@juspay/svelte-ui-components 3.1.6 → 3.2.1

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 (122) hide show
  1. package/README.md +55 -2
  2. package/dist/Accordion/Accordion.svelte +5 -1
  3. package/dist/Accordion/properties.d.ts +1 -0
  4. package/dist/AreaChart/AreaChart.svelte +8 -2
  5. package/dist/AreaChart/properties.d.ts +10 -0
  6. package/dist/Banner/Banner.svelte +5 -1
  7. package/dist/Banner/properties.d.ts +1 -0
  8. package/dist/BarChart/BarChart.svelte +8 -2
  9. package/dist/BarChart/properties.d.ts +8 -0
  10. package/dist/Book/Book.svelte +5 -1
  11. package/dist/Book/properties.d.ts +1 -0
  12. package/dist/Calendar/Calendar.svelte +11 -3
  13. package/dist/Calendar/properties.d.ts +11 -0
  14. package/dist/Chat/Chat.svelte +29 -9
  15. package/dist/Chat/properties.d.ts +9 -0
  16. package/dist/ChatBubble/ChatBubble.svelte +11 -3
  17. package/dist/ChatBubble/properties.d.ts +3 -0
  18. package/dist/ChatComposer/ChatComposer.svelte +38 -12
  19. package/dist/ChatComposer/properties.d.ts +12 -0
  20. package/dist/ChatHeader/ChatHeader.svelte +5 -1
  21. package/dist/ChatHeader/properties.d.ts +1 -0
  22. package/dist/ChatMessage/ChatMessage.svelte +11 -3
  23. package/dist/ChatMessage/properties.d.ts +3 -0
  24. package/dist/ChatMessageList/ChatMessageList.svelte +11 -3
  25. package/dist/ChatMessageList/properties.d.ts +6 -0
  26. package/dist/ChatSuggestions/ChatSuggestions.svelte +5 -1
  27. package/dist/ChatSuggestions/properties.d.ts +1 -0
  28. package/dist/CheckListItem/CheckListItem.svelte +5 -1
  29. package/dist/CheckListItem/properties.d.ts +1 -0
  30. package/dist/Checkbox/Checkbox.svelte +5 -1
  31. package/dist/Checkbox/properties.d.ts +1 -0
  32. package/dist/ChipInput/ChipInput.svelte +14 -4
  33. package/dist/ChipInput/properties.d.ts +4 -0
  34. package/dist/Choicebox/Choicebox.svelte +5 -1
  35. package/dist/Choicebox/properties.d.ts +1 -0
  36. package/dist/ColorPicker/ColorPicker.svelte +8 -2
  37. package/dist/ColorPicker/properties.d.ts +2 -0
  38. package/dist/Combobox/Combobox.svelte +26 -8
  39. package/dist/Combobox/properties.d.ts +8 -0
  40. package/dist/CommandMenu/CommandMenu.svelte +8 -2
  41. package/dist/CommandMenu/properties.d.ts +2 -0
  42. package/dist/ContextMenu/ContextMenu.svelte +11 -3
  43. package/dist/ContextMenu/properties.d.ts +3 -0
  44. package/dist/DateRangePicker/DateRangePicker.svelte +20 -6
  45. package/dist/DateRangePicker/properties.d.ts +19 -0
  46. package/dist/DualAxisBarChart/DualAxisBarChart.svelte +5 -1
  47. package/dist/DualAxisBarChart/properties.d.ts +4 -0
  48. package/dist/FileDropzoneTrigger/FileDropzoneTrigger.svelte +5 -1
  49. package/dist/FileDropzoneTrigger/properties.d.ts +1 -0
  50. package/dist/FileInput/FileInput.svelte +8 -2
  51. package/dist/FileInput/properties.d.ts +2 -0
  52. package/dist/FunnelChart/FunnelChart.svelte +8 -2
  53. package/dist/FunnelChart/properties.d.ts +8 -0
  54. package/dist/Img/Img.svelte +14 -2
  55. package/dist/Img/properties.d.ts +1 -0
  56. package/dist/Input/Input.svelte +23 -7
  57. package/dist/Input/properties.d.ts +7 -0
  58. package/dist/LineChart/LineChart.svelte +8 -2
  59. package/dist/LineChart/properties.d.ts +10 -0
  60. package/dist/ListItem/ListItem.svelte +17 -5
  61. package/dist/ListItem/properties.d.ts +5 -0
  62. package/dist/LottiePlayer/LottiePlayer.svelte +8 -2
  63. package/dist/LottiePlayer/properties.d.ts +2 -0
  64. package/dist/MediaPlayer/MediaPlayer.svelte +5 -1
  65. package/dist/MediaPlayer/properties.d.ts +1 -0
  66. package/dist/Menu/Menu.svelte +11 -3
  67. package/dist/Menu/properties.d.ts +3 -0
  68. package/dist/Modal/Modal.svelte +22 -6
  69. package/dist/Modal/properties.d.ts +6 -0
  70. package/dist/Pagination/Pagination.svelte +5 -1
  71. package/dist/Pagination/properties.d.ts +1 -0
  72. package/dist/PieChart/PieChart.svelte +8 -2
  73. package/dist/PieChart/properties.d.ts +8 -0
  74. package/dist/Pill/Pill.svelte +5 -1
  75. package/dist/Pill/properties.d.ts +1 -0
  76. package/dist/Radio/Radio.svelte +5 -1
  77. package/dist/Radio/properties.d.ts +1 -0
  78. package/dist/Resizable/Resizable.svelte +11 -3
  79. package/dist/Resizable/properties.d.ts +3 -0
  80. package/dist/SankeyChart/SankeyChart.svelte +14 -4
  81. package/dist/SankeyChart/properties.d.ts +12 -0
  82. package/dist/Scroller/Scroller.svelte +5 -1
  83. package/dist/Scroller/properties.d.ts +1 -0
  84. package/dist/Select/Select.svelte +11 -3
  85. package/dist/Select/properties.d.ts +3 -0
  86. package/dist/Sheet/Sheet.svelte +11 -3
  87. package/dist/Sheet/properties.d.ts +3 -0
  88. package/dist/Slider/Slider.svelte +8 -2
  89. package/dist/Slider/properties.d.ts +2 -0
  90. package/dist/Snippet/Snippet.svelte +5 -1
  91. package/dist/Snippet/properties.d.ts +1 -0
  92. package/dist/SplitButton/SplitButton.svelte +5 -1
  93. package/dist/SplitButton/properties.d.ts +1 -0
  94. package/dist/SplitInput/SplitInput.svelte +11 -3
  95. package/dist/SplitInput/properties.d.ts +3 -0
  96. package/dist/Status/Status.svelte +5 -1
  97. package/dist/Status/properties.d.ts +1 -0
  98. package/dist/Stepper/Stepper.svelte +8 -2
  99. package/dist/Stepper/properties.d.ts +9 -0
  100. package/dist/Tabs/Tabs.svelte +8 -2
  101. package/dist/Tabs/properties.d.ts +2 -0
  102. package/dist/TaskList/TaskList.svelte +4 -1
  103. package/dist/TaskList/properties.d.ts +1 -0
  104. package/dist/ThemeSwitcher/ThemeSwitcher.svelte +9 -1
  105. package/dist/ThemeSwitcher/properties.d.ts +1 -0
  106. package/dist/ThinkingIndicator/ThinkingIndicator.svelte +8 -2
  107. package/dist/ThinkingIndicator/properties.d.ts +2 -0
  108. package/dist/Toggle/Toggle.svelte +5 -1
  109. package/dist/Toggle/properties.d.ts +1 -0
  110. package/dist/ToolCallLog/ToolCallLog.svelte +10 -1
  111. package/dist/ToolCallLog/properties.d.ts +1 -0
  112. package/dist/Toolbar/Toolbar.svelte +5 -1
  113. package/dist/Toolbar/properties.d.ts +1 -0
  114. package/dist-wc/index.js +5542 -3454
  115. package/package.json +20 -5
  116. package/scripts/codemod/README.md +76 -0
  117. package/scripts/codemod/cli.ts +206 -0
  118. package/scripts/codemod/map.ts +118 -0
  119. package/scripts/codemod/transform.ts +549 -0
  120. package/scripts/codemod/tsconfig.json +15 -0
  121. package/scripts/codemod/wc-children.ts +75 -0
  122. package/scripts/postinstall.mjs +56 -0
