@kashi-ui/persian 2.15.1 → 2.16.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.
@@ -0,0 +1,7 @@
1
+ /**
2
+ * شناسهٔ صیادی چک: ۱۶ رقم. الگوریتم رقم کنترل آن عمومی منتشر نشده است،
3
+ * پس فقط طول و رقم بودن بررسی می‌شود (و شناسهٔ تمام‌صفر رد می‌شود). استعلام اصالت با سامانهٔ صیاد است.
4
+ */
5
+ export declare function isValidSayad(value: string): boolean;
6
+ /** "1234567890123456" → "1234 5678 9012 3456" (ارقام لاتین) */
7
+ export declare function formatSayad(value: string): string;
package/dist/cheque.js ADDED
@@ -0,0 +1,13 @@
1
+ import { onlyDigits } from "./digits.js";
2
+ /**
3
+ * شناسهٔ صیادی چک: ۱۶ رقم. الگوریتم رقم کنترل آن عمومی منتشر نشده است،
4
+ * پس فقط طول و رقم بودن بررسی می‌شود (و شناسهٔ تمام‌صفر رد می‌شود). استعلام اصالت با سامانهٔ صیاد است.
5
+ */
6
+ export function isValidSayad(value) {
7
+ const d = onlyDigits(value);
8
+ return /^\d{16}$/.test(d) && !/^0+$/.test(d);
9
+ }
10
+ /** "1234567890123456" → "1234 5678 9012 3456" (ارقام لاتین) */
11
+ export function formatSayad(value) {
12
+ return onlyDigits(value).slice(0, 16).replace(/(\d{4})(?=\d)/g, "$1 ");
13
+ }
@@ -0,0 +1,27 @@
1
+ /** یک بازهٔ کاری، مثل { from: "09:00", to: "13:00" } */
2
+ export interface TimeRange {
3
+ from: string;
4
+ to: string;
5
+ }
6
+ /** ساعت‌های یک روز؛ open: false یعنی تعطیل */
7
+ export interface DayHours {
8
+ open: boolean;
9
+ ranges: TimeRange[];
10
+ }
11
+ /** هفت روز از شنبه تا جمعه */
12
+ export type WeekHours = DayHours[];
13
+ /** ساعت کاری رایج: شنبه تا چهارشنبه ۹ تا ۱۷، پنجشنبه ۹ تا ۱۳، جمعه تعطیل */
14
+ export declare function defaultWeekHours(): WeekHours;
15
+ /** بازهٔ نامعتبر (پایان پیش از شروع یا ساعت غلط) یا هم‌پوشان؛ اندیس بازه‌های مشکل‌دار را برمی‌گرداند */
16
+ export declare function invalidRanges(day: DayHours): number[];
17
+ /** آیا در این لحظه باز است؟ بازهٔ «۲۲:۰۰ تا ۰۲:۰۰» از نیمه‌شب می‌گذرد و تا بامداد روز بعد حساب می‌شود */
18
+ export declare function isOpenAt(week: WeekHours, date?: Date): boolean;
19
+ export interface SummarizeHoursOptions {
20
+ /** @default "fa" */
21
+ locale?: "fa" | "en";
22
+ }
23
+ /**
24
+ * خلاصهٔ خوانا با یکی کردن روزهای پشت‌سرهم که ساعت یکسان دارند:
25
+ * «شنبه تا چهارشنبه ۰۹:۰۰ تا ۱۷:۰۰؛ پنجشنبه ۰۹:۰۰ تا ۱۳:۰۰؛ جمعه تعطیل»
26
+ */
27
+ export declare function summarizeHours(week: WeekHours, { locale }?: SummarizeHoursOptions): string;
package/dist/hours.js ADDED
@@ -0,0 +1,58 @@
1
+ import { WEEKDAYS, WEEKDAYS_EN, jalaliWeekday } from "./jalali.js";
2
+ import { toFaDigits } from "./digits.js";
3
+ import { parseTime } from "./time.js";
4
+ const min = (t) => {
5
+ const p = parseTime(t);
6
+ return p ? p.hours * 60 + p.minutes : NaN;
7
+ };
8
+ /** ساعت کاری رایج: شنبه تا چهارشنبه ۹ تا ۱۷، پنجشنبه ۹ تا ۱۳، جمعه تعطیل */
9
+ export function defaultWeekHours() {
10
+ return Array.from({ length: 7 }, (_, i) => i === 6 ? { open: false, ranges: [] } : { open: true, ranges: [{ from: "09:00", to: i === 5 ? "13:00" : "17:00" }] });
11
+ }
12
+ /** بازهٔ نامعتبر (پایان پیش از شروع یا ساعت غلط) یا هم‌پوشان؛ اندیس بازه‌های مشکل‌دار را برمی‌گرداند */
13
+ export function invalidRanges(day) {
14
+ if (!day.open)
15
+ return [];
16
+ const bad = new Set();
17
+ day.ranges.forEach((r, i) => {
18
+ const a = min(r.from), b = min(r.to);
19
+ if (!(a < b))
20
+ bad.add(i);
21
+ day.ranges.forEach((s, j) => {
22
+ if (j > i && min(s.from) < b && a < min(s.to))
23
+ bad.add(i).add(j);
24
+ });
25
+ });
26
+ return [...bad].sort();
27
+ }
28
+ /** آیا در این لحظه باز است؟ بازهٔ «۲۲:۰۰ تا ۰۲:۰۰» از نیمه‌شب می‌گذرد و تا بامداد روز بعد حساب می‌شود */
29
+ export function isOpenAt(week, date = new Date()) {
30
+ const w = jalaliWeekday(date);
31
+ const now = date.getHours() * 60 + date.getMinutes();
32
+ const today = week[w];
33
+ if (today?.open && today.ranges.some((r) => (min(r.from) < min(r.to) ? now >= min(r.from) && now < min(r.to) : now >= min(r.from))))
34
+ return true;
35
+ const prev = week[(w + 6) % 7];
36
+ return !!prev?.open && prev.ranges.some((r) => min(r.from) > min(r.to) && now < min(r.to));
37
+ }
38
+ /**
39
+ * خلاصهٔ خوانا با یکی کردن روزهای پشت‌سرهم که ساعت یکسان دارند:
40
+ * «شنبه تا چهارشنبه ۰۹:۰۰ تا ۱۷:۰۰؛ پنجشنبه ۰۹:۰۰ تا ۱۳:۰۰؛ جمعه تعطیل»
41
+ */
42
+ export function summarizeHours(week, { locale = "fa" } = {}) {
43
+ const en = locale === "en";
44
+ const names = en ? WEEKDAYS_EN : WEEKDAYS;
45
+ const d = (s) => (en ? s : toFaDigits(s));
46
+ const key = (day) => (day.open && day.ranges.length ? day.ranges.map((r) => `${r.from}-${r.to}`).join(",") : "closed");
47
+ const text = (day) => key(day) === "closed" ? (en ? "closed" : "تعطیل") : day.ranges.map((r) => d(`${r.from}${en ? "–" : " تا "}${r.to}`)).join(en ? ", " : " و ");
48
+ const parts = [];
49
+ for (let i = 0; i < 7;) {
50
+ let j = i;
51
+ while (j + 1 < 7 && key(week[j + 1]) === key(week[i]))
52
+ j++;
53
+ const days = i === j ? names[i] : `${names[i]}${en ? "–" : " تا "}${names[j]}`;
54
+ parts.push(`${days}${en ? ": " : " "}${text(week[i])}`);
55
+ i = j + 1;
56
+ }
57
+ return parts.join(en ? "; " : "؛ ");
58
+ }
package/dist/index.d.ts CHANGED
@@ -28,6 +28,11 @@ export type { IranAddress } from "./address.js";
28
28
  export { IRAN_FIXED_HOLIDAYS, IRAN_FIXED_HOLIDAYS_EN, getIranHoliday } from "./holidays.js";
