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/docs/DropDown.md
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
# DropDown Component
|
|
2
|
+
|
|
3
|
+
**Replaces:** `<select>` elements and custom dropdown menus
|
|
4
|
+
|
|
5
|
+
**Purpose:** Rich dropdown menu with keyboard navigation, icons, search, and action handling
|
|
6
|
+
|
|
7
|
+
**When to Use:**
|
|
8
|
+
- Action menus (context menus, toolbar dropdowns)
|
|
9
|
+
- Navigation dropdowns with links
|
|
10
|
+
- Replacing `<select>` when you need icons, dividers, or complex items
|
|
11
|
+
- Any menu that needs better UX than native `<select>`
|
|
12
|
+
|
|
13
|
+
## Key Props
|
|
14
|
+
|
|
15
|
+
- `show?: boolean` ($bindable) - Control dropdown open/closed state
|
|
16
|
+
- `position?: TDropDownControlPosition` (default: null) - Menu position relative to button
|
|
17
|
+
- `ddActions?: IDDAction[]` (default: []) - Array of menu items/actions (see IDDAction interface below)
|
|
18
|
+
- `noCaret?: boolean` - Hide the dropdown arrow icon
|
|
19
|
+
- `buttonTitle?: string | null` - Button text (if not using `button` snippet)
|
|
20
|
+
- `buttonClass?: string` - CSS classes for the button
|
|
21
|
+
- `controlClass?: string` - CSS classes for the dropdown wrapper
|
|
22
|
+
- `toggleClass?: string` - CSS classes for the toggle container
|
|
23
|
+
- `inputControl?: boolean` - Style button as input control
|
|
24
|
+
- `fullBlock?: boolean` - Make button full width
|
|
25
|
+
- `bodyClass?: string` - CSS classes for dropdown body/menu
|
|
26
|
+
- `sameSize?: boolean` - Make dropdown menu same width as button
|
|
27
|
+
- `zIndex?: number` (default: 40) - Z-index for dropdown positioning
|
|
28
|
+
- `disabled?: boolean` - Disable the dropdown
|
|
29
|
+
- `hidden?: boolean` - Hide the dropdown
|
|
30
|
+
- `hideEmptyDDActions?: boolean` - Auto-hide if no actions provided
|
|
31
|
+
- `verbose?: boolean` - Enable console logging for debugging
|
|
32
|
+
- `dataColor?: TDefaultColorPalate` - Color theme for button
|
|
33
|
+
- `clientWidth?: number` ($bindable) - Width of the button element
|
|
34
|
+
|
|
35
|
+
## Snippets
|
|
36
|
+
|
|
37
|
+
- `button?: Snippet` - Custom button content (overrides `buttonTitle`)
|
|
38
|
+
- `actions?: Snippet` - Custom menu content (in addition to or instead of `ddActions`)
|
|
39
|
+
|
|
40
|
+
## IDDAction Interface
|
|
41
|
+
|
|
42
|
+
Menu items configuration:
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
interface IDDAction {
|
|
46
|
+
title?: string // Display text
|
|
47
|
+
key?: string | number // Unique key for item
|
|
48
|
+
divider?: boolean // Render as divider line
|
|
49
|
+
header?: boolean // Render as header text (bold, no click)
|
|
50
|
+
dividerGroup?: string // Auto-add divider when group changes
|
|
51
|
+
headerGroup?: string // Auto-add header when group changes
|
|
52
|
+
active?: boolean // Highlight as active/selected
|
|
53
|
+
disabled?: boolean // Disable interaction
|
|
54
|
+
hidden?: boolean // Hide from menu
|
|
55
|
+
indented?: boolean // Indent item (for hierarchy)
|
|
56
|
+
|
|
57
|
+
// Actions
|
|
58
|
+
action?: () => void // Click handler
|
|
59
|
+
href?: string // Navigation URL
|
|
60
|
+
hrefReplace?: boolean // Use replaceState navigation
|
|
61
|
+
hrefDownload?: string // Download URL
|
|
62
|
+
hrefDownloadFilename?: string // Filename for download
|
|
63
|
+
|
|
64
|
+
// Visual
|
|
65
|
+
faProps?: IFAProps // FontAwesome icon
|
|
66
|
+
imageHref?: string // Image URL for icon
|
|
67
|
+
|
|
68
|
+
// Alternate action (right side button)
|
|
69
|
+
alternateAction?: () => void // Right-side button action
|
|
70
|
+
alternateTitle?: string // Right-side button text
|
|
71
|
+
alternateFAProps?: IFAProps // Right-side button icon
|
|
72
|
+
alternateNoClose?: boolean // Keep menu open after alternate action
|
|
73
|
+
|
|
74
|
+
// Behavior
|
|
75
|
+
noCloseMenu?: boolean // Keep menu open after action
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Keyboard Navigation
|
|
80
|
+
|
|
81
|
+
- **Arrow Down:** Open menu / Move to next item
|
|
82
|
+
- **Arrow Up:** Move to previous item
|
|
83
|
+
- **Enter:** Execute selected item action
|
|
84
|
+
- **Tab:** Close menu
|
|
85
|
+
- **Type letter:** Jump to first item starting with that letter
|
|
86
|
+
|
|
87
|
+
## Usage Examples
|
|
88
|
+
|
|
89
|
+
```svelte
|
|
90
|
+
<script>
|
|
91
|
+
import { DropDown } from 'intelliwaketssveltekitv25';
|
|
92
|
+
import { faEdit, faTrash, faCopy } from '@fortawesome/free-solid-svg-icons';
|
|
93
|
+
|
|
94
|
+
let showMenu = $state(false);
|
|
95
|
+
let selectedOption = $state('option1');
|
|
96
|
+
|
|
97
|
+
const actions = [
|
|
98
|
+
{
|
|
99
|
+
title: 'Edit',
|
|
100
|
+
faProps: { icon: faEdit },
|
|
101
|
+
action: () => editItem()
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
title: 'Duplicate',
|
|
105
|
+
faProps: { icon: faCopy },
|
|
106
|
+
action: () => duplicateItem()
|
|
107
|
+
},
|
|
108
|
+
{ divider: true },
|
|
109
|
+
{
|
|
110
|
+
title: 'Delete',
|
|
111
|
+
faProps: { icon: faTrash },
|
|
112
|
+
action: () => deleteItem()
|
|
113
|
+
}
|
|
114
|
+
];
|
|
115
|
+
</script>
|
|
116
|
+
|
|
117
|
+
<!-- Simple action menu -->
|
|
118
|
+
<DropDown
|
|
119
|
+
bind:show={showMenu}
|
|
120
|
+
buttonTitle="Actions"
|
|
121
|
+
ddActions={actions}
|
|
122
|
+
/>
|
|
123
|
+
|
|
124
|
+
<!-- As select replacement with active indicator -->
|
|
125
|
+
<DropDown
|
|
126
|
+
bind:show={showOptions}
|
|
127
|
+
buttonTitle={selectedOption}
|
|
128
|
+
ddActions={[
|
|
129
|
+
{
|
|
130
|
+
title: 'Option 1',
|
|
131
|
+
active: selectedOption === 'option1',
|
|
132
|
+
action: () => selectedOption = 'option1'
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
title: 'Option 2',
|
|
136
|
+
active: selectedOption === 'option2',
|
|
137
|
+
action: () => selectedOption = 'option2'
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
title: 'Option 3',
|
|
141
|
+
active: selectedOption === 'option3',
|
|
142
|
+
action: () => selectedOption = 'option3'
|
|
143
|
+
}
|
|
144
|
+
]}
|
|
145
|
+
inputControl
|
|
146
|
+
/>
|
|
147
|
+
|
|
148
|
+
<!-- With navigation links -->
|
|
149
|
+
<DropDown
|
|
150
|
+
buttonTitle="Navigate"
|
|
151
|
+
ddActions={[
|
|
152
|
+
{ title: 'Dashboard', href: '/dashboard' },
|
|
153
|
+
{ title: 'Settings', href: '/settings' },
|
|
154
|
+
{ divider: true },
|
|
155
|
+
{ title: 'Logout', href: '/logout', hrefReplace: true }
|
|
156
|
+
]}
|
|
157
|
+
/>
|
|
158
|
+
|
|
159
|
+
<!-- With grouped items -->
|
|
160
|
+
<DropDown
|
|
161
|
+
buttonTitle="Options"
|
|
162
|
+
ddActions={[
|
|
163
|
+
{ title: 'File Operations', header: true },
|
|
164
|
+
{ title: 'Open', action: () => open() },
|
|
165
|
+
{ title: 'Save', action: () => save() },
|
|
166
|
+
{ divider: true },
|
|
167
|
+
{ title: 'Edit Operations', header: true },
|
|
168
|
+
{ title: 'Cut', action: () => cut() },
|
|
169
|
+
{ title: 'Copy', action: () => copy() },
|
|
170
|
+
{ title: 'Paste', action: () => paste() }
|
|
171
|
+
]}
|
|
172
|
+
/>
|
|
173
|
+
|
|
174
|
+
<!-- With auto-grouping by headerGroup -->
|
|
175
|
+
<DropDown
|
|
176
|
+
buttonTitle="Grouped"
|
|
177
|
+
ddActions={[
|
|
178
|
+
{ title: 'Item 1', headerGroup: 'Group A', action: () => {} },
|
|
179
|
+
{ title: 'Item 2', headerGroup: 'Group A', action: () => {} },
|
|
180
|
+
{ title: 'Item 3', headerGroup: 'Group B', action: () => {} },
|
|
181
|
+
{ title: 'Item 4', headerGroup: 'Group B', action: () => {} }
|
|
182
|
+
]}
|
|
183
|
+
/>
|
|
184
|
+
<!-- Automatically adds headers "Group A" and "Group B" -->
|
|
185
|
+
|
|
186
|
+
<!-- Custom button content -->
|
|
187
|
+
<DropDown bind:show={showCustom} ddActions={actions}>
|
|
188
|
+
{#snippet button()}
|
|
189
|
+
<Icon icon={faEllipsisV} />
|
|
190
|
+
More Options
|
|
191
|
+
{/snippet}
|
|
192
|
+
</DropDown>
|
|
193
|
+
|
|
194
|
+
<!-- Full width dropdown -->
|
|
195
|
+
<DropDown
|
|
196
|
+
buttonTitle="Select Option"
|
|
197
|
+
ddActions={options}
|
|
198
|
+
fullBlock
|
|
199
|
+
sameSize
|
|
200
|
+
inputControl
|
|
201
|
+
/>
|
|
202
|
+
|
|
203
|
+
<!-- With disabled items -->
|
|
204
|
+
<DropDown
|
|
205
|
+
buttonTitle="Actions"
|
|
206
|
+
ddActions={[
|
|
207
|
+
{ title: 'Available Action', action: () => {} },
|
|
208
|
+
{ title: 'Coming Soon', disabled: true },
|
|
209
|
+
{ title: 'Premium Only', disabled: true }
|
|
210
|
+
]}
|
|
211
|
+
/>
|
|
212
|
+
|
|
213
|
+
<!-- With alternate actions (two buttons per row) -->
|
|
214
|
+
<DropDown
|
|
215
|
+
buttonTitle="Files"
|
|
216
|
+
ddActions={[
|
|
217
|
+
{
|
|
218
|
+
title: 'document.pdf',
|
|
219
|
+
action: () => openFile('document.pdf'),
|
|
220
|
+
alternateAction: () => downloadFile('document.pdf'),
|
|
221
|
+
alternateFAProps: { icon: faDownload }
|
|
222
|
+
}
|
|
223
|
+
]}
|
|
224
|
+
/>
|
|
225
|
+
|
|
226
|
+
<!-- Download action -->
|
|
227
|
+
<DropDown
|
|
228
|
+
buttonTitle="Export"
|
|
229
|
+
ddActions={[
|
|
230
|
+
{
|
|
231
|
+
title: 'Export as CSV',
|
|
232
|
+
hrefDownload: '/api/export?format=csv',
|
|
233
|
+
hrefDownloadFilename: 'data.csv'
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
title: 'Export as PDF',
|
|
237
|
+
hrefDownload: '/api/export?format=pdf',
|
|
238
|
+
hrefDownloadFilename: 'data.pdf'
|
|
239
|
+
}
|
|
240
|
+
]}
|
|
241
|
+
/>
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Common Mistakes
|
|
245
|
+
|
|
246
|
+
- ❌ Not providing `action`, `href`, or `hrefDownload` for menu items
|
|
247
|
+
✅ Correct: Every menu item (except dividers/headers) needs an action
|
|
248
|
+
|
|
249
|
+
- ❌ Using DropDown when MultiSelect is more appropriate
|
|
250
|
+
✅ Correct: Use `MultiSelect` for selecting multiple options, `DropDown` for single actions/selections
|
|
251
|
+
|
|
252
|
+
- ❌ Forgetting to handle menu close in custom `noCloseMenu` actions
|
|
253
|
+
✅ Correct: Manually set `show = false` when using `noCloseMenu: true`
|
|
254
|
+
|
|
255
|
+
- ❌ Not using `bind:show` for controlled dropdowns
|
|
256
|
+
✅ Correct: `<DropDown bind:show={showMenu}>` to control open/close state
|
|
257
|
+
|
|
258
|
+
- ❌ Using complex objects as `key` without providing unique string/number keys
|
|
259
|
+
✅ Correct: Always provide `key` prop for array items
|
|
260
|
+
|
|
261
|
+
## Related Components
|
|
262
|
+
|
|
263
|
+
- `DropDownControl` - Lower-level dropdown control (used internally by DropDown)
|
|
264
|
+
- `MultiSelect` - For selecting multiple options from a list
|
|
265
|
+
- `Importer` - Specialized dropdown for file imports
|
|
266
|
+
|
|
267
|
+
## Storybook
|
|
268
|
+
|
|
269
|
+
See `Components/DropDown` stories
|