@webority/ui-react 0.7.6 → 0.7.7
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/types/components/AppAutocomplete.d.ts +1 -1
- package/dist/types/components/AppCheckbox.d.ts +1 -1
- package/dist/types/components/AppDatePicker.d.ts +1 -1
- package/dist/types/components/AppDateRangePicker.d.ts +1 -1
- package/dist/types/components/AppMultiSelect.d.ts +1 -1
- package/dist/types/components/AppNumberInput.d.ts +5 -1
- package/dist/types/components/AppRadio.d.ts +1 -1
- package/dist/types/components/AppShell.d.ts +11 -6
- package/dist/types/components/AppSlider.d.ts +1 -1
- package/dist/types/components/AppSwitch.d.ts +1 -1
- package/dist/types/components/AppTagInput.d.ts +1 -1
- package/dist/types/components/AppTimePicker.d.ts +1 -1
- package/dist/types/components/AppToastContainer.d.ts +6 -7
- package/dist/types/components/__tests__/restPassthrough.d.ts +9 -0
- package/dist/types/components/toastStore.d.ts +1 -0
- package/dist/types/components/useWuiControl.d.ts +55 -0
- package/dist/ui-react.js +1072 -862
- package/package.json +3 -3
|
@@ -33,7 +33,7 @@ import '@webority/ui-elements';
|
|
|
33
33
|
* @param {import('react').ReactNode} [props.help] Help content shown in an info tip beside the label.
|
|
34
34
|
* @param {string} [props.helpLabel="More information"] Accessible name for that info tip.
|
|
35
35
|
* @param {string} [props.fieldClassName]
|
|
36
|
-
* @param {import('react').Ref} [ref]
|
|
36
|
+
* @param {import('react').Ref<HTMLElement>} [ref]
|
|
37
37
|
*/
|
|
38
38
|
declare const AppAutocomplete: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
|
|
39
39
|
export default AppAutocomplete;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* @param {string} [props.error] Error message, rendered below the control. Replaces the hint.
|
|
14
14
|
* @param {string} [props.hint] Helper text below the control. Hidden while an error is shown.
|
|
15
15
|
* @param {string} [props.className]
|
|
16
|
-
* @param {import('react').Ref} [ref]
|
|
16
|
+
* @param {import('react').Ref<HTMLInputElement>} [ref]
|
|
17
17
|
*/
|
|
18
18
|
declare const AppCheckbox: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
|
|
19
19
|
export default AppCheckbox;
|
|
@@ -26,7 +26,7 @@ import '@webority/ui-elements';
|
|
|
26
26
|
* @param {string} [props.id]
|
|
27
27
|
* @param {string} [props.ariaLabel]
|
|
28
28
|
* @param {string} [props.className]
|
|
29
|
-
* @param {import('react').Ref} [ref]
|
|
29
|
+
* @param {import('react').Ref<HTMLElement>} [ref]
|
|
30
30
|
*/
|
|
31
31
|
declare const AppDatePicker: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
|
|
32
32
|
export default AppDatePicker;
|
|
@@ -27,7 +27,7 @@ import '@webority/ui-elements';
|
|
|
27
27
|
* @param {string} [props.id]
|
|
28
28
|
* @param {string} [props.ariaLabel]
|
|
29
29
|
* @param {string} [props.className]
|
|
30
|
-
* @param {import('react').Ref} [ref]
|
|
30
|
+
* @param {import('react').Ref<HTMLElement>} [ref]
|
|
31
31
|
*/
|
|
32
32
|
declare const AppDateRangePicker: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
|
|
33
33
|
export default AppDateRangePicker;
|
|
@@ -23,7 +23,7 @@ import '@webority/ui-elements';
|
|
|
23
23
|
* @param {import('react').ReactNode} [props.help] Help content shown in an info tip beside the label.
|
|
24
24
|
* @param {string} [props.helpLabel="More information"] Accessible name for that info tip.
|
|
25
25
|
* @param {string} [props.fieldClassName]
|
|
26
|
-
* @param {import('react').Ref} [ref]
|
|
26
|
+
* @param {import('react').Ref<HTMLElement>} [ref]
|
|
27
27
|
*/
|
|
28
28
|
declare const AppMultiSelect: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
|
|
29
29
|
export default AppMultiSelect;
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
* Numeric field with ±/step stepper buttons, min/max clamping, and precision rounding.
|
|
3
3
|
* Mirrors the AppInput field-shell pattern (label/error/hint/required/aria wiring) exactly.
|
|
4
4
|
*
|
|
5
|
-
* Forwards `ref` to the underlying input
|
|
5
|
+
* Forwards `ref` to the underlying input. `onChange` is called with a **number** (or `''`),
|
|
6
|
+
* not a DOM event — react-hook-form's plain `{...register('x')}` spread expects an event and
|
|
7
|
+
* will not work here. Wire it with `<Controller name="x" render={({ field }) => (
|
|
8
|
+
* <AppNumberInput value={field.value} onChange={field.onChange} />
|
|
9
|
+
* )} />` instead.
|
|
6
10
|
*
|
|
7
11
|
* Behavior:
|
|
8
12
|
* - Displays as a text input (inputmode decimal when precision > 0, numeric otherwise)
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* @param {string} [props.error] Error message, rendered below the control. Replaces the hint.
|
|
14
14
|
* @param {string} [props.hint] Helper text below the control. Hidden while an error is shown.
|
|
15
15
|
* @param {string} [props.className]
|
|
16
|
-
* @param {import('react').Ref} [ref]
|
|
16
|
+
* @param {import('react').Ref<HTMLInputElement>} [ref]
|
|
17
17
|
*/
|
|
18
18
|
declare const AppRadio: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
|
|
19
19
|
export default AppRadio;
|
|
@@ -2,9 +2,10 @@ export type NavItemShape = {
|
|
|
2
2
|
key?: string;
|
|
3
3
|
label: string;
|
|
4
4
|
/**
|
|
5
|
-
* Bootstrap Icons name
|
|
5
|
+
* Bootstrap Icons name — or a node, so a
|
|
6
|
+
* product with its own content-icon set (iconsax behind a product `Icon` seam) can use it.
|
|
6
7
|
*/
|
|
7
|
-
icon?: string;
|
|
8
|
+
icon?: string | import('react').ReactNode;
|
|
8
9
|
href: string;
|
|
9
10
|
/**
|
|
10
11
|
* A count or short status at the row's end.
|
|
@@ -17,7 +18,7 @@ export type NavItemShape = {
|
|
|
17
18
|
/**
|
|
18
19
|
* A right-aligned secondary glyph (lock, external arrow, new dot).
|
|
19
20
|
*/
|
|
20
|
-
trailingIcon?: string;
|
|
21
|
+
trailingIcon?: string | import('react').ReactNode;
|
|
21
22
|
/**
|
|
22
23
|
* The current page — takes the brand tint + aria-current.
|
|
23
24
|
*/
|
|
@@ -31,11 +32,12 @@ export type NavItemShape = {
|
|
|
31
32
|
* @typedef {object} NavItemShape
|
|
32
33
|
* @property {string} [key]
|
|
33
34
|
* @property {string} label
|
|
34
|
-
* @property {string} [icon] Bootstrap Icons name
|
|
35
|
+
* @property {string|import('react').ReactNode} [icon] Bootstrap Icons name — or a node, so a
|
|
36
|
+
* product with its own content-icon set (iconsax behind a product `Icon` seam) can use it.
|
|
35
37
|
* @property {string} href
|
|
36
38
|
* @property {import('react').ReactNode} [badge] A count or short status at the row's end.
|
|
37
39
|
* @property {'danger'|'success'|'warning'} [badgeTone] Tints the badge for an alert count.
|
|
38
|
-
* @property {string} [trailingIcon] A right-aligned secondary glyph (lock, external arrow, new dot).
|
|
40
|
+
* @property {string|import('react').ReactNode} [trailingIcon] A right-aligned secondary glyph (lock, external arrow, new dot).
|
|
39
41
|
* @property {boolean} [active] The current page — takes the brand tint + aria-current.
|
|
40
42
|
* @property {NavItemShape[]} [children] Sub-items — the row becomes an expandable parent.
|
|
41
43
|
*/
|
|
@@ -55,6 +57,8 @@ export type NavItemShape = {
|
|
|
55
57
|
* @param {{ label?: string, items: NavItemShape[] }[]} props.groups Nav groups, in order.
|
|
56
58
|
* Groups after the first are separated by a rule.
|
|
57
59
|
* @param {import('react').ReactNode} [props.brand] The logo row at the top of the sidebar.
|
|
60
|
+
* @param {import('react').ReactNode} [props.sidebarStart] Between the brand row and the nav —
|
|
61
|
+
* a workspace/tenant switcher, an environment badge. Hidden on the collapsed rail.
|
|
58
62
|
* @param {import('react').ReactNode} [props.sidebarFooter] Pinned below the scrolling nav.
|
|
59
63
|
* @param {import('react').ReactNode} [props.topbarStart] Leading topbar slot — page title, crumbs.
|
|
60
64
|
* @param {import('react').ReactNode} [props.topbarEnd] Trailing topbar slot — search, account menu.
|
|
@@ -66,12 +70,13 @@ export type NavItemShape = {
|
|
|
66
70
|
* @param {string} [props.navLabel='Main navigation']
|
|
67
71
|
* @param {string} [props.className]
|
|
68
72
|
*/
|
|
69
|
-
export default function AppShell({ groups, brand, sidebarFooter, topbarStart, topbarEnd, footer, children, collapsed, onCollapsedChange, noSidebar, navLabel, linkComponent: Link, className, ...rest }: {
|
|
73
|
+
export default function AppShell({ groups, brand, sidebarStart, sidebarFooter, topbarStart, topbarEnd, footer, children, collapsed, onCollapsedChange, noSidebar, navLabel, linkComponent: Link, className, ...rest }: {
|
|
70
74
|
groups: {
|
|
71
75
|
label?: string;
|
|
72
76
|
items: NavItemShape[];
|
|
73
77
|
}[];
|
|
74
78
|
brand?: import('react').ReactNode;
|
|
79
|
+
sidebarStart?: import('react').ReactNode;
|
|
75
80
|
sidebarFooter?: import('react').ReactNode;
|
|
76
81
|
topbarStart?: import('react').ReactNode;
|
|
77
82
|
topbarEnd?: import('react').ReactNode;
|
|
@@ -31,7 +31,7 @@ import '@webority/ui-elements';
|
|
|
31
31
|
* @param {string} [props.id]
|
|
32
32
|
* @param {string} [props.ariaLabel]
|
|
33
33
|
* @param {string} [props.className]
|
|
34
|
-
* @param {import('react').Ref} [ref]
|
|
34
|
+
* @param {import('react').Ref<HTMLElement>} [ref]
|
|
35
35
|
*/
|
|
36
36
|
declare const AppSlider: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
|
|
37
37
|
export default AppSlider;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* @param {string} [props.error] Error message, rendered below the control. Replaces the hint.
|
|
14
14
|
* @param {string} [props.hint] Helper text below the control. Hidden while an error is shown.
|
|
15
15
|
* @param {string} [props.className]
|
|
16
|
-
* @param {import('react').Ref} [ref]
|
|
16
|
+
* @param {import('react').Ref<HTMLInputElement>} [ref]
|
|
17
17
|
*/
|
|
18
18
|
declare const AppSwitch: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
|
|
19
19
|
export default AppSwitch;
|
|
@@ -22,7 +22,7 @@ import '@webority/ui-elements';
|
|
|
22
22
|
* @param {string} [props.fieldClassName] Class to apply to the wrapper field div.
|
|
23
23
|
* @param {import('react').ReactNode} [props.help] Help content shown in an info tip beside the label.
|
|
24
24
|
* @param {string} [props.helpLabel="More information"] Accessible name for that info tip.
|
|
25
|
-
* @param {import('react').Ref} [ref]
|
|
25
|
+
* @param {import('react').Ref<HTMLElement>} [ref]
|
|
26
26
|
*/
|
|
27
27
|
declare const AppTagInput: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
|
|
28
28
|
export default AppTagInput;
|
|
@@ -27,7 +27,7 @@ import '@webority/ui-elements';
|
|
|
27
27
|
* @param {string} [props.id]
|
|
28
28
|
* @param {string} [props.ariaLabel]
|
|
29
29
|
* @param {string} [props.className]
|
|
30
|
-
* @param {import('react').Ref} [ref]
|
|
30
|
+
* @param {import('react').Ref<HTMLElement>} [ref]
|
|
31
31
|
*/
|
|
32
32
|
declare const AppTimePicker: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
|
|
33
33
|
export default AppTimePicker;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Mounts once near the app root and renders whatever toast()/errorToast() raise.
|
|
3
|
-
* auto-dismiss
|
|
4
|
-
*
|
|
2
|
+
* Mounts once near the app root and renders whatever toast()/errorToast() raise. The
|
|
3
|
+
* auto-dismiss timer itself lives in toastStore (so a toast still expires with no container
|
|
4
|
+
* mounted); react-bootstrap's Toast reproduces the same delay for its own slide/fade exit,
|
|
5
|
+
* and there is no bespoke stylesheet — the look is Bootstrap + the shared theme.
|
|
5
6
|
*
|
|
6
7
|
* Supports new toast options:
|
|
7
8
|
* - title: optional bold first line
|
|
8
|
-
* - duration: auto-dismiss delay in ms (0 = sticky/persistent
|
|
9
|
+
* - duration: auto-dismiss delay in ms, set via toast()/errorToast() (0 = sticky/persistent)
|
|
9
10
|
* - action: { label, onClick } renders an action button
|
|
10
11
|
*
|
|
11
12
|
* @param {object} props
|
|
12
13
|
* @param {'top-start'|'top-center'|'top-end'|'middle-center'|'bottom-start'|'bottom-center'|'bottom-end'} [props.position='bottom-end']
|
|
13
|
-
* @param {number} [props.autoDismiss=5000] Default auto-dismiss delay (legacy; overridden by individual toast.duration)
|
|
14
14
|
*/
|
|
15
|
-
export default function AppToastContainer({ position
|
|
15
|
+
export default function AppToastContainer({ position }: {
|
|
16
16
|
position?: 'top-start' | 'top-center' | 'top-end' | 'middle-center' | 'bottom-start' | 'bottom-center' | 'bottom-end';
|
|
17
|
-
autoDismiss?: number;
|
|
18
17
|
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Shared rest-prop probe for Wave 2 field/control passthrough tests. */
|
|
2
|
+
export declare const REST_PROBE: {
|
|
3
|
+
id: string;
|
|
4
|
+
'data-testid': string;
|
|
5
|
+
'data-foo': string;
|
|
6
|
+
'aria-roledescription': string;
|
|
7
|
+
};
|
|
8
|
+
/** Assert standard REST_PROBE attributes landed on the control root. */
|
|
9
|
+
export declare function expectProbe(el: any): void;
|
|
@@ -3,6 +3,7 @@ export declare function subscribeToasts(listener: any): () => boolean;
|
|
|
3
3
|
/**
|
|
4
4
|
* Raise a toast. De-duped by `variant:message` while one is still on screen, or by explicit `id`.
|
|
5
5
|
* When `opts.id` is provided, a toast with that id replaces any existing one (refresh/update).
|
|
6
|
+
* `duration` of 0 is sticky (no timer); any other duration schedules its own expiry here.
|
|
6
7
|
*/
|
|
7
8
|
export declare function pushToast(message: any, variant: any, opts?: {}): void;
|
|
8
9
|
/** Remove a toast — its auto-dismiss timer fired, or the user closed it. */
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared plumbing for thin React wrappers over form-associated `<wui-*>` elements.
|
|
3
|
+
*
|
|
4
|
+
* Collapses the copy-pasted triple every hard-interactive wrapper used to own:
|
|
5
|
+
* 1. merge a forwarded ref with an internal ref
|
|
6
|
+
* 2. sync a controlled `value` prop onto the element
|
|
7
|
+
* 3. listen for the element's `change` event and call `onChange`
|
|
8
|
+
*
|
|
9
|
+
* Callers that need extra effects (options arrays, remote loaders, dual-thumb ranges)
|
|
10
|
+
* keep those beside this hook — only the common path lives here.
|
|
11
|
+
*
|
|
12
|
+
* @param {object} opts
|
|
13
|
+
* @param {import('react').Ref<HTMLElement>} [opts.ref] Forwarded ref from `forwardRef`.
|
|
14
|
+
* @param {unknown} [opts.value] Controlled value; when defined, written to `el.value`.
|
|
15
|
+
* @param {(value: unknown) => void} [opts.onChange] Called with the control value only
|
|
16
|
+
* (one argument — matches every existing App* wrapper and its unit tests).
|
|
17
|
+
* @param {(el: HTMLElement) => unknown} [opts.readValue] How to read the element on change
|
|
18
|
+
* (default: `el => el.value`). Dual-thumb / multi-select wrappers pass a custom reader.
|
|
19
|
+
* @param {(el: HTMLElement, value: unknown) => void} [opts.writeValue] How to write the
|
|
20
|
+
* controlled value (default: `el.value = value ?? ''`).
|
|
21
|
+
* @param {unknown[]} [opts.syncDeps] Extra deps that should re-run the write effect
|
|
22
|
+
* (rarely needed — prefer baking state into `value`).
|
|
23
|
+
* @returns {{ setRef: (el: HTMLElement | null) => void, innerRef: import('react').MutableRefObject<HTMLElement | null> }}
|
|
24
|
+
*/
|
|
25
|
+
export default function useWuiControl({ ref, value, onChange, readValue, writeValue, syncDeps, }?: {
|
|
26
|
+
ref?: import('react').Ref<HTMLElement>;
|
|
27
|
+
value?: unknown;
|
|
28
|
+
onChange?: (value: unknown) => void;
|
|
29
|
+
readValue?: (el: HTMLElement) => unknown;
|
|
30
|
+
writeValue?: (el: HTMLElement, value: unknown) => void;
|
|
31
|
+
syncDeps?: unknown[];
|
|
32
|
+
}): {
|
|
33
|
+
setRef: (el: HTMLElement | null) => void;
|
|
34
|
+
innerRef: import('react').MutableRefObject<HTMLElement | null>;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Shallow value+label equality for two `{ value, label }` option arrays.
|
|
38
|
+
*
|
|
39
|
+
* The select/multiselect/autocomplete wrappers re-map their `options` prop into a fresh
|
|
40
|
+
* array every render (even when the caller's underlying data hasn't changed), and assigning
|
|
41
|
+
* that fresh array onto the element's `options` property makes the element re-render its
|
|
42
|
+
* menu — closing an open dropdown or discarding in-progress search text on any unrelated
|
|
43
|
+
* parent re-render. Comparing before assigning keeps the element's own array identity (and
|
|
44
|
+
* its open menu) whenever the option set is actually unchanged.
|
|
45
|
+
*
|
|
46
|
+
* @param {{value: unknown, label: string}[]} [next]
|
|
47
|
+
* @param {{value: unknown, label: string}[]} [cur]
|
|
48
|
+
*/
|
|
49
|
+
export declare function optionsEqual(next?: {
|
|
50
|
+
value: unknown;
|
|
51
|
+
label: string;
|
|
52
|
+
}[], cur?: {
|
|
53
|
+
value: unknown;
|
|
54
|
+
label: string;
|
|
55
|
+
}[]): boolean;
|