@placeholderco/placeholder-ui 3.1.2 → 3.1.3

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.
@@ -17,6 +17,8 @@ export interface ComboBoxItem {
17
17
  groupName?: string;
18
18
  imageSrc?: string;
19
19
  description?: string;
20
+ /** Tooltip text shown on hover/focus (used by Tabs) */
21
+ tooltip?: string;
20
22
  /** Shows the option but prevents it from being selected */
21
23
  disabled?: boolean;
22
24
  /** Marks a synthetic "add new value" suggestion (see Autocomplete) */
@@ -318,6 +318,30 @@
318
318
  --badge-hover-text-color: var(--ui-primary-contrast-color);
319
319
  --badge-outline-color: var(--ui-focus-color);
320
320
  }
321
+
322
+ .primary-outline {
323
+ --badge-text-color: var(--text-color);
324
+ --badge-border: 1px solid var(--text-color);
325
+ --badge-border-color: var(--text-color);
326
+ }
327
+
328
+ .accent-outline {
329
+ --badge-text-color: var(--ui-accent);
330
+ --badge-border: 1px solid var(--ui-accent);
331
+ --badge-border-color: var(--ui-accent);
332
+ }
333
+
334
+ .tertiary-subtle {
335
+ --badge-text-color: var(--ui-tertiary);
336
+ --badge-border-color: var(--ui-tertiary);
337
+ --badge-bg-color: color-mix(in srgb, var(--ui-tertiary) 20%, transparent);
338
+ }
339
+
340
+ .tertiary-outline {
341
+ --badge-text-color: var(--ui-tertiary);
342
+ --badge-border: 1px solid var(--ui-tertiary);
343
+ --badge-border-color: var(--ui-tertiary);
344
+ }
321
345
  }
322
346
 
323
347
  .disabled {
@@ -1,22 +1,32 @@
1
1
  <script lang="ts">
2
2
  import type { ComboBoxItem } from '../models/ComboBoxItem.js';
3
+ import Tooltip, { type TooltipLocation } from './Tooltip.svelte';
3
4
  import { onMount } from 'svelte';
4
5
 
5
6
  export interface TabsProps {
6
7
  /**
7
8
  * Available tab options. `class` is added to the tab button (style it with `:global()`),
8
- * and a divider is drawn between neighbouring tabs whose `groupName` differs
9
+ * a divider is drawn between neighbouring tabs whose `groupName` differs, and `tooltip`
10
+ * is shown on hover/focus
9
11
  */
10
12
  tabOptions: ComboBoxItem[];
11
13
  /** Currently active tab value (bindable) */
12
14
  activeTab?: string;
13
15
  /** Use solid background instead of transparent */
14
16
  solidBg?: boolean;
17
+ /** Preferred position of tab tooltips */
18
+ tooltipLocation?: TooltipLocation;
15
19
  /** Callback when active tab changes */
16
20
  onchange?: (newValue: string) => void;
17
21
  }
18
22
 
19
- let { tabOptions, activeTab = $bindable(''), solidBg = false, onchange }: TabsProps = $props();
23
+ let {
24
+ tabOptions,
25
+ activeTab = $bindable(''),
26
+ solidBg = false,
27
+ tooltipLocation = 'top',
28
+ onchange
29
+ }: TabsProps = $props();
20
30
  let containerRef: HTMLDivElement;
21
31
  let scrollRef: HTMLDivElement;
22
32
  let buttonElements = $state<HTMLButtonElement[]>([]);
@@ -91,15 +101,25 @@
91
101
  {#if index > 0 && (option.groupName ?? '') !== (tabOptions[index - 1].groupName ?? '')}
92
102
  <span class="tab-divider" aria-hidden="true"></span>
93
103
  {/if}
94
- <button
95
- type="button"
96
- bind:this={buttonElements[index]}
97
- class="tab-item {isSelected ? 'selected' : ''} {solidBg ? 'solid' : ''} {option.class ??
98
- ''}"
99
- onclick={() => setValue(option.value)}
100
- >
101
- {option.label}
102
- </button>
104
+ {#snippet tabButton()}
105
+ <button
106
+ type="button"
107
+ bind:this={buttonElements[index]}
108
+ class="tab-item {isSelected ? 'selected' : ''} {solidBg ? 'solid' : ''} {option.class ??
109
+ ''}"
110
+ onclick={() => setValue(option.value)}
111
+ >
112
+ {option.label}
113
+ </button>
114
+ {/snippet}
115
+
116
+ {#if option.tooltip}
117
+ <Tooltip text={option.tooltip} location={tooltipLocation}>
118
+ {@render tabButton()}
119
+ </Tooltip>
120
+ {:else}
121
+ {@render tabButton()}
122
+ {/if}
103
123
  {/each}
104
124
  <div class="tab-underline" style={underlineStyle}></div>
105
125
  </div>
@@ -121,6 +141,13 @@
121
141
  user-select: none;
122
142
  }
123
143
 
144
+ /* Tooltip wrappers are inline-block; flex keeps the button flush with the bar */
145
+ .tabs > :global(.tooltip-v2-container),
146
+ .tabs > :global(.tooltip-v2-container > .tooltip-v2-trigger) {
147
+ display: flex;
148
+ flex-shrink: 0;
149
+ }
150
+
124
151
  .tab-item {
125
152
  position: relative;
126
153
  display: flex;
@@ -1,14 +1,18 @@
1
1
  import type { ComboBoxItem } from '../models/ComboBoxItem.js';
2
+ import { type TooltipLocation } from './Tooltip.svelte';
2
3
  export interface TabsProps {
3
4
  /**
4
5
  * Available tab options. `class` is added to the tab button (style it with `:global()`),
5
- * and a divider is drawn between neighbouring tabs whose `groupName` differs
6
+ * a divider is drawn between neighbouring tabs whose `groupName` differs, and `tooltip`
7
+ * is shown on hover/focus
6
8
  */
7
9
  tabOptions: ComboBoxItem[];
8
10
  /** Currently active tab value (bindable) */
9
11
  activeTab?: string;
10
12
  /** Use solid background instead of transparent */
11
13
  solidBg?: boolean;
14
+ /** Preferred position of tab tooltips */
15
+ tooltipLocation?: TooltipLocation;
12
16
  /** Callback when active tab changes */
13
17
  onchange?: (newValue: string) => void;
14
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@placeholderco/placeholder-ui",
3
- "version": "3.1.2",
3
+ "version": "3.1.3",
4
4
  "description": "A modern, customizable Svelte 5 UI component library with comprehensive theming support. Re-brand it with a single config object.",
5
5
  "license": "MIT",
6
6
  "author": "Placeholderco",