@voidable/ui 0.11.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/README.md +1 -1
  2. package/dist/angular/index.d.ts +2 -2
  3. package/dist/angular/index.js +2 -1
  4. package/dist/chunks/activation-B8aBarKd.js +4 -0
  5. package/dist/chunks/carousel-C9u0bg5l.js +10 -0
  6. package/dist/chunks/choice-BTrsi7OW.js +16 -0
  7. package/dist/chunks/data-Baycjoo4.js +96 -0
  8. package/dist/chunks/fields-MEqz-olE.js +21 -0
  9. package/dist/chunks/{form-control-C0vH6gii.js → form-control-fL-Hhy91.js} +49 -48
  10. package/dist/chunks/{keyboard-CEhMSkws.js → keyboard-ChtDvhB_.js} +4 -23
  11. package/dist/chunks/{keyboard-activation-CV0m4hkn.js → keyboard-activation-BfEyoaMT.js} +4 -6
  12. package/dist/chunks/menu-CxRRgkJI.js +21 -0
  13. package/dist/chunks/{modal-DWGkNdNG.js → modal-Cz2-Ov76.js} +23 -15
  14. package/dist/chunks/nav-menu-Bx284Dk6.js +12 -0
  15. package/dist/chunks/{overlay-CH7L4N-h.js → overlay-BuV-4Yvt.js} +75 -68
  16. package/dist/chunks/overlay-K1ilWC1p.js +4 -0
  17. package/dist/chunks/pickers-CjlFgNke.js +36 -0
  18. package/dist/chunks/table-BBpqwWEi.js +4 -0
  19. package/dist/chunks/tabs-Buf3EBWq.js +10 -0
  20. package/dist/components/accordion.d.ts +7 -0
  21. package/dist/components/accordion.js +22 -14
  22. package/dist/components/action-input.d.ts +2 -1
  23. package/dist/components/action-input.js +59 -55
  24. package/dist/components/bar-chart.js +41 -40
  25. package/dist/components/breadcrumbs.d.ts +2 -0
  26. package/dist/components/breadcrumbs.js +15 -11
  27. package/dist/components/button.d.ts +7 -0
  28. package/dist/components/button.js +23 -16
  29. package/dist/components/calendar.d.ts +45 -10
  30. package/dist/components/calendar.js +183 -129
  31. package/dist/components/carousel.d.ts +22 -0
  32. package/dist/components/carousel.js +64 -35
  33. package/dist/components/charts/data.d.ts +2 -2
  34. package/dist/components/checkbox-group.js +22 -21
  35. package/dist/components/checkbox.d.ts +7 -0
  36. package/dist/components/checkbox.js +29 -24
  37. package/dist/components/collapsible.d.ts +7 -0
  38. package/dist/components/collapsible.js +19 -11
  39. package/dist/components/color-picker.js +28 -27
  40. package/dist/components/combobox.d.ts +13 -1
  41. package/dist/components/combobox.js +54 -41
  42. package/dist/components/compose-input.d.ts +9 -1
  43. package/dist/components/compose-input.js +28 -16
  44. package/dist/components/dialog.js +1 -1
  45. package/dist/components/donut-chart.js +57 -56
  46. package/dist/components/drawer.js +1 -1
  47. package/dist/components/dropdown-menu.d.ts +22 -0
  48. package/dist/components/dropdown-menu.js +54 -39
  49. package/dist/components/editable.d.ts +11 -1
  50. package/dist/components/editable.js +35 -22
  51. package/dist/components/error-fallback.d.ts +4 -2
  52. package/dist/components/error-fallback.js +34 -28
  53. package/dist/components/file-upload.d.ts +9 -0
  54. package/dist/components/file-upload.js +54 -28
  55. package/dist/components/gauge.js +108 -107
  56. package/dist/components/hamburger.d.ts +7 -0
  57. package/dist/components/hamburger.js +28 -19
  58. package/dist/components/hover-card.d.ts +7 -0
  59. package/dist/components/hover-card.js +22 -14
  60. package/dist/components/indicator.js +15 -14
  61. package/dist/components/input.js +1 -1
  62. package/dist/components/line-chart.js +43 -42
  63. package/dist/components/menu.d.ts +25 -0
  64. package/dist/components/menu.js +55 -33
  65. package/dist/components/multiselect.d.ts +17 -1
  66. package/dist/components/multiselect.js +96 -74
  67. package/dist/components/nav-menu.d.ts +9 -0
  68. package/dist/components/nav-menu.js +30 -23
  69. package/dist/components/number-input.d.ts +15 -1
  70. package/dist/components/number-input.js +71 -37
  71. package/dist/components/pagination.js +25 -24
  72. package/dist/components/pin-input.d.ts +11 -0
  73. package/dist/components/pin-input.js +46 -32
  74. package/dist/components/popover.d.ts +7 -0
  75. package/dist/components/popover.js +21 -13
  76. package/dist/components/radio-group.js +1 -1
  77. package/dist/components/radio.d.ts +10 -1
  78. package/dist/components/radio.js +37 -32
  79. package/dist/components/segmented-control.d.ts +14 -0
  80. package/dist/components/segmented-control.js +40 -28
  81. package/dist/components/sidebar.d.ts +1 -0
  82. package/dist/components/sidebar.js +14 -10
  83. package/dist/components/slider.js +1 -1
  84. package/dist/components/spinner.d.ts +5 -3
  85. package/dist/components/spinner.js +21 -14
  86. package/dist/components/stat.js +1 -1
  87. package/dist/components/status-dot.d.ts +2 -2
  88. package/dist/components/status-dot.js +12 -14
  89. package/dist/components/stepper.d.ts +2 -0
  90. package/dist/components/stepper.js +20 -13
  91. package/dist/components/switch.d.ts +7 -0
  92. package/dist/components/switch.js +24 -16
  93. package/dist/components/table.d.ts +77 -1
  94. package/dist/components/table.js +562 -73
  95. package/dist/components/tabs.d.ts +11 -0
  96. package/dist/components/tabs.js +42 -33
  97. package/dist/components/tag.js +12 -11
  98. package/dist/components/tags-input.d.ts +10 -1
  99. package/dist/components/tags-input.js +42 -30
  100. package/dist/components/textarea.js +1 -1
  101. package/dist/components/toast.d.ts +2 -0
  102. package/dist/components/toast.js +35 -28
  103. package/dist/components/toggle-group.d.ts +8 -0
  104. package/dist/components/toggle-group.js +24 -17
  105. package/dist/components/toggle.d.ts +7 -0
  106. package/dist/components/toggle.js +23 -15
  107. package/dist/components/tooltip.d.ts +7 -0
  108. package/dist/components/tooltip.js +20 -12
  109. package/dist/components.json +96 -74
  110. package/dist/custom-elements.json +4213 -131
  111. package/dist/dev/rules.d.ts +0 -1
  112. package/dist/dev/types.d.ts +3 -1
  113. package/dist/dev.js +244 -113
  114. package/dist/index.d.ts +4 -0
  115. package/dist/index.js +68 -66
  116. package/dist/keyboard-activation.d.ts +9 -9
  117. package/dist/keyboard.d.ts +2 -10
  118. package/dist/keymaps/activation.d.ts +8 -0
  119. package/dist/keymaps/carousel.d.ts +9 -0
  120. package/dist/keymaps/choice.d.ts +21 -0
  121. package/dist/keymaps/fields.d.ts +31 -0
  122. package/dist/keymaps/index.d.ts +2 -0
  123. package/dist/keymaps/menu.d.ts +36 -0
  124. package/dist/keymaps/nav-menu.d.ts +11 -0
  125. package/dist/keymaps/overlay.d.ts +4 -0
  126. package/dist/keymaps/pickers.d.ts +36 -0
  127. package/dist/keymaps/table.d.ts +8 -0
  128. package/dist/keymaps/tabs.d.ts +7 -0
  129. package/dist/keymaps.js +51 -0
  130. package/dist/keys.d.ts +46 -0
  131. package/dist/keys.js +57 -0
  132. package/dist/llms.txt +11 -3
  133. package/dist/messages/ar.d.ts +1 -0
  134. package/dist/messages/ar.js +130 -0
  135. package/dist/messages/fr.d.ts +1 -0
  136. package/dist/messages/fr.js +109 -0
  137. package/dist/messages.d.ts +213 -0
  138. package/dist/messages.js +190 -0
  139. package/dist/modal.d.ts +7 -0
  140. package/dist/reference.md +817 -17
  141. package/dist/testing/index.d.ts +46 -0
  142. package/dist/testing.js +79 -0
  143. package/dist/types/elements.d.ts +89 -73
  144. package/dist/types/react.d.ts +5 -1
  145. package/dist/types/solid.d.ts +5 -1
  146. package/dist/types/solid2.d.ts +4 -0
  147. package/dist/types/svelte.d.ts +5 -1
  148. package/dist/types/vue.d.ts +5 -1
  149. package/dist/vscode.html-custom-data.json +384 -18
  150. package/dist/web-types.json +830 -69
  151. package/package.json +22 -2
  152. package/dist/chunks/data-BpiiNapL.js +0 -95
