dga-ui-react 1.5.1 → 1.6.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.
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+
3
+ interface DGA_MetricProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "style"> {
4
+ style?: "smallChart" | "largeChart";
5
+ label?: React.ReactNode;
6
+ percentage?: React.ReactNode;
7
+ featuredIcon?: React.ReactNode;
8
+ showChart?: boolean;
9
+ chart?: {
10
+ type: "realistic" | "wavy" | "straight" | "layers";
11
+ trend: "negative" | "positive";
12
+ showMarker?: boolean;
13
+ };
14
+ showInfo?: boolean;
15
+ change?: {
16
+ content: React.ReactNode;
17
+ type: "01" | "02";
18
+ trend: "positive" | "negative";
19
+ };
20
+ text?: React.ReactNode;
21
+ showActions?: boolean;
22
+ moreButton?: React.ReactNode;
23
+ actions?: React.ReactNode;
24
+ }
25
+ declare const Metric: React.FC<DGA_MetricProps>;
26
+
27
+ export { Metric as default };
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "dga-ui-react",
3
+ "version": "1.0.0",
4
+ "description": "Metric component",
5
+ "author": "Ashraf Ainia",
6
+ "license": "MIT",
7
+ "main": "cjs/index.js",
8
+ "module": "esm/index.js",
9
+ "types": "index.d.ts"
10
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dga-ui-react",
3
- "version": "1.1.1",
4
- "description": "DGA ui library",
3
+ "version": "1.0.0",
4
+ "description": "DGA UI Charts",
5
5
  "author": "Ashraf Ainia",
6
6
  "license": "MIT",
7
7
  "main": "cjs/index.js",
package/dist/cjs/index.js CHANGED
@@ -263,11 +263,11 @@
263
263
  font-weight: 500;
264
264
  .leadIcon {
265
265
  margin-inline-end: 4px;
266
- display: "inline-flex";
267
- alignitems: "center";
266
+ display: inline-flex;
268
267
  }
269
268
  .trailIcon {
270
269
  margin-inline-start: 4px;
270
+ display: inline-flex;
271
271
  }
272
272
  `,xr={medium:{w:320,h:32,p:16,f:14},large:{w:320,h:40,p:16,f:16}},br=er.div`
273
273
  direction: ${e=>e.$theme.direction};
@@ -623,6 +623,10 @@
623
623
  margin-inline-start: 4px;
624
624
  display: inline-flex;
625
625
  }
626
+
627
+ .iconOnly {
628
+ display: inline-flex;
629
+ }
626
630
  `,Ur=er.div`
627
631
  direction: ${e=>e.$theme.direction};
628
632
  /* pointer-events: ${e=>e.$pointerEvents}; */
@@ -863,8 +867,9 @@
863
867
  transition: all 0.2s;
864
868
  border-bottom-left-radius: 50px;
865
869
  border-bottom-right-radius: 50px;
