nicklabs-ui 1.0.32 → 1.0.34

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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A Vue 3 component library with glassmorphism design, built for modern web applications.
4
4
 
5
- **Version**: 1.0.26 | **Framework**: Vue 3.5+
5
+ **Version**: 1.0.34 | **Framework**: Vue 3.5+
6
6
 
7
7
  ---
8
8
 
@@ -306,13 +306,15 @@ Checkbox input supporting both single and multi-option modes.
306
306
  |------|------|---------|-------------|
307
307
  | `modelValue` | `boolean \| any[]` | — | Bound value (v-model) |
308
308
  | `multiple` | `boolean` | `false` | Enable multi-option mode |
309
- | `options` | `OptionItem[]` | — | Options for multi mode |
309
+ | `options` | `Record<string, any>[]` | — | Options for multi mode |
310
310
  | `disabled` | `boolean` | `false` | Disable input |
311
311
  | `title` | `string` | — | Group label displayed above options |
312
312
  | `label` | `string` | — | Text beside checkbox in single mode (overridable by default slot) |
313
313
  | `inline` | `boolean` | `false` | Display title and options on the same line |
314
314
  | `direction` | `"row" \| "column"` | `"row"` | Layout direction for options |
315
315
  | `autofocus` | `boolean` | `false` | Auto-focus on mount |
316
+ | `formatLabel` | `(option: any) => string` | `(opt) => opt.label` | Function to extract display text from an option |
317
+ | `formatValue` | `(option: any) => any` | `(opt) => opt.value` | Function to extract the value from an option |
316
318
 
317
319
  **Events**
318
320
 
@@ -342,6 +344,15 @@ Checkbox input supporting both single and multi-option modes.
342
344
 
343
345
  <!-- Inline title -->
344
346
  <NCheckbox v-model="selected" multiple :options="options" title="Interests" inline />
347
+
348
+ <!-- Custom field names -->
349
+ <NCheckbox
350
+ v-model="selected"
351
+ multiple
352
+ :options="[{ name: 'Apple', id: 'apple' }, { name: 'Banana', id: 'banana' }]"
353
+ :format-label="(opt) => opt.name"
354
+ :format-value="(opt) => opt.id"
355
+ />
345
356
  </template>
346
357
 
347
358
  <script setup>
@@ -377,6 +388,8 @@ Dropdown select with search, multi-select, and clear support.
377
388
  | `disabled` | `boolean` | `false` | Disable input |
378
389
  | `title` | `string` | — | Label above dropdown |
379
390
  | `multipleDisplay` | `"count" \| "tags"` | `"tags"` | How selected items display |
391
+ | `formatLabel` | `(option: any) => string` | `(opt) => opt.label` | Function to extract display text from an option |
392
+ | `formatValue` | `(option: any) => any` | `(opt) => opt.value` | Function to extract the value from an option |
380
393
 
381
394
  **Events**
382
395
 
@@ -406,6 +419,23 @@ Dropdown select with search, multi-select, and clear support.
406
419
  multipleDisplay="tags"
407
420
  title="Tags"
408
421
  />
422
+
423
+ <!-- Custom keys (API data with non-standard field names) -->
424
+ <NSelect
425
+ v-model="city"
426
+ :options="[{ name: 'Taipei', id: 'taipei' }, { name: 'Tokyo', id: 'tokyo' }]"
427
+ :format-label="(opt) => opt.name"
428
+ :format-value="(opt) => opt.id"
429
+ placeholder="Select city"
430
+ />
431
+
432
+ <!-- Combine multiple fields into display text -->
433
+ <NSelect
434
+ v-model="city"
435
+ :options="apiData"
436
+ :format-label="(opt) => `${opt.name} (${opt.code})`"
437
+ :format-value="(opt) => opt.id"
438
+ />
409
439
  </template>
410
440
 
411
441
  <script setup>
@@ -1018,26 +1048,34 @@ import { NTooltip, NButton } from 'nicklabs-ui'
1018
1048
 
1019
1049
  #### NLoading
1020
1050
 
1021
- Loading indicator for inline use or full-page overlay.
1051
+ Loading indicator supporting inline, overlay, and fullscreen modes.
1022
1052
 
1023
1053
  **Props**
1024
1054
 
1025
1055
  | Prop | Type | Default | Description |
1026
1056
  |------|------|---------|-------------|
1027
- | `loading` | `boolean` | `false` | Show loading state |
1057
+ | `loading` | `boolean` | `true` | Show loading state |
1028
1058
  | `title` | `string` | — | Loading message |
1029
1059
  | `variant` | `"spinner" \| "dots"` | `"spinner"` | Animation style |
1030
- | `overlay` | `boolean` | `false` | Full-page overlay mode |
1060
+ | `overlay` | `boolean` | `false` | Overlay mode — covers slot content with a backdrop |
1061
+ | `fullscreen` | `boolean` | `false` | Fullscreen mode — covers the entire viewport and blocks interaction |
1031
1062
 
1032
1063
  **Usage**
1033
1064
 
1034
1065
  ```vue
1035
1066
  <template>
1036
- <!-- Inline -->
1037
- <NLoading :loading="isFetching" title="Loading data..." />
1038
-
1039
- <!-- Full-page overlay -->
1040
- <NLoading :loading="isSubmitting" overlay title="Saving..." variant="dots" />
1067
+ <!-- Inline: shows spinner while loading, slot content when done -->
1068
+ <NLoading :loading="isFetching" title="Loading data...">
1069
+ <p>Content loaded!</p>
1070
+ </NLoading>
1071
+
1072
+ <!-- Overlay: spinner overlaid on top of slot content -->
1073
+ <NLoading :loading="isSubmitting" overlay title="Saving..." variant="dots">
1074
+ <div>Form content here</div>
1075
+ </NLoading>
1076
+
1077
+ <!-- Fullscreen: blocks entire viewport, no slot needed -->
1078
+ <NLoading :loading="isProcessing" fullscreen title="處理中..." />
1041
1079
  </template>
1042
1080
 
1043
1081
  <script setup>
@@ -1046,6 +1084,7 @@ import { NLoading } from 'nicklabs-ui'
1046
1084
 
1047
1085
  const isFetching = ref(true)
1048
1086
  const isSubmitting = ref(false)
1087
+ const isProcessing = ref(false)
1049
1088
  </script>
1050
1089
  ```
1051
1090