@kashi-ui/react 0.13.0 → 0.14.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/README.md +1 -1
- package/dist/ColorPicker.d.ts +1 -1
- package/dist/ColorPicker.js +86 -3
- package/dist/DatePicker.d.ts +3 -1
- package/dist/DatePicker.js +2 -2
- package/dist/DateRangePicker.d.ts +4 -2
- package/dist/DateRangePicker.js +2 -2
- package/dist/MultiSelect.d.ts +33 -0
- package/dist/MultiSelect.js +82 -0
- package/dist/Pagination.d.ts +11 -2
- package/dist/Pagination.js +11 -3
- package/dist/Tabs.js +21 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ export function SignUp() {
|
|
|
20
20
|
}
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
کامپوننتها: Button · Input · Textarea · Select · Checkbox · RadioGroup · Switch · Badge · Card · Alert · Avatar · AvatarGroup · Tabs · Dialog · Toast · Tooltip · DropdownMenu · DataTable · Pagination · Breadcrumb · Accordion · Stepper · Progress · Spinner · Skeleton · EmptyState · Divider · Kbd · RelativeTime · Combobox · CommandPalette · TagInput · FileUpload · Slider · NumberInput · Popover · StatCard · Timeline · SideNav · SegmentedControl · CopyButton · Banner · Rating · TreeView · ButtonGroup · ChipGroup · PasswordStrength · BarChart · LineChart · ContextMenu · InlineEdit · PieChart · BarList · ProportionBar · Sparkline · Carousel · ColorPicker · Tour · Meter · Splitter
|
|
23
|
+
کامپوننتها: Button · Input · Textarea · Select · Checkbox · RadioGroup · Switch · Badge · Card · Alert · Avatar · AvatarGroup · Tabs · Dialog · Toast · Tooltip · DropdownMenu · DataTable · Pagination · Breadcrumb · Accordion · Stepper · Progress · Spinner · Skeleton · EmptyState · Divider · Kbd · RelativeTime · Combobox · MultiSelect · CommandPalette · TagInput · FileUpload · Slider · NumberInput · Popover · StatCard · Timeline · SideNav · SegmentedControl · CopyButton · Banner · Rating · TreeView · ButtonGroup · ChipGroup · PasswordStrength · BarChart · LineChart · ContextMenu · InlineEdit · PieChart · BarList · ProportionBar · Sparkline · Carousel · ColorPicker · Tour · Meter · Splitter
|
|
24
24
|
|
|
25
25
|
فارسی: DatePicker و Calendar شمسی · DateRangePicker · TimeInput · PostalCodeInput · PlateInput · LandlineInput · MonthPicker · Countdown · ActivityHeatmap · ProvinceSelect · NationalIdInput · CardNumberInput · IbanInput · MobileInput · PriceInput · OtpInput
|
|
26
26
|
|
package/dist/ColorPicker.d.ts
CHANGED
|
@@ -19,5 +19,5 @@ export interface ColorPickerProps {
|
|
|
19
19
|
}
|
|
20
20
|
/** نسبت کنتراست WCAG */
|
|
21
21
|
export declare const contrastRatio: (a: string, b: string) => number;
|
|
22
|
-
/** انتخاب رنگ برند یا برچسب: نمونهرنگها،
|
|
22
|
+
/** انتخاب رنگ برند یا برچسب: نمونهرنگها، پنل انتخاب دلخواه و کد hex، با کنتراست متن روی آن */
|
|
23
23
|
export declare function ColorPicker({ label, hint, value, defaultValue, onChange, swatches, showContrast, name, id, className }: ColorPickerProps): import("react").JSX.Element;
|
package/dist/ColorPicker.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useId, useState } from "react";
|
|
2
|
+
import { useEffect, useId, useRef, useState } from "react";
|
|
3
3
|
import { toFaDigits } from "@kashi-ui/persian";
|
|
4
4
|
import { Field } from "./Field.js";
|
|
5
5
|
const DEFAULT_SWATCHES = [
|
|
@@ -30,14 +30,97 @@ export const contrastRatio = (a, b) => {
|
|
|
30
30
|
const [x, y] = [lum(a), lum(b)].sort((m, n) => n - m);
|
|
31
31
|
return (x + 0.05) / (y + 0.05);
|
|
32
32
|
};
|
|
33
|
+
const hexToRgb = (hex) => [1, 3, 5].map((i) => parseInt(hex.slice(i, i + 2), 16));
|
|
34
|
+
const rgbToHex = (r, g, b) => `#${[r, g, b].map((n) => Math.round(Math.min(255, Math.max(0, n))).toString(16).padStart(2, "0")).join("")}`;
|
|
35
|
+
function hexToHsv(hex) {
|
|
36
|
+
const [r, g, b] = hexToRgb(hex).map((n) => n / 255);
|
|
37
|
+
const max = Math.max(r, g, b), d = max - Math.min(r, g, b);
|
|
38
|
+
let h = 0;
|
|
39
|
+
if (d)
|
|
40
|
+
h = max === r ? ((g - b) / d) % 6 : max === g ? (b - r) / d + 2 : (r - g) / d + 4;
|
|
41
|
+
return { h: (h * 60 + 360) % 360, s: max ? d / max : 0, v: max };
|
|
42
|
+
}
|
|
43
|
+
function hsvToHex({ h, s, v }) {
|
|
44
|
+
const f = (n) => {
|
|
45
|
+
const k = (n + h / 60) % 6;
|
|
46
|
+
return (v - v * s * Math.max(0, Math.min(k, 4 - k, 1))) * 255;
|
|
47
|
+
};
|
|
48
|
+
return rgbToHex(f(5), f(3), f(1));
|
|
49
|
+
}
|
|
50
|
+
const Dropper = () => _jsx("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: 1.7, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: "m11 5 4 4M13.5 2.5a2.1 2.1 0 0 1 3 3L15 7 13 5ZM12 6l-7.5 7.5L3 17l3.5-1.5L14 8" }) });
|
|
51
|
+
/** پنل انتخاب رنگ: سطح اشباع و روشنایی، نوار رنگمایه، قطرهچکان و کدها */
|
|
52
|
+
function ColorPanel({ hex, onChange, onClose }) {
|
|
53
|
+
const [hsv, setHsv] = useState(() => hexToHsv(hex));
|
|
54
|
+
const area = useRef(null);
|
|
55
|
+
const panel = useRef(null);
|
|
56
|
+
// تغییر از بیرون (نمونهرنگ یا فیلد hex) رنگمایه را حفظ میکند وقتی رنگ خاکستری است
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
if (hsvToHex(hsv) !== hex)
|
|
59
|
+
setHsv((p) => { const n = hexToHsv(hex); return n.s === 0 ? { ...n, h: p.h } : n; });
|
|
60
|
+
}, [hex]);
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
area.current?.focus({ preventScroll: true });
|
|
63
|
+
const onDown = (e) => !panel.current?.parentElement?.contains(e.target) && onClose();
|
|
64
|
+
document.addEventListener("pointerdown", onDown);
|
|
65
|
+
return () => document.removeEventListener("pointerdown", onDown);
|
|
66
|
+
}, []);
|
|
67
|
+
const apply = (n) => {
|
|
68
|
+
setHsv(n);
|
|
69
|
+
onChange(hsvToHex(n));
|
|
70
|
+
};
|
|
71
|
+
const fromPointer = (e) => {
|
|
72
|
+
const r = area.current.getBoundingClientRect();
|
|
73
|
+
const x = Math.min(1, Math.max(0, (e.clientX - r.left) / r.width));
|
|
74
|
+
const y = Math.min(1, Math.max(0, (e.clientY - r.top) / r.height));
|
|
75
|
+
apply({ ...hsv, s: x, v: 1 - y });
|
|
76
|
+
};
|
|
77
|
+
const onAreaKey = (e) => {
|
|
78
|
+
const step = e.shiftKey ? 0.1 : 0.01;
|
|
79
|
+
const k = {
|
|
80
|
+
ArrowLeft: { s: Math.max(0, hsv.s - step) }, ArrowRight: { s: Math.min(1, hsv.s + step) },
|
|
81
|
+
ArrowUp: { v: Math.min(1, hsv.v + step) }, ArrowDown: { v: Math.max(0, hsv.v - step) },
|
|
82
|
+
};
|
|
83
|
+
if (k[e.key]) {
|
|
84
|
+
e.preventDefault();
|
|
85
|
+
apply({ ...hsv, ...k[e.key] });
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const [r, g, b] = hexToRgb(hex);
|
|
89
|
+
const pct = (n) => `${toFaDigits(Math.round(n * 100))}٪`;
|
|
90
|
+
const eye = typeof window !== "undefined" && "EyeDropper" in window;
|
|
91
|
+
return (_jsxs("div", { ref: panel, className: "k-color__panel", role: "dialog", "aria-label": "\u0627\u0646\u062A\u062E\u0627\u0628 \u0631\u0646\u06AF \u062F\u0644\u062E\u0648\u0627\u0647", onKeyDown: (e) => {
|
|
92
|
+
if (e.key === "Escape") {
|
|
93
|
+
e.stopPropagation();
|
|
94
|
+
onClose();
|
|
95
|
+
}
|
|
96
|
+
}, children: [_jsx("div", { ref: area, className: "k-color__area", style: { "--_hue": `hsl(${hsv.h} 100% 50%)` }, role: "slider", tabIndex: 0, "aria-label": "\u0627\u0634\u0628\u0627\u0639 \u0648 \u0631\u0648\u0634\u0646\u0627\u06CC\u06CC", "aria-valuetext": `اشباع ${pct(hsv.s)}، روشنایی ${pct(hsv.v)}`, "aria-valuenow": Math.round(hsv.s * 100), onPointerDown: (e) => {
|
|
97
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
98
|
+
fromPointer(e);
|
|
99
|
+
}, onPointerMove: (e) => e.buttons === 1 && fromPointer(e), onKeyDown: onAreaKey, children: _jsx("span", { className: "k-color__thumb", style: { left: `${hsv.s * 100}%`, top: `${(1 - hsv.v) * 100}%` } }) }), _jsxs("div", { className: "k-color__tools", children: [eye && (_jsx("button", { type: "button", className: "k-btn k-btn--tertiary k-btn--icon k-btn--sm", "aria-label": "\u0628\u0631\u062F\u0627\u0634\u062A\u0646 \u0631\u0646\u06AF \u0627\u0632 \u0635\u0641\u062D\u0647", onClick: async () => {
|
|
100
|
+
try {
|
|
101
|
+
const res = await new window.EyeDropper().open();
|
|
102
|
+
const h = norm(res.sRGBHex);
|
|
103
|
+
if (h)
|
|
104
|
+
onChange(h);
|
|
105
|
+
}
|
|
106
|
+
catch { /* کاربر انصراف داد */ }
|
|
107
|
+
}, children: _jsx(Dropper, {}) })), _jsx("span", { className: "k-color__current", "aria-hidden": "true" }), _jsx("input", { type: "range", className: "k-color__hue", min: 0, max: 359, value: Math.round(hsv.h), "aria-label": "\u0631\u0646\u06AF\u200C\u0645\u0627\u06CC\u0647", "aria-valuetext": `${toFaDigits(Math.round(hsv.h))} درجه`, onChange: (e) => apply({ ...hsv, h: Number(e.target.value) }) })] }), _jsx("div", { className: "k-color__codes", dir: "ltr", children: ["R", "G", "B"].map((ch, i) => (_jsxs("label", { className: "k-color__code", children: [_jsx("input", { className: "k-color__num", inputMode: "numeric", value: [r, g, b][i], "aria-label": { R: "قرمز", G: "سبز", B: "آبی" }[ch], onChange: (e) => {
|
|
108
|
+
const n = Math.min(255, Math.max(0, Number(e.target.value.replace(/\D/g, "")) || 0));
|
|
109
|
+
const rgb = [r, g, b];
|
|
110
|
+
rgb[i] = n;
|
|
111
|
+
onChange(rgbToHex(rgb[0], rgb[1], rgb[2]));
|
|
112
|
+
} }), _jsx("span", { "aria-hidden": "true", children: ch })] }, ch))) })] }));
|
|
113
|
+
}
|
|
33
114
|
const Check = () => _jsx("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: 2.2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: "m5 10.5 3.2 3L15 7" }) });
|
|
34
|
-
/** انتخاب رنگ برند یا برچسب: نمونهرنگها،
|
|
115
|
+
/** انتخاب رنگ برند یا برچسب: نمونهرنگها، پنل انتخاب دلخواه و کد hex، با کنتراست متن روی آن */
|
|
35
116
|
export function ColorPicker({ label, hint, value, defaultValue = "#0b8077", onChange, swatches = DEFAULT_SWATCHES, showContrast = true, name, id, className }) {
|
|
36
117
|
const autoId = useId();
|
|
37
118
|
const fieldId = id ?? autoId;
|
|
38
119
|
const [inner, setInner] = useState(norm(defaultValue) ?? "#000000");
|
|
39
120
|
const current = norm(value ?? "") ?? inner;
|
|
40
121
|
const [text, setText] = useState(null);
|
|
122
|
+
const [open, setOpen] = useState(false);
|
|
123
|
+
const trigger = useRef(null);
|
|
41
124
|
const set = (hex) => {
|
|
42
125
|
if (value === undefined)
|
|
43
126
|
setInner(hex);
|
|
@@ -48,7 +131,7 @@ export function ColorPicker({ label, hint, value, defaultValue = "#0b8077", onCh
|
|
|
48
131
|
const ink = white >= black ? "#ffffff" : "#000000";
|
|
49
132
|
const fmt = (r) => toFaDigits((Math.round(r * 10) / 10).toFixed(1)).replace(".", "٫");
|
|
50
133
|
const invalid = text !== null && !norm(text);
|
|
51
|
-
return (_jsx(Field, { id: `${fieldId}-hex`, label: label, hint: hint, error: invalid ? "کد رنگ معتبر نیست؛ مثل #0fa89b وارد کنید." : undefined, className: className, children: _jsxs("div", { className: "k-color", style: { "--_sw": current, "--_ink": ink }, children: [swatches.length > 0 && (_jsx("div", { className: "k-color__swatches", role: "radiogroup", "aria-label": "\u0631\u0646\u06AF\u200C\u0647\u0627\u06CC \u067E\u06CC\u0634\u0646\u0647\u0627\u062F\u06CC", children: swatches.map((s) => (_jsxs("label", { className: "k-color__swatch", style: { "--_sw": s.value, "--_ink": contrastRatio(s.value, "#ffffff") >= 3 ? "#fff" : "#000" }, title: s.name, children: [_jsx("input", { type: "radio", className: "k-sr-only", name: `${fieldId}-sw`, checked: norm(s.value) === current, "aria-label": s.name, onChange: () => set(norm(s.value)) }), _jsx(Check, {})] }, s.value))) })), _jsxs("div", { className: "k-color__row", children: [_jsxs("
|
|
134
|
+
return (_jsx(Field, { id: `${fieldId}-hex`, label: label, hint: hint, error: invalid ? "کد رنگ معتبر نیست؛ مثل #0fa89b وارد کنید." : undefined, className: className, children: _jsxs("div", { className: "k-color", style: { "--_sw": current, "--_ink": ink }, children: [swatches.length > 0 && (_jsx("div", { className: "k-color__swatches", role: "radiogroup", "aria-label": "\u0631\u0646\u06AF\u200C\u0647\u0627\u06CC \u067E\u06CC\u0634\u0646\u0647\u0627\u062F\u06CC", children: swatches.map((s) => (_jsxs("label", { className: "k-color__swatch", style: { "--_sw": s.value, "--_ink": contrastRatio(s.value, "#ffffff") >= 3 ? "#fff" : "#000" }, title: s.name, children: [_jsx("input", { type: "radio", className: "k-sr-only", name: `${fieldId}-sw`, checked: norm(s.value) === current, "aria-label": s.name, onChange: () => set(norm(s.value)) }), _jsx(Check, {})] }, s.value))) })), _jsxs("div", { className: "k-color__row", children: [_jsxs("span", { className: "k-color__anchor", children: [_jsx("button", { ref: trigger, type: "button", className: "k-color__preview", "aria-label": "\u0627\u0646\u062A\u062E\u0627\u0628 \u0631\u0646\u06AF \u062F\u0644\u062E\u0648\u0627\u0647", "aria-haspopup": "dialog", "aria-expanded": open, onClick: () => setOpen((o) => !o) }), open && _jsx(ColorPanel, { hex: current, onChange: set, onClose: () => { setOpen(false); trigger.current?.focus(); } })] }), _jsx("div", { className: "k-input", "data-state": invalid ? "invalid" : undefined, children: _jsx("input", { id: `${fieldId}-hex`, className: "k-input__control", dir: "ltr", spellCheck: false, autoComplete: "off", value: text ?? current, "aria-invalid": invalid || undefined, onChange: (e) => {
|
|
52
135
|
setText(e.target.value);
|
|
53
136
|
const h = norm(e.target.value);
|
|
54
137
|
if (h) {
|
package/dist/DatePicker.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import { type CalendarLabels } from "./Calendar.js";
|
|
2
|
+
import { type CalendarLabels, type CalendarProps } from "./Calendar.js";
|
|
3
3
|
import { type InputProps } from "./Input.js";
|
|
4
4
|
type Base = Omit<InputProps, "value" | "defaultValue" | "onChange" | "type" | "addonEnd" | "min" | "max">;
|
|
5
5
|
export interface DatePickerProps extends Base {
|
|
@@ -19,6 +19,8 @@ export interface DatePickerProps extends Base {
|
|
|
19
19
|
/** @default "امروز" */
|
|
20
20
|
todayLabel?: string;
|
|
21
21
|
calendarLabels?: CalendarLabels;
|
|
22
|
+
/** تعطیلات در تقویم؛ مثل Calendar */
|
|
23
|
+
holidays?: CalendarProps["holidays"];
|
|
22
24
|
}
|
|
23
25
|
/**
|
|
24
26
|
* انتخاب تاریخ شمسی: تایپ مستقیم (۱۴۰۳/۰۵/۱۲) یا انتخاب از تقویم.
|
package/dist/DatePicker.js
CHANGED
|
@@ -8,7 +8,7 @@ import { mergeRefs, useIsomorphicLayoutEffect } from "./utils.js";
|
|
|
8
8
|
* انتخاب تاریخ شمسی: تایپ مستقیم (۱۴۰۳/۰۵/۱۲) یا انتخاب از تقویم.
|
|
9
9
|
* با name، مقدار میلادی به شکل YYYY-MM-DD در فرم ارسال میشود.
|
|
10
10
|
*/
|
|
11
|
-
export const DatePicker = forwardRef(function DatePicker({ value, defaultValue = null, onChange, min, max, isDateDisabled, digits = "fa", yearRange, invalidMessage = "این تاریخ معتبر نیست؛ آن را به شکل ۱۴۰۳/۰۵/۱۲ وارد کنید.", openLabel = "انتخاب تاریخ از تقویم", todayLabel = "امروز", calendarLabels, error, name, onBlur, placeholder, ...rest }, ref) {
|
|
11
|
+
export const DatePicker = forwardRef(function DatePicker({ value, defaultValue = null, onChange, min, max, isDateDisabled, holidays, digits = "fa", yearRange, invalidMessage = "این تاریخ معتبر نیست؛ آن را به شکل ۱۴۰۳/۰۵/۱۲ وارد کنید.", openLabel = "انتخاب تاریخ از تقویم", todayLabel = "امروز", calendarLabels, error, name, onBlur, placeholder, ...rest }, ref) {
|
|
12
12
|
const id = useId();
|
|
13
13
|
const popoverId = `${id}-calendar`;
|
|
14
14
|
const [inner, setInner] = useState(defaultValue);
|
|
@@ -82,7 +82,7 @@ export const DatePicker = forwardRef(function DatePicker({ value, defaultValue =
|
|
|
82
82
|
}, children: _jsx(Calendar, { value: selected, onChange: (d) => {
|
|
83
83
|
commit(d);
|
|
84
84
|
close();
|
|
85
|
-
}, min: min, max: max, isDateDisabled: isDateDisabled, digits: digits, yearRange: yearRange, labels: calendarLabels, autoFocus: true, footer: _jsx("button", { type: "button", className: "k-btn k-btn--link", onClick: () => {
|
|
85
|
+
}, min: min, max: max, isDateDisabled: isDateDisabled, holidays: holidays, digits: digits, yearRange: yearRange, labels: calendarLabels, autoFocus: true, footer: _jsx("button", { type: "button", className: "k-btn k-btn--link", onClick: () => {
|
|
86
86
|
const t = new Date();
|
|
87
87
|
commit(new Date(t.getFullYear(), t.getMonth(), t.getDate()));
|
|
88
88
|
close();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import { type CalendarLabels } from "./Calendar.js";
|
|
2
|
+
import { type CalendarLabels, type CalendarProps } from "./Calendar.js";
|
|
3
3
|
export interface DateRange {
|
|
4
4
|
start: Date | null;
|
|
5
5
|
end: Date | null;
|
|
@@ -34,6 +34,8 @@ export interface DateRangePickerProps {
|
|
|
34
34
|
id?: string;
|
|
35
35
|
className?: string;
|
|
36
36
|
calendarLabels?: CalendarLabels;
|
|
37
|
+
/** تعطیلات در تقویم؛ مثل Calendar */
|
|
38
|
+
holidays?: CalendarProps["holidays"];
|
|
37
39
|
labels?: {
|
|
38
40
|
placeholder?: string;
|
|
39
41
|
separator?: string;
|
|
@@ -47,4 +49,4 @@ export interface DateRangePickerProps {
|
|
|
47
49
|
* انتخاب بازهٔ تاریخ شمسی: کلیک اول شروع، کلیک دوم پایان؛ پیش از تأیید، بازه با حرکت موس پیشنمایش میشود.
|
|
48
50
|
* تغییرها فقط با «تأیید» ثبت میشوند.
|
|
49
51
|
*/
|
|
50
|
-
export declare function DateRangePicker({ label, hint, error, value, defaultValue, onChange, min, max, isDateDisabled, presets, digits, name, disabled, id, className, calendarLabels, labels, }: DateRangePickerProps): import("react").JSX.Element;
|
|
52
|
+
export declare function DateRangePicker({ label, hint, error, value, defaultValue, onChange, min, max, isDateDisabled, holidays, presets, digits, name, disabled, id, className, calendarLabels, labels, }: DateRangePickerProps): import("react").JSX.Element;
|
package/dist/DateRangePicker.js
CHANGED
|
@@ -29,7 +29,7 @@ export const defaultRangePresets = [
|
|
|
29
29
|
* انتخاب بازهٔ تاریخ شمسی: کلیک اول شروع، کلیک دوم پایان؛ پیش از تأیید، بازه با حرکت موس پیشنمایش میشود.
|
|
30
30
|
* تغییرها فقط با «تأیید» ثبت میشوند.
|
|
31
31
|
*/
|
|
32
|
-
export function DateRangePicker({ label, hint, error, value, defaultValue = { start: null, end: null }, onChange, min, max, isDateDisabled, presets = defaultRangePresets, digits = "fa", name, disabled, id, className, calendarLabels, labels = {}, }) {
|
|
32
|
+
export function DateRangePicker({ label, hint, error, value, defaultValue = { start: null, end: null }, onChange, min, max, isDateDisabled, holidays, presets = defaultRangePresets, digits = "fa", name, disabled, id, className, calendarLabels, labels = {}, }) {
|
|
33
33
|
const autoId = useId();
|
|
34
34
|
const triggerId = id ?? autoId;
|
|
35
35
|
const popoverId = `${triggerId}-popover`;
|
|
@@ -90,5 +90,5 @@ export function DateRangePicker({ label, hint, error, value, defaultValue = { st
|
|
|
90
90
|
}, children: [presets.length > 0 && (_jsx("ul", { className: "k-daterange__presets", role: "list", "aria-label": presetsLabel, children: presets.map((p, i) => (_jsx("li", { children: _jsx("button", { type: "button", className: "k-daterange__preset", "aria-pressed": i === activePreset, onClick: () => {
|
|
91
91
|
setDraft(p.range(today));
|
|
92
92
|
setNav((n) => n + 1);
|
|
93
|
-
}, children: p.label }) }, p.label))) })), _jsxs("div", { className: "k-daterange__main", children: [_jsx(Calendar, { range: draft, value: draft.end ?? draft.start, onChange: pick, min: min, max: max, isDateDisabled: isDateDisabled, digits: digits, labels: calendarLabels, autoFocus: true }, nav), _jsxs("div", { className: "k-daterange__footer", children: [_jsx("span", { className: "k-daterange__summary", "aria-live": "polite", children: draft.start && draft.end ? `${fmt(draft.start)}${separator}${fmt(draft.end)}` : draft.start ? pickEnd : "" }), _jsx("button", { type: "button", className: "k-btn k-btn--secondary k-btn--sm", onClick: () => close(), children: cancel }), _jsx("button", { type: "button", className: cx("k-btn k-btn--primary k-btn--sm"), disabled: !draft.start || !draft.end, onClick: () => commit(draft), children: apply })] })] })] }))] }) }));
|
|
93
|
+
}, children: p.label }) }, p.label))) })), _jsxs("div", { className: "k-daterange__main", children: [_jsx(Calendar, { range: draft, value: draft.end ?? draft.start, onChange: pick, min: min, max: max, isDateDisabled: isDateDisabled, holidays: holidays, digits: digits, labels: calendarLabels, autoFocus: true }, nav), _jsxs("div", { className: "k-daterange__footer", children: [_jsx("span", { className: "k-daterange__summary", "aria-live": "polite", children: draft.start && draft.end ? `${fmt(draft.start)}${separator}${fmt(draft.end)}` : draft.start ? pickEnd : "" }), _jsx("button", { type: "button", className: "k-btn k-btn--secondary k-btn--sm", onClick: () => close(), children: cancel }), _jsx("button", { type: "button", className: cx("k-btn k-btn--primary k-btn--sm"), disabled: !draft.start || !draft.end, onClick: () => commit(draft), children: apply })] })] })] }))] }) }));
|
|
94
94
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type ComboboxOption } from "./Combobox.js";
|
|
3
|
+
export interface MultiSelectProps {
|
|
4
|
+
label?: ReactNode;
|
|
5
|
+
hint?: ReactNode;
|
|
6
|
+
error?: ReactNode;
|
|
7
|
+
options: ComboboxOption[];
|
|
8
|
+
value?: string[];
|
|
9
|
+
defaultValue?: string[];
|
|
10
|
+
onChange?: (value: string[]) => void;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
/** بیشترین تعداد انتخاب */
|
|
13
|
+
max?: number;
|
|
14
|
+
filter?: (option: ComboboxOption, query: string) => boolean;
|
|
15
|
+
/** @default "نتیجهای پیدا نشد." */
|
|
16
|
+
emptyMessage?: ReactNode;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/** با name، یک فیلد پنهان برای هر مقدار */
|
|
19
|
+
name?: string;
|
|
20
|
+
id?: string;
|
|
21
|
+
className?: string;
|
|
22
|
+
labels?: {
|
|
23
|
+
remove?: (label: string) => string;
|
|
24
|
+
selected?: (n: number) => string;
|
|
25
|
+
max?: (n: number) => string;
|
|
26
|
+
clear?: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* انتخاب چند گزینه با جستجو؛ انتخابها بهشکل برچسب داخل فیلد.
|
|
31
|
+
* ↑↓ حرکت، Enter انتخاب یا لغو انتخاب، Backspace در فیلد خالی آخرین برچسب را حذف میکند، Esc بستن.
|
|
32
|
+
*/
|
|
33
|
+
export declare function MultiSelect({ label, hint, error, options, value, defaultValue, onChange, placeholder, max, filter, emptyMessage, disabled, name, id, className, labels, }: MultiSelectProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { toFaDigits } from "@kashi-ui/persian";
|
|
4
|
+
import { Badge } from "./Badge.js";
|
|
5
|
+
import { defaultFilter, highlight } from "./Combobox.js";
|
|
6
|
+
import { Field, describedBy } from "./Field.js";
|
|
7
|
+
const Check = () => _jsx("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: "m5 10.5 3.2 3L15 7" }) });
|
|
8
|
+
/**
|
|
9
|
+
* انتخاب چند گزینه با جستجو؛ انتخابها بهشکل برچسب داخل فیلد.
|
|
10
|
+
* ↑↓ حرکت، Enter انتخاب یا لغو انتخاب، Backspace در فیلد خالی آخرین برچسب را حذف میکند، Esc بستن.
|
|
11
|
+
*/
|
|
12
|
+
export function MultiSelect({ label, hint, error, options, value, defaultValue = [], onChange, placeholder, max, filter = defaultFilter, emptyMessage = "نتیجهای پیدا نشد.", disabled, name, id, className, labels = {}, }) {
|
|
13
|
+
const { remove = (l) => `حذف ${l}`, selected: selectedLabel = (n) => `${toFaDigits(n)} مورد انتخاب شده`, max: maxLabel = (n) => `حداکثر ${toFaDigits(n)} مورد`, clear = "پاک کردن همه", } = labels;
|
|
14
|
+
const autoId = useId();
|
|
15
|
+
const inputId = id ?? autoId;
|
|
16
|
+
const listId = `${inputId}-list`;
|
|
17
|
+
const [inner, setInner] = useState(defaultValue);
|
|
18
|
+
const chosen = value ?? inner;
|
|
19
|
+
const [query, setQuery] = useState("");
|
|
20
|
+
const [open, setOpen] = useState(false);
|
|
21
|
+
const [active, setActive] = useState(-1);
|
|
22
|
+
const [announce, setAnnounce] = useState("");
|
|
23
|
+
const input = useRef(null);
|
|
24
|
+
const wrap = useRef(null);
|
|
25
|
+
const filtered = useMemo(() => options.filter((o) => filter(o, query)), [options, query, filter]);
|
|
26
|
+
const full = max !== undefined && chosen.length >= max;
|
|
27
|
+
const set = (next) => {
|
|
28
|
+
if (value === undefined)
|
|
29
|
+
setInner(next);
|
|
30
|
+
onChange?.(next);
|
|
31
|
+
};
|
|
32
|
+
const toggle = (o) => {
|
|
33
|
+
if (o.disabled)
|
|
34
|
+
return;
|
|
35
|
+
const on = chosen.includes(o.value);
|
|
36
|
+
if (!on && full)
|
|
37
|
+
return setAnnounce(maxLabel(max));
|
|
38
|
+
set(on ? chosen.filter((v) => v !== o.value) : [...chosen, o.value]);
|
|
39
|
+
setAnnounce(`${o.label} ${on ? "حذف شد" : "انتخاب شد"}`);
|
|
40
|
+
setQuery("");
|
|
41
|
+
};
|
|
42
|
+
const move = (d) => {
|
|
43
|
+
const en = filtered.map((o, i) => (o.disabled ? -1 : i)).filter((i) => i >= 0);
|
|
44
|
+
if (!en.length)
|
|
45
|
+
return;
|
|
46
|
+
const p = en.indexOf(active);
|
|
47
|
+
setActive(en[(p + d + en.length) % en.length]);
|
|
48
|
+
};
|
|
49
|
+
const onKey = (e) => {
|
|
50
|
+
if (e.key === "ArrowDown") {
|
|
51
|
+
e.preventDefault();
|
|
52
|
+
open ? move(1) : (setOpen(true), setActive(0));
|
|
53
|
+
}
|
|
54
|
+
else if (e.key === "ArrowUp") {
|
|
55
|
+
e.preventDefault();
|
|
56
|
+
open ? move(-1) : setOpen(true);
|
|
57
|
+
}
|
|
58
|
+
else if (e.key === "Enter" && open && filtered[active]) {
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
toggle(filtered[active]);
|
|
61
|
+
}
|
|
62
|
+
else if (e.key === "Escape" && open) {
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
setOpen(false);
|
|
65
|
+
}
|
|
66
|
+
else if (e.key === "Backspace" && !query && chosen.length) {
|
|
67
|
+
const last = options.find((o) => o.value === chosen[chosen.length - 1]);
|
|
68
|
+
set(chosen.slice(0, -1));
|
|
69
|
+
if (last)
|
|
70
|
+
setAnnounce(`${last.label} حذف شد`);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const labelOf = (v) => options.find((o) => o.value === v)?.label ?? v;
|
|
74
|
+
return (_jsx(Field, { id: inputId, label: label, hint: hint, error: error, className: className, children: _jsxs("div", { ref: wrap, className: "k-combobox k-multiselect", "data-open": open ? "" : undefined, onBlur: (e) => !wrap.current?.contains(e.relatedTarget) && setOpen(false), children: [_jsxs("div", { className: "k-tag-input", "data-invalid": error ? "" : undefined, onClick: () => input.current?.focus(), children: [chosen.map((v) => (_jsx(Badge, { tone: "brand", onRemove: disabled ? undefined : () => set(chosen.filter((x) => x !== v)), removeLabel: remove(labelOf(v)), children: labelOf(v) }, v))), _jsx("input", { ref: input, id: inputId, className: "k-tag-input__control", role: "combobox", "aria-autocomplete": "list", "aria-expanded": open, "aria-controls": listId, "aria-activedescendant": open && active >= 0 ? `${listId}-${active}` : undefined, "aria-describedby": describedBy(inputId, hint, error, `${inputId}-count`), "aria-invalid": error ? true : undefined, autoComplete: "off", placeholder: chosen.length ? undefined : placeholder, disabled: disabled, value: query, onChange: (e) => {
|
|
75
|
+
setQuery(e.target.value);
|
|
76
|
+
setOpen(true);
|
|
77
|
+
setActive(0);
|
|
78
|
+
}, onFocus: () => setOpen(true), onKeyDown: onKey }), chosen.length > 1 && !disabled && (_jsx("button", { type: "button", className: "k-input__action", "aria-label": clear, onClick: () => { set([]); input.current?.focus(); }, children: _jsx("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: 1.7, strokeLinecap: "round", "aria-hidden": "true", children: _jsx("path", { d: "m6 6 8 8M14 6l-8 8" }) }) }))] }), _jsxs("ul", { id: listId, role: "listbox", "aria-multiselectable": "true", "aria-label": typeof label === "string" ? label : undefined, className: "k-listbox", hidden: !open, style: { insetBlockStart: "calc(100% + 6px)" }, children: [filtered.length === 0 && _jsx("li", { className: "k-listbox__empty", role: "presentation", children: emptyMessage }), filtered.map((o, i) => {
|
|
79
|
+
const on = chosen.includes(o.value);
|
|
80
|
+
return (_jsxs("li", { id: `${listId}-${i}`, role: "option", "aria-selected": on, "aria-disabled": o.disabled || (!on && full) || undefined, "data-active": i === active ? "" : undefined, className: "k-option k-option--check", onPointerDown: (e) => e.preventDefault(), onClick: () => toggle(o), onPointerMove: () => active !== i && setActive(i), children: [_jsx("span", { className: "k-multiselect__box", "aria-hidden": "true", children: on && _jsx(Check, {}) }), o.icon, _jsxs("span", { className: "k-option__body", children: [_jsx("span", { children: highlight(o.label, query) }), o.description && _jsx("span", { className: "k-option__desc", children: o.description })] })] }, o.value));
|
|
81
|
+
})] }), _jsx("span", { id: `${inputId}-count`, className: "k-sr-only", children: selectedLabel(chosen.length) }), _jsx("span", { className: "k-sr-only", "aria-live": "polite", children: announce }), name && chosen.map((v) => _jsx("input", { type: "hidden", name: name, value: v }, v))] }) }));
|
|
82
|
+
}
|
package/dist/Pagination.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
2
|
/** صفحههایی که نمایش داده میشوند؛ null یعنی «…» */
|
|
3
3
|
export declare function pageRange(page: number, total: number, siblings?: number): (number | null)[];
|
|
4
4
|
export interface PaginationProps {
|
|
@@ -13,13 +13,22 @@ export interface PaginationProps {
|
|
|
13
13
|
summary?: ReactNode;
|
|
14
14
|
/** @default "fa" */
|
|
15
15
|
digits?: "fa" | "latin";
|
|
16
|
+
/** تعداد ردیف در هر صفحه؛ با onPageSizeChange فهرست انتخاب نمایش داده میشود */
|
|
17
|
+
pageSize?: number;
|
|
18
|
+
/** @default [10, 20, 50, 100] */
|
|
19
|
+
pageSizes?: number[];
|
|
20
|
+
onPageSizeChange?: (size: number) => void;
|
|
21
|
+
/** فیلد «برو به صفحه» برای فهرستهای طولانی */
|
|
22
|
+
jumper?: boolean;
|
|
16
23
|
labels?: {
|
|
17
24
|
nav?: string;
|
|
18
25
|
prev?: string;
|
|
19
26
|
next?: string;
|
|
20
27
|
page?: (n: string) => string;
|
|
28
|
+
perPage?: string;
|
|
29
|
+
jump?: string;
|
|
21
30
|
};
|
|
22
31
|
className?: string;
|
|
23
32
|
}
|
|
24
33
|
/** صفحهبندی با ارقام فارسی؛ صفحهٔ فعلی با aria-current="page" */
|
|
25
|
-
export declare function Pagination({ page, total, onChange, getHref, siblings, summary, digits, labels, className }: PaginationProps): import("react").JSX.Element;
|
|
34
|
+
export declare function Pagination({ page, total, onChange, getHref, siblings, summary, digits, pageSize, pageSizes, onPageSizeChange, jumper, labels, className, }: PaginationProps): import("react").JSX.Element;
|
package/dist/Pagination.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
2
3
|
import { toFaDigits } from "@kashi-ui/persian";
|
|
3
4
|
import { cx } from "./cx.js";
|
|
4
5
|
/** صفحههایی که نمایش داده میشوند؛ null یعنی «…» */
|
|
@@ -19,10 +20,17 @@ export function pageRange(page, total, siblings = 1) {
|
|
|
19
20
|
}
|
|
20
21
|
const Chevron = ({ dir }) => (_jsx("svg", { "data-k-mirror": "", viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: 1.7, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: dir === "prev" ? "m12 5-5 5 5 5" : "m8 5 5 5-5 5" }) }));
|
|
21
22
|
/** صفحهبندی با ارقام فارسی؛ صفحهٔ فعلی با aria-current="page" */
|
|
22
|
-
export function Pagination({ page, total, onChange, getHref, siblings = 1, summary, digits = "fa", labels = {}, className }) {
|
|
23
|
+
export function Pagination({ page, total, onChange, getHref, siblings = 1, summary, digits = "fa", pageSize, pageSizes = [10, 20, 50, 100], onPageSizeChange, jumper, labels = {}, className, }) {
|
|
23
24
|
const n = (v) => (digits === "fa" ? toFaDigits(v) : String(v));
|
|
24
|
-
const { nav = "صفحهبندی", prev = "قبلی", next = "بعدی", page: pageLabel = (x) => `صفحهٔ ${x}
|
|
25
|
+
const { nav = "صفحهبندی", prev = "قبلی", next = "بعدی", page: pageLabel = (x) => `صفحهٔ ${x}`, perPage = "در هر صفحه", jump = "برو به صفحه" } = labels;
|
|
26
|
+
const [jumpText, setJumpText] = useState("");
|
|
25
27
|
// تابع معمولی، نه کامپوننت: تا دکمهها با هر رندر دوباره ساخته نشوند و فوکوس کیبورد حفظ شود
|
|
26
28
|
const item = ({ to, children, current, disabled, aria, className: c }) => getHref && !disabled ? (_jsx("a", { className: c, href: getHref(to), "aria-current": current ? "page" : undefined, "aria-label": aria, children: children })) : (_jsx("button", { type: "button", className: c, disabled: disabled, "aria-current": current ? "page" : undefined, "aria-label": aria, onClick: () => onChange?.(to), children: children }));
|
|
27
|
-
return (_jsxs("nav", { className: cx("k-pagination", className), "aria-label": nav, children: [item({ to: page - 1, disabled: page <= 1, className: "k-btn k-btn--secondary k-btn--sm", children: _jsxs(_Fragment, { children: [_jsx(Chevron, { dir: "prev" }), prev] }) }), summary && _jsx("span", { className: "k-pagination__summary", children: summary }), _jsx("ul", { className: "k-pagination__pages", role: "list", children: pageRange(page, total, siblings).map((p, i) => (_jsx("li", { children: p === null ? (_jsx("span", { className: "k-pagination__ellipsis", "aria-hidden": "true", children: "\u2026" })) : (item({ to: p, current: p === page, aria: pageLabel(n(p)), className: "k-pagination__page", children: n(p) })) }, i))) }), item({ to: page + 1, disabled: page >= total, className: "k-btn k-btn--secondary k-btn--sm", children: _jsxs(_Fragment, { children: [next, _jsx(Chevron, { dir: "next" })] }) })] }))
|
|
29
|
+
return (_jsxs("nav", { className: cx("k-pagination", className), "aria-label": nav, children: [item({ to: page - 1, disabled: page <= 1, className: "k-btn k-btn--secondary k-btn--sm", children: _jsxs(_Fragment, { children: [_jsx(Chevron, { dir: "prev" }), prev] }) }), summary && _jsx("span", { className: "k-pagination__summary", children: summary }), _jsx("ul", { className: "k-pagination__pages", role: "list", children: pageRange(page, total, siblings).map((p, i) => (_jsx("li", { children: p === null ? (_jsx("span", { className: "k-pagination__ellipsis", "aria-hidden": "true", children: "\u2026" })) : (item({ to: p, current: p === page, aria: pageLabel(n(p)), className: "k-pagination__page", children: n(p) })) }, i))) }), item({ to: page + 1, disabled: page >= total, className: "k-btn k-btn--secondary k-btn--sm", children: _jsxs(_Fragment, { children: [next, _jsx(Chevron, { dir: "next" })] }) }), (onPageSizeChange || (jumper && onChange)) && (_jsxs("div", { className: "k-pagination__tools", children: [onPageSizeChange && (_jsxs("label", { className: "k-pagination__tool", children: [_jsx("span", { className: "k-select k-select--sm", children: _jsx("select", { className: "k-select__control", value: pageSize, onChange: (e) => onPageSizeChange(Number(e.target.value)), children: pageSizes.map((sz) => _jsx("option", { value: sz, children: n(sz) }, sz)) }) }), _jsx("span", { children: perPage })] })), jumper && onChange && (_jsx("form", { className: "k-pagination__tool", onSubmit: (e) => {
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
const to = Number(jumpText.replace(/[۰-۹]/g, (d) => String("۰۱۲۳۴۵۶۷۸۹".indexOf(d))).replace(/\D/g, ""));
|
|
32
|
+
if (to >= 1 && to <= total)
|
|
33
|
+
onChange(to);
|
|
34
|
+
setJumpText("");
|
|
35
|
+
}, children: _jsxs("label", { className: "k-pagination__tool", children: [_jsx("span", { children: jump }), _jsx("span", { className: "k-input k-input--sm k-pagination__jump", children: _jsx("input", { className: "k-input__control", inputMode: "numeric", dir: "ltr", value: jumpText, placeholder: n(page), "aria-label": `${jump}، از ${n(1)} تا ${n(total)}`, onChange: (e) => setJumpText(e.target.value) }) })] }) }))] }))] }));
|
|
28
36
|
}
|
package/dist/Tabs.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useContext, useId, useRef, useState } from "react";
|
|
3
3
|
import { cx } from "./cx.js";
|
|
4
|
+
import { useIsomorphicLayoutEffect } from "./utils.js";
|
|
4
5
|
const TabsCtx = createContext(null);
|
|
5
6
|
const useTabs = () => {
|
|
6
7
|
const ctx = useContext(TabsCtx);
|
|
@@ -26,7 +27,24 @@ export function Tabs({ value, defaultValue = "", onChange, variant = "line", blo
|
|
|
26
27
|
}
|
|
27
28
|
export function TabList({ className, children, ...rest }) {
|
|
28
29
|
const ref = useRef(null);
|
|
29
|
-
const { orientation } = useTabs();
|
|
30
|
+
const { orientation, selected } = useTabs();
|
|
31
|
+
// نشانگر زبانهٔ فعال که با تغییر زبانه میلغزد؛ تا اندازهگیری نشده، سبک ایستای CSS نمایش داده میشود
|
|
32
|
+
const [box, setBox] = useState(null);
|
|
33
|
+
useIsomorphicLayoutEffect(() => {
|
|
34
|
+
const list = ref.current;
|
|
35
|
+
if (!list)
|
|
36
|
+
return;
|
|
37
|
+
const measure = () => {
|
|
38
|
+
const tab = list.querySelector('[role="tab"][aria-selected="true"]');
|
|
39
|
+
if (!tab)
|
|
40
|
+
return setBox(null);
|
|
41
|
+
setBox({ x: tab.offsetLeft, y: tab.offsetTop, w: tab.offsetWidth, h: tab.offsetHeight });
|
|
42
|
+
};
|
|
43
|
+
measure();
|
|
44
|
+
const ro = new ResizeObserver(measure);
|
|
45
|
+
ro.observe(list);
|
|
46
|
+
return () => ro.disconnect();
|
|
47
|
+
}, [selected]);
|
|
30
48
|
const onKeyDown = (e) => {
|
|
31
49
|
const tabs = [...(ref.current?.querySelectorAll('[role="tab"]:not(:disabled)') ?? [])];
|
|
32
50
|
const i = tabs.indexOf(document.activeElement);
|
|
@@ -43,7 +61,7 @@ export function TabList({ className, children, ...rest }) {
|
|
|
43
61
|
next.focus();
|
|
44
62
|
next.click(); // فعالسازی خودکار با فوکوس
|
|
45
63
|
};
|
|
46
|
-
return (
|
|
64
|
+
return (_jsxs("div", { ref: ref, role: "tablist", "aria-orientation": orientation, className: cx("k-tabs__list", className), "data-indicator": box ? "" : undefined, style: box ? { "--_ix": `${box.x}px`, "--_iy": `${box.y}px`, "--_iw": `${box.w}px`, "--_ih": `${box.h}px` } : undefined, onKeyDown: onKeyDown, ...rest, children: [children, box && _jsx("span", { className: "k-tabs__indicator", "aria-hidden": "true" })] }));
|
|
47
65
|
}
|
|
48
66
|
export function Tab({ value, className, children, disabled, ...rest }) {
|
|
49
67
|
const { id, selected, select } = useTabs();
|
package/dist/index.d.ts
CHANGED
|
@@ -132,3 +132,5 @@ export { Splitter } from "./Splitter.js";
|
|
|
132
132
|
export type { SplitterProps } from "./Splitter.js";
|
|
133
133
|
export { Tour } from "./Tour.js";
|
|
134
134
|
export type { TourProps, TourStep } from "./Tour.js";
|
|
135
|
+
export { MultiSelect } from "./MultiSelect.js";
|
|
136
|
+
export type { MultiSelectProps } from "./MultiSelect.js";
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kashi-ui/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
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": "^0.
|
|
25
|
+
"@kashi-ui/css": "^0.14.0",
|
|
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": "^0.
|
|
63
|
-
"@kashi-ui/persian": "^0.
|
|
62
|
+
"@kashi-ui/bank-logos": "^0.14.0",
|
|
63
|
+
"@kashi-ui/persian": "^0.14.0"
|
|
64
64
|
}
|
|
65
65
|
}
|