@juspay/svelte-ui-components 4.27.5 → 4.28.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.
Files changed (164) hide show
  1. package/README.md +140 -36
  2. package/dist/Animations/ModalAnimation.svelte +15 -1
  3. package/dist/Animations/OverlayAnimation.svelte +7 -1
  4. package/dist/AreaChart/AreaChart.svelte +366 -85
  5. package/dist/AspectRatio/AspectRatio.svelte +51 -0
  6. package/dist/AspectRatio/AspectRatio.svelte.d.ts +3 -0
  7. package/dist/AspectRatio/properties.d.ts +27 -0
  8. package/dist/AspectRatio/properties.js +1 -0
  9. package/dist/Banner/Banner.svelte +10 -4
  10. package/dist/Banner/properties.d.ts +8 -0
  11. package/dist/BarChart/BarChart.svelte +156 -49
  12. package/dist/Book/Book.svelte +14 -1
  13. package/dist/BrandLoader/BrandLoader.svelte +76 -12
  14. package/dist/Button/Button.svelte +56 -11
  15. package/dist/Calendar/Calendar.svelte +88 -61
  16. package/dist/Card/Card.svelte +1 -1
  17. package/dist/Carousel/Carousel.svelte +6 -3
  18. package/dist/ChatComposer/ChatComposer.svelte +54 -4
  19. package/dist/ChatComposer/dictationState.d.ts +15 -0
  20. package/dist/ChatComposer/dictationState.js +9 -0
  21. package/dist/ChatComposer/properties.d.ts +28 -1
  22. package/dist/ChatMessage/ChatMessage.svelte +27 -1
  23. package/dist/CheckListItem/CheckListItem.svelte +3 -3
  24. package/dist/Checkbox/Checkbox.svelte +84 -3
  25. package/dist/Checkbox/properties.d.ts +45 -13
  26. package/dist/ChipInput/ChipInput.svelte +70 -3
  27. package/dist/ChipInput/properties.d.ts +16 -0
  28. package/dist/Choicebox/Choicebox.svelte +156 -1
  29. package/dist/Choicebox/group.d.ts +63 -0
  30. package/dist/Choicebox/group.js +127 -0
  31. package/dist/Choicebox/properties.d.ts +46 -0
  32. package/dist/ColorPicker/ColorPicker.svelte +169 -20
  33. package/dist/ColorPicker/properties.d.ts +16 -0
  34. package/dist/Combobox/Combobox.svelte +87 -25
  35. package/dist/Combobox/properties.d.ts +23 -0
  36. package/dist/CommandMenu/CommandMenu.svelte +27 -11
  37. package/dist/ContextMenu/ContextMenu.svelte +31 -37
  38. package/dist/DateRangePicker/DateRangePicker.svelte +171 -73
  39. package/dist/DeltaIndicator/DeltaIndicator.svelte +3 -3
  40. package/dist/Draggable/Draggable.svelte +12 -7
  41. package/dist/DualAxisBarChart/DualAxisBarChart.svelte +11 -4
  42. package/dist/EmptyState/EmptyState.svelte +1 -1
  43. package/dist/FileDropzoneTrigger/FileDropzoneTrigger.svelte +1 -1
  44. package/dist/FileInput/FileInput.svelte +50 -1
  45. package/dist/FileInput/properties.d.ts +7 -0
  46. package/dist/FunnelChart/FunnelChart.svelte +40 -12
  47. package/dist/FunnelChart/properties.d.ts +7 -1
  48. package/dist/Gallery/Gallery.svelte +20 -13
  49. package/dist/Gallery/properties.d.ts +8 -0
  50. package/dist/GridItem/GridItem.svelte +31 -1
  51. package/dist/HITL/HITL.svelte +35 -9
  52. package/dist/Icon/Icon.svelte +19 -3
  53. package/dist/Input/Input.svelte +24 -10
  54. package/dist/Input/properties.d.ts +37 -1
  55. package/dist/InputButton/InputButton.svelte +86 -11
  56. package/dist/InputButton/properties.d.ts +10 -1
  57. package/dist/Label/Label.svelte +54 -0
  58. package/dist/Label/Label.svelte.d.ts +3 -0
  59. package/dist/Label/properties.d.ts +26 -0
  60. package/dist/Label/properties.js +1 -0
  61. package/dist/LineChart/LineChart.svelte +385 -94
  62. package/dist/ListItem/ListItem.svelte +121 -15
  63. package/dist/Loader/Loader.svelte +22 -2
  64. package/dist/LoadingDots/LoadingDots.svelte +21 -0
  65. package/dist/MediaUpload/MediaUpload.svelte +13 -3
  66. package/dist/Menu/Menu.svelte +56 -28
  67. package/dist/Modal/Modal.svelte +77 -42
  68. package/dist/Pagination/Pagination.svelte +9 -2
  69. package/dist/Phone/Phone.svelte +4 -0
  70. package/dist/PieChart/PieChart.svelte +282 -38
  71. package/dist/PieChart/properties.d.ts +9 -0
  72. package/dist/Pill/Pill.svelte +14 -5
  73. package/dist/Progress/Progress.svelte +20 -0
  74. package/dist/Radio/Radio.svelte +58 -1
  75. package/dist/Radio/properties.d.ts +23 -0
  76. package/dist/RatingGroup/RatingGroup.svelte +283 -0
  77. package/dist/RatingGroup/RatingGroup.svelte.d.ts +4 -0
  78. package/dist/RatingGroup/properties.d.ts +73 -0
  79. package/dist/RatingGroup/properties.js +1 -0
  80. package/dist/RelativeTime/RelativeTime.svelte +1 -1
  81. package/dist/SankeyChart/SankeyChart.svelte +272 -50
  82. package/dist/SankeyChart/properties.d.ts +9 -0
  83. package/dist/Scroller/Scroller.svelte +37 -2
  84. package/dist/Select/Select.svelte +166 -46
  85. package/dist/Select/properties.d.ts +7 -0
  86. package/dist/Separator/Separator.svelte +48 -0
  87. package/dist/Separator/Separator.svelte.d.ts +3 -0
  88. package/dist/Separator/properties.d.ts +22 -0
  89. package/dist/Separator/properties.js +1 -0
  90. package/dist/Sheet/Sheet.svelte +60 -21
  91. package/dist/Shimmer/Shimmer.svelte +15 -0
  92. package/dist/Slider/Slider.svelte +87 -6
  93. package/dist/Slider/properties.d.ts +26 -0
  94. package/dist/Snippet/Snippet.svelte +4 -0
  95. package/dist/Snippet/copyState.svelte.d.ts +13 -1
  96. package/dist/Snippet/copyState.svelte.js +27 -1
  97. package/dist/Snippet/properties.d.ts +7 -0
  98. package/dist/SoundKit/SoundKit.js +9 -8
  99. package/dist/SplitInput/SplitInput.svelte +68 -2
  100. package/dist/SplitInput/properties.d.ts +23 -0
  101. package/dist/StatCard/StatCard.svelte +6 -6
  102. package/dist/Status/Status.svelte +2 -2
  103. package/dist/Stepper/Step.svelte +19 -6
  104. package/dist/Stepper/Stepper.svelte +108 -35
  105. package/dist/Table/BuiltinCell.svelte +2 -2
  106. package/dist/Table/Table.svelte +373 -55
  107. package/dist/Table/properties.d.ts +134 -3
  108. package/dist/Tabs/Tabs.svelte +263 -65
  109. package/dist/Tabs/properties.d.ts +23 -0
  110. package/dist/TaskList/TaskList.svelte +14 -5
  111. package/dist/ThemeSwitcher/ThemeSwitcher.svelte +23 -0
  112. package/dist/ThinkingIndicator/ThinkingIndicator.svelte +13 -5
  113. package/dist/Toast/Toast.svelte +27 -2
  114. package/dist/Toggle/Toggle.svelte +79 -7
  115. package/dist/Toggle/Toggle.svelte.d.ts +1 -1
  116. package/dist/Toggle/properties.d.ts +30 -7
  117. package/dist/ToolCallLog/ToolCallLog.svelte +59 -21
  118. package/dist/ToolCallLog/properties.d.ts +10 -0
  119. package/dist/Toolbar/Toolbar.svelte +1 -1
  120. package/dist/Tooltip/Tooltip.svelte +20 -2
  121. package/dist/Tooltip/tooltip-action.js +39 -4
  122. package/dist/TypewriterText/TypewriterText.svelte +34 -2
  123. package/dist/TypewriterText/properties.d.ts +18 -5
  124. package/dist/_chart/ChartContainer.svelte +12 -0
  125. package/dist/_chart/ChartTooltip.svelte +18 -4
  126. package/dist/_chart/Legend.svelte +21 -0
  127. package/dist/_chart/Legend.svelte.d.ts +15 -0
  128. package/dist/_chart/geometry.d.ts +54 -1
  129. package/dist/_chart/geometry.js +122 -14
  130. package/dist/_chart/interactions.d.ts +5 -1
  131. package/dist/_chart/interactions.js +9 -5
  132. package/dist/_chart/scales.js +16 -0
  133. package/dist/_chart/temporal.d.ts +45 -0
  134. package/dist/_chart/temporal.js +116 -0
  135. package/dist/_field/description.d.ts +50 -0
  136. package/dist/_field/description.js +51 -0
  137. package/dist/_interaction/dismissal.d.ts +67 -0
  138. package/dist/_interaction/dismissal.js +137 -0
  139. package/dist/_interaction/focus.d.ts +73 -0
  140. package/dist/_interaction/focus.js +143 -0
  141. package/dist/assets/star.svg +5 -0
  142. package/dist/index.d.ts +13 -1
  143. package/dist/index.js +21 -1
  144. package/dist/reduced-motion.svelte.d.ts +37 -0
  145. package/dist/reduced-motion.svelte.js +44 -0
  146. package/dist/styles/theme-dark.css +778 -0
  147. package/dist/types.d.ts +4 -2
  148. package/dist/utils.d.ts +62 -1
  149. package/dist/utils.js +80 -21
  150. package/dist-codemod/{bin.js → codemod/bin.js} +13 -2
  151. package/dist-codemod/{cli.js → codemod/cli.js} +48 -3
  152. package/dist-codemod/codemod/migrate-audit.js +395 -0
  153. package/dist-codemod/codemod/migration-assets/legacy-display.css +120 -0
  154. package/dist-codemod/codemod/migration-assets/legacy-palette.css +106 -0
  155. package/dist-codemod/codemod/migration-assets/wc-display.json +492 -0
  156. package/dist-codemod/migrate/analyze.js +804 -0
  157. package/dist-codemod/migrate/chart-tooltip-selector.js +301 -0
  158. package/dist-wc/index.js +13992 -4323
  159. package/package.json +13 -6
  160. package/dist/Modal/focus-trap.d.ts +0 -42
  161. package/dist/Modal/focus-trap.js +0 -57
  162. /package/dist-codemod/{legacy-pairs.js → codemod/legacy-pairs.js} +0 -0
  163. /package/dist-codemod/{transform.js → codemod/transform.js} +0 -0
  164. /package/dist-codemod/{wc-children.js → codemod/wc-children.js} +0 -0
