@kanso-labs/kanso-ui 0.44.0 → 0.44.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","ReactNode","stylex","createElement","RenderComponentProps","COLLAPSED_BLOCK_SIZE","hasContent","useRender","layers","mergeStyles","colors","motion","sizing","spacing","Text","ICON_BUTTON_TARGET","ICON_SIZE","GLYPH_INSET","HEIGHTS","lg","plain","withSubtitle","md","sm","const","COLLAPSED_HEIGHT","FORCED_COLORS","styles","pinned","k87sOh","kVAEAm","kY2c9j","$$css","root","k6CgDc","kGNEyG","kWkggS","kB7OPa","k1xSpc","kjj79g","kIyJzY","k1ekBW","kAMwcw","row","kOIVth","kzqmXN","kUOVxO","scrolled","kL6WhQ","kfdmCh","kt9PQ7","HEADLINE_VARIANT","HEADINGS","heading","level","known","Number","isInteger","PARAGRAPH","_temp","kAzted","heightStyles","minBlockSize","val","undefined","_temp2","ks0D6T","rowStyles","start","end","maxInlineSize","kwRFfy","kZCmMZ","AppBarProps","Omit","align","collapsed","contentInset","contentMaxInlineSize","headingLevel","headline","leading","size","subtitle","trailing","AppBar","t0","$","render","t1","t2","t3","t4","t5","t6","t7","t8","t9","t10","t11","t12","t13","t14","props","collapse","expandedHeight","height","hasLeading","hasTrailing","t15","edgePadding","t16","t17","Symbol","for","0","className","1","t18","t19","t20","t21","t22","children","defaultTagName","hasSlot","inset","trim","_c","props","stylex.props"],"sources":["../../../src/components/app-bar/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { createElement } from 'react';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { COLLAPSED_BLOCK_SIZE } from '../../hooks/useAppBarScroll';\nimport { hasContent } from '../../render/content';\nimport { useRender } from '../../render/useRender';\nimport '../../styles/layers.stylex';\nimport { layers } from '../../styles/layers.stylex';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, sizing, spacing } from '../../tokens/design.tokens.stylex';\nimport Text from '../text';\n\n// Material Design's app bar, in the three sizes the spec recommends.\n//\n// `md` and `lg` are Material Design's medium and large *flexible* bars, the\n// newer of the two sets the spec gives and the one it recommends, which is why\n// those two steps are theirs.\n//\n// Material Design also merged the old center-aligned variant into small as a\n// configuration rather than a variant, which is why alignment is a prop here\n// and applies to every size.\n//\n// Heights are Material Design's, and they are minimums rather than fixed. The\n// spec says the flexible bars \"hug the text contents\" and gives them multi-line\n// support and text wrapping, so a headline long enough to wrap has to be able\n// to make its bar taller. Fixing the height would truncate exactly the case\n// the variant was redesigned for.\n\n// The geometry Material Design lays a bar's icon buttons out on. Its tokens\n// give a 4dp leading and trailing space between the bar's edge and the first\n// button's 48dp target, no space between one target and the next, and a 24dp\n// icon centred in each — so a glyph lands 4 + 12 = 16dp in, on the page's own\n// margin.\n//\n// The library's icon button draws a 40dp box with its 48dp target out of\n// flow, so a slot pads half the difference either side and puts the whole\n// difference between two buttons, which lays the targets edge to edge as the\n// tokens do. The target is IconButton's TARGET_SIZE, a literal there for the\n// reason it gives: it is a floor the page states, not a step of the control\n// scale.\nconst ICON_BUTTON_TARGET = '48px';\nconst ICON_SIZE = '24px';\n\n// How far an icon sits inside its target, which is how much less than the\n// content inset the row is padded on an edge that holds a slot. That is what\n// puts a leading glyph, rather than the edge of its target, at the inset.\nconst GLYPH_INSET = `(${ICON_BUTTON_TARGET} - ${ICON_SIZE}) / 2`;\nconst HEIGHTS = {\n lg: {\n plain: '120px',\n withSubtitle: '152px'\n },\n md: {\n plain: '112px',\n withSubtitle: '136px'\n },\n sm: {\n plain: `${COLLAPSED_BLOCK_SIZE}px`,\n withSubtitle: `${COLLAPSED_BLOCK_SIZE}px`\n }\n} as const;\n\n// What a flexible bar collapses to, which is the small bar exactly. Material\n// Design does not describe the collapsed large bar as a state of its own — it\n// describes it as becoming the small bar, which is why this reads off the same\n// table rather than being a fourth height.\nconst COLLAPSED_HEIGHT = HEIGHTS.sm.plain;\n\n// Windows High Contrast and the rest of the forced-colours modes. Spelled\n// here rather than imported, for the reason src/field/styles.ts records: the\n// StyleX compiler resolves a constant across files only out of a `.stylex.ts`\n// module, and the generated one holds design tokens rather than queries.\nconst FORCED_COLORS = '@media (forced-colors: active)';\nconst styles = {\n pinned: {\n k87sOh: \"x13vifvy\",\n kVAEAm: \"x7wzq59\",\n kY2c9j: \"xfj7q76\",\n $$css: true\n },\n root: {\n k6CgDc: \"x12w9bfk\",\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"x14s9m32\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kjj79g: \"xl56j7k\",\n kIyJzY: \"xioksi3\",\n k1ekBW: \"x8u3r54\",\n kAMwcw: \"x1seskgd\",\n $$css: true\n },\n row: {\n kGNEyG: \"x6s0dn4\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kOIVth: \"xzoy561\",\n kzqmXN: \"xh8yej3\",\n kUOVxO: \"xvueqy4\",\n $$css: true\n },\n scrolled: {\n kWkggS: \"x1mjdul6\",\n kL6WhQ: \"xszdk7l\",\n kfdmCh: \"xe3zi7u\",\n kt9PQ7: \"x15anc7y\",\n $$css: true\n }\n};\n\n// One entry per size, and each names a type role rather than a figure.\n// Material Design's own tokens are `md.comp.app-bar.<size>.title.font`,\n// aliases onto the type scale rather than sizes of their own, so this maps to\n// the scale the same way and lets Text apply it.\nconst HEADLINE_VARIANT = {\n lg: 'headlineMedium',\n md: 'headlineSmall',\n sm: 'titleLarge'\n} as const;\n\n// The headline is the page's title in Material Design's model, so it is the\n// page's <h1> unless the call site says otherwise. `headingLevel` is what says\n// otherwise, and a bar drawn beside another bar — one per pane in a\n// `ListDetail` or a `SupportingPane` — or under a page heading of its own\n// should lower it.\n//\n// Built here rather than kept as a constant per level: `headline` becomes the\n// heading's children, so a call site cannot demote the heading by passing one\n// of its own. `headline={<h2>…</h2>}` renders an h2 inside the h1 — two\n// headings where one was wanted, which React does not warn about.\n//\n// The level is looked up rather than interpolated into a tag name. `h7` is a\n// custom element as far as React is concerned, so it renders without a word\n// said and leaves the outline worse than the default would have. The prop's\n// type is the six levels, and a value outside them from a call site the type\n// does not reach — `NaN`, which rounded and clamped to no element at all and\n// took the headline out of the outline — falls back to the default h1.\n// Disclosure's own `headingLevel` hands the number to React Aria, which is\n// why that one needs no equivalent.\nconst HEADINGS = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] as const;\nfunction heading(level: number) {\n const known = Number.isInteger(level) && level >= 1 && level <= 6;\n return createElement(known ? HEADINGS[level - 1] : HEADINGS[0]);\n}\nconst PARAGRAPH = <p />;\n\n// Height is the one value the call site does not choose, and it depends on two\n// props at once, so it is a function style rather than one key per\n// combination. StyleX writes it to a custom property inline, the same\n// mechanism Feed uses for its cell minimum.\nconst _temp = {\n kAzted: \"x1chvrdh\",\n \"$$css\": true\n};\nconst heightStyles = {\n root: (minBlockSize: string) => [_temp, {\n \"--x-minBlockSize\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(minBlockSize)\n }]\n};\n\n// The row's measure and inset both come from the call site, so both are\n// function styles too. Each edge is worked out on its own: where it holds a\n// slot the row stops short of the inset by GLYPH_INSET, so the glyph rather\n// than its target is what sits at the inset, and where it holds none the\n// headline itself starts there. Clamped at zero, since an inset smaller than\n// a glyph's own room would otherwise ask for a negative padding, which CSS\n// throws away whole.\nconst _temp2 = {\n ks0D6T: \"x13i5qev\",\n \"$$css\": true\n};\nconst rowStyles = {\n root: (start: string, end: string, maxInlineSize: string) => [_temp2, {\n kwRFfy: end != null ? \"x120eax6\" : end,\n kZCmMZ: start != null ? \"xnvo3vl\" : start,\n $$css: true\n }, {\n \"--x-maxInlineSize\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(maxInlineSize),\n \"--x-paddingInlineEnd\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(end),\n \"--x-paddingInlineStart\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(start)\n }]\n};\ntype AppBarProps = Omit<RenderComponentProps<'header'>, 'children'> & {\n /**\n * Which of Material Design's alignments the text takes. `center` is the\n * configuration that replaced the old center-aligned variant.\n * @default 'start'\n */\n align?: 'center' | 'start';\n /**\n * Collapses a flexible bar to the height and headline of the small one, for\n * a bar `pinned` over content that has been scrolled. Material Design\n * specifies it for the flexible sizes, and without it a pinned `lg` costs\n * 152px of the viewport for as long as the page is open.\n *\n * Controlled, and for the same reason `scrolled` is: only the app knows\n * which element scrolls, and how far into it the bar should have finished\n * collapsing. `useAppBarScroll` derives both from that element's scroll,\n * and is the way to set them unless the app needs a rule of its own.\n *\n * Ignored on `sm`, which is already the height this collapses to. The\n * subtitle goes with the height, since there is no room for a second line\n * in the small bar.\n *\n * Collapsing hands the page back the height the bar gives up, and a bar\n * whose state is read off the scroll offset can then undo itself in two\n * ways. Both move the offset back under the threshold, so the bar expands,\n * the page regains its height, and the two take turns for as long as the\n * reader stays there.\n *\n * - **Scroll anchoring.** Browsers answer a change in height above the\n * viewport by moving the offset by the same amount, to keep the content\n * in place. Give the scroll container `overflow-anchor: none`, which is\n * also the movement you want: the content follows the bar's bottom edge\n * up rather than standing still while the bar shrinks behind it.\n * - **The shorter page.** A page that overflows by less than the threshold\n * plus the height the bar gives back cannot scroll that far once the bar\n * has collapsed, so the browser pulls the offset back inside it. No\n * threshold avoids this, since the band moves with it; what does is not\n * collapsing on such a page, which is the rule `useAppBarScroll` applies.\n * @default false\n */\n collapsed?: boolean;\n /**\n * Where the bar's content starts on each edge: the headline where nothing\n * comes before it, and the leading icon's glyph where something does, with\n * the headline after the icon button's target. The trailing edge is the\n * same mirrored. Any length works, `0` included, for a bar drawn flush.\n *\n * The default is Material Design's own margin for a top app bar, the\n * spacing scale's `lg` step, which is also the margin it gives body\n * content, so a bar and the page beneath line up without either being told\n * about the other. Set it to the page's gutter where that differs.\n * @default spacing.lg\n */\n contentInset?: string;\n /**\n * How wide the bar's contents may run before they stop growing, with the\n * row centred in whatever is left. The bar's own surface still paints edge\n * to edge.\n *\n * This is what lines a full-bleed bar up with a page whose content sits in\n * a measure: give it the page's measure, and `contentInset` the page's\n * gutter. Unset, the row is as wide as the bar.\n */\n contentMaxInlineSize?: string;\n /**\n * Where the headline sits in the page's outline, as one of the six heading\n * levels. A screen reader moves between headings, so a bar drawn beside\n * another bar, or under a page heading of its own, should lower it. A value\n * outside the six that reaches it untyped falls back to 1.\n * @default 1\n */\n headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;\n /** The page's title. Wraps rather than truncating, and grows the bar with it. */\n headline?: ReactNode;\n /** Usually a back or menu icon button. Sits before the text. */\n leading?: ReactNode;\n /**\n * Holds the bar at the top of its scroll container while the content\n * scrolls beneath it, and keeps it painted over that content. The bar\n * still needs a scrolling ancestor to stick inside: the window, or an\n * element with its own overflow. A pinned bar is the one `collapsed` and\n * `scrolled` are for.\n * @default false\n */\n pinned?: boolean;\n /**\n * Whether the content beneath has been scrolled. Material Design separates\n * a bar from scrolled content with a fill colour rather than a shadow, and\n * this is what applies it.\n *\n * Controlled, with no listener of its own: only the app knows which element\n * scrolls, and a bar that watched the window would be wrong inside every\n * pane and dialog that scrolls independently.\n * @default false\n */\n scrolled?: boolean;\n /**\n * Height and headline size, as steps of the library's size scale. `sm` is\n * Material Design's small bar, a fixed 64px; `md` and `lg` are its medium\n * and large flexible bars, which hug their text.\n * @default 'sm'\n */\n size?: 'lg' | 'md' | 'sm';\n /** A second line under the headline. Makes `md` and `lg` taller. */\n subtitle?: ReactNode;\n /** Actions, at the far end. Usually icon buttons. */\n trailing?: ReactNode;\n};\n\n/**\n * Material Design's app bar: the container at the top of a page carrying its\n * title, one or two actions, and the way back out.\n *\n * Three sizes. `sm` is a fixed 64px bar for a page whose title is a label;\n * `md` and `lg` are the flexible bars, which give the headline a larger\n * type role and grow to fit a subtitle or a headline that wraps.\n *\n * It paints its own surface, unlike the layout components, because separating\n * itself from the content beneath is the job — which is also why `scrolled`\n * and `collapsed` exist. Neither watches the page: only the app knows which\n * element scrolls, so both are set from its own scroll handler.\n */\nfunction AppBar({\n align = 'start',\n collapsed = false,\n contentInset = spacing.lg,\n contentMaxInlineSize = 'none',\n headingLevel = 1,\n headline,\n leading,\n pinned = false,\n render,\n scrolled = false,\n size = 'sm',\n subtitle,\n trailing,\n ...props\n}: AppBarProps) {\n // `sm` is already what the flexible bars collapse to, so collapsing it is\n // a no-op rather than an error. A bar whose size is chosen at the call site\n // from a breakpoint would otherwise have to guard the prop as well.\n const collapse = collapsed && size !== 'sm';\n const expandedHeight = hasContent(subtitle) ? HEIGHTS[size].withSubtitle : HEIGHTS[size].plain;\n const height = collapse ? COLLAPSED_HEIGHT : expandedHeight;\n const hasLeading = hasContent(leading);\n const hasTrailing = hasContent(trailing);\n return useRender({\n defaultTagName: 'header',\n props: {\n ...props,\n children: <div {...stylex.props(styles.row, rowStyles.root(edgePadding(contentInset, hasLeading), edgePadding(contentInset, hasTrailing), contentMaxInlineSize))}>\n {!hasLeading ? null : <div className=\"x6s0dn4 x9f619 x78zum5 x2lah0s x1r8zjiw x1let9r4\">{leading}</div>}\n <div {...{\n 0: {\n className: \"x9f619 x78zum5 xdt5ytf x1iyjqo2 xkjl1po xl56j7k xeuugli xj0a0fe x1cmllll\"\n },\n 1: {\n className: \"x9f619 x78zum5 xdt5ytf x1iyjqo2 xkjl1po xl56j7k xeuugli xj0a0fe x1cmllll x2b8uid\"\n }\n }[!!(align === 'center') << 0]}>\n {!hasContent(headline) ? null : <Text className=\"x12w9bfk xioksi3 x1nxaspg x1seskgd\" render={heading(headingLevel)} variant={collapse ? HEADLINE_VARIANT.sm : HEADLINE_VARIANT[size]}>\n {headline}\n </Text>}\n {!hasContent(subtitle) || collapse ? null : <Text render={PARAGRAPH} tone=\"muted\" variant=\"bodyMedium\">\n {subtitle}\n </Text>}\n </div>\n {!hasTrailing ? null : <div className=\"x6s0dn4 x9f619 x78zum5 x2lah0s x1r8zjiw x1let9r4\">{trailing}</div>}\n </div>,\n ...mergeStyles(stylex.props(styles.root, heightStyles.root(height), scrolled && styles.scrolled, pinned && styles.pinned), props)\n },\n render\n });\n}\n\n/**\n * The row's padding on one edge, for the inset the call site gave.\n *\n * A bare `0` is the one length CSS accepts without a unit, and the one it\n * rejects inside `max()`, where it reads as a number, so it is given its\n * unit before the arithmetic sees it.\n */\nfunction edgePadding(contentInset: string, hasSlot: boolean) {\n const inset = contentInset.trim() === '0' ? '0px' : contentInset;\n return hasSlot ? `max(0px, ${inset} - ${GLYPH_INSET})` : inset;\n}\nexport type { AppBarProps };\nexport default AppBar;"],"mappings":";;;;;;;;;;;AAkDA,MAAMkB,cAAc;AACpB,MAAMC,UAAU;CACdC,IAAI;EACFC,OAAO;EACPC,cAAc;CAChB;CACAC,IAAI;EACFF,OAAO;EACPC,cAAc;CAChB;CACAE,IAAI;EACFH,OAAO;EACPC,cAAc;CAChB;AACF;AAMA,MAAMI,mBAAmBP,QAAQK,GAAGH;AAOpC,MAAMO,SAAS;CACbC,QAAQ;EACNC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRV,OAAO;CACT;CACAW,KAAK;EACHR,QAAQ;EACRE,QAAQ;EACRC,QAAQ;EACRM,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRd,OAAO;CACT;CACAe,UAAU;EACRX,QAAQ;EACRY,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRlB,OAAO;CACT;AACF;AAMA,MAAMmB,mBAAmB;CACvBhC,IAAI;CACJG,IAAI;CACJC,IAAI;AACN;AAqBA,MAAM6B,WAAW;CAAC;CAAM;CAAM;CAAM;CAAM;CAAM;AAAI;AACpD,SAASC,QAAQC,OAAe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AAAG;EAAAH,EAAA,MAAAI;EAAAJ,EAAA,MAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,QAAAC,UAAAD,EAAA,QAAAK,MAAAL,EAAA,QAAAO,IAAA;EAxBcC,KAAA;GAAA6B,gBACChC;GAAQW,OACjBT;GAsBNN;EAEH;EAACD,EAAA,MAAAC;EAAAD,EAAA,MAAAK;EAAAL,EAAA,MAAAO;EAAAP,EAAA,MAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OA1BMhF,GAAUwF,EA0BhB;AAAC;;;;;;;;AAUJ,SAASe,YAAYjC,cAAsBgD,SAAkB;CAC3D,MAAMC,QAAQjD,aAAakD,KAAK,MAAM,MAAM,QAAQlD;CACpD,OAAOgD,UAAU,YAAYC,MAAK,KAAM7G,YAAW,KAAM6G;AAC3D"}
1
+ {"version":3,"file":"index.js","names":["c","_c","ReactNode","stylex","createElement","useLayoutEffect","useRef","RenderComponentProps","COLLAPSED_BLOCK_SIZE","hasContent","useRender","layers","mergeStyles","colors","motion","sizing","spacing","motionDurationMs","motionEasing","Text","ICON_BUTTON_TARGET","ICON_SIZE","GLYPH_INSET","HEIGHTS","lg","plain","withSubtitle","md","sm","const","COLLAPSED_HEIGHT","FORCED_COLORS","styles","pinned","k87sOh","kVAEAm","kY2c9j","$$css","root","k6CgDc","kGNEyG","kWkggS","kB7OPa","k1xSpc","kjj79g","kIyJzY","k1ekBW","kAMwcw","row","kfiyM8","kC13JO","kumcoG","kzqmXN","kUOVxO","scrolled","kL6WhQ","kfdmCh","kt9PQ7","text","kSGwAc","kXwgrk","kJuA4N","kE4Cay","k7Eaqz","kHjlTd","k8WAf4","textBelow","textCenter","k9WMMc","twoRows","kTDh7v","k4zj60","kWgvks","k5JduY","kVb13B","k5jvz2","HEADLINE_VARIANT","SUBTITLE_VARIANT","HEADINGS","heading","level","known","Number","isInteger","PARAGRAPH","_temp","kAzted","heightStyles","minBlockSize","val","undefined","_temp2","ks0D6T","rowStyles","start","end","maxInlineSize","kwRFfy","kZCmMZ","tracks","gridTemplateRows","k9llMU","_temp3","keoZOQ","textStyles","inset","reach","marginBlockStart","UNDER_TARGETS","AppBarProps","Omit","align","collapsed","contentInset","contentMaxInlineSize","headingLevel","headline","leading","size","subtitle","trailing","LINES","Geometry","height","lines","Line","x","y","AppBar","t0","$","t1","t2","t3","t4","t5","t6","render","t7","t8","props","collapse","below","expandedHeight","hasLeading","hasTrailing","textRef","useCollapseMotion","t9","t10","edgePadding","t11","t12","glyphRoom","t13","t14","t15","t16","t17","t18","t19","children","t20","defaultTagName","drawnAt","bar","HTMLElement","settled","getBoundingClientRect","map","selector","index","line","element","querySelector","moved","matrixOf","a","e","f","hasSlot","withUnit","geometryOf","frame","box","edge","left","right","isRightToLeft","parseFloat","getComputedStyle","fontSize","glyphTopOf","top","Element","range","document","createRange","selectNodeContents","first","getClientRects","item","direction","DOMMatrixReadOnly","transform","originOf","glyphs","prefersReducedMotion","window","matchMedia","matches","collapsedBefore","Symbol","for","animations","current","parentElement","moving","some","_temp4","last","from","animation_0","animation","cancel","to","timing","duration","medium1","easing","emphasized","heights","animate","blockSize","clipPath","entries","was","is","origin","push","transformOrigin","playState","trim","_c","props","stylex.props"],"sources":["../../../src/components/app-bar/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { createElement, useLayoutEffect, useRef } from 'react';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { COLLAPSED_BLOCK_SIZE } from '../../hooks/useAppBarScroll';\nimport { hasContent } from '../../render/content';\nimport { useRender } from '../../render/useRender';\nimport '../../styles/layers.stylex';\nimport { layers } from '../../styles/layers.stylex';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, sizing, spacing } from '../../tokens/design.tokens.stylex';\nimport { motionDurationMs, motionEasing } from '../../tokens/values';\nimport Text from '../text';\n\n// Material Design's app bar, in the three sizes the spec recommends.\n//\n// `md` and `lg` are Material Design's medium and large *flexible* bars, the\n// newer of the two sets the spec gives and the one it recommends, which is why\n// those two steps are theirs: their heights, their two rows, and their type\n// roles, which HEADLINE_VARIANT and SUBTITLE_VARIANT name.\n//\n// Material Design also merged the old center-aligned variant into small as a\n// configuration rather than a variant, which is why alignment is a prop here\n// and applies to every size.\n//\n// Heights are Material Design's, and they are minimums rather than fixed. The\n// spec says the flexible bars \"hug the text contents\" and gives them multi-line\n// support and text wrapping, so a headline long enough to wrap has to be able\n// to make its bar taller. Fixing the height would truncate exactly the case\n// the variant was redesigned for.\n//\n// The small bar is one row: the leading slot, the text and the trailing slot\n// side by side in a 64px strip. The flexible bars are two, as Material Design\n// lays them out. The first is that same strip holding the slots alone, and the\n// second runs the text under it across the whole measure, so a long headline\n// wraps against the bar's width rather than against what the slots leave.\n// Collapsing moves the text up into the strip, which is the small bar exactly,\n// and the slots never move: they are in the strip in both states.\n\n// The geometry Material Design lays a bar's icon buttons out on. Its tokens\n// give a 4dp leading and trailing space between the bar's edge and the first\n// button's 48dp target, no space between one target and the next, and a 24dp\n// icon centred in each — so a glyph lands 4 + 12 = 16dp in, on the page's own\n// margin.\n//\n// The library's icon button draws a 40dp box with its 48dp target out of\n// flow, so a slot pads half the difference either side and puts the whole\n// difference between two buttons, which lays the targets edge to edge as the\n// tokens do. The target is IconButton's TARGET_SIZE, a literal there for the\n// reason it gives: it is a floor the page states, not a step of the control\n// scale.\nconst ICON_BUTTON_TARGET = '48px';\nconst ICON_SIZE = '24px';\n\n// How far an icon sits inside its target, which is how much less than the\n// content inset the row is padded on an edge that holds a slot. That is what\n// puts a leading glyph, rather than the edge of its target, at the inset.\nconst GLYPH_INSET = `(${ICON_BUTTON_TARGET} - ${ICON_SIZE}) / 2`;\nconst HEIGHTS = {\n lg: {\n plain: '120px',\n withSubtitle: '152px'\n },\n md: {\n plain: '112px',\n withSubtitle: '136px'\n },\n sm: {\n plain: `${COLLAPSED_BLOCK_SIZE}px`,\n withSubtitle: `${COLLAPSED_BLOCK_SIZE}px`\n }\n} as const;\n\n// What a flexible bar collapses to, which is the small bar exactly. Material\n// Design does not describe the collapsed large bar as a state of its own — it\n// describes it as becoming the small bar, which is why this reads off the same\n// table rather than being a fourth height.\nconst COLLAPSED_HEIGHT = HEIGHTS.sm.plain;\n\n// Windows High Contrast and the rest of the forced-colours modes. Spelled\n// here rather than imported, for the reason src/field/styles.ts records: the\n// StyleX compiler resolves a constant across files only out of a `.stylex.ts`\n// module, and the generated one holds design tokens rather than queries.\nconst FORCED_COLORS = '@media (forced-colors: active)';\nconst styles = {\n pinned: {\n k87sOh: \"x13vifvy\",\n kVAEAm: \"x7wzq59\",\n kY2c9j: \"xfj7q76\",\n $$css: true\n },\n root: {\n k6CgDc: \"x12w9bfk\",\n kGNEyG: \"x1qjc9v5\",\n kWkggS: \"x14s9m32\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kjj79g: \"xl56j7k\",\n kIyJzY: \"xioksi3\",\n k1ekBW: \"x15406qy\",\n kAMwcw: \"x1seskgd\",\n $$css: true\n },\n row: {\n kfiyM8: \"x10ukxgv\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"xrvj5dj\",\n kC13JO: \"x97ohe\",\n kumcoG: \"xx9t13c\",\n kzqmXN: \"xh8yej3\",\n kUOVxO: \"xvueqy4\",\n $$css: true\n },\n scrolled: {\n kWkggS: \"x1mjdul6\",\n kL6WhQ: \"xszdk7l\",\n kfdmCh: \"xe3zi7u\",\n kt9PQ7: \"x15anc7y\",\n $$css: true\n },\n text: {\n kSGwAc: \"xamitd3\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kXwgrk: \"xdt5ytf\",\n kJuA4N: \"x12gd1sl\",\n kE4Cay: \"xkjl1po\",\n k7Eaqz: \"xeuugli\",\n kHjlTd: \"xj0a0fe\",\n k8WAf4: \"x1cmllll\",\n $$css: true\n },\n textBelow: {\n kSGwAc: \"xnav3zx\",\n k8WAf4: \"xt970qd\",\n $$css: true\n },\n textCenter: {\n k9WMMc: \"x2b8uid\",\n $$css: true\n }\n};\n\n// The flexible bars' two rows: the strip with the slots at either end, and the\n// text under it across all three columns. The second row takes whatever height\n// the bar has beyond the strip, and the text sits at its bottom.\n//\n// Material Design places that text by its last baseline, 28px above the large\n// bar's bottom edge and 24px above the medium one's, and that is the reading\n// that makes the heights above come out, together with the reach textStyles\n// gives the text: the same figures as padding under the line box would make a\n// plain large bar 64 + 44 + 28 = 136px rather than 120px. CSS gives a box no\n// margin below its baseline, so the strut does it.\n// An empty box in the same grid area, aligned on its last baseline with the\n// text, has its baseline at its own bottom edge and the margin under that, so\n// the pair is held that far off the row's end. Literals rather than tokens,\n// like HEIGHTS: they are measurements the spec gives this component, not steps\n// of the spacing scale, which has no 28.\nconst twoRows = {\n lg: {\n kTDh7v: \"x1mna9mr\",\n k4zj60: \"x1gmr53x\",\n kWgvks: \"xx38sju\",\n k5JduY: \"x1s928wv\",\n kVb13B: \"x1vlsijy\",\n k5jvz2: \"x1fh8phi\",\n kC13JO: \"xc3o5yk\",\n $$css: true\n },\n md: {\n kTDh7v: \"x1mna9mr\",\n k4zj60: \"x1gmr53x\",\n kWgvks: \"xx38sju\",\n k5JduY: \"x1s928wv\",\n kVb13B: \"x1vlsijy\",\n k5jvz2: \"x1v6yq59\",\n kC13JO: \"xc3o5yk\",\n $$css: true\n }\n};\n\n// One entry per size, and each names a type role rather than a figure.\n// Material Design's own tokens are `md.comp.app-bar.<size>.title.font`,\n// aliases onto the type scale rather than sizes of their own, so this maps to\n// the scale the same way and lets Text apply it. The roles are the flexible\n// bars': headlineMedium on medium and displaySmall on large, which is a step\n// up from what the spec's other medium and large bars take, and the small\n// bar's titleLarge.\nconst HEADLINE_VARIANT = {\n lg: 'displaySmall',\n md: 'headlineMedium',\n sm: 'titleLarge'\n} as const;\n\n// The subtitle's role, by the same tokens' `subtitle.font`. Material Design\n// gives each size its own rather than one role at every size, and a collapsed\n// bar takes the small bar's, as it takes its headline's.\nconst SUBTITLE_VARIANT = {\n lg: 'titleMedium',\n md: 'labelLarge',\n sm: 'labelMedium'\n} as const;\n\n// The headline is the page's title in Material Design's model, so it is the\n// page's <h1> unless the call site says otherwise. `headingLevel` is what says\n// otherwise, and a bar drawn beside another bar — one per pane in a\n// `ListDetail` or a `SupportingPane` — or under a page heading of its own\n// should lower it.\n//\n// Built here rather than kept as a constant per level: `headline` becomes the\n// heading's children, so a call site cannot demote the heading by passing one\n// of its own. `headline={<h2>…</h2>}` renders an h2 inside the h1 — two\n// headings where one was wanted, which React does not warn about.\n//\n// The level is looked up rather than interpolated into a tag name. `h7` is a\n// custom element as far as React is concerned, so it renders without a word\n// said and leaves the outline worse than the default would have. The prop's\n// type is the six levels, and a value outside them from a call site the type\n// does not reach — `NaN`, which rounded and clamped to no element at all and\n// took the headline out of the outline — falls back to the default h1.\n// Disclosure's own `headingLevel` hands the number to React Aria, which is\n// why that one needs no equivalent.\nconst HEADINGS = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] as const;\nfunction heading(level: number) {\n const known = Number.isInteger(level) && level >= 1 && level <= 6;\n return createElement(known ? HEADINGS[level - 1] : HEADINGS[0]);\n}\nconst PARAGRAPH = <p />;\n\n// Height is the one value the call site does not choose, and it depends on two\n// props at once, so it is a function style rather than one key per\n// combination. StyleX writes it to a custom property inline, the same\n// mechanism Feed uses for its cell minimum.\n//\n// The row takes it too, and that is for the collapse's motion. The bar's\n// height is animated, and a row that only stretched to it would be laid out\n// at every height the bar passed through: the second row is the room the bar\n// has beyond the strip, so its text would ride up and down with the bar\n// rather than holding the place the animation moves it to. With the minimum\n// of its own, the row is laid out once, at the height the bar is heading for,\n// and the bar clips it until it gets there.\nconst _temp = {\n kAzted: \"x1chvrdh\",\n \"$$css\": true\n};\nconst heightStyles = {\n root: (minBlockSize: string) => [_temp, {\n \"--x-minBlockSize\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(minBlockSize)\n }]\n};\n\n// The row's measure and inset both come from the call site, so both are\n// function styles too. Each edge is worked out on its own: where it holds a\n// slot the row stops short of the inset by GLYPH_INSET, so the glyph rather\n// than its target is what sits at the inset, and where it holds none the\n// headline itself starts there. Clamped at zero, since an inset smaller than\n// a glyph's own room would otherwise ask for a negative padding, which CSS\n// throws away whole.\n//\n// The tracks are a function style for a different reason: the strip is the\n// small bar's height, which is the hook's constant, and the compiler cannot\n// read a constant out of another module — see FORCED_COLORS.\nconst _temp2 = {\n ks0D6T: \"x13i5qev\",\n \"$$css\": true\n};\nconst rowStyles = {\n root: (start: string, end: string, maxInlineSize: string) => [_temp2, {\n kwRFfy: end != null ? \"x120eax6\" : end,\n kZCmMZ: start != null ? \"xnvo3vl\" : start,\n $$css: true\n }, {\n \"--x-maxInlineSize\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(maxInlineSize),\n \"--x-paddingInlineEnd\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(end),\n \"--x-paddingInlineStart\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(start)\n }],\n tracks: (gridTemplateRows: string) => [{\n k9llMU: gridTemplateRows != null ? \"x1xxtoay\" : gridTemplateRows,\n $$css: true\n }, {\n \"--x-gridTemplateRows\": gridTemplateRows != null ? gridTemplateRows : undefined\n }]\n};\n\n// The text in the second row runs under the slots as well as between them, so\n// it puts back what the row's padding held off an edge for a slot's glyph, and\n// the headline starts on the inset again. A function style for the reason the\n// row's padding is one.\n//\n// It also reaches up into the strip, by the band under the slots' targets,\n// and Material Design's heights depend on that. A large bar's 36/44 headline\n// with its baseline 28px above a 120px bar's edge has the top of its line box\n// inside the strip, and so does the medium bar's 28/36 one: measured, the two\n// bars came out 126px and 115px tall without it. What reaches in is the line's\n// leading and the room above its capitals rather than any glyph, and it stops\n// where the targets do, so nothing a reader can press is under it. A function\n// style because the strip's height is the hook's constant — see rowStyles.\nconst _temp3 = {\n keoZOQ: \"x1vhfslr\",\n \"$$css\": true\n};\nconst textStyles = {\n inset: (start: string, end: string) => [{\n kwRFfy: end != null ? \"x120eax6\" : end,\n kZCmMZ: start != null ? \"xnvo3vl\" : start,\n $$css: true\n }, {\n \"--x-paddingInlineEnd\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(end),\n \"--x-paddingInlineStart\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(start)\n }],\n reach: (marginBlockStart: string) => [_temp3, {\n \"--x-marginBlockStart\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(marginBlockStart)\n }]\n};\n\n// How far the strip runs on below the slots' targets, which are centred in it.\nconst UNDER_TARGETS = `calc((${COLLAPSED_HEIGHT} - ${ICON_BUTTON_TARGET}) / 2)`;\ntype AppBarProps = Omit<RenderComponentProps<'header'>, 'children'> & {\n /**\n * Which of Material Design's alignments the text takes. `center` is the\n * configuration that replaced the old center-aligned variant.\n * @default 'start'\n */\n align?: 'center' | 'start';\n /**\n * Collapses a flexible bar to the height and headline of the small one, for\n * a bar `pinned` over content that has been scrolled. Material Design\n * specifies it for the flexible sizes, and without it a pinned `lg` costs\n * 152px of the viewport for as long as the page is open.\n *\n * Controlled, and for the same reason `scrolled` is: only the app knows\n * which element scrolls, and how far into it the bar should have finished\n * collapsing. `useAppBarScroll` derives both from that element's scroll,\n * and is the way to set them unless the app needs a rule of its own.\n *\n * Ignored on `sm`, which is already the height this collapses to. The\n * headline and the subtitle move up into the row the slots sit in and take\n * the small bar's type roles, which fit both lines in its 64px, and the\n * slots never leave that row: they stay where they are while the bar\n * shrinks under them.\n *\n * Collapsing hands the page back the height the bar gives up, and a bar\n * whose state is read off the scroll offset can then undo itself in two\n * ways. Both move the offset back under the threshold, so the bar expands,\n * the page regains its height, and the two take turns for as long as the\n * reader stays there.\n *\n * - **Scroll anchoring.** Browsers answer a change in height above the\n * viewport by moving the offset by the same amount, to keep the content\n * in place. Give the scroll container `overflow-anchor: none`, which is\n * also the movement you want: the content follows the bar's bottom edge\n * up rather than standing still while the bar shrinks behind it.\n * - **The shorter page.** A page that overflows by less than the threshold\n * plus the height the bar gives back cannot scroll that far once the bar\n * has collapsed, so the browser pulls the offset back inside it. No\n * threshold avoids this, since the band moves with it; what does is not\n * collapsing on such a page, which is the rule `useAppBarScroll` applies.\n * @default false\n */\n collapsed?: boolean;\n /**\n * Where the bar's content starts on each edge: the headline where nothing\n * comes before it, and the leading icon's glyph where something does, with\n * the headline after the icon button's target. The trailing edge is the\n * same mirrored. Any length works, `0` included, for a bar drawn flush.\n *\n * The default is Material Design's own margin for a top app bar, the\n * spacing scale's `lg` step, which is also the margin it gives body\n * content, so a bar and the page beneath line up without either being told\n * about the other. Set it to the page's gutter where that differs.\n * @default spacing.lg\n */\n contentInset?: string;\n /**\n * How wide the bar's contents may run before they stop growing, with the\n * row centred in whatever is left. The bar's own surface still paints edge\n * to edge.\n *\n * This is what lines a full-bleed bar up with a page whose content sits in\n * a measure: give it the page's measure, and `contentInset` the page's\n * gutter. Unset, the row is as wide as the bar.\n */\n contentMaxInlineSize?: string;\n /**\n * Where the headline sits in the page's outline, as one of the six heading\n * levels. A screen reader moves between headings, so a bar drawn beside\n * another bar, or under a page heading of its own, should lower it. A value\n * outside the six that reaches it untyped falls back to 1.\n * @default 1\n */\n headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;\n /** The page's title. Wraps rather than truncating, and grows the bar with it. */\n headline?: ReactNode;\n /** Usually a back or menu icon button. Sits before the text. */\n leading?: ReactNode;\n /**\n * Holds the bar at the top of its scroll container while the content\n * scrolls beneath it, and keeps it painted over that content. The bar\n * still needs a scrolling ancestor to stick inside: the window, or an\n * element with its own overflow. A pinned bar is the one `collapsed` and\n * `scrolled` are for.\n * @default false\n */\n pinned?: boolean;\n /**\n * Whether the content beneath has been scrolled. Material Design separates\n * a bar from scrolled content with a fill colour rather than a shadow, and\n * this is what applies it.\n *\n * Controlled, with no listener of its own: only the app knows which element\n * scrolls, and a bar that watched the window would be wrong inside every\n * pane and dialog that scrolls independently.\n * @default false\n */\n scrolled?: boolean;\n /**\n * Height and headline size, as steps of the library's size scale. `sm` is\n * Material Design's small bar, a fixed 64px row; `md` and `lg` are its\n * medium and large flexible bars, which put the text in a row of its own\n * under the slots and hug it.\n * @default 'sm'\n */\n size?: 'lg' | 'md' | 'sm';\n /** A second line under the headline. Makes `md` and `lg` taller. */\n subtitle?: ReactNode;\n /** Actions, at the far end. Usually icon buttons. */\n trailing?: ReactNode;\n};\n\n// The text block's two lines: the headline, and the subtitle beside it. The\n// block holds nothing else, and each is drawn as one kind of element.\nconst LINES = [':scope > :is(h1, h2, h3, h4, h5, h6)', ':scope > p'] as const;\n\n/**\n * What collapsing moves, and so what its animation runs between: the bar's\n * height, and each of the text's lines, in the order LINES gives them, with\n * `null` for a line the bar does not draw.\n */\ntype Geometry = {\n height: number;\n lines: (Line | null)[];\n};\n\n/**\n * Where one of the text's lines is drawn: the point its glyphs hang from,\n * measured from the bar's own corner, and its type size. The point is the\n * top of the line's first glyphs, on the edge the text hangs from.\n */\ntype Line = {\n size: number;\n x: number;\n y: number;\n};\n\n/**\n * Material Design's app bar: the container at the top of a page carrying its\n * title, one or two actions, and the way back out.\n *\n * Three sizes. `sm` is a fixed 64px bar for a page whose title is a label;\n * `md` and `lg` are the flexible bars, which give the headline a larger\n * type role in a row of its own under the slots, and grow to fit a subtitle\n * or a headline that wraps.\n *\n * It paints its own surface, unlike the layout components, because separating\n * itself from the content beneath is the job — which is also why `scrolled`\n * and `collapsed` exist. Neither watches the page: only the app knows which\n * element scrolls, so both are set from its own scroll handler.\n */\nfunction AppBar({\n align = 'start',\n collapsed = false,\n contentInset = spacing.lg,\n contentMaxInlineSize = 'none',\n headingLevel = 1,\n headline,\n leading,\n pinned = false,\n render,\n scrolled = false,\n size = 'sm',\n subtitle,\n trailing,\n ...props\n}: AppBarProps) {\n // `sm` is already what the flexible bars collapse to, so collapsing it is\n // a no-op rather than an error. A bar whose size is chosen at the call site\n // from a breakpoint would otherwise have to guard the prop as well.\n const collapse = collapsed && size !== 'sm';\n // The flexible bars at their full height are the only state with a second\n // row. Collapsed, they are the small bar.\n const below = size !== 'sm' && !collapse;\n const expandedHeight = hasContent(subtitle) ? HEIGHTS[size].withSubtitle : HEIGHTS[size].plain;\n const height = collapse ? COLLAPSED_HEIGHT : expandedHeight;\n const hasLeading = hasContent(leading);\n const hasTrailing = hasContent(trailing);\n const textRef = useCollapseMotion(collapse, align);\n return useRender({\n defaultTagName: 'header',\n props: {\n ...props,\n children: <div {...stylex.props(styles.row, rowStyles.root(edgePadding(contentInset, hasLeading), edgePadding(contentInset, hasTrailing), contentMaxInlineSize), rowStyles.tracks(below ? `minmax(${COLLAPSED_HEIGHT}, auto) 1fr` : `minmax(${COLLAPSED_HEIGHT}, auto)`), heightStyles.root(height), below && twoRows[size])}>\n {!hasLeading ? null : <div className=\"x6s0dn4 xamitd3 x9f619 x78zum5 x1r8zjiw x1let9r4 x1kxrqrs x15ir4sr\">{leading}</div>}\n <div {...stylex.props(styles.text, below && styles.textBelow, below && textStyles.inset(glyphRoom(contentInset, hasLeading), glyphRoom(contentInset, hasTrailing)), below && textStyles.reach(`calc(-1 * ${UNDER_TARGETS})`), align === 'center' && styles.textCenter)} ref={textRef}>\n {!hasContent(headline) ? null : <Text render={heading(headingLevel)} variant={collapse ? HEADLINE_VARIANT.sm : HEADLINE_VARIANT[size]}>\n {headline}\n </Text>}\n {!hasContent(subtitle) ? null : <Text render={PARAGRAPH} tone=\"muted\" variant={collapse ? SUBTITLE_VARIANT.sm : SUBTITLE_VARIANT[size]}>\n {subtitle}\n </Text>}\n </div>\n {!hasTrailing ? null : <div className=\"x6s0dn4 xamitd3 x9f619 x78zum5 x1r8zjiw x1let9r4 x1txd71x x6aqprb\">\n {trailing}\n </div>}\n </div>,\n ...mergeStyles(stylex.props(styles.root, heightStyles.root(height), scrolled && styles.scrolled, pinned && styles.pinned), props)\n },\n render\n });\n}\n\n/**\n * Where an animation still under way has the bar and the text drawn: the\n * height it holds the bar at, and each line where its transform has taken it\n * and at the size its scale has reached. A line scales about the point it\n * hangs from, so the transform's translation is how far that point has moved.\n */\nfunction drawnAt(bar: HTMLElement, text: HTMLElement, settled: Geometry): Geometry {\n return {\n height: bar.getBoundingClientRect().height,\n lines: LINES.map((selector, index) => {\n const line = settled.lines[index];\n const element = text.querySelector(selector);\n if (line === null || element === null) {\n return null;\n }\n const moved = matrixOf(element);\n return {\n size: line.size * moved.a,\n x: line.x + moved.e,\n y: line.y + moved.f\n };\n })\n };\n}\n\n/** The row's padding on one edge, for the inset the call site gave. */\nfunction edgePadding(contentInset: string, hasSlot: boolean) {\n const inset = withUnit(contentInset);\n return hasSlot ? `max(0px, ${inset} - ${GLYPH_INSET})` : inset;\n}\n\n/**\n * Where the bar and each of the text's lines are drawn. A line's point is on\n * the edge its text hangs from: the middle when it is centred, and the start\n * edge otherwise, which is the right edge in a right-to-left page. Each line\n * is as wide as the text block, so that edge is its box's.\n */\nfunction geometryOf(bar: HTMLElement, text: HTMLElement, align: 'center' | 'start'): Geometry {\n const frame = bar.getBoundingClientRect();\n return {\n height: frame.height,\n lines: LINES.map(selector => {\n const element = text.querySelector(selector);\n if (element === null) {\n return null;\n }\n const box = element.getBoundingClientRect();\n const edge = align === 'center' ? (box.left + box.right) / 2 : isRightToLeft(element) ? box.right : box.left;\n return {\n size: Number.parseFloat(getComputedStyle(element).fontSize),\n x: edge - frame.left,\n y: glyphTopOf(element) - frame.top\n };\n })\n };\n}\n\n/**\n * What the row's padding held back on one edge for a slot's glyph, which the\n * text in the second row puts back: the inset less `edgePadding`, so the\n * smaller of the inset and GLYPH_INSET.\n */\nfunction glyphRoom(contentInset: string, hasSlot: boolean) {\n return hasSlot ? `min(${withUnit(contentInset)}, ${GLYPH_INSET})` : '0px';\n}\n\n/**\n * Where an element's first glyphs start, which is below its box's top by\n * half its line's leading. The leading is a share of the line height, and\n * the two roles a line moves between do not keep line height and type size\n * in one ratio, so a line scaled by its type size from its box's corner\n * starts its glyphs off where they were drawn: about a pixel, for a large\n * bar's headline.\n */\nfunction glyphTopOf(element: Element) {\n const range = document.createRange();\n range.selectNodeContents(element);\n const first = range.getClientRects().item(0);\n return first === null ? element.getBoundingClientRect().top : first.top;\n}\n\n/** Whether the text runs right to left, which decides the edge it hangs from. */\nfunction isRightToLeft(element: Element) {\n return getComputedStyle(element).direction === 'rtl';\n}\n\n/** The transform an element is drawn with, `none` reading as no change. */\nfunction matrixOf(element: Element) {\n return new DOMMatrixReadOnly(getComputedStyle(element).transform);\n}\n\n/**\n * The point a line scales about, in its own box: the top of its glyphs, on\n * the edge its text hangs from.\n */\nfunction originOf(element: Element, align: 'center' | 'start') {\n const edge = align === 'center' ? 'center' : isRightToLeft(element) ? 'right' : 'left';\n const glyphs = glyphTopOf(element) - element.getBoundingClientRect().top;\n return `${edge} ${glyphs}px`;\n}\n\n/**\n * Read when the bar changes state rather than once at mount, so a reader who\n * changes the setting is answered by the next collapse.\n */\nfunction prefersReducedMotion() {\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n\n/**\n * Animates a flexible bar between its two states, and returns the ref for the\n * text block whose lines it moves.\n *\n * Collapsing changes the bar's layout rather than a value — the text leaves\n * the second row for the strip, both lines take the small bar's type roles,\n * and the bar's height drops from a minimum to whatever its content takes —\n * so there is nothing for a CSS transition to interpolate. This plays it the\n * other way round: the change has already been laid out when the effect runs,\n * so the bar is animated from the height it had to the one it has, and each\n * line from where and how large it was drawn to where and how large it is,\n * by a transform that starts at the difference and ends at none. A line\n * scales about the point its glyphs hang from, which is what lands its first\n * frame on the glyphs it replaces — see glyphTopOf. A scale rather than a\n * transition of the type itself, which would lay the text out again on every\n * frame and move it away from the place it was measured at. Each line moves\n * on its own rather than with the block, since the subtitle starts under the\n * headline's line, whose height changes with its role. The slots need\n * nothing: they are in the strip in both states.\n *\n * The bar's height is animated through `min-block-size` as well as its\n * height, since the minimum would otherwise hold an expanding bar at its new\n * height from the first frame, and it is clipped while it moves, since an\n * expanding bar's second row is laid out at full height from the start.\n *\n * Where the text was is measured after every commit that leaves the state\n * alone, so it is current when the state does change. A change that lands\n * while the last one is still moving starts from where the bar and the text\n * are drawn at that moment, read off the running animations, so reversing\n * mid-way turns round rather than jumping to the end first.\n *\n * Its timing is the root's `background-color` transition's, the `medium1`\n * duration and the emphasized curve, so the fill and the height move as one.\n * Those come from tokens/values rather than the theme, since `animate()`\n * throws on a var(), and the motion is skipped under reduced motion, as the\n * root's transition is.\n */\nfunction useCollapseMotion(collapse: boolean, align: 'center' | 'start') {\n const textRef = useRef<HTMLDivElement>(null);\n const settled = useRef<Geometry | null>(null);\n const collapsedBefore = useRef(collapse);\n const animations = useRef<Animation[]>([]);\n useLayoutEffect(() => {\n const text = textRef.current;\n const bar = text?.parentElement?.parentElement;\n if (text == null || bar == null) {\n return;\n }\n const moving = animations.current.some(animation => animation.playState === 'running');\n if (collapsedBefore.current === collapse) {\n if (!moving) {\n settled.current = geometryOf(bar, text, align);\n }\n return;\n }\n collapsedBefore.current = collapse;\n const last = settled.current;\n const from = moving && last !== null ? drawnAt(bar, text, last) : last;\n for (const animation of animations.current) {\n animation.cancel();\n }\n animations.current = [];\n const to = geometryOf(bar, text, align);\n settled.current = to;\n if (from === null || prefersReducedMotion()) {\n return;\n }\n const timing = {\n duration: motionDurationMs.medium1,\n easing: motionEasing.emphasized\n };\n const heights = [`${from.height}px`, `${to.height}px`];\n animations.current = [bar.animate({\n blockSize: heights,\n clipPath: ['inset(0)', 'inset(0)'],\n minBlockSize: heights\n }, timing)];\n for (const [index, selector] of LINES.entries()) {\n const element = text.querySelector(selector);\n const was = from.lines[index];\n const is = to.lines[index];\n if (element === null || was == null || is == null || is.size === 0) {\n continue;\n }\n const origin = originOf(element, align);\n animations.current.push(element.animate({\n transform: [`translate(${was.x - is.x}px, ${was.y - is.y}px) scale(${was.size / is.size})`, 'none'],\n transformOrigin: [origin, origin]\n }, timing));\n }\n });\n return textRef;\n}\n\n/**\n * The inset as a length CSS arithmetic accepts. A bare `0` is the one length\n * CSS takes without a unit, and the one it rejects inside `max()` and `min()`,\n * where it reads as a number.\n */\nfunction withUnit(contentInset: string) {\n return contentInset.trim() === '0' ? '0px' : contentInset;\n}\nexport type { AppBarProps };\nexport default AppBar;"],"mappings":";;;;;;;;;;;;AAsDA,MAAMoB,qBAAqB;AAM3B,MAAME,cAAc,IAAIF,mBAAkB;AAC1C,MAAMG,UAAU;CACdC,IAAI;EACFC,OAAO;EACPC,cAAc;CAChB;CACAC,IAAI;EACFF,OAAO;EACPC,cAAc;CAChB;CACAE,IAAI;EACFH,OAAO;EACPC,cAAc;CAChB;AACF;AAMA,MAAMI,mBAAmBP,QAAQK,GAAGH;AAOpC,MAAMO,SAAS;CACbC,QAAQ;EACNC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRV,OAAO;CACT;CACAW,KAAK;EACHC,QAAQ;EACRP,QAAQ;EACRC,QAAQ;EACRO,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRhB,OAAO;CACT;CACAiB,UAAU;EACRb,QAAQ;EACRc,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRpB,OAAO;CACT;CACAqB,MAAM;EACJC,QAAQ;EACRjB,QAAQ;EACRC,QAAQ;EACRiB,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACR5B,OAAO;CACT;CACA6B,WAAW;EACTP,QAAQ;EACRM,QAAQ;EACR5B,OAAO;CACT;CACA8B,YAAY;EACVC,QAAQ;EACR/B,OAAO;CACT;AACF;AAiBA,MAAMgC,UAAU;CACd7C,IAAI;EACF8C,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,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,GAAErG,MAAO+C;IACpB,IAAIE,YAAY,QAAQ+D,OAAO,QAAQC,MAAM,QAAQA,GAAEvH,SAAU,GAC/D;IAEF,MAAAwH,SAAejC,SAAShC,SAAS9D,KAAK;IACtCuG,WAAUC,QAAQwB,KAAMlE,QAAO2D,QAAS;KAAA5B,WAC3B,CAAC,aAAagC,IAAG9G,IAAK+G,GAAE/G,EAAE,MAAO8G,IAAG7G,IAAK8G,GAAE9G,EAAE,YAAa6G,IAAGtH,OAAQuH,GAAEvH,KAAK,IAAK,MAAM;KAAC0H,iBAClF,CAACF,QAAQA,MAAM;IAClC,GAAGZ,MAAM,CAAC;GAAC;EACZ;EACFhG,EAAA,KAAAnB;EAAAmB,EAAA,KAAAW;EAAAX,EAAA,KAAAC;CAAA,OAAAA,KAAAD,EAAA;CAhDD7H,gBAAgB8H,EAgDf;CAAC,OACKe;AAAO;;;;;;AAtDhB,SAAAyE,OAAAI,WAAA;CAAA,OAWwDA,UAASkB,cAAe;AAAS;AAmDzF,SAAS5D,SAASpE,cAAsB;CACtC,OAAOA,aAAaiI,KAAK,MAAM,MAAM,QAAQjI;AAC/C"}
@@ -121,7 +121,7 @@ function buttonContent(children, ripple, inGroup) {
121
121
  ...props(controlStyles.disc, styles.control, state.isReadOnly && controlStyles.controlReadOnly, state.isDisabled && controlStyles.controlDisabled, interactive && state.isHovered && hoverLayers[tone], interactive && state.isFocusVisible && focusLayers[tone], interactive && state.isPressed && pressedLayers[tone], state.isFocusVisible && focus.ringVisible),
122
122
  children: [/* @__PURE__ */ jsx("span", {
123
123
  ...props(styles.box, marked && styles.boxMarked, !marked && state.isInvalid && styles.boxUnmarkedError, !marked && !state.isInvalid && interactive && active && styles.boxUnmarkedActive, marked && state.isInvalid && styles.boxMarkedError, state.isDisabled && (marked ? styles.boxMarkedDisabled : styles.boxUnmarkedDisabled)),
124
- children: state.isIndeterminate ? /* @__PURE__ */ jsx(IndeterminateGlyph, { className: "xmix8c7 x1lliihq x1xp8n7a" }) : state.isSelected ? /* @__PURE__ */ jsx(CheckGlyph, { className: "xmix8c7 x1lliihq x1xp8n7a" }) : null
124
+ children: state.isIndeterminate ? /* @__PURE__ */ jsx(IndeterminateGlyph, { className: "xmix8c7 x1lliihq x2lah0s x1xp8n7a" }) : state.isSelected ? /* @__PURE__ */ jsx(CheckGlyph, { className: "xmix8c7 x1lliihq x2lah0s x1xp8n7a" }) : null
125
125
  }), interactive ? ripple.surface : null]
126
126
  }), /* @__PURE__ */ jsx(ControlLabel, {
127
127
  isRequired: required,
@@ -210,6 +210,7 @@ function fieldContent(button, description, error, reserve) {
210
210
  children: /* @__PURE__ */ jsx(FieldMessage, {
211
211
  description,
212
212
  error,
213
+ indent: true,
213
214
  inset: false,
214
215
  isDisabled,
215
216
  reserve
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","CheckboxButtonRenderProps","CheckboxFieldRenderProps","CheckboxFieldProps","RACCheckboxFieldProps","stylex","useContext","CheckboxButton","CheckboxField","CheckboxGroupStateContext","ControlLabel","controlStyles","FieldMessage","invalidFrom","useFieldValidationBehavior","CheckGlyph","IndeterminateGlyph","useRipple","focus","mergeStatefulStyles","colors","motion","stateLayerOpacity","FORCED_COLORS","styles","box","k6CgDc","kGNEyG","kWkggS","kZKoxP","kVAM5u","kaIpWk","ksu8eU","kMzoRj","kB7OPa","kMwMTN","k1xSpc","kzqmXN","kjj79g","kIyJzY","k1ekBW","kAMwcw","$$css","boxMarked","boxMarkedDisabled","boxMarkedError","boxUnmarkedActive","boxUnmarkedDisabled","boxUnmarkedError","control","hoverLayers","error","marked","unmarked","focusLayers","pressedLayers","CheckboxProps","children","description","Omit","Ripple","ReturnType","HTMLSpanElement","Tone","buttonContent","ripple","inGroup","state","required","isRequired","isSelected","isIndeterminate","interactive","isDisabled","isReadOnly","tone","isInvalid","active","isHovered","isPressed","isFocusVisible","handlers","props","disc","controlReadOnly","controlDisabled","ringVisible","surface","Checkbox","t0","$","validationBehavior","reachable","validate","undefined","name","T0","t1","t2","field","t3","t4","t5","fieldContent","t6","button","reserve","messages","stylex.props","_c","props"],"sources":["../../../src/components/checkbox/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { CheckboxButtonRenderProps, CheckboxFieldRenderProps, CheckboxFieldProps as RACCheckboxFieldProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext } from 'react';\nimport { CheckboxButton, CheckboxField, CheckboxGroupStateContext } from 'react-aria-components';\nimport { ControlLabel } from '../../control';\nimport { controlStyles } from '../../control/styles';\nimport { FieldMessage } from '../../field';\nimport { invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { CheckGlyph, IndeterminateGlyph } from '../../glyphs';\nimport { useRipple } from '../../hooks/useRipple';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\n\n// The checkbox page: an 18dp box with a 2dp corner and an 18dp glyph, inside\n// a 40dp state layer, with a 48dp target. Unselected, the box is a 2dp rule\n// in on surface variant that turns on surface while hovered, pressed or\n// focused; selected or indeterminate, it fills with primary and the glyph\n// takes on primary. The error pair is error and on error, and disabled is\n// on surface at the disabled opacity for the rule or the fill, with the\n// glyph in surface. The state layer is on surface over an unselected box and\n// primary over a selected one while hovered, and the two swap once pressed.\n//\n// React Aria's `CheckboxField` is the root, a div holding the description\n// and error slots; its `CheckboxButton` is the label around a visually\n// hidden input, and everything drawn is that label's children, chosen from\n// the render state React Aria hands them. The field is a two-column grid —\n// the control, then the text — and the label is `display: contents`, so the\n// control and the label text each take a column and the description and\n// error line up under the text rather than under the box.\n//\n// The adjacent label is body-large on surface, which the page keeps the same\n// whether or not the box is selected. The corner is a literal: the page's\n// 2dp is a step the shape scale does not carry.\n// Windows High Contrast and the rest of the forced-colours modes. Spelled\n// here rather than imported, for the reason src/field/styles.ts records: the\n// StyleX compiler resolves a constant across files only out of a `.stylex.ts`\n// module, and the generated one holds design tokens rather than queries.\nconst FORCED_COLORS = '@media (forced-colors: active)';\nconst styles = {\n box: {\n k6CgDc: \"x12w9bfk\",\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"xmix8c7\",\n kVAM5u: \"x1is7jjm\",\n kaIpWk: \"x1cum3z5\",\n ksu8eU: \"x1y0btm7\",\n kMzoRj: \"xdh2fpr\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"xwjo7ld\",\n k1xSpc: \"x78zum5\",\n kzqmXN: \"x1xp8n7a\",\n kjj79g: \"xl56j7k\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"xts7igz\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n boxMarked: {\n kWkggS: \"xnety89\",\n kVAM5u: \"x9r1u3d\",\n $$css: true\n },\n boxMarkedDisabled: {\n kWkggS: \"x1crcgwy\",\n kVAM5u: \"x9r1u3d xmnqt3w\",\n kMwMTN: \"xrpadme x1bhcspo\",\n $$css: true\n },\n boxMarkedError: {\n kWkggS: \"xwi4nbo\",\n kVAM5u: \"x9r1u3d\",\n kMwMTN: \"x1l7c2jh\",\n $$css: true\n },\n boxUnmarkedActive: {\n kVAM5u: \"x1pacwz9\",\n $$css: true\n },\n boxUnmarkedDisabled: {\n kVAM5u: \"xp1r3on xmnqt3w\",\n $$css: true\n },\n boxUnmarkedError: {\n kVAM5u: \"xx78ee7\",\n $$css: true\n },\n control: {\n kMwMTN: \"x139gbkf\",\n $$css: true\n }\n};\n\n// The state layer's colour follows the box: on surface over an unmarked box\n// and primary over a marked one while hovered, the two swapped once pressed,\n// and error throughout while invalid.\nconst hoverLayers = {\n error: {\n kWkggS: \"x55e1u4\",\n $$css: true\n },\n marked: {\n kWkggS: \"x659ado\",\n $$css: true\n },\n unmarked: {\n kWkggS: \"x1b18xnh\",\n $$css: true\n }\n};\n\n// A keyboard's focus draws the hover layer's colour at the focus opacity.\nconst focusLayers = {\n error: {\n kWkggS: \"xyn212m\",\n $$css: true\n },\n marked: {\n kWkggS: \"x1sog3nf\",\n $$css: true\n },\n unmarked: {\n kWkggS: \"xwqhyid\",\n $$css: true\n }\n};\nconst pressedLayers = {\n error: {\n kWkggS: \"x3czxiy\",\n $$css: true\n },\n marked: {\n kWkggS: \"xjeeohs\",\n $$css: true\n },\n unmarked: {\n kWkggS: \"x1dvjsmr\",\n $$css: true\n }\n};\ntype CheckboxProps = {\n /**\n * The label, beside the box. A checkbox that a row labels some other way\n * leaves it out and passes `aria-label` instead.\n *\n * A link or a button in it acts on its own, as in a native label: a press\n * or Enter on \"the terms\" in \"I agree to the terms\" follows the link and\n * leaves the checkbox as it was. A press anywhere else in the label\n * toggles it.\n */\n children?: ReactNode;\n /**\n * A hint under the label. Replaced by `error` when there is one, so the\n * two never stack.\n */\n description?: string;\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the checkbox in its error state — the message, the error colours and\n * `aria-invalid` all follow from it.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n} & Omit<RACCheckboxFieldProps, 'children' | 'isInvalid' | 'validationBehavior'>;\ntype Ripple = ReturnType<typeof useRipple<HTMLSpanElement>>;\ntype Tone = 'error' | 'marked' | 'unmarked';\n\n// What the label draws, chosen from the render state React Aria hands it.\n// Built by a call rather than written inline at the prop, which is what\n// react-perf's no-new-function-as-prop is after; the React Compiler memoises\n// the result on its inputs. The ripple's handlers and surface go on the\n// control while the checkbox can change, and are left off while it cannot,\n// since a press that changes nothing should not look like one.\nfunction buttonContent(children: ReactNode, ripple: Ripple, inGroup: boolean) {\n return (state: CheckboxButtonRenderProps) => {\n // A checkbox in a group is marked by the group's label rather than its\n // own: the group is what has to have a choice made in it.\n const required = state.isRequired && !inGroup;\n const marked = state.isSelected || state.isIndeterminate;\n const interactive = !state.isDisabled && !state.isReadOnly;\n const tone: Tone = state.isInvalid ? 'error' : marked ? 'marked' : 'unmarked';\n const active = state.isHovered || state.isPressed || state.isFocusVisible;\n return <>\n <span {...interactive ? ripple.handlers : {}} {...stylex.props(controlStyles.disc, styles.control, state.isReadOnly && controlStyles.controlReadOnly, state.isDisabled && controlStyles.controlDisabled, interactive && state.isHovered && hoverLayers[tone], interactive && state.isFocusVisible && focusLayers[tone], interactive && state.isPressed && pressedLayers[tone], state.isFocusVisible && focus.ringVisible)}>\n <span {...stylex.props(styles.box, marked && styles.boxMarked, !marked && state.isInvalid && styles.boxUnmarkedError, !marked && !state.isInvalid && interactive && active && styles.boxUnmarkedActive, marked && state.isInvalid && styles.boxMarkedError, state.isDisabled && (marked ? styles.boxMarkedDisabled : styles.boxUnmarkedDisabled))}>\n {state.isIndeterminate ? <IndeterminateGlyph className=\"xmix8c7 x1lliihq x1xp8n7a\" /> : state.isSelected ? <CheckGlyph className=\"xmix8c7 x1lliihq x1xp8n7a\" /> : null}\n </span>\n {interactive ? ripple.surface : null}\n </span>\n <ControlLabel isRequired={required} state={state}>\n {children}\n </ControlLabel>\n </>;\n };\n}\n\n/**\n * A checkbox with its label, and optionally a description or an error under\n * it. Its state is React Aria's: pass `isSelected` with `onChange` to\n * control it, or `defaultSelected` to let it keep its own; `isIndeterminate`\n * draws the dash for a box that stands for a partly selected set. Inside a\n * `CheckboxGroup` it takes its `value` and the group's selection instead.\n *\n * `isRequired` ends the label in the asterisk every required field's label\n * ends in. Inside a `CheckboxGroup` the group's label carries it instead,\n * since the group is what must have a choice made in it.\n *\n * The call site's `className` and `style` land on the field as a whole,\n * which is the element a layout positions.\n */\nfunction Checkbox({\n children,\n description,\n error,\n ...props\n}: CheckboxProps & RefAttributes<HTMLDivElement>) {\n const ripple = useRipple<HTMLSpanElement>();\n const validationBehavior = useFieldValidationBehavior();\n\n // Whether a message can ever reach this checkbox, which is what a form\n // keeps an empty line under a field for. One in a group cannot — the\n // group owns the one message and keeps its own line for it — and one on\n // its own can only where something can find it wanting: a requirement, a\n // check of its own, or a name a form's errors can be keyed by. Without\n // this every checkbox in a form sat a line taller than it draws, and a\n // group of them in a form gained a line after every item.\n const inGroup = useContext(CheckboxGroupStateContext) !== null;\n const reachable = !inGroup && (props.isRequired === true || props.validate !== undefined || props.name !== undefined);\n return <CheckboxField isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(controlStyles.field), props)}>\n {fieldContent(<CheckboxButton className=\"xjp7ctv\">\n {buttonContent(children, ripple, inGroup)}\n </CheckboxButton>, description, error, reachable)}\n </CheckboxField>;\n}\n\n// The button and the line under it, from the field's render state: the\n// description fades with a disabled checkbox, by itself or by its group, as\n// its label does. Built by a call for the same reason as `buttonContent`.\nfunction fieldContent(button: ReactNode, description: string | undefined, error: string | undefined, reserve: boolean) {\n return ({\n isDisabled\n }: CheckboxFieldRenderProps) => <>\n {button}\n <div {...stylex.props(controlStyles.messages)}>\n <FieldMessage description={description} error={error} inset={false} isDisabled={isDisabled} reserve={reserve} />\n </div>\n </>;\n}\nexport type { CheckboxProps };\nexport default Checkbox;"],"mappings":";;;;;;;;;;;;;;;AA2CA,MAAM2B,SAAS;CACbC,KAAK;EACHC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,WAAW;EACTf,QAAQ;EACRE,QAAQ;EACRY,OAAO;CACT;CACAE,mBAAmB;EACjBhB,QAAQ;EACRE,QAAQ;EACRK,QAAQ;EACRO,OAAO;CACT;CACAG,gBAAgB;EACdjB,QAAQ;EACRE,QAAQ;EACRK,QAAQ;EACRO,OAAO;CACT;CACAI,mBAAmB;EACjBhB,QAAQ;EACRY,OAAO;CACT;CACAK,q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mB/C,aAAiCP,OAA2BuD,SAAkB;CACrH,QAAQ,EACNjC,iBAC8B,qBAAA,YAAA,EAAA,UAAA,CAC3BgC,QACD,oBAAC,OAAD;EAAK,GAAIpG,MAAaM,cAAcgG,QAAQ;EAC1C,UAAA,oBAAC,cAAD;GAA2BjD;GAAoBP;GAAO,OAAO;GAAmBsB;GAAqBiC;EAAQ,CAAA;CAC1G,CAAA,CACP,EAAA,CAAA;AACJ"}
1
+ {"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","CheckboxButtonRenderProps","CheckboxFieldRenderProps","CheckboxFieldProps","RACCheckboxFieldProps","stylex","useContext","CheckboxButton","CheckboxField","CheckboxGroupStateContext","ControlLabel","controlStyles","FieldMessage","invalidFrom","useFieldValidationBehavior","CheckGlyph","IndeterminateGlyph","useRipple","focus","mergeStatefulStyles","colors","motion","stateLayerOpacity","FORCED_COLORS","styles","box","k6CgDc","kGNEyG","kWkggS","kZKoxP","kVAM5u","kaIpWk","ksu8eU","kMzoRj","kB7OPa","kMwMTN","k1xSpc","kzqmXN","kjj79g","kIyJzY","k1ekBW","kAMwcw","$$css","boxMarked","boxMarkedDisabled","boxMarkedError","boxUnmarkedActive","boxUnmarkedDisabled","boxUnmarkedError","control","hoverLayers","error","marked","unmarked","focusLayers","pressedLayers","CheckboxProps","children","description","Omit","Ripple","ReturnType","HTMLSpanElement","Tone","buttonContent","ripple","inGroup","state","required","isRequired","isSelected","isIndeterminate","interactive","isDisabled","isReadOnly","tone","isInvalid","active","isHovered","isPressed","isFocusVisible","handlers","props","disc","controlReadOnly","controlDisabled","ringVisible","surface","Checkbox","t0","$","validationBehavior","reachable","validate","undefined","name","T0","t1","t2","field","t3","t4","t5","fieldContent","t6","button","reserve","messages","stylex.props","_c","props"],"sources":["../../../src/components/checkbox/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { CheckboxButtonRenderProps, CheckboxFieldRenderProps, CheckboxFieldProps as RACCheckboxFieldProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext } from 'react';\nimport { CheckboxButton, CheckboxField, CheckboxGroupStateContext } from 'react-aria-components';\nimport { ControlLabel } from '../../control';\nimport { controlStyles } from '../../control/styles';\nimport { FieldMessage } from '../../field';\nimport { invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { CheckGlyph, IndeterminateGlyph } from '../../glyphs';\nimport { useRipple } from '../../hooks/useRipple';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\n\n// The checkbox page: an 18dp box with a 2dp corner and an 18dp glyph, inside\n// a 40dp state layer, with a 48dp target. Unselected, the box is a 2dp rule\n// in on surface variant that turns on surface while hovered, pressed or\n// focused; selected or indeterminate, it fills with primary and the glyph\n// takes on primary. The error pair is error and on error, and disabled is\n// on surface at the disabled opacity for the rule or the fill, with the\n// glyph in surface. The state layer is on surface over an unselected box and\n// primary over a selected one while hovered, and the two swap once pressed.\n//\n// React Aria's `CheckboxField` is the root, a div holding the description\n// and error slots; its `CheckboxButton` is the label around a visually\n// hidden input, and everything drawn is that label's children, chosen from\n// the render state React Aria hands them. The field is a two-column grid —\n// the control, then the text — and the label is `display: contents`, so the\n// control and the label text each take a column and the description and\n// error line up under the text rather than under the box.\n//\n// The adjacent label is body-large on surface, which the page keeps the same\n// whether or not the box is selected. The corner is a literal: the page's\n// 2dp is a step the shape scale does not carry.\n// Windows High Contrast and the rest of the forced-colours modes. Spelled\n// here rather than imported, for the reason src/field/styles.ts records: the\n// StyleX compiler resolves a constant across files only out of a `.stylex.ts`\n// module, and the generated one holds design tokens rather than queries.\nconst FORCED_COLORS = '@media (forced-colors: active)';\nconst styles = {\n box: {\n k6CgDc: \"x12w9bfk\",\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"xmix8c7\",\n kVAM5u: \"x1is7jjm\",\n kaIpWk: \"x1cum3z5\",\n ksu8eU: \"x1y0btm7\",\n kMzoRj: \"xdh2fpr\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"xwjo7ld\",\n k1xSpc: \"x78zum5\",\n kzqmXN: \"x1xp8n7a\",\n kjj79g: \"xl56j7k\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"xts7igz\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n boxMarked: {\n kWkggS: \"xnety89\",\n kVAM5u: \"x9r1u3d\",\n $$css: true\n },\n boxMarkedDisabled: {\n kWkggS: \"x1crcgwy\",\n kVAM5u: \"x9r1u3d xmnqt3w\",\n kMwMTN: \"xrpadme x1bhcspo\",\n $$css: true\n },\n boxMarkedError: {\n kWkggS: \"xwi4nbo\",\n kVAM5u: \"x9r1u3d\",\n kMwMTN: \"x1l7c2jh\",\n $$css: true\n },\n boxUnmarkedActive: {\n kVAM5u: \"x1pacwz9\",\n $$css: true\n },\n boxUnmarkedDisabled: {\n kVAM5u: \"xp1r3on xmnqt3w\",\n $$css: true\n },\n boxUnmarkedError: {\n kVAM5u: \"xx78ee7\",\n $$css: true\n },\n control: {\n kMwMTN: \"x139gbkf\",\n $$css: true\n }\n};\n\n// The state layer's colour follows the box: on surface over an unmarked box\n// and primary over a marked one while hovered, the two swapped once pressed,\n// and error throughout while invalid.\nconst hoverLayers = {\n error: {\n kWkggS: \"x55e1u4\",\n $$css: true\n },\n marked: {\n kWkggS: \"x659ado\",\n $$css: true\n },\n unmarked: {\n kWkggS: \"x1b18xnh\",\n $$css: true\n }\n};\n\n// A keyboard's focus draws the hover layer's colour at the focus opacity.\nconst focusLayers = {\n error: {\n kWkggS: \"xyn212m\",\n $$css: true\n },\n marked: {\n kWkggS: \"x1sog3nf\",\n $$css: true\n },\n unmarked: {\n kWkggS: \"xwqhyid\",\n $$css: true\n }\n};\nconst pressedLayers = {\n error: {\n kWkggS: \"x3czxiy\",\n $$css: true\n },\n marked: {\n kWkggS: \"xjeeohs\",\n $$css: true\n },\n unmarked: {\n kWkggS: \"x1dvjsmr\",\n $$css: true\n }\n};\ntype CheckboxProps = {\n /**\n * The label, beside the box. A checkbox that a row labels some other way\n * leaves it out and passes `aria-label` instead.\n *\n * A link or a button in it acts on its own, as in a native label: a press\n * or Enter on \"the terms\" in \"I agree to the terms\" follows the link and\n * leaves the checkbox as it was. A press anywhere else in the label\n * toggles it.\n */\n children?: ReactNode;\n /**\n * A hint under the label. Replaced by `error` when there is one, so the\n * two never stack.\n */\n description?: string;\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the checkbox in its error state — the message, the error colours and\n * `aria-invalid` all follow from it.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n} & Omit<RACCheckboxFieldProps, 'children' | 'isInvalid' | 'validationBehavior'>;\ntype Ripple = ReturnType<typeof useRipple<HTMLSpanElement>>;\ntype Tone = 'error' | 'marked' | 'unmarked';\n\n// What the label draws, chosen from the render state React Aria hands it.\n// Built by a call rather than written inline at the prop, which is what\n// react-perf's no-new-function-as-prop is after; the React Compiler memoises\n// the result on its inputs. The ripple's handlers and surface go on the\n// control while the checkbox can change, and are left off while it cannot,\n// since a press that changes nothing should not look like one.\nfunction buttonContent(children: ReactNode, ripple: Ripple, inGroup: boolean) {\n return (state: CheckboxButtonRenderProps) => {\n // A checkbox in a group is marked by the group's label rather than its\n // own: the group is what has to have a choice made in it.\n const required = state.isRequired && !inGroup;\n const marked = state.isSelected || state.isIndeterminate;\n const interactive = !state.isDisabled && !state.isReadOnly;\n const tone: Tone = state.isInvalid ? 'error' : marked ? 'marked' : 'unmarked';\n const active = state.isHovered || state.isPressed || state.isFocusVisible;\n return <>\n <span {...interactive ? ripple.handlers : {}} {...stylex.props(controlStyles.disc, styles.control, state.isReadOnly && controlStyles.controlReadOnly, state.isDisabled && controlStyles.controlDisabled, interactive && state.isHovered && hoverLayers[tone], interactive && state.isFocusVisible && focusLayers[tone], interactive && state.isPressed && pressedLayers[tone], state.isFocusVisible && focus.ringVisible)}>\n <span {...stylex.props(styles.box, marked && styles.boxMarked, !marked && state.isInvalid && styles.boxUnmarkedError, !marked && !state.isInvalid && interactive && active && styles.boxUnmarkedActive, marked && state.isInvalid && styles.boxMarkedError, state.isDisabled && (marked ? styles.boxMarkedDisabled : styles.boxUnmarkedDisabled))}>\n {state.isIndeterminate ? <IndeterminateGlyph className=\"xmix8c7 x1lliihq x2lah0s x1xp8n7a\" /> : state.isSelected ? <CheckGlyph className=\"xmix8c7 x1lliihq x2lah0s x1xp8n7a\" /> : null}\n </span>\n {interactive ? ripple.surface : null}\n </span>\n <ControlLabel isRequired={required} state={state}>\n {children}\n </ControlLabel>\n </>;\n };\n}\n\n/**\n * A checkbox with its label, and optionally a description or an error under\n * it. Its state is React Aria's: pass `isSelected` with `onChange` to\n * control it, or `defaultSelected` to let it keep its own; `isIndeterminate`\n * draws the dash for a box that stands for a partly selected set. Inside a\n * `CheckboxGroup` it takes its `value` and the group's selection instead.\n *\n * `isRequired` ends the label in the asterisk every required field's label\n * ends in. Inside a `CheckboxGroup` the group's label carries it instead,\n * since the group is what must have a choice made in it.\n *\n * The call site's `className` and `style` land on the field as a whole,\n * which is the element a layout positions.\n */\nfunction Checkbox({\n children,\n description,\n error,\n ...props\n}: CheckboxProps & RefAttributes<HTMLDivElement>) {\n const ripple = useRipple<HTMLSpanElement>();\n const validationBehavior = useFieldValidationBehavior();\n\n // Whether a message can ever reach this checkbox, which is what a form\n // keeps an empty line under a field for. One in a group cannot — the\n // group owns the one message and keeps its own line for it — and one on\n // its own can only where something can find it wanting: a requirement, a\n // check of its own, or a name a form's errors can be keyed by. Without\n // this every checkbox in a form sat a line taller than it draws, and a\n // group of them in a form gained a line after every item.\n const inGroup = useContext(CheckboxGroupStateContext) !== null;\n const reachable = !inGroup && (props.isRequired === true || props.validate !== undefined || props.name !== undefined);\n return <CheckboxField isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(controlStyles.field), props)}>\n {fieldContent(<CheckboxButton className=\"xjp7ctv\">\n {buttonContent(children, ripple, inGroup)}\n </CheckboxButton>, description, error, reachable)}\n </CheckboxField>;\n}\n\n// The button and the line under it, from the field's render state: the\n// description fades with a disabled checkbox, by itself or by its group, as\n// its label does. Built by a call for the same reason as `buttonContent`.\nfunction fieldContent(button: ReactNode, description: string | undefined, error: string | undefined, reserve: boolean) {\n return ({\n isDisabled\n }: CheckboxFieldRenderProps) => <>\n {button}\n <div {...stylex.props(controlStyles.messages)}>\n <FieldMessage description={description} error={error} indent inset={false} isDisabled={isDisabled} reserve={reserve} />\n </div>\n </>;\n}\nexport type { CheckboxProps };\nexport default Checkbox;"],"mappings":";;;;;;;;;;;;;;;AA2CA,MAAM2B,SAAS;CACbC,KAAK;EACHC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,WAAW;EACTf,QAAQ;EACRE,QAAQ;EACRY,OAAO;CACT;CACAE,mBAAmB;EACjBhB,QAAQ;EACRE,QAAQ;EACRK,QAAQ;EACRO,OAAO;CACT;CACAG,gBAAgB;EACdjB,QAAQ;EACRE,QAAQ;EACRK,QAAQ;EACRO,OAAO;CACT;CACAI,mBAAmB;EACjBhB,QAAQ;EACRY,OAAO;CACT;CACAK,qBAAqB;EACnBjB,QAAQ;EACRY,OAAO;CACT;CACAM,kBAAkB;EAChBlB,QAAQ;EACRY,OAAO;CACT;CACAO,SAAS;EACPd,QAAQ;EACRO,OAAO;CACT;AACF;AAKA,MAAMQ,cAAc;CAClBC,OAAO;EACLvB,QAAQ;EACRc,OAAO;C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GAAO,QAAA;GAAO,OAAO;GAAmBsB;GAAqBiC;EAAQ,CAAA;CACjH,CAAA,CACP,EAAA,CAAA;AACJ"}
@@ -6,7 +6,6 @@ import { overlay } from "../../styles/overlay.js";
6
6
  import { useHoldBottomEdge } from "../../hooks/useBottomEdge.js";
7
7
  import { useScrollStop } from "../../hooks/useScrollStop.js";
8
8
  import { OverlayScope } from "../../overlay/index.js";
9
- import { InsideModalContext } from "../../overlay/modal.js";
10
9
  import { c } from "react/compiler-runtime";
11
10
  import { createContext, useContext, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
12
11
  import { jsx } from "react/jsx-runtime";
@@ -101,11 +100,11 @@ function Dialog$1(t0) {
101
100
  }
102
101
  function DialogBody(t0) {
103
102
  const $ = c(8);
104
- const { ref: callerRef, ...props$2 } = t0;
103
+ const { ref: callerRef, ...props$1 } = t0;
105
104
  const isBasic = useContext(BasicContext);
106
105
  const describe = useContext(DescriptionContext);
107
106
  const generated = useId();
108
- const id = props$2.id ?? (describe === null ? void 0 : generated);
107
+ const id = props$1.id ?? (describe === null ? void 0 : generated);
109
108
  useLayoutEffect(() => {
110
109
  if (describe === null || id === void 0) return;
111
110
  describe(id);
@@ -116,7 +115,7 @@ function DialogBody(t0) {
116
115
  const ref = useRef(null);
117
116
  const title = useSlottedContext(HeadingContext, "title");
118
117
  const scrollStop = useScrollStop(ref, {
119
- label: props$2["aria-label"],
118
+ label: props$1["aria-label"],
120
119
  title: title?.id
121
120
  });
122
121
  const t1 = callerRef ?? void 0;
@@ -127,19 +126,19 @@ function DialogBody(t0) {
127
126
  $[1] = t2;
128
127
  } else t2 = $[1];
129
128
  const merged = t2;
130
- const t3 = mergeStyles(props(styles.body, isBasic && basic.body, overlay.modalBodyRing), props$2);
129
+ const t3 = mergeStyles(props(styles.body, isBasic && basic.body, overlay.modalBodyRing), props$1);
131
130
  let t4;
132
- if ($[2] !== id || $[3] !== merged || $[4] !== props$2 || $[5] !== scrollStop || $[6] !== t3) {
131
+ if ($[2] !== id || $[3] !== merged || $[4] !== props$1 || $[5] !== scrollStop || $[6] !== t3) {
133
132
  t4 = /* @__PURE__ */ jsx("div", {
134
133
  ...scrollStop,
135
134
  id,
136
- ...props$2,
135
+ ...props$1,
137
136
  ref: merged,
138
137
  ...t3
139
138
  });
140
139
  $[2] = id;
141
140
  $[3] = merged;
142
- $[4] = props$2;
141
+ $[4] = props$1;
143
142
  $[5] = scrollStop;
144
143
  $[6] = t3;
145
144
  $[7] = t4;
@@ -177,7 +176,7 @@ function DialogBody(t0) {
177
176
  * over it, and React Aria's popovers and menus draw above both.
178
177
  */
179
178
  function DialogContent(t0) {
180
- const $ = c(43);
179
+ const $ = c(42);
181
180
  let children;
182
181
  let className;
183
182
  let container;
@@ -185,12 +184,12 @@ function DialogContent(t0) {
185
184
  let isKeyboardDismissDisabled;
186
185
  let isOpen;
187
186
  let onOpenChange;
188
- let props$1;
187
+ let props$2;
189
188
  let ref;
190
189
  let style;
191
190
  let t1;
192
191
  if ($[0] !== t0) {
193
- ({children, className, container, defaultOpen, isDismissable: t1, isKeyboardDismissDisabled, isOpen, onOpenChange, ref, style, ...props$1} = t0);
192
+ ({children, className, container, defaultOpen, isDismissable: t1, isKeyboardDismissDisabled, isOpen, onOpenChange, ref, style, ...props$2} = t0);
194
193
  $[0] = t0;
195
194
  $[1] = children;
196
195
  $[2] = className;
@@ -199,7 +198,7 @@ function DialogContent(t0) {
199
198
  $[5] = isKeyboardDismissDisabled;
200
199
  $[6] = isOpen;
201
200
  $[7] = onOpenChange;
202
- $[8] = props$1;
201
+ $[8] = props$2;
203
202
  $[9] = ref;
204
203
  $[10] = style;
205
204
  $[11] = t1;
@@ -211,25 +210,23 @@ function DialogContent(t0) {
211
210
  isKeyboardDismissDisabled = $[5];
212
211
  isOpen = $[6];
213
212
  onOpenChange = $[7];
214
- props$1 = $[8];
213
+ props$2 = $[8];
215
214
  ref = $[9];
216
215
  style = $[10];
217
216
  t1 = $[11];
218
217
  }
219
218
  const isDismissable = t1 === void 0 ? true : t1;
220
- const isBasic = props$1.role === "alertdialog";
219
+ const isBasic = props$2.role === "alertdialog";
221
220
  const [body, setBody] = useState();
222
- const overModal = useContext(InsideModalContext);
223
221
  const t2 = isBasic ? setBody : null;
224
222
  let t3;
225
- if ($[12] !== isBasic || $[13] !== overModal) {
226
- t3 = props(overlay.scrim, overModal && overlay.scrimOverModal, styles.centre, isBasic && basic.centre);
223
+ if ($[12] !== isBasic) {
224
+ t3 = props(overlay.scrim, styles.centre, isBasic && basic.centre);
227
225
  $[12] = isBasic;
228
- $[13] = overModal;
229
- $[14] = t3;
230
- } else t3 = $[14];
226
+ $[13] = t3;
227
+ } else t3 = $[13];
231
228
  let t4;
232
- if ($[15] !== className || $[16] !== isBasic || $[17] !== style) {
229
+ if ($[14] !== className || $[15] !== isBasic || $[16] !== style) {
233
230
  t4 = mergeStatefulStyles({
234
231
  0: { className: "x1n1nwrg x1u6grsq xbhiib0 x1ebxanj x16dv9tl xvkjz1l xt7dq6l x1ju3lih x1w1tqly x19pkqky x1f120ba xx61lck x1gb867b x13rsnn2 x1udv5rz x9f619 x139gbkf x78zum5 xdt5ytf xh8yej3 xmz0i5r x27kpxv x6iovhr x1u2d2a2 xxzqys8 xb3r6kr x9xqwrn xg8iv3o x19b5e0v xsds98l" },
235
232
  1: { className: "x1n1nwrg x1u6grsq x16dv9tl xvkjz1l x1w1tqly x13rsnn2 x1udv5rz x9f619 x139gbkf x78zum5 xdt5ytf xh8yej3 xmz0i5r xb3r6kr xbhiib0 xt7dq6l x19pkqky xx61lck x27kpxv x1u2d2a2" }
@@ -237,47 +234,44 @@ function DialogContent(t0) {
237
234
  className,
238
235
  style
239
236
  });
240
- $[15] = className;
241
- $[16] = isBasic;
242
- $[17] = style;
243
- $[18] = t4;
244
- } else t4 = $[18];
245
- const t5 = props$1["aria-describedby"] ?? (isBasic ? body : void 0);
237
+ $[14] = className;
238
+ $[15] = isBasic;
239
+ $[16] = style;
240
+ $[17] = t4;
241
+ } else t4 = $[17];
242
+ const t5 = props$2["aria-describedby"] ?? (isBasic ? body : void 0);
246
243
  let t6;
247
- if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
244
+ if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
248
245
  t6 = props(overlay.modalDialog);
249
- $[19] = t6;
250
- } else t6 = $[19];
246
+ $[18] = t6;
247
+ } else t6 = $[18];
251
248
  let t7;
252
- if ($[20] !== children || $[21] !== props$1 || $[22] !== t5) {
253
- t7 = /* @__PURE__ */ jsx(InsideModalContext, {
254
- value: true,
255
- children: /* @__PURE__ */ jsx(Dialog, {
256
- ...props$1,
257
- "aria-describedby": t5,
258
- ...t6,
259
- children
260
- })
249
+ if ($[19] !== children || $[20] !== props$2 || $[21] !== t5) {
250
+ t7 = /* @__PURE__ */ jsx(Dialog, {
251
+ ...props$2,
252
+ "aria-describedby": t5,
253
+ ...t6,
254
+ children
261
255
  });
262
- $[20] = children;
263
- $[21] = props$1;
264
- $[22] = t5;
265
- $[23] = t7;
266
- } else t7 = $[23];
256
+ $[19] = children;
257
+ $[20] = props$2;
258
+ $[21] = t5;
259
+ $[22] = t7;
260
+ } else t7 = $[22];
267
261
  let t8;
268
- if ($[24] !== ref || $[25] !== t4 || $[26] !== t7) {
262
+ if ($[23] !== ref || $[24] !== t4 || $[25] !== t7) {
269
263
  t8 = /* @__PURE__ */ jsx(Modal, {
270
264
  ref,
271
265
  ...t4,
272
266
  children: t7
273
267
  });
274
- $[24] = ref;
275
- $[25] = t4;
276
- $[26] = t7;
277
- $[27] = t8;
278
- } else t8 = $[27];
268
+ $[23] = ref;
269
+ $[24] = t4;
270
+ $[25] = t7;
271
+ $[26] = t8;
272
+ } else t8 = $[26];
279
273
  let t9;
280
- if ($[28] !== container || $[29] !== defaultOpen || $[30] !== isDismissable || $[31] !== isKeyboardDismissDisabled || $[32] !== isOpen || $[33] !== onOpenChange || $[34] !== t3 || $[35] !== t8) {
274
+ if ($[27] !== container || $[28] !== defaultOpen || $[29] !== isDismissable || $[30] !== isKeyboardDismissDisabled || $[31] !== isOpen || $[32] !== onOpenChange || $[33] !== t3 || $[34] !== t8) {
281
275
  t9 = /* @__PURE__ */ jsx(OverlayScope, { children: /* @__PURE__ */ jsx(ModalOverlay, {
282
276
  defaultOpen,
283
277
  isDismissable,
@@ -288,36 +282,36 @@ function DialogContent(t0) {
288
282
  ...t3,
289
283
  children: t8
290
284
  }) });
291
- $[28] = container;
292
- $[29] = defaultOpen;
293
- $[30] = isDismissable;
294
- $[31] = isKeyboardDismissDisabled;
295
- $[32] = isOpen;
296
- $[33] = onOpenChange;
297
- $[34] = t3;
298
- $[35] = t8;
299
- $[36] = t9;
300
- } else t9 = $[36];
285
+ $[27] = container;
286
+ $[28] = defaultOpen;
287
+ $[29] = isDismissable;
288
+ $[30] = isKeyboardDismissDisabled;
289
+ $[31] = isOpen;
290
+ $[32] = onOpenChange;
291
+ $[33] = t3;
292
+ $[34] = t8;
293
+ $[35] = t9;
294
+ } else t9 = $[35];
301
295
  let t10;
302
- if ($[37] !== t2 || $[38] !== t9) {
296
+ if ($[36] !== t2 || $[37] !== t9) {
303
297
  t10 = /* @__PURE__ */ jsx(DescriptionContext, {
304
298
  value: t2,
305
299
  children: t9
306
300
  });
307
- $[37] = t2;
308
- $[38] = t9;
309
- $[39] = t10;
310
- } else t10 = $[39];
301
+ $[36] = t2;
302
+ $[37] = t9;
303
+ $[38] = t10;
304
+ } else t10 = $[38];
311
305
  let t11;
312
- if ($[40] !== isBasic || $[41] !== t10) {
306
+ if ($[39] !== isBasic || $[40] !== t10) {
313
307
  t11 = /* @__PURE__ */ jsx(BasicContext, {
314
308
  value: isBasic,
315
309
  children: t10
316
310
  });
317
- $[40] = isBasic;
318
- $[41] = t10;
319
- $[42] = t11;
320
- } else t11 = $[42];
311
+ $[39] = isBasic;
312
+ $[40] = t10;
313
+ $[41] = t11;
314
+ } else t11 = $[41];
321
315
  return t11;
322
316
  }
323
317
  /**