@eldrajs/ui 0.3.4 → 0.3.6

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/CHANGELOG.md CHANGED
@@ -46,6 +46,8 @@ Release-please writes the generated notes from commit messages and does not repl
46
46
  - **`NavMenu`** — the header navigation: top-level links, and buttons opening a `dropdown` panel or a `mega` panel of columns (entries with `description`, `badge`, `current`, `newTab`). Disclosure pattern: `Enter`/`Space` open, `Tab` walks through, `Escape` closes and returns focus, an outside click or focus leaving closes, one panel at a time; plus the APG arrow keys (`←`/`→`/`Home`/`End` along the bar, `↓`/`↑` into and through a panel, never wrapping). Optional `openOnHover`, opening after a 150ms rest and closing 150ms after the pointer leaves; a closing panel fades out. Below `collapseBelow` (default `lg`; also `md`, `xl`, the container breakpoints `@tablet`/`@content`/`@wide`, `never` and `always`) it becomes a menu button and a left `Drawer` with accordion rows. Takes a resolved Studio link tree as it is. `variant`: `ghost` (default; text colour with a fill on hover and while open) or `muted` (muted text turning the text colour on hover, while open and on the current page, no fill), for the bar and its panels alike. `linkAs`, `classes`, slots `panelItem`/`groupHeading`/`panelFooter`/`toggle`/`drawerFooter`, `v-model` (open panel) and `v-model:drawerOpen`, exposed `close()`. New messages `navMenuLabel`, `navMenuOpen`, `navMenuDrawer`, `navMenuOverview`; new CSS variables `--eldra-nav-menu-offset`, `--eldra-nav-menu-dropdown-min`/`-max`, `--eldra-nav-menu-column-min`.
47
47
  - **`NavMenu`'s phone menu**: `drawerLayout` (`accordion`, the default, or `sections`, each panel listed open under its label, the new `drawerSectionHeading` part naming its list, group headings kept where a panel has them); `drawerItems`, the drawer's own entries when they differ from the bar's (a mega panel's area pages, a bar panel's footer links as rows); the `drawerHeader` slot (`{ close }`) for a logo and a call to action in the drawer's header row; the `triggerIcon` slot (`{ item, open }`) replacing the panel buttons' chevron, still turned over while open; `placement` (`bar` or `drawer`) in the `panelItem` and `groupHeading` slot props; new parts `drawerRoot`, `drawerHeader`, `drawerClose`, `drawerBody`, `drawerSectionHeading`. New types `NavMenuDrawerLayout`, `NavMenuPlacement`, `NavMenuPanelPart`, `NavMenuDrawerPanelPart`, `NavMenuPanelItemSlotProps`, `NavMenuGroupHeadingSlotProps`.
48
48
  - **`Drawer`'s `header` slot**: content for the header row, after the title and before the close button.
49
+ - **`Drawer` swipes closed** (`swipe`, default `true`): a side drawer follows a drag toward its edge after `--eldra-drawer-swipe-threshold` (default `24px`), by the header with a mouse or pen and from anywhere with a finger, and closes past 35% or on a flick, else springs back; the backdrop fades with the drag. `close` fires with the new reason `"swipe"`.
50
+ - **`Drawer`'s `mobileSheet`** (default `false`): below a 48rem viewport, a bottom sheet of its content's height (up to `--eldra-drawer-sheet-gap`, default `3rem`, from the top) with rounded top corners (`--eldra-drawer-sheet-radius`) and a grab handle (new `handle` part, `--eldra-drawer-handle-color`), dragged down by the handle, the header, or the body once it is scrolled to the top.
49
51
  - **`@eldrajs/ui/components.css`** — `style.css` without Tailwind's preflight, whose reset reached every element on the page (rich-text headings, lists, links and paragraphs lost their browser defaults). Same theme and utilities; the reset only touches elements inside a component: every component's outermost element, and every panel, bubble or toast region it teleports, now carries the public `data-eldra-ui` marker, and the reset reaches those and the `data-part` elements within them, so a site's own `data-part` elements (Ark UI and Zag included) keep their defaults. `Rating`'s stars, `FilterPanel`'s colour ring, `SearchBar`'s no-results text and `SearchModal`'s key hints no longer lean on the global reset, so they draw the same under either stylesheet.
