intelliwaketssveltekitv25 1.0.81 → 1.0.83
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/INTEGRATION.md +574 -0
- package/README.md +199 -45
- package/dist/ArrayTable.stories.js +215 -0
- package/dist/ArrayTable.svelte +46 -0
- package/dist/ArrayTable.svelte.d.ts +44 -0
- package/dist/DropDown.stories.d.ts +96 -0
- package/dist/DropDown.stories.js +192 -0
- package/dist/DropDown.svelte +32 -0
- package/dist/DropDown.svelte.d.ts +30 -0
- package/dist/InputNumber.stories.d.ts +122 -0
- package/dist/InputNumber.stories.js +186 -0
- package/dist/InputNumber.svelte +52 -0
- package/dist/InputNumber.svelte.d.ts +27 -0
- package/dist/Modal.stories.d.ts +114 -0
- package/dist/Modal.stories.js +139 -0
- package/dist/Modal.svelte +34 -3
- package/dist/Modal.svelte.d.ts +35 -3
- package/dist/MultiSelect.stories.js +338 -0
- package/dist/MultiSelect.svelte +81 -0
- package/dist/MultiSelect.svelte.d.ts +38 -0
- package/dist/Switch.stories.d.ts +81 -0
- package/dist/Switch.stories.js +99 -0
- package/dist/Switch.svelte +40 -0
- package/dist/Switch.svelte.d.ts +26 -0
- package/dist/TextArea.stories.d.ts +180 -0
- package/dist/TextArea.stories.js +216 -0
- package/dist/TextArea.svelte +32 -0
- package/dist/TextArea.svelte.d.ts +24 -0
- package/dist/app.css +1 -1
- package/docs/DateRangePicker.md +272 -0
- package/docs/DisplayHTML.md +249 -0
- package/docs/DropDown.md +269 -0
- package/docs/Functions.md +796 -0
- package/docs/Home.md +109 -0
- package/docs/Icon.md +203 -0
- package/docs/Importer.md +328 -0
- package/docs/ImporterAnalysis.md +249 -0
- package/docs/ImporterLoad.md +288 -0
- package/docs/InputNumber.md +159 -0
- package/docs/Integration.md +215 -0
- package/docs/Modal.md +207 -0
- package/docs/MultiSelect.md +304 -0
- package/docs/Paginator.md +332 -0
- package/docs/Search.md +364 -0
- package/docs/SlideDown.md +358 -0
- package/docs/Svelte-5-Patterns.md +364 -0
- package/docs/Switch.md +107 -0
- package/docs/TabHeader.md +333 -0
- package/docs/TabHref.md +370 -0
- package/docs/TextArea.md +118 -0
- package/docs/_Sidebar.md +38 -0
- package/llms.txt +113 -0
- package/package.json +7 -2
package/dist/MultiSelect.svelte
CHANGED
|
@@ -1,3 +1,43 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
Type-safe, searchable multi-select dropdown with dynamic item creation and keyboard navigation.
|
|
4
|
+
Replaces native <select multiple> with advanced features.
|
|
5
|
+
|
|
6
|
+
@example
|
|
7
|
+
```svelte
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { MultiSelect } from 'intelliwaketssveltekitv25';
|
|
10
|
+
|
|
11
|
+
interface Tag {
|
|
12
|
+
id: number;
|
|
13
|
+
name: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const tags: Tag[] = [
|
|
17
|
+
{ id: 1, name: 'JavaScript' },
|
|
18
|
+
{ id: 2, name: 'TypeScript' }
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
let selected = $state<Tag[]>([]);
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<MultiSelect possibles={tags} bind:selected={selected} placeholder="Select tags..." />
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
@remarks
|
|
28
|
+
- Uses TypeScript generics for type-safe selections: <T extends TGenericMultiSelect>
|
|
29
|
+
- Svelte 5 $bindable runes for two-way binding (selected, selectedIDs, created, existing)
|
|
30
|
+
- Keyboard navigation: Arrow keys, Enter, Backspace
|
|
31
|
+
- Searchable with automatic filtering
|
|
32
|
+
- Dynamic item creation with validation
|
|
33
|
+
- Supports single-select mode (isMulti=false)
|
|
34
|
+
- Custom display and ID functions for flexible data structures
|
|
35
|
+
- Grouping/headers support via headerValue function
|
|
36
|
+
|
|
37
|
+
@see DropDown - For single action/selection without search
|
|
38
|
+
@see DropDownControl - Lower-level dropdown control (used internally)
|
|
39
|
+
-->
|
|
40
|
+
|
|
1
41
|
<!--suppress JSDeprecatedSymbols -->
|
|
2
42
|
<script lang='ts' generics="T extends TGenericMultiSelect">
|
|
3
43
|
import { DeepEqual, SearchRows } from '@solidbasisventures/intelliwaketsfoundation'
|
|
@@ -8,46 +48,87 @@
|
|
|
8
48
|
import { type ActionArray, useActions } from './useActions'
|
|
9
49
|
|
|
10
50
|
let {
|
|
51
|
+
/** HTML id attribute for the input element */
|
|
11
52
|
id = undefined,
|
|
53
|
+
/** Controls dropdown visibility (two-way bindable) */
|
|
12
54
|
show = $bindable(false),
|
|
55
|
+
/** Svelte actions array */
|
|
13
56
|
use = [],
|
|
57
|
+
/** Array of all available items to select from */
|
|
14
58
|
possibles,
|
|
59
|
+
/** Currently selected items (two-way bindable) */
|
|
15
60
|
selected = $bindable([]),
|
|
61
|
+
/** IDs of selected items (two-way bindable, alternative to selected) */
|
|
16
62
|
selectedIDs = $bindable(undefined),
|
|
63
|
+
/** Newly created items (two-way bindable, subset of selected that don't exist in possibles) */
|
|
17
64
|
created = $bindable([]),
|
|
65
|
+
/** Existing items (two-way bindable, subset of selected that exist in possibles) */
|
|
18
66
|
existing = $bindable([]),
|
|
67
|
+
/** Form input name for hidden inputs (enables form submission) */
|
|
19
68
|
name = null,
|
|
69
|
+
/** Placeholder text shown when no items selected */
|
|
20
70
|
placeholder = '',
|
|
71
|
+
/** Disable user interaction */
|
|
21
72
|
disabled = false,
|
|
73
|
+
/** Display in readonly mode (no interaction allowed) */
|
|
22
74
|
readonly = false,
|
|
75
|
+
/** Mark as required (shows invalid state if empty) */
|
|
23
76
|
required = false,
|
|
77
|
+
/** Mark as invalid (shows error styling) */
|
|
24
78
|
invalid = false,
|
|
79
|
+
/** Allow multiple selections (false = single-select mode) */
|
|
25
80
|
isMulti = true,
|
|
81
|
+
/** Show clear all button when items are selected */
|
|
26
82
|
allowClearAll = true,
|
|
83
|
+
/** Text prefix shown before new item name in create option */
|
|
27
84
|
createPrefix = 'Create:',
|
|
85
|
+
/** Function to create new items from search string (enables dynamic creation) */
|
|
28
86
|
create = undefined,
|
|
87
|
+
/** Validation function for new items (returns true or error message string) */
|
|
29
88
|
createValid = undefined,
|
|
89
|
+
/** Tab index for keyboard navigation */
|
|
30
90
|
tabindex = 0,
|
|
91
|
+
/** Function to extract display text from item */
|
|
31
92
|
displayValue = (item: T) => item.name ?? item.id ?? '',
|
|
93
|
+
/** Function to extract unique identifier from item */
|
|
32
94
|
idValue = (item: T) => item.id ?? displayValue(item),
|
|
95
|
+
/** Function to compute key for each statements (defaults to idValue) */
|
|
33
96
|
keyValue = (item: T) => idValue(item),
|
|
97
|
+
/** Function to compute value for hidden form inputs */
|
|
34
98
|
inputValue = (item: T) => idValue(item),
|
|
99
|
+
/** Function to extract header/group text from item (for grouping) */
|
|
35
100
|
headerValue = (item: T | null | undefined) => item?.header,
|
|
101
|
+
/** Match dropdown width to toggle button width */
|
|
36
102
|
sameSize = true,
|
|
103
|
+
/** Timestamp to trigger dropdown resize recalculation */
|
|
37
104
|
resizeTS = 1,
|
|
105
|
+
/** Auto-focus input on mount */
|
|
38
106
|
autoFocus = false,
|
|
107
|
+
/** Z-index for dropdown positioning */
|
|
39
108
|
zIndex = 50,
|
|
109
|
+
/** Additional CSS classes for dropdown body */
|
|
40
110
|
bodyClass = '',
|
|
111
|
+
/** Additional CSS classes for toggle button */
|
|
41
112
|
toggleClass = '',
|
|
113
|
+
/** Additional CSS classes for dropdown control wrapper */
|
|
42
114
|
controlClass = '',
|
|
115
|
+
/** Additional CSS classes for search input */
|
|
43
116
|
inputClass = '',
|
|
117
|
+
/** Parent div element reference (for focus management) */
|
|
44
118
|
parentDivElement = null,
|
|
119
|
+
/** Associate with a form by ID */
|
|
45
120
|
form = undefined,
|
|
121
|
+
/** Callback when item is added (passes item ID) */
|
|
46
122
|
onadd,
|
|
123
|
+
/** Callback when existing item is selected (passes item ID) */
|
|
47
124
|
onselect,
|
|
125
|
+
/** Callback when new item is created (passes item ID) */
|
|
48
126
|
oncreate,
|
|
127
|
+
/** Callback when selection changes (passes array of selected items) */
|
|
49
128
|
onchange,
|
|
129
|
+
/** Callback when item is cleared (passes item ID) */
|
|
50
130
|
onclear,
|
|
131
|
+
/** Callback when all items are cleared */
|
|
51
132
|
onclearall
|
|
52
133
|
}: {
|
|
53
134
|
id?: string
|
|
@@ -64,6 +64,44 @@ interface $$IsomorphicComponent {
|
|
|
64
64
|
<T extends TGenericMultiSelect>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
65
65
|
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
66
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Type-safe, searchable multi-select dropdown with dynamic item creation and keyboard navigation.
|
|
69
|
+
* Replaces native <select multiple> with advanced features.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```svelte
|
|
73
|
+
* <script lang="ts">
|
|
74
|
+
* import { MultiSelect } from 'intelliwaketssveltekitv25';
|
|
75
|
+
*
|
|
76
|
+
* interface Tag {
|
|
77
|
+
* id: number;
|
|
78
|
+
* name: string;
|
|
79
|
+
* }
|
|
80
|
+
*
|
|
81
|
+
* const tags: Tag[] = [
|
|
82
|
+
* { id: 1, name: 'JavaScript' },
|
|
83
|
+
* { id: 2, name: 'TypeScript' }
|
|
84
|
+
* ];
|
|
85
|
+
*
|
|
86
|
+
* let selected = $state<Tag[]>([]);
|
|
87
|
+
* </script>
|
|
88
|
+
*
|
|
89
|
+
* <MultiSelect possibles={tags} bind:selected={selected} placeholder="Select tags..." />
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @remarks
|
|
93
|
+
* - Uses TypeScript generics for type-safe selections: <T extends TGenericMultiSelect>
|
|
94
|
+
* - Svelte 5 $bindable runes for two-way binding (selected, selectedIDs, created, existing)
|
|
95
|
+
* - Keyboard navigation: Arrow keys, Enter, Backspace
|
|
96
|
+
* - Searchable with automatic filtering
|
|
97
|
+
* - Dynamic item creation with validation
|
|
98
|
+
* - Supports single-select mode (isMulti=false)
|
|
99
|
+
* - Custom display and ID functions for flexible data structures
|
|
100
|
+
* - Grouping/headers support via headerValue function
|
|
101
|
+
*
|
|
102
|
+
* @see DropDown - For single action/selection without search
|
|
103
|
+
* @see DropDownControl - Lower-level dropdown control (used internally)
|
|
104
|
+
*/
|
|
67
105
|
declare const MultiSelect: $$IsomorphicComponent;
|
|
68
106
|
type MultiSelect<T extends TGenericMultiSelect> = InstanceType<typeof MultiSelect<T>>;
|
|
69
107
|
export default MultiSelect;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/svelte';
|
|
2
|
+
type SwitchProps = {
|
|
3
|
+
checked?: boolean;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
readonly?: boolean;
|
|
6
|
+
name?: string;
|
|
7
|
+
value?: unknown;
|
|
8
|
+
offValue?: unknown;
|
|
9
|
+
displayCheckInverse?: boolean;
|
|
10
|
+
hidden?: boolean;
|
|
11
|
+
class?: string;
|
|
12
|
+
};
|
|
13
|
+
declare const meta: {
|
|
14
|
+
title: string;
|
|
15
|
+
component: import("svelte").Component<{
|
|
16
|
+
id?: string | undefined;
|
|
17
|
+
use?: import("./useActions").ActionArray;
|
|
18
|
+
checked?: boolean;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
readonly?: boolean;
|
|
21
|
+
name?: string | undefined;
|
|
22
|
+
form?: string | undefined;
|
|
23
|
+
value?: unknown | undefined;
|
|
24
|
+
offValue?: unknown | undefined;
|
|
25
|
+
hidden?: boolean;
|
|
26
|
+
displayCheckInverse?: boolean;
|
|
27
|
+
class?: string;
|
|
28
|
+
oncheck?: (val: boolean) => void;
|
|
29
|
+
children?: import("svelte").Snippet;
|
|
30
|
+
}, {}, "checked">;
|
|
31
|
+
tags: string[];
|
|
32
|
+
argTypes: {
|
|
33
|
+
checked: {
|
|
34
|
+
control: "boolean";
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
disabled: {
|
|
38
|
+
control: "boolean";
|
|
39
|
+
description: string;
|
|
40
|
+
};
|
|
41
|
+
readonly: {
|
|
42
|
+
control: "boolean";
|
|
43
|
+
description: string;
|
|
44
|
+
};
|
|
45
|
+
name: {
|
|
46
|
+
control: "text";
|
|
47
|
+
description: string;
|
|
48
|
+
};
|
|
49
|
+
value: {
|
|
50
|
+
control: "text";
|
|
51
|
+
description: string;
|
|
52
|
+
};
|
|
53
|
+
offValue: {
|
|
54
|
+
control: "text";
|
|
55
|
+
description: string;
|
|
56
|
+
};
|
|
57
|
+
displayCheckInverse: {
|
|
58
|
+
control: "boolean";
|
|
59
|
+
description: string;
|
|
60
|
+
};
|
|
61
|
+
hidden: {
|
|
62
|
+
control: "boolean";
|
|
63
|
+
description: string;
|
|
64
|
+
};
|
|
65
|
+
class: {
|
|
66
|
+
control: "text";
|
|
67
|
+
description: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
export default meta;
|
|
72
|
+
type Story = StoryObj<SwitchProps>;
|
|
73
|
+
export declare const Default: Story;
|
|
74
|
+
export declare const Checked: Story;
|
|
75
|
+
export declare const Disabled: Story;
|
|
76
|
+
export declare const DisabledChecked: Story;
|
|
77
|
+
export declare const Readonly: Story;
|
|
78
|
+
export declare const WithFormName: Story;
|
|
79
|
+
export declare const WithCustomValues: Story;
|
|
80
|
+
export declare const DisplayInverse: Story;
|
|
81
|
+
export declare const DisplayInverseChecked: Story;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import Switch from './Switch.svelte';
|
|
2
|
+
const meta = {
|
|
3
|
+
title: 'Components/Switch',
|
|
4
|
+
component: Switch,
|
|
5
|
+
tags: ['autodocs'],
|
|
6
|
+
argTypes: {
|
|
7
|
+
checked: {
|
|
8
|
+
control: 'boolean',
|
|
9
|
+
description: 'Current checked state (two-way bindable)'
|
|
10
|
+
},
|
|
11
|
+
disabled: {
|
|
12
|
+
control: 'boolean',
|
|
13
|
+
description: 'Disables user interaction'
|
|
14
|
+
},
|
|
15
|
+
readonly: {
|
|
16
|
+
control: 'boolean',
|
|
17
|
+
description: 'Visual display only, no interaction'
|
|
18
|
+
},
|
|
19
|
+
name: {
|
|
20
|
+
control: 'text',
|
|
21
|
+
description: 'Form field name for submissions'
|
|
22
|
+
},
|
|
23
|
+
value: {
|
|
24
|
+
control: 'text',
|
|
25
|
+
description: 'Value to submit when checked'
|
|
26
|
+
},
|
|
27
|
+
offValue: {
|
|
28
|
+
control: 'text',
|
|
29
|
+
description: 'Value to submit when unchecked'
|
|
30
|
+
},
|
|
31
|
+
displayCheckInverse: {
|
|
32
|
+
control: 'boolean',
|
|
33
|
+
description: 'Invert visual display (useful for "disabled" semantics)'
|
|
34
|
+
},
|
|
35
|
+
hidden: {
|
|
36
|
+
control: 'boolean',
|
|
37
|
+
description: 'Hide the component'
|
|
38
|
+
},
|
|
39
|
+
class: {
|
|
40
|
+
control: 'text',
|
|
41
|
+
description: 'Additional CSS classes'
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
export default meta;
|
|
46
|
+
export const Default = {
|
|
47
|
+
args: {
|
|
48
|
+
checked: false
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
export const Checked = {
|
|
52
|
+
args: {
|
|
53
|
+
checked: true
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
export const Disabled = {
|
|
57
|
+
args: {
|
|
58
|
+
checked: false,
|
|
59
|
+
disabled: true
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
export const DisabledChecked = {
|
|
63
|
+
args: {
|
|
64
|
+
checked: true,
|
|
65
|
+
disabled: true
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
export const Readonly = {
|
|
69
|
+
args: {
|
|
70
|
+
checked: true,
|
|
71
|
+
readonly: true
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
export const WithFormName = {
|
|
75
|
+
args: {
|
|
76
|
+
checked: true,
|
|
77
|
+
name: 'agreeToTerms'
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
export const WithCustomValues = {
|
|
81
|
+
args: {
|
|
82
|
+
checked: true,
|
|
83
|
+
name: 'subscription',
|
|
84
|
+
value: 'premium',
|
|
85
|
+
offValue: 'free'
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
export const DisplayInverse = {
|
|
89
|
+
args: {
|
|
90
|
+
checked: false,
|
|
91
|
+
displayCheckInverse: true
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
export const DisplayInverseChecked = {
|
|
95
|
+
args: {
|
|
96
|
+
checked: true,
|
|
97
|
+
displayCheckInverse: true
|
|
98
|
+
}
|
|
99
|
+
};
|
package/dist/Switch.svelte
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
Custom styled toggle switch with smooth animations and accessibility features.
|
|
4
|
+
Replaces native <input type="checkbox"> for boolean on/off controls.
|
|
5
|
+
|
|
6
|
+
@example
|
|
7
|
+
```svelte
|
|
8
|
+
<script>
|
|
9
|
+
import { Switch } from 'intelliwaketssveltekitv25';
|
|
10
|
+
let enabled = $state(false);
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<Switch bind:checked={enabled}>
|
|
14
|
+
Enable Notifications
|
|
15
|
+
</Switch>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
@remarks
|
|
19
|
+
- Uses Svelte 5 $bindable rune for two-way binding of checked state
|
|
20
|
+
- Supports keyboard interaction (Space key to toggle)
|
|
21
|
+
- Includes visual inversion option via displayCheckInverse
|
|
22
|
+
- Dispatches change and input events for form integration
|
|
23
|
+
- Print-friendly with fallback to checkmark/square symbols
|
|
24
|
+
|
|
25
|
+
@see CheckBox - For custom checkbox styling (not toggle appearance)
|
|
26
|
+
@see SwitchDateNull - Toggle that sets/clears a date value
|
|
27
|
+
-->
|
|
28
|
+
|
|
1
29
|
<script lang='ts'>
|
|
2
30
|
import { type Snippet, tick } from 'svelte'
|
|
3
31
|
import { type ActionArray, useActions } from './useActions'
|
|
@@ -5,18 +33,30 @@
|
|
|
5
33
|
let {
|
|
6
34
|
id = undefined,
|
|
7
35
|
use = [],
|
|
36
|
+
/** Current checked state (two-way bindable) */
|
|
8
37
|
checked = $bindable(false),
|
|
38
|
+
/** Disable user interaction */
|
|
9
39
|
disabled = false,
|
|
40
|
+
/** Visual display only, no interaction */
|
|
10
41
|
readonly = false,
|
|
42
|
+
/** Form field name for submissions */
|
|
11
43
|
name = undefined,
|
|
44
|
+
/** Associate with a specific form by ID */
|
|
12
45
|
form = undefined,
|
|
46
|
+
/** Value to submit when checked */
|
|
13
47
|
value = undefined,
|
|
48
|
+
/** Value to submit when unchecked (internal default) */
|
|
14
49
|
offValue = 'ZZZnoneZZZ',
|
|
50
|
+
/** Hide the component */
|
|
15
51
|
hidden = false,
|
|
52
|
+
/** Invert visual display (useful for "disabled" semantics) */
|
|
16
53
|
displayCheckInverse = false,
|
|
54
|
+
/** Additional CSS classes */
|
|
17
55
|
class: clazz = '',
|
|
56
|
+
/** Callback fired when checked state changes */
|
|
18
57
|
oncheck = () => {
|
|
19
58
|
},
|
|
59
|
+
/** Label content displayed next to switch */
|
|
20
60
|
children
|
|
21
61
|
}: {
|
|
22
62
|
id?: string | undefined
|
package/dist/Switch.svelte.d.ts
CHANGED
|
@@ -16,6 +16,32 @@ type $$ComponentProps = {
|
|
|
16
16
|
oncheck?: (val: boolean) => void;
|
|
17
17
|
children?: Snippet;
|
|
18
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* Custom styled toggle switch with smooth animations and accessibility features.
|
|
21
|
+
* Replaces native <input type="checkbox"> for boolean on/off controls.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```svelte
|
|
25
|
+
* <script>
|
|
26
|
+
* import { Switch } from 'intelliwaketssveltekitv25';
|
|
27
|
+
* let enabled = $state(false);
|
|
28
|
+
* </script>
|
|
29
|
+
*
|
|
30
|
+
* <Switch bind:checked={enabled}>
|
|
31
|
+
* Enable Notifications
|
|
32
|
+
* </Switch>
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* - Uses Svelte 5 $bindable rune for two-way binding of checked state
|
|
37
|
+
* - Supports keyboard interaction (Space key to toggle)
|
|
38
|
+
* - Includes visual inversion option via displayCheckInverse
|
|
39
|
+
* - Dispatches change and input events for form integration
|
|
40
|
+
* - Print-friendly with fallback to checkmark/square symbols
|
|
41
|
+
*
|
|
42
|
+
* @see CheckBox - For custom checkbox styling (not toggle appearance)
|
|
43
|
+
* @see SwitchDateNull - Toggle that sets/clears a date value
|
|
44
|
+
*/
|
|
19
45
|
declare const Switch: import("svelte").Component<$$ComponentProps, {}, "checked">;
|
|
20
46
|
type Switch = ReturnType<typeof Switch>;
|
|
21
47
|
export default Switch;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/svelte';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: import("svelte").Component<Omit<import("svelte/elements").HTMLTextareaAttributes, "value" | "use" | "this"> & {
|
|
5
|
+
value: string | null;
|
|
6
|
+
onkeydown?: (e: KeyboardEvent) => void;
|
|
7
|
+
propagateEnter?: boolean;
|
|
8
|
+
use?: import("./useActions").ActionArray;
|
|
9
|
+
}, {}, "value">;
|
|
10
|
+
tags: string[];
|
|
11
|
+
argTypes: {
|
|
12
|
+
value: {
|
|
13
|
+
control: string;
|
|
14
|
+
description: string;
|
|
15
|
+
table: {
|
|
16
|
+
type: {
|
|
17
|
+
summary: string;
|
|
18
|
+
};
|
|
19
|
+
defaultValue: {
|
|
20
|
+
summary: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
readonly: {
|
|
25
|
+
control: string;
|
|
26
|
+
description: string;
|
|
27
|
+
table: {
|
|
28
|
+
type: {
|
|
29
|
+
summary: string;
|
|
30
|
+
};
|
|
31
|
+
defaultValue: {
|
|
32
|
+
summary: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
disabled: {
|
|
37
|
+
control: string;
|
|
38
|
+
description: string;
|
|
39
|
+
table: {
|
|
40
|
+
type: {
|
|
41
|
+
summary: string;
|
|
42
|
+
};
|
|
43
|
+
defaultValue: {
|
|
44
|
+
summary: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
placeholder: {
|
|
49
|
+
control: string;
|
|
50
|
+
description: string;
|
|
51
|
+
table: {
|
|
52
|
+
type: {
|
|
53
|
+
summary: string;
|
|
54
|
+
};
|
|
55
|
+
defaultValue: {
|
|
56
|
+
summary: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
propagateEnter: {
|
|
61
|
+
control: string;
|
|
62
|
+
description: string;
|
|
63
|
+
table: {
|
|
64
|
+
type: {
|
|
65
|
+
summary: string;
|
|
66
|
+
};
|
|
67
|
+
defaultValue: {
|
|
68
|
+
summary: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
rows: {
|
|
73
|
+
control: string;
|
|
74
|
+
description: string;
|
|
75
|
+
table: {
|
|
76
|
+
type: {
|
|
77
|
+
summary: string;
|
|
78
|
+
};
|
|
79
|
+
defaultValue: {
|
|
80
|
+
summary: string;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
maxlength: {
|
|
85
|
+
control: string;
|
|
86
|
+
description: string;
|
|
87
|
+
table: {
|
|
88
|
+
type: {
|
|
89
|
+
summary: string;
|
|
90
|
+
};
|
|
91
|
+
defaultValue: {
|
|
92
|
+
summary: string;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
required: {
|
|
97
|
+
control: string;
|
|
98
|
+
description: string;
|
|
99
|
+
table: {
|
|
100
|
+
type: {
|
|
101
|
+
summary: string;
|
|
102
|
+
};
|
|
103
|
+
defaultValue: {
|
|
104
|
+
summary: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
class: {
|
|
109
|
+
control: string;
|
|
110
|
+
description: string;
|
|
111
|
+
table: {
|
|
112
|
+
type: {
|
|
113
|
+
summary: string;
|
|
114
|
+
};
|
|
115
|
+
defaultValue: {
|
|
116
|
+
summary: string;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
export default meta;
|
|
123
|
+
type Story = StoryObj<typeof meta>;
|
|
124
|
+
/**
|
|
125
|
+
* Default empty textarea with auto-grow enabled.
|
|
126
|
+
*/
|
|
127
|
+
export declare const Default: Story;
|
|
128
|
+
/**
|
|
129
|
+
* Textarea with pre-populated value demonstrating auto-resize.
|
|
130
|
+
*/
|
|
131
|
+
export declare const WithValue: Story;
|
|
132
|
+
/**
|
|
133
|
+
* Textarea with placeholder text.
|
|
134
|
+
*/
|
|
135
|
+
export declare const WithPlaceholder: Story;
|
|
136
|
+
/**
|
|
137
|
+
* Readonly mode displays the text as formatted HTML with line breaks preserved.
|
|
138
|
+
* This is useful for displaying data that should not be edited.
|
|
139
|
+
*/
|
|
140
|
+
export declare const Readonly: Story;
|
|
141
|
+
/**
|
|
142
|
+
* Disabled state prevents user interaction but keeps textarea visible.
|
|
143
|
+
*/
|
|
144
|
+
export declare const Disabled: Story;
|
|
145
|
+
/**
|
|
146
|
+
* Demonstrates auto-grow behavior with long text.
|
|
147
|
+
* The textarea automatically adjusts height to fit content without scrollbars.
|
|
148
|
+
*/
|
|
149
|
+
export declare const LongText: Story;
|
|
150
|
+
/**
|
|
151
|
+
* Character limit with maxlength attribute.
|
|
152
|
+
*/
|
|
153
|
+
export declare const WithMaxLength: Story;
|
|
154
|
+
/**
|
|
155
|
+
* Required field with validation styling.
|
|
156
|
+
*/
|
|
157
|
+
export declare const Required: Story;
|
|
158
|
+
/**
|
|
159
|
+
* Custom styling with Tailwind classes.
|
|
160
|
+
*/
|
|
161
|
+
export declare const CustomStyling: Story;
|
|
162
|
+
/**
|
|
163
|
+
* Textarea with propagateEnter enabled (Enter key will propagate to parent).
|
|
164
|
+
* By default, Enter key is stopped to prevent accidental form submissions.
|
|
165
|
+
*/
|
|
166
|
+
export declare const PropagateEnter: Story;
|
|
167
|
+
/**
|
|
168
|
+
* Form integration example showing how to use TextArea in a form.
|
|
169
|
+
* The textarea will submit with the form using the name attribute.
|
|
170
|
+
*/
|
|
171
|
+
export declare const FormIntegration: Story;
|
|
172
|
+
/**
|
|
173
|
+
* Empty textarea showing placeholder.
|
|
174
|
+
*/
|
|
175
|
+
export declare const Empty: Story;
|
|
176
|
+
/**
|
|
177
|
+
* Initial rows specification (standard HTML attribute).
|
|
178
|
+
* The textarea will start with this height and then auto-grow.
|
|
179
|
+
*/
|
|
180
|
+
export declare const WithInitialRows: Story;
|