@eldrajs/ui 0.3.5 → 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 +3 -0
- package/README.md +29 -19
- package/dist/{VariantPicker-BjM-PmXb.js → VariantPicker-BB-2Cj32.js} +4 -1
- package/dist/components/drawer/Drawer.vue.d.ts +2 -0
- package/dist/components/drawer/types.d.ts +15 -1
- package/dist/components/drawer/useDrawerDrag.d.ts +20 -0
- package/dist/components.css +142 -8
- package/dist/index.js +295 -16
- package/dist/style.css +142 -8
- package/dist/utilities.css +100 -0
- package/dist/vee-validate.js +1 -1
- package/package.json +1 -1
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.
|
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`
|
|
1000
|
-
|
|
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
|
|
@@ -3050,18 +3049,30 @@ null>`, not a Vue `InjectionKey`, despite matching this package's `*_KEY` naming
|
|
|
3050
3049
|
click" — with no exception column the way the shared modal rules' "unless the dialog holds
|
|
3051
3050
|
unsaved input" gives `Dialog`. `useDialog`'s `dismissable` option is simply never passed, which
|
|
3052
3051
|
defaults to `true`.
|
|
3053
|
-
- **`Drawer`
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
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.
|
|
3065
3076
|
- **`Drawer`'s close button aria-label is a function of whichever prop names the drawer, not a
|
|
3066
3077
|
fixed string.** The design spec's own Accessibility notes give three different literal labels
|
|
3067
3078
|
for the one control ("Close cart", "Close menu", "Close filters"), which this package cannot know
|
|
@@ -3074,9 +3085,8 @@ null>`, not a Vue `InjectionKey`, despite matching this package's `*_KEY` naming
|
|
|
3074
3085
|
own convention every stateful component in this package shares) replaces `open`/`openChange`;
|
|
3075
3086
|
`close(reason)` fires with `"escape"`/`"backdrop"`/`"button"`/an action value, the identical shape
|
|
3076
3087
|
`Dialog`'s own `close` event already uses, rather than a bare `close` with no reason. There is no
|
|
3077
|
-
`afterLeave`:
|
|
3078
|
-
|
|
3079
|
-
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"`.
|
|
3080
3090
|
- **`Tooltip`'s bubble stays mounted permanently, unlike every other teleported panel in this
|
|
3081
3091
|
package.** `Select`/`MultiSelect`/`SearchBar` mount their panel fresh on every open (`v-if` on
|
|
3082
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
|
+
};
|
package/dist/components.css
CHANGED
|
@@ -1382,6 +1382,79 @@
|
|
|
1382
1382
|
translate: var(--tw-translate-x) var(--tw-translate-y);
|
|
1383
1383
|
}
|
|
1384
1384
|
|
|
1385
|
+
.eldra\:eldra-drawer-motion {
|
|
1386
|
+
--eldra-drawer-slide-x: var(--eldra-drawer-slide, 2rem);
|
|
1387
|
+
--eldra-drawer-enter: var(--eldra-drawer-enter-duration, .4s);
|
|
1388
|
+
--eldra-drawer-exit: var(--eldra-drawer-exit-duration, .26s);
|
|
1389
|
+
--eldra-drawer-curve: var(--eldra-drawer-ease, cubic-bezier(.32, .72, 0, 1));
|
|
1390
|
+
transition-behavior: allow-discrete;
|
|
1391
|
+
transition-property: display, overlay;
|
|
1392
|
+
transition-duration: var(--eldra-drawer-enter);
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
.eldra\:eldra-drawer-motion[data-side="left"] {
|
|
1396
|
+
--eldra-drawer-slide-x: calc(-1 * var(--eldra-drawer-slide, 2rem));
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
.eldra\:eldra-drawer-motion:not([open]) {
|
|
1400
|
+
transition-duration: var(--eldra-drawer-exit);
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
.eldra\:eldra-drawer-motion::backdrop {
|
|
1404
|
+
opacity: calc(1 - var(--eldra-drawer-drag, 0));
|
|
1405
|
+
transition-behavior: allow-discrete;
|
|
1406
|
+
transition-property: opacity, display, overlay;
|
|
1407
|
+
transition-duration: var(--eldra-drawer-enter);
|
|
1408
|
+
transition-timing-function: var(--eldra-drawer-curve);
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
.eldra\:eldra-drawer-motion:not([open])::backdrop {
|
|
1412
|
+
opacity: 0;
|
|
1413
|
+
transition-duration: var(--eldra-drawer-exit);
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
.eldra\:eldra-drawer-motion > [data-part="panel"] {
|
|
1417
|
+
transition-property: translate, opacity;
|
|
1418
|
+
transition-duration: var(--eldra-drawer-enter);
|
|
1419
|
+
transition-timing-function: var(--eldra-drawer-curve);
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
.eldra\:eldra-drawer-motion:not([open]) > [data-part="panel"] {
|
|
1423
|
+
translate: calc(var(--eldra-drawer-slide-x) * var(--eldra-drawer-axis-x, 1) + 100% * var(--eldra-drawer-away-x, 0)) calc(100% * var(--eldra-drawer-axis-y, 0));
|
|
1424
|
+
opacity: var(--eldra-drawer-from-opacity, 0);
|
|
1425
|
+
transition-duration: var(--eldra-drawer-exit);
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
@starting-style {
|
|
1429
|
+
.eldra\:eldra-drawer-motion[open] > [data-part="panel"] {
|
|
1430
|
+
translate: calc(var(--eldra-drawer-slide-x) * var(--eldra-drawer-axis-x, 1) + 100% * var(--eldra-drawer-away-x, 0)) calc(100% * var(--eldra-drawer-axis-y, 0));
|
|
1431
|
+
opacity: var(--eldra-drawer-from-opacity, 0);
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
.eldra\:eldra-drawer-motion[open]::backdrop {
|
|
1435
|
+
opacity: 0;
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
.eldra\:eldra-drawer-motion[data-dragging] {
|
|
1440
|
+
-webkit-user-select: none;
|
|
1441
|
+
user-select: none;
|
|
1442
|
+
cursor: grabbing;
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
.eldra\:eldra-drawer-motion[data-dragging] > [data-part="panel"], .eldra\:eldra-drawer-motion[data-dragging]::backdrop {
|
|
1446
|
+
transition-duration: 0s;
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1450
|
+
.eldra\:eldra-drawer-motion {
|
|
1451
|
+
--eldra-drawer-slide-x: 0px;
|
|
1452
|
+
--eldra-drawer-enter: var(--eldra-duration-base);
|
|
1453
|
+
--eldra-drawer-exit: var(--eldra-duration-base);
|
|
1454
|
+
--eldra-drawer-curve: linear;
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1385
1458
|
.eldra\:scale-0 {
|
|
1386
1459
|
--tw-scale-x: 0%;
|
|
1387
1460
|
--tw-scale-y: 0%;
|
|
@@ -1418,14 +1491,6 @@
|
|
|
1418
1491
|
animation: eldra-dialog-in var(--eldra-duration-slow) var(--eldra-ease-out);
|
|
1419
1492
|
}
|
|
1420
1493
|
|
|
1421
|
-
.eldra\:animate-eldra-drawer-in-left {
|
|
1422
|
-
animation: eldra-drawer-in-left var(--eldra-duration-slow) var(--eldra-ease-out);
|
|
1423
|
-
}
|
|
1424
|
-
|
|
1425
|
-
.eldra\:animate-eldra-drawer-in-right {
|
|
1426
|
-
animation: eldra-drawer-in-right var(--eldra-duration-slow) var(--eldra-ease-out);
|
|
1427
|
-
}
|
|
1428
|
-
|
|
1429
1494
|
.eldra\:animate-eldra-lightbox-in {
|
|
1430
1495
|
animation: eldra-lightbox-in var(--eldra-duration-slow) var(--eldra-ease-out);
|
|
1431
1496
|
}
|
|
@@ -1472,6 +1537,11 @@
|
|
|
1472
1537
|
touch-action: var(--tw-pan-x, ) var(--tw-pan-y, ) var(--tw-pinch-zoom, );
|
|
1473
1538
|
}
|
|
1474
1539
|
|
|
1540
|
+
.eldra\:touch-pinch-zoom {
|
|
1541
|
+
--tw-pinch-zoom: pinch-zoom;
|
|
1542
|
+
touch-action: var(--tw-pan-x, ) var(--tw-pan-y, ) var(--tw-pinch-zoom, );
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1475
1545
|
.eldra\:touch-none {
|
|
1476
1546
|
touch-action: none;
|
|
1477
1547
|
}
|
|
@@ -1730,6 +1800,10 @@
|
|
|
1730
1800
|
overflow: hidden;
|
|
1731
1801
|
}
|
|
1732
1802
|
|
|
1803
|
+
.eldra\:overflow-clip {
|
|
1804
|
+
overflow: clip;
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1733
1807
|
.eldra\:overflow-hidden {
|
|
1734
1808
|
overflow: hidden;
|
|
1735
1809
|
}
|
|
@@ -2056,6 +2130,10 @@
|
|
|
2056
2130
|
background-color: var(--eldra-dialog-background, var(--eldra-color-background));
|
|
2057
2131
|
}
|
|
2058
2132
|
|
|
2133
|
+
.eldra\:bg-\[var\(--eldra-drawer-handle-color\,var\(--eldra-color-border-strong\)\)\] {
|
|
2134
|
+
background-color: var(--eldra-drawer-handle-color, var(--eldra-color-border-strong));
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2059
2137
|
.eldra\:bg-accent {
|
|
2060
2138
|
background-color: var(--eldra-color-accent);
|
|
2061
2139
|
}
|
|
@@ -3516,6 +3594,14 @@
|
|
|
3516
3594
|
}
|
|
3517
3595
|
}
|
|
3518
3596
|
|
|
3597
|
+
@media (not (min-width: 48rem)) and (prefers-reduced-motion: no-preference) {
|
|
3598
|
+
.eldra\:eldra-drawer-sheet {
|
|
3599
|
+
--eldra-drawer-axis-x: 0;
|
|
3600
|
+
--eldra-drawer-axis-y: 1;
|
|
3601
|
+
--eldra-drawer-from-opacity: 1;
|
|
3602
|
+
}
|
|
3603
|
+
}
|
|
3604
|
+
|
|
3519
3605
|
.eldra\:eldra-field-invalid {
|
|
3520
3606
|
--eldra-focus-rest-width: var(--eldra-field-border-width, 1px);
|
|
3521
3607
|
--eldra-focus-rest-color: var(--eldra-color-danger);
|
|
@@ -4119,19 +4205,53 @@
|
|
|
4119
4205
|
height: 2.75rem;
|
|
4120
4206
|
}
|
|
4121
4207
|
|
|
4208
|
+
.eldra\:max-md\:h-auto {
|
|
4209
|
+
height: auto;
|
|
4210
|
+
}
|
|
4211
|
+
|
|
4122
4212
|
.eldra\:max-md\:h-screen {
|
|
4123
4213
|
height: 100vh;
|
|
4124
4214
|
}
|
|
4125
4215
|
|
|
4216
|
+
.eldra\:max-md\:eldra-drawer-sheet-height {
|
|
4217
|
+
max-height: calc(100% - var(--eldra-drawer-sheet-gap, 3rem) - env(safe-area-inset-top, 0px));
|
|
4218
|
+
}
|
|
4219
|
+
|
|
4220
|
+
.eldra\:max-md\:min-h-0 {
|
|
4221
|
+
min-height: 0;
|
|
4222
|
+
}
|
|
4223
|
+
|
|
4224
|
+
.eldra\:max-md\:touch-none {
|
|
4225
|
+
touch-action: none;
|
|
4226
|
+
}
|
|
4227
|
+
|
|
4228
|
+
.eldra\:max-md\:flex-col {
|
|
4229
|
+
flex-direction: column;
|
|
4230
|
+
}
|
|
4231
|
+
|
|
4232
|
+
.eldra\:max-md\:justify-end {
|
|
4233
|
+
justify-content: flex-end;
|
|
4234
|
+
}
|
|
4235
|
+
|
|
4126
4236
|
.eldra\:max-md\:rounded-none {
|
|
4127
4237
|
border-radius: 0;
|
|
4128
4238
|
}
|
|
4129
4239
|
|
|
4240
|
+
.eldra\:max-md\:rounded-t-\[var\(--eldra-drawer-sheet-radius\,var\(--eldra-radius-xl\)\)\] {
|
|
4241
|
+
border-top-left-radius: var(--eldra-drawer-sheet-radius, var(--eldra-radius-xl));
|
|
4242
|
+
border-top-right-radius: var(--eldra-drawer-sheet-radius, var(--eldra-radius-xl));
|
|
4243
|
+
}
|
|
4244
|
+
|
|
4130
4245
|
.eldra\:max-md\:border-0 {
|
|
4131
4246
|
border-style: var(--tw-border-style);
|
|
4132
4247
|
border-width: 0;
|
|
4133
4248
|
}
|
|
4134
4249
|
|
|
4250
|
+
.eldra\:max-md\:border-t {
|
|
4251
|
+
border-top-style: var(--tw-border-style);
|
|
4252
|
+
border-top-width: 1px;
|
|
4253
|
+
}
|
|
4254
|
+
|
|
4135
4255
|
.eldra\:max-md\:border-r-0 {
|
|
4136
4256
|
border-right-style: var(--tw-border-style);
|
|
4137
4257
|
border-right-width: 0;
|
|
@@ -4146,6 +4266,10 @@
|
|
|
4146
4266
|
padding-inline-end: 7.5rem;
|
|
4147
4267
|
}
|
|
4148
4268
|
|
|
4269
|
+
.eldra\:max-md\:pt-1 {
|
|
4270
|
+
padding-top: var(--eldra-space-1);
|
|
4271
|
+
}
|
|
4272
|
+
|
|
4149
4273
|
.eldra\:max-md\:pb-17 {
|
|
4150
4274
|
padding-bottom: 4.25rem;
|
|
4151
4275
|
}
|
|
@@ -4180,6 +4304,16 @@
|
|
|
4180
4304
|
display: inline-flex;
|
|
4181
4305
|
}
|
|
4182
4306
|
|
|
4307
|
+
.eldra\:md\:touch-pan-y {
|
|
4308
|
+
--tw-pan-y: pan-y;
|
|
4309
|
+
touch-action: var(--tw-pan-x, ) var(--tw-pan-y, ) var(--tw-pinch-zoom, );
|
|
4310
|
+
}
|
|
4311
|
+
|
|
4312
|
+
.eldra\:md\:touch-pinch-zoom {
|
|
4313
|
+
--tw-pinch-zoom: pinch-zoom;
|
|
4314
|
+
touch-action: var(--tw-pan-x, ) var(--tw-pan-y, ) var(--tw-pinch-zoom, );
|
|
4315
|
+
}
|
|
4316
|
+
|
|
4183
4317
|
.eldra\:md\:text-body-sm {
|
|
4184
4318
|
font-family: var(--eldra-text-body-sm-family);
|
|
4185
4319
|
font-size: var(--eldra-text-body-sm-size);
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as parseLocaleNumber, A as focusInvalid, At as joinIds, B as FIELD_CLEAR_BUTTON_BOX, C as topLayerDialog, Ct as FORM_LAYOUT_KEY, D as normalizeText, Dt as ELDRA_SCOPE_KEY, E as matchRange, Et as useControllableModel, F as defaultCharacterMeaning, G as createNumberFormat, H as FIELD_LIVE, I as stripMask, J as defaultUnitFormat, K as currencyFractionDigits, L as CurrencyInput_default, M as filterNumericBeforeInput, N as Input_default, O as useListbox, Ot as provideEldraScope, P as applyMask, Q as localeSeparators, R as UnitInput_default, S as useOverlay, St as ICON_STROKE_WIDTH$4, T as useFloating, Tt as mergeClass, U as FIELD_SEARCH_APPEARANCE, V as FIELD_DISABLED, W as FIELD_SIZE, X as formatNumber, Y as formatCurrency, Z as formatUnit, _ as optionCursor, _t as FIELD_KEY, a as claimShortcut, at as provideEldraUiCurrency, b as MultiSelect_default, bt as Icon_default, c as SearchResultsPanel_default, ct as useEldraUiLocale, d as INPUT, dt as tagPadding, et as useSlotPresence, f as PLAIN_BOX_ONLY, ft as CheckboxGroup_default, g as labelRecipe, gt as FieldError_default, h as dotRecipe, ht as RequiredMark_default, i as SearchBar_default, it as LOCALE_KEY, j as Switch_default, jt as useUiId, k as FormLayout_default, kt as useEldraScope, l as RadioGroup_default, lt as TAG_FILL, m as PLAIN_OPTION, mt as VisuallyHidden_default, n as Textarea_default, nt as CURRENCY_KEY, o as ownsShortcut, ot as provideEldraUiLocale, p as PLAIN_COLUMNS, pt as Checkbox_default, q as currencySymbol, r as Select_default, rt as DEFAULT_UI_LOCALE, s as releaseShortcut, st as useEldraUiCurrency, t as VariantPicker_default, tt as useHeadingTag, u as HINT, ut as TAG_SHAPE, v as radioRecipe, vt as Button_default, w as useTeleportTarget, wt as FORM_SUBMITTING_KEY, x as usePopover, xt as ICON_SIZE_CLASS, y as QuantityStepper_default, yt as Spinner_default, z as FIELD_BASE } from "./VariantPicker-
|
|
1
|
+
import { $ as parseLocaleNumber, A as focusInvalid, At as joinIds, B as FIELD_CLEAR_BUTTON_BOX, C as topLayerDialog, Ct as FORM_LAYOUT_KEY, D as normalizeText, Dt as ELDRA_SCOPE_KEY, E as matchRange, Et as useControllableModel, F as defaultCharacterMeaning, G as createNumberFormat, H as FIELD_LIVE, I as stripMask, J as defaultUnitFormat, K as currencyFractionDigits, L as CurrencyInput_default, M as filterNumericBeforeInput, N as Input_default, O as useListbox, Ot as provideEldraScope, P as applyMask, Q as localeSeparators, R as UnitInput_default, S as useOverlay, St as ICON_STROKE_WIDTH$4, T as useFloating, Tt as mergeClass, U as FIELD_SEARCH_APPEARANCE, V as FIELD_DISABLED, W as FIELD_SIZE, X as formatNumber, Y as formatCurrency, Z as formatUnit, _ as optionCursor, _t as FIELD_KEY, a as claimShortcut, at as provideEldraUiCurrency, b as MultiSelect_default, bt as Icon_default, c as SearchResultsPanel_default, ct as useEldraUiLocale, d as INPUT, dt as tagPadding, et as useSlotPresence, f as PLAIN_BOX_ONLY, ft as CheckboxGroup_default, g as labelRecipe, gt as FieldError_default, h as dotRecipe, ht as RequiredMark_default, i as SearchBar_default, it as LOCALE_KEY, j as Switch_default, jt as useUiId, k as FormLayout_default, kt as useEldraScope, l as RadioGroup_default, lt as TAG_FILL, m as PLAIN_OPTION, mt as VisuallyHidden_default, n as Textarea_default, nt as CURRENCY_KEY, o as ownsShortcut, ot as provideEldraUiLocale, p as PLAIN_COLUMNS, pt as Checkbox_default, q as currencySymbol, r as Select_default, rt as DEFAULT_UI_LOCALE, s as releaseShortcut, st as useEldraUiCurrency, t as VariantPicker_default, tt as useHeadingTag, u as HINT, ut as TAG_SHAPE, v as radioRecipe, vt as Button_default, w as useTeleportTarget, wt as FORM_SUBMITTING_KEY, x as usePopover, xt as ICON_SIZE_CLASS, y as QuantityStepper_default, yt as Spinner_default, z as FIELD_BASE } from "./VariantPicker-BB-2Cj32.js";
|
|
2
2
|
import { i as enUS, n as provideEldraUiMessages, r as useMessages, t as MESSAGES_KEY } from "./useMessages-B5nzZghs.js";
|
|
3
3
|
import { Comment, Fragment, Teleport, Text, Transition, cloneVNode, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, guardReactiveProps, h, inject, isRef, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeUnmount, onMounted, onServerPrefetch, onUnmounted, onUpdated, openBlock, provide, reactive, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toRef, toValue, unref, useAttrs, useId, useSlots, useTemplateRef, vModelText, vShow, watch, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
4
4
|
import { dateTimeFormat } from "@eldrajs/sdk/format/date";
|
|
@@ -4584,17 +4584,249 @@ var Dialog_default = /* @__PURE__ */ defineComponent({
|
|
|
4584
4584
|
};
|
|
4585
4585
|
}
|
|
4586
4586
|
});
|
|
4587
|
+
// src/components/drawer/useDrawerDrag.ts
|
|
4588
|
+
/**
|
|
4589
|
+
* Drag-to-dismiss for `Drawer`: a side drawer swiped toward its own edge, and a `mobileSheet`
|
|
4590
|
+
* drawer pulled down below the 48rem viewport edge. The panel follows the pointer one to one, the
|
|
4591
|
+
* backdrop fades with the distance (`--eldra-drawer-drag`, read by `eldra-drawer-motion`), and on
|
|
4592
|
+
* release the drawer closes past a third of its size or on a quick flick, else springs back.
|
|
4593
|
+
*
|
|
4594
|
+
* Nothing moves until the pointer has travelled the dead zone along the closing direction and
|
|
4595
|
+
* more along it than across it: 24px for a side swipe (`--eldra-drawer-swipe-threshold`), so a
|
|
4596
|
+
* stray mouse movement or a scroll never drags the drawer, and 4px on a sheet's handle and header,
|
|
4597
|
+
* which exist to be grabbed. The panel then starts from 0, not from the dead zone.
|
|
4598
|
+
*
|
|
4599
|
+
* Where a drag may start: never on a control (a button, link, field, or anything editable) or
|
|
4600
|
+
* inside something that scrolls sideways. A mouse or pen drags a side drawer by its header only,
|
|
4601
|
+
* so selecting text in the body still works; a finger may swipe it from anywhere. A sheet is
|
|
4602
|
+
* dragged by its handle and header, and by its body when the body is scrolled to the top and the
|
|
4603
|
+
* finger moves down, the way a native sheet hands a scroll over to the sheet.
|
|
4604
|
+
*/
|
|
4605
|
+
var INTERACTIVE = "button, a[href], input, textarea, select, label, summary, [contenteditable]:not([contenteditable=\"false\"]), [role=\"slider\"], [role=\"button\"], [role=\"link\"], [role=\"tab\"], [role=\"option\"]";
|
|
4606
|
+
/** A third of the panel, or a flick at least this fast toward the edge, closes the drawer. */
|
|
4607
|
+
var DISMISS_FRACTION = .35;
|
|
4608
|
+
var FLICK_SPEED = .45;
|
|
4609
|
+
var SHEET_THRESHOLD = 4;
|
|
4610
|
+
var SIDE_THRESHOLD = 24;
|
|
4611
|
+
function isSheetViewport() {
|
|
4612
|
+
return typeof window !== "undefined" && window.matchMedia("(width < 48rem)").matches;
|
|
4613
|
+
}
|
|
4614
|
+
function scrollsSideways(target, stop) {
|
|
4615
|
+
for (let el = target; el && el !== stop; el = el.parentElement) {
|
|
4616
|
+
const style = getComputedStyle(el);
|
|
4617
|
+
if (/(auto|scroll)/.test(style.overflowX) && el.scrollWidth > el.clientWidth) return true;
|
|
4618
|
+
}
|
|
4619
|
+
return false;
|
|
4620
|
+
}
|
|
4621
|
+
function useDrawerDrag(options) {
|
|
4622
|
+
let gesture = null;
|
|
4623
|
+
let pointerId = null;
|
|
4624
|
+
let suppressClick = false;
|
|
4625
|
+
function thresholdFor(axis) {
|
|
4626
|
+
if (axis === "y") return SHEET_THRESHOLD;
|
|
4627
|
+
const raw = options.dialog.value ? getComputedStyle(options.dialog.value).getPropertyValue("--eldra-drawer-swipe-threshold") : "";
|
|
4628
|
+
const value = parseFloat(raw);
|
|
4629
|
+
return Number.isFinite(value) ? value : SIDE_THRESHOLD;
|
|
4630
|
+
}
|
|
4631
|
+
function begin(x, y, axis) {
|
|
4632
|
+
const panel = options.panel.value;
|
|
4633
|
+
if (!panel) return;
|
|
4634
|
+
const rect = panel.getBoundingClientRect();
|
|
4635
|
+
gesture = {
|
|
4636
|
+
axis,
|
|
4637
|
+
dir: axis === "y" || options.side() === "right" ? 1 : -1,
|
|
4638
|
+
threshold: thresholdFor(axis),
|
|
4639
|
+
startX: x,
|
|
4640
|
+
startY: y,
|
|
4641
|
+
origin: 0,
|
|
4642
|
+
engaged: false,
|
|
4643
|
+
size: axis === "x" ? rect.width : rect.height,
|
|
4644
|
+
position: 0,
|
|
4645
|
+
samples: []
|
|
4646
|
+
};
|
|
4647
|
+
}
|
|
4648
|
+
/** Feeds a pointer position; returns whether the drag is engaged (the panel is following). */
|
|
4649
|
+
function track(x, y) {
|
|
4650
|
+
const g = gesture;
|
|
4651
|
+
if (!g) return false;
|
|
4652
|
+
const along = (g.axis === "x" ? x - g.startX : y - g.startY) * g.dir;
|
|
4653
|
+
const across = Math.abs(g.axis === "x" ? y - g.startY : x - g.startX);
|
|
4654
|
+
if (!g.engaged) {
|
|
4655
|
+
if (Math.abs(along) < g.threshold && across < g.threshold) return false;
|
|
4656
|
+
if (along < g.threshold || across > along) {
|
|
4657
|
+
gesture = null;
|
|
4658
|
+
return false;
|
|
4659
|
+
}
|
|
4660
|
+
g.engaged = true;
|
|
4661
|
+
g.origin = along;
|
|
4662
|
+
options.dialog.value?.setAttribute("data-dragging", "");
|
|
4663
|
+
window.getSelection?.()?.removeAllRanges();
|
|
4664
|
+
}
|
|
4665
|
+
g.position = Math.max(along - g.origin, 0);
|
|
4666
|
+
const now = performance.now();
|
|
4667
|
+
g.samples.push({
|
|
4668
|
+
t: now,
|
|
4669
|
+
p: g.position
|
|
4670
|
+
});
|
|
4671
|
+
while (g.samples.length > 2 && now - g.samples[0].t > 100) g.samples.shift();
|
|
4672
|
+
paint(g);
|
|
4673
|
+
return true;
|
|
4674
|
+
}
|
|
4675
|
+
function paint(g) {
|
|
4676
|
+
const panel = options.panel.value;
|
|
4677
|
+
const dialog = options.dialog.value;
|
|
4678
|
+
if (!panel || !dialog) return;
|
|
4679
|
+
const offset = g.position * g.dir;
|
|
4680
|
+
panel.style.translate = g.axis === "x" ? `${offset}px 0` : `0 ${offset}px`;
|
|
4681
|
+
const progress = Math.min(Math.max(g.position / g.size, 0), 1);
|
|
4682
|
+
dialog.style.setProperty("--eldra-drawer-drag", progress.toFixed(4));
|
|
4683
|
+
}
|
|
4684
|
+
function release() {
|
|
4685
|
+
const g = gesture;
|
|
4686
|
+
gesture = null;
|
|
4687
|
+
if (!g?.engaged) return;
|
|
4688
|
+
suppressClick = true;
|
|
4689
|
+
setTimeout(() => suppressClick = false, 0);
|
|
4690
|
+
const first = g.samples[0];
|
|
4691
|
+
const last = g.samples[g.samples.length - 1];
|
|
4692
|
+
const velocity = !(last ? performance.now() - last.t > 80 : true) && first && last && last.t > first.t ? (last.p - first.p) / (last.t - first.t) : 0;
|
|
4693
|
+
const dismissed = g.position > g.size * DISMISS_FRACTION || velocity > FLICK_SPEED && g.position > 8;
|
|
4694
|
+
const dialog = options.dialog.value;
|
|
4695
|
+
const panel = options.panel.value;
|
|
4696
|
+
if (dialog && dismissed) {
|
|
4697
|
+
const remaining = Math.max(g.size - g.position, 0);
|
|
4698
|
+
const duration = Math.round(Math.min(Math.max(remaining / Math.max(velocity, 1.2), 140), 320));
|
|
4699
|
+
dialog.style.setProperty("--eldra-drawer-exit-duration", `${duration}ms`);
|
|
4700
|
+
dialog.style.setProperty("--eldra-drawer-from-opacity", "1");
|
|
4701
|
+
if (g.axis === "x") {
|
|
4702
|
+
dialog.style.setProperty("--eldra-drawer-axis-x", "0");
|
|
4703
|
+
dialog.style.setProperty("--eldra-drawer-away-x", String(g.dir));
|
|
4704
|
+
}
|
|
4705
|
+
}
|
|
4706
|
+
dialog?.removeAttribute("data-dragging");
|
|
4707
|
+
dialog?.style.removeProperty("--eldra-drawer-drag");
|
|
4708
|
+
if (panel) panel.style.translate = "";
|
|
4709
|
+
if (dismissed) options.dismiss();
|
|
4710
|
+
}
|
|
4711
|
+
/** Clears what a swipe-dismiss left on the root, so the next opening enters the usual way. */
|
|
4712
|
+
function reset() {
|
|
4713
|
+
const dialog = options.dialog.value;
|
|
4714
|
+
if (!dialog) return;
|
|
4715
|
+
for (const name of [
|
|
4716
|
+
"--eldra-drawer-exit-duration",
|
|
4717
|
+
"--eldra-drawer-from-opacity",
|
|
4718
|
+
"--eldra-drawer-axis-x",
|
|
4719
|
+
"--eldra-drawer-away-x",
|
|
4720
|
+
"--eldra-drawer-drag"
|
|
4721
|
+
]) dialog.style.removeProperty(name);
|
|
4722
|
+
dialog.removeAttribute("data-dragging");
|
|
4723
|
+
if (options.panel.value) options.panel.value.style.translate = "";
|
|
4724
|
+
}
|
|
4725
|
+
function onPointerDown(event) {
|
|
4726
|
+
if (!options.enabled() || gesture || event.button !== 0 || !event.isPrimary) return;
|
|
4727
|
+
const panel = options.panel.value;
|
|
4728
|
+
const target = event.target;
|
|
4729
|
+
if (!panel || !target || target.closest(INTERACTIVE)) return;
|
|
4730
|
+
const sheet = options.sheet() && isSheetViewport();
|
|
4731
|
+
const grip = target.closest("[data-part=\"handle\"], [data-part=\"header\"]");
|
|
4732
|
+
if (sheet) {
|
|
4733
|
+
if (!grip) return;
|
|
4734
|
+
} else {
|
|
4735
|
+
if (event.pointerType !== "touch" && !grip) return;
|
|
4736
|
+
if (scrollsSideways(target, panel)) return;
|
|
4737
|
+
}
|
|
4738
|
+
begin(event.clientX, event.clientY, sheet ? "y" : "x");
|
|
4739
|
+
pointerId = event.pointerId;
|
|
4740
|
+
window.addEventListener("pointermove", onPointerMove);
|
|
4741
|
+
window.addEventListener("pointerup", onPointerEnd);
|
|
4742
|
+
window.addEventListener("pointercancel", onPointerCancel);
|
|
4743
|
+
}
|
|
4744
|
+
function onPointerMove(event) {
|
|
4745
|
+
if (event.pointerId !== pointerId) return;
|
|
4746
|
+
if (track(event.clientX, event.clientY)) event.preventDefault();
|
|
4747
|
+
}
|
|
4748
|
+
function stopPointer() {
|
|
4749
|
+
pointerId = null;
|
|
4750
|
+
window.removeEventListener("pointermove", onPointerMove);
|
|
4751
|
+
window.removeEventListener("pointerup", onPointerEnd);
|
|
4752
|
+
window.removeEventListener("pointercancel", onPointerCancel);
|
|
4753
|
+
}
|
|
4754
|
+
function onPointerEnd(event) {
|
|
4755
|
+
if (event.pointerId !== pointerId) return;
|
|
4756
|
+
stopPointer();
|
|
4757
|
+
release();
|
|
4758
|
+
}
|
|
4759
|
+
/** The browser took the gesture over (a scroll): put the panel back. */
|
|
4760
|
+
function onPointerCancel(event) {
|
|
4761
|
+
if (event.pointerId !== pointerId) return;
|
|
4762
|
+
stopPointer();
|
|
4763
|
+
if (gesture?.engaged) gesture.position = 0;
|
|
4764
|
+
release();
|
|
4765
|
+
}
|
|
4766
|
+
/** A drag that ended over the panel must not also click what it ended on. */
|
|
4767
|
+
function onClickCapture(event) {
|
|
4768
|
+
if (!suppressClick) return;
|
|
4769
|
+
suppressClick = false;
|
|
4770
|
+
event.preventDefault();
|
|
4771
|
+
event.stopPropagation();
|
|
4772
|
+
}
|
|
4773
|
+
let touchId = null;
|
|
4774
|
+
function onTouchStart(event) {
|
|
4775
|
+
const body = options.body.value;
|
|
4776
|
+
if (!options.enabled() || !options.sheet() || !isSheetViewport() || gesture || !body) return;
|
|
4777
|
+
const touch = event.changedTouches[0];
|
|
4778
|
+
const target = event.target;
|
|
4779
|
+
if (!touch || event.touches.length > 1 || !target || target.closest(INTERACTIVE)) return;
|
|
4780
|
+
if (body.scrollTop > 0) return;
|
|
4781
|
+
touchId = touch.identifier;
|
|
4782
|
+
begin(touch.clientX, touch.clientY, "y");
|
|
4783
|
+
}
|
|
4784
|
+
function onTouchMove(event) {
|
|
4785
|
+
if (touchId === null) return;
|
|
4786
|
+
const touch = [...event.changedTouches].find((t) => t.identifier === touchId);
|
|
4787
|
+
if (!touch) return;
|
|
4788
|
+
if ((options.body.value?.scrollTop ?? 0) > 0 && !gesture?.engaged) {
|
|
4789
|
+
touchId = null;
|
|
4790
|
+
gesture = null;
|
|
4791
|
+
return;
|
|
4792
|
+
}
|
|
4793
|
+
if (track(touch.clientX, touch.clientY)) event.preventDefault();
|
|
4794
|
+
else if (!gesture) touchId = null;
|
|
4795
|
+
}
|
|
4796
|
+
function onTouchEnd(event) {
|
|
4797
|
+
if (touchId === null) return;
|
|
4798
|
+
if (![...event.changedTouches].some((t) => t.identifier === touchId)) return;
|
|
4799
|
+
touchId = null;
|
|
4800
|
+
release();
|
|
4801
|
+
}
|
|
4802
|
+
onMounted(() => options.dialog.value?.addEventListener("click", onClickCapture, true));
|
|
4803
|
+
onBeforeUnmount(() => {
|
|
4804
|
+
options.dialog.value?.removeEventListener("click", onClickCapture, true);
|
|
4805
|
+
stopPointer();
|
|
4806
|
+
});
|
|
4807
|
+
return {
|
|
4808
|
+
onPointerDown,
|
|
4809
|
+
onTouchStart,
|
|
4810
|
+
onTouchMove,
|
|
4811
|
+
onTouchEnd,
|
|
4812
|
+
reset
|
|
4813
|
+
};
|
|
4814
|
+
}
|
|
4587
4815
|
// src/components/drawer/Drawer.vue?vue&type=script&setup=true&lang.ts
|
|
4588
4816
|
var _hoisted_1$37 = [
|
|
4589
4817
|
"data-eldra-scope",
|
|
4590
4818
|
"aria-labelledby",
|
|
4591
|
-
"aria-label"
|
|
4819
|
+
"aria-label",
|
|
4820
|
+
"data-side"
|
|
4592
4821
|
];
|
|
4593
4822
|
var _hoisted_2$30 = ["data-eldra-slot"];
|
|
4594
4823
|
var _hoisted_3$22 = ["data-eldra-scope", "id"];
|
|
4595
4824
|
var _hoisted_4$14 = ["aria-label"];
|
|
4596
4825
|
var _hoisted_5$10 = ["data-eldra-slot"];
|
|
4597
4826
|
var _hoisted_6$6 = ["data-eldra-slot"];
|
|
4827
|
+
var handleBarClass = "eldra:block eldra:h-1 eldra:w-9 eldra:rounded-full eldra:bg-[var(--eldra-drawer-handle-color,var(--eldra-color-border-strong))]";
|
|
4828
|
+
/** `--eldra-drawer-width` from the `width` prop, left unset so the utility's own literal default
|
|
4829
|
+
* (28rem) applies when the prop is omitted. */
|
|
4598
4830
|
var titleAreaClass = "eldra:min-w-0 eldra:flex-1";
|
|
4599
4831
|
// src/components/drawer/Drawer.vue
|
|
4600
4832
|
var Drawer_default = /* @__PURE__ */ defineComponent({
|
|
@@ -4609,6 +4841,14 @@ var Drawer_default = /* @__PURE__ */ defineComponent({
|
|
|
4609
4841
|
ariaLabel: { default: void 0 },
|
|
4610
4842
|
count: { default: void 0 },
|
|
4611
4843
|
width: { default: void 0 },
|
|
4844
|
+
mobileSheet: {
|
|
4845
|
+
type: Boolean,
|
|
4846
|
+
default: false
|
|
4847
|
+
},
|
|
4848
|
+
swipe: {
|
|
4849
|
+
type: Boolean,
|
|
4850
|
+
default: true
|
|
4851
|
+
},
|
|
4612
4852
|
messages: { default: void 0 },
|
|
4613
4853
|
classes: { default: void 0 }
|
|
4614
4854
|
},
|
|
@@ -4643,6 +4883,8 @@ var Drawer_default = /* @__PURE__ */ defineComponent({
|
|
|
4643
4883
|
* every stateful component in this package uses. */
|
|
4644
4884
|
const model = useControllableModel(props, emit, () => false);
|
|
4645
4885
|
const dialogEl = ref(null);
|
|
4886
|
+
const panelEl = ref(null);
|
|
4887
|
+
const bodyEl = ref(null);
|
|
4646
4888
|
const closeButtonEl = ref(null);
|
|
4647
4889
|
const titleId = useUiId("drawer-title");
|
|
4648
4890
|
const { close, isTop } = useDialog({
|
|
@@ -4660,6 +4902,18 @@ var Drawer_default = /* @__PURE__ */ defineComponent({
|
|
|
4660
4902
|
}),
|
|
4661
4903
|
onCancel: () => emit("cancel")
|
|
4662
4904
|
});
|
|
4905
|
+
const drag = useDrawerDrag({
|
|
4906
|
+
dialog: dialogEl,
|
|
4907
|
+
panel: panelEl,
|
|
4908
|
+
body: bodyEl,
|
|
4909
|
+
side: () => props.side,
|
|
4910
|
+
sheet: () => props.mobileSheet,
|
|
4911
|
+
enabled: () => props.swipe,
|
|
4912
|
+
dismiss: () => close("swipe")
|
|
4913
|
+
});
|
|
4914
|
+
watch(model, (open) => {
|
|
4915
|
+
if (open) drag.reset();
|
|
4916
|
+
});
|
|
4663
4917
|
/** The one place the public `close` event is emitted, for every closing route at once — see
|
|
4664
4918
|
* `Dialog.vue`'s own comment on this exact pattern, including the `"programmatic"` reason a plain
|
|
4665
4919
|
* external close (a parent setting `modelValue` to `false` directly) now reads. */
|
|
@@ -4691,10 +4945,11 @@ var Drawer_default = /* @__PURE__ */ defineComponent({
|
|
|
4691
4945
|
* child panel to `side` — `justify-end`/`justify-start`, not a per-side inset, so the same panel
|
|
4692
4946
|
* markup works for both without swapping which physical side it reads its position from.
|
|
4693
4947
|
*
|
|
4694
|
-
* The
|
|
4695
|
-
*
|
|
4696
|
-
* moves
|
|
4697
|
-
*
|
|
4948
|
+
* The motion is `eldra-drawer-motion` (see its comment in `utilities.css`): the panel slides a
|
|
4949
|
+
* short way in from its edge and fades, the backdrop fades, and closing plays the same in reverse.
|
|
4950
|
+
* It moves the panel, never this root, so a fixed descendant keeps the viewport as its containing
|
|
4951
|
+
* block. With `mobileSheet`, below 48rem the root becomes a column that sets the panel on the
|
|
4952
|
+
* bottom edge and `eldra-drawer-sheet` turns the slide into a rise from below.
|
|
4698
4953
|
*
|
|
4699
4954
|
* `hidden open:flex`, not a bare `flex` (fix, from the operator's own finding — see `Dialog`'s
|
|
4700
4955
|
* own rootClass comment for the full mechanism): a bare `flex` here is exactly what left a closed
|
|
@@ -4705,8 +4960,8 @@ var Drawer_default = /* @__PURE__ */ defineComponent({
|
|
|
4705
4960
|
const rootClass = computed(() => [
|
|
4706
4961
|
"eldra:fixed eldra:inset-0 eldra:m-0 eldra:hidden eldra:open:flex eldra:h-auto eldra:max-h-none eldra:w-full eldra:max-w-none eldra:border-0 eldra:bg-transparent eldra:p-0 eldra:text-text",
|
|
4707
4962
|
props.side === "left" ? "eldra:justify-start" : "eldra:justify-end",
|
|
4708
|
-
"eldra:backdrop:bg-overlay eldra:focus:outline-none",
|
|
4709
|
-
props.
|
|
4963
|
+
"eldra:overflow-clip eldra:backdrop:bg-overlay eldra:focus:outline-none eldra:eldra-drawer-motion",
|
|
4964
|
+
props.mobileSheet && "eldra:eldra-drawer-sheet eldra:max-md:flex-col eldra:max-md:justify-end"
|
|
4710
4965
|
]);
|
|
4711
4966
|
/**
|
|
4712
4967
|
* The visible sheet (spec "Drawer" → Sizes): full viewport height pinned to its edge, the width
|
|
@@ -4720,14 +4975,22 @@ var Drawer_default = /* @__PURE__ */ defineComponent({
|
|
|
4720
4975
|
"eldra:flex eldra:h-full eldra:max-h-full eldra:min-w-0 eldra:flex-col eldra:bg-background eldra:text-text eldra:shadow-md",
|
|
4721
4976
|
"eldra:eldra-drawer-width",
|
|
4722
4977
|
props.side === "left" ? "eldra:border-r eldra:border-border eldra:max-md:border-r-0" : "eldra:border-l eldra:border-border eldra:max-md:border-l-0",
|
|
4978
|
+
props.mobileSheet && "eldra:max-md:h-auto eldra:max-md:eldra-drawer-sheet-height eldra:max-md:border-t eldra:max-md:rounded-t-[var(--eldra-drawer-sheet-radius,var(--eldra-radius-xl))]",
|
|
4979
|
+
props.swipe && (props.mobileSheet ? "eldra:md:touch-pan-y eldra:md:touch-pinch-zoom" : "eldra:touch-pan-y eldra:touch-pinch-zoom"),
|
|
4723
4980
|
props.classes?.panel
|
|
4724
4981
|
]);
|
|
4725
|
-
/**
|
|
4726
|
-
*
|
|
4982
|
+
/**
|
|
4983
|
+
* The sheet's grab handle: a short bar centred above the header, below 48rem only. Decorative to
|
|
4984
|
+
* assistive technology (the close button and `Esc` close it); its row, with the header below it,
|
|
4985
|
+
* is where the sheet is dragged, so neither lets the browser take the touch for a scroll.
|
|
4986
|
+
*/
|
|
4987
|
+
const handleClass = computed(() => ["eldra:flex eldra:shrink-0 eldra:cursor-grab eldra:touch-none eldra:justify-center eldra:pt-2 eldra:pb-1 eldra:md:hidden", props.classes?.handle]);
|
|
4727
4988
|
const panelStyle = computed(() => props.width === void 0 ? void 0 : { "--eldra-drawer-width": props.width });
|
|
4728
4989
|
const headerClass = computed(() => [
|
|
4729
4990
|
"eldra:flex eldra:shrink-0 eldra:items-center eldra:gap-4 eldra:border-b eldra:border-border",
|
|
4730
4991
|
"eldra:eldra-drawer-header-height eldra:eldra-drawer-gutter eldra:eldra-drawer-header-top eldra:eldra-drawer-header-bottom",
|
|
4992
|
+
props.mobileSheet && "eldra:max-md:min-h-0 eldra:max-md:pt-1 eldra:max-md:touch-none",
|
|
4993
|
+
props.swipe && "eldra:select-none",
|
|
4731
4994
|
props.classes?.header
|
|
4732
4995
|
]);
|
|
4733
4996
|
/** A plain layout spacer, not a named part: `flex-1` so it claims every pixel the title does not
|
|
@@ -4769,12 +5032,22 @@ var Drawer_default = /* @__PURE__ */ defineComponent({
|
|
|
4769
5032
|
class: normalizeClass(rootClass.value),
|
|
4770
5033
|
"aria-labelledby": __props.title ? unref(titleId) : void 0,
|
|
4771
5034
|
"aria-label": !__props.title ? __props.ariaLabel : void 0,
|
|
5035
|
+
"data-side": __props.side,
|
|
4772
5036
|
onClose: onNativeClose
|
|
4773
5037
|
}, [createElementVNode("div", {
|
|
5038
|
+
ref_key: "panelEl",
|
|
5039
|
+
ref: panelEl,
|
|
4774
5040
|
"data-part": "panel",
|
|
4775
5041
|
class: normalizeClass(panelClass.value),
|
|
4776
|
-
style: normalizeStyle(panelStyle.value)
|
|
5042
|
+
style: normalizeStyle(panelStyle.value),
|
|
5043
|
+
onPointerdown: _cache[4] || (_cache[4] = (...args) => unref(drag).onPointerDown && unref(drag).onPointerDown(...args))
|
|
4777
5044
|
}, [
|
|
5045
|
+
__props.mobileSheet ? (openBlock(), createElementBlock("div", {
|
|
5046
|
+
key: 0,
|
|
5047
|
+
"data-part": "handle",
|
|
5048
|
+
"aria-hidden": "true",
|
|
5049
|
+
class: normalizeClass(handleClass.value)
|
|
5050
|
+
}, [createElementVNode("span", { class: normalizeClass(handleBarClass) })], 2)) : createCommentVNode("", true),
|
|
4778
5051
|
createElementVNode("div", {
|
|
4779
5052
|
"data-part": "header",
|
|
4780
5053
|
class: normalizeClass(headerClass.value)
|
|
@@ -4799,7 +5072,7 @@ var Drawer_default = /* @__PURE__ */ defineComponent({
|
|
|
4799
5072
|
class: normalizeClass(closeClass.value),
|
|
4800
5073
|
"aria-label": closeLabel.value,
|
|
4801
5074
|
onClick: onCloseClick
|
|
4802
|
-
}, [..._cache[
|
|
5075
|
+
}, [..._cache[5] || (_cache[5] = [createElementVNode("svg", {
|
|
4803
5076
|
class: "eldra:size-4",
|
|
4804
5077
|
viewBox: "0 0 24 24",
|
|
4805
5078
|
fill: "none",
|
|
@@ -4811,17 +5084,23 @@ var Drawer_default = /* @__PURE__ */ defineComponent({
|
|
|
4811
5084
|
focusable: "false"
|
|
4812
5085
|
}, [createElementVNode("path", { d: "M18 6l-12 12" }), createElementVNode("path", { d: "M6 6l12 12" })], -1)])], 10, _hoisted_4$14)], 2),
|
|
4813
5086
|
createElementVNode("div", {
|
|
5087
|
+
ref_key: "bodyEl",
|
|
5088
|
+
ref: bodyEl,
|
|
4814
5089
|
"data-eldra-slot": unref(eldra).slotHost("default"),
|
|
4815
5090
|
"data-part": "body",
|
|
4816
|
-
class: normalizeClass(bodyClass.value)
|
|
4817
|
-
|
|
5091
|
+
class: normalizeClass(bodyClass.value),
|
|
5092
|
+
onTouchstart: _cache[0] || (_cache[0] = (...args) => unref(drag).onTouchStart && unref(drag).onTouchStart(...args)),
|
|
5093
|
+
onTouchmove: _cache[1] || (_cache[1] = (...args) => unref(drag).onTouchMove && unref(drag).onTouchMove(...args)),
|
|
5094
|
+
onTouchend: _cache[2] || (_cache[2] = (...args) => unref(drag).onTouchEnd && unref(drag).onTouchEnd(...args)),
|
|
5095
|
+
onTouchcancel: _cache[3] || (_cache[3] = (...args) => unref(drag).onTouchEnd && unref(drag).onTouchEnd(...args))
|
|
5096
|
+
}, [renderSlot(_ctx.$slots, "default")], 42, _hoisted_5$10),
|
|
4818
5097
|
unref(slots).footer ? (openBlock(), createElementBlock("div", {
|
|
4819
|
-
key:
|
|
5098
|
+
key: 1,
|
|
4820
5099
|
"data-eldra-slot": unref(eldra).slotHost("footer"),
|
|
4821
5100
|
"data-part": "footer",
|
|
4822
5101
|
class: normalizeClass(footerClass.value)
|
|
4823
5102
|
}, [renderSlot(_ctx.$slots, "footer")], 10, _hoisted_6$6)) : createCommentVNode("", true)
|
|
4824
|
-
],
|
|
5103
|
+
], 38)], 42, _hoisted_1$37);
|
|
4825
5104
|
};
|
|
4826
5105
|
}
|
|
4827
5106
|
});
|
package/dist/style.css
CHANGED
|
@@ -1520,6 +1520,79 @@
|
|
|
1520
1520
|
translate: var(--tw-translate-x) var(--tw-translate-y);
|
|
1521
1521
|
}
|
|
1522
1522
|
|
|
1523
|
+
.eldra\:eldra-drawer-motion {
|
|
1524
|
+
--eldra-drawer-slide-x: var(--eldra-drawer-slide, 2rem);
|
|
1525
|
+
--eldra-drawer-enter: var(--eldra-drawer-enter-duration, .4s);
|
|
1526
|
+
--eldra-drawer-exit: var(--eldra-drawer-exit-duration, .26s);
|
|
1527
|
+
--eldra-drawer-curve: var(--eldra-drawer-ease, cubic-bezier(.32, .72, 0, 1));
|
|
1528
|
+
transition-behavior: allow-discrete;
|
|
1529
|
+
transition-property: display, overlay;
|
|
1530
|
+
transition-duration: var(--eldra-drawer-enter);
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
.eldra\:eldra-drawer-motion[data-side="left"] {
|
|
1534
|
+
--eldra-drawer-slide-x: calc(-1 * var(--eldra-drawer-slide, 2rem));
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
.eldra\:eldra-drawer-motion:not([open]) {
|
|
1538
|
+
transition-duration: var(--eldra-drawer-exit);
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
.eldra\:eldra-drawer-motion::backdrop {
|
|
1542
|
+
opacity: calc(1 - var(--eldra-drawer-drag, 0));
|
|
1543
|
+
transition-behavior: allow-discrete;
|
|
1544
|
+
transition-property: opacity, display, overlay;
|
|
1545
|
+
transition-duration: var(--eldra-drawer-enter);
|
|
1546
|
+
transition-timing-function: var(--eldra-drawer-curve);
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
.eldra\:eldra-drawer-motion:not([open])::backdrop {
|
|
1550
|
+
opacity: 0;
|
|
1551
|
+
transition-duration: var(--eldra-drawer-exit);
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
.eldra\:eldra-drawer-motion > [data-part="panel"] {
|
|
1555
|
+
transition-property: translate, opacity;
|
|
1556
|
+
transition-duration: var(--eldra-drawer-enter);
|
|
1557
|
+
transition-timing-function: var(--eldra-drawer-curve);
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
.eldra\:eldra-drawer-motion:not([open]) > [data-part="panel"] {
|
|
1561
|
+
translate: calc(var(--eldra-drawer-slide-x) * var(--eldra-drawer-axis-x, 1) + 100% * var(--eldra-drawer-away-x, 0)) calc(100% * var(--eldra-drawer-axis-y, 0));
|
|
1562
|
+
opacity: var(--eldra-drawer-from-opacity, 0);
|
|
1563
|
+
transition-duration: var(--eldra-drawer-exit);
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
@starting-style {
|
|
1567
|
+
.eldra\:eldra-drawer-motion[open] > [data-part="panel"] {
|
|
1568
|
+
translate: calc(var(--eldra-drawer-slide-x) * var(--eldra-drawer-axis-x, 1) + 100% * var(--eldra-drawer-away-x, 0)) calc(100% * var(--eldra-drawer-axis-y, 0));
|
|
1569
|
+
opacity: var(--eldra-drawer-from-opacity, 0);
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
.eldra\:eldra-drawer-motion[open]::backdrop {
|
|
1573
|
+
opacity: 0;
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
.eldra\:eldra-drawer-motion[data-dragging] {
|
|
1578
|
+
-webkit-user-select: none;
|
|
1579
|
+
user-select: none;
|
|
1580
|
+
cursor: grabbing;
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1583
|
+
.eldra\:eldra-drawer-motion[data-dragging] > [data-part="panel"], .eldra\:eldra-drawer-motion[data-dragging]::backdrop {
|
|
1584
|
+
transition-duration: 0s;
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1588
|
+
.eldra\:eldra-drawer-motion {
|
|
1589
|
+
--eldra-drawer-slide-x: 0px;
|
|
1590
|
+
--eldra-drawer-enter: var(--eldra-duration-base);
|
|
1591
|
+
--eldra-drawer-exit: var(--eldra-duration-base);
|
|
1592
|
+
--eldra-drawer-curve: linear;
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1523
1596
|
.eldra\:scale-0 {
|
|
1524
1597
|
--tw-scale-x: 0%;
|
|
1525
1598
|
--tw-scale-y: 0%;
|
|
@@ -1556,14 +1629,6 @@
|
|
|
1556
1629
|
animation: eldra-dialog-in var(--eldra-duration-slow) var(--eldra-ease-out);
|
|
1557
1630
|
}
|
|
1558
1631
|
|
|
1559
|
-
.eldra\:animate-eldra-drawer-in-left {
|
|
1560
|
-
animation: eldra-drawer-in-left var(--eldra-duration-slow) var(--eldra-ease-out);
|
|
1561
|
-
}
|
|
1562
|
-
|
|
1563
|
-
.eldra\:animate-eldra-drawer-in-right {
|
|
1564
|
-
animation: eldra-drawer-in-right var(--eldra-duration-slow) var(--eldra-ease-out);
|
|
1565
|
-
}
|
|
1566
|
-
|
|
1567
1632
|
.eldra\:animate-eldra-lightbox-in {
|
|
1568
1633
|
animation: eldra-lightbox-in var(--eldra-duration-slow) var(--eldra-ease-out);
|
|
1569
1634
|
}
|
|
@@ -1610,6 +1675,11 @@
|
|
|
1610
1675
|
touch-action: var(--tw-pan-x, ) var(--tw-pan-y, ) var(--tw-pinch-zoom, );
|
|
1611
1676
|
}
|
|
1612
1677
|
|
|
1678
|
+
.eldra\:touch-pinch-zoom {
|
|
1679
|
+
--tw-pinch-zoom: pinch-zoom;
|
|
1680
|
+
touch-action: var(--tw-pan-x, ) var(--tw-pan-y, ) var(--tw-pinch-zoom, );
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1613
1683
|
.eldra\:touch-none {
|
|
1614
1684
|
touch-action: none;
|
|
1615
1685
|
}
|
|
@@ -1868,6 +1938,10 @@
|
|
|
1868
1938
|
overflow: hidden;
|
|
1869
1939
|
}
|
|
1870
1940
|
|
|
1941
|
+
.eldra\:overflow-clip {
|
|
1942
|
+
overflow: clip;
|
|
1943
|
+
}
|
|
1944
|
+
|
|
1871
1945
|
.eldra\:overflow-hidden {
|
|
1872
1946
|
overflow: hidden;
|
|
1873
1947
|
}
|
|
@@ -2194,6 +2268,10 @@
|
|
|
2194
2268
|
background-color: var(--eldra-dialog-background, var(--eldra-color-background));
|
|
2195
2269
|
}
|
|
2196
2270
|
|
|
2271
|
+
.eldra\:bg-\[var\(--eldra-drawer-handle-color\,var\(--eldra-color-border-strong\)\)\] {
|
|
2272
|
+
background-color: var(--eldra-drawer-handle-color, var(--eldra-color-border-strong));
|
|
2273
|
+
}
|
|
2274
|
+
|
|
2197
2275
|
.eldra\:bg-accent {
|
|
2198
2276
|
background-color: var(--eldra-color-accent);
|
|
2199
2277
|
}
|
|
@@ -3654,6 +3732,14 @@
|
|
|
3654
3732
|
}
|
|
3655
3733
|
}
|
|
3656
3734
|
|
|
3735
|
+
@media (not (min-width: 48rem)) and (prefers-reduced-motion: no-preference) {
|
|
3736
|
+
.eldra\:eldra-drawer-sheet {
|
|
3737
|
+
--eldra-drawer-axis-x: 0;
|
|
3738
|
+
--eldra-drawer-axis-y: 1;
|
|
3739
|
+
--eldra-drawer-from-opacity: 1;
|
|
3740
|
+
}
|
|
3741
|
+
}
|
|
3742
|
+
|
|
3657
3743
|
.eldra\:eldra-field-invalid {
|
|
3658
3744
|
--eldra-focus-rest-width: var(--eldra-field-border-width, 1px);
|
|
3659
3745
|
--eldra-focus-rest-color: var(--eldra-color-danger);
|
|
@@ -4257,19 +4343,53 @@
|
|
|
4257
4343
|
height: 2.75rem;
|
|
4258
4344
|
}
|
|
4259
4345
|
|
|
4346
|
+
.eldra\:max-md\:h-auto {
|
|
4347
|
+
height: auto;
|
|
4348
|
+
}
|
|
4349
|
+
|
|
4260
4350
|
.eldra\:max-md\:h-screen {
|
|
4261
4351
|
height: 100vh;
|
|
4262
4352
|
}
|
|
4263
4353
|
|
|
4354
|
+
.eldra\:max-md\:eldra-drawer-sheet-height {
|
|
4355
|
+
max-height: calc(100% - var(--eldra-drawer-sheet-gap, 3rem) - env(safe-area-inset-top, 0px));
|
|
4356
|
+
}
|
|
4357
|
+
|
|
4358
|
+
.eldra\:max-md\:min-h-0 {
|
|
4359
|
+
min-height: 0;
|
|
4360
|
+
}
|
|
4361
|
+
|
|
4362
|
+
.eldra\:max-md\:touch-none {
|
|
4363
|
+
touch-action: none;
|
|
4364
|
+
}
|
|
4365
|
+
|
|
4366
|
+
.eldra\:max-md\:flex-col {
|
|
4367
|
+
flex-direction: column;
|
|
4368
|
+
}
|
|
4369
|
+
|
|
4370
|
+
.eldra\:max-md\:justify-end {
|
|
4371
|
+
justify-content: flex-end;
|
|
4372
|
+
}
|
|
4373
|
+
|
|
4264
4374
|
.eldra\:max-md\:rounded-none {
|
|
4265
4375
|
border-radius: 0;
|
|
4266
4376
|
}
|
|
4267
4377
|
|
|
4378
|
+
.eldra\:max-md\:rounded-t-\[var\(--eldra-drawer-sheet-radius\,var\(--eldra-radius-xl\)\)\] {
|
|
4379
|
+
border-top-left-radius: var(--eldra-drawer-sheet-radius, var(--eldra-radius-xl));
|
|
4380
|
+
border-top-right-radius: var(--eldra-drawer-sheet-radius, var(--eldra-radius-xl));
|
|
4381
|
+
}
|
|
4382
|
+
|
|
4268
4383
|
.eldra\:max-md\:border-0 {
|
|
4269
4384
|
border-style: var(--tw-border-style);
|
|
4270
4385
|
border-width: 0;
|
|
4271
4386
|
}
|
|
4272
4387
|
|
|
4388
|
+
.eldra\:max-md\:border-t {
|
|
4389
|
+
border-top-style: var(--tw-border-style);
|
|
4390
|
+
border-top-width: 1px;
|
|
4391
|
+
}
|
|
4392
|
+
|
|
4273
4393
|
.eldra\:max-md\:border-r-0 {
|
|
4274
4394
|
border-right-style: var(--tw-border-style);
|
|
4275
4395
|
border-right-width: 0;
|
|
@@ -4284,6 +4404,10 @@
|
|
|
4284
4404
|
padding-inline-end: 7.5rem;
|
|
4285
4405
|
}
|
|
4286
4406
|
|
|
4407
|
+
.eldra\:max-md\:pt-1 {
|
|
4408
|
+
padding-top: var(--eldra-space-1);
|
|
4409
|
+
}
|
|
4410
|
+
|
|
4287
4411
|
.eldra\:max-md\:pb-17 {
|
|
4288
4412
|
padding-bottom: 4.25rem;
|
|
4289
4413
|
}
|
|
@@ -4318,6 +4442,16 @@
|
|
|
4318
4442
|
display: inline-flex;
|
|
4319
4443
|
}
|
|
4320
4444
|
|
|
4445
|
+
.eldra\:md\:touch-pan-y {
|
|
4446
|
+
--tw-pan-y: pan-y;
|
|
4447
|
+
touch-action: var(--tw-pan-x, ) var(--tw-pan-y, ) var(--tw-pinch-zoom, );
|
|
4448
|
+
}
|
|
4449
|
+
|
|
4450
|
+
.eldra\:md\:touch-pinch-zoom {
|
|
4451
|
+
--tw-pinch-zoom: pinch-zoom;
|
|
4452
|
+
touch-action: var(--tw-pan-x, ) var(--tw-pan-y, ) var(--tw-pinch-zoom, );
|
|
4453
|
+
}
|
|
4454
|
+
|
|
4321
4455
|
.eldra\:md\:text-body-sm {
|
|
4322
4456
|
font-family: var(--eldra-text-body-sm-family);
|
|
4323
4457
|
font-size: var(--eldra-text-body-sm-size);
|
package/dist/utilities.css
CHANGED
|
@@ -1765,6 +1765,106 @@
|
|
|
1765
1765
|
animation: eldra-drawer-in-left var(--eldra-duration-slow) var(--eldra-ease-out);
|
|
1766
1766
|
}
|
|
1767
1767
|
|
|
1768
|
+
/* The drawer's motion, on the `<dialog>` root. The panel enters from its own edge and leaves
|
|
1769
|
+
toward it: a short slide (`--eldra-drawer-slide`, 2rem) and a fade, eased like a native sheet,
|
|
1770
|
+
so it reads as arriving rather than travelling across the screen. The backdrop fades with it.
|
|
1771
|
+
Both directions are plain transitions: `@starting-style` gives the opening frame, and `display`
|
|
1772
|
+
and `overlay` transition discretely so a closed dialog stays painted, in the top layer, until
|
|
1773
|
+
the panel has gone. Where a browser lacks either, it opens and closes at once. On the root,
|
|
1774
|
+
never as a transform of the root: a full-viewport transform makes the root the containing block
|
|
1775
|
+
for any fixed descendant.
|
|
1776
|
+
|
|
1777
|
+
`--eldra-drawer-drag` (0 to 1, set while a `mobileSheet` drawer is dragged) fades the backdrop
|
|
1778
|
+
with the panel's distance from rest; `data-dragging` stops both from easing behind the finger.
|
|
1779
|
+
The panel's resting offset is computed from `--eldra-drawer-axis-x`/`-y`, `--eldra-drawer-away-x`
|
|
1780
|
+
and `--eldra-drawer-from-opacity`, which this utility never sets, so `eldra-drawer-sheet` below
|
|
1781
|
+
can turn the side slide into a bottom sheet, and a swipe can send the panel all the way off its
|
|
1782
|
+
edge, without a selector of its own to outrank. */
|
|
1783
|
+
@utility eldra-drawer-motion {
|
|
1784
|
+
--eldra-drawer-slide-x: var(--eldra-drawer-slide, 2rem);
|
|
1785
|
+
--eldra-drawer-enter: var(--eldra-drawer-enter-duration, 400ms);
|
|
1786
|
+
--eldra-drawer-exit: var(--eldra-drawer-exit-duration, 260ms);
|
|
1787
|
+
--eldra-drawer-curve: var(--eldra-drawer-ease, cubic-bezier(0.32, 0.72, 0, 1));
|
|
1788
|
+
transition-property: display, overlay;
|
|
1789
|
+
transition-behavior: allow-discrete;
|
|
1790
|
+
transition-duration: var(--eldra-drawer-enter);
|
|
1791
|
+
&[data-side='left'] {
|
|
1792
|
+
--eldra-drawer-slide-x: calc(-1 * var(--eldra-drawer-slide, 2rem));
|
|
1793
|
+
}
|
|
1794
|
+
&:not([open]) {
|
|
1795
|
+
transition-duration: var(--eldra-drawer-exit);
|
|
1796
|
+
}
|
|
1797
|
+
&::backdrop {
|
|
1798
|
+
opacity: calc(1 - var(--eldra-drawer-drag, 0));
|
|
1799
|
+
transition-property: opacity, display, overlay;
|
|
1800
|
+
transition-behavior: allow-discrete;
|
|
1801
|
+
transition-duration: var(--eldra-drawer-enter);
|
|
1802
|
+
transition-timing-function: var(--eldra-drawer-curve);
|
|
1803
|
+
}
|
|
1804
|
+
&:not([open])::backdrop {
|
|
1805
|
+
opacity: 0;
|
|
1806
|
+
transition-duration: var(--eldra-drawer-exit);
|
|
1807
|
+
}
|
|
1808
|
+
& > [data-part='panel'] {
|
|
1809
|
+
transition-property: translate, opacity;
|
|
1810
|
+
transition-duration: var(--eldra-drawer-enter);
|
|
1811
|
+
transition-timing-function: var(--eldra-drawer-curve);
|
|
1812
|
+
}
|
|
1813
|
+
&:not([open]) > [data-part='panel'] {
|
|
1814
|
+
translate: calc(
|
|
1815
|
+
var(--eldra-drawer-slide-x) * var(--eldra-drawer-axis-x, 1) + 100% *
|
|
1816
|
+
var(--eldra-drawer-away-x, 0)
|
|
1817
|
+
)
|
|
1818
|
+
calc(100% * var(--eldra-drawer-axis-y, 0));
|
|
1819
|
+
opacity: var(--eldra-drawer-from-opacity, 0);
|
|
1820
|
+
transition-duration: var(--eldra-drawer-exit);
|
|
1821
|
+
}
|
|
1822
|
+
@starting-style {
|
|
1823
|
+
&[open] > [data-part='panel'] {
|
|
1824
|
+
translate: calc(
|
|
1825
|
+
var(--eldra-drawer-slide-x) * var(--eldra-drawer-axis-x, 1) + 100% *
|
|
1826
|
+
var(--eldra-drawer-away-x, 0)
|
|
1827
|
+
)
|
|
1828
|
+
calc(100% * var(--eldra-drawer-axis-y, 0));
|
|
1829
|
+
opacity: var(--eldra-drawer-from-opacity, 0);
|
|
1830
|
+
}
|
|
1831
|
+
&[open]::backdrop {
|
|
1832
|
+
opacity: 0;
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
&[data-dragging] {
|
|
1836
|
+
user-select: none;
|
|
1837
|
+
cursor: grabbing;
|
|
1838
|
+
}
|
|
1839
|
+
&[data-dragging] > [data-part='panel'],
|
|
1840
|
+
&[data-dragging]::backdrop {
|
|
1841
|
+
transition-duration: 0s;
|
|
1842
|
+
}
|
|
1843
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1844
|
+
--eldra-drawer-slide-x: 0px;
|
|
1845
|
+
--eldra-drawer-enter: var(--eldra-duration-base);
|
|
1846
|
+
--eldra-drawer-exit: var(--eldra-duration-base);
|
|
1847
|
+
--eldra-drawer-curve: linear;
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
/* `Drawer`'s `mobileSheet`: below the drawer's 48rem viewport edge the panel rises from the bottom
|
|
1852
|
+
instead of sliding in from its side, and leaves the same way. Variables only; the motion is
|
|
1853
|
+
`eldra-drawer-motion`'s. Reduced motion keeps that utility's plain fade. */
|
|
1854
|
+
@utility eldra-drawer-sheet {
|
|
1855
|
+
@media (width < 48rem) and (prefers-reduced-motion: no-preference) {
|
|
1856
|
+
--eldra-drawer-axis-x: 0;
|
|
1857
|
+
--eldra-drawer-axis-y: 1;
|
|
1858
|
+
--eldra-drawer-from-opacity: 1;
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
/* The sheet's height cap: it fits its content up to the viewport less `--eldra-drawer-sheet-gap`
|
|
1863
|
+
(3rem), so the page above it stays in view and reads as the thing it was opened from. */
|
|
1864
|
+
@utility eldra-drawer-sheet-height {
|
|
1865
|
+
max-height: calc(100% - var(--eldra-drawer-sheet-gap, 3rem) - env(safe-area-inset-top, 0px));
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1768
1868
|
/* --- Search modal ------------------------------------------------------------------------------ */
|
|
1769
1869
|
|
|
1770
1870
|
/* The field's own type (spec "Search modal" → Sizes, Field row): "1.0625rem text" (desktop and
|
package/dist/vee-validate.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as focusInvalid, L as CurrencyInput_default, N as Input_default, R as UnitInput_default, _t as FIELD_KEY, b as MultiSelect_default, ft as CheckboxGroup_default, i as SearchBar_default, j as Switch_default, jt as useUiId, k as FormLayout_default, kt as useEldraScope, l as RadioGroup_default, n as Textarea_default, pt as Checkbox_default, r as Select_default, t as VariantPicker_default, y as QuantityStepper_default } from "./VariantPicker-
|
|
1
|
+
import { A as focusInvalid, L as CurrencyInput_default, N as Input_default, R as UnitInput_default, _t as FIELD_KEY, b as MultiSelect_default, ft as CheckboxGroup_default, i as SearchBar_default, j as Switch_default, jt as useUiId, k as FormLayout_default, kt as useEldraScope, l as RadioGroup_default, n as Textarea_default, pt as Checkbox_default, r as Select_default, t as VariantPicker_default, y as QuantityStepper_default } from "./VariantPicker-BB-2Cj32.js";
|
|
2
2
|
import { r as useMessages } from "./useMessages-B5nzZghs.js";
|
|
3
3
|
import { Fragment, computed, createBlock, createElementBlock, createElementVNode, createSlots, createTextVNode, defineComponent, guardReactiveProps, inject, isRef, mergeProps, nextTick, normalizeClass, normalizeProps, onMounted, onScopeDispose, openBlock, provide, ref, renderList, renderSlot, toDisplayString, unref, watch, withCtx } from "vue";
|
|
4
4
|
import { FormContextKey, useField, useForm } from "vee-validate";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eldrajs/ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "Accessible Vue 3 core components for Eldra storefronts: buttons, forms, selects, cards, overlays and navigation, themed through CSS design tokens.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessible",
|