@winchsa/ui 0.1.33 → 0.1.35

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 (300) hide show
  1. package/dist/components/Breadcrumbs.d.vue.ts +7 -0
  2. package/dist/components/Breadcrumbs.vue +46 -0
  3. package/dist/components/Breadcrumbs.vue.d.ts +7 -0
  4. package/dist/components/CustomizerSection.d.vue.ts +17 -0
  5. package/dist/components/CustomizerSection.vue +19 -0
  6. package/dist/components/CustomizerSection.vue.d.ts +17 -0
  7. package/dist/components/DialogCloseBtn.d.vue.ts +7 -0
  8. package/dist/components/DialogCloseBtn.vue +20 -0
  9. package/dist/components/DialogCloseBtn.vue.d.ts +7 -0
  10. package/dist/components/Drawer.d.vue.ts +28 -0
  11. package/dist/components/Drawer.vue +60 -0
  12. package/dist/components/Drawer.vue.d.ts +28 -0
  13. package/dist/components/IconBtn.d.vue.ts +18 -0
  14. package/dist/components/IconBtn.vue +24 -0
  15. package/dist/components/IconBtn.vue.d.ts +18 -0
  16. package/dist/components/LoadingBar.d.vue.ts +6 -0
  17. package/dist/components/LoadingBar.vue +31 -0
  18. package/dist/components/LoadingBar.vue.d.ts +6 -0
  19. package/dist/components/LoadingDialog.d.vue.ts +12 -0
  20. package/dist/components/LoadingDialog.vue +41 -0
  21. package/dist/components/LoadingDialog.vue.d.ts +12 -0
  22. package/dist/components/LoadingItem.d.vue.ts +25 -0
  23. package/dist/components/LoadingItem.vue +66 -0
  24. package/dist/components/LoadingItem.vue.d.ts +25 -0
  25. package/dist/components/Modal.d.vue.ts +50 -0
  26. package/dist/components/Modal.vue +155 -0
  27. package/dist/components/Modal.vue.d.ts +50 -0
  28. package/dist/components/MoreBtn.d.vue.ts +17 -0
  29. package/dist/components/MoreBtn.vue +28 -0
  30. package/dist/components/MoreBtn.vue.d.ts +17 -0
  31. package/dist/components/ScrollToTop.d.vue.ts +3 -0
  32. package/dist/components/ScrollToTop.vue +39 -0
  33. package/dist/components/ScrollToTop.vue.d.ts +3 -0
  34. package/dist/components/SiteTitle.d.vue.ts +3 -0
  35. package/dist/components/SiteTitle.vue +14 -0
  36. package/dist/components/SiteTitle.vue.d.ts +3 -0
  37. package/dist/components/Toaster.d.vue.ts +6 -0
  38. package/dist/components/Toaster.vue +19 -0
  39. package/dist/components/Toaster.vue.d.ts +6 -0
  40. package/dist/components/cards/AppCard.d.vue.ts +18 -0
  41. package/dist/components/cards/AppCard.vue +45 -0
  42. package/dist/components/cards/AppCard.vue.d.ts +18 -0
  43. package/dist/components/cards/AppCardActions.d.vue.ts +33 -0
  44. package/dist/components/cards/AppCardActions.vue +126 -0
  45. package/dist/components/cards/AppCardActions.vue.d.ts +33 -0
  46. package/dist/components/cards/CardStatisticsHorizontal.d.vue.ts +9 -0
  47. package/dist/components/cards/CardStatisticsHorizontal.vue +29 -0
  48. package/dist/components/cards/CardStatisticsHorizontal.vue.d.ts +9 -0
  49. package/dist/components/cards/CheckboxesCard.d.vue.ts +18 -0
  50. package/dist/components/cards/CheckboxesCard.vue +108 -0
  51. package/dist/components/cards/CheckboxesCard.vue.d.ts +18 -0
  52. package/dist/components/cards/HeaderCard.d.vue.ts +9 -0
  53. package/dist/components/cards/HeaderCard.vue +31 -0
  54. package/dist/components/cards/HeaderCard.vue.d.ts +9 -0
  55. package/dist/components/cards/ImageCard.d.vue.ts +33 -0
  56. package/dist/components/cards/ImageCard.vue +73 -0
  57. package/dist/components/cards/ImageCard.vue.d.ts +33 -0
  58. package/dist/components/cards/InputCard.d.vue.ts +21 -0
  59. package/dist/components/cards/InputCard.vue +60 -0
  60. package/dist/components/cards/InputCard.vue.d.ts +21 -0
  61. package/dist/components/cards/StaticCard.d.vue.ts +21 -0
  62. package/dist/components/cards/StaticCard.vue +37 -0
  63. package/dist/components/cards/StaticCard.vue.d.ts +21 -0
  64. package/dist/components/forms/Accordion.d.vue.ts +19 -0
  65. package/dist/components/forms/Accordion.vue +43 -0
  66. package/dist/components/forms/Accordion.vue.d.ts +19 -0
  67. package/dist/components/forms/AppBarSearch.d.vue.ts +43 -0
  68. package/dist/components/forms/AppBarSearch.vue +345 -0
  69. package/dist/components/forms/AppBarSearch.vue.d.ts +43 -0
  70. package/dist/components/forms/AppCombobox.d.vue.ts +13 -0
  71. package/dist/components/forms/AppCombobox.vue +60 -0
  72. package/dist/components/forms/AppCombobox.vue.d.ts +13 -0
  73. package/dist/components/forms/AppDrawerHeaderSection.d.vue.ts +20 -0
  74. package/dist/components/forms/AppDrawerHeaderSection.vue +21 -0
  75. package/dist/components/forms/AppDrawerHeaderSection.vue.d.ts +20 -0
  76. package/dist/components/forms/AppLabel.d.vue.ts +24 -0
  77. package/dist/components/forms/AppLabel.vue +47 -0
  78. package/dist/components/forms/AppLabel.vue.d.ts +24 -0
  79. package/dist/components/forms/AppLink.d.vue.ts +19 -0
  80. package/dist/components/forms/AppLink.vue +50 -0
  81. package/dist/components/forms/AppLink.vue.d.ts +19 -0
  82. package/dist/components/forms/AppNumberField.d.vue.ts +20 -0
  83. package/dist/components/forms/AppNumberField.vue +79 -0
  84. package/dist/components/forms/AppNumberField.vue.d.ts +20 -0
  85. package/dist/components/forms/AppOtpInput.d.vue.ts +13 -0
  86. package/dist/components/forms/AppOtpInput.vue +84 -0
  87. package/dist/components/forms/AppOtpInput.vue.d.ts +13 -0
  88. package/dist/components/forms/AppSearchHeader.d.vue.ts +8 -0
  89. package/dist/components/forms/AppSearchHeader.vue +72 -0
  90. package/dist/components/forms/AppSearchHeader.vue.d.ts +8 -0
  91. package/dist/components/forms/AppSelect.d.vue.ts +21 -0
  92. package/dist/components/forms/AppSelect.vue +94 -0
  93. package/dist/components/forms/AppSelect.vue.d.ts +21 -0
  94. package/dist/components/forms/AppStepper.d.vue.ts +21 -0
  95. package/dist/components/forms/AppStepper.vue +232 -0
  96. package/dist/components/forms/AppStepper.vue.d.ts +21 -0
  97. package/dist/components/forms/AppSwitch.d.vue.ts +18 -0
  98. package/dist/components/forms/AppSwitch.vue +60 -0
  99. package/dist/components/forms/AppSwitch.vue.d.ts +18 -0
  100. package/dist/components/forms/AppTextField.d.vue.ts +17 -0
  101. package/dist/components/forms/AppTextField.vue +62 -0
  102. package/dist/components/forms/AppTextField.vue.d.ts +17 -0
  103. package/dist/components/forms/AppTextarea.d.vue.ts +17 -0
  104. package/dist/components/forms/AppTextarea.vue +65 -0
  105. package/dist/components/forms/AppTextarea.vue.d.ts +17 -0
  106. package/dist/components/forms/AttachmentCropperInput.d.vue.ts +18 -0
  107. package/dist/components/forms/AttachmentCropperInput.vue +227 -0
  108. package/dist/components/forms/AttachmentCropperInput.vue.d.ts +18 -0
  109. package/dist/components/forms/AttachmentInput.d.vue.ts +16 -0
  110. package/dist/components/forms/AttachmentInput.vue +116 -0
  111. package/dist/components/forms/AttachmentInput.vue.d.ts +16 -0
  112. package/dist/components/forms/AutocompleteInput.d.vue.ts +86 -0
  113. package/dist/components/forms/AutocompleteInput.vue +778 -0
  114. package/dist/components/forms/AutocompleteInput.vue.d.ts +86 -0
  115. package/dist/components/forms/BankSelect.d.vue.ts +21 -0
  116. package/dist/components/forms/BankSelect.vue +43 -0
  117. package/dist/components/forms/BankSelect.vue.d.ts +21 -0
  118. package/dist/components/forms/BaseButton.d.vue.ts +20 -0
  119. package/dist/components/forms/BaseButton.vue +42 -0
  120. package/dist/components/forms/BaseButton.vue.d.ts +20 -0
  121. package/dist/components/forms/CounterInput.d.vue.ts +13 -0
  122. package/dist/components/forms/CounterInput.vue +71 -0
  123. package/dist/components/forms/CounterInput.vue.d.ts +13 -0
  124. package/dist/components/forms/CustomCheckboxes.d.vue.ts +25 -0
  125. package/dist/components/forms/CustomCheckboxes.vue +69 -0
  126. package/dist/components/forms/CustomCheckboxes.vue.d.ts +25 -0
  127. package/dist/components/forms/CustomCheckboxesWithIcon.d.vue.ts +25 -0
  128. package/dist/components/forms/CustomCheckboxesWithIcon.vue +80 -0
  129. package/dist/components/forms/CustomCheckboxesWithIcon.vue.d.ts +25 -0
  130. package/dist/components/forms/CustomCheckboxesWithImage.d.vue.ts +16 -0
  131. package/dist/components/forms/CustomCheckboxesWithImage.vue +67 -0
  132. package/dist/components/forms/CustomCheckboxesWithImage.vue.d.ts +16 -0
  133. package/dist/components/forms/CustomRadios.d.vue.ts +25 -0
  134. package/dist/components/forms/CustomRadios.vue +69 -0
  135. package/dist/components/forms/CustomRadios.vue.d.ts +25 -0
  136. package/dist/components/forms/CustomRadiosWithIcon.d.vue.ts +28 -0
  137. package/dist/components/forms/CustomRadiosWithIcon.vue +98 -0
  138. package/dist/components/forms/CustomRadiosWithIcon.vue.d.ts +28 -0
  139. package/dist/components/forms/CustomRadiosWithImage.d.vue.ts +35 -0
  140. package/dist/components/forms/CustomRadiosWithImage.vue +69 -0
  141. package/dist/components/forms/CustomRadiosWithImage.vue.d.ts +35 -0
  142. package/dist/components/forms/DatePicker.d.vue.ts +29 -0
  143. package/dist/components/forms/DatePicker.vue +392 -0
  144. package/dist/components/forms/DatePicker.vue.d.ts +29 -0
  145. package/dist/components/forms/DatePickerRange.d.vue.ts +24 -0
  146. package/dist/components/forms/DatePickerRange.vue +127 -0
  147. package/dist/components/forms/DatePickerRange.vue.d.ts +24 -0
  148. package/dist/components/forms/DraggedUploadFile.d.vue.ts +11 -0
  149. package/dist/components/forms/DraggedUploadFile.vue +120 -0
  150. package/dist/components/forms/DraggedUploadFile.vue.d.ts +11 -0
  151. package/dist/components/forms/ImageCardInput.d.vue.ts +35 -0
  152. package/dist/components/forms/ImageCardInput.vue +234 -0
  153. package/dist/components/forms/ImageCardInput.vue.d.ts +35 -0
  154. package/dist/components/forms/InputValidationWrapper.d.vue.ts +26 -0
  155. package/dist/components/forms/InputValidationWrapper.vue +24 -0
  156. package/dist/components/forms/InputValidationWrapper.vue.d.ts +26 -0
  157. package/dist/components/forms/LicensePlateInput.d.vue.ts +21 -0
  158. package/dist/components/forms/LicensePlateInput.vue +175 -0
  159. package/dist/components/forms/LicensePlateInput.vue.d.ts +21 -0
  160. package/dist/components/forms/ManualDate.d.vue.ts +20 -0
  161. package/dist/components/forms/ManualDate.vue +264 -0
  162. package/dist/components/forms/ManualDate.vue.d.ts +20 -0
  163. package/dist/components/forms/MobileInput.d.vue.ts +25 -0
  164. package/dist/components/forms/MobileInput.vue +118 -0
  165. package/dist/components/forms/MobileInput.vue.d.ts +25 -0
  166. package/dist/components/forms/PasswordInput.d.vue.ts +11 -0
  167. package/dist/components/forms/PasswordInput.vue +29 -0
  168. package/dist/components/forms/PasswordInput.vue.d.ts +11 -0
  169. package/dist/components/forms/RangeInput.d.vue.ts +10 -0
  170. package/dist/components/forms/RangeInput.vue +48 -0
  171. package/dist/components/forms/RangeInput.vue.d.ts +10 -0
  172. package/dist/components/forms/Tabs.d.vue.ts +23 -0
  173. package/dist/components/forms/Tabs.vue +35 -0
  174. package/dist/components/forms/Tabs.vue.d.ts +23 -0
  175. package/dist/components/forms/TimePicker.d.vue.ts +18 -0
  176. package/dist/components/forms/TimePicker.vue +370 -0
  177. package/dist/components/forms/TimePicker.vue.d.ts +18 -0
  178. package/dist/components/table/DataTable.d.vue.ts +70 -0
  179. package/dist/components/table/DataTable.vue +361 -0
  180. package/dist/components/table/DataTable.vue.d.ts +70 -0
  181. package/dist/components/table/EditableDataTable.d.vue.ts +21 -0
  182. package/dist/components/table/EditableDataTable.vue +330 -0
  183. package/dist/components/table/EditableDataTable.vue.d.ts +21 -0
  184. package/dist/components/table/EditableDataTableRow.d.vue.ts +20 -0
  185. package/dist/components/table/EditableDataTableRow.vue +252 -0
  186. package/dist/components/table/EditableDataTableRow.vue.d.ts +20 -0
  187. package/dist/components/table/FilterGenerator.d.vue.ts +13 -0
  188. package/dist/components/table/FilterGenerator.vue +231 -0
  189. package/dist/components/table/FilterGenerator.vue.d.ts +13 -0
  190. package/dist/components/table/StaticTable.d.vue.ts +34 -0
  191. package/dist/components/table/StaticTable.vue +152 -0
  192. package/dist/components/table/StaticTable.vue.d.ts +34 -0
  193. package/dist/components/table/TablePagination.d.vue.ts +15 -0
  194. package/dist/components/table/TablePagination.vue +73 -0
  195. package/dist/components/table/TablePagination.vue.d.ts +15 -0
  196. package/dist/composables/useIsMobile.d.ts +1 -0
  197. package/dist/composables/useIsMobile.js +10 -0
  198. package/dist/composables/useIsMobile.mjs +4 -0
  199. package/dist/composables/useTableFilters.d.ts +23 -0
  200. package/dist/composables/useTableFilters.js +197 -0
  201. package/dist/composables/useTableFilters.mjs +184 -0
  202. package/dist/images/avatar.png +0 -0
  203. package/dist/images/sa.svg +1 -0
  204. package/dist/index.d.ts +65 -0
  205. package/dist/index.js +454 -0
  206. package/dist/index.mjs +130 -0
  207. package/dist/lang/ar.json +54 -0
  208. package/dist/lang/en.json +54 -0
  209. package/dist/styles/assets/scss/variables/_template.scss +1 -0
  210. package/dist/styles/assets/scss/variables/_vuetify.scss +1 -0
  211. package/dist/styles/core/base/_components.scss +164 -0
  212. package/dist/styles/core/base/_dark.scss +16 -0
  213. package/dist/styles/core/base/_default-layout-w-vertical-nav.scss +106 -0
  214. package/dist/styles/core/base/_default-layout.scss +16 -0
  215. package/dist/styles/core/base/_index.scss +47 -0
  216. package/dist/styles/core/base/_layouts.scss +63 -0
  217. package/dist/styles/core/base/_misc.scss +20 -0
  218. package/dist/styles/core/base/_mixins.scss +84 -0
  219. package/dist/styles/core/base/_route-transitions.scss +70 -0
  220. package/dist/styles/core/base/_utilities.scss +418 -0
  221. package/dist/styles/core/base/_utils.scss +100 -0
  222. package/dist/styles/core/base/_variables.scss +190 -0
  223. package/dist/styles/core/base/_vertical-nav.scss +264 -0
  224. package/dist/styles/core/base/libs/_perfect-scrollbar.scss +35 -0
  225. package/dist/styles/core/base/libs/vuetify/_index.scss +1 -0
  226. package/dist/styles/core/base/libs/vuetify/_overrides.scss +380 -0
  227. package/dist/styles/core/base/libs/vuetify/_variables.scss +48 -0
  228. package/dist/styles/core/base/placeholders/_default-layout-vertical-nav.scss +48 -0
  229. package/dist/styles/core/base/placeholders/_default-layout.scss +3 -0
  230. package/dist/styles/core/base/placeholders/_index.scss +5 -0
  231. package/dist/styles/core/base/placeholders/_misc.scss +7 -0
  232. package/dist/styles/core/base/placeholders/_nav.scss +26 -0
  233. package/dist/styles/core/base/placeholders/_vertical-nav.scss +84 -0
  234. package/dist/styles/core/base/skins/_bordered.scss +60 -0
  235. package/dist/styles/core/base/skins/_index.scss +1 -0
  236. package/dist/styles/core/template/_components.scss +1044 -0
  237. package/dist/styles/core/template/_default-layout-w-vertical-nav.scss +20 -0
  238. package/dist/styles/core/template/_utilities.scss +20 -0
  239. package/dist/styles/core/template/_variables.scss +67 -0
  240. package/dist/styles/core/template/_vertical-nav.scss +41 -0
  241. package/dist/styles/core/template/index.css +18786 -0
  242. package/dist/styles/core/template/index.scss +15 -0
  243. package/dist/styles/core/template/libs/vuetify/_variables.scss +464 -0
  244. package/dist/styles/core/template/libs/vuetify/index.css +739 -0
  245. package/dist/styles/core/template/libs/vuetify/index.scss +1 -0
  246. package/dist/styles/core/template/pages/misc.css +16 -0
  247. package/dist/styles/core/template/pages/misc.scss +20 -0
  248. package/dist/styles/core/template/placeholders/_default-layout-vertical-nav.scss +9 -0
  249. package/dist/styles/core/template/placeholders/_index.scss +3 -0
  250. package/dist/styles/core/template/placeholders/_nav.scss +15 -0
  251. package/dist/styles/core/template/placeholders/_vertical-nav.scss +18 -0
  252. package/dist/styles/core/template/skins/_bordered.scss +36 -0
  253. package/dist/styles/core/template/skins/_index.scss +1 -0
  254. package/dist/styles/layouts/_classes.scss +3 -0
  255. package/dist/styles/layouts/_dashboard-layout.scss +43 -0
  256. package/dist/styles/layouts/_global.scss +10 -0
  257. package/dist/styles/layouts/_mixins.scss +28 -0
  258. package/dist/styles/layouts/_placeholders.scss +53 -0
  259. package/dist/styles/layouts/_rtl.scss +7 -0
  260. package/dist/styles/layouts/_variables.scss +22 -0
  261. package/dist/styles/layouts/index.css +14 -0
  262. package/dist/styles/layouts/index.scss +2 -0
  263. package/dist/types.d.ts +218 -0
  264. package/dist/utils/apiUrl.d.ts +1 -0
  265. package/dist/utils/apiUrl.js +15 -0
  266. package/dist/utils/apiUrl.mjs +8 -0
  267. package/dist/utils/client.d.ts +9 -0
  268. package/dist/utils/client.js +53 -0
  269. package/dist/utils/client.mjs +39 -0
  270. package/dist/utils/files.d.ts +2 -0
  271. package/dist/utils/files.js +35 -0
  272. package/dist/utils/files.mjs +22 -0
  273. package/dist/utils/formValidation.d.ts +7 -0
  274. package/dist/utils/formValidation.js +20 -0
  275. package/dist/utils/formValidation.mjs +13 -0
  276. package/dist/utils/formatters.d.ts +12 -0
  277. package/dist/utils/formatters.js +84 -0
  278. package/dist/utils/formatters.mjs +56 -0
  279. package/dist/utils/hijriDate.d.ts +58 -0
  280. package/dist/utils/hijriDate.js +168 -0
  281. package/dist/utils/hijriDate.mjs +1951 -0
  282. package/dist/utils/i18n.d.ts +8 -0
  283. package/dist/utils/i18n.js +36 -0
  284. package/dist/utils/i18n.mjs +27 -0
  285. package/dist/utils/index.d.ts +10 -0
  286. package/dist/utils/index.js +115 -0
  287. package/dist/utils/index.mjs +10 -0
  288. package/dist/utils/queryParams.d.ts +4 -0
  289. package/dist/utils/queryParams.js +26 -0
  290. package/dist/utils/queryParams.mjs +18 -0
  291. package/dist/utils/ruleValidator.d.ts +41 -0
  292. package/dist/utils/ruleValidator.js +210 -0
  293. package/dist/utils/ruleValidator.mjs +195 -0
  294. package/dist/utils/toaster.d.ts +12 -0
  295. package/dist/utils/toaster.js +68 -0
  296. package/dist/utils/toaster.mjs +58 -0
  297. package/dist/utils/utils.d.ts +9 -0
  298. package/dist/utils/utils.js +84 -0
  299. package/dist/utils/utils.mjs +67 -0
  300. package/package.json +67 -67
