@alfadocs/ui-kit 0.16.0 → 0.17.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.
@@ -0,0 +1,50 @@
1
+ import { type HTMLAttributes, type ReactNode } from 'react';
2
+ import { type VariantProps } from 'class-variance-authority';
3
+ declare const fieldVariants: (props?: ({
4
+ size?: "sm" | "md" | "lg" | null | undefined;
5
+ disabled?: boolean | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ declare const valueVariants: (props?: ({
8
+ intent?: "default" | "primary" | null | undefined;
9
+ size?: "sm" | "md" | "lg" | null | undefined;
10
+ wrap?: boolean | null | undefined;
11
+ hasStartIcon?: boolean | null | undefined;
12
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
13
+ type FieldSize = NonNullable<VariantProps<typeof fieldVariants>['size']>;
14
+ type ValueIntent = NonNullable<VariantProps<typeof valueVariants>['intent']>;
15
+ export interface CopyFieldProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onCopy'> {
16
+ /** The value displayed in the read-only field and copied on click. */
17
+ value: string;
18
+ /** Field height + padding. Mirrors TextInput sizes. */
19
+ size?: FieldSize;
20
+ /**
21
+ * `primary` tints the value text with `--primary` — matches the
22
+ * link-style emphasis used by the telehealth showSession page.
23
+ */
24
+ intent?: ValueIntent;
25
+ /**
26
+ * Leading icon slot, decorative. Use `lucide-react` icons like
27
+ * `<Link2 />` for a URL, `<KeyRound />` for a token.
28
+ */
29
+ startIcon?: ReactNode;
30
+ /**
31
+ * `false` (default) truncates long values with ellipsis on a single
32
+ * line. `true` allows wrap with `overflow-wrap: anywhere`.
33
+ */
34
+ wrap?: boolean;
35
+ /** Override the default 'Copy' button label. */
36
+ copyLabel?: ReactNode;
37
+ /** Override the default 'Copied' success-state label. */
38
+ copiedLabel?: ReactNode;
39
+ /** Milliseconds before the button reverts to its default state. Default 2000. */
40
+ copiedDuration?: number;
41
+ /** ARIA label for the read-only textbox. Defaults to the i18n key. */
42
+ ariaLabel?: string;
43
+ /** Fires once after a successful clipboard write. */
44
+ onCopy?: (value: string) => void;
45
+ /** Greys both the field and the button; the button doesn't fire onCopy. */
46
+ disabled?: boolean;
47
+ }
48
+ export declare const CopyField: import("react").ForwardRefExoticComponent<CopyFieldProps & import("react").RefAttributes<HTMLDivElement>>;
49
+ export {};
50
+ //# sourceMappingURL=copy-field.d.ts.map
@@ -0,0 +1,5 @@
1
+ export { CopyField } from './copy-field';
2
+ export type { CopyFieldProps } from './copy-field';
3
+ export { copyFieldAgent } from './copy-field.agent';
4
+ export type { CopyFieldHandle } from './copy-field.agent';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { C as p, c as a } from "../../_chunks/copy-field-BCHAZ8QV.js";
2
+ export {
3
+ p as CopyField,
4
+ a as copyFieldAgent
5
+ };
6
+ //# sourceMappingURL=index.js.map
@@ -14,6 +14,7 @@ export * from './checkbox';
14
14
  export * from './checkbox-group';
15
15
  export * from './color-picker';
16
16
  export * from './combobox';
17
+ export * from './copy-field';
17
18
  export * from './date-picker';
18
19
  export * from './date-range-picker';
19
20
  export * from './date-time-picker';
@@ -1,4 +1,4 @@
1
- import { N as i, a as t, b as e, c as o, d as g, e as s, f as u, g as v, n as M } from "../../_chunks/navigation-menu-Bav1d_wA.js";
1
+ import { N as i, a as t, b as e, c as o, d as g, e as s, f as u, g as v, n as M } from "../../_chunks/navigation-menu-DdufF-_4.js";
2
2
  import { S as r } from "../../_chunks/skip-link-BaSMtPwB.js";
3
3
  export {
4
4
  i as NavigationMenu,
@@ -1,4 +1,4 @@
1
- import { P as n, a as s, b as t, c as g, d as o, e as P, f as e, g as p, p as l } from "../../_chunks/pagination-OQBlnb1H.js";
1
+ import { P as n, a as s, b as t, c as g, d as o, e as P, f as e, g as p, p as l } from "../../_chunks/pagination-F1ei4khE.js";
2
2
  export {
3
3
  n as Pagination,
4
4
  s as PaginationEllipsis,
@@ -1,3 +1,3 @@
1
- export { PublicHeader, type PublicHeaderHandle, type PublicHeaderProps, type PublicHeaderNavLinkProps, } from './public-header';
1
+ export { PublicHeader, type PublicHeaderHandle, type PublicHeaderProps, type PublicHeaderNavLinkProps, type PublicHeaderNavDropdownProps, type PublicHeaderDropdownCardProps, type PublicHeaderDropdownLinkProps, } from './public-header';
2
2
  export { publicHeaderAgent } from './public-header.agent';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import { P as r, p } from "../../_chunks/public-header.agent-ZLBAQ30j.js";
1
+ import { P as r, p } from "../../_chunks/public-header.agent-sDi9N9su.js";
2
2
  export {
3
3
  r as PublicHeader,
4
4
  p as publicHeaderAgent
@@ -32,12 +32,47 @@ export interface PublicHeaderNavLinkProps extends Omit<AnchorHTMLAttributes<HTML
32
32
  active?: boolean;
33
33
  children: ReactNode;
34
34
  }
35
+ export interface PublicHeaderNavDropdownProps {
36
+ /** Trigger label (the visible nav item text). */
37
+ label: ReactNode;
38
+ /**
39
+ * `false` (default) renders a single-card dropdown anchored near the trigger
40
+ * (Settori-style). `true` renders a wide multi-card mega-menu spanning the
41
+ * pill's full inline width (Soluzioni-style).
42
+ */
43
+ wide?: boolean;
44
+ /** Cards / content inside the dropdown panel. */
45
+ children: ReactNode;
46
+ /** Optional id; not required — used only for analytics / test selectors. */
47
+ id?: string;
48
+ }
49
+ export interface PublicHeaderDropdownCardProps {
50
+ /**
51
+ * Optional href — when provided the card title becomes a clickable
52
+ * anchor with a `→` arrow indicator. Without href, the title is
53
+ * a static heading (Settori-style).
54
+ */
55
+ href?: string;
56
+ title: ReactNode;
57
+ /** Optional subtitle / muted helper text under the title. */
58
+ subtitle?: ReactNode;
59
+ /** Sub-list contents (typically PublicHeader.DropdownLink children). */
60
+ children?: ReactNode;
61
+ }
62
+ export interface PublicHeaderDropdownLinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> {
63
+ href: string;
64
+ active?: boolean;
65
+ children: ReactNode;
66
+ }
35
67
  declare const rootVariants: (props?: ({
36
- variant?: "dark" | "default" | "transparent" | null | undefined;
68
+ variant?: "dark" | "default" | "pill" | "transparent" | null | undefined;
37
69
  sticky?: "none" | "top" | "scroll-up" | null | undefined;
38
70
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
39
71
  export declare const PublicHeader: import("react").ForwardRefExoticComponent<PublicHeaderProps & import("react").RefAttributes<HTMLElement>> & {
40
72
  NavLink: import("react").ForwardRefExoticComponent<PublicHeaderNavLinkProps & import("react").RefAttributes<HTMLAnchorElement>>;
73
+ NavDropdown: import("react").ForwardRefExoticComponent<PublicHeaderNavDropdownProps & import("react").RefAttributes<HTMLButtonElement>>;
74
+ DropdownCard: import("react").ForwardRefExoticComponent<PublicHeaderDropdownCardProps & import("react").RefAttributes<HTMLDivElement>>;
75
+ DropdownLink: import("react").ForwardRefExoticComponent<PublicHeaderDropdownLinkProps & import("react").RefAttributes<HTMLAnchorElement>>;
41
76
  };
42
77
  export {};
43
78
  //# sourceMappingURL=public-header.d.ts.map
@@ -0,0 +1,10 @@
1
+ export interface UseControllableStateOptions<T> {
2
+ /** Controlled value. When defined, the hook is in controlled mode. */
3
+ value?: T;
4
+ /** Initial state when uncontrolled. Ignored once `value` is set. */
5
+ defaultValue?: T;
6
+ /** Fires on every write — controlled callers must apply it. */
7
+ onChange?: (next: T) => void;
8
+ }
9
+ export declare function useControllableState<T>({ value, defaultValue, onChange, }: UseControllableStateOptions<T>): [T | undefined, (next: T) => void];
10
+ //# sourceMappingURL=use-controllable-state.d.ts.map
@@ -0,0 +1,45 @@
1
+ export type CopyStatus = 'idle' | 'copied' | 'error';
2
+ export interface UseCopyToClipboardOptions {
3
+ /**
4
+ * Auto-reset to `'idle'` this many ms after a successful copy. Pass
5
+ * `0` to disable auto-reset (caller drives the lifecycle). @default 2000
6
+ */
7
+ resetAfterMs?: number;
8
+ /**
9
+ * Override the underlying clipboard writer. When omitted the hook
10
+ * uses `navigator.clipboard.writeText`. Pass your own writer to add
11
+ * a legacy `document.execCommand('copy')` fallback for non-HTTPS
12
+ * contexts, or to instrument the call for telemetry. Must resolve
13
+ * `true` on success, `false` on failure (do not throw).
14
+ */
15
+ writer?: (value: string) => Promise<boolean>;
16
+ }
17
+ export interface UseCopyToClipboardReturn {
18
+ /** Current status. `'idle'` until the first `copy()` call. */
19
+ status: CopyStatus;
20
+ /** Last value successfully copied, or `null`. */
21
+ copiedValue: string | null;
22
+ /** Copy `value` to the clipboard. Returns `true` on success. */
23
+ copy: (value: string) => Promise<boolean>;
24
+ /** Reset to `'idle'` immediately. */
25
+ reset: () => void;
26
+ }
27
+ /**
28
+ * Copy a string to the system clipboard with status tracking.
29
+ *
30
+ * Uses `navigator.clipboard.writeText` (https-only / focus-required, but
31
+ * universally available in modern browsers). Falls back gracefully —
32
+ * `copy()` returns `false` and sets `status: 'error'` when the Clipboard
33
+ * API is unavailable or the call rejects.
34
+ *
35
+ * Status auto-resets to `'idle'` after `resetAfterMs` ms by default so
36
+ * the common "show ✓ for 2s after click" UX has zero glue code.
37
+ *
38
+ * @example
39
+ * const { status, copy } = useCopyToClipboard();
40
+ * <Button onClick={() => copy(value)}>
41
+ * {status === 'copied' ? 'Copied!' : 'Copy'}
42
+ * </Button>
43
+ */
44
+ export declare function useCopyToClipboard(options?: UseCopyToClipboardOptions): UseCopyToClipboardReturn;
45
+ //# sourceMappingURL=use-copy-to-clipboard.d.ts.map
@@ -53,6 +53,13 @@ const a = {
53
53
  vatNumberLabel: "VAT no.:",
54
54
  phoneLabel: "Phone:"
55
55
  },
56
+ copyField: {
57
+ copy: "Copy",
58
+ copied: "Copied",
59
+ valueLabel: "Value to copy",
60
+ copySuccess: "Copied to clipboard",
61
+ copyFailed: "Copy failed"
62
+ },
56
63
  inputs: {
57
64
  switch: {
58
65
  on: "On",
@@ -1068,6 +1075,13 @@ const a = {
1068
1075
  vatNumberLabel: "P. IVA:",
1069
1076
  phoneLabel: "Telefono:"
1070
1077
  },
1078
+ copyField: {
1079
+ copy: "Copia",
1080
+ copied: "Copiato",
1081
+ valueLabel: "Valore da copiare",
1082
+ copySuccess: "Copiato negli appunti",
1083
+ copyFailed: "Copia non riuscita"
1084
+ },
1071
1085
  inputs: {
1072
1086
  switch: {
1073
1087
  on: "Attivo",
@@ -2049,6 +2063,13 @@ const a = {
2049
2063
  vatNumberLabel: "USt-IdNr.:",
2050
2064
  phoneLabel: "Telefon:"
2051
2065
  },
2066
+ copyField: {
2067
+ copy: "Kopieren",
2068
+ copied: "Kopiert",
2069
+ valueLabel: "Wert zum Kopieren",
2070
+ copySuccess: "In Zwischenablage kopiert",
2071
+ copyFailed: "Kopieren fehlgeschlagen"
2072
+ },
2052
2073
  inputs: {
2053
2074
  switch: {
2054
2075
  on: "An",
@@ -51,6 +51,13 @@ export declare const enUi: {
51
51
  readonly vatNumberLabel: "VAT no.:";
52
52
  readonly phoneLabel: "Phone:";
53
53
  };
54
+ readonly copyField: {
55
+ readonly copy: "Copy";
56
+ readonly copied: "Copied";
57
+ readonly valueLabel: "Value to copy";
58
+ readonly copySuccess: "Copied to clipboard";
59
+ readonly copyFailed: "Copy failed";
60
+ };
54
61
  readonly inputs: {
55
62
  readonly switch: {
56
63
  readonly on: "On";
@@ -1082,6 +1089,13 @@ export declare const itUi: {
1082
1089
  readonly vatNumberLabel: "P. IVA:";
1083
1090
  readonly phoneLabel: "Telefono:";
1084
1091
  };
1092
+ readonly copyField: {
1093
+ readonly copy: "Copia";
1094
+ readonly copied: "Copiato";
1095
+ readonly valueLabel: "Valore da copiare";
1096
+ readonly copySuccess: "Copiato negli appunti";
1097
+ readonly copyFailed: "Copia non riuscita";
1098
+ };
1085
1099
  readonly inputs: {
1086
1100
  readonly switch: {
1087
1101
  readonly on: "Attivo";
@@ -2088,6 +2102,13 @@ export declare const deUi: {
2088
2102
  readonly vatNumberLabel: "USt-IdNr.:";
2089
2103
  readonly phoneLabel: "Telefon:";
2090
2104
  };
2105
+ readonly copyField: {
2106
+ readonly copy: "Kopieren";
2107
+ readonly copied: "Kopiert";
2108
+ readonly valueLabel: "Wert zum Kopieren";
2109
+ readonly copySuccess: "In Zwischenablage kopiert";
2110
+ readonly copyFailed: "Kopieren fehlgeschlagen";
2111
+ };
2091
2112
  readonly inputs: {
2092
2113
  readonly switch: {
2093
2114
  readonly on: "An";