package/dist/index.d.ts CHANGED
@@ -83,6 +83,10 @@ export { default as FunnelChart } from './FunnelChart/FunnelChart.svelte';
83
83
  export { default as ProportionBar } from './ProportionBar/ProportionBar.svelte';
84
84
  export { default as ChipInput } from './ChipInput/ChipInput.svelte';
85
85
  export { default as FileDropzoneTrigger } from './FileDropzoneTrigger/FileDropzoneTrigger.svelte';
86
+ export { default as Separator } from './Separator/Separator.svelte';
87
+ export { default as Label } from './Label/Label.svelte';
88
+ export { default as AspectRatio } from './AspectRatio/AspectRatio.svelte';
89
+ export { default as RatingGroup } from './RatingGroup/RatingGroup.svelte';
86
90
  export { default as Chat } from './Chat/Chat.svelte';
87
91
  export { default as ChatHeader } from './ChatHeader/ChatHeader.svelte';
88
92
  export { default as ChatMessage } from './ChatMessage/ChatMessage.svelte';
@@ -147,6 +151,10 @@ export type * from './Gauge/properties';
147
151
  export type * from './SplitButton/properties';
148
152
  export type * from './KeyboardInput/properties';
149
153
  export type * from './LoadingDots/properties';
154
+ export type * from './Separator/properties';
155
+ export type * from './Label/properties';
156
+ export type * from './AspectRatio/properties';
157
+ export type * from './RatingGroup/properties';
150
158
  export type * from './Menu/properties';
