@juspay/svelte-ui-components 1.34.1 → 1.34.2

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.
Files changed (89) hide show
  1. package/dist/Accordion/Accordion.svelte +17 -30
  2. package/dist/Accordion/Accordion.svelte.d.ts +6 -20
  3. package/dist/Animations/ModalAnimation.svelte +44 -30
  4. package/dist/Animations/ModalAnimation.svelte.d.ts +9 -21
  5. package/dist/Animations/OverlayAnimation.svelte +9 -2
  6. package/dist/Animations/OverlayAnimation.svelte.d.ts +6 -28
  7. package/dist/Badge/Badge.svelte +9 -8
  8. package/dist/Badge/Badge.svelte.d.ts +3 -18
  9. package/dist/Banner/Banner.svelte +20 -19
  10. package/dist/Banner/Banner.svelte.d.ts +3 -23
  11. package/dist/Banner/properties.d.ts +6 -2
  12. package/dist/BrandLoader/BrandLoader.svelte +11 -12
  13. package/dist/BrandLoader/BrandLoader.svelte.d.ts +3 -19
  14. package/dist/BrandLoader/properties.d.ts +1 -4
  15. package/dist/BrandLoader/properties.js +1 -7
  16. package/dist/Button/Button.svelte +38 -27
  17. package/dist/Button/Button.svelte.d.ts +4 -23
  18. package/dist/Button/properties.d.ts +9 -5
  19. package/dist/Button/properties.js +1 -7
  20. package/dist/Carousel/Carousel.svelte +132 -108
  21. package/dist/Carousel/Carousel.svelte.d.ts +3 -20
  22. package/dist/Carousel/properties.d.ts +6 -12
  23. package/dist/Carousel/properties.js +1 -7
  24. package/dist/CheckListItem/CheckListItem.svelte +18 -12
  25. package/dist/CheckListItem/CheckListItem.svelte.d.ts +4 -23
  26. package/dist/CheckListItem/properties.d.ts +7 -0
  27. package/dist/CheckListItem/properties.js +1 -0
  28. package/dist/GridItem/GridItem.svelte +17 -11
  29. package/dist/GridItem/GridItem.svelte.d.ts +4 -24
  30. package/dist/GridItem/properties.d.ts +8 -0
  31. package/dist/GridItem/properties.js +1 -0
  32. package/dist/Icon/Icon.svelte +8 -6
  33. package/dist/Icon/Icon.svelte.d.ts +3 -21
  34. package/dist/Icon/properties.d.ts +3 -2
  35. package/dist/Icon/properties.js +1 -4
  36. package/dist/IconStack/IconStack.svelte +5 -3
  37. package/dist/IconStack/IconStack.svelte.d.ts +4 -19
  38. package/dist/IconStack/properties.d.ts +4 -1
  39. package/dist/Img/Img.svelte +13 -9
  40. package/dist/Img/Img.svelte.d.ts +4 -20
  41. package/dist/Img/properties.d.ts +2 -2
  42. package/dist/Input/Input.svelte +172 -139
  43. package/dist/Input/Input.svelte.d.ts +6 -32
  44. package/dist/Input/properties.d.ts +23 -22
  45. package/dist/Input/properties.js +1 -23
  46. package/dist/InputButton/InputButton.svelte +76 -78
  47. package/dist/InputButton/InputButton.svelte.d.ts +6 -35
  48. package/dist/InputButton/properties.d.ts +6 -4
  49. package/dist/InputButton/properties.js +1 -18
  50. package/dist/ListItem/ListItem.svelte +87 -64
  51. package/dist/ListItem/ListItem.svelte.d.ts +4 -35
  52. package/dist/ListItem/properties.d.ts +21 -7
  53. package/dist/ListItem/properties.js +1 -8
  54. package/dist/Loader/Loader.svelte +1 -4
  55. package/dist/Loader/Loader.svelte.d.ts +24 -15
  56. package/dist/Modal/Modal.svelte +117 -95
  57. package/dist/Modal/Modal.svelte.d.ts +3 -29
  58. package/dist/Modal/properties.d.ts +21 -13
  59. package/dist/Modal/properties.js +1 -14
  60. package/dist/Select/Select.svelte +170 -142
  61. package/dist/Select/Select.svelte.d.ts +3 -26
  62. package/dist/Select/properties.d.ts +19 -10
  63. package/dist/Status/Status.svelte +15 -15
  64. package/dist/Status/Status.svelte.d.ts +3 -21
  65. package/dist/Status/properties.d.ts +2 -2
  66. package/dist/Status/properties.js +1 -6
  67. package/dist/Stepper/Step.svelte +13 -13
  68. package/dist/Stepper/Step.svelte.d.ts +4 -23
  69. package/dist/Stepper/Stepper.svelte +10 -7
  70. package/dist/Stepper/Stepper.svelte.d.ts +3 -20
  71. package/dist/Stepper/properties.d.ts +12 -0
  72. package/dist/Table/Table.svelte +73 -47
  73. package/dist/Table/Table.svelte.d.ts +3 -20
  74. package/dist/Table/properties.d.ts +5 -5
  75. package/dist/Toast/Toast.svelte +144 -76
  76. package/dist/Toast/Toast.svelte.d.ts +24 -23
  77. package/dist/Toast/properties.d.ts +10 -11
  78. package/dist/Toast/properties.js +1 -4
  79. package/dist/Toggle/Toggle.svelte +12 -11
  80. package/dist/Toggle/Toggle.svelte.d.ts +4 -21
  81. package/dist/Toggle/properties.d.ts +5 -0
  82. package/dist/Toggle/properties.js +1 -0
  83. package/dist/Toolbar/Toolbar.svelte +27 -20
  84. package/dist/Toolbar/Toolbar.svelte.d.ts +3 -26
  85. package/dist/Toolbar/properties.d.ts +10 -4
  86. package/dist/Toolbar/properties.js +1 -5
  87. package/dist/index.d.ts +0 -11
  88. package/dist/index.js +0 -11
  89. package/package.json +29 -29
