@juspay/svelte-ui-components 4.10.1 → 4.10.3

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 (2) hide show
  1. package/README.md +28 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -243,6 +243,34 @@ import '@juspay/svelte-ui-components/wc';
243
243
  Theming works identically to the Svelte components — the same `--{component}-{element}-{property}`
244
244
  CSS custom properties apply across the shadow DOM boundary.
245
245
 
246
+ ### Event handlers: use `addEventListener`, not `element.onclick`
247
+
248
+ Handlers are passed as **props**, and 93 of those props are named after event-handler
249
+ accessors that already exist on `HTMLElement` — `onclick`, `onchange`, `oninput`,
250
+ `onkeydown`, `ontouchstart` and 22 others. On a custom element the component's prop
251
+ wins, so assigning the property does not register a DOM handler the way it would
252
+ anywhere else:
253
+
254
+ ```js
255
+ const checkbox = document.querySelector('sui-checkbox');
256
+
257
+ // Sets the component's prop. On sui-checkbox and sui-toggle that prop is called
258
+ // with a boolean, so `event` here is `true` / `false`, not a MouseEvent.
259
+ checkbox.onclick = (event) => console.log(event.clientX); // undefined
260
+
261
+ // Always does what you expect.
262
+ checkbox.addEventListener('click', (event) => console.log(event.clientX));
263
+ ```
264
+
265
+ Two things are **not** affected: the inline HTML attribute (`<sui-button onclick="...">`)
266
+ never used this accessor, and `addEventListener` is untouched. Only the JavaScript
267
+ property assignment differs.
268
+
269
+ Renaming these is a breaking change to every element's JavaScript API, so the whole set
270
+ has to move at once at a major — the same way the `aria*` collisions were renamed in
271
+ 4.0.0. Until then the existing declarations are recorded in
272
+ `scripts/wc-parity/prop-parity.test.ts`, which fails the build on a new one.
273
+
246
274
  ---
247
275
 
248
276
  ## Theming
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/svelte-ui-components",
3
- "version": "4.10.1",
3
+ "version": "4.10.3",
4
4
  "description": "A themeable Svelte 5 UI component library with CSS custom property driven styling",
5
5
  "keywords": [
6
6
  "svelte",