@stacksjs/components 0.2.870 → 0.2.872
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/dist/{Button-pg8mzsq3.stx → Button-1qmncazg.stx} +12 -5
- package/dist/{FilterChips-mpmev5v5.stx → FilterChips-xg7pgkk2.stx} +6 -1
- package/dist/{Pager-5e7knyqh.stx → Pager-7gn8jygq.stx} +4 -1
- package/dist/{PasswordInput-n2ven456.stx → PasswordInput-z2g5ha65.stx} +16 -6
- package/dist/{TextInput-tyqzz3jy.stx → TextInput-m4a4kpfy.stx} +5 -3
- package/dist/{Tooltip-tt73d42w.stx → Tooltip-wy1nrv9a.stx} +10 -0
- package/dist/index.js +2 -2
- package/dist/ui/button/Button.d.ts +7 -0
- package/dist/ui/input/TextInput.d.ts +3 -1
- package/dist/ui/mobile/FilterChips.d.ts +5 -0
- package/package.json +3 -3
- package/src/ui/button/Button.stx +12 -5
- package/src/ui/input/PasswordInput.stx +16 -6
- package/src/ui/input/TextInput.stx +5 -3
- package/src/ui/mobile/FilterChips.stx +6 -1
- package/src/ui/pager/Pager.stx +4 -1
- package/src/ui/tooltip/Tooltip.stx +10 -0
|
@@ -188,6 +188,13 @@ declare const nativeVariants: {
|
|
|
188
188
|
text: string
|
|
189
189
|
}
|
|
190
190
|
};
|
|
191
|
+
/*
|
|
192
|
+
* Heights are a floor, not a fixed size. A host draws text at the reader's
|
|
193
|
+
* chosen size, where 17pt becomes 48 at the largest accessibility setting,
|
|
194
|
+
* and a button held at 44pt cut its own label off top and bottom. The padding
|
|
195
|
+
* is small enough that the floor still decides the height at the default
|
|
196
|
+
* text size, so nothing moves there.
|
|
197
|
+
*/
|
|
191
198
|
declare const nativeVariant: unknown;
|
|
192
199
|
export declare const nativeButtonClasses: unknown;
|
|
193
200
|
export declare const nativeTextClasses: string;
|
|
@@ -153,7 +153,9 @@ export declare const htmlSize: unknown;
|
|
|
153
153
|
export declare const list: boolean;
|
|
154
154
|
export declare const autofocus: ReturnType<typeof $bool>;
|
|
155
155
|
/*
|
|
156
|
-
* The field a phone app draws, for a native host ($native): 48pt tall
|
|
156
|
+
* The field a phone app draws, for a native host ($native): 48pt tall and
|
|
157
|
+
* taller when the reader's text size needs it (a fixed 48pt cut the words in
|
|
158
|
+
* half at the larger accessibility sizes, where 17pt is drawn at 48), the
|
|
157
159
|
* 17pt body size, a filled rounded box that reads on a grouped background and
|
|
158
160
|
* a plain one alike, and the system's placeholder grey. The web's rings,
|
|
159
161
|
* shadow and density roles have nothing to draw on a device, and its icon
|
|
@@ -21,6 +21,11 @@ export declare const className: unknown;
|
|
|
21
21
|
* screen edges while its first chip still lines up with the title above it —
|
|
22
22
|
* a row that stops at the gutter looks complete when it is not.
|
|
23
23
|
*/
|
|
24
|
+
/*
|
|
25
|
+
* `shrink-0`: a row that scrolls sideways has no height of its own to give
|
|
26
|
+
* up. In a screen taller than the phone (any phone on its side) the column
|
|
27
|
+
* shrank it first, to nothing, and the filters were gone.
|
|
28
|
+
*/
|
|
24
29
|
export declare const rowClasses: unknown;
|
|
25
30
|
declare type __DtsxStxComponentType = DefineComponent<{ chips?: unknown[], className?: string }>;
|
|
26
31
|
export default __dtsx_component__;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/components",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.872",
|
|
5
5
|
"description": "A modern component library built with STX, featuring headwind utility classes and TypeScript syntax highlighting.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -129,8 +129,8 @@
|
|
|
129
129
|
"dependencies": {
|
|
130
130
|
"@iconify-json/f7": "^1.2.2",
|
|
131
131
|
"@stacksjs/ts-css": "^0.3.11",
|
|
132
|
-
"@stacksjs/stx": "0.2.
|
|
133
|
-
"bun-plugin-stx": "0.2.
|
|
132
|
+
"@stacksjs/stx": "0.2.872",
|
|
133
|
+
"bun-plugin-stx": "0.2.872",
|
|
134
134
|
"ts-syntax-highlighter": "^0.2.20",
|
|
135
135
|
"ts-video-player": "^0.1.11"
|
|
136
136
|
},
|
package/src/ui/button/Button.stx
CHANGED
|
@@ -154,12 +154,19 @@ const nativeVariants = {
|
|
|
154
154
|
ghost: { box: '', text: 'text-accent' },
|
|
155
155
|
danger: { box: 'bg-danger-solid', text: 'text-danger-ink' },
|
|
156
156
|
}
|
|
157
|
+
/*
|
|
158
|
+
* Heights are a floor, not a fixed size. A host draws text at the reader's
|
|
159
|
+
* chosen size, where 17pt becomes 48 at the largest accessibility setting,
|
|
160
|
+
* and a button held at 44pt cut its own label off top and bottom. The padding
|
|
161
|
+
* is small enough that the floor still decides the height at the default
|
|
162
|
+
* text size, so nothing moves there.
|
|
163
|
+
*/
|
|
157
164
|
const nativeSizes = {
|
|
158
|
-
xs: { box: 'h-7 px-2.5 gap-1 rounded-[7px]', text: 'text-[13px]' },
|
|
159
|
-
sm: { box: 'h-[34px] px-3 gap-1.5 rounded-[8px]', text: 'text-[15px]' },
|
|
160
|
-
md: { box: 'h-11 px-4 gap-2 rounded-[10px]', text: 'text-[17px]' },
|
|
161
|
-
lg: { box: 'h-[50px] px-5 gap-2 rounded-[12px]', text: 'text-[17px]' },
|
|
162
|
-
xl: { box: 'h-14 px-6 gap-2.5 rounded-[14px]', text: 'text-[19px]' },
|
|
165
|
+
xs: { box: 'min-h-7 py-1 px-2.5 gap-1 rounded-[7px]', text: 'text-[13px]' },
|
|
166
|
+
sm: { box: 'min-h-[34px] py-1.5 px-3 gap-1.5 rounded-[8px]', text: 'text-[15px]' },
|
|
167
|
+
md: { box: 'min-h-11 py-2.5 px-4 gap-2 rounded-[10px]', text: 'text-[17px]' },
|
|
168
|
+
lg: { box: 'min-h-[50px] py-3 px-5 gap-2 rounded-[12px]', text: 'text-[17px]' },
|
|
169
|
+
xl: { box: 'min-h-14 py-3.5 px-6 gap-2.5 rounded-[14px]', text: 'text-[19px]' },
|
|
163
170
|
}
|
|
164
171
|
const nativeVariant = nativeVariants[variant] || nativeVariants.primary
|
|
165
172
|
const nativeSize = nativeSizes[size] || nativeSizes.md
|
|
@@ -100,7 +100,7 @@ export const enterKeyHint = $props.enterKeyHint || $props.enterkeyhint || ''
|
|
|
100
100
|
* autocomplete is the sign-in password, so the platform offers the saved one.
|
|
101
101
|
*/
|
|
102
102
|
export const nativeAutocomplete = autocomplete || 'current-password'
|
|
103
|
-
export const nativeFieldClasses = `h-12 pl-4 pr-11 text-[17px] text-[#000000] dark:text-[#ffffff] bg-[#767680]/12 dark:bg-[#767680]/24 rounded-[10px] border-0 ${error ? 'border border-[#ff3b30] dark:border-[#ff453a]' : ''} ${disabled ? 'opacity-50' : ''} ${inputClassName}`.replace(/\s+/g, ' ').trim()
|
|
103
|
+
export const nativeFieldClasses = `min-h-12 pl-4 pr-11 text-[17px] text-[#000000] dark:text-[#ffffff] bg-[#767680]/12 dark:bg-[#767680]/24 rounded-[10px] border-0 ${error ? 'border border-[#ff3b30] dark:border-[#ff453a]' : ''} ${disabled ? 'opacity-50' : ''} ${inputClassName}`.replace(/\s+/g, ' ').trim()
|
|
104
104
|
export const nativeLabelClasses = 'mb-1.5 px-4 text-[13px] uppercase text-[#6d6d72] dark:text-[#8d8d93]'
|
|
105
105
|
export const nativeHelperClasses = `mt-1.5 px-4 text-[13px] ${error ? 'text-[#ff3b30] dark:text-[#ff453a]' : 'text-[#6d6d72] dark:text-[#8d8d93]'}`
|
|
106
106
|
</script>
|
|
@@ -111,12 +111,19 @@ export const nativeHelperClasses = `mt-1.5 px-4 text-[13px] ${error ? 'text-[#ff
|
|
|
111
111
|
const placeholderText = useReactiveProp('placeholder', {{ placeholder }})
|
|
112
112
|
const emit = defineEmits()
|
|
113
113
|
const showPassword = state(false)
|
|
114
|
-
//
|
|
115
|
-
|
|
114
|
+
// Bound both ways, as TextInput, Textarea and NumberInput are (#2059): a
|
|
115
|
+
// form of shared fields wrote every one back through v-model:value except
|
|
116
|
+
// its password, where the binding compiled and then did nothing.
|
|
117
|
+
const inputValue = useModel('value', { default: {{ value }}, parse: (v) => v == null ? '' : String(v) })
|
|
116
118
|
|
|
117
119
|
function onInput(event) {
|
|
118
|
-
inputValue.
|
|
119
|
-
emit('input', inputValue())
|
|
120
|
+
inputValue.input(event.target.value)
|
|
121
|
+
if (!inputValue.modifiers.lazy) emit('input', inputValue())
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function onChange(event) {
|
|
125
|
+
inputValue.change(event.target.value)
|
|
126
|
+
if (inputValue.modifiers.lazy) emit('input', inputValue())
|
|
120
127
|
}
|
|
121
128
|
|
|
122
129
|
function toggleVisibility() {
|
|
@@ -180,12 +187,13 @@ defineExpose({ value: inputValue })
|
|
|
180
187
|
@if(readonly)readonly@endif
|
|
181
188
|
@if(required)required@endif
|
|
182
189
|
@input="onInput($event)"
|
|
190
|
+
@change="onChange($event)"
|
|
183
191
|
aria-invalid="{{ error ? 'true' : 'false' }}"
|
|
184
192
|
/>
|
|
185
193
|
<button
|
|
186
194
|
type="button"
|
|
187
195
|
@click="toggleVisibility()"
|
|
188
|
-
class="absolute top-0
|
|
196
|
+
class="absolute top-0 bottom-0 right-0 w-11 items-center justify-center"
|
|
189
197
|
:aria-label="toggleAriaLabel()"
|
|
190
198
|
>
|
|
191
199
|
<i :show="showPassword()" class="i-lucide-eye-off h-5 w-5 text-[#8e8e93]"></i>
|
|
@@ -236,6 +244,7 @@ defineExpose({ value: inputValue })
|
|
|
236
244
|
@if(readonly)readonly@endif
|
|
237
245
|
@if(required)required@endif
|
|
238
246
|
@input="onInput($event)"
|
|
247
|
+
@change="onChange($event)"
|
|
239
248
|
:aria-invalid="{{ error ? 'true' : 'false' }}"
|
|
240
249
|
@if(helperText)aria-describedby="{{ helperId }}"@endif
|
|
241
250
|
/>
|
|
@@ -309,6 +318,7 @@ defineExpose({ value: inputValue })
|
|
|
309
318
|
@if(readonly)readonly@endif
|
|
310
319
|
@if(required)required@endif
|
|
311
320
|
@input="onInput($event)"
|
|
321
|
+
@change="onChange($event)"
|
|
312
322
|
:aria-invalid="{{ error ? 'true' : 'false' }}"
|
|
313
323
|
@if(helperText)aria-describedby="{{ helperId }}"@endif
|
|
314
324
|
/>
|
|
@@ -156,14 +156,16 @@ export const list = type !== 'password' && given($props.list) ? String($props.li
|
|
|
156
156
|
export const autofocus = $bool($props.autofocus)
|
|
157
157
|
|
|
158
158
|
/*
|
|
159
|
-
* The field a phone app draws, for a native host ($native): 48pt tall
|
|
159
|
+
* The field a phone app draws, for a native host ($native): 48pt tall and
|
|
160
|
+
* taller when the reader's text size needs it (a fixed 48pt cut the words in
|
|
161
|
+
* half at the larger accessibility sizes, where 17pt is drawn at 48), the
|
|
160
162
|
* 17pt body size, a filled rounded box that reads on a grouped background and
|
|
161
163
|
* a plain one alike, and the system's placeholder grey. The web's rings,
|
|
162
164
|
* shadow and density roles have nothing to draw on a device, and its icon
|
|
163
165
|
* slot is a web flourish iOS fields do without. An invalid field gets the
|
|
164
166
|
* system red outline, a disabled one dims as UIKit's do.
|
|
165
167
|
*/
|
|
166
|
-
export const nativeFieldClasses = `h-12 px-4 text-[17px] text-[#000000] dark:text-[#ffffff] bg-[#767680]/12 dark:bg-[#767680]/24 rounded-[10px] border-0 ${inputClassName}`.trim()
|
|
168
|
+
export const nativeFieldClasses = `min-h-12 px-4 text-[17px] text-[#000000] dark:text-[#ffffff] bg-[#767680]/12 dark:bg-[#767680]/24 rounded-[10px] border-0 ${inputClassName}`.trim()
|
|
167
169
|
export const nativeLabelClasses = 'mb-1.5 px-4 text-[13px] uppercase text-[#6d6d72] dark:text-[#8d8d93]'
|
|
168
170
|
export const nativeHelperClasses = `mt-1.5 px-4 text-[13px] ${error ? 'text-[#ff3b30] dark:text-[#ff453a]' : 'text-[#6d6d72] dark:text-[#8d8d93]'}`
|
|
169
171
|
</script>
|
|
@@ -319,7 +321,7 @@ defineExpose({ value: inputValue, clear: onClear })
|
|
|
319
321
|
|
|
320
322
|
@if(clearable)
|
|
321
323
|
<button :if="!nativeClear" type="button" :show="hasValue() && !isDisabled() && !isReadonly()"
|
|
322
|
-
@click="onClear()" class="absolute top-0
|
|
324
|
+
@click="onClear()" class="absolute top-0 bottom-0 right-0 w-10 items-center justify-center" aria-label="Clear input"
|
|
323
325
|
><i class="i-lucide-circle-x h-[17px] w-[17px] text-[#c4c4c7] dark:text-[#5b5b5f]"></i></button>
|
|
324
326
|
@endif
|
|
325
327
|
</div>
|
|
@@ -21,8 +21,13 @@ export const className = $props.className || ''
|
|
|
21
21
|
* screen edges while its first chip still lines up with the title above it —
|
|
22
22
|
* a row that stops at the gutter looks complete when it is not.
|
|
23
23
|
*/
|
|
24
|
+
/*
|
|
25
|
+
* `shrink-0`: a row that scrolls sideways has no height of its own to give
|
|
26
|
+
* up. In a screen taller than the phone (any phone on its side) the column
|
|
27
|
+
* shrank it first, to nothing, and the filters were gone.
|
|
28
|
+
*/
|
|
24
29
|
export const rowClasses = `
|
|
25
|
-
-mx-4 flex gap-2 overflow-x-auto px-4 pb-1
|
|
30
|
+
-mx-4 flex shrink-0 gap-2 overflow-x-auto px-4 pb-1
|
|
26
31
|
[scrollbar-width:none] [&::-webkit-scrollbar]:hidden
|
|
27
32
|
${className}
|
|
28
33
|
`.replace(/\s+/g, ' ').trim()
|
package/src/ui/pager/Pager.stx
CHANGED
|
@@ -216,7 +216,10 @@ defineExpose({ selected, count, go, next, prev })
|
|
|
216
216
|
|
|
217
217
|
<section class="{{ rootClasses }}" aria-roledescription="carousel" @if(label)aria-label="{{ label }}"@endif @keydown="onKey($event)">
|
|
218
218
|
@if(nativeHost)
|
|
219
|
-
|
|
219
|
+
{{-- A host's scroller is where a pager's name goes: it announces the
|
|
220
|
+
name on the way in and leaves the pages inside reachable, which the
|
|
221
|
+
box around it cannot do (a named box is a single stop). --}}
|
|
222
|
+
<div data-native="ScrollView" @if(label)aria-label="{{ label }}"@endif horizontal pagingEnabled :pageIndex="selected()" :scrollEnabled="allowSwipe" showsHorizontalScrollIndicator="false" showsVerticalScrollIndicator="false" class="flex-1 min-h-0" @page-selected="onNativePage($event)">
|
|
220
223
|
<slot />
|
|
221
224
|
</div>
|
|
222
225
|
@else
|
|
@@ -222,6 +222,15 @@ function describeTrigger() {
|
|
|
222
222
|
target.setAttribute('aria-describedby', existing.join(' '))
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
+
/*
|
|
226
|
+
* A host has no `aria-describedby`. What it has is a hint: the sentence a
|
|
227
|
+
* screen reader adds after a control's name. Without it the words of a
|
|
228
|
+
* tooltip reached nobody who could not see them appear, since a reader has no
|
|
229
|
+
* reason to tap a button twice to find out what it is for. The hint is bound
|
|
230
|
+
* on the wrapper, which is the stop a reader makes: it is what takes the press.
|
|
231
|
+
*/
|
|
232
|
+
const nativeHint = derived(() => isDisabled() ? null : (String(tooltipContent() ?? '').trim() || null))
|
|
233
|
+
|
|
225
234
|
let restorePanel = null
|
|
226
235
|
onMount(() => {
|
|
227
236
|
describeTrigger()
|
|
@@ -243,6 +252,7 @@ onDestroy(() => { if (restorePanel) restorePanel() })
|
|
|
243
252
|
itself (stacksjs/stx#2048). --}}
|
|
244
253
|
<span
|
|
245
254
|
data-native="Pressable"
|
|
255
|
+
@if($native):accessibilityHint="nativeHint()"@endif
|
|
246
256
|
x-ref="triggerRef"
|
|
247
257
|
@click="toggleTouch($event)"
|
|
248
258
|
@mouseenter="showTooltip()"
|