@constructive-io/ui 0.13.0 → 0.14.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/{ai-B7XNnqYL.js → ai-4JrVVL3q.js} +311 -213
- package/dist/ai-4JrVVL3q.js.map +1 -0
- package/dist/{ai-DJ-YPj8c.cjs → ai-B08ufcbD.cjs} +309 -211
- package/dist/ai-B08ufcbD.cjs.map +1 -0
- package/dist/components/ai/index.cjs +1 -1
- package/dist/components/ai/index.d.cts +1 -1
- package/dist/components/ai/index.d.ts +1 -1
- package/dist/components/ai/index.js +1 -1
- package/dist/components/autocomplete.cjs +1 -1
- package/dist/components/autocomplete.js +1 -1
- package/dist/components/badge.d.cts +4 -4
- package/dist/components/badge.d.ts +4 -4
- package/dist/components/button-group.d.cts +1 -1
- package/dist/components/button-group.d.ts +1 -1
- package/dist/components/button.cjs +3 -3
- package/dist/components/button.cjs.map +1 -1
- package/dist/components/button.d.cts +2 -2
- package/dist/components/button.d.ts +2 -2
- package/dist/components/button.js +3 -3
- package/dist/components/button.js.map +1 -1
- package/dist/components/card.d.cts +1 -1
- package/dist/components/card.d.ts +1 -1
- package/dist/components/collapsible.cjs +1 -1
- package/dist/components/collapsible.cjs.map +1 -1
- package/dist/components/collapsible.js +1 -1
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/combobox.cjs +1 -1
- package/dist/components/combobox.js +1 -1
- package/dist/components/command.cjs +8 -3
- package/dist/components/command.cjs.map +1 -1
- package/dist/components/command.d.cts +4 -1
- package/dist/components/command.d.ts +4 -1
- package/dist/components/command.js +8 -3
- package/dist/components/command.js.map +1 -1
- package/dist/components/dropdown-menu.cjs +2 -2
- package/dist/components/dropdown-menu.cjs.map +1 -1
- package/dist/components/dropdown-menu.js +2 -2
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/field.d.cts +1 -1
- package/dist/components/field.d.ts +1 -1
- package/dist/components/input-otp.cjs +1 -1
- package/dist/components/input-otp.js +1 -1
- package/dist/components/multi-select.cjs +1 -1
- package/dist/components/multi-select.js +1 -1
- package/dist/components/popover.cjs +7 -0
- package/dist/components/popover.cjs.map +1 -1
- package/dist/components/popover.d.cts +7 -1
- package/dist/components/popover.d.ts +7 -1
- package/dist/components/popover.js +7 -1
- package/dist/components/popover.js.map +1 -1
- package/dist/components/select.cjs +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/sidebar.d.cts +1 -1
- package/dist/components/sidebar.d.ts +1 -1
- package/dist/components/tabs.cjs +5 -2
- package/dist/components/tabs.cjs.map +1 -1
- package/dist/components/tabs.js +5 -2
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/toggle-group.cjs +1 -1
- package/dist/components/toggle-group.js +1 -1
- package/dist/components/toggle.d.cts +1 -1
- package/dist/components/toggle.d.ts +1 -1
- package/dist/components/workspace-kit/index.cjs +51 -21
- package/dist/components/workspace-kit/index.cjs.map +1 -1
- package/dist/components/workspace-kit/index.d.cts +18 -6
- package/dist/components/workspace-kit/index.d.ts +18 -6
- package/dist/components/workspace-kit/index.js +51 -21
- package/dist/components/workspace-kit/index.js.map +1 -1
- package/dist/{fluid-highlight-DxWeZ7iu.js → fluid-highlight-CNELHV8o.js} +26 -11
- package/dist/fluid-highlight-CNELHV8o.js.map +1 -0
- package/dist/{fluid-highlight-AW-OITqJ.cjs → fluid-highlight-YWFRZXsw.cjs} +30 -9
- package/dist/fluid-highlight-YWFRZXsw.cjs.map +1 -0
- package/dist/{index-z3LqQ5L5.d.ts → index-Cluc_xc5.d.ts} +23 -14
- package/dist/{index-CiO-3M_X.d.cts → index-DXoG0ghv.d.cts} +23 -14
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/{theme-DTTTlylA.d.ts → theme-CKpIa4Fj.d.cts} +42 -26
- package/dist/{theme-DTTTlylA.d.cts → theme-CKpIa4Fj.d.ts} +42 -26
- package/dist/theme-dials-config.d.cts +1 -1
- package/dist/theme-dials-config.d.ts +1 -1
- package/dist/theme-presets.d.cts +1 -1
- package/dist/theme-presets.d.ts +1 -1
- package/dist/{theme-tuning-TJ76tnxZ.d.cts → theme-tuning-CTOHSrsh.d.cts} +2 -2
- package/dist/{theme-tuning-DjgDvV8V.d.ts → theme-tuning-DOko6Pmy.d.ts} +2 -2
- package/dist/theme-tuning.d.cts +1 -1
- package/dist/theme-tuning.d.ts +1 -1
- package/dist/theme.cjs +28 -22
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.d.cts +1 -1
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +28 -22
- package/dist/theme.js.map +1 -1
- package/package.json +5 -2
- package/src/styles/globals.css +43 -25
- package/dist/ai-B7XNnqYL.js.map +0 -1
- package/dist/ai-DJ-YPj8c.cjs.map +0 -1
- package/dist/fluid-highlight-AW-OITqJ.cjs.map +0 -1
- package/dist/fluid-highlight-DxWeZ7iu.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.cjs","names":["TabsPrimitive","cn","useScrollFade","useMergedRefs"],"sources":["../../src/components/tabs.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Tabs as TabsPrimitive } from '@base-ui/react/tabs';\n\nimport { useMergedRefs } from '../lib/compose-refs';\nimport { useScrollFade } from '../lib/use-scroll-fade';\nimport { cn } from '../lib/utils';\n\nfunction Tabs({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Root>) {\n\treturn <TabsPrimitive.Root data-slot=\"tabs\" className={cn('flex flex-col gap-2', className)} {...props} />;\n}\n\n/** Scrolls `scroller` along its inline axis just far enough to show `target`; the page never moves. */\nfunction revealInline(scroller: HTMLElement, target: HTMLElement) {\n\tconst frame = scroller.getBoundingClientRect();\n\tconst box = target.getBoundingClientRect();\n\tif (box.left < frame.left) scroller.scrollBy({ left: box.left - frame.left - 8 });\n\telse if (box.right > frame.right) scroller.scrollBy({ left: box.right - frame.right + 8 });\n}\n\n/**\n * Tabs keep their width and scroll sideways once they no longer fit: the list never grows past its\n * container, edges fade where more tabs are hidden, and the active tab is scrolled into view.\n */\nfunction TabsList({ className, children, style, ...props }: React.ComponentProps<typeof TabsPrimitive.List>) {\n\tconst fade = useScrollFade<HTMLDivElement>();\n\t// The fade's ref and the one the consumer passes, merged once so React does not detach and attach them every render.\n\tconst ref = useMergedRefs(fade.ref, props.ref);\n\tconst { node: list, overflowing } = fade;\n\n\tReact.useEffect(() => {\n\t\tif (!list || !overflowing) return;\n\t\tconst revealActive = () => {\n\t\t\tconst active = list.querySelector<HTMLElement>('[data-active]');\n\t\t\tif (active) revealInline(list, active);\n\t\t};\n\t\t// The list only becomes a scroller once it overflows, so the active tab is revealed then, and again whenever\n\t\t// another tab becomes active.\n\t\trevealActive();\n\t\tconst observer = new MutationObserver(revealActive);\n\t\tobserver.observe(list, { subtree: true, attributes: true, attributeFilter: ['data-active'] });\n\t\treturn () => observer.disconnect();\n\t}, [list, overflowing]);\n\n\treturn (\n\t\t<TabsPrimitive.List\n\t\t\tdata-slot=\"tabs-list\"\n\t\t\tclassName={cn(\n\t\t\t\t'bg-muted text-muted-foreground/70 relative inline-flex w-fit max-w-full items-center justify-center rounded-md p-0.5',\n\t\t\t\t// Scroll only when needed, so a list that fits keeps its focus rings uncropped.\n\t\t\t\toverflowing && 'justify-start overflow-x-auto overscroll-x-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tstyle={fade.style ? { ...style, ...fade.style } : style}\n\t\t\t{...props}\n\t\t\tref={ref}\n\t\t>\n\t\t\t<TabsIndicator />\n\t\t\t{children}\n\t\t</TabsPrimitive.List>\n\t);\n}\n\n/**\n * Traveling active-tab pill — Base UI feeds it --active-tab-* CSS vars, so\n * transitioning left/top/width/height animates the slide between tabs.\n * TabsList renders one automatically before the triggers (whose `relative`\n * labels paint above it); exported for custom list compositions.\n */\nfunction TabsIndicator({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Indicator>) {\n\treturn (\n\t\t<TabsPrimitive.Indicator\n\t\t\tdata-slot=\"tabs-indicator\"\n\t\t\tclassName={cn(\n\t\t\t\t`bg-background absolute top-(--active-tab-top) left-(--active-tab-left) h-(--active-tab-height)\n\t\t\t\tw-(--active-tab-width) rounded-[calc(var(--radius-md)-2px)] shadow-xs transition-[left,top,width,height]\n\t\t\t\tduration-(--duration-moderate) ease-out motion-reduce:transition-none`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Tab>) {\n\treturn (\n\t\t<TabsPrimitive.Tab\n\t\t\tdata-slot=\"tabs-trigger\"\n\t\t\tclassName={cn(\n\t\t\t\t`hover:text-muted-foreground data-[active]:text-foreground\n\t\t\t\t\tfocus-visible:ring-ring/50 relative inline-flex min-h-10 min-w-10 shrink-0 items-center justify-center rounded-[calc(var(--radius-md)-2px)] px-3\n\t\t\t\t\ttext-sm font-medium whitespace-nowrap outline-none pointer-coarse:min-h-11 focus-visible:ring-[3px]\n\t\t\t\tdata-[disabled]:pointer-events-none data-[disabled]:opacity-64 [&_svg]:shrink-0`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Panel>) {\n\treturn <TabsPrimitive.Panel data-slot=\"tabs-content\" className={cn('min-w-0 flex-1 outline-none [overflow-wrap:break-word]', className)} {...props} />;\n}\n\nexport { Tabs, TabsContent, TabsIndicator, TabsList, TabsTrigger };\n"],"mappings":";;;;;;;;;;;;;AASA,SAAS,KAAK,EAAE,WAAW,GAAG,SAA0D;CACvF,OAAO,2CAACA,yBAAc,MAAf;EAAoB,aAAU;EAAO,WAAWC,iBAAG,uBAAuB,SAAS;EAAG,GAAI;CAAQ;AAC1G;;AAGA,SAAS,aAAa,UAAuB,QAAqB;CACjE,MAAM,QAAQ,SAAS,sBAAsB;CAC7C,MAAM,MAAM,OAAO,sBAAsB;
|
|
1
|
+
{"version":3,"file":"tabs.cjs","names":["TabsPrimitive","cn","useScrollFade","useMergedRefs"],"sources":["../../src/components/tabs.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Tabs as TabsPrimitive } from '@base-ui/react/tabs';\n\nimport { useMergedRefs } from '../lib/compose-refs';\nimport { useScrollFade } from '../lib/use-scroll-fade';\nimport { cn } from '../lib/utils';\n\nfunction Tabs({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Root>) {\n\treturn <TabsPrimitive.Root data-slot=\"tabs\" className={cn('flex flex-col gap-2', className)} {...props} />;\n}\n\n/** Scrolls `scroller` along its inline axis just far enough to show `target`; the page never moves. */\nfunction revealInline(scroller: HTMLElement, target: HTMLElement) {\n\tconst frame = scroller.getBoundingClientRect();\n\tconst box = target.getBoundingClientRect();\n\t// A tab wider than the list shows its start, where the label begins, rather than its end.\n\tif (box.width >= frame.width) {\n\t\tconst rtl = getComputedStyle(scroller).direction === 'rtl';\n\t\tscroller.scrollBy({ left: rtl ? box.right - frame.right : box.left - frame.left });\n\t} else if (box.left < frame.left) scroller.scrollBy({ left: box.left - frame.left - 8 });\n\telse if (box.right > frame.right) scroller.scrollBy({ left: box.right - frame.right + 8 });\n}\n\n/**\n * Tabs keep their width and scroll sideways once they no longer fit: the list never grows past its\n * container, edges fade where more tabs are hidden, and the active tab is scrolled into view.\n */\nfunction TabsList({ className, children, style, ...props }: React.ComponentProps<typeof TabsPrimitive.List>) {\n\tconst fade = useScrollFade<HTMLDivElement>();\n\t// The fade's ref and the one the consumer passes, merged once so React does not detach and attach them every render.\n\tconst ref = useMergedRefs(fade.ref, props.ref);\n\tconst { node: list, overflowing } = fade;\n\n\tReact.useEffect(() => {\n\t\tif (!list || !overflowing) return;\n\t\tconst revealActive = () => {\n\t\t\tconst active = list.querySelector<HTMLElement>('[data-active]');\n\t\t\tif (active) revealInline(list, active);\n\t\t};\n\t\t// The list only becomes a scroller once it overflows, so the active tab is revealed then, and again whenever\n\t\t// another tab becomes active.\n\t\trevealActive();\n\t\tconst observer = new MutationObserver(revealActive);\n\t\tobserver.observe(list, { subtree: true, attributes: true, attributeFilter: ['data-active'] });\n\t\treturn () => observer.disconnect();\n\t}, [list, overflowing]);\n\n\treturn (\n\t\t<TabsPrimitive.List\n\t\t\tdata-slot=\"tabs-list\"\n\t\t\tclassName={cn(\n\t\t\t\t'bg-muted text-muted-foreground/70 relative inline-flex w-fit max-w-full items-center justify-center rounded-md p-0.5',\n\t\t\t\t// Scroll only when needed, so a list that fits keeps its focus rings uncropped.\n\t\t\t\t// Sideways only: a strip never scrolls vertically, and no bar takes height from the tabs.\n\t\t\t\toverflowing && 'justify-start overflow-x-auto overflow-y-hidden overscroll-x-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tstyle={fade.style ? { ...style, ...fade.style } : style}\n\t\t\t{...props}\n\t\t\tref={ref}\n\t\t>\n\t\t\t<TabsIndicator />\n\t\t\t{children}\n\t\t</TabsPrimitive.List>\n\t);\n}\n\n/**\n * Traveling active-tab pill — Base UI feeds it --active-tab-* CSS vars, so\n * transitioning left/top/width/height animates the slide between tabs.\n * TabsList renders one automatically before the triggers (whose `relative`\n * labels paint above it); exported for custom list compositions.\n */\nfunction TabsIndicator({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Indicator>) {\n\treturn (\n\t\t<TabsPrimitive.Indicator\n\t\t\tdata-slot=\"tabs-indicator\"\n\t\t\tclassName={cn(\n\t\t\t\t`bg-background absolute top-(--active-tab-top) left-(--active-tab-left) h-(--active-tab-height)\n\t\t\t\tw-(--active-tab-width) rounded-[calc(var(--radius-md)-2px)] shadow-xs transition-[left,top,width,height]\n\t\t\t\tduration-(--duration-moderate) ease-out motion-reduce:transition-none`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Tab>) {\n\treturn (\n\t\t<TabsPrimitive.Tab\n\t\t\tdata-slot=\"tabs-trigger\"\n\t\t\tclassName={cn(\n\t\t\t\t`hover:text-muted-foreground data-[active]:text-foreground\n\t\t\t\t\tfocus-visible:ring-ring/50 relative inline-flex min-h-10 min-w-10 shrink-0 items-center justify-center rounded-[calc(var(--radius-md)-2px)] px-3\n\t\t\t\t\ttext-sm font-medium whitespace-nowrap outline-none pointer-coarse:min-h-11 focus-visible:ring-[3px]\n\t\t\t\tdata-[disabled]:pointer-events-none data-[disabled]:opacity-64 [&_svg]:shrink-0`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Panel>) {\n\treturn <TabsPrimitive.Panel data-slot=\"tabs-content\" className={cn('min-w-0 flex-1 outline-none [overflow-wrap:break-word]', className)} {...props} />;\n}\n\nexport { Tabs, TabsContent, TabsIndicator, TabsList, TabsTrigger };\n"],"mappings":";;;;;;;;;;;;;AASA,SAAS,KAAK,EAAE,WAAW,GAAG,SAA0D;CACvF,OAAO,2CAACA,yBAAc,MAAf;EAAoB,aAAU;EAAO,WAAWC,iBAAG,uBAAuB,SAAS;EAAG,GAAI;CAAQ;AAC1G;;AAGA,SAAS,aAAa,UAAuB,QAAqB;CACjE,MAAM,QAAQ,SAAS,sBAAsB;CAC7C,MAAM,MAAM,OAAO,sBAAsB;CAEzC,IAAI,IAAI,SAAS,MAAM,OAAO;EAC7B,MAAM,MAAM,iBAAiB,QAAQ,CAAC,CAAC,cAAc;EACrD,SAAS,SAAS,EAAE,MAAM,MAAM,IAAI,QAAQ,MAAM,QAAQ,IAAI,OAAO,MAAM,KAAK,CAAC;CAClF,OAAO,IAAI,IAAI,OAAO,MAAM,MAAM,SAAS,SAAS,EAAE,MAAM,IAAI,OAAO,MAAM,OAAO,EAAE,CAAC;MAClF,IAAI,IAAI,QAAQ,MAAM,OAAO,SAAS,SAAS,EAAE,MAAM,IAAI,QAAQ,MAAM,QAAQ,EAAE,CAAC;AAC1F;;;;;AAMA,SAAS,SAAS,EAAE,WAAW,UAAU,OAAO,GAAG,SAA0D;CAC5G,MAAM,OAAOC,sCAA8B;CAE3C,MAAM,MAAMC,mCAAc,KAAK,KAAK,MAAM,GAAG;CAC7C,MAAM,EAAE,MAAM,MAAM,gBAAgB;CAEpC,MAAM,gBAAgB;EACrB,IAAI,CAAC,QAAQ,CAAC,aAAa;EAC3B,MAAM,qBAAqB;GAC1B,MAAM,SAAS,KAAK,cAA2B,eAAe;GAC9D,IAAI,QAAQ,aAAa,MAAM,MAAM;EACtC;EAGA,aAAa;EACb,MAAM,WAAW,IAAI,iBAAiB,YAAY;EAClD,SAAS,QAAQ,MAAM;GAAE,SAAS;GAAM,YAAY;GAAM,iBAAiB,CAAC,aAAa;EAAE,CAAC;EAC5F,aAAa,SAAS,WAAW;CAClC,GAAG,CAAC,MAAM,WAAW,CAAC;CAEtB,OACC,4CAACH,yBAAc,MAAf;EACC,aAAU;EACV,WAAWC,iBACV,wHAGA,eAAe,6HACf,SACD;EACA,OAAO,KAAK,QAAQ;GAAE,GAAG;GAAO,GAAG,KAAK;EAAM,IAAI;EAClD,GAAI;EACC;YAXN,CAaC,2CAAC,eAAD,CAAgB,IACf,QACkB;;AAEtB;;;;;;;AAQA,SAAS,cAAc,EAAE,WAAW,GAAG,SAA+D;CACrG,OACC,2CAACD,yBAAc,WAAf;EACC,aAAU;EACV,WAAWC,iBACV;;4EAGA,SACD;EACA,GAAI;CACJ;AAEH;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAAyD;CAC7F,OACC,2CAACD,yBAAc,KAAf;EACC,aAAU;EACV,WAAWC,iBACV;;;sFAIA,SACD;EACA,GAAI;CACJ;AAEH;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAA2D;CAC/F,OAAO,2CAACD,yBAAc,OAAf;EAAqB,aAAU;EAAe,WAAWC,iBAAG,0DAA0D,SAAS;EAAG,GAAI;CAAQ;AACtJ"}
|
package/dist/components/tabs.js
CHANGED
|
@@ -19,7 +19,10 @@ function Tabs({ className, ...props }) {
|
|
|
19
19
|
function revealInline(scroller, target) {
|
|
20
20
|
const frame = scroller.getBoundingClientRect();
|
|
21
21
|
const box = target.getBoundingClientRect();
|
|
22
|
-
if (box.
|
|
22
|
+
if (box.width >= frame.width) {
|
|
23
|
+
const rtl = getComputedStyle(scroller).direction === "rtl";
|
|
24
|
+
scroller.scrollBy({ left: rtl ? box.right - frame.right : box.left - frame.left });
|
|
25
|
+
} else if (box.left < frame.left) scroller.scrollBy({ left: box.left - frame.left - 8 });
|
|
23
26
|
else if (box.right > frame.right) scroller.scrollBy({ left: box.right - frame.right + 8 });
|
|
24
27
|
}
|
|
25
28
|
/**
|
|
@@ -47,7 +50,7 @@ function TabsList({ className, children, style, ...props }) {
|
|
|
47
50
|
}, [list, overflowing]);
|
|
48
51
|
return /* @__PURE__ */ jsxs(Tabs$1.List, {
|
|
49
52
|
"data-slot": "tabs-list",
|
|
50
|
-
className: cn("bg-muted text-muted-foreground/70 relative inline-flex w-fit max-w-full items-center justify-center rounded-md p-0.5", overflowing && "justify-start overflow-x-auto overscroll-x-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", className),
|
|
53
|
+
className: cn("bg-muted text-muted-foreground/70 relative inline-flex w-fit max-w-full items-center justify-center rounded-md p-0.5", overflowing && "justify-start overflow-x-auto overflow-y-hidden overscroll-x-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", className),
|
|
51
54
|
style: fade.style ? {
|
|
52
55
|
...style,
|
|
53
56
|
...fade.style
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.js","names":["TabsPrimitive"],"sources":["../../src/components/tabs.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Tabs as TabsPrimitive } from '@base-ui/react/tabs';\n\nimport { useMergedRefs } from '../lib/compose-refs';\nimport { useScrollFade } from '../lib/use-scroll-fade';\nimport { cn } from '../lib/utils';\n\nfunction Tabs({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Root>) {\n\treturn <TabsPrimitive.Root data-slot=\"tabs\" className={cn('flex flex-col gap-2', className)} {...props} />;\n}\n\n/** Scrolls `scroller` along its inline axis just far enough to show `target`; the page never moves. */\nfunction revealInline(scroller: HTMLElement, target: HTMLElement) {\n\tconst frame = scroller.getBoundingClientRect();\n\tconst box = target.getBoundingClientRect();\n\tif (box.left < frame.left) scroller.scrollBy({ left: box.left - frame.left - 8 });\n\telse if (box.right > frame.right) scroller.scrollBy({ left: box.right - frame.right + 8 });\n}\n\n/**\n * Tabs keep their width and scroll sideways once they no longer fit: the list never grows past its\n * container, edges fade where more tabs are hidden, and the active tab is scrolled into view.\n */\nfunction TabsList({ className, children, style, ...props }: React.ComponentProps<typeof TabsPrimitive.List>) {\n\tconst fade = useScrollFade<HTMLDivElement>();\n\t// The fade's ref and the one the consumer passes, merged once so React does not detach and attach them every render.\n\tconst ref = useMergedRefs(fade.ref, props.ref);\n\tconst { node: list, overflowing } = fade;\n\n\tReact.useEffect(() => {\n\t\tif (!list || !overflowing) return;\n\t\tconst revealActive = () => {\n\t\t\tconst active = list.querySelector<HTMLElement>('[data-active]');\n\t\t\tif (active) revealInline(list, active);\n\t\t};\n\t\t// The list only becomes a scroller once it overflows, so the active tab is revealed then, and again whenever\n\t\t// another tab becomes active.\n\t\trevealActive();\n\t\tconst observer = new MutationObserver(revealActive);\n\t\tobserver.observe(list, { subtree: true, attributes: true, attributeFilter: ['data-active'] });\n\t\treturn () => observer.disconnect();\n\t}, [list, overflowing]);\n\n\treturn (\n\t\t<TabsPrimitive.List\n\t\t\tdata-slot=\"tabs-list\"\n\t\t\tclassName={cn(\n\t\t\t\t'bg-muted text-muted-foreground/70 relative inline-flex w-fit max-w-full items-center justify-center rounded-md p-0.5',\n\t\t\t\t// Scroll only when needed, so a list that fits keeps its focus rings uncropped.\n\t\t\t\toverflowing && 'justify-start overflow-x-auto overscroll-x-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tstyle={fade.style ? { ...style, ...fade.style } : style}\n\t\t\t{...props}\n\t\t\tref={ref}\n\t\t>\n\t\t\t<TabsIndicator />\n\t\t\t{children}\n\t\t</TabsPrimitive.List>\n\t);\n}\n\n/**\n * Traveling active-tab pill — Base UI feeds it --active-tab-* CSS vars, so\n * transitioning left/top/width/height animates the slide between tabs.\n * TabsList renders one automatically before the triggers (whose `relative`\n * labels paint above it); exported for custom list compositions.\n */\nfunction TabsIndicator({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Indicator>) {\n\treturn (\n\t\t<TabsPrimitive.Indicator\n\t\t\tdata-slot=\"tabs-indicator\"\n\t\t\tclassName={cn(\n\t\t\t\t`bg-background absolute top-(--active-tab-top) left-(--active-tab-left) h-(--active-tab-height)\n\t\t\t\tw-(--active-tab-width) rounded-[calc(var(--radius-md)-2px)] shadow-xs transition-[left,top,width,height]\n\t\t\t\tduration-(--duration-moderate) ease-out motion-reduce:transition-none`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Tab>) {\n\treturn (\n\t\t<TabsPrimitive.Tab\n\t\t\tdata-slot=\"tabs-trigger\"\n\t\t\tclassName={cn(\n\t\t\t\t`hover:text-muted-foreground data-[active]:text-foreground\n\t\t\t\t\tfocus-visible:ring-ring/50 relative inline-flex min-h-10 min-w-10 shrink-0 items-center justify-center rounded-[calc(var(--radius-md)-2px)] px-3\n\t\t\t\t\ttext-sm font-medium whitespace-nowrap outline-none pointer-coarse:min-h-11 focus-visible:ring-[3px]\n\t\t\t\tdata-[disabled]:pointer-events-none data-[disabled]:opacity-64 [&_svg]:shrink-0`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Panel>) {\n\treturn <TabsPrimitive.Panel data-slot=\"tabs-content\" className={cn('min-w-0 flex-1 outline-none [overflow-wrap:break-word]', className)} {...props} />;\n}\n\nexport { Tabs, TabsContent, TabsIndicator, TabsList, TabsTrigger };\n"],"mappings":";;;;;;;;;;AASA,SAAS,KAAK,EAAE,WAAW,GAAG,SAA0D;CACvF,OAAO,oBAACA,OAAc,MAAf;EAAoB,aAAU;EAAO,WAAW,GAAG,uBAAuB,SAAS;EAAG,GAAI;CAAQ;AAC1G;;AAGA,SAAS,aAAa,UAAuB,QAAqB;CACjE,MAAM,QAAQ,SAAS,sBAAsB;CAC7C,MAAM,MAAM,OAAO,sBAAsB;
|
|
1
|
+
{"version":3,"file":"tabs.js","names":["TabsPrimitive"],"sources":["../../src/components/tabs.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Tabs as TabsPrimitive } from '@base-ui/react/tabs';\n\nimport { useMergedRefs } from '../lib/compose-refs';\nimport { useScrollFade } from '../lib/use-scroll-fade';\nimport { cn } from '../lib/utils';\n\nfunction Tabs({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Root>) {\n\treturn <TabsPrimitive.Root data-slot=\"tabs\" className={cn('flex flex-col gap-2', className)} {...props} />;\n}\n\n/** Scrolls `scroller` along its inline axis just far enough to show `target`; the page never moves. */\nfunction revealInline(scroller: HTMLElement, target: HTMLElement) {\n\tconst frame = scroller.getBoundingClientRect();\n\tconst box = target.getBoundingClientRect();\n\t// A tab wider than the list shows its start, where the label begins, rather than its end.\n\tif (box.width >= frame.width) {\n\t\tconst rtl = getComputedStyle(scroller).direction === 'rtl';\n\t\tscroller.scrollBy({ left: rtl ? box.right - frame.right : box.left - frame.left });\n\t} else if (box.left < frame.left) scroller.scrollBy({ left: box.left - frame.left - 8 });\n\telse if (box.right > frame.right) scroller.scrollBy({ left: box.right - frame.right + 8 });\n}\n\n/**\n * Tabs keep their width and scroll sideways once they no longer fit: the list never grows past its\n * container, edges fade where more tabs are hidden, and the active tab is scrolled into view.\n */\nfunction TabsList({ className, children, style, ...props }: React.ComponentProps<typeof TabsPrimitive.List>) {\n\tconst fade = useScrollFade<HTMLDivElement>();\n\t// The fade's ref and the one the consumer passes, merged once so React does not detach and attach them every render.\n\tconst ref = useMergedRefs(fade.ref, props.ref);\n\tconst { node: list, overflowing } = fade;\n\n\tReact.useEffect(() => {\n\t\tif (!list || !overflowing) return;\n\t\tconst revealActive = () => {\n\t\t\tconst active = list.querySelector<HTMLElement>('[data-active]');\n\t\t\tif (active) revealInline(list, active);\n\t\t};\n\t\t// The list only becomes a scroller once it overflows, so the active tab is revealed then, and again whenever\n\t\t// another tab becomes active.\n\t\trevealActive();\n\t\tconst observer = new MutationObserver(revealActive);\n\t\tobserver.observe(list, { subtree: true, attributes: true, attributeFilter: ['data-active'] });\n\t\treturn () => observer.disconnect();\n\t}, [list, overflowing]);\n\n\treturn (\n\t\t<TabsPrimitive.List\n\t\t\tdata-slot=\"tabs-list\"\n\t\t\tclassName={cn(\n\t\t\t\t'bg-muted text-muted-foreground/70 relative inline-flex w-fit max-w-full items-center justify-center rounded-md p-0.5',\n\t\t\t\t// Scroll only when needed, so a list that fits keeps its focus rings uncropped.\n\t\t\t\t// Sideways only: a strip never scrolls vertically, and no bar takes height from the tabs.\n\t\t\t\toverflowing && 'justify-start overflow-x-auto overflow-y-hidden overscroll-x-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tstyle={fade.style ? { ...style, ...fade.style } : style}\n\t\t\t{...props}\n\t\t\tref={ref}\n\t\t>\n\t\t\t<TabsIndicator />\n\t\t\t{children}\n\t\t</TabsPrimitive.List>\n\t);\n}\n\n/**\n * Traveling active-tab pill — Base UI feeds it --active-tab-* CSS vars, so\n * transitioning left/top/width/height animates the slide between tabs.\n * TabsList renders one automatically before the triggers (whose `relative`\n * labels paint above it); exported for custom list compositions.\n */\nfunction TabsIndicator({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Indicator>) {\n\treturn (\n\t\t<TabsPrimitive.Indicator\n\t\t\tdata-slot=\"tabs-indicator\"\n\t\t\tclassName={cn(\n\t\t\t\t`bg-background absolute top-(--active-tab-top) left-(--active-tab-left) h-(--active-tab-height)\n\t\t\t\tw-(--active-tab-width) rounded-[calc(var(--radius-md)-2px)] shadow-xs transition-[left,top,width,height]\n\t\t\t\tduration-(--duration-moderate) ease-out motion-reduce:transition-none`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Tab>) {\n\treturn (\n\t\t<TabsPrimitive.Tab\n\t\t\tdata-slot=\"tabs-trigger\"\n\t\t\tclassName={cn(\n\t\t\t\t`hover:text-muted-foreground data-[active]:text-foreground\n\t\t\t\t\tfocus-visible:ring-ring/50 relative inline-flex min-h-10 min-w-10 shrink-0 items-center justify-center rounded-[calc(var(--radius-md)-2px)] px-3\n\t\t\t\t\ttext-sm font-medium whitespace-nowrap outline-none pointer-coarse:min-h-11 focus-visible:ring-[3px]\n\t\t\t\tdata-[disabled]:pointer-events-none data-[disabled]:opacity-64 [&_svg]:shrink-0`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Panel>) {\n\treturn <TabsPrimitive.Panel data-slot=\"tabs-content\" className={cn('min-w-0 flex-1 outline-none [overflow-wrap:break-word]', className)} {...props} />;\n}\n\nexport { Tabs, TabsContent, TabsIndicator, TabsList, TabsTrigger };\n"],"mappings":";;;;;;;;;;AASA,SAAS,KAAK,EAAE,WAAW,GAAG,SAA0D;CACvF,OAAO,oBAACA,OAAc,MAAf;EAAoB,aAAU;EAAO,WAAW,GAAG,uBAAuB,SAAS;EAAG,GAAI;CAAQ;AAC1G;;AAGA,SAAS,aAAa,UAAuB,QAAqB;CACjE,MAAM,QAAQ,SAAS,sBAAsB;CAC7C,MAAM,MAAM,OAAO,sBAAsB;CAEzC,IAAI,IAAI,SAAS,MAAM,OAAO;EAC7B,MAAM,MAAM,iBAAiB,QAAQ,CAAC,CAAC,cAAc;EACrD,SAAS,SAAS,EAAE,MAAM,MAAM,IAAI,QAAQ,MAAM,QAAQ,IAAI,OAAO,MAAM,KAAK,CAAC;CAClF,OAAO,IAAI,IAAI,OAAO,MAAM,MAAM,SAAS,SAAS,EAAE,MAAM,IAAI,OAAO,MAAM,OAAO,EAAE,CAAC;MAClF,IAAI,IAAI,QAAQ,MAAM,OAAO,SAAS,SAAS,EAAE,MAAM,IAAI,QAAQ,MAAM,QAAQ,EAAE,CAAC;AAC1F;;;;;AAMA,SAAS,SAAS,EAAE,WAAW,UAAU,OAAO,GAAG,SAA0D;CAC5G,MAAM,OAAO,cAA8B;CAE3C,MAAM,MAAM,cAAc,KAAK,KAAK,MAAM,GAAG;CAC7C,MAAM,EAAE,MAAM,MAAM,gBAAgB;CAEpC,QAAM,gBAAgB;EACrB,IAAI,CAAC,QAAQ,CAAC,aAAa;EAC3B,MAAM,qBAAqB;GAC1B,MAAM,SAAS,KAAK,cAA2B,eAAe;GAC9D,IAAI,QAAQ,aAAa,MAAM,MAAM;EACtC;EAGA,aAAa;EACb,MAAM,WAAW,IAAI,iBAAiB,YAAY;EAClD,SAAS,QAAQ,MAAM;GAAE,SAAS;GAAM,YAAY;GAAM,iBAAiB,CAAC,aAAa;EAAE,CAAC;EAC5F,aAAa,SAAS,WAAW;CAClC,GAAG,CAAC,MAAM,WAAW,CAAC;CAEtB,OACC,qBAACA,OAAc,MAAf;EACC,aAAU;EACV,WAAW,GACV,wHAGA,eAAe,6HACf,SACD;EACA,OAAO,KAAK,QAAQ;GAAE,GAAG;GAAO,GAAG,KAAK;EAAM,IAAI;EAClD,GAAI;EACC;YAXN,CAaC,oBAAC,eAAD,CAAgB,IACf,QACkB;;AAEtB;;;;;;;AAQA,SAAS,cAAc,EAAE,WAAW,GAAG,SAA+D;CACrG,OACC,oBAACA,OAAc,WAAf;EACC,aAAU;EACV,WAAW,GACV;;4EAGA,SACD;EACA,GAAI;CACJ;AAEH;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAAyD;CAC7F,OACC,oBAACA,OAAc,KAAf;EACC,aAAU;EACV,WAAW,GACV;;;sFAIA,SACD;EACA,GAAI;CACJ;AAEH;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAA2D;CAC/F,OAAO,oBAACA,OAAc,OAAf;EAAqB,aAAU;EAAe,WAAW,GAAG,0DAA0D,SAAS;EAAG,GAAI;CAAQ;AACtJ"}
|
|
@@ -5,7 +5,7 @@ const require_rolldown_runtime = require('../rolldown-runtime-D_qnwXdH.cjs');
|
|
|
5
5
|
const require_utils = require('../utils-CzTQ3-VI.cjs');
|
|
6
6
|
const require_text_runs = require('../text-runs-CdmlS5C7.cjs');
|
|
7
7
|
const require_components_toggle = require('./toggle.cjs');
|
|
8
|
-
const require_fluid_highlight = require('../fluid-highlight-
|
|
8
|
+
const require_fluid_highlight = require('../fluid-highlight-YWFRZXsw.cjs');
|
|
9
9
|
let react = require("react");
|
|
10
10
|
react = require_rolldown_runtime.__toESM(react, 1);
|
|
11
11
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { t as cn } from "../utils-BkMLyah9.js";
|
|
4
4
|
import { t as truncateTextRuns } from "../text-runs-DqcEO8L_.js";
|
|
5
5
|
import { toggleVariants } from "./toggle.js";
|
|
6
|
-
import { t as FluidHighlight } from "../fluid-highlight-
|
|
6
|
+
import { t as FluidHighlight } from "../fluid-highlight-CNELHV8o.js";
|
|
7
7
|
import * as React$1 from "react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { Toggle } from "@base-ui/react/toggle";
|
|
@@ -4,7 +4,7 @@ import { Toggle as Toggle$1 } from "@base-ui/react/toggle";
|
|
|
4
4
|
//#region src/components/toggle.d.ts
|
|
5
5
|
declare const toggleVariants: (props?: ({
|
|
6
6
|
variant?: "default" | "outline" | null | undefined;
|
|
7
|
-
size?: "default" | "
|
|
7
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
8
8
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
9
|
type ToggleProps = React$1.ComponentProps<typeof Toggle$1> & VariantProps<typeof toggleVariants>;
|
|
10
10
|
declare function Toggle({ className, variant, size, children, ...props }: ToggleProps): React$1.JSX.Element;
|
|
@@ -4,7 +4,7 @@ import { Toggle as Toggle$1 } from "@base-ui/react/toggle";
|
|
|
4
4
|
//#region src/components/toggle.d.ts
|
|
5
5
|
declare const toggleVariants: (props?: ({
|
|
6
6
|
variant?: "default" | "outline" | null | undefined;
|
|
7
|
-
size?: "default" | "
|
|
7
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
8
8
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
9
|
type ToggleProps = React$1.ComponentProps<typeof Toggle$1> & VariantProps<typeof toggleVariants>;
|
|
10
10
|
declare function Toggle({ className, variant, size, children, ...props }: ToggleProps): React$1.JSX.Element;
|
|
@@ -103,14 +103,25 @@ const ICON_BUTTON_SIZE = {
|
|
|
103
103
|
lg: "size-8"
|
|
104
104
|
};
|
|
105
105
|
/**
|
|
106
|
+
* The look of `TooltipIconButton`, for icon-only controls that render their own
|
|
107
|
+
* element, such as a menu trigger. Hover state is instant; press scales to 0.96.
|
|
108
|
+
*/
|
|
109
|
+
function iconButtonClass({ variant = "ghost", size = "md", extendHitArea = true, menu = false } = {}) {
|
|
110
|
+
return require_utils.cn("grid shrink-0 cursor-pointer place-items-center rounded-md disabled:cursor-not-allowed disabled:opacity-40", ICON_BUTTON_VARIANT[variant], ICON_BUTTON_SIZE[size], pressClass, focusRingClass, extendHitArea && "relative before:absolute before:-inset-2 before:content-[''] pointer-coarse:before:-inset-2.5", menu && "data-popup-open:bg-overlay-hover");
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
106
113
|
* Icon-only button with a matching tooltip and accessible name. Hover state is
|
|
107
114
|
* instant; press scales to 0.96.
|
|
108
115
|
*/
|
|
109
|
-
function TooltipIconButton({ label, side = "top", variant
|
|
116
|
+
function TooltipIconButton({ label, side = "top", variant, size, extendHitArea, className, children, ...props }) {
|
|
110
117
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_tooltip.Tooltip, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_tooltip.TooltipTrigger, { render: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
111
118
|
type: "button",
|
|
112
119
|
"aria-label": label,
|
|
113
|
-
className: require_utils.cn(
|
|
120
|
+
className: require_utils.cn(iconButtonClass({
|
|
121
|
+
variant,
|
|
122
|
+
size,
|
|
123
|
+
extendHitArea
|
|
124
|
+
}), className),
|
|
114
125
|
...props,
|
|
115
126
|
children
|
|
116
127
|
}) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_tooltip.TooltipContent, {
|
|
@@ -131,8 +142,11 @@ const TONE_COLOR = {
|
|
|
131
142
|
/**
|
|
132
143
|
* Tone fills mixed from `--tone`. On a white page the fill carries the colour and the
|
|
133
144
|
* border only defines the edge; dark keeps a fainter fill under a stronger border.
|
|
145
|
+
* The light edge is translucent so it sits on any row tint, and where relative colours
|
|
146
|
+
* work its chroma is capped first: a translucent edge of a tone outside sRGB (the info
|
|
147
|
+
* blue) otherwise renders yellow at the rounded corners.
|
|
134
148
|
*/
|
|
135
|
-
const toneBadgeClass = require_utils.cn("
|
|
149
|
+
const toneBadgeClass = require_utils.cn("[--tone-edge:color-mix(in_oklab,var(--tone)_25%,transparent)]", "supports-[color:oklch(from_red_l_c_h)]:[--tone-edge:color-mix(in_oklab,oklch(from_var(--tone)_l_min(c,0.12)_h)_25%,transparent)]", "border-(--tone-edge) bg-[color-mix(in_oklab,var(--tone)_14%,transparent)]", "text-[color-mix(in_oklab,var(--tone),var(--foreground)_32%)]", "dark:border-[color-mix(in_oklab,var(--tone)_35%,transparent)] dark:bg-[color-mix(in_oklab,var(--tone)_9%,transparent)]");
|
|
136
150
|
/** Small tinted label. Clickable when `onClick` is set. */
|
|
137
151
|
function ToneBadge({ tone, children, onClick, className }) {
|
|
138
152
|
const color = tone === "neutral" ? null : TONE_COLOR[tone];
|
|
@@ -223,7 +237,7 @@ function ViewHeader({ icon: Icon, title, children, divider = true }) {
|
|
|
223
237
|
function ViewFrame({ icon, title, actions, label, maxWidth = "max-w-6xl", className, children }) {
|
|
224
238
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
225
239
|
"aria-label": label ?? (typeof title === "string" ? title : void 0),
|
|
226
|
-
className: "flex min-w-0 flex-1 flex-col",
|
|
240
|
+
className: "flex min-h-0 min-w-0 flex-1 flex-col",
|
|
227
241
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ViewHeader, {
|
|
228
242
|
icon,
|
|
229
243
|
title,
|
|
@@ -957,29 +971,44 @@ function SwitcherTrigger({ label, name, glyph, collapsed }) {
|
|
|
957
971
|
//#endregion
|
|
958
972
|
//#region src/components/workspace-kit/nav.tsx
|
|
959
973
|
const ROW = require_utils.cn("relative flex h-8 cursor-pointer items-center rounded-md text-start text-sm pointer-coarse:h-10", focusRingClass);
|
|
960
|
-
/**
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
974
|
+
/**
|
|
975
|
+
* Full-width row with a label, or a centred square matching the rail's icon
|
|
976
|
+
* buttons. A rail badge stretches the square into a capsule: the glyph, then
|
|
977
|
+
* the word, filling the rail's width so the word never overhangs the fill.
|
|
978
|
+
*/
|
|
979
|
+
const rowShape = (collapsed, badge = false) => collapsed ? badge ? "h-auto w-full shrink-0 flex-col justify-center gap-0.5 py-1.5" : "size-8 shrink-0 justify-center pointer-coarse:size-10" : "w-full gap-2 px-2";
|
|
980
|
+
/**
|
|
981
|
+
* Labels a rail control with a tooltip while the sidebar is collapsed. A `tip`
|
|
982
|
+
* adds a line under the label there, and is the whole tooltip when expanded.
|
|
983
|
+
*/
|
|
984
|
+
function RailTip({ label, collapsed, tip, children }) {
|
|
985
|
+
if (!collapsed && !tip) return children;
|
|
965
986
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_tooltip.Tooltip, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_tooltip.TooltipTrigger, { render: children }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_tooltip.TooltipContent, {
|
|
966
987
|
side: "right",
|
|
967
|
-
children: label
|
|
988
|
+
children: collapsed ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [label, tip ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
989
|
+
className: "block text-pretty text-muted-foreground",
|
|
990
|
+
children: tip
|
|
991
|
+
}) : null] }) : tip
|
|
968
992
|
})] });
|
|
969
993
|
}
|
|
970
994
|
/**
|
|
971
995
|
* One sidebar row. Focus reads through weight and a tinted fill, never a
|
|
972
996
|
* coloured dot; hover is instant because rows are clicked constantly.
|
|
973
997
|
*/
|
|
974
|
-
function NavRow({ label, collapsed, active, leading, labelNode, trailing, muted, disabled, busy, onClick, href, renderLink }) {
|
|
975
|
-
const
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
998
|
+
function NavRow({ label, collapsed, active, leading, labelNode, trailing, tip, railBadge, muted, disabled, busy, onClick, href, renderLink }) {
|
|
999
|
+
const badge = collapsed ? railBadge : null;
|
|
1000
|
+
const content = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
1001
|
+
leading,
|
|
1002
|
+
badge,
|
|
1003
|
+
collapsed ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1004
|
+
title: tip ? void 0 : label,
|
|
1005
|
+
className: "min-w-0 flex-1 truncate",
|
|
1006
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("bdi", { children: labelNode ?? label })
|
|
1007
|
+
}), busy ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Loader2, {
|
|
1008
|
+
"aria-hidden": "true",
|
|
1009
|
+
className: "size-3.5 shrink-0 text-muted-foreground motion-safe:animate-spin"
|
|
1010
|
+
}) : trailing] })
|
|
1011
|
+
] });
|
|
983
1012
|
const tone = active ? "bg-sidebar-accent font-medium text-foreground" : muted ? "text-muted-foreground" : "text-sidebar-foreground";
|
|
984
1013
|
const shared = {
|
|
985
1014
|
"aria-label": collapsed ? label : void 0,
|
|
@@ -996,7 +1025,7 @@ function NavRow({ label, collapsed, active, leading, labelNode, trailing, muted,
|
|
|
996
1025
|
if (disabled) event.preventDefault();
|
|
997
1026
|
else onClick?.();
|
|
998
1027
|
},
|
|
999
|
-
className: require_utils.cn(ROW, rowShape(collapsed), "no-underline", disabled ? "cursor-not-allowed opacity-50" : require_utils.cn("hover:bg-overlay-hover", muted && !active && "hover:text-foreground"), tone),
|
|
1028
|
+
className: require_utils.cn(ROW, rowShape(collapsed, Boolean(badge)), "no-underline", disabled ? "cursor-not-allowed opacity-50" : require_utils.cn("hover:bg-overlay-hover", muted && !active && "hover:text-foreground"), tone),
|
|
1000
1029
|
children: content
|
|
1001
1030
|
};
|
|
1002
1031
|
row = renderLink ? renderLink(props) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", { ...props });
|
|
@@ -1005,7 +1034,7 @@ function NavRow({ label, collapsed, active, leading, labelNode, trailing, muted,
|
|
|
1005
1034
|
...shared,
|
|
1006
1035
|
disabled,
|
|
1007
1036
|
onClick,
|
|
1008
|
-
className: require_utils.cn(ROW, rowShape(collapsed), "disabled:cursor-not-allowed disabled:opacity-50", active ? tone : require_utils.cn("enabled:hover:bg-overlay-hover", tone, muted && "enabled:hover:text-foreground")),
|
|
1037
|
+
className: require_utils.cn(ROW, rowShape(collapsed, Boolean(badge)), "disabled:cursor-not-allowed disabled:opacity-50", active ? tone : require_utils.cn("enabled:hover:bg-overlay-hover", tone, muted && "enabled:hover:text-foreground")),
|
|
1009
1038
|
children: content
|
|
1010
1039
|
});
|
|
1011
1040
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
|
|
@@ -1013,6 +1042,7 @@ function NavRow({ label, collapsed, active, leading, labelNode, trailing, muted,
|
|
|
1013
1042
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RailTip, {
|
|
1014
1043
|
label,
|
|
1015
1044
|
collapsed,
|
|
1045
|
+
tip,
|
|
1016
1046
|
children: row
|
|
1017
1047
|
})
|
|
1018
1048
|
});
|