vlite3 0.5.2 → 0.5.4
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 +121 -116
- package/components/Barcode/Barcode.vue.js +1 -1
- package/components/Dropdown/DropdownItem.vue.js +28 -20
- package/components/Dropdown/DropdownMenu.vue.js +20 -19
- package/components/ExportData/ExportData.vue.js +42 -42
- package/components/ImportData/ImportStep1.vue.js +1 -1
- package/components/Modal.vue.d.ts +6 -2
- package/components/Modal.vue.js +1 -1
- package/components/Modal.vue2.js +56 -53
- package/components/QRCode/QRCode.vue.js +4 -4
- package/package.json +2 -2
- package/style.css +1 -1
- package/_virtual/Barcode.js +0 -4
- package/_virtual/CODE128.js +0 -4
- package/_virtual/CODE128A.js +0 -4
- package/_virtual/CODE128B.js +0 -4
- package/_virtual/CODE128C.js +0 -4
- package/_virtual/CODE128_AUTO.js +0 -4
- package/_virtual/CODE93.js +0 -4
- package/_virtual/CODE93FullASCII.js +0 -4
- package/_virtual/EAN.js +0 -4
- package/_virtual/EAN13.js +0 -4
- package/_virtual/EAN2.js +0 -4
- package/_virtual/EAN5.js +0 -4
- package/_virtual/EAN8.js +0 -4
- package/_virtual/ErrorHandler.js +0 -4
- package/_virtual/FileSaver.min.js +0 -5
- package/_virtual/FileSaver.min2.js +0 -4
- package/_virtual/ITF.js +0 -4
- package/_virtual/ITF14.js +0 -4
- package/_virtual/JsBarcode.js +0 -7
- package/_virtual/MSI.js +0 -4
- package/_virtual/MSI10.js +0 -4
- package/_virtual/MSI1010.js +0 -4
- package/_virtual/MSI11.js +0 -4
- package/_virtual/MSI1110.js +0 -4
- package/_virtual/UPC.js +0 -4
- package/_virtual/UPCE.js +0 -4
- package/_virtual/_commonjsHelpers.js +0 -8
- package/_virtual/alignment-pattern.js +0 -4
- package/_virtual/auto.js +0 -4
- package/_virtual/browser.js +0 -7
- package/_virtual/browser2.js +0 -4
- package/_virtual/canvas.js +0 -4
- package/_virtual/canvas2.js +0 -4
- package/_virtual/checksums.js +0 -4
- package/_virtual/constants.js +0 -4
- package/_virtual/constants2.js +0 -4
- package/_virtual/constants3.js +0 -4
- package/_virtual/constants4.js +0 -4
- package/_virtual/defaults.js +0 -4
- package/_virtual/dijkstra.js +0 -4
- package/_virtual/encoder.js +0 -4
- package/_virtual/error-correction-code.js +0 -4
- package/_virtual/error-correction-level.js +0 -4
- package/_virtual/exceptions.js +0 -4
- package/_virtual/finder-pattern.js +0 -4
- package/_virtual/fixOptions.js +0 -4
- package/_virtual/format-info.js +0 -4
- package/_virtual/galois-field.js +0 -4
- package/_virtual/getOptionsFromElement.js +0 -4
- package/_virtual/getRenderProperties.js +0 -4
- package/_virtual/index.js +0 -4
- package/_virtual/index10.js +0 -4
- package/_virtual/index11.js +0 -4
- package/_virtual/index2.js +0 -4
- package/_virtual/index3.js +0 -4
- package/_virtual/index4.js +0 -4
- package/_virtual/index5.js +0 -4
- package/_virtual/index6.js +0 -4
- package/_virtual/index7.js +0 -4
- package/_virtual/index8.js +0 -4
- package/_virtual/index9.js +0 -4
- package/_virtual/linearizeEncodings.js +0 -4
- package/_virtual/mask-pattern.js +0 -4
- package/_virtual/merge.js +0 -4
- package/_virtual/mode.js +0 -4
- package/_virtual/object.js +0 -4
- package/_virtual/optionsFromStrings.js +0 -4
- package/_virtual/papaparse.min.js +0 -7
- package/_virtual/papaparse.min2.js +0 -4
- package/_virtual/polynomial.js +0 -4
- package/_virtual/qrcode.js +0 -4
- package/_virtual/regex.js +0 -4
- package/_virtual/segments.js +0 -4
- package/_virtual/shared.js +0 -4
- package/_virtual/svg-tag.js +0 -4
- package/_virtual/svg.js +0 -4
- package/_virtual/utils.js +0 -4
- package/_virtual/utils2.js +0 -4
- package/_virtual/version-check.js +0 -4
- package/_virtual/version.js +0 -4
package/README.md
CHANGED
|
@@ -14,6 +14,10 @@ yarn add vlite3
|
|
|
14
14
|
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
## Demo
|
|
18
|
+
|
|
19
|
+
[Live Demo](https://vlite3.vercel.app/)
|
|
20
|
+
|
|
17
21
|
## 2. Tailwind CSS Setup (Tailwind v4)
|
|
18
22
|
|
|
19
23
|
`vite.config.ts`
|
|
@@ -24,7 +28,6 @@ import tailwindcss from '@tailwindcss/vite'
|
|
|
24
28
|
export default defineConfig({
|
|
25
29
|
plugins: [vue(), tailwindcss()],
|
|
26
30
|
})
|
|
27
|
-
|
|
28
31
|
```
|
|
29
32
|
|
|
30
33
|
`style.css`
|
|
@@ -35,7 +38,6 @@ export default defineConfig({
|
|
|
35
38
|
|
|
36
39
|
@import 'vlite3/style.css';
|
|
37
40
|
@source "../node_modules/vlite3";
|
|
38
|
-
|
|
39
41
|
```
|
|
40
42
|
|
|
41
43
|
## 3. Usage
|
|
@@ -53,7 +55,6 @@ import { Button, Input } from 'vlite3'
|
|
|
53
55
|
<Input placeholder="Type here..." />
|
|
54
56
|
</div>
|
|
55
57
|
</template>
|
|
56
|
-
|
|
57
58
|
```
|
|
58
59
|
|
|
59
60
|
## Global Configuration (Registry System)
|
|
@@ -117,21 +118,20 @@ const vlite = createVLite({
|
|
|
117
118
|
return data.url // MUST return the file URL string
|
|
118
119
|
},
|
|
119
120
|
},
|
|
120
|
-
|
|
121
|
+
|
|
121
122
|
// Global UI Components Configuration
|
|
122
123
|
components: {
|
|
123
124
|
form: {
|
|
124
125
|
variant: 'outline', // Applies 'outline' globally to all Form inputs ('solid' | 'outline' | 'floating' | etc.)
|
|
125
|
-
size: 'md',
|
|
126
|
-
rounded: 'md',
|
|
126
|
+
size: 'md', // Global size for form inputs ('sm' | 'md' | 'lg')
|
|
127
|
+
rounded: 'md', // Global border radius for forms
|
|
127
128
|
showRequiredAsterisk: true, // Globally toggle the visibility of the required asterisk
|
|
128
|
-
}
|
|
129
|
-
}
|
|
129
|
+
},
|
|
130
|
+
},
|
|
130
131
|
})
|
|
131
132
|
|
|
132
133
|
app.use(vlite)
|
|
133
134
|
app.mount('#app')
|
|
134
|
-
|
|
135
135
|
```
|
|
136
136
|
|
|
137
137
|
### How it works
|
|
@@ -184,11 +184,10 @@ const handleSubmit = (payload) => {
|
|
|
184
184
|
<template>
|
|
185
185
|
<div class="">
|
|
186
186
|
<Form :schema="schema" @onSubmit="handleSubmit" />
|
|
187
|
-
|
|
187
|
+
|
|
188
188
|
<Form :schema="schema" variant="solid" size="lg" @onSubmit="handleSubmit" />
|
|
189
189
|
</div>
|
|
190
190
|
</template>
|
|
191
|
-
|
|
192
191
|
```
|
|
193
192
|
|
|
194
193
|
# 🎨 Theming & Customization
|
|
@@ -203,23 +202,23 @@ All colors are defined as CSS variables, allowing you to customize the appearanc
|
|
|
203
202
|
|
|
204
203
|
Override these variables in `:root` or within a `.dark` class (when using class-based dark mode) to adjust your theme.
|
|
205
204
|
|
|
206
|
-
| Variable
|
|
207
|
-
|
|
|
208
|
-
| `--color-background`
|
|
209
|
-
| `--color-foreground`
|
|
210
|
-
| `--color-card`
|
|
211
|
-
| `--color-primary`
|
|
212
|
-
| `--color-primary-foreground`
|
|
213
|
-
| `--color-secondary`
|
|
214
|
-
| `--color-secondary-foreground`
|
|
215
|
-
| `--color-muted`
|
|
216
|
-
| `--color-muted`
|
|
217
|
-
| `--color-accent`
|
|
218
|
-
| `--color-accent-foreground`
|
|
219
|
-
| `--color-destructive`
|
|
220
|
-
| `--color-destructive-foreground` | `text-destructive-foreground` | Text on destructive background (white)
|
|
221
|
-
| `--color-border`
|
|
222
|
-
| `--radius`
|
|
205
|
+
| Variable | Utility Class | Description | Recommended Usage |
|
|
206
|
+
| -------------------------------- | ----------------------------- | --------------------------------------- | ----------------------------------------------- |
|
|
207
|
+
| `--color-background` | `bg-background` | Default page background (white) | Main application background |
|
|
208
|
+
| `--color-foreground` | `text-foreground` | Default text color (gray-900) | Primary content text |
|
|
209
|
+
| `--color-card` | `bg-card` | Card background (gray-100) | Cards, containers, surfaces, panels, dialogs |
|
|
210
|
+
| `--color-primary` | `bg-primary` | Primary brand color (blue) | Main actions, buttons, active states |
|
|
211
|
+
| `--color-primary-foreground` | `text-primary-foreground` | Text on primary background (white) | Text/icons displayed on primary elements |
|
|
212
|
+
| `--color-secondary` | `bg-secondary` | Secondary background (gray-200) | Secondary actions, muted sections |
|
|
213
|
+
| `--color-secondary-foreground` | `text-secondary-foreground` | Text on secondary background (gray-900) | Content displayed on secondary elements |
|
|
214
|
+
| `--color-muted` | `bg-muted` | Muted background (gray-150) | Subtle surfaces, table headers, disabled states |
|
|
215
|
+
| `--color-muted` | `text-muted` | Muted text (gray-600) | Secondary text, inactive links, descriptions |
|
|
216
|
+
| `--color-accent` | `bg-accent` | Accent background (gray-150) | Hover states, selection highlights |
|
|
217
|
+
| `--color-accent-foreground` | `text-accent-foreground` | Text on accent background (gray-900) | Content displayed on accent elements |
|
|
218
|
+
| `--color-destructive` | `bg-destructive` | Destructive color (red) | Errors, warnings, destructive actions |
|
|
219
|
+
| `--color-destructive-foreground` | `text-destructive-foreground` | Text on destructive background (white) | Content displayed on destructive elements |
|
|
220
|
+
| `--color-border` | `border` | Default border color (gray-250) | Inputs, cards, dividers |
|
|
221
|
+
| `--radius` | `rounded` | Global border radius | Shared radius across components |
|
|
223
222
|
|
|
224
223
|
---
|
|
225
224
|
|
|
@@ -227,9 +226,9 @@ Override these variables in `:root` or within a `.dark` class (when using class-
|
|
|
227
226
|
|
|
228
227
|
For more complex components, vlite3 provides extended variants for main semantic colors (`primary`, `danger`, `warning`, `info`, `success`). These are useful for building nuanced UIs with subtle backgrounds, hover states, and accessible text.
|
|
229
228
|
|
|
230
|
-
| Base Color
|
|
231
|
-
|
|
|
232
|
-
| **Primary** | `--color-primary-light`<br>
|
|
229
|
+
| Base Color | Variant Variables | Usage Description |
|
|
230
|
+
| ----------- | --------------------------- | ----------------- |
|
|
231
|
+
| **Primary** | `--color-primary-light`<br> |
|
|
233
232
|
|
|
234
233
|
<br>`--color-primary-dark`<br>
|
|
235
234
|
|
|
@@ -239,9 +238,9 @@ For more complex components, vlite3 provides extended variants for main semantic
|
|
|
239
238
|
|
|
240
239
|
<br>**Dark**: Hover state for the main color.<br>
|
|
241
240
|
|
|
242
|
-
<br>**Fg**: Text color on top of the
|
|
241
|
+
<br>**Fg**: Text color on top of the _main_ color.<br>
|
|
243
242
|
|
|
244
|
-
<br>**Fg-Light**: Text color on top of the
|
|
243
|
+
<br>**Fg-Light**: Text color on top of the _light_ variant. |
|
|
245
244
|
| **Danger** | `--color-danger-light`<br>
|
|
246
245
|
|
|
247
246
|
<br>`--color-danger-dark`<br>
|
|
@@ -303,19 +302,18 @@ For more complex components, vlite3 provides extended variants for main semantic
|
|
|
303
302
|
</div>
|
|
304
303
|
|
|
305
304
|
<button class="bg-danger text-danger-fg hover:bg-danger-dark">Delete</button>
|
|
306
|
-
|
|
307
305
|
```
|
|
308
306
|
|
|
309
307
|
### Additional Colors
|
|
310
308
|
|
|
311
309
|
vlite3 also provides additional utility colors for specific feedback states:
|
|
312
310
|
|
|
313
|
-
| Variable
|
|
314
|
-
|
|
|
315
|
-
| `--color-success` | `text-success`, `bg-success` | For success messages/badges.
|
|
316
|
-
| `--color-warning` | `text-warning`, `bg-warning` | For warning messages/badges.
|
|
317
|
-
| `--color-info`
|
|
318
|
-
| `--color-danger`
|
|
311
|
+
| Variable | Class Name | Description |
|
|
312
|
+
| ----------------- | ---------------------------- | --------------------------------------- |
|
|
313
|
+
| `--color-success` | `text-success`, `bg-success` | For success messages/badges. |
|
|
314
|
+
| `--color-warning` | `text-warning`, `bg-warning` | For warning messages/badges. |
|
|
315
|
+
| `--color-info` | `text-info`, `bg-info` | For informational messages/badges. |
|
|
316
|
+
| `--color-danger` | `text-danger`, `bg-danger` | Alias for destructive in some contexts. |
|
|
319
317
|
|
|
320
318
|
---
|
|
321
319
|
|
|
@@ -323,8 +321,8 @@ vlite3 also provides additional utility colors for specific feedback states:
|
|
|
323
321
|
|
|
324
322
|
The typography system is organized into two complementary scales:
|
|
325
323
|
|
|
326
|
-
|
|
327
|
-
|
|
324
|
+
- Compact scale (prefixed with `--text--fs-*`)
|
|
325
|
+
- Progressive scale (prefixed with `--text-fs-*`)
|
|
328
326
|
|
|
329
327
|
Use the progressive scale only when you need finer visual control beyond the standard Tailwind size tokens.
|
|
330
328
|
For most layout and content needs, prefer the default Tailwind text sizes to maintain consistency.
|
|
@@ -340,7 +338,6 @@ For most layout and content needs, prefer the default Tailwind text sizes to mai
|
|
|
340
338
|
--text--fs-6: 0.6em;
|
|
341
339
|
--text--fs-7: 0.55em;
|
|
342
340
|
--text--fs-8: 0.5em;
|
|
343
|
-
|
|
344
341
|
```
|
|
345
342
|
|
|
346
343
|
### Progressive Text Scale
|
|
@@ -366,23 +363,13 @@ For most layout and content needs, prefer the default Tailwind text sizes to mai
|
|
|
366
363
|
--text-fs-9: 1.8em;
|
|
367
364
|
--text-fs-9.5: 2em;
|
|
368
365
|
--text-fs-10: 2.5em;
|
|
369
|
-
|
|
370
366
|
```
|
|
371
367
|
|
|
372
368
|
### Tailwind Size Tokens
|
|
373
369
|
|
|
374
370
|
```css
|
|
375
|
-
--text-xs: 0.75rem
|
|
376
|
-
--text-
|
|
377
|
-
--text-base: 1rem
|
|
378
|
-
--text-lg: 1.125rem
|
|
379
|
-
--text-xl: 1.25rem
|
|
380
|
-
--text-2xl: 1.5rem
|
|
381
|
-
--text-3xl: 1.875rem
|
|
382
|
-
--text-4xl: 2.25rem
|
|
383
|
-
--text-5xl: 3rem
|
|
384
|
-
--text-6xl: 4rem;
|
|
385
|
-
|
|
371
|
+
--text-xs: 0.75rem --text-sm: 0.875rem --text-base: 1rem --text-lg: 1.125rem --text-xl: 1.25rem
|
|
372
|
+
--text-2xl: 1.5rem --text-3xl: 1.875rem --text-4xl: 2.25rem --text-5xl: 3rem --text-6xl: 4rem;
|
|
386
373
|
```
|
|
387
374
|
|
|
388
375
|
---
|
|
@@ -395,87 +382,105 @@ For most layout and content needs, prefer the default Tailwind text sizes to mai
|
|
|
395
382
|
<span class="-text-fs-4 text-muted"> Caption text </span>
|
|
396
383
|
|
|
397
384
|
<h1 class="text-xl font-semibold">Page Title</h1>
|
|
398
|
-
|
|
399
385
|
```
|
|
400
386
|
|
|
401
387
|
## Hard Rules
|
|
402
388
|
|
|
403
389
|
Follow these rules strictly to ensure visual consistency and predictable styling across the system:
|
|
404
390
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
391
|
+
- Use `border` instead of `border-border` (the default border color (gray-250) is already applied).
|
|
392
|
+
- Use `rounded` instead of `rounded-rounded`.
|
|
393
|
+
- Use `bg-muted` instead of `bg-secondary/20`.
|
|
394
|
+
- Use `gap-x-*` instead of applying `ml-*` or `mr-*` directly on sibling items.
|
|
395
|
+
- Use `gap-y-*` instead of applying `mt-*` or `mb-*` directly on sibling items.
|
|
410
396
|
|
|
411
397
|
---
|
|
412
398
|
|
|
413
399
|
## ✅ Components
|
|
414
400
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
401
|
+
- [x] **Button**
|
|
402
|
+
- [x] **ButtonGroup**
|
|
403
|
+
- [x] **Icon**
|
|
404
|
+
- [x] **Label**
|
|
405
|
+
- [x] **Badge**
|
|
406
|
+
- [x] **Chip**
|
|
407
|
+
- [x] **Logo**
|
|
408
|
+
- [x] **Navbar**
|
|
409
|
+
- [x] **SidebarMenu**
|
|
410
|
+
- [x] **SidePanel**
|
|
411
|
+
- [x] **Breadcrumb**
|
|
412
|
+
- [x] **List**
|
|
413
|
+
- [x] **Masonry Grid**
|
|
414
|
+
- [x] **Stats**
|
|
415
|
+
- [x] **ThemeToggle**
|
|
416
|
+
- [x] **Screen**
|
|
427
417
|
|
|
428
418
|
### Inputs & Forms
|
|
429
419
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
420
|
+
- [x] **Input**
|
|
421
|
+
- [x] **Textarea**
|
|
422
|
+
- [x] **CheckBox**
|
|
423
|
+
- [x] **Switch**
|
|
424
|
+
- [x] **ChoiceBox**
|
|
425
|
+
- [x] **Slider**
|
|
426
|
+
- [x] **OTPInput**
|
|
427
|
+
- [x] **NumberInput**
|
|
428
|
+
- [x] **DatePicker**
|
|
429
|
+
- [x] **DateRangePicker**
|
|
430
|
+
- [x] **ColorPicker**
|
|
431
|
+
- [x] **FilePicker**
|
|
432
|
+
- [x] **AvatarUploader**
|
|
433
|
+
- [x] **IconPicker**
|
|
434
|
+
- [x] **MultiSelect**
|
|
435
|
+
- [x] **Forms**
|
|
436
|
+
- [x] **CustomFields**
|
|
437
|
+
- [x] **GoogleLogin**
|
|
438
|
+
- [x] **PermissionEditor**
|
|
447
439
|
|
|
448
440
|
### Data Display
|
|
449
441
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
442
|
+
- [x] **Avatar**
|
|
443
|
+
- [x] **Accordion**
|
|
444
|
+
- [x] **Carousel**
|
|
445
|
+
- [x] **DataTable**
|
|
446
|
+
- [x] **DataList**
|
|
447
|
+
- [x] **Pagination**
|
|
448
|
+
- [x] **Timeline**
|
|
449
|
+
- [x] **Heatmap**
|
|
450
|
+
- [x] **PricingPlan**
|
|
451
|
+
- [x] **FileTree**
|
|
452
|
+
- [x] **Workbook**
|
|
453
|
+
- [x] **Kanban**
|
|
454
|
+
- [x] **Tabes**
|
|
455
|
+
- [x] **Masonry**
|
|
456
|
+
- [x] **Stats**
|
|
461
457
|
|
|
462
458
|
### Feedback & Overlays
|
|
463
459
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
460
|
+
- [x] **Alert**
|
|
461
|
+
- [x] **Modal**
|
|
462
|
+
- [x] **ConfirmationModal**
|
|
463
|
+
- [x] **ToastNotification**
|
|
464
|
+
- [x] **Tooltip**
|
|
465
|
+
- [x] **Dropdown**
|
|
466
|
+
- [x] **ProgressBar**
|
|
467
|
+
- [x] **Spinner**
|
|
468
|
+
- [x] **CommandPalette**
|
|
469
|
+
- [x] **SidePanel**
|
|
472
470
|
|
|
473
|
-
|
|
471
|
+
### Utilities & Tools
|
|
474
472
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
473
|
+
- [x] **Barcode**
|
|
474
|
+
- [x] **QRCode**
|
|
475
|
+
- [x] **ImportData**
|
|
476
|
+
- [x] **ExportData**
|
|
477
|
+
|
|
478
|
+
## Complete reference for AI agents and developers:
|
|
481
479
|
|
|
480
|
+
- [0-setup.md](https://github.com/safdar-azeem/vlite3/blob/main/docs/0-vlite3-setup.md)
|
|
481
|
+
- [1-theming.md](https://github.com/safdar-azeem/vlite3/blob/main/docs/1-theming.md)
|
|
482
|
+
- [2-components.md](https://github.com/safdar-azeem/vlite3/blob/main/docs/2-all-components.md)
|
|
483
|
+
- [3-forms.md](https://github.com/safdar-azeem/vlite3/blob/main/docs/components/Forms.md)
|
|
484
|
+
- [3-utility.md](https://github.com/safdar-azeem/vlite3/blob/main/docs/3-utility.md)
|
|
485
|
+
- [4-i18n.md](https://github.com/safdar-azeem/vlite3/blob/main/docs/4-i18n.md)
|
|
486
|
+
- [5-search-util.md](https://github.com/safdar-azeem/vlite3/blob/main/docs/5-search-util.md)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as d, ref as i, onMounted as f, watch as m, openBlock as r, createElementBlock as l, toDisplayString as p, createCommentVNode as v, withDirectives as h, vShow as g } from "vue";
|
|
2
|
-
import w from "
|
|
2
|
+
import w from "jsbarcode";
|
|
3
3
|
import { barcodesConstants as b } from "./types.js";
|
|
4
4
|
const y = { class: "inline-flex justify-center items-center max-w-full flex-col gap-2" }, x = {
|
|
5
5
|
key: 0,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as g, computed as s, openBlock as n, createElementBlock as l, withKeys as k, withModifiers as w, normalizeClass as h, renderSlot as I, normalizeProps as $, guardReactiveProps as B, createBlock as b, createCommentVNode as i, createElementVNode as c, toDisplayString as a } from "vue";
|
|
2
|
+
import v from "../Icon.vue.js";
|
|
3
3
|
import { $t as d } from "../../utils/i18n.js";
|
|
4
|
-
const
|
|
4
|
+
const j = ["data-disabled"], C = { class: "flex flex-col flex-1 min-w-0" }, D = { class: "flex items-center justify-between gap-2" }, S = { class: "truncate font-medium" }, z = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "text-xs text-muted-foreground whitespace-nowrap opacity-90"
|
|
7
|
-
},
|
|
7
|
+
}, E = {
|
|
8
8
|
key: 0,
|
|
9
9
|
class: "text-[10px] text-muted-foreground truncate opacity-70"
|
|
10
|
-
}, P = /* @__PURE__ */
|
|
10
|
+
}, P = /* @__PURE__ */ g({
|
|
11
11
|
__name: "DropdownItem",
|
|
12
12
|
props: {
|
|
13
13
|
option: {},
|
|
@@ -17,40 +17,48 @@ const B = ["data-disabled"], $ = { class: "flex flex-col flex-1 min-w-0" }, j =
|
|
|
17
17
|
index: {}
|
|
18
18
|
},
|
|
19
19
|
emits: ["click", "mouseenter"],
|
|
20
|
-
setup(e, { emit:
|
|
21
|
-
const t = e,
|
|
22
|
-
|
|
20
|
+
setup(e, { emit: x }) {
|
|
21
|
+
const t = e, r = x, y = s(
|
|
22
|
+
() => t.option.labelI18n ? d(t.option.labelI18n) : t.option.label
|
|
23
|
+
), u = s(
|
|
24
|
+
() => t.option.subtitleI18n ? d(t.option.subtitleI18n) : t.option.subtitle
|
|
25
|
+
), m = s(
|
|
26
|
+
() => t.option.descriptionI18n ? d(t.option.descriptionI18n) : t.option.description
|
|
27
|
+
);
|
|
28
|
+
return (f, o) => (n(), l("div", {
|
|
29
|
+
tabindex: 0,
|
|
23
30
|
"data-dropdown-item": "",
|
|
24
|
-
class: h(["relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-disabled:pointer-events-none data-disabled:opacity-50", [
|
|
31
|
+
class: h(["relative w-full flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus-visible:bg-accent focus-visible:text-accent-foreground focus-visible:ring-1 focus-visible:ring-primary focus-visible:ring-offset-1 data-disabled:pointer-events-none data-disabled:opacity-50", [
|
|
25
32
|
e.selectable && e.selected && !e.option.children ? "bg-accent" : "",
|
|
26
33
|
e.focused ? "bg-accent text-accent-foreground" : "hover:bg-accent hover:text-accent-foreground",
|
|
27
34
|
e.option.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
|
|
28
35
|
]]),
|
|
29
36
|
"data-disabled": e.option.disabled ? !0 : void 0,
|
|
30
|
-
onClick:
|
|
31
|
-
|
|
37
|
+
onClick: o[0] || (o[0] = (p) => r("click", e.option)),
|
|
38
|
+
onKeydown: o[1] || (o[1] = k(w((p) => r("click", e.option), ["prevent"]), ["enter"])),
|
|
39
|
+
onMouseenter: o[2] || (o[2] = (p) => f.$emit("mouseenter", e.index ?? -1))
|
|
32
40
|
}, [
|
|
33
|
-
|
|
34
|
-
e.option.icon || e.option.emoji ? (
|
|
41
|
+
I(f.$slots, "default", $(B({ option: e.option, index: e.index, selected: e.selected })), () => [
|
|
42
|
+
e.option.icon || e.option.emoji ? (n(), b(v, {
|
|
35
43
|
key: 0,
|
|
36
44
|
icon: e.option.icon,
|
|
37
45
|
emoji: e.option.emoji,
|
|
38
46
|
class: "mr-2 h-4 w-4 shrink-0 mt-0.5"
|
|
39
47
|
}, null, 8, ["icon", "emoji"])) : i("", !0),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
c("div", C, [
|
|
49
|
+
c("div", D, [
|
|
50
|
+
c("span", S, a(y.value), 1),
|
|
51
|
+
u.value ? (n(), l("span", z, a(u.value), 1)) : i("", !0)
|
|
44
52
|
]),
|
|
45
|
-
|
|
53
|
+
m.value ? (n(), l("span", E, a(m.value), 1)) : i("", !0)
|
|
46
54
|
]),
|
|
47
|
-
e.selectable && e.selected ? (
|
|
55
|
+
e.selectable && e.selected ? (n(), b(v, {
|
|
48
56
|
key: 1,
|
|
49
57
|
icon: "lucide:check",
|
|
50
58
|
class: "ml-2 h-4 w-4 shrink-0 text-primary"
|
|
51
59
|
})) : i("", !0)
|
|
52
60
|
])
|
|
53
|
-
], 42,
|
|
61
|
+
], 42, j));
|
|
54
62
|
}
|
|
55
63
|
});
|
|
56
64
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as Z, defineAsyncComponent as ee, ref as j, computed as h, watch as T, onMounted as te, onBeforeUnmount as le, openBlock as n, createElementBlock as
|
|
1
|
+
import { defineComponent as Z, defineAsyncComponent as ee, ref as j, computed as h, watch as T, onMounted as te, onBeforeUnmount as le, openBlock as n, createElementBlock as c, createVNode as S, createCommentVNode as u, renderSlot as b, unref as o, normalizeStyle as se, normalizeClass as _, toDisplayString as D, createBlock as v, Fragment as E, renderList as ne, withCtx as N, createElementVNode as $, createSlots as oe, mergeProps as re, nextTick as ae } from "vue";
|
|
2
2
|
import I from "../Icon.vue.js";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import ce from "../Input.vue.js";
|
|
4
|
+
import de from "./DropdownItem.vue.js";
|
|
5
5
|
import ie from "./DropdownBooleanItem.vue.js";
|
|
6
6
|
import ue from "./DropdownGroupedLayout.vue.js";
|
|
7
7
|
import { useDropdownNavigation as fe } from "./composables/useDropdownNavigation.js";
|
|
@@ -54,7 +54,7 @@ const he = ["dir"], ve = {
|
|
|
54
54
|
}), L = h(() => {
|
|
55
55
|
const e = M("vlite.dropdown.search");
|
|
56
56
|
return e !== "vlite.dropdown.search" ? e : "Search...";
|
|
57
|
-
}),
|
|
57
|
+
}), d = h(() => t.options ? t.options.map((e) => typeof e == "string" || typeof e == "number" ? { label: String(e), value: String(e) } : e) : []), R = h(() => t.remote ? t.searchable : t.searchable && (d.value.length || 0) > 9);
|
|
58
58
|
let k = null;
|
|
59
59
|
T(m, (e) => {
|
|
60
60
|
t.remote && (k && clearTimeout(k), k = setTimeout(() => {
|
|
@@ -75,12 +75,12 @@ const he = ["dir"], ve = {
|
|
|
75
75
|
onMouseEnterItem: x,
|
|
76
76
|
scrollToIndex: U
|
|
77
77
|
} = fe({
|
|
78
|
-
options:
|
|
78
|
+
options: d,
|
|
79
79
|
searchQuery: m,
|
|
80
80
|
containerRef: O,
|
|
81
81
|
emit: (e, ...s) => f(e, ...s),
|
|
82
82
|
handleSelect: (e, s) => w(e)
|
|
83
|
-
}), g = h(() => t.remote ? m.value ?
|
|
83
|
+
}), g = h(() => t.remote ? m.value ? d.value : t.cachedOptions.length ? t.cachedOptions : d.value : K.value), q = (e) => {
|
|
84
84
|
if (!(!t.selected || typeof t.selected != "object") && e.key && e.key in t.selected)
|
|
85
85
|
return t.selected[e.key];
|
|
86
86
|
}, G = (e) => e.disabled ? !1 : Array.isArray(t.selected) ? t.selected.includes(e.value) : t.selected && typeof t.selected == "object" && e.key ? t.selected[e.key] === e.value : t.selected === e.value, J = (e) => !e.key || !t.selected || typeof t.selected != "object" ? !1 : !!t.selected[e.key], Q = (e, s) => {
|
|
@@ -105,7 +105,7 @@ const he = ["dir"], ve = {
|
|
|
105
105
|
}, X = async () => {
|
|
106
106
|
await ae();
|
|
107
107
|
let e = -1;
|
|
108
|
-
t.layout !== "grouped" && (t.selectedIndex !== null && t.selectedIndex >= 0 ? e = t.selectedIndex : t.selected !== void 0 && typeof t.selected != "object" && (e =
|
|
108
|
+
t.layout !== "grouped" && (t.selectedIndex !== null && t.selectedIndex >= 0 ? e = t.selectedIndex : t.selected !== void 0 && typeof t.selected != "object" && (e = d.value.findIndex((s) => s.value === t.selected)), e !== -1 && U(e));
|
|
109
109
|
};
|
|
110
110
|
T(
|
|
111
111
|
() => g.value,
|
|
@@ -118,12 +118,12 @@ const he = ["dir"], ve = {
|
|
|
118
118
|
window.removeEventListener("keydown", B);
|
|
119
119
|
});
|
|
120
120
|
const Y = (e) => e.labelI18n ? M(e.labelI18n) : e.label;
|
|
121
|
-
return (e, s) => (n(),
|
|
121
|
+
return (e, s) => (n(), c("div", {
|
|
122
122
|
class: "dropdown-menu w-full min-w-[150px] flex flex-col",
|
|
123
123
|
dir: r.direction
|
|
124
124
|
}, [
|
|
125
|
-
R.value ? (n(),
|
|
126
|
-
S(
|
|
125
|
+
R.value ? (n(), c("div", ve, [
|
|
126
|
+
S(ce, {
|
|
127
127
|
modelValue: m.value,
|
|
128
128
|
"onUpdate:modelValue": s[0] || (s[0] = (l) => m.value = l),
|
|
129
129
|
placeholder: L.value,
|
|
@@ -136,10 +136,10 @@ const he = ["dir"], ve = {
|
|
|
136
136
|
"show-clear-button": !1
|
|
137
137
|
}, null, 8, ["modelValue", "placeholder"])
|
|
138
138
|
])) : u("", !0),
|
|
139
|
-
e.$slots.header ? (n(),
|
|
139
|
+
e.$slots.header ? (n(), c("div", ye, [
|
|
140
140
|
b(e.$slots, "header")
|
|
141
141
|
])) : u("", !0),
|
|
142
|
-
|
|
142
|
+
d.value.length > 0 || e.$slots.menu ? (n(), c("div", {
|
|
143
143
|
key: 2,
|
|
144
144
|
ref_key: "containerRef",
|
|
145
145
|
ref: O,
|
|
@@ -154,7 +154,7 @@ const he = ["dir"], ve = {
|
|
|
154
154
|
(...l) => o(C) && o(C)(...l)),
|
|
155
155
|
onScroll: F
|
|
156
156
|
}, [
|
|
157
|
-
g.value.length === 0 &&
|
|
157
|
+
g.value.length === 0 && d.value.length > 0 && !r.loading ? (n(), c("div", ge, D(A.value), 1)) : u("", !0),
|
|
158
158
|
r.layout === "grouped" ? (n(), v(ue, {
|
|
159
159
|
key: 1,
|
|
160
160
|
options: g.value,
|
|
@@ -162,8 +162,8 @@ const he = ["dir"], ve = {
|
|
|
162
162
|
selectable: r.selectable,
|
|
163
163
|
columns: r.columns,
|
|
164
164
|
onSelect: w
|
|
165
|
-
}, null, 8, ["options", "selected", "selectable", "columns"])) : (n(!0),
|
|
166
|
-
l.label === "---" ? (n(),
|
|
165
|
+
}, null, 8, ["options", "selected", "selectable", "columns"])) : (n(!0), c(E, { key: 2 }, ne(g.value, (l, a) => (n(), c(E, { key: a }, [
|
|
166
|
+
l.label === "---" ? (n(), c("div", be)) : l.data?.isBoolean ? (n(), v(ie, {
|
|
167
167
|
key: 1,
|
|
168
168
|
option: l,
|
|
169
169
|
value: J(l),
|
|
@@ -187,8 +187,9 @@ const he = ["dir"], ve = {
|
|
|
187
187
|
}, {
|
|
188
188
|
trigger: N(() => [
|
|
189
189
|
$("div", {
|
|
190
|
+
tabindex: 0,
|
|
190
191
|
"data-dropdown-item": "",
|
|
191
|
-
class: _(["relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm font-medium outline-none transition-colors justify-between w-full", [
|
|
192
|
+
class: _(["relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm font-medium outline-none transition-colors justify-between w-full focus-visible:bg-accent focus-visible:text-accent-foreground focus-visible:ring-1 focus-visible:ring-primary focus-visible:ring-offset-1", [
|
|
192
193
|
o(p) && o(y) === a ? "bg-accent text-accent-foreground" : "hover:bg-accent hover:text-accent-foreground",
|
|
193
194
|
l.disabled ? "opacity-50 cursor-not-allowed" : ""
|
|
194
195
|
]]),
|
|
@@ -210,7 +211,7 @@ const he = ["dir"], ve = {
|
|
|
210
211
|
], 42, ke)
|
|
211
212
|
]),
|
|
212
213
|
_: 2
|
|
213
|
-
}, 1032, ["position", "offset", "options", "selected", "menuId", "nestedPosition", "nestedOffset", "selectable", "ignoreClickOutside", "direction", "onOnSelect"])) : (n(), v(
|
|
214
|
+
}, 1032, ["position", "offset", "options", "selected", "menuId", "nestedPosition", "nestedOffset", "selectable", "ignoreClickOutside", "direction", "onOnSelect"])) : (n(), v(de, {
|
|
214
215
|
key: 3,
|
|
215
216
|
option: l,
|
|
216
217
|
index: a,
|
|
@@ -229,7 +230,7 @@ const he = ["dir"], ve = {
|
|
|
229
230
|
} : void 0
|
|
230
231
|
]), 1032, ["option", "index", "selected", "focused", "selectable", "onClick", "onMouseenter"]))
|
|
231
232
|
], 64))), 128)),
|
|
232
|
-
r.loading ? (n(),
|
|
233
|
+
r.loading ? (n(), c("div", xe, [
|
|
233
234
|
S(I, {
|
|
234
235
|
icon: "lucide:loader-2",
|
|
235
236
|
class: "w-4 h-4 animate-spin text-muted-foreground"
|
|
@@ -237,7 +238,7 @@ const he = ["dir"], ve = {
|
|
|
237
238
|
])) : u("", !0),
|
|
238
239
|
b(e.$slots, "menu")
|
|
239
240
|
], 38)) : u("", !0),
|
|
240
|
-
e.$slots.footer ? (n(),
|
|
241
|
+
e.$slots.footer ? (n(), c("div", Se, [
|
|
241
242
|
b(e.$slots, "footer")
|
|
242
243
|
])) : u("", !0)
|
|
243
244
|
], 8, he));
|