diginet-core-ui 1.3.89-beta.3 → 1.3.89-beta.4
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/components/popover/index.js +9 -14
- package/package.json +1 -1
- package/styles/general.js +22 -1
|
@@ -5,15 +5,10 @@ import OptionWrapper from "../others/option-wrapper";
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import React, { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
7
7
|
import { createPortal } from 'react-dom';
|
|
8
|
-
import { bgColor, borderRadius4px, displayFlex, displayNone, flexCol, inset, justifyBetween, overflowAuto, parseMaxWidthHeight, parseMinWidthHeight, parseWidthHeight, pointerEventsInitial, pointerEventsNone, positionAbsolute, positionFixed, positionRelative } from "../../styles/general";
|
|
8
|
+
import { bgColor, borderBottom, borderRadius4px, displayFlex, displayNone, flexCol, inset, justifyBetween, overflowAuto, parseMaxWidthHeight, parseMinWidthHeight, parseWidthHeight, pointerEventsInitial, pointerEventsNone, positionAbsolute, positionFixed, positionRelative } from "../../styles/general";
|
|
9
9
|
import { useTheme } from "../../theme";
|
|
10
10
|
import { classNames, isMobile, refType as ref } from "../../utils";
|
|
11
11
|
const {
|
|
12
|
-
colors: {
|
|
13
|
-
system: {
|
|
14
|
-
white: systemWhite
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
12
|
typography: {
|
|
18
13
|
paragraph1
|
|
19
14
|
},
|
|
@@ -148,10 +143,10 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
148
143
|
const anchorRef = useRef(anchor);
|
|
149
144
|
const [openState, setOpenState] = useState(open);
|
|
150
145
|
const [element, setElement] = useState(null);
|
|
146
|
+
const arrowSize = arrow ? 6 : 0;
|
|
151
147
|
const _PortalPopoverCSS = PortalPopoverCSS(zIndex, fullScreen);
|
|
152
148
|
const _PopoverContainerCSS = PopoverContainerCSS(bgColor, width, height);
|
|
153
|
-
const _PopoverArrowCSS = PopoverArrowCSS(bgColor);
|
|
154
|
-
const arrowSize = arrow ? 6 : 0;
|
|
149
|
+
const _PopoverArrowCSS = PopoverArrowCSS(bgColor, arrowSize);
|
|
155
150
|
if (direction) {
|
|
156
151
|
const directionObject = getDirectionPopover(direction);
|
|
157
152
|
anchorOrigin = directionObject.anchorOrigin;
|
|
@@ -218,7 +213,7 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
218
213
|
var _anchor5, _anchor$current;
|
|
219
214
|
anchor = ((_anchor5 = anchor) === null || _anchor5 === void 0 ? void 0 : _anchor5.element) || ((_anchor$current = anchor.current) === null || _anchor$current === void 0 ? void 0 : _anchor$current.element) || anchor.current;
|
|
220
215
|
}
|
|
221
|
-
if (!anchor) return;
|
|
216
|
+
if (!document.body.contains(anchor)) return;
|
|
222
217
|
if (arrow && anchorOrigin.vertical !== anchorOrigin.horizontal && transformOrigin.vertical !== transformOrigin.horizontal) {
|
|
223
218
|
aPosition = getArrowPosition(anchorOrigin, transformOrigin, translate);
|
|
224
219
|
}
|
|
@@ -528,13 +523,13 @@ const PopoverContainerCSS = (bgCl, width, height) => css`
|
|
|
528
523
|
opacity: 0;
|
|
529
524
|
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
|
|
530
525
|
`;
|
|
531
|
-
const PopoverArrowCSS =
|
|
526
|
+
const PopoverArrowCSS = (bgCl, arrowSize) => css`
|
|
532
527
|
${displayNone};
|
|
533
528
|
${positionAbsolute};
|
|
534
529
|
${parseWidthHeight(0)};
|
|
535
|
-
|
|
536
|
-
border-
|
|
537
|
-
border-
|
|
530
|
+
${borderBottom(arrowSize, bgCl)};
|
|
531
|
+
border-left: ${arrowSize}px solid transparent;
|
|
532
|
+
border-right: ${arrowSize}px solid transparent;
|
|
538
533
|
`;
|
|
539
534
|
Popover.defaultProps = {
|
|
540
535
|
anchorOrigin: {
|
|
@@ -542,7 +537,7 @@ Popover.defaultProps = {
|
|
|
542
537
|
horizontal: 'center'
|
|
543
538
|
},
|
|
544
539
|
arrow: false,
|
|
545
|
-
bgColor:
|
|
540
|
+
bgColor: 'system.white',
|
|
546
541
|
className: '',
|
|
547
542
|
clickOutsideToClose: true,
|
|
548
543
|
fullScreen: true,
|
package/package.json
CHANGED
package/styles/general.js
CHANGED
|
@@ -74,6 +74,9 @@ const borderRadius4px = css`
|
|
|
74
74
|
const borderRadius50 = css`
|
|
75
75
|
border-radius: 50%;
|
|
76
76
|
`;
|
|
77
|
+
const bottom = vl => css`
|
|
78
|
+
bottom: ${parseCSSValue(vl)};
|
|
79
|
+
`;
|
|
77
80
|
const boxBorder = css`
|
|
78
81
|
box-sizing: border-box;
|
|
79
82
|
`;
|
|
@@ -217,6 +220,9 @@ const justifyEvenly = css`
|
|
|
217
220
|
const justifyStart = css`
|
|
218
221
|
justify-content: flex-start;
|
|
219
222
|
`;
|
|
223
|
+
const left = vl => css`
|
|
224
|
+
left: ${parseCSSValue(vl)};
|
|
225
|
+
`;
|
|
220
226
|
const mg = vl => css`
|
|
221
227
|
margin: ${getSpacing(vl)};
|
|
222
228
|
`;
|
|
@@ -353,6 +359,18 @@ const positionRelative = css`
|
|
|
353
359
|
const positionSticky = css`
|
|
354
360
|
position: sticky;
|
|
355
361
|
`;
|
|
362
|
+
const right = vl => css`
|
|
363
|
+
right: ${parseCSSValue(vl)};
|
|
364
|
+
`;
|
|
365
|
+
const scale = vl => css`
|
|
366
|
+
transform: scale(${vl});
|
|
367
|
+
`;
|
|
368
|
+
const scaleX = vl => css`
|
|
369
|
+
transform: scaleX(${vl});
|
|
370
|
+
`;
|
|
371
|
+
const scaleY = vl => css`
|
|
372
|
+
transform: scaleY(${vl});
|
|
373
|
+
`;
|
|
356
374
|
const selfCenter = css`
|
|
357
375
|
align-self: center;
|
|
358
376
|
`;
|
|
@@ -398,6 +416,9 @@ const textunderline = css`
|
|
|
398
416
|
const textUppercase = css`
|
|
399
417
|
text-transform: uppercase;
|
|
400
418
|
`;
|
|
419
|
+
const top = vl => css`
|
|
420
|
+
top: ${parseCSSValue(vl)};
|
|
421
|
+
`;
|
|
401
422
|
const truncate = css`
|
|
402
423
|
overflow: hidden;
|
|
403
424
|
text-overflow: ellipsis;
|
|
@@ -421,4 +442,4 @@ const whiteSpacePreWrap = css`
|
|
|
421
442
|
const z = vl => css`
|
|
422
443
|
z-index: ${zIndex(vl)};
|
|
423
444
|
`;
|
|
424
|
-
export { bgColor, bgCurrent, bgTransparent, border, borderBottom, borderBottomColor, borderColor, borderNone, borderRadius, borderRadius100, borderRadius4px, borderRadius50, boxBorder, boxContent, breakAll, breakWord, cursorDefault, cursorInherit, cursorMove, cursorNoDrop, cursorNotAllowed, cursorPointer, cursorText, displayBlock, displayFlex, displayInlineBlock, displayInlineFlex, displayNone, fill, flexCol, flexColReverse, flexNowrap, flexRow, flexRowReverse, flexShrink, flexShrink0, flexWrap, flexWrapReverse, floatLeft, floatNone, floatRight, gap, gapX, gapY, inset, insetX, insetY, invisible, italic, itemsCenter, itemsEnd, itemsStart, justifyAround, justifyBetween, justifyCenter, justifyEnd, justifyEvenly, justifyStart, mg, mgb, mgl, mgr, mgt, mgx, mgy, noBorder, noBoxShadow, noMargin, noPadding, objectContain, objectCover, objectFill, objectNone, order, outlineNone, overflowAuto, overflowHidden, parseHeight, parseMaxHeight, parseMaxWidth, parseMaxWidthHeight, parseMinHeight, parseMinWidth, parseMinWidthHeight, parseWidth, parseWidthHeight, pd, pdb, pdl, pdr, pdt, pdx, pdy, pointerEventsAuto, pointerEventsInherit, pointerEventsInitial, pointerEventsNone, positionAbsolute, positionFixed, positionRelative, positionSticky, selfCenter, selfEnd, selfStart, shadowNone, textCapitalize, textCenter, textColor, textCurrent, textEllipsis, textLeft, textLineThrough, textLowercase, textRight, textunderline, textUppercase, truncate, userSelectNone, visible, whiteSpaceBreakSpaces, whiteSpaceNoWrap, whiteSpacePreWrap, z };
|
|
445
|
+
export { bgColor, bgCurrent, bgTransparent, border, borderBottom, borderBottomColor, borderColor, borderNone, borderRadius, borderRadius100, borderRadius4px, borderRadius50, bottom, boxBorder, boxContent, breakAll, breakWord, cursorDefault, cursorInherit, cursorMove, cursorNoDrop, cursorNotAllowed, cursorPointer, cursorText, displayBlock, displayFlex, displayInlineBlock, displayInlineFlex, displayNone, fill, flexCol, flexColReverse, flexNowrap, flexRow, flexRowReverse, flexShrink, flexShrink0, flexWrap, flexWrapReverse, floatLeft, floatNone, floatRight, gap, gapX, gapY, inset, insetX, insetY, invisible, italic, itemsCenter, itemsEnd, itemsStart, justifyAround, justifyBetween, justifyCenter, justifyEnd, justifyEvenly, justifyStart, left, mg, mgb, mgl, mgr, mgt, mgx, mgy, noBorder, noBoxShadow, noMargin, noPadding, objectContain, objectCover, objectFill, objectNone, order, outlineNone, overflowAuto, overflowHidden, parseHeight, parseMaxHeight, parseMaxWidth, parseMaxWidthHeight, parseMinHeight, parseMinWidth, parseMinWidthHeight, parseWidth, parseWidthHeight, pd, pdb, pdl, pdr, pdt, pdx, pdy, pointerEventsAuto, pointerEventsInherit, pointerEventsInitial, pointerEventsNone, positionAbsolute, positionFixed, positionRelative, positionSticky, right, scale, scaleX, scaleY, selfCenter, selfEnd, selfStart, shadowNone, textCapitalize, textCenter, textColor, textCurrent, textEllipsis, textLeft, textLineThrough, textLowercase, textRight, textunderline, textUppercase, top, truncate, userSelectNone, visible, whiteSpaceBreakSpaces, whiteSpaceNoWrap, whiteSpacePreWrap, z };
|