@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": "search-field",
|
|
3
|
-
"changedIn": "2026.
|
|
3
|
+
"changedIn": "2026.11.1",
|
|
4
4
|
"dependencies": [
|
|
5
5
|
"button",
|
|
6
6
|
"input"
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
],
|
|
11
11
|
"source": {
|
|
12
12
|
"path": "search-field.tsx",
|
|
13
|
-
"content": "/**\n * A single-line search field: a `<search>` landmark stacking a caption, a\n * decorated control, and optional supporting or validation copy, composed\n * from whatever compound parts a given field needs. Its own\n * {@link SearchField.Input} part pairs a leading glyph with the native\n * `<input type=\"search\">` control it decorates, building on {@link Input} for\n * that control's box, color, and state styling, and\n * {@link SearchField.Control} rows that input with the\n * {@link SearchField.Clear} button that empties it.\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 { SearchIcon, XIcon } from \"@sdxc/icons\";\nimport { fg } from \"@sdxc/u/color\";\nimport { rounded } from \"@sdxc/u/effects\";\nimport { pointerEvents } from \"@sdxc/u/general\";\nimport {\n\tabsolute,\n\tappearance,\n\tflex,\n\tgrow,\n\thidden,\n\tinsBs,\n\tinsIe,\n\tinsIs,\n\titems,\n\trelative,\n} from \"@sdxc/u/layout\";\nimport { bs, is, p, pis } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { translateY } from \"@sdxc/u/transform\";\n\nimport { clearField, SEARCH_FIELD_CLEAR_COMMAND } from \"@sdxc/ui/mixins\";\nimport { fieldStackLayout } from \"@sdxc/ui/styles\";\n\nimport { Button } from \"@sdxc/ui/button\";\nimport { Input } from \"@sdxc/ui/input\";\n\n/**\n * Prop types for {@link SearchField} and its compound parts.\n */\nexport namespace SearchField {\n\t/**\n\t * Every native `<search>` attribute, unchanged, plus the `mix` passthrough.\n\t * `children` composes this field's parts — typically a caption, the\n\t * {@link SearchField.Input} control, and validation copy — in a single column.\n\t */\n\texport interface Props extends TagProps<\"search\"> {\n\t\t/** The field's compound parts: a caption, the control, and any supporting or validation copy. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Every prop {@link Input} accepts except `type`, `list`, and `role`,\n\t * which this control fixes to `\"search\"` and the platform's own implicit\n\t * `searchbox` role on the consumer's behalf, plus the `mix` passthrough.\n\t */\n\texport interface InputProps extends Omit<Input.Props, \"type\" | \"list\" | \"role\"> {}\n\n\t/**\n\t * Every native `<div>` attribute, unchanged, plus the `mix` passthrough.\n\t * `children` holds one control row: the {@link SearchField.Input} and the\n\t * {@link SearchField.Clear} button that empties it.\n\t */\n\texport interface ControlProps extends TagProps<\"div\"> {\n\t\t/** The row's contents: the search input, and the clear button reading it. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Every prop {@link Button} accepts except `type`, `variant`, `size`, and\n\t * `command`, which this control fixes on the consumer's behalf, plus the\n\t * `mix` passthrough.\n\t */\n\texport interface ClearProps extends Omit<\n\t\tButton.Props,\n\t\t\"type\" | \"variant\" | \"size\" | \"command\" | \"children\"\n\t> {\n\t\t/** The `id` of the input this button empties, naming the control it belongs to. */\n\t\tcommandfor: string;\n\t\t/** Glyph or label the button shows. Defaults to a decorative {@link XIcon}. */\n\t\tchildren?: RemixNode;\n\t}\n}\n\n/**\n * Renders a `<search>` landmark — the platform's own role for a search\n * region, needing no explicit `role` attribute — stacking a caption,\n * {@link SearchField.Input}, and validation copy in a single column.\n *\n * @param handle Runtime handle carrying the host `<search>`'s props.\n * @returns The render function producing the field's markup.\n * @example\n * <SearchField>\n * \t<Label htmlFor=\"site-search\">{t(\"search.label\")}</Label>\n * \t<SearchField.Input id=\"site-search\" name=\"q\" placeholder={t(\"search.placeholder\")} />\n * </SearchField>\n * @example\n * <SearchField aria-label={t(\"search.label\")}>\n * \t<SearchField.Input name=\"q\" />\n * </SearchField>\n */\nexport function SearchField(handle: Handle<SearchField.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <search {...rest} data-slot=\"search-field\" mix={
|
|
13
|
+
"content": "/**\n * A single-line search field: a `<search>` landmark stacking a caption, a\n * decorated control, and optional supporting or validation copy, composed\n * from whatever compound parts a given field needs. Its own\n * {@link SearchField.Input} part pairs a leading glyph with the native\n * `<input type=\"search\">` control it decorates, building on {@link Input} for\n * that control's box, color, and state styling, and\n * {@link SearchField.Control} rows that input with the\n * {@link SearchField.Clear} button that empties it.\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 { SearchIcon, XIcon } from \"@sdxc/icons\";\nimport { fg } from \"@sdxc/u/color\";\nimport { rounded } from \"@sdxc/u/effects\";\nimport { pointerEvents, mergeMix } from \"@sdxc/u/general\";\nimport {\n\tabsolute,\n\tappearance,\n\tflex,\n\tgrow,\n\thidden,\n\tinsBs,\n\tinsIe,\n\tinsIs,\n\titems,\n\trelative,\n} from \"@sdxc/u/layout\";\nimport { bs, is, p, pis } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { translateY } from \"@sdxc/u/transform\";\n\nimport { clearField, SEARCH_FIELD_CLEAR_COMMAND } from \"@sdxc/ui/mixins\";\nimport { fieldStackLayout } from \"@sdxc/ui/styles\";\n\nimport { Button } from \"@sdxc/ui/button\";\nimport { Input } from \"@sdxc/ui/input\";\n\n/**\n * Prop types for {@link SearchField} and its compound parts.\n */\nexport namespace SearchField {\n\t/**\n\t * Every native `<search>` attribute, unchanged, plus the `mix` passthrough.\n\t * `children` composes this field's parts — typically a caption, the\n\t * {@link SearchField.Input} control, and validation copy — in a single column.\n\t */\n\texport interface Props extends TagProps<\"search\"> {\n\t\t/** The field's compound parts: a caption, the control, and any supporting or validation copy. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Every prop {@link Input} accepts except `type`, `list`, and `role`,\n\t * which this control fixes to `\"search\"` and the platform's own implicit\n\t * `searchbox` role on the consumer's behalf, plus the `mix` passthrough.\n\t */\n\texport interface InputProps extends Omit<Input.Props, \"type\" | \"list\" | \"role\"> {}\n\n\t/**\n\t * Every native `<div>` attribute, unchanged, plus the `mix` passthrough.\n\t * `children` holds one control row: the {@link SearchField.Input} and the\n\t * {@link SearchField.Clear} button that empties it.\n\t */\n\texport interface ControlProps extends TagProps<\"div\"> {\n\t\t/** The row's contents: the search input, and the clear button reading it. */\n\t\tchildren: RemixNode;\n\t}\n\n\t/**\n\t * Every prop {@link Button} accepts except `type`, `variant`, `size`, and\n\t * `command`, which this control fixes on the consumer's behalf, plus the\n\t * `mix` passthrough.\n\t */\n\texport interface ClearProps extends Omit<\n\t\tButton.Props,\n\t\t\"type\" | \"variant\" | \"size\" | \"command\" | \"children\"\n\t> {\n\t\t/** The `id` of the input this button empties, naming the control it belongs to. */\n\t\tcommandfor: string;\n\t\t/** Glyph or label the button shows. Defaults to a decorative {@link XIcon}. */\n\t\tchildren?: RemixNode;\n\t}\n}\n\n/**\n * Renders a `<search>` landmark — the platform's own role for a search\n * region, needing no explicit `role` attribute — stacking a caption,\n * {@link SearchField.Input}, and validation copy in a single column.\n *\n * @param handle Runtime handle carrying the host `<search>`'s props.\n * @returns The render function producing the field's markup.\n * @example\n * <SearchField>\n * \t<Label htmlFor=\"site-search\">{t(\"search.label\")}</Label>\n * \t<SearchField.Input id=\"site-search\" name=\"q\" placeholder={t(\"search.placeholder\")} />\n * </SearchField>\n * @example\n * <SearchField aria-label={t(\"search.label\")}>\n * \t<SearchField.Input name=\"q\" />\n * </SearchField>\n */\nexport function SearchField(handle: Handle<SearchField.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <search {...rest} data-slot=\"search-field\" mix={mergeMix(fieldStackLayout(), mix)} />;\n\t};\n}\n\n/**\n * Renders {@link SearchField}'s control: a positioning wrapper pairing a\n * muted, decorative {@link SearchIcon} with a native `<input type=\"search\">`\n * built on {@link Input}, inheriting its box, color, and state styling.\n *\n * The user agent's own cancel affordance is suppressed, so clearing the field is\n * {@link SearchField.Clear}'s job — one glyph the field styles and places, sitting\n * alone in the trailing corner.\n *\n * @param handle Runtime handle carrying the host `<input>`'s props.\n * @returns The render function producing the control's markup.\n * @example\n * <SearchField.Input aria-label={t(\"search.label\")} placeholder={t(\"search.placeholder\")} />\n * @example\n * <SearchField.Input name=\"q\" color=\"brand\" defaultValue=\"remix\" />\n */\nSearchField.Input = function SearchFieldInput(handle: Handle<SearchField.InputProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div data-slot=\"input-wrapper\" mix={[relative(), flex(), items(\"center\")]}>\n\t\t\t\t<SearchIcon\n\t\t\t\t\tsize={16}\n\t\t\t\t\tdata-slot=\"icon\"\n\t\t\t\t\tmix={[absolute(), insIs(\"0.75rem\"), pointerEvents(), fg(\"neutral.muted\")]}\n\t\t\t\t/>\n\t\t\t\t<Input\n\t\t\t\t\ttype=\"search\"\n\t\t\t\t\t{...rest}\n\t\t\t\t\tmix={mergeMix(\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\tpis(\"2.25rem\"),\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * {@link SearchField.Clear} draws the clear affordance, so the one the user agent draws\n\t\t\t\t\t\t\t * inside a search input holding a value is hidden to keep the two from stacking.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\twhen(\"&::-webkit-search-cancel-button\", [appearance(\"none\"), hidden()]),\n\t\t\t\t\t\t\twhen(\"&::-webkit-search-decoration\", [appearance(\"none\"), hidden()]),\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</div>\n\t\t);\n\t};\n};\n\n/**\n * Renders the row holding {@link SearchField.Input} and the\n * {@link SearchField.Clear} button beside it, and the positioning context that\n * anchors the clear button to the input's trailing edge.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the control row's markup.\n * @example\n * <SearchField.Control>\n * \t<SearchField.Input id=\"site-search\" name=\"q\" />\n * \t<SearchField.Clear commandfor=\"site-search\" aria-label={t(\"search.clear\")} />\n * </SearchField.Control>\n */\nSearchField.Control = function SearchFieldControl(handle: Handle<SearchField.ControlProps>) {\n\treturn () => {\n\t\tlet { 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=\"control\"\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\tflex(),\n\t\t\t\t\t\titems(\"center\"),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The input spans the row, so the field keeps the width its container offers.\n\t\t\t\t\t\t */\n\t\t\t\t\t\twhen('& > [data-slot=\"input-wrapper\"]', grow()),\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 {@link SearchField}'s clear button: a round, icon-sized ghost\n * {@link Button} centred on the input's trailing edge, carrying `clearField()`\n * so it empties the `commandfor` input it names and shows while that input holds text.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the clear button's markup.\n * @example\n * <SearchField.Clear commandfor=\"site-search\" aria-label={t(\"search.clear\")} />\n * @example\n * <SearchField.Clear commandfor=\"site-search\">{t(\"search.clear\")}</SearchField.Clear>\n */\nSearchField.Clear = function SearchFieldClear(handle: Handle<SearchField.ClearProps>) {\n\treturn () => {\n\t\tlet { children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<Button\n\t\t\t\ttype=\"button\"\n\t\t\t\t{...rest}\n\t\t\t\thidden\n\t\t\t\tvariant=\"ghost\"\n\t\t\t\tsize=\"sm\"\n\t\t\t\tcommand={SEARCH_FIELD_CLEAR_COMMAND}\n\t\t\t\tdata-slot=\"clear\"\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tclearField(),\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * A round, icon-sized target centred on the field, so its hover tint reads as a\n\t\t\t\t\t\t * disc beside the text, and its glyph sits as far from the trailing edge as the\n\t\t\t\t\t\t * search glyph sits from the leading one.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tis(7),\n\t\t\t\t\t\tbs(7),\n\t\t\t\t\t\tp(0),\n\t\t\t\t\t\trounded(\"full\"),\n\t\t\t\t\t\tabsolute(),\n\t\t\t\t\t\tinsIe(\"0.375rem\"),\n\t\t\t\t\t\tinsBs(\"50%\"),\n\t\t\t\t\t\ttranslateY(\"-50%\"),\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 ?? <XIcon size={16} />}\n\t\t\t</Button>\n\t\t);\n\t};\n};\n"
|
|
14
14
|
},
|
|
15
15
|
"test": null
|
|
16
16
|
}
|
package/registry/ui/section.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "section",
|
|
3
|
-
"changedIn": "2026.
|
|
3
|
+
"changedIn": "2026.11.1",
|
|
4
4
|
"dependencies": [],
|
|
5
5
|
"exports": [
|
|
6
6
|
"Section"
|
|
7
7
|
],
|
|
8
8
|
"source": {
|
|
9
9
|
"path": "section.tsx",
|
|
10
|
-
"content": "/**\n * A grouping wrapper for a set of related items inside a listbox, menu, or\n * combobox — a native `<section>` element carrying the small block-axis\n * padding that sets one group apart from the next. Pairing it with a\n * `Header` as its first child gives the group a visible 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 { pb } from \"@sdxc/u/size\";\n\n/**\n * Props accepted by {@link Section}.\n */\nexport namespace Section {\n\t/**\n\t * Every native `<section>` attribute, unchanged, plus the `mix`\n\t * passthrough. Content is whatever `children` the consumer supplies,\n\t * most often a `Header` label followed by the group's items.\n\t */\n\texport interface Props extends TagProps<\"section\"> {}\n}\n\n/**\n * Renders its children inside a `<section>` element with small block-axis\n * padding, separating one group of items from its siblings inside a\n * listbox, menu, or combobox; pair it with a `Header` to label the group.\n *\n * @param handle Runtime handle carrying the host `<section>`'s props.\n * @returns The render function producing the group's markup.\n * @example\n * <Section aria-labelledby=\"account-heading\">\n * \t<Header id=\"account-heading\">{t(\"settings.account\")}</Header>\n * \t<ListBox.Item id=\"profile\">{t(\"settings.profile\")}</ListBox.Item>\n * \t<ListBox.Item id=\"billing\">{t(\"settings.billing\")}</ListBox.Item>\n * </Section>\n */\nexport function Section(handle: Handle<Section.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <section {...rest} mix={
|
|
10
|
+
"content": "/**\n * A grouping wrapper for a set of related items inside a listbox, menu, or\n * combobox — a native `<section>` element carrying the small block-axis\n * padding that sets one group apart from the next. Pairing it with a\n * `Header` as its first child gives the group a visible 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 { mergeMix } from \"@sdxc/u/general\";\nimport { pb } from \"@sdxc/u/size\";\n\n/**\n * Props accepted by {@link Section}.\n */\nexport namespace Section {\n\t/**\n\t * Every native `<section>` attribute, unchanged, plus the `mix`\n\t * passthrough. Content is whatever `children` the consumer supplies,\n\t * most often a `Header` label followed by the group's items.\n\t */\n\texport interface Props extends TagProps<\"section\"> {}\n}\n\n/**\n * Renders its children inside a `<section>` element with small block-axis\n * padding, separating one group of items from its siblings inside a\n * listbox, menu, or combobox; pair it with a `Header` to label the group.\n *\n * @param handle Runtime handle carrying the host `<section>`'s props.\n * @returns The render function producing the group's markup.\n * @example\n * <Section aria-labelledby=\"account-heading\">\n * \t<Header id=\"account-heading\">{t(\"settings.account\")}</Header>\n * \t<ListBox.Item id=\"profile\">{t(\"settings.profile\")}</ListBox.Item>\n * \t<ListBox.Item id=\"billing\">{t(\"settings.billing\")}</ListBox.Item>\n * </Section>\n */\nexport function Section(handle: Handle<Section.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <section {...rest} mix={mergeMix(pb(\"0.25rem\"), mix)} />;\n\t};\n}\n"
|
|
11
11
|
},
|
|
12
12
|
"test": null
|
|
13
13
|
}
|
package/registry/ui/select.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "select",
|
|
3
|
-
"changedIn": "2026.
|
|
3
|
+
"changedIn": "2026.11.1",
|
|
4
4
|
"dependencies": [],
|
|
5
5
|
"exports": [
|
|
6
6
|
"Select"
|
|
7
7
|
],
|
|
8
8
|
"source": {
|
|
9
9
|
"path": "select.tsx",
|
|
10
|
-
"content": "/**\n * A native `<select>` styled as a bordered, rounded field and progressively\n * upgraded with customizable-select rendering — a custom trigger button, a\n * value slot mirroring the current selection, and richly styled options and\n * groups — wherever the browser resolves `appearance: base-select`. The\n * trigger, value, and picker styling layer on top of ordinary\n * `<option>`/`<optgroup>` markup, so every browser renders a working\n * dropdown from that same markup.\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 { ChevronDownIcon } from \"@sdxc/icons\";\nimport { bg, border, borderEdge, fg, outline, outlineStyle, outlineWidth } from \"@sdxc/u/color\";\nimport {\n\topacity,\n\trounded,\n\ttransition,\n\ttransitionBehavior,\n\ttransitionDuration,\n} from \"@sdxc/u/effects\";\nimport { cursor, raw } from \"@sdxc/u/general\";\nimport {\n\tappearance,\n\tbasis,\n\tflex,\n\tgap,\n\tgrow,\n\tinlineFlex,\n\tinset,\n\titems,\n\tjustify,\n\tshrink,\n} from \"@sdxc/u/layout\";\nimport { overflow } from \"@sdxc/u/overflow\";\nimport { media, startingStyle } from \"@sdxc/u/responsive\";\nimport { bs, is, m, maxBs, p, pb, pi } from \"@sdxc/u/size\";\nimport { data, hover, when } from \"@sdxc/u/state\";\nimport { text, textAlign, truncate } from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport { durations } from \"@sdxc/ui/animations\";\nimport { mirrorSelectedOption } from \"@sdxc/ui/mixins\";\nimport { floatingSurface, surfaceInset } from \"@sdxc/ui/styles\";\n\n/**\n * The `<selectedcontent>` element mirrors the currently selected\n * `<option>`'s rendered content inside a customized `<select>`'s trigger\n * button, its attribute shape declared here to match a plain `<span>`'s.\n */\ndeclare global {\n\tnamespace JSX {\n\t\tinterface IntrinsicHTMLElements {\n\t\t\tselectedcontent: IntrinsicHTMLElements[\"span\"];\n\t\t}\n\t}\n}\n\n/** Semantic color role {@link Select} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: Select.Color = \"neutral\";\n\n/**\n * `type` {@link Select.Trigger} falls back to when a consumer doesn't supply\n * one, keeping a click on the trigger from submitting a surrounding `<form>`\n * the way a bare `<button>`'s default type otherwise would.\n */\nconst DEFAULT_TRIGGER_TYPE: NonNullable<Select.TriggerProps[\"type\"]> = \"button\";\n\n/**\n * `aria-hidden` applied through {@link attrs} to {@link Select.Trigger}'s\n * default chevron glyph unless a consumer overrides it, keeping the\n * decorative icon out of the accessibility tree.\n */\nconst DEFAULT_ICON_ARIA_HIDDEN = \"true\";\n\n/**\n * Prop types for {@link Select} and its compound parts.\n */\nexport namespace Select {\n\t/**\n\t * Semantic color role, each mapped to its matching `--ui-*` variables.\n\t */\n\texport type Color = \"brand\" | \"neutral\" | \"success\" | \"warning\" | \"danger\";\n\n\t/**\n\t * Every native `<select>` attribute, unchanged, plus the `mix` passthrough.\n\t * `multiple` and a `size` greater than `1` remain functional but switch\n\t * rendering back to the plain list-box; `role` is already implicit.\n\t */\n\t/**\n\t * `value` and `defaultValue` are left out on purpose. A `<select>` takes its selection\n\t * from the option carrying `selected` and nothing else reads either attribute, so a\n\t * value passed here goes unread and the field quietly shows its first option. Mark the\n\t * option instead: `<Select.Option value=\"eu\" selected>`.\n\t */\n\texport interface Props extends Omit<TagProps<\"select\">, \"role\" | \"defaultValue\" | \"value\"> {\n\t\t/** Semantic color role for the focus-visible ring. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t}\n\n\t/**\n\t * Every native `<button>` attribute, unchanged, plus the `mix` passthrough.\n\t * `type` defaults to {@link DEFAULT_TRIGGER_TYPE}.\n\t */\n\texport interface TriggerProps extends TagProps<\"button\"> {}\n\n\t/**\n\t * Every attribute a plain `<span>` accepts, unchanged, plus the `mix`\n\t * passthrough. Any `children` supplied render as a fallback in browsers\n\t * treating `<selectedcontent>` as unknown — see {@link Select.Value}.\n\t */\n\texport interface ValueProps extends TagProps<\"selectedcontent\"> {}\n\n\t/**\n\t * Every native `<option>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface OptionProps extends TagProps<\"option\"> {}\n\n\t/**\n\t * Every native `<optgroup>` attribute, unchanged, plus the `mix`\n\t * passthrough.\n\t */\n\texport interface GroupProps extends TagProps<\"optgroup\"> {}\n}\n\n/**\n * Renders a native `<select>` styled as a bordered, rounded field that\n * progressively upgrades to customizable-select rendering via\n * `appearance: base-select`, falling back to the platform's own dropdown.\n *\n * @param handle Runtime handle carrying the host `<select>`'s props.\n * @returns The render function producing the field's markup.\n * @example\n * <Select aria-label={t(\"form.country.label\")} required>\n * \t<Select.Option value=\"\">{t(\"form.country.placeholder\")}</Select.Option>\n * \t<Select.Option value=\"us\">{t(\"countries.us\")}</Select.Option>\n * \t<Select.Option value=\"ca\">{t(\"countries.ca\")}</Select.Option>\n * </Select>\n * @example\n * <Select aria-label={t(\"form.plan.label\")} color=\"brand\">\n * \t<Select.Trigger />\n * \t<Select.Group label={t(\"form.plan.groups.personal\")}>\n * \t\t<Select.Option value=\"free\">{t(\"plans.free\")}</Select.Option>\n * \t\t<Select.Option value=\"pro\">{t(\"plans.pro\")}</Select.Option>\n * \t</Select.Group>\n * </Select>\n */\nexport function Select(handle: Handle<Select.Props>) {\n\treturn () => {\n\t\tlet { color, multiple, size, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\n\t\tif (import.meta.env?.DEV && (multiple || (typeof size === \"number\" && size > 1))) {\n\t\t\tconsole.warn(\n\t\t\t\t\"Select: `appearance: base-select` styling has no effect on a `multiple` select or one with a `size` greater than 1 — the browser keeps its plain list-box rendering there instead of the customized trigger, value, and option styling.\",\n\t\t\t);\n\t\t}\n\n\t\tlet fieldMix = [\n\t\t\tflex(),\n\t\t\titems(\"center\"),\n\t\t\tjustify(\"between\"),\n\t\t\tcursor(\"default\"),\n\t\t\ttext(\"sm\"),\n\t\t\t/**\n\t\t\t * Focus draws a ring standing off the field and the border steps only to its hover weight,\n\t\t\t * so the field keeps its shape. The pointer and keyboard selectors exclude each other because\n\t\t\t * `outline: none` is a shorthand that, from a later layer, resets the whole ring.\n\t\t\t */\n\t\t\twhen(\"&:focus:not(:focus-visible)\", outline(\"none\")),\n\t\t\twhen(\"&:focus-visible\", [\n\t\t\t\tborder(\"neutral.border-hover\"),\n\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\tdata(\"color\", \"success\", outline(\"success.ring\")),\n\t\t\t\tdata(\"color\", \"warning\", outline(\"warning.ring\")),\n\t\t\t\tdata(\"color\", \"danger\", outline(\"danger.ring\")),\n\t\t\t]),\n\t\t\twhen('&[aria-invalid=\"true\"], &:user-invalid', [\n\t\t\t\toutlineWidth(\"2px\"),\n\t\t\t\toutlineStyle(\"solid\"),\n\t\t\t\traw({ outlineOffset: \"2px\" }),\n\t\t\t]),\n\t\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\n\t\t\twhen(\"&::picker(select)\", [\n\t\t\t\tfloatingSurface(),\n\t\t\t\tsurfaceInset(),\n\t\t\t\tm(0),\n\t\t\t\tinset(\"auto\"),\n\t\t\t\tmaxBs(\"15rem\"),\n\t\t\t\toverflow(\"auto\"),\n\t\t\t\toutline(\"none\"),\n\t\t\t\topacity(0),\n\t\t\t\ttransition(\"opacity, display, overlay\", { duration: durations.fast }),\n\t\t\t\ttransitionBehavior(\"allow-discrete\"),\n\t\t\t]),\n\t\t\twhen(\"&:open::picker(select)\", opacity(100)),\n\t\t\tstartingStyle(when(\"&:open::picker(select)\", opacity(0))),\n\t\t\tmedia(\n\t\t\t\t\"(prefers-reduced-motion: reduce)\",\n\t\t\t\twhen(\"&::picker(select)\", transitionDuration(\"0s\")),\n\t\t\t),\n\t\t\traw({\n\t\t\t\t\"&:open\": {\n\t\t\t\t\t'& [data-slot=\"icon\"]': {\n\t\t\t\t\t\ttransform: \"rotate(180deg)\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t\"&:has(option:checked:disabled)\": {\n\t\t\t\t\t\"& selectedcontent\": {\n\t\t\t\t\t\tcolor: \"var(--ui-neutral-fg-muted)\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}),\n\t\t\tgap(\"0.5rem\"),\n\t\t\tis(\"full\"),\n\t\t\tbs(\"2.5rem\"),\n\t\t\trounded(\"md\"),\n\t\t\tborder({ color: \"neutral\", width: 1 }),\n\t\t\tbg(\"neutral.tint\"),\n\t\t\tfg(\"neutral.emphasis\"),\n\t\t\tpi(\"0.75rem\"),\n\t\t\tpb(\"0.5rem\"),\n\t\t\tappearance(\"base-select\"),\n\t\t\ttransition(\n\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter\",\n\t\t\t),\n\t\t\thover(border(\"neutral.border-hover\")),\n\t\t\twhen(\"&:focus\", border(\"neutral.border-hover\")),\n\t\t\twhen('&[aria-invalid=\"true\"], &:user-invalid', [\n\t\t\t\tborder(\"danger\"),\n\t\t\t\toutline({ color: \"danger.ring\", offset: 2 }),\n\t\t\t]),\n\t\t\twhen(\"&:disabled\", bg(\"neutral.bg-tint-hover\")),\n\t\t\traw({\n\t\t\t\t\"&::picker(select)\": {\n\t\t\t\t\tborderRadius: \"var(--ui-radius-lg, 0.5rem)\",\n\t\t\t\t\tborderWidth: \"1px\",\n\t\t\t\t\tborderStyle: \"solid\",\n\t\t\t\t\tborderColor: \"var(--ui-neutral-border)\",\n\t\t\t\t\tbackgroundColor: \"var(--ui-neutral-bg-tint)\",\n\t\t\t\t},\n\t\t\t\t\"&::picker-icon\": {\n\t\t\t\t\tcolor: \"var(--ui-neutral-fg-muted)\",\n\t\t\t\t},\n\t\t\t}),\n\t\t\tmix,\n\t\t] as unknown as Select.Props[\"mix\"];\n\n\t\treturn (\n\t\t\t<select multiple={multiple} size={size} data-color={resolvedColor} {...rest} mix={fieldMix} />\n\t\t);\n\t};\n}\n\n/**\n * Renders {@link Select}'s customizable trigger: a native `<button>` placed\n * as {@link Select}'s first child, showing {@link Select.Value} and a\n * rotating chevron by default, filling the field's box edge to edge.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the trigger's markup.\n * @example\n * <Select.Trigger />\n * @example\n * <Select.Trigger>\n * \t<Select.Value>{t(\"form.plan.placeholder\")}</Select.Value>\n * </Select.Trigger>\n */\nSelect.Trigger = function SelectTrigger(handle: Handle<Select.TriggerProps>) {\n\treturn () => {\n\t\tlet { type, children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype={type ?? DEFAULT_TRIGGER_TYPE}\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"between\"),\n\t\t\t\t\tgap(\"0.5rem\"),\n\t\t\t\t\tis(\"full\"),\n\t\t\t\t\tbs(\"full\"),\n\t\t\t\t\tm(0),\n\t\t\t\t\tp(0),\n\t\t\t\t\tborder({ width: 0, style: \"none\" }),\n\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\tfg(\"inherit\"),\n\t\t\t\t\traw({ font: \"inherit\" }),\n\t\t\t\t\ttextAlign(\"start\"),\n\t\t\t\t\tcursor(\"inherit\"),\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\t\t<>\n\t\t\t\t\t\t<Select.Value />\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tdata-slot=\"icon\"\n\t\t\t\t\t\t\tmix={[\n\t\t\t\t\t\t\t\tattrs({ \"aria-hidden\": DEFAULT_ICON_ARIA_HIDDEN }),\n\t\t\t\t\t\t\t\tinlineFlex(),\n\t\t\t\t\t\t\t\tshrink(),\n\t\t\t\t\t\t\t\ttransition(\"transform\"),\n\t\t\t\t\t\t\t\twhen(\"& svg\", [is(\"1rem\"), bs(\"1rem\")]),\n\t\t\t\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", transitionDuration(\"0s\")),\n\t\t\t\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ChevronDownIcon />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</button>\n\t\t);\n\t};\n};\n\n/**\n * Renders a native `<selectedcontent>` element inside {@link Select.Trigger},\n * mirroring the currently selected {@link Select.Option}'s content via the\n * platform; `children` render as a fallback where it's treated as unknown.\n *\n * @param handle Runtime handle carrying the host element's props.\n * @returns The render function producing the value slot's markup.\n * @example\n * <Select.Value />\n * @example\n * <Select.Value>{t(\"form.plan.placeholder\")}</Select.Value>\n */\nSelect.Value = function SelectValue(handle: Handle<Select.ValueProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<selectedcontent\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\tmirrorSelectedOption(),\n\t\t\t\t\tgrow(),\n\t\t\t\t\tshrink(1),\n\t\t\t\t\tbasis(\"0%\"),\n\t\t\t\t\ttruncate(),\n\t\t\t\t\ttextAlign(\"start\"),\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 native `<option>` styled for the rounded, padded row a\n * supporting browser shows inside {@link Select}'s `::picker(select)`\n * dropdown, reading its own hover, focus, checked, and disabled states.\n *\n * @param handle Runtime handle carrying the host `<option>`'s props.\n * @returns The render function producing the option's markup.\n * @example\n * <Select.Option value=\"us\">{t(\"countries.us\")}</Select.Option>\n * @example\n * <Select.Option value=\"\" disabled>{t(\"form.country.placeholder\")}</Select.Option>\n */\nSelect.Option = function SelectOption(handle: Handle<Select.OptionProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<option\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\tcursor(\"default\"),\n\t\t\t\t\tpi(\"0.75rem\"),\n\t\t\t\t\tpb(\"0.5rem\"),\n\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\toutline(\"none\"),\n\t\t\t\t\twhen(\"&:disabled\", opacity(50)),\n\t\t\t\t\twhen(\"&::checkmark\", fg(\"currentColor\")),\n\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\ttransition(\n\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t),\n\t\t\t\t\twhen(\"&:hover\", bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\twhen(\"&:active\", bg(\"neutral.bg-tint-pressed\")),\n\t\t\t\t\twhen(\"&:focus\", bg(\"brand.tint\")),\n\t\t\t\t\twhen(\"&:checked\", [bg(\"brand.solid\"), fg(\"brand.onSolid\")]),\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 native `<optgroup>` styled as a padded run of\n * {@link Select.Option}s, set off from the group before it by a\n * block-start divider on every group after the first.\n *\n * @param handle Runtime handle carrying the host `<optgroup>`'s props.\n * @returns The render function producing the group's markup.\n * @example\n * <Select.Group label={t(\"form.plan.groups.personal\")}>\n * \t<Select.Option value=\"free\">{t(\"plans.free\")}</Select.Option>\n * \t<Select.Option value=\"pro\">{t(\"plans.pro\")}</Select.Option>\n * </Select.Group>\n */\nSelect.Group = function SelectGroup(handle: Handle<Select.GroupProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\tif (import.meta.env?.DEV && !rest.label) {\n\t\t\tconsole.warn(\n\t\t\t\t\"Select.Group: an `optgroup` with no `label` renders with no visible heading for its options — pass a `label` describing the group.\",\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<optgroup\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\twhen(\"&:not(:first-child)\", borderEdge(\"block-start\", { width: 1 })),\n\t\t\t\t\tpb(\"0.25rem\"),\n\t\t\t\t\twhen(\"&:not(:first-child)\", border(\"neutral\")),\n\t\t\t\t\tmix,\n\t\t\t\t]}\n\t\t\t/>\n\t\t);\n\t};\n};\n"
|
|
10
|
+
"content": "/**\n * A native `<select>` styled as a bordered, rounded field and progressively\n * upgraded with customizable-select rendering — a custom trigger button, a\n * value slot mirroring the current selection, and richly styled options and\n * groups — wherever the browser resolves `appearance: base-select`. The\n * trigger, value, and picker styling layer on top of ordinary\n * `<option>`/`<optgroup>` markup, so every browser renders a working\n * dropdown from that same markup.\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 { ChevronDownIcon } from \"@sdxc/icons\";\nimport { bg, border, borderEdge, fg, outline, outlineStyle, outlineWidth } from \"@sdxc/u/color\";\nimport {\n\topacity,\n\trounded,\n\ttransition,\n\ttransitionBehavior,\n\ttransitionDuration,\n} from \"@sdxc/u/effects\";\nimport { cursor, raw, mergeMix } from \"@sdxc/u/general\";\nimport {\n\tappearance,\n\tbasis,\n\tflex,\n\tgap,\n\tgrow,\n\tinlineFlex,\n\tinset,\n\titems,\n\tjustify,\n\tshrink,\n} from \"@sdxc/u/layout\";\nimport { overflow } from \"@sdxc/u/overflow\";\nimport { media, startingStyle } from \"@sdxc/u/responsive\";\nimport { bs, is, m, maxBs, p, pb, pi } from \"@sdxc/u/size\";\nimport { data, hover, when } from \"@sdxc/u/state\";\nimport { text, textAlign, truncate } from \"@sdxc/u/typography\";\nimport { attrs } from \"remix/component\";\n\nimport { durations } from \"@sdxc/ui/animations\";\nimport { mirrorSelectedOption } from \"@sdxc/ui/mixins\";\nimport { floatingSurface, surfaceInset } from \"@sdxc/ui/styles\";\n\n/**\n * The `<selectedcontent>` element mirrors the currently selected\n * `<option>`'s rendered content inside a customized `<select>`'s trigger\n * button, its attribute shape declared here to match a plain `<span>`'s.\n */\ndeclare global {\n\tnamespace JSX {\n\t\tinterface IntrinsicHTMLElements {\n\t\t\tselectedcontent: IntrinsicHTMLElements[\"span\"];\n\t\t}\n\t}\n}\n\n/** Semantic color role {@link Select} falls back to when `color` is omitted. */\nconst DEFAULT_COLOR: Select.Color = \"neutral\";\n\n/**\n * `type` {@link Select.Trigger} falls back to when a consumer doesn't supply\n * one, keeping a click on the trigger from submitting a surrounding `<form>`\n * the way a bare `<button>`'s default type otherwise would.\n */\nconst DEFAULT_TRIGGER_TYPE: NonNullable<Select.TriggerProps[\"type\"]> = \"button\";\n\n/**\n * `aria-hidden` applied through {@link attrs} to {@link Select.Trigger}'s\n * default chevron glyph unless a consumer overrides it, keeping the\n * decorative icon out of the accessibility tree.\n */\nconst DEFAULT_ICON_ARIA_HIDDEN = \"true\";\n\n/**\n * Prop types for {@link Select} and its compound parts.\n */\nexport namespace Select {\n\t/**\n\t * Semantic color role, each mapped to its matching `--ui-*` variables.\n\t */\n\texport type Color = \"brand\" | \"neutral\" | \"success\" | \"warning\" | \"danger\";\n\n\t/**\n\t * Every native `<select>` attribute, unchanged, plus the `mix` passthrough.\n\t * `multiple` and a `size` greater than `1` remain functional but switch\n\t * rendering back to the plain list-box; `role` is already implicit.\n\t */\n\t/**\n\t * `value` and `defaultValue` are left out on purpose. A `<select>` takes its selection\n\t * from the option carrying `selected` and nothing else reads either attribute, so a\n\t * value passed here goes unread and the field quietly shows its first option. Mark the\n\t * option instead: `<Select.Option value=\"eu\" selected>`.\n\t */\n\texport interface Props extends Omit<TagProps<\"select\">, \"role\" | \"defaultValue\" | \"value\"> {\n\t\t/** Semantic color role for the focus-visible ring. Defaults to {@link DEFAULT_COLOR}. */\n\t\tcolor?: Color;\n\t}\n\n\t/**\n\t * Every native `<button>` attribute, unchanged, plus the `mix` passthrough.\n\t * `type` defaults to {@link DEFAULT_TRIGGER_TYPE}.\n\t */\n\texport interface TriggerProps extends TagProps<\"button\"> {}\n\n\t/**\n\t * Every attribute a plain `<span>` accepts, unchanged, plus the `mix`\n\t * passthrough. Any `children` supplied render as a fallback in browsers\n\t * treating `<selectedcontent>` as unknown — see {@link Select.Value}.\n\t */\n\texport interface ValueProps extends TagProps<\"selectedcontent\"> {}\n\n\t/**\n\t * Every native `<option>` attribute, unchanged, plus the `mix` passthrough.\n\t */\n\texport interface OptionProps extends TagProps<\"option\"> {}\n\n\t/**\n\t * Every native `<optgroup>` attribute, unchanged, plus the `mix`\n\t * passthrough.\n\t */\n\texport interface GroupProps extends TagProps<\"optgroup\"> {}\n}\n\n/**\n * Renders a native `<select>` styled as a bordered, rounded field that\n * progressively upgrades to customizable-select rendering via\n * `appearance: base-select`, falling back to the platform's own dropdown.\n *\n * @param handle Runtime handle carrying the host `<select>`'s props.\n * @returns The render function producing the field's markup.\n * @example\n * <Select aria-label={t(\"form.country.label\")} required>\n * \t<Select.Option value=\"\">{t(\"form.country.placeholder\")}</Select.Option>\n * \t<Select.Option value=\"us\">{t(\"countries.us\")}</Select.Option>\n * \t<Select.Option value=\"ca\">{t(\"countries.ca\")}</Select.Option>\n * </Select>\n * @example\n * <Select aria-label={t(\"form.plan.label\")} color=\"brand\">\n * \t<Select.Trigger />\n * \t<Select.Group label={t(\"form.plan.groups.personal\")}>\n * \t\t<Select.Option value=\"free\">{t(\"plans.free\")}</Select.Option>\n * \t\t<Select.Option value=\"pro\">{t(\"plans.pro\")}</Select.Option>\n * \t</Select.Group>\n * </Select>\n */\nexport function Select(handle: Handle<Select.Props>) {\n\treturn () => {\n\t\tlet { color, multiple, size, mix, ...rest } = handle.props;\n\t\tlet resolvedColor = color ?? DEFAULT_COLOR;\n\n\t\tif (import.meta.env?.DEV && (multiple || (typeof size === \"number\" && size > 1))) {\n\t\t\tconsole.warn(\n\t\t\t\t\"Select: `appearance: base-select` styling has no effect on a `multiple` select or one with a `size` greater than 1 — the browser keeps its plain list-box rendering there instead of the customized trigger, value, and option styling.\",\n\t\t\t);\n\t\t}\n\n\t\tlet fieldMix = mergeMix(\n\t\t\t[\n\t\t\t\tflex(),\n\t\t\t\titems(\"center\"),\n\t\t\t\tjustify(\"between\"),\n\t\t\t\tcursor(\"default\"),\n\t\t\t\ttext(\"sm\"),\n\t\t\t\t/**\n\t\t\t\t * Focus draws a ring standing off the field and the border steps only to its hover weight,\n\t\t\t\t * so the field keeps its shape. The pointer and keyboard selectors exclude each other because\n\t\t\t\t * `outline: none` is a shorthand that, from a later layer, resets the whole ring.\n\t\t\t\t */\n\t\t\t\twhen(\"&:focus:not(:focus-visible)\", outline(\"none\")),\n\t\t\t\twhen(\"&:focus-visible\", [\n\t\t\t\t\tborder(\"neutral.border-hover\"),\n\t\t\t\t\toutline({ color: \"brand.ring\", offset: 2 }),\n\t\t\t\t\tdata(\"color\", \"success\", outline(\"success.ring\")),\n\t\t\t\t\tdata(\"color\", \"warning\", outline(\"warning.ring\")),\n\t\t\t\t\tdata(\"color\", \"danger\", outline(\"danger.ring\")),\n\t\t\t\t]),\n\t\t\t\twhen('&[aria-invalid=\"true\"], &:user-invalid', [\n\t\t\t\t\toutlineWidth(\"2px\"),\n\t\t\t\t\toutlineStyle(\"solid\"),\n\t\t\t\t\traw({ outlineOffset: \"2px\" }),\n\t\t\t\t]),\n\t\t\t\twhen(\"&:disabled\", [cursor(\"not-allowed\"), opacity(50)]),\n\n\t\t\t\twhen(\"&::picker(select)\", [\n\t\t\t\t\tfloatingSurface(),\n\t\t\t\t\tsurfaceInset(),\n\t\t\t\t\tm(0),\n\t\t\t\t\tinset(\"auto\"),\n\t\t\t\t\tmaxBs(\"15rem\"),\n\t\t\t\t\toverflow(\"auto\"),\n\t\t\t\t\toutline(\"none\"),\n\t\t\t\t\topacity(0),\n\t\t\t\t\ttransition(\"opacity, display, overlay\", { duration: durations.fast }),\n\t\t\t\t\ttransitionBehavior(\"allow-discrete\"),\n\t\t\t\t]),\n\t\t\t\twhen(\"&:open::picker(select)\", opacity(100)),\n\t\t\t\tstartingStyle(when(\"&:open::picker(select)\", opacity(0))),\n\t\t\t\tmedia(\n\t\t\t\t\t\"(prefers-reduced-motion: reduce)\",\n\t\t\t\t\twhen(\"&::picker(select)\", transitionDuration(\"0s\")),\n\t\t\t\t),\n\t\t\t\traw({\n\t\t\t\t\t\"&:open\": {\n\t\t\t\t\t\t'& [data-slot=\"icon\"]': {\n\t\t\t\t\t\t\ttransform: \"rotate(180deg)\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t\"&:has(option:checked:disabled)\": {\n\t\t\t\t\t\t\"& selectedcontent\": {\n\t\t\t\t\t\t\tcolor: \"var(--ui-neutral-fg-muted)\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t\tgap(\"0.5rem\"),\n\t\t\t\tis(\"full\"),\n\t\t\t\tbs(\"2.5rem\"),\n\t\t\t\trounded(\"md\"),\n\t\t\t\tborder({ color: \"neutral\", width: 1 }),\n\t\t\t\tbg(\"neutral.tint\"),\n\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\tpi(\"0.75rem\"),\n\t\t\t\tpb(\"0.5rem\"),\n\t\t\t\tappearance(\"base-select\"),\n\t\t\t\ttransition(\n\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter\",\n\t\t\t\t),\n\t\t\t\thover(border(\"neutral.border-hover\")),\n\t\t\t\twhen(\"&:focus\", border(\"neutral.border-hover\")),\n\t\t\t\twhen('&[aria-invalid=\"true\"], &:user-invalid', [\n\t\t\t\t\tborder(\"danger\"),\n\t\t\t\t\toutline({ color: \"danger.ring\", offset: 2 }),\n\t\t\t\t]),\n\t\t\t\twhen(\"&:disabled\", bg(\"neutral.bg-tint-hover\")),\n\t\t\t\traw({\n\t\t\t\t\t\"&::picker(select)\": {\n\t\t\t\t\t\tborderRadius: \"var(--ui-radius-lg, 0.5rem)\",\n\t\t\t\t\t\tborderWidth: \"1px\",\n\t\t\t\t\t\tborderStyle: \"solid\",\n\t\t\t\t\t\tborderColor: \"var(--ui-neutral-border)\",\n\t\t\t\t\t\tbackgroundColor: \"var(--ui-neutral-bg-tint)\",\n\t\t\t\t\t},\n\t\t\t\t\t\"&::picker-icon\": {\n\t\t\t\t\t\tcolor: \"var(--ui-neutral-fg-muted)\",\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t],\n\t\t\tmix,\n\t\t) as Select.Props[\"mix\"];\n\n\t\treturn (\n\t\t\t<select multiple={multiple} size={size} data-color={resolvedColor} {...rest} mix={fieldMix} />\n\t\t);\n\t};\n}\n\n/**\n * Renders {@link Select}'s customizable trigger: a native `<button>` placed\n * as {@link Select}'s first child, showing {@link Select.Value} and a\n * rotating chevron by default, filling the field's box edge to edge.\n *\n * @param handle Runtime handle carrying the host `<button>`'s props.\n * @returns The render function producing the trigger's markup.\n * @example\n * <Select.Trigger />\n * @example\n * <Select.Trigger>\n * \t<Select.Value>{t(\"form.plan.placeholder\")}</Select.Value>\n * </Select.Trigger>\n */\nSelect.Trigger = function SelectTrigger(handle: Handle<Select.TriggerProps>) {\n\treturn () => {\n\t\tlet { type, children, mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<button\n\t\t\t\ttype={type ?? DEFAULT_TRIGGER_TYPE}\n\t\t\t\t{...rest}\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\tjustify(\"between\"),\n\t\t\t\t\t\tgap(\"0.5rem\"),\n\t\t\t\t\t\tis(\"full\"),\n\t\t\t\t\t\tbs(\"full\"),\n\t\t\t\t\t\tm(0),\n\t\t\t\t\t\tp(0),\n\t\t\t\t\t\tborder({ width: 0, style: \"none\" }),\n\t\t\t\t\t\tbg(\"transparent\"),\n\t\t\t\t\t\tfg(\"inherit\"),\n\t\t\t\t\t\traw({ font: \"inherit\" }),\n\t\t\t\t\t\ttextAlign(\"start\"),\n\t\t\t\t\t\tcursor(\"inherit\"),\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\t\t<>\n\t\t\t\t\t\t<Select.Value />\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tdata-slot=\"icon\"\n\t\t\t\t\t\t\tmix={[\n\t\t\t\t\t\t\t\tattrs({ \"aria-hidden\": DEFAULT_ICON_ARIA_HIDDEN }),\n\t\t\t\t\t\t\t\tinlineFlex(),\n\t\t\t\t\t\t\t\tshrink(),\n\t\t\t\t\t\t\t\ttransition(\"transform\"),\n\t\t\t\t\t\t\t\twhen(\"& svg\", [is(\"1rem\"), bs(\"1rem\")]),\n\t\t\t\t\t\t\t\tmedia(\"(prefers-reduced-motion: reduce)\", transitionDuration(\"0s\")),\n\t\t\t\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ChevronDownIcon />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</button>\n\t\t);\n\t};\n};\n\n/**\n * Renders a native `<selectedcontent>` element inside {@link Select.Trigger},\n * mirroring the currently selected {@link Select.Option}'s content via the\n * platform; `children` render as a fallback where it's treated as unknown.\n *\n * @param handle Runtime handle carrying the host element's props.\n * @returns The render function producing the value slot's markup.\n * @example\n * <Select.Value />\n * @example\n * <Select.Value>{t(\"form.plan.placeholder\")}</Select.Value>\n */\nSelect.Value = function SelectValue(handle: Handle<Select.ValueProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<selectedcontent\n\t\t\t\t{...rest}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[mirrorSelectedOption(), grow(), shrink(1), basis(\"0%\"), truncate(), textAlign(\"start\")],\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 native `<option>` styled for the rounded, padded row a\n * supporting browser shows inside {@link Select}'s `::picker(select)`\n * dropdown, reading its own hover, focus, checked, and disabled states.\n *\n * @param handle Runtime handle carrying the host `<option>`'s props.\n * @returns The render function producing the option's markup.\n * @example\n * <Select.Option value=\"us\">{t(\"countries.us\")}</Select.Option>\n * @example\n * <Select.Option value=\"\" disabled>{t(\"form.country.placeholder\")}</Select.Option>\n */\nSelect.Option = function SelectOption(handle: Handle<Select.OptionProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<option\n\t\t\t\t{...rest}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tcursor(\"default\"),\n\t\t\t\t\t\tpi(\"0.75rem\"),\n\t\t\t\t\t\tpb(\"0.5rem\"),\n\t\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t\toutline(\"none\"),\n\t\t\t\t\t\twhen(\"&:disabled\", opacity(50)),\n\t\t\t\t\t\twhen(\"&::checkmark\", fg(\"currentColor\")),\n\t\t\t\t\t\trounded(\"md\"),\n\t\t\t\t\t\tfg(\"neutral.emphasis\"),\n\t\t\t\t\t\ttransition(\n\t\t\t\t\t\t\t\"color, background-color, border-color, outline-color, text-decoration-color, fill, stroke\",\n\t\t\t\t\t\t),\n\t\t\t\t\t\twhen(\"&:hover\", bg(\"neutral.bg-tint-hover\")),\n\t\t\t\t\t\twhen(\"&:active\", bg(\"neutral.bg-tint-pressed\")),\n\t\t\t\t\t\twhen(\"&:focus\", bg(\"brand.tint\")),\n\t\t\t\t\t\twhen(\"&:checked\", [bg(\"brand.solid\"), fg(\"brand.onSolid\")]),\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 native `<optgroup>` styled as a padded run of\n * {@link Select.Option}s, set off from the group before it by a\n * block-start divider on every group after the first.\n *\n * @param handle Runtime handle carrying the host `<optgroup>`'s props.\n * @returns The render function producing the group's markup.\n * @example\n * <Select.Group label={t(\"form.plan.groups.personal\")}>\n * \t<Select.Option value=\"free\">{t(\"plans.free\")}</Select.Option>\n * \t<Select.Option value=\"pro\">{t(\"plans.pro\")}</Select.Option>\n * </Select.Group>\n */\nSelect.Group = function SelectGroup(handle: Handle<Select.GroupProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\tif (import.meta.env?.DEV && !rest.label) {\n\t\t\tconsole.warn(\n\t\t\t\t\"Select.Group: an `optgroup` with no `label` renders with no visible heading for its options — pass a `label` describing the group.\",\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<optgroup\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(\"&:not(:first-child)\", borderEdge(\"block-start\", { width: 1 })),\n\t\t\t\t\t\tpb(\"0.25rem\"),\n\t\t\t\t\t\twhen(\"&:not(:first-child)\", border(\"neutral\")),\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
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "selection-indicator",
|
|
3
|
-
"changedIn": "2026.
|
|
3
|
+
"changedIn": "2026.11.1",
|
|
4
4
|
"dependencies": [],
|
|
5
5
|
"exports": [
|
|
6
6
|
"SelectionIndicator"
|
|
7
7
|
],
|
|
8
8
|
"source": {
|
|
9
9
|
"path": "selection-indicator.tsx",
|
|
10
|
-
"content": "/**\n * A small marker that stays invisible, while still reserving its own layout\n * slot, until the element carrying it is the current selection. Anchors a\n * menu or listbox option's checkmark, a tab strip's active-tab underline, or\n * any similar per-item selection cue to a fixed spot so neighboring content\n * never reflows between the selected and unselected states.\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 { visibility } from \"@sdxc/u/effects\";\nimport { bs, is } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { attrs } from \"remix/component\";\n\n/**\n * `aria-hidden=\"true\"` applied through {@link attrs} unless a consumer\n * overrides it. The indicator restates a selection state already exposed\n * via `aria-selected`/`aria-current`, so assistive technology gains nothing.\n */\nconst DEFAULT_ARIA_HIDDEN = \"true\";\n\n/**\n * Prop types for {@link SelectionIndicator}.\n */\nexport namespace SelectionIndicator {\n\t/**\n\t * Every native `<div>` attribute, plus the `mix` passthrough. Selection\n\t * state reads directly from `aria-selected`/`aria-current` already set on\n\t * the host, so there is no separate boolean prop to duplicate it.\n\t */\n\texport interface Props extends TagProps<\"div\"> {}\n}\n\n/**\n * Renders a marker that stays present in the layout at all times but only\n * becomes visible once its host carries `aria-selected=\"true\"` or a truthy\n * `aria-current`, so sibling content never reflows on selection change.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the indicator's markup.\n * @example\n * <Menu.Item aria-selected={isChecked}>\n * \t<SelectionIndicator aria-selected={isChecked}>\n * \t\t<CheckIcon />\n * \t</SelectionIndicator>\n * \t<Text slot=\"label\">{t(\"menu.autosave\")}</Text>\n * </Menu.Item>\n * @example\n * <Tabs.Trigger id=\"billing\" aria-selected={activeTab === \"billing\"}>\n * \t{t(\"settings.tabs.billing\")}\n * \t<SelectionIndicator\n * \t\taria-selected={activeTab === \"billing\"}\n * \t\tmix={css({ position: \"absolute\", insetBlockEnd: \"0\", insetInline: \"0\", blockSize: \"2px\" })}\n * \t/>\n * </Tabs.Trigger>\n */\nexport function SelectionIndicator(handle: Handle<SelectionIndicator.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ \"aria-hidden\": DEFAULT_ARIA_HIDDEN }),\n\t\t\t\t\tis(\"var(--ui-selection-indicator-size, 1rem)\"),\n\t\t\t\t\tbs(\"var(--ui-selection-indicator-size, 1rem)\"),\n\t\t\t\t\tfg(\"currentColor\"),\n\t\t\t\t\tvisibility(\"hidden\"),\n\t\t\t\t\twhen('&[aria-selected=\"true\"]', visibility()),\n\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', visibility()),\n\t\t\t\t\tmix,\n\t\t\t\t
|
|
10
|
+
"content": "/**\n * A small marker that stays invisible, while still reserving its own layout\n * slot, until the element carrying it is the current selection. Anchors a\n * menu or listbox option's checkmark, a tab strip's active-tab underline, or\n * any similar per-item selection cue to a fixed spot so neighboring content\n * never reflows between the selected and unselected states.\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 { visibility } from \"@sdxc/u/effects\";\nimport { mergeMix } from \"@sdxc/u/general\";\nimport { bs, is } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { attrs } from \"remix/component\";\n\n/**\n * `aria-hidden=\"true\"` applied through {@link attrs} unless a consumer\n * overrides it. The indicator restates a selection state already exposed\n * via `aria-selected`/`aria-current`, so assistive technology gains nothing.\n */\nconst DEFAULT_ARIA_HIDDEN = \"true\";\n\n/**\n * Prop types for {@link SelectionIndicator}.\n */\nexport namespace SelectionIndicator {\n\t/**\n\t * Every native `<div>` attribute, plus the `mix` passthrough. Selection\n\t * state reads directly from `aria-selected`/`aria-current` already set on\n\t * the host, so there is no separate boolean prop to duplicate it.\n\t */\n\texport interface Props extends TagProps<\"div\"> {}\n}\n\n/**\n * Renders a marker that stays present in the layout at all times but only\n * becomes visible once its host carries `aria-selected=\"true\"` or a truthy\n * `aria-current`, so sibling content never reflows on selection change.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the indicator's markup.\n * @example\n * <Menu.Item aria-selected={isChecked}>\n * \t<SelectionIndicator aria-selected={isChecked}>\n * \t\t<CheckIcon />\n * \t</SelectionIndicator>\n * \t<Text slot=\"label\">{t(\"menu.autosave\")}</Text>\n * </Menu.Item>\n * @example\n * <Tabs.Trigger id=\"billing\" aria-selected={activeTab === \"billing\"}>\n * \t{t(\"settings.tabs.billing\")}\n * \t<SelectionIndicator\n * \t\taria-selected={activeTab === \"billing\"}\n * \t\tmix={css({ position: \"absolute\", insetBlockEnd: \"0\", insetInline: \"0\", blockSize: \"2px\" })}\n * \t/>\n * </Tabs.Trigger>\n */\nexport function SelectionIndicator(handle: Handle<SelectionIndicator.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tattrs({ \"aria-hidden\": DEFAULT_ARIA_HIDDEN }),\n\t\t\t\t\t\tis(\"var(--ui-selection-indicator-size, 1rem)\"),\n\t\t\t\t\t\tbs(\"var(--ui-selection-indicator-size, 1rem)\"),\n\t\t\t\t\t\tfg(\"currentColor\"),\n\t\t\t\t\t\tvisibility(\"hidden\"),\n\t\t\t\t\t\twhen('&[aria-selected=\"true\"]', visibility()),\n\t\t\t\t\t\twhen('&[aria-current]:not([aria-current=\"false\"])', visibility()),\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
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sentinel-row",
|
|
3
|
-
"changedIn": "2026.
|
|
3
|
+
"changedIn": "2026.11.1",
|
|
4
4
|
"dependencies": [],
|
|
5
5
|
"exports": [
|
|
6
6
|
"SentinelRow"
|
|
7
7
|
],
|
|
8
8
|
"source": {
|
|
9
9
|
"path": "sentinel-row.tsx",
|
|
10
|
-
"content": "/**\n * A decorative sentinel row shared by every list-shaped compound component\n * that renders a trailing loading placeholder: a `<div>` styled as centered,\n * muted small text, sized to match its enclosing list's own row rhythm.\n * Every trailing-row part across these compound components assigns this\n * same implementation, keeping the markup, styling, and behavior 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 { fg } from \"@sdxc/u/color\";\nimport { flex, items, justify } from \"@sdxc/u/layout\";\nimport { pb } from \"@sdxc/u/size\";\nimport { text } from \"@sdxc/u/typography\";\n\n/**\n * Renders a decorative sentinel row: a `<div>` styled as centered, muted\n * small text, ready to hold whatever loading indicator or \"load more\"\n * trigger a paired enhancement supplies as `children`.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the sentinel row's markup.\n * @example\n * <ListBox.LoadMoreItem>{t(\"list.loadingMore\")}</ListBox.LoadMoreItem>\n */\nexport function SentinelRow(handle: Handle<TagProps<\"div\">>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\tflex(),\n\t\t\t\t\titems(\"center\"),\n\t\t\t\t\tjustify(\"center\"),\n\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\tpb(\"0.5rem\"),\n\t\t\t\t\tfg(\"neutral.muted\"),\n\t\t\t\t\tmix,\n\t\t\t\t
|
|
10
|
+
"content": "/**\n * A decorative sentinel row shared by every list-shaped compound component\n * that renders a trailing loading placeholder: a `<div>` styled as centered,\n * muted small text, sized to match its enclosing list's own row rhythm.\n * Every trailing-row part across these compound components assigns this\n * same implementation, keeping the markup, styling, and behavior 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 { fg } from \"@sdxc/u/color\";\nimport { mergeMix } from \"@sdxc/u/general\";\nimport { flex, items, justify } from \"@sdxc/u/layout\";\nimport { pb } from \"@sdxc/u/size\";\nimport { text } from \"@sdxc/u/typography\";\n\n/**\n * Renders a decorative sentinel row: a `<div>` styled as centered, muted\n * small text, ready to hold whatever loading indicator or \"load more\"\n * trigger a paired enhancement supplies as `children`.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the sentinel row's markup.\n * @example\n * <ListBox.LoadMoreItem>{t(\"list.loadingMore\")}</ListBox.LoadMoreItem>\n */\nexport function SentinelRow(handle: Handle<TagProps<\"div\">>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\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\tjustify(\"center\"),\n\t\t\t\t\t\ttext(\"sm\"),\n\t\t\t\t\t\tpb(\"0.5rem\"),\n\t\t\t\t\t\tfg(\"neutral.muted\"),\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": {
|
|
13
13
|
"path": "sentinel-row.test.tsx",
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "separator",
|
|
3
|
-
"changedIn": "2026.
|
|
3
|
+
"changedIn": "2026.11.1",
|
|
4
4
|
"dependencies": [],
|
|
5
5
|
"exports": [
|
|
6
6
|
"Separator"
|
|
7
7
|
],
|
|
8
8
|
"source": {
|
|
9
9
|
"path": "separator.tsx",
|
|
10
|
-
"content": "/**\n * A thin visual divider marking a boundary between two groups of content —\n * a menu's sections, a toolbar's clusters, a page's regions. It renders as\n * a single hairline element whose axis and length come from the semantic\n * border color and the orientation it carries.\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 } from \"@sdxc/u/color\";\nimport { bs, is, minBs } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { attrs } from \"remix/component\";\n\n/**\n * ARIA role applied through {@link attrs} so the host `<div>` is announced\n * as a divider between content groups without requiring the consumer to\n * repeat it on every instance.\n */\nconst DEFAULT_ROLE = \"separator\";\n\n/**\n * Default `aria-orientation` value applied through {@link attrs}. Keeping\n * the accessibility attribute and the CSS variant selector on the same\n * value lets a consumer flip the axis by setting `aria-orientation=\"vertical\"`.\n */\nconst DEFAULT_ORIENTATION = \"horizontal\";\n\n/**\n * Props accepted by {@link Separator}.\n */\nexport namespace Separator {\n\t/**\n\t * Every native `<div>` attribute, unchanged, plus the `mix` passthrough.\n\t * Setting `aria-orientation=\"vertical\"` switches both the accessibility\n\t * contract and the rendered axis to a vertical divider.\n\t */\n\texport interface Props extends TagProps<\"div\"> {}\n}\n\n/**\n * Renders a static hairline divider between two groups of content, carrying\n * the `separator` role and defaulting to a full-width horizontal line;\n * setting `aria-orientation=\"vertical\"` flips it to a full-height vertical line.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the divider's markup.\n * @example\n * <Separator />\n * @example\n * <Separator aria-orientation=\"vertical\" />\n */\nexport function Separator(handle: Handle<Separator.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tmix={[\n\t\t\t\t\tattrs({ role: DEFAULT_ROLE, \"aria-orientation\": DEFAULT_ORIENTATION }),\n\t\t\t\t\twhen('&[aria-orientation=\"horizontal\"]', [\n\t\t\t\t\t\tbs(\"var(--ui-separator-thickness, 1px)\"),\n\t\t\t\t\t\tis(\"100%\"),\n\t\t\t\t\t]),\n\t\t\t\t\twhen('&[aria-orientation=\"vertical\"]', [\n\t\t\t\t\t\tbs(\"100%\"),\n\t\t\t\t\t\tminBs(\"var(--ui-separator-min-size, 1rem)\"),\n\t\t\t\t\t\tis(\"var(--ui-separator-thickness, 1px)\"),\n\t\t\t\t\t]),\n\t\t\t\t\tbg(\"neutral.border\"),\n\t\t\t\t\tmix,\n\t\t\t\t
|
|
10
|
+
"content": "/**\n * A thin visual divider marking a boundary between two groups of content —\n * a menu's sections, a toolbar's clusters, a page's regions. It renders as\n * a single hairline element whose axis and length come from the semantic\n * border color and the orientation it carries.\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 } from \"@sdxc/u/color\";\nimport { mergeMix } from \"@sdxc/u/general\";\nimport { bs, is, minBs } from \"@sdxc/u/size\";\nimport { when } from \"@sdxc/u/state\";\nimport { attrs } from \"remix/component\";\n\n/**\n * ARIA role applied through {@link attrs} so the host `<div>` is announced\n * as a divider between content groups without requiring the consumer to\n * repeat it on every instance.\n */\nconst DEFAULT_ROLE = \"separator\";\n\n/**\n * Default `aria-orientation` value applied through {@link attrs}. Keeping\n * the accessibility attribute and the CSS variant selector on the same\n * value lets a consumer flip the axis by setting `aria-orientation=\"vertical\"`.\n */\nconst DEFAULT_ORIENTATION = \"horizontal\";\n\n/**\n * Props accepted by {@link Separator}.\n */\nexport namespace Separator {\n\t/**\n\t * Every native `<div>` attribute, unchanged, plus the `mix` passthrough.\n\t * Setting `aria-orientation=\"vertical\"` switches both the accessibility\n\t * contract and the rendered axis to a vertical divider.\n\t */\n\texport interface Props extends TagProps<\"div\"> {}\n}\n\n/**\n * Renders a static hairline divider between two groups of content, carrying\n * the `separator` role and defaulting to a full-width horizontal line;\n * setting `aria-orientation=\"vertical\"` flips it to a full-height vertical line.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the divider's markup.\n * @example\n * <Separator />\n * @example\n * <Separator aria-orientation=\"vertical\" />\n */\nexport function Separator(handle: Handle<Separator.Props>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...rest}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tattrs({ role: DEFAULT_ROLE, \"aria-orientation\": DEFAULT_ORIENTATION }),\n\t\t\t\t\t\twhen('&[aria-orientation=\"horizontal\"]', [\n\t\t\t\t\t\t\tbs(\"var(--ui-separator-thickness, 1px)\"),\n\t\t\t\t\t\t\tis(\"100%\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\twhen('&[aria-orientation=\"vertical\"]', [\n\t\t\t\t\t\t\tbs(\"100%\"),\n\t\t\t\t\t\t\tminBs(\"var(--ui-separator-min-size, 1rem)\"),\n\t\t\t\t\t\t\tis(\"var(--ui-separator-thickness, 1px)\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tbg(\"neutral.border\"),\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
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shared-element",
|
|
3
|
-
"changedIn": "2026.
|
|
3
|
+
"changedIn": "2026.11.1",
|
|
4
4
|
"dependencies": [],
|
|
5
5
|
"exports": [
|
|
6
6
|
"SharedElement"
|
|
7
7
|
],
|
|
8
8
|
"source": {
|
|
9
9
|
"path": "shared-element.tsx",
|
|
10
|
-
"content": "/**\n * A plain host that carries a stable view-transition identity across\n * separate page loads, so a same-origin, cross-document navigation morphs it\n * from its old position, size, and appearance into its new one instead of\n * replacing it outright. Its identity comes straight from its own `id`,\n * matched against the same `id` on the corresponding element in the document\n * being navigated to or from — no script, snapshotting, or scope wrapper\n * required for this baseline.\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 { block } from \"@sdxc/u/layout\";\n\nimport { mergeStyle } from \"@sdxc/ui/utils\";\n\n/**\n * Written as plain CSS text inside a `<style>` element: `@view-transition`\n * accepts only descriptors, and `::view-transition-group(*)` selects from\n * the browser's own transition tree, both needing selectors written directly in CSS.\n */\nconst CROSS_DOCUMENT_TRANSITION_STYLESHEET = `\n@view-transition {\n\tnavigation: auto;\n}\n\n@media (prefers-reduced-motion: reduce) {\n\t::view-transition-group(*) {\n\t\tanimation: none;\n\t}\n}\n`;\n\n/**\n * Prop types for {@link SharedElement}.\n */\nexport namespace SharedElement {\n\t/**\n\t * Props accepted by {@link SharedElement}: every native `<div>` attribute\n\t * plus the `mix` passthrough. `id` doubles as the view transition identity,\n\t * matched against the same `id` in the document navigated to or from.\n\t */\n\texport interface Props extends TagProps<\"div\"> {}\n}\n\n/**\n * Renders a plain `<div>` host whose `view-transition-name` comes from its\n * own `id`, so a same-origin, cross-document navigation matching that `id`\n * on the other side morphs the element instead of replacing it outright.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the host's markup.\n * @example\n * // On the listing page\n * <SharedElement id={`cover-${book.slug}`}>\n * \t<img src={book.coverUrl} alt={book.title} />\n * </SharedElement>\n * @example\n * // On the book's own page — the matching `id` lets the browser morph\n * // between the two instead of swapping the image outright.\n * <SharedElement id={`cover-${book.slug}`}>\n * \t<img src={book.coverUrl} alt={book.title} />\n * </SharedElement>\n */\nexport function SharedElement(handle: Handle<SharedElement.Props>) {\n\treturn () => {\n\t\tlet { id, mix, style, ...rest } = handle.props;\n\n\t\tif (import.meta.env?.DEV && !id) {\n\t\t\tconsole.warn(\n\t\t\t\t'SharedElement rendered without an \"id\" — the browser has nothing to match it against on the other side of a cross-document view transition.',\n\t\t\t);\n\t\t}\n\n\t\tlet resolvedStyle = mergeStyle(style, { \"view-transition-name\": id });\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<style>{CROSS_DOCUMENT_TRANSITION_STYLESHEET}</style>\n\t\t\t\t<div {...rest} id={id} style={resolvedStyle} mix={
|
|
10
|
+
"content": "/**\n * A plain host that carries a stable view-transition identity across\n * separate page loads, so a same-origin, cross-document navigation morphs it\n * from its old position, size, and appearance into its new one instead of\n * replacing it outright. Its identity comes straight from its own `id`,\n * matched against the same `id` on the corresponding element in the document\n * being navigated to or from — no script, snapshotting, or scope wrapper\n * required for this baseline.\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 { block } from \"@sdxc/u/layout\";\n\nimport { mergeStyle } from \"@sdxc/ui/utils\";\n\n/**\n * Written as plain CSS text inside a `<style>` element: `@view-transition`\n * accepts only descriptors, and `::view-transition-group(*)` selects from\n * the browser's own transition tree, both needing selectors written directly in CSS.\n */\nconst CROSS_DOCUMENT_TRANSITION_STYLESHEET = `\n@view-transition {\n\tnavigation: auto;\n}\n\n@media (prefers-reduced-motion: reduce) {\n\t::view-transition-group(*) {\n\t\tanimation: none;\n\t}\n}\n`;\n\n/**\n * Prop types for {@link SharedElement}.\n */\nexport namespace SharedElement {\n\t/**\n\t * Props accepted by {@link SharedElement}: every native `<div>` attribute\n\t * plus the `mix` passthrough. `id` doubles as the view transition identity,\n\t * matched against the same `id` in the document navigated to or from.\n\t */\n\texport interface Props extends TagProps<\"div\"> {}\n}\n\n/**\n * Renders a plain `<div>` host whose `view-transition-name` comes from its\n * own `id`, so a same-origin, cross-document navigation matching that `id`\n * on the other side morphs the element instead of replacing it outright.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the host's markup.\n * @example\n * // On the listing page\n * <SharedElement id={`cover-${book.slug}`}>\n * \t<img src={book.coverUrl} alt={book.title} />\n * </SharedElement>\n * @example\n * // On the book's own page — the matching `id` lets the browser morph\n * // between the two instead of swapping the image outright.\n * <SharedElement id={`cover-${book.slug}`}>\n * \t<img src={book.coverUrl} alt={book.title} />\n * </SharedElement>\n */\nexport function SharedElement(handle: Handle<SharedElement.Props>) {\n\treturn () => {\n\t\tlet { id, mix, style, ...rest } = handle.props;\n\n\t\tif (import.meta.env?.DEV && !id) {\n\t\t\tconsole.warn(\n\t\t\t\t'SharedElement rendered without an \"id\" — the browser has nothing to match it against on the other side of a cross-document view transition.',\n\t\t\t);\n\t\t}\n\n\t\tlet resolvedStyle = mergeStyle(style, { \"view-transition-name\": id });\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<style>{CROSS_DOCUMENT_TRANSITION_STYLESHEET}</style>\n\t\t\t\t<div {...rest} id={id} style={resolvedStyle} mix={mergeMix(block(), mix)} />\n\t\t\t</>\n\t\t);\n\t};\n}\n"
|
|
11
11
|
},
|
|
12
12
|
"test": null
|
|
13
13
|
}
|
package/registry/ui/sheet.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sheet",
|
|
3
|
-
"changedIn": "2026.
|
|
3
|
+
"changedIn": "2026.11.1",
|
|
4
4
|
"dependencies": [
|
|
5
5
|
"dialog"
|
|
6
6
|
],
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
],
|
|
10
10
|
"source": {
|
|
11
11
|
"path": "sheet.tsx",
|
|
12
|
-
"content": "/**\n * An edge-docked panel that renders through {@link Dialog} — the same native\n * `<dialog>` host, Invoker Commands, backdrop dimming, and missing-`id` dev\n * warning — repositioned from a centered panel to a fixed inline-side column\n * entirely through CSS keyed off a `data-side` attribute. Compound parts\n * cover a header, title, description, footer, and a dismiss control shaped\n * for a column-docked panel's own layout rather than a centered dialog's.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle } from \"remix/component\";\n\nimport { borderEdge, fg } from \"@sdxc/u/color\";\nimport { rounded } from \"@sdxc/u/effects\";\nimport { vars, willChange } from \"@sdxc/u/general\";\nimport {\n\tfixed,\n\tflex,\n\tgap,\n\tinsBe,\n\tinsBs,\n\tinsLeft,\n\tinsRight,\n\titems,\n\tjustify,\n\tvstack,\n} from \"@sdxc/u/layout\";\nimport { is, m, maxBs, maxIs, mbs, paddingLeft, paddingRight, pbe, pbs } from \"@sdxc/u/size\";\nimport { data } from \"@sdxc/u/state\";\nimport { fontSize, pretty } from \"@sdxc/u/typography\";\n\nimport { durations, easings } from \"@sdxc/ui/animations\";\nimport { enterExit } from \"@sdxc/ui/animations\";\n\nimport { Dialog } from \"@sdxc/ui/dialog\";\n\n/**\n * Physical side of the viewport {@link Sheet} docks to when `side` is left\n * unset.\n */\nconst DEFAULT_SIDE: Sheet.Side = \"right\";\n\n/**\n * How far toward its side the panel drifts while it fades out on close: a\n * hint of the direction it came from, short of the full slide it entered with.\n */\nconst EXIT_DISTANCE = \"1rem\";\n\n/** Blur radius in pixels the panel softens to as it fades out. */\nconst EXIT_BLUR_PX = 4;\n\n/**\n * Prop types for {@link Sheet} and its compound parts.\n */\nexport namespace Sheet {\n\t/**\n\t * Physical side of the viewport the panel docks to and slides in from,\n\t * fixed rather than reading-direction-relative so it keeps docking to the\n\t * same edge under any `dir` value, matching the safe-area padding's edge.\n\t */\n\texport type Side = \"left\" | \"right\";\n\n\t/** Every prop {@link Dialog.Props} accepts, plus which side the panel docks to. */\n\texport interface Props extends Dialog.Props {\n\t\t/** Physical side of the viewport to dock to. Defaults to {@link DEFAULT_SIDE}. */\n\t\tside?: Side;\n\t}\n\n\t/** Every prop {@link Dialog.HeaderProps} accepts, unchanged. */\n\texport interface HeaderProps extends Dialog.HeaderProps {}\n\n\t/** Every prop {@link Dialog.TitleProps} accepts, unchanged. */\n\texport interface TitleProps extends Dialog.TitleProps {}\n\n\t/** Every prop {@link Dialog.DescriptionProps} accepts, unchanged. */\n\texport interface DescriptionProps extends Dialog.DescriptionProps {}\n\n\t/** Every prop {@link Dialog.FooterProps} accepts, unchanged. */\n\texport interface FooterProps extends Dialog.FooterProps {}\n\n\t/** Every prop {@link Dialog.CloseProps} accepts, unchanged. */\n\texport interface CloseProps extends Dialog.CloseProps {}\n}\n\n/**\n * Renders the panel through {@link Dialog}: fixed, pinned to whichever\n * inline edge `side` names with the far edge released to `auto`, and slid\n * via `@starting-style`/`allow-discrete` so the close animates too.\n *\n * @param handle Runtime handle carrying the host `<dialog>`'s props, plus `side`.\n * @returns The render function producing the panel's markup.\n * @example\n * <Button commandfor=\"cart\" command=\"show-modal\">{t(\"cart.open\")}</Button>\n * <Sheet id=\"cart\" side=\"right\" aria-labelledby=\"cart-title\">\n * \t<Sheet.Header>\n * \t\t<Sheet.Title id=\"cart-title\">{t(\"cart.title\")}</Sheet.Title>\n * \t\t<Sheet.Description>{t(\"cart.description\")}</Sheet.Description>\n * \t</Sheet.Header>\n * \t<Sheet.Footer>\n * \t\t<Button commandfor=\"cart\" command=\"close\">{t(\"actions.checkout\")}</Button>\n * \t</Sheet.Footer>\n * \t<Sheet.Close commandfor=\"cart\" aria-label={t(\"actions.close\")} />\n * </Sheet>\n * @example\n * <Sheet id=\"filters\" side=\"left\" aria-labelledby=\"filters-title\">\n * \t<Sheet.Header>\n * \t\t<Sheet.Title id=\"filters-title\">{t(\"filters.title\")}</Sheet.Title>\n * \t</Sheet.Header>\n * </Sheet>\n */\nexport function Sheet(handle: Handle<Sheet.Props>) {\n\treturn () => {\n\t\tlet { side, mix, ...rest } = handle.props;\n\t\tlet resolvedSide = side ?? DEFAULT_SIDE;\n\n\t\treturn (\n\t\t\t<Dialog\n\t\t\t\t{...rest}\n\t\t\t\tdata-side={resolvedSide}\n\t\t\t\tmix={[\n\t\t\t\t\tfixed(),\n\t\t\t\t\tm(0),\n\t\t\t\t\trounded(\"none\"),\n\t\t\t\t\tmaxBs(\"none\"),\n\t\t\t\t\tmaxIs(\"none\"),\n\t\t\t\t\tis(\"min(90vw, var(--ui-sheet-size, 24rem))\"),\n\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\tenterExit({\n\t\t\t\t\t\ttranslate: \"var(--ui-sheet-enter-offset)\",\n\t\t\t\t\t\tduration: durations.slow,\n\t\t\t\t\t\teasing: easings.decelerate,\n\t\t\t\t\t\texit: { translate: \"var(--ui-sheet-exit-offset)\", opacity: 0, blur: EXIT_BLUR_PX },\n\t\t\t\t\t\texitDuration: durations.fast,\n\t\t\t\t\t\texitEasing: easings.accelerate,\n\t\t\t\t\t}),\n\t\t\t\t\twillChange(\"translate\"),\n\t\t\t\t\tdata(\"side\", \"right\", [\n\t\t\t\t\t\tborderEdge(\"left\", { width: 1, color: \"neutral\" }),\n\t\t\t\t\t\tvars({\n\t\t\t\t\t\t\t\"ui-sheet-enter-offset\": \"100% 0\",\n\t\t\t\t\t\t\t\"ui-sheet-exit-offset\": `${EXIT_DISTANCE} 0`,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tinsRight(\"0\"),\n\t\t\t\t\t\tinsLeft(\"auto\"),\n\t\t\t\t\t\tpaddingLeft(\"1.5rem\"),\n\t\t\t\t\t\tpaddingRight(\"calc(1.5rem + env(safe-area-inset-right, 0px))\"),\n\t\t\t\t\t]),\n\n\t\t\t\t\tdata(\"side\", \"left\", [\n\t\t\t\t\t\tborderEdge(\"right\", { width: 1, color: \"neutral\" }),\n\t\t\t\t\t\tvars({\n\t\t\t\t\t\t\t\"ui-sheet-enter-offset\": \"-100% 0\",\n\t\t\t\t\t\t\t\"ui-sheet-exit-offset\": `-${EXIT_DISTANCE} 0`,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tinsLeft(\"0\"),\n\t\t\t\t\t\tinsRight(\"auto\"),\n\t\t\t\t\t\tpaddingRight(\"1.5rem\"),\n\t\t\t\t\t\tpaddingLeft(\"calc(1.5rem + env(safe-area-inset-left, 0px))\"),\n\t\t\t\t\t]),\n\t\t\t\t\tgap(\"1rem\"),\n\t\t\t\t\tpbs(`calc(1.5rem + env(safe-area-inset-top, 0px))`),\n\t\t\t\t\tpbe(`calc(1.5rem + env(safe-area-inset-bottom, 0px))`),\n\t\t\t\t\tmix,\n\t\t\t\t
|
|
12
|
+
"content": "/**\n * An edge-docked panel that renders through {@link Dialog} — the same native\n * `<dialog>` host, Invoker Commands, backdrop dimming, and missing-`id` dev\n * warning — repositioned from a centered panel to a fixed inline-side column\n * entirely through CSS keyed off a `data-side` attribute. Compound parts\n * cover a header, title, description, footer, and a dismiss control shaped\n * for a column-docked panel's own layout rather than a centered dialog's.\n *\n * @author [Sergio Xalambrí](https://sergiodxa.com)\n * @copyright Sergio Xalambrí 2026\n */\n\nimport type { Handle } from \"remix/component\";\n\nimport { borderEdge, fg } from \"@sdxc/u/color\";\nimport { rounded } from \"@sdxc/u/effects\";\nimport { vars, willChange, mergeMix } from \"@sdxc/u/general\";\nimport {\n\tfixed,\n\tflex,\n\tgap,\n\tinsBe,\n\tinsBs,\n\tinsLeft,\n\tinsRight,\n\titems,\n\tjustify,\n\tvstack,\n} from \"@sdxc/u/layout\";\nimport { is, m, maxBs, maxIs, mbs, paddingLeft, paddingRight, pbe, pbs } from \"@sdxc/u/size\";\nimport { data } from \"@sdxc/u/state\";\nimport { fontSize, pretty } from \"@sdxc/u/typography\";\n\nimport { durations, easings } from \"@sdxc/ui/animations\";\nimport { enterExit } from \"@sdxc/ui/animations\";\n\nimport { Dialog } from \"@sdxc/ui/dialog\";\n\n/**\n * Physical side of the viewport {@link Sheet} docks to when `side` is left\n * unset.\n */\nconst DEFAULT_SIDE: Sheet.Side = \"right\";\n\n/**\n * How far toward its side the panel drifts while it fades out on close: a\n * hint of the direction it came from, short of the full slide it entered with.\n */\nconst EXIT_DISTANCE = \"1rem\";\n\n/** Blur radius in pixels the panel softens to as it fades out. */\nconst EXIT_BLUR_PX = 4;\n\n/**\n * Prop types for {@link Sheet} and its compound parts.\n */\nexport namespace Sheet {\n\t/**\n\t * Physical side of the viewport the panel docks to and slides in from,\n\t * fixed rather than reading-direction-relative so it keeps docking to the\n\t * same edge under any `dir` value, matching the safe-area padding's edge.\n\t */\n\texport type Side = \"left\" | \"right\";\n\n\t/** Every prop {@link Dialog.Props} accepts, plus which side the panel docks to. */\n\texport interface Props extends Dialog.Props {\n\t\t/** Physical side of the viewport to dock to. Defaults to {@link DEFAULT_SIDE}. */\n\t\tside?: Side;\n\t}\n\n\t/** Every prop {@link Dialog.HeaderProps} accepts, unchanged. */\n\texport interface HeaderProps extends Dialog.HeaderProps {}\n\n\t/** Every prop {@link Dialog.TitleProps} accepts, unchanged. */\n\texport interface TitleProps extends Dialog.TitleProps {}\n\n\t/** Every prop {@link Dialog.DescriptionProps} accepts, unchanged. */\n\texport interface DescriptionProps extends Dialog.DescriptionProps {}\n\n\t/** Every prop {@link Dialog.FooterProps} accepts, unchanged. */\n\texport interface FooterProps extends Dialog.FooterProps {}\n\n\t/** Every prop {@link Dialog.CloseProps} accepts, unchanged. */\n\texport interface CloseProps extends Dialog.CloseProps {}\n}\n\n/**\n * Renders the panel through {@link Dialog}: fixed, pinned to whichever\n * inline edge `side` names with the far edge released to `auto`, and slid\n * via `@starting-style`/`allow-discrete` so the close animates too.\n *\n * @param handle Runtime handle carrying the host `<dialog>`'s props, plus `side`.\n * @returns The render function producing the panel's markup.\n * @example\n * <Button commandfor=\"cart\" command=\"show-modal\">{t(\"cart.open\")}</Button>\n * <Sheet id=\"cart\" side=\"right\" aria-labelledby=\"cart-title\">\n * \t<Sheet.Header>\n * \t\t<Sheet.Title id=\"cart-title\">{t(\"cart.title\")}</Sheet.Title>\n * \t\t<Sheet.Description>{t(\"cart.description\")}</Sheet.Description>\n * \t</Sheet.Header>\n * \t<Sheet.Footer>\n * \t\t<Button commandfor=\"cart\" command=\"close\">{t(\"actions.checkout\")}</Button>\n * \t</Sheet.Footer>\n * \t<Sheet.Close commandfor=\"cart\" aria-label={t(\"actions.close\")} />\n * </Sheet>\n * @example\n * <Sheet id=\"filters\" side=\"left\" aria-labelledby=\"filters-title\">\n * \t<Sheet.Header>\n * \t\t<Sheet.Title id=\"filters-title\">{t(\"filters.title\")}</Sheet.Title>\n * \t</Sheet.Header>\n * </Sheet>\n */\nexport function Sheet(handle: Handle<Sheet.Props>) {\n\treturn () => {\n\t\tlet { side, mix, ...rest } = handle.props;\n\t\tlet resolvedSide = side ?? DEFAULT_SIDE;\n\n\t\treturn (\n\t\t\t<Dialog\n\t\t\t\t{...rest}\n\t\t\t\tdata-side={resolvedSide}\n\t\t\t\tmix={mergeMix(\n\t\t\t\t\t[\n\t\t\t\t\t\tfixed(),\n\t\t\t\t\t\tm(0),\n\t\t\t\t\t\trounded(\"none\"),\n\t\t\t\t\t\tmaxBs(\"none\"),\n\t\t\t\t\t\tmaxIs(\"none\"),\n\t\t\t\t\t\tis(\"min(90vw, var(--ui-sheet-size, 24rem))\"),\n\t\t\t\t\t\tinsBs(\"0\"),\n\t\t\t\t\t\tinsBe(\"0\"),\n\t\t\t\t\t\tenterExit({\n\t\t\t\t\t\t\ttranslate: \"var(--ui-sheet-enter-offset)\",\n\t\t\t\t\t\t\tduration: durations.slow,\n\t\t\t\t\t\t\teasing: easings.decelerate,\n\t\t\t\t\t\t\texit: { translate: \"var(--ui-sheet-exit-offset)\", opacity: 0, blur: EXIT_BLUR_PX },\n\t\t\t\t\t\t\texitDuration: durations.fast,\n\t\t\t\t\t\t\texitEasing: easings.accelerate,\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twillChange(\"translate\"),\n\t\t\t\t\t\tdata(\"side\", \"right\", [\n\t\t\t\t\t\t\tborderEdge(\"left\", { width: 1, color: \"neutral\" }),\n\t\t\t\t\t\t\tvars({\n\t\t\t\t\t\t\t\t\"ui-sheet-enter-offset\": \"100% 0\",\n\t\t\t\t\t\t\t\t\"ui-sheet-exit-offset\": `${EXIT_DISTANCE} 0`,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tinsRight(\"0\"),\n\t\t\t\t\t\t\tinsLeft(\"auto\"),\n\t\t\t\t\t\t\tpaddingLeft(\"1.5rem\"),\n\t\t\t\t\t\t\tpaddingRight(\"calc(1.5rem + env(safe-area-inset-right, 0px))\"),\n\t\t\t\t\t\t]),\n\n\t\t\t\t\t\tdata(\"side\", \"left\", [\n\t\t\t\t\t\t\tborderEdge(\"right\", { width: 1, color: \"neutral\" }),\n\t\t\t\t\t\t\tvars({\n\t\t\t\t\t\t\t\t\"ui-sheet-enter-offset\": \"-100% 0\",\n\t\t\t\t\t\t\t\t\"ui-sheet-exit-offset\": `-${EXIT_DISTANCE} 0`,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\tinsLeft(\"0\"),\n\t\t\t\t\t\t\tinsRight(\"auto\"),\n\t\t\t\t\t\t\tpaddingRight(\"1.5rem\"),\n\t\t\t\t\t\t\tpaddingLeft(\"calc(1.5rem + env(safe-area-inset-left, 0px))\"),\n\t\t\t\t\t\t]),\n\t\t\t\t\t\tgap(\"1rem\"),\n\t\t\t\t\t\tpbs(`calc(1.5rem + env(safe-area-inset-top, 0px))`),\n\t\t\t\t\t\tpbe(`calc(1.5rem + env(safe-area-inset-bottom, 0px))`),\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 {@link Sheet.HeaderProps.children} as the panel's header slot: a\n * tightly-stacked column of {@link Sheet.Title} and {@link Sheet.Description},\n * start-aligned at every width rather than centering like {@link Dialog.Header}.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the header slot's markup.\n * @example\n * <Sheet.Header>\n * \t<Sheet.Title>{t(\"cart.title\")}</Sheet.Title>\n * \t<Sheet.Description>{t(\"cart.description\")}</Sheet.Description>\n * </Sheet.Header>\n */\nSheet.Header = function SheetHeader(handle: Handle<Sheet.HeaderProps>) {\n\treturn () => {\n\t\tlet { mix, ...rest } = handle.props;\n\n\t\treturn <div {...rest} data-slot=\"header\" mix={mergeMix(vstack({ gap: \"0.25rem\" }), mix)} />;\n\t};\n};\n\n/**\n * Renders {@link Sheet.TitleProps.children} as the panel's heading: identical\n * to {@link Dialog.Title}, since both name a panel with the same size and\n * weight of heading text.\n *\n * @param handle Runtime handle carrying the host `<h2>`'s props.\n * @returns The render function producing the heading's markup.\n * @example\n * <Sheet.Title>{t(\"cart.title\")}</Sheet.Title>\n */\nSheet.Title = Dialog.Title;\n\n/**\n * Renders {@link Sheet.DescriptionProps.children} as the panel's supporting\n * copy, in a native `<p>` set to the panel's own foreground color rather\n * than {@link Dialog.Description}'s more muted one.\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 * <Sheet.Description>{t(\"cart.description\")}</Sheet.Description>\n */\nSheet.Description = function SheetDescription(handle: Handle<Sheet.DescriptionProps>) {\n\treturn () => {\n\t\tlet { 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([fontSize(\"sm\"), fg(\"neutral\"), pretty()], mix)}\n\t\t\t>\n\t\t\t\t{rest.children}\n\t\t\t</p>\n\t\t);\n\t};\n};\n\n/**\n * Renders {@link Sheet.FooterProps.children} as the panel's action row: a\n * single end-aligned row pinned to the block-end edge at every width, unlike\n * {@link Dialog.Footer}'s column that only becomes a row as its container grows.\n *\n * @param handle Runtime handle carrying the host `<div>`'s props.\n * @returns The render function producing the action row's markup.\n * @example\n * <Sheet.Footer>\n * \t<Button commandfor=\"cart\" command=\"close\" variant=\"outline\">{t(\"actions.cancel\")}</Button>\n * \t<Button commandfor=\"cart\" command=\"close\">{t(\"actions.checkout\")}</Button>\n * </Sheet.Footer>\n */\nSheet.Footer = function SheetFooter(handle: Handle<Sheet.FooterProps>) {\n\treturn () => {\n\t\tlet { 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=\"footer\"\n\t\t\t\tmix={mergeMix([mbs(\"auto\"), flex(), items(\"center\"), justify(\"end\"), gap(\"0.5rem\")], mix)}\n\t\t\t/>\n\t\t);\n\t};\n};\n\n/**\n * Renders a dismiss control for the ancestor {@link Sheet} named by\n * `commandfor`: identical to {@link Dialog.Close}.\n *\n * @param handle Runtime handle carrying the host button's props.\n * @returns The render function producing the dismiss control's markup.\n * @example\n * <Sheet.Close commandfor=\"cart\" aria-label={t(\"actions.close\")} />\n */\nSheet.Close = Dialog.Close;\n"
|
|
13
13
|
},
|
|
14
14
|
"test": null
|
|
15
15
|
}
|