@startlibs/components 1.0.4 → 1.1.0

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.
Files changed (115) hide show
  1. package/lib/BasicBulletList.mjs +9 -0
  2. package/lib/BasicBulletList.mjs.map +1 -0
  3. package/lib/Button.mjs +95 -0
  4. package/lib/Button.mjs.map +1 -0
  5. package/lib/ContextMenu.mjs +452 -0
  6. package/lib/ContextMenu.mjs.map +1 -0
  7. package/lib/Dialog.mjs +232 -0
  8. package/lib/Dialog.mjs.map +1 -0
  9. package/lib/Draggable.mjs +880 -0
  10. package/lib/Draggable.mjs.map +1 -0
  11. package/lib/ErrorBoundary.mjs +108 -0
  12. package/lib/ErrorBoundary.mjs.map +1 -0
  13. package/lib/FillLastLineResizer.mjs +238 -0
  14. package/lib/FillLastLineResizer.mjs.map +1 -0
  15. package/lib/Flip.mjs +604 -0
  16. package/lib/Flip.mjs.map +1 -0
  17. package/lib/FlipList.mjs +186 -0
  18. package/lib/FlipList.mjs.map +1 -0
  19. package/lib/FormatDate.mjs +25 -0
  20. package/lib/FormatDate.mjs.map +1 -0
  21. package/lib/Icon.mjs +50 -0
  22. package/lib/Icon.mjs.map +1 -0
  23. package/lib/Image.mjs +41 -0
  24. package/lib/Image.mjs.map +1 -0
  25. package/lib/Link.mjs +116 -0
  26. package/lib/Link.mjs.map +1 -0
  27. package/lib/Loading.mjs +10 -0
  28. package/lib/Loading.mjs.map +1 -0
  29. package/lib/LoadingDiv.mjs +83 -0
  30. package/lib/LoadingDiv.mjs.map +1 -0
  31. package/lib/Notifications.mjs +63 -0
  32. package/lib/Notifications.mjs.map +1 -0
  33. package/lib/PageLoader.mjs +42 -0
  34. package/lib/PageLoader.mjs.map +1 -0
  35. package/lib/PersistentNotifications.mjs +130 -0
  36. package/lib/PersistentNotifications.mjs.map +1 -0
  37. package/lib/Popup.mjs +49 -0
  38. package/lib/Popup.mjs.map +1 -0
  39. package/lib/SplitColumnsContainer.mjs +43 -0
  40. package/lib/SplitColumnsContainer.mjs.map +1 -0
  41. package/lib/SwitchDiv.mjs +61 -0
  42. package/lib/SwitchDiv.mjs.map +1 -0
  43. package/lib/TextButton.mjs +41 -0
  44. package/lib/TextButton.mjs.map +1 -0
  45. package/lib/ToastNotifications.mjs +215 -0
  46. package/lib/ToastNotifications.mjs.map +1 -0
  47. package/lib/Tooltip.mjs +160 -0
  48. package/lib/Tooltip.mjs.map +1 -0
  49. package/lib/TransitionDiv.mjs +56 -0
  50. package/lib/TransitionDiv.mjs.map +1 -0
  51. package/lib/WarningDialog.mjs +84 -0
  52. package/lib/WarningDialog.mjs.map +1 -0
  53. package/lib/alt/buttons/OnClickLoadingButton.mjs +36 -0
  54. package/lib/alt/buttons/OnClickLoadingButton.mjs.map +1 -0
  55. package/lib/alt/dialogs/DialogWithImageHeader.mjs +14 -0
  56. package/lib/alt/dialogs/DialogWithImageHeader.mjs.map +1 -0
  57. package/lib/alt/dialogs/DialogWithSidebar.mjs +106 -0
  58. package/lib/alt/dialogs/DialogWithSidebar.mjs.map +1 -0
  59. package/lib/alt/dialogs/MobileBubbleDialog.mjs +49 -0
  60. package/lib/alt/dialogs/MobileBubbleDialog.mjs.map +1 -0
  61. package/lib/containers/DialogContainer.mjs +413 -0
  62. package/lib/containers/DialogContainer.mjs.map +1 -0
  63. package/lib/containers/Reposition.mjs +35 -0
  64. package/lib/containers/Reposition.mjs.map +1 -0
  65. package/lib/containers/usePositioning.mjs +294 -0
  66. package/lib/containers/usePositioning.mjs.map +1 -0
  67. package/lib/index.cjs +5000 -0
  68. package/lib/index.cjs.map +1 -0
  69. package/lib/index.mjs +37 -0
  70. package/lib/index.mjs.map +1 -0
  71. package/lib/useDialogWithToggle.mjs +18 -0
  72. package/lib/useDialogWithToggle.mjs.map +1 -0
  73. package/lib/willUseIsSticky.mjs +123 -0
  74. package/lib/willUseIsSticky.mjs.map +1 -0
  75. package/package.json +44 -29
  76. package/src/BasicBulletList.jsx +21 -0
  77. package/src/Button.jsx +288 -0
  78. package/src/ContextMenu.jsx +621 -0
  79. package/src/Dialog.jsx +413 -0
  80. package/src/Draggable.jsx +801 -0
  81. package/src/ErrorBoundary.jsx +75 -0
  82. package/src/FillLastLineResizer.jsx +226 -0
  83. package/src/Flip.jsx +560 -0
  84. package/src/FlipList.jsx +136 -0
  85. package/src/FormatDate.jsx +9 -0
  86. package/src/Icon.jsx +49 -0
  87. package/src/Image.jsx +23 -0
  88. package/src/Link.jsx +68 -0
  89. package/src/Loading.jsx +29 -0
  90. package/src/LoadingDiv.jsx +75 -0
  91. package/src/Notifications.jsx +89 -0
  92. package/src/PageLoader.jsx +48 -0
  93. package/src/PersistentNotifications.jsx +182 -0
  94. package/src/Popup.jsx +49 -0
  95. package/src/SplitColumnsContainer.jsx +63 -0
  96. package/src/SwitchDiv.jsx +30 -0
  97. package/src/TextButton.jsx +34 -0
  98. package/src/ToastNotifications.jsx +298 -0
  99. package/src/Tooltip.jsx +158 -0
  100. package/src/TransitionDiv.jsx +34 -0
  101. package/src/WarningDialog.jsx +70 -0
  102. package/src/alt/buttons/OnClickLoadingButton.jsx +16 -0
  103. package/src/alt/dialogs/DialogWithImageHeader.jsx +42 -0
  104. package/src/alt/dialogs/DialogWithSidebar.jsx +135 -0
  105. package/src/alt/dialogs/MobileBubbleDialog.jsx +56 -0
  106. package/src/containers/DialogContainer.jsx +423 -0
  107. package/src/containers/Reposition.jsx +24 -0
  108. package/src/containers/usePositioning.jsx +305 -0
  109. package/src/index.js +35 -0
  110. package/src/useDialogWithToggle.jsx +12 -0
  111. package/src/willUseIsSticky.jsx +113 -0
  112. package/.babelrc +0 -27
  113. package/lib/index.js +0 -5429
  114. package/rollup.config.js +0 -52
  115. package/yarn-error.log +0 -3724
