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.
@@ -0,0 +1,127 @@
1
+ import ButtonGroup from './ButtonGroup.svelte';
2
+ const meta = {
3
+ title: 'Components/ButtonGroup',
4
+ component: ButtonGroup,
5
+ tags: ['autodocs'],
6
+ argTypes: {
7
+ value: {
8
+ control: 'text',
9
+ description: 'Currently selected value'
10
+ },
11
+ options: {
12
+ control: 'object',
13
+ description: 'Array of options (strings or objects with key, name, disabled, hidden)'
14
+ },
15
+ class: {
16
+ control: 'text',
17
+ description: 'Additional CSS classes'
18
+ },
19
+ name: {
20
+ control: 'text',
21
+ description: 'Name for hidden input field'
22
+ },
23
+ readonly: {
24
+ control: 'boolean',
25
+ description: 'Makes the button group readonly'
26
+ },
27
+ dataColor: {
28
+ control: 'select',
29
+ options: ['primary', 'secondary', 'danger', 'warning', 'gray'],
30
+ description: 'Color palette for the buttons'
31
+ }
32
+ }
33
+ };
34
+ export default meta;
35
+ export const Default = {
36
+ args: {
37
+ value: 'option2',
38
+ options: ['option1', 'option2', 'option3']
39
+ }
40
+ };
41
+ export const WithObjectOptions = {
42
+ args: {
43
+ value: 'two',
44
+ options: [
45
+ { key: 'one', name: 'First Option' },
46
+ { key: 'two', name: 'Second Option' },
47
+ { key: 'three', name: 'Third Option' }
48
+ ]
49
+ }
50
+ };
51
+ export const WithDisabledOption = {
52
+ args: {
53
+ value: 'medium',
54
+ options: [
55
+ { key: 'small', name: 'Small' },
56
+ { key: 'medium', name: 'Medium' },
57
+ { key: 'large', name: 'Large', disabled: true },
58
+ { key: 'xlarge', name: 'X-Large' }
59
+ ]
60
+ }
61
+ };
62
+ export const WithHiddenOption = {
63
+ args: {
64
+ value: 'visible1',
65
+ options: [
66
+ { key: 'visible1', name: 'Visible 1' },
67
+ { key: 'hidden', name: 'Hidden Option', hidden: true },
68
+ { key: 'visible2', name: 'Visible 2' }
69
+ ]
70
+ }
71
+ };
72
+ export const Readonly = {
73
+ args: {
74
+ value: 'selected',
75
+ options: ['option1', 'selected', 'option3'],
76
+ readonly: true
77
+ }
78
+ };
79
+ export const WithPrimaryColor = {
80
+ args: {
81
+ value: 'option2',
82
+ options: ['option1', 'option2', 'option3'],
83
+ dataColor: 'primary'
84
+ }
85
+ };
86
+ export const WithSecondaryColor = {
87
+ args: {
88
+ value: 'option2',
89
+ options: ['option1', 'option2', 'option3'],
90
+ dataColor: 'secondary'
91
+ }
92
+ };
93
+ export const WithDangerColor = {
94
+ args: {
95
+ value: 'delete',
96
+ options: [
97
+ { key: 'save', name: 'Save' },
98
+ { key: 'delete', name: 'Delete' },
99
+ { key: 'cancel', name: 'Cancel' }
100
+ ],
101
+ dataColor: 'danger'
102
+ }
103
+ };
104
+ export const ManyOptions = {
105
+ args: {
106
+ value: '5',
107
+ options: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
108
+ }
109
+ };
110
+ export const WithFormName = {
111
+ args: {
112
+ value: 'option2',
113
+ options: ['option1', 'option2', 'option3'],
114
+ name: 'buttonGroupField'
115
+ }
116
+ };
117
+ export const CustomClass = {
118
+ args: {
119
+ value: 'center',
120
+ options: [
121
+ { key: 'left', name: 'Left' },
122
+ { key: 'center', name: 'Center' },
123
+ { key: 'right', name: 'Right' }
124
+ ],
125
+ class: 'shadow-lg'
126
+ }
127
+ };
@@ -0,0 +1,96 @@
1
+ import type { StoryObj } from '@storybook/svelte';
2
+ type DropDownProps = {
3
+ show?: boolean;
4
+ ddActions?: any[];
5
+ buttonTitle?: string | null;
6
+ noCaret?: boolean;
7
+ buttonClass?: string;
8
+ inputControl?: boolean;
9
+ fullBlock?: boolean;
10
+ sameSize?: boolean;
11
+ disabled?: boolean;
12
+ hidden?: boolean;
13
+ };
14
+ declare const meta: {
15
+ title: string;
16
+ component: import("svelte").Component<{
17
+ show?: boolean;
18
+ position?: import("./Definitions").TDropDownControlPosition;
19
+ ddActions?: import("./Definitions").IDDAction[];
20
+ noCaret?: boolean;
21
+ buttonTitle?: string | null;
22
+ buttonClass?: string;
23
+ controlClass?: string;
24
+ toggleClass?: string;
25
+ inputControl?: boolean;
26
+ fullBlock?: boolean;
27
+ bodyClass?: string;
28
+ sameSize?: boolean;
29
+ zIndex?: number;
30
+ disabled?: boolean;
31
+ hidden?: boolean;
32
+ hideEmptyDDActions?: boolean;
33
+ button?: import("svelte").Snippet;
34
+ verbose?: boolean;
35
+ actions?: import("svelte").Snippet;
36
+ dataColor?: TDefaultColorPalate;
37
+ clientWidth?: number;
38
+ }, {}, "show" | "clientWidth">;
39
+ tags: string[];
40
+ argTypes: {
41
+ show: {
42
+ control: "boolean";
43
+ description: string;
44
+ };
45
+ ddActions: {
46
+ control: "object";
47
+ description: string;
48
+ };
49
+ buttonTitle: {
50
+ control: "text";
51
+ description: string;
52
+ };
53
+ noCaret: {
54
+ control: "boolean";
55
+ description: string;
56
+ };
57
+ buttonClass: {
58
+ control: "text";
59
+ description: string;
60
+ };
61
+ inputControl: {
62
+ control: "boolean";
63
+ description: string;
64
+ };
65
+ fullBlock: {
66
+ control: "boolean";
67
+ description: string;
68
+ };
69
+ sameSize: {
70
+ control: "boolean";
71
+ description: string;
72
+ };
73
+ disabled: {
74
+ control: "boolean";
75
+ description: string;
76
+ };
77
+ hidden: {
78
+ control: "boolean";
79
+ description: string;
80
+ };
81
+ };
82
+ };
83
+ export default meta;
84
+ type Story = StoryObj<DropDownProps>;
85
+ export declare const Default: Story;
86
+ export declare const WithActiveItem: Story;
87
+ export declare const WithDisabledItems: Story;
88
+ export declare const WithHeaders: Story;
89
+ export declare const WithGrouping: Story;
90
+ export declare const WithNavigation: Story;
91
+ export declare const WithDownloads: Story;
92
+ export declare const WithAlternateActions: Story;
93
+ export declare const AsSelectReplacement: Story;
94
+ export declare const Disabled: Story;
95
+ export declare const NoCaret: Story;
96
+ export declare const FullWidth: Story;
@@ -0,0 +1,192 @@
1
+ import DropDown from './DropDown.svelte';
2
+ import { faEdit, faTrash, faCopy, faDownload, faFile } from '@fortawesome/free-solid-svg-icons';
3
+ const meta = {
4
+ title: 'Components/DropDown',
5
+ component: DropDown,
6
+ tags: ['autodocs'],
7
+ argTypes: {
8
+ show: {
9
+ control: 'boolean',
10
+ description: 'Control dropdown open/closed state'
11
+ },
12
+ ddActions: {
13
+ control: 'object',
14
+ description: 'Array of menu items/actions (IDDAction[])'
15
+ },
16
+ buttonTitle: {
17
+ control: 'text',
18
+ description: 'Button text (if not using button snippet)'
19
+ },
20
+ noCaret: {
21
+ control: 'boolean',
22
+ description: 'Hide the dropdown arrow icon'
23
+ },
24
+ buttonClass: {
25
+ control: 'text',
26
+ description: 'CSS classes for the button'
27
+ },
28
+ inputControl: {
29
+ control: 'boolean',
30
+ description: 'Style button as input control'
31
+ },
32
+ fullBlock: {
33
+ control: 'boolean',
34
+ description: 'Make button full width'
35
+ },
36
+ sameSize: {
37
+ control: 'boolean',
38
+ description: 'Make dropdown menu same width as button'
39
+ },
40
+ disabled: {
41
+ control: 'boolean',
42
+ description: 'Disable the dropdown'
43
+ },
44
+ hidden: {
45
+ control: 'boolean',
46
+ description: 'Hide the dropdown'
47
+ }
48
+ }
49
+ };
50
+ export default meta;
51
+ const basicActions = [
52
+ { title: 'Edit', faProps: { icon: faEdit }, action: () => alert('Edit clicked') },
53
+ { title: 'Copy', faProps: { icon: faCopy }, action: () => alert('Copy clicked') },
54
+ { divider: true },
55
+ { title: 'Delete', faProps: { icon: faTrash }, action: () => alert('Delete clicked') }
56
+ ];
57
+ export const Default = {
58
+ args: {
59
+ buttonTitle: 'Actions',
60
+ ddActions: basicActions
61
+ }
62
+ };
63
+ export const WithActiveItem = {
64
+ args: {
65
+ buttonTitle: 'Option 2',
66
+ inputControl: true,
67
+ ddActions: [
68
+ { title: 'Option 1', action: () => { } },
69
+ { title: 'Option 2', active: true, action: () => { } },
70
+ { title: 'Option 3', action: () => { } }
71
+ ]
72
+ }
73
+ };
74
+ export const WithDisabledItems = {
75
+ args: {
76
+ buttonTitle: 'Actions',
77
+ ddActions: [
78
+ { title: 'Available Action', action: () => { } },
79
+ { title: 'Disabled Action', disabled: true, action: () => { } },
80
+ { title: 'Another Action', action: () => { } }
81
+ ]
82
+ }
83
+ };
84
+ export const WithHeaders = {
85
+ args: {
86
+ buttonTitle: 'Options',
87
+ ddActions: [
88
+ { title: 'File Operations', header: true },
89
+ { title: 'Open', action: () => { } },
90
+ { title: 'Save', action: () => { } },
91
+ { divider: true },
92
+ { title: 'Edit Operations', header: true },
93
+ { title: 'Cut', action: () => { } },
94
+ { title: 'Copy', action: () => { } }
95
+ ]
96
+ }
97
+ };
98
+ export const WithGrouping = {
99
+ args: {
100
+ buttonTitle: 'Grouped',
101
+ ddActions: [
102
+ { title: 'Item 1', headerGroup: 'Group A', action: () => { } },
103
+ { title: 'Item 2', headerGroup: 'Group A', action: () => { } },
104
+ { title: 'Item 3', headerGroup: 'Group B', action: () => { } },
105
+ { title: 'Item 4', headerGroup: 'Group B', action: () => { } }
106
+ ]
107
+ }
108
+ };
109
+ export const WithNavigation = {
110
+ args: {
111
+ buttonTitle: 'Navigate',
112
+ ddActions: [
113
+ { title: 'Dashboard', href: '/dashboard' },
114
+ { title: 'Settings', href: '/settings' },
115
+ { divider: true },
116
+ { title: 'Logout', href: '/logout', hrefReplace: true }
117
+ ]
118
+ }
119
+ };
120
+ export const WithDownloads = {
121
+ args: {
122
+ buttonTitle: 'Export',
123
+ ddActions: [
124
+ {
125
+ title: 'Export as CSV',
126
+ faProps: { icon: faFile },
127
+ hrefDownload: '/api/export?format=csv',
128
+ hrefDownloadFilename: 'data.csv'
129
+ },
130
+ {
131
+ title: 'Export as PDF',
132
+ faProps: { icon: faFile },
133
+ hrefDownload: '/api/export?format=pdf',
134
+ hrefDownloadFilename: 'data.pdf'
135
+ }
136
+ ]
137
+ }
138
+ };
139
+ export const WithAlternateActions = {
140
+ args: {
141
+ buttonTitle: 'Files',
142
+ ddActions: [
143
+ {
144
+ title: 'document.pdf',
145
+ faProps: { icon: faFile },
146
+ action: () => alert('Open document'),
147
+ alternateAction: () => alert('Download document'),
148
+ alternateFAProps: { icon: faDownload }
149
+ }
150
+ ]
151
+ }
152
+ };
153
+ export const AsSelectReplacement = {
154
+ args: {
155
+ buttonTitle: 'Medium',
156
+ inputControl: true,
157
+ fullBlock: true,
158
+ sameSize: true,
159
+ ddActions: [
160
+ { title: 'Small', action: () => { } },
161
+ { title: 'Medium', active: true, action: () => { } },
162
+ { title: 'Large', action: () => { } },
163
+ { title: 'X-Large', action: () => { } }
164
+ ]
165
+ }
166
+ };
167
+ export const Disabled = {
168
+ args: {
169
+ buttonTitle: 'Actions',
170
+ disabled: true,
171
+ ddActions: basicActions
172
+ }
173
+ };
174
+ export const NoCaret = {
175
+ args: {
176
+ buttonTitle: 'Menu',
177
+ noCaret: true,
178
+ ddActions: basicActions
179
+ }
180
+ };
181
+ export const FullWidth = {
182
+ args: {
183
+ buttonTitle: 'Select Option',
184
+ fullBlock: true,
185
+ inputControl: true,
186
+ ddActions: [
187
+ { title: 'Option 1', action: () => { } },
188
+ { title: 'Option 2', action: () => { } },
189
+ { title: 'Option 3', action: () => { } }
190
+ ]
191
+ }
192
+ };
@@ -1,3 +1,35 @@
1
+ <!--
2
+ @component
3
+ Rich dropdown menu with keyboard navigation, icons, search, and action handling.
4
+ Replaces native <select> elements and provides context menus, action lists, and navigation dropdowns.
5
+
6
+ @example
7
+ ```svelte
8
+ <script>
9
+ import { DropDown } from 'intelliwaketssveltekitv25';
10
+ import { faEdit, faTrash } from '@fortawesome/free-solid-svg-icons';
11
+
12
+ const actions = [
13
+ { title: 'Edit', faProps: { icon: faEdit }, action: () => editItem() },
14
+ { title: 'Delete', faProps: { icon: faTrash }, action: () => deleteItem() }
15
+ ];
16
+ </script>
17
+
18
+ <DropDown buttonTitle="Actions" ddActions={actions} />
19
+ ```
20
+
21
+ @remarks
22
+ - Keyboard navigation: Arrow keys, Enter, Tab, type-to-search
23
+ - Supports icons (FontAwesome), dividers, headers, and grouping
24
+ - Action handlers, href navigation, and download links
25
+ - Auto-positioning based on viewport space
26
+ - Active item highlighting for selection scenarios
27
+ - Alternate actions (two buttons per row)
28
+
29
+ @see DropDownControl - Lower-level dropdown control (used internally)
30
+ @see MultiSelect - For selecting multiple options from a list
31
+ -->
32
+
1
33
  <script lang='ts'>
