@mediaradar/design-components 0.13.0 → 0.15.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.
package/dist/index.d.cts CHANGED
@@ -163,6 +163,14 @@ interface BadgeProps {
163
163
  tone?: BadgeTone;
164
164
  /** Shape and case. `count` for a number, `eyebrow` for a category label. */
165
165
  kind?: BadgeKind;
166
+ /**
167
+ * Draws a small filled dot before the label, in the tone's own ink. For a
168
+ * status that is scanned down a column rather than read -- the dot is what
169
+ * the eye follows, and it carries the colour at a size the text cannot.
170
+ * Purely decorative: the label is the accessible content, so the dot is
171
+ * hidden from assistive tech rather than announced as a second thing.
172
+ */
173
+ dot?: boolean;
166
174
  /** Text, or an icon plus text. Keep it to a few words -- a badge annotates, it does not explain. */
167
175
  children: ReactNode;
168
176
  className?: string;
@@ -176,8 +184,9 @@ interface BadgeProps {
176
184
  * @props
177
185
  * tone?: 'neutral' | 'brand' | 'brandSolid' | 'success' | 'warning' | 'danger' | 'ai' | 'overlay' (default 'neutral')
178
186
  * kind?: 'label' | 'count' | 'eyebrow' (default 'label')
187
+ * dot?: boolean (default false) -- a filled dot before the label, in the tone's ink
179
188
  * children: ReactNode
180
- * @tokens text-micro, rounded-full, bg-subtle, bg-brand-primarySoft, bg-brand-primaryAction,
189
+ * @tokens text-micro, rounded-full, bg-current, bg-subtle, bg-brand-primarySoft, bg-brand-primaryAction,
181
190
  * bg-status-success/15, bg-status-warning/30, bg-status-danger/15, bg-scrim,
182
191
  * text-text-secondary, text-brand-primaryAction, text-text-success,
183
192
  * text-text-warning, text-text-danger, text-ai-ontint, text-brand-onprimary,
@@ -213,11 +222,12 @@ interface BadgeProps {
213
222
  * <Badge>Financial Services</Badge>
214
223
  * <Badge tone="brandSolid" kind="count">{activeFilters}</Badge>
215
224
  * <Badge tone="warning">Partial month</Badge>
225
+ * <Badge tone="success" dot>Completed</Badge>
216
226
  * <Badge kind="eyebrow" tone="neutral">Saved view</Badge>
217
227
  * <Badge tone="brand"><Check size={11} aria-hidden="true" />Primary</Badge>
218
228
  * ```
219
229
  */
220
- declare function Badge({ tone, kind, children, className }: BadgeProps): react.JSX.Element;
230
+ declare function Badge({ tone, kind, dot, children, className }: BadgeProps): react.JSX.Element;
221
231
 
222
232
  /**
223
233
  * @pattern CheckBox
@@ -968,18 +978,29 @@ declare function StackedColumnPlaceholder({ height, width, legendRows, axis, }:
968
978
  * escapes both `overflow` clipping inside scrollable panels and the broken
969
979
  * `fixed` containing block a transformed ancestor creates.
970
980
  * @tokens rounded-control, border-border-default, bg-surface, shadow-overlay,
971
- * text-text-primary, bg-text-primary, text-surface
981
+ * text-text-primary, bg-text-primary, text-surface,
982
+ * duration-(--mr-motion-duration-interactive)
972
983
  * @variant surface - Default. Themed surface/border bubble -- matches the
973
984
  * Recharts chart tooltips this was originally built for.
974
985
  * @variant inverted - Solid dark pill (no border) -- for a tooltip sitting
975
986
  * over a nav rail or other icon-only surface, where the themed surface bubble
976
987
  * doesn't read as clearly against a busy background.
977
988
  * @behavior Shows on hover and on keyboard focus (so it stays reachable
978
- * without a pointer) after `delay` ms (0 = immediate, the default). Hides
979
- * immediately on mouseleave/blur, cancelling a pending delayed show if it
980
- * hasn't fired yet -- except in `interactive` mode, which delays the hide
981
- * briefly so the pointer can travel from the trigger into the tooltip's own
982
- * content. Pass `whenTruncated` to only surface it once the trigger's content
989
+ * without a pointer) after `delay` ms (0 = immediate, the default). Fades in
990
+ * and out (opacity, `ease-in-out`, over the sys
991
+ * `--mr-motion-duration-interactive` token -- 200ms today); the bubble stays
992
+ * mounted through the fade-out and is removed from the DOM once it ends.
993
+ * Under `prefers-reduced-motion: reduce` there is no fade: it appears and is
994
+ * removed instantly. The hide starts on mouseleave/blur, cancelling a pending
995
+ * delayed show if it hasn't fired yet -- except in `interactive` mode, which
996
+ * delays the hide briefly so the pointer can travel from the trigger into the
997
+ * tooltip's own content. Re-hovering (or re-focusing) the trigger while the
998
+ * bubble is still fading out reverses the fade from where it is, without
999
+ * waiting out `delay` again, since it is already on screen; so does moving
1000
+ * the pointer back into an `interactive` bubble. A non-interactive bubble is
1001
+ * `pointer-events-none` throughout, fade-out included, so it never
1002
+ * intercepts clicks meant for what sits under it. Pass `whenTruncated` to
1003
+ * only surface it once the trigger's content
983
1004
  * is actually clipped by ellipsis (`scrollWidth > clientWidth`). `placement`
984
1005
  * 'top'/'bottom' centre (or `align="start"` left-align) on the trigger;
985
1006
  * 'right' centres vertically beside the anchor and 'bottom-end' hangs below,
@@ -1392,9 +1413,20 @@ declare const buttonVariants: (props?: ({
1392
1413
  size?: "icon" | "sm" | "md" | "lg" | null | undefined;
1393
1414
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1394
1415
  interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
1395
- /** Render the button styling onto the single child element instead of a `<button>` (e.g. a router `<Link>`). */
1416
+ /**
1417
+ * Render the button styling onto the single child element instead of a
1418
+ * `<button>` (e.g. a router `<Link>` or an `<a>`). The child must be exactly
1419
+ * one React element; it keeps its own tag, content and semantics.
1420
+ */
1396
1421
  asChild?: boolean;
1397
- /** Shows a spinner in place of the leading edge and disables the button. */
1422
+ /**
1423
+ * Shows a spinner in place of the leading edge and disables the button.
1424
+ * With `asChild` there is no spinner (the child owns its content, and a
1425
+ * spinner belongs inside a real `<button>`): `loading` only sets
1426
+ * `aria-busy` and forwards `disabled` to the child, which only has an
1427
+ * effect on elements that support it -- an `<a>` stays clickable, so block
1428
+ * navigation yourself while loading.
1429
+ */
1398
1430
  loading?: boolean;
1399
1431
  /** Button label and/or icon. With `asChild`, the single element that receives the button styling. */
1400
1432
  children?: ReactNode;
@@ -1420,8 +1452,13 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantPr
1420
1452
  * but Button suppresses it (`focus-visible:outline-hidden focus-visible:ring-0`)
1421
1453
  * and relies on its per-variant hover/brightness treatment instead. `loading`
1422
1454
  * implies `disabled` (and sets `aria-busy`), since a control mid-submit
1423
- * shouldn't accept another click.
1424
- * @a11y Renders a native <button>, so it keeps native keyboard behaviour.
1455
+ * shouldn't accept another click. `asChild` renders only the child element,
1456
+ * through Radix `Slot`, with the button classes, ref and remaining props
1457
+ * merged onto it -- no wrapping `<button>`. With `asChild`, `loading` draws
1458
+ * no spinner; it sets `aria-busy` and forwards `disabled`, which an `<a>`
1459
+ * ignores, so a loading link stays clickable unless the caller blocks it.
1460
+ * @a11y Renders a native <button>, so it keeps native keyboard behaviour
1461
+ * (with `asChild`, the child element's own semantics apply instead).
1425
1462
  * `loading` sets aria-busy, and the spinner is aria-hidden. Icon-only
1426
1463
  * usage needs an aria-label from the caller -- nothing here supplies one.
1427
1464
  * @usage
@@ -1430,6 +1467,7 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantPr
1430
1467
  * <Button variant="secondary" size="sm">Cancel</Button>
1431
1468
  * <Button variant="danger">Delete</Button>
1432
1469
  * <Button variant="primary" loading>Saving…</Button>
1470
+ * <Button asChild variant="secondary"><a href="/reports">View reports</a></Button>
1433
1471
  * ```
1434
1472
  */
1435
1473
  declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
package/dist/index.d.ts CHANGED
@@ -163,6 +163,14 @@ interface BadgeProps {
163
163
  tone?: BadgeTone;
164
164
  /** Shape and case. `count` for a number, `eyebrow` for a category label. */
165
165
  kind?: BadgeKind;
166
+ /**
167
+ * Draws a small filled dot before the label, in the tone's own ink. For a
168
+ * status that is scanned down a column rather than read -- the dot is what
169
+ * the eye follows, and it carries the colour at a size the text cannot.
170
+ * Purely decorative: the label is the accessible content, so the dot is
171
+ * hidden from assistive tech rather than announced as a second thing.
172
+ */
173
+ dot?: boolean;
166
174
  /** Text, or an icon plus text. Keep it to a few words -- a badge annotates, it does not explain. */
167
175
  children: ReactNode;
168
176
  className?: string;
@@ -176,8 +184,9 @@ interface BadgeProps {
176
184
  * @props
177
185
  * tone?: 'neutral' | 'brand' | 'brandSolid' | 'success' | 'warning' | 'danger' | 'ai' | 'overlay' (default 'neutral')
178
186
  * kind?: 'label' | 'count' | 'eyebrow' (default 'label')
187
+ * dot?: boolean (default false) -- a filled dot before the label, in the tone's ink
179
188
  * children: ReactNode
180
- * @tokens text-micro, rounded-full, bg-subtle, bg-brand-primarySoft, bg-brand-primaryAction,
189
+ * @tokens text-micro, rounded-full, bg-current, bg-subtle, bg-brand-primarySoft, bg-brand-primaryAction,
181
190
  * bg-status-success/15, bg-status-warning/30, bg-status-danger/15, bg-scrim,
182
191
  * text-text-secondary, text-brand-primaryAction, text-text-success,
183
192
  * text-text-warning, text-text-danger, text-ai-ontint, text-brand-onprimary,
@@ -213,11 +222,12 @@ interface BadgeProps {
213
222
  * <Badge>Financial Services</Badge>
214
223
  * <Badge tone="brandSolid" kind="count">{activeFilters}</Badge>
215
224
  * <Badge tone="warning">Partial month</Badge>
225
+ * <Badge tone="success" dot>Completed</Badge>
216
226
  * <Badge kind="eyebrow" tone="neutral">Saved view</Badge>
217
227
  * <Badge tone="brand"><Check size={11} aria-hidden="true" />Primary</Badge>
218
228
  * ```
219
229
  */
220
- declare function Badge({ tone, kind, children, className }: BadgeProps): react.JSX.Element;
230
+ declare function Badge({ tone, kind, dot, children, className }: BadgeProps): react.JSX.Element;
221
231
 
222
232
  /**
223
233
  * @pattern CheckBox
@@ -968,18 +978,29 @@ declare function StackedColumnPlaceholder({ height, width, legendRows, axis, }:
968
978
  * escapes both `overflow` clipping inside scrollable panels and the broken
969
979
  * `fixed` containing block a transformed ancestor creates.
970
980
  * @tokens rounded-control, border-border-default, bg-surface, shadow-overlay,
971
- * text-text-primary, bg-text-primary, text-surface
981
+ * text-text-primary, bg-text-primary, text-surface,
982
+ * duration-(--mr-motion-duration-interactive)
972
983
  * @variant surface - Default. Themed surface/border bubble -- matches the
973
984
  * Recharts chart tooltips this was originally built for.
974
985
  * @variant inverted - Solid dark pill (no border) -- for a tooltip sitting
975
986
  * over a nav rail or other icon-only surface, where the themed surface bubble
976
987
  * doesn't read as clearly against a busy background.
977
988
  * @behavior Shows on hover and on keyboard focus (so it stays reachable
978
- * without a pointer) after `delay` ms (0 = immediate, the default). Hides
979
- * immediately on mouseleave/blur, cancelling a pending delayed show if it
980
- * hasn't fired yet -- except in `interactive` mode, which delays the hide
981
- * briefly so the pointer can travel from the trigger into the tooltip's own
982
- * content. Pass `whenTruncated` to only surface it once the trigger's content
989
+ * without a pointer) after `delay` ms (0 = immediate, the default). Fades in
990
+ * and out (opacity, `ease-in-out`, over the sys
991
+ * `--mr-motion-duration-interactive` token -- 200ms today); the bubble stays
992
+ * mounted through the fade-out and is removed from the DOM once it ends.
993
+ * Under `prefers-reduced-motion: reduce` there is no fade: it appears and is
994
+ * removed instantly. The hide starts on mouseleave/blur, cancelling a pending
995
+ * delayed show if it hasn't fired yet -- except in `interactive` mode, which
996
+ * delays the hide briefly so the pointer can travel from the trigger into the
997
+ * tooltip's own content. Re-hovering (or re-focusing) the trigger while the
998
+ * bubble is still fading out reverses the fade from where it is, without
999
+ * waiting out `delay` again, since it is already on screen; so does moving
1000
+ * the pointer back into an `interactive` bubble. A non-interactive bubble is
1001
+ * `pointer-events-none` throughout, fade-out included, so it never
1002
+ * intercepts clicks meant for what sits under it. Pass `whenTruncated` to
1003
+ * only surface it once the trigger's content
983
1004
  * is actually clipped by ellipsis (`scrollWidth > clientWidth`). `placement`
984
1005
  * 'top'/'bottom' centre (or `align="start"` left-align) on the trigger;
985
1006
  * 'right' centres vertically beside the anchor and 'bottom-end' hangs below,
@@ -1392,9 +1413,20 @@ declare const buttonVariants: (props?: ({
1392
1413
  size?: "icon" | "sm" | "md" | "lg" | null | undefined;
1393
1414
  } & class_variance_authority_types.ClassProp) | undefined) => string;
1394
1415
  interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
1395
- /** Render the button styling onto the single child element instead of a `<button>` (e.g. a router `<Link>`). */
1416
+ /**
1417
+ * Render the button styling onto the single child element instead of a
1418
+ * `<button>` (e.g. a router `<Link>` or an `<a>`). The child must be exactly
1419
+ * one React element; it keeps its own tag, content and semantics.
1420
+ */
1396
1421
  asChild?: boolean;
1397
- /** Shows a spinner in place of the leading edge and disables the button. */
1422
+ /**
1423
+ * Shows a spinner in place of the leading edge and disables the button.
1424
+ * With `asChild` there is no spinner (the child owns its content, and a
1425
+ * spinner belongs inside a real `<button>`): `loading` only sets
1426
+ * `aria-busy` and forwards `disabled` to the child, which only has an
1427
+ * effect on elements that support it -- an `<a>` stays clickable, so block
1428
+ * navigation yourself while loading.
1429
+ */
1398
1430
  loading?: boolean;
1399
1431
  /** Button label and/or icon. With `asChild`, the single element that receives the button styling. */
1400
1432
  children?: ReactNode;
@@ -1420,8 +1452,13 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantPr
1420
1452
  * but Button suppresses it (`focus-visible:outline-hidden focus-visible:ring-0`)
1421
1453
  * and relies on its per-variant hover/brightness treatment instead. `loading`
1422
1454
  * implies `disabled` (and sets `aria-busy`), since a control mid-submit
1423
- * shouldn't accept another click.
1424
- * @a11y Renders a native <button>, so it keeps native keyboard behaviour.
1455
+ * shouldn't accept another click. `asChild` renders only the child element,
1456
+ * through Radix `Slot`, with the button classes, ref and remaining props
1457
+ * merged onto it -- no wrapping `<button>`. With `asChild`, `loading` draws
1458
+ * no spinner; it sets `aria-busy` and forwards `disabled`, which an `<a>`
1459
+ * ignores, so a loading link stays clickable unless the caller blocks it.
1460
+ * @a11y Renders a native <button>, so it keeps native keyboard behaviour
1461
+ * (with `asChild`, the child element's own semantics apply instead).
1425
1462
  * `loading` sets aria-busy, and the spinner is aria-hidden. Icon-only
1426
1463
  * usage needs an aria-label from the caller -- nothing here supplies one.
1427
1464
  * @usage
@@ -1430,6 +1467,7 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, VariantPr
1430
1467
  * <Button variant="secondary" size="sm">Cancel</Button>
1431
1468
  * <Button variant="danger">Delete</Button>
1432
1469
  * <Button variant="primary" loading>Saving…</Button>
1470
+ * <Button asChild variant="secondary"><a href="/reports">View reports</a></Button>
1433
1471
  * ```
1434
1472
  */
1435
1473
  declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;