151
159
  export type * from './Sheet/properties';
152
160
  export type * from './Scroller/properties';
@@ -208,6 +216,10 @@ export type * from './MediaPlayer/properties';
208
216
  export type * from './MediaUpload/properties';
209
217
  export type * from './Gallery/properties';
210
218
  export { createSoundKit } from './SoundKit/SoundKit';
211
- export { validateInput, lockBodyScroll, unlockBodyScroll } from './utils';
219
+ export { validateInput, lockBodyScroll, unlockBodyScroll, prefersReducedMotion } from './utils';
220
+ export { reducedMotion } from './reduced-motion.svelte';
221
+ export type { ReducedMotionPreference } from './reduced-motion.svelte';
222
+ export { TEL_PRESETS, TEL_PRESET_IN_MOBILE } from './utils';
223
+ export type { TelPreset, ValidateInputOptions } from './utils';
212
224
  export { formatNumberIndian } from './_chart/format';
213
225
  export { createNarrationHighlighter } from './_chart/narrationHighlighter';
package/dist/index.js CHANGED
@@ -83,6 +83,10 @@ export { default as FunnelChart } from './FunnelChart/FunnelChart.svelte';
83
83
  export { default as ProportionBar } from './ProportionBar/ProportionBar.svelte';
84
84
  export { default as ChipInput } from './ChipInput/ChipInput.svelte';
