nicklabs-ui 1.0.107 → 1.0.110

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.106 | **Framework**: Vue 3.5+
5
+ **Version**: 1.0.110 | **Framework**: Vue 3.5+
6
6
 
7
7
  ---
8
8
 
@@ -23,6 +23,7 @@ A Vue 3 component library with glassmorphism design, built for modern web applic
23
23
  - [NAudioSelect](#naudioselect)
24
24
  - [NSwitch](#nswitch)
25
25
  - [NDatePicker](#ndatepicker)
26
+ - [NTimePicker](#ntimepicker)
26
27
  - [Data Display](#data-display)
27
28
  - [NTable](#ntable)
28
29
  - [NVirtualTable](#nvirtualtable)
@@ -30,6 +31,7 @@ A Vue 3 component library with glassmorphism design, built for modern web applic
30
31
  - [NTag](#ntag)
31
32
  - [NEmpty](#nempty)
32
33
  - [NCode](#ncode)
34
+ - [NImage](#nimage)
33
35
  - [Modals & Overlays](#modals--overlays)
34
36
  - [NModal](#nmodal)
35
37
  - [NDrawer](#ndrawer)
@@ -860,6 +862,58 @@ const endDate = ref('')
860
862
 
861
863
  ---
862
864
 
865
+ #### NTimePicker
866
+
867
+ Time picker for selecting hour, minute, and second. Each unit can be toggled on or off independently, and the bound string is trimmed to match the enabled units. Uses a scrolling-list dropdown on desktop and a bottom sheet on mobile.
868
+
869
+ **Props**
870
+
871
+ | Prop | Type | Default | Description |
872
+ |------|------|---------|-------------|
873
+ | `modelValue` | `string` | `""` | Bound value (v-model). Format follows the enabled units, e.g. `HH:mm:ss`, `HH:mm`, `mm:ss` |
874
+ | `hour` | `boolean` | `true` | Show the "hour" column |
875
+ | `minute` | `boolean` | `true` | Show the "minute" column |
876
+ | `second` | `boolean` | `true` | Show the "second" column |
877
+ | `placeholder` | `string` | `"請選擇時間"` | Placeholder text |
878
+ | `disabled` | `boolean` | `false` | Disable picker |
879
+ | `clearable` | `boolean` | `false` | Show clear button |
880
+ | `title` | `string` | `""` | Label above picker |
881
+ | `size` | `"sm" \| "md" \| "lg"` | `"md"` | Trigger size |
882
+
883
+ **Events**
884
+
885
+ | Event | Payload | Description |
886
+ |-------|---------|-------------|
887
+ | `update:modelValue` | `string` | Value changed (v-model) |
888
+ | `change` | `string` | Value changed |
889
+ | `clear` | — | Clear button clicked |
890
+
891
+ **Usage**
892
+
893
+ ```vue
894
+ <template>
895
+ <!-- Hour : minute : second -->
896
+ <NTimePicker v-model="time" title="Select Time" clearable />
897
+
898
+ <!-- Hour : minute only (value becomes "HH:mm") -->
899
+ <NTimePicker v-model="timeHM" :second="false" title="Hour & Minute" />
900
+
901
+ <!-- Hour only (value becomes "HH") -->
902
+ <NTimePicker v-model="hourOnly" :minute="false" :second="false" title="Hour" />
903
+ </template>
904
+
905
+ <script setup>
906
+ import { ref } from 'vue'
907
+ import { NTimePicker } from 'nicklabs-ui'
908
+
909
+ const time = ref('09:30:00')
910
+ const timeHM = ref('14:30')
911
+ const hourOnly = ref('08')
912
+ </script>
913
+ ```
914
+
915
+ ---
916
+
863
917
  ### Data Display
864
918
 
865
919
  ---
@@ -1329,6 +1383,67 @@ const snippet = `const greeting = (name: string) => {
1329
1383
 
1330
1384
  ---
1331
1385
 
1386
+ #### NImage
1387
+
1388
+ An image display component that behaves like a native `<img>` by default, with sizing, `object-fit`, and corner-radius props. Enable `preview` to make the thumbnail clickable — it opens a teleported, blurred-backdrop lightbox showing the full image, closable via the × button, the ESC key, or an overlay click.
1389
+
1390
+ **Props**
1391
+
1392
+ | Prop | Type | Default | Description |
1393
+ |------|------|---------|-------------|
1394
+ | `src` | `string` | — | Image source (required) |
1395
+ | `alt` | `string` | `""` | Alternative text |
1396
+ | `width` | `string \| number` | — | Thumbnail width (number is treated as px) |
1397
+ | `height` | `string \| number` | — | Thumbnail height (number is treated as px) |
1398
+ | `fit` | `"fill" \| "contain" \| "cover" \| "none" \| "scale-down"` | `"cover"` | Maps to CSS `object-fit` |
1399
+ | `radiusSize` | `"none" \| "sm" \| "md" \| "lg" \| "xl"` | `"md"` | Corner radius |
1400
+ | `lazy` | `boolean` | `false` | Use `loading="lazy"` for deferred loading |
1401
+ | `preview` | `boolean` | `false` | Click the image to open a full-size lightbox |
1402
+ | `previewSrc` | `string` | `src` | High-resolution source for the lightbox; falls back to `src` |
1403
+ | `zIndex` | `number` | `1000` | Lightbox overlay z-index |
1404
+ | `closeOnClickOverlay` | `boolean` | `true` | Close the lightbox when the backdrop is clicked |
1405
+
1406
+ **Events**
1407
+
1408
+ | Event | Payload | Description |
1409
+ |-------|---------|-------------|
1410
+ | `load` | `Event` | Image finished loading |
1411
+ | `error` | `Event` | Image failed to load |
1412
+ | `preview-open` | — | Lightbox opened |
1413
+ | `preview-close` | — | Lightbox closed |
1414
+
1415
+ **Usage**
1416
+
1417
+ ```vue
1418
+ <template>
1419
+ <!-- Basic: behaves like <img> -->
1420
+ <NImage src="/photo.jpg" :width="200" :height="140" alt="Scenery" />
1421
+
1422
+ <!-- Lightbox: click to view the full image -->
1423
+ <NImage src="/photo.jpg" :width="200" :height="140" preview />
1424
+
1425
+ <!-- Separate thumbnail and full-resolution sources -->
1426
+ <NImage
1427
+ src="/photo-thumb.jpg"
1428
+ preview-src="/photo-full.jpg"
1429
+ :width="200"
1430
+ :height="140"
1431
+ preview
1432
+ />
1433
+
1434
+ <!-- object-fit and corner radius -->
1435
+ <NImage src="/photo.jpg" :width="160" :height="160" fit="contain" radius-size="xl" />
1436
+ </template>
1437
+
1438
+ <script setup lang="ts">
1439
+ import { NImage } from 'nicklabs-ui'
1440
+ </script>
1441
+ ```
1442
+
1443
+ > Distinct from [NImageSelect](#nimageselect): `NImage` **displays** an image (with an optional lightbox), while `NImageSelect` is an **uploader** for picking image files.
1444
+
1445
+ ---
1446
+
1332
1447
  ### Modals & Overlays
1333
1448
 
1334
1449
  ---