@startlibs/components 1.1.4 → 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 +30 -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/index.js +0 -5444
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _extends from '@babel/runtime/helpers/extends';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
2
3
|
import React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import styled, {
|
|
4
|
+
import { getMargin, callIfFunction, scrollWidth } from '@startlibs/utils';
|
|
5
|
+
import styled, { useTheme } from 'styled-components';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
const _excluded = ["viewportMinWidth", "twoColumnsBelowVW", "margin", "last", "className"];
|
|
7
8
|
const getMarginFromFieldChild = props => {
|
|
8
9
|
if (!props.last) return 0;
|
|
9
10
|
const fields = React.Children.toArray(props.children).filter(c => c.type.displayName === "Field" || c.type.displayName === "EnhancedInput");
|
|
@@ -16,10 +17,80 @@ const splitColumnMargins = {
|
|
|
16
17
|
'default': 1,
|
|
17
18
|
big: 2
|
|
18
19
|
};
|
|
19
|
-
|
|
20
|
+
|
|
21
|
+
// viewportMinWidth/twoColumnsBelowVW vêm de props: não tem CSS estático possível pra eles (yak
|
|
22
|
+
// extrai @media em tempo de build, não a partir de uma prop em tempo de render). Troca o
|
|
23
|
+
// `media.min`/`media.max` (que embutiam um `@media` dinâmico) por um hook que ouve
|
|
24
|
+
// `matchMedia` e liga/desliga classe — as duas regras de CSS ficam estáticas, e a mesma soma de
|
|
25
|
+
// `scrollWidth` que `media()` já fazia entra aqui, pro breakpoint bater igual em px (inclusive
|
|
26
|
+
// a 610px, entre 600 e 600 + barra de rolagem).
|
|
27
|
+
const useMatchMedia = query => {
|
|
28
|
+
const getMatch = () => typeof window !== 'undefined' && window.matchMedia ? window.matchMedia(query).matches : false;
|
|
29
|
+
const [matches, setMatches] = React.useState(getMatch);
|
|
30
|
+
React.useEffect(() => {
|
|
31
|
+
if (typeof window === 'undefined' || !window.matchMedia) return;
|
|
32
|
+
const mql = window.matchMedia(query);
|
|
33
|
+
const onChange = () => setMatches(mql.matches);
|
|
34
|
+
onChange();
|
|
35
|
+
const addListener = mql.addEventListener ? cb => mql.addEventListener('change', cb) : cb => mql.addListener(cb);
|
|
36
|
+
const removeListener = mql.removeEventListener ? cb => mql.removeEventListener('change', cb) : cb => mql.removeListener(cb);
|
|
37
|
+
addListener(onChange);
|
|
38
|
+
return () => removeListener(onChange);
|
|
39
|
+
}, [query]);
|
|
40
|
+
return matches;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// Mesma comparação que checkCustomScreenWidth (utils/src/styled.js) fazia pro theme.overrideMediaWidth:
|
|
44
|
+
// ignora o browser de verdade e compara direto contra o breakpoint (sem somar scrollWidth — o
|
|
45
|
+
// override já é uma largura "combinada", não a viewport física). Usado em testes/impressão.
|
|
46
|
+
const matchesOverrideWidth = (overrideWidth, breakpoint, type) => {
|
|
47
|
+
const currentWidth = callIfFunction(overrideWidth);
|
|
48
|
+
return type === 'min-width' ? currentWidth >= breakpoint : currentWidth <= breakpoint;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// `breakpoint` null/undefined == bloco original não tinha condição nenhuma pra testar (o `&&`
|
|
52
|
+
// de `props.twoColumnsBelowVW &&`): nem entra no matchMedia, nem no overrideMediaWidth.
|
|
53
|
+
const useBreakpointMatch = (breakpoint, type, overrideWidth) => {
|
|
54
|
+
const hasBreakpoint = breakpoint !== undefined && breakpoint !== null;
|
|
55
|
+
const useOverride = hasBreakpoint && overrideWidth !== undefined;
|
|
56
|
+
const query = hasBreakpoint && !useOverride ? "(".concat(type, ": ").concat(breakpoint + scrollWidth, "px)") : 'not all';
|
|
57
|
+
const mediaMatch = useMatchMedia(query);
|
|
58
|
+
if (!hasBreakpoint) return false;
|
|
59
|
+
return useOverride ? matchesOverrideWidth(overrideWidth, breakpoint, type) : mediaMatch;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// styled(Base) mira num componente, não numa tag: ao contrário do antigo styled.div, o
|
|
63
|
+
// styled-components não filtra prop inválida pra <div> nesse caso. Por isso tira aqui, à mão,
|
|
64
|
+
// toda prop que ou é lida só pelo template (margin, last) ou só existe pra decidir a classe
|
|
65
|
+
// aqui dentro (viewportMinWidth, twoColumnsBelowVW), antes de espalhar o resto no elemento real.
|
|
66
|
+
const SplitColumnsContainerBase = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
67
|
+
var _useTheme;
|
|
68
|
+
let {
|
|
69
|
+
viewportMinWidth = 0,
|
|
70
|
+
twoColumnsBelowVW,
|
|
71
|
+
margin,
|
|
72
|
+
last,
|
|
73
|
+
className
|
|
74
|
+
} = _ref,
|
|
75
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
76
|
+
const overrideWidth = (_useTheme = useTheme()) === null || _useTheme === void 0 ? void 0 : _useTheme.overrideMediaWidth;
|
|
77
|
+
const isFlex = useBreakpointMatch(viewportMinWidth, 'min-width', overrideWidth);
|
|
78
|
+
const isTwoColumns = useBreakpointMatch(twoColumnsBelowVW, 'max-width', overrideWidth);
|
|
79
|
+
const classes = [className, isFlex && 'JS-flex-columns', isTwoColumns && 'JS-two-columns'].filter(Boolean).join(' ');
|
|
80
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
81
|
+
ref: ref,
|
|
82
|
+
className: classes || undefined
|
|
83
|
+
}, rest));
|
|
84
|
+
});
|
|
85
|
+
const SplitColumnsContainer = /*#__PURE__*/styled(SplitColumnsContainerBase).withConfig({
|
|
20
86
|
displayName: "SplitColumnsContainer",
|
|
21
87
|
componentId: "sc-1h4sw88-0"
|
|
22
|
-
})(["margin-bottom:", "rem
|
|
88
|
+
})(["margin-bottom:", "rem;&.JS-flex-columns{display:flex;flex-wrap:nowrap;margin-left:", "rem;margin-right:", "rem;margin-top:", "rem;> *{flex-basis:0;flex-grow:1;margin-left:", "rem;margin-right:", "rem;margin-top:", "rem;}}&.JS-two-columns{flex-wrap:wrap;> *{flex-basis:47%;}}"], props => getMarginFromFieldChild(props), props => -getMargin(splitColumnMargins)(props) / 2, props => -getMargin(splitColumnMargins)(props) / 2, props => -getMargin(splitColumnMargins)(props), props => getMargin(splitColumnMargins)(props) / 2, props => getMargin(splitColumnMargins)(props) / 2, props => getMargin(splitColumnMargins)(props));
|
|
89
|
+
// O plugin/babel-plugin-styled-components infere o displayName do nome da variável — mas só
|
|
90
|
+
// quando o import `styled` vem de 'styled-components' (modo sc). No lib-yak o arquivo passa a
|
|
91
|
+
// importar `styled` de '@yak/react' e isso não acontece mais, então fica explícito aqui, nos dois
|
|
92
|
+
// modos: fixDoubledLastMarginBottom precisa do mesmo valor em "SplitColumnsContainer.displayName".
|
|
93
|
+
SplitColumnsContainer.displayName = 'SplitColumnsContainer';
|
|
23
94
|
const fixDoubledLastMarginBottom = children => {
|
|
24
95
|
let last = React.Children.count(children) - 1;
|
|
25
96
|
function processChild(child, i) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SplitColumnsContainer.mjs","sources":["../src/SplitColumnsContainer.jsx"],"sourcesContent":["import React from 'react'\n\nimport {getMargin, media} from '@startlibs/utils'\nimport styled, {css} from 'styled-components'\n\nconst getMarginFromFieldChild = (props) => {\n if (!props.last) return 0;\n const fields = React.Children.toArray(props.children).filter(c => c.type.displayName === \"Field\" || c.type.displayName === \"EnhancedInput\")\n if (!fields.length) return 0\n const lastField = fields.slice(-1)[0]\n return '-' + getMargin(props.theme.Field.margins)(lastField.props)\n}\n\n\nconst splitColumnMargins = {small:0.5,'default':1, big:2}\n\nexport const SplitColumnsContainer = styled.div`\n\n margin-bottom: ${getMarginFromFieldChild}rem;\n \n ${props => css`\n ${media.min(props.viewportMinWidth || 0)`\n display: flex;\n flex-wrap: nowrap;\n margin-left: -${props=>getMargin(splitColumnMargins)(props)/2}rem;\n margin-right: -${props=>getMargin(splitColumnMargins)(props)/2}rem;\n margin-top: -${props=>getMargin(splitColumnMargins)(props)}rem;\n > * {\n flex-basis: 0;\n flex-grow: 1;\n margin-left: ${props=>getMargin(splitColumnMargins)(props)/2}rem;\n margin-right: ${props=>getMargin(splitColumnMargins)(props)/2}rem;\n margin-top: ${props=>getMargin(splitColumnMargins)(props)}rem;\n }\n `}\n `}\n ${props => props.twoColumnsBelowVW && css`\n ${media.max(props.twoColumnsBelowVW)`\n flex-wrap: wrap;\n > * {\n flex-basis: 47%;\n }\n `}\n `}\n`\n\nexport const fixDoubledLastMarginBottom = (children) => {\n let last = React.Children.count(children)-1\n\n function processChild(child, i) {\n if (i === last && child && child.type && child.type.displayName === SplitColumnsContainer.displayName) {\n return React.cloneElement(child, {last: true})\n }\n return child\n }\n if (!Array.isArray(children) || children.length===0) {\n return processChild(children,0)\n }\n while ((!children[last] || (children[last] && children[last].type && children[last].type.displayName === \"Errors\")) && last > 0) {\n last--\n }\n return React.Children.map(children,processChild)\n}\n"],"names":["getMarginFromFieldChild","props","last","fields","React","Children","toArray","children","filter","c","type","displayName","length","lastField","slice","getMargin","theme","Field","margins","splitColumnMargins","small","big","SplitColumnsContainer","styled","div","withConfig","componentId","css","media","min","viewportMinWidth","_templateObject","_taggedTemplateLiteral","twoColumnsBelowVW","max","_templateObject2","fixDoubledLastMarginBottom","count","processChild","child","i","cloneElement","Array","isArray","map"],"mappings":";;;;;;AAKA,MAAMA,uBAAuB,GAAIC,KAAK,IAAK;AACzC,EAAA,IAAI,CAACA,KAAK,CAACC,IAAI,EAAE,OAAO,CAAC,CAAA;AACzB,EAAA,MAAMC,MAAM,GAAGC,KAAK,CAACC,QAAQ,CAACC,OAAO,CAACL,KAAK,CAACM,QAAQ,CAAC,CAACC,MAAM,CAACC,CAAC,IAAIA,CAAC,CAACC,IAAI,CAACC,WAAW,KAAK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AQ,CAACL,IAAI,CAAC,IAAKK,QAAQ,CAACL,IAAI,CAAC,IAAIK,QAAQ,CAACL,IAAI,CAAC,CAACQ,IAAI,IAAIH,QAAQ,CAACL,IAAI,CAAC,CAACQ,IAAI,CAACC,WAAW,KAAK,QAAS,KAAKT,IAAI,GAAG,CAAC,EAAE;AAC/HA,IAAAA,IAAI,EAAE,CAAA;AACR,GAAA;EACA,OAAOE,KAAK,CAACC,QAAQ,CAACuC,GAAG,CAACrC,QAAQ,EAAC+B,YAAY,CAAC,CAAA;AAClD;;;;"}
|
|
1
|
+
{"version":3,"file":"SplitColumnsContainer.mjs","sources":["../src/SplitColumnsContainer.jsx"],"sourcesContent":["import React from 'react'\n\nimport {callIfFunction, getMargin, scrollWidth} from '@startlibs/utils'\nimport styled, {useTheme} from 'styled-components'\n\nconst getMarginFromFieldChild = (props) => {\n if (!props.last) return 0;\n const fields = React.Children.toArray(props.children).filter(c => c.type.displayName === \"Field\" || c.type.displayName === \"EnhancedInput\")\n if (!fields.length) return 0\n const lastField = fields.slice(-1)[0]\n return '-' + getMargin(props.theme.Field.margins)(lastField.props)\n}\n\n\nconst splitColumnMargins = {small:0.5,'default':1, big:2}\n\n// viewportMinWidth/twoColumnsBelowVW vêm de props: não tem CSS estático possível pra eles (yak\n// extrai @media em tempo de build, não a partir de uma prop em tempo de render). Troca o\n// `media.min`/`media.max` (que embutiam um `@media` dinâmico) por um hook que ouve\n// `matchMedia` e liga/desliga classe — as duas regras de CSS ficam estáticas, e a mesma soma de\n// `scrollWidth` que `media()` já fazia entra aqui, pro breakpoint bater igual em px (inclusive\n// a 610px, entre 600 e 600 + barra de rolagem).\nconst useMatchMedia = (query) => {\n const getMatch = () => (typeof window !== 'undefined' && window.matchMedia) ? window.matchMedia(query).matches : false\n const [matches, setMatches] = React.useState(getMatch)\n React.useEffect(() => {\n if (typeof window === 'undefined' || !window.matchMedia) return\n const mql = window.matchMedia(query)\n const onChange = () => setMatches(mql.matches)\n onChange()\n const addListener = mql.addEventListener ? (cb) => mql.addEventListener('change', cb) : (cb) => mql.addListener(cb)\n const removeListener = mql.removeEventListener ? (cb) => mql.removeEventListener('change', cb) : (cb) => mql.removeListener(cb)\n addListener(onChange)\n return () => removeListener(onChange)\n }, [query])\n return matches\n}\n\n// Mesma comparação que checkCustomScreenWidth (utils/src/styled.js) fazia pro theme.overrideMediaWidth:\n// ignora o browser de verdade e compara direto contra o breakpoint (sem somar scrollWidth — o\n// override já é uma largura \"combinada\", não a viewport física). Usado em testes/impressão.\nconst matchesOverrideWidth = (overrideWidth, breakpoint, type) => {\n const currentWidth = callIfFunction(overrideWidth)\n return type === 'min-width' ? currentWidth >= breakpoint : currentWidth <= breakpoint\n}\n\n// `breakpoint` null/undefined == bloco original não tinha condição nenhuma pra testar (o `&&`\n// de `props.twoColumnsBelowVW &&`): nem entra no matchMedia, nem no overrideMediaWidth.\nconst useBreakpointMatch = (breakpoint, type, overrideWidth) => {\n const hasBreakpoint = breakpoint !== undefined && breakpoint !== null\n const useOverride = hasBreakpoint && overrideWidth !== undefined\n const query = (hasBreakpoint && !useOverride)\n ? `(${type}: ${breakpoint + scrollWidth}px)`\n : 'not all'\n const mediaMatch = useMatchMedia(query)\n if (!hasBreakpoint) return false\n return useOverride ? matchesOverrideWidth(overrideWidth, breakpoint, type) : mediaMatch\n}\n\n// styled(Base) mira num componente, não numa tag: ao contrário do antigo styled.div, o\n// styled-components não filtra prop inválida pra <div> nesse caso. Por isso tira aqui, à mão,\n// toda prop que ou é lida só pelo template (margin, last) ou só existe pra decidir a classe\n// aqui dentro (viewportMinWidth, twoColumnsBelowVW), antes de espalhar o resto no elemento real.\nconst SplitColumnsContainerBase = React.forwardRef(({viewportMinWidth = 0, twoColumnsBelowVW, margin, last, className, ...rest}, ref) => {\n const overrideWidth = useTheme()?.overrideMediaWidth\n const isFlex = useBreakpointMatch(viewportMinWidth, 'min-width', overrideWidth)\n const isTwoColumns = useBreakpointMatch(twoColumnsBelowVW, 'max-width', overrideWidth)\n const classes = [className, isFlex && 'JS-flex-columns', isTwoColumns && 'JS-two-columns'].filter(Boolean).join(' ')\n return <div ref={ref} className={classes || undefined} {...rest}/>\n})\n\nexport const SplitColumnsContainer = styled(SplitColumnsContainerBase)`\n margin-bottom: ${props => getMarginFromFieldChild(props)}rem;\n\n &.JS-flex-columns {\n display: flex;\n flex-wrap: nowrap;\n /* O yak extrai essas interpolações pra var(--...): um sinal de menos solto no texto estático,\n logo antes da interpolação, vira \"-var(--x)\" na folha final — sintaxe de CSS inválida\n (margin cai pro valor inicial, 0px). O sinal de menos tem que estar DENTRO do valor\n calculado, não no texto ao redor. */\n margin-left: ${props=> -getMargin(splitColumnMargins)(props)/2}rem;\n margin-right: ${props=> -getMargin(splitColumnMargins)(props)/2}rem;\n margin-top: ${props=> -getMargin(splitColumnMargins)(props)}rem;\n > * {\n flex-basis: 0;\n flex-grow: 1;\n margin-left: ${props=>getMargin(splitColumnMargins)(props)/2}rem;\n margin-right: ${props=>getMargin(splitColumnMargins)(props)/2}rem;\n margin-top: ${props=>getMargin(splitColumnMargins)(props)}rem;\n }\n }\n &.JS-two-columns {\n flex-wrap: wrap;\n > * {\n flex-basis: 47%;\n }\n }\n`\n// O plugin/babel-plugin-styled-components infere o displayName do nome da variável — mas só\n// quando o import `styled` vem de 'styled-components' (modo sc). No lib-yak o arquivo passa a\n// importar `styled` de '@yak/react' e isso não acontece mais, então fica explícito aqui, nos dois\n// modos: fixDoubledLastMarginBottom precisa do mesmo valor em \"SplitColumnsContainer.displayName\".\nSplitColumnsContainer.displayName = 'SplitColumnsContainer'\n\nexport const fixDoubledLastMarginBottom = (children) => {\n let last = React.Children.count(children)-1\n\n function processChild(child, i) {\n if (i === last && child && child.type && child.type.displayName === SplitColumnsContainer.displayName) {\n return React.cloneElement(child, {last: true})\n }\n return child\n }\n if (!Array.isArray(children) || children.length===0) {\n return processChild(children,0)\n }\n while ((!children[last] || (children[last] && children[last].type && children[last].type.displayName === \"Errors\")) && last > 0) {\n last--\n }\n return React.Children.map(children,processChild)\n}\n"],"names":["getMarginFromFieldChild","props","last","fields","React","Children","toArray","children","filter","c","type","displayName","length","lastField","slice","getMargin","theme","Field","margins","splitColumnMargins","small","big","useMatchMedia","query","getMatch","window","matchMedia","matches","setMatches","useState","useEffect","mql","onChange","addListener","addEventListener","cb","removeListener","removeEventListener","matchesOverrideWidth","overrideWidth","breakpoint","currentWidth","callIfFunction","useBreakpointMatch","hasBreakpoint","undefined","useOverride","concat","scrollWidth","mediaMatch","SplitColumnsContainerBase","forwardRef","_ref","ref","_useTheme","viewportMinWidth","twoColumnsBelowVW","margin","className","rest","_objectWithoutProperties","_excluded","useTheme","overrideMediaWidth","isFlex","isTwoColumns","classes","Boolean","join","createElement","_extends","SplitColumnsContainer","styled","withConfig","componentId","fixDoubledLastMarginBottom","count","processChild","child","i","cloneElement","Array","isArray","map"],"mappings":";;;;;;;AAKA,MAAMA,uBAAuB,GAAIC,KAAK,IAAK;AACzC,EAAA,IAAI,CAACA,KAAK,CAACC,IAAI,EAAE,OAAO,CAAC,CAAA;AACzB,EAAA,MAAMC,MAAM,GAAGC,KAAK,CAACC,QAAQ,CAACC,OAAO,CAACL,KAAK,CAACM,QAAQ,CAAC,CAACC,MAAM,CAACC,CAAC,IAAIA,CAAC,CAACC,IAAI,CAACC,WAAW,KAAK,OAAO,IAAIF,CAAC,CAACC,IAAI,CAACC,WAAW,KAAK,eAAe,CAAC,CAAA;AAC3I,EAAA,IAAI,CAACR,MAAM,CAACS,MAAM,EAAE,OAAO,CAAC,CAAA;EAC5B,MAAMC,SAAS,GAAGV,MAAM,CAACW,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACrC,EAAA,OAAO,GAAG,GAAGC,SAAS,CAACd,KAAK,CAACe,KAAK,CAACC,KAAK,CAACC,OAAO,CAAC,CAACL,SAAS,CAACZ,KAAK,CAAC,CAAA;AACpE,CAAC,CAAA;AAGD,MAAMkB,kBAAkB,GAAG;AAACC,E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I,CAAC,IAAIK,QAAQ,CAACL,IAAI,CAAC,CAACQ,IAAI,IAAIH,QAAQ,CAACL,IAAI,CAAC,CAACQ,IAAI,CAACC,WAAW,KAAK,QAAS,KAAKT,IAAI,GAAG,CAAC,EAAE;AAC/HA,IAAAA,IAAI,EAAE,CAAA;AACR,GAAA;EACA,OAAOE,KAAK,CAACC,QAAQ,CAAC8E,GAAG,CAAC5E,QAAQ,EAACsE,YAAY,CAAC,CAAA;AAClD;;;;"}
|
package/lib/TextButton.mjs
CHANGED
|
@@ -27,7 +27,7 @@ const TextButton = /*#__PURE__*/styled(_ref => {
|
|
|
27
27
|
}).withConfig({
|
|
28
28
|
displayName: "TextButton",
|
|
29
29
|
componentId: "sc-1eydmhc-0"
|
|
30
|
-
})(["display:inline-block;font-weight:600;font-size:", "px;color:", ";cursor:pointer;text-decoration:none
|
|
30
|
+
})(["display:inline-block;font-weight:600;font-size:", "px;color:", ";cursor:pointer;text-decoration:none;&:hover,&:active{color:", ";}", "{display:inline-block;margin-left:0.25rem;vertical-align:-3px;}", " & ~ &{margin-left:1rem;}"], props => props.fontSize ? props.fontSize : "14", props => props.alert ? getColor('alert') : getColor('main'), props => props.alert ? darken(0.1, getColor("alert")(props)) : darken(0.1, getColor("main")(props)), Loading, props => props.nowrap && "\n white-space: nowrap;\n ");
|
|
31
31
|
TextButton.a = props => /*#__PURE__*/React.createElement(TextButton, _extends({}, props, {
|
|
32
32
|
className: props.className,
|
|
33
33
|
innerAs: "a"
|
package/lib/TextButton.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextButton.mjs","sources":["../src/TextButton.jsx"],"sourcesContent":["import React from 'react'\nimport styled from 'styled-components';\nimport {darken} from 'polished'\nimport { getColor } from '@startlibs/utils';\nimport {Link} from './Link'\nimport {Loading} from './Loading'\n\nexport const TextButton = styled(({className,isLoading,alert, fontSize, children, innerAs: Wrapper = 'div', ...props}) => <Wrapper className={className} {...props}>\n {children} {isLoading && <Loading size={14} borderWidth={3} />}\n</Wrapper>)`\n display: inline-block;\n font-weight: 600;\n font-size: ${props => props.fontSize ? props.fontSize : \"14\"}px;\n color: ${props => props.alert ? getColor('alert') : getColor('main')};\n cursor: pointer;\n text-decoration: none;\n
|
|
1
|
+
{"version":3,"file":"TextButton.mjs","sources":["../src/TextButton.jsx"],"sourcesContent":["import React from 'react'\nimport styled from 'styled-components';\nimport {darken} from 'polished'\nimport { getColor } from '@startlibs/utils';\nimport {Link} from './Link'\nimport {Loading} from './Loading'\n\nexport const TextButton = styled(({className,isLoading,alert, fontSize, children, innerAs: Wrapper = 'div', ...props}) => <Wrapper className={className} {...props}>\n {children} {isLoading && <Loading size={14} borderWidth={3} />}\n</Wrapper>)`\n display: inline-block;\n font-weight: 600;\n font-size: ${props => props.fontSize ? props.fontSize : \"14\"}px;\n color: ${props => props.alert ? getColor('alert') : getColor('main')};\n cursor: pointer;\n text-decoration: none;\n &:hover, &:active {\n color: ${props => props.alert ? darken(0.1, getColor(\"alert\")(props)) : darken(0.1, getColor(\"main\")(props))};\n }\n ${Loading} {\n display: inline-block;\n margin-left: 0.25rem;\n vertical-align: -3px;\n }\n ${props => props.nowrap && `\n white-space: nowrap;\n `}\n & ~ & {\n margin-left: 1rem;\n }\n`\n\nTextButton.a = (props) => <TextButton {...props} className={props.className} innerAs=\"a\"/>\nTextButton.Link = (props) => <TextButton {...props} className={props.className} innerAs={Link}/>"],"names":["TextButton","styled","_ref","className","isLoading","alert","fontSize","children","innerAs","Wrapper","props","_objectWithoutProperties","_excluded","React","createElement","_extends","Loading","size","borderWidth","withConfig","displayName","componentId","getColor","darken","nowrap","a","Link"],"mappings":";;;;;;;;;;AAOaA,MAAAA,UAAU,gBAAGC,MAAM,CAACC,IAAA,IAAA;EAAA,IAAC;MAACC,SAAS;MAACC,SAAS;MAACC,KAAK;MAAEC,QAAQ;MAAEC,QAAQ;MAAEC,OAAO,EAAEC,OAAO,GAAG,KAAA;AAAe,KAAC,GAAAP,IAA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,CAAA,CAAC,CAAC,CAAA;AAC1FR,UAAU,CAAC0B,IAAI,GAAIhB,KAAK,iBAAKG,KAAA,CAAAC,aAAA,CAACd,UAAU,EAAAe,QAAA,KAAKL,KAAK,EAAA;EAAEP,SAAS,EAAEO,KAAK,CAACP,SAAU;AAACK,EAAAA,OAAO,EAAEkB,IAAAA;AAAK,CAAA,CAAC,CAAC;;;;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import _taggedTemplateLiteral from '@babel/runtime/helpers/taggedTemplateLiteral';
|
|
3
|
-
import styled, { css } from 'styled-components';
|
|
4
3
|
import _map from 'lodash/fp/map';
|
|
5
4
|
import _concat from 'lodash/fp/concat';
|
|
6
5
|
import _differenceBy from 'lodash/fp/differenceBy';
|
|
7
6
|
import _isObject from 'lodash/fp/isObject';
|
|
8
7
|
import React, { useMemo, useEffect, useRef } from 'react';
|
|
9
8
|
import { media, getColor, ifUndefined, getUID, oneWayAnimation, callIfFunction, constrainEvent } from '@startlibs/utils';
|
|
9
|
+
import styled, { css } from 'styled-components';
|
|
10
10
|
import { rgba } from 'polished';
|
|
11
11
|
import { willUseSharedState, useToggle, Fill } from '@startlibs/core';
|
|
12
12
|
import { FlipList } from './FlipList.mjs';
|
|
@@ -14,17 +14,17 @@ import { Icon } from './Icon.mjs';
|
|
|
14
14
|
import { Loading } from './Loading.mjs';
|
|
15
15
|
import { SwitchDiv } from './SwitchDiv.mjs';
|
|
16
16
|
|
|
17
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7
|
|
17
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
18
18
|
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; }
|
|
19
19
|
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; }
|
|
20
20
|
const NotificationContainer = /*#__PURE__*/styled.div.withConfig({
|
|
21
21
|
displayName: "ToastNotifications__NotificationContainer",
|
|
22
22
|
componentId: "sc-inycsj-0"
|
|
23
|
-
})(["position:fixed;bottom:0;max-height:100%;z-index:999999;display:flex;flex-direction:column-reverse;align-items:flex-end;overflow-y:auto;right:1.5rem;", " ", "
|
|
23
|
+
})(["position:fixed;bottom:0;max-height:100%;z-index:999999;display:flex;flex-direction:column-reverse;align-items:flex-end;overflow-y:auto;right:1.5rem;", " ", " &::-webkit-scrollbar{width:21px;height:21px;}&::-webkit-scrollbar-thumb{pointer-events:all;background:rgba(0,0,0,0.4);border-radius:100px;background-clip:padding-box;border:6px solid transparent;min-height:30px;min-width:30px;&:hover{background:rgba(0,0,0,0.5);background-clip:padding-box;border:6px solid transparent;}}&::-webkit-scrollbar-corner{background:transparent;}", " ", ""], media.desktop(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding-bottom: 1.5rem;\n "]))), media.mobile(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding-bottom: 0.75rem;\n "]))), media.desktop(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n &.JS-dialog-open {\n right: 2.75rem;\n }\n "]))), media.mobile(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n left: 0.75rem;\n right: 0.75rem;\n "]))));
|
|
24
24
|
const ToastBox = /*#__PURE__*/styled.div.withConfig({
|
|
25
25
|
displayName: "ToastNotifications__ToastBox",
|
|
26
26
|
componentId: "sc-inycsj-1"
|
|
27
|
-
})(["color:white;font-size:14px;font-weight:500;border-radius:12px;flex-shrink:0;margin-top:0.5rem;overflow:hidden;transition:0.3s background ease,0.4s opacity 1.5s;", " ", " ", ""], media.desktop(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n background: ", ";\n max-width: 300px;\n "])), props => rgba(getColor(props.type)(props), ifUndefined(props.opacity, 0.7))), media.mobile(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n background: ", ";\n "])), props => rgba(getColor(props.type)(props), ifUndefined(props.opacity, 0.8)))
|
|
27
|
+
})(["color:white;font-size:14px;font-weight:500;border-radius:12px;flex-shrink:0;margin-top:0.5rem;overflow:hidden;transition:0.3s background ease,0.4s opacity 1.5s;", " ", " ", ""], props => css(["background:", ";"], getColor(props.type)), media.desktop(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n background: ", ";\n max-width: 300px;\n "])), props => rgba(getColor(props.type)(props), ifUndefined(props.opacity, 0.7))), media.mobile(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n background: ", ";\n "])), props => rgba(getColor(props.type)(props), ifUndefined(props.opacity, 0.8))));
|
|
28
28
|
const NotificationTitleContainer = /*#__PURE__*/styled.div.withConfig({
|
|
29
29
|
displayName: "ToastNotifications__NotificationTitleContainer",
|
|
30
30
|
componentId: "sc-inycsj-2"
|
|
@@ -36,20 +36,26 @@ const NotificationTitle = /*#__PURE__*/styled.div.withConfig({
|
|
|
36
36
|
const NotificationContent = /*#__PURE__*/styled.div.withConfig({
|
|
37
37
|
displayName: "ToastNotifications__NotificationContent",
|
|
38
38
|
componentId: "sc-inycsj-4"
|
|
39
|
-
})(["display:flex;align-items:center;text-align:left;padding:1rem 1.5rem;", ""], media.mobile(
|
|
39
|
+
})(["display:flex;align-items:center;text-align:left;padding:1rem 1.5rem;", ""], media.mobile(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n justify-content: center;\n "]))));
|
|
40
|
+
// Task 13c: substitui a prop JSX `css="min-width: 0;"` (R13 proíbe essa forma no yak) por um
|
|
41
|
+
// styled component equivalente.
|
|
42
|
+
const NotificationContentBody = /*#__PURE__*/styled.div.withConfig({
|
|
43
|
+
displayName: "ToastNotifications__NotificationContentBody",
|
|
44
|
+
componentId: "sc-inycsj-5"
|
|
45
|
+
})(["min-width:0;"]);
|
|
40
46
|
const NotificationIconWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
41
47
|
displayName: "ToastNotifications__NotificationIconWrapper",
|
|
42
|
-
componentId: "sc-inycsj-
|
|
48
|
+
componentId: "sc-inycsj-6"
|
|
43
49
|
})(["margin-right:1rem;position:relative;width:36px;text-align:center;flex-shrink:0;", "{font-size:", "px;}"], Icon, props => props.isLoading ? 22 : props.iconFontSize || 40);
|
|
44
50
|
const CloseIcon = /*#__PURE__*/styled(Icon).attrs({
|
|
45
51
|
icon: 'x'
|
|
46
52
|
}).withConfig({
|
|
47
53
|
displayName: "ToastNotifications__CloseIcon",
|
|
48
|
-
componentId: "sc-inycsj-
|
|
49
|
-
})(["font-size:20px;cursor:pointer;width:2rem;height:2rem;line-height:2rem;text-align:center;position:absolute;top:50%;right:0.25rem;transform:translateY(-50%);border-radius:100px;opacity:0.8
|
|
54
|
+
componentId: "sc-inycsj-7"
|
|
55
|
+
})(["font-size:20px;cursor:pointer;width:2rem;height:2rem;line-height:2rem;text-align:center;position:absolute;top:50%;right:0.25rem;transform:translateY(-50%);border-radius:100px;opacity:0.8;&:hover,&:active{background:rgba(0,0,0,0.1);opacity:1;}"]);
|
|
50
56
|
const NotificationDetails = /*#__PURE__*/styled.div.withConfig({
|
|
51
57
|
displayName: "ToastNotifications__NotificationDetails",
|
|
52
|
-
componentId: "sc-inycsj-
|
|
58
|
+
componentId: "sc-inycsj-8"
|
|
53
59
|
})(["background:rgba(0,0,0,0.1);border-radius:8px;padding:1rem;margin:0 1rem 1rem;font-weight:400;font-size:13px;"]);
|
|
54
60
|
const [useToastNotifications, _useToastNotificationsRef, setToastNotifications] = willUseSharedState([]);
|
|
55
61
|
const formatNotification = (notification, extra) => _isObject(notification) ? _objectSpread(_objectSpread(_objectSpread({}, notification), extra), {}, {
|
|
@@ -173,7 +179,7 @@ const ToastNotifications = () => {
|
|
|
173
179
|
size: 36,
|
|
174
180
|
white: true,
|
|
175
181
|
absolute: true
|
|
176
|
-
})), /*#__PURE__*/React.createElement(
|
|
182
|
+
})), /*#__PURE__*/React.createElement(NotificationContentBody, null, callIfFunction(notification.content, closeWithLock))), notification.details && /*#__PURE__*/React.createElement(NotificationDetails, {
|
|
177
183
|
onClick: constrainEvent()
|
|
178
184
|
}, notification.details)));
|
|
179
185
|
}))));
|
|
@@ -206,10 +212,6 @@ const useNotificationContainerWidthLock = containerRef => {
|
|
|
206
212
|
unlockWidth
|
|
207
213
|
};
|
|
208
214
|
};
|
|
209
|
-
var _StyledDiv = /*#__PURE__*/styled("div").withConfig({
|
|
210
|
-
displayName: "ToastNotifications___StyledDiv",
|
|
211
|
-
componentId: "sc-inycsj-8"
|
|
212
|
-
})(["min-width:0;"]);
|
|
213
215
|
|
|
214
216
|
export { ToastNotifications, createToastNotification, useToastNotificationToggle, useToastNotifications, willShowToastNotification };
|
|
215
217
|
//# sourceMappingURL=ToastNotifications.mjs.map
|
|
@@ -1 +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 from 'styled-components'\nimport {rgba} from 'polished'\nimport {Fill, useToggle, willUseSharedState} from '@startlibs/core'\nimport {getUID, ifUndefined, media, callIfFunction, getColor} from '@startlibs/utils'\nimport {css} from \"styled-components/macro\";\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 ${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 ${props => css`background: ${getColor(props.type)};`}\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`\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 <div css=\"min-width: 0;\">{callIfFunction(notification.content,closeWithLock)}</div>\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","div","withConfig","displayName","componentId","media","desktop","_templateObject","_taggedTemplateLiteral","mobile","_templateObject2","_templateObject3","_templateObject4","ToastBox","_templateObject5","props","rgba","getColor","type","ifUndefined","opacity","_templateObject6","css","_templateObject7","NotificationTitleContainer","onClick","NotificationTitle","NotificationContent","_templateObject8","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","concat","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","_StyledDiv","details","lockCountRef","prevWidthRef","el","current","width","measured","getBoundingClientRect","next","Math","max"],"mappings":";;;;;;;;;;;;;;;;;;;AAaA,MAAMA,qBAAqB,gBAAGC,MAAM,CAACC,GAAG,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,2CAAA;EAAAC,WAAA,EAAA,aAAA;AAAA,CAAA,CAAA,CAAA,CAAA,sJAAA,EAAA,GAAA,EAAA,oXAAA,EAAA,GAAA,EAAA,EAAA,CAAA,EAUpCC,KAAK,CAACC,OAAO,CAAAC,eAAA,KAAAA,eAAA,GAAAC,sBAAA,CAAA,CAAA,mCAAA,CAAA,CAAA,CAAA,CAAA,EAGbH,KAAK,CAACI,MAAM,CAAAC,gBAAA,KAAAA,gBAAA,GAAAF,sBAAA,CAwBZH,CAAAA,oCAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,KAAK,CAACC,OAAO,CAAAK,gBAAA,KAAAA,gBAAA,GAAAH,sBAAA,CAAA,CAAA,4DAAA,CAAA,CAAA,CAAA,CAAA,EAKbH,KAAK,CAACI,MAAM,CAAAG,gBAAA,KAAAA,gBAAA,GAAAJ,sBAAA,CAIf,CAAA,+CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAED,MAAMK,QA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AACyC,KAAK,CAAA;MACrC,MAAMC,QAAQ,GAAGH,EAAE,CAACI,qBAAqB,EAAE,CAACF,KAAK,CAAA;AACjDF,MAAAA,EAAE,CAACvC,KAAK,CAACyC,KAAK,GAAGC,QAAQ,GAAG,IAAI,CAAA;AAClC,KAAA;AACAL,IAAAA,YAAY,CAACG,OAAO,GAAGH,YAAY,CAACG,OAAO,GAAG,CAAC,CAAA;GAChD,CAAA;EAED,MAAMhC,WAAW,GAAGA,MAAM;AACxB,IAAA,MAAM+B,EAAE,GAAGlC,YAAY,CAACmC,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,CAACvC,KAAK,CAACyC,KAAK,GAAGH,YAAY,CAACE,OAAO,IAAI,EAAE,CAAA;MAC3CF,YAAY,CAACE,OAAO,GAAG,IAAI,CAAA;AAC7B,KAAA;GACD,CAAA;EAED,OAAO;IAACjC,SAAS;AAAEC,IAAAA,WAAAA;GAAY,CAAA;AACjC,CAAC,CAAA;AAAA,IAAA2B,UAAA,gBAAA5H,MAAA,CAAA,KAAA,CAAA,CAAAE,UAAA,CAAA;EAAAC,WAAA,EAAA,gCAAA;EAAAC,WAAA,EAAA,aAAA;AAAA,CAAA,CAAA,CAAA,CAAA,cAAA,CAAA,CAAA;;;;"}
|
|
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","div","withConfig","displayName","componentId","media","desktop","_templateObject","_taggedTemplateLiteral","mobile","_templateObject2","_templateObject3","_templateObject4","ToastBox","props","css","getColor","type","_templateObject5","rgba","ifUndefined","opacity","_templateObject6","NotificationTitleContainer","onClick","NotificationTitle","NotificationContent","_templateObject7","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","concat","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,gBAAGC,MAAM,CAACC,GAAG,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,2CAAA;EAAAC,WAAA,EAAA,aAAA;AAAA,CAAA,CAAA,CAAA,CAAA,sJAAA,EAAA,GAAA,EAAA,uXAAA,EAAA,GAAA,EAAA,EAAA,CAAA,EAUpCC,KAAK,CAACC,OAAO,CAAAC,eAAA,KAAAA,eAAA,GAAAC,sBAAA,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,EAAE,CAAA;MAC3CF,YAAY,CAACE,OAAO,GAAG,IAAI,CAAA;AAC7B,KAAA;GACD,CAAA;EAED,OAAO;IAAChC,SAAS;AAAEC,IAAAA,WAAAA;GAAY,CAAA;AACjC,CAAC;;;;"}
|
|
@@ -8,7 +8,7 @@ var _templateObject;
|
|
|
8
8
|
const DialogWithImageHeader = /*#__PURE__*/styled(Dialog).withConfig({
|
|
9
9
|
displayName: "DialogWithImageHeader",
|
|
10
10
|
componentId: "sc-1f1ry4g-0"
|
|
11
|
-
})(["max-width:51rem;", "{background:", ";text-shadow:none;color:rgba(120,120,120,1);font-size:20px;box-shadow:rgba(0,0,0,0.2) 0px 1px 3px 0px,rgba(0,0,0,0.05) 0px 0px 0px 1px;width:36px;height:36px;line-height:36px;transition:0.1s ease-out
|
|
11
|
+
})(["max-width:51rem;", "{background:", ";text-shadow:none;color:rgba(120,120,120,1);font-size:20px;box-shadow:rgba(0,0,0,0.2) 0px 1px 3px 0px,rgba(0,0,0,0.05) 0px 0px 0px 1px;width:36px;height:36px;line-height:36px;transition:0.1s ease-out;&:hover{background-color:rgb(230,230,230);}&:active{background-color:rgb(220,220,220);transition:0s ease-out;}@supports (position:sticky){position:sticky;top:-2.5rem;right:0rem;float:right;margin-right:-1.25rem;margin-top:0.75rem;}", "}"], CloseIcon, getColor('gray240'), media.mobile(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n @supports (position: sticky) {\n top: 0;\n margin-right: -1rem;\n }\n "]))));
|
|
12
12
|
|
|
13
13
|
export { DialogWithImageHeader };
|
|
14
14
|
//# sourceMappingURL=DialogWithImageHeader.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogWithImageHeader.mjs","sources":["../../../src/alt/dialogs/DialogWithImageHeader.jsx"],"sourcesContent":["import React from 'react'\nimport styled from 'styled-components'\nimport {media, getColor} from '@startlibs/utils'\nimport {CloseIcon, Dialog} from '../../Dialog'\n\nexport const DialogWithImageHeader = styled(Dialog)`\n max-width: 51rem;\n \n ${CloseIcon} {\n background: ${getColor('gray240')};\n text-shadow: none;\n color: rgba(120,120,120,1);\n font-size: 20px;\n box-shadow: rgba(0,0,0,0.2) 0px 1px 3px 0px, rgba(0,0,0,0.05) 0px 0px 0px 1px;\n width: 36px;\n height: 36px;\n line-height: 36px;\n transition: 0.1s ease-out;\n
|
|
1
|
+
{"version":3,"file":"DialogWithImageHeader.mjs","sources":["../../../src/alt/dialogs/DialogWithImageHeader.jsx"],"sourcesContent":["import React from 'react'\nimport styled from 'styled-components'\nimport {media, getColor} from '@startlibs/utils'\nimport {CloseIcon, Dialog} from '../../Dialog'\n\nexport const DialogWithImageHeader = styled(Dialog)`\n max-width: 51rem;\n \n ${CloseIcon} {\n background: ${getColor('gray240')};\n text-shadow: none;\n color: rgba(120,120,120,1);\n font-size: 20px;\n box-shadow: rgba(0,0,0,0.2) 0px 1px 3px 0px, rgba(0,0,0,0.05) 0px 0px 0px 1px;\n width: 36px;\n height: 36px;\n line-height: 36px;\n transition: 0.1s ease-out;\n &:hover {\n background-color: rgb(230,230,230);\n }\n &:active {\n background-color: rgb(220,220,220);\n transition: 0s ease-out;\n }\n @supports (position: sticky) {\n position: sticky;\n top: -2.5rem;\n right: 0rem;\n float: right;\n margin-right: -1.25rem;\n margin-top: 0.75rem;\n }\n ${media.mobile`\n @supports (position: sticky) {\n top: 0;\n margin-right: -1rem;\n }\n `}\n \n }\n`"],"names":["DialogWithImageHeader","styled","Dialog","withConfig","displayName","componentId","CloseIcon","getColor","media","mobile","_templateObject","_taggedTemplateLiteral"],"mappings":";;;;;;;AAKO,MAAMA,qBAAqB,gBAAGC,MAAM,CAACC,MAAM,CAAC,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,uBAAA;EAAAC,WAAA,EAAA,cAAA;AAAA,CAAA,CAAA,CAAA,CAAA,kBAAA,EAAA,cAAA,EAAA,ibAAA,EAAA,GAAA,CAAA,EAG/CC,SAAS,EACKC,QAAQ,CAAC,SAAS,CAAC,EAwB/BC,KAAK,CAACC,MAAM,CAAAC,eAAA,KAAAA,eAAA,GAAAC,sBAAA,CAQjB,CAAA,sGAAA,CAAA,CAAA,CAAA,CAAA;;;;"}
|
|
@@ -10,7 +10,7 @@ import { willUseFlipSwitch } from '../../Flip.mjs';
|
|
|
10
10
|
import { Loading } from '../../Loading.mjs';
|
|
11
11
|
import { DialogContainer } from '../../containers/DialogContainer.mjs';
|
|
12
12
|
|
|
13
|
-
const _excluded = ["className", "tabIsOpen", "menuIsOpen", "sidebar", "Content", "openTab", "children", "title"];
|
|
13
|
+
const _excluded = ["className", "style", "tabIsOpen", "menuIsOpen", "sidebar", "Content", "openTab", "children", "title"];
|
|
14
14
|
var _templateObject, _templateObject2, _templateObject3;
|
|
15
15
|
const SideMenu = /*#__PURE__*/styled.div.withConfig({
|
|
16
16
|
displayName: "DialogWithSidebar__SideMenu",
|
|
@@ -19,7 +19,7 @@ const SideMenu = /*#__PURE__*/styled.div.withConfig({
|
|
|
19
19
|
const DialogTabMenu = /*#__PURE__*/styled.ul.withConfig({
|
|
20
20
|
displayName: "DialogWithSidebar__DialogTabMenu",
|
|
21
21
|
componentId: "sc-suvg9r-1"
|
|
22
|
-
})(["cursor:default;overflow:auto;text-align:left;color:inherit;user-select:none;li{position:relative;padding:1rem 2rem 1rem 4.1rem;font-size:14px;", "
|
|
22
|
+
})(["cursor:default;overflow:auto;text-align:left;color:inherit;user-select:none;li{position:relative;padding:1rem 2rem 1rem 4.1rem;font-size:14px;", " &:hover{background-color:", ";cursor:pointer;}&.selected{color:", ";background:rgba(0,132,214,0.125);pointer-events:none;}}.icon{position:absolute;left:1rem;top:50%;transform:translateY(-50%);width:3rem;text-align:center;line-height:0;font-size:26px;}", ""], media.mobile(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n font-size: 16px;\n "]))), getColor('bluishGray'), getColor('main'), props => props.menuTabIsOpen && "\n li {\n padding: 1.25rem 2rem 1.25rem 3.25rem;\n border-radius: 6px;\n }\n .icon{\n left: 0;\n }\n ");
|
|
23
23
|
const [fadeIn, relativeFadeout] = twoWayAnimation('opacity: 0;', 'opacity: 0;', 'opacity: 1;');
|
|
24
24
|
const absoluteOnLeave = oneWayAnimation('position: absolute;', 'position: absolute;');
|
|
25
25
|
const fadeOut = [absoluteOnLeave, relativeFadeout];
|
|
@@ -29,6 +29,7 @@ const MENU_TAB = '$menu$';
|
|
|
29
29
|
const DialogWithSidebarPresentation = _ref => {
|
|
30
30
|
let {
|
|
31
31
|
className,
|
|
32
|
+
style,
|
|
32
33
|
tabIsOpen,
|
|
33
34
|
menuIsOpen,
|
|
34
35
|
sidebar,
|
|
@@ -51,6 +52,7 @@ const DialogWithSidebarPresentation = _ref => {
|
|
|
51
52
|
} = _ref2;
|
|
52
53
|
return /*#__PURE__*/React.createElement("div", {
|
|
53
54
|
className: className + " JS-has-wc",
|
|
55
|
+
style: style,
|
|
54
56
|
ref: ref
|
|
55
57
|
}, props.closeDialog && /*#__PURE__*/React.createElement(CloseIcon, {
|
|
56
58
|
onClick: confirmCloseDialog
|
|
@@ -94,9 +96,11 @@ const TabContent = _ref3 => {
|
|
|
94
96
|
className: "dialog-content"
|
|
95
97
|
}, callIfFunction(Content, tab), callIfFunction(children, tab));
|
|
96
98
|
};
|
|
99
|
+
|
|
100
|
+
// R6: "as" não existe no yak. Dialog expõe "tagAs" no lugar (ver Dialog.jsx).
|
|
97
101
|
const DialogWithSidebar = /*#__PURE__*/styled(props => /*#__PURE__*/React.createElement(Dialog, _extends({
|
|
98
102
|
fullscreenOnMobile: true,
|
|
99
|
-
|
|
103
|
+
tagAs: DialogWithSidebarPresentation
|
|
100
104
|
}, props))).withConfig({
|
|
101
105
|
displayName: "DialogWithSidebar",
|
|
102
106
|
componentId: "sc-suvg9r-2"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogWithSidebar.mjs","sources":["../../../src/alt/dialogs/DialogWithSidebar.jsx"],"sourcesContent":["import React, {useRef} from 'react'\nimport styled from 'styled-components'\nimport {media, callIfFunction, getColor, twoWayAnimation, oneWayAnimation} from '@startlibs/utils'\nimport {useToggle, usePopupToggle, useLazyConstant} from '@startlibs/core'\nimport {CloseIcon, Dialog} from '../../Dialog'\nimport {willUseFlipSwitch} from '../../Flip'\nimport {Loading} from '../../Loading'\nimport {DialogContainer} from '../../containers/DialogContainer'\n\nexport const SideMenu = styled.div`\n background-color: ${getColor('lightBluishGray')};\n border-top-left-radius: 18px;\n border-bottom-left-radius: 18px;\n width: 19rem;\n flex-shrink: 0;\n padding: 1.25rem 0;\n ${props => !props.visibleOnDesktop && 'display:none;'}\n ${media.mobile`\n display:block;\n position:fixed;\n top:0;\n left:0;\n bottom:0;\n z-index:1000;\n transition: 0.25s transform ease-out;\n background-color: ${getColor('gray240')};\n box-shadow: -5px 0 20px 5px rgba(0,0,0,0.4);\n border-radius: 0;\n ${props => !props.isOpen && `\n transform: translateX(-100%);\n box-shadow: none;\n `}\n `}\n`\nexport const DialogTabMenu = styled.ul`\n cursor: default;\n overflow: auto;\n text-align: left;\n color: inherit;\n user-select: none;\n li {\n position: relative;\n padding: 1rem 2rem 1rem 4.1rem;\n font-size: 14px;\n ${media.mobile`\n font-size: 16px;\n `}\n
|
|
1
|
+
{"version":3,"file":"DialogWithSidebar.mjs","sources":["../../../src/alt/dialogs/DialogWithSidebar.jsx"],"sourcesContent":["import React, {useRef} from 'react'\nimport styled from 'styled-components'\nimport {media, callIfFunction, getColor, twoWayAnimation, oneWayAnimation} from '@startlibs/utils'\nimport {useToggle, usePopupToggle, useLazyConstant} from '@startlibs/core'\nimport {CloseIcon, Dialog} from '../../Dialog'\nimport {willUseFlipSwitch} from '../../Flip'\nimport {Loading} from '../../Loading'\nimport {DialogContainer} from '../../containers/DialogContainer'\n\nexport const SideMenu = styled.div`\n background-color: ${getColor('lightBluishGray')};\n border-top-left-radius: 18px;\n border-bottom-left-radius: 18px;\n width: 19rem;\n flex-shrink: 0;\n padding: 1.25rem 0;\n ${props => !props.visibleOnDesktop && 'display:none;'}\n ${media.mobile`\n display:block;\n position:fixed;\n top:0;\n left:0;\n bottom:0;\n z-index:1000;\n transition: 0.25s transform ease-out;\n background-color: ${getColor('gray240')};\n box-shadow: -5px 0 20px 5px rgba(0,0,0,0.4);\n border-radius: 0;\n ${props => !props.isOpen && `\n transform: translateX(-100%);\n box-shadow: none;\n `}\n `}\n`\nexport const DialogTabMenu = styled.ul`\n cursor: default;\n overflow: auto;\n text-align: left;\n color: inherit;\n user-select: none;\n li {\n position: relative;\n padding: 1rem 2rem 1rem 4.1rem;\n font-size: 14px;\n ${media.mobile`\n font-size: 16px;\n `}\n &:hover {\n background-color: ${getColor('bluishGray')};\n cursor: pointer;\n }\n &.selected {\n color: ${getColor('main')};\n background: rgba(0, 132, 214, 0.125);\n pointer-events: none;\n }\n }\n .icon{\n position: absolute;\n left: 1rem;\n top: 50%;\n transform: translateY(-50%);\n width: 3rem;\n text-align: center;\n line-height: 0;\n font-size: 26px;\n }\n ${props => props.menuTabIsOpen && `\n li {\n padding: 1.25rem 2rem 1.25rem 3.25rem;\n border-radius: 6px;\n }\n .icon{\n left: 0;\n }\n `}\n`\n\nconst [fadeIn, relativeFadeout] = twoWayAnimation('opacity: 0;','opacity: 0;', 'opacity: 1;')\nconst absoluteOnLeave = oneWayAnimation('position: absolute;', 'position: absolute;')\nconst fadeOut = [absoluteOnLeave,relativeFadeout]\n\nexport const MENU_TAB = '$menu$'\n\n// ponytail: sem footer — padrão do dialog com barra lateral; fecha pelo X ou por fora\nexport const DialogWithSidebarPresentation = ({className, style, tabIsOpen, menuIsOpen, sidebar, Content, openTab, children, title, ...props}) => {\n const tab = useToggle(tabIsOpen)\n const sideMenu = usePopupToggle(menuIsOpen)\n const ref = useRef()\n const switchAnimation = useLazyConstant(willUseFlipSwitch)\n\n const menuTabIsOpen = tab.isOpen === MENU_TAB\n\n return <DialogContainer {...props} ref={ref}>{({confirmCloseDialog}) =>\n <div className={className + \" JS-has-wc\"} style={style} ref={ref}>\n {\n props.closeDialog &&\n <CloseIcon onClick={confirmCloseDialog}/>\n }\n <SideMenu isOpen={sideMenu.isOpen} visibleOnDesktop>\n {sidebar(tab)}\n </SideMenu>\n\n <div className={(menuTabIsOpen ? \"menuTabIsOpen \" : \"\") + \"main-container\"}>\n <h2>{\n menuTabIsOpen ? \"Configurações gerais\" : <><span className=\"icon icon-menu mobile-only\" onClick={sideMenu.open}/>\n {title(tab)}</>}</h2>\n <React.Suspense fallback={<TabContent key=\"loading\" switchAnimation={switchAnimation} tab={tab} children={<Loading absolute/>} />}>\n <TabContent key={tab.isOpen} switchAnimation={switchAnimation} tab={tab} Content={Content} children={children} />\n </React.Suspense>\n </div>\n </div>\n }</DialogContainer>\n}\n\nconst TabContent = ({Content,children,tab,switchAnimation}) => {\n const contentRef = useRef()\n switchAnimation(contentRef,fadeIn,fadeOut)\n\n return <div ref={contentRef} className=\"dialog-content\">\n {callIfFunction(Content,tab)}\n {callIfFunction(children,tab)}\n </div>\n}\n\n// R6: \"as\" não existe no yak. Dialog expõe \"tagAs\" no lugar (ver Dialog.jsx).\nexport const DialogWithSidebar = styled((props) => <Dialog fullscreenOnMobile tagAs={DialogWithSidebarPresentation} {...props} />)`\n max-width: 59rem;\n display: flex;\n padding: 0;\n flex-direction: row;\n ${media.mobile`\n min-height: 100%;\n overflow: hidden;\n `}\n`\n"],"names":["SideMenu","styled","div","withConfig","displayName","componentId","getColor","props","visibleOnDesktop","media","mobile","_templateObject","_taggedTemplateLiteral","isOpen","DialogTabMenu","ul","_templateObject2","menuTabIsOpen","fadeIn","relativeFadeout","twoWayAnimation","absoluteOnLeave","oneWayAnimation","fadeOut","MENU_TAB","DialogWithSidebarPresentation","_ref","className","style","tabIsOpen","menuIsOpen","sidebar","Content","openTab","children","title","_objectWithoutProperties","_excluded","tab","useToggle","sideMenu","usePopupToggle","ref","useRef","switchAnimation","useLazyConstant","willUseFlipSwitch","React","createElement","DialogContainer","_extends","_ref2","confirmCloseDialog","closeDialog","CloseIcon","onClick","Fragment","open","Suspense","fallback","TabContent","key","Loading","absolute","_ref3","contentRef","callIfFunction","DialogWithSidebar","Dialog","fullscreenOnMobile","tagAs","_templateObject3"],"mappings":";;;;;;;;;;;;;;MASaA,QAAQ,gBAAGC,MAAM,CAACC,GAAG,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,6BAAA;EAAAC,WAAA,EAAA,aAAA;AAAA,CAAA,CAAA,CAAA,CAAA,mBAAA,EAAA,0GAAA,EAAA,GAAA,EAAA,EAAA,CAAA,EACZC,QAAQ,CAAC,iBAAiB,CAAC,EAM7CC,KAAK,IAAI,CAACA,KAAK,CAACC,gBAAgB,IAAI,eAAe,EACnDC,KAAK,CAACC,MAAM,CAAAC,eAAA,KAAAA,eAAA,GAAAC,sBAAA,CAQQN,CAAAA,yKAAAA,EAAAA,kFAAAA,EAAAA,MAAAA,CAAAA,CAAAA,CAAAA,EAAAA,QAAQ,CAAC,SAAS,CAAC,EAGrCC,KAAK,IAAI,CAACA,KAAK,CAACM,MAAM,0EAGvB,CAEJ,EAAA;MACYC,aAAa,gBAAGb,MAAM,CAACc,EAAE,CAAAZ,UAAA,CAAA;EAAAC,WAAA,EAAA,kCAAA;EAAAC,WAAA,EAAA,aAAA;AAAA,CAUhCI,CAAAA,CAAAA,CAAAA,gJAAAA,EAAAA,4BAAAA,EAAAA,oCAAAA,EAAAA,0LAAAA,EAAAA,EAAAA,CAAAA,EAAAA,KAAK,CAACC,MAAM,CAAAM,gBAAA,KAAAA,gBAAA,GAAAJ,sBAAA,CAIQN,CAAAA,gCAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,QAAQ,CAAC,YAAY,CAAC,EAIjCA,QAAQ,CAAC,MAAM,CAAC,EAe3BC,KAAK,IAAIA,KAAK,CAACU,aAAa,IAAA,mIAQ7B,EACF;AAED,MAAM,CAACC,MAAM,EAAEC,eAAe,CAAC,GAAGC,eAAe,CAAC,aAAa,EAAC,aAAa,EAAE,aAAa,C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AAAA,QAAQ,EAAEA,QAAAA;KAAW,CAClG,CACb,CACF,CAAC,CAAA;AAAA,GACU,CAAC,CAAA;AACvB,EAAC;AAED,MAAM0B,UAAU,GAAGI,KAAA,IAA4C;EAAA,IAA3C;IAAChC,OAAO;IAACE,QAAQ;IAACI,GAAG;AAACM,IAAAA,eAAAA;AAAe,GAAC,GAAAoB,KAAA,CAAA;AACxD,EAAA,MAAMC,UAAU,GAAGtB,MAAM,EAAE,CAAA;AAC3BC,EAAAA,eAAe,CAACqB,UAAU,EAAC/C,MAAM,EAACK,OAAO,CAAC,CAAA;EAE1C,oBAAOwB,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAA;AAAKN,IAAAA,GAAG,EAAEuB,UAAW;AAACtC,IAAAA,SAAS,EAAC,gBAAA;AAAgB,GAAA,EACpDuC,cAAc,CAAClC,OAAO,EAACM,GAAG,CAAC,EAC3B4B,cAAc,CAAChC,QAAQ,EAACI,GAAG,CACzB,CAAC,CAAA;AACR,CAAC,CAAA;;AAED;AACa6B,MAAAA,iBAAiB,gBAAGlE,MAAM,CAAEM,KAAK,iBAAKwC,KAAA,CAAAC,aAAA,CAACoB,MAAM,EAAAlB,QAAA,CAAA;EAACmB,kBAAkB,EAAA,IAAA;AAACC,EAAAA,KAAK,EAAE7C,6BAAAA;AAA8B,CAAA,EAAKlB,KAAK,CAAG,CAAC,CAAC,CAAAJ,UAAA,CAAA;EAAAC,WAAA,EAAA,mBAAA;EAAAC,WAAA,EAAA,aAAA;AAAA,CAK9HI,CAAAA,CAAAA,CAAAA,4DAAAA,EAAAA,EAAAA,CAAAA,EAAAA,KAAK,CAACC,MAAM,CAAA6D,gBAAA,KAAAA,gBAAA,GAAA3D,sBAAA,CAIf,CAAA,oDAAA,CAAA,CAAA,CAAA,CAAA;;;;"}
|
|
@@ -10,7 +10,7 @@ const _excluded = ["className", "footer", "Content", "children", "title", "illus
|
|
|
10
10
|
const MobileBubbleDialogFooter = /*#__PURE__*/styled.div.withConfig({
|
|
11
11
|
displayName: "MobileBubbleDialog__MobileBubbleDialogFooter",
|
|
12
12
|
componentId: "sc-riqrem-0"
|
|
13
|
-
})(["background-color:", ";min-height:5rem;color:", ";font-size:13px;font-weight:500;text-transform:uppercase;padding:1rem;user-select:none;display:flex;align-items:center;justify-content:center;cursor:pointer;border-bottom-left-radius:10px;border-bottom-right-radius:10px
|
|
13
|
+
})(["background-color:", ";min-height:5rem;color:", ";font-size:13px;font-weight:500;text-transform:uppercase;padding:1rem;user-select:none;display:flex;align-items:center;justify-content:center;cursor:pointer;border-bottom-left-radius:10px;border-bottom-right-radius:10px;&:active{background:rgb(232,232,232);}"], getColor('gray240'), getColor('main'));
|
|
14
14
|
const MobileBubbleDialog = /*#__PURE__*/styled(_ref => {
|
|
15
15
|
let {
|
|
16
16
|
className,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileBubbleDialog.mjs","sources":["../../../src/alt/dialogs/MobileBubbleDialog.jsx"],"sourcesContent":["import React, {useRef} from 'react'\n\nimport {callIfFunction, getColor} from '@startlibs/utils'\nimport styled from 'styled-components'\n\nimport {DialogErrorContent} from '../../Dialog'\nimport {DialogContainer} from '../../containers/DialogContainer'\n\nconst MobileBubbleDialogFooter = styled.div `\n background-color: ${getColor('gray240')};\n min-height: 5rem;\n color: ${getColor('main')};\n font-size: 13px;\n font-weight: 500;\n text-transform: uppercase;\n padding: 1rem;\n user-select: none;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n border-bottom-left-radius: 10px;\n border-bottom-right-radius: 10px;\n
|
|
1
|
+
{"version":3,"file":"MobileBubbleDialog.mjs","sources":["../../../src/alt/dialogs/MobileBubbleDialog.jsx"],"sourcesContent":["import React, {useRef} from 'react'\n\nimport {callIfFunction, getColor} from '@startlibs/utils'\nimport styled from 'styled-components'\n\nimport {DialogErrorContent} from '../../Dialog'\nimport {DialogContainer} from '../../containers/DialogContainer'\n\nconst MobileBubbleDialogFooter = styled.div `\n background-color: ${getColor('gray240')};\n min-height: 5rem;\n color: ${getColor('main')};\n font-size: 13px;\n font-weight: 500;\n text-transform: uppercase;\n padding: 1rem;\n user-select: none;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n border-bottom-left-radius: 10px;\n border-bottom-right-radius: 10px;\n &:active {\n background: rgb(232,232,232);\n }\n`\n\nexport const MobileBubbleDialog = styled(({className, footer, Content, children, title, illustration, icon, auxiliarActions, ...props}) => {\n const ref = useRef()\n return <DialogContainer {...props} closeOnClick ref={ref} DialogErrorContent={DialogErrorContent} title={title}>{({confirmCloseDialog}) =>\n <>\n <div className={className} ref={ref}>\n {\n children && callIfFunction(children)\n }\n <MobileBubbleDialogFooter onClick={confirmCloseDialog}>\n Fechar\n </MobileBubbleDialogFooter>\n </div>\n </>\n }</DialogContainer>\n})`\n border-radius: 10px;\n background-color: white;\n width: 100%;\n margin: auto;\n position: relative;\n align-self: baseline;\n overflow: hidden;\n @supports (flex-wrap: wrap) {\n display: flex;\n flex-direction: column;\n }\n`\n\n"],"names":["MobileBubbleDialogFooter","styled","div","withConfig","displayName","componentId","getColor","MobileBubbleDialog","_ref","className","footer","Content","children","title","illustration","icon","auxiliarActions","props","_objectWithoutProperties","_excluded","ref","useRef","React","createElement","DialogContainer","_extends","closeOnClick","DialogErrorContent","_ref2","confirmCloseDialog","Fragment","callIfFunction","onClick"],"mappings":";;;;;;;;;AAQA,MAAMA,wBAAwB,gBAAGC,MAAM,CAACC,GAAG,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,8CAAA;EAAAC,WAAA,EAAA,aAAA;AAAA,CACrBC,CAAAA,CAAAA,CAAAA,mBAAAA,EAAAA,yBAAAA,EAAAA,oQAAAA,CAAAA,EAAAA,QAAQ,CAAC,SAAS,CAAC,EAE9BA,QAAQ,CAAC,MAAM,CAAC,CAe1B,CAAA;MAEYC,kBAAkB,gBAAGN,MAAM,CAACO,IAAA,IAAkG;EAAA,IAAjG;MAACC,SAAS;MAAEC,MAAM;MA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