@webority/ui-react 0.7.7 → 0.7.8

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.
@@ -19,8 +19,9 @@
19
19
  * click and Escape no longer close the dialog.
20
20
  * @param {'center'|'top'} [props.placement='center'] Vertical placement of the card,
21
21
  * forwarded to AppModal — centred (default) or pinned near the top.
22
+ * @param {string} [props.className] Merged with the dialog's own wui-confirm class.
22
23
  */
23
- export default function AppConfirmDialog({ open, title, message, confirmLabel, cancelLabel, danger, tone, confirmPhrase, onConfirm, onClose, loading, staticBackdrop, placement, ...rest }: {
24
+ export default function AppConfirmDialog({ open, title, message, confirmLabel, cancelLabel, danger, tone, confirmPhrase, onConfirm, onClose, loading, staticBackdrop, placement, className, ...rest }: {
24
25
  open: boolean;
25
26
  title: string;
26
27
  message?: import('react').ReactNode;
@@ -34,4 +35,5 @@ export default function AppConfirmDialog({ open, title, message, confirmLabel, c
34
35
  loading?: boolean;
35
36
  staticBackdrop?: boolean;
36
37
  placement?: 'center' | 'top';
38
+ className?: string;
37
39
  }): import("react").JSX.Element;
@@ -1,6 +1,7 @@
1
- export default function AppInfoTip({ label, children, placement, ...rest }: {
1
+ export default function AppInfoTip({ label, children, placement, className, ...rest }: {
2
2
  [x: string]: any;
3
3
  children: any;
4
+ className?: string;
4
5
  label: any;
5
6
  placement?: string;
6
7
  }): import("react").JSX.Element;
@@ -59,6 +59,10 @@ export type NavItemShape = {
59
59
  * @param {import('react').ReactNode} [props.brand] The logo row at the top of the sidebar.
60
60
  * @param {import('react').ReactNode} [props.sidebarStart] Between the brand row and the nav —
61
61
  * a workspace/tenant switcher, an environment badge. Hidden on the collapsed rail.
62
+ * @param {import('react').ReactNode} [props.sidebarStartCompact] Same slot for the collapsed
63
+ * rail — typically a compact monogram control (e.g. `AppWorkspaceSwitcher compact`). Shown
64
+ * only on the desktop collapsed rail; the expanded `sidebarStart` stays hidden there. Omit
65
+ * to keep today's behaviour (nothing in that slot when collapsed).
62
66
  * @param {import('react').ReactNode} [props.sidebarFooter] Pinned below the scrolling nav.
63
67
  * @param {import('react').ReactNode} [props.topbarStart] Leading topbar slot — page title, crumbs.
64
68
  * @param {import('react').ReactNode} [props.topbarEnd] Trailing topbar slot — search, account menu.
@@ -70,13 +74,14 @@ export type NavItemShape = {
70
74
  * @param {string} [props.navLabel='Main navigation']
71
75
  * @param {string} [props.className]
72
76
  */
73
- export default function AppShell({ groups, brand, sidebarStart, sidebarFooter, topbarStart, topbarEnd, footer, children, collapsed, onCollapsedChange, noSidebar, navLabel, linkComponent: Link, className, ...rest }: {
77
+ export default function AppShell({ groups, brand, sidebarStart, sidebarStartCompact, sidebarFooter, topbarStart, topbarEnd, footer, children, collapsed, onCollapsedChange, noSidebar, navLabel, linkComponent: Link, className, ...rest }: {
74
78
  groups: {
75
79
  label?: string;
76
80
  items: NavItemShape[];
77
81
  }[];
78
82
  brand?: import('react').ReactNode;
79
83
  sidebarStart?: import('react').ReactNode;
84
+ sidebarStartCompact?: import('react').ReactNode;
80
85
  sidebarFooter?: import('react').ReactNode;
81
86
  topbarStart?: import('react').ReactNode;
82
87
  topbarEnd?: import('react').ReactNode;
@@ -21,8 +21,9 @@
21
21
  * any run of hidden pages — between the arrows.
22
22
  * @param {boolean} [props.showPageSize=true] Show the "Rows per page" selector. Set false for a
23
23
  * compact pager that pages but doesn't expose page size (e.g. a dense numbered table).
24
+ * @param {string} [props.className] Merged with the component's own table-pagination class.
24
25
  */
25
- export default function AppTablePagination({ page, totalPages, pageSize, total, firstRow, lastRow, onPageChange, onPageSizeChange, pageSizes, mode, showPageSize, ...rest }: {
26
+ export default function AppTablePagination({ page, totalPages, pageSize, total, firstRow, lastRow, onPageChange, onPageSizeChange, pageSizes, mode, showPageSize, className, ...rest }: {
26
27
  page: number;
27
28
  totalPages: number;
28
29
  pageSize: number;
@@ -34,4 +35,5 @@ export default function AppTablePagination({ page, totalPages, pageSize, total,
34
35
  pageSizes?: number[];
35
36
  mode?: 'prev-next' | 'numbered';
36
37
  showPageSize?: boolean;
38
+ className?: string;
37
39
  }): import("react").JSX.Element;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Mounts once near the app root and renders whatever toast()/errorToast() raise — surface cards
3
+ * with a variant accent + icon, an auto-dismiss progress bar (pauses on hover/focus), and
4
+ * swipe-to-dismiss. There is no toast library; the look is Bootstrap utilities + the shared theme.
5
+ * The Razor counterpart is <app-toast> + WUI.toast, kept structurally identical.
6
+ *
7
+ * Toast options (from toast()/errorToast()): title, duration (0 = sticky), action {label,onClick},
8
+ * id (replace/refresh), and a string OR React-node message (rich body).
9
+ *
10
+ * @param {object} props
11
+ * @param {'top-start'|'top-center'|'top-end'|'middle-center'|'bottom-start'|'bottom-center'|'bottom-end'} [props.position='bottom-end']
12
+ * @param {number} [props.maxVisible=4] Most toasts shown at once; older ones collapse to a "+N more" chip.
13
+ */
14
+ export default function AppToast({ position, maxVisible }: {
15
+ position?: 'top-start' | 'top-center' | 'top-end' | 'middle-center' | 'bottom-start' | 'bottom-center' | 'bottom-end';
16
+ maxVisible?: number;
17
+ }): import("react").JSX.Element;
@@ -11,11 +11,20 @@
11
11
  * renders as written; hovering or focusing it reveals the tooltip.
12
12
  * @param {'top'|'bottom'|'start'|'end'} [props.placement='top'] Where the tooltip appears;
13
13
  * prefers the given direction, flips if needed to stay in view.
14
- * @param {string} [props.className] Class on the tooltip element.
14
+ * @param {'default'|'dark'|'primary'|'success'|'warning'|'danger'} [props.tone='default'] Preset
15
+ * colour of the tooltip. `default` is the light surface look; the others are solid tints. For
16
+ * a fully custom colour, pass a `className` whose rule sets the `--wui-tooltip-bg` /
17
+ * `--wui-tooltip-color` / `--wui-tooltip-border` / `--wui-tooltip-radius` CSS vars.
18
+ * @param {'sm'|'md'|'lg'} [props.size='md'] Preset size (font-size + padding + max-width). For a
19
+ * fully custom size, pass a `className` that sets the `--wui-tooltip-font-size` /
20
+ * `--wui-tooltip-padding-y` / `--wui-tooltip-padding-x` / `--wui-tooltip-max-width` CSS vars.
21
+ * @param {string} [props.className] Extra class on the tooltip element.
15
22
  */
16
- export default function AppTooltip({ content, children, placement, className, ...rest }: {
23
+ export default function AppTooltip({ content, children, placement, tone, size, className, ...rest }: {
17
24
  content: import('react').ReactNode;
18
25
  children: import('react').ReactElement;
19
26
  placement?: 'top' | 'bottom' | 'start' | 'end';
27
+ tone?: 'default' | 'dark' | 'primary' | 'success' | 'warning' | 'danger';
28
+ size?: 'sm' | 'md' | 'lg';
20
29
  className?: string;
21
30
  }): import("react").JSX.Element;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Tenant / workspace switcher — a react-bootstrap Dropdown wearing an identity card.
3
+ *
4
+ * Selection is a CALLBACK, never navigation: products own where a workspace switch goes
5
+ * (a route change, a reload, an API call), so `onSelect(tenant)` is all the library does.
6
+ * The footer action stays router-decoupled the same way `AppDropdown`/`AppBreadcrumbs` are —
7
+ * an `{ href }` renders through `linkComponent` when one is supplied, otherwise a plain
8
+ * anchor, and the library never imports a router.
9
+ *
10
+ * Tenant logos use `loading="lazy"` so a closed menu (renderOnMount) does not force every
11
+ * logo network fetch on first paint — the browser defers off-screen images.
12
+ *
13
+ * NOTE: the exported component must stay the FIRST destructured function in this file —
14
+ * the parity check reads the first signature it finds as the component's public props.
15
+ *
16
+ * @param {object} props
17
+ * @param {{ id: string, name: string, logoUrl?: string, badge?: string }[]} [props.tenants]
18
+ * The switchable workspaces. Razor composes the same list from `<app-workspace-option>` children.
19
+ * @param {string} [props.currentId] Id of the active workspace — drives the trigger and the tick.
20
+ * @param {(tenant: object) => void} [props.onSelect] Fired with the chosen tenant. No navigation.
21
+ * @param {string} [props.menuLabel] Optional header label above the list ("Workspaces").
22
+ * @param {import('react').ReactNode | { label: string, icon?: string, href?: string }} [props.footerAction]
23
+ * A pinned row under the list — a node rendered as-is, or a descriptor the library renders
24
+ * as a menu row (through `linkComponent` when it carries an `href`).
25
+ * @param {import('react').ElementType} [props.linkComponent] Component for `href` rows (e.g. Link).
26
+ * @param {boolean} [props.searchable=false] Client-side filter over the list. Only earns its
27
+ * place past roughly eight workspaces.
28
+ * @param {() => void} [props.onCreate] Fired by the create row.
29
+ * @param {boolean} [props.canCreate=false] Renders the create row. Hidden by default because
30
+ * most members cannot create a workspace.
31
+ * @param {string} [props.createLabel="Create workspace"] Copy for the create row.
32
+ * @param {boolean} [props.compact=false] Renders the 36px monogram button instead of the full
33
+ * card — the shape a collapsed rail slot wants. Same menu either way.
34
+ * @param {string} [props.ariaLabel] Accessible name for the trigger. Defaults to
35
+ * "Workspace <name>".
36
+ */
37
+ export default function AppWorkspaceSwitcher({ tenants, currentId, onSelect, menuLabel, footerAction, linkComponent, searchable, onCreate, canCreate, createLabel, compact, ariaLabel, ...rest }: {
38
+ tenants?: {
39
+ id: string;
40
+ name: string;
41
+ logoUrl?: string;
42
+ badge?: string;
43
+ }[];
44
+ currentId?: string;
45
+ onSelect?: (tenant: object) => void;
46
+ menuLabel?: string;
47
+ footerAction?: import('react').ReactNode | {
48
+ label: string;
49
+ icon?: string;
50
+ href?: string;
51
+ };
52
+ linkComponent?: import('react').ElementType;
53
+ searchable?: boolean;
54
+ onCreate?: () => void;
55
+ canCreate?: boolean;
56
+ createLabel?: string;
57
+ compact?: boolean;
58
+ ariaLabel?: string;
59
+ }): import("react").JSX.Element;
@@ -1,3 +1,5 @@
1
+ /** Clear every toast at once — e.g. on route change or logout. */
2
+ export declare function dismissAll(): void;
1
3
  export declare function toast(message: any, variantOrOptions?: string): void;
2
4
  export declare namespace toast {
3
5
  var promise: (promise: Promise<any>, messages: object, opts?: object) => Promise<any>;
@@ -4,7 +4,10 @@ export declare function subscribeToasts(listener: any): () => boolean;
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
6
  * `duration` of 0 is sticky (no timer); any other duration schedules its own expiry here.
7
+ * `message` may be a string or a React node (rich body); string-dedupe only applies to strings.
7
8
  */
8
9
  export declare function pushToast(message: any, variant: any, opts?: {}): void;
9
10
  /** Remove a toast — its auto-dismiss timer fired, or the user closed it. */
10
11
  export declare function dismissToast(id: any): void;
12
+ /** Clear every toast at once — e.g. on route change or logout. No-op when already empty. */
13
+ export declare function dismissAllToasts(): void;
@@ -18,16 +18,21 @@
18
18
  * (default: `el => el.value`). Dual-thumb / multi-select wrappers pass a custom reader.
19
19
  * @param {(el: HTMLElement, value: unknown) => void} [opts.writeValue] How to write the
20
20
  * controlled value (default: `el.value = value ?? ''`).
21
+ * @param {string[]} [opts.events=['change']] DOM events that call onChange. Use
22
+ * `['input','change']` for controls that fire `input` live and `change` only on commit
23
+ * (phone) so React controlled state stays current; values are de-duped so both events in
24
+ * one gesture do not double-call with the same value.
21
25
  * @param {unknown[]} [opts.syncDeps] Extra deps that should re-run the write effect
22
26
  * (rarely needed — prefer baking state into `value`).
23
27
  * @returns {{ setRef: (el: HTMLElement | null) => void, innerRef: import('react').MutableRefObject<HTMLElement | null> }}
24
28
  */
25
- export default function useWuiControl({ ref, value, onChange, readValue, writeValue, syncDeps, }?: {
29
+ export default function useWuiControl({ ref, value, onChange, readValue, writeValue, events, syncDeps, }?: {
26
30
  ref?: import('react').Ref<HTMLElement>;
27
31
  value?: unknown;
28
32
  onChange?: (value: unknown) => void;
29
33
  readValue?: (el: HTMLElement) => unknown;
30
34
  writeValue?: (el: HTMLElement, value: unknown) => void;
35
+ events?: string[];
31
36
  syncDeps?: unknown[];
32
37
  }): {
33
38
  setRef: (el: HTMLElement | null) => void;
@@ -53,3 +58,14 @@ export declare function optionsEqual(next?: {
53
58
  value: unknown;
54
59
  label: string;
55
60
  }[]): boolean;
61
+ /** Module-stable reader for multi-value elements (`el.values`). */
62
+ export declare function readValues(el: any): any;
63
+ /** Module-stable writer for multi-value elements — skips no-op array reassignment. */
64
+ export declare function writeValues(el: any, next: any): void;
65
+ /** Module-stable range reader for dual-thumb sliders. */
66
+ export declare function readRange(el: any): {
67
+ start: any;
68
+ end: any;
69
+ };
70
+ /** Module-stable single-thumb numeric writer. */
71
+ export declare function writeNumberValue(el: any, v: any): void;
@@ -71,10 +71,11 @@ export { default as AppTagInput } from './components/AppTagInput.jsx';
71
71
  export { default as AppTextarea } from './components/AppTextarea.jsx';
72
72
  export { default as AppTimeline } from './components/AppTimeline.jsx';
73
73
  export { default as AppTimePicker } from './components/AppTimePicker.jsx';
74
- export { default as AppToastContainer } from './components/AppToastContainer.jsx';
74
+ export { default as AppToast, default as AppToastContainer } from './components/AppToast.jsx';
75
75
  export { default as AppTooltip } from './components/AppTooltip.jsx';
76
+ export { default as AppWorkspaceSwitcher } from './components/AppWorkspaceSwitcher.jsx';
76
77
  export { default as Icon, iconNames, registerIcons } from './components/Icon.jsx';
77
78
  export { MODAL_ICONS } from './components/ModalIcons.jsx';
78
79
  export { default as RequiredMark } from './components/RequiredMark.jsx';
79
- export { errorToast, toast } from './components/toast.js';
80
+ export { dismissAll, errorToast, toast } from './components/toast.js';
80
81
  export { usePagination } from './lib/usePagination.js';