@webority/ui-react 0.9.3 → 0.9.5
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/dist/iconCatalogFull.bold.g-OK3eOiMp.js +947 -0
- package/dist/iconCatalogFull.broken.g-BZsyxXcp.js +947 -0
- package/dist/iconCatalogFull.bulk.g-B7wsb4AN.js +947 -0
- package/dist/iconCatalogFull.g-BKUr0SVj.js +947 -0
- package/dist/iconCatalogFull.outline.g-AOnxJAAj.js +947 -0
- package/dist/iconCatalogFull.twotone.g-DR6Qdpib.js +947 -0
- package/dist/{iconVariants.g-BL1d2HPV.js → iconVariants.g-CLikIWjb.js} +5 -5
- package/dist/types/components/iconCatalogFull.bold.g.d.ts +944 -0
- package/dist/types/components/iconCatalogFull.broken.g.d.ts +944 -0
- package/dist/types/components/iconCatalogFull.bulk.g.d.ts +944 -0
- package/dist/types/components/iconCatalogFull.g.d.ts +0 -4722
- package/dist/types/components/iconCatalogFull.outline.g.d.ts +944 -0
- package/dist/types/components/iconCatalogFull.twotone.g.d.ts +944 -0
- package/dist/types/components/useWuiControl.d.ts +15 -1
- package/dist/ui-react.js +707 -657
- package/package.json +3 -3
- package/dist/iconCatalogFull.g-DHZusHbO.js +0 -5668
|
@@ -6,6 +6,14 @@
|
|
|
6
6
|
* 2. sync a controlled `value` prop onto the element
|
|
7
7
|
* 3. listen for the element's `change` event and call `onChange`
|
|
8
8
|
*
|
|
9
|
+
* Listeners are wired in the REF CALLBACK, not an effect. React recreates the element
|
|
10
|
+
* whenever its position in the tree changes — e.g. a wrapper's `.field` shell appearing the
|
|
11
|
+
* moment `error` turns truthy — and an effect keyed on callbacks never sees the new element,
|
|
12
|
+
* leaving it write-only with no change listener, so everything typed after a validation error
|
|
13
|
+
* silently stops reaching React state. The ref callback is the one place element identity
|
|
14
|
+
* changes are guaranteed to pass through, so wiring there makes recreation safe: the new
|
|
15
|
+
* element is re-wired and the controlled value pushed onto it immediately.
|
|
16
|
+
*
|
|
9
17
|
* Callers that need extra effects (options arrays, remote loaders, dual-thumb ranges)
|
|
10
18
|
* keep those beside this hook — only the common path lives here.
|
|
11
19
|
*
|
|
@@ -22,17 +30,23 @@
|
|
|
22
30
|
* `['input','change']` for controls that fire `input` live and `change` only on commit
|
|
23
31
|
* (phone) so React controlled state stays current; values are de-duped so both events in
|
|
24
32
|
* one gesture do not double-call with the same value.
|
|
33
|
+
* @param {Record<string, (e: Event) => void>} [opts.on] Extra element events → handlers
|
|
34
|
+
* (e.g. `{ complete: (e) => onComplete?.(e.detail) }`), wired with the same
|
|
35
|
+
* survives-element-recreation lifecycle as the change listeners. Handlers always see the
|
|
36
|
+
* latest render's callbacks; the map's KEYS must be stable across renders (the values may
|
|
37
|
+
* be fresh closures).
|
|
25
38
|
* @param {unknown[]} [opts.syncDeps] Extra deps that should re-run the write effect
|
|
26
39
|
* (rarely needed — prefer baking state into `value`).
|
|
27
40
|
* @returns {{ setRef: (el: HTMLElement | null) => void, innerRef: import('react').MutableRefObject<HTMLElement | null> }}
|
|
28
41
|
*/
|
|
29
|
-
export default function useWuiControl({ ref, value, onChange, readValue, writeValue, events, syncDeps }?: {
|
|
42
|
+
export default function useWuiControl({ ref, value, onChange, readValue, writeValue, events, on, syncDeps }?: {
|
|
30
43
|
ref?: import('react').Ref<HTMLElement>;
|
|
31
44
|
value?: unknown;
|
|
32
45
|
onChange?: (value: unknown) => void;
|
|
33
46
|
readValue?: (el: HTMLElement) => unknown;
|
|
34
47
|
writeValue?: (el: HTMLElement, value: unknown) => void;
|
|
35
48
|
events?: string[];
|
|
49
|
+
on?: Record<string, (e: Event) => void>;
|
|
36
50
|
syncDeps?: unknown[];
|
|
37
51
|
}): {
|
|
38
52
|
setRef: (el: HTMLElement | null) => void;
|