@adula/ui 2.1.0 → 2.3.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.
Files changed (50) hide show
  1. package/README.md +14 -3
  2. package/build/attachment-preview.json +21 -0
  3. package/build/breadcrumb.json +18 -0
  4. package/build/calendar.json +1 -1
  5. package/build/checkbox.json +1 -1
  6. package/build/command.json +1 -1
  7. package/build/confirm-action.json +3 -2
  8. package/build/copy-button.json +21 -0
  9. package/build/data-table.json +8 -2
  10. package/build/dialog-param.json +17 -0
  11. package/build/dialog.json +3 -2
  12. package/build/dropdown-menu.json +1 -1
  13. package/build/file-input.json +21 -0
  14. package/build/form.json +1 -1
  15. package/build/hijri-calendar.json +1 -1
  16. package/build/label.json +1 -1
  17. package/build/list-filters.json +34 -0
  18. package/build/long-dialog.json +17 -0
  19. package/build/manifest.json +146 -76
  20. package/build/messages.json +21 -0
  21. package/build/pagination.json +3 -2
  22. package/build/popover.json +1 -1
  23. package/build/radio-group.json +1 -1
  24. package/build/record-assignments.json +3 -2
  25. package/build/record-collaboration.json +4 -2
  26. package/build/record-print.json +24 -0
  27. package/build/record-workflows.json +3 -2
  28. package/build/resource-actions.json +3 -2
  29. package/build/resource-bulk.json +27 -0
  30. package/build/resource-dashboard.json +27 -0
  31. package/build/resource-field.json +7 -2
  32. package/build/resource-form.json +4 -2
  33. package/build/resource-import.json +7 -3
  34. package/build/resource-page.json +4 -2
  35. package/build/resource-show.json +6 -2
  36. package/build/resource-surface.json +4 -2
  37. package/build/resource-value.json +11 -2
  38. package/build/select.json +1 -1
  39. package/build/separator.json +1 -1
  40. package/build/sheet.json +1 -1
  41. package/build/slider.json +17 -0
  42. package/build/sonner.json +1 -1
  43. package/build/sortable-list.json +20 -0
  44. package/build/switch.json +1 -1
  45. package/build/table.json +1 -1
  46. package/build/tabs.json +1 -1
  47. package/build/theme.css +48 -2
  48. package/build/tooltip.json +1 -1
  49. package/build/user-avatar.json +17 -0
  50. package/package.json +5 -2
