venice-ui 1.0.22 → 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.
- package/dist/cjs/components/Section/Section.js +2 -2
- package/dist/cjs/components/Section/Section.styles.js +4 -2
- package/dist/cjs/components/Tile/Tile.js +4 -3
- package/dist/cjs/components/Tile/Tile.styles.js +1 -1
- package/dist/cjs/hooks/useOutsideClick.js +20 -0
- package/dist/esm/components/Section/Section.js +2 -2
- package/dist/esm/components/Section/Section.styles.js +4 -2
- package/dist/esm/components/Tile/Tile.js +4 -3
- package/dist/esm/components/Tile/Tile.styles.js +1 -1
- package/dist/esm/hooks/useOutsideClick.js +16 -0
- package/dist/types/components/Section/Section.d.ts +1 -0
- package/dist/types/components/Section/Section.styles.d.ts +6 -3
- package/dist/types/components/Tile/Tile.d.ts +1 -0
- package/dist/types/components/Tile/Tile.styles.d.ts +1 -0
- package/dist/types/hooks/useOutsideClick.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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,
|
|
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
|
|
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
|
`;
|
|
@@ -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
|
|
11
|
-
|
|
12
|
-
|
|
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: ${
|
|
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,
|
|
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
|
|
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
|
`;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ElementHeader } from '../ElementHeader';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { TileElement } from './Tile.styles';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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: ${
|
|
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
|
+
};
|
|
@@ -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
|
|
3
|
+
interface ISectionTitleStyle {
|
|
4
4
|
titlePosition?: TitlePosition;
|
|
5
5
|
}
|
|
6
|
-
export declare const SectionTitle: import("styled-components").StyledComponent<"div", any,
|
|
7
|
-
|
|
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 {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useOutsideClick: (callback: () => void) => import("react").RefObject<HTMLDivElement>;
|