vlite3 1.5.12 → 1.5.13

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 (127) hide show
  1. package/README.md +20 -8
  2. package/components/Accordion/AccordionContent.vue.js +2 -2
  3. package/components/CommandPalette/CommandPaletteContent2.vue.js +1 -1
  4. package/components/CommandPalette/{CommandPaletteItem2.vue.js → CommandPaletteItem.vue.js} +1 -1
  5. package/components/Dropdown/DropdownMenu.vue.js +1 -1
  6. package/components/Form/AccordionView2.vue.js +1 -1
  7. package/components/Form/Form.vue.js +2 -2
  8. package/components/NavbarCommandPalette.vue.js +1 -1
  9. package/components/PanZoomViewport/PanZoomViewport.vue.d.ts +7 -7
  10. package/components/PanZoomViewport/PanZoomViewport.vue.js +1 -1
  11. package/components/Tabes/Tabes.vue.js +2 -2
  12. package/docs/README.md +17 -0
  13. package/docs/all-components.md +89 -0
  14. package/docs/component-index.md +313 -0
  15. package/docs/components/accordion.md +52 -0
  16. package/docs/components/alert.md +34 -0
  17. package/docs/components/app-shell.md +371 -0
  18. package/docs/components/async-select.md +264 -0
  19. package/docs/components/attachments-list.md +231 -0
  20. package/docs/components/avatar-group.md +74 -0
  21. package/docs/components/avatar-uploader.md +61 -0
  22. package/docs/components/avatar.md +28 -0
  23. package/docs/components/badge.md +81 -0
  24. package/docs/components/barcode.md +42 -0
  25. package/docs/components/beacon.md +29 -0
  26. package/docs/components/breadcrumb.md +317 -0
  27. package/docs/components/button-group.md +35 -0
  28. package/docs/components/button.md +86 -0
  29. package/docs/components/calendar.md +95 -0
  30. package/docs/components/carousel.md +122 -0
  31. package/docs/components/cart.md +533 -0
  32. package/docs/components/category-manager.md +269 -0
  33. package/docs/components/category-menu.md +251 -0
  34. package/docs/components/charts.md +1456 -0
  35. package/docs/components/chat.md +330 -0
  36. package/docs/components/checkbox.md +31 -0
  37. package/docs/components/chip.md +137 -0
  38. package/docs/components/choice-box.md +40 -0
  39. package/docs/components/clipboard.md +105 -0
  40. package/docs/components/clock.md +70 -0
  41. package/docs/components/color-picker.md +82 -0
  42. package/docs/components/command-palette.md +214 -0
  43. package/docs/components/comment-thread.md +171 -0
  44. package/docs/components/confirmation-modal.md +50 -0
  45. package/docs/components/custom-fields-display.md +94 -0
  46. package/docs/components/custom-fields.md +97 -0
  47. package/docs/components/data-list.md +93 -0
  48. package/docs/components/data-table.md +922 -0
  49. package/docs/components/date-picker.md +58 -0
  50. package/docs/components/date-range-picker.md +24 -0
  51. package/docs/components/date-time.md +104 -0
  52. package/docs/components/dropdown.md +740 -0
  53. package/docs/components/empty.md +100 -0
  54. package/docs/components/export-data.md +320 -0
  55. package/docs/components/file-picker.md +83 -0
  56. package/docs/components/file-preview.md +42 -0
  57. package/docs/components/file-tree.md +144 -0
  58. package/docs/components/footer.md +251 -0
  59. package/docs/components/forms.md +776 -0
  60. package/docs/components/gantt-chart.md +767 -0
  61. package/docs/components/google-login.md +67 -0
  62. package/docs/components/google-map.md +128 -0
  63. package/docs/components/heatmap.md +80 -0
  64. package/docs/components/icon-picker.md +58 -0
  65. package/docs/components/icon.md +176 -0
  66. package/docs/components/image-comparison.md +51 -0
  67. package/docs/components/image-magnifier.md +26 -0
  68. package/docs/components/import-data.md +521 -0
  69. package/docs/components/input.md +58 -0
  70. package/docs/components/invoice.md +339 -0
  71. package/docs/components/kanban.md +302 -0
  72. package/docs/components/label.md +25 -0
  73. package/docs/components/list.md +419 -0
  74. package/docs/components/masonry.md +55 -0
  75. package/docs/components/modal.md +133 -0
  76. package/docs/components/multi-select.md +54 -0
  77. package/docs/components/navbar.md +403 -0
  78. package/docs/components/number-input.md +41 -0
  79. package/docs/components/otp-input.md +68 -0
  80. package/docs/components/pagination.md +83 -0
  81. package/docs/components/pan-zoom-viewport.md +245 -0
  82. package/docs/components/permission-editor.md +322 -0
  83. package/docs/components/persona.md +56 -0
  84. package/docs/components/price.md +106 -0
  85. package/docs/components/pricing-plan.md +68 -0
  86. package/docs/components/progress-bar.md +53 -0
  87. package/docs/components/qr-code.md +59 -0
  88. package/docs/components/rating.md +59 -0
  89. package/docs/components/rich-text-editor.md +210 -0
  90. package/docs/components/scale-generator.md +101 -0
  91. package/docs/components/screen.md +208 -0
  92. package/docs/components/seo-provider.md +189 -0
  93. package/docs/components/side-panel.md +94 -0
  94. package/docs/components/sidebar-menu.md +422 -0
  95. package/docs/components/skeleton.md +115 -0
  96. package/docs/components/slider.md +48 -0
  97. package/docs/components/spinner.md +27 -0
  98. package/docs/components/splitter.md +97 -0
  99. package/docs/components/stats.md +234 -0
  100. package/docs/components/status-chip.md +232 -0
  101. package/docs/components/switch.md +23 -0
  102. package/docs/components/tabs.md +335 -0
  103. package/docs/components/tag-input.md +55 -0
  104. package/docs/components/textarea.md +31 -0
  105. package/docs/components/theme-provider.md +130 -0
  106. package/docs/components/theme-toggle.md +36 -0
  107. package/docs/components/thumbnail-selector.md +186 -0
  108. package/docs/components/timeline.md +225 -0
  109. package/docs/components/toast-notification.md +89 -0
  110. package/docs/components/tooltip.md +31 -0
  111. package/docs/components/workbook.md +102 -0
  112. package/docs/composables/use-theme.md +59 -0
  113. package/docs/getting-started/setup.md +176 -0
  114. package/docs/guides/draggable.md +211 -0
  115. package/docs/guides/internationalization.md +281 -0
  116. package/docs/guides/performance.md +118 -0
  117. package/docs/guides/testing-forms.md +154 -0
  118. package/docs/guides/testing-overlays.md +131 -0
  119. package/docs/guides/theming.md +124 -0
  120. package/docs/utilities/search.md +580 -0
  121. package/docs/utilities/utilities.md +371 -0
  122. package/docs-manifest.json +339 -0
  123. package/package.json +5 -13
  124. package/scripts/generate-docs-manifest.js +207 -0
  125. package/scripts/sync-docs.js +754 -0
  126. package/style.css +1 -1
  127. /package/components/Dropdown/{DropdownMenu2.vue.js → DropdownMenu3.vue.js} +0 -0
