@webority/ui-elements 0.6.9 → 0.6.10
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.
- package/README.md +27 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,3 +21,30 @@ import '@webority/ui-elements'; // registers the custom elements
|
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
Component catalogue: <https://ui.webority.dev>
|
|
24
|
+
|
|
25
|
+
## Authoring a `<wui-*>` element
|
|
26
|
+
|
|
27
|
+
Rules learned from defects, not from style preference.
|
|
28
|
+
|
|
29
|
+
**Every public accessor needs a setter, not just a getter.** React sets a *property* on a
|
|
30
|
+
custom element whenever one exists on the instance, and only falls back to an attribute when
|
|
31
|
+
it does not. A getter-only accessor therefore throws
|
|
32
|
+
`Cannot set property x of #<ce> which has only a getter` the moment React renders
|
|
33
|
+
`<wui-thing x={1} />` — and because that happens *during render* it takes the whole page down,
|
|
34
|
+
not just the field. Write the setter through to the attribute:
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
get length() { return Number(this.getAttribute('length') ?? 6); }
|
|
38
|
+
set length(v) { this.setAttribute('length', String(v)); }
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Enforced by `pnpm check:parity`, which fails on a public getter with no setter.
|
|
42
|
+
|
|
43
|
+
**The accessible name has to land on the real control, not the host.** `aria-label` on the
|
|
44
|
+
custom element names the element, which is not what a screen reader reads and not what axe
|
|
45
|
+
checks. Copy it onto the `<input>`/`<button>` inside during render.
|
|
46
|
+
|
|
47
|
+
**Never position a floating panel by hand.** Use `anchorOverlay(trigger, panel)` — it flips
|
|
48
|
+
above the trigger when there is no room below and clamps horizontally. Four elements each had
|
|
49
|
+
their own copy of `top = rect.bottom + 4`; every one of them ran off the bottom of the screen,
|
|
50
|
+
and a `position: fixed` panel below the fold cannot be scrolled to.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/ui-elements",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.10",
|
|
4
4
|
"description": "Webority framework-agnostic UI custom elements (<wui-*>) — the single implementation of the interactive components, styled by @webority/theme. Used natively in Razor and wrapped by @webority/ui-react.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "module",
|