@juspay/svelte-ui-components 1.0.0 → 1.2.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.
@@ -1,6 +1,7 @@
1
1
  <script>import { fly, fade } from "svelte/transition";
2
2
  export let enable = true;
3
3
  export let align = "bottom";
4
+ export let transitionType = "ALL";
4
5
  let flyAnimationProperties = { x: 0, y: 0, duration: 380 };
5
6
  let fadeAnimationProperties = { duration: 300 };
6
7
  switch (align) {
@@ -15,11 +16,21 @@ switch (align) {
15
16
 
16
17
  {#if enable}
17
18
  {#if align === 'top' || align === 'bottom'}
18
- <div transition:fly={flyAnimationProperties}>
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}>
19
30
  <slot />
20
31
  </div>
21
32
  {:else}
22
- <div in:fade={fadeAnimationProperties} out:fade={fadeAnimationProperties}>
33
+ <div in:fade|global={fadeAnimationProperties} out:fade|global={fadeAnimationProperties}>
23
34
  <slot />
24
35
  </div>
25
36
  {/if}
@@ -1,9 +1,11 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  import type { ModalAlign } from '../Modal/properties';
3
+ import type { ModalTransition } from '../types';
3
4
  declare const __propDef: {
4
5
  props: {
5
6
  enable?: boolean | undefined;
6
7
  align?: ModalAlign | undefined;
8
+ transitionType?: ModalTransition | undefined;
7
9
  };
8
10
  events: {
9
11
  [evt: string]: CustomEvent<any>;
@@ -48,8 +48,8 @@ function handleButtonClick() {
48
48
  font-family: var(--button-font-family);
49
49
  font-weight: var(--button-font-weight, 500);
50
50
  font-size: var(--button-font-size, 14px);
51
- background-color: var(--button-color, var(--primary-button-color, #3a4550));
52
- color: var(--button-text-color, var(--primary-text-color, white));
51
+ background-color: var(--button-color, #3a4550);
52
+ color: var(--button-text-color, white);
53
53
  height: var(--button-height, fit-content);
54
54
  padding: var(--button-padding, 16px);
55
55
  margin: var(--button-margin);
@@ -66,6 +66,12 @@ function handleButtonClick() {
66
66
  visibility: var(--button-visibility, visible);
67
67
  }
68
68
 
69
+ button:hover {
70
+ background: var(--button-hover-color, var(--button-color, #3a4550));
71
+ color: var(--button-hover-text-color, var(--button-text-color, white));
72
+ border: var(--button-hover-border, var(--button-border, none));
73
+ }
74
+
69
75
  .button-progress-bar {
70
76
  position: absolute;
71
77
  height: 100%;
@@ -7,6 +7,7 @@ export let properties = defaultListItemProperties;
7
7
  export let showLoader = false;
8
8
  export let showRightContentLoader = false;
9
9
  export let expand = false;
10
+ export let preventFocus = false;
10
11
  function handleLeftImageClick() {
11
12
  dispatch("leftImageClick");
12
13
  }
@@ -29,9 +30,17 @@ function handleTopSectionClick() {
29
30
  {#if showLoader}
30
31
  <div class="item-loader" />
31
32
  {/if}
32
- <div class="item" on:click={handleItemClick} on:keydown role="button" tabindex="0">
33
+ <div
34
+ class="item"
35
+ class:prevent-focus={preventFocus}
36
+ on:click={handleItemClick}
37
+ on:keydown
38
+ role="button"
39
+ tabindex="0"
40
+ >
33
41
  <div
34
42
  class="top-section"
43
+ class:prevent-focus={preventFocus}
35
44
  on:click={handleTopSectionClick}
36
45
  on:keydown
37
46
  role="button"
@@ -39,7 +48,13 @@ function handleTopSectionClick() {
39
48
  >
40
49
  <div class="left-content">
41
50
  {#if properties.leftImageUrl}
42
- <div on:click={handleLeftImageClick} on:keydown role="button" tabindex="0">
51
+ <div
52
+ class:prevent-focus={preventFocus}
53
+ on:click={handleLeftImageClick}
54
+ on:keydown
55
+ role="button"
56
+ tabindex="0"
57
+ >
43
58
  <img class="left-img" src={properties.leftImageUrl} alt="" />
44
59
  </div>
45
60
  {/if}
@@ -51,6 +66,7 @@ function handleTopSectionClick() {
51
66
  {#if properties.label}
52
67
  <div
53
68
  class="center-text"
69
+ class:prevent-focus={preventFocus}
54
70
  on:click={handleCenterTextClick}
55
71
  on:keydown
56
72
  role="button"
@@ -69,7 +85,13 @@ function handleTopSectionClick() {
69
85
  <slot name="rightContent" />
70
86
  {/if}
71
87
  {#if properties.rightImageUrl}
72
- <div on:click={handleRightImageClick} on:keydown role="button" tabindex="0">
88
+ <div
89
+ class:prevent-focus={preventFocus}
90
+ on:click={handleRightImageClick}
91
+ on:keydown
92
+ role="button"
93
+ tabindex="0"
94
+ >
73
95
  <img class="right-img" src={properties.rightImageUrl} alt="" />
74
96
  </div>
75
97
  {/if}
@@ -130,6 +152,15 @@ function handleTopSectionClick() {
130
152
  box-shadow: var(--list-item-box-shadow, none);
131
153
  width: var(--list-item-box-width);
132
154
  border-radius: var(--list-item-border-radius, 0px);
155
+ margin: var(--list-item-margin);
156
+ padding: var(--list-item-padding);
157
+ border: var(--list-item-border);
158
+ transition: var(--list-item-transition);
159
+ }
160
+
161
+ .item:hover {
162
+ background-color: var(--list-item-hover-background-color, var(--list-item-background-color));
163
+ border: var(--list-item-hover-border, var(--list-item-border));
133
164
  }
134
165
 
135
166
  .top-section {
@@ -170,6 +201,14 @@ function handleTopSectionClick() {
170
201
  border-radius: var(--list-item-left-image-border-radius, 0px);
171
202
  margin: var(--list-item-left-image-margin, 0px);
172
203
  filter: var(--list-item-left-image-filter, none);
204
+ background: var(--list-item-left-image-background);
205
+ border: var(--list-item-left-image-border);
206
+ transition: var(--list-item-transition);
207
+ }
208
+
209
+ .left-img:hover {
210
+ background: var(--list-item-left-image-hover-background, var(--list-item-left-image-background));
211
+ border: var(--list-item-left-image-hover-border, var(--list-item-left-image-border));
173
212
  }
174
213
 
175
214
  .right-img {
@@ -178,6 +217,15 @@ function handleTopSectionClick() {
178
217
  padding: var(--list-item-right-image-padding, 0px);
179
218
  border-radius: var(--list-item-right-image-border-radius, 0px);
180
219
  margin: var(--list-item-right-image-margin, 0px);
220
+ filter: var(--list-item-right-image-filter);
221
+ background: var(--list-item-right-image-background);
222
+ border: var(--list-item-right-image-border);
223
+ transition: var(--list-item-transition);
224
+ }
225
+
226
+ .right-img:hover {
227
+ background: var(--list-item-right-image-hover-background, var(--list-item-right-image-background));
228
+ border: var(--list-item-right-image-hover-border, var(--list-item-right-image-border));
181
229
  }
182
230
 
183
231
  .right-content-text {
@@ -193,4 +241,8 @@ function handleTopSectionClick() {
193
241
  font-family: var(--list-item-right-content-text-font-family);
194
242
  justify-content: var(--list-item-right-content-text-justify-content);
195
243
  }
244
+
245
+ .prevent-focus:focus {
246
+ outline: none;
247
+ }
196
248
  </style>
@@ -6,6 +6,7 @@ declare const __propDef: {
6
6
  showLoader?: boolean | undefined;
7
7
  showRightContentLoader?: boolean | undefined;
8
8
  expand?: boolean | undefined;
9
+ preventFocus?: boolean | undefined;
9
10
  };
10
11
  events: {
11
12
  keydown: KeyboardEvent;
@@ -61,7 +61,11 @@ onDestroy(() => {
61
61
  role="button"
62
62
  tabindex="0"
63
63
  >
64
- <ModalAnimation enable={properties.enableTransition} align={properties.align}>
64
+ <ModalAnimation
65
+ enable={properties.enableTransition}
66
+ align={properties.align}
67
+ transitionType={properties.transitionType}
68
+ >
65
69
  <div class="modal-content {properties.size}">
66
70
  {#if properties.header.leftImage !== null || properties.header.text !== null || properties.header.rightImage !== null}
67
71
  <div class="header">
@@ -1,3 +1,4 @@
1
+ import type { ModalTransition } from '../types';
1
2
  export type ModalSize = 'large' | 'medium' | 'small' | 'fit-content';
2
3
  export type ModalAlign = 'top' | 'center' | 'bottom';
3
4
  export type ModalProperties = {
@@ -6,6 +7,7 @@ export type ModalProperties = {
6
7
  showOverlay: boolean;
7
8
  supportHardwareBackPress: boolean;
8
9
  enableTransition: boolean;
10
+ transitionType: ModalTransition;
9
11
  header: {
10
12
  leftImage: string | null;
11
13
  rightImage: string | null;
@@ -8,5 +8,6 @@ export const defaultModalProperties = {
8
8
  rightImage: null,
9
9
  text: null
10
10
  },
11
- enableTransition: true
11
+ enableTransition: true,
12
+ transitionType: 'ALL'
12
13
  };
package/dist/index.d.ts CHANGED
@@ -17,6 +17,7 @@ export { default as Banner } from './Banner/Banner.svelte';
17
17
  export { default as Toggle } from './Toggle/Toggle.svelte';
18
18
  export { default as Accordion } from './Accordion/Accordion.svelte';
19
19
  export { default as CheckListItem } from './CheckListItem/CheckListItem.svelte';
20
+ export { default as Table } from './Table/Table.svelte';
20
21
  export type { ButtonProperties } from './Button/properties';
21
22
  export type { ModalProperties, ModalAlign, ModalSize } from './Modal/properties';
22
23
  export type { InputProperties } from './Input/properties';
@@ -34,6 +35,7 @@ export type { ToolbarProperties } from './Toolbar/properties';
34
35
  export type { CarouselProperties } from './Carousel/properties';
35
36
  export type { BadgeProperties } from './Badge/properties';
36
37
  export type { BannerProperties } from './Banner/properties';
38
+ export type { TableProperties } from './Table/properties';
37
39
  export { defaultIconProperties } from './Icon/properties';
38
40
  export { defaultButtonProperties } from './Button/properties';
39
41
  export { defaultModalProperties } from './Modal/properties';
package/dist/index.js CHANGED
@@ -17,6 +17,7 @@ export { default as Banner } from './Banner/Banner.svelte';
17
17
  export { default as Toggle } from './Toggle/Toggle.svelte';
18
18
  export { default as Accordion } from './Accordion/Accordion.svelte';
19
19
  export { default as CheckListItem } from './CheckListItem/CheckListItem.svelte';
20
+ export { default as Table } from './Table/Table.svelte';
20
21
  export { defaultIconProperties } from './Icon/properties';
21
22
  export { defaultButtonProperties } from './Button/properties';
22
23
  export { defaultModalProperties } from './Modal/properties';
package/dist/types.d.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  * @description Different types of input data which can be passed to the Input Component
4
4
  */
5
5
  export type InputDataType = 'text' | 'tel' | 'password' | 'email';
6
+ export type ModalTransition = 'IN' | 'ALL';
6
7
  export type AutoCompleteType = 'tel' | 'name' | 'email' | 'one-time-code' | 'postal-code' | 'street-address' | 'on' | 'address-level1';
7
8
  /**
8
9
  * @name CustomValidator
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "@juspay/svelte-ui-components",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",
7
7
  "preview": "vite preview",
8
8
  "package": "svelte-kit sync && svelte-package && publint",
9
- "publish": "node --experimental-json-modules scripts/publish.js",
10
9
  "prepublishOnly": "npm run package",
11
10
  "test": "npm run test:integration && npm run test:unit",
12
11
  "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
@@ -16,9 +15,6 @@
16
15
  "test:integration": "playwright test",
17
16
  "test:unit": "vitest"
18
17
  },
19
- "author": {
20
- "name": "Juspay Technologies Pvt Ltd"
21
- },
22
18
  "exports": {
23
19
  ".": {
24
20
  "types": "./dist/index.d.ts",