sdocs 0.0.1
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 +43 -0
- package/bin/sdocs.js +2 -0
- package/dist/Sdocs.svelte +1210 -0
- package/dist/Sdocs.svelte.d.ts +5 -0
- package/dist/cli/app-plugin.d.ts +7 -0
- package/dist/cli/app-plugin.js +69 -0
- package/dist/cli/config.d.ts +12 -0
- package/dist/cli/config.js +34 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +72 -0
- package/dist/cli/server.d.ts +2 -0
- package/dist/cli/server.js +62 -0
- package/dist/docgen.d.ts +47 -0
- package/dist/docgen.js +463 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/internal/ComponentPreview.svelte +58 -0
- package/dist/internal/ComponentPreview.svelte.d.ts +17 -0
- package/dist/internal/CssPropsTable.svelte +239 -0
- package/dist/internal/CssPropsTable.svelte.d.ts +11 -0
- package/dist/internal/Home.svelte +92 -0
- package/dist/internal/Home.svelte.d.ts +9 -0
- package/dist/internal/MethodsTable.svelte +72 -0
- package/dist/internal/MethodsTable.svelte.d.ts +7 -0
- package/dist/internal/PropsTable.svelte +342 -0
- package/dist/internal/PropsTable.svelte.d.ts +12 -0
- package/dist/internal/Showcase.svelte +130 -0
- package/dist/internal/Showcase.svelte.d.ts +21 -0
- package/dist/types.d.ts +162 -0
- package/dist/types.js +1 -0
- package/dist/ui/Badge/Badge.docs.svelte +46 -0
- package/dist/ui/Badge/Badge.docs.svelte.d.ts +26 -0
- package/dist/ui/Badge/Badge.svelte +59 -0
- package/dist/ui/Badge/Badge.svelte.d.ts +17 -0
- package/dist/ui/Badge/index.d.ts +1 -0
- package/dist/ui/Badge/index.js +1 -0
- package/dist/ui/Checkbox/Checkbox.docs.svelte +51 -0
- package/dist/ui/Checkbox/Checkbox.docs.svelte.d.ts +27 -0
- package/dist/ui/Checkbox/Checkbox.svelte +169 -0
- package/dist/ui/Checkbox/Checkbox.svelte.d.ts +18 -0
- package/dist/ui/Checkbox/index.d.ts +1 -0
- package/dist/ui/Checkbox/index.js +1 -0
- package/dist/ui/CodeBlock/CodeBlock.docs.svelte +28 -0
- package/dist/ui/CodeBlock/CodeBlock.docs.svelte.d.ts +24 -0
- package/dist/ui/CodeBlock/CodeBlock.svelte +101 -0
- package/dist/ui/CodeBlock/CodeBlock.svelte.d.ts +7 -0
- package/dist/ui/CodeBlock/index.d.ts +1 -0
- package/dist/ui/CodeBlock/index.js +1 -0
- package/dist/ui/Frame/Frame.docs.svelte +140 -0
- package/dist/ui/Frame/Frame.docs.svelte.d.ts +26 -0
- package/dist/ui/Frame/Frame.svelte +88 -0
- package/dist/ui/Frame/Frame.svelte.d.ts +15 -0
- package/dist/ui/Frame/index.d.ts +1 -0
- package/dist/ui/Frame/index.js +1 -0
- package/dist/ui/InputNumber/InputNumber.docs.svelte +50 -0
- package/dist/ui/InputNumber/InputNumber.docs.svelte.d.ts +26 -0
- package/dist/ui/InputNumber/InputNumber.svelte +275 -0
- package/dist/ui/InputNumber/InputNumber.svelte.d.ts +26 -0
- package/dist/ui/InputNumber/index.d.ts +1 -0
- package/dist/ui/InputNumber/index.js +1 -0
- package/dist/ui/InputText/InputText.docs.svelte +43 -0
- package/dist/ui/InputText/InputText.docs.svelte.d.ts +26 -0
- package/dist/ui/InputText/InputText.svelte +116 -0
- package/dist/ui/InputText/InputText.svelte.d.ts +22 -0
- package/dist/ui/InputText/index.d.ts +1 -0
- package/dist/ui/InputText/index.js +1 -0
- package/dist/ui/Panel/CollapsiblePanel.docs.svelte +45 -0
- package/dist/ui/Panel/CollapsiblePanel.docs.svelte.d.ts +25 -0
- package/dist/ui/Panel/CollapsiblePanel.svelte +93 -0
- package/dist/ui/Panel/CollapsiblePanel.svelte.d.ts +14 -0
- package/dist/ui/Panel/index.d.ts +1 -0
- package/dist/ui/Panel/index.js +1 -0
- package/dist/ui/Placeholder/Placeholder.docs.svelte +49 -0
- package/dist/ui/Placeholder/Placeholder.docs.svelte.d.ts +26 -0
- package/dist/ui/Placeholder/Placeholder.svelte +99 -0
- package/dist/ui/Placeholder/Placeholder.svelte.d.ts +21 -0
- package/dist/ui/Placeholder/index.d.ts +1 -0
- package/dist/ui/Placeholder/index.js +1 -0
- package/dist/ui/Radio/Radio.docs.svelte +67 -0
- package/dist/ui/Radio/Radio.docs.svelte.d.ts +27 -0
- package/dist/ui/Radio/Radio.svelte +165 -0
- package/dist/ui/Radio/Radio.svelte.d.ts +22 -0
- package/dist/ui/Radio/RadioGroup.docs.svelte +70 -0
- package/dist/ui/Radio/RadioGroup.docs.svelte.d.ts +27 -0
- package/dist/ui/Radio/RadioGroup.svelte +98 -0
- package/dist/ui/Radio/RadioGroup.svelte.d.ts +27 -0
- package/dist/ui/Radio/index.d.ts +2 -0
- package/dist/ui/Radio/index.js +2 -0
- package/dist/ui/SegmentControl/SegmentControl.docs.svelte +54 -0
- package/dist/ui/SegmentControl/SegmentControl.docs.svelte.d.ts +25 -0
- package/dist/ui/SegmentControl/SegmentControl.svelte +120 -0
- package/dist/ui/SegmentControl/SegmentControl.svelte.d.ts +18 -0
- package/dist/ui/SegmentControl/index.d.ts +1 -0
- package/dist/ui/SegmentControl/index.js +1 -0
- package/dist/ui/Stack/Stack.docs.svelte +63 -0
- package/dist/ui/Stack/Stack.docs.svelte.d.ts +26 -0
- package/dist/ui/Stack/Stack.svelte +45 -0
- package/dist/ui/Stack/Stack.svelte.d.ts +19 -0
- package/dist/ui/Stack/index.d.ts +1 -0
- package/dist/ui/Stack/index.js +1 -0
- package/dist/ui/Table/Body.svelte +17 -0
- package/dist/ui/Table/Body.svelte.d.ts +11 -0
- package/dist/ui/Table/Caption.svelte +17 -0
- package/dist/ui/Table/Caption.svelte.d.ts +11 -0
- package/dist/ui/Table/Cell.svelte +24 -0
- package/dist/ui/Table/Cell.svelte.d.ts +15 -0
- package/dist/ui/Table/Foot.svelte +17 -0
- package/dist/ui/Table/Foot.svelte.d.ts +11 -0
- package/dist/ui/Table/Head.svelte +17 -0
- package/dist/ui/Table/Head.svelte.d.ts +11 -0
- package/dist/ui/Table/Header.svelte +27 -0
- package/dist/ui/Table/Header.svelte.d.ts +17 -0
- package/dist/ui/Table/Row.svelte +19 -0
- package/dist/ui/Table/Row.svelte.d.ts +13 -0
- package/dist/ui/Table/Table.docs.svelte +197 -0
- package/dist/ui/Table/Table.docs.svelte.d.ts +28 -0
- package/dist/ui/Table/Table.svelte +140 -0
- package/dist/ui/Table/Table.svelte.d.ts +27 -0
- package/dist/ui/Table/index.js +10 -0
- package/dist/ui/css/colors.css +377 -0
- package/dist/ui/css/global.css +10 -0
- package/dist/ui/index.d.ts +12 -0
- package/dist/ui/index.js +12 -0
- package/dist/virtual-sdocs.d.ts +20 -0
- package/dist/vite-plugin.d.ts +18 -0
- package/dist/vite-plugin.js +206 -0
- package/dist/vite.d.ts +2 -0
- package/dist/vite.js +2 -0
- package/package.json +76 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import InputText from './InputText.svelte';
|
|
3
|
+
import type { DocMeta } from '../../types.js';
|
|
4
|
+
|
|
5
|
+
export const meta: DocMeta = {
|
|
6
|
+
title: 'InputText',
|
|
7
|
+
component: InputText,
|
|
8
|
+
args: {
|
|
9
|
+
value: '',
|
|
10
|
+
placeholder: 'Enter text...',
|
|
11
|
+
size: 'm',
|
|
12
|
+
disabled: false,
|
|
13
|
+
type: 'text'
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { Default, Sizes, Disabled, Types };
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
{#snippet Default(args: any)}
|
|
21
|
+
<InputText {...args} />
|
|
22
|
+
{/snippet}
|
|
23
|
+
|
|
24
|
+
{#snippet Sizes()}
|
|
25
|
+
<div style="display: flex; flex-direction: column; gap: 12px; max-width: 300px;">
|
|
26
|
+
<InputText placeholder="XS size" size="xs" />
|
|
27
|
+
<InputText placeholder="S size" size="s" />
|
|
28
|
+
<InputText placeholder="M size" size="m" />
|
|
29
|
+
<InputText placeholder="L size" size="l" />
|
|
30
|
+
</div>
|
|
31
|
+
{/snippet}
|
|
32
|
+
|
|
33
|
+
{#snippet Types()}
|
|
34
|
+
<div style="display: flex; flex-direction: column; gap: 12px; max-width: 300px;">
|
|
35
|
+
<InputText placeholder="Text input" type="text" />
|
|
36
|
+
<InputText placeholder="Email input" type="email" />
|
|
37
|
+
<InputText placeholder="Password input" type="password" />
|
|
38
|
+
</div>
|
|
39
|
+
{/snippet}
|
|
40
|
+
|
|
41
|
+
{#snippet Disabled()}
|
|
42
|
+
<InputText placeholder="Disabled input" value="Can't edit this" disabled />
|
|
43
|
+
{/snippet}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import InputText from './InputText.svelte';
|
|
2
|
+
import type { DocMeta } from '../../types.js';
|
|
3
|
+
declare const Default: (args: any) => ReturnType<import("svelte").Snippet>;
|
|
4
|
+
declare const Sizes: () => ReturnType<import("svelte").Snippet>;
|
|
5
|
+
declare const Types: () => ReturnType<import("svelte").Snippet>;
|
|
6
|
+
declare const Disabled: () => ReturnType<import("svelte").Snippet>;
|
|
7
|
+
export declare const meta: DocMeta;
|
|
8
|
+
export { Default, Sizes, Disabled, Types };
|
|
9
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
10
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
11
|
+
$$bindings?: Bindings;
|
|
12
|
+
} & Exports;
|
|
13
|
+
(internal: unknown, props: {
|
|
14
|
+
$$events?: Events;
|
|
15
|
+
$$slots?: Slots;
|
|
16
|
+
}): Exports & {
|
|
17
|
+
$set?: any;
|
|
18
|
+
$on?: any;
|
|
19
|
+
};
|
|
20
|
+
z_$$bindings?: Bindings;
|
|
21
|
+
}
|
|
22
|
+
declare const InputText: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
23
|
+
[evt: string]: CustomEvent<any>;
|
|
24
|
+
}, {}, {}, string>;
|
|
25
|
+
type InputText = InstanceType<typeof InputText>;
|
|
26
|
+
export default InputText;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A text input field with size variants and event callbacks.
|
|
4
|
+
*/
|
|
5
|
+
interface Props {
|
|
6
|
+
/** Input value */
|
|
7
|
+
value?: string;
|
|
8
|
+
/** Placeholder text */
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
/** Callback when value changes */
|
|
11
|
+
onchange?: (value: string) => void;
|
|
12
|
+
/** Callback on input */
|
|
13
|
+
oninput?: (value: string) => void;
|
|
14
|
+
/** Size variant */
|
|
15
|
+
size?: 'xs' | 's' | 'm' | 'l';
|
|
16
|
+
/** Disable the input */
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/** Input type */
|
|
19
|
+
type?: 'text' | 'email' | 'password';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let {
|
|
23
|
+
value = '',
|
|
24
|
+
placeholder = '',
|
|
25
|
+
onchange,
|
|
26
|
+
oninput,
|
|
27
|
+
size = 'm',
|
|
28
|
+
disabled = false,
|
|
29
|
+
type = 'text'
|
|
30
|
+
}: Props = $props();
|
|
31
|
+
|
|
32
|
+
// Internal state - sync with prop
|
|
33
|
+
let inputValue = $state(value);
|
|
34
|
+
$effect(() => {
|
|
35
|
+
inputValue = value;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
function handleInput(e: Event) {
|
|
39
|
+
const target = e.target as HTMLInputElement;
|
|
40
|
+
inputValue = target.value;
|
|
41
|
+
oninput?.(inputValue);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function handleChange(e: Event) {
|
|
45
|
+
const target = e.target as HTMLInputElement;
|
|
46
|
+
inputValue = target.value;
|
|
47
|
+
onchange?.(inputValue);
|
|
48
|
+
}
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<input
|
|
52
|
+
class="InputText {size}"
|
|
53
|
+
{type}
|
|
54
|
+
value={inputValue}
|
|
55
|
+
{placeholder}
|
|
56
|
+
{disabled}
|
|
57
|
+
oninput={handleInput}
|
|
58
|
+
onchange={handleChange}
|
|
59
|
+
/>
|
|
60
|
+
|
|
61
|
+
<style>
|
|
62
|
+
.InputText {
|
|
63
|
+
font-family: var(--font-sans);
|
|
64
|
+
font-weight: 400;
|
|
65
|
+
border: none;
|
|
66
|
+
background: var(--base-100);
|
|
67
|
+
color: var(--color-text);
|
|
68
|
+
border-radius: 6px;
|
|
69
|
+
transition: all 0.15s ease;
|
|
70
|
+
outline: none;
|
|
71
|
+
width: 100%;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.InputText::placeholder {
|
|
75
|
+
color: var(--base-400);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.InputText:hover:not(:disabled) {
|
|
79
|
+
background: var(--base-50);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.InputText:focus {
|
|
83
|
+
background: var(--base-50);
|
|
84
|
+
box-shadow: 0 0 0 2px var(--action-200);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.InputText:disabled {
|
|
88
|
+
opacity: 0.5;
|
|
89
|
+
cursor: not-allowed;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* Size variants - heights: xs=24px, s=28px, m=32px, l=40px */
|
|
93
|
+
.xs {
|
|
94
|
+
height: 24px;
|
|
95
|
+
padding: 0 8px;
|
|
96
|
+
font-size: 11px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.s {
|
|
100
|
+
height: 28px;
|
|
101
|
+
padding: 0 10px;
|
|
102
|
+
font-size: 12px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.m {
|
|
106
|
+
height: 32px;
|
|
107
|
+
padding: 0 12px;
|
|
108
|
+
font-size: 13px;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.l {
|
|
112
|
+
height: 40px;
|
|
113
|
+
padding: 0 16px;
|
|
114
|
+
font-size: 14px;
|
|
115
|
+
}
|
|
116
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A text input field with size variants and event callbacks.
|
|
3
|
+
*/
|
|
4
|
+
interface Props {
|
|
5
|
+
/** Input value */
|
|
6
|
+
value?: string;
|
|
7
|
+
/** Placeholder text */
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
/** Callback when value changes */
|
|
10
|
+
onchange?: (value: string) => void;
|
|
11
|
+
/** Callback on input */
|
|
12
|
+
oninput?: (value: string) => void;
|
|
13
|
+
/** Size variant */
|
|
14
|
+
size?: 'xs' | 's' | 'm' | 'l';
|
|
15
|
+
/** Disable the input */
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/** Input type */
|
|
18
|
+
type?: 'text' | 'email' | 'password';
|
|
19
|
+
}
|
|
20
|
+
declare const InputText: import("svelte").Component<Props, {}, "">;
|
|
21
|
+
type InputText = ReturnType<typeof InputText>;
|
|
22
|
+
export default InputText;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as InputText } from './InputText.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as InputText } from './InputText.svelte';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import CollapsiblePanel from './CollapsiblePanel.svelte';
|
|
3
|
+
import type { DocMeta } from '../../types.js';
|
|
4
|
+
|
|
5
|
+
export const meta: DocMeta = {
|
|
6
|
+
title: 'Layout/CollapsiblePanel',
|
|
7
|
+
component: CollapsiblePanel,
|
|
8
|
+
args: {
|
|
9
|
+
title: 'Settings',
|
|
10
|
+
open: true
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { Default, Closed, CustomContent };
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
{#snippet Default(args: any)}
|
|
18
|
+
<CollapsiblePanel {...args}>
|
|
19
|
+
<p style="margin: 0; color: #666;">Panel content goes here.</p>
|
|
20
|
+
</CollapsiblePanel>
|
|
21
|
+
{/snippet}
|
|
22
|
+
|
|
23
|
+
{#snippet Closed()}
|
|
24
|
+
<CollapsiblePanel title="Collapsed by default" open={false}>
|
|
25
|
+
<p style="margin: 0; color: #666;">This content is hidden until you click the header.</p>
|
|
26
|
+
</CollapsiblePanel>
|
|
27
|
+
{/snippet}
|
|
28
|
+
|
|
29
|
+
{#snippet CustomContent()}
|
|
30
|
+
<CollapsiblePanel title="User Profile">
|
|
31
|
+
<div style="display: flex; flex-direction: column; gap: 12px;">
|
|
32
|
+
<div style="display: flex; align-items: center; gap: 12px;">
|
|
33
|
+
<div style="width: 48px; height: 48px; background: #e5e5e5; border-radius: 50%;"></div>
|
|
34
|
+
<div>
|
|
35
|
+
<div style="font-weight: 600;">John Doe</div>
|
|
36
|
+
<div style="font-size: 13px; color: #666;">john@example.com</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
<div style="display: flex; gap: 8px;">
|
|
40
|
+
<button style="padding: 6px 12px; background: #3b82f6; color: white; border: none; border-radius: 6px; font-size: 13px; cursor: pointer;">Edit</button>
|
|
41
|
+
<button style="padding: 6px 12px; background: #f3f4f6; color: #374151; border: none; border-radius: 6px; font-size: 13px; cursor: pointer;">Settings</button>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</CollapsiblePanel>
|
|
45
|
+
{/snippet}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import CollapsiblePanel from './CollapsiblePanel.svelte';
|
|
2
|
+
import type { DocMeta } from '../../types.js';
|
|
3
|
+
declare const Default: (args: any) => ReturnType<import("svelte").Snippet>;
|
|
4
|
+
declare const Closed: () => ReturnType<import("svelte").Snippet>;
|
|
5
|
+
declare const CustomContent: () => ReturnType<import("svelte").Snippet>;
|
|
6
|
+
export declare const meta: DocMeta;
|
|
7
|
+
export { Default, Closed, CustomContent };
|
|
8
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
9
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
10
|
+
$$bindings?: Bindings;
|
|
11
|
+
} & Exports;
|
|
12
|
+
(internal: unknown, props: {
|
|
13
|
+
$$events?: Events;
|
|
14
|
+
$$slots?: Slots;
|
|
15
|
+
}): Exports & {
|
|
16
|
+
$set?: any;
|
|
17
|
+
$on?: any;
|
|
18
|
+
};
|
|
19
|
+
z_$$bindings?: Bindings;
|
|
20
|
+
}
|
|
21
|
+
declare const CollapsiblePanel: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
22
|
+
[evt: string]: CustomEvent<any>;
|
|
23
|
+
}, {}, {}, string>;
|
|
24
|
+
type CollapsiblePanel = InstanceType<typeof CollapsiblePanel>;
|
|
25
|
+
export default CollapsiblePanel;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import ChevronRight from 'lucide-svelte/icons/chevron-right';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
/** Title displayed in header */
|
|
7
|
+
title?: string;
|
|
8
|
+
/** Whether the panel is open */
|
|
9
|
+
open?: boolean;
|
|
10
|
+
/** Remove content padding */
|
|
11
|
+
no_content_padding?: boolean;
|
|
12
|
+
/** Panel content */
|
|
13
|
+
children?: Snippet;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let { title, open = $bindable(true), no_content_padding = false, children }: Props = $props();
|
|
17
|
+
|
|
18
|
+
function toggle() {
|
|
19
|
+
open = !open;
|
|
20
|
+
}
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<div class="CollapsiblePanel">
|
|
24
|
+
{#if title}
|
|
25
|
+
<button type="button" class="CollapsiblePanel-header" onclick={toggle}>
|
|
26
|
+
<h3 class="CollapsiblePanel-title">{title}</h3>
|
|
27
|
+
<span class="CollapsiblePanel-icon" class:open>
|
|
28
|
+
<ChevronRight size={14} strokeWidth={2} />
|
|
29
|
+
</span>
|
|
30
|
+
</button>
|
|
31
|
+
{/if}
|
|
32
|
+
{#if open && children}
|
|
33
|
+
<div class="CollapsiblePanel-content" class:no_content_padding>
|
|
34
|
+
{@render children()}
|
|
35
|
+
</div>
|
|
36
|
+
{/if}
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<style>
|
|
40
|
+
.CollapsiblePanel {
|
|
41
|
+
/* background: var(--color-bg-elevated); */
|
|
42
|
+
background: var(--base-100);
|
|
43
|
+
width: 100%;
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
gap: 1px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.CollapsiblePanel-header {
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
justify-content: space-between;
|
|
53
|
+
width: 100%;
|
|
54
|
+
padding: 8px 16px;
|
|
55
|
+
background: var(--base-50);
|
|
56
|
+
border: none;
|
|
57
|
+
cursor: pointer;
|
|
58
|
+
transition: background 0.15s ease;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.CollapsiblePanel-header:hover {
|
|
62
|
+
background: var(--color-bg-hover);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.CollapsiblePanel-title {
|
|
66
|
+
margin: 0;
|
|
67
|
+
font-size: 11px;
|
|
68
|
+
font-weight: 600;
|
|
69
|
+
text-transform: uppercase;
|
|
70
|
+
letter-spacing: 0.08em;
|
|
71
|
+
color: var(--base-500);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.CollapsiblePanel-icon {
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
color: var(--color-text-muted);
|
|
78
|
+
transition: transform 0.15s ease;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.CollapsiblePanel-icon.open {
|
|
82
|
+
transform: rotate(90deg);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.CollapsiblePanel-content {
|
|
86
|
+
background: var(--base-0);
|
|
87
|
+
padding: 16px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.CollapsiblePanel-content.no_content_padding {
|
|
91
|
+
padding: 0;
|
|
92
|
+
}
|
|
93
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
/** Title displayed in header */
|
|
4
|
+
title?: string;
|
|
5
|
+
/** Whether the panel is open */
|
|
6
|
+
open?: boolean;
|
|
7
|
+
/** Remove content padding */
|
|
8
|
+
no_content_padding?: boolean;
|
|
9
|
+
/** Panel content */
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
}
|
|
12
|
+
declare const CollapsiblePanel: import("svelte").Component<Props, {}, "open">;
|
|
13
|
+
type CollapsiblePanel = ReturnType<typeof CollapsiblePanel>;
|
|
14
|
+
export default CollapsiblePanel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CollapsiblePanel } from './CollapsiblePanel.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CollapsiblePanel } from './CollapsiblePanel.svelte';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import Placeholder from './Placeholder.svelte';
|
|
3
|
+
import type { DocMeta } from '../../types.js';
|
|
4
|
+
|
|
5
|
+
export const meta: DocMeta = {
|
|
6
|
+
title: 'Placeholder',
|
|
7
|
+
component: Placeholder,
|
|
8
|
+
args: {
|
|
9
|
+
text: 'Placeholder',
|
|
10
|
+
radius: 0,
|
|
11
|
+
color: 'pink',
|
|
12
|
+
width: '200px',
|
|
13
|
+
height: '100px'
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
let bangRef: Placeholder;
|
|
18
|
+
|
|
19
|
+
export { Default, Colors, InLayout, Bang };
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
{#snippet Default(args: any)}
|
|
23
|
+
<Placeholder {...args} />
|
|
24
|
+
{/snippet}
|
|
25
|
+
|
|
26
|
+
{#snippet Colors()}
|
|
27
|
+
<div style="display: flex; gap: 16px;">
|
|
28
|
+
<Placeholder text="Pink" color="pink" width="120px" height="80px" />
|
|
29
|
+
<Placeholder text="Green" color="green" width="120px" height="80px" />
|
|
30
|
+
<Placeholder text="Blue" color="blue" width="120px" height="80px" />
|
|
31
|
+
</div>
|
|
32
|
+
{/snippet}
|
|
33
|
+
|
|
34
|
+
{#snippet InLayout()}
|
|
35
|
+
<div style="display: flex; flex-direction: column; gap: 8px; width: 300px; height: 200px;">
|
|
36
|
+
<Placeholder text="Header" color="blue" height="40px" />
|
|
37
|
+
<div style="display: flex; gap: 8px; flex: 1;">
|
|
38
|
+
<Placeholder text="Nav" color="green" width="80px" />
|
|
39
|
+
<Placeholder text="Main" color="pink" />
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
{/snippet}
|
|
43
|
+
|
|
44
|
+
{#snippet Bang()}
|
|
45
|
+
<div style="display: flex; align-items: center; gap: 12px;">
|
|
46
|
+
<Placeholder bind:this={bangRef} text="Click the button" width="200px" height="80px" />
|
|
47
|
+
<button style="height: 32px; padding: 0 12px; font-family: var(--font-sans); font-size: 13px; font-weight: 500; background: var(--base-800); color: var(--base-50); border: none; border-radius: 6px; cursor: pointer; white-space: nowrap;" onclick={() => bangRef?.bang()}>bang()</button>
|
|
48
|
+
</div>
|
|
49
|
+
{/snippet}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Placeholder from './Placeholder.svelte';
|
|
2
|
+
import type { DocMeta } from '../../types.js';
|
|
3
|
+
declare const Default: (args: any) => ReturnType<import("svelte").Snippet>;
|
|
4
|
+
declare const Colors: () => ReturnType<import("svelte").Snippet>;
|
|
5
|
+
declare const InLayout: () => ReturnType<import("svelte").Snippet>;
|
|
6
|
+
declare const Bang: () => ReturnType<import("svelte").Snippet>;
|
|
7
|
+
export declare const meta: DocMeta;
|
|
8
|
+
export { Default, Colors, InLayout, Bang };
|
|
9
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
10
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
11
|
+
$$bindings?: Bindings;
|
|
12
|
+
} & Exports;
|
|
13
|
+
(internal: unknown, props: {
|
|
14
|
+
$$events?: Events;
|
|
15
|
+
$$slots?: Slots;
|
|
16
|
+
}): Exports & {
|
|
17
|
+
$set?: any;
|
|
18
|
+
$on?: any;
|
|
19
|
+
};
|
|
20
|
+
z_$$bindings?: Bindings;
|
|
21
|
+
}
|
|
22
|
+
declare const Placeholder: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
23
|
+
[evt: string]: CustomEvent<any>;
|
|
24
|
+
}, {}, {}, string>;
|
|
25
|
+
type Placeholder = InstanceType<typeof Placeholder>;
|
|
26
|
+
export default Placeholder;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* A Placeholder rectangle for visualizing layouts and empty spaces.
|
|
4
|
+
* Call `run()` to trigger a flash animation (useful for testing function props).
|
|
5
|
+
*/
|
|
6
|
+
interface Props {
|
|
7
|
+
/** Text to display inside the Placeholder */
|
|
8
|
+
text?: string;
|
|
9
|
+
/** Border radius in pixels */
|
|
10
|
+
radius?: number;
|
|
11
|
+
/** Color variant */
|
|
12
|
+
color?: 'pink' | 'green' | 'blue';
|
|
13
|
+
/** Width (any CSS dimension) */
|
|
14
|
+
width?: string;
|
|
15
|
+
/** Height (any CSS dimension) */
|
|
16
|
+
height?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let { text, radius = 0, color = 'pink', width = '100%', height = '100%' }: Props = $props();
|
|
20
|
+
|
|
21
|
+
let flashing = $state(false);
|
|
22
|
+
let flashTimeout: ReturnType<typeof setTimeout>;
|
|
23
|
+
|
|
24
|
+
export function bang() {
|
|
25
|
+
clearTimeout(flashTimeout);
|
|
26
|
+
flashing = true;
|
|
27
|
+
flashTimeout = setTimeout(() => {
|
|
28
|
+
flashing = false;
|
|
29
|
+
}, 400);
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<div class="Placeholder {color}" class:flashing style:border-radius="{radius}px" style:width style:height>
|
|
34
|
+
{#if text}
|
|
35
|
+
<span class="Placeholder-text">{text}</span>
|
|
36
|
+
{/if}
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<style>
|
|
40
|
+
.Placeholder {
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
transition: opacity 0.3s ease;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.Placeholder.flashing {
|
|
48
|
+
opacity: 0.4;
|
|
49
|
+
transition: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.Placeholder.pink {
|
|
53
|
+
background: repeating-linear-gradient(
|
|
54
|
+
-45deg,
|
|
55
|
+
var(--pink-100),
|
|
56
|
+
var(--pink-100) 8px,
|
|
57
|
+
var(--pink-200) 8px,
|
|
58
|
+
var(--pink-200) 12px
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.Placeholder.pink .Placeholder-text {
|
|
63
|
+
color: var(--pink-500);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.Placeholder.green {
|
|
67
|
+
background: repeating-linear-gradient(
|
|
68
|
+
-45deg,
|
|
69
|
+
var(--success-100),
|
|
70
|
+
var(--success-100) 8px,
|
|
71
|
+
var(--success-200) 8px,
|
|
72
|
+
var(--success-200) 12px
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.Placeholder.green .Placeholder-text {
|
|
77
|
+
color: var(--success-500);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.Placeholder.blue {
|
|
81
|
+
background: repeating-linear-gradient(
|
|
82
|
+
-45deg,
|
|
83
|
+
var(--sky-100),
|
|
84
|
+
var(--sky-100) 8px,
|
|
85
|
+
var(--sky-200) 8px,
|
|
86
|
+
var(--sky-200) 12px
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.Placeholder.blue .Placeholder-text {
|
|
91
|
+
color: var(--sky-500);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.Placeholder-text {
|
|
95
|
+
font-family: var(--font-sans);
|
|
96
|
+
font-size: 12px;
|
|
97
|
+
font-weight: 500;
|
|
98
|
+
}
|
|
99
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Placeholder rectangle for visualizing layouts and empty spaces.
|
|
3
|
+
* Call `run()` to trigger a flash animation (useful for testing function props).
|
|
4
|
+
*/
|
|
5
|
+
interface Props {
|
|
6
|
+
/** Text to display inside the Placeholder */
|
|
7
|
+
text?: string;
|
|
8
|
+
/** Border radius in pixels */
|
|
9
|
+
radius?: number;
|
|
10
|
+
/** Color variant */
|
|
11
|
+
color?: 'pink' | 'green' | 'blue';
|
|
12
|
+
/** Width (any CSS dimension) */
|
|
13
|
+
width?: string;
|
|
14
|
+
/** Height (any CSS dimension) */
|
|
15
|
+
height?: string;
|
|
16
|
+
}
|
|
17
|
+
declare const Placeholder: import("svelte").Component<Props, {
|
|
18
|
+
bang: () => void;
|
|
19
|
+
}, "">;
|
|
20
|
+
type Placeholder = ReturnType<typeof Placeholder>;
|
|
21
|
+
export default Placeholder;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Placeholder } from './Placeholder.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Placeholder } from './Placeholder.svelte';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import Radio from './Radio.svelte';
|
|
3
|
+
import type { DocMeta } from '../../types.js';
|
|
4
|
+
|
|
5
|
+
export const meta: DocMeta = {
|
|
6
|
+
title: 'Radio',
|
|
7
|
+
component: Radio,
|
|
8
|
+
args: {
|
|
9
|
+
value: 'option1',
|
|
10
|
+
label: 'Select this option',
|
|
11
|
+
checked: false,
|
|
12
|
+
size: 'm',
|
|
13
|
+
disabled: false
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { Default, Sizes, GroupedByName, WithoutLabel, Disabled };
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
{#snippet Default(args: any)}
|
|
21
|
+
<Radio {...args} />
|
|
22
|
+
{/snippet}
|
|
23
|
+
|
|
24
|
+
{#snippet Sizes()}
|
|
25
|
+
<div style="display: flex; gap: 24px; align-items: center;">
|
|
26
|
+
<Radio name="sizes" value="xs" label="Extra small" size="xs" />
|
|
27
|
+
<Radio name="sizes" value="s" label="Small" size="s" />
|
|
28
|
+
<Radio name="sizes" value="m" label="Medium" size="m" checked />
|
|
29
|
+
<Radio name="sizes" value="l" label="Large" size="l" />
|
|
30
|
+
</div>
|
|
31
|
+
{/snippet}
|
|
32
|
+
|
|
33
|
+
{#snippet GroupedByName()}
|
|
34
|
+
<div style="display: flex; gap: 48px;">
|
|
35
|
+
<div>
|
|
36
|
+
<p style="margin: 0 0 12px; font-size: 13px; font-weight: 500;">Favorite fruit</p>
|
|
37
|
+
<div style="display: flex; flex-direction: column; gap: 10px;">
|
|
38
|
+
<Radio name="fruit" value="apple" label="Apple" checked />
|
|
39
|
+
<Radio name="fruit" value="banana" label="Banana" />
|
|
40
|
+
<Radio name="fruit" value="cherry" label="Cherry" />
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
<div>
|
|
44
|
+
<p style="margin: 0 0 12px; font-size: 13px; font-weight: 500;">Favorite color</p>
|
|
45
|
+
<div style="display: flex; flex-direction: column; gap: 10px;">
|
|
46
|
+
<Radio name="color" value="red" label="Red" />
|
|
47
|
+
<Radio name="color" value="blue" label="Blue" checked />
|
|
48
|
+
<Radio name="color" value="green" label="Green" />
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
{/snippet}
|
|
53
|
+
|
|
54
|
+
{#snippet WithoutLabel()}
|
|
55
|
+
<div style="display: flex; gap: 16px;">
|
|
56
|
+
<Radio name="nolabel" value="1" size="m" />
|
|
57
|
+
<Radio name="nolabel" value="2" size="m" checked />
|
|
58
|
+
<Radio name="nolabel" value="3" size="m" />
|
|
59
|
+
</div>
|
|
60
|
+
{/snippet}
|
|
61
|
+
|
|
62
|
+
{#snippet Disabled()}
|
|
63
|
+
<div style="display: flex; flex-direction: column; gap: 10px;">
|
|
64
|
+
<Radio name="disabled-demo" value="1" label="Disabled unchecked" disabled />
|
|
65
|
+
<Radio name="disabled-demo" value="2" label="Disabled checked" checked disabled />
|
|
66
|
+
</div>
|
|
67
|
+
{/snippet}
|