@@ -1,216 +1,286 @@
1
1
  {
2
- "version": "2.1.0",
3
- "adulaCompatibility": "2.1",
2
+ "version": "2.3.0",
3
+ "adulaCompatibility": "2.3",
4
4
  "items": [
5
5
  {
6
6
  "name": "button",
7
- "version": "2.1.0",
7
+ "version": "2.3.0",
8
8
  "hash": "cf1a045e41f5029fe9a8e3f3513a142dbe6550d6ffbe560b652a0aed1bb76f94"
9
9
  },
10
10
  {
11
11
  "name": "input",
12
- "version": "2.1.0",
12
+ "version": "2.3.0",
13
13
  "hash": "5a398efe048aff90155d858e63290dee2b7ad31c060936ac5bfce5ecf691e022"
14
14
  },
15
15
  {
16
16
  "name": "textarea",
17
- "version": "2.1.0",
17
+ "version": "2.3.0",
18
18
  "hash": "f0f615a9112e64ccb0d580d9325558c97750c24bcce933211acd2fa01c24b008"
19
19
  },
20
20
  {
21
21
  "name": "select",
22
- "version": "2.1.0",
23
- "hash": "25524a9856101efd64d4fa9922cd3c3ab36da05d84d75f06aec102f9fbc3b554"
22
+ "version": "2.3.0",
23
+ "hash": "18ee21eba11ffcff5ae395c7b3b6d98f46fb16c7ebfe9524702698ce3d28d2a8"
24
24
  },
25
25
  {
26
26
  "name": "checkbox",
27
- "version": "2.1.0",
28
- "hash": "631d1bacffcb6856a210bb2a40301f589cd0a74dfe28363e6fe3393e6c658ffa"
27
+ "version": "2.3.0",
28
+ "hash": "cca8adce36cf2ec1ee0a931e94fde84b2cf99c5161aa0cdb64bfab9ddeeaccf2"
29
29
  },
30
30
  {
31
31
  "name": "switch",
32
- "version": "2.1.0",
33
- "hash": "f41dc7b8d0b3d36a5b74460b651f20046c70a825321ea5ba8e32b575e87e9fb4"
32
+ "version": "2.3.0",
33
+ "hash": "e7c66890e466ce01de637cfbebd61e9419125d15455649026363402967424e58"
34
34
  },
35
35
  {
36
36
  "name": "radio-group",
37
- "version": "2.1.0",
38
- "hash": "2f6e9ad7d314703388e20cbea51d3f3bae35e0aedb239fe7e58f71dc892110e0"
37
+ "version": "2.3.0",
38
+ "hash": "812401f01905afba206becc0925a65ae74b55c94f355602051106f093d2d18e3"
39
39
  },
40
40
  {
41
41
  "name": "table",
42
- "version": "2.1.0",
43
- "hash": "2a76f50a6672357e167a2ebc1ea82535c9298629d94f5aa9ee57108e5c535f66"
42
+ "version": "2.3.0",
43
+ "hash": "b2510151b64e672f358deac23046e7f2a43ec6d8835006577ac93a05a4d30ac0"
44
44
  },
45
45
  {
46
46
  "name": "form",
47
- "version": "2.1.0",
48
- "hash": "2b164e3985524723c3997a334fe04b3232a52a4a37ac81c1acac25968f709628"
47
+ "version": "2.3.0",
48
+ "hash": "dd62ca3716c521cba34e96bc85f9193165ca6ed7905b90d53b7be891515a304d"
49
49
  },
50
50
  {
51
51
  "name": "label",
52
- "version": "2.1.0",
53
- "hash": "adb3d62721dfe74a6e812cee5ac8b2a0f5ad8821140a0d017e4bdabd2fd7b966"
52
+ "version": "2.3.0",
53
+ "hash": "011da9573b00b89c2209a30a17d400f9bc1bb77b25d1547f496a7a1bc9dd5093"
54
54
  },
55
55
  {
56
56
  "name": "dialog",
57
- "version": "2.1.0",
58
- "hash": "04b47b3d9de9d4998eb610a6753c115cf3aa5db88e6889caac337f2d95f708bc"
57
+ "version": "2.3.0",
58
+ "hash": "2f4d3ab3fe8fee5537265e46b72ad88f9e58b585a979b98afc56ab5d0b82e47c"
59
59
  },
60
60
  {
61
61
  "name": "sheet",
62
- "version": "2.1.0",
63
- "hash": "8b511eba90dbab3ea69faafa384e6b27d5aa1ba4742b47dc526238b2babcf97a"
62
+ "version": "2.3.0",
63
+ "hash": "779c0787c8f32ea1c23046b31f75a631a1358c02e6737def284920469676bc68"
64
64
  },
65
65
  {
66
66
  "name": "dropdown-menu",
67
- "version": "2.1.0",
68
- "hash": "622b2ba53ab5d9ebf28de16078a0051adb5a1035d63f5febeb3992fc1c094ff9"
67
+ "version": "2.3.0",
68
+ "hash": "7b5ed94e71634435d99ea48e4dda3009f9d82f5ad7ecb14219156d729048660e"
69
69
  },
70
70
  {
71
71
  "name": "popover",
72
- "version": "2.1.0",
73
- "hash": "288f01bbff64e03473dfb7c0b680f0ca77d610f646653b29364ae245d8491e03"
72
+ "version": "2.3.0",
73
+ "hash": "f6dc0a30f9054e5aab39b210f85f4a59e119ac6059290298e3e9ea4000266e05"
74
74
  },
75
75
  {
76
76
  "name": "command",
77
- "version": "2.1.0",
78
- "hash": "47fc8607025e87f3a35f974a55a946d9fee2d0eebd9a681276028e01731d1845"
77
+ "version": "2.3.0",
78
+ "hash": "23a8649d95107efb19c88f4673c8465ee1260eb4ef2761129e20809ce36875ab"
79
79
  },
80
80
  {
81
81
  "name": "calendar",
82
- "version": "2.1.0",
83
- "hash": "a536d790c69a67daf9aad8e76901dd668e02520d38677a3f27e1eadcf6a90ad7"
82
+ "version": "2.3.0",
83
+ "hash": "146fe26176aaae0f6607d4a511bffa12ce530f4e70057821dbc54d463f04028e"
84
84
  },
85
85
  {
86
86
  "name": "badge",
87
- "version": "2.1.0",
87
+ "version": "2.3.0",
88
88
  "hash": "08a668f461549c6edf7da629899d59373e7cae5686d1533fd5d451fbf7c2e33e"
89
89
  },
90
90
  {
91
91
  "name": "card",
92
- "version": "2.1.0",
92
+ "version": "2.3.0",
93
93
  "hash": "0c7ac44916cc64285da5d8734fd34896a72cabecada2119b68f7f04ac6995b9a"
94
94
  },
95
+ {
96
+ "name": "breadcrumb",
97
+ "version": "2.3.0",
98
+ "hash": "4fdb892b4873cea530050ff2b5382bce25c55bfc895cff9d3409e3ed4e4b613c"
99
+ },
95
100
  {
96
101
  "name": "tabs",
97
- "version": "2.1.0",
98
- "hash": "ceac90f0124b6c52d5f0268226fc36ec1689feb8540664414158aa8fdebac0f7"
102
+ "version": "2.3.0",
103
+ "hash": "d146730d0fd73ecb4d57b50a18d99fd81fd75a394bbba554ed090b168a601ede"
99
104
  },
100
105
  {
101
106
  "name": "sonner",
102
- "version": "2.1.0",
103
- "hash": "433f224e2266ddfa0f42fe7f81a87a55cb4e6284dce8187b97256154409fe10d"
107
+ "version": "2.3.0",
108
+ "hash": "bab1201bf8abbc1316ab0bb6140443e4451e92026b0a2fbd27b90323fdb6ff14"
104
109
  },
105
110
  {
106
111
  "name": "skeleton",
107
- "version": "2.1.0",
112
+ "version": "2.3.0",
108
113
  "hash": "8dd2b789d3a4b70fb62a99922ef48ee7a0d23a7cda09b00cc1df49c8c29fac90"
109
114
  },
110
115
  {
111
116
  "name": "pagination",
112
- "version": "2.1.0",
113
- "hash": "d1119e2d1e6e80c2556b510c715370c4b9e039e8851461aa28e71c3c1d9d1329"
117
+ "version": "2.3.0",
118
+ "hash": "c04e4d0e0f037136ed30cc2602ce2122e3ae65a866eb04b4ae26f218b58303d4"
114
119
  },
115
120
  {
116
121
  "name": "tooltip",
117
- "version": "2.1.0",
118
- "hash": "616d81f4386a0fb6b714e74515fd77328db0314ddb573003adfaf4693f100fe6"
122
+ "version": "2.3.0",
123
+ "hash": "ba7a2b3d666f1848b063585c25bb87f16d2b46891f23ee0727992a63ba310540"
119
124
  },
120
125
  {
121
126
  "name": "separator",
122
- "version": "2.1.0",
123
- "hash": "deb8eb9daf72092fd11d69af65891b721f154fd1bb8d3c7fabb46f33cf612c87"
127
+ "version": "2.3.0",
128
+ "hash": "12f949bd09fa730831cc500e15f2b3556779e1c840da70a57febae9580fed5f6"
124
129
  },
125
130
  {
126
131
  "name": "alert",
127
- "version": "2.1.0",
132
+ "version": "2.3.0",
128
133
  "hash": "17940923e71122bb30d830c569e36e3886109cbfdfb405fd3954774fed1f0ead"
129
134
  },
130
135
  {
131
136
  "name": "can",
132
- "version": "2.1.0",
137
+ "version": "2.3.0",
133
138
  "hash": "325cc32dac417e6001146ff59ba45b0c2231b672c92cebf389eaff378b82120c"
134
139
  },
140
+ {
141
+ "name": "attachment-preview",
142
+ "version": "2.3.0",
143
+ "hash": "ebe2fd30ad80cbac797fba2368b807f7edd06d40b298bf3fbf1b7602f2481645"
144
+ },
145
+ {
146
+ "name": "slider",
147
+ "version": "2.3.0",
148
+ "hash": "a58f2f389bcd7535cc33e164895e9c07c2bfe98fbfa95325871817c84dd991ec"
149
+ },
150
+ {
151
+ "name": "user-avatar",
152
+ "version": "2.3.0",
153
+ "hash": "b71b6504fd7792ad98e2ba3d58f6a1cb7f835ccf9cf69f0d39bb6bcabba45a0c"
154
+ },
155
+ {
156
+ "name": "sortable-list",
157
+ "version": "2.3.0",
158
+ "hash": "d22c1bfecaf6ac38a5b122c31f48927dd329d34f31b518e2243946f1a0b16c2f"
159
+ },
135
160
  {
136
161
  "name": "resource-value",
137
- "version": "2.1.0",
138
- "hash": "f63bb60aad14e8a11b4e15fec95d160035307c91d10703412a06d0673b010931"
162
+ "version": "2.3.0",
163
+ "hash": "a835b27097555882bbaaefd183ec9e444a8d3aa6b04ddbde5f23e108658ab3af"
139
164
  },
140
165
  {
141
166
  "name": "resource-field",
142
- "version": "2.1.0",
143
- "hash": "faf47b734ee7c466e7b73066114faba23957b26157f7cc1e3d843601bc0cea1b"
167
+ "version": "2.3.0",
168
+ "hash": "06b892cf8ea0610facd2d67106c518789d7f1e103068a3072c988147de7fbfac"
144
169
  },
145
170
  {
146
171
  "name": "data-table",
147
- "version": "2.1.0",
148
- "hash": "ee435ba760462decf9172cee64c823e08edbe49246f75f3786c75c6783602096"
172
+ "version": "2.3.0",
173
+ "hash": "e937d9c825c6d59f1e6f0a2e4702ce75e5c32b961e76922e1bc3fb9acf28692e"
149
174
  },
150
175
  {
151
176
  "name": "resource-form",
152
- "version": "2.1.0",
153
- "hash": "177ea294c9485fc3b9d9633982c29faad56baee495f7c2e69feba868c33a84e9"
177
+ "version": "2.3.0",
178
+ "hash": "604c474a096e7e700db5add5c3720e2d49c9b40111f2612c84b7ee03186e16a5"
154
179
  },
155
180
  {
156
181
  "name": "record-collaboration",
157
- "version": "2.1.0",
158
- "hash": "578412b5a1153d8fa1777179ca39e172460af5d4f7c2a17b2c643c6507385857"
182
+ "version": "2.3.0",
183
+ "hash": "48998f4879d95448ed3ca74a1c04f7d456701010319516404caf9934e6639ba0"
159
184
  },
160
185
  {
161
186
  "name": "record-assignments",
162
- "version": "2.1.0",
163
- "hash": "3e19c7c033e80ed91952a33a23d604455874fe97e4d5b2a0012fcb1d6c30ec8c"
187
+ "version": "2.3.0",
188
+ "hash": "85f5e00077013fec639875644f8b378294e3033d9a140a379c4d6df8bea9348c"
164
189
  },
165
190
  {
166
191
  "name": "record-workflows",
167
- "version": "2.1.0",
168
- "hash": "94ed2b1e30255fd02447af36f5c51cc8af2ab6bdc7ff07b7a91f4e6420c36224"
192
+ "version": "2.3.0",
193
+ "hash": "b84a4431ec07364c46c7efab2c4346e19922aa3d5f1e7fdc91ae50bb01acc5bd"
194
+ },
195
+ {
196
+ "name": "record-print",
197
+ "version": "2.3.0",
198
+ "hash": "20caed486c5330f371e08e796f2c2b8196bc3da416ef571cdcf9041c57589159"
169
199
  },
170
200
  {
171
201
  "name": "resource-show",
172
- "version": "2.1.0",
173
- "hash": "1a894acdcf94e2204ff94ebfa2d2a7059378292eca8a4e1a6d09234e25de5bbc"
202
+ "version": "2.3.0",
203
+ "hash": "710c8855877156c1a910782569658016c5464ba672a53fdb2a787547961a51d4"
204
+ },
205
+ {
206
+ "name": "file-input",
207
+ "version": "2.3.0",
208
+ "hash": "d9ae66af8bd073641b4390e3da8be531d3117ca3e2eb0106477e403cf580c1a3"
174
209
  },
175
210
  {
176
211
  "name": "resource-import",
177
- "version": "2.1.0",
178
- "hash": "0adbc6376480b46c7b0e2e947ffdeba5a13e82ec20d926d10b3cdeb804d675f7"
212
+ "version": "2.3.0",
213
+ "hash": "0604fc858010f4df8de744939a04e1817ec94bb1e0a2785745219fdac847bfb5"
179
214
  },
180
215
  {
181
216
  "name": "resource-page",
182
- "version": "2.1.0",
183
- "hash": "c67bd28de750b552091c8614f48499609a4e6a167b3fc8d97f843764b5e81199"
217
+ "version": "2.3.0",
218
+ "hash": "6e589ce87799a0822c0e7e8021226bb8d793ac65608c5d5d2adc2c6f0a5c6eca"
184
219
  },
185
220
  {
186
221
  "name": "resource-actions",
187
- "version": "2.1.0",
188
- "hash": "9c66535433d81b9f574763c310ecfd0df036ce926f8f560222d49348fcd62cea"
222
+ "version": "2.3.0",
223
+ "hash": "ae8a5a8abe4e5872ae8fbc803f88a4306ca6da21d96a396f55d675de27a776fe"
189
224
  },
190
225
  {
191
226
  "name": "resource-surface",
192
- "version": "2.1.0",
193
- "hash": "a7723c7e3baeb925a81b91142133e423a702df3ebbc5efb9aa3d99b6589034cb"
227
+ "version": "2.3.0",
228
+ "hash": "01731d810c0710c0e6ddce875d9ea94b585a258abba273a9f299e5f06f37ca97"
194
229
  },
195
230
  {
196
231
  "name": "ui-preferences",
197
- "version": "2.1.0",
232
+ "version": "2.3.0",
198
233
  "hash": "c5430a68726b1b01dd1259481fac4cd60ddfdd6cd986dc2c6fe63cc35e2d5cdb"
199
234
  },
200
235
  {
201
236
  "name": "calendar-date",
202
- "version": "2.1.0",
237
+ "version": "2.3.0",
203
238
  "hash": "f166217803da3ae1beac2662f8c5528ea52c96b1fb4891dfc19b71090b345ff2"
204
239
  },
240
+ {
241
+ "name": "messages",
242
+ "version": "2.3.0",
243
+ "hash": "7a8db307f85ad397f8f54e63a5cc863c4a2acd7d7b3f9e6262f341cbb81ae3c1"
244
+ },
205
245
  {
206
246
  "name": "hijri-calendar",
207
- "version": "2.1.0",
208
- "hash": "39ca5de9c1df32e65e434241f3cbbae629463c9f21da93205274c177fc8b85f3"
247
+ "version": "2.3.0",
248
+ "hash": "45821450e1dc1e2418326b4fca36d4e1980a2ac08a096e92775b6bfc017cd16f"
209
249
  },
210
250
  {
211
251
  "name": "confirm-action",
212
- "version": "2.1.0",
213
- "hash": "7710115860f595324ab94f752abb1de09b58acc9256aadf56ea0113b3dd4bb09"
252
+ "version": "2.3.0",
253
+ "hash": "b707040fc28ffd69902eb9f19b80aeb415b73f66cdfeff50c98c27f8cdc64bf8"
254
+ },
255
+ {
256
+ "name": "list-filters",
257
+ "version": "2.3.0",
258
+ "hash": "50f22bce337189e741b17104d6b602985d24d3aea25f3ddeef397de6cb8eb5c2"
259
+ },
260
+ {
261
+ "name": "resource-bulk",
262
+ "version": "2.3.0",
263
+ "hash": "1a12724a82045012e11561199d13b68746e0960f8b6f79befd89311467f3efe6"
264
+ },
265
+ {
266
+ "name": "resource-dashboard",
267
+ "version": "2.3.0",
268
+ "hash": "eb24b1da870d4f26e32e116e7391df257a09e3fb78b6969a8e28f50a599e18c5"
269
+ },
270
+ {
271
+ "name": "copy-button",
272
+ "version": "2.3.0",
273
+ "hash": "230201018d328e7a35f923b3697db878ea8e665c273ca201fa2cd7470157a9d6"
274
+ },
275
+ {
276
+ "name": "long-dialog",
277
+ "version": "2.3.0",
278
+ "hash": "660cbb3ff7765b93516deb5a8904ff97748591c3f6a08111d41637a271af2a6b"
279
+ },
280
+ {
281
+ "name": "dialog-param",
282
+ "version": "2.3.0",
283
+ "hash": "1759e33dd41c737f7889af86b20fea7757cbbb11417d1d222b2d20b9567fbc6e"
214
284
  }
215
285
  ],
216
286
  "dependencies": {
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "messages",
3
+ "type": "registry:ui",
4
+ "registryDependencies": [],
5
+ "dependencies": [],
6
+ "files": [
7
+ {
8
+ "path": "registry/ui/messages.ts",
9
+ "type": "registry:ui",
10
+ "content": "import { usePage } from '@inertiajs/react'\nimport { useMemo } from 'react'\nimport {\n createTranslator,\n localizedLabel,\n type InterfaceDirection,\n type InterfaceLanguage,\n type LocalizedLabel,\n} from '~/components/ui/message_format'\n\nexport {\n arabicText,\n countForm,\n createTranslator,\n documentCount,\n recordCount,\n interpolate,\n localizedLabel,\n type InterfaceDirection,\n type InterfaceLanguage,\n type CountForm,\n type LocalizedLabel,\n type MessageParams,\n type Translate,\n} from '~/components/ui/message_format'\n\ntype MessageProps = {\n locale?: string\n dir?: InterfaceDirection\n languages?: InterfaceLanguage[]\n messages?: Record<string, string>\n}\n\nconst none: Record<string, string> = {}\nconst arabicOnly: InterfaceLanguage[] = [{ code: 'ar', name: 'العربية', dir: 'rtl' }]\n\n/**\n * Interface text for the current user: `t('نص عربي', params)` and `label(field.label)`.\n * A consumer that does not share `locale`, `dir` and `messages` keeps rendering Arabic.\n */\nexport function useMessages() {\n const props = usePage<MessageProps>().props\n const locale = props.locale ?? 'ar'\n const dir = props.dir ?? 'rtl'\n const messages = props.messages ?? none\n return useMemo(\n () => ({\n locale,\n dir,\n t: createTranslator(messages),\n label: (value: LocalizedLabel) => localizedLabel(value, locale),\n }),\n [locale, dir, messages]\n )\n}\n\n/** The enabled interface languages, Arabic first; one entry when only Arabic is enabled. */\nexport function useLanguages(): InterfaceLanguage[] {\n return usePage<MessageProps>().props.languages ?? arabicOnly\n}\n",
11
+ "target": "inertia/components/ui/messages.ts"
12
+ },
13
+ {
14
+ "path": "registry/ui/message_format.ts",
15
+ "type": "registry:ui",
16
+ "content": "export type InterfaceDirection = 'rtl' | 'ltr'\nexport type InterfaceLanguage = { code: string; name: string; dir: InterfaceDirection }\n/** A resource or field label: Arabic is required, every other language is optional. */\nexport type LocalizedLabel = { ar: string; [language: string]: string | undefined }\nexport type MessageParams = Record<string, string | number>\nexport type Translate = (arabic: string, params?: MessageParams) => string\n\nconst none: Record<string, string> = {}\n\n/** Replaces `{name}` placeholders; an unknown placeholder is kept as written. */\nexport function interpolate(template: string, params?: MessageParams) {\n if (!params) return template\n return template.replace(/\\{(\\w+)\\}/g, (match, name: string) =>\n Object.hasOwn(params, name) ? String(params[name]) : match\n )\n}\n\n/**\n * Arabic is the base language: the interface text is the lookup key and is shown\n * unchanged when no translation exists (always the case for Arabic users).\n */\nexport function createTranslator(messages: Record<string, string> = none): Translate {\n return (arabic, params) =>\n interpolate(Object.hasOwn(messages, arabic) ? messages[arabic] : arabic, params)\n}\n\n/** The Arabic text with its placeholders filled, for helpers called outside components. */\nexport const arabicText: Translate = createTranslator()\n\n/** `label.<locale>` when present, otherwise the required Arabic label. */\nexport function localizedLabel(label: LocalizedLabel, locale: string) {\n return label[locale] || label.ar\n}\n\n/** The CLDR plural category of a count under Arabic rules (n % 100 decides from 100 on). */\nexport type CountForm = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other'\nconst arabicPlurals = new Intl.PluralRules('ar')\nexport function countForm(count: number): CountForm {\n return arabicPlurals.select(count) as CountForm\n}\n\n/**\n * «سجل واحد»، «سجلان»، «3 سجلات»، «11 سجلًا»، «100 سجل» (#110). Each form is its own catalog\n * text, so translations choose their wording per form.\n */\nexport function recordCount(count: number, t: Translate = arabicText) {\n switch (countForm(count)) {\n case 'one':\n return t('سجل واحد')\n case 'two':\n return t('سجلان')\n case 'few':\n return t('{count} سجلات', { count })\n case 'many':\n return t('{count} سجلًا', { count })\n default:\n return t('{count} سجل', { count })\n }\n}\n\n/** «مستند واحد»، «مستندان»، «3 مستندات»، «11 مستندًا»، «100 مستند». */\nexport function documentCount(count: number, t: Translate = arabicText) {\n switch (countForm(count)) {\n case 'one':\n return t('مستند واحد')\n case 'two':\n return t('مستندان')\n case 'few':\n return t('{count} مستندات', { count })\n case 'many':\n return t('{count} مستندًا', { count })\n default:\n return t('{count} مستند', { count })\n }\n}\n",
17
+ "target": "inertia/components/ui/message_format.ts"
18
+ }
19
+ ],
20
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json"
21
+ }
@@ -5,13 +5,14 @@
5
5
  "lucide-react@1.47.0"
6
6
  ],
