Skip to content

Commit c196353

Browse files
committed
minor fixes
1 parent f1c555a commit c196353

File tree

3 files changed

+21
-33
lines changed

3 files changed

+21
-33
lines changed

docs/app/components/content/examples/scroll-area/ScrollAreaResponsiveMasonryExample.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ const items = Array.from({ length: 30 }, (_, i) => {
2727
minLanes,
2828
maxLanes
2929
}"
30-
class="h-[600px] border border-default rounded-lg"
31-
style="resize: both; overflow: auto; min-width: 300px; min-height: 300px;"
30+
class="h-[600px] w-full border border-default rounded-lg"
31+
style="resize: horizontal; overflow: auto; min-width: 300px; min-height: 300px;"
3232
>
3333
<template #default="{ item }">
3434
<UCard :ui="{ body: 'p-0 sm:p-0' }">

docs/content/docs/2.components/scroll-area.md

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,9 @@ options:
6565
- name: orientation
6666
label: orientation
6767
default: vertical
68-
items:
69-
- vertical
70-
- horizontal
7168
---
7269
::
7370

74-
::note
75-
Use your mouse to drag the scroll area horizontally or vertically depending on the orientation.
76-
::
77-
7871
### Virtualize
7972

8073
Enable virtualization with the `virtualize` prop to efficiently handle large datasets. This renders only visible items, dramatically improving performance with thousands of items.
@@ -130,16 +123,10 @@ Use the `lanes` option to create multi-column masonry layouts. This is perfect f
130123
---
131124
name: 'scroll-area-masonry-example'
132125
class: 'p-8'
133-
options:
134-
- name: lanes
135-
label: lanes
136-
default: 3
137-
- name: gap
138-
label: gap
139-
default: 12
140-
- name: padding
141-
label: padding
142-
default: 12
126+
props:
127+
lanes: 3
128+
gap: 12
129+
padding: 12
143130
---
144131
::
145132

@@ -155,23 +142,13 @@ Use the `laneWidth`, `minLanes`, and `maxLanes` options to create responsive mas
155142
---
156143
name: 'scroll-area-responsive-masonry-example'
157144
class: 'p-8'
158-
options:
159-
- name: laneWidth
160-
label: laneWidth
161-
default: 200
162-
- name: minLanes
163-
label: minLanes
164-
default: 1
165-
- name: maxLanes
166-
label: maxLanes
167-
default: 6
145+
props:
146+
laneWidth: 200
147+
minLanes: 1
148+
maxLanes: 6
168149
---
169150
::
170151

171-
::note
172-
The container has `resize: both` applied so you can drag from the bottom-right corner to see the columns adjust automatically as the width changes.
173-
::
174-
175152
### With custom virtualization options
176153

177154
The `virtualize` prop accepts all [TanStack Virtual options](https://tanstack.com/virtual/latest/docs/api/virtualizer), plus additional responsive masonry options (`laneWidth`, `minLanes`, `maxLanes`).

src/runtime/components/ScrollArea.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,17 @@ const virtualizerProps = toRef(() => {
151151
minLanes: 1
152152
})
153153
154+
// Ensure numeric props are actually numbers (they may come in as strings from component props)
155+
const numericProps = ['estimateSize', 'overscan', 'gap', 'paddingStart', 'paddingEnd', 'scrollMargin', 'lanes', 'minLanes', 'maxLanes', 'laneWidth'] as const
156+
for (const key of numericProps) {
157+
if (baseProps[key] !== undefined && typeof baseProps[key] !== 'function') {
158+
const num = Number(baseProps[key])
159+
if (!isNaN(num)) {
160+
baseProps[key] = num
161+
}
162+
}
163+
}
164+
154165
// Use responsive lanes if laneWidth is set
155166
if (baseProps.laneWidth !== undefined) {
156167
baseProps.lanes = calculateResponsiveLanes()

0 commit comments

Comments
 (0)