@instantdb/components 0.22.92 → 0.22.93
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/.turbo/turbo-build.log +5 -5
- package/README.md +1 -1
- package/dist/components/DialogContentPrimitive.d.ts +1 -0
- package/dist/components/DialogContentPrimitive.d.ts.map +1 -0
- package/dist/components/ui.d.ts +2 -1
- package/dist/components/ui.d.ts.map +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.js +668 -659
- package/package.json +7 -7
- package/src/components/DialogContentPrimitive.tsx +0 -0
- package/src/components/explorer/table-components.tsx +1 -1
- package/src/components/ui.tsx +52 -17
- package/vite.config.ts +4 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instantdb/components",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.22.
|
|
4
|
+
"version": "0.22.93",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Instant's UI components",
|
|
7
7
|
"homepage": "https://github.com/instantdb/instant/tree/main/client/packages/components",
|
|
@@ -93,16 +93,16 @@
|
|
|
93
93
|
"swr": "^2.2.4",
|
|
94
94
|
"tailwind-merge": "^2.2.1",
|
|
95
95
|
"uuid": "^11.1.0",
|
|
96
|
-
"@instantdb/
|
|
97
|
-
"@instantdb/
|
|
98
|
-
"@instantdb/
|
|
99
|
-
"@instantdb/react": "0.22.
|
|
100
|
-
"@instantdb/version": "0.22.
|
|
96
|
+
"@instantdb/admin": "0.22.93",
|
|
97
|
+
"@instantdb/platform": "0.22.93",
|
|
98
|
+
"@instantdb/core": "0.22.93",
|
|
99
|
+
"@instantdb/react": "0.22.93",
|
|
100
|
+
"@instantdb/version": "0.22.93"
|
|
101
101
|
},
|
|
102
102
|
"scripts": {
|
|
103
103
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
104
104
|
"build": "vite build",
|
|
105
|
-
"dev": "vite build --watch",
|
|
105
|
+
"dev": "vite build --watch --mode development",
|
|
106
106
|
"publish-package": "pnpm pack && npm publish *.tgz --access public",
|
|
107
107
|
"dev:demo": "vite"
|
|
108
108
|
}
|
|
File without changes
|
package/src/components/ui.tsx
CHANGED
|
@@ -560,7 +560,7 @@ export const IconButton = ({
|
|
|
560
560
|
}: IconButtonProps) => {
|
|
561
561
|
return (
|
|
562
562
|
<Tooltip>
|
|
563
|
-
<TooltipTrigger>
|
|
563
|
+
<TooltipTrigger asChild>
|
|
564
564
|
<button
|
|
565
565
|
title={label}
|
|
566
566
|
disabled={disabled}
|
|
@@ -616,19 +616,55 @@ function DialogPortal({
|
|
|
616
616
|
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
|
|
617
617
|
}
|
|
618
618
|
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
}
|
|
619
|
+
const DialogOverlay = React.forwardRef<
|
|
620
|
+
React.ComponentRef<typeof DialogPrimitive.Overlay>,
|
|
621
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
|
|
622
|
+
>(({ className, ...props }, ref) => (
|
|
623
|
+
<DialogPrimitive.Overlay
|
|
624
|
+
ref={ref}
|
|
625
|
+
data-slot="dialog-overlay"
|
|
626
|
+
className={cn(
|
|
627
|
+
'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/50',
|
|
628
|
+
className,
|
|
629
|
+
)}
|
|
630
|
+
{...props}
|
|
631
|
+
/>
|
|
632
|
+
));
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* Radix Dialog's TitleWarning uses document.getElementById to check for a title,
|
|
636
|
+
* but this doesn't work in Shadow DOM. This component creates a hidden element
|
|
637
|
+
* in the main document to satisfy the check, using a ref to get the actual ID
|
|
638
|
+
* that Radix assigns to the title.
|
|
639
|
+
*/
|
|
640
|
+
function ShadowDialogTitle({ title }: { title: string }) {
|
|
641
|
+
const shadowRoot = useShadowRoot();
|
|
642
|
+
const titleRef = React.useRef<HTMLHeadingElement>(null);
|
|
643
|
+
|
|
644
|
+
React.useEffect(() => {
|
|
645
|
+
// Only needed in Shadow DOM and in development
|
|
646
|
+
if (!shadowRoot || process.env.NODE_ENV === 'production') {
|
|
647
|
+
return;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
const titleId = titleRef.current?.id;
|
|
651
|
+
if (!titleId) return;
|
|
652
|
+
|
|
653
|
+
// Create a hidden element in the main document to satisfy Radix's getElementById check
|
|
654
|
+
const hiddenTitle = document.createElement('span');
|
|
655
|
+
hiddenTitle.id = titleId;
|
|
656
|
+
hiddenTitle.style.display = 'none';
|
|
657
|
+
document.body.appendChild(hiddenTitle);
|
|
658
|
+
|
|
659
|
+
return () => {
|
|
660
|
+
hiddenTitle.remove();
|
|
661
|
+
};
|
|
662
|
+
}, [shadowRoot]);
|
|
663
|
+
|
|
623
664
|
return (
|
|
624
|
-
<
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
'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/50',
|
|
628
|
-
className,
|
|
629
|
-
)}
|
|
630
|
-
{...props}
|
|
631
|
-
/>
|
|
665
|
+
<VisuallyHidden>
|
|
666
|
+
<DialogPrimitive.Title ref={titleRef}>{title}</DialogPrimitive.Title>
|
|
667
|
+
</VisuallyHidden>
|
|
632
668
|
);
|
|
633
669
|
}
|
|
634
670
|
|
|
@@ -640,6 +676,7 @@ function DialogContent({
|
|
|
640
676
|
...props
|
|
641
677
|
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
642
678
|
showCloseButton?: boolean;
|
|
679
|
+
title: string;
|
|
643
680
|
}) {
|
|
644
681
|
const shadowRoot = useShadowRoot();
|
|
645
682
|
const darkMode = useShadowDarkMode();
|
|
@@ -648,6 +685,7 @@ function DialogContent({
|
|
|
648
685
|
<DialogPortal container={shadowRoot} data-slot="dialog-portal">
|
|
649
686
|
<DialogOverlay className={cn(darkMode ? 'dark' : '', 'overflow-y-auto')}>
|
|
650
687
|
<DialogPrimitive.Content
|
|
688
|
+
aria-label={title}
|
|
651
689
|
data-slot="dialog-content"
|
|
652
690
|
className={cn(
|
|
653
691
|
'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 relative top-[50%] left-[50%] z-50 grid max-h-[calc(100%-2rem)] w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 overflow-y-auto rounded-lg border border-gray-200 bg-white p-6 shadow-lg duration-200 sm:max-w-lg dark:border-neutral-700 dark:bg-neutral-800 dark:text-white',
|
|
@@ -656,9 +694,7 @@ function DialogContent({
|
|
|
656
694
|
)}
|
|
657
695
|
{...props}
|
|
658
696
|
>
|
|
659
|
-
<
|
|
660
|
-
<DialogTitle>{title}</DialogTitle>
|
|
661
|
-
</VisuallyHidden>
|
|
697
|
+
<ShadowDialogTitle title={title} />
|
|
662
698
|
{children}
|
|
663
699
|
{showCloseButton && (
|
|
664
700
|
<DialogPrimitive.Close
|
|
@@ -1541,7 +1577,6 @@ export function Fence({
|
|
|
1541
1577
|
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
1542
1578
|
import { rosePineDawnTheme } from './rosePineDawnTheme';
|
|
1543
1579
|
import { useShadowRoot, useShadowDarkMode } from './StyleMe';
|
|
1544
|
-
import { DialogTitle } from '@radix-ui/react-dialog';
|
|
1545
1580
|
function Switch({
|
|
1546
1581
|
className,
|
|
1547
1582
|
...props
|
package/vite.config.ts
CHANGED
|
@@ -7,7 +7,7 @@ import dts from 'unplugin-dts/vite';
|
|
|
7
7
|
|
|
8
8
|
import { peerDependencies, dependencies } from './package.json';
|
|
9
9
|
|
|
10
|
-
export default defineConfig({
|
|
10
|
+
export default defineConfig(({ mode }) => ({
|
|
11
11
|
clearScreen: false,
|
|
12
12
|
plugins: [react({}), tailwindcss({ optimize: true }), dts({})],
|
|
13
13
|
resolve: {
|
|
@@ -17,8 +17,9 @@ export default defineConfig({
|
|
|
17
17
|
},
|
|
18
18
|
build: {
|
|
19
19
|
outDir: 'dist',
|
|
20
|
+
minify: mode !== 'development',
|
|
20
21
|
target: 'esnext',
|
|
21
|
-
emptyOutDir:
|
|
22
|
+
emptyOutDir: mode !== 'development',
|
|
22
23
|
cssCodeSplit: true,
|
|
23
24
|
lib: {
|
|
24
25
|
formats: ['es', 'cjs'],
|
|
@@ -46,4 +47,4 @@ export default defineConfig({
|
|
|
46
47
|
},
|
|
47
48
|
},
|
|
48
49
|
},
|
|
49
|
-
});
|
|
50
|
+
}));
|