866
- `,Gr=r=>{var{children:o,menuItems:n,disabled:i,keepOpenOnItemsClicked:a,onOpen:s,onClose:d}=r,p=u(r,["children","menuItems","disabled","keepOpenOnItemsClicked","onOpen","onClose"]);const g=c(),[h,m]=t.useState(!1),[A,f]=t.useState(""),[x,b]=t.useState({top:0,left:0}),v=t.useRef(null),y=t.useRef(null),C=t.useRef(null),w=()=>{let e=Math.max(document.documentElement.clientHeight||0,window.innerHeight||0);if(y.current&&C.current){const t=y.current.getBoundingClientRect();let r={top:t.bottom,left:"ltr"===g.direction?t.left:t.right-C.current.clientWidth};"ltr"===g.direction?r.left+C.current.clientWidth>window.innerWidth&&(r.left=window.innerWidth-C.current.clientWidth):r.left&&t.right-C.current.clientWidth<0&&(r.left=0),t.bottom+C.current.clientHeight>e&&(r.top=t.top-C.current.clientHeight),r.top<0&&(r.top=0),r.top>e&&(r.top=C.current.clientHeight),b(r)}};return t.useEffect((()=>{if(y.current){const e=()=>{w()},t=e=>{var t;(null===(t=v.current)||void 0===t?void 0:t.contains(e.target))||(null==d||d(e),m(!1))};return window.addEventListener("resize",e),window.addEventListener("click",t),()=>{window.removeEventListener("resize",e),window.removeEventListener("click",t)}}}),[y]),t.useEffect((()=>{const e=document.getElementsByTagName("body");e&&e[0]&&(e[0].style.overflow=h?"hidden":A)}),[h]),t.useEffect((()=>{var e,t,r;f(null===(r=null===(t=null===(e=document.getElementsByTagName("body"))||void 0===e?void 0:e[0])||void 0===t?void 0:t.style)||void 0===r?void 0:r.overflow)}),[]),e.jsxs(Wr,Object.assign({$theme:g},p,{className:l("dgaui dgaui_menu",p.className),ref:v,children:[e.jsx("div",{ref:y,onClick:e=>(e=>{h?(m(!1),null==d||d(e)):(w(),m(!0),null==s||s(e))})(e),className:"menuChildren",children:o}),e.jsx("div",{ref:C,className:"menueItemsContainer dgaui_hiddenScrollbar "+(h?" slide-bottom":""),style:x,onClick:e=>{a||(m(!1),null==d||d(e))},children:n})]}))},Wr=er.div`
870
+ `,Gr=r=>{var{children:o,menuItems:n,disabled:i,keepOpenOnItemsClicked:a,onOpen:s,onClose:d,reverseOpeningDirection:p}=r,g=u(r,["children","menuItems","disabled","keepOpenOnItemsClicked","onOpen","onClose","reverseOpeningDirection"]);const h=c(),[m,A]=t.useState(!1),[f,x]=t.useState(""),[b,v]=t.useState({top:0,left:0}),y=t.useRef(null),C=t.useRef(null),w=t.useRef(null),$=()=>{const e=Math.max(document.documentElement.clientHeight,window.innerHeight);if(C.current&&w.current){const t=C.current.getBoundingClientRect();let r={top:t.bottom,left:"ltr"===h.direction?t.left:t.right-w.current.clientWidth};"ltr"===h.direction?r.left+w.current.clientWidth>window.innerWidth&&(r.left=window.innerWidth-w.current.clientWidth):r.left&&t.right-w.current.clientWidth<0&&(r.left=0),p&&(r={top:r.top,left:"ltr"===h.direction?t.right-w.current.clientWidth:t.left},r.left<0&&(r.left=0),t.left+w.current.clientWidth>innerWidth&&(r.left=innerWidth-w.current.clientWidth)),t.bottom+w.current.clientHeight>e&&(r.top=t.top-w.current.clientHeight),r.top<0&&(r.top=0),r.top>e&&(r.top=w.current.clientHeight),v(r)}};return t.useEffect((()=>{if(C.current){const e=()=>{$()},t=e=>{var t;(null===(t=y.current)||void 0===t?void 0:t.contains(e.target))||(null==d||d(e),A(!1))};return window.addEventListener("resize",e),window.addEventListener("click",t),()=>{window.removeEventListener("resize",e),window.removeEventListener("click",t)}}}),[C,p]),t.useEffect((()=>{const e=document.getElementsByTagName("body");e&&e[0]&&(e[0].style.overflow=m?"hidden":f)}),[m]),t.useEffect((()=>{var e,t,r;x(null===(r=null===(t=null===(e=document.getElementsByTagName("body"))||void 0===e?void 0:e[0])||void 0===t?void 0:t.style)||void 0===r?void 0:r.overflow)}),[]),e.jsxs(Wr,Object.assign({$theme:h},g,{className:l("dgaui dgaui_menu",g.className),ref:y,children:[e.jsx("div",{ref:C,onClick:e=>(e=>{m?(A(!1),null==d||d(e)):($(),A(!0),null==s||s(e))})(e),className:"menuChildren",children:o}),e.jsx("div",{ref:w,className:"menueItemsContainer dgaui_hiddenScrollbar "+(m?" slide-bottom":""),style:b,onClick:e=>{a||(A(!1),null==d||d(e))},children:n})]}))},Wr=er.div`
867
871
  direction: ${e=>e.$theme.direction};
872
+ display: inline-block;
868
873
 
869
874
  .menueItemsContainer {
870
875
  width: max-content;