7
7
  "registryDependencies": [
8
- "button"
8
+ "button",
9
+ "messages"
9
10
  ],
10
11
  "files": [
11
12
  {
12
13
  "path": "registry/ui/pagination.tsx",
13
14
  "type": "registry:ui",
14
- "content": "import * as React from \"react\"\nimport { cn } from \"cn\"\nimport {\n ChevronLeftIcon,\n ChevronRightIcon,\n MoreHorizontalIcon,\n} from \"lucide-react\"\n\nimport { buttonVariants, type Button } from \"~/components/ui/button\"\n\nfunction Pagination({ className, ...props }: React.ComponentProps<\"nav\">) {\n return (\n <nav\n role=\"navigation\"\n aria-label=\"التنقل بين الصفحات\"\n data-slot=\"التنقل بين الصفحات\"\n className={cn(\"mx-auto flex w-full justify-center\", className)}\n {...props}\n />\n )\n}\n\nfunction PaginationContent({\n className,\n ...props\n}: React.ComponentProps<\"ul\">) {\n return (\n <ul\n data-slot=\"pagination-content\"\n className={cn(\"flex flex-row items-center gap-1\", className)}\n {...props}\n />\n )\n}\n\nfunction PaginationItem({ ...props }: React.ComponentProps<\"li\">) {\n return <li data-slot=\"pagination-item\" {...props} />\n}\n\ntype PaginationLinkProps = {\n isActive?: boolean\n} & Pick<React.ComponentProps<typeof Button>, \"size\"> &\n React.ComponentProps<\"a\">\n\nfunction PaginationLink({\n className,\n isActive,\n size = \"icon\",\n ...props\n}: PaginationLinkProps) {\n return (\n <a\n aria-current={isActive ? \"page\" : undefined}\n data-slot=\"pagination-link\"\n data-active={isActive}\n className={cn(\n buttonVariants({\n variant: isActive ? \"outline\" : \"ghost\",\n size,\n }),\n className\n )}\n {...props}\n />\n )\n}\n\nfunction PaginationPrevious({\n className,\n ...props\n}: React.ComponentProps<typeof PaginationLink>) {\n return (\n <PaginationLink\n aria-label=\"الصفحة السابقة\"\n size=\"default\"\n className={cn(\"gap-1 px-2.5 sm:ps-2.5\", className)}\n {...props}\n >\n <ChevronLeftIcon className=\"rtl:rotate-180\" />\n <span className=\"hidden sm:block\">السابق</span>\n </PaginationLink>\n )\n}\n\nfunction PaginationNext({\n className,\n ...props\n}: React.ComponentProps<typeof PaginationLink>) {\n return (\n <PaginationLink\n aria-label=\"الصفحة التالية\"\n size=\"default\"\n className={cn(\"gap-1 px-2.5 sm:pe-2.5\", className)}\n {...props}\n >\n <span className=\"hidden sm:block\">التالي</span>\n <ChevronRightIcon className=\"rtl:rotate-180\" />\n </PaginationLink>\n )\n}\n\nfunction PaginationEllipsis({\n className,\n ...props\n}: React.ComponentProps<\"span\">) {\n return (\n <span\n aria-hidden\n data-slot=\"pagination-ellipsis\"\n className={cn(\"flex size-9 items-center justify-center\", className)}\n {...props}\n >\n <MoreHorizontalIcon className=\"size-4\" />\n <span className=\"sr-only\">صفحات أخرى</span>\n </span>\n )\n}\n\nexport {\n Pagination,\n PaginationContent,\n PaginationLink,\n PaginationItem,\n PaginationPrevious,\n PaginationNext,\n PaginationEllipsis,\n}\n",
15
+ "content": "import * as React from \"react\"\nimport { cn } from \"cn\"\nimport {\n ChevronLeftIcon,\n ChevronRightIcon,\n MoreHorizontalIcon,\n} from \"lucide-react\"\n\nimport { buttonVariants, type Button } from \"~/components/ui/button\"\nimport { useMessages } from \"~/components/ui/messages\"\n\nfunction Pagination({ className, ...props }: React.ComponentProps<\"nav\">) {\n const { t } = useMessages()\n return (\n <nav\n role=\"navigation\"\n aria-label={t(\"التنقل بين الصفحات\")}\n data-slot=\"التنقل بين الصفحات\"\n className={cn(\"mx-auto flex w-full justify-center\", className)}\n {...props}\n />\n )\n}\n\nfunction PaginationContent({\n className,\n ...props\n}: React.ComponentProps<\"ul\">) {\n return (\n <ul\n data-slot=\"pagination-content\"\n className={cn(\"flex flex-row items-center gap-1\", className)}\n {...props}\n />\n )\n}\n\nfunction PaginationItem({ ...props }: React.ComponentProps<\"li\">) {\n return <li data-slot=\"pagination-item\" {...props} />\n}\n\ntype PaginationLinkProps = {\n isActive?: boolean\n} & Pick<React.ComponentProps<typeof Button>, \"size\"> &\n React.ComponentProps<\"a\">\n\nfunction PaginationLink({\n className,\n isActive,\n size = \"icon\",\n ...props\n}: PaginationLinkProps) {\n return (\n <a\n aria-current={isActive ? \"page\" : undefined}\n data-slot=\"pagination-link\"\n data-active={isActive}\n className={cn(\n buttonVariants({\n variant: isActive ? \"outline\" : \"ghost\",\n size,\n }),\n className\n )}\n {...props}\n />\n )\n}\n\nfunction PaginationPrevious({\n className,\n ...props\n}: React.ComponentProps<typeof PaginationLink>) {\n const { t } = useMessages()\n return (\n <PaginationLink\n aria-label={t(\"الصفحة السابقة\")}\n size=\"default\"\n className={cn(\"gap-1 px-2.5 sm:ps-2.5\", className)}\n {...props}\n >\n <ChevronLeftIcon className=\"rtl:rotate-180\" />\n <span className=\"hidden sm:block\">{t(\"السابق\")}</span>\n </PaginationLink>\n )\n}\n\nfunction PaginationNext({\n className,\n ...props\n}: React.ComponentProps<typeof PaginationLink>) {\n const { t } = useMessages()\n return (\n <PaginationLink\n aria-label={t(\"الصفحة التالية\")}\n size=\"default\"\n className={cn(\"gap-1 px-2.5 sm:pe-2.5\", className)}\n {...props}\n >\n <span className=\"hidden sm:block\">{t(\"التالي\")}</span>\n <ChevronRightIcon className=\"rtl:rotate-180\" />\n </PaginationLink>\n )\n}\n\nfunction PaginationEllipsis({\n className,\n ...props\n}: React.ComponentProps<\"span\">) {\n const { t } = useMessages()\n return (\n <span\n aria-hidden\n data-slot=\"pagination-ellipsis\"\n className={cn(\"flex size-9 items-center justify-center\", className)}\n {...props}\n >\n <MoreHorizontalIcon className=\"size-4\" />\n <span className=\"sr-only\">{t(\"صفحات أخرى\")}</span>\n </span>\n )\n}\n\nexport {\n Pagination,\n PaginationContent,\n PaginationLink,\n PaginationItem,\n PaginationPrevious,\n PaginationNext,\n PaginationEllipsis,\n}\n",
15
16
  "target": "inertia/components/ui/pagination.tsx"
16
17
  }
17
18
  ],
