Skip to content

Commit ad8b220

Browse files
committed
Merge meta#8139 (its base with the list stack's re-fold after meta#8635) under the reorder mode hint
2 parents 8304693 + 083771c commit ad8b220

48 files changed

Lines changed: 3182 additions & 348 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.changeset/action-group-tracker.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@astryxdesign/core': patch
3+
---
4+
5+
[internal] One tracker for a held finger across a group of targets (an alert's or an action sheet's actions, a menu's rows, a segmented control's segments, a page control's dots): it reads the targets' rects once, resolves the finger against them (or by the owner's rule), paints or reports the highlight, and runs the target through its own click at the lift. Nothing a consumer sees changes.
6+
7+
@vjeux
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@astryxdesign/core': patch
3+
---
4+
5+
[fix] ChatComposerInput keeps focus and its Tab stop when disabled instead of moving focus to the page. Disabled editors block editing, paste/drop, trigger selection, imperative mutations, and submission while retaining their draft and accessible description.
6+
@korkt-kim
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@astryxdesign/core': patch
3+
---
4+
5+
[fix] Popover: an open popover no longer pulls in a Tab pressed elsewhere on the page. Keyboard users can move through the rest of the page in order while a popover is open, for example a list next to a non-modal comment popover. Focus inside the popover still cycles with Tab and Shift+Tab, and Escape still closes it and returns focus to its trigger. `useFocusTrap` applies the same rule: it holds focus that is inside its container and leaves Tabs that start outside to the page. This meets `component:Popover` DEC-9. Fixes #7687.
6+
7+
@cixzhang
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@astryxdesign/core': patch
3+
---
4+
5+
[fix] SideNav: a collapsed rail item's tooltip now binds to the link or button itself rather than the row around it, so the focusable control is the WAI-ARIA tooltip pattern's trigger and is described by the tooltip (`aria-describedby`) from its first render. Keyboard focus on it now shows the label. As with other link and button tooltips, a touch tap activates the control without opening the tooltip. A disabled item still shows its label on hover.
6+
7+
@ernestt @thewebartisan7

‎apps/sandbox/src/app/(sandbox)/pages/motion-lab/LabDemos.tsx‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {Badge} from '@astryxdesign/core/Badge';
3434
import {Button} from '@astryxdesign/core/Button';
3535
import {Card} from '@astryxdesign/core/Card';
3636
import {CheckboxInput} from '@astryxdesign/core/CheckboxInput';
37+
import {ProgressBar} from '@astryxdesign/core/ProgressBar';
3738
import {Tab, TabList} from '@astryxdesign/core/TabList';
3839
// A swizzled copy of core's TabList carrying the proposed travelling indicator.
3940
import {
@@ -43,6 +44,7 @@ import {
4344
import {Skeleton} from '@astryxdesign/core/Skeleton';
4445
import {SideNav, SideNavItem, SideNavSection} from '@astryxdesign/core/SideNav';
4546
import {Token} from '@astryxdesign/core/Token';
47+
import {themeProps} from '@astryxdesign/core/utils';
4648
import {HStack, VStack} from '@astryxdesign/core/Layout';
4749
import {Text} from '@astryxdesign/core/Text';
4850
import {useMotionLab} from './MotionLabStore';
@@ -937,6 +939,61 @@ export function OriginRig({kind}: {kind: 'zero' | 'centre' | 'anchored'}) {
937939
);
938940
}
939941

942+
// --- progress fill -----------------------------------------------------------
943+
944+
/** The values a fast upload might report, one per tick. */
945+
const FILL_STEPS = [12, 58, 34, 86] as const;
946+
947+
/**
948+
* The determinate fill on a data change. Before is the real ProgressBar,
949+
* which transitions `width` (a layout property, every frame of every tick).
950+
* After is a sandbox copy of its track and fill that moves the same fill with
951+
* `transform: scaleX()` on the same token and curve, so only the technique
952+
* differs. It carries ProgressBar's theming targets (root, track and fill),
953+
* so the theme paints it as it paints the real bar.
954+
*/
955+
export function ProgressFillRig({mode}: {mode: Mode}) {
956+
const [step, setStep] = useState(0);
957+
useLoop(() => setStep(current => (current + 1) % FILL_STEPS.length), 1600);
958+
const value = FILL_STEPS[step];
959+
960+
return (
961+
<VStack gap={2} {...stylex.props(sx.full)}>
962+
{mode === 'before' ? (
963+
<ProgressBar label="Uploading" value={value} hasValueLabel />
964+
) : (
965+
<div {...themeProps('progress-bar', {variant: 'accent'})}>
966+
<VStack gap={1}>
967+
<HStack gap={2} hAlign="between">
968+
<Text>Uploading</Text>
969+
<Text color="secondary">{value}%</Text>
970+
</HStack>
971+
<div
972+
{...themeProps('progress-bar-track')}
973+
className={`astryx-progress-bar-track ${styles.fillTrack}`}
974+
role="progressbar"
975+
aria-label="Uploading"
976+
aria-valuemin={0}
977+
aria-valuemax={100}
978+
aria-valuenow={value}>
979+
<div
980+
{...themeProps('progress-bar-fill', {variant: 'accent'})}
981+
className={`astryx-progress-bar-fill ${styles.fillScale}`}
982+
style={{transform: `scaleX(${value / 100})`}}
983+
/>
984+
</div>
985+
</VStack>
986+
</div>
987+
)}
988+
<Hint>
989+
{mode === 'before'
990+
? 'Width is a layout property: every frame of every tick re-lays out the bar. A fast upload ticks often enough to behave like a layout loop.'
991+
: 'The same fill on transform: scaleX, so it runs on the compositor. The cost shows at the ends: the rounded caps squash at small values, which is why this needs an exception or a different structure before it ships.'}
992+
</Hint>
993+
</VStack>
994+
);
995+
}
996+
940997
// --- loops -------------------------------------------------------------------
941998

942999
export function LoopRig({policy}: {policy: 'today' | 'delete' | 'degrade'}) {

‎apps/sandbox/src/app/(sandbox)/pages/motion-lab/MotionControlRail.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export function MotionControlRail() {
7474

7575
return (
7676
<HStack gap={3} vAlign="center" wrap="wrap" {...stylex.props(sx.rail)}>
77-
<HStack gap={1.5} vAlign="center">
77+
<HStack gap={1.5} vAlign="center" wrap="wrap">
7878
<Text type="supporting" color="secondary">
7979
Speed
8080
</Text>

‎apps/sandbox/src/app/(sandbox)/pages/motion-lab/MotionLab.module.css‎

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,52 @@
736736
}
737737
}
738738

739+
/* ------------------------------------------------------- progress fill ---- */
740+
741+
/* A copy of ProgressBar's track and fill (8px, muted track, accent fill, full
742+
radius) whose fill moves with transform instead of width, on the same token
743+
and curve core uses, so the pair differs only in technique. */
744+
.fillTrack {
745+
position: relative;
746+
height: 8px;
747+
border-radius: var(--radius-full);
748+
overflow: hidden;
749+
}
750+
751+
.fillScale {
752+
position: absolute;
753+
inset: 0;
754+
border-radius: inherit;
755+
transform-origin: left center;
756+
transition: transform var(--duration-medium) var(--ease-standard);
757+
}
758+
759+
/* Core's own paint, in Core's layer, so a theme's rule for the
760+
ProgressBar targets (the copy carries their classes) wins as it does on
761+
the real bar. */
762+
@layer astryx-base {
763+
.fillTrack {
764+
background: var(--color-background-muted);
765+
}
766+
767+
.fillScale {
768+
background: var(--color-accent);
769+
}
770+
}
771+
772+
[dir='rtl'] .fillScale {
773+
transform-origin: right center;
774+
}
775+
776+
/* Forced colours paint the track and fill as Canvas: Core's fill keeps its
777+
shape with a CanvasText outline, and so does the copy. */
778+
@media (forced-colors: active) {
779+
.fillScale {
780+
outline: 1px solid CanvasText;
781+
outline-offset: -1px;
782+
}
783+
}
784+
739785
/* ---------------------------------------------------------------- tint ---- */
740786

741787
/* The Table hover tint, at whatever duration and curve is being argued over.
@@ -749,7 +795,7 @@
749795
}
750796

751797
.tintRow:hover {
752-
background: var(--color-background-hover, var(--color-background-elevated));
798+
background-color: var(--color-overlay-hover);
753799
}
754800

755801
/* NavItem's hover tint (NavTintRig). Before: as shipped, it snaps on where
@@ -783,8 +829,11 @@
783829
transition-property: background-color;
784830
}
785831

832+
/* The hover overlay token Astryx ships: the rule used to read two names no
833+
theme defines, so the row never tinted and the pane showed nothing to
834+
compare. */
786835
.noopRow:hover {
787-
background: var(--color-background-hover, var(--color-background-elevated));
836+
background-color: var(--color-overlay-hover);
788837
}
789838

790839
/* ------------------------------------------------------------- origin ----- */

‎apps/sandbox/src/app/(sandbox)/pages/motion-lab/MotionLabShell.tsx‎

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ import {
3030
LayoutPanel,
3131
VStack,
3232
} from '@astryxdesign/core/Layout';
33+
import {Collapsible} from '@astryxdesign/core/Collapsible';
34+
import {useMediaQuery} from '@astryxdesign/core/hooks';
3335
import {List, ListItem} from '@astryxdesign/core/List';
3436
import {Text} from '@astryxdesign/core/Text';
3537
import {useMotionLab} from './MotionLabStore';
@@ -53,8 +55,21 @@ const sx = stylex.create({
5355
firstGroupLabel: {
5456
paddingBlockStart: '2px',
5557
},
58+
narrowNav: {
59+
paddingInline: '12px',
60+
borderBlockEndWidth: '1px',
61+
borderBlockEndStyle: 'solid',
62+
borderBlockEndColor: 'var(--color-border)',
63+
},
5664
});
5765

66+
/**
67+
* Below this width the 228px page panel would leave the lab's cards a
68+
* column too narrow to read, so the pages fold into a collapsible list above
69+
* the content instead.
70+
*/
71+
const NARROW_QUERY = '(max-width: 719px)';
72+
5873
/**
5974
* Hrefs stay unprefixed: SandboxLink applies the Vite base path once in the
6075
* LinkProvider, and usePathname() returns the path within that base path.
@@ -102,6 +117,10 @@ function LabNav() {
102117
export function MotionLabShell({children}: {children: ReactNode}) {
103118
const {registerScope, reducedMotion} = useMotionLab();
104119
const ref = useRef<HTMLDivElement | null>(null);
120+
const isNarrow = useMediaQuery(NARROW_QUERY);
121+
// The shell outlives a page change; keying the folded list by page closes
122+
// it after a pick, so the chosen page starts on screen.
123+
const pathname = usePathname();
105124

106125
useEffect(() => {
107126
registerScope(ref.current);
@@ -117,13 +136,25 @@ export function MotionLabShell({children}: {children: ReactNode}) {
117136
<Layout
118137
height="fill"
119138
start={
120-
<LayoutPanel hasDivider width={228} padding={0} role="navigation">
121-
<LabNav />
122-
</LayoutPanel>
139+
isNarrow ? undefined : (
140+
<LayoutPanel hasDivider width={228} padding={0} role="navigation">
141+
<LabNav />
142+
</LayoutPanel>
143+
)
123144
}
124145
content={
125146
<LayoutContent padding={0}>
126147
<VStack gap={0}>
148+
{isNarrow && (
149+
<div {...stylex.props(sx.narrowNav)}>
150+
<Collapsible
151+
key={pathname}
152+
trigger="Motion Lab pages"
153+
defaultIsOpen={false}>
154+
<LabNav />
155+
</Collapsible>
156+
</div>
157+
)}
127158
<MotionControlRail />
128159
{children}
129160
</VStack>

‎apps/sandbox/src/app/(sandbox)/pages/motion-lab/js-mirror/page.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ export default function MotionJsMirrorPage() {
430430
<ChartPane mode="after" />
431431
<Text type="supporting" color="secondary">
432432
<code>scaledMs(&apos;--duration-reveal&apos;)</code> and{' '}
433-
<code>
433+
<code style={{overflowWrap: 'anywhere'}}>
434434
bezierAt(parseBezier(rawToken(&apos;--ease-move&apos;)),
435435
k)
436436
</code>{' '}
@@ -468,7 +468,7 @@ export default function MotionJsMirrorPage() {
468468
/>
469469
</VStack>
470470

471-
<Grid columns={{minWidth: 460}} gap={4}>
471+
<Grid columns={{minWidth: 460, max: 2}} gap={4}>
472472
<DemoCard
473473
title="Why the defaults are not hardcoded in JS"
474474
question="Because a theme retunes the whole scale, and a constants file would quietly stop agreeing with the stylesheet.">

‎apps/sandbox/src/app/(sandbox)/pages/motion-lab/preview-plan/page.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ export default function PreviewPlanPage() {
307307
<Heading level={2}>{group}</Heading>
308308
<Badge label={`${rows.length}`} />
309309
</HStack>
310-
<Grid columns={{minWidth: 420}} gap={3}>
310+
<Grid columns={{minWidth: 420, max: 2}} gap={3}>
311311
{rows.map(row => (
312312
<RowCard key={row.id} row={row} />
313313
))}

0 commit comments

Comments
 (0)