29
29
  export type { HolidayOptions } from "./holidays.js";
30
30
  export { isValidLegalId } from "./legal-id.js";
31
+ export { isValidSayad, formatSayad } from "./cheque.js";
32
+ export { economicCodeType, isValidEconomicCode, normalizeTaxId, isValidTaxId } from "./tax.js";
33
+ export type { EconomicCodeType } from "./tax.js";
34
+ export { defaultWeekHours, invalidRanges, isOpenAt, summarizeHours } from "./hours.js";
35
+ export type { TimeRange, DayHours, WeekHours, SummarizeHoursOptions } from "./hours.js";
31
36
  export { fixKeyboardLayout, looksLikeWrongLayout } from "./keyboard.js";
32
37
  export { formatMoney, rialToToman, tomanToRial } from "./money.js";
33
38
  export type { FormatMoneyOptions } from "./money.js";
package/dist/index.js CHANGED
@@ -16,6 +16,9 @@ export { CITIES } from "./cities.js";
16
16
  export { getCities, getCityProvinces, formatAddress, EMPTY_ADDRESS } from "./address.js";
17
17
  export { IRAN_FIXED_HOLIDAYS, IRAN_FIXED_HOLIDAYS_EN, getIranHoliday } from "./holidays.js";
18
18
  export { isValidLegalId } from "./legal-id.js";
