@stacksjs/components 0.2.979 → 0.2.982
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/{DateTimePicker-d5984mm1.stx → DateTimePicker-7zk8tc4s.stx} +30 -23
- package/dist/{DialogPanel-v972ztcc.stx → DialogPanel-aav3werz.stx} +1 -1
- package/dist/{Drawer-18xpj1je.stx → Drawer-f6hwnwmg.stx} +1 -1
- package/dist/index.js +2 -2
- package/dist/ui/date-time-picker/DateTimePicker.d.ts +3 -0
- package/dist/ui/date-time-picker/date-time-picker-text.d.ts +67 -0
- package/dist/ui/dialog/index.d.ts +2 -2
- package/dist/ui/drawer/index.d.ts +2 -2
- package/package.json +3 -3
- package/src/ui/date-time-picker/DateTimePicker.stx +30 -23
- package/src/ui/date-time-picker/date-time-picker-text.ts +47 -0
- package/src/ui/dialog/DialogPanel.stx +1 -1
- package/src/ui/dialog/index.ts +2 -2
- package/src/ui/drawer/Drawer.stx +1 -1
- package/src/ui/drawer/index.ts +2 -2
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { dateTimePickerText } from './date-time-picker-text';
|
|
2
|
+
import { dateTimePickerText } from './date-time-picker-text';
|
|
1
3
|
import type { DefineComponent } from '@stacksjs/stx';
|
|
2
4
|
declare function close(restoreFocus?: boolean): undefined;
|
|
3
5
|
declare function open(): undefined;
|
|
@@ -14,6 +16,7 @@ declare const step: unknown;
|
|
|
14
16
|
export declare const minuteStep: boolean;
|
|
15
17
|
export declare const placeholder: unknown;
|
|
16
18
|
export declare const label: unknown;
|
|
19
|
+
export declare const initialText: ReturnType<typeof dateTimePickerText>;
|
|
17
20
|
export declare const triggerLabel: unknown;
|
|
18
21
|
export declare const triggerPlaceholder: unknown;
|
|
19
22
|
export declare const instanceId: unknown;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export declare function dateTimePickerText(locale: string): typeof english;
|
|
2
|
+
/**
|
|
3
|
+
* @defaultValue
|
|
4
|
+
* ```ts
|
|
5
|
+
* {
|
|
6
|
+
* label: 'Schedule',
|
|
7
|
+
* placeholder: 'Choose date and time',
|
|
8
|
+
* timezone: 'Timezone:',
|
|
9
|
+
* time: 'Time',
|
|
10
|
+
* hour: 'In an hour',
|
|
11
|
+
* tomorrow: 'Tomorrow morning',
|
|
12
|
+
* suggested: 'Next best time',
|
|
13
|
+
* clear: 'Clear',
|
|
14
|
+
* cancel: 'Cancel',
|
|
15
|
+
* apply: 'Apply',
|
|
16
|
+
* previousMonth: 'Previous month',
|
|
17
|
+
* nextMonth: 'Next month',
|
|
18
|
+
* invalidTime: 'Choose a valid date and time. This clock time may not exist in the selected timezone.',
|
|
19
|
+
* invalidMinimum: 'The earliest allowed time is invalid.',
|
|
20
|
+
* invalidMaximum: 'The latest allowed time is invalid.',
|
|
21
|
+
* beforeMinimum: 'Choose a time at or after the earliest allowed time.',
|
|
22
|
+
* afterMaximum: 'Choose a time at or before the latest allowed time.',
|
|
23
|
+
* invalidTimezone: 'Choose a valid workspace timezone.',
|
|
24
|
+
* minuteIncrement: 'Choose a time matching the minute increment.'
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
declare const english: {
|
|
29
|
+
/** @defaultValue 'Schedule' */
|
|
30
|
+
label: string;
|
|
31
|
+
/** @defaultValue 'Choose date and time' */
|
|
32
|
+
placeholder: string;
|
|
33
|
+
/** @defaultValue 'Timezone:' */
|
|
34
|
+
timezone: string;
|
|
35
|
+
/** @defaultValue 'Time' */
|
|
36
|
+
time: string;
|
|
37
|
+
/** @defaultValue 'In an hour' */
|
|
38
|
+
hour: string;
|
|
39
|
+
/** @defaultValue 'Tomorrow morning' */
|
|
40
|
+
tomorrow: string;
|
|
41
|
+
/** @defaultValue 'Next best time' */
|
|
42
|
+
suggested: string;
|
|
43
|
+
/** @defaultValue 'Clear' */
|
|
44
|
+
clear: string;
|
|
45
|
+
/** @defaultValue 'Cancel' */
|
|
46
|
+
cancel: string;
|
|
47
|
+
/** @defaultValue 'Apply' */
|
|
48
|
+
apply: string;
|
|
49
|
+
/** @defaultValue 'Previous month' */
|
|
50
|
+
previousMonth: string;
|
|
51
|
+
/** @defaultValue 'Next month' */
|
|
52
|
+
nextMonth: string;
|
|
53
|
+
/** @defaultValue 'Choose a valid date and time. This clock time may not exist in the selected timezone.' */
|
|
54
|
+
invalidTime: string;
|
|
55
|
+
/** @defaultValue 'The earliest allowed time is invalid.' */
|
|
56
|
+
invalidMinimum: string;
|
|
57
|
+
/** @defaultValue 'The latest allowed time is invalid.' */
|
|
58
|
+
invalidMaximum: string;
|
|
59
|
+
/** @defaultValue 'Choose a time at or after the earliest allowed time.' */
|
|
60
|
+
beforeMinimum: string;
|
|
61
|
+
/** @defaultValue 'Choose a time at or before the latest allowed time.' */
|
|
62
|
+
afterMaximum: string;
|
|
63
|
+
/** @defaultValue 'Choose a valid workspace timezone.' */
|
|
64
|
+
invalidTimezone: string;
|
|
65
|
+
/** @defaultValue 'Choose a time matching the minute increment.' */
|
|
66
|
+
minuteIncrement: string
|
|
67
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare interface DialogProps {
|
|
2
|
-
sheetDetents?: Array<'medium' | 'large'>
|
|
3
|
-
selectedDetent?: 'medium' | 'large'
|
|
2
|
+
sheetDetents?: Array<'fit' | 'medium' | 'large'>
|
|
3
|
+
selectedDetent?: 'fit' | 'medium' | 'large'
|
|
4
4
|
open?: boolean
|
|
5
5
|
onClose?: (value: boolean) => void
|
|
6
6
|
className?: string
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare interface DrawerProps {
|
|
2
|
-
sheetDetents?: Array<'medium' | 'large'>
|
|
3
|
-
selectedDetent?: 'medium' | 'large'
|
|
2
|
+
sheetDetents?: Array<'fit' | 'medium' | 'large'>
|
|
3
|
+
selectedDetent?: 'fit' | 'medium' | 'large'
|
|
4
4
|
open?: boolean
|
|
5
5
|
onClose?: () => void
|
|
6
6
|
position?: 'right' | 'left' | 'top' | 'bottom'
|
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.982",
|
|
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",
|
|
@@ -144,8 +144,8 @@
|
|
|
144
144
|
"dependencies": {
|
|
145
145
|
"@iconify-json/f7": "^1.2.2",
|
|
146
146
|
"@stacksjs/ts-css": "^0.3.11",
|
|
147
|
-
"@stacksjs/stx": "0.2.
|
|
148
|
-
"bun-plugin-stx": "0.2.
|
|
147
|
+
"@stacksjs/stx": "0.2.982",
|
|
148
|
+
"bun-plugin-stx": "0.2.982",
|
|
149
149
|
"ts-syntax-highlighter": "^0.2.20",
|
|
150
150
|
"ts-video-player": "^0.1.11"
|
|
151
151
|
},
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script server>
|
|
2
|
+
import { dateTimePickerText } from './date-time-picker-text'
|
|
3
|
+
|
|
2
4
|
export const value = $props.value || null
|
|
3
5
|
export const timeZone = $props.timeZone || 'UTC'
|
|
4
6
|
export const locale = $props.locale || 'en-US'
|
|
@@ -9,10 +11,11 @@ export const disabled = $bool($props.disabled)
|
|
|
9
11
|
export const clearable = $bool($props.clearable, true)
|
|
10
12
|
const step = $num($props.minuteStep, 1)
|
|
11
13
|
export const minuteStep = Number.isInteger(step) && step > 0 && 60 % step === 0 ? step : 1
|
|
12
|
-
export const placeholder = $props.placeholder || '
|
|
13
|
-
export const label = $props.label || '
|
|
14
|
-
export const
|
|
15
|
-
export const
|
|
14
|
+
export const placeholder = $props.placeholder || ''
|
|
15
|
+
export const label = $props.label || ''
|
|
16
|
+
export const initialText = dateTimePickerText(locale)
|
|
17
|
+
export const triggerLabel = label || initialText.label
|
|
18
|
+
export const triggerPlaceholder = placeholder || initialText.placeholder
|
|
16
19
|
export const instanceId = $uid
|
|
17
20
|
export const rootClasses = `relative inline-block ${$props.className || ''}`.trim()
|
|
18
21
|
export const triggerClasses = 'inline-flex items-center gap-2 rounded-control bg-field px-3 py-2 text-sm text-fg ring-1 ring-inset ring-line-strong hover:bg-field-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50'
|
|
@@ -21,10 +24,11 @@ export const panelClasses = 'absolute left-0 z-30 w-96 max-w-[calc(100vw-2rem)]
|
|
|
21
24
|
|
|
22
25
|
<script client>
|
|
23
26
|
import { measureTooltipPosition, trackBrowserPopup, trackNativePopup } from '../../utils/tooltip-position'
|
|
27
|
+
import { dateTimePickerText } from './date-time-picker-text'
|
|
24
28
|
import { dateTimeFields, dateTimeInstant, dateTimePreset, dateTimeToIso, formatDateTime, validTimeZone } from './date-time'
|
|
25
29
|
const emit = defineEmits()
|
|
26
30
|
const instanceId = {{ instanceId }}
|
|
27
|
-
const
|
|
31
|
+
const customLabel = useReactiveProp('label', {{ label }})
|
|
28
32
|
const rootRef = useRef('dateTimeRoot')
|
|
29
33
|
const triggerRef = useRef('dateTimeTrigger')
|
|
30
34
|
const value = useReactiveProp('value', {{ value }}, { parse: value => value })
|
|
@@ -35,7 +39,10 @@ const maximum = useReactiveProp('maxDate', {{ maxDate }}, { parse: value => valu
|
|
|
35
39
|
const suggested = useReactiveProp('suggestedTime', {{ suggestedTime }}, { parse: value => value })
|
|
36
40
|
const disabled = useReactiveProp('disabled', {{ disabled }})
|
|
37
41
|
const clearable = useReactiveProp('clearable', {{ clearable }})
|
|
38
|
-
const
|
|
42
|
+
const customPlaceholder = useReactiveProp('placeholder', {{ placeholder }})
|
|
43
|
+
const text = derived(() => dateTimePickerText(locale()))
|
|
44
|
+
const label = derived(() => customLabel() || text().label)
|
|
45
|
+
const placeholder = derived(() => customPlaceholder() || text().placeholder)
|
|
39
46
|
const minuteStep = useReactiveProp('minuteStep', {{ minuteStep }}, { parse: value => {
|
|
40
47
|
const n = Number(value)
|
|
41
48
|
return Number.isInteger(n) && n > 0 && 60 % n === 0 ? n : 1
|
|
@@ -94,20 +101,20 @@ const candidate = derived(() => {
|
|
|
94
101
|
return dateTimeToIso(date, time, zone)
|
|
95
102
|
})
|
|
96
103
|
function boundsError(iso) {
|
|
97
|
-
if (!iso) return
|
|
104
|
+
if (!iso) return text().invalidTime
|
|
98
105
|
const minValue = minimum()
|
|
99
106
|
const maxValue = maximum()
|
|
100
107
|
const min = dateTimeInstant(minValue)
|
|
101
108
|
const max = dateTimeInstant(maxValue)
|
|
102
|
-
if (minValue && !min) return
|
|
103
|
-
if (maxValue && !max) return
|
|
104
|
-
if (min && Date.parse(iso) < Date.parse(min)) return
|
|
105
|
-
if (max && Date.parse(iso) > Date.parse(max)) return
|
|
109
|
+
if (minValue && !min) return text().invalidMinimum
|
|
110
|
+
if (maxValue && !max) return text().invalidMaximum
|
|
111
|
+
if (min && Date.parse(iso) < Date.parse(min)) return text().beforeMinimum
|
|
112
|
+
if (max && Date.parse(iso) > Date.parse(max)) return text().afterMaximum
|
|
106
113
|
return ''
|
|
107
114
|
}
|
|
108
115
|
const error = derived(() => {
|
|
109
|
-
if (!validTimeZone(timeZone())) return
|
|
110
|
-
if (Number(draftTime().slice(3, 5)) % minuteStep() !== 0) return
|
|
116
|
+
if (!validTimeZone(timeZone())) return text().invalidTimezone
|
|
117
|
+
if (Number(draftTime().slice(3, 5)) % minuteStep() !== 0) return text().minuteIncrement
|
|
111
118
|
return boundsError(candidate())
|
|
112
119
|
})
|
|
113
120
|
|
|
@@ -215,21 +222,21 @@ defineExpose({ open, close })
|
|
|
215
222
|
<span :text="displayValue">{{ triggerPlaceholder }}</span>
|
|
216
223
|
</button>
|
|
217
224
|
<div :if="isOpen" class="{{ panelClasses }}" role="dialog" data-native="Modal" visible="false" hidden :hidden="!isOpen()" :id="panelId" :aria-labelledby="titleId" :aria-describedby="zoneId" data-date-time-panel>
|
|
218
|
-
<h3 class="mb-2 text-sm font-semibold text-fg" :id="titleId" x-text="label">{{
|
|
219
|
-
<p class="mb-3 text-xs text-fg-muted" :id="zoneId">
|
|
225
|
+
<h3 class="mb-2 text-sm font-semibold text-fg" :id="titleId" x-text="label">{{ triggerLabel }}</h3>
|
|
226
|
+
<p class="mb-3 text-xs text-fg-muted" :id="zoneId"><span :text="text().timezone">{{ initialText.timezone }}</span> <span x-text="timeZone"></span></p>
|
|
220
227
|
<div class="mb-3 flex flex-wrap gap-2">
|
|
221
|
-
<button type="button" class="rounded-control bg-surface px-2 py-1 text-xs text-fg hover:bg-surface-hover" data-date-time-preset="hour" :disabled="presetDisabled('hour')" @click="choosePreset('hour')">
|
|
222
|
-
<button type="button" class="rounded-control bg-surface px-2 py-1 text-xs text-fg hover:bg-surface-hover" data-date-time-preset="tomorrow" :disabled="presetDisabled('tomorrow')" @click="choosePreset('tomorrow')">
|
|
223
|
-
<button :if="suggestion" type="button" class="rounded-control bg-surface px-2 py-1 text-xs text-fg hover:bg-surface-hover" data-date-time-preset="suggested" :disabled="presetDisabled('suggested')" @click="choosePreset('suggested')">
|
|
228
|
+
<button type="button" class="rounded-control bg-surface px-2 py-1 text-xs text-fg hover:bg-surface-hover" data-date-time-preset="hour" :disabled="presetDisabled('hour')" @click="choosePreset('hour')" :text="text().hour">{{ initialText.hour }}</button>
|
|
229
|
+
<button type="button" class="rounded-control bg-surface px-2 py-1 text-xs text-fg hover:bg-surface-hover" data-date-time-preset="tomorrow" :disabled="presetDisabled('tomorrow')" @click="choosePreset('tomorrow')" :text="text().tomorrow">{{ initialText.tomorrow }}</button>
|
|
230
|
+
<button :if="suggestion" type="button" class="rounded-control bg-surface px-2 py-1 text-xs text-fg hover:bg-surface-hover" data-date-time-preset="suggested" :disabled="presetDisabled('suggested')" @click="choosePreset('suggested')" :text="text().suggested">{{ initialText.suggested }}</button>
|
|
224
231
|
</div>
|
|
225
|
-
<Calendar :value="calendarValue()" :minDate="calendarMin()" :maxDate="calendarMax()" :locale="locale" @change.stop="onCalendarChange" className="max-w-none p-0 shadow-none" />
|
|
226
|
-
<label class="mt-3 block text-xs font-medium text-fg" :for="timeId">
|
|
232
|
+
<Calendar :value="calendarValue()" :minDate="calendarMin()" :maxDate="calendarMax()" :locale="locale" previousMonthLabel="{{ initialText.previousMonth }}" nextMonthLabel="{{ initialText.nextMonth }}" :previousMonthLabel="text().previousMonth" :nextMonthLabel="text().nextMonth" @change.stop="onCalendarChange" className="max-w-none p-0 shadow-none" />
|
|
233
|
+
<label class="mt-3 block text-xs font-medium text-fg" :for="timeId" :text="text().time">{{ initialText.time }}</label>
|
|
227
234
|
<input type="time" class="mt-1 w-full rounded-control bg-field px-3 py-2 text-sm text-fg ring-1 ring-line-strong focus:ring-2 focus:ring-accent" :id="timeId" data-date-time-clock x-model="draftTime" :step="minuteStep() * 60" :aria-invalid="error() ? 'true' : null" :aria-describedby="error() ? errorId : zoneId" @keydown.enter.prevent="apply()" />
|
|
228
235
|
<p class="mt-2 text-xs text-danger-fg" :id="errorId" role="status" aria-live="polite" x-text="error"></p>
|
|
229
236
|
<div class="mt-3 flex justify-end gap-2">
|
|
230
|
-
<button :if="clearable" type="button" class="mr-auto rounded-control px-3 py-2 text-sm text-fg-muted hover:bg-surface-hover" data-date-time-clear @click="clear()">
|
|
231
|
-
<button type="button" class="rounded-control px-3 py-2 text-sm text-fg hover:bg-surface-hover" data-date-time-cancel @click="close()">
|
|
232
|
-
<button type="button" class="rounded-control bg-accent-solid px-3 py-2 text-sm text-accent-ink disabled:opacity-50" :disabled="!!error()" data-date-time-apply @click="apply()">
|
|
237
|
+
<button :if="clearable" type="button" class="mr-auto rounded-control px-3 py-2 text-sm text-fg-muted hover:bg-surface-hover" data-date-time-clear @click="clear()" :text="text().clear">{{ initialText.clear }}</button>
|
|
238
|
+
<button type="button" class="rounded-control px-3 py-2 text-sm text-fg hover:bg-surface-hover" data-date-time-cancel @click="close()" :text="text().cancel">{{ initialText.cancel }}</button>
|
|
239
|
+
<button type="button" class="rounded-control bg-accent-solid px-3 py-2 text-sm text-accent-ink disabled:opacity-50" :disabled="!!error()" data-date-time-apply @click="apply()" :text="text().apply">{{ initialText.apply }}</button>
|
|
233
240
|
</div>
|
|
234
241
|
</div>
|
|
235
242
|
</div>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const english = {
|
|
2
|
+
label: 'Schedule',
|
|
3
|
+
placeholder: 'Choose date and time',
|
|
4
|
+
timezone: 'Timezone:',
|
|
5
|
+
time: 'Time',
|
|
6
|
+
hour: 'In an hour',
|
|
7
|
+
tomorrow: 'Tomorrow morning',
|
|
8
|
+
suggested: 'Next best time',
|
|
9
|
+
clear: 'Clear',
|
|
10
|
+
cancel: 'Cancel',
|
|
11
|
+
apply: 'Apply',
|
|
12
|
+
previousMonth: 'Previous month',
|
|
13
|
+
nextMonth: 'Next month',
|
|
14
|
+
invalidTime: 'Choose a valid date and time. This clock time may not exist in the selected timezone.',
|
|
15
|
+
invalidMinimum: 'The earliest allowed time is invalid.',
|
|
16
|
+
invalidMaximum: 'The latest allowed time is invalid.',
|
|
17
|
+
beforeMinimum: 'Choose a time at or after the earliest allowed time.',
|
|
18
|
+
afterMaximum: 'Choose a time at or before the latest allowed time.',
|
|
19
|
+
invalidTimezone: 'Choose a valid workspace timezone.',
|
|
20
|
+
minuteIncrement: 'Choose a time matching the minute increment.',
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const spanish: typeof english = {
|
|
24
|
+
label: 'Programar',
|
|
25
|
+
placeholder: 'Elige la fecha y la hora',
|
|
26
|
+
timezone: 'Zona horaria:',
|
|
27
|
+
time: 'Hora',
|
|
28
|
+
hour: 'En una hora',
|
|
29
|
+
tomorrow: 'Mañana por la mañana',
|
|
30
|
+
suggested: 'Próximo mejor horario',
|
|
31
|
+
clear: 'Borrar',
|
|
32
|
+
cancel: 'Cancelar',
|
|
33
|
+
apply: 'Aplicar',
|
|
34
|
+
previousMonth: 'Mes anterior',
|
|
35
|
+
nextMonth: 'Mes siguiente',
|
|
36
|
+
invalidTime: 'Elige una fecha y una hora válidas. Esa hora puede no existir en la zona horaria seleccionada.',
|
|
37
|
+
invalidMinimum: 'La hora mínima permitida no es válida.',
|
|
38
|
+
invalidMaximum: 'La hora máxima permitida no es válida.',
|
|
39
|
+
beforeMinimum: 'Elige una hora igual o posterior a la mínima permitida.',
|
|
40
|
+
afterMaximum: 'Elige una hora igual o anterior a la máxima permitida.',
|
|
41
|
+
invalidTimezone: 'Elige una zona horaria válida.',
|
|
42
|
+
minuteIncrement: 'Elige una hora que respete el intervalo de minutos.',
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function dateTimePickerText(locale: string): typeof english {
|
|
46
|
+
return /^es(?:-|$)/i.test(locale) ? spanish : english
|
|
47
|
+
}
|
|
@@ -51,7 +51,7 @@ export const nativeGrabberClasses = `self-center h-[5px] w-9 shrink-0 rounded-fu
|
|
|
51
51
|
</script>
|
|
52
52
|
|
|
53
53
|
<script client>
|
|
54
|
-
const systemSheet = typeof craft !== 'undefined' && craft.platform
|
|
54
|
+
const systemSheet = typeof craft !== 'undefined' && ['ios', 'android'].includes(craft.platform) && craft.capabilities.nativePlatformControls === true
|
|
55
55
|
</script>
|
|
56
56
|
|
|
57
57
|
@if($native)
|
package/src/ui/dialog/index.ts
CHANGED
|
@@ -6,8 +6,8 @@ export { default as DialogTitle } from './DialogTitle.stx'
|
|
|
6
6
|
|
|
7
7
|
export interface DialogProps {
|
|
8
8
|
/** Native sheet resting sizes; the website retains its existing layout. */
|
|
9
|
-
sheetDetents?: Array<'medium' | 'large'>
|
|
10
|
-
selectedDetent?: 'medium' | 'large'
|
|
9
|
+
sheetDetents?: Array<'fit' | 'medium' | 'large'>
|
|
10
|
+
selectedDetent?: 'fit' | 'medium' | 'large'
|
|
11
11
|
open?: boolean
|
|
12
12
|
onClose?: (value: boolean) => void
|
|
13
13
|
className?: string
|
package/src/ui/drawer/Drawer.stx
CHANGED
|
@@ -130,7 +130,7 @@ export const drawerInstanceId = $uid
|
|
|
130
130
|
// A nested overlay's close belongs to that overlay, never this drawer.
|
|
131
131
|
const emit = defineEmits(['close'])
|
|
132
132
|
const drawerInstanceId = {{ drawerInstanceId }}
|
|
133
|
-
const systemSheet = typeof craft !== 'undefined' && craft.platform
|
|
133
|
+
const systemSheet = typeof craft !== 'undefined' && ['ios', 'android'].includes(craft.platform) && craft.capabilities.nativePlatformControls === true
|
|
134
134
|
// useReactiveProp lets the parent drive `open` via signals
|
|
135
135
|
// (`:open="drawerOpen()"`) instead of the prop being captured once.
|
|
136
136
|
// See stacksjs/stx#1704.
|
package/src/ui/drawer/index.ts
CHANGED
|
@@ -2,8 +2,8 @@ export { default as Drawer } from './Drawer.stx'
|
|
|
2
2
|
|
|
3
3
|
export interface DrawerProps {
|
|
4
4
|
/** Native sheet resting sizes; the website retains its existing layout. */
|
|
5
|
-
sheetDetents?: Array<'medium' | 'large'>
|
|
6
|
-
selectedDetent?: 'medium' | 'large'
|
|
5
|
+
sheetDetents?: Array<'fit' | 'medium' | 'large'>
|
|
6
|
+
selectedDetent?: 'fit' | 'medium' | 'large'
|
|
7
7
|
open?: boolean
|
|
8
8
|
onClose?: () => void
|
|
9
9
|
position?: 'right' | 'left' | 'top' | 'bottom'
|