@sqlrooms/ui 0.29.0-rc.11 → 0.29.0-rc.13
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 +64 -0
- package/dist/components/scrollable-row.d.ts +16 -5
- package/dist/components/scrollable-row.d.ts.map +1 -1
- package/dist/components/scrollable-row.js +56 -5
- package/dist/components/scrollable-row.js.map +1 -1
- package/dist/components/textarea.d.ts.map +1 -1
- package/dist/components/textarea.js +1 -89
- package/dist/components/textarea.js.map +1 -1
- package/dist/hooks/useAutoResizeTextarea.d.ts +45 -0
- package/dist/hooks/useAutoResizeTextarea.d.ts.map +1 -0
- package/dist/hooks/useAutoResizeTextarea.js +99 -0
- package/dist/hooks/useAutoResizeTextarea.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
- package/tailwind-preset.css +27 -0
package/README.md
CHANGED
|
@@ -181,6 +181,70 @@ function SettingsPanel({onClose}: {onClose: () => void}) {
|
|
|
181
181
|
- **Form Handling**: Integrated with React Hook Form for easy form management
|
|
182
182
|
- **Custom Styling**: Extend components with custom styles using Tailwind CSS
|
|
183
183
|
- **Animation**: Smooth transitions and animations for interactive elements
|
|
184
|
+
- **`ScrollableRow` forwards its ref and passes through extra props** (e.g.
|
|
185
|
+
`data-*`, `aria-*`, event handlers) to its outermost element, so it can be
|
|
186
|
+
wrapped by a slot component (such as Radix's `Slot`, re-exported from this
|
|
187
|
+
package) without silently losing the ref or those props. Note the two refs
|
|
188
|
+
point at different elements: the forwarded ref is the outer wrapper (the one
|
|
189
|
+
that also takes `className`), while `scrollRef` is the inner scrolling
|
|
190
|
+
container, for reading or setting `scrollLeft`.
|
|
191
|
+
|
|
192
|
+
## Auto-Resize for Textareas
|
|
193
|
+
|
|
194
|
+
`useAutoResizeTextarea` is the hook behind `Textarea`'s `autoResize` prop,
|
|
195
|
+
exported so it can be applied to a textarea element you did not render
|
|
196
|
+
yourself — for example one rendered by a host application's own text-input
|
|
197
|
+
component. Give it a ref to the textarea and it grows the element's height to
|
|
198
|
+
fit its content, tracks whether the content now exceeds the element's
|
|
199
|
+
`max-height`, and re-measures on container resize.
|
|
200
|
+
|
|
201
|
+
`resizeToFitContent` schedules the measurement on the next animation frame, so
|
|
202
|
+
the element's height is not yet updated when the call returns.
|
|
203
|
+
|
|
204
|
+
```tsx
|
|
205
|
+
import {useAutoResizeTextarea} from '@sqlrooms/ui';
|
|
206
|
+
import {useRef} from 'react';
|
|
207
|
+
|
|
208
|
+
function MyTextarea({
|
|
209
|
+
value,
|
|
210
|
+
onChange,
|
|
211
|
+
}: {
|
|
212
|
+
value: string;
|
|
213
|
+
onChange: (value: string) => void;
|
|
214
|
+
}) {
|
|
215
|
+
const textareaRef = useRef<HTMLTextAreaElement>(null);
|
|
216
|
+
const {hasOverflow, resizeToFitContent} = useAutoResizeTextarea({
|
|
217
|
+
autoResize: true,
|
|
218
|
+
textareaRef,
|
|
219
|
+
value,
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
return (
|
|
223
|
+
<textarea
|
|
224
|
+
ref={textareaRef}
|
|
225
|
+
value={value}
|
|
226
|
+
onChange={(event) => onChange(event.currentTarget.value)}
|
|
227
|
+
onInput={() => resizeToFitContent()}
|
|
228
|
+
className={hasOverflow ? 'overflow-y-auto' : 'overflow-y-hidden'}
|
|
229
|
+
/>
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
`Textarea` itself is unchanged: it still accepts `autoResize` and consumes
|
|
235
|
+
this hook internally.
|
|
236
|
+
|
|
237
|
+
## Native scrolling
|
|
238
|
+
|
|
239
|
+
Use the `scrollbar-thin` utility for simple native overflow containers that
|
|
240
|
+
should use a thin, theme-aware scrollbar:
|
|
241
|
+
|
|
242
|
+
```tsx
|
|
243
|
+
<div className="scrollbar-thin overflow-y-auto">{/* content */}</div>
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Use `ScrollArea` instead when a surface needs custom horizontal or
|
|
247
|
+
bidirectional scrollbar behavior.
|
|
184
248
|
|
|
185
249
|
## TabStrip
|
|
186
250
|
|
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* A horizontally scrolling row with arrows that appear only where there is more
|
|
4
|
+
* content.
|
|
5
|
+
*
|
|
6
|
+
* The forwarded ref and `className` target the outer wrapper (so `Slot` or
|
|
7
|
+
* drop-target wrapping works); `scrollRef` targets the inner scrolling
|
|
8
|
+
* container.
|
|
9
|
+
*/
|
|
10
|
+
export declare const ScrollableRow: React.ForwardRefExoticComponent<{
|
|
3
11
|
children: React.ReactNode;
|
|
4
12
|
className?: string;
|
|
5
13
|
scrollClassName?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Ref to the inner scrolling container. Replaces the internal ref; the
|
|
16
|
+
* arrows keep working.
|
|
17
|
+
*/
|
|
6
18
|
scrollRef?: React.RefObject<HTMLDivElement>;
|
|
19
|
+
/** Pixels scrolled per arrow activation. Defaults to 200. */
|
|
7
20
|
scrollAmount?: number;
|
|
8
|
-
arrowVisibility?:
|
|
21
|
+
arrowVisibility?: "hover" | "always";
|
|
9
22
|
arrowClassName?: string;
|
|
10
23
|
arrowIconClassName?: string;
|
|
11
|
-
}
|
|
12
|
-
export declare function ScrollableRow({ children, className, scrollClassName, scrollRef, scrollAmount, arrowVisibility, arrowClassName, arrowIconClassName, }: ScrollableRowProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export {};
|
|
24
|
+
} & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className" | "children"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
25
|
//# sourceMappingURL=scrollable-row.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scrollable-row.d.ts","sourceRoot":"","sources":["../../src/components/scrollable-row.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"scrollable-row.d.ts","sourceRoot":"","sources":["../../src/components/scrollable-row.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAmBzD;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa;cAvBd,KAAK,CAAC,SAAS;gBACb,MAAM;sBACA,MAAM;IACxB;;;OAGG;gBACS,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC;IAC3C,6DAA6D;mBAC9C,MAAM;sBACH,OAAO,GAAG,QAAQ;qBACnB,MAAM;yBACF,MAAM;qKA+K3B,CAAC"}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
|
3
|
-
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
4
4
|
import { cn } from '../lib/utils';
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* A horizontally scrolling row with arrows that appear only where there is more
|
|
7
|
+
* content.
|
|
8
|
+
*
|
|
9
|
+
* The forwarded ref and `className` target the outer wrapper (so `Slot` or
|
|
10
|
+
* drop-target wrapping works); `scrollRef` targets the inner scrolling
|
|
11
|
+
* container.
|
|
12
|
+
*/
|
|
13
|
+
export const ScrollableRow = React.forwardRef(function ScrollableRow({ children, className, scrollClassName, scrollRef, scrollAmount = 200, arrowVisibility = 'hover', arrowClassName, arrowIconClassName, ...rest }, forwardedRef) {
|
|
6
14
|
const internalRef = useRef(null);
|
|
7
15
|
const containerRef = scrollRef ?? internalRef;
|
|
8
16
|
const [canScrollLeft, setCanScrollLeft] = useState(false);
|
|
@@ -32,14 +40,57 @@ export function ScrollableRow({ children, className, scrollClassName, scrollRef,
|
|
|
32
40
|
container.addEventListener('scroll', updateScrollState);
|
|
33
41
|
const resizeObserver = new ResizeObserver(updateScrollState);
|
|
34
42
|
resizeObserver.observe(container);
|
|
43
|
+
// The container's own box stays fixed when its content changes size (e.g.
|
|
44
|
+
// loading placeholders replaced by wider suggestions), so ResizeObserver
|
|
45
|
+
// on the container alone would leave the arrows stale. Observe each child
|
|
46
|
+
// element instead, and re-observe as children are added or removed, so
|
|
47
|
+
// overflow changes track content-size changes too.
|
|
48
|
+
const contentObserver = new ResizeObserver(updateScrollState);
|
|
49
|
+
const observeChildren = () => {
|
|
50
|
+
contentObserver.disconnect();
|
|
51
|
+
for (const child of Array.from(container.children)) {
|
|
52
|
+
contentObserver.observe(child);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
observeChildren();
|
|
56
|
+
const mutationObserver = new MutationObserver((mutations) => {
|
|
57
|
+
// Only direct child additions/removals change the resize-observer targets.
|
|
58
|
+
if (mutations.some(({ type, target }) => type === 'childList' && target === container)) {
|
|
59
|
+
observeChildren();
|
|
60
|
+
}
|
|
61
|
+
updateScrollState();
|
|
62
|
+
});
|
|
63
|
+
// Text and styling can change overflow without resizing a direct child.
|
|
64
|
+
// Observe all attributes: hidden and arbitrary CSS selectors affect layout too.
|
|
65
|
+
mutationObserver.observe(container, {
|
|
66
|
+
childList: true,
|
|
67
|
+
characterData: true,
|
|
68
|
+
attributes: true,
|
|
69
|
+
subtree: true,
|
|
70
|
+
});
|
|
71
|
+
// Font metrics can change direct-text overflow without a DOM mutation or
|
|
72
|
+
// an element resize. Refresh after font loading settles, including failures.
|
|
73
|
+
const fonts = container.ownerDocument.fonts;
|
|
74
|
+
fonts?.addEventListener('loadingdone', updateScrollState);
|
|
75
|
+
fonts?.addEventListener('loadingerror', updateScrollState);
|
|
35
76
|
return () => {
|
|
36
77
|
container.removeEventListener('scroll', updateScrollState);
|
|
37
78
|
resizeObserver.disconnect();
|
|
79
|
+
contentObserver.disconnect();
|
|
80
|
+
mutationObserver.disconnect();
|
|
81
|
+
fonts?.removeEventListener('loadingdone', updateScrollState);
|
|
82
|
+
fonts?.removeEventListener('loadingerror', updateScrollState);
|
|
38
83
|
};
|
|
39
|
-
|
|
84
|
+
// `children` is intentionally excluded from the deps: it is typically a
|
|
85
|
+
// fresh array on every parent render, and re-running this effect (which
|
|
86
|
+
// calls setState) on every render would trip React's "Maximum update depth
|
|
87
|
+
// exceeded" warning. DOM observers and font events handle content changes;
|
|
88
|
+
// the scroll listener covers user/dnd scrolling.
|
|
89
|
+
}, [containerRef]);
|
|
40
90
|
const arrowBaseClass = cn('absolute top-0 z-10 flex h-full w-8 items-center backdrop-blur-md bg-background/50 transition-colors', arrowVisibility === 'hover'
|
|
41
91
|
? 'opacity-0 transition-opacity hover:opacity-100'
|
|
42
92
|
: 'opacity-100', arrowClassName);
|
|
43
|
-
return (_jsxs("div", { className: cn('relative', className), children: [_jsx("button", { type: "button", onClick: () => scrollBy('left'), disabled: !canScrollLeft, className: cn(arrowBaseClass, 'left-0 justify-start pl-1', 'from-background/90 via-background/60 group bg-gradient-to-r to-transparent', !canScrollLeft && 'pointer-events-none opacity-0'), "aria-label": "Scroll left", title: "Scroll left", children: _jsx(ChevronLeft, { className: cn('text-muted-foreground group-hover:text-foreground h-5 w-5 transition-colors', arrowIconClassName) }) }), _jsx("div", { ref: containerRef, className: scrollClassName, children: children }), _jsx("button", { type: "button", onClick: () => scrollBy('right'), disabled: !canScrollRight, className: cn(arrowBaseClass, 'right-0 justify-end pr-1', 'from-background/90 via-background/60 group bg-gradient-to-l to-transparent', !canScrollRight && 'pointer-events-none opacity-0'), "aria-label": "Scroll right", title: "Scroll right", children: _jsx(ChevronRight, { className: cn('text-muted-foreground group-hover:text-foreground h-5 w-5 transition-colors', arrowIconClassName) }) })] }));
|
|
44
|
-
}
|
|
93
|
+
return (_jsxs("div", { ref: forwardedRef, className: cn('relative', className), ...rest, children: [_jsx("button", { type: "button", onClick: () => scrollBy('left'), disabled: !canScrollLeft, className: cn(arrowBaseClass, 'left-0 justify-start pl-1', 'from-background/90 via-background/60 group bg-gradient-to-r to-transparent', !canScrollLeft && 'pointer-events-none opacity-0'), "aria-label": "Scroll left", title: "Scroll left", children: _jsx(ChevronLeft, { className: cn('text-muted-foreground group-hover:text-foreground h-5 w-5 transition-colors', arrowIconClassName) }) }), _jsx("div", { ref: containerRef, className: scrollClassName, children: children }), _jsx("button", { type: "button", onClick: () => scrollBy('right'), disabled: !canScrollRight, className: cn(arrowBaseClass, 'right-0 justify-end pr-1', 'from-background/90 via-background/60 group bg-gradient-to-l to-transparent', !canScrollRight && 'pointer-events-none opacity-0'), "aria-label": "Scroll right", title: "Scroll right", children: _jsx(ChevronRight, { className: cn('text-muted-foreground group-hover:text-foreground h-5 w-5 transition-colors', arrowIconClassName) }) })] }));
|
|
94
|
+
});
|
|
95
|
+
ScrollableRow.displayName = 'ScrollableRow';
|
|
45
96
|
//# sourceMappingURL=scrollable-row.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scrollable-row.js","sourceRoot":"","sources":["../../src/components/scrollable-row.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,WAAW,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AACvD,OAAc,EAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACzD,OAAO,EAAC,EAAE,EAAC,MAAM,cAAc,CAAC;AAahC,MAAM,UAAU,aAAa,CAAC,EAC5B,QAAQ,EACR,SAAS,EACT,eAAe,EACf,SAAS,EACT,YAAY,GAAG,GAAG,EAClB,eAAe,GAAG,OAAO,EACzB,cAAc,EACd,kBAAkB,GACC;IACnB,MAAM,WAAW,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IACjD,MAAM,YAAY,GAAG,SAAS,IAAI,WAAW,CAAC;IAC9C,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC1D,MAAM,CAAC,cAAc,EAAE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AAC,CAAC;IAE7B,MAAM,cAAc,GAAG,EAAE,CACvB,sGAAsG,EACtG,eAAe,KAAK,OAAO;QACzB,CAAC,CAAC,gDAAgD;QAClD,CAAC,CAAC,aAAa,EACjB,cAAc,CACf,CAAC;IAEF,OAAO,CACL,eAAK,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,aACvC,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,EAC/B,QAAQ,EAAE,CAAC,aAAa,EACxB,SAAS,EAAE,EAAE,CACX,cAAc,EACd,2BAA2B,EAC3B,4EAA4E,EAC5E,CAAC,aAAa,IAAI,+BAA+B,CAClD,gBACU,aAAa,EACxB,KAAK,EAAC,aAAa,YAEnB,KAAC,WAAW,IACV,SAAS,EAAE,EAAE,CACX,6EAA6E,EAC7E,kBAAkB,CACnB,GACD,GACK,EAET,cAAK,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,eAAe,YAC/C,QAAQ,GACL,EAEN,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,EAChC,QAAQ,EAAE,CAAC,cAAc,EACzB,SAAS,EAAE,EAAE,CACX,cAAc,EACd,0BAA0B,EAC1B,4EAA4E,EAC5E,CAAC,cAAc,IAAI,+BAA+B,CACnD,gBACU,cAAc,EACzB,KAAK,EAAC,cAAc,YAEpB,KAAC,YAAY,IACX,SAAS,EAAE,EAAE,CACX,6EAA6E,EAC7E,kBAAkB,CACnB,GACD,GACK,IACL,CACP,CAAC;AACJ,CAAC","sourcesContent":["import {ChevronLeft, ChevronRight} from 'lucide-react';\nimport React, {useEffect, useRef, useState} from 'react';\nimport {cn} from '../lib/utils';\n\ntype ScrollableRowProps = {\n children: React.ReactNode;\n className?: string;\n scrollClassName?: string;\n scrollRef?: React.RefObject<HTMLDivElement>;\n scrollAmount?: number;\n arrowVisibility?: 'hover' | 'always';\n arrowClassName?: string;\n arrowIconClassName?: string;\n};\n\nexport function ScrollableRow({\n children,\n className,\n scrollClassName,\n scrollRef,\n scrollAmount = 200,\n arrowVisibility = 'hover',\n arrowClassName,\n arrowIconClassName,\n}: ScrollableRowProps) {\n const internalRef = useRef<HTMLDivElement>(null);\n const containerRef = scrollRef ?? internalRef;\n const [canScrollLeft, setCanScrollLeft] = useState(false);\n const [canScrollRight, setCanScrollRight] = useState(false);\n\n const scrollBy = (direction: 'left' | 'right') => {\n const container = containerRef.current;\n if (!container) return;\n\n container.scrollBy({\n left: direction === 'left' ? -scrollAmount : scrollAmount,\n behavior: 'smooth',\n });\n };\n\n useEffect(() => {\n const updateScrollState = () => {\n const container = containerRef.current;\n if (!container) return;\n\n const {scrollLeft, scrollWidth, clientWidth} = container;\n setCanScrollLeft(scrollLeft > 0);\n setCanScrollRight(scrollLeft + clientWidth < scrollWidth - 1);\n };\n\n const container = containerRef.current;\n if (!container) return;\n\n updateScrollState();\n\n container.addEventListener('scroll', updateScrollState);\n const resizeObserver = new ResizeObserver(updateScrollState);\n resizeObserver.observe(container);\n\n return () => {\n container.removeEventListener('scroll', updateScrollState);\n resizeObserver.disconnect();\n };\n }, [children, containerRef]);\n\n const arrowBaseClass = cn(\n 'absolute top-0 z-10 flex h-full w-8 items-center backdrop-blur-md bg-background/50 transition-colors',\n arrowVisibility === 'hover'\n ? 'opacity-0 transition-opacity hover:opacity-100'\n : 'opacity-100',\n arrowClassName,\n );\n\n return (\n <div className={cn('relative', className)}>\n <button\n type=\"button\"\n onClick={() => scrollBy('left')}\n disabled={!canScrollLeft}\n className={cn(\n arrowBaseClass,\n 'left-0 justify-start pl-1',\n 'from-background/90 via-background/60 group bg-gradient-to-r to-transparent',\n !canScrollLeft && 'pointer-events-none opacity-0',\n )}\n aria-label=\"Scroll left\"\n title=\"Scroll left\"\n >\n <ChevronLeft\n className={cn(\n 'text-muted-foreground group-hover:text-foreground h-5 w-5 transition-colors',\n arrowIconClassName,\n )}\n />\n </button>\n\n <div ref={containerRef} className={scrollClassName}>\n {children}\n </div>\n\n <button\n type=\"button\"\n onClick={() => scrollBy('right')}\n disabled={!canScrollRight}\n className={cn(\n arrowBaseClass,\n 'right-0 justify-end pr-1',\n 'from-background/90 via-background/60 group bg-gradient-to-l to-transparent',\n !canScrollRight && 'pointer-events-none opacity-0',\n )}\n aria-label=\"Scroll right\"\n title=\"Scroll right\"\n >\n <ChevronRight\n className={cn(\n 'text-muted-foreground group-hover:text-foreground h-5 w-5 transition-colors',\n arrowIconClassName,\n )}\n />\n </button>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"scrollable-row.js","sourceRoot":"","sources":["../../src/components/scrollable-row.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,WAAW,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,EAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACzD,OAAO,EAAC,EAAE,EAAC,MAAM,cAAc,CAAC;AAkBhC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAG3C,SAAS,aAAa,CACtB,EACE,QAAQ,EACR,SAAS,EACT,eAAe,EACf,SAAS,EACT,YAAY,GAAG,GAAG,EAClB,eAAe,GAAG,OAAO,EACzB,cAAc,EACd,kBAAkB,EAClB,GAAG,IAAI,EACR,EACD,YAAY;IAEZ,MAAM,WAAW,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IACjD,MAAM,YAAY,GAAG,SAAS,IAAI,WAAW,CAAC;IAC9C,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC1D,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE5D,MAAM,QAAQ,GAAG,CAAC,SAA2B,EAAE,EAAE;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ffect, useRef, useState} from 'react';\nimport {cn} from '../lib/utils';\n\ntype ScrollableRowProps = {\n children: React.ReactNode;\n className?: string;\n scrollClassName?: string;\n /**\n * Ref to the inner scrolling container. Replaces the internal ref; the\n * arrows keep working.\n */\n scrollRef?: React.RefObject<HTMLDivElement>;\n /** Pixels scrolled per arrow activation. Defaults to 200. */\n scrollAmount?: number;\n arrowVisibility?: 'hover' | 'always';\n arrowClassName?: string;\n arrowIconClassName?: string;\n} & Omit<React.ComponentPropsWithoutRef<'div'>, 'children' | 'className'>;\n\n/**\n * A horizontally scrolling row with arrows that appear only where there is more\n * content.\n *\n * The forwarded ref and `className` target the outer wrapper (so `Slot` or\n * drop-target wrapping works); `scrollRef` targets the inner scrolling\n * container.\n */\nexport const ScrollableRow = React.forwardRef<\n HTMLDivElement,\n ScrollableRowProps\n>(function ScrollableRow(\n {\n children,\n className,\n scrollClassName,\n scrollRef,\n scrollAmount = 200,\n arrowVisibility = 'hover',\n arrowClassName,\n arrowIconClassName,\n ...rest\n },\n forwardedRef,\n) {\n const internalRef = useRef<HTMLDivElement>(null);\n const containerRef = scrollRef ?? internalRef;\n const [canScrollLeft, setCanScrollLeft] = useState(false);\n const [canScrollRight, setCanScrollRight] = useState(false);\n\n const scrollBy = (direction: 'left' | 'right') => {\n const container = containerRef.current;\n if (!container) return;\n\n container.scrollBy({\n left: direction === 'left' ? -scrollAmount : scrollAmount,\n behavior: 'smooth',\n });\n };\n\n useEffect(() => {\n const updateScrollState = () => {\n const container = containerRef.current;\n if (!container) return;\n\n const {scrollLeft, scrollWidth, clientWidth} = container;\n setCanScrollLeft(scrollLeft > 0);\n setCanScrollRight(scrollLeft + clientWidth < scrollWidth - 1);\n };\n\n const container = containerRef.current;\n if (!container) return;\n\n updateScrollState();\n\n container.addEventListener('scroll', updateScrollState);\n\n const resizeObserver = new ResizeObserver(updateScrollState);\n resizeObserver.observe(container);\n\n // The container's own box stays fixed when its content changes size (e.g.\n // loading placeholders replaced by wider suggestions), so ResizeObserver\n // on the container alone would leave the arrows stale. Observe each child\n // element instead, and re-observe as children are added or removed, so\n // overflow changes track content-size changes too.\n const contentObserver = new ResizeObserver(updateScrollState);\n const observeChildren = () => {\n contentObserver.disconnect();\n for (const child of Array.from(container.children)) {\n contentObserver.observe(child);\n }\n };\n observeChildren();\n\n const mutationObserver = new MutationObserver((mutations) => {\n // Only direct child additions/removals change the resize-observer targets.\n if (\n mutations.some(\n ({type, target}) => type === 'childList' && target === container,\n )\n ) {\n observeChildren();\n }\n updateScrollState();\n });\n // Text and styling can change overflow without resizing a direct child.\n // Observe all attributes: hidden and arbitrary CSS selectors affect layout too.\n mutationObserver.observe(container, {\n childList: true,\n characterData: true,\n attributes: true,\n subtree: true,\n });\n\n // Font metrics can change direct-text overflow without a DOM mutation or\n // an element resize. Refresh after font loading settles, including failures.\n const fonts = container.ownerDocument.fonts;\n fonts?.addEventListener('loadingdone', updateScrollState);\n fonts?.addEventListener('loadingerror', updateScrollState);\n\n return () => {\n container.removeEventListener('scroll', updateScrollState);\n resizeObserver.disconnect();\n contentObserver.disconnect();\n mutationObserver.disconnect();\n fonts?.removeEventListener('loadingdone', updateScrollState);\n fonts?.removeEventListener('loadingerror', updateScrollState);\n };\n // `children` is intentionally excluded from the deps: it is typically a\n // fresh array on every parent render, and re-running this effect (which\n // calls setState) on every render would trip React's \"Maximum update depth\n // exceeded\" warning. DOM observers and font events handle content changes;\n // the scroll listener covers user/dnd scrolling.\n }, [containerRef]);\n\n const arrowBaseClass = cn(\n 'absolute top-0 z-10 flex h-full w-8 items-center backdrop-blur-md bg-background/50 transition-colors',\n arrowVisibility === 'hover'\n ? 'opacity-0 transition-opacity hover:opacity-100'\n : 'opacity-100',\n arrowClassName,\n );\n\n return (\n <div ref={forwardedRef} className={cn('relative', className)} {...rest}>\n <button\n type=\"button\"\n onClick={() => scrollBy('left')}\n disabled={!canScrollLeft}\n className={cn(\n arrowBaseClass,\n 'left-0 justify-start pl-1',\n 'from-background/90 via-background/60 group bg-gradient-to-r to-transparent',\n !canScrollLeft && 'pointer-events-none opacity-0',\n )}\n aria-label=\"Scroll left\"\n title=\"Scroll left\"\n >\n <ChevronLeft\n className={cn(\n 'text-muted-foreground group-hover:text-foreground h-5 w-5 transition-colors',\n arrowIconClassName,\n )}\n />\n </button>\n\n <div ref={containerRef} className={scrollClassName}>\n {children}\n </div>\n\n <button\n type=\"button\"\n onClick={() => scrollBy('right')}\n disabled={!canScrollRight}\n className={cn(\n arrowBaseClass,\n 'right-0 justify-end pr-1',\n 'from-background/90 via-background/60 group bg-gradient-to-l to-transparent',\n !canScrollRight && 'pointer-events-none opacity-0',\n )}\n aria-label=\"Scroll right\"\n title=\"Scroll right\"\n >\n <ChevronRight\n className={cn(\n 'text-muted-foreground group-hover:text-foreground h-5 w-5 transition-colors',\n arrowIconClassName,\n )}\n />\n </button>\n </div>\n );\n});\n\nScrollableRow.displayName = 'ScrollableRow';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../src/components/textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../src/components/textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,KAAK,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,GAAG;IACtD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,QAAQ,wGAoDb,CAAC;AAGF,OAAO,EAAC,QAAQ,EAAC,CAAC"}
|
|
@@ -1,95 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { cn } from '../lib/utils';
|
|
4
|
-
|
|
5
|
-
* Uses layout effect in the browser and falls back to effect during SSR.
|
|
6
|
-
*/
|
|
7
|
-
const useIsomorphicLayoutEffect = typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect;
|
|
8
|
-
/**
|
|
9
|
-
* Keeps a textarea height synchronized with its content and container width.
|
|
10
|
-
*
|
|
11
|
-
* The resize path is intentionally triggered from multiple sources (input,
|
|
12
|
-
* value changes, and width changes) and then deduped per frame.
|
|
13
|
-
*/
|
|
14
|
-
function useAutoResizeTextarea({ autoResize, textareaRef, value, defaultValue, }) {
|
|
15
|
-
const [hasOverflow, setHasOverflow] = React.useState(false);
|
|
16
|
-
const lastMeasuredWidthRef = React.useRef(0);
|
|
17
|
-
const resizeFrameRef = React.useRef(null);
|
|
18
|
-
const applyResizeToFitContent = React.useCallback(() => {
|
|
19
|
-
const el = textareaRef.current;
|
|
20
|
-
if (!el || !autoResize || typeof window === 'undefined')
|
|
21
|
-
return;
|
|
22
|
-
el.style.height = 'auto';
|
|
23
|
-
el.style.height = `${el.scrollHeight}px`;
|
|
24
|
-
const computedStyle = window.getComputedStyle(el);
|
|
25
|
-
const maxHeight = computedStyle.maxHeight;
|
|
26
|
-
if (maxHeight && maxHeight !== 'none') {
|
|
27
|
-
const maxHeightValue = parseFloat(maxHeight);
|
|
28
|
-
setHasOverflow(el.scrollHeight > maxHeightValue);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
setHasOverflow(false);
|
|
32
|
-
}
|
|
33
|
-
}, [autoResize, textareaRef]);
|
|
34
|
-
const resizeToFitContent = React.useCallback(() => {
|
|
35
|
-
if (!autoResize || typeof window === 'undefined')
|
|
36
|
-
return;
|
|
37
|
-
// Keep input/effect-triggered resize paths for robustness, but collapse
|
|
38
|
-
// same-frame calls into one DOM measurement/write cycle.
|
|
39
|
-
if (resizeFrameRef.current !== null)
|
|
40
|
-
return;
|
|
41
|
-
resizeFrameRef.current = window.requestAnimationFrame(() => {
|
|
42
|
-
resizeFrameRef.current = null;
|
|
43
|
-
applyResizeToFitContent();
|
|
44
|
-
});
|
|
45
|
-
}, [autoResize, applyResizeToFitContent]);
|
|
46
|
-
useIsomorphicLayoutEffect(() => {
|
|
47
|
-
resizeToFitContent();
|
|
48
|
-
}, [resizeToFitContent, value, defaultValue]);
|
|
49
|
-
React.useEffect(() => {
|
|
50
|
-
if (!autoResize)
|
|
51
|
-
return;
|
|
52
|
-
const el = textareaRef.current;
|
|
53
|
-
if (!el || typeof window === 'undefined')
|
|
54
|
-
return;
|
|
55
|
-
// Re-measure after layout settles so hidden/collapsed mount states
|
|
56
|
-
// don't leave a stale oversized height.
|
|
57
|
-
resizeToFitContent();
|
|
58
|
-
if (typeof ResizeObserver === 'undefined') {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
lastMeasuredWidthRef.current = el.getBoundingClientRect().width;
|
|
62
|
-
const observer = new ResizeObserver((entries) => {
|
|
63
|
-
const entry = entries[0];
|
|
64
|
-
if (!entry)
|
|
65
|
-
return;
|
|
66
|
-
const nextWidth = entry.contentRect.width;
|
|
67
|
-
if (Math.abs(nextWidth - lastMeasuredWidthRef.current) < 1) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
lastMeasuredWidthRef.current = nextWidth;
|
|
71
|
-
resizeToFitContent();
|
|
72
|
-
});
|
|
73
|
-
observer.observe(el);
|
|
74
|
-
return () => {
|
|
75
|
-
observer.disconnect();
|
|
76
|
-
};
|
|
77
|
-
}, [autoResize, resizeToFitContent, textareaRef]);
|
|
78
|
-
React.useEffect(() => {
|
|
79
|
-
if (typeof window === 'undefined')
|
|
80
|
-
return;
|
|
81
|
-
return () => {
|
|
82
|
-
if (resizeFrameRef.current !== null) {
|
|
83
|
-
window.cancelAnimationFrame(resizeFrameRef.current);
|
|
84
|
-
resizeFrameRef.current = null;
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
}, []);
|
|
88
|
-
return {
|
|
89
|
-
hasOverflow,
|
|
90
|
-
resizeToFitContent,
|
|
91
|
-
};
|
|
92
|
-
}
|
|
4
|
+
import { useAutoResizeTextarea } from '../hooks/useAutoResizeTextarea';
|
|
93
5
|
/**
|
|
94
6
|
* Textarea component with optional auto-resize behavior.
|
|
95
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.js","sourceRoot":"","sources":["../../src/components/textarea.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,EAAE,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"textarea.js","sourceRoot":"","sources":["../../src/components/textarea.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAC,EAAE,EAAC,MAAM,cAAc,CAAC;AAChC,OAAO,EAAC,qBAAqB,EAAC,MAAM,gCAAgC,CAAC;AAMrE;;GAEG;AACH,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAC/B,CACE,EACE,SAAS,EACT,UAAU,GAAG,KAAK,EAClB,OAAO,EACP,KAAK,EACL,YAAY,EACZ,IAAI,EACJ,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAsB,IAAI,CAAC,CAAC;IAEzD,KAAK,CAAC,mBAAmB,CACvB,GAAG,EACH,GAAG,EAAE,CAAC,QAAQ,CAAC,OAA8B,CAC9C,CAAC;IAEF,MAAM,EAAC,WAAW,EAAE,kBAAkB,EAAC,GAAG,qBAAqB,CAAC;QAC9D,UAAU;QACV,WAAW,EAAE,QAAQ;QACrB,KAAK;QACL,YAAY;KACb,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,CAAC,CAAuC,EAAE,EAAE;QAC9D,IAAI,UAAU;YAAE,kBAAkB,EAAE,CAAC;QACrC,IAAI,OAAO;YAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC,CAAC;IAEF,OAAO,CACL,mBACE,SAAS,EAAE,EAAE,CACX,6QAA6Q,EAC7Q,UAAU;YACR,CAAC,CAAC,WAAW;gBACX,CAAC,CAAC,iBAAiB;gBACnB,CAAC,CAAC,mBAAmB;YACvB,CAAC,CAAC,SAAS,EACb,SAAS,CACV,EACD,IAAI,EAAE,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAC1C,GAAG,EAAE,QAAQ,EACb,OAAO,EAAE,WAAW,EACpB,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,KACtB,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AACF,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC;AAElC,OAAO,EAAC,QAAQ,EAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport {cn} from '../lib/utils';\nimport {useAutoResizeTextarea} from '../hooks/useAutoResizeTextarea';\n\ntype TextareaProps = React.ComponentProps<'textarea'> & {\n autoResize?: boolean;\n};\n\n/**\n * Textarea component with optional auto-resize behavior.\n */\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n (\n {\n className,\n autoResize = false,\n onInput,\n value,\n defaultValue,\n rows,\n ...props\n },\n ref,\n ) => {\n const localRef = React.useRef<HTMLTextAreaElement>(null);\n\n React.useImperativeHandle(\n ref,\n () => localRef.current as HTMLTextAreaElement,\n );\n\n const {hasOverflow, resizeToFitContent} = useAutoResizeTextarea({\n autoResize,\n textareaRef: localRef,\n value,\n defaultValue,\n });\n\n const handleInput = (e: React.FormEvent<HTMLTextAreaElement>) => {\n if (autoResize) resizeToFitContent();\n if (onInput) onInput(e);\n };\n\n return (\n <textarea\n className={cn(\n 'border-input placeholder:text-muted-foreground focus-visible:ring-ring flex min-h-[60px] w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-sm focus-visible:ring-1 focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',\n autoResize\n ? hasOverflow\n ? 'overflow-y-auto'\n : 'overflow-y-hidden'\n : undefined,\n className,\n )}\n rows={rows ?? (autoResize ? 1 : undefined)}\n ref={localRef}\n onInput={handleInput}\n value={value}\n defaultValue={defaultValue}\n {...props}\n />\n );\n },\n);\nTextarea.displayName = 'Textarea';\n\nexport {Textarea};\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Options for {@link useAutoResizeTextarea}.
|
|
4
|
+
*/
|
|
5
|
+
export interface UseAutoResizeTextareaOptions {
|
|
6
|
+
/** Whether auto-resize is active. When false, the hook is a no-op. */
|
|
7
|
+
autoResize: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Ref to the textarea to measure and resize. May point to a textarea
|
|
10
|
+
* rendered by a component the caller does not own.
|
|
11
|
+
*/
|
|
12
|
+
textareaRef: React.RefObject<HTMLTextAreaElement | null>;
|
|
13
|
+
/** The textarea's current controlled value, if any. */
|
|
14
|
+
value?: React.ComponentProps<'textarea'>['value'];
|
|
15
|
+
/** The textarea's uncontrolled default value, if any. */
|
|
16
|
+
defaultValue?: React.ComponentProps<'textarea'>['defaultValue'];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Return value of {@link useAutoResizeTextarea}.
|
|
20
|
+
*/
|
|
21
|
+
export interface UseAutoResizeTextareaResult {
|
|
22
|
+
/** True when the content's height exceeds the element's `max-height`. */
|
|
23
|
+
hasOverflow: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Schedules a re-measure and height update on the next animation frame —
|
|
26
|
+
* the element's height is not yet updated when this returns.
|
|
27
|
+
*/
|
|
28
|
+
resizeToFitContent: () => void;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Keeps a textarea's height synchronized with its content and container
|
|
32
|
+
* width.
|
|
33
|
+
*
|
|
34
|
+
* Reads and writes only through the DOM node reached via `textareaRef`, so
|
|
35
|
+
* auto-grow can be layered onto a text input rendered by any component,
|
|
36
|
+
* including one that does not implement it itself.
|
|
37
|
+
*
|
|
38
|
+
* The resize path is triggered from several sources (input, value changes,
|
|
39
|
+
* width changes) and deduped per frame.
|
|
40
|
+
*
|
|
41
|
+
* @param options - See {@link UseAutoResizeTextareaOptions}.
|
|
42
|
+
* @returns See {@link UseAutoResizeTextareaResult}.
|
|
43
|
+
*/
|
|
44
|
+
export declare function useAutoResizeTextarea({ autoResize, textareaRef, value, defaultValue, }: UseAutoResizeTextareaOptions): UseAutoResizeTextareaResult;
|
|
45
|
+
//# sourceMappingURL=useAutoResizeTextarea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAutoResizeTextarea.d.ts","sourceRoot":"","sources":["../../src/hooks/useAutoResizeTextarea.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,sEAAsE;IACtE,UAAU,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;IACzD,uDAAuD;IACvD,KAAK,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC;IAClD,yDAAyD;IACzD,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,cAAc,CAAC,CAAC;CACjE;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,yEAAyE;IACzE,WAAW,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,kBAAkB,EAAE,MAAM,IAAI,CAAC;CAChC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,UAAU,EACV,WAAW,EACX,KAAK,EACL,YAAY,GACb,EAAE,4BAA4B,GAAG,2BAA2B,CAyF5D"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Uses layout effect in the browser and falls back to effect during SSR.
|
|
4
|
+
*/
|
|
5
|
+
const useIsomorphicLayoutEffect = typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect;
|
|
6
|
+
/**
|
|
7
|
+
* Keeps a textarea's height synchronized with its content and container
|
|
8
|
+
* width.
|
|
9
|
+
*
|
|
10
|
+
* Reads and writes only through the DOM node reached via `textareaRef`, so
|
|
11
|
+
* auto-grow can be layered onto a text input rendered by any component,
|
|
12
|
+
* including one that does not implement it itself.
|
|
13
|
+
*
|
|
14
|
+
* The resize path is triggered from several sources (input, value changes,
|
|
15
|
+
* width changes) and deduped per frame.
|
|
16
|
+
*
|
|
17
|
+
* @param options - See {@link UseAutoResizeTextareaOptions}.
|
|
18
|
+
* @returns See {@link UseAutoResizeTextareaResult}.
|
|
19
|
+
*/
|
|
20
|
+
export function useAutoResizeTextarea({ autoResize, textareaRef, value, defaultValue, }) {
|
|
21
|
+
const [hasOverflow, setHasOverflow] = React.useState(false);
|
|
22
|
+
const lastMeasuredWidthRef = React.useRef(0);
|
|
23
|
+
const resizeFrameRef = React.useRef(null);
|
|
24
|
+
const applyResizeToFitContent = React.useCallback(() => {
|
|
25
|
+
const el = textareaRef.current;
|
|
26
|
+
if (!el || !autoResize || typeof window === 'undefined')
|
|
27
|
+
return;
|
|
28
|
+
el.style.height = 'auto';
|
|
29
|
+
el.style.height = `${el.scrollHeight}px`;
|
|
30
|
+
const computedStyle = window.getComputedStyle(el);
|
|
31
|
+
const maxHeight = computedStyle.maxHeight;
|
|
32
|
+
if (maxHeight && maxHeight !== 'none') {
|
|
33
|
+
const maxHeightValue = parseFloat(maxHeight);
|
|
34
|
+
setHasOverflow(el.scrollHeight > maxHeightValue);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
setHasOverflow(false);
|
|
38
|
+
}
|
|
39
|
+
}, [autoResize, textareaRef]);
|
|
40
|
+
const resizeToFitContent = React.useCallback(() => {
|
|
41
|
+
if (!autoResize || typeof window === 'undefined')
|
|
42
|
+
return;
|
|
43
|
+
// Keep input/effect-triggered resize paths for robustness, but collapse
|
|
44
|
+
// same-frame calls into one DOM measurement/write cycle.
|
|
45
|
+
if (resizeFrameRef.current !== null)
|
|
46
|
+
return;
|
|
47
|
+
resizeFrameRef.current = window.requestAnimationFrame(() => {
|
|
48
|
+
resizeFrameRef.current = null;
|
|
49
|
+
applyResizeToFitContent();
|
|
50
|
+
});
|
|
51
|
+
}, [autoResize, applyResizeToFitContent]);
|
|
52
|
+
useIsomorphicLayoutEffect(() => {
|
|
53
|
+
resizeToFitContent();
|
|
54
|
+
}, [resizeToFitContent, value, defaultValue]);
|
|
55
|
+
React.useEffect(() => {
|
|
56
|
+
if (!autoResize)
|
|
57
|
+
return;
|
|
58
|
+
const el = textareaRef.current;
|
|
59
|
+
if (!el || typeof window === 'undefined')
|
|
60
|
+
return;
|
|
61
|
+
// Re-measure after layout settles so hidden/collapsed mount states
|
|
62
|
+
// don't leave a stale oversized height.
|
|
63
|
+
resizeToFitContent();
|
|
64
|
+
if (typeof ResizeObserver === 'undefined') {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
lastMeasuredWidthRef.current = el.getBoundingClientRect().width;
|
|
68
|
+
const observer = new ResizeObserver((entries) => {
|
|
69
|
+
const entry = entries[0];
|
|
70
|
+
if (!entry)
|
|
71
|
+
return;
|
|
72
|
+
const nextWidth = entry.contentRect.width;
|
|
73
|
+
if (Math.abs(nextWidth - lastMeasuredWidthRef.current) < 1) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
lastMeasuredWidthRef.current = nextWidth;
|
|
77
|
+
resizeToFitContent();
|
|
78
|
+
});
|
|
79
|
+
observer.observe(el);
|
|
80
|
+
return () => {
|
|
81
|
+
observer.disconnect();
|
|
82
|
+
};
|
|
83
|
+
}, [autoResize, resizeToFitContent, textareaRef]);
|
|
84
|
+
React.useEffect(() => {
|
|
85
|
+
if (typeof window === 'undefined')
|
|
86
|
+
return;
|
|
87
|
+
return () => {
|
|
88
|
+
if (resizeFrameRef.current !== null) {
|
|
89
|
+
window.cancelAnimationFrame(resizeFrameRef.current);
|
|
90
|
+
resizeFrameRef.current = null;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}, []);
|
|
94
|
+
return {
|
|
95
|
+
hasOverflow,
|
|
96
|
+
resizeToFitContent,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=useAutoResizeTextarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAutoResizeTextarea.js","sourceRoot":"","sources":["../../src/hooks/useAutoResizeTextarea.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;GAEG;AACH,MAAM,yBAAyB,GAC7B,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC;AAgC1E;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,qBAAqB,CAAC,EACpC,UAAU,EACV,WAAW,EACX,KAAK,EACL,YAAY,GACiB;IAC7B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5D,MAAM,oBAAoB,GAAG,KAAK,CAAC,MAAM,CAAS,CAAC,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CAAgB,IAAI,CAAC,CAAC;IAEzD,MAAM,uBAAuB,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACrD,MAAM,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,EAAE,IAAI,CAAC,UAAU,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,OAAO;QAEhE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;QACzB,EAAE,CAAC,K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kBAAkB;KACnB,CAAC;AACJ,CAAC","sourcesContent":["import * as React from 'react';\n\n/**\n * Uses layout effect in the browser and falls back to effect during SSR.\n */\nconst useIsomorphicLayoutEffect =\n typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect;\n\n/**\n * Options for {@link useAutoResizeTextarea}.\n */\nexport interface UseAutoResizeTextareaOptions {\n /** Whether auto-resize is active. When false, the hook is a no-op. */\n autoResize: boolean;\n /**\n * Ref to the textarea to measure and resize. May point to a textarea\n * rendered by a component the caller does not own.\n */\n textareaRef: React.RefObject<HTMLTextAreaElement | null>;\n /** The textarea's current controlled value, if any. */\n value?: React.ComponentProps<'textarea'>['value'];\n /** The textarea's uncontrolled default value, if any. */\n defaultValue?: React.ComponentProps<'textarea'>['defaultValue'];\n}\n\n/**\n * Return value of {@link useAutoResizeTextarea}.\n */\nexport interface UseAutoResizeTextareaResult {\n /** True when the content's height exceeds the element's `max-height`. */\n hasOverflow: boolean;\n /**\n * Schedules a re-measure and height update on the next animation frame —\n * the element's height is not yet updated when this returns.\n */\n resizeToFitContent: () => void;\n}\n\n/**\n * Keeps a textarea's height synchronized with its content and container\n * width.\n *\n * Reads and writes only through the DOM node reached via `textareaRef`, so\n * auto-grow can be layered onto a text input rendered by any component,\n * including one that does not implement it itself.\n *\n * The resize path is triggered from several sources (input, value changes,\n * width changes) and deduped per frame.\n *\n * @param options - See {@link UseAutoResizeTextareaOptions}.\n * @returns See {@link UseAutoResizeTextareaResult}.\n */\nexport function useAutoResizeTextarea({\n autoResize,\n textareaRef,\n value,\n defaultValue,\n}: UseAutoResizeTextareaOptions): UseAutoResizeTextareaResult {\n const [hasOverflow, setHasOverflow] = React.useState(false);\n const lastMeasuredWidthRef = React.useRef<number>(0);\n const resizeFrameRef = React.useRef<number | null>(null);\n\n const applyResizeToFitContent = React.useCallback(() => {\n const el = textareaRef.current;\n if (!el || !autoResize || typeof window === 'undefined') return;\n\n el.style.height = 'auto';\n el.style.height = `${el.scrollHeight}px`;\n\n const computedStyle = window.getComputedStyle(el);\n const maxHeight = computedStyle.maxHeight;\n if (maxHeight && maxHeight !== 'none') {\n const maxHeightValue = parseFloat(maxHeight);\n setHasOverflow(el.scrollHeight > maxHeightValue);\n } else {\n setHasOverflow(false);\n }\n }, [autoResize, textareaRef]);\n\n const resizeToFitContent = React.useCallback(() => {\n if (!autoResize || typeof window === 'undefined') return;\n\n // Keep input/effect-triggered resize paths for robustness, but collapse\n // same-frame calls into one DOM measurement/write cycle.\n if (resizeFrameRef.current !== null) return;\n\n resizeFrameRef.current = window.requestAnimationFrame(() => {\n resizeFrameRef.current = null;\n applyResizeToFitContent();\n });\n }, [autoResize, applyResizeToFitContent]);\n\n useIsomorphicLayoutEffect(() => {\n resizeToFitContent();\n }, [resizeToFitContent, value, defaultValue]);\n\n React.useEffect(() => {\n if (!autoResize) return;\n\n const el = textareaRef.current;\n if (!el || typeof window === 'undefined') return;\n\n // Re-measure after layout settles so hidden/collapsed mount states\n // don't leave a stale oversized height.\n resizeToFitContent();\n\n if (typeof ResizeObserver === 'undefined') {\n return;\n }\n\n lastMeasuredWidthRef.current = el.getBoundingClientRect().width;\n const observer = new ResizeObserver((entries) => {\n const entry = entries[0];\n if (!entry) return;\n\n const nextWidth = entry.contentRect.width;\n if (Math.abs(nextWidth - lastMeasuredWidthRef.current) < 1) {\n return;\n }\n\n lastMeasuredWidthRef.current = nextWidth;\n resizeToFitContent();\n });\n\n observer.observe(el);\n\n return () => {\n observer.disconnect();\n };\n }, [autoResize, resizeToFitContent, textareaRef]);\n\n React.useEffect(() => {\n if (typeof window === 'undefined') return;\n\n return () => {\n if (resizeFrameRef.current !== null) {\n window.cancelAnimationFrame(resizeFrameRef.current);\n resizeFrameRef.current = null;\n }\n };\n }, []);\n\n return {\n hasOverflow,\n resizeToFitContent,\n };\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ export { useDebouncedCallback } from './hooks/useDebouncedCallback';
|
|
|
66
66
|
export { useDebouncedValue } from './hooks/useDebouncedValue';
|
|
67
67
|
export { useIsMobile } from './hooks/use-mobile';
|
|
68
68
|
export { useRelativeCoordinates } from './hooks/useRelativeCoordinates';
|
|
69
|
+
export { useAutoResizeTextarea, type UseAutoResizeTextareaOptions, type UseAutoResizeTextareaResult, } from './hooks/useAutoResizeTextarea';
|
|
69
70
|
export { resolveFontSizeClass, type FontSizeToken } from './lib/fontSize';
|
|
70
71
|
export { cn } from './lib/utils';
|
|
71
72
|
export { DEFAULT_THEME, DEFAULT_THEME_STORAGE_KEY, getResolvedTheme, getTheme, getThemePreference, ThemeProvider, useTheme, type ResolvedTheme, type Theme, } from './theme/theme-provider';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAC,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAEvE,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EAAC,KAAK,EAAE,aAAa,EAAE,KAAK,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAEzE,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAC,MAAM,EAAE,cAAc,EAAE,KAAK,WAAW,EAAC,MAAM,qBAAqB,CAAC;AAE7E,OAAO,EAAC,QAAQ,EAAE,KAAK,aAAa,EAAC,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EACL,IAAI,EACJ,WAAW,EACX,eAAe,EACf,UAAU,EACV,UAAU,EACV,SAAS,GACV,MAAM,mBAAmB,CAAC;AAE3B,OAA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EAAC,EAAE,EAAC,MAAM,aAAa,CAAC;AAG/B,OAAO,EACL,aAAa,EACb,yBAAyB,EACzB,gBAAgB,EAChB,QAAQ,EACR,kBAAkB,EAClB,aAAa,EACb,QAAQ,EACR,KAAK,aAAa,EAClB,KAAK,KAAK,GACX,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAC,IAAI,EAAC,MAAM,sBAAsB,CAAC;AAE1C,OAAO,EAAC,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -67,6 +67,7 @@ export { useDebouncedCallback } from './hooks/useDebouncedCallback';
|
|
|
67
67
|
export { useDebouncedValue } from './hooks/useDebouncedValue';
|
|
68
68
|
export { useIsMobile } from './hooks/use-mobile';
|
|
69
69
|
export { useRelativeCoordinates } from './hooks/useRelativeCoordinates';
|
|
70
|
+
export { useAutoResizeTextarea, } from './hooks/useAutoResizeTextarea';
|
|
70
71
|
// Utilities
|
|
71
72
|
export { resolveFontSizeClass } from './lib/fontSize';
|
|
72
73
|
export { cn } from './lib/utils';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,aAAa;AACb,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAC,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAEvE,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EAAC,KAAK,EAAE,aAAa,EAAkB,MAAM,oBAAoB,CAAC;AAEzE,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,cAAc,EACd,c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CAAC;AAEtE,YAAY;AACZ,OAAO,EAAC,oBAAoB,EAAqB,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAC,EAAE,EAAC,MAAM,aAAa,CAAC;AAE/B,QAAQ;AACR,OAAO,EACL,aAAa,EACb,yBAAyB,EACzB,gBAAgB,EAChB,QAAQ,EACR,kBAAkB,EAClB,aAAa,EACb,QAAQ,GAGT,MAAM,wBAAwB,CAAC;AAEhC,uBAAuB;AACvB,OAAO,EAAC,IAAI,EAAC,MAAM,sBAAsB,CAAC;AAE1C,OAAO,EAAC,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,yBAAyB,CAAC","sourcesContent":["/**\n * {@include ../README.md}\n * @packageDocumentation\n */\n\n// Components\nexport {\n Accordion,\n AccordionContent,\n AccordionItem,\n AccordionTrigger,\n} from './components/accordion';\n\nexport {Alert, AlertDescription, AlertTitle} from './components/alert';\n\nexport {AspectRatio} from './components/aspect-ratio';\n\nexport {Badge, badgeVariants, type BadgeProps} from './components/badge';\n\nexport {\n Breadcrumb,\n BreadcrumbEllipsis,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbList,\n BreadcrumbPage,\n BreadcrumbSeparator,\n} from './components/breadcrumb';\n\nexport {Button, buttonVariants, type ButtonProps} from './components/button';\n\nexport {Calendar, type CalendarProps} from './components/calendar';\n\nexport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardTitle,\n} from './components/card';\n\nexport {Checkbox} from './components/checkbox';\n\nexport {\n Combobox,\n type ComboboxContentProps,\n type ComboboxItemProps,\n type ComboboxRootProps,\n type ComboboxTriggerProps,\n} from './components/combobox';\nexport {\n useCombobox,\n type UseComboboxOptions,\n type UseComboboxReturn,\n} from './hooks/useCombobox';\n\nexport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from './components/collapsible';\n\nexport {\n Command,\n CommandDialog,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n CommandShortcut,\n} from './components/command';\n\nexport {\n ContextMenu,\n ContextMenuCheckboxItem,\n ContextMenuContent,\n ContextMenuGroup,\n ContextMenuItem,\n ContextMenuLabel,\n ContextMenuPortal,\n ContextMenuRadioGroup,\n ContextMenuRadioItem,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuSub,\n ContextMenuSubContent,\n ContextMenuSubTrigger,\n ContextMenuTrigger,\n} from './components/context-menu';\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n} from './components/dialog';\n\nexport {\n Drawer,\n DrawerClose,\n DrawerContent,\n DrawerDescription,\n DrawerFooter,\n DrawerHandle,\n DrawerHeader,\n DrawerOverlay,\n DrawerPortal,\n DrawerTitle,\n DrawerTrigger,\n} from './components/drawer';\n\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from './components/dropdown-menu';\n\nexport {EditableText} from './components/editable-text';\n\nexport {ErrorBoundary} from './components/error-boundary';\n\nexport {ErrorPane} from './components/error-pane';\n\nexport {\n Form,\n FormControl,\n FormDescription,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n useFormField,\n} from './components/form';\n\nexport {Input} from './components/input';\n\nexport {\n SettingsPanelHeader,\n type SettingsPanelHeaderProps,\n} from './components/settings-panel-header';\n\nexport {Label} from './components/label';\n\nexport {\n ModifierScrollOverlay,\n type ModifierScrollOverlayProps,\n} from './components/modifier-scroll-overlay';\n\nexport {\n Menubar,\n MenubarCheckboxItem,\n MenubarContent,\n MenubarGroup,\n MenubarItem,\n MenubarLabel,\n MenubarMenu,\n MenubarPortal,\n MenubarRadioGroup,\n MenubarRadioItem,\n MenubarSeparator,\n MenubarShortcut,\n MenubarSub,\n MenubarSubContent,\n MenubarSubTrigger,\n MenubarTrigger,\n} from './components/menu-bar';\n\nexport {\n Pagination,\n PaginationContent,\n PaginationEllipsis,\n PaginationItem,\n PaginationLink,\n PaginationNext,\n PaginationPrevious,\n} from './components/pagination';\n\nexport {\n Popover,\n PopoverAnchor,\n PopoverContent,\n PopoverTrigger,\n} from './components/popover';\n\nexport {ProgressModal} from './components/progress-modal';\n\nexport {Progress} from './components/progress';\n\nexport {RadioGroup, RadioGroupItem} from './components/radio-group';\n\nexport {\n ResizableHandle,\n ResizablePanel,\n ResizablePanelGroup,\n} from './components/resizable';\nexport type {\n ResizablePanelOrientation,\n ResizablePanelHandle,\n} from './components/resizable';\n\nexport {RunButton, type RunButtonProps} from './components/run-button';\n\nexport {\n TabStrip,\n type TabDescriptor,\n type TabStripDndMode,\n type TabStripDragData,\n type TabStripProps,\n} from './components/tab-strip';\n\nexport {ScrollableRow} from './components/scrollable-row';\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n} from './components/select';\n\nexport {ScrollArea, ScrollBar} from './components/scroll-area';\n\nexport {Separator} from './components/separator';\n\nexport {\n Sheet,\n SheetClose,\n SheetContent,\n SheetDescription,\n SheetFooter,\n SheetHeader,\n SheetOverlay,\n SheetPortal,\n SheetTitle,\n SheetTrigger,\n} from './components/sheet';\n\nexport {\n Sidebar,\n SidebarContent,\n SidebarFooter,\n SidebarGroup,\n SidebarGroupAction,\n SidebarGroupContent,\n SidebarGroupLabel,\n SidebarHeader,\n SidebarInput,\n SidebarInset,\n SidebarMenu,\n SidebarMenuAction,\n SidebarMenuBadge,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarMenuSkeleton,\n SidebarMenuSub,\n SidebarMenuSubButton,\n SidebarMenuSubItem,\n SidebarProvider,\n SidebarRail,\n SidebarSeparator,\n SidebarTrigger,\n useSidebar,\n} from './components/sidebar';\n\nexport {SkeletonPane} from './components/skeleton-pane';\n\nexport {Skeleton} from './components/skeleton';\n\nexport {Slider} from './components/slider';\n\nexport {SpinnerPane} from './components/spinner-pane';\n\nexport {Spinner} from './components/spinner';\n\nexport {Switch} from './components/switch';\n\nexport {\n Table,\n TableBody,\n TableCaption,\n TableCell,\n TableFooter,\n TableHead,\n TableHeader,\n TableRow,\n} from './components/table';\n\nexport {Tabs, TabsContent, TabsList, TabsTrigger} from './components/tabs';\n\nexport {Textarea} from './components/textarea';\n\nexport {ThemeSwitch} from './components/theme-switch';\n\nexport {ToggleGroup, ToggleGroupItem} from './components/toggle-group';\n\nexport {Toggle, toggleVariants} from './components/toggle';\n\nexport {CopyButton, type CopyButtonProps} from './components/copy-button';\n\nexport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from './components/tooltip';\n\nexport {Tree, type TreeNodeData} from './components/tree';\n\n// Hooks\nexport {toast, type ExternalToast} from 'sonner';\n\nexport {\n useAspectRatioDimensions,\n type Dimensions,\n type UseAspectRatioDimensionsProps,\n} from './hooks/useAspectRatioDimensions';\n\nexport {\n useDisclosure,\n type UseDisclosureReturnValue,\n} from './hooks/useDisclosure';\n\nexport {useDebounce} from './hooks/useDebounce';\nexport {useDebouncedCallback} from './hooks/useDebouncedCallback';\nexport {useDebouncedValue} from './hooks/useDebouncedValue';\n\nexport {useIsMobile} from './hooks/use-mobile';\nexport {useRelativeCoordinates} from './hooks/useRelativeCoordinates';\n\n// Utilities\nexport {resolveFontSizeClass, type FontSizeToken} from './lib/fontSize';\nexport {cn} from './lib/utils';\n\n// Theme\nexport {\n DEFAULT_THEME,\n DEFAULT_THEME_STORAGE_KEY,\n getResolvedTheme,\n getTheme,\n getThemePreference,\n ThemeProvider,\n useTheme,\n type ResolvedTheme,\n type Theme,\n} from './theme/theme-provider';\n\n// Re-export from Radix\nexport {Slot} from '@radix-ui/react-slot';\n\nexport {Toaster} from './components/sonner';\n\nexport {\n HoverCard,\n HoverCardContent,\n HoverCardTrigger,\n} from './components/hover-card';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,aAAa;AACb,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAC,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAEvE,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EAAC,KAAK,EAAE,aAAa,EAAkB,MAAM,oBAAoB,CAAC;AAEzE,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAC,MAAM,EAAE,cAAc,EAAmB,MAAM,qBAAqB,CAAC;AAE7E,OAAO,EAAC,QAAQ,EAAqB,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EACL,IAAI,EACJ,WAAW,EACX,eAAe,EACf,UAAU,EACV,UAAU,EACV,SAAS,GACV,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAE/C,OAAO,EACL,QAAQ,GAKT,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,WAAW,GAGZ,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,OAAO,EACP,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,YA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port {\n Accordion,\n AccordionContent,\n AccordionItem,\n AccordionTrigger,\n} from './components/accordion';\n\nexport {Alert, AlertDescription, AlertTitle} from './components/alert';\n\nexport {AspectRatio} from './components/aspect-ratio';\n\nexport {Badge, badgeVariants, type BadgeProps} from './components/badge';\n\nexport {\n Breadcrumb,\n BreadcrumbEllipsis,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbList,\n BreadcrumbPage,\n BreadcrumbSeparator,\n} from './components/breadcrumb';\n\nexport {Button, buttonVariants, type ButtonProps} from './components/button';\n\nexport {Calendar, type CalendarProps} from './components/calendar';\n\nexport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardHeader,\n CardTitle,\n} from './components/card';\n\nexport {Checkbox} from './components/checkbox';\n\nexport {\n Combobox,\n type ComboboxContentProps,\n type ComboboxItemProps,\n type ComboboxRootProps,\n type ComboboxTriggerProps,\n} from './components/combobox';\nexport {\n useCombobox,\n type UseComboboxOptions,\n type UseComboboxReturn,\n} from './hooks/useCombobox';\n\nexport {\n Collapsible,\n CollapsibleContent,\n CollapsibleTrigger,\n} from './components/collapsible';\n\nexport {\n Command,\n CommandDialog,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n CommandShortcut,\n} from './components/command';\n\nexport {\n ContextMenu,\n ContextMenuCheckboxItem,\n ContextMenuContent,\n ContextMenuGroup,\n ContextMenuItem,\n ContextMenuLabel,\n ContextMenuPortal,\n ContextMenuRadioGroup,\n ContextMenuRadioItem,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuSub,\n ContextMenuSubContent,\n ContextMenuSubTrigger,\n ContextMenuTrigger,\n} from './components/context-menu';\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n} from './components/dialog';\n\nexport {\n Drawer,\n DrawerClose,\n DrawerContent,\n DrawerDescription,\n DrawerFooter,\n DrawerHandle,\n DrawerHeader,\n DrawerOverlay,\n DrawerPortal,\n DrawerTitle,\n DrawerTrigger,\n} from './components/drawer';\n\nexport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuPortal,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from './components/dropdown-menu';\n\nexport {EditableText} from './components/editable-text';\n\nexport {ErrorBoundary} from './components/error-boundary';\n\nexport {ErrorPane} from './components/error-pane';\n\nexport {\n Form,\n FormControl,\n FormDescription,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n useFormField,\n} from './components/form';\n\nexport {Input} from './components/input';\n\nexport {\n SettingsPanelHeader,\n type SettingsPanelHeaderProps,\n} from './components/settings-panel-header';\n\nexport {Label} from './components/label';\n\nexport {\n ModifierScrollOverlay,\n type ModifierScrollOverlayProps,\n} from './components/modifier-scroll-overlay';\n\nexport {\n Menubar,\n MenubarCheckboxItem,\n MenubarContent,\n MenubarGroup,\n MenubarItem,\n MenubarLabel,\n MenubarMenu,\n MenubarPortal,\n MenubarRadioGroup,\n MenubarRadioItem,\n MenubarSeparator,\n MenubarShortcut,\n MenubarSub,\n MenubarSubContent,\n MenubarSubTrigger,\n MenubarTrigger,\n} from './components/menu-bar';\n\nexport {\n Pagination,\n PaginationContent,\n PaginationEllipsis,\n PaginationItem,\n PaginationLink,\n PaginationNext,\n PaginationPrevious,\n} from './components/pagination';\n\nexport {\n Popover,\n PopoverAnchor,\n PopoverContent,\n PopoverTrigger,\n} from './components/popover';\n\nexport {ProgressModal} from './components/progress-modal';\n\nexport {Progress} from './components/progress';\n\nexport {RadioGroup, RadioGroupItem} from './components/radio-group';\n\nexport {\n ResizableHandle,\n ResizablePanel,\n ResizablePanelGroup,\n} from './components/resizable';\nexport type {\n ResizablePanelOrientation,\n ResizablePanelHandle,\n} from './components/resizable';\n\nexport {RunButton, type RunButtonProps} from './components/run-button';\n\nexport {\n TabStrip,\n type TabDescriptor,\n type TabStripDndMode,\n type TabStripDragData,\n type TabStripProps,\n} from './components/tab-strip';\n\nexport {ScrollableRow} from './components/scrollable-row';\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n} from './components/select';\n\nexport {ScrollArea, ScrollBar} from './components/scroll-area';\n\nexport {Separator} from './components/separator';\n\nexport {\n Sheet,\n SheetClose,\n SheetContent,\n SheetDescription,\n SheetFooter,\n SheetHeader,\n SheetOverlay,\n SheetPortal,\n SheetTitle,\n SheetTrigger,\n} from './components/sheet';\n\nexport {\n Sidebar,\n SidebarContent,\n SidebarFooter,\n SidebarGroup,\n SidebarGroupAction,\n SidebarGroupContent,\n SidebarGroupLabel,\n SidebarHeader,\n SidebarInput,\n SidebarInset,\n SidebarMenu,\n SidebarMenuAction,\n SidebarMenuBadge,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarMenuSkeleton,\n SidebarMenuSub,\n SidebarMenuSubButton,\n SidebarMenuSubItem,\n SidebarProvider,\n SidebarRail,\n SidebarSeparator,\n SidebarTrigger,\n useSidebar,\n} from './components/sidebar';\n\nexport {SkeletonPane} from './components/skeleton-pane';\n\nexport {Skeleton} from './components/skeleton';\n\nexport {Slider} from './components/slider';\n\nexport {SpinnerPane} from './components/spinner-pane';\n\nexport {Spinner} from './components/spinner';\n\nexport {Switch} from './components/switch';\n\nexport {\n Table,\n TableBody,\n TableCaption,\n TableCell,\n TableFooter,\n TableHead,\n TableHeader,\n TableRow,\n} from './components/table';\n\nexport {Tabs, TabsContent, TabsList, TabsTrigger} from './components/tabs';\n\nexport {Textarea} from './components/textarea';\n\nexport {ThemeSwitch} from './components/theme-switch';\n\nexport {ToggleGroup, ToggleGroupItem} from './components/toggle-group';\n\nexport {Toggle, toggleVariants} from './components/toggle';\n\nexport {CopyButton, type CopyButtonProps} from './components/copy-button';\n\nexport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from './components/tooltip';\n\nexport {Tree, type TreeNodeData} from './components/tree';\n\n// Hooks\nexport {toast, type ExternalToast} from 'sonner';\n\nexport {\n useAspectRatioDimensions,\n type Dimensions,\n type UseAspectRatioDimensionsProps,\n} from './hooks/useAspectRatioDimensions';\n\nexport {\n useDisclosure,\n type UseDisclosureReturnValue,\n} from './hooks/useDisclosure';\n\nexport {useDebounce} from './hooks/useDebounce';\nexport {useDebouncedCallback} from './hooks/useDebouncedCallback';\nexport {useDebouncedValue} from './hooks/useDebouncedValue';\n\nexport {useIsMobile} from './hooks/use-mobile';\nexport {useRelativeCoordinates} from './hooks/useRelativeCoordinates';\n\nexport {\n useAutoResizeTextarea,\n type UseAutoResizeTextareaOptions,\n type UseAutoResizeTextareaResult,\n} from './hooks/useAutoResizeTextarea';\n\n// Utilities\nexport {resolveFontSizeClass, type FontSizeToken} from './lib/fontSize';\nexport {cn} from './lib/utils';\n\n// Theme\nexport {\n DEFAULT_THEME,\n DEFAULT_THEME_STORAGE_KEY,\n getResolvedTheme,\n getTheme,\n getThemePreference,\n ThemeProvider,\n useTheme,\n type ResolvedTheme,\n type Theme,\n} from './theme/theme-provider';\n\n// Re-export from Radix\nexport {Slot} from '@radix-ui/react-slot';\n\nexport {Toaster} from './components/sonner';\n\nexport {\n HoverCard,\n HoverCardContent,\n HoverCardTrigger,\n} from './components/hover-card';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqlrooms/ui",
|
|
3
|
-
"version": "0.29.0-rc.
|
|
3
|
+
"version": "0.29.0-rc.13",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/sqlrooms/sqlrooms.git"
|
|
@@ -68,6 +68,8 @@
|
|
|
68
68
|
"vaul": "^1.1.2"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
+
"@jest/globals": "^30.3.0",
|
|
72
|
+
"jsdom": "^29.1.1",
|
|
71
73
|
"ts-jest": "^29.4.4"
|
|
72
74
|
},
|
|
73
75
|
"peerDependencies": {
|
|
@@ -76,5 +78,5 @@
|
|
|
76
78
|
"publishConfig": {
|
|
77
79
|
"access": "public"
|
|
78
80
|
},
|
|
79
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "d183fe9164e5f67c23b358328ca03dbf77a035a4"
|
|
80
82
|
}
|
package/tailwind-preset.css
CHANGED
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
:root {
|
|
16
|
+
/* Native controls (color inputs, etc.): light UA chrome. */
|
|
17
|
+
color-scheme: light;
|
|
16
18
|
--background: 0 0% 100%;
|
|
17
19
|
--foreground: 240 10% 3.9%;
|
|
18
20
|
--card: 0 0% 100%;
|
|
@@ -67,7 +69,13 @@
|
|
|
67
69
|
--editor-lint-warning: 32 94% 48%;
|
|
68
70
|
}
|
|
69
71
|
|
|
72
|
+
.light {
|
|
73
|
+
color-scheme: light;
|
|
74
|
+
}
|
|
75
|
+
|
|
70
76
|
.dark {
|
|
77
|
+
/* Native controls: dark UA chrome. */
|
|
78
|
+
color-scheme: dark;
|
|
71
79
|
--background: 240 10% 3.9%;
|
|
72
80
|
--foreground: 0 0% 98%;
|
|
73
81
|
--card: 240 10% 3.9%;
|
|
@@ -214,6 +222,25 @@
|
|
|
214
222
|
appearance: none;
|
|
215
223
|
margin: 0;
|
|
216
224
|
}
|
|
225
|
+
|
|
226
|
+
.scrollbar-thin {
|
|
227
|
+
scrollbar-color: hsl(var(--border)) transparent;
|
|
228
|
+
scrollbar-width: thin;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.scrollbar-thin::-webkit-scrollbar {
|
|
232
|
+
width: 0.375rem;
|
|
233
|
+
height: 0.375rem;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.scrollbar-thin::-webkit-scrollbar-thumb {
|
|
237
|
+
background-color: hsl(var(--border));
|
|
238
|
+
border-radius: 9999px;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.scrollbar-thin::-webkit-scrollbar-track {
|
|
242
|
+
background-color: transparent;
|
|
243
|
+
}
|
|
217
244
|
}
|
|
218
245
|
|
|
219
246
|
@layer components {
|