@@ -1,39 +1,26 @@
1
- <script>import { afterUpdate, onMount } from "svelte";
2
- export let expand = false;
3
- let maxHeight = 0;
4
- let accordionRef;
5
- function updateMaxHeight() {
6
- try {
7
- if (expand) {
8
- accordionRef.style.maxHeight = `${maxHeight}px`;
9
- } else {
10
- accordionRef.style.maxHeight = "0";
11
- }
12
- } catch (e) {
13
- console.error("Error while updating style of accordian", e);
14
- }
15
- }
16
- afterUpdate(updateMaxHeight);
17
- onMount(() => {
18
- accordionRef.style.transition = "max-height 0.2s ease-out";
19
- updateMaxHeight();
20
- });
21
- $: {
22
- if (accordionRef) {
23
- maxHeight = accordionRef.scrollHeight;
24
- updateMaxHeight();
25
- }
26
- }
1
+ <script lang="ts">
2
+ let { expand = false, children } = $props();
27
3
  </script>
28
4
 
29
- <div class="accordion" bind:this={accordionRef}>
30
- <slot />
5
+ <div class="accordion" class:expanded={expand}>
6
+ <div class="accordion-content">
7
+ {@render children?.()}
8
+ </div>
31
9
  </div>
32
10
 
33
11
  <style>
34
12
  .accordion {
35
- max-height: 0;
13
+ display: grid;
14
+ grid-template-rows: 0fr;
36
15
  overflow: hidden;
37
- transition: max-height 0s ease-in;
16
+ transition: grid-template-rows 0.2s ease-out;
17
+ }
18
+
19
+ .accordion.expanded {
20
+ grid-template-rows: 1fr;
21
+ }
22
+
23
+ .accordion-content {
24
+ min-height: 0;
38
25
  }
39
26
  </style>
