venice-ui 1.0.22 → 1.0.25
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/Card/Card.js +1 -1
- package/dist/cjs/components/Card/Card.styles.js +5 -2
- package/dist/cjs/components/Section/Section.js +4 -3
- package/dist/cjs/components/Section/Section.styles.js +7 -3
- package/dist/cjs/components/Tile/Tile.js +4 -3
- package/dist/cjs/components/Tile/Tile.styles.js +2 -1
- package/dist/cjs/hooks/useOutsideClick.js +20 -0
- package/dist/esm/components/Card/Card.js +1 -1
- package/dist/esm/components/Card/Card.styles.js +5 -2
- package/dist/esm/components/Section/Section.js +4 -3
- package/dist/esm/components/Section/Section.styles.js +7 -3
- package/dist/esm/components/Tile/Tile.js +4 -3
- package/dist/esm/components/Tile/Tile.styles.js +2 -1
- package/dist/esm/hooks/useOutsideClick.js +16 -0
- package/dist/types/components/Card/Card.styles.d.ts +4 -1
- package/dist/types/components/Section/Section.d.ts +2 -0
- package/dist/types/components/Section/Section.styles.d.ts +10 -4
- package/dist/types/components/Tile/Tile.d.ts +2 -0
- package/dist/types/components/Tile/Tile.styles.d.ts +2 -0
- package/dist/types/hooks/useOutsideClick.d.ts +1 -0
- package/package.json +1 -1
|
@@ -10,6 +10,6 @@ const ElementHeader_1 = require("../ElementHeader");
|
|
|
10
10
|
const Card = ({ children, title, actionLabel, moreIcon = false, backIcon = false, handleClick, handleBack, height, options, }) => {
|
|
11
11
|
return (react_1.default.createElement(Card_styles_1.CardElement, { height: height },
|
|
12
12
|
(title || actionLabel) && (react_1.default.createElement(ElementHeader_1.ElementHeader, { title: title, actionLabel: actionLabel, handleClick: handleClick, handleBack: handleBack, closeIcon: false, backIcon: backIcon, actionButton: true, moreIcon: moreIcon, options: options })),
|
|
13
|
-
react_1.default.createElement(Card_styles_1.CardContent,
|
|
13
|
+
react_1.default.createElement(Card_styles_1.CardContent, { soloMode: !title && !actionLabel }, children)));
|
|
14
14
|
};
|
|
15
15
|
exports.Card = Card;
|
|
@@ -14,12 +14,15 @@ exports.CardElement = styled_components_1.default.div `
|
|
|
14
14
|
background-color: ${Theme_1.Theme.colors.white};
|
|
15
15
|
border-radius: ${Theme_1.Theme.borderRadius.m};
|
|
16
16
|
height: ${p => p.height ? p.height : '100%'};
|
|
17
|
-
box-shadow: ${Theme_1.Theme.shadow.s}
|
|
17
|
+
box-shadow: ${Theme_1.Theme.shadow.s};
|
|
18
18
|
`;
|
|
19
19
|
exports.CardContent = styled_components_1.default.div `
|
|
20
20
|
box-sizing: border-box;
|
|
21
21
|
display: flex;
|
|
22
|
+
backgorund-color:#ff0000;
|
|
22
23
|
padding: ${Theme_1.Theme.padding.l};
|
|
23
24
|
width: 100%;
|
|
24
25
|
flex-direction: row;
|
|
25
|
-
|
|
26
|
+
${p => !p.soloMode && `
|
|
27
|
+
padding-top:0px;`}
|
|
28
|
+
`;
|
|
@@ -7,10 +7,11 @@ 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
|
|
11
|
-
|
|
10
|
+
const Theme_1 = require("../../Theme");
|
|
11
|
+
const Section = ({ title, children, titlePosition = "left", noPadding = false, backgroundColor = Theme_1.Theme.colors.white, }) => {
|
|
12
|
+
return (react_1.default.createElement(Section_styles_1.SectionElement, { backgroundColor: backgroundColor },
|
|
12
13
|
title && (react_1.default.createElement(Section_styles_1.SectionTitle, { titlePosition: titlePosition },
|
|
13
14
|
react_1.default.createElement(Typography_1.TextSubHeader, null, title))),
|
|
14
|
-
react_1.default.createElement(Section_styles_1.SectionContent,
|
|
15
|
+
react_1.default.createElement(Section_styles_1.SectionContent, { noPadding: noPadding }, children)));
|
|
15
16
|
};
|
|
16
17
|
exports.Section = Section;
|
|
@@ -9,15 +9,19 @@ 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
|
-
|
|
13
|
-
|
|
12
|
+
overflow:auto;
|
|
13
|
+
padding: ${Theme_1.Theme.padding.l} 0;
|
|
14
|
+
background-color: ${(p) => p.backgroundColor};
|
|
14
15
|
`;
|
|
15
16
|
exports.SectionTitle = styled_components_1.default.div `
|
|
16
17
|
width:100%;
|
|
17
|
-
padding
|
|
18
|
+
padding:0 ${Theme_1.Theme.padding.l} ${Theme_1.Theme.padding.l} ${Theme_1.Theme.padding.l} ;
|
|
18
19
|
text-align:${p => p.titlePosition};
|
|
20
|
+
box-sizing:border-box;
|
|
19
21
|
`;
|
|
20
22
|
exports.SectionContent = styled_components_1.default.div `
|
|
23
|
+
box-sizing:border-box;
|
|
21
24
|
width:100%;
|
|
22
25
|
display:flex;
|
|
26
|
+
padding: 0 ${p => p.noPadding ? 0 : Theme_1.Theme.padding.l};
|
|
23
27
|
`;
|
|
@@ -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, height = 'auto', }) => {
|
|
12
|
+
return (react_1.default.createElement(Tile_styles_1.TileElement, { size: size, shadow: shadow, backgroundColor: backgroundColor, height: height },
|
|
13
|
+
title && react_1.default.createElement(ElementHeader_1.ElementHeader, { title: title, bgColor: backgroundColor }),
|
|
13
14
|
children));
|
|
14
15
|
};
|
|
15
16
|
exports.Tile = Tile;
|
|
@@ -10,12 +10,13 @@ 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;
|
|
17
17
|
flex-direction: column;
|
|
18
18
|
position: relative;
|
|
19
|
+
height:${p => p.height};
|
|
19
20
|
${(p) => p.shadow &&
|
|
20
21
|
`
|
|
21
22
|
box-shadow: ${Theme_1.Theme.shadow.s}
|
|
@@ -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;
|
|
@@ -4,5 +4,5 @@ import { ElementHeader } from '../ElementHeader';
|
|
|
4
4
|
export const Card = ({ children, title, actionLabel, moreIcon = false, backIcon = false, handleClick, handleBack, height, options, }) => {
|
|
5
5
|
return (React.createElement(CardElement, { height: height },
|
|
6
6
|
(title || actionLabel) && (React.createElement(ElementHeader, { title: title, actionLabel: actionLabel, handleClick: handleClick, handleBack: handleBack, closeIcon: false, backIcon: backIcon, actionButton: true, moreIcon: moreIcon, options: options })),
|
|
7
|
-
React.createElement(CardContent,
|
|
7
|
+
React.createElement(CardContent, { soloMode: !title && !actionLabel }, children)));
|
|
8
8
|
};
|
|
@@ -8,12 +8,15 @@ export const CardElement = styled.div `
|
|
|
8
8
|
background-color: ${Theme.colors.white};
|
|
9
9
|
border-radius: ${Theme.borderRadius.m};
|
|
10
10
|
height: ${p => p.height ? p.height : '100%'};
|
|
11
|
-
box-shadow: ${Theme.shadow.s}
|
|
11
|
+
box-shadow: ${Theme.shadow.s};
|
|
12
12
|
`;
|
|
13
13
|
export const CardContent = styled.div `
|
|
14
14
|
box-sizing: border-box;
|
|
15
15
|
display: flex;
|
|
16
|
+
backgorund-color:#ff0000;
|
|
16
17
|
padding: ${Theme.padding.l};
|
|
17
18
|
width: 100%;
|
|
18
19
|
flex-direction: row;
|
|
19
|
-
|
|
20
|
+
${p => !p.soloMode && `
|
|
21
|
+
padding-top:0px;`}
|
|
22
|
+
`;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { TextSubHeader } from '../Typography';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { SectionElement, SectionTitle, SectionContent } from './Section.styles';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { Theme } from '../../Theme';
|
|
5
|
+
export const Section = ({ title, children, titlePosition = "left", noPadding = false, backgroundColor = Theme.colors.white, }) => {
|
|
6
|
+
return (React.createElement(SectionElement, { backgroundColor: backgroundColor },
|
|
6
7
|
title && (React.createElement(SectionTitle, { titlePosition: titlePosition },
|
|
7
8
|
React.createElement(TextSubHeader, null, title))),
|
|
8
|
-
React.createElement(SectionContent,
|
|
9
|
+
React.createElement(SectionContent, { noPadding: noPadding }, children)));
|
|
9
10
|
};
|
|
@@ -3,15 +3,19 @@ import { Theme } from "../../Theme";
|
|
|
3
3
|
export const SectionElement = styled.div `
|
|
4
4
|
width:100%;
|
|
5
5
|
box-sizing:border-box;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
overflow:auto;
|
|
7
|
+
padding: ${Theme.padding.l} 0;
|
|
8
|
+
background-color: ${(p) => p.backgroundColor};
|
|
8
9
|
`;
|
|
9
10
|
export const SectionTitle = styled.div `
|
|
10
11
|
width:100%;
|
|
11
|
-
padding
|
|
12
|
+
padding:0 ${Theme.padding.l} ${Theme.padding.l} ${Theme.padding.l} ;
|
|
12
13
|
text-align:${p => p.titlePosition};
|
|
14
|
+
box-sizing:border-box;
|
|
13
15
|
`;
|
|
14
16
|
export const SectionContent = styled.div `
|
|
17
|
+
box-sizing:border-box;
|
|
15
18
|
width:100%;
|
|
16
19
|
display:flex;
|
|
20
|
+
padding: 0 ${p => p.noPadding ? 0 : Theme.padding.l};
|
|
17
21
|
`;
|
|
@@ -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, height = 'auto', }) => {
|
|
6
|
+
return (React.createElement(TileElement, { size: size, shadow: shadow, backgroundColor: backgroundColor, height: height },
|
|
7
|
+
title && React.createElement(ElementHeader, { title: title, bgColor: backgroundColor }),
|
|
7
8
|
children));
|
|
8
9
|
};
|
|
@@ -4,12 +4,13 @@ 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;
|
|
11
11
|
flex-direction: column;
|
|
12
12
|
position: relative;
|
|
13
|
+
height:${p => p.height};
|
|
13
14
|
${(p) => p.shadow &&
|
|
14
15
|
`
|
|
15
16
|
box-shadow: ${Theme.shadow.s}
|
|
@@ -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
|
+
};
|
|
@@ -2,5 +2,8 @@ interface ICardElementProps {
|
|
|
2
2
|
height?: string;
|
|
3
3
|
}
|
|
4
4
|
export declare const CardElement: import("styled-components").StyledComponent<"div", any, ICardElementProps, never>;
|
|
5
|
-
|
|
5
|
+
interface ICardContentStyles {
|
|
6
|
+
soloMode: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const CardContent: import("styled-components").StyledComponent<"div", any, ICardContentStyles, never>;
|
|
6
9
|
export {};
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { TitlePosition } from '../../types';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
interface ISectionStyles {
|
|
3
|
+
backgroundColor: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const SectionElement: import("styled-components").StyledComponent<"div", any, ISectionStyles, never>;
|
|
6
|
+
interface ISectionTitleStyle {
|
|
4
7
|
titlePosition?: TitlePosition;
|
|
5
8
|
}
|
|
6
|
-
export declare const SectionTitle: import("styled-components").StyledComponent<"div", any,
|
|
7
|
-
|
|
9
|
+
export declare const SectionTitle: import("styled-components").StyledComponent<"div", any, ISectionTitleStyle, never>;
|
|
10
|
+
interface ISectionContentStyles {
|
|
11
|
+
noPadding: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const SectionContent: import("styled-components").StyledComponent<"div", any, ISectionContentStyles, never>;
|
|
8
14
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useOutsideClick: (callback: () => void) => import("react").RefObject<HTMLDivElement>;
|