@noxlovette/material 0.6.0 → 0.7.0
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/claude-skill/material-design/SKILL.md +5 -2
- package/claude-skill/material-design/references/accessibility-checklist.md +5 -0
- package/claude-skill/material-design/references/component-patterns.md +24 -3
- package/claude-skill/material-design/references/motion-guide.md +53 -11
- package/claude-skill/material-design/references/tokens-and-styles.md +4 -0
- package/dist/animation/TransitionPatterns.stories.svelte +50 -0
- package/dist/animation/containerTransform.js +10 -4
- package/dist/animation/reducedMotion.d.ts +2 -0
- package/dist/animation/reducedMotion.js +2 -0
- package/dist/animation/sharedAxisTransition.d.ts +20 -3
- package/dist/animation/sharedAxisTransition.js +67 -8
- package/dist/attachments/drag.d.ts +52 -0
- package/dist/attachments/drag.js +217 -0
- package/dist/attachments/index.d.ts +1 -0
- package/dist/attachments/index.js +1 -0
- package/dist/components/badge/theme.js +1 -1
- package/dist/components/buttons/button-group/theme.d.ts +1 -1
- package/dist/components/buttons/button-group/theme.js +1 -1
- package/dist/components/buttons/connected/theme.d.ts +1 -1
- package/dist/components/buttons/connected/theme.js +1 -1
- package/dist/components/buttons/split-button/SplitButton.svelte +1 -1
- package/dist/components/buttons/split-button/theme.d.ts +1 -1
- package/dist/components/buttons/split-button/theme.js +1 -1
- package/dist/components/buttons/theme.d.ts +1 -1
- package/dist/components/buttons/theme.js +3 -3
- package/dist/components/cards/theme.js +1 -1
- package/dist/components/chips/Chip.mdx +24 -11
- package/dist/components/chips/Chip.stories.svelte +10 -0
- package/dist/components/chips/Chip.svelte +58 -18
- package/dist/components/chips/Chip.svelte.d.ts +3 -1
- package/dist/components/chips/ChipGroup.stories.svelte +73 -0
- package/dist/components/chips/ChipGroup.stories.svelte.d.ts +4 -0
- package/dist/components/chips/ChipGroup.svelte +242 -0
- package/dist/components/chips/ChipGroup.svelte.d.ts +33 -0
- package/dist/components/chips/index.d.ts +1 -0
- package/dist/components/chips/index.js +1 -0
- package/dist/components/chips/theme.d.ts +183 -22
- package/dist/components/chips/theme.js +117 -26
- package/dist/components/chips/types.d.ts +36 -2
- package/dist/components/containers/action-rail/theme.d.ts +1 -1
- package/dist/components/containers/action-rail/theme.js +2 -2
- package/dist/components/containers/app/theme.d.ts +2 -2
- package/dist/components/containers/app/theme.js +2 -2
- package/dist/components/containers/bottom-sheet/BottomSheet.stories.svelte +1 -1
- package/dist/components/containers/bottom-sheet/theme.d.ts +1 -1
- package/dist/components/containers/bottom-sheet/theme.js +2 -2
- package/dist/components/containers/carousel/theme.d.ts +1 -1
- package/dist/components/containers/carousel/theme.js +1 -1
- package/dist/components/containers/context-menu/theme.d.ts +1 -1
- package/dist/components/containers/context-menu/theme.js +2 -2
- package/dist/components/containers/dialogue/Dialogue.svelte +1 -1
- package/dist/components/containers/dialogue/theme.d.ts +1 -1
- package/dist/components/containers/dialogue/theme.js +3 -3
- package/dist/components/containers/dialogue/types.d.ts +1 -1
- package/dist/components/containers/divider/theme.d.ts +1 -1
- package/dist/components/containers/divider/theme.js +1 -1
- package/dist/components/containers/link-preview/theme.d.ts +1 -1
- package/dist/components/containers/link-preview/theme.js +2 -2
- package/dist/components/containers/list/List.svelte +8 -2
- package/dist/components/containers/list/ListItem.mdx +6 -0
- package/dist/components/containers/list/ListItem.svelte +77 -2
- package/dist/components/containers/list/context.d.ts +14 -0
- package/dist/components/containers/list/theme.d.ts +7 -1
- package/dist/components/containers/list/theme.js +11 -3
- package/dist/components/containers/menu/Menu.svelte +1 -1
- package/dist/components/containers/menu/MenuSub.svelte +1 -1
- package/dist/components/containers/menu/theme.d.ts +1 -1
- package/dist/components/containers/menu/theme.js +1 -1
- package/dist/components/containers/pane/DraggablePane.svelte +25 -63
- package/dist/components/containers/pane/Pane.svelte +1 -1
- package/dist/components/containers/pane/theme.d.ts +1 -1
- package/dist/components/containers/pane/theme.js +35 -9
- package/dist/components/containers/popover/theme.d.ts +4 -4
- package/dist/components/containers/popover/theme.js +2 -2
- package/dist/components/containers/scroll-area/theme.js +1 -1
- package/dist/components/containers/side-sheet/theme.d.ts +1 -1
- package/dist/components/containers/side-sheet/theme.js +1 -1
- package/dist/components/date/theme.d.ts +7 -7
- package/dist/components/date/theme.js +1 -1
- package/dist/components/forms/checkbox/theme.d.ts +1 -1
- package/dist/components/forms/checkbox/theme.js +2 -2
- package/dist/components/forms/command/theme.d.ts +4 -4
- package/dist/components/forms/command/theme.js +1 -1
- package/dist/components/forms/pin/theme.d.ts +1 -1
- package/dist/components/forms/pin/theme.js +1 -1
- package/dist/components/forms/radio-group/theme.d.ts +1 -1
- package/dist/components/forms/radio-group/theme.js +1 -1
- package/dist/components/forms/search/theme.d.ts +1 -1
- package/dist/components/forms/search/theme.js +1 -1
- package/dist/components/forms/select/Select.svelte +2 -2
- package/dist/components/forms/select/theme.d.ts +1 -1
- package/dist/components/forms/select/theme.js +2 -2
- package/dist/components/forms/slider/theme.d.ts +1 -1
- package/dist/components/forms/slider/theme.js +1 -1
- package/dist/components/forms/switch/theme.d.ts +1 -1
- package/dist/components/forms/switch/theme.js +1 -1
- package/dist/components/forms/textfield/theme.d.ts +1 -1
- package/dist/components/forms/textfield/theme.js +1 -1
- package/dist/components/forms/toggle-group/theme.d.ts +1 -1
- package/dist/components/forms/toggle-group/theme.js +1 -1
- package/dist/components/forms/tooltip/theme.d.ts +1 -1
- package/dist/components/forms/tooltip/theme.js +2 -2
- package/dist/components/misc/Avatar.stories.svelte +56 -7
- package/dist/components/misc/Avatar.stories.svelte.d.ts +2 -17
- package/dist/components/misc/Avatar.svelte +82 -8
- package/dist/components/misc/Avatar.svelte.d.ts +5 -0
- package/dist/components/misc/ThemeSwitcher.svelte +1 -1
- package/dist/components/misc/theme.d.ts +6 -0
- package/dist/components/misc/theme.js +6 -4
- package/dist/components/misc/types.d.ts +17 -1
- package/dist/components/nav/appbar/theme.d.ts +1 -1
- package/dist/components/nav/appbar/theme.js +3 -2
- package/dist/components/nav/breadcrumb/theme.d.ts +1 -1
- package/dist/components/nav/breadcrumb/theme.js +1 -1
- package/dist/components/nav/currentRoute.d.ts +11 -0
- package/dist/components/nav/currentRoute.js +28 -0
- package/dist/components/nav/navbar/NavbarItem.svelte +3 -6
- package/dist/components/nav/navbar/theme.d.ts +3 -3
- package/dist/components/nav/navbar/theme.js +2 -2
- package/dist/components/nav/rail/Rail.mdx +65 -23
- package/dist/components/nav/rail/Rail.stories.svelte +24 -4
- package/dist/components/nav/rail/Rail.stories.svelte.d.ts +2 -17
- package/dist/components/nav/rail/Rail.svelte +165 -48
- package/dist/components/nav/rail/Rail.svelte.d.ts +6 -3
- package/dist/components/nav/rail/RailItem.svelte +122 -65
- package/dist/components/nav/rail/RailItem.svelte.d.ts +3 -2
- package/dist/components/nav/rail/theme.d.ts +70 -85
- package/dist/components/nav/rail/theme.js +80 -67
- package/dist/components/nav/rail/types.d.ts +4 -0
- package/dist/components/nav/tabs/Tabs.stories.svelte +2 -1
- package/dist/components/nav/tabs/theme.d.ts +1 -1
- package/dist/components/nav/tabs/theme.js +1 -1
- package/dist/components/pill/theme.d.ts +1 -1
- package/dist/components/pill/theme.js +1 -1
- package/dist/components/progress/LinearProgress.svelte +1 -1
- package/dist/components/snackbar/theme.d.ts +1 -1
- package/dist/components/snackbar/theme.js +2 -2
- package/dist/components/table/theme.d.ts +1 -1
- package/dist/components/table/theme.js +1 -1
- package/dist/components/time/TimeField.svelte +1 -1
- package/dist/components/time/theme.d.ts +1 -1
- package/dist/components/time/theme.js +1 -1
- package/dist/components/toolbar/theme.d.ts +1 -1
- package/dist/components/toolbar/theme.js +2 -2
- package/dist/components/typography/body/theme.d.ts +1 -1
- package/dist/components/typography/body/theme.js +1 -1
- package/dist/components/typography/display/theme.d.ts +1 -1
- package/dist/components/typography/display/theme.js +1 -1
- package/dist/components/typography/headline/theme.d.ts +1 -1
- package/dist/components/typography/headline/theme.js +1 -1
- package/dist/components/typography/kbd/theme.d.ts +1 -1
- package/dist/components/typography/kbd/theme.js +1 -1
- package/dist/components/typography/label/theme.js +1 -1
- package/dist/components/typography/title/theme.d.ts +1 -1
- package/dist/components/typography/title/theme.js +1 -1
- package/dist/index.css +3 -0
- package/dist/styles/components.css +50 -0
- package/dist/styles/icon.css +13 -0
- package/dist/styles/layers.css +33 -0
- package/dist/utils/icon/Icon.stories.svelte +97 -0
- package/dist/utils/icon/Icon.stories.svelte.d.ts +4 -0
- package/dist/utils/icon/Icon.svelte +101 -12
- package/dist/utils/icon/Icon.svelte.d.ts +9 -0
- package/dist/utils/icon/MaterialSymbolsProvider.svelte +11 -4
- package/dist/utils/icon/base-icons.d.ts +1 -1
- package/dist/utils/icon/base-icons.js +1 -1
- package/dist/utils/icon/icon-names.d.ts +2 -0
- package/dist/utils/icon/icon-names.js +2 -0
- package/dist/utils/icon/swap.d.ts +6 -0
- package/dist/utils/icon/swap.js +45 -0
- package/dist/utils/icon/theme.d.ts +1 -1
- package/dist/utils/icon/theme.js +1 -1
- package/dist/utils/icon/types.d.ts +59 -7
- package/dist/utils/tv.d.ts +5 -0
- package/dist/utils/tv.js +20 -0
- package/package.json +2 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { tv } from '
|
|
1
|
+
import { tv } from '../../../utils/tv.js';
|
|
2
2
|
/*
|
|
3
3
|
M3 Expressive lists (https://m3.material.io/components/lists/specs).
|
|
4
4
|
|
|
@@ -7,6 +7,11 @@ import { tv } from 'tailwind-variants';
|
|
|
7
7
|
`List` sets `--li-top`/`--li-bottom` to 16dp on its first/last child, so the list's outer
|
|
8
8
|
corners stay 16dp while the inner ones morph. Custom properties inherit, so this reaches an item
|
|
9
9
|
through its `<li>`; each `<ul>` resets both so nested lists start clean.
|
|
10
|
+
|
|
11
|
+
Selection: the selected fill is its own element rather than the item's background. When one
|
|
12
|
+
item loses the selection and another gains it in the same update (a nav list following the
|
|
13
|
+
route, a single-select list), the fill springs from where the old one was drawn to the new
|
|
14
|
+
item, like the tab indicator, instead of blinking out and in.
|
|
10
15
|
*/
|
|
11
16
|
export const list = tv({
|
|
12
17
|
base: 'flex w-full flex-col [--li-bottom:initial] [--li-top:initial]',
|
|
@@ -22,11 +27,14 @@ export const list = tv({
|
|
|
22
27
|
export const listItem = tv({
|
|
23
28
|
slots: {
|
|
24
29
|
base: [
|
|
25
|
-
'relative flex w-full min-w-spacing-0 gap-spacing-150 ps-spacing-200 pe-spacing-200 pt-spacing-125 pb-spacing-125 text-start',
|
|
30
|
+
'relative isolate flex w-full min-w-spacing-0 gap-spacing-150 ps-spacing-200 pe-spacing-200 pt-spacing-125 pb-spacing-125 text-start',
|
|
26
31
|
'[--li-shape:0.25rem] rounded-t-[var(--li-top,var(--li-shape))] rounded-b-[var(--li-bottom,var(--li-shape))]',
|
|
27
32
|
'transition-[border-radius,background-color,color] md-sys-motion-fast-spatial',
|
|
28
33
|
'text-md-sys-color-on-surface-variant'
|
|
29
34
|
],
|
|
35
|
+
/* The selected fill, under the item's content and state layer, in the item's shape. When the
|
|
36
|
+
selection moves within a List it springs over from the previous item (ListItem.svelte). */
|
|
37
|
+
selection: 'pointer-events-none absolute inset-spacing-0 -z-10 rounded-[inherit] bg-md-sys-color-secondary-container',
|
|
30
38
|
leading: 'flex shrink-0 items-center text-md-sys-color-on-surface-variant',
|
|
31
39
|
body: 'flex min-w-spacing-0 flex-1 flex-col justify-center',
|
|
32
40
|
overline: 'md-sys-typescale-label-small line-clamp-1 text-md-sys-color-on-surface-variant',
|
|
@@ -71,7 +79,7 @@ export const listItem = tv({
|
|
|
71
79
|
},
|
|
72
80
|
selected: {
|
|
73
81
|
true: {
|
|
74
|
-
base: '
|
|
82
|
+
base: 'text-md-sys-color-on-secondary-container [--li-shape:1rem] hover:[--li-shape:1rem]',
|
|
75
83
|
leading: 'text-md-sys-color-on-secondary-container',
|
|
76
84
|
overline: 'text-md-sys-color-on-secondary-container',
|
|
77
85
|
headline: 'text-md-sys-color-on-secondary-container',
|
|
@@ -44,7 +44,7 @@ Contrast with `MenuItem` (a single interactive row inside the panel) and
|
|
|
44
44
|
</DropdownMenu.Trigger>
|
|
45
45
|
|
|
46
46
|
<DropdownMenu.Portal>
|
|
47
|
-
<DropdownMenu.Content {align} sideOffset={4} class="z-
|
|
47
|
+
<DropdownMenu.Content {align} sideOffset={4} class="z-layer-popup">
|
|
48
48
|
{#snippet child({ wrapperProps, props, open: isOpen })}
|
|
49
49
|
<div {...wrapperProps} class={wrapperProps.class as any}>
|
|
50
50
|
<div
|
|
@@ -67,7 +67,7 @@ trigger row (`iconProps`/`helper`/`children` label) behaves like a
|
|
|
67
67
|
</DropdownMenu.SubTrigger>
|
|
68
68
|
|
|
69
69
|
<DropdownMenu.Portal>
|
|
70
|
-
<DropdownMenu.SubContent sideOffset={4} class="z-
|
|
70
|
+
<DropdownMenu.SubContent sideOffset={4} class="z-layer-popup">
|
|
71
71
|
{#snippet child({ wrapperProps, props, open: isOpen })}
|
|
72
72
|
<div {...wrapperProps} class={wrapperProps.class as any}>
|
|
73
73
|
<div
|
|
@@ -31,7 +31,7 @@ the pane itself stays `position: fixed` and doesn't move with either.
|
|
|
31
31
|
import { springTokens, springTransition } from '../../../animation/spring.js';
|
|
32
32
|
import { Icon, Layer } from '../../../utils/index.js';
|
|
33
33
|
import { ButtonIcon } from '../../buttons/index.js';
|
|
34
|
-
import { clickOutside } from '../../../attachments/index.js';
|
|
34
|
+
import { clickOutside, drag, resist } from '../../../attachments/index.js';
|
|
35
35
|
import { draggablePane, type ResizeEdge } from './theme.js';
|
|
36
36
|
import { dragPositions } from './dragStore.svelte.js';
|
|
37
37
|
import type { DraggablePaneProps } from './types.js';
|
|
@@ -313,11 +313,6 @@ the pane itself stays `position: fixed` and doesn't move with either.
|
|
|
313
313
|
the same spring. Grabbing the pane mid-spring stops it where it is.
|
|
314
314
|
*/
|
|
315
315
|
const SETTLE_SPRING = springTransition(springTokens.fastSpatial);
|
|
316
|
-
/* Share of the overshoot still applied at the edge, shrinking the further it's pulled. The
|
|
317
|
-
UIScrollView rubber-band constant — M3 has no token for this; tune by eye. */
|
|
318
|
-
const RUBBER_BAND = 0.55;
|
|
319
|
-
/* Pointer samples older than this don't count towards the release velocity. */
|
|
320
|
-
const VELOCITY_WINDOW_MS = 100;
|
|
321
316
|
|
|
322
317
|
let settleX: AnimationPlaybackControls | undefined;
|
|
323
318
|
let settleY: AnimationPlaybackControls | undefined;
|
|
@@ -352,61 +347,31 @@ the pane itself stays `position: fixed` and doesn't move with either.
|
|
|
352
347
|
if (persistKey) dragPositions.set(persistKey, { x: next.x, y: next.y, width, height });
|
|
353
348
|
}
|
|
354
349
|
|
|
355
|
-
/** Resisted overshoot: the further past the edge, the less the pane follows. */
|
|
356
|
-
function rubberBand(overshoot: number, limit: number) {
|
|
357
|
-
return (1 - 1 / ((overshoot * RUBBER_BAND) / limit + 1)) * limit;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
function resist(value: number, min: number, max: number, size: number) {
|
|
361
|
-
if (value < min) return min - rubberBand(min - value, size);
|
|
362
|
-
if (value > max) return max + rubberBand(value - max, size);
|
|
363
|
-
return value;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
let dragStartX = 0;
|
|
367
|
-
let dragStartY = 0;
|
|
368
350
|
let originX = 0;
|
|
369
351
|
let originY = 0;
|
|
370
|
-
let samples: { x: number; y: number; t: number }[] = [];
|
|
371
|
-
|
|
372
|
-
function startDrag(event: PointerEvent) {
|
|
373
|
-
if (disableDrag) return;
|
|
374
|
-
stopSettle();
|
|
375
|
-
dragging = true;
|
|
376
|
-
dragStartX = event.clientX;
|
|
377
|
-
dragStartY = event.clientY;
|
|
378
|
-
originX = x ?? initialX;
|
|
379
|
-
originY = y ?? initialY;
|
|
380
|
-
samples = [{ x: event.clientX, y: event.clientY, t: event.timeStamp }];
|
|
381
|
-
(event.currentTarget as HTMLElement).setPointerCapture(event.pointerId);
|
|
382
|
-
}
|
|
383
352
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
if (!dragging) return;
|
|
407
|
-
dragging = false;
|
|
408
|
-
settleTo(x ?? initialX, y ?? initialY, releaseVelocity());
|
|
409
|
-
}
|
|
353
|
+
// Pointer plumbing (capture, release velocity) and the rubber-band come from the shared drag
|
|
354
|
+
// attachment; this only positions the pane.
|
|
355
|
+
const dragPane = drag(() => ({
|
|
356
|
+
disabled: disableDrag,
|
|
357
|
+
onStart: () => {
|
|
358
|
+
stopSettle();
|
|
359
|
+
dragging = true;
|
|
360
|
+
originX = x ?? initialX;
|
|
361
|
+
originY = y ?? initialY;
|
|
362
|
+
},
|
|
363
|
+
onMove: (offset) => {
|
|
364
|
+
const rect = boundsRect();
|
|
365
|
+
const { x: minX, y: minY } = clamp(-Infinity, -Infinity);
|
|
366
|
+
const { x: maxX, y: maxY } = clamp(Infinity, Infinity);
|
|
367
|
+
x = resist(originX + offset.x, minX, maxX, rect.right - rect.left);
|
|
368
|
+
y = resist(originY + offset.y, minY, maxY, rect.bottom - rect.top);
|
|
369
|
+
},
|
|
370
|
+
onEnd: (velocity) => {
|
|
371
|
+
dragging = false;
|
|
372
|
+
settleTo(x ?? initialX, y ?? initialY, velocity);
|
|
373
|
+
}
|
|
374
|
+
}));
|
|
410
375
|
|
|
411
376
|
const NUDGE = 8;
|
|
412
377
|
|
|
@@ -453,7 +418,7 @@ the pane itself stays `position: fixed` and doesn't move with either.
|
|
|
453
418
|
// every move rather than accumulated via `event.movementX`/`movementY` —
|
|
454
419
|
// the latter isn't reliably populated across every input path (some
|
|
455
420
|
// synthetic/automated drag sequences leave it 0), which would silently
|
|
456
|
-
// drop the resize.
|
|
421
|
+
// drop the resize. The drag attachment works from a fixed baseline the same way.
|
|
457
422
|
function moveResize(event: PointerEvent) {
|
|
458
423
|
if (!resizeDir) return;
|
|
459
424
|
applyResize(
|
|
@@ -534,10 +499,7 @@ the pane itself stays `position: fixed` and doesn't move with either.
|
|
|
534
499
|
tabindex={disableDrag ? undefined : 0}
|
|
535
500
|
aria-label={disableDrag ? undefined : title ? `Drag to move ${title}` : 'Drag to move'}
|
|
536
501
|
aria-keyshortcuts={disableDrag ? undefined : 'ArrowUp ArrowDown ArrowLeft ArrowRight'}
|
|
537
|
-
|
|
538
|
-
onpointermove={disableDrag ? undefined : moveDrag}
|
|
539
|
-
onpointerup={disableDrag ? undefined : endDrag}
|
|
540
|
-
onpointercancel={disableDrag ? undefined : endDrag}
|
|
502
|
+
{@attach dragPane}
|
|
541
503
|
onkeydown={disableDrag ? undefined : onKeydown}
|
|
542
504
|
>
|
|
543
505
|
{#if !disableDrag}
|
|
@@ -76,7 +76,7 @@ the document root yourself to get the same behavior.
|
|
|
76
76
|
|
|
77
77
|
const style = $derived(
|
|
78
78
|
clsx(
|
|
79
|
-
!flexible && `width: ${shown}px;
|
|
79
|
+
!flexible && `width: ${shown}px; --pane-basis: ${shown}px;`,
|
|
80
80
|
sticky && `--pane-sticky-top: ${stickyTop}px;`
|
|
81
81
|
)
|
|
82
82
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type VariantProps } from '
|
|
1
|
+
import { type VariantProps } from '../../../utils/tv.js';
|
|
2
2
|
export type PaneVariants = VariantProps<typeof pane>;
|
|
3
3
|
export type PaneGridVariants = VariantProps<typeof paneGrid>;
|
|
4
4
|
export type PaneHandleVariants = VariantProps<typeof paneHandle>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { tv } from '
|
|
1
|
+
import { tv } from '../../../utils/tv.js';
|
|
2
2
|
// Static class lookups, keyed by breakpoint then value — every string below is a
|
|
3
3
|
// literal Tailwind candidate, so the JIT scanner picks it up even though it's only
|
|
4
4
|
// ever read through object indexing at runtime (see PaneGrid.svelte's resolveResponsive).
|
|
@@ -92,11 +92,22 @@ const marginClasses = {
|
|
|
92
92
|
xl: 'xl:m-spacing-400'
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
|
+
/*
|
|
96
|
+
A pane's flex-basis is its size along the grid's axis, so it depends on the direction. Each
|
|
97
|
+
Pane publishes the basis it wants in a row as --pane-basis (0 for a flexible pane, so flexible
|
|
98
|
+
siblings share the free space; its px width for a fixed one), and each tier here applies it to
|
|
99
|
+
the children: that basis in a row, `auto` in a column, where panes stack at their content
|
|
100
|
+
height. A basis of 0 in a column made a flexible pane exactly as tall as its min-height, with
|
|
101
|
+
the rest of its content clipped. The `*:` classes beat the Pane's own `basis-*`.
|
|
102
|
+
*/
|
|
95
103
|
const directionClasses = {
|
|
96
|
-
small: { row: 'flex-row', column: 'flex-col' },
|
|
97
|
-
medium: { row: 'md:flex-row', column: 'md:flex-col' },
|
|
98
|
-
large: { row: 'lg:flex-row', column: 'lg:flex-col' },
|
|
99
|
-
extraLarge: {
|
|
104
|
+
small: { row: 'flex-row *:basis-(--pane-basis)', column: 'flex-col *:basis-auto' },
|
|
105
|
+
medium: { row: 'md:flex-row md:*:basis-(--pane-basis)', column: 'md:flex-col md:*:basis-auto' },
|
|
106
|
+
large: { row: 'lg:flex-row lg:*:basis-(--pane-basis)', column: 'lg:flex-col lg:*:basis-auto' },
|
|
107
|
+
extraLarge: {
|
|
108
|
+
row: 'xl:flex-row xl:*:basis-(--pane-basis)',
|
|
109
|
+
column: 'xl:flex-col xl:*:basis-auto'
|
|
110
|
+
}
|
|
100
111
|
};
|
|
101
112
|
const visibleFromClasses = {
|
|
102
113
|
small: '',
|
|
@@ -167,9 +178,10 @@ export const pane = tv({
|
|
|
167
178
|
lg: { content: 'gap-spacing-200' },
|
|
168
179
|
xl: { content: 'gap-spacing-300' }
|
|
169
180
|
},
|
|
181
|
+
// The basis outside a PaneGrid; inside one, the grid's direction sets it from --pane-basis.
|
|
170
182
|
flexible: {
|
|
171
|
-
true: { base: 'min-w-spacing-0 grow basis-spacing-0' },
|
|
172
|
-
false: { base: 'shrink-0' }
|
|
183
|
+
true: { base: 'min-w-spacing-0 grow basis-spacing-0 [--pane-basis:0px]' },
|
|
184
|
+
false: { base: 'shrink-0 basis-(--pane-basis)' }
|
|
173
185
|
},
|
|
174
186
|
sticky: {
|
|
175
187
|
true: {
|
|
@@ -178,6 +190,20 @@ export const pane = tv({
|
|
|
178
190
|
false: ''
|
|
179
191
|
}
|
|
180
192
|
},
|
|
193
|
+
compoundVariants: [
|
|
194
|
+
/*
|
|
195
|
+
A full pane is a page that scrolls with the window, so its content ends 72dp (a 56dp FAB
|
|
196
|
+
plus its 16dp margin) above the pane's bottom edge instead of on the preset's bottom
|
|
197
|
+
padding. The last line can then scroll clear of a FAB (M3: keep a FAB from covering
|
|
198
|
+
content at the end of a scroll) and doesn't finish flush against the window edge. Each
|
|
199
|
+
tier restates it, since the presets set `md:py-*`/`lg:py-*`.
|
|
200
|
+
*/
|
|
201
|
+
{
|
|
202
|
+
full: true,
|
|
203
|
+
padding: ['sm', 'md', 'lg'],
|
|
204
|
+
class: { content: 'pb-spacing-900 md:pb-spacing-900 lg:pb-spacing-900' }
|
|
205
|
+
}
|
|
206
|
+
],
|
|
181
207
|
defaultVariants: {
|
|
182
208
|
rounded: true,
|
|
183
209
|
flexible: true
|
|
@@ -211,14 +237,14 @@ export const paneHandle = tv({
|
|
|
211
237
|
});
|
|
212
238
|
export const draggablePane = tv({
|
|
213
239
|
slots: {
|
|
214
|
-
base: 'fixed z-
|
|
240
|
+
base: 'fixed z-layer-pane flex min-w-72 flex-col rounded-md bg-md-sys-color-surface-container-highest shadow-elevation-3 transition-shadow md-sys-motion-effects',
|
|
215
241
|
headerBar: 'relative flex shrink-0 items-center gap-spacing-100 rounded-t-2xl px-spacing-150 py-spacing-100 touch-none select-none md-sys-state-focus-indicator',
|
|
216
242
|
grip: 'shrink-0 text-md-sys-color-on-surface-variant',
|
|
217
243
|
headline: 'flex-1 truncate md-sys-typescale-title-small text-md-sys-color-on-surface',
|
|
218
244
|
actions: 'flex shrink-0 items-center gap-spacing-50',
|
|
219
245
|
content: 'flex flex-1 flex-col min-h-spacing-0 min-w-spacing-0 overflow-auto p-spacing-200 pt-spacing-100',
|
|
220
246
|
resizeHandle: 'absolute touch-none',
|
|
221
|
-
miniBase: 'fixed z-
|
|
247
|
+
miniBase: 'fixed z-layer-pane flex cursor-pointer items-center gap-spacing-100 rounded-full bg-md-sys-color-surface-container-high px-spacing-200 py-spacing-100 shadow-elevation-2 md-sys-state-focus-indicator hover:shadow-elevation-3',
|
|
222
248
|
miniIcon: 'shrink-0 text-md-sys-color-on-surface-variant',
|
|
223
249
|
miniLabel: 'md-sys-typescale-label-large max-w-48 truncate text-md-sys-color-on-surface'
|
|
224
250
|
},
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { type VariantProps } from '
|
|
1
|
+
import { type VariantProps } from '../../../utils/tv.js';
|
|
2
2
|
export type PopoverVariants = VariantProps<typeof popover>;
|
|
3
3
|
export declare const popover: import("tailwind-variants").TVReturnType<{
|
|
4
4
|
[key: string]: {
|
|
5
5
|
[key: string]: import("tailwind-variants").ClassValue | {
|
|
6
6
|
title?: import("tailwind-variants").ClassValue;
|
|
7
|
-
close?: import("tailwind-variants").ClassValue;
|
|
8
7
|
base?: import("tailwind-variants").ClassValue;
|
|
9
8
|
body?: import("tailwind-variants").ClassValue;
|
|
10
9
|
header?: import("tailwind-variants").ClassValue;
|
|
10
|
+
close?: import("tailwind-variants").ClassValue;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
} | {
|
|
14
14
|
[x: string]: {
|
|
15
15
|
[x: string]: import("tailwind-variants").ClassValue | {
|
|
16
16
|
title?: import("tailwind-variants").ClassValue;
|
|
17
|
-
close?: import("tailwind-variants").ClassValue;
|
|
18
17
|
base?: import("tailwind-variants").ClassValue;
|
|
19
18
|
body?: import("tailwind-variants").ClassValue;
|
|
20
19
|
header?: import("tailwind-variants").ClassValue;
|
|
20
|
+
close?: import("tailwind-variants").ClassValue;
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
} | {}, {
|
|
@@ -30,10 +30,10 @@ export declare const popover: import("tailwind-variants").TVReturnType<{
|
|
|
30
30
|
[key: string]: {
|
|
31
31
|
[key: string]: import("tailwind-variants").ClassValue | {
|
|
32
32
|
title?: import("tailwind-variants").ClassValue;
|
|
33
|
-
close?: import("tailwind-variants").ClassValue;
|
|
34
33
|
base?: import("tailwind-variants").ClassValue;
|
|
35
34
|
body?: import("tailwind-variants").ClassValue;
|
|
36
35
|
header?: import("tailwind-variants").ClassValue;
|
|
36
|
+
close?: import("tailwind-variants").ClassValue;
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
39
|
} | {}, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { tv } from '
|
|
1
|
+
import { tv } from '../../../utils/tv.js';
|
|
2
2
|
export const popover = tv({
|
|
3
3
|
slots: {
|
|
4
|
-
base: 'relative z-
|
|
4
|
+
base: 'relative z-layer-popup min-w-48 max-w-sm rounded-2xl bg-md-sys-color-surface-container-high p-spacing-200 shadow-elevation-3 ring-1 ring-md-sys-color-outline/20',
|
|
5
5
|
close: 'absolute top-spacing-150 right-spacing-150',
|
|
6
6
|
header: 'mb-spacing-100 flex items-center justify-between gap-spacing-200',
|
|
7
7
|
title: 'md-sys-typescale-title-small text-md-sys-color-on-surface',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { tv } from '
|
|
1
|
+
import { tv } from '../../../utils/tv.js';
|
|
2
2
|
/*
|
|
3
3
|
M3 side sheet (https://m3.material.io/components/side-sheets/specs). Full height, 256dp wide by
|
|
4
4
|
default and never wider than 400dp. 24dp start/end padding (16dp before a back button), 12dp
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type VariantProps } from '
|
|
1
|
+
import { type VariantProps } from '../../utils/tv.js';
|
|
2
2
|
export type DateFieldVariants = VariantProps<typeof dateField>;
|
|
3
3
|
export type DateRangeFieldVariants = VariantProps<typeof dateRangeField>;
|
|
4
4
|
export declare const dateRangeField: import("tailwind-variants").TVReturnType<{
|
|
@@ -251,10 +251,10 @@ export declare const dateCalendar: import("tailwind-variants").TVReturnType<{
|
|
|
251
251
|
[key: string]: {
|
|
252
252
|
[key: string]: import("tailwind-variants").ClassValue | {
|
|
253
253
|
grid?: import("tailwind-variants").ClassValue;
|
|
254
|
-
row?: import("tailwind-variants").ClassValue;
|
|
255
|
-
surface?: import("tailwind-variants").ClassValue;
|
|
256
254
|
header?: import("tailwind-variants").ClassValue;
|
|
257
255
|
nav?: import("tailwind-variants").ClassValue;
|
|
256
|
+
row?: import("tailwind-variants").ClassValue;
|
|
257
|
+
surface?: import("tailwind-variants").ClassValue;
|
|
258
258
|
cell?: import("tailwind-variants").ClassValue;
|
|
259
259
|
heading?: import("tailwind-variants").ClassValue;
|
|
260
260
|
weekday?: import("tailwind-variants").ClassValue;
|
|
@@ -265,10 +265,10 @@ export declare const dateCalendar: import("tailwind-variants").TVReturnType<{
|
|
|
265
265
|
[x: string]: {
|
|
266
266
|
[x: string]: import("tailwind-variants").ClassValue | {
|
|
267
267
|
grid?: import("tailwind-variants").ClassValue;
|
|
268
|
-
row?: import("tailwind-variants").ClassValue;
|
|
269
|
-
surface?: import("tailwind-variants").ClassValue;
|
|
270
268
|
header?: import("tailwind-variants").ClassValue;
|
|
271
269
|
nav?: import("tailwind-variants").ClassValue;
|
|
270
|
+
row?: import("tailwind-variants").ClassValue;
|
|
271
|
+
surface?: import("tailwind-variants").ClassValue;
|
|
272
272
|
cell?: import("tailwind-variants").ClassValue;
|
|
273
273
|
heading?: import("tailwind-variants").ClassValue;
|
|
274
274
|
weekday?: import("tailwind-variants").ClassValue;
|
|
@@ -289,10 +289,10 @@ export declare const dateCalendar: import("tailwind-variants").TVReturnType<{
|
|
|
289
289
|
[key: string]: {
|
|
290
290
|
[key: string]: import("tailwind-variants").ClassValue | {
|
|
291
291
|
grid?: import("tailwind-variants").ClassValue;
|
|
292
|
-
row?: import("tailwind-variants").ClassValue;
|
|
293
|
-
surface?: import("tailwind-variants").ClassValue;
|
|
294
292
|
header?: import("tailwind-variants").ClassValue;
|
|
295
293
|
nav?: import("tailwind-variants").ClassValue;
|
|
294
|
+
row?: import("tailwind-variants").ClassValue;
|
|
295
|
+
surface?: import("tailwind-variants").ClassValue;
|
|
296
296
|
cell?: import("tailwind-variants").ClassValue;
|
|
297
297
|
heading?: import("tailwind-variants").ClassValue;
|
|
298
298
|
weekday?: import("tailwind-variants").ClassValue;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { tv } from '
|
|
1
|
+
import { tv } from '../../../utils/tv.js';
|
|
2
2
|
export const checkbox = tv({
|
|
3
3
|
slots: {
|
|
4
|
-
root: 'group inline-flex min-h-spacing-500 select-none items-start gap-spacing-150 text-md-sys-color-on-surface
|
|
4
|
+
root: 'group inline-flex min-h-spacing-500 select-none items-start gap-spacing-150 text-md-sys-color-on-surface cursor-pointer',
|
|
5
5
|
container: 'relative inline-flex size-[18px] shrink-0',
|
|
6
6
|
control: 'layer-container absolute -inset-[11px] rounded-full text-md-sys-color-on-surface-variant state-layer before:rounded-full group-focus-visible:outline group-focus-visible:outline-3 group-focus-visible:outline-offset-2 group-focus-visible:outline-md-sys-color-secondary transition-colors md-sys-motion-fast-effects',
|
|
7
7
|
box: 'absolute inset-[11px] rounded-[4px] border-2 border-current bg-md-sys-color-surface transition-colors md-sys-motion-fast-effects',
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type VariantProps } from '
|
|
1
|
+
import { type VariantProps } from '../../../utils/tv.js';
|
|
2
2
|
export type CommandVariants = VariantProps<typeof command>;
|
|
3
3
|
export declare const command: import("tailwind-variants").TVReturnType<{
|
|
4
4
|
[key: string]: {
|
|
5
5
|
[key: string]: import("tailwind-variants").ClassValue | {
|
|
6
6
|
item?: import("tailwind-variants").ClassValue;
|
|
7
|
-
input?: import("tailwind-variants").ClassValue;
|
|
8
7
|
base?: import("tailwind-variants").ClassValue;
|
|
8
|
+
input?: import("tailwind-variants").ClassValue;
|
|
9
9
|
group?: import("tailwind-variants").ClassValue;
|
|
10
10
|
list?: import("tailwind-variants").ClassValue;
|
|
11
11
|
separator?: import("tailwind-variants").ClassValue;
|
|
@@ -19,8 +19,8 @@ export declare const command: import("tailwind-variants").TVReturnType<{
|
|
|
19
19
|
[x: string]: {
|
|
20
20
|
[x: string]: import("tailwind-variants").ClassValue | {
|
|
21
21
|
item?: import("tailwind-variants").ClassValue;
|
|
22
|
-
input?: import("tailwind-variants").ClassValue;
|
|
23
22
|
base?: import("tailwind-variants").ClassValue;
|
|
23
|
+
input?: import("tailwind-variants").ClassValue;
|
|
24
24
|
group?: import("tailwind-variants").ClassValue;
|
|
25
25
|
list?: import("tailwind-variants").ClassValue;
|
|
26
26
|
separator?: import("tailwind-variants").ClassValue;
|
|
@@ -45,8 +45,8 @@ export declare const command: import("tailwind-variants").TVReturnType<{
|
|
|
45
45
|
[key: string]: {
|
|
46
46
|
[key: string]: import("tailwind-variants").ClassValue | {
|
|
47
47
|
item?: import("tailwind-variants").ClassValue;
|
|
48
|
-
input?: import("tailwind-variants").ClassValue;
|
|
49
48
|
base?: import("tailwind-variants").ClassValue;
|
|
49
|
+
input?: import("tailwind-variants").ClassValue;
|
|
50
50
|
group?: import("tailwind-variants").ClassValue;
|
|
51
51
|
list?: import("tailwind-variants").ClassValue;
|
|
52
52
|
separator?: import("tailwind-variants").ClassValue;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { tv } from '
|
|
1
|
+
import { tv } from '../../../utils/tv.js';
|
|
2
2
|
export const command = tv({
|
|
3
3
|
slots: {
|
|
4
4
|
base: 'flex h-full w-full flex-col overflow-hidden rounded-2xl bg-md-sys-color-surface-container-high text-md-sys-color-on-surface shadow-elevation-3 ring-1 ring-md-sys-color-outline/20',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { tv } from '
|
|
1
|
+
import { tv } from '../../../utils/tv.js';
|
|
2
2
|
/**
|
|
3
3
|
* M3 Expressive contained search bar (https://m3.material.io/components/search/specs):
|
|
4
4
|
* 56dp, circular, surface-container-high, flat. 48dp leading/trailing targets at a 4dp inset,
|
|
@@ -65,13 +65,13 @@ Powered by bits-ui for accessibility and behavior.
|
|
|
65
65
|
|
|
66
66
|
<Select.Portal disabled={portalDisabled}>
|
|
67
67
|
<Select.Content
|
|
68
|
-
class={cls.content({ class: clsx('z-
|
|
68
|
+
class={cls.content({ class: clsx('z-layer-popup', contentProps?.class) })}
|
|
69
69
|
sideOffset={4}
|
|
70
70
|
align="start"
|
|
71
71
|
{...contentProps}
|
|
72
72
|
>
|
|
73
73
|
{#snippet child({ wrapperProps, props, open })}
|
|
74
|
-
<div {...wrapperProps} class={clsx('z-
|
|
74
|
+
<div {...wrapperProps} class={clsx('z-layer-popup', wrapperProps.class as any)}>
|
|
75
75
|
<div
|
|
76
76
|
{...props}
|
|
77
77
|
class={clsx('relative flex flex-col outline-none', props.class as any)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { tv } from '
|
|
1
|
+
import { tv } from '../../../utils/tv.js';
|
|
2
2
|
export const select = tv({
|
|
3
3
|
slots: {
|
|
4
4
|
root: 'relative w-full',
|
|
@@ -32,7 +32,7 @@ export const select = tv({
|
|
|
32
32
|
group-data-[state=open]:rotate-180
|
|
33
33
|
`,
|
|
34
34
|
content: `
|
|
35
|
-
z-
|
|
35
|
+
z-layer-popup min-w-[var(--bits-select-anchor-width)] max-h-96 overflow-y-auto
|
|
36
36
|
rounded-lg gap-spacing-50 bg-md-sys-color-surface-container-high
|
|
37
37
|
shadow-elevation-3 ring-md-sys-color-outline/10 px-spacing-100 py-spacing-50 outline-none
|
|
38
38
|
`,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type VariantProps } from '
|
|
1
|
+
import { type VariantProps } from '../../../utils/tv.js';
|
|
2
2
|
/**
|
|
3
3
|
* M3 Expressive slider: an active and an inactive track separated from a bar handle by a 6dp gap.
|
|
4
4
|
* Per-size tokens (track / handle / outer corner / inset icon): XS 16/44/8/–, S 24/44/8/–,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { tv } from '
|
|
1
|
+
import { tv } from '../../../utils/tv.js';
|
|
2
2
|
/**
|
|
3
3
|
* M3 Expressive slider: an active and an inactive track separated from a bar handle by a 6dp gap.
|
|
4
4
|
* Per-size tokens (track / handle / outer corner / inset icon): XS 16/44/8/–, S 24/44/8/–,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type VariantProps } from '
|
|
1
|
+
import { type VariantProps } from '../../../utils/tv.js';
|
|
2
2
|
export type ToggleGroupVariants = VariantProps<typeof toggleGroup>;
|
|
3
3
|
export type ToggleGroupItemVariants = VariantProps<typeof toggleGroupItem>;
|
|
4
4
|
export declare const toggleGroup: import("tailwind-variants").TVReturnType<{
|