@idds/vue 1.6.12 → 1.6.14
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 +16 -271
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +194 -191
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +894 -873
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -117,28 +117,6 @@ Or use minified versions for production:
|
|
|
117
117
|
@import '@idds/styles/tailwind/css/bgn.min.css';
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
-
Then you can use Tailwind utility classes with INA Digital colors:
|
|
121
|
-
|
|
122
|
-
```vue
|
|
123
|
-
<template>
|
|
124
|
-
<div class="bg-blue-500 text-white p-4">
|
|
125
|
-
<p class="text-guide-500">This text uses guide-500 color</p>
|
|
126
|
-
<p class="text-neutral-500">This text uses neutral-500 color</p>
|
|
127
|
-
</div>
|
|
128
|
-
</template>
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
**Available brand theme files:**
|
|
132
|
-
|
|
133
|
-
- `@idds/styles/tailwind/css/idds.css` - Default theme
|
|
134
|
-
- `@idds/styles/tailwind/css/inagov.css` - INAGov brand
|
|
135
|
-
- `@idds/styles/tailwind/css/inaku.css` - INAKu brand
|
|
136
|
-
- `@idds/styles/tailwind/css/inapas.css` - INAPas brand
|
|
137
|
-
- `@idds/styles/tailwind/css/bgn.css` - BGN brand
|
|
138
|
-
- `@idds/styles/tailwind/css/bkn.css` - BKN brand
|
|
139
|
-
- `@idds/styles/tailwind/css/lan.css` - LAN brand
|
|
140
|
-
- `@idds/styles/tailwind/css/panrb.css` - panrb brand
|
|
141
|
-
|
|
142
120
|
## Available Components
|
|
143
121
|
|
|
144
122
|
### Form Components
|
|
@@ -223,62 +201,23 @@ setBrandTheme('bgn'); // or 'inagov', 'inaku', 'inapas', 'bkn', 'lan', 'panrb'
|
|
|
223
201
|
|
|
224
202
|
// Use default theme
|
|
225
203
|
setBrandTheme('default');
|
|
226
|
-
|
|
227
|
-
// Remove brand theme (use default)
|
|
228
|
-
setBrandTheme(null);
|
|
229
204
|
```
|
|
230
205
|
|
|
231
|
-
###
|
|
232
|
-
|
|
233
|
-
- `'default'` - Default INA Digital theme
|
|
234
|
-
- `'inagov'` - INAGov brand theme
|
|
235
|
-
- `'inaku'` - INAKu brand theme
|
|
236
|
-
- `'inapas'` - INAPas brand theme
|
|
237
|
-
- `'bgn'` - BGN brand theme
|
|
238
|
-
- `'bkn'` - BKN brand theme
|
|
239
|
-
- `'lan'` - LAN brand theme
|
|
240
|
-
- `'panrb'` - panrb brand theme
|
|
241
|
-
|
|
242
|
-
### Custom Theme
|
|
243
|
-
|
|
244
|
-
You can also set a custom theme:
|
|
245
|
-
|
|
246
|
-
```js
|
|
247
|
-
import { setCustomTheme } from '@idds/vue';
|
|
248
|
-
|
|
249
|
-
setCustomTheme({
|
|
250
|
-
name: 'custom',
|
|
251
|
-
colors: {
|
|
252
|
-
primary500: '#0968f6',
|
|
253
|
-
primary600: '#0754c4',
|
|
254
|
-
// ... other color tokens
|
|
255
|
-
},
|
|
256
|
-
});
|
|
257
|
-
```
|
|
206
|
+
### Theme Mode (Light/Dark)
|
|
258
207
|
|
|
259
|
-
|
|
208
|
+
You can globally set or toggle the theme mode between light and dark:
|
|
260
209
|
|
|
261
210
|
```js
|
|
262
|
-
import {
|
|
263
|
-
getCurrentTheme,
|
|
264
|
-
getAvailableBrands,
|
|
265
|
-
resetTheme,
|
|
266
|
-
isValidBrand,
|
|
267
|
-
} from '@idds/vue';
|
|
211
|
+
import { setThemeMode, toggleThemeMode, getThemeMode } from '@idds/vue';
|
|
268
212
|
|
|
269
|
-
//
|
|
270
|
-
|
|
213
|
+
// Set specific mode
|
|
214
|
+
setThemeMode('dark'); // or 'light'
|
|
271
215
|
|
|
272
|
-
//
|
|
273
|
-
|
|
216
|
+
// Toggle current mode
|
|
217
|
+
toggleThemeMode();
|
|
274
218
|
|
|
275
|
-
//
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
// Validate brand name
|
|
279
|
-
if (isValidBrand('bgn')) {
|
|
280
|
-
setBrandTheme('bgn');
|
|
281
|
-
}
|
|
219
|
+
// Get current mode
|
|
220
|
+
const currentMode = getThemeMode();
|
|
282
221
|
```
|
|
283
222
|
|
|
284
223
|
## Composables
|
|
@@ -300,10 +239,6 @@ const toast = useToast();
|
|
|
300
239
|
const showSuccess = () => {
|
|
301
240
|
toast.success('Operation completed successfully!');
|
|
302
241
|
};
|
|
303
|
-
|
|
304
|
-
const showError = () => {
|
|
305
|
-
toast.error('An error occurred');
|
|
306
|
-
};
|
|
307
242
|
</script>
|
|
308
243
|
```
|
|
309
244
|
|
|
@@ -326,7 +261,6 @@ const handleDelete = async () => {
|
|
|
326
261
|
title: 'Delete Item',
|
|
327
262
|
message: 'Are you sure you want to delete this item?',
|
|
328
263
|
});
|
|
329
|
-
|
|
330
264
|
if (result) {
|
|
331
265
|
// User confirmed
|
|
332
266
|
}
|
|
@@ -334,123 +268,6 @@ const handleDelete = async () => {
|
|
|
334
268
|
</script>
|
|
335
269
|
```
|
|
336
270
|
|
|
337
|
-
## Component Examples
|
|
338
|
-
|
|
339
|
-
### TextField
|
|
340
|
-
|
|
341
|
-
```vue
|
|
342
|
-
<template>
|
|
343
|
-
<TextField
|
|
344
|
-
v-model="email"
|
|
345
|
-
label="Email"
|
|
346
|
-
placeholder="Enter your email"
|
|
347
|
-
type="email"
|
|
348
|
-
:required="true"
|
|
349
|
-
:show-clear-button="true"
|
|
350
|
-
:max-length="100"
|
|
351
|
-
:show-char-count="true"
|
|
352
|
-
@input="handleInput"
|
|
353
|
-
/>
|
|
354
|
-
</template>
|
|
355
|
-
|
|
356
|
-
<script setup>
|
|
357
|
-
import { ref } from 'vue';
|
|
358
|
-
import { TextField } from '@idds/vue';
|
|
359
|
-
|
|
360
|
-
const email = ref('');
|
|
361
|
-
const handleInput = (event) => {
|
|
362
|
-
console.log('Input event:', event);
|
|
363
|
-
};
|
|
364
|
-
</script>
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
### Button
|
|
368
|
-
|
|
369
|
-
```vue
|
|
370
|
-
<template>
|
|
371
|
-
<Button variant="primary" size="md" @click="handleClick"> Submit </Button>
|
|
372
|
-
</template>
|
|
373
|
-
|
|
374
|
-
<script setup>
|
|
375
|
-
import { Button } from '@idds/vue';
|
|
376
|
-
|
|
377
|
-
const handleClick = () => {
|
|
378
|
-
console.log('Button clicked');
|
|
379
|
-
};
|
|
380
|
-
</script>
|
|
381
|
-
```
|
|
382
|
-
|
|
383
|
-
### SelectDropdown
|
|
384
|
-
|
|
385
|
-
```vue
|
|
386
|
-
<template>
|
|
387
|
-
<SelectDropdown
|
|
388
|
-
v-model="selected"
|
|
389
|
-
:options="options"
|
|
390
|
-
label="Select Option"
|
|
391
|
-
placeholder="Choose an option"
|
|
392
|
-
:searchable="true"
|
|
393
|
-
:clearable="true"
|
|
394
|
-
/>
|
|
395
|
-
</template>
|
|
396
|
-
|
|
397
|
-
<script setup>
|
|
398
|
-
import { ref } from 'vue';
|
|
399
|
-
import { SelectDropdown } from '@idds/vue';
|
|
400
|
-
|
|
401
|
-
const selected = ref(null);
|
|
402
|
-
const options = [
|
|
403
|
-
{ value: '1', label: 'Option 1' },
|
|
404
|
-
{ value: '2', label: 'Option 2' },
|
|
405
|
-
];
|
|
406
|
-
</script>
|
|
407
|
-
```
|
|
408
|
-
|
|
409
|
-
### DatePicker
|
|
410
|
-
|
|
411
|
-
```vue
|
|
412
|
-
<template>
|
|
413
|
-
<DatePicker
|
|
414
|
-
v-model="date"
|
|
415
|
-
mode="single"
|
|
416
|
-
label="Select Date"
|
|
417
|
-
placeholder="Choose a date"
|
|
418
|
-
date-format="DD/MM/YYYY"
|
|
419
|
-
:show-icon="true"
|
|
420
|
-
:show-clear-button="true"
|
|
421
|
-
/>
|
|
422
|
-
</template>
|
|
423
|
-
|
|
424
|
-
<script setup>
|
|
425
|
-
import { ref } from 'vue';
|
|
426
|
-
import { DatePicker } from '@idds/vue';
|
|
427
|
-
|
|
428
|
-
const date = ref('');
|
|
429
|
-
</script>
|
|
430
|
-
```
|
|
431
|
-
|
|
432
|
-
### Table
|
|
433
|
-
|
|
434
|
-
```vue
|
|
435
|
-
<template>
|
|
436
|
-
<Table :columns="columns" :data="data" />
|
|
437
|
-
</template>
|
|
438
|
-
|
|
439
|
-
<script setup>
|
|
440
|
-
import { Table } from '@idds/vue';
|
|
441
|
-
|
|
442
|
-
const columns = [
|
|
443
|
-
{ key: 'name', label: 'Name' },
|
|
444
|
-
{ key: 'email', label: 'Email' },
|
|
445
|
-
];
|
|
446
|
-
|
|
447
|
-
const data = [
|
|
448
|
-
{ id: 1, name: 'John', email: 'john@example.com' },
|
|
449
|
-
{ id: 2, name: 'Jane', email: 'jane@example.com' },
|
|
450
|
-
];
|
|
451
|
-
</script>
|
|
452
|
-
```
|
|
453
|
-
|
|
454
271
|
## Utilities
|
|
455
272
|
|
|
456
273
|
### Security Utilities
|
|
@@ -461,6 +278,8 @@ import {
|
|
|
461
278
|
validateInput,
|
|
462
279
|
encodeHtmlEntities,
|
|
463
280
|
decodeHtmlEntities,
|
|
281
|
+
sanitizeFileName,
|
|
282
|
+
containsDangerousPatterns
|
|
464
283
|
} from '@idds/vue';
|
|
465
284
|
|
|
466
285
|
// Sanitize user input
|
|
@@ -476,7 +295,7 @@ if (!validation.isValid) {
|
|
|
476
295
|
### File Validation
|
|
477
296
|
|
|
478
297
|
```js
|
|
479
|
-
import { validateFile,
|
|
298
|
+
import { validateFile, validateFileMagicNumber, formatFileSize } from '@idds/vue';
|
|
480
299
|
|
|
481
300
|
// Validate file
|
|
482
301
|
const result = validateFile(file, {
|
|
@@ -484,75 +303,20 @@ const result = validateFile(file, {
|
|
|
484
303
|
maxSize: 5 * 1024 * 1024, // 5MB
|
|
485
304
|
});
|
|
486
305
|
|
|
487
|
-
// Validate magic number (file signature)
|
|
488
|
-
const magicResult = await validateMagicNumber(file, 'image/png');
|
|
489
|
-
|
|
490
306
|
// Format file size
|
|
491
307
|
const formatted = formatFileSize(1024 * 1024); // "1 MB"
|
|
492
308
|
```
|
|
493
309
|
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
### CSS Classes
|
|
497
|
-
|
|
498
|
-
Components use BEM-like naming conventions:
|
|
499
|
-
|
|
500
|
-
- `ina-button` - Base button class
|
|
501
|
-
- `ina-button--primary` - Primary variant
|
|
502
|
-
- `ina-button--disabled` - Disabled state
|
|
503
|
-
- `ina-text-field` - Text field component
|
|
504
|
-
- `ina-text-field__input` - Input element
|
|
505
|
-
- `ina-text-field__label` - Label element
|
|
506
|
-
|
|
507
|
-
### Custom Styling
|
|
508
|
-
|
|
509
|
-
You can override component styles using CSS:
|
|
510
|
-
|
|
511
|
-
```css
|
|
512
|
-
.ina-button--primary {
|
|
513
|
-
background-color: your-custom-color;
|
|
514
|
-
}
|
|
515
|
-
```
|
|
516
|
-
|
|
517
|
-
### Using with Tailwind CSS (Optional)
|
|
518
|
-
|
|
519
|
-
If you want to use Tailwind CSS utility classes alongside the design system:
|
|
520
|
-
|
|
521
|
-
1. Install Tailwind CSS in your project
|
|
522
|
-
2. Import color tokens:
|
|
523
|
-
|
|
524
|
-
```js
|
|
525
|
-
// tailwind.config.js
|
|
526
|
-
import iddsColorTokens from '@idds/vue';
|
|
527
|
-
|
|
528
|
-
export default {
|
|
529
|
-
theme: {
|
|
530
|
-
extend: {
|
|
531
|
-
colors: iddsColorTokens,
|
|
532
|
-
},
|
|
533
|
-
},
|
|
534
|
-
};
|
|
535
|
-
```
|
|
536
|
-
|
|
537
|
-
3. Use Tailwind classes for custom styling:
|
|
538
|
-
|
|
539
|
-
```vue
|
|
540
|
-
<template>
|
|
541
|
-
<div class="bg-blue-500 text-white p-4">
|
|
542
|
-
<Button>Click me</Button>
|
|
543
|
-
</div>
|
|
544
|
-
</template>
|
|
545
|
-
```
|
|
546
|
-
|
|
547
|
-
> **Note:** Tailwind CSS is **optional**. The design system works perfectly without it. Components are fully styled and functional using only the included CSS.
|
|
310
|
+
### Styling
|
|
311
|
+
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**.
|
|
548
312
|
|
|
549
313
|
## TypeScript Support
|
|
550
314
|
|
|
551
|
-
All components are fully typed with TypeScript:
|
|
315
|
+
All components are fully typed with TypeScript, exporting interfaces for Props and their related strict Types:
|
|
552
316
|
|
|
553
317
|
```vue
|
|
554
318
|
<script setup lang="ts">
|
|
555
|
-
import { TextField, type TextFieldProps } from '@idds/vue';
|
|
319
|
+
import { TextField, type TextFieldProps, type TextFieldSize } from '@idds/vue';
|
|
556
320
|
|
|
557
321
|
const props: TextFieldProps = {
|
|
558
322
|
modelValue: '',
|
|
@@ -561,25 +325,6 @@ const props: TextFieldProps = {
|
|
|
561
325
|
</script>
|
|
562
326
|
```
|
|
563
327
|
|
|
564
|
-
## Development
|
|
565
|
-
|
|
566
|
-
```bash
|
|
567
|
-
# Install dependencies
|
|
568
|
-
npm install
|
|
569
|
-
|
|
570
|
-
# Start development server
|
|
571
|
-
npm run dev
|
|
572
|
-
|
|
573
|
-
# Build for production
|
|
574
|
-
npm run build
|
|
575
|
-
|
|
576
|
-
# Type checking
|
|
577
|
-
npm run type-check
|
|
578
|
-
|
|
579
|
-
# Linting
|
|
580
|
-
npm run lint
|
|
581
|
-
```
|
|
582
|
-
|
|
583
328
|
## License
|
|
584
329
|
|
|
585
330
|
MIT
|