85
85
  export { default as FileDropzoneTrigger } from './FileDropzoneTrigger/FileDropzoneTrigger.svelte';
86
+ export { default as Separator } from './Separator/Separator.svelte';
87
+ export { default as Label } from './Label/Label.svelte';
88
+ export { default as AspectRatio } from './AspectRatio/AspectRatio.svelte';
89
+ export { default as RatingGroup } from './RatingGroup/RatingGroup.svelte';
86
90
  export { default as Chat } from './Chat/Chat.svelte';
87
91
  export { default as ChatHeader } from './ChatHeader/ChatHeader.svelte';
88
92
  export { default as ChatMessage } from './ChatMessage/ChatMessage.svelte';
@@ -106,6 +110,22 @@ export { SpeechToTextController } from './SpeechToText/controller.svelte';
106
110
  export { SpeechSynthesisController } from './SpeechSynthesis/controller.svelte';
107
111
  export { createCopyState } from './Snippet/copyState.svelte';
108
112
  export { createSoundKit } from './SoundKit/SoundKit';
109
- export { validateInput, lockBodyScroll, unlockBodyScroll } from './utils';
113
+ // `prefersReducedMotion` reads the OS preference, and its own comment in utils.ts
114
+ // explains why it is shared rather than reimplemented per component: two
115
+ // character-reveal implementations ship here, and honouring the preference in one
116
+ // silences a chat bubble while the message body inside it keeps typing. That argument
117
+ // applies just as much across the boundary. A consumer driving motion from JavaScript
118
+ // -- a canvas, a chart, an imperative animation -- cannot reach the preference through
119
+ // a stylesheet, so leaving this unexported made every such consumer write it again.
120
+ export { validateInput, lockBodyScroll, unlockBodyScroll, prefersReducedMotion } from './utils';
121
+ // The reactive counterpart to `prefersReducedMotion()` above: a consumer
122
+ // building their own component with runes needs a value that stays current
123
+ // inside a `$derived`, which a plain function call cannot give them, for the
124
+ // same reason Sheet itself needed one (see reduced-motion.svelte.ts).
125
+ export { reducedMotion } from './reduced-motion.svelte';
126
+ // `dataType="tel"` no longer assumes a market. A consumer who WANTS the old
127
+ // Indian-mobile rule has to be able to name it, so the presets and the options
128
+ // type ship alongside the validator they configure.
129
+ export { TEL_PRESETS, TEL_PRESET_IN_MOBILE } from './utils';
110
130
  export { formatNumberIndian } from './_chart/format';
111
131
  export { createNarrationHighlighter } from './_chart/narrationHighlighter';
