@tryghost/shade 0.1.0-alpha.2 → 0.1.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -64
- package/es/components/page-templates/list-page.js +2 -1
- package/es/components/page-templates/list-page.js.map +1 -1
- package/es/components/patterns/filter-bar.js +4 -6
- package/es/components/patterns/filter-bar.js.map +1 -1
- package/es/components/patterns/filters.js +35 -22
- package/es/components/patterns/filters.js.map +1 -1
- package/es/components/patterns/gh-chart.js +6 -3
- package/es/components/patterns/gh-chart.js.map +1 -1
- package/es/components/patterns/image-upload.js +1 -3
- package/es/components/patterns/image-upload.js.map +1 -1
- package/es/components/patterns/page-header.js +18 -43
- package/es/components/patterns/page-header.js.map +1 -1
- package/es/components/patterns/share-modal.js +3 -15
- package/es/components/patterns/share-modal.js.map +1 -1
- package/es/components/ui/alert-dialog.js +2 -4
- package/es/components/ui/alert-dialog.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 +2 -33
- package/es/components/ui/button-variants.js.map +1 -1
- package/es/components/ui/button.js +1 -2
- package/es/components/ui/button.js.map +1 -1
- package/es/components/ui/calendar.js +5 -6
- package/es/components/ui/calendar.js.map +1 -1
- package/es/components/ui/chart.js +2 -29
- package/es/components/ui/chart.js.map +1 -1
- package/es/components/ui/combobox.js +2 -2
- package/es/components/ui/combobox.js.map +1 -1
- package/es/components/ui/copy-field.js +1 -3
- package/es/components/ui/copy-field.js.map +1 -1
- package/es/components/ui/data-list.js +1 -3
- package/es/components/ui/data-list.js.map +1 -1
- package/es/components/ui/dialog.js +32 -8
- package/es/components/ui/dialog.js.map +1 -1
- package/es/components/ui/dropzone-variants.js +1 -3
- package/es/components/ui/dropzone-variants.js.map +1 -1
- package/es/components/ui/dropzone.js +2 -2
- package/es/components/ui/dropzone.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/image-overlay-button.js +2 -2
- package/es/components/ui/image-overlay-button.js.map +1 -1
- package/es/components/ui/input-group.js +2 -5
- package/es/components/ui/input-group.js.map +1 -1
- package/es/components/ui/navbar.js +1 -3
- package/es/components/ui/navbar.js.map +1 -1
- package/es/components/ui/pagemenu.js +33 -9
- package/es/components/ui/pagemenu.js.map +1 -1
- package/es/components/ui/select-variants.js +2 -10
- package/es/components/ui/select-variants.js.map +1 -1
- package/es/components/ui/select.js +1 -4
- package/es/components/ui/select.js.map +1 -1
- package/es/components/ui/simple-pagination.js +4 -7
- package/es/components/ui/simple-pagination.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/ui/toggle-group.js +1 -3
- package/es/components/ui/toggle-group.js.map +1 -1
- package/es/components/ui/toggle-variants.js +1 -7
- package/es/components/ui/toggle-variants.js.map +1 -1
- package/es/components/ui/toggle.js +1 -2
- package/es/components/ui/toggle.js.map +1 -1
- package/es/components/ui/token-field.js +2 -2
- package/es/components/ui/token-field.js.map +1 -1
- package/es/components/ui/tooltip.js +8 -17
- package/es/components/ui/tooltip.js.map +1 -1
- package/es/components.js +3 -2
- package/es/index.js +3 -2
- package/es/lib/date-utils.js +151 -0
- package/es/lib/date-utils.js.map +1 -0
- package/es/lib/ds-utils.js +16 -72
- package/es/lib/ds-utils.js.map +1 -1
- package/es/lib/utils.js +3 -2
- package/es/providers/header-tooltip-provider.js +1 -4
- package/es/providers/header-tooltip-provider.js.map +1 -1
- package/es/providers/shade-context.js +1 -1
- package/es/providers/shade-context.js.map +1 -1
- package/es/providers/shade-provider.js +3 -3
- package/es/providers/shade-provider.js.map +1 -1
- package/es/shade-app.js +3 -3
- package/es/shade-app.js.map +1 -1
- package/es/shade-scope.js +2 -2
- package/es/shade-scope.js.map +1 -1
- package/es/tokens.js +0 -8
- package/es/tokens.js.map +1 -1
- package/es/utils.js +3 -2
- package/package.json +6 -6
- package/styles.css +6 -0
- package/tailwind.theme.css +201 -187
- package/theme-variables.css +289 -42
- package/types/components/page-templates/list-page.d.ts +2 -1
- package/types/components/page-templates/list-page.d.ts.map +1 -1
- package/types/components/patterns/filter-bar.d.ts.map +1 -1
- package/types/components/patterns/filters.d.ts +2 -4
- package/types/components/patterns/filters.d.ts.map +1 -1
- package/types/components/patterns/gh-chart.d.ts.map +1 -1
- package/types/components/patterns/image-upload.d.ts.map +1 -1
- package/types/components/patterns/page-header.d.ts +6 -11
- package/types/components/patterns/page-header.d.ts.map +1 -1
- package/types/components/patterns/share-modal.d.ts +1 -1
- package/types/components/patterns/share-modal.d.ts.map +1 -1
- package/types/components/ui/avatar.d.ts.map +1 -1
- package/types/components/ui/button-variants.d.ts +0 -1
- package/types/components/ui/button-variants.d.ts.map +1 -1
- package/types/components/ui/button.d.ts +1 -1
- package/types/components/ui/button.d.ts.map +1 -1
- package/types/components/ui/calendar.d.ts.map +1 -1
- package/types/components/ui/chart.d.ts +1 -17
- package/types/components/ui/chart.d.ts.map +1 -1
- package/types/components/ui/combobox.d.ts.map +1 -1
- package/types/components/ui/copy-field.d.ts.map +1 -1
- package/types/components/ui/data-list.d.ts.map +1 -1
- package/types/components/ui/dialog.d.ts +11 -2
- package/types/components/ui/dialog.d.ts.map +1 -1
- package/types/components/ui/dropzone-variants.d.ts +1 -1
- package/types/components/ui/dropzone-variants.d.ts.map +1 -1
- package/types/components/ui/image-overlay-button.d.ts +1 -1
- package/types/components/ui/image-overlay-button.d.ts.map +1 -1
- package/types/components/ui/input-group.d.ts.map +1 -1
- package/types/components/ui/navbar.d.ts.map +1 -1
- package/types/components/ui/pagemenu.d.ts +3 -0
- package/types/components/ui/pagemenu.d.ts.map +1 -1
- package/types/components/ui/select-variants.d.ts +0 -1
- package/types/components/ui/select-variants.d.ts.map +1 -1
- package/types/components/ui/select.d.ts +1 -1
- package/types/components/ui/select.d.ts.map +1 -1
- package/types/components/ui/simple-pagination.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/ui/toggle-group.d.ts +4 -6
- package/types/components/ui/toggle-group.d.ts.map +1 -1
- package/types/components/ui/toggle-variants.d.ts +0 -1
- package/types/components/ui/toggle-variants.d.ts.map +1 -1
- package/types/components/ui/toggle.d.ts +2 -3
- package/types/components/ui/toggle.d.ts.map +1 -1
- package/types/components/ui/token-field.d.ts +2 -2
- package/types/components/ui/token-field.d.ts.map +1 -1
- package/types/components/ui/tooltip.d.ts.map +1 -1
- package/types/components.d.ts +1 -0
- package/types/components.d.ts.map +1 -1
- package/types/lib/date-utils.d.ts +17 -0
- package/types/lib/date-utils.d.ts.map +1 -0
- package/types/lib/ds-utils.d.ts +2 -16
- package/types/lib/ds-utils.d.ts.map +1 -1
- package/types/lib/utils.d.ts +1 -0
- package/types/lib/utils.d.ts.map +1 -1
- package/types/providers/header-tooltip-provider.d.ts.map +1 -1
- package/types/providers/shade-context.d.ts +2 -1
- package/types/providers/shade-context.d.ts.map +1 -1
- package/types/providers/shade-provider.d.ts +1 -1
- package/types/providers/shade-provider.d.ts.map +1 -1
- package/types/shade-app.d.ts +5 -2
- package/types/shade-app.d.ts.map +1 -1
- package/types/tokens.d.ts +1 -1
- package/types/tokens.d.ts.map +1 -1
- package/types/utils.d.ts +2 -1
- package/types/utils.d.ts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy-field.js","names":[],"sources":["../../../src/components/ui/copy-field.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Inline, Stack, Text } from '@/components/primitives';\nimport { Button, type ButtonProps } from '@/components/ui/button';\nimport { inputSurface } from '@/components/ui/input-surface';\nimport { cn } from '@/lib/utils';\
|
|
1
|
+
{"version":3,"file":"copy-field.js","names":[],"sources":["../../../src/components/ui/copy-field.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Inline, Stack, Text } from '@/components/primitives';\nimport { Button, type ButtonProps } from '@/components/ui/button';\nimport { inputSurface } from '@/components/ui/input-surface';\nimport { cn } from '@/lib/utils';\n\ntype CopyFieldContextValue = {\n copied: boolean;\n copy: () => Promise<void>;\n disabled: boolean;\n labelId: string;\n value: string;\n};\n\nconst CopyFieldContext = React.createContext<CopyFieldContextValue | null>(null);\n\nfunction useCopyField() {\n const context = React.useContext(CopyFieldContext);\n\n if (!context) {\n throw new Error('CopyField subcomponents must be used within CopyField');\n }\n\n return context;\n}\n\ninterface CopyFieldProps extends React.HTMLAttributes<HTMLDivElement> {\n disabled?: boolean;\n value: string;\n}\n\nconst CopyField = React.forwardRef<HTMLDivElement, CopyFieldProps>(\n ({ children, className, disabled = false, value, ...props }, ref) => {\n const [copied, setCopied] = React.useState(false);\n const labelId = React.useId();\n const resetTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n\n React.useEffect(() => {\n setCopied(false);\n\n if (resetTimer.current) {\n clearTimeout(resetTimer.current);\n resetTimer.current = null;\n }\n }, [value]);\n\n React.useEffect(() => {\n return () => {\n if (resetTimer.current) {\n clearTimeout(resetTimer.current);\n }\n };\n }, []);\n\n const copy = React.useCallback(async () => {\n if (disabled) {\n return;\n }\n\n try {\n await navigator.clipboard.writeText(value);\n setCopied(true);\n\n if (resetTimer.current) {\n clearTimeout(resetTimer.current);\n }\n\n resetTimer.current = setTimeout(() => setCopied(false), 2000);\n } catch {\n setCopied(false);\n }\n }, [disabled, value]);\n\n const contextValue = React.useMemo(\n () => ({ copied, copy, disabled, labelId, value }),\n [copied, copy, disabled, labelId, value],\n );\n\n return (\n <CopyFieldContext.Provider value={contextValue}>\n <Stack\n ref={ref}\n className={cn('group/copy-field w-full', className)}\n data-disabled={disabled || undefined}\n data-slot=\"copy-field\"\n gap=\"xs\"\n {...props}\n >\n {children}\n </Stack>\n </CopyFieldContext.Provider>\n );\n },\n);\nCopyField.displayName = 'CopyField';\n\nconst CopyFieldLabel = React.forwardRef<HTMLElement, React.ComponentProps<typeof Text>>(\n ({ className, id, ...props }, ref) => {\n const { labelId } = useCopyField();\n\n return (\n <Text\n ref={ref}\n as=\"div\"\n className={cn(\n 'text-control! font-medium group-data-[disabled=true]/copy-field:opacity-50',\n className,\n )}\n data-slot=\"copy-field-label\"\n id={id || labelId}\n leading=\"snug\"\n {...props}\n />\n );\n },\n);\nCopyFieldLabel.displayName = 'CopyFieldLabel';\n\nconst CopyFieldContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n inputSurface('within'),\n 'group/copy-field-content relative flex h-(--control-height) w-full items-center overflow-hidden bg-control-readonly-surface px-3 py-1 group-data-[disabled=true]/copy-field:cursor-not-allowed group-data-[disabled=true]/copy-field:opacity-50',\n className,\n )}\n data-slot=\"copy-field-content\"\n {...props}\n />\n ),\n);\nCopyFieldContent.displayName = 'CopyFieldContent';\n\nconst CopyFieldValue = React.forwardRef<HTMLElement, React.ComponentProps<typeof Text>>(\n ({ children, className, ...props }, ref) => {\n const { disabled, labelId, value } = useCopyField();\n\n return (\n <Text\n ref={ref}\n aria-disabled={disabled || undefined}\n aria-labelledby={\n props['aria-label'] || props['aria-labelledby'] ? props['aria-labelledby'] : labelId\n }\n aria-readonly=\"true\"\n as=\"div\"\n className={cn('min-w-0 truncate pr-2 text-muted-foreground', className)}\n data-slot=\"copy-field-value\"\n leading=\"snug\"\n role=\"textbox\"\n tabIndex={disabled ? undefined : 0}\n {...props}\n >\n {children ?? value}\n </Text>\n );\n },\n);\nCopyFieldValue.displayName = 'CopyFieldValue';\n\nconst CopyFieldActions = React.forwardRef<HTMLElement, React.ComponentProps<typeof Inline>>(\n ({ className, ...props }, ref) => {\n return (\n <Inline\n ref={ref}\n className={cn(\n 'absolute top-1/2 right-[1px] -translate-y-1/2 gap-px bg-control-readonly-surface pl-1 transition-opacity md:pointer-events-none md:opacity-0 md:group-focus-within/copy-field-content:pointer-events-auto md:group-focus-within/copy-field-content:opacity-100 md:group-hover/copy-field-content:pointer-events-auto md:group-hover/copy-field-content:opacity-100 [&_button]:h-6 [&_button:not([data-slot=copy-field-copy-button])]:bg-control-readonly-surface [&_button:not([data-slot=copy-field-copy-button])]:hover:bg-secondary [&_button[data-control-shape=rounded]]:rounded-sm',\n className,\n )}\n data-slot=\"copy-field-actions\"\n gap=\"none\"\n {...props}\n />\n );\n },\n);\nCopyFieldActions.displayName = 'CopyFieldActions';\n\ninterface CopyFieldCopyButtonProps extends Omit<ButtonProps, 'children'> {\n children?: React.ReactNode;\n copiedLabel?: React.ReactNode;\n}\n\nconst CopyFieldCopyButton = React.forwardRef<HTMLButtonElement, CopyFieldCopyButtonProps>(\n ({ children = 'Copy', className, copiedLabel = 'Copied', disabled, onClick, ...props }, ref) => {\n const { copied, copy, disabled: fieldDisabled } = useCopyField();\n\n return (\n <Button\n ref={ref}\n className={cn(\n 'bg-surface-elevated hover:border-border-strong/40 hover:bg-surface-elevated',\n className,\n )}\n disabled={fieldDisabled || disabled}\n size=\"sm\"\n type=\"button\"\n variant=\"outline\"\n onClick={async (event) => {\n await copy();\n onClick?.(event);\n }}\n {...props}\n data-slot=\"copy-field-copy-button\"\n >\n {copied ? copiedLabel : children}\n </Button>\n );\n },\n);\nCopyFieldCopyButton.displayName = 'CopyFieldCopyButton';\n\nexport {\n CopyField,\n CopyFieldActions,\n CopyFieldContent,\n CopyFieldCopyButton,\n CopyFieldLabel,\n CopyFieldValue,\n};\nexport type { CopyFieldProps };\n"],"mappings":";;;;;;;;;AAeA,IAAM,mBAAmB,QAAM,cAA4C,IAAI;AAE/E,SAAS,eAAe;CACtB,MAAM,UAAU,QAAM,WAAW,gBAAgB;CAEjD,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,uDAAuD;CAGzE,OAAO;AACT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ACJ,aAAU;YAET,SAAS,cAAc;CAClB,CAAA;AAEZ,CACF;AACA,oBAAoB,cAAc"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { cn } from "../../lib/ds-utils.js";
|
|
2
|
-
import { useShade } from "../../providers/shade-context.js";
|
|
3
2
|
import React from "react";
|
|
4
3
|
import { jsx } from "react/jsx-runtime";
|
|
5
4
|
//#region src/components/ui/data-list.tsx
|
|
@@ -40,10 +39,9 @@ var DataListBody = React.forwardRef(({ children, className, ...props }, ref) =>
|
|
|
40
39
|
});
|
|
41
40
|
DataListBody.displayName = "DataListBody";
|
|
42
41
|
var DataListRow = React.forwardRef(({ children, className, ...props }, ref) => {
|
|
43
|
-
const { isAdmin7 } = useShade();
|
|
44
42
|
return /* @__PURE__ */ jsx("div", {
|
|
45
43
|
ref,
|
|
46
|
-
className: cn("group/row relative flex items-center justify-between gap-3 py-0.5 before:absolute before:-inset-x-0.5 before:inset-y-0.5 before:z-0 before:bg-muted/60 before:opacity-0 hover:before:opacity-100",
|
|
44
|
+
className: cn("group/row relative flex items-center justify-between gap-3 py-0.5 before:absolute before:-inset-x-0.5 before:inset-y-0.5 before:z-0 before:rounded-control before:bg-muted/60 before:opacity-0 hover:before:opacity-100", className),
|
|
47
45
|
...props,
|
|
48
46
|
children
|
|
49
47
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-list.js","names":[],"sources":["../../../src/components/ui/data-list.tsx"],"sourcesContent":["import { useShade } from '@/providers/shade-context';\nimport { cn } from '@/lib/utils';\nimport React from 'react';\n\n/* Data List main component\n/* -------------------------------------------------------------------------- */\ninterface DataListProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataList = React.forwardRef<HTMLDivElement, DataListProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div ref={ref} className={cn('flex flex-col items-stretch', className)} {...props}>\n {children}\n </div>\n );\n },\n);\n\nDataList.displayName = 'DataList';\n\n/* Header\n/* -------------------------------------------------------------------------- */\ninterface DataListHeaderProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListHeader = React.forwardRef<HTMLDivElement, DataListHeaderProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'flex items-center justify-between gap-2 border-b p-2 text-xs font-medium tracking-wide text-muted-foreground uppercase',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListHeader.displayName = 'DataListHeader';\n\n/* Head\n/* -------------------------------------------------------------------------- */\ninterface DataListHeadProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListHead = React.forwardRef<HTMLDivElement, DataListHeadProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div ref={ref} className={cn('', className)} {...props}>\n {children}\n </div>\n );\n },\n);\n\nDataListHead.displayName = 'DataListHead';\n\n/* Body\n/* -------------------------------------------------------------------------- */\ninterface DataListBodyProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListBody = React.forwardRef<HTMLDivElement, DataListBodyProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div ref={ref} className={cn('flex flex-col items-stretch pt-1.5', className)} {...props}>\n {children}\n </div>\n );\n },\n);\n\nDataListBody.displayName = 'DataListBody';\n\n/* Data row\n/* -------------------------------------------------------------------------- */\ninterface DataListRowProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListRow = React.forwardRef<HTMLDivElement, DataListRowProps>(\n ({ children, className, ...props }, ref) => {\n const { isAdmin7 } = useShade();\n return (\n <div\n ref={ref}\n className={cn(\n 'group/row relative flex items-center justify-between gap-3 py-0.5 before:absolute before:-inset-x-0.5 before:inset-y-0.5 before:z-0 before:bg-muted/60 before:opacity-0 hover:before:opacity-100',\n isAdmin7 ? 'before:rounded-control' : 'before:rounded-[6px]',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListRow.displayName = 'DataListRow';\n\n/* Bar\n/* -------------------------------------------------------------------------- */\ninterface DataListBarProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListBar = React.forwardRef<HTMLDivElement, DataListBarProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'absolute inset-x-0 inset-y-1 z-0 origin-left rounded-[4px] bg-state-info/10 transition-all group-hover/row:bg-state-info/25 dark:bg-state-info/20 dark:group-hover/row:bg-state-info/35',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListBar.displayName = 'DataListBar';\n\n/* List item content\n/* -------------------------------------------------------------------------- */\ninterface DataListItemContentProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListItemContent = React.forwardRef<HTMLDivElement, DataListItemContentProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'relative z-10 flex max-w-[calc(100%-32px)] min-w-0 items-center p-2 text-sm font-medium transition-[max-width] duration-300 ease-in-out group-hover/datalist:max-w-[calc(100%-100px)]',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListItemContent.displayName = 'DataListItemContent';\n\n/* Value\n/* -------------------------------------------------------------------------- */\ninterface DataListItemValueProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListItemValue = React.forwardRef<HTMLDivElement, DataListItemValueProps>(\n ({ children, className, ...props }, ref) => {\n // Apply animation styles when there are multiple children\n const childrenArray = React.Children.toArray(children);\n const hasMultipleChildren = childrenArray.length > 1;\n\n return (\n <div\n ref={ref}\n className={cn(\n 'z-10 flex items-center',\n // Apply animation styles when there are multiple children\n hasMultipleChildren &&\n '[&>[data-type=\"value-abs\"]]:transition-transform [&>[data-type=\"value-abs\"]]:duration-300 [&>[data-type=\"value-abs\"]]:group-hover/datalist:-translate-x-14',\n hasMultipleChildren &&\n '[&>[data-type=\"value-perc\"]]:invisible [&>[data-type=\"value-perc\"]]:absolute [&>[data-type=\"value-perc\"]]:right-0 [&>[data-type=\"value-perc\"]]:translate-x-14 [&>[data-type=\"value-perc\"]]:opacity-0 [&>[data-type=\"value-perc\"]]:transition-all [&>[data-type=\"value-perc\"]]:duration-300 [&>[data-type=\"value-perc\"]]:group-hover/datalist:visible [&>[data-type=\"value-perc\"]]:group-hover/datalist:translate-x-0 [&>[data-type=\"value-perc\"]]:group-hover/datalist:opacity-100',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListItemValue.displayName = 'DataListItemValue';\n\n/* Value absolute value, e.g. 996.178.341\n/* -------------------------------------------------------------------------- */\ninterface DataListItemValueAbsProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListItemValueAbs = React.forwardRef<HTMLDivElement, DataListItemValueAbsProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn('z-10 px-2 font-mono text-sm', className)}\n data-type=\"value-abs\"\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListItemValueAbs.displayName = 'DataListItemValueAbs';\n\n/* Value percentage value, e.g. 85%\n/* -------------------------------------------------------------------------- */\ninterface DataListItemValuePercProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListItemValuePerc = React.forwardRef<HTMLDivElement, DataListItemValuePercProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn('px-3 font-mono text-sm text-muted-foreground', className)}\n data-type=\"value-perc\"\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListItemValuePerc.displayName = 'DataListItemValuePerc';\n\n/* End of components\n/* -------------------------------------------------------------------------- */\nexport {\n DataList,\n DataListHeader,\n DataListHead,\n DataListBody,\n DataListRow,\n DataListBar,\n DataListItemContent,\n DataListItemValue,\n DataListItemValueAbs,\n DataListItemValuePerc,\n};\n"],"mappings":";;;;;AAWA,IAAM,WAAW,MAAM,YACpB,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EAAU;EAAK,WAAW,GAAG,+BAA+B,SAAS;EAAG,GAAI;EACzE;CACE,CAAA;AAET,CACF;AAEA,SAAS,cAAc;AASvB,IAAM,iBAAiB,MAAM,YAC1B,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GACT,0HACA,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,eAAe,cAAc;AAS7B,IAAM,eAAe,MAAM,YACxB,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EAAU;EAAK,WAAW,GAAG,IAAI,SAAS;EAAG,GAAI;EAC9C;CACE,CAAA;AAET,CACF;AAEA,aAAa,cAAc;AAS3B,IAAM,eAAe,MAAM,YACxB,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EAAU;EAAK,WAAW,GAAG,sCAAsC,SAAS;EAAG,GAAI;EAChF;CACE,CAAA;AAET,CACF;AAEA,aAAa,cAAc;AAS3B,IAAM,cAAc,MAAM,YACvB,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,MAAM,EAAE,aAAa,SAAS;CAC9B,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GACT,oMACA,WAAW,2BAA2B,wBACtC,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,YAAY,cAAc;AAS1B,IAAM,cAAc,MAAM,YACvB,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GACT,2LACA,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,YAAY,cAAc;AAS1B,IAAM,sBAAsB,MAAM,YAC/B,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GACT,yLACA,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,oBAAoB,cAAc;AASlC,IAAM,oBAAoB,MAAM,YAC7B,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAG1C,MAAM,sBADgB,MAAM,SAAS,QAAQ,QACjB,CAAA,CAAc,SAAS;CAEnD,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GACT,0BAEA,uBACE,oKACF,uBACE,0eACF,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,kBAAkB,cAAc;AAShC,IAAM,uBAAuB,MAAM,YAChC,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GAAG,+BAA+B,SAAS;EACtD,aAAU;EACV,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,qBAAqB,cAAc;AASnC,IAAM,wBAAwB,MAAM,YACjC,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GAAG,gDAAgD,SAAS;EACvE,aAAU;EACV,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,sBAAsB,cAAc"}
|
|
1
|
+
{"version":3,"file":"data-list.js","names":[],"sources":["../../../src/components/ui/data-list.tsx"],"sourcesContent":["import { cn } from '@/lib/utils';\nimport React from 'react';\n\n/* Data List main component\n/* -------------------------------------------------------------------------- */\ninterface DataListProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataList = React.forwardRef<HTMLDivElement, DataListProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div ref={ref} className={cn('flex flex-col items-stretch', className)} {...props}>\n {children}\n </div>\n );\n },\n);\n\nDataList.displayName = 'DataList';\n\n/* Header\n/* -------------------------------------------------------------------------- */\ninterface DataListHeaderProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListHeader = React.forwardRef<HTMLDivElement, DataListHeaderProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'flex items-center justify-between gap-2 border-b p-2 text-xs font-medium tracking-wide text-muted-foreground uppercase',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListHeader.displayName = 'DataListHeader';\n\n/* Head\n/* -------------------------------------------------------------------------- */\ninterface DataListHeadProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListHead = React.forwardRef<HTMLDivElement, DataListHeadProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div ref={ref} className={cn('', className)} {...props}>\n {children}\n </div>\n );\n },\n);\n\nDataListHead.displayName = 'DataListHead';\n\n/* Body\n/* -------------------------------------------------------------------------- */\ninterface DataListBodyProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListBody = React.forwardRef<HTMLDivElement, DataListBodyProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div ref={ref} className={cn('flex flex-col items-stretch pt-1.5', className)} {...props}>\n {children}\n </div>\n );\n },\n);\n\nDataListBody.displayName = 'DataListBody';\n\n/* Data row\n/* -------------------------------------------------------------------------- */\ninterface DataListRowProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListRow = React.forwardRef<HTMLDivElement, DataListRowProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'group/row relative flex items-center justify-between gap-3 py-0.5 before:absolute before:-inset-x-0.5 before:inset-y-0.5 before:z-0 before:rounded-control before:bg-muted/60 before:opacity-0 hover:before:opacity-100',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListRow.displayName = 'DataListRow';\n\n/* Bar\n/* -------------------------------------------------------------------------- */\ninterface DataListBarProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListBar = React.forwardRef<HTMLDivElement, DataListBarProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'absolute inset-x-0 inset-y-1 z-0 origin-left rounded-[4px] bg-state-info/10 transition-all group-hover/row:bg-state-info/25 dark:bg-state-info/20 dark:group-hover/row:bg-state-info/35',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListBar.displayName = 'DataListBar';\n\n/* List item content\n/* -------------------------------------------------------------------------- */\ninterface DataListItemContentProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListItemContent = React.forwardRef<HTMLDivElement, DataListItemContentProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'relative z-10 flex max-w-[calc(100%-32px)] min-w-0 items-center p-2 text-sm font-medium transition-[max-width] duration-300 ease-in-out group-hover/datalist:max-w-[calc(100%-100px)]',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListItemContent.displayName = 'DataListItemContent';\n\n/* Value\n/* -------------------------------------------------------------------------- */\ninterface DataListItemValueProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListItemValue = React.forwardRef<HTMLDivElement, DataListItemValueProps>(\n ({ children, className, ...props }, ref) => {\n // Apply animation styles when there are multiple children\n const childrenArray = React.Children.toArray(children);\n const hasMultipleChildren = childrenArray.length > 1;\n\n return (\n <div\n ref={ref}\n className={cn(\n 'z-10 flex items-center',\n // Apply animation styles when there are multiple children\n hasMultipleChildren &&\n '[&>[data-type=\"value-abs\"]]:transition-transform [&>[data-type=\"value-abs\"]]:duration-300 [&>[data-type=\"value-abs\"]]:group-hover/datalist:-translate-x-14',\n hasMultipleChildren &&\n '[&>[data-type=\"value-perc\"]]:invisible [&>[data-type=\"value-perc\"]]:absolute [&>[data-type=\"value-perc\"]]:right-0 [&>[data-type=\"value-perc\"]]:translate-x-14 [&>[data-type=\"value-perc\"]]:opacity-0 [&>[data-type=\"value-perc\"]]:transition-all [&>[data-type=\"value-perc\"]]:duration-300 [&>[data-type=\"value-perc\"]]:group-hover/datalist:visible [&>[data-type=\"value-perc\"]]:group-hover/datalist:translate-x-0 [&>[data-type=\"value-perc\"]]:group-hover/datalist:opacity-100',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListItemValue.displayName = 'DataListItemValue';\n\n/* Value absolute value, e.g. 996.178.341\n/* -------------------------------------------------------------------------- */\ninterface DataListItemValueAbsProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListItemValueAbs = React.forwardRef<HTMLDivElement, DataListItemValueAbsProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn('z-10 px-2 font-mono text-sm', className)}\n data-type=\"value-abs\"\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListItemValueAbs.displayName = 'DataListItemValueAbs';\n\n/* Value percentage value, e.g. 85%\n/* -------------------------------------------------------------------------- */\ninterface DataListItemValuePercProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListItemValuePerc = React.forwardRef<HTMLDivElement, DataListItemValuePercProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn('px-3 font-mono text-sm text-muted-foreground', className)}\n data-type=\"value-perc\"\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListItemValuePerc.displayName = 'DataListItemValuePerc';\n\n/* End of components\n/* -------------------------------------------------------------------------- */\nexport {\n DataList,\n DataListHeader,\n DataListHead,\n DataListBody,\n DataListRow,\n DataListBar,\n DataListItemContent,\n DataListItemValue,\n DataListItemValueAbs,\n DataListItemValuePerc,\n};\n"],"mappings":";;;;AAUA,IAAM,WAAW,MAAM,YACpB,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EAAU;EAAK,WAAW,GAAG,+BAA+B,SAAS;EAAG,GAAI;EACzE;CACE,CAAA;AAET,CACF;AAEA,SAAS,cAAc;AASvB,IAAM,iBAAiB,MAAM,YAC1B,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GACT,0HACA,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,eAAe,cAAc;AAS7B,IAAM,eAAe,MAAM,YACxB,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EAAU;EAAK,WAAW,GAAG,IAAI,SAAS;EAAG,GAAI;EAC9C;CACE,CAAA;AAET,CACF;AAEA,aAAa,cAAc;AAS3B,IAAM,eAAe,MAAM,YACxB,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EAAU;EAAK,WAAW,GAAG,sCAAsC,SAAS;EAAG,GAAI;EAChF;CACE,CAAA;AAET,CACF;AAEA,aAAa,cAAc;AAS3B,IAAM,cAAc,MAAM,YACvB,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GACT,2NACA,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,YAAY,cAAc;AAS1B,IAAM,cAAc,MAAM,YACvB,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GACT,2LACA,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,YAAY,cAAc;AAS1B,IAAM,sBAAsB,MAAM,YAC/B,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GACT,yLACA,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,oBAAoB,cAAc;AASlC,IAAM,oBAAoB,MAAM,YAC7B,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAG1C,MAAM,sBADgB,MAAM,SAAS,QAAQ,QACjB,CAAA,CAAc,SAAS;CAEnD,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GACT,0BAEA,uBACE,oKACF,uBACE,0eACF,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,kBAAkB,cAAc;AAShC,IAAM,uBAAuB,MAAM,YAChC,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GAAG,+BAA+B,SAAS;EACtD,aAAU;EACV,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,qBAAqB,cAAc;AASnC,IAAM,wBAAwB,MAAM,YACjC,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GAAG,gDAAgD,SAAS;EACvE,aAAU;EACV,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,sBAAsB,cAAc"}
|
|
@@ -1,25 +1,49 @@
|
|
|
1
1
|
import { cn } from "../../lib/ds-utils.js";
|
|
2
2
|
import { ShadeScope } from "../../shade-scope.js";
|
|
3
3
|
import * as React$1 from "react";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
6
6
|
//#region src/components/ui/dialog.tsx
|
|
7
|
-
var
|
|
7
|
+
var DialogModalContext = React$1.createContext(true);
|
|
8
|
+
var Dialog = ({ modal = true, ...props }) => /* @__PURE__ */ jsx(DialogModalContext.Provider, {
|
|
9
|
+
value: modal,
|
|
10
|
+
children: /* @__PURE__ */ jsx(DialogPrimitive.Root, {
|
|
11
|
+
modal,
|
|
12
|
+
...props
|
|
13
|
+
})
|
|
14
|
+
});
|
|
8
15
|
var DialogTrigger = DialogPrimitive.Trigger;
|
|
9
16
|
var DialogPortal = DialogPrimitive.Portal;
|
|
10
17
|
var DialogClose = DialogPrimitive.Close;
|
|
11
18
|
var DialogOverlay = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Overlay, {
|
|
12
19
|
ref,
|
|
13
20
|
className: cn("fixed inset-0 z-50 transform-gpu bg-black/30 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0 dark:bg-black/60", className),
|
|
21
|
+
"data-slot": "dialog-overlay",
|
|
14
22
|
...props
|
|
15
23
|
}));
|
|
16
24
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
var dialogPanelClassName = "z-50 grid w-full max-w-lg transform-gpu gap-6 bg-surface-elevated-2 p-6 shadow-lg outline-hidden duration-200 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95";
|
|
26
|
+
var DialogContent = React$1.forwardRef(({ className, children, scroll = "fixed", ...props }, ref) => {
|
|
27
|
+
const modal = React$1.useContext(DialogModalContext);
|
|
28
|
+
const panel = /* @__PURE__ */ jsx(DialogPrimitive.Content, {
|
|
29
|
+
ref,
|
|
30
|
+
className: cn(scroll === "overlay" ? "pointer-events-auto relative rounded-lg" : "fixed top-[8vmin] left-[50%] translate-x-[-50%] sm:rounded-lg", dialogPanelClassName, className),
|
|
31
|
+
...props,
|
|
32
|
+
children
|
|
33
|
+
});
|
|
34
|
+
const scrollingPanel = /* @__PURE__ */ jsx("div", {
|
|
35
|
+
className: "flex min-h-full items-start justify-center px-4 py-[8vmin]",
|
|
36
|
+
children: panel
|
|
37
|
+
});
|
|
38
|
+
return /* @__PURE__ */ jsx(DialogPortal, { children: /* @__PURE__ */ jsx(ShadeScope, { children: scroll === "overlay" ? modal ? /* @__PURE__ */ jsx(DialogOverlay, {
|
|
39
|
+
className: "overflow-y-auto duration-200",
|
|
40
|
+
children: scrollingPanel
|
|
41
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
42
|
+
className: "pointer-events-none fixed inset-0 z-50 overflow-y-auto",
|
|
43
|
+
"data-slot": "dialog-scroller",
|
|
44
|
+
children: scrollingPanel
|
|
45
|
+
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(DialogOverlay, {}), panel] }) }) });
|
|
46
|
+
});
|
|
23
47
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
24
48
|
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
25
49
|
className: cn("flex flex-col gap-y-1.5 text-center sm:text-left", className),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","names":[],"sources":["../../../src/components/ui/dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\n\nimport { cn } from '@/lib/utils';\nimport { ShadeScope } from '@/shade-scope';\n\nconst Dialog = DialogPrimitive.Root;\n\nconst DialogTrigger = DialogPrimitive.Trigger;\n\nconst DialogPortal = DialogPrimitive.Portal;\n\nconst DialogClose = DialogPrimitive.Close;\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n 'fixed inset-0 z-50 transform-gpu bg-black/30 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0 dark:bg-black/60',\n className,\n )}\n {...props}\n />\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\
|
|
1
|
+
{"version":3,"file":"dialog.js","names":[],"sources":["../../../src/components/ui/dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\n\nimport { cn } from '@/lib/utils';\nimport { ShadeScope } from '@/shade-scope';\n\n// Radix keeps whether a dialog is modal to itself, and the overlay scroll layout needs to know.\nconst DialogModalContext = React.createContext(true);\n\nconst Dialog = ({ modal = true, ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) => (\n <DialogModalContext.Provider value={modal}>\n <DialogPrimitive.Root modal={modal} {...props} />\n </DialogModalContext.Provider>\n);\n\nconst DialogTrigger = DialogPrimitive.Trigger;\n\nconst DialogPortal = DialogPrimitive.Portal;\n\nconst DialogClose = DialogPrimitive.Close;\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n 'fixed inset-0 z-50 transform-gpu bg-black/30 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0 dark:bg-black/60',\n className,\n )}\n data-slot=\"dialog-overlay\"\n {...props}\n />\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\n// The panel itself, shared by both ways a dialog can sit on the page.\nconst dialogPanelClassName =\n 'z-50 grid w-full max-w-lg transform-gpu gap-6 bg-surface-elevated-2 p-6 shadow-lg outline-hidden duration-200 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95';\n\nexport interface DialogContentProps extends React.ComponentPropsWithoutRef<\n typeof DialogPrimitive.Content\n> {\n /**\n * How a dialog taller than the window scrolls. `fixed` (the default) pins the dialog near\n * the top of the window, so it needs its own height limit and inner scroll. `overlay` makes\n * the backdrop the scroll container instead: the whole dialog scrolls as one piece, the way\n * a page does.\n */\n scroll?: 'fixed' | 'overlay';\n}\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n DialogContentProps\n>(({ className, children, scroll = 'fixed', ...props }, ref) => {\n const modal = React.useContext(DialogModalContext);\n\n const panel = (\n <DialogPrimitive.Content\n ref={ref}\n className={cn(\n scroll === 'overlay'\n ? 'pointer-events-auto relative rounded-lg'\n : 'fixed top-[8vmin] left-[50%] translate-x-[-50%] sm:rounded-lg',\n dialogPanelClassName,\n className,\n )}\n {...props}\n >\n {children}\n </DialogPrimitive.Content>\n );\n\n // The space around the dialog is padding on this wrapper, not on the scroll container:\n // browsers leave a scroll container's own bottom padding out of what it scrolls, which\n // would leave the dialog flush with the bottom of the window.\n const scrollingPanel = (\n <div className=\"flex min-h-full items-start justify-center px-4 py-[8vmin]\">{panel}</div>\n );\n\n return (\n <DialogPortal>\n <ShadeScope>\n {scroll === 'overlay' ? (\n modal ? (\n // The dialog sits inside the backdrop here, so the backdrop animates as long as the\n // dialog does; otherwise closing unmounts the dialog part-way through its animation.\n <DialogOverlay className=\"overflow-y-auto duration-200\">{scrollingPanel}</DialogOverlay>\n ) : (\n // Radix renders no backdrop for a non-modal dialog, and the page behind stays\n // usable, so this scroll container lets presses beside the dialog through.\n <div\n className=\"pointer-events-none fixed inset-0 z-50 overflow-y-auto\"\n data-slot=\"dialog-scroller\"\n >\n {scrollingPanel}\n </div>\n )\n ) : (\n <>\n <DialogOverlay />\n {panel}\n </>\n )}\n </ShadeScope>\n </DialogPortal>\n );\n});\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div className={cn('flex flex-col gap-y-1.5 text-center sm:text-left', className)} {...props} />\n);\nDialogHeader.displayName = 'DialogHeader';\n\nconst DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n 'flex flex-col-reverse sm:flex-row sm:items-end sm:justify-end sm:gap-2 [&_button]:min-w-20',\n className,\n )}\n {...props}\n />\n);\nDialogFooter.displayName = 'DialogFooter';\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn('text-xl leading-none font-semibold tracking-tight', className)}\n {...props}\n />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn('text-muted-foreground', className)}\n {...props}\n />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogTrigger,\n DialogClose,\n DialogContent,\n DialogHeader,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n};\n"],"mappings":";;;;;;AAOA,IAAM,qBAAqB,QAAM,cAAc,IAAI;AAEnD,IAAM,UAAU,EAAE,QAAQ,MAAM,GAAG,YACjC,oBAAC,mBAAmB,UAApB;CAA6B,OAAO;WAClC,oBAAC,gBAAgB,MAAjB;EAA6B;EAAO,GAAI;CAAQ,CAAA;AACrB,CAAA;AAG/B,IAAM,gBAAgB,gBAAgB;AAEtC,IAAM,eAAe,gBAAgB;AAErC,IAAM,cAAc,gBAAgB;AAEpC,IAAM,gBAAgB,QAAM,YAGzB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,gBAAgB,SAAjB;CACO;CACL,WAAW,GACT,yLACA,SACF;CACA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AAS,QAC1B,oBAAC,gBAAgB,aAAjB;CACO;CACL,WAAW,GAAG,yBAAyB,SAAS;CAChD,GAAI;AACL,CAAA,CACF;AACD,kBAAkB,cAAc,gBAAgB,YAAY"}
|
|
@@ -12,13 +12,11 @@ var dropzoneBaseVariants = cva("flex cursor-pointer flex-col items-center justif
|
|
|
12
12
|
} },
|
|
13
13
|
defaultVariants: { variant: "default" }
|
|
14
14
|
});
|
|
15
|
-
function dropzoneVariants(props = {},
|
|
15
|
+
function dropzoneVariants(props = {}, shape = "pill") {
|
|
16
16
|
return cn(dropzoneBaseVariants(props), props.variant === "button" && buttonVariants({
|
|
17
|
-
isAdmin7,
|
|
18
17
|
shape,
|
|
19
18
|
variant: "outline"
|
|
20
19
|
}), props.variant === "buttonSecondary" && buttonVariants({
|
|
21
|
-
isAdmin7,
|
|
22
20
|
shape,
|
|
23
21
|
size: "sm",
|
|
24
22
|
variant: "secondary"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropzone-variants.js","names":[],"sources":["../../../src/components/ui/dropzone-variants.ts"],"sourcesContent":["import { cva } from 'class-variance-authority';\nimport { buttonVariants } from '@/components/ui/button-variants';\nimport { inputSurface } from '@/components/ui/input-surface';\nimport { cn } from '@/lib/utils';\nimport type { ControlShape } from '@/providers/shade-context';\n\nconst dropzoneBaseVariants = cva(\n 'flex cursor-pointer flex-col items-center justify-center outline-hidden',\n {\n variants: {\n variant: {\n default: cn(\n inputSurface('self'),\n 'border-2 border-dashed bg-transparent p-10 hover:border-border-strong',\n ),\n filled: cn(\n inputSurface('self'),\n 'border-transparent bg-muted p-3 hover:bg-interactive-hover',\n ),\n button: 'flex-row',\n buttonSecondary: 'flex-row',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n },\n);\n\n// Keep the exported variants function useful outside the component, with current defaults.\nfunction dropzoneVariants(\n props: Parameters<typeof dropzoneBaseVariants>[0] = {},\n
|
|
1
|
+
{"version":3,"file":"dropzone-variants.js","names":[],"sources":["../../../src/components/ui/dropzone-variants.ts"],"sourcesContent":["import { cva } from 'class-variance-authority';\nimport { buttonVariants } from '@/components/ui/button-variants';\nimport { inputSurface } from '@/components/ui/input-surface';\nimport { cn } from '@/lib/utils';\nimport type { ControlShape } from '@/providers/shade-context';\n\nconst dropzoneBaseVariants = cva(\n 'flex cursor-pointer flex-col items-center justify-center outline-hidden',\n {\n variants: {\n variant: {\n default: cn(\n inputSurface('self'),\n 'border-2 border-dashed bg-transparent p-10 hover:border-border-strong',\n ),\n filled: cn(\n inputSurface('self'),\n 'border-transparent bg-muted p-3 hover:bg-interactive-hover',\n ),\n button: 'flex-row',\n buttonSecondary: 'flex-row',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n },\n);\n\n// Keep the exported variants function useful outside the component, with current defaults.\nfunction dropzoneVariants(\n props: Parameters<typeof dropzoneBaseVariants>[0] = {},\n shape: ControlShape = 'pill',\n) {\n return cn(\n dropzoneBaseVariants(props),\n props.variant === 'button' && buttonVariants({ shape, variant: 'outline' }),\n props.variant === 'buttonSecondary' &&\n buttonVariants({ shape, size: 'sm', variant: 'secondary' }),\n props.className,\n );\n}\n\nexport { dropzoneVariants };\n"],"mappings":";;;;;AAMA,IAAM,uBAAuB,IAC3B,2EACA;CACE,UAAU,EACR,SAAS;EACP,SAAS,GACP,aAAa,MAAM,GACnB,uEACF;EACA,QAAQ,GACN,aAAa,MAAM,GACnB,4DACF;EACA,QAAQ;EACR,iBAAiB;CACnB,EACF;CACA,iBAAiB,EACf,SAAS,UACX;AACF,CACF;AAGA,SAAS,iBACP,QAAoD,CAAC,GACrD,QAAsB,QACtB;CACA,OAAO,GACL,qBAAqB,KAAK,GAC1B,MAAM,YAAY,YAAY,eAAe;EAAE;EAAO,SAAS;CAAU,CAAC,GAC1E,MAAM,YAAY,qBAChB,eAAe;EAAE;EAAO,MAAM;EAAM,SAAS;CAAY,CAAC,GAC5D,MAAM,SACR;AACF"}
|
|
@@ -6,7 +6,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
import { useDropzone } from "react-dropzone";
|
|
7
7
|
//#region src/components/ui/dropzone.tsx
|
|
8
8
|
var Dropzone = React$1.forwardRef(({ accept, multiple = false, maxFiles = multiple ? 0 : 1, disabled = false, noDragEventsBubbling = false, inputId, inputAriaLabel, inputTestId, onDropAccepted, onDropRejected, variant, className, children, ...props }, ref) => {
|
|
9
|
-
const { controlShape
|
|
9
|
+
const { controlShape } = useShade();
|
|
10
10
|
const { getRootProps, getInputProps, rootRef, isDragActive, isDragAccept, isDragReject, isFocused, isFileDialogActive, open } = useDropzone({
|
|
11
11
|
accept,
|
|
12
12
|
multiple,
|
|
@@ -35,7 +35,7 @@ var Dropzone = React$1.forwardRef(({ accept, multiple = false, maxFiles = multip
|
|
|
35
35
|
tabIndex: disabled ? -1 : 0,
|
|
36
36
|
"aria-disabled": disabled,
|
|
37
37
|
"aria-invalid": isDragReject || void 0,
|
|
38
|
-
className: cn(dropzoneVariants({ variant },
|
|
38
|
+
className: cn(dropzoneVariants({ variant }, controlShape), disabled && "pointer-events-none cursor-not-allowed opacity-60", isDragReject && "border-state-danger bg-state-danger/10", isDragActive && !isDragReject && !disabled && "border-state-success bg-state-success/10", className)
|
|
39
39
|
});
|
|
40
40
|
return /* @__PURE__ */ jsxs("div", {
|
|
41
41
|
ref: setRootRefs,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropzone.js","names":[],"sources":["../../../src/components/ui/dropzone.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Accept, DropEvent, FileRejection, useDropzone } from 'react-dropzone';\nimport { type VariantProps } from 'class-variance-authority';\nimport { dropzoneVariants } from '@/components/ui/dropzone-variants';\nimport { useShade } from '@/providers/shade-context';\nimport { cn } from '@/lib/utils';\n\ntype DropzoneRenderProps = {\n isDragActive: boolean;\n isDragAccept: boolean;\n isDragReject: boolean;\n isFocused: boolean;\n isFileDialogActive: boolean;\n open: () => void;\n};\n\nexport interface DropzoneProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'children'>,\n VariantProps<typeof dropzoneVariants> {\n accept?: Accept;\n multiple?: boolean;\n maxFiles?: number;\n disabled?: boolean;\n noDragEventsBubbling?: boolean;\n inputId?: string;\n inputAriaLabel?: string;\n inputTestId?: string;\n onDropAccepted?: (files: File[], event: DropEvent) => void;\n onDropRejected?: (fileRejections: FileRejection[], event: DropEvent) => void;\n children?: React.ReactNode | ((props: DropzoneRenderProps) => React.ReactNode);\n}\n\nexport const Dropzone = React.forwardRef<HTMLDivElement, DropzoneProps>(\n (\n {\n accept,\n multiple = false,\n maxFiles = multiple ? 0 : 1,\n disabled = false,\n noDragEventsBubbling = false,\n inputId,\n inputAriaLabel,\n inputTestId,\n onDropAccepted,\n onDropRejected,\n variant,\n className,\n children,\n ...props\n },\n ref,\n ) => {\n const { controlShape
|
|
1
|
+
{"version":3,"file":"dropzone.js","names":[],"sources":["../../../src/components/ui/dropzone.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Accept, DropEvent, FileRejection, useDropzone } from 'react-dropzone';\nimport { type VariantProps } from 'class-variance-authority';\nimport { dropzoneVariants } from '@/components/ui/dropzone-variants';\nimport { useShade } from '@/providers/shade-context';\nimport { cn } from '@/lib/utils';\n\ntype DropzoneRenderProps = {\n isDragActive: boolean;\n isDragAccept: boolean;\n isDragReject: boolean;\n isFocused: boolean;\n isFileDialogActive: boolean;\n open: () => void;\n};\n\nexport interface DropzoneProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'children'>,\n VariantProps<typeof dropzoneVariants> {\n accept?: Accept;\n multiple?: boolean;\n maxFiles?: number;\n disabled?: boolean;\n noDragEventsBubbling?: boolean;\n inputId?: string;\n inputAriaLabel?: string;\n inputTestId?: string;\n onDropAccepted?: (files: File[], event: DropEvent) => void;\n onDropRejected?: (fileRejections: FileRejection[], event: DropEvent) => void;\n children?: React.ReactNode | ((props: DropzoneRenderProps) => React.ReactNode);\n}\n\nexport const Dropzone = React.forwardRef<HTMLDivElement, DropzoneProps>(\n (\n {\n accept,\n multiple = false,\n maxFiles = multiple ? 0 : 1,\n disabled = false,\n noDragEventsBubbling = false,\n inputId,\n inputAriaLabel,\n inputTestId,\n onDropAccepted,\n onDropRejected,\n variant,\n className,\n children,\n ...props\n },\n ref,\n ) => {\n const { controlShape } = useShade();\n const {\n getRootProps,\n getInputProps,\n rootRef,\n isDragActive,\n isDragAccept,\n isDragReject,\n isFocused,\n isFileDialogActive,\n open,\n } = useDropzone({\n accept,\n multiple,\n maxFiles,\n disabled,\n noDragEventsBubbling,\n onDropAccepted,\n onDropRejected,\n });\n\n const content =\n typeof children === 'function'\n ? children({\n isDragActive,\n isDragAccept,\n isDragReject,\n isFocused,\n isFileDialogActive,\n open,\n })\n : children;\n\n const setRootRefs = (element: HTMLDivElement | null) => {\n (rootRef as React.MutableRefObject<HTMLDivElement | null>).current = element;\n\n if (typeof ref === 'function') {\n ref(element);\n } else if (ref) {\n ref.current = element;\n }\n };\n\n const dropzoneRootProps = getRootProps({\n ...props,\n role: 'button',\n tabIndex: disabled ? -1 : 0,\n 'aria-disabled': disabled,\n 'aria-invalid': isDragReject || undefined,\n className: cn(\n dropzoneVariants({ variant }, controlShape),\n disabled && 'pointer-events-none cursor-not-allowed opacity-60',\n isDragReject && 'border-state-danger bg-state-danger/10',\n isDragActive && !isDragReject && !disabled && 'border-state-success bg-state-success/10',\n className,\n ),\n }) as React.HTMLAttributes<HTMLDivElement> & { ref?: React.Ref<HTMLDivElement> };\n\n // Destructure out the ref from getRootProps — we use setRootRefs instead\n const { ref: _, ...rootProps } = dropzoneRootProps; // eslint-disable-line @typescript-eslint/no-unused-vars\n\n return (\n <div ref={setRootRefs} {...rootProps}>\n <input\n {...getInputProps()}\n aria-label={inputAriaLabel}\n data-testid={inputTestId}\n id={inputId}\n />\n {content}\n </div>\n );\n },\n);\n\nDropzone.displayName = 'Dropzone';\n"],"mappings":";;;;;;;AAiCA,IAAa,WAAW,QAAM,YAE1B,EACE,QACA,WAAW,OACX,WAAW,WAAW,IAAI,GAC1B,WAAW,OACX,uBAAuB,OACvB,SACA,gBACA,aACA,gBACA,gBACA,SACA,WACA,UACA,GAAG,SAEL,QACG;CACH,MAAM,EAAE,iBAAiB,SAAS;CAClC,MAAM,EACJ,cACA,eACA,SACA,cACA,cACA,cACA,WACA,oBACA,SACE,YAAY;EACd;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,UACJ,OAAO,aAAa,aAChB,SAAS;EACP;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,IACD;CAEN,MAAM,eAAe,YAAmC;EACtD,QAA2D,UAAU;EAErE,IAAI,OAAO,QAAQ,YACjB,IAAI,OAAO;OACN,IAAI,KACT,IAAI,UAAU;CAElB;CAkBA,MAAM,EAAE,KAAK,GAAG,GAAG,cAhBO,aAAa;EACrC,GAAG;EACH,MAAM;EACN,UAAU,WAAW,KAAK;EAC1B,iBAAiB;EACjB,gBAAgB,gBAAgB,KAAA;EAChC,WAAW,GACT,iBAAiB,EAAE,QAAQ,GAAG,YAAY,GAC1C,YAAY,qDACZ,gBAAgB,0CAChB,gBAAgB,CAAC,gBAAgB,CAAC,YAAY,4CAC9C,SACF;CACF,CAGiC;CAEjC,OACE,qBAAC,OAAD;EAAK,KAAK;EAAa,GAAI;YAA3B,CACE,oBAAC,SAAD;GACE,GAAI,cAAc;GAClB,cAAY;GACZ,eAAa;GACb,IAAI;EACL,CAAA,GACA,OACE;;AAET,CACF;AAEA,SAAS,cAAc"}
|
|
@@ -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;A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E;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":";;;;;;AAuC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,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"}
|
|
@@ -5,8 +5,8 @@ var imageOverlayButtonClasses = {
|
|
|
5
5
|
pressed: "enabled:active:bg-surface-inverse enabled:active:text-surface-inverse-foreground enabled:aria-expanded:bg-surface-inverse enabled:aria-expanded:text-surface-inverse-foreground"
|
|
6
6
|
};
|
|
7
7
|
/** Keep image-overlay controls legible over the image in every button state. */
|
|
8
|
-
function imageOverlayButton(
|
|
9
|
-
return cn(imageOverlayButtonClasses.base,
|
|
8
|
+
function imageOverlayButton() {
|
|
9
|
+
return cn(imageOverlayButtonClasses.base, imageOverlayButtonClasses.pressed);
|
|
10
10
|
}
|
|
11
11
|
//#endregion
|
|
12
12
|
export { imageOverlayButton, imageOverlayButtonClasses };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-overlay-button.js","names":[],"sources":["../../../src/components/ui/image-overlay-button.ts"],"sourcesContent":["import { cn } from '@/lib/utils';\n\nexport const imageOverlayButtonClasses = {\n base: 'bg-surface-inverse text-surface-inverse-foreground hover:bg-surface-inverse/90 hover:text-surface-inverse-foreground',\n pressed:\n 'enabled:active:bg-surface-inverse enabled:active:text-surface-inverse-foreground enabled:aria-expanded:bg-surface-inverse enabled:aria-expanded:text-surface-inverse-foreground',\n} as const;\n\n/** Keep image-overlay controls legible over the image in every button state. */\nexport function imageOverlayButton(
|
|
1
|
+
{"version":3,"file":"image-overlay-button.js","names":[],"sources":["../../../src/components/ui/image-overlay-button.ts"],"sourcesContent":["import { cn } from '@/lib/utils';\n\nexport const imageOverlayButtonClasses = {\n base: 'bg-surface-inverse text-surface-inverse-foreground hover:bg-surface-inverse/90 hover:text-surface-inverse-foreground',\n pressed:\n 'enabled:active:bg-surface-inverse enabled:active:text-surface-inverse-foreground enabled:aria-expanded:bg-surface-inverse enabled:aria-expanded:text-surface-inverse-foreground',\n} as const;\n\n/** Keep image-overlay controls legible over the image in every button state. */\nexport function imageOverlayButton() {\n return cn(imageOverlayButtonClasses.base, imageOverlayButtonClasses.pressed);\n}\n"],"mappings":";;AAEA,IAAa,4BAA4B;CACvC,MAAM;CACN,SACE;AACJ;;AAGA,SAAgB,qBAAqB;CACnC,OAAO,GAAG,0BAA0B,MAAM,0BAA0B,OAAO;AAC7E"}
|