19
+ export { isValidSayad, formatSayad } from "./cheque.js";
20
+ export { economicCodeType, isValidEconomicCode, normalizeTaxId, isValidTaxId } from "./tax.js";
21
+ export { defaultWeekHours, invalidRanges, isOpenAt, summarizeHours } from "./hours.js";
19
22
  export { fixKeyboardLayout, looksLikeWrongLayout } from "./keyboard.js";
20
23
  export { formatMoney, rialToToman, tomanToRial } from "./money.js";
21
24
  export { faMessages, enMessages, getMessages } from "./messages.js";
@@ -219,6 +219,9 @@ export declare const faMessages: {
219
219
  iban: string;
220
220
  nationalId: string;
221
221
  legalId: string;
222
+ sayad: string;
223
+ economicCode: string;
224
+ taxId: string;
222
225
  mobile: string;
223
226
  landline: string;
224
227
  postal: string;
@@ -328,6 +331,14 @@ export declare const faMessages: {
328
331
  postal: string;
329
332
  time: string;
330
333
  plate: string;
334
+ sayad: string;
335
+ "economic-code": string;
336
+ "tax-id": string;
337
+ };
338
+ taxCode: {
339
+ person: string;
340
+ company: string;
341
+ legacy: string;
331
342
  };
332
343
  textFix: {
333
344
  fix: string;
@@ -439,6 +450,155 @@ export declare const faMessages: {
439
450
  provinceSearch: string;
440
451
  streetHint: string;
441
452
  };
453
+ businessHours: {
454
+ label: string;
455
+ weekdays: string;
456
+ open: string;
457
+ closed: string;
458
+ from: string;
459
+ to: string;
460
+ addRange: string;
461
+ removeRange: string;
462
+ copyAll: string;
463
+ invalid: string;
464
+ openNow: string;
465
+ closedNow: string;
466
+ rangeOf: (day: string, n: string) => string;
467
+ };
468
+ chat: {
469
+ thread: string;
470
+ you: string;
471
+ assistant: string;
472
+ typing: (name: string) => string;
473
+ typingShort: string;
474
+ copy: string;
475
+ copied: string;
476
+ retry: string;
477
+ like: string;
478
+ dislike: string;
479
+ actions: string;
480
+ sending: string;
481
+ sent: string;
482
+ delivered: string;
483
+ read: string;
484
+ failed: string;
485
+ edited: string;
486
+ scrollDown: string;
487
+ newMessages: (n: string) => string;
488
+ };
489
+ composer: {
490
+ label: string;
491
+ placeholder: string;
492
+ send: string;
493
+ stop: string;
494
+ attach: string;
495
+ attachments: string;
496
+ removeAttachment: (name: string) => string;
497
+ hint: string;
498
+ tooMany: (n: string) => string;
499
+ tooLarge: (name: string, size: string) => string;
500
+ };
501
+ streaming: {
502
+ writing: string;
503
+ done: string;
504
+ };
505
+ codeBlock: {
506
+ copy: string;
507
+ copied: string;
508
+ code: (lang: string) => string;
509
+ wrap: string;
510
+ lines: (n: string) => string;
511
+ };
512
+ sortable: {
513
+ handle: (item: string) => string;
514
+ instructions: string;
515
+ grabbed: (item: string, pos: string, total: string) => string;
516
+ moved: (item: string, pos: string, total: string) => string;
517
+ dropped: (item: string, pos: string, total: string) => string;
518
+ cancelled: (item: string) => string;
519
+ };
520
+ kanban: {
521
+ label: string;
522
+ add: string;
523
+ count: (n: string) => string;
524
+ empty: string;
525
+ instructions: string;
526
+ grabbed: (item: string, col: string) => string;
527
+ moved: (item: string, col: string, pos: string) => string;
528
+ dropped: (item: string, col: string, pos: string) => string;
529
+ cancelled: (item: string) => string;
530
+ };
531
+ lightbox: {
532
+ gallery: string;
533
+ label: string;
534
+ open: (alt: string) => string;
535
+ close: string;
536
+ prev: string;
537
+ next: string;
538
+ counter: (n: string, total: string) => string;
539
+ zoomIn: string;
540
+ zoomOut: string;
541
+ };
542
+ richText: {
543
+ label: string;
544
+ toolbar: string;
545
+ bold: string;
546
+ italic: string;
547
+ underline: string;
548
+ strike: string;
549
+ heading: string;
550
+ quote: string;
551
+ bullet: string;
552
+ ordered: string;
553
+ link: string;
554
+ linkUrl: string;
555
+ apply: string;
556
+ unlink: string;
557
+ rtl: string;
558
+ ltr: string;
559
+ undo: string;
560
+ redo: string;
561
+ clear: string;
562
+ placeholder: string;
563
+ zwnj: string;
564
+ words: (n: string) => string;
565
+ chars: (n: string) => string;
566
+ };
567
+ notifications: {
568
+ label: string;
569
+ button: (n: string) => string;
570
+ all: string;
571
+ unread: string;
572
+ markAll: string;
573
+ markRead: string;
574
+ empty: string;
575
+ emptyUnread: string;
576
+ today: string;
577
+ yesterday: string;
578
+ earlier: string;
579
+ settings: string;
580
+ viewAll: string;
581
+ unreadDot: string;
582
+ };
583
+ qr: {
584
+ label: (value: string) => string;
585
+ tooLong: string;
586
+ download: string;
587
+ };
588
+ scheduler: {
589
+ label: string;
590
+ week: string;
591
+ day: string;
592
+ prevWeek: string;
593
+ nextWeek: string;
594
+ prevDay: string;
595
+ nextDay: string;
596
+ now: string;
597
+ view: string;
598
+ events: (n: string) => string;
599
+ noEvents: string;
600
+ slot: (day: string, time: string) => string;
601
+ };
442
602
  };
443
603
  export type KashiMessages = typeof faMessages;
444
604
  export declare const enMessages: KashiMessages;
package/dist/messages.js CHANGED
@@ -85,6 +85,8 @@ export const faMessages = {
85
85
  input: { clear: "پاک کردن", show: "نمایش رمز", hide: "پنهان کردن رمز", checking: "در حال بررسی" },
86
86
  invalid: {
87
87
  card: "شماره کارت معتبر نیست.", iban: "شماره شبا معتبر نیست.", nationalId: "کد ملی معتبر نیست.", legalId: "شناسهٔ ملی معتبر نیست.",
88
+ sayad: "شناسهٔ صیادی باید ۱۶ رقم باشد.", economicCode: "کد اقتصادی معتبر نیست؛ کد ملی، شناسهٔ ملی یا کد ۱۲ رقمی قدیمی را وارد کنید.",
89
+ taxId: "شمارهٔ مالیاتی فاکتور باید ۲۲ نویسه از ارقام و حروف لاتین باشد.",
88
90
  mobile: "شماره موبایل معتبر نیست.", landline: "شمارهٔ تلفن ثابت معتبر نیست.", postal: "کد پستی معتبر نیست.", plate: "پلاک خودرو معتبر نیست.",
89
91
  time: "ساعت معتبر نیست؛ آن را به شکل ۰۹:۳۰ وارد کنید.", timeRange: (a, b) => `ساعت باید بین ${a} و ${b} باشد.`,
90
92
  priceMin: (n) => `مبلغ باید حداقل ${n} باشد.`, priceMax: (n) => `مبلغ باید حداکثر ${n} باشد.`,
@@ -126,7 +128,9 @@ export const faMessages = {
126
128
  persianInput: {
127
129
  text: "متن", "national-id": "کد ملی", "legal-id": "شناسهٔ ملی شرکت", mobile: "شمارهٔ موبایل", landline: "تلفن ثابت",
128
130
  card: "شمارهٔ کارت", iban: "شمارهٔ شبا", price: "مبلغ", postal: "کد پستی", time: "ساعت", plate: "پلاک خودرو",
131
+ sayad: "شناسهٔ صیادی چک", "economic-code": "کد اقتصادی", "tax-id": "شمارهٔ مالیاتی فاکتور",
129
132
  },
133
+ taxCode: { person: "شخص حقیقی", company: "شخص حقوقی", legacy: "کد قدیمی" },
130
134
  textFix: {
131
135
  fix: "اصلاح نگارش", clean: "نگارش متن درست است.", count: (n, summary) => `${n} مورد قابل اصلاح: ${summary}`,
132
136
  arabic: "حرف عربی", zwnj: "نیم‌فاصله", punctuation: "علامت", digits: "رقم", spacing: "فاصله",
@@ -158,6 +162,60 @@ export const faMessages = {
158
162
  legend: "نشانی", province: "استان", city: "شهر", street: "نشانی", plaque: "پلاک", unit: "واحد", postalCode: "کد پستی",
159
163
  provinceSearch: "جستجوی استان", streetHint: "خیابان، کوچه، نام ساختمان",
160
164
  },
165
+ businessHours: {
166
+ label: "ساعت کاری", weekdays: "روزهای کاری", open: "باز", closed: "تعطیل", from: "از", to: "تا",
167
+ addRange: "افزودن بازهٔ دیگر", removeRange: "حذف این بازه", copyAll: "همین ساعت برای همهٔ روزهای باز",
168
+ invalid: "ساعت پایان باید بعد از شروع باشد و بازه‌ها روی هم نیفتند.", openNow: "الان باز است", closedNow: "الان بسته است",
169
+ rangeOf: (day, n) => `بازهٔ ${n} ${day}`,
170
+ },
171
+ chat: {
172
+ thread: "گفتگو", you: "شما", assistant: "دستیار", typing: (name) => `${name} در حال نوشتن است`, typingShort: "در حال نوشتن",
173
+ copy: "کپی پیام", copied: "کپی شد", retry: "تلاش دوباره", like: "پاسخ خوب بود", dislike: "پاسخ خوب نبود", actions: "کارهای پیام",
174
+ sending: "در حال ارسال", sent: "ارسال شد", delivered: "رسید", read: "خوانده شد", failed: "ارسال نشد", edited: "ویرایش‌شده",
175
+ scrollDown: "رفتن به آخرین پیام", newMessages: (n) => `${n} پیام تازه`,
176
+ },
177
+ composer: {
178
+ label: "پیام", placeholder: "پیامتان را بنویسید…", send: "ارسال", stop: "توقف پاسخ", attach: "پیوست فایل",
179
+ attachments: "پیوست‌ها", removeAttachment: (name) => `حذف ${name}`, hint: "Enter برای ارسال، Shift+Enter برای خط تازه",
180
+ tooMany: (n) => `حداکثر ${n} پیوست.`, tooLarge: (name, size) => `${name} بیشتر از ${size} است.`,
181
+ },
182
+ streaming: { writing: "در حال نوشتن پاسخ", done: "پاسخ کامل شد" },
183
+ codeBlock: { copy: "کپی کد", copied: "کپی شد", code: (lang) => `کد ${lang}`, wrap: "شکستن خط‌های بلند", lines: (n) => `${n} خط` },
184
+ sortable: {
185
+ handle: (item) => `جابه‌جا کردن ${item}`, instructions: "برای جابه‌جایی فاصله را بزنید؛ با کلیدهای جهت حرکت دهید، دوباره فاصله برای رها کردن و Escape برای لغو.",
186
+ grabbed: (item, pos, total) => `${item} برداشته شد؛ جای ${pos} از ${total}.`,
187
+ moved: (item, pos, total) => `${item}، جای ${pos} از ${total}`,
188
+ dropped: (item, pos, total) => `${item} در جای ${pos} از ${total} گذاشته شد.`,
189
+ cancelled: (item) => `جابه‌جایی ${item} لغو شد.`,
190
+ },
191
+ kanban: {
192
+ label: "تابلو", add: "افزودن کارت", count: (n) => `${n} کارت`, empty: "کارتی در این ستون نیست؛ کارتی را اینجا بکشید.",
193
+ instructions: "برای جابه‌جایی کارت فاصله را بزنید؛ بالا و پایین داخل ستون، چپ و راست بین ستون‌ها، دوباره فاصله برای رها کردن و Escape برای لغو.",
194
+ grabbed: (item, col) => `${item} از ستون ${col} برداشته شد.`,
195
+ moved: (item, col, pos) => `${item}، ستون ${col}، جای ${pos}`,
196
+ dropped: (item, col, pos) => `${item} در ستون ${col}، جای ${pos} گذاشته شد.`,
197
+ cancelled: (item) => `جابه‌جایی ${item} لغو شد.`,
198
+ },
199
+ lightbox: {
200
+ gallery: "گالری تصاویر", label: "نمایش تصویر", open: (alt) => `بزرگ کردن ${alt}`, close: "بستن", prev: "تصویر قبلی", next: "تصویر بعدی",
201
+ counter: (n, total) => `${n} از ${total}`, zoomIn: "بزرگ‌نمایی", zoomOut: "اندازهٔ عادی",
202
+ },
203
+ richText: {
204
+ label: "ویرایشگر متن", toolbar: "قالب‌بندی", bold: "پررنگ", italic: "کج", underline: "زیرخط", strike: "خط‌خورده", heading: "عنوان",
205
+ quote: "نقل‌قول", bullet: "فهرست نقطه‌ای", ordered: "فهرست شماره‌دار", link: "پیوند", linkUrl: "نشانی پیوند", apply: "ثبت", unlink: "حذف پیوند",
206
+ rtl: "راست‌به‌چپ", ltr: "چپ‌به‌راست", undo: "واگرد", redo: "ازنو", clear: "پاک کردن قالب", placeholder: "بنویسید…",
207
+ zwnj: "Shift+Space نیم‌فاصله می‌گذارد", words: (n) => `${n} کلمه`, chars: (n) => `${n} نویسه`,
208
+ },
209
+ notifications: {
210
+ label: "اعلان‌ها", button: (n) => `اعلان‌ها، ${n} خوانده‌نشده`, all: "همه", unread: "خوانده‌نشده", markAll: "خواندن همه",
211
+ markRead: "علامت خوانده‌شده", empty: "اعلانی ندارید.", emptyUnread: "همهٔ اعلان‌ها را خوانده‌اید.", today: "امروز", yesterday: "دیروز",
212
+ earlier: "قبل‌تر", settings: "تنظیمات اعلان‌ها", viewAll: "دیدن همهٔ اعلان‌ها", unreadDot: "خوانده‌نشده",
213
+ },
214
+ qr: { label: (value) => `کد QR برای ${value}`, tooLong: "این متن برای کد QR خیلی طولانی است.", download: "دانلود کد QR" },
215
+ scheduler: {
216
+ label: "برنامهٔ زمانی", week: "هفته", day: "روز", prevWeek: "هفتهٔ قبل", nextWeek: "هفتهٔ بعد", prevDay: "روز قبل", nextDay: "روز بعد",
217
+ now: "اکنون", view: "نما", events: (n) => `${n} رویداد`, noEvents: "بدون رویداد", slot: (day, time) => `${day} ساعت ${time}، افزودن رویداد`,
218
+ },
161
219
  };
162
220
  export const enMessages = {
163
221
  common: {
@@ -241,6 +299,8 @@ export const enMessages = {
241
299
  input: { clear: "Clear", show: "Show password", hide: "Hide password", checking: "Checking" },
242
300
  invalid: {
243
301
  card: "Invalid card number.", iban: "Invalid IBAN.", nationalId: "Invalid national ID.", legalId: "Invalid company ID.",
302
+ sayad: "A Sayad ID has 16 digits.", economicCode: "Invalid economic code; enter a national ID, company ID or the old 12-digit code.",
303
+ taxId: "An invoice tax ID has 22 Latin letters and digits.",
244
304
  mobile: "Invalid mobile number.", landline: "Invalid phone number.", postal: "Invalid postal code.", plate: "Invalid license plate.",
245
305
  time: "Invalid time; enter it like 09:30.", timeRange: (a, b) => `Time must be between ${a} and ${b}.`,
246
306
  priceMin: (n) => `Amount must be at least ${n}.`, priceMax: (n) => `Amount must be at most ${n}.`,
@@ -282,7 +342,9 @@ export const enMessages = {
282
342
  persianInput: {
283
343
  text: "Text", "national-id": "National ID", "legal-id": "Company ID", mobile: "Mobile number", landline: "Phone number",
284
344
  card: "Card number", iban: "IBAN", price: "Amount", postal: "Postal code", time: "Time", plate: "License plate",
345
+ sayad: "Cheque Sayad ID", "economic-code": "Economic code", "tax-id": "Invoice tax ID",
285
346
  },
347
+ taxCode: { person: "Individual", company: "Company", legacy: "Old code" },
286
348
  textFix: {
287
349
  fix: "Fix writing", clean: "The text looks right.", count: (n, summary) => `${n} fixable: ${summary}`,
288
350
  arabic: "Arabic letters", zwnj: "half-spaces", punctuation: "punctuation", digits: "digits", spacing: "spacing",
@@ -314,6 +376,60 @@ export const enMessages = {
314
376
  legend: "Address", province: "Province", city: "City", street: "Street address", plaque: "No.", unit: "Unit", postalCode: "Postal code",
315
377
  provinceSearch: "Search provinces", streetHint: "Street, alley, building name",
316
378
  },
379
+ businessHours: {
380
+ label: "Business hours", weekdays: "Working days", open: "Open", closed: "Closed", from: "From", to: "To",
381
+ addRange: "Add another range", removeRange: "Remove this range", copyAll: "Use these hours for all open days",
382
+ invalid: "End time must be after the start time and ranges can't overlap.", openNow: "Open now", closedNow: "Closed now",
383
+ rangeOf: (day, n) => `${day}, range ${n}`,
384
+ },
385
+ chat: {
386
+ thread: "Conversation", you: "You", assistant: "Assistant", typing: (name) => `${name} is typing`, typingShort: "Typing",
387
+ copy: "Copy message", copied: "Copied", retry: "Try again", like: "Good response", dislike: "Bad response", actions: "Message actions",
388
+ sending: "Sending", sent: "Sent", delivered: "Delivered", read: "Read", failed: "Not sent", edited: "edited",
389
+ scrollDown: "Jump to latest message", newMessages: (n) => `${n} new messages`,
390
+ },
391
+ composer: {
392
+ label: "Message", placeholder: "Write a message…", send: "Send", stop: "Stop response", attach: "Attach file",
393
+ attachments: "Attachments", removeAttachment: (name) => `Remove ${name}`, hint: "Enter to send, Shift+Enter for a new line",
394
+ tooMany: (n) => `Up to ${n} attachments.`, tooLarge: (name, size) => `${name} is larger than ${size}.`,
395
+ },
396
+ streaming: { writing: "Writing a response", done: "Response complete" },
397
+ codeBlock: { copy: "Copy code", copied: "Copied", code: (lang) => `${lang} code`, wrap: "Wrap long lines", lines: (n) => `${n} lines` },
398
+ sortable: {
399
+ handle: (item) => `Move ${item}`, instructions: "Press Space to pick up; use arrow keys to move, Space again to drop and Escape to cancel.",
400
+ grabbed: (item, pos, total) => `Picked up ${item}; position ${pos} of ${total}.`,
401
+ moved: (item, pos, total) => `${item}, position ${pos} of ${total}`,
402
+ dropped: (item, pos, total) => `Dropped ${item} at position ${pos} of ${total}.`,
403
+ cancelled: (item) => `Move of ${item} cancelled.`,
404
+ },
405
+ kanban: {
406
+ label: "Board", add: "Add card", count: (n) => `${n} cards`, empty: "No cards here; drag one in.",
407
+ instructions: "Press Space to pick up a card; up and down within a column, left and right between columns, Space again to drop and Escape to cancel.",
408
+ grabbed: (item, col) => `Picked up ${item} from ${col}.`,
409
+ moved: (item, col, pos) => `${item}, ${col}, position ${pos}`,
410
+ dropped: (item, col, pos) => `Dropped ${item} in ${col}, position ${pos}.`,
411
+ cancelled: (item) => `Move of ${item} cancelled.`,
412
+ },
413
+ lightbox: {
414
+ gallery: "Image gallery", label: "Image viewer", open: (alt) => `Enlarge ${alt}`, close: "Close", prev: "Previous image", next: "Next image",
415
+ counter: (n, total) => `${n} of ${total}`, zoomIn: "Zoom in", zoomOut: "Actual size",
416
+ },
417
+ richText: {
418
+ label: "Text editor", toolbar: "Formatting", bold: "Bold", italic: "Italic", underline: "Underline", strike: "Strikethrough", heading: "Heading",
419
+ quote: "Quote", bullet: "Bulleted list", ordered: "Numbered list", link: "Link", linkUrl: "Link URL", apply: "Apply", unlink: "Remove link",
420
+ rtl: "Right to left", ltr: "Left to right", undo: "Undo", redo: "Redo", clear: "Clear formatting", placeholder: "Write…",
421
+ zwnj: "Shift+Space inserts a zero-width non-joiner", words: (n) => `${n} words`, chars: (n) => `${n} characters`,
422
+ },
423
+ notifications: {
424
+ label: "Notifications", button: (n) => `Notifications, ${n} unread`, all: "All", unread: "Unread", markAll: "Mark all as read",
425
+ markRead: "Mark as read", empty: "You have no notifications.", emptyUnread: "You're all caught up.", today: "Today", yesterday: "Yesterday",
426
+ earlier: "Earlier", settings: "Notification settings", viewAll: "View all notifications", unreadDot: "Unread",
427
+ },
428
+ qr: { label: (value) => `QR code for ${value}`, tooLong: "This text is too long for a QR code.", download: "Download QR code" },
429
+ scheduler: {
430
+ label: "Schedule", week: "Week", day: "Day", prevWeek: "Previous week", nextWeek: "Next week", prevDay: "Previous day", nextDay: "Next day",
431
+ now: "Now", view: "View", events: (n) => `${n} events`, noEvents: "No events", slot: (day, time) => `${day} at ${time}, add event`,
432
+ },
317
433
  };
318
434
  /** فرهنگ کامل: پایهٔ زبان (fa یا en) به‌اضافهٔ متن‌هایی که خودتان عوض کرده‌اید */
319
435
  export function getMessages(locale = "fa", overrides) {
package/dist/tax.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ export type EconomicCodeType = "person" | "company" | "legacy";
2
+ /**
3
+ * نوع کد اقتصادی از روی طول: از ۱۳۹۸ کد اقتصادی اشخاص حقیقی همان کد ملی (۱۰ رقم)
4
+ * و اشخاص حقوقی همان شناسهٔ ملی (۱۱ رقم) است؛ کد ۱۲ رقمی قدیمی هنوز روی فاکتورهای قدیمی دیده می‌شود.
5
+ */
6
+ export declare function economicCodeType(value: string): EconomicCodeType | null;
7
+ /** کد اقتصادی: ۱۰ رقم با رقم کنترل کد ملی، ۱۱ رقم با رقم کنترل شناسهٔ ملی، یا ۱۲ رقم قدیمی (فقط طول) */
8
+ export declare function isValidEconomicCode(value: string): boolean;
9
+ /** شمارهٔ مالیاتی فاکتور را یکدست می‌کند: ارقام لاتین، حروف بزرگ، بدون فاصله و خط تیره */
10
+ export declare function normalizeTaxId(value: string): string;
11
+ /**
12
+ * شمارهٔ منحصربه‌فرد مالیاتی فاکتور در سامانهٔ مودیان: ۲۲ نویسه از ارقام و حروف لاتین.
13
+ * فقط شکل بررسی می‌شود؛ درستی شماره را فقط خود سامانه تأیید می‌کند.
14
+ */
15
+ export declare function isValidTaxId(value: string): boolean;
package/dist/tax.js ADDED
@@ -0,0 +1,32 @@
1
+ import { onlyDigits, toEnDigits } from "./digits.js";
2
+ import { isValidLegalId } from "./legal-id.js";
3
+ import { isValidNationalId } from "./national-id.js";
4
+ /**
5
+ * نوع کد اقتصادی از روی طول: از ۱۳۹۸ کد اقتصادی اشخاص حقیقی همان کد ملی (۱۰ رقم)
6
+ * و اشخاص حقوقی همان شناسهٔ ملی (۱۱ رقم) است؛ کد ۱۲ رقمی قدیمی هنوز روی فاکتورهای قدیمی دیده می‌شود.
7
+ */
8
+ export function economicCodeType(value) {
9
+ const n = onlyDigits(value).length;
10
+ return n === 10 ? "person" : n === 11 ? "company" : n === 12 ? "legacy" : null;
11
+ }
12
+ /** کد اقتصادی: ۱۰ رقم با رقم کنترل کد ملی، ۱۱ رقم با رقم کنترل شناسهٔ ملی، یا ۱۲ رقم قدیمی (فقط طول) */
13
+ export function isValidEconomicCode(value) {
14
+ const d = onlyDigits(value);
15
+ const type = economicCodeType(d);
16
+ if (type === "person")
17
+ return isValidNationalId(d);
18
+ if (type === "company")
19
+ return isValidLegalId(d);
20
+ return type === "legacy" && !/^0+$/.test(d);
21
+ }
22
+ /** شمارهٔ مالیاتی فاکتور را یکدست می‌کند: ارقام لاتین، حروف بزرگ، بدون فاصله و خط تیره */
23
+ export function normalizeTaxId(value) {
24
+ return toEnDigits(value).toUpperCase().replace(/[^0-9A-Z]/g, "");
25
+ }
26
+ /**
27
+ * شمارهٔ منحصربه‌فرد مالیاتی فاکتور در سامانهٔ مودیان: ۲۲ نویسه از ارقام و حروف لاتین.
28
+ * فقط شکل بررسی می‌شود؛ درستی شماره را فقط خود سامانه تأیید می‌کند.
29
+ */
30
+ export function isValidTaxId(value) {
31
+ return /^[0-9A-Z]{22}$/.test(normalizeTaxId(value));
32
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kashi-ui/persian",
3
- "version": "2.15.1",
3
+ "version": "2.16.0",
4
4
  "description": "ابزارهای فارسی کاشی: تاریخ شمسی، اعتبارسنجی کد ملی و شماره کارت، ارقام فارسی",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",