@via-profit/ui-kit 0.1.6 → 0.1.7

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.
@@ -16,6 +16,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  const react_1 = __importDefault(require("react"));
18
18
  const styled_1 = __importDefault(require("@emotion/styled"));
19
+ const react_2 = require("@emotion/react");
19
20
  const StyledSurfaceContainer = styled_1.default.div `
20
21
  display: ${({ $inline }) => ($inline ? 'inline-flex' : 'flex')};
21
22
  box-sizing: border-box;
@@ -25,9 +26,14 @@ const StyledSurfaceContainer = styled_1.default.div `
25
26
  box-shadow: ${({ theme }) => `0 0.5em 2em -0.8em ${theme.color.surface.darken(100).alpha(0.4).toString()}`};
26
27
  border-radius: ${({ theme }) => theme.shape.radiusFactor}em;
27
28
  font-size: 1em;
29
+
30
+ ${({ $rounded }) => $rounded &&
31
+ (0, react_2.css) `
32
+ border-radius: 100%;
33
+ `}
28
34
  `;
29
35
  const SurfaceContainer = (props, ref) => {
30
- const { inline, children } = props, nativeProps = __rest(props, ["inline", "children"]);
31
- return (react_1.default.createElement(StyledSurfaceContainer, Object.assign({ "$inline": inline }, nativeProps, { ref: ref }), children));
36
+ const { inline, children, rounded, noPadding } = props, nativeProps = __rest(props, ["inline", "children", "rounded", "noPadding"]);
37
+ return (react_1.default.createElement(StyledSurfaceContainer, Object.assign({ "$inline": inline, "$rounded": rounded, "$noPadding": noPadding }, nativeProps, { ref: ref }), children));
32
38
  };
33
39
  exports.default = react_1.default.forwardRef(SurfaceContainer);
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
2
  export type SurfaceContentProps = React.HTMLAttributes<HTMLDivElement> & {
3
3
  readonly noPadding?: boolean;
4
+ readonly rounded?: boolean;
4
5
  };
5
6
  declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
6
7
  readonly noPadding?: boolean | undefined;
8
+ readonly rounded?: boolean | undefined;
7
9
  } & React.RefAttributes<HTMLDivElement>>;
8
10
  export default _default;
@@ -22,11 +22,20 @@ const StyledContent = styled_1.default.div `
22
22
  overflow: auto;
23
23
  ${({ $noPadding }) => (typeof $noPadding === 'undefined' || $noPadding === false) &&
24
24
  (0, react_2.css) `
25
+ overflow: visible;
25
26
  padding: 1.4rem 1rem 1rem 1rem;
26
27
  `}
28
+
29
+ ${({ $rounded, $noPadding }) => $rounded &&
30
+ (0, react_2.css) `
31
+ display: flex;
32
+ align-items: center;
33
+ justify-content: center;
34
+ padding: ${$noPadding ? '0' : '1rem'};
35
+ `}
27
36
  `;
28
37
  const SurfaceContent = (props, ref) => {
29
- const { children, noPadding } = props, nativeProps = __rest(props, ["children", "noPadding"]);
30
- return (react_1.default.createElement(StyledContent, Object.assign({ "$noPadding": noPadding }, nativeProps, { ref: ref }), children));
38
+ const { children, noPadding, rounded } = props, nativeProps = __rest(props, ["children", "noPadding", "rounded"]);
39
+ return (react_1.default.createElement(StyledContent, Object.assign({ "$noPadding": noPadding, "$rounded": rounded }, nativeProps, { ref: ref }), children));
31
40
  };
32
41
  exports.default = react_1.default.forwardRef(SurfaceContent);
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
2
  export type SurfaceFooterProps = React.HTMLAttributes<HTMLDivElement> & {
3
3
  readonly noPadding?: boolean;
4
+ readonly rounded?: boolean;
4
5
  };
5
6
  declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
6
7
  readonly noPadding?: boolean | undefined;
8
+ readonly rounded?: boolean | undefined;
7
9
  } & React.RefAttributes<HTMLDivElement>>;
8
10
  export default _default;
@@ -20,12 +20,12 @@ const StyledFooter = styled_1.default.div `
20
20
  display: flex;
21
21
  align-items: center;
22
22
  justify-content: flex-end;
23
- padding: 1rem;
23
+ padding: ${({ $noPadding }) => ($noPadding ? '0' : '1rem')};
24
24
  border-bottom-left-radius: inherit;
25
25
  border-bottom-right-radius: inherit;