@@ -0,0 +1,100 @@
1
+ # Empty
2
+
3
+ **Import:** `import { Empty } from 'vlite3'`
4
+
5
+ A versatile component used to display empty states when no data is available. It comes with 12 distinct, highly-polished variants designed for modern SaaS interfaces, ranging from simple icons to elaborate structural skeletons and minimalist focus blocks.
6
+
7
+ The component inherits its default variant from the global `vlite3` configuration, but can be overridden locally on a per-component basis.
8
+
9
+ ---
10
+
11
+ ## Props
12
+
13
+ | Prop | Type | Default | Description |
14
+ | :----------------- | :----------------- | :------ | :-------------------------------------------------------------------------- |
15
+ | `title` | `string` | `'No data found'` | The main title of the empty state. |
16
+ | `titleI18n` | `string` | — | An i18n key to use for the title, translated automatically. |
17
+ | `description` | `string` | `'There is nothing to display here right now.'` | The descriptive subtitle text. Supports HTML. |
18
+ | `descriptionI18n` | `string` | — | An i18n key to use for the description, translated automatically. |
19
+ | `icon` | `string` | `'lucide:inbox'` | The icon to display, using any valid Iconify string format. |
20
+ | `variant` | `EmptyVariant` | `'variant1'` | The visual variant to render. Accepts `'variant1'` through `'variant11'`. |
21
+
22
+ ---
23
+
24
+ ## Slots
25
+
26
+ | Slot Name | Description |
27
+ | :-------- | :---------- |
28
+ | `action` | A slot typically used for rendering call-to-action buttons below the description. |
29
+ | `default` | The default slot, rendered inside the component block for custom additions. |
30
+
31
+ ---
32
+
33
+ ## Usage
34
+
35
+ ### Basic Local Usage
36
+
37
+ Pass a title and description to quickly render a clean empty state. By default, it will use `'variant1'` unless globally configured otherwise.
38
+
39
+ ```vue
40
+ <script setup lang="ts">
41
+ import { Empty, Button } from 'vlite3'
42
+ </script>
43
+
44
+ <template>
45
+ <Empty
46
+ title="No Habits Tracked"
47
+ description="Your journey is waiting. Start building consistency today by defining your first daily ritual."
48
+ icon="lucide:sparkles"
49
+ variant="variant10"
50
+ >
51
+ <template #action>
52
+ <Button variant="primary">Get Started</Button>
53
+ </template>
54
+ </Empty>
55
+ </template>
56
+ ```
57
+
58
+ ---
59
+
60
+ ## Global Configuration
61
+
62
+ You can set a default empty state variant for your entire application during plugin initialization. This ensures consistent empty states across all your data tables, lists, and pages without manually passing the `variant` prop every time.
63
+
64
+ ```ts
65
+ // main.ts
66
+ import { createApp } from 'vue'
67
+ import { createVLite } from 'vlite3'
68
+ import App from './App.vue'
69
+
70
+ const app = createApp(App)
71
+
72
+ const vlite = createVLite({
73
+ components: {
74
+ empty: {
75
+ variant: 'variant10', // Set default variant for all Empty components
76
+ },
77
+ },
78
+ })
79
+
80
+ app.use(vlite)
81
+ app.mount('#app')
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Variants Overview
87
+
88
+ The `Empty` component relies on its unique variants to match different parts of an application:
89
+
90
+ - **Variant 1 (Clean):** Minimalist focused on a clean icon display.
91
+ - **Variant 2 (Horizontal):** Useful for compact or wide row layouts.
92
+ - **Variant 3 (Typographic):** Dramatic, larger text sizes with a focus on copy.
93
+ - **Variant 4 (Structural):** A split wireframe layout mimicking a dashboard, great for full-page empty apps.
94
+ - **Variant 5 (Atmospheric):** A flat, grey minimalist block with a large resting icon.
95
+ - **Variant 6 (Interactive):** A clear dashed-border dropzone style layout.
96
+ - **Variant 7 (Narrative):** An offset timeline tree structure, implying a user journey.
97
+ - **Variant 8 (Floating):** A crisp, simple elevated card centered in the viewport.
98
+ - **Variant 9 (Split):** Split visual layout aesthetics.
99
+ - **Variant 10 (Essential):** An ultra-clean left-aligned block with zero bounding boxes. Pure data.
100
+ - **Variant 11 (Large Text):** Emphasized typography layout structure.
@@ -0,0 +1,320 @@
1
+ # ExportData
2
+
3
+ **Import:** `import { ExportData } from 'vlite3'`
4
+
5
+ ### Description
6
+
7
+ `ExportData` is a flexible, production-ready component for exporting arrays of data to **Excel (.xlsx)**, **CSV (.csv)**, and **JSON (.json)** files. It supports two modes: **Frontend mode** (generating and downloading files directly in the browser using client-side libraries) and **Backend mode** (delegating the generation to a backend API).
8
+
9
+ Key capabilities:
10
+ - **Dot-notation support:** Easily parse nested object fields (e.g. `'address.city'`).
11
+ - **Context-aware cell formatting:** Pass both the raw property value and the parent row object to custom formatting functions.
12
+ - **Dual UI behavior:** Automatically switches between immediate export and selector modal based on configured formats.
13
+ - **Excel safety guardrails:** Enforces limits such as 31-character sheet names to prevent spreadsheet parsing crashes.
14
+ - **UTF-8 BOM for CSVs:** Correctly encodes special characters for Microsoft Excel compatibility.
15
+ - **Programmatic control:** Exposes API methods via template refs to trigger exports programmatically.
16
+
17
+ ---
18
+
19
+ ## Dynamic UI Modes
20
+
21
+ The component automatically adapts its interface based on the length of the `formats` prop:
22
+
23
+ ```mermaid
24
+ graph TD
25
+ A[Formats Prop Check] -->|Length == 1| B[Direct Download Mode]
26
+ A -->|Length > 1| C[Modal Selector Mode]
27
+ B -->|Click Button| D[Export Triggered Immediately]
28
+ C -->|Click Button| E[Open sm:max-w-400px Modal]
29
+ E -->|Select Format Option| F[Export Triggered]
30
+ ```
31
+
32
+ 1. **Direct Download Mode (Single Format)** — If `formats` contains exactly one item (e.g. `['csv']`), clicking the trigger button downloads the file immediately. No modal is displayed.
33
+ 2. **Modal Selector Mode (Multiple Formats)** — If `formats` contains multiple options, clicking the trigger button opens a modal selector (`sm:max-w-[400px]`) displaying styled buttons with matching icons for each format.
34
+
35
+ ---
36
+
37
+ ## Props
38
+
39
+ | Prop | Type | Default | Description |
40
+ | :--- | :--- | :------ | :---------- |
41
+ | `data` | `any[]` | _(required)_ | The array of data objects to export. If empty or null in frontend mode, a warning Toast is shown. |
42
+ | `fields` | `ExportField[]` | _(required)_ | Ordered array of field definitions mapping data property paths to output columns. |
43
+ | `title` | `string` | `'Export Data'` | Used as the modal title and fallback Excel sheet name. Also serves as the base for automatic filenames. |
44
+ | `formats` | `ExportFormat[]` | `['excel', 'csv', 'json']` | Enabled export formats. If a single option is provided, direct download mode is used. |
45
+ | `filename` | `string` | — | Base filename without extension. Defaults to `{title.toLowerCase().replace(/\s+/g, '-')}-{YYYY-MM-DD}`. |
46
+ | `buttonText` | `string` | `'Export'` | Label for the trigger button. |
47
+ | `buttonIcon` | `string` | `'lucide:download'` | Iconify icon ID for the trigger button icon. |
48
+ | `mode` | `'frontend' \| 'backend'` | `'frontend'` | `'frontend'` generates files client-side. `'backend'` delegates to the `onExport` callback. |
49
+ | `onExport` | `(format: ExportFormat) => Promise<void> \| void` | — | Callback required when `mode='backend'`. Triggered with the selected format. |
50
+
51
+ ---
52
+
53
+ ## TypeScript Definitions
54
+
55
+ All types are exported from the component namespace:
56
+
57
+ ```ts
58
+ export interface ExportField {
59
+ field: string // Property path in the data object. Supports dot notation (e.g., 'address.city').
60
+ title: string // Column header label in the exported file.
61
+ format?: (value: any, row: any) => any // Optional transform function. Receives raw value and the full row object.
62
+ }
63
+
64
+ export type ExportFormat = 'excel' | 'csv' | 'json'
65
+
66
+ export interface ExportDataProps {
67
+ data: any[]
68
+ title?: string
69
+ fields: ExportField[]
70
+ formats?: ExportFormat[]
71
+ filename?: string
72
+ buttonText?: string
73
+ buttonIcon?: string
74
+ mode?: 'frontend' | 'backend'
75
+ onExport?: (format: ExportFormat) => Promise<void> | void
76
+ }
77
+ ```
78
+
79
+ ---
80
+
81
+ ## Deep Dive: Data Processing & Formatting Pipeline
82
+
83
+ In frontend mode, the component maps raw dataset objects into flat rows formatted for spreadsheet generation:
84
+
85
+ ```mermaid
86
+ flowchart TD
87
+ Raw[Raw Data Object] --> Retrieve[1. Dot-Notation Property Retrieval]
88
+ Retrieve --> CheckFormat{2. Custom format defined?}
89
+ CheckFormat -->|Yes| ExecFormat[3a. Run format callback]
90
+ CheckFormat -->|No| Coalesce[3b. Coalesce undefined/null to empty string]
91
+ ExecFormat --> Final[Output Column Value]
92
+ Coalesce --> Final
93
+ ```
94
+
95
+ ### 1. Dot-Notation Property Retrieval
96
+ Nested keys (e.g., `'address.city'`) are parsed using a recursive lookup helper. If any parent object along the path is undefined or null, it safely returns `undefined` without throwing errors.
97
+
98
+ ### 2. Context-Aware Custom Formatters
99
+ If a field has a `format` function:
100
+ * It executes, passing **both** the raw field value and the complete row object: `format(rawValue, rowItem)`.
101
+ * This allows you to construct computed cells that rely on multiple columns (e.g., combining `firstName` and `lastName` or calculating sums).
102
+
103
+ ### 3. Coalescing Nulls/Undefined
104
+ If no custom formatter is defined, the component checks the retrieved property. If the property is `undefined` or `null`, it is coalesced to an empty string (`''`) so that cells do not print text like `'null'` or `'undefined'`.
105
+
106
+ ---
107
+
108
+ ## File Generation Specifics (Frontend Mode)
109
+
110
+ ### Excel Limit Safeguard
111
+ Microsoft Excel restricts sheet names (tabs) to a maximum of **31 characters** and forbids specific characters (like `[`, `]`, `?`, `*`, `/`, `\`). The component extracts the first 31 characters of the `title` prop to ensure compliance and prevent sheet corruption crashes:
112
+ ```ts
113
+ XLSX.utils.book_append_sheet(workbook, worksheet, props.title.substring(0, 31))
114
+ ```
115
+
116
+ ### UTF-8 BOM for CSVs
117
+ When generating CSVs, the component prepends a UTF-8 Byte Order Mark (`\uFEFF`) to the text payload. This tells programs like Microsoft Excel that the file uses UTF-8 encoding, ensuring that special characters, accents, emoji, or non-English scripts are displayed correctly.
118
+
119
+ ---
120
+
121
+ ## Frontend vs. Backend Mode
122
+
123
+ ### Frontend Mode
124
+ * Uses **SheetJS (xlsx)** for Excel workbook generation, **PapaParse** for CSV formatting, and standard `Blob` serializations for JSON.
125
+ * Files are constructed entirely in memory on the client side and saved using the **file-saver** library.
126
+ * Safely blocks exports if the `data` array is empty, showing a warning toast notification.
127
+
128
+ ### Backend Mode
129
+ * Set `mode="backend"`. Client-side processing is skipped entirely.
130
+ * Triggering an export calls the `onExport(format)` callback.
131
+ * > [!IMPORTANT]
132
+ > The developer's `onExport` function is fully responsible for hitting the API, handling file binary responses, and triggering the file download. If your backend callback throws an error, the component catches it and displays a warning Toast.
133
+
134
+ ---
135
+
136
+ ## Exposed API Methods (`defineExpose`)
137
+
138
+ You can access these properties and methods by attaching a template `ref` to the `<ExportData>` component in your Vue parent:
139
+
140
+ | Method / Property | Signature | Description |
141
+ | :--- | :--- | :--- |
142
+ | `exportData` | `(format: ExportFormat, close?: () => void) => Promise<void>` | Programmatically fires the export routine. You can optionally supply a closing callback (e.g. to dismiss a custom dropdown). |
143
+ | `availableFormats` | `ComputedRef<{ label: string; value: ExportFormat; icon: string }[]>` | The filtered list of active format objects containing values, labels, and icons. |
144
+
145
+ ---
146
+
147
+ ## Slots
148
+
149
+ * **No Public Slots:** This component has no public slot overrides. It renders a standard trigger button internally. For fully customized layouts, use the programmatic `exportData` method via a template `ref` on an external button component.
150
+
151
+ ---
152
+
153
+ ## Events
154
+
155
+ * **No Public Events:** The component does not emit public events. Lifecycle overrides should be configured through the `onExport` callback when running in backend mode.
156
+
157
+ ---
158
+
159
+ ## Translation Keys Reference (i18n)
160
+
161
+ The component utilizes the `$t()` utility for internationalization. All translation keys, default English fallbacks, and parameter structures are outlined below.
162
+
163
+ ### ExportData Keys
164
+
165
+ | Key | Default Fallback |
166
+ | :------------------------------ | :------------------------------------------ |
167
+ | `vlite.exportData.selectFormat` | `'Select Export Format'` |
168
+ | `vlite.exportData.success` | `'Data exported successfully as {format}'` |
169
+ | `vlite.exportData.error` | `'An error occurred while exporting data.'` |
170
+ | `vlite.exportData.noData` | `'No data available to export.'` |
171
+
172
+ ---
173
+
174
+ ## Usage Examples
175
+
176
+ ### 1. Basic Frontend Export (All Formats)
177
+
178
+ ```vue
179
+ <script setup lang="ts">
180
+ import { ExportData, type ExportField } from 'vlite3'
181
+
182
+ const users = [
183
+ {
184
+ id: 1,
185
+ name: 'Alice',
186
+ email: 'alice@example.com',
187
+ address: { city: 'New York' },
188
+ balance: 1250.5,
189
+ },
190
+ { id: 2, name: 'Bob', email: 'bob@example.com', address: { city: 'London' }, balance: 340.0 },
191
+ ]
192
+
193
+ const exportFields: ExportField[] = [
194
+ { field: 'id', title: 'User ID' },
195
+ { field: 'name', title: 'Full Name' },
196
+ { field: 'email', title: 'Email Address' },
197
+ { field: 'address.city', title: 'City' },
198
+ // Custom context-aware formatter
199
+ { field: 'balance', title: 'Balance ($)', format: (val) => `$${val.toFixed(2)}` },
200
+ ]
201
+ </script>
202
+
203
+ <template>
204
+ <ExportData
205
+ :data="users"
206
+ title="Users Report"
207
+ filename="users_2025"
208
+ :fields="exportFields"
209
+ :formats="['excel', 'csv', 'json']" />
210
+ </template>
211
+ ```
212
+
213
+ ---
214
+
215
+ ### 2. Single Format — Direct CSV Download
216
+
217
+ When `formats` has exactly one entry, clicking the button exports immediately with no modal popup.
218
+
219
+ ```vue
220
+ <template>
221
+ <ExportData
222
+ :data="orders"
223
+ title="Orders"
224
+ button-text="Download CSV"
225
+ button-icon="lucide:file-down"
226
+ :fields="orderFields"
227
+ :formats="['csv']" />
228
+ </template>
229
+ ```
230
+
231
+ ---
232
+
233
+ ### 3. Custom Value Formatting
234
+
235
+ Use the `format` function on any field to transform values before they appear in the exported file. It receives both the cell value and the parent row object.
236
+
237
+ ```vue
238
+ <script setup lang="ts">
239
+ import type { ExportField } from 'vlite3'
240
+
241
+ const fields: ExportField[] = [
242
+ { field: 'status', title: 'Status', format: (val) => String(val).toUpperCase() },
243
+ { field: 'price', title: 'Price', format: (val) => `$${Number(val).toFixed(2)}` },
244
+ { field: 'date', title: 'Created At', format: (val) => new Date(val).toLocaleDateString() },
245
+ // Calculate a computed display value based on multiple row properties
246
+ {
247
+ field: 'fullName',
248
+ title: 'Full Name',
249
+ format: (val, row) => `${row.firstName} ${row.lastName}`
250
+ },
251
+ {
252
+ field: 'tags',
253
+ title: 'Tags',
254
+ format: (val) => (Array.isArray(val) ? val.join(', ') : val),
255
+ },
256
+ ]
257
+ </script>
258
+ ```
259
+
260
+ ---
261
+
262
+ ### 4. Backend Export Mode
263
+
264
+ In backend mode, the component collects the user's format choice and delegates all API requests and download triggering to your callback.
265
+
266
+ ```vue
267
+ <script setup lang="ts">
268
+ import { ExportData, type ExportField } from 'vlite3'
269
+ import { myApi } from '@/api'
270
+ import { saveAs } from 'file-saver'
271
+
272
+ const fields: ExportField[] = [
273
+ { field: 'id', title: 'ID' },
274
+ { field: 'name', title: 'Name' },
275
+ ]
276
+
277
+ const handleBackendExport = async (format: 'excel' | 'csv' | 'json') => {
278
+ const blob = await myApi.exportUsers({ format })
279
+ saveAs(blob, `users-export.${format === 'excel' ? 'xlsx' : format}`)
280
+ }
281
+ </script>
282
+
283
+ <template>
284
+ <ExportData
285
+ :data="[]"
286
+ title="Users Report"
287
+ :fields="fields"
288
+ :formats="['excel', 'csv']"
289
+ mode="backend"
290
+ :on-export="handleBackendExport" />
291
+ </template>
292
+ ```
293
+
294
+ ---
295
+
296
+ ### 5. Programmatic Export via Template Ref
297
+
298
+ Trigger exports from custom buttons or UI panels by calling the exposed `exportData` method.
299
+
300
+ ```vue
301
+ <script setup lang="ts">
302
+ import { ref } from 'vue'
303
+ import { ExportData } from 'vlite3'
304
+
305
+ const exportRef = ref<InstanceType<typeof ExportData> | null>(null)
306
+
307
+ const triggerExcel = () => {
308
+ exportRef.value?.exportData('excel')
309
+ }
310
+ </script>
311
+
312
+ <template>
313
+ <!-- Render component hidden from view -->
314
+ <ExportData ref="exportRef" :data="data" :fields="fields" class="hidden" />
315
+
316
+ <Button @click="triggerExcel" icon="lucide:file-spreadsheet">
317
+ Export to Excel
318
+ </Button>
319
+ </template>
320
+ ```
@@ -0,0 +1,83 @@
1
+ # FilePicker
2
+
3
+ **Import:** `import { FilePicker } from 'vlite3'`
4
+
5
+ ### Props
6
+
7
+ | Prop | Type | Default | Description |
8
+ | :---------------- | :--------------------------------------------- | :----------- | :------------------------------------------ |
9
+ | `modelValue` | `FilePickerValue \| FilePickerValue[] \| null` | `null` | Binding (`v-model`) |
10
+ | `variant` | `'dropzone' \| 'input'` | `'dropzone'` | Display variant |
11
+ | `multiSelect` | `boolean` | `false` | Allow multiple file selection |
12
+ | `fileTypes` | `string[]` | `[]` | Allowed types (e.g., `['image/*', '.pdf']`) |
13
+ | `returnFormat` | `'file' \| 'base64'` | `'file'` | Output format for file data |
14
+ | `maxSize` | `number` | — | Max file size in bytes |
15
+ | `maxFiles` | `number` | — | Max number of allowed files |
16
+ | `loading` | `boolean` | `false` | Show loading state |
17
+ | `disabled` | `boolean` | `false` | Disable interaction |
18
+ | `allowRename` | `boolean` | `false` | Allow renaming files directly in the dropzone |
19
+ | `placeholder` | `string` | — | Placeholder (for `input` variant) |
20
+ | `placeholderI18n` | `string` | — | I18n key for input placeholder |
21
+ | `textI18n` | `string` | — | I18n key for dropzone text |
22
+ | `size` | `InputSize` | `'md'` | Size (for `input` variant) |
23
+ | `rounded` | `InputRounded` | `'md'` | Border radius (for `input` variant) |
24
+
25
+ ### Types
26
+
27
+ ```ts
28
+ export interface FilePickerValue {
29
+ fileName: string
30
+ fileType: string
31
+ fileSize: number
32
+ file: File | null // Actual File object (null if URL)
33
+ base64: string // Populated if returnFormat='base64'
34
+ isUrl?: boolean
35
+ }
36
+ ```
37
+
38
+ ### Events
39
+
40
+ - `@update:modelValue`: Emitted when value changes
41
+ - `@change`: Emitted when value changes
42
+ - `@error`: Emitted on validation errors (type, size, etc.)
43
+
44
+ ### Slots
45
+
46
+ | Slot | Description | Props |
47
+ | :-------- | :------------------ | :------------------------------------------ |
48
+ | `trigger` | Custom trigger area | `{ trigger, files, isDragging, isLoading }` |
49
+
50
+ ### Usage
51
+
52
+ #### Basic Dropzone
53
+
54
+ ```vue
55
+ <FilePicker v-model="files" :file-types="['image/*']" />
56
+ ```
57
+
58
+ #### Input Variant
59
+
60
+ ```vue
61
+ <FilePicker v-model="files" variant="input" placeholder="Upload document..." :multi-select="true" />
62
+ ```
63
+
64
+ #### Base64 Return
65
+
66
+ ```vue
67
+ <FilePicker v-model="files" return-format="base64" @change="uploadToServer" />
68
+ ```
69
+
70
+ #### Custom Trigger Slot
71
+
72
+ ```vue
73
+ <FilePicker v-model="files">
74
+ <template #trigger="{ trigger, files, isLoading }">
75
+ <Button
76
+ :loading="isLoading"
77
+ icon="lucide:upload"
78
+ @click="trigger">
79
+ {{ files?.length ? 'Change File' : 'Upload' }}
80
+ </Button>
81
+ </template>
82
+ </FilePicker>
83
+ ```
@@ -0,0 +1,42 @@
1
+ # FilePreview
2
+
3
+ **Import:** `import { FilePreview } from 'vlite3'`
4
+
5
+ A wrapper component for rendering documents (PDFs, images, etc.) inline or inside modals. It relies on the `v-file-preview` library to securely render content within a dedicated viewer.
6
+
7
+ ### Props
8
+
9
+ | Prop | Type | Default | Description |
10
+ | :------------ | :-------- | :------ | :------------------------------------------------------------ |
11
+ | `url` | `string` | — | The URL of the file to preview. (Required) |
12
+ | `name` | `string` | — | Optional file name for display and context. |
13
+ | `canDownload` | `boolean` | `true` | Toggles the visibility of the "Download" programmatic action. |
14
+
15
+ ### Usage
16
+
17
+ ```vue
18
+ <script setup>
19
+ import { FilePreview, Modal, Button } from 'vlite3'
20
+ </script>
21
+
22
+ <template>
23
+ <div class="p-4 space-y-4">
24
+ <FilePreview
25
+ url="[https://example.com/document.pdf](https://example.com/document.pdf)"
26
+ name="Company Policy.pdf" />
27
+
28
+ <Modal
29
+ title="Preview Document"
30
+ max-width="max-w-3xl"
31
+ :body="FilePreview"
32
+ :bodyProps="{
33
+ url: '[https://example.com/document.pdf](https://example.com/document.pdf)',
34
+ name: 'Policy.pdf',
35
+ }">
36
+ <template #trigger>
37
+ <Button>Open Preview</Button>
38
+ </template>
39
+ </Modal>
40
+ </div>
41
+ </template>
42
+ ```
@@ -0,0 +1,144 @@
1
+ # FileTree
2
+
3
+ **Import:** `import { FileTree } from 'vlite3'`
4
+
5
+ ### Description
6
+
7
+ A recursive tree component for displaying hierarchical data (files, folders, categories) with support for selection, checkboxes, async loading, and search filtering.
8
+
9
+ ### Props
10
+
11
+ | Prop | Type | Default | Description |
12
+ | :-------------------- | :------------------------------ | :--------- | :--------------------------------- |
13
+ | `data` | `FileNode[]` | `[]` | Tree data structure |
14
+ | `modelValue` | `string[]` | `[]` | Selected node IDs (v-model) |
15
+ | `selectionMode` | `'single' \| 'multiple'` | `'single'` | Selection behavior |
16
+ | `showCheckboxes` | `boolean` | `false` | Show checkboxes for selection |
17
+ | `loadData` | `(node) => Promise<FileNode[]>` | — | Async handler for loading children |
18
+ | `searchQuery` | `string` | — | Filter nodes by name or content |
19
+ | `highlightSearch` | `boolean` | `false` | Highlight matching text |
20
+ | `defaultExpandedKeys` | `string[]` | `[]` | Initially expanded nodes |
21
+ | `emptyText` | `string` | — | Text for empty state |
22
+ | `emptyTextI18n` | `string` | — | I18n key for empty text |
23
+ | `variant` | `'default' \| 'bordered'` | `'default'`| Visual style of the tree |
24
+ | `class` | `string` | — | CSS class for tree container |
25
+
26
+ ### Type Definitions
27
+
28
+ ```typescript
29
+ interface FileNode {
30
+ id: string
31
+ label: string
32
+ isFolder?: boolean
33
+ children?: FileNode[]
34
+ icon?: string // Custom icon name
35
+ disabled?: boolean
36
+ isLoaded?: boolean // For async loading status
37
+ [key: string]: any // Allow custom data
38
+ }
39
+ ```
40
+
41
+ ### Events
42
+
43
+ - `@node-click` (node: `FileNode`): Emitted when a node is clicked.
44
+ - `@select` (node: `FileNode`, selected: `boolean`): Emitted when selection changes.
45
+ - `@expand` (node: `FileNode`, expanded: `boolean`): Emitted when a folder is expanded/collapsed.
46
+
47
+ ### Slots
48
+
49
+ - `actions` (`{ node: FileNode }`): Custom content to render on the right end of each node (e.g., action buttons like edit/delete).
50
+
51
+ ### Hierarchy connectors
52
+
53
+ The indent guides are drawn by the shared `TreeConnectors` component (`src/components/TreeConnectors`), the same primitive used by `DataTable`'s tree mode. Every node renders a vertical trunk, a horizontal branch to its icon, and a corner when it is the last child — all computed dynamically from the node's depth, its position among its siblings (`isLast`), and its ancestors' last-child flags (`ancestorLastFlags`, threaded through the recursion). Nothing is hard-coded, so the guides stay correct at any nesting depth and update automatically as folders expand, collapse, or load asynchronously.
54
+
55
+ ### Usage
56
+
57
+ #### 1. Content Search & Highlighting
58
+
59
+ To enable content highlighting, your data nodes should include the `searchMatch` property.
60
+
61
+ ```vue
62
+ <script setup>
63
+ import { computed, ref } from 'vue'
64
+
65
+ const searchQuery = ref('calculate')
66
+
67
+ // Example: Data is usually processed to attach search matches
68
+ const files = computed(() => [
69
+ {
70
+ id: 'utils',
71
+ label: 'utils.ts',
72
+ // ...
73
+ searchMatch: {
74
+ line_number: 42,
75
+ line_content: 'export const calculateTotal = (a, b) => a + b',
76
+ match_start: 24, // index where 'calculate' starts
77
+ match_length: 9,
78
+ },
79
+ },
80
+ ])
81
+ </script>
82
+
83
+ <template>
84
+ <FileTree :data="files" :search-query="searchQuery" highlight-search />
85
+ </template>
86
+ ```
87
+
88
+ #### 2. Async Loading with Skeleton State
89
+
90
+ Load children dynamically when a folder is expanded.
91
+
92
+ ```vue
93
+ <script setup>
94
+ const handleLoad = async (node) => {
95
+ // Simulate API call
96
+ await new Promise((r) => setTimeout(r, 1000))
97
+
98
+ return [{ id: `${node.id}-1`, label: 'Dynamic File.txt', isFolder: false }]
99
+ }
100
+ </script>
101
+
102
+ <template>
103
+ <FileTree :data="initialNodes" :loadData="handleLoad" />
104
+ </template>
105
+ ```
106
+
107
+ #### 3. Multiple Selection with Checkboxes
108
+
109
+ Handle selection state via `v-model`.
110
+
111
+ ```vue
112
+ <script setup>
113
+ const selectedIds = ref([])
114
+ </script>
115
+
116
+ <template>
117
+ <div class="h-64 border rounded p-2">
118
+ <FileTree
119
+ :data="projectFiles"
120
+ v-model="selectedIds"
121
+ selection-mode="multiple"
122
+ show-checkboxes
123
+ :default-expanded-keys="['root']" />
124
+ </div>
125
+ <div>Selected: {{ selectedIds }}</div>
126
+ </template>
127
+ ```
128
+
129
+ #### 4. Custom Node Actions
130
+
131
+ You can render custom action buttons on the right side of the node using the `#actions` slot.
132
+
133
+ ```vue
134
+ <template>
135
+ <FileTree :data="files">
136
+ <template #actions="{ node }">
137
+ <div class="flex gap-2 text-sm">
138
+ <button @click.stop="editFile(node)" class="text-blue-500 hover:text-blue-600">Edit</button>
139
+ <button @click.stop="deleteFile(node)" class="text-red-500 hover:text-red-600">Delete</button>
140
+ </div>
141
+ </template>
142
+ </FileTree>
143
+ </template>
144
+ ```