@blencm/ui 0.0.1 → 0.0.3
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/README.md +22 -68
- package/dist/index.cjs +78 -91
- package/dist/index.js +78 -91
- package/dist/shared/data-table.d.ts +2 -1
- package/dist/style.css +15 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
# @blencm/ui
|
|
2
2
|
|
|
3
|
-
**Accessible
|
|
3
|
+
**Accessible React components on Radix UI and Tailwind CSS.**
|
|
4
4
|
|
|
5
|
-
Install the package, import
|
|
6
|
-
No copying components into `src/components`, no manual setup, and no duplicated UI code across projects.
|
|
7
|
-
|
|
8
|
-
## Documentation & Live Components
|
|
9
|
-
|
|
10
|
-
**Explore all components, live examples, and copy the demo code:**
|
|
5
|
+
Install the package, import a component, and start. No copy-paste into `src/components`.
|
|
11
6
|
|
|
12
7
|
View components [here](https://ui.blencm.com).
|
|
13
8
|
|
|
@@ -15,24 +10,25 @@ View components [here](https://ui.blencm.com).
|
|
|
15
10
|
|
|
16
11
|
## Installation
|
|
17
12
|
|
|
18
|
-
Install the package with your preferred package manager:
|
|
19
|
-
|
|
20
13
|
```bash
|
|
21
14
|
pnpm add @blencm/ui
|
|
22
15
|
```
|
|
23
16
|
|
|
24
|
-
|
|
17
|
+
```bash
|
|
18
|
+
npm install @blencm/ui
|
|
19
|
+
```
|
|
25
20
|
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
react-dom >=17 <21
|
|
21
|
+
```bash
|
|
22
|
+
yarn add @blencm/ui
|
|
29
23
|
```
|
|
30
24
|
|
|
25
|
+
React and React DOM are peer dependencies (`>=17`).
|
|
26
|
+
|
|
31
27
|
---
|
|
32
28
|
|
|
33
|
-
##
|
|
29
|
+
## Usage
|
|
34
30
|
|
|
35
|
-
|
|
31
|
+
Styles, theme tokens, and the CSS reset load with the package.
|
|
36
32
|
|
|
37
33
|
```tsx
|
|
38
34
|
import { Button } from '@blencm/ui';
|
|
@@ -47,82 +43,40 @@ export function Example() {
|
|
|
47
43
|
}
|
|
48
44
|
```
|
|
49
45
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
---
|
|
53
|
-
|
|
54
|
-
## Styles
|
|
55
|
-
|
|
56
|
-
In most setups, styles are loaded automatically.
|
|
57
|
-
|
|
58
|
-
If your bundler does not process CSS side-effect imports, import the stylesheet manually:
|
|
46
|
+
If your bundler does not follow CSS side-effect imports:
|
|
59
47
|
|
|
60
48
|
```tsx
|
|
61
49
|
import '@blencm/ui/style.css';
|
|
62
50
|
```
|
|
63
51
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
Dark mode is controlled by adding the `dark` class to an ancestor element, typically `<html>`:
|
|
52
|
+
Dark mode follows a `dark` class on an ancestor:
|
|
67
53
|
|
|
68
54
|
```html
|
|
69
55
|
<html class="dark">
|
|
56
|
+
<body><!-- app --></body>
|
|
57
|
+
</html>
|
|
70
58
|
```
|
|
71
59
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
Customize the design system by overriding CSS variables in your application.
|
|
75
|
-
|
|
76
|
-
For example:
|
|
60
|
+
Override CSS variables in your app:
|
|
77
61
|
|
|
78
62
|
```css
|
|
79
63
|
:root {
|
|
80
|
-
--primary:
|
|
81
|
-
--
|
|
64
|
+
--primary: oklch(0.205 0 0);
|
|
65
|
+
--primary-foreground: oklch(0.985 0 0);
|
|
66
|
+
--radius: 0.625rem;
|
|
82
67
|
}
|
|
83
68
|
```
|
|
84
69
|
|
|
85
|
-
This allows you to adapt colors, border radius, and other theme tokens without modifying the library itself.
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
## Why @blencm/ui?
|
|
90
|
-
|
|
91
|
-
`@blencm/ui` is designed for teams and developers who want a consistent component system without maintaining a local copy of every UI component.
|
|
92
|
-
|
|
93
|
-
* **Accessible by default** — built on top of Radix UI primitives.
|
|
94
|
-
* **Reusable** — install once and use across multiple React projects.
|
|
95
|
-
* **Tailwind CSS friendly** — designed to work naturally with utility-first styling.
|
|
96
|
-
* **Themeable** — customize the appearance through CSS variables.
|
|
97
|
-
* **Dark mode ready** — supports class-based dark mode.
|
|
98
|
-
* **TypeScript friendly** — designed for modern React and TypeScript applications.
|
|
99
|
-
* **No copy-paste workflow** — components are imported directly from the package.
|
|
100
|
-
|
|
101
70
|
---
|
|
102
71
|
|
|
103
72
|
## Sponsor
|
|
104
73
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
**[MultiBase Studio](https://multibasestudio.com/)** is a cross-platform desktop database client for **SQL, NoSQL, and cloud databases**.
|
|
108
|
-
|
|
109
|
-
Connect to PostgreSQL, MySQL, MongoDB, Redis, SQLite, and **40+ database engines** from a single application.
|
|
110
|
-
|
|
111
|
-
With MultiBase Studio you can:
|
|
112
|
-
|
|
113
|
-
* Write queries with autocomplete
|
|
114
|
-
* Explore databases, tables, collections, and schemas
|
|
115
|
-
* Browse and edit data
|
|
116
|
-
* Manage multiple database connections
|
|
117
|
-
* Run backups
|
|
118
|
-
* Work across different database engines without switching tools
|
|
119
|
-
|
|
120
|
-
Available for **Windows, macOS, and Linux**.
|
|
74
|
+
**[MultiBase Studio](https://multibasestudio.com/)** is a desktop client for SQL, NoSQL, and cloud databases. Connect PostgreSQL, MySQL, MongoDB, Redis, SQLite, and 40+ engines from one app — query with autocomplete, explore schemas, edit data, and run backups without switching tools.
|
|
121
75
|
|
|
122
|
-
The
|
|
76
|
+
Available on Windows, macOS, and Linux. The [free plan](https://multibasestudio.com/) does not expire and does not require a credit card.
|
|
123
77
|
|
|
124
78
|
---
|
|
125
79
|
|
|
126
80
|
## License
|
|
127
81
|
|
|
128
|
-
|
|
82
|
+
[MIT](./LICENSE) · [GitHub](https://github.com/blencm/ui)
|
package/dist/index.cjs
CHANGED
|
@@ -6682,7 +6682,7 @@ function SearchableSelectBase({
|
|
|
6682
6682
|
"button",
|
|
6683
6683
|
{
|
|
6684
6684
|
type: "button",
|
|
6685
|
-
"aria-label": "
|
|
6685
|
+
"aria-label": "Clear search",
|
|
6686
6686
|
tabIndex: -1,
|
|
6687
6687
|
onPointerDown: (event) => {
|
|
6688
6688
|
event.preventDefault();
|
|
@@ -8185,7 +8185,7 @@ function capitalize(value) {
|
|
|
8185
8185
|
}
|
|
8186
8186
|
function UiDate({
|
|
8187
8187
|
label,
|
|
8188
|
-
placeholder = "
|
|
8188
|
+
placeholder = "Select a date",
|
|
8189
8189
|
value,
|
|
8190
8190
|
defaultMonth,
|
|
8191
8191
|
onChange,
|
|
@@ -8489,7 +8489,7 @@ function UiDate({
|
|
|
8489
8489
|
}),
|
|
8490
8490
|
"h-8 w-8 shrink-0 rounded-lg text-muted-foreground hover:text-foreground disabled:opacity-30"
|
|
8491
8491
|
),
|
|
8492
|
-
"aria-label": "
|
|
8492
|
+
"aria-label": "Previous month",
|
|
8493
8493
|
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react8.ChevronLeftIcon, { className: "h-4 w-4" })
|
|
8494
8494
|
}
|
|
8495
8495
|
),
|
|
@@ -8502,7 +8502,7 @@ function UiDate({
|
|
|
8502
8502
|
items: monthOptions,
|
|
8503
8503
|
disabled: Boolean(disabled),
|
|
8504
8504
|
size: "sm",
|
|
8505
|
-
placeholder: "
|
|
8505
|
+
placeholder: "Month",
|
|
8506
8506
|
selectClassName: "space-y-0",
|
|
8507
8507
|
className: dateHeaderSelectTriggerClassName,
|
|
8508
8508
|
contentClassName: dateHeaderSelectContentClassName,
|
|
@@ -8519,7 +8519,7 @@ function UiDate({
|
|
|
8519
8519
|
items: yearOptions,
|
|
8520
8520
|
disabled: Boolean(disabled),
|
|
8521
8521
|
size: "sm",
|
|
8522
|
-
placeholder: "
|
|
8522
|
+
placeholder: "Year",
|
|
8523
8523
|
selectClassName: "space-y-0",
|
|
8524
8524
|
className: dateHeaderSelectTriggerClassName,
|
|
8525
8525
|
contentClassName: dateHeaderSelectContentClassName,
|
|
@@ -8547,7 +8547,7 @@ function UiDate({
|
|
|
8547
8547
|
}),
|
|
8548
8548
|
"h-8 w-8 shrink-0 rounded-lg text-muted-foreground hover:text-foreground disabled:opacity-30"
|
|
8549
8549
|
),
|
|
8550
|
-
"aria-label": "
|
|
8550
|
+
"aria-label": "Next month",
|
|
8551
8551
|
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react8.ChevronRightIcon, { className: "h-4 w-4" })
|
|
8552
8552
|
}
|
|
8553
8553
|
)
|
|
@@ -9251,7 +9251,7 @@ function WheelArrowIndicator() {
|
|
|
9251
9251
|
}
|
|
9252
9252
|
function UiTime({
|
|
9253
9253
|
label,
|
|
9254
|
-
placeholder = "
|
|
9254
|
+
placeholder = "Select time",
|
|
9255
9255
|
value,
|
|
9256
9256
|
onChange,
|
|
9257
9257
|
onBlur,
|
|
@@ -11930,6 +11930,7 @@ function DataTable({
|
|
|
11930
11930
|
pageLabel = "Page",
|
|
11931
11931
|
isRowsSelected = true,
|
|
11932
11932
|
totalRows,
|
|
11933
|
+
totalLabel = "records",
|
|
11933
11934
|
rowsSelectedLabel = "row(s) selected",
|
|
11934
11935
|
template = "neo",
|
|
11935
11936
|
classNames,
|
|
@@ -11986,6 +11987,8 @@ function DataTable({
|
|
|
11986
11987
|
const accentOn = !!dtAccent;
|
|
11987
11988
|
const dataAccent = accentOn ? "on" : "off";
|
|
11988
11989
|
const headerIsSticky = stickyHeader && !headerScroll;
|
|
11990
|
+
const isEmpty = table.getRowModel().rows.length === 0;
|
|
11991
|
+
const emptyState = emptyData != null ? emptyData : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("p", { className: "text-muted-foreground", children: "No results." });
|
|
11989
11992
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
11990
11993
|
"div",
|
|
11991
11994
|
{
|
|
@@ -11993,89 +11996,72 @@ function DataTable({
|
|
|
11993
11996
|
className: cn(ui.root, heightClassName),
|
|
11994
11997
|
style: accentOn ? { "--dt-accent": dtAccent } : void 0,
|
|
11995
11998
|
children: [
|
|
11996
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.
|
|
11997
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.
|
|
11998
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
11999
|
-
|
|
12000
|
-
|
|
12001
|
-
|
|
12002
|
-
|
|
12003
|
-
|
|
12004
|
-
|
|
12005
|
-
|
|
12006
|
-
header.
|
|
12007
|
-
|
|
12008
|
-
|
|
12009
|
-
|
|
12010
|
-
|
|
12011
|
-
|
|
12012
|
-
|
|
12013
|
-
import_framer_motion.
|
|
12014
|
-
|
|
12015
|
-
|
|
12016
|
-
|
|
12017
|
-
|
|
12018
|
-
|
|
12019
|
-
|
|
12020
|
-
|
|
12021
|
-
|
|
12022
|
-
|
|
12023
|
-
|
|
12024
|
-
|
|
12025
|
-
|
|
12026
|
-
|
|
12027
|
-
|
|
12028
|
-
|
|
12029
|
-
|
|
12030
|
-
|
|
12031
|
-
cell.
|
|
12032
|
-
|
|
12033
|
-
|
|
12034
|
-
|
|
12035
|
-
|
|
12036
|
-
|
|
12037
|
-
|
|
12038
|
-
|
|
12039
|
-
|
|
12040
|
-
|
|
12041
|
-
|
|
12042
|
-
|
|
12043
|
-
|
|
12044
|
-
|
|
12045
|
-
|
|
12046
|
-
|
|
12047
|
-
|
|
12048
|
-
|
|
12049
|
-
|
|
12050
|
-
|
|
12051
|
-
|
|
12052
|
-
|
|
12053
|
-
|
|
12054
|
-
|
|
12055
|
-
|
|
12056
|
-
|
|
12057
|
-
|
|
12058
|
-
|
|
12059
|
-
|
|
12060
|
-
|
|
12061
|
-
|
|
12062
|
-
) }, cell.id))
|
|
12063
|
-
},
|
|
12064
|
-
row.id
|
|
12065
|
-
)) : emptyData || /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(TableRow, { "data-accent": dataAccent, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
12066
|
-
TableCell,
|
|
12067
|
-
{
|
|
12068
|
-
colSpan: columns.length,
|
|
12069
|
-
className: cn(
|
|
12070
|
-
ui.td,
|
|
12071
|
-
"text-muted-foreground h-28 text-center"
|
|
12072
|
-
),
|
|
12073
|
-
children: "No results."
|
|
12074
|
-
}
|
|
12075
|
-
) }) })
|
|
12076
|
-
] }) }),
|
|
12077
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ScrollBar, { orientation: "horizontal" })
|
|
12078
|
-
] }) }),
|
|
11999
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "relative min-h-0 flex-1", children: [
|
|
12000
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(ScrollArea, { className: "h-full", children: [
|
|
12001
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "relative w-max min-w-full", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Table, { className: cn(ui.table), children: [
|
|
12002
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(TableHeader, { className: cn(ui.thead), children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(TableRow, { className: cn(ui.trHead), children: headerGroup.headers.map((header) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
12003
|
+
TableHead,
|
|
12004
|
+
{
|
|
12005
|
+
className: cn(
|
|
12006
|
+
headerIsSticky ? cn(ui.theadSticky, "z-20") : void 0,
|
|
12007
|
+
ui.th
|
|
12008
|
+
),
|
|
12009
|
+
children: header.isPlaceholder ? null : (0, import_react_table.flexRender)(
|
|
12010
|
+
header.column.columnDef.header,
|
|
12011
|
+
header.getContext()
|
|
12012
|
+
)
|
|
12013
|
+
},
|
|
12014
|
+
header.id
|
|
12015
|
+
)) }, headerGroup.id)) }),
|
|
12016
|
+
animate ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_framer_motion.AnimatePresence, { mode: "wait", initial: false, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
12017
|
+
import_framer_motion.motion.tbody,
|
|
12018
|
+
{
|
|
12019
|
+
className: cn(ui.tbody),
|
|
12020
|
+
initial: { opacity: 0, y: 6 },
|
|
12021
|
+
animate: { opacity: 1, y: 0 },
|
|
12022
|
+
exit: { opacity: 0, y: -6 },
|
|
12023
|
+
transition: { duration: 0.18 },
|
|
12024
|
+
children: table.getRowModel().rows.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
12025
|
+
TableRow,
|
|
12026
|
+
{
|
|
12027
|
+
"data-accent": dataAccent,
|
|
12028
|
+
"data-state": row.getIsSelected() ? "selected" : void 0,
|
|
12029
|
+
onClick: () => onClick == null ? void 0 : onClick(row.original),
|
|
12030
|
+
className: cn(
|
|
12031
|
+
ui.tr,
|
|
12032
|
+
clickable ? ui.trClickable : void 0
|
|
12033
|
+
),
|
|
12034
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(TableCell, { className: cn(ui.td), children: (0, import_react_table.flexRender)(
|
|
12035
|
+
cell.column.columnDef.cell,
|
|
12036
|
+
cell.getContext()
|
|
12037
|
+
) }, cell.id))
|
|
12038
|
+
},
|
|
12039
|
+
row.id
|
|
12040
|
+
)) : null
|
|
12041
|
+
},
|
|
12042
|
+
pageKey
|
|
12043
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(TableBody, { className: cn(ui.tbody), children: table.getRowModel().rows.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
12044
|
+
TableRow,
|
|
12045
|
+
{
|
|
12046
|
+
"data-accent": dataAccent,
|
|
12047
|
+
"data-state": row.getIsSelected() ? "selected" : void 0,
|
|
12048
|
+
onClick: () => onClick == null ? void 0 : onClick(row.original),
|
|
12049
|
+
className: cn(
|
|
12050
|
+
ui.tr,
|
|
12051
|
+
clickable ? ui.trClickable : void 0
|
|
12052
|
+
),
|
|
12053
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(TableCell, { className: cn(ui.td), children: (0, import_react_table.flexRender)(
|
|
12054
|
+
cell.column.columnDef.cell,
|
|
12055
|
+
cell.getContext()
|
|
12056
|
+
) }, cell.id))
|
|
12057
|
+
},
|
|
12058
|
+
row.id
|
|
12059
|
+
)) : null })
|
|
12060
|
+
] }) }),
|
|
12061
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ScrollBar, { orientation: "horizontal" })
|
|
12062
|
+
] }),
|
|
12063
|
+
isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 top-12 z-[5] flex w-full items-center justify-center p-8", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "pointer-events-auto flex h-full w-full flex-col items-center justify-center text-center", children: emptyState }) }) : null
|
|
12064
|
+
] }),
|
|
12079
12065
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: cn(ui.footer), children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: cn(ui.footerInner), children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-[1fr_auto] sm:items-center", children: [
|
|
12080
12066
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: cn(ui.metaWrap), children: [
|
|
12081
12067
|
isRowsSelected && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { children: [
|
|
@@ -12090,7 +12076,8 @@ function DataTable({
|
|
|
12090
12076
|
typeof totalRows === "number" && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { children: [
|
|
12091
12077
|
"Total: ",
|
|
12092
12078
|
totalRows,
|
|
12093
|
-
"
|
|
12079
|
+
" ",
|
|
12080
|
+
totalLabel
|
|
12094
12081
|
] })
|
|
12095
12082
|
] }),
|
|
12096
12083
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: cn(ui.controlsWrap), children: [
|
package/dist/index.js
CHANGED
|
@@ -6398,7 +6398,7 @@ function SearchableSelectBase({
|
|
|
6398
6398
|
"button",
|
|
6399
6399
|
{
|
|
6400
6400
|
type: "button",
|
|
6401
|
-
"aria-label": "
|
|
6401
|
+
"aria-label": "Clear search",
|
|
6402
6402
|
tabIndex: -1,
|
|
6403
6403
|
onPointerDown: (event) => {
|
|
6404
6404
|
event.preventDefault();
|
|
@@ -7923,7 +7923,7 @@ function capitalize(value) {
|
|
|
7923
7923
|
}
|
|
7924
7924
|
function UiDate({
|
|
7925
7925
|
label,
|
|
7926
|
-
placeholder = "
|
|
7926
|
+
placeholder = "Select a date",
|
|
7927
7927
|
value,
|
|
7928
7928
|
defaultMonth,
|
|
7929
7929
|
onChange,
|
|
@@ -8227,7 +8227,7 @@ function UiDate({
|
|
|
8227
8227
|
}),
|
|
8228
8228
|
"h-8 w-8 shrink-0 rounded-lg text-muted-foreground hover:text-foreground disabled:opacity-30"
|
|
8229
8229
|
),
|
|
8230
|
-
"aria-label": "
|
|
8230
|
+
"aria-label": "Previous month",
|
|
8231
8231
|
children: /* @__PURE__ */ jsx31(ChevronLeftIcon, { className: "h-4 w-4" })
|
|
8232
8232
|
}
|
|
8233
8233
|
),
|
|
@@ -8240,7 +8240,7 @@ function UiDate({
|
|
|
8240
8240
|
items: monthOptions,
|
|
8241
8241
|
disabled: Boolean(disabled),
|
|
8242
8242
|
size: "sm",
|
|
8243
|
-
placeholder: "
|
|
8243
|
+
placeholder: "Month",
|
|
8244
8244
|
selectClassName: "space-y-0",
|
|
8245
8245
|
className: dateHeaderSelectTriggerClassName,
|
|
8246
8246
|
contentClassName: dateHeaderSelectContentClassName,
|
|
@@ -8257,7 +8257,7 @@ function UiDate({
|
|
|
8257
8257
|
items: yearOptions,
|
|
8258
8258
|
disabled: Boolean(disabled),
|
|
8259
8259
|
size: "sm",
|
|
8260
|
-
placeholder: "
|
|
8260
|
+
placeholder: "Year",
|
|
8261
8261
|
selectClassName: "space-y-0",
|
|
8262
8262
|
className: dateHeaderSelectTriggerClassName,
|
|
8263
8263
|
contentClassName: dateHeaderSelectContentClassName,
|
|
@@ -8285,7 +8285,7 @@ function UiDate({
|
|
|
8285
8285
|
}),
|
|
8286
8286
|
"h-8 w-8 shrink-0 rounded-lg text-muted-foreground hover:text-foreground disabled:opacity-30"
|
|
8287
8287
|
),
|
|
8288
|
-
"aria-label": "
|
|
8288
|
+
"aria-label": "Next month",
|
|
8289
8289
|
children: /* @__PURE__ */ jsx31(ChevronRightIcon4, { className: "h-4 w-4" })
|
|
8290
8290
|
}
|
|
8291
8291
|
)
|
|
@@ -8997,7 +8997,7 @@ function WheelArrowIndicator() {
|
|
|
8997
8997
|
}
|
|
8998
8998
|
function UiTime({
|
|
8999
8999
|
label,
|
|
9000
|
-
placeholder = "
|
|
9000
|
+
placeholder = "Select time",
|
|
9001
9001
|
value,
|
|
9002
9002
|
onChange,
|
|
9003
9003
|
onBlur,
|
|
@@ -11722,6 +11722,7 @@ function DataTable({
|
|
|
11722
11722
|
pageLabel = "Page",
|
|
11723
11723
|
isRowsSelected = true,
|
|
11724
11724
|
totalRows,
|
|
11725
|
+
totalLabel = "records",
|
|
11725
11726
|
rowsSelectedLabel = "row(s) selected",
|
|
11726
11727
|
template = "neo",
|
|
11727
11728
|
classNames,
|
|
@@ -11778,6 +11779,8 @@ function DataTable({
|
|
|
11778
11779
|
const accentOn = !!dtAccent;
|
|
11779
11780
|
const dataAccent = accentOn ? "on" : "off";
|
|
11780
11781
|
const headerIsSticky = stickyHeader && !headerScroll;
|
|
11782
|
+
const isEmpty = table.getRowModel().rows.length === 0;
|
|
11783
|
+
const emptyState = emptyData != null ? emptyData : /* @__PURE__ */ jsx66("p", { className: "text-muted-foreground", children: "No results." });
|
|
11781
11784
|
return /* @__PURE__ */ jsxs38(
|
|
11782
11785
|
"div",
|
|
11783
11786
|
{
|
|
@@ -11785,89 +11788,72 @@ function DataTable({
|
|
|
11785
11788
|
className: cn(ui.root, heightClassName),
|
|
11786
11789
|
style: accentOn ? { "--dt-accent": dtAccent } : void 0,
|
|
11787
11790
|
children: [
|
|
11788
|
-
/* @__PURE__ */
|
|
11789
|
-
/* @__PURE__ */
|
|
11790
|
-
/* @__PURE__ */ jsx66(
|
|
11791
|
-
|
|
11792
|
-
|
|
11793
|
-
|
|
11794
|
-
|
|
11795
|
-
|
|
11796
|
-
|
|
11797
|
-
|
|
11798
|
-
header.
|
|
11799
|
-
|
|
11800
|
-
|
|
11801
|
-
|
|
11802
|
-
|
|
11803
|
-
|
|
11804
|
-
|
|
11805
|
-
|
|
11806
|
-
|
|
11807
|
-
|
|
11808
|
-
|
|
11809
|
-
|
|
11810
|
-
|
|
11811
|
-
|
|
11812
|
-
|
|
11813
|
-
|
|
11814
|
-
|
|
11815
|
-
|
|
11816
|
-
|
|
11817
|
-
|
|
11818
|
-
|
|
11819
|
-
|
|
11820
|
-
|
|
11821
|
-
|
|
11822
|
-
|
|
11823
|
-
|
|
11824
|
-
|
|
11825
|
-
|
|
11826
|
-
|
|
11827
|
-
|
|
11828
|
-
|
|
11829
|
-
|
|
11830
|
-
|
|
11831
|
-
|
|
11832
|
-
|
|
11833
|
-
|
|
11834
|
-
|
|
11835
|
-
|
|
11836
|
-
|
|
11837
|
-
|
|
11838
|
-
|
|
11839
|
-
|
|
11840
|
-
|
|
11841
|
-
|
|
11842
|
-
|
|
11843
|
-
|
|
11844
|
-
|
|
11845
|
-
|
|
11846
|
-
|
|
11847
|
-
|
|
11848
|
-
|
|
11849
|
-
|
|
11850
|
-
|
|
11851
|
-
|
|
11852
|
-
|
|
11853
|
-
|
|
11854
|
-
) }, cell.id))
|
|
11855
|
-
},
|
|
11856
|
-
row.id
|
|
11857
|
-
)) : emptyData || /* @__PURE__ */ jsx66(TableRow, { "data-accent": dataAccent, children: /* @__PURE__ */ jsx66(
|
|
11858
|
-
TableCell,
|
|
11859
|
-
{
|
|
11860
|
-
colSpan: columns.length,
|
|
11861
|
-
className: cn(
|
|
11862
|
-
ui.td,
|
|
11863
|
-
"text-muted-foreground h-28 text-center"
|
|
11864
|
-
),
|
|
11865
|
-
children: "No results."
|
|
11866
|
-
}
|
|
11867
|
-
) }) })
|
|
11868
|
-
] }) }),
|
|
11869
|
-
/* @__PURE__ */ jsx66(ScrollBar, { orientation: "horizontal" })
|
|
11870
|
-
] }) }),
|
|
11791
|
+
/* @__PURE__ */ jsxs38("div", { className: "relative min-h-0 flex-1", children: [
|
|
11792
|
+
/* @__PURE__ */ jsxs38(ScrollArea, { className: "h-full", children: [
|
|
11793
|
+
/* @__PURE__ */ jsx66("div", { className: "relative w-max min-w-full", children: /* @__PURE__ */ jsxs38(Table, { className: cn(ui.table), children: [
|
|
11794
|
+
/* @__PURE__ */ jsx66(TableHeader, { className: cn(ui.thead), children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx66(TableRow, { className: cn(ui.trHead), children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx66(
|
|
11795
|
+
TableHead,
|
|
11796
|
+
{
|
|
11797
|
+
className: cn(
|
|
11798
|
+
headerIsSticky ? cn(ui.theadSticky, "z-20") : void 0,
|
|
11799
|
+
ui.th
|
|
11800
|
+
),
|
|
11801
|
+
children: header.isPlaceholder ? null : flexRender(
|
|
11802
|
+
header.column.columnDef.header,
|
|
11803
|
+
header.getContext()
|
|
11804
|
+
)
|
|
11805
|
+
},
|
|
11806
|
+
header.id
|
|
11807
|
+
)) }, headerGroup.id)) }),
|
|
11808
|
+
animate ? /* @__PURE__ */ jsx66(AnimatePresence, { mode: "wait", initial: false, children: /* @__PURE__ */ jsx66(
|
|
11809
|
+
motion.tbody,
|
|
11810
|
+
{
|
|
11811
|
+
className: cn(ui.tbody),
|
|
11812
|
+
initial: { opacity: 0, y: 6 },
|
|
11813
|
+
animate: { opacity: 1, y: 0 },
|
|
11814
|
+
exit: { opacity: 0, y: -6 },
|
|
11815
|
+
transition: { duration: 0.18 },
|
|
11816
|
+
children: table.getRowModel().rows.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx66(
|
|
11817
|
+
TableRow,
|
|
11818
|
+
{
|
|
11819
|
+
"data-accent": dataAccent,
|
|
11820
|
+
"data-state": row.getIsSelected() ? "selected" : void 0,
|
|
11821
|
+
onClick: () => onClick == null ? void 0 : onClick(row.original),
|
|
11822
|
+
className: cn(
|
|
11823
|
+
ui.tr,
|
|
11824
|
+
clickable ? ui.trClickable : void 0
|
|
11825
|
+
),
|
|
11826
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx66(TableCell, { className: cn(ui.td), children: flexRender(
|
|
11827
|
+
cell.column.columnDef.cell,
|
|
11828
|
+
cell.getContext()
|
|
11829
|
+
) }, cell.id))
|
|
11830
|
+
},
|
|
11831
|
+
row.id
|
|
11832
|
+
)) : null
|
|
11833
|
+
},
|
|
11834
|
+
pageKey
|
|
11835
|
+
) }) : /* @__PURE__ */ jsx66(TableBody, { className: cn(ui.tbody), children: table.getRowModel().rows.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx66(
|
|
11836
|
+
TableRow,
|
|
11837
|
+
{
|
|
11838
|
+
"data-accent": dataAccent,
|
|
11839
|
+
"data-state": row.getIsSelected() ? "selected" : void 0,
|
|
11840
|
+
onClick: () => onClick == null ? void 0 : onClick(row.original),
|
|
11841
|
+
className: cn(
|
|
11842
|
+
ui.tr,
|
|
11843
|
+
clickable ? ui.trClickable : void 0
|
|
11844
|
+
),
|
|
11845
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx66(TableCell, { className: cn(ui.td), children: flexRender(
|
|
11846
|
+
cell.column.columnDef.cell,
|
|
11847
|
+
cell.getContext()
|
|
11848
|
+
) }, cell.id))
|
|
11849
|
+
},
|
|
11850
|
+
row.id
|
|
11851
|
+
)) : null })
|
|
11852
|
+
] }) }),
|
|
11853
|
+
/* @__PURE__ */ jsx66(ScrollBar, { orientation: "horizontal" })
|
|
11854
|
+
] }),
|
|
11855
|
+
isEmpty ? /* @__PURE__ */ jsx66("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 top-12 z-[5] flex w-full items-center justify-center p-8", children: /* @__PURE__ */ jsx66("div", { className: "pointer-events-auto flex h-full w-full flex-col items-center justify-center text-center", children: emptyState }) }) : null
|
|
11856
|
+
] }),
|
|
11871
11857
|
/* @__PURE__ */ jsx66("div", { className: cn(ui.footer), children: /* @__PURE__ */ jsx66("div", { className: cn(ui.footerInner), children: /* @__PURE__ */ jsxs38("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-[1fr_auto] sm:items-center", children: [
|
|
11872
11858
|
/* @__PURE__ */ jsxs38("div", { className: cn(ui.metaWrap), children: [
|
|
11873
11859
|
isRowsSelected && /* @__PURE__ */ jsxs38("div", { children: [
|
|
@@ -11882,7 +11868,8 @@ function DataTable({
|
|
|
11882
11868
|
typeof totalRows === "number" && /* @__PURE__ */ jsxs38("div", { children: [
|
|
11883
11869
|
"Total: ",
|
|
11884
11870
|
totalRows,
|
|
11885
|
-
"
|
|
11871
|
+
" ",
|
|
11872
|
+
totalLabel
|
|
11886
11873
|
] })
|
|
11887
11874
|
] }),
|
|
11888
11875
|
/* @__PURE__ */ jsxs38("div", { className: cn(ui.controlsWrap), children: [
|
|
@@ -138,6 +138,7 @@ export interface DataTableProps<TData extends RowData, TValue = unknown> {
|
|
|
138
138
|
rowPerPageLabel?: string;
|
|
139
139
|
pageLabel?: string;
|
|
140
140
|
ofLabel?: string;
|
|
141
|
+
totalLabel?: string;
|
|
141
142
|
emptyData?: React.ReactNode;
|
|
142
143
|
animate?: boolean;
|
|
143
144
|
heightClassName?: string;
|
|
@@ -171,5 +172,5 @@ export interface DataTableProps<TData extends RowData, TValue = unknown> {
|
|
|
171
172
|
* - isRowsSelected / rowsSelectedLabel: selection meta display
|
|
172
173
|
* - rowPerPageLabel, pageLabel, ofLabel: i18n labels
|
|
173
174
|
*/
|
|
174
|
-
declare function DataTable<TData extends RowData, TValue = unknown>({ columns, data, pageCount, page, perPage, pageSizeOptions, rowPerPageLabel, ofLabel, pageLabel, isRowsSelected, totalRows, rowsSelectedLabel, template, classNames, accent, accentColor, emptyData, onPageChange, onClick, onPageSizeChange, animate, stickyHeader, headerScroll, heightClassName, }: DataTableProps<TData, TValue>): React.JSX.Element;
|
|
175
|
+
declare function DataTable<TData extends RowData, TValue = unknown>({ columns, data, pageCount, page, perPage, pageSizeOptions, rowPerPageLabel, ofLabel, pageLabel, isRowsSelected, totalRows, totalLabel, rowsSelectedLabel, template, classNames, accent, accentColor, emptyData, onPageChange, onClick, onPageSizeChange, animate, stickyHeader, headerScroll, heightClassName, }: DataTableProps<TData, TValue>): React.JSX.Element;
|
|
175
176
|
export { DataTable, DATA_TABLE_TEMPLATES };
|
package/dist/style.css
CHANGED
|
@@ -317,6 +317,9 @@
|
|
|
317
317
|
.top-4 {
|
|
318
318
|
top: calc(var(--spacing) * 4);
|
|
319
319
|
}
|
|
320
|
+
.top-12 {
|
|
321
|
+
top: calc(var(--spacing) * 12);
|
|
322
|
+
}
|
|
320
323
|
.top-\[1px\] {
|
|
321
324
|
top: 1px;
|
|
322
325
|
}
|
|
@@ -398,6 +401,9 @@
|
|
|
398
401
|
.z-\[1\] {
|
|
399
402
|
z-index: 1;
|
|
400
403
|
}
|
|
404
|
+
.z-\[5\] {
|
|
405
|
+
z-index: 5;
|
|
406
|
+
}
|
|
401
407
|
.z-\[100\] {
|
|
402
408
|
z-index: 100;
|
|
403
409
|
}
|
|
@@ -494,9 +500,6 @@
|
|
|
494
500
|
.hidden {
|
|
495
501
|
display: none;
|
|
496
502
|
}
|
|
497
|
-
.inline {
|
|
498
|
-
display: inline;
|
|
499
|
-
}
|
|
500
503
|
.inline-flex {
|
|
501
504
|
display: inline-flex;
|
|
502
505
|
}
|
|
@@ -585,9 +588,6 @@
|
|
|
585
588
|
.h-24 {
|
|
586
589
|
height: calc(var(--spacing) * 24);
|
|
587
590
|
}
|
|
588
|
-
.h-28 {
|
|
589
|
-
height: calc(var(--spacing) * 28);
|
|
590
|
-
}
|
|
591
591
|
.h-32 {
|
|
592
592
|
height: calc(var(--spacing) * 32);
|
|
593
593
|
}
|
|
@@ -1590,6 +1590,9 @@
|
|
|
1590
1590
|
.p-6 {
|
|
1591
1591
|
padding: calc(var(--spacing) * 6);
|
|
1592
1592
|
}
|
|
1593
|
+
.p-8 {
|
|
1594
|
+
padding: calc(var(--spacing) * 8);
|
|
1595
|
+
}
|
|
1593
1596
|
.p-\[1px\] {
|
|
1594
1597
|
padding: 1px;
|
|
1595
1598
|
}
|
|
@@ -1956,6 +1959,9 @@
|
|
|
1956
1959
|
.uppercase {
|
|
1957
1960
|
text-transform: uppercase;
|
|
1958
1961
|
}
|
|
1962
|
+
.italic {
|
|
1963
|
+
font-style: italic;
|
|
1964
|
+
}
|
|
1959
1965
|
.ordinal {
|
|
1960
1966
|
--tw-ordinal: ordinal;
|
|
1961
1967
|
font-variant-numeric: var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,);
|
|
@@ -2146,6 +2152,9 @@
|
|
|
2146
2152
|
.fade-in-0 {
|
|
2147
2153
|
--tw-enter-opacity: 0;
|
|
2148
2154
|
}
|
|
2155
|
+
.paused {
|
|
2156
|
+
animation-play-state: paused;
|
|
2157
|
+
}
|
|
2149
2158
|
.zoom-in-95 {
|
|
2150
2159
|
--tw-enter-scale: .95;
|
|
2151
2160
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blencm/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Bleker <bleker@blencm.com>",
|
|
6
6
|
"description": "Installable React UI library built on Radix UI and Tailwind CSS. Accessible primitives, form helpers (React Hook Form + Zod), DataTable, SearchableSelect, date/time pickers, dialogs and toasts. Import from npm — no copy-paste into src/components.",
|