@divayth/brick-ui 0.4.0 → 0.5.0
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/dist/index.js +4 -4
- package/dist/lib/cn.d.ts +3 -0
- package/dist/lib/cn.d.ts.map +1 -0
- package/dist/lib/cn.js +8 -0
- package/dist/styles.css +1 -1
- package/dist/ui/Accordion/Accordion.d.ts +8 -6
- package/dist/ui/Accordion/Accordion.d.ts.map +1 -1
- package/dist/ui/Accordion/Accordion.js +32 -39
- package/dist/ui/Accordion/Accordion.module.css.js +9 -9
- package/dist/ui/Accordion/index.d.ts +2 -0
- package/dist/ui/Accordion/index.d.ts.map +1 -0
- package/dist/ui/Alert/Alert.d.ts +27 -4
- package/dist/ui/Alert/Alert.d.ts.map +1 -1
- package/dist/ui/Alert/Alert.js +27 -26
- package/dist/ui/Alert/index.d.ts +2 -0
- package/dist/ui/Alert/index.d.ts.map +1 -0
- package/dist/ui/Button/Button.d.ts.map +1 -1
- package/dist/ui/Button/Button.js +53 -59
- package/dist/ui/Button/Button.module.css.js +24 -30
- package/dist/ui/Button/index.d.ts +2 -0
- package/dist/ui/Button/index.d.ts.map +1 -0
- package/dist/ui/Card/Card.d.ts +1 -1
- package/dist/ui/Card/Card.d.ts.map +1 -1
- package/dist/ui/Card/Card.js +9 -15
- package/dist/ui/Card/Card.module.css.js +6 -4
- package/dist/ui/Card/index.d.ts +2 -0
- package/dist/ui/Card/index.d.ts.map +1 -0
- package/dist/ui/Chip/Chip.d.ts +2 -2
- package/dist/ui/Chip/Chip.d.ts.map +1 -1
- package/dist/ui/Chip/Chip.js +28 -37
- package/dist/ui/Chip/Chip.module.css.js +18 -18
- package/dist/ui/Chip/index.d.ts +2 -0
- package/dist/ui/Chip/index.d.ts.map +1 -0
- package/dist/ui/Modal/Modal.d.ts +1 -1
- package/dist/ui/Modal/Modal.d.ts.map +1 -1
- package/dist/ui/MultipleChip/MultipleChip.d.ts.map +1 -1
- package/dist/ui/MultipleChip/MultipleChip.js +38 -51
- package/dist/ui/MultipleChip/index.d.ts +2 -0
- package/dist/ui/MultipleChip/index.d.ts.map +1 -0
- package/dist/ui/Select/Select.types.d.ts +2 -0
- package/dist/ui/Select/Select.types.d.ts.map +1 -1
- package/dist/ui/Select/SelectControl.d.ts +1 -1
- package/dist/ui/Select/SelectControl.d.ts.map +1 -1
- package/dist/ui/Select/SelectControl.js +33 -31
- package/dist/ui/Select/SelectOptions.d.ts +1 -1
- package/dist/ui/Select/SelectOptions.d.ts.map +1 -1
- package/dist/ui/Select/SelectOptions.js +28 -27
- package/dist/ui/{table → Table}/Table.context.d.ts.map +1 -1
- package/dist/ui/{table → Table}/Table.d.ts.map +1 -1
- package/dist/ui/{table → Table}/Table.types.d.ts +1 -0
- package/dist/ui/{table → Table}/Table.types.d.ts.map +1 -1
- package/dist/ui/{table → Table}/components/content/TableContent.d.ts.map +1 -1
- package/dist/ui/Table/components/content/TableContent.js +72 -0
- package/dist/ui/{table → Table}/components/content/cell/Cell.d.ts.map +1 -1
- package/dist/ui/{table → Table}/components/content/cellcheckbox/CellCheckbox.d.ts.map +1 -1
- package/dist/ui/{table → Table}/components/content/datarow/DataRow.d.ts.map +1 -1
- package/dist/ui/{table → Table}/components/content/head/TableHead.d.ts.map +1 -1
- package/dist/ui/{table → Table}/components/content/headercell/HeaderCell.d.ts.map +1 -1
- package/dist/ui/{table → Table}/components/content/headercell/HeaderCell.js +15 -15
- package/dist/ui/{table → Table}/components/content/headercell/HeaderCell.module.css.js +2 -2
- package/dist/ui/{table → Table}/components/content/headercellcheckbox/HeaderCellCheckbox.d.ts.map +1 -1
- package/dist/ui/{table → Table}/components/content/tablebody/TableBody.d.ts.map +1 -1
- package/dist/ui/{table → Table}/components/pagination/TablePagination.d.ts.map +1 -1
- package/dist/ui/{table → Table}/components/root/TableRoot.d.ts +1 -1
- package/dist/ui/{table → Table}/components/root/TableRoot.d.ts.map +1 -1
- package/dist/ui/Table/components/root/TableRoot.js +30 -0
- package/dist/ui/Table/hooks/useSelected.d.ts.map +1 -0
- package/dist/ui/{table → Table}/index.d.ts.map +1 -1
- package/dist/ui/index.d.ts +8 -8
- package/dist/ui/index.d.ts.map +1 -1
- package/package.json +9 -3
- package/dist/ui/table/components/content/TableContent.js +0 -67
- package/dist/ui/table/components/root/TableRoot.js +0 -28
- package/dist/ui/table/hooks/useSelected.d.ts.map +0 -1
- /package/dist/ui/{table → Table}/Table.context.d.ts +0 -0
- /package/dist/ui/{table → Table}/Table.context.js +0 -0
- /package/dist/ui/{table → Table}/Table.d.ts +0 -0
- /package/dist/ui/{table → Table}/Table.js +0 -0
- /package/dist/ui/{table → Table}/Table.types.js +0 -0
- /package/dist/ui/{table → Table}/components/content/TableContent.d.ts +0 -0
- /package/dist/ui/{table → Table}/components/content/TableContent.module.css.js +0 -0
- /package/dist/ui/{table → Table}/components/content/cell/Cell.d.ts +0 -0
- /package/dist/ui/{table → Table}/components/content/cell/Cell.js +0 -0
- /package/dist/ui/{table → Table}/components/content/cell/Cell.module.css.js +0 -0
- /package/dist/ui/{table → Table}/components/content/cellcheckbox/CellCheckbox.d.ts +0 -0
- /package/dist/ui/{table → Table}/components/content/cellcheckbox/CellCheckbox.js +0 -0
- /package/dist/ui/{table → Table}/components/content/datarow/DataRow.d.ts +0 -0
- /package/dist/ui/{table → Table}/components/content/datarow/DataRow.js +0 -0
- /package/dist/ui/{table → Table}/components/content/head/TableHead.d.ts +0 -0
- /package/dist/ui/{table → Table}/components/content/head/TableHead.js +0 -0
- /package/dist/ui/{table → Table}/components/content/head/TableHead.module.css.js +0 -0
- /package/dist/ui/{table → Table}/components/content/headercell/HeaderCell.d.ts +0 -0
- /package/dist/ui/{table → Table}/components/content/headercellcheckbox/HeaderCellCheckbox.d.ts +0 -0
- /package/dist/ui/{table → Table}/components/content/headercellcheckbox/HeaderCellCheckbox.js +0 -0
- /package/dist/ui/{table → Table}/components/content/tablebody/TableBody.d.ts +0 -0
- /package/dist/ui/{table → Table}/components/content/tablebody/TableBody.js +0 -0
- /package/dist/ui/{table → Table}/components/pagination/TablePagination.d.ts +0 -0
- /package/dist/ui/{table → Table}/components/pagination/TablePagination.js +0 -0
- /package/dist/ui/{table → Table}/components/root/TableRoot.module.css.js +0 -0
- /package/dist/ui/{table → Table}/hooks/useSelected.d.ts +0 -0
- /package/dist/ui/{table → Table}/hooks/useSelected.js +0 -0
- /package/dist/ui/{table → Table}/index.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@divayth/brick-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "React components for Brick UI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -25,7 +25,9 @@
|
|
|
25
25
|
"build-storybook": "storybook build",
|
|
26
26
|
"prepack": "npm run build",
|
|
27
27
|
"lint": "eslint .",
|
|
28
|
-
"lint:fix": "eslint . --fix"
|
|
28
|
+
"lint:fix": "eslint . --fix",
|
|
29
|
+
"test": "vitest run",
|
|
30
|
+
"test:coverage": "vitest run --coverage"
|
|
29
31
|
},
|
|
30
32
|
"peerDependencies": {
|
|
31
33
|
"react": "^19.0.0",
|
|
@@ -46,6 +48,7 @@
|
|
|
46
48
|
"@eslint/js": "^9.39.5",
|
|
47
49
|
"@fontsource-variable/inter": "^5.3.0",
|
|
48
50
|
"@storybook/addon-docs": "^10.6.1",
|
|
51
|
+
"@storybook/addon-vitest": "^10.6.1",
|
|
49
52
|
"@storybook/react-vite": "^10.6.1",
|
|
50
53
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
51
54
|
"@tailwindcss/vite": "^4.0.0",
|
|
@@ -54,12 +57,14 @@
|
|
|
54
57
|
"@types/react": "^19.0.0",
|
|
55
58
|
"@types/react-dom": "^19.0.0",
|
|
56
59
|
"@vitejs/plugin-react": "^5.0.0",
|
|
60
|
+
"@vitest/coverage-v8": "^5.1.0",
|
|
57
61
|
"eslint": "^9.39.5",
|
|
58
62
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
59
63
|
"eslint-plugin-react": "^7.37.5",
|
|
60
64
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
61
65
|
"eslint-plugin-simple-import-sort": "^13.0.0",
|
|
62
66
|
"globals": "^16.5.0",
|
|
67
|
+
"jsdom": "^27.4.0",
|
|
63
68
|
"react": "^19.0.0",
|
|
64
69
|
"react-dom": "^19.0.0",
|
|
65
70
|
"rollup-plugin-preserve-directives": "^0.4.0",
|
|
@@ -68,7 +73,8 @@
|
|
|
68
73
|
"tsc-alias": "^1.9.10",
|
|
69
74
|
"typescript": "^5.0.0",
|
|
70
75
|
"typescript-eslint": "^8.72.1",
|
|
71
|
-
"vite": "^7.0.0"
|
|
76
|
+
"vite": "^7.0.0",
|
|
77
|
+
"vitest": "^5.1.0"
|
|
72
78
|
},
|
|
73
79
|
"publishConfig": {
|
|
74
80
|
"access": "public"
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { jsx as l, jsxs as b } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as z, useState as A, useLayoutEffect as B } from "react";
|
|
3
|
-
import C from "clsx";
|
|
4
|
-
import { TableHead as E } from "./head/TableHead.js";
|
|
5
|
-
import { HeaderCell as W } from "./headercell/HeaderCell.js";
|
|
6
|
-
import { HeaderCellCheckbox as k } from "./headercellcheckbox/HeaderCellCheckbox.js";
|
|
7
|
-
import { TableBody as O } from "./tablebody/TableBody.js";
|
|
8
|
-
import w from "./TableContent.module.css.js";
|
|
9
|
-
const P = ({
|
|
10
|
-
scrollable: x = !1,
|
|
11
|
-
sticky: H = !0,
|
|
12
|
-
withHeader: L = !0,
|
|
13
|
-
columns: a,
|
|
14
|
-
sorting: v,
|
|
15
|
-
selectedKey: n,
|
|
16
|
-
...t
|
|
17
|
-
}) => {
|
|
18
|
-
const { data: m } = t, { sort: R, onSortChange: S } = v ?? {}, y = m.length === 0, N = t.isLoading || y, u = z(null), [g, T] = A([]), d = t.isLoading && g.length === a.length + +!!n;
|
|
19
|
-
return B(() => {
|
|
20
|
-
const o = u.current;
|
|
21
|
-
if (!o || t.isLoading) return;
|
|
22
|
-
const r = () => {
|
|
23
|
-
const i = Array.from(o.tHead?.rows[0]?.cells ?? []).map((e) => e.getBoundingClientRect().width), p = i.reduce((e, h) => e + h, 0);
|
|
24
|
-
if (!p) return;
|
|
25
|
-
const f = i.map((e) => e / p * 100);
|
|
26
|
-
T(
|
|
27
|
-
(e) => e.length === f.length && e.every((h, j) => h === f[j]) ? e : f
|
|
28
|
-
);
|
|
29
|
-
};
|
|
30
|
-
r();
|
|
31
|
-
const c = new ResizeObserver(r);
|
|
32
|
-
for (const s of Array.from(o.tHead?.rows[0]?.cells ?? []))
|
|
33
|
-
c.observe(s);
|
|
34
|
-
return () => c.disconnect();
|
|
35
|
-
}, [m, a, n, t.isLoading]), /* @__PURE__ */ l("div", { className: C(w.root, { [w.scrollable]: x }), children: /* @__PURE__ */ b(
|
|
36
|
-
"table",
|
|
37
|
-
{
|
|
38
|
-
ref: u,
|
|
39
|
-
className: C("w-full border-collapse", {
|
|
40
|
-
"h-full": N,
|
|
41
|
-
"table-fixed": d
|
|
42
|
-
}),
|
|
43
|
-
children: [
|
|
44
|
-
d && /* @__PURE__ */ l("colgroup", { children: g.map((o, r) => /* @__PURE__ */ l("col", { style: { width: `${o}%` } }, r)) }),
|
|
45
|
-
L && /* @__PURE__ */ b(E, { sticky: H, children: [
|
|
46
|
-
!!n && /* @__PURE__ */ l(k, { data: m, selectedKey: n }),
|
|
47
|
-
a.map(({ key: o, label: r, sortKey: c, style: s, align: i }) => /* @__PURE__ */ l(
|
|
48
|
-
W,
|
|
49
|
-
{
|
|
50
|
-
sort: R,
|
|
51
|
-
onSortChange: S,
|
|
52
|
-
sortKey: c,
|
|
53
|
-
style: d ? { ...s, width: void 0 } : s,
|
|
54
|
-
align: i,
|
|
55
|
-
children: r
|
|
56
|
-
},
|
|
57
|
-
String(o)
|
|
58
|
-
))
|
|
59
|
-
] }),
|
|
60
|
-
/* @__PURE__ */ l(O, { columns: a, selectedKey: n, ...t })
|
|
61
|
-
]
|
|
62
|
-
}
|
|
63
|
-
) });
|
|
64
|
-
};
|
|
65
|
-
export {
|
|
66
|
-
P as TableContent
|
|
67
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
3
|
-
import c from "clsx";
|
|
4
|
-
import { TableContent as i } from "../content/TableContent.js";
|
|
5
|
-
import { TablePagination as n } from "../pagination/TablePagination.js";
|
|
6
|
-
import s from "./TableRoot.module.css.js";
|
|
7
|
-
const x = ({
|
|
8
|
-
maxHeight: o = "100%",
|
|
9
|
-
withBorder: l = !0,
|
|
10
|
-
pagination: r,
|
|
11
|
-
...m
|
|
12
|
-
}) => {
|
|
13
|
-
const t = o !== "auto";
|
|
14
|
-
return /* @__PURE__ */ a(
|
|
15
|
-
"div",
|
|
16
|
-
{
|
|
17
|
-
className: c(s.root, { [s.borderless]: !l }),
|
|
18
|
-
style: { height: t ? "100%" : "auto", maxHeight: o },
|
|
19
|
-
children: [
|
|
20
|
-
/* @__PURE__ */ e(i, { scrollable: t, ...m }),
|
|
21
|
-
r && /* @__PURE__ */ e(n, { ...r })
|
|
22
|
-
]
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
};
|
|
26
|
-
export {
|
|
27
|
-
x as TableRoot
|
|
28
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSelected.d.ts","sourceRoot":"","sources":["../../../../src/ui/table/hooks/useSelected.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,8DAA0B,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/ui/{table → Table}/components/content/headercellcheckbox/HeaderCellCheckbox.d.ts
RENAMED
|
File without changes
|
/package/dist/ui/{table → Table}/components/content/headercellcheckbox/HeaderCellCheckbox.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|