# `ixfx-tooltip`

A tooltip component that renders a value with optional icon and formatted number display. Uses native render root (no shadow DOM).

```html
<ixfx-tooltip value="42" orientation="top"></ixfx-tooltip>
<ixfx-tooltip value="3.14159" icon="pi"></ixfx-tooltip>
<ixfx-tooltip value="error" icon="<svg>...</svg>" orientation="bottom"></ixfx-tooltip>
```

### Properties / attributes

| Attribute / Property | Type                           | Default                   | Description                   |
|----------------------|--------------------------------|---------------------------|-------------------------------|
| `value`              | `unknown`                      | `undefined`               | Value to display              |
| `orientation`        | `'top' \| 'right' \| 'bottom' \| 'left'` | `'top'` | Popover orientation |
| `anchor`             | `string`                       | `'--tooltip'`             | CSS anchor name               |
| `icon`               | `string \| undefined`          | `undefined`               | Icon name or raw SVG string   |

### Value formatting

Numbers are formatted using `valueFormatTooltip`:
- Integers display as-is
- Floats display with 2 decimal places
- Strings display as-is
- Other values are JSON-stringified

### Static properties

| Property              | Type                    | Description                    |
|-----------------------|-------------------------|--------------------------------|
| `numberFormatter`     | `(v: number) => string` | Formats number for display     |
| `defaultFormatter`    | `FormatValueForHuman`   | Default value formatter        |

### Instance properties

| Property              | Type                    | Description                    |
|-----------------------|-------------------------|--------------------------------|
| `valueFormatTooltip`  | `FormatValueForHuman`   | Instance formatter, adjustable |

### CSS custom properties

| Property   | Default | Description       |
|------------|---------|-------------------|
| `--anchor-id` | set dynamically | CSS anchor for positioning |

### CSS classes

The component applies these classes to the output element:
- `tooltip`
- `tooltip-orientation-{top|right|bottom|left}`
- `tooltip-type-text` or `tooltip-type-number`
- `tooltip-style-bubble`

### Usage notes

- `renderRenderRoot` returns `this` (light DOM), allowing CSS from parent to style the tooltip
- For native CSS anchor positioning, set `anchor` to a unique CSS custom property name
- Can be used as an overlay element positioned via CSS Anchor Positioning API

---

# `ixfx-value-drag`

A vertical drag handle for adjusting numeric values. Drag up/down to change value; click the slot to activate an editor.

```html
<ixfx-value-drag min="0" max="100" value="50"></ixfx-value-drag>
```

### Properties / attributes

| Attribute / Property | Type                   | Default    | Description                                  |
|---------------------|------------------------|------------|----------------------------------------------|
| `min`              | `number`               | `0`        | Minimum value                                |
| `max`              | `number`               | `1`        | Maximum value                                |
| `value`            | `number`               | `0.5`      | Current value                                |
| `sensitivity`      | `number`               | `0.3`      | Screen percentage needed to reach min/max     |
| `disabled`         | `boolean`              | `false`    | Disables interaction                         |
| `numberConverter`  | `(v: number) => number`| `Math.floor` | Converts the raw value                      |

### Events

| Event    | Detail                    | Description                            |
|----------|---------------------------|----------------------------------------|
| `input`  | `{ value: number }`      | Fired continuously during drag         |
| `change` | `{ value: number }`      | Fired when drag ends                   |

### Usage

```js
const drag = document.querySelector('ixfx-value-drag');
drag.min = 0;
drag.max = 255;
drag.value = 128;

// Listen for changes
drag.addEventListener('change', e => {
  console.log('final value:', e.detail.value);
});

// Listen during drag
drag.addEventListener('input', e => {
  console.log('current value:', e.detail.value);
});
```

### Custom value conversion

By default, values are floored to integers. Provide a custom converter:

```js
drag.numberConverter = v => Math.round(v);  // Round instead of floor
drag.numberConverter = v => v.toFixed(2); // Keep 2 decimal places (returns string!)
```

### CSS custom properties

| Property   | Default | Description       |
|------------|---------|-------------------|
| --surface-3 | `#ccc` | Background color |
| --surface-text | `#000` | Text color |