@@ -0,0 +1,37 @@
1
+ /**
2
+ * A live, reactive mirror of the OS `prefers-reduced-motion` preference.
3
+ *
4
+ * `prefersReducedMotion()` in `utils.ts` is a plain, un-reactive read -- exactly
5
+ * right for the call sites that invoke it fresh on every interaction (Tabs,
6
+ * Input, Scroller, ChatController, TypewriterText), but useless inside a
7
+ * `$derived`/`$derived.by` that only recomputes when a *tracked* dependency
8
+ * changes. A derived that calls it and returns early on the reduced-motion
9
+ * branch -- Sheet's `flyParams` is the case that surfaced this -- reads no
10
+ * Svelte state at all along that path, so it latches whatever the preference
11
+ * happened to be on its first evaluation and never revisits it, in either
12
+ * direction, for the life of the component instance.
13
+ *
14
+ * `current` below is real `$state`, so reading `reducedMotion.current` inside
15
+ * a derived registers a tracked dependency wherever in the function body the
16
+ * read happens -- an early `return` right after it still leaves the derived
17
+ * subscribed, which is exactly the property a plain boolean lacks.
18
+ *
19
+ * One module-level `MediaQueryList` subscription for the whole page, rather
20
+ * than one per consumer: the preference is a single global fact about the
21
+ * browser tab, not something scoped to any particular mounted component, so
22
+ * every reader shares this one listener instead of each taking out (and
23
+ * needing to release) its own. It is intentionally never removed -- there is
24
+ * no "stop caring about the OS setting" moment short of the page unloading,
25
+ * at which point the browser reclaims it along with everything else. This
26
+ * differs from VoiceOrb.svelte's own subscription, which is taken out and torn
27
+ * down inside its `onMount`: that one has to seed a field before the first
28
+ * animation frame and already owns an `onMount`/`onDestroy` pair for its
29
+ * `ResizeObserver`, so pairing the listener with the same lifecycle costs it
30
+ * nothing extra. A shared source has neither constraint, and no owning
31
+ * component to pair teardown with in the first place.
32
+ */
33
+ export type ReducedMotionPreference = {
34
+ /** The live OS preference. Read it inside a `$derived` to stay subscribed. */
35
+ readonly current: boolean;
36
+ };
37
+ export declare const reducedMotion: ReducedMotionPreference;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * A live, reactive mirror of the OS `prefers-reduced-motion` preference.
3
+ *
4
+ * `prefersReducedMotion()` in `utils.ts` is a plain, un-reactive read -- exactly
5
+ * right for the call sites that invoke it fresh on every interaction (Tabs,
6
+ * Input, Scroller, ChatController, TypewriterText), but useless inside a
7
+ * `$derived`/`$derived.by` that only recomputes when a *tracked* dependency
8
+ * changes. A derived that calls it and returns early on the reduced-motion
9
+ * branch -- Sheet's `flyParams` is the case that surfaced this -- reads no
10
+ * Svelte state at all along that path, so it latches whatever the preference
11
+ * happened to be on its first evaluation and never revisits it, in either
12
+ * direction, for the life of the component instance.
13
+ *
14
+ * `current` below is real `$state`, so reading `reducedMotion.current` inside
15
+ * a derived registers a tracked dependency wherever in the function body the
16
+ * read happens -- an early `return` right after it still leaves the derived
17
+ * subscribed, which is exactly the property a plain boolean lacks.
18
+ *
19
+ * One module-level `MediaQueryList` subscription for the whole page, rather
20
+ * than one per consumer: the preference is a single global fact about the
21
+ * browser tab, not something scoped to any particular mounted component, so
22
+ * every reader shares this one listener instead of each taking out (and
23
+ * needing to release) its own. It is intentionally never removed -- there is
24
+ * no "stop caring about the OS setting" moment short of the page unloading,
25
+ * at which point the browser reclaims it along with everything else. This
26
+ * differs from VoiceOrb.svelte's own subscription, which is taken out and torn
27
+ * down inside its `onMount`: that one has to seed a field before the first
28
+ * animation frame and already owns an `onMount`/`onDestroy` pair for its
29
+ * `ResizeObserver`, so pairing the listener with the same lifecycle costs it
30
+ * nothing extra. A shared source has neither constraint, and no owning
31
+ * component to pair teardown with in the first place.
32
+ */
33
+ const query = typeof window !== 'undefined' && typeof window.matchMedia === 'function'
34
+ ? window.matchMedia('(prefers-reduced-motion: reduce)')
35
+ : null;
36
+ let current = $state(query?.matches ?? false);
37
+ query?.addEventListener('change', (event) => {
38
+ current = event.matches;
39
+ });
40
+ export const reducedMotion = {
41
+ get current() {
42
+ return current;
43
+ }
44
+ };