@@ -1,20 +1,6 @@
1
- import { SvelteComponent } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- expand?: boolean;
5
- };
6
- events: {
7
- [evt: string]: CustomEvent<any>;
8
- };
9
- slots: {
10
- default: {};
11
- };
12
- exports?: {} | undefined;
13
- bindings?: string | undefined;
14
- };
15
- export type AccordionProps = typeof __propDef.props;
16
- export type AccordionEvents = typeof __propDef.events;
17
- export type AccordionSlots = typeof __propDef.slots;
18
- export default class Accordion extends SvelteComponent<AccordionProps, AccordionEvents, AccordionSlots> {
19
- }
20
- export {};
1
+ declare const Accordion: import("svelte").Component<{
2
+ expand?: boolean;
3
+ children: any;
4
+ }, {}, "">;
5
+ type Accordion = ReturnType<typeof Accordion>;
6
+ export default Accordion;
@@ -1,39 +1,53 @@
1
- <script>import { fly, fade } from "svelte/transition";
2
- export let enable = true;
3
- export let align = "bottom";
4
- export let transitionType = "ALL";
5
- let flyAnimationProperties = { x: 0, y: 0, duration: 380 };
6
- let fadeAnimationProperties = { duration: 300 };
7
- switch (align) {
8
- case "top":
9
- flyAnimationProperties = { ...flyAnimationProperties, y: -30 };
10
- break;
11
- case "bottom":
12
- flyAnimationProperties = { ...flyAnimationProperties, y: 300 };
13
- break;
14
- }
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import { fly, fade } from 'svelte/transition';
4
+ import type { ModalAlign } from '../Modal/properties';
5
+ import type { ModalTransition } from '../types';
6
+
7
+ type Props = {
8
+ enable?: boolean;
9
+ align?: ModalAlign;
10
+ transitionType?: ModalTransition;
11
+ children?: Snippet;
12
+ };
13
+
14
+ let { enable = true, align = 'bottom', transitionType = 'ALL', children }: Props = $props();
15
+
16
+ let flyAnimationProperties = $derived.by(() => {
17
+ const base = { x: 0, y: 0, duration: 380 };
18
+
19
+ switch (align) {
20
+ case 'top':
21
+ return { ...base, y: -30 };
22
+ case 'bottom':
23
+ return { ...base, y: 300 };
24
+ default:
25
+ return base;
26
+ }
27
+ });
28
+
29
+ let fadeAnimationProperties = { duration: 300 };
30
+
31
+ let useFlyAnimation = $derived(align === 'top' || align === 'bottom');
32
+ let useOutTransition = $derived(transitionType === 'ALL');
15
33
  </script>
16
34
 