@@ -9,7 +9,7 @@
9
9
  {
10
10
  "path": "registry/ui/popover.tsx",
11
11
  "type": "registry:ui",
12
- "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { cn } from \"cn\"\nimport { Popover as PopoverPrimitive } from \"radix-ui\"\n\nfunction Popover({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />\n}\n\nfunction PopoverTrigger({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {\n return <PopoverPrimitive.Trigger data-slot=\"popover-trigger\" {...props} />\n}\n\nfunction PopoverContent({\n className,\n align = \"center\",\n sideOffset = 4,\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Content>) {\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n data-slot=\"popover-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\",\n className\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n )\n}\n\nfunction PopoverAnchor({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {\n return <PopoverPrimitive.Anchor data-slot=\"popover-anchor\" {...props} />\n}\n\nfunction PopoverHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"popover-header\"\n className={cn(\"flex flex-col gap-1 text-sm\", className)}\n {...props}\n />\n )\n}\n\nfunction PopoverTitle({ className, ...props }: React.ComponentProps<\"h2\">) {\n return (\n <div\n data-slot=\"popover-title\"\n className={cn(\"font-medium\", className)}\n {...props}\n />\n )\n}\n\nfunction PopoverDescription({\n className,\n ...props\n}: React.ComponentProps<\"p\">) {\n return (\n <p\n data-slot=\"popover-description\"\n className={cn(\"text-muted-foreground\", className)}\n {...props}\n />\n )\n}\n\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverAnchor,\n PopoverHeader,\n PopoverTitle,\n PopoverDescription,\n}\n",
12
+ "content": "import * as React from \"react\"\nimport { cn } from \"cn\"\nimport { Popover as PopoverPrimitive } from \"radix-ui\"\n\nfunction Popover({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />\n}\n\nfunction PopoverTrigger({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {\n return <PopoverPrimitive.Trigger data-slot=\"popover-trigger\" {...props} />\n}\n\nfunction PopoverContent({\n className,\n align = \"center\",\n sideOffset = 4,\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Content>) {\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n data-slot=\"popover-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\",\n className\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n )\n}\n\nfunction PopoverAnchor({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {\n return <PopoverPrimitive.Anchor data-slot=\"popover-anchor\" {...props} />\n}\n\nfunction PopoverHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"popover-header\"\n className={cn(\"flex flex-col gap-1 text-sm\", className)}\n {...props}\n />\n )\n}\n\nfunction PopoverTitle({ className, ...props }: React.ComponentProps<\"h2\">) {\n return (\n <div\n data-slot=\"popover-title\"\n className={cn(\"font-medium\", className)}\n {...props}\n />\n )\n}\n\nfunction PopoverDescription({\n className,\n ...props\n}: React.ComponentProps<\"p\">) {\n return (\n <p\n data-slot=\"popover-description\"\n className={cn(\"text-muted-foreground\", className)}\n {...props}\n />\n )\n}\n\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverAnchor,\n PopoverHeader,\n PopoverTitle,\n PopoverDescription,\n}\n",
13
13
  "target": "inertia/components/ui/popover.tsx"
14
14
  }