package/README.md CHANGED
@@ -38,6 +38,53 @@ This library takes a different approach: **components are unstyled by default**
38
38
 
39
39
  ---
40
40
 
41
+ ## Coming in 4.0.0: one breaking change
42
+
43
+ Advance notice, not a change in this release. **Nothing below has happened yet** —
44
+ the current 3.x line still accepts everything it always did.
45
+
46
+ In 4.0.0, `children` stops being a declared property on `sui-chat-bubble`,
47
+ `sui-draggable` and `sui-resizable`. Assigning it will set an inert expando and
48
+ the content will silently disappear. Pass the content as light-DOM children
49
+ instead, which those wrappers will forward through their default slot:
50
+
51
+ ```js
52
+ el.children = mySnippet; // before — no longer works
53
+ ```
54
+
55
+ ```html
56
+ <sui-draggable><div>…</div></sui-draggable>
57
+ <!-- after -->
58
+ ```
59
+
60
+ **Reading `element.children` is what the change fixes.** Declaring the property
61
+ replaces the inherited accessor, so on those three elements `element.children`
62
+ returns `undefined` rather than an `HTMLCollection` today and
63
+ `el.children.length` throws. That is why the declaration has to go, and why it
64
+ cannot go before a major.
65
+
66
+ You can find affected call sites now, well before the major — this reports and
67
+ writes nothing:
68
+
69
+ ```sh
70
+ npx sui-codemod --dry-run ./src
71
+ ```
72
+
73
+ It flags `.children =` assignments only in files that also mention one of the
74
+ three elements, so ordinary DOM code is not reported. The fix moves content from
75
+ a JavaScript assignment into markup, which is a decision about where content is
76
+ authored, so the tool deliberately does not rewrite it for you. Requires Node
77
+ &ge;&nbsp;22.18; `typescript` is an optional peer dependency that the codemod's
78
+ Svelte-parsing paths need.
79
+
80
+ Nothing else in the custom-element surface breaks. Everything this release adds —
81
+ 185 wrapper props, three previously unregistered elements, the `spellcheck` and
82
+ `aria-haspopup` mappings, the snippet props on Banner, ListItem, Menu, Modal and
83
+ Button, Accordion's `disabled`, LottiePlayer's callbacks — is new surface or a
84
+ fix to something that did not work.
85
+
86
+ ---
87
+
41
88
  ## Quick Start
