@juspay/svelte-ui-components 2.112.0 → 2.113.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/FileDropzoneTrigger/FileDropzoneTrigger.svelte +81 -0
- package/dist/FileDropzoneTrigger/FileDropzoneTrigger.svelte.d.ts +4 -0
- package/dist/FileDropzoneTrigger/properties.d.ts +24 -0
- package/dist/FileDropzoneTrigger/properties.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Button from '../Button/Button.svelte';
|
|
3
|
+
import Img from '../Img/Img.svelte';
|
|
4
|
+
import type { FileDropzoneTriggerProperties } from './properties';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
icon,
|
|
8
|
+
heading,
|
|
9
|
+
caption,
|
|
10
|
+
compact = false,
|
|
11
|
+
onclick,
|
|
12
|
+
testId,
|
|
13
|
+
classes
|
|
14
|
+
}: FileDropzoneTriggerProperties = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
{#if compact}
|
|
18
|
+
<div class="file-dropzone-trigger-compact {classes ?? ''}">
|
|
19
|
+
<div class="file-dropzone-trigger-icon-sm" aria-hidden="true">
|
|
20
|
+
<Img src={icon} alt="" fallback="" classes="file-dropzone-trigger-icon-sm-img" />
|
|
21
|
+
</div>
|
|
22
|
+
<span class="file-dropzone-trigger-heading" data-pw={testId} testID={testId}>{heading}</span>
|
|
23
|
+
</div>
|
|
24
|
+
{:else}
|
|
25
|
+
<Button
|
|
26
|
+
classes={`file-dropzone-trigger-button ${classes ?? ''}`}
|
|
27
|
+
{onclick}
|
|
28
|
+
{...typeof testId === 'string' ? { testId } : {}}
|
|
29
|
+
>
|
|
30
|
+
<div class="file-dropzone-trigger-icon" aria-hidden="true">
|
|
31
|
+
<Img src={icon} alt="" fallback="" classes="file-dropzone-trigger-icon-img" />
|
|
32
|
+
</div>
|
|
33
|
+
<p class="file-dropzone-trigger-heading-wrap">
|
|
34
|
+
<span class="file-dropzone-trigger-heading">{heading}</span>
|
|
35
|
+
</p>
|
|
36
|
+
{#if caption}
|
|
37
|
+
<p class="file-dropzone-trigger-caption">{caption}</p>
|
|
38
|
+
{/if}
|
|
39
|
+
</Button>
|
|
40
|
+
{/if}
|
|
41
|
+
|
|
42
|
+
<style>
|
|
43
|
+
.file-dropzone-trigger-compact {
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: var(--file-dropzone-trigger-compact-flex-direction, row);
|
|
46
|
+
align-items: var(--file-dropzone-trigger-compact-align-items, center);
|
|
47
|
+
gap: var(--file-dropzone-trigger-compact-gap, 8px);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.file-dropzone-trigger-icon-sm,
|
|
51
|
+
.file-dropzone-trigger-icon {
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.file-dropzone-trigger-icon-sm :global(.file-dropzone-trigger-icon-sm-img) {
|
|
58
|
+
--image-width: var(--file-dropzone-trigger-icon-sm-size, 16px);
|
|
59
|
+
--image-height: var(--file-dropzone-trigger-icon-sm-size, 16px);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.file-dropzone-trigger-icon :global(.file-dropzone-trigger-icon-img) {
|
|
63
|
+
--image-width: var(--file-dropzone-trigger-icon-size, 24px);
|
|
64
|
+
--image-height: var(--file-dropzone-trigger-icon-size, 24px);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.file-dropzone-trigger-heading {
|
|
68
|
+
color: var(--file-dropzone-trigger-heading-color, inherit);
|
|
69
|
+
font-weight: var(--file-dropzone-trigger-heading-font-weight, 600);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.file-dropzone-trigger-heading-wrap {
|
|
73
|
+
margin: var(--file-dropzone-trigger-heading-margin, 0);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.file-dropzone-trigger-caption {
|
|
77
|
+
margin: var(--file-dropzone-trigger-caption-margin, 0);
|
|
78
|
+
color: var(--file-dropzone-trigger-caption-color, #64748b);
|
|
79
|
+
font-size: var(--file-dropzone-trigger-caption-font-size, 0.85em);
|
|
80
|
+
}
|
|
81
|
+
</style>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { FileDropzoneTriggerProperties } from './properties';
|
|
2
|
+
declare const FileDropzoneTrigger: import("svelte").Component<FileDropzoneTriggerProperties, {}, "">;
|
|
3
|
+
type FileDropzoneTrigger = ReturnType<typeof FileDropzoneTrigger>;
|
|
4
|
+
export default FileDropzoneTrigger;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type FileDropzoneTriggerProperties = MandatoryFileDropzoneTriggerProperties & OptionalFileDropzoneTriggerProperties & FileDropzoneTriggerEventProperties;
|
|
2
|
+
export type MandatoryFileDropzoneTriggerProperties = {
|
|
3
|
+
/** Upload icon asset, rendered through the library `Img` component. */
|
|
4
|
+
icon: string;
|
|
5
|
+
/** Primary call-to-action text (static copy, or a dynamic file name once selected). */
|
|
6
|
+
heading: string;
|
|
7
|
+
};
|
|
8
|
+
export type OptionalFileDropzoneTriggerProperties = {
|
|
9
|
+
/** Secondary line below the heading (accepted file type / size limit). Non-compact only. */
|
|
10
|
+
caption?: string;
|
|
11
|
+
/** Bare icon + heading with no Button wrapper or caption, for inline/compact trigger placements. */
|
|
12
|
+
compact?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Non-compact: forwarded to the inner `Button`. Compact: applied to the heading `<span>`.
|
|
15
|
+
* Emits both `data-pw` and `testID` on that element.
|
|
16
|
+
*/
|
|
17
|
+
testId?: string;
|
|
18
|
+
/** CSS class applied to the root element — the inner `Button` in non-compact, the icon+heading wrapper in compact. */
|
|
19
|
+
classes?: string;
|
|
20
|
+
};
|
|
21
|
+
export type FileDropzoneTriggerEventProperties = {
|
|
22
|
+
/** Wire to `FileInput`'s `openFilePicker`. Non-compact only — compact relies on `FileInput`'s own whole-area click/drop handling. */
|
|
23
|
+
onclick?: () => void;
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -76,6 +76,7 @@ export { default as DualAxisBarChart } from './DualAxisBarChart/DualAxisBarChart
|
|
|
76
76
|
export { default as FunnelChart } from './FunnelChart/FunnelChart.svelte';
|
|
77
77
|
export { default as ProportionBar } from './ProportionBar/ProportionBar.svelte';
|
|
78
78
|
export { default as ChipInput } from './ChipInput/ChipInput.svelte';
|
|
79
|
+
export { default as FileDropzoneTrigger } from './FileDropzoneTrigger/FileDropzoneTrigger.svelte';
|
|
79
80
|
export type * from './Button/properties';
|
|
80
81
|
export type * from './Modal/properties';
|
|
81
82
|
export type * from './Input/properties';
|
|
@@ -148,6 +149,7 @@ export type * from './DualAxisBarChart/properties';
|
|
|
148
149
|
export type * from './FunnelChart/properties';
|
|
149
150
|
export type * from './ProportionBar/properties';
|
|
150
151
|
export type * from './ChipInput/properties';
|
|
152
|
+
export type * from './FileDropzoneTrigger/properties';
|
|
151
153
|
export type * from './_chart/highlight';
|
|
152
154
|
export { validateInput } from './utils';
|
|
153
155
|
export { formatNumberIndian } from './_chart/format';
|
package/dist/index.js
CHANGED
|
@@ -76,5 +76,6 @@ export { default as DualAxisBarChart } from './DualAxisBarChart/DualAxisBarChart
|
|
|
76
76
|
export { default as FunnelChart } from './FunnelChart/FunnelChart.svelte';
|
|
77
77
|
export { default as ProportionBar } from './ProportionBar/ProportionBar.svelte';
|
|
78
78
|
export { default as ChipInput } from './ChipInput/ChipInput.svelte';
|
|
79
|
+
export { default as FileDropzoneTrigger } from './FileDropzoneTrigger/FileDropzoneTrigger.svelte';
|
|
79
80
|
export { validateInput } from './utils';
|
|
80
81
|
export { formatNumberIndian } from './_chart/format';
|