@@ -0,0 +1,130 @@
1
+ import { registerMessages as e } from "../messages.js";
2
+ //#region src/messages/ar.ts
3
+ e("ar", {
4
+ close: "إغلاق",
5
+ dismiss: "إغلاق",
6
+ remove: "إزالة",
7
+ removeItem: ({ name: e }) => `إزالة ${e}`,
8
+ valueMissing: "يُرجى ملء هذا الحقل.",
9
+ "checkboxGroup.required": "يُرجى تحديد خانة واحدة على الأقل.",
10
+ "breadcrumbs.label": "مسار التنقل",
11
+ "calendar.label": "التقويم",
12
+ "calendar.previousMonth": "الشهر السابق",
13
+ "calendar.nextMonth": "الشهر التالي",
14
+ "calendar.chooseMonth": "اختيار الشهر",
15
+ "calendar.chooseYear": "اختيار السنة",
16
+ "calendar.previousYear": "السنة السابقة",
17
+ "calendar.nextYear": "السنة التالية",
18
+ "calendar.previousYears": "السنوات السابقة",
19
+ "calendar.nextYears": "السنوات التالية",
20
+ "datePicker.placeholder": "اختر تاريخًا",
21
+ "datePicker.toggle": "إظهار التقويم أو إخفاؤه",
22
+ "datePicker.dialog": "اختيار التاريخ",
23
+ "datePicker.invalid": ({ format: e }) => `أدخل تاريخًا بالصيغة ${e} أو YYYY-MM-DD.`,
24
+ "datePicker.tooEarly": ({ date: e }) => `اختر ${e} أو تاريخًا لاحقًا.`,
25
+ "datePicker.tooLate": ({ date: e }) => `اختر ${e} أو تاريخًا سابقًا.`,
26
+ "carousel.slide": ({ index: e, count: t }) => `${e} من ${t}`,
27
+ "carousel.goTo": ({ index: e }) => `الانتقال إلى الشريحة ${e}`,
28
+ "carousel.indicators": "مؤشرات الشرائح",
29
+ "chart.bar": "مخطط شريطي",
30
+ "chart.line": "مخطط خطي",
31
+ "chart.donut": "مخطط حلقي",
32
+ "chart.gauge": "مقياس",
33
+ "chart.label": "التسمية",
34
+ "chart.segment": "الجزء",
35
+ "chart.value": "القيمة",
36
+ "chart.share": "النسبة",
37
+ "chart.minimum": "الحد الأدنى",
38
+ "chart.maximum": "الحد الأقصى",
39
+ "colorPicker.label": "منتقي الألوان",
40
+ "composeInput.placeholder": "اكتب رسالة...",
41
+ "composeInput.send": "إرسال",
42
+ "combobox.placeholder": "بحث...",
43
+ "combobox.empty": "لم يتم العثور على خيارات",
44
+ "actionInput.action": "إجراء",
45
+ "editable.placeholder": "انقر للتعديل",
46
+ "errorFallback.heading": "حدث خطأ ما",
47
+ "errorFallback.retry": "إعادة المحاولة",
48
+ "fileUpload.prompt": ({ browse: e }) => `أفلت الملفات هنا أو ${e}`,
49
+ "fileUpload.browse": "تصفّح",
50
+ "fileUpload.rejectType": ({ name: e }) => `${e} ليس نوع ملف مقبولًا.`,
51
+ "fileUpload.rejectSize": ({ name: e, limit: t }) => `حجم ${e} يتجاوز الحد المسموح (${t}).`,
52
+ "fileUpload.rejectCount": ({ name: e }) => `لم تتم إضافة ${e}: يمكن اختيار ملف واحد فقط.`,
53
+ "hamburger.open": "القائمة",
54
+ "hamburger.close": "إغلاق القائمة",
55
+ "indicator.label": "إشعار",
56
+ "indicator.count": ({ count: e }, t) => t.plural(e, {
57
+ zero: "لا إشعارات",
58
+ one: "إشعار واحد",
59
+ two: "إشعاران",
60
+ few: `${t.number(e)} إشعارات`,
61
+ many: `${t.number(e)} إشعارًا`,
62
+ other: `${t.number(e)} إشعار`
63
+ }),
64
+ "menu.label": "القائمة",
65
+ "menu.empty": "لا توجد نتائج",
66
+ "multiselect.placeholder": "اختر...",
67
+ "multiselect.selected": ({ count: e }, t) => t.plural(e, {
68
+ zero: "لا شيء محدد",
69
+ one: "محدد واحد",
70
+ two: "محددان",
71
+ few: `${t.number(e)} محددة`,
72
+ many: `${t.number(e)} محددًا`,
73
+ other: `${t.number(e)} محدد`
74
+ }),
75
+ "numberInput.label": "حقل رقمي",
76
+ "numberInput.decrement": "إنقاص",
77
+ "numberInput.increment": "زيادة",
78
+ "pagination.label": "ترقيم الصفحات",
79
+ "pagination.previous": "الصفحة السابقة",
80
+ "pagination.next": "الصفحة التالية",
81
+ "pinInput.label": "رمز PIN",
82
+ "pinInput.digit": ({ index: e, count: t }) => `الرقم ${e} من ${t}`,
83
+ "sidebar.label": "التنقل الجانبي",
84
+ "spinner.label": "جارٍ التحميل",
85
+ "statusDot.online": "متصل",
86
+ "statusDot.away": "بعيد",
87
+ "statusDot.offline": "غير متصل",
88
+ "stepper.label": "التقدّم",
89
+ "table.selectAll": "تحديد كل الصفوف",
90
+ "table.selectAllShown": ({ count: e }, t) => t.plural(e, {
91
+ zero: "لا صفوف معروضة",
92
+ one: "تحديد الصف المعروض",
93
+ two: "تحديد الصفين المعروضين",
94
+ few: `تحديد الصفوف المعروضة (${t.number(e)})`,
95
+ many: `تحديد الصفوف المعروضة (${t.number(e)})`,
96
+ other: `تحديد الصفوف المعروضة (${t.number(e)})`
97
+ }),
98
+ "table.rowsShown": ({ shown: e, total: t }, n) => `${n.number(e)} من ${n.plural(t, {
99
+ zero: "لا صفوف",
100
+ one: "صف واحد",
101
+ two: "صفين",
102
+ few: `${n.number(t)} صفوف`,
103
+ many: `${n.number(t)} صفًا`,
104
+ other: `${n.number(t)} صف`
105
+ })}`,
106
+ "table.rows": ({ count: e }, t) => t.plural(e, {
107
+ zero: "لا صفوف",
108
+ one: "صف واحد",
109
+ two: "صفان",
110
+ few: `${t.number(e)} صفوف`,
111
+ many: `${t.number(e)} صفًا`,
112
+ other: `${t.number(e)} صف`
113
+ }),
114
+ "table.selected": ({ count: e }, t) => t.plural(e, {
115
+ zero: "لا شيء محدد",
116
+ one: "محدد صف واحد",
117
+ two: "محدد صفان",
118
+ few: `محددة ${t.number(e)} صفوف`,
119
+ many: `محدد ${t.number(e)} صفًا`,
120
+ other: `محدد ${t.number(e)} صف`
121
+ }),
122
+ "table.noneSelected": "لم يُحدد أي صف",
123
+ "table.allSelected": ({ count: e }, t) => `تم تحديد جميع الصفوف (${t.number(e)})`,
124
+ "table.sortedAscending": ({ column: e }) => `مرتب حسب ${e}، تصاعديًا`,
125
+ "table.sortedDescending": ({ column: e }) => `مرتب حسب ${e}، تنازليًا`,
126
+ "table.sortCleared": ({ column: e }) => `أُزيل الترتيب حسب ${e}`,
127
+ "tagsInput.placeholder": "أضف وسمًا...",
128
+ "toast.region": "الإشعارات"
129
+ });
130
+ //#endregion
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,109 @@
1
+ import { registerMessages as e } from "../messages.js";
2
+ //#region src/messages/fr.ts
3
+ e("fr", {
4
+ close: "Fermer",
5
+ dismiss: "Fermer",
6
+ remove: "Supprimer",
7
+ removeItem: ({ name: e }) => `Supprimer ${e}`,
8
+ valueMissing: "Veuillez renseigner ce champ.",
9
+ "checkboxGroup.required": "Veuillez cocher au moins une case.",
10
+ "breadcrumbs.label": "Fil d’Ariane",
11
+ "calendar.label": "Calendrier",
12
+ "calendar.previousMonth": "Mois précédent",
13
+ "calendar.nextMonth": "Mois suivant",
14
+ "calendar.chooseMonth": "Choisir le mois",
15
+ "calendar.chooseYear": "Choisir l’année",
16
+ "calendar.previousYear": "Année précédente",
17
+ "calendar.nextYear": "Année suivante",
18
+ "calendar.previousYears": "Années précédentes",
19
+ "calendar.nextYears": "Années suivantes",
20
+ "datePicker.placeholder": "Choisir une date",
21
+ "datePicker.toggle": "Afficher ou masquer le calendrier",
22
+ "datePicker.dialog": "Choisir une date",
23
+ "datePicker.invalid": ({ format: e }) => `Saisissez une date au format ${e} ou AAAA-MM-JJ.`,
24
+ "datePicker.tooEarly": ({ date: e }) => `Choisissez le ${e} ou une date ultérieure.`,
25
+ "datePicker.tooLate": ({ date: e }) => `Choisissez le ${e} ou une date antérieure.`,
26
+ "carousel.slide": ({ index: e, count: t }) => `${e} sur ${t}`,
27
+ "carousel.goTo": ({ index: e }) => `Aller à la diapositive ${e}`,
28
+ "carousel.indicators": "Indicateurs de diapositives",
29
+ "chart.bar": "Graphique à barres",
30
+ "chart.line": "Graphique linéaire",
31
+ "chart.donut": "Graphique en anneau",
32
+ "chart.gauge": "Jauge",
33
+ "chart.label": "Libellé",
34
+ "chart.segment": "Segment",
35
+ "chart.value": "Valeur",
36
+ "chart.share": "Part",
37
+ "chart.minimum": "Minimum",
38
+ "chart.maximum": "Maximum",
39
+ "colorPicker.label": "Sélecteur de couleur",
40
+ "composeInput.placeholder": "Écrivez un message...",
41
+ "composeInput.send": "Envoyer",
42
+ "combobox.placeholder": "Rechercher...",
43
+ "combobox.empty": "Aucune option trouvée",
44
+ "actionInput.action": "Action",
45
+ "editable.placeholder": "Cliquez pour modifier",
46
+ "errorFallback.heading": "Une erreur est survenue",
47
+ "errorFallback.retry": "Réessayer",
48
+ "fileUpload.prompt": ({ browse: e }) => `Déposez des fichiers ici ou ${e}`,
49
+ "fileUpload.browse": "parcourez",
50
+ "fileUpload.rejectType": ({ name: e }) => `${e} n’est pas un type de fichier accepté.`,
51
+ "fileUpload.rejectSize": ({ name: e, limit: t }) => `${e} dépasse la limite de ${t}.`,
52
+ "fileUpload.rejectCount": ({ name: e }) => `${e} n’a pas été ajouté : un seul fichier peut être choisi.`,
53
+ "hamburger.open": "Menu",
54
+ "hamburger.close": "Fermer le menu",
55
+ "indicator.label": "notification",
56
+ "indicator.count": ({ count: e }, t) => `${t.number(e)} ${t.plural(e, {
57
+ one: "notification",
58
+ other: "notifications"
59
+ })}`,
60
+ "menu.label": "Menu",
61
+ "menu.empty": "Aucun résultat",
62
+ "multiselect.placeholder": "Sélectionner...",
63
+ "multiselect.selected": ({ count: e }, t) => `${t.number(e)} ${t.plural(e, {
64
+ one: "sélectionné",
65
+ other: "sélectionnés"
66
+ })}`,
67
+ "numberInput.label": "Champ numérique",
68
+ "numberInput.decrement": "Diminuer",
69
+ "numberInput.increment": "Augmenter",
70
+ "pagination.label": "Pagination",
71
+ "pagination.previous": "Page précédente",
72
+ "pagination.next": "Page suivante",
73
+ "pinInput.label": "Code PIN",
74
+ "pinInput.digit": ({ index: e, count: t }) => `Chiffre ${e} sur ${t}`,
75
+ "sidebar.label": "Navigation latérale",
76
+ "spinner.label": "Chargement",
77
+ "statusDot.online": "En ligne",
78
+ "statusDot.away": "Absent",
79
+ "statusDot.offline": "Hors ligne",
80
+ "stepper.label": "Progression",
81
+ "table.selectAll": "Sélectionner toutes les lignes",
82
+ "table.selectAllShown": ({ count: e }, t) => `Sélectionner les ${t.number(e)} ${t.plural(e, {
83
+ one: "ligne affichée",
84
+ other: "lignes affichées"
85
+ })}`,
86
+ "table.rowsShown": ({ shown: e, total: t }, n) => `${n.number(e)} sur ${n.number(t)} ${n.plural(t, {
87
+ one: "ligne",
88
+ other: "lignes"
89
+ })}`,
90
+ "table.rows": ({ count: e }, t) => `${t.number(e)} ${t.plural(e, {
91
+ one: "ligne",
92
+ other: "lignes"
93
+ })}`,
94
+ "table.selected": ({ count: e }, t) => `${t.number(e)} ${t.plural(e, {
95
+ one: "sélectionnée",
96
+ other: "sélectionnées"
97
+ })}`,
98
+ "table.noneSelected": "Aucune ligne sélectionnée",
99
+ "table.allSelected": ({ count: e }, t) => `${t.plural(e, {
100
+ one: "La ligne est sélectionnée",
101
+ other: `Les ${t.number(e)} lignes sont sélectionnées`
102
+ })}`,
103
+ "table.sortedAscending": ({ column: e }) => `Trié par ${e}, ordre croissant`,
104
+ "table.sortedDescending": ({ column: e }) => `Trié par ${e}, ordre décroissant`,
105
+ "table.sortCleared": ({ column: e }) => `Tri par ${e} supprimé`,
106
+ "tagsInput.placeholder": "Ajouter une étiquette...",
107
+ "toast.region": "Notifications"
108
+ });
109
+ //#endregion
@@ -0,0 +1,213 @@
1
+ /**
2
+ * Built-in strings and the locale a component formats with (#29).
3
+ *
4
+ * Every word the library writes itself (an accessible name, a placeholder, an error, the headers of a chart's
5
+ * data table) is a message in this catalogue, in English. `registerMessages(locale, messages)` adds or overrides
6
+ * a locale; a component looks its strings up through the closest `lang` of the element, so a page, a section or
7
+ * one element can be in another language. An attribute the author writes (`aria-label`, `placeholder`, a label
8
+ * part) always wins over a message.
9
+ *
10
+ * Only components that have strings import this module, and the registry is kept on `globalThis` (not in a
11
+ * module variable) so that two copies of the library, or a module-federated one, share one set of locales.
12
+ */
13
+ /** What a message may be given: counts, names, formatted values. `undefined` means the message takes none. */
14
+ export interface MessageParameters {
15
+ /** The close button of a dialog or drawer. */
16
+ close: undefined;
17
+ /** The close button `toast()` writes. */
18
+ dismiss: undefined;
19
+ /** The remove button of a tag. */
20
+ remove: undefined;
21
+ /** The remove button of one chosen item (a multiselect chip, a tag in a tags input, a file). */
22
+ removeItem: {
23
+ name: string;
24
+ };
25
+ /** A required control with no value. */
26
+ valueMissing: undefined;
27
+ /** A required checkbox group with nothing checked. */
28
+ 'checkboxGroup.required': undefined;
29
+ 'breadcrumbs.label': undefined;
30
+ 'calendar.label': undefined;
31
+ 'calendar.previousMonth': undefined;
32
+ 'calendar.nextMonth': undefined;
33
+ 'calendar.chooseMonth': undefined;
34
+ 'calendar.chooseYear': undefined;
35
+ 'calendar.previousYear': undefined;
36
+ 'calendar.nextYear': undefined;
37
+ 'calendar.previousYears': undefined;
38
+ 'calendar.nextYears': undefined;
39
+ 'datePicker.placeholder': undefined;
40
+ 'datePicker.toggle': undefined;
41
+ 'datePicker.dialog': undefined;
42
+ /** A typed date that is not a date: `format` is the field's `format`. */
43
+ 'datePicker.invalid': {
44
+ format: string;
45
+ };
46
+ /** A typed date before `min`; `date` is `min` written in the field's format. */
47
+ 'datePicker.tooEarly': {
48
+ date: string;
49
+ };
50
+ /** A typed date after `max`; `date` is `max` written in the field's format. */
51
+ 'datePicker.tooLate': {
52
+ date: string;
53
+ };
54
+ /** The name of one slide: its place among the others. */
55
+ 'carousel.slide': {
56
+ index: number;
57
+ count: number;
58
+ };
59
+ /** The name of one dot of the slide indicators. */
60
+ 'carousel.goTo': {
61
+ index: number;
62
+ count: number;
63
+ };
64
+ 'carousel.indicators': undefined;
65
+ 'chart.bar': undefined;
66
+ 'chart.line': undefined;
67
+ 'chart.donut': undefined;
68
+ 'chart.gauge': undefined;
69
+ /** Header of the first column of a line or bar chart's data table. */
70
+ 'chart.label': undefined;
71
+ 'chart.segment': undefined;
72
+ 'chart.value': undefined;
73
+ 'chart.share': undefined;
74
+ 'chart.minimum': undefined;
75
+ 'chart.maximum': undefined;
76
+ 'colorPicker.label': undefined;
77
+ 'composeInput.placeholder': undefined;
78
+ 'composeInput.send': undefined;
79
+ 'combobox.placeholder': undefined;
80
+ 'combobox.empty': undefined;
81
+ 'actionInput.action': undefined;
82
+ 'editable.placeholder': undefined;
83
+ 'errorFallback.heading': undefined;
84
+ 'errorFallback.retry': undefined;
85
+ /** The drop zone's text; `browse` is the word `fileUpload.browse`, which the component draws as the link. */
86
+ 'fileUpload.prompt': {
87
+ browse: string;
88
+ };
89
+ 'fileUpload.browse': undefined;
90
+ 'fileUpload.rejectType': {
91
+ name: string;
92
+ };
93
+ /** `limit` is the size limit written as a number of bytes in the element's locale. */
94
+ 'fileUpload.rejectSize': {
95
+ name: string;
96
+ limit: string;
97
+ };
98
+ 'fileUpload.rejectCount': {
99
+ name: string;
100
+ };
101
+ 'hamburger.open': undefined;
102
+ 'hamburger.close': undefined;
103
+ /** The name of an indicator with no count. */
104
+ 'indicator.label': undefined;
105
+ /** The name of an indicator with a count. */
106
+ 'indicator.count': {
107
+ count: number;
108
+ };
109
+ 'menu.label': undefined;
110
+ 'menu.empty': undefined;
111
+ 'multiselect.placeholder': undefined;
112
+ /** The description of a multiselect with chosen options: how many. */
113
+ 'multiselect.selected': {
114
+ count: number;
115
+ };
116
+ 'numberInput.label': undefined;
117
+ 'numberInput.decrement': undefined;
118
+ 'numberInput.increment': undefined;
119
+ 'pagination.label': undefined;
120
+ 'pagination.previous': undefined;
121
+ 'pagination.next': undefined;
122
+ 'pinInput.label': undefined;
123
+ /** The name of one cell of a PIN input. */
124
+ 'pinInput.digit': {
125
+ index: number;
126
+ count: number;
127
+ };
128
+ 'sidebar.label': undefined;
129
+ 'spinner.label': undefined;
130
+ 'statusDot.online': undefined;
131
+ 'statusDot.away': undefined;
132
+ 'statusDot.offline': undefined;
133
+ 'stepper.label': undefined;
134
+ /** The name of the header checkbox of a selectable table: it selects every row. */
135
+ 'table.selectAll': undefined;
136
+ /** The name of the header checkbox while a filter hides rows: `count` is how many rows are shown. */
137
+ 'table.selectAllShown': {
138
+ count: number;
139
+ };
140
+ /** The announcement after a filter: `shown` of `total` rows. */
141
+ 'table.rowsShown': {
142
+ shown: number;
143
+ total: number;
144
+ };
145
+ /** The announcement of the number of rows (no filter, or a manual table). */
146
+ 'table.rows': {
147
+ count: number;
148
+ };
149
+ /** The announcement after a selection changed: how many rows are selected. */
150
+ 'table.selected': {
151
+ count: number;
152
+ };
153
+ 'table.noneSelected': undefined;
154
+ /** The announcement after select-all across pages: every one of `count` rows. */
155
+ 'table.allSelected': {
156
+ count: number;
157
+ };
158
+ /** The announcements after sorting; `column` is the column's name. */
159
+ 'table.sortedAscending': {
160
+ column: string;
161
+ };
162
+ 'table.sortedDescending': {
163
+ column: string;
164
+ };
165
+ 'table.sortCleared': {
166
+ column: string;
167
+ };
168
+ 'tagsInput.placeholder': undefined;
169
+ 'toast.region': undefined;
170
+ }
171
+ export type MessageKey = keyof MessageParameters;
172
+ /** What a message function is told besides its parameters. */
173
+ export interface MessageContext {
174
+ /** The locale the message was registered for (`ar`, `pt-br`): use it for number formatting. */
175
+ locale: string;
176
+ /** The word form for a count by this locale's plural rules (`Intl.PluralRules`): `plural(n, { one: 'file', other: 'files' })`. `other` is required. */
177
+ plural: (n: number, forms: Partial<Record<Intl.LDMLPluralRule, string>> & {
178
+ other: string;
179
+ }) => string;
180
+ /** The number written for this locale. */
181
+ number: (n: number) => string;
182
+ }
183
+ /** A message: a string, or a function of the parameters the key takes. */
184
+ export type Message<K extends MessageKey = MessageKey> = MessageParameters[K] extends undefined ? string : string | ((params: MessageParameters[K], context: MessageContext) => string);
185
+ /** A set of messages for one locale, as `registerMessages` takes it: any of the keys. */
186
+ export type Messages = {
187
+ [K in MessageKey]?: Message<K>;
188
+ };
189
+ /** The English messages, for tooling (the catalogue docs, the manifest). */
190
+ export declare const englishMessages: Readonly<{
191
+ [K in MessageKey]: Message<K>;
192
+ }>;
193
+ /**
194
+ * Adds messages for a locale, or overrides some of the ones it has (also English: `registerMessages('en', {
195
+ * 'pagination.next': 'Next' })`). `locale` is a BCP 47 tag; an element in `pt-BR` uses `pt-BR`, then `pt`, then
196
+ * English, key by key, so a locale only needs the messages that differ from its parent. Elements already on the
197
+ * page are redrawn.
198
+ */
199
+ export declare function registerMessages(locale: string, messages: Messages): void;
200
+ /** The `lang` an element is in: its closest non-empty `lang` (the page's included), else English. */
201
+ export declare function langOf(el: Element | null): string;
202
+ /**
203
+ * The locale to format dates and numbers in: the element's own `locale` when it has one, else the closest
204
+ * `lang`, else the page's, else `en-US`.
205
+ */
206
+ export declare function localeOf(el: Element, own?: string | null): string;
207
+ /**
208
+ * The message `key` for the language of `el`, with `params` where the key takes them. The search goes from the
209
+ * element's `lang` through its regions to English, per key. The element is redrawn (`requestUpdate`) when
210
+ * that `lang` changes or a locale is registered, so call it from `render()` or `updated()`.
211
+ */
212
+ export declare function msg<K extends MessageKey>(el: Element | null, key: K, ...params: MessageParameters[K] extends undefined ? [] : [MessageParameters[K]]): string;
213
+ export declare function nameHost(el: Element, text: string | null, set: (name: string, value: string | null) => void, attr?: string): void;
@@ -0,0 +1,190 @@
1
+ //#region src/messages.ts
2
+ var e = {
3
+ close: "Close",
4
+ dismiss: "Dismiss",
5
+ remove: "Remove",
6
+ removeItem: ({ name: e }) => `Remove ${e}`,
7
+ valueMissing: "Please fill out this field.",
8
+ "checkboxGroup.required": "Please check at least one box.",
9
+ "breadcrumbs.label": "Breadcrumb",
10
+ "calendar.label": "Calendar",
11
+ "calendar.previousMonth": "Previous month",
12
+ "calendar.nextMonth": "Next month",
13
+ "calendar.chooseMonth": "Switch to month picker",
14
+ "calendar.chooseYear": "Switch to year picker",
15
+ "calendar.previousYear": "Previous year",
16
+ "calendar.nextYear": "Next year",
17
+ "calendar.previousYears": "Previous years",
18
+ "calendar.nextYears": "Next years",
19
+ "datePicker.placeholder": "Select date",
20
+ "datePicker.toggle": "Toggle calendar",
21
+ "datePicker.dialog": "Choose date",
22
+ "datePicker.invalid": ({ format: e }) => `Enter a date as ${e} or YYYY-MM-DD.`,
23
+ "datePicker.tooEarly": ({ date: e }) => `Choose ${e} or a later date.`,
24
+ "datePicker.tooLate": ({ date: e }) => `Choose ${e} or an earlier date.`,
25
+ "carousel.slide": ({ index: e, count: t }) => `${e} of ${t}`,
26
+ "carousel.goTo": ({ index: e }) => `Go to slide ${e}`,
27
+ "carousel.indicators": "Slide indicators",
28
+ "chart.bar": "Bar chart",
29
+ "chart.line": "Line chart",
30
+ "chart.donut": "Donut chart",
31
+ "chart.gauge": "Gauge chart",
32
+ "chart.label": "Label",
33
+ "chart.segment": "Segment",
34
+ "chart.value": "Value",
35
+ "chart.share": "Share",
36
+ "chart.minimum": "Minimum",
37
+ "chart.maximum": "Maximum",
38
+ "colorPicker.label": "Color picker",
39
+ "composeInput.placeholder": "Type a message...",
40
+ "composeInput.send": "Send",
41
+ "combobox.placeholder": "Search...",
42
+ "combobox.empty": "No options found",
43
+ "actionInput.action": "Action",
44
+ "editable.placeholder": "Click to edit",
45
+ "errorFallback.heading": "Something went wrong",
46
+ "errorFallback.retry": "Try again",
47
+ "fileUpload.prompt": ({ browse: e }) => `Drop files here or ${e}`,
48
+ "fileUpload.browse": "browse",
49
+ "fileUpload.rejectType": ({ name: e }) => `${e} is not an accepted file type.`,
50
+ "fileUpload.rejectSize": ({ name: e, limit: t }) => `${e} is larger than the limit of ${t}.`,
51
+ "fileUpload.rejectCount": ({ name: e }) => `${e} was not added: only one file can be chosen.`,
52
+ "hamburger.open": "Menu",
53
+ "hamburger.close": "Close menu",
54
+ "indicator.label": "notification",
55
+ "indicator.count": ({ count: e }, t) => `${t.number(e)} ${t.plural(e, {
56
+ one: "notification",
57
+ other: "notifications"
58
+ })}`,
59
+ "menu.label": "Menu",
60
+ "menu.empty": "No results found",
61
+ "multiselect.placeholder": "Select...",
62
+ "multiselect.selected": ({ count: e }, t) => `${t.number(e)} selected`,
63
+ "numberInput.label": "Number input",
64
+ "numberInput.decrement": "Decrement",
65
+ "numberInput.increment": "Increment",
66
+ "pagination.label": "Pagination",
67
+ "pagination.previous": "Previous page",
68
+ "pagination.next": "Next page",
69
+ "pinInput.label": "PIN input",
70
+ "pinInput.digit": ({ index: e, count: t }) => `Digit ${e} of ${t}`,
71
+ "sidebar.label": "Sidebar navigation",
72
+ "spinner.label": "Loading",
73
+ "statusDot.online": "Online",
74
+ "statusDot.away": "Away",
75
+ "statusDot.offline": "Offline",
76
+ "stepper.label": "Progress",
77
+ "table.selectAll": "Select all rows",
78
+ "table.selectAllShown": ({ count: e }, t) => `Select all ${t.number(e)} shown ${t.plural(e, {
79
+ one: "row",
80
+ other: "rows"
81
+ })}`,
82
+ "table.rowsShown": ({ shown: e, total: t }, n) => `${n.number(e)} of ${n.number(t)} ${n.plural(t, {
83
+ one: "row",
84
+ other: "rows"
85
+ })}`,
86
+ "table.rows": ({ count: e }, t) => `${t.number(e)} ${t.plural(e, {
87
+ one: "row",
88
+ other: "rows"
89
+ })}`,
90
+ "table.selected": ({ count: e }, t) => `${t.number(e)} selected`,
91
+ "table.noneSelected": "No rows selected",
92
+ "table.allSelected": ({ count: e }, t) => `All ${t.number(e)} ${t.plural(e, {
93
+ one: "row",
94
+ other: "rows"
95
+ })} selected`,
96
+ "table.sortedAscending": ({ column: e }) => `Sorted by ${e}, ascending`,
97
+ "table.sortedDescending": ({ column: e }) => `Sorted by ${e}, descending`,
98
+ "table.sortCleared": ({ column: e }) => `Sorting by ${e} removed`,
99
+ "tagsInput.placeholder": "Add tag...",
100
+ "toast.region": "Notifications"
101
+ }, t = "en", n = e, r = Symbol.for("@voidable/ui/messages");
102
+ function i() {
103
+ let n = globalThis;
104
+ return n[r] ??= {
105
+ locales: new Map([[t, e]]),
106
+ plurals: /* @__PURE__ */ new Map(),
107
+ watched: /* @__PURE__ */ new Set(),
108
+ seen: /* @__PURE__ */ new WeakMap(),
109
+ observer: null
110
+ };
111
+ }
112
+ var a = (e) => e.trim().replace(/_/g, "-").toLowerCase();
113
+ function o(e, t) {
114
+ let n = i(), r = a(e);
115
+ n.locales.set(r, {
116
+ ...n.locales.get(r),
117
+ ...t
118
+ }), h(n, null);
119
+ }
120
+ function s(e) {
121
+ return e === null ? t : (m(e), e.closest("[lang]:not([lang=\"\"])")?.getAttribute("lang")?.trim() || t);
122
+ }
123
+ function c(e, n) {
124
+ let r = n || s(e);
125
+ return r === t ? "en-US" : r;
126
+ }
127
+ function l(e) {
128
+ let t = a(e).split("-"), n = [];
129
+ for (let e = t.length; e > 0; e--) n.push(t.slice(0, e).join("-"));
130
+ return n;
131
+ }
132
+ function u(e, n) {
133
+ let r = e.plurals.get(n);
134
+ if (!r) {
135
+ try {
136
+ r = new Intl.PluralRules(n);
137
+ } catch {
138
+ r = new Intl.PluralRules(t);
139
+ }
140
+ e.plurals.set(n, r);
141
+ }
142
+ let i = r;
143
+ return {
144
+ locale: n,
145
+ plural: (e, t) => t[i.select(e)] ?? t.other,
146
+ number: (e) => {
147
+ try {
148
+ return new Intl.NumberFormat(n).format(e);
149
+ } catch {
150
+ return String(e);
151
+ }
152
+ }
153
+ };
154
+ }
155
+ function d(e, n, ...r) {
156
+ let a = i(), o = s(e);
157
+ for (let e of [...l(o), t]) {
158
+ let t = a.locales.get(e)?.[n];
159
+ if (t !== void 0) return typeof t == "string" ? t : t(r[0], u(a, e));
160
+ }
161
+ return n;
162
+ }
163
+ var f = /* @__PURE__ */ new WeakMap();
164
+ function p(e, t, n, r = "aria-label") {
165
+ let i = f.get(e)?.get(r), a = e.getAttribute(r);
166
+ a !== null && a !== i || (t === null ? f.get(e)?.delete(r) : (f.get(e) ?? f.set(e, /* @__PURE__ */ new Map()).get(e)).set(r, t), n(r, t));
167
+ }
168
+ function m(e) {
169
+ if (typeof document > "u" || !("requestUpdate" in e)) return;
170
+ let t = i();
171
+ if (t.seen.has(e)) return;
172
+ let n = new WeakRef(e);
173
+ t.seen.set(e, n), t.watched.add(n), t.observer || (t.observer = new MutationObserver((e) => h(t, e.map((e) => e.target))), t.observer.observe(document.documentElement, {
174
+ attributes: !0,
175
+ attributeFilter: ["lang"],
176
+ subtree: !0
177
+ }));
178
+ }
179
+ function h(e, t) {
180
+ for (let n of e.watched) {
181
+ let r = n.deref();
182
+ if (!r) {
183
+ e.watched.delete(n);
184
+ continue;
185
+ }
186
+ (t === null || t.some((e) => e.contains(r))) && r.requestUpdate();
187
+ }
188
+ }
189
+ //#endregion
190
+ export { n as englishMessages, s as langOf, c as localeOf, d as msg, p as nameHost, o as registerMessages };
package/dist/modal.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { VoidElement } from './base.js';
2
2
  import { OverlayController } from './overlay.js';
3
3
  import { PartsController } from './parts.js';
4
+ import { KeyOverrides } from './keys.js';
4
5
  /**
5
6
  * The shared modal behind `<void-dialog>` and `<void-drawer>`.
6
7
  *
@@ -14,6 +15,12 @@ import { PartsController } from './parts.js';
14
15
  * @internal
15
16
  */
16
17
  export declare class VoidModal extends VoidElement {
18
+ /** Key bindings for this element's actions, as JSON (`{"close":["Escape"]}`); `[]` switches an action off, which leaves a modal with no keyboard exit. See the keyboard guide. */
19
+ keys: KeyOverrides | null;
20
+ /** @internal The actions of this element and their default keys. */
21
+ static readonly keyMap: {
22
+ close: string[];
23
+ };
17
24
  /** Whether it is open. Set or remove the attribute (or property) to open and close it; the server may do the same through a morph. */
18
25
  open: boolean;
19
26
  /**