@webority/ui-react 0.7.8 → 0.8.0

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.
@@ -5,15 +5,19 @@
5
5
  *
6
6
  * @param {object} props
7
7
  * @param {"info"|"success"|"warning"|"danger"} [props.variant="info"]
8
- * @param {import('react').ReactNode} props.children
8
+ * @param {import('react').ReactNode} props.children The alert body.
9
+ * @param {import('react').ReactNode} [props.title] A bold heading line above the body (`.alert-heading`).
10
+ * @param {string|import('react').ReactNode} [props.icon] A leading glyph — a Bootstrap Icons name or a node.
9
11
  * @param {string} [props.className]
10
12
  * @param {() => void} [props.onClose] Called when dismissed
11
13
  * @param {boolean} [props.dismissible] Show the close button (defaults to true when onClose is set)
12
14
  * @param {"alert"|"status"} [props.role="alert"] Use "status" for non-assertive notices
13
15
  */
14
- export default function AppAlert({ variant, children, className, onClose, dismissible, role, ...rest }: {
16
+ export default function AppAlert({ variant, children, title, icon, className, onClose, dismissible, role, ...rest }: {
15
17
  variant?: "info" | "success" | "warning" | "danger";
16
18
  children: import('react').ReactNode;
19
+ title?: import('react').ReactNode;
20
+ icon?: string | import('react').ReactNode;
17
21
  className?: string;
18
22
  onClose?: () => void;
19
23
  dismissible?: boolean;
@@ -18,9 +18,12 @@
18
18
  * @param {import('react').ReactNode} props.children
19
19
  * @param {"default"|"elevated"|"outlined"|"muted"|"accent"} [props.variant="default"]
20
20
  * @param {"primary"|"success"|"warning"|"danger"|"info"} [props.tone="primary"] Colours the `accent` stripe.
21
- * @param {"none"|"sm"|"md"|"lg"} [props.padding="md"] Header/body/footer padding.
21
+ * @param {"none"|"sm"|"md"|"lg"} [props.padding="md"] Header/body/footer padding preset. The
22
+ * default (md) is a uniform 20px; for an arbitrary inset, add a class (see `className`) that
23
+ * sets the `--wui-card-pad` token instead of using this preset scale.
22
24
  * @param {"xs"|"sm"|"md"|"lg"|number|string} [props.maxWidth] Cap + centre a standalone card.
23
- * @param {string} [props.className]
25
+ * @param {string} [props.className] Extra classes on the `.card` root — the padding hook: a class
26
+ * here can set `--wui-card-pad` to retune the inset (the Razor counterpart is a plain `class`).
24
27
  * @param {string} [props.bodyClassName]
25
28
  * @param {string} [props.headerClassName]
26
29
  * @param {boolean} [props.body=true] Wrap children in `.card-body`. False for a flush card.
@@ -16,7 +16,10 @@
16
16
  * @param {string} [props.rowActionsLabel]
17
17
  * @param {object} [props.pagination]
18
18
  * @param {string} [props.ariaLabel]
19
- * @param {string} [props.className]
19
+ * @param {string} [props.className] Extra classes on the <table> (column/table styling).
20
+ * @param {string} [props.wrapperClassName] Extra classes on the `.table-wrap` outer div — the
21
+ * padding hook. Manage the table's inset from here (e.g. a class that sets `--wui-table-pad`);
22
+ * the Razor counterpart is a plain `class` on `<app-data-table>`.
20
23
  * @param {boolean} [props.selectable=false] Render a leading checkbox column.
21
24
  * @param {Set<string|number>} [props.selectedIds] Currently selected row keys.
22
25
  * @param {(id: string|number) => void} [props.onToggleRow]
@@ -24,7 +27,7 @@
24
27
  * @param {(row: object) => import('react').ReactNode} [props.renderExpanded] When given, each row
25
28
  * gets a leading expand toggle; the returned content renders in a full-width row beneath it.
26
29
  */
27
- export default function AppDataTable({ columns, rows, rowKey, sort, onSort, loading, skeletonRows, empty, emptyFiltered, sourceCount, rowActions, rowActionsLabel, pagination, ariaLabel, className, selectable, selectedIds, onToggleRow, onToggleAll, renderExpanded, ...rest }: {
30
+ export default function AppDataTable({ columns, rows, rowKey, sort, onSort, loading, skeletonRows, empty, emptyFiltered, sourceCount, rowActions, rowActionsLabel, pagination, ariaLabel, className, wrapperClassName, selectable, selectedIds, onToggleRow, onToggleAll, renderExpanded, ...rest }: {
28
31
  columns: object[];
29
32
  rows: object[];
30
33
  rowKey?: (row: object, index: number) => string | number;
@@ -43,6 +46,7 @@ export default function AppDataTable({ columns, rows, rowKey, sort, onSort, load
43
46
  pagination?: object;
44
47
  ariaLabel?: string;
45
48
  className?: string;
49
+ wrapperClassName?: string;
46
50
  selectable?: boolean;
47
51
  selectedIds?: Set<string | number>;
48
52
  onToggleRow?: (id: string | number) => void;
@@ -0,0 +1,42 @@
1
+ import '@webority/ui-elements';
2
+ /**
3
+ * A macOS-style floating dock — a pill of icon links whose items magnify as the pointer
4
+ * approaches them. Marketing / landing-page chrome, not a replacement for `AppShell`
5
+ * primary navigation.
6
+ *
7
+ * Wraps the shared `<wui-dock>` element, which owns the pointer-tracking magnification
8
+ * and turns itself off on coarse pointers and under `prefers-reduced-motion` — so the
9
+ * dock is a plain, fully usable icon row wherever the effect would misbehave. Every item
10
+ * is a real link (or button) with an accessible name; the visible tooltip is decorative.
11
+ *
12
+ * Router-decoupled like AppBreadcrumbs: an item with `to` renders through `linkComponent`
13
+ * when one is provided, otherwise a plain `<a href>`. An item with `onClick` and no
14
+ * href/to renders a `<button>`. The library never imports a router.
15
+ *
16
+ * @param {object} props
17
+ * @param {{ key?: string, title: string, icon: string|import('react').ReactNode,
18
+ * href?: string, to?: string, onClick?: () => void }[]} props.items The dock items,
19
+ * left to right. `title` is the accessible name and the hover tooltip.
20
+ * @param {import('react').ElementType} [props.linkComponent] Component for `to` items (e.g. Link).
21
+ * @param {string} [props.ariaLabel='Quick navigation'] Accessible name for the dock landmark.
22
+ * @param {boolean} [props.magnify=true] Set false to render a static dock (no hover effect).
23
+ * @param {number} [props.maxScale] Item scale at cursor center (element default 1.6).
24
+ * @param {number} [props.radius] Px falloff distance for the magnification (element default 100).
25
+ * @param {string} [props.className]
26
+ */
27
+ export default function AppFloatingDock({ items, linkComponent, ariaLabel, magnify, maxScale, radius, className, ...rest }: {
28
+ items: {
29
+ key?: string;
30
+ title: string;
31
+ icon: string | import('react').ReactNode;
32
+ href?: string;
33
+ to?: string;
34
+ onClick?: () => void;
35
+ }[];
36
+ linkComponent?: import('react').ElementType;
37
+ ariaLabel?: string;
38
+ magnify?: boolean;
39
+ maxScale?: number;
40
+ radius?: number;
41
+ className?: string;
42
+ }): import("react").JSX.Element;
@@ -8,19 +8,23 @@
8
8
  * @param {object} props
9
9
  * @param {import('react').ReactElement} props.trigger The anchor element the panel opens from.
10
10
  * Must be a single element that forwards a ref (a DOM element, or a react-bootstrap-based
11
- * App* like AppButton/ActionIcon). It renders as written; clicking it toggles the panel.
11
+ * App* like AppButton/ActionIcon). It renders as written; clicking (or hovering/focusing) it
12
+ * toggles the panel.
12
13
  * @param {import('react').ReactNode} props.children The panel body.
13
14
  * @param {string} [props.title] Optional panel heading.
14
15
  * @param {'top'|'bottom'|'start'|'end'|'auto'} [props.placement='bottom'] Where it opens; `auto`
15
16
  * flips to stay in view.
16
- * @param {'click'|'hover'|'focus'} [props.triggerType='click'] What opens it.
17
+ * @param {'click'|'hover'|'focus'|('click'|'hover'|'focus')[]} [props.triggerType='click'] What
18
+ * opens it; pass an array for multiple (e.g. ['hover', 'focus']).
19
+ * @param {(show: boolean) => void} [props.onToggle] Callback fired when the panel opens/closes.
17
20
  * @param {string} [props.className] Class on the popover panel.
18
21
  */
19
- export default function AppPopover({ trigger, children, title, placement, triggerType, className, ...rest }: {
22
+ export default function AppPopover({ trigger, children, title, placement, triggerType, onToggle, className, ...rest }: {
20
23
  trigger: import('react').ReactElement;
21
24
  children: import('react').ReactNode;
22
25
  title?: string;
23
26
  placement?: 'top' | 'bottom' | 'start' | 'end' | 'auto';
24
- triggerType?: 'click' | 'hover' | 'focus';
27
+ triggerType?: 'click' | 'hover' | 'focus' | ('click' | 'hover' | 'focus')[];
28
+ onToggle?: (show: boolean) => void;
25
29
  className?: string;
26
30
  }): import("react").JSX.Element;
@@ -12,6 +12,9 @@
12
12
  * @param {string} [props.name]
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
+ * @param {'pill'|'circle'|'round'} [props.shape] Track shape — `pill` (default) is the sliding
16
+ * pill (squircle ends); `round` is the same sliding pill with truly circular ends
17
+ * (`corner-shape: round`); `circle` is a compact round on/off button.
15
18
  * @param {string} [props.className]
16
19
  * @param {import('react').Ref<HTMLInputElement>} [ref]
17
20
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
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
3
+ * with a variant icon, a quiet auto-dismiss (the invisible countdown pauses on hover/focus), and
4
4
  * swipe-to-dismiss. There is no toast library; the look is Bootstrap utilities + the shared theme.
5
5
  * The Razor counterpart is <app-toast> + WUI.toast, kept structurally identical.
6
6
  *
@@ -10,8 +10,20 @@
10
10
  * @param {object} props
11
11
  * @param {'top-start'|'top-center'|'top-end'|'middle-center'|'bottom-start'|'bottom-center'|'bottom-end'} [props.position='bottom-end']
12
12
  * @param {number} [props.maxVisible=4] Most toasts shown at once; older ones collapse to a "+N more" chip.
13
+ * @param {'rise'|'organic'|'jelly'|'spring'} [props.animation='rise'] Default entrance motion for
14
+ * every toast: `rise` (soft fade + lift), `organic` (surface materializes, status icon grows
15
+ * from a dot, message trails in), `jelly` (squash-and-stretch drop), `spring` (elastic
16
+ * slide-up). A per-toast `animation` option overrides it.
17
+ * @param {'rounded'|'pill'|'sharp'} [props.shape='rounded'] Default corner treatment; a per-toast
18
+ * `shape` option overrides it.
19
+ * @param {'auto'|'inverse'} [props.surface='auto'] `inverse` renders every toast on the OPPOSITE
20
+ * surface of the active mode — a dark card in light mode, a light card in dark mode — so the
21
+ * stack always contrasts with the page. A per-toast `surface` option overrides it.
13
22
  */
14
- export default function AppToast({ position, maxVisible }: {
23
+ export default function AppToast({ position, maxVisible, animation, shape, surface, }: {
15
24
  position?: 'top-start' | 'top-center' | 'top-end' | 'middle-center' | 'bottom-start' | 'bottom-center' | 'bottom-end';
16
25
  maxVisible?: number;
26
+ animation?: 'rise' | 'organic' | 'jelly' | 'spring';
27
+ shape?: 'rounded' | 'pill' | 'sharp';
28
+ surface?: 'auto' | 'inverse';
17
29
  }): import("react").JSX.Element;
@@ -0,0 +1,54 @@
1
+ /**
2
+ * A Figma-style toolbar — a pill strip of icon tools over a work surface. Exactly one
3
+ * tool is active; the active tool expands to reveal its label, the rest stay icon-only.
4
+ * Optional momentary `actions` render after a divider and just fire — they never stay
5
+ * selected.
6
+ *
7
+ * Not `AppSegmented` (that chooses a form VALUE — view mode, period) and not
8
+ * `AppFloatingDock` (marketing navigation shortcuts): this is action chrome — which
9
+ * TOOL is in hand.
10
+ *
11
+ * Built on real `<input type="radio">` elements inside labels, so arrow-key navigation,
12
+ * the single tab stop, and screen-reader announcements come from the browser — and the
13
+ * Razor `<app-toolbar>` posts the selected tool inside a plain form with no JavaScript.
14
+ * The expand/collapse is pure CSS and honours `prefers-reduced-motion`.
15
+ *
16
+ * Controlled via `value` + `onSelect`, or uncontrolled via `defaultValue`.
17
+ *
18
+ * @param {object} props
19
+ * @param {{ value: string, title: string, icon: string|import('react').ReactNode,
20
+ * disabled?: boolean }[]} props.items The tools, left to right.
21
+ * @param {{ key?: string, title: string, icon: string|import('react').ReactNode,
22
+ * onClick?: () => void, disabled?: boolean }[]} [props.actions] Momentary buttons after
23
+ * a divider — fire and forget, never selected.
24
+ * @param {string} [props.value] The active tool's value (controlled).
25
+ * @param {string} [props.defaultValue] Initially active tool (uncontrolled).
26
+ * @param {(value: string) => void} [props.onSelect]
27
+ * @param {string} props.label Accessible name for the toolbar.
28
+ * @param {string} [props.name] Field name grouping the radios (and what posts in a form).
29
+ * Defaults to a generated one.
30
+ * @param {boolean} [props.disabled=false] Disables the whole toolbar.
31
+ * @param {string} [props.className]
32
+ */
33
+ export default function AppToolbar({ items, actions, value, defaultValue, onSelect, label, name, disabled, className, ...rest }: {
34
+ items: {
35
+ value: string;
36
+ title: string;
37
+ icon: string | import('react').ReactNode;
38
+ disabled?: boolean;
39
+ }[];
40
+ actions?: {
41
+ key?: string;
42
+ title: string;
43
+ icon: string | import('react').ReactNode;
44
+ onClick?: () => void;
45
+ disabled?: boolean;
46
+ }[];
47
+ value?: string;
48
+ defaultValue?: string;
49
+ onSelect?: (value: string) => void;
50
+ label: string;
51
+ name?: string;
52
+ disabled?: boolean;
53
+ className?: string;
54
+ }): import("react").JSX.Element;
@@ -0,0 +1,36 @@
1
+ import '@webority/ui-elements';
2
+ /**
3
+ * A multi-step flow over the shared `<wui-wizard>` element — a stepper progress
4
+ * header, one visible step panel at a time, and a sticky Back / Skip / Next / Finish
5
+ * footer. Give it `steps` metadata and one panel per step as children (in order).
6
+ *
7
+ * Uncontrolled by default (it owns the current step); pass `active` + `onStepChange`
8
+ * to drive it. `beforeNext` gates advancing — return `false` (or a rejecting promise)
9
+ * to block Next, e.g. until a form validates. An `optional` step shows the Skip button.
10
+ *
11
+ * @param {object} props
12
+ * @param {{ key?: string, label: string, description?: string, optional?: boolean, icon?: string, status?: 'done'|'active'|'pending'|'error' }[]} props.steps
13
+ * @param {import('react').ReactNode} props.children One panel per step, in step order.
14
+ * @param {number} [props.active] Controlled current-step index (with `onStepChange`).
15
+ * @param {number} [props.defaultActive=0] Initial step when uncontrolled.
16
+ * @param {(index: number, detail: { previous: number, reason: 'next'|'back'|'skip'|'step'|'set' }) => void} [props.onStepChange]
17
+ * @param {(detail: { index: number }) => void} [props.onFinish] Fired when Finish is pressed on the last step.
18
+ * @param {(index: number) => void} [props.onSkip] Fired when an optional step is skipped.
19
+ * @param {(index: number) => boolean | Promise<boolean>} [props.beforeNext] Validation gate run before advancing on Next — return false (or a rejecting promise) to block; the blocked step turns red.
20
+ * @param {(index: number) => void} [props.onInvalid] Fired when advancing is blocked by beforeNext (the step is marked invalid).
21
+ * @param {'steps'|'journey'|'icons'} [props.variant='steps'] Stepper header style — compact circles, the wide journey bar, or large connected icon badges with a "STEP n" eyebrow.
22
+ * @param {'primary'|'success'|'warning'|'danger'|'info'} [props.tone] Recolour the whole stepper accent (active fill, done rail, ring, done tint) to a semantic ramp. Unset keeps the variant's default (primary for steps/journey, success/green for icons). For any other colour, override the `--wui-step-accent` / `--wui-step-soft` CSS variables via `style` or a `className` instead.
23
+ * @param {'horizontal'|'vertical'} [props.orientation='horizontal']
24
+ * @param {boolean} [props.skippable=false] Show a Skip button on every step (bar the last), without needing per-step `optional`. A per-step `optional` still works on its own.
25
+ * @param {boolean} [props.nonLinear=false] Allow jumping to any step, not only completed ones.
26
+ * @param {boolean} [props.hideStepper=false] Hide the progress header.
27
+ * @param {boolean} [props.disabled=false] Disable all navigation.
28
+ * @param {string} [props.label='Progress'] Accessible name for the stepper.
29
+ * @param {string} [props.backLabel='Back']
30
+ * @param {string} [props.nextLabel='Next']
31
+ * @param {string} [props.skipLabel='Skip']
32
+ * @param {string} [props.finishLabel='Finish']
33
+ * @param {string} [props.className]
34
+ */
35
+ declare const AppWizard: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
36
+ export default AppWizard;
@@ -27,6 +27,7 @@ export { default as AppDropdown } from './components/AppDropdown.jsx';
27
27
  export { default as AppEmptyState } from './components/AppEmptyState.jsx';
28
28
  export { default as AppFileAttachment } from './components/AppFileAttachment.jsx';
29
29
  export { default as AppFilePicker } from './components/AppFilePicker.jsx';
30
+ export { default as AppFloatingDock } from './components/AppFloatingDock.jsx';
30
31
  export { default as AppFormActions } from './components/AppFormActions.jsx';
31
32
  export { default as AppFormRow } from './components/AppFormRow.jsx';
32
33
  export { default as AppFormSection } from './components/AppFormSection.jsx';
@@ -72,7 +73,9 @@ export { default as AppTextarea } from './components/AppTextarea.jsx';
72
73
  export { default as AppTimeline } from './components/AppTimeline.jsx';
73
74
  export { default as AppTimePicker } from './components/AppTimePicker.jsx';
74
75
  export { default as AppToast, default as AppToastContainer } from './components/AppToast.jsx';
76
+ export { default as AppToolbar } from './components/AppToolbar.jsx';
75
77
  export { default as AppTooltip } from './components/AppTooltip.jsx';
78
+ export { default as AppWizard } from './components/AppWizard.jsx';
76
79
  export { default as AppWorkspaceSwitcher } from './components/AppWorkspaceSwitcher.jsx';
77
80
  export { default as Icon, iconNames, registerIcons } from './components/Icon.jsx';
78
81
  export { MODAL_ICONS } from './components/ModalIcons.jsx';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Shared render logic for checkbox/radio/switch controls.
3
+ * @internal — not exported from the package barrel
4
+ */
5
+ declare const CheckField: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
6
+ export default CheckField;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Check if a value is considered empty (null, undefined, or empty string).
3
+ * @param {*} value
4
+ * @returns {boolean}
5
+ */
6
+ export declare function isEmpty(value: any): boolean;
7
+ /**
8
+ * Get the display value for a potentially empty field.
9
+ * Returns an em-dash for empty values, otherwise returns the value as-is.
10
+ * @param {*} value
11
+ * @returns {string|*}
12
+ */
13
+ export declare function emptyValue(value: any): string | any;