venice-ui 1.0.21 → 1.0.24

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.
@@ -7,10 +7,10 @@ exports.Section = void 0;
7
7
  const Typography_1 = require("../Typography");
8
8
  const react_1 = __importDefault(require("react"));
9
9
  const Section_styles_1 = require("./Section.styles");
10
- const Section = ({ title, children, titlePosition = "left" }) => {
10
+ const Section = ({ title, children, titlePosition = "left", noPadding = false }) => {
11
11
  return (react_1.default.createElement(Section_styles_1.SectionElement, null,
12
12
  title && (react_1.default.createElement(Section_styles_1.SectionTitle, { titlePosition: titlePosition },
13
13
  react_1.default.createElement(Typography_1.TextSubHeader, null, title))),
14
- react_1.default.createElement(Section_styles_1.SectionContent, null, children)));
14
+ react_1.default.createElement(Section_styles_1.SectionContent, { noPadding: noPadding }, children)));
15
15
  };
16
16
  exports.Section = Section;
@@ -9,15 +9,17 @@ const Theme_1 = require("../../Theme");
9
9
  exports.SectionElement = styled_components_1.default.div `
10
10
  width:100%;
11
11
  box-sizing:border-box;
12
- padding: ${Theme_1.Theme.padding.l};
12
+ padding: ${Theme_1.Theme.padding.l} 0;
13
13
  background-color:${Theme_1.Theme.colors.white};
14
14
  `;
15
15
  exports.SectionTitle = styled_components_1.default.div `
16
16
  width:100%;
17
- padding-bottom: ${Theme_1.Theme.padding.l};
17
+ padding:0 ${Theme_1.Theme.padding.l} ${Theme_1.Theme.padding.l} ${Theme_1.Theme.padding.l} ;
18
18
  text-align:${p => p.titlePosition};
19
+ box-sizing:border-box;
19
20
  `;
20
21
  exports.SectionContent = styled_components_1.default.div `
21
22
  width:100%;
22
23
  display:flex;
24
+ padding: 0 ${p => p.noPadding ? 0 : Theme_1.Theme.padding.l};
23
25
  `;
