@sdxc/kit 2026.10.30 → 2026.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -0
- package/changelog.jsonl +346 -0
- package/config.schema.json +14 -0
- package/dist/ci/install.d.ts +15 -0
- package/dist/ci/install.js +27 -0
- package/dist/ci/locate.d.ts +23 -0
- package/dist/ci/locate.js +43 -0
- package/dist/cli.js +5 -0
- package/dist/commands/ci/list.d.ts +16 -0
- package/dist/commands/ci/list.js +24 -0
- package/dist/commands/ci/run.d.ts +65 -0
- package/dist/commands/ci/run.js +36 -0
- package/dist/commands/ci/signoff.d.ts +15 -0
- package/dist/commands/ci/signoff.js +15 -0
- package/dist/commands/ci/verify.d.ts +17 -0
- package/dist/commands/ci/verify.js +15 -0
- package/dist/commands/create.js +3 -0
- package/dist/commands/pkg.d.ts +16 -0
- package/dist/commands/pkg.js +71 -0
- package/dist/commands/routes.d.ts +1 -1
- package/dist/config.d.ts +10 -4
- package/dist/config.js +8 -0
- package/dist/contract.d.ts +60 -1
- package/dist/contract.js +46 -0
- package/dist/create/workspace.d.ts +15 -0
- package/dist/create/workspace.js +42 -0
- package/dist/doctor/checks.js +4 -0
- package/dist/doctor/ci.d.ts +15 -0
- package/dist/doctor/ci.js +63 -0
- package/dist/doctor/translations.d.ts +19 -0
- package/dist/doctor/translations.js +144 -0
- package/dist/make/declare.js +32 -11
- package/dist/package-manager.d.ts +2 -0
- package/dist/package-manager.js +16 -2
- package/dist/pkg/catalog.d.ts +12 -0
- package/dist/pkg/catalog.js +153 -0
- package/dist/pkg/resolve.d.ts +67 -0
- package/dist/pkg/resolve.js +147 -0
- package/dist/upgrade/changelog.d.ts +2 -2
- package/dist/upgrade/project.d.ts +2 -2
- package/package.json +10 -8
- package/registry/ui/accordion.json +2 -2
- package/registry/ui/alert-dialog.json +2 -2
- package/registry/ui/alert.json +2 -2
- package/registry/ui/aspect-ratio.json +2 -2
- package/registry/ui/avatar.json +6 -3
- package/registry/ui/badge.json +2 -2
- package/registry/ui/banner.json +16 -0
- package/registry/ui/breadcrumbs.json +2 -2
- package/registry/ui/button.json +5 -3
- package/registry/ui/calendar.json +2 -2
- package/registry/ui/card.json +2 -2
- package/registry/ui/carousel.json +2 -2
- package/registry/ui/checkbox-group.json +2 -2
- package/registry/ui/checkbox.json +2 -2
- package/registry/ui/combobox.json +2 -2
- package/registry/ui/command.json +2 -2
- package/registry/ui/confirm.json +8 -4
- package/registry/ui/cta-group.json +2 -2
- package/registry/ui/date-field.json +2 -2
- package/registry/ui/date-picker.json +2 -2
- package/registry/ui/date-range-picker.json +2 -2
- package/registry/ui/description.json +2 -2
- package/registry/ui/dialog-dismiss.json +13 -0
- package/registry/ui/dialog.json +2 -2
- package/registry/ui/disclosure.json +2 -2
- package/registry/ui/drawer.json +2 -2
- package/registry/ui/field-error.json +2 -2
- package/registry/ui/form.json +2 -2
- package/registry/ui/group.json +2 -2
- package/registry/ui/header.json +2 -2
- package/registry/ui/heading-scope.json +2 -2
- package/registry/ui/heading.json +3 -3
- package/registry/ui/highlight.json +3 -3
- package/registry/ui/hover-card.json +2 -2
- package/registry/ui/image-placeholder.json +2 -2
- package/registry/ui/input.json +2 -2
- package/registry/ui/item.json +2 -2
- package/registry/ui/keyboard.json +2 -2
- package/registry/ui/label.json +2 -2
- package/registry/ui/link-button.json +5 -3
- package/registry/ui/link.json +2 -2
- package/registry/ui/listbox.json +2 -2
- package/registry/ui/menu.json +2 -2
- package/registry/ui/meter.json +2 -2
- package/registry/ui/modal.json +2 -2
- package/registry/ui/nav-link.json +2 -2
- package/registry/ui/navigation-menu.json +2 -2
- package/registry/ui/number-field.json +2 -2
- package/registry/ui/otp-field.json +2 -2
- package/registry/ui/overlay-arrow.json +2 -2
- package/registry/ui/pagination.json +2 -2
- package/registry/ui/popover.json +2 -2
- package/registry/ui/progress-bar.json +2 -2
- package/registry/ui/property-list.json +18 -0
- package/registry/ui/radio-group.json +2 -2
- package/registry/ui/range-calendar.json +2 -2
- package/registry/ui/relative-time.json +17 -0
- package/registry/ui/scroll-area.json +2 -2
- package/registry/ui/search-field.json +2 -2
- package/registry/ui/section.json +2 -2
- package/registry/ui/select.json +2 -2
- package/registry/ui/selection-indicator.json +2 -2
- package/registry/ui/sentinel-row.json +2 -2
- package/registry/ui/separator.json +2 -2
- package/registry/ui/shared-element.json +2 -2
- package/registry/ui/sheet.json +2 -2
- package/registry/ui/sidebar.json +2 -2
- package/registry/ui/slider.json +2 -2
- package/registry/ui/spinner.json +2 -2
- package/registry/ui/status-dot.json +16 -0
- package/registry/ui/switch.json +2 -2
- package/registry/ui/tabs.json +2 -2
- package/registry/ui/tag-group.json +2 -2
- package/registry/ui/text-field.json +7 -3
- package/registry/ui/text.json +2 -2
- package/registry/ui/textarea.json +2 -2
- package/registry/ui/time-field.json +2 -2
- package/registry/ui/timeline.json +16 -0
- package/registry/ui/toggle-button.json +2 -2
- package/registry/ui/tooltip.json +2 -2
- package/registry/ui/typeset.json +2 -2
- package/registry/ui/youtube-embed.json +2 -2
- package/stubs/scaffold.controller.index.stub +1 -1
- package/templates/app/.config/sdxc/ci.ts +26 -0
- package/templates/app/.github/workflows/ci.yml +46 -0
- package/templates/app/README.md +4 -0
- package/templates/app/package.json +1 -0
- package/templates/app/public/_headers +4 -0
- package/registry/ui/attachment.json +0 -15
- package/registry/ui/bubble.json +0 -13
- package/registry/ui/chart.json +0 -13
- package/registry/ui/color-area.json +0 -13
- package/registry/ui/color-field.json +0 -20
- package/registry/ui/color-picker.json +0 -17
- package/registry/ui/color-slider.json +0 -13
- package/registry/ui/color-swatch-picker.json +0 -15
- package/registry/ui/color-swatch.json +0 -13
- package/registry/ui/color-wheel.json +0 -13
- package/registry/ui/context-menu.json +0 -16
- package/registry/ui/drop-indicator.json +0 -13
- package/registry/ui/drop-zone.json +0 -13
- package/registry/ui/empty.json +0 -15
- package/registry/ui/feature.json +0 -18
- package/registry/ui/file-trigger.json +0 -13
- package/registry/ui/grid-list.json +0 -18
- package/registry/ui/logo-cloud.json +0 -16
- package/registry/ui/marker.json +0 -13
- package/registry/ui/marketing-header.json +0 -18
- package/registry/ui/marketing-section.json +0 -16
- package/registry/ui/menubar.json +0 -13
- package/registry/ui/message-scroller.json +0 -16
- package/registry/ui/message.json +0 -13
- package/registry/ui/resizable.json +0 -13
- package/registry/ui/shortcut-list.json +0 -18
- package/registry/ui/skeleton.json +0 -13
- package/registry/ui/split.json +0 -16
- package/registry/ui/stat-strip.json +0 -16
- package/registry/ui/table.json +0 -16
- package/registry/ui/toast.json +0 -16
- package/registry/ui/toolbar.json +0 -13
- package/registry/ui/tree.json +0 -18
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "heading-scope",
|
|
3
|
-
"changedIn": "2026.
|
|
3
|
+
"changedIn": "2026.11.1",
|
|
4
4
|
"dependencies": [],
|
|
5
5
|
"exports": [
|
|
6
6
|
"HeadingLevel",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
],
|
|
12
12
|
"source": {
|
|
13
13
|
"path": "heading-scope.tsx",
|
|
14
|
-
"content": "/**\n * Establishes an ambient heading level read by nested headings and scopes,\n * keeping a document outline sequential without passing a level by hand.\n * Nesting moves one level deeper unless an explicit `level` fixes it, and\n * renders a `display: contents` host so composing it adds no layout box\n * while still exposing the depth via `data-heading-level`.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { contents } from \"@sdxc/u/layout\";\n\n/**\n * Semantic depth, from `1` (`<h1>`) through `6` (`<h6>`), shared by every\n * heading-related component's level resolution.\n */\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\n/**\n * Native tag rendered for each supported {@link HeadingLevel}, as a single\n * level-to-element lookup table.\n */\nexport const TAG_BY_LEVEL: Record<HeadingLevel, \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\"> = {\n\t1: \"h1\",\n\t2: \"h2\",\n\t3: \"h3\",\n\t4: \"h4\",\n\t5: \"h5\",\n\t6: \"h6\",\n};\n\nconst DEFAULT_LEVEL: HeadingLevel = 1;\n\n/** Deepest semantic depth the native heading elements support; a resolution past this clamps down to it. */\nconst MAX_LEVEL: HeadingLevel = 6;\n\n/**\n * Prop and context types for {@link HeadingScope}.\n */\nexport namespace HeadingScope {\n\t/** Value {@link HeadingScope} provides to descendants through context. */\n\texport interface Context {\n\t\t/** Semantic depth this scope establishes for the headings and nested scopes rendered inside it. */\n\t\tlevel: HeadingLevel;\n\t}\n\n\t/**\n\t * Native `<div>` attributes, plus `mix` and an optional `level` that\n\t * fixes this scope's depth outright, overriding the ambient\n\t * one-level-deeper default.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/**\n\t\t * Explicit semantic depth for this scope. Defaults to one level past\n\t\t * the nearest ancestor scope's depth, or `1` where no scope wraps\n\t\t * this one at all.\n\t\t */\n\t\tlevel?: HeadingLevel;\n\t}\n}\n\n/**\n * Reads the semantic depth from the nearest ancestor {@link HeadingScope},\n * always resolving safely to `undefined` when no ancestor scope exists,\n * regardless of how that absence surfaces.\n *\n * @param handle Runtime handle of the component performing the lookup.\n * @returns The nearest ancestor scope's depth, or `undefined` where nothing wraps the caller.\n * @example\n * let ambient = readAmbientLevel(handle); // 2, nested inside a HeadingScope holding level 2\n */\nexport function readAmbientLevel(handle: Handle<unknown, any>): HeadingLevel | undefined {\n\ttry {\n\t\tlet ambient = handle.context.get(HeadingScope) as HeadingScope.Context | undefined;\n\n\t\treturn ambient?.level;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/**\n * Resolves the semantic depth a heading renders at: an explicit level wins,\n * then the nearest ancestor {@link HeadingScope}'s depth, then `1`, clamped\n * to `6` with a dev-mode warning to flatten or restart the nesting.\n *\n * @param handle Runtime handle of the component resolving its depth.\n * @param explicitLevel A `level` passed directly to the component, if any.\n * @returns The resolved, clamped {@link HeadingLevel}.\n * @example\n * let level = resolveHeadingLevel(handle, handle.props.level); // an explicit level always wins\n */\nexport function resolveHeadingLevel(\n\thandle: Handle<unknown, any>,\n\texplicitLevel?: HeadingLevel,\n): HeadingLevel {\n\tlet resolved: number = explicitLevel ?? readAmbientLevel(handle) ?? DEFAULT_LEVEL;\n\n\tif (resolved > MAX_LEVEL) {\n\t\tif (import.meta.env?.DEV) {\n\t\t\tconsole.warn(\n\t\t\t\t`Heading nesting resolved to level ${resolved}, past the native \"h1\"–\"h6\" range. Flatten the nesting, or start a new top-level HeadingScope instead of nesting further.`,\n\t\t\t);\n\t\t}\n\n\t\treturn MAX_LEVEL;\n\t}\n\n\treturn resolved as HeadingLevel;\n}\n\n/**\n * Establishes an ambient heading level for descendants: an explicit `level`\n * fixes it, otherwise one level past the nearest ancestor {@link HeadingScope},\n * read before this scope publishes its own depth, or `1` with no ancestor.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props and providing {@link HeadingScope.Context} to descendants.\n * @returns The render function producing the scope's markup.\n * @example\n * <HeadingScope>\n * \t<Heading>Document title</Heading>\n * \t<HeadingScope>\n * \t\t<Heading>Section title</Heading>\n * \t</HeadingScope>\n * </HeadingScope>\n */\nexport function HeadingScope(handle: Handle<HeadingScope.Props, HeadingScope.Context>) {\n\treturn () => {\n\t\tlet { level, mix, ...rest } = handle.props;\n\t\tlet ambient = readAmbientLevel(handle);\n\t\tlet requested = level ?? (ambient === undefined ? undefined : ((ambient + 1) as HeadingLevel));\n\t\tlet resolved = resolveHeadingLevel(handle, requested);\n\n\t\thandle.context.set({ level: resolved });\n\n\t\treturn <div {...rest} data-heading-level={resolved} mix={
|
|
14
|
+
"content": "/**\n * Establishes an ambient heading level read by nested headings and scopes,\n * keeping a document outline sequential without passing a level by hand.\n * Nesting moves one level deeper unless an explicit `level` fixes it, and\n * renders a `display: contents` host so composing it adds no layout box\n * while still exposing the depth via `data-heading-level`.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { mergeMix } from \"@sdxc/u/general\";\nimport { contents } from \"@sdxc/u/layout\";\n\n/**\n * Semantic depth, from `1` (`<h1>`) through `6` (`<h6>`), shared by every\n * heading-related component's level resolution.\n */\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\n/**\n * Native tag rendered for each supported {@link HeadingLevel}, as a single\n * level-to-element lookup table.\n */\nexport const TAG_BY_LEVEL: Record<HeadingLevel, \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\"> = {\n\t1: \"h1\",\n\t2: \"h2\",\n\t3: \"h3\",\n\t4: \"h4\",\n\t5: \"h5\",\n\t6: \"h6\",\n};\n\nconst DEFAULT_LEVEL: HeadingLevel = 1;\n\n/** Deepest semantic depth the native heading elements support; a resolution past this clamps down to it. */\nconst MAX_LEVEL: HeadingLevel = 6;\n\n/**\n * Prop and context types for {@link HeadingScope}.\n */\nexport namespace HeadingScope {\n\t/** Value {@link HeadingScope} provides to descendants through context. */\n\texport interface Context {\n\t\t/** Semantic depth this scope establishes for the headings and nested scopes rendered inside it. */\n\t\tlevel: HeadingLevel;\n\t}\n\n\t/**\n\t * Native `<div>` attributes, plus `mix` and an optional `level` that\n\t * fixes this scope's depth outright, overriding the ambient\n\t * one-level-deeper default.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/**\n\t\t * Explicit semantic depth for this scope. Defaults to one level past\n\t\t * the nearest ancestor scope's depth, or `1` where no scope wraps\n\t\t * this one at all.\n\t\t */\n\t\tlevel?: HeadingLevel;\n\t}\n}\n\n/**\n * Reads the semantic depth from the nearest ancestor {@link HeadingScope},\n * always resolving safely to `undefined` when no ancestor scope exists,\n * regardless of how that absence surfaces.\n *\n * @param handle Runtime handle of the component performing the lookup.\n * @returns The nearest ancestor scope's depth, or `undefined` where nothing wraps the caller.\n * @example\n * let ambient = readAmbientLevel(handle); // 2, nested inside a HeadingScope holding level 2\n */\nexport function readAmbientLevel(handle: Handle<unknown, any>): HeadingLevel | undefined {\n\ttry {\n\t\tlet ambient = handle.context.get(HeadingScope) as HeadingScope.Context | undefined;\n\n\t\treturn ambient?.level;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/**\n * Resolves the semantic depth a heading renders at: an explicit level wins,\n * then the nearest ancestor {@link HeadingScope}'s depth, then `1`, clamped\n * to `6` with a dev-mode warning to flatten or restart the nesting.\n *\n * @param handle Runtime handle of the component resolving its depth.\n * @param explicitLevel A `level` passed directly to the component, if any.\n * @returns The resolved, clamped {@link HeadingLevel}.\n * @example\n * let level = resolveHeadingLevel(handle, handle.props.level); // an explicit level always wins\n */\nexport function resolveHeadingLevel(\n\thandle: Handle<unknown, any>,\n\texplicitLevel?: HeadingLevel,\n): HeadingLevel {\n\tlet resolved: number = explicitLevel ?? readAmbientLevel(handle) ?? DEFAULT_LEVEL;\n\n\tif (resolved > MAX_LEVEL) {\n\t\tif (import.meta.env?.DEV) {\n\t\t\tconsole.warn(\n\t\t\t\t`Heading nesting resolved to level ${resolved}, past the native \"h1\"–\"h6\" range. Flatten the nesting, or start a new top-level HeadingScope instead of nesting further.`,\n\t\t\t);\n\t\t}\n\n\t\treturn MAX_LEVEL;\n\t}\n\n\treturn resolved as HeadingLevel;\n}\n\n/**\n * Establishes an ambient heading level for descendants: an explicit `level`\n * fixes it, otherwise one level past the nearest ancestor {@link HeadingScope},\n * read before this scope publishes its own depth, or `1` with no ancestor.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props and providing {@link HeadingScope.Context} to descendants.\n * @returns The render function producing the scope's markup.\n * @example\n * <HeadingScope>\n * \t<Heading>Document title</Heading>\n * \t<HeadingScope>\n * \t\t<Heading>Section title</Heading>\n * \t</HeadingScope>\n * </HeadingScope>\n */\nexport function HeadingScope(handle: Handle<HeadingScope.Props, HeadingScope.Context>) {\n\treturn () => {\n\t\tlet { level, mix, ...rest } = handle.props;\n\t\tlet ambient = readAmbientLevel(handle);\n\t\tlet requested = level ?? (ambient === undefined ? undefined : ((ambient + 1) as HeadingLevel));\n\t\tlet resolved = resolveHeadingLevel(handle, requested);\n\n\t\thandle.context.set({ level: resolved });\n\n\t\treturn <div {...rest} data-heading-level={resolved} mix={mergeMix(contents(), mix)} />;\n\t};\n}\n"
|
|
15
15
|
},
|
|
16
16
|
"test": {
|
|
17
17
|
"path": "heading-scope.test.ts",
|
package/registry/ui/heading.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "heading",
|
|
3
|
-
"changedIn": "2026.
|
|
3
|
+
"changedIn": "2026.11.1",
|
|
4
4
|
"dependencies": [
|
|
5
5
|
"heading-scope"
|
|
6
6
|
],
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
],
|
|
10
10
|
"source": {
|
|
11
11
|
"path": "heading.tsx",
|
|
12
|
-
"content": "/**\n * A section title rendered inside the native heading element matching its\n * semantic depth — `<h1>` through `<h6>` — styled at one fixed emphasis size\n * regardless of which level it renders. An explicit `level` prop fixes the\n * depth outright; otherwise, the nearest ancestor `HeadingScope` supplies\n * it, and a heading with no scope wrapping it at all renders as `<h1>`.\n * Choosing a level changes only the document outline the element contributes to\n * assistive technology; its rendered size stays fixed, so nesting sections\n * correctly never requires a visual trade-off. Pass `size=\"display\"` or\n * `size=\"chapter\"` for
|
|
12
|
+
"content": "/**\n * A section title rendered inside the native heading element matching its\n * semantic depth — `<h1>` through `<h6>` — styled at one fixed emphasis size\n * regardless of which level it renders. An explicit `level` prop fixes the\n * depth outright; otherwise, the nearest ancestor `HeadingScope` supplies\n * it, and a heading with no scope wrapping it at all renders as `<h1>`.\n * Choosing a level changes only the document outline the element contributes to\n * assistive technology; its rendered size stays fixed, so nesting sections\n * correctly never requires a visual trade-off. Pass `size=\"display\"` or\n * `size=\"chapter\"` for landing headlines that read the `--ui-landing-*`\n * display tokens (light weight, tight tracking, near-1.0 leading).\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { fg } from \"@sdxc/u/color\";\nimport { mergeMix } from \"@sdxc/u/general\";\nimport { balance, fontSize, leading, tracking, weight } from \"@sdxc/u/typography\";\n\nimport { displayHeading } from \"@sdxc/ui/styles\";\n\nimport type { HeadingLevel } from \"@sdxc/ui/heading-scope\";\n\nimport { resolveHeadingLevel, TAG_BY_LEVEL } from \"@sdxc/ui/heading-scope\";\n\n/** Visual size {@link Heading} applies when `size` is omitted. */\nconst DEFAULT_SIZE: Heading.Size = \"default\";\n\n/**\n * Prop types for {@link Heading}.\n */\nexport namespace Heading {\n\t/**\n\t * Semantic depth, from `1` (`<h1>`) through `6` (`<h6>`), mapped to the\n\t * matching native heading element.\n\t */\n\texport type Level = HeadingLevel;\n\n\t/**\n\t * Visual size recipe: the catalog default, a page H1 display scale, or a\n\t * section chapter (~40–48px) from the landing tokens.\n\t */\n\texport type Size = \"default\" | \"display\" | \"chapter\";\n\n\t/**\n\t * Every native heading-element attribute, unchanged, plus the `mix`\n\t * passthrough and a `level` prop choosing which native element the\n\t * heading renders as.\n\t */\n\texport interface Props extends TagProps<\"h1\"> {\n\t\t/**\n\t\t * Semantic depth. Defaults to the nearest ancestor `HeadingScope`'s\n\t\t * depth, or `1` where no scope wraps this heading at all.\n\t\t */\n\t\tlevel?: Level;\n\t\t/**\n\t\t * Visual size recipe. Defaults to {@link DEFAULT_SIZE}. Landing\n\t\t * pages reach for `\"display\"` (H1) or `\"chapter\"` (section H2); app\n\t\t * chrome keeps `\"default\"`.\n\t\t */\n\t\tsize?: Size;\n\t}\n}\n\n/**\n * Renders its children inside the native heading element matching `level`.\n * The default size is semibold, tight-tracked emphasis at `lg`; `\"display\"`\n * and `\"chapter\"` swap in {@link displayHeading} so large landing titles\n * stay light-weighted.\n *\n * @param handle Runtime handle carrying the host heading element's props.\n * @returns The render function producing the heading's markup.\n * @example\n * <Heading level={1}>Page title</Heading>\n * @example\n * <Heading>Section title</Heading>\n * @example\n * <Heading size=\"chapter\">{t(\"section.title\")}</Heading>\n */\nexport function Heading(handle: Handle<Heading.Props>) {\n\treturn () => {\n\t\tlet { level, mix, size, ...rest } = handle.props;\n\t\tlet resolved = resolveHeadingLevel(handle, level);\n\t\tlet resolvedSize = size ?? DEFAULT_SIZE;\n\t\tlet Tag = TAG_BY_LEVEL[resolved];\n\t\tlet isLanding = resolvedSize === \"display\" || resolvedSize === \"chapter\";\n\n\t\treturn (\n\t\t\t<Tag\n\t\t\t\t{...rest}\n\t\t\t\tdata-heading-level={resolved}\n\t\t\t\tdata-size={resolvedSize}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tresolvedSize === \"display\" ? displayHeading(1) : [],\n\t\t\t\t\t\tresolvedSize === \"chapter\" ? displayHeading(2) : [],\n\t\t\t\t\t\tisLanding\n\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t: [\n\t\t\t\t\t\t\t\t\tweight(\"semibold\"),\n\t\t\t\t\t\t\t\t\ttracking(\"tight\"),\n\t\t\t\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\t\t\t\tfontSize(\"lg\"),\n\t\t\t\t\t\t\t\t\tleading(\"none\"),\n\t\t\t\t\t\t\t\t\tbalance(),\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t/>\n\t\t);\n\t};\n}\n"
|
|
13
13
|
},
|
|
14
14
|
"test": {
|
|
15
15
|
"path": "heading.test.tsx",
|
|
16
|
-
"content": "/**\n * Covers {@link Heading} default and
|
|
16
|
+
"content": "/**\n * Covers {@link Heading} default and landing display size recipes.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport { renderToString } from \"remix/component/server\";\nimport { describe, expect, test } from \"vitest\";\n\nimport { Heading } from \"@sdxc/ui/heading\";\n\ndescribe(\"Heading\", () => {\n\ttest(\"keeps the default catalog size\", async () => {\n\t\tlet html = await renderToString(<Heading level={2}>Section</Heading>);\n\n\t\texpect(html).toContain(\"<h2\");\n\t\texpect(html).toContain('data-size=\"default\"');\n\t\texpect(html).toContain(\"font-weight: 600\");\n\t});\n\n\ttest(\"applies display and chapter landing recipes\", async () => {\n\t\tlet display = await renderToString(<Heading size=\"display\">Hero</Heading>);\n\t\tlet chapter = await renderToString(\n\t\t\t<Heading size=\"chapter\" level={2}>\n\t\t\t\tChapter\n\t\t\t</Heading>,\n\t\t);\n\n\t\texpect(display).toContain('data-size=\"display\"');\n\t\texpect(display).toContain(\"var(--ui-landing-display-weight\");\n\t\texpect(chapter).toContain('data-size=\"chapter\"');\n\t\texpect(chapter).toContain(\"var(--ui-landing-chapter-size\");\n\t});\n});\n"
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "highlight",
|
|
3
|
-
"changedIn": "2026.
|
|
3
|
+
"changedIn": "2026.11.1",
|
|
4
4
|
"dependencies": [],
|
|
5
5
|
"exports": [
|
|
6
6
|
"Highlight"
|
|
7
7
|
],
|
|
8
8
|
"source": {
|
|
9
9
|
"path": "highlight.tsx",
|
|
10
|
-
"content": "/**\n * Text with the stretches a search matched marked: a run of `{ text, match }` segments\n * rendered as one inline `<span>`, each matched stretch a native `<mark>` tinted through a\n * semantic color role. Segments stay text nodes, so the content is escaped by construction.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport {
|
|
10
|
+
"content": "/**\n * Text with the stretches a search matched marked: a run of `{ text, match }` segments\n * rendered as one inline `<span>`, each matched stretch a native `<mark>` tinted through a\n * semantic color role. Segments stay text nodes, so the content is escaped by construction.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { fg } from \"@sdxc/u/color\";\nimport { rounded } from \"@sdxc/u/effects\";\nimport { raw, mergeMix } from \"@sdxc/u/general\";\nimport { data, when } from \"@sdxc/u/state\";\n\nimport type { SemanticColor } from \"@sdxc/ui/utils\";\n\n/** Semantic color role {@link Highlight} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: Highlight.Color = \"brand\";\n\n/**\n * Prop types for {@link Highlight}.\n */\nexport namespace Highlight {\n\t/** Semantic color role the marks are tinted with. */\n\texport type Color = SemanticColor;\n\n\t/** One stretch of the text, and whether the query matched it. */\n\texport interface Segment {\n\t\t/** The stretch exactly as written. */\n\t\ttext: string;\n\t\t/** Whether this stretch is drawn as a `<mark>`. */\n\t\tmatch: boolean;\n\t}\n\n\t/**\n\t * Every native `<span>` attribute except `children`, which the segments replace, plus\n\t * the `mix` passthrough.\n\t */\n\texport interface Props extends Omit<TagProps<\"span\">, \"children\"> {\n\t\t/** The text in order, split where the matches start and end. */\n\t\tsegments: ReadonlyArray<Segment>;\n\t\t/** Semantic color role of the marks. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t}\n}\n\n/**\n * Renders the segments inline, each match as a `<mark>` with a quiet tint behind text\n * that keeps the surrounding color and weight, so a match inside a link still reads as\n * the link. A mark broken across lines keeps its rounded tint on every fragment.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the highlighted text.\n * @example\n * <Highlight segments={[{ text: \"Remix\", match: true }, { text: \" routing\", match: false }]} />\n * @example\n * <Link href={post.href}><Highlight segments={post.title} color=\"warning\" /></Link>\n */\nexport function Highlight(handle: Handle<Highlight.Props>) {\n\treturn () => {\n\t\tlet { color, segments, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\tdata-color={color ?? DEFAULT_COLOR}\n\t\t\t\t{...rest}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\twhen(\"& > mark\", [\n\t\t\t\t\t\t\tfg(\"inherit\"),\n\t\t\t\t\t\t\trounded(\"sm\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tfontWeight: \"inherit\",\n\t\t\t\t\t\t\t\tpaddingInline: \"0.08em\",\n\t\t\t\t\t\t\t\tboxDecorationBreak: \"clone\",\n\t\t\t\t\t\t\t\tWebkitBoxDecorationBreak: \"clone\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"color\", \"brand\", when(\"& > mark\", markTint(\"brand\"))),\n\t\t\t\t\t\tdata(\"color\", \"neutral\", when(\"& > mark\", markTint(\"neutral\"))),\n\t\t\t\t\t\tdata(\"color\", \"success\", when(\"& > mark\", markTint(\"success\"))),\n\t\t\t\t\t\tdata(\"color\", \"warning\", when(\"& > mark\", markTint(\"warning\"))),\n\t\t\t\t\t\tdata(\"color\", \"danger\", when(\"& > mark\", markTint(\"danger\"))),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{segments.map((segment) => (segment.match ? <mark>{segment.text}</mark> : segment.text))}\n\t\t\t</span>\n\t\t);\n\t};\n}\n\n/**\n * The tint behind a match: the role's ink at 20%, which reads in light and dark alike\n * where the palette's own tint step fades into the page.\n */\nfunction markTint(role: Highlight.Color) {\n\treturn raw({ backgroundColor: `color-mix(in oklab, var(--ui-${role}-fg) 20%, transparent)` });\n}\n"
|
|
11
11
|
},
|
|
12
12
|
"test": {
|
|
13
13
|
"path": "highlight.test.tsx",
|
|
14
|
-
"content": "/**\n * Tests for the markup and tint {@link Highlight} renders: matches become `<mark>`, every\n * stretch stays escaped text, and the tint follows the color role.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport { renderToString } from \"remix/component/server\";\nimport { describe, expect, test } from \"vitest\";\n\nimport { Highlight } from \"@sdxc/ui/highlight\";\n\ndescribe(Highlight.name, () => {\n\ttest(\"marks exactly the matched stretches, in order\", async () => {\n\t\tlet html = await renderToString(\n\t\t\t<Highlight\n\t\t\t\tsegments={[\n\t\t\t\t\t{ text: \"Learn \", match: false },\n\t\t\t\t\t{ text: \"Remix\", match: true },\n\t\t\t\t\t{ text: \" today\", match: false },\n\t\t\t\t]}\n\t\t\t/>,\n\t\t);\n\n\t\texpect(html).toMatch(/<span data-color=\"brand\"[^>]*>Learn <mark>Remix<\\/mark> today<\\/span>/);\n\t});\n\n\ttest(\"escapes the text of every stretch\", async () => {\n\t\tlet html = await renderToString(\n\t\t\t<Highlight\n\t\t\t\tsegments={[\n\t\t\t\t\t{ text: \"<b>\", match: true },\n\t\t\t\t\t{ text: \" & co\", match: false },\n\t\t\t\t]}\n\t\t\t/>,\n\t\t);\n\n\t\texpect(html).toContain(\"<mark><b></mark> & co\");\n\t});\n\n\ttest(\"tints the marks with the color role asked for\", async () => {\n\t\tlet html = await renderToString(\n\t\t\t<Highlight color=\"warning\" segments={[{ text: \"hit\", match: true }]} />,\n\t\t);\n\n\t\texpect(html).toContain('data-color=\"warning\"');\n\t\texpect(html).toContain(\"--ui-warning-
|
|
14
|
+
"content": "/**\n * Tests for the markup and tint {@link Highlight} renders: matches become `<mark>`, every\n * stretch stays escaped text, and the tint follows the color role.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport { renderToString } from \"remix/component/server\";\nimport { describe, expect, test } from \"vitest\";\n\nimport { Highlight } from \"@sdxc/ui/highlight\";\n\ndescribe(Highlight.name, () => {\n\ttest(\"marks exactly the matched stretches, in order\", async () => {\n\t\tlet html = await renderToString(\n\t\t\t<Highlight\n\t\t\t\tsegments={[\n\t\t\t\t\t{ text: \"Learn \", match: false },\n\t\t\t\t\t{ text: \"Remix\", match: true },\n\t\t\t\t\t{ text: \" today\", match: false },\n\t\t\t\t]}\n\t\t\t/>,\n\t\t);\n\n\t\texpect(html).toMatch(/<span data-color=\"brand\"[^>]*>Learn <mark>Remix<\\/mark> today<\\/span>/);\n\t});\n\n\ttest(\"escapes the text of every stretch\", async () => {\n\t\tlet html = await renderToString(\n\t\t\t<Highlight\n\t\t\t\tsegments={[\n\t\t\t\t\t{ text: \"<b>\", match: true },\n\t\t\t\t\t{ text: \" & co\", match: false },\n\t\t\t\t]}\n\t\t\t/>,\n\t\t);\n\n\t\texpect(html).toContain(\"<mark><b></mark> & co\");\n\t});\n\n\ttest(\"tints the marks with the color role asked for\", async () => {\n\t\tlet html = await renderToString(\n\t\t\t<Highlight color=\"warning\" segments={[{ text: \"hit\", match: true }]} />,\n\t\t);\n\n\t\texpect(html).toContain('data-color=\"warning\"');\n\t\texpect(html).toContain(\"var(--ui-warning-fg) 20%\");\n\t});\n});\n"
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hover-card",
|
|
3
|
-
"changedIn": "2026.
|
|
3
|
+
"changedIn": "2026.11.1",
|
|
4
4
|
"dependencies": [],
|
|
5
5
|
"exports": [
|
|
6
6
|
"HoverCard"
|
|
7
7
|
],
|
|
8
8
|
"source": {
|
|
9
9
|
"path": "hover-card.tsx",
|
|
10
|
-
"content": "/**\n * A supplementary detail panel that appears beside a trigger on hover or\n * keyboard focus — a user card beneath an @mention, a definition beneath a\n * term. Its panel shares {@link Popover}'s rounded, bordered, shadowed\n * surface, sized narrower and padded for a compact block of text. Reveal\n * rides `:hover` and `:focus-within` on the compound root, since a\n * hover-revealed surface has no invoker to click — the hover path sits\n * behind `@media (hover: hover)` to avoid a stuck-open panel on coarse\n * pointers, while focus stays unconditional for keyboard and touch users.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { fg } from \"@sdxc/u/color\";\nimport { opacity, transition, transitionDuration, visibility } from \"@sdxc/u/effects\";\nimport { pointerEvents, raw } from \"@sdxc/u/general\";\nimport {\n\tabsolute,\n\tcontents,\n\tinlineBlock,\n\tinsBe,\n\tinsBs,\n\tinsIe,\n\tinsIs,\n\trelative,\n} from \"@sdxc/u/layout\";\nimport { media } from \"@sdxc/u/responsive\";\nimport { is, mb, mbe, mbs, marginLeft, marginRight, mi, p } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { text } from \"@sdxc/u/typography\";\n\nimport type { AnchorPlacement } from \"@sdxc/ui/utils\";\n\nimport { floatingSurface } from \"@sdxc/ui/styles\";\n\n/**\n * Side of the trigger {@link HoverCard.Content} renders against when\n * `placement` is left unset.\n */\nconst DEFAULT_PLACEMENT: HoverCard.Placement = \"bottom\";\n\n/**\n * Prop types for {@link HoverCard} and its compound parts.\n */\nexport namespace HoverCard {\n\t/**\n\t * Side of the trigger the panel renders against, and — for corner variants\n\t * — which trigger edge it aligns to on the perpendicular axis. Names a\n\t * physical viewport side, so it keeps attaching under any `dir` value.\n\t */\n\texport type Placement = AnchorPlacement;\n\n\t/**\n\t * Every native `<span>` attribute, plus the `mix` passthrough. This is\n\t * the compound root every part below nests inside — its own hover and\n\t * focus-within state is what reveals {@link HoverCard.Content}.\n\t */\n\texport interface Props extends TagProps<\"span\"> {\n\t\t/** The compound root's parts: {@link HoverCard.Trigger} followed by {@link HoverCard.Content}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link HoverCard.Trigger}.\n\t */\n\texport interface TriggerProps extends TagProps<\"span\"> {\n\t\t/**\n\t\t * The visible trigger — a link, button, or other element. The root\n\t\t * reveals {@link HoverCard.Content} whenever focus or a hover-capable\n\t\t * pointer rests inside it, so pointer users reach the panel even without a focusable child.\n\t\t */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link HoverCard.Content}.\n\t */\n\texport interface ContentProps extends TagProps<\"div\"> {\n\t\t/** Side of the trigger to render against. Defaults to {@link DEFAULT_PLACEMENT}. */\n\t\tplacement?: Placement;\n\t\t/** The panel's content. */\n\t\tchildren: RemixNode;\n\t}\n}\n\n/**\n * Renders the compound root: a `<span>` providing {@link HoverCard.Content}'s\n * anchor and the hover/focus-within scope that reveals it, so hovering or\n * focusing the trigger or panel keeps it open with no script-tracked state.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the compound root's markup.\n * @example\n * <HoverCard>\n * \t<HoverCard.Trigger>\n * \t\t<Link href={`/users/${user.handle}`}>@{user.handle}</Link>\n * \t</HoverCard.Trigger>\n * \t<HoverCard.Content aria-label={t(\"userCard.label\", { name: user.name })}>\n * \t\t<p>{user.bio}</p>\n * \t</HoverCard.Content>\n * </HoverCard>\n */\nexport function HoverCard(handle: Handle<HoverCard.Props>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\tdata-slot=\"hover-card\"\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\trelative(),\n\t\t\t\t\tinlineBlock(),\n\t\t\t\t\tmedia(\n\t\t\t\t\t\t\"(hover: hover)\",\n\t\t\t\t\t\twhen('&:hover [data-slot=\"hover-card-content\"]', [\n\t\t\t\t\t\t\topacity(100),\n\t\t\t\t\t\t\tvisibility(),\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * An open card is something the reader reaches into, so it takes the pointer.\n\t\t\t\t\t\t\t * `!important` settles it: each mix entry gets its own cascade sublayer, and the resting\n\t\t\t\t\t\t\t * state's own rule may land in a later one.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tpointerEvents: \"auto !important\",\n\t\t\t\t\t\t\t\ttransitionDelay: \"var(--ui-hover-card-open-delay, 0.4s)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t\twhen('&:focus-within [data-slot=\"hover-card-content\"]', [\n\t\t\t\t\t\topacity(100),\n\t\t\t\t\t\tvisibility(),\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\tpointerEvents: \"auto !important\",\n\t\t\t\t\t\t\ttransitionDelay: \"0s\",\n\t\t\t\t\t\t}),\n\t\t\t\t\t]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</span>\n\t\t);\n\t};\n}\n\n/**\n * Renders {@link HoverCard.TriggerProps.children} inside a `<span>` styled\n * `display: contents`, so the trigger keeps the child's own layout and\n * hover/focus-within participation, visible straight through to the root above.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the trigger's markup.\n * @example\n * <HoverCard.Trigger>\n * \t<Link href={`/users/${user.handle}`}>@{user.handle}</Link>\n * </HoverCard.Trigger>\n */\nHoverCard.Trigger = function HoverCardTrigger(handle: Handle<HoverCard.TriggerProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<span data-slot=\"hover-card-trigger\" {...rest} mix={[contents(), mix]}>\n\t\t\t\t{children}\n\t\t\t</span>\n\t\t);\n\t};\n};\n\n/**\n * Renders the panel: a `<div>` sharing {@link Popover}'s surface and placement\n * contract, kept in normal stacking order for its CSS-driven hover/focus\n * reveal, with delays tuned for pointer and keyboard users.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the panel's markup.\n * @example\n * <HoverCard.Content placement=\"bottom-start\">\n * \t<OverlayArrow placement=\"bottom-start\">\n * \t\t<svg width={12} height={12} viewBox=\"0 0 12 12\">\n * \t\t\t<path d=\"M0 0 L6 6 L12 0\" />\n * \t\t</svg>\n * \t</OverlayArrow>\n * \t<p>{user.bio}</p>\n * </HoverCard.Content>\n */\nHoverCard.Content = function HoverCardContent(handle: Handle<HoverCard.ContentProps>) {\n\treturn () => {\n\t\tlet { placement, children, mix, ...rest } = handle.props;\n\t\tlet resolvedPlacement = placement ?? DEFAULT_PLACEMENT;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tdata-slot=\"hover-card-content\"\n\t\t\t\tdata-placement={resolvedPlacement}\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\tfloatingSurface(),\n\t\t\t\t\tabsolute(),\n\t\t\t\t\tp(4),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\tis(\"18rem\"),\n\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\topacity(0),\n\t\t\t\t\ttransition(\"opacity, visibility, pointer-events\"),\n\t\t\t\t\tvisibility(\"hidden\"),\n\t\t\t\t\tpointerEvents(),\n\t\t\t\t\traw({\n\t\t\t\t\t\tzIndex: \"var(--ui-hover-card-z, 50)\",\n\t\t\t\t\t\ttransitionBehavior: \"allow-discrete\",\n\t\t\t\t\t\ttransitionDelay: \"var(--ui-hover-card-close-delay, 0.2s)\",\n\t\t\t\t\t}),\n\n\t\t\t\t\twhen('&[data-placement^=\"bottom\"]', [\n\t\t\t\t\t\tmbs(\"var(--ui-popover-offset, 0.5rem)\"),\n\t\t\t\t\t\tinsBs(\"100%\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen('&[data-placement^=\"top\"]', [\n\t\t\t\t\t\tmbe(\"var(--ui-popover-offset, 0.5rem)\"),\n\t\t\t\t\t\tinsBe(\"100%\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen('&[data-placement^=\"left\"]', [\n\t\t\t\t\t\tmarginRight(\"var(--ui-popover-offset, 0.5rem)\"),\n\t\t\t\t\t\traw({ right: \"100%\" }),\n\t\t\t\t\t]),\n\t\t\t\t\twhen('&[data-placement^=\"right\"]', [\n\t\t\t\t\t\tmarginLeft(\"var(--ui-popover-offset, 0.5rem)\"),\n\t\t\t\t\t\traw({ left: \"100%\" }),\n\t\t\t\t\t]),\n\n\t\t\t\t\t/**\n\t\t\t\t\t * The card rests off its trigger's edge, and a pointer travelling between the\n\t\t\t\t\t * two crosses that space, so the card's own hit area reaches back across it\n\t\t\t\t\t * and the pair reads as one surface for as long as the pointer is on either.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"&::before\", raw({ content: '\"\"', position: \"absolute\" })),\n\t\t\t\t\twhen(\n\t\t\t\t\t\t'&[data-placement^=\"bottom\"]::before',\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\tinsetBlockEnd: \"100%\",\n\t\t\t\t\t\t\tinsetInlineStart: \"0\",\n\t\t\t\t\t\t\tinsetInlineEnd: \"0\",\n\t\t\t\t\t\t\tblockSize: \"var(--ui-popover-offset, 0.5rem)\",\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\twhen(\n\t\t\t\t\t\t'&[data-placement^=\"top\"]::before',\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\tinsetBlockStart: \"100%\",\n\t\t\t\t\t\t\tinsetInlineStart: \"0\",\n\t\t\t\t\t\t\tinsetInlineEnd: \"0\",\n\t\t\t\t\t\t\tblockSize: \"var(--ui-popover-offset, 0.5rem)\",\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\twhen(\n\t\t\t\t\t\t'&[data-placement^=\"left\"]::before',\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\tleft: \"100%\",\n\t\t\t\t\t\t\tinsetBlockStart: \"0\",\n\t\t\t\t\t\t\tinsetBlockEnd: \"0\",\n\t\t\t\t\t\t\tinlineSize: \"var(--ui-popover-offset, 0.5rem)\",\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\twhen(\n\t\t\t\t\t\t'&[data-placement^=\"right\"]::before',\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\tright: \"100%\",\n\t\t\t\t\t\t\tinsetBlockStart: \"0\",\n\t\t\t\t\t\t\tinsetBlockEnd: \"0\",\n\t\t\t\t\t\t\tinlineSize: \"var(--ui-popover-offset, 0.5rem)\",\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\n\t\t\t\t\twhen('&[data-placement=\"bottom\"], &[data-placement=\"top\"]', [\n\t\t\t\t\t\tmi(\"auto\"),\n\t\t\t\t\t\tinsIs(\"0\"),\n\t\t\t\t\t\tinsIe(\"0\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen('&[data-placement=\"bottom-start\"], &[data-placement=\"top-start\"]', insIs(\"0\")),\n\t\t\t\t\twhen('&[data-placement=\"bottom-end\"], &[data-placement=\"top-end\"]', insIe(\"0\")),\n\t\t\t\t\twhen('&[data-placement=\"left\"], &[data-placement=\"right\"]', [\n\t\t\t\t\t\tmb(\"auto\"),\n\t\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen('&[data-placement=\"left-start\"], &[data-placement=\"right-start\"]', insBs(\"0\")),\n\t\t\t\t\twhen('&[data-placement=\"left-end\"], &[data-placement=\"right-end\"]', insBe(\"0\")),\n\n\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", [\n\t\t\t\t\t\ttransitionDuration(\"0s\"),\n\t\t\t\t\t\traw({ transitionDelay: \"0s\" }),\n\t\t\t\t\t]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n"
|
|
10
|
+
"content": "/**\n * A supplementary detail panel that appears beside a trigger on hover or\n * keyboard focus — a user card beneath an @mention, a definition beneath a\n * term. Its panel shares {@link Popover}'s rounded, bordered, shadowed\n * surface, sized narrower and padded for a compact block of text. Reveal\n * rides `:hover` and `:focus-within` on the compound root, since a\n * hover-revealed surface has no invoker to click — the hover path sits\n * behind `@media (hover: hover)` to avoid a stuck-open panel on coarse\n * pointers, while focus stays unconditional for keyboard and touch users.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { fg } from \"@sdxc/u/color\";\nimport { opacity, transition, transitionDuration, visibility } from \"@sdxc/u/effects\";\nimport { pointerEvents, raw, mergeMix } from \"@sdxc/u/general\";\nimport {\n\tabsolute,\n\tcontents,\n\tinlineBlock,\n\tinsBe,\n\tinsBs,\n\tinsIe,\n\tinsIs,\n\trelative,\n} from \"@sdxc/u/layout\";\nimport { media } from \"@sdxc/u/responsive\";\nimport { is, mb, mbe, mbs, marginLeft, marginRight, mi, p } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { text } from \"@sdxc/u/typography\";\n\nimport type { AnchorPlacement } from \"@sdxc/ui/utils\";\n\nimport { floatingSurface } from \"@sdxc/ui/styles\";\n\n/**\n * Side of the trigger {@link HoverCard.Content} renders against when\n * `placement` is left unset.\n */\nconst DEFAULT_PLACEMENT: HoverCard.Placement = \"bottom\";\n\n/**\n * Prop types for {@link HoverCard} and its compound parts.\n */\nexport namespace HoverCard {\n\t/**\n\t * Side of the trigger the panel renders against, and — for corner variants\n\t * — which trigger edge it aligns to on the perpendicular axis. Names a\n\t * physical viewport side, so it keeps attaching under any `dir` value.\n\t */\n\texport type Placement = AnchorPlacement;\n\n\t/**\n\t * Every native `<span>` attribute, plus the `mix` passthrough. This is\n\t * the compound root every part below nests inside — its own hover and\n\t * focus-within state is what reveals {@link HoverCard.Content}.\n\t */\n\texport interface Props extends TagProps<\"span\"> {\n\t\t/** The compound root's parts: {@link HoverCard.Trigger} followed by {@link HoverCard.Content}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link HoverCard.Trigger}.\n\t */\n\texport interface TriggerProps extends TagProps<\"span\"> {\n\t\t/**\n\t\t * The visible trigger — a link, button, or other element. The root\n\t\t * reveals {@link HoverCard.Content} whenever focus or a hover-capable\n\t\t * pointer rests inside it, so pointer users reach the panel even without a focusable child.\n\t\t */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link HoverCard.Content}.\n\t */\n\texport interface ContentProps extends TagProps<\"div\"> {\n\t\t/** Side of the trigger to render against. Defaults to {@link DEFAULT_PLACEMENT}. */\n\t\tplacement?: Placement;\n\t\t/** The panel's content. */\n\t\tchildren: RemixNode;\n\t}\n}\n\n/**\n * Renders the compound root: a `<span>` providing {@link HoverCard.Content}'s\n * anchor and the hover/focus-within scope that reveals it, so hovering or\n * focusing the trigger or panel keeps it open with no script-tracked state.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the compound root's markup.\n * @example\n * <HoverCard>\n * \t<HoverCard.Trigger>\n * \t\t<Link href={`/users/${user.handle}`}>@{user.handle}</Link>\n * \t</HoverCard.Trigger>\n * \t<HoverCard.Content aria-label={t(\"userCard.label\", { name: user.name })}>\n * \t\t<p>{user.bio}</p>\n * \t</HoverCard.Content>\n * </HoverCard>\n */\nexport function HoverCard(handle: Handle<HoverCard.Props>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\tdata-slot=\"hover-card\"\n\t\t\t\t{...rest}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\trelative(),\n\t\t\t\t\t\tinlineBlock(),\n\t\t\t\t\t\tmedia(\n\t\t\t\t\t\t\t\"(hover: hover)\",\n\t\t\t\t\t\t\twhen('&:hover [data-slot=\"hover-card-content\"]', [\n\t\t\t\t\t\t\t\topacity(100),\n\t\t\t\t\t\t\t\tvisibility(),\n\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t * An open card is something the reader reaches into, so it takes the pointer.\n\t\t\t\t\t\t\t\t * `!important` settles it: each mix entry gets its own cascade sublayer, and the resting\n\t\t\t\t\t\t\t\t * state's own rule may land in a later one.\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\t\tpointerEvents: \"auto !important\",\n\t\t\t\t\t\t\t\t\ttransitionDelay: \"var(--ui-hover-card-open-delay, 0.4s)\",\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen('&:focus-within [data-slot=\"hover-card-content\"]', [\n\t\t\t\t\t\t\topacity(100),\n\t\t\t\t\t\t\tvisibility(),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tpointerEvents: \"auto !important\",\n\t\t\t\t\t\t\t\ttransitionDelay: \"0s\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t]),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</span>\n\t\t);\n\t};\n}\n\n/**\n * Renders {@link HoverCard.TriggerProps.children} inside a `<span>` styled\n * `display: contents`, so the trigger keeps the child's own layout and\n * hover/focus-within participation, visible straight through to the root above.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the trigger's markup.\n * @example\n * <HoverCard.Trigger>\n * \t<Link href={`/users/${user.handle}`}>@{user.handle}</Link>\n * </HoverCard.Trigger>\n */\nHoverCard.Trigger = function HoverCardTrigger(handle: Handle<HoverCard.TriggerProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<span data-slot=\"hover-card-trigger\" {...rest} mix={mergeMix(contents(), mix)}>\n\t\t\t\t{children}\n\t\t\t</span>\n\t\t);\n\t};\n};\n\n/**\n * Renders the panel: a `<div>` sharing {@link Popover}'s surface and placement\n * contract, kept in normal stacking order for its CSS-driven hover/focus\n * reveal, with delays tuned for pointer and keyboard users.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the panel's markup.\n * @example\n * <HoverCard.Content placement=\"bottom-start\">\n * \t<OverlayArrow placement=\"bottom-start\">\n * \t\t<svg width={12} height={12} viewBox=\"0 0 12 12\">\n * \t\t\t<path d=\"M0 0 L6 6 L12 0\" />\n * \t\t</svg>\n * \t</OverlayArrow>\n * \t<p>{user.bio}</p>\n * </HoverCard.Content>\n */\nHoverCard.Content = function HoverCardContent(handle: Handle<HoverCard.ContentProps>) {\n\treturn () => {\n\t\tlet { placement, children, mix, ...rest } = handle.props;\n\t\tlet resolvedPlacement = placement ?? DEFAULT_PLACEMENT;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tdata-slot=\"hover-card-content\"\n\t\t\t\tdata-placement={resolvedPlacement}\n\t\t\t\t{...rest}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tfloatingSurface(),\n\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\tp(4),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\tis(\"18rem\"),\n\t\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t\topacity(0),\n\t\t\t\t\t\ttransition(\"opacity, visibility, pointer-events\"),\n\t\t\t\t\t\tvisibility(\"hidden\"),\n\t\t\t\t\t\tpointerEvents(),\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\tzIndex: \"var(--ui-hover-card-z, 50)\",\n\t\t\t\t\t\t\ttransitionBehavior: \"allow-discrete\",\n\t\t\t\t\t\t\ttransitionDelay: \"var(--ui-hover-card-close-delay, 0.2s)\",\n\t\t\t\t\t\t}),\n\n\t\t\t\t\t\twhen('&[data-placement^=\"bottom\"]', [\n\t\t\t\t\t\t\tmbs(\"var(--ui-popover-offset, 0.5rem)\"),\n\t\t\t\t\t\t\tinsBs(\"100%\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-placement^=\"top\"]', [\n\t\t\t\t\t\t\tmbe(\"var(--ui-popover-offset, 0.5rem)\"),\n\t\t\t\t\t\t\tinsBe(\"100%\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-placement^=\"left\"]', [\n\t\t\t\t\t\t\tmarginRight(\"var(--ui-popover-offset, 0.5rem)\"),\n\t\t\t\t\t\t\traw({ right: \"100%\" }),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-placement^=\"right\"]', [\n\t\t\t\t\t\t\tmarginLeft(\"var(--ui-popover-offset, 0.5rem)\"),\n\t\t\t\t\t\t\traw({ left: \"100%\" }),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The card rests off its trigger's edge, and a pointer travelling between the\n\t\t\t\t\t\t * two crosses that space, so the card's own hit area reaches back across it\n\t\t\t\t\t\t * and the pair reads as one surface for as long as the pointer is on either.\n\t\t\t\t\t\t */\n\t\t\t\t\t\twhen(\"&::before\", raw({ content: '\"\"', position: \"absolute\" })),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t'&[data-placement^=\"bottom\"]::before',\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tinsetBlockEnd: \"100%\",\n\t\t\t\t\t\t\t\tinsetInlineStart: \"0\",\n\t\t\t\t\t\t\t\tinsetInlineEnd: \"0\",\n\t\t\t\t\t\t\t\tblockSize: \"var(--ui-popover-offset, 0.5rem)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t'&[data-placement^=\"top\"]::before',\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tinsetBlockStart: \"100%\",\n\t\t\t\t\t\t\t\tinsetInlineStart: \"0\",\n\t\t\t\t\t\t\t\tinsetInlineEnd: \"0\",\n\t\t\t\t\t\t\t\tblockSize: \"var(--ui-popover-offset, 0.5rem)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t'&[data-placement^=\"left\"]::before',\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tleft: \"100%\",\n\t\t\t\t\t\t\t\tinsetBlockStart: \"0\",\n\t\t\t\t\t\t\t\tinsetBlockEnd: \"0\",\n\t\t\t\t\t\t\t\tinlineSize: \"var(--ui-popover-offset, 0.5rem)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t'&[data-placement^=\"right\"]::before',\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tright: \"100%\",\n\t\t\t\t\t\t\t\tinsetBlockStart: \"0\",\n\t\t\t\t\t\t\t\tinsetBlockEnd: \"0\",\n\t\t\t\t\t\t\t\tinlineSize: \"var(--ui-popover-offset, 0.5rem)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\n\t\t\t\t\t\twhen('&[data-placement=\"bottom\"], &[data-placement=\"top\"]', [\n\t\t\t\t\t\t\tmi(\"auto\"),\n\t\t\t\t\t\t\tinsIs(\"0\"),\n\t\t\t\t\t\t\tinsIe(\"0\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-placement=\"bottom-start\"], &[data-placement=\"top-start\"]', insIs(\"0\")),\n\t\t\t\t\t\twhen('&[data-placement=\"bottom-end\"], &[data-placement=\"top-end\"]', insIe(\"0\")),\n\t\t\t\t\t\twhen('&[data-placement=\"left\"], &[data-placement=\"right\"]', [\n\t\t\t\t\t\t\tmb(\"auto\"),\n\t\t\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[data-placement=\"left-start\"], &[data-placement=\"right-start\"]', insBs(\"0\")),\n\t\t\t\t\t\twhen('&[data-placement=\"left-end\"], &[data-placement=\"right-end\"]', insBe(\"0\")),\n\n\t\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", [\n\t\t\t\t\t\t\ttransitionDuration(\"0s\"),\n\t\t\t\t\t\t\traw({ transitionDelay: \"0s\" }),\n\t\t\t\t\t\t]),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n"
|
|
11
11
|
},
|
|
12
12
|
"test": null
|
|
13
13
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "image-placeholder",
|
|
3
|
-
"changedIn": "2026.
|
|
3
|
+
"changedIn": "2026.11.1",
|
|
4
4
|
"dependencies": [],
|
|
5
5
|
"exports": [
|
|
6
6
|
"ImagePlaceholder"
|
|
7
7
|
],
|
|
8
8
|
"source": {
|
|
9
9
|
"path": "image-placeholder.tsx",
|
|
10
|
-
"content": "/**\n * The shared foundation for a fixed-size image-with-fallback box — a user\n * avatar, a brand logo, or any other picture that needs a graceful stand-in\n * before it loads or when it's missing. It renders a sized, shaped host that\n * an image and a fallback layer both stack into, plus a corner status badge\n * and a group of overlapping instances with a trailing overflow count.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { ringShadow, rounded, visibility } from \"@sdxc/u/effects\";\nimport { userSelect } from \"@sdxc/u/general\";\nimport {\n\tabsolute,\n\tcenter,\n\tflex,\n\tinlineFlex,\n\tinsBe,\n\tinsIe,\n\tinset,\n\titems,\n\tjustify,\n\trelative,\n\tshrink,\n} from \"@sdxc/u/layout\";\nimport { overflow } from \"@sdxc/u/overflow\";\nimport { bs, fit, is, mis } from \"@sdxc/u/size\";\nimport { data, precededBy, when } from \"@sdxc/u/state\";\nimport { tabularNums, text, textTransform, weight } from \"@sdxc/u/typography\";\n\n/** Size variant {@link ImagePlaceholder} falls back to when `size` is omitted. */\nconst DEFAULT_SIZE: ImagePlaceholder.Size = \"md\";\n\n/**\n * Shape variant {@link ImagePlaceholder} and {@link ImagePlaceholder.GroupCount}\n * fall back to when `shape` is omitted.\n */\nconst DEFAULT_SHAPE: ImagePlaceholder.Shape = \"circle\";\n\n/**\n * The inset hairline {@link ImagePlaceholder.Image} draws over a picture's\n * edge, read from the theme's `--ui-image-outline`, which flips for dark mode.\n */\nconst IMAGE_OUTLINE = \"var(--ui-image-outline, rgb(0 0 0 / 0.1))\";\n\n/**\n * Prop types for {@link ImagePlaceholder} and its compound parts.\n */\nexport namespace ImagePlaceholder {\n\t/**\n\t * Size variant controlling the host's rendered dimensions and, through\n\t * ordinary inheritance, the fallback initials' font size.\n\t */\n\texport type Size = \"sm\" | \"md\" | \"lg\";\n\n\t/**\n\t * Shape variant controlling the corner rounding of the host, its image,\n\t * and its fallback layer: `\"circle\"` renders a fully rounded disc, and\n\t * `\"square\"` renders a softly rounded square.\n\t */\n\texport type Shape = \"circle\" | \"square\";\n\n\t/**\n\t * Props accepted by {@link ImagePlaceholder}.\n\t */\n\texport interface Props extends TagProps<\"span\"> {\n\t\t/** Size variant. Defaults to {@link DEFAULT_SIZE}. */\n\t\tsize?: Size;\n\t\t/** Shape variant. Defaults to {@link DEFAULT_SHAPE}. */\n\t\tshape?: Shape;\n\t\t/** The host's compound parts: {@link ImagePlaceholder.Image}, {@link ImagePlaceholder.Fallback}, and an optional {@link ImagePlaceholder.Badge}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link ImagePlaceholder.Image}.\n\t */\n\texport interface ImageProps extends Omit<\n\t\tTagProps<\"img\">,\n\t\t\"src\" | \"alt\" | \"role\" | \"aria-label\" | \"aria-labelledby\" | \"title\"\n\t> {\n\t\t/** Image source URL. */\n\t\tsrc: string;\n\t\t/**\n\t\t * Accessible text description of the image. Required, since a\n\t\t * consumer's own localized description drives what assistive\n\t\t * technology announces.\n\t\t */\n\t\talt: string;\n\t}\n\n\t/**\n\t * Props accepted by {@link ImagePlaceholder.Fallback}.\n\t */\n\texport interface FallbackProps extends TagProps<\"span\"> {\n\t\t/** Fallback content, typically the subject's initials. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link ImagePlaceholder.Badge}.\n\t */\n\texport interface BadgeProps extends TagProps<\"span\"> {}\n\n\t/**\n\t * Props accepted by {@link ImagePlaceholder.Group}.\n\t */\n\texport interface GroupProps extends TagProps<\"div\"> {\n\t\t/** A run of {@link ImagePlaceholder} instances, optionally trailed by {@link ImagePlaceholder.GroupCount}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link ImagePlaceholder.GroupCount}.\n\t */\n\texport interface GroupCountProps extends TagProps<\"span\"> {\n\t\t/** Shape variant, matching the shape of the sibling placeholders it trails. Defaults to {@link DEFAULT_SHAPE}. */\n\t\tshape?: Shape;\n\t\t/** The overflow count text, e.g. `\"+3\"`. */\n\t\tchildren: RemixNode;\n\t}\n}\n\n/**\n * Renders the placeholder host: a fixed-size, centered box whose `data-shape`\n * attribute styles it, its image, and its fallback together, leaving room\n * for {@link ImagePlaceholder.Badge} to sit unclipped on the corner.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the placeholder's markup.\n * @example\n * <ImagePlaceholder>\n * \t<ImagePlaceholder.Image src={user.avatarUrl} alt={user.name} />\n * \t<ImagePlaceholder.Fallback>{initials}</ImagePlaceholder.Fallback>\n * </ImagePlaceholder>\n * @example\n * <ImagePlaceholder size=\"lg\" shape=\"square\">\n * \t<ImagePlaceholder.Image src={org.logoUrl} alt={org.name} />\n * \t<ImagePlaceholder.Badge />\n * </ImagePlaceholder>\n */\nexport function ImagePlaceholder(handle: Handle<ImagePlaceholder.Props>) {\n\treturn () => {\n\t\tlet { size, shape, children, mix, ...rest } = handle.props;\n\t\tlet resolvedSize = size ?? DEFAULT_SIZE;\n\t\tlet resolvedShape = shape ?? DEFAULT_SHAPE;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"image-placeholder\"\n\t\t\t\tdata-size={resolvedSize}\n\t\t\t\tdata-shape={resolvedShape}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\trelative(),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\tshrink(),\n\t\t\t\t\tuserSelect(),\n\t\t\t\t\tis(\"var(--ui-image-placeholder-size-md, 2.5rem)\"),\n\t\t\t\t\tbs(\"var(--ui-image-placeholder-size-md, 2.5rem)\"),\n\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\tdata(\"size\", \"sm\", [\n\t\t\t\t\t\tis(\"var(--ui-image-placeholder-size-sm, 2rem)\"),\n\t\t\t\t\t\tbs(\"var(--ui-image-placeholder-size-sm, 2rem)\"),\n\t\t\t\t\t\ttext(\"xs\"),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"size\", \"lg\", [\n\t\t\t\t\t\tis(\"var(--ui-image-placeholder-size-lg, 3rem)\"),\n\t\t\t\t\t\tbs(\"var(--ui-image-placeholder-size-lg, 3rem)\"),\n\t\t\t\t\t\ttext(\"base\"),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"shape\", \"circle\", [\n\t\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\t\twhen('& > [data-slot=\"image\"]', rounded(\"full\")),\n\t\t\t\t\t\twhen('& > [data-slot=\"fallback\"]', rounded(\"full\")),\n\t\t\t\t\t]),\n\t\t\t\t\tdata(\"shape\", \"square\", [\n\t\t\t\t\t\trounded(\"lg\"),\n\t\t\t\t\t\twhen('& > [data-slot=\"image\"]', rounded(\"lg\")),\n\t\t\t\t\t\twhen('& > [data-slot=\"fallback\"]', rounded(\"lg\")),\n\t\t\t\t\t]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</span>\n\t\t);\n\t};\n}\n\n/**\n * Renders the placeholder's image layer: an `<img>` cropped to cover, clipped to\n * {@link ImagePlaceholder}'s `data-shape`, its inset hairline holding the edge on\n * a same-tone background. Its order against {@link ImagePlaceholder.Fallback} decides what shows.\n *\n * @param handle Runtime handle carrying the host `<img>`'s props.\n * @returns The render function producing the image layer's markup.\n * @example\n * <ImagePlaceholder.Image src={user.avatarUrl} alt={user.name} />\n */\nImagePlaceholder.Image = function ImagePlaceholderImage(\n\thandle: Handle<ImagePlaceholder.ImageProps>,\n) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<img\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"image\"\n\t\t\t\tmix={[\n\t\t\t\t\tabsolute(),\n\t\t\t\t\tis(\"full\"),\n\t\t\t\t\tbs(\"full\"),\n\t\t\t\t\tfit(\"cover\"),\n\t\t\t\t\tinset(0, 0, 0, 0),\n\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\toutline({ color: IMAGE_OUTLINE, width: 1, offset: -1 }),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders the placeholder's fallback layer: a `<span>` centering a consumer's\n * content in uppercase text. Font size inherits {@link ImagePlaceholder}'s\n * `data-size` via CSS, keeping initials proportional at every size.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the fallback layer's markup.\n * @example\n * <ImagePlaceholder.Fallback>{initials}</ImagePlaceholder.Fallback>\n */\nImagePlaceholder.Fallback = function ImagePlaceholderFallback(\n\thandle: Handle<ImagePlaceholder.FallbackProps>,\n) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"fallback\"\n\t\t\t\tmix={[\n\t\t\t\t\t/**\n\t\t\t\t\t * Both layers fill the host and this one follows the image, so it hides while an unbroken\n\t\t\t\t\t * image is present and takes over once the image fails. It hides through `visibility`,\n\t\t\t\t\t * which no other rule here sets, so declaration order keeps it hidden.\n\t\t\t\t\t */\n\t\t\t\t\tprecededBy('img[data-slot=\"image\"]:not([data-image-error])', visibility(\"hidden\")),\n\t\t\t\t\tabsolute(),\n\t\t\t\t\tcenter(),\n\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\tbg(\"neutral.bg-tint-pressed\"),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\tinset(0, 0, 0, 0),\n\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\ttextTransform(\"uppercase\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</span>\n\t\t);\n\t};\n};\n\n/**\n * Renders a small status dot pinned to the host's block-end/inline-end\n * corner, always fully rounded regardless of {@link ImagePlaceholder}'s own\n * shape, and ringed to read as cut from whatever sits beneath it.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the badge's markup.\n * @example\n * <ImagePlaceholder.Badge />\n */\nImagePlaceholder.Badge = function ImagePlaceholderBadge(\n\thandle: Handle<ImagePlaceholder.BadgeProps>,\n) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"badge\"\n\t\t\t\tmix={[\n\t\t\t\t\tabsolute(),\n\t\t\t\t\tis(3),\n\t\t\t\t\tbs(3),\n\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\tborder({ color: \"neutral.tint\", width: 2 }),\n\t\t\t\t\tbg(\"neutral.strong\"),\n\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\tinsIe(\"0\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a row of overlapping placeholders: a flex container that pulls each\n * child back over the previous one and rings each in the neutral tint background,\n * so the overlap reads as stacked cutouts.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the group's markup.\n * @example\n * <ImagePlaceholder.Group>\n * \t<ImagePlaceholder>…</ImagePlaceholder>\n * \t<ImagePlaceholder>…</ImagePlaceholder>\n * \t<ImagePlaceholder.GroupCount>+3</ImagePlaceholder.GroupCount>\n * </ImagePlaceholder.Group>\n */\nImagePlaceholder.Group = function ImagePlaceholderGroup(\n\thandle: Handle<ImagePlaceholder.GroupProps>,\n) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\twhen(\"& > * + *\", mis(-3)),\n\t\t\t\t\twhen('& > [data-slot=\"image-placeholder\"]', ringShadow(\"neutral.tint\")),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders the \"+N\" overflow indicator trailing {@link ImagePlaceholder.Group}:\n * a medium box matching {@link ImagePlaceholder}'s size, ring and `shape`, its\n * tabular digits keeping a changing count the same width.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the overflow indicator's markup.\n * @example\n * <ImagePlaceholder.GroupCount>+3</ImagePlaceholder.GroupCount>\n */\nImagePlaceholder.GroupCount = function ImagePlaceholderGroupCount(\n\thandle: Handle<ImagePlaceholder.GroupCountProps>,\n) {\n\treturn () => {\n\t\tlet { shape, children, mix, ...rest } = handle.props;\n\t\tlet resolvedShape = shape ?? DEFAULT_SHAPE;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group-count\"\n\t\t\t\tdata-shape={resolvedShape}\n\t\t\t\tmix={[\n\t\t\t\t\trelative(),\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\twhen('&[data-shape=\"circle\"]', rounded(\"full\")),\n\t\t\t\t\twhen('&[data-shape=\"square\"]', rounded(\"lg\")),\n\t\t\t\t\tshrink(),\n\t\t\t\t\tuserSelect(),\n\t\t\t\t\tis(\"var(--ui-image-placeholder-size-md, 2.5rem)\"),\n\t\t\t\t\tbs(\"var(--ui-image-placeholder-size-md, 2.5rem)\"),\n\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\ttabularNums(),\n\t\t\t\t\tringShadow(\"neutral.tint\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</span>\n\t\t);\n\t};\n};\n"
|
|
10
|
+
"content": "/**\n * The shared foundation for a fixed-size image-with-fallback box — a user\n * avatar, a brand logo, or any other picture that needs a graceful stand-in\n * before it loads or when it's missing. It renders a sized, shaped host that\n * an image and a fallback layer both stack into, plus a corner status badge\n * and a group of overlapping instances with a trailing overflow count.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { ringShadow, rounded, visibility } from \"@sdxc/u/effects\";\nimport { userSelect, mergeMix } from \"@sdxc/u/general\";\nimport {\n\tabsolute,\n\tcenter,\n\tflex,\n\tinlineFlex,\n\tinsBe,\n\tinsIe,\n\tinset,\n\titems,\n\tjustify,\n\trelative,\n\tshrink,\n} from \"@sdxc/u/layout\";\nimport { overflow } from \"@sdxc/u/overflow\";\nimport { bs, fit, is, mis } from \"@sdxc/u/size\";\nimport { data, precededBy, when } from \"@sdxc/u/state\";\nimport { tabularNums, text, textTransform, weight } from \"@sdxc/u/typography\";\n\n/** Size variant {@link ImagePlaceholder} falls back to when `size` is omitted. */\nconst DEFAULT_SIZE: ImagePlaceholder.Size = \"md\";\n\n/**\n * Shape variant {@link ImagePlaceholder} and {@link ImagePlaceholder.GroupCount}\n * fall back to when `shape` is omitted.\n */\nconst DEFAULT_SHAPE: ImagePlaceholder.Shape = \"circle\";\n\n/**\n * The inset hairline {@link ImagePlaceholder.Image} draws over a picture's\n * edge, read from the theme's `--ui-image-outline`, which flips for dark mode.\n */\nconst IMAGE_OUTLINE = \"var(--ui-image-outline, rgb(0 0 0 / 0.1))\";\n\n/**\n * Prop types for {@link ImagePlaceholder} and its compound parts.\n */\nexport namespace ImagePlaceholder {\n\t/**\n\t * Size variant controlling the host's rendered dimensions and, through\n\t * ordinary inheritance, the fallback initials' font size.\n\t */\n\texport type Size = \"sm\" | \"md\" | \"lg\";\n\n\t/**\n\t * Shape variant controlling the corner rounding of the host, its image,\n\t * and its fallback layer: `\"circle\"` renders a fully rounded disc, and\n\t * `\"square\"` renders a softly rounded square.\n\t */\n\texport type Shape = \"circle\" | \"square\";\n\n\t/**\n\t * Props accepted by {@link ImagePlaceholder}.\n\t */\n\texport interface Props extends TagProps<\"span\"> {\n\t\t/** Size variant. Defaults to {@link DEFAULT_SIZE}. */\n\t\tsize?: Size;\n\t\t/** Shape variant. Defaults to {@link DEFAULT_SHAPE}. */\n\t\tshape?: Shape;\n\t\t/** The host's compound parts: {@link ImagePlaceholder.Image}, {@link ImagePlaceholder.Fallback}, and an optional {@link ImagePlaceholder.Badge}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link ImagePlaceholder.Image}.\n\t */\n\texport interface ImageProps extends Omit<\n\t\tTagProps<\"img\">,\n\t\t\"src\" | \"alt\" | \"role\" | \"aria-label\" | \"aria-labelledby\" | \"title\"\n\t> {\n\t\t/** Image source URL. */\n\t\tsrc: string;\n\t\t/**\n\t\t * Accessible text description of the image. Required, since a\n\t\t * consumer's own localized description drives what assistive\n\t\t * technology announces.\n\t\t */\n\t\talt: string;\n\t}\n\n\t/**\n\t * Props accepted by {@link ImagePlaceholder.Fallback}.\n\t */\n\texport interface FallbackProps extends TagProps<\"span\"> {\n\t\t/** Fallback content, typically the subject's initials. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link ImagePlaceholder.Badge}.\n\t */\n\texport interface BadgeProps extends TagProps<\"span\"> {}\n\n\t/**\n\t * Props accepted by {@link ImagePlaceholder.Group}.\n\t */\n\texport interface GroupProps extends TagProps<\"div\"> {\n\t\t/** A run of {@link ImagePlaceholder} instances, optionally trailed by {@link ImagePlaceholder.GroupCount}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link ImagePlaceholder.GroupCount}.\n\t */\n\texport interface GroupCountProps extends TagProps<\"span\"> {\n\t\t/** Shape variant, matching the shape of the sibling placeholders it trails. Defaults to {@link DEFAULT_SHAPE}. */\n\t\tshape?: Shape;\n\t\t/** The overflow count text, e.g. `\"+3\"`. */\n\t\tchildren: RemixNode;\n\t}\n}\n\n/**\n * Renders the placeholder host: a fixed-size, centered box whose `data-shape`\n * attribute styles it, its image, and its fallback together, leaving room\n * for {@link ImagePlaceholder.Badge} to sit unclipped on the corner.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the placeholder's markup.\n * @example\n * <ImagePlaceholder>\n * \t<ImagePlaceholder.Image src={user.avatarUrl} alt={user.name} />\n * \t<ImagePlaceholder.Fallback>{initials}</ImagePlaceholder.Fallback>\n * </ImagePlaceholder>\n * @example\n * <ImagePlaceholder size=\"lg\" shape=\"square\">\n * \t<ImagePlaceholder.Image src={org.logoUrl} alt={org.name} />\n * \t<ImagePlaceholder.Badge />\n * </ImagePlaceholder>\n */\nexport function ImagePlaceholder(handle: Handle<ImagePlaceholder.Props>) {\n\treturn () => {\n\t\tlet { size, shape, children, mix, ...rest } = handle.props;\n\t\tlet resolvedSize = size ?? DEFAULT_SIZE;\n\t\tlet resolvedShape = shape ?? DEFAULT_SHAPE;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"image-placeholder\"\n\t\t\t\tdata-size={resolvedSize}\n\t\t\t\tdata-shape={resolvedShape}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\twhen(\"&:focus-visible\", outline({ color: \"brand.ring\", offset: 2 })),\n\t\t\t\t\t\trelative(),\n\t\t\t\t\t\tinlineFlex(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\tshrink(),\n\t\t\t\t\t\tuserSelect(),\n\t\t\t\t\t\tis(\"var(--ui-image-placeholder-size-md, 2.5rem)\"),\n\t\t\t\t\t\tbs(\"var(--ui-image-placeholder-size-md, 2.5rem)\"),\n\t\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t\tdata(\"size\", \"sm\", [\n\t\t\t\t\t\t\tis(\"var(--ui-image-placeholder-size-sm, 2rem)\"),\n\t\t\t\t\t\t\tbs(\"var(--ui-image-placeholder-size-sm, 2rem)\"),\n\t\t\t\t\t\t\ttext(\"xs\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"size\", \"lg\", [\n\t\t\t\t\t\t\tis(\"var(--ui-image-placeholder-size-lg, 3rem)\"),\n\t\t\t\t\t\t\tbs(\"var(--ui-image-placeholder-size-lg, 3rem)\"),\n\t\t\t\t\t\t\ttext(\"base\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"shape\", \"circle\", [\n\t\t\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\t\t\twhen('& > [data-slot=\"image\"]', rounded(\"full\")),\n\t\t\t\t\t\t\twhen('& > [data-slot=\"fallback\"]', rounded(\"full\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"shape\", \"square\", [\n\t\t\t\t\t\t\trounded(\"lg\"),\n\t\t\t\t\t\t\twhen('& > [data-slot=\"image\"]', rounded(\"lg\")),\n\t\t\t\t\t\t\twhen('& > [data-slot=\"fallback\"]', rounded(\"lg\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</span>\n\t\t);\n\t};\n}\n\n/**\n * Renders the placeholder's image layer: an `<img>` cropped to cover, clipped to\n * {@link ImagePlaceholder}'s `data-shape`, its inset hairline holding the edge on\n * a same-tone background. Its order against {@link ImagePlaceholder.Fallback} decides what shows.\n *\n * @param handle Runtime handle carrying the host `<img>`'s props.\n * @returns The render function producing the image layer's markup.\n * @example\n * <ImagePlaceholder.Image src={user.avatarUrl} alt={user.name} />\n */\nImagePlaceholder.Image = function ImagePlaceholderImage(\n\thandle: Handle<ImagePlaceholder.ImageProps>,\n) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<img\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"image\"\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\tis(\"full\"),\n\t\t\t\t\t\tbs(\"full\"),\n\t\t\t\t\t\tfit(\"cover\"),\n\t\t\t\t\t\tinset(0, 0, 0, 0),\n\t\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\t\toutline({ color: IMAGE_OUTLINE, width: 1, offset: -1 }),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders the placeholder's fallback layer: a `<span>` centering a consumer's\n * content in uppercase text. Font size inherits {@link ImagePlaceholder}'s\n * `data-size` via CSS, keeping initials proportional at every size.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the fallback layer's markup.\n * @example\n * <ImagePlaceholder.Fallback>{initials}</ImagePlaceholder.Fallback>\n */\nImagePlaceholder.Fallback = function ImagePlaceholderFallback(\n\thandle: Handle<ImagePlaceholder.FallbackProps>,\n) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"fallback\"\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Both layers fill the host and this one follows the image, so it hides while an unbroken\n\t\t\t\t\t\t * image is present and takes over once the image fails. It hides through `visibility`,\n\t\t\t\t\t\t * which no other rule here sets, so declaration order keeps it hidden.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprecededBy('img[data-slot=\"image\"]:not([data-image-error])', visibility(\"hidden\")),\n\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\tcenter(),\n\t\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\t\tbg(\"neutral.bg-tint-pressed\"),\n\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\tinset(0, 0, 0, 0),\n\t\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\t\ttextTransform(\"uppercase\"),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</span>\n\t\t);\n\t};\n};\n\n/**\n * Renders a small status dot pinned to the host's block-end/inline-end\n * corner, always fully rounded regardless of {@link ImagePlaceholder}'s own\n * shape, and ringed to read as cut from whatever sits beneath it.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the badge's markup.\n * @example\n * <ImagePlaceholder.Badge />\n */\nImagePlaceholder.Badge = function ImagePlaceholderBadge(\n\thandle: Handle<ImagePlaceholder.BadgeProps>,\n) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"badge\"\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\tis(3),\n\t\t\t\t\t\tbs(3),\n\t\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\t\tborder({ color: \"neutral.tint\", width: 2 }),\n\t\t\t\t\t\tbg(\"neutral.strong\"),\n\t\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\t\tinsIe(\"0\"),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a row of overlapping placeholders: a flex container that pulls each\n * child back over the previous one and rings each in the neutral tint background,\n * so the overlap reads as stacked cutouts.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the group's markup.\n * @example\n * <ImagePlaceholder.Group>\n * \t<ImagePlaceholder>…</ImagePlaceholder>\n * \t<ImagePlaceholder>…</ImagePlaceholder>\n * \t<ImagePlaceholder.GroupCount>+3</ImagePlaceholder.GroupCount>\n * </ImagePlaceholder.Group>\n */\nImagePlaceholder.Group = function ImagePlaceholderGroup(\n\thandle: Handle<ImagePlaceholder.GroupProps>,\n) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group\"\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\twhen(\"& > * + *\", mis(-3)),\n\t\t\t\t\t\twhen('& > [data-slot=\"image-placeholder\"]', ringShadow(\"neutral.tint\")),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders the \"+N\" overflow indicator trailing {@link ImagePlaceholder.Group}:\n * a medium box matching {@link ImagePlaceholder}'s size, ring and `shape`, its\n * tabular digits keeping a changing count the same width.\n *\n * @param handle Runtime handle carrying the host `<span>`'s props.\n * @returns The render function producing the overflow indicator's markup.\n * @example\n * <ImagePlaceholder.GroupCount>+3</ImagePlaceholder.GroupCount>\n */\nImagePlaceholder.GroupCount = function ImagePlaceholderGroupCount(\n\thandle: Handle<ImagePlaceholder.GroupCountProps>,\n) {\n\treturn () => {\n\t\tlet { shape, children, mix, ...rest } = handle.props;\n\t\tlet resolvedShape = shape ?? DEFAULT_SHAPE;\n\n\t\treturn (\n\t\t\t<span\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"group-count\"\n\t\t\t\tdata-shape={resolvedShape}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\trelative(),\n\t\t\t\t\t\tinlineFlex(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\toverflow(\"hidden\"),\n\t\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\t\tbg(\"neutral.bg-tint-hover\"),\n\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\twhen('&[data-shape=\"circle\"]', rounded(\"full\")),\n\t\t\t\t\t\twhen('&[data-shape=\"square\"]', rounded(\"lg\")),\n\t\t\t\t\t\tshrink(),\n\t\t\t\t\t\tuserSelect(),\n\t\t\t\t\t\tis(\"var(--ui-image-placeholder-size-md, 2.5rem)\"),\n\t\t\t\t\t\tbs(\"var(--ui-image-placeholder-size-md, 2.5rem)\"),\n\t\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t\ttabularNums(),\n\t\t\t\t\t\tringShadow(\"neutral.tint\"),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</span>\n\t\t);\n\t};\n};\n"
|
|
11
11
|
},
|
|
12
12
|
"test": {
|
|
13
13
|
"path": "image-placeholder.test.tsx",
|
package/registry/ui/input.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "input",
|
|
3
|
-
"changedIn": "2026.
|
|
3
|
+
"changedIn": "2026.11.3",
|
|
4
4
|
"dependencies": [],
|
|
5
5
|
"exports": [
|
|
6
6
|
"Input"
|
|
7
7
|
],
|
|
8
8
|
"source": {
|
|
9
9
|
"path": "input.tsx",
|
|
10
|
-
"content": "/**\n * A single-line native form field for free text entry, rendered as a\n * bordered, rounded `<input>` whose border, background, and focus ring read\n * from a semantic color role. It supplies the field's own box styling only,\n * ready to compose alongside a paired label, hint, and validation message,\n * and serves as the shared foundation every other single-line text control\n * in this library builds on.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { opacity, rounded } from \"@sdxc/u/effects\";\nimport { cursor } from \"@sdxc/u/general\";\nimport { block } from \"@sdxc/u/layout\";\nimport { bs, is, pb, pi } from \"@sdxc/u/size\";\nimport { focusVisible, hover, invalid, when } from \"@sdxc/u/state\";\nimport { text } from \"@sdxc/u/typography\";\n\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\n\n/** Semantic color role {@link Input} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: Input.Color = \"neutral\";\n\n/**\n * Prop types for {@link Input}.\n */\nexport namespace Input {\n\t/**\n\t * Semantic color role for the focus-visible ring, each mapped to its\n\t * matching `--ui-*` variables. A field marked invalid always reads the\n\t * danger tone for its ring regardless of `color`.\n\t */\n\texport type Color = \"brand\" | \"neutral\" | \"success\" | \"warning\" | \"danger\";\n\n\t/**\n\t * Every native `<input>` attribute, unchanged, plus the `mix`\n\t * passthrough. `role` narrows to match whichever `type` is set, the\n\t * same correlation the platform itself defines between the two.\n\t */\n\texport type Props = TagProps<\"input\"> & {\n\t\t/** Semantic color role for the focus-visible ring. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t};\n}\n\n/**\n * Renders a native `<input>` host colored via `data-color`, with hover,\n * focus, and disabled states driven by native pseudo-classes; `[aria-invalid=\"true\"]`\n * together with `:user-invalid` forces the danger tone regardless of `color`.\n *\n * @param handle Runtime handle carrying the host `<input>`'s props.\n * @returns The render function producing the field's markup.\n * @example\n * <Label htmlFor=\"email\">{t(\"form.email.label\")}</Label>\n * <Input id=\"email\" type=\"email\" required />\n * @example\n * <Input\n * \taria-label={t(\"form.search.label\")}\n * \tcolor=\"brand\"\n * \tplaceholder={t(\"form.search.placeholder\")}\n * />\n * @example\n * <Input id=\"username\" aria-describedby=\"username-error\" aria-invalid=\"true\" />\n * <FieldError id=\"username-error\">{t(\"form.username.taken\")}</FieldError>\n */\nexport function Input(handle: Handle<Input.Props>) {\n\treturn () => {\n\t\tlet { color, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\t{...rest}\n\t\t\t\tdata-color={resolvedColor}\n\t\t\t\tmix={[\n\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\tblock(),\n\t\t\t\t\tis(\"full\"),\n\t\t\t\t\tbs(10),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tborder({ color: \"neutral\", width: 1 }),\n\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\tpi(3),\n\t\t\t\t\tpb(2),\n\t\t\t\t\twhen(\"&::placeholder\", fg(\"neutral.muted\")),\n\t\t\t\t\thover(border(\"neutral.border-hover\")),\n\t\t\t\t\t/**\n\t\t\t\t\t * Focus draws a ring standing off the field, as every button here does, and the border\n\t\t\t\t\t * steps only to its hover weight: a strong border flush with the ring reads as the field\n\t\t\t\t\t * changing shape.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"&:focus\", border(\"neutral.border-hover\")),\n\t\t\t\t\t/**\n\t\t\t\t\t * Pointer focus drops the platform outline and keyboard focus keeps the ring below. The\n\t\t\t\t\t * selectors exclude each other because `outline: none` is a shorthand, and from a later\n\t\t\t\t\t * cascade layer it resets the ring's color, width and style at once.\n\t\t\t\t\t */\n\t\t\t\t\twhen(\"&:focus:not(:focus-visible)\", outline(\"none\")),\n\t\t\t\t\tfocusVisible(
|
|
10
|
+
"content": "/**\n * A single-line native form field for free text entry, rendered as a\n * bordered, rounded `<input>` whose border, background, and focus ring read\n * from a semantic color role. It supplies the field's own box styling only,\n * ready to compose alongside a paired label, hint, and validation message,\n * and serves as the shared foundation every other single-line text control\n * in this library builds on.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { opacity, rounded } from \"@sdxc/u/effects\";\nimport { cursor, mergeMix } from \"@sdxc/u/general\";\nimport { block } from \"@sdxc/u/layout\";\nimport { bs, is, pb, pi } from \"@sdxc/u/size\";\nimport { focusVisible, hover, invalid, when } from \"@sdxc/u/state\";\nimport { text } from \"@sdxc/u/typography\";\n\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\n\n/** Semantic color role {@link Input} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: Input.Color = \"neutral\";\n\n/** An input joined to a `Group.Text` addon, whose group draws the field's focus and invalid rings. */\nconst BESIDE_ADDON = ':is([data-slot=\"group-text\"] ~ *, :has(~ [data-slot=\"group-text\"]))';\n\n/** An input standing on its own, drawing its focus and invalid rings itself. */\nconst STANDALONE = `:not(${BESIDE_ADDON})`;\n\n/**\n * Prop types for {@link Input}.\n */\nexport namespace Input {\n\t/**\n\t * Semantic color role for the focus-visible ring, each mapped to its\n\t * matching `--ui-*` variables. A field marked invalid always reads the\n\t * danger tone for its ring regardless of `color`.\n\t */\n\texport type Color = \"brand\" | \"neutral\" | \"success\" | \"warning\" | \"danger\";\n\n\t/**\n\t * Every native `<input>` attribute, unchanged, plus the `mix`\n\t * passthrough. `role` narrows to match whichever `type` is set, the\n\t * same correlation the platform itself defines between the two.\n\t */\n\texport type Props = TagProps<\"input\"> & {\n\t\t/** Semantic color role for the focus-visible ring. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t};\n}\n\n/**\n * Renders a native `<input>` host colored via `data-color`, with hover,\n * focus, and disabled states driven by native pseudo-classes; `[aria-invalid=\"true\"]`\n * together with `:user-invalid` forces the danger tone regardless of `color`.\n *\n * @param handle Runtime handle carrying the host `<input>`'s props.\n * @returns The render function producing the field's markup.\n * @example\n * <Label htmlFor=\"email\">{t(\"form.email.label\")}</Label>\n * <Input id=\"email\" type=\"email\" required />\n * @example\n * <Input\n * \taria-label={t(\"form.search.label\")}\n * \tcolor=\"brand\"\n * \tplaceholder={t(\"form.search.placeholder\")}\n * />\n * @example\n * <Input id=\"username\" aria-describedby=\"username-error\" aria-invalid=\"true\" />\n * <FieldError id=\"username-error\">{t(\"form.username.taken\")}</FieldError>\n */\nexport function Input(handle: Handle<Input.Props>) {\n\treturn () => {\n\t\tlet { color, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\t{...rest}\n\t\t\t\tdata-color={resolvedColor}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\t\tblock(),\n\t\t\t\t\t\tis(\"full\"),\n\t\t\t\t\t\tbs(10),\n\t\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\t\tborder({ color: \"neutral\", width: 1 }),\n\t\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\tpi(3),\n\t\t\t\t\t\tpb(2),\n\t\t\t\t\t\twhen(\"&::placeholder\", fg(\"neutral.muted\")),\n\t\t\t\t\t\thover(border(\"neutral.border-hover\")),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Focus draws a ring standing off the field, as every button here does, and the border\n\t\t\t\t\t\t * steps only to its hover weight: a strong border flush with the ring reads as the field\n\t\t\t\t\t\t * changing shape.\n\t\t\t\t\t\t */\n\t\t\t\t\t\twhen(\"&:focus\", border(\"neutral.border-hover\")),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Pointer focus drops the platform outline and keyboard focus keeps the ring below. The\n\t\t\t\t\t\t * selectors exclude each other because `outline: none` is a shorthand, and from a later\n\t\t\t\t\t\t * cascade layer it resets the ring's color, width and style at once.\n\t\t\t\t\t\t */\n\t\t\t\t\t\twhen(\"&:focus:not(:focus-visible)\", outline(\"none\")),\n\t\t\t\t\t\tfocusVisible(border(\"neutral.border-hover\")),\n\t\t\t\t\t\twhen(`&:focus-visible${STANDALONE}`, [\n\t\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\t\twhen('&[data-color=\"success\"]', outline(\"success.ring\")),\n\t\t\t\t\t\t\twhen('&[data-color=\"warning\"]', outline(\"warning.ring\")),\n\t\t\t\t\t\t\twhen('&[data-color=\"danger\"]', outline(\"danger.ring\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen(`&:focus${BESIDE_ADDON}`, outline(\"none\")),\n\t\t\t\t\t\tinvalid(border(\"danger\")),\n\t\t\t\t\t\twhen(\n\t\t\t\t\t\t\t`&:is(:user-invalid, [aria-invalid=\"true\"])${STANDALONE}`,\n\t\t\t\t\t\t\toutline({ color: \"danger.ring\", offset: 2 }),\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\"&:disabled\", [opacity(50), bg(\"neutral.bg-tint-hover\"), cursor(\"not-allowed\")]),\n\t\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t/>\n\t\t);\n\t};\n}\n"
|
|
11
11
|
},
|
|
12
12
|
"test": null
|
|
13
13
|
}
|
package/registry/ui/item.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "item",
|
|
3
|
-
"changedIn": "2026.
|
|
3
|
+
"changedIn": "2026.11.1",
|
|
4
4
|
"dependencies": [],
|
|
5
5
|
"exports": [
|
|
6
6
|
"Item"
|
|
7
7
|
],
|
|
8
8
|
"source": {
|
|
9
9
|
"path": "item.tsx",
|
|
10
|
-
"content": "/**\n * A single-line content row composing a leading media slot, a title and\n * description content slot, and a trailing action slot along one\n * horizontally centered line — the shape a settings row, a notification\n * list entry, or a file row all share. Every part lays out through the\n * row's own flex line rather than any part reading a semantic role from its\n * neighbors, so a row renders correctly whichever parts a given list needs:\n * media and content alone, content and actions alone, or all three.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { fg } from \"@sdxc/u/color\";\nimport { raw } from \"@sdxc/u/general\";\nimport {\n\tbasis,\n\tcenter,\n\tcontainer,\n\tflex,\n\tflexCol,\n\tflexWrap,\n\tgap,\n\tgrow,\n\titems,\n\tshrink,\n} from \"@sdxc/u/layout\";\nimport { atMax } from \"@sdxc/u/responsive\";\nimport { bs, is, mis, minIs, pb, pi } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { fontSize, leading, text, truncate, weight } from \"@sdxc/u/typography\";\n\n/**\n * Named container {@link Item} declares on its own host, so\n * {@link Item.Actions} can adapt to the row's own width instead of the\n * page's, keeping the same row width in a full page or a narrow panel.\n */\nconst CONTAINER_NAME = \"ui-item\";\n\n/**\n * `@container` max-width threshold below which the row can't hold\n * {@link Item.Media}, {@link Item.Content}, and {@link Item.Actions} on one\n * line without crowding {@link Item.Content}'s text out of room.\n */\nconst NARROW_CONTAINER_SIZE = \"20rem\";\n\n/**\n * Prop types for {@link Item} and its compound parts.\n */\nexport namespace Item {\n\t/**\n\t * Props accepted by {@link Item}.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** The row's compound parts: {@link Item.Media}, {@link Item.Content}, and {@link Item.Actions}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Item.Media}.\n\t */\n\texport interface MediaProps extends TagProps<\"div\"> {\n\t\t/** The leading graphic — an icon, an image thumbnail, an Avatar instance, or a checkbox. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Item.Content}.\n\t */\n\texport interface ContentProps extends TagProps<\"div\"> {\n\t\t/** {@link Item.Title} and, optionally, {@link Item.Description}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Item.Title}.\n\t */\n\texport interface TitleProps extends TagProps<\"div\"> {\n\t\t/** The row's label text. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Item.Description}.\n\t */\n\texport interface DescriptionProps extends TagProps<\"p\"> {\n\t\t/** Supporting detail below the title — a file size, an email address, a timestamp. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Item.Actions}.\n\t */\n\texport interface ActionsProps extends TagProps<\"div\"> {\n\t\t/** A run of buttons, links, or a switch — whatever control the row offers. */\n\t\tchildren: RemixNode;\n\t}\n}\n\n/**\n * Renders the row's host: a `<div>` laying {@link Item.Media},\n * {@link Item.Content}, and {@link Item.Actions} on one flex line, dropping\n * {@link Item.Actions} to a second line once the row narrows past threshold.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Item>\n * \t<Item.Media><FileTextIcon aria-hidden /></Item.Media>\n * \t<Item.Content>\n * \t\t<Item.Title>quarterly-report.pdf</Item.Title>\n * \t\t<Item.Description>2.4 MB</Item.Description>\n * \t</Item.Content>\n * \t<Item.Actions>\n * \t\t<Button aria-label={t(\"files.download\")}><DownloadIcon /></Button>\n * \t</Item.Actions>\n * </Item>\n * @example\n * <Item>\n * \t<Item.Content>\n * \t\t<Item.Title>{t(\"settings.emailNotifications.title\")}</Item.Title>\n * \t\t<Item.Description>{t(\"settings.emailNotifications.description\")}</Item.Description>\n * \t</Item.Content>\n * \t<Item.Actions>\n * \t\t<Switch name=\"emailNotifications\" />\n * \t</Item.Actions>\n * </Item>\n */\nexport function Item(handle: Handle<Item.Props>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"item\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tgap(\"var(--ui-item-gap, 0.75rem)\"),\n\t\t\t\t\tpb(\"var(--ui-item-padding-block, 0.625rem)\"),\n\t\t\t\t\tpi(\"var(--ui-item-padding-inline, 0.75rem)\"),\n\t\t\t\t\tcontainer(CONTAINER_NAME),\n\t\t\t\t\t/**\n\t\t\t\t\t * The row wraps at every width, and {@link Item.Actions} claiming a full line once the\n\t\t\t\t\t * row is narrow decides when it does; a query on this row's own container can only\n\t\t\t\t\t * restyle its descendants, never the row itself.\n\t\t\t\t\t */\n\t\t\t\t\tflexWrap(\"wrap\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n}\n\n/**\n * Renders {@link Item.MediaProps.children} as the row's leading slot: a\n * shrink-proof, centered `<div>` colored from the neutral foreground so a\n * nested icon inherits it through `currentcolor`.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the media slot's markup.\n * @example\n * <Item.Media><FileTextIcon aria-hidden /></Item.Media>\n * @example\n * <Item.Media>\n * \t<Avatar size=\"sm\">\n * \t\t<Avatar.Image src={member.avatarUrl} alt={member.name} />\n * \t\t<Avatar.Fallback>{member.initials}</Avatar.Fallback>\n * \t</Avatar>\n * </Item.Media>\n */\nItem.Media = function ItemMedia(handle: Handle<Item.MediaProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"media\"\n\t\t\t\tmix={[\n\t\t\t\t\tcenter(),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\twhen(\"& > svg\", [is(5), bs(5)]),\n\t\t\t\t\tshrink(),\n\t\t\t\t\tis(\"var(--ui-item-media-size, 2rem)\"),\n\t\t\t\t\tbs(\"var(--ui-item-media-size, 2rem)\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Item.ContentProps.children} as the row's text column: a\n * `<div>` stacking {@link Item.Title} and {@link Item.Description} with its\n * minimum inline size collapsed to `0` so their truncation takes effect.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the text column's markup.\n * @example\n * <Item.Content>\n * \t<Item.Title>quarterly-report.pdf</Item.Title>\n * \t<Item.Description>2.4 MB</Item.Description>\n * </Item.Content>\n */\nItem.Content = function ItemContent(handle: Handle<Item.ContentProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"content\"\n\t\t\t\tmix={[flex(), flexCol(), minIs(0), gap(0.5), grow(), shrink(1), basis(\"0%\"), mix]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Item.TitleProps.children} as the row's label in a plain\n * `<div>`, since a document outline gains nothing from a heading entry per\n * repeated row, truncated to one line in the foreground's emphasized tone.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the title's markup.\n * @example\n * <Item.Title>quarterly-report.pdf</Item.Title>\n */\nItem.Title = function ItemTitle(handle: Handle<Item.TitleProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"title\"\n\t\t\t\tmix={[weight(\"medium\"), fg(\"neutral.emphasis\"), truncate(), text(\"sm\"), mix]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Item.DescriptionProps.children} as the row's supporting\n * detail in a native `<p>`, truncated to one line to match\n * {@link Item.Title} so the pair reads as one compact two-line block.\n *\n * @param handle Runtime handle carrying the host `<p>`'s props.\n * @returns The render function producing the description's markup.\n * @example\n * <Item.Description>2.4 MB</Item.Description>\n */\nItem.Description = function ItemDescription(handle: Handle<Item.DescriptionProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<p\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"description\"\n\t\t\t\tmix={[\n\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\ttruncate(),\n\t\t\t\t\tfontSize(\"0.8125rem\"),\n\t\t\t\t\tleading(\"calc(1.125 / 0.8125)\"),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</p>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Item.ActionsProps.children} as the row's trailing slot,\n * pinned to the inline-end edge; once {@link Item} wraps narrow, it drops\n * to its own line, indented past {@link Item.Media} to read as trailing.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the action slot's markup.\n * @example\n * <Item.Actions>\n * \t<Button aria-label={t(\"files.download\")}><DownloadIcon /></Button>\n * \t<Button aria-label={t(\"files.remove\")}><XIcon /></Button>\n * </Item.Actions>\n */\nItem.Actions = function ItemActions(handle: Handle<Item.ActionsProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"actions\"\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tmis(\"auto\"),\n\t\t\t\t\tshrink(),\n\t\t\t\t\tgap(\"var(--ui-item-actions-gap, 0.5rem)\"),\n\t\t\t\t\tatMax(NARROW_CONTAINER_SIZE, CONTAINER_NAME, [\n\t\t\t\t\t\tbasis(\"100%\"),\n\t\t\t\t\t\traw({\n\t\t\t\t\t\t\tjustifyContent: \"flex-end\",\n\t\t\t\t\t\t\tmarginInlineStart:\n\t\t\t\t\t\t\t\t\"calc(var(--ui-item-media-size, 2rem) + var(--ui-item-gap, 0.75rem))\",\n\t\t\t\t\t\t}),\n\t\t\t\t\t]),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n"
|
|
10
|
+
"content": "/**\n * A single-line content row composing a leading media slot, a title and\n * description content slot, and a trailing action slot along one\n * horizontally centered line — the shape a settings row, a notification\n * list entry, or a file row all share. Every part lays out through the\n * row's own flex line rather than any part reading a semantic role from its\n * neighbors, so a row renders correctly whichever parts a given list needs:\n * media and content alone, content and actions alone, or all three.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps, RemixNode } from \"remix/component\";\n\nimport { fg } from \"@sdxc/u/color\";\nimport { raw, mergeMix } from \"@sdxc/u/general\";\nimport {\n\tbasis,\n\tcenter,\n\tcontainer,\n\tflex,\n\tflexCol,\n\tflexWrap,\n\tgap,\n\tgrow,\n\titems,\n\tshrink,\n} from \"@sdxc/u/layout\";\nimport { atMax } from \"@sdxc/u/responsive\";\nimport { bs, is, mis, minIs, pb, pi } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { fontSize, leading, text, truncate, weight } from \"@sdxc/u/typography\";\n\n/**\n * Named container {@link Item} declares on its own host, so\n * {@link Item.Actions} can adapt to the row's own width instead of the\n * page's, keeping the same row width in a full page or a narrow panel.\n */\nconst CONTAINER_NAME = \"ui-item\";\n\n/**\n * `@container` max-width threshold below which the row can't hold\n * {@link Item.Media}, {@link Item.Content}, and {@link Item.Actions} on one\n * line without crowding {@link Item.Content}'s text out of room.\n */\nconst NARROW_CONTAINER_SIZE = \"20rem\";\n\n/**\n * Prop types for {@link Item} and its compound parts.\n */\nexport namespace Item {\n\t/**\n\t * Props accepted by {@link Item}.\n\t */\n\texport interface Props extends TagProps<\"div\"> {\n\t\t/** The row's compound parts: {@link Item.Media}, {@link Item.Content}, and {@link Item.Actions}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Item.Media}.\n\t */\n\texport interface MediaProps extends TagProps<\"div\"> {\n\t\t/** The leading graphic — an icon, an image thumbnail, an Avatar instance, or a checkbox. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Item.Content}.\n\t */\n\texport interface ContentProps extends TagProps<\"div\"> {\n\t\t/** {@link Item.Title} and, optionally, {@link Item.Description}. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Item.Title}.\n\t */\n\texport interface TitleProps extends TagProps<\"div\"> {\n\t\t/** The row's label text. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Item.Description}.\n\t */\n\texport interface DescriptionProps extends TagProps<\"p\"> {\n\t\t/** Supporting detail below the title — a file size, an email address, a timestamp. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Props accepted by {@link Item.Actions}.\n\t */\n\texport interface ActionsProps extends TagProps<\"div\"> {\n\t\t/** A run of buttons, links, or a switch — whatever control the row offers. */\n\t\tchildren: RemixNode;\n\t}\n}\n\n/**\n * Renders the row's host: a `<div>` laying {@link Item.Media},\n * {@link Item.Content}, and {@link Item.Actions} on one flex line, dropping\n * {@link Item.Actions} to a second line once the row narrows past threshold.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the row's markup.\n * @example\n * <Item>\n * \t<Item.Media><FileTextIcon aria-hidden /></Item.Media>\n * \t<Item.Content>\n * \t\t<Item.Title>quarterly-report.pdf</Item.Title>\n * \t\t<Item.Description>2.4 MB</Item.Description>\n * \t</Item.Content>\n * \t<Item.Actions>\n * \t\t<Button aria-label={t(\"files.download\")}><DownloadIcon /></Button>\n * \t</Item.Actions>\n * </Item>\n * @example\n * <Item>\n * \t<Item.Content>\n * \t\t<Item.Title>{t(\"settings.emailNotifications.title\")}</Item.Title>\n * \t\t<Item.Description>{t(\"settings.emailNotifications.description\")}</Item.Description>\n * \t</Item.Content>\n * \t<Item.Actions>\n * \t\t<Switch name=\"emailNotifications\" />\n * \t</Item.Actions>\n * </Item>\n */\nexport function Item(handle: Handle<Item.Props>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"item\"\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tgap(\"var(--ui-item-gap, 0.75rem)\"),\n\t\t\t\t\t\tpb(\"var(--ui-item-padding-block, 0.625rem)\"),\n\t\t\t\t\t\tpi(\"var(--ui-item-padding-inline, 0.75rem)\"),\n\t\t\t\t\t\tcontainer(CONTAINER_NAME),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The row wraps at every width, and {@link Item.Actions} claiming a full line once the\n\t\t\t\t\t\t * row is narrow decides when it does; a query on this row's own container can only\n\t\t\t\t\t\t * restyle its descendants, never the row itself.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tflexWrap(\"wrap\"),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n}\n\n/**\n * Renders {@link Item.MediaProps.children} as the row's leading slot: a\n * shrink-proof, centered `<div>` colored from the neutral foreground so a\n * nested icon inherits it through `currentcolor`.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the media slot's markup.\n * @example\n * <Item.Media><FileTextIcon aria-hidden /></Item.Media>\n * @example\n * <Item.Media>\n * \t<Avatar size=\"sm\">\n * \t\t<Avatar.Image src={member.avatarUrl} alt={member.name} />\n * \t\t<Avatar.Fallback>{member.initials}</Avatar.Fallback>\n * \t</Avatar>\n * </Item.Media>\n */\nItem.Media = function ItemMedia(handle: Handle<Item.MediaProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"media\"\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tcenter(),\n\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\twhen(\"& > svg\", [is(5), bs(5)]),\n\t\t\t\t\t\tshrink(),\n\t\t\t\t\t\tis(\"var(--ui-item-media-size, 2rem)\"),\n\t\t\t\t\t\tbs(\"var(--ui-item-media-size, 2rem)\"),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Item.ContentProps.children} as the row's text column: a\n * `<div>` stacking {@link Item.Title} and {@link Item.Description} with its\n * minimum inline size collapsed to `0` so their truncation takes effect.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the text column's markup.\n * @example\n * <Item.Content>\n * \t<Item.Title>quarterly-report.pdf</Item.Title>\n * \t<Item.Description>2.4 MB</Item.Description>\n * </Item.Content>\n */\nItem.Content = function ItemContent(handle: Handle<Item.ContentProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"content\"\n\t\t\t\tmix={mergeMix([flex(), flexCol(), minIs(0), gap(0.5), grow(), shrink(1), basis(\"0%\")], mix)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Item.TitleProps.children} as the row's label in a plain\n * `<div>`, since a document outline gains nothing from a heading entry per\n * repeated row, truncated to one line in the foreground's emphasized tone.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the title's markup.\n * @example\n * <Item.Title>quarterly-report.pdf</Item.Title>\n */\nItem.Title = function ItemTitle(handle: Handle<Item.TitleProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"title\"\n\t\t\t\tmix={mergeMix([weight(\"medium\"), fg(\"neutral.emphasis\"), truncate(), text(\"sm\")], mix)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Item.DescriptionProps.children} as the row's supporting\n * detail in a native `<p>`, truncated to one line to match\n * {@link Item.Title} so the pair reads as one compact two-line block.\n *\n * @param handle Runtime handle carrying the host `<p>`'s props.\n * @returns The render function producing the description's markup.\n * @example\n * <Item.Description>2.4 MB</Item.Description>\n */\nItem.Description = function ItemDescription(handle: Handle<Item.DescriptionProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<p\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"description\"\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[fg(\"neutral.muted\"), truncate(), fontSize(\"0.8125rem\"), leading(\"calc(1.125 / 0.8125)\")],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</p>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Item.ActionsProps.children} as the row's trailing slot,\n * pinned to the inline-end edge; once {@link Item} wraps narrow, it drops\n * to its own line, indented past {@link Item.Media} to read as trailing.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the action slot's markup.\n * @example\n * <Item.Actions>\n * \t<Button aria-label={t(\"files.download\")}><DownloadIcon /></Button>\n * \t<Button aria-label={t(\"files.remove\")}><XIcon /></Button>\n * </Item.Actions>\n */\nItem.Actions = function ItemActions(handle: Handle<Item.ActionsProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tdata-slot=\"actions\"\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tflex(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tmis(\"auto\"),\n\t\t\t\t\t\tshrink(),\n\t\t\t\t\t\tgap(\"var(--ui-item-actions-gap, 0.5rem)\"),\n\t\t\t\t\t\tatMax(NARROW_CONTAINER_SIZE, CONTAINER_NAME, [\n\t\t\t\t\t\t\tbasis(\"100%\"),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tjustifyContent: \"flex-end\",\n\t\t\t\t\t\t\t\tmarginInlineStart:\n\t\t\t\t\t\t\t\t\t\"calc(var(--ui-item-media-size, 2rem) + var(--ui-item-gap, 0.75rem))\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t]),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t};\n};\n"
|
|
11
11
|
},
|
|
12
12
|
"test": null
|
|
13
13
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keyboard",
|
|
3
|
-
"changedIn": "2026.
|
|
3
|
+
"changedIn": "2026.11.1",
|
|
4
4
|
"dependencies": [],
|
|
5
5
|
"exports": [
|
|
6
6
|
"Keyboard"
|
|
7
7
|
],
|
|
8
8
|
"source": {
|
|
9
9
|
"path": "keyboard.tsx",
|
|
10
|
-
"content": "/**\n * A keyboard-shortcut hint rendered inside a native `<kbd>` element, drawn as the key\n * it names: a tinted, bordered cap sized to read beside the row's own text. Its\n * inline-start auto margin pushes it to the trailing edge of whatever row it sits in —\n * a menu item's command, a tooltip's accelerator, a button's shortcut label.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { bg, border, fg } from \"@sdxc/u/color\";\nimport { rounded } from \"@sdxc/u/effects\";\nimport { inlineFlex, items, justify } from \"@sdxc/u/layout\";\nimport { bs, minIs, mis, pi } from \"@sdxc/u/size\";\nimport { leading, tabularNums, text } from \"@sdxc/u/typography\";\n\n/**\n * Prop types for {@link Keyboard}.\n */\nexport namespace Keyboard {\n\t/**\n\t * Every native `<kbd>` attribute, unchanged, plus the `mix` passthrough.\n\t * Renders as a small, muted, trailing-aligned annotation whose content is\n\t * whatever `children` the consumer supplies — a key, a chord, a glyph.\n\t */\n\texport interface Props extends TagProps<\"kbd\"> {}\n}\n\n/**\n * Renders its children inside a `<kbd>` element drawn as a key cap, whose inline-start\n * auto margin pushes it to the trailing edge of whatever row it sits in — a menu item,\n * a tooltip, a button.\n *\n * @param handle Runtime handle carrying the host `<kbd>`'s props.\n * @returns The render function producing the shortcut hint's markup.\n * @example\n * <Keyboard>⌘K</Keyboard>\n */\nexport function Keyboard(handle: Handle<Keyboard.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<kbd\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\tmis(\"auto\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * The cap centers its glyph as an inline box, so a key sits inside the sentence\n\t\t\t\t\t * naming it; `center()` composes `flex()` and would put the key on a line of its own.\n\t\t\t\t\t */\n\t\t\t\t\tinlineFlex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t/**\n\t\t\t\t\t * A cap keeps its height and a minimum width whatever it holds, so a single\n\t\t\t\t\t * letter and a two-glyph chord sit on the same line as each other.\n\t\t\t\t\t */\n\t\t\t\t\tbs(\"1.25rem\"),\n\t\t\t\t\tminIs(\"1.25rem\"),\n\t\t\t\t\tpi(1.5),\n\t\t\t\t\trounded(\"sm\"),\n\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\tborder({ color: \"neutral\", width: 1 }),\n\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\ttext(\"xs\"),\n\t\t\t\t\tleading(\"none\"),\n\t\t\t\t\ttabularNums(),\n\t\t\t\t\tmix,\n\t\t\t\t
|
|
10
|
+
"content": "/**\n * A keyboard-shortcut hint rendered inside a native `<kbd>` element, drawn as the key\n * it names: a tinted, bordered cap sized to read beside the row's own text. Its\n * inline-start auto margin pushes it to the trailing edge of whatever row it sits in —\n * a menu item's command, a tooltip's accelerator, a button's shortcut label.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { bg, border, fg } from \"@sdxc/u/color\";\nimport { rounded } from \"@sdxc/u/effects\";\nimport { mergeMix } from \"@sdxc/u/general\";\nimport { inlineFlex, items, justify } from \"@sdxc/u/layout\";\nimport { bs, minIs, mis, pi } from \"@sdxc/u/size\";\nimport { leading, tabularNums, text } from \"@sdxc/u/typography\";\n\n/**\n * Prop types for {@link Keyboard}.\n */\nexport namespace Keyboard {\n\t/**\n\t * Every native `<kbd>` attribute, unchanged, plus the `mix` passthrough.\n\t * Renders as a small, muted, trailing-aligned annotation whose content is\n\t * whatever `children` the consumer supplies — a key, a chord, a glyph.\n\t */\n\texport interface Props extends TagProps<\"kbd\"> {}\n}\n\n/**\n * Renders its children inside a `<kbd>` element drawn as a key cap, whose inline-start\n * auto margin pushes it to the trailing edge of whatever row it sits in — a menu item,\n * a tooltip, a button.\n *\n * @param handle Runtime handle carrying the host `<kbd>`'s props.\n * @returns The render function producing the shortcut hint's markup.\n * @example\n * <Keyboard>⌘K</Keyboard>\n */\nexport function Keyboard(handle: Handle<Keyboard.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<kbd\n\t\t\t\t{...rest}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tmis(\"auto\"),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The cap centers its glyph as an inline box, so a key sits inside the sentence\n\t\t\t\t\t\t * naming it; `center()` composes `flex()` and would put the key on a line of its own.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tinlineFlex(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * A cap keeps its height and a minimum width whatever it holds, so a single\n\t\t\t\t\t\t * letter and a two-glyph chord sit on the same line as each other.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tbs(\"1.25rem\"),\n\t\t\t\t\t\tminIs(\"1.25rem\"),\n\t\t\t\t\t\tpi(1.5),\n\t\t\t\t\t\trounded(\"sm\"),\n\t\t\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\t\t\tborder({ color: \"neutral\", width: 1 }),\n\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\ttext(\"xs\"),\n\t\t\t\t\t\tleading(\"none\"),\n\t\t\t\t\t\ttabularNums(),\n\t\t\t\t\t],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t/>\n\t\t);\n\t};\n}\n"
|
|
11
11
|
},
|
|
12
12
|
"test": null
|
|
13
13
|
}
|
package/registry/ui/label.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "label",
|
|
3
|
-
"changedIn": "2026.
|
|
3
|
+
"changedIn": "2026.11.1",
|
|
4
4
|
"dependencies": [],
|
|
5
5
|
"exports": [
|
|
6
6
|
"Label"
|
|
7
7
|
],
|
|
8
8
|
"source": {
|
|
9
9
|
"path": "label.tsx",
|
|
10
|
-
"content": "/**\n * A caption for a form control, associated with its field either through\n * the native `for`/`id` relationship (set `htmlFor` to the field's `id`) or\n * by wrapping the control as a child. It renders as a single line of\n * emphasized text at the library's default label size, weight, and color.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { fg } from \"@sdxc/u/color\";\nimport { fontSize, leading, weight } from \"@sdxc/u/typography\";\n\n/**\n * Prop types for {@link Label}.\n */\nexport namespace Label {\n\t/**\n\t * Every native `<label>` attribute, unchanged, plus the `mix` passthrough.\n\t * Renders at the library's default caption size, medium weight, and\n\t * emphasized neutral foreground; set `htmlFor` or nest the field as a child.\n\t */\n\texport interface Props extends TagProps<\"label\"> {}\n}\n\n/**\n * Renders its children inside a native `<label>` element, sized and colored\n * as a form field caption. Pair it with a field by setting `htmlFor` to the\n * field's `id`, or wrap the field directly so the platform associates them.\n *\n * @param handle Runtime handle carrying the host `<label>`'s props.\n * @returns The render function producing the label's markup.\n * @example\n * <Label htmlFor=\"email\">{t(\"form.email.label\")}</Label>\n * @example\n * <Label>\n * \t{t(\"form.newsletter.label\")}\n * \t<input type=\"checkbox\" name=\"newsletter\" />\n * </Label>\n */\nexport function Label(handle: Handle<Label.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<label\n\t\t\t\t{...rest}\n\t\t\t\tmix={[weight(\"medium\"), fg(\"neutral.emphasis\"), fontSize(\"sm\"), leading(\"none\")
|
|
10
|
+
"content": "/**\n * A caption for a form control, associated with its field either through\n * the native `for`/`id` relationship (set `htmlFor` to the field's `id`) or\n * by wrapping the control as a child. It renders as a single line of\n * emphasized text at the library's default label size, weight, and color.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { fg } from \"@sdxc/u/color\";\nimport { mergeMix } from \"@sdxc/u/general\";\nimport { fontSize, leading, weight } from \"@sdxc/u/typography\";\n\n/**\n * Prop types for {@link Label}.\n */\nexport namespace Label {\n\t/**\n\t * Every native `<label>` attribute, unchanged, plus the `mix` passthrough.\n\t * Renders at the library's default caption size, medium weight, and\n\t * emphasized neutral foreground; set `htmlFor` or nest the field as a child.\n\t */\n\texport interface Props extends TagProps<\"label\"> {}\n}\n\n/**\n * Renders its children inside a native `<label>` element, sized and colored\n * as a form field caption. Pair it with a field by setting `htmlFor` to the\n * field's `id`, or wrap the field directly so the platform associates them.\n *\n * @param handle Runtime handle carrying the host `<label>`'s props.\n * @returns The render function producing the label's markup.\n * @example\n * <Label htmlFor=\"email\">{t(\"form.email.label\")}</Label>\n * @example\n * <Label>\n * \t{t(\"form.newsletter.label\")}\n * \t<input type=\"checkbox\" name=\"newsletter\" />\n * </Label>\n */\nexport function Label(handle: Handle<Label.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<label\n\t\t\t\t{...rest}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[weight(\"medium\"), fg(\"neutral.emphasis\"), fontSize(\"sm\"), leading(\"none\")],\n\t\t\t\t\tmix,\n\t\t\t\t)}\n\t\t\t/>\n\t\t);\n\t};\n}\n"
|
|
11
11
|
},
|
|
12
12
|
"test": null
|
|
13
13
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "link-button",
|
|
3
|
-
"changedIn": "2026.
|
|
4
|
-
"dependencies": [
|
|
3
|
+
"changedIn": "2026.11.3",
|
|
4
|
+
"dependencies": [
|
|
5
|
+
"cta-group"
|
|
6
|
+
],
|
|
5
7
|
"exports": [
|
|
6
8
|
"LinkButton"
|
|
7
9
|
],
|
|
8
10
|
"source": {
|
|
9
11
|
"path": "link-button.tsx",
|
|
10
|
-
"content": "/**\n * A navigation action styled to read as a button rather than inline text —\n * \"View project\", \"Download\", a dialog's \"Cancel\" that also navigates away.\n * Its host renders as a native `<a>`, sharing {@link Button}'s semantic\n * color role, visual weight variant, and size so a link and a button placed\n * side by side render pixel-identical.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { opacity, rounded } from \"@sdxc/u/effects\";\nimport { cursor, pointerEvents, userSelect } from \"@sdxc/u/general\";\nimport { gap, inlineFlex, items, justify, shrink } from \"@sdxc/u/layout\";\nimport { bs, is, minBs, pb, pi, pie, pis } from \"@sdxc/u/size\";\nimport { active, data, hover, when } from \"@sdxc/u/state\";\nimport { text, weight } from \"@sdxc/u/typography\";\n\nimport type { LinkPrefetch } from \"@sdxc/ui/utils\";\nimport type { SemanticColor } from \"@sdxc/ui/utils\";\n\nimport { hitArea } from \"@sdxc/ui/styles\";\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\nimport { glyphEdges } from \"@sdxc/ui/utils\";\nimport { prefetchAttribute, rendersPrefetchHint } from \"@sdxc/ui/utils\";\n\n/** Semantic color role {@link LinkButton} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: LinkButton.Color = \"neutral\";\n\n/** Visual weight {@link LinkButton} falls back to when `variant` is omitted. */\nconst DEFAULT_VARIANT: LinkButton.Variant = \"solid\";\n\n/** Size variant {@link LinkButton} falls back to when `size` is omitted. */\nconst DEFAULT_SIZE: LinkButton.Size = \"md\";\n\n/** Prefetch mode {@link LinkButton} falls back to when `prefetch` is omitted. */\nconst DEFAULT_PREFETCH: LinkButton.Prefetch = \"none\";\n\n/**\n * Prop types for {@link LinkButton}.\n */\nexport namespace LinkButton {\n\t/**\n\t * Semantic color role, each mapped to its matching `--ui-*` variables.\n\t */\n\texport type Color = SemanticColor;\n\n\t/**\n\t * Visual weight the link renders with: a solid fill with an on-solid\n\t * foreground, a transparent fill with a strong colored border, or a fully\n\t * transparent fill with just a colored label.\n\t */\n\texport type Variant = \"solid\" | \"outline\" | \"ghost\";\n\n\t/**\n\t * Size variant controlling the link's padding and font size.\n\t * Marketing pairing: `\"sm\"` is ~32px for nav rows, `\"lg\"` is ~48px for\n\t * hero {@link CtaGroup} actions — keep those slots on different sizes.\n\t */\n\texport type Size = \"sm\" | \"md\" | \"lg\";\n\n\t/**\n\t * When the destination starts loading: on intent, once in the viewport, on\n\t * render through a `<link rel=\"prefetch\">` that also serves full-document\n\t * navigations, or only on navigation (`\"none\"`).\n\t */\n\texport type Prefetch = LinkPrefetch;\n\n\t/**\n\t * Props accepted by {@link LinkButton}. A type alias rather than an\n\t * interface, since the native anchor props resolve to an intersection\n\t * type that TypeScript can't use in an `extends` clause.\n\t */\n\texport type Props = TagProps<\"a\"> & {\n\t\t/** Semantic color role. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t\t/** Visual weight. Defaults to {@link DEFAULT_VARIANT}. */\n\t\tvariant?: Variant;\n\t\t/** Size variant. Defaults to {@link DEFAULT_SIZE}. */\n\t\tsize?: Size;\n\t\t/**\n\t\t * Prefetch mode, for links whose GET is safe to repeat. `\"render\"` suits\n\t\t * multi-page navigations; a list keeps it to its first few items, since each\n\t\t * hint is a request on page load. Defaults to {@link DEFAULT_PREFETCH}.\n\t\t */\n\t\tprefetch?: Prefetch;\n\t};\n}\n\n/**\n * Renders a native `<a>` host, colored and shaped through the same color,\n * variant, and size data attributes as {@link Button}. `aria-disabled=\"true\"`\n * keeps it focusable while dimmed, so drop `href` too for full inertness.\n *\n * @param handle Runtime handle carrying the host `<a>`'s props.\n * @returns The render function producing the link's markup.\n * @example\n * <LinkButton href=\"/projects/new\" prefetch=\"intent\">{t(\"actions.createProject\")}</LinkButton>\n * @example\n * <LinkButton href=\"/projects\" color=\"neutral\" variant=\"outline\" size=\"sm\">{t(\"actions.cancel\")}</LinkButton>\n * @example\n * <LinkButton href=\"/export/report.csv\" download aria-disabled={!hasReport || undefined}>{t(\"actions.download\")}</LinkButton>\n */\nexport function LinkButton(handle: Handle<LinkButton.Props>) {\n\treturn () => {\n\t\tlet { color, variant, size, prefetch, children, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\t\tlet resolvedVariant = variant ?? DEFAULT_VARIANT;\n\t\tlet resolvedSize = size ?? DEFAULT_SIZE;\n\t\tlet resolvedPrefetch = prefetch ?? DEFAULT_PREFETCH;\n\t\tlet edges = glyphEdges(children);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<a\n\t\t\t\t\t{...rest}\n\t\t\t\t\tdata-color={resolvedColor}\n\t\t\t\t\tdata-variant={resolvedVariant}\n\t\t\t\t\tdata-size={resolvedSize}\n\t\t\t\t\tdata-rmx-prefetch={prefetchAttribute(resolvedPrefetch)}\n\t\t\t\t\tdata-glyph-start={edges.start || undefined}\n\t\t\t\t\tdata-glyph-end={edges.end || undefined}\n\t\t\t\t\tmix={[\n\t\t\t\t\t\twhen(\"&:focus-visible\", [\n\t\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\t\tdata(\"color\", \"neutral\", outline(\"neutral.ring\")),\n\t\t\t\t\t\t\tdata(\"color\", \"success\", outline(\"success.ring\")),\n\t\t\t\t\t\t\tdata(\"color\", \"warning\", outline(\"warning.ring\")),\n\t\t\t\t\t\t\tdata(\"color\", \"danger\", outline(\"danger.ring\")),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\t\tinlineFlex(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\tgap(2),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * A glyph inside a link button is measured and held at size by the same rules\n\t\t\t\t\t\t * `Button` states, for the same reasons: it is sized against the label beside\n\t\t\t\t\t\t * it so the row keeps the height its text and padding ask for, and it never\n\t\t\t\t\t\t * shrinks, since the default `flex-shrink: 1` would compress the glyph rather\n\t\t\t\t\t\t * than the words and a squashed icon reads as a rendering fault.\n\t\t\t\t\t\t */\n\t\t\t\t\t\twhen(\"& > svg\", [shrink(), is(4), bs(4)]),\n\t\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\t\tweight(\"medium\"),\n\t\t\t\t\t\t/** A small control reaches `--ui-target-size` however a consumer positions it. */\n\t\t\t\t\t\thitArea({ anchor: \"flex-center\" }),\n\t\t\t\t\t\tpi(4),\n\t\t\t\t\t\tpb(2),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Every variant carries the same border width, colored to match its\n\t\t\t\t\t\t * own fill (transparent for ghost), so solid, outline, and ghost\n\t\t\t\t\t\t * render at the same footprint.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tborder({ width: 1 }),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The row measure is stated, so the control lines up with a field of the same size when\n\t\t\t\t\t\t * a Group fuses the two, and still grows when a long label wraps.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tminBs(\"2.5rem\"),\n\n\t\t\t\t\t\tdata(\"size\", \"sm\", [pi(3), pb(1.5), minBs(\"2rem\"), when(\"& > svg\", [is(3), bs(3)])]),\n\t\t\t\t\t\tdata(\"size\", \"lg\", [\n\t\t\t\t\t\t\tpi(5),\n\t\t\t\t\t\t\tpb(2.5),\n\t\t\t\t\t\t\ttext(\"base\"),\n\t\t\t\t\t\t\tminBs(\"3rem\"),\n\t\t\t\t\t\t\twhen(\"& > svg\", [is(5), bs(5)]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * A glyph beside a label carries its own side bearing, so the padding on that\n\t\t\t\t\t\t * side drops one step and the glyph and the words read as evenly inset.\n\t\t\t\t\t\t */\n\t\t\t\t\t\twhen(\"&[data-glyph-start]:has(> svg:first-child)\", [\n\t\t\t\t\t\t\tpis(3),\n\t\t\t\t\t\t\tdata(\"size\", \"sm\", pis(2)),\n\t\t\t\t\t\t\tdata(\"size\", \"lg\", pis(4)),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen(\"&[data-glyph-end]:has(> svg:last-child)\", [\n\t\t\t\t\t\t\tpie(3),\n\t\t\t\t\t\t\tdata(\"size\", \"sm\", pie(2)),\n\t\t\t\t\t\t\tdata(\"size\", \"lg\", pie(4)),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\tdata(\"variant\", \"solid\", [\n\t\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\t\tbg(\"brand.solid\"),\n\t\t\t\t\t\t\t\tborder(\"brand.solid\"),\n\t\t\t\t\t\t\t\tfg(\"brand.onSolid\"),\n\t\t\t\t\t\t\t\thover([bg(\"brand.bg-solid-hover\"), border(\"brand.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\tactive([bg(\"brand.bg-solid-pressed\"), border(\"brand.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\t\tbg(\"neutral.solid\"),\n\t\t\t\t\t\t\t\tborder(\"neutral.solid\"),\n\t\t\t\t\t\t\t\tfg(\"neutral.onSolid\"),\n\t\t\t\t\t\t\t\thover([bg(\"neutral.bg-solid-hover\"), border(\"neutral.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\tactive([bg(\"neutral.bg-solid-pressed\"), border(\"neutral.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\t\tbg(\"success.solid\"),\n\t\t\t\t\t\t\t\tborder(\"success.solid\"),\n\t\t\t\t\t\t\t\tfg(\"success.onSolid\"),\n\t\t\t\t\t\t\t\thover([bg(\"success.bg-solid-hover\"), border(\"success.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\tactive([bg(\"success.bg-solid-pressed\"), border(\"success.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\t\tbg(\"warning.solid\"),\n\t\t\t\t\t\t\t\tborder(\"warning.solid\"),\n\t\t\t\t\t\t\t\tfg(\"warning.onSolid\"),\n\t\t\t\t\t\t\t\thover([bg(\"warning.bg-solid-hover\"), border(\"warning.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\tactive([bg(\"warning.bg-solid-pressed\"), border(\"warning.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\t\tbg(\"danger.solid\"),\n\t\t\t\t\t\t\t\tborder(\"danger.solid\"),\n\t\t\t\t\t\t\t\tfg(\"danger.onSolid\"),\n\t\t\t\t\t\t\t\thover([bg(\"danger.bg-solid-hover\"), border(\"danger.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\tactive([bg(\"danger.bg-solid-pressed\"), border(\"danger.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\tdata(\"variant\", \"outline\", [\n\t\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\t\tborder(\"brand\"),\n\t\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\t\thover([bg(\"brand.tint\"), border(\"brand.border-hover\")]),\n\t\t\t\t\t\t\t\tactive(bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\t\tborder(\"neutral\"),\n\t\t\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\t\t\thover([bg(\"neutral.tint\"), border(\"neutral.border-hover\")]),\n\t\t\t\t\t\t\t\tactive(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\t\tborder(\"success\"),\n\t\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\t\thover([bg(\"success.tint\"), border(\"success.border-hover\")]),\n\t\t\t\t\t\t\t\tactive(bg(\"success.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\t\tborder(\"warning\"),\n\t\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\t\thover([bg(\"warning.tint\"), border(\"warning.border-hover\")]),\n\t\t\t\t\t\t\t\tactive(bg(\"warning.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\t\tborder(\"danger\"),\n\t\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\t\thover([bg(\"danger.tint\"), border(\"danger.border-hover\")]),\n\t\t\t\t\t\t\t\tactive(bg(\"danger.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"variant\", \"outline\", bg(\"transparent\")),\n\n\t\t\t\t\t\tdata(\"variant\", \"ghost\", [\n\t\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\t\thover(bg(\"brand.tint\")),\n\t\t\t\t\t\t\t\tactive(bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\t\tfg(\"neutral\"),\n\t\t\t\t\t\t\t\thover(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\t\t\tactive(bg(\"neutral.bg-tint-pressed\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\t\thover(bg(\"success.tint\")),\n\t\t\t\t\t\t\t\tactive(bg(\"success.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\t\thover(bg(\"warning.tint\")),\n\t\t\t\t\t\t\t\tactive(bg(\"warning.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\t\thover(bg(\"danger.tint\")),\n\t\t\t\t\t\t\t\tactive(bg(\"danger.bg-tint-hover\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tdata(\"variant\", \"ghost\", [bg(\"transparent\"), border(\"transparent\")]),\n\n\t\t\t\t\t\twhen('&[aria-disabled=\"true\"]', opacity(50)),\n\t\t\t\t\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), pointerEvents()]),\n\n\t\t\t\t\t\tcursor(\"default\"),\n\t\t\t\t\t\tuserSelect(),\n\n\t\t\t\t\t\ttext(\"sm\"),\n\n\t\t\t\t\t\tdata(\"size\", \"sm\", text(\"xs\")),\n\t\t\t\t\t\tmix,\n\t\t\t\t\t]}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</a>\n\t\t\t\t{rendersPrefetchHint(resolvedPrefetch, rest.href) && (\n\t\t\t\t\t<link rel=\"prefetch\" href={rest.href} />\n\t\t\t\t)}\n\t\t\t</>\n\t\t);\n\t};\n}\n"
|
|
12
|
+
"content": "/**\n * A navigation action styled to read as a button rather than inline text —\n * \"View project\", \"Download\", a dialog's \"Cancel\" that also navigates away.\n * Its host renders as a native `<a>`, sharing {@link Button}'s semantic\n * color role, visual weight variant, and size so a link and a button placed\n * side by side render pixel-identical.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle, Props as TagProps } from \"remix/component\";\n\nimport { bg, border, fg, outline } from \"@sdxc/u/color\";\nimport { opacity } from \"@sdxc/u/effects\";\nimport { cursor, pointerEvents, raw, userSelect, mergeMix } from \"@sdxc/u/general\";\nimport { gap, inlineFlex, items, justify, shrink } from \"@sdxc/u/layout\";\nimport { bs, is, minBs, pb, pi, pie, pis } from \"@sdxc/u/size\";\nimport { active, data, hover, when } from \"@sdxc/u/state\";\nimport { text } from \"@sdxc/u/typography\";\n\nimport type { LinkPrefetch } from \"@sdxc/ui/utils\";\nimport type { SemanticColor } from \"@sdxc/ui/utils\";\n\nimport { hitArea } from \"@sdxc/ui/styles\";\nimport { interactiveTransition } from \"@sdxc/ui/styles\";\nimport { surfaceControl } from \"@sdxc/ui/styles\";\nimport { glyphEdges } from \"@sdxc/ui/utils\";\nimport { prefetchAttribute, rendersPrefetchHint } from \"@sdxc/ui/utils\";\n\nimport { CtaGroup } from \"@sdxc/ui/cta-group\";\n\n/** Semantic color role {@link LinkButton} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: LinkButton.Color = \"neutral\";\n\n/** Visual weight {@link LinkButton} falls back to when `variant` is omitted. */\nconst DEFAULT_VARIANT: LinkButton.Variant = \"solid\";\n\n/** Size variant {@link LinkButton} falls back to when `size` is omitted. */\nconst DEFAULT_SIZE: LinkButton.Size = \"md\";\n\n/** Prefetch mode {@link LinkButton} falls back to when `prefetch` is omitted. */\nconst DEFAULT_PREFETCH: LinkButton.Prefetch = \"none\";\n\n/**\n * Prop types for {@link LinkButton}.\n */\nexport namespace LinkButton {\n\t/**\n\t * Semantic color role, each mapped to its matching `--ui-*` variables.\n\t */\n\texport type Color = SemanticColor;\n\n\t/**\n\t * Visual weight the link renders with: a solid fill with an on-solid\n\t * foreground, a transparent fill with a strong colored border, a fully\n\t * transparent fill with just a colored label, or a raised `surface` fill with\n\t * the emphasis ink and a tactile edge — a secondary that reads as a control\n\t * beside a solid primary, and turns translucent inside inverse and brand bands.\n\t */\n\texport type Variant = \"solid\" | \"outline\" | \"ghost\" | \"surface\";\n\n\t/**\n\t * Size variant controlling the link's padding and font size.\n\t * Inside a {@link CtaGroup} an omitted size takes the group's, so a hero row\n\t * sizes every action at once; `\"md\"` is the 40px landing CTA.\n\t */\n\texport type Size = \"sm\" | \"md\" | \"lg\";\n\n\t/**\n\t * When the destination starts loading: on intent, once in the viewport, on\n\t * render through a `<link rel=\"prefetch\">` that also serves full-document\n\t * navigations, or only on navigation (`\"none\"`).\n\t */\n\texport type Prefetch = LinkPrefetch;\n\n\t/**\n\t * Props accepted by {@link LinkButton}. A type alias rather than an\n\t * interface, since the native anchor props resolve to an intersection\n\t * type that TypeScript can't use in an `extends` clause.\n\t */\n\texport type Props = TagProps<\"a\"> & {\n\t\t/** Semantic color role. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t\t/** Visual weight. Defaults to {@link DEFAULT_VARIANT}. */\n\t\tvariant?: Variant;\n\t\t/** Size variant. Defaults to {@link DEFAULT_SIZE}. */\n\t\tsize?: Size;\n\t\t/**\n\t\t * Prefetch mode, for links whose GET is safe to repeat. `\"render\"` suits\n\t\t * multi-page navigations; a list keeps it to its first few items, since each\n\t\t * hint is a request on page load. Defaults to {@link DEFAULT_PREFETCH}.\n\t\t */\n\t\tprefetch?: Prefetch;\n\t};\n}\n\n/**\n * Renders a native `<a>` host, colored and shaped through the same color,\n * variant, and size data attributes as {@link Button}. `aria-disabled=\"true\"`\n * keeps it focusable while dimmed, so drop `href` too for full inertness.\n *\n * @param handle Runtime handle carrying the host `<a>`'s props.\n * @returns The render function producing the link's markup.\n * @example\n * <LinkButton href=\"/projects/new\" prefetch=\"intent\">{t(\"actions.createProject\")}</LinkButton>\n * @example\n * <LinkButton href=\"/projects\" color=\"neutral\" variant=\"outline\" size=\"sm\">{t(\"actions.cancel\")}</LinkButton>\n * @example\n * <LinkButton href=\"/export/report.csv\" download aria-disabled={!hasReport || undefined}>{t(\"actions.download\")}</LinkButton>\n */\nexport function LinkButton(handle: Handle<LinkButton.Props>) {\n\treturn () => {\n\t\tlet { color, variant, size, prefetch, children, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\t\tlet resolvedVariant = variant ?? DEFAULT_VARIANT;\n\t\tlet group = handle.context.get(CtaGroup) as CtaGroup.Context | undefined;\n\t\tlet resolvedSize = size ?? group?.size ?? DEFAULT_SIZE;\n\t\tlet resolvedPrefetch = prefetch ?? DEFAULT_PREFETCH;\n\t\tlet edges = glyphEdges(children);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<a\n\t\t\t\t\t{...rest}\n\t\t\t\t\tdata-color={resolvedColor}\n\t\t\t\t\tdata-variant={resolvedVariant}\n\t\t\t\t\tdata-size={resolvedSize}\n\t\t\t\t\tdata-rmx-prefetch={prefetchAttribute(resolvedPrefetch)}\n\t\t\t\t\tdata-glyph-start={edges.start || undefined}\n\t\t\t\t\tdata-glyph-end={edges.end || undefined}\n\t\t\t\t\tmix={mergeMix(\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\twhen(\"&:focus-visible\", [\n\t\t\t\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\t\t\t\tdata(\"color\", \"neutral\", outline(\"neutral.ring\")),\n\t\t\t\t\t\t\t\tdata(\"color\", \"success\", outline(\"success.ring\")),\n\t\t\t\t\t\t\t\tdata(\"color\", \"warning\", outline(\"warning.ring\")),\n\t\t\t\t\t\t\t\tdata(\"color\", \"danger\", outline(\"danger.ring\")),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\tinteractiveTransition(),\n\t\t\t\t\t\t\tinlineFlex(),\n\t\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\t\t\tgap(2),\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * A glyph inside a link button is measured and held at size by the same rules\n\t\t\t\t\t\t\t * `Button` states, for the same reasons: it is sized against the label beside\n\t\t\t\t\t\t\t * it so the row keeps the height its text and padding ask for, and it never\n\t\t\t\t\t\t\t * shrinks, since the default `flex-shrink: 1` would compress the glyph rather\n\t\t\t\t\t\t\t * than the words and a squashed icon reads as a rendering fault.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\twhen(\"& > svg\", [shrink(), is(4), bs(4)]),\n\t\t\t\t\t\t\traw({\n\t\t\t\t\t\t\t\tborderRadius: \"var(--ui-button-radius, var(--ui-radius-md, 0.375rem))\",\n\t\t\t\t\t\t\t\tfontWeight: \"var(--ui-button-weight, 500)\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t/** A small control reaches `--ui-target-size` however a consumer positions it. */\n\t\t\t\t\t\t\thitArea({ anchor: \"flex-center\" }),\n\t\t\t\t\t\t\tpi(4),\n\t\t\t\t\t\t\tpb(2),\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * Every variant carries the same border width, colored to match its\n\t\t\t\t\t\t\t * own fill (transparent for ghost), so solid, outline, and ghost\n\t\t\t\t\t\t\t * render at the same footprint.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tborder({ width: 1 }),\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * The row measure is stated, so the control lines up with a field of the same size when\n\t\t\t\t\t\t\t * a Group fuses the two, and still grows when a long label wraps.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tminBs(\"2.5rem\"),\n\n\t\t\t\t\t\t\tdata(\"size\", \"sm\", [pi(3), pb(1.5), minBs(\"2rem\"), when(\"& > svg\", [is(3), bs(3)])]),\n\t\t\t\t\t\t\tdata(\"size\", \"lg\", [\n\t\t\t\t\t\t\t\tpi(5),\n\t\t\t\t\t\t\t\tpb(2.5),\n\t\t\t\t\t\t\t\ttext(\"base\"),\n\t\t\t\t\t\t\t\tminBs(\"3rem\"),\n\t\t\t\t\t\t\t\twhen(\"& > svg\", [is(5), bs(5)]),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * A glyph beside a label carries its own side bearing, so the padding on that\n\t\t\t\t\t\t\t * side drops one step and the glyph and the words read as evenly inset.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\twhen(\"&[data-glyph-start]:has(> svg:first-child)\", [\n\t\t\t\t\t\t\t\tpis(3),\n\t\t\t\t\t\t\t\tdata(\"size\", \"sm\", pis(2)),\n\t\t\t\t\t\t\t\tdata(\"size\", \"lg\", pis(4)),\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\twhen(\"&[data-glyph-end]:has(> svg:last-child)\", [\n\t\t\t\t\t\t\t\tpie(3),\n\t\t\t\t\t\t\t\tdata(\"size\", \"sm\", pie(2)),\n\t\t\t\t\t\t\t\tdata(\"size\", \"lg\", pie(4)),\n\t\t\t\t\t\t\t]),\n\n\t\t\t\t\t\t\tdata(\"variant\", \"solid\", [\n\t\t\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\t\t\tbg(\"brand.solid\"),\n\t\t\t\t\t\t\t\t\tborder(\"brand.solid\"),\n\t\t\t\t\t\t\t\t\tfg(\"brand.onSolid\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"brand.bg-solid-hover\"), border(\"brand.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\t\tactive([bg(\"brand.bg-solid-pressed\"), border(\"brand.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\t\t\tbg(\"neutral.solid\"),\n\t\t\t\t\t\t\t\t\tborder(\"neutral.solid\"),\n\t\t\t\t\t\t\t\t\tfg(\"neutral.onSolid\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"neutral.bg-solid-hover\"), border(\"neutral.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\t\tactive([bg(\"neutral.bg-solid-pressed\"), border(\"neutral.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\t\t\tbg(\"success.solid\"),\n\t\t\t\t\t\t\t\t\tborder(\"success.solid\"),\n\t\t\t\t\t\t\t\t\tfg(\"success.onSolid\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"success.bg-solid-hover\"), border(\"success.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\t\tactive([bg(\"success.bg-solid-pressed\"), border(\"success.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\t\t\tbg(\"warning.solid\"),\n\t\t\t\t\t\t\t\t\tborder(\"warning.solid\"),\n\t\t\t\t\t\t\t\t\tfg(\"warning.onSolid\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"warning.bg-solid-hover\"), border(\"warning.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\t\tactive([bg(\"warning.bg-solid-pressed\"), border(\"warning.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\t\t\tbg(\"danger.solid\"),\n\t\t\t\t\t\t\t\t\tborder(\"danger.solid\"),\n\t\t\t\t\t\t\t\t\tfg(\"danger.onSolid\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"danger.bg-solid-hover\"), border(\"danger.bg-solid-hover\")]),\n\t\t\t\t\t\t\t\t\tactive([bg(\"danger.bg-solid-pressed\"), border(\"danger.bg-solid-pressed\")]),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t]),\n\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * Each variant's resting fill sits in the same block as its hover and active\n\t\t\t\t\t\t\t * fills, so the state rules win on specificity and keep winning whatever order\n\t\t\t\t\t\t\t * a page first uses the classes in.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tdata(\"variant\", \"outline\", [\n\t\t\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\t\t\tborder(\"brand\"),\n\t\t\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"brand.tint\"), border(\"brand.border-hover\")]),\n\t\t\t\t\t\t\t\t\tactive(bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\t\t\tborder(\"neutral\"),\n\t\t\t\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"neutral.tint\"), border(\"neutral.border-hover\")]),\n\t\t\t\t\t\t\t\t\tactive(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\t\t\tborder(\"success\"),\n\t\t\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"success.tint\"), border(\"success.border-hover\")]),\n\t\t\t\t\t\t\t\t\tactive(bg(\"success.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\t\t\tborder(\"warning\"),\n\t\t\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"warning.tint\"), border(\"warning.border-hover\")]),\n\t\t\t\t\t\t\t\t\tactive(bg(\"warning.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\t\t\tborder(\"danger\"),\n\t\t\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\t\t\thover([bg(\"danger.tint\"), border(\"danger.border-hover\")]),\n\t\t\t\t\t\t\t\t\tactive(bg(\"danger.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t]),\n\n\t\t\t\t\t\t\tdata(\"variant\", \"ghost\", [\n\t\t\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\t\t\tborder(\"transparent\"),\n\t\t\t\t\t\t\t\tdata(\"color\", \"brand\", [\n\t\t\t\t\t\t\t\t\tfg(\"brand\"),\n\t\t\t\t\t\t\t\t\thover(bg(\"brand.tint\")),\n\t\t\t\t\t\t\t\t\tactive(bg(\"brand.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"neutral\", [\n\t\t\t\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\t\t\t\thover(bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t\tactive(bg(\"neutral.bg-tint-pressed\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"success\", [\n\t\t\t\t\t\t\t\t\tfg(\"success\"),\n\t\t\t\t\t\t\t\t\thover(bg(\"success.tint\")),\n\t\t\t\t\t\t\t\t\tactive(bg(\"success.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"warning\", [\n\t\t\t\t\t\t\t\t\tfg(\"warning\"),\n\t\t\t\t\t\t\t\t\thover(bg(\"warning.tint\")),\n\t\t\t\t\t\t\t\t\tactive(bg(\"warning.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\tdata(\"color\", \"danger\", [\n\t\t\t\t\t\t\t\t\tfg(\"danger\"),\n\t\t\t\t\t\t\t\t\thover(bg(\"danger.tint\")),\n\t\t\t\t\t\t\t\t\tactive(bg(\"danger.bg-tint-hover\")),\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t]),\n\n\t\t\t\t\t\t\tdata(\"variant\", \"surface\", surfaceControl()),\n\n\t\t\t\t\t\t\twhen('&[aria-disabled=\"true\"]', opacity(50)),\n\t\t\t\t\t\t\twhen('&[aria-disabled=\"true\"]', [cursor(\"not-allowed\"), pointerEvents()]),\n\n\t\t\t\t\t\t\tcursor(\"default\"),\n\t\t\t\t\t\t\tuserSelect(),\n\n\t\t\t\t\t\t\ttext(\"sm\"),\n\n\t\t\t\t\t\t\tdata(\"size\", \"sm\", text(\"xs\")),\n\t\t\t\t\t\t],\n\t\t\t\t\t\tmix,\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</a>\n\t\t\t\t{rendersPrefetchHint(resolvedPrefetch, rest.href) && (\n\t\t\t\t\t<link rel=\"prefetch\" href={rest.href} />\n\t\t\t\t)}\n\t\t\t</>\n\t\t);\n\t};\n}\n"
|
|
11
13
|
},
|
|
12
14
|
"test": {
|
|
13
15
|
"path": "link-button.test.tsx",
|