@idds/vue 1.6.14 → 1.6.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -15
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -225,19 +225,36 @@ const currentMode = getThemeMode();
|
|
|
225
225
|
### Toast Notifications
|
|
226
226
|
|
|
227
227
|
```vue
|
|
228
|
+
<!-- Root Component (e.g. App.vue) -->
|
|
228
229
|
<template>
|
|
229
230
|
<ToastProvider>
|
|
230
|
-
<
|
|
231
|
+
<router-view />
|
|
231
232
|
</ToastProvider>
|
|
232
233
|
</template>
|
|
233
234
|
|
|
234
235
|
<script setup>
|
|
235
|
-
import { ToastProvider
|
|
236
|
+
import { ToastProvider } from '@idds/vue';
|
|
237
|
+
</script>
|
|
238
|
+
```
|
|
236
239
|
|
|
237
|
-
|
|
240
|
+
```vue
|
|
241
|
+
<!-- Child Component -->
|
|
242
|
+
<template>
|
|
243
|
+
<Button @click="handleShowToast">Show Toast</Button>
|
|
244
|
+
</template>
|
|
238
245
|
|
|
239
|
-
|
|
240
|
-
|
|
246
|
+
<script setup>
|
|
247
|
+
import { useToast, Button } from '@idds/vue';
|
|
248
|
+
|
|
249
|
+
const { toast } = useToast();
|
|
250
|
+
|
|
251
|
+
const handleShowToast = () => {
|
|
252
|
+
toast({
|
|
253
|
+
state: 'positive',
|
|
254
|
+
title: 'Berhasil',
|
|
255
|
+
description: 'Data berhasil disimpan',
|
|
256
|
+
duration: 3000,
|
|
257
|
+
});
|
|
241
258
|
};
|
|
242
259
|
</script>
|
|
243
260
|
```
|
|
@@ -245,24 +262,40 @@ const showSuccess = () => {
|
|
|
245
262
|
### Confirmation Dialog
|
|
246
263
|
|
|
247
264
|
```vue
|
|
265
|
+
<!-- Root Component -->
|
|
248
266
|
<template>
|
|
249
267
|
<ConfirmationProvider>
|
|
250
|
-
<
|
|
268
|
+
<router-view />
|
|
251
269
|
</ConfirmationProvider>
|
|
252
270
|
</template>
|
|
253
271
|
|
|
254
272
|
<script setup>
|
|
255
|
-
import { ConfirmationProvider
|
|
273
|
+
import { ConfirmationProvider } from '@idds/vue';
|
|
274
|
+
</script>
|
|
275
|
+
```
|
|
256
276
|
|
|
257
|
-
|
|
277
|
+
```vue
|
|
278
|
+
<!-- Child Component -->
|
|
279
|
+
<template>
|
|
280
|
+
<Button @click="handleDelete" variant="error">Hapus Item</Button>
|
|
281
|
+
</template>
|
|
282
|
+
|
|
283
|
+
<script setup>
|
|
284
|
+
import { useConfirmation, Button } from '@idds/vue';
|
|
285
|
+
|
|
286
|
+
const { confirm } = useConfirmation();
|
|
258
287
|
|
|
259
288
|
const handleDelete = async () => {
|
|
260
|
-
const
|
|
261
|
-
title: '
|
|
262
|
-
message: '
|
|
289
|
+
const isConfirmed = await confirm({
|
|
290
|
+
title: 'Hapus Data?',
|
|
291
|
+
message: 'Apakah Anda yakin ingin menghapus data ini?',
|
|
292
|
+
confirmText: 'Hapus',
|
|
293
|
+
cancelText: 'Batal',
|
|
294
|
+
confirmClassName: 'bg-red-600 hover:bg-red-700 text-white',
|
|
263
295
|
});
|
|
264
|
-
|
|
265
|
-
|
|
296
|
+
|
|
297
|
+
if (isConfirmed) {
|
|
298
|
+
console.log('User confirmed deletion');
|
|
266
299
|
}
|
|
267
300
|
};
|
|
268
301
|
</script>
|
|
@@ -279,7 +312,7 @@ import {
|
|
|
279
312
|
encodeHtmlEntities,
|
|
280
313
|
decodeHtmlEntities,
|
|
281
314
|
sanitizeFileName,
|
|
282
|
-
containsDangerousPatterns
|
|
315
|
+
containsDangerousPatterns,
|
|
283
316
|
} from '@idds/vue';
|
|
284
317
|
|
|
285
318
|
// Sanitize user input
|
|
@@ -295,7 +328,11 @@ if (!validation.isValid) {
|
|
|
295
328
|
### File Validation
|
|
296
329
|
|
|
297
330
|
```js
|
|
298
|
-
import {
|
|
331
|
+
import {
|
|
332
|
+
validateFile,
|
|
333
|
+
validateFileMagicNumber,
|
|
334
|
+
formatFileSize,
|
|
335
|
+
} from '@idds/vue';
|
|
299
336
|
|
|
300
337
|
// Validate file
|
|
301
338
|
const result = validateFile(file, {
|
|
@@ -308,6 +345,7 @@ const formatted = formatFileSize(1024 * 1024); // "1 MB"
|
|
|
308
345
|
```
|
|
309
346
|
|
|
310
347
|
### Styling
|
|
348
|
+
|
|
311
349
|
Components use BEM-like naming conventions (e.g., `ina-button`, `ina-button--primary`). The `@idds/styles` package serves all necessary core styles. Tailwind integration is completely **optional**.
|
|
312
350
|
|
|
313
351
|
## TypeScript Support
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idds/vue",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.15",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"vue-tsc": "^2.0.6"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@idds/styles": "^1.6.
|
|
66
|
+
"@idds/styles": "^1.6.15",
|
|
67
67
|
"clsx": "^2.1.1"
|
|
68
68
|
}
|
|
69
69
|
}
|