42
89
 
43
90
  ```svelte
@@ -165,8 +212,14 @@ component.
165
212
  <script type="module" src="https://juspay.github.io/svelte-ui-components/wc/index.js"></script>
166
213
 
167
214
  <!-- Pinned to an npm version, via jsDelivr or unpkg -->
168
- <script type="module" src="https://cdn.jsdelivr.net/npm/@juspay/svelte-ui-components@latest/dist-wc/index.js"></script>
169
- <script type="module" src="https://unpkg.com/@juspay/svelte-ui-components@latest/dist-wc/index.js"></script>
215
+ <script
216
+ type="module"
217
+ src="https://cdn.jsdelivr.net/npm/@juspay/svelte-ui-components@latest/dist-wc/index.js"
218
+ ></script>
219
+ <script
220
+ type="module"
221
+ src="https://unpkg.com/@juspay/svelte-ui-components@latest/dist-wc/index.js"
222
+ ></script>
170
223
 
171
224
  <sui-button>Click me</sui-button>
172
225
  <sui-input placeholder="Type here"></sui-input>
@@ -5,7 +5,8 @@
5
5
  expand = $bindable(false),
6
6
  children,
7
7
  trigger,
8
- ontoggle,
8
+ ontoggle: ontoggleLegacy,
9
+ onToggle,
9
10
  triggerClasses,
10
11
  classes,
11
12
  testId,
@@ -13,6 +14,9 @@
13
14
  panelId
14
15
  }: AccordionProperties = $props();
15
16
 
17
+ // Event-casing phase 1: both spellings accepted, the correct one wins.
18
+ const ontoggle = $derived(onToggle ?? ontoggleLegacy);
19
+
16
20
  /* The trigger and the panel are siblings, not ancestor/descendant, so nothing in the
17
21
  markup tells assistive technology which region the trigger's aria-expanded refers to.
18
22
  A generated id keeps that link automatic -- consumers pass no id and get correct
@@ -27,4 +27,5 @@ export type OptionalAccordionProperties = {
27
27
  };
28
28
  export type AccordionEventProperties = {
29
29
  ontoggle?: (expanded: boolean) => void;
30
+ onToggle?: (expanded: boolean) => void;
30
31
  };
@@ -51,12 +51,18 @@
51
51
  tooltipSnippet,
52
52
  empty,
53
53
  tooltipPortal = false,
54
- onpointhover,
55
- onpointclick,
54
+ onpointhover: onpointhoverLegacy,
55
+ onPointHover,
56
+ onpointclick: onpointclickLegacy,
57
+ onPointClick,
56
58
  testId,
57
59
  classes
58
60
  }: AreaChartProperties = $props();
59
61
 
62
+ // Event-casing phase 1: both spellings accepted, the correct one wins.
63
+ const onpointclick = $derived(onPointClick ?? onpointclickLegacy);
64
+ const onpointhover = $derived(onPointHover ?? onpointhoverLegacy);
65
+
60
66
  // ── State ──────────────────────────────────────────────────────
61
67
 
62
68
  let containerEl: HTMLDivElement | null = $state(null);
@@ -61,9 +61,19 @@ export type AreaChartEventProperties = {
61
61
  pointIndex: number;
62
62
  point: AreaChartDataPoint;
63
63
  } | null) => void;
64
+ onPointHover?: (event: {
65
+ seriesIndex: number;
66
+ pointIndex: number;
67
+ point: AreaChartDataPoint;
68
+ } | null) => void;
64
69
  onpointclick?: (event: {
65
70
  seriesIndex: number;
66
71
  pointIndex: number;
67
72
  point: AreaChartDataPoint;
68
73
  }) => void;
74
+ onPointClick?: (event: {
75
+ seriesIndex: number;
76
+ pointIndex: number;
77
+ point: AreaChartDataPoint;
78
+ }) => void;
69
79
  };
@@ -14,12 +14,16 @@
14
14
  rightContent,
15
15
  dismissIcon,
16
16
  onclick,
17
- ondismiss,
17
+ ondismiss: ondismissLegacy,
18
+ onDismiss,
18
19
  classes,
19
20
  title,
20
21
  role = null
21
22
  }: BannerProperties = $props();
22
23
 
24
+ // Event-casing phase 1: both spellings accepted, the correct one wins.
25
+ const ondismiss = $derived(onDismiss ?? ondismissLegacy);
26
+
23
27
  let interactive = $derived(typeof onclick === 'function');
24
28
 
25
29
  let rootClass = $derived(['banner', classes ?? ''].filter((c) => c.length > 0).join(' '));
@@ -18,4 +18,5 @@ export type OptionalBannerProperties = {
18
18
  export type BannerEventProperties = {
19
19
  onclick?: (event: MouseEvent) => void;
20
20
  ondismiss?: () => void;
21
+ onDismiss?: () => void;
21
22
  };
@@ -91,12 +91,18 @@
91
91
  interactiveLegend = false,
92
92
  hideLegendBelow = 360,
93
93
  tooltipPortal = false,
94
- onbarclick,
95
- onbarhover,
94
+ onbarclick: onbarclickLegacy,
95
+ onBarClick,
96
+ onbarhover: onbarhoverLegacy,
97
+ onBarHover,
96
98
  testId,
97
99
  classes
98
100
  }: BarChartProperties = $props();
99
101
 
102
+ // Event-casing phase 1: both spellings accepted, the correct one wins.
103
+ const onbarclick = $derived(onBarClick ?? onbarclickLegacy);
104
+ const onbarhover = $derived(onBarHover ?? onbarhoverLegacy);
105
+
100
106
  // ── State ──────────────────────────────────────────────────────
101
107
 
102
108
  let containerEl: HTMLDivElement | null = $state(null);
@@ -231,8 +231,16 @@ export type BarChartEventProperties = {
231
231
  index: number;
232
232
  dataPoint: BarChartDataPoint;
233
233
  }) => void;
234
+ onBarClick?: (event: {
235
+ index: number;
236
+ dataPoint: BarChartDataPoint;
237
+ }) => void;
234
238
  onbarhover?: (event: {
235
239
  index: number;
236
240
  dataPoint: BarChartDataPoint;
237
241
  } | null) => void;
242
+ onBarHover?: (event: {
243
+ index: number;
244
+ dataPoint: BarChartDataPoint;
245
+ } | null) => void;
238
246
  };
@@ -14,10 +14,14 @@
14
14
  testId,
15
15
  previousIcon,
16
16
  nextIcon,
17
- onpagechange,
17
+ onpagechange: onpagechangeLegacy,
18
+ onPageChange,
18
19
  classes
19
20
  }: BookProperties = $props();
20
21
 
22
+ // Event-casing phase 1: both spellings accepted, the correct one wins.
23
+ const onpagechange = $derived(onPageChange ?? onpagechangeLegacy);
24
+
21
25
  let startX = 0;
22
26
  let isDragging = false;
23
27
 
@@ -21,4 +21,5 @@ export type OptionalBookProperties = {
21
21
  };
22
22
  export type BookEventProperties = {
23
23
  onpagechange?: (page: number) => void;
24
+ onPageChange?: (page: number) => void;
24
25
  };
@@ -19,13 +19,21 @@
19
19
  testId,
20
20
  previousMonthIcon,
21
21
  nextMonthIcon,
22
- onselect,
23
- onrangeselect,
24
- onmonthchange,
22
+ onselect: onselectLegacy,
23
+ onSelect,
24
+ onrangeselect: onrangeselectLegacy,
25
+ onRangeSelect,
26
+ onmonthchange: onmonthchangeLegacy,
27
+ onMonthChange,
25
28
  classes,
26
29
  initialMonth = null
27
30
  }: CalendarProperties = $props();
28
31
 
32
+ // Event-casing phase 1: both spellings accepted, the correct one wins.
33
+ const onmonthchange = $derived(onMonthChange ?? onmonthchangeLegacy);
34
+ const onrangeselect = $derived(onRangeSelect ?? onrangeselectLegacy);
35
+ const onselect = $derived(onSelect ?? onselectLegacy);
36
+
29
37
  const now = new SvelteDate();
30
38
  // Intentionally read initialMonth once (untracked) — it seeds the display month at mount
31
39
  // and subsequent prop changes should not navigate the calendar (user navigates via the buttons).
@@ -21,12 +21,23 @@ export type CalendarEventProperties = {
21
21
  onselect?: (event: {
22
22
  date: Date;
23
23
  }) => void;
24
+ onSelect?: (event: {
25
+ date: Date;
26
+ }) => void;
24
27
  onrangeselect?: (event: {
25
28
  rangeStart: Date;
26
29
  rangeEnd: Date;
27
30
  }) => void;
31
+ onRangeSelect?: (event: {
32
+ rangeStart: Date;
33
+ rangeEnd: Date;
34
+ }) => void;
28
35
  onmonthchange?: (event: {
29
36
  year: number;
30
37
  month: number;
31
38
  }) => void;
39
+ onMonthChange?: (event: {
40
+ year: number;
41
+ month: number;
42
+ }) => void;
32
43
  };
@@ -43,19 +43,39 @@
43
43
  stopIcon,
44
44
  voiceIcon,
45
45
  attachIcon,
46
- onsend,
47
- onsuggestion,
48
- onclose,
49
- onstop,
50
- onvoice,
51
- onattach,
52
- onretry,
53
- onfeedback,
54
- onscrollstate,
46
+ onsend: onsendLegacy,
47
+ onSend,
48
+ onsuggestion: onsuggestionLegacy,
49
+ onSuggestion,
50
+ onclose: oncloseLegacy,
51
+ onClose,
52
+ onstop: onstopLegacy,
53
+ onStop,
54
+ onvoice: onvoiceLegacy,
55
+ onVoice,
56
+ onattach: onattachLegacy,
57
+ onAttach,
58
+ onretry: onretryLegacy,
59
+ onRetry,
60
+ onfeedback: onfeedbackLegacy,
61
+ onFeedback,
62
+ onscrollstate: onscrollstateLegacy,
63
+ onScrollState,
55
64
  testId,
56
65
  classes
57
66
  }: ChatProperties = $props();
58
67
 
68
+ // Event-casing phase 1: both spellings accepted, the correct one wins.
69
+ const onattach = $derived(onAttach ?? onattachLegacy);
70
+ const onclose = $derived(onClose ?? oncloseLegacy);
71
+ const onfeedback = $derived(onFeedback ?? onfeedbackLegacy);
72
+ const onretry = $derived(onRetry ?? onretryLegacy);
73
+ const onscrollstate = $derived(onScrollState ?? onscrollstateLegacy);
74
+ const onsend = $derived(onSend ?? onsendLegacy);
75
+ const onstop = $derived(onStop ?? onstopLegacy);
76
+ const onsuggestion = $derived(onSuggestion ?? onsuggestionLegacy);
77
+ const onvoice = $derived(onVoice ?? onvoiceLegacy);
78
+
59
79
  let showHeader = $derived(
60
80
  title.length > 0 ||
61
81
  subtitle.length > 0 ||
@@ -49,12 +49,21 @@ export type OptionalChatProperties = {
49
49
  };
50
50
  export type ChatEventProperties = {
51
51
  onsend?: (value: string, attachments: File[]) => void;
52
+ onSend?: (value: string, attachments: File[]) => void;
52
53
  onsuggestion?: (value: string, index: number) => void;
54
+ onSuggestion?: (value: string, index: number) => void;
53
55
  onclose?: () => void;
56
+ onClose?: () => void;
54
57
  onstop?: () => void;
58
+ onStop?: () => void;
55
59
  onvoice?: () => void;
60
+ onVoice?: () => void;
56
61
  onattach?: (files: File[]) => void;
62
+ onAttach?: (files: File[]) => void;
57
63
  onretry?: () => void;
64
+ onRetry?: () => void;
58
65
  onfeedback?: (value: ChatMessageFeedback, message: ChatMessageData) => void;
66
+ onFeedback?: (value: ChatMessageFeedback, message: ChatMessageData) => void;
59
67
  onscrollstate?: ChatMessageListProperties['onscrollstate'];
68
+ onScrollState?: ChatMessageListProperties['onscrollstate'];
60
69
  };
@@ -27,13 +27,21 @@
27
27
  expanded = $bindable(false),
28
28
  expandedPanelWidth = $bindable(600),
29
29
  expandedPanelHeight = $bindable(760),
30
- onopen,
31
- onclose,
32
- ontoggle,
30
+ onopen: onopenLegacy,
31
+ onOpen,
32
+ onclose: oncloseLegacy,
33
+ onClose,
34
+ ontoggle: ontoggleLegacy,
35
+ onToggle,
33
36
  testId,
34
37
  classes
35
38
  }: ChatBubbleProperties = $props();
36
39
 
40
+ // Event-casing phase 1: both spellings accepted, the correct one wins.
41
+ const onclose = $derived(onClose ?? oncloseLegacy);
42
+ const onopen = $derived(onOpen ?? onopenLegacy);
43
+ const ontoggle = $derived(onToggle ?? ontoggleLegacy);
44
+
37
45
  const DRAG_THRESHOLD = 4;
38
46
 
39
47
  function handlesFor(vertical: 'top' | 'bottom', side: 'left' | 'right'): ResizeEdge[] {
@@ -38,6 +38,9 @@ export type OptionalChatBubbleProperties = {
38
38
  };
39
39
  export type ChatBubbleEventProperties = {
40
40
  onopen?: () => void;
41
+ onOpen?: () => void;
41
42
  onclose?: () => void;
43
+ onClose?: () => void;
42
44
  ontoggle?: (open: boolean) => void;
45
+ onToggle?: (open: boolean) => void;
43
46
  };
@@ -26,12 +26,18 @@
26
26
  richVideoTooltip,
27
27
  richRemoveIcon,
28
28
  richFileIcon,
29
- onremoverichimage,
30
- onremoverichfile,
31
- onremoverichvideo,
32
- onopenrichimage,
33
- onopenrichvideo,
34
- onopenrichfile,
29
+ onremoverichimage: onremoverichimageLegacy,
30
+ onRemoveRichImage,
31
+ onremoverichfile: onremoverichfileLegacy,
32
+ onRemoveRichFile,
33
+ onremoverichvideo: onremoverichvideoLegacy,
34
+ onRemoveRichVideo,
35
+ onopenrichimage: onopenrichimageLegacy,
36
+ onOpenRichImage,
37
+ onopenrichvideo: onopenrichvideoLegacy,
38
+ onOpenRichVideo,
39
+ onopenrichfile: onopenrichfileLegacy,
40
+ onOpenRichFile,
35
41
  sendable = null,
36
42
  accept = '',
37
43
  multiple = false,
@@ -46,15 +52,21 @@
46
52
  actionIcon,
47
53
  actionLabel = 'Voice conversation',
48
54
  leading,
49
- onsubmit,
55
+ onsubmit: onsubmitLegacy,
56
+ onSubmit,
50
57
  oninput,
51
58
  onkeydown,
52
59
  onpaste,
53
- onstop,
54
- onvoice,
55
- onattach,
56
- onattachclick,
57
- onaction,
60
+ onstop: onstopLegacy,
61
+ onStop,
62
+ onvoice: onvoiceLegacy,
63
+ onVoice,
64
+ onattach: onattachLegacy,
65
+ onAttach,
66
+ onattachclick: onattachclickLegacy,
67
+ onAttachClick,
68
+ onaction: onactionLegacy,
69
+ onAction,
58
70
  testId,
59
71
  inputTestId,
60
72
  inputAriaLabel,
@@ -67,6 +79,20 @@
67
79
  classes
68
80
  }: ChatComposerProperties = $props();
69
81
 
82
+ // Event-casing phase 1: both spellings accepted, the correct one wins.
83
+ const onaction = $derived(onAction ?? onactionLegacy);
84
+ const onattach = $derived(onAttach ?? onattachLegacy);
85
+ const onattachclick = $derived(onAttachClick ?? onattachclickLegacy);
86
+ const onopenrichfile = $derived(onOpenRichFile ?? onopenrichfileLegacy);
87
+ const onopenrichimage = $derived(onOpenRichImage ?? onopenrichimageLegacy);
88
+ const onopenrichvideo = $derived(onOpenRichVideo ?? onopenrichvideoLegacy);
89
+ const onremoverichfile = $derived(onRemoveRichFile ?? onremoverichfileLegacy);
90
+ const onremoverichimage = $derived(onRemoveRichImage ?? onremoverichimageLegacy);
91
+ const onremoverichvideo = $derived(onRemoveRichVideo ?? onremoverichvideoLegacy);
92
+ const onstop = $derived(onStop ?? onstopLegacy);
93
+ const onsubmit = $derived(onSubmit ?? onsubmitLegacy);
94
+ const onvoice = $derived(onVoice ?? onvoiceLegacy);
95
+
70
96
  let fileInput: HTMLInputElement | null = $state(null);
71
97
 
72
98
  let showVoice = $derived(typeof onvoice === 'function');
@@ -73,37 +73,49 @@ export type OptionalChatComposerProperties = {
73
73
  };
74
74
  export type ChatComposerEventProperties = {
75
75
  onsubmit?: (value: string, attachments: File[]) => void;
76
+ onSubmit?: (value: string, attachments: File[]) => void;
76
77
  oninput?: (value: string, event: Event) => void;
77
78
  onkeydown?: (event: KeyboardEvent) => void;
78
79
  onpaste?: (event: ClipboardEvent) => void;
79
80
  onstop?: () => void;
81
+ onStop?: () => void;
80
82
  onvoice?: () => void;
83
+ onVoice?: () => void;
81
84
  onattach?: (files: File[]) => void;
85
+ onAttach?: (files: File[]) => void;
82
86
  /**
83
87
  * Intercepts the attach button: when provided, clicking it calls this instead of
84
88
  * opening the built-in file picker — for apps with their own chooser (camera /
85
89
  * gallery / files).
86
90
  */
87
91
  onattachclick?: () => void;
92
+ onAttachClick?: () => void;
88
93
  /**
89
94
  * Removal callbacks for the rich strip's chips. Omit them to render the rich
90
95
  * chips read-only (no remove buttons), mirroring AttachmentChipRow.
91
96
  */
92
97
  onremoverichimage?: (id: string) => void;
98
+ onRemoveRichImage?: (id: string) => void;
93
99
  onremoverichfile?: (id: string) => void;
100
+ onRemoveRichFile?: (id: string) => void;
94
101
  onremoverichvideo?: (id: string) => void;
102
+ onRemoveRichVideo?: (id: string) => void;
95
103
  /**
96
104
  * Open/preview callbacks for the rich strip's chips — when provided, a chip's
97
105
  * tile becomes a real button and clicking it fires with the attachment (e.g.
98
106
  * open a lightbox, play the video).
99
107
  */
100
108
  onopenrichimage?: (image: AttachmentChipImage) => void;
109
+ onOpenRichImage?: (image: AttachmentChipImage) => void;
101
110
  onopenrichvideo?: (video: AttachmentChipVideo) => void;
111
+ onOpenRichVideo?: (video: AttachmentChipVideo) => void;
102
112
  onopenrichfile?: (file: AttachmentChipFile) => void;
113
+ onOpenRichFile?: (file: AttachmentChipFile) => void;
103
114
  /**
104
115
  * The composer's idle action (e.g. voice conversation mode). While the value is
105
116
  * empty, nothing is sendable and no reply is streaming, the send button gives way
106
117
  * to an action button that fires this.
107
118
  */
108
119
  onaction?: () => void;
120
+ onAction?: () => void;
109
121
  };
@@ -14,12 +14,16 @@
14
14
  closeIcon,
15
15
  closeLabel = 'Close',
16
16
  showClose,
17
- onclose,
17
+ onclose: oncloseLegacy,
18
+ onClose,
18
19
  children,
19
20
  testId,
20
21
  classes
21
22
  }: ChatHeaderProperties = $props();
22
23
 
24
+ // Event-casing phase 1: both spellings accepted, the correct one wins.
25
+ const onclose = $derived(onClose ?? oncloseLegacy);
26
+
23
27
  let displayClose = $derived(showClose ?? typeof onclose === 'function');
24
28
  </script>
25
29
 
@@ -16,4 +16,5 @@ export type OptionalChatHeaderProperties = {
16
16
  };
17
17
  export type ChatHeaderEventProperties = {
18
18
  onclose?: () => void;
19
+ onClose?: () => void;
19
20
  };
@@ -27,13 +27,21 @@
27
27
  retryLabel = 'Retry',
28
28
  feedbackUpLabel = 'Good response',
29
29
  feedbackDownLabel = 'Bad response',
30
- onretry,
31
- onfeedback,
32
- oncopy,
30
+ onretry: onretryLegacy,
31
+ onRetry,
32
+ onfeedback: onfeedbackLegacy,
33
+ onFeedback,
34
+ oncopy: oncopyLegacy,
35
+ onCopy,
33
36
  testId,
34
37
  classes
35
38
  }: ChatMessageProperties = $props();
36
39
 
40
+ // Event-casing phase 1: both spellings accepted, the correct one wins.
41
+ const oncopy = $derived(onCopy ?? oncopyLegacy);
42
+ const onfeedback = $derived(onFeedback ?? onfeedbackLegacy);
43
+ const onretry = $derived(onRetry ?? onretryLegacy);
44
+
37
45
  let party = $derived(partyOf(role));
38
46
 
39
47
  let copied = $state(false);
@@ -43,6 +43,9 @@ export type OptionalChatMessageProperties = {
43
43
  };
44
44
  export type ChatMessageEventProperties = {
45
45
  onretry?: (() => void) | null;
46
+ onRetry?: (() => void) | null;
46
47
  onfeedback?: ((value: ChatMessageFeedback) => void) | null;
48
+ onFeedback?: ((value: ChatMessageFeedback) => void) | null;
47
49
  oncopy?: (text: string) => void;
50
+ onCopy?: (text: string) => void;
48
51
  };
@@ -23,13 +23,21 @@
23
23
  jumpLabel = 'Jump to latest',
24
24
  jumpIcon,
25
25
  allowCopy = false,
26
- onscrollstate,
27
- onretry,
28
- onfeedback,
26
+ onscrollstate: onscrollstateLegacy,
27
+ onScrollState,
28
+ onretry: onretryLegacy,
29
+ onRetry,
30
+ onfeedback: onfeedbackLegacy,
31
+ onFeedback,
29
32
  testId,
30
33
  classes
31
34
  }: ChatMessageListProperties = $props();
32
35
 
36
+ // Event-casing phase 1: both spellings accepted, the correct one wins.
37
+ const onfeedback = $derived(onFeedback ?? onfeedbackLegacy);
38
+ const onretry = $derived(onRetry ?? onretryLegacy);
39
+ const onscrollstate = $derived(onScrollState ?? onscrollstateLegacy);
40
+
33
41
  let listEl: HTMLElement | null = $state(null);
34
42
  let innerEl: HTMLElement | null = $state(null);
35
43
  let atBottom = $state(true);
@@ -49,6 +49,12 @@ export type ChatMessageListEventProperties = {
49
49
  atBottom: boolean;
50
50
  scrollable: boolean;
51
51
  }) => void;
52
+ onScrollState?: (state: {
53
+ atBottom: boolean;
54
+ scrollable: boolean;
55
+ }) => void;
52
56
  onretry?: () => void;
57
+ onRetry?: () => void;
53
58
  onfeedback?: (value: ChatMessageFeedback, message: ChatMessageData) => void;
59
+ onFeedback?: (value: ChatMessageFeedback, message: ChatMessageData) => void;
54
60
  };
@@ -13,11 +13,15 @@
13
13
  loading = false,
14
14
  icon,
15
15
  chipClasses,
16
- onselect,
16
+ onselect: onselectLegacy,
17
+ onSelect,
17
18
  testId,
18
19
  classes
19
20
  }: ChatSuggestionsProperties = $props();
20
21
 
22
+ // Event-casing phase 1: both spellings accepted, the correct one wins.
23
+ const onselect = $derived(onSelect ?? onselectLegacy);
24
+
21
25
  const labelOf = (item: ChatSuggestion): string => (typeof item === 'string' ? item : item.label);
22
26
 
23
27
  const valueOf = (item: ChatSuggestion): string => {
@@ -55,4 +55,5 @@ export type OptionalChatSuggestionsProperties = {
55
55
  };
56
56
  export type ChatSuggestionsEventProperties = {
57
57
  onselect?: (value: string, index: number) => void;
58
+ onSelect?: (value: string, index: number) => void;
58
59
  };
@@ -8,10 +8,14 @@
8
8
  disabled = false,
9
9
  checkboxLabel,
10
10
  testId,
11
- onclick,
11
+ onclick: onclickLegacy,
12
+ onClick,
12
13
  classes
13
14
  }: CheckListItemProperties = $props();
14
15
 
16
+ // Event-casing phase 1: both spellings accepted, the correct one wins.
17
+ const onclick = $derived(onClick ?? onclickLegacy);
18
+
15
19
  function handleClick(value: boolean): void {
16
20
  checked = value;
17
21
  onclick?.(checked);
@@ -12,4 +12,5 @@ export type OptionalCheckListItemProperties = {
12
12
  };
13
13
  export type CheckListItemEventProperties = {
14
14
  onclick?: (checked: boolean) => void;
15
+ onClick?: (checked: boolean) => void;
15
16
  };