@uni-design-system/uni-react 0.0.10 → 0.0.12

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.
@@ -1,13 +1,14 @@
1
- import { ReactNode } from 'react';
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
2
  import { ContainerColorToken, ShadowElevation, Size } from '@uni-design-system/uni-core';
3
+ import { Property } from 'csstype';
3
4
  export type CardType = 'elevated' | 'filled' | 'outlined';
4
- export interface CardProps {
5
+ export interface CardProps extends HTMLAttributes<HTMLDivElement> {
5
6
  children?: ReactNode;
6
7
  cardType?: CardType;
7
8
  colorToken?: ContainerColorToken;
8
9
  elevation?: ShadowElevation;
9
- width?: number;
10
- height?: number | string | undefined;
10
+ width?: Property.Width<number | string>;
11
+ height?: Property.Height<number | string>;
11
12
  borderRadius?: Size | 'none';
12
13
  }
13
- export declare function Card({ children, cardType, elevation, colorToken, width, height, borderRadius, }: CardProps): JSX.Element;
14
+ export declare function Card({ children, cardType, elevation, colorToken, width, height, borderRadius, style, ...rest }: CardProps): JSX.Element;
@@ -1,4 +1,15 @@
1
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
+ };
2
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
15
  };
@@ -6,17 +17,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
17
  exports.Card = void 0;
7
18
  const react_1 = __importDefault(require("react"));
8
19
  const core_1 = require("../../core");
