@fiestaboard/ui 5.12.3 → 6.0.1

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.
@@ -3,8 +3,41 @@ import * as React from "react";
3
3
  declare const badgeVariants: (props?: ({
4
4
  variant?: "destructive" | "default" | "success" | "brand" | "outline" | "secondary" | "variable" | "formula" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
- export type BadgeProps = React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
7
- asChild?: boolean;
6
+ /**
7
+ * The dismiss pair, as a union rather than two optional props (#299).
8
+ *
9
+ * The dismiss button's entire visible content is an `aria-hidden` X glyph, so
10
+ * `dismissLabel` is not a nicety — it is the button's ONLY accessible name.
11
+ * While both props were independently optional, `<Badge onDismiss={fn}>Weather
12
+ * </Badge>` type-checked, `aria-label={undefined}` was dropped at runtime, and
13
+ * the badge shipped a control a screen reader announces as bare "button". In a
14
+ * row of filter chips that is "button, button, button" with no way to tell
15
+ * which one removes Weather and which removes Traffic (SC 4.1.2, and 2.5.3
16
+ * once the X is the only thing a sighted user has to go on).
17
+ *
18
+ * The JSDoc had said REQUIRED since #249. Prose is not a compiler. This makes
19
+ * the unnamed case unrepresentable instead — the same move `SelectionGroup`
20
+ * already makes for the `aria-label`/`aria-labelledby` pair, and the same
21
+ * principle `card.tsx` names as "what makes that drift impossible rather than
22
+ * merely discouraged".
23
+ *
24
+ * A DEFAULT label was the other option and is not available to this package:
25
+ * `IconTile` already settled that a component needing a name needs a
26
+ * *localized* name, and this library ships no copy of its own (§8). "Dismiss"
27
+ * hardcoded in English is a worse bug than no name at all, because it looks
28
+ * fixed.
29
+ *
30
+ * The negative arm spells both keys as `?: never` so the props stay
31
+ * destructurable and a stray `dismissLabel` with no `onDismiss` is caught too
32
+ * — a label on a button that does not exist is a typo, not a no-op.
33
+ *
34
+ * Exported because a union cannot be built up prop by prop. A call site whose
35
+ * dismissibility is conditional has to hold the whole pair as one value —
36
+ * `const dismiss: BadgeDismissProps = enabled ? { onDismiss, dismissLabel } :
37
+ * {}` and then `<Badge {...dismiss}>` — and without this export it would have
38
+ * to re-declare the union to say that.
39
+ */
40
+ export type BadgeDismissProps = {
8
41
  /**
9
42
  * Renders a trailing dismiss button that the badge owns (#249).
10
43
  *
@@ -17,13 +50,20 @@ export type BadgeProps = React.ComponentProps<"span"> & VariantProps<typeof badg
17
50
  * Incompatible with `asChild`, which hands the rendered element to the
18
51
  * caller and leaves nowhere to put the button.
19
52
  */
20
- onDismiss?: () => void;
53
+ onDismiss: () => void;
21
54
  /**
22
- * Localized accessible name for the dismiss button, e.g. "Remove Weather".
23
- * REQUIRED with `onDismiss`: an X glyph names nothing, and per the
24
- * package's i18n rule this ships no copy of its own.
55
+ * Localized accessible name for the dismiss button, e.g. "Remove
56
+ * Weather". Required alongside `onDismiss` and enforced by the type: an
57
+ * X glyph names nothing, and per the package's i18n rule this ships no
58
+ * copy of its own.
25
59
  */
26
- dismissLabel?: string;
60
+ dismissLabel: string;
61
+ } | {
62
+ onDismiss?: never;
63
+ dismissLabel?: never;
27
64
  };
65
+ export type BadgeProps = React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
66
+ asChild?: boolean;
67
+ } & BadgeDismissProps;
28
68
  declare function Badge({ className, variant, asChild, children, onDismiss, dismissLabel, ref, ...props }: BadgeProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
29
69
  export { Badge, badgeVariants };
@@ -1 +1 @@
1
- {"version":3,"file":"badge.js","names":[],"sources":["../../../src/components/feedback/badge.tsx"],"mappings":";;;;;;;;AAQA,IAAM,IAAgB,EACpB,0QACA;CACE,UAAU,EACR,SAAS;EACP,SAAS;EAKT,OAAO;EACP,WAAW;EACX,aAAa;EACb,SAAS;EACT,UACE;EACF,SACE;EACF,SACE;CACJ,EACF;CACA,iBAAiB,EACf,SAAS,UACX;AACF,CACF;AA0BA,SAAS,EAAM,EAAE,cAAW,YAAS,aAAU,IAAO,aAAU,cAAW,iBAAc,QAAK,GAAG,KAAqB;CACpH,IAAM,IAAc,MAAc,KAAA,KAAa,CAAC;CAEhD,OAAO,EAAU;EACf,gBAAgB;EACX;EACL,QAAQ,IAAW,EAAM,SAAS,KAAK,CAAQ,IAA2B,KAAA;EAC1E,OAAO;GACL,aAAa;GACb,WAAW,EACT,EAAc,EAAE,WAAQ,CAAC,GACzB,KAAe,CAQb,oBAIA,iBACF,GACA,CACF;GACA,GAAI,IACA,CAAC,IACD,EACE,UAAU,IACR,kBAAA,GAAA,EAAA,UAAA,CAIE,kBAAC,QAAD;IAAM,aAAU;IAAc,WAAU;IACrC;GACG,CAAA,GACN,kBAAC,GAAD;IACE,MAAK;IACL,SAAQ;IACR,MAAK;IACL,aAAU;IACV,cAAY;IACZ,SAAS;IAGT,WAAU;IAEV,UAAA,kBAAC,GAAD,EAAG,eAAY,OAAQ,CAAA;GACjB,CAAA,CACR,EAAA,CAAA,IAEF,EAEJ;GACJ,GAAG;EACL;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"badge.js","names":[],"sources":["../../../src/components/feedback/badge.tsx"],"mappings":";;;;;;;;AAQA,IAAM,IAAgB,EACpB,0QACA;CACE,UAAU,EACR,SAAS;EACP,SAAS;EAKT,OAAO;EACP,WAAW;EACX,aAAa;EACb,SAAS;EACT,UACE;EACF,SACE;EACF,SACE;CACJ,EACF;CACA,iBAAiB,EACf,SAAS,UACX;AACF,CACF;AAkEA,SAAS,EAAM,EAAE,cAAW,YAAS,aAAU,IAAO,aAAU,cAAW,iBAAc,QAAK,GAAG,KAAqB;CACpH,IAAM,IAAc,MAAc,KAAA,KAAa,CAAC;CAEhD,OAAO,EAAU;EACf,gBAAgB;EACX;EACL,QAAQ,IAAW,EAAM,SAAS,KAAK,CAAQ,IAA2B,KAAA;EAC1E,OAAO;GACL,aAAa;GACb,WAAW,EACT,EAAc,EAAE,WAAQ,CAAC,GACzB,KAAe,CAQb,oBAIA,iBACF,GACA,CACF;GACA,GAAI,IACA,CAAC,IACD,EACE,UAAU,IACR,kBAAA,GAAA,EAAA,UAAA,CAIE,kBAAC,QAAD;IAAM,aAAU;IAAc,WAAU;IACrC;GACG,CAAA,GACN,kBAAC,GAAD;IACE,MAAK;IACL,SAAQ;IACR,MAAK;IACL,aAAU;IACV,cAAY;IACZ,SAAS;IAGT,WAAU;IAEV,UAAA,kBAAC,GAAD,EAAG,eAAY,OAAQ,CAAA;GACjB,CAAA,CACR,EAAA,CAAA,IAEF,EAEJ;GACJ,GAAG;EACL;CACF,CAAC;AACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiestaboard/ui",
3
- "version": "5.12.3",
3
+ "version": "6.0.1",
4
4
  "description": "FiestaUI — the FiestaBoard design system. React components on Base UI with Tailwind v4 design tokens.",
5
5
  "license": "MIT",
6
6
  "repository": {