@tryghost/shade 0.1.0-alpha.17 → 0.1.0-alpha.19
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/es/components/patterns/gh-chart.js +4 -2
- package/es/components/patterns/gh-chart.js.map +1 -1
- package/es/components/ui/avatar.js +8 -4
- package/es/components/ui/avatar.js.map +1 -1
- package/es/components/ui/badge-variants.js +1 -1
- package/es/components/ui/badge-variants.js.map +1 -1
- package/es/components/ui/banner-variants.js +4 -4
- package/es/components/ui/banner-variants.js.map +1 -1
- package/es/components/ui/button-variants.js +1 -1
- package/es/components/ui/button-variants.js.map +1 -1
- package/es/components/ui/floating-sidebar.js +4 -4
- package/es/components/ui/floating-sidebar.js.map +1 -1
- package/es/components/ui/select-variants.js +1 -1
- package/es/components/ui/select-variants.js.map +1 -1
- package/es/components/ui/sticky-footer.js +1 -1
- package/es/components/ui/sticky-footer.js.map +1 -1
- package/es/components/ui/toast.js +2 -0
- package/es/components.js +2 -1
- package/es/index.js +2 -1
- package/es/lib/ds-utils.js +17 -3
- package/es/lib/ds-utils.js.map +1 -1
- package/es/lib/utils.js +2 -2
- package/es/utils.js +2 -2
- package/package.json +1 -1
- package/tailwind.theme.css +201 -179
- package/theme-variables.css +286 -31
- package/types/components/patterns/gh-chart.d.ts.map +1 -1
- package/types/components/ui/avatar.d.ts.map +1 -1
- package/types/components/ui/toast.d.ts +2 -0
- package/types/components/ui/toast.d.ts.map +1 -0
- package/types/components.d.ts +1 -0
- package/types/components.d.ts.map +1 -1
- package/types/lib/ds-utils.d.ts +2 -0
- package/types/lib/ds-utils.d.ts.map +1 -1
- package/types/utils.d.ts +1 -1
- package/types/utils.d.ts.map +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { calculateYAxisWidth, cn, formatNumber, getYRange } from "../../lib/ds-utils.js";
|
|
2
2
|
import { formatDisplayDateWithRange } from "../../lib/date-utils.js";
|
|
3
|
+
import { useShade } from "../../providers/shade-context.js";
|
|
3
4
|
import { AlignedAxisTick, ChartContainer, ChartTooltip } from "../ui/chart.js";
|
|
4
5
|
import { Area, AreaChart, CartesianGrid, XAxis, YAxis } from "recharts";
|
|
5
6
|
import { TrendingDown, TrendingUp } from "lucide-react";
|
|
@@ -50,6 +51,7 @@ var GhCustomTooltipContent = ({ active, payload, range, showHours, color }) => {
|
|
|
50
51
|
});
|
|
51
52
|
};
|
|
52
53
|
var GhAreaChart = ({ data, range, yAxisRange, color = "var(--chart-blue)", id, className, syncId, allowDataOverflow = false, showYAxisValues = true, showHorizontalLines = true, dataFormatter = formatNumber, showHours = false, tooltipContent }) => {
|
|
54
|
+
const { admin7Design } = useShade();
|
|
53
55
|
const yRange = yAxisRange || [getYRange(data).min, getYRange(data).max];
|
|
54
56
|
const chartConfig = { value: { label: data[0]?.label || "Value" } };
|
|
55
57
|
const baseValue = yRange[0];
|
|
@@ -126,11 +128,11 @@ var GhAreaChart = ({ data, range, yAxisRange, color = "var(--chart-blue)", id, c
|
|
|
126
128
|
children: [/* @__PURE__ */ jsx("stop", {
|
|
127
129
|
offset: "5%",
|
|
128
130
|
stopColor: color,
|
|
129
|
-
stopOpacity: .8
|
|
131
|
+
stopOpacity: admin7Design ? .5 : .8
|
|
130
132
|
}), /* @__PURE__ */ jsx("stop", {
|
|
131
133
|
offset: "95%",
|
|
132
134
|
stopColor: color,
|
|
133
|
-
stopOpacity: .1
|
|
135
|
+
stopOpacity: admin7Design ? .5 : .1
|
|
134
136
|
})]
|
|
135
137
|
}) }),
|
|
136
138
|
/* @__PURE__ */ jsx(Area, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gh-chart.js","names":[],"sources":["../../../src/components/patterns/gh-chart.tsx"],"sourcesContent":["import {\n calculateYAxisWidth,\n cn,\n formatDisplayDateWithRange,\n formatNumber,\n getYRange,\n} from '@/lib/utils';\nimport React from 'react';\nimport { AlignedAxisTick, ChartConfig, ChartContainer, ChartTooltip } from '@/components/ui/chart';\nimport { Area, AreaChart, CartesianGrid, XAxis, YAxis } from 'recharts';\nimport { TrendingDown, TrendingUp } from 'lucide-react';\n\n// A Ghost specific charts for analytics re-using ShadCN/UI and Recharts components\n\ninterface TooltipPayload {\n value: number;\n payload: {\n date?: string;\n formattedValue?: string;\n label?: string;\n diffValue?: null | number;\n formattedDiffValue?: null | string;\n };\n}\n\ninterface TooltipProps {\n active?: boolean;\n payload?: TooltipPayload[];\n range?: number;\n showHours?: boolean;\n color?: string;\n}\n\nconst GhCustomTooltipContent = ({ active, payload, range, showHours, color }: TooltipProps) => {\n if (!active || !payload?.length) {\n return null;\n }\n\n const { date, formattedValue, label, diffValue, formattedDiffValue } = payload[0].payload;\n const displayValue = formattedValue || payload[0].value;\n\n return (\n <div className=\"min-w-[120px] rounded-lg border bg-background px-3 py-2 shadow-lg\">\n {date && (\n <div className=\"text-sm text-foreground\">\n {formatDisplayDateWithRange(date, range || 0, showHours)}\n </div>\n )}\n <div className=\"flex items-start gap-2\">\n <span\n className=\"mt-1.5 inline-block size-2 rounded-full opacity-50\"\n style={{ backgroundColor: color || 'var(--chart-blue)' }}\n ></span>\n <div className=\"flex grow items-start justify-between gap-5\">\n {label && <div className=\"text-sm text-muted-foreground\">{label}</div>}\n <div className=\"flex flex-col items-end font-mono font-medium\">\n {displayValue}\n\n {diffValue ? (\n diffValue < 0 && (\n <div className=\"flex items-center gap-0.5 text-state-danger\">\n <TrendingDown size={14} strokeWidth={1.5} />\n <span>{formattedDiffValue}</span>\n </div>\n )\n ) : (\n <></>\n )}\n {diffValue ? (\n diffValue > 0 && (\n <div className=\"flex items-center gap-0.5 text-state-success\">\n <TrendingUp size={14} strokeWidth={1.5} />\n <span>{formattedDiffValue}</span>\n </div>\n )\n ) : (\n <></>\n )}\n {/* {diffValue !== undefined ? diffValue === 0 && (\n <span>—</span>\n ) : <></>} */}\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nexport type GhAreaChartDataItem = {\n date: string;\n value: number;\n formattedValue: string;\n label: string;\n};\n\ninterface GhAreaChartProps {\n data: GhAreaChartDataItem[];\n range: number;\n yAxisRange?: [number, number];\n color?: string;\n id: string;\n className?: string;\n syncId?: string;\n allowDataOverflow?: boolean;\n showYAxisValues?: boolean;\n showHorizontalLines?: boolean;\n dataFormatter?: (value: number) => string;\n showHours?: boolean;\n tooltipContent?: React.ReactElement;\n}\n\nconst GhAreaChart: React.FC<GhAreaChartProps> = ({\n data,\n range,\n yAxisRange,\n color = 'var(--chart-blue)',\n id,\n className,\n syncId,\n allowDataOverflow = false,\n showYAxisValues = true,\n showHorizontalLines = true,\n dataFormatter = formatNumber,\n showHours = false,\n tooltipContent,\n}) => {\n const yRange = yAxisRange || [getYRange(data).min, getYRange(data).max];\n const chartConfig = {\n value: {\n label: data[0]?.label || 'Value',\n },\n } satisfies ChartConfig;\n\n // Use yRange as domain and set baseValue to the minimum\n const baseValue = yRange[0];\n\n // Calculate midpoint and create ticks array\n const midValue = (yRange[0] + yRange[1]) / 2;\n const isWholeMid = Number.isInteger(midValue);\n const yTicks = isWholeMid ? [yRange[0], midValue, yRange[1]] : yRange;\n\n const xTickHoursOnly = showHours && range === 1;\n const xTicks = data.length > 0 ? [...new Set([data[0].date, data[data.length - 1].date])] : [];\n\n return (\n <ChartContainer className={cn('w-full', className)} config={chartConfig}>\n <AreaChart\n data={data}\n margin={{\n left: 4,\n right: 4,\n top: showHorizontalLines ? 24 : 4,\n }}\n syncId={syncId}\n >\n <CartesianGrid horizontal={showHorizontalLines} stroke=\"var(--border)\" vertical={false} />\n <XAxis\n axisLine={{ stroke: 'var(--border)', strokeWidth: 1 }}\n dataKey=\"date\"\n interval={0}\n tick={(props) => (\n <AlignedAxisTick\n {...props}\n formatter={(value) =>\n formatDisplayDateWithRange(String(value), range, showHours, xTickHoursOnly)\n }\n textAnchor={xTicks.length === 1 ? 'middle' : undefined}\n />\n )}\n tickFormatter={(value) => formatDisplayDateWithRange(String(value), range, showHours)}\n tickLine={false}\n tickMargin={10}\n ticks={xTicks}\n />\n <YAxis\n allowDataOverflow={allowDataOverflow}\n axisLine={false}\n domain={allowDataOverflow ? undefined : yRange}\n scale=\"linear\"\n tickFormatter={(value: number) => {\n return dataFormatter(value);\n }}\n tickLine={false}\n ticks={yTicks}\n width={showYAxisValues ? calculateYAxisWidth(yRange, dataFormatter) : 0}\n />\n <ChartTooltip\n content={\n tooltipContent || (\n <GhCustomTooltipContent color={color} range={range} showHours={showHours} />\n )\n }\n cursor={true}\n isAnimationActive={false}\n position={{ y: 10 }}\n />\n <defs>\n <linearGradient id={`fillChart-${id}`} x1=\"0\" x2=\"0\" y1=\"0\" y2=\"1\">\n <stop offset=\"5%\" stopColor={color} stopOpacity={0.8} />\n <stop offset=\"95%\" stopColor={color} stopOpacity={0.1} />\n </linearGradient>\n </defs>\n <Area\n baseValue={baseValue}\n dataKey=\"value\"\n fill={`url(#fillChart-${id})`}\n fillOpacity={0.2}\n isAnimationActive={false}\n stroke={color}\n strokeWidth={1.5}\n type=\"linear\"\n />\n </AreaChart>\n </ChartContainer>\n );\n};\n\nexport { GhAreaChart, GhCustomTooltipContent };\n\nexport type { TooltipProps };\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"gh-chart.js","names":[],"sources":["../../../src/components/patterns/gh-chart.tsx"],"sourcesContent":["import {\n calculateYAxisWidth,\n cn,\n formatDisplayDateWithRange,\n formatNumber,\n getYRange,\n} from '@/lib/utils';\nimport React from 'react';\nimport { AlignedAxisTick, ChartConfig, ChartContainer, ChartTooltip } from '@/components/ui/chart';\nimport { Area, AreaChart, CartesianGrid, XAxis, YAxis } from 'recharts';\nimport { TrendingDown, TrendingUp } from 'lucide-react';\nimport { useShade } from '@/providers/shade-context';\n\n// A Ghost specific charts for analytics re-using ShadCN/UI and Recharts components\n\ninterface TooltipPayload {\n value: number;\n payload: {\n date?: string;\n formattedValue?: string;\n label?: string;\n diffValue?: null | number;\n formattedDiffValue?: null | string;\n };\n}\n\ninterface TooltipProps {\n active?: boolean;\n payload?: TooltipPayload[];\n range?: number;\n showHours?: boolean;\n color?: string;\n}\n\nconst GhCustomTooltipContent = ({ active, payload, range, showHours, color }: TooltipProps) => {\n if (!active || !payload?.length) {\n return null;\n }\n\n const { date, formattedValue, label, diffValue, formattedDiffValue } = payload[0].payload;\n const displayValue = formattedValue || payload[0].value;\n\n return (\n <div className=\"min-w-[120px] rounded-lg border bg-background px-3 py-2 shadow-lg\">\n {date && (\n <div className=\"text-sm text-foreground\">\n {formatDisplayDateWithRange(date, range || 0, showHours)}\n </div>\n )}\n <div className=\"flex items-start gap-2\">\n <span\n className=\"mt-1.5 inline-block size-2 rounded-full opacity-50\"\n style={{ backgroundColor: color || 'var(--chart-blue)' }}\n ></span>\n <div className=\"flex grow items-start justify-between gap-5\">\n {label && <div className=\"text-sm text-muted-foreground\">{label}</div>}\n <div className=\"flex flex-col items-end font-mono font-medium\">\n {displayValue}\n\n {diffValue ? (\n diffValue < 0 && (\n <div className=\"flex items-center gap-0.5 text-state-danger\">\n <TrendingDown size={14} strokeWidth={1.5} />\n <span>{formattedDiffValue}</span>\n </div>\n )\n ) : (\n <></>\n )}\n {diffValue ? (\n diffValue > 0 && (\n <div className=\"flex items-center gap-0.5 text-state-success\">\n <TrendingUp size={14} strokeWidth={1.5} />\n <span>{formattedDiffValue}</span>\n </div>\n )\n ) : (\n <></>\n )}\n {/* {diffValue !== undefined ? diffValue === 0 && (\n <span>—</span>\n ) : <></>} */}\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nexport type GhAreaChartDataItem = {\n date: string;\n value: number;\n formattedValue: string;\n label: string;\n};\n\ninterface GhAreaChartProps {\n data: GhAreaChartDataItem[];\n range: number;\n yAxisRange?: [number, number];\n color?: string;\n id: string;\n className?: string;\n syncId?: string;\n allowDataOverflow?: boolean;\n showYAxisValues?: boolean;\n showHorizontalLines?: boolean;\n dataFormatter?: (value: number) => string;\n showHours?: boolean;\n tooltipContent?: React.ReactElement;\n}\n\nconst GhAreaChart: React.FC<GhAreaChartProps> = ({\n data,\n range,\n yAxisRange,\n color = 'var(--chart-blue)',\n id,\n className,\n syncId,\n allowDataOverflow = false,\n showYAxisValues = true,\n showHorizontalLines = true,\n dataFormatter = formatNumber,\n showHours = false,\n tooltipContent,\n}) => {\n const { admin7Design } = useShade();\n const yRange = yAxisRange || [getYRange(data).min, getYRange(data).max];\n const chartConfig = {\n value: {\n label: data[0]?.label || 'Value',\n },\n } satisfies ChartConfig;\n\n // Use yRange as domain and set baseValue to the minimum\n const baseValue = yRange[0];\n\n // Calculate midpoint and create ticks array\n const midValue = (yRange[0] + yRange[1]) / 2;\n const isWholeMid = Number.isInteger(midValue);\n const yTicks = isWholeMid ? [yRange[0], midValue, yRange[1]] : yRange;\n\n const xTickHoursOnly = showHours && range === 1;\n const xTicks = data.length > 0 ? [...new Set([data[0].date, data[data.length - 1].date])] : [];\n\n return (\n <ChartContainer className={cn('w-full', className)} config={chartConfig}>\n <AreaChart\n data={data}\n margin={{\n left: 4,\n right: 4,\n top: showHorizontalLines ? 24 : 4,\n }}\n syncId={syncId}\n >\n <CartesianGrid horizontal={showHorizontalLines} stroke=\"var(--border)\" vertical={false} />\n <XAxis\n axisLine={{ stroke: 'var(--border)', strokeWidth: 1 }}\n dataKey=\"date\"\n interval={0}\n tick={(props) => (\n <AlignedAxisTick\n {...props}\n formatter={(value) =>\n formatDisplayDateWithRange(String(value), range, showHours, xTickHoursOnly)\n }\n textAnchor={xTicks.length === 1 ? 'middle' : undefined}\n />\n )}\n tickFormatter={(value) => formatDisplayDateWithRange(String(value), range, showHours)}\n tickLine={false}\n tickMargin={10}\n ticks={xTicks}\n />\n <YAxis\n allowDataOverflow={allowDataOverflow}\n axisLine={false}\n domain={allowDataOverflow ? undefined : yRange}\n scale=\"linear\"\n tickFormatter={(value: number) => {\n return dataFormatter(value);\n }}\n tickLine={false}\n ticks={yTicks}\n width={showYAxisValues ? calculateYAxisWidth(yRange, dataFormatter) : 0}\n />\n <ChartTooltip\n content={\n tooltipContent || (\n <GhCustomTooltipContent color={color} range={range} showHours={showHours} />\n )\n }\n cursor={true}\n isAnimationActive={false}\n position={{ y: 10 }}\n />\n <defs>\n <linearGradient id={`fillChart-${id}`} x1=\"0\" x2=\"0\" y1=\"0\" y2=\"1\">\n {/* admin7Design charts are flat: an even tint under the line. */}\n <stop offset=\"5%\" stopColor={color} stopOpacity={admin7Design ? 0.5 : 0.8} />\n <stop offset=\"95%\" stopColor={color} stopOpacity={admin7Design ? 0.5 : 0.1} />\n </linearGradient>\n </defs>\n <Area\n baseValue={baseValue}\n dataKey=\"value\"\n fill={`url(#fillChart-${id})`}\n fillOpacity={0.2}\n isAnimationActive={false}\n stroke={color}\n strokeWidth={1.5}\n type=\"linear\"\n />\n </AreaChart>\n </ChartContainer>\n );\n};\n\nexport { GhAreaChart, GhCustomTooltipContent };\n\nexport type { TooltipProps };\n"],"mappings":";;;;;;;;;AAkCA,IAAM,0BAA0B,EAAE,QAAQ,SAAS,OAAO,WAAW,YAA0B;CAC7F,IAAI,CAAC,UAAU,CAAC,SAAS,QACvB,OAAO;CAGT,MAAM,EAAE,MAAM,gBAAgB,OAAO,WAAW,uBAAuB,QAAQ,EAAE,CAAC;CAClF,MAAM,eAAe,kBAAkB,QAAQ,EAAE,CAAC;CAElD,OACE,qBAAC,OAAD;EAAK,WAAU;YAAf,CACG,QACC,oBAAC,OAAD;GAAK,WAAU;aACZ,2BAA2B,MAAM,SAAS,GAAG,SAAS;EACpD,CAAA,GAEP,qBAAC,OAAD;GAAK,WAAU;aAAf,CACE,oBAAC,QAAD;IACE,WAAU;IACV,OAAO,EAAE,iBAAiB,SAAS,oBAAoB;GAClD,CAAA,GACP,qBAAC,OAAD;IAAK,WAAU;cAAf,CACG,SAAS,oBAAC,OAAD;KAAK,WAAU;eAAiC;IAAW,CAAA,GACrE,qBAAC,OAAD;KAAK,WAAU;eAAf;MACG;MAEA,YACC,YAAY,KACV,qBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,oBAAC,cAAD;QAAc,M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
|
-
import { cn, stringToHslColor } from "../../lib/ds-utils.js";
|
|
1
|
+
import { cn, stringToHslColor, stringToTonalAvatarClasses } from "../../lib/ds-utils.js";
|
|
2
|
+
import { useShade } from "../../providers/shade-context.js";
|
|
2
3
|
import { User } from "lucide-react";
|
|
3
4
|
import * as React$1 from "react";
|
|
4
5
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -32,15 +33,18 @@ function ValidatedAvatarImage({ src }) {
|
|
|
32
33
|
});
|
|
33
34
|
}
|
|
34
35
|
var Avatar = React$1.forwardRef(({ className, children, src, initials, colorSeed, ...props }, ref) => {
|
|
36
|
+
const { admin7Design } = useShade();
|
|
35
37
|
const hasInitials = !!initials;
|
|
36
|
-
const
|
|
38
|
+
const seed = colorSeed || initials || "";
|
|
39
|
+
const tonal = hasInitials && admin7Design;
|
|
40
|
+
const bgColor = hasInitials && !tonal ? stringToHslColor(seed, "45", "55") : void 0;
|
|
37
41
|
return /* @__PURE__ */ jsx(AvatarPrimitive.Root, {
|
|
38
42
|
ref,
|
|
39
43
|
className: cn("relative flex size-8 shrink-0 overflow-hidden rounded-full", className),
|
|
40
44
|
...props,
|
|
41
45
|
children: children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(AvatarFallback, {
|
|
42
|
-
className: cn("text-xs text-muted-foreground md:text-sm [&_svg]:size-3 md:[&_svg]:size-4", hasInitials && "font-semibold text-white"),
|
|
43
|
-
style:
|
|
46
|
+
className: cn("text-xs text-muted-foreground md:text-sm [&_svg]:size-3 md:[&_svg]:size-4", hasInitials && "font-semibold", hasInitials && (tonal ? stringToTonalAvatarClasses(seed) : "text-white")),
|
|
47
|
+
style: bgColor ? { backgroundColor: bgColor } : void 0,
|
|
44
48
|
children: initials ?? /* @__PURE__ */ jsx(User, {})
|
|
45
49
|
}), src && /* @__PURE__ */ jsx(ValidatedAvatarImage, { src })] })
|
|
46
50
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.js","names":[],"sources":["../../../src/components/ui/avatar.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as AvatarPrimitive from '@radix-ui/react-avatar';\nimport { User } from 'lucide-react';\n\nimport { cn } from '@/lib/utils';\nimport { stringToHslColor } from '@/lib/ds-utils';\n\nconst AvatarImage = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Image>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Image\n ref={ref}\n className={cn('aspect-square size-full', className)}\n {...props}\n />\n));\nAvatarImage.displayName = AvatarPrimitive.Image.displayName;\n\nconst AvatarFallback = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Fallback>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Fallback\n ref={ref}\n className={cn(\n 'flex size-full items-center justify-center rounded-full bg-muted [&_svg]:size-4',\n className,\n )}\n {...props}\n />\n));\nAvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;\n\n// Gravatar's `d=blank` parameter returns a 1×1 transparent PNG when no avatar\n// exists for the given email. The HTTP response is 200, so Radix's AvatarImage\n// would treat it as a valid image and hide the fallback. We render the image\n// ourselves and only reveal it once it loads with non-trivial dimensions.\nfunction ValidatedAvatarImage({ src }: { src: string }) {\n const [loaded, setLoaded] = React.useState(false);\n\n React.useEffect(() => {\n setLoaded(false);\n }, [src]);\n\n return (\n <img\n alt=\"\"\n className={cn('absolute inset-0 size-full object-cover', !loaded && 'invisible')}\n src={src}\n onLoad={(e) => {\n const { naturalWidth, naturalHeight } = e.currentTarget;\n if (naturalWidth > 1 && naturalHeight > 1) {\n setLoaded(true);\n }\n }}\n />\n );\n}\n\ninterface AvatarProps extends React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root> {\n src?: string | null;\n initials?: string | null;\n /**\n * Seeds the fallback background hue. Defaults to the initials, but callers\n * should pass the richer identity string they derived the initials from\n * (name/email) so distinct people keep distinct hues.\n */\n colorSeed?: string | null;\n}\n\nconst Avatar = React.forwardRef<React.ElementRef<typeof AvatarPrimitive.Root>, AvatarProps>(\n ({ className, children, src, initials, colorSeed, ...props }, ref) => {\n const hasInitials = !!initials;\n const bgColor = hasInitials ? stringToHslColor(
|
|
1
|
+
{"version":3,"file":"avatar.js","names":[],"sources":["../../../src/components/ui/avatar.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as AvatarPrimitive from '@radix-ui/react-avatar';\nimport { User } from 'lucide-react';\n\nimport { cn } from '@/lib/utils';\nimport { stringToHslColor, stringToTonalAvatarClasses } from '@/lib/ds-utils';\nimport { useShade } from '@/providers/shade-context';\n\nconst AvatarImage = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Image>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Image\n ref={ref}\n className={cn('aspect-square size-full', className)}\n {...props}\n />\n));\nAvatarImage.displayName = AvatarPrimitive.Image.displayName;\n\nconst AvatarFallback = React.forwardRef<\n React.ElementRef<typeof AvatarPrimitive.Fallback>,\n React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>\n>(({ className, ...props }, ref) => (\n <AvatarPrimitive.Fallback\n ref={ref}\n className={cn(\n 'flex size-full items-center justify-center rounded-full bg-muted [&_svg]:size-4',\n className,\n )}\n {...props}\n />\n));\nAvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;\n\n// Gravatar's `d=blank` parameter returns a 1×1 transparent PNG when no avatar\n// exists for the given email. The HTTP response is 200, so Radix's AvatarImage\n// would treat it as a valid image and hide the fallback. We render the image\n// ourselves and only reveal it once it loads with non-trivial dimensions.\nfunction ValidatedAvatarImage({ src }: { src: string }) {\n const [loaded, setLoaded] = React.useState(false);\n\n React.useEffect(() => {\n setLoaded(false);\n }, [src]);\n\n return (\n <img\n alt=\"\"\n className={cn('absolute inset-0 size-full object-cover', !loaded && 'invisible')}\n src={src}\n onLoad={(e) => {\n const { naturalWidth, naturalHeight } = e.currentTarget;\n if (naturalWidth > 1 && naturalHeight > 1) {\n setLoaded(true);\n }\n }}\n />\n );\n}\n\ninterface AvatarProps extends React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root> {\n src?: string | null;\n initials?: string | null;\n /**\n * Seeds the fallback background hue. Defaults to the initials, but callers\n * should pass the richer identity string they derived the initials from\n * (name/email) so distinct people keep distinct hues.\n */\n colorSeed?: string | null;\n}\n\nconst Avatar = React.forwardRef<React.ElementRef<typeof AvatarPrimitive.Root>, AvatarProps>(\n ({ className, children, src, initials, colorSeed, ...props }, ref) => {\n const { admin7Design } = useShade();\n const hasInitials = !!initials;\n const seed = colorSeed || initials || '';\n const tonal = hasInitials && admin7Design;\n const bgColor = hasInitials && !tonal ? stringToHslColor(seed, '45', '55') : undefined;\n\n return (\n <AvatarPrimitive.Root\n ref={ref}\n className={cn('relative flex size-8 shrink-0 overflow-hidden rounded-full', className)}\n {...props}\n >\n {children ?? (\n <>\n <AvatarFallback\n className={cn(\n 'text-xs text-muted-foreground md:text-sm [&_svg]:size-3 md:[&_svg]:size-4',\n hasInitials && 'font-semibold',\n hasInitials && (tonal ? stringToTonalAvatarClasses(seed) : 'text-white'),\n )}\n style={bgColor ? { backgroundColor: bgColor } : undefined}\n >\n {initials ?? <User />}\n </AvatarFallback>\n {src && <ValidatedAvatarImage src={src} />}\n </>\n )}\n </AvatarPrimitive.Root>\n );\n },\n);\nAvatar.displayName = AvatarPrimitive.Root.displayName;\n\nexport { Avatar, AvatarImage, AvatarFallback };\n"],"mappings":";;;;;;;AAQA,IAAM,cAAc,QAAM,YAGvB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,gBAAgB,OAAjB;CACO;CACL,WAAW,GAAG,2BAA2B,SAAS;CAClD,GAAI;AACL,CAAA,CACF;AACD,YAAY,cAAc,gBAAgB,MAAM;AAEhD,IAAM,iBAAiB,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,KAAK"}
|
|
@@ -7,7 +7,7 @@ var badgeVariants = cva("inline-flex items-center border font-semibold tracking-
|
|
|
7
7
|
secondary: "border-transparent bg-secondary text-secondary-foreground/70",
|
|
8
8
|
destructive: "border-transparent bg-destructive/20 text-destructive",
|
|
9
9
|
success: "border-transparent bg-green/20 text-green",
|
|
10
|
-
warning: "border-transparent bg-
|
|
10
|
+
warning: "border-transparent bg-badge-warning text-badge-warning-foreground",
|
|
11
11
|
outline: "text-foreground"
|
|
12
12
|
},
|
|
13
13
|
size: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge-variants.js","names":[],"sources":["../../../src/components/ui/badge-variants.ts"],"sourcesContent":["import { cva } from 'class-variance-authority';\n\nconst badgeVariants = cva(\n 'inline-flex items-center border font-semibold tracking-normal transition-colors focus:ring-2 focus:ring-focus-ring focus:ring-offset-2 focus:outline-hidden',\n {\n variants: {\n variant: {\n default: 'border-transparent bg-primary text-primary-foreground',\n secondary: 'border-transparent bg-secondary text-secondary-foreground/70',\n destructive: 'border-transparent bg-destructive/20 text-destructive',\n success: 'border-transparent bg-green/20 text-green',\n warning: 'border-transparent bg-
|
|
1
|
+
{"version":3,"file":"badge-variants.js","names":[],"sources":["../../../src/components/ui/badge-variants.ts"],"sourcesContent":["import { cva } from 'class-variance-authority';\n\nconst badgeVariants = cva(\n 'inline-flex items-center border font-semibold tracking-normal transition-colors focus:ring-2 focus:ring-focus-ring focus:ring-offset-2 focus:outline-hidden',\n {\n variants: {\n variant: {\n default: 'border-transparent bg-primary text-primary-foreground',\n secondary: 'border-transparent bg-secondary text-secondary-foreground/70',\n destructive: 'border-transparent bg-destructive/20 text-destructive',\n success: 'border-transparent bg-green/20 text-green',\n warning: 'border-transparent bg-badge-warning text-badge-warning-foreground',\n outline: 'text-foreground',\n },\n size: {\n default: 'h-4.5 px-1.5 text-xs',\n sm: 'h-5 px-2 text-sm',\n md: 'h-6 px-2.5 text-sm',\n },\n shape: {\n rounded: 'rounded-xs',\n pill: 'rounded-full',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n shape: 'pill',\n },\n },\n);\n\nexport { badgeVariants };\n"],"mappings":";;AAEA,IAAM,gBAAgB,IACpB,+JACA;CACE,UAAU;EACR,SAAS;GACP,SAAS;GACT,WAAW;GACX,aAAa;GACb,SAAS;GACT,SAAS;GACT,SAAS;EACX;EACA,MAAM;GACJ,SAAS;GACT,IAAI;GACJ,IAAI;EACN;EACA,OAAO;GACL,SAAS;GACT,MAAM;EACR;CACF;CACA,iBAAiB;EACf,SAAS;EACT,MAAM;EACN,OAAO;CACT;AACF,CACF"}
|
|
@@ -6,10 +6,10 @@ var bannerVariants = cva("relative block rounded-lg transition-all duration-300"
|
|
|
6
6
|
default: "border border-border-default bg-surface-panel shadow-sm hover:shadow-md",
|
|
7
7
|
gradient: [
|
|
8
8
|
"cursor-pointer bg-surface-elevated",
|
|
9
|
-
"shadow-[-7px_-
|
|
10
|
-
"dark:shadow-[-7px_-
|
|
11
|
-
"hover:shadow-[-7px_-
|
|
12
|
-
"dark:hover:shadow-[-7px_-
|
|
9
|
+
"shadow-[-7px_-6px_42px_8px_color-mix(in_oklab,var(--banner-glow-start)_28%,transparent),7px_6px_42px_8px_color-mix(in_oklab,var(--banner-glow-end)_32%,transparent)]",
|
|
10
|
+
"dark:shadow-[-7px_-6px_42px_8px_color-mix(in_oklab,var(--banner-glow-start)_36%,transparent),7px_6px_42px_8px_color-mix(in_oklab,var(--banner-glow-end)_38%,transparent)]",
|
|
11
|
+
"hover:shadow-[-7px_-4px_42px_10px_color-mix(in_oklab,var(--banner-glow-start)_38%,transparent),7px_8px_42px_10px_color-mix(in_oklab,var(--banner-glow-end)_42%,transparent)]",
|
|
12
|
+
"dark:hover:shadow-[-7px_-4px_42px_10px_color-mix(in_oklab,var(--banner-glow-start)_50%,transparent),7px_8px_42px_10px_color-mix(in_oklab,var(--banner-glow-end)_52%,transparent)]",
|
|
13
13
|
"hover:translate-y-[-2px] hover:scale-[1.01]"
|
|
14
14
|
],
|
|
15
15
|
info: "border border-state-info/40 bg-state-info/10",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"banner-variants.js","names":[],"sources":["../../../src/components/ui/banner-variants.ts"],"sourcesContent":["import { cva } from 'class-variance-authority';\n\nconst bannerVariants = cva('relative block rounded-lg transition-all duration-300', {\n variants: {\n variant: {\n default: 'border border-border-default bg-surface-panel shadow-sm hover:shadow-md',\n gradient: [\n 'cursor-pointer bg-surface-elevated',\n 'shadow-[-7px_-
|
|
1
|
+
{"version":3,"file":"banner-variants.js","names":[],"sources":["../../../src/components/ui/banner-variants.ts"],"sourcesContent":["import { cva } from 'class-variance-authority';\n\nconst bannerVariants = cva('relative block rounded-lg transition-all duration-300', {\n variants: {\n variant: {\n default: 'border border-border-default bg-surface-panel shadow-sm hover:shadow-md',\n gradient: [\n 'cursor-pointer bg-surface-elevated',\n 'shadow-[-7px_-6px_42px_8px_color-mix(in_oklab,var(--banner-glow-start)_28%,transparent),7px_6px_42px_8px_color-mix(in_oklab,var(--banner-glow-end)_32%,transparent)]',\n 'dark:shadow-[-7px_-6px_42px_8px_color-mix(in_oklab,var(--banner-glow-start)_36%,transparent),7px_6px_42px_8px_color-mix(in_oklab,var(--banner-glow-end)_38%,transparent)]',\n 'hover:shadow-[-7px_-4px_42px_10px_color-mix(in_oklab,var(--banner-glow-start)_38%,transparent),7px_8px_42px_10px_color-mix(in_oklab,var(--banner-glow-end)_42%,transparent)]',\n 'dark:hover:shadow-[-7px_-4px_42px_10px_color-mix(in_oklab,var(--banner-glow-start)_50%,transparent),7px_8px_42px_10px_color-mix(in_oklab,var(--banner-glow-end)_52%,transparent)]',\n 'hover:translate-y-[-2px] hover:scale-[1.01]',\n ],\n info: 'border border-state-info/40 bg-state-info/10',\n success: 'border border-state-success/40 bg-state-success/10',\n warning: 'border border-state-warning/40 bg-state-warning/10',\n destructive: 'border border-state-danger/20 bg-state-danger/10',\n },\n size: {\n sm: 'p-2 text-sm',\n md: 'p-3',\n lg: 'p-4',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'md',\n },\n});\n\nexport { bannerVariants };\n"],"mappings":";;AAEA,IAAM,iBAAiB,IAAI,yDAAyD;CAClF,UAAU;EACR,SAAS;GACP,SAAS;GACT,UAAU;IACR;IACA;IACA;IACA;IACA;IACA;GACF;GACA,MAAM;GACN,SAAS;GACT,SAAS;GACT,aAAa;EACf;EACA,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;CACF;CACA,iBAAiB;EACf,SAAS;EACT,MAAM;CACR;AACF,CAAC"}
|
|
@@ -87,7 +87,7 @@ var buttonVariants = cva("inline-flex items-center justify-center gap-1.5 text-c
|
|
|
87
87
|
},
|
|
88
88
|
{
|
|
89
89
|
variant: "outline",
|
|
90
|
-
className: "border-0 shadow-control-outline enabled:active:shadow-control-outline-pressed enabled:aria-expanded:shadow-control-outline-pressed enabled:aria-expanded:bg-button-
|
|
90
|
+
className: "border-0 shadow-control-outline enabled:active:shadow-control-outline-pressed enabled:aria-expanded:shadow-control-outline-pressed enabled:active:bg-button-pressed enabled:aria-expanded:bg-button-pressed"
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
93
|
size: "icon",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-variants.js","names":[],"sources":["../../../src/components/ui/button-variants.ts"],"sourcesContent":["import { cva } from 'class-variance-authority';\n\nconst buttonVariants = cva(\n 'inline-flex items-center justify-center gap-1.5 text-control whitespace-nowrap transition-colors focus-visible:ring-1 focus-visible:ring-focus-ring focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-[1.5px]',\n {\n variants: {\n variant: {\n default:\n 'bg-primary font-semibold text-primary-foreground hover:bg-primary/90 disabled:bg-control-disabled-surface disabled:text-muted-foreground/80 disabled:opacity-100',\n destructive:\n 'bg-destructive font-medium text-destructive-foreground hover:bg-destructive/90',\n outline:\n 'border border-control-border bg-transparent font-medium hover:bg-button-hover hover:text-accent-foreground',\n secondary: 'font-medium text-secondary-foreground',\n subtle: 'font-medium',\n ghost: 'font-medium hover:bg-accent hover:text-accent-foreground',\n 'destructive-ghost': 'font-medium text-destructive hover:text-destructive',\n link: 'font-medium text-primary underline-offset-4 hover:underline',\n dropdown:\n 'border border-control-border bg-transparent hover:bg-button-hover hover:text-accent-foreground',\n },\n size: {\n default: 'h-(--control-height) px-2.5 py-2',\n sm: 'h-7 px-3 text-sm! [&_svg]:size-3',\n lg: 'h-11 px-8 text-md font-semibold',\n icon: 'size-9',\n 'icon-sm': 'size-7 p-0 [&_svg]:size-3',\n },\n shape: {\n rounded: 'rounded-control',\n pill: 'rounded-full',\n },\n },\n compoundVariants: [\n { variant: 'secondary', className: 'bg-tab-active hover:bg-secondary' },\n {\n variant: 'destructive-ghost',\n className:\n 'hover:bg-destructive/10 enabled:active:bg-destructive/10 enabled:aria-expanded:bg-destructive/10',\n },\n {\n variant: 'subtle',\n className: 'hover:bg-accent hover:text-accent-foreground',\n },\n {\n variant: ['secondary', 'ghost', 'destructive-ghost', 'subtle'],\n className:\n 'enabled:active:shadow-control-pressed enabled:aria-expanded:shadow-control-pressed',\n },\n {\n variant: 'secondary',\n className: 'enabled:active:bg-secondary enabled:aria-expanded:bg-secondary',\n },\n {\n variant: ['ghost', 'subtle'],\n className:\n 'enabled:active:bg-accent enabled:aria-expanded:bg-accent enabled:aria-expanded:text-accent-foreground',\n },\n {\n variant: 'ghost',\n className:\n 'hover:bg-button-ghost-hover enabled:active:bg-button-ghost-hover enabled:aria-expanded:bg-button-ghost-hover',\n },\n {\n variant: 'default',\n size: ['default', 'sm', 'lg'],\n className: 'px-4',\n },\n {\n variant: [\n 'destructive',\n 'outline',\n 'secondary',\n 'ghost',\n 'destructive-ghost',\n 'dropdown',\n 'subtle',\n ],\n size: ['default', 'sm', 'lg'],\n className: 'px-3',\n },\n {\n variant: 'outline',\n className:\n 'border-0 shadow-control-outline enabled:active:shadow-control-outline-pressed enabled:aria-expanded:shadow-control-outline-pressed enabled:aria-expanded:bg-button-
|
|
1
|
+
{"version":3,"file":"button-variants.js","names":[],"sources":["../../../src/components/ui/button-variants.ts"],"sourcesContent":["import { cva } from 'class-variance-authority';\n\nconst buttonVariants = cva(\n 'inline-flex items-center justify-center gap-1.5 text-control whitespace-nowrap transition-colors focus-visible:ring-1 focus-visible:ring-focus-ring focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-[1.5px]',\n {\n variants: {\n variant: {\n default:\n 'bg-primary font-semibold text-primary-foreground hover:bg-primary/90 disabled:bg-control-disabled-surface disabled:text-muted-foreground/80 disabled:opacity-100',\n destructive:\n 'bg-destructive font-medium text-destructive-foreground hover:bg-destructive/90',\n outline:\n 'border border-control-border bg-transparent font-medium hover:bg-button-hover hover:text-accent-foreground',\n secondary: 'font-medium text-secondary-foreground',\n subtle: 'font-medium',\n ghost: 'font-medium hover:bg-accent hover:text-accent-foreground',\n 'destructive-ghost': 'font-medium text-destructive hover:text-destructive',\n link: 'font-medium text-primary underline-offset-4 hover:underline',\n dropdown:\n 'border border-control-border bg-transparent hover:bg-button-hover hover:text-accent-foreground',\n },\n size: {\n default: 'h-(--control-height) px-2.5 py-2',\n sm: 'h-7 px-3 text-sm! [&_svg]:size-3',\n lg: 'h-11 px-8 text-md font-semibold',\n icon: 'size-9',\n 'icon-sm': 'size-7 p-0 [&_svg]:size-3',\n },\n shape: {\n rounded: 'rounded-control',\n pill: 'rounded-full',\n },\n },\n compoundVariants: [\n { variant: 'secondary', className: 'bg-tab-active hover:bg-secondary' },\n {\n variant: 'destructive-ghost',\n className:\n 'hover:bg-destructive/10 enabled:active:bg-destructive/10 enabled:aria-expanded:bg-destructive/10',\n },\n {\n variant: 'subtle',\n className: 'hover:bg-accent hover:text-accent-foreground',\n },\n {\n variant: ['secondary', 'ghost', 'destructive-ghost', 'subtle'],\n className:\n 'enabled:active:shadow-control-pressed enabled:aria-expanded:shadow-control-pressed',\n },\n {\n variant: 'secondary',\n className: 'enabled:active:bg-secondary enabled:aria-expanded:bg-secondary',\n },\n {\n variant: ['ghost', 'subtle'],\n className:\n 'enabled:active:bg-accent enabled:aria-expanded:bg-accent enabled:aria-expanded:text-accent-foreground',\n },\n {\n variant: 'ghost',\n className:\n 'hover:bg-button-ghost-hover enabled:active:bg-button-ghost-hover enabled:aria-expanded:bg-button-ghost-hover',\n },\n {\n variant: 'default',\n size: ['default', 'sm', 'lg'],\n className: 'px-4',\n },\n {\n variant: [\n 'destructive',\n 'outline',\n 'secondary',\n 'ghost',\n 'destructive-ghost',\n 'dropdown',\n 'subtle',\n ],\n size: ['default', 'sm', 'lg'],\n className: 'px-3',\n },\n {\n variant: 'outline',\n className:\n 'border-0 shadow-control-outline enabled:active:shadow-control-outline-pressed enabled:aria-expanded:shadow-control-outline-pressed enabled:active:bg-button-pressed enabled:aria-expanded:bg-button-pressed',\n },\n {\n size: 'icon',\n className: 'size-(--control-height) aspect-square p-0',\n },\n ],\n defaultVariants: {\n variant: 'default',\n size: 'default',\n shape: 'pill',\n },\n },\n);\n\nexport { buttonVariants };\n"],"mappings":";;AAEA,IAAM,iBAAiB,IACrB,wTACA;CACE,UAAU;EACR,SAAS;GACP,SACE;GACF,aACE;GACF,SACE;GACF,WAAW;GACX,QAAQ;GACR,OAAO;GACP,qBAAqB;GACrB,MAAM;GACN,UACE;EACJ;EACA,MAAM;GACJ,SAAS;GACT,IAAI;GACJ,IAAI;GACJ,MAAM;GACN,WAAW;EACb;EACA,OAAO;GACL,SAAS;GACT,MAAM;EACR;CACF;CACA,kBAAkB;EAChB;GAAE,SAAS;GAAa,WAAW;EAAmC;EACtE;GACE,SAAS;GACT,WACE;EACJ;EACA;GACE,SAAS;GACT,WAAW;EACb;EACA;GACE,SAAS;IAAC;IAAa;IAAS;IAAqB;GAAQ;GAC7D,WACE;EACJ;EACA;GACE,SAAS;GACT,WAAW;EACb;EACA;GACE,SAAS,CAAC,SAAS,QAAQ;GAC3B,WACE;EACJ;EACA;GACE,SAAS;GACT,WACE;EACJ;EACA;GACE,SAAS;GACT,MAAM;IAAC;IAAW;IAAM;GAAI;GAC5B,WAAW;EACb;EACA;GACE,SAAS;IACP;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,MAAM;IAAC;IAAW;IAAM;GAAI;GAC5B,WAAW;EACb;EACA;GACE,SAAS;GACT,WACE;EACJ;EACA;GACE,MAAM;GACN,WAAW;EACb;CACF;CACA,iBAAiB;EACf,SAAS;EACT,MAAM;EACN,OAAO;CACT;AACF,CACF"}
|
|
@@ -35,8 +35,8 @@ var SIZES = {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
var PADDING = 20;
|
|
38
|
-
var PIN_BUTTON_SIZE =
|
|
39
|
-
var PIN_BUTTON_RIGHT =
|
|
38
|
+
var PIN_BUTTON_SIZE = 32;
|
|
39
|
+
var PIN_BUTTON_RIGHT = 12;
|
|
40
40
|
var OFFSET_TOP = "var(--floating-sidebar-offset-top, 0px)";
|
|
41
41
|
var OFFSET_LEFT = "var(--floating-sidebar-offset-left, 0px)";
|
|
42
42
|
var PANEL_HEIGHT = `calc(100vh - ${OFFSET_TOP} - var(--floating-sidebar-offset-bottom, 0px) - ${INSET * 2}px)`;
|
|
@@ -412,7 +412,7 @@ var FloatingSidebar = React$1.forwardRef(({ pinned, onPinnedChange, pinLocked =
|
|
|
412
412
|
height: headerHeight,
|
|
413
413
|
gap: sizes.gap,
|
|
414
414
|
paddingLeft: PADDING,
|
|
415
|
-
paddingRight: onPinnedChange ?
|
|
415
|
+
paddingRight: onPinnedChange ? 44 + sizes.gap : PADDING
|
|
416
416
|
},
|
|
417
417
|
children: [/* @__PURE__ */ jsx("button", {
|
|
418
418
|
ref: triggerRef,
|
|
@@ -461,7 +461,7 @@ var FloatingSidebar = React$1.forwardRef(({ pinned, onPinnedChange, pinLocked =
|
|
|
461
461
|
ref: pinButtonRef,
|
|
462
462
|
"aria-hidden": pinLocked || void 0,
|
|
463
463
|
"aria-label": pinned ? unpinLabel : pinLabel,
|
|
464
|
-
className: cn("absolute z-10 flex size-
|
|
464
|
+
className: cn("absolute z-10 flex size-8 cursor-pointer items-center justify-center rounded-full text-muted-foreground transition-[opacity,color,background-color] duration-200 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:pointer-events-auto focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-focus-ring focus-visible:outline-hidden", open && !pinLocked ? "pointer-events-auto opacity-100 delay-75" : "pointer-events-none opacity-0"),
|
|
465
465
|
"data-slot": "floating-sidebar-pin",
|
|
466
466
|
style: {
|
|
467
467
|
top: (headerHeight - PIN_BUTTON_SIZE) / 2,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floating-sidebar.js","names":[],"sources":["../../../src/components/ui/floating-sidebar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Pin } from 'lucide-react';\n\nimport { cn } from '@/lib/utils';\nimport {\n FLOATING_SIDEBAR_CLOSED_SIZE,\n FLOATING_SIDEBAR_INSET,\n FLOATING_SIDEBAR_OPEN_WIDTH,\n FLOATING_SIDEBAR_SPRING,\n getFloatingSidebarGapWidth,\n getFloatingSidebarTiming,\n type FloatingSidebarMorphStyle,\n} from '@/components/ui/floating-sidebar-metrics';\n\n/*\n * A floating \"liquid glass\" sidebar: one capsule that morphs between three\n * states.\n *\n * - closed: a circle around an icon (e.g. the site icon)\n * - open: hovering the circle or the hot zone beneath it, focusing or clicking it\n * grows the circle into a panel floating over the content, the header\n * fading in beside the icon and the body unfurling beneath it\n * - pinned: the panel is docked at full height and a gap beside it offsets\n * the content\n *\n * The icon is one element throughout: filling the circle while closed, it\n * shrinks and glides into its place in the header row as the circle opens.\n *\n * Use it inside a SidebarProvider in place of `Sidebar`, with the usual menu\n * primitives (SidebarGroup, SidebarMenu…) in the body. It is a desktop\n * component; render the `Sidebar` sheet on mobile.\n *\n * It only moves itself and its gap, which changes width at once as it pins and\n * unpins. Content that should glide to its new place, or keep clear of the\n * closed circle, does so itself with the metrics and timing exported from\n * floating-sidebar-metrics (`FLOATING_SIDEBAR_INSET`, `getFloatingSidebarGapWidth`,\n * `getFloatingSidebarTiming`…), driven by the same `pinned` it passes in.\n */\n\nconst UNFURL_DURATION = '450ms';\n// Forgiving, so a pointer drifting off the panel doesn't close it.\nconst CLOSE_DELAY = 400;\n// How long the pointer stays still to count as at rest (see `armHoverOnRest`).\nconst REST_DELAY = 100;\n// After the morph's duration, when it's taken as finished though no\n// transitionend came (e.g. a height that didn't change)\nconst MORPH_END_GRACE = 100;\nconst INSET = FLOATING_SIDEBAR_INSET;\nconst CLOSED_SIZE = FLOATING_SIDEBAR_CLOSED_SIZE;\nconst OPEN_RADIUS = 6;\n// Below this width the open header row tightens to match smaller page titles.\nconst NARROW_QUERY = '(max-width: 1379px)';\n/**\n * The closed circle is `CLOSED_SIZE` across: its visible diameter inside a 1px\n * border (a light outline that all but disappears on a light page).\n *\n * - circleIcon: the icon centred in it, cropped round, a little larger than\n * the header row's icon\n * - icon: the icon in the open and pinned header row, which is `padding`\n * around it, as tall as it is from the panel's top and left\n * - gap: between the header row's icon and the header beside it\n */\nconst SIZES = {\n regular: { circleIcon: 32, icon: 28, gap: 10 },\n narrow: { circleIcon: 32, icon: 24, gap: 8 },\n};\n// Around the header row's icon, and the body's side padding, so the search\n// field and nav rows line up with the icon.\nconst PADDING = 20;\nconst PIN_BUTTON_SIZE = 28;\n// Puts the pin glyph PADDING from the panel's right edge.\nconst PIN_BUTTON_RIGHT = 14;\n/*\n * The capsule floats within the viewport, less any chrome framing the page\n * around it: `--floating-sidebar-offset-top`, `-left` and `-bottom` (0 unless\n * set on an ancestor) move its corner and shorten its panel by that much.\n */\nconst OFFSET_TOP = 'var(--floating-sidebar-offset-top, 0px)';\nconst OFFSET_LEFT = 'var(--floating-sidebar-offset-left, 0px)';\nconst OFFSET_BOTTOM = 'var(--floating-sidebar-offset-bottom, 0px)';\n// Pinned, and the most it grows to open.\nconst PANEL_HEIGHT = `calc(100vh - ${OFFSET_TOP} - ${OFFSET_BOTTOM} - ${INSET * 2}px)`;\n\n/** Frosted body: a faint tint so the capsule reads as a surface, a light-catching outline and a backdrop blur. */\nconst GLASS = 'border border-border-glass bg-surface-glass backdrop-blur-md backdrop-saturate-150';\n\n/** Floating: inset highlights, a hairline outline and a layered drop shadow. */\nconst SHADOW_FLOAT = 'var(--shadow-glass-floating)';\n\n/** Pinned: only a 1px outline; the other layers fade out so the panel reads as anchored. */\nconst SHADOW_PINNED = 'var(--shadow-glass-docked)';\n\n// Popups opened from the panel render in portals: the panel stays open under\n// them, and the hot zone ignores the pointer over them.\nconst POPUP_TRIGGER_SELECTOR = '[aria-haspopup][aria-expanded=true]';\nconst OVERLAY_SELECTOR =\n '[role=dialog], [role=alertdialog], [role=menu], [role=listbox], [data-radix-popper-content-wrapper]';\n\n/**\n * Whether a point is in the hot zone: the strip beneath the closed circle, as\n * wide as its footprint, from the screen's left edge down to the bottom. With\n * the circle, it's what opens the panel; nothing beside the circle does.\n */\nfunction inHotZone(wrapper: HTMLElement | null, x: number, y: number): boolean {\n if (!wrapper) {\n return false;\n }\n // The capsule's corner, wherever its offsets put it\n const { top, left } = wrapper.getBoundingClientRect();\n return x < left + CLOSED_SIZE + INSET && y >= top + CLOSED_SIZE + INSET;\n}\n\nfunction useMediaQuery(query: string): boolean {\n const [matches, setMatches] = React.useState(\n () => typeof window !== 'undefined' && (window.matchMedia?.(query).matches ?? false),\n );\n\n React.useEffect(() => {\n const mql = window.matchMedia?.(query);\n if (!mql) {\n return;\n }\n const onChange = () => setMatches(mql.matches);\n onChange();\n mql.addEventListener('change', onChange);\n return () => mql.removeEventListener('change', onChange);\n }, [query]);\n\n return matches;\n}\n\n/**\n * Reads the capsule's height just before React applies a pin change to the\n * DOM, which by the time layout effects run is gone. Renders nothing.\n */\nclass BeforePinCommit extends React.Component<{ pinned: boolean; onBeforeCommit: () => void }> {\n getSnapshotBeforeUpdate(previous: Readonly<{ pinned: boolean }>) {\n if (previous.pinned !== this.props.pinned) {\n this.props.onBeforeCommit();\n }\n return null;\n }\n\n // React requires it alongside getSnapshotBeforeUpdate\n componentDidUpdate() {}\n\n render() {\n return null;\n }\n}\n\n/** Specular sheen: a top-edge highlight that fades quickly so the body stays translucent. */\nfunction GlassHighlight() {\n return (\n <div\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute inset-0\"\n style={{ borderRadius: 'inherit', background: 'var(--surface-glass-highlight)' }}\n />\n );\n}\n\ninterface FloatingSidebarProps extends Omit<React.ComponentProps<'div'>, 'children'> {\n /** Docked beside the content, rather than a circle that opens over it. */\n pinned: boolean;\n /** Shows the pin button when provided. */\n onPinnedChange?: (pinned: boolean) => void;\n /**\n * Pinned by the screen rather than by the user (e.g. a screen whose\n * navigation lives in the sidebar): the pin button fades out, keeping its\n * place so the header doesn't reflow.\n */\n pinLocked?: boolean;\n /**\n * How the capsule morphs: `bump` (the default) grows a touch past size and\n * settles back; `ease` moves on a plain ease-out, without overshoot (e.g.\n * for a pin the screen makes, sequenced with other motion). It applies to\n * the transitions that start while it's set, so keep it until\n * `onPinnedMorphEnd`. Content moving in step takes the same timing from\n * `getFloatingSidebarTiming`.\n */\n morphStyle?: FloatingSidebarMorphStyle;\n /**\n * Called with the new `pinned` state once the capsule has finished morphing\n * to it (at once without transitions); not if `pinned` changes again first.\n */\n onPinnedMorphEnd?: (pinned: boolean) => void;\n /** Centred in the closed circle, and kept in place as it grows (e.g. the site icon). */\n icon: React.ReactNode;\n /** The circle's accessible name (e.g. the site title). */\n label: string;\n /** Beside the icon in the open and pinned panel's header row (e.g. the site title); hidden while closed. */\n header: React.ReactNode;\n /** Unfurls beneath the header when open or pinned. */\n children: React.ReactNode;\n bodyClassName?: string;\n /** The open and pinned panel's width. */\n openWidth?: number;\n /** Stops the panel opening (and closes it), e.g. while the page is locked. */\n disabled?: boolean;\n /**\n * Enables transitions. Leave it false until the pinned state has loaded, so\n * a stored state lands without morphing. Transitions also wait a frame after\n * mounting.\n */\n animate?: boolean;\n /** Opens the panel when the pointer enters the strip beneath the closed circle. */\n hotZone?: boolean;\n /**\n * Hovering doesn't open the panel until the pointer first comes to rest,\n * for a sidebar that reappears under a pointer on its way somewhere (e.g.\n * back from a full-screen screen); resting over it then opens it. Read as\n * it mounts.\n */\n armHoverOnRest?: boolean;\n /**\n * Changing it (e.g. to the route's path) cancels a pending close: a layout\n * shift inside the panel can fire a mouseleave though the pointer never left.\n */\n resetKey?: unknown;\n pinLabel?: string;\n unpinLabel?: string;\n}\n\n/**\n * The outer element (forwarded ref) holds the gap that offsets the content\n * while pinned; `className` and other props land on the fixed wrapper around\n * the capsule, like Shade's `Sidebar`.\n */\nconst FloatingSidebar = React.forwardRef<HTMLDivElement, FloatingSidebarProps>(\n (\n {\n pinned,\n onPinnedChange,\n pinLocked = false,\n morphStyle = 'bump',\n onPinnedMorphEnd,\n icon,\n label,\n header,\n children,\n bodyClassName,\n openWidth = FLOATING_SIDEBAR_OPEN_WIDTH,\n disabled = false,\n animate = true,\n hotZone = true,\n armHoverOnRest = false,\n resetKey,\n pinLabel = 'Pin sidebar',\n unpinLabel = 'Unpin sidebar',\n className,\n style,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n ...props\n },\n ref,\n ) => {\n const narrow = useMediaQuery(NARROW_QUERY);\n const reducedMotion = useMediaQuery('(prefers-reduced-motion: reduce)');\n const sizes = narrow ? SIZES.narrow : SIZES.regular;\n const headerHeight = PADDING + sizes.icon + PADDING;\n // Moves the icon from its place in the header row to the circle's centre\n const closedIconOffset = (CLOSED_SIZE - 2 - sizes.circleIcon) / 2 - PADDING;\n\n const wrapperRef = React.useRef<HTMLDivElement>(null);\n const capsuleRef = React.useRef<HTMLDivElement>(null);\n const triggerRef = React.useRef<HTMLButtonElement>(null);\n const headerRef = React.useRef<HTMLDivElement>(null);\n const bodyRef = React.useRef<HTMLDivElement>(null);\n const pinButtonRef = React.useRef<HTMLButtonElement>(null);\n\n // Hover intent: opens at once, closes after a delay so the pointer can\n // travel between the hot zone and the panel.\n const [open, setOpen] = React.useState(false);\n const closeTimer = React.useRef<number | undefined>(undefined);\n const cancel = React.useCallback(() => {\n window.clearTimeout(closeTimer.current);\n closeTimer.current = undefined;\n }, []);\n const show = React.useCallback(() => {\n cancel();\n if (!disabled) {\n setOpen(true);\n }\n }, [cancel, disabled]);\n const hide = React.useCallback(() => {\n cancel();\n setOpen(false);\n }, [cancel]);\n const scheduleClose = React.useCallback(() => {\n cancel();\n const tryClose = () => {\n const wrapper = wrapperRef.current;\n if (wrapper?.querySelector(POPUP_TRIGGER_SELECTOR)) {\n closeTimer.current = window.setTimeout(tryClose, CLOSE_DELAY);\n return;\n }\n closeTimer.current = undefined;\n // Still over the capsule, though its mouseleave said otherwise (e.g.\n // it morphed under the pointer): it closes once the pointer leaves it.\n if (wrapper?.matches(':hover')) {\n hover.current.capsule = true;\n hover.current.any = true;\n return;\n }\n // Keyboard users close it by tabbing out or with Escape.\n const active = document.activeElement;\n if (active && wrapper?.contains(active) && active.matches(':focus-visible')) {\n return;\n }\n setOpen(false);\n };\n closeTimer.current = window.setTimeout(tryClose, CLOSE_DELAY);\n }, [cancel]);\n\n React.useEffect(() => cancel, [cancel]);\n React.useEffect(() => {\n if (disabled) {\n hide();\n }\n }, [disabled, hide]);\n React.useEffect(() => {\n cancel();\n }, [resetKey, cancel]);\n\n // The capsule and the hot zone act as one hover target. It only arms once\n // the pointer has been outside it: the sidebar can appear under a resting\n // pointer (e.g. back from the editor, whose close button sits where the\n // circle is), and that shouldn't open it.\n const hover = React.useRef({ capsule: false, zone: false, any: false });\n const hoverArmed = React.useRef(false);\n // With `armHoverOnRest`, the pointer passes over it freely until it stops\n const [waitsForRest] = React.useState(armHoverOnRest);\n const waitingForRest = React.useRef(waitsForRest);\n const restTimer = React.useRef<number | undefined>(undefined);\n const updateHover = React.useCallback(\n (parts: Partial<Record<'capsule' | 'zone', boolean>>) => {\n const state = hover.current;\n Object.assign(state, parts);\n const any = state.capsule || state.zone;\n if (waitingForRest.current) {\n return;\n }\n if (!hoverArmed.current) {\n hoverArmed.current = !any;\n return;\n }\n if (any === state.any) {\n return;\n }\n state.any = any;\n if (any) {\n show();\n } else {\n scheduleClose();\n }\n },\n [scheduleClose, show],\n );\n\n // The hot zone tracks the pointer rather than covering the page, so the\n // content beneath it still scrolls and responds to the pointer. The\n // pointer's moves also keep the capsule's hover true to where it is: its\n // mouseenter and mouseleave can be missed or misfire as it morphs under a\n // pointer (e.g. landing open from pinned), and the panel mustn't close\n // while the pointer is over it.\n React.useEffect(() => {\n if (disabled) {\n return;\n }\n const onPointerMove = (event: PointerEvent) => {\n if (event.pointerType === 'touch') {\n return;\n }\n const target = event.target instanceof Element ? event.target : null;\n // Popups opened from the panel (in portals) keep the capsule's hover as it was\n const overOverlay = Boolean(target?.closest(OVERLAY_SELECTOR));\n const parts: Partial<Record<'capsule' | 'zone', boolean>> = {};\n if (!overOverlay && target) {\n parts.capsule = Boolean(wrapperRef.current?.contains(target));\n }\n if (hotZone) {\n parts.zone = !overOverlay && inHotZone(wrapperRef.current, event.clientX, event.clientY);\n }\n updateHover(parts);\n if (waitingForRest.current) {\n window.clearTimeout(restTimer.current);\n restTimer.current = window.setTimeout(() => {\n waitingForRest.current = false;\n hoverArmed.current = true;\n const state = hover.current;\n state.any = state.capsule || state.zone;\n if (state.any) {\n show();\n }\n }, REST_DELAY);\n }\n };\n const onPointerLeave = () => updateHover({ capsule: false, zone: false });\n document.addEventListener('pointermove', onPointerMove);\n document.documentElement.addEventListener('pointerleave', onPointerLeave);\n return () => {\n document.removeEventListener('pointermove', onPointerMove);\n document.documentElement.removeEventListener('pointerleave', onPointerLeave);\n window.clearTimeout(restTimer.current);\n hover.current.zone = false;\n };\n }, [disabled, hotZone, show, updateHover]);\n\n // Escape closes the floating panel, returning focus to the circle.\n const restoringFocus = React.useRef(false);\n React.useEffect(() => {\n if (!open || pinned) {\n return;\n }\n const onKeyDown = (event: KeyboardEvent) => {\n const wrapper = wrapperRef.current;\n if (\n event.key !== 'Escape' ||\n event.defaultPrevented ||\n wrapper?.querySelector(POPUP_TRIGGER_SELECTOR)\n ) {\n return;\n }\n const focusWasWithin = Boolean(wrapper?.contains(document.activeElement));\n hide();\n if (focusWasWithin) {\n restoringFocus.current = true;\n triggerRef.current?.focus();\n restoringFocus.current = false;\n }\n };\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n }, [hide, open, pinned]);\n\n // Pinned, the panel is always open; `open` alone shows the pin button.\n const expanded = open || pinned;\n\n // The header, pin button and body are clipped away while closed, so they\n // must not be reachable; the circle itself takes focus. A locked pin\n // button is hidden in every state.\n React.useLayoutEffect(() => {\n for (const element of [headerRef.current, bodyRef.current]) {\n if (element) {\n element.inert = !expanded;\n }\n }\n if (pinButtonRef.current) {\n pinButtonRef.current.inert = !expanded || pinLocked;\n }\n }, [expanded, pinLocked]);\n\n // The gap changes width at once, never through a transition: that would\n // lay the content out again on every frame. Content that should glide to\n // its new place slides itself, in step with the morph (see\n // `getFloatingSidebarTiming`).\n const gapWidth = getFloatingSidebarGapWidth(pinned, openWidth);\n\n // Transitions start a frame after mounting (and after `animate`), so the\n // first paint and a stored pinned state never morph.\n const [ready, setReady] = React.useState(false);\n React.useEffect(() => {\n if (!animate) {\n setReady(false);\n return;\n }\n const frame = requestAnimationFrame(() => setReady(true));\n return () => cancelAnimationFrame(frame);\n }, [animate]);\n const morph = ready && !reducedMotion;\n // The capsule's shape, and what moves with it (its height, the icon)\n const {\n duration: morphDuration,\n easing: glideEasing,\n shapeEasing,\n } = getFloatingSidebarTiming(morphStyle);\n // The capsule's transitions: its height glides rather than bumps, as the\n // body it holds unfurls without overshoot (a bump on a panel this tall\n // would overshoot by tens of pixels)\n const capsuleTransitions: Array<[property: string, easing: string]> = morph\n ? [\n ['width', shapeEasing],\n ['height', glideEasing],\n ['border-radius', shapeEasing],\n ['box-shadow', shapeEasing],\n ]\n : [];\n\n // Reports the end of the morph a pin change starts: the capsule's height\n // transition ending, or its duration passing without one.\n const onPinnedMorphEndRef = React.useRef(onPinnedMorphEnd);\n React.useLayoutEffect(() => {\n onPinnedMorphEndRef.current = onPinnedMorphEnd;\n });\n const pendingMorph = React.useRef<{ pinned: boolean; timer: number } | null>(null);\n const finishMorph = React.useCallback(() => {\n const pending = pendingMorph.current;\n if (!pending) {\n return;\n }\n window.clearTimeout(pending.timer);\n pendingMorph.current = null;\n onPinnedMorphEndRef.current?.(pending.pinned);\n }, []);\n const previousPinned = React.useRef(pinned);\n React.useLayoutEffect(() => {\n if (previousPinned.current === pinned) {\n return;\n }\n previousPinned.current = pinned;\n window.clearTimeout(pendingMorph.current?.timer);\n pendingMorph.current = null;\n if (!morph) {\n onPinnedMorphEndRef.current?.(pinned);\n return;\n }\n const timer = window.setTimeout(finishMorph, morphDuration + MORPH_END_GRACE);\n pendingMorph.current = { pinned, timer };\n }, [finishMorph, morph, morphDuration, pinned]);\n React.useEffect(() => () => window.clearTimeout(pendingMorph.current?.timer), []);\n\n // Floating open, the body scrolls once it has unfurled (a panel taller\n // than the viewport); while unfurling it's clipped.\n const [unfurled, setUnfurled] = React.useState(expanded);\n React.useEffect(() => {\n if (pinned || !expanded || !morph) {\n setUnfurled(expanded);\n }\n }, [expanded, morph, pinned]);\n\n // The floating open capsule's height (`auto`) on screen before the pin change\n const heightBefore = React.useRef<number | null>(null);\n const measureBeforePin = React.useCallback(() => {\n const capsule = capsuleRef.current;\n heightBefore.current =\n capsule?.style.height === 'auto' ? capsule.getBoundingClientRect().height : null;\n }, []);\n\n // Pinning the floating open panel, its height transitions from `auto`,\n // which interpolate-size resolves anew on every frame: should the body's\n // content grow meanwhile (e.g. another navigation rendered into it), the\n // start would leap past the pinned height and the capsule jump to it. It\n // starts from the height it had on screen instead.\n const capsuleTransitionsRef = React.useRef(capsuleTransitions);\n React.useLayoutEffect(() => {\n capsuleTransitionsRef.current = capsuleTransitions;\n });\n React.useLayoutEffect(() => {\n const from = heightBefore.current;\n heightBefore.current = null;\n const capsule = capsuleRef.current;\n const transitions = capsuleTransitionsRef.current;\n if (from === null || !capsule || !transitions.length) {\n return;\n }\n const { height, transitionProperty, transitionTimingFunction } = capsule.style;\n const others = transitions.filter(([property]) => property !== 'height');\n capsule.style.transitionProperty = others.map(([property]) => property).join(', ');\n capsule.style.transitionTimingFunction = others.map(([, easing]) => easing).join(', ');\n capsule.style.height = `${from}px`;\n // Lands the start height without a transition, the others starting theirs\n void getComputedStyle(capsule).height;\n capsule.style.transitionProperty = transitionProperty;\n capsule.style.transitionTimingFunction = transitionTimingFunction;\n capsule.style.height = height;\n }, [pinned]);\n\n // The body fills the pinned capsule, and keeps filling it while it shrinks\n // after unpinning, so the footer rides its bottom edge rather than jumping\n // up; by the end the capsule hugs the body, so letting go doesn't show.\n const [filled, setFilled] = React.useState(pinned);\n React.useEffect(() => {\n if (pinned || !morph) {\n setFilled(pinned);\n return;\n }\n const timer = window.setTimeout(() => setFilled(false), morphDuration);\n return () => window.clearTimeout(timer);\n }, [morph, morphDuration, pinned]);\n\n const state = pinned ? 'pinned' : open ? 'open' : 'closed';\n\n return (\n <div ref={ref} className=\"shrink-0 text-foreground\" data-state={state} role=\"navigation\">\n {/* Offsets the content while pinned */}\n <div aria-hidden=\"true\" className=\"h-full\" data-sidebar=\"gap\" style={{ width: gapWidth }} />\n <BeforePinCommit pinned={pinned} onBeforeCommit={measureBeforePin} />\n {/* The capsule plus, while floating open, a hover buffer to its right */}\n <div\n ref={wrapperRef}\n className={cn('fixed z-40 flex items-stretch', className)}\n style={{\n top: `calc(${OFFSET_TOP} + ${INSET}px)`,\n left: `calc(${OFFSET_LEFT} + ${INSET}px)`,\n ...style,\n }}\n onBlur={(event) => {\n onBlur?.(event);\n const next = event.relatedTarget;\n if (\n open &&\n next instanceof Node &&\n !event.currentTarget.contains(next) &&\n !wrapperRef.current?.querySelector(POPUP_TRIGGER_SELECTOR)\n ) {\n hide();\n }\n }}\n onFocus={(event) => {\n onFocus?.(event);\n if (!restoringFocus.current && event.target.matches(':focus-visible')) {\n show();\n }\n }}\n onMouseEnter={(event) => {\n onMouseEnter?.(event);\n updateHover({ capsule: true });\n }}\n onMouseLeave={(event) => {\n onMouseLeave?.(event);\n updateHover({ capsule: false });\n }}\n {...props}\n >\n <div\n ref={capsuleRef}\n className={cn(\n 'relative flex shrink-0 flex-col overflow-hidden [interpolate-size:allow-keywords]',\n GLASS,\n )}\n data-sidebar=\"sidebar\"\n data-slot=\"floating-sidebar\"\n data-state={state}\n style={{\n width: expanded ? openWidth : CLOSED_SIZE,\n // Open, `auto` (not undefined) so interpolate-size can transition it\n height: pinned ? PANEL_HEIGHT : expanded ? 'auto' : CLOSED_SIZE,\n maxHeight: PANEL_HEIGHT,\n // The width's bump dips a little below the circle as it closes;\n // it mustn't squeeze it, clipping the icon\n minWidth: CLOSED_SIZE,\n borderRadius: expanded ? OPEN_RADIUS : CLOSED_SIZE / 2,\n boxShadow: pinned ? SHADOW_PINNED : SHADOW_FLOAT,\n transitionProperty: morph\n ? capsuleTransitions.map(([property]) => property).join(', ')\n : 'none',\n transitionDuration: `${morphDuration}ms`,\n transitionTimingFunction: capsuleTransitions.map(([, easing]) => easing).join(', '),\n }}\n onTransitionEnd={(event) => {\n if (event.target === event.currentTarget && event.propertyName === 'height') {\n finishMorph();\n }\n }}\n >\n <GlassHighlight />\n\n {/* Laid out open in every state (the closed capsule clips it), so\n the morph never reflows it */}\n <div\n className=\"flex shrink-0 items-center\"\n data-slot=\"floating-sidebar-header\"\n style={{\n width: openWidth - 2,\n height: headerHeight,\n gap: sizes.gap,\n paddingLeft: PADDING,\n paddingRight: onPinnedChange\n ? PIN_BUTTON_RIGHT + PIN_BUTTON_SIZE + sizes.gap\n : PADDING,\n }}\n >\n {/* The circle's focus target: focusing or clicking it opens the\n panel. Pinned, it's only the icon. It holds the icon's place\n in the row. */}\n <button\n ref={triggerRef}\n aria-expanded={pinned ? undefined : open}\n aria-hidden={pinned || undefined}\n aria-label={label}\n className={cn(\n 'group relative shrink-0 outline-none',\n pinned ? 'cursor-default' : 'cursor-pointer',\n )}\n data-slot=\"floating-sidebar-trigger\"\n style={{ width: sizes.icon, height: sizes.icon }}\n tabIndex={pinned ? -1 : 0}\n type=\"button\"\n onClick={show}\n >\n {/* The icon at its closed size (crisp where it rests longest),\n scaled down into the row while open; closed, moved to the\n circle's centre and cropped round */}\n <span\n className=\"absolute top-0 left-0 overflow-hidden group-focus-visible:outline-2 group-focus-visible:outline-offset-2 group-focus-visible:outline-focus-ring group-focus-visible:outline-solid [&>*]:size-full [&>*]:object-cover\"\n data-slot=\"floating-sidebar-icon\"\n style={{\n width: sizes.circleIcon,\n height: sizes.circleIcon,\n transformOrigin: '0 0',\n // From the row's icon place to the circle's centre, in the\n // header row's coordinates (it starts inside the border)\n transform: expanded\n ? `translate(0px, 0px) scale(${sizes.icon / sizes.circleIcon})`\n : `translate(${closedIconOffset}px, ${closedIconOffset}px) scale(1)`,\n borderRadius: expanded ? '22%' : '50%',\n transitionProperty: morph ? 'transform, border-radius' : 'none',\n transitionDuration: `${morphDuration}ms`,\n transitionTimingFunction: glideEasing,\n }}\n >\n {icon}\n </span>\n </button>\n {/* Fades and slides in as the capsule grows, out as it shrinks */}\n <div\n ref={headerRef}\n className=\"flex min-w-0 flex-1 items-center gap-2\"\n style={{\n opacity: expanded ? 1 : 0,\n transform: expanded ? 'none' : 'translateX(-8px)',\n transitionProperty: morph ? 'opacity, transform' : 'none',\n transitionDuration: expanded ? '320ms' : '160ms',\n transitionDelay: expanded ? '90ms' : '0ms',\n transitionTimingFunction: FLOATING_SIDEBAR_SPRING,\n }}\n >\n {header}\n </div>\n </div>\n\n {/* Anchored to the capsule, so it tracks the right edge as the width animates */}\n {onPinnedChange && (\n <button\n ref={pinButtonRef}\n aria-hidden={pinLocked || undefined}\n aria-label={pinned ? unpinLabel : pinLabel}\n className={cn(\n 'absolute z-10 flex size-7 cursor-pointer items-center justify-center rounded-full text-muted-foreground transition-[opacity,color,background-color] duration-200 hover:bg-interactive-hover hover:text-foreground focus-visible:pointer-events-auto focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-focus-ring focus-visible:outline-hidden',\n // Follows the hover state, not pinning, so it hides when the\n // pointer leaves a pinned panel too\n open && !pinLocked\n ? 'pointer-events-auto opacity-100 delay-75'\n : 'pointer-events-none opacity-0',\n )}\n data-slot=\"floating-sidebar-pin\"\n style={{ top: (headerHeight - PIN_BUTTON_SIZE) / 2, right: PIN_BUTTON_RIGHT }}\n type=\"button\"\n onClick={() => onPinnedChange(!pinned)}\n >\n <Pin\n className=\"size-4\"\n strokeWidth={1.75}\n style={{\n transform: pinned ? 'rotate(45deg)' : 'rotate(0deg)',\n transitionProperty: reducedMotion ? 'none' : 'transform',\n transitionDuration: '300ms',\n transitionTimingFunction: FLOATING_SIDEBAR_SPRING,\n }}\n />\n </button>\n )}\n\n {/* Unfurls through grid rows 0fr → 1fr, whatever the body's\n height. One structure in every state, so pinning and unpinning\n animate it rather than swap its layout. */}\n <div\n ref={bodyRef}\n className={cn('grid min-h-0', filled && 'flex-1')}\n data-slot=\"floating-sidebar-body\"\n style={{\n gridTemplateRows: expanded ? '1fr' : '0fr',\n transitionProperty: morph ? 'grid-template-rows' : 'none',\n transitionDuration: UNFURL_DURATION,\n transitionTimingFunction: FLOATING_SIDEBAR_SPRING,\n }}\n onTransitionEnd={(event) => {\n if (\n event.target === event.currentTarget &&\n event.propertyName === 'grid-template-rows'\n ) {\n setUnfurled(expanded);\n }\n }}\n >\n {/* Filling the capsule, the body scrolls within itself (e.g. a\n scrolling SidebarContent above a footer) */}\n <div\n className={cn(\n 'min-h-0',\n filled\n ? 'flex flex-col overflow-hidden'\n : unfurled\n ? 'overflow-y-auto overscroll-contain'\n : 'overflow-hidden',\n )}\n >\n {/* The open width, so the content doesn't reflow as the capsule grows */}\n <div\n className={cn(\n 'flex flex-col pt-2 pb-4 transition-opacity duration-200',\n filled && 'min-h-0 flex-1',\n expanded ? 'opacity-100 delay-75' : 'opacity-0',\n bodyClassName,\n )}\n style={{ width: openWidth - 2, paddingLeft: PADDING, paddingRight: PADDING }}\n >\n {children}\n </div>\n </div>\n </div>\n </div>\n {expanded && !pinned && <div aria-hidden=\"true\" className=\"w-12 shrink-0\" />}\n </div>\n </div>\n );\n },\n);\nFloatingSidebar.displayName = 'FloatingSidebar';\n\nexport { FloatingSidebar };\nexport type { FloatingSidebarProps };\n"],"mappings":";;;;;;AAuCA,IAAM,kBAAkB;AAExB,IAAM,cAAc;AAEpB,IAAM,aAAa;AAGnB,IAAM,kBAAkB;AACxB,IAAM,QAAA;AACN,IAAM,cAAA;AACN,IAAM,cAAc;AAEpB,IAAM,eAAe;;;;;;;;;;;AAWrB,IAAM,QAAQ;CACZ,SAAS;EAAE,YAAY;EAAI,MAAM;EAAI,KAAK;CAAG;CAC7C,QAAQ;EAAE,YAAY;EAAI,MAAM;EAAI,KAAK;CAAE;AAC7C;AAGA,IAAM,UAAU;AAChB,IAAM,kBAAkB;AAExB,IAAM,mBAAmB;AAMzB,IAAM,aAAa;AACnB,IAAM,cAAc;AAGpB,IAAM,eAAe,gBAAgB,WAAW,kDAAwB,QAAQ,EAAE;;AAGlF,IAAM,QAAQ;;AAGd,IAAM,eAAe;;AAGrB,IAAM,gBAAgB;AAItB,IAAM,yBAAyB;AAC/B,IAAM,mBACJ;;;;;;AAOF,SAAS,UAAU,SAA6B,GAAW,GAAoB;CAC7E,IAAI,CAAC,SACH,OAAO;CAGT,MAAM,EAAE,KAAK,SAAS,QAAQ,sBAAsB;CACpD,OAAO,IAAI,OAAO,cAAc,SAAS,KAAK,MAAM,cAAc;AACpE;AAEA,SAAS,cAAc,OAAwB;CAC7C,MAAM,CAAC,SAAS,cAAc,QAAM,eAC5B,OAAO,WAAW,gBAAgB,OAAO,aAAa,KAAK,CAAC,CAAC,WAAW,MAChF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AmB;QAAG,OAAO;OAAiB;OAC5E,MAAK;OACL,eAAe,eAAe,CAAC,MAAM;iBAErC,oBAAC,KAAD;QACE,WAAU;QACV,aAAa;QACb,OAAO;SACL,WAAW,SAAS,kBAAkB;SACtC,oBAAoB,gBAAgB,SAAS;SAC7C,oBAAoB;SACpB,0BAAA;QACF;OACD,CAAA;MACK,CAAA;MAMV,oBAAC,OAAD;OACE,KAAK;OACL,WAAW,GAAG,gBAAgB,UAAU,QAAQ;OAChD,aAAU;OACV,OAAO;QACL,kBAAkB,WAAW,QAAQ;QACrC,oBAAoB,QAAQ,uBAAuB;QACnD,oBAAoB;QACpB,0BAA0B;OAC5B;OACA,kBAAkB,UAAU;QAC1B,IACE,MAAM,WAAW,MAAM,iBACvB,MAAM,iBAAiB,sBAEvB,YAAY,QAAQ;OAExB;iBAIA,oBAAC,OAAD;QACE,WAAW,GACT,WACA,SACI,kCACA,WACE,uCACA,iBACR;kBAGA,oBAAC,OAAD;SACE,WAAW,GACT,2DACA,UAAU,kBACV,WAAW,yBAAyB,aACpC,aACF;SACA,OAAO;UAAE,OAAO,YAAY;UAAG,aAAa;UAAS,cAAc;SAAQ;SAE1E;QACE,CAAA;OACF,CAAA;MACF,CAAA;KACF;QACJ,YAAY,CAAC,UAAU,oBAAC,OAAD;KAAK,eAAY;KAAO,WAAU;IAAiB,CAAA,CACxE;;EACF;;AAET,CACF;AACA,gBAAgB,cAAc"}
|
|
1
|
+
{"version":3,"file":"floating-sidebar.js","names":[],"sources":["../../../src/components/ui/floating-sidebar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Pin } from 'lucide-react';\n\nimport { cn } from '@/lib/utils';\nimport {\n FLOATING_SIDEBAR_CLOSED_SIZE,\n FLOATING_SIDEBAR_INSET,\n FLOATING_SIDEBAR_OPEN_WIDTH,\n FLOATING_SIDEBAR_SPRING,\n getFloatingSidebarGapWidth,\n getFloatingSidebarTiming,\n type FloatingSidebarMorphStyle,\n} from '@/components/ui/floating-sidebar-metrics';\n\n/*\n * A floating \"liquid glass\" sidebar: one capsule that morphs between three\n * states.\n *\n * - closed: a circle around an icon (e.g. the site icon)\n * - open: hovering the circle or the hot zone beneath it, focusing or clicking it\n * grows the circle into a panel floating over the content, the header\n * fading in beside the icon and the body unfurling beneath it\n * - pinned: the panel is docked at full height and a gap beside it offsets\n * the content\n *\n * The icon is one element throughout: filling the circle while closed, it\n * shrinks and glides into its place in the header row as the circle opens.\n *\n * Use it inside a SidebarProvider in place of `Sidebar`, with the usual menu\n * primitives (SidebarGroup, SidebarMenu…) in the body. It is a desktop\n * component; render the `Sidebar` sheet on mobile.\n *\n * It only moves itself and its gap, which changes width at once as it pins and\n * unpins. Content that should glide to its new place, or keep clear of the\n * closed circle, does so itself with the metrics and timing exported from\n * floating-sidebar-metrics (`FLOATING_SIDEBAR_INSET`, `getFloatingSidebarGapWidth`,\n * `getFloatingSidebarTiming`…), driven by the same `pinned` it passes in.\n */\n\nconst UNFURL_DURATION = '450ms';\n// Forgiving, so a pointer drifting off the panel doesn't close it.\nconst CLOSE_DELAY = 400;\n// How long the pointer stays still to count as at rest (see `armHoverOnRest`).\nconst REST_DELAY = 100;\n// After the morph's duration, when it's taken as finished though no\n// transitionend came (e.g. a height that didn't change)\nconst MORPH_END_GRACE = 100;\nconst INSET = FLOATING_SIDEBAR_INSET;\nconst CLOSED_SIZE = FLOATING_SIDEBAR_CLOSED_SIZE;\nconst OPEN_RADIUS = 6;\n// Below this width the open header row tightens to match smaller page titles.\nconst NARROW_QUERY = '(max-width: 1379px)';\n/**\n * The closed circle is `CLOSED_SIZE` across: its visible diameter inside a 1px\n * border (a light outline that all but disappears on a light page).\n *\n * - circleIcon: the icon centred in it, cropped round, a little larger than\n * the header row's icon\n * - icon: the icon in the open and pinned header row, which is `padding`\n * around it, as tall as it is from the panel's top and left\n * - gap: between the header row's icon and the header beside it\n */\nconst SIZES = {\n regular: { circleIcon: 32, icon: 28, gap: 10 },\n narrow: { circleIcon: 32, icon: 24, gap: 8 },\n};\n// Around the header row's icon, and the body's side padding, so the search\n// field and nav rows line up with the icon.\nconst PADDING = 20;\nconst PIN_BUTTON_SIZE = 32;\n// Puts the pin glyph PADDING from the panel's right edge.\nconst PIN_BUTTON_RIGHT = 12;\n/*\n * The capsule floats within the viewport, less any chrome framing the page\n * around it: `--floating-sidebar-offset-top`, `-left` and `-bottom` (0 unless\n * set on an ancestor) move its corner and shorten its panel by that much.\n */\nconst OFFSET_TOP = 'var(--floating-sidebar-offset-top, 0px)';\nconst OFFSET_LEFT = 'var(--floating-sidebar-offset-left, 0px)';\nconst OFFSET_BOTTOM = 'var(--floating-sidebar-offset-bottom, 0px)';\n// Pinned, and the most it grows to open.\nconst PANEL_HEIGHT = `calc(100vh - ${OFFSET_TOP} - ${OFFSET_BOTTOM} - ${INSET * 2}px)`;\n\n/** Frosted body: a faint tint so the capsule reads as a surface, a light-catching outline and a backdrop blur. */\nconst GLASS = 'border border-border-glass bg-surface-glass backdrop-blur-md backdrop-saturate-150';\n\n/** Floating: inset highlights, a hairline outline and a layered drop shadow. */\nconst SHADOW_FLOAT = 'var(--shadow-glass-floating)';\n\n/** Pinned: only a 1px outline; the other layers fade out so the panel reads as anchored. */\nconst SHADOW_PINNED = 'var(--shadow-glass-docked)';\n\n// Popups opened from the panel render in portals: the panel stays open under\n// them, and the hot zone ignores the pointer over them.\nconst POPUP_TRIGGER_SELECTOR = '[aria-haspopup][aria-expanded=true]';\nconst OVERLAY_SELECTOR =\n '[role=dialog], [role=alertdialog], [role=menu], [role=listbox], [data-radix-popper-content-wrapper]';\n\n/**\n * Whether a point is in the hot zone: the strip beneath the closed circle, as\n * wide as its footprint, from the screen's left edge down to the bottom. With\n * the circle, it's what opens the panel; nothing beside the circle does.\n */\nfunction inHotZone(wrapper: HTMLElement | null, x: number, y: number): boolean {\n if (!wrapper) {\n return false;\n }\n // The capsule's corner, wherever its offsets put it\n const { top, left } = wrapper.getBoundingClientRect();\n return x < left + CLOSED_SIZE + INSET && y >= top + CLOSED_SIZE + INSET;\n}\n\nfunction useMediaQuery(query: string): boolean {\n const [matches, setMatches] = React.useState(\n () => typeof window !== 'undefined' && (window.matchMedia?.(query).matches ?? false),\n );\n\n React.useEffect(() => {\n const mql = window.matchMedia?.(query);\n if (!mql) {\n return;\n }\n const onChange = () => setMatches(mql.matches);\n onChange();\n mql.addEventListener('change', onChange);\n return () => mql.removeEventListener('change', onChange);\n }, [query]);\n\n return matches;\n}\n\n/**\n * Reads the capsule's height just before React applies a pin change to the\n * DOM, which by the time layout effects run is gone. Renders nothing.\n */\nclass BeforePinCommit extends React.Component<{ pinned: boolean; onBeforeCommit: () => void }> {\n getSnapshotBeforeUpdate(previous: Readonly<{ pinned: boolean }>) {\n if (previous.pinned !== this.props.pinned) {\n this.props.onBeforeCommit();\n }\n return null;\n }\n\n // React requires it alongside getSnapshotBeforeUpdate\n componentDidUpdate() {}\n\n render() {\n return null;\n }\n}\n\n/** Specular sheen: a top-edge highlight that fades quickly so the body stays translucent. */\nfunction GlassHighlight() {\n return (\n <div\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute inset-0\"\n style={{ borderRadius: 'inherit', background: 'var(--surface-glass-highlight)' }}\n />\n );\n}\n\ninterface FloatingSidebarProps extends Omit<React.ComponentProps<'div'>, 'children'> {\n /** Docked beside the content, rather than a circle that opens over it. */\n pinned: boolean;\n /** Shows the pin button when provided. */\n onPinnedChange?: (pinned: boolean) => void;\n /**\n * Pinned by the screen rather than by the user (e.g. a screen whose\n * navigation lives in the sidebar): the pin button fades out, keeping its\n * place so the header doesn't reflow.\n */\n pinLocked?: boolean;\n /**\n * How the capsule morphs: `bump` (the default) grows a touch past size and\n * settles back; `ease` moves on a plain ease-out, without overshoot (e.g.\n * for a pin the screen makes, sequenced with other motion). It applies to\n * the transitions that start while it's set, so keep it until\n * `onPinnedMorphEnd`. Content moving in step takes the same timing from\n * `getFloatingSidebarTiming`.\n */\n morphStyle?: FloatingSidebarMorphStyle;\n /**\n * Called with the new `pinned` state once the capsule has finished morphing\n * to it (at once without transitions); not if `pinned` changes again first.\n */\n onPinnedMorphEnd?: (pinned: boolean) => void;\n /** Centred in the closed circle, and kept in place as it grows (e.g. the site icon). */\n icon: React.ReactNode;\n /** The circle's accessible name (e.g. the site title). */\n label: string;\n /** Beside the icon in the open and pinned panel's header row (e.g. the site title); hidden while closed. */\n header: React.ReactNode;\n /** Unfurls beneath the header when open or pinned. */\n children: React.ReactNode;\n bodyClassName?: string;\n /** The open and pinned panel's width. */\n openWidth?: number;\n /** Stops the panel opening (and closes it), e.g. while the page is locked. */\n disabled?: boolean;\n /**\n * Enables transitions. Leave it false until the pinned state has loaded, so\n * a stored state lands without morphing. Transitions also wait a frame after\n * mounting.\n */\n animate?: boolean;\n /** Opens the panel when the pointer enters the strip beneath the closed circle. */\n hotZone?: boolean;\n /**\n * Hovering doesn't open the panel until the pointer first comes to rest,\n * for a sidebar that reappears under a pointer on its way somewhere (e.g.\n * back from a full-screen screen); resting over it then opens it. Read as\n * it mounts.\n */\n armHoverOnRest?: boolean;\n /**\n * Changing it (e.g. to the route's path) cancels a pending close: a layout\n * shift inside the panel can fire a mouseleave though the pointer never left.\n */\n resetKey?: unknown;\n pinLabel?: string;\n unpinLabel?: string;\n}\n\n/**\n * The outer element (forwarded ref) holds the gap that offsets the content\n * while pinned; `className` and other props land on the fixed wrapper around\n * the capsule, like Shade's `Sidebar`.\n */\nconst FloatingSidebar = React.forwardRef<HTMLDivElement, FloatingSidebarProps>(\n (\n {\n pinned,\n onPinnedChange,\n pinLocked = false,\n morphStyle = 'bump',\n onPinnedMorphEnd,\n icon,\n label,\n header,\n children,\n bodyClassName,\n openWidth = FLOATING_SIDEBAR_OPEN_WIDTH,\n disabled = false,\n animate = true,\n hotZone = true,\n armHoverOnRest = false,\n resetKey,\n pinLabel = 'Pin sidebar',\n unpinLabel = 'Unpin sidebar',\n className,\n style,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n ...props\n },\n ref,\n ) => {\n const narrow = useMediaQuery(NARROW_QUERY);\n const reducedMotion = useMediaQuery('(prefers-reduced-motion: reduce)');\n const sizes = narrow ? SIZES.narrow : SIZES.regular;\n const headerHeight = PADDING + sizes.icon + PADDING;\n // Moves the icon from its place in the header row to the circle's centre\n const closedIconOffset = (CLOSED_SIZE - 2 - sizes.circleIcon) / 2 - PADDING;\n\n const wrapperRef = React.useRef<HTMLDivElement>(null);\n const capsuleRef = React.useRef<HTMLDivElement>(null);\n const triggerRef = React.useRef<HTMLButtonElement>(null);\n const headerRef = React.useRef<HTMLDivElement>(null);\n const bodyRef = React.useRef<HTMLDivElement>(null);\n const pinButtonRef = React.useRef<HTMLButtonElement>(null);\n\n // Hover intent: opens at once, closes after a delay so the pointer can\n // travel between the hot zone and the panel.\n const [open, setOpen] = React.useState(false);\n const closeTimer = React.useRef<number | undefined>(undefined);\n const cancel = React.useCallback(() => {\n window.clearTimeout(closeTimer.current);\n closeTimer.current = undefined;\n }, []);\n const show = React.useCallback(() => {\n cancel();\n if (!disabled) {\n setOpen(true);\n }\n }, [cancel, disabled]);\n const hide = React.useCallback(() => {\n cancel();\n setOpen(false);\n }, [cancel]);\n const scheduleClose = React.useCallback(() => {\n cancel();\n const tryClose = () => {\n const wrapper = wrapperRef.current;\n if (wrapper?.querySelector(POPUP_TRIGGER_SELECTOR)) {\n closeTimer.current = window.setTimeout(tryClose, CLOSE_DELAY);\n return;\n }\n closeTimer.current = undefined;\n // Still over the capsule, though its mouseleave said otherwise (e.g.\n // it morphed under the pointer): it closes once the pointer leaves it.\n if (wrapper?.matches(':hover')) {\n hover.current.capsule = true;\n hover.current.any = true;\n return;\n }\n // Keyboard users close it by tabbing out or with Escape.\n const active = document.activeElement;\n if (active && wrapper?.contains(active) && active.matches(':focus-visible')) {\n return;\n }\n setOpen(false);\n };\n closeTimer.current = window.setTimeout(tryClose, CLOSE_DELAY);\n }, [cancel]);\n\n React.useEffect(() => cancel, [cancel]);\n React.useEffect(() => {\n if (disabled) {\n hide();\n }\n }, [disabled, hide]);\n React.useEffect(() => {\n cancel();\n }, [resetKey, cancel]);\n\n // The capsule and the hot zone act as one hover target. It only arms once\n // the pointer has been outside it: the sidebar can appear under a resting\n // pointer (e.g. back from the editor, whose close button sits where the\n // circle is), and that shouldn't open it.\n const hover = React.useRef({ capsule: false, zone: false, any: false });\n const hoverArmed = React.useRef(false);\n // With `armHoverOnRest`, the pointer passes over it freely until it stops\n const [waitsForRest] = React.useState(armHoverOnRest);\n const waitingForRest = React.useRef(waitsForRest);\n const restTimer = React.useRef<number | undefined>(undefined);\n const updateHover = React.useCallback(\n (parts: Partial<Record<'capsule' | 'zone', boolean>>) => {\n const state = hover.current;\n Object.assign(state, parts);\n const any = state.capsule || state.zone;\n if (waitingForRest.current) {\n return;\n }\n if (!hoverArmed.current) {\n hoverArmed.current = !any;\n return;\n }\n if (any === state.any) {\n return;\n }\n state.any = any;\n if (any) {\n show();\n } else {\n scheduleClose();\n }\n },\n [scheduleClose, show],\n );\n\n // The hot zone tracks the pointer rather than covering the page, so the\n // content beneath it still scrolls and responds to the pointer. The\n // pointer's moves also keep the capsule's hover true to where it is: its\n // mouseenter and mouseleave can be missed or misfire as it morphs under a\n // pointer (e.g. landing open from pinned), and the panel mustn't close\n // while the pointer is over it.\n React.useEffect(() => {\n if (disabled) {\n return;\n }\n const onPointerMove = (event: PointerEvent) => {\n if (event.pointerType === 'touch') {\n return;\n }\n const target = event.target instanceof Element ? event.target : null;\n // Popups opened from the panel (in portals) keep the capsule's hover as it was\n const overOverlay = Boolean(target?.closest(OVERLAY_SELECTOR));\n const parts: Partial<Record<'capsule' | 'zone', boolean>> = {};\n if (!overOverlay && target) {\n parts.capsule = Boolean(wrapperRef.current?.contains(target));\n }\n if (hotZone) {\n parts.zone = !overOverlay && inHotZone(wrapperRef.current, event.clientX, event.clientY);\n }\n updateHover(parts);\n if (waitingForRest.current) {\n window.clearTimeout(restTimer.current);\n restTimer.current = window.setTimeout(() => {\n waitingForRest.current = false;\n hoverArmed.current = true;\n const state = hover.current;\n state.any = state.capsule || state.zone;\n if (state.any) {\n show();\n }\n }, REST_DELAY);\n }\n };\n const onPointerLeave = () => updateHover({ capsule: false, zone: false });\n document.addEventListener('pointermove', onPointerMove);\n document.documentElement.addEventListener('pointerleave', onPointerLeave);\n return () => {\n document.removeEventListener('pointermove', onPointerMove);\n document.documentElement.removeEventListener('pointerleave', onPointerLeave);\n window.clearTimeout(restTimer.current);\n hover.current.zone = false;\n };\n }, [disabled, hotZone, show, updateHover]);\n\n // Escape closes the floating panel, returning focus to the circle.\n const restoringFocus = React.useRef(false);\n React.useEffect(() => {\n if (!open || pinned) {\n return;\n }\n const onKeyDown = (event: KeyboardEvent) => {\n const wrapper = wrapperRef.current;\n if (\n event.key !== 'Escape' ||\n event.defaultPrevented ||\n wrapper?.querySelector(POPUP_TRIGGER_SELECTOR)\n ) {\n return;\n }\n const focusWasWithin = Boolean(wrapper?.contains(document.activeElement));\n hide();\n if (focusWasWithin) {\n restoringFocus.current = true;\n triggerRef.current?.focus();\n restoringFocus.current = false;\n }\n };\n document.addEventListener('keydown', onKeyDown);\n return () => document.removeEventListener('keydown', onKeyDown);\n }, [hide, open, pinned]);\n\n // Pinned, the panel is always open; `open` alone shows the pin button.\n const expanded = open || pinned;\n\n // The header, pin button and body are clipped away while closed, so they\n // must not be reachable; the circle itself takes focus. A locked pin\n // button is hidden in every state.\n React.useLayoutEffect(() => {\n for (const element of [headerRef.current, bodyRef.current]) {\n if (element) {\n element.inert = !expanded;\n }\n }\n if (pinButtonRef.current) {\n pinButtonRef.current.inert = !expanded || pinLocked;\n }\n }, [expanded, pinLocked]);\n\n // The gap changes width at once, never through a transition: that would\n // lay the content out again on every frame. Content that should glide to\n // its new place slides itself, in step with the morph (see\n // `getFloatingSidebarTiming`).\n const gapWidth = getFloatingSidebarGapWidth(pinned, openWidth);\n\n // Transitions start a frame after mounting (and after `animate`), so the\n // first paint and a stored pinned state never morph.\n const [ready, setReady] = React.useState(false);\n React.useEffect(() => {\n if (!animate) {\n setReady(false);\n return;\n }\n const frame = requestAnimationFrame(() => setReady(true));\n return () => cancelAnimationFrame(frame);\n }, [animate]);\n const morph = ready && !reducedMotion;\n // The capsule's shape, and what moves with it (its height, the icon)\n const {\n duration: morphDuration,\n easing: glideEasing,\n shapeEasing,\n } = getFloatingSidebarTiming(morphStyle);\n // The capsule's transitions: its height glides rather than bumps, as the\n // body it holds unfurls without overshoot (a bump on a panel this tall\n // would overshoot by tens of pixels)\n const capsuleTransitions: Array<[property: string, easing: string]> = morph\n ? [\n ['width', shapeEasing],\n ['height', glideEasing],\n ['border-radius', shapeEasing],\n ['box-shadow', shapeEasing],\n ]\n : [];\n\n // Reports the end of the morph a pin change starts: the capsule's height\n // transition ending, or its duration passing without one.\n const onPinnedMorphEndRef = React.useRef(onPinnedMorphEnd);\n React.useLayoutEffect(() => {\n onPinnedMorphEndRef.current = onPinnedMorphEnd;\n });\n const pendingMorph = React.useRef<{ pinned: boolean; timer: number } | null>(null);\n const finishMorph = React.useCallback(() => {\n const pending = pendingMorph.current;\n if (!pending) {\n return;\n }\n window.clearTimeout(pending.timer);\n pendingMorph.current = null;\n onPinnedMorphEndRef.current?.(pending.pinned);\n }, []);\n const previousPinned = React.useRef(pinned);\n React.useLayoutEffect(() => {\n if (previousPinned.current === pinned) {\n return;\n }\n previousPinned.current = pinned;\n window.clearTimeout(pendingMorph.current?.timer);\n pendingMorph.current = null;\n if (!morph) {\n onPinnedMorphEndRef.current?.(pinned);\n return;\n }\n const timer = window.setTimeout(finishMorph, morphDuration + MORPH_END_GRACE);\n pendingMorph.current = { pinned, timer };\n }, [finishMorph, morph, morphDuration, pinned]);\n React.useEffect(() => () => window.clearTimeout(pendingMorph.current?.timer), []);\n\n // Floating open, the body scrolls once it has unfurled (a panel taller\n // than the viewport); while unfurling it's clipped.\n const [unfurled, setUnfurled] = React.useState(expanded);\n React.useEffect(() => {\n if (pinned || !expanded || !morph) {\n setUnfurled(expanded);\n }\n }, [expanded, morph, pinned]);\n\n // The floating open capsule's height (`auto`) on screen before the pin change\n const heightBefore = React.useRef<number | null>(null);\n const measureBeforePin = React.useCallback(() => {\n const capsule = capsuleRef.current;\n heightBefore.current =\n capsule?.style.height === 'auto' ? capsule.getBoundingClientRect().height : null;\n }, []);\n\n // Pinning the floating open panel, its height transitions from `auto`,\n // which interpolate-size resolves anew on every frame: should the body's\n // content grow meanwhile (e.g. another navigation rendered into it), the\n // start would leap past the pinned height and the capsule jump to it. It\n // starts from the height it had on screen instead.\n const capsuleTransitionsRef = React.useRef(capsuleTransitions);\n React.useLayoutEffect(() => {\n capsuleTransitionsRef.current = capsuleTransitions;\n });\n React.useLayoutEffect(() => {\n const from = heightBefore.current;\n heightBefore.current = null;\n const capsule = capsuleRef.current;\n const transitions = capsuleTransitionsRef.current;\n if (from === null || !capsule || !transitions.length) {\n return;\n }\n const { height, transitionProperty, transitionTimingFunction } = capsule.style;\n const others = transitions.filter(([property]) => property !== 'height');\n capsule.style.transitionProperty = others.map(([property]) => property).join(', ');\n capsule.style.transitionTimingFunction = others.map(([, easing]) => easing).join(', ');\n capsule.style.height = `${from}px`;\n // Lands the start height without a transition, the others starting theirs\n void getComputedStyle(capsule).height;\n capsule.style.transitionProperty = transitionProperty;\n capsule.style.transitionTimingFunction = transitionTimingFunction;\n capsule.style.height = height;\n }, [pinned]);\n\n // The body fills the pinned capsule, and keeps filling it while it shrinks\n // after unpinning, so the footer rides its bottom edge rather than jumping\n // up; by the end the capsule hugs the body, so letting go doesn't show.\n const [filled, setFilled] = React.useState(pinned);\n React.useEffect(() => {\n if (pinned || !morph) {\n setFilled(pinned);\n return;\n }\n const timer = window.setTimeout(() => setFilled(false), morphDuration);\n return () => window.clearTimeout(timer);\n }, [morph, morphDuration, pinned]);\n\n const state = pinned ? 'pinned' : open ? 'open' : 'closed';\n\n return (\n <div ref={ref} className=\"shrink-0 text-foreground\" data-state={state} role=\"navigation\">\n {/* Offsets the content while pinned */}\n <div aria-hidden=\"true\" className=\"h-full\" data-sidebar=\"gap\" style={{ width: gapWidth }} />\n <BeforePinCommit pinned={pinned} onBeforeCommit={measureBeforePin} />\n {/* The capsule plus, while floating open, a hover buffer to its right */}\n <div\n ref={wrapperRef}\n className={cn('fixed z-40 flex items-stretch', className)}\n style={{\n top: `calc(${OFFSET_TOP} + ${INSET}px)`,\n left: `calc(${OFFSET_LEFT} + ${INSET}px)`,\n ...style,\n }}\n onBlur={(event) => {\n onBlur?.(event);\n const next = event.relatedTarget;\n if (\n open &&\n next instanceof Node &&\n !event.currentTarget.contains(next) &&\n !wrapperRef.current?.querySelector(POPUP_TRIGGER_SELECTOR)\n ) {\n hide();\n }\n }}\n onFocus={(event) => {\n onFocus?.(event);\n if (!restoringFocus.current && event.target.matches(':focus-visible')) {\n show();\n }\n }}\n onMouseEnter={(event) => {\n onMouseEnter?.(event);\n updateHover({ capsule: true });\n }}\n onMouseLeave={(event) => {\n onMouseLeave?.(event);\n updateHover({ capsule: false });\n }}\n {...props}\n >\n <div\n ref={capsuleRef}\n className={cn(\n 'relative flex shrink-0 flex-col overflow-hidden [interpolate-size:allow-keywords]',\n GLASS,\n )}\n data-sidebar=\"sidebar\"\n data-slot=\"floating-sidebar\"\n data-state={state}\n style={{\n width: expanded ? openWidth : CLOSED_SIZE,\n // Open, `auto` (not undefined) so interpolate-size can transition it\n height: pinned ? PANEL_HEIGHT : expanded ? 'auto' : CLOSED_SIZE,\n maxHeight: PANEL_HEIGHT,\n // The width's bump dips a little below the circle as it closes;\n // it mustn't squeeze it, clipping the icon\n minWidth: CLOSED_SIZE,\n borderRadius: expanded ? OPEN_RADIUS : CLOSED_SIZE / 2,\n boxShadow: pinned ? SHADOW_PINNED : SHADOW_FLOAT,\n transitionProperty: morph\n ? capsuleTransitions.map(([property]) => property).join(', ')\n : 'none',\n transitionDuration: `${morphDuration}ms`,\n transitionTimingFunction: capsuleTransitions.map(([, easing]) => easing).join(', '),\n }}\n onTransitionEnd={(event) => {\n if (event.target === event.currentTarget && event.propertyName === 'height') {\n finishMorph();\n }\n }}\n >\n <GlassHighlight />\n\n {/* Laid out open in every state (the closed capsule clips it), so\n the morph never reflows it */}\n <div\n className=\"flex shrink-0 items-center\"\n data-slot=\"floating-sidebar-header\"\n style={{\n width: openWidth - 2,\n height: headerHeight,\n gap: sizes.gap,\n paddingLeft: PADDING,\n paddingRight: onPinnedChange\n ? PIN_BUTTON_RIGHT + PIN_BUTTON_SIZE + sizes.gap\n : PADDING,\n }}\n >\n {/* The circle's focus target: focusing or clicking it opens the\n panel. Pinned, it's only the icon. It holds the icon's place\n in the row. */}\n <button\n ref={triggerRef}\n aria-expanded={pinned ? undefined : open}\n aria-hidden={pinned || undefined}\n aria-label={label}\n className={cn(\n 'group relative shrink-0 outline-none',\n pinned ? 'cursor-default' : 'cursor-pointer',\n )}\n data-slot=\"floating-sidebar-trigger\"\n style={{ width: sizes.icon, height: sizes.icon }}\n tabIndex={pinned ? -1 : 0}\n type=\"button\"\n onClick={show}\n >\n {/* The icon at its closed size (crisp where it rests longest),\n scaled down into the row while open; closed, moved to the\n circle's centre and cropped round */}\n <span\n className=\"absolute top-0 left-0 overflow-hidden group-focus-visible:outline-2 group-focus-visible:outline-offset-2 group-focus-visible:outline-focus-ring group-focus-visible:outline-solid [&>*]:size-full [&>*]:object-cover\"\n data-slot=\"floating-sidebar-icon\"\n style={{\n width: sizes.circleIcon,\n height: sizes.circleIcon,\n transformOrigin: '0 0',\n // From the row's icon place to the circle's centre, in the\n // header row's coordinates (it starts inside the border)\n transform: expanded\n ? `translate(0px, 0px) scale(${sizes.icon / sizes.circleIcon})`\n : `translate(${closedIconOffset}px, ${closedIconOffset}px) scale(1)`,\n borderRadius: expanded ? '22%' : '50%',\n transitionProperty: morph ? 'transform, border-radius' : 'none',\n transitionDuration: `${morphDuration}ms`,\n transitionTimingFunction: glideEasing,\n }}\n >\n {icon}\n </span>\n </button>\n {/* Fades and slides in as the capsule grows, out as it shrinks */}\n <div\n ref={headerRef}\n className=\"flex min-w-0 flex-1 items-center gap-2\"\n style={{\n opacity: expanded ? 1 : 0,\n transform: expanded ? 'none' : 'translateX(-8px)',\n transitionProperty: morph ? 'opacity, transform' : 'none',\n transitionDuration: expanded ? '320ms' : '160ms',\n transitionDelay: expanded ? '90ms' : '0ms',\n transitionTimingFunction: FLOATING_SIDEBAR_SPRING,\n }}\n >\n {header}\n </div>\n </div>\n\n {/* Anchored to the capsule, so it tracks the right edge as the width animates */}\n {onPinnedChange && (\n <button\n ref={pinButtonRef}\n aria-hidden={pinLocked || undefined}\n aria-label={pinned ? unpinLabel : pinLabel}\n className={cn(\n 'absolute z-10 flex size-8 cursor-pointer items-center justify-center rounded-full text-muted-foreground transition-[opacity,color,background-color] duration-200 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:pointer-events-auto focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-focus-ring focus-visible:outline-hidden',\n // Follows the hover state, not pinning, so it hides when the\n // pointer leaves a pinned panel too\n open && !pinLocked\n ? 'pointer-events-auto opacity-100 delay-75'\n : 'pointer-events-none opacity-0',\n )}\n data-slot=\"floating-sidebar-pin\"\n style={{ top: (headerHeight - PIN_BUTTON_SIZE) / 2, right: PIN_BUTTON_RIGHT }}\n type=\"button\"\n onClick={() => onPinnedChange(!pinned)}\n >\n <Pin\n className=\"size-4\"\n strokeWidth={1.75}\n style={{\n transform: pinned ? 'rotate(45deg)' : 'rotate(0deg)',\n transitionProperty: reducedMotion ? 'none' : 'transform',\n transitionDuration: '300ms',\n transitionTimingFunction: FLOATING_SIDEBAR_SPRING,\n }}\n />\n </button>\n )}\n\n {/* Unfurls through grid rows 0fr → 1fr, whatever the body's\n height. One structure in every state, so pinning and unpinning\n animate it rather than swap its layout. */}\n <div\n ref={bodyRef}\n className={cn('grid min-h-0', filled && 'flex-1')}\n data-slot=\"floating-sidebar-body\"\n style={{\n gridTemplateRows: expanded ? '1fr' : '0fr',\n transitionProperty: morph ? 'grid-template-rows' : 'none',\n transitionDuration: UNFURL_DURATION,\n transitionTimingFunction: FLOATING_SIDEBAR_SPRING,\n }}\n onTransitionEnd={(event) => {\n if (\n event.target === event.currentTarget &&\n event.propertyName === 'grid-template-rows'\n ) {\n setUnfurled(expanded);\n }\n }}\n >\n {/* Filling the capsule, the body scrolls within itself (e.g. a\n scrolling SidebarContent above a footer) */}\n <div\n className={cn(\n 'min-h-0',\n filled\n ? 'flex flex-col overflow-hidden'\n : unfurled\n ? 'overflow-y-auto overscroll-contain'\n : 'overflow-hidden',\n )}\n >\n {/* The open width, so the content doesn't reflow as the capsule grows */}\n <div\n className={cn(\n 'flex flex-col pt-2 pb-4 transition-opacity duration-200',\n filled && 'min-h-0 flex-1',\n expanded ? 'opacity-100 delay-75' : 'opacity-0',\n bodyClassName,\n )}\n style={{ width: openWidth - 2, paddingLeft: PADDING, paddingRight: PADDING }}\n >\n {children}\n </div>\n </div>\n </div>\n </div>\n {expanded && !pinned && <div aria-hidden=\"true\" className=\"w-12 shrink-0\" />}\n </div>\n </div>\n );\n },\n);\nFloatingSidebar.displayName = 'FloatingSidebar';\n\nexport { FloatingSidebar };\nexport type { FloatingSidebarProps };\n"],"mappings":";;;;;;AAuCA,IAAM,kBAAkB;AAExB,IAAM,cAAc;AAEpB,IAAM,aAAa;AAGnB,IAAM,kBAAkB;AACxB,IAAM,QAAA;AACN,IAAM,cAAA;AACN,IAAM,cAAc;AAEpB,IAAM,eAAe;;;;;;;;;;;AAWrB,IAAM,QAAQ;CACZ,SAAS;EAAE,YAAY;EAAI,MAAM;EAAI,KAAK;CAAG;CAC7C,QAAQ;EAAE,YAAY;EAAI,MAAM;EAAI,KAAK;CAAE;AAC7C;AAGA,IAAM,UAAU;AAChB,IAAM,kBAAkB;AAExB,IAAM,mBAAmB;AAMzB,IAAM,aAAa;AACnB,IAAM,cAAc;AAGpB,IAAM,eAAe,gBAAgB,WAAW,kDAAwB,QAAQ,EAAE;;AAGlF,IAAM,QAAQ;;AAGd,IAAM,eAAe;;AAGrB,IAAM,gBA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cAAc"}
|
|
@@ -19,7 +19,7 @@ var selectTriggerVariants = cva("flex h-(--control-height) w-full items-center j
|
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
variant: "ghost",
|
|
22
|
-
className: "enabled:active:bg-button-
|
|
22
|
+
className: "enabled:active:bg-button-pressed enabled:aria-expanded:bg-button-pressed"
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
variant: "secondary",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-variants.js","names":[],"sources":["../../../src/components/ui/select-variants.ts"],"sourcesContent":["import { cva } from 'class-variance-authority';\n\nconst selectTriggerVariants = cva(\n 'flex h-(--control-height) w-full items-center justify-between px-3 py-2 text-control whitespace-nowrap hover:bg-button-hover data-[placeholder]:text-muted-foreground [&>span]:line-clamp-1',\n {\n variants: {\n variant: {\n default: '',\n ghost: 'border-transparent bg-transparent shadow-none',\n secondary:\n 'border-transparent bg-tab-active text-secondary-foreground shadow-none hover:bg-secondary',\n },\n shape: {\n rounded: 'rounded-control',\n pill: 'rounded-full',\n },\n },\n compoundVariants: [\n {\n variant: ['secondary', 'ghost'],\n className:\n 'enabled:active:shadow-control-pressed enabled:aria-expanded:shadow-control-pressed',\n },\n {\n variant: 'ghost',\n className: 'enabled:active:bg-button-
|
|
1
|
+
{"version":3,"file":"select-variants.js","names":[],"sources":["../../../src/components/ui/select-variants.ts"],"sourcesContent":["import { cva } from 'class-variance-authority';\n\nconst selectTriggerVariants = cva(\n 'flex h-(--control-height) w-full items-center justify-between px-3 py-2 text-control whitespace-nowrap hover:bg-button-hover data-[placeholder]:text-muted-foreground [&>span]:line-clamp-1',\n {\n variants: {\n variant: {\n default: '',\n ghost: 'border-transparent bg-transparent shadow-none',\n secondary:\n 'border-transparent bg-tab-active text-secondary-foreground shadow-none hover:bg-secondary',\n },\n shape: {\n rounded: 'rounded-control',\n pill: 'rounded-full',\n },\n },\n compoundVariants: [\n {\n variant: ['secondary', 'ghost'],\n className:\n 'enabled:active:shadow-control-pressed enabled:aria-expanded:shadow-control-pressed',\n },\n {\n variant: 'ghost',\n className: 'enabled:active:bg-button-pressed enabled:aria-expanded:bg-button-pressed',\n },\n {\n variant: 'secondary',\n className: 'enabled:active:bg-secondary enabled:aria-expanded:bg-secondary',\n },\n ],\n defaultVariants: {\n variant: 'default',\n shape: 'rounded',\n },\n },\n);\n\nexport { selectTriggerVariants };\n"],"mappings":";;AAEA,IAAM,wBAAwB,IAC5B,+LACA;CACE,UAAU;EACR,SAAS;GACP,SAAS;GACT,OAAO;GACP,WACE;EACJ;EACA,OAAO;GACL,SAAS;GACT,MAAM;EACR;CACF;CACA,kBAAkB;EAChB;GACE,SAAS,CAAC,aAAa,OAAO;GAC9B,WACE;EACJ;EACA;GACE,SAAS;GACT,WAAW;EACb;EACA;GACE,SAAS;GACT,WAAW;EACb;CACF;CACA,iBAAiB;EACf,SAAS;EACT,OAAO;CACT;AACF,CACF"}
|
|
@@ -18,7 +18,7 @@ var StickyFooter = ({ shiftY, height = 96, children, className, contentClassName
|
|
|
18
18
|
children
|
|
19
19
|
}),
|
|
20
20
|
/* @__PURE__ */ jsx("div", {
|
|
21
|
-
className: "sticky mx-2 block h-6 rounded-full shadow-[0_0_0_1px_color-mix(in_oklab,var(--
|
|
21
|
+
className: "sticky mx-2 block h-6 rounded-full shadow-[0_0_0_1px_color-mix(in_oklab,var(--border)_25%,transparent),0_-8px_16px_-3px_color-mix(in_oklab,var(--foreground)_8%,transparent)]",
|
|
22
22
|
style: { bottom: shiftY ? `calc(${shiftY} + ${height - 24}px)` : `${height - 24}px` }
|
|
23
23
|
})
|
|
24
24
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sticky-footer.js","names":[],"sources":["../../../src/components/ui/sticky-footer.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from 'react';\nimport { cn } from '@/lib/utils';\n\nexport interface StickyFooterProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {\n shiftY?: string;\n height?: number;\n children?: ReactNode;\n contentClassName?: string;\n}\n\n/** Keeps actions visible at the bottom of a scrolling surface. */\nexport const StickyFooter = ({\n shiftY,\n height = 96,\n children,\n className,\n contentClassName,\n style,\n ...props\n}: StickyFooterProps) => (\n <div\n className={cn('sticky z-[297] m-0 box-border w-full p-0', className)}\n style={{\n bottom: shiftY ? `calc(${shiftY} - 24px)` : '-24px',\n height: `${height + 24}px`,\n ...style,\n }}\n {...props}\n >\n <div className=\"sticky bottom-0 z-[298] block h-6 bg-background\" />\n <div\n className={cn(\n 'sticky bottom-0 z-[299] -mb-6 flex items-center justify-between bg-background',\n contentClassName,\n )}\n style={{ height }}\n >\n {children}\n </div>\n <div\n className=\"sticky mx-2 block h-6 rounded-full shadow-[0_0_0_1px_color-mix(in_oklab,var(--
|
|
1
|
+
{"version":3,"file":"sticky-footer.js","names":[],"sources":["../../../src/components/ui/sticky-footer.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from 'react';\nimport { cn } from '@/lib/utils';\n\nexport interface StickyFooterProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {\n shiftY?: string;\n height?: number;\n children?: ReactNode;\n contentClassName?: string;\n}\n\n/** Keeps actions visible at the bottom of a scrolling surface. */\nexport const StickyFooter = ({\n shiftY,\n height = 96,\n children,\n className,\n contentClassName,\n style,\n ...props\n}: StickyFooterProps) => (\n <div\n className={cn('sticky z-[297] m-0 box-border w-full p-0', className)}\n style={{\n bottom: shiftY ? `calc(${shiftY} - 24px)` : '-24px',\n height: `${height + 24}px`,\n ...style,\n }}\n {...props}\n >\n <div className=\"sticky bottom-0 z-[298] block h-6 bg-background\" />\n <div\n className={cn(\n 'sticky bottom-0 z-[299] -mb-6 flex items-center justify-between bg-background',\n contentClassName,\n )}\n style={{ height }}\n >\n {children}\n </div>\n <div\n className=\"sticky mx-2 block h-6 rounded-full shadow-[0_0_0_1px_color-mix(in_oklab,var(--border)_25%,transparent),0_-8px_16px_-3px_color-mix(in_oklab,var(--foreground)_8%,transparent)]\"\n style={{ bottom: shiftY ? `calc(${shiftY} + ${height - 24}px)` : `${height - 24}px` }}\n />\n </div>\n);\n"],"mappings":";;;;AAWA,IAAa,gBAAgB,EAC3B,QACA,SAAS,IACT,UACA,WACA,kBACA,OACA,GAAG,YAEH,qBAAC,OAAD;CACE,WAAW,GAAG,4CAA4C,SAAS;CACnE,OAAO;EACL,QAAQ,SAAS,QAAQ,OAAO,YAAY;EAC5C,QAAQ,GAAG,SAAS,GAAG;EACvB,GAAG;CACL;CACA,GAAI;WAPN;EASE,oBAAC,OAAD,EAAK,WAAU,kDAAmD,CAAA;EAClE,oBAAC,OAAD;GACE,WAAW,GACT,iFACA,gBACF;GACA,OAAO,EAAE,OAAO;GAEf;EACE,CAAA;EACL,oBAAC,OAAD;GACE,WAAU;GACV,OAAO,EAAE,QAAQ,SAAS,QAAQ,OAAO,KAAK,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI;EACrF,CAAA;CACE"}
|
package/es/components.js
CHANGED
|
@@ -71,9 +71,10 @@ import { DragIndicator, SortableList } from "./components/ui/sortable-list.js";
|
|
|
71
71
|
import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeadButton, TableHeader, TableRow } from "./components/ui/table.js";
|
|
72
72
|
import { tabsVariants } from "./components/ui/tabs-variants.js";
|
|
73
73
|
import { Textarea } from "./components/ui/textarea.js";
|
|
74
|
+
import { toast } from "./components/ui/toast.js";
|
|
74
75
|
import { ToggleGroup, ToggleGroupItem } from "./components/ui/toggle-group.js";
|
|
75
76
|
import { a as TwitterLogo, i as GoogleLogo, n as GhostLogo, o as XLogo, r as GhostOrb, t as FacebookLogo } from "./images-CUcakpOD.js";
|
|
76
77
|
import { TimePicker } from "./components/ui/time-picker.js";
|
|
77
78
|
import { tokenFieldClasses } from "./components/ui/token-field.js";
|
|
78
79
|
import { defaultFilter as commandDefaultFilter } from "cmdk";
|
|
79
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActionList, ActionListItem, ActionListItemActions, ActionListItemContent, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlignedAxisTick, AnimatedNumber, Avatar, AvatarFallback, AvatarImage, Badge, Banner, BarChartLoadingIndicator, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, CalendarDayButton, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, CodeEditor, Combobox, ComboboxContent, ComboboxTrigger, ComboboxValue, Command, CommandCheck, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CopyField, CopyFieldActions, CopyFieldContent, CopyFieldCopyButton, CopyFieldLabel, CopyFieldValue, DataList, DataListBar, DataListBody, DataListHead, DataListHeader, DataListItemContent, DataListItemValue, DataListItemValueAbs, DataListItemValuePerc, DataListRow, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DragIndicator, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Dropzone, EmptyBadge, EmptyCard, EmptyIndicator, FLOATING_SIDEBAR_BUMP, FLOATING_SIDEBAR_CLOSED_FOOTPRINT, FLOATING_SIDEBAR_CLOSED_SIZE, FLOATING_SIDEBAR_DURATION, FLOATING_SIDEBAR_EASE, FLOATING_SIDEBAR_EASE_DURATION, FLOATING_SIDEBAR_INSET, FLOATING_SIDEBAR_OPEN_WIDTH, FLOATING_SIDEBAR_SPRING, FacebookLogo, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, Flag, FloatingSidebar, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, GhostLogo, GhostOrb, GoogleLogo, HoverCard, HoverCardContent, HoverCardTrigger, IconComponents as Icon, Indicator, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Kbd, KbdGroup, Label, Link, LoadingIndicator, MultiSelectCombobox, Navbar, NavbarActions, NavbarNavigation, NoValueLabel, NoValueLabelIcon, PageMenu, PageMenuItem, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, PreviewChrome, RadioGroup, RadioGroupItem, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SimplePagination, SimplePaginationNavigation, SimplePaginationNextButton, SimplePaginationPages, SimplePaginationPreviousButton, Skeleton, SkeletonTable, SortableList, StickyFooter, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeadButton, TableHeader, TableRow, Tabs, TabsContent, TabsDropdownTrigger, TabsList, TabsTrigger, TabsTriggerCount, Textarea, TimePicker, Toaster, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TwitterLogo, XLogo, badgeVariants, bannerVariants, buttonVariants, cardVariants, commandDefaultFilter, dropzoneVariants, getFloatingSidebarGapWidth, getFloatingSidebarTiming, imageOverlayButton, imageOverlayButtonClasses, indicatorVariants, inputGroupVariants, inputSurface, inputSurfaceClasses, previewChromeVariants, radioGroupItemVariants, selectTriggerVariants, tabsVariants, tokenFieldClasses, useFormField, useSidebar };
|
|
80
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, ActionList, ActionListItem, ActionListItemActions, ActionListItemContent, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlignedAxisTick, AnimatedNumber, Avatar, AvatarFallback, AvatarImage, Badge, Banner, BarChartLoadingIndicator, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, CalendarDayButton, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, CodeEditor, Combobox, ComboboxContent, ComboboxTrigger, ComboboxValue, Command, CommandCheck, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, CopyField, CopyFieldActions, CopyFieldContent, CopyFieldCopyButton, CopyFieldLabel, CopyFieldValue, DataList, DataListBar, DataListBody, DataListHead, DataListHeader, DataListItemContent, DataListItemValue, DataListItemValueAbs, DataListItemValuePerc, DataListRow, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DragIndicator, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Dropzone, EmptyBadge, EmptyCard, EmptyIndicator, FLOATING_SIDEBAR_BUMP, FLOATING_SIDEBAR_CLOSED_FOOTPRINT, FLOATING_SIDEBAR_CLOSED_SIZE, FLOATING_SIDEBAR_DURATION, FLOATING_SIDEBAR_EASE, FLOATING_SIDEBAR_EASE_DURATION, FLOATING_SIDEBAR_INSET, FLOATING_SIDEBAR_OPEN_WIDTH, FLOATING_SIDEBAR_SPRING, FacebookLogo, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, Flag, FloatingSidebar, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, GhostLogo, GhostOrb, GoogleLogo, HoverCard, HoverCardContent, HoverCardTrigger, IconComponents as Icon, Indicator, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Kbd, KbdGroup, Label, Link, LoadingIndicator, MultiSelectCombobox, Navbar, NavbarActions, NavbarNavigation, NoValueLabel, NoValueLabelIcon, PageMenu, PageMenuItem, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, PreviewChrome, RadioGroup, RadioGroupItem, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SimplePagination, SimplePaginationNavigation, SimplePaginationNextButton, SimplePaginationPages, SimplePaginationPreviousButton, Skeleton, SkeletonTable, SortableList, StickyFooter, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeadButton, TableHeader, TableRow, Tabs, TabsContent, TabsDropdownTrigger, TabsList, TabsTrigger, TabsTriggerCount, Textarea, TimePicker, Toaster, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TwitterLogo, XLogo, badgeVariants, bannerVariants, buttonVariants, cardVariants, commandDefaultFilter, dropzoneVariants, getFloatingSidebarGapWidth, getFloatingSidebarTiming, imageOverlayButton, imageOverlayButtonClasses, indicatorVariants, inputGroupVariants, inputSurface, inputSurfaceClasses, previewChromeVariants, radioGroupItemVariants, selectTriggerVariants, tabsVariants, toast, tokenFieldClasses, useFormField, useSidebar };
|