@via-profit/ui-kit 0.1.0-rc.58 → 0.1.0-rc.59
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/Surface/SurfaceFooter.d.ts +8 -0
- package/Surface/SurfaceFooter.js +31 -0
- package/Surface/index.d.ts +13 -0
- package/Surface/index.js +7 -3
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type SurfaceFooterProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
readonly noPadding?: boolean;
|
|
4
|
+
};
|
|
5
|
+
declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
6
|
+
readonly noPadding?: boolean | undefined;
|
|
7
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
+
const StyledFooter = styled_1.default.div `
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: flex-end;
|
|
23
|
+
padding: 1rem;
|
|
24
|
+
border-bottom-left-radius: inherit;
|
|
25
|
+
border-bottom-right-radius: inherit;
|
|
26
|
+
`;
|
|
27
|
+
const SurfaceFooter = (props, ref) => {
|
|
28
|
+
const { children } = props, nativeProps = __rest(props, ["children"]);
|
|
29
|
+
return (react_1.default.createElement(StyledFooter, Object.assign({}, nativeProps, { ref: ref }), children));
|
|
30
|
+
};
|
|
31
|
+
exports.default = react_1.default.forwardRef(SurfaceFooter);
|
package/Surface/index.d.ts
CHANGED
|
@@ -3,12 +3,17 @@ import { SurfaceContainerProps } from './SurfaceContainer';
|
|
|
3
3
|
import { SurfaceHeaderProps } from './SurfaceHeader';
|
|
4
4
|
import { SurfaceSubheaderProps } from './SurfaceSubheader';
|
|
5
5
|
import { SurfaceContentProps } from './SurfaceContent';
|
|
6
|
+
import { SurfaceFooterProps } from './SurfaceFooter';
|
|
6
7
|
export type SurfaceProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
7
8
|
readonly children: React.ReactNode | React.ReactNode[];
|
|
8
9
|
/**
|
|
9
10
|
* Header content
|
|
10
11
|
*/
|
|
11
12
|
readonly header?: JSX.Element | string;
|
|
13
|
+
/**
|
|
14
|
+
* Footer content
|
|
15
|
+
*/
|
|
16
|
+
readonly footer?: JSX.Element | string;
|
|
12
17
|
/**
|
|
13
18
|
* Subheader content
|
|
14
19
|
*/
|
|
@@ -39,6 +44,10 @@ export interface SurfaceOverrides {
|
|
|
39
44
|
* Surface content component
|
|
40
45
|
*/
|
|
41
46
|
readonly Content?: React.ForwardRefExoticComponent<SurfaceContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
47
|
+
/**
|
|
48
|
+
* Surface footer component
|
|
49
|
+
*/
|
|
50
|
+
readonly Footer?: React.ForwardRefExoticComponent<SurfaceFooterProps & React.RefAttributes<HTMLDivElement>>;
|
|
42
51
|
}
|
|
43
52
|
declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
44
53
|
readonly children: React.ReactNode | React.ReactNode[];
|
|
@@ -46,6 +55,10 @@ declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTM
|
|
|
46
55
|
* Header content
|
|
47
56
|
*/
|
|
48
57
|
readonly header?: string | JSX.Element | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Footer content
|
|
60
|
+
*/
|
|
61
|
+
readonly footer?: string | JSX.Element | undefined;
|
|
49
62
|
/**
|
|
50
63
|
* Subheader content
|
|
51
64
|
*/
|
package/Surface/index.js
CHANGED
|
@@ -42,20 +42,24 @@ const SurfaceContainer_1 = __importDefault(require("./SurfaceContainer"));
|
|
|
42
42
|
const SurfaceHeader_1 = __importDefault(require("./SurfaceHeader"));
|
|
43
43
|
const SurfaceSubheader_1 = __importDefault(require("./SurfaceSubheader"));
|
|
44
44
|
const SurfaceContent_1 = __importDefault(require("./SurfaceContent"));
|
|
45
|
+
const SurfaceFooter_1 = __importDefault(require("./SurfaceFooter"));
|
|
45
46
|
const Surface = (props, ref) => {
|
|
46
|
-
const { children, header, subheader, inline, overrides } = props, nativeProps = __rest(props, ["children", "header", "subheader", "inline", "overrides"]);
|
|
47
|
+
const { children, header, subheader, footer, inline, overrides } = props, nativeProps = __rest(props, ["children", "header", "subheader", "footer", "inline", "overrides"]);
|
|
48
|
+
const hasFooter = typeof footer !== 'undefined' && footer !== null;
|
|
47
49
|
const hasHeader = typeof header !== 'undefined' && header !== null;
|
|
48
50
|
const hasSubheader = typeof subheader !== 'undefined' && subheader !== null;
|
|
49
51
|
const overridesMap = React.useMemo(() => (Object.assign({ Container: SurfaceContainer_1.default,
|
|
50
52
|
Header: SurfaceHeader_1.default,
|
|
51
53
|
Subheader: SurfaceSubheader_1.default,
|
|
52
|
-
Content: SurfaceContent_1.default
|
|
54
|
+
Content: SurfaceContent_1.default,
|
|
55
|
+
Footer: SurfaceFooter_1.default }, overrides)), [overrides]);
|
|
53
56
|
if (!hasHeader && hasSubheader) {
|
|
54
57
|
console.warn(`[@via-profit/ui-kit] Surface component. If you use a subheader, then you should add a header`);
|
|
55
58
|
}
|
|
56
59
|
return (React.createElement(overridesMap.Container, Object.assign({}, nativeProps, { inline: inline, ref: ref }),
|
|
57
60
|
hasHeader && React.createElement(overridesMap.Header, null, header),
|
|
58
61
|
hasSubheader && React.createElement(overridesMap.Subheader, null, subheader),
|
|
59
|
-
React.createElement(overridesMap.Content, null, children)
|
|
62
|
+
React.createElement(overridesMap.Content, null, children),
|
|
63
|
+
hasFooter && React.createElement(overridesMap.Footer, null, footer)));
|
|
60
64
|
};
|
|
61
65
|
exports.default = React.forwardRef(Surface);
|