/** * Tree-shaken DEV guardrails (blueprint §5). * No-ops when `NODE_ENV === "production"`. * * W12 owns `outline-none` + `positive-tabindex`. Other codes are catalogued * here so consumers share one tree-shaken entry point. */ export type DevWarnCode = "placeholder-as-label" | "two-primaries" | "banned-error-word" | "bare-disabled" | "cancel-disabled" | "dialog-too-many-actions" | "select-too-few-options" | "positive-tabindex" | "tooltip-on-disabled" | "outline-none" | "multiple-h1" | "opaque-stack-group" /** Numeric height/paddingHorizontal on a recipe control without sizeRecipeEscape. */ | "size-recipe-escape"; export type DevWarnDetail = { component?: string; id?: string; value?: unknown; word?: string; count?: number; suggest?: string; region?: string; [key: string]: unknown; }; /** * LC-57 GUARDRAIL-CLEAN-STORIES allowlist entry, declared as a Storybook story * parameter (`parameters.guardrailSpecimen`). * * Catalog stories emit zero `[theme]` guardrail warnings at rest. A story whose * whole purpose is to demonstrate the warned state (a disabled-dial specimen, a * pager boundary case) is allowlisted by declaring itself: * * ```ts * export const Disabled: Story = { * parameters: { * guardrailSpecimen: { * warns: ["bare-disabled"], * reason: "Demonstrates the disabled dial; Stepper has no disabledReason plumbing.", * } satisfies GuardrailSpecimenParameter, * }, * }; * ``` * * Semantics, pinned: * - `warns` is the CLOSED set of codes the story may emit at rest. An emitted * code outside the set still FAILs the story. * - A declared code that happens not to fire passes — component improvements * must never break an allowlist entry. * - The declaration NEVER suppresses the console warning — the warn still * fires; only the warn-harvester tolerates it (explicit, never tacit). * - Harvesters (`p-results/story-hygiene/verify.mjs`) read this parameter off * the rendered story and fail CLOSED when parameters cannot be read at all. */ export type GuardrailSpecimenParameter = { /** Warn codes this story may emit at rest — a closed set, not a wildcard. */ warns: DevWarnCode[]; /** Why the warned state is the story's subject (recorded per LC-57). */ reason: string; }; /** * Emit a once-per-key console warning in non-production builds. */ export declare function devWarn(code: DevWarnCode, detail?: DevWarnDetail): void; /** @internal test helper */ export declare function __resetDevWarnSeen(): void; /** Alias kept for callers that imported the W12-era name. */ export declare const themeDevWarn: typeof devWarn; export declare const __resetThemeDevWarnSeen: typeof __resetDevWarnSeen; /** * DG-FORM-02 / DG-FORM-11: placeholder must not be the only label. */ export declare function warnPlaceholderAsLabel(args: { placeholder?: string | null; label?: unknown; ariaLabel?: string | null; id?: string; component?: string; }): void; /** DG-COPY-02 / DG-VAL-03 — banned words in error copy. */ export declare function warnBannedErrorWords(message: string | null | undefined, detail?: DevWarnDetail): void; /** DG-ST-03 — bare `disabled` without reason / explain. */ export declare function warnBareDisabled(args: { disabled?: boolean; disabledReason?: string | null; skip?: boolean; component?: string; id?: string; }): void; /** * LC-65 — numeric `height` / `paddingHorizontal` on a size-recipe control * (Button, Input.Box) must opt in with `sizeRecipeEscape="reason"`. Warns * once per component+id like `warnBareDisabled`; does not invent a general * style escape. */ export declare function warnSizeRecipeEscape(args: { height?: unknown; paddingHorizontal?: unknown; sizeRecipeEscape?: string | null; component?: string; id?: string; }): void; /** * DG-ACT-05 — the cancel/dismiss action never renders disabled (while confirm * may be). Enforcing callers strip the prop and report the attempt here. */ export declare function warnCancelDisabled(args: { disabled?: boolean; component?: string; id?: string; }): void; /** DG-OVL-04 — dialog action rows cap at this many actions by default. */ export declare const DIALOG_MAX_ACTIONS = 2; /** * DG-OVL-04 — max 2 actions in a dialog by default. Warn-only (never a hard * block); `allowManyActions` is the explicit eject acknowledging the extra * actions. */ export declare function warnDialogTooManyActions(args: { count: number; allowManyActions?: boolean; component?: string; id?: string; }): void; /** * DG-CTRL — Select with too few options; suggest RadioGroup / ToggleGroup. */ export declare function warnSelectTooFewOptions(args: { count: number; multiple?: boolean; component?: string; id?: string; }): void; /** DG-A11Y-03 — never `tabIndex` > 0. */ export declare function warnPositiveTabIndex(args: { value?: number | string | null; component?: string; id?: string; }): void; /** DG-OVL-05 — no hover tooltip on disabled controls. */ export declare function warnTooltipOnDisabled(args: { childDisabled?: boolean; component?: string; id?: string; }): void; type OutlineLike = { outline?: string | number; outlineStyle?: string; outlineWidth?: number; outlineColor?: string; } | null | undefined; /** * DG-A11Y-01 / W12 — warn when a focus style strips the outline. * Call on `focusVisibleStyle` / `focusStyle` only — not resting * `outlineWidth: 0` + transparent (border-flicker rest). */ export declare function warnOutlineNone(style: OutlineLike, detail?: DevWarnDetail): void; export {}; //# sourceMappingURL=devWarn.d.ts.map