@kashi-ui/react 2.25.0 → 2.27.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/ActivityHeatmap.js +4 -2
- package/dist/AddressForm.js +3 -2
- package/dist/Alert.js +3 -2
- package/dist/AppointmentPicker.js +4 -2
- package/dist/Avatar.js +5 -3
- package/dist/Badge.js +3 -2
- package/dist/BankBadge.js +2 -2
- package/dist/BankCard.js +4 -2
- package/dist/Banner.js +3 -2
- package/dist/BillInput.js +6 -3
- package/dist/BottomSheet.js +3 -2
- package/dist/Breadcrumb.js +3 -2
- package/dist/BusinessHours.js +6 -3
- package/dist/Button.js +3 -2
- package/dist/Calendar.js +4 -2
- package/dist/CardNumberInput.js +4 -2
- package/dist/Carousel.js +4 -2
- package/dist/Chart.js +6 -4
- package/dist/Chat.js +6 -4
- package/dist/ChatComposer.js +4 -2
- package/dist/CitySelect.js +3 -2
- package/dist/CodeBlock.js +4 -2
- package/dist/ColorPicker.js +6 -3
- package/dist/Combobox.js +4 -2
- package/dist/CommandPalette.js +4 -2
- package/dist/ContextMenu.js +3 -2
- package/dist/CopyButton.js +3 -2
- package/dist/Countdown.js +4 -2
- package/dist/DataTable.js +3 -2
- package/dist/DatePicker.js +4 -2
- package/dist/DateRangePicker.js +7 -5
- package/dist/DateTile.js +2 -2
- package/dist/Dialog.js +3 -2
- package/dist/Drawer.js +3 -2
- package/dist/EconomicCodeInput.js +4 -2
- package/dist/EmptyState.js +3 -2
- package/dist/Field.js +3 -2
- package/dist/FileUpload.d.ts +1 -1
- package/dist/FileUpload.js +9 -6
- package/dist/Gantt.js +4 -2
- package/dist/IbanInput.js +3 -2
- package/dist/ImageCropper.js +4 -2
- package/dist/InfiniteScroll.js +4 -2
- package/dist/InlineEdit.js +3 -2
- package/dist/Input.js +3 -2
- package/dist/Invoice.js +4 -2
- package/dist/IranMap.js +4 -2
- package/dist/Kanban.js +4 -2
- package/dist/KashiProvider.d.ts +731 -3
- package/dist/KashiProvider.js +19 -4
- package/dist/KeyboardFixInput.js +4 -2
- package/dist/LandlineInput.js +4 -2
- package/dist/LegalIdInput.js +4 -2
- package/dist/Lightbox.js +6 -3
- package/dist/Meter.js +4 -2
- package/dist/MobileInput.js +4 -2
- package/dist/Money.js +4 -2
- package/dist/MonthPicker.js +4 -2
- package/dist/MultiSelect.js +4 -2
- package/dist/NationalIdInput.js +4 -2
- package/dist/Navbar.js +3 -2
- package/dist/NotificationCenter.js +6 -3
- package/dist/NumberInput.js +4 -2
- package/dist/OtpInput.js +2 -2
- package/dist/Pagination.js +4 -2
- package/dist/PasswordStrength.js +5 -4
- package/dist/PaymentReceipt.js +4 -2
- package/dist/PersianInput.js +3 -2
- package/dist/PersianTextarea.js +4 -2
- package/dist/PlateInput.js +3 -2
- package/dist/PostalCodeInput.js +4 -2
- package/dist/PriceInput.js +4 -2
- package/dist/PriceRange.js +4 -2
- package/dist/Progress.js +5 -3
- package/dist/ProvinceSelect.js +3 -2
- package/dist/QRCode.js +3 -2
- package/dist/Rating.js +4 -2
- package/dist/RelativeTime.js +2 -2
- package/dist/RichTextEditor.js +4 -2
- package/dist/SayadInput.js +4 -2
- package/dist/Scheduler.js +4 -2
- package/dist/SearchSuggest.js +3 -2
- package/dist/Select.js +3 -2
- package/dist/SideNav.js +3 -2
- package/dist/SignaturePad.js +3 -2
- package/dist/Slider.js +4 -2
- package/dist/Sortable.js +4 -2
- package/dist/Splitter.js +4 -2
- package/dist/Stat.js +4 -2
- package/dist/Stepper.js +4 -2
- package/dist/StreamingText.js +3 -2
- package/dist/SwatchGroup.js +3 -2
- package/dist/TagInput.js +4 -2
- package/dist/TaxIdInput.js +3 -2
- package/dist/TimeClock.js +4 -2
- package/dist/TimeInput.js +4 -2
- package/dist/TimePicker.js +4 -2
- package/dist/Toast.js +3 -2
- package/dist/Tour.js +4 -2
- package/dist/VirtualList.js +4 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +4 -4
package/dist/RichTextEditor.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useId, useRef, useState } from "react";
|
|
4
4
|
import { cx } from "./cx.js";
|
|
5
|
-
import {
|
|
5
|
+
import { useKashiLocale, useMessages } from "./KashiProvider.js";
|
|
6
|
+
import { faRichText } from "@kashi-ui/persian";
|
|
6
7
|
const DEFAULT_TOOLS = ["bold", "italic", "underline", "strike", "|", "heading", "quote", "bullet", "ordered", "|", "link", "direction", "|", "undo", "clear"];
|
|
7
8
|
const ALLOWED = new Set(["P", "BR", "B", "STRONG", "I", "EM", "U", "S", "STRIKE", "DEL", "A", "UL", "OL", "LI", "H2", "H3", "BLOCKQUOTE", "DIV", "SPAN", "CODE"]);
|
|
8
9
|
const BLOCKS = "p, li, h2, h3, blockquote, div";
|
|
@@ -87,7 +88,8 @@ const ICONS = {
|
|
|
87
88
|
const DIR_ICON = I(_jsx("path", { d: "M9 4h6M13 4v12M9 4v8a3 3 0 0 1-3-3 3 3 0 0 1 3-3M4 14l2 2 2-2" }));
|
|
88
89
|
/** ویرایشگر متن غنی سبک و فارسی: جهت هر بند جدا، نیمفاصله با Shift+Space، چسباندن پاکشده و نوار ابزار با کیبورد */
|
|
89
90
|
export function RichTextEditor({ value, defaultValue = "", onChange, label, "aria-label": ariaLabel, placeholder, tools = DEFAULT_TOOLS, minHeight = "8rem", showCount = true, name, hint, error, disabled, className, }) {
|
|
90
|
-
const {
|
|
91
|
+
const M = useMessages({ richText: faRichText });
|
|
92
|
+
const { n } = useKashiLocale();
|
|
91
93
|
const R = M.richText;
|
|
92
94
|
const area = useRef(null);
|
|
93
95
|
const bar = useRef(null);
|
package/dist/SayadInput.js
CHANGED
|
@@ -5,10 +5,12 @@ import { formatSayad, isValidSayad } from "@kashi-ui/persian";
|
|
|
5
5
|
import { Input } from "./Input.js";
|
|
6
6
|
import { useDigitsInput } from "./useDigitsInput.js";
|
|
7
7
|
import { mergeRefs } from "./utils.js";
|
|
8
|
-
import {
|
|
8
|
+
import { useKashiLocale, useMessages } from "./KashiProvider.js";
|
|
9
|
+
import { faInvalid } from "@kashi-ui/persian";
|
|
9
10
|
/** شناسهٔ صیادی چک: ۱۶ رقم در گروههای چهارتایی؛ فقط طول بررسی میشود چون رقم کنترل آن عمومی نیست */
|
|
10
11
|
export const SayadInput = forwardRef(function SayadInput({ value, defaultValue, onValueChange, digits, invalidMessage, error, name, onBlur, placeholder, ...rest }, ref) {
|
|
11
|
-
const
|
|
12
|
+
const M = useMessages({ invalid: faInvalid });
|
|
13
|
+
const { digits: D } = useKashiLocale();
|
|
12
14
|
digits ?? (digits = D);
|
|
13
15
|
invalidMessage ?? (invalidMessage = M.invalid.sayad);
|
|
14
16
|
const { raw, shown, inputRef, handleChange } = useDigitsInput({ value, defaultValue, maxDigits: 16, format: formatSayad, digits });
|
package/dist/Scheduler.js
CHANGED
|
@@ -3,7 +3,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useEffect, useRef, useState } from "react";
|
|
4
4
|
import { formatJalali, formatTime, getIranHoliday, jalaliWeekday, toJalali } from "@kashi-ui/persian";
|
|
5
5
|
import { cx } from "./cx.js";
|
|
6
|
-
import {
|
|
6
|
+
import { useKashiLocale, useMessages } from "./KashiProvider.js";
|
|
7
|
+
import { faCommon, faScheduler } from "@kashi-ui/persian";
|
|
7
8
|
import { SegmentedControl } from "./SegmentedControl.js";
|
|
8
9
|
const day0 = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
9
10
|
const addDays = (d, n) => new Date(d.getFullYear(), d.getMonth(), d.getDate() + n);
|
|
@@ -45,7 +46,8 @@ function layout(list) {
|
|
|
45
46
|
* خط «اکنون»، تعطیلات، و خانههای خالی که با کلیک یا کیبورد (کلیدهای جهت و Enter) رویداد تازه میسازند.
|
|
46
47
|
*/
|
|
47
48
|
export function Scheduler({ events, date, defaultDate, onDateChange, view, defaultView = "week", onViewChange, startHour = 8, endHour = 20, step = 30, onSlotClick, onEventClick, holidays = true, now: nowProp, hourHeight = "3.5rem", className, }) {
|
|
48
|
-
const
|
|
49
|
+
const M = useMessages({ common: faCommon, scheduler: faScheduler });
|
|
50
|
+
const { locale, digits, weekdays, weekdaysShort, months, n } = useKashiLocale();
|
|
49
51
|
const S = M.scheduler;
|
|
50
52
|
const [innerDate, setInnerDate] = useState(() => day0(defaultDate ?? new Date()));
|
|
51
53
|
const [innerView, setInnerView] = useState(defaultView);
|
package/dist/SearchSuggest.js
CHANGED
|
@@ -3,7 +3,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { persianFilter } from "@kashi-ui/persian";
|
|
5
5
|
import { cx } from "./cx.js";
|
|
6
|
-
import {
|
|
6
|
+
import { useMessages } from "./KashiProvider.js";
|
|
7
|
+
import { faSearchSuggest } from "@kashi-ui/persian";
|
|
7
8
|
import { useIsomorphicLayoutEffect } from "./utils.js";
|
|
8
9
|
const norm = (s) => s.replace(/[يى]/g, "ی").replace(/ك/g, "ک").replace(/[\s]+/g, " ").trim().toLowerCase();
|
|
9
10
|
const SearchIcon = () => _jsxs("svg", { viewBox: "0 0 20 20", width: "20", height: "20", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", "aria-hidden": "true", children: [_jsx("circle", { cx: "9.1", cy: "9.1", r: "6.2" }), _jsx("path", { d: "m14 14 3.3 3.3" })] });
|
|
@@ -11,7 +12,7 @@ const TrendIcon = () => _jsx("svg", { viewBox: "0 0 20 20", width: "16", height:
|
|
|
11
12
|
const HistoryIcon = () => _jsx("svg", { viewBox: "0 0 20 20", width: "16", height: "16", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: "M3.3 10a6.7 6.7 0 1 0 1.9-4.7M3.2 2.9v2.6h2.6M10 6.6V10l2.3 1.5" }) });
|
|
12
13
|
/** جعبهٔ جستجو با جستجوهای اخیر و پرطرفدار و پیشنهاد هنگام تایپ (الگوی فروشگاههای اینترنتی) */
|
|
13
14
|
export function SearchSuggest({ value, defaultValue, onChange, onSearch, recent, onClearRecent, storageKey, popular = [], suggestions, placeholder, label, name, className, labels = {}, loading, emptyMessage, }) {
|
|
14
|
-
const {
|
|
15
|
+
const M = useMessages({ searchSuggest: faSearchSuggest });
|
|
15
16
|
const id = useId();
|
|
16
17
|
const listId = `${id}-panel`;
|
|
17
18
|
const [inner, setInner] = useState(defaultValue ?? "");
|
package/dist/Select.js
CHANGED
|
@@ -4,7 +4,8 @@ import { Children, forwardRef, isValidElement, useCallback, useEffect, useId, us
|
|
|
4
4
|
import { cx } from "./cx.js";
|
|
5
5
|
import { Field, describedBy } from "./Field.js";
|
|
6
6
|
import { useIsomorphicLayoutEffect } from "./utils.js";
|
|
7
|
-
import {
|
|
7
|
+
import { useMessages } from "./KashiProvider.js";
|
|
8
|
+
import { faCommon } from "@kashi-ui/persian";
|
|
8
9
|
const textOf = (node) => typeof node === "string" || typeof node === "number" ? String(node)
|
|
9
10
|
: Array.isArray(node) ? node.map(textOf).join("")
|
|
10
11
|
: isValidElement(node) ? textOf(node.props.children) : "";
|
|
@@ -46,7 +47,7 @@ export const Select = forwardRef(function Select({ label, hint, error, placehold
|
|
|
46
47
|
});
|
|
47
48
|
function CustomSelect({ selectId, label, hint, error, placeholder, options, size, required, className, fieldClassName, children, extra, placeholderSelected, rest, forwardedRef, readOnly, loading, emptyMessage, }) {
|
|
48
49
|
const { value, defaultValue, onChange, disabled, name, form, autoComplete, onBlur, onFocus, ...other } = rest;
|
|
49
|
-
const {
|
|
50
|
+
const M = useMessages({ common: faCommon });
|
|
50
51
|
const items = useMemo(() => collect(options, children), [options, children]);
|
|
51
52
|
const opts = items.filter((i) => i.kind === "option");
|
|
52
53
|
const nativeRef = useRef(null);
|
package/dist/SideNav.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useId, useState } from "react";
|
|
4
4
|
import { cx } from "./cx.js";
|
|
5
|
-
import {
|
|
5
|
+
import { useMessages } from "./KashiProvider.js";
|
|
6
|
+
import { faSideNav } from "@kashi-ui/persian";
|
|
6
7
|
const Chevron = () => (_jsx("svg", { className: "k-sidenav__chevron", viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: 1.7, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: "m6 8 4 4 4-4" }) }));
|
|
7
8
|
const hasCurrent = (it) => Boolean(it.current || it.items?.some(hasCurrent));
|
|
8
9
|
function Item({ item, collapsed }) {
|
|
@@ -19,7 +20,7 @@ function Item({ item, collapsed }) {
|
|
|
19
20
|
}
|
|
20
21
|
/** ناوبری کناری پنل مدیریت با گروه، زیرمنو، نشان و حالت جمعشده */
|
|
21
22
|
export function SideNav({ sections, header, footer, collapsed, "aria-label": ariaLabel, className }) {
|
|
22
|
-
const {
|
|
23
|
+
const M = useMessages({ sideNav: faSideNav });
|
|
23
24
|
ariaLabel ?? (ariaLabel = M.sideNav.label);
|
|
24
25
|
const id = useId();
|
|
25
26
|
return (_jsxs("nav", { className: cx("k-sidenav", collapsed && "k-sidenav--collapsed", className), "aria-label": ariaLabel, children: [header && _jsx("div", { className: "k-sidenav__header", children: header }), sections.map((sec, i) => (_jsxs("div", { children: [sec.label && _jsx("p", { className: "k-sidenav__label", id: `${id}-s${i}`, children: sec.label }), _jsx("ul", { className: "k-sidenav__group", role: "list", "aria-labelledby": sec.label ? `${id}-s${i}` : undefined, children: sec.items.map((it) => _jsx(Item, { item: it, collapsed: collapsed }, it.label)) })] }, sec.label ?? i))), footer && _jsx("div", { className: "k-sidenav__footer", children: footer })] }));
|
package/dist/SignaturePad.js
CHANGED
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, useCallback, useEffect, useId, useImperativeHandle, useRef, useState } from "react";
|
|
4
4
|
import { cx } from "./cx.js";
|
|
5
|
-
import {
|
|
5
|
+
import { useMessages } from "./KashiProvider.js";
|
|
6
|
+
import { faCommon, faSignature } from "@kashi-ui/persian";
|
|
6
7
|
const dist = (a, b) => Math.hypot(a[0] - b[0], a[1] - b[1]);
|
|
7
8
|
/**
|
|
8
9
|
* کادر امضا با ماوس، قلم و لمس: خطها نرم (منحنی درجهٔ دو) و پهنایشان با فشار و سرعت قلم تغییر میکند.
|
|
9
10
|
* برگرداندن آخرین خط، پاک کردن، و حالت «تایپ امضا» برای کسی که نمیتواند رسم کند.
|
|
10
11
|
*/
|
|
11
12
|
export const SignaturePad = forwardRef(function SignaturePad({ label, hint, error, onChange, defaultStrokes = [], name, required, disabled, readOnly, allowTyped = true, penWidth = 2.5, exportColor = "#0b0c0f", id, className }, ref) {
|
|
12
|
-
const {
|
|
13
|
+
const M = useMessages({ common: faCommon, signature: faSignature });
|
|
13
14
|
const S = M.signature;
|
|
14
15
|
const autoId = useId();
|
|
15
16
|
const fieldId = id ?? autoId;
|
package/dist/Slider.js
CHANGED
|
@@ -3,7 +3,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useId, useState } from "react";
|
|
4
4
|
import { formatNumber } from "@kashi-ui/persian";
|
|
5
5
|
import { cx } from "./cx.js";
|
|
6
|
-
import {
|
|
6
|
+
import { useKashiLocale, useMessages } from "./KashiProvider.js";
|
|
7
|
+
import { faCommon, faSlider } from "@kashi-ui/persian";
|
|
7
8
|
/** اسلایدر روی <input type="range"> بومی؛ با آرایهٔ دوتایی، بازه با دو دستگیره */
|
|
8
9
|
export function Slider({ label, value, defaultValue, onChange, min = 0, max = 100, step = 1, showValue = true, format, marks, disabled, readOnly, name, className, labels = {}, }) {
|
|
9
10
|
const id = useId();
|
|
@@ -12,7 +13,8 @@ export function Slider({ label, value, defaultValue, onChange, min = 0, max = 10
|
|
|
12
13
|
const current = (value ?? inner);
|
|
13
14
|
const [lo, hi] = Array.isArray(current) ? current : [min, current];
|
|
14
15
|
const pct = (n) => `${((n - min) / (max - min)) * 100}%`;
|
|
15
|
-
const {
|
|
16
|
+
const M = useMessages({ common: faCommon, slider: faSlider });
|
|
17
|
+
const { digits: D } = useKashiLocale();
|
|
16
18
|
format ?? (format = (x) => formatNumber(x, { digits: D }));
|
|
17
19
|
const { from = M.slider.from, to = M.slider.to, separator = M.common.range } = labels;
|
|
18
20
|
const set = (next) => {
|
package/dist/Sortable.js
CHANGED
|
@@ -4,14 +4,16 @@ import { useRef, useState } from "react";
|
|
|
4
4
|
import { cx } from "./cx.js";
|
|
5
5
|
import { move, useFlip } from "./dnd.js";
|
|
6
6
|
import { useIsomorphicLayoutEffect } from "./utils.js";
|
|
7
|
-
import {
|
|
7
|
+
import { useKashiLocale, useMessages } from "./KashiProvider.js";
|
|
8
|
+
import { faSortable } from "@kashi-ui/persian";
|
|
8
9
|
const Grip = () => (_jsx("svg", { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: [6, 10, 14].flatMap((y) => [_jsx("circle", { cx: "7.5", cy: y, r: "1.3" }, `a${y}`), _jsx("circle", { cx: "12.5", cy: y, r: "1.3" }, `b${y}`)]) }));
|
|
9
10
|
/**
|
|
10
11
|
* فهرست کشیدنی: با ماوس و لمس از دستگیره بکشید، یا با کیبورد: فاصله برای برداشتن، کلیدهای جهت برای حرکت،
|
|
11
12
|
* فاصلهٔ دوباره برای رها کردن و Escape برای لغو. هر حرکت برای صفحهخوان اعلام میشود.
|
|
12
13
|
*/
|
|
13
14
|
export function SortableList({ items, getId, getLabel, onReorder, renderItem, "aria-label": ariaLabel, disabled, className }) {
|
|
14
|
-
const {
|
|
15
|
+
const M = useMessages({ sortable: faSortable });
|
|
16
|
+
const { n } = useKashiLocale();
|
|
15
17
|
const S = M.sortable;
|
|
16
18
|
const root = useRef(null);
|
|
17
19
|
// ترتیب پیشنمایش هنگام کشیدن؛ null یعنی همان items
|
package/dist/Splitter.js
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useRef, useState } from "react";
|
|
4
4
|
import { cx } from "./cx.js";
|
|
5
|
-
import {
|
|
5
|
+
import { useKashiLocale, useMessages } from "./KashiProvider.js";
|
|
6
|
+
import { faCommon, faSplitter } from "@kashi-ui/persian";
|
|
6
7
|
/** دو پنل با مرز قابلکشیدن؛ با کیبورد: ←→ (یا ↑↓) پنج درصد، Home/End کمینه و بیشینه */
|
|
7
8
|
export function Splitter({ children, orientation = "horizontal", size, defaultSize = 40, onSizeChange, min = 15, max = 85, label, height, className }) {
|
|
8
|
-
const {
|
|
9
|
+
const M = useMessages({ common: faCommon, splitter: faSplitter });
|
|
10
|
+
const { n } = useKashiLocale();
|
|
9
11
|
label ?? (label = M.splitter.label);
|
|
10
12
|
const [inner, setInner] = useState(defaultSize);
|
|
11
13
|
const current = size ?? inner;
|
package/dist/Stat.js
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
import { cx } from "./cx.js";
|
|
5
|
-
import {
|
|
5
|
+
import { useKashiLocale, useMessages } from "./KashiProvider.js";
|
|
6
|
+
import { faCommon, faStat } from "@kashi-ui/persian";
|
|
6
7
|
const Arrow = ({ dir }) => (_jsx("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: 1.8, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: dir === "up" ? _jsx("path", { d: "M10 15V5m0 0-4 4m4-4 4 4" }) : _jsx("path", { d: "M10 5v10m0 0-4-4m4 4 4-4" }) }));
|
|
7
8
|
/** کارت شاخص کلیدی (KPI) با روند؛ صفحهخوان روند را به شکل «۱۲٪ افزایش» میخواند */
|
|
8
9
|
export const StatCard = forwardRef(function StatCard({ label, value, unit, icon, change, invertTrend, caption, children, labels = {}, loading, className, ...rest }, ref) {
|
|
9
|
-
const {
|
|
10
|
+
const M = useMessages({ common: faCommon, stat: faStat });
|
|
11
|
+
const { n } = useKashiLocale();
|
|
10
12
|
const { up = M.stat.up, down = M.stat.down, flat = M.stat.flat } = labels;
|
|
11
13
|
const dir = change === undefined ? null : change > 0 ? "up" : change < 0 ? "down" : "flat";
|
|
12
14
|
// رنگ بر اساس خوب یا بد بودن، نه جهت
|
package/dist/Stepper.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { cx } from "./cx.js";
|
|
4
|
-
import {
|
|
4
|
+
import { useKashiLocale, useMessages } from "./KashiProvider.js";
|
|
5
|
+
import { faCommon, faStepper } from "@kashi-ui/persian";
|
|
5
6
|
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" }) }));
|
|
6
7
|
/** مراحل یک فرایند؛ مرحلهٔ فعلی با aria-current="step" و وضعیت هر مرحله برای صفحهخوان */
|
|
7
8
|
export function Stepper({ steps, current, orientation = "horizontal", label, labels = {}, className }) {
|
|
8
|
-
const {
|
|
9
|
+
const M = useMessages({ common: faCommon, stepper: faStepper });
|
|
10
|
+
const { n } = useKashiLocale();
|
|
9
11
|
label ?? (label = M.stepper.label);
|
|
10
12
|
const { complete = M.stepper.complete, current: currentLabel = M.stepper.current } = labels;
|
|
11
13
|
return (_jsx("ol", { className: cx("k-steps", orientation === "vertical" && "k-steps--vertical", className), "aria-label": label, children: steps.map((s, i) => {
|
package/dist/StreamingText.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useRef, useState } from "react";
|
|
4
4
|
import { cx } from "./cx.js";
|
|
5
|
-
import {
|
|
5
|
+
import { useMessages } from "./KashiProvider.js";
|
|
6
|
+
import { faStreaming } from "@kashi-ui/persian";
|
|
6
7
|
const reduced = () => typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
7
8
|
/** کلمهها با فاصلهٔ بعدشان؛ نیمفاصله داخل کلمه میماند */
|
|
8
9
|
const words = (s) => s.match(/\S+\s*|\s+/g) ?? [];
|
|
@@ -11,7 +12,7 @@ const words = (s) => s.match(/\S+\s*|\s+/g) ?? [];
|
|
|
11
12
|
* صفحهخوان هر کلمه را جدا نمیخواند: متن تا پایان aria-busy است و پایان پاسخ یک بار اعلام میشود.
|
|
12
13
|
*/
|
|
13
14
|
export function StreamingText({ text, streaming = false, speed, onDone, cursor = true, as: Tag = "p", className }) {
|
|
14
|
-
const {
|
|
15
|
+
const M = useMessages({ streaming: faStreaming });
|
|
15
16
|
const all = words(text);
|
|
16
17
|
const [shown, setShown] = useState(() => (speed && !reduced() ? 0 : all.length));
|
|
17
18
|
// کلمههایی که پیش از این دیده شدهاند انیمیشن نمیگیرند
|
package/dist/SwatchGroup.js
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useId, useState } from "react";
|
|
4
4
|
import { cx } from "./cx.js";
|
|
5
|
-
import {
|
|
5
|
+
import { useMessages } from "./KashiProvider.js";
|
|
6
|
+
import { faSwatch } from "@kashi-ui/persian";
|
|
6
7
|
/** انتخاب رنگ از میان نمونهها (فیلتر رنگ کالا)؛ روی چکباکس یا رادیوی بومی، پس صفحهکلید و فرم خودکار کار میکنند */
|
|
7
8
|
export function SwatchGroup({ options, value, defaultValue, onChange, single = false, label, size = "md", name, readOnly, className }) {
|
|
8
|
-
const {
|
|
9
|
+
const M = useMessages({ swatch: faSwatch });
|
|
9
10
|
const id = useId();
|
|
10
11
|
const [inner, setInner] = useState(defaultValue ?? []);
|
|
11
12
|
const selected = value ?? inner;
|
package/dist/TagInput.js
CHANGED
|
@@ -5,7 +5,8 @@ import { normalizePersian } from "@kashi-ui/persian";
|
|
|
5
5
|
import { Badge } from "./Badge.js";
|
|
6
6
|
import { Field, describedBy } from "./Field.js";
|
|
7
7
|
import { mergeRefs } from "./utils.js";
|
|
8
|
-
import {
|
|
8
|
+
import { useKashiLocale, useMessages } from "./KashiProvider.js";
|
|
9
|
+
import { faCommon, faTagInput } from "@kashi-ui/persian";
|
|
9
10
|
/** ورود چند مقدار، مثل مهارتها یا ایمیلها؛ Enter یا ویرگول (, یا ،) ثبت میکند و Backspace آخری را حذف میکند */
|
|
10
11
|
export const TagInput = forwardRef(function TagInput({ label, hint, error, value, defaultValue = [], onChange, placeholder, separators = ["Enter", ",", "،"], validate, max, allowDuplicates = false, tone = "brand", disabled, readOnly, name, id, className, labels = {}, }, ref) {
|
|
11
12
|
const autoId = useId();
|
|
@@ -16,7 +17,8 @@ export const TagInput = forwardRef(function TagInput({ label, hint, error, value
|
|
|
16
17
|
const [localError, setLocalError] = useState();
|
|
17
18
|
const [announce, setAnnounce] = useState("");
|
|
18
19
|
const inputRef = useRef(null);
|
|
19
|
-
const {
|
|
20
|
+
const M = useMessages({ common: faCommon, tagInput: faTagInput });
|
|
21
|
+
const { n: N } = useKashiLocale();
|
|
20
22
|
const { added = M.common.added, removed = M.common.removed, remove = M.common.remove, max: maxMsg = (x) => M.common.max(N(x)), duplicate = M.tagInput.duplicate, } = labels;
|
|
21
23
|
const set = (next) => {
|
|
22
24
|
if (value === undefined)
|
package/dist/TaxIdInput.js
CHANGED
|
@@ -3,13 +3,14 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
3
3
|
import { forwardRef, useState } from "react";
|
|
4
4
|
import { isValidTaxId, normalizeTaxId } from "@kashi-ui/persian";
|
|
5
5
|
import { Input } from "./Input.js";
|
|
6
|
-
import {
|
|
6
|
+
import { useMessages } from "./KashiProvider.js";
|
|
7
|
+
import { faInvalid } from "@kashi-ui/persian";
|
|
7
8
|
/**
|
|
8
9
|
* شمارهٔ منحصربهفرد مالیاتی فاکتور (سامانهٔ مودیان): ۲۲ نویسه.
|
|
9
10
|
* ارقام فارسی لاتین میشوند، حروف بزرگ و فاصله و خط تیره حذف؛ فقط شکل بررسی میشود.
|
|
10
11
|
*/
|
|
11
12
|
export const TaxIdInput = forwardRef(function TaxIdInput({ value, defaultValue = "", onValueChange, invalidMessage, error, name, onBlur, placeholder, ...rest }, ref) {
|
|
12
|
-
const {
|
|
13
|
+
const M = useMessages({ invalid: faInvalid });
|
|
13
14
|
invalidMessage ?? (invalidMessage = M.invalid.taxId);
|
|
14
15
|
const [inner, setInner] = useState(() => normalizeTaxId(defaultValue).slice(0, 22));
|
|
15
16
|
const [touched, setTouched] = useState(false);
|
package/dist/TimeClock.js
CHANGED
|
@@ -3,7 +3,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useEffect, useRef, useState } from "react";
|
|
4
4
|
import { formatTime, parseTime, toFaDigits } from "@kashi-ui/persian";
|
|
5
5
|
import { cx } from "./cx.js";
|
|
6
|
-
import {
|
|
6
|
+
import { useKashiLocale, useMessages } from "./KashiProvider.js";
|
|
7
|
+
import { faTimePicker } from "@kashi-ui/persian";
|
|
7
8
|
const DAY = 24 * 60;
|
|
8
9
|
const pad = (n) => String(n).padStart(2, "0");
|
|
9
10
|
const toMin = (s) => {
|
|
@@ -22,7 +23,8 @@ const hourAngle = (h) => (h % 12) * 30;
|
|
|
22
23
|
* با کلیک یا کشیدن روی صفحه، یا با کیبورد (↑↓←→، Home/End، Enter) کار میکند.
|
|
23
24
|
*/
|
|
24
25
|
export function TimeClock({ value, defaultValue = null, onChange, onComplete, view, defaultView = "hour", onViewChange, step = 5, min, max, digits, "aria-label": ariaLabel, labels = {}, autoFocus, className, }) {
|
|
25
|
-
const
|
|
26
|
+
const M = useMessages({ timePicker: faTimePicker });
|
|
27
|
+
const { digits: D } = useKashiLocale();
|
|
26
28
|
digits ?? (digits = D);
|
|
27
29
|
ariaLabel ?? (ariaLabel = M.timePicker.clock);
|
|
28
30
|
const { hour: hourLabel = M.timePicker.hour, minute: minuteLabel = M.timePicker.minute } = labels;
|
package/dist/TimeInput.js
CHANGED
|
@@ -3,13 +3,15 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { forwardRef, useEffect, useState } from "react";
|
|
4
4
|
import { formatTime, parseTime, toFaDigits } from "@kashi-ui/persian";
|
|
5
5
|
import { Input } from "./Input.js";
|
|
6
|
-
import {
|
|
6
|
+
import { useKashiLocale, useMessages } from "./KashiProvider.js";
|
|
7
|
+
import { faInvalid } from "@kashi-ui/persian";
|
|
7
8
|
const toMin = (t) => t.hours * 60 + t.minutes;
|
|
8
9
|
const fromMin = (m) => ({ hours: Math.floor(m / 60), minutes: m % 60 });
|
|
9
10
|
const Clock = () => (_jsxs("svg", { viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: 1.7, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [_jsx("circle", { cx: "10", cy: "10", r: "7" }), _jsx("path", { d: "M10 6v4l2.5 2" })] }));
|
|
10
11
|
/** ساعت ۲۴ساعته با ارقام فارسی: «۹۳۰» یا «۹:۳۰» تایپ کنید، ↑↓ گام به گام */
|
|
11
12
|
export const TimeInput = forwardRef(function TimeInput({ value, defaultValue = null, onChange, step = 15, min, max, digits, invalidMessage, rangeMessage, error, name, placeholder, onBlur, onKeyDown, ...rest }, ref) {
|
|
12
|
-
const
|
|
13
|
+
const M = useMessages({ invalid: faInvalid });
|
|
14
|
+
const { digits: D, locale } = useKashiLocale();
|
|
13
15
|
digits ?? (digits = D);
|
|
14
16
|
invalidMessage ?? (invalidMessage = M.invalid.time);
|
|
15
17
|
rangeMessage ?? (rangeMessage = M.invalid.timeRange);
|
package/dist/TimePicker.js
CHANGED
|
@@ -5,13 +5,15 @@ import { formatTime, parseTime, toFaDigits } from "@kashi-ui/persian";
|
|
|
5
5
|
import { TimeClock } from "./TimeClock.js";
|
|
6
6
|
import { TimeInput } from "./TimeInput.js";
|
|
7
7
|
import { useIsomorphicLayoutEffect } from "./utils.js";
|
|
8
|
-
import {
|
|
8
|
+
import { useKashiLocale, useMessages } from "./KashiProvider.js";
|
|
9
|
+
import { faCommon, faTimePicker } from "@kashi-ui/persian";
|
|
9
10
|
/**
|
|
10
11
|
* انتخاب ساعت: تایپ مستقیم (۰۹:۳۰) یا انتخاب از صفحهٔ ساعت عقربهای، کنار دیتپیکر شمسی.
|
|
11
12
|
* با name، مقدار به شکل HH:MM با ارقام لاتین در فرم ارسال میشود.
|
|
12
13
|
*/
|
|
13
14
|
export const TimePicker = forwardRef(function TimePicker({ value, defaultValue = null, onChange, step = 5, min, max, digits, openLabel, showNow = true, readOnly, disabled, ...rest }, ref) {
|
|
14
|
-
const {
|
|
15
|
+
const M = useMessages({ common: faCommon, timePicker: faTimePicker });
|
|
16
|
+
const { digits: D } = useKashiLocale();
|
|
15
17
|
digits ?? (digits = D);
|
|
16
18
|
openLabel ?? (openLabel = M.timePicker.open);
|
|
17
19
|
const id = useId();
|
package/dist/Toast.js
CHANGED
|
@@ -4,7 +4,8 @@ import { useEffect, useId, useRef, useState, useSyncExternalStore } from "react"
|
|
|
4
4
|
import { isDev } from "./utils.js";
|
|
5
5
|
import { cx } from "./cx.js";
|
|
6
6
|
import { CloseIcon, ErrorIcon, InfoIcon, SuccessIcon, WarningIcon } from "./icons.js";
|
|
7
|
-
import {
|
|
7
|
+
import { useMessages } from "./KashiProvider.js";
|
|
8
|
+
import { faToast } from "@kashi-ui/persian";
|
|
8
9
|
// مخزن سادهٔ سراسری؛ هر جای برنامه میتواند toast() را صدا بزند
|
|
9
10
|
let items = [];
|
|
10
11
|
let nextId = 1;
|
|
@@ -90,7 +91,7 @@ const subscribeToasters = (l) => {
|
|
|
90
91
|
};
|
|
91
92
|
/** محل نمایش اعلانها؛ یک بار در ریشهٔ برنامه قرار دهید */
|
|
92
93
|
export function Toaster({ placement, position, max = 5, label, closeLabel }) {
|
|
93
|
-
const {
|
|
94
|
+
const M = useMessages({ toast: faToast });
|
|
94
95
|
label ?? (label = M.toast.region);
|
|
95
96
|
closeLabel ?? (closeLabel = M.toast.close);
|
|
96
97
|
const id = useId();
|
package/dist/Tour.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { useKashiLocale, useMessages } from "./KashiProvider.js";
|
|
5
|
+
import { faCommon, faTour } from "@kashi-ui/persian";
|
|
5
6
|
/**
|
|
6
7
|
* راهنمای قدمبهقدم برای آشنایی با محصول: بخش هر مرحله روشن و بقیه کمرنگ میشود.
|
|
7
8
|
* Esc میبندد، ←→ بین مرحلهها و فوکوس پس از پایان به جای قبلی برمیگردد.
|
|
8
9
|
*/
|
|
9
10
|
export function Tour({ steps, open, onOpenChange, onFinish, labels = {} }) {
|
|
10
11
|
const id = useId();
|
|
11
|
-
const {
|
|
12
|
+
const M = useMessages({ common: faCommon, tour: faTour });
|
|
13
|
+
const { n: N } = useKashiLocale();
|
|
12
14
|
const { next = M.common.next, prev = M.common.prev, done = M.tour.done, skip = M.tour.skip, step: stepLabel = (a, t) => M.tour.step(N(a), N(t)) } = labels;
|
|
13
15
|
const [i, setI] = useState(0);
|
|
14
16
|
const [rect, setRect] = useState(null);
|
package/dist/VirtualList.js
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { cx } from "./cx.js";
|
|
5
|
-
import {
|
|
5
|
+
import { useKashiLocale, useMessages } from "./KashiProvider.js";
|
|
6
|
+
import { faVirtualList } from "@kashi-ui/persian";
|
|
6
7
|
const useIso = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
7
8
|
function VirtualListInner({ items, renderItem, getKey, estimateSize = 48, fixedSize, overscan = 6, height, onEndReached, gap = 0, label, className, style }, ref) {
|
|
8
|
-
const {
|
|
9
|
+
const M = useMessages({ virtualList: faVirtualList });
|
|
10
|
+
const { n } = useKashiLocale();
|
|
9
11
|
const scroller = useRef(null);
|
|
10
12
|
const sizes = useRef(new Map());
|
|
11
13
|
const [version, setVersion] = useState(0);
|
package/dist/index.d.ts
CHANGED
|
@@ -179,7 +179,7 @@ export { PaymentReceipt } from "./PaymentReceipt.js";
|
|
|
179
179
|
export type { PaymentReceiptProps, ReceiptStatus } from "./PaymentReceipt.js";
|
|
180
180
|
export { PersianInput, PERSIAN_INPUT_LABELS } from "./PersianInput.js";
|
|
181
181
|
export type { PersianInputKind, PersianInputKinds, PersianInputProps } from "./PersianInput.js";
|
|
182
|
-
export { KashiProvider, useKashi } from "./KashiProvider.js";
|
|
182
|
+
export { KashiProvider, useKashi, useKashiLocale, useMessages } from "./KashiProvider.js";
|
|
183
183
|
export type { KashiProviderProps } from "./KashiProvider.js";
|
|
184
184
|
export { faMessages, enMessages } from "@kashi-ui/persian";
|
|
185
185
|
export type { KashiMessages, KashiMessagesInput, KashiLocale } from "@kashi-ui/persian";
|
package/dist/index.js
CHANGED
|
@@ -90,7 +90,7 @@ export { BankCard } from "./BankCard.js";
|
|
|
90
90
|
export { DateTile } from "./DateTile.js";
|
|
91
91
|
export { PaymentReceipt } from "./PaymentReceipt.js";
|
|
92
92
|
export { PersianInput, PERSIAN_INPUT_LABELS } from "./PersianInput.js";
|
|
93
|
-
export { KashiProvider, useKashi } from "./KashiProvider.js";
|
|
93
|
+
export { KashiProvider, useKashi, useKashiLocale, useMessages } from "./KashiProvider.js";
|
|
94
94
|
export { faMessages, enMessages } from "@kashi-ui/persian";
|
|
95
95
|
export { SayadInput } from "./SayadInput.js";
|
|
96
96
|
export { EconomicCodeInput } from "./EconomicCodeInput.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kashi-ui/react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.27.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": "^2.
|
|
25
|
+
"@kashi-ui/css": "^2.27.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": "^2.
|
|
63
|
-
"@kashi-ui/persian": "^2.
|
|
62
|
+
"@kashi-ui/bank-logos": "^2.27.0",
|
|
63
|
+
"@kashi-ui/persian": "^2.27.0"
|
|
64
64
|
}
|
|
65
65
|
}
|