@bouku/core 0.1.4 → 0.1.5

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,7 +1,8 @@
1
1
  type Props = {
2
2
  label: string;
3
- value: string | number;
3
+ value?: string | number | null;
4
+ units?: string;
4
5
  note?: string;
5
6
  };
6
- export declare const Card: ({ label, value, note }: Props) => import("react").JSX.Element;
7
+ export declare const Card: ({ label, value, units, note }: Props) => import("react").JSX.Element;
7
8
  export default Card;
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Card = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const flex_1 = require("../layout/flex");
6
- const Card = ({ label, value, note }) => ((0, jsx_runtime_1.jsxs)(flex_1.ColumnBox, { style: s.card, children: [(0, jsx_runtime_1.jsx)("span", { className: s.label, children: label }), (0, jsx_runtime_1.jsx)("span", { className: s.value, children: formatValue(value) }), (0, jsx_runtime_1.jsx)("span", { className: s.note, children: note })] }));
6
+ const Card = ({ label, value, units, note }) => ((0, jsx_runtime_1.jsxs)(flex_1.ColumnBox, { style: s.card, children: [(0, jsx_runtime_1.jsx)("span", { className: s.label, children: label }), (0, jsx_runtime_1.jsxs)("span", { className: s.value, children: [formatValue(value), " ", units] }), (0, jsx_runtime_1.jsx)("span", { className: s.note, children: note })] }));
7
7
  exports.Card = Card;
8
8
  const formatValue = (x) => {
9
+ if (!x)
10
+ return "N/A";
9
11
  if (typeof x === "string")
10
12
  return x;
11
13
  else if (typeof x === "number")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bouku/core",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "MIT",