@juspay/svelte-ui-components 1.34.1 → 2.0.0
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/dist/Accordion/Accordion.svelte +17 -30
- package/dist/Accordion/Accordion.svelte.d.ts +6 -20
- package/dist/Animations/ModalAnimation.svelte +44 -30
- package/dist/Animations/ModalAnimation.svelte.d.ts +9 -21
- package/dist/Animations/OverlayAnimation.svelte +9 -2
- package/dist/Animations/OverlayAnimation.svelte.d.ts +6 -28
- package/dist/Badge/Badge.svelte +9 -8
- package/dist/Badge/Badge.svelte.d.ts +3 -18
- package/dist/Banner/Banner.svelte +20 -19
- package/dist/Banner/Banner.svelte.d.ts +3 -23
- package/dist/Banner/properties.d.ts +6 -2
- package/dist/BrandLoader/BrandLoader.svelte +11 -12
- package/dist/BrandLoader/BrandLoader.svelte.d.ts +3 -19
- package/dist/BrandLoader/properties.d.ts +1 -4
- package/dist/BrandLoader/properties.js +1 -7
- package/dist/Button/Button.svelte +38 -27
- package/dist/Button/Button.svelte.d.ts +4 -23
- package/dist/Button/properties.d.ts +9 -5
- package/dist/Button/properties.js +1 -7
- package/dist/Carousel/Carousel.svelte +132 -108
- package/dist/Carousel/Carousel.svelte.d.ts +3 -20
- package/dist/Carousel/properties.d.ts +6 -12
- package/dist/Carousel/properties.js +1 -7
- package/dist/CheckListItem/CheckListItem.svelte +18 -12
- package/dist/CheckListItem/CheckListItem.svelte.d.ts +4 -23
- package/dist/CheckListItem/properties.d.ts +7 -0
- package/dist/CheckListItem/properties.js +1 -0
- package/dist/GridItem/GridItem.svelte +17 -11
- package/dist/GridItem/GridItem.svelte.d.ts +4 -24
- package/dist/GridItem/properties.d.ts +8 -0
- package/dist/GridItem/properties.js +1 -0
- package/dist/Icon/Icon.svelte +8 -6
- package/dist/Icon/Icon.svelte.d.ts +3 -21
- package/dist/Icon/properties.d.ts +3 -2
- package/dist/Icon/properties.js +1 -4
- package/dist/IconStack/IconStack.svelte +5 -3
- package/dist/IconStack/IconStack.svelte.d.ts +4 -19
- package/dist/IconStack/properties.d.ts +4 -1
- package/dist/Img/Img.svelte +13 -9
- package/dist/Img/Img.svelte.d.ts +4 -20
- package/dist/Img/properties.d.ts +2 -2
- package/dist/Input/Input.svelte +172 -139
- package/dist/Input/Input.svelte.d.ts +6 -32
- package/dist/Input/properties.d.ts +23 -22
- package/dist/Input/properties.js +1 -23
- package/dist/InputButton/InputButton.svelte +76 -78
- package/dist/InputButton/InputButton.svelte.d.ts +6 -35
- package/dist/InputButton/properties.d.ts +6 -4
- package/dist/InputButton/properties.js +1 -18
- package/dist/ListItem/ListItem.svelte +87 -64
- package/dist/ListItem/ListItem.svelte.d.ts +4 -35
- package/dist/ListItem/properties.d.ts +21 -7
- package/dist/ListItem/properties.js +1 -8
- package/dist/Loader/Loader.svelte +1 -4
- package/dist/Loader/Loader.svelte.d.ts +24 -15
- package/dist/Modal/Modal.svelte +117 -95
- package/dist/Modal/Modal.svelte.d.ts +3 -29
- package/dist/Modal/properties.d.ts +21 -13
- package/dist/Modal/properties.js +1 -14
- package/dist/Select/Select.svelte +170 -142
- package/dist/Select/Select.svelte.d.ts +3 -26
- package/dist/Select/properties.d.ts +19 -10
- package/dist/Status/Status.svelte +15 -15
- package/dist/Status/Status.svelte.d.ts +3 -21
- package/dist/Status/properties.d.ts +2 -2
- package/dist/Status/properties.js +1 -6
- package/dist/Stepper/Step.svelte +13 -13
- package/dist/Stepper/Step.svelte.d.ts +4 -23
- package/dist/Stepper/Stepper.svelte +10 -7
- package/dist/Stepper/Stepper.svelte.d.ts +3 -20
- package/dist/Stepper/properties.d.ts +12 -0
- package/dist/Table/Table.svelte +73 -47
- package/dist/Table/Table.svelte.d.ts +3 -20
- package/dist/Table/properties.d.ts +5 -5
- package/dist/Toast/Toast.svelte +144 -76
- package/dist/Toast/Toast.svelte.d.ts +24 -23
- package/dist/Toast/properties.d.ts +10 -11
- package/dist/Toast/properties.js +1 -4
- package/dist/Toggle/Toggle.svelte +12 -11
- package/dist/Toggle/Toggle.svelte.d.ts +4 -21
- package/dist/Toggle/properties.d.ts +5 -0
- package/dist/Toggle/properties.js +1 -0
- package/dist/Toolbar/Toolbar.svelte +27 -20
- package/dist/Toolbar/Toolbar.svelte.d.ts +3 -26
- package/dist/Toolbar/properties.d.ts +10 -4
- package/dist/Toolbar/properties.js +1 -5
- package/dist/index.d.ts +0 -11
- package/dist/index.js +0 -11
- package/package.json +29 -29
|
@@ -1,166 +1,195 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onDestroy, onMount } from 'svelte';
|
|
3
|
+
import type { SelectProperties } from './properties';
|
|
4
|
+
import type { ButtonProperties } from '../Button/properties';
|
|
5
|
+
import Img from '../Img/Img.svelte';
|
|
6
|
+
import Button from '../Button/Button.svelte';
|
|
7
|
+
import CheckListItem from '../CheckListItem/CheckListItem.svelte';
|
|
8
|
+
|
|
9
|
+
let selectedElementDiv: HTMLDivElement | null = $state(null);
|
|
10
|
+
|
|
11
|
+
let {
|
|
12
|
+
dropDownIconAlt = '',
|
|
13
|
+
placeholder = '',
|
|
14
|
+
label = '',
|
|
15
|
+
allItems = [],
|
|
16
|
+
selectedItem = '',
|
|
17
|
+
selectedItemLabel = null,
|
|
18
|
+
showSelectedItemInDropdown = false,
|
|
19
|
+
selectMultipleItems = false,
|
|
20
|
+
hideDropDownIcon,
|
|
21
|
+
dropDownIcon,
|
|
22
|
+
leftIcon = null,
|
|
23
|
+
showSingleSelectButton,
|
|
24
|
+
showSelectedItem = true,
|
|
25
|
+
showSelectedItemCount = false,
|
|
26
|
+
testId,
|
|
27
|
+
labelTestId,
|
|
28
|
+
itemTestId,
|
|
29
|
+
leftContent,
|
|
30
|
+
bottomContent,
|
|
31
|
+
onselect,
|
|
32
|
+
ondropdownClick,
|
|
33
|
+
onkeydown
|
|
34
|
+
}: SelectProperties = $props();
|
|
35
|
+
|
|
36
|
+
const dropDownIconUrl = dropDownIcon ?? 'https://sdk.breeze.in/gallery/icons/down-arrow.svg';
|
|
37
|
+
|
|
38
|
+
let applyButtonProps: ButtonProperties = $derived({
|
|
39
|
+
text: `Select (${selectedItem.length})`,
|
|
40
|
+
enable: selectedItem.length > 0,
|
|
41
|
+
showLoader: false,
|
|
42
|
+
type: 'submit'
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const selectAllButtonProps: ButtonProperties = {
|
|
46
|
+
text: 'Select All',
|
|
47
|
+
enable: true,
|
|
25
48
|
showLoader: false,
|
|
26
|
-
|
|
27
|
-
type: "submit"
|
|
49
|
+
type: 'submit'
|
|
28
50
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
let isSelectOpen = false;
|
|
37
|
-
const dispatch = createEventDispatcher();
|
|
38
|
-
$:
|
|
39
|
-
nonSelectedItems = properties.allItems.filter(
|
|
40
|
-
(item) => properties.selectMultipleItems ? !properties.selectedItem.includes(item) : item !== properties.selectedItem
|
|
51
|
+
|
|
52
|
+
let isSelectOpen = $state(false);
|
|
53
|
+
|
|
54
|
+
let nonSelectedItems = $derived(
|
|
55
|
+
allItems.filter((item) =>
|
|
56
|
+
selectMultipleItems ? !selectedItem.includes(item) : item !== selectedItem
|
|
57
|
+
)
|
|
41
58
|
);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
59
|
+
|
|
60
|
+
function isSelected(selectedItem: string | string[], item: string) {
|
|
61
|
+
if (Array.isArray(selectedItem)) {
|
|
62
|
+
return selectedItem.includes(item);
|
|
63
|
+
} else {
|
|
64
|
+
return selectedItem.trim() === item.trim();
|
|
65
|
+
}
|
|
47
66
|
}
|
|
48
|
-
|
|
49
|
-
function selectItem(item) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
67
|
+
|
|
68
|
+
function selectItem(item: string) {
|
|
69
|
+
if (selectMultipleItems && Array.isArray(selectedItemLabel) && Array.isArray(selectedItem)) {
|
|
70
|
+
if (isSelected(selectedItem, item)) {
|
|
71
|
+
selectedItem = selectedItem.filter((selected) => selected !== item);
|
|
72
|
+
selectedItemLabel = selectedItemLabel.filter((label) => label !== item);
|
|
73
|
+
} else {
|
|
74
|
+
selectedItem = [...selectedItem, item];
|
|
75
|
+
selectedItemLabel = [...selectedItemLabel, item];
|
|
76
|
+
}
|
|
58
77
|
} else {
|
|
59
|
-
|
|
60
|
-
|
|
78
|
+
selectedItem = [item];
|
|
79
|
+
selectedItemLabel = [item];
|
|
80
|
+
}
|
|
81
|
+
if (!selectMultipleItems) {
|
|
82
|
+
toggleSelect();
|
|
83
|
+
dispatchEvent();
|
|
61
84
|
}
|
|
62
|
-
} else {
|
|
63
|
-
properties.selectedItem = [item];
|
|
64
|
-
properties.selectedItemLabel = [item];
|
|
65
85
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
86
|
+
|
|
87
|
+
function dispatchEvent() {
|
|
88
|
+
onselect?.({ selectedItems: selectedItem });
|
|
89
|
+
isSelectOpen = false;
|
|
69
90
|
}
|
|
70
|
-
|
|
71
|
-
function
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
function toggleSelect() {
|
|
76
|
-
isSelectOpen = !isSelectOpen;
|
|
77
|
-
dispatch("dropdownClick");
|
|
78
|
-
}
|
|
79
|
-
function selectAllItems() {
|
|
80
|
-
if (properties.selectedItem.length === properties.allItems.length) {
|
|
81
|
-
properties.selectedItem = [];
|
|
82
|
-
properties.selectedItemLabel = [];
|
|
83
|
-
} else {
|
|
84
|
-
properties.selectedItem = [...properties.allItems];
|
|
85
|
-
properties.selectedItemLabel = [...properties.allItems];
|
|
91
|
+
|
|
92
|
+
function toggleSelect() {
|
|
93
|
+
isSelectOpen = !isSelectOpen;
|
|
94
|
+
ondropdownClick?.();
|
|
86
95
|
}
|
|
87
|
-
|
|
88
|
-
function
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const isCheckListClicked = clickedElement.classList.contains("checkbox");
|
|
96
|
-
if (!isItemClicked && !isApplyButtonClicked && !isClearAllButtonClicked && !isSelectAllButtonClicked && !isCheckListClicked) {
|
|
97
|
-
isSelectOpen = false;
|
|
96
|
+
|
|
97
|
+
function selectAllItems() {
|
|
98
|
+
if (selectedItem.length === allItems.length) {
|
|
99
|
+
selectedItem = [];
|
|
100
|
+
selectedItemLabel = [];
|
|
101
|
+
} else {
|
|
102
|
+
selectedItem = [...allItems];
|
|
103
|
+
selectedItemLabel = [...allItems];
|
|
98
104
|
}
|
|
99
105
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
|
|
107
|
+
function closeSelect(event: Event) {
|
|
108
|
+
const clickedElement = event.target as HTMLElement;
|
|
109
|
+
if (selectedElementDiv !== null && !selectedElementDiv.contains(clickedElement)) {
|
|
110
|
+
const isItemClicked = clickedElement.classList.contains('item');
|
|
111
|
+
const isApplyButtonClicked = clickedElement.classList.contains('apply-btn');
|
|
112
|
+
const isClearAllButtonClicked = clickedElement.innerText === 'Clear All';
|
|
113
|
+
const isSelectAllButtonClicked = clickedElement.innerText === 'Select All';
|
|
114
|
+
const isCheckListClicked = clickedElement.classList.contains('checkbox');
|
|
115
|
+
if (
|
|
116
|
+
!isItemClicked &&
|
|
117
|
+
!isApplyButtonClicked &&
|
|
118
|
+
!isClearAllButtonClicked &&
|
|
119
|
+
!isSelectAllButtonClicked &&
|
|
120
|
+
!isCheckListClicked
|
|
121
|
+
) {
|
|
122
|
+
isSelectOpen = false;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
107
125
|
}
|
|
108
|
-
|
|
126
|
+
|
|
127
|
+
onMount(() => {
|
|
128
|
+
document.addEventListener('click', closeSelect);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
onDestroy(() => {
|
|
132
|
+
if (typeof window !== 'undefined') {
|
|
133
|
+
document.removeEventListener('click', closeSelect);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
109
136
|
</script>
|
|
110
137
|
|
|
111
|
-
{#if
|
|
112
|
-
<label class="label-container" for={
|
|
113
|
-
{
|
|
138
|
+
{#if label !== null && label !== ''}
|
|
139
|
+
<label class="label-container" for={label} data-pw={labelTestId}>
|
|
140
|
+
{label}
|
|
114
141
|
</label>
|
|
115
142
|
{/if}
|
|
116
143
|
|
|
117
|
-
{#if
|
|
144
|
+
{#if allItems.length !== 0}
|
|
118
145
|
<div class="select">
|
|
119
146
|
<div
|
|
120
147
|
class="selected item"
|
|
121
|
-
|
|
148
|
+
onclick={toggleSelect}
|
|
122
149
|
bind:this={selectedElementDiv}
|
|
123
|
-
|
|
150
|
+
{onkeydown}
|
|
124
151
|
role="button"
|
|
125
152
|
tabindex="0"
|
|
126
|
-
data-pw={
|
|
153
|
+
data-pw={testId}
|
|
127
154
|
>
|
|
128
|
-
{#if
|
|
155
|
+
{#if leftIcon !== null}
|
|
129
156
|
<div class="icon-container">
|
|
130
|
-
<Img {...
|
|
157
|
+
<Img {...leftIcon} />
|
|
131
158
|
</div>
|
|
132
|
-
|
|
159
|
+
{/if}
|
|
160
|
+
{#if leftContent}
|
|
161
|
+
{@render leftContent()}
|
|
133
162
|
{/if}
|
|
134
163
|
<div class="selected-content">
|
|
135
|
-
{#if
|
|
136
|
-
{#if
|
|
137
|
-
{
|
|
138
|
-
{:else if
|
|
139
|
-
{
|
|
140
|
-
{:else if
|
|
141
|
-
{
|
|
164
|
+
{#if selectMultipleItems && Array.isArray(selectedItemLabel) && Array.isArray(selectedItem)}
|
|
165
|
+
{#if selectedItem.length === 0}
|
|
166
|
+
{placeholder}
|
|
167
|
+
{:else if selectedItemLabel?.length === 0 || (showSelectedItemInDropdown && showSelectedItem !== false)}
|
|
168
|
+
{selectedItem.join(', ')}
|
|
169
|
+
{:else if showSelectedItem !== false}
|
|
170
|
+
{selectedItemLabel.join(', ')}
|
|
142
171
|
{:else}
|
|
143
|
-
{
|
|
172
|
+
{placeholder}
|
|
144
173
|
{/if}
|
|
145
|
-
{:else if
|
|
146
|
-
{
|
|
147
|
-
{:else if
|
|
148
|
-
{
|
|
149
|
-
{:else if
|
|
150
|
-
{
|
|
174
|
+
{:else if selectedItem === ''}
|
|
175
|
+
{placeholder}
|
|
176
|
+
{:else if selectedItemLabel === null || (selectedItemLabel === '' && showSelectedItem !== false)}
|
|
177
|
+
{selectedItem}
|
|
178
|
+
{:else if showSelectedItem !== false}
|
|
179
|
+
{selectedItemLabel}
|
|
151
180
|
{:else}
|
|
152
|
-
{
|
|
181
|
+
{placeholder}
|
|
153
182
|
{/if}
|
|
154
183
|
</div>
|
|
155
|
-
<div class="filler"
|
|
156
|
-
{#if
|
|
184
|
+
<div class="filler"></div>
|
|
185
|
+
{#if showSelectedItemCount && selectMultipleItems && Array.isArray(selectedItem)}
|
|
157
186
|
<div class="selected-item-count">
|
|
158
|
-
{
|
|
187
|
+
{selectedItem.length}
|
|
159
188
|
</div>
|
|
160
189
|
{/if}
|
|
161
|
-
{#if !
|
|
190
|
+
{#if !hideDropDownIcon}
|
|
162
191
|
<img
|
|
163
|
-
src={
|
|
192
|
+
src={dropDownIconUrl}
|
|
164
193
|
alt={dropDownIconAlt}
|
|
165
194
|
class="arrow {isSelectOpen ? 'active' : ''}"
|
|
166
195
|
/>
|
|
@@ -170,42 +199,41 @@ onDestroy(() => {
|
|
|
170
199
|
class="non-selected-items"
|
|
171
200
|
style="--non-selected-display:{isSelectOpen ? 'inline-block' : 'none'};"
|
|
172
201
|
>
|
|
173
|
-
{#if
|
|
202
|
+
{#if selectMultipleItems && !showSingleSelectButton}
|
|
174
203
|
<div class="select-all-btn">
|
|
175
204
|
<CheckListItem
|
|
176
|
-
checked={Array.isArray(
|
|
177
|
-
properties.selectedItem.length === properties.allItems.length}
|
|
205
|
+
checked={Array.isArray(selectedItem) && selectedItem.length === allItems.length}
|
|
178
206
|
text=""
|
|
179
|
-
|
|
207
|
+
onclick={selectAllItems}
|
|
180
208
|
/>
|
|
181
|
-
<Button
|
|
209
|
+
<Button {...selectAllButtonProps} onclick={selectAllItems} />
|
|
182
210
|
</div>
|
|
183
211
|
{/if}
|
|
184
212
|
<div class="item-list">
|
|
185
|
-
{#each
|
|
213
|
+
{#each showSelectedItemInDropdown ? allItems : nonSelectedItems as item (item)}
|
|
186
214
|
<div
|
|
187
|
-
|
|
188
|
-
|
|
215
|
+
{onkeydown}
|
|
216
|
+
onclick={() => {
|
|
189
217
|
selectItem(item);
|
|
190
218
|
}}
|
|
191
|
-
class="item {isSelected(
|
|
219
|
+
class="item {isSelected(selectedItem, item) ? ' item-selected' : ''}"
|
|
192
220
|
role="button"
|
|
193
221
|
tabindex="0"
|
|
194
|
-
data-pw={`${
|
|
222
|
+
data-pw={`${itemTestId}-${item}`}
|
|
195
223
|
>
|
|
196
|
-
{#if
|
|
197
|
-
<CheckListItem checked={isSelected(
|
|
224
|
+
{#if selectMultipleItems}
|
|
225
|
+
<CheckListItem checked={isSelected(selectedItem, item)} text="" />
|
|
198
226
|
{/if}
|
|
199
227
|
{item}
|
|
200
228
|
</div>
|
|
201
229
|
{/each}
|
|
202
230
|
</div>
|
|
203
|
-
{#if
|
|
204
|
-
|
|
231
|
+
{#if bottomContent}
|
|
232
|
+
{@render bottomContent()}
|
|
205
233
|
{/if}
|
|
206
|
-
{#if
|
|
234
|
+
{#if selectMultipleItems}
|
|
207
235
|
<div class="apply-btn-container">
|
|
208
|
-
<Button
|
|
236
|
+
<Button {...applyButtonProps} onclick={dispatchEvent} />
|
|
209
237
|
</div>
|
|
210
238
|
{/if}
|
|
211
239
|
</div>
|
|
@@ -1,27 +1,4 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { SelectProperties } from './properties';
|
|
3
|
-
declare const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
properties?: SelectProperties;
|
|
7
|
-
};
|
|
8
|
-
events: {
|
|
9
|
-
keydown: KeyboardEvent;
|
|
10
|
-
message: CustomEvent<any>;
|
|
11
|
-
dropdownClick: CustomEvent<any>;
|
|
12
|
-
} & {
|
|
13
|
-
[evt: string]: CustomEvent<any>;
|
|
14
|
-
};
|
|
15
|
-
slots: {
|
|
16
|
-
leftContent: {};
|
|
17
|
-
bottomContent: {};
|
|
18
|
-
};
|
|
19
|
-
exports?: {} | undefined;
|
|
20
|
-
bindings?: string | undefined;
|
|
21
|
-
};
|
|
22
|
-
export type SelectProps = typeof __propDef.props;
|
|
23
|
-
export type SelectEvents = typeof __propDef.events;
|
|
24
|
-
export type SelectSlots = typeof __propDef.slots;
|
|
25
|
-
export default class Select extends SvelteComponent<SelectProps, SelectEvents, SelectSlots> {
|
|
26
|
-
}
|
|
27
|
-
export {};
|
|
2
|
+
declare const Select: import("svelte").Component<SelectProperties, {}, "">;
|
|
3
|
+
type Select = ReturnType<typeof Select>;
|
|
4
|
+
export default Select;
|
|
@@ -1,19 +1,28 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { ImgProperties } from '../Img/properties';
|
|
2
3
|
export type SelectProperties = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
dropDownIconAlt?: string;
|
|
5
|
+
placeholder?: string | null;
|
|
6
|
+
label?: string | null;
|
|
7
|
+
allItems?: string[];
|
|
8
|
+
selectedItem?: string | string[];
|
|
9
|
+
selectedItemLabel?: string | string[] | null;
|
|
10
|
+
showSelectedItemInDropdown?: boolean;
|
|
11
|
+
selectMultipleItems?: boolean;
|
|
10
12
|
hideDropDownIcon?: boolean;
|
|
11
13
|
dropDownIcon?: string;
|
|
12
|
-
leftIcon
|
|
13
|
-
showSingleSelectButton?: boolean
|
|
14
|
+
leftIcon?: ImgProperties | null;
|
|
15
|
+
showSingleSelectButton?: boolean;
|
|
14
16
|
showSelectedItem?: boolean;
|
|
15
17
|
showSelectedItemCount?: boolean;
|
|
16
18
|
testId?: string;
|
|
17
19
|
labelTestId?: string;
|
|
18
20
|
itemTestId?: string;
|
|
21
|
+
leftContent?: Snippet;
|
|
22
|
+
bottomContent?: Snippet;
|
|
23
|
+
onselect?: (event: {
|
|
24
|
+
selectedItems: string | string[];
|
|
25
|
+
}) => void;
|
|
26
|
+
ondropdownClick?: () => void;
|
|
27
|
+
onkeydown?: (event: KeyboardEvent) => void;
|
|
19
28
|
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { StatusProperties } from './properties';
|
|
3
|
+
import Button from '../Button/Button.svelte';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
5
|
+
let {
|
|
6
|
+
statusIcon = 'icons/order-success-icon.svg',
|
|
7
|
+
statusText = '',
|
|
8
|
+
statusDescription = '',
|
|
9
|
+
buttonProperties,
|
|
10
|
+
onbuttonClick
|
|
11
|
+
}: StatusProperties = $props();
|
|
12
12
|
</script>
|
|
13
13
|
|
|
14
14
|
<div class="background">
|
|
15
15
|
<div class="order-status">
|
|
16
|
-
<div class="status-image"><img src={
|
|
17
|
-
<div class="status-text">{
|
|
16
|
+
<div class="status-image"><img src={statusIcon} alt="status" /></div>
|
|
17
|
+
<div class="status-text">{statusText}</div>
|
|
18
18
|
<div class="status-description">
|
|
19
19
|
<!-- eslint-disable-next-line -->
|
|
20
|
-
{@html
|
|
20
|
+
{@html statusDescription}
|
|
21
21
|
</div>
|
|
22
|
-
{#if
|
|
23
|
-
<Button
|
|
22
|
+
{#if buttonProperties}
|
|
23
|
+
<Button {...buttonProperties} onclick={onbuttonClick} />
|
|
24
24
|
{/if}
|
|
25
25
|
</div>
|
|
26
26
|
</div>
|
|
@@ -1,22 +1,4 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
|
-
export declare const prerender = true;
|
|
3
1
|
import type { StatusProperties } from './properties';
|
|
4
|
-
declare const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
events: {
|
|
9
|
-
buttonClick: CustomEvent<any>;
|
|
10
|
-
} & {
|
|
11
|
-
[evt: string]: CustomEvent<any>;
|
|
12
|
-
};
|
|
13
|
-
slots: {};
|
|
14
|
-
exports?: {} | undefined;
|
|
15
|
-
bindings?: string | undefined;
|
|
16
|
-
};
|
|
17
|
-
export type StatusProps = typeof __propDef.props;
|
|
18
|
-
export type StatusEvents = typeof __propDef.events;
|
|
19
|
-
export type StatusSlots = typeof __propDef.slots;
|
|
20
|
-
export default class Status extends SvelteComponent<StatusProps, StatusEvents, StatusSlots> {
|
|
21
|
-
}
|
|
22
|
-
export {};
|
|
2
|
+
declare const Status: import("svelte").Component<StatusProperties, {}, "">;
|
|
3
|
+
type Status = ReturnType<typeof Status>;
|
|
4
|
+
export default Status;
|
|
@@ -3,6 +3,6 @@ export type StatusProperties = {
|
|
|
3
3
|
statusIcon: string;
|
|
4
4
|
statusText: string;
|
|
5
5
|
statusDescription: string;
|
|
6
|
-
buttonProperties
|
|
6
|
+
buttonProperties?: ButtonProperties;
|
|
7
|
+
onbuttonClick?: () => void;
|
|
7
8
|
};
|
|
8
|
-
export declare const defaultStatusProperties: StatusProperties;
|
package/dist/Stepper/Step.svelte
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function handleStepClick() {
|
|
7
|
-
|
|
8
|
-
}
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { StepProperties } from './properties';
|
|
3
|
+
|
|
4
|
+
let { stepIndex, label, icon, onclick, onkeydown }: StepProperties = $props();
|
|
5
|
+
|
|
6
|
+
function handleStepClick() {
|
|
7
|
+
onclick?.({ selectedIndex: stepIndex });
|
|
8
|
+
}
|
|
9
9
|
</script>
|
|
10
10
|
|
|
11
|
-
<div class="step"
|
|
12
|
-
{#if icon
|
|
11
|
+
<div class="step" onclick={handleStepClick} {onkeydown} role="button" tabindex="0">
|
|
12
|
+
{#if icon}
|
|
13
13
|
<div class="step-icon-container">
|
|
14
14
|
<img class="step-icon" src={icon} alt="" />
|
|
15
15
|
</div>
|
|
16
16
|
{:else}
|
|
17
17
|
<div class="step-index-container">
|
|
18
|
-
<div class=
|
|
18
|
+
<div class="step-index-text">
|
|
19
19
|
{stepIndex}
|
|
20
20
|
</div>
|
|
21
21
|
</div>
|
|
22
22
|
{/if}
|
|
23
|
-
<div class=
|
|
23
|
+
<div class="step-text">
|
|
24
24
|
{label}
|
|
25
25
|
</div>
|
|
26
|
-
<div class=
|
|
26
|
+
<div class="separator"></div>
|
|
27
27
|
</div>
|
|
28
28
|
|
|
29
29
|
<style>
|
|
@@ -1,23 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
label: string;
|
|
6
|
-
icon: string | null;
|
|
7
|
-
};
|
|
8
|
-
events: {
|
|
9
|
-
keydown: KeyboardEvent;
|
|
10
|
-
handleStepClick: CustomEvent<any>;
|
|
11
|
-
} & {
|
|
12
|
-
[evt: string]: CustomEvent<any>;
|
|
13
|
-
};
|
|
14
|
-
slots: {};
|
|
15
|
-
exports?: {} | undefined;
|
|
16
|
-
bindings?: string | undefined;
|
|
17
|
-
};
|
|
18
|
-
export type StepProps = typeof __propDef.props;
|
|
19
|
-
export type StepEvents = typeof __propDef.events;
|
|
20
|
-
export type StepSlots = typeof __propDef.slots;
|
|
21
|
-
export default class Step extends SvelteComponent<StepProps, StepEvents, StepSlots> {
|
|
22
|
-
}
|
|
23
|
-
export {};
|
|
1
|
+
import type { StepProperties } from './properties';
|
|
2
|
+
declare const Step: import("svelte").Component<StepProperties, {}, "">;
|
|
3
|
+
type Step = ReturnType<typeof Step>;
|
|
4
|
+
export default Step;
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { StepperProperties } from './properties';
|
|
3
|
+
import Step from './Step.svelte';
|
|
4
|
+
|
|
5
|
+
let { steps, currentStepIndex, onhandleStepClick }: StepperProperties = $props();
|
|
3
6
|
</script>
|
|
4
7
|
|
|
5
8
|
<div class="container">
|
|
6
|
-
{#each
|
|
9
|
+
{#each steps as currentStep, stepIndex}
|
|
7
10
|
<div
|
|
8
|
-
class:active-step={
|
|
9
|
-
class:completed-step={
|
|
11
|
+
class:active-step={currentStepIndex === stepIndex}
|
|
12
|
+
class:completed-step={currentStepIndex > stepIndex}
|
|
10
13
|
class="step-container"
|
|
11
14
|
>
|
|
12
15
|
<Step
|
|
13
|
-
|
|
16
|
+
onclick={onhandleStepClick}
|
|
14
17
|
label={currentStep.label}
|
|
15
|
-
icon={currentStep.icon
|
|
18
|
+
icon={currentStep.icon}
|
|
16
19
|
stepIndex={stepIndex + 1}
|
|
17
20
|
/>
|
|
18
21
|
</div>
|