intelliwaketssveltekitv25 1.0.80 → 1.0.82

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.
@@ -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
@@ -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;
@@ -0,0 +1,216 @@
1
+ import TextArea from './TextArea.svelte';
2
+ const meta = {
3
+ title: 'Components/TextArea',
4
+ component: TextArea,
5
+ tags: ['autodocs'],
6
+ argTypes: {
7
+ value: {
8
+ control: 'text',
9
+ description: 'Current text value (two-way bindable)',
10
+ table: {
11
+ type: { summary: 'string | null' },
12
+ defaultValue: { summary: 'null' }
13
+ }
14
+ },
15
+ readonly: {
16
+ control: 'boolean',
17
+ description: 'Display as readonly (renders as DisplayHTML instead of textarea)',
18
+ table: {
19
+ type: { summary: 'boolean' },
20
+ defaultValue: { summary: 'false' }
21
+ }
22
+ },
23
+ disabled: {
24
+ control: 'boolean',
25
+ description: 'Disable user interaction',
26
+ table: {
27
+ type: { summary: 'boolean' },
28
+ defaultValue: { summary: 'false' }
29
+ }
30
+ },
31
+ placeholder: {
32
+ control: 'text',
33
+ description: 'Placeholder text shown when empty',
34
+ table: {
35
+ type: { summary: 'string' },
36
+ defaultValue: { summary: '""' }
37
+ }
38
+ },
39
+ propagateEnter: {
40
+ control: 'boolean',
41
+ description: 'Allow Enter key to propagate (useful in forms) - default: false',
42
+ table: {
43
+ type: { summary: 'boolean' },
44
+ defaultValue: { summary: 'false' }
45
+ }
46
+ },
47
+ rows: {
48
+ control: 'number',
49
+ description: 'Initial number of rows (standard HTML attribute)',
50
+ table: {
51
+ type: { summary: 'number' },
52
+ defaultValue: { summary: 'undefined' }
53
+ }
54
+ },
55
+ maxlength: {
56
+ control: 'number',
57
+ description: 'Maximum character length (standard HTML attribute)',
58
+ table: {
59
+ type: { summary: 'number' },
60
+ defaultValue: { summary: 'undefined' }
61
+ }
62
+ },
63
+ required: {
64
+ control: 'boolean',
65
+ description: 'Mark field as required (standard HTML attribute)',
66
+ table: {
67
+ type: { summary: 'boolean' },
68
+ defaultValue: { summary: 'false' }
69
+ }
70
+ },
71
+ class: {
72
+ control: 'text',
73
+ description: 'Additional CSS classes',
74
+ table: {
75
+ type: { summary: 'string' },
76
+ defaultValue: { summary: '""' }
77
+ }
78
+ }
79
+ }
80
+ };
81
+ export default meta;
82
+ /**
83
+ * Default empty textarea with auto-grow enabled.
84
+ */
85
+ export const Default = {
86
+ args: {
87
+ value: '',
88
+ placeholder: 'Enter your text here...'
89
+ }
90
+ };
91
+ /**
92
+ * Textarea with pre-populated value demonstrating auto-resize.
93
+ */
94
+ export const WithValue = {
95
+ args: {
96
+ value: 'This is some initial text.\nIt automatically adjusts height as you type.\nTry adding more lines!'
97
+ }
98
+ };
99
+ /**
100
+ * Textarea with placeholder text.
101
+ */
102
+ export const WithPlaceholder = {
103
+ args: {
104
+ value: '',
105
+ placeholder: 'Describe your project in detail...'
106
+ }
107
+ };
108
+ /**
109
+ * Readonly mode displays the text as formatted HTML with line breaks preserved.
110
+ * This is useful for displaying data that should not be edited.
111
+ */
112
+ export const Readonly = {
113
+ args: {
114
+ value: 'This is readonly text.\nLine breaks are preserved.\nThe textarea is replaced with DisplayHTML component.',
115
+ readonly: true
116
+ }
117
+ };
118
+ /**
119
+ * Disabled state prevents user interaction but keeps textarea visible.
120
+ */
121
+ export const Disabled = {
122
+ args: {
123
+ value: 'This textarea is disabled.',
124
+ disabled: true
125
+ }
126
+ };
127
+ /**
128
+ * Demonstrates auto-grow behavior with long text.
129
+ * The textarea automatically adjusts height to fit content without scrollbars.
130
+ */
131
+ export const LongText = {
132
+ args: {
133
+ value: `Lorem ipsum dolor sit amet, consectetur adipiscing elit.
134
+ Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
135
+ Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.
136
+
137
+ Duis aute irure dolor in reprehenderit in voluptate velit esse.
138
+ Cillum dolore eu fugiat nulla pariatur excepteur sint occaecat.
139
+ Cupidatat non proident sunt in culpa qui officia deserunt mollit.
140
+
141
+ Add more lines to see the textarea grow automatically!
142
+ Each line is preserved exactly as typed.
143
+ No manual resizing needed - the component handles it for you.`
144
+ }
145
+ };
146
+ /**
147
+ * Character limit with maxlength attribute.
148
+ */
149
+ export const WithMaxLength = {
150
+ args: {
151
+ value: '',
152
+ maxlength: 100,
153
+ placeholder: 'Maximum 100 characters allowed...'
154
+ }
155
+ };
156
+ /**
157
+ * Required field with validation styling.
158
+ */
159
+ export const Required = {
160
+ args: {
161
+ value: '',
162
+ required: true,
163
+ placeholder: 'This field is required'
164
+ }
165
+ };
166
+ /**
167
+ * Custom styling with Tailwind classes.
168
+ */
169
+ export const CustomStyling = {
170
+ args: {
171
+ value: 'Custom styled textarea',
172
+ class: 'border-2 border-primary-main rounded-lg p-4 bg-primary-light'
173
+ }
174
+ };
175
+ /**
176
+ * Textarea with propagateEnter enabled (Enter key will propagate to parent).
177
+ * By default, Enter key is stopped to prevent accidental form submissions.
178
+ */
179
+ export const PropagateEnter = {
180
+ args: {
181
+ value: 'Try pressing Enter - it will propagate to the form',
182
+ propagateEnter: true,
183
+ placeholder: 'Enter key propagates to parent elements'
184
+ }
185
+ };
186
+ /**
187
+ * Form integration example showing how to use TextArea in a form.
188
+ * The textarea will submit with the form using the name attribute.
189
+ */
190
+ export const FormIntegration = {
191
+ args: {
192
+ value: 'This is form data',
193
+ name: 'comment',
194
+ required: true,
195
+ placeholder: 'Enter your comment (required)'
196
+ }
197
+ };
198
+ /**
199
+ * Empty textarea showing placeholder.
200
+ */
201
+ export const Empty = {
202
+ args: {
203
+ value: null,
204
+ placeholder: 'Start typing...'
205
+ }
206
+ };
207
+ /**
208
+ * Initial rows specification (standard HTML attribute).
209
+ * The textarea will start with this height and then auto-grow.
210
+ */
211
+ export const WithInitialRows = {
212
+ args: {
213
+ value: 'This textarea starts with 10 rows',
214
+ rows: 10
215
+ }
216
+ };
@@ -1,3 +1,29 @@
1
+ <!--
2
+ @component
3
+ Auto-resizing textarea with automatic height adjustment and readonly display mode.
4
+ Replaces native <textarea> elements with auto-grow functionality.
5
+
6
+ @example
7
+ ```svelte
8
+ <script>
9
+ import { TextArea } from 'intelliwaketssveltekitv25';
10
+ let comment = $state('');
11
+ </script>
12
+
13
+ <TextArea bind:value={comment} placeholder="Enter your comment..." />
14
+ ```
15
+
16
+ @remarks
17
+ - Uses Svelte 5 $bindable rune for two-way binding of value
18
+ - Automatically adjusts height to fit content (auto-grow)
19
+ - Readonly mode displays as formatted HTML with line breaks preserved
20
+ - Prevents Enter key propagation by default (prevents accidental form submissions)
21
+ - Supports all standard HTML textarea attributes
22
+
23
+ @see DisplayHTML - Used for readonly display
24
+ @see InputNumber - For single-line numeric inputs
25
+ -->
26
+
1
27
  <script lang="ts">
