@bouku/core 0.4.5 → 0.4.6

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.
@@ -13,7 +13,7 @@ export function CheckBox({ size, label, value: isChecked, update, disabled = fal
13
13
  const getStyle = tv({
14
14
  slots: {
15
15
  container: "items-center",
16
- box: "flex justify-center items-center hover:bg-accent border rounded border-outline duration-200 cursor-pointer",
16
+ box: "flex justify-center items-center bg-input hover:bg-input-light border rounded border-outline duration-200 cursor-pointer",
17
17
  check: "text-background",
18
18
  label: "text-primary-dark"
19
19
  },
@@ -34,7 +34,7 @@ const getStyle = tv({
34
34
  },
35
35
  active: {
36
36
  true: {
37
- box: "bg-accent"
37
+ box: "bg-accent!"
38
38
  }
39
39
  }
40
40
  },
@@ -4,6 +4,7 @@ import { CheckBox } from "../miscellaneous/checkbox/index.js";
4
4
  import { Actions } from "./actions.js";
5
5
  import CheckCircle from "../../assets/icons/check-circle.svg";
6
6
  import XCircle from "../../assets/icons/x-circle.svg";
7
+ import { parseDate } from "./utils/date.js";
7
8
  export const isDateLike = (val) => !isNaN(Date.parse(val)) && isNaN(Number(val));
8
9
  export const TableRow = ({ columns, data, actions, count, selected, toggleSelected }) => (_jsxs(RowBox, { style: s.container, children: [toggleSelected && (_jsx(RowBox, { style: s.selection, children: _jsx(CheckBox, { size: "sm", value: selected ?? false, update: toggleSelected }) })), columns.map(({ key, format }, i) => {
9
10
  const rawValue = data[key];
@@ -11,10 +12,8 @@ export const TableRow = ({ columns, data, actions, count, selected, toggleSelect
11
12
  ? 0
12
13
  : (data[key] ?? "-");
13
14
  let cellValue = value;
14
- if (format === "date" &&
15
- isDateLike(value.toString())) {
16
- cellValue = new Date(cellValue.toString()).toLocaleDateString();
17
- }
15
+ if (format === "date" && isDateLike(value.toString()))
16
+ cellValue = parseDate(value).toLocaleDateString();
18
17
  return (_jsx(RowBox, { style: cn(s.cell, i === 0 && "justify-start"), children: _jsx("span", { className: "truncate", children: value === true
19
18
  ? _jsx(CheckCircle, { className: "text-success" })
20
19
  : value === false
@@ -1,9 +1,10 @@
1
+ import { parseDate } from "./date.js";
1
2
  export function formatCellValue(value, format) {
2
3
  if (value == null) {
3
4
  return "";
4
5
  }
5
6
  if (format === "date") {
6
- return new Date(String(value)).toLocaleDateString();
7
+ return parseDate(String(value)).toLocaleDateString();
7
8
  }
8
9
  return String(value);
9
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bouku/core",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "main": "./dist/index.js",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",