@juspay/svelte-ui-components 2.112.0 → 2.114.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.
@@ -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 {};
@@ -21,6 +21,7 @@
21
21
  footer,
22
22
  debounceTime = 700,
23
23
  leftImageTestId,
24
+ leftImageAriaLabel,
24
25
  testId,
25
26
  content,
26
27
  footerSnippet,
@@ -162,6 +163,7 @@
162
163
  onkeydown={handleLeftImageKeyDown}
163
164
  role="button"
164
165
  tabindex="0"
166
+ aria-label={leftImageAriaLabel ?? null}
165
167
  data-pw={leftImageTestId}
166
168
  testID={leftImageTestId}
167
169
  >
@@ -187,6 +189,7 @@
187
189
  tabindex="0"
188
190
  onclick={handleRightImageClick}
189
191
  onkeydown={handleRightImageKeyDown}
192
+ aria-label={header.buttonAriaLabel ?? null}
190
193
  data-pw={header.buttonTestId}
191
194
  testID={header.buttonTestId}
192
195
  >
@@ -17,6 +17,8 @@ export type OptionalModalProperties = {
17
17
  text?: string;
18
18
  testId?: string;
19
19
  buttonTestId?: string;
20
+ /** Accessible name for the right header image's role="button" wrapper (e.g. a close control). Rendered as aria-label. */
21
+ buttonAriaLabel?: string;
20
22
  };
21
23
  footer?: {
22
24
  primaryButton?: ButtonProperties;
@@ -24,6 +26,8 @@ export type OptionalModalProperties = {
24
26
  };
25
27
  debounceTime?: number;
26
28
  leftImageTestId?: string;
29
+ /** Accessible name for the left header image's role="button" wrapper (e.g. a back control). Rendered as aria-label. */
30
+ leftImageAriaLabel?: string;
27
31
  testId?: string;
28
32
  content?: Snippet;
29
33
  footerSnippet?: Snippet;
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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/svelte-ui-components",
3
- "version": "2.112.0",
3
+ "version": "2.114.0",
4
4
  "description": "A themeable Svelte 5 UI component library with CSS custom property driven styling",
5
5
  "keywords": [
6
6
  "svelte",