sherick-ui 2.1.1 → 2.3.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/README.md +24 -1
- package/dist/cjs/components/Badge.cjs +1 -1
- package/dist/cjs/components/Badge.cjs.map +1 -1
- package/dist/cjs/components/Button.cjs +11 -2
- package/dist/cjs/components/Button.cjs.map +1 -1
- package/dist/cjs/components/Calendar.cjs +2 -2
- package/dist/cjs/components/Calendar.cjs.map +1 -1
- package/dist/cjs/components/Card.cjs +3 -2
- package/dist/cjs/components/Card.cjs.map +1 -1
- package/dist/cjs/components/Chip.cjs +3 -3
- package/dist/cjs/components/Chip.cjs.map +1 -1
- package/dist/cjs/components/Combobox.cjs +1 -1
- package/dist/cjs/components/Combobox.cjs.map +1 -1
- package/dist/cjs/components/Command.cjs +2 -2
- package/dist/cjs/components/Command.cjs.map +1 -1
- package/dist/cjs/components/CommandPalette.cjs +1 -1
- package/dist/cjs/components/CommandPalette.cjs.map +1 -1
- package/dist/cjs/components/DateRangePicker.cjs +1 -1
- package/dist/cjs/components/DateRangePicker.cjs.map +1 -1
- package/dist/cjs/components/DialogHeader.cjs +1 -1
- package/dist/cjs/components/DialogHeader.cjs.map +1 -1
- package/dist/cjs/components/Drawer.cjs +1 -1
- package/dist/cjs/components/Drawer.cjs.map +1 -1
- package/dist/cjs/components/Field.cjs +1 -1
- package/dist/cjs/components/Field.cjs.map +1 -1
- package/dist/cjs/components/FileUpload.cjs +2 -2
- package/dist/cjs/components/FileUpload.cjs.map +1 -1
- package/dist/cjs/components/IconButton.cjs +1 -1
- package/dist/cjs/components/IconButton.cjs.map +1 -1
- package/dist/cjs/components/Input.cjs +1 -1
- package/dist/cjs/components/Input.cjs.map +1 -1
- package/dist/cjs/components/NavItem.cjs +3 -3
- package/dist/cjs/components/NavItem.cjs.map +1 -1
- package/dist/cjs/components/NumberField.cjs +1 -1
- package/dist/cjs/components/NumberField.cjs.map +1 -1
- package/dist/cjs/components/Pagination.cjs +1 -1
- package/dist/cjs/components/Pagination.cjs.map +1 -1
- package/dist/cjs/components/Progress.cjs +7 -4
- package/dist/cjs/components/Progress.cjs.map +1 -1
- package/dist/cjs/components/RadioGroup.cjs +3 -2
- package/dist/cjs/components/RadioGroup.cjs.map +1 -1
- package/dist/cjs/components/Select.cjs +1 -1
- package/dist/cjs/components/Select.cjs.map +1 -1
- package/dist/cjs/components/Slider.cjs +1 -1
- package/dist/cjs/components/Slider.cjs.map +1 -1
- package/dist/cjs/components/Stepper.cjs +5 -1
- package/dist/cjs/components/Stepper.cjs.map +1 -1
- package/dist/cjs/components/Table.cjs +10 -2
- package/dist/cjs/components/Table.cjs.map +1 -1
- package/dist/cjs/components/Tabs.cjs +1 -1
- package/dist/cjs/components/Tabs.cjs.map +1 -1
- package/dist/cjs/components/Textarea.cjs +1 -1
- package/dist/cjs/components/Textarea.cjs.map +1 -1
- package/dist/cjs/components/Toast.cjs +5 -2
- package/dist/cjs/components/Toast.cjs.map +1 -1
- package/dist/cjs/components/Tooltip.cjs +1 -1
- package/dist/cjs/components/Tooltip.cjs.map +1 -1
- package/dist/cjs/components/TreeView.cjs +43 -10
- package/dist/cjs/components/TreeView.cjs.map +1 -1
- package/dist/cjs/components/ui.common.cjs +109 -44
- package/dist/cjs/components/ui.common.cjs.map +1 -1
- package/dist/cjs/components/ui.motion.cjs +37 -13
- package/dist/cjs/components/ui.motion.cjs.map +1 -1
- package/dist/cjs/dev.cjs +10 -0
- package/dist/cjs/dev.cjs.map +1 -1
- package/dist/esm/components/Badge.js +2 -2
- package/dist/esm/components/Badge.js.map +1 -1
- package/dist/esm/components/Button.js +12 -3
- package/dist/esm/components/Button.js.map +1 -1
- package/dist/esm/components/Calendar.js +3 -3
- package/dist/esm/components/Calendar.js.map +1 -1
- package/dist/esm/components/Card.js +4 -3
- package/dist/esm/components/Card.js.map +1 -1
- package/dist/esm/components/Chip.js +3 -3
- package/dist/esm/components/Chip.js.map +1 -1
- package/dist/esm/components/CodeBlock.js +5 -4
- package/dist/esm/components/CodeBlock.js.map +1 -1
- package/dist/esm/components/Combobox.js +2 -2
- package/dist/esm/components/Combobox.js.map +1 -1
- package/dist/esm/components/Command.js +3 -3
- package/dist/esm/components/Command.js.map +1 -1
- package/dist/esm/components/CommandPalette.js +2 -2
- package/dist/esm/components/CommandPalette.js.map +1 -1
- package/dist/esm/components/DateRangePicker.js +2 -2
- package/dist/esm/components/DateRangePicker.js.map +1 -1
- package/dist/esm/components/DialogHeader.js +2 -2
- package/dist/esm/components/DialogHeader.js.map +1 -1
- package/dist/esm/components/Drawer.js +2 -2
- package/dist/esm/components/Drawer.js.map +1 -1
- package/dist/esm/components/Field.js +2 -2
- package/dist/esm/components/Field.js.map +1 -1
- package/dist/esm/components/FileUpload.js +3 -3
- package/dist/esm/components/FileUpload.js.map +1 -1
- package/dist/esm/components/IconButton.js +1 -1
- package/dist/esm/components/IconButton.js.map +1 -1
- package/dist/esm/components/Input.js +2 -2
- package/dist/esm/components/Input.js.map +1 -1
- package/dist/esm/components/Markdown.js +3 -2
- package/dist/esm/components/Markdown.js.map +1 -1
- package/dist/esm/components/NavItem.js +5 -5
- package/dist/esm/components/NavItem.js.map +1 -1
- package/dist/esm/components/NumberField.js +2 -2
- package/dist/esm/components/NumberField.js.map +1 -1
- package/dist/esm/components/Pagination.js +2 -2
- package/dist/esm/components/Pagination.js.map +1 -1
- package/dist/esm/components/Progress.js +8 -5
- package/dist/esm/components/Progress.js.map +1 -1
- package/dist/esm/components/RadioGroup.js +5 -4
- package/dist/esm/components/RadioGroup.js.map +1 -1
- package/dist/esm/components/Select.js +2 -2
- package/dist/esm/components/Select.js.map +1 -1
- package/dist/esm/components/Slider.js +1 -1
- package/dist/esm/components/Slider.js.map +1 -1
- package/dist/esm/components/Stepper.js +6 -2
- package/dist/esm/components/Stepper.js.map +1 -1
- package/dist/esm/components/Table.js +11 -3
- package/dist/esm/components/Table.js.map +1 -1
- package/dist/esm/components/Tabs.js +2 -2
- package/dist/esm/components/Tabs.js.map +1 -1
- package/dist/esm/components/Textarea.js +2 -2
- package/dist/esm/components/Textarea.js.map +1 -1
- package/dist/esm/components/Toast.js +6 -3
- package/dist/esm/components/Toast.js.map +1 -1
- package/dist/esm/components/Tooltip.js +2 -2
- package/dist/esm/components/Tooltip.js.map +1 -1
- package/dist/esm/components/TreeView.js +45 -12
- package/dist/esm/components/TreeView.js.map +1 -1
- package/dist/esm/components/ui.common.js +105 -46
- package/dist/esm/components/ui.common.js.map +1 -1
- package/dist/esm/components/ui.motion.js +34 -14
- package/dist/esm/components/ui.motion.js.map +1 -1
- package/dist/esm/dev.js +2 -2
- package/dist/styles.css +173 -61
- package/dist/theme.css +33 -4
- package/dist/types/dev.d.cts +56 -35
- package/dist/types/dev.d.ts +56 -35
- package/dist/types/index.d.cts +15 -3
- package/dist/types/index.d.ts +15 -3
- package/package.json +1 -1
|
@@ -34,15 +34,28 @@ import { cx } from '../libs/utils.js';
|
|
|
34
34
|
const motionFeedback = "transition-[background-color,color,box-shadow,opacity] duration-press ease-press motion-reduce:transition-none";
|
|
35
35
|
/** A control answers a press immediately and settles on its release.
|
|
36
36
|
*
|
|
37
|
-
* The recipe owns the *amplitude* of that answer as well as its timing, because how far a
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
37
|
+
* The recipe owns the *amplitude* of that answer as well as its timing, because how far a press
|
|
38
|
+
* travels is the system's physical character rather than a component's anatomy. A percentage is a
|
|
39
|
+
* distance only once it meets a size, so the amplitude comes in tiers chosen by the control's role:
|
|
40
|
+
*
|
|
41
|
+
* - `motionTactile`: a content-width control — a button, a chip, a segment — compresses 4%, about
|
|
42
|
+
* two pixels at the size of the ink it moves.
|
|
43
|
+
* - `motionTactileWide`: a control that spans a track — a tab — compresses 1.5%, so its edges move
|
|
44
|
+
* about as far as a button's.
|
|
45
|
+
* - `motionTactileField`: a list-opening field — a Select trigger, an editable Combobox — spans
|
|
46
|
+
* its whole container, and 4% of a 580px field moved each edge 11.6px. It compresses 0.7%, about
|
|
47
|
+
* two pixels at that width: the field acknowledges the press without lurching.
|
|
48
|
+
*
|
|
49
|
+
* The press leg runs on `duration-tactile`, short enough to land inside a tap; the release settles
|
|
50
|
+
* on the release timing. A control whose visible ink is far smaller than its target takes
|
|
51
|
+
* `motionInkPress` on that ink instead, so the target itself never moves. The interpolation and
|
|
52
|
+
* the compression are neutralised together under reduced motion. */
|
|
43
53
|
/* Base may disable the surface itself or the value control inside a Select wrapper.
|
|
44
|
-
Neither is a pressable surface. Timing
|
|
45
|
-
const
|
|
54
|
+
Neither is a pressable surface. Timing is otherwise shared by every tier. */
|
|
55
|
+
const tactileTiming = "transition-[background-color,color,box-shadow,transform,opacity] duration-release ease-release active:duration-tactile active:ease-press motion-reduce:transition-none";
|
|
56
|
+
const motionTactile = /* @__PURE__ */ cx(tactileTiming, "motion-safe:[&:not([data-disabled],:disabled,:has(>[role=combobox][data-disabled]))]:active:scale-[0.96]");
|
|
57
|
+
const motionTactileWide = /* @__PURE__ */ cx(tactileTiming, "motion-safe:[&:not([data-disabled],:disabled)]:active:scale-[0.985]");
|
|
58
|
+
const motionTactileField = /* @__PURE__ */ cx(tactileTiming, "motion-safe:[&:not([data-disabled],:disabled,:has(>[role=combobox][data-disabled]))]:active:scale-[0.993]");
|
|
46
59
|
/** The spatial half of a compact press, applied to the *mark* rather than to the control.
|
|
47
60
|
*
|
|
48
61
|
* A control whose visible ink is much smaller than the target it is aimed at — a dialog's close
|
|
@@ -52,7 +65,7 @@ const motionTactile = "transition-[background-color,color,box-shadow,transform,o
|
|
|
52
65
|
* release lands), so the mark takes the twelve percent and the target keeps its geometry. The
|
|
53
66
|
* target still owns the focus ring and the state layer, and still carries the tone and depth
|
|
54
67
|
* response, so the boundary a press happens inside never moves. */
|
|
55
|
-
const motionInkPress = "transition-transform duration-release ease-release group-active:duration-
|
|
68
|
+
const motionInkPress = "transition-transform duration-release ease-release group-active:duration-tactile group-active:ease-press group-active:scale-[0.88] motion-reduce:transition-none motion-reduce:group-active:scale-100";
|
|
56
69
|
/* Motion is not owned here — but the recipes above are the whole vocabulary: every press, arrival,
|
|
57
70
|
travel, presence and activity in the library is one of these names plus its owner's own target
|
|
58
71
|
geometry. */
|
|
@@ -81,6 +94,9 @@ const motionOrient = "transition-transform duration-release ease-release motion-
|
|
|
81
94
|
* settle together, and an interrupted move retargets from wherever it currently is
|
|
82
95
|
* because it is a transition and not a keyframe. */
|
|
83
96
|
const motionRelocate = "transition-[left,inset-inline-start,top,width,height,transform,background-color,color,box-shadow,opacity] duration-release ease-glide motion-reduce:transition-none";
|
|
97
|
+
/** The same travel across a whole track — a tab indicator — on the longer travel timing, so a
|
|
98
|
+
* movement of hundreds of pixels is followed rather than skipped. */
|
|
99
|
+
const motionRelocateLong = "transition-[left,inset-inline-start,top,width,height,transform,background-color,color,box-shadow,opacity] duration-travel ease-glide motion-reduce:transition-none";
|
|
84
100
|
/** Direct manipulation: the pointer owns the geometry, so a positional transition would be
|
|
85
101
|
* lag. While the primitive reports a drag, position and size are removed from the
|
|
86
102
|
* transition list and only tone and engagement geometry remain; a keyboard or programmatic
|
|
@@ -132,7 +148,7 @@ const motionPresenceTooltip = /* @__PURE__ */ cx("transition-[opacity,transform]
|
|
|
132
148
|
const motionPresenceModal = /* @__PURE__ */ cx("transition-[opacity,transform] duration-overlay ease-glide", "data-[ending-style]:duration-overlay-exit data-[ending-style]:ease-exit", "motion-reduce:transition-[opacity]", modalFrom);
|
|
133
149
|
/** The plane behind a surface that owns the viewport. Opacity only: a blur or a filter is
|
|
134
150
|
* never animated, so the plane can never animate the page behind it. */
|
|
135
|
-
const motionPresenceScrim = "transition-opacity duration-overlay ease-release data-[ending-style]:duration-overlay-exit data-[ending-style]:ease-exit";
|
|
151
|
+
const motionPresenceScrim = "transition-opacity duration-overlay ease-release data-[starting-style]:opacity-0 data-[ending-style]:opacity-0 data-[ending-style]:duration-overlay-exit data-[ending-style]:ease-exit";
|
|
136
152
|
/** Continuous activity is a distinct intent, not an exception to interaction motion: it
|
|
137
153
|
* reports work rather than answering an event, and it has no entrance of its own. */
|
|
138
154
|
const motionActivitySpin = "animate-spin motion-reduce:animate-none";
|
|
@@ -147,13 +163,17 @@ const motionActivityPulse = "animate-pulse motion-reduce:animate-none";
|
|
|
147
163
|
const motionActivityIndeterminate = "animate-sherick-indeterminate [[dir=rtl]_&]:[--sui-indeterminate-direction:-1] motion-reduce:animate-none";
|
|
148
164
|
/** The state layer is a composited overlay, so its own opacity is the only thing that
|
|
149
165
|
* moves. Shared here because four interaction states across the library ride it. */
|
|
150
|
-
|
|
166
|
+
/** A row in a collection moves its highlight rather than fading it: a highlight is where the reader
|
|
167
|
+
* is, and arrowing through a list with a soft fade on every row leaves a smear of half-lit rows.
|
|
168
|
+
* The row's layer therefore changes in one step, for the pointer and the keyboard alike. */
|
|
169
|
+
const motionRowLayer = "before:transition-none";
|
|
170
|
+
const motionStateLayer = "before:transition-opacity before:duration-release before:ease-release active:before:duration-tactile active:before:ease-press group-active:before:duration-tactile group-active:before:ease-press motion-reduce:before:transition-none";
|
|
151
171
|
/* `disclose` is the in-flow counterpart of presence: nothing mounts or unmounts, and nothing
|
|
152
172
|
leaves the page — one region changes its own height where it sits. Base measures the panel and
|
|
153
173
|
publishes that height, so the geometry is the primitive's and only the interpolation is here.
|
|
154
174
|
The panel states the height it opens to; this recipe owns how it gets there, and reduced
|
|
155
175
|
motion applies the layout state in one step rather than travelling through it. */
|
|
156
|
-
const motionDisclose = "transition-[height] duration-release ease-release data-[starting-style]:h-0 data-[ending-style]:h-0 motion-reduce:transition-none";
|
|
176
|
+
const motionDisclose = "transition-[height] duration-release ease-release data-[starting-style]:h-0 data-[ending-style]:h-0 data-[ending-style]:duration-overlay-exit data-[ending-style]:ease-exit motion-reduce:transition-none";
|
|
157
177
|
/* A sheet is a surface that owns the viewport and is attached to one edge of it, so its presence is
|
|
158
178
|
a slide out of that edge rather than the modal lift, and it never bounces. The component names the
|
|
159
179
|
edge by setting exactly one of `--sui-sheet-from-x` / `--sui-sheet-from-y` to a full own-extent
|
|
@@ -164,7 +184,7 @@ const motionDisclose = "transition-[height] duration-release ease-release data-[
|
|
|
164
184
|
component did not set would translate a side sheet on both axes at once, so a sheet attached to
|
|
165
185
|
the right edge would enter from the bottom-right corner and travel diagonally instead of
|
|
166
186
|
straight in. One edge means one axis. */
|
|
167
|
-
const motionPresenceSheet = /* @__PURE__ */ cx("transition-[transform,opacity] duration-
|
|
187
|
+
const motionPresenceSheet = /* @__PURE__ */ cx("transition-[transform,opacity] duration-sheet ease-glide", "data-[ending-style]:duration-sheet-exit data-[ending-style]:ease-exit", "motion-reduce:transition-[opacity]", "data-[starting-style]:opacity-0", "data-[ending-style]:opacity-0", "data-[starting-style]:[transform:translate(var(--sui-sheet-from-x,0px),var(--sui-sheet-from-y,0px))]", "data-[ending-style]:[transform:translate(var(--sui-sheet-from-x,0px),var(--sui-sheet-from-y,0px))]", "motion-reduce:data-[starting-style]:transform-none", "motion-reduce:data-[ending-style]:transform-none");
|
|
168
188
|
/* A toast is a stack, not a single surface: several independent surfaces share one corner,
|
|
169
189
|
re-flow when one of them leaves, and can each be flung away by the pointer. That is one
|
|
170
190
|
spatial owner on one node, and this is it.
|
|
@@ -177,5 +197,5 @@ const motionPresenceSheet = /* @__PURE__ */ cx("transition-[transform,opacity] d
|
|
|
177
197
|
already going instead of turning around. */
|
|
178
198
|
const motionPresenceToast = /* @__PURE__ */ cx("transition-[transform,opacity,height] duration-overlay ease-glide", "data-[ending-style]:duration-overlay-exit data-[ending-style]:ease-exit", "data-[swiping]:transition-none", "motion-reduce:transition-[opacity]", "data-[starting-style]:opacity-0", "data-[ending-style]:opacity-0", "data-[starting-style]:[transform:translateY(var(--sui-toast-from-y,150%))]", "[&[data-ending-style]:not([data-swipe-direction])]:[transform:translateY(var(--sui-toast-from-y,150%))]", "data-[ending-style]:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y,0px)+150%))]", "data-[ending-style]:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y,0px)-150%))]", "data-[ending-style]:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x,0px)-150%))]", "data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x,0px)+150%))]", "motion-reduce:data-[starting-style]:transform-none", "motion-reduce:data-[ending-style]:transform-none");
|
|
179
199
|
|
|
180
|
-
export { motionActivityIndeterminate, motionActivityPulse, motionActivitySpin, motionArrive, motionDirect, motionDisclose, motionFeedback, motionInkPress, motionOrient, motionPresenceAnchored, motionPresenceModal, motionPresenceScrim, motionPresenceSheet, motionPresenceToast, motionPresenceTooltip, motionRelocate, motionStateLayer, motionTactile };
|
|
200
|
+
export { motionActivityIndeterminate, motionActivityPulse, motionActivitySpin, motionArrive, motionDirect, motionDisclose, motionFeedback, motionInkPress, motionOrient, motionPresenceAnchored, motionPresenceModal, motionPresenceScrim, motionPresenceSheet, motionPresenceToast, motionPresenceTooltip, motionRelocate, motionRelocateLong, motionRowLayer, motionStateLayer, motionTactile, motionTactileField, motionTactileWide };
|
|
181
201
|
//# sourceMappingURL=ui.motion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.motion.js","sources":["../../../src/components/ui.motion.ts"],"sourcesContent":["/* Sherick UI motion grammar\n =========================\n Components describe what changes; this module exclusively describes how change moves.\n\n The canonical intents are:\n - feedback: non-spatial state response;\n - tactile: temporary physical response to activation;\n - arrive: a meaningful subordinate part appears or leaves;\n - orient: a persistent part changes orientation in place;\n - relocate: a persistent part moves or resizes between stable states;\n - direct: geometry continuously follows the user;\n - disclose: in-flow content expands and collapses;\n - presence: an independent surface enters/leaves;\n - activity: continuous motion that communicates ongoing work.\n\n Every recipe here owns the transition property, the duration, the curve and the\n `prefers-reduced-motion` behavior for one physical event. The durations and curves\n themselves are the authored tokens in `src/styles/tokens.ts`; nothing in this file\n writes a literal duration or an animation keyframe beyond the two activity loops.\n\n `docs/DESIGN_LANGUAGE.md` owns the semantics. Target geometry, material, tone and\n elevation remain component/anatomy concerns: a component says where something ends\n up, and this module says how it gets there. */\n\n/* A recipe that is composed from other recipes is built through `cx`, whose call is marked pure.\n That is load-bearing for the published bundles rather than a bundler detail: an unused recipe\n whose value is a template literal with a substitution in it is not provably side-effect-free, so\n it survives tree-shaking and every consumer that imports any part of this module pays for every\n recipe in it — including the families it never uses. See `libs/utils.ts`. */\nimport { cx } from \"@/libs/utils\";\n\nexport type MotionIntent =\n | \"feedback\"\n | \"tactile\"\n | \"arrive\"\n | \"orient\"\n | \"relocate\"\n | \"direct\"\n | \"disclose\"\n | \"presence\"\n | \"activity\";\n\n/** Non-spatial feedback: hover, focus, field tone, a highlighted row, a filled surface.\n * It never translates, scales or resizes; reduced motion simply drops the interpolation\n * and the state still arrives. */\nexport const motionFeedback =\n \"transition-[background-color,color,box-shadow,opacity] duration-press ease-press motion-reduce:transition-none\";\n\n/** A control answers a press immediately and settles on its release.\n *\n * The recipe owns the *amplitude* of that answer as well as its timing, because how far a\n * press travels is the system's physical character rather than a component's anatomy: a\n * control whose outline is what the user sees compresses 4%, which is about two pixels at the\n * size of the ink it moves. A control whose visible ink is far smaller than the target it is\n * aimed at takes `motionInkPress` on that ink instead, so the target itself never moves. The\n * interpolation and the compression are neutralised together under reduced motion. */\n/* Base may disable the surface itself or the value control inside a Select wrapper.\n Neither is a pressable surface. Timing and amplitude are otherwise unchanged. */\nexport const motionTactile =\n \"transition-[background-color,color,box-shadow,transform,opacity] duration-release ease-release active:duration-press active:ease-press motion-safe:[&:not([data-disabled],:disabled,:has(>[role=combobox][data-disabled]))]:active:scale-[0.96] motion-reduce:transition-none\";\n\n/** The spatial half of a compact press, applied to the *mark* rather than to the control.\n *\n * A control whose visible ink is much smaller than the target it is aimed at — a dialog's close\n * control, a stepper, a search field's submit — is a large target around a small glyph, and only\n * the glyph is visible at rest. Compressing the whole control would shrink the ground the pointer\n * is already on (a 44px target becomes 38.7px while held, which is exactly where a near-edge\n * release lands), so the mark takes the twelve percent and the target keeps its geometry. The\n * target still owns the focus ring and the state layer, and still carries the tone and depth\n * response, so the boundary a press happens inside never moves. */\nexport const motionInkPress =\n \"transition-transform duration-release ease-release group-active:duration-press group-active:ease-press group-active:scale-[0.88] motion-reduce:transition-none motion-reduce:group-active:scale-100\";\n\n/* Motion is not owned here — but the recipes above are the whole vocabulary: every press, arrival,\n travel, presence and activity in the library is one of these names plus its owner's own target\n geometry. */\n\n/* A field that opens a list — a `Select`'s trigger, an editable `Combobox`'s field — takes\n `motionTactile` as a whole, which is what makes the two forms of the same control press\n identically. The *field* is the element that carries the compression in both: a press activates\n the whole chain, so a descendant being pressed is what makes the field itself match `:active`\n (and a select trigger's own active state is suppressed by the primitive, so its field's wrapper\n is the only element left to carry it). Typing, focus and hover never match it, so the field is\n perfectly still while it is used as a text field; a press that places a caret or drags across a\n word is the same press the field already answers, and distinguishing it would take pointer\n bookkeeping inside a component for a case that reads as one interaction either way. */\n\n/** A meaningful subordinate part arrives. Spring is reserved for this intent: a mark is\n * made by overshooting the position it lands in. It leaves without the overshoot, and\n * reduced motion lands it in one step — which takes a *state-specific* override, because the\n * starting state is a higher-specificity rule than a plain `transform: none` and would otherwise\n * win under reduced motion while the transition was gone, turning a spring into an instant jump. */\nexport const motionArrive =\n \"transition-[background-color,color,box-shadow,transform,opacity] duration-release ease-spring data-[starting-style]:scale-50 data-[ending-style]:scale-50 data-[ending-style]:opacity-0 data-[ending-style]:duration-overlay-exit data-[ending-style]:ease-exit motion-reduce:transition-none motion-reduce:transform-none motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100\";\n\n/** A persistent affordance changes orientation in place: a disclosure chevron. It reaches\n * its target orientation consistently and never overshoots. */\nexport const motionOrient =\n \"transition-transform duration-release ease-release motion-reduce:transition-none\";\n\n/** A persistent object travels between stable destinations: a tab indicator, a switch\n * thumb. The travel itself is the event, so it takes the glide curve rather than the\n * arrival curve, and it never overshoots: a destination that is passed and come back\n * from reads as a defect. Position, size and the tone the object picks up on the way\n * settle together, and an interrupted move retargets from wherever it currently is\n * because it is a transition and not a keyframe. */\nexport const motionRelocate =\n \"transition-[left,inset-inline-start,top,width,height,transform,background-color,color,box-shadow,opacity] duration-release ease-glide motion-reduce:transition-none\";\n\n/** Direct manipulation: the pointer owns the geometry, so a positional transition would be\n * lag. While the primitive reports a drag, position and size are removed from the\n * transition list and only tone and engagement geometry remain; a keyboard or programmatic\n * step still settles. Reduced motion never changes direct manipulation. */\nexport const motionDirect =\n \"transition-[inset-inline-start,width,height,background-color,color,box-shadow,transform,opacity] duration-release ease-release active:duration-press active:ease-press data-[dragging]:transition-[background-color,color,box-shadow,transform,opacity] motion-reduce:transition-none motion-reduce:transform-none\";\n\n/* Anchored popup, tooltip, modal, sheet, toast and scrim presence share three states:\n settled, `data-starting-style` and `data-ending-style`. The primitive decides\n when the node mounts and unmounts.\n None of them writes an animation keyframe or a timer, so a rapid open → close → open\n retargets from the current painted value instead of restarting.\n\n The anchored roles read their entrance direction from the resolved side. Base publishes\n the side on the popup after collision handling and the origin as `--transform-origin`, so\n a surface below its trigger rises into place, one above it settles down into it, and one\n flipped by a collision animates the way it is actually placed. */\n\nconst anchoredGeometry = /* @__PURE__ */ cx(\n \"[transform-origin:var(--transform-origin)]\",\n \"[--sui-overlay-from-shift-y:-4px]\",\n \"data-[side=top]:[--sui-overlay-from-shift-y:4px]\",\n \"data-[side=left]:[--sui-overlay-from-shift-y:0px] data-[side=left]:[--sui-overlay-from-shift-x:4px]\",\n \"data-[side=right]:[--sui-overlay-from-shift-y:0px] data-[side=right]:[--sui-overlay-from-shift-x:-4px]\",\n /* The logical sides resolve against the writing direction: `inline-start` puts the popup at the\n anchor's inline-start edge, which is its physical *left* on a left-to-right page and its\n physical *right* on a right-to-left one, so the four pixels that travel toward the anchor\n change sign with the page while the physical sides above never do. The direction is read from\n the `dir` attribute — the attribute that lays the page out, and the only one a portaled\n surface can see. The primitive resolves the side from the direction *it* is told about\n (`DirectionProvider`), so a consumer whose page is right-to-left declares that direction to\n both, exactly as the workbench's RTL specimens do. */\n \"data-[side=inline-start]:[--sui-overlay-from-shift-y:0px] data-[side=inline-start]:[--sui-overlay-from-shift-x:4px]\",\n \"[[dir=rtl]_&]:data-[side=inline-start]:[--sui-overlay-from-shift-x:-4px]\",\n \"data-[side=inline-end]:[--sui-overlay-from-shift-y:0px] data-[side=inline-end]:[--sui-overlay-from-shift-x:-4px]\",\n \"[[dir=rtl]_&]:data-[side=inline-end]:[--sui-overlay-from-shift-x:4px]\",\n);\n\n/* Both ends of a presence animation start from the same state, and reduced motion drops the\n spatial half of it: presence still reads as arriving, but only through opacity. The\n transform is a literal class rather than an interpolated one, because the stylesheet\n compiler reads class names as text: a name that only exists once a template is evaluated\n compiles to no rule at all. */\nconst anchoredFrom = /* @__PURE__ */ cx(\n \"data-[starting-style]:opacity-0\",\n \"data-[starting-style]:[transform:translate(var(--sui-overlay-from-shift-x,0px),var(--sui-overlay-from-shift-y,0px))scale(var(--sui-overlay-from-scale,1))]\",\n \"data-[ending-style]:opacity-0\",\n \"data-[ending-style]:[transform:translate(var(--sui-overlay-from-shift-x,0px),var(--sui-overlay-from-shift-y,0px))scale(var(--sui-overlay-from-scale,1))]\",\n \"motion-reduce:data-[starting-style]:transform-none\",\n \"motion-reduce:data-[ending-style]:transform-none\",\n);\n\nconst modalFrom = /* @__PURE__ */ cx(\n \"data-[starting-style]:opacity-0\",\n \"data-[starting-style]:[transform:translate(0,12px)scale(0.96)]\",\n \"data-[ending-style]:opacity-0\",\n \"data-[ending-style]:[transform:translate(0,12px)scale(0.96)]\",\n \"motion-reduce:data-[starting-style]:transform-none\",\n \"motion-reduce:data-[ending-style]:transform-none\",\n);\n\n/** An anchored surface: `Select`, `Combobox`, `Menu` and `Popover`. It grows out of the edge\n * it is attached to, enters on the overlay timing, and leaves on the shorter exit.\n *\n * The grow is the motion's signature and the four pixels of travel only support it, so the\n * entrance takes the glide curve rather than the arrival curve. With a front-loaded curve the\n * opacity and the scale both jump in the first frames, which means the surface is already half\n * grown by the time it is visible at all — a pop, not a grow. The glide curve spends its whole\n * duration visible, so the eye actually sees the surface open out of its anchor. */\nexport const motionPresenceAnchored = /* @__PURE__ */ cx(\n \"transition-[opacity,transform] duration-overlay ease-glide\",\n \"data-[ending-style]:duration-overlay-exit data-[ending-style]:ease-exit\",\n \"motion-reduce:transition-[opacity]\",\n \"[--sui-overlay-from-scale:0.94]\",\n anchoredGeometry,\n anchoredFrom,\n);\n\n/** A tooltip: the same side-aware model and the same grow as an anchored popup, deliberately\n * lighter — it settles on the local timing rather than the overlay timing, and it never\n * bounces. */\nexport const motionPresenceTooltip = /* @__PURE__ */ cx(\n \"transition-[opacity,transform] duration-release ease-glide\",\n \"data-[ending-style]:duration-overlay-exit data-[ending-style]:ease-exit\",\n \"motion-reduce:transition-[opacity]\",\n \"[--sui-overlay-from-scale:0.94]\",\n anchoredGeometry,\n anchoredFrom,\n);\n\n/** A modal surface: anchored to the viewport rather than to a trigger, so it has no side\n * to grow from. A large surface never bounces; it fades, rises a little and settles, and its\n * scale stays restrained because a plane this big grows visibly even from a few percent. */\nexport const motionPresenceModal = /* @__PURE__ */ cx(\n \"transition-[opacity,transform] duration-overlay ease-glide\",\n \"data-[ending-style]:duration-overlay-exit data-[ending-style]:ease-exit\",\n \"motion-reduce:transition-[opacity]\",\n modalFrom,\n);\n\n/** The plane behind a surface that owns the viewport. Opacity only: a blur or a filter is\n * never animated, so the plane can never animate the page behind it. */\nexport const motionPresenceScrim =\n \"transition-opacity duration-overlay ease-release data-[ending-style]:duration-overlay-exit data-[ending-style]:ease-exit\";\n\n/** Continuous activity is a distinct intent, not an exception to interaction motion: it\n * reports work rather than answering an event, and it has no entrance of its own. */\nexport const motionActivitySpin = \"animate-spin motion-reduce:animate-none\";\nexport const motionActivityPulse = \"animate-pulse motion-reduce:animate-none\";\n\n/** The indeterminate half of a progress bar. A task with no known value cannot report a\n * position, so it reports *work* instead: the fill sweeps across its own track on the one loop\n * that is paced, because a loop that reports rather than answers cannot arrive. The travel is a\n * composited transform rather than a laid-out edge, and an endless loop must never sit on the\n * layout path; the direction is a value the recipe flips with the writing direction, because a\n * transform is physical and the sweep follows the page. Under reduced motion the loop stops and\n * the fill rests where it starts: a static status glyph, exactly as the spin and the pulse rest. */\nexport const motionActivityIndeterminate =\n \"animate-sherick-indeterminate [[dir=rtl]_&]:[--sui-indeterminate-direction:-1] motion-reduce:animate-none\";\n\n/** The state layer is a composited overlay, so its own opacity is the only thing that\n * moves. Shared here because four interaction states across the library ride it. */\nexport const motionStateLayer =\n \"before:transition-opacity before:duration-release before:ease-release active:before:duration-press active:before:ease-press group-active:before:duration-press group-active:before:ease-press motion-reduce:before:transition-none\";\n\n/* `disclose` is the in-flow counterpart of presence: nothing mounts or unmounts, and nothing\n leaves the page — one region changes its own height where it sits. Base measures the panel and\n publishes that height, so the geometry is the primitive's and only the interpolation is here.\n The panel states the height it opens to; this recipe owns how it gets there, and reduced\n motion applies the layout state in one step rather than travelling through it. */\nexport const motionDisclose =\n \"transition-[height] duration-release ease-release data-[starting-style]:h-0 data-[ending-style]:h-0 motion-reduce:transition-none\";\n\n/* A sheet is a surface that owns the viewport and is attached to one edge of it, so its presence is\n a slide out of that edge rather than the modal lift, and it never bounces. The component names the\n edge by setting exactly one of `--sui-sheet-from-x` / `--sui-sheet-from-y` to a full own-extent\n offset, because which edge a sheet is attached to is anatomy; how far it travels and how long it\n takes are not.\n\n The other axis is `0px`, and that default is load-bearing: a fallback of `100%` on the axis the\n component did not set would translate a side sheet on both axes at once, so a sheet attached to\n the right edge would enter from the bottom-right corner and travel diagonally instead of\n straight in. One edge means one axis. */\nexport const motionPresenceSheet = /* @__PURE__ */ cx(\n \"transition-[transform,opacity] duration-overlay ease-glide\",\n \"data-[ending-style]:duration-overlay-exit data-[ending-style]:ease-exit\",\n \"motion-reduce:transition-[opacity]\",\n \"data-[starting-style]:opacity-0\",\n \"data-[ending-style]:opacity-0\",\n \"data-[starting-style]:[transform:translate(var(--sui-sheet-from-x,0px),var(--sui-sheet-from-y,0px))]\",\n \"data-[ending-style]:[transform:translate(var(--sui-sheet-from-x,0px),var(--sui-sheet-from-y,0px))]\",\n \"motion-reduce:data-[starting-style]:transform-none\",\n \"motion-reduce:data-[ending-style]:transform-none\",\n);\n\n/* A toast is a stack, not a single surface: several independent surfaces share one corner,\n re-flow when one of them leaves, and can each be flung away by the pointer. That is one\n spatial owner on one node, and this is it.\n\n The component owns where a toast rests — its stacked offset, its clamped height and the\n expanded fan are geometry — and sets `--sui-toast-from-y` to the direction the stack grows in.\n This recipe owns the entrance, the exit, the stack's re-flow, and the gesture: while\n `data-swiping` is set the node follows the pointer with no interpolation at all, and a\n dismissal carries the movement it was flung with so the toast keeps travelling the way it was\n already going instead of turning around. */\nexport const motionPresenceToast = /* @__PURE__ */ cx(\n \"transition-[transform,opacity,height] duration-overlay ease-glide\",\n \"data-[ending-style]:duration-overlay-exit data-[ending-style]:ease-exit\",\n \"data-[swiping]:transition-none\",\n \"motion-reduce:transition-[opacity]\",\n \"data-[starting-style]:opacity-0\",\n \"data-[ending-style]:opacity-0\",\n \"data-[starting-style]:[transform:translateY(var(--sui-toast-from-y,150%))]\",\n \"[&[data-ending-style]:not([data-swipe-direction])]:[transform:translateY(var(--sui-toast-from-y,150%))]\",\n \"data-[ending-style]:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y,0px)+150%))]\",\n \"data-[ending-style]:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y,0px)-150%))]\",\n \"data-[ending-style]:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x,0px)-150%))]\",\n \"data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x,0px)+150%))]\",\n \"motion-reduce:data-[starting-style]:transform-none\",\n \"motion-reduce:data-[ending-style]:transform-none\",\n);\n"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;;AAsBiD;AAEjD;;;;AAI+E;AAc/E;;AAEmC;AAC5B,MAAM,cAAc,GACzB;AAEF;;;;;;;AAOuF;AACvF;AACmF;AAC5E,MAAM,aAAa,GACxB;AAEF;;;;;;;;AAQoE;AAC7D,MAAM,cAAc,GACzB;AAEF;;AAEe;AAEf;;;;;;;;AAQyF;AAEzF;;;;AAIqG;AAC9F,MAAM,YAAY,GACvB;AAEF;AACgE;AACzD,MAAM,YAAY,GACvB;AAEF;;;;;AAKqD;AAC9C,MAAM,cAAc,GACzB;AAEF;;;AAG4E;AACrE,MAAM,YAAY,GACvB;AAEF;;;;;;;;;AASoE;AAEpE,MAAM,gBAAgB,mBAAmB,EAAE,CACzC,4CAA4C,EAC5C,mCAAmC,EACnC,kDAAkD,EAClD,qGAAqG,EACrG,wGAAwG;AACxG;;;;;;;AAOwD;AACxD,qHAAqH,EACrH,0EAA0E,EAC1E,kHAAkH,EAClH,uEAAuE,CACxE;AAED;;;;AAIiC;AACjC,MAAM,YAAY,mBAAmB,EAAE,CACrC,iCAAiC,EACjC,4JAA4J,EAC5J,+BAA+B,EAC/B,0JAA0J,EAC1J,oDAAoD,EACpD,kDAAkD,CACnD;AAED,MAAM,SAAS,mBAAmB,EAAE,CAClC,iCAAiC,EACjC,gEAAgE,EAChE,+BAA+B,EAC/B,8DAA8D,EAC9D,oDAAoD,EACpD,kDAAkD,CACnD;AAED;;;;;;;AAOqF;MACxE,sBAAsB,mBAAmB,EAAE,CACtD,4DAA4D,EAC5D,yEAAyE,EACzE,oCAAoC,EACpC,iCAAiC,EACjC,gBAAgB,EAChB,YAAY;AAGd;;AAEe;MACF,qBAAqB,mBAAmB,EAAE,CACrD,4DAA4D,EAC5D,yEAAyE,EACzE,oCAAoC,EACpC,iCAAiC,EACjC,gBAAgB,EAChB,YAAY;AAGd;;AAE6F;AACtF,MAAM,mBAAmB,mBAAmB,EAAE,CACnD,4DAA4D,EAC5D,yEAAyE,EACzE,oCAAoC,EACpC,SAAS;AAGX;AACyE;AAClE,MAAM,mBAAmB,GAC9B;AAEF;AACsF;AAC/E,MAAM,kBAAkB,GAAG;AAC3B,MAAM,mBAAmB,GAAG;AAEnC;;;;;;AAMqG;AAC9F,MAAM,2BAA2B,GACtC;AAEF;AACqF;AAC9E,MAAM,gBAAgB,GAC3B;AAEF;;;;AAIoF;AAC7E,MAAM,cAAc,GACzB;AAEF;;;;;;;;;AAS2C;AACpC,MAAM,mBAAmB,mBAAmB,EAAE,CACnD,4DAA4D,EAC5D,yEAAyE,EACzE,oCAAoC,EACpC,iCAAiC,EACjC,+BAA+B,EAC/B,sGAAsG,EACtG,oGAAoG,EACpG,oDAAoD,EACpD,kDAAkD;AAGpD;;;;;;;;;AAS8C;AACvC,MAAM,mBAAmB,mBAAmB,EAAE,CACnD,mEAAmE,EACnE,yEAAyE,EACzE,gCAAgC,EAChC,oCAAoC,EACpC,iCAAiC,EACjC,+BAA+B,EAC/B,4EAA4E,EAC5E,yGAAyG,EACzG,sHAAsH,EACtH,oHAAoH,EACpH,sHAAsH,EACtH,uHAAuH,EACvH,oDAAoD,EACpD,kDAAkD;;"}
|
|
1
|
+
{"version":3,"file":"ui.motion.js","sources":["../../../src/components/ui.motion.ts"],"sourcesContent":["/* Sherick UI motion grammar\n =========================\n Components describe what changes; this module exclusively describes how change moves.\n\n The canonical intents are:\n - feedback: non-spatial state response;\n - tactile: temporary physical response to activation;\n - arrive: a meaningful subordinate part appears or leaves;\n - orient: a persistent part changes orientation in place;\n - relocate: a persistent part moves or resizes between stable states;\n - direct: geometry continuously follows the user;\n - disclose: in-flow content expands and collapses;\n - presence: an independent surface enters/leaves;\n - activity: continuous motion that communicates ongoing work.\n\n Every recipe here owns the transition property, the duration, the curve and the\n `prefers-reduced-motion` behavior for one physical event. The durations and curves\n themselves are the authored tokens in `src/styles/tokens.ts`; nothing in this file\n writes a literal duration or an animation keyframe beyond the two activity loops.\n\n `docs/DESIGN_LANGUAGE.md` owns the semantics. Target geometry, material, tone and\n elevation remain component/anatomy concerns: a component says where something ends\n up, and this module says how it gets there. */\n\n/* A recipe that is composed from other recipes is built through `cx`, whose call is marked pure.\n That is load-bearing for the published bundles rather than a bundler detail: an unused recipe\n whose value is a template literal with a substitution in it is not provably side-effect-free, so\n it survives tree-shaking and every consumer that imports any part of this module pays for every\n recipe in it — including the families it never uses. See `libs/utils.ts`. */\nimport { cx } from \"@/libs/utils\";\n\nexport type MotionIntent =\n | \"feedback\"\n | \"tactile\"\n | \"arrive\"\n | \"orient\"\n | \"relocate\"\n | \"direct\"\n | \"disclose\"\n | \"presence\"\n | \"activity\";\n\n/** Non-spatial feedback: hover, focus, field tone, a highlighted row, a filled surface.\n * It never translates, scales or resizes; reduced motion simply drops the interpolation\n * and the state still arrives. */\nexport const motionFeedback =\n \"transition-[background-color,color,box-shadow,opacity] duration-press ease-press motion-reduce:transition-none\";\n\n/** A control answers a press immediately and settles on its release.\n *\n * The recipe owns the *amplitude* of that answer as well as its timing, because how far a press\n * travels is the system's physical character rather than a component's anatomy. A percentage is a\n * distance only once it meets a size, so the amplitude comes in tiers chosen by the control's role:\n *\n * - `motionTactile`: a content-width control — a button, a chip, a segment — compresses 4%, about\n * two pixels at the size of the ink it moves.\n * - `motionTactileWide`: a control that spans a track — a tab — compresses 1.5%, so its edges move\n * about as far as a button's.\n * - `motionTactileField`: a list-opening field — a Select trigger, an editable Combobox — spans\n * its whole container, and 4% of a 580px field moved each edge 11.6px. It compresses 0.7%, about\n * two pixels at that width: the field acknowledges the press without lurching.\n *\n * The press leg runs on `duration-tactile`, short enough to land inside a tap; the release settles\n * on the release timing. A control whose visible ink is far smaller than its target takes\n * `motionInkPress` on that ink instead, so the target itself never moves. The interpolation and\n * the compression are neutralised together under reduced motion. */\n/* Base may disable the surface itself or the value control inside a Select wrapper.\n Neither is a pressable surface. Timing is otherwise shared by every tier. */\nconst tactileTiming =\n \"transition-[background-color,color,box-shadow,transform,opacity] duration-release ease-release active:duration-tactile active:ease-press motion-reduce:transition-none\";\n\nexport const motionTactile = /* @__PURE__ */ cx(\n tactileTiming,\n \"motion-safe:[&:not([data-disabled],:disabled,:has(>[role=combobox][data-disabled]))]:active:scale-[0.96]\"\n);\n\nexport const motionTactileWide = /* @__PURE__ */ cx(\n tactileTiming,\n \"motion-safe:[&:not([data-disabled],:disabled)]:active:scale-[0.985]\"\n);\n\nexport const motionTactileField = /* @__PURE__ */ cx(\n tactileTiming,\n \"motion-safe:[&:not([data-disabled],:disabled,:has(>[role=combobox][data-disabled]))]:active:scale-[0.993]\"\n);\n\n/** The spatial half of a compact press, applied to the *mark* rather than to the control.\n *\n * A control whose visible ink is much smaller than the target it is aimed at — a dialog's close\n * control, a stepper, a search field's submit — is a large target around a small glyph, and only\n * the glyph is visible at rest. Compressing the whole control would shrink the ground the pointer\n * is already on (a 44px target becomes 38.7px while held, which is exactly where a near-edge\n * release lands), so the mark takes the twelve percent and the target keeps its geometry. The\n * target still owns the focus ring and the state layer, and still carries the tone and depth\n * response, so the boundary a press happens inside never moves. */\nexport const motionInkPress =\n \"transition-transform duration-release ease-release group-active:duration-tactile group-active:ease-press group-active:scale-[0.88] motion-reduce:transition-none motion-reduce:group-active:scale-100\";\n\n/* Motion is not owned here — but the recipes above are the whole vocabulary: every press, arrival,\n travel, presence and activity in the library is one of these names plus its owner's own target\n geometry. */\n\n/* A field that opens a list — a `Select`'s trigger, an editable `Combobox`'s field — takes\n `motionTactile` as a whole, which is what makes the two forms of the same control press\n identically. The *field* is the element that carries the compression in both: a press activates\n the whole chain, so a descendant being pressed is what makes the field itself match `:active`\n (and a select trigger's own active state is suppressed by the primitive, so its field's wrapper\n is the only element left to carry it). Typing, focus and hover never match it, so the field is\n perfectly still while it is used as a text field; a press that places a caret or drags across a\n word is the same press the field already answers, and distinguishing it would take pointer\n bookkeeping inside a component for a case that reads as one interaction either way. */\n\n/** A meaningful subordinate part arrives. Spring is reserved for this intent: a mark is\n * made by overshooting the position it lands in. It leaves without the overshoot, and\n * reduced motion lands it in one step — which takes a *state-specific* override, because the\n * starting state is a higher-specificity rule than a plain `transform: none` and would otherwise\n * win under reduced motion while the transition was gone, turning a spring into an instant jump. */\nexport const motionArrive =\n \"transition-[background-color,color,box-shadow,transform,opacity] duration-release ease-spring data-[starting-style]:scale-50 data-[ending-style]:scale-50 data-[ending-style]:opacity-0 data-[ending-style]:duration-overlay-exit data-[ending-style]:ease-exit motion-reduce:transition-none motion-reduce:transform-none motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100\";\n\n/** A persistent affordance changes orientation in place: a disclosure chevron. It reaches\n * its target orientation consistently and never overshoots. */\nexport const motionOrient =\n \"transition-transform duration-release ease-release motion-reduce:transition-none\";\n\n/** A persistent object travels between stable destinations: a tab indicator, a switch\n * thumb. The travel itself is the event, so it takes the glide curve rather than the\n * arrival curve, and it never overshoots: a destination that is passed and come back\n * from reads as a defect. Position, size and the tone the object picks up on the way\n * settle together, and an interrupted move retargets from wherever it currently is\n * because it is a transition and not a keyframe. */\nexport const motionRelocate =\n \"transition-[left,inset-inline-start,top,width,height,transform,background-color,color,box-shadow,opacity] duration-release ease-glide motion-reduce:transition-none\";\n\n/** The same travel across a whole track — a tab indicator — on the longer travel timing, so a\n * movement of hundreds of pixels is followed rather than skipped. */\nexport const motionRelocateLong =\n \"transition-[left,inset-inline-start,top,width,height,transform,background-color,color,box-shadow,opacity] duration-travel ease-glide motion-reduce:transition-none\";\n\n/** Direct manipulation: the pointer owns the geometry, so a positional transition would be\n * lag. While the primitive reports a drag, position and size are removed from the\n * transition list and only tone and engagement geometry remain; a keyboard or programmatic\n * step still settles. Reduced motion never changes direct manipulation. */\nexport const motionDirect =\n \"transition-[inset-inline-start,width,height,background-color,color,box-shadow,transform,opacity] duration-release ease-release active:duration-press active:ease-press data-[dragging]:transition-[background-color,color,box-shadow,transform,opacity] motion-reduce:transition-none motion-reduce:transform-none\";\n\n/* Anchored popup, tooltip, modal, sheet, toast and scrim presence share three states:\n settled, `data-starting-style` and `data-ending-style`. The primitive decides\n when the node mounts and unmounts.\n None of them writes an animation keyframe or a timer, so a rapid open → close → open\n retargets from the current painted value instead of restarting.\n\n The anchored roles read their entrance direction from the resolved side. Base publishes\n the side on the popup after collision handling and the origin as `--transform-origin`, so\n a surface below its trigger rises into place, one above it settles down into it, and one\n flipped by a collision animates the way it is actually placed. */\n\nconst anchoredGeometry = /* @__PURE__ */ cx(\n \"[transform-origin:var(--transform-origin)]\",\n \"[--sui-overlay-from-shift-y:-4px]\",\n \"data-[side=top]:[--sui-overlay-from-shift-y:4px]\",\n \"data-[side=left]:[--sui-overlay-from-shift-y:0px] data-[side=left]:[--sui-overlay-from-shift-x:4px]\",\n \"data-[side=right]:[--sui-overlay-from-shift-y:0px] data-[side=right]:[--sui-overlay-from-shift-x:-4px]\",\n /* The logical sides resolve against the writing direction: `inline-start` puts the popup at the\n anchor's inline-start edge, which is its physical *left* on a left-to-right page and its\n physical *right* on a right-to-left one, so the four pixels that travel toward the anchor\n change sign with the page while the physical sides above never do. The direction is read from\n the `dir` attribute — the attribute that lays the page out, and the only one a portaled\n surface can see. The primitive resolves the side from the direction *it* is told about\n (`DirectionProvider`), so a consumer whose page is right-to-left declares that direction to\n both, exactly as the workbench's RTL specimens do. */\n \"data-[side=inline-start]:[--sui-overlay-from-shift-y:0px] data-[side=inline-start]:[--sui-overlay-from-shift-x:4px]\",\n \"[[dir=rtl]_&]:data-[side=inline-start]:[--sui-overlay-from-shift-x:-4px]\",\n \"data-[side=inline-end]:[--sui-overlay-from-shift-y:0px] data-[side=inline-end]:[--sui-overlay-from-shift-x:-4px]\",\n \"[[dir=rtl]_&]:data-[side=inline-end]:[--sui-overlay-from-shift-x:4px]\",\n);\n\n/* Both ends of a presence animation start from the same state, and reduced motion drops the\n spatial half of it: presence still reads as arriving, but only through opacity. The\n transform is a literal class rather than an interpolated one, because the stylesheet\n compiler reads class names as text: a name that only exists once a template is evaluated\n compiles to no rule at all. */\nconst anchoredFrom = /* @__PURE__ */ cx(\n \"data-[starting-style]:opacity-0\",\n \"data-[starting-style]:[transform:translate(var(--sui-overlay-from-shift-x,0px),var(--sui-overlay-from-shift-y,0px))scale(var(--sui-overlay-from-scale,1))]\",\n \"data-[ending-style]:opacity-0\",\n \"data-[ending-style]:[transform:translate(var(--sui-overlay-from-shift-x,0px),var(--sui-overlay-from-shift-y,0px))scale(var(--sui-overlay-from-scale,1))]\",\n \"motion-reduce:data-[starting-style]:transform-none\",\n \"motion-reduce:data-[ending-style]:transform-none\",\n);\n\nconst modalFrom = /* @__PURE__ */ cx(\n \"data-[starting-style]:opacity-0\",\n \"data-[starting-style]:[transform:translate(0,12px)scale(0.96)]\",\n \"data-[ending-style]:opacity-0\",\n \"data-[ending-style]:[transform:translate(0,12px)scale(0.96)]\",\n \"motion-reduce:data-[starting-style]:transform-none\",\n \"motion-reduce:data-[ending-style]:transform-none\",\n);\n\n/** An anchored surface: `Select`, `Combobox`, `Menu` and `Popover`. It grows out of the edge\n * it is attached to, enters on the overlay timing, and leaves on the shorter exit.\n *\n * The grow is the motion's signature and the four pixels of travel only support it, so the\n * entrance takes the glide curve rather than the arrival curve. With a front-loaded curve the\n * opacity and the scale both jump in the first frames, which means the surface is already half\n * grown by the time it is visible at all — a pop, not a grow. The glide curve spends its whole\n * duration visible, so the eye actually sees the surface open out of its anchor. */\nexport const motionPresenceAnchored = /* @__PURE__ */ cx(\n \"transition-[opacity,transform] duration-overlay ease-glide\",\n \"data-[ending-style]:duration-overlay-exit data-[ending-style]:ease-exit\",\n \"motion-reduce:transition-[opacity]\",\n \"[--sui-overlay-from-scale:0.94]\",\n anchoredGeometry,\n anchoredFrom,\n);\n\n/** A tooltip: the same side-aware model and the same grow as an anchored popup, deliberately\n * lighter — it settles on the local timing rather than the overlay timing, and it never\n * bounces. */\nexport const motionPresenceTooltip = /* @__PURE__ */ cx(\n \"transition-[opacity,transform] duration-release ease-glide\",\n \"data-[ending-style]:duration-overlay-exit data-[ending-style]:ease-exit\",\n \"motion-reduce:transition-[opacity]\",\n \"[--sui-overlay-from-scale:0.94]\",\n anchoredGeometry,\n anchoredFrom,\n);\n\n/** A modal surface: anchored to the viewport rather than to a trigger, so it has no side\n * to grow from. A large surface never bounces; it fades, rises a little and settles, and its\n * scale stays restrained because a plane this big grows visibly even from a few percent. */\nexport const motionPresenceModal = /* @__PURE__ */ cx(\n \"transition-[opacity,transform] duration-overlay ease-glide\",\n \"data-[ending-style]:duration-overlay-exit data-[ending-style]:ease-exit\",\n \"motion-reduce:transition-[opacity]\",\n modalFrom,\n);\n\n/** The plane behind a surface that owns the viewport. Opacity only: a blur or a filter is\n * never animated, so the plane can never animate the page behind it. */\nexport const motionPresenceScrim =\n \"transition-opacity duration-overlay ease-release data-[starting-style]:opacity-0 data-[ending-style]:opacity-0 data-[ending-style]:duration-overlay-exit data-[ending-style]:ease-exit\";\n\n/** Continuous activity is a distinct intent, not an exception to interaction motion: it\n * reports work rather than answering an event, and it has no entrance of its own. */\nexport const motionActivitySpin = \"animate-spin motion-reduce:animate-none\";\nexport const motionActivityPulse = \"animate-pulse motion-reduce:animate-none\";\n\n/** The indeterminate half of a progress bar. A task with no known value cannot report a\n * position, so it reports *work* instead: the fill sweeps across its own track on the one loop\n * that is paced, because a loop that reports rather than answers cannot arrive. The travel is a\n * composited transform rather than a laid-out edge, and an endless loop must never sit on the\n * layout path; the direction is a value the recipe flips with the writing direction, because a\n * transform is physical and the sweep follows the page. Under reduced motion the loop stops and\n * the fill rests where it starts: a static status glyph, exactly as the spin and the pulse rest. */\nexport const motionActivityIndeterminate =\n \"animate-sherick-indeterminate [[dir=rtl]_&]:[--sui-indeterminate-direction:-1] motion-reduce:animate-none\";\n\n/** The state layer is a composited overlay, so its own opacity is the only thing that\n * moves. Shared here because four interaction states across the library ride it. */\n/** A row in a collection moves its highlight rather than fading it: a highlight is where the reader\n * is, and arrowing through a list with a soft fade on every row leaves a smear of half-lit rows.\n * The row's layer therefore changes in one step, for the pointer and the keyboard alike. */\nexport const motionRowLayer = \"before:transition-none\";\n\nexport const motionStateLayer =\n \"before:transition-opacity before:duration-release before:ease-release active:before:duration-tactile active:before:ease-press group-active:before:duration-tactile group-active:before:ease-press motion-reduce:before:transition-none\";\n\n/* `disclose` is the in-flow counterpart of presence: nothing mounts or unmounts, and nothing\n leaves the page — one region changes its own height where it sits. Base measures the panel and\n publishes that height, so the geometry is the primitive's and only the interpolation is here.\n The panel states the height it opens to; this recipe owns how it gets there, and reduced\n motion applies the layout state in one step rather than travelling through it. */\nexport const motionDisclose =\n \"transition-[height] duration-release ease-release data-[starting-style]:h-0 data-[ending-style]:h-0 data-[ending-style]:duration-overlay-exit data-[ending-style]:ease-exit motion-reduce:transition-none\";\n\n/* A sheet is a surface that owns the viewport and is attached to one edge of it, so its presence is\n a slide out of that edge rather than the modal lift, and it never bounces. The component names the\n edge by setting exactly one of `--sui-sheet-from-x` / `--sui-sheet-from-y` to a full own-extent\n offset, because which edge a sheet is attached to is anatomy; how far it travels and how long it\n takes are not.\n\n The other axis is `0px`, and that default is load-bearing: a fallback of `100%` on the axis the\n component did not set would translate a side sheet on both axes at once, so a sheet attached to\n the right edge would enter from the bottom-right corner and travel diagonally instead of\n straight in. One edge means one axis. */\nexport const motionPresenceSheet = /* @__PURE__ */ cx(\n \"transition-[transform,opacity] duration-sheet ease-glide\",\n \"data-[ending-style]:duration-sheet-exit data-[ending-style]:ease-exit\",\n \"motion-reduce:transition-[opacity]\",\n \"data-[starting-style]:opacity-0\",\n \"data-[ending-style]:opacity-0\",\n \"data-[starting-style]:[transform:translate(var(--sui-sheet-from-x,0px),var(--sui-sheet-from-y,0px))]\",\n \"data-[ending-style]:[transform:translate(var(--sui-sheet-from-x,0px),var(--sui-sheet-from-y,0px))]\",\n \"motion-reduce:data-[starting-style]:transform-none\",\n \"motion-reduce:data-[ending-style]:transform-none\",\n);\n\n/* A toast is a stack, not a single surface: several independent surfaces share one corner,\n re-flow when one of them leaves, and can each be flung away by the pointer. That is one\n spatial owner on one node, and this is it.\n\n The component owns where a toast rests — its stacked offset, its clamped height and the\n expanded fan are geometry — and sets `--sui-toast-from-y` to the direction the stack grows in.\n This recipe owns the entrance, the exit, the stack's re-flow, and the gesture: while\n `data-swiping` is set the node follows the pointer with no interpolation at all, and a\n dismissal carries the movement it was flung with so the toast keeps travelling the way it was\n already going instead of turning around. */\nexport const motionPresenceToast = /* @__PURE__ */ cx(\n \"transition-[transform,opacity,height] duration-overlay ease-glide\",\n \"data-[ending-style]:duration-overlay-exit data-[ending-style]:ease-exit\",\n \"data-[swiping]:transition-none\",\n \"motion-reduce:transition-[opacity]\",\n \"data-[starting-style]:opacity-0\",\n \"data-[ending-style]:opacity-0\",\n \"data-[starting-style]:[transform:translateY(var(--sui-toast-from-y,150%))]\",\n \"[&[data-ending-style]:not([data-swipe-direction])]:[transform:translateY(var(--sui-toast-from-y,150%))]\",\n \"data-[ending-style]:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y,0px)+150%))]\",\n \"data-[ending-style]:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y,0px)-150%))]\",\n \"data-[ending-style]:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x,0px)-150%))]\",\n \"data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x,0px)+150%))]\",\n \"motion-reduce:data-[starting-style]:transform-none\",\n \"motion-reduce:data-[ending-style]:transform-none\",\n);\n"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;;AAsBiD;AAEjD;;;;AAI+E;AAc/E;;AAEmC;AAC5B,MAAM,cAAc,GACzB;AAEF;;;;;;;;;;;;;;;;;AAiBqE;AACrE;AAC+E;AAC/E,MAAM,aAAa,GACjB,wKAAwK;AAEnK,MAAM,aAAa,mBAAmB,EAAE,CAC7C,aAAa,EACb,0GAA0G;AAGrG,MAAM,iBAAiB,mBAAmB,EAAE,CACjD,aAAa,EACb,qEAAqE;AAGhE,MAAM,kBAAkB,mBAAmB,EAAE,CAClD,aAAa,EACb,2GAA2G;AAG7G;;;;;;;;AAQoE;AAC7D,MAAM,cAAc,GACzB;AAEF;;AAEe;AAEf;;;;;;;;AAQyF;AAEzF;;;;AAIqG;AAC9F,MAAM,YAAY,GACvB;AAEF;AACgE;AACzD,MAAM,YAAY,GACvB;AAEF;;;;;AAKqD;AAC9C,MAAM,cAAc,GACzB;AAEF;AACsE;AAC/D,MAAM,kBAAkB,GAC7B;AAEF;;;AAG4E;AACrE,MAAM,YAAY,GACvB;AAEF;;;;;;;;;AASoE;AAEpE,MAAM,gBAAgB,mBAAmB,EAAE,CACzC,4CAA4C,EAC5C,mCAAmC,EACnC,kDAAkD,EAClD,qGAAqG,EACrG,wGAAwG;AACxG;;;;;;;AAOwD;AACxD,qHAAqH,EACrH,0EAA0E,EAC1E,kHAAkH,EAClH,uEAAuE,CACxE;AAED;;;;AAIiC;AACjC,MAAM,YAAY,mBAAmB,EAAE,CACrC,iCAAiC,EACjC,4JAA4J,EAC5J,+BAA+B,EAC/B,0JAA0J,EAC1J,oDAAoD,EACpD,kDAAkD,CACnD;AAED,MAAM,SAAS,mBAAmB,EAAE,CAClC,iCAAiC,EACjC,gEAAgE,EAChE,+BAA+B,EAC/B,8DAA8D,EAC9D,oDAAoD,EACpD,kDAAkD,CACnD;AAED;;;;;;;AAOqF;MACxE,sBAAsB,mBAAmB,EAAE,CACtD,4DAA4D,EAC5D,yEAAyE,EACzE,oCAAoC,EACpC,iCAAiC,EACjC,gBAAgB,EAChB,YAAY;AAGd;;AAEe;MACF,qBAAqB,mBAAmB,EAAE,CACrD,4DAA4D,EAC5D,yEAAyE,EACzE,oCAAoC,EACpC,iCAAiC,EACjC,gBAAgB,EAChB,YAAY;AAGd;;AAE6F;AACtF,MAAM,mBAAmB,mBAAmB,EAAE,CACnD,4DAA4D,EAC5D,yEAAyE,EACzE,oCAAoC,EACpC,SAAS;AAGX;AACyE;AAClE,MAAM,mBAAmB,GAC9B;AAEF;AACsF;AAC/E,MAAM,kBAAkB,GAAG;AAC3B,MAAM,mBAAmB,GAAG;AAEnC;;;;;;AAMqG;AAC9F,MAAM,2BAA2B,GACtC;AAEF;AACqF;AACrF;;AAE6F;AACtF,MAAM,cAAc,GAAG;AAEvB,MAAM,gBAAgB,GAC3B;AAEF;;;;AAIoF;AAC7E,MAAM,cAAc,GACzB;AAEF;;;;;;;;;AAS2C;AACpC,MAAM,mBAAmB,mBAAmB,EAAE,CACnD,0DAA0D,EAC1D,uEAAuE,EACvE,oCAAoC,EACpC,iCAAiC,EACjC,+BAA+B,EAC/B,sGAAsG,EACtG,oGAAoG,EACpG,oDAAoD,EACpD,kDAAkD;AAGpD;;;;;;;;;AAS8C;AACvC,MAAM,mBAAmB,mBAAmB,EAAE,CACnD,mEAAmE,EACnE,yEAAyE,EACzE,gCAAgC,EAChC,oCAAoC,EACpC,iCAAiC,EACjC,+BAA+B,EAC/B,4EAA4E,EAC5E,yGAAyG,EACzG,sHAAsH,EACtH,oHAAoH,EACpH,sHAAsH,EACtH,uHAAuH,EACvH,oDAAoD,EACpD,kDAAkD;;"}
|
package/dist/esm/dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { density, detail, disclosure, edge, edgeTone, elevation, fieldLayout, focusRing, focusRingDrag, focusRingHeld, focusRingInset, focusRingWithin, groupFocusRing, hitArea, list, material, matteInset, mediaCanvas, overlay, parentFocusRingInset, recessedTop, recipeAlphas, selectable, shape, stacking, state, stateLayer, text, tone } from './components/ui.common.js';
|
|
2
|
-
export { motionActivityIndeterminate, motionActivityPulse, motionActivitySpin, motionArrive, motionDirect, motionDisclose, motionFeedback, motionInkPress, motionOrient, motionPresenceAnchored, motionPresenceModal, motionPresenceScrim, motionPresenceSheet, motionPresenceToast, motionPresenceTooltip, motionRelocate, motionStateLayer, motionTactile } from './components/ui.motion.js';
|
|
1
|
+
export { currentDestination, density, detail, disclosure, edge, edgeTone, elevation, fieldLayout, fieldMessage, focusRing, focusRingDrag, focusRingHeld, focusRingInset, focusRingWithin, groupFocusRing, hitArea, iconSlot, list, material, matteInset, mediaCanvas, overlay, parentFocusRingInset, recessedTop, recipeAlphas, selectable, selectableRowSurface, shape, stacking, state, stateLayer, stateLayerQuietComposite, text, tone, type } from './components/ui.common.js';
|
|
2
|
+
export { motionActivityIndeterminate, motionActivityPulse, motionActivitySpin, motionArrive, motionDirect, motionDisclose, motionFeedback, motionInkPress, motionOrient, motionPresenceAnchored, motionPresenceModal, motionPresenceScrim, motionPresenceSheet, motionPresenceToast, motionPresenceTooltip, motionRelocate, motionRelocateLong, motionRowLayer, motionStateLayer, motionTactile, motionTactileField, motionTactileWide } from './components/ui.motion.js';
|
|
3
3
|
export { cn } from './libs/utils.js';
|
|
4
4
|
//# sourceMappingURL=dev.js.map
|