9
- function Card({ children, cardType, elevation, colorToken = 'primary-container', width, height, borderRadius, }) {
20
+ function Card(_a) {
21
+ var { children, cardType, elevation, colorToken = 'surface', width, height, borderRadius, style } = _a, rest = __rest(_a, ["children", "cardType", "elevation", "colorToken", "width", "height", "borderRadius", "style"]);
10
22
  const { colors, containers } = (0, core_1.useTheme)();
11
23
  const { borderRadii } = containers.card;
12
- const style = Object.assign({ height,
13
- width, backgroundColor: colors[colorToken || 'surface'], color: colors[`on-${colorToken}` || 'on-surface'] }, (0, core_1.Padding)('md', 'all'));
24
+ const styles = Object.assign(Object.assign({ height,
25
+ width, backgroundColor: colors[colorToken || 'surface'], color: colors[`on-${colorToken}` || 'on-surface'] }, (0, core_1.Padding)('md', 'all')), style);
14
26
  if (cardType === 'elevated') {
15
- style.boxShadow = (0, core_1.BoxShadow)(elevation || 'raised');
27
+ styles.boxShadow = (0, core_1.BoxShadow)(elevation || 'raised');
16
28
  }
17
29
  if (borderRadii && borderRadius !== 'none') {
18
- style.borderRadius = borderRadii[borderRadius || 'md'];
30
+ styles.borderRadius = borderRadii[borderRadius || 'md'];
19
31
  }
20
- return react_1.default.createElement("div", { style: style }, children);
32
+ return (react_1.default.createElement("div", Object.assign({ style: styles }, rest), children));
21
33
  }
22
34
  exports.Card = Card;
@@ -0,0 +1,2 @@
1
+ export * from './image.component';
2
+ export * from './image.model';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./image.component"), exports);
18
+ __exportStar(require("./image.model"), exports);
@@ -1,11 +1,12 @@
1
- export * from './theme';
2
1
  export * from './border';
2
+ export * from './container';
3
3
  export * from './flex';
4
+ export * from './hooks';
4
5
  export * from './icon';
6
+ export * from './image';
5
7
  export * from './layout';
6
- export * from './container';
8
+ export * from './overlay';
7
9
  export * from './padding';
8
10
  export * from './shadow';
9
11
  export * from './text';
10
- export * from './overlay';
11
- export * from './hooks';
12
+ export * from './theme';
@@ -14,14 +14,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./theme"), exports);
18
17
  __exportStar(require("./border"), exports);
18
+ __exportStar(require("./container"), exports);
19
19
  __exportStar(require("./flex"), exports);
20
+ __exportStar(require("./hooks"), exports);
20
21
  __exportStar(require("./icon"), exports);
22
+ __exportStar(require("./image"), exports);
21
23
  __exportStar(require("./layout"), exports);
22
- __exportStar(require("./container"), exports);
24
+ __exportStar(require("./overlay"), exports);
23
25
  __exportStar(require("./padding"), exports);
24
26
  __exportStar(require("./shadow"), exports);
25
27
  __exportStar(require("./text"), exports);
26
- __exportStar(require("./overlay"), exports);
27
- __exportStar(require("./hooks"), exports);
28
+ __exportStar(require("./theme"), exports);
@@ -1,13 +1,14 @@
1
- import { ReactNode } from 'react';
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
2
  import { ContainerColorToken, ShadowElevation, Size } from '@uni-design-system/uni-core';
3
+ import { Property } from 'csstype';
3
4
  export type CardType = 'elevated' | 'filled' | 'outlined';
4
- export interface CardProps {
5
+ export interface CardProps extends HTMLAttributes<HTMLDivElement> {
5
6
  children?: ReactNode;
6
7
  cardType?: CardType;
7
8
  colorToken?: ContainerColorToken;
8
9
  elevation?: ShadowElevation;
9
- width?: number;
10
- height?: number | string | undefined;
10
+ width?: Property.Width<number | string>;
11
+ height?: Property.Height<number | string>;
11
12
  borderRadius?: Size | 'none';
12
13
  }
13
- export declare function Card({ children, cardType, elevation, colorToken, width, height, borderRadius, }: CardProps): JSX.Element;
14
+ export declare function Card({ children, cardType, elevation, colorToken, width, height, borderRadius, style, ...rest }: CardProps): JSX.Element;
@@ -1,15 +1,27 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
1
12
  import React from 'react';
2
13
  import { BoxShadow, Padding, useTheme } from '../../core';
3
- export function Card({ children, cardType, elevation, colorToken = 'primary-container', width, height, borderRadius, }) {
14
+ export function Card(_a) {
15
+ var { children, cardType, elevation, colorToken = 'surface', width, height, borderRadius, style } = _a, rest = __rest(_a, ["children", "cardType", "elevation", "colorToken", "width", "height", "borderRadius", "style"]);
4
16
  const { colors, containers } = useTheme();
5
17
  const { borderRadii } = containers.card;
6
- const style = Object.assign({ height,
7
- width, backgroundColor: colors[colorToken || 'surface'], color: colors[`on-${colorToken}` || 'on-surface'] }, Padding('md', 'all'));
18
+ const styles = Object.assign(Object.assign({ height,
19
+ width, backgroundColor: colors[colorToken || 'surface'], color: colors[`on-${colorToken}` || 'on-surface'] }, Padding('md', 'all')), style);
8
20
  if (cardType === 'elevated') {
9
- style.boxShadow = BoxShadow(elevation || 'raised');
21
+ styles.boxShadow = BoxShadow(elevation || 'raised');
10
22
  }
11
23
  if (borderRadii && borderRadius !== 'none') {
12
- style.borderRadius = borderRadii[borderRadius || 'md'];
24
+ styles.borderRadius = borderRadii[borderRadius || 'md'];
13
25
  }
14
- return React.createElement("div", { style: style }, children);
26
+ return (React.createElement("div", Object.assign({ style: styles }, rest), children));
15
27
  }
@@ -0,0 +1,2 @@
1
+ export * from './image.component';
2
+ export * from './image.model';
@@ -0,0 +1,2 @@
1
+ export * from './image.component';
2
+ export * from './image.model';
@@ -1,11 +1,12 @@
1
- export * from './theme';
2
1
  export * from './border';
2
+ export * from './container';
3
3
  export * from './flex';
4
+ export * from './hooks';
4
5
  export * from './icon';
6
+ export * from './image';
5
7
  export * from './layout';
6
- export * from './container';
8
+ export * from './overlay';
7
9
  export * from './padding';
8
10
  export * from './shadow';
9
11
  export * from './text';
10
- export * from './overlay';
11
- export * from './hooks';
12
+ export * from './theme';
@@ -1,11 +1,12 @@
1
- export * from './theme';
2
1
  export * from './border';
2
+ export * from './container';
3
3
  export * from './flex';
4
+ export * from './hooks';
4
5
  export * from './icon';
6
+ export * from './image';
5
7
  export * from './layout';
6
- export * from './container';
8
+ export * from './overlay';
7
9
  export * from './padding';
8
10
  export * from './shadow';
9
11
  export * from './text';
10
- export * from './overlay';
11
- export * from './hooks';
12
+ export * from './theme';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uni-design-system/uni-react",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "React component library for the UNI Design System.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",