@kanso-labs/kanso-ui 0.41.0 → 0.42.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.
- package/dist/components/app-bar/index.d.ts +5 -4
- package/dist/components/app-bar/index.js +1 -2
- package/dist/components/app-bar/index.js.map +1 -1
- package/dist/components/avatar/index.d.ts +28 -2
- package/dist/components/avatar/index.js +3 -0
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/product-icon/index.d.ts +18 -0
- package/dist/components/product-icon/index.js +3 -0
- package/dist/components/product-icon/index.js.map +1 -1
- package/dist/glyphs/index.js +19 -1
- package/dist/glyphs/index.js.map +1 -1
- package/dist/hooks/useImageLoadingStatus.js +56 -45
- package/dist/hooks/useImageLoadingStatus.js.map +1 -1
- package/dist/mark/index.js +126 -86
- package/dist/mark/index.js.map +1 -1
- package/dist/mark/styles.js +14 -0
- package/dist/mark/styles.js.map +1 -1
- package/dist/styles.css +8 -0
- package/package.json +12 -12
|
@@ -66,12 +66,13 @@ type AppBarProps = Omit<RenderComponentProps<'header'>, 'children'> & {
|
|
|
66
66
|
*/
|
|
67
67
|
contentMaxInlineSize?: string;
|
|
68
68
|
/**
|
|
69
|
-
* Where the headline sits in the page's outline
|
|
70
|
-
* between headings, so a bar drawn beside
|
|
71
|
-
* heading of its own, should lower it.
|
|
69
|
+
* Where the headline sits in the page's outline, as one of the six heading
|
|
70
|
+
* levels. A screen reader moves between headings, so a bar drawn beside
|
|
71
|
+
* another bar, or under a page heading of its own, should lower it. A value
|
|
72
|
+
* outside the six that reaches it untyped falls back to 1.
|
|
72
73
|
* @default 1
|
|
73
74
|
*/
|
|
74
|
-
headingLevel?:
|
|
75
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
75
76
|
/** The page's title. Wraps rather than truncating, and grows the bar with it. */
|
|
76
77
|
headline?: ReactNode;
|
|
77
78
|
/** Usually a back or menu icon button. Sits before the text. */
|
|
@@ -75,8 +75,7 @@ const HEADINGS = [
|
|
|
75
75
|
"h6"
|
|
76
76
|
];
|
|
77
77
|
function heading(level) {
|
|
78
|
-
|
|
79
|
-
return createElement(HEADINGS[index]);
|
|
78
|
+
return createElement(Number.isInteger(level) && level >= 1 && level <= 6 ? HEADINGS[level - 1] : HEADINGS[0]);
|
|
80
79
|
}
|
|
81
80
|
const PARAGRAPH = /* @__PURE__ */ jsx("p", {});
|
|
82
81
|
const _temp = {
|
|
@@ -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","index","Math","min","max","round","length","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. Disclosure's\n// own `headingLevel` hands the number to React Aria, which is why that one\n// needs no equivalent.\nconst HEADINGS = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] as const;\nfunction heading(level: number) {\n const index = Math.min(Math.max(Math.round(level), 1), HEADINGS.length) - 1;\n return createElement(HEADINGS[index]);\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. A screen reader moves\n * between headings, so a bar drawn beside another bar, or under a page\n * heading of its own, should lower it.\n * @default 1\n */\n headingLevel?: number;\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;AAkBA,MAAM6B,WAAW;CAAC;CAAM;CAAM;CAAM;CAAM;CAAM;AAAI;AACpD,SAASC,QA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LC;EACL;EAACJ,EAAA,MAAAE;EAAAF,EAAA,MAAAG;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,OA1BMnF,GAAU2F,EA0BhB;AAAC;;;;;;;;AAUJ,SAASe,YAAYjC,cAAsBgD,SAAkB;CAC3D,MAAMC,QAAQjD,aAAakD,KAAK,MAAM,MAAM,QAAQlD;CACpD,OAAOgD,UAAU,YAAYC,MAAK,KAAMhH,YAAW,KAAMgH;AAC3D"}
|
|
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;EAC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A,KAAAD;EAAAC,EAAA,KAAAC;EAAAD,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;EAAAL,EAAA,KAAAM;CAAA,OAAA;EAAAL,SAAAD,EAAA;EAAAE,KAAAF,EAAA;EAAAG,KAAAH,EAAA;EAAAI,KAAAJ,EAAA;EAAAK,KAAAL,EAAA;EAAAM,KAAAN,EAAA;CAAA;CAAA,IAAAO;CAAA,IAAAP,EAAA,QAAAE,MAAAF,EAAA,QAAAG,MAAAH,EAAA,QAAAI,IAAA;EArB5HG,KAAA;GAAA,GACFS;GAAKoB,UACEjC;GAkBF,GACLC;EACL;EAACJ,EAAA,MAAAE;EAAAF,EAAA,MAAAG;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,6 +1,22 @@
|
|
|
1
1
|
import { RenderComponentProps } from "../../render/useRender.js";
|
|
2
|
+
import { ImgHTMLAttributes } from "react";
|
|
2
3
|
//#region src/components/avatar/index.d.ts
|
|
3
|
-
type AvatarProps =
|
|
4
|
+
type AvatarProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Hides the avatar from assistive technology, for one beside the person's
|
|
7
|
+
* name — a row whose headline is the name, a byline — where it would
|
|
8
|
+
* otherwise announce the name a second time. `name` still supplies the
|
|
9
|
+
* initials, and is not announced.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
decorative?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Attributes for the picture's own `<img>`: a `srcSet` and `sizes` for a
|
|
15
|
+
* screen's density, a `referrerPolicy` or `crossOrigin` for where it is
|
|
16
|
+
* served from, a `fetchPriority`, or `loading` and `decoding`, which are
|
|
17
|
+
* `lazy` and `async` unless given.
|
|
18
|
+
*/
|
|
19
|
+
imgProps?: Pick<ImgHTMLAttributes<HTMLImageElement>, 'crossOrigin' | 'decoding' | 'fetchPriority' | 'loading' | 'referrerPolicy' | 'sizes' | 'srcSet'>;
|
|
4
20
|
/**
|
|
5
21
|
* The person this represents. Supplies both the initials and the accessible
|
|
6
22
|
* name, so a screen reader announces who it is rather than reading two
|
|
@@ -14,6 +30,13 @@ type AvatarProps = Omit<RenderComponentProps<'span'>, 'children'> & {
|
|
|
14
30
|
* names are, is one word, and takes one initial.
|
|
15
31
|
*/
|
|
16
32
|
name: string;
|
|
33
|
+
/**
|
|
34
|
+
* Whether an avatar with no initials to take, for a blank `name`, draws
|
|
35
|
+
* Material Design's anonymous person. `false` leaves the tinted disc empty,
|
|
36
|
+
* for a loading skeleton.
|
|
37
|
+
* @default true
|
|
38
|
+
*/
|
|
39
|
+
showPersonIcon?: boolean;
|
|
17
40
|
/**
|
|
18
41
|
* Diameter: `sm` 36px, `md` 40px, `lg` 56px.
|
|
19
42
|
* @default 'md'
|
|
@@ -29,7 +52,7 @@ type AvatarProps = Omit<RenderComponentProps<'span'>, 'children'> & {
|
|
|
29
52
|
* @default 'primary'
|
|
30
53
|
*/
|
|
31
54
|
tone?: 'negative' | 'positive' | 'primary' | 'secondary' | 'tertiary';
|
|
32
|
-
}
|
|
55
|
+
} & Omit<RenderComponentProps<'span'>, 'children'>;
|
|
33
56
|
/**
|
|
34
57
|
* A person, as a circle holding their photo or, until it loads or when there
|
|
35
58
|
* is none, their initials. `name` is both where the initials come from and
|
|
@@ -39,6 +62,9 @@ type AvatarProps = Omit<RenderComponentProps<'span'>, 'children'> & {
|
|
|
39
62
|
* <Avatar name="Ada Lovelace" src={photo} size="lg" />
|
|
40
63
|
* ```
|
|
41
64
|
*
|
|
65
|
+
* When the person's name is already written next to the avatar, mark it
|
|
66
|
+
* `decorative`, so a screen reader reads the name once.
|
|
67
|
+
*
|
|
42
68
|
* Reach for ProductIcon when what is drawn is not a person; the two share
|
|
43
69
|
* their sizes, so either fills the same slot in a row or a card.
|
|
44
70
|
*
|
|
@@ -12,6 +12,9 @@ import { jsx } from "react/jsx-runtime";
|
|
|
12
12
|
* <Avatar name="Ada Lovelace" src={photo} size="lg" />
|
|
13
13
|
* ```
|
|
14
14
|
*
|
|
15
|
+
* When the person's name is already written next to the avatar, mark it
|
|
16
|
+
* `decorative`, so a screen reader reads the name once.
|
|
17
|
+
*
|
|
15
18
|
* Reach for ProductIcon when what is drawn is not a person; the two share
|
|
16
19
|
* their sizes, so either fills the same slot in a row or a card.
|
|
17
20
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","RenderComponentProps","Mark","AvatarProps","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","ImgHTMLAttributes","RenderComponentProps","Mark","AvatarProps","decorative","imgProps","Pick","HTMLImageElement","name","showPersonIcon","size","src","tone","Omit","Avatar","t0","$","props","t1","t2","undefined","t3","_c"],"sources":["../../../src/components/avatar/index.tsx"],"sourcesContent":["'use client'\n\nimport type { ImgHTMLAttributes } from 'react'\n\nimport type { RenderComponentProps } from '../../render/useRender'\n\nimport Mark from '../../mark'\n\n// A person, drawn as a circle with the photo cropped to fill it. The box, the\n// sizes, the tones, the photo's loading and the labelling are the mark's in\n// `src/mark`, which ProductIcon draws a thing through as well, so a person\n// and a thing fill the same slot.\n//\n// Which tone a given person gets is the consuming app's decision — the design\n// cycles colours per person, and that cycle belongs where the list of people\n// is, not in this component.\n\ntype AvatarProps = {\n /**\n * Hides the avatar from assistive technology, for one beside the person's\n * name — a row whose headline is the name, a byline — where it would\n * otherwise announce the name a second time. `name` still supplies the\n * initials, and is not announced.\n * @default false\n */\n decorative?: boolean\n /**\n * Attributes for the picture's own `<img>`: a `srcSet` and `sizes` for a\n * screen's density, a `referrerPolicy` or `crossOrigin` for where it is\n * served from, a `fetchPriority`, or `loading` and `decoding`, which are\n * `lazy` and `async` unless given.\n */\n imgProps?: Pick<\n ImgHTMLAttributes<HTMLImageElement>,\n | 'crossOrigin'\n | 'decoding'\n | 'fetchPriority'\n | 'loading'\n | 'referrerPolicy'\n | 'sizes'\n | 'srcSet'\n >\n /**\n * The person this represents. Supplies both the initials and the accessible\n * name, so a screen reader announces who it is rather than reading two\n * letters aloud.\n *\n * A display name, as a reader would see it written: the initials are its\n * first and last words. A title before the name (\"Dr.\"), a generational\n * suffix after it (\"Jr.\", \"III\") and an aside in brackets at its end\n * (\"(she/her)\") are passed over, as is punctuation a word opens with. A\n * name written without spaces between its words, as Japanese and Chinese\n * names are, is one word, and takes one initial.\n */\n name: string\n /**\n * Whether an avatar with no initials to take, for a blank `name`, draws\n * Material Design's anonymous person. `false` leaves the tinted disc empty,\n * for a loading skeleton.\n * @default true\n */\n showPersonIcon?: boolean\n /**\n * Diameter: `sm` 36px, `md` 40px, `lg` 56px.\n * @default 'md'\n */\n size?: 'lg' | 'md' | 'sm'\n /**\n * A photo to show in place of the initials. The initials stay until it has\n * loaded, and come back if it fails.\n */\n src?: string\n /**\n * Which container/on-container colour pair to tint with.\n * @default 'primary'\n */\n tone?: 'negative' | 'positive' | 'primary' | 'secondary' | 'tertiary'\n} & Omit<RenderComponentProps<'span'>, 'children'>\n\n/**\n * A person, as a circle holding their photo or, until it loads or when there\n * is none, their initials. `name` is both where the initials come from and\n * what a screen reader announces, so it is required even with a photo.\n *\n * ```tsx\n * <Avatar name=\"Ada Lovelace\" src={photo} size=\"lg\" />\n * ```\n *\n * When the person's name is already written next to the avatar, mark it\n * `decorative`, so a screen reader reads the name once.\n *\n * Reach for ProductIcon when what is drawn is not a person; the two share\n * their sizes, so either fills the same slot in a row or a card.\n *\n * The call site's `className` and `style` land on the circle.\n */\nfunction Avatar({ size = 'md', tone = 'primary', ...props }: AvatarProps) {\n return <Mark {...props} kind=\"person\" size={size} tone={tone} />\n}\n\nexport type { AvatarProps }\n\nexport default Avatar\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAgGA,SAAAgB,OAAAC,IAAA;CAAA,MAAAC,IAAAjB,EAAA,CAAA;CAAA,IAAAkB;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAH,EAAA,OAAAD,IAAA;EAAgB,CAAA,CAAAL,MAAAQ,IAAAN,MAAAO,IAAA,GAAAF,SAAAF;EAAwDC,EAAA,KAAAD;EAAAC,EAAA,KAAAC;EAAAD,EAAA,KAAAE;EAAAF,EAAA,KAAAG;CAAA,OAAA;EAAAF,QAAAD,EAAA;EAAAE,KAAAF,EAAA;EAAAG,KAAAH,EAAA;CAAA;CAAtD,MAAAN,OAAAQ,OAAAE,KAAAA,IAAA,OAAAF;CAAa,MAAAN,OAAAO,OAAAC,KAAAA,IAAA,YAAAD;CAAgB,IAAAE;CAAA,IAAAL,EAAA,OAAAC,SAAAD,EAAA,OAAAN,QAAAM,EAAA,OAAAJ,MAAA;EACtCS,KAAA,oBAAC,MAAD;GAAK,GAAKJ;GAAY,MAAA;GAAeP;GAAYE;EAAI,CAAA;EAAII,EAAA,KAAAC;EAAAD,EAAA,KAAAN;EAAAM,EAAA,KAAAJ;EAAAI,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OAAzDK;AAAyD"}
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import { RenderComponentProps } from "../../render/useRender.js";
|
|
2
|
+
import { ImgHTMLAttributes } from "react";
|
|
2
3
|
//#region src/components/product-icon/index.d.ts
|
|
3
4
|
type ProductIconProps = Omit<RenderComponentProps<'span'>, 'children'> & {
|
|
5
|
+
/**
|
|
6
|
+
* Hides the mark from assistive technology, for one beside the name of
|
|
7
|
+
* what it identifies, where it would otherwise announce the name a second
|
|
8
|
+
* time. `name` still supplies the initial, and is not announced.
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
11
|
+
decorative?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Attributes for the picture's own `<img>`: a `srcSet` and `sizes` for a
|
|
14
|
+
* screen's density, a `referrerPolicy` or `crossOrigin` for where it is
|
|
15
|
+
* served from, a `fetchPriority`, or `loading` and `decoding`, which are
|
|
16
|
+
* `lazy` and `async` unless given.
|
|
17
|
+
*/
|
|
18
|
+
imgProps?: Pick<ImgHTMLAttributes<HTMLImageElement>, 'crossOrigin' | 'decoding' | 'fetchPriority' | 'loading' | 'referrerPolicy' | 'sizes' | 'srcSet'>;
|
|
4
19
|
/**
|
|
5
20
|
* What this identifies. Supplies both the fallback initial and the
|
|
6
21
|
* accessible name, so a screen reader announces the thing rather than
|
|
@@ -34,6 +49,9 @@ type ProductIconProps = Omit<RenderComponentProps<'span'>, 'children'> & {
|
|
|
34
49
|
*
|
|
35
50
|
* The mark is letterboxed rather than cropped, so a logo of any aspect ratio
|
|
36
51
|
* can be handed over as it was drawn.
|
|
52
|
+
*
|
|
53
|
+
* When the thing's name is already written next to the mark, mark it
|
|
54
|
+
* `decorative`, so a screen reader reads the name once.
|
|
37
55
|
*/
|
|
38
56
|
declare function ProductIcon({ size, tone, ...props }: ProductIconProps): import("react").JSX.Element;
|
|
39
57
|
//#endregion
|
|
@@ -9,6 +9,9 @@ import { jsx } from "react/jsx-runtime";
|
|
|
9
9
|
*
|
|
10
10
|
* The mark is letterboxed rather than cropped, so a logo of any aspect ratio
|
|
11
11
|
* can be handed over as it was drawn.
|
|
12
|
+
*
|
|
13
|
+
* When the thing's name is already written next to the mark, mark it
|
|
14
|
+
* `decorative`, so a screen reader reads the name once.
|
|
12
15
|
*/
|
|
13
16
|
function ProductIcon(t0) {
|
|
14
17
|
const $ = c(8);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","RenderComponentProps","Mark","ProductIconProps","Omit","name","size","src","tone","ProductIcon","t0","$","props","t1","t2","undefined","t3","_c"],"sources":["../../../src/components/product-icon/index.tsx"],"sourcesContent":["'use client'\n\nimport type { RenderComponentProps } from '../../render/useRender'\n\nimport Mark from '../../mark'\n\n// The counterpart to Avatar: Avatar stands for a person, this stands for\n// everything else — an application, a service, a brand. It is drawn as a\n// rounded square with the mark letterboxed, and its tone tints the fallback\n// rather than the square. The header of `src/mark/styles.ts` says why on all\n// three counts.\n//\n// The box, the sizes, the tones, the mark's loading and the labelling are the\n// mark's in `src/mark`, which Avatar draws a person through as well. No\n// Material Design page draws a product mark, so its sizes are Avatar's — 36,\n// 40 and 56 — which is what lets a mark and a person fill the same slot.\n\ntype ProductIconProps = Omit<RenderComponentProps<'span'>, 'children'> & {\n /**\n * What this identifies. Supplies both the fallback initial and the\n * accessible name, so a screen reader announces the thing rather than\n * reading a letter aloud. The initial is the name's first letter, number or\n * emoji, passing over punctuation it opens with: a handle's at sign, a\n * channel's hash or a bracket.\n */\n name: string\n /**\n * Edge length: `sm` 36px, `md` 40px, `lg` 56px. The same three Avatar uses,\n * so the two are interchangeable wherever one leads a row or a card.\n * @default 'md'\n */\n size?: 'lg' | 'md' | 'sm'\n /**\n * The mark to show in place of the initial. The initial stays until it has\n * loaded, and comes back if it fails.\n */\n src?: string\n /**\n * Which container/on-container colour pair to tint the fallback with. It is\n * the fallback's own background, so it is gone once `src` has loaded rather\n * than sitting behind the mark.\n * @default 'primary'\n */\n tone?: 'negative' | 'positive' | 'primary' | 'secondary' | 'tertiary'\n}\n\n/**\n * A small square mark identifying something that is not a person — an\n * application, a service, a brand. Reach for Avatar when it is a person.\n *\n * The mark is letterboxed rather than cropped, so a logo of any aspect ratio\n * can be handed over as it was drawn.\n */\nfunction ProductIcon({\n size = 'md',\n tone = 'primary',\n ...props\n}: ProductIconProps) {\n return <Mark {...props} kind=\"thing\" size={size} tone={tone} />\n}\n\nexport type { ProductIconProps }\n\nexport default ProductIcon\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","ImgHTMLAttributes","RenderComponentProps","Mark","ProductIconProps","Omit","decorative","imgProps","Pick","HTMLImageElement","name","size","src","tone","ProductIcon","t0","$","props","t1","t2","undefined","t3","_c"],"sources":["../../../src/components/product-icon/index.tsx"],"sourcesContent":["'use client'\n\nimport type { ImgHTMLAttributes } from 'react'\n\nimport type { RenderComponentProps } from '../../render/useRender'\n\nimport Mark from '../../mark'\n\n// The counterpart to Avatar: Avatar stands for a person, this stands for\n// everything else — an application, a service, a brand. It is drawn as a\n// rounded square with the mark letterboxed, and its tone tints the fallback\n// rather than the square. The header of `src/mark/styles.ts` says why on all\n// three counts.\n//\n// The box, the sizes, the tones, the mark's loading and the labelling are the\n// mark's in `src/mark`, which Avatar draws a person through as well. No\n// Material Design page draws a product mark, so its sizes are Avatar's — 36,\n// 40 and 56 — which is what lets a mark and a person fill the same slot.\n\ntype ProductIconProps = Omit<RenderComponentProps<'span'>, 'children'> & {\n /**\n * Hides the mark from assistive technology, for one beside the name of\n * what it identifies, where it would otherwise announce the name a second\n * time. `name` still supplies the initial, and is not announced.\n * @default false\n */\n decorative?: boolean\n /**\n * Attributes for the picture's own `<img>`: a `srcSet` and `sizes` for a\n * screen's density, a `referrerPolicy` or `crossOrigin` for where it is\n * served from, a `fetchPriority`, or `loading` and `decoding`, which are\n * `lazy` and `async` unless given.\n */\n imgProps?: Pick<\n ImgHTMLAttributes<HTMLImageElement>,\n | 'crossOrigin'\n | 'decoding'\n | 'fetchPriority'\n | 'loading'\n | 'referrerPolicy'\n | 'sizes'\n | 'srcSet'\n >\n /**\n * What this identifies. Supplies both the fallback initial and the\n * accessible name, so a screen reader announces the thing rather than\n * reading a letter aloud. The initial is the name's first letter, number or\n * emoji, passing over punctuation it opens with: a handle's at sign, a\n * channel's hash or a bracket.\n */\n name: string\n /**\n * Edge length: `sm` 36px, `md` 40px, `lg` 56px. The same three Avatar uses,\n * so the two are interchangeable wherever one leads a row or a card.\n * @default 'md'\n */\n size?: 'lg' | 'md' | 'sm'\n /**\n * The mark to show in place of the initial. The initial stays until it has\n * loaded, and comes back if it fails.\n */\n src?: string\n /**\n * Which container/on-container colour pair to tint the fallback with. It is\n * the fallback's own background, so it is gone once `src` has loaded rather\n * than sitting behind the mark.\n * @default 'primary'\n */\n tone?: 'negative' | 'positive' | 'primary' | 'secondary' | 'tertiary'\n}\n\n/**\n * A small square mark identifying something that is not a person — an\n * application, a service, a brand. Reach for Avatar when it is a person.\n *\n * The mark is letterboxed rather than cropped, so a logo of any aspect ratio\n * can be handed over as it was drawn.\n *\n * When the thing's name is already written next to the mark, mark it\n * `decorative`, so a screen reader reads the name once.\n */\nfunction ProductIcon({\n size = 'md',\n tone = 'primary',\n ...props\n}: ProductIconProps) {\n return <Mark {...props} kind=\"thing\" size={size} tone={tone} />\n}\n\nexport type { ProductIconProps }\n\nexport default ProductIcon\n"],"mappings":";;;;;;;;;;;;;;;AAiFA,SAAAe,YAAAC,IAAA;CAAA,MAAAC,IAAAhB,EAAA,CAAA;CAAA,IAAAiB;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAH,EAAA,OAAAD,IAAA;EAAqB,CAAA,CAAAJ,MAAAO,IAAAL,MAAAM,IAAA,GAAAF,SAAAF;EAIFC,EAAA,KAAAD;EAAAC,EAAA,KAAAC;EAAAD,EAAA,KAAAE;EAAAF,EAAA,KAAAG;CAAA,OAAA;EAAAF,QAAAD,EAAA;EAAAE,KAAAF,EAAA;EAAAG,KAAAH,EAAA;CAAA;CAHjB,MAAAL,OAAAO,OAAAE,KAAAA,IAAA,OAAAF;CACA,MAAAL,OAAAM,OAAAC,KAAAA,IAAA,YAAAD;CAAgB,IAAAE;CAAA,IAAAL,EAAA,OAAAC,SAAAD,EAAA,OAAAL,QAAAK,EAAA,OAAAH,MAAA;EAGTQ,KAAA,oBAAC,MAAD;GAAK,GAAKJ;GAAY,MAAA;GAAcN;GAAYE;EAAI,CAAA;EAAIG,EAAA,KAAAC;EAAAD,EAAA,KAAAL;EAAAK,EAAA,KAAAH;EAAAG,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OAAxDK;AAAwD"}
|
package/dist/glyphs/index.js
CHANGED
|
@@ -277,6 +277,24 @@ function CloseGlyph(props) {
|
|
|
277
277
|
} else t1 = $[2];
|
|
278
278
|
return t1;
|
|
279
279
|
}
|
|
280
|
+
function PersonGlyph(props) {
|
|
281
|
+
const $ = c(3);
|
|
282
|
+
let t0;
|
|
283
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
284
|
+
t0 = /* @__PURE__ */ jsx("path", { d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" });
|
|
285
|
+
$[0] = t0;
|
|
286
|
+
} else t0 = $[0];
|
|
287
|
+
let t1;
|
|
288
|
+
if ($[1] !== props) {
|
|
289
|
+
t1 = /* @__PURE__ */ jsx(Glyph, {
|
|
290
|
+
...props,
|
|
291
|
+
children: t0
|
|
292
|
+
});
|
|
293
|
+
$[1] = props;
|
|
294
|
+
$[2] = t1;
|
|
295
|
+
} else t1 = $[2];
|
|
296
|
+
return t1;
|
|
297
|
+
}
|
|
280
298
|
function PlusGlyph(props) {
|
|
281
299
|
const $ = c(3);
|
|
282
300
|
let t0;
|
|
@@ -314,6 +332,6 @@ function SearchGlyph(props) {
|
|
|
314
332
|
return t1;
|
|
315
333
|
}
|
|
316
334
|
//#endregion
|
|
317
|
-
export { ArrowBackGlyph, ArrowDownwardGlyph, ArrowDropDownGlyph, ArrowUpwardGlyph, CalendarGlyph, CheckGlyph, ChevronDownGlyph, ChevronEndGlyph, ClockGlyph, CloseGlyph, IndeterminateGlyph, KeyboardGlyph, MinusGlyph, PlusGlyph, SearchGlyph };
|
|
335
|
+
export { ArrowBackGlyph, ArrowDownwardGlyph, ArrowDropDownGlyph, ArrowUpwardGlyph, CalendarGlyph, CheckGlyph, ChevronDownGlyph, ChevronEndGlyph, ClockGlyph, CloseGlyph, IndeterminateGlyph, KeyboardGlyph, MinusGlyph, PersonGlyph, PlusGlyph, SearchGlyph };
|
|
318
336
|
|
|
319
337
|
//# sourceMappingURL=index.js.map
|
package/dist/glyphs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ReactNode","SVGProps","stylex","mergeStyles","glyphStyles","GlyphProps","Omit","SVGSVGElement","ArrowBackGlyph","props","$","_c","t0","Symbol","for","t1","ArrowDownwardGlyph","ArrowDropDownGlyph","ArrowUpwardGlyph","CalendarGlyph","CheckGlyph","ClockGlyph","Glyph","children","t2","t3","t4","t5","t6","glyph","KeyboardGlyph","MinusGlyph","IndeterminateGlyph","ChevronDownGlyph","ChevronEndGlyph","CloseGlyph","PlusGlyph","SearchGlyph","_c","props","stylex.props"],"sources":["../../src/glyphs/index.tsx"],"sourcesContent":["import type { ReactNode, SVGProps } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { mergeStyles } from '../styles/merge';\nimport { glyphStyles } from './styles';\n\n// The glyphs the library's own controls draw: the check and the dash a\n// checkbox shows, the plus and minus a number field's steppers show, and\n// the magnifier and cross a search field shows. Inline SVG in\n// `currentColor`, sized by whatever renders them, and private to the\n// library — a call site with icons of its own passes them to IconButton and\n// the slots that take a node, which is why nothing here is exported from\n// the package.\n//\n// The paths are the check, the horizontal rule, the plus, the search, the\n// close, the right and down chevrons, the two sort arrows, the back arrow,\n// the drop-down arrow, the calendar, the schedule clock and the keyboard from\n// Material Symbols on their 24-unit grid, which is what the checkbox page\n// draws at 18dp, the icon buttons page at 20 and the search, menus, date\n// picker and time picker pages at 24 — the date picker's menu\n// buttons draw their arrow at 18, and a split button's menu button its\n// chevron at between 22 and 50.\n\ntype GlyphProps = Omit<SVGProps<SVGSVGElement>, 'children' | 'viewBox'>;\n\n// What a search view's back button draws, pointing at the page it returns\n// to. It says \"back\" rather than \"to the left\", so whatever renders it\n// mirrors it under a right-to-left writing mode, as ChevronEndGlyph's\n// renderers do.\nfunction ArrowBackGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z\" />\n </Glyph>;\n}\n\n// Which way a sorted column is ordered. Up is ascending and down is\n// descending, which is the direction the data tables page puts beside a\n// column header's name. Neither mirrors under a right-to-left writing mode:\n// they say \"up\" and \"down\" rather than \"onward\", and those do not flip.\nfunction ArrowDownwardGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z\" />\n </Glyph>;\n}\n\n// What a menu button draws after its label, pointing at the list it opens.\n// Down is down in either writing direction, so it does not mirror.\nfunction ArrowDropDownGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M7 10l5 5 5-5z\" />\n </Glyph>;\n}\nfunction ArrowUpwardGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z\" />\n </Glyph>;\n}\n\n// What the date picker's trigger draws: the calendar a date is picked from.\nfunction CalendarGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M19 4h-1V2h-2v2H8V2H6v2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 16H5V10h14v10zm0-12H5V6h14v2z\" />\n </Glyph>;\n}\nfunction CheckGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z\" />\n </Glyph>;\n}\n\n// What the time picker's trigger draws, and the button that takes its\n// keyboard entry back to the dial: the clock a time is picked from.\nfunction ClockGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z\" />\n </Glyph>;\n}\n\n/**\n * The svg every glyph draws: the 24-unit grid its path is on, the colour it\n * takes from the text around it, and its box. The call site's `className`\n * and `style` are merged with the glyph's own rather than replacing them.\n */\nfunction Glyph({\n children,\n ...props\n}: GlyphProps & {\n children: ReactNode;\n}) {\n return <svg aria-hidden=\"true\" fill=\"currentColor\" viewBox=\"0 0 24 24\" {...props} {...mergeStyles(stylex.props(glyphStyles.glyph), props)}>\n {children}\n </svg>;\n}\n\n// What the time picker's dial draws on the button that switches it to typed\n// entry.\nfunction KeyboardGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M20 5H4c-1.1 0-1.99.9-1.99 2L2 17c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 12H4V7h16v10zm-9-9h2v2h-2zm0 3h2v2h-2zM8 8h2v2H8zm0 3h2v2H8zm-3 0h2v2H5zm0-3h2v2H5zm3 6h8v2H8zm6-3h2v2h-2zm0-3h2v2h-2zm3 3h2v2h-2zm0-3h2v2h-2z\" />\n </Glyph>;\n}\n\n// The same rule stands for a partly selected checkbox and for a stepper's\n// decrement; the two names say which is meant at the call site.\nfunction MinusGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M19 13H5v-2h14v2z\" />\n </Glyph>;\n}\nconst IndeterminateGlyph = MinusGlyph;\n\n// Points down at the menu a split button's second half opens.\nfunction ChevronDownGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z\" />\n </Glyph>;\n}\n\n// Points at the submenu a menu item opens. It says \"further in\" rather than\n// \"to the right\", so whatever renders it mirrors it under a right-to-left\n// writing mode — the glyph itself carries no direction of its own, since a\n// transform here would be an inline style.\nfunction ChevronEndGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z\" />\n </Glyph>;\n}\nfunction CloseGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\" />\n </Glyph>;\n}\nfunction PlusGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z\" />\n </Glyph>;\n}\nfunction SearchGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z\" />\n </Glyph>;\n}\nexport { ArrowBackGlyph, ArrowDownwardGlyph, ArrowDropDownGlyph, ArrowUpwardGlyph, CalendarGlyph, CheckGlyph, ChevronDownGlyph, ChevronEndGlyph, ClockGlyph, CloseGlyph, IndeterminateGlyph, KeyboardGlyph, MinusGlyph, PlusGlyph, SearchGlyph };"],"mappings":";;;;;;AA4BA,SAAAQ,eAAAC,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAA,IAAAC;CAAA,IAAAF,EAAA,OAAAG,OAAAC,IAAA,2BAAA,GAAA;EAEMF,KAAA,oBAAA,QAAA,EAAQ,GAAA,+DAA8D,CAAA;EA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OAAAG,OAAAC,IAAA,2BAAA,GAAA;EAEMF,KAAA,oBAAA,QAAA,EAAQ,GAAA,sCAAqC,CAAA;EAAGF,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CAAA,IAAAK;CAAA,IAAAL,EAAA,OAAAD,OAAA;EAD7CM,KAAA,oBAAC,OAAD;GAAM,GAAKN;GACdG,UAAAA;EADS,CAAA;EAEHF,EAAA,KAAAD;EAAAC,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OAFHK;AAEG;AAEZ,SAAAsB,YAAA5B,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAA,IAAAC;CAAA,IAAAF,EAAA,OAAAG,OAAAC,IAAA,2BAAA,GAAA;EAEMF,KAAA,oBAAA,QAAA,EAAQ,GAAA,6MAA4M,CAAA;EAAGF,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CAAA,IAAAK;CAAA,IAAAL,EAAA,OAAAD,OAAA;EADpNM,KAAA,oBAAC,OAAD;GAAM,GAAKN;GACdG,UAAAA;EADS,CAAA;EAEHF,EAAA,KAAAD;EAAAC,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OAFHK;AAEG"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["ReactNode","SVGProps","stylex","mergeStyles","glyphStyles","GlyphProps","Omit","SVGSVGElement","ArrowBackGlyph","props","$","_c","t0","Symbol","for","t1","ArrowDownwardGlyph","ArrowDropDownGlyph","ArrowUpwardGlyph","CalendarGlyph","CheckGlyph","ClockGlyph","Glyph","children","t2","t3","t4","t5","t6","glyph","KeyboardGlyph","MinusGlyph","IndeterminateGlyph","ChevronDownGlyph","ChevronEndGlyph","CloseGlyph","PersonGlyph","PlusGlyph","SearchGlyph","_c","props","stylex.props"],"sources":["../../src/glyphs/index.tsx"],"sourcesContent":["import type { ReactNode, SVGProps } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { mergeStyles } from '../styles/merge';\nimport { glyphStyles } from './styles';\n\n// The glyphs the library's own controls draw: the check and the dash a\n// checkbox shows, the plus and minus a number field's steppers show, and\n// the magnifier and cross a search field shows. Inline SVG in\n// `currentColor`, sized by whatever renders them, and private to the\n// library — a call site with icons of its own passes them to IconButton and\n// the slots that take a node, which is why nothing here is exported from\n// the package.\n//\n// The paths are the check, the horizontal rule, the plus, the search, the\n// close, the right and down chevrons, the two sort arrows, the back arrow,\n// the drop-down arrow, the calendar, the schedule clock, the keyboard and the\n// person from\n// Material Symbols on their 24-unit grid, which is what the checkbox page\n// draws at 18dp, the icon buttons page at 20 and the search, menus, date\n// picker and time picker pages at 24 — the date picker's menu\n// buttons draw their arrow at 18, and a split button's menu button its\n// chevron at between 22 and 50.\n\ntype GlyphProps = Omit<SVGProps<SVGSVGElement>, 'children' | 'viewBox'>;\n\n// What a search view's back button draws, pointing at the page it returns\n// to. It says \"back\" rather than \"to the left\", so whatever renders it\n// mirrors it under a right-to-left writing mode, as ChevronEndGlyph's\n// renderers do.\nfunction ArrowBackGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z\" />\n </Glyph>;\n}\n\n// Which way a sorted column is ordered. Up is ascending and down is\n// descending, which is the direction the data tables page puts beside a\n// column header's name. Neither mirrors under a right-to-left writing mode:\n// they say \"up\" and \"down\" rather than \"onward\", and those do not flip.\nfunction ArrowDownwardGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z\" />\n </Glyph>;\n}\n\n// What a menu button draws after its label, pointing at the list it opens.\n// Down is down in either writing direction, so it does not mirror.\nfunction ArrowDropDownGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M7 10l5 5 5-5z\" />\n </Glyph>;\n}\nfunction ArrowUpwardGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z\" />\n </Glyph>;\n}\n\n// What the date picker's trigger draws: the calendar a date is picked from.\nfunction CalendarGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M19 4h-1V2h-2v2H8V2H6v2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 16H5V10h14v10zm0-12H5V6h14v2z\" />\n </Glyph>;\n}\nfunction CheckGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z\" />\n </Glyph>;\n}\n\n// What the time picker's trigger draws, and the button that takes its\n// keyboard entry back to the dial: the clock a time is picked from.\nfunction ClockGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z\" />\n </Glyph>;\n}\n\n/**\n * The svg every glyph draws: the 24-unit grid its path is on, the colour it\n * takes from the text around it, and its box. The call site's `className`\n * and `style` are merged with the glyph's own rather than replacing them.\n */\nfunction Glyph({\n children,\n ...props\n}: GlyphProps & {\n children: ReactNode;\n}) {\n return <svg aria-hidden=\"true\" fill=\"currentColor\" viewBox=\"0 0 24 24\" {...props} {...mergeStyles(stylex.props(glyphStyles.glyph), props)}>\n {children}\n </svg>;\n}\n\n// What the time picker's dial draws on the button that switches it to typed\n// entry.\nfunction KeyboardGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M20 5H4c-1.1 0-1.99.9-1.99 2L2 17c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 12H4V7h16v10zm-9-9h2v2h-2zm0 3h2v2h-2zM8 8h2v2H8zm0 3h2v2H8zm-3 0h2v2H5zm0-3h2v2H5zm3 6h8v2H8zm6-3h2v2h-2zm0-3h2v2h-2zm3 3h2v2h-2zm0-3h2v2h-2z\" />\n </Glyph>;\n}\n\n// The same rule stands for a partly selected checkbox and for a stepper's\n// decrement; the two names say which is meant at the call site.\nfunction MinusGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M19 13H5v-2h14v2z\" />\n </Glyph>;\n}\nconst IndeterminateGlyph = MinusGlyph;\n\n// Points down at the menu a split button's second half opens.\nfunction ChevronDownGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z\" />\n </Glyph>;\n}\n\n// Points at the submenu a menu item opens. It says \"further in\" rather than\n// \"to the right\", so whatever renders it mirrors it under a right-to-left\n// writing mode — the glyph itself carries no direction of its own, since a\n// transform here would be an inline style.\nfunction ChevronEndGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z\" />\n </Glyph>;\n}\nfunction CloseGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\" />\n </Glyph>;\n}\n\n// What an avatar with no name to take initials from draws: Material Design's\n// anonymous person, a head over shoulders.\nfunction PersonGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z\" />\n </Glyph>;\n}\nfunction PlusGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z\" />\n </Glyph>;\n}\nfunction SearchGlyph(props: GlyphProps) {\n return <Glyph {...props}>\n <path d=\"M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z\" />\n </Glyph>;\n}\nexport { ArrowBackGlyph, ArrowDownwardGlyph, ArrowDropDownGlyph, ArrowUpwardGlyph, CalendarGlyph, CheckGlyph, ChevronDownGlyph, ChevronEndGlyph, ClockGlyph, CloseGlyph, IndeterminateGlyph, KeyboardGlyph, MinusGlyph, PersonGlyph, PlusGlyph, SearchGlyph };"],"mappings":";;;;;;AA6BA,SAAAQ,eAAAC,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAA,IAAAC;CAAA,IAAAF,EAAA,OAAAG,OAAAC,IAAA,2BAAA,GAAA;EAEMF,KAAA,oBAAA,QAAA,EAAQ,GAAA,+DAA8D,CAAA;EAAGF,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CAAA,IAAAK;CAAA,IAAAL,EAAA,OAAAD,OAAA;EADtEM,KAAA,oBAAC,OAAD;GAAM,GAAKN;GACdG,UAAAA;EADS,CAAA;EAEHF,EAAA,KAAAD;EAAAC,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OAFHK;AAEG;AAOZ,SAAAC,mBAAAP,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAA,IAAAC;CAAA,IAAAF,EAAA,OAAAG,OAAAC,IAAA,2BAAA,GAAA;EAEMF,KAAA,oBAAA,QAAA,EAAQ,GAAA,iEAAgE,CAAA;EAAGF,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CAAA,IAAAK;CAAA,IAAAL,EAAA,OAAAD,OAAA;EADxEM,KAAA,oBAAC,OAAD;GAAM,GAAKN;GACdG,UAAAA;EADS,CAAA;EAEH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AL,EAAA,OAAAD,OAAA;EAD7CM,KAAA,oBAAC,OAAD;GAAM,GAAKN;GACdG,UAAAA;EADS,CAAA;EAEHF,EAAA,KAAAD;EAAAC,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OAFHK;AAEG;AAEZ,SAAAuB,YAAA7B,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAA,IAAAC;CAAA,IAAAF,EAAA,OAAAG,OAAAC,IAAA,2BAAA,GAAA;EAEMF,KAAA,oBAAA,QAAA,EAAQ,GAAA,6MAA4M,CAAA;EAAGF,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CAAA,IAAAK;CAAA,IAAAL,EAAA,OAAAD,OAAA;EADpNM,KAAA,oBAAC,OAAD;GAAM,GAAKN;GACdG,UAAAA;EADS,CAAA;EAEHF,EAAA,KAAAD;EAAAC,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OAFHK;AAEG"}
|
|
@@ -1,58 +1,69 @@
|
|
|
1
1
|
import { c } from "react/compiler-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useState } from "react";
|
|
3
3
|
//#region src/hooks/useImageLoadingStatus.ts
|
|
4
4
|
/**
|
|
5
|
-
* Whether
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* Whether the picture at `src` can be shown yet, from what the component's
|
|
6
|
+
* own `<img>` reports. The image is rendered from the start and hidden until
|
|
7
|
+
* it loads, so the browser fetches it as it would any image — `loading`,
|
|
8
|
+
* `srcSet` and `sizes` all apply, which a detached preloader started on
|
|
9
|
+
* mount left them no part in — and hand `onLoad` and `onError` to that
|
|
10
|
+
* element. A component keeps its fallback until the picture is ready and
|
|
11
|
+
* brings it back if the picture fails, so the browser's broken-image glyph
|
|
12
|
+
* is never what shows.
|
|
13
|
+
*
|
|
14
|
+
* `previous` is the picture last loaded, while a new `src` is still loading,
|
|
15
|
+
* so the component can keep showing it rather than drop back to the fallback
|
|
16
|
+
* for as long as the new one takes — a theme swapping one logo for another
|
|
17
|
+
* flashed the initial between them. It is the resource the browser actually
|
|
18
|
+
* loaded, which is cached, so an element showing it needs no `srcSet`.
|
|
10
19
|
*
|
|
11
20
|
* No `src` counts as a failure, since the outcome is the same: the fallback
|
|
12
|
-
* shows.
|
|
13
|
-
* change of `src` reads as loading
|
|
21
|
+
* shows. Outcomes are remembered against the `src` they came for, so a
|
|
22
|
+
* change of `src` reads as loading rather than as the old outcome.
|
|
14
23
|
*/
|
|
15
24
|
function useImageLoadingStatus(src) {
|
|
16
|
-
const $ = c(
|
|
17
|
-
const [
|
|
25
|
+
const $ = c(5);
|
|
26
|
+
const [loaded, setLoaded] = useState(null);
|
|
27
|
+
const [failed, setFailed] = useState(null);
|
|
18
28
|
let t0;
|
|
29
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
30
|
+
t0 = (event) => {
|
|
31
|
+
const image = event.currentTarget;
|
|
32
|
+
const from = image.getAttribute("src");
|
|
33
|
+
if (from !== null) setLoaded({
|
|
34
|
+
shown: image.currentSrc === "" ? from : image.currentSrc,
|
|
35
|
+
src: from
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
$[0] = t0;
|
|
39
|
+
} else t0 = $[0];
|
|
40
|
+
const onLoad = t0;
|
|
19
41
|
let t1;
|
|
20
|
-
if ($[
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return () => {
|
|
40
|
-
image.removeEventListener("load", onLoad);
|
|
41
|
-
image.removeEventListener("error", onError);
|
|
42
|
-
image.removeAttribute("src");
|
|
43
|
-
};
|
|
42
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
43
|
+
t1 = (event_0) => {
|
|
44
|
+
const from_0 = event_0.currentTarget.getAttribute("src");
|
|
45
|
+
if (from_0 !== null) setFailed(from_0);
|
|
46
|
+
};
|
|
47
|
+
$[1] = t1;
|
|
48
|
+
} else t1 = $[1];
|
|
49
|
+
const onError = t1;
|
|
50
|
+
let status = "loading";
|
|
51
|
+
if (src === void 0 || failed === src) status = "error";
|
|
52
|
+
else if (loaded?.src === src) status = "loaded";
|
|
53
|
+
const t2 = status === "loading" ? loaded?.shown : void 0;
|
|
54
|
+
let t3;
|
|
55
|
+
if ($[2] !== status || $[3] !== t2) {
|
|
56
|
+
t3 = {
|
|
57
|
+
onError,
|
|
58
|
+
onLoad,
|
|
59
|
+
previous: t2,
|
|
60
|
+
status
|
|
44
61
|
};
|
|
45
|
-
|
|
46
|
-
$[
|
|
47
|
-
$[
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
t0 = $[1];
|
|
51
|
-
t1 = $[2];
|
|
52
|
-
}
|
|
53
|
-
useEffect(t0, t1);
|
|
54
|
-
if (src === void 0) return "error";
|
|
55
|
-
return settled?.src === src ? settled.status : "loading";
|
|
62
|
+
$[2] = status;
|
|
63
|
+
$[3] = t2;
|
|
64
|
+
$[4] = t3;
|
|
65
|
+
} else t3 = $[4];
|
|
66
|
+
return t3;
|
|
56
67
|
}
|
|
57
68
|
//#endregion
|
|
58
69
|
export { useImageLoadingStatus };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useImageLoadingStatus.js","names":["
|
|
1
|
+
{"version":3,"file":"useImageLoadingStatus.js","names":["SyntheticEvent","useCallback","useState","ImageLoadingStatus","Loaded","shown","src","useImageLoadingStatus","$","_c","loaded","setLoaded","failed","setFailed","t0","Symbol","for","event","image","currentTarget","from","getAttribute","currentSrc","onLoad","t1","event_0","from_0","onError","status","undefined","t2","t3","previous","_c"],"sources":["../../src/hooks/useImageLoadingStatus.ts"],"sourcesContent":["import type { SyntheticEvent } from 'react'\n\nimport { useCallback, useState } from 'react'\n\ntype ImageLoadingStatus = 'error' | 'loaded' | 'loading'\n\ninterface Loaded {\n /** The resource the browser chose and loaded, out of a `srcSet` too. */\n shown: string\n /** The `src` it loaded for. */\n src: string\n}\n\n/**\n * Whether the picture at `src` can be shown yet, from what the component's\n * own `<img>` reports. The image is rendered from the start and hidden until\n * it loads, so the browser fetches it as it would any image — `loading`,\n * `srcSet` and `sizes` all apply, which a detached preloader started on\n * mount left them no part in — and hand `onLoad` and `onError` to that\n * element. A component keeps its fallback until the picture is ready and\n * brings it back if the picture fails, so the browser's broken-image glyph\n * is never what shows.\n *\n * `previous` is the picture last loaded, while a new `src` is still loading,\n * so the component can keep showing it rather than drop back to the fallback\n * for as long as the new one takes — a theme swapping one logo for another\n * flashed the initial between them. It is the resource the browser actually\n * loaded, which is cached, so an element showing it needs no `srcSet`.\n *\n * No `src` counts as a failure, since the outcome is the same: the fallback\n * shows. Outcomes are remembered against the `src` they came for, so a\n * change of `src` reads as loading rather than as the old outcome.\n */\nfunction useImageLoadingStatus(src: string | undefined) {\n const [loaded, setLoaded] = useState<Loaded | null>(null)\n const [failed, setFailed] = useState<null | string>(null)\n\n // Read off the element rather than closed over, so the one pair of\n // handlers serves whichever `src` the element carries when it settles.\n const onLoad = useCallback((event: SyntheticEvent<HTMLImageElement>) => {\n const image = event.currentTarget\n const from = image.getAttribute('src')\n if (from !== null) {\n setLoaded({\n shown: image.currentSrc === '' ? from : image.currentSrc,\n src: from,\n })\n }\n }, [])\n const onError = useCallback((event: SyntheticEvent<HTMLImageElement>) => {\n const from = event.currentTarget.getAttribute('src')\n if (from !== null) {\n setFailed(from)\n }\n }, [])\n\n let status: ImageLoadingStatus = 'loading'\n if (src === undefined || failed === src) {\n status = 'error'\n } else if (loaded?.src === src) {\n status = 'loaded'\n }\n\n return {\n onError,\n onLoad,\n previous: status === 'loading' ? loaded?.shown : undefined,\n status,\n }\n}\n\nexport type { ImageLoadingStatus }\n\nexport { useImage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
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { props } from "../node_modules/@stylexjs/stylex/lib/es/stylex.js";
|
|
2
2
|
import { useRender } from "../render/useRender.js";
|
|
3
3
|
import { mergeStyles } from "../styles/merge.js";
|
|
4
|
+
import { PersonGlyph } from "../glyphs/index.js";
|
|
4
5
|
import { useImageLoadingStatus } from "../hooks/useImageLoadingStatus.js";
|
|
5
6
|
import { initialOfThing, initialsOfPerson } from "./initials.js";
|
|
6
7
|
import { markStyles } from "./styles.js";
|
|
7
8
|
import { c } from "react/compiler-runtime";
|
|
8
|
-
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
import { useLocale } from "react-aria-components";
|
|
10
11
|
//#region src/mark/index.tsx
|
|
11
12
|
const KINDS = {
|
|
@@ -31,105 +32,144 @@ const KINDS = {
|
|
|
31
32
|
* pill.
|
|
32
33
|
*/
|
|
33
34
|
function Mark(t0) {
|
|
34
|
-
const $ = c(
|
|
35
|
-
const { kind, name, render, size, src, tone, ...props$1 } = t0;
|
|
35
|
+
const $ = c(41);
|
|
36
|
+
const { decorative: t1, imgProps, kind, name, render, showPersonIcon: t2, size, src, tone, ...props$1 } = t0;
|
|
37
|
+
const decorative = t1 === void 0 ? false : t1;
|
|
38
|
+
const showPersonIcon = t2 === void 0 ? true : t2;
|
|
36
39
|
const { fit, initials, shape, tintsFallback } = KINDS[kind];
|
|
37
|
-
const status = useImageLoadingStatus(src);
|
|
40
|
+
const { onError, onLoad, previous, status } = useImageLoadingStatus(src);
|
|
38
41
|
const { locale } = useLocale();
|
|
39
|
-
let
|
|
42
|
+
let t3;
|
|
40
43
|
if ($[0] !== initials || $[1] !== locale || $[2] !== name) {
|
|
41
|
-
|
|
44
|
+
t3 = initials(name, locale);
|
|
42
45
|
$[0] = initials;
|
|
43
46
|
$[1] = locale;
|
|
44
47
|
$[2] = name;
|
|
45
|
-
$[3] =
|
|
46
|
-
} else
|
|
47
|
-
const fallback =
|
|
48
|
-
let t2;
|
|
49
|
-
if ($[4] !== name) {
|
|
50
|
-
t2 = name.trim();
|
|
51
|
-
$[4] = name;
|
|
52
|
-
$[5] = t2;
|
|
53
|
-
} else t2 = $[5];
|
|
54
|
-
const named = t2 !== "";
|
|
55
|
-
let children;
|
|
56
|
-
if (status === "loaded") {
|
|
57
|
-
let t3;
|
|
58
|
-
if ($[6] !== fit) {
|
|
59
|
-
t3 = props(markStyles.image, fit);
|
|
60
|
-
$[6] = fit;
|
|
61
|
-
$[7] = t3;
|
|
62
|
-
} else t3 = $[7];
|
|
63
|
-
let t4;
|
|
64
|
-
if ($[8] !== src || $[9] !== t3) {
|
|
65
|
-
t4 = /* @__PURE__ */ jsx("img", {
|
|
66
|
-
alt: "",
|
|
67
|
-
src,
|
|
68
|
-
...t3
|
|
69
|
-
});
|
|
70
|
-
$[8] = src;
|
|
71
|
-
$[9] = t3;
|
|
72
|
-
$[10] = t4;
|
|
73
|
-
} else t4 = $[10];
|
|
74
|
-
children = t4;
|
|
75
|
-
} else if (tintsFallback) {
|
|
76
|
-
let t3;
|
|
77
|
-
if ($[11] !== tone) {
|
|
78
|
-
t3 = props(markStyles.fallback, markStyles[tone]);
|
|
79
|
-
$[11] = tone;
|
|
80
|
-
$[12] = t3;
|
|
81
|
-
} else t3 = $[12];
|
|
82
|
-
let t4;
|
|
83
|
-
if ($[13] !== fallback || $[14] !== t3) {
|
|
84
|
-
t4 = /* @__PURE__ */ jsx("span", {
|
|
85
|
-
...t3,
|
|
86
|
-
children: fallback
|
|
87
|
-
});
|
|
88
|
-
$[13] = fallback;
|
|
89
|
-
$[14] = t3;
|
|
90
|
-
$[15] = t4;
|
|
91
|
-
} else t4 = $[15];
|
|
92
|
-
children = t4;
|
|
93
|
-
} else children = fallback;
|
|
94
|
-
const t3 = "span";
|
|
48
|
+
$[3] = t3;
|
|
49
|
+
} else t3 = $[3];
|
|
50
|
+
const fallback = t3;
|
|
95
51
|
let t4;
|
|
96
|
-
if ($[
|
|
97
|
-
t4 =
|
|
52
|
+
if ($[4] !== decorative || $[5] !== name) {
|
|
53
|
+
t4 = !decorative && name.trim() !== "";
|
|
54
|
+
$[4] = decorative;
|
|
55
|
+
$[5] = name;
|
|
56
|
+
$[6] = t4;
|
|
57
|
+
} else t4 = $[6];
|
|
58
|
+
const named = t4;
|
|
59
|
+
const showsPicture = status === "loaded" || previous !== void 0;
|
|
60
|
+
let initialsNode = null;
|
|
61
|
+
if (!showsPicture && kind === "person" && fallback === "") {
|
|
62
|
+
let t5;
|
|
63
|
+
if ($[7] !== showPersonIcon) {
|
|
64
|
+
t5 = showPersonIcon ? /* @__PURE__ */ jsx(PersonGlyph, { ...props(markStyles.personGlyph) }) : null;
|
|
65
|
+
$[7] = showPersonIcon;
|
|
66
|
+
$[8] = t5;
|
|
67
|
+
} else t5 = $[8];
|
|
68
|
+
initialsNode = t5;
|
|
69
|
+
} else if (!showsPicture) {
|
|
70
|
+
let t5;
|
|
71
|
+
if ($[9] !== fallback || $[10] !== tintsFallback || $[11] !== tone) {
|
|
72
|
+
t5 = tintsFallback ? /* @__PURE__ */ jsx("span", {
|
|
73
|
+
...props(markStyles.fallback, markStyles[tone]),
|
|
74
|
+
children: fallback
|
|
75
|
+
}) : fallback;
|
|
76
|
+
$[9] = fallback;
|
|
77
|
+
$[10] = tintsFallback;
|
|
78
|
+
$[11] = tone;
|
|
79
|
+
$[12] = t5;
|
|
80
|
+
} else t5 = $[12];
|
|
81
|
+
initialsNode = t5;
|
|
82
|
+
}
|
|
83
|
+
let t5;
|
|
84
|
+
if ($[13] !== fit || $[14] !== previous) {
|
|
85
|
+
t5 = previous === void 0 ? null : /* @__PURE__ */ jsx("img", {
|
|
86
|
+
alt: "",
|
|
87
|
+
src: previous,
|
|
88
|
+
...props(markStyles.image, fit)
|
|
89
|
+
}, previous);
|
|
90
|
+
$[13] = fit;
|
|
91
|
+
$[14] = previous;
|
|
92
|
+
$[15] = t5;
|
|
93
|
+
} else t5 = $[15];
|
|
94
|
+
let t6;
|
|
95
|
+
if ($[16] !== fit || $[17] !== imgProps || $[18] !== onError || $[19] !== onLoad || $[20] !== src || $[21] !== status) {
|
|
96
|
+
t6 = src === void 0 || status === "error" ? null : /* @__PURE__ */ jsx("img", {
|
|
97
|
+
alt: "",
|
|
98
|
+
decoding: "async",
|
|
99
|
+
loading: "lazy",
|
|
100
|
+
...imgProps,
|
|
101
|
+
onError,
|
|
102
|
+
onLoad,
|
|
103
|
+
src,
|
|
104
|
+
...props(markStyles.image, fit, status !== "loaded" && markStyles.imagePending)
|
|
105
|
+
}, src);
|
|
106
|
+
$[16] = fit;
|
|
107
|
+
$[17] = imgProps;
|
|
108
|
+
$[18] = onError;
|
|
109
|
+
$[19] = onLoad;
|
|
110
|
+
$[20] = src;
|
|
111
|
+
$[21] = status;
|
|
112
|
+
$[22] = t6;
|
|
113
|
+
} else t6 = $[22];
|
|
114
|
+
let t7;
|
|
115
|
+
if ($[23] !== initialsNode || $[24] !== t5 || $[25] !== t6) {
|
|
116
|
+
t7 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
117
|
+
initialsNode,
|
|
118
|
+
t5,
|
|
119
|
+
t6
|
|
120
|
+
] });
|
|
121
|
+
$[23] = initialsNode;
|
|
122
|
+
$[24] = t5;
|
|
123
|
+
$[25] = t6;
|
|
124
|
+
$[26] = t7;
|
|
125
|
+
} else t7 = $[26];
|
|
126
|
+
const children = t7;
|
|
127
|
+
const t8 = "span";
|
|
128
|
+
let t9;
|
|
129
|
+
if ($[27] !== name || $[28] !== named) {
|
|
130
|
+
t9 = named ? {
|
|
98
131
|
"aria-label": name,
|
|
99
132
|
role: "img"
|
|
100
133
|
} : {};
|
|
101
|
-
$[
|
|
102
|
-
$[
|
|
103
|
-
$[
|
|
104
|
-
} else
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
134
|
+
$[27] = name;
|
|
135
|
+
$[28] = named;
|
|
136
|
+
$[29] = t9;
|
|
137
|
+
} else t9 = $[29];
|
|
138
|
+
let t10;
|
|
139
|
+
if ($[30] !== decorative) {
|
|
140
|
+
t10 = decorative ? { "aria-hidden": true } : {};
|
|
141
|
+
$[30] = decorative;
|
|
142
|
+
$[31] = t10;
|
|
143
|
+
} else t10 = $[31];
|
|
144
|
+
const t11 = mergeStyles(props(markStyles.base, shape, markStyles[size], !tintsFallback && markStyles[tone]), props$1);
|
|
145
|
+
let t12;
|
|
146
|
+
if ($[32] !== children || $[33] !== props$1 || $[34] !== t10 || $[35] !== t11 || $[36] !== t9) {
|
|
147
|
+
t12 = {
|
|
148
|
+
...t9,
|
|
149
|
+
...t10,
|
|
111
150
|
...props$1,
|
|
112
|
-
children
|
|
113
|
-
...
|
|
151
|
+
children,
|
|
152
|
+
...t11
|
|
114
153
|
};
|
|
115
|
-
$[
|
|
116
|
-
$[
|
|
117
|
-
$[
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
154
|
+
$[32] = children;
|
|
155
|
+
$[33] = props$1;
|
|
156
|
+
$[34] = t10;
|
|
157
|
+
$[35] = t11;
|
|
158
|
+
$[36] = t9;
|
|
159
|
+
$[37] = t12;
|
|
160
|
+
} else t12 = $[37];
|
|
161
|
+
let t13;
|
|
162
|
+
if ($[38] !== render || $[39] !== t12) {
|
|
163
|
+
t13 = {
|
|
164
|
+
defaultTagName: t8,
|
|
165
|
+
props: t12,
|
|
126
166
|
render
|
|
127
167
|
};
|
|
128
|
-
$[
|
|
129
|
-
$[
|
|
130
|
-
$[
|
|
131
|
-
} else
|
|
132
|
-
return useRender(
|
|
168
|
+
$[38] = render;
|
|
169
|
+
$[39] = t12;
|
|
170
|
+
$[40] = t13;
|
|
171
|
+
} else t13 = $[40];
|
|
172
|
+
return useRender(t13);
|
|
133
173
|
}
|
|
134
174
|
//#endregion
|
|
135
175
|
export { Mark as default };
|
package/dist/mark/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["stylex","useLocale","RenderComponentProps","MarkSize","MarkTone","useImageLoadingStatus","useRender","mergeStyles","initialOfThing","initialsOfPerson","markStyles","KINDS","person","fit","cover","initials","shape","circle","tintsFallback","thing","contain","square","const","MarkProps","Omit","kind","name","size","src","tone","Mark","t0","$","_c","render","props","status","locale","t1","fallback","t2","trim","named","children","t3","image","t4","role","t6","base","t7","t8","defaultTagName","_c","props","stylex.props"],"sources":["../../src/mark/index.tsx"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport { useLocale } from 'react-aria-components';\nimport type { RenderComponentProps } from '../render/useRender';\nimport type { MarkSize, MarkTone } from './styles';\nimport { useImageLoadingStatus } from '../hooks/useImageLoadingStatus';\nimport { useRender } from '../render/useRender';\nimport { mergeStyles } from '../styles/merge';\nimport { initialOfThing, initialsOfPerson } from './initials';\nimport { markStyles } from './styles';\n\n// What each kind of mark is drawn as. The header of `./styles` says why the\n// two differ where they do; everything not in this table is the same for\n// both.\nconst KINDS = {\n person: {\n fit: markStyles.cover,\n initials: initialsOfPerson,\n shape: markStyles.circle,\n tintsFallback: false\n },\n thing: {\n fit: markStyles.contain,\n initials: initialOfThing,\n shape: markStyles.square,\n tintsFallback: true\n }\n} as const;\ntype MarkProps = Omit<RenderComponentProps<'span'>, 'children'> & {\n /** A person, which Avatar draws, or anything else, which ProductIcon does. */\n kind: keyof typeof KINDS;\n /** Supplies both the fallback's initials and the accessible name. */\n name: string;\n size: MarkSize;\n /** An image to show in place of the initials once it has loaded. */\n src?: string;\n tone: MarkTone;\n};\n\n/**\n * The small identity mark Avatar and ProductIcon both render: an image once\n * it has loaded, initials until then or if it fails, named for whoever or\n * whatever it stands for. Shared rather than written into each, so a fix to\n * one reaches both. Not a component of the library's own and not exported\n * from the package; see `src/chip` for the same arrangement around a chip's\n * pill.\n */\nfunction Mark({\n kind,\n name,\n render,\n size,\n src,\n tone,\n ...props\n}: MarkProps) {\n const {\n fit,\n initials,\n shape,\n tintsFallback\n } = KINDS[kind];\n // The image is shown only once it has loaded, and the initials stay until\n // then and come back if it fails — see useImageLoadingStatus.\n const status = useImageLoadingStatus(src);\n const {\n locale\n } = useLocale();\n const fallback = initials(name, locale);\n\n // role/aria-label rather than letting the initials be read: \"AL\" is not\n // what anyone means to announce. Marking the root as an image also makes\n // its contents presentational, so the image and the initials can't be\n // announced a second time underneath the name. A span rather than an\n // <img>, which is void: this element's whole job is to hold the initials\n // shown when there is no image, or none has loaded yet.\n //\n // A blank name — one still loading, say — names nothing, so the mark is\n // then a plain element rather than an image with no name, which a screen\n // reader reads as a bare \"image\". Its empty initials, or its image with an\n // empty alt, leave it nothing to announce.\n const named = name.trim() !== '';\n let children;\n if (status === 'loaded') {\n children = <img alt=\"\" src={src} {...stylex.props(markStyles.image, fit)} />;\n } else if (tintsFallback) {\n children = <span {...stylex.props(markStyles.fallback, markStyles[tone])}>\n {fallback}\n </span>;\n } else {\n children = fallback;\n }\n return useRender({\n defaultTagName: 'span',\n props: {\n ...(named ? {\n 'aria-label': name,\n role: 'img'\n } : {}),\n ...props,\n children,\n ...mergeStyles(stylex.props(markStyles.base, shape, markStyles[size], !tintsFallback && markStyles[tone]), props)\n },\n render\n });\n}\nexport default Mark;"],"mappings":";;;;;;;;;;AAaA,MAAMW,QAAQ;CACZC,QAAQ;EACNC,KAAKH,WAAWI;EAChBC,UAAUN;EACVO,OAAON,WAAWO;EAClBC,eAAe;CACjB;CACAC,OAAO;EACLN,KAAKH,WAAWU;EAChBL,UAAUP;EACVQ,OAAON,WAAWW;EAClBH,eAAe;CACjB;AACF;;;;;;;;;AAoBA,SAAAY,KAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAc,MAAA,EAAAR,MAAAC,MAAAQ,QAAAP,MAAAC,KAAAC,MAAA,GAAAM,YAAAJ;CASZ,MAAA,EAAAlB,KAAAE,UAAAC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","PersonGlyph","useImageLoadingStatus","useRender","mergeStyles","initialOfThing","initialsOfPerson","markStyles","KINDS","person","fit","cover","initials","shape","circle","tintsFallback","thing","contain","square","const","MarkProps","decorative","imgProps","Pick","HTMLImageElement","kind","name","showPersonIcon","size","src","tone","Omit","Mark","t0","$","_c","t1","render","t2","props","undefined","onError","onLoad","previous","status","locale","t3","fallback","t4","trim","named","showsPicture","initialsNode","t5","personGlyph","image","t6","imagePending","t7","children","t8","t9","role","t10","t11","base","t12","t13","defaultTagName","_c","props","stylex.props"],"sources":["../../src/mark/index.tsx"],"sourcesContent":["import type { ImgHTMLAttributes } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { useLocale } from 'react-aria-components';\nimport type { RenderComponentProps } from '../render/useRender';\nimport type { MarkSize, MarkTone } from './styles';\nimport { PersonGlyph } from '../glyphs';\nimport { useImageLoadingStatus } from '../hooks/useImageLoadingStatus';\nimport { useRender } from '../render/useRender';\nimport { mergeStyles } from '../styles/merge';\nimport { initialOfThing, initialsOfPerson } from './initials';\nimport { markStyles } from './styles';\n\n// What each kind of mark is drawn as. The header of `./styles` says why the\n// two differ where they do; everything not in this table is the same for\n// both.\nconst KINDS = {\n person: {\n fit: markStyles.cover,\n initials: initialsOfPerson,\n shape: markStyles.circle,\n tintsFallback: false\n },\n thing: {\n fit: markStyles.contain,\n initials: initialOfThing,\n shape: markStyles.square,\n tintsFallback: true\n }\n} as const;\ntype MarkProps = {\n /**\n * Hides the mark from assistive technology, for one beside the name it\n * stands for, which would otherwise be announced twice.\n */\n decorative?: boolean | undefined;\n /** Attributes for the picture's own `<img>`, as Avatar and ProductIcon take them. */\n imgProps?: Pick<ImgHTMLAttributes<HTMLImageElement>, 'crossOrigin' | 'decoding' | 'fetchPriority' | 'loading' | 'referrerPolicy' | 'sizes' | 'srcSet'> | undefined;\n /** A person, which Avatar draws, or anything else, which ProductIcon does. */\n kind: keyof typeof KINDS;\n /** Supplies the fallback's initials, and the accessible name unless decorative. */\n name: string;\n /**\n * Whether a person with no initials to take — a blank name — draws the\n * anonymous person glyph, or an empty disc, as a loading skeleton wants.\n */\n showPersonIcon?: boolean | undefined;\n size: MarkSize;\n /** An image to show in place of the initials once it has loaded. */\n src?: string;\n tone: MarkTone;\n} & Omit<RenderComponentProps<'span'>, 'children'>;\n\n/**\n * The small identity mark Avatar and ProductIcon both render: an image once\n * it has loaded, initials until then or if it fails, named for whoever or\n * whatever it stands for. Shared rather than written into each, so a fix to\n * one reaches both. Not a component of the library's own and not exported\n * from the package; see `src/chip` for the same arrangement around a chip's\n * pill.\n */\nfunction Mark({\n decorative = false,\n imgProps,\n kind,\n name,\n render,\n showPersonIcon = true,\n size,\n src,\n tone,\n ...props\n}: MarkProps) {\n const {\n fit,\n initials,\n shape,\n tintsFallback\n } = KINDS[kind];\n // The image is rendered from the start and shown once it has loaded, and\n // the initials stay until then and come back if it fails — see\n // useImageLoadingStatus.\n const {\n onError,\n onLoad,\n previous,\n status\n } = useImageLoadingStatus(src);\n const {\n locale\n } = useLocale();\n const fallback = initials(name, locale);\n\n // role/aria-label rather than letting the initials be read: \"AL\" is not\n // what anyone means to announce. Marking the root as an image also makes\n // its contents presentational, so the image and the initials can't be\n // announced a second time underneath the name. A span rather than an\n // <img>, which is void: this element's whole job is to hold the initials\n // shown when there is no image, or none has loaded yet.\n //\n // A blank name — one still loading, say — names nothing, so the mark is\n // then a plain element rather than an image with no name, which a screen\n // reader reads as a bare \"image\". Its empty initials, or its image with an\n // empty alt, leave it nothing to announce.\n //\n // A decorative mark is hidden outright. Beside the name it stands for — a\n // list row whose headline is the person — the name came out twice, once as\n // the image and once as the text, and with no role the initials would be\n // read as bare letters instead.\n const named = !decorative && name.trim() !== '';\n\n // The initials while no picture shows: before the first loads, and once\n // one fails. They are left out under a picture rather than kept beneath\n // it, since a letterboxed logo would show them through its transparent\n // parts.\n const showsPicture = status === 'loaded' || previous !== undefined;\n let initialsNode = null;\n if (!showsPicture && kind === 'person' && fallback === '') {\n // A person with no initials to take — a blank name, one still loading —\n // draws Material Design's anonymous person in the tone's on-container\n // colour, where it drew an empty disc. Decoration: a blank name is\n // unnamed, and the glyph announces nothing either.\n initialsNode = showPersonIcon ? <PersonGlyph {...stylex.props(markStyles.personGlyph)} /> : null;\n } else if (!showsPicture) {\n initialsNode = tintsFallback ? <span {...stylex.props(markStyles.fallback, markStyles[tone])}>\n {fallback}\n </span> : fallback;\n }\n\n // Two pictures at most, laid over the initials. The one last loaded stays\n // while a new `src` loads, and the new one is rendered on top of it from\n // the start, hidden until it has loaded: lazy, so an avatar far down an\n // unvirtualised list is not fetched on mount, and decoded off the main\n // thread, both of which the call site can change through `imgProps`. The\n // last loaded one is the resource the browser chose, out of a `srcSet`\n // too, and is cached, so it needs none of those.\n const children = <>\n {initialsNode}\n {previous === undefined ? null : <img alt=\"\" key={previous} src={previous} {...stylex.props(markStyles.image, fit)} />}\n {src === undefined || status === 'error' ? null : <img alt=\"\" decoding=\"async\" key={src} loading=\"lazy\" {...imgProps} onError={onError} onLoad={onLoad} src={src} {...stylex.props(markStyles.image, fit, status !== 'loaded' && markStyles.imagePending)} />}\n </>;\n return useRender({\n defaultTagName: 'span',\n props: {\n ...(named ? {\n 'aria-label': name,\n role: 'img'\n } : {}),\n ...(decorative ? {\n 'aria-hidden': true\n } : {}),\n ...props,\n children,\n ...mergeStyles(stylex.props(markStyles.base, shape, markStyles[size], !tintsFallback && markStyles[tone]), props)\n },\n render\n });\n}\nexport default Mark;"],"mappings":";;;;;;;;;;;AAeA,MAAMa,QAAQ;CACZC,QAAQ;EACNC,KAAKH,WAAWI;EAChBC,UAAUN;EACVO,OAAON,WAAWO;EAClBC,eAAe;CACjB;CACAC,OAAO;EACLN,KAAKH,WAAWU;EAChBL,UAAUP;EACVQ,OAAON,WAAWW;EAClBH,eAAe;CACjB;AACF;;;;;;;;;AAgCA,SAAAiB,KAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAc,MAAA,EAAAd,YAAAe,IAAAd,UA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A;CAAA,IAAAiC;CAAA,IAAAjC,EAAA,QAAAG,UAAAH,EAAA,QAAAgC,KAAA;EAbcC,MAAA;GAAAC,gBACCR;GAAMrB,OACf2B;GAWN7B;EAEH;EAACH,EAAA,MAAAG;EAAAH,EAAA,MAAAgC;EAAAhC,EAAA,MAAAiC;CAAA,OAAAA,MAAAjC,EAAA;CAAA,OAfM/B,UAAUgE,GAehB;AAAC"}
|
package/dist/mark/styles.js
CHANGED
|
@@ -12,6 +12,7 @@ const markStyles = {
|
|
|
12
12
|
k63SB2: "x1bf3uqz",
|
|
13
13
|
kjj79g: "xl56j7k",
|
|
14
14
|
kVQacm: "xb3r6kr",
|
|
15
|
+
kVAEAm: "x1n2onr6",
|
|
15
16
|
kfSwDN: "x87ps6o",
|
|
16
17
|
$$css: true
|
|
17
18
|
},
|
|
@@ -37,7 +38,15 @@ const markStyles = {
|
|
|
37
38
|
},
|
|
38
39
|
image: {
|
|
39
40
|
kZKoxP: "x5yr21d",
|
|
41
|
+
kB7OPa: "x9f619",
|
|
40
42
|
kzqmXN: "xh8yej3",
|
|
43
|
+
k87sOh: "x13vifvy",
|
|
44
|
+
kLqNvP: "x1o0tod",
|
|
45
|
+
kVAEAm: "x10l6tqk",
|
|
46
|
+
$$css: true
|
|
47
|
+
},
|
|
48
|
+
imagePending: {
|
|
49
|
+
kSiTet: "xg01cxk",
|
|
41
50
|
$$css: true
|
|
42
51
|
},
|
|
43
52
|
lg: {
|
|
@@ -57,6 +66,11 @@ const markStyles = {
|
|
|
57
66
|
kMwMTN: "xylzu7l",
|
|
58
67
|
$$css: true
|
|
59
68
|
},
|
|
69
|
+
personGlyph: {
|
|
70
|
+
kZKoxP: "x39lw6i",
|
|
71
|
+
kzqmXN: "xycev2y",
|
|
72
|
+
$$css: true
|
|
73
|
+
},
|
|
60
74
|
positive: {
|
|
61
75
|
kWkggS: "xa3zu90",
|
|
62
76
|
kMwMTN: "x1di7zbg",
|
package/dist/mark/styles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","names":["stylex","colors","radii","typography","FORCED_COLORS","markStyles","base","kGNEyG","kVAM5u","ksu8eU","kMzoRj","kB7OPa","k1xSpc","kmuXW","kMv6JI","k63SB2","kjj79g","kVQacm","kfSwDN","$$css","circle","kaIpWk","contain","kVIFPx","cover","fallback","kZKoxP","kzqmXN","image","lg","kGuDYH","md","negative","kWkggS","kMwMTN","positive","primary","secondary","sm","square","tertiary","MarkSize","MarkTone"],"sources":["../../src/mark/styles.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport '../tokens/design.tokens.stylex';\nimport { colors, radii, typography } from '../tokens/design.tokens.stylex';\n\n// The box Avatar and ProductIcon draw in, shared so a person and a thing stay\n// the same three sizes in the same five tones, and so either can fill a\n// leading slot without moving what sits beside it. They differ in the two\n// ways that matter for a mark rather than a face, and those are the keys a\n// kind picks between in `./index.tsx`.\n//\n// A person is a circle with the photo cropped to fill it; a thing is a\n// rounded square with its mark letterboxed. A logo is drawn to its own\n// bounding box, so a circle crops the corners it was composed with, and\n// cropping a face loses nothing anyone minds where cropping a wordmark loses\n// the word. The cost of `contain` is letterboxing — a wide mark leaves space\n// above and below — and that is the right trade for a mark whose whole job\n// is to be recognised.\n//\n// That cost is also why a thing's tone tints the fallback rather than the\n// root. A mark letterboxed into the square does not cover it, and neither\n// does one drawn with transparency, so a tint on the root showed as a\n// coloured box around every logo that was not an opaque square. On the\n// fallback it is seen exactly when it is meant to be: while there is no\n// mark, or none has loaded. A photo covers the whole circle, so a person's\n// tone stays on the root.\n//\n// Tones are container/on-container pairs rather than one colour each, so the\n// initials are always a role's own foreground and can't end up unreadable on\n// a tint they were never paired with.\n//\n// Sizes carry their own type size but not their own weight or family: the\n// label face at medium weight holds across all three, so a large mark is\n// bigger initials rather than differently-styled ones.\n//\n// The three are the library's own rather than a spec page's — no Material\n// Design page gives a measurement for one in text; the lists page draws its\n// leading elements in a diagram and tabulates only their padding. So they are\n// stated against the scale the library already has. `md` is 40dp, which is\n// Button's and IconButton's own `md` height, so a mark and a control line up\n// in a row. `lg` is 56dp. `sm` is 36dp, between the 32dp a chip and an `xs`\n// control take and that 40dp default, for a row that wants a person smaller\n// than the button beside them.\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 markStyles = {\n base: {\n kGNEyG: \"x6s0dn4\",\n kVAM5u: \"x1w1tqly\",\n ksu8eU: \"xx61lck\",\n kMzoRj: \"x13rsnn2\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kMv6JI: \"xkknnkr\",\n k63SB2: \"x1bf3uqz\",\n kjj79g: \"xl56j7k\",\n kVQacm: \"xb3r6kr\",\n kfSwDN: \"x87ps6o\",\n $$css: true\n },\n circle: {\n kaIpWk: \"x16fbrrb\",\n $$css: true\n },\n contain: {\n kVIFPx: \"x19kjcj4\",\n $$css: true\n },\n cover: {\n kVIFPx: \"xl1xv1r\",\n $$css: true\n },\n fallback: {\n kGNEyG: \"x6s0dn4\",\n kZKoxP: \"x5yr21d\",\n k1xSpc: \"x78zum5\",\n kzqmXN: \"xh8yej3\",\n kjj79g: \"xl56j7k\",\n $$css: true\n },\n image: {\n kZKoxP: \"x5yr21d\",\n kzqmXN: \"xh8yej3\",\n $$css: true\n },\n lg: {\n kZKoxP: \"xnnlda6\",\n kGuDYH: \"x1848etk\",\n kzqmXN: \"x15yg21f\",\n $$css: true\n },\n md: {\n kZKoxP: \"x1vqgdyp\",\n kGuDYH: \"x14zspaw\",\n kzqmXN: \"x100vrsf\",\n $$css: true\n },\n negative: {\n kWkggS: \"xkz0cvf\",\n kMwMTN: \"xylzu7l\",\n $$css: true\n },\n positive: {\n kWkggS: \"xa3zu90\",\n kMwMTN: \"x1di7zbg\",\n $$css: true\n },\n primary: {\n kWkggS: \"xp89om9\",\n kMwMTN: \"xscdzaa\",\n $$css: true\n },\n secondary: {\n kWkggS: \"x15dekr4\",\n kMwMTN: \"x1sawysd\",\n $$css: true\n },\n sm: {\n kZKoxP: \"xc9qbxq\",\n kGuDYH: \"xkucv67\",\n kzqmXN: \"x14qfxbe\",\n $$css: true\n },\n square: {\n kaIpWk: \"x1xdvaa9\",\n $$css: true\n },\n tertiary: {\n kWkggS: \"xs6yvni\",\n kMwMTN: \"x3cbcwg\",\n $$css: true\n }\n};\ntype MarkSize = 'lg' | 'md' | 'sm';\ntype MarkTone = 'negative' | 'positive' | 'primary' | 'secondary' | 'tertiary';\nexport type { MarkSize, MarkTone };\nexport { markStyles };"],"mappings":";AA+CA,MAAMK,aAAa;CACjBC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,QAAQ;EACNC,QAAQ;EACRF,OAAO;CACT;CACAG,SAAS;EACPC,QAAQ;EACRJ,OAAO;CACT;CACAK,OAAO;EACLD,QAAQ;EACRJ,OAAO;CACT;CACAM,UAAU;
|
|
1
|
+
{"version":3,"file":"styles.js","names":["stylex","colors","radii","typography","FORCED_COLORS","markStyles","base","kGNEyG","kVAM5u","ksu8eU","kMzoRj","kB7OPa","k1xSpc","kmuXW","kMv6JI","k63SB2","kjj79g","kVQacm","kVAEAm","kfSwDN","$$css","circle","kaIpWk","contain","kVIFPx","cover","fallback","kZKoxP","kzqmXN","image","k87sOh","kLqNvP","imagePending","kSiTet","lg","kGuDYH","md","negative","kWkggS","kMwMTN","personGlyph","positive","primary","secondary","sm","square","tertiary","MarkSize","MarkTone"],"sources":["../../src/mark/styles.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport '../tokens/design.tokens.stylex';\nimport { colors, radii, typography } from '../tokens/design.tokens.stylex';\n\n// The box Avatar and ProductIcon draw in, shared so a person and a thing stay\n// the same three sizes in the same five tones, and so either can fill a\n// leading slot without moving what sits beside it. They differ in the two\n// ways that matter for a mark rather than a face, and those are the keys a\n// kind picks between in `./index.tsx`.\n//\n// A person is a circle with the photo cropped to fill it; a thing is a\n// rounded square with its mark letterboxed. A logo is drawn to its own\n// bounding box, so a circle crops the corners it was composed with, and\n// cropping a face loses nothing anyone minds where cropping a wordmark loses\n// the word. The cost of `contain` is letterboxing — a wide mark leaves space\n// above and below — and that is the right trade for a mark whose whole job\n// is to be recognised.\n//\n// That cost is also why a thing's tone tints the fallback rather than the\n// root. A mark letterboxed into the square does not cover it, and neither\n// does one drawn with transparency, so a tint on the root showed as a\n// coloured box around every logo that was not an opaque square. On the\n// fallback it is seen exactly when it is meant to be: while there is no\n// mark, or none has loaded. A photo covers the whole circle, so a person's\n// tone stays on the root.\n//\n// Tones are container/on-container pairs rather than one colour each, so the\n// initials are always a role's own foreground and can't end up unreadable on\n// a tint they were never paired with.\n//\n// Sizes carry their own type size but not their own weight or family: the\n// label face at medium weight holds across all three, so a large mark is\n// bigger initials rather than differently-styled ones.\n//\n// The three are the library's own rather than a spec page's — no Material\n// Design page gives a measurement for one in text; the lists page draws its\n// leading elements in a diagram and tabulates only their padding. So they are\n// stated against the scale the library already has. `md` is 40dp, which is\n// Button's and IconButton's own `md` height, so a mark and a control line up\n// in a row. `lg` is 56dp. `sm` is 36dp, between the 32dp a chip and an `xs`\n// control take and that 40dp default, for a row that wants a person smaller\n// than the button beside them.\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 markStyles = {\n base: {\n kGNEyG: \"x6s0dn4\",\n kVAM5u: \"x1w1tqly\",\n ksu8eU: \"xx61lck\",\n kMzoRj: \"x13rsnn2\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kMv6JI: \"xkknnkr\",\n k63SB2: \"x1bf3uqz\",\n kjj79g: \"xl56j7k\",\n kVQacm: \"xb3r6kr\",\n kVAEAm: \"x1n2onr6\",\n kfSwDN: \"x87ps6o\",\n $$css: true\n },\n circle: {\n kaIpWk: \"x16fbrrb\",\n $$css: true\n },\n contain: {\n kVIFPx: \"x19kjcj4\",\n $$css: true\n },\n cover: {\n kVIFPx: \"xl1xv1r\",\n $$css: true\n },\n fallback: {\n kGNEyG: \"x6s0dn4\",\n kZKoxP: \"x5yr21d\",\n k1xSpc: \"x78zum5\",\n kzqmXN: \"xh8yej3\",\n kjj79g: \"xl56j7k\",\n $$css: true\n },\n image: {\n kZKoxP: \"x5yr21d\",\n kB7OPa: \"x9f619\",\n kzqmXN: \"xh8yej3\",\n k87sOh: \"x13vifvy\",\n kLqNvP: \"x1o0tod\",\n kVAEAm: \"x10l6tqk\",\n $$css: true\n },\n imagePending: {\n kSiTet: \"xg01cxk\",\n $$css: true\n },\n lg: {\n kZKoxP: \"xnnlda6\",\n kGuDYH: \"x1848etk\",\n kzqmXN: \"x15yg21f\",\n $$css: true\n },\n md: {\n kZKoxP: \"x1vqgdyp\",\n kGuDYH: \"x14zspaw\",\n kzqmXN: \"x100vrsf\",\n $$css: true\n },\n negative: {\n kWkggS: \"xkz0cvf\",\n kMwMTN: \"xylzu7l\",\n $$css: true\n },\n personGlyph: {\n kZKoxP: \"x39lw6i\",\n kzqmXN: \"xycev2y\",\n $$css: true\n },\n positive: {\n kWkggS: \"xa3zu90\",\n kMwMTN: \"x1di7zbg\",\n $$css: true\n },\n primary: {\n kWkggS: \"xp89om9\",\n kMwMTN: \"xscdzaa\",\n $$css: true\n },\n secondary: {\n kWkggS: \"x15dekr4\",\n kMwMTN: \"x1sawysd\",\n $$css: true\n },\n sm: {\n kZKoxP: \"xc9qbxq\",\n kGuDYH: \"xkucv67\",\n kzqmXN: \"x14qfxbe\",\n $$css: true\n },\n square: {\n kaIpWk: \"x1xdvaa9\",\n $$css: true\n },\n tertiary: {\n kWkggS: \"xs6yvni\",\n kMwMTN: \"x3cbcwg\",\n $$css: true\n }\n};\ntype MarkSize = 'lg' | 'md' | 'sm';\ntype MarkTone = 'negative' | 'positive' | 'primary' | 'secondary' | 'tertiary';\nexport type { MarkSize, MarkTone };\nexport { markStyles };"],"mappings":";AA+CA,MAAMK,aAAa;CACjBC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,QAAQ;EACNC,QAAQ;EACRF,OAAO;CACT;CACAG,SAAS;EACPC,QAAQ;EACRJ,OAAO;CACT;CACAK,OAAO;EACLD,QAAQ;EACRJ,OAAO;CACT;CACAM,UAAU;EACRnB,QAAQ;EACRoB,QAAQ;EACRf,QAAQ;EACRgB,QAAQ;EACRZ,QAAQ;EACRI,OAAO;CACT;CACAS,OAAO;EACLF,QAAQ;EACRhB,QAAQ;EACRiB,QAAQ;EACRE,QAAQ;EACRC,QAAQ;EACRb,QAAQ;EACRE,OAAO;CACT;CACAY,cAAc;EACZC,QAAQ;EACRb,OAAO;CACT;CACAc,IAAI;EACFP,QAAQ;EACRQ,QAAQ;EACRP,QAAQ;EACRR,OAAO;CACT;CACAgB,IAAI;EACFT,QAAQ;EACRQ,QAAQ;EACRP,QAAQ;EACRR,OAAO;CACT;CACAiB,UAAU;EACRC,QAAQ;EACRC,QAAQ;EACRnB,OAAO;CACT;CACAoB,aAAa;EACXb,QAAQ;EACRC,QAAQ;EACRR,OAAO;CACT;CACAqB,UAAU;EACRH,QAAQ;EACRC,QAAQ;EACRnB,OAAO;CACT;CACAsB,SAAS;EACPJ,QAAQ;EACRC,QAAQ;EACRnB,OAAO;CACT;CACAuB,WAAW;EACTL,QAAQ;EACRC,QAAQ;EACRnB,OAAO;CACT;CACAwB,IAAI;EACFjB,QAAQ;EACRQ,QAAQ;EACRP,QAAQ;EACRR,OAAO;CACT;CACAyB,QAAQ;EACNvB,QAAQ;EACRF,OAAO;CACT;CACA0B,UAAU;EACRR,QAAQ;EACRC,QAAQ;EACRnB,OAAO;CACT;AACF"}
|
package/dist/styles.css
CHANGED
|
@@ -3418,6 +3418,10 @@
|
|
|
3418
3418
|
height: 56px;
|
|
3419
3419
|
}
|
|
3420
3420
|
|
|
3421
|
+
.x39lw6i {
|
|
3422
|
+
height: 60%;
|
|
3423
|
+
}
|
|
3424
|
+
|
|
3421
3425
|
.x1peatla {
|
|
3422
3426
|
height: 64px;
|
|
3423
3427
|
}
|
|
@@ -4058,6 +4062,10 @@
|
|
|
4058
4062
|
width: 56px;
|
|
4059
4063
|
}
|
|
4060
4064
|
|
|
4065
|
+
.xycev2y {
|
|
4066
|
+
width: 60%;
|
|
4067
|
+
}
|
|
4068
|
+
|
|
4061
4069
|
.x1v4s8kt {
|
|
4062
4070
|
width: 6px;
|
|
4063
4071
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanso-labs/kanso-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.1",
|
|
4
4
|
"description": "A React component library built on React Aria Components primitives and styled with StyleX, with design tokens sourced from a single W3C DTCG file and compiled via Style Dictionary",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -79,19 +79,19 @@
|
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@arethetypeswrong/cli": "0.18.5",
|
|
81
81
|
"@babel/core": "7.29.7",
|
|
82
|
-
"@chromatic-com/storybook": "5.
|
|
82
|
+
"@chromatic-com/storybook": "5.5.1",
|
|
83
83
|
"@codecov/rollup-plugin": "2.0.1",
|
|
84
84
|
"@commitlint/cli": "21.2.3",
|
|
85
85
|
"@commitlint/config-conventional": "21.2.3",
|
|
86
86
|
"@eslint/js": "10.0.1",
|
|
87
|
-
"@kanso-labs/unplugin-style-dictionary": "0.10.
|
|
87
|
+
"@kanso-labs/unplugin-style-dictionary": "0.10.26",
|
|
88
88
|
"@microsoft/api-extractor": "7.59.4",
|
|
89
89
|
"@rolldown/plugin-babel": "0.2.4",
|
|
90
|
-
"@storybook/addon-a11y": "10.6.
|
|
91
|
-
"@storybook/addon-docs": "10.6.
|
|
92
|
-
"@storybook/addon-vitest": "10.6.
|
|
93
|
-
"@storybook/builder-vite": "10.6.
|
|
94
|
-
"@storybook/react-vite": "10.6.
|
|
90
|
+
"@storybook/addon-a11y": "10.6.2",
|
|
91
|
+
"@storybook/addon-docs": "10.6.2",
|
|
92
|
+
"@storybook/addon-vitest": "10.6.2",
|
|
93
|
+
"@storybook/builder-vite": "10.6.2",
|
|
94
|
+
"@storybook/react-vite": "10.6.2",
|
|
95
95
|
"@stylexjs/stylex": "0.19.1",
|
|
96
96
|
"@stylexjs/unplugin": "0.19.1",
|
|
97
97
|
"@testing-library/dom": "10.4.2",
|
|
@@ -108,12 +108,12 @@
|
|
|
108
108
|
"eslint-plugin-perfectionist": "5.12.1",
|
|
109
109
|
"eslint-plugin-react-hooks": "7.1.1",
|
|
110
110
|
"eslint-plugin-react-refresh": "0.5.7",
|
|
111
|
-
"eslint-plugin-storybook": "10.6.
|
|
111
|
+
"eslint-plugin-storybook": "10.6.2",
|
|
112
112
|
"globals": "17.13.0",
|
|
113
113
|
"husky": "9.1.7",
|
|
114
114
|
"lightningcss": "1.33.0",
|
|
115
115
|
"lint-staged": "17.6.0",
|
|
116
|
-
"oxfmt": "0.
|
|
116
|
+
"oxfmt": "0.73.0",
|
|
117
117
|
"oxlint": "1.87.0",
|
|
118
118
|
"oxlint-tsgolint": "7.0.2004",
|
|
119
119
|
"playwright": "1.64.0",
|
|
@@ -121,11 +121,11 @@
|
|
|
121
121
|
"react": "19.3.0",
|
|
122
122
|
"react-dom": "19.3.0",
|
|
123
123
|
"rimraf": "6.1.3",
|
|
124
|
-
"storybook": "10.6.
|
|
124
|
+
"storybook": "10.6.2",
|
|
125
125
|
"style-dictionary": "5.6.1",
|
|
126
126
|
"tsdown": "0.23.1",
|
|
127
127
|
"typescript": "6.0.3",
|
|
128
|
-
"typescript-eslint": "8.71.
|
|
128
|
+
"typescript-eslint": "8.71.2",
|
|
129
129
|
"vite": "8.3.4",
|
|
130
130
|
"vitest": "4.1.11"
|
|
131
131
|
},
|