@plexui/vue 0.14.1 → 0.16.0
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/es/components/Alert/Alert.js +6 -0
- package/dist/es/components/Alert/Alert.js.map +1 -1
- package/dist/es/components/Alert/index.js.map +1 -1
- package/dist/es/components/Sidebar/Sidebar.js +95 -10
- package/dist/es/components/Sidebar/Sidebar.js.map +1 -1
- package/dist/es/components/Sidebar/useSidebarContext.js +21 -18
- package/dist/es/components/Sidebar/useSidebarContext.js.map +1 -1
- package/dist/es/lib/phoneDrawer.js +207 -0
- package/dist/es/lib/phoneDrawer.js.map +1 -0
- package/dist/types/components/Alert/Alert.d.ts +18 -0
- package/dist/types/components/Alert/index.d.ts +1 -1
- package/dist/types/components/Sidebar/Sidebar.d.ts +22 -2
- package/dist/types/components/Sidebar/useSidebarContext.d.ts +25 -0
- package/dist/types/lib/phoneDrawer.d.ts +44 -0
- package/package.json +2 -2
|
@@ -38,6 +38,11 @@ const AlertComponent = defineComponent({
|
|
|
38
38
|
description: String,
|
|
39
39
|
/** Places `actions` at the end or the bottom. Automatic from sizing when unset. */
|
|
40
40
|
actionsPlacement: String,
|
|
41
|
+
/**
|
|
42
|
+
* How the actions show at 767px and below: 50px capsules side by side, as the buttons of an iOS tip (TipKit),
|
|
43
|
+
* or the buttons as given, at their own size, for an alert inside a block of buttons of its own. @default "capsules"
|
|
44
|
+
*/
|
|
45
|
+
mobileActions: { type: String, default: "capsules" },
|
|
41
46
|
/** `false` hides the indicator. Use the `indicator` slot to replace it. */
|
|
42
47
|
indicator: { type: Boolean, default: undefined },
|
|
43
48
|
/** Class applied to the actions container */
|
|
@@ -96,6 +101,7 @@ const AlertComponent = defineComponent({
|
|
|
96
101
|
"role": color === "danger" ? "alert" : undefined,
|
|
97
102
|
"data-actions-placement": props.actionsPlacement ?? actionsAutoPlacement.value,
|
|
98
103
|
"data-banner": props.banner ? "" : undefined,
|
|
104
|
+
"data-mobile-actions": props.mobileActions === "own" ? "own" : undefined,
|
|
99
105
|
}, [
|
|
100
106
|
props.indicator === false
|
|
101
107
|
? null
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../../../src/components/Alert/Alert.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EACL,eAAe,EACf,CAAC,EACD,eAAe,EACf,SAAS,EACT,GAAG,EACH,KAAK,GAKN,MAAM,KAAK,CAAA;AAEZ,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,CAAC,MAAM,kDAAkD,CAAA;AAchE,+EAA+E;AAC/E,MAAM,SAAS,GAAG,CAAC,KAAiB,EAAE,EAAE;IACtC,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,SAAS,CAAC;QACf,KAAK,SAAS,CAAC;QACf,KAAK,QAAQ;YACX,OAAO,CAAC,CAAC,OAAO,CAAC,CAAA;QACnB,KAAK,SAAS;YACZ,OAAO,CAAC,CAAC,WAAW,CAAC,CAAA;QACvB;YACE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAA;IAClB,CAAC;AACH,CAAC,CAAA;AAED,gDAAgD;AAChD,MAAM,cAAc,GAAG,CAAC,KAA0B,EAAE,QAAoC,EAAE,EAAE;IAC1F,MAAM,GAAG,GAAG,KAAK,CAAC,cAAoF,CAAA;IACtG,IAAI,CAAC,GAAG;QAAE,OAAO,KAAK,CAAC,WAAW,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;IAClF,4DAA4D;IAC5D,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,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,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAC1B;oBACH,CAAC,CAAC,IAAI;aACT,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAOF,qFAAqF;AACrF,MAAM,CAAC,MAAM,KAAK,GAAG,cAA4E,CAAA","sourcesContent":["import clsx from \"clsx\"\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n ref,\n watch,\n type HTMLAttributes,\n type PropType,\n type VNodeArrayChildren,\n type VNodeChild,\n} from \"vue\"\nimport type { SemanticColors, Variants } from \"@plexui/styles/types\"\nimport { CheckCircle, Info, Warning, X } from \"../Icon/index.js\"\nimport { Button } from \"../Button/index.js\"\nimport { hasContent } from \"../../lib/slotContent.js\"\nimport s from \"@plexui/styles/components/Alert/Alert.module.css\"\n\n// Vue port of packages/ui/src/components/Alert/Alert.tsx. ReactNode props\n// are slots (`title`, `description`, `actions`, `indicator`), with string\n// props as fallback for `title` and `description`. `:indicator=\"false\"`\n// hides the indicator. `onDismiss` stays a function prop (`@dismiss` in\n// templates) because its presence adds the Dismiss button.\n// The actions auto placement mirrors usehooks-ts `useResizeObserver`: it\n// reacts to the container's content-box width only.\n\nexport type AlertColor = SemanticColors<\n \"primary\" | \"danger\" | \"success\" | \"info\" | \"discovery\" | \"caution\" | \"warning\"\n>\n\n/** Default indicator icon, chosen from the color (which signals intention). */\nconst Indicator = (color: AlertColor) => {\n switch (color) {\n case \"warning\":\n case \"caution\":\n case \"danger\":\n return h(Warning)\n case \"success\":\n return h(CheckCircle)\n default:\n return h(Info)\n }\n}\n\n// usehooks-ts `extractSize` for the content box\nconst contentBoxSize = (entry: ResizeObserverEntry, sizeType: \"inlineSize\" | \"blockSize\") => {\n const box = entry.contentBoxSize as ReadonlyArray<ResizeObserverSize> | ResizeObserverSize | undefined\n if (!box) return entry.contentRect[sizeType === \"inlineSize\" ? \"width\" : \"height\"]\n // Firefox once reported a single object instead of an array\n return Array.isArray(box) ? box[0]?.[sizeType] : (box as ResizeObserverSize)[sizeType]\n}\n\nconst AlertComponent = defineComponent({\n name: \"Alert\",\n props: {\n /** Color of the alert. @default \"primary\" */\n color: { type: String as PropType<AlertColor>, default: \"primary\" },\n /** Style variant. @default \"outline\" */\n variant: { type: String as PropType<Variants<\"solid\" | \"soft\" | \"outline\">>, default: \"outline\" },\n /** Title displayed in the alert (or the `title` slot). */\n title: String,\n /** Description text displayed in the alert (or the `description` slot). */\n description: String,\n /** Places `actions` at the end or the bottom. Automatic from sizing when unset. */\n actionsPlacement: String as PropType<\"end\" | \"bottom\">,\n /** `false` hides the indicator. Use the `indicator` slot to replace it. */\n indicator: { type: Boolean, default: undefined },\n /** Class applied to the actions container */\n actionsClassName: String,\n /** Shows the Dismiss button; called when it is clicked. */\n onDismiss: Function as PropType<(event: MouseEvent) => void>,\n /** A full-width strip across a page or panel: square corners, lines above and below only. @default false */\n banner: { type: Boolean, default: false },\n },\n setup(props, { slots }) {\n const containerRef = ref<HTMLDivElement | null>(null)\n const actionsRef = ref<HTMLDivElement | null>(null)\n const actionsAutoPlacement = ref<\"end\" | \"bottom\">(\"end\")\n const containerWidth = ref<number | undefined>(undefined)\n\n let observer: ResizeObserver | undefined\n onMounted(() => {\n const container = containerRef.value\n if (!container) return\n if (typeof window === \"undefined\" || !(\"ResizeObserver\" in window)) return\n let previousWidth: number | undefined\n let previousHeight: number | undefined\n observer = new ResizeObserver(([entry]) => {\n if (!entry) return\n const width = contentBoxSize(entry, \"inlineSize\")\n const height = contentBoxSize(entry, \"blockSize\")\n if (width !== previousWidth || height !== previousHeight) {\n previousWidth = width\n previousHeight = height\n containerWidth.value = width\n }\n })\n observer.observe(container, { box: \"content-box\" })\n })\n onBeforeUnmount(() => observer?.disconnect())\n\n watch(containerWidth, (width) => {\n const actionsWidth = actionsRef.value?.clientWidth ?? 0\n\n if (actionsWidth && width) {\n // If actions are larger than a third of the container width, wrap them.\n actionsAutoPlacement.value = actionsWidth > width / 3 ? \"bottom\" : \"end\"\n }\n })\n\n return () => {\n const { color } = props\n const title: VNodeChild = slots.title ? slots.title() : props.title\n const description: VNodeChild = slots.description ? slots.description() : props.description\n const actions = slots.actions?.()\n const showActions = hasContent(actions) || !!props.onDismiss\n\n return h(\n \"div\",\n {\n \"ref\": containerRef,\n \"class\": s.Alert,\n \"data-variant\": props.variant,\n \"data-color\": color,\n \"role\": color === \"danger\" ? \"alert\" : undefined,\n \"data-actions-placement\": props.actionsPlacement ?? actionsAutoPlacement.value,\n \"data-banner\": props.banner ? \"\" : undefined,\n },\n [\n props.indicator === false\n ? null\n : h(\"div\", { class: s.Indicator }, slots.indicator ? slots.indicator() : [Indicator(color)]),\n h(\"div\", { class: s.Content }, [\n h(\"div\", { class: s.Message }, [\n hasContent([title as VNodeArrayChildren]) ? h(\"div\", { class: s.Title }, [title]) : null,\n hasContent([description as VNodeArrayChildren])\n ? h(\"div\", { class: s.Description }, [description])\n : null,\n ]),\n showActions\n ? h(\"div\", { class: clsx(s.Actions, props.actionsClassName), ref: actionsRef }, [\n actions,\n props.onDismiss\n ? h(\n Button,\n { type: \"button\", onClick: props.onDismiss, color, variant: \"soft\", pill: true, class: s.DismissButton },\n { default: () => \"Dismiss\" },\n )\n : null,\n ])\n : null,\n ]),\n // On a phone the alert is dismissed with a close button in its corner, as an iOS tip is\n props.onDismiss\n ? h(\n Button,\n { \"type\": \"button\", \"onClick\": props.onDismiss, \"color\": \"secondary\", \"variant\": \"soft\", \"size\": \"sm\", \"uniform\": true, \"pill\": true, \"aria-label\": \"Dismiss\", \"class\": s.CloseButton },\n { default: () => [h(X)] },\n )\n : null,\n ],\n )\n }\n },\n})\n\ntype AlertOwnProps = InstanceType<typeof AlertComponent>[\"$props\"]\n\n/** Alert props plus the native <div> attributes that fall through to it, as in React. */\nexport type AlertProps = AlertOwnProps & Omit<HTMLAttributes, keyof AlertOwnProps>\n\n/** Inline message with a semantic color, optional title, description and actions. */\nexport const Alert = AlertComponent as typeof AlertComponent & { new (): { $props: A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EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC,WAAW,EAAE,EACvL,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAC1B;oBACH,CAAC,CAAC,IAAI;aACT,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAOF,qFAAqF;AACrF,MAAM,CAAC,MAAM,KAAK,GAAG,cAA4E,CAAA","sourcesContent":["import clsx from \"clsx\"\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n ref,\n watch,\n type HTMLAttributes,\n type PropType,\n type VNodeArrayChildren,\n type VNodeChild,\n} from \"vue\"\nimport type { SemanticColors, Variants } from \"@plexui/styles/types\"\nimport { CheckCircle, Info, Warning, X } from \"../Icon/index.js\"\nimport { Button } from \"../Button/index.js\"\nimport { hasContent } from \"../../lib/slotContent.js\"\nimport s from \"@plexui/styles/components/Alert/Alert.module.css\"\n\n// Vue port of packages/ui/src/components/Alert/Alert.tsx. ReactNode props\n// are slots (`title`, `description`, `actions`, `indicator`), with string\n// props as fallback for `title` and `description`. `:indicator=\"false\"`\n// hides the indicator. `onDismiss` stays a function prop (`@dismiss` in\n// templates) because its presence adds the Dismiss button.\n// The actions auto placement mirrors usehooks-ts `useResizeObserver`: it\n// reacts to the container's content-box width only.\n\nexport type AlertMobileActions = \"capsules\" | \"own\"\n\nexport type AlertColor = SemanticColors<\n \"primary\" | \"danger\" | \"success\" | \"info\" | \"discovery\" | \"caution\" | \"warning\"\n>\n\n/** Default indicator icon, chosen from the color (which signals intention). */\nconst Indicator = (color: AlertColor) => {\n switch (color) {\n case \"warning\":\n case \"caution\":\n case \"danger\":\n return h(Warning)\n case \"success\":\n return h(CheckCircle)\n default:\n return h(Info)\n }\n}\n\n// usehooks-ts `extractSize` for the content box\nconst contentBoxSize = (entry: ResizeObserverEntry, sizeType: \"inlineSize\" | \"blockSize\") => {\n const box = entry.contentBoxSize as ReadonlyArray<ResizeObserverSize> | ResizeObserverSize | undefined\n if (!box) return entry.contentRect[sizeType === \"inlineSize\" ? \"width\" : \"height\"]\n // Firefox once reported a single object instead of an array\n return Array.isArray(box) ? box[0]?.[sizeType] : (box as ResizeObserverSize)[sizeType]\n}\n\nconst AlertComponent = defineComponent({\n name: \"Alert\",\n props: {\n /** Color of the alert. @default \"primary\" */\n color: { type: String as PropType<AlertColor>, default: \"primary\" },\n /** Style variant. @default \"outline\" */\n variant: { type: String as PropType<Variants<\"solid\" | \"soft\" | \"outline\">>, default: \"outline\" },\n /** Title displayed in the alert (or the `title` slot). */\n title: String,\n /** Description text displayed in the alert (or the `description` slot). */\n description: String,\n /** Places `actions` at the end or the bottom. Automatic from sizing when unset. */\n actionsPlacement: String as PropType<\"end\" | \"bottom\">,\n /**\n * How the actions show at 767px and below: 50px capsules side by side, as the buttons of an iOS tip (TipKit),\n * or the buttons as given, at their own size, for an alert inside a block of buttons of its own. @default \"capsules\"\n */\n mobileActions: { type: String as PropType<AlertMobileActions>, default: \"capsules\" },\n /** `false` hides the indicator. Use the `indicator` slot to replace it. */\n indicator: { type: Boolean, default: undefined },\n /** Class applied to the actions container */\n actionsClassName: String,\n /** Shows the Dismiss button; called when it is clicked. */\n onDismiss: Function as PropType<(event: MouseEvent) => void>,\n /** A full-width strip across a page or panel: square corners, lines above and below only. @default false */\n banner: { type: Boolean, default: false },\n },\n setup(props, { slots }) {\n const containerRef = ref<HTMLDivElement | null>(null)\n const actionsRef = ref<HTMLDivElement | null>(null)\n const actionsAutoPlacement = ref<\"end\" | \"bottom\">(\"end\")\n const containerWidth = ref<number | undefined>(undefined)\n\n let observer: ResizeObserver | undefined\n onMounted(() => {\n const container = containerRef.value\n if (!container) return\n if (typeof window === \"undefined\" || !(\"ResizeObserver\" in window)) return\n let previousWidth: number | undefined\n let previousHeight: number | undefined\n observer = new ResizeObserver(([entry]) => {\n if (!entry) return\n const width = contentBoxSize(entry, \"inlineSize\")\n const height = contentBoxSize(entry, \"blockSize\")\n if (width !== previousWidth || height !== previousHeight) {\n previousWidth = width\n previousHeight = height\n containerWidth.value = width\n }\n })\n observer.observe(container, { box: \"content-box\" })\n })\n onBeforeUnmount(() => observer?.disconnect())\n\n watch(containerWidth, (width) => {\n const actionsWidth = actionsRef.value?.clientWidth ?? 0\n\n if (actionsWidth && width) {\n // If actions are larger than a third of the container width, wrap them.\n actionsAutoPlacement.value = actionsWidth > width / 3 ? \"bottom\" : \"end\"\n }\n })\n\n return () => {\n const { color } = props\n const title: VNodeChild = slots.title ? slots.title() : props.title\n const description: VNodeChild = slots.description ? slots.description() : props.description\n const actions = slots.actions?.()\n const showActions = hasContent(actions) || !!props.onDismiss\n\n return h(\n \"div\",\n {\n \"ref\": containerRef,\n \"class\": s.Alert,\n \"data-variant\": props.variant,\n \"data-color\": color,\n \"role\": color === \"danger\" ? \"alert\" : undefined,\n \"data-actions-placement\": props.actionsPlacement ?? actionsAutoPlacement.value,\n \"data-banner\": props.banner ? \"\" : undefined,\n \"data-mobile-actions\": props.mobileActions === \"own\" ? \"own\" : undefined,\n },\n [\n props.indicator === false\n ? null\n : h(\"div\", { class: s.Indicator }, slots.indicator ? slots.indicator() : [Indicator(color)]),\n h(\"div\", { class: s.Content }, [\n h(\"div\", { class: s.Message }, [\n hasContent([title as VNodeArrayChildren]) ? h(\"div\", { class: s.Title }, [title]) : null,\n hasContent([description as VNodeArrayChildren])\n ? h(\"div\", { class: s.Description }, [description])\n : null,\n ]),\n showActions\n ? h(\"div\", { class: clsx(s.Actions, props.actionsClassName), ref: actionsRef }, [\n actions,\n props.onDismiss\n ? h(\n Button,\n { type: \"button\", onClick: props.onDismiss, color, variant: \"soft\", pill: true, class: s.DismissButton },\n { default: () => \"Dismiss\" },\n )\n : null,\n ])\n : null,\n ]),\n // On a phone the alert is dismissed with a close button in its corner, as an iOS tip is\n props.onDismiss\n ? h(\n Button,\n { \"type\": \"button\", \"onClick\": props.onDismiss, \"color\": \"secondary\", \"variant\": \"soft\", \"size\": \"sm\", \"uniform\": true, \"pill\": true, \"aria-label\": \"Dismiss\", \"class\": s.CloseButton },\n { default: () => [h(X)] },\n )\n : null,\n ],\n )\n }\n },\n})\n\ntype AlertOwnProps = InstanceType<typeof AlertComponent>[\"$props\"]\n\n/** Alert props plus the native <div> attributes that fall through to it, as in React. */\nexport type AlertProps = AlertOwnProps & Omit<HTMLAttributes, keyof AlertOwnProps>\n\n/** Inline message with a semantic color, optional title, description and actions. */\nexport const Alert = AlertComponent as typeof AlertComponent & { new (): { $props: AlertProps } }\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Alert/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Alert/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAA6D,MAAM,YAAY,CAAA","sourcesContent":["export { Alert, type AlertColor, type AlertMobileActions, type AlertProps } from \"./Alert.js\"\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { computed, defineComponent, Fragment, h, inject, onBeforeUnmount, onMounted, provide, ref, Text, } from "vue";
|
|
1
|
+
import { computed, defineComponent, Fragment, h, inject, onBeforeUnmount, onMounted, provide, ref, Text, watch, } from "vue";
|
|
2
|
+
import { attachDrawerSwipe, closeOnUnhandledEscape, drawerInitialFocus, loopDrawerFocus } from "../../lib/phoneDrawer.js";
|
|
2
3
|
import { Button } from "../Button/index.js";
|
|
3
4
|
import { ChevronRightMd, Disclosure, Search as SearchIcon, Sidebar as SidebarIcon, SidebarMenuMobile, X } from "../Icon/index.js";
|
|
4
5
|
import { Input } from "../Input/index.js";
|
|
@@ -216,8 +217,10 @@ export const SidebarMenuItem = SidebarMenuItemComponent;
|
|
|
216
217
|
// =============================================
|
|
217
218
|
// Shared by every row of the rail: moving to the next one shows its label at once.
|
|
218
219
|
let railLeftAt = 0;
|
|
219
|
-
// Rows inside the mobile drawer end with a disclosure chevron (see the drawer list in the styles)
|
|
220
|
+
// Rows inside the mobile drawer end with a disclosure chevron (see the drawer list in the styles), unless the drawer
|
|
221
|
+
// leaves it out (`:disclosure="false"`).
|
|
220
222
|
const sidebarDrawerKey = Symbol("SidebarDrawer");
|
|
223
|
+
const notInDrawer = computed(() => false);
|
|
221
224
|
/** The chevron of a drawer row that leads to another page. */
|
|
222
225
|
const menuDisclosure = () => h("span", { "class": s.MenuDisclosure, "aria-hidden": "true" }, [h(Disclosure)]);
|
|
223
226
|
const SidebarMenuButtonComponent = defineComponent({
|
|
@@ -236,7 +239,7 @@ const SidebarMenuButtonComponent = defineComponent({
|
|
|
236
239
|
},
|
|
237
240
|
setup(props, { attrs, slots }) {
|
|
238
241
|
const sidebar = useSidebar();
|
|
239
|
-
const
|
|
242
|
+
const drawerRows = inject(sidebarDrawerKey, notInDrawer);
|
|
240
243
|
const openDelay = ref();
|
|
241
244
|
return () => {
|
|
242
245
|
const { className, rest } = cleanAttrs(attrs);
|
|
@@ -256,7 +259,7 @@ const SidebarMenuButtonComponent = defineComponent({
|
|
|
256
259
|
});
|
|
257
260
|
}
|
|
258
261
|
const content = slots.default?.();
|
|
259
|
-
const wrap = (children) => h("span", { class: s.MenuButtonInner },
|
|
262
|
+
const wrap = (children) => h("span", { class: s.MenuButtonInner }, drawerRows.value ? [children, menuDisclosure()] : children);
|
|
260
263
|
let button;
|
|
261
264
|
if (props.asChild) {
|
|
262
265
|
// With asChild the child element is the button, so the inner wrapper
|
|
@@ -387,7 +390,7 @@ const SidebarMenuSubButtonComponent = defineComponent({
|
|
|
387
390
|
indent: { type: Number, default: 0 },
|
|
388
391
|
},
|
|
389
392
|
setup(props, { attrs, slots }) {
|
|
390
|
-
const
|
|
393
|
+
const drawerRows = inject(sidebarDrawerKey, notInDrawer);
|
|
391
394
|
return () => {
|
|
392
395
|
const { className, rest } = cleanAttrs(attrs);
|
|
393
396
|
const ownProps = {
|
|
@@ -397,7 +400,7 @@ const SidebarMenuSubButtonComponent = defineComponent({
|
|
|
397
400
|
...rest,
|
|
398
401
|
};
|
|
399
402
|
const content = slots.default?.();
|
|
400
|
-
if (!
|
|
403
|
+
if (!drawerRows.value)
|
|
401
404
|
return props.asChild ? renderAsChild(content, ownProps) : h("button", ownProps, content);
|
|
402
405
|
// In the drawer the disclosure follows the content, inside the child element with asChild
|
|
403
406
|
if (props.asChild) {
|
|
@@ -474,8 +477,21 @@ export const SidebarCardTitleLink = defineComponent({
|
|
|
474
477
|
});
|
|
475
478
|
export const SidebarCardContent = part("SidebarCardContent", "div", s.CardContent);
|
|
476
479
|
export const SidebarCardFooter = part("SidebarCardFooter", "div", s.CardFooter);
|
|
477
|
-
/**
|
|
478
|
-
|
|
480
|
+
/**
|
|
481
|
+
* Main content area next to the sidebar, a `<main>`. Behind the open phone drawer it takes no focus or touch
|
|
482
|
+
* (`inert`); an `inert` of your own wins.
|
|
483
|
+
*/
|
|
484
|
+
export const SidebarInset = defineComponent({
|
|
485
|
+
name: "SidebarInset",
|
|
486
|
+
inheritAttrs: false,
|
|
487
|
+
setup(_props, { attrs, slots }) {
|
|
488
|
+
const sidebar = useSidebar();
|
|
489
|
+
return () => {
|
|
490
|
+
const { className, rest } = cleanAttrs(attrs);
|
|
491
|
+
return h("main", { inert: sidebar.isMobile && sidebar.openMobile ? "" : undefined, ...rest, class: [s.Inset, className] }, slots.default?.());
|
|
492
|
+
};
|
|
493
|
+
},
|
|
494
|
+
});
|
|
479
495
|
/** Wrapper for the sidebar and the main content. */
|
|
480
496
|
export const SidebarLayout = part("SidebarLayout", "div", s.SidebarLayout);
|
|
481
497
|
/**
|
|
@@ -542,19 +558,72 @@ export const SidebarMobileMenuButton = defineComponent({
|
|
|
542
558
|
// =============================================
|
|
543
559
|
// Mobile Sidebar
|
|
544
560
|
// =============================================
|
|
561
|
+
/**
|
|
562
|
+
* The phone drawer: a modal dialog while it is open. Focus moves into it and Tab goes round its controls, the page
|
|
563
|
+
* behind is inert (SidebarInset), Escape inside it closes it after any layer over it has taken its own, and focus
|
|
564
|
+
* goes back to the control that opened it. A swipe in from the edge it slides from opens it and a swipe back closes
|
|
565
|
+
* it (lib/phoneDrawer).
|
|
566
|
+
*/
|
|
545
567
|
const SidebarMobileComponent = defineComponent({
|
|
546
568
|
name: "SidebarMobile",
|
|
547
569
|
inheritAttrs: false,
|
|
548
570
|
props: {
|
|
549
571
|
/** When true, drawer is positioned absolute instead of fixed (for contained demos) */
|
|
550
572
|
contained: { type: Boolean, default: undefined },
|
|
573
|
+
/** Rows that lead to another page end with a disclosure chevron, as in an iOS list. `false` leaves it out. @default true */
|
|
574
|
+
disclosure: { type: Boolean, default: true },
|
|
551
575
|
},
|
|
552
576
|
setup(props, { attrs, slots }) {
|
|
553
577
|
const sidebar = useSidebar();
|
|
554
|
-
provide(sidebarDrawerKey,
|
|
578
|
+
provide(sidebarDrawerKey, computed(() => props.disclosure));
|
|
579
|
+
const drawer = ref();
|
|
580
|
+
const setDrawer = (el) => {
|
|
581
|
+
drawer.value = el instanceof HTMLElement ? el : el?.$el;
|
|
582
|
+
};
|
|
583
|
+
let detachSwipe;
|
|
584
|
+
onMounted(() => {
|
|
585
|
+
// Focus moves in on open and back to what opened the drawer on close (from mount, as React's effect). A drawer
|
|
586
|
+
// that is not contained shows only at phone width, so going back to it from a wide window moves focus in again.
|
|
587
|
+
watch(() => sidebar.openMobile && (sidebar.isMobile || Boolean(props.contained)), (open, _, onCleanup) => {
|
|
588
|
+
const el = drawer.value;
|
|
589
|
+
if (!open || !el)
|
|
590
|
+
return;
|
|
591
|
+
const trigger = document.activeElement;
|
|
592
|
+
if (!el.contains(document.activeElement))
|
|
593
|
+
drawerInitialFocus(el).focus({ preventScroll: true });
|
|
594
|
+
onCleanup(() => {
|
|
595
|
+
const active = document.activeElement;
|
|
596
|
+
const lost = !active || active === document.body || el.contains(active);
|
|
597
|
+
if (lost && trigger instanceof HTMLElement && trigger.isConnected && !el.contains(trigger)) {
|
|
598
|
+
trigger.focus({ preventScroll: true });
|
|
599
|
+
}
|
|
600
|
+
});
|
|
601
|
+
}, { flush: "post", immediate: true });
|
|
602
|
+
const el = drawer.value;
|
|
603
|
+
const root = el?.closest("[data-mobile-menu]");
|
|
604
|
+
if (!el || !root)
|
|
605
|
+
return;
|
|
606
|
+
detachSwipe = attachDrawerSwipe({
|
|
607
|
+
root,
|
|
608
|
+
drawer: el,
|
|
609
|
+
isOpen: () => sidebar.openMobile,
|
|
610
|
+
setOpen: (open) => sidebar.setOpenMobile(open),
|
|
611
|
+
enabled: () => sidebar.isMobile,
|
|
612
|
+
});
|
|
613
|
+
});
|
|
614
|
+
onBeforeUnmount(() => detachSwipe?.());
|
|
615
|
+
const onDrawerKeydown = (event) => {
|
|
616
|
+
const el = drawer.value;
|
|
617
|
+
if (!sidebar.openMobile || !el)
|
|
618
|
+
return;
|
|
619
|
+
loopDrawerFocus(event, el);
|
|
620
|
+
closeOnUnhandledEscape(event, el, () => sidebar.setOpenMobile(false));
|
|
621
|
+
};
|
|
555
622
|
return () => {
|
|
556
623
|
const { className, rest } = cleanAttrs(attrs);
|
|
624
|
+
const { onKeydown: userKeydown, ...drawerAttrs } = rest;
|
|
557
625
|
const contained = props.contained && s.contained;
|
|
626
|
+
const open = sidebar.openMobile;
|
|
558
627
|
return [
|
|
559
628
|
// Backdrop
|
|
560
629
|
h("div", {
|
|
@@ -563,7 +632,23 @@ const SidebarMobileComponent = defineComponent({
|
|
|
563
632
|
"aria-hidden": "true",
|
|
564
633
|
}),
|
|
565
634
|
// Drawer
|
|
566
|
-
h("div", {
|
|
635
|
+
h("div", {
|
|
636
|
+
"ref": setDrawer,
|
|
637
|
+
"role": "dialog",
|
|
638
|
+
"aria-modal": open ? "true" : undefined,
|
|
639
|
+
"aria-label": "Menu",
|
|
640
|
+
"tabindex": -1,
|
|
641
|
+
"inert": open ? undefined : "",
|
|
642
|
+
...drawerAttrs,
|
|
643
|
+
"class": [s.MobileSidebar, contained, className],
|
|
644
|
+
// Your handler runs first and can keep the drawer open with preventDefault(), as onKeyDown in React
|
|
645
|
+
"onKeydown": (event) => {
|
|
646
|
+
for (const handler of [userKeydown].flat())
|
|
647
|
+
if (typeof handler === "function")
|
|
648
|
+
handler(event);
|
|
649
|
+
onDrawerKeydown(event);
|
|
650
|
+
},
|
|
651
|
+
}, slots.default?.()),
|
|
567
652
|
];
|
|
568
653
|
};
|
|
569
654
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar.js","sourceRoot":"","sources":["../../../../src/components/Sidebar/Sidebar.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,CAAC,EACD,MAAM,EACN,eAAe,EACf,SAAS,EACT,OAAO,EACP,GAAG,EACH,IAAI,GAWL,MAAM,KAAK,CAAA;AACZ,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,IAAI,UAAU,EAAE,OAAO,IAAI,WAAW,EAAE,iBAAiB,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAA;AACjI,OAAO,EAAE,KAAK,EAAmB,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACzG,OAAO,CAAC,MAAM,sDAAsD,CAAA;AACpE,OAAO,EACL,eAAe,EACf,UAAU,GAKX,MAAM,wBAAwB,CAAA;AAE/B,0EAA0E;AAC1E,2EAA2E;AAC3E,6EAA6E;AAC7E,0EAA0E;AAC1E,+EAA+E;AAC/E,0EAA0E;AAC1E,6EAA6E;AAC7E,QAAQ;AACR,2EAA2E;AAC3E,2EAA2E;AAC3E,yEAAyE;AACzE,yEAAyE;AACzE,6DAA6D;AAC7D,oEAAoE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C7C,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE;gBAClC,CAAC,CACC,KAAK,EACL,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,cAAc,EAAE,EAClD,EAAE,GAAG,KAAK,EAAE,cAAc,EAAE,KAAK,CAAC,cAAc,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,CAC5E;aACF,CAAC,CAAA;QACJ,CAAC,CAAA;IACH,CAAC;CACF,CAA4B,CAAA;AAQ7B,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAA0B,oBAAoB,EAAE,KAAK,EAAE,CAAC,CAAC,WAAW,CAAC,CAAA","sourcesContent":["import {\n computed,\n defineComponent,\n Fragment,\n h,\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n Text,\n type AnchorHTMLAttributes,\n type ButtonHTMLAttributes,\n type DefineComponent,\n type HTMLAttributes,\n type InjectionKey,\n type LiHTMLAttributes,\n type PropType,\n type Slots,\n type VNode,\n type VNodeArrayChildren,\n} from \"vue\"\nimport { Button } from \"../Button/index.js\"\nimport { ChevronRightMd, Disclosure, Search as SearchIcon, Sidebar as SidebarIcon, SidebarMenuMobile, X } from \"../Icon/index.js\"\nimport { Input, type InputProps } from \"../Input/index.js\"\nimport { Tooltip } from \"../Tooltip/index.js\"\nimport { composeEventHandlers, firstElementChild, flattenSlot, mergeSlotProps } from \"../Tooltip/slot.js\"\nimport s from \"@plexui/styles/components/Sidebar/Sidebar.module.css\"\nimport {\n SidebarProvider,\n useSidebar,\n type SidebarCollapsible,\n type SidebarSide,\n type SidebarProviderVariant,\n type SidebarVariant,\n} from \"./useSidebarContext.js\"\n\n// Vue port of packages/ui/src/components/Sidebar/Sidebar.tsx. Exports are\n// flat, as in React's index. Every part renders its React element with the\n// caller's attributes applied after its own (React spreads `...props` last),\n// so a caller's attribute or listener replaces the part's own. `class` is\n// merged. An `@click` on SidebarTrigger or SidebarMobileMenuButton runs before\n// the toggle and cancels it with `preventDefault()`, as `onClick` does in\n// React. `data-toggle` (injected by MDX) is dropped, as React's `cleanProps`\n// does.\n// - `asChild` (SidebarGroupLabel, SidebarMenuButton, SidebarMenuSubButton)\n// merges into the first element of the default slot the way Radix's Slot\n// does. SidebarMenuButton puts its inner `<span>` inside that element,\n// around the element's own content, as React clones it; with no single\n// element child it merges into the inner `<span>` instead.\n// - ReactNode props are slots: SidebarMenuButton `tooltip` (prop or\n// `#tooltip` slot), SidebarTrigger's icon (default slot), SidebarInput's\n// `startAdornment` (slot, Search icon by default).\n// - Parts whose React children are fixed (SidebarMenuChevron,\n// SidebarMenuSkeleton, SidebarMobileMenuButton) ignore the default slot.\n\n// Re-export provider and composable\nexport { SidebarProvider, useSidebar }\nexport type { SidebarCollapsible, SidebarProviderVariant, SidebarSide, SidebarVariant }\n\ntype Attrs = Record<string, unknown>\n\n// Filter out attributes that shouldn't reach the DOM (e.g. injected by MDX)\nconst cleanAttrs = (attrs: Attrs) => {\n const { \"data-toggle\": _, class: className, ...rest } = attrs\n return { className, rest }\n}\n\n// An explicit type keeps the published declaration on Vue's `DefineComponent`\n// alias; an inferred one is expanded there and fails consumers' type checks\n// (`GlobalComponents` against `Record<string, Component>`, TS2344).\ntype Part<A> = DefineComponent & { new (): { $props: A } }\n\n/** A part that renders one element with its class and the caller's attributes. */\nconst part = <A>(name: string, tag: string, className: string | undefined): Part<A> => {\n const component = defineComponent({\n name,\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n return () => {\n const { className: userClass, rest } = cleanAttrs(attrs)\n return h(tag, { ...rest, class: [className, userClass] }, slots.default?.())\n }\n },\n })\n return component as unknown as Part<A>\n}\n\n// =============================================\n// Sidebar Root\n// =============================================\n\nconst SidebarComponent = defineComponent({\n name: \"Sidebar\",\n inheritAttrs: false,\n props: {\n /** The side the sidebar is on. @default \"left\" */\n side: { type: String as PropType<SidebarSide>, default: \"left\" },\n /** The visual variant of the sidebar. @default \"sidebar\" */\n variant: { type: String as PropType<SidebarVariant>, default: \"sidebar\" },\n },\n setup(props, { attrs, slots }) {\n const sidebar = useSidebar()\n\n return () => {\n // Skip rendering sidebar on mobile for offcanvas mode\n if (sidebar.isMobile && sidebar.collapsible === \"offcanvas\") {\n return null\n }\n\n const { className, rest } = cleanAttrs(attrs)\n return h(\n \"aside\",\n { \"data-side\": props.side, \"data-variant\": props.variant, \"class\": [s.Sidebar, className], ...rest },\n slots.default?.(),\n )\n }\n },\n})\n\nexport type SidebarProps = InstanceType<typeof SidebarComponent>[\"$props\"] & HTMLAttributes\n\n/** The sidebar container, an `<aside>`. Renders nothing on mobile in offcanvas mode. */\nexport const Sidebar = SidebarComponent as typeof SidebarComponent & { new (): { $props: SidebarProps } }\n\n// =============================================\n// Sidebar Sections\n// =============================================\n\nexport type SidebarHeaderProps = HTMLAttributes\n\n/** Sticky top area of the sidebar. */\nexport const SidebarHeader = part<SidebarHeaderProps>(\"SidebarHeader\", \"div\", s.Header)\n\nexport type SidebarContentProps = HTMLAttributes\n\n/**\n * Scrollable content area. Sets `data-content-scrollable` on the sidebar\n * while its content overflows.\n */\nexport const SidebarContent = defineComponent({\n name: \"SidebarContent\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const contentEl = ref<HTMLDivElement | null>(null)\n let observer: ResizeObserver | undefined\n\n onMounted(() => {\n const el = contentEl.value\n if (!el) return\n const sidebar = el.parentElement\n if (!sidebar) return\n\n const update = () => {\n const hasOverflow = el.scrollHeight > el.clientHeight\n sidebar.setAttribute(\"data-content-scrollable\", hasOverflow ? \"true\" : \"false\")\n }\n update()\n observer = new ResizeObserver(update)\n observer.observe(el)\n })\n onBeforeUnmount(() => observer?.disconnect())\n\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"div\", { ref: contentEl, class: [s.Content, className], ...rest }, slots.default?.())\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarContentProps>>\n\nexport type SidebarFooterProps = HTMLAttributes\n\n/** Sticky bottom area of the sidebar, with a separator line on top. */\nexport const SidebarFooter = defineComponent({\n name: \"SidebarFooter\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"div\", { class: [s.Footer, className], ...rest }, [\n h(\"div\", { class: s.FooterSeparator }),\n slots.default?.(),\n ])\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarFooterProps>>\n\nexport type SidebarRailProps = HTMLAttributes\n\nexport const SidebarRail = part<SidebarRailProps>(\"SidebarRail\", \"div\", s.Rail)\n\n// =============================================\n// Groups\n// =============================================\n\nconst SidebarGroupComponent = defineComponent({\n name: \"SidebarGroup\",\n inheritAttrs: false,\n props: {\n /** Whether the group is open initially. A closed group hides its `SidebarGroupContent`. @default true */\n defaultOpen: { type: Boolean, default: true },\n /** Controlled open state. The group has no toggle of its own: change `open` from your own control. */\n open: { type: Boolean, default: undefined },\n },\n setup(props, { attrs, slots }) {\n // The initial value only, like an uncontrolled input's defaultValue\n const internalOpen = ref(props.defaultOpen)\n\n return () => {\n const open = props.open ?? internalOpen.value\n const { className, rest } = cleanAttrs(attrs)\n return h(\n \"div\",\n { \"data-state\": open ? \"open\" : \"closed\", \"class\": [s.Group, className], ...rest },\n slots.default?.(),\n )\n }\n },\n})\n\nexport type SidebarGroupProps = InstanceType<typeof SidebarGroupComponent>[\"$props\"] & HTMLAttributes\n\n/** Section within the content. `data-state` follows `open` / `defaultOpen`. */\nexport const SidebarGroup = SidebarGroupComponent as typeof SidebarGroupComponent & {\n new (): { $props: SidebarGroupProps }\n}\n\n/** Radix Slot: the first element of the slot, with `slotProps` merged in. */\nconst renderAsChild = (children: VNodeArrayChildren | undefined, slotProps: Attrs) => {\n const child = firstElementChild(children)\n return child ? mergeSlotProps(child, slotProps) : null\n}\n\n/**\n * React's `cloneElement(child, undefined, wrap(child.props.children))`: the\n * same element (key and ref kept) with its content, or its default slot for a\n * component such as RouterLink, passed through `wrap`.\n */\nconst wrapChildContent = (child: VNode, wrap: (content: VNodeArrayChildren | undefined) => VNode): VNode => {\n const content = child.children\n let children: VNodeArrayChildren | Slots\n if (content && typeof content === \"object\" && !Array.isArray(content)) {\n // Drop the compiled-slots flag so the new default slot is always used\n const { _: _compiled, ...slotFns } = content as Slots & { _?: unknown }\n children = { ...slotFns, default: () => [wrap(slotFns.default?.())] }\n } else {\n children = [wrap(typeof content === \"string\" ? [content] : (content ?? undefined))]\n }\n return h(child.type as string, { ...child.props, key: child.key ?? undefined, ref: child.ref as never }, children as never)\n}\n\nconst SidebarGroupLabelComponent = defineComponent({\n name: \"SidebarGroupLabel\",\n inheritAttrs: false,\n props: {\n /** Merges into the slot's first element instead of rendering a `<span>`. @default false */\n asChild: { type: Boolean, default: false },\n /**\n * Size variant for the label.\n * - \"sm\": Compact style for dashboard/settings sidebars\n * - \"lg\": Documentation style with larger text and more spacing\n * @default \"lg\"\n */\n size: { type: String as PropType<\"sm\" | \"lg\">, default: \"lg\" },\n },\n setup(props, { attrs, slots }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n const ownProps = { \"data-size\": props.size, \"class\": [s.GroupLabel, className], ...rest }\n return props.asChild ? renderAsChild(slots.default?.(), ownProps) : h(\"span\", ownProps, slots.default?.())\n }\n },\n})\n\nexport type SidebarGroupLabelProps = InstanceType<typeof SidebarGroupLabelComponent>[\"$props\"] & HTMLAttributes\n\n/** Section label within a SidebarGroup. */\nexport const SidebarGroupLabel = SidebarGroupLabelComponent as typeof SidebarGroupLabelComponent & {\n new (): { $props: SidebarGroupLabelProps }\n}\n\nexport type SidebarGroupActionProps = HTMLAttributes\n\nexport const SidebarGroupAction = part<SidebarGroupActionProps>(\"SidebarGroupAction\", \"div\", s.GroupAction)\n\nexport type SidebarGroupContentProps = HTMLAttributes\n\nexport const SidebarGroupContent = part<SidebarGroupContentProps>(\"SidebarGroupContent\", \"div\", s.GroupContent)\n\n// =============================================\n// Menu\n// =============================================\n\nexport type SidebarMenuProps = HTMLAttributes\n\n/** Navigation menu, a `<ul>`. */\nexport const SidebarMenu = part<SidebarMenuProps>(\"SidebarMenu\", \"ul\", s.Menu)\n\nconst SidebarMenuItemComponent = defineComponent({\n name: \"SidebarMenuItem\",\n inheritAttrs: false,\n props: {\n /** Marks the item as expanded (`data-expanded`), for chevrons and sub menus. */\n expanded: { type: Boolean, default: undefined },\n },\n setup(props, { attrs, slots }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\n \"li\",\n { \"data-expanded\": props.expanded ? \"true\" : undefined, \"class\": [s.MenuItem, className], ...rest },\n slots.default?.(),\n )\n }\n },\n})\n\nexport type SidebarMenuItemProps = InstanceType<typeof SidebarMenuItemComponent>[\"$props\"] & LiHTMLAttributes\n\n/** Menu item, an `<li>`. */\nexport const SidebarMenuItem = SidebarMenuItemComponent as typeof SidebarMenuItemComponent & {\n new (): { $props: SidebarMenuItemProps }\n}\n\n// =============================================\n// Menu Button\n// =============================================\n\n// Shared by every row of the rail: moving to the next one shows its label at once.\nlet railLeftAt = 0\n\n// Rows inside the mobile drawer end with a disclosure chevron (see the drawer list in the styles).\nconst sidebarDrawerKey: InjectionKey<boolean> = Symbol(\"SidebarDrawer\")\n\n/** The chevron of a drawer row that leads to another page. */\nconst menuDisclosure = () => h(\"span\", { \"class\": s.MenuDisclosure, \"aria-hidden\": \"true\" }, [h(Disclosure)])\n\nconst SidebarMenuButtonComponent = defineComponent({\n name: \"SidebarMenuButton\",\n inheritAttrs: false,\n props: {\n /** Whether the button is in an active/highlighted state. @default false */\n isActive: { type: Boolean, default: false },\n /**\n * Optional tooltip to show when the sidebar is collapsed (or the\n * `#tooltip` slot). Hidden on mobile.\n */\n tooltip: String,\n /** Whether to render the button as a custom element via Slot. @default false */\n asChild: { type: Boolean, default: false },\n },\n setup(props, { attrs, slots }) {\n const sidebar = useSidebar()\n const inDrawer = inject(sidebarDrawerKey, false)\n const openDelay = ref<number>()\n\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n const hasTooltip = !!(props.tooltip || slots.tooltip)\n const ownProps: Record<string, unknown> = {\n \"data-active\": props.isActive ? \"true\" : \"false\",\n \"aria-current\": props.isActive ? \"page\" : undefined,\n \"class\": [s.MenuButton, className],\n ...rest,\n }\n if (hasTooltip) {\n ownProps.onPointerenter = composeEventHandlers(rest.onPointerenter, () => {\n openDelay.value = Date.now() - railLeftAt < 300 ? 0 : undefined\n })\n ownProps.onPointerleave = composeEventHandlers(rest.onPointerleave, () => {\n railLeftAt = Date.now()\n })\n }\n const content = slots.default?.()\n const wrap = (children: VNodeArrayChildren | undefined) =>\n h(\"span\", { class: s.MenuButtonInner }, inDrawer ? [children, menuDisclosure()] : children)\n let button: VNode\n if (props.asChild) {\n // With asChild the child element is the button, so the inner wrapper\n // goes inside it. Wrapping the child instead would merge the button\n // attributes onto the wrapper span.\n // A lone text child is wrapped below rather than slotted\n const nodes = flattenSlot(content)\n const child = nodes.length === 1 && nodes[0].type !== Text ? nodes[0] : undefined\n button = mergeSlotProps(child ? wrapChildContent(child, wrap) : wrap(content), ownProps)\n } else {\n button = h(\"button\", ownProps, [wrap(content)])\n }\n\n // The tooltip shows when collapsed (icon mode) and not on mobile. It wraps\n // the row in every state, so the row stays mounted and its label can fade.\n if (hasTooltip) {\n const shown = sidebar.state === \"collapsed\" && !sidebar.isMobile\n return h(\n Tooltip,\n { content: shown ? props.tooltip : null, openDelay: openDelay.value, side: \"right\" },\n { default: () => button, ...(slots.tooltip && shown ? { content: slots.tooltip } : {}) },\n )\n }\n\n return button\n }\n },\n})\n\nexport type SidebarMenuButtonProps = InstanceType<typeof SidebarMenuButtonComponent>[\"$props\"] & ButtonHTMLAttributes\n\n/** Menu item button. Shows its `tooltip` when the sidebar is collapsed to icons. */\nexport const SidebarMenuButton = SidebarMenuButtonComponent as typeof SidebarMenuButtonComponent & {\n new (): { $props: SidebarMenuButtonProps }\n}\n\n// =============================================\n// Menu Button Parts\n// =============================================\n\nexport type SidebarMenuButtonIconProps = HTMLAttributes\n\nexport const SidebarMenuButtonIcon = part<SidebarMenuButtonIconProps>(\n \"SidebarMenuButtonIcon\",\n \"span\",\n s.MenuButtonIcon,\n)\n\nconst SidebarMenuButtonLabelComponent = defineComponent({\n name: \"SidebarMenuButtonLabel\",\n inheritAttrs: false,\n props: {\n /** Shorter label rendered next to the full one (`data-short-label`). */\n shortLabel: String,\n },\n setup(props, { attrs, slots }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return [\n h(\n \"span\",\n { \"data-long-label\": \"true\", \"class\": [s.MenuButtonLabel, className], ...rest },\n slots.default?.(),\n ),\n props.shortLabel\n ? h(\"span\", { \"data-short-label\": \"true\", \"class\": [s.MenuButtonLabel, className] }, props.shortLabel)\n : null,\n ]\n }\n },\n})\n\nexport type SidebarMenuButtonLabelProps = InstanceType<typeof SidebarMenuButtonLabelComponent>[\"$props\"] & HTMLAttributes\n\nexport const SidebarMenuButtonLabel = SidebarMenuButtonLabelComponent as typeof SidebarMenuButtonLabelComponent & {\n new (): { $props: SidebarMenuButtonLabelProps }\n}\n\n// =============================================\n// Menu Chevron (Expand/Collapse Toggle)\n// =============================================\n\nexport type SidebarMenuChevronProps = HTMLAttributes\n\nexport const SidebarMenuChevron = defineComponent({\n name: \"SidebarMenuChevron\",\n inheritAttrs: false,\n setup(_props, { attrs }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"span\", { class: [s.MenuChevron, className], ...rest }, [h(ChevronRightMd)])\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarMenuChevronProps>>\n\n// =============================================\n// Menu Badge & Action\n// =============================================\n\nexport type SidebarMenuBadgeProps = HTMLAttributes\n\nexport const SidebarMenuBadge = part<SidebarMenuBadgeProps>(\"SidebarMenuBadge\", \"span\", s.MenuBadge)\n\nexport type SidebarMenuActionProps = HTMLAttributes\n\nexport const SidebarMenuAction = part<SidebarMenuActionProps>(\"SidebarMenuAction\", \"div\", s.MenuAction)\n\n// =============================================\n// Menu Skeleton\n// =============================================\n\nconst SidebarMenuSkeletonComponent = defineComponent({\n name: \"SidebarMenuSkeleton\",\n inheritAttrs: false,\n props: {\n /** Renders the icon placeholder. @default true */\n showIcon: { type: Boolean, default: true },\n /** Width of the label skeleton (e.g., \"60%\", \"80%\", \"100px\"). @default \"60%\" */\n labelWidth: { type: String, default: \"60%\" },\n },\n setup(props, { attrs }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"div\", { \"data-skeleton\": \"true\", \"class\": [s.MenuSkeleton, className], ...rest }, [\n props.showIcon ? h(\"div\", { class: s.MenuSkeletonIcon }) : null,\n h(\"div\", { class: s.MenuSkeletonLabel, style: { width: props.labelWidth } }),\n ])\n }\n },\n})\n\nexport type SidebarMenuSkeletonProps = InstanceType<typeof SidebarMenuSkeletonComponent>[\"$props\"] & HTMLAttributes\n\nexport const SidebarMenuSkeleton = SidebarMenuSkeletonComponent as typeof SidebarMenuSkeletonComponent & {\n new (): { $props: SidebarMenuSkeletonProps }\n}\n\n// =============================================\n// Submenu\n// =============================================\n\nconst SidebarMenuSubComponent = defineComponent({\n name: \"SidebarMenuSub\",\n inheritAttrs: false,\n props: {\n /** Whether the submenu is expanded. @default true */\n open: { type: Boolean, default: true },\n /**\n * When true, child items align with parent text that has icons.\n * This adjusts the padding so level 2 text aligns with level 1 text.\n * @default false\n */\n hasIcons: { type: Boolean, default: false },\n },\n setup(props, { attrs, slots }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\n \"ul\",\n {\n \"data-state\": props.open ? \"open\" : \"closed\",\n \"data-has-icons\": props.hasIcons ? \"true\" : undefined,\n // Collapsed items are only hidden visually: keep them out of the tab\n // order. \"\" renders `inert=\"\"` (a DOM property in browsers)\n \"inert\": props.open ? undefined : \"\",\n \"class\": [s.MenuSub, className],\n ...rest,\n },\n slots.default?.(),\n )\n }\n },\n})\n\nexport type SidebarMenuSubProps = InstanceType<typeof SidebarMenuSubComponent>[\"$props\"] & HTMLAttributes\n\nexport const SidebarMenuSub = SidebarMenuSubComponent as typeof SidebarMenuSubComponent & {\n new (): { $props: SidebarMenuSubProps }\n}\n\nexport type SidebarMenuSubItemProps = LiHTMLAttributes\n\nexport const SidebarMenuSubItem = part<SidebarMenuSubItemProps>(\"SidebarMenuSubItem\", \"li\", s.MenuSubItem)\n\nconst SidebarMenuSubButtonComponent = defineComponent({\n name: \"SidebarMenuSubButton\",\n inheritAttrs: false,\n props: {\n /** Whether the button is in an active/highlighted state. @default false */\n isActive: { type: Boolean, default: false },\n /** Merges into the slot's first element instead of rendering a `<button>`. @default false */\n asChild: { type: Boolean, default: false },\n /**\n * Indent level for nested items (0-3).\n * Each level adds 12px of left margin.\n * @default 0\n */\n indent: { type: Number as PropType<0 | 1 | 2 | 3>, default: 0 },\n },\n setup(props, { attrs, slots }) {\n const inDrawer = inject(sidebarDrawerKey, false)\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n const ownProps = {\n \"data-active\": props.isActive ? \"true\" : \"false\",\n \"aria-current\": props.isActive ? \"page\" : undefined,\n \"class\": [s.MenuSubButton, s[`indent${props.indent}`], className],\n ...rest,\n }\n const content = slots.default?.()\n if (!inDrawer) return props.asChild ? renderAsChild(content, ownProps) : h(\"button\", ownProps, content)\n // In the drawer the disclosure follows the content, inside the child element with asChild\n if (props.asChild) {\n const child = firstElementChild(content)\n return child ? mergeSlotProps(wrapChildContent(child, (inner) => h(Fragment, null, [inner, menuDisclosure()])), ownProps) : null\n }\n return h(\"button\", ownProps, [content, menuDisclosure()])\n }\n },\n})\n\nexport type SidebarMenuSubButtonProps = InstanceType<typeof SidebarMenuSubButtonComponent>[\"$props\"] & ButtonHTMLAttributes\n\nexport const SidebarMenuSubButton = SidebarMenuSubButtonComponent as typeof SidebarMenuSubButtonComponent & {\n new (): { $props: SidebarMenuSubButtonProps }\n}\n\n// =============================================\n// Separator\n// =============================================\n\nexport type SidebarSeparatorProps = HTMLAttributes\n\nexport const SidebarSeparator = defineComponent({\n name: \"SidebarSeparator\",\n inheritAttrs: false,\n setup(_props, { attrs }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"hr\", { class: [s.Separator, className], ...rest })\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarSeparatorProps>>\n\n// =============================================\n// Card\n// =============================================\n\nconst SidebarCardComponent = defineComponent({\n name: \"SidebarCard\",\n inheritAttrs: false,\n props: {\n /** Visual variant. @default \"default\" */\n variant: { type: String as PropType<\"default\" | \"elevated\">, default: \"default\" },\n /** Shows a dismiss button. @default false */\n dismissible: { type: Boolean, default: false },\n },\n emits: {\n /** The dismiss button was clicked */\n dismiss: (_event: MouseEvent) => true,\n },\n setup(props, { attrs, slots, emit }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"div\", { \"data-variant\": props.variant, \"class\": [s.Card, className], ...rest }, [\n props.dismissible\n ? h(\n Button,\n {\n \"uniform\": true,\n \"size\": \"3xs\",\n \"variant\": \"ghost\",\n \"color\": \"secondary\",\n \"class\": s.CardDismiss,\n \"onClick\": (event: MouseEvent) => emit(\"dismiss\", event),\n \"aria-label\": \"Dismiss\",\n },\n { default: () => h(X) },\n )\n : null,\n slots.default?.(),\n ])\n }\n },\n})\n\nexport type SidebarCardProps = InstanceType<typeof SidebarCardComponent>[\"$props\"] & HTMLAttributes\n\n/** Promotional card for CTAs, upgrades or announcements. */\nexport const SidebarCard = SidebarCardComponent as typeof SidebarCardComponent & {\n new (): { $props: SidebarCardProps }\n}\n\nexport type SidebarCardHeaderProps = HTMLAttributes\n\nexport const SidebarCardHeader = part<SidebarCardHeaderProps>(\"SidebarCardHeader\", \"div\", s.CardHeader)\n\nexport type SidebarCardTitleProps = HTMLAttributes\n\nexport const SidebarCardTitle = part<SidebarCardTitleProps>(\"SidebarCardTitle\", \"div\", s.CardTitle)\n\nexport type SidebarCardTitleLinkProps = AnchorHTMLAttributes\n\nexport const SidebarCardTitleLink = defineComponent({\n name: \"SidebarCardTitleLink\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"a\", { class: [s.CardTitleLink, className], ...rest }, [\n slots.default?.(),\n h(ChevronRightMd, { class: s.CardTitleChevron }),\n ])\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarCardTitleLinkProps>>\n\nexport type SidebarCardContentProps = HTMLAttributes\n\nexport const SidebarCardContent = part<SidebarCardContentProps>(\"SidebarCardContent\", \"div\", s.CardContent)\n\nexport type SidebarCardFooterProps = HTMLAttributes\n\nexport const SidebarCardFooter = part<SidebarCardFooterProps>(\"SidebarCardFooter\", \"div\", s.CardFooter)\n\n// =============================================\n// Inset (Main Content Area)\n// =============================================\n\nexport type SidebarInsetProps = HTMLAttributes\n\n/** Main content area next to the sidebar, a `<main>`. */\nexport const SidebarInset = part<SidebarInsetProps>(\"SidebarInset\", \"main\", s.Inset)\n\n// =============================================\n// Layout Container\n// =============================================\n\nexport type SidebarLayoutProps = HTMLAttributes\n\n/** Wrapper for the sidebar and the main content. */\nexport const SidebarLayout = part<SidebarLayoutProps>(\"SidebarLayout\", \"div\", s.SidebarLayout)\n\n// =============================================\n// Trigger (Collapse Button)\n// =============================================\n\nexport type SidebarTriggerProps = ButtonHTMLAttributes\n\n/**\n * Collapse button. The default slot replaces the icon. Renders nothing when\n * `collapsible=\"none\"`.\n */\nexport const SidebarTrigger = defineComponent({\n name: \"SidebarTrigger\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const sidebar = useSidebar()\n\n return () => {\n // Don't render if collapsible=\"none\" (text-only sidebars)\n if (sidebar.collapsible === \"none\") {\n return null\n }\n\n const { className, rest } = cleanAttrs(attrs)\n const { onClick, ...others } = rest\n return h(\n \"button\",\n {\n \"type\": \"button\",\n \"class\": [s.Trigger, className],\n // The caller's listener runs first and can cancel the toggle\n \"onClick\": composeEventHandlers(onClick, () => sidebar.toggleSidebar()),\n \"aria-label\": sidebar.isMobile\n ? \"Open menu\"\n : sidebar.state === \"expanded\"\n ? \"Collapse sidebar\"\n : \"Expand sidebar\",\n ...others,\n },\n [\n h(\"span\", { class: s.TriggerInner }, [\n // One icon for both states: the tooltip, not the icon, says what a press does\n h(\"span\", { class: s.TriggerIcon }, slots.default ? slots.default() : [h(SidebarIcon)]),\n ]),\n ],\n )\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarTriggerProps>>\n\n// =============================================\n// Mobile Menu Button (SidebarMenuMobile icon → X)\n// =============================================\n\nexport type SidebarMobileMenuButtonProps = ButtonHTMLAttributes\n\nexport const SidebarMobileMenuButton = defineComponent({\n name: \"SidebarMobileMenuButton\",\n inheritAttrs: false,\n setup(_props, { attrs }) {\n const sidebar = useSidebar()\n\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n const { onClick, ...others } = rest\n return h(\n \"button\",\n {\n \"type\": \"button\",\n \"data-expanded\": sidebar.openMobile ? \"\" : undefined,\n \"class\": [s.MobileMenuButton, className],\n // The caller's listener runs first and can cancel the toggle\n \"onClick\": composeEventHandlers(onClick, () => sidebar.setOpenMobile(!sidebar.openMobile)),\n \"aria-label\": sidebar.openMobile ? \"Close menu\" : \"Open menu\",\n ...others,\n },\n [\n h(\"span\", { class: s.MobileMenuIcon }, [\n h(SidebarMenuMobile, { \"class\": s.MobileMenuGlyph, \"data-glyph\": \"menu\" }),\n h(X, { \"class\": s.MobileMenuGlyph, \"data-glyph\": \"close\" }),\n ]),\n ],\n )\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarMobileMenuButtonProps>>\n\n// =============================================\n// Mobile Sidebar\n// =============================================\n\nconst SidebarMobileComponent = defineComponent({\n name: \"SidebarMobile\",\n inheritAttrs: false,\n props: {\n /** When true, drawer is positioned absolute instead of fixed (for contained demos) */\n contained: { type: Boolean, default: undefined },\n },\n setup(props, { attrs, slots }) {\n const sidebar = useSidebar()\n provide(sidebarDrawerKey, true)\n\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n const contained = props.contained && s.contained\n return [\n // Backdrop\n h(\"div\", {\n \"class\": [s.MobileBackdrop, contained],\n \"onClick\": () => sidebar.setOpenMobile(false),\n \"aria-hidden\": \"true\",\n }),\n // Drawer\n h(\"div\", { class: [s.MobileSidebar, contained, className], ...rest }, slots.default?.()),\n ]\n }\n },\n})\n\nexport type SidebarMobileProps = InstanceType<typeof SidebarMobileComponent>[\"$props\"] & HTMLAttributes\n\nexport const SidebarMobile = SidebarMobileComponent as typeof SidebarMobileComponent & {\n new (): { $props: SidebarMobileProps }\n}\n\nexport type SidebarMobileHeaderProps = HTMLAttributes\n\nexport const SidebarMobileHeader = part<SidebarMobileHeaderProps>(\"SidebarMobileHeader\", \"div\", s.MobileHeader)\n\nexport type SidebarMobileFooterProps = HTMLAttributes\n\nexport const SidebarMobileFooter = part<SidebarMobileFooterProps>(\"SidebarMobileFooter\", \"div\", s.MobileFooter)\n\n// =============================================\n// Input (Search)\n// =============================================\n\nexport type SidebarInputProps = InputProps\n\n/**\n * Search input: an Input with a Search icon in its `startAdornment` slot.\n * Every attribute, listener and slot goes to the Input (`v-model:value`,\n * `@clear`, ...). A template ref gets the Input's `focus()` and `input`\n * (React forwards its ref to the <input>).\n */\nexport const SidebarInput = defineComponent({\n name: \"SidebarInput\",\n inheritAttrs: false,\n setup(_props, { attrs, slots, expose }) {\n // Input's exposed API\n const inputComponent = ref<{ input: HTMLInputElement | null; focus: () => void } | null>(null)\n\n expose({\n focus: () => inputComponent.value?.focus(),\n input: computed(() => inputComponent.value?.input ?? null),\n })\n\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"div\", { class: s.Input }, [\n h(\n Input,\n { class: className, ...rest, ref: inputComponent },\n { ...slots, startAdornment: slots.startAdornment ?? (() => h(SearchIcon)) },\n ),\n ])\n }\n },\n}) as unknown as typeof Input\n\n// =============================================\n// Footer Links\n// =============================================\n\nexport type SidebarFooterLinksProps = HTMLAttributes\n\nexport const SidebarFooterLinks = part<SidebarFooterLinksProps>(\"SidebarFooterLinks\", \"div\", s.FooterLin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KAAK,CAAC,cAAc,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,CAC5E;aACF,CAAC,CAAA;QACJ,CAAC,CAAA;IACH,CAAC;CACF,CAA4B,CAAA;AAQ7B,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAA0B,oBAAoB,EAAE,KAAK,EAAE,CAAC,CAAC,WAAW,CAAC,CAAA","sourcesContent":["import {\n computed,\n defineComponent,\n Fragment,\n h,\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n ref,\n Text,\n watch,\n type AnchorHTMLAttributes,\n type ButtonHTMLAttributes,\n type DefineComponent,\n type HTMLAttributes,\n type InjectionKey,\n type LiHTMLAttributes,\n type PropType,\n type Ref,\n type Slots,\n type VNode,\n type VNodeArrayChildren,\n} from \"vue\"\nimport { attachDrawerSwipe, closeOnUnhandledEscape, drawerInitialFocus, loopDrawerFocus } from \"../../lib/phoneDrawer.js\"\nimport { Button } from \"../Button/index.js\"\nimport { ChevronRightMd, Disclosure, Search as SearchIcon, Sidebar as SidebarIcon, SidebarMenuMobile, X } from \"../Icon/index.js\"\nimport { Input, type InputProps } from \"../Input/index.js\"\nimport { Tooltip } from \"../Tooltip/index.js\"\nimport { composeEventHandlers, firstElementChild, flattenSlot, mergeSlotProps } from \"../Tooltip/slot.js\"\nimport s from \"@plexui/styles/components/Sidebar/Sidebar.module.css\"\nimport {\n SidebarProvider,\n useSidebar,\n type SidebarCollapsible,\n type SidebarSide,\n type SidebarProviderVariant,\n type SidebarVariant,\n} from \"./useSidebarContext.js\"\n\n// Vue port of packages/ui/src/components/Sidebar/Sidebar.tsx. Exports are\n// flat, as in React's index. Every part renders its React element with the\n// caller's attributes applied after its own (React spreads `...props` last),\n// so a caller's attribute or listener replaces the part's own. `class` is\n// merged. An `@click` on SidebarTrigger or SidebarMobileMenuButton runs before\n// the toggle and cancels it with `preventDefault()`, as `onClick` does in\n// React. `data-toggle` (injected by MDX) is dropped, as React's `cleanProps`\n// does.\n// - `asChild` (SidebarGroupLabel, SidebarMenuButton, SidebarMenuSubButton)\n// merges into the first element of the default slot the way Radix's Slot\n// does. SidebarMenuButton puts its inner `<span>` inside that element,\n// around the element's own content, as React clones it; with no single\n// element child it merges into the inner `<span>` instead.\n// - ReactNode props are slots: SidebarMenuButton `tooltip` (prop or\n// `#tooltip` slot), SidebarTrigger's icon (default slot), SidebarInput's\n// `startAdornment` (slot, Search icon by default).\n// - Parts whose React children are fixed (SidebarMenuChevron,\n// SidebarMenuSkeleton, SidebarMobileMenuButton) ignore the default slot.\n\n// Re-export provider and composable\nexport { SidebarProvider, useSidebar }\nexport type { SidebarCollapsible, SidebarProviderVariant, SidebarSide, SidebarVariant }\n\ntype Attrs = Record<string, unknown>\n\n// Filter out attributes that shouldn't reach the DOM (e.g. injected by MDX)\nconst cleanAttrs = (attrs: Attrs) => {\n const { \"data-toggle\": _, class: className, ...rest } = attrs\n return { className, rest }\n}\n\n// An explicit type keeps the published declaration on Vue's `DefineComponent`\n// alias; an inferred one is expanded there and fails consumers' type checks\n// (`GlobalComponents` against `Record<string, Component>`, TS2344).\ntype Part<A> = DefineComponent & { new (): { $props: A } }\n\n/** A part that renders one element with its class and the caller's attributes. */\nconst part = <A>(name: string, tag: string, className: string | undefined): Part<A> => {\n const component = defineComponent({\n name,\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n return () => {\n const { className: userClass, rest } = cleanAttrs(attrs)\n return h(tag, { ...rest, class: [className, userClass] }, slots.default?.())\n }\n },\n })\n return component as unknown as Part<A>\n}\n\n// =============================================\n// Sidebar Root\n// =============================================\n\nconst SidebarComponent = defineComponent({\n name: \"Sidebar\",\n inheritAttrs: false,\n props: {\n /** The side the sidebar is on. @default \"left\" */\n side: { type: String as PropType<SidebarSide>, default: \"left\" },\n /** The visual variant of the sidebar. @default \"sidebar\" */\n variant: { type: String as PropType<SidebarVariant>, default: \"sidebar\" },\n },\n setup(props, { attrs, slots }) {\n const sidebar = useSidebar()\n\n return () => {\n // Skip rendering sidebar on mobile for offcanvas mode\n if (sidebar.isMobile && sidebar.collapsible === \"offcanvas\") {\n return null\n }\n\n const { className, rest } = cleanAttrs(attrs)\n return h(\n \"aside\",\n { \"data-side\": props.side, \"data-variant\": props.variant, \"class\": [s.Sidebar, className], ...rest },\n slots.default?.(),\n )\n }\n },\n})\n\nexport type SidebarProps = InstanceType<typeof SidebarComponent>[\"$props\"] & HTMLAttributes\n\n/** The sidebar container, an `<aside>`. Renders nothing on mobile in offcanvas mode. */\nexport const Sidebar = SidebarComponent as typeof SidebarComponent & { new (): { $props: SidebarProps } }\n\n// =============================================\n// Sidebar Sections\n// =============================================\n\nexport type SidebarHeaderProps = HTMLAttributes\n\n/** Sticky top area of the sidebar. */\nexport const SidebarHeader = part<SidebarHeaderProps>(\"SidebarHeader\", \"div\", s.Header)\n\nexport type SidebarContentProps = HTMLAttributes\n\n/**\n * Scrollable content area. Sets `data-content-scrollable` on the sidebar\n * while its content overflows.\n */\nexport const SidebarContent = defineComponent({\n name: \"SidebarContent\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const contentEl = ref<HTMLDivElement | null>(null)\n let observer: ResizeObserver | undefined\n\n onMounted(() => {\n const el = contentEl.value\n if (!el) return\n const sidebar = el.parentElement\n if (!sidebar) return\n\n const update = () => {\n const hasOverflow = el.scrollHeight > el.clientHeight\n sidebar.setAttribute(\"data-content-scrollable\", hasOverflow ? \"true\" : \"false\")\n }\n update()\n observer = new ResizeObserver(update)\n observer.observe(el)\n })\n onBeforeUnmount(() => observer?.disconnect())\n\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"div\", { ref: contentEl, class: [s.Content, className], ...rest }, slots.default?.())\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarContentProps>>\n\nexport type SidebarFooterProps = HTMLAttributes\n\n/** Sticky bottom area of the sidebar, with a separator line on top. */\nexport const SidebarFooter = defineComponent({\n name: \"SidebarFooter\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"div\", { class: [s.Footer, className], ...rest }, [\n h(\"div\", { class: s.FooterSeparator }),\n slots.default?.(),\n ])\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarFooterProps>>\n\nexport type SidebarRailProps = HTMLAttributes\n\nexport const SidebarRail = part<SidebarRailProps>(\"SidebarRail\", \"div\", s.Rail)\n\n// =============================================\n// Groups\n// =============================================\n\nconst SidebarGroupComponent = defineComponent({\n name: \"SidebarGroup\",\n inheritAttrs: false,\n props: {\n /** Whether the group is open initially. A closed group hides its `SidebarGroupContent`. @default true */\n defaultOpen: { type: Boolean, default: true },\n /** Controlled open state. The group has no toggle of its own: change `open` from your own control. */\n open: { type: Boolean, default: undefined },\n },\n setup(props, { attrs, slots }) {\n // The initial value only, like an uncontrolled input's defaultValue\n const internalOpen = ref(props.defaultOpen)\n\n return () => {\n const open = props.open ?? internalOpen.value\n const { className, rest } = cleanAttrs(attrs)\n return h(\n \"div\",\n { \"data-state\": open ? \"open\" : \"closed\", \"class\": [s.Group, className], ...rest },\n slots.default?.(),\n )\n }\n },\n})\n\nexport type SidebarGroupProps = InstanceType<typeof SidebarGroupComponent>[\"$props\"] & HTMLAttributes\n\n/** Section within the content. `data-state` follows `open` / `defaultOpen`. */\nexport const SidebarGroup = SidebarGroupComponent as typeof SidebarGroupComponent & {\n new (): { $props: SidebarGroupProps }\n}\n\n/** Radix Slot: the first element of the slot, with `slotProps` merged in. */\nconst renderAsChild = (children: VNodeArrayChildren | undefined, slotProps: Attrs) => {\n const child = firstElementChild(children)\n return child ? mergeSlotProps(child, slotProps) : null\n}\n\n/**\n * React's `cloneElement(child, undefined, wrap(child.props.children))`: the\n * same element (key and ref kept) with its content, or its default slot for a\n * component such as RouterLink, passed through `wrap`.\n */\nconst wrapChildContent = (child: VNode, wrap: (content: VNodeArrayChildren | undefined) => VNode): VNode => {\n const content = child.children\n let children: VNodeArrayChildren | Slots\n if (content && typeof content === \"object\" && !Array.isArray(content)) {\n // Drop the compiled-slots flag so the new default slot is always used\n const { _: _compiled, ...slotFns } = content as Slots & { _?: unknown }\n children = { ...slotFns, default: () => [wrap(slotFns.default?.())] }\n } else {\n children = [wrap(typeof content === \"string\" ? [content] : (content ?? undefined))]\n }\n return h(child.type as string, { ...child.props, key: child.key ?? undefined, ref: child.ref as never }, children as never)\n}\n\nconst SidebarGroupLabelComponent = defineComponent({\n name: \"SidebarGroupLabel\",\n inheritAttrs: false,\n props: {\n /** Merges into the slot's first element instead of rendering a `<span>`. @default false */\n asChild: { type: Boolean, default: false },\n /**\n * Size variant for the label.\n * - \"sm\": Compact style for dashboard/settings sidebars\n * - \"lg\": Documentation style with larger text and more spacing\n * @default \"lg\"\n */\n size: { type: String as PropType<\"sm\" | \"lg\">, default: \"lg\" },\n },\n setup(props, { attrs, slots }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n const ownProps = { \"data-size\": props.size, \"class\": [s.GroupLabel, className], ...rest }\n return props.asChild ? renderAsChild(slots.default?.(), ownProps) : h(\"span\", ownProps, slots.default?.())\n }\n },\n})\n\nexport type SidebarGroupLabelProps = InstanceType<typeof SidebarGroupLabelComponent>[\"$props\"] & HTMLAttributes\n\n/** Section label within a SidebarGroup. */\nexport const SidebarGroupLabel = SidebarGroupLabelComponent as typeof SidebarGroupLabelComponent & {\n new (): { $props: SidebarGroupLabelProps }\n}\n\nexport type SidebarGroupActionProps = HTMLAttributes\n\nexport const SidebarGroupAction = part<SidebarGroupActionProps>(\"SidebarGroupAction\", \"div\", s.GroupAction)\n\nexport type SidebarGroupContentProps = HTMLAttributes\n\nexport const SidebarGroupContent = part<SidebarGroupContentProps>(\"SidebarGroupContent\", \"div\", s.GroupContent)\n\n// =============================================\n// Menu\n// =============================================\n\nexport type SidebarMenuProps = HTMLAttributes\n\n/** Navigation menu, a `<ul>`. */\nexport const SidebarMenu = part<SidebarMenuProps>(\"SidebarMenu\", \"ul\", s.Menu)\n\nconst SidebarMenuItemComponent = defineComponent({\n name: \"SidebarMenuItem\",\n inheritAttrs: false,\n props: {\n /** Marks the item as expanded (`data-expanded`), for chevrons and sub menus. */\n expanded: { type: Boolean, default: undefined },\n },\n setup(props, { attrs, slots }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\n \"li\",\n { \"data-expanded\": props.expanded ? \"true\" : undefined, \"class\": [s.MenuItem, className], ...rest },\n slots.default?.(),\n )\n }\n },\n})\n\nexport type SidebarMenuItemProps = InstanceType<typeof SidebarMenuItemComponent>[\"$props\"] & LiHTMLAttributes\n\n/** Menu item, an `<li>`. */\nexport const SidebarMenuItem = SidebarMenuItemComponent as typeof SidebarMenuItemComponent & {\n new (): { $props: SidebarMenuItemProps }\n}\n\n// =============================================\n// Menu Button\n// =============================================\n\n// Shared by every row of the rail: moving to the next one shows its label at once.\nlet railLeftAt = 0\n\n// Rows inside the mobile drawer end with a disclosure chevron (see the drawer list in the styles), unless the drawer\n// leaves it out (`:disclosure=\"false\"`).\nconst sidebarDrawerKey: InjectionKey<Ref<boolean>> = Symbol(\"SidebarDrawer\")\nconst notInDrawer = computed(() => false)\n\n/** The chevron of a drawer row that leads to another page. */\nconst menuDisclosure = () => h(\"span\", { \"class\": s.MenuDisclosure, \"aria-hidden\": \"true\" }, [h(Disclosure)])\n\nconst SidebarMenuButtonComponent = defineComponent({\n name: \"SidebarMenuButton\",\n inheritAttrs: false,\n props: {\n /** Whether the button is in an active/highlighted state. @default false */\n isActive: { type: Boolean, default: false },\n /**\n * Optional tooltip to show when the sidebar is collapsed (or the\n * `#tooltip` slot). Hidden on mobile.\n */\n tooltip: String,\n /** Whether to render the button as a custom element via Slot. @default false */\n asChild: { type: Boolean, default: false },\n },\n setup(props, { attrs, slots }) {\n const sidebar = useSidebar()\n const drawerRows = inject(sidebarDrawerKey, notInDrawer)\n const openDelay = ref<number>()\n\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n const hasTooltip = !!(props.tooltip || slots.tooltip)\n const ownProps: Record<string, unknown> = {\n \"data-active\": props.isActive ? \"true\" : \"false\",\n \"aria-current\": props.isActive ? \"page\" : undefined,\n \"class\": [s.MenuButton, className],\n ...rest,\n }\n if (hasTooltip) {\n ownProps.onPointerenter = composeEventHandlers(rest.onPointerenter, () => {\n openDelay.value = Date.now() - railLeftAt < 300 ? 0 : undefined\n })\n ownProps.onPointerleave = composeEventHandlers(rest.onPointerleave, () => {\n railLeftAt = Date.now()\n })\n }\n const content = slots.default?.()\n const wrap = (children: VNodeArrayChildren | undefined) =>\n h(\"span\", { class: s.MenuButtonInner }, drawerRows.value ? [children, menuDisclosure()] : children)\n let button: VNode\n if (props.asChild) {\n // With asChild the child element is the button, so the inner wrapper\n // goes inside it. Wrapping the child instead would merge the button\n // attributes onto the wrapper span.\n // A lone text child is wrapped below rather than slotted\n const nodes = flattenSlot(content)\n const child = nodes.length === 1 && nodes[0].type !== Text ? nodes[0] : undefined\n button = mergeSlotProps(child ? wrapChildContent(child, wrap) : wrap(content), ownProps)\n } else {\n button = h(\"button\", ownProps, [wrap(content)])\n }\n\n // The tooltip shows when collapsed (icon mode) and not on mobile. It wraps\n // the row in every state, so the row stays mounted and its label can fade.\n if (hasTooltip) {\n const shown = sidebar.state === \"collapsed\" && !sidebar.isMobile\n return h(\n Tooltip,\n { content: shown ? props.tooltip : null, openDelay: openDelay.value, side: \"right\" },\n { default: () => button, ...(slots.tooltip && shown ? { content: slots.tooltip } : {}) },\n )\n }\n\n return button\n }\n },\n})\n\nexport type SidebarMenuButtonProps = InstanceType<typeof SidebarMenuButtonComponent>[\"$props\"] & ButtonHTMLAttributes\n\n/** Menu item button. Shows its `tooltip` when the sidebar is collapsed to icons. */\nexport const SidebarMenuButton = SidebarMenuButtonComponent as typeof SidebarMenuButtonComponent & {\n new (): { $props: SidebarMenuButtonProps }\n}\n\n// =============================================\n// Menu Button Parts\n// =============================================\n\nexport type SidebarMenuButtonIconProps = HTMLAttributes\n\nexport const SidebarMenuButtonIcon = part<SidebarMenuButtonIconProps>(\n \"SidebarMenuButtonIcon\",\n \"span\",\n s.MenuButtonIcon,\n)\n\nconst SidebarMenuButtonLabelComponent = defineComponent({\n name: \"SidebarMenuButtonLabel\",\n inheritAttrs: false,\n props: {\n /** Shorter label rendered next to the full one (`data-short-label`). */\n shortLabel: String,\n },\n setup(props, { attrs, slots }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return [\n h(\n \"span\",\n { \"data-long-label\": \"true\", \"class\": [s.MenuButtonLabel, className], ...rest },\n slots.default?.(),\n ),\n props.shortLabel\n ? h(\"span\", { \"data-short-label\": \"true\", \"class\": [s.MenuButtonLabel, className] }, props.shortLabel)\n : null,\n ]\n }\n },\n})\n\nexport type SidebarMenuButtonLabelProps = InstanceType<typeof SidebarMenuButtonLabelComponent>[\"$props\"] & HTMLAttributes\n\nexport const SidebarMenuButtonLabel = SidebarMenuButtonLabelComponent as typeof SidebarMenuButtonLabelComponent & {\n new (): { $props: SidebarMenuButtonLabelProps }\n}\n\n// =============================================\n// Menu Chevron (Expand/Collapse Toggle)\n// =============================================\n\nexport type SidebarMenuChevronProps = HTMLAttributes\n\nexport const SidebarMenuChevron = defineComponent({\n name: \"SidebarMenuChevron\",\n inheritAttrs: false,\n setup(_props, { attrs }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"span\", { class: [s.MenuChevron, className], ...rest }, [h(ChevronRightMd)])\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarMenuChevronProps>>\n\n// =============================================\n// Menu Badge & Action\n// =============================================\n\nexport type SidebarMenuBadgeProps = HTMLAttributes\n\nexport const SidebarMenuBadge = part<SidebarMenuBadgeProps>(\"SidebarMenuBadge\", \"span\", s.MenuBadge)\n\nexport type SidebarMenuActionProps = HTMLAttributes\n\nexport const SidebarMenuAction = part<SidebarMenuActionProps>(\"SidebarMenuAction\", \"div\", s.MenuAction)\n\n// =============================================\n// Menu Skeleton\n// =============================================\n\nconst SidebarMenuSkeletonComponent = defineComponent({\n name: \"SidebarMenuSkeleton\",\n inheritAttrs: false,\n props: {\n /** Renders the icon placeholder. @default true */\n showIcon: { type: Boolean, default: true },\n /** Width of the label skeleton (e.g., \"60%\", \"80%\", \"100px\"). @default \"60%\" */\n labelWidth: { type: String, default: \"60%\" },\n },\n setup(props, { attrs }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"div\", { \"data-skeleton\": \"true\", \"class\": [s.MenuSkeleton, className], ...rest }, [\n props.showIcon ? h(\"div\", { class: s.MenuSkeletonIcon }) : null,\n h(\"div\", { class: s.MenuSkeletonLabel, style: { width: props.labelWidth } }),\n ])\n }\n },\n})\n\nexport type SidebarMenuSkeletonProps = InstanceType<typeof SidebarMenuSkeletonComponent>[\"$props\"] & HTMLAttributes\n\nexport const SidebarMenuSkeleton = SidebarMenuSkeletonComponent as typeof SidebarMenuSkeletonComponent & {\n new (): { $props: SidebarMenuSkeletonProps }\n}\n\n// =============================================\n// Submenu\n// =============================================\n\nconst SidebarMenuSubComponent = defineComponent({\n name: \"SidebarMenuSub\",\n inheritAttrs: false,\n props: {\n /** Whether the submenu is expanded. @default true */\n open: { type: Boolean, default: true },\n /**\n * When true, child items align with parent text that has icons.\n * This adjusts the padding so level 2 text aligns with level 1 text.\n * @default false\n */\n hasIcons: { type: Boolean, default: false },\n },\n setup(props, { attrs, slots }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\n \"ul\",\n {\n \"data-state\": props.open ? \"open\" : \"closed\",\n \"data-has-icons\": props.hasIcons ? \"true\" : undefined,\n // Collapsed items are only hidden visually: keep them out of the tab\n // order. \"\" renders `inert=\"\"` (a DOM property in browsers)\n \"inert\": props.open ? undefined : \"\",\n \"class\": [s.MenuSub, className],\n ...rest,\n },\n slots.default?.(),\n )\n }\n },\n})\n\nexport type SidebarMenuSubProps = InstanceType<typeof SidebarMenuSubComponent>[\"$props\"] & HTMLAttributes\n\nexport const SidebarMenuSub = SidebarMenuSubComponent as typeof SidebarMenuSubComponent & {\n new (): { $props: SidebarMenuSubProps }\n}\n\nexport type SidebarMenuSubItemProps = LiHTMLAttributes\n\nexport const SidebarMenuSubItem = part<SidebarMenuSubItemProps>(\"SidebarMenuSubItem\", \"li\", s.MenuSubItem)\n\nconst SidebarMenuSubButtonComponent = defineComponent({\n name: \"SidebarMenuSubButton\",\n inheritAttrs: false,\n props: {\n /** Whether the button is in an active/highlighted state. @default false */\n isActive: { type: Boolean, default: false },\n /** Merges into the slot's first element instead of rendering a `<button>`. @default false */\n asChild: { type: Boolean, default: false },\n /**\n * Indent level for nested items (0-3).\n * Each level adds 12px of left margin.\n * @default 0\n */\n indent: { type: Number as PropType<0 | 1 | 2 | 3>, default: 0 },\n },\n setup(props, { attrs, slots }) {\n const drawerRows = inject(sidebarDrawerKey, notInDrawer)\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n const ownProps = {\n \"data-active\": props.isActive ? \"true\" : \"false\",\n \"aria-current\": props.isActive ? \"page\" : undefined,\n \"class\": [s.MenuSubButton, s[`indent${props.indent}`], className],\n ...rest,\n }\n const content = slots.default?.()\n if (!drawerRows.value) return props.asChild ? renderAsChild(content, ownProps) : h(\"button\", ownProps, content)\n // In the drawer the disclosure follows the content, inside the child element with asChild\n if (props.asChild) {\n const child = firstElementChild(content)\n return child ? mergeSlotProps(wrapChildContent(child, (inner) => h(Fragment, null, [inner, menuDisclosure()])), ownProps) : null\n }\n return h(\"button\", ownProps, [content, menuDisclosure()])\n }\n },\n})\n\nexport type SidebarMenuSubButtonProps = InstanceType<typeof SidebarMenuSubButtonComponent>[\"$props\"] & ButtonHTMLAttributes\n\nexport const SidebarMenuSubButton = SidebarMenuSubButtonComponent as typeof SidebarMenuSubButtonComponent & {\n new (): { $props: SidebarMenuSubButtonProps }\n}\n\n// =============================================\n// Separator\n// =============================================\n\nexport type SidebarSeparatorProps = HTMLAttributes\n\nexport const SidebarSeparator = defineComponent({\n name: \"SidebarSeparator\",\n inheritAttrs: false,\n setup(_props, { attrs }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"hr\", { class: [s.Separator, className], ...rest })\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarSeparatorProps>>\n\n// =============================================\n// Card\n// =============================================\n\nconst SidebarCardComponent = defineComponent({\n name: \"SidebarCard\",\n inheritAttrs: false,\n props: {\n /** Visual variant. @default \"default\" */\n variant: { type: String as PropType<\"default\" | \"elevated\">, default: \"default\" },\n /** Shows a dismiss button. @default false */\n dismissible: { type: Boolean, default: false },\n },\n emits: {\n /** The dismiss button was clicked */\n dismiss: (_event: MouseEvent) => true,\n },\n setup(props, { attrs, slots, emit }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"div\", { \"data-variant\": props.variant, \"class\": [s.Card, className], ...rest }, [\n props.dismissible\n ? h(\n Button,\n {\n \"uniform\": true,\n \"size\": \"3xs\",\n \"variant\": \"ghost\",\n \"color\": \"secondary\",\n \"class\": s.CardDismiss,\n \"onClick\": (event: MouseEvent) => emit(\"dismiss\", event),\n \"aria-label\": \"Dismiss\",\n },\n { default: () => h(X) },\n )\n : null,\n slots.default?.(),\n ])\n }\n },\n})\n\nexport type SidebarCardProps = InstanceType<typeof SidebarCardComponent>[\"$props\"] & HTMLAttributes\n\n/** Promotional card for CTAs, upgrades or announcements. */\nexport const SidebarCard = SidebarCardComponent as typeof SidebarCardComponent & {\n new (): { $props: SidebarCardProps }\n}\n\nexport type SidebarCardHeaderProps = HTMLAttributes\n\nexport const SidebarCardHeader = part<SidebarCardHeaderProps>(\"SidebarCardHeader\", \"div\", s.CardHeader)\n\nexport type SidebarCardTitleProps = HTMLAttributes\n\nexport const SidebarCardTitle = part<SidebarCardTitleProps>(\"SidebarCardTitle\", \"div\", s.CardTitle)\n\nexport type SidebarCardTitleLinkProps = AnchorHTMLAttributes\n\nexport const SidebarCardTitleLink = defineComponent({\n name: \"SidebarCardTitleLink\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"a\", { class: [s.CardTitleLink, className], ...rest }, [\n slots.default?.(),\n h(ChevronRightMd, { class: s.CardTitleChevron }),\n ])\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarCardTitleLinkProps>>\n\nexport type SidebarCardContentProps = HTMLAttributes\n\nexport const SidebarCardContent = part<SidebarCardContentProps>(\"SidebarCardContent\", \"div\", s.CardContent)\n\nexport type SidebarCardFooterProps = HTMLAttributes\n\nexport const SidebarCardFooter = part<SidebarCardFooterProps>(\"SidebarCardFooter\", \"div\", s.CardFooter)\n\n// =============================================\n// Inset (Main Content Area)\n// =============================================\n\nexport type SidebarInsetProps = HTMLAttributes\n\n/**\n * Main content area next to the sidebar, a `<main>`. Behind the open phone drawer it takes no focus or touch\n * (`inert`); an `inert` of your own wins.\n */\nexport const SidebarInset = defineComponent({\n name: \"SidebarInset\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const sidebar = useSidebar()\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\n \"main\",\n { inert: sidebar.isMobile && sidebar.openMobile ? \"\" : undefined, ...rest, class: [s.Inset, className] },\n slots.default?.(),\n )\n }\n },\n}) as unknown as Part<SidebarInsetProps>\n\n// =============================================\n// Layout Container\n// =============================================\n\nexport type SidebarLayoutProps = HTMLAttributes\n\n/** Wrapper for the sidebar and the main content. */\nexport const SidebarLayout = part<SidebarLayoutProps>(\"SidebarLayout\", \"div\", s.SidebarLayout)\n\n// =============================================\n// Trigger (Collapse Button)\n// =============================================\n\nexport type SidebarTriggerProps = ButtonHTMLAttributes\n\n/**\n * Collapse button. The default slot replaces the icon. Renders nothing when\n * `collapsible=\"none\"`.\n */\nexport const SidebarTrigger = defineComponent({\n name: \"SidebarTrigger\",\n inheritAttrs: false,\n setup(_props, { attrs, slots }) {\n const sidebar = useSidebar()\n\n return () => {\n // Don't render if collapsible=\"none\" (text-only sidebars)\n if (sidebar.collapsible === \"none\") {\n return null\n }\n\n const { className, rest } = cleanAttrs(attrs)\n const { onClick, ...others } = rest\n return h(\n \"button\",\n {\n \"type\": \"button\",\n \"class\": [s.Trigger, className],\n // The caller's listener runs first and can cancel the toggle\n \"onClick\": composeEventHandlers(onClick, () => sidebar.toggleSidebar()),\n \"aria-label\": sidebar.isMobile\n ? \"Open menu\"\n : sidebar.state === \"expanded\"\n ? \"Collapse sidebar\"\n : \"Expand sidebar\",\n ...others,\n },\n [\n h(\"span\", { class: s.TriggerInner }, [\n // One icon for both states: the tooltip, not the icon, says what a press does\n h(\"span\", { class: s.TriggerIcon }, slots.default ? slots.default() : [h(SidebarIcon)]),\n ]),\n ],\n )\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarTriggerProps>>\n\n// =============================================\n// Mobile Menu Button (SidebarMenuMobile icon → X)\n// =============================================\n\nexport type SidebarMobileMenuButtonProps = ButtonHTMLAttributes\n\nexport const SidebarMobileMenuButton = defineComponent({\n name: \"SidebarMobileMenuButton\",\n inheritAttrs: false,\n setup(_props, { attrs }) {\n const sidebar = useSidebar()\n\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n const { onClick, ...others } = rest\n return h(\n \"button\",\n {\n \"type\": \"button\",\n \"data-expanded\": sidebar.openMobile ? \"\" : undefined,\n \"class\": [s.MobileMenuButton, className],\n // The caller's listener runs first and can cancel the toggle\n \"onClick\": composeEventHandlers(onClick, () => sidebar.setOpenMobile(!sidebar.openMobile)),\n \"aria-label\": sidebar.openMobile ? \"Close menu\" : \"Open menu\",\n ...others,\n },\n [\n h(\"span\", { class: s.MobileMenuIcon }, [\n h(SidebarMenuMobile, { \"class\": s.MobileMenuGlyph, \"data-glyph\": \"menu\" }),\n h(X, { \"class\": s.MobileMenuGlyph, \"data-glyph\": \"close\" }),\n ]),\n ],\n )\n }\n },\n}) as unknown as ReturnType<typeof part<SidebarMobileMenuButtonProps>>\n\n// =============================================\n// Mobile Sidebar\n// =============================================\n\n/**\n * The phone drawer: a modal dialog while it is open. Focus moves into it and Tab goes round its controls, the page\n * behind is inert (SidebarInset), Escape inside it closes it after any layer over it has taken its own, and focus\n * goes back to the control that opened it. A swipe in from the edge it slides from opens it and a swipe back closes\n * it (lib/phoneDrawer).\n */\nconst SidebarMobileComponent = defineComponent({\n name: \"SidebarMobile\",\n inheritAttrs: false,\n props: {\n /** When true, drawer is positioned absolute instead of fixed (for contained demos) */\n contained: { type: Boolean, default: undefined },\n /** Rows that lead to another page end with a disclosure chevron, as in an iOS list. `false` leaves it out. @default true */\n disclosure: { type: Boolean, default: true },\n },\n setup(props, { attrs, slots }) {\n const sidebar = useSidebar()\n provide(sidebarDrawerKey, computed(() => props.disclosure))\n const drawer = ref<HTMLElement>()\n const setDrawer = (el: unknown) => {\n drawer.value = el instanceof HTMLElement ? el : ((el as { $el?: unknown } | null)?.$el as HTMLElement | undefined)\n }\n\n let detachSwipe: (() => void) | undefined\n onMounted(() => {\n // Focus moves in on open and back to what opened the drawer on close (from mount, as React's effect). A drawer\n // that is not contained shows only at phone width, so going back to it from a wide window moves focus in again.\n watch(\n () => sidebar.openMobile && (sidebar.isMobile || Boolean(props.contained)),\n (open, _, onCleanup) => {\n const el = drawer.value\n if (!open || !el) return\n const trigger = document.activeElement\n if (!el.contains(document.activeElement)) drawerInitialFocus(el).focus({ preventScroll: true })\n onCleanup(() => {\n const active = document.activeElement\n const lost = !active || active === document.body || el.contains(active)\n if (lost && trigger instanceof HTMLElement && trigger.isConnected && !el.contains(trigger)) {\n trigger.focus({ preventScroll: true })\n }\n })\n },\n { flush: \"post\", immediate: true },\n )\n\n const el = drawer.value\n const root = el?.closest<HTMLElement>(\"[data-mobile-menu]\")\n if (!el || !root) return\n detachSwipe = attachDrawerSwipe({\n root,\n drawer: el,\n isOpen: () => sidebar.openMobile,\n setOpen: (open) => sidebar.setOpenMobile(open),\n enabled: () => sidebar.isMobile,\n })\n })\n onBeforeUnmount(() => detachSwipe?.())\n\n const onDrawerKeydown = (event: KeyboardEvent) => {\n const el = drawer.value\n if (!sidebar.openMobile || !el) return\n loopDrawerFocus(event, el)\n closeOnUnhandledEscape(event, el, () => sidebar.setOpenMobile(false))\n }\n\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n const { onKeydown: userKeydown, ...drawerAttrs } = rest\n const contained = props.contained && s.contained\n const open = sidebar.openMobile\n return [\n // Backdrop\n h(\"div\", {\n \"class\": [s.MobileBackdrop, contained],\n \"onClick\": () => sidebar.setOpenMobile(false),\n \"aria-hidden\": \"true\",\n }),\n // Drawer\n h(\n \"div\",\n {\n \"ref\": setDrawer,\n \"role\": \"dialog\",\n \"aria-modal\": open ? \"true\" : undefined,\n \"aria-label\": \"Menu\",\n \"tabindex\": -1,\n \"inert\": open ? undefined : \"\",\n ...drawerAttrs,\n \"class\": [s.MobileSidebar, contained, className],\n // Your handler runs first and can keep the drawer open with preventDefault(), as onKeyDown in React\n \"onKeydown\": (event: KeyboardEvent) => {\n for (const handler of [userKeydown].flat()) if (typeof handler === \"function\") handler(event)\n onDrawerKeydown(event)\n },\n },\n slots.default?.(),\n ),\n ]\n }\n },\n})\n\nexport type SidebarMobileProps = InstanceType<typeof SidebarMobileComponent>[\"$props\"] & HTMLAttributes\n\nexport const SidebarMobile = SidebarMobileComponent as typeof SidebarMobileComponent & {\n new (): { $props: SidebarMobileProps }\n}\n\nexport type SidebarMobileHeaderProps = HTMLAttributes\n\nexport const SidebarMobileHeader = part<SidebarMobileHeaderProps>(\"SidebarMobileHeader\", \"div\", s.MobileHeader)\n\nexport type SidebarMobileFooterProps = HTMLAttributes\n\nexport const SidebarMobileFooter = part<SidebarMobileFooterProps>(\"SidebarMobileFooter\", \"div\", s.MobileFooter)\n\n// =============================================\n// Input (Search)\n// =============================================\n\nexport type SidebarInputProps = InputProps\n\n/**\n * Search input: an Input with a Search icon in its `startAdornment` slot.\n * Every attribute, listener and slot goes to the Input (`v-model:value`,\n * `@clear`, ...). A template ref gets the Input's `focus()` and `input`\n * (React forwards its ref to the <input>).\n */\nexport const SidebarInput = defineComponent({\n name: \"SidebarInput\",\n inheritAttrs: false,\n setup(_props, { attrs, slots, expose }) {\n // Input's exposed API\n const inputComponent = ref<{ input: HTMLInputElement | null; focus: () => void } | null>(null)\n\n expose({\n focus: () => inputComponent.value?.focus(),\n input: computed(() => inputComponent.value?.input ?? null),\n })\n\n return () => {\n const { className, rest } = cleanAttrs(attrs)\n return h(\"div\", { class: s.Input }, [\n h(\n Input,\n { class: className, ...rest, ref: inputComponent },\n { ...slots, startAdornment: slots.startAdornment ?? (() => h(SearchIcon)) },\n ),\n ])\n }\n },\n}) as unknown as typeof Input\n\n// =============================================\n// Footer Links\n// =============================================\n\nexport type SidebarFooterLinksProps = HTMLAttributes\n\nexport const SidebarFooterLinks = part<SidebarFooterLinksProps>(\"SidebarFooterLinks\", \"div\", s.FooterLinks)\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed, defineComponent, h, inject, onBeforeUnmount, onMounted, provide, reactive, ref,
|
|
1
|
+
import { computed, defineComponent, h, inject, onBeforeUnmount, onMounted, provide, reactive, ref, } from "vue";
|
|
2
2
|
import s from "@plexui/styles/components/Sidebar/Sidebar.module.css";
|
|
3
3
|
// Vue port of packages/ui/src/components/Sidebar/useSidebarContext.tsx.
|
|
4
4
|
// - `useSidebar()` returns the context as a reactive object (read
|
|
@@ -8,8 +8,11 @@ import s from "@plexui/styles/components/Sidebar/Sidebar.module.css";
|
|
|
8
8
|
// content slot exposes its controller.
|
|
9
9
|
// - `open` + `update:open` support `v-model:open`. As in React, the provider
|
|
10
10
|
// is controlled only when `open` is passed; `update:open` is emitted either way.
|
|
11
|
-
//
|
|
12
|
-
//
|
|
11
|
+
// `openMobile` + `update:openMobile` (`v-model:open-mobile`) do the same for
|
|
12
|
+
// the phone drawer.
|
|
13
|
+
// - Mobile detection and the Cmd/Ctrl+B shortcut start on mount, as React's
|
|
14
|
+
// effects do (SSR-safe). Escape closes the drawer from inside it
|
|
15
|
+
// (SidebarMobile), so a layer over it takes its own Escape first.
|
|
13
16
|
// Constants
|
|
14
17
|
const SIDEBAR_COOKIE_NAME = "sidebar:state";
|
|
15
18
|
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7; // 7 days
|
|
@@ -56,6 +59,10 @@ const SidebarProviderComponent = defineComponent({
|
|
|
56
59
|
defaultOpen: { type: Boolean, default: true },
|
|
57
60
|
/** Controlled open state (`v-model:open`) */
|
|
58
61
|
open: { type: Boolean, default: undefined },
|
|
62
|
+
/** Controlled open state of the phone drawer, SidebarMobile (`v-model:open-mobile`) */
|
|
63
|
+
openMobile: { type: Boolean, default: undefined },
|
|
64
|
+
/** Initial open state of the phone drawer (uncontrolled). @default false */
|
|
65
|
+
defaultOpenMobile: { type: Boolean, default: false },
|
|
59
66
|
/** Collapsible mode. @default "offcanvas" */
|
|
60
67
|
collapsible: { type: String, default: "offcanvas" },
|
|
61
68
|
/** "app" is the shell of a product: a quiet rail, pill rows and on a phone a drawer under the page. @default "sidebar" */
|
|
@@ -64,11 +71,15 @@ const SidebarProviderComponent = defineComponent({
|
|
|
64
71
|
emits: {
|
|
65
72
|
/** The open state changes (`v-model:open`) */
|
|
66
73
|
"update:open": (_open) => true,
|
|
74
|
+
/** The phone drawer opens or closes: its menu button, its backdrop, Escape or a swipe (`v-model:open-mobile`) */
|
|
75
|
+
"update:openMobile": (_open) => true,
|
|
67
76
|
},
|
|
68
77
|
slots: Object,
|
|
69
78
|
setup(props, { attrs, slots, emit }) {
|
|
70
79
|
const isMobile = useIsMobile();
|
|
71
|
-
|
|
80
|
+
// Controlled vs uncontrolled state for the phone drawer
|
|
81
|
+
const internalOpenMobile = ref(props.defaultOpenMobile);
|
|
82
|
+
const openMobile = computed(() => props.openMobile ?? internalOpenMobile.value);
|
|
72
83
|
// Controlled vs uncontrolled state for desktop
|
|
73
84
|
const internalOpen = ref(props.defaultOpen);
|
|
74
85
|
const open = computed(() => props.open ?? internalOpen.value);
|
|
@@ -85,7 +96,12 @@ const SidebarProviderComponent = defineComponent({
|
|
|
85
96
|
}
|
|
86
97
|
};
|
|
87
98
|
const setOpenMobile = (value) => {
|
|
88
|
-
|
|
99
|
+
const next = typeof value === "function" ? value(openMobile.value) : value;
|
|
100
|
+
if (next === openMobile.value)
|
|
101
|
+
return;
|
|
102
|
+
if (props.openMobile === undefined)
|
|
103
|
+
internalOpenMobile.value = next;
|
|
104
|
+
emit("update:openMobile", next);
|
|
89
105
|
};
|
|
90
106
|
// Toggle function that handles both mobile and desktop
|
|
91
107
|
const toggleSidebar = () => {
|
|
@@ -116,19 +132,6 @@ const SidebarProviderComponent = defineComponent({
|
|
|
116
132
|
};
|
|
117
133
|
onMounted(() => window.addEventListener("keydown", handleShortcut));
|
|
118
134
|
onBeforeUnmount(() => window.removeEventListener("keydown", handleShortcut));
|
|
119
|
-
// Close mobile menu on escape key
|
|
120
|
-
const handleEscape = (event) => {
|
|
121
|
-
if (event.key === "Escape") {
|
|
122
|
-
setOpenMobile(false);
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
watch(openMobile, (isOpen, _, onCleanup) => {
|
|
126
|
-
if (!isOpen)
|
|
127
|
-
return;
|
|
128
|
-
window.addEventListener("keydown", handleEscape);
|
|
129
|
-
onCleanup(() => window.removeEventListener("keydown", handleEscape));
|
|
130
|
-
}, { flush: "post" });
|
|
131
|
-
onBeforeUnmount(() => window.removeEventListener("keydown", handleEscape));
|
|
132
135
|
// Derive state from open boolean
|
|
133
136
|
const state = computed(() => (open.value ? "expanded" : "collapsed"));
|
|
134
137
|
const context = reactive({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSidebarContext.js","sourceRoot":"","sources":["../../../../src/components/Sidebar/useSidebarContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,CAAC,EACD,MAAM,EACN,eAAe,EACf,SAAS,EACT,OAAO,EACP,QAAQ,EACR,GAAG,EACH,KAAK,GAKN,MAAM,KAAK,CAAA;AACZ,OAAO,CAAC,MAAM,sDAAsD,CAAA;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,CAAC,MAAM,iBAAiB,GAAG;IAC/B,KAAK,EAAE,aAAa;IACpB,SAAS,EAAE,iBAAiB;IAC5B,YAAY,EAAE,oBAAoB;IAClC,UAAU,EAAE,kBAAkB;IAC9B,iBAAiB,EAAE,yBAAyB;IAC5C,iBAAiB;IACjB,WAAW,EAAE,mBAAmB;IAChC,cAAc,EAAE,sBAAsB;CAC9B,CAAA","sourcesContent":["import {\n computed,\n defineComponent,\n h,\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n reactive,\n ref,\n watch,\n type InjectionKey,\n type PropType,\n type SlotsType,\n type StyleValue,\n} from \"vue\"\nimport s from \"@plexui/styles/components/Sidebar/Sidebar.module.css\"\n\n// Vue port of packages/ui/src/components/Sidebar/useSidebarContext.tsx.\n// - `useSidebar()` returns the context as a reactive object (read\n// `sidebar.state`; destructuring outside a render loses reactivity).\n// Templates get the same object as the default slot props of\n// SidebarProvider (`v-slot=\"{ state, toggleSidebar }\"`), the way Popover's\n// content slot exposes its controller.\n// - `open` + `update:open` support `v-model:open`. As in React, the provider\n// is controlled only when `open` is passed; `update:open` is emitted either way.\n// - Mobile detection, the Cmd/Ctrl+B shortcut and the Escape listener start\n// on mount, as React's effects do (SSR-safe).\n\n// Constants\nconst SIDEBAR_COOKIE_NAME = \"sidebar:state\"\nconst SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7 // 7 days\nconst SIDEBAR_WIDTH = \"240px\"\nconst SIDEBAR_WIDTH_APP = \"260px\"\nconst SIDEBAR_WIDTH_MOBILE = \"288px\"\nconst SIDEBAR_WIDTH_ICON = \"64px\"\nconst SIDEBAR_KEYBOARD_SHORTCUT = \"b\"\nconst MOBILE_BREAKPOINT = 768\n\n// Types\nexport type SidebarState = \"expanded\" | \"collapsed\"\nexport type SidebarCollapsible = \"offcanvas\" | \"icon\" | \"none\"\nexport type SidebarSide = \"left\" | \"right\"\nexport type SidebarVariant = \"sidebar\" | \"docs\"\nexport type SidebarProviderVariant = \"sidebar\" | \"app\"\n\ntype SetBoolean = (value: boolean | ((prev: boolean) => boolean)) => void\n\nexport type SidebarContextValue = {\n state: SidebarState\n open: boolean\n setOpen: (open: boolean) => void\n openMobile: boolean\n setOpenMobile: (open: boolean) => void\n isMobile: boolean\n collapsible: SidebarCollapsible\n toggleSidebar: () => void\n}\n\n// Context\nconst SidebarContextKey: InjectionKey<SidebarContextValue> = Symbol(\"PlexUISidebar\")\n\n/** Sidebar state and controls; call it in `setup()` of a component inside SidebarProvider. */\nexport const useSidebar = (): SidebarContextValue => {\n const context = inject(SidebarContextKey, null)\n\n if (!context) {\n throw new Error(\"useSidebar must be used within a SidebarProvider\")\n }\n\n return context\n}\n\n// Composable for mobile detection via matchMedia\nfunction useIsMobile() {\n const isMobile = ref(false)\n let cleanup: (() => void) | undefined\n\n onMounted(() => {\n // Check if we're in browser environment\n if (typeof window === \"undefined\") return\n\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)\n\n const handleChange = () => {\n isMobile.value = mql.matches\n }\n handleChange() // Initial check\n\n mql.addEventListener(\"change\", handleChange)\n cleanup = () => mql.removeEventListener(\"change\", handleChange)\n })\n onBeforeUnmount(() => cleanup?.())\n\n return isMobile\n}\n\n/** Native attributes of the provider's `<div>` that React accepts: `class` and `style`. */\nexport type SidebarProviderAttrs = { class?: unknown; style?: StyleValue }\n\nconst SidebarProviderComponent = defineComponent({\n name: \"SidebarProvider\",\n inheritAttrs: false,\n props: {\n /** Default open state (uncontrolled). @default true */\n defaultOpen: { type: Boolean, default: true },\n /** Controlled open state (`v-model:open`) */\n open: { type: Boolean, default: undefined },\n /** Collapsible mode. @default \"offcanvas\" */\n collapsible: { type: String as PropType<SidebarCollapsible>, default: \"offcanvas\" },\n /** \"app\" is the shell of a product: a quiet rail, pill rows and on a phone a drawer under the page. @default \"sidebar\" */\n variant: { type: String as PropType<SidebarProviderVariant>, default: \"sidebar\" },\n },\n emits: {\n /** The open state changes (`v-model:open`) */\n \"update:open\": (_open: boolean) => true,\n },\n slots: Object as SlotsType<{ default?: (context: SidebarContextValue) => unknown }>,\n setup(props, { attrs, slots, emit }) {\n const isMobile = useIsMobile()\n const openMobile = ref(false)\n\n // Controlled vs uncontrolled state for desktop\n const internalOpen = ref(props.defaultOpen)\n const open = computed(() => props.open ?? internalOpen.value)\n\n const setOpen: SetBoolean = (value) => {\n const openState = typeof value === \"function\" ? value(open.value) : value\n\n // Controlled only when `open` is passed; update:open alone is a notification\n if (props.open === undefined) {\n internalOpen.value = openState\n }\n emit(\"update:open\", openState)\n\n // Persist state in cookie for SSR\n if (typeof document !== \"undefined\") {\n document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`\n }\n }\n\n const setOpenMobile: SetBoolean = (value) => {\n openMobile.value = typeof value === \"function\" ? value(openMobile.value) : value\n }\n\n // Toggle function that handles both mobile and desktop\n const toggleSidebar = () => {\n if (isMobile.value) {\n setOpenMobile((prev) => !prev)\n } else {\n setOpen((prev) => !prev)\n }\n }\n\n // Keyboard shortcut: Cmd/Ctrl + B\n const handleShortcut = (event: KeyboardEvent) => {\n // Skip if collapsible is \"none\"\n if (props.collapsible === \"none\") return\n\n // Don't trigger when focus is in an editable element (input, textarea, contenteditable)\n const target = event.target as HTMLElement | null\n if (target?.closest?.(\"input, textarea\") || target?.isContentEditable) return\n\n // Check for Cmd (Mac) or Ctrl (Windows/Linux) + B\n if (\n event.key === SIDEBAR_KEYBOARD_SHORTCUT &&\n (event.metaKey || event.ctrlKey) &&\n !event.altKey &&\n !event.shiftKey\n ) {\n event.preventDefault()\n toggleSidebar()\n }\n }\n onMounted(() => window.addEventListener(\"keydown\", handleShortcut))\n onBeforeUnmount(() => window.removeEventListener(\"keydown\", handleShortcut))\n\n // Close mobile menu on escape key\n const handleEscape = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n setOpenMobile(false)\n }\n }\n watch(\n openMobile,\n (isOpen, _, onCleanup) => {\n if (!isOpen) return\n window.addEventListener(\"keydown\", handleEscape)\n onCleanup(() => window.removeEventListener(\"keydown\", handleEscape))\n },\n { flush: \"post\" },\n )\n onBeforeUnmount(() => window.removeEventListener(\"keydown\", handleEscape))\n\n // Derive state from open boolean\n const state = computed<SidebarState>(() => (open.value ? \"expanded\" : \"collapsed\"))\n\n const context = reactive({\n state,\n open,\n setOpen: setOpen as (open: boolean) => void,\n openMobile,\n setOpenMobile: setOpenMobile as (open: boolean) => void,\n isMobile,\n collapsible: computed(() => props.collapsible),\n toggleSidebar,\n }) as SidebarContextValue\n\n provide(SidebarContextKey, context)\n\n return () =>\n h(\n \"div\",\n {\n \"class\": [props.variant === \"app\" && s.App, attrs.class],\n \"style\": [\n {\n \"--sidebar-width\": props.variant === \"app\" ? SIDEBAR_WIDTH_APP : SIDEBAR_WIDTH,\n \"--sidebar-width-mobile\": SIDEBAR_WIDTH_MOBILE,\n \"--sidebar-width-icon\": SIDEBAR_WIDTH_ICON,\n },\n attrs.style as StyleValue,\n ],\n \"data-sidebar\": state.value,\n \"data-mobile-menu\": openMobile.value ? \"visible\" : \"hidden\",\n \"data-collapsible\": props.collapsible,\n },\n slots.default?.(context) as never,\n )\n },\n})\n\ntype SidebarProviderOwnProps = InstanceType<typeof SidebarProviderComponent>[\"$props\"]\n\nexport type SidebarProviderProps = SidebarProviderOwnProps & SidebarProviderAttrs\n\n/**\n * Handles the sidebar state and provides it to every part. Like React, it\n * renders a `<div>` that takes only `class` and `style`. The default slot\n * receives the context (`v-slot=\"{ state, toggleSidebar }\"`).\n */\nexport const SidebarProvider = SidebarProviderComponent as typeof SidebarProviderComponent & {\n new (): { $props: SidebarProviderProps }\n}\n\n// Re-export constants for external use\nexport const SIDEBAR_CONSTANTS = {\n WIDTH: SIDEBAR_WIDTH,\n WIDTH_APP: SIDEBAR_WIDTH_APP,\n WIDTH_MOBILE: SIDEBAR_WIDTH_MOBILE,\n WIDTH_ICON: SIDEBAR_WIDTH_ICON,\n KEYBOARD_SHORTCUT: SIDEBAR_KEYBOARD_SHORTCUT,\n MOBILE_BREAKPOINT,\n COOKIE_NAME: SIDEBAR_COOKIE_NAME,\n COOKIE_MAX_AGE: SIDEBAR_COOKIE_MAX_AGE,\n} as const\n"]}
|
|
1
|
+
{"version":3,"file":"useSidebarContext.js","sourceRoot":"","sources":["../../../../src/components/Sidebar/useSidebarContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,CAAC,EACD,MAAM,EACN,eAAe,EACf,SAAS,EACT,OAAO,EACP,QAAQ,EACR,GAAG,GAKJ,MAAM,KAAK,CAAA;AACZ,OAAO,CAAC,MAAM,sDAAsD,CAAA;AAEpE,wEAAwE;AACxE,kEAAkE;AAClE,uEAAuE;AACvE,+DAA+D;AAC/D,6EAA6E;AAC7E,yCAAyC;AACzC,6EAA6E;AAC7E,mFAAmF;AACnF,+EAA+E;AAC/E,sBAAsB;AACtB,4EAA4E;AAC5E,mEAAmE;AACnE,oEAAoE;AAEpE,YAAY;AACZ,MAAM,mBAAmB,GAAG,eAAe,CAAA;AAC3C,MAAM,sBAAsB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA,CAAC,SAAS;AACzD,MAAM,aAAa,GAAG,OAAO,CAAA;AAC7B,MAAM,iBAAiB,GAAG,OAAO,CAAA;AACjC,MAAM,oBAAoB,GAAG,OAAO,CAAA;AACpC,MAAM,kBAAkB,GAAG,MAAM,CAAA;AACjC,MAAM,yBAAyB,GAAG,GAAG,CAAA;AACrC,MAAM,iBAAiB,GAAG,GAAG,CAAA;AAsB7B,UAAU;AACV,MAAM,iBAAiB,GAAsC,MAAM,CAAC,eAAe,CAAC,CAAA;AAEpF,8FAA8F;AAC9F,MAAM,CAAC,MAAM,UAAU,GAAG,GAAwB,EAAE;IAClD,MAAM,OAAO,GAAG,MAAM,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAA;IAE/C,IAAI,CAAC,OAAO,EAAE,CAAC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,EAAE,oBAAoB;oBAC9C,sBAAsB,EAAE,kBAAkB;iBAC3C;gBACD,KAAK,CAAC,KAAmB;aAC1B;YACD,cAAc,EAAE,KAAK,CAAC,KAAK;YAC3B,kBAAkB,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;YAC3D,kBAAkB,EAAE,KAAK,CAAC,WAAW;SACtC,EACD,KAAK,CAAC,OAAO,EAAE,CAAC,OAAO,CAAU,CAClC,CAAA;IACL,CAAC;CACF,CAAC,CAAA;AAMF;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,wBAE9B,CAAA;AAED,uCAAuC;AACvC,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,KAAK,EAAE,aAAa;IACpB,SAAS,EAAE,iBAAiB;IAC5B,YAAY,EAAE,oBAAoB;IAClC,UAAU,EAAE,kBAAkB;IAC9B,iBAAiB,EAAE,yBAAyB;IAC5C,iBAAiB;IACjB,WAAW,EAAE,mBAAmB;IAChC,cAAc,EAAE,sBAAsB;CAC9B,CAAA","sourcesContent":["import {\n computed,\n defineComponent,\n h,\n inject,\n onBeforeUnmount,\n onMounted,\n provide,\n reactive,\n ref,\n type InjectionKey,\n type PropType,\n type SlotsType,\n type StyleValue,\n} from \"vue\"\nimport s from \"@plexui/styles/components/Sidebar/Sidebar.module.css\"\n\n// Vue port of packages/ui/src/components/Sidebar/useSidebarContext.tsx.\n// - `useSidebar()` returns the context as a reactive object (read\n// `sidebar.state`; destructuring outside a render loses reactivity).\n// Templates get the same object as the default slot props of\n// SidebarProvider (`v-slot=\"{ state, toggleSidebar }\"`), the way Popover's\n// content slot exposes its controller.\n// - `open` + `update:open` support `v-model:open`. As in React, the provider\n// is controlled only when `open` is passed; `update:open` is emitted either way.\n// `openMobile` + `update:openMobile` (`v-model:open-mobile`) do the same for\n// the phone drawer.\n// - Mobile detection and the Cmd/Ctrl+B shortcut start on mount, as React's\n// effects do (SSR-safe). Escape closes the drawer from inside it\n// (SidebarMobile), so a layer over it takes its own Escape first.\n\n// Constants\nconst SIDEBAR_COOKIE_NAME = \"sidebar:state\"\nconst SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7 // 7 days\nconst SIDEBAR_WIDTH = \"240px\"\nconst SIDEBAR_WIDTH_APP = \"260px\"\nconst SIDEBAR_WIDTH_MOBILE = \"288px\"\nconst SIDEBAR_WIDTH_ICON = \"64px\"\nconst SIDEBAR_KEYBOARD_SHORTCUT = \"b\"\nconst MOBILE_BREAKPOINT = 768\n\n// Types\nexport type SidebarState = \"expanded\" | \"collapsed\"\nexport type SidebarCollapsible = \"offcanvas\" | \"icon\" | \"none\"\nexport type SidebarSide = \"left\" | \"right\"\nexport type SidebarVariant = \"sidebar\" | \"docs\"\nexport type SidebarProviderVariant = \"sidebar\" | \"app\"\n\ntype SetBoolean = (value: boolean | ((prev: boolean) => boolean)) => void\n\nexport type SidebarContextValue = {\n state: SidebarState\n open: boolean\n setOpen: (open: boolean) => void\n openMobile: boolean\n setOpenMobile: (open: boolean) => void\n isMobile: boolean\n collapsible: SidebarCollapsible\n toggleSidebar: () => void\n}\n\n// Context\nconst SidebarContextKey: InjectionKey<SidebarContextValue> = Symbol(\"PlexUISidebar\")\n\n/** Sidebar state and controls; call it in `setup()` of a component inside SidebarProvider. */\nexport const useSidebar = (): SidebarContextValue => {\n const context = inject(SidebarContextKey, null)\n\n if (!context) {\n throw new Error(\"useSidebar must be used within a SidebarProvider\")\n }\n\n return context\n}\n\n// Composable for mobile detection via matchMedia\nfunction useIsMobile() {\n const isMobile = ref(false)\n let cleanup: (() => void) | undefined\n\n onMounted(() => {\n // Check if we're in browser environment\n if (typeof window === \"undefined\") return\n\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)\n\n const handleChange = () => {\n isMobile.value = mql.matches\n }\n handleChange() // Initial check\n\n mql.addEventListener(\"change\", handleChange)\n cleanup = () => mql.removeEventListener(\"change\", handleChange)\n })\n onBeforeUnmount(() => cleanup?.())\n\n return isMobile\n}\n\n/** Native attributes of the provider's `<div>` that React accepts: `class` and `style`. */\nexport type SidebarProviderAttrs = { class?: unknown; style?: StyleValue }\n\nconst SidebarProviderComponent = defineComponent({\n name: \"SidebarProvider\",\n inheritAttrs: false,\n props: {\n /** Default open state (uncontrolled). @default true */\n defaultOpen: { type: Boolean, default: true },\n /** Controlled open state (`v-model:open`) */\n open: { type: Boolean, default: undefined },\n /** Controlled open state of the phone drawer, SidebarMobile (`v-model:open-mobile`) */\n openMobile: { type: Boolean, default: undefined },\n /** Initial open state of the phone drawer (uncontrolled). @default false */\n defaultOpenMobile: { type: Boolean, default: false },\n /** Collapsible mode. @default \"offcanvas\" */\n collapsible: { type: String as PropType<SidebarCollapsible>, default: \"offcanvas\" },\n /** \"app\" is the shell of a product: a quiet rail, pill rows and on a phone a drawer under the page. @default \"sidebar\" */\n variant: { type: String as PropType<SidebarProviderVariant>, default: \"sidebar\" },\n },\n emits: {\n /** The open state changes (`v-model:open`) */\n \"update:open\": (_open: boolean) => true,\n /** The phone drawer opens or closes: its menu button, its backdrop, Escape or a swipe (`v-model:open-mobile`) */\n \"update:openMobile\": (_open: boolean) => true,\n },\n slots: Object as SlotsType<{ default?: (context: SidebarContextValue) => unknown }>,\n setup(props, { attrs, slots, emit }) {\n const isMobile = useIsMobile()\n // Controlled vs uncontrolled state for the phone drawer\n const internalOpenMobile = ref(props.defaultOpenMobile)\n const openMobile = computed(() => props.openMobile ?? internalOpenMobile.value)\n\n // Controlled vs uncontrolled state for desktop\n const internalOpen = ref(props.defaultOpen)\n const open = computed(() => props.open ?? internalOpen.value)\n\n const setOpen: SetBoolean = (value) => {\n const openState = typeof value === \"function\" ? value(open.value) : value\n\n // Controlled only when `open` is passed; update:open alone is a notification\n if (props.open === undefined) {\n internalOpen.value = openState\n }\n emit(\"update:open\", openState)\n\n // Persist state in cookie for SSR\n if (typeof document !== \"undefined\") {\n document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`\n }\n }\n\n const setOpenMobile: SetBoolean = (value) => {\n const next = typeof value === \"function\" ? value(openMobile.value) : value\n if (next === openMobile.value) return\n if (props.openMobile === undefined) internalOpenMobile.value = next\n emit(\"update:openMobile\", next)\n }\n\n // Toggle function that handles both mobile and desktop\n const toggleSidebar = () => {\n if (isMobile.value) {\n setOpenMobile((prev) => !prev)\n } else {\n setOpen((prev) => !prev)\n }\n }\n\n // Keyboard shortcut: Cmd/Ctrl + B\n const handleShortcut = (event: KeyboardEvent) => {\n // Skip if collapsible is \"none\"\n if (props.collapsible === \"none\") return\n\n // Don't trigger when focus is in an editable element (input, textarea, contenteditable)\n const target = event.target as HTMLElement | null\n if (target?.closest?.(\"input, textarea\") || target?.isContentEditable) return\n\n // Check for Cmd (Mac) or Ctrl (Windows/Linux) + B\n if (\n event.key === SIDEBAR_KEYBOARD_SHORTCUT &&\n (event.metaKey || event.ctrlKey) &&\n !event.altKey &&\n !event.shiftKey\n ) {\n event.preventDefault()\n toggleSidebar()\n }\n }\n onMounted(() => window.addEventListener(\"keydown\", handleShortcut))\n onBeforeUnmount(() => window.removeEventListener(\"keydown\", handleShortcut))\n\n // Derive state from open boolean\n const state = computed<SidebarState>(() => (open.value ? \"expanded\" : \"collapsed\"))\n\n const context = reactive({\n state,\n open,\n setOpen: setOpen as (open: boolean) => void,\n openMobile,\n setOpenMobile: setOpenMobile as (open: boolean) => void,\n isMobile,\n collapsible: computed(() => props.collapsible),\n toggleSidebar,\n }) as SidebarContextValue\n\n provide(SidebarContextKey, context)\n\n return () =>\n h(\n \"div\",\n {\n \"class\": [props.variant === \"app\" && s.App, attrs.class],\n \"style\": [\n {\n \"--sidebar-width\": props.variant === \"app\" ? SIDEBAR_WIDTH_APP : SIDEBAR_WIDTH,\n \"--sidebar-width-mobile\": SIDEBAR_WIDTH_MOBILE,\n \"--sidebar-width-icon\": SIDEBAR_WIDTH_ICON,\n },\n attrs.style as StyleValue,\n ],\n \"data-sidebar\": state.value,\n \"data-mobile-menu\": openMobile.value ? \"visible\" : \"hidden\",\n \"data-collapsible\": props.collapsible,\n },\n slots.default?.(context) as never,\n )\n },\n})\n\ntype SidebarProviderOwnProps = InstanceType<typeof SidebarProviderComponent>[\"$props\"]\n\nexport type SidebarProviderProps = SidebarProviderOwnProps & SidebarProviderAttrs\n\n/**\n * Handles the sidebar state and provides it to every part. Like React, it\n * renders a `<div>` that takes only `class` and `style`. The default slot\n * receives the context (`v-slot=\"{ state, toggleSidebar }\"`).\n */\nexport const SidebarProvider = SidebarProviderComponent as typeof SidebarProviderComponent & {\n new (): { $props: SidebarProviderProps }\n}\n\n// Re-export constants for external use\nexport const SIDEBAR_CONSTANTS = {\n WIDTH: SIDEBAR_WIDTH,\n WIDTH_APP: SIDEBAR_WIDTH_APP,\n WIDTH_MOBILE: SIDEBAR_WIDTH_MOBILE,\n WIDTH_ICON: SIDEBAR_WIDTH_ICON,\n KEYBOARD_SHORTCUT: SIDEBAR_KEYBOARD_SHORTCUT,\n MOBILE_BREAKPOINT,\n COOKIE_NAME: SIDEBAR_COOKIE_NAME,\n COOKIE_MAX_AGE: SIDEBAR_COOKIE_MAX_AGE,\n} as const\n"]}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The phone drawer of Sidebar, shared by React and Vue (one copy per package, kept identical by lib-sync).
|
|
3
|
+
*
|
|
4
|
+
* - It follows the finger: a swipe in from the edge it lives behind opens it, a swipe back toward that edge closes
|
|
5
|
+
* it, and either finishes on release by how far and how fast the finger went. The drawer says its edge in
|
|
6
|
+
* `--sidebar-drawer-edge` (`left` or `right`). While a finger drags it, the root carries `data-mobile-dragging`
|
|
7
|
+
* and `--sidebar-drawer-progress` (0 closed to 1 open), and the styles place the drawer by them.
|
|
8
|
+
* - While it is open, Tab goes round its controls (the page behind is inert), and Escape closes it once every other
|
|
9
|
+
* listener has had the key, so a menu or dialog over the drawer takes its own Escape first.
|
|
10
|
+
*/
|
|
11
|
+
/** How far in from its edge a swipe that opens the drawer may start */
|
|
12
|
+
export const DRAWER_EDGE_ZONE = 24;
|
|
13
|
+
/** How far a finger moves before the swipe is taken as horizontal or left to the page */
|
|
14
|
+
export const DRAWER_SWIPE_SLOP = 10;
|
|
15
|
+
/** A release faster than this, in px/ms, finishes the swipe in its direction whatever the distance */
|
|
16
|
+
export const DRAWER_SWIPE_VELOCITY = 0.3;
|
|
17
|
+
/** A finger held still this long, in ms, before it lifts lets go by distance alone */
|
|
18
|
+
export const DRAWER_SWIPE_HOLD = 100;
|
|
19
|
+
const edgeOf = (drawer) => getComputedStyle(drawer).getPropertyValue("--sidebar-drawer-edge").trim() === "left" ? "left" : "right";
|
|
20
|
+
/** The distance the drawer travels: its own width when it slides in beside the page, else its container's width */
|
|
21
|
+
const travelOf = (drawer, root, edge) => {
|
|
22
|
+
if (edge === "left")
|
|
23
|
+
return drawer.getBoundingClientRect().width || root.getBoundingClientRect().width;
|
|
24
|
+
const container = drawer.offsetParent instanceof HTMLElement ? drawer.offsetParent : null;
|
|
25
|
+
return container?.clientWidth || window.innerWidth;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* A finger on a slider, on an element that takes horizontal touches itself (`touch-action` without `pan-x`, such
|
|
29
|
+
* as the Slider) or in a row that scrolls sideways moves that, not the drawer
|
|
30
|
+
*/
|
|
31
|
+
const ownsHorizontalSwipe = (target, root) => {
|
|
32
|
+
for (let node = target instanceof Element ? target : null; node && node !== root; node = node.parentElement) {
|
|
33
|
+
if ((node instanceof HTMLInputElement && node.type === "range") || node.getAttribute("role") === "slider")
|
|
34
|
+
return true;
|
|
35
|
+
const style = getComputedStyle(node);
|
|
36
|
+
if (/^(none|pan-y|pinch-zoom)/.test(style.touchAction) && !style.touchAction.includes("pan-x"))
|
|
37
|
+
return true;
|
|
38
|
+
if (node.scrollWidth > node.clientWidth && /auto|scroll/.test(style.overflowX))
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* A popover or menu open over the drawer (the Radix and Reka popper wrappers) keeps the touch: swiping the drawer
|
|
45
|
+
* away from under it would leave it open on an inert trigger. A modal dialog's overlay already covers the drawer.
|
|
46
|
+
*/
|
|
47
|
+
const layerOpen = (root) => root.ownerDocument.querySelector("[data-radix-popper-content-wrapper], [data-reka-popper-content-wrapper]") !== null;
|
|
48
|
+
/** Starts the gesture on `root`; returns the cleanup */
|
|
49
|
+
export function attachDrawerSwipe({ root, drawer, isOpen, setOpen, enabled = () => true }) {
|
|
50
|
+
let drag = null;
|
|
51
|
+
const setProgress = (progress) => {
|
|
52
|
+
root.style.setProperty("--sidebar-drawer-progress", String(progress));
|
|
53
|
+
};
|
|
54
|
+
const end = (commit, time = 0) => {
|
|
55
|
+
const current = drag;
|
|
56
|
+
drag = null;
|
|
57
|
+
if (!current || current.state !== "dragging")
|
|
58
|
+
return;
|
|
59
|
+
let next = current.open;
|
|
60
|
+
if (commit) {
|
|
61
|
+
// Velocity in the opening direction is positive; a finger that stopped before lifting has none
|
|
62
|
+
const velocity = time - current.lastTime > DRAWER_SWIPE_HOLD ? 0 : current.velocity;
|
|
63
|
+
const opening = current.edge === "left" ? velocity : -velocity;
|
|
64
|
+
next = opening > DRAWER_SWIPE_VELOCITY ? true : opening < -DRAWER_SWIPE_VELOCITY ? false : current.progress > 0.5;
|
|
65
|
+
}
|
|
66
|
+
if (next !== current.open)
|
|
67
|
+
setOpen(next);
|
|
68
|
+
// The drawer leaves the finger once the new state is on the page, so it animates from where it was let go
|
|
69
|
+
requestAnimationFrame(() => {
|
|
70
|
+
root.removeAttribute("data-mobile-dragging");
|
|
71
|
+
root.style.removeProperty("--sidebar-drawer-progress");
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
const onTouchStart = (event) => {
|
|
75
|
+
// A second finger cancels a swipe under way, and the drawer goes back to where it was
|
|
76
|
+
end(false);
|
|
77
|
+
if (event.touches.length !== 1 || !enabled() || layerOpen(root) || ownsHorizontalSwipe(event.target, root))
|
|
78
|
+
return;
|
|
79
|
+
const touch = event.touches[0];
|
|
80
|
+
const open = isOpen();
|
|
81
|
+
const edge = edgeOf(drawer);
|
|
82
|
+
if (!open) {
|
|
83
|
+
const bounds = root.getBoundingClientRect();
|
|
84
|
+
const fromEdge = edge === "left" ? touch.clientX - bounds.left : bounds.right - touch.clientX;
|
|
85
|
+
if (fromEdge < 0 || fromEdge > DRAWER_EDGE_ZONE)
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
drag = {
|
|
89
|
+
x: touch.clientX,
|
|
90
|
+
y: touch.clientY,
|
|
91
|
+
lastX: touch.clientX,
|
|
92
|
+
lastTime: event.timeStamp,
|
|
93
|
+
velocity: 0,
|
|
94
|
+
open,
|
|
95
|
+
edge,
|
|
96
|
+
travel: Math.max(1, travelOf(drawer, root, edge)),
|
|
97
|
+
state: "pending",
|
|
98
|
+
progress: open ? 1 : 0,
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
const onTouchMove = (event) => {
|
|
102
|
+
if (!drag || drag.state === "ignored")
|
|
103
|
+
return;
|
|
104
|
+
// A second finger put down outside the root shows only here
|
|
105
|
+
if (event.touches.length !== 1) {
|
|
106
|
+
end(false);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const touch = event.touches[0];
|
|
110
|
+
if (!touch)
|
|
111
|
+
return;
|
|
112
|
+
const dx = touch.clientX - drag.x;
|
|
113
|
+
const dy = touch.clientY - drag.y;
|
|
114
|
+
// Toward the open drawer is positive
|
|
115
|
+
const toward = drag.edge === "left" ? dx : -dx;
|
|
116
|
+
if (drag.state === "pending") {
|
|
117
|
+
if (Math.abs(dx) < DRAWER_SWIPE_SLOP && Math.abs(dy) < DRAWER_SWIPE_SLOP)
|
|
118
|
+
return;
|
|
119
|
+
const horizontal = Math.abs(dx) > Math.abs(dy);
|
|
120
|
+
if (!horizontal || (drag.open ? toward >= 0 : toward <= 0)) {
|
|
121
|
+
drag.state = "ignored";
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
drag.state = "dragging";
|
|
125
|
+
root.setAttribute("data-mobile-dragging", "");
|
|
126
|
+
}
|
|
127
|
+
if (event.cancelable)
|
|
128
|
+
event.preventDefault();
|
|
129
|
+
const elapsed = event.timeStamp - drag.lastTime;
|
|
130
|
+
if (elapsed > 0)
|
|
131
|
+
drag.velocity = (touch.clientX - drag.lastX) / elapsed;
|
|
132
|
+
drag.lastX = touch.clientX;
|
|
133
|
+
drag.lastTime = event.timeStamp;
|
|
134
|
+
drag.progress = Math.min(1, Math.max(0, (drag.open ? 1 : 0) + toward / drag.travel));
|
|
135
|
+
setProgress(drag.progress);
|
|
136
|
+
};
|
|
137
|
+
// A finger lifted while another stays on the screen cancels the swipe
|
|
138
|
+
const onTouchEnd = (event) => end(event.touches.length === 0, event.timeStamp);
|
|
139
|
+
const onTouchCancel = () => end(false);
|
|
140
|
+
root.addEventListener("touchstart", onTouchStart, { passive: true });
|
|
141
|
+
root.addEventListener("touchmove", onTouchMove, { passive: false });
|
|
142
|
+
root.addEventListener("touchend", onTouchEnd);
|
|
143
|
+
root.addEventListener("touchcancel", onTouchCancel);
|
|
144
|
+
return () => {
|
|
145
|
+
root.removeEventListener("touchstart", onTouchStart);
|
|
146
|
+
root.removeEventListener("touchmove", onTouchMove);
|
|
147
|
+
root.removeEventListener("touchend", onTouchEnd);
|
|
148
|
+
root.removeEventListener("touchcancel", onTouchCancel);
|
|
149
|
+
root.removeAttribute("data-mobile-dragging");
|
|
150
|
+
root.style.removeProperty("--sidebar-drawer-progress");
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
const TABBABLE = 'a[href], area[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), iframe, [contenteditable]:not([contenteditable="false"]), [tabindex]';
|
|
154
|
+
/** The controls Tab reaches in the drawer, in order: not disabled (a disabled fieldset too), not in a closed submenu, not hidden */
|
|
155
|
+
export const drawerTabbables = (drawer) => Array.from(drawer.querySelectorAll(TABBABLE)).filter((element) => element.tabIndex >= 0 &&
|
|
156
|
+
!element.matches(":disabled") &&
|
|
157
|
+
!element.closest("[inert], [hidden]") &&
|
|
158
|
+
(typeof element.checkVisibility !== "function" || element.checkVisibility({ visibilityProperty: true })));
|
|
159
|
+
/** The first control of the open drawer, or the drawer itself */
|
|
160
|
+
export const drawerInitialFocus = (drawer) => drawerTabbables(drawer)[0] ?? drawer;
|
|
161
|
+
/**
|
|
162
|
+
* Tab from the last control goes to the first and Shift+Tab from the first to the last, so focus stays in the open
|
|
163
|
+
* drawer. A layer over it in a portal (a menu, a dialog) keeps its own Tab.
|
|
164
|
+
*/
|
|
165
|
+
export function loopDrawerFocus(event, drawer) {
|
|
166
|
+
if (event.key !== "Tab" || event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey)
|
|
167
|
+
return;
|
|
168
|
+
if (!(event.target instanceof Node) || !drawer.contains(event.target))
|
|
169
|
+
return;
|
|
170
|
+
const items = drawerTabbables(drawer);
|
|
171
|
+
const active = drawer.ownerDocument.activeElement;
|
|
172
|
+
const first = items[0];
|
|
173
|
+
const last = items[items.length - 1];
|
|
174
|
+
if (!first || !last) {
|
|
175
|
+
event.preventDefault();
|
|
176
|
+
drawer.focus({ preventScroll: true });
|
|
177
|
+
}
|
|
178
|
+
else if (event.shiftKey && (active === first || active === drawer)) {
|
|
179
|
+
event.preventDefault();
|
|
180
|
+
last.focus({ preventScroll: true });
|
|
181
|
+
}
|
|
182
|
+
else if (!event.shiftKey && active === last) {
|
|
183
|
+
event.preventDefault();
|
|
184
|
+
first.focus({ preventScroll: true });
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Escape pressed in the open drawer closes it when the key reaches the window unprevented: a menu, popover or dialog
|
|
189
|
+
* over the drawer has its listener on the way there and takes the key first, however it listens.
|
|
190
|
+
*/
|
|
191
|
+
export function closeOnUnhandledEscape(event, drawer, close) {
|
|
192
|
+
if (event.key !== "Escape" || event.defaultPrevented)
|
|
193
|
+
return;
|
|
194
|
+
const view = drawer.ownerDocument.defaultView;
|
|
195
|
+
if (!view)
|
|
196
|
+
return;
|
|
197
|
+
const afterOthers = (late) => {
|
|
198
|
+
view.removeEventListener("keydown", afterOthers);
|
|
199
|
+
// A listener that stopped the key on its way leaves this one to the next key, which only removes it
|
|
200
|
+
if (late !== event || event.defaultPrevented)
|
|
201
|
+
return;
|
|
202
|
+
event.preventDefault();
|
|
203
|
+
close();
|
|
204
|
+
};
|
|
205
|
+
view.addEventListener("keydown", afterOthers);
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=phoneDrawer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phoneDrawer.js","sourceRoot":"","sources":["../../../src/lib/phoneDrawer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,uEAAuE;AACvE,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAA;AAClC,yFAAyF;AACzF,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAA;AACnC,sGAAsG;AACtG,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAA;AACxC,sFAAsF;AACtF,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAA;AA0BpC,MAAM,MAAM,GAAG,CAAC,MAAmB,EAAoB,EAAE,CACvD,gBAAgB,CAAC,MAAM,CAAC,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,CAAC,IAAI,EAAE,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAA;AAEzG,mHAAmH;AACnH,MAAM,QAAQ,GAAG,CAAC,MAAmB,EAAE,IAAiB,EAAE,IAAsB,EAAE,EAAE;IAClF,IAAI,IAAI,KAAK,MAAM;QAAE,OAAO,MAAM,CAAC,qBAAqB,EAAE,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H,MAAM,UAAU,sBAAsB,CAAC,KAAoB,EAAE,MAAmB,EAAE,KAAiB;IACjG,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,gBAAgB;QAAE,OAAM;IAC5D,MAAM,IAAI,GAAG,MAAM,CAAC,aAAa,CAAC,WAAW,CAAA;IAC7C,IAAI,CAAC,IAAI;QAAE,OAAM;IACjB,MAAM,WAAW,GAAG,CAAC,IAAW,EAAE,EAAE;QAClC,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;QAChD,oGAAoG;QACpG,IAAI,IAAI,KAAK,KAAK,IAAI,KAAK,CAAC,gBAAgB;YAAE,OAAM;QACpD,KAAK,CAAC,cAAc,EAAE,CAAA;QACtB,KAAK,EAAE,CAAA;IACT,CAAC,CAAA;IACD,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;AAC/C,CAAC","sourcesContent":["/**\n * The phone drawer of Sidebar, shared by React and Vue (one copy per package, kept identical by lib-sync).\n *\n * - It follows the finger: a swipe in from the edge it lives behind opens it, a swipe back toward that edge closes\n * it, and either finishes on release by how far and how fast the finger went. The drawer says its edge in\n * `--sidebar-drawer-edge` (`left` or `right`). While a finger drags it, the root carries `data-mobile-dragging`\n * and `--sidebar-drawer-progress` (0 closed to 1 open), and the styles place the drawer by them.\n * - While it is open, Tab goes round its controls (the page behind is inert), and Escape closes it once every other\n * listener has had the key, so a menu or dialog over the drawer takes its own Escape first.\n */\n\n/** How far in from its edge a swipe that opens the drawer may start */\nexport const DRAWER_EDGE_ZONE = 24\n/** How far a finger moves before the swipe is taken as horizontal or left to the page */\nexport const DRAWER_SWIPE_SLOP = 10\n/** A release faster than this, in px/ms, finishes the swipe in its direction whatever the distance */\nexport const DRAWER_SWIPE_VELOCITY = 0.3\n/** A finger held still this long, in ms, before it lifts lets go by distance alone */\nexport const DRAWER_SWIPE_HOLD = 100\n\nexport type DrawerSwipeOptions = {\n /** The element that holds the drawer and the page, where the drag state is written */\n root: HTMLElement\n /** The drawer itself */\n drawer: HTMLElement\n isOpen: () => boolean\n setOpen: (open: boolean) => void\n /** False turns the gesture off (a wide layout) */\n enabled?: () => boolean\n}\n\ntype Drag = {\n x: number\n y: number\n lastX: number\n lastTime: number\n velocity: number\n open: boolean\n edge: \"left\" | \"right\"\n travel: number\n state: \"pending\" | \"dragging\" | \"ignored\"\n progress: number\n}\n\nconst edgeOf = (drawer: HTMLElement): \"left\" | \"right\" =>\n getComputedStyle(drawer).getPropertyValue(\"--sidebar-drawer-edge\").trim() === \"left\" ? \"left\" : \"right\"\n\n/** The distance the drawer travels: its own width when it slides in beside the page, else its container's width */\nconst travelOf = (drawer: HTMLElement, root: HTMLElement, edge: \"left\" | \"right\") => {\n if (edge === \"left\") return drawer.getBoundingClientRect().width || root.getBoundingClientRect().width\n const container = drawer.offsetParent instanceof HTMLElement ? drawer.offsetParent : null\n return container?.clientWidth || window.innerWidth\n}\n\n/**\n * A finger on a slider, on an element that takes horizontal touches itself (`touch-action` without `pan-x`, such\n * as the Slider) or in a row that scrolls sideways moves that, not the drawer\n */\nconst ownsHorizontalSwipe = (target: EventTarget | null, root: HTMLElement) => {\n for (let node = target instanceof Element ? target : null; node && node !== root; node = node.parentElement) {\n if ((node instanceof HTMLInputElement && node.type === \"range\") || node.getAttribute(\"role\") === \"slider\") return true\n const style = getComputedStyle(node)\n if (/^(none|pan-y|pinch-zoom)/.test(style.touchAction) && !style.touchAction.includes(\"pan-x\")) return true\n if (node.scrollWidth > node.clientWidth && /auto|scroll/.test(style.overflowX)) return true\n }\n return false\n}\n\n/**\n * A popover or menu open over the drawer (the Radix and Reka popper wrappers) keeps the touch: swiping the drawer\n * away from under it would leave it open on an inert trigger. A modal dialog's overlay already covers the drawer.\n */\nconst layerOpen = (root: HTMLElement) =>\n root.ownerDocument.querySelector(\"[data-radix-popper-content-wrapper], [data-reka-popper-content-wrapper]\") !== null\n\n/** Starts the gesture on `root`; returns the cleanup */\nexport function attachDrawerSwipe({ root, drawer, isOpen, setOpen, enabled = () => true }: DrawerSwipeOptions) {\n let drag: Drag | null = null\n\n const setProgress = (progress: number) => {\n root.style.setProperty(\"--sidebar-drawer-progress\", String(progress))\n }\n\n const end = (commit: boolean, time = 0) => {\n const current = drag\n drag = null\n if (!current || current.state !== \"dragging\") return\n let next = current.open\n if (commit) {\n // Velocity in the opening direction is positive; a finger that stopped before lifting has none\n const velocity = time - current.lastTime > DRAWER_SWIPE_HOLD ? 0 : current.velocity\n const opening = current.edge === \"left\" ? velocity : -velocity\n next = opening > DRAWER_SWIPE_VELOCITY ? true : opening < -DRAWER_SWIPE_VELOCITY ? false : current.progress > 0.5\n }\n if (next !== current.open) setOpen(next)\n // The drawer leaves the finger once the new state is on the page, so it animates from where it was let go\n requestAnimationFrame(() => {\n root.removeAttribute(\"data-mobile-dragging\")\n root.style.removeProperty(\"--sidebar-drawer-progress\")\n })\n }\n\n const onTouchStart = (event: TouchEvent) => {\n // A second finger cancels a swipe under way, and the drawer goes back to where it was\n end(false)\n if (event.touches.length !== 1 || !enabled() || layerOpen(root) || ownsHorizontalSwipe(event.target, root)) return\n const touch = event.touches[0]!\n const open = isOpen()\n const edge = edgeOf(drawer)\n if (!open) {\n const bounds = root.getBoundingClientRect()\n const fromEdge = edge === \"left\" ? touch.clientX - bounds.left : bounds.right - touch.clientX\n if (fromEdge < 0 || fromEdge > DRAWER_EDGE_ZONE) return\n }\n drag = {\n x: touch.clientX,\n y: touch.clientY,\n lastX: touch.clientX,\n lastTime: event.timeStamp,\n velocity: 0,\n open,\n edge,\n travel: Math.max(1, travelOf(drawer, root, edge)),\n state: \"pending\",\n progress: open ? 1 : 0,\n }\n }\n\n const onTouchMove = (event: TouchEvent) => {\n if (!drag || drag.state === \"ignored\") return\n // A second finger put down outside the root shows only here\n if (event.touches.length !== 1) {\n end(false)\n return\n }\n const touch = event.touches[0]\n if (!touch) return\n const dx = touch.clientX - drag.x\n const dy = touch.clientY - drag.y\n // Toward the open drawer is positive\n const toward = drag.edge === \"left\" ? dx : -dx\n if (drag.state === \"pending\") {\n if (Math.abs(dx) < DRAWER_SWIPE_SLOP && Math.abs(dy) < DRAWER_SWIPE_SLOP) return\n const horizontal = Math.abs(dx) > Math.abs(dy)\n if (!horizontal || (drag.open ? toward >= 0 : toward <= 0)) {\n drag.state = \"ignored\"\n return\n }\n drag.state = \"dragging\"\n root.setAttribute(\"data-mobile-dragging\", \"\")\n }\n if (event.cancelable) event.preventDefault()\n const elapsed = event.timeStamp - drag.lastTime\n if (elapsed > 0) drag.velocity = (touch.clientX - drag.lastX) / elapsed\n drag.lastX = touch.clientX\n drag.lastTime = event.timeStamp\n drag.progress = Math.min(1, Math.max(0, (drag.open ? 1 : 0) + toward / drag.travel))\n setProgress(drag.progress)\n }\n\n // A finger lifted while another stays on the screen cancels the swipe\n const onTouchEnd = (event: TouchEvent) => end(event.touches.length === 0, event.timeStamp)\n const onTouchCancel = () => end(false)\n\n root.addEventListener(\"touchstart\", onTouchStart, { passive: true })\n root.addEventListener(\"touchmove\", onTouchMove, { passive: false })\n root.addEventListener(\"touchend\", onTouchEnd)\n root.addEventListener(\"touchcancel\", onTouchCancel)\n return () => {\n root.removeEventListener(\"touchstart\", onTouchStart)\n root.removeEventListener(\"touchmove\", onTouchMove)\n root.removeEventListener(\"touchend\", onTouchEnd)\n root.removeEventListener(\"touchcancel\", onTouchCancel)\n root.removeAttribute(\"data-mobile-dragging\")\n root.style.removeProperty(\"--sidebar-drawer-progress\")\n }\n}\n\nconst TABBABLE =\n 'a[href], area[href], button:not([disabled]), input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), iframe, [contenteditable]:not([contenteditable=\"false\"]), [tabindex]'\n\n/** The controls Tab reaches in the drawer, in order: not disabled (a disabled fieldset too), not in a closed submenu, not hidden */\nexport const drawerTabbables = (drawer: HTMLElement) =>\n Array.from(drawer.querySelectorAll<HTMLElement>(TABBABLE)).filter(\n (element) =>\n element.tabIndex >= 0 &&\n !element.matches(\":disabled\") &&\n !element.closest(\"[inert], [hidden]\") &&\n (typeof element.checkVisibility !== \"function\" || element.checkVisibility({ visibilityProperty: true })),\n )\n\n/** The first control of the open drawer, or the drawer itself */\nexport const drawerInitialFocus = (drawer: HTMLElement) => drawerTabbables(drawer)[0] ?? drawer\n\n/**\n * Tab from the last control goes to the first and Shift+Tab from the first to the last, so focus stays in the open\n * drawer. A layer over it in a portal (a menu, a dialog) keeps its own Tab.\n */\nexport function loopDrawerFocus(event: KeyboardEvent, drawer: HTMLElement) {\n if (event.key !== \"Tab\" || event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return\n if (!(event.target instanceof Node) || !drawer.contains(event.target)) return\n const items = drawerTabbables(drawer)\n const active = drawer.ownerDocument.activeElement\n const first = items[0]\n const last = items[items.length - 1]\n if (!first || !last) {\n event.preventDefault()\n drawer.focus({ preventScroll: true })\n } else if (event.shiftKey && (active === first || active === drawer)) {\n event.preventDefault()\n last.focus({ preventScroll: true })\n } else if (!event.shiftKey && active === last) {\n event.preventDefault()\n first.focus({ preventScroll: true })\n }\n}\n\n/**\n * Escape pressed in the open drawer closes it when the key reaches the window unprevented: a menu, popover or dialog\n * over the drawer has its listener on the way there and takes the key first, however it listens.\n */\nexport function closeOnUnhandledEscape(event: KeyboardEvent, drawer: HTMLElement, close: () => void) {\n if (event.key !== \"Escape\" || event.defaultPrevented) return\n const view = drawer.ownerDocument.defaultView\n if (!view) return\n const afterOthers = (late: Event) => {\n view.removeEventListener(\"keydown\", afterOthers)\n // A listener that stopped the key on its way leaves this one to the next key, which only removes it\n if (late !== event || event.defaultPrevented) return\n event.preventDefault()\n close()\n }\n view.addEventListener(\"keydown\", afterOthers)\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type HTMLAttributes, type PropType } from "vue";
|
|
2
2
|
import type { SemanticColors, Variants } from "@plexui/styles/types";
|
|
3
|
+
export type AlertMobileActions = "capsules" | "own";
|
|
3
4
|
export type AlertColor = SemanticColors<"primary" | "danger" | "success" | "info" | "discovery" | "caution" | "warning">;
|
|
4
5
|
declare const AlertComponent: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
6
|
/** Color of the alert. @default "primary" */
|
|
@@ -18,6 +19,14 @@ declare const AlertComponent: import("vue").DefineComponent<import("vue").Extrac
|
|
|
18
19
|
description: StringConstructor;
|
|
19
20
|
/** Places `actions` at the end or the bottom. Automatic from sizing when unset. */
|
|
20
21
|
actionsPlacement: PropType<"end" | "bottom">;
|
|
22
|
+
/**
|
|
23
|
+
* How the actions show at 767px and below: 50px capsules side by side, as the buttons of an iOS tip (TipKit),
|
|
24
|
+
* or the buttons as given, at their own size, for an alert inside a block of buttons of its own. @default "capsules"
|
|
25
|
+
*/
|
|
26
|
+
mobileActions: {
|
|
27
|
+
type: PropType<AlertMobileActions>;
|
|
28
|
+
default: string;
|
|
29
|
+
};
|
|
21
30
|
/** `false` hides the indicator. Use the `indicator` slot to replace it. */
|
|
22
31
|
indicator: {
|
|
23
32
|
type: BooleanConstructor;
|
|
@@ -51,6 +60,14 @@ declare const AlertComponent: import("vue").DefineComponent<import("vue").Extrac
|
|
|
51
60
|
description: StringConstructor;
|
|
52
61
|
/** Places `actions` at the end or the bottom. Automatic from sizing when unset. */
|
|
53
62
|
actionsPlacement: PropType<"end" | "bottom">;
|
|
63
|
+
/**
|
|
64
|
+
* How the actions show at 767px and below: 50px capsules side by side, as the buttons of an iOS tip (TipKit),
|
|
65
|
+
* or the buttons as given, at their own size, for an alert inside a block of buttons of its own. @default "capsules"
|
|
66
|
+
*/
|
|
67
|
+
mobileActions: {
|
|
68
|
+
type: PropType<AlertMobileActions>;
|
|
69
|
+
default: string;
|
|
70
|
+
};
|
|
54
71
|
/** `false` hides the indicator. Use the `indicator` slot to replace it. */
|
|
55
72
|
indicator: {
|
|
56
73
|
type: BooleanConstructor;
|
|
@@ -68,6 +85,7 @@ declare const AlertComponent: import("vue").DefineComponent<import("vue").Extrac
|
|
|
68
85
|
}>> & Readonly<{}>, {
|
|
69
86
|
color: "primary" | "danger" | "success" | "info" | "discovery" | "caution" | "warning";
|
|
70
87
|
variant: "solid" | "soft" | "outline";
|
|
88
|
+
mobileActions: AlertMobileActions;
|
|
71
89
|
indicator: boolean;
|
|
72
90
|
banner: boolean;
|
|
73
91
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Alert, type AlertColor, type AlertProps } from "./Alert.js";
|
|
1
|
+
export { Alert, type AlertColor, type AlertMobileActions, type AlertProps } from "./Alert.js";
|
|
@@ -422,8 +422,11 @@ export declare const SidebarCardContent: Part<HTMLAttributes>;
|
|
|
422
422
|
export type SidebarCardFooterProps = HTMLAttributes;
|
|
423
423
|
export declare const SidebarCardFooter: Part<HTMLAttributes>;
|
|
424
424
|
export type SidebarInsetProps = HTMLAttributes;
|
|
425
|
-
/**
|
|
426
|
-
|
|
425
|
+
/**
|
|
426
|
+
* Main content area next to the sidebar, a `<main>`. Behind the open phone drawer it takes no focus or touch
|
|
427
|
+
* (`inert`); an `inert` of your own wins.
|
|
428
|
+
*/
|
|
429
|
+
export declare const SidebarInset: Part<SidebarInsetProps>;
|
|
427
430
|
export type SidebarLayoutProps = HTMLAttributes;
|
|
428
431
|
/** Wrapper for the sidebar and the main content. */
|
|
429
432
|
export declare const SidebarLayout: Part<HTMLAttributes>;
|
|
@@ -435,12 +438,23 @@ export type SidebarTriggerProps = ButtonHTMLAttributes;
|
|
|
435
438
|
export declare const SidebarTrigger: ReturnType<typeof part<SidebarTriggerProps>>;
|
|
436
439
|
export type SidebarMobileMenuButtonProps = ButtonHTMLAttributes;
|
|
437
440
|
export declare const SidebarMobileMenuButton: ReturnType<typeof part<SidebarMobileMenuButtonProps>>;
|
|
441
|
+
/**
|
|
442
|
+
* The phone drawer: a modal dialog while it is open. Focus moves into it and Tab goes round its controls, the page
|
|
443
|
+
* behind is inert (SidebarInset), Escape inside it closes it after any layer over it has taken its own, and focus
|
|
444
|
+
* goes back to the control that opened it. A swipe in from the edge it slides from opens it and a swipe back closes
|
|
445
|
+
* it (lib/phoneDrawer).
|
|
446
|
+
*/
|
|
438
447
|
declare const SidebarMobileComponent: DefineComponent<import("vue").ExtractPropTypes<{
|
|
439
448
|
/** When true, drawer is positioned absolute instead of fixed (for contained demos) */
|
|
440
449
|
contained: {
|
|
441
450
|
type: BooleanConstructor;
|
|
442
451
|
default: undefined;
|
|
443
452
|
};
|
|
453
|
+
/** Rows that lead to another page end with a disclosure chevron, as in an iOS list. `false` leaves it out. @default true */
|
|
454
|
+
disclosure: {
|
|
455
|
+
type: BooleanConstructor;
|
|
456
|
+
default: boolean;
|
|
457
|
+
};
|
|
444
458
|
}>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
445
459
|
[key: string]: any;
|
|
446
460
|
}>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -449,8 +463,14 @@ declare const SidebarMobileComponent: DefineComponent<import("vue").ExtractPropT
|
|
|
449
463
|
type: BooleanConstructor;
|
|
450
464
|
default: undefined;
|
|
451
465
|
};
|
|
466
|
+
/** Rows that lead to another page end with a disclosure chevron, as in an iOS list. `false` leaves it out. @default true */
|
|
467
|
+
disclosure: {
|
|
468
|
+
type: BooleanConstructor;
|
|
469
|
+
default: boolean;
|
|
470
|
+
};
|
|
452
471
|
}>> & Readonly<{}>, {
|
|
453
472
|
contained: boolean;
|
|
473
|
+
disclosure: boolean;
|
|
454
474
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
455
475
|
export type SidebarMobileProps = InstanceType<typeof SidebarMobileComponent>["$props"] & HTMLAttributes;
|
|
456
476
|
export declare const SidebarMobile: typeof SidebarMobileComponent & {
|
|
@@ -32,6 +32,16 @@ declare const SidebarProviderComponent: import("vue").DefineComponent<import("vu
|
|
|
32
32
|
type: BooleanConstructor;
|
|
33
33
|
default: undefined;
|
|
34
34
|
};
|
|
35
|
+
/** Controlled open state of the phone drawer, SidebarMobile (`v-model:open-mobile`) */
|
|
36
|
+
openMobile: {
|
|
37
|
+
type: BooleanConstructor;
|
|
38
|
+
default: undefined;
|
|
39
|
+
};
|
|
40
|
+
/** Initial open state of the phone drawer (uncontrolled). @default false */
|
|
41
|
+
defaultOpenMobile: {
|
|
42
|
+
type: BooleanConstructor;
|
|
43
|
+
default: boolean;
|
|
44
|
+
};
|
|
35
45
|
/** Collapsible mode. @default "offcanvas" */
|
|
36
46
|
collapsible: {
|
|
37
47
|
type: PropType<SidebarCollapsible>;
|
|
@@ -47,6 +57,8 @@ declare const SidebarProviderComponent: import("vue").DefineComponent<import("vu
|
|
|
47
57
|
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
48
58
|
/** The open state changes (`v-model:open`) */
|
|
49
59
|
"update:open": (_open: boolean) => true;
|
|
60
|
+
/** The phone drawer opens or closes: its menu button, its backdrop, Escape or a swipe (`v-model:open-mobile`) */
|
|
61
|
+
"update:openMobile": (_open: boolean) => true;
|
|
50
62
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
51
63
|
/** Default open state (uncontrolled). @default true */
|
|
52
64
|
defaultOpen: {
|
|
@@ -58,6 +70,16 @@ declare const SidebarProviderComponent: import("vue").DefineComponent<import("vu
|
|
|
58
70
|
type: BooleanConstructor;
|
|
59
71
|
default: undefined;
|
|
60
72
|
};
|
|
73
|
+
/** Controlled open state of the phone drawer, SidebarMobile (`v-model:open-mobile`) */
|
|
74
|
+
openMobile: {
|
|
75
|
+
type: BooleanConstructor;
|
|
76
|
+
default: undefined;
|
|
77
|
+
};
|
|
78
|
+
/** Initial open state of the phone drawer (uncontrolled). @default false */
|
|
79
|
+
defaultOpenMobile: {
|
|
80
|
+
type: BooleanConstructor;
|
|
81
|
+
default: boolean;
|
|
82
|
+
};
|
|
61
83
|
/** Collapsible mode. @default "offcanvas" */
|
|
62
84
|
collapsible: {
|
|
63
85
|
type: PropType<SidebarCollapsible>;
|
|
@@ -70,11 +92,14 @@ declare const SidebarProviderComponent: import("vue").DefineComponent<import("vu
|
|
|
70
92
|
};
|
|
71
93
|
}>> & Readonly<{
|
|
72
94
|
"onUpdate:open"?: ((_open: boolean) => any) | undefined;
|
|
95
|
+
"onUpdate:openMobile"?: ((_open: boolean) => any) | undefined;
|
|
73
96
|
}>, {
|
|
74
97
|
collapsible: SidebarCollapsible;
|
|
75
98
|
open: boolean;
|
|
76
99
|
defaultOpen: boolean;
|
|
77
100
|
variant: SidebarProviderVariant;
|
|
101
|
+
openMobile: boolean;
|
|
102
|
+
defaultOpenMobile: boolean;
|
|
78
103
|
}, SlotsType<{
|
|
79
104
|
default?: (context: SidebarContextValue) => unknown;
|
|
80
105
|
}>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The phone drawer of Sidebar, shared by React and Vue (one copy per package, kept identical by lib-sync).
|
|
3
|
+
*
|
|
4
|
+
* - It follows the finger: a swipe in from the edge it lives behind opens it, a swipe back toward that edge closes
|
|
5
|
+
* it, and either finishes on release by how far and how fast the finger went. The drawer says its edge in
|
|
6
|
+
* `--sidebar-drawer-edge` (`left` or `right`). While a finger drags it, the root carries `data-mobile-dragging`
|
|
7
|
+
* and `--sidebar-drawer-progress` (0 closed to 1 open), and the styles place the drawer by them.
|
|
8
|
+
* - While it is open, Tab goes round its controls (the page behind is inert), and Escape closes it once every other
|
|
9
|
+
* listener has had the key, so a menu or dialog over the drawer takes its own Escape first.
|
|
10
|
+
*/
|
|
11
|
+
/** How far in from its edge a swipe that opens the drawer may start */
|
|
12
|
+
export declare const DRAWER_EDGE_ZONE = 24;
|
|
13
|
+
/** How far a finger moves before the swipe is taken as horizontal or left to the page */
|
|
14
|
+
export declare const DRAWER_SWIPE_SLOP = 10;
|
|
15
|
+
/** A release faster than this, in px/ms, finishes the swipe in its direction whatever the distance */
|
|
16
|
+
export declare const DRAWER_SWIPE_VELOCITY = 0.3;
|
|
17
|
+
/** A finger held still this long, in ms, before it lifts lets go by distance alone */
|
|
18
|
+
export declare const DRAWER_SWIPE_HOLD = 100;
|
|
19
|
+
export type DrawerSwipeOptions = {
|
|
20
|
+
/** The element that holds the drawer and the page, where the drag state is written */
|
|
21
|
+
root: HTMLElement;
|
|
22
|
+
/** The drawer itself */
|
|
23
|
+
drawer: HTMLElement;
|
|
24
|
+
isOpen: () => boolean;
|
|
25
|
+
setOpen: (open: boolean) => void;
|
|
26
|
+
/** False turns the gesture off (a wide layout) */
|
|
27
|
+
enabled?: () => boolean;
|
|
28
|
+
};
|
|
29
|
+
/** Starts the gesture on `root`; returns the cleanup */
|
|
30
|
+
export declare function attachDrawerSwipe({ root, drawer, isOpen, setOpen, enabled }: DrawerSwipeOptions): () => void;
|
|
31
|
+
/** The controls Tab reaches in the drawer, in order: not disabled (a disabled fieldset too), not in a closed submenu, not hidden */
|
|
32
|
+
export declare const drawerTabbables: (drawer: HTMLElement) => HTMLElement[];
|
|
33
|
+
/** The first control of the open drawer, or the drawer itself */
|
|
34
|
+
export declare const drawerInitialFocus: (drawer: HTMLElement) => HTMLElement;
|
|
35
|
+
/**
|
|
36
|
+
* Tab from the last control goes to the first and Shift+Tab from the first to the last, so focus stays in the open
|
|
37
|
+
* drawer. A layer over it in a portal (a menu, a dialog) keeps its own Tab.
|
|
38
|
+
*/
|
|
39
|
+
export declare function loopDrawerFocus(event: KeyboardEvent, drawer: HTMLElement): void;
|
|
40
|
+
/**
|
|
41
|
+
* Escape pressed in the open drawer closes it when the key reaches the window unprevented: a menu, popover or dialog
|
|
42
|
+
* over the drawer has its listener on the way there and takes the key first, however it listens.
|
|
43
|
+
*/
|
|
44
|
+
export declare function closeOnUnhandledEscape(event: KeyboardEvent, drawer: HTMLElement, close: () => void): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plexui/vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Plex UI components for Vue 3, built on Reka UI and the shared @plexui/styles CSS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"@maskito/core": "5.2.2",
|
|
78
78
|
"@maskito/kit": "5.2.2",
|
|
79
79
|
"@maskito/vue": "5.2.2",
|
|
80
|
-
"@plexui/styles": "^0.1.
|
|
80
|
+
"@plexui/styles": "^0.1.41",
|
|
81
81
|
"@tanstack/table-core": "8.21.3",
|
|
82
82
|
"@tanstack/vue-table": "8.21.3",
|
|
83
83
|
"@tiptap/core": "3.21.0",
|