@webority/ui-react 0.13.5 → 0.15.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.
@@ -10,6 +10,9 @@
10
10
  *
11
11
  * @param {object} props
12
12
  * @param {string|import('react').ReactNode} props.icon glyph name (see Icon), or a custom node (e.g. an iconsax glyph)
13
+ * @param {'linear'|'outline'|'bold'|'bulk'|'broken'|'twotone'} [props.iconVariant='linear'] iconsax
14
+ * style of a NAMED icon (AppIcon's `variant`). A node passed as `icon` is the caller's own glyph
15
+ * and is not restyled.
13
16
  * @param {string} props.label accessible name + collision-aware hover/focus tooltip
14
17
  * @param {'auto'|'top'|'bottom'|'start'|'end'} [props.tooltipPlacement='auto'] which side the
15
18
  * tooltip prefers. `auto` (default) lets Popper pick the side with the most room; a named side
@@ -25,8 +28,9 @@
25
28
  * wrapper must use `forwardRef` (the tooltip still opens without it, but may be mispositioned).
26
29
  * @param {string} [props.href] sets an anchor without needing `as`.
27
30
  */
28
- export default function AppActionIcon({ icon, label, tooltipPlacement, danger, disabled, size, onClick, className, as, href, ...rest }: {
31
+ export default function AppActionIcon({ icon, iconVariant, label, tooltipPlacement, danger, disabled, size, onClick, className, as, href, ...rest }: {
29
32
  icon: string | import('react').ReactNode;
33
+ iconVariant?: 'linear' | 'outline' | 'bold' | 'bulk' | 'broken' | 'twotone';
30
34
  label: string;
31
35
  tooltipPlacement?: 'auto' | 'top' | 'bottom' | 'start' | 'end';
32
36
  danger?: boolean;
@@ -1,8 +1,15 @@
1
1
  /**
2
- * The shared status banner — wraps react-bootstrap <Alert> (same `.alert` /
2
+ * The shared tinted banner — wraps react-bootstrap <Alert> (same `.alert` /
3
3
  * `.alert-{variant}` classes Bootstrap + the theme already style). Screens must
4
4
  * use this instead of raw `className="alert alert-…"`.
5
5
  *
6
+ * It does two jobs, and `role` is what tells them apart for assistive technology:
7
+ * - REPORT a state ("we couldn't save", "your trial ends in 3 days"): keep the default
8
+ * `role="alert"`, or `"status"` for a notice that must not interrupt.
9
+ * - EXPLAIN part of the page (how a figure is worked out, what happens next): pass
10
+ * `role="none"` so a screen reader reads it as ordinary content instead of breaking in.
11
+ * `accent` adds the thick left edge that marks such an aside.
12
+ *
6
13
  * @param {object} props
7
14
  * @param {"info"|"success"|"warning"|"danger"} [props.variant="info"]
8
15
  * @param {import('react').ReactNode} props.children The alert body.
@@ -10,22 +17,32 @@
10
17
  * @param {string|import('react').ReactNode} [props.icon] A leading glyph — a semantic icon name or a node. Defaults to the variant's badge glyph; pass `null` for none.
11
18
  * @param {string} [props.image] A custom image URL shown in the badge instead of the icon glyph (fills the circle).
12
19
  * @param {string} [props.imageAlt] Alt text for the custom image.
20
+ * @param {number} [props.imageSize] Width and height of the image badge in px. Unset, it follows `size`.
13
21
  * @param {string} [props.className]
14
22
  * @param {() => void} [props.onClose] Called when dismissed
15
23
  * @param {boolean} [props.dismissible] Show the close button (defaults to true when onClose is set)
16
24
  * @param {boolean} [props.bordered=true] Draw the soft variant border. `false` keeps only the tint fill.
17
- * @param {"alert"|"status"} [props.role="alert"] Use "status" for non-assertive notices
25
+ * @param {boolean} [props.accent=false] A thick variant-coloured left edge, marking the alert as an aside.
26
+ * @param {"sm"|"md"|"lg"} [props.size="md"] `sm` is a compact single line; `lg` is roomier, with a larger
27
+ * heading, body and badge.
28
+ * @param {import('react').ReactNode} [props.action] A trailing action pinned to the right — usually an `AppButton`.
29
+ * @param {"alert"|"status"|"none"} [props.role="alert"] "status" for non-assertive notices; "none" for
30
+ * explanatory page content, which must not interrupt a screen reader.
18
31
  */
19
- export default function AppAlert({ variant, children, title, icon, image, imageAlt, className, onClose, dismissible, bordered, role, ...rest }: {
32
+ export default function AppAlert({ variant, children, title, icon, image, imageAlt, imageSize, className, onClose, dismissible, bordered, accent, size, action, role, ...rest }: {
20
33
  variant?: "info" | "success" | "warning" | "danger";
21
34
  children: import('react').ReactNode;
22
35
  title?: import('react').ReactNode;
23
36
  icon?: string | import('react').ReactNode;
24
37
  image?: string;
25
38
  imageAlt?: string;
39
+ imageSize?: number;
26
40
  className?: string;
27
41
  onClose?: () => void;
28
42
  dismissible?: boolean;
29
43
  bordered?: boolean;
30
- role?: "alert" | "status";
44
+ accent?: boolean;
45
+ size?: "sm" | "md" | "lg";
46
+ action?: import('react').ReactNode;
47
+ role?: "alert" | "status" | "none";
31
48
  }): import("react").JSX.Element;
@@ -7,9 +7,10 @@
7
7
  * @param {string} props.value
8
8
  * @param {boolean} props.checked
9
9
  * @param {(e: import('react').ChangeEvent<HTMLInputElement>) => void} props.onChange
10
- * @param {string} [props.icon]
10
+ * @param {string} [props.icon] Icon name. Renders linear, and switches to the solid (bold) style
11
+ * while the card is checked so the selected card reads at a glance.
11
12
  * @param {import('react').ReactNode} [props.iconNode]
12
- * @param {number} [props.iconSize=18]
13
+ * @param {number} [props.iconSize] Icon glyph size in px. Defaults to the card size: 16 (sm), 18 (md), 22 (lg).
13
14
  * @param {string} [props.image] Image URL — renders an image-forward card (overrides `icon`).
14
15
  * @param {string} [props.imageAlt]
15
16
  * @param {import('react').ReactNode} [props.children] Custom body, overriding title/description.
@@ -17,12 +18,18 @@
17
18
  * @param {import('react').ReactNode} [props.description]
18
19
  * @param {string} [props.checkIcon="check"]
19
20
  * @param {number} [props.checkSize=18]
21
+ * @param {boolean} [props.hideCheck=false] Render no selected tick. Selection then reads from the
22
+ * card's border and fill alone, and the card sheds the top/bottom room the tick needed.
23
+ * @param {'sm'|'md'|'lg'} [props.size='md'] Card size: padding, gap, icon disc, type and the
24
+ * tick offset step together.
25
+ * @param {'inline'|'stacked'} [props.layout='inline'] `inline` puts the icon beside the text;
26
+ * `stacked` puts the icon on its own line with the title and description below it.
20
27
  * @param {string} [props.className]
21
28
  */
22
29
  export default function AppChoiceCard({ name, multiple, value, checked, onChange, icon, iconNode, // custom icon element; overrides the `icon` name when provided
23
30
  iconSize, image, // image URL — renders an image-forward card (overrides icon)
24
31
  imageAlt, children, // custom body template — overrides title/description when provided
25
- title, description, checkIcon, checkSize, className, ...rest }: {
32
+ title, description, checkIcon, checkSize, hideCheck, size, layout, className, ...rest }: {
26
33
  name: string;
27
34
  multiple?: boolean;
28
35
  value: string;
@@ -38,5 +45,8 @@ title, description, checkIcon, checkSize, className, ...rest }: {
38
45
  description?: import('react').ReactNode;
39
46
  checkIcon?: string;
40
47
  checkSize?: number;
48
+ hideCheck?: boolean;
49
+ size?: 'sm' | 'md' | 'lg';
50
+ layout?: 'inline' | 'stacked';
41
51
  className?: string;
42
52
  }): import("react").JSX.Element;
@@ -0,0 +1,62 @@
1
+ import "@webority/ui-elements";
2
+ /**
3
+ * App-wide "search and jump": a top-anchored dialog with a search input over a grouped list
4
+ * of results. Pair it with `useCommandPaletteShortcut` to open it on Ctrl+K / Cmd+K.
5
+ *
6
+ * The overlay is `AppModal`, so the backdrop, Escape, the focus trap and returning focus to
7
+ * whatever was focused before it opened all come from there. The list behaviour (the active
8
+ * result, ArrowUp / ArrowDown across groups with wrap-around, Enter, the pointer, scrolling the
9
+ * active result into view) is the shared `<wui-command-palette>` element, the same one the
10
+ * Razor `<app-command-palette>` uses.
11
+ *
12
+ * You own the search: `query` is controlled, and `groups` is whatever your search returned
13
+ * for it. The palette does not filter. Selecting a result calls its `onSelect`, then `onClose`.
14
+ *
15
+ * @param {object} props
16
+ * @param {boolean} props.open
17
+ * @param {() => void} props.onClose Called on Escape, a backdrop click, and after a selection.
18
+ * @param {string} [props.query=''] The search text (controlled).
19
+ * @param {(value: string) => void} [props.onQueryChange] Called with the new text as the user types.
20
+ * @param {string} [props.placeholder='Search…']
21
+ * @param {{ key: string, label: import('react').ReactNode, items: { key: string,
22
+ * label: import('react').ReactNode, description?: import('react').ReactNode,
23
+ * icon?: string | import('react').ReactNode, meta?: import('react').ReactNode,
24
+ * onSelect?: () => void }[] }[]} [props.groups=[]] Results, rendered in order under
25
+ * their group headings. Keys must be unique within their group; groups with no items are
26
+ * left out. `icon` is a library icon name or a node; `meta` is short trailing text or a node.
27
+ * @param {boolean} [props.loading=false] Shows the library spinner in the input.
28
+ * @param {import('react').ReactNode} [props.emptyText='No results'] Shown when the query is
29
+ * not blank, nothing is loading, and no group has items.
30
+ * @param {import('react').ReactNode} [props.footer] Content under the list, such as key hints.
31
+ * @param {string} [props.ariaLabel='Search'] Accessible name of the dialog and its input.
32
+ * @param {boolean} [props.highlight=true] Bold the query inside each string label,
33
+ * case-insensitively. A label given as a node renders as it is.
34
+ * @param {string} [props.id] Seeds the result and heading ids; defaults to a generated id.
35
+ * @param {string} [props.className] Extra classes on the dialog card.
36
+ */
37
+ export default function AppCommandPalette({ open, onClose, query, onQueryChange, placeholder, groups, loading, emptyText, footer, ariaLabel, highlight, id, className, ...rest }: {
38
+ open: boolean;
39
+ onClose: () => void;
40
+ query?: string;
41
+ onQueryChange?: (value: string) => void;
42
+ placeholder?: string;
43
+ groups?: {
44
+ key: string;
45
+ label: import('react').ReactNode;
46
+ items: {
47
+ key: string;
48
+ label: import('react').ReactNode;
49
+ description?: import('react').ReactNode;
50
+ icon?: string | import('react').ReactNode;
51
+ meta?: import('react').ReactNode;
52
+ onSelect?: () => void;
53
+ }[];
54
+ }[];
55
+ loading?: boolean;
56
+ emptyText?: import('react').ReactNode;
57
+ footer?: import('react').ReactNode;
58
+ ariaLabel?: string;
59
+ highlight?: boolean;
60
+ id?: string;
61
+ className?: string;
62
+ }): import("react").JSX.Element;
@@ -13,6 +13,8 @@
13
13
  * badge occupies (and to the same reduced footprint when the dialog has no message), so a
14
14
  * 1024px PNG and a 64px one land identically. Decorative like the tone artwork: it renders
15
15
  * aria-hidden with an empty alt, and the title plus message carry the meaning.
16
+ * @param {number} [props.iconSize] Width and height of the illustration in px, for the tone
17
+ * artwork and a custom `image` alike. Unset, it is 120px with a message and 84px without.
16
18
  * @param {string} [props.confirmPhrase]
17
19
  * @param {() => void} props.onConfirm
18
20
  * @param {string} [props.cancelLabel="Cancel"]
@@ -28,7 +30,7 @@
28
30
  * a preset, or an exact max-width in px for a custom size.
29
31
  * @param {string} [props.className] Merged with the dialog's own wui-confirm class.
30
32
  */
31
- export default function AppConfirmDialog({ open, title, message, confirmLabel, cancelLabel, danger, tone, image, confirmPhrase, onConfirm, onClose, loading, staticBackdrop, placement, size, className, ...rest }: {
33
+ export default function AppConfirmDialog({ open, title, message, confirmLabel, cancelLabel, danger, tone, image, iconSize, confirmPhrase, onConfirm, onClose, loading, staticBackdrop, placement, size, className, ...rest }: {
32
34
  open: boolean;
33
35
  title: string;
34
36
  message?: import('react').ReactNode;
@@ -36,6 +38,7 @@ export default function AppConfirmDialog({ open, title, message, confirmLabel, c
36
38
  danger?: boolean;
37
39
  tone?: string;
38
40
  image?: string;
41
+ iconSize?: number;
39
42
  confirmPhrase?: string;
40
43
  onConfirm: () => void;
41
44
  cancelLabel?: string;
@@ -0,0 +1,14 @@
1
+ import "@webority/ui-elements";
2
+ /**
3
+ * @param {object} props
4
+ * @param {string} [props.value] Selected ISO 3166-1 alpha-2 code, e.g. "IN".
5
+ * @param {(value: string) => void} [props.onChange] Called with the chosen ISO code.
6
+ * @param {string[]} [props.countries] Limit the list to these ISO codes (alphabetical by name).
7
+ * Omitted, every country is listed.
8
+ * @param {boolean} [props.searchable=true] Show the search box in the menu.
9
+ * @param {'sm'|'md'|'lg'} [props.size='md'] Control size, same as AppInput.
10
+ * @param {string} [props.className] Class to apply to the control element.
11
+ * @param {string} [props.fieldClassName] Class to apply to the wrapper field div.
12
+ */
13
+ declare const AppCountrySelect: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
14
+ export default AppCountrySelect;
@@ -1,7 +1,8 @@
1
- export default function AppInfoTip({ label, children, placement, className, ...rest }: {
1
+ export default function AppInfoTip({ label, children, placement, width, className, ...rest }: {
2
2
  [x: string]: any;
3
3
  children: any;
4
4
  className?: string;
5
5
  label: any;
6
6
  placement?: string;
7
+ width?: string;
7
8
  }): import("react").JSX.Element;
@@ -21,6 +21,8 @@
21
21
  * @param {() => void} props.onAdd
22
22
  * @param {(index: number) => void} [props.onRemove] Omit to make rows non-removable.
23
23
  * @param {string} [props.addLabel='Add another']
24
+ * @param {string} [props.addVariant='secondary'] The add button's AppButton variant
25
+ * (primary, outline, ghost, …); an unknown value warns in dev, same as AppButton.
24
26
  * @param {string} [props.removeLabel='Remove row']
25
27
  * @param {string} [props.emptyText] Shown in place of the rows when there are none.
26
28
  * @param {number} [props.min=0] Rows at or below this count cannot be removed.
@@ -28,7 +30,7 @@
28
30
  * @param {boolean} [props.numbered=true] Show the row index.
29
31
  * @param {string} [props.className]
30
32
  */
31
- export default function AppRepeater({ rows, renderRow, rowLabel, onAdd, onRemove, addLabel, removeLabel, emptyText, min, max, numbered, className, ...rest }: {
33
+ export default function AppRepeater({ rows, renderRow, rowLabel, onAdd, onRemove, addLabel, addVariant, removeLabel, emptyText, min, max, numbered, className, ...rest }: {
32
34
  rows: {
33
35
  id?: string | number;
34
36
  }[];
@@ -37,6 +39,7 @@ export default function AppRepeater({ rows, renderRow, rowLabel, onAdd, onRemove
37
39
  onAdd: () => void;
38
40
  onRemove?: (index: number) => void;
39
41
  addLabel?: string;
42
+ addVariant?: string;
40
43
  removeLabel?: string;
41
44
  emptyText?: string;
42
45
  min?: number;
@@ -1,44 +1,13 @@
1
- /**
2
- * A segmented control — 2–4 mutually-exclusive options shown side by side, all
3
- * visible at once. The canonical use is a theme switch (Light / Dark / System)
4
- * or a compact view/range toggle above a chart.
5
- *
6
- * Past four options the row runs out of width — reach for `AppSelect` instead.
7
- * For a boolean use `AppSwitch`; for a filter that can be off use `AppChoiceChip`.
8
- *
9
- * Built on real `<input type="radio">` elements inside labels, so arrow-key
10
- * navigation, the single tab stop, and the "2 of 3" screen-reader announcement all
11
- * come from the browser rather than hand-written key handling — and the control
12
- * posts inside a plain form with no JavaScript.
13
- *
14
- * @param {object} props
15
- * @param {{ value: string, label: string, note?: string, icon?: string, disabled?: boolean }[]} props.options
16
- * `note` renders as a smaller, muted sub-line under the label — a supporting detail
17
- * ("Last 7 days") without shrinking the label itself. Optional; segments without one are
18
- * unaffected.
19
- * @param {string} props.value The selected option's value.
20
- * @param {(value: string) => void} props.onChange
21
- * @param {string} props.label Accessible name for the group.
22
- * @param {string} [props.name] Field name. Defaults to a generated one.
23
- * @param {'sm'|'md'|'lg'} [props.size='md']
24
- * @param {boolean} [props.fullWidth=false] Segments share the row equally, filling the container.
25
- * @param {boolean} [props.disabled=false] Disables the whole control.
26
- * @param {string} [props.className]
27
- */
28
- export default function AppSegmented({ options, value, onChange, label, name, size, fullWidth, disabled, className, ...rest }: {
29
- options: {
30
- value: string;
31
- label: string;
32
- note?: string;
33
- icon?: string;
34
- disabled?: boolean;
35
- }[];
36
- value: string;
37
- onChange: (value: string) => void;
38
- label: string;
39
- name?: string;
40
- size?: 'sm' | 'md' | 'lg';
41
- fullWidth?: boolean;
42
- disabled?: boolean;
1
+ export default function AppSegmented({ options, value, onChange, label, name, size, fullWidth, bordered, disabled, className, ...rest }: {
2
+ [x: string]: any;
3
+ bordered?: boolean;
43
4
  className?: string;
5
+ disabled?: boolean;
6
+ fullWidth?: boolean;
7
+ label: any;
8
+ name: any;
9
+ onChange: any;
10
+ options?: any[];
11
+ size?: string;
12
+ value: any;
44
13
  }): import("react").JSX.Element;
@@ -3,6 +3,9 @@ import "@webority/ui-elements";
3
3
  * @param {object} props
4
4
  * @param {string} [props.className] Class to apply to the control element.
5
5
  * @param {string} [props.fieldClassName] Class to apply to the wrapper field div.
6
+ * @param {import('react').ReactNode} [props.prefix] A bordered box before the select (e.g. "+91", "Tag"),
7
+ * the same shell as AppInput's prefix. Not combined with floatingLabel.
8
+ * @param {import('react').ReactNode} [props.suffix] A bordered box after the select, as AppInput's suffix.
6
9
  */
7
10
  declare const AppSelect: import("react").ForwardRefExoticComponent<import("react").RefAttributes<any>>;
8
11
  export default AppSelect;
@@ -14,6 +14,9 @@ export declare const InfoIcon: ({ size }: {
14
14
  export declare const DeleteIcon: ({ size }: {
15
15
  size?: number;
16
16
  }) => import("react").JSX.Element;
17
+ export declare const PrimaryIcon: ({ size }: {
18
+ size?: number;
19
+ }) => import("react").JSX.Element;
17
20
  export declare const MODAL_ICONS: {
18
21
  success: ({ size }: {
19
22
  size?: number;
@@ -30,4 +33,7 @@ export declare const MODAL_ICONS: {
30
33
  delete: ({ size }: {
31
34
  size?: number;
32
35
  }) => import("react").JSX.Element;
36
+ primary: ({ size }: {
37
+ size?: number;
38
+ }) => import("react").JSX.Element;
33
39
  };
@@ -1,9 +1,11 @@
1
1
  /**
2
2
  * @param {string | import('react').ReactNode} icon A Bootstrap-Icons name, or a node rendered as-is.
3
- * @param {{ size?: number, className?: string }} [options]
3
+ * @param {{ size?: number, className?: string, variant?: string }} [options] `variant` is the iconsax
4
+ * style for a NAMED icon; a node is the caller's own glyph and renders untouched.
4
5
  * @returns {import('react').ReactNode | null}
5
6
  */
6
- export default function renderIconProp(icon: string | import('react').ReactNode, { size, className }?: {
7
+ export default function renderIconProp(icon: string | import('react').ReactNode, { size, className, variant }?: {
7
8
  size?: number;
8
9
  className?: string;
10
+ variant?: string;
9
11
  }): import('react').ReactNode | null;
@@ -9,17 +9,18 @@ export { default as AppBadge } from "./components/AppBadge.jsx";
9
9
  export { default as AppBanner } from "./components/AppBanner.jsx";
10
10
  export { default as AppBreadcrumbs } from "./components/AppBreadcrumbs.jsx";
11
11
  export { default as AppButton } from "./components/AppButton.jsx";
12
- export { default as AppCallout } from "./components/AppCallout.jsx";
13
12
  export { default as AppCard } from "./components/AppCard.jsx";
14
13
  export { default as AppCheckbox } from "./components/AppCheckbox.jsx";
15
14
  export { default as AppChip } from "./components/AppChip.jsx";
16
15
  export { default as AppChoiceCard } from "./components/AppChoiceCard.jsx";
17
16
  export { default as AppChoiceChip } from "./components/AppChoiceChip.jsx";
18
17
  export { default as AppColorField } from "./components/AppColorField.jsx";
18
+ export { default as AppCommandPalette } from "./components/AppCommandPalette.jsx";
19
19
  export { default as AppCompareTable } from "./components/AppCompareTable.jsx";
20
20
  export { default as AppConfirmDialog } from "./components/AppConfirmDialog.jsx";
21
21
  export { default as AppConsentBanner } from "./components/AppConsentBanner.jsx";
22
22
  export { default as AppCopyButton } from "./components/AppCopyButton.jsx";
23
+ export { default as AppCountrySelect } from "./components/AppCountrySelect.jsx";
23
24
  export { default as AppDataTable } from "./components/AppDataTable.jsx";
24
25
  export { default as AppDatePicker } from "./components/AppDatePicker.jsx";
25
26
  export { default as AppDateRangePicker } from "./components/AppDateRangePicker.jsx";
@@ -83,4 +84,5 @@ export { default as AppWizard } from "./components/AppWizard.jsx";
83
84
  export { default as AppWorkspaceSwitcher } from "./components/AppWorkspaceSwitcher.jsx";
84
85
  export { MODAL_ICONS } from "./components/ModalIcons.jsx";
85
86
  export { dismissAll, errorToast, toast } from "./components/toast.js";
87
+ export { useCommandPaletteShortcut } from "./lib/useCommandPaletteShortcut.js";
86
88
  export { usePagination } from "./lib/usePagination.js";
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Calls `onOpen` when the user presses Ctrl+K (Windows, Linux) or Cmd+K (macOS) anywhere on
3
+ * the page, and stops the browser's own use of the chord (Ctrl+K focuses the address bar in
4
+ * some browsers). Pair it with `AppCommandPalette`:
5
+ *
6
+ * const [open, setOpen] = useState(false);
7
+ * useCommandPaletteShortcut(() => setOpen(true));
8
+ *
9
+ * Kept deliberately simple: it fires whatever has focus, including a text field or another
10
+ * open dialog, and it ignores a held key's auto-repeat. A chord with Alt or Shift held is left
11
+ * alone, so Ctrl+Shift+K stays available to the page. The listener is removed on unmount, and
12
+ * a new `onOpen` each render is fine: the latest one is always called.
13
+ *
14
+ * @param {() => void} onOpen Called on the chord.
15
+ * @param {{ key?: string }} [options] `key` is the letter to pair with Ctrl / Cmd (default `k`),
16
+ * matched case-insensitively.
17
+ */
18
+ export declare function useCommandPaletteShortcut(onOpen: () => void, { key }?: {
19
+ key?: string;
20
+ }): void;