@mediaradar/design-components 0.46.0 → 0.47.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
@@ -224,7 +224,7 @@ interface BadgeProps extends CommonProps {
224
224
  tone?: BadgeTone;
225
225
  /**
226
226
  * Shape and case. `count` for a number, `eyebrow` for a small-caps label,
227
- * `category` for what a thing is (a topic, a category): always quiet grey,
227
+ * `category` for what a thing is (a topic, a category): quiet grey unless `highlight`,
228
228
  * `tone` is ignored.
229
229
  */
230
230
  kind?: BadgeKind;
@@ -236,6 +236,12 @@ interface BadgeProps extends CommonProps {
236
236
  * hidden from assistive tech rather than announced as a second thing.
237
237
  */
238
238
  dot?: boolean;
239
+ /**
240
+ * Only with `kind="category"`. Marks the one original or primary item in a
241
+ * set of versions -- "Original" among a creative's revisions -- in the pale
242
+ * brand tint instead of grey. At most one per set.
243
+ */
244
+ highlight?: boolean;
239
245
  /** Text, or an icon plus text. Keep it to a few words -- a badge annotates, it does not explain. */
240
246
  children: ReactNode;
241
247
  className?: string;
@@ -249,8 +255,9 @@ interface BadgeProps extends CommonProps {
249
255
  * between them cover every badge treatment in the product.
250
256
  * @props
251
257
  * tone?: 'neutral' | 'brand' | 'brandSolid' | 'success' | 'warning' | 'danger' | 'ai' | 'overlay' (default 'neutral')
252
- * kind?: 'label' | 'count' | 'eyebrow' | 'category' (default 'label') -- category is always grey, tone ignored
258
+ * kind?: 'label' | 'count' | 'eyebrow' | 'category' (default 'label') -- category is grey unless highlight, tone ignored
253
259
  * dot?: boolean (default false) -- a filled dot before the label, in the tone's ink
260
+ * highlight?: boolean (default false) -- with kind="category" only: pale brand tint for the one original/primary item in a set
254
261
  * children: ReactNode
255
262
  * @tokens text-micro, rounded-full, bg-current, bg-subtle, bg-brand-primarySoft, bg-brand-primaryAction,
256
263
  * bg-status-success/15, bg-status-warning/30, bg-status-danger/15, bg-scrim,
@@ -281,11 +288,16 @@ interface BadgeProps extends CommonProps {
281
288
  * has become a callout; use one.
282
289
  * @avoid when you are choosing the tone by colour rather than by meaning. A
283
290
  * red badge that does not mean failure teaches readers to ignore red.
291
+ * @use highlight on a category only to mark the one original or primary item
292
+ * in a set of versions, e.g. "Original" among a creative's revisions.
293
+ * @avoid highlight on more than one category in a set, or to make a category
294
+ * stand out for emphasis -- then nothing stands out.
284
295
  * @avoid when several sit in a row and all say something different -- that is
285
296
  * a definition list wearing badges, and reads as noise.
286
297
  * @usage
287
298
  * ```tsx
288
299
  * <Badge>Financial Services</Badge>
300
+ * <Badge kind="category" highlight>Original</Badge>
289
301
  * <Badge tone="brandSolid" kind="count">{activeFilters}</Badge>
290
302
  * <Badge tone="warning">Partial month</Badge>
291
303
  * <Badge tone="success" dot>Completed</Badge>
@@ -293,7 +305,7 @@ interface BadgeProps extends CommonProps {
293
305
  * <Badge tone="brand"><Check size={11} aria-hidden="true" />Primary</Badge>
294
306
  * ```
295
307
  */
296
- declare function Badge({ tone, kind, dot, children, className, testIdPrefix }: BadgeProps): react.JSX.Element;
308
+ declare function Badge({ tone, kind, dot, highlight, children, className, testIdPrefix }: BadgeProps): react.JSX.Element;
297
309
 
298
310
  interface DeltaProps extends CommonProps {
299
311
  /** The change itself. Its sign picks the direction; render the absolute value. */
package/dist/index.d.ts CHANGED
@@ -224,7 +224,7 @@ interface BadgeProps extends CommonProps {
224
224
  tone?: BadgeTone;
225
225
  /**
226
226
  * Shape and case. `count` for a number, `eyebrow` for a small-caps label,
227
- * `category` for what a thing is (a topic, a category): always quiet grey,
227
+ * `category` for what a thing is (a topic, a category): quiet grey unless `highlight`,
228
228
  * `tone` is ignored.
229
229
  */
230
230
  kind?: BadgeKind;
@@ -236,6 +236,12 @@ interface BadgeProps extends CommonProps {
236
236
  * hidden from assistive tech rather than announced as a second thing.
237
237
  */
238
238
  dot?: boolean;
239
+ /**
240
+ * Only with `kind="category"`. Marks the one original or primary item in a
241
+ * set of versions -- "Original" among a creative's revisions -- in the pale
242
+ * brand tint instead of grey. At most one per set.
243
+ */
244
+ highlight?: boolean;
239
245
  /** Text, or an icon plus text. Keep it to a few words -- a badge annotates, it does not explain. */
240
246
  children: ReactNode;
241
247
  className?: string;
@@ -249,8 +255,9 @@ interface BadgeProps extends CommonProps {
249
255
  * between them cover every badge treatment in the product.
250
256
  * @props
251
257
  * tone?: 'neutral' | 'brand' | 'brandSolid' | 'success' | 'warning' | 'danger' | 'ai' | 'overlay' (default 'neutral')
252
- * kind?: 'label' | 'count' | 'eyebrow' | 'category' (default 'label') -- category is always grey, tone ignored
258
+ * kind?: 'label' | 'count' | 'eyebrow' | 'category' (default 'label') -- category is grey unless highlight, tone ignored
253
259
  * dot?: boolean (default false) -- a filled dot before the label, in the tone's ink
260
+ * highlight?: boolean (default false) -- with kind="category" only: pale brand tint for the one original/primary item in a set
254
261
  * children: ReactNode
255
262
  * @tokens text-micro, rounded-full, bg-current, bg-subtle, bg-brand-primarySoft, bg-brand-primaryAction,
256
263
  * bg-status-success/15, bg-status-warning/30, bg-status-danger/15, bg-scrim,
@@ -281,11 +288,16 @@ interface BadgeProps extends CommonProps {
281
288
  * has become a callout; use one.
282
289
  * @avoid when you are choosing the tone by colour rather than by meaning. A
283
290
  * red badge that does not mean failure teaches readers to ignore red.
291
+ * @use highlight on a category only to mark the one original or primary item
292
+ * in a set of versions, e.g. "Original" among a creative's revisions.
293
+ * @avoid highlight on more than one category in a set, or to make a category
294
+ * stand out for emphasis -- then nothing stands out.
284
295
  * @avoid when several sit in a row and all say something different -- that is
285
296
  * a definition list wearing badges, and reads as noise.
286
297
  * @usage
287
298
  * ```tsx
288
299
  * <Badge>Financial Services</Badge>
300
+ * <Badge kind="category" highlight>Original</Badge>
289
301
  * <Badge tone="brandSolid" kind="count">{activeFilters}</Badge>
290
302
  * <Badge tone="warning">Partial month</Badge>
291
303
  * <Badge tone="success" dot>Completed</Badge>
@@ -293,7 +305,7 @@ interface BadgeProps extends CommonProps {
293
305
  * <Badge tone="brand"><Check size={11} aria-hidden="true" />Primary</Badge>
294
306
  * ```
295
307
  */
296
- declare function Badge({ tone, kind, dot, children, className, testIdPrefix }: BadgeProps): react.JSX.Element;
308
+ declare function Badge({ tone, kind, dot, highlight, children, className, testIdPrefix }: BadgeProps): react.JSX.Element;
297
309
 
298
310
  interface DeltaProps extends CommonProps {
299
311
  /** The change itself. Its sign picks the direction; render the absolute value. */
package/dist/index.js CHANGED
@@ -557,12 +557,13 @@ var KIND = {
557
557
  // are harder to read than the sentence case they replaced.
558
558
  eyebrow: "px-2.5 py-1 uppercase tracking-wider",
559
559
  // What a thing IS (a topic, a category) rather than a signal about it.
560
- // Always the same quiet grey whatever `tone` says: colour here would read
560
+ // Quiet grey whatever `tone` says (only `highlight` changes it): colour here would read
561
561
  // as meaning, and a category has none. This is the old Tag.
562
562
  category: "px-2 py-1"
563
563
  };
564
564
  var CATEGORY = "bg-subtle font-medium text-text-tertiary";
565
- function Badge({ tone = "neutral", kind = "label", dot = false, children, className, testIdPrefix }) {
565
+ var CATEGORY_HIGHLIGHT = "bg-brand-primarySoft font-semibold text-brand-primaryAction";
566
+ function Badge({ tone = "neutral", kind = "label", dot = false, highlight = false, children, className, testIdPrefix }) {
566
567
  return /* @__PURE__ */ jsxs5(
567
568
  "span",
568
569
  {
@@ -574,7 +575,7 @@ function Badge({ tone = "neutral", kind = "label", dot = false, children, classN
574
575
  // badge is almost always beside flexible text that would otherwise
575
576
  // squash it. `whitespace-nowrap` because a wrapped badge is a bug.
576
577
  "inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded-full text-micro leading-none",
577
- kind === "category" ? CATEGORY : cn("font-semibold", TONE[tone]),
578
+ kind === "category" ? highlight ? CATEGORY_HIGHLIGHT : CATEGORY : cn("font-semibold", TONE[tone]),
578
579
  KIND[kind],
579
580
  className
580
581
  ),