50
52
  - **`zoomSizes(sizes, zoom)`** — multiplies every length in an `<img sizes>` list by `zoom`, keeping its media conditions (`(min-width: 1024px) 50vw, 100vw` at zoom 3 is `(min-width: 1024px) calc(50vw * 3), calc(100vw * 3)`); a zoom of 1 or less, `auto` and a size-less condition are left as given. What `Image` now does to its own `sizes`, for a renderer that draws a zoomed crop itself.
51
53
  - **`Breadcrumb`'s `structuredData` prop** (default `true`, so nothing changes by default). `false` omits the component's own `BreadcrumbList` JSON-LD `<script>`, for a page whose theme already writes one at page level (`@eldrajs/theme-core`'s `buildBreadcrumbLd`); two on one page is duplicate markup.
@@ -72,6 +74,7 @@ Release-please writes the generated notes from commit messages and does not repl
72
74
 
73
75
  ### Changed
74
76
 
77
+ - **`Drawer` opens and closes with a short slide and fade of its panel** instead of sliding the whole viewport-wide root in, and no longer closes instantly. Tune it with `--eldra-drawer-slide` (default `2rem`), `--eldra-drawer-enter-duration` (400ms) and `--eldra-drawer-exit-duration` (260ms); reduced motion fades only. The `animate-eldra-drawer-in-*` classes are no longer on the root.
75
78
  - **The skeleton shimmer is slower and softer**: one sweep over the first 1.8s of a 3s cycle, eased at both ends, then a rest, with the glare a soft band rather than a wash the width of the shape. It was a 1.4s `ease-out` sweep, back to back.
76
79
  - **`Dialog` focuses itself on open, not its first control**, from the keyboard as from a tap, so a form dialog no longer opens with the caret (and, on leaving it, the blur validation) in its first field. `Tab` reaches the first control; mark a field `autofocus` to focus it instead. `useDialog` takes the same behaviour as `focusFirstControl: false`; `Drawer`, `Lightbox` and `SearchModal` are unchanged.
77
80
  - **The focus ring moves out from the border as it fades in**, instead of fading in at full size: at rest it is a 1px transparent band against the border, and on focus it travels out past the 2px `focus-inner` infill to the 2px ring, over `duration-base`. The end state is unchanged. Drawn with `box-shadow` spreads, which render at fractional sizes, so the move is smooth.
@@ -89,7 +92,7 @@ Release-please writes the generated notes from commit messages and does not repl
89
92
  - **`Enter` and `Space` on a `Popover` trigger open it.**
90
93
  - **A press that starts inside a `Dialog`, `Drawer`, `Lightbox` or `SearchModal` panel and is released on the backdrop no longer closes it** (selecting text, dragging out of a field).
91
94
  - **A programmatic `click()` on a `Popover`, `Select` or `MultiSelect` trigger opens it**; a click forwarded by a `<label>` still only focuses.
92
- - **The focus ring composes with Tailwind shadows.** `eldra-focus`'s `box-shadow` ends with `--tw-inset-shadow`, `--tw-inset-ring-shadow`, `--tw-ring-offset-shadow`, `--tw-ring-shadow` and `--tw-shadow`, each empty by default, so a `shadow-*` or `ring-*` on the same element draws beneath the ring instead of being dropped. `RangeSlider`'s thumb loses the `shadow-sm` that never painted under the ring, so it looks as before.
95
+ - **The focus ring composes with Tailwind shadows.** `eldra-focus` draws its infill in `--tw-ring-offset-shadow` and its ring in `--tw-ring-shadow` (`eldra-focus-inset`: `--tw-inset-ring-shadow`), and its `box-shadow` is exactly the list Tailwind's `shadow-*` utilities write, so a consumer's `shadow-*` on the same element keeps the ring and draws beneath it, even from the consumer's own later `utilities` layer, where it used to replace the ring. A `ring-*`, `ring-offset-*` or `inset-ring-*` utility now replaces the ring, as Tailwind's own `ring` does. `RangeSlider`'s thumb loses the `shadow-sm` that never painted under the ring, so it looks as before.
93
96
  - **The inset focus ring sits against the element's edge, its gap inside it.** `eldra-focus-inset` and `eldra-focus-inset-always` swap their bands, so a select's search field, `SearchModal`'s field, underline `Tab`s and `QuantityStepper`'s parts no longer show a white band between their container's border and the ring.
94
97
  - **A `Select` or `MultiSelect` panel's search field draws no focus ring.** It holds focus while the panel is open, so the inset ring framed it for as long as the panel showed.
95
98
  - **A disabled `Select`/`MultiSelect` option is drawn muted, without the strikethrough**, and a multi-select's disabled selected box is `Checkbox`'s disabled checked box (`muted`, tick kept) instead of the `primary` fill. Recorded under Deviations.
@@ -151,7 +154,7 @@ Release-please writes the generated notes from commit messages and does not repl
151
154
 
152
155
  ### Fixed
153
156
 
154
- - **A press on a `FieldWrapper`'s bare frame** (the gap between the label and the control, or the box around the control) no longer moves the caret or the focus. In a modal `Dialog` it used to leave a blinking caret in the input while the dialog kept the focus, so typing did nothing; elsewhere it focused the input. The label still focuses it.
157
+ - **A press on empty space in a `FieldWrapper` blurs the focused input again**, as on any other empty space. 0.3.4 cancelled that press, which kept the focus in the input; that change is reverted.
155
158
  - **A field's 2px error boundary no longer splits into two lines at 90%, 110% or 125% zoom.** `Input`, `Textarea`, `UnitInput`, `Select`, `MultiSelect` (and `SearchBar`, `CurrencyInput` through them) draw the second line as the focus ring's resting band in `danger`, a `box-shadow` against the outside of the border, instead of a pseudo-element inset on the field's root. `eldra-field-invalid` now sits on the control (the input, textarea, select trigger, or the `MultiSelect` field holding inside tags), and `--eldra-field-invalid-radius` is gone. On focus the line moves out to become the focus ring.
156
159
  - **`scoped.css` leaves a `Popover` or `Tooltip` trigger to the consumer.** The root is the slot host (`data-eldra-slot`) while the trigger is filled, so the consumer's own element keeps its border, padding and background instead of the kit's reset and utilities.
157
160
  - **`Popover` finds its trigger inside a fragment**, so a wrapper can forward its own `<slot>` into `trigger`.
package/README.md CHANGED
@@ -192,7 +192,7 @@ Every component supports all five of these; none hard-codes anything a store mig
192
192
  | `ContentCard` | `--eldra-content-card-title-size` (default `1.25rem`) and `--eldra-content-card-title-line` (default `1.3`) — the title's own size and line ratio, no token of its own; `--eldra-content-card-excerpt-size` (default `0.9375rem`) and `--eldra-content-card-excerpt-line` (default `1.5`) — the excerpt's own size and line ratio, shared by `FeatureCard`'s `body` (`text-content-card-excerpt` in `tailwind.css`), since both read the same spec number |
193
193
  | `CurrencyInput` | `UnitInput`'s exactly (it renders a `UnitInput` with `isCurrency` always on) — see the `UnitInput` row |
194
194
  | `Dialog` | `--eldra-dialog-title-size` (default `1.25rem`), `--eldra-dialog-title-line` (default `1.3`) — the title's own size/line, no token of its own; `--eldra-dialog-width` (default `32rem`), `--eldra-dialog-width-sm` (default `24rem`) — the panel's own width, always capped at the dialog's padded width (the viewport less `2rem`) inside the utility itself; `--eldra-dialog-max-height` (default `none`: a tall panel grows and the dialog scrolls like a page; set it to cap the panel and scroll the body inside it instead); the `eldra-dialog-fullscreen` utility pins the panel to the viewport edges with the body scrolling between header and footer, for a consumer to put under a viewport variant (`classes.panel: 'max-md:eldra-dialog-fullscreen'`); `--eldra-dialog-background` (default `var(--color-background)`), `--eldra-dialog-border` (default `var(--color-border)`), `--eldra-dialog-text` (default `var(--color-text)`, also the close button's hover and press tint), `--eldra-dialog-muted` (default `var(--color-muted)`, the description) and `--eldra-dialog-backdrop` (default `var(--color-overlay)`) — the chrome's own colours, read by the dialog's parts only, so setting them on the `<dialog>` (`class`) recolours it without re-theming the slotted content the way redefining `--eldra-color-*` there would |