15
15
  ],
@@ -9,7 +9,7 @@
9
9
  {
10
10
  "path": "registry/ui/radio-group.tsx",
11
11
  "type": "registry:ui",
12
- "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { cn } from \"cn\"\nimport { CircleIcon } from \"lucide-react\"\nimport { RadioGroup as RadioGroupPrimitive } from \"radix-ui\"\n\nfunction RadioGroup({\n className,\n ...props\n}: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {\n return (\n <RadioGroupPrimitive.Root dir=\"rtl\"\n data-slot=\"radio-group\"\n className={cn(\"grid gap-3\", className)}\n {...props}\n />\n )\n}\n\nfunction RadioGroupItem({\n className,\n ...props\n}: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {\n return (\n <RadioGroupPrimitive.Item\n data-slot=\"radio-group-item\"\n className={cn(\n \"aspect-square size-4 shrink-0 rounded-full border border-input text-primary shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:ring-destructive/40\",\n className\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator\n data-slot=\"radio-group-indicator\"\n className=\"relative flex items-center justify-center\"\n >\n <CircleIcon className=\"absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 fill-primary\" />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n )\n}\n\nexport { RadioGroup, RadioGroupItem }\n",
12
+ "content": "import * as React from \"react\"\nimport { cn } from \"cn\"\nimport { CircleIcon } from \"lucide-react\"\nimport { RadioGroup as RadioGroupPrimitive } from \"radix-ui\"\n\nfunction RadioGroup({\n className,\n ...props\n}: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {\n return (\n <RadioGroupPrimitive.Root dir=\"rtl\"\n data-slot=\"radio-group\"\n className={cn(\"grid gap-3\", className)}\n {...props}\n />\n )\n}\n\nfunction RadioGroupItem({\n className,\n ...props\n}: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {\n return (\n <RadioGroupPrimitive.Item\n data-slot=\"radio-group-item\"\n className={cn(\n \"aspect-square size-4 shrink-0 rounded-full border border-input text-primary shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:ring-destructive/40\",\n className\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator\n data-slot=\"radio-group-indicator\"\n className=\"relative flex items-center justify-center\"\n >\n <CircleIcon className=\"absolute top-1/2 start-1/2 size-2 ltr:-translate-x-1/2 rtl:translate-x-1/2 -translate-y-1/2 fill-primary\" />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n )\n}\n\nexport { RadioGroup, RadioGroupItem }\n",
13
13
  "target": "inertia/components/ui/radio-group.tsx"
14
14
  }