@@ -0,0 +1,294 @@
1
+ import _isFunction from 'lodash/fp/isFunction';
2
+ import React, { useRef, useState, useLayoutEffect, useEffect } from 'react';
3
+ import styled from 'styled-components';
4
+ import { getClosestOffsetScroll } from '@startlibs/utils';
5
+ import { useEnsureRef } from '@startlibs/core';
6
+ import { getDialogLayersSize } from './DialogContainer.mjs';
7
+
8
+ const Placeholder = /*#__PURE__*/styled.span.withConfig({
9
+ displayName: "usePositioning__Placeholder",
10
+ componentId: "sc-1m4912o-0"
11
+ })(["top:0;left:0;padding:0 !important;position:absolute;"]);
12
+ /*
13
+ type Alignment = 'top left' | 'top center' | 'top right' |
14
+ 'center left' | 'center center' | 'center right' |
15
+ 'bottom left' | 'bottom center' | 'bottom right'
16
+
17
+ type Collision = 'fit fit' | 'fit flip' | 'fit fitflip' | 'fit none' |
18
+ 'flip fit' | 'flip flip' | 'flip fitflip' | 'flip none' |
19
+ 'flipfit fit' | 'flipfit flip' | 'flipfit fitflip' | 'flipfit none' |
20
+ 'none fit' | 'none flip' | 'none fitflip' | 'none none'
21
+ */
22
+
23
+ const HORIZONTAL_MAPPING = ['left', 'center', 'right'];
24
+ const VERTICAL_MAPPING = ['top', 'center', 'bottom'];
25
+ const ARROW_KEY_POSITIONS = {
26
+ left: '0',
27
+ right: '-0',
28
+ top: '0',
29
+ bottom: '-0'
30
+ };
31
+ const POSITIONING_BOUNDS = {
32
+ left: 0,
33
+ top: 0,
34
+ right: 0,
35
+ bottom: 0
36
+ };
37
+ const addPositioningBound = (key, value) => {
38
+ POSITIONING_BOUNDS[key] += value;
39
+ return () => POSITIONING_BOUNDS[key] -= value;
40
+ };
41
+ function getPosition(origin, offset, max, originSize, selfSize, originalAlignment, selfAlignment, onCollision, mapping, boundMargin) {
42
+ // 0 pra left ou top, 1/2 pra center, 1 pra right ou bottom
43
+ const originDiff = originSize * (mapping.indexOf(originalAlignment) / 2);
44
+ // 0 pra left ou top, -1/2 pra center, -1 pra right ou bottom
45
+ const selfDiff = -(selfSize * (mapping.indexOf(selfAlignment) / 2));
46
+ const respectingBounds = boundMargin !== false;
47
+ const upperBound = respectingBounds ? POSITIONING_BOUNDS[mapping[0]] + boundMargin : Number.MIN_SAFE_INTEGER;
48
+ const lowerBound = respectingBounds ? POSITIONING_BOUNDS[mapping[2]] + boundMargin : 0;
49
+ const newPosition = Math.max(upperBound, origin + selfDiff + originDiff + offset);
50
+ const collision = Math.max(-newPosition, newPosition + selfSize - max + lowerBound);
51
+ if (collision > 0 && onCollision !== 'none') {
52
+ if (onCollision.indexOf('flip') >= 0) {
53
+ const flippedPosition = getPosition(origin, -offset, max, originSize, selfSize, originalAlignment, selfAlignment, onCollision.indexOf('fit') >= 0 ? 'fit' : 'none', mapping.slice().reverse(), boundMargin);
54
+ const flippedCollision = Math.max(-flippedPosition[0], flippedPosition[0] + selfSize - max);
55
+ if (collision > 0 && flippedCollision > 0 || flippedPosition[0] < upperBound) {
56
+ return getPosition(origin, offset, max, originSize, selfSize, originalAlignment, selfAlignment, 'fit', mapping, boundMargin);
57
+ }
58
+ return collision < flippedCollision ? [newPosition, 'none'] : [flippedPosition[0], flippedPosition[1] === 'fit' ? 'flipfit' : 'flip'];
59
+ } else {
60
+ const minBound = respectingBounds ? upperBound : 0;
61
+ const fittedPosition = Math.max(minBound, Math.min(newPosition, max - selfSize - lowerBound));
62
+ return [fittedPosition, fittedPosition !== newPosition ? 'fit' : 'none'];
63
+ }
64
+ } else {
65
+ return [newPosition, 'none'];
66
+ }
67
+ }
68
+ const arrowShadow = {
69
+ top: '-1px -1px 2px -1px rgba(0,0,0,.25)',
70
+ right: '1px -1px 2px -1px rgba(0,0,0,.25)',
71
+ bottom: '1px 1px 2px -1px rgba(0,0,0,.25)',
72
+ left: '-1px 1px 2px -1px rgba(0,0,0,.25)'
73
+ };
74
+ const translate = (position, offset) => (position === 'left' ? '-50%' : position === 'right' ? '50%' : offset) + ',' + (position === 'top' ? '-50%' : position === 'bottom' ? '50%' : offset);
75
+ const ARROW_DEFAULT_SIZE = 14;
76
+ const DefaultArrow = /*#__PURE__*/styled.div.withConfig({
77
+ displayName: "usePositioning__DefaultArrow",
78
+ componentId: "sc-1m4912o-1"
79
+ })(["background-color:#fff;position:absolute;width:", "px;height:", "px;transform:translate(-50%,50%) rotate(45deg);bottom:0;left:50%;box-shadow:", ";"], ARROW_DEFAULT_SIZE, ARROW_DEFAULT_SIZE, arrowShadow.bottom);
80
+ const usePositioning = (element, _ref, arrowRefOpt) => {
81
+ let {
82
+ my = 'top right',
83
+ offset = '0 0',
84
+ // x y
85
+ at = 'bottom right',
86
+ onCollision = 'flip flip',
87
+ arrow,
88
+ arrowPadding = 10,
89
+ fill,
90
+ useLayers = true,
91
+ fixed,
92
+ bottom: onBottom,
93
+ left: onLeft,
94
+ right: onRight,
95
+ top: onTop,
96
+ keepWidth = true,
97
+ boundMargin = 6,
98
+ respectBounds,
99
+ respectOffsetScroll,
100
+ on,
101
+ placeholderAs
102
+ } = _ref;
103
+ const placeholder = useRef();
104
+ const arrowRef = useEnsureRef(arrowRefOpt);
105
+ const [positionInfo, setPositionInfo] = useState();
106
+ const setPosition = function () {
107
+ var _element$current, _placeholder$current, _placeholder$current2, _placeholder$current3, _placeholder$current4;
108
+ let retry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
109
+ if (retry > 10) {
110
+ return;
111
+ }
112
+ if (!((_element$current = element.current) !== null && _element$current !== void 0 && _element$current.style) || !((_placeholder$current = placeholder.current) !== null && _placeholder$current !== void 0 && _placeholder$current.offsetParent || (_placeholder$current2 = placeholder.current) !== null && _placeholder$current2 !== void 0 && (_placeholder$current2 = _placeholder$current2.parentNode) !== null && _placeholder$current2 !== void 0 && _placeholder$current2.offsetParent)) {
113
+ setTimeout(() => setPosition(retry + 1), 100);
114
+ return;
115
+ }
116
+ if (keepWidth) {
117
+ element.current.style.width = '';
118
+ } else {
119
+ element.current.style.maxWidth = '';
120
+ }
121
+ const placeholderOffsetParent = ((_placeholder$current3 = placeholder.current) === null || _placeholder$current3 === void 0 ? void 0 : _placeholder$current3.offsetParent) || ((_placeholder$current4 = placeholder.current) === null || _placeholder$current4 === void 0 || (_placeholder$current4 = _placeholder$current4.parentNode) === null || _placeholder$current4 === void 0 ? void 0 : _placeholder$current4.offsetParent);
122
+ const usingLayer = respectOffsetScroll || useLayers && getDialogLayersSize() > 0;
123
+ const scrollOwner = usingLayer ? _isFunction(respectOffsetScroll) ? respectOffsetScroll(element.current.offsetParent) : getClosestOffsetScroll(element.current.offsetParent) : {
124
+ scrollTop: window.pageYOffset,
125
+ scrollLeft: window.pageXOffset
126
+ };
127
+
128
+ // console.log({scrollOwner,scrollTop:scrollOwner.scrollTop,pageYOffset:window.pageYOffset})
129
+
130
+ const scrollY = !isNaN(scrollOwner.scrollTop) ? scrollOwner.scrollTop : window.pageYOffset;
131
+ const scrollX = !isNaN(scrollOwner.scrollLeft) ? scrollOwner.scrollLeft : window.pageXOffset;
132
+ const getRespectOffsetScrollTopLeft = () => {
133
+ const {
134
+ top,
135
+ left
136
+ } = placeholder.current.getBoundingClientRect();
137
+ const {
138
+ top: scrollOwnerTop,
139
+ left: scrollOwnerLeft
140
+ } = scrollOwner.getBoundingClientRect();
141
+ return {
142
+ top: top - scrollOwnerTop,
143
+ left: left - scrollOwnerLeft
144
+ };
145
+ };
146
+ const {
147
+ left: leftPlusBorder,
148
+ top: topPlusBorder
149
+ } = respectOffsetScroll ? getRespectOffsetScrollTopLeft() : placeholder.current.getBoundingClientRect();
150
+ const {
151
+ borderLeftWidth,
152
+ borderTopWidth
153
+ } = window.getComputedStyle(placeholderOffsetParent);
154
+ const left = leftPlusBorder - parseInt(borderLeftWidth, 10);
155
+ const top = topPlusBorder - parseInt(borderTopWidth, 10);
156
+ const {
157
+ offsetWidth: parentOffsetWidth,
158
+ offsetHeight: parentOffsetHeight
159
+ } = placeholderOffsetParent;
160
+ const {
161
+ offsetWidth: popupOffsetWidth,
162
+ offsetHeight: popupOffsetHeight
163
+ } = element.current;
164
+ const {
165
+ width: popupCurrentWidth
166
+ } = element.current.getBoundingClientRect();
167
+ const [offsetX, offsetY] = [].concat(offset).join(' ').split(' ').map(_ => Number(_ || 0));
168
+ const simplePositioning = [onTop, onRight, onBottom, onLeft].map(_ => _ === true ? 'center' : _);
169
+ const simplePositioningIndex = simplePositioning.findIndex(_ => _);
170
+ const bodyWidth = document.body.offsetWidth - (usingLayer ? parseInt(getComputedStyle(document.body).paddingRight, 10) : 0);
171
+ // Barra fixa inferior (footer mobile) registrada em POSITIONING_BOUNDS conta como
172
+ // borda da tela: sem isso o popup se posiciona atrás dela. Com respectBounds o
173
+ // desconto já vem do lowerBound em getPosition, não descontar duas vezes.
174
+ const windowHeight = window.innerHeight - (respectBounds ? 0 : POSITIONING_BOUNDS.bottom);
175
+ const [verticalCollision, horizontalCollision] = onCollision.split(' ');
176
+ const [verticalMy, horizontalMy] = [my, 'bottom $', '$ left', 'top $', '$ right'][simplePositioningIndex + 1].replace('$', simplePositioning[simplePositioningIndex]).split(' ');
177
+ const [verticalAt, horizontalAt] = [at, 'top $', '$ right', 'bottom $', '$ left'][simplePositioningIndex + 1].replace('$', simplePositioning[simplePositioningIndex]).split(' ');
178
+ const [processedLeft, collisionH] = getPosition(left, offsetX, bodyWidth, parentOffsetWidth, fill ? parentOffsetWidth : popupOffsetWidth, horizontalAt, horizontalMy, horizontalCollision, HORIZONTAL_MAPPING, !!respectBounds && boundMargin);
179
+ const [processedTop, collisionV] = getPosition(top, offsetY, windowHeight, parentOffsetHeight, popupOffsetHeight, verticalAt, verticalMy, verticalCollision, VERTICAL_MAPPING, !!respectBounds && boundMargin);
180
+ const flippedV = collisionV.indexOf('flip') >= 0;
181
+ const flippedH = collisionH.indexOf('flip') >= 0;
182
+
183
+ //arrow
184
+ const arrowSide = Math.abs(VERTICAL_MAPPING.indexOf(verticalMy) - VERTICAL_MAPPING.indexOf(verticalAt)) === 2 ? flippedV ? verticalAt : verticalMy : Math.abs(HORIZONTAL_MAPPING.indexOf(horizontalMy) - HORIZONTAL_MAPPING.indexOf(horizontalAt)) === 2 ? flippedH ? horizontalAt : horizontalMy : '';
185
+ const arrowElement = arrowRef.current;
186
+ const arrowOnVerticalSide = arrowSide === 'left' || arrowSide === 'right';
187
+ const arrowSize = arrowElement ? arrowElement.getBoundingClientRect()[arrowOnVerticalSide ? 'height' : 'width'] : ARROW_DEFAULT_SIZE * Math.sqrt(2);
188
+ const [arrowOffset, popupArrowOffset] = arrowOnVerticalSide ? processArrow(ARROW_KEY_POSITIONS[arrow] || arrow, arrowSize, arrowOnVerticalSide, parentOffsetHeight, popupOffsetHeight, processedTop - top, flippedV) : processArrow(ARROW_KEY_POSITIONS[arrow] || arrow, arrowSize, arrowOnVerticalSide, parentOffsetWidth, popupOffsetWidth, processedLeft - left, flippedV);
189
+ const maxHeight = window.innerHeight - (POSITIONING_BOUNDS.top + POSITIONING_BOUNDS.bottom) - (respectBounds ? boundMargin * 2 : 0);
190
+ const maxWidth = window.innerWidth - (POSITIONING_BOUNDS.left + POSITIONING_BOUNDS.right) - (respectBounds ? boundMargin * 2 : 0);
191
+ element.current.style.maxHeight = '';
192
+ if (parseInt(window.getComputedStyle(element.current).maxHeight) > maxHeight) {
193
+ element.current.style.maxHeight = maxHeight + 'px';
194
+ }
195
+ if (keepWidth) {
196
+ element.current.style.width = Math.ceil(popupCurrentWidth) + "px";
197
+ } else {
198
+ element.current.style.maxWidth = maxWidth + 'px';
199
+ }
200
+ // console.log({processedTop,top,offsetY,scrollY})
201
+
202
+ element.current.style.top = processedTop + (arrowOnVerticalSide ? popupArrowOffset : 0) + (fixed ? 0 : scrollY) + 'px';
203
+ element.current.style.left = processedLeft + (arrowOnVerticalSide ? 0 : popupArrowOffset) + (fixed ? 0 : scrollX) + 'px';
204
+ const arrowStyle = {
205
+ transform: "translate(".concat(translate(arrowSide, arrowOffset[0] === 'top' || arrowOffset[0] === 'left' ? '-50%' : '50%'), ") rotate(45deg)"),
206
+ bottom: "auto",
207
+ left: "auto",
208
+ [arrowSide]: '0',
209
+ boxShadow: arrowShadow[arrowSide],
210
+ [arrowOffset[0]]: arrowOffset[1] + 'px'
211
+ };
212
+ if (arrowRef.current) {
213
+ Object.assign(arrowRef.current.style, arrowStyle);
214
+ }
215
+ setPositionInfo({
216
+ atTop: verticalAt === 'top' && !flippedV || verticalAt === 'bottom' && flippedV,
217
+ atBottom: verticalAt === 'bottom' && !flippedV || verticalAt === 'top' && flippedV,
218
+ atLeft: horizontalAt === 'left' && !flippedH || verticalAt === 'right' && flippedH,
219
+ atRight: horizontalAt === 'right' && !flippedH || verticalAt === 'left' && flippedH,
220
+ fullHeight: popupOffsetHeight > maxHeight,
221
+ fullWidth: popupOffsetWidth > maxWidth,
222
+ arrowSide,
223
+ arrowOffset,
224
+ arrowStyle
225
+ });
226
+ if (fill) {
227
+ element.current.style.width = parentOffsetWidth + 'px';
228
+ }
229
+ if (fixed) {
230
+ element.current.style.position = 'fixed';
231
+ }
232
+ };
233
+ useLayoutEffect(setPosition, [on]);
234
+ useEffect(() => {
235
+ window.addEventListener('portalReposition', setPosition);
236
+ window.addEventListener('stepResize', setPosition);
237
+ window.addEventListener('scroll', setPosition, {
238
+ passive: true
239
+ });
240
+ return () => {
241
+ window.removeEventListener('portalReposition', setPosition);
242
+ window.removeEventListener('stepResize', setPosition);
243
+ window.removeEventListener('scroll', setPosition);
244
+ };
245
+ }, []);
246
+ const processArrow = (arrow, arrowSize, onVerticalSide, arrowContainerWidth, popupSize, deltaPopupPosition, flipped) => {
247
+ if (!arrow) {
248
+ return ['', 0];
249
+ }
250
+ const margin = arrowPadding + arrowSize / 2;
251
+ const [invertDirection, percent, px] = (arrow === true ? '50%' : arrow).replace(/(-)?(\d+%)?\s?(-?\d+)?/, '$1:$2:$3').split(':');
252
+ const invertAndFlipDirection = flipped ? !invertDirection : invertDirection;
253
+ const arrowPosition = onVerticalSide ? invertAndFlipDirection ? 'bottom' : 'top' : invertAndFlipDirection ? 'right' : 'left';
254
+ const fromOriginCorner = arrowPosition === 'left' || arrowPosition === 'top';
255
+ const popupOffset = fromOriginCorner ? deltaPopupPosition : arrowContainerWidth - deltaPopupPosition - popupSize;
256
+
257
+ /* ____________________________
258
+ | arrow container |
259
+ |___________________________|
260
+ ..../\_______
261
+ | popup |
262
+ |____________|
263
+ |-------| = delta popup position (popupOffset)
264
+ .... = arrowPadding prop, applies to both sides, moves popup or does nothing
265
+ arrow prop = invert percent px // relative to arrow container
266
+ invert = -?
267
+ percent = (\d+%)?
268
+ px = (-?\d+)?
269
+ procedure:
270
+ 1- position arrow according to container - arrowInitialPos
271
+ 2- constrain position inside container - constrainedArrowPosition
272
+ 3- move popup according to arrowPadding (margin) - popupDelta
273
+ 4- final arrow position, relative to final popup position - finalArrowPosition
274
+ */
275
+
276
+ const arrowInitialPos = parseInt(percent || 0, 10) * arrowContainerWidth / 100 + parseInt(px || 0, 10);
277
+ const constrainedArrowPosition = Math.min(Math.max(arrowInitialPos, 0), arrowContainerWidth);
278
+ const arrowPositionRelativeToPopup = fromOriginCorner ? constrainedArrowPosition - popupOffset : arrowContainerWidth - popupOffset - constrainedArrowPosition;
279
+ const popupDelta = arrowPositionRelativeToPopup < margin ? arrowPositionRelativeToPopup - margin : arrowPositionRelativeToPopup > popupSize - margin ? margin + arrowPositionRelativeToPopup - popupSize : 0;
280
+ const finalPopupPosition = fromOriginCorner ? popupOffset + popupDelta : arrowContainerWidth - popupOffset - popupDelta - popupSize;
281
+ return [[arrowPosition, constrainedArrowPosition - finalPopupPosition], popupDelta];
282
+ };
283
+ const arrowElement = arrow && /*#__PURE__*/React.createElement(DefaultArrow, {
284
+ ref: arrowRef
285
+ });
286
+ const placeholderElement = /*#__PURE__*/React.createElement(Placeholder, {
287
+ as: placeholderAs,
288
+ ref: placeholder
289
+ });
290
+ return [positionInfo, placeholderElement, arrowElement];
291
+ };
292
+
293
+ export { DefaultArrow, addPositioningBound, usePositioning };
294
+ //# sourceMappingURL=usePositioning.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePositioning.mjs","sources":["../../src/containers/usePositioning.jsx"],"sourcesContent":["import React, {useEffect, useLayoutEffect, useRef, useState} from 'react'\nimport _ from 'lodash/fp'\nimport styled from 'styled-components'\nimport {getClosestOffsetScroll} from '@startlibs/utils'\nimport {useEnsureRef} from '@startlibs/core'\nimport {getDialogLayersSize} from './DialogContainer'\n\nconst Placeholder = styled.span`\n top:0;\n left:0;\n padding: 0 !important;\n position: absolute;\n`\n/*\ntype Alignment = 'top left' | 'top center' | 'top right' |\n 'center left' | 'center center' | 'center right' |\n 'bottom left' | 'bottom center' | 'bottom right'\n\ntype Collision = 'fit fit' | 'fit flip' | 'fit fitflip' | 'fit none' |\n 'flip fit' | 'flip flip' | 'flip fitflip' | 'flip none' |\n 'flipfit fit' | 'flipfit flip' | 'flipfit fitflip' | 'flipfit none' |\n 'none fit' | 'none flip' | 'none fitflip' | 'none none'\n*/\n\nconst HORIZONTAL_MAPPING = ['left', 'center', 'right']\nconst VERTICAL_MAPPING = ['top', 'center', 'bottom']\nconst ARROW_KEY_POSITIONS = {left: '0', right: '-0', top: '0', bottom: '-0'}\n\nconst POSITIONING_BOUNDS = {left:0,top:0,right:0,bottom:0}\nexport const addPositioningBound = (key,value) => {\n POSITIONING_BOUNDS[key] += value\n return () => POSITIONING_BOUNDS[key] -= value\n}\n\nfunction getPosition(origin, offset, max, originSize, selfSize, originalAlignment, selfAlignment, onCollision, mapping, boundMargin) {\n\n // 0 pra left ou top, 1/2 pra center, 1 pra right ou bottom\n const originDiff = originSize * (mapping.indexOf(originalAlignment) / 2)\n // 0 pra left ou top, -1/2 pra center, -1 pra right ou bottom\n const selfDiff = -(selfSize * (mapping.indexOf(selfAlignment) / 2))\n\n const respectingBounds = boundMargin !== false\n const upperBound = respectingBounds ? (POSITIONING_BOUNDS[mapping[0]] + boundMargin) : Number.MIN_SAFE_INTEGER\n const lowerBound = respectingBounds ? (POSITIONING_BOUNDS[mapping[2]] + boundMargin) : 0\n const newPosition = Math.max(upperBound, origin + selfDiff + originDiff + offset)\n\n const collision = Math.max(-newPosition, newPosition + selfSize - max + lowerBound)\n if (collision > 0 && onCollision !== 'none') {\n if (onCollision.indexOf('flip') >= 0) {\n const flippedPosition = getPosition(origin, -offset, max, originSize, selfSize, originalAlignment, selfAlignment, onCollision.indexOf('fit') >= 0 ? 'fit' : 'none', mapping.slice().reverse(), boundMargin)\n const flippedCollision = Math.max(-flippedPosition[0], flippedPosition[0] + selfSize - max)\n if ((collision > 0 && flippedCollision > 0) || flippedPosition[0] < upperBound) {\n return getPosition(origin, offset, max, originSize, selfSize, originalAlignment, selfAlignment, 'fit', mapping, boundMargin)\n }\n return collision < flippedCollision ? [newPosition, 'none'] : [flippedPosition[0], flippedPosition[1] === 'fit' ? 'flipfit' : 'flip']\n } else {\n const minBound = respectingBounds ? upperBound : 0\n const fittedPosition = Math.max(minBound, Math.min(newPosition, max - selfSize - lowerBound))\n return [fittedPosition, fittedPosition !== newPosition ? 'fit' : 'none']\n }\n } else {\n return [newPosition, 'none']\n }\n}\n\nconst arrowShadow = {\n top: '-1px -1px 2px -1px rgba(0,0,0,.25)',\n right: '1px -1px 2px -1px rgba(0,0,0,.25)',\n bottom: '1px 1px 2px -1px rgba(0,0,0,.25)',\n left: '-1px 1px 2px -1px rgba(0,0,0,.25)'\n}\n\nconst translate = (position, offset) => (position === 'left' ? '-50%' : position === 'right' ? '50%' : offset) + ',' +\n (position === 'top' ? '-50%' : position === 'bottom' ? '50%' : offset)\n\nconst ARROW_DEFAULT_SIZE = 14\n\nexport const DefaultArrow = styled.div`\n background-color: #fff;\n position: absolute;\n width: ${ARROW_DEFAULT_SIZE}px;\n height: ${ARROW_DEFAULT_SIZE}px;\n transform: translate(-50%,50%) rotate(45deg);\n bottom: 0;\n left: 50%;\n box-shadow: ${arrowShadow.bottom};\n`\n\nexport const usePositioning = (\n element,\n {\n my = 'top right',\n offset = '0 0', // x y\n at = 'bottom right',\n onCollision = 'flip flip',\n arrow,\n arrowPadding = 10,\n fill,\n useLayers = true,\n fixed,\n bottom: onBottom,\n left: onLeft,\n right: onRight,\n top: onTop,\n keepWidth = true,\n boundMargin = 6,\n respectBounds,\n respectOffsetScroll,\n on,\n placeholderAs\n },\n arrowRefOpt\n) => {\n const placeholder = useRef()\n const arrowRef = useEnsureRef(arrowRefOpt)\n const [positionInfo, setPositionInfo] = useState()\n\n const setPosition = (retry=0) => {\n if (retry>10) { return }\n if (!element.current?.style || !(placeholder.current?.offsetParent || placeholder.current?.parentNode?.offsetParent)) {\n setTimeout(()=>setPosition(retry+1),100)\n return\n }\n if (keepWidth) {\n element.current.style.width = ''\n } else {\n element.current.style.maxWidth = ''\n }\n const placeholderOffsetParent = (placeholder.current?.offsetParent || placeholder.current?.parentNode?.offsetParent)\n const usingLayer = respectOffsetScroll || useLayers && getDialogLayersSize() > 0\n const scrollOwner =\n usingLayer\n ? (_.isFunction(respectOffsetScroll) ? respectOffsetScroll(element.current.offsetParent) : getClosestOffsetScroll(element.current.offsetParent))\n : {scrollTop: window.pageYOffset, scrollLeft: window.pageXOffset}\n\n // console.log({scrollOwner,scrollTop:scrollOwner.scrollTop,pageYOffset:window.pageYOffset})\n\n const scrollY = !isNaN(scrollOwner.scrollTop) ? scrollOwner.scrollTop : window.pageYOffset\n const scrollX = !isNaN(scrollOwner.scrollLeft) ? scrollOwner.scrollLeft : window.pageXOffset\n const getRespectOffsetScrollTopLeft = () => {\n const {top,left} = placeholder.current.getBoundingClientRect()\n const {top:scrollOwnerTop, left: scrollOwnerLeft} = scrollOwner.getBoundingClientRect()\n return {top: top-scrollOwnerTop,left: left-scrollOwnerLeft}\n }\n const {left: leftPlusBorder, top: topPlusBorder} =\n respectOffsetScroll\n ? getRespectOffsetScrollTopLeft()\n :placeholder.current.getBoundingClientRect()\n\n const {borderLeftWidth, borderTopWidth} = window.getComputedStyle(placeholderOffsetParent)\n const left = leftPlusBorder - parseInt(borderLeftWidth, 10)\n const top = topPlusBorder - parseInt(borderTopWidth, 10)\n const {offsetWidth: parentOffsetWidth, offsetHeight: parentOffsetHeight} = (placeholderOffsetParent)\n const {offsetWidth: popupOffsetWidth, offsetHeight: popupOffsetHeight} = element.current\n const {width:popupCurrentWidth} = element.current.getBoundingClientRect()\n const [offsetX, offsetY] = [].concat(offset).join(' ').split(' ').map(_ => Number(_ || 0))\n const simplePositioning = [onTop, onRight, onBottom, onLeft].map(_ => _ === true ? 'center' : _)\n const simplePositioningIndex = simplePositioning.findIndex(_ => _)\n const bodyWidth = document.body.offsetWidth - (usingLayer ? parseInt(getComputedStyle(document.body).paddingRight, 10) : 0)\n // Barra fixa inferior (footer mobile) registrada em POSITIONING_BOUNDS conta como\n // borda da tela: sem isso o popup se posiciona atrás dela. Com respectBounds o\n // desconto já vem do lowerBound em getPosition, não descontar duas vezes.\n const windowHeight = window.innerHeight - (respectBounds ? 0 : POSITIONING_BOUNDS.bottom)\n\n const [verticalCollision, horizontalCollision] = onCollision.split(' ')\n const [verticalMy, horizontalMy] = [my, 'bottom $', '$ left', 'top $', '$ right'][simplePositioningIndex + 1].replace('$', simplePositioning[simplePositioningIndex]).split(' ')\n const [verticalAt, horizontalAt] = [at, 'top $', '$ right', 'bottom $', '$ left'][simplePositioningIndex + 1].replace('$', simplePositioning[simplePositioningIndex]).split(' ')\n\n const [processedLeft, collisionH] = getPosition(left, offsetX, bodyWidth, parentOffsetWidth, fill ? parentOffsetWidth : popupOffsetWidth, horizontalAt, horizontalMy, horizontalCollision, HORIZONTAL_MAPPING,!!respectBounds && boundMargin)\n const [processedTop, collisionV] = getPosition(top, offsetY, windowHeight, parentOffsetHeight, popupOffsetHeight, verticalAt, verticalMy, verticalCollision, VERTICAL_MAPPING,!!respectBounds && boundMargin)\n\n\n const flippedV = collisionV.indexOf('flip') >= 0\n const flippedH = collisionH.indexOf('flip') >= 0\n\n\n //arrow\n const arrowSide = Math.abs(VERTICAL_MAPPING.indexOf(verticalMy) - VERTICAL_MAPPING.indexOf(verticalAt)) === 2 ? (flippedV ? verticalAt : verticalMy) :\n Math.abs(HORIZONTAL_MAPPING.indexOf(horizontalMy) - HORIZONTAL_MAPPING.indexOf(horizontalAt)) === 2 ? (flippedH ? horizontalAt : horizontalMy) : ''\n const arrowElement = arrowRef.current\n const arrowOnVerticalSide = arrowSide === 'left' || arrowSide === 'right'\n const arrowSize = arrowElement ? arrowElement.getBoundingClientRect()[arrowOnVerticalSide ? 'height' : 'width'] : (ARROW_DEFAULT_SIZE * Math.sqrt(2))\n const [arrowOffset, popupArrowOffset] = arrowOnVerticalSide ?\n processArrow(ARROW_KEY_POSITIONS[arrow] || arrow, arrowSize, arrowOnVerticalSide, parentOffsetHeight, popupOffsetHeight, processedTop - top, flippedV) :\n processArrow(ARROW_KEY_POSITIONS[arrow] || arrow, arrowSize, arrowOnVerticalSide, parentOffsetWidth, popupOffsetWidth, processedLeft - left, flippedV)\n\n\n const maxHeight = window.innerHeight - (POSITIONING_BOUNDS.top + POSITIONING_BOUNDS.bottom) - (respectBounds ? boundMargin*2 : 0)\n const maxWidth = window.innerWidth - (POSITIONING_BOUNDS.left + POSITIONING_BOUNDS.right) - (respectBounds ? boundMargin*2 : 0)\n\n element.current.style.maxHeight = ''\n if (parseInt(window.getComputedStyle(element.current).maxHeight) > maxHeight) {\n element.current.style.maxHeight = maxHeight+'px'\n }\n if (keepWidth) {\n element.current.style.width = Math.ceil(popupCurrentWidth)+\"px\"\n } else {\n element.current.style.maxWidth = maxWidth+'px'\n }\n // console.log({processedTop,top,offsetY,scrollY})\n\n\n element.current.style.top = (processedTop + (arrowOnVerticalSide ? popupArrowOffset : 0) + (fixed ? 0 : scrollY)) + 'px'\n element.current.style.left = (processedLeft + (arrowOnVerticalSide ? 0 : popupArrowOffset) + (fixed ? 0 : scrollX)) + 'px'\n\n const arrowStyle = {\n transform: `translate(${translate(arrowSide, arrowOffset[0] === 'top' || arrowOffset[0] === 'left' ? '-50%' : '50%')}) rotate(45deg)`,\n bottom:\"auto\",\n left:\"auto\",\n [arrowSide]: '0',\n boxShadow: arrowShadow[arrowSide],\n [arrowOffset[0]]: arrowOffset[1]+'px'\n }\n if (arrowRef.current) {\n Object.assign(arrowRef.current.style,arrowStyle)\n }\n\n setPositionInfo({\n atTop: (verticalAt === 'top' && !flippedV) || (verticalAt === 'bottom' && flippedV),\n atBottom: (verticalAt === 'bottom' && !flippedV) || (verticalAt === 'top' && flippedV),\n atLeft: (horizontalAt === 'left' && !flippedH) || (verticalAt === 'right' && flippedH),\n atRight: (horizontalAt === 'right' && !flippedH) || (verticalAt === 'left' && flippedH),\n fullHeight: popupOffsetHeight > maxHeight,\n fullWidth: popupOffsetWidth > maxWidth,\n arrowSide,\n arrowOffset,\n arrowStyle\n })\n\n if (fill) {\n element.current.style.width = parentOffsetWidth + 'px'\n }\n if (fixed) {\n element.current.style.position = 'fixed'\n }\n }\n\n useLayoutEffect(setPosition, [on])\n\n\n useEffect(() => {\n window.addEventListener('portalReposition', setPosition)\n window.addEventListener('stepResize', setPosition)\n window.addEventListener('scroll', setPosition, {passive:true})\n return () => {\n window.removeEventListener('portalReposition', setPosition)\n window.removeEventListener('stepResize', setPosition)\n window.removeEventListener('scroll', setPosition)\n }\n }, []\n )\n\n\n const processArrow = (arrow, arrowSize, onVerticalSide, arrowContainerWidth, popupSize, deltaPopupPosition, flipped) => {\n if (!arrow) {\n return ['', 0]\n }\n const margin = arrowPadding + (arrowSize / 2)\n const [invertDirection, percent, px] = (arrow === true ? '50%' : arrow).replace(/(-)?(\\d+%)?\\s?(-?\\d+)?/, '$1:$2:$3').split(':')\n const invertAndFlipDirection = flipped ? !invertDirection : invertDirection\n const arrowPosition = onVerticalSide ? (invertAndFlipDirection ? 'bottom' : 'top') : (invertAndFlipDirection ? 'right' : 'left')\n const fromOriginCorner = arrowPosition === 'left' || arrowPosition === 'top'\n\n const popupOffset = fromOriginCorner ? deltaPopupPosition : (arrowContainerWidth - deltaPopupPosition - popupSize)\n\n /* ____________________________\n | arrow container |\n |___________________________|\n ..../\\_______\n | popup |\n |____________|\n\n |-------| = delta popup position (popupOffset)\n\n .... = arrowPadding prop, applies to both sides, moves popup or does nothing\n\n arrow prop = invert percent px // relative to arrow container\n invert = -?\n percent = (\\d+%)?\n px = (-?\\d+)?\n\n procedure:\n 1- position arrow according to container - arrowInitialPos\n 2- constrain position inside container - constrainedArrowPosition\n 3- move popup according to arrowPadding (margin) - popupDelta\n 4- final arrow position, relative to final popup position - finalArrowPosition\n */\n\n const arrowInitialPos = (parseInt(percent || 0, 10) * arrowContainerWidth / 100) + parseInt(px || 0, 10)\n const constrainedArrowPosition = (Math.min(Math.max(arrowInitialPos, 0), arrowContainerWidth))\n const arrowPositionRelativeToPopup = fromOriginCorner ? constrainedArrowPosition - popupOffset : (arrowContainerWidth - popupOffset - constrainedArrowPosition)\n const popupDelta = arrowPositionRelativeToPopup < margin ?\n (arrowPositionRelativeToPopup - margin) :\n arrowPositionRelativeToPopup > (popupSize - margin) ?\n (margin + arrowPositionRelativeToPopup - popupSize) :\n 0\n const finalPopupPosition = fromOriginCorner ? popupOffset + popupDelta : (arrowContainerWidth - popupOffset - popupDelta - popupSize)\n return [[arrowPosition,(constrainedArrowPosition - finalPopupPosition)], popupDelta]\n }\n\n const arrowElement = arrow && <DefaultArrow ref={arrowRef} />\n\n const placeholderElement = <Placeholder as={placeholderAs} ref={placeholder}/>\n return [positionInfo,placeholderElement,arrowElement]\n}"],"names":["Placeholder","styled","span","withConfig","displayName","componentId","HORIZONTAL_MAPPING","VERTICAL_MAPPING","ARROW_KEY_POSITIONS","left","right","top","bottom","POSITIONING_BOUNDS","addPositioningBound","key","value","getPosition","origin","offset","max","originSize","selfSize","originalAlignment","selfAlignment","onCollision","mapping","boundMargin","originDiff","indexOf","selfDiff","respectingBounds","upperBound","Number","MIN_SAFE_INTEGER","lowerBound","newPosition","Math","collision","flippedPosition","slice","reverse","flippedCollision","minBound","fittedPosition","min","arrowShadow","translate","position","ARROW_DEFAULT_SIZE","DefaultArrow","div","usePositioning","element","_ref","arrowRefOpt","my","at","arrow","arrowPadding","fill","useLayers","fixed","onBottom","onLeft","onRight","onTop","keepWidth","respectBounds","respectOffsetScroll","on","placeholderAs","placeholder","useRef","arrowRef","useEnsureRef","positionInfo","setPositionInfo","useState","setPosition","_element$current","_placeholder$current","_placeholder$current2","_placeholder$current3","_placeholder$current4","retry","arguments","length","undefined","current","style","offsetParent","parentNode","setTimeout","width","maxWidth","placeholderOffsetParent","usingLayer","getDialogLayersSize","scrollOwner","_isFunction","getClosestOffsetScroll","scrollTop","window","pageYOffset","scrollLeft","pageXOffset","scrollY","isNaN","scrollX","getRespectOffsetScrollTopLeft","getBoundingClientRect","scrollOwnerTop","scrollOwnerLeft","leftPlusBorder","topPlusBorder","borderLeftWidth","borderTopWidth","getComputedStyle","parseInt","offsetWidth","parentOffsetWidth","offsetHeight","parentOffsetHeight","popupOffsetWidth","popupOffsetHeight","popupCurrentWidth","offsetX","offsetY","concat","join","split","map","_","simplePositioning","simplePositioningIndex","findIndex","bodyWidth","document","body","paddingRight","windowHeight","innerHeight","verticalCollision","horizontalCollision","verticalMy","horizontalMy","replace","verticalAt","horizontalAt","processedLeft","collisionH","processedTop","collisionV","flippedV","flippedH","arrowSide","abs","arrowElement","arrowOnVerticalSide","arrowSize","sqrt","arrowOffset","popupArrowOffset","processArrow","maxHeight","innerWidth","ceil","arrowStyle","transform","boxShadow","Object","assign","atTop","atBottom","atLeft","atRight","fullHeight","fullWidth","useLayoutEffect","useEffect","addEventListener","passive","removeEventListener","onVerticalSide","arrowContainerWidth","popupSize","deltaPopupPosition","flipped","margin","invertDirection","percent","px","invertAndFlipDirection","arrowPosition","fromOriginCorner","popupOffset","arrowInitialPos","constrainedArrowPosition","arrowPositionRelativeToPopup","popupDelta","finalPopupPosition","React","createElement","ref","placeholderElement","as"],"mappings":";;;;;;;AAOA,MAAMA,WAAW,gBAAGC,MAAM,CAACC,IAAI,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,6BAAA;EAAAC,WAAA,EAAA,cAAA;AAAA,CAK9B,CAAA,CAAA,CAAA,sDAAA,CAAA,CAAA,CAAA;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMC,kBAAkB,GAAG,CAAC,MAAM,EAAE,QAAQ,EAA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