195
- | `Drawer` | `--eldra-drawer-title-size` (default `1.25rem`), `--eldra-drawer-title-line` (default `1.3`) — the title's own size/line, no token of its own (the same numbers as `Dialog`'s, but its own variable pair); `--eldra-drawer-width` (default `28rem`) — the panel's own maximum width, capped at the viewport inside the utility itself, which also carries the full-screen-below-a-48rem-_viewport_ media query; `--eldra-drawer-header-height` (default `4rem`) — the header row's least height, with `--eldra-drawer-header-padding` (default `var(--eldra-space-4)`) — its top and bottom padding, `0px` to centre the row's content in exactly that height, such as a site header's; `--eldra-drawer-gutter` (default `1.5rem`) — the header's, body's and footer's side padding. The device's safe areas (`env(safe-area-inset-*)`) are added around both, so a full-screen drawer clears a notch and the home indicator on a page with `viewport-fit=cover` |
195
+ | `Drawer` | `--eldra-drawer-title-size` (default `1.25rem`), `--eldra-drawer-title-line` (default `1.3`) — the title's own size/line, no token of its own (the same numbers as `Dialog`'s, but its own variable pair); `--eldra-drawer-width` (default `28rem`) — the panel's own maximum width, capped at the viewport inside the utility itself, which also carries the full-screen-below-a-48rem-_viewport_ media query; `--eldra-drawer-header-height` (default `4rem`) — the header row's least height, with `--eldra-drawer-header-padding` (default `var(--eldra-space-4)`) — its top and bottom padding, `0px` to centre the row's content in exactly that height, such as a site header's; `--eldra-drawer-gutter` (default `1.5rem`) — the header's, body's and footer's side padding. The device's safe areas (`env(safe-area-inset-*)`) are added around both, so a full-screen drawer clears a notch and the home indicator on a page with `viewport-fit=cover`; `--eldra-drawer-slide` (default `2rem`), `--eldra-drawer-enter-duration` (default `400ms`), `--eldra-drawer-exit-duration` (default `260ms`) — the panel's slide and fade in and out; `--eldra-drawer-swipe-threshold` (default `24px`) — how far a side swipe travels before the panel follows; with `mobileSheet`, `--eldra-drawer-sheet-gap` (default `3rem`), `--eldra-drawer-sheet-radius` (default `var(--eldra-radius-xl)`) and `--eldra-drawer-handle-color` (default `var(--eldra-color-border-strong)`) |
196
196
  | `EditorPlaceholder` | `--eldra-editor-placeholder-border-width` (default `1.5px`) — the dashed boundary's width, distinct from `EmptyState`'s own stock `border` (1px) |
