@r2digisolutions/components 0.19.0 → 0.19.2

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.
@@ -40,9 +40,33 @@
40
40
  badge
41
41
  }: Props = $props();
42
42
 
43
+ const TAG_PRIORITY: StoreProductTag[] = ['featured', 'new', 'popular'];
44
+
43
45
  const visibleTags = $derived(
44
46
  tags.filter((t): t is StoreProductTag => t === 'new' || t === 'featured' || t === 'popular')
45
47
  );
48
+
49
+ /** Max 2 chips so the promo header stays one row. */
50
+ const displayTags = $derived(
51
+ TAG_PRIORITY.filter((t) => visibleTags.includes(t)).slice(0, installed ? 1 : 2)
52
+ );
53
+
54
+ function tagVariant(tag: StoreProductTag): 'info' | 'warning' | 'default' {
55
+ if (tag === 'new') return 'info';
56
+ // Featured uses custom amber + white via tagClass (avoid warning’s amber text).
57
+ if (tag === 'featured') return 'default';
58
+ return 'default';
59
+ }
60
+
61
+ function tagClass(tag: StoreProductTag): string {
62
+ if (tag === 'featured') {
63
+ return '!border-0 !bg-amber-500 !text-white dark:!bg-amber-500 dark:!text-white';
64
+ }
65
+ if (tag === 'popular') {
66
+ return 'border-0 bg-neutral-100 text-neutral-700 dark:bg-neutral-800 dark:text-neutral-200';
67
+ }
68
+ return '';
69
+ }
46
70
  </script>
47
71
 
48
72
  <button
@@ -54,16 +78,13 @@
54
78
  {#if featured}
55
79
  <div class="ms-tile__promo bg-gradient-to-br {accentClass}">
56
80
  <div class="ms-tile__promo-mesh" aria-hidden="true"></div>
57
- {#if visibleTags.length || installed || badge}
81
+ {#if displayTags.length || installed || badge}
58
82
  <div class="ms-tile__tags">
59
83
  {#if badge}
60
84
  {@render badge()}
61
85
  {:else}
62
- {#each visibleTags as tag (tag)}
63
- <Badge
64
- variant={tag === 'new' ? 'info' : tag === 'featured' ? 'primary' : 'secondary'}
65
- size="sm"
66
- >
86
+ {#each displayTags as tag (tag)}
87
+ <Badge variant={tagVariant(tag)} size="sm" class={tagClass(tag)}>
67
88
  {TAG_LABELS[tag]}
68
89
  </Badge>
69
90
  {/each}
@@ -93,17 +114,14 @@
93
114
  <div class="ms-tile__icon-shine" aria-hidden="true"></div>
94
115
  <Icon class="relative size-9 text-white drop-shadow-sm sm:size-10" />
95
116
  </div>
96
- {#if visibleTags[0]}
117
+ {#if displayTags[0]}
97
118
  <span class="ms-tile__corner">
98
119
  <Badge
99
- variant={visibleTags[0] === 'new'
100
- ? 'info'
101
- : visibleTags[0] === 'featured'
102
- ? 'primary'
103
- : 'secondary'}
120
+ variant={tagVariant(displayTags[0])}
104
121
  size="sm"
122
+ class={tagClass(displayTags[0])}
105
123
  >
106
- {TAG_LABELS[visibleTags[0]]}
124
+ {TAG_LABELS[displayTags[0]]}
107
125
  </Badge>
108
126
  </span>
109
127
  {:else if installed}
@@ -275,9 +293,11 @@
275
293
  left: 0.75rem;
276
294
  z-index: 2;
277
295
  display: flex;
278
- flex-wrap: wrap;
296
+ flex-wrap: nowrap;
297
+ align-items: center;
279
298
  gap: 0.35rem;
280
299
  max-width: calc(100% - 5.5rem);
300
+ overflow: hidden;
281
301
  }
282
302
  .ms-tile__promo-copy {
283
303
  position: relative;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r2digisolutions/components",
3
- "version": "0.19.0",
3
+ "version": "0.19.2",
4
4
  "private": false,
5
5
  "description": "R2DigiSolutions Svelte 5 component library — Atomic Design, Tailwind 4, Light/Dark mode",
6
6
  "license": "MIT",