svelte-docsmith 0.2.0 → 0.4.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 +66 -25
- package/dist/clipboard.svelte.d.ts +1 -1
- package/dist/clipboard.svelte.js +15 -8
- package/dist/config.d.ts +36 -6
- package/dist/config.js +33 -7
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -0
- package/dist/markdown-layout.svelte +14 -1
- package/dist/markdown-layout.svelte.d.ts +2 -0
- package/dist/preprocess.d.ts +4 -5
- package/dist/preprocess.js +15 -7
- package/dist/search/context.svelte.d.ts +7 -0
- package/dist/search/context.svelte.js +20 -0
- package/dist/search/create-search.d.ts +14 -0
- package/dist/search/create-search.js +56 -0
- package/dist/search/snippet.d.ts +7 -0
- package/dist/search/snippet.js +43 -0
- package/dist/search.d.ts +10 -0
- package/dist/search.js +4 -0
- package/dist/theme.css +25 -0
- package/dist/types.d.ts +0 -6
- package/dist/ui/badge.svelte +10 -1
- package/dist/ui/badge.svelte.d.ts +2 -0
- package/dist/ui/callout.svelte +9 -9
- package/dist/ui/callout.svelte.d.ts +3 -3
- package/dist/ui/layouts/docs-header.svelte +5 -11
- package/dist/ui/layouts/docs-header.svelte.d.ts +0 -6
- package/dist/ui/layouts/docs-mobile-header.svelte +40 -8
- package/dist/ui/layouts/docs-mobile-header.svelte.d.ts +5 -4
- package/dist/ui/layouts/docs-shell.svelte +49 -5
- package/dist/ui/layouts/docs-shell.svelte.d.ts +16 -1
- package/dist/ui/layouts/error-page.svelte +82 -0
- package/dist/ui/layouts/error-page.svelte.d.ts +25 -0
- package/dist/ui/layouts/seo-head.svelte +65 -0
- package/dist/ui/layouts/seo-head.svelte.d.ts +11 -0
- package/dist/ui/markdown/h2.svelte +7 -3
- package/dist/ui/markdown/h3.svelte +7 -3
- package/dist/ui/markdown/pre.svelte +79 -29
- package/dist/ui/prop.svelte +71 -36
- package/dist/ui/prop.svelte.d.ts +1 -1
- package/dist/ui/props-table.svelte +10 -62
- package/dist/ui/search-trigger.svelte +31 -0
- package/dist/ui/search-trigger.svelte.d.ts +6 -0
- package/dist/ui/search.svelte +167 -0
- package/dist/ui/search.svelte.d.ts +13 -0
- package/dist/ui/shadcn/accordion/accordion.svelte.d.ts +1 -1
- package/dist/ui/shadcn/command/command-dialog.svelte +42 -0
- package/dist/ui/shadcn/command/command-dialog.svelte.d.ts +14 -0
- package/dist/ui/shadcn/command/command-empty.svelte +17 -0
- package/dist/ui/shadcn/command/command-empty.svelte.d.ts +4 -0
- package/dist/ui/shadcn/command/command-group.svelte +33 -0
- package/dist/ui/shadcn/command/command-group.svelte.d.ts +7 -0
- package/dist/ui/shadcn/command/command-input.svelte +36 -0
- package/dist/ui/shadcn/command/command-input.svelte.d.ts +4 -0
- package/dist/ui/shadcn/command/command-item.svelte +27 -0
- package/dist/ui/shadcn/command/command-item.svelte.d.ts +4 -0
- package/dist/ui/shadcn/command/command-link-item.svelte +20 -0
- package/dist/ui/shadcn/command/command-link-item.svelte.d.ts +4 -0
- package/dist/ui/shadcn/command/command-list.svelte +20 -0
- package/dist/ui/shadcn/command/command-list.svelte.d.ts +4 -0
- package/dist/ui/shadcn/command/command-loading.svelte +7 -0
- package/dist/ui/shadcn/command/command-loading.svelte.d.ts +4 -0
- package/dist/ui/shadcn/command/command-separator.svelte +17 -0
- package/dist/ui/shadcn/command/command-separator.svelte.d.ts +4 -0
- package/dist/ui/shadcn/command/command-shortcut.svelte +23 -0
- package/dist/ui/shadcn/command/command-shortcut.svelte.d.ts +5 -0
- package/dist/ui/shadcn/command/command.svelte +28 -0
- package/dist/ui/shadcn/command/command.svelte.d.ts +8 -0
- package/dist/ui/shadcn/command/index.d.ts +12 -0
- package/dist/ui/shadcn/command/index.js +14 -0
- package/dist/ui/shadcn/dialog/dialog-close.svelte +11 -0
- package/dist/ui/shadcn/dialog/dialog-close.svelte.d.ts +4 -0
- package/dist/ui/shadcn/dialog/dialog-content.svelte +48 -0
- package/dist/ui/shadcn/dialog/dialog-content.svelte.d.ts +13 -0
- package/dist/ui/shadcn/dialog/dialog-description.svelte +20 -0
- package/dist/ui/shadcn/dialog/dialog-description.svelte.d.ts +4 -0
- package/dist/ui/shadcn/dialog/dialog-footer.svelte +32 -0
- package/dist/ui/shadcn/dialog/dialog-footer.svelte.d.ts +8 -0
- package/dist/ui/shadcn/dialog/dialog-header.svelte +20 -0
- package/dist/ui/shadcn/dialog/dialog-header.svelte.d.ts +5 -0
- package/dist/ui/shadcn/dialog/dialog-overlay.svelte +20 -0
- package/dist/ui/shadcn/dialog/dialog-overlay.svelte.d.ts +4 -0
- package/dist/ui/shadcn/dialog/dialog-portal.svelte +7 -0
- package/dist/ui/shadcn/dialog/dialog-portal.svelte.d.ts +3 -0
- package/dist/ui/shadcn/dialog/dialog-title.svelte +17 -0
- package/dist/ui/shadcn/dialog/dialog-title.svelte.d.ts +4 -0
- package/dist/ui/shadcn/dialog/dialog-trigger.svelte +11 -0
- package/dist/ui/shadcn/dialog/dialog-trigger.svelte.d.ts +4 -0
- package/dist/ui/shadcn/dialog/dialog.svelte +7 -0
- package/dist/ui/shadcn/dialog/dialog.svelte.d.ts +3 -0
- package/dist/ui/shadcn/dialog/index.d.ts +11 -0
- package/dist/ui/shadcn/dialog/index.js +13 -0
- package/dist/ui/shadcn/input/index.d.ts +2 -0
- package/dist/ui/shadcn/input/index.js +4 -0
- package/dist/ui/shadcn/input/input.svelte +48 -0
- package/dist/ui/shadcn/input/input.svelte.d.ts +13 -0
- package/dist/ui/shadcn/input-group/index.d.ts +7 -0
- package/dist/ui/shadcn/input-group/index.js +9 -0
- package/dist/ui/shadcn/input-group/input-group-addon.svelte +53 -0
- package/dist/ui/shadcn/input-group/input-group-addon.svelte.d.ts +32 -0
- package/dist/ui/shadcn/input-group/input-group-button.svelte +49 -0
- package/dist/ui/shadcn/input-group/input-group-button.svelte.d.ts +32 -0
- package/dist/ui/shadcn/input-group/input-group-input.svelte +23 -0
- package/dist/ui/shadcn/input-group/input-group-input.svelte.d.ts +11 -0
- package/dist/ui/shadcn/input-group/input-group-text.svelte +22 -0
- package/dist/ui/shadcn/input-group/input-group-text.svelte.d.ts +5 -0
- package/dist/ui/shadcn/input-group/input-group-textarea.svelte +23 -0
- package/dist/ui/shadcn/input-group/input-group-textarea.svelte.d.ts +3 -0
- package/dist/ui/shadcn/input-group/input-group.svelte +24 -0
- package/dist/ui/shadcn/input-group/input-group.svelte.d.ts +5 -0
- package/dist/ui/shadcn/tabs/tabs.svelte.d.ts +1 -1
- package/dist/ui/shadcn/textarea/index.d.ts +2 -0
- package/dist/ui/shadcn/textarea/index.js +4 -0
- package/dist/ui/shadcn/textarea/textarea.svelte +23 -0
- package/dist/ui/shadcn/textarea/textarea.svelte.d.ts +5 -0
- package/dist/ui/tab-item.svelte +35 -9
- package/dist/ui/tab-item.svelte.d.ts +9 -4
- package/dist/ui/tabs-phase.svelte +19 -0
- package/dist/ui/tabs-phase.svelte.d.ts +9 -0
- package/dist/ui/tabs.svelte +47 -24
- package/dist/ui/tabs.svelte.d.ts +16 -6
- package/dist/vite.d.ts +8 -6
- package/dist/vite.js +140 -47
- package/package.json +8 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Dialog as DialogPrimitive } from 'bits-ui';
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
ref = $bindable(null),
|
|
6
|
+
type = 'button',
|
|
7
|
+
...restProps
|
|
8
|
+
}: DialogPrimitive.TriggerProps = $props();
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<DialogPrimitive.Trigger bind:ref data-slot="dialog-trigger" {type} {...restProps} />
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Root from './dialog.svelte';
|
|
2
|
+
import Portal from './dialog-portal.svelte';
|
|
3
|
+
import Title from './dialog-title.svelte';
|
|
4
|
+
import Footer from './dialog-footer.svelte';
|
|
5
|
+
import Header from './dialog-header.svelte';
|
|
6
|
+
import Overlay from './dialog-overlay.svelte';
|
|
7
|
+
import Content from './dialog-content.svelte';
|
|
8
|
+
import Description from './dialog-description.svelte';
|
|
9
|
+
import Trigger from './dialog-trigger.svelte';
|
|
10
|
+
import Close from './dialog-close.svelte';
|
|
11
|
+
export { Root, Title, Portal, Footer, Header, Trigger, Overlay, Content, Description, Close, Root as Dialog, Title as DialogTitle, Portal as DialogPortal, Footer as DialogFooter, Header as DialogHeader, Trigger as DialogTrigger, Overlay as DialogOverlay, Content as DialogContent, Description as DialogDescription, Close as DialogClose };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Root from './dialog.svelte';
|
|
2
|
+
import Portal from './dialog-portal.svelte';
|
|
3
|
+
import Title from './dialog-title.svelte';
|
|
4
|
+
import Footer from './dialog-footer.svelte';
|
|
5
|
+
import Header from './dialog-header.svelte';
|
|
6
|
+
import Overlay from './dialog-overlay.svelte';
|
|
7
|
+
import Content from './dialog-content.svelte';
|
|
8
|
+
import Description from './dialog-description.svelte';
|
|
9
|
+
import Trigger from './dialog-trigger.svelte';
|
|
10
|
+
import Close from './dialog-close.svelte';
|
|
11
|
+
export { Root, Title, Portal, Footer, Header, Trigger, Overlay, Content, Description, Close,
|
|
12
|
+
//
|
|
13
|
+
Root as Dialog, Title as DialogTitle, Portal as DialogPortal, Footer as DialogFooter, Header as DialogHeader, Trigger as DialogTrigger, Overlay as DialogOverlay, Content as DialogContent, Description as DialogDescription, Close as DialogClose };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLInputAttributes, HTMLInputTypeAttribute } from 'svelte/elements';
|
|
3
|
+
import { cn, type WithElementRef } from '../../../shadcn.js';
|
|
4
|
+
|
|
5
|
+
type InputType = Exclude<HTMLInputTypeAttribute, 'file'>;
|
|
6
|
+
|
|
7
|
+
type Props = WithElementRef<
|
|
8
|
+
Omit<HTMLInputAttributes, 'type'> &
|
|
9
|
+
({ type: 'file'; files?: FileList } | { type?: InputType; files?: undefined })
|
|
10
|
+
>;
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
ref = $bindable(null),
|
|
14
|
+
value = $bindable(),
|
|
15
|
+
type,
|
|
16
|
+
files = $bindable(),
|
|
17
|
+
class: className,
|
|
18
|
+
'data-slot': dataSlot = 'input',
|
|
19
|
+
...restProps
|
|
20
|
+
}: Props = $props();
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
{#if type === 'file'}
|
|
24
|
+
<input
|
|
25
|
+
bind:this={ref}
|
|
26
|
+
data-slot={dataSlot}
|
|
27
|
+
class={cn(
|
|
28
|
+
'dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 h-9 rounded-md border bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] file:h-7 file:text-sm file:font-medium focus-visible:ring-3 aria-invalid:ring-3 md:text-sm file:text-foreground placeholder:text-muted-foreground w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',
|
|
29
|
+
className
|
|
30
|
+
)}
|
|
31
|
+
type="file"
|
|
32
|
+
bind:files
|
|
33
|
+
bind:value
|
|
34
|
+
{...restProps}
|
|
35
|
+
/>
|
|
36
|
+
{:else}
|
|
37
|
+
<input
|
|
38
|
+
bind:this={ref}
|
|
39
|
+
data-slot={dataSlot}
|
|
40
|
+
class={cn(
|
|
41
|
+
'dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 h-9 rounded-md border bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] file:h-7 file:text-sm file:font-medium focus-visible:ring-3 aria-invalid:ring-3 md:text-sm file:text-foreground placeholder:text-muted-foreground w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',
|
|
42
|
+
className
|
|
43
|
+
)}
|
|
44
|
+
{type}
|
|
45
|
+
bind:value
|
|
46
|
+
{...restProps}
|
|
47
|
+
/>
|
|
48
|
+
{/if}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HTMLInputAttributes, HTMLInputTypeAttribute } from 'svelte/elements';
|
|
2
|
+
import { type WithElementRef } from '../../../shadcn.js';
|
|
3
|
+
type InputType = Exclude<HTMLInputTypeAttribute, 'file'>;
|
|
4
|
+
type Props = WithElementRef<Omit<HTMLInputAttributes, 'type'> & ({
|
|
5
|
+
type: 'file';
|
|
6
|
+
files?: FileList;
|
|
7
|
+
} | {
|
|
8
|
+
type?: InputType;
|
|
9
|
+
files?: undefined;
|
|
10
|
+
})>;
|
|
11
|
+
declare const Input: import("svelte").Component<Props, {}, "value" | "ref" | "files">;
|
|
12
|
+
type Input = ReturnType<typeof Input>;
|
|
13
|
+
export default Input;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import Root from './input-group.svelte';
|
|
2
|
+
import Addon from './input-group-addon.svelte';
|
|
3
|
+
import Button from './input-group-button.svelte';
|
|
4
|
+
import Input from './input-group-input.svelte';
|
|
5
|
+
import Text from './input-group-text.svelte';
|
|
6
|
+
import Textarea from './input-group-textarea.svelte';
|
|
7
|
+
export { Root, Addon, Button, Input, Text, Textarea, Root as InputGroup, Addon as InputGroupAddon, Button as InputGroupButton, Input as InputGroupInput, Text as InputGroupText, Textarea as InputGroupTextarea };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Root from './input-group.svelte';
|
|
2
|
+
import Addon from './input-group-addon.svelte';
|
|
3
|
+
import Button from './input-group-button.svelte';
|
|
4
|
+
import Input from './input-group-input.svelte';
|
|
5
|
+
import Text from './input-group-text.svelte';
|
|
6
|
+
import Textarea from './input-group-textarea.svelte';
|
|
7
|
+
export { Root, Addon, Button, Input, Text, Textarea,
|
|
8
|
+
//
|
|
9
|
+
Root as InputGroup, Addon as InputGroupAddon, Button as InputGroupButton, Input as InputGroupInput, Text as InputGroupText, Textarea as InputGroupTextarea };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { tv, type VariantProps } from 'tailwind-variants';
|
|
3
|
+
export const inputGroupAddonVariants = tv({
|
|
4
|
+
base: "text-muted-foreground h-auto gap-2 py-1.5 text-sm font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4 flex cursor-text items-center justify-center select-none",
|
|
5
|
+
variants: {
|
|
6
|
+
align: {
|
|
7
|
+
'inline-start': 'pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem] order-first',
|
|
8
|
+
'inline-end': 'pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem] order-last',
|
|
9
|
+
'block-start':
|
|
10
|
+
'px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2 order-first w-full justify-start',
|
|
11
|
+
'block-end':
|
|
12
|
+
'px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2 order-last w-full justify-start'
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
align: 'inline-start'
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export type InputGroupAddonAlign = VariantProps<typeof inputGroupAddonVariants>['align'];
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<script lang="ts">
|
|
24
|
+
import { cn, type WithElementRef } from '../../../shadcn.js';
|
|
25
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
26
|
+
|
|
27
|
+
let {
|
|
28
|
+
ref = $bindable(null),
|
|
29
|
+
class: className,
|
|
30
|
+
children,
|
|
31
|
+
align = 'inline-start',
|
|
32
|
+
...restProps
|
|
33
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
34
|
+
align?: InputGroupAddonAlign;
|
|
35
|
+
} = $props();
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<div
|
|
39
|
+
bind:this={ref}
|
|
40
|
+
role="group"
|
|
41
|
+
data-slot="input-group-addon"
|
|
42
|
+
data-align={align}
|
|
43
|
+
class={cn(inputGroupAddonVariants({ align }), className)}
|
|
44
|
+
onclick={(e) => {
|
|
45
|
+
if ((e.target as HTMLElement).closest('button')) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
e.currentTarget.parentElement?.querySelector('input')?.focus();
|
|
49
|
+
}}
|
|
50
|
+
{...restProps}
|
|
51
|
+
>
|
|
52
|
+
{@render children?.()}
|
|
53
|
+
</div>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
+
export declare const inputGroupAddonVariants: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
align: {
|
|
4
|
+
'inline-start': string;
|
|
5
|
+
'inline-end': string;
|
|
6
|
+
'block-start': string;
|
|
7
|
+
'block-end': string;
|
|
8
|
+
};
|
|
9
|
+
}, undefined, "text-muted-foreground h-auto gap-2 py-1.5 text-sm font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4 flex cursor-text items-center justify-center select-none", {
|
|
10
|
+
align: {
|
|
11
|
+
'inline-start': string;
|
|
12
|
+
'inline-end': string;
|
|
13
|
+
'block-start': string;
|
|
14
|
+
'block-end': string;
|
|
15
|
+
};
|
|
16
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
17
|
+
align: {
|
|
18
|
+
'inline-start': string;
|
|
19
|
+
'inline-end': string;
|
|
20
|
+
'block-start': string;
|
|
21
|
+
'block-end': string;
|
|
22
|
+
};
|
|
23
|
+
}, undefined, "text-muted-foreground h-auto gap-2 py-1.5 text-sm font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4 flex cursor-text items-center justify-center select-none", unknown, unknown, undefined>>;
|
|
24
|
+
export type InputGroupAddonAlign = VariantProps<typeof inputGroupAddonVariants>['align'];
|
|
25
|
+
import { type WithElementRef } from '../../../shadcn.js';
|
|
26
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
27
|
+
type $$ComponentProps = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
28
|
+
align?: InputGroupAddonAlign;
|
|
29
|
+
};
|
|
30
|
+
declare const InputGroupAddon: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
31
|
+
type InputGroupAddon = ReturnType<typeof InputGroupAddon>;
|
|
32
|
+
export default InputGroupAddon;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { tv, type VariantProps } from 'tailwind-variants';
|
|
3
|
+
|
|
4
|
+
const inputGroupButtonVariants = tv({
|
|
5
|
+
base: 'gap-2 text-sm flex items-center shadow-none',
|
|
6
|
+
variants: {
|
|
7
|
+
size: {
|
|
8
|
+
xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
|
|
9
|
+
sm: 'cn-input-group-button-size-sm',
|
|
10
|
+
'icon-xs': 'size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0',
|
|
11
|
+
'icon-sm': 'size-8 p-0 has-[>svg]:p-0'
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
size: 'xs'
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export type InputGroupButtonSize = VariantProps<typeof inputGroupButtonVariants>['size'];
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<script lang="ts">
|
|
23
|
+
import { cn } from '../../../shadcn.js';
|
|
24
|
+
import type { ComponentProps } from 'svelte';
|
|
25
|
+
import { Button } from '../button/index.js';
|
|
26
|
+
|
|
27
|
+
let {
|
|
28
|
+
ref = $bindable(null),
|
|
29
|
+
class: className,
|
|
30
|
+
children,
|
|
31
|
+
type = 'button',
|
|
32
|
+
variant = 'ghost',
|
|
33
|
+
size = 'xs',
|
|
34
|
+
...restProps
|
|
35
|
+
}: Omit<ComponentProps<typeof Button>, 'href' | 'size'> & {
|
|
36
|
+
size?: InputGroupButtonSize;
|
|
37
|
+
} = $props();
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<Button
|
|
41
|
+
bind:ref
|
|
42
|
+
{type}
|
|
43
|
+
data-size={size}
|
|
44
|
+
{variant}
|
|
45
|
+
class={cn(inputGroupButtonVariants({ size }), className)}
|
|
46
|
+
{...restProps}
|
|
47
|
+
>
|
|
48
|
+
{@render children?.()}
|
|
49
|
+
</Button>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
+
declare const inputGroupButtonVariants: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
size: {
|
|
4
|
+
xs: string;
|
|
5
|
+
sm: string;
|
|
6
|
+
'icon-xs': string;
|
|
7
|
+
'icon-sm': string;
|
|
8
|
+
};
|
|
9
|
+
}, undefined, "gap-2 text-sm flex items-center shadow-none", {
|
|
10
|
+
size: {
|
|
11
|
+
xs: string;
|
|
12
|
+
sm: string;
|
|
13
|
+
'icon-xs': string;
|
|
14
|
+
'icon-sm': string;
|
|
15
|
+
};
|
|
16
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
17
|
+
size: {
|
|
18
|
+
xs: string;
|
|
19
|
+
sm: string;
|
|
20
|
+
'icon-xs': string;
|
|
21
|
+
'icon-sm': string;
|
|
22
|
+
};
|
|
23
|
+
}, undefined, "gap-2 text-sm flex items-center shadow-none", unknown, unknown, undefined>>;
|
|
24
|
+
export type InputGroupButtonSize = VariantProps<typeof inputGroupButtonVariants>['size'];
|
|
25
|
+
import type { ComponentProps } from 'svelte';
|
|
26
|
+
import { Button } from '../button/index.js';
|
|
27
|
+
type $$ComponentProps = Omit<ComponentProps<typeof Button>, 'href' | 'size'> & {
|
|
28
|
+
size?: InputGroupButtonSize;
|
|
29
|
+
};
|
|
30
|
+
declare const InputGroupButton: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
31
|
+
type InputGroupButton = ReturnType<typeof InputGroupButton>;
|
|
32
|
+
export default InputGroupButton;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../../shadcn.js';
|
|
3
|
+
import type { ComponentProps } from 'svelte';
|
|
4
|
+
import { Input } from '../input/index.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
value = $bindable(),
|
|
9
|
+
class: className,
|
|
10
|
+
...props
|
|
11
|
+
}: ComponentProps<typeof Input> = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Input
|
|
15
|
+
bind:ref
|
|
16
|
+
data-slot="input-group-control"
|
|
17
|
+
class={cn(
|
|
18
|
+
'rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent flex-1',
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
bind:value
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const InputGroupInput: import("svelte").Component<(Omit<import("svelte/elements").HTMLInputAttributes, "type"> & ({
|
|
2
|
+
type: "file";
|
|
3
|
+
files?: FileList;
|
|
4
|
+
} | {
|
|
5
|
+
type?: "number" | "time" | "url" | "search" | "text" | "button" | "image" | "hidden" | "color" | "submit" | "reset" | "checkbox" | "radio" | (string & {}) | "tel" | "email" | "date" | "datetime-local" | "month" | "password" | "range" | "week";
|
|
6
|
+
files?: undefined;
|
|
7
|
+
})) & {
|
|
8
|
+
ref?: HTMLElement | null | undefined;
|
|
9
|
+
}, {}, "value" | "ref">;
|
|
10
|
+
type InputGroupInput = ReturnType<typeof InputGroupInput>;
|
|
11
|
+
export default InputGroupInput;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from '../../../shadcn.js';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLSpanElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<span
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
class={cn(
|
|
16
|
+
"text-muted-foreground gap-2 text-sm [&_svg:not([class*='size-'])]:size-4 flex items-center [&_svg]:pointer-events-none",
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
{...restProps}
|
|
20
|
+
>
|
|
21
|
+
{@render children?.()}
|
|
22
|
+
</span>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type WithElementRef } from '../../../shadcn.js';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
declare const InputGroupText: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLSpanElement>>, {}, "ref">;
|
|
4
|
+
type InputGroupText = ReturnType<typeof InputGroupText>;
|
|
5
|
+
export default InputGroupText;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../../shadcn.js';
|
|
3
|
+
import { Textarea } from '../textarea/index.js';
|
|
4
|
+
import type { ComponentProps } from 'svelte';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
value = $bindable(),
|
|
9
|
+
class: className,
|
|
10
|
+
...props
|
|
11
|
+
}: ComponentProps<typeof Textarea> = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Textarea
|
|
15
|
+
bind:ref
|
|
16
|
+
data-slot="input-group-control"
|
|
17
|
+
class={cn(
|
|
18
|
+
'rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent flex-1 resize-none',
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
bind:value
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const InputGroupTextarea: import("svelte").Component<Omit<import("../../../shadcn.js").WithElementRef<import("svelte/elements").HTMLTextareaAttributes>, "children">, {}, "value" | "ref">;
|
|
2
|
+
type InputGroupTextarea = ReturnType<typeof InputGroupTextarea>;
|
|
3
|
+
export default InputGroupTextarea;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef } from '../../../shadcn.js';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...props
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="input-group"
|
|
16
|
+
role="group"
|
|
17
|
+
class={cn(
|
|
18
|
+
'group/input-group border-input dark:bg-input/30 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 h-9 rounded-md border shadow-xs transition-[color,box-shadow] in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-3 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5 relative flex w-full min-w-0 items-center outline-none has-[>textarea]:h-auto',
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
{...props}
|
|
22
|
+
>
|
|
23
|
+
{@render children?.()}
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type WithElementRef } from '../../../shadcn.js';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
declare const InputGroup: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLDivElement>>, {}, "ref">;
|
|
4
|
+
type InputGroup = ReturnType<typeof InputGroup>;
|
|
5
|
+
export default InputGroup;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Tabs as TabsPrimitive } from 'bits-ui';
|
|
2
|
-
declare const Tabs: import("svelte").Component<TabsPrimitive.RootProps, {}, "
|
|
2
|
+
declare const Tabs: import("svelte").Component<TabsPrimitive.RootProps, {}, "value" | "ref">;
|
|
3
3
|
type Tabs = ReturnType<typeof Tabs>;
|
|
4
4
|
export default Tabs;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn, type WithElementRef, type WithoutChildren } from '../../../shadcn.js';
|
|
3
|
+
import type { HTMLTextareaAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
value = $bindable(),
|
|
8
|
+
class: className,
|
|
9
|
+
'data-slot': dataSlot = 'textarea',
|
|
10
|
+
...restProps
|
|
11
|
+
}: WithoutChildren<WithElementRef<HTMLTextareaAttributes>> = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<textarea
|
|
15
|
+
bind:this={ref}
|
|
16
|
+
data-slot={dataSlot}
|
|
17
|
+
class={cn(
|
|
18
|
+
'border-input dark:bg-input/30 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-md border bg-transparent px-2.5 py-2 text-base shadow-xs transition-[color,box-shadow] focus-visible:ring-3 aria-invalid:ring-3 md:text-sm placeholder:text-muted-foreground flex field-sizing-content min-h-16 w-full outline-none disabled:cursor-not-allowed disabled:opacity-50',
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
bind:value
|
|
22
|
+
{...restProps}
|
|
23
|
+
></textarea>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type WithElementRef } from '../../../shadcn.js';
|
|
2
|
+
import type { HTMLTextareaAttributes } from 'svelte/elements';
|
|
3
|
+
declare const Textarea: import("svelte").Component<Omit<WithElementRef<HTMLTextareaAttributes>, "children">, {}, "value" | "ref">;
|
|
4
|
+
type Textarea = ReturnType<typeof Textarea>;
|
|
5
|
+
export default Textarea;
|
package/dist/ui/tab-item.svelte
CHANGED
|
@@ -1,14 +1,40 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import { getContext, type Snippet } from 'svelte';
|
|
3
|
+
import * as TabsPrimitive from './shadcn/tabs/index.js';
|
|
4
|
+
import { TABS_PHASE, getTabsContext, type TabsPhase } from './tabs.svelte';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const {
|
|
7
|
+
label,
|
|
8
|
+
value: valueProp,
|
|
9
|
+
children
|
|
10
|
+
}: {
|
|
11
|
+
/** The trigger text for this tab. */
|
|
12
|
+
label: string;
|
|
13
|
+
/** Underlying value; defaults to `label` (only needed to disambiguate duplicate labels). */
|
|
14
|
+
value?: string;
|
|
15
|
+
children: Snippet;
|
|
16
|
+
} = $props();
|
|
8
17
|
|
|
9
|
-
const
|
|
18
|
+
const value = $derived(valueProp ?? label);
|
|
19
|
+
const phase = getContext<TabsPhase>(TABS_PHASE);
|
|
20
|
+
|
|
21
|
+
// Register once, during the collect pass, so <Tabs> can pick the default tab.
|
|
22
|
+
// svelte-ignore state_referenced_locally
|
|
23
|
+
if (phase === 'collect') getTabsContext()?.register(value);
|
|
10
24
|
</script>
|
|
11
25
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
26
|
+
{#if phase === 'list'}
|
|
27
|
+
<!-- bits-ui v2 emits data-state="active"; the vendored trigger styles the
|
|
28
|
+
active state with data-active (a skew from the CLI's registry version),
|
|
29
|
+
so paint the active state here to match what's actually emitted. -->
|
|
30
|
+
<TabsPrimitive.Trigger
|
|
31
|
+
{value}
|
|
32
|
+
class="data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm"
|
|
33
|
+
>
|
|
34
|
+
{label}
|
|
35
|
+
</TabsPrimitive.Trigger>
|
|
36
|
+
{:else if phase === 'panel'}
|
|
37
|
+
<TabsPrimitive.Content {value}>
|
|
38
|
+
{@render children()}
|
|
39
|
+
</TabsPrimitive.Content>
|
|
40
|
+
{/if}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
/** The trigger text for this tab. */
|
|
4
|
+
label: string;
|
|
5
|
+
/** Underlying value; defaults to `label` (only needed to disambiguate duplicate labels). */
|
|
6
|
+
value?: string;
|
|
7
|
+
children: Snippet;
|
|
8
|
+
};
|
|
9
|
+
declare const TabItem: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
5
10
|
type TabItem = ReturnType<typeof TabItem>;
|
|
6
11
|
export default TabItem;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// Internal to <Tabs>. bits-ui renders the trigger row (Tabs.List) and the
|
|
3
|
+
// panels (Tabs.Content) as separate subtrees, but authors write a single flat
|
|
4
|
+
// list of <TabItem>s. So <Tabs> renders that list three times through this
|
|
5
|
+
// wrapper — once per phase — and each <TabItem> reads the phase to decide what
|
|
6
|
+
// to emit: `collect` registers its value (no DOM), `list` renders a trigger,
|
|
7
|
+
// `panel` renders the content. Doing it in render (not an effect) keeps the
|
|
8
|
+
// first tab selected server-side, with no post-hydration pop-in.
|
|
9
|
+
import { setContext, type Snippet } from 'svelte';
|
|
10
|
+
import { TABS_PHASE, type TabsPhase } from './tabs.svelte';
|
|
11
|
+
|
|
12
|
+
const { phase, children }: { phase: TabsPhase; children: Snippet } = $props();
|
|
13
|
+
|
|
14
|
+
// phase is fixed for the lifetime of each scope instance.
|
|
15
|
+
// svelte-ignore state_referenced_locally
|
|
16
|
+
setContext<TabsPhase>(TABS_PHASE, phase);
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
{@render children()}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
import { type TabsPhase } from './tabs.svelte';
|
|
3
|
+
type $$ComponentProps = {
|
|
4
|
+
phase: TabsPhase;
|
|
5
|
+
children: Snippet;
|
|
6
|
+
};
|
|
7
|
+
declare const TabsPhase: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
|
+
type TabsPhase = ReturnType<typeof TabsPhase>;
|
|
9
|
+
export default TabsPhase;
|