2
28
 
3
29
  import type { HTMLTextareaAttributes } from 'svelte/elements'
@@ -6,12 +32,18 @@
6
32
  import {autoGrow} from './Functions'
7
33
 
8
34
  let {
35
+ /** Current text value (two-way bindable) */
9
36
  value = $bindable(),
10
37
  // thisRef = $bindable<HTMLTextAreaElement>(),
38
+ /** Display as readonly (renders as DisplayHTML instead of textarea) */
11
39
  readonly,
40
+ /** Svelte actions array */
12
41
  use = [],
42
+ /** Keyboard event handler */
13
43
  onkeydown,
44
+ /** Allow Enter key to propagate (useful in forms) - default: false */
14
45
  propagateEnter = false,
46
+ /** Standard HTML textarea attributes (placeholder, disabled, required, maxlength, rows, cols, name, class, etc.) */
15
47
  ...otherProps
16
48
  }: Omit<
17
49
  HTMLTextareaAttributes,
@@ -6,6 +6,30 @@ type $$ComponentProps = Omit<HTMLTextareaAttributes, 'value' | 'this' | 'use'> &
6
6
  propagateEnter?: boolean;
7
7
  use?: ActionArray;
8
8
  };
9
+ /**
10
+ * Auto-resizing textarea with automatic height adjustment and readonly display mode.
11
+ * Replaces native <textarea> elements with auto-grow functionality.
12
+ *
13
+ * @example
14
+ * ```svelte
15
+ * <script>
16
+ * import { TextArea } from 'intelliwaketssveltekitv25';
17
+ * let comment = $state('');
18
+ * </script>
19
+ *
20
+ * <TextArea bind:value={comment} placeholder="Enter your comment..." />
21
+ * ```
22
+ *
23
+ * @remarks
24
+ * - Uses Svelte 5 $bindable rune for two-way binding of value
25
+ * - Automatically adjusts height to fit content (auto-grow)
26
+ * - Readonly mode displays as formatted HTML with line breaks preserved
27
+ * - Prevents Enter key propagation by default (prevents accidental form submissions)
28
+ * - Supports all standard HTML textarea attributes
29
+ *
30
+ * @see DisplayHTML - Used for readonly display
31
+ * @see InputNumber - For single-line numeric inputs
32
+ */
9
33
  declare const TextArea: import("svelte").Component<$$ComponentProps, {}, "value">;
10
34
  type TextArea = ReturnType<typeof TextArea>;
11
35
  export default TextArea;