@@ -0,0 +1,175 @@
1
+ <script setup>
2
+ import { computed, watch } from "vue";
3
+ import { useI18n } from "vue-i18n";
4
+ import { VLabel, VIcon, VValidation, VMessages } from "vuetify/components";
5
+ const { t } = useI18n();
6
+ const props = defineProps({
7
+ hideDetails: { type: Boolean, required: false },
8
+ label: { type: String, required: false },
9
+ customId: { type: String, required: false },
10
+ errorMessages: { type: [Array, String], required: false },
11
+ validateOn: { type: null, required: false, default: "submit lazy" },
12
+ error: { type: Boolean, required: false },
13
+ rules: { type: Array, required: false }
14
+ });
15
+ const model = defineModel({ type: [Array, null], ...{ default: ["", "", "", ""] } });
16
+ const LangLabel = computed(() => props.label ? t(props.label) : "");
17
+ const allowedLetters = ["A", "B", "J", "D", "R", "S", "X", "T", "E", "G", "K", "L", "Z", "N", "H", "U", "V"];
18
+ const allowedArabicLetters = ["\u0623", "\u0627", "\u0628", "\u062D", "\u062F", "\u0631", "\u0633", "\u0635", "\u0637", "\u0639", "\u0642", "\u0643", "\u0644", "\u0645", "\u0646", "\u0647", "\u0648", "\u064A"];
19
+ const normalizeInput = (input) => {
20
+ const arabicCasting = {
21
+ "\u0627": "\u0623",
22
+ "\u0622": "\u0623",
23
+ "\u0625": "\u0623",
24
+ "\u0649": "\u064A"
25
+ };
26
+ return input.split("").map((char) => arabicCasting[char] || char.toUpperCase()).join("");
27
+ };
28
+ const updateModelAt = (index, value) => {
29
+ const newModel = [...model.value ?? ["", "", "", ""]];
30
+ newModel[index] = value;
31
+ model.value = newModel;
32
+ };
33
+ const handleInput = (e, index) => {
34
+ const input = e.target;
35
+ let value = input.value;
36
+ if (!model.value) {
37
+ model.value = ["", "", "", ""];
38
+ }
39
+ if (e.inputType === "deleteContentBackward") {
40
+ updateModelAt(index, "");
41
+ if (index > 0) {
42
+ document.getElementById(`license-${props.customId || ""}-${index - 1}`)?.focus();
43
+ }
44
+ return;
45
+ }
46
+ if (index < 3) {
47
+ value = normalizeInput(value);
48
+ if (!allowedLetters.includes(value) && !allowedArabicLetters.includes(value)) {
49
+ updateModelAt(index, "");
50
+ input.value = "";
51
+ return;
52
+ }
53
+ updateModelAt(index, value);
54
+ if (value) {
55
+ document.getElementById(`license-${props.customId || ""}-${index + 1}`)?.focus();
56
+ }
57
+ } else {
58
+ if (/\D/.test(value)) {
59
+ updateModelAt(index, "");
60
+ input.value = "";
61
+ return;
62
+ }
63
+ updateModelAt(index, value);
64
+ }
65
+ };
66
+ const clear = () => {
67
+ model.value = null;
68
+ };
69
+ watch(() => model.value, (newVal) => {
70
+ if (Array.isArray(newVal)) {
71
+ model.value = newVal;
72
+ } else {
73
+ model.value = null;
74
+ }
75
+ }, { immediate: true });
76
+ </script>
77
+
78
+ <template>
79
+ <div class="d-flex flex-column h-100 w-100">
80
+ <VValidation
81
+ v-slot="{ errorMessages: validationErrors, isValid }"
82
+ v-model="model"
83
+ :error="error"
84
+ :rules="rules"
85
+ :validate-on="validateOn"
86
+ >
87
+ <div class="d-flex flex-column h-100">
88
+ <VLabel
89
+ v-if="label"
90
+ class="mb-2 text-body-2 text-high-emphasis"
91
+ :text="LangLabel"
92
+ />
93
+ <div
94
+ class="app-license-plate-input position-relative"
95
+ style="min-height: 45px;"
96
+ :class="{
97
+ 'app-license-plate-input--error': error || isValid.value === false
98
+ }"
99
+ >
100
+ <input
101
+ v-for="(_, index) in 4"
102
+ :id="`license-${customId || ''}-${index}`"
103
+ :key="`license-${customId || ''}-${index}`"
104
+ :value="model?.[index] ?? ''"
105
+ class="app-license-plate-input-cell"
106
+ type="text"
107
+ autocomplete="off"
108
+ :maxlength="index === 3 ? 4 : 1"
109
+ :placeholder="index === 3 ? t('inputs.numbers') : t('inputs.character')"
110
+ @input="handleInput($event, index)"
111
+ >
112
+ <a
113
+ v-if="model?.some(Boolean)"
114
+ class="position-absolute"
115
+ style="inset-inline-end: 10px;"
116
+ @click="clear"
117
+ >
118
+ <VIcon
119
+ size="19"
120
+ style="color: rgba(var(--v-theme-on-surface), var(--v-medium-emphasis-opacity)) !important;"
121
+ >
122
+ tabler-x
123
+ </VIcon>
124
+ </a>
125
+ </div>
126
+ <VMessages
127
+ v-if="!hideDetails"
128
+ class="mt-1"
129
+ color="error"
130
+ :messages="errorMessages || validationErrors.value"
131
+ :active="!isValid.value"
132
+ />
133
+ </div>
134
+ </VValidation>
135
+ </div>
136
+ </template>
137
+
138
+ <style scoped>
139
+ .app-license-plate-input.app-license-plate-input--error {
140
+ border-color: rgba(var(--v-theme-error), 1) !important;
141
+ }
142
+ .app-license-plate-input:hover {
143
+ transition: all 0.3s;
144
+ border-color: rgba(var(--v-theme-primary), 1);
145
+ }
146
+ .app-license-plate-input:focus-within {
147
+ transition: all 0.3s;
148
+ border-color: rgba(var(--v-theme-primary));
149
+ }
150
+ .app-license-plate-input {
151
+ display: grid;
152
+ grid-template-columns: 60px 60px 60px 1fr;
153
+ width: 100%;
154
+ min-height: 40px;
155
+ align-items: center;
156
+ border: 1px solid rgba(var(--v-border-color), 0.29);
157
+ border-radius: 6px;
158
+ transition: all 0.5s;
159
+ box-sizing: border-box;
160
+ }
161
+ .app-license-plate-input .app-license-plate-input-cell {
162
+ height: 100%;
163
+ text-align: center;
164
+ padding: 2px 6px;
165
+ font-size: 13px;
166
+ outline: none;
167
+ border-inline-end: 1px solid rgba(var(--v-border-color), var(--v-border-opacity));
168
+ }
169
+ .app-license-plate-input .app-license-plate-input-cell:last-of-type {
170
+ text-align: start;
171
+ padding-inline-start: 12px;
172
+ border: 0px;
173
+ width: 100%;
174
+ }
175
+ </style>
@@ -0,0 +1,21 @@
1
+ import type { ValidateOn } from '../../types';
2
+ type __VLS_Props = {
3
+ hideDetails?: boolean;
4
+ label?: string;
5
+ customId?: string;
6
+ errorMessages?: string[] | string;
7
+ validateOn?: ValidateOn;
8
+ error?: boolean;
9
+ rules?: ((value: unknown) => string)[];
10
+ };
11
+ type __VLS_ModelProps = {
12
+ modelValue?: string[] | null;
13
+ };
14
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
15
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
+ "update:modelValue": (value: string[] | null) => any;
17
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
18
+ "onUpdate:modelValue"?: ((value: string[] | null) => any) | undefined;
19
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
+ declare const _default: typeof __VLS_export;
21
+ export default _default;
@@ -0,0 +1,20 @@
1
+ import type { ValidateOn } from '../../types';
2
+ type __VLS_Props = {
3
+ hideDetails?: boolean;
4
+ label?: string;
5
+ customId?: string;
6
+ modelValue?: string;
7
+ errorMessages?: string[] | string;
8
+ type?: 'gregorian' | 'hijri' | string | undefined;
9
+ disabled?: boolean;
10
+ validateOn?: ValidateOn;
11
+ error?: boolean;
12
+ rules?: ((value: unknown) => string)[];
13
+ };
14
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
15
+ "update:model-value": (value: string) => any;
16
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
17
+ "onUpdate:model-value"?: ((value: string) => any) | undefined;
18
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const _default: typeof __VLS_export;
20
+ export default _default;
@@ -0,0 +1,264 @@
1
+ <script setup>
2
+ import { computed, ref, watch } from "vue";
3
+ import { useI18n } from "vue-i18n";
4
+ import { VLabel, VIcon, VValidation, VMessages } from "vuetify/components";
5
+ import { HijriJS } from "../../utils/hijriDate";
6
+ const { t } = useI18n();
7
+ const props = defineProps({
8
+ hideDetails: { type: Boolean, required: false },
9
+ label: { type: String, required: false },
10
+ customId: { type: String, required: false, default: "" },
11
+ modelValue: { type: String, required: false },
12
+ errorMessages: { type: [Array, String], required: false },
13
+ type: { type: null, required: false },
14
+ disabled: { type: Boolean, required: false },
15
+ validateOn: { type: null, required: false, default: "submit lazy" },
16
+ error: { type: Boolean, required: false },
17
+ rules: { type: Array, required: false }
18
+ });
19
+ const emit = defineEmits(["update:model-value"]);
20
+ const date = ref({
21
+ year: "",
22
+ month: "",
23
+ day: ""
24
+ });
25
+ const dayInputRef = ref(null);
26
+ const monthInputRef = ref(null);
27
+ const yearInputRef = ref(null);
28
+ const LangLabel = computed(() => props.label ? t(props.label) : "");
29
+ const yearIsInvalid = computed(() => {
30
+ return date.value.year ? date.value.year.length < 4 : false;
31
+ });
32
+ const onBackspace = (e, key) => {
33
+ const input = e.target;
34
+ if (e.key === "Backspace" && !date.value[key]) {
35
+ if (input.dataset.order === "2") {
36
+ dayInputRef.value?.focus();
37
+ } else if (input.dataset.order === "3") {
38
+ monthInputRef.value?.focus();
39
+ }
40
+ }
41
+ };
42
+ const onDayInput = (e) => {
43
+ const input = e.target;
44
+ if (e.inputType === "deleteContentBackward") {
45
+ date.value.day = date.value.day?.slice(0, -1);
46
+ return;
47
+ }
48
+ if (/\D/g.test(input.value)) {
49
+ date.value.day = date.value.day.replace(/\D/g, "");
50
+ input.value = date.value.day;
51
+ return;
52
+ }
53
+ if (parseInt(input.value) > 31) {
54
+ date.value.day = "31";
55
+ input.value = "31";
56
+ } else {
57
+ date.value.day = input.value;
58
+ }
59
+ if (date.value.day?.length > 1) {
60
+ monthInputRef.value?.focus();
61
+ }
62
+ };
63
+ const onMonthInput = (e) => {
64
+ const input = e.target;
65
+ if (e.inputType === "deleteContentBackward") {
66
+ date.value.month = date.value.month?.slice(0, -1);
67
+ return;
68
+ }
69
+ if (/\D/g.test(input.value)) {
70
+ date.value.month = date.value.month.replace(/\D/g, "");
71
+ input.value = date.value.month;
72
+ return;
73
+ }
74
+ if (parseInt(input.value) > 12) {
75
+ date.value.month = "12";
76
+ input.value = "12";
77
+ } else {
78
+ date.value.month = input.value;
79
+ }
80
+ if (date.value.month?.length > 1) {
81
+ yearInputRef.value?.focus();
82
+ }
83
+ };
84
+ const onYearInput = (e) => {
85
+ const input = e.target;
86
+ if (e.inputType === "deleteContentBackward") {
87
+ date.value.year = date.value.year?.slice(0, -1);
88
+ return;
89
+ }
90
+ if (/\D/g.test(input.value)) {
91
+ date.value.year = date.value.year.replace(/\D/g, "");
92
+ input.value = date.value.year;
93
+ return;
94
+ }
95
+ const currentYear = props.type === "hijri" ? HijriJS.today().year : (/* @__PURE__ */ new Date()).getFullYear();
96
+ if (parseInt(input.value) > currentYear) {
97
+ date.value.year = String(currentYear);
98
+ input.value = String(currentYear);
99
+ } else {
100
+ date.value.year = input.value;
101
+ }
102
+ };
103
+ const clear = () => {
104
+ date.value = {
105
+ year: "",
106
+ month: "",
107
+ day: ""
108
+ };
109
+ };
110
+ const dateFormat = (type) => {
111
+ if (type === "day") {
112
+ date.value.day = date.value.day ? date.value.day.padStart(2, "0") : "";
113
+ }
114
+ if (type === "month") {
115
+ date.value.month = date.value.month ? date.value.month.padStart(2, "0") : "";
116
+ }
117
+ };
118
+ watch(() => date.value, (val) => {
119
+ emit("update:model-value", [val.year, val.month, val.day].join("-"));
120
+ }, {
121
+ deep: true
122
+ });
123
+ watch(() => props.type, clear, { deep: true });
124
+ watch(() => props.modelValue, (val) => {
125
+ if (val) {
126
+ const [year, month, day] = val.split("-") ?? [];
127
+ date.value = {
128
+ year: year ?? "",
129
+ month: month ?? "",
130
+ day: day ?? ""
131
+ };
132
+ } else {
133
+ date.value = {
134
+ year: "",
135
+ month: "",
136
+ day: ""
137
+ };
138
+ }
139
+ }, { deep: true, immediate: true });
140
+ </script>
141
+
142
+ <template>
143
+ <div>
144
+ <VValidation
145
+ v-slot="{ errorMessages: validationErrors, isValid }"
146
+ v-model="date"
147
+ :error="error"
148
+ :rules="rules"
149
+ >
150
+ <div class="d-flex flex-column">
151
+ <VLabel
152
+ v-if="label"
153
+ class="mb-2 text-body-2 text-high-emphasis"
154
+ :text="LangLabel"
155
+ />
156
+ <div class="app-date-input position-relative" style="min-height: 45px;" :class="{
157
+ 'app-date-input--error': isValid.value === false || yearIsInvalid || error,
158
+ 'app-date-input--disabled': disabled
159
+ }">
160
+ <input
161
+ ref="dayInputRef"
162
+ data-order="1"
163
+ :value="date.day"
164
+ class="app-date-input-cell"
165
+ type="text"
166
+ maxlength="2"
167
+ :placeholder="t('inputs.day')"
168
+ :disabled="disabled"
169
+ autocomplete="off"
170
+ @input="onDayInput($event)"
171
+ @keyup="onBackspace($event, 'day')"
172
+ @blur="dateFormat('day')"
173
+ >
174
+ <input
175
+ ref="monthInputRef"
176
+ data-order="2"
177
+ :value="date.month"
178
+ class="app-date-input-cell"
179
+ type="text"
180
+ maxlength="2"
181
+ :placeholder="t('inputs.month')"
182
+ :disabled="disabled"
183
+ autocomplete="off"
184
+ @input="onMonthInput($event)"
185
+ @keyup="onBackspace($event, 'month')"
186
+ @blur="dateFormat('month')"
187
+ >
188
+ <input
189
+ ref="yearInputRef"
190
+ data-order="3"
191
+ :value="date.year"
192
+ class="app-date-input-cell"
193
+ type="text"
194
+ maxlength="4"
195
+ :placeholder="t('inputs.year')"
196
+ :disabled="disabled"
197
+ autocomplete="off"
198
+ @input="onYearInput($event)"
199
+ @keyup="onBackspace($event, 'year')"
200
+ >
201
+ <a
202
+ v-if="date && Object.values(date).filter(Boolean).length > 0"
203
+ class="position-absolute"
204
+ style="inset-inline-end: 10px;"
205
+ @click="clear"
206
+ >
207
+ <VIcon size="19" style="color: rgba(var(--v-theme-on-surface), var(--v-medium-emphasis-opacity)) !important;">tabler-x</VIcon>
208
+ </a>
209
+ </div>
210
+ <VMessages
211
+ v-if="!hideDetails"
212
+ class="mt-n1"
213
+ :messages="errorMessages || validationErrors.value"
214
+ :active="!isValid.value"
215
+ />
216
+ </div>
217
+ </VValidation>
218
+ </div>
219
+ </template>
220
+
221
+ <style scoped>
222
+ .app-date-input.app-date-input--error {
223
+ border-color: rgba(var(--v-theme-error), 1) !important;
224
+ }
225
+ .app-date-input.app-date-input--disabled {
226
+ border-color: rgba(var(--v-border-color), var(--v-border-opacity)) !important;
227
+ background: rgb(var(--v-disabled-background)) !important;
228
+ }
229
+ .app-date-input:hover {
230
+ transition: all 0.3s;
231
+ border-color: rgba(var(--v-border-color), 1);
232
+ }
233
+ .app-date-input:focus-within {
234
+ transition: all 0.3s;
235
+ border-color: rgba(var(--v-theme-primary));
236
+ }
237
+ .app-date-input {
238
+ display: grid;
239
+ grid-template-columns: 60px 60px 1fr;
240
+ width: 100%;
241
+ min-height: 40px;
242
+ height: 100%;
243
+ align-items: center;
244
+ border: 1px solid rgba(var(--v-border-color), 0.29) !important;
245
+ border-radius: 6px;
246
+ transition: all 0.5s;
247
+ box-sizing: border-box;
248
+ }
249
+ .app-date-input .app-date-input-cell {
250
+ height: 100%;
251
+ text-align: center;
252
+ padding: 2px 6px;
253
+ font-size: 13px;
254
+ outline: none;
255
+ border-inline-end: 1px solid rgba(var(--v-border-color), var(--v-border-opacity));
256
+ }
257
+ .app-date-input .app-date-input-cell:last-of-type {
258
+ text-align: start;
259
+ padding-inline-start: 12px;
260
+ border: 0px;
261
+ width: 100%;
262
+ min-width: 80px;
263
+ }
264
+ </style>
@@ -0,0 +1,20 @@
1
+ import type { ValidateOn } from '../../types';
2
+ type __VLS_Props = {
3
+ hideDetails?: boolean;
4
+ label?: string;
5
+ customId?: string;
6
+ modelValue?: string;
7
+ errorMessages?: string[] | string;
8
+ type?: 'gregorian' | 'hijri' | string | undefined;
9
+ disabled?: boolean;
10
+ validateOn?: ValidateOn;
11
+ error?: boolean;
12
+ rules?: ((value: unknown) => string)[];
13
+ };
14
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
15
+ "update:model-value": (value: string) => any;
16
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
17
+ "onUpdate:model-value"?: ((value: string) => any) | undefined;
18
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const _default: typeof __VLS_export;
20
+ export default _default;
@@ -0,0 +1,25 @@
1
+ type __VLS_Props = {
2
+ label?: string;
3
+ rules?: ((value: unknown) => string | true)[];
4
+ };
5
+ type __VLS_ModelProps = {
6
+ modelValue?: number | string;
7
+ };
8
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
9
+ declare var __VLS_17: string | number, __VLS_18: any;
10
+ type __VLS_Slots = {} & {
11
+ [K in NonNullable<typeof __VLS_17>]?: (props: typeof __VLS_18) => any;
12
+ };
13
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
+ "update:modelValue": (value: string | number | undefined) => any;
15
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
16
+ "onUpdate:modelValue"?: ((value: string | number | undefined) => any) | undefined;
17
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
19
+ declare const _default: typeof __VLS_export;
20
+ export default _default;
21
+ type __VLS_WithSlots<T, S> = T & {
22
+ new (): {
23
+ $slots: S;
24
+ };
25
+ };
@@ -0,0 +1,118 @@
1
+ <script setup>
2
+ import { computed, useAttrs } from "vue";
3
+ import { useI18n } from "vue-i18n";
4
+ import { VTextField, VLabel } from "vuetify/components";
5
+ import { ruleValidator } from "../../utils/ruleValidator";
6
+ const { t } = useI18n();
7
+ const { numberValidator } = ruleValidator();
8
+ const props = defineProps({
9
+ label: { type: String, required: false, default: "" },
10
+ rules: { type: Array, required: false }
11
+ });
12
+ const mobileValue = defineModel({ type: [Number, String] });
13
+ const elementId = computed(() => {
14
+ const attrs = useAttrs();
15
+ const _elementIdToken = attrs.id || attrs.label;
16
+ return _elementIdToken ? `AppTextField-${_elementIdToken}-${Math.random().toString(36).slice(2, 7)}` : void 0;
17
+ });
18
+ const LangLabel = computed(() => props.label ? t(props.label) : "");
19
+ const validateInput = (event) => {
20
+ const input = event.target;
21
+ let value = input.value.replace(/\D/g, "");
22
+ if (value.length > 0 && !/^0|^5/.test(value)) {
23
+ value = "";
24
+ }
25
+ mobileValue.value = value;
26
+ input.value = value;
27
+ };
28
+ </script>
29
+
30
+ <template>
31
+ <div
32
+ class="AppTextField flex-grow-1 mobile-input w-100"
33
+ :class="$attrs.class"
34
+ lang="en"
35
+ >
36
+ <VLabel
37
+ v-if="label"
38
+ :for="elementId"
39
+ class="mb-2 text-body-2 text-high-emphasis"
40
+ :text="LangLabel"
41
+ />
42
+
43
+ <VTextField
44
+ v-bind="{
45
+ ...$attrs,
46
+ class: null,
47
+ label: void 0,
48
+ variant: 'outlined',
49
+ id: elementId
50
+ }"
51
+ v-model="mobileValue"
52
+ lang="en"
53
+ placeholder="5xxxxxxxx"
54
+ :maxlength="mobileValue?.startsWith('0') ? 10 : 9"
55
+ type="text"
56
+ :rules="[numberValidator, ...(props.rules || [])]"
57
+ @input="validateInput"
58
+ >
59
+ <template
60
+ v-for="(_, name) in $slots"
61
+ #[name]="slotProps"
62
+ >
63
+ <slot
64
+ :name="name"
65
+ v-bind="slotProps || {}"
66
+ />
67
+ </template>
68
+ <template #details>
69
+ <span class="app-h-1" />
70
+ </template>
71
+ <template #append-inner>
72
+ <div
73
+ class="d-flex flex-nowrap"
74
+ >
75
+ <img
76
+ src="../../images/sa.svg"
77
+ alt="sa"
78
+ width="20"
79
+ >
80
+ <span class="ms-2"> +966 </span>
81
+ </div>
82
+ </template>
83
+ </VTextField>
84
+ </div>
85
+ </template>
86
+
87
+ <style>
88
+ .mobile-input .v-field__input {
89
+ padding-inline-start: 16px !important;
90
+ padding-inline-end: 16px !important;
91
+ }
92
+ .mobile-input .v-input__control .v-field__field {
93
+ border: none !important;
94
+ }
95
+ .mobile-input .v-field {
96
+ padding: 0 !important;
97
+ }
98
+ .mobile-input .v-input input,
99
+ .mobile-input .v-field__append-inner {
100
+ direction: ltr !important;
101
+ text-align: start !important;
102
+ }
103
+ .mobile-input .v-field__append-inner {
104
+ padding-inline-start: 16px;
105
+ }
106
+ .mobile-input .v-field__append-inner span {
107
+ direction: ltr;
108
+ font-size: 14px;
109
+ }
110
+
111
+ [dir=ltr] .mobile-input .v-field {
112
+ display: flex !important;
113
+ flex-direction: row-reverse !important;
114
+ }
115
+ [dir=ltr] .mobile-input .v-field--appended {
116
+ padding-inline-end: 0 !important;
117
+ }
118
+ </style>
@@ -0,0 +1,25 @@
1
+ type __VLS_Props = {
2
+ label?: string;
3
+ rules?: ((value: unknown) => string | true)[];
4
+ };
5
+ type __VLS_ModelProps = {
6
+ modelValue?: number | string;
7
+ };
8
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
9
+ declare var __VLS_17: string | number, __VLS_18: any;
10
+ type __VLS_Slots = {} & {
11
+ [K in NonNullable<typeof __VLS_17>]?: (props: typeof __VLS_18) => any;
12
+ };
13
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
+ "update:modelValue": (value: string | number | undefined) => any;
15
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
16
+ "onUpdate:modelValue"?: ((value: string | number | undefined) => any) | undefined;
17
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
19
+ declare const _default: typeof __VLS_export;
20
+ export default _default;
21
+ type __VLS_WithSlots<T, S> = T & {
22
+ new (): {
23
+ $slots: S;
24
+ };
25
+ };
@@ -0,0 +1,11 @@
1
+ type __VLS_Props = {
2
+ modelValue?: string | null;
3
+ label?: string;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
6
+ "update:modelValue": (value: string | number) => any;
7
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
8
+ "onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
9
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ declare const _default: typeof __VLS_export;
11
+ export default _default;