@@ -34,7 +34,9 @@ const Sidepanel = ({ isOpen, handleClose, children, right = false, overlayer = t
34
34
  const ref = (0, react_1.useRef)(null);
35
35
  (0, react_1.useEffect)(() => {
36
36
  const handleClickOutside = (event) => {
37
- if (ref.current && !ref.current.contains(event.target) && isOpen) {
37
+ console.log('click:', isOpen);
38
+ if (ref.current && !ref.current.contains(event.target)) {
39
+ console.log('fire:', isOpen);
38
40
  handleClose && handleClose();
39
41
  }
40
42
  };
@@ -7,9 +7,10 @@ exports.Tile = void 0;
7
7
  const ElementHeader_1 = require("../ElementHeader");
8
8
  const react_1 = __importDefault(require("react"));
9
9
  const Tile_styles_1 = require("./Tile.styles");
10
- const Tile = ({ size = 'small', shadow = true, title, children, }) => {
11
- return (react_1.default.createElement(Tile_styles_1.TileElement, { size: size, shadow: shadow },
12
- title && react_1.default.createElement(ElementHeader_1.ElementHeader, { title: title }),
10
+ const Theme_1 = require("../../Theme");
11
+ const Tile = ({ size = 'small', shadow = true, title, children, backgroundColor = Theme_1.Theme.colors.white, }) => {
12
+ return (react_1.default.createElement(Tile_styles_1.TileElement, { size: size, shadow: shadow, backgroundColor: backgroundColor },
13
+ title && react_1.default.createElement(ElementHeader_1.ElementHeader, { title: title, bgColor: backgroundColor }),
13
14
  children));
14
15
  };
15
16
  exports.Tile = Tile;
@@ -10,7 +10,7 @@ exports.TileElement = styled_components_1.default.div `
10
10
  box-sizing: border-box;
11
11
  display: flex;
12
12
  width: 100%;
13
- background-color: ${Theme_1.Theme.colors.white};
13
+ background-color: ${(p) => p.backgroundColor};
14
14
  border-radius: ${Theme_1.Theme.borderRadius.m};
15
15
  max-height: 100%;
16
16
  overflow: hidden;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useOutsideClick = void 0;
4
+ const react_1 = require("react");
5
+ const useOutsideClick = (callback) => {
6
+ const ref = (0, react_1.useRef)(null);
7
+ (0, react_1.useEffect)(() => {
8
+ const handleClick = (event) => {
9
+ if (ref.current && !ref.current.contains(event.target)) {
10
+ callback();
11
+ }
12
+ };
13
+ document.addEventListener("click", handleClick, true);
14
+ return () => {
15
+ document.removeEventListener("click", handleClick, true);
16
+ };
17
+ }, [ref]);
18
+ return ref;
19
+ };
20
+ exports.useOutsideClick = useOutsideClick;
@@ -1,9 +1,9 @@
1
1
  import { TextSubHeader } from '../Typography';
2
2
  import React from 'react';
3
3
  import { SectionElement, SectionTitle, SectionContent } from './Section.styles';
4
- export const Section = ({ title, children, titlePosition = "left" }) => {
4
+ export const Section = ({ title, children, titlePosition = "left", noPadding = false }) => {
5
5
  return (React.createElement(SectionElement, null,
6
6
  title && (React.createElement(SectionTitle, { titlePosition: titlePosition },
7
7
  React.createElement(TextSubHeader, null, title))),
8
- React.createElement(SectionContent, null, children)));
8
+ React.createElement(SectionContent, { noPadding: noPadding }, children)));
9
9
  };
@@ -3,15 +3,17 @@ import { Theme } from "../../Theme";
3
3
  export const SectionElement = styled.div `
4
4
  width:100%;
5
5
  box-sizing:border-box;
6
- padding: ${Theme.padding.l};
6
+ padding: ${Theme.padding.l} 0;
7
7
  background-color:${Theme.colors.white};
8
8
  `;
9
9
  export const SectionTitle = styled.div `
10
10
  width:100%;
11
- padding-bottom: ${Theme.padding.l};
11
+ padding:0 ${Theme.padding.l} ${Theme.padding.l} ${Theme.padding.l} ;
12
12
  text-align:${p => p.titlePosition};
13
+ box-sizing:border-box;
13
14
  `;
14
15
  export const SectionContent = styled.div `
15
16
  width:100%;
16
17
  display:flex;
18
+ padding: 0 ${p => p.noPadding ? 0 : Theme.padding.l};
17
19
  `;
@@ -8,7 +8,9 @@ export const Sidepanel = ({ isOpen, handleClose, children, right = false, overla
8
8
  const ref = useRef(null);
9
9
  useEffect(() => {
10
10
  const handleClickOutside = (event) => {
11
- if (ref.current && !ref.current.contains(event.target) && isOpen) {
11
+ console.log('click:', isOpen);
12
+ if (ref.current && !ref.current.contains(event.target)) {
13
+ console.log('fire:', isOpen);
12
14
  handleClose && handleClose();
13
15
  }
14
16
  };
@@ -1,8 +1,9 @@
1
1
  import { ElementHeader } from '../ElementHeader';
2
2
  import React from 'react';
3
3
  import { TileElement } from './Tile.styles';
4
- export const Tile = ({ size = 'small', shadow = true, title, children, }) => {
5
- return (React.createElement(TileElement, { size: size, shadow: shadow },
6
- title && React.createElement(ElementHeader, { title: title }),
4
+ import { Theme } from '../../Theme';
5
+ export const Tile = ({ size = 'small', shadow = true, title, children, backgroundColor = Theme.colors.white, }) => {
6
+ return (React.createElement(TileElement, { size: size, shadow: shadow, backgroundColor: backgroundColor },
7
+ title && React.createElement(ElementHeader, { title: title, bgColor: backgroundColor }),
7
8
  children));
8
9
  };
@@ -4,7 +4,7 @@ export const TileElement = styled.div `
4
4
  box-sizing: border-box;
5
5
  display: flex;
6
6
  width: 100%;
7
- background-color: ${Theme.colors.white};
7
+ background-color: ${(p) => p.backgroundColor};
8
8
  border-radius: ${Theme.borderRadius.m};
9
9
  max-height: 100%;
10
10
  overflow: hidden;
@@ -0,0 +1,16 @@
1
+ import { useEffect, useRef } from "react";
2
+ export const useOutsideClick = (callback) => {
3
+ const ref = useRef(null);
4
+ useEffect(() => {
5
+ const handleClick = (event) => {
6
+ if (ref.current && !ref.current.contains(event.target)) {
7
+ callback();
8
+ }
9
+ };
10
+ document.addEventListener("click", handleClick, true);
11
+ return () => {
12
+ document.removeEventListener("click", handleClick, true);
13
+ };
14
+ }, [ref]);
15
+ return ref;
16
+ };
@@ -4,5 +4,6 @@ export interface ISectionProps {
4
4
  title?: string;
5
5
  children: React.ReactNode;
6
6
  titlePosition?: TitlePosition;
7
+ noPadding?: boolean;
7
8
  }
8
9
  export declare const Section: FC<ISectionProps>;
@@ -1,8 +1,11 @@
1
1
  import { TitlePosition } from '../../types';
2
2
  export declare const SectionElement: import("styled-components").StyledComponent<"div", any, {}, never>;
3
- interface ISectionTitleSyle {
3
+ interface ISectionTitleStyle {
4
4
  titlePosition?: TitlePosition;
5
5
  }
6
- export declare const SectionTitle: import("styled-components").StyledComponent<"div", any, ISectionTitleSyle, never>;
7
- export declare const SectionContent: import("styled-components").StyledComponent<"div", any, {}, never>;
6
+ export declare const SectionTitle: import("styled-components").StyledComponent<"div", any, ISectionTitleStyle, never>;
7
+ interface ISectionContentStyles {
8
+ noPadding: boolean;
9
+ }
10
+ export declare const SectionContent: import("styled-components").StyledComponent<"div", any, ISectionContentStyles, never>;
8
11
  export {};
@@ -4,5 +4,6 @@ export interface ITileProps {
4
4
  title?: string;
5
5
  size?: string;
6
6
  shadow?: boolean;
7
+ backgroundColor?: string;
7
8
  }
8
9
  export declare const Tile: FC<ITileProps>;
@@ -1,6 +1,7 @@
1
1
  interface ITileElementStyle {
2
2
  size: string;
3
3
  shadow: boolean;
4
+ backgroundColor: string;
4
5
  }
5
6
  export declare const TileElement: import("styled-components").StyledComponent<"div", any, ITileElementStyle, never>;
6
7
  export {};
@@ -0,0 +1 @@
1
+ export declare const useOutsideClick: (callback: () => void) => import("react").RefObject<HTMLDivElement>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "venice-ui",
3
- "version": "1.0.21",
3
+ "version": "1.0.24",
4
4
  "description": "Component library",
5
5
  "main": "index.js",
6
6
  "module": "./dist/esm/index.js",