@constructive-io/ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/alert-dialog.d.ts +31 -0
- package/dist/components/alert-dialog.js +314 -0
- package/dist/components/alert-dialog.js.map +1 -0
- package/dist/components/alert.d.ts +14 -0
- package/dist/components/alert.js +38 -0
- package/dist/components/alert.js.map +1 -0
- package/dist/components/autocomplete.d.ts +28 -0
- package/dist/components/autocomplete.js +395 -0
- package/dist/components/autocomplete.js.map +1 -0
- package/dist/components/avatar.d.ts +13 -0
- package/dist/components/avatar.js +37 -0
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.d.ts +15 -0
- package/dist/components/badge.js +43 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/breadcrumb.d.ts +14 -0
- package/dist/components/breadcrumb.js +154 -0
- package/dist/components/breadcrumb.js.map +1 -0
- package/dist/components/button.d.ts +17 -0
- package/dist/components/button.js +62 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/calendar-rac.d.ts +13 -0
- package/dist/components/calendar-rac.js +82 -0
- package/dist/components/calendar-rac.js.map +1 -0
- package/dist/components/card.d.ts +19 -0
- package/dist/components/card.js +75 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/checkbox-group.d.ts +7 -0
- package/dist/components/checkbox-group.js +16 -0
- package/dist/components/checkbox-group.js.map +1 -0
- package/dist/components/checkbox.d.ts +8 -0
- package/dist/components/checkbox.js +67 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/collapsible.d.ts +54 -0
- package/dist/components/collapsible.js +121 -0
- package/dist/components/collapsible.js.map +1 -0
- package/dist/components/combobox.d.ts +44 -0
- package/dist/components/combobox.js +486 -0
- package/dist/components/combobox.js.map +1 -0
- package/dist/components/command.d.ts +43 -0
- package/dist/components/command.js +690 -0
- package/dist/components/command.js.map +1 -0
- package/dist/components/dialog.d.ts +35 -0
- package/dist/components/dialog.js +440 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/dock.d.ts +31 -0
- package/dist/components/dock.js +111 -0
- package/dist/components/dock.js.map +1 -0
- package/dist/components/drawer.d.ts +16 -0
- package/dist/components/drawer.js +147 -0
- package/dist/components/drawer.js.map +1 -0
- package/dist/components/dropdown-menu.d.ts +50 -0
- package/dist/components/dropdown-menu.js +380 -0
- package/dist/components/dropdown-menu.js.map +1 -0
- package/dist/components/field.d.ts +51 -0
- package/dist/components/field.js +115 -0
- package/dist/components/field.js.map +1 -0
- package/dist/components/flickering-grid.d.ts +15 -0
- package/dist/components/flickering-grid.js +147 -0
- package/dist/components/flickering-grid.js.map +1 -0
- package/dist/components/form-control.d.ts +15 -0
- package/dist/components/form-control.js +173 -0
- package/dist/components/form-control.js.map +1 -0
- package/dist/components/form.d.ts +37 -0
- package/dist/components/form.js +179 -0
- package/dist/components/form.js.map +1 -0
- package/dist/components/input-group.d.ts +18 -0
- package/dist/components/input-group.js +177 -0
- package/dist/components/input-group.js.map +1 -0
- package/dist/components/input.d.ts +11 -0
- package/dist/components/input.js +60 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/json-input.d.ts +25 -0
- package/dist/components/json-input.js +351 -0
- package/dist/components/json-input.js.map +1 -0
- package/dist/components/label.d.ts +11 -0
- package/dist/components/label.js +27 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/motion-grid.d.ts +20 -0
- package/dist/components/motion-grid.js +81 -0
- package/dist/components/motion-grid.js.map +1 -0
- package/dist/components/multi-select.d.ts +198 -0
- package/dist/components/multi-select.js +882 -0
- package/dist/components/multi-select.js.map +1 -0
- package/dist/components/page-header.d.ts +17 -0
- package/dist/components/page-header.js +17 -0
- package/dist/components/page-header.js.map +1 -0
- package/dist/components/pagination.d.ts +19 -0
- package/dist/components/pagination.js +144 -0
- package/dist/components/pagination.js.map +1 -0
- package/dist/components/popover.d.ts +35 -0
- package/dist/components/popover.js +188 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/portal.d.ts +108 -0
- package/dist/components/portal.js +75 -0
- package/dist/components/portal.js.map +1 -0
- package/dist/components/progress.d.ts +10 -0
- package/dist/components/progress.js +30 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/progressive-blur-scroll-container.d.ts +25 -0
- package/dist/components/progressive-blur-scroll-container.js +142 -0
- package/dist/components/progressive-blur-scroll-container.js.map +1 -0
- package/dist/components/progressive-blur.d.ts +16 -0
- package/dist/components/progressive-blur.js +68 -0
- package/dist/components/progressive-blur.js.map +1 -0
- package/dist/components/radio-group.d.ts +10 -0
- package/dist/components/radio-group.js +37 -0
- package/dist/components/radio-group.js.map +1 -0
- package/dist/components/record-picker.d.ts +16 -0
- package/dist/components/record-picker.js +366 -0
- package/dist/components/record-picker.js.map +1 -0
- package/dist/components/resizable.d.ts +11 -0
- package/dist/components/resizable.js +52 -0
- package/dist/components/resizable.js.map +1 -0
- package/dist/components/responsive-diagram.d.ts +10 -0
- package/dist/components/responsive-diagram.js +63 -0
- package/dist/components/responsive-diagram.js.map +1 -0
- package/dist/components/scroll-area.d.ts +12 -0
- package/dist/components/scroll-area.js +69 -0
- package/dist/components/scroll-area.js.map +1 -0
- package/dist/components/select.d.ts +47 -0
- package/dist/components/select.js +287 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/separator.d.ts +11 -0
- package/dist/components/separator.js +24 -0
- package/dist/components/separator.js.map +1 -0
- package/dist/components/sheet.d.ts +112 -0
- package/dist/components/sheet.js +600 -0
- package/dist/components/sheet.js.map +1 -0
- package/dist/components/sidebar.d.ts +77 -0
- package/dist/components/sidebar.js +1217 -0
- package/dist/components/sidebar.js.map +1 -0
- package/dist/components/skeleton.d.ts +7 -0
- package/dist/components/skeleton.js +16 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/sonner.d.ts +10 -0
- package/dist/components/sonner.js +23 -0
- package/dist/components/sonner.js.map +1 -0
- package/dist/components/stack/index.d.ts +663 -0
- package/dist/components/stack/index.js +1418 -0
- package/dist/components/stack/index.js.map +1 -0
- package/dist/components/stepper.d.ts +30 -0
- package/dist/components/stepper.js +280 -0
- package/dist/components/stepper.js.map +1 -0
- package/dist/components/switch.d.ts +8 -0
- package/dist/components/switch.js +40 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/table.d.ts +15 -0
- package/dist/components/table.js +65 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +10 -0
- package/dist/components/tabs.js +48 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/tags.d.ts +42 -0
- package/dist/components/tags.js +728 -0
- package/dist/components/tags.js.map +1 -0
- package/dist/components/textarea.d.ts +10 -0
- package/dist/components/textarea.js +54 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/toast/index.d.ts +52 -0
- package/dist/components/toast/index.js +221 -0
- package/dist/components/toast/index.js.map +1 -0
- package/dist/components/tooltip.d.ts +29 -0
- package/dist/components/tooltip.js +174 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/components/unlink-button.d.ts +14 -0
- package/dist/components/unlink-button.js +91 -0
- package/dist/components/unlink-button.js.map +1 -0
- package/dist/index.cjs +7692 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2157 -0
- package/dist/index.d.ts +2157 -0
- package/dist/index.js +7375 -0
- package/dist/index.js.map +1 -0
- package/package.json +490 -0
- package/src/styles/globals.css +397 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/utils.ts","../../src/components/progressive-blur.tsx","../../src/components/progressive-blur-scroll-container.tsx"],"names":["jsxs","jsx"],"mappings":"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","file":"progressive-blur-scroll-container.js","sourcesContent":["import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","'use client';\n\nimport React from 'react';\n\nimport { cn } from '../lib/utils';\n\nexport interface ProgressiveBlurProps {\n\tclassName?: string;\n\theight?: string;\n\tposition?: 'top' | 'bottom' | 'both';\n\t/** Strength of the blur kernel in pixels (simpler, fewer artifacts) */\n\tblurPx?: number;\n\tsurface?: 'background' | 'card' | 'sidebar';\n\tintensity?: number;\n\t/** Optional horizontal inset to avoid edge bleeding (e.g. '0.5rem') */\n\tinsetX?: string;\n}\n\nexport function ProgressiveBlur({\n\tclassName,\n\theight = '24%',\n\tposition = 'bottom',\n\tblurPx = 8,\n\tsurface = 'background',\n\tintensity = 0.3,\n\tinsetX = '0',\n}: ProgressiveBlurProps) {\n\tconst isBottom = position === 'bottom';\n\tconst isTop = position === 'top';\n\tconst clampedIntensity = Math.max(0, Math.min(1, intensity));\n\tconst surfaceVar = surface === 'card' ? '--card' : surface === 'sidebar' ? '--sidebar' : '--background';\n\n\t// Vertical-only blur layer with a smooth single gradient mask\n\tconst mask = isBottom\n\t\t? 'linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 75%, rgba(0,0,0,1) 100%)'\n\t\t: isTop\n\t\t\t? 'linear-gradient(to top, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 75%, rgba(0,0,0,1) 100%)'\n\t\t\t: 'linear-gradient(rgba(0,0,0,0) 0%, rgba(0,0,0,1) 95%, rgba(0,0,0,0) 100%)';\n\n\tconst overlayMask = isBottom\n\t\t? `linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,${clampedIntensity}) 55%, rgba(0,0,0,1) 85%, rgba(0,0,0,1) 100%)`\n\t\t: isTop\n\t\t\t? `linear-gradient(to top, rgba(0,0,0,0) 0%, rgba(0,0,0,${clampedIntensity}) 55%, rgba(0,0,0,1) 85%, rgba(0,0,0,1) 100%)`\n\t\t\t: `linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,${clampedIntensity}) 25%, rgba(0,0,0,1) 50%, rgba(0,0,0,${clampedIntensity}) 75%, rgba(0,0,0,0) 100%)`;\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cn(\n\t\t\t\t'pointer-events-none absolute inset-x-0 z-10 overflow-hidden',\n\t\t\t\tclassName,\n\t\t\t\tisTop ? 'top-0' : isBottom ? 'bottom-0' : 'inset-y-0',\n\t\t\t)}\n\t\t\tstyle={{\n\t\t\t\theight: position === 'both' ? '100%' : height,\n\t\t\t\tleft: insetX,\n\t\t\t\tright: insetX,\n\t\t\t}}\n\t\t>\n\t\t\t{/* Backdrop blur with vertical mask only (no horizontal bleeding) */}\n\t\t\t<div\n\t\t\t\tclassName='absolute inset-0'\n\t\t\t\tstyle={{\n\t\t\t\t\tbackdropFilter: `blur(${blurPx}px)`,\n\t\t\t\t\tWebkitBackdropFilter: `blur(${blurPx}px)`,\n\t\t\t\t\tmaskImage: mask,\n\t\t\t\t\tWebkitMaskImage: mask,\n\t\t\t\t}}\n\t\t\t/>\n\n\t\t\t{/* Color overlay: gradient from transparent to solid background for seamless blending */}\n\t\t\t<div\n\t\t\t\tclassName={cn('absolute inset-0')}\n\t\t\t\tstyle={{\n\t\t\t\t\tbackgroundColor: `var(${surfaceVar})`,\n\t\t\t\t\tmaskImage: overlayMask,\n\t\t\t\t\tWebkitMaskImage: overlayMask,\n\t\t\t\t}}\n\t\t\t/>\n\t\t</div>\n\t);\n}\n","'use client';\n\nimport { useCallback, useEffect, useRef, useState, type ReactNode } from 'react';\n\nimport { cn } from '../lib/utils';\n\nimport { ProgressiveBlur, type ProgressiveBlurProps } from './progressive-blur';\n\nexport interface ProgressiveBlurScrollContainerProps {\n\tchildren: ReactNode;\n\tclassName?: string;\n\t/** Class name for the scrollable inner div */\n\tscrollClassName?: string;\n\t/** Minimum number of items to show blur (prevents blur on sparse content) */\n\tminItemsForBlur?: number;\n\t/** Current item count for minItemsForBlur check */\n\titemCount?: number;\n\t/** Props to pass to ProgressiveBlur */\n\tblurProps?: Partial<ProgressiveBlurProps>;\n\t/** Whether to show blur (in addition to overflow check) */\n\tshowBlur?: boolean;\n}\n\n/**\n * A scrollable container that shows progressive blur effects at the top and bottom\n * when content overflows. Top blur appears when scrolled, bottom blur when more content below.\n */\nexport function ProgressiveBlurScrollContainer({\n\tchildren,\n\tclassName,\n\tscrollClassName,\n\tminItemsForBlur = 0,\n\titemCount = 0,\n\tblurProps,\n\tshowBlur = true,\n}: ProgressiveBlurScrollContainerProps) {\n\tconst [hasOverflow, setHasOverflow] = useState(false);\n\tconst [isScrolledFromTop, setIsScrolledFromTop] = useState(false);\n\tconst [isScrolledFromBottom, setIsScrolledFromBottom] = useState(true);\n\tconst scrollRef = useRef<HTMLDivElement>(null);\n\n\tconst checkScrollPosition = useCallback(() => {\n\t\tif (scrollRef.current) {\n\t\t\tconst el = scrollRef.current;\n\t\t\tconst scrollTop = el.scrollTop;\n\t\t\tconst scrollHeight = el.scrollHeight;\n\t\t\tconst clientHeight = el.clientHeight;\n\n\t\t\t// Show top blur if scrolled more than 10px from top\n\t\t\tsetIsScrolledFromTop(scrollTop > 10);\n\t\t\t// Show bottom blur if not scrolled to bottom (with 10px threshold)\n\t\t\tsetIsScrolledFromBottom(scrollTop + clientHeight < scrollHeight - 10);\n\t\t}\n\t}, []);\n\n\tuseEffect(() => {\n\t\tconst checkOverflow = () => {\n\t\t\tif (scrollRef.current) {\n\t\t\t\tconst el = scrollRef.current;\n\t\t\t\tsetHasOverflow(el.scrollHeight > el.clientHeight);\n\t\t\t\tcheckScrollPosition();\n\t\t\t}\n\t\t};\n\t\tcheckOverflow();\n\t\twindow.addEventListener('resize', checkOverflow);\n\t\treturn () => window.removeEventListener('resize', checkOverflow);\n\t}, [children, checkScrollPosition]);\n\n\t// Listen to scroll events\n\tuseEffect(() => {\n\t\tconst el = scrollRef.current;\n\t\tif (!el) return;\n\n\t\tel.addEventListener('scroll', checkScrollPosition, { passive: true });\n\t\treturn () => el.removeEventListener('scroll', checkScrollPosition);\n\t}, [checkScrollPosition]);\n\n\tconst canShowBlur = showBlur && hasOverflow && (minItemsForBlur === 0 || itemCount > minItemsForBlur);\n\n\treturn (\n\t\t<div className={cn('relative min-h-0 flex-1', className)}>\n\t\t\t<div\n\t\t\t\tref={scrollRef}\n\t\t\t\tclassName={cn('absolute inset-0 overflow-y-auto', scrollClassName)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t\t{canShowBlur && isScrolledFromTop && (\n\t\t\t\t<ProgressiveBlur\n\t\t\t\t\tposition='top'\n\t\t\t\t\theight='48px'\n\t\t\t\t\tsurface='background'\n\t\t\t\t\tintensity={0.2}\n\t\t\t\t\t{...blurProps}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{canShowBlur && isScrolledFromBottom && (\n\t\t\t\t<ProgressiveBlur\n\t\t\t\t\tposition='bottom'\n\t\t\t\t\theight='64px'\n\t\t\t\t\tsurface='background'\n\t\t\t\t\tintensity={0.25}\n\t\t\t\t\t{...blurProps}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface ProgressiveBlurProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
height?: string;
|
|
6
|
+
position?: 'top' | 'bottom' | 'both';
|
|
7
|
+
/** Strength of the blur kernel in pixels (simpler, fewer artifacts) */
|
|
8
|
+
blurPx?: number;
|
|
9
|
+
surface?: 'background' | 'card' | 'sidebar';
|
|
10
|
+
intensity?: number;
|
|
11
|
+
/** Optional horizontal inset to avoid edge bleeding (e.g. '0.5rem') */
|
|
12
|
+
insetX?: string;
|
|
13
|
+
}
|
|
14
|
+
declare function ProgressiveBlur({ className, height, position, blurPx, surface, intensity, insetX, }: ProgressiveBlurProps): react_jsx_runtime.JSX.Element;
|
|
15
|
+
|
|
16
|
+
export { ProgressiveBlur, type ProgressiveBlurProps };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { twMerge } from 'tailwind-merge';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
function cn(...inputs) {
|
|
7
|
+
return twMerge(clsx(inputs));
|
|
8
|
+
}
|
|
9
|
+
function ProgressiveBlur({
|
|
10
|
+
className,
|
|
11
|
+
height = "24%",
|
|
12
|
+
position = "bottom",
|
|
13
|
+
blurPx = 8,
|
|
14
|
+
surface = "background",
|
|
15
|
+
intensity = 0.3,
|
|
16
|
+
insetX = "0"
|
|
17
|
+
}) {
|
|
18
|
+
const isBottom = position === "bottom";
|
|
19
|
+
const isTop = position === "top";
|
|
20
|
+
const clampedIntensity = Math.max(0, Math.min(1, intensity));
|
|
21
|
+
const surfaceVar = surface === "card" ? "--card" : surface === "sidebar" ? "--sidebar" : "--background";
|
|
22
|
+
const mask = isBottom ? "linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 75%, rgba(0,0,0,1) 100%)" : isTop ? "linear-gradient(to top, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 75%, rgba(0,0,0,1) 100%)" : "linear-gradient(rgba(0,0,0,0) 0%, rgba(0,0,0,1) 95%, rgba(0,0,0,0) 100%)";
|
|
23
|
+
const overlayMask = isBottom ? `linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,${clampedIntensity}) 55%, rgba(0,0,0,1) 85%, rgba(0,0,0,1) 100%)` : isTop ? `linear-gradient(to top, rgba(0,0,0,0) 0%, rgba(0,0,0,${clampedIntensity}) 55%, rgba(0,0,0,1) 85%, rgba(0,0,0,1) 100%)` : `linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,${clampedIntensity}) 25%, rgba(0,0,0,1) 50%, rgba(0,0,0,${clampedIntensity}) 75%, rgba(0,0,0,0) 100%)`;
|
|
24
|
+
return /* @__PURE__ */ jsxs(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
className: cn(
|
|
28
|
+
"pointer-events-none absolute inset-x-0 z-10 overflow-hidden",
|
|
29
|
+
className,
|
|
30
|
+
isTop ? "top-0" : isBottom ? "bottom-0" : "inset-y-0"
|
|
31
|
+
),
|
|
32
|
+
style: {
|
|
33
|
+
height: position === "both" ? "100%" : height,
|
|
34
|
+
left: insetX,
|
|
35
|
+
right: insetX
|
|
36
|
+
},
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ jsx(
|
|
39
|
+
"div",
|
|
40
|
+
{
|
|
41
|
+
className: "absolute inset-0",
|
|
42
|
+
style: {
|
|
43
|
+
backdropFilter: `blur(${blurPx}px)`,
|
|
44
|
+
WebkitBackdropFilter: `blur(${blurPx}px)`,
|
|
45
|
+
maskImage: mask,
|
|
46
|
+
WebkitMaskImage: mask
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
/* @__PURE__ */ jsx(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
className: cn("absolute inset-0"),
|
|
54
|
+
style: {
|
|
55
|
+
backgroundColor: `var(${surfaceVar})`,
|
|
56
|
+
maskImage: overlayMask,
|
|
57
|
+
WebkitMaskImage: overlayMask
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { ProgressiveBlur };
|
|
67
|
+
//# sourceMappingURL=progressive-blur.js.map
|
|
68
|
+
//# sourceMappingURL=progressive-blur.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/utils.ts","../../src/components/progressive-blur.tsx"],"names":[],"mappings":";;;;AAGO,SAAS,MAAM,MAAA,EAAsB;AAC1C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC7B;ACaO,SAAS,eAAA,CAAgB;AAAA,EAC/B,SAAA;AAAA,EACA,MAAA,GAAS,KAAA;AAAA,EACT,QAAA,GAAW,QAAA;AAAA,EACX,MAAA,GAAS,CAAA;AAAA,EACT,OAAA,GAAU,YAAA;AAAA,EACV,SAAA,GAAY,GAAA;AAAA,EACZ,MAAA,GAAS;AACV,CAAA,EAAyB;AACxB,EAAA,MAAM,WAAW,QAAA,KAAa,QAAA;AAC9B,EAAA,MAAM,QAAQ,QAAA,KAAa,KAAA;AAC3B,EAAA,MAAM,gBAAA,GAAmB,KAAK,GAAA,CAAI,CAAA,EAAG,KAAK,GAAA,CAAI,CAAA,EAAG,SAAS,CAAC,CAAA;AAC3D,EAAA,MAAM,aAAa,OAAA,KAAY,MAAA,GAAS,QAAA,GAAW,OAAA,KAAY,YAAY,WAAA,GAAc,cAAA;AAGzF,EAAA,MAAM,IAAA,GAAO,QAAA,GACV,qFAAA,GACA,KAAA,GACC,kFAAA,GACA,0EAAA;AAEJ,EAAA,MAAM,WAAA,GAAc,QAAA,GACjB,CAAA,wDAAA,EAA2D,gBAAgB,CAAA,6CAAA,CAAA,GAC3E,KAAA,GACC,CAAA,qDAAA,EAAwD,gBAAgB,CAAA,6CAAA,CAAA,GACxE,CAAA,wDAAA,EAA2D,gBAAgB,CAAA,qCAAA,EAAwC,gBAAgB,CAAA,0BAAA,CAAA;AAEvI,EAAA,uBACC,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACA,SAAA,EAAW,EAAA;AAAA,QACV,6DAAA;AAAA,QACA,SAAA;AAAA,QACA,KAAA,GAAQ,OAAA,GAAU,QAAA,GAAW,UAAA,GAAa;AAAA,OAC3C;AAAA,MACA,KAAA,EAAO;AAAA,QACN,MAAA,EAAQ,QAAA,KAAa,MAAA,GAAS,MAAA,GAAS,MAAA;AAAA,QACvC,IAAA,EAAM,MAAA;AAAA,QACN,KAAA,EAAO;AAAA,OACR;AAAA,MAGA,QAAA,EAAA;AAAA,wBAAA,GAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YACA,SAAA,EAAU,kBAAA;AAAA,YACV,KAAA,EAAO;AAAA,cACN,cAAA,EAAgB,QAAQ,MAAM,CAAA,GAAA,CAAA;AAAA,cAC9B,oBAAA,EAAsB,QAAQ,MAAM,CAAA,GAAA,CAAA;AAAA,cACpC,SAAA,EAAW,IAAA;AAAA,cACX,eAAA,EAAiB;AAAA;AAClB;AAAA,SACD;AAAA,wBAGA,GAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YACA,SAAA,EAAW,GAAG,kBAAkB,CAAA;AAAA,YAChC,KAAA,EAAO;AAAA,cACN,eAAA,EAAiB,OAAO,UAAU,CAAA,CAAA,CAAA;AAAA,cAClC,SAAA,EAAW,WAAA;AAAA,cACX,eAAA,EAAiB;AAAA;AAClB;AAAA;AACD;AAAA;AAAA,GACD;AAEF","file":"progressive-blur.js","sourcesContent":["import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","'use client';\n\nimport React from 'react';\n\nimport { cn } from '../lib/utils';\n\nexport interface ProgressiveBlurProps {\n\tclassName?: string;\n\theight?: string;\n\tposition?: 'top' | 'bottom' | 'both';\n\t/** Strength of the blur kernel in pixels (simpler, fewer artifacts) */\n\tblurPx?: number;\n\tsurface?: 'background' | 'card' | 'sidebar';\n\tintensity?: number;\n\t/** Optional horizontal inset to avoid edge bleeding (e.g. '0.5rem') */\n\tinsetX?: string;\n}\n\nexport function ProgressiveBlur({\n\tclassName,\n\theight = '24%',\n\tposition = 'bottom',\n\tblurPx = 8,\n\tsurface = 'background',\n\tintensity = 0.3,\n\tinsetX = '0',\n}: ProgressiveBlurProps) {\n\tconst isBottom = position === 'bottom';\n\tconst isTop = position === 'top';\n\tconst clampedIntensity = Math.max(0, Math.min(1, intensity));\n\tconst surfaceVar = surface === 'card' ? '--card' : surface === 'sidebar' ? '--sidebar' : '--background';\n\n\t// Vertical-only blur layer with a smooth single gradient mask\n\tconst mask = isBottom\n\t\t? 'linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 75%, rgba(0,0,0,1) 100%)'\n\t\t: isTop\n\t\t\t? 'linear-gradient(to top, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 75%, rgba(0,0,0,1) 100%)'\n\t\t\t: 'linear-gradient(rgba(0,0,0,0) 0%, rgba(0,0,0,1) 95%, rgba(0,0,0,0) 100%)';\n\n\tconst overlayMask = isBottom\n\t\t? `linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,${clampedIntensity}) 55%, rgba(0,0,0,1) 85%, rgba(0,0,0,1) 100%)`\n\t\t: isTop\n\t\t\t? `linear-gradient(to top, rgba(0,0,0,0) 0%, rgba(0,0,0,${clampedIntensity}) 55%, rgba(0,0,0,1) 85%, rgba(0,0,0,1) 100%)`\n\t\t\t: `linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,${clampedIntensity}) 25%, rgba(0,0,0,1) 50%, rgba(0,0,0,${clampedIntensity}) 75%, rgba(0,0,0,0) 100%)`;\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cn(\n\t\t\t\t'pointer-events-none absolute inset-x-0 z-10 overflow-hidden',\n\t\t\t\tclassName,\n\t\t\t\tisTop ? 'top-0' : isBottom ? 'bottom-0' : 'inset-y-0',\n\t\t\t)}\n\t\t\tstyle={{\n\t\t\t\theight: position === 'both' ? '100%' : height,\n\t\t\t\tleft: insetX,\n\t\t\t\tright: insetX,\n\t\t\t}}\n\t\t>\n\t\t\t{/* Backdrop blur with vertical mask only (no horizontal bleeding) */}\n\t\t\t<div\n\t\t\t\tclassName='absolute inset-0'\n\t\t\t\tstyle={{\n\t\t\t\t\tbackdropFilter: `blur(${blurPx}px)`,\n\t\t\t\t\tWebkitBackdropFilter: `blur(${blurPx}px)`,\n\t\t\t\t\tmaskImage: mask,\n\t\t\t\t\tWebkitMaskImage: mask,\n\t\t\t\t}}\n\t\t\t/>\n\n\t\t\t{/* Color overlay: gradient from transparent to solid background for seamless blending */}\n\t\t\t<div\n\t\t\t\tclassName={cn('absolute inset-0')}\n\t\t\t\tstyle={{\n\t\t\t\t\tbackgroundColor: `var(${surfaceVar})`,\n\t\t\t\t\tmaskImage: overlayMask,\n\t\t\t\t\tWebkitMaskImage: overlayMask,\n\t\t\t\t}}\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Radio as Radio$1 } from '@base-ui/react/radio';
|
|
3
|
+
import { RadioGroup as RadioGroup$1 } from '@base-ui/react/radio-group';
|
|
4
|
+
|
|
5
|
+
type RadioGroupProps = RadioGroup$1.Props;
|
|
6
|
+
type RadioProps = Radio$1.Root.Props;
|
|
7
|
+
declare function RadioGroup({ className, ...props }: RadioGroupProps): react_jsx_runtime.JSX.Element;
|
|
8
|
+
declare function Radio({ className, ...props }: RadioProps): react_jsx_runtime.JSX.Element;
|
|
9
|
+
|
|
10
|
+
export { Radio, RadioGroup, Radio as RadioGroupItem, type RadioGroupProps, type RadioProps };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Radio as Radio$1 } from '@base-ui/react/radio';
|
|
3
|
+
import { RadioGroup as RadioGroup$1 } from '@base-ui/react/radio-group';
|
|
4
|
+
import { clsx } from 'clsx';
|
|
5
|
+
import { twMerge } from 'tailwind-merge';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
function cn(...inputs) {
|
|
9
|
+
return twMerge(clsx(inputs));
|
|
10
|
+
}
|
|
11
|
+
function RadioGroup({ className, ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsx(RadioGroup$1, { className: cn("flex flex-col gap-3", className), "data-slot": "radio-group", ...props });
|
|
13
|
+
}
|
|
14
|
+
function Radio({ className, ...props }) {
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
Radio$1.Root,
|
|
17
|
+
{
|
|
18
|
+
className: cn(
|
|
19
|
+
"relative inline-flex size-4.5 shrink-0 items-center justify-center rounded-full border border-input bg-background bg-clip-padding shadow-xs outline-none transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-full not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/48 data-disabled:opacity-64 sm:size-4 dark:not-data-checked:bg-input/32 dark:bg-clip-border dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/8%)] [[data-disabled],[data-checked],[aria-invalid]]:shadow-none",
|
|
20
|
+
className
|
|
21
|
+
),
|
|
22
|
+
"data-slot": "radio",
|
|
23
|
+
...props,
|
|
24
|
+
children: /* @__PURE__ */ jsx(
|
|
25
|
+
Radio$1.Indicator,
|
|
26
|
+
{
|
|
27
|
+
className: "-inset-px absolute flex size-4.5 items-center justify-center rounded-full before:size-2 before:rounded-full before:bg-primary-foreground data-unchecked:hidden data-checked:bg-primary sm:size-4 sm:before:size-1.5",
|
|
28
|
+
"data-slot": "radio-indicator"
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { Radio, RadioGroup, Radio as RadioGroupItem };
|
|
36
|
+
//# sourceMappingURL=radio-group.js.map
|
|
37
|
+
//# sourceMappingURL=radio-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/utils.ts","../../src/components/radio-group.tsx"],"names":["RadioGroupPrimitive","RadioPrimitive"],"mappings":";;;;;;AAGO,SAAS,MAAM,MAAA,EAAsB;AAC1C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC7B;ACKA,SAAS,UAAA,CAAW,EAAE,SAAA,EAAW,GAAG,OAAM,EAAoB;AAC7D,EAAA,uBACC,GAAA,CAACA,YAAA,EAAA,EAAoB,SAAA,EAAW,EAAA,CAAG,qBAAA,EAAuB,SAAS,CAAA,EAAG,WAAA,EAAU,aAAA,EAAe,GAAG,KAAA,EAAO,CAAA;AAE3G;AAEA,SAAS,KAAA,CAAM,EAAE,SAAA,EAAW,GAAG,OAAM,EAAe;AACnD,EAAA,uBACC,GAAA;AAAA,IAACC,OAAA,CAAe,IAAA;AAAA,IAAf;AAAA,MACA,SAAA,EAAW,EAAA;AAAA,QACV,o3BAAA;AAAA,QACA;AAAA,OACD;AAAA,MACA,WAAA,EAAU,OAAA;AAAA,MACT,GAAG,KAAA;AAAA,MAEJ,QAAA,kBAAA,GAAA;AAAA,QAACA,OAAA,CAAe,SAAA;AAAA,QAAf;AAAA,UACA,SAAA,EAAU,qNAAA;AAAA,UACV,WAAA,EAAU;AAAA;AAAA;AACX;AAAA,GACD;AAEF","file":"radio-group.js","sourcesContent":["import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","'use client';\n\nimport { Radio as RadioPrimitive } from '@base-ui/react/radio';\nimport { RadioGroup as RadioGroupPrimitive } from '@base-ui/react/radio-group';\n\nimport { cn } from '../lib/utils';\n\ntype RadioGroupProps = RadioGroupPrimitive.Props;\ntype RadioProps = RadioPrimitive.Root.Props;\n\nfunction RadioGroup({ className, ...props }: RadioGroupProps) {\n\treturn (\n\t\t<RadioGroupPrimitive className={cn('flex flex-col gap-3', className)} data-slot=\"radio-group\" {...props} />\n\t);\n}\n\nfunction Radio({ className, ...props }: RadioProps) {\n\treturn (\n\t\t<RadioPrimitive.Root\n\t\t\tclassName={cn(\n\t\t\t\t'relative inline-flex size-4.5 shrink-0 items-center justify-center rounded-full border border-input bg-background bg-clip-padding shadow-xs outline-none transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-full not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/48 data-disabled:opacity-64 sm:size-4 dark:not-data-checked:bg-input/32 dark:bg-clip-border dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/8%)] [[data-disabled],[data-checked],[aria-invalid]]:shadow-none',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tdata-slot=\"radio\"\n\t\t\t{...props}\n\t\t>\n\t\t\t<RadioPrimitive.Indicator\n\t\t\t\tclassName=\"-inset-px absolute flex size-4.5 items-center justify-center rounded-full before:size-2 before:rounded-full before:bg-primary-foreground data-unchecked:hidden data-checked:bg-primary sm:size-4 sm:before:size-1.5\"\n\t\t\t\tdata-slot=\"radio-indicator\"\n\t\t\t/>\n\t\t</RadioPrimitive.Root>\n\t);\n}\n\nexport { RadioGroup, Radio, Radio as RadioGroupItem };\nexport type { RadioGroupProps, RadioProps };\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface RecordPickerProps {
|
|
4
|
+
records: any[];
|
|
5
|
+
linkedRecordIds: Set<string>;
|
|
6
|
+
onLink: (record: any) => void;
|
|
7
|
+
isLinking: boolean;
|
|
8
|
+
getRecordLabel: (record: any) => string;
|
|
9
|
+
getRecordId: (record: any) => string;
|
|
10
|
+
searchFields?: string[];
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
maxHeight?: string;
|
|
13
|
+
}
|
|
14
|
+
declare function RecordPicker({ records, linkedRecordIds, onLink, isLinking, getRecordLabel, getRecordId, searchFields, placeholder, maxHeight, }: RecordPickerProps): react_jsx_runtime.JSX.Element;
|
|
15
|
+
|
|
16
|
+
export { RecordPicker };
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useState, useMemo, useCallback, useEffect } from 'react';
|
|
4
|
+
import { RiSearchLine, RiLoader4Line, RiCheckLine } from '@remixicon/react';
|
|
5
|
+
import { matchSorter } from 'match-sorter';
|
|
6
|
+
import { Checkbox as Checkbox$1 } from '@base-ui/react/checkbox';
|
|
7
|
+
import { clsx } from 'clsx';
|
|
8
|
+
import { twMerge } from 'tailwind-merge';
|
|
9
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
10
|
+
import { cva } from 'class-variance-authority';
|
|
11
|
+
import { Input as Input$1 } from '@base-ui/react/input';
|
|
12
|
+
import { ScrollArea as ScrollArea$1 } from '@base-ui/react/scroll-area';
|
|
13
|
+
|
|
14
|
+
function useDebounce(value, delay) {
|
|
15
|
+
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const handler = setTimeout(() => {
|
|
18
|
+
setDebouncedValue(value);
|
|
19
|
+
}, delay);
|
|
20
|
+
return () => {
|
|
21
|
+
clearTimeout(handler);
|
|
22
|
+
};
|
|
23
|
+
}, [value, delay]);
|
|
24
|
+
return debouncedValue;
|
|
25
|
+
}
|
|
26
|
+
function cn(...inputs) {
|
|
27
|
+
return twMerge(clsx(inputs));
|
|
28
|
+
}
|
|
29
|
+
var Checkbox = React.forwardRef(({ className, ...props }, ref) => {
|
|
30
|
+
return /* @__PURE__ */ jsx(
|
|
31
|
+
Checkbox$1.Root,
|
|
32
|
+
{
|
|
33
|
+
ref,
|
|
34
|
+
className: cn(
|
|
35
|
+
"relative inline-flex size-4.5 shrink-0 items-center justify-center rounded-[4px] border border-input bg-background bg-clip-padding shadow-xs outline-none ring-ring transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[3px] not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-background aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/48 data-disabled:opacity-64 sm:size-4 dark:not-data-checked:bg-input/32 dark:bg-clip-border dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/8%)] [[data-disabled],[data-checked],[aria-invalid]]:shadow-none",
|
|
36
|
+
className
|
|
37
|
+
),
|
|
38
|
+
"data-slot": "checkbox",
|
|
39
|
+
...props,
|
|
40
|
+
children: /* @__PURE__ */ jsx(
|
|
41
|
+
Checkbox$1.Indicator,
|
|
42
|
+
{
|
|
43
|
+
className: "-inset-px absolute flex items-center justify-center rounded-[4px] text-primary-foreground data-unchecked:hidden data-checked:bg-primary data-indeterminate:text-foreground",
|
|
44
|
+
"data-slot": "checkbox-indicator",
|
|
45
|
+
render: (props2, state) => /* @__PURE__ */ jsx("span", { ...props2, children: state.indeterminate ? /* @__PURE__ */ jsx(
|
|
46
|
+
"svg",
|
|
47
|
+
{
|
|
48
|
+
className: "size-3.5 sm:size-3",
|
|
49
|
+
fill: "none",
|
|
50
|
+
height: "24",
|
|
51
|
+
stroke: "currentColor",
|
|
52
|
+
strokeLinecap: "round",
|
|
53
|
+
strokeLinejoin: "round",
|
|
54
|
+
strokeWidth: "3",
|
|
55
|
+
viewBox: "0 0 24 24",
|
|
56
|
+
width: "24",
|
|
57
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
58
|
+
children: /* @__PURE__ */ jsx("path", { d: "M5.252 12h13.496" })
|
|
59
|
+
}
|
|
60
|
+
) : /* @__PURE__ */ jsx(
|
|
61
|
+
"svg",
|
|
62
|
+
{
|
|
63
|
+
className: "size-3.5 sm:size-3",
|
|
64
|
+
fill: "none",
|
|
65
|
+
height: "24",
|
|
66
|
+
stroke: "currentColor",
|
|
67
|
+
strokeLinecap: "round",
|
|
68
|
+
strokeLinejoin: "round",
|
|
69
|
+
strokeWidth: "3",
|
|
70
|
+
viewBox: "0 0 24 24",
|
|
71
|
+
width: "24",
|
|
72
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
73
|
+
children: /* @__PURE__ */ jsx("path", { d: "M5.252 12.7 10.2 18.63 18.748 5.37" })
|
|
74
|
+
}
|
|
75
|
+
) })
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
});
|
|
81
|
+
Checkbox.displayName = "Checkbox";
|
|
82
|
+
function Input({ className, size = "default", unstyled = false, ...props }) {
|
|
83
|
+
const isFloating = props.placeholder === " ";
|
|
84
|
+
return /* @__PURE__ */ jsx(
|
|
85
|
+
"span",
|
|
86
|
+
{
|
|
87
|
+
className: cn(
|
|
88
|
+
!unstyled && [
|
|
89
|
+
// Base layout
|
|
90
|
+
"relative inline-flex w-full rounded-lg border border-input bg-background bg-clip-padding text-base shadow-xs transition-shadow",
|
|
91
|
+
// Inner shadow highlight
|
|
92
|
+
"before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)]",
|
|
93
|
+
"not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)]",
|
|
94
|
+
// Focus state - use primary brand color
|
|
95
|
+
"has-focus-visible:border-primary/60 has-focus-visible:ring-[3px] has-focus-visible:ring-primary/35",
|
|
96
|
+
// Invalid state
|
|
97
|
+
"has-aria-invalid:border-destructive/36",
|
|
98
|
+
"has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16",
|
|
99
|
+
// Disabled state
|
|
100
|
+
"has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none",
|
|
101
|
+
// Dark mode
|
|
102
|
+
"sm:text-sm dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border",
|
|
103
|
+
"dark:has-aria-invalid:ring-destructive/24",
|
|
104
|
+
"dark:not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/8%)]"
|
|
105
|
+
],
|
|
106
|
+
className
|
|
107
|
+
) || void 0,
|
|
108
|
+
"data-size": size,
|
|
109
|
+
"data-slot": "input-control",
|
|
110
|
+
children: /* @__PURE__ */ jsx(
|
|
111
|
+
Input$1,
|
|
112
|
+
{
|
|
113
|
+
className: cn(
|
|
114
|
+
"w-full min-w-0 rounded-[inherit] bg-transparent px-[calc(--spacing(3)-1px)] outline-none",
|
|
115
|
+
isFloating ? "h-11 pt-4.5 pb-1 leading-none placeholder:text-transparent sm:h-10" : "h-8.5 leading-8.5 placeholder:text-muted-foreground/72 sm:h-7.5 sm:leading-7.5",
|
|
116
|
+
size === "sm" && (isFloating ? "h-10 px-[calc(--spacing(2.5)-1px)] pt-4 pb-1 sm:h-9" : "h-7.5 px-[calc(--spacing(2.5)-1px)] leading-7.5 sm:h-6.5 sm:leading-6.5"),
|
|
117
|
+
size === "lg" && (isFloating ? "h-12 pt-5 pb-1.5 sm:h-11" : "h-9.5 leading-9.5 sm:h-8.5 sm:leading-8.5"),
|
|
118
|
+
props.type === "search" && "[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-results-button]:appearance-none [&::-webkit-search-results-decoration]:appearance-none",
|
|
119
|
+
props.type === "file" && "text-muted-foreground file:me-3 file:bg-transparent file:font-medium file:text-foreground file:text-sm"
|
|
120
|
+
),
|
|
121
|
+
"data-slot": "input",
|
|
122
|
+
size: typeof size === "number" ? size : void 0,
|
|
123
|
+
...props
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
function InputGroup({ className, ...props }) {
|
|
130
|
+
return /* @__PURE__ */ jsx(
|
|
131
|
+
"div",
|
|
132
|
+
{
|
|
133
|
+
className: cn(
|
|
134
|
+
"relative inline-flex w-full min-w-0 items-center rounded-lg border border-input bg-background bg-clip-padding text-base shadow-xs transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-[input:disabled,textarea:disabled]:not-has-[input:focus-visible,textarea:focus-visible]:not-has-[input[aria-invalid],textarea[aria-invalid]]:before:shadow-[0_1px_--theme(--color-black/4%)] has-[input:focus-visible,textarea:focus-visible]:has-[input[aria-invalid],textarea[aria-invalid]]:border-destructive/64 has-[input:focus-visible,textarea:focus-visible]:has-[input[aria-invalid],textarea[aria-invalid]]:ring-destructive/16 has-[textarea]:h-auto has-data-[align=block-end]:h-auto has-data-[align=block-start]:h-auto has-data-[align=block-end]:flex-col has-data-[align=block-start]:flex-col has-[input:focus-visible,textarea:focus-visible]:border-primary/60 has-[input[aria-invalid],textarea[aria-invalid]]:border-destructive/36 has-[input:disabled,textarea:disabled]:opacity-64 has-[input:disabled,textarea:disabled,input:focus-visible,textarea:focus-visible,input[aria-invalid],textarea[aria-invalid]]:shadow-none has-[input:focus-visible,textarea:focus-visible]:ring-[3px] has-[input:focus-visible,textarea:focus-visible]:ring-primary/35 sm:text-sm dark:bg-input/32 dark:bg-clip-border dark:has-[input[aria-invalid],textarea[aria-invalid]]:ring-destructive/24 dark:not-has-[input:disabled,textarea:disabled]:not-has-[input:focus-visible,textarea:focus-visible]:not-has-[input[aria-invalid],textarea[aria-invalid]]:before:shadow-[0_-1px_--theme(--color-white/8%)] has-data-[align=inline-start]:**:[[data-size=sm]_input]:ps-1.5 has-data-[align=inline-end]:**:[[data-size=sm]_input]:pe-1.5 *:[[data-slot=input-control],[data-slot=textarea-control]]:contents *:[[data-slot=input-control],[data-slot=textarea-control]]:before:hidden has-[[data-align=block-start],[data-align=block-end]]:**:[input]:h-auto has-data-[align=inline-start]:**:[input]:ps-2 has-data-[align=inline-end]:**:[input]:pe-2 has-data-[align=block-end]:**:[input]:pt-1.5 has-data-[align=block-start]:**:[input]:pb-1.5 **:[textarea]:min-h-20.5 **:[textarea]:resize-none **:[textarea]:py-[calc(--spacing(3)-1px)] **:[textarea]:max-sm:min-h-23.5 **:[textarea_button]:rounded-[calc(var(--radius-md)-1px)]",
|
|
135
|
+
className
|
|
136
|
+
),
|
|
137
|
+
"data-slot": "input-group",
|
|
138
|
+
role: "group",
|
|
139
|
+
...props
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
var inputGroupAddonVariants = cva(
|
|
144
|
+
"[&_svg]:-mx-0.5 flex h-auto cursor-text select-none items-center justify-center gap-2 [&>kbd]:rounded-[calc(var(--radius)-5px)] in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4.5 sm:in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4 not-has-[button]:**:[svg:not([class*='opacity-'])]:opacity-80",
|
|
145
|
+
{
|
|
146
|
+
defaultVariants: {
|
|
147
|
+
align: "inline-start"
|
|
148
|
+
},
|
|
149
|
+
variants: {
|
|
150
|
+
align: {
|
|
151
|
+
"block-end": "order-last w-full justify-start px-[calc(--spacing(3)-1px)] pb-[calc(--spacing(3)-1px)] [.border-t]:pt-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]",
|
|
152
|
+
"block-start": "order-first w-full justify-start px-[calc(--spacing(3)-1px)] pt-[calc(--spacing(3)-1px)] [.border-b]:pb-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]",
|
|
153
|
+
"inline-end": "has-[>:last-child[data-slot=badge]]:-me-1.5 has-[>button]:-me-2 order-last pe-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:me-[-0.35rem] [[data-size=sm]+&]:pe-[calc(--spacing(2.5)-1px)]",
|
|
154
|
+
"inline-start": "has-[>:last-child[data-slot=badge]]:-ms-1.5 has-[>button]:-ms-2 order-first ps-[calc(--spacing(3)-1px)] has-[>kbd:last-child]:ms-[-0.35rem] [[data-size=sm]+&]:ps-[calc(--spacing(2.5)-1px)]"
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
function InputGroupAddon({
|
|
160
|
+
className,
|
|
161
|
+
align = "inline-start",
|
|
162
|
+
...props
|
|
163
|
+
}) {
|
|
164
|
+
return /* @__PURE__ */ jsx(
|
|
165
|
+
"div",
|
|
166
|
+
{
|
|
167
|
+
className: cn(inputGroupAddonVariants({ align }), className),
|
|
168
|
+
"data-align": align,
|
|
169
|
+
"data-slot": "input-group-addon",
|
|
170
|
+
onMouseDown: (e) => {
|
|
171
|
+
const target = e.target;
|
|
172
|
+
const isInteractive = target.closest("button, a");
|
|
173
|
+
if (isInteractive) return;
|
|
174
|
+
e.preventDefault();
|
|
175
|
+
const parent = e.currentTarget.parentElement;
|
|
176
|
+
const input = parent?.querySelector("input, textarea");
|
|
177
|
+
if (input && !parent?.querySelector("input:focus, textarea:focus")) {
|
|
178
|
+
input.focus();
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
...props
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
function InputGroupInput({ className, ...props }) {
|
|
186
|
+
return /* @__PURE__ */ jsx(Input, { className, unstyled: true, ...props });
|
|
187
|
+
}
|
|
188
|
+
var ScrollArea = React.forwardRef(
|
|
189
|
+
({ className, children, scrollFade = false, scrollbarGutter = false, ...props }, ref) => {
|
|
190
|
+
return /* @__PURE__ */ jsxs(
|
|
191
|
+
ScrollArea$1.Root,
|
|
192
|
+
{
|
|
193
|
+
ref,
|
|
194
|
+
className: cn("size-full min-h-0", className),
|
|
195
|
+
...props,
|
|
196
|
+
children: [
|
|
197
|
+
/* @__PURE__ */ jsx(
|
|
198
|
+
ScrollArea$1.Viewport,
|
|
199
|
+
{
|
|
200
|
+
className: cn(
|
|
201
|
+
"h-full overscroll-contain rounded-[inherit] outline-none transition-shadows focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background",
|
|
202
|
+
scrollFade && "mask-t-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-start)))] mask-b-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-end)))] mask-l-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-start)))] mask-r-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-end)))] [--fade-size:1.5rem]",
|
|
203
|
+
scrollbarGutter && "data-has-overflow-y:pe-2.5 data-has-overflow-x:pb-2.5"
|
|
204
|
+
),
|
|
205
|
+
"data-slot": "scroll-area-viewport",
|
|
206
|
+
children
|
|
207
|
+
}
|
|
208
|
+
),
|
|
209
|
+
/* @__PURE__ */ jsx(ScrollBar, { orientation: "vertical" }),
|
|
210
|
+
/* @__PURE__ */ jsx(ScrollBar, { orientation: "horizontal" }),
|
|
211
|
+
/* @__PURE__ */ jsx(ScrollArea$1.Corner, { "data-slot": "scroll-area-corner" })
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
);
|
|
217
|
+
ScrollArea.displayName = "ScrollArea";
|
|
218
|
+
function ScrollBar({
|
|
219
|
+
className,
|
|
220
|
+
orientation = "vertical",
|
|
221
|
+
...props
|
|
222
|
+
}) {
|
|
223
|
+
return /* @__PURE__ */ jsx(
|
|
224
|
+
ScrollArea$1.Scrollbar,
|
|
225
|
+
{
|
|
226
|
+
className: cn(
|
|
227
|
+
"m-1 flex opacity-0 transition-opacity delay-300 data-[orientation=horizontal]:h-1.5 data-[orientation=vertical]:w-1.5 data-[orientation=horizontal]:flex-col data-hovering:opacity-100 data-scrolling:opacity-100 data-hovering:delay-0 data-scrolling:delay-0 data-hovering:duration-100 data-scrolling:duration-100",
|
|
228
|
+
className
|
|
229
|
+
),
|
|
230
|
+
"data-slot": "scroll-area-scrollbar",
|
|
231
|
+
orientation,
|
|
232
|
+
...props,
|
|
233
|
+
children: /* @__PURE__ */ jsx(
|
|
234
|
+
ScrollArea$1.Thumb,
|
|
235
|
+
{
|
|
236
|
+
className: "relative flex-1 rounded-full bg-foreground/20",
|
|
237
|
+
"data-slot": "scroll-area-thumb"
|
|
238
|
+
}
|
|
239
|
+
)
|
|
240
|
+
}
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
function RecordPicker({
|
|
244
|
+
records,
|
|
245
|
+
linkedRecordIds,
|
|
246
|
+
onLink,
|
|
247
|
+
isLinking,
|
|
248
|
+
getRecordLabel,
|
|
249
|
+
getRecordId,
|
|
250
|
+
searchFields = ["name", "title", "label"],
|
|
251
|
+
placeholder = "Search records...",
|
|
252
|
+
maxHeight = "300px"
|
|
253
|
+
}) {
|
|
254
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
255
|
+
const debouncedSearchQuery = useDebounce(searchQuery, 300);
|
|
256
|
+
const filteredRecords = useMemo(() => {
|
|
257
|
+
if (!debouncedSearchQuery.trim()) {
|
|
258
|
+
return records;
|
|
259
|
+
}
|
|
260
|
+
return matchSorter(records, debouncedSearchQuery, {
|
|
261
|
+
keys: searchFields,
|
|
262
|
+
threshold: matchSorter.rankings.CONTAINS
|
|
263
|
+
});
|
|
264
|
+
}, [records, debouncedSearchQuery, searchFields]);
|
|
265
|
+
const { linkedRecords, unlinkableRecords } = useMemo(() => {
|
|
266
|
+
const linked = [];
|
|
267
|
+
const unlinkable = [];
|
|
268
|
+
filteredRecords.forEach((record) => {
|
|
269
|
+
const recordId = getRecordId(record);
|
|
270
|
+
if (linkedRecordIds.has(recordId)) {
|
|
271
|
+
linked.push(record);
|
|
272
|
+
} else {
|
|
273
|
+
unlinkable.push(record);
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
return { linkedRecords: linked, unlinkableRecords: unlinkable };
|
|
277
|
+
}, [filteredRecords, linkedRecordIds, getRecordId]);
|
|
278
|
+
const handleLinkRecord = useCallback(
|
|
279
|
+
(record) => {
|
|
280
|
+
onLink(record);
|
|
281
|
+
},
|
|
282
|
+
[onLink]
|
|
283
|
+
);
|
|
284
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
285
|
+
/* @__PURE__ */ jsxs(InputGroup, { children: [
|
|
286
|
+
/* @__PURE__ */ jsx(InputGroupAddon, { children: /* @__PURE__ */ jsx(RiSearchLine, {}) }),
|
|
287
|
+
/* @__PURE__ */ jsx(
|
|
288
|
+
InputGroupInput,
|
|
289
|
+
{
|
|
290
|
+
placeholder,
|
|
291
|
+
value: searchQuery,
|
|
292
|
+
onChange: (e) => setSearchQuery(e.target.value)
|
|
293
|
+
}
|
|
294
|
+
)
|
|
295
|
+
] }),
|
|
296
|
+
/* @__PURE__ */ jsx(ScrollArea, { style: { maxHeight }, className: "scrollbar-neutral-thin", children: /* @__PURE__ */ jsxs("div", { className: "space-y-2 pr-2", children: [
|
|
297
|
+
unlinkableRecords.length > 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
298
|
+
/* @__PURE__ */ jsxs("h4", { className: "text-muted-foreground text-xs font-medium tracking-wide uppercase", children: [
|
|
299
|
+
"Available Records (",
|
|
300
|
+
unlinkableRecords.length,
|
|
301
|
+
")"
|
|
302
|
+
] }),
|
|
303
|
+
unlinkableRecords.map((record) => {
|
|
304
|
+
const recordId = getRecordId(record);
|
|
305
|
+
const label = getRecordLabel(record);
|
|
306
|
+
return /* @__PURE__ */ jsxs(
|
|
307
|
+
"div",
|
|
308
|
+
{
|
|
309
|
+
className: "hover:bg-muted/50 flex items-center space-x-3 rounded-md p-2 transition-colors",
|
|
310
|
+
children: [
|
|
311
|
+
/* @__PURE__ */ jsx(
|
|
312
|
+
Checkbox,
|
|
313
|
+
{
|
|
314
|
+
id: `record-${recordId}`,
|
|
315
|
+
checked: false,
|
|
316
|
+
onCheckedChange: () => handleLinkRecord(record),
|
|
317
|
+
disabled: isLinking,
|
|
318
|
+
className: "flex-shrink-0"
|
|
319
|
+
}
|
|
320
|
+
),
|
|
321
|
+
/* @__PURE__ */ jsx(
|
|
322
|
+
"label",
|
|
323
|
+
{
|
|
324
|
+
htmlFor: `record-${recordId}`,
|
|
325
|
+
className: "flex-1 cursor-pointer truncate text-sm",
|
|
326
|
+
title: label,
|
|
327
|
+
children: label
|
|
328
|
+
}
|
|
329
|
+
),
|
|
330
|
+
isLinking && /* @__PURE__ */ jsx(RiLoader4Line, { className: "text-muted-foreground h-4 w-4 flex-shrink-0 animate-spin" })
|
|
331
|
+
]
|
|
332
|
+
},
|
|
333
|
+
recordId
|
|
334
|
+
);
|
|
335
|
+
})
|
|
336
|
+
] }),
|
|
337
|
+
linkedRecords.length > 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
338
|
+
/* @__PURE__ */ jsxs("h4", { className: "text-muted-foreground text-xs font-medium tracking-wide uppercase", children: [
|
|
339
|
+
"Already Linked (",
|
|
340
|
+
linkedRecords.length,
|
|
341
|
+
")"
|
|
342
|
+
] }),
|
|
343
|
+
linkedRecords.map((record) => {
|
|
344
|
+
const recordId = getRecordId(record);
|
|
345
|
+
const label = getRecordLabel(record);
|
|
346
|
+
return /* @__PURE__ */ jsxs("div", { className: "bg-muted/30 flex items-center space-x-3 rounded-md p-2", children: [
|
|
347
|
+
/* @__PURE__ */ jsx("div", { className: "flex h-4 w-4 flex-shrink-0 items-center justify-center", children: /* @__PURE__ */ jsx(RiCheckLine, { className: "h-3 w-3 text-green-600" }) }),
|
|
348
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground flex-1 truncate text-sm", title: label, children: label })
|
|
349
|
+
] }, recordId);
|
|
350
|
+
})
|
|
351
|
+
] }),
|
|
352
|
+
filteredRecords.length === 0 && /* @__PURE__ */ jsxs("div", { className: "text-muted-foreground py-8 text-center", children: [
|
|
353
|
+
/* @__PURE__ */ jsx(RiSearchLine, { className: "mx-auto mb-2 h-8 w-8 opacity-50" }),
|
|
354
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm", children: searchQuery ? "No records match your search" : "No records available" })
|
|
355
|
+
] }),
|
|
356
|
+
filteredRecords.length > 0 && unlinkableRecords.length === 0 && /* @__PURE__ */ jsxs("div", { className: "text-muted-foreground py-4 text-center", children: [
|
|
357
|
+
/* @__PURE__ */ jsx(RiCheckLine, { className: "mx-auto mb-2 h-6 w-6 opacity-50" }),
|
|
358
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm", children: "All matching records are already linked" })
|
|
359
|
+
] })
|
|
360
|
+
] }) })
|
|
361
|
+
] });
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export { RecordPicker };
|
|
365
|
+
//# sourceMappingURL=record-picker.js.map
|
|
366
|
+
//# sourceMappingURL=record-picker.js.map
|