@startlibs/components 1.1.5 → 1.2.0-rc.2
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 +31 -12
- package/lib/containers/DialogContainer.mjs.map +1 -1
- package/lib/index.cjs +288 -95
- 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 +468 -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 +13 -6
- package/src/willUseIsSticky.jsx +22 -2
package/src/TextButton.jsx
CHANGED
|
@@ -14,7 +14,7 @@ export const TextButton = styled(({className,isLoading,alert, fontSize, children
|
|
|
14
14
|
color: ${props => props.alert ? getColor('alert') : getColor('main')};
|
|
15
15
|
cursor: pointer;
|
|
16
16
|
text-decoration: none;
|
|
17
|
-
|
|
17
|
+
&:hover, &:active {
|
|
18
18
|
color: ${props => props.alert ? darken(0.1, getColor("alert")(props)) : darken(0.1, getColor("main")(props))};
|
|
19
19
|
}
|
|
20
20
|
${Loading} {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React, {useEffect, useMemo, useRef} from 'react'
|
|
2
2
|
import {oneWayAnimation, constrainEvent} from '@startlibs/utils'
|
|
3
3
|
import _ from 'lodash/fp'
|
|
4
|
-
import styled from 'styled-components'
|
|
4
|
+
import styled, {css} from 'styled-components'
|
|
5
5
|
import {rgba} from 'polished'
|
|
6
6
|
import {Fill, useToggle, willUseSharedState} from '@startlibs/core'
|
|
7
7
|
import {getUID, ifUndefined, media, callIfFunction, getColor} from '@startlibs/utils'
|
|
8
|
-
import {css} from "styled-components/macro";
|
|
9
8
|
import {FlipList} from './FlipList'
|
|
10
9
|
import {Icon} from './Icon'
|
|
11
10
|
import {Loading} from './Loading'
|
|
@@ -27,11 +26,11 @@ const NotificationContainer = styled.div `
|
|
|
27
26
|
${media.mobile`
|
|
28
27
|
padding-bottom: 0.75rem;
|
|
29
28
|
`}
|
|
30
|
-
|
|
29
|
+
&::-webkit-scrollbar {
|
|
31
30
|
width: 21px;
|
|
32
31
|
height: 21px;
|
|
33
32
|
}
|
|
34
|
-
|
|
33
|
+
&::-webkit-scrollbar-thumb {
|
|
35
34
|
pointer-events: all;
|
|
36
35
|
background: rgba(0,0,0,0.4);
|
|
37
36
|
border-radius: 100px;
|
|
@@ -45,7 +44,7 @@ const NotificationContainer = styled.div `
|
|
|
45
44
|
border: 6px solid transparent;
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
|
-
|
|
47
|
+
&::-webkit-scrollbar-corner {
|
|
49
48
|
background: transparent;
|
|
50
49
|
}
|
|
51
50
|
${media.desktop`
|
|
@@ -68,6 +67,10 @@ const ToastBox = styled.div`
|
|
|
68
67
|
margin-top: 0.5rem;
|
|
69
68
|
overflow: hidden;
|
|
70
69
|
transition: 0.3s background ease, 0.4s opacity 1.5s;
|
|
70
|
+
/* styled-components (stylis) hoista bloco aninhado de @media para depois do flat; o
|
|
71
|
+
yak preserva a ordem do fonte. Esse fallback sólido precisa vir ANTES dos media
|
|
72
|
+
abaixo, ou o yak aplicaria ele por último (ganhando sempre) nos dois breakpoints. */
|
|
73
|
+
${props => css`background: ${getColor(props.type)};`}
|
|
71
74
|
${media.desktop`
|
|
72
75
|
background: ${props => rgba(getColor(props.type)(props),ifUndefined(props.opacity,0.7))};
|
|
73
76
|
max-width: 300px;
|
|
@@ -75,7 +78,6 @@ const ToastBox = styled.div`
|
|
|
75
78
|
${media.mobile`
|
|
76
79
|
background: ${props => rgba(getColor(props.type)(props),ifUndefined(props.opacity,0.8))};
|
|
77
80
|
`}
|
|
78
|
-
${props => css`background: ${getColor(props.type)};`}
|
|
79
81
|
`
|
|
80
82
|
const NotificationTitleContainer = styled.div`
|
|
81
83
|
background: rgba(0,0,0,0.1);
|
|
@@ -103,6 +105,11 @@ const NotificationContent = styled.div`
|
|
|
103
105
|
justify-content: center;
|
|
104
106
|
`}
|
|
105
107
|
`
|
|
108
|
+
// Task 13c: substitui a prop JSX `css="min-width: 0;"` (R13 proíbe essa forma no yak) por um
|
|
109
|
+
// styled component equivalente.
|
|
110
|
+
const NotificationContentBody = styled.div`
|
|
111
|
+
min-width: 0;
|
|
112
|
+
`
|
|
106
113
|
const NotificationIconWrapper = styled.div`
|
|
107
114
|
margin-right: 1rem;
|
|
108
115
|
position: relative;
|
|
@@ -126,7 +133,7 @@ const CloseIcon = styled(Icon).attrs({icon: 'x'})`
|
|
|
126
133
|
transform: translateY(-50%);
|
|
127
134
|
border-radius: 100px;
|
|
128
135
|
opacity: 0.8;
|
|
129
|
-
|
|
136
|
+
&:hover, &:active {
|
|
130
137
|
background: rgba(0,0,0,0.1);
|
|
131
138
|
opacity: 1;
|
|
132
139
|
}
|
|
@@ -251,7 +258,7 @@ export const ToastNotifications = () => {
|
|
|
251
258
|
{notification.isLoading && <Loading size={36} white absolute/>}
|
|
252
259
|
</NotificationIconWrapper>
|
|
253
260
|
}
|
|
254
|
-
<
|
|
261
|
+
<NotificationContentBody>{callIfFunction(notification.content,closeWithLock)}</NotificationContentBody>
|
|
255
262
|
</NotificationContent>
|
|
256
263
|
{notification.details &&
|
|
257
264
|
<NotificationDetails onClick={constrainEvent()}>
|
|
@@ -16,10 +16,10 @@ export const DialogWithImageHeader = styled(Dialog)`
|
|
|
16
16
|
height: 36px;
|
|
17
17
|
line-height: 36px;
|
|
18
18
|
transition: 0.1s ease-out;
|
|
19
|
-
|
|
19
|
+
&:hover {
|
|
20
20
|
background-color: rgb(230,230,230);
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
&:active {
|
|
23
23
|
background-color: rgb(220,220,220);
|
|
24
24
|
transition: 0s ease-out;
|
|
25
25
|
}
|
|
@@ -45,7 +45,7 @@ export const DialogTabMenu = styled.ul`
|
|
|
45
45
|
${media.mobile`
|
|
46
46
|
font-size: 16px;
|
|
47
47
|
`}
|
|
48
|
-
|
|
48
|
+
&:hover {
|
|
49
49
|
background-color: ${getColor('bluishGray')};
|
|
50
50
|
cursor: pointer;
|
|
51
51
|
}
|
|
@@ -68,7 +68,7 @@ export const DialogTabMenu = styled.ul`
|
|
|
68
68
|
${props => props.menuTabIsOpen && `
|
|
69
69
|
li {
|
|
70
70
|
padding: 1.25rem 2rem 1.25rem 3.25rem;
|
|
71
|
-
border-radius: 6px
|
|
71
|
+
border-radius: 6px;
|
|
72
72
|
}
|
|
73
73
|
.icon{
|
|
74
74
|
left: 0;
|
|
@@ -83,7 +83,7 @@ const fadeOut = [absoluteOnLeave,relativeFadeout]
|
|
|
83
83
|
export const MENU_TAB = '$menu$'
|
|
84
84
|
|
|
85
85
|
// ponytail: sem footer — padrão do dialog com barra lateral; fecha pelo X ou por fora
|
|
86
|
-
export const DialogWithSidebarPresentation = ({className, tabIsOpen, menuIsOpen, sidebar, Content, openTab, children, title, ...props}) => {
|
|
86
|
+
export const DialogWithSidebarPresentation = ({className, style, tabIsOpen, menuIsOpen, sidebar, Content, openTab, children, title, ...props}) => {
|
|
87
87
|
const tab = useToggle(tabIsOpen)
|
|
88
88
|
const sideMenu = usePopupToggle(menuIsOpen)
|
|
89
89
|
const ref = useRef()
|
|
@@ -92,7 +92,7 @@ export const DialogWithSidebarPresentation = ({className, tabIsOpen, menuIsOpen,
|
|
|
92
92
|
const menuTabIsOpen = tab.isOpen === MENU_TAB
|
|
93
93
|
|
|
94
94
|
return <DialogContainer {...props} ref={ref}>{({confirmCloseDialog}) =>
|
|
95
|
-
<div className={className + " JS-has-wc"} ref={ref}>
|
|
95
|
+
<div className={className + " JS-has-wc"} style={style} ref={ref}>
|
|
96
96
|
{
|
|
97
97
|
props.closeDialog &&
|
|
98
98
|
<CloseIcon onClick={confirmCloseDialog}/>
|
|
@@ -123,7 +123,8 @@ const TabContent = ({Content,children,tab,switchAnimation}) => {
|
|
|
123
123
|
</div>
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
// R6: "as" não existe no yak. Dialog expõe "tagAs" no lugar (ver Dialog.jsx).
|
|
127
|
+
export const DialogWithSidebar = styled((props) => <Dialog fullscreenOnMobile tagAs={DialogWithSidebarPresentation} {...props} />)`
|
|
127
128
|
max-width: 59rem;
|
|
128
129
|
display: flex;
|
|
129
130
|
padding: 0;
|
|
@@ -35,13 +35,20 @@ export const ModalContainer = styled.div`
|
|
|
35
35
|
scrollbar-color: transparent transparent;
|
|
36
36
|
`
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
// R6: "as" não existe no yak. tagAs troca a tag renderizada (form quando a dialog embute um
|
|
39
|
+
// form, senão div). withScroll/fullscreen/fullscreenOnMobile são lidos pelo template abaixo,
|
|
40
|
+
// mas não são atributos DOM válidos: como o alvo do styled() agora é um componente (não mais
|
|
41
|
+
// styled.div puro), o styled-components para de filtrar prop inválida sozinho — tiram-se à mão
|
|
42
|
+
// antes do spread no elemento real.
|
|
43
|
+
const DialogCenterTagAs = React.forwardRef(({tagAs: Tag = 'div', withScroll, fullscreen, fullscreenOnMobile, ...props}, ref) => <Tag ref={ref} {...props}/>)
|
|
44
|
+
|
|
45
|
+
const DialogCenter = styled(DialogCenterTagAs)`
|
|
39
46
|
@supports (position:sticky) {
|
|
40
47
|
will-change: transform, opacity;
|
|
41
48
|
&.JS-wc-off {
|
|
42
49
|
will-change: auto;
|
|
43
50
|
}
|
|
44
|
-
}
|
|
51
|
+
}
|
|
45
52
|
display: -webkit-box;
|
|
46
53
|
display: -ms-flexbox;
|
|
47
54
|
display: flex;
|
|
@@ -59,7 +66,7 @@ const DialogCenter = styled.div`
|
|
|
59
66
|
right:0;
|
|
60
67
|
align-items: center;
|
|
61
68
|
${media.desktop`
|
|
62
|
-
padding: ${props => props.fullscreen ? '1rem' : '3rem 0.5rem
|
|
69
|
+
padding: ${props => props.fullscreen ? '1rem' : '3rem 0.5rem'};
|
|
63
70
|
`}
|
|
64
71
|
${media.mobile`
|
|
65
72
|
padding: ${props => props.fullscreenOnMobile ? '0' : '0.5rem'};
|
|
@@ -222,7 +229,7 @@ export const DialogContainer = forwardRef((
|
|
|
222
229
|
}
|
|
223
230
|
})
|
|
224
231
|
// clearPreventDialogPop()
|
|
225
|
-
if (document.body.scrollHeight === document.body.clientHeight) {
|
|
232
|
+
if (modal.current && document.body.scrollHeight === document.body.clientHeight) {
|
|
226
233
|
modal.current.style.overflowY = "scroll"
|
|
227
234
|
if (modalScroll.current) {
|
|
228
235
|
modalScroll.current.style.overflowY = "scroll"
|
|
@@ -374,7 +381,7 @@ export const DialogContainer = forwardRef((
|
|
|
374
381
|
if (getSize() === 1) {
|
|
375
382
|
removeWindowScroll(true);
|
|
376
383
|
}
|
|
377
|
-
if (document.body.scrollHeight === document.body.clientHeight) {
|
|
384
|
+
if (modal.current && document.body.scrollHeight === document.body.clientHeight) {
|
|
378
385
|
modal.current.style.overflowY = "none"
|
|
379
386
|
}
|
|
380
387
|
if (modalScroll.current) {
|
|
@@ -403,7 +410,7 @@ export const DialogContainer = forwardRef((
|
|
|
403
410
|
<AnimatedModal timing={animationTiming} blurBackdrop={blurBackdrop}/>
|
|
404
411
|
<ModalContainer ref={modal}>
|
|
405
412
|
|
|
406
|
-
<DialogCenter autoComplete={autoComplete} className="JS-has-wc" withScroll={getSize()>1} fullscreen={fullscreen} fullscreenOnMobile={fullscreenOnMobile} ref={modalScroll}
|
|
413
|
+
<DialogCenter autoComplete={autoComplete} className="JS-has-wc" withScroll={getSize()>1} fullscreen={fullscreen} fullscreenOnMobile={fullscreenOnMobile} ref={modalScroll} tagAs={usingForm ? 'form' : undefined} onClick={checkClick}
|
|
407
414
|
onSubmit={usingForm ? () => {} : undefined}
|
|
408
415
|
onMouseDown={mouseDown}>
|
|
409
416
|
{content}
|
package/src/willUseIsSticky.jsx
CHANGED
|
@@ -32,9 +32,29 @@ const SentinelStyle = styled.div`
|
|
|
32
32
|
visibility: hidden;
|
|
33
33
|
height:1px;
|
|
34
34
|
width: 1px;
|
|
35
|
-
${props => props.addCss}
|
|
36
35
|
`
|
|
37
36
|
|
|
37
|
+
// addCss é texto livre de declarações CSS (ex.: Combobox.jsx em @startlibs/form passa
|
|
38
|
+
// "margin-top:-3px;"), decidido em tempo de execução pelo chamador — não dá pra virar
|
|
39
|
+
// `css\`\`` (precisaria do texto na hora do build) nem ficar como interpolação solta no
|
|
40
|
+
// template (R14: o yak ignora em silêncio uma função que devolve texto livre numa posição de
|
|
41
|
+
// declaração). Vira `style` inline nos dois modos: mesmo resultado visual, sem CSS-in-JS aqui.
|
|
42
|
+
const cssTextToStyle = (text) => {
|
|
43
|
+
const style = {}
|
|
44
|
+
for (const declaration of (text || '').split(';')) {
|
|
45
|
+
const colonIndex = declaration.indexOf(':')
|
|
46
|
+
if (colonIndex === -1) continue
|
|
47
|
+
const property = declaration.slice(0, colonIndex).trim()
|
|
48
|
+
const value = declaration.slice(colonIndex + 1).trim()
|
|
49
|
+
if (!property || !value) continue
|
|
50
|
+
// Custom property (--foo) mantém o nome; o resto vira camelCase (margin-top -> marginTop),
|
|
51
|
+
// igual ao que o React espera num objeto de `style`.
|
|
52
|
+
const camelProperty = property.startsWith('--') ? property : property.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase())
|
|
53
|
+
style[camelProperty] = value
|
|
54
|
+
}
|
|
55
|
+
return Object.keys(style).length ? style : undefined
|
|
56
|
+
}
|
|
57
|
+
|
|
38
58
|
export const willUseIsSticky = (options = {}) => {
|
|
39
59
|
|
|
40
60
|
const [useRegister, onChange] = willUseSharedCallback()
|
|
@@ -100,7 +120,7 @@ export const willUseIsSticky = (options = {}) => {
|
|
|
100
120
|
}
|
|
101
121
|
},[])
|
|
102
122
|
|
|
103
|
-
const renderSentinel = (css = "") => <SentinelStyle
|
|
123
|
+
const renderSentinel = (css = "") => <SentinelStyle style={cssTextToStyle(css)} className={className} ref={ensuredRef} />
|
|
104
124
|
|
|
105
125
|
return children
|
|
106
126
|
? children(renderSentinel,isSticky)
|