2
34
  import DropDownControl from './DropDownControl.svelte'
3
35
  import { type Snippet, tick } from 'svelte'
@@ -23,6 +23,36 @@ type $$ComponentProps = {
23
23
  dataColor?: TDefaultColorPalate;
24
24
  clientWidth?: number;
25
25
  };
26
+ /**
27
+ * Rich dropdown menu with keyboard navigation, icons, search, and action handling.
28
+ * Replaces native <select> elements and provides context menus, action lists, and navigation dropdowns.
29
+ *
30
+ * @example
31
+ * ```svelte
32
+ * <script>
33
+ * import { DropDown } from 'intelliwaketssveltekitv25';
34
+ * import { faEdit, faTrash } from '@fortawesome/free-solid-svg-icons';
35
+ *
36
+ * const actions = [
37
+ * { title: 'Edit', faProps: { icon: faEdit }, action: () => editItem() },
38
+ * { title: 'Delete', faProps: { icon: faTrash }, action: () => deleteItem() }
39
+ * ];
40
+ * </script>
41
+ *
42
+ * <DropDown buttonTitle="Actions" ddActions={actions} />
43
+ * ```
44
+ *
45
+ * @remarks
46
+ * - Keyboard navigation: Arrow keys, Enter, Tab, type-to-search
47
+ * - Supports icons (FontAwesome), dividers, headers, and grouping
48
+ * - Action handlers, href navigation, and download links
49
+ * - Auto-positioning based on viewport space
50
+ * - Active item highlighting for selection scenarios
51
+ * - Alternate actions (two buttons per row)
52
+ *
53
+ * @see DropDownControl - Lower-level dropdown control (used internally)
54
+ * @see MultiSelect - For selecting multiple options from a list
55
+ */
26
56
  declare const DropDown: import("svelte").Component<$$ComponentProps, {}, "show" | "clientWidth">;
