@webority/ui-react 0.7.2 → 0.7.3

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.
@@ -8,7 +8,7 @@
8
8
  * unusable with a screen reader, and it doubles as the hover tooltip.
9
9
  *
10
10
  * @param {object} props
11
- * @param {string} props.icon glyph name (see Icon)
11
+ * @param {string|import('react').ReactNode} props.icon glyph name (see Icon), or a custom node (e.g. an iconsax glyph)
12
12
  * @param {string} props.label accessible name + tooltip
13
13
  * @param {boolean} [props.danger] destructive tint
14
14
  * @param {boolean} [props.disabled]
@@ -19,7 +19,7 @@
19
19
  * @param {string} [props.href] sets an anchor without needing `as`.
20
20
  */
21
21
  export default function ActionIcon({ icon, label, danger, disabled, size, onClick, className, as, href, ...rest }: {
22
- icon: string;
22
+ icon: string | import('react').ReactNode;
23
23
  label: string;
24
24
  danger?: boolean;
25
25
  disabled?: boolean;
@@ -14,7 +14,8 @@ import '@webority/ui-elements';
14
14
  * argument reports whether the commit was a freeform entry (`allowCustom`) rather than a
15
15
  * listed option — existing callers reading only the first argument are unaffected.
16
16
  * @param {{value: string, label: string}[]} [props.options] Static options.
17
- * @param {(query: string) => Promise<{value: string, label: string}[]>} [props.loadOptions] Remote loader.
17
+ * @param {(query: string, opts?: { signal?: AbortSignal }) => Promise<{value: string, label: string}[]>} [props.loadOptions]
18
+ * Remote loader; receives an AbortSignal for the superseded request (optional to use).
18
19
  * @param {string} [props.placeholder]
19
20
  * @param {number} [props.minChars] Min chars before a remote search fires (default 1 in remote mode).
20
21
  * @param {number} [props.debounce] Debounce ms for remote search (default 250).
@@ -40,7 +41,9 @@ export default function AppAutocomplete({ value, onChange, options, loadOptions,
40
41
  value: string;
41
42
  label: string;
42
43
  }[];
43
- loadOptions?: (query: string) => Promise<{
44
+ loadOptions?: (query: string, opts?: {
45
+ signal?: AbortSignal;
46
+ }) => Promise<{
44
47
  value: string;
45
48
  label: string;
46
49
  }[]>;
@@ -7,13 +7,13 @@
7
7
  *
8
8
  * @param {object} props
9
9
  * @param {import('react').ReactNode} props.children
10
- * @param {"primary"|"success"|"warn"|"danger"|"info"} [props.tone]
10
+ * @param {"neutral"|"primary"|"success"|"warning"|"danger"|"info"} [props.tone] Legacy "warn" is aliased to "warning".
11
11
  * @param {boolean} [props.dot=false]
12
12
  * @param {string} [props.className]
13
13
  */
14
14
  export default function AppBadge({ children, tone, dot, className, ...rest }: {
15
15
  children: import('react').ReactNode;
16
- tone?: "primary" | "success" | "warn" | "danger" | "info";
16
+ tone?: "neutral" | "primary" | "success" | "warning" | "danger" | "info";
17
17
  dot?: boolean;
18
18
  className?: string;
19
19
  }): import("react").JSX.Element;
@@ -1,9 +1,10 @@
1
- export default function AppButton({ children, variant, size, type, loading, disabled, block, leftIcon, rightIcon, className, ...rest }: {
1
+ export default function AppButton({ children, variant, size, type, loading, disabled, block, leftIcon, rightIcon, href, className, ...rest }: {
2
2
  [x: string]: any;
3
3
  block?: boolean;
4
4
  children: any;
5
5
  className?: string;
6
6
  disabled?: boolean;
7
+ href: any;
7
8
  leftIcon?: any;
8
9
  loading?: boolean;
9
10
  rightIcon?: any;
@@ -10,7 +10,7 @@
10
10
  * the tighter widget/tile variant (smaller title + text).
11
11
  *
12
12
  * @param {object} props
13
- * @param {string} props.icon Bootstrap Icons name for the bubble
13
+ * @param {string|import('react').ReactNode} props.icon Bootstrap Icons name for the bubble, or a custom node
14
14
  * @param {number} [props.iconSize=24]
15
15
  * @param {"md"|"sm"} [props.size="md"]
16
16
  * @param {import('react').ReactNode} props.title
@@ -20,7 +20,7 @@
20
20
  * @param {import('react').CSSProperties} [props.style]
21
21
  */
22
22
  export default function AppEmptyState({ icon, iconSize, size, title, text, action, className, style, ...rest }: {
23
- icon: string;
23
+ icon: string | import('react').ReactNode;
24
24
  iconSize?: number;
25
25
  size?: "md" | "sm";
26
26
  title: import('react').ReactNode;
@@ -9,13 +9,13 @@
9
9
  * `AppStatusBadge`. This is for stating facts.
10
10
  *
11
11
  * @param {object} props
12
- * @param {{ key?: string, icon: string, label: string, value: import('react').ReactNode, href?: string }[]} props.items
12
+ * @param {{ key?: string, icon: string|import('react').ReactNode, label: string, value: import('react').ReactNode, href?: string }[]} props.items
13
13
  * @param {string} [props.className]
14
14
  */
15
15
  export default function AppInfoList({ items, className, ...rest }: {
16
16
  items: {
17
17
  key?: string;
18
- icon: string;
18
+ icon: string | import('react').ReactNode;
19
19
  label: string;
20
20
  value: import('react').ReactNode;
21
21
  href?: string;
@@ -5,7 +5,7 @@
5
5
  * @param {object} props
6
6
  * @param {string} props.label What the number measures.
7
7
  * @param {import('react').ReactNode} props.value The number itself, already formatted.
8
- * @param {string} [props.icon] Icon name for the leading tile.
8
+ * @param {string|import('react').ReactNode} [props.icon] Icon name for the leading tile, or a custom node.
9
9
  * @param {import('react').ReactNode} [props.delta] Change text, e.g. "12% vs last month".
10
10
  * @param {'up'|'down'|'flat'} [props.deltaDirection='flat'] Colours the delta and picks its arrow.
11
11
  * @param {'plain'|'filled'|'accent'} [props.variant='plain'] The tile surface: plain (today's
@@ -16,7 +16,7 @@
16
16
  export default function AppKpiTile({ label, value, icon, delta, deltaDirection, variant, inline, className, ...rest }: {
17
17
  label: string;
18
18
  value: import('react').ReactNode;
19
- icon?: string;
19
+ icon?: string | import('react').ReactNode;
20
20
  delta?: import('react').ReactNode;
21
21
  deltaDirection?: 'up' | 'down' | 'flat';
22
22
  variant?: 'plain' | 'filled' | 'accent';
@@ -1,22 +1,33 @@
1
1
  /**
2
- * Shared tab strip (.app-tabs). Keyboard: Arrow / Home / End.
2
+ * Shared tab strip (.app-tabs). A controlled component: the caller owns `value` +
3
+ * `onChange` and renders the panels. Razor's <app-tabs> renders the same strip markup
4
+ * (plus Bootstrap panels), so both surfaces look and behave alike.
3
5
  *
4
- * React drives the strip as a controlled component (`value` + `onChange`, panels
5
- * are the caller's); Razor's <app-tabs> additionally renders Bootstrap panels
6
- * from its children. The strip markup is the same on both, so they look alike.
6
+ * The active state is a sliding "ink bar" (`.app-tab-indicator`) — one element that is
7
+ * JS-measured against the active tab and animates between tabs with an elastic overshoot
8
+ * (`--wui-ease-elastic`). It becomes a moving pill in the `pills` variant and a moving
9
+ * left edge when `orientation="vertical"`, and it snaps (no slide) under
10
+ * `prefers-reduced-motion`.
11
+ *
12
+ * Keyboard (WAI-ARIA tablist): Arrow (Left/Right, or Up/Down when vertical) / Home / End
13
+ * roam the strip skipping disabled tabs. `activation="automatic"` (default) selects as
14
+ * focus moves; `activation="manual"` moves focus only and selects on Enter/Space.
7
15
  *
8
16
  * @param {object} props
9
17
  * @param {{ key: string, label: import('react').ReactNode, count?: number, tone?: string, icon?: import('react').ReactNode, danger?: boolean, disabled?: boolean }[]} props.tabs
10
- * @param {string} props.value
18
+ * @param {string} props.value Selected tab key.
11
19
  * @param {(key: string) => void} props.onChange
12
20
  * @param {"underline"|"pills"} [props.variant="underline"]
21
+ * @param {"horizontal"|"vertical"} [props.orientation="horizontal"] Vertical renders a side rail.
22
+ * @param {"sm"|"md"|"lg"} [props.size="md"]
23
+ * @param {boolean} [props.fitted=false] Tabs share the width equally instead of scrolling.
24
+ * @param {"automatic"|"manual"} [props.activation="automatic"] Whether arrow keys also select.
13
25
  * @param {string} [props.ariaLabel]
14
26
  * @param {string} [props.className]
15
27
  * @param {import('react').CSSProperties} [props.style]
16
- * @param {"success"|"warning"|"danger"|"info"} [props.tone] Tone tint for a tab's count
17
- * pill — set per-tab as `tabs[].tone`, matching the vocabulary `.status-label` uses.
28
+ * @param {"success"|"warning"|"danger"|"info"} [props.tone] Per-tab count-pill tint (set as `tabs[].tone`).
18
29
  */
19
- export default function AppTabs({ tabs, value, onChange, variant, ariaLabel, className, style, ...rest }: {
30
+ export default function AppTabs({ tabs, value, onChange, variant, orientation, size, fitted, activation, ariaLabel, className, style, ...rest }: {
20
31
  tabs: {
21
32
  key: string;
22
33
  label: import('react').ReactNode;
@@ -29,6 +40,10 @@ export default function AppTabs({ tabs, value, onChange, variant, ariaLabel, cla
29
40
  value: string;
30
41
  onChange: (key: string) => void;
31
42
  variant?: "underline" | "pills";
43
+ orientation?: "horizontal" | "vertical";
44
+ size?: "sm" | "md" | "lg";
45
+ fitted?: boolean;
46
+ activation?: "automatic" | "manual";
32
47
  ariaLabel?: string;
33
48
  className?: string;
34
49
  style?: import('react').CSSProperties;
@@ -0,0 +1 @@
1
+ export default function normalizeTone(tone: any): any;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @param {string | import('react').ReactNode} icon A Bootstrap-Icons name, or a node rendered as-is.
3
+ * @param {{ size?: number, className?: string }} [options]
4
+ * @returns {import('react').ReactNode | null}
5
+ */
6
+ export default function renderIconProp(icon: string | import('react').ReactNode, { size, className }?: {
7
+ size?: number;
8
+ className?: string;
9
+ }): import('react').ReactNode | null;