@fiestaboard/ui 5.12.2 → 6.0.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.
|
@@ -3,7 +3,25 @@ import * as React from "react";
|
|
|
3
3
|
declare const alertVariants: (props?: ({
|
|
4
4
|
variant?: "destructive" | "default" | "info" | "success" | "warning" | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
-
|
|
6
|
+
export type AlertProps = React.ComponentProps<"div"> & VariantProps<typeof alertVariants> & {
|
|
7
|
+
/**
|
|
8
|
+
* Override the announcement urgency the variant would otherwise pick.
|
|
9
|
+
*
|
|
10
|
+
* The default is derived from `variant` (see {@link ASSERTIVE_VARIANTS}),
|
|
11
|
+
* which is right for the overwhelming majority of call sites — reach for
|
|
12
|
+
* this only when the message's urgency genuinely disagrees with its
|
|
13
|
+
* colour. A `destructive`-tinted alert that has been on the page since
|
|
14
|
+
* load is `politeness="polite"`; a `default`-tinted alert announcing that
|
|
15
|
+
* a save just failed is `politeness="assertive"`.
|
|
16
|
+
*
|
|
17
|
+
* Named for the ARIA term rather than spelled as a role so the two
|
|
18
|
+
* spellings cannot drift: this picks `alert` vs `status`, and no
|
|
19
|
+
* `aria-live` is set alongside, because the role already implies it (the
|
|
20
|
+
* same rule `EmptyState` follows).
|
|
21
|
+
*/
|
|
22
|
+
politeness?: "assertive" | "polite";
|
|
23
|
+
};
|
|
24
|
+
declare function Alert({ className, variant, politeness, ...props }: AlertProps): React.JSX.Element;
|
|
7
25
|
declare function AlertTitle({ className, ...props }: React.ComponentProps<"h5">): React.JSX.Element;
|
|
8
26
|
declare function AlertDescription({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
9
27
|
export { Alert, AlertDescription, AlertTitle, alertVariants };
|
|
@@ -12,23 +12,24 @@ var r = n("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:trans
|
|
|
12
12
|
warning: "border-warning bg-warning/8 text-foreground [&>svg]:text-warning"
|
|
13
13
|
} },
|
|
14
14
|
defaultVariants: { variant: "default" }
|
|
15
|
-
});
|
|
16
|
-
function
|
|
15
|
+
}), i = ["destructive", "warning"];
|
|
16
|
+
function a({ className: n, variant: a, politeness: o, ...s }) {
|
|
17
|
+
let c = o ?? (a && i.includes(a) ? "assertive" : "polite");
|
|
17
18
|
return /* @__PURE__ */ t("div", {
|
|
18
19
|
"data-slot": "alert",
|
|
19
|
-
role: "alert",
|
|
20
|
-
className: e(r({ variant:
|
|
21
|
-
...
|
|
20
|
+
role: c === "assertive" ? "alert" : "status",
|
|
21
|
+
className: e(r({ variant: a }), n),
|
|
22
|
+
...s
|
|
22
23
|
});
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
+
function o({ className: n, ...r }) {
|
|
25
26
|
return /* @__PURE__ */ t("h5", {
|
|
26
27
|
"data-slot": "alert-title",
|
|
27
28
|
className: e("mb-1 font-semibold leading-tight tracking-tight", n),
|
|
28
29
|
...r
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
+
function s({ className: n, ...r }) {
|
|
32
33
|
return /* @__PURE__ */ t("div", {
|
|
33
34
|
"data-slot": "alert-description",
|
|
34
35
|
className: e("text-sm [&_p]:leading-relaxed", n),
|
|
@@ -36,6 +37,6 @@ function o({ className: n, ...r }) {
|
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
39
|
//#endregion
|
|
39
|
-
export {
|
|
40
|
+
export { a as Alert, s as AlertDescription, o as AlertTitle, r as alertVariants };
|
|
40
41
|
|
|
41
42
|
//# sourceMappingURL=alert.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.js","names":[],"sources":["../../../src/components/feedback/alert.tsx"],"mappings":";;;;;AAqBA,IAAM,IAAgB,EACpB,2KACA;CACE,UAAU,EACR,SAAS;EAKP,SAAS;EAiBT,aAAa;EACb,MAAM;EACN,SAAS;EACT,SAAS;CACX,EACF;CACA,iBAAiB,EACf,SAAS,UACX;AACF,CACF;
|
|
1
|
+
{"version":3,"file":"alert.js","names":[],"sources":["../../../src/components/feedback/alert.tsx"],"mappings":";;;;;AAqBA,IAAM,IAAgB,EACpB,2KACA;CACE,UAAU,EACR,SAAS;EAKP,SAAS;EAiBT,aAAa;EACb,MAAM;EACN,SAAS;EACT,SAAS;CACX,EACF;CACA,iBAAiB,EACf,SAAS,UACX;AACF,CACF,GA0BM,IAA8C,CAAC,eAAe,SAAS;AAsB7E,SAAS,EAAM,EAAE,cAAW,YAAS,eAAY,GAAG,KAAqB;CACvE,IAAM,IAAU,MAAe,KAAW,EAAmB,SAAS,CAAO,IAAI,cAAc;CAE/F,OACE,kBAAC,OAAD;EACE,aAAU;EACV,MAAM,MAAY,cAAc,UAAU;EAC1C,WAAW,EAAG,EAAc,EAAE,WAAQ,CAAC,GAAG,CAAS;EAMnD,GAAI;CACL,CAAA;AAEL;AAIA,SAAS,EAAW,EAAE,cAAW,GAAG,KAAqC;CACvE,OACE,kBAAC,MAAD;EACE,aAAU;EACV,WAAW,EAAG,mDAAmD,CAAS;EAC1E,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,EAAiB,EAAE,cAAW,GAAG,KAAsC;CAC9E,OAAO,kBAAC,OAAD;EAAK,aAAU;EAAoB,WAAW,EAAG,iCAAiC,CAAS;EAAG,GAAI;CAAQ,CAAA;AACnH"}
|
|
@@ -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
|
-
|
|
7
|
-
|
|
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
|
|
53
|
+
onDismiss: () => void;
|
|
21
54
|
/**
|
|
22
|
-
* Localized accessible name for the dismiss button, e.g. "Remove
|
|
23
|
-
*
|
|
24
|
-
* package's i18n rule this ships no
|
|
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
|
|
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;
|
|
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"}
|