15
15
  ],
@@ -10,7 +10,8 @@
10
10
  "dialog",
11
11
  "select",
12
12
  "ui-preferences",
13
- "resource-value"
13
+ "resource-value",
14
+ "user-avatar"
14
15
  ],
15
16
  "dependencies": [
16
17
  "lucide-react@1.47.0",
@@ -20,7 +21,7 @@
20
21
  {
21
22
  "path": "registry/ui/record-assignments.tsx",
22
23
  "type": "registry:ui",
23
- "content": "import { useCallback, useEffect, useState } from 'react'\nimport axios from 'axios'\nimport { ListChecks, Plus } from 'lucide-react'\nimport type { Assignment, MentionCandidate } from 'adula'\nimport { Badge } from '~/components/ui/badge'\nimport { Button } from '~/components/ui/button'\nimport { Input } from '~/components/ui/input'\nimport { Label } from '~/components/ui/label'\nimport { Textarea } from '~/components/ui/textarea'\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from '~/components/ui/dialog'\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '~/components/ui/select'\nimport { formatDate } from '~/components/ui/resource-value'\nimport { useUiPreferences } from '~/components/ui/ui-preferences'\n\nconst json = { headers: { Accept: 'application/json' }, withXSRFToken: true }\nconst statusLabel: Record<Assignment['status'], string> = {\n open: 'مفتوحة',\n done: 'منجزة',\n cancelled: 'ملغاة',\n}\n\n/** Tasks assigned on one record, with an assignment dialog for users who may update it. */\nexport function RecordAssignments({\n resource,\n id,\n canAssign,\n}: {\n resource: string\n id: number | string\n canAssign: boolean\n}) {\n const { calendar } = useUiPreferences()\n const base = `/resources/${resource}/${id}`\n const [rows, setRows] = useState<Assignment[] | null>(null)\n const [open, setOpen] = useState(false)\n const [people, setPeople] = useState<MentionCandidate[]>([])\n const [assigneeId, setAssigneeId] = useState('')\n const [title, setTitle] = useState('')\n const [note, setNote] = useState('')\n const [dueOn, setDueOn] = useState('')\n const [error, setError] = useState('')\n const [busy, setBusy] = useState(false)\n\n const load = useCallback(async () => {\n try {\n const response = await axios.get<{ data: Assignment[] }>(`${base}/assignments`, json)\n setRows(response.data.data)\n } catch {\n setRows([])\n }\n }, [base])\n useEffect(() => {\n void load()\n }, [load])\n useEffect(() => {\n if (!open) return\n axios\n .get<{ data: MentionCandidate[] }>(`${base}/mentions`, json)\n .then((response) => setPeople(response.data.data))\n .catch(() => setPeople([]))\n }, [open, base])\n\n const submit = async (event: React.FormEvent) => {\n event.preventDefault()\n setBusy(true)\n setError('')\n try {\n await axios.post(\n `${base}/assignments`,\n { assigneeId: Number(assigneeId), title, note, dueOn },\n json\n )\n setOpen(false)\n setTitle('')\n setNote('')\n setDueOn('')\n setAssigneeId('')\n await load()\n } catch (caught) {\n setError(\n axios.isAxiosError(caught) && caught.response?.data?.error?.message\n ? String(caught.response.data.error.message)\n : 'تعذر إسناد المهمة.'\n )\n } finally {\n setBusy(false)\n }\n }\n\n return (\n <section aria-label=\"المهام المسندة\" className=\"rounded-xl border bg-white\">\n <div className=\"flex items-center gap-2 border-b px-7 py-4\">\n <ListChecks size={16} className=\"text-muted-foreground\" />\n <h2 className=\"text-sm font-semibold\">المهام المسندة</h2>\n {canAssign && (\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n className=\"ms-auto\"\n onClick={() => setOpen(true)}\n >\n <Plus size={14} />\n إسناد مهمة\n </Button>\n )}\n </div>\n {rows === null ? (\n <p role=\"status\" className=\"px-7 py-5 text-xs text-muted-foreground\">\n جارٍ تحميل المهام…\n </p>\n ) : rows.length === 0 ? (\n <p className=\"px-7 py-5 text-xs text-muted-foreground\">لا مهام على هذا السجل.</p>\n ) : (\n <ul className=\"divide-y\">\n {rows.map((row) => (\n <li\n key={row.id}\n className=\"flex flex-wrap items-center gap-x-4 gap-y-1 px-7 py-3 text-sm\"\n >\n <span className=\"font-medium\">{row.title}</span>\n <Badge variant={row.status === 'open' ? 'default' : 'secondary'}>\n {statusLabel[row.status]}\n </Badge>\n <span className=\"text-xs text-muted-foreground\">\n المكلف: {row.assigneeName ?? `#${row.assigneeId}`}\n </span>\n {row.dueOn && (\n <span className=\"text-xs text-muted-foreground\">\n الاستحقاق <bdi className=\"tabular-nums\">{formatDate(row.dueOn, calendar)}</bdi>\n </span>\n )}\n </li>\n ))}\n </ul>\n )}\n <Dialog open={open} onOpenChange={setOpen}>\n <DialogContent dir=\"rtl\" className=\"sm:max-w-lg\">\n <DialogHeader>\n <DialogTitle>إسناد مهمة</DialogTitle>\n <DialogDescription>\n تظهر المهمة في «مهامي» لدى المكلف، ويُشعَر بها فوراً.\n </DialogDescription>\n </DialogHeader>\n <form id=\"assignment-form\" className=\"space-y-4\" onSubmit={submit}>\n <div className=\"space-y-2\">\n <Label htmlFor=\"assignment-assignee\">المكلف</Label>\n <Select value={assigneeId} onValueChange={setAssigneeId}>\n <SelectTrigger id=\"assignment-assignee\" aria-label=\"المكلف\">\n <SelectValue placeholder=\"اختر زميلاً يملك صلاحية العرض\" />\n </SelectTrigger>\n <SelectContent>\n {people.map((person) => (\n <SelectItem key={person.id} value={String(person.id)}>\n {person.name}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n <div className=\"space-y-2\">\n <Label htmlFor=\"assignment-title\">عنوان المهمة</Label>\n <Input\n id=\"assignment-title\"\n value={title}\n maxLength={200}\n required\n onChange={(event) => setTitle(event.target.value)}\n />\n </div>\n <div className=\"space-y-2\">\n <Label htmlFor=\"assignment-due\">تاريخ الاستحقاق</Label>\n <Input\n id=\"assignment-due\"\n type=\"date\"\n value={dueOn}\n onChange={(event) => setDueOn(event.target.value)}\n />\n </div>\n <div className=\"space-y-2\">\n <Label htmlFor=\"assignment-note\">ملاحظة</Label>\n <Textarea\n id=\"assignment-note\"\n value={note}\n maxLength={2000}\n onChange={(event) => setNote(event.target.value)}\n />\n </div>\n {error && (\n <p role=\"alert\" className=\"rounded-lg bg-red-50 px-3 py-2 text-xs text-red-800\">\n {error}\n </p>\n )}\n </form>\n <DialogFooter>\n <Button type=\"button\" variant=\"outline\" onClick={() => setOpen(false)}>\n إلغاء\n </Button>\n <Button\n type=\"submit\"\n form=\"assignment-form\"\n disabled={busy || !assigneeId || !title.trim()}\n >\n إسناد\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n </section>\n )\n}\n",
24
+ "content": "import { useCallback, useEffect, useState } from 'react'\nimport axios from 'axios'\nimport { ListChecks, Plus } from 'lucide-react'\nimport type { Assignment, MentionCandidate } from 'adula'\nimport { Badge } from '~/components/ui/badge'\nimport { UserAvatar } from '~/components/ui/user-avatar'\nimport { Button } from '~/components/ui/button'\nimport { Input } from '~/components/ui/input'\nimport { Label } from '~/components/ui/label'\nimport { Textarea } from '~/components/ui/textarea'\nimport { Dialog, DialogClose } from '~/components/ui/dialog'\nimport { LongDialogContent } from '~/components/ui/long-dialog'\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '~/components/ui/select'\nimport { formatDate } from '~/components/ui/resource-value'\nimport { useUiPreferences } from '~/components/ui/ui-preferences'\n\nconst json = { headers: { Accept: 'application/json' }, withXSRFToken: true }\nconst statusLabel: Record<Assignment['status'], string> = {\n open: 'مفتوحة',\n done: 'منجزة',\n cancelled: 'ملغاة',\n}\n\n/** Tasks assigned on one record, with an assignment dialog for users who may update it. */\nexport function RecordAssignments({\n resource,\n id,\n canAssign,\n}: {\n resource: string\n id: number | string\n canAssign: boolean\n}) {\n const { calendar } = useUiPreferences()\n const base = `/resources/${resource}/${id}`\n const [rows, setRows] = useState<Assignment[] | null>(null)\n const [open, setOpen] = useState(false)\n const [people, setPeople] = useState<MentionCandidate[]>([])\n const [assigneeId, setAssigneeId] = useState('')\n const [title, setTitle] = useState('')\n const [note, setNote] = useState('')\n const [dueOn, setDueOn] = useState('')\n const [error, setError] = useState('')\n const [busy, setBusy] = useState(false)\n\n const load = useCallback(async () => {\n try {\n const response = await axios.get<{ data: Assignment[] }>(`${base}/assignments`, json)\n setRows(response.data.data)\n } catch {\n setRows([])\n }\n }, [base])\n useEffect(() => {\n void load()\n }, [load])\n useEffect(() => {\n if (!open) return\n // Each opening starts from an empty draft, so «إغلاق دون حفظ» really discards it.\n setAssigneeId('')\n setTitle('')\n setNote('')\n setDueOn('')\n setError('')\n axios\n .get<{ data: MentionCandidate[] }>(`${base}/mentions`, json)\n .then((response) => setPeople(response.data.data))\n .catch(() => setPeople([]))\n }, [open, base])\n\n const submit = async (event: React.FormEvent) => {\n event.preventDefault()\n setBusy(true)\n setError('')\n try {\n await axios.post(\n `${base}/assignments`,\n { assigneeId: Number(assigneeId), title, note, dueOn },\n json\n )\n setOpen(false)\n await load()\n } catch (caught) {\n setError(\n axios.isAxiosError(caught) && caught.response?.data?.error?.message\n ? String(caught.response.data.error.message)\n : 'تعذر إسناد المهمة.'\n )\n } finally {\n setBusy(false)\n }\n }\n\n return (\n <section aria-label=\"المهام المسندة\" className=\"rounded-xl border bg-card\">\n <div className=\"flex items-center gap-2 border-b px-7 py-4\">\n <ListChecks size={16} className=\"text-muted-foreground\" />\n <h2 className=\"text-sm font-semibold\">المهام المسندة</h2>\n {canAssign && (\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n className=\"ms-auto\"\n onClick={() => setOpen(true)}\n >\n <Plus size={14} />\n إسناد مهمة\n </Button>\n )}\n </div>\n {rows === null ? (\n <p role=\"status\" className=\"px-7 py-5 text-xs text-muted-foreground\">\n جارٍ تحميل المهام…\n </p>\n ) : rows.length === 0 ? (\n <p className=\"px-7 py-5 text-xs text-muted-foreground\">لا مهام على هذا السجل.</p>\n ) : (\n <ul className=\"divide-y\">\n {rows.map((row) => (\n <li\n key={row.id}\n className=\"flex flex-wrap items-center gap-x-4 gap-y-1 px-7 py-3 text-sm\"\n >\n <span className=\"font-medium\">{row.title}</span>\n <Badge variant={row.status === 'open' ? 'default' : 'secondary'}>\n {statusLabel[row.status]}\n </Badge>\n <span className=\"inline-flex items-center gap-1.5 text-xs text-muted-foreground\">\n <UserAvatar\n user={{ id: row.assigneeId, name: row.assigneeName, avatarUrl: row.assigneeAvatarUrl }}\n size=\"xs\"\n />\n المكلف: {row.assigneeName ?? `#${row.assigneeId}`}\n </span>\n {row.dueOn && (\n <span className=\"text-xs text-muted-foreground\">\n الاستحقاق <bdi className=\"tabular-nums\">{formatDate(row.dueOn, calendar)}</bdi>\n </span>\n )}\n </li>\n ))}\n </ul>\n )}\n <Dialog\n mode=\"edit\"\n open={open}\n onOpenChange={setOpen}\n value={{ assigneeId, title, note, dueOn }}\n >\n <LongDialogContent\n dir=\"rtl\"\n width=\"lg\"\n title=\"إسناد مهمة\"\n description=\"تظهر المهمة في «مهامي» لدى المكلف، ويُشعَر بها فوراً.\"\n footer={\n <>\n <DialogClose asChild>\n <Button type=\"button\" variant=\"outline\">\n إلغاء\n </Button>\n </DialogClose>\n <Button\n type=\"submit\"\n form=\"assignment-form\"\n disabled={busy || !assigneeId || !title.trim()}\n >\n إسناد\n </Button>\n </>\n }\n >\n <form\n id=\"assignment-form\"\n className=\"space-y-4\"\n onSubmit={submit}\n // Closing asks first only when a value differs from the empty draft it opened with.\n >\n <div className=\"space-y-2\">\n <Label htmlFor=\"assignment-assignee\">المكلف</Label>\n <Select value={assigneeId} onValueChange={setAssigneeId}>\n <SelectTrigger id=\"assignment-assignee\" aria-label=\"المكلف\">\n <SelectValue placeholder=\"اختر زميلاً يملك صلاحية العرض\" />\n </SelectTrigger>\n <SelectContent>\n {people.map((person) => (\n <SelectItem key={person.id} value={String(person.id)}>\n {person.name}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n <div className=\"space-y-2\">\n <Label htmlFor=\"assignment-title\">عنوان المهمة</Label>\n <Input\n id=\"assignment-title\"\n value={title}\n maxLength={200}\n required\n onChange={(event) => setTitle(event.target.value)}\n />\n </div>\n <div className=\"space-y-2\">\n <Label htmlFor=\"assignment-due\">تاريخ الاستحقاق</Label>\n <Input\n id=\"assignment-due\"\n type=\"date\"\n value={dueOn}\n onChange={(event) => setDueOn(event.target.value)}\n />\n </div>\n <div className=\"space-y-2\">\n <Label htmlFor=\"assignment-note\">ملاحظة</Label>\n <Textarea\n id=\"assignment-note\"\n value={note}\n maxLength={2000}\n onChange={(event) => setNote(event.target.value)}\n />\n </div>\n {error && (\n <p role=\"alert\" className=\"rounded-lg bg-destructive/10 px-3 py-2 text-xs text-destructive\">\n {error}\n </p>\n )}\n </form>\n </LongDialogContent>\n </Dialog>\n </section>\n )\n}\n",
24
25
  "target": "inertia/components/ui/record-assignments.tsx"
25
26
  }
26
27
  ],