@kashi-ui/react 2.24.0 → 2.24.1
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/DataTable.js +5 -1
- package/dist/Meter.js +1 -1
- package/dist/NotificationCenter.js +1 -1
- package/dist/Radio.js +1 -1
- package/package.json +4 -4
package/dist/DataTable.js
CHANGED
|
@@ -91,7 +91,11 @@ export function DataTable({ columns, rows, getRowId, caption, description, hideC
|
|
|
91
91
|
return (_jsxs("div", { ref: wrap, className: cx("k-table-wrap", (stickyHeader || vOpts) && "k-table-wrap--sticky", vOpts && "k-table-wrap--virtual", className, classNames.root), role: "region", "aria-labelledby": `${id}-caption`, "aria-busy": loadingRows > 0 || undefined, tabIndex: 0, style: maxHeight || vOpts ? { maxBlockSize: maxHeight ?? "28rem" } : undefined, children: [_jsxs("table", { className: cx("k-table", compact && "k-table--compact", striped && "k-table--striped", onRowClick && "k-table--clickable", classNames.table), "aria-rowcount": vOpts ? sorted.length + 1 : undefined, children: [_jsxs("caption", { id: `${id}-caption`, className: hideCaption ? "k-sr-only" : undefined, children: [_jsx("span", { className: "k-table__caption-title", children: caption }), description && _jsx("span", { className: "k-table__caption-desc", children: description })] }), _jsx("thead", { children: _jsxs("tr", { "aria-rowindex": vOpts ? 1 : undefined, children: [selectable && (_jsx("th", { scope: "col", className: "k-table__check", children: _jsx("input", { ref: allRef, type: "checkbox", className: "k-checkbox", "aria-label": selectAll, checked: all, onChange: () => setSel(all ? [] : ids) }) })), columns.map((c) => {
|
|
92
92
|
const s = activeSort?.key === c.key ? activeSort.direction : undefined;
|
|
93
93
|
return (_jsx("th", { scope: "col", "aria-sort": c.sortable ? (s ?? "none") : undefined, className: cx(cellCls(c), classNames.header) || undefined, style: c.width ? { inlineSize: c.width } : undefined, children: c.sortable ? _jsx("button", { type: "button", className: "k-table__sort", onClick: () => setSort(c.key), children: c.header }) : c.header }, c.key));
|
|
94
|
-
})] }) }), _jsx("tbody", { children: loadingRows > 0 ? (Array.from({ length: loadingRows }, (_, i) => (_jsxs("tr", { "aria-hidden": "true", children: [selectable && _jsx("td", { className: "k-table__check", children: _jsx("span", { className: "k-skeleton", style: { inlineSize: "1.125rem", blockSize: "1.125rem" } }) }), columns.map((c) => (_jsx("td", { className: cellCls(c), children: _jsx("span", { className: "k-skeleton", style: { inlineSize: `${50 + ((i * 17 + c.key.length * 11) % 40)}%` } }) }, c.key)))] }, `sk-${i}`)))) : sorted.length === 0 ? (_jsx("tr", { className: "k-table__empty", children: _jsx("td", { colSpan: colCount, children:
|
|
94
|
+
})] }) }), _jsx("tbody", { children: loadingRows > 0 ? (Array.from({ length: loadingRows }, (_, i) => (_jsxs("tr", { "aria-hidden": "true", children: [selectable && _jsx("td", { className: "k-table__check", children: _jsx("span", { className: "k-skeleton", style: { inlineSize: "1.125rem", blockSize: "1.125rem" } }) }), columns.map((c) => (_jsx("td", { className: cellCls(c), children: _jsx("span", { className: "k-skeleton", style: { inlineSize: `${50 + ((i * 17 + c.key.length * 11) % 40)}%` } }) }, c.key)))] }, `sk-${i}`)))) : sorted.length === 0 ? (_jsx("tr", { className: "k-table__empty", children: _jsx("td", { colSpan: colCount, children:
|
|
95
|
+
// متن ساده همان فاصله و ترازِ پیام پیشفرض را میگیرد؛ EmptyState یا عنصر دیگر خودش فاصله دارد
|
|
96
|
+
empty == null || typeof empty === "string" || typeof empty === "number"
|
|
97
|
+
? _jsx("p", { style: { padding: "2rem", margin: 0, textAlign: "center" }, children: empty ?? M.table.empty })
|
|
98
|
+
: empty }) })) : (_jsxs(_Fragment, { children: [win && spacer(win.before, "sp-top"), visible.map((r, vi) => {
|
|
95
99
|
const rid = getRowId(r);
|
|
96
100
|
const on = sel.includes(rid);
|
|
97
101
|
const index = (win?.first ?? 0) + vi;
|
package/dist/Meter.js
CHANGED
|
@@ -13,5 +13,5 @@ export function Meter({ label, value, max = 100, warning = max * 0.8, critical =
|
|
|
13
13
|
const status = v >= critical ? "critical" : v >= warning ? "warning" : "ok";
|
|
14
14
|
const pct = Math.round((v / max) * 100);
|
|
15
15
|
const text = { ok, warning: warnText, critical: critText }[status];
|
|
16
|
-
return (_jsxs("div", { className: cx("k-meter", className), "data-status": status, children: [_jsxs("div", { className: "k-meter__head", children: [_jsx("span", { className: "k-meter__label", children: label }), _jsxs("span", { className: "k-meter__value", children: [format(v), " ",
|
|
16
|
+
return (_jsxs("div", { className: cx("k-meter", className), "data-status": status, children: [_jsxs("div", { className: "k-meter__head", children: [_jsx("span", { className: "k-meter__label", children: label }), _jsxs("span", { className: "k-meter__value", children: [format(v), " ", _jsx("span", { children: of !== undefined ? `${of} ${format(max)}` : M.common.of("", format(max)).trim() })] })] }), _jsxs("div", { className: "k-meter__track", role: "meter", "aria-valuenow": v, "aria-valuemin": 0, "aria-valuemax": max, "aria-valuetext": `${of ? `${format(v)} ${of} ${format(max)}` : M.common.of(format(v), format(max))}${M.common.list}${M.common.percent(n(pct))}${M.common.list}${text}`, "aria-label": typeof label === "string" ? label : undefined, children: [_jsx("span", { className: "k-meter__fill", style: { inlineSize: `${pct}%` } }), _jsx("span", { className: "k-meter__mark", style: { insetInlineStart: `${(warning / max) * 100}%` }, "aria-hidden": "true" })] }), _jsxs("p", { className: "k-meter__status", "aria-hidden": "true", children: [_jsx(Icon, { d: status === "ok" ? "m5 10.5 3.2 3L15 7" : "M10 3 2.5 16.5h15ZM10 8v4M10 14.5h.01" }), text, " \u00B7 ", M.common.percent(n(pct))] })] }));
|
|
17
17
|
}
|
|
@@ -25,7 +25,7 @@ export function NotificationList({ items, onRead, onReadAll, onSelect, onSetting
|
|
|
25
25
|
groups[d >= today ? 0 : d >= today - 86400000 ? 1 : 2][1].push(it);
|
|
26
26
|
}
|
|
27
27
|
return (_jsxs("div", { className: cx("k-notif", className), children: [_jsxs("div", { className: "k-notif__head", children: [_jsx("h2", { className: "k-notif__title", children: title ?? N.label }), onReadAll && unread > 0 && (_jsxs("button", { type: "button", className: "k-notif__link", onClick: onReadAll, children: [_jsx(CheckAll, {}), N.markAll] })), onSettings && _jsx("button", { type: "button", className: "k-notif__icon", "aria-label": N.settings, onClick: onSettings, children: _jsx(Gear, {}) })] }), _jsx("div", { className: "k-notif__tabs", role: "group", children: ["all", "unread"].map((t) => (_jsxs("button", { type: "button", className: "k-notif__tab", "aria-pressed": tab === t, onClick: () => setTab(t), children: [N[t], t === "unread" && unread > 0 && _jsx("span", { className: "k-notif__count", children: n(unread) })] }, t))) }), list.length === 0 ? (_jsxs("div", { className: "k-notif__empty", children: [_jsx("span", { className: "k-notif__empty-icon", children: _jsx(Bell, {}) }), _jsx("p", { children: tab === "unread" ? N.emptyUnread : N.empty })] })) : (_jsx("div", { className: "k-notif__scroll", tabIndex: -1, children: groups.filter(([, g]) => g.length).map(([name, g]) => (_jsxs("section", { className: "k-notif__group", "aria-label": name, children: [_jsx("h3", { className: "k-notif__group-title", children: name }), _jsx("ul", { className: "k-notif__list", children: g.map((it) => {
|
|
28
|
-
const inner = (_jsxs(_Fragment, { children: [it.icon && _jsx("span", { className: "k-notif__media", "data-tone": it.tone, children: it.icon }), _jsxs("span", { className: "k-notif__text", children: [_jsx("span", { className: "k-notif__item-title", children: it.title }), it.body && _jsx("span", { className: "k-notif__body", children: it.body }), _jsx("time", { className: "k-notif__time", dateTime: it.time.toISOString(), children: formatRelative(it.time, { now: ref, locale, digits }) })] })] }));
|
|
28
|
+
const inner = (_jsxs(_Fragment, { children: [it.icon && _jsx("span", { className: "k-notif__media", "data-tone": it.tone, children: it.icon }), _jsxs("span", { className: "k-notif__text", children: [_jsx("span", { className: "k-notif__item-title", children: it.title }), !it.read && _jsxs("span", { className: "k-sr-only", children: [" ", N.unreadDot] }), it.body && _jsx("span", { className: "k-notif__body", children: it.body }), _jsx("time", { className: "k-notif__time", dateTime: it.time.toISOString(), children: formatRelative(it.time, { now: ref, locale, digits }) })] })] }));
|
|
29
29
|
const select = () => {
|
|
30
30
|
if (!it.read)
|
|
31
31
|
onRead?.(it.id);
|
package/dist/Radio.js
CHANGED
|
@@ -33,5 +33,5 @@ export const Radio = forwardRef(function Radio({ value, label, description, badg
|
|
|
33
33
|
}
|
|
34
34
|
const autoId = useId();
|
|
35
35
|
const inputId = id ?? autoId;
|
|
36
|
-
return (_jsxs("label", { className: cx("k-check", className), htmlFor: inputId, "data-readonly": ctx?.readOnly || undefined, children: [_jsx("input", { ref: ref, type: "radio", className: "k-radio", id: inputId, name: ctx?.name ?? name, value: value, checked: ctx ? ctx.value === value : undefined, onChange: () => ctx?.setValue(value), disabled: disabled, "aria-readonly": ctx?.readOnly || undefined, "aria-describedby": description ? `${inputId}-desc` : undefined, ...rest }), _jsxs("span", { className: "k-check__text", children: [badge != null && badge !== false ? (_jsxs("span", { className: "k-check__head", children: [_jsx("span", { className: "k-check__label", children: label }), typeof badge === "string" ? _jsx("span", { className: "k-badge k-badge--brand k-badge--sm", children: badge }) : badge] })) : (_jsx("span", { className: "k-check__label", children: label })), description && _jsx("span", { className: "k-check__description", id: `${inputId}-desc`, children: description })] }), meta != null && meta !== false && _jsx("span", { className: "k-check__meta", children: meta })] }));
|
|
36
|
+
return (_jsxs("label", { className: cx("k-check", className), htmlFor: inputId, "data-readonly": ctx?.readOnly || undefined, children: [_jsx("input", { ref: ref, type: "radio", className: "k-radio", id: inputId, name: ctx?.name ?? name, value: value, checked: ctx ? ctx.value === value : undefined, onChange: () => ctx?.setValue(value), disabled: disabled, "aria-readonly": ctx?.readOnly || undefined, "aria-invalid": ctx?.invalid || undefined, "aria-describedby": description ? `${inputId}-desc` : undefined, ...rest }), _jsxs("span", { className: "k-check__text", children: [badge != null && badge !== false ? (_jsxs("span", { className: "k-check__head", children: [_jsx("span", { className: "k-check__label", children: label }), typeof badge === "string" ? _jsx("span", { className: "k-badge k-badge--brand k-badge--sm", children: badge }) : badge] })) : (_jsx("span", { className: "k-check__label", children: label })), description && _jsx("span", { className: "k-check__description", id: `${inputId}-desc`, children: description })] }), meta != null && meta !== false && _jsx("span", { className: "k-check__meta", children: meta })] }));
|
|
37
37
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kashi-ui/react",
|
|
3
|
-
"version": "2.24.
|
|
3
|
+
"version": "2.24.1",
|
|
4
4
|
"description": "کامپوننتهای React دیزاینسیستم کاشی",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"test": "node --test test/*.test.mjs"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@kashi-ui/css": "^2.24.
|
|
25
|
+
"@kashi-ui/css": "^2.24.1",
|
|
26
26
|
"react": ">=18"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@kashi-ui/bank-logos": "^2.24.
|
|
63
|
-
"@kashi-ui/persian": "^2.24.
|
|
62
|
+
"@kashi-ui/bank-logos": "^2.24.1",
|
|
63
|
+
"@kashi-ui/persian": "^2.24.1"
|
|
64
64
|
}
|
|
65
65
|
}
|