26
26
  `;
27
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));
28
+ const { children, noPadding, rounded } = props, nativeProps = __rest(props, ["children", "noPadding", "rounded"]);
29
+ return (react_1.default.createElement(StyledFooter, Object.assign({ "$noPadding": noPadding }, nativeProps, { ref: ref }), children));
30
30
  };
31
31
  exports.default = react_1.default.forwardRef(SurfaceFooter);
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
2
  export type SurfaceHeaderProps = React.HTMLAttributes<HTMLDivElement> & {
3
3
  readonly noPadding?: boolean;
4
+ readonly rounded?: boolean;
4
5
  };
5
6
  declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
6
7
  readonly noPadding?: boolean | undefined;
8
+ readonly rounded?: boolean | undefined;
7
9
  } & React.RefAttributes<HTMLDivElement>>;
8
10
  export default _default;
@@ -24,7 +24,7 @@ const StyledHeader = styled_1.default.div `
24
24
  border-top-right-radius: inherit;
25
25
  `;
26
26
  const SurfaceHeader = (props, ref) => {
27
- const { children, noPadding } = props, nativeProps = __rest(props, ["children", "noPadding"]);
27
+ const { children, noPadding, rounded } = props, nativeProps = __rest(props, ["children", "noPadding", "rounded"]);
28
28
  return (react_1.default.createElement(StyledHeader, Object.assign({ "$noPadding": noPadding }, nativeProps, { ref: ref }), children));
29
29
  };
30
30
  exports.default = react_1.default.forwardRef(SurfaceHeader);
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
2
  export type SurfaceSubheaderProps = React.HTMLAttributes<HTMLDivElement> & {
3
3
  readonly noPadding?: boolean;
4
+ readonly rounded?: boolean;
4
5
  };
5
6
  declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
6
7
  readonly noPadding?: boolean | undefined;
8
+ readonly rounded?: boolean | undefined;
7
9
  } & React.RefAttributes<HTMLDivElement>>;
8
10
  export default _default;
@@ -23,7 +23,7 @@ const StyledHeader = styled_1.default.div `
23
23
  color: ${({ theme }) => theme.color.textSecondary.toString()};
24
24
  `;
25
25
  const SurfaceSubheader = (props, ref) => {
26
- const { children, noPadding } = props, nativeProps = __rest(props, ["children", "noPadding"]);
26
+ const { children, noPadding, rounded } = props, nativeProps = __rest(props, ["children", "noPadding", "rounded"]);
27
27
  return (react_1.default.createElement(StyledHeader, Object.assign({ "$noPadding": noPadding }, nativeProps, { ref: ref }), children));
28
28
  };
29
29
  exports.default = react_1.default.forwardRef(SurfaceSubheader);
package/Surface/index.js CHANGED
@@ -44,7 +44,7 @@ const SurfaceSubheader_1 = __importDefault(require("./SurfaceSubheader"));
44
44
  const SurfaceContent_1 = __importDefault(require("./SurfaceContent"));
45
45
  const SurfaceFooter_1 = __importDefault(require("./SurfaceFooter"));
46
46
  const Surface = (props, ref) => {
47
- const { children, header, subheader, footer, inline, noPadding, overrides } = props, nativeProps = __rest(props, ["children", "header", "subheader", "footer", "inline", "noPadding", "overrides"]);
47
+ const { children, header, subheader, footer, inline, noPadding, rounded, overrides } = props, nativeProps = __rest(props, ["children", "header", "subheader", "footer", "inline", "noPadding", "rounded", "overrides"]);
48
48
  const hasFooter = typeof footer !== 'undefined' && footer !== null;
49
49
  const hasHeader = typeof header !== 'undefined' && header !== null;
50
50
  const hasSubheader = typeof subheader !== 'undefined' && subheader !== null;
@@ -58,10 +58,10 @@ const Surface = (props, ref) => {
58
58
  if (!hasHeader && hasSubheader) {
59
59
  console.warn(`[@via-profit/ui-kit] Surface component. If you use a subheader, then you should add a header`);
60
60
  }
61
- return (React.createElement(overridesMap.Container, Object.assign({}, nativeProps, { inline: inline, noPadding: noPadding, ref: ref }),
62
- hasHeader && React.createElement(overridesMap.Header, { noPadding: noPadding }, header),
63
- hasSubheader && (React.createElement(overridesMap.Subheader, { noPadding: noPadding }, subheader)),
64
- React.createElement(overridesMap.Content, { noPadding: noPadding }, children),
65
- hasFooter && React.createElement(overridesMap.Footer, { noPadding: noPadding }, footer)));
61
+ return (React.createElement(overridesMap.Container, Object.assign({}, nativeProps, { inline: inline, noPadding: noPadding, rounded: rounded, ref: ref }),
62
+ hasHeader && (React.createElement(overridesMap.Header, { noPadding: noPadding, rounded: rounded }, header)),
63
+ hasSubheader && (React.createElement(overridesMap.Subheader, { noPadding: noPadding, rounded: rounded }, subheader)),
64
+ React.createElement(overridesMap.Content, { noPadding: noPadding, rounded: rounded }, children),
65
+ hasFooter && (React.createElement(overridesMap.Footer, { noPadding: noPadding, rounded: rounded }, footer))));
66
66
  };
67
67
  exports.default = React.forwardRef(Surface);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@via-profit/ui-kit",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "UI Kit",
5
5
  "repository": {
6
6
  "type": "git",