diginet-core-ui 1.3.89-beta.2 → 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.
@@ -0,0 +1,144 @@
1
+ /** @jsxRuntime classic */
2
+ /** @jsx jsx */
3
+ import { css, jsx } from '@emotion/core';
4
+ import { ButtonIcon, Typography } from "./..";
5
+ import { Icon } from "../../icons/effect";
6
+ import OptionWrapper from "../others/option-wrapper";
7
+ import PropTypes from 'prop-types';
8
+ import React, { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
9
+ import { displayFlex, flexWrap, itemsCenter, mg, mgx, pd, userSelectNone } from "../../styles/general";
10
+ import { classNames } from "../../utils";
11
+ const insertSeparators = (items, separator) => {
12
+ return items.reduce((acc, current, index) => {
13
+ if (index < items.length - 1) {
14
+ acc = acc.concat(current, jsx("li", {
15
+ css: BreadcrumbSeparatorCSS,
16
+ "aria-hidden": true,
17
+ key: `separator-${index}`,
18
+ className: 'DGN-UI-Breadcrumb-separator'
19
+ }, separator));
20
+ } else {
21
+ acc.push(current);
22
+ }
23
+ return acc;
24
+ }, []);
25
+ };
26
+ const Breadcrumb = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
27
+ action = {},
28
+ children,
29
+ className,
30
+ data,
31
+ id,
32
+ itemsAfterCollapse,
33
+ itemsBeforeCollapse,
34
+ maxItems,
35
+ separator,
36
+ style
37
+ }, reference) => {
38
+ if (!reference) reference = useRef(null);
39
+ const ref = useRef(null);
40
+ const [expanded, setExpanded] = React.useState(false);
41
+ useImperativeHandle(reference, () => {
42
+ const currentRef = ref.current || {};
43
+ currentRef.element = ref.current;
44
+ const _instance = {
45
+ ...action
46
+ }; // methods
47
+ _instance.__proto__ = {}; // hidden methods
48
+ currentRef.instance = _instance;
49
+ return currentRef;
50
+ });
51
+ const renderItemsBeforeAndAfter = allItems => {
52
+ const handleClickExpand = () => {
53
+ setExpanded(true);
54
+ };
55
+ if (itemsBeforeCollapse + itemsAfterCollapse >= allItems.length) {
56
+ return allItems;
57
+ }
58
+ return [...allItems.slice(0, itemsBeforeCollapse), jsx(ButtonIcon, {
59
+ key: "ellipsis",
60
+ name: 'MoreHoriz',
61
+ width: 24,
62
+ height: 16,
63
+ onClick: handleClickExpand
64
+ }), ...allItems.slice(allItems.length - itemsAfterCollapse, allItems.length)];
65
+ };
66
+ const allItems = data !== null && data !== void 0 && data.length ? data.map((item, idx) => {
67
+ var _data$onClick;
68
+ return jsx("li", {
69
+ className: 'DGN-UI-Breadcrumb-li',
70
+ key: `child-${idx}`
71
+ }, jsx(Typography, {
72
+ type: (data === null || data === void 0 ? void 0 : data.length) === idx + 1 ? 'h5' : 'p3',
73
+ mapping: 'a',
74
+ color: 'text.sub',
75
+ href: data === null || data === void 0 ? void 0 : data.href,
76
+ onClick: data === null || data === void 0 ? void 0 : (_data$onClick = data.onClick) === null || _data$onClick === void 0 ? void 0 : _data$onClick.call(data)
77
+ }, item === null || item === void 0 ? void 0 : item.name));
78
+ }) : React.Children.toArray(children).filter(child => {
79
+ return /*#__PURE__*/React.isValidElement(child);
80
+ }).map((child, idx) => jsx("li", {
81
+ className: 'DGN-UI-Breadcrumb-li',
82
+ key: `child-${idx}`
83
+ }, child));
84
+ return useMemo(() => {
85
+ return jsx("nav", {
86
+ ref: ref,
87
+ id: id,
88
+ style: style,
89
+ className: classNames('DGN-UI-Breadcrumb', className)
90
+ }, jsx("ol", {
91
+ css: BreadcrumbOlCSS,
92
+ className: 'DGN-UI-Breadcrumb-ol'
93
+ }, insertSeparators(expanded || maxItems && allItems.length <= maxItems ? allItems : renderItemsBeforeAndAfter(allItems), separator)));
94
+ }, [children, className, data, id, itemsAfterCollapse, itemsBeforeCollapse, maxItems, separator, style, expanded]);
95
+ }));
96
+ const BreadcrumbOlCSS = css`
97
+ ${displayFlex};
98
+ ${flexWrap};
99
+ ${itemsCenter};
100
+ ${pd(0)};
101
+ ${mg(0)};
102
+ list-style: none;
103
+ `;
104
+ const BreadcrumbSeparatorCSS = css`
105
+ ${displayFlex};
106
+ ${userSelectNone};
107
+ ${mgx([2])};
108
+ `;
109
+ Breadcrumb.defaultProps = {
110
+ className: '',
111
+ itemsBeforeCollapse: 1,
112
+ itemsAfterCollapse: 1,
113
+ maxItems: 8,
114
+ separator: jsx(Icon, {
115
+ name: 'ArrowRight',
116
+ width: 16,
117
+ height: 16
118
+ }),
119
+ style: {}
120
+ };
121
+ Breadcrumb.propTypes = {
122
+ /** The content of the component. */
123
+ children: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
124
+ /** Class for component. */
125
+ className: PropTypes.string,
126
+ /** Class for component. */
127
+ data: PropTypes.PropTypes.arrayOf(PropTypes.shape({
128
+ name: PropTypes.string,
129
+ href: PropTypes.string,
130
+ onClick: PropTypes.func
131
+ })),
132
+ /** Class for component. */
133
+ itemsBeforeCollapse: PropTypes.number,
134
+ /** Class for component. */
135
+ itemsAfterCollapse: PropTypes.number,
136
+ /** Class for component. */
137
+ maxItems: PropTypes.number,
138
+ /** Custom separator node. */
139
+ separator: PropTypes.node,
140
+ /** Style inline of component. */
141
+ style: PropTypes.object
142
+ };
143
+ export { Breadcrumb };
144
+ export default OptionWrapper(Breadcrumb);
@@ -31,6 +31,9 @@ export { default as Button } from "./button";
31
31
  export { default as ButtonIcon } from "./button/icon";