197
197
  | `EmptyState` | `--eldra-empty-state-title-size` (default `1.25rem`) and `--eldra-empty-state-title-line` (default `1.3`) — the title's own size and line ratio, no token of its own |
198
198
  | `FeatureCard` | Shares `ContentCard`'s `--eldra-content-card-excerpt-size`/`-line` for its own `body` text (`text-content-card-excerpt`); its `title` reads `text-h4` directly, no variable of its own |
@@ -996,9 +996,8 @@ Four things follow from the move, and each is a real consequence rather than a d
996
996
  `transform`, `filter`, `perspective`, `backdrop-filter`, `contain: paint/layout/strict/content`
997
997
  or `will-change` on any of those: `position: fixed` then resolves against **that element**, not
998
998
  the viewport, and its `overflow` clips the panel exactly like any other ancestor. This package's
999
- own `Drawer` is one such element — its slide-in animation is a `transform` on the root
1000
- `<dialog>` itself (see `Drawer.vue`'s own comment on `rootClass`), so teleporting into an open
1001
- `Drawer` needs the same care as any other transformed ancestor. Point `teleport` at something
999
+ own `Drawer` moves its panel with `translate` while it opens, closes and is dragged, and
1000
+ `translate` makes an element a containing block too: point `teleport` at something
1002
1001
  plain, or leave it at `body`.
1003
1002
  - **Custom properties are no longer inherited from around the control.** Set `--eldra-*` overrides
1004
1003
  on `:root` (which is what [Customisation](#customisation) asks for anyway), not on a wrapper
@@ -2089,10 +2088,13 @@ aria-busy aria-label="Loading product"`, `ContentCard`'s loading root now matche
2089
2088
  `disabled`, `tabindex`, `aria-pressed`, `aria-disabled` or `aria-label`, since a generic element
2090
2089
  takes none of them. It is for a part that only looks like a button inside a control that is
2091
2090
  itself the button; its name is its own text, and an icon-only one is decorative.
2092
- - **The focus ring composes with Tailwind shadows.** `eldra-focus` ends its `box-shadow` with
2093
- `--tw-inset-shadow`, `--tw-inset-ring-shadow`, `--tw-ring-offset-shadow`, `--tw-ring-shadow` and
2094
- `--tw-shadow`, each empty by default, so a `shadow-*` or `ring-*` on the same element is drawn
2095
- beneath the ring rather than dropped.
2091
+ - **The focus ring composes with Tailwind shadows.** `eldra-focus` draws its infill in
2092
+ `--tw-ring-offset-shadow` and its ring in `--tw-ring-shadow` (`eldra-focus-inset` uses
2093
+ `--tw-inset-ring-shadow`), and its `box-shadow` is exactly the list Tailwind's `shadow-*`
2094
+ utilities write. So a `shadow-*` on the same element, from any layer, keeps the ring and draws
2095
+ beneath it. A `ring-*`, `ring-offset-*` or `inset-ring-*` utility replaces the ring, as
2096
+ Tailwind's own `ring` and `focus:ring` do. A `transition-*` utility still replaces the ring's
2097
+ transition list, so the ring appears without its fade.
2096
2098
  - **`Button` disabled link button keeps its `href`.** A disabled `<a>` that also drops `href`
2097
2099
  becomes a generic element and stops exposing `role="link"` — a screen reader stops naming what it
2098
2100
  is at the exact moment it needs to say "unavailable". `href` stays, and `aria-disabled="true"`,
@@ -3047,18 +3049,30 @@ null>`, not a Vue `InjectionKey`, despite matching this package's `*_KEY` naming
3047
3049
  click" — with no exception column the way the shared modal rules' "unless the dialog holds
3048
3050
  unsaved input" gives `Dialog`. `useDialog`'s `dismissable` option is simply never passed, which
3049
3051
  defaults to `true`.
3050
- - **`Drawer`'s reduced-motion entrance reuses `Dialog`'s own `animate-eldra-dialog-in-reduced`
3051
- keyframe rather than a third one of its own.** Both spec sections ask for the identical "plain
3052
- opacity fade over `duration-base` (200ms), linear" — no rise, no scale, nothing side-specific — so
3053
- a second keyframe with the same two declarations would only be a second name for the same rule.
3054
- Only the non-reduced entrance gets `Drawer`-specific keyframes (`eldra-drawer-in-right`/`-left`,
3055
- a `translateX` slide from the correct edge), since that part _is_ side-specific.
3056
- - **`Drawer`'s slide animation is on the root `<dialog>`, not the panel**, the same placement
3057
- `Dialog`'s own `animate-eldra-dialog-in` uses. The root is a full-viewport transparent flex box
3058
- that only docks its (opaque) panel child to one edge; translating the root by a full 100% of its
3059
- own (viewport) width slides the panel fully off-screen and back regardless of the panel's own
3060
- width, while the `::backdrop` — a sibling box, not a descendant — is untouched by the transform
3061
- and simply stays in place.
3052
+ - **`Drawer` slides its panel a short way, not the whole drawer from off-screen, and also leaves
3053
+ that way.** The spec asks for a slide from the edge; a full-width slide reads as a page change on
3054
+ a wide screen, so the panel enters from `--eldra-drawer-slide` (default `2rem`) toward its edge
3055
+ while it fades in over `--eldra-drawer-enter-duration` (400ms), and leaves the same way over
3056
+ `--eldra-drawer-exit-duration` (260ms), on one curve (`cubic-bezier(0.32, 0.72, 0, 1)`). It is a
3057
+ CSS transition (`@starting-style`, with `display` and `overlay` kept for the exit) in the
3058
+ `eldra-drawer-motion` utility, on the panel rather than the root, so the `::backdrop` fades on its
3059
+ own and its opacity can follow a drag (`--eldra-drawer-drag`). Under reduced motion the panel
3060
+ only fades, over `duration-base`, linear, the same as `Dialog`'s reduced entrance. A swipe that
3061
+ closes the drawer takes the panel the rest of the way off its edge, at the speed it was let go.
3062
+ - **`Drawer` swipes closed, `swipe` (default `true`).** A side drawer follows a drag toward its own
3063
+ edge once the pointer has moved `--eldra-drawer-swipe-threshold` (default `24px`) that way and
3064
+ more along than across, so a stray movement or a scroll never moves it; a mouse or pen drags by
3065
+ the header (text in the body stays selectable), a finger from anywhere that is not a control or a
3066
+ sideways scroller. Let go past 35% of the panel, or flicked, it closes with the reason
3067
+ `"swipe"`; otherwise it springs back. Dragged back past its resting position, it stays there. Keyboard users close it
3068
+ with `Escape` or the close button, as before; a keyboard drag would only be a slower `Escape`.
3069
+ - **`Drawer`'s `mobileSheet` (default `false`) is a bottom sheet below a 48rem viewport**, not the
3070
+ full-screen panel: content height up to `--eldra-drawer-sheet-gap` (default `3rem`) from the top,
3071
+ rounded top corners (`--eldra-drawer-sheet-radius`, default `radius-xl`), a grab handle (the
3072
+ `handle` part, `aria-hidden`: the close button and `Escape` are the accessible way out,
3073
+ `--eldra-drawer-handle-color`). It rises from the bottom and is dragged down by its handle and
3074
+ header after 4px, or by its body when the body is scrolled to the top, the way a native sheet
3075
+ takes over a scroll. Off by default because a full-screen drawer is the spec's mobile variant.
3062
3076
  - **`Drawer`'s close button aria-label is a function of whichever prop names the drawer, not a
3063
3077
  fixed string.** The design spec's own Accessibility notes give three different literal labels
3064
3078
  for the one control ("Close cart", "Close menu", "Close filters"), which this package cannot know
@@ -3071,9 +3085,8 @@ null>`, not a Vue `InjectionKey`, despite matching this package's `*_KEY` naming
3071
3085
  own convention every stateful component in this package shares) replaces `open`/`openChange`;
3072
3086
  `close(reason)` fires with `"escape"`/`"backdrop"`/`"button"`/an action value, the identical shape
3073
3087
  `Dialog`'s own `close` event already uses, rather than a bare `close` with no reason. There is no
3074
- `afterLeave`: the spec's own exit is "instant" (no animation to wait for), the same reasoning that
3075
- gives `Dialog` no exit-coordination event either — an event that only ever fires on the same tick
3076
- as `close` would tell a consumer nothing `close` does not already.
3088
+ `afterLeave`: `close` fires when the drawer starts to leave, and nothing in the exit transition is
3089
+ a consumer's to wait for. `close` also takes `"swipe"`.
3077
3090
  - **`Tooltip`'s bubble stays mounted permanently, unlike every other teleported panel in this
3078
3091
  package.** `Select`/`MultiSelect`/`SearchBar` mount their panel fresh on every open (`v-if` on
3079
3092
  the `<Teleport>`), so `animate-eldra-popover-in`'s keyframe replays each time. The spec's own
@@ -232,11 +232,14 @@ var kitMerge = extendTailwindMerge({
232
232
  "eldra-radio-card-selected": ["eldra-radio-card-selected"],
233
233
  "eldra-switch-thumb-offset": ["eldra-switch-thumb-offset"],
234
234
  "eldra-dialog-fullscreen": ["eldra-dialog-fullscreen"],
235
+ "eldra-drawer-motion": ["eldra-drawer-motion"],
236
+ "eldra-drawer-sheet": ["eldra-drawer-sheet"],
235
237
  "max-h": [
236
238
  "eldra-select-panel-height",
237
239
  "eldra-search-panel-height",
238
240
  "eldra-dialog-max-height",
239
- "eldra-search-modal-max-height"
241
+ "eldra-search-modal-max-height",
242
+ "eldra-drawer-sheet-height"
240
243
  ],
241
244
  m: ["eldra-search-modal-position"],
242
245
  "max-w": [
@@ -178,6 +178,8 @@ declare const __VLS_base: import('vue').DefineComponent<DrawerProps, {
178
178
  }>;
179
179
  width: string;
180
180
  side: import('./types.js').DrawerSide;
181
+ mobileSheet: boolean;
182
+ swipe: boolean;
181
183
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
182
184
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
183
185
  declare const _default: typeof __VLS_export;
@@ -1,6 +1,6 @@
1
1
  import { UiMessages } from '../../composables/useMessages.js';
2
2
  /** The parts a consumer can restyle through `classes`, named as the spec's anatomy names them. */
3
- export type DrawerPart = 'panel' | 'header' | 'title' | 'count' | 'close' | 'body' | 'footer';
3
+ export type DrawerPart = 'panel' | 'handle' | 'header' | 'title' | 'count' | 'close' | 'body' | 'footer';
4
4
  /** The edge the sheet slides in from. `left` is for the mobile menu; everything else (cart,
5
5
  * filters, quick view) is `right`, the default. */
6
6
  export type DrawerSide = 'right' | 'left';
@@ -22,6 +22,20 @@ export interface DrawerProps {
22
22
  * viewport. Default `"28rem"`. Below a 48rem *viewport* the drawer covers the full screen
23
23
  * regardless of this value. */
24
24
  width?: string;
25
+ /**
26
+ * Below the 48rem viewport edge, opens as a bottom sheet instead of a full-screen panel: it
27
+ * rises from the bottom, fits its content up to the viewport less `--eldra-drawer-sheet-gap`,
28
+ * and has a grab handle; drag the handle or header down (or the body, once it is scrolled to the
29
+ * top) to close it, the backdrop fading as it goes. Wider than that it is the usual side drawer.
30
+ * Default `false`.
31
+ */
32
+ mobileSheet?: boolean;
33
+ /**
34
+ * Swipe the drawer toward its edge to close it: a side drawer sideways (a finger anywhere on
35
+ * it, a mouse or pen by its header), a `mobileSheet` down. Nothing moves until the pointer has
36
+ * gone `--eldra-drawer-swipe-threshold` (24px) toward the edge. Default `true`.
37
+ */
38
+ swipe?: boolean;
25
39
  /** Message overrides (only `close` applies here, unless a name is available — see
26
40
  * `closeDrawer`). See `useMessages`. */
27
41
  messages?: Partial<UiMessages>;
@@ -0,0 +1,20 @@
1
+ import { Ref } from 'vue';
2
+ export interface DrawerDragOptions {
3
+ dialog: Ref<HTMLDialogElement | null>;
4
+ panel: Ref<HTMLElement | null>;
5
+ body: Ref<HTMLElement | null>;
6
+ side: () => 'left' | 'right';
7
+ /** The `mobileSheet` prop; the sheet itself only exists below the 48rem viewport edge. */
8
+ sheet: () => boolean;
9
+ /** The `swipe` prop. */
10
+ enabled: () => boolean;
11
+ /** Closes the drawer; called once the panel has been let go past the dismiss point. */
12
+ dismiss: () => void;
13
+ }
14
+ export declare function useDrawerDrag(options: DrawerDragOptions): {
15
+ onPointerDown: (event: PointerEvent) => void;
16
+ onTouchStart: (event: TouchEvent) => void;
17
+ onTouchMove: (event: TouchEvent) => void;
18
+ onTouchEnd: (event: TouchEvent) => void;
19
+ reset: () => void;
20
+ };