@adea-ai/ui 0.160.0 → 0.160.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/composites/settings/settings-layout.d.ts.map +1 -1
- package/dist/components/composites/settings/settings-layout.js +14 -2
- package/dist/components/composites/settings/settings-layout.js.map +1 -1
- package/dist/r/src/components/composites/settings/settings-layout.tsx +18 -1
- package/package.json +1 -1
- package/src/components/composites/settings/settings-layout.tsx +18 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings-layout.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/settings/settings-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAIvD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAsB,KAAK,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAExF,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,cAAc,CAAC,OAAO,IAAI,CAAC,EAC3B,UAAU,GAAG,aAAa,GAAG,OAAO,GAAG,cAAc,GAAG,UAAU,CACnE,GAAG;IACF,gFAAgF;IAChF,MAAM,EAAE,SAAS,uBAAuB,EAAE,CAAA;IAC1C,wCAAwC;IACxC,YAAY,EAAE,MAAM,CAAA;IACpB,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAA;IACb,wDAAwD;IACxD,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,uEAAuE;IACvE,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,+FAA+F;IAC/F,cAAc,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,OAAO,EAAE,iBAAiB,GAAG,SAAS,KAAK,IAAI,CAAC,CAAA;IAC7E;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,wBAAwB,CAAA;IAC3C,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AAWhE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"settings-layout.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/settings/settings-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAIvD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAsB,KAAK,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAExF,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,cAAc,CAAC,OAAO,IAAI,CAAC,EAC3B,UAAU,GAAG,aAAa,GAAG,OAAO,GAAG,cAAc,GAAG,UAAU,CACnE,GAAG;IACF,gFAAgF;IAChF,MAAM,EAAE,SAAS,uBAAuB,EAAE,CAAA;IAC1C,wCAAwC;IACxC,YAAY,EAAE,MAAM,CAAA;IACpB,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAA;IACb,wDAAwD;IACxD,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,uEAAuE;IACvE,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,+FAA+F;IAC/F,cAAc,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,OAAO,EAAE,iBAAiB,GAAG,SAAS,KAAK,IAAI,CAAC,CAAA;IAC7E;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,wBAAwB,CAAA;IAC3C,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AAWhE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,eAsExD"}
|
|
@@ -2,8 +2,8 @@ import { MD_BREAKPOINT } from "../../../lib/breakpoints.js";
|
|
|
2
2
|
import { cn } from "../../../lib/utils.js";
|
|
3
3
|
import { Tabs } from "../../ui/tabs/tabs.js";
|
|
4
4
|
import { SettingsNavigation } from "./settings-navigation.js";
|
|
5
|
-
import { createComponent, insert, mergeProps, template } from "@solidjs/web";
|
|
6
|
-
import { createSignal, omit, onSettled } from "solid-js";
|
|
5
|
+
import { createComponent, insert, mergeProps, ref, template } from "@solidjs/web";
|
|
6
|
+
import { createEffect, createSignal, omit, onSettled, untrack } from "solid-js";
|
|
7
7
|
// src/components/composites/settings/settings-layout.tsx
|
|
8
8
|
var _tmpl$ = /* @__PURE__ */ template(`<div data-slot=settings-layout-panels class="min-h-0 min-w-0 flex-1 overflow-y-auto p-(--settings-panel-padding) [--settings-panel-padding:--spacing(4)]">`);
|
|
9
9
|
/** Below the `md` breakpoint the rail becomes a strip. */
|
|
@@ -43,6 +43,13 @@ function SettingsLayout(props) {
|
|
|
43
43
|
if (requested !== "auto") return requested;
|
|
44
44
|
return wide() ? "rail" : "strip";
|
|
45
45
|
};
|
|
46
|
+
let panels;
|
|
47
|
+
let shown = untrack(() => local.value);
|
|
48
|
+
createEffect(() => local.value, (value) => {
|
|
49
|
+
if (value === shown) return;
|
|
50
|
+
shown = value;
|
|
51
|
+
if (panels) panels.scrollTop = 0;
|
|
52
|
+
});
|
|
46
53
|
return createComponent(Tabs, mergeProps(rest, {
|
|
47
54
|
get orientation() {
|
|
48
55
|
return layout() === "rail" ? "vertical" : "horizontal";
|
|
@@ -78,6 +85,11 @@ function SettingsLayout(props) {
|
|
|
78
85
|
}
|
|
79
86
|
}), (() => {
|
|
80
87
|
var _el$ = _tmpl$();
|
|
88
|
+
ref(() => {
|
|
89
|
+
return (element) => {
|
|
90
|
+
panels = element;
|
|
91
|
+
};
|
|
92
|
+
}, _el$);
|
|
81
93
|
insert(_el$, () => {
|
|
82
94
|
return local.children;
|
|
83
95
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings-layout.js","names":["<Tabs\n {...rest}\n orientation={layout() === 'rail' ? 'vertical' : 'horizontal'}\n data-navigation-layout={layout()}\n value={local.value}\n class={cn('min-h-0 min-w-0 flex-1 gap-0', local.class)}\n >\n <SettingsNavigation\n aria-label={local['aria-label']}\n groups={local.groups}\n value={local.value}\n onReselect={local.onReselect}\n revealSelected={local.revealSelected}\n class={layout() === 'rail' ? 'w-24 md:w-sidebar' : undefined}\n />\n <div\n data-slot=\"settings-layout-panels\"\n class=\"min-h-0 min-w-0 flex-1 overflow-y-auto p-(--settings-panel-padding) [--settings-panel-padding:--spacing(4)]\"\n >\n {local.children}\n </div>\n </Tabs>","<SettingsNavigation\n aria-label={local['aria-label']}\n groups={local.groups}\n value={local.value}\n onReselect={local.onReselect}\n revealSelected={local.revealSelected}\n class={layout() === 'rail' ? 'w-24 md:w-sidebar' : undefined}\n />"],"sources":["../../../../src/components/composites/settings/settings-layout.tsx"],"sourcesContent":["import type { ComponentProps, JSX } from '@solidjs/web'\nimport { createSignal, onSettled, omit } from 'solid-js'\nimport { MD_BREAKPOINT } from '#lib/breakpoints'\nimport { cn } from '#lib/utils'\nimport { Tabs } from '../../ui/tabs'\nimport { SettingsNavigation, type SettingsNavigationGroup } from './settings-navigation'\n\nexport type SettingsLayoutProps = Omit<\n ComponentProps<typeof Tabs>,\n 'children' | 'orientation' | 'value' | 'defaultValue' | 'onChange'\n> & {\n /** Grouped navigation entries; the host owns their values and panel content. */\n groups: readonly SettingsNavigationGroup[]\n /** Accessible name for the tab list. */\n 'aria-label': string\n /** The host-controlled selected destination. */\n value: string\n /** Updates the host-controlled selected destination. */\n onChange: (value: string) => void\n /** Called when the already-selected destination is activated again. */\n onReselect?: (value: string) => void\n /** Reveal the selected row on value changes and window resizes. Defaults to nearest scroll. */\n revealSelected?: boolean | ((trigger: HTMLButtonElement | undefined) => void)\n /**\n * How the section navigation sits beside the panels. `auto` (the default) is\n * the vertical rail from 48rem of viewport width up and a horizontal,\n * scrollable strip of tabs above the panels below it. `rail` and `strip` pin\n * one shape at every width.\n */\n navigationLayout?: SettingsNavigationLayout\n /** Panels must be rendered as `TabsContent` descendants. */\n children?: JSX.Element\n}\n\nexport type SettingsNavigationLayout = 'auto' | 'rail' | 'strip'\n\n/** Below the `md` breakpoint the rail becomes a strip. */\nconst RAIL_MEDIA_QUERY = `(min-width: ${MD_BREAKPOINT})`\n\nfunction railQuery(): MediaQueryList | undefined {\n return typeof window === 'undefined' || typeof window.matchMedia !== 'function'\n ? undefined\n : window.matchMedia(RAIL_MEDIA_QUERY)\n}\n\n/**\n * SettingsLayout.\n *\n * A controlled, vertical settings rail beside its scrollable panel viewport.\n * The host keeps ownership of selection, URL/hash state and panel content.\n *\n * Below 48rem the rail becomes a horizontal strip of tabs above the panels.\n * A 6rem rail at phone width clips every label, so this is the default rather\n * than an opt-in. It changes the tab root's orientation, not just its\n * styling: the list's `aria-orientation` and the tabs' arrow keys (Up/Down on\n * the rail, Left/Right on the strip) follow the axis the reader sees. The\n * breakpoint is the viewport's, like CatalogBrowser's and ContextualSidebar's,\n * and is read before the first render so a phone never paints the rail. A\n * server render, which has no viewport, renders the rail.\n */\nexport function SettingsLayout(props: SettingsLayoutProps) {\n const local = props\n const rest = omit(\n props,\n 'class',\n 'children',\n 'groups',\n 'aria-label',\n 'value',\n 'onReselect',\n 'revealSelected',\n 'navigationLayout'\n )\n\n const [wide, setWide] = createSignal(railQuery()?.matches ?? true)\n onSettled(() => {\n const query = railQuery()\n if (!query) return\n const update = () => setWide(query.matches)\n update()\n query.addEventListener('change', update)\n return () => query.removeEventListener('change', update)\n })\n const layout = (): 'rail' | 'strip' => {\n const requested = local.navigationLayout ?? 'auto'\n if (requested !== 'auto') return requested\n return wide() ? 'rail' : 'strip'\n }\n\n return (\n <Tabs\n {...rest}\n orientation={layout() === 'rail' ? 'vertical' : 'horizontal'}\n data-navigation-layout={layout()}\n value={local.value}\n class={cn('min-h-0 min-w-0 flex-1 gap-0', local.class)}\n >\n <SettingsNavigation\n aria-label={local['aria-label']}\n groups={local.groups}\n value={local.value}\n onReselect={local.onReselect}\n revealSelected={local.revealSelected}\n class={layout() === 'rail' ? 'w-24 md:w-sidebar' : undefined}\n />\n <div\n data-slot=\"settings-layout-panels\"\n class=\"min-h-0 min-w-0 flex-1 overflow-y-auto p-(--settings-panel-padding) [--settings-panel-padding:--spacing(4)]\"\n >\n {local.children}\n </div>\n </Tabs>\n )\n}\n"],"mappings":";;;;;;;;;AAqCA,IAAM,mBAAmB,eAAe,cAAc;AAEtD,SAAS,YAAwC;CAC/C,OAAO,OAAO,WAAW,eAAe,OAAO,OAAO,eAAe,aACjE,KAAA,IACA,OAAO,WAAW,gBAAgB;AACxC;;;;;;;;;;;;;;;;AAiBA,SAAgB,eAAe,OAA4B;CACzD,MAAM,QAAQ;CACd,MAAM,OAAO,KACX,OACA,SACA,YACA,UACA,cACA,SACA,cACA,kBACA,kBACF;CAEA,MAAM,CAAC,MAAM,WAAW,aAAa,UAAU,CAAC,EAAE,WAAW,IAAI;CACjE,gBAAgB;EACd,MAAM,QAAQ,UAAU;EACxB,IAAI,CAAC,OAAO;EACZ,MAAM,eAAe,QAAQ,MAAM,OAAO;EAC1C,OAAO;EACP,MAAM,iBAAiB,UAAU,MAAM;EACvC,aAAa,MAAM,oBAAoB,UAAU,MAAM;CACzD,CAAC;CACD,MAAM,eAAiC;EACrC,MAAM,YAAY,MAAM,oBAAoB;EAC5C,IAAI,cAAc,QAAQ,OAAO;EACjC,OAAO,KAAK,IAAI,SAAS;CAC3B;CAEA,OACEA,gBAAAA,MAAAA,WACM,MADN;EAEE,IAAA,cAAA;GAAa,OAAA,OAAO,MAAM,SAAS,aAAa;EAAY;EAC5D,IAAA,2BAAA;GAAwB,OAAA,OAAO;EAAC;EAChC,IAAA,QAAA;GAAO,OAAA,MAAM;EAAK;EAClB,IAAA,UAAA;GAAO,OAAA,GAAG,gCAAgC,MAAM,KAAK;EAAC;EALxD,IAAA,WAAA;GAMC,OAAA,CACCC,gBAAAA,oBAAAA;IACE,IAAA,eAAA;KAAY,OAAA,MAAM;IAAa;IAC/B,IAAA,SAAA;KAAQ,OAAA,MAAM;IAAM;IACpB,IAAA,QAAA;KAAO,OAAA,MAAM;IAAK;IAClB,IAAA,aAAA;KAAY,OAAA,MAAM;IAAU;IAC5B,IAAA,iBAAA;KAAgB,OAAA,MAAM;IAAc;IACpC,IAAA,UAAA;KAAO,OAAA,OAAO,MAAM,SAAS,sBAAsB,KAAA;IAAS;GAC7D,CAAA,UACD;
|
|
1
|
+
{"version":3,"file":"settings-layout.js","names":["<Tabs\n {...rest}\n orientation={layout() === 'rail' ? 'vertical' : 'horizontal'}\n data-navigation-layout={layout()}\n value={local.value}\n class={cn('min-h-0 min-w-0 flex-1 gap-0', local.class)}\n >\n <SettingsNavigation\n aria-label={local['aria-label']}\n groups={local.groups}\n value={local.value}\n onReselect={local.onReselect}\n revealSelected={local.revealSelected}\n class={layout() === 'rail' ? 'w-24 md:w-sidebar' : undefined}\n />\n <div\n ref={(element: HTMLDivElement) => {\n panels = element\n }}\n data-slot=\"settings-layout-panels\"\n class=\"min-h-0 min-w-0 flex-1 overflow-y-auto p-(--settings-panel-padding) [--settings-panel-padding:--spacing(4)]\"\n >\n {local.children}\n </div>\n </Tabs>","<SettingsNavigation\n aria-label={local['aria-label']}\n groups={local.groups}\n value={local.value}\n onReselect={local.onReselect}\n revealSelected={local.revealSelected}\n class={layout() === 'rail' ? 'w-24 md:w-sidebar' : undefined}\n />","ref={(element: HTMLDivElement) => {\n panels = element\n }}"],"sources":["../../../../src/components/composites/settings/settings-layout.tsx"],"sourcesContent":["import type { ComponentProps, JSX } from '@solidjs/web'\nimport { createEffect, createSignal, onSettled, omit, untrack } from 'solid-js'\nimport { MD_BREAKPOINT } from '#lib/breakpoints'\nimport { cn } from '#lib/utils'\nimport { Tabs } from '../../ui/tabs'\nimport { SettingsNavigation, type SettingsNavigationGroup } from './settings-navigation'\n\nexport type SettingsLayoutProps = Omit<\n ComponentProps<typeof Tabs>,\n 'children' | 'orientation' | 'value' | 'defaultValue' | 'onChange'\n> & {\n /** Grouped navigation entries; the host owns their values and panel content. */\n groups: readonly SettingsNavigationGroup[]\n /** Accessible name for the tab list. */\n 'aria-label': string\n /** The host-controlled selected destination. */\n value: string\n /** Updates the host-controlled selected destination. */\n onChange: (value: string) => void\n /** Called when the already-selected destination is activated again. */\n onReselect?: (value: string) => void\n /** Reveal the selected row on value changes and window resizes. Defaults to nearest scroll. */\n revealSelected?: boolean | ((trigger: HTMLButtonElement | undefined) => void)\n /**\n * How the section navigation sits beside the panels. `auto` (the default) is\n * the vertical rail from 48rem of viewport width up and a horizontal,\n * scrollable strip of tabs above the panels below it. `rail` and `strip` pin\n * one shape at every width.\n */\n navigationLayout?: SettingsNavigationLayout\n /** Panels must be rendered as `TabsContent` descendants. */\n children?: JSX.Element\n}\n\nexport type SettingsNavigationLayout = 'auto' | 'rail' | 'strip'\n\n/** Below the `md` breakpoint the rail becomes a strip. */\nconst RAIL_MEDIA_QUERY = `(min-width: ${MD_BREAKPOINT})`\n\nfunction railQuery(): MediaQueryList | undefined {\n return typeof window === 'undefined' || typeof window.matchMedia !== 'function'\n ? undefined\n : window.matchMedia(RAIL_MEDIA_QUERY)\n}\n\n/**\n * SettingsLayout.\n *\n * A controlled, vertical settings rail beside its scrollable panel viewport.\n * The host keeps ownership of selection, URL/hash state and panel content.\n *\n * Below 48rem the rail becomes a horizontal strip of tabs above the panels.\n * A 6rem rail at phone width clips every label, so this is the default rather\n * than an opt-in. It changes the tab root's orientation, not just its\n * styling: the list's `aria-orientation` and the tabs' arrow keys (Up/Down on\n * the rail, Left/Right on the strip) follow the axis the reader sees. The\n * breakpoint is the viewport's, like CatalogBrowser's and ContextualSidebar's,\n * and is read before the first render so a phone never paints the rail. A\n * server render, which has no viewport, renders the rail.\n */\nexport function SettingsLayout(props: SettingsLayoutProps) {\n const local = props\n const rest = omit(\n props,\n 'class',\n 'children',\n 'groups',\n 'aria-label',\n 'value',\n 'onReselect',\n 'revealSelected',\n 'navigationLayout'\n )\n\n const [wide, setWide] = createSignal(railQuery()?.matches ?? true)\n onSettled(() => {\n const query = railQuery()\n if (!query) return\n const update = () => setWide(query.matches)\n update()\n query.addEventListener('change', update)\n return () => query.removeEventListener('change', update)\n })\n const layout = (): 'rail' | 'strip' => {\n const requested = local.navigationLayout ?? 'auto'\n if (requested !== 'auto') return requested\n return wide() ? 'rail' : 'strip'\n }\n\n // Another section opens at its top. The panels share one scroller, and the section that\n // leaves and the one that opens are both in it for a moment, so its offset would otherwise\n // carry over (or be moved by scroll anchoring) into the new section.\n let panels: HTMLDivElement | undefined\n let shown = untrack(() => local.value)\n createEffect(\n () => local.value,\n (value) => {\n if (value === shown) return\n shown = value\n if (panels) panels.scrollTop = 0\n }\n )\n\n return (\n <Tabs\n {...rest}\n orientation={layout() === 'rail' ? 'vertical' : 'horizontal'}\n data-navigation-layout={layout()}\n value={local.value}\n class={cn('min-h-0 min-w-0 flex-1 gap-0', local.class)}\n >\n <SettingsNavigation\n aria-label={local['aria-label']}\n groups={local.groups}\n value={local.value}\n onReselect={local.onReselect}\n revealSelected={local.revealSelected}\n class={layout() === 'rail' ? 'w-24 md:w-sidebar' : undefined}\n />\n <div\n ref={(element: HTMLDivElement) => {\n panels = element\n }}\n data-slot=\"settings-layout-panels\"\n class=\"min-h-0 min-w-0 flex-1 overflow-y-auto p-(--settings-panel-padding) [--settings-panel-padding:--spacing(4)]\"\n >\n {local.children}\n </div>\n </Tabs>\n )\n}\n"],"mappings":";;;;;;;;;AAqCA,IAAM,mBAAmB,eAAe,cAAc;AAEtD,SAAS,YAAwC;CAC/C,OAAO,OAAO,WAAW,eAAe,OAAO,OAAO,eAAe,aACjE,KAAA,IACA,OAAO,WAAW,gBAAgB;AACxC;;;;;;;;;;;;;;;;AAiBA,SAAgB,eAAe,OAA4B;CACzD,MAAM,QAAQ;CACd,MAAM,OAAO,KACX,OACA,SACA,YACA,UACA,cACA,SACA,cACA,kBACA,kBACF;CAEA,MAAM,CAAC,MAAM,WAAW,aAAa,UAAU,CAAC,EAAE,WAAW,IAAI;CACjE,gBAAgB;EACd,MAAM,QAAQ,UAAU;EACxB,IAAI,CAAC,OAAO;EACZ,MAAM,eAAe,QAAQ,MAAM,OAAO;EAC1C,OAAO;EACP,MAAM,iBAAiB,UAAU,MAAM;EACvC,aAAa,MAAM,oBAAoB,UAAU,MAAM;CACzD,CAAC;CACD,MAAM,eAAiC;EACrC,MAAM,YAAY,MAAM,oBAAoB;EAC5C,IAAI,cAAc,QAAQ,OAAO;EACjC,OAAO,KAAK,IAAI,SAAS;CAC3B;CAKA,IAAI;CACJ,IAAI,QAAQ,cAAc,MAAM,KAAK;CACrC,mBACQ,MAAM,QACX,UAAU;EACT,IAAI,UAAU,OAAO;EACrB,QAAQ;EACR,IAAI,QAAQ,OAAO,YAAY;CACjC,CACF;CAEA,OACEA,gBAAAA,MAAAA,WACM,MADN;EAEE,IAAA,cAAA;GAAa,OAAA,OAAO,MAAM,SAAS,aAAa;EAAY;EAC5D,IAAA,2BAAA;GAAwB,OAAA,OAAO;EAAC;EAChC,IAAA,QAAA;GAAO,OAAA,MAAM;EAAK;EAClB,IAAA,UAAA;GAAO,OAAA,GAAG,gCAAgC,MAAM,KAAK;EAAC;EALxD,IAAA,WAAA;GAMC,OAAA,CACCC,gBAAAA,oBAAAA;IACE,IAAA,eAAA;KAAY,OAAA,MAAM;IAAa;IAC/B,IAAA,SAAA;KAAQ,OAAA,MAAM;IAAM;IACpB,IAAA,QAAA;KAAO,OAAA,MAAM;IAAK;IAClB,IAAA,aAAA;KAAY,OAAA,MAAM;IAAU;IAC5B,IAAA,iBAAA;KAAgB,OAAA,MAAM;IAAc;IACpC,IAAA,UAAA;KAAO,OAAA,OAAO,MAAM,SAAS,sBAAsB,KAAA;IAAS;GAC7D,CAAA,UACD;IAQK,IAAA,OAAA,OAAA;IAPH,UAAA;KAAM,QAAA,YAA4B;MAChC,SAAS;KACX;IAAC,GAFDC,IAEC;IAHH,OAAA,YAOE;KAAC,OAAA,MAAM;IAAQ,CACZ;IARL,OAAA;GAQK,EAAA,CAAA,CAhBN;EAiBK;;AAEV"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentProps, JSX } from '@solidjs/web'
|
|
2
|
-
import { createSignal, onSettled, omit } from 'solid-js'
|
|
2
|
+
import { createEffect, createSignal, onSettled, omit, untrack } from 'solid-js'
|
|
3
3
|
import { MD_BREAKPOINT } from '../../../lib/breakpoints'
|
|
4
4
|
import { cn } from '../../../lib/utils'
|
|
5
5
|
import { Tabs } from '../../ui/tabs'
|
|
@@ -87,6 +87,20 @@ export function SettingsLayout(props: SettingsLayoutProps) {
|
|
|
87
87
|
return wide() ? 'rail' : 'strip'
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
// Another section opens at its top. The panels share one scroller, and the section that
|
|
91
|
+
// leaves and the one that opens are both in it for a moment, so its offset would otherwise
|
|
92
|
+
// carry over (or be moved by scroll anchoring) into the new section.
|
|
93
|
+
let panels: HTMLDivElement | undefined
|
|
94
|
+
let shown = untrack(() => local.value)
|
|
95
|
+
createEffect(
|
|
96
|
+
() => local.value,
|
|
97
|
+
(value) => {
|
|
98
|
+
if (value === shown) return
|
|
99
|
+
shown = value
|
|
100
|
+
if (panels) panels.scrollTop = 0
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
|
|
90
104
|
return (
|
|
91
105
|
<Tabs
|
|
92
106
|
{...rest}
|
|
@@ -104,6 +118,9 @@ export function SettingsLayout(props: SettingsLayoutProps) {
|
|
|
104
118
|
class={layout() === 'rail' ? 'w-24 md:w-sidebar' : undefined}
|
|
105
119
|
/>
|
|
106
120
|
<div
|
|
121
|
+
ref={(element: HTMLDivElement) => {
|
|
122
|
+
panels = element
|
|
123
|
+
}}
|
|
107
124
|
data-slot="settings-layout-panels"
|
|
108
125
|
class="min-h-0 min-w-0 flex-1 overflow-y-auto p-(--settings-panel-padding) [--settings-panel-padding:--spacing(4)]"
|
|
109
126
|
>
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentProps, JSX } from '@solidjs/web'
|
|
2
|
-
import { createSignal, onSettled, omit } from 'solid-js'
|
|
2
|
+
import { createEffect, createSignal, onSettled, omit, untrack } from 'solid-js'
|
|
3
3
|
import { MD_BREAKPOINT } from '#lib/breakpoints'
|
|
4
4
|
import { cn } from '#lib/utils'
|
|
5
5
|
import { Tabs } from '../../ui/tabs'
|
|
@@ -87,6 +87,20 @@ export function SettingsLayout(props: SettingsLayoutProps) {
|
|
|
87
87
|
return wide() ? 'rail' : 'strip'
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
// Another section opens at its top. The panels share one scroller, and the section that
|
|
91
|
+
// leaves and the one that opens are both in it for a moment, so its offset would otherwise
|
|
92
|
+
// carry over (or be moved by scroll anchoring) into the new section.
|
|
93
|
+
let panels: HTMLDivElement | undefined
|
|
94
|
+
let shown = untrack(() => local.value)
|
|
95
|
+
createEffect(
|
|
96
|
+
() => local.value,
|
|
97
|
+
(value) => {
|
|
98
|
+
if (value === shown) return
|
|
99
|
+
shown = value
|
|
100
|
+
if (panels) panels.scrollTop = 0
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
|
|
90
104
|
return (
|
|
91
105
|
<Tabs
|
|
92
106
|
{...rest}
|
|
@@ -104,6 +118,9 @@ export function SettingsLayout(props: SettingsLayoutProps) {
|
|
|
104
118
|
class={layout() === 'rail' ? 'w-24 md:w-sidebar' : undefined}
|
|
105
119
|
/>
|
|
106
120
|
<div
|
|
121
|
+
ref={(element: HTMLDivElement) => {
|
|
122
|
+
panels = element
|
|
123
|
+
}}
|
|
107
124
|
data-slot="settings-layout-panels"
|
|
108
125
|
class="min-h-0 min-w-0 flex-1 overflow-y-auto p-(--settings-panel-padding) [--settings-panel-padding:--spacing(4)]"
|
|
109
126
|
>
|