27
57
  type DropDown = ReturnType<typeof DropDown>;
28
58
  export default DropDown;
@@ -69,6 +69,7 @@ export type TUpDownArrowOptions = {
69
69
  list?: ({
70
70
  id: number;
71
71
  } & Record<string, any>)[];
72
+ enterDown?: boolean;
72
73
  };
73
74
  /**
74
75
  * The `upDownArrows` function adds an event listener to an HTMLInputElement that responds to arrow key presses.
package/dist/Functions.js CHANGED
@@ -368,7 +368,8 @@ export function upDownArrows(el, prePost) {
368
368
  e.preventDefault();
369
369
  break;
370
370
  case KEY_STRING_DOWN_ARROW:
371
- {
371
+ case KEY_STRING_ENTER:
372
+ if (prePost?.enterDown || e.key === KEY_STRING_DOWN_ARROW) {
372
373
  const components = e.target.id?.split('_');
373
374
  const currentID = CleanNumberNull(components.shift());
374
375
  if (currentID !== null && components.length) {
@@ -389,8 +390,8 @@ export function upDownArrows(el, prePost) {
389
390
  element?.focus();
390
391
  }
391
392
  }
393
+ e.preventDefault();
392
394
  }
393
- e.preventDefault();
394
395
  break;
395
396
  }
396
397
  }
@@ -0,0 +1,122 @@
1
+ import type { StoryObj } from '@storybook/svelte';
2
+ type InputNumberProps = {
3
+ value?: number | null;
4
+ currency?: boolean;
5
+ percent?: boolean;
6
+ fixedDecimals?: number;
7
+ minDecimals?: number;
8
+ maxDecimals?: number;
9
+ min?: number;
10
+ max?: number;
11
+ allowNegative?: boolean;
12
+ zeroBlank?: boolean;
13
+ zeroDash?: boolean;
14
+ prefix?: string;
15
+ suffix?: string;
16
+ delayChange?: boolean | number | 'blur';
17
+ widthNumbers?: number;
18
+ disabled?: boolean;
19
+ readonly?: boolean;
20
+ required?: boolean;
21
+ placeholder?: string;
22
+ };
23
+ declare const meta: {
24
+ title: string;
25
+ component: import("svelte").Component<import("./Functions").TInputNumberAttributes, {}, "value" | "thisRef">;
26
+ tags: string[];
27
+ argTypes: {
28
+ value: {
29
+ control: "number";
30
+ description: string;
31
+ };
32
+ currency: {
33
+ control: "boolean";
34
+ description: string;
35
+ };
36
+ percent: {
37
+ control: "boolean";
38
+ description: string;
39
+ };
40
+ fixedDecimals: {
41
+ control: "number";
42
+ description: string;
43
+ };
44
+ minDecimals: {
45
+ control: "number";
46
+ description: string;
47
+ };
48
+ maxDecimals: {
49
+ control: "number";
50
+ description: string;
51
+ };
52
+ min: {
53
+ control: "number";
54
+ description: string;
55
+ };
56
+ max: {
57
+ control: "number";
58
+ description: string;
59
+ };
60
+ allowNegative: {
61
+ control: "boolean";
62
+ description: string;
63
+ };
64
+ zeroBlank: {
65
+ control: "boolean";
66
+ description: string;
67
+ };
68
+ zeroDash: {
69
+ control: "boolean";
70
+ description: string;
71
+ };
72
+ prefix: {
73
+ control: "text";
74
+ description: string;
75
+ };
76
+ suffix: {
77
+ control: "text";
78
+ description: string;
79
+ };
80
+ delayChange: {
81
+ control: "boolean";
82
+ description: string;
83
+ };
84
+ widthNumbers: {
85
+ control: "number";
86
+ description: string;
87
+ };
88
+ disabled: {
89
+ control: "boolean";
90
+ description: string;
91
+ };
92
+ readonly: {
93
+ control: "boolean";
94
+ description: string;
95
+ };
96
+ required: {
97
+ control: "boolean";
98
+ description: string;
99
+ };
100
+ placeholder: {
101
+ control: "text";
102
+ description: string;
103
+ };
104
+ };
105
+ };
106
+ export default meta;
107
+ type Story = StoryObj<InputNumberProps>;
108
+ export declare const Default: Story;
109
+ export declare const Currency: Story;
110
+ export declare const Percentage: Story;
111
+ export declare const IntegerOnly: Story;
112
+ export declare const WithMinMax: Story;
113
+ export declare const AllowNegative: Story;
114
+ export declare const ZeroBlank: Story;
115
+ export declare const ZeroDash: Story;
116
+ export declare const CustomSuffix: Story;
117
+ export declare const CustomPrefix: Story;
118
+ export declare const Disabled: Story;
119
+ export declare const Readonly: Story;
120
+ export declare const WithDelayChange: Story;
121
+ export declare const WithWidth: Story;
122
+ export declare const Required: Story;