17
35
  {#if enable}
18
- {#if align === 'top' || align === 'bottom'}
19
- {#if transitionType === 'IN'}
20
- <div in:fly|global={flyAnimationProperties}>
21
- <slot />
22
- </div>
23
- {:else}
24
- <div in:fly|global={flyAnimationProperties} out:fly|global={flyAnimationProperties}>
25
- <slot />
26
- </div>
27
- {/if}
28
- {:else if transitionType === 'IN'}
29
- <div in:fade|global={fadeAnimationProperties}>
30
- <slot />
36
+ {#if useFlyAnimation}
37
+ <div
38
+ in:fly|global={flyAnimationProperties}
39
+ out:fly|global={useOutTransition ? flyAnimationProperties : undefined}
40
+ >
41
+ {@render children?.()}
31
42
  </div>
32
43
  {:else}
33
- <div in:fade|global={fadeAnimationProperties} out:fade|global={fadeAnimationProperties}>
34
- <slot />
44
+ <div
45
+ in:fade|global={fadeAnimationProperties}
46
+ out:fade|global={useOutTransition ? fadeAnimationProperties : undefined}
47
+ >
48
+ {@render children?.()}
35
49
  </div>
36
50
  {/if}
37
51
  {:else}
38
- <slot />
52
+ {@render children?.()}
39
53
  {/if}
@@ -1,24 +1,12 @@
1
- import { SvelteComponent } from "svelte";
1
+ import type { Snippet } from 'svelte';
2
2
  import type { ModalAlign } from '../Modal/properties';
3
3
  import type { ModalTransition } from '../types';
4
- declare const __propDef: {
5
- props: {
6
- enable?: boolean;
7
- align?: ModalAlign;
8
- transitionType?: ModalTransition;
9
- };
10
- events: {
11
- [evt: string]: CustomEvent<any>;
12
- };
13
- slots: {
14
- default: {};
15
- };
16
- exports?: {} | undefined;
17
- bindings?: string | undefined;
4
+ type Props = {
5
+ enable?: boolean;
6
+ align?: ModalAlign;
7
+ transitionType?: ModalTransition;
8
+ children?: Snippet;
18
9
  };
19
- export type ModalAnimationProps = typeof __propDef.props;
20
- export type ModalAnimationEvents = typeof __propDef.events;
21
- export type ModalAnimationSlots = typeof __propDef.slots;
22
- export default class ModalAnimation extends SvelteComponent<ModalAnimationProps, ModalAnimationEvents, ModalAnimationSlots> {
23
- }
24
- export {};
10
+ declare const ModalAnimation: import("svelte").Component<Props, {}, "">;
11
+ type ModalAnimation = ReturnType<typeof ModalAnimation>;
12
+ export default ModalAnimation;
@@ -1,7 +1,14 @@
1
- <script>
1
+ <script lang="ts">
2
2
  import { fade } from 'svelte/transition';
3
+ import type { Snippet } from 'svelte';
4
+
5
+ type Props = {
6
+ children?: Snippet;
7
+ };
8
+
9
+ let { children }: Props = $props();
3
10
  </script>
4
11
 
5
12
  <div out:fade={{ duration: 350 }}>
6
- <slot />
13
+ {@render children?.()}
7
14
  </div>
@@ -1,29 +1,7 @@
1
- /** @typedef {typeof __propDef.props} OverlayAnimationProps */
2
- /** @typedef {typeof __propDef.events} OverlayAnimationEvents */
3
- /** @typedef {typeof __propDef.slots} OverlayAnimationSlots */
4
- export default class OverlayAnimation extends SvelteComponent<{
5
- [x: string]: never;
6
- }, {
7
- [evt: string]: CustomEvent<any>;
8
- }, {
9
- default: {};
10
- }> {
11
- }
12
- export type OverlayAnimationProps = typeof __propDef.props;
13
- export type OverlayAnimationEvents = typeof __propDef.events;
14
- export type OverlayAnimationSlots = typeof __propDef.slots;
15
- import { SvelteComponent } from "svelte";
16
- declare const __propDef: {
17
- props: {
18
- [x: string]: never;
19
- };
20
- events: {
21
- [evt: string]: CustomEvent<any>;
22
- };
23
- slots: {
24
- default: {};
25
- };
26
- exports?: undefined;
27
- bindings?: undefined;
1
+ import type { Snippet } from 'svelte';
2
+ type Props = {
3
+ children?: Snippet;
28
4
  };
29
- export {};
5
+ declare const OverlayAnimation: import("svelte").Component<Props, {}, "">;
6
+ type OverlayAnimation = ReturnType<typeof OverlayAnimation>;
7
+ export default OverlayAnimation;
@@ -1,14 +1,15 @@
1
- <script>export let properties = null;
1
+ <script lang="ts">
2
+ import type { BadgeProperties } from './properties';
3
+
4
+ let { image, value }: BadgeProperties = $props();
2
5
  </script>
3
6
 
4
- {#if properties !== null}
5
- <div class="badge-icon">
6
- <div class="badge-wrap">
7
- <img class="icon-img" src={properties.image} alt="" />
8
- <div class="badge">{properties.value}</div>
9
- </div>
7
+ <div class="badge-icon">
8
+ <div class="badge-wrap">
9
+ <img class="icon-img" src={image} alt="" />
10
+ <div class="badge">{value}</div>
10
11
  </div>
11
- {/if}
12
+ </div>
12
13
 
13
14
  <style>
14
15
  .badge-wrap {
@@ -1,19 +1,4 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import type { BadgeProperties } from './properties';
3
- declare const __propDef: {
4
- props: {
5
- properties?: BadgeProperties | null;
6
- };
7
- events: {
8
- [evt: string]: CustomEvent<any>;
9
- };
10
- slots: {};
11
- exports?: {} | undefined;
12
- bindings?: string | undefined;
13
- };
14
- export type BadgeProps = typeof __propDef.props;
15
- export type BadgeEvents = typeof __propDef.events;
16
- export type BadgeSlots = typeof __propDef.slots;
17
- export default class Badge extends SvelteComponent<BadgeProps, BadgeEvents, BadgeSlots> {
18
- }
19
- export {};
2
+ declare const Badge: import("svelte").Component<BadgeProperties, {}, "">;
3
+ type Badge = ReturnType<typeof Badge>;
4
+ export default Badge;
@@ -1,27 +1,28 @@
1
- <script>export let properties = null;
1
+ <script lang="ts">
2
+ import type { BannerProperties } from './properties';
3
+
4
+ let { icon, text, linkText, rightContent, onclick, onkeydown }: BannerProperties = $props();
2
5
  </script>
3
6
 
4
- {#if properties !== null}
5
- <div class="banner" on:click on:keydown role="button" tabindex="0">
6
- {#if properties.icon !== null}
7
- <div class="banner-image">
8
- <img src={properties.icon} alt="" />
9
- </div>
10
- {/if}
11
- <div class="banner-text">
12
- {#if properties.linkText !== null}
13
- <div>{properties.text}<span class="link-text">{properties.linkText}</span></div>
14
- {:else}
15
- <div>{properties.text}</div>
16
- {/if}
7
+ <div class="banner" {onclick} {onkeydown} role="button" tabindex="0">
8
+ {#if icon}
9
+ <div class="banner-image">
10
+ <img src={icon} alt="" />
17
11
  </div>
18
- {#if $$slots.rightContent}
19
- <div class="right-content">
20
- <slot name="rightContent" />
21
- </div>
12
+ {/if}
13
+ <div class="banner-text">
14
+ {#if linkText}
15
+ <div>{text}<span class="link-text">{linkText}</span></div>
16
+ {:else}
17
+ <div>{text}</div>
22
18
  {/if}
23
19
  </div>
24
- {/if}
20
+ {#if rightContent}
21
+ <div class="right-content">
22
+ {@render rightContent()}
23
+ </div>
24
+ {/if}
25
+ </div>
25
26
 
26
27
  <style>
27
28
  .banner {
@@ -1,24 +1,4 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import type { BannerProperties } from './properties';
3
- declare const __propDef: {
4
- props: {
5
- properties?: BannerProperties | null;
6
- };
7
- events: {
8
- click: PointerEvent;
9
- keydown: KeyboardEvent;
10
- } & {
11
- [evt: string]: CustomEvent<any>;
12
- };
13
- slots: {
14
- rightContent: {};
15
- };
16
- exports?: {} | undefined;
17
- bindings?: string | undefined;
18
- };
19
- export type BannerProps = typeof __propDef.props;
20
- export type BannerEvents = typeof __propDef.events;
21
- export type BannerSlots = typeof __propDef.slots;
22
- export default class Banner extends SvelteComponent<BannerProps, BannerEvents, BannerSlots> {
23
- }
24
- export {};
2
+ declare const Banner: import("svelte").Component<BannerProperties, {}, "">;
3
+ type Banner = ReturnType<typeof Banner>;
4
+ export default Banner;
@@ -1,5 +1,9 @@
1
+ import type { Snippet } from 'svelte';
1
2
  export type BannerProperties = {
2
- icon: string | null;
3
+ icon?: string | null;
3
4
  text: string;
4
- linkText: string | null;
5
+ linkText?: string | null;
6
+ rightContent?: Snippet;
7
+ onclick?: (event: MouseEvent) => void;
8
+ onkeydown?: (event: KeyboardEvent) => void;
5
9
  };
@@ -1,22 +1,21 @@
1
- <script context="module">export const prerender = true;
2
- </script>
1
+ <script lang="ts">
2
+ import type { BrandLoaderProperties } from './properties';
3
3
 
4
- <script>import { defaultBrandLoaderProperties } from "./properties";
5
- export let properties = defaultBrandLoaderProperties;
4
+ let { brandLogoURL, brandText, subText }: BrandLoaderProperties = $props();
6
5
  </script>
7
6
 
8
7
  <div class="background">
9
8
  <div class="loader">
10
- <img src={properties.brandLogoURL} alt="" />
11
- <div class="text">{properties.brandText}</div>
12
- {#if properties.subText}
13
- <div class="sub-text">{properties.subText}</div>
9
+ <img src={brandLogoURL} alt="" />
10
+ <div class="text">{brandText}</div>
11
+ {#if subText}
12
+ <div class="sub-text">{subText}</div>
14
13
  {/if}
15
14
  <div class="lds-ellipsis">
16
- <div />
17
- <div />
18
- <div />
19
- <div />
15
+ <div></div>
16
+ <div></div>
17
+ <div></div>
18
+ <div></div>
20
19
  </div>
21
20
  </div>
22
21
  </div>
@@ -1,20 +1,4 @@
1
- import { SvelteComponent } from "svelte";
2
- export declare const prerender = true;
3
1
  import type { BrandLoaderProperties } from './properties';
4
- declare const __propDef: {
5
- props: {
6
- properties?: BrandLoaderProperties;
7
- };
8
- events: {
9
- [evt: string]: CustomEvent<any>;
10
- };
11
- slots: {};
12
- exports?: {} | undefined;
13
- bindings?: string | undefined;
14
- };
15
- export type BrandLoaderProps = typeof __propDef.props;
16
- export type BrandLoaderEvents = typeof __propDef.events;
17
- export type BrandLoaderSlots = typeof __propDef.slots;
18
- export default class BrandLoader extends SvelteComponent<BrandLoaderProps, BrandLoaderEvents, BrandLoaderSlots> {
19
- }
20
- export {};
2
+ declare const BrandLoader: import("svelte").Component<BrandLoaderProperties, {}, "">;
3
+ type BrandLoader = ReturnType<typeof BrandLoader>;
4
+ export default BrandLoader;
@@ -1,8 +1,5 @@
1
1
  export type BrandLoaderProperties = {
2
- fullScreen: boolean;
3
- subText: string | null;
4
2
  brandLogoURL: string;
5
3
  brandText: string;
6
- loaderBackgroundImage: string;
4
+ subText?: string | null;
7
5
  };
8
- export declare const defaultBrandLoaderProperties: BrandLoaderProperties;
@@ -1,7 +1 @@
1
- export const defaultBrandLoaderProperties = {
2
- fullScreen: true,
3
- subText: null,
4
- brandLogoURL: 'https://sdk.breeze.in/gallery/icons/logo.svg',
5
- brandText: 'breeze',
6
- loaderBackgroundImage: '/images/loader-background.svg'
7
- };
1
+ export {};
@@ -1,41 +1,52 @@
1
- <script>import { createEventDispatcher } from "svelte";
2
- import Loader from "../Loader/Loader.svelte";
3
- import { defaultButtonProperties } from "./properties";
4
- export let properties = defaultButtonProperties;
5
- export let showProgressBar = false;
6
- const dispatch = createEventDispatcher();
7
- function handleButtonClick() {
8
- if (showProgressBar) {
9
- return;
10
- }
11
- dispatch("click");
12
- if (properties.showLoader && properties.loaderType === "ProgressBar") {
13
- showProgressBar = true;
1
+ <script lang="ts">
2
+ import Loader from '../Loader/Loader.svelte';
3
+ import type { ButtonProperties } from './properties';
4
+
5
+ let {
6
+ text,
7
+ enable = true,
8
+ showLoader = false,
9
+ loaderType,
10
+ type = 'submit',
11
+ testId,
12
+ onclick,
13
+ onkeyup = () => {},
14
+ showProgressBar = $bindable(false),
15
+ icon
16
+ }: ButtonProperties = $props();
17
+
18
+ function handleButtonClick(event: MouseEvent): void {
19
+ if (showProgressBar) {
20
+ return;
21
+ }
22
+ onclick?.(event);
23
+ if (showLoader && loaderType === 'ProgressBar') {
24
+ showProgressBar = true;
25
+ }
14
26
  }
15
- }
16
27
  </script>
17
28
 
18
29
  <div class="button-container">
19
30
  {#if showProgressBar}
20
- <div class="button-progress-bar" />
31
+ <div class="button-progress-bar"></div>
21
32
  {/if}
22
33
  <button
23
- style="
24
- --opacity: {properties.enable ? 1 : 0.4};
25
- --cursor: {properties.enable ? 'pointer' : 'not-allowed'};"
26
- on:click={handleButtonClick}
27
- disabled={!(properties.enable && !properties.showLoader)}
28
- type={properties.type}
29
- data-pw={properties.testId}
34
+ style:--opacity={enable ? 1 : 0.4}
35
+ style:--cursor={enable ? 'pointer' : 'not-allowed'}
36
+ onclick={handleButtonClick}
37
+ {onkeyup}
38
+ disabled={!(enable && !showLoader)}
39
+ {type}
40
+ data-pw={testId}
30
41
  >
31
- {#if properties.showLoader && properties.loaderType === 'Circular'}
42
+ {#if showLoader && loaderType === 'Circular'}
32
43
  <div class="button-loader"><Loader /></div>
33
44
  {/if}
34
- {#if $$slots.icon}
35
- <div class="button-icon"><slot name="icon" /></div>
45
+ {#if icon}
46
+ <div class="button-icon">{@render icon()}</div>
36
47
  {/if}
37
- {#if properties.text !== null && properties.text.length > 0}
38
- <div class="button-text">{properties.text}</div>
48
+ {#if text}
49
+ <div class="button-text">{text}</div>
39
50
  {/if}
40
51
  </button>
41
52
  </div>
@@ -1,23 +1,4 @@
1
- import { SvelteComponent } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- properties?: import("./properties").ButtonProperties;
5
- showProgressBar?: boolean;
6
- };
7
- events: {
8
- click: CustomEvent<any>;
9
- } & {
10
- [evt: string]: CustomEvent<any>;
11
- };
12
- slots: {
13
- icon: {};
14
- };
15
- exports?: {} | undefined;
16
- bindings?: string | undefined;
17
- };
18
- export type ButtonProps = typeof __propDef.props;
19
- export type ButtonEvents = typeof __propDef.events;
20
- export type ButtonSlots = typeof __propDef.slots;
21
- export default class Button extends SvelteComponent<ButtonProps, ButtonEvents, ButtonSlots> {
22
- }
23
- export {};
1
+ import type { ButtonProperties } from './properties';
2
+ declare const Button: import("svelte").Component<ButtonProperties, {}, "showProgressBar">;
3
+ type Button = ReturnType<typeof Button>;
4
+ export default Button;
@@ -1,10 +1,14 @@
1
+ import type { Snippet } from 'svelte';
1
2
  export type LoaderType = 'Circular' | 'ProgressBar';
2
3
  export type ButtonProperties = {
3
4
  text: string;
4
- enable: boolean;
5
- showLoader: boolean;
6
- loaderType: LoaderType | null;
7
- type: 'submit' | 'reset' | 'button';
5
+ enable?: boolean;
6
+ showProgressBar?: boolean;
7
+ showLoader?: boolean;
8
+ loaderType?: LoaderType;
9
+ type?: 'submit' | 'reset' | 'button';
8
10
  testId?: string;
11
+ onclick?: (event: MouseEvent) => void;
12
+ onkeyup?: (event: KeyboardEvent) => void;
13
+ icon?: Snippet;
9
14
  };
10
- export declare const defaultButtonProperties: ButtonProperties;
@@ -1,7 +1 @@
1
- export const defaultButtonProperties = {
2
- text: 'click',
3
- enable: true,
4
- showLoader: false,
5
- loaderType: null,
6
- type: 'submit'
7
- };
1
+ export {};