32
32
  export { default as ButtonMore } from "./button/more";
33
33
 
34
+ // BREADCRUMB
35
+ export { default as Breadcrumb } from "./breadcrumb";
36
+
34
37
  // CARD
35
38
  export { default as Card } from "./card";
36
39
  export { default as CardHeader } from "./card/header";
@@ -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 = bgColor => css`
526
+ const PopoverArrowCSS = (bgCl, arrowSize) => css`
532
527
  ${displayNone};
533
528
  ${positionAbsolute};
534
529
  ${parseWidthHeight(0)};
535
- border-left: 6px solid transparent;
536
- border-right: 6px solid transparent;
537
- border-bottom: 6px solid ${bgColor};
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: systemWhite,
540
+ bgColor: 'system.white',
546
541
  className: '',
547
542
  clickOutsideToClose: true,
548
543
  fullScreen: true,
package/icons/basic.js CHANGED
@@ -4295,6 +4295,34 @@ export const PaperZoom = /*#__PURE__*/memo(({
4295
4295
  fill: colors[color] || color
4296
4296
  }));
4297
4297
  });
4298
+ export const Pause = /*#__PURE__*/memo(({
4299
+ width,
4300
+ height,
4301
+ color = '#7F828E',
4302
+ viewBox = false
4303
+ }) => {
4304
+ return viewBox ? /*#__PURE__*/React.createElement("svg", {
4305
+ width: width || 24,
4306
+ height: height || 24,
4307
+ viewBox: "0 0 24 24",
4308
+ fill: "none"
4309
+ }, /*#__PURE__*/React.createElement("path", {
4310
+ fillRule: "evenodd",
4311
+ clipRule: "evenodd",
4312
+ d: "M10 19H6V5H10V19ZM14 19V5H18V19H14Z",
4313
+ fill: colors[color] || color
4314
+ })) : /*#__PURE__*/React.createElement("svg", {
4315
+ width: width || 12,
4316
+ height: height || 14,
4317
+ viewBox: "0 0 12 14",
4318
+ fill: "none"
4319
+ }, /*#__PURE__*/React.createElement("path", {
4320
+ fillRule: "evenodd",
4321
+ clipRule: "evenodd",
4322
+ d: "M4 14H0V0H4V14ZM8 14V0H12V14H8Z",
4323
+ fill: colors[color] || color
4324
+ }));
4325
+ });
4298
4326
  export const Payment = /*#__PURE__*/memo(({
4299
4327
  width,
4300
4328
  height,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diginet-core-ui",
3
- "version": "1.3.89-beta.2",
3
+ "version": "1.3.89-beta.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "license": "UNLICENSED",
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 };