@juspay/svelte-ui-components 2.28.2 → 2.29.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/Banner/Banner.svelte +34 -7
- package/dist/Banner/properties.d.ts +2 -0
- package/dist/Breadcrumb/Breadcrumb.svelte +58 -0
- package/dist/Breadcrumb/Breadcrumb.svelte.d.ts +4 -0
- package/dist/Breadcrumb/properties.d.ts +19 -0
- package/dist/Breadcrumb/properties.js +1 -0
- package/dist/Calendar/Calendar.svelte +10 -4
- package/dist/Calendar/properties.d.ts +2 -0
- package/dist/DateRangePicker/DateRangePicker.svelte +627 -0
- package/dist/DateRangePicker/DateRangePicker.svelte.d.ts +4 -0
- package/dist/DateRangePicker/properties.d.ts +74 -0
- package/dist/DateRangePicker/properties.js +1 -0
- package/dist/EmptyState/EmptyState.svelte +3 -1
- package/dist/EmptyState/properties.d.ts +1 -1
- package/dist/FileInput/FileInput.svelte +176 -0
- package/dist/FileInput/FileInput.svelte.d.ts +4 -0
- package/dist/FileInput/properties.d.ts +18 -0
- package/dist/FileInput/properties.js +1 -0
- package/dist/Modal/Modal.svelte +5 -4
- package/dist/Pagination/Pagination.svelte +56 -11
- package/dist/Pagination/properties.d.ts +15 -0
- package/dist/Pill/Pill.svelte +10 -0
- package/dist/Pill/properties.d.ts +7 -0
- package/dist/Select/Select.svelte +77 -30
- package/dist/Select/Select.svelte.d.ts +1 -1
- package/dist/Select/properties.d.ts +12 -1
- package/dist/Sheet/Sheet.svelte +16 -0
- package/dist/Sheet/properties.d.ts +4 -0
- package/dist/Table/Table.svelte +28 -6
- package/dist/Table/properties.d.ts +6 -0
- package/dist/Tabs/Tabs.svelte +52 -8
- package/dist/index.d.ts +6 -0
- package/dist/index.js +3 -0
- package/package.json +1 -1
|
@@ -15,11 +15,15 @@
|
|
|
15
15
|
dismissIcon,
|
|
16
16
|
onclick,
|
|
17
17
|
ondismiss,
|
|
18
|
-
classes
|
|
18
|
+
classes,
|
|
19
|
+
title,
|
|
20
|
+
role = null
|
|
19
21
|
}: BannerProperties = $props();
|
|
20
22
|
|
|
21
23
|
let interactive = $derived(typeof onclick === 'function');
|
|
22
24
|
|
|
25
|
+
let rootClass = $derived(['banner', classes ?? ''].filter((c) => c.length > 0).join(' '));
|
|
26
|
+
|
|
23
27
|
function handleClick(event: MouseEvent): void {
|
|
24
28
|
onclick?.(event);
|
|
25
29
|
}
|
|
@@ -43,10 +47,10 @@
|
|
|
43
47
|
{#if visible}
|
|
44
48
|
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
|
|
45
49
|
<div
|
|
46
|
-
class=
|
|
50
|
+
class={rootClass}
|
|
47
51
|
onclick={interactive ? handleClick : null}
|
|
48
52
|
onkeydown={interactive ? handleKeydown : null}
|
|
49
|
-
role={interactive ? 'button' : null}
|
|
53
|
+
role={role !== null ? role : interactive ? 'button' : null}
|
|
50
54
|
tabindex={interactive ? 0 : null}
|
|
51
55
|
data-pw={typeof testId === 'string' ? testId : null}
|
|
52
56
|
transition:slide={{ duration: 300 }}
|
|
@@ -56,11 +60,18 @@
|
|
|
56
60
|
{@render icon()}
|
|
57
61
|
</div>
|
|
58
62
|
{/if}
|
|
59
|
-
<div class="banner-
|
|
60
|
-
{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
<div class="banner-body">
|
|
64
|
+
{#if typeof title === 'function'}
|
|
65
|
+
<div class="banner-title">
|
|
66
|
+
{@render title()}
|
|
67
|
+
</div>
|
|
63
68
|
{/if}
|
|
69
|
+
<div class="banner-text">
|
|
70
|
+
{text}
|
|
71
|
+
{#if typeof linkText === 'string' && linkText.length > 0}
|
|
72
|
+
<span class="banner-link-text">{linkText}</span>
|
|
73
|
+
{/if}
|
|
74
|
+
</div>
|
|
64
75
|
</div>
|
|
65
76
|
{#if typeof rightContent === 'function'}
|
|
66
77
|
<div class="banner-right">
|
|
@@ -102,6 +113,8 @@
|
|
|
102
113
|
font-weight: var(--banner-font-weight, 500);
|
|
103
114
|
line-height: var(--banner-line-height, 1.3);
|
|
104
115
|
border-bottom: var(--banner-border-bottom, none);
|
|
116
|
+
border: var(--banner-border);
|
|
117
|
+
border-radius: var(--banner-border-radius, 0);
|
|
105
118
|
cursor: var(--banner-cursor, pointer);
|
|
106
119
|
position: var(--banner-position, sticky);
|
|
107
120
|
top: var(--banner-top, 0);
|
|
@@ -121,6 +134,20 @@
|
|
|
121
134
|
height: var(--banner-icon-size, 18px);
|
|
122
135
|
}
|
|
123
136
|
|
|
137
|
+
.banner-body {
|
|
138
|
+
display: flex;
|
|
139
|
+
flex-direction: column;
|
|
140
|
+
overflow: hidden;
|
|
141
|
+
gap: var(--banner-body-gap, 0);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.banner-title {
|
|
145
|
+
font-weight: var(--banner-title-font-weight, inherit);
|
|
146
|
+
overflow: hidden;
|
|
147
|
+
text-overflow: ellipsis;
|
|
148
|
+
white-space: nowrap;
|
|
149
|
+
}
|
|
150
|
+
|
|
124
151
|
.banner-text {
|
|
125
152
|
overflow: var(--banner-text-overflow, hidden);
|
|
126
153
|
text-overflow: var(--banner-text-ellipsis, ellipsis);
|
|
@@ -5,6 +5,7 @@ export type MandatoryBannerProperties = {
|
|
|
5
5
|
};
|
|
6
6
|
export type OptionalBannerProperties = {
|
|
7
7
|
icon?: Snippet;
|
|
8
|
+
title?: Snippet;
|
|
8
9
|
linkText?: string;
|
|
9
10
|
dismissible?: boolean;
|
|
10
11
|
visible?: boolean;
|
|
@@ -12,6 +13,7 @@ export type OptionalBannerProperties = {
|
|
|
12
13
|
rightContent?: Snippet;
|
|
13
14
|
dismissIcon?: Snippet;
|
|
14
15
|
classes?: string;
|
|
16
|
+
role?: string | null;
|
|
15
17
|
};
|
|
16
18
|
export type BannerEventProperties = {
|
|
17
19
|
onclick?: (event: MouseEvent) => void;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { BreadcrumbProperties } from './properties';
|
|
3
|
+
|
|
4
|
+
let { items, item, ariaLabel, separator, classes, testId }: BreadcrumbProperties = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<nav
|
|
8
|
+
class="breadcrumb {classes ?? ''}"
|
|
9
|
+
aria-label={ariaLabel}
|
|
10
|
+
data-pw={typeof testId === 'string' ? testId : null}
|
|
11
|
+
>
|
|
12
|
+
<ol class="breadcrumb-list">
|
|
13
|
+
{#each items as crumb, index (index)}
|
|
14
|
+
<li class="breadcrumb-item">
|
|
15
|
+
{#if typeof item === 'function'}
|
|
16
|
+
{@render item({
|
|
17
|
+
href: crumb.href,
|
|
18
|
+
label: crumb.label,
|
|
19
|
+
isLast: index === items.length - 1,
|
|
20
|
+
index
|
|
21
|
+
})}
|
|
22
|
+
{/if}
|
|
23
|
+
</li>
|
|
24
|
+
{#if index < items.length - 1}
|
|
25
|
+
<li class="breadcrumb-separator" aria-hidden="true">
|
|
26
|
+
{#if typeof separator === 'function'}
|
|
27
|
+
{@render separator()}
|
|
28
|
+
{:else}
|
|
29
|
+
/
|
|
30
|
+
{/if}
|
|
31
|
+
</li>
|
|
32
|
+
{/if}
|
|
33
|
+
{/each}
|
|
34
|
+
</ol>
|
|
35
|
+
</nav>
|
|
36
|
+
|
|
37
|
+
<style>
|
|
38
|
+
.breadcrumb-list {
|
|
39
|
+
display: flex;
|
|
40
|
+
list-style: none;
|
|
41
|
+
padding: 0;
|
|
42
|
+
margin: 0;
|
|
43
|
+
gap: var(--breadcrumb-list-gap);
|
|
44
|
+
flex-wrap: var(--breadcrumb-flex-wrap, nowrap);
|
|
45
|
+
align-items: center;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.breadcrumb-item {
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.breadcrumb-separator {
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
color: var(--breadcrumb-separator-color, currentColor);
|
|
57
|
+
}
|
|
58
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
export type BreadcrumbItemData = {
|
|
3
|
+
href: string;
|
|
4
|
+
label: string;
|
|
5
|
+
};
|
|
6
|
+
export type BreadcrumbItemContext = {
|
|
7
|
+
href: string;
|
|
8
|
+
label: string;
|
|
9
|
+
isLast: boolean;
|
|
10
|
+
index: number;
|
|
11
|
+
};
|
|
12
|
+
export type BreadcrumbProperties = {
|
|
13
|
+
items: readonly BreadcrumbItemData[];
|
|
14
|
+
item: Snippet<[BreadcrumbItemContext]>;
|
|
15
|
+
ariaLabel: string;
|
|
16
|
+
separator?: Snippet;
|
|
17
|
+
classes?: string;
|
|
18
|
+
testId?: string;
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { CalendarProperties } from './properties';
|
|
3
3
|
import { SvelteDate } from 'svelte/reactivity';
|
|
4
|
-
import { tick } from 'svelte';
|
|
4
|
+
import { tick, untrack } from 'svelte';
|
|
5
5
|
import chevronLeftSvg from '../assets/chevron-left.svg?raw';
|
|
6
6
|
import chevronRightSvg from '../assets/chevron-right.svg?raw';
|
|
7
7
|
import Button from '../Button/Button.svelte';
|
|
@@ -22,11 +22,17 @@
|
|
|
22
22
|
onselect,
|
|
23
23
|
onrangeselect,
|
|
24
24
|
onmonthchange,
|
|
25
|
-
classes
|
|
25
|
+
classes,
|
|
26
|
+
initialMonth = null
|
|
26
27
|
}: CalendarProperties = $props();
|
|
27
28
|
|
|
28
29
|
const now = new SvelteDate();
|
|
29
|
-
|
|
30
|
+
// Intentionally read initialMonth once (untracked) — it seeds the display month at mount
|
|
31
|
+
// and subsequent prop changes should not navigate the calendar (user navigates via the buttons).
|
|
32
|
+
let displayDate = untrack(() => {
|
|
33
|
+
const seed = initialMonth !== null ? initialMonth : now;
|
|
34
|
+
return new SvelteDate(seed.getFullYear(), seed.getMonth(), 1);
|
|
35
|
+
});
|
|
30
36
|
let focusedDay: number | null = $state(null);
|
|
31
37
|
|
|
32
38
|
let gridRef: HTMLElement | null = $state(null);
|
|
@@ -359,7 +365,7 @@
|
|
|
359
365
|
}
|
|
360
366
|
|
|
361
367
|
.header {
|
|
362
|
-
display: flex;
|
|
368
|
+
display: var(--calendar-header-display, flex);
|
|
363
369
|
align-items: center;
|
|
364
370
|
justify-content: space-between;
|
|
365
371
|
margin-bottom: var(--calendar-header-margin-bottom, 12px);
|
|
@@ -14,6 +14,8 @@ export type OptionalCalendarProperties = {
|
|
|
14
14
|
previousMonthIcon?: Snippet;
|
|
15
15
|
nextMonthIcon?: Snippet;
|
|
16
16
|
classes?: string;
|
|
17
|
+
/** The month to display initially (only year+month are used). Defaults to the current month. */
|
|
18
|
+
initialMonth?: Date | null;
|
|
17
19
|
};
|
|
18
20
|
export type CalendarEventProperties = {
|
|
19
21
|
onselect?: (event: {
|