@sqlrooms/ui 0.28.0-rc.0 → 0.28.1-rc.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/README.md +2 -5
- package/dist/components/dialog.d.ts.map +1 -1
- package/dist/components/dialog.js +2 -2
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/editable-text.js +3 -3
- package/dist/components/editable-text.js.map +1 -1
- package/dist/components/scrollable-row.js +8 -8
- package/dist/components/scrollable-row.js.map +1 -1
- package/dist/components/theme-switch.d.ts.map +1 -1
- package/dist/components/theme-switch.js +4 -4
- package/dist/components/theme-switch.js.map +1 -1
- package/dist/components/toaster.d.ts +2 -1
- package/dist/components/toaster.d.ts.map +1 -1
- package/dist/components/toaster.js +16 -3
- package/dist/components/toaster.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -51,18 +51,15 @@ function LoginForm() {
|
|
|
51
51
|
### Using Hooks
|
|
52
52
|
|
|
53
53
|
```tsx
|
|
54
|
-
import {
|
|
54
|
+
import {toast, useDisclosure} from '@sqlrooms/ui';
|
|
55
55
|
|
|
56
56
|
function MyComponent() {
|
|
57
|
-
const {toast} = useToast();
|
|
58
57
|
const {isOpen, onOpen, onClose} = useDisclosure();
|
|
59
58
|
|
|
60
59
|
const handleAction = () => {
|
|
61
60
|
// Perform some action
|
|
62
|
-
toast({
|
|
63
|
-
title: 'Success!',
|
|
61
|
+
toast.success('Success!', {
|
|
64
62
|
description: 'Your action was completed successfully.',
|
|
65
|
-
variant: 'success',
|
|
66
63
|
});
|
|
67
64
|
onClose();
|
|
68
65
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/components/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,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|
|
10
10
|
const DialogClose = DialogPrimitive.Close;
|
|
11
11
|
const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Overlay, { ref: ref, className: cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80', className), ...props })));
|
|
12
12
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
13
|
-
const DialogContent = React.forwardRef(({ className, children, showCloseButton = true, ...props }, ref) => (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { ref: ref, className: cn('bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95
|
|
13
|
+
const DialogContent = React.forwardRef(({ className, children, showCloseButton = true, ...props }, ref) => (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { ref: ref, className: cn('bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg', className), ...props, children: [children, showCloseButton && (_jsxs(DialogPrimitive.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none", children: [_jsx(X, { className: "h-4 w-4" }), _jsx("span", { className: "sr-only", children: "Close" })] }))] })] })));
|
|
14
14
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
15
15
|
const DialogHeader = ({ className, ...props }) => (_jsx("div", { className: cn('flex flex-col space-y-1.5 text-center sm:text-left', className), ...props }));
|
|
16
16
|
DialogHeader.displayName = 'DialogHeader';
|
|
17
17
|
const DialogFooter = ({ className, ...props }) => (_jsx("div", { className: cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className), ...props }));
|
|
18
18
|
DialogFooter.displayName = 'DialogFooter';
|
|
19
|
-
const DialogTitle = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Title, { ref: ref, className: cn('text-lg font-semibold
|
|
19
|
+
const DialogTitle = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Title, { ref: ref, className: cn('text-lg leading-none font-semibold tracking-tight', className), ...props })));
|
|
20
20
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
21
21
|
const DialogDescription = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Description, { ref: ref, className: cn('text-muted-foreground text-sm', className), ...props })));
|
|
22
22
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/components/dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAC,CAAC,EAAC,MAAM,cAAc,CAAC;AAE/B,OAAO,EAAC,EAAE,EAAC,MAAM,cAAc,CAAC;AAEhC,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC;AAEpC,MAAM,aAAa,GAAG,eAAe,CAAC,OAAO,CAAC;AAE9C,MAAM,YAAY,GAAG,eAAe,CAAC,MAAM,CAAC;AAE5C,MAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC;AAE1C,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAGpC,CAAC,EAAC,SAAS,EAAE,GAAG,KAAK,EAAC,EAAE,GAAG,EAAE,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KAAK,EAAC,EAAE,GAAG,EAAE,EAAE,CAAC,CAChC,KAAC,eAAe,CAAC,WAAW,IAC1B,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,+BAA+B,EAAE,SAAS,CAAC,KACrD,KAAK,GACT,CACH,CAAC,CAAC;AACH,iBAAiB,CAAC,WAAW,GAAG,eAAe,CAAC,WAAW,CAAC,WAAW,CAAC;AAExE,OAAO,EACL,MAAM,EACN,YAAY,EACZ,aAAa,EACb,aAAa,EACb,WAAW,EACX,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,iBAAiB,GAClB,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport {X} from 'lucide-react';\n\nimport {cn} from '../lib/utils';\n\nconst Dialog = DialogPrimitive.Root;\n\nconst DialogTrigger = DialogPrimitive.Trigger;\n\nconst DialogPortal = DialogPrimitive.Portal;\n\nconst DialogClose = DialogPrimitive.Close;\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({className, ...props}, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80',\n className,\n )}\n {...props}\n />\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\ninterface DialogContentProps extends React.ComponentPropsWithoutRef<\n typeof DialogPrimitive.Content\n> {\n showCloseButton?: boolean;\n}\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n DialogContentProps\n>(({className, children, showCloseButton = true, ...props}, ref) => (\n <DialogPortal>\n <DialogOverlay />\n <DialogPrimitive.Content\n ref={ref}\n className={cn(\n 'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg',\n className,\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close className=\"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none\">\n <X className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n));\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n 'flex flex-col space-y-1.5 text-center sm:text-left',\n className,\n )}\n {...props}\n />\n);\nDialogHeader.displayName = 'DialogHeader';\n\nconst DialogFooter = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n 'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2',\n className,\n )}\n {...props}\n />\n);\nDialogFooter.displayName = 'DialogFooter';\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({className, ...props}, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn(\n 'text-lg leading-none font-semibold tracking-tight',\n className,\n )}\n {...props}\n />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({className, ...props}, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn('text-muted-foreground text-sm', className)}\n {...props}\n />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogTrigger,\n DialogClose,\n DialogContent,\n DialogHeader,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n};\n"]}
|
|
@@ -66,7 +66,7 @@ export const EditableText = ({ className, isReadOnly = false, defaultEditing = f
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
return undefined;
|
|
69
|
-
}, [isEditing, isInternalEditing]);
|
|
69
|
+
}, [isEditing, isInternalEditing, selectOnFocus]);
|
|
70
70
|
/* eslint-enable react-hooks/set-state-in-effect */
|
|
71
71
|
const handleSetValue = useCallback((e) => {
|
|
72
72
|
if (isReadOnly || !isInternalEditing) {
|
|
@@ -135,8 +135,8 @@ export const EditableText = ({ className, isReadOnly = false, defaultEditing = f
|
|
|
135
135
|
document.removeEventListener('keydown', handleKeyDown);
|
|
136
136
|
};
|
|
137
137
|
}, [isInternalEditing, onChange, handleSetEditing, value]);
|
|
138
|
-
return (_jsx(Input, { ref: inputRef, className: cn('
|
|
139
|
-
'select-none
|
|
138
|
+
return (_jsx(Input, { ref: inputRef, className: cn('w-full rounded-sm border-transparent px-1 py-0 focus:border-blue-500 focus:ring-blue-500 focus:outline-hidden disabled:cursor-text disabled:opacity-1', {
|
|
139
|
+
'bg-transparent select-none': !isInternalEditing,
|
|
140
140
|
truncate: !isInternalEditing,
|
|
141
141
|
}, className), style: {
|
|
142
142
|
caretColor: isInternalEditing ? undefined : 'transparent',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editable-text.js","sourceRoot":"","sources":["../../src/components/editable-text.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAkB,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEhF,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAC9B,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,QAAQ,CAAC,gBAAgB,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;oBAC1C,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC;oBACzB,MAAM;YACV,CAAC;QACH,CAAC,CAAC;QACF,IAAI,iBAAiB,EAAE,CAAC;YACtB,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QACzD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,iBAAiB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAC,CAAC;IAE3D,OAAO,CACL,KAAC,KAAK,IACJ,GAAG,EAAE,QAAQ,EACb,SAAS,EAAE,EAAE,CACX,uJAAuJ,EACvJ;YACE,4BAA4B,EAAE,CAAC,iBAAiB;YAChD,QAAQ,EAAE,CAAC,iBAAiB;SAC7B,EACD,SAAS,CACV,EACD,KAAK,EAAE;YACL,UAAU,EAAE,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa;SAC1D,EACD,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,iBAAiB,IAAI,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EACnE,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,WAAW,EACpB,WAAW,EACT,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC,SAAS,GAEnE,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["'use client';\n\nimport {ChangeEvent, FC, useCallback, useEffect, useRef, useState} from 'react';\n\nimport {Input} from './input';\nimport {cn} from '../lib/utils';\n\n/**\n * Component that allows the user to edit a string.\n *\n * The editing mode can be controlled (the mode is managed by the parent component)\n * or uncontrolled (managed by the component itself).\n *\n * Controlled mode example:\n * ```\n * const [text, setText] = useState('');\n * const [isEditing, setEditing] = useState(false);\n * ...\n * <EditableText\n * value={text}\n * onChange={setText}\n * isEditing={isEditing}\n * onEditingChange={setEditing}\n * />\n * ```\n *\n * Uncontrolled mode example:\n * ```\n * const [text, setText] = useState('');\n * ...\n * <EditableText\n * value={text}\n * onChange={setText}\n * defaultEditing={false}\n * />\n * ```\n */\n\nexport const EditableText: FC<{\n className?: string;\n isReadOnly?: boolean;\n value: string;\n placeholder?: string;\n onChange: (text: string) => void;\n autoFocus?: boolean;\n selectOnFocus?: boolean;\n /** When false, the input is removed from tab order while not editing. */\n allowTabFocusWhenNotEditing?: boolean;\n\n /**\n * The editing state when it is initially rendered. Use when you do not need to control its editing state\n * in the parent component.\n **/\n defaultEditing?: boolean;\n\n /**\n * The controlled editing state of the component. Must be used in conjunction with onEditingChange.\n **/\n isEditing?: boolean;\n onEditingChange?: (isEditing: boolean) => void;\n}> = ({\n className,\n isReadOnly = false,\n defaultEditing = false,\n isEditing,\n placeholder,\n value,\n onChange,\n onEditingChange,\n autoFocus,\n selectOnFocus = false,\n allowTabFocusWhenNotEditing = true,\n}) => {\n const [isInternalEditing, setInternalIsEditing] = useState(defaultEditing);\n const inputRef = useRef<HTMLInputElement>(null);\n const [internalValue, setInternalValue] = useState(value);\n const internalValueRef = useRef(internalValue);\n\n useEffect(() => {\n internalValueRef.current = internalValue;\n }, [internalValue]);\n\n // Keep internalValue in sync with value prop\n /* eslint-disable react-hooks/set-state-in-effect */\n useEffect(() => {\n if (value !== internalValueRef.current) {\n setInternalValue(value);\n }\n }, [value]);\n\n // Keep internal editing state in sync with controlled isEditing prop\n // and focus the input when editing is enabled\n useEffect(() => {\n if (isEditing !== undefined && isEditing !== isInternalEditing) {\n setInternalIsEditing(Boolean(isEditing));\n if (isEditing) {\n // When enabling editing from a dropdown menu, there will be a blur event when the dropdown closes,\n // so we need to wait a bit before making sure the input is focused and selected.\n const timeoutId = setTimeout(() => {\n inputRef.current?.focus();\n if (selectOnFocus) {\n inputRef.current?.select();\n }\n }, 200);\n return () => clearTimeout(timeoutId);\n }\n }\n return undefined;\n }, [isEditing, isInternalEditing]);\n /* eslint-enable react-hooks/set-state-in-effect */\n\n const handleSetValue = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n if (isReadOnly || !isInternalEditing) {\n return;\n }\n return setInternalValue(e.target.value);\n },\n [isInternalEditing, isReadOnly],\n );\n\n const handleSetEditing = useCallback(\n (nextIsEditing: boolean) => {\n if (isReadOnly) {\n return;\n }\n setInternalIsEditing(nextIsEditing);\n onEditingChange?.(nextIsEditing);\n },\n [isReadOnly, onEditingChange],\n );\n\n const handleBlur = useCallback(() => {\n handleSetEditing(false);\n onChange(internalValueRef.current?.trim());\n }, [handleSetEditing, onChange]);\n\n const handleClick = useCallback(() => {\n if (!isInternalEditing) {\n handleSetEditing(true);\n }\n }, [isInternalEditing, handleSetEditing]);\n\n const handleFocus = useCallback(() => {\n if (selectOnFocus && isInternalEditing) {\n inputRef.current?.select();\n }\n }, [isInternalEditing, selectOnFocus]);\n\n useEffect(() => {\n if (!isInternalEditing) return;\n let rafId = requestAnimationFrame(() => {\n rafId = requestAnimationFrame(() => {\n inputRef.current?.focus();\n if (selectOnFocus) {\n inputRef.current?.select();\n }\n });\n });\n return () => {\n cancelAnimationFrame(rafId);\n };\n }, [isInternalEditing, selectOnFocus]);\n\n // Add keydown event listener to handle enter key\n useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n switch (e.key) {\n case 'Escape':\n // Reset the internal value to the original value\n setInternalValue(value);\n internalValueRef.current = value;\n handleSetEditing(false);\n inputRef.current?.blur();\n break;\n case 'Enter':\n handleSetEditing(false);\n onChange(internalValueRef.current.trim());\n inputRef.current?.blur();\n break;\n }\n };\n if (isInternalEditing) {\n document.addEventListener('keydown', handleKeyDown);\n }\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n }, [isInternalEditing, onChange, handleSetEditing, value]);\n\n return (\n <Input\n ref={inputRef}\n className={cn(\n 'disabled:opacity-1 w-full rounded-sm border-transparent px-1 py-0 focus:border-blue-500 focus:outline-hidden focus:ring-blue-500 disabled:cursor-text',\n {\n 'select-none bg-transparent': !isInternalEditing,\n truncate: !isInternalEditing,\n },\n className,\n )}\n style={{\n caretColor: isInternalEditing ? undefined : 'transparent',\n }}\n value={internalValue}\n tabIndex={isInternalEditing || allowTabFocusWhenNotEditing ? 0 : -1}\n autoFocus={autoFocus}\n onChange={handleSetValue}\n onFocus={handleFocus}\n onBlur={handleBlur}\n disabled={isReadOnly}\n onClick={handleClick}\n placeholder={\n !isInternalEditing ? (placeholder ?? 'Click to edit') : undefined\n }\n />\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"editable-text.js","sourceRoot":"","sources":["../../src/components/editable-text.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAkB,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEhF,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,EAAE,EAAC,MAAM,cAAc,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,MAAM,CAAC,MAAM,YAAY,GAsBpB,CAAC,EACJ,SAAS,EACT,UAAU,GAAG,KAAK,EAClB,cAAc,GAAG,KAAK,EACtB,SAAS,EACT,WAAW,EACX,KAAK,EACL,QAAQ,EACR,eAAe,EACf,SAAS,EACT,aAAa,GAAG,KAAK,EACrB,2BAA2B,GAAG,IAAI,GACnC,EAAE,EAAE;IACH,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;IAC3E,MAAM,QAAQ,GAAG,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B,EAAE,KAAK,CAAC,CAAC,CAAC;IAE3D,OAAO,CACL,KAAC,KAAK,IACJ,GAAG,EAAE,QAAQ,EACb,SAAS,EAAE,EAAE,CACX,uJAAuJ,EACvJ;YACE,4BAA4B,EAAE,CAAC,iBAAiB;YAChD,QAAQ,EAAE,CAAC,iBAAiB;SAC7B,EACD,SAAS,CACV,EACD,KAAK,EAAE;YACL,UAAU,EAAE,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa;SAC1D,EACD,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,iBAAiB,IAAI,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EACnE,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,WAAW,EACpB,WAAW,EACT,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,WAAW,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC,SAAS,GAEnE,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["'use client';\n\nimport {ChangeEvent, FC, useCallback, useEffect, useRef, useState} from 'react';\n\nimport {Input} from './input';\nimport {cn} from '../lib/utils';\n\n/**\n * Component that allows the user to edit a string.\n *\n * The editing mode can be controlled (the mode is managed by the parent component)\n * or uncontrolled (managed by the component itself).\n *\n * Controlled mode example:\n * ```\n * const [text, setText] = useState('');\n * const [isEditing, setEditing] = useState(false);\n * ...\n * <EditableText\n * value={text}\n * onChange={setText}\n * isEditing={isEditing}\n * onEditingChange={setEditing}\n * />\n * ```\n *\n * Uncontrolled mode example:\n * ```\n * const [text, setText] = useState('');\n * ...\n * <EditableText\n * value={text}\n * onChange={setText}\n * defaultEditing={false}\n * />\n * ```\n */\n\nexport const EditableText: FC<{\n className?: string;\n isReadOnly?: boolean;\n value: string;\n placeholder?: string;\n onChange: (text: string) => void;\n autoFocus?: boolean;\n selectOnFocus?: boolean;\n /** When false, the input is removed from tab order while not editing. */\n allowTabFocusWhenNotEditing?: boolean;\n\n /**\n * The editing state when it is initially rendered. Use when you do not need to control its editing state\n * in the parent component.\n **/\n defaultEditing?: boolean;\n\n /**\n * The controlled editing state of the component. Must be used in conjunction with onEditingChange.\n **/\n isEditing?: boolean;\n onEditingChange?: (isEditing: boolean) => void;\n}> = ({\n className,\n isReadOnly = false,\n defaultEditing = false,\n isEditing,\n placeholder,\n value,\n onChange,\n onEditingChange,\n autoFocus,\n selectOnFocus = false,\n allowTabFocusWhenNotEditing = true,\n}) => {\n const [isInternalEditing, setInternalIsEditing] = useState(defaultEditing);\n const inputRef = useRef<HTMLInputElement>(null);\n const [internalValue, setInternalValue] = useState(value);\n const internalValueRef = useRef(internalValue);\n\n useEffect(() => {\n internalValueRef.current = internalValue;\n }, [internalValue]);\n\n // Keep internalValue in sync with value prop\n /* eslint-disable react-hooks/set-state-in-effect */\n useEffect(() => {\n if (value !== internalValueRef.current) {\n setInternalValue(value);\n }\n }, [value]);\n\n // Keep internal editing state in sync with controlled isEditing prop\n // and focus the input when editing is enabled\n useEffect(() => {\n if (isEditing !== undefined && isEditing !== isInternalEditing) {\n setInternalIsEditing(Boolean(isEditing));\n if (isEditing) {\n // When enabling editing from a dropdown menu, there will be a blur event when the dropdown closes,\n // so we need to wait a bit before making sure the input is focused and selected.\n const timeoutId = setTimeout(() => {\n inputRef.current?.focus();\n if (selectOnFocus) {\n inputRef.current?.select();\n }\n }, 200);\n return () => clearTimeout(timeoutId);\n }\n }\n return undefined;\n }, [isEditing, isInternalEditing, selectOnFocus]);\n /* eslint-enable react-hooks/set-state-in-effect */\n\n const handleSetValue = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n if (isReadOnly || !isInternalEditing) {\n return;\n }\n return setInternalValue(e.target.value);\n },\n [isInternalEditing, isReadOnly],\n );\n\n const handleSetEditing = useCallback(\n (nextIsEditing: boolean) => {\n if (isReadOnly) {\n return;\n }\n setInternalIsEditing(nextIsEditing);\n onEditingChange?.(nextIsEditing);\n },\n [isReadOnly, onEditingChange],\n );\n\n const handleBlur = useCallback(() => {\n handleSetEditing(false);\n onChange(internalValueRef.current?.trim());\n }, [handleSetEditing, onChange]);\n\n const handleClick = useCallback(() => {\n if (!isInternalEditing) {\n handleSetEditing(true);\n }\n }, [isInternalEditing, handleSetEditing]);\n\n const handleFocus = useCallback(() => {\n if (selectOnFocus && isInternalEditing) {\n inputRef.current?.select();\n }\n }, [isInternalEditing, selectOnFocus]);\n\n useEffect(() => {\n if (!isInternalEditing) return;\n let rafId = requestAnimationFrame(() => {\n rafId = requestAnimationFrame(() => {\n inputRef.current?.focus();\n if (selectOnFocus) {\n inputRef.current?.select();\n }\n });\n });\n return () => {\n cancelAnimationFrame(rafId);\n };\n }, [isInternalEditing, selectOnFocus]);\n\n // Add keydown event listener to handle enter key\n useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n switch (e.key) {\n case 'Escape':\n // Reset the internal value to the original value\n setInternalValue(value);\n internalValueRef.current = value;\n handleSetEditing(false);\n inputRef.current?.blur();\n break;\n case 'Enter':\n handleSetEditing(false);\n onChange(internalValueRef.current.trim());\n inputRef.current?.blur();\n break;\n }\n };\n if (isInternalEditing) {\n document.addEventListener('keydown', handleKeyDown);\n }\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n }, [isInternalEditing, onChange, handleSetEditing, value]);\n\n return (\n <Input\n ref={inputRef}\n className={cn(\n 'w-full rounded-sm border-transparent px-1 py-0 focus:border-blue-500 focus:ring-blue-500 focus:outline-hidden disabled:cursor-text disabled:opacity-1',\n {\n 'bg-transparent select-none': !isInternalEditing,\n truncate: !isInternalEditing,\n },\n className,\n )}\n style={{\n caretColor: isInternalEditing ? undefined : 'transparent',\n }}\n value={internalValue}\n tabIndex={isInternalEditing || allowTabFocusWhenNotEditing ? 0 : -1}\n autoFocus={autoFocus}\n onChange={handleSetValue}\n onFocus={handleFocus}\n onBlur={handleBlur}\n disabled={isReadOnly}\n onClick={handleClick}\n placeholder={\n !isInternalEditing ? (placeholder ?? 'Click to edit') : undefined\n }\n />\n );\n};\n"]}
|
|
@@ -7,14 +7,6 @@ export function ScrollableRow({ children, className, scrollClassName, scrollRef,
|
|
|
7
7
|
const containerRef = scrollRef ?? internalRef;
|
|
8
8
|
const [canScrollLeft, setCanScrollLeft] = useState(false);
|
|
9
9
|
const [canScrollRight, setCanScrollRight] = useState(false);
|
|
10
|
-
const updateScrollState = () => {
|
|
11
|
-
const container = containerRef.current;
|
|
12
|
-
if (!container)
|
|
13
|
-
return;
|
|
14
|
-
const { scrollLeft, scrollWidth, clientWidth } = container;
|
|
15
|
-
setCanScrollLeft(scrollLeft > 0);
|
|
16
|
-
setCanScrollRight(scrollLeft + clientWidth < scrollWidth - 1);
|
|
17
|
-
};
|
|
18
10
|
const scrollBy = (direction) => {
|
|
19
11
|
const container = containerRef.current;
|
|
20
12
|
if (!container)
|
|
@@ -25,6 +17,14 @@ export function ScrollableRow({ children, className, scrollClassName, scrollRef,
|
|
|
25
17
|
});
|
|
26
18
|
};
|
|
27
19
|
useEffect(() => {
|
|
20
|
+
const updateScrollState = () => {
|
|
21
|
+
const container = containerRef.current;
|
|
22
|
+
if (!container)
|
|
23
|
+
return;
|
|
24
|
+
const { scrollLeft, scrollWidth, clientWidth } = container;
|
|
25
|
+
setCanScrollLeft(scrollLeft > 0);
|
|
26
|
+
setCanScrollRight(scrollLeft + clientWidth < scrollWidth - 1);
|
|
27
|
+
};
|
|
28
28
|
const container = containerRef.current;
|
|
29
29
|
if (!container)
|
|
30
30
|
return;
|
|
@@ -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,MAA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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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-switch.d.ts","sourceRoot":"","sources":["../../src/components/theme-switch.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"theme-switch.d.ts","sourceRoot":"","sources":["../../src/components/theme-switch.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AAIzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC;IAC3B,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAwBA,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useTheme } from '../theme/theme-provider';
|
|
4
3
|
import * as SwitchPrimitives from '@radix-ui/react-switch';
|
|
5
|
-
import {
|
|
4
|
+
import { MoonIcon, SunIcon } from 'lucide-react';
|
|
6
5
|
import { cn } from '../lib/utils';
|
|
6
|
+
import { useTheme } from '../theme/theme-provider';
|
|
7
7
|
/**
|
|
8
8
|
* A theme toggle switch component that allows users to switch between light and dark themes.
|
|
9
9
|
*
|
|
@@ -39,8 +39,8 @@ import { cn } from '../lib/utils';
|
|
|
39
39
|
*/
|
|
40
40
|
export const ThemeSwitch = ({ className }) => {
|
|
41
41
|
const { theme, setTheme } = useTheme();
|
|
42
|
-
return (_jsx(SwitchPrimitives.Root, { className: cn('focus-visible:ring-ring focus-visible:ring-offset-background data-[state=checked]:bg-primary/20 data-[state=unchecked]:bg-input peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:
|
|
42
|
+
return (_jsx(SwitchPrimitives.Root, { className: cn('focus-visible:ring-ring focus-visible:ring-offset-background data-[state=checked]:bg-primary/20 data-[state=unchecked]:bg-input peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50', className), checked: theme === 'dark', onCheckedChange: (checked) => {
|
|
43
43
|
setTheme(checked ? 'dark' : 'light');
|
|
44
|
-
}, children: _jsxs(SwitchPrimitives.Thumb, { className: cn('bg-background pointer-events-none flex h-4 w-4 items-center justify-center rounded-full shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0 dark:bg-zinc-900'), children: [_jsx(SunIcon, { className: "dark:text-primary h-2.5 w-2.5 rotate-0
|
|
44
|
+
}, children: _jsxs(SwitchPrimitives.Thumb, { className: cn('bg-background pointer-events-none flex h-4 w-4 items-center justify-center rounded-full shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0 dark:bg-zinc-900'), children: [_jsx(SunIcon, { className: "dark:text-primary h-2.5 w-2.5 scale-100 rotate-0 transition-all dark:scale-0 dark:-rotate-90" }), _jsx(MoonIcon, { className: "dark:text-primary absolute h-2.5 w-2.5 scale-0 rotate-90 transition-all dark:scale-100 dark:rotate-0" })] }) }));
|
|
45
45
|
};
|
|
46
46
|
//# sourceMappingURL=theme-switch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-switch.js","sourceRoot":"","sources":["../../src/components/theme-switch.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;
|
|
1
|
+
{"version":3,"file":"theme-switch.js","sourceRoot":"","sources":["../../src/components/theme-switch.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAC,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAC,EAAE,EAAC,MAAM,cAAc,CAAC;AAChC,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,CAAC,MAAM,WAAW,GAGnB,CAAC,EAAC,SAAS,EAAC,EAAE,EAAE;IACnB,MAAM,EAAC,KAAK,EAAE,QAAQ,EAAC,GAAG,QAAQ,EAAE,CAAC;IAErC,OAAO,CACL,KAAC,gBAAgB,CAAC,IAAI,IACpB,SAAS,EAAE,EAAE,CACX,kYAAkY,EAClY,SAAS,CACV,EACD,OAAO,EAAE,KAAK,KAAK,MAAM,EACzB,eAAe,EAAE,CAAC,OAAO,EAAE,EAAE;YAC3B,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACvC,CAAC,YAED,MAAC,gBAAgB,CAAC,KAAK,IACrB,SAAS,EAAE,EAAE,CACX,wNAAwN,CACzN,aAED,KAAC,OAAO,IAAC,SAAS,EAAC,8FAA8F,GAAG,EACpH,KAAC,QAAQ,IAAC,SAAS,EAAC,sGAAsG,GAAG,IACtG,GACH,CACzB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["'use client';\n\nimport * as SwitchPrimitives from '@radix-ui/react-switch';\nimport {MoonIcon, SunIcon} from 'lucide-react';\nimport {FC} from 'react';\nimport {cn} from '../lib/utils';\nimport {useTheme} from '../theme/theme-provider';\n\n/**\n * A theme toggle switch component that allows users to switch between light and dark themes.\n *\n * This component provides a visually appealing switch with sun/moon icons that animate smoothly\n * during theme transitions. It integrates with the theme context to manage theme state.\n *\n * Features:\n * - Smooth icon animations\n * - Accessible keyboard navigation\n * - Focus and hover states\n * - Customizable via className prop\n *\n * @component\n * @example\n * ```tsx\n * // Basic usage\n * <ThemeSwitch />\n *\n * // With custom styling\n * <ThemeSwitch className=\"my-custom-class\" />\n *\n * // Within a theme provider\n * import { ThemeProvider } from '../theme/theme-provider';\n *\n * function App() {\n * return (\n * <ThemeProvider>\n * <ThemeSwitch />\n * </ThemeProvider>\n * );\n * }\n * ```\n */\nexport const ThemeSwitch: FC<{\n /** Optional CSS class name for styling the switch container */\n className?: string;\n}> = ({className}) => {\n const {theme, setTheme} = useTheme();\n\n return (\n <SwitchPrimitives.Root\n className={cn(\n 'focus-visible:ring-ring focus-visible:ring-offset-background data-[state=checked]:bg-primary/20 data-[state=unchecked]:bg-input peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50',\n className,\n )}\n checked={theme === 'dark'}\n onCheckedChange={(checked) => {\n setTheme(checked ? 'dark' : 'light');\n }}\n >\n <SwitchPrimitives.Thumb\n className={cn(\n 'bg-background pointer-events-none flex h-4 w-4 items-center justify-center rounded-full shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0 dark:bg-zinc-900',\n )}\n >\n <SunIcon className=\"dark:text-primary h-2.5 w-2.5 scale-100 rotate-0 transition-all dark:scale-0 dark:-rotate-90\" />\n <MoonIcon className=\"dark:text-primary absolute h-2.5 w-2.5 scale-0 rotate-90 transition-all dark:scale-100 dark:rotate-0\" />\n </SwitchPrimitives.Thumb>\n </SwitchPrimitives.Root>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toaster.d.ts","sourceRoot":"","sources":["../../src/components/toaster.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"toaster.d.ts","sourceRoot":"","sources":["../../src/components/toaster.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,YAAY,EAAC,MAAM,QAAQ,CAAC;AAqC5D,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,2CAwB1C"}
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Toaster as Sonner } from 'sonner';
|
|
4
|
+
import { useTheme } from '../theme/theme-provider';
|
|
3
5
|
import { useToast } from '../hooks/use-toast';
|
|
4
6
|
import { Toast, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, } from './toast';
|
|
5
|
-
|
|
7
|
+
function LegacyToaster() {
|
|
6
8
|
const { toasts } = useToast();
|
|
7
9
|
return (_jsxs(ToastProvider, { children: [toasts.map(function ({ id, title, description, action, ...props }) {
|
|
8
|
-
return (_jsxs(Toast, { ...props, children: [_jsxs("div", { className: "grid gap-1
|
|
10
|
+
return (_jsxs(Toast, { ...props, children: [_jsxs("div", { className: "grid w-full gap-1", children: [title && _jsx(ToastTitle, { children: title }), description && (_jsx(ToastDescription, { children: description }))] }), action, _jsx(ToastClose, {})] }, id));
|
|
9
11
|
}), _jsx(ToastViewport, {})] }));
|
|
10
12
|
}
|
|
13
|
+
export function Toaster(props) {
|
|
14
|
+
const { theme } = useTheme();
|
|
15
|
+
return (_jsxs(_Fragment, { children: [_jsx(LegacyToaster, {}), _jsx(Sonner, { theme: theme, className: "toaster group", toastOptions: {
|
|
16
|
+
classNames: {
|
|
17
|
+
toast: 'group toast group-[.toaster]:border-border group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:shadow-lg',
|
|
18
|
+
description: 'group-[.toast]:text-muted-foreground',
|
|
19
|
+
actionButton: 'group-[.toast]:bg-primary group-[.toast]:text-primary-foreground',
|
|
20
|
+
cancelButton: 'group-[.toast]:bg-muted group-[.toast]:text-muted-foreground',
|
|
21
|
+
},
|
|
22
|
+
}, ...props })] }));
|
|
23
|
+
}
|
|
11
24
|
//# sourceMappingURL=toaster.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toaster.js","sourceRoot":"","sources":["../../src/components/toaster.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAC,QAAQ,EAAC,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EACL,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,aAAa,GACd,MAAM,SAAS,CAAC;AAEjB,
|
|
1
|
+
{"version":3,"file":"toaster.js","sourceRoot":"","sources":["../../src/components/toaster.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAC,OAAO,IAAI,MAAM,EAAoB,MAAM,QAAQ,CAAC;AAE5D,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAC,QAAQ,EAAC,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EACL,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,aAAa,GACd,MAAM,SAAS,CAAC;AAEjB,SAAS,aAAa;IACpB,MAAM,EAAC,MAAM,EAAC,GAAG,QAAQ,EAAE,CAAC;IAE5B,OAAO,CACL,MAAC,aAAa,eACX,MAAM,CAAC,GAAG,CAAC,UAAU,EAAC,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,KAAK,EAAC;gBAC9D,OAAO,CACL,MAAC,KAAK,OAAc,KAAK,aACvB,eAAK,SAAS,EAAC,mBAAmB,aAC/B,KAAK,IAAI,KAAC,UAAU,cAAE,KAAK,GAAc,EACzC,WAAW,IAAI,CACd,KAAC,gBAAgB,cAAE,WAAW,GAAoB,CACnD,IACG,EACL,MAAM,EACP,KAAC,UAAU,KAAG,KARJ,EAAE,CASN,CACT,CAAC;YACJ,CAAC,CAAC,EACF,KAAC,aAAa,KAAG,IACH,CACjB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,KAAmB;IACzC,MAAM,EAAC,KAAK,EAAC,GAAG,QAAQ,EAAE,CAAC;IAE3B,OAAO,CACL,8BACE,KAAC,aAAa,KAAG,EACjB,KAAC,MAAM,IACL,KAAK,EAAE,KAA8B,EACrC,SAAS,EAAC,eAAe,EACzB,YAAY,EAAE;oBACZ,UAAU,EAAE;wBACV,KAAK,EACH,uIAAuI;wBACzI,WAAW,EAAE,sCAAsC;wBACnD,YAAY,EACV,kEAAkE;wBACpE,YAAY,EACV,8DAA8D;qBACjE;iBACF,KACG,KAAK,GACT,IACD,CACJ,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport {Toaster as Sonner, type ToasterProps} from 'sonner';\n\nimport {useTheme} from '../theme/theme-provider';\nimport {useToast} from '../hooks/use-toast';\nimport {\n Toast,\n ToastClose,\n ToastDescription,\n ToastProvider,\n ToastTitle,\n ToastViewport,\n} from './toast';\n\nfunction LegacyToaster() {\n const {toasts} = useToast();\n\n return (\n <ToastProvider>\n {toasts.map(function ({id, title, description, action, ...props}) {\n return (\n <Toast key={id} {...props}>\n <div className=\"grid w-full gap-1\">\n {title && <ToastTitle>{title}</ToastTitle>}\n {description && (\n <ToastDescription>{description}</ToastDescription>\n )}\n </div>\n {action}\n <ToastClose />\n </Toast>\n );\n })}\n <ToastViewport />\n </ToastProvider>\n );\n}\n\nexport function Toaster(props: ToasterProps) {\n const {theme} = useTheme();\n\n return (\n <>\n <LegacyToaster />\n <Sonner\n theme={theme as ToasterProps['theme']}\n className=\"toaster group\"\n toastOptions={{\n classNames: {\n toast:\n 'group toast group-[.toaster]:border-border group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:shadow-lg',\n description: 'group-[.toast]:text-muted-foreground',\n actionButton:\n 'group-[.toast]:bg-primary group-[.toast]:text-primary-foreground',\n cancelButton:\n 'group-[.toast]:bg-muted group-[.toast]:text-muted-foreground',\n },\n }}\n {...props}\n />\n </>\n );\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -54,7 +54,8 @@ export { Toggle, toggleVariants } from './components/toggle';
|
|
|
54
54
|
export { CopyButton, type CopyButtonProps } from './components/copy-button';
|
|
55
55
|
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, } from './components/tooltip';
|
|
56
56
|
export { Tree, type TreeNodeData } from './components/tree';
|
|
57
|
-
export { useToast, toast, reducer } from './hooks/use-toast';
|
|
57
|
+
export { useToast, toast as legacyToast, reducer } from './hooks/use-toast';
|
|
58
|
+
export { toast, type ExternalToast } from 'sonner';
|
|
58
59
|
export { useAspectRatioDimensions, type Dimensions, type UseAspectRatioDimensionsProps, } from './hooks/useAspectRatioDimensions';
|
|
59
60
|
export { useDisclosure, type UseDisclosureReturnValue, } from './hooks/useDisclosure';
|
|
60
61
|
export { useRelativeCoordinates } from './hooks/useRelativeCoordinates';
|
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,aAAa,EACb,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAC,KAAK,EAAE,UAAU,EAAE,gBAAgB,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,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AAEjC,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AAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAE7C,OAAO,EAAC,WAAW,EAAE,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAEvE,OAAO,EAAC,MAAM,EAAE,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAC,UAAU,EAAE,KAAK,eAAe,EAAC,MAAM,0BAA0B,CAAC;AAE1E,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,EACd,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAC,IAAI,EAAE,KAAK,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAG1D,OAAO,EAAC,QAAQ,EAAE,KAAK,IAAI,WAAW,EAAE,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAC,KAAK,EAAE,KAAK,aAAa,EAAC,MAAM,QAAQ,CAAC;AAEjD,OAAO,EACL,wBAAwB,EACxB,KAAK,UAAU,EACf,KAAK,6BAA6B,GACnC,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,aAAa,EACb,KAAK,wBAAwB,GAC9B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAC,sBAAsB,EAAC,MAAM,gCAAgC,CAAC;AAGtE,OAAO,EAAC,EAAE,EAAC,MAAM,aAAa,CAAC;AAC/B,OAAO,EAAC,oBAAoB,EAAE,KAAK,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAGxE,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AAG/D,OAAO,EAAC,IAAI,EAAC,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -56,7 +56,8 @@ export { CopyButton } from './components/copy-button';
|
|
|
56
56
|
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, } from './components/tooltip';
|
|
57
57
|
export { Tree } from './components/tree';
|
|
58
58
|
// Hooks
|
|
59
|
-
export { useToast, toast, reducer } from './hooks/use-toast';
|
|
59
|
+
export { useToast, toast as legacyToast, reducer } from './hooks/use-toast';
|
|
60
|
+
export { toast } from 'sonner';
|
|
60
61
|
export { useAspectRatioDimensions, } from './hooks/useAspectRatioDimensions';
|
|
61
62
|
export { useDisclosure, } from './hooks/useDisclosure';
|
|
62
63
|
export { useRelativeCoordinates } from './hooks/useRelativeCoordinates';
|
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,aAAa,EACb,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAC,KAAK,EAAE,UAAU,EAAE,gBAAgB,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,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,kBAAkB,GACnB,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,UAAU,EACV,UAAU,EACV,SAAS,EACT,eAAe,EACf,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAC,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAE/C,OAAO,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,OAAO,EACP,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,E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E3D,OAAO,EACL,wBAAwB,GAGzB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,aAAa,GAEd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAC,sBAAsB,EAAC,MAAM,gCAAgC,CAAC;AAEtE,YAAY;AACZ,OAAO,EAAC,EAAE,EAAC,MAAM,aAAa,CAAC;AAC/B,OAAO,EAAC,oBAAoB,EAAqB,MAAM,gBAAgB,CAAC;AAExE,QAAQ;AACR,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AAE/D,uBAAuB;AACvB,OAAO,EAAC,IAAI,EAAC,MAAM,sBAAsB,CAAC","sourcesContent":["/**\n * {@include ../README.md}\n * @packageDocumentation\n */\n\n// Components\nexport {\n Accordion,\n AccordionItem,\n AccordionTrigger,\n AccordionContent,\n} from './components/accordion';\n\nexport {Alert, AlertTitle, AlertDescription} from './components/alert';\n\nexport {AspectRatio} from './components/aspect-ratio';\n\nexport {Badge, badgeVariants, type BadgeProps} from './components/badge';\n\nexport {\n Breadcrumb,\n BreadcrumbList,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbPage,\n BreadcrumbSeparator,\n BreadcrumbEllipsis,\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 CardHeader,\n CardFooter,\n CardTitle,\n CardDescription,\n CardContent,\n} from './components/card';\n\nexport {Checkbox} from './components/checkbox';\n\nexport {ComboboxDemo} from './components/combobox';\n\nexport {\n Collapsible,\n CollapsibleTrigger,\n CollapsibleContent,\n} from './components/collapsible';\n\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n} from './components/command';\n\nexport {\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuContent,\n ContextMenuItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioItem,\n ContextMenuLabel,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuGroup,\n ContextMenuPortal,\n ContextMenuSub,\n ContextMenuSubContent,\n ContextMenuSubTrigger,\n ContextMenuRadioGroup,\n} from './components/context-menu';\n\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogTrigger,\n DialogClose,\n DialogContent,\n DialogHeader,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n} from './components/dialog';\n\nexport {\n Drawer,\n DrawerPortal,\n DrawerOverlay,\n DrawerTrigger,\n DrawerClose,\n DrawerContent,\n DrawerHeader,\n DrawerFooter,\n DrawerTitle,\n DrawerDescription,\n DrawerHandle,\n} from './components/drawer';\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\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 useFormField,\n Form,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n FormField,\n} from './components/form';\n\nexport {Input} from './components/input';\n\nexport {Label} from './components/label';\n\nexport {\n Menubar,\n MenubarMenu,\n MenubarTrigger,\n MenubarContent,\n MenubarItem,\n MenubarSeparator,\n MenubarLabel,\n MenubarCheckboxItem,\n MenubarRadioGroup,\n MenubarRadioItem,\n MenubarPortal,\n MenubarSub,\n MenubarSubContent,\n MenubarSubTrigger,\n MenubarGroup,\n MenubarShortcut,\n} from './components/menu-bar';\n\nexport {\n Pagination,\n PaginationContent,\n PaginationLink,\n PaginationItem,\n PaginationPrevious,\n PaginationNext,\n PaginationEllipsis,\n} from './components/pagination';\n\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverAnchor,\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 ResizablePanelGroup,\n ResizablePanel,\n ResizableHandle,\n} from './components/resizable';\n\nexport {\n TabStrip,\n type TabDescriptor,\n type TabStripProps,\n} from './components/tab-strip';\n\nexport {ScrollableRow} from './components/scrollable-row';\n\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n SelectScrollUpButton,\n SelectScrollDownButton,\n} from './components/select';\n\nexport {ScrollArea, ScrollBar} from './components/scroll-area';\n\nexport {Separator} from './components/separator';\n\nexport {\n Sheet,\n SheetPortal,\n SheetOverlay,\n SheetTrigger,\n SheetClose,\n SheetContent,\n SheetHeader,\n SheetFooter,\n SheetTitle,\n SheetDescription,\n} from './components/sheet';\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 TableHeader,\n TableBody,\n TableFooter,\n TableHead,\n TableRow,\n TableCell,\n TableCaption,\n} from './components/table';\n\nexport {Tabs, TabsList, TabsTrigger, TabsContent} from './components/tabs';\n\nexport {Textarea} from './components/textarea';\n\nexport {ThemeSwitch} from './components/theme-switch';\n\nexport {\n type ToastProps,\n type ToastActionElement,\n ToastProvider,\n ToastViewport,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastClose,\n ToastAction,\n} from './components/toast';\n\nexport {Toaster} from './components/toaster';\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 TooltipTrigger,\n TooltipContent,\n TooltipProvider,\n} from './components/tooltip';\n\nexport {Tree, type TreeNodeData} from './components/tree';\n\n// Hooks\nexport {useToast, toast, reducer} from './hooks/use-toast';\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 {useRelativeCoordinates} from './hooks/useRelativeCoordinates';\n\n// Utilities\nexport {cn} from './lib/utils';\nexport {resolveFontSizeClass, type FontSizeToken} from './lib/fontSize';\n\n// Theme\nexport {ThemeProvider, useTheme} from './theme/theme-provider';\n\n// Re-export from Radix\nexport {Slot} from '@radix-ui/react-slot';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,aAAa;AACb,OAAO,EACL,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAC,KAAK,EAAE,UAAU,EAAE,gBAAgB,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,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,kBAAkB,GACnB,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,UAAU,EACV,UAAU,EACV,SAAS,EACT,eAAe,EACf,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAE3B,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M,0BAA0B,CAAC;AAE1E,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,EACd,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAC,IAAI,EAAoB,MAAM,mBAAmB,CAAC;AAE1D,QAAQ;AACR,OAAO,EAAC,QAAQ,EAAE,KAAK,IAAI,WAAW,EAAE,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAC,KAAK,EAAqB,MAAM,QAAQ,CAAC;AAEjD,OAAO,EACL,wBAAwB,GAGzB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,aAAa,GAEd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAC,sBAAsB,EAAC,MAAM,gCAAgC,CAAC;AAEtE,YAAY;AACZ,OAAO,EAAC,EAAE,EAAC,MAAM,aAAa,CAAC;AAC/B,OAAO,EAAC,oBAAoB,EAAqB,MAAM,gBAAgB,CAAC;AAExE,QAAQ;AACR,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AAE/D,uBAAuB;AACvB,OAAO,EAAC,IAAI,EAAC,MAAM,sBAAsB,CAAC","sourcesContent":["/**\n * {@include ../README.md}\n * @packageDocumentation\n */\n\n// Components\nexport {\n Accordion,\n AccordionItem,\n AccordionTrigger,\n AccordionContent,\n} from './components/accordion';\n\nexport {Alert, AlertTitle, AlertDescription} from './components/alert';\n\nexport {AspectRatio} from './components/aspect-ratio';\n\nexport {Badge, badgeVariants, type BadgeProps} from './components/badge';\n\nexport {\n Breadcrumb,\n BreadcrumbList,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbPage,\n BreadcrumbSeparator,\n BreadcrumbEllipsis,\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 CardHeader,\n CardFooter,\n CardTitle,\n CardDescription,\n CardContent,\n} from './components/card';\n\nexport {Checkbox} from './components/checkbox';\n\nexport {ComboboxDemo} from './components/combobox';\n\nexport {\n Collapsible,\n CollapsibleTrigger,\n CollapsibleContent,\n} from './components/collapsible';\n\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n} from './components/command';\n\nexport {\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuContent,\n ContextMenuItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioItem,\n ContextMenuLabel,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuGroup,\n ContextMenuPortal,\n ContextMenuSub,\n ContextMenuSubContent,\n ContextMenuSubTrigger,\n ContextMenuRadioGroup,\n} from './components/context-menu';\n\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogTrigger,\n DialogClose,\n DialogContent,\n DialogHeader,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n} from './components/dialog';\n\nexport {\n Drawer,\n DrawerPortal,\n DrawerOverlay,\n DrawerTrigger,\n DrawerClose,\n DrawerContent,\n DrawerHeader,\n DrawerFooter,\n DrawerTitle,\n DrawerDescription,\n DrawerHandle,\n} from './components/drawer';\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\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 useFormField,\n Form,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n FormField,\n} from './components/form';\n\nexport {Input} from './components/input';\n\nexport {Label} from './components/label';\n\nexport {\n Menubar,\n MenubarMenu,\n MenubarTrigger,\n MenubarContent,\n MenubarItem,\n MenubarSeparator,\n MenubarLabel,\n MenubarCheckboxItem,\n MenubarRadioGroup,\n MenubarRadioItem,\n MenubarPortal,\n MenubarSub,\n MenubarSubContent,\n MenubarSubTrigger,\n MenubarGroup,\n MenubarShortcut,\n} from './components/menu-bar';\n\nexport {\n Pagination,\n PaginationContent,\n PaginationLink,\n PaginationItem,\n PaginationPrevious,\n PaginationNext,\n PaginationEllipsis,\n} from './components/pagination';\n\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverAnchor,\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 ResizablePanelGroup,\n ResizablePanel,\n ResizableHandle,\n} from './components/resizable';\n\nexport {\n TabStrip,\n type TabDescriptor,\n type TabStripProps,\n} from './components/tab-strip';\n\nexport {ScrollableRow} from './components/scrollable-row';\n\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n SelectScrollUpButton,\n SelectScrollDownButton,\n} from './components/select';\n\nexport {ScrollArea, ScrollBar} from './components/scroll-area';\n\nexport {Separator} from './components/separator';\n\nexport {\n Sheet,\n SheetPortal,\n SheetOverlay,\n SheetTrigger,\n SheetClose,\n SheetContent,\n SheetHeader,\n SheetFooter,\n SheetTitle,\n SheetDescription,\n} from './components/sheet';\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 TableHeader,\n TableBody,\n TableFooter,\n TableHead,\n TableRow,\n TableCell,\n TableCaption,\n} from './components/table';\n\nexport {Tabs, TabsList, TabsTrigger, TabsContent} from './components/tabs';\n\nexport {Textarea} from './components/textarea';\n\nexport {ThemeSwitch} from './components/theme-switch';\n\nexport {\n type ToastProps,\n type ToastActionElement,\n ToastProvider,\n ToastViewport,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastClose,\n ToastAction,\n} from './components/toast';\n\nexport {Toaster} from './components/toaster';\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 TooltipTrigger,\n TooltipContent,\n TooltipProvider,\n} from './components/tooltip';\n\nexport {Tree, type TreeNodeData} from './components/tree';\n\n// Hooks\nexport {useToast, toast as legacyToast, reducer} from './hooks/use-toast';\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 {useRelativeCoordinates} from './hooks/useRelativeCoordinates';\n\n// Utilities\nexport {cn} from './lib/utils';\nexport {resolveFontSizeClass, type FontSizeToken} from './lib/fontSize';\n\n// Theme\nexport {ThemeProvider, useTheme} from './theme/theme-provider';\n\n// Re-export from Radix\nexport {Slot} from '@radix-ui/react-slot';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqlrooms/ui",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.1-rc.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"author": "SQLRooms Contributors",
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"react-day-picker": "^8.10.1",
|
|
63
63
|
"react-hook-form": "^7.63.0",
|
|
64
64
|
"react-resizable-panels": "^3.0.6",
|
|
65
|
+
"sonner": "^2.0.7",
|
|
65
66
|
"tailwind-merge": "^2.6.0",
|
|
66
67
|
"tailwindcss-animate": "^1.0.7",
|
|
67
68
|
"usehooks-ts": "^3.1.1",
|
|
@@ -70,5 +71,5 @@
|
|
|
70
71
|
"peerDependencies": {
|
|
71
72
|
"tailwindcss": "^4.1.18"
|
|
72
73
|
},
|
|
73
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "1e0dcae95d1ccdbcd1b32df1d647d0f794b94e5e"
|
|
74
75
|
}
|