@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
package/lib/Dialog.mjs
CHANGED
|
@@ -5,8 +5,8 @@ import _assign from 'lodash/fp/assign';
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import styled, { css } from 'styled-components';
|
|
7
7
|
import { darken } from 'polished';
|
|
8
|
-
import { media, getColor,
|
|
9
|
-
import {
|
|
8
|
+
import { media, getColor, customTheme, callIfFunction } from '@startlibs/utils';
|
|
9
|
+
import { StartlibsConsumer, useEnsureRef } from '@startlibs/core';
|
|
10
10
|
import { Button } from './Button.mjs';
|
|
11
11
|
import { Icon } from './Icon.mjs';
|
|
12
12
|
import { LoadingDiv } from './LoadingDiv.mjs';
|
|
@@ -14,7 +14,10 @@ import { fixDoubledLastMarginBottom } from './SplitColumnsContainer.mjs';
|
|
|
14
14
|
import { DialogContainer } from './containers/DialogContainer.mjs';
|
|
15
15
|
import { willUseIsSticky } from './willUseIsSticky.mjs';
|
|
16
16
|
|
|
17
|
-
const _excluded = ["
|
|
17
|
+
const _excluded = ["fixTitleMargin"],
|
|
18
|
+
_excluded2 = ["sticky", "isSticky"],
|
|
19
|
+
_excluded3 = ["className", "style", "skipWrap", "wrapChildren", "stickyFooter", "fixTitleMargin", "skipCloseIcon", "isLoading", "footer", "Content", "children", "title", "illustration", "icon", "auxiliarActions", "container", "onClose"],
|
|
20
|
+
_excluded4 = ["tagAs"];
|
|
18
21
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
19
22
|
const DialogIcon = /*#__PURE__*/styled(Icon).withConfig({
|
|
20
23
|
displayName: "Dialog__DialogIcon",
|
|
@@ -38,14 +41,31 @@ const DialogContent = /*#__PURE__*/styled(props => /*#__PURE__*/React.createElem
|
|
|
38
41
|
displayName: "Dialog__DialogContent",
|
|
39
42
|
componentId: "sc-gai4ey-3"
|
|
40
43
|
})(["outline:none;width:100%;position:relative;min-height:5rem;", " ", " p{font-size:14px;}"], props => props.icon && css(["padding-right:8rem;min-height:6rem;"]), props => props.illustration && css(["padding-right:15rem;", ""], media.mobile(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding-right: 1.5rem;\n "])))));
|
|
41
|
-
|
|
44
|
+
|
|
45
|
+
// Host tag (styled.h2) com prop lida só no template: o styled-components filtra sozinho antes do
|
|
46
|
+
// DOM, mas o yak não filtra atributo inválido em host tag puro — tira-se fixTitleMargin à mão.
|
|
47
|
+
const TitleBase = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
48
|
+
let props = _objectWithoutProperties(_ref, _excluded);
|
|
49
|
+
return /*#__PURE__*/React.createElement("h2", _extends({
|
|
50
|
+
ref: ref
|
|
51
|
+
}, props));
|
|
52
|
+
});
|
|
53
|
+
const DialogTitle = /*#__PURE__*/styled(TitleBase).withConfig({
|
|
42
54
|
displayName: "Dialog__DialogTitle",
|
|
43
55
|
componentId: "sc-gai4ey-4"
|
|
44
56
|
})(["margin-bottom:1rem;padding-bottom:1rem;", " ", ""], props => props.fixTitleMargin && "\n padding-bottom: 0;\n ", media.mobile(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-size: 19px;\n "]))));
|
|
45
|
-
|
|
57
|
+
|
|
58
|
+
// Mesma razão do TitleBase acima: sticky/isSticky só existem pro template, tiram-se antes do DOM.
|
|
59
|
+
const FooterBase = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
60
|
+
let props = _objectWithoutProperties(_ref2, _excluded2);
|
|
61
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
62
|
+
ref: ref
|
|
63
|
+
}, props));
|
|
64
|
+
});
|
|
65
|
+
const DialogFooter = /*#__PURE__*/styled(FooterBase).withConfig({
|
|
46
66
|
displayName: "Dialog__DialogFooter",
|
|
47
67
|
componentId: "sc-gai4ey-5"
|
|
48
|
-
})(["display:block;padding-top:1rem;margin-top:1rem;align-items:stretch;text-align:right;", " ", " ", ":not(.styled-button-colored){background:", ";color:", ";&:hover{background:", ";}&:active{background:", ";}}"], props => props.sticky && css(["position:sticky;background:white;width:inherit;z-index:50;", " ", " ", ""], media.desktop(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n bottom: -3rem;\n margin-left: -2rem;\n margin-right: -2rem;\n margin-bottom: -1.5rem;\n margin-top: 0.5rem;\n padding: 1.5rem 2rem;\n border-radius: 0 0 1rem 1rem;\n "]))), media.mobile(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n bottom: -0.5rem;\n padding: 0.75rem 1.75rem;\n margin-bottom: -1rem;\n margin-left: -1.75rem;\n margin-right: -1.75rem;\n "])))
|
|
68
|
+
})(["display:block;padding-top:1rem;margin-top:1rem;align-items:stretch;text-align:right;", " ", " ", ":not(.styled-button-colored){background:", ";color:", ";&:hover{background:", ";}&:active{background:", ";}}"], props => props.sticky && css(["position:sticky;background:white;width:inherit;z-index:50;", " ", " ", ""], props => props.isSticky && "\n box-shadow: 0 0px 2px 0 rgba(0,0,0,0.1), 0 0px 5px 1px rgba(0,0,0,0.15);\n border-radius: 0;\n ", media.desktop(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n bottom: -3rem;\n margin-left: -2rem;\n margin-right: -2rem;\n margin-bottom: -1.5rem;\n margin-top: 0.5rem;\n padding: 1.5rem 2rem;\n border-radius: 0 0 1rem 1rem;\n "]))), media.mobile(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n bottom: -0.5rem;\n padding: 0.75rem 1.75rem;\n margin-bottom: -1rem;\n margin-left: -1.75rem;\n margin-right: -1.75rem;\n "])))), media.max(370)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n ", " {\n min-width: unset;\n padding-left: 1.25rem;\n padding-right: 1.25rem;\n }\n "])), Button), Button, props => darken(0.03, getColor('bluishGray')(props)), getColor('gray90'), props => darken(0.06, getColor('bluishGray')(props)), props => darken(0.09, getColor('bluishGray')(props)));
|
|
49
69
|
const FooterAuxiliaryContainer = /*#__PURE__*/styled.div.withConfig({
|
|
50
70
|
displayName: "Dialog__FooterAuxiliaryContainer",
|
|
51
71
|
componentId: "sc-gai4ey-6"
|
|
@@ -63,9 +83,10 @@ const DialogAlwaysVisibleDiv = /*#__PURE__*/styled.div.withConfig({
|
|
|
63
83
|
})(["padding:2rem 2rem 0;margin:-2rem;", ""], media.mobile(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n padding: 1.75rem 1.75rem 0;\n margin: -1.75rem;\n "]))));
|
|
64
84
|
// END
|
|
65
85
|
|
|
66
|
-
const
|
|
86
|
+
const DialogInner = /*#__PURE__*/React.forwardRef((_ref3, outerRef) => {
|
|
67
87
|
let {
|
|
68
88
|
className,
|
|
89
|
+
style,
|
|
69
90
|
skipWrap,
|
|
70
91
|
wrapChildren,
|
|
71
92
|
stickyFooter,
|
|
@@ -81,8 +102,8 @@ const Dialog = /*#__PURE__*/styled(/*#__PURE__*/React.forwardRef((_ref, outerRef
|
|
|
81
102
|
auxiliarActions,
|
|
82
103
|
container = true,
|
|
83
104
|
onClose
|
|
84
|
-
} =
|
|
85
|
-
props = _objectWithoutProperties(
|
|
105
|
+
} = _ref3,
|
|
106
|
+
props = _objectWithoutProperties(_ref3, _excluded3);
|
|
86
107
|
const ref = useEnsureRef(outerRef);
|
|
87
108
|
const [WithIsSticky] = willUseIsSticky();
|
|
88
109
|
const handleClose = React.useCallback(async () => {
|
|
@@ -109,6 +130,7 @@ const Dialog = /*#__PURE__*/styled(/*#__PURE__*/React.forwardRef((_ref, outerRef
|
|
|
109
130
|
}, auxiliarActions && /*#__PURE__*/React.createElement(FooterAuxiliaryContainer, null, callIfFunction(auxiliarActions)), callIfFunction(footer)), sentinel())));
|
|
110
131
|
const dialog = confirmCloseDialog => /*#__PURE__*/React.createElement("div", {
|
|
111
132
|
className: className + " JS-has-wc JS-dialog",
|
|
133
|
+
style: style,
|
|
112
134
|
ref: ref
|
|
113
135
|
}, skipWrap ? /*#__PURE__*/React.createElement(React.Fragment, null, alwaysVisible(confirmCloseDialog), content) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DialogAlwaysVisibleDiv, null, alwaysVisible(confirmCloseDialog)), /*#__PURE__*/React.createElement(DialogContentWrapper, {
|
|
114
136
|
isLoading: isLoading
|
|
@@ -118,23 +140,37 @@ const Dialog = /*#__PURE__*/styled(/*#__PURE__*/React.forwardRef((_ref, outerRef
|
|
|
118
140
|
ref: ref,
|
|
119
141
|
title: title,
|
|
120
142
|
closeDialog: handleClose
|
|
121
|
-
}),
|
|
143
|
+
}), _ref4 => {
|
|
122
144
|
let {
|
|
123
145
|
confirmCloseDialog
|
|
124
|
-
} =
|
|
146
|
+
} = _ref4;
|
|
125
147
|
return dialog(confirmCloseDialog);
|
|
126
148
|
}) : dialog(handleClose);
|
|
127
|
-
})
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// R6: "as" não existe no yak. tagAs troca o componente/tag renderizado (ex.: DialogErrorContent
|
|
152
|
+
// usa tagAs="div" pra reaproveitar o CSS do Dialog sem a lógica interna; DialogWithSidebar usa
|
|
153
|
+
// tagAs={DialogWithSidebarPresentation}); sem tagAs, renderiza o Dialog de verdade (DialogInner).
|
|
154
|
+
const DialogTagAs = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
|
|
155
|
+
let {
|
|
156
|
+
tagAs: Tag = DialogInner
|
|
157
|
+
} = _ref5,
|
|
158
|
+
props = _objectWithoutProperties(_ref5, _excluded4);
|
|
159
|
+
return /*#__PURE__*/React.createElement(Tag, _extends({
|
|
160
|
+
ref: ref
|
|
161
|
+
}, props));
|
|
162
|
+
});
|
|
163
|
+
const Dialog = /*#__PURE__*/styled(DialogTagAs).withConfig({
|
|
128
164
|
displayName: "Dialog",
|
|
129
165
|
componentId: "sc-gai4ey-9"
|
|
130
|
-
})(["@supports (position:sticky){will-change:transform,opacity;&.JS-wc-off{will-change:auto;}}border-radius:24px;padding:2rem;background-color:white;width:100%;max-width:45rem;", " margin:auto;position:relative;align-self:baseline;display:block;> h3:first-child{margin-top:0.5rem;}p{line-height:140%;}", " ", " ", ""], props => props.$maxWidth && css(["max-width:", ";"], props.$maxWidth), media.mobile(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n padding: 1.75rem;\n max-width: 100%;\n ", ";\n "])), props => props.fullscreenOnMobile && "\n border-radius: 0;\n min-height: 100%;\n "), props => props.closeDialog && css(["", "{padding-right:2rem;}"], DialogTitle), customTheme('Dialog'));
|
|
166
|
+
})(["@supports (position:sticky){will-change:transform,opacity;&.JS-wc-off{will-change:auto;}}border-radius:24px;padding:2rem;background-color:white;width:100%;max-width:45rem;", " margin:auto;position:relative;align-self:baseline;display:block;overflow:clip;> h3:first-child{margin-top:0.5rem;}p{line-height:140%;}", " ", " ", ""], props => props.$maxWidth && css(["max-width:", ";"], props => props.$maxWidth), media.mobile(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n padding: 1.75rem;\n max-width: 100%;\n ", ";\n "])), props => props.fullscreenOnMobile && "\n border-radius: 0;\n min-height: 100%;\n "), props => props.closeDialog && css(["", "{padding-right:2rem;}"], DialogTitle), customTheme('Dialog'));
|
|
131
167
|
const ConfirmDialog = props => /*#__PURE__*/React.createElement(Dialog, _extends({}, props, {
|
|
132
168
|
placement: "Confirm-Dialog"
|
|
133
169
|
}), props.children);
|
|
134
|
-
const DefaultConfirmDialog = props => /*#__PURE__*/React.createElement(StartlibsConsumer, null,
|
|
170
|
+
const DefaultConfirmDialog = props => /*#__PURE__*/React.createElement(StartlibsConsumer, null, _ref6 => {
|
|
135
171
|
let {
|
|
136
172
|
confirmDialogLabels
|
|
137
|
-
} =
|
|
173
|
+
} = _ref6;
|
|
138
174
|
const handleCancel = async () => {
|
|
139
175
|
if (props.onCancel) props.onCancel();
|
|
140
176
|
if (props.onClose) await props.onClose().catch(console.error);
|
|
@@ -169,26 +205,26 @@ const DialogErrorBadge = /*#__PURE__*/styled.div.withConfig({
|
|
|
169
205
|
displayName: "Dialog__DialogErrorBadge",
|
|
170
206
|
componentId: "sc-gai4ey-11"
|
|
171
207
|
})(["width:72px;height:72px;margin:0 auto 1.5rem;border-radius:50%;background:rgba(0,0,0,0.06);display:flex;align-items:center;justify-content:center;", "{font-size:40px;color:rgba(0,0,0,0.4);}"], Icon);
|
|
172
|
-
const DialogErrorContent =
|
|
208
|
+
const DialogErrorContent = _ref7 => {
|
|
173
209
|
let {
|
|
174
210
|
closeDialog,
|
|
175
211
|
onClose,
|
|
176
212
|
title
|
|
177
|
-
} =
|
|
213
|
+
} = _ref7;
|
|
178
214
|
const handleClose = React.useCallback(async () => {
|
|
179
215
|
if (onClose) await onClose().catch(console.error);
|
|
180
216
|
if (closeDialog) closeDialog();
|
|
181
217
|
}, [onClose, closeDialog]);
|
|
182
|
-
return /*#__PURE__*/React.createElement(StartlibsConsumer, null,
|
|
218
|
+
return /*#__PURE__*/React.createElement(StartlibsConsumer, null, _ref8 => {
|
|
183
219
|
let {
|
|
184
220
|
ErrorDialog: {
|
|
185
221
|
title,
|
|
186
222
|
content,
|
|
187
223
|
close
|
|
188
224
|
}
|
|
189
|
-
} =
|
|
225
|
+
} = _ref8;
|
|
190
226
|
return /*#__PURE__*/React.createElement(Dialog, {
|
|
191
|
-
|
|
227
|
+
tagAs: "div",
|
|
192
228
|
$maxWidth: "30rem"
|
|
193
229
|
}, closeDialog && /*#__PURE__*/React.createElement(CloseIcon, {
|
|
194
230
|
onClick: handleClose
|
|
@@ -203,21 +239,21 @@ const DialogErrorContent = _ref4 => {
|
|
|
203
239
|
}, close))));
|
|
204
240
|
});
|
|
205
241
|
};
|
|
206
|
-
const DialogError =
|
|
242
|
+
const DialogError = _ref9 => {
|
|
207
243
|
let {
|
|
208
244
|
closeDialog,
|
|
209
245
|
onClose
|
|
210
|
-
} =
|
|
246
|
+
} = _ref9;
|
|
211
247
|
const handleClose = React.useCallback(async () => {
|
|
212
248
|
if (onClose) await onClose().catch(console.error);
|
|
213
249
|
if (closeDialog) closeDialog();
|
|
214
250
|
}, [onClose, closeDialog]);
|
|
215
|
-
return /*#__PURE__*/React.createElement(StartlibsConsumer, null,
|
|
251
|
+
return /*#__PURE__*/React.createElement(StartlibsConsumer, null, _ref10 => {
|
|
216
252
|
let {
|
|
217
253
|
ErrorDialog: {
|
|
218
254
|
title
|
|
219
255
|
}
|
|
220
|
-
} =
|
|
256
|
+
} = _ref10;
|
|
221
257
|
return /*#__PURE__*/React.createElement(Dialog, {
|
|
222
258
|
closeDialog: handleClose,
|
|
223
259
|
title: title
|
package/lib/Dialog.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.mjs","sources":["../src/Dialog.jsx"],"sourcesContent":["import React from 'react';\nimport _ from 'lodash/fp'\nimport styled, {css} from 'styled-components'\nimport {darken} from 'polished'\n\nimport {callIfFunction, customTheme, getColor, media} from '@startlibs/utils'\nimport {StartlibsConsumer, useEnsureRef} from '@startlibs/core'\n\nimport {Button} from './Button'\nimport {Icon} from './Icon'\nimport {LoadingDiv} from './LoadingDiv'\nimport {fixDoubledLastMarginBottom} from './SplitColumnsContainer'\nimport {DialogContainer} from './containers/DialogContainer'\nimport {willUseIsSticky} from './willUseIsSticky'\n\nexport const DialogIcon = styled(Icon)`\n font-size: 60px;\n width: 8rem;\n text-align: center;\n color: #d2d2d2;\n right: 0;\n top: 1rem;\n position: absolute;\n ${media.desktop`\n top: 0\n `}\n`\n\nconst CloseIcon = styled(Icon).attrs(_.assign({icon: 'x'}))`\n position: absolute;\n width: 32px;\n height: 32px;\n font-size: 24px;\n line-height: 32px;\n cursor: pointer;\n border-radius: 50%;\n text-align: center;\n color: rgba(0,0,0,0.3);\n transition: 0.2s linear;\n z-index: 1000;\n top: 1rem;\n right: 1rem;\n &:hover {\n background-color: rgba(0,0,0,0.075);\n }\n `\n\nconst DialogIllustration = styled.img`\n max-width: 16rem;\n position: absolute;\n right: 1rem;\n bottom: 0;\n ${media.mobile`\n display: none;\n `}\n`\n\nconst DialogContent = styled((props) =>\n <div {...props}>\n {fixDoubledLastMarginBottom(props.children)}\n {props.icon && <DialogIcon icon={props.icon}/>}\n {props.illustration && <DialogIllustration src={props.illustration}/>}\n </div>\n)`\n outline:none;\n width: 100%;\n position: relative;\n min-height: 5rem;\n ${props => props.icon && css`\n padding-right: 8rem;\n min-height: 6rem;\n `}\n ${props => props.illustration && css`\n padding-right: 15rem;\n ${media.mobile`\n padding-right: 1.5rem;\n `}\n `}\n p {\n font-size: 14px;\n }\n `\n\nconst DialogTitle = styled.h2`\n margin-bottom: 1rem;\n padding-bottom: 1rem;\n ${props => props.fixTitleMargin && `\n padding-bottom: 0;\n `}\n ${media.mobile`\n font-size: 19px;\n `}\n`\n\nconst DialogFooter = styled.div`\n display: block;\n padding-top: 1rem;\n margin-top: 1rem;\n align-items: stretch;\n text-align: right;\n ${props => props.sticky && css`\n position: sticky;\n background: white;\n width: inherit;\n z-index: 50;\n ${media.desktop`\n bottom: -3rem;\n margin-left: -2rem;\n margin-right: -2rem;\n margin-bottom: -1.5rem;\n margin-top: 0.5rem;\n padding: 1.5rem 2rem;\n border-radius: 0 0 1rem 1rem;\n `}\n ${media.mobile`\n bottom: -0.5rem;\n padding: 0.75rem 1.75rem;\n margin-bottom: -1rem;\n margin-left: -1.75rem;\n margin-right: -1.75rem;\n `}\n ${props => props.isSticky && `\n box-shadow: 0 0px 2px 0 rgba(0,0,0,0.1), 0 0px 5px 1px rgba(0,0,0,0.15);\n border-radius: 0;\n `}\n `}\n ${media.max(370)`\n ${Button} {\n min-width: unset;\n padding-left: 1.25rem;\n padding-right: 1.25rem;\n }\n `}\n // Footer's plain (non-colored) buttons use the \"light\" look; colored variants keep their color.\n // ponytail: for a plain footer button that shows a loading spinner, pass \\`light\\` explicitly so the spinner renders dark instead of white-on-light.\n ${Button}:not(.styled-button-colored) {\n background: ${props => darken(0.03, getColor('bluishGray')(props))};\n color: ${getColor('gray90')};\n &:hover {\n background: ${props => darken(0.06, getColor('bluishGray')(props))};\n }\n &:active {\n background: ${props => darken(0.09, getColor('bluishGray')(props))};\n }\n }\n `\n\nconst FooterAuxiliaryContainer = styled.div`\n flex-grow: 1;\n align-self: center;\n display: inline-block;\n padding-right: 1rem;\n float: left;\n`\n\n// THIS IS NEEDED FOR LOADING ANIMATION ON DialogWithImageHeader\n\nexport const DialogContentWrapper = styled(LoadingDiv)`\n padding: 2rem;\n margin: -2rem;\n ${media.mobile`\n padding: 1.75rem;\n margin: -1.75rem;\n `}\n`\nconst DialogAlwaysVisibleDiv = styled.div`\n padding: 2rem 2rem 0;\n margin: -2rem;\n ${media.mobile`\n padding: 1.75rem 1.75rem 0;\n margin: -1.75rem;\n `}\n`\n// END\n\nconst Dialog = styled(React.forwardRef(({className, skipWrap, wrapChildren, stickyFooter, fixTitleMargin, skipCloseIcon, isLoading, footer, Content, children, title, illustration, icon, auxiliarActions, container = true, onClose, ...props}, outerRef) => {\n const ref = useEnsureRef(outerRef)\n const [WithIsSticky] = willUseIsSticky()\n\n const handleClose = React.useCallback(async () => {\n if (onClose) await onClose().catch(console.error)\n if (props.closeDialog) props.closeDialog()\n }, [onClose, props.closeDialog])\n\n const alwaysVisible = (confirmCloseDialog) => <>\n {\n props.closeDialog && !skipCloseIcon &&\n <CloseIcon className=\"JS-dialog-close\" onClick={confirmCloseDialog}/>\n }\n {\n title &&\n <DialogTitle fixTitleMargin>{callIfFunction(title)}</DialogTitle>\n }\n </>\n\n const content = <>\n {\n Content &&\n <DialogContent icon={icon} illustration={illustration}>{callIfFunction(Content)}</DialogContent>\n }\n {\n !Content && children &&\n <DialogContent icon={icon} illustration={illustration}>{wrapChildren ? wrapChildren(children) : callIfFunction(children)}</DialogContent>\n }\n {\n Content && children && (wrapChildren ? wrapChildren(children) : callIfFunction(children))\n }\n {\n footer &&\n <WithIsSticky bottom>{(sentinel, isSticky) => <>\n <DialogFooter isSticky={isSticky} sticky={stickyFooter}>\n {auxiliarActions && <FooterAuxiliaryContainer>{callIfFunction(auxiliarActions)}</FooterAuxiliaryContainer>}\n {callIfFunction(footer)}\n </DialogFooter>\n {sentinel()}\n </>\n }</WithIsSticky>\n }\n </>\n\n const dialog = (confirmCloseDialog) => <div\n className={className + \" JS-has-wc JS-dialog\"}\n ref={ref}\n >\n {skipWrap\n ? <>\n {alwaysVisible(confirmCloseDialog)}\n {content}\n </>\n : <>\n <DialogAlwaysVisibleDiv>\n {alwaysVisible(confirmCloseDialog)}\n </DialogAlwaysVisibleDiv>\n <DialogContentWrapper isLoading={isLoading}>\n {content}\n </DialogContentWrapper>\n </>\n }\n </div>\n\n return container\n ? <DialogContainer {...props} DialogErrorContent={DialogErrorContent}\n ref={ref}\n title={title}\n closeDialog={handleClose}\n >{({confirmCloseDialog}) => dialog(confirmCloseDialog)}</DialogContainer>\n : dialog(handleClose)\n}))`\n @supports (position:sticky) {\n will-change: transform, opacity;\n &.JS-wc-off {\n will-change: auto;\n }\n }\n \n border-radius: 24px;\n padding: 2rem;\n background-color: white;\n width: 100%;\n max-width: 45rem;\n /* Override opcional via prop. Fica ANTES do media.mobile de propósito: no mobile\n o max-width:100% de lá continua ganhando. Inerte sem a prop → zero efeito em\n quem já ajusta a largura por css=\"max-width:...\". */\n ${props => props.$maxWidth && css`max-width: ${props.$maxWidth};`}\n margin: auto;\n position: relative;\n align-self: baseline;\n display: block; \n > h3:first-child {\n margin-top: 0.5rem;\n }\n p {\n line-height: 140%;\n }\n ${media.mobile`\n padding: 1.75rem;\n max-width: 100%;\n ${props => props.fullscreenOnMobile && `\n border-radius: 0;\n min-height: 100%;\n `};\n `}\n ${props => props.closeDialog && css`\n ${DialogTitle} {\n padding-right: 2rem;\n }\n `}\n ${customTheme('Dialog')}\n`\n\n\nexport {\n FooterAuxiliaryContainer,\n DialogTitle,\n DialogFooter,\n DialogContent,\n CloseIcon,\n Dialog\n}\n\nexport const ConfirmDialog = (props) => <Dialog {...props} placement=\"Confirm-Dialog\">{props.children}</Dialog>\n\nexport const DefaultConfirmDialog = (props) => (\n <StartlibsConsumer>{({confirmDialogLabels}) => {\n const handleCancel = async () => {\n if (props.onCancel) props.onCancel()\n if (props.onClose) await props.onClose().catch(console.error)\n }\n\n return (\n <ConfirmDialog\n title={confirmDialogLabels.title}\n closeDialog={handleCancel}\n onClose={props.onClose}\n onConfirm={props.onConfirm}\n footer={<>\n <Button onClick={handleCancel}>{confirmDialogLabels.cancel}</Button>\n <Button\n hover=\"success\" isLoading={props.isLoading}\n onClick={props.onSaveInstead}\n >{confirmDialogLabels.confirm}</Button>\n <Button autoFocus alert onClick={props.onConfirm}>{confirmDialogLabels.discard}</Button>\n </>}\n >\n <p>{confirmDialogLabels.content}</p>\n </ConfirmDialog>\n )}}\n </StartlibsConsumer>)\n\n// Estado de erro genérico da dialog: badge circular centralizado (mesma linguagem\n// dos error pages da app) no lugar do ícone cinza flutuando no canto. Cores em rgba\n// (não getColor) pra não depender dos tokens de tema da app que consome a lib.\nconst DialogErrorLayout = styled.div`\n text-align: center;\n /* max-width (não <br/>) força a quebra do título em ~2 linhas como o error page,\n mas deixa telas estreitas quebrarem sozinhas. Ajuste fino se o corte não bater. */\n ${DialogTitle} {\n max-width: 18rem;\n margin-left: auto;\n margin-right: auto;\n }\n ${DialogContent} {\n min-height: 0; /* mata o vão vazio que sobrava acima do botão */\n p {\n max-width: 20rem;\n margin-left: auto;\n margin-right: auto;\n }\n }\n ${DialogFooter} {\n text-align: center;\n margin-top: 0;\n padding-top: 0.5rem;\n }\n`\n\nconst DialogErrorBadge = styled.div`\n width: 72px;\n height: 72px;\n margin: 0 auto 1.5rem;\n border-radius: 50%;\n background: rgba(0, 0, 0, 0.06);\n display: flex;\n align-items: center;\n justify-content: center;\n ${Icon} {\n font-size: 40px;\n color: rgba(0, 0, 0, 0.4);\n }\n`\n\nexport const DialogErrorContent = ({ closeDialog, onClose, title }) => {\n const handleClose = React.useCallback(async () => {\n if (onClose) await onClose().catch(console.error)\n if (closeDialog) closeDialog()\n }, [onClose, closeDialog])\n\n return (\n <StartlibsConsumer>\n {({ ErrorDialog: { title, content, close } }) => (\n <Dialog as=\"div\" $maxWidth=\"30rem\">\n {closeDialog && <CloseIcon onClick={handleClose} />}\n <DialogErrorLayout>\n <DialogErrorBadge><Icon icon=\"warning\"/></DialogErrorBadge>\n {title && <DialogTitle fixTitleMargin>{title}</DialogTitle>}\n <DialogContent>{content}</DialogContent>\n <DialogFooter>\n <Button highlight rounded onClick={handleClose}>{close}</Button>\n </DialogFooter>\n </DialogErrorLayout>\n </Dialog>\n )}\n </StartlibsConsumer>\n )\n}\n\nexport const DialogError = ({ closeDialog, onClose }) => {\n const handleClose = React.useCallback(async () => {\n if (onClose) await onClose().catch(console.error)\n if (closeDialog) closeDialog()\n }, [onClose, closeDialog])\n\n return (\n <StartlibsConsumer>\n {({ ErrorDialog: { title } }) => (\n <Dialog closeDialog={handleClose} title={title}>\n <DialogErrorContent closeDialog={handleClose} onClose={onClose} />\n </Dialog>\n )}\n </StartlibsConsumer>\n )\n}\n"],"names":["DialogIcon","styled","Icon","withConfig","displayName","componentId","media","desktop","_templateObject","_taggedTemplateLiteral","CloseIcon","attrs","_assign","icon","DialogIllustration","img","mobile","_templateObject2","DialogContent","props","React","createElement","fixDoubledLastMarginBottom","children","illustration","src","css","_templateObject3","DialogTitle","h2","fixTitleMargin","_templateObject4","DialogFooter","div","sticky","_templateObject5","_templateObject6","isSticky","max","_templateObject7","Button","darken","getColor","FooterAuxiliaryContainer","DialogContentWrapper","LoadingDiv","_templateObject8","DialogAlwaysVisibleDiv","_templateObject9","Dialog","forwardRef","_ref","outerRef","className","skipWrap","wrapChildren","stickyFooter","skipCloseIcon","isLoading","footer","Content","title","auxiliarActions","container","onClose","_objectWithoutProperties","_excluded","ref","useEnsureRef","WithIsSticky","willUseIsSticky","handleClose","useCallback","catch","console","error","closeDialog","alwaysVisible","confirmCloseDialog","Fragment","onClick","callIfFunction","content","bottom","sentinel","dialog","DialogContainer","_extends","DialogErrorContent","_ref2","$maxWidth","_templateObject10","fullscreenOnMobile","customTheme","ConfirmDialog","placement","DefaultConfirmDialog","StartlibsConsumer","_ref3","confirmDialogLabels","handleCancel","onCancel","onConfirm","cancel","hover","onSaveInstead","confirm","autoFocus","alert","discard","DialogErrorLayout","DialogErrorBadge","_ref4","_ref5","ErrorDialog","close","as","highlight","rounded","DialogError","_ref6","_ref7"],"mappings":";;;;;;;;;;;;;;;;;;AAeO,MAAMA,UAAU,gBAAGC,MAAM,CAACC,IAAI,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,oBAAA;EAAAC,WAAA,EAAA,aAAA;AAAA,CAQlCC,CAAAA,CAAAA,CAAAA,+FAAAA,EAAAA,EAAAA,CAAAA,EAAAA,KAAK,CAACC,OAAO,CAAAC,eAAA,KAAAA,eAAA,GAAAC,sBAAA,CAGhB,CAAA,kBAAA,CAAA,CAAA,CAAA,CAAA,EAAA;AAEKC,MAAAA,SAAS,gBAAGT,MAAM,CAACC,IAAI,CAAC,CAACS,KAAK,CAACC,OAAA,CAAS;AAACC,EAAAA,IAAI,EAAE,GAAA;AAAG,CAAC,CAAC,CAAC,CAAAV,UAAA,CAAA;EAAAC,WAAA,EAAA,mBAAA;EAAAC,WAAA,EAAA,aAAA;AAAA,CAiBxD,CAAA,CAAA,CAAA,wPAAA,CAAA,EAAA;AAEH,MAAMS,kBAAkB,gBAAGb,MAAM,CAACc,GAAG,CAAAZ,UAAA,CAAA;EAAAC,WAAA,EAAA,4BAAA;EAAAC,WAAA,EAAA,aAAA;AAAA,CAK/BC,CAAAA,CAAAA,CAAAA,wDAAAA,EAAAA,EAAAA,CAAAA,EAAAA,KAAK,CAACU,MAAM,CAAAC,gBAAA,KAAAA,gBAAA,GAAAR,sBAAA,CAGj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D,KAAK,CAACoD,WAAW,CAAC,YAAY;AAChD,IAAA,IAAIR,OAAO,EAAE,MAAMA,OAAO,EAAE,CAACS,KAAK,CAACC,OAAO,CAACC,KAAK,CAAC,CAAA;AACjD,IAAA,IAAIC,WAAW,EAAEA,WAAW,EAAE,CAAA;AAChC,GAAC,EAAE,CAACZ,OAAO,EAAEY,WAAW,CAAC,CAAC,CAAA;AAE1B,EAAA,oBACExD,KAAA,CAAAC,aAAA,CAAC4E,iBAAiB,QACfwB,KAAA,IAAA;IAAA,IAAC;AAAEP,MAAAA,WAAW,EAAE;AAAErD,QAAAA,KAAAA;AAAM,OAAA;AAAE,KAAC,GAAA4D,KAAA,CAAA;AAAA,IAAA,oBAC1BrG,KAAA,CAAAC,aAAA,CAAC4B,MAAM,EAAA;AAAC2B,MAAAA,WAAW,EAAEL,WAAY;AAACV,MAAAA,KAAK,EAAEA,KAAAA;AAAM,KAAA,eAC7CzC,KAAA,CAAAC,aAAA,CAACmE,kBAAkB,EAAA;AAACZ,MAAAA,WAAW,EAAEL,WAAY;AAACP,MAAAA,OAAO,EAAEA,OAAAA;AAAQ,KAAE,CAC3D,CAAC,CAAA;AAAA,GAEM,CAAC,CAAA;AAExB;;;;"}
|
|
1
|
+
{"version":3,"file":"Dialog.mjs","sources":["../src/Dialog.jsx"],"sourcesContent":["import React from 'react';\nimport _ from 'lodash/fp'\nimport styled, {css} from 'styled-components'\nimport {darken} from 'polished'\n\nimport {callIfFunction, customTheme, getColor, media} from '@startlibs/utils'\nimport {StartlibsConsumer, useEnsureRef} from '@startlibs/core'\n\nimport {Button} from './Button'\nimport {Icon} from './Icon'\nimport {LoadingDiv} from './LoadingDiv'\nimport {fixDoubledLastMarginBottom} from './SplitColumnsContainer'\nimport {DialogContainer} from './containers/DialogContainer'\nimport {willUseIsSticky} from './willUseIsSticky'\n\nexport const DialogIcon = styled(Icon)`\n font-size: 60px;\n width: 8rem;\n text-align: center;\n color: #d2d2d2;\n right: 0;\n top: 1rem;\n position: absolute;\n ${media.desktop`\n top: 0\n `}\n`\n\nconst CloseIcon = styled(Icon).attrs(_.assign({icon: 'x'}))`\n position: absolute;\n width: 32px;\n height: 32px;\n font-size: 24px;\n line-height: 32px;\n cursor: pointer;\n border-radius: 50%;\n text-align: center;\n color: rgba(0,0,0,0.3);\n transition: 0.2s linear;\n z-index: 1000;\n top: 1rem;\n right: 1rem;\n &:hover {\n background-color: rgba(0,0,0,0.075);\n }\n `\n\nconst DialogIllustration = styled.img`\n max-width: 16rem;\n position: absolute;\n right: 1rem;\n bottom: 0;\n ${media.mobile`\n display: none;\n `}\n`\n\nconst DialogContent = styled((props) =>\n <div {...props}>\n {fixDoubledLastMarginBottom(props.children)}\n {props.icon && <DialogIcon icon={props.icon}/>}\n {props.illustration && <DialogIllustration src={props.illustration}/>}\n </div>\n)`\n outline:none;\n width: 100%;\n position: relative;\n min-height: 5rem;\n ${props => props.icon && css`\n padding-right: 8rem;\n min-height: 6rem;\n `}\n ${props => props.illustration && css`\n padding-right: 15rem;\n ${media.mobile`\n padding-right: 1.5rem;\n `}\n `}\n p {\n font-size: 14px;\n }\n `\n\n// Host tag (styled.h2) com prop lida só no template: o styled-components filtra sozinho antes do\n// DOM, mas o yak não filtra atributo inválido em host tag puro — tira-se fixTitleMargin à mão.\nconst TitleBase = React.forwardRef(({fixTitleMargin, ...props}, ref) => <h2 ref={ref} {...props}/>)\nconst DialogTitle = styled(TitleBase)`\n margin-bottom: 1rem;\n padding-bottom: 1rem;\n ${props => props.fixTitleMargin && `\n padding-bottom: 0;\n `}\n ${media.mobile`\n font-size: 19px;\n `}\n`\n\n// Mesma razão do TitleBase acima: sticky/isSticky só existem pro template, tiram-se antes do DOM.\nconst FooterBase = React.forwardRef(({sticky, isSticky, ...props}, ref) => <div ref={ref} {...props}/>)\nconst DialogFooter = styled(FooterBase)`\n display: block;\n padding-top: 1rem;\n margin-top: 1rem;\n align-items: stretch;\n text-align: right;\n ${props => props.sticky && css`\n position: sticky;\n background: white;\n width: inherit;\n z-index: 50;\n /* isSticky ANTES dos blocos media.* de propósito: stylis (sc) hoisteia @media pro fim do\n CSS gerado, então mesmo escrito aqui em cima, o border-radius do media.desktop sempre\n ganhava do border-radius:0 daqui em produção — o box-shadow/border-radius:0 nunca eram\n vistos no desktop. O yak mantém a ordem literal do fonte; colocando isSticky antes, as\n duas saem iguais (idem Task 12, ToastBox). */\n ${props => props.isSticky && `\n box-shadow: 0 0px 2px 0 rgba(0,0,0,0.1), 0 0px 5px 1px rgba(0,0,0,0.15);\n border-radius: 0;\n `}\n ${media.desktop`\n bottom: -3rem;\n margin-left: -2rem;\n margin-right: -2rem;\n margin-bottom: -1.5rem;\n margin-top: 0.5rem;\n padding: 1.5rem 2rem;\n border-radius: 0 0 1rem 1rem;\n `}\n ${media.mobile`\n bottom: -0.5rem;\n padding: 0.75rem 1.75rem;\n margin-bottom: -1rem;\n margin-left: -1.75rem;\n margin-right: -1.75rem;\n `}\n `}\n ${media.max(370)`\n ${Button} {\n min-width: unset;\n padding-left: 1.25rem;\n padding-right: 1.25rem;\n }\n `}\n /* Footer's plain (non-colored) buttons use the \"light\" look; colored variants keep their color. */\n /* ponytail: for a plain footer button that shows a loading spinner, pass \\`light\\` explicitly so the spinner renders dark instead of white-on-light. */\n ${Button}:not(.styled-button-colored) {\n background: ${props => darken(0.03, getColor('bluishGray')(props))};\n color: ${getColor('gray90')};\n &:hover {\n background: ${props => darken(0.06, getColor('bluishGray')(props))};\n }\n &:active {\n background: ${props => darken(0.09, getColor('bluishGray')(props))};\n }\n }\n `\n\nconst FooterAuxiliaryContainer = styled.div`\n flex-grow: 1;\n align-self: center;\n display: inline-block;\n padding-right: 1rem;\n float: left;\n`\n\n// THIS IS NEEDED FOR LOADING ANIMATION ON DialogWithImageHeader\n\nexport const DialogContentWrapper = styled(LoadingDiv)`\n padding: 2rem;\n margin: -2rem;\n ${media.mobile`\n padding: 1.75rem;\n margin: -1.75rem;\n `}\n`\nconst DialogAlwaysVisibleDiv = styled.div`\n padding: 2rem 2rem 0;\n margin: -2rem;\n ${media.mobile`\n padding: 1.75rem 1.75rem 0;\n margin: -1.75rem;\n `}\n`\n// END\n\nconst DialogInner = React.forwardRef(({className, style, skipWrap, wrapChildren, stickyFooter, fixTitleMargin, skipCloseIcon, isLoading, footer, Content, children, title, illustration, icon, auxiliarActions, container = true, onClose, ...props}, outerRef) => {\n const ref = useEnsureRef(outerRef)\n const [WithIsSticky] = willUseIsSticky()\n\n const handleClose = React.useCallback(async () => {\n if (onClose) await onClose().catch(console.error)\n if (props.closeDialog) props.closeDialog()\n }, [onClose, props.closeDialog])\n\n const alwaysVisible = (confirmCloseDialog) => <>\n {\n props.closeDialog && !skipCloseIcon &&\n <CloseIcon className=\"JS-dialog-close\" onClick={confirmCloseDialog}/>\n }\n {\n title &&\n <DialogTitle fixTitleMargin>{callIfFunction(title)}</DialogTitle>\n }\n </>\n\n const content = <>\n {\n Content &&\n <DialogContent icon={icon} illustration={illustration}>{callIfFunction(Content)}</DialogContent>\n }\n {\n !Content && children &&\n <DialogContent icon={icon} illustration={illustration}>{wrapChildren ? wrapChildren(children) : callIfFunction(children)}</DialogContent>\n }\n {\n Content && children && (wrapChildren ? wrapChildren(children) : callIfFunction(children))\n }\n {\n footer &&\n <WithIsSticky bottom>{(sentinel, isSticky) => <>\n <DialogFooter isSticky={isSticky} sticky={stickyFooter}>\n {auxiliarActions && <FooterAuxiliaryContainer>{callIfFunction(auxiliarActions)}</FooterAuxiliaryContainer>}\n {callIfFunction(footer)}\n </DialogFooter>\n {sentinel()}\n </>\n }</WithIsSticky>\n }\n </>\n\n const dialog = (confirmCloseDialog) => <div\n className={className + \" JS-has-wc JS-dialog\"}\n style={style}\n ref={ref}\n >\n {skipWrap\n ? <>\n {alwaysVisible(confirmCloseDialog)}\n {content}\n </>\n : <>\n <DialogAlwaysVisibleDiv>\n {alwaysVisible(confirmCloseDialog)}\n </DialogAlwaysVisibleDiv>\n <DialogContentWrapper isLoading={isLoading}>\n {content}\n </DialogContentWrapper>\n </>\n }\n </div>\n\n return container\n ? <DialogContainer {...props} DialogErrorContent={DialogErrorContent}\n ref={ref}\n title={title}\n closeDialog={handleClose}\n >{({confirmCloseDialog}) => dialog(confirmCloseDialog)}</DialogContainer>\n : dialog(handleClose)\n})\n\n// R6: \"as\" não existe no yak. tagAs troca o componente/tag renderizado (ex.: DialogErrorContent\n// usa tagAs=\"div\" pra reaproveitar o CSS do Dialog sem a lógica interna; DialogWithSidebar usa\n// tagAs={DialogWithSidebarPresentation}); sem tagAs, renderiza o Dialog de verdade (DialogInner).\nconst DialogTagAs = React.forwardRef(({tagAs: Tag = DialogInner, ...props}, ref) => <Tag ref={ref} {...props}/>)\n\nconst Dialog = styled(DialogTagAs)`\n @supports (position:sticky) {\n will-change: transform, opacity;\n &.JS-wc-off {\n will-change: auto;\n }\n }\n \n border-radius: 24px;\n padding: 2rem;\n background-color: white;\n width: 100%;\n max-width: 45rem;\n /* Override opcional via prop. Fica ANTES do media.mobile de propósito: no mobile\n o max-width:100% de lá continua ganhando. Inerte sem a prop → zero efeito em\n quem já ajusta a largura por css=\"max-width:...\". */\n ${props => props.$maxWidth && css`max-width: ${props => props.$maxWidth};`}\n margin: auto;\n position: relative;\n align-self: baseline;\n display: block; \n overflow: clip;\n > h3:first-child {\n margin-top: 0.5rem;\n }\n p {\n line-height: 140%;\n }\n ${media.mobile`\n padding: 1.75rem;\n max-width: 100%;\n ${props => props.fullscreenOnMobile && `\n border-radius: 0;\n min-height: 100%;\n `};\n `}\n ${props => props.closeDialog && css`\n ${DialogTitle} {\n padding-right: 2rem;\n }\n `}\n ${customTheme('Dialog')}\n`\n\n\nexport {\n FooterAuxiliaryContainer,\n DialogTitle,\n DialogFooter,\n DialogContent,\n CloseIcon,\n Dialog\n}\n\nexport const ConfirmDialog = (props) => <Dialog {...props} placement=\"Confirm-Dialog\">{props.children}</Dialog>\n\nexport const DefaultConfirmDialog = (props) => (\n <StartlibsConsumer>{({confirmDialogLabels}) => {\n const handleCancel = async () => {\n if (props.onCancel) props.onCancel()\n if (props.onClose) await props.onClose().catch(console.error)\n }\n\n return (\n <ConfirmDialog\n title={confirmDialogLabels.title}\n closeDialog={handleCancel}\n onClose={props.onClose}\n onConfirm={props.onConfirm}\n footer={<>\n <Button onClick={handleCancel}>{confirmDialogLabels.cancel}</Button>\n <Button\n hover=\"success\" isLoading={props.isLoading}\n onClick={props.onSaveInstead}\n >{confirmDialogLabels.confirm}</Button>\n <Button autoFocus alert onClick={props.onConfirm}>{confirmDialogLabels.discard}</Button>\n </>}\n >\n <p>{confirmDialogLabels.content}</p>\n </ConfirmDialog>\n )}}\n </StartlibsConsumer>)\n\n// Estado de erro genérico da dialog: badge circular centralizado (mesma linguagem\n// dos error pages da app) no lugar do ícone cinza flutuando no canto. Cores em rgba\n// (não getColor) pra não depender dos tokens de tema da app que consome a lib.\nconst DialogErrorLayout = styled.div`\n text-align: center;\n /* max-width (não <br/>) força a quebra do título em ~2 linhas como o error page,\n mas deixa telas estreitas quebrarem sozinhas. Ajuste fino se o corte não bater. */\n ${DialogTitle} {\n max-width: 18rem;\n margin-left: auto;\n margin-right: auto;\n }\n ${DialogContent} {\n min-height: 0; /* mata o vão vazio que sobrava acima do botão */\n p {\n max-width: 20rem;\n margin-left: auto;\n margin-right: auto;\n }\n }\n ${DialogFooter} {\n text-align: center;\n margin-top: 0;\n padding-top: 0.5rem;\n }\n`\n\nconst DialogErrorBadge = styled.div`\n width: 72px;\n height: 72px;\n margin: 0 auto 1.5rem;\n border-radius: 50%;\n background: rgba(0, 0, 0, 0.06);\n display: flex;\n align-items: center;\n justify-content: center;\n ${Icon} {\n font-size: 40px;\n color: rgba(0, 0, 0, 0.4);\n }\n`\n\nexport const DialogErrorContent = ({ closeDialog, onClose, title }) => {\n const handleClose = React.useCallback(async () => {\n if (onClose) await onClose().catch(console.error)\n if (closeDialog) closeDialog()\n }, [onClose, closeDialog])\n\n return (\n <StartlibsConsumer>\n {({ ErrorDialog: { title, content, close } }) => (\n <Dialog tagAs=\"div\" $maxWidth=\"30rem\">\n {closeDialog && <CloseIcon onClick={handleClose} />}\n <DialogErrorLayout>\n <DialogErrorBadge><Icon icon=\"warning\"/></DialogErrorBadge>\n {title && <DialogTitle fixTitleMargin>{title}</DialogTitle>}\n <DialogContent>{content}</DialogContent>\n <DialogFooter>\n <Button highlight rounded onClick={handleClose}>{close}</Button>\n </DialogFooter>\n </DialogErrorLayout>\n </Dialog>\n )}\n </StartlibsConsumer>\n )\n}\n\nexport const DialogError = ({ closeDialog, onClose }) => {\n const handleClose = React.useCallback(async () => {\n if (onClose) await onClose().catch(console.error)\n if (closeDialog) closeDialog()\n }, [onClose, closeDialog])\n\n return (\n <StartlibsConsumer>\n {({ ErrorDialog: { title } }) => (\n <Dialog closeDialog={handleClose} title={title}>\n <DialogErrorContent closeDialog={handleClose} onClose={onClose} />\n </Dialog>\n )}\n </StartlibsConsumer>\n )\n}\n"],"names":["DialogIcon","styled","Icon","withConfig","displayName","componentId","media","desktop","_templateObject","_taggedTemplateLiteral","CloseIcon","attrs","_assign","icon","DialogIllustration","img","mobile","_templateObject2","DialogContent","props","React","createElement","fixDoubledLastMarginBottom","children","illustration","src","css","_templateObject3","TitleBase","forwardRef","_ref","ref","_objectWithoutProperties","_excluded","_extends","DialogTitle","fixTitleMargin","_templateObject4","FooterBase","_ref2","_excluded2","DialogFooter","sticky","isSticky","_templateObject5","_templateObject6","max","_templateObject7","Button","darken","getColor","FooterAuxiliaryContainer","div","DialogContentWrapper","LoadingDiv","_templateObject8","DialogAlwaysVisibleDiv","_templateObject9","DialogInner","_ref3","outerRef","className","style","skipWrap","wrapChildren","stickyFooter","skipCloseIcon","isLoading","footer","Content","title","auxiliarActions","container","onClose","_excluded3","useEnsureRef","WithIsSticky","willUseIsSticky","handleClose","useCallback","catch","console","error","closeDialog","alwaysVisible","confirmCloseDialog","Fragment","onClick","callIfFunction","content","bottom","sentinel","dialog","DialogContainer","DialogErrorContent","_ref4","DialogTagAs","_ref5","tagAs","Tag","_excluded4","Dialog","$maxWidth","_templateObject10","fullscreenOnMobile","customTheme","ConfirmDialog","placement","DefaultConfirmDialog","StartlibsConsumer","_ref6","confirmDialogLabels","handleCancel","onCancel","onConfirm","cancel","hover","onSaveInstead","confirm","autoFocus","alert","discard","DialogErrorLayout","DialogErrorBadge","_ref7","_ref8","ErrorDialog","close","highlight","rounded","DialogError","_ref9","_ref10"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAeO,MAAMA,UAAU,gBAAGC,MAAM,CAACC,IAAI,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,oBAAA;EAAAC,WAAA,EAAA,aAAA;AAAA,CAQlCC,CAAAA,CAAAA,CAAAA,+FAAAA,EAAAA,EAAAA,CAAAA,EAAAA,KAAK,CAACC,OAAO,CAAAC,eAAA,KAAAA,eAAA,GAAAC,sBAAA,CAGhB,CAAA,kBAAA,CAAA,CAAA,CAAA,CAAA,EAAA;AAEKC,MAAAA,SAAS,gBAAGT,MAAM,CAACC,IAAI,CAAC,CAACS,KAAK,CAACC,OAAA,CAAS;AAACC,EAAAA,IAAI,EAAE,GAAA;AAAG,CAAC,CAAC,CAAC,CAAAV,UAAA,CAAA;EAAAC,WAAA,EAAA,mBAAA;EAAAC,WAAA,EAAA,aAAA;AAAA,CAiBxD,CAAA,CAAA,CAAA,wPAAA,CAAA,EAAA;AAEH,MAAMS,kBAAkB,gBAAGb,MAAM,CAACc,GAAG,CAAAZ,UAAA,CAAA;EAAAC,WAAA,EAAA,4BAAA;EAAAC,WAAA,EAAA,aAAA;AAAA,CAK/BC,CAAAA,CAAAA,CAAAA,wDAAAA,EAAAA,EAAAA,CAAAA,EAAAA,KAAK,CAACU,MAAM,CAAAC,gBAAA,KAAAA,gBAAA,GAAAR,sBAAA,CAGjB,CAAA,8BAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAEKS,MAAAA,aAAa,gBAAGjB,MAAM,CAAEkB,KAAK,iBACjCC,KAAA,CAAAC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;AAChD,IAAA,IAAIN,OAAO,EAAE,MAAMA,OAAO,EAAE,CAACO,KAAK,CAACC,OAAO,CAACC,KAAK,CAAC,CAAA;AACjD,IAAA,IAAIC,WAAW,EAAEA,WAAW,EAAE,CAAA;AAChC,GAAC,EAAE,CAACV,OAAO,EAAEU,WAAW,CAAC,CAAC,CAAA;AAE1B,EAAA,oBACE/D,KAAA,CAAAC,aAAA,CAACwF,iBAAiB,QACfuB,MAAA,IAAA;IAAA,IAAC;AAAEN,MAAAA,WAAW,EAAE;AAAExD,QAAAA,KAAAA;AAAM,OAAA;AAAE,KAAC,GAAA8D,MAAA,CAAA;AAAA,IAAA,oBAC1BhH,KAAA,CAAAC,aAAA,CAACgF,MAAM,EAAA;AAAClB,MAAAA,WAAW,EAAEL,WAAY;AAACR,MAAAA,KAAK,EAAEA,KAAAA;AAAM,KAAA,eAC7ClD,KAAA,CAAAC,aAAA,CAACyE,kBAAkB,EAAA;AAACX,MAAAA,WAAW,EAAEL,WAAY;AAACL,MAAAA,OAAO,EAAEA,OAAAA;AAAQ,KAAE,CAC3D,CAAC,CAAA;AAAA,GAEM,CAAC,CAAA;AAExB;;;;"}
|
package/lib/Icon.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import _extends from '@babel/runtime/helpers/extends';
|
|
1
2
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
2
3
|
import React from 'react';
|
|
3
|
-
import styled, {
|
|
4
|
+
import styled, { useTheme } from 'styled-components';
|
|
4
5
|
|
|
5
6
|
const _excluded = ["icon", "children", "theme", "clickable", "customIcon", "colorSet", "color"];
|
|
6
7
|
class IconComponent extends React.Component {
|
|
@@ -38,12 +39,17 @@ class IconComponent extends React.Component {
|
|
|
38
39
|
return /*#__PURE__*/React.createElement("span", rest, theme.icons[icon] || customIcon && icon, children);
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
|
-
const
|
|
42
|
+
const ThemedIconComponent = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(IconComponent, _extends({
|
|
43
|
+
ref: ref
|
|
44
|
+
}, props, {
|
|
45
|
+
theme: useTheme()
|
|
46
|
+
})));
|
|
47
|
+
const Icon = /*#__PURE__*/styled(ThemedIconComponent).withConfig({
|
|
42
48
|
displayName: "Icon",
|
|
43
49
|
componentId: "sc-wsq54u-0"
|
|
44
|
-
})(["font-family:
|
|
50
|
+
})(["font-family:", " !important;speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;user-select:none;", ""], props => {
|
|
45
51
|
var _props$theme;
|
|
46
|
-
return (_props$theme = props.theme) === null || _props$theme === void 0 ? void 0 : _props$theme.iconFont;
|
|
52
|
+
return "'".concat((_props$theme = props.theme) === null || _props$theme === void 0 ? void 0 : _props$theme.iconFont, "'");
|
|
47
53
|
}, props => props.clickable && "\n cursor: pointer;\n &:hover {\n opacity: 0.85;\n }\n ");
|
|
48
54
|
|
|
49
55
|
export { Icon };
|
package/lib/Icon.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.mjs","sources":["../src/Icon.jsx"],"sourcesContent":["import React from 'react'\nimport styled
|
|
1
|
+
{"version":3,"file":"Icon.mjs","sources":["../src/Icon.jsx"],"sourcesContent":["import React from 'react'\nimport styled, {useTheme} from 'styled-components'\n\n\nclass IconComponent extends React.Component {\n\n state = {}\n\n componentDidMount() {\n const icon = this.props.icon\n if ((this.props.theme.svgIcons || {})[icon]) {\n this.props.theme.svgLoader(icon).then((i) => this.setState({Svg: i.default}))\n }\n }\n\n render() {\n const {icon, children, theme, clickable, customIcon, colorSet, color, ...rest} = this.props\n if ((theme.svgIcons || {})[icon]) {\n if (this.state.Svg) {\n return <this.state.Svg {...rest} />\n } else {\n return null\n }\n }\n return <span {...rest}>{theme.icons[icon] || (customIcon && icon)}{children}</span>\n }\n}\n\nconst ThemedIconComponent = React.forwardRef((props, ref) => <IconComponent ref={ref} {...props} theme={useTheme()}/>)\n\nexport const Icon = styled(ThemedIconComponent)`\n font-family: ${props => `'${props.theme?.iconFont}'`} !important;\n speak: none;\n font-style: normal;\n font-weight: normal;\n font-variant: normal;\n text-transform: none;\n line-height: 1;\n \n /* Better Font Rendering =========== */\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n user-select: none; \n ${props => props.clickable && `\n cursor: pointer;\n &:hover {\n opacity: 0.85;\n }\n `}\n`"],"names":["IconComponent","React","Component","constructor","arguments","state","componentDidMount","icon","props","theme","svgIcons","svgLoader","then","i","setState","Svg","default","render","_this$props","children","clickable","customIcon","colorSet","color","rest","_objectWithoutProperties","_excluded","createElement","icons","ThemedIconComponent","forwardRef","ref","_extends","useTheme","Icon","styled","withConfig","displayName","componentId","_props$theme","concat","iconFont"],"mappings":";;;;;;AAIA,MAAMA,aAAa,SAASC,KAAK,CAACC,SAAS,CAAC;EAAAC,WAAA,GAAA;AAAA,IAAA,KAAA,CAAA,GAAAC,SAAA,CAAA,CAAA;IAAA,IAE1CC,CAAAA,KAAK,GAAG,EAAE,CAAA;AAAA,GAAA;AAEVC,EAAAA,iBAAiBA,GAAG;AAClB,IAAA,MAAMC,IAAI,GAAG,IAAI,CAACC,KAAK,CAACD,IAAI,CAAA;AAC5B,IAAA,IAAI,CAAC,IAAI,CAACC,KAAK,CAACC,KAAK,CAACC,QAAQ,IAAI,EAAE,EAAEH,IAAI,CAAC,EAAE;AAC3C,MAAA,IAAI,CAACC,KAAK,CAACC,KAAK,CAACE,SAAS,CAACJ,IAAI,CAAC,CAACK,IAAI,CAAEC,CAAC,IAAK,IAAI,CAACC,QAAQ,CAAC;QAACC,GAAG,EAAEF,CAAC,CAACG,OAAAA;AAAO,OAAC,CAAC,CAAC,CAAA;AAC/E,KAAA;AACF,GAAA;AAEAC,EAAAA,MAAMA,GAAG;AACP,IAAA,MAAAC,WAAA,GAAiF,IAAI,CAACV,KAAK;A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AA,GAAA,CAAAC,MAAA,CAAA,CAAAD,YAAA,GAAQ/B,KAAK,CAACC,KAAK,MAAA,IAAA,IAAA8B,YAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAXA,YAAA,CAAaE,QAAQ,EAAA,GAAA,CAAA,CAAA;AAAA,CAAG,EAYlDjC,KAAK,IAAIA,KAAK,CAACY,SAAS,4EAKzB;;;;"}
|
package/lib/Loading.mjs
CHANGED
|
@@ -1,10 +1,33 @@
|
|
|
1
|
+
import _extends from '@babel/runtime/helpers/extends';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
+
import React from 'react';
|
|
1
4
|
import styled from 'styled-components';
|
|
2
|
-
import { getColor } from '@startlibs/utils';
|
|
5
|
+
import { getColor, insertKeyframes } from '@startlibs/utils';
|
|
3
6
|
|
|
4
|
-
const
|
|
7
|
+
const _excluded = ["color", "white", "size", "borderWidth", "absolute"];
|
|
8
|
+
|
|
9
|
+
// Nome fixo do @keyframes preservado: um `keyframes` do styled-components geraria um nome
|
|
10
|
+
// com hash, diferente do atual "loading-spin" (quebraria quem lê animationName). Por isso
|
|
11
|
+
// o bloco fica fora de um template styled/css/keyframes, registrado pelo CSSOM (sem nonce)
|
|
12
|
+
// no primeiro render do Loading (não no import: o pacote declara "sideEffects": false e
|
|
13
|
+
// código de topo de módulo pode ser descartado por um bundler mais agressivo se achar as
|
|
14
|
+
// exportações não usadas).
|
|
15
|
+
const injectSpinKeyframes = () => insertKeyframes('loading-spin', '100% { transform: rotate(1turn) }');
|
|
16
|
+
|
|
17
|
+
// styled(LoadingBase) mira num componente, não numa tag: ao contrário do antigo styled.div,
|
|
18
|
+
// o styled-components não filtra prop inválida pra <div> nesse caso. Por isso tira aqui,
|
|
19
|
+
// à mão, cada prop que o template do Loading lê, antes de espalhar o resto no elemento real.
|
|
20
|
+
const LoadingBase = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
21
|
+
let props = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
+
injectSpinKeyframes();
|
|
23
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
24
|
+
ref: ref
|
|
25
|
+
}, props));
|
|
26
|
+
});
|
|
27
|
+
const Loading = /*#__PURE__*/styled(LoadingBase).withConfig({
|
|
5
28
|
displayName: "Loading",
|
|
6
29
|
componentId: "sc-5t5spc-0"
|
|
7
|
-
})(["z-index:1;--loading-color:", ";--loading-bw:", "px;width:", "px;aspect-ratio:1;flex-shrink:0;border-radius:50%;background:radial-gradient(farthest-side,var(--loading-color) 94%,#0000) top/var(--loading-bw) var(--loading-bw) no-repeat,conic-gradient(#0000 15%,var(--loading-color));-webkit-mask:radial-gradient(farthest-side,#0000 calc(100% - var(--loading-bw)),#000 0);mask:radial-gradient(farthest-side,#0000 calc(100% - var(--loading-bw)),#000 0);animation:loading-spin 0.6s infinite linear;", "
|
|
30
|
+
})(["z-index:1;--loading-color:", ";--loading-bw:", "px;width:", "px;aspect-ratio:1;flex-shrink:0;border-radius:50%;background:radial-gradient(farthest-side,var(--loading-color) 94%,#0000) top/var(--loading-bw) var(--loading-bw) no-repeat,conic-gradient(#0000 15%,var(--loading-color));-webkit-mask:radial-gradient(farthest-side,#0000 calc(100% - var(--loading-bw)),#000 0);mask:radial-gradient(farthest-side,#0000 calc(100% - var(--loading-bw)),#000 0);animation:loading-spin 0.6s infinite linear;", ""], props => props.color || (props.white ? 'rgba(255,255,255,0.9)' : getColor("main")(props)), props => props.borderWidth || 4, props => props.size || 26, props => props.absolute && "\n position: absolute;\n top: 0;\n bottom: 0;\n right: 0;\n left: 0;\n margin: auto;\n ");
|
|
8
31
|
|
|
9
32
|
export { Loading };
|
|
10
33
|
//# sourceMappingURL=Loading.mjs.map
|
package/lib/Loading.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Loading.mjs","sources":["../src/Loading.jsx"],"sourcesContent":["import styled from 'styled-components'\nimport {getColor} from '@startlibs/utils'\n\nexport const Loading = styled
|
|
1
|
+
{"version":3,"file":"Loading.mjs","sources":["../src/Loading.jsx"],"sourcesContent":["import React from 'react'\nimport styled from 'styled-components'\nimport {getColor, insertKeyframes} from '@startlibs/utils'\n\n// Nome fixo do @keyframes preservado: um `keyframes` do styled-components geraria um nome\n// com hash, diferente do atual \"loading-spin\" (quebraria quem lê animationName). Por isso\n// o bloco fica fora de um template styled/css/keyframes, registrado pelo CSSOM (sem nonce)\n// no primeiro render do Loading (não no import: o pacote declara \"sideEffects\": false e\n// código de topo de módulo pode ser descartado por um bundler mais agressivo se achar as\n// exportações não usadas).\nconst injectSpinKeyframes = () => insertKeyframes('loading-spin', '100% { transform: rotate(1turn) }')\n\n// styled(LoadingBase) mira num componente, não numa tag: ao contrário do antigo styled.div,\n// o styled-components não filtra prop inválida pra <div> nesse caso. Por isso tira aqui,\n// à mão, cada prop que o template do Loading lê, antes de espalhar o resto no elemento real.\nconst LoadingBase = React.forwardRef(({color, white, size, borderWidth, absolute, ...props}, ref) => {\n injectSpinKeyframes()\n return <div ref={ref} {...props}/>\n})\n\nexport const Loading = styled(LoadingBase)`\n z-index:1;\n --loading-color: ${props => props.color || (props.white ? 'rgba(255,255,255,0.9)' : getColor(\"main\")(props))};\n --loading-bw: ${props => props.borderWidth || 4}px;\n width: ${props => props.size || 26}px;\n aspect-ratio: 1;\n flex-shrink: 0;\n border-radius: 50%;\n background:\n radial-gradient(farthest-side, var(--loading-color) 94%, #0000) top/var(--loading-bw) var(--loading-bw) no-repeat,\n conic-gradient(#0000 15%, var(--loading-color));\n -webkit-mask: radial-gradient(farthest-side, #0000 calc(100% - var(--loading-bw)), #000 0);\n mask: radial-gradient(farthest-side, #0000 calc(100% - var(--loading-bw)), #000 0);\n animation: loading-spin 0.6s infinite linear;\n ${props => props.absolute && `\n position: absolute;\n top: 0;\n bottom: 0;\n right: 0;\n left: 0;\n margin: auto;\n `}\n `\n"],"names":["injectSpinKeyframes","insertKeyframes","LoadingBase","React","forwardRef","_ref","ref","props","_objectWithoutProperties","_excluded","createElement","_extends","Loading","styled","withConfig","displayName","componentId","color","white","getColor","borderWidth","size","absolute"],"mappings":";;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,mBAAmB,GAAGA,MAAMC,eAAe,CAAC,cAAc,EAAE,mCAAmC,CAAC,CAAA;;AAEtG;AACA;AACA;AACA,MAAMC,WAAW,gBAAGC,KAAK,CAACC,UAAU,CAAC,CAAAC,IAAA,EAAwDC,GAAG,KAAK;EAA/D,IAA+CC,KAAK,GAAAC,wBAAA,CAAAH,IAAA,EAAAI,SAAA,EAAA;AACxFT,EAAAA,mBAAmB,EAAE,CAAA;AACrB,EAAA,oBAAOG,KAAA,CAAAO,aAAA,CAAA,KAAA,EAAAC,QAAA,CAAA;AAAKL,IAAAA,GAAG,EAAEA,GAAAA;GAASC,EAAAA,KAAK,CAAE,CAAC,CAAA;AACpC,CAAC,CAAC,CAAA;AAEK,MAAMK,OAAO,gBAAGC,MAAM,CAACX,WAAW,CAAC,CAAAY,UAAA,CAAA;EAAAC,WAAA,EAAA,SAAA;EAAAC,WAAA,EAAA,aAAA;AAAA,CAAA,CAAA,CAAA,CAAA,4BAAA,EAAA,gBAAA,EAAA,WAAA,EAAA,kbAAA,EAAA,EAAA,CAAA,EAEnBT,KAAK,IAAIA,KAAK,CAACU,KAAK,KAAKV,KAAK,CAACW,KAAK,GAAG,uBAAuB,GAAGC,QAAQ,CAAC,MAAM,CAAC,CAACZ,KAAK,CAAC,CAAC,EAC5FA,KAAK,IAAIA,KAAK,CAACa,WAAW,IAAI,CAAC,EACtCb,KAAK,IAAIA,KAAK,CAACc,IAAI,IAAI,EAAE,EAUhCd,KAAK,IAAIA,KAAK,CAACe,QAAQ,8HAOxB;;;;"}
|
package/lib/PageLoader.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
|
-
import styled
|
|
2
|
+
import styled from 'styled-components';
|
|
3
3
|
import { getColor, oneWayAnimation, animationTiming } from '@startlibs/utils';
|
|
4
4
|
import { useToggle } from '@startlibs/core';
|
|
5
5
|
import { useFlipLeave } from './Flip.mjs';
|
|
@@ -7,7 +7,7 @@ import { useFlipLeave } from './Flip.mjs';
|
|
|
7
7
|
const LoadingBar = /*#__PURE__*/styled.div.withConfig({
|
|
8
8
|
displayName: "PageLoader__LoadingBar",
|
|
9
9
|
componentId: "sc-96jeob-0"
|
|
10
|
-
})(["width:100%;border-radius:0 1px 1px 0;height:4px;position:fixed;background:", ";transform:translateX(-100%);", " left:0;z-index:99999;box-shadow:", ";", " ", ""], props => props.bottom ?
|
|
10
|
+
})(["width:100%;border-radius:0 1px 1px 0;height:4px;position:fixed;background:", ";transform:translateX(-100%);", " left:0;z-index:99999;box-shadow:", ";", " ", ""], props => props.bottom ? getColor('main') : "#84D359", props => props.bottom ? "bottom:69px;" : "top: 0;", props => props.bottom ? "0 0 1px 1px rgba(0,132,214,0.2)" : "0 0 2px 0 rgba(0,0,0,0.5)", props => props.loading && "\n transform: translateX(-30%);\n transition: transform 1.5s ease;\n ", props => props.closing && "\n transform: translateX(0);\n transition: transform 0.3s ease-in;\n ");
|
|
11
11
|
const PageLoader = _ref => {
|
|
12
12
|
let {
|
|
13
13
|
isLoading
|
package/lib/PageLoader.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageLoader.mjs","sources":["../src/PageLoader.jsx"],"sourcesContent":["import React, {useEffect} from 'react'\nimport styled
|
|
1
|
+
{"version":3,"file":"PageLoader.mjs","sources":["../src/PageLoader.jsx"],"sourcesContent":["import React, {useEffect} from 'react'\nimport styled from 'styled-components'\nimport {oneWayAnimation, getColor} from '@startlibs/utils'\nimport {useToggle} from '@startlibs/core'\nimport {useFlipLeave} from './Flip'\nimport {animationTiming} from '@startlibs/utils'\n\nexport const LoadingBar = styled.div`\n width: 100%;\n border-radius: 0 1px 1px 0;\n height: 4px;\n position: fixed;\n background: ${props => props.bottom ? getColor('main') : `#84D359`};\n transform: translateX(-100%);\n ${props => props.bottom ? \"bottom:69px;\" : \"top: 0;\"}\n left: 0;\n z-index: 99999;\n box-shadow: ${props => props.bottom ? `0 0 1px 1px rgba(0,132,214,0.2)` : `0 0 2px 0 rgba(0,0,0,0.5)`};\n ${props => props.loading && `\n transform: translateX(-30%);\n transition: transform 1.5s ease;\n `}\n ${props => props.closing && `\n transform: translateX(0);\n transition: transform 0.3s ease-in;\n `}\n`\n\n\nexport const PageLoader = ({isLoading}) => {\n const loader = useToggle()\n useEffect(() => {\n if (isLoading) {\n loader.open()\n } else {\n loader.closeAfter(500)\n }\n },[isLoading])\n\n return <LoadingBar loading={loader.isOpen} closing={loader.closing}/>\n}\n\nconst animation = oneWayAnimation('transform:translateX(-30%);','transform:translateX(0);')\nexport const SuspenseLoadingBar = () => {\n const ref = React.useRef()\n useFlipLeave(ref,animation,{reverse: false,timing:animationTiming('0.3s ease-in')})\n return <LoadingBar ref={ref} loading/>\n}"],"names":["LoadingBar","styled","div","withConfig","displayName","componentId","props","bottom","getColor","loading","closing","PageLoader","_ref","isLoading","loader","useToggle","useEffect","open","closeAfter","React","createElement","isOpen","animation","oneWayAnimation","SuspenseLoadingBar","ref","useRef","useFlipLeave","reverse","timing","animationTiming"],"mappings":";;;;;;MAOaA,UAAU,gBAAGC,MAAM,CAACC,GAAG,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,wBAAA;EAAAC,WAAA,EAAA,aAAA;AAAA,CAAA,CAAA,CAAA,CAAA,4EAAA,EAAA,+BAAA,EAAA,mCAAA,EAAA,GAAA,EAAA,GAAA,EAAA,EAAA,CAAA,EAKpBC,KAAK,IAAIA,KAAK,CAACC,MAAM,GAAGC,QAAQ,CAAC,MAAM,CAAC,GAAY,SAAA,EAEhEF,KAAK,IAAIA,KAAK,CAACC,MAAM,GAAG,cAAc,GAAG,SAAS,EAGtCD,KAAK,IAAIA,KAAK,CAACC,MAAM,GAAkE,iCAAA,G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
|
}).withConfig({
|
|
41
41
|
displayName: "PersistentNotifications__PersistentNotificationCloseIcon",
|
|
42
42
|
componentId: "sc-1t7i0dh-4"
|
|
43
|
-
})(["position:absolute;width:30px;height:30px;font-size:20px;line-height:30px;cursor:pointer;border-radius:50%;text-align:center;z-index:1000;top:0.5rem;right:0.5rem;color:", ";background:", "
|
|
43
|
+
})(["position:absolute;width:30px;height:30px;font-size:20px;line-height:30px;cursor:pointer;border-radius:50%;text-align:center;z-index:1000;top:0.5rem;right:0.5rem;color:", ";background:", ";&:hover{background:", ";}&:active{background:", ";}"], props => props.type && props.type !== 'main' ? getColor(props.type)(props) : darken(0.1, getColor("main")(props)), props => transparentize(0.90, getColor(props.type || "main")(props)), props => transparentize(0.85, getColor(props.type || "main")(props)), props => transparentize(0.82, getColor(props.type || "main")(props)));
|
|
44
44
|
const [useNotifications,, setNotifications] = willUseSharedState([]);
|
|
45
45
|
const openPersistentNotification = notification => {
|
|
46
46
|
const newNotification = _objectSpread({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersistentNotifications.mjs","sources":["../src/PersistentNotifications.jsx"],"sourcesContent":["import React, {useRef} from 'react'\nimport _ from 'lodash/fp'\nimport styled from 'styled-components'\nimport {Fill, willUseSharedState} from '@startlibs/core'\nimport {media,getColor, callIfFunction, oneWayAnimation, printerMedia} from '@startlibs/utils'\nimport {useFlipAnimation} from './Flip'\nimport {Icon} from './Icon'\nimport {darken, transparentize } from 'polished';\nimport {Button} from './Button'\n\nexport const PersistentNotification = styled.div`\n color: ${getColor('warning')};\n h4 {\n font-size: 15px;\n font-weight: 500;\n margin-bottom: 0.5rem;\n }\n p {\n font-size: 13px;\n margin-bottom: 0;\n }\n`\n\nexport const PersistentNotificationContent = styled.div`\n display: flex;\n align-items: center;\n padding: 1.5rem;\n`\nexport const PersistentNotificationIcon = styled(Icon)`\n font-size: 38px;\n width: 4rem;\n height: 4rem;\n line-height: 4rem;\n border-radius: 100px;\n text-align: center;\n background: ${props => transparentize(0.88, getColor(\"warning\")(props))};\n margin-right: 1rem;\n flex-shrink: 0;\n ${props => props.icon === 'warning' && `font-size:30px;`}\n`\nexport const PersistentNotificationActions = styled.div`\n display: flex;\n margin-top: -0.25rem;\n padding: 0 1.5rem 1.5rem;\n ${Button} {\n flex-grow: 1;\n }\n ${Button} ~ ${Button} {\n margin-left: 0;\n margin-right: 1rem;\n }\n ${media.max(390)`\n display: block;\n ${Button} {\n width: 100%;\n }\n ${Button} ~ ${Button} {\n margin-left: 0;\n margin-top: 0.75rem;\n }\n `}\n`\nexport const PersistentNotificationCloseIcon = styled(Icon).attrs({icon: 'x'})`\n position: absolute;\n width: 30px;\n height: 30px;\n font-size: 20px;\n line-height: 30px;\n cursor: pointer;\n border-radius: 50%;\n text-align: center;\n z-index: 1000;\n top: 0.5rem;\n right: 0.5rem;\n color: ${props => props.type && props.type!== 'main' ? getColor(props.type)(props) : darken(0.1, getColor(\"main\")(props))};\n background: ${props => transparentize(0.90, getColor(props.type || \"main\")(props))};\n :hover {\n background: ${props => transparentize(0.85, getColor(props.type || \"main\")(props))};\n }\n :active {\n background: ${props => transparentize(0.82, getColor(props.type || \"main\")(props))};\n }\n `\n\n\nconst [useNotifications, ,setNotifications] = willUseSharedState([])\n\nexport const openPersistentNotification = (notification) => {\n const newNotification = {priority:0,type:\"success\",...(_.isObject(notification) ? notification : {content:notification})}\n\n setNotifications(list => {\n const nextIndex = list.findIndex(n => n.priority < newNotification.priority)\n return nextIndex < 0\n ? [...list,newNotification]\n : [...list.slice(0,nextIndex),newNotification,...list.slice(nextIndex)]\n })\n return () => setNotifications(_.without([newNotification]))\n}\n\n\nconst animation = oneWayAnimation('opacity:0; transform:translateY(-20px)', 'opacity:1;transform:translate(0)')\n\nconst NotificationContainer = styled.div `\n position: fixed;\n top: 0;\n height: 0;\n right: 0;\n z-index:20;\n`\n\nconst Notification = styled.div `\n background: ${props => transparentize(0.9, getColor(props.type)(props))};\n position: relative;\n border-radius: 19px;\n`\nconst NotificationWrapper = styled.div `\n background: white;\n margin-top: ${props => props.marginTop || \"3.5rem\"};\n margin-right: 0.75rem;\n margin-left: 0.75rem;\n padding: 5px;\n border-radius: 22px;\n box-shadow: 0 0 10px 0 rgba(0,0,0,0.1), 0 1px 2px 1px rgba(0,0,0,0.15);\n max-width: 364px;\n ${media.mobile`\n margin-top: ${props => props.marginTop || \"4rem\"};\n `}\n ${printerMedia`\n display: none;\n `}\n`\nconst [useIsHiddenPersistentNotifications,,hidePersistentNotifications] = willUseSharedState(false)\nexport {useIsHiddenPersistentNotifications, hidePersistentNotifications}\nexport const PersistentNotifications = () => {\n const [notifications,setNotifications] = useNotifications()\n const [isHidden] = useIsHiddenPersistentNotifications()\n\n if (!notifications.length || isHidden) {\n return null;\n }\n const closeMessage = (e) => {\n setNotifications((list) => list.slice(1))\n }\n\n const {content,type,marginTop,...notification} = notifications[0]\n\n return <Fill name=\"PersistentNotifications\">\n <FlipNotification type={type} marginTop={marginTop}>\n {content\n ? callIfFunction(content,closeMessage)\n : <DefaultNotification type={type} _onClose={closeMessage} {...notification} />\n }\n </FlipNotification>\n </Fill>\n}\n\nconst DefaultNotification = ({type, title,body,actions, icon, skipClose,_onClose,onClose}) => {\n return <PersistentNotification>\n <PersistentNotificationContent>\n {(_.isString(icon) || !icon) ? <PersistentNotificationIcon icon={icon || type}/> : icon}\n <div>\n <h4>{title}</h4>\n {body}\n </div>\n </PersistentNotificationContent>\n {\n actions &&\n <PersistentNotificationActions>\n {actions}\n </PersistentNotificationActions>\n }\n {!skipClose && <PersistentNotificationCloseIcon type=\"warning\" onClick={_.over([_onClose,onClose])}/>}\n </PersistentNotification>\n}\n\nconst FlipNotification = (props) => {\n const ref = useRef()\n useFlipAnimation(ref,animation)\n return <NotificationContainer className=\"JS-fix-dialog-scroll\" ref={ref}>\n <NotificationWrapper marginTop={props.marginTop}><Notification id=\"js-share-notification\" {...props}/></NotificationWrapper>\n </NotificationContainer>\n}\n"],"names":["PersistentNotification","styled","div","withConfig","displayName","componentId","getColor","PersistentNotificationContent","PersistentNotificationIcon","Icon","props","transparentize","icon","PersistentNotificationActions","Button","media","max","_templateObject","_taggedTemplateLiteral","PersistentNotificationCloseIcon","attrs","type","darken","useNotifications","setNotifications","willUseSharedState","openPersistentNotification","notification","newNotification","_objectSpread","priority","_isObject","content","list","nextIndex","findIndex","n","slice","_without","animation","oneWayAnimation","NotificationContainer","Notification","NotificationWrapper","marginTop","mobile","_templateObject2","printerMedia","_templateObject3","useIsHiddenPersistentNotifications","hidePersistentNotifications","PersistentNotifications","notifications","isHidden","length","closeMessage","e","_notifications$","_objectWithoutProperties","_excluded","React","createElement","Fill","name","FlipNotification","callIfFunction","DefaultNotification","_extends","_onClose","_ref","title","body","actions","skipClose","onClose","_isString","onClick","_over","ref","useRef","useFlipAnimation","className","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;MAUaA,sBAAsB,gBAAGC,MAAM,CAACC,GAAG,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,iDAAA;EAAAC,WAAA,EAAA,cAAA;AAAA,CAAA,CAAA,CAAA,CAAA,QAAA,EAAA,6FAAA,CAAA,EACrCC,QAAQ,CAAC,SAAS,CAAC,EAU7B;MAEYC,6BAA6B,gBAAGN,MAAM,CAACC,GAAG,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,wDAAA;EAAAC,WAAA,EAAA,cAAA;AAAA,CAItD,CAAA,CAAA,CAAA,iDAAA,CAAA,EAAA;AACM,MAAMG,0BAA0B,gBAAGP,MAAM,CAACQ,IAAI,CAAC,CAAAN,UAAA,CAAA;EAAAC,WAAA,EAAA,qDAAA;EAAAC,WAAA,EAAA,cAAA;AAAA,CAOtCK,CAAAA,CAAAA,CAAAA,0GAAAA,EAAAA,mCAAAA,EAAAA,EAAAA,CAAAA,EAAAA,KAAK,IAAIC,cAAc,CAAC,IAAI,EAAEL,QAAQ,CAAC,SAAS,CAAC,CAACI,KAAK,CAAC,CAAC,EAGrEA,KAAK,IAAI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Notifications.jsx"],"sourcesContent":["import React, {useRef} from 'react'\nimport _ from 'lodash/fp'\nimport styled from 'styled-components'\nimport {Fill, willUseSharedState} from '@startlibs/core'\nimport {media,getColor, callIfFunction, oneWayAnimation, printerMedia} from '@startlibs/utils'\nimport {useFlipAnimation} from './Flip'\nimport {Icon} from './Icon'\nimport {darken, transparentize } from 'polished';\nimport {Button} from './Button'\n\nexport const PersistentNotification = styled.div`\n color: ${getColor('warning')};\n h4 {\n font-size: 15px;\n font-weight: 500;\n margin-bottom: 0.5rem;\n }\n p {\n font-size: 13px;\n margin-bottom: 0;\n }\n`\n\nexport const PersistentNotificationContent = styled.div`\n display: flex;\n align-items: center;\n padding: 1.5rem;\n`\nexport const PersistentNotificationIcon = styled(Icon)`\n font-size: 38px;\n width: 4rem;\n height: 4rem;\n line-height: 4rem;\n border-radius: 100px;\n text-align: center;\n background: ${props => transparentize(0.88, getColor(\"warning\")(props))};\n margin-right: 1rem;\n flex-shrink: 0;\n ${props => props.icon === 'warning' && `font-size:30px;`}\n`\nexport const PersistentNotificationActions = styled.div`\n display: flex;\n margin-top: -0.25rem;\n padding: 0 1.5rem 1.5rem;\n ${Button} {\n flex-grow: 1;\n }\n ${Button} ~ ${Button} {\n margin-left: 0;\n margin-right: 1rem;\n }\n ${media.max(390)`\n display: block;\n ${Button} {\n width: 100%;\n }\n ${Button} ~ ${Button} {\n margin-left: 0;\n margin-top: 0.75rem;\n }\n `}\n`\nexport const PersistentNotificationCloseIcon = styled(Icon).attrs({icon: 'x'})`\n position: absolute;\n width: 30px;\n height: 30px;\n font-size: 20px;\n line-height: 30px;\n cursor: pointer;\n border-radius: 50%;\n text-align: center;\n z-index: 1000;\n top: 0.5rem;\n right: 0.5rem;\n color: ${props => props.type && props.type!== 'main' ? getColor(props.type)(props) : darken(0.1, getColor(\"main\")(props))};\n background: ${props => transparentize(0.90, getColor(props.type || \"main\")(props))};\n &:hover {\n background: ${props => transparentize(0.85, getColor(props.type || \"main\")(props))};\n }\n &:active {\n background: ${props => transparentize(0.82, getColor(props.type || \"main\")(props))};\n }\n `\n\n\nconst [useNotifications, ,setNotifications] = willUseSharedState([])\n\nexport const openPersistentNotification = (notification) => {\n const newNotification = {priority:0,type:\"success\",...(_.isObject(notification) ? notification : {content:notification})}\n\n setNotifications(list => {\n const nextIndex = list.findIndex(n => n.priority < newNotification.priority)\n return nextIndex < 0\n ? [...list,newNotification]\n : [...list.slice(0,nextIndex),newNotification,...list.slice(nextIndex)]\n })\n return () => setNotifications(_.without([newNotification]))\n}\n\n\nconst animation = oneWayAnimation('opacity:0; transform:translateY(-20px)', 'opacity:1;transform:translate(0)')\n\nconst NotificationContainer = styled.div `\n position: fixed;\n top: 0;\n height: 0;\n right: 0;\n z-index:20;\n`\n\nconst Notification = styled.div `\n background: ${props => transparentize(0.9, getColor(props.type)(props))};\n position: relative;\n border-radius: 19px;\n`\nconst NotificationWrapper = styled.div `\n background: white;\n margin-top: ${props => props.marginTop || \"3.5rem\"};\n margin-right: 0.75rem;\n margin-left: 0.75rem;\n padding: 5px;\n border-radius: 22px;\n box-shadow: 0 0 10px 0 rgba(0,0,0,0.1), 0 1px 2px 1px rgba(0,0,0,0.15);\n max-width: 364px;\n ${media.mobile`\n margin-top: ${props => props.marginTop || \"4rem\"};\n `}\n ${printerMedia`\n display: none;\n `}\n`\nconst [useIsHiddenPersistentNotifications,,hidePersistentNotifications] = willUseSharedState(false)\nexport {useIsHiddenPersistentNotifications, hidePersistentNotifications}\nexport const PersistentNotifications = () => {\n const [notifications,setNotifications] = useNotifications()\n const [isHidden] = useIsHiddenPersistentNotifications()\n\n if (!notifications.length || isHidden) {\n return null;\n }\n const closeMessage = (e) => {\n setNotifications((list) => list.slice(1))\n }\n\n const {content,type,marginTop,...notification} = notifications[0]\n\n return <Fill name=\"PersistentNotifications\">\n <FlipNotification type={type} marginTop={marginTop}>\n {content\n ? callIfFunction(content,closeMessage)\n : <DefaultNotification type={type} _onClose={closeMessage} {...notification} />\n }\n </FlipNotification>\n </Fill>\n}\n\nconst DefaultNotification = ({type, title,body,actions, icon, skipClose,_onClose,onClose}) => {\n return <PersistentNotification>\n <PersistentNotificationContent>\n {(_.isString(icon) || !icon) ? <PersistentNotificationIcon icon={icon || type}/> : icon}\n <div>\n <h4>{title}</h4>\n {body}\n </div>\n </PersistentNotificationContent>\n {\n actions &&\n <PersistentNotificationActions>\n {actions}\n </PersistentNotificationActions>\n }\n {!skipClose && <PersistentNotificationCloseIcon type=\"warning\" onClick={_.over([_onClose,onClose])}/>}\n </PersistentNotification>\n}\n\nconst FlipNotification = (props) => {\n const ref = useRef()\n useFlipAnimation(ref,animation)\n return <NotificationContainer className=\"JS-fix-dialog-scroll\" ref={ref}>\n <NotificationWrapper marginTop={props.marginTop}><Notification id=\"js-share-notification\" {...props}/></NotificationWrapper>\n </NotificationContainer>\n}\n"],"names":["PersistentNotification","styled","div","withConfig","displayName","componentId","getColor","PersistentNotificationContent","PersistentNotificationIcon","Icon","props","transparentize","icon","PersistentNotificationActions","Button","media","max","_templateObject","_taggedTemplateLiteral","PersistentNotificationCloseIcon","attrs","type","darken","useNotifications","setNotifications","willUseSharedState","openPersistentNotification","notification","newNotification","_objectSpread","priority","_isObject","content","list","nextIndex","findIndex","n","slice","_without","animation","oneWayAnimation","NotificationContainer","Notification","NotificationWrapper","marginTop","mobile","_templateObject2","printerMedia","_templateObject3","useIsHiddenPersistentNotifications","hidePersistentNotifications","PersistentNotifications","notifications","isHidden","length","closeMessage","e","_notifications$","_objectWithoutProperties","_excluded","React","createElement","Fill","name","FlipNotification","callIfFunction","DefaultNotification","_extends","_onClose","_ref","title","body","actions","skipClose","onClose","_isString","onClick","_over","ref","useRef","useFlipAnimation","className","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;MAUaA,sBAAsB,gBAAGC,MAAM,CAACC,GAAG,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,iDAAA;EAAAC,WAAA,EAAA,cAAA;AAAA,CAAA,CAAA,CAAA,CAAA,QA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