@ixfx/components 0.5.5 → 0.5.7
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/bundle/index.d.ts +60 -1
- package/bundle/index.d.ts.map +1 -1
- package/bundle/index.js +328 -10
- package/bundle/index.js.map +1 -1
- package/dist/ac-text.d.ts +4 -1
- package/dist/ac-text.d.ts.map +1 -1
- package/dist/ac-text.js +34 -5
- package/dist/ac-text.js.map +1 -1
- package/dist/{button-CTE8crYn.js → button-CU8eLcxB.js} +15 -1
- package/dist/button-CU8eLcxB.js.map +1 -0
- package/dist/button.d.ts +2 -1
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +1 -1
- package/dist/{colour-picker-C3Ag4uh-.js → colour-picker-Bb795sjX.js} +2 -2
- package/dist/{colour-picker-C3Ag4uh-.js.map → colour-picker-Bb795sjX.js.map} +1 -1
- package/dist/colour-picker.d.ts +1 -1
- package/dist/colour-picker.js +1 -1
- package/dist/crumbs.d.ts +1 -1
- package/dist/crumbs.js +1 -1
- package/dist/{icon-DpA9x2Ve.d.ts → icon-BUwP1CZ1.d.ts} +2 -2
- package/dist/icon-BUwP1CZ1.d.ts.map +1 -0
- package/dist/icons.d.ts +2 -2
- package/dist/{index-DfEkTGvT.d.ts → index-B1UKcA7l.d.ts} +3 -3
- package/dist/{index-DfEkTGvT.d.ts.map → index-B1UKcA7l.d.ts.map} +1 -1
- package/dist/{index-D_ftz_IT.d.ts → index-BKAlRgbq.d.ts} +2 -2
- package/dist/{index-D_ftz_IT.d.ts.map → index-BKAlRgbq.d.ts.map} +1 -1
- package/dist/{index-CoqtMSd9.d.ts → index-BUB5SICW.d.ts} +2 -2
- package/dist/{index-CoqtMSd9.d.ts.map → index-BUB5SICW.d.ts.map} +1 -1
- package/dist/{index-BtGFYfaK.d.ts → index-RqMh1i-O.d.ts} +2 -2
- package/dist/{index-BtGFYfaK.d.ts.map → index-RqMh1i-O.d.ts.map} +1 -1
- package/dist/index.d.ts +64 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +279 -6
- package/dist/index.js.map +1 -1
- package/dist/{labelled-input-base-DiTme1JO.d.ts → labelled-input-base-Dp_9KP0G.d.ts} +2 -2
- package/dist/{labelled-input-base-DiTme1JO.d.ts.map → labelled-input-base-Dp_9KP0G.d.ts.map} +1 -1
- package/dist/labelled-radial-input.d.ts +2 -2
- package/dist/labelled-radial-input.d.ts.map +1 -1
- package/dist/labelled-range-input.d.ts +1 -1
- package/dist/{menu-xPpzkoiW.js → menu-BYyeCAF7.js} +2 -2
- package/dist/{menu-xPpzkoiW.js.map → menu-BYyeCAF7.js.map} +1 -1
- package/dist/{menu-item-CFy8e3G_.js → menu-item-BttvL89f.js} +2 -2
- package/dist/{menu-item-CFy8e3G_.js.map → menu-item-BttvL89f.js.map} +1 -1
- package/dist/{menu-item-DSyf9f_L.d.ts → menu-item-CQ4Qg731.d.ts} +2 -2
- package/dist/{menu-item-DSyf9f_L.d.ts.map → menu-item-CQ4Qg731.d.ts.map} +1 -1
- package/dist/menu.d.ts +2 -2
- package/dist/menu.js +2 -2
- package/dist/panel.d.ts +1 -1
- package/dist/{popup-DiWMxsWj.js → popup-D80sj2QC.js} +5 -3
- package/dist/popup-D80sj2QC.js.map +1 -0
- package/dist/{tab-list-BohmbvqF.d.ts → tab-list-VtWT-_FG.d.ts} +2 -2
- package/dist/{tab-list-BohmbvqF.d.ts.map → tab-list-VtWT-_FG.d.ts.map} +1 -1
- package/dist/tabs.d.ts +1 -1
- package/docs-user/README.md +1 -0
- package/docs-user/button.md +2 -0
- package/docs-user/snackbar.md +94 -0
- package/package.json +1 -1
- package/dist/button-CTE8crYn.js.map +0 -1
- package/dist/icon-DpA9x2Ve.d.ts.map +0 -1
- package/dist/popup-DiWMxsWj.js.map +0 -1
package/docs-user/README.md
CHANGED
|
@@ -31,6 +31,7 @@ This directory contains documentation for each component and some architectural
|
|
|
31
31
|
- [range-input](./range-input.md)
|
|
32
32
|
- [selecthorizontal](./selecthorizontal.md)
|
|
33
33
|
- [slider-input](./slider-input.md)
|
|
34
|
+
- [snackbar](./snackbar.md)
|
|
34
35
|
- [snap-container](./snap-container.md)
|
|
35
36
|
- [split-layout](./split-layout.md)
|
|
36
37
|
- [swipe](./swipe.md)
|
package/docs-user/button.md
CHANGED
|
@@ -15,6 +15,7 @@ Three related button components:
|
|
|
15
15
|
<ixfx-button icon="check">Commit</ixfx-button>
|
|
16
16
|
<ixfx-button icon="check" hide-label>Commit</ixfx-button>
|
|
17
17
|
<ixfx-button disabled>Unavailable</ixfx-button>
|
|
18
|
+
<ixfx-button subtle>Subtle</ixfx-button>
|
|
18
19
|
```
|
|
19
20
|
|
|
20
21
|
### Properties / attributes
|
|
@@ -25,6 +26,7 @@ Three related button components:
|
|
|
25
26
|
| `icon` | string | — | Registered icon name **or** raw `<svg>` string |
|
|
26
27
|
| `hide-icon` | boolean | `false` | Hides the icon even when `icon` is set |
|
|
27
28
|
| `hide-label` | boolean | `false` | Hides the text label (useful for icon-only buttons)|
|
|
29
|
+
| `subtle` | boolean | `false` | Renders the background at 40% opacity, raised to 70% on hover/focus |
|
|
28
30
|
|
|
29
31
|
### Slots
|
|
30
32
|
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Snackbar
|
|
2
|
+
|
|
3
|
+
A small floating toolbar anchored in visual proximity to another element on the page (the "target"), built on the native Popover and CSS Anchor Positioning APIs.
|
|
4
|
+
|
|
5
|
+
```html
|
|
6
|
+
<ixfx-snackbar for="something">
|
|
7
|
+
<button>Bold</button>
|
|
8
|
+
</ixfx-snackbar>
|
|
9
|
+
<div id="something">Hello</div>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The user sees "Hello". Clicking it shows the snackbar's toolbar anchored above it.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## `ixfx-snackbar`
|
|
17
|
+
|
|
18
|
+
Unlike `ixfx-menu-trigger` / `ixfx-colour-picker-popup`, the trigger is not slotted content inside the component — it's an external element referenced by `for`. The host element itself is the popover (`popover="auto"`); there's no inner wrapper div, since the entire slotted content is the panel.
|
|
19
|
+
|
|
20
|
+
### Properties / attributes
|
|
21
|
+
|
|
22
|
+
| Attribute / Property | Type | Default | Description |
|
|
23
|
+
|---|---|---|---|
|
|
24
|
+
| `for` | string | `''` | `id` of the target element to anchor to and attach interaction listeners on |
|
|
25
|
+
| `mode` | `'explicit'` \| `'manual'` \| `'implicit'` | `'explicit'` | How the snackbar is invoked (see below) |
|
|
26
|
+
| `placement` | `'top'` \| `'bottom'` \| `'left'` \| `'right'` | `'top'` | Which side of the target the panel appears on; reflected attribute |
|
|
27
|
+
| `dismiss` | `'auto'` \| `'manual'` | `'auto'` | Whether a click bubbling up from inside the snackbar closes it (see below) |
|
|
28
|
+
| `show-delay` | number (ms) | `150` | `implicit` mode only — debounce before showing once the target/panel is tickled |
|
|
29
|
+
| `hide-delay` | number (ms) | `500` | `implicit` mode only — delay before auto-hiding once the target/panel is no longer tickled |
|
|
30
|
+
|
|
31
|
+
### Modes
|
|
32
|
+
|
|
33
|
+
| Mode | Behavior |
|
|
34
|
+
|---|---|
|
|
35
|
+
| `explicit` | Clicking the target toggles the snackbar. If the target has no existing `tabindex`/focusability, `tabindex="0"` and `role="button"` are added so it's keyboard-operable too (removed again if `for` changes or the component disconnects). |
|
|
36
|
+
| `implicit` | Hovering or focusing the target shows the snackbar after `show-delay` ms (cancelled if the pointer/focus leaves before then, so a quick pass-over doesn't open it); it auto-hides `hide-delay` ms after the pointer/focus leaves, unless the pointer enters or focus moves into the panel itself first. |
|
|
37
|
+
| `manual` | No automatic listeners are attached to the target at all — only `.show()` / `.hide()` / `.toggle()` calls open or close it. |
|
|
38
|
+
|
|
39
|
+
In all three modes, native popover light-dismiss still applies: Escape or clicking outside closes the snackbar.
|
|
40
|
+
|
|
41
|
+
Only one `ixfx-snackbar` is ever open at a time on a page, regardless of how each was invoked — this comes for free from `popover="auto"` (every unrelated auto popover is closed as part of the platform's "show popover" algorithm whenever a new one shows), not from any bookkeeping in this component.
|
|
42
|
+
|
|
43
|
+
### Dismiss
|
|
44
|
+
|
|
45
|
+
| `dismiss` | Behavior |
|
|
46
|
+
|---|---|
|
|
47
|
+
| `auto` (default) | Any `click` event that bubbles up from inside the snackbar (e.g. clicking a toolbar button) closes it — the common "pick an action, panel closes" pattern. A control that needs to stay open after being clicked can call `event.stopPropagation()`. |
|
|
48
|
+
| `manual` | Clicks inside the snackbar are ignored; it's only closed by calling `.hide()` (or native light-dismiss — Escape / click-outside). |
|
|
49
|
+
|
|
50
|
+
This is independent of `mode` — it governs how the snackbar closes, not how it opens.
|
|
51
|
+
|
|
52
|
+
### Methods
|
|
53
|
+
|
|
54
|
+
- `show()`, `hide()`, `toggle()` — thin wrappers over the native `showPopover()`/`hidePopover()`/`togglePopover()`.
|
|
55
|
+
|
|
56
|
+
Because the popover is `auto`, clicking outside (or pressing Escape) closes it *before* the click that triggered the dismissal dispatches. `toggle()` accounts for this: if a light-dismiss close happened in the same click, the toggle is a no-op rather than immediately re-opening the snackbar — so a target/button that calls `.toggle()` still works as an open/close switch even though the trigger lives outside the popover.
|
|
57
|
+
|
|
58
|
+
### Getters
|
|
59
|
+
|
|
60
|
+
- `isOpen: boolean`
|
|
61
|
+
|
|
62
|
+
### Slots
|
|
63
|
+
|
|
64
|
+
| Slot | Description |
|
|
65
|
+
|---|---|
|
|
66
|
+
| default | Toolbar content (buttons, etc.), laid out as a flex row |
|
|
67
|
+
|
|
68
|
+
### Events
|
|
69
|
+
|
|
70
|
+
No custom events. Because the host itself is the popover, the native `toggle` (`ToggleEvent`) fires directly on `ixfx-snackbar`:
|
|
71
|
+
|
|
72
|
+
```js
|
|
73
|
+
document.querySelector('ixfx-snackbar').addEventListener('toggle', e => {
|
|
74
|
+
console.log(e.newState); // 'open' | 'closed'
|
|
75
|
+
});
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### CSS custom properties
|
|
79
|
+
|
|
80
|
+
Visual chrome comes from `popupSurfaceStyles` (shared with `ixfx-menu-trigger` / `ixfx-colour-picker-popup`):
|
|
81
|
+
|
|
82
|
+
| Property | Description |
|
|
83
|
+
|---|---|
|
|
84
|
+
| `--surface-5` | Background |
|
|
85
|
+
| `--surface-6` | Border color |
|
|
86
|
+
| `--surface-5-text` | Text color |
|
|
87
|
+
| `--shadow-m` | Drop shadow |
|
|
88
|
+
| `--radius-l` | Corner radius |
|
|
89
|
+
| `--space-s` | Padding / gap between slotted items and between panel and target |
|
|
90
|
+
|
|
91
|
+
### Constraints
|
|
92
|
+
|
|
93
|
+
- The target element referenced by `for` must exist in the DOM (by `id`, resolved against `getRootNode()`) whenever `for` is set or changes — there's no polling/observation for a target that appears later.
|
|
94
|
+
- In `implicit` mode, the target must already be focusable for the focus-triggered (keyboard) path to work; `ixfx-snackbar` only auto-adds `tabindex`/`role` in `explicit` mode.
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"button-CTE8crYn.js","names":["customElement"],"sources":["../src/button/button-styles.ts","../src/button/button.ts"],"sourcesContent":["import { css } from 'lit';\n\nexport const buttonStyles = css`\n :host {\n display: inline-flex;\n max-width: 100%;\n vertical-align: middle;\n user-select: none;\n -webkit-user-select: none;\n }\n\n button {\n cursor: pointer;\n appearance: none;\n background: var(--surface-4, #ccc);\n color: var(--surface-3-text, #000);\n border: var(--border, 1px solid #999);\n outline: var(--ixfx-button-outline, none);\n border-radius: var(--radius-xl, 8px);\n corner-shape: superellipse(1);\n padding: var(--space-m, 8px) var(--space-l, 12px);\n font-family: var(--font-family, inherit);\n font-size: var(--text-m, 14px);\n margin: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 0.5em;\n width: 100%;\n overflow: hidden;\n white-space: nowrap;\n box-shadow: \n var(--ixfx-button-shade, none),\n inset 1px 1px 1px 1px color-mix(in oklch, var(--surface-4) 30%, transparent), inset -1px -1px 1px 1px color-mix(in oklch, var(--surface-2) 20%, transparent),\n 2px 2px 1px 0px color-mix(in oklch, var(--surface-2) 30%, transparent);\n transition: background var(--transition, 0.2s), border-color var(--transition, 0.2s);\n }\n\n button:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n button:hover:not(:disabled) {\n background: color-mix(in oklch, var(--surface-4) 80%, transparent);\n border-color: var(--accent, #666);\n box-shadow: \n inset 1px 1px 1px 1px color-mix(in oklch, var(--surface-5) 70%, transparent), \n inset -1px -1px 1px 1px color-mix(in oklch, var(--surface-2) 60%, transparent),\n 2px 2px 1px 0px color-mix(in oklch, var(--surface-2) 90%, transparent);\n }\n\n button:active:not(:disabled) {\n background: var(--surface-2, #aaa);\n transform: translateY(1px);\n box-shadow: inset 1px 1px 0px 0.5px color-mix(in oklch,var(--surface-1),transparent);\n }\n\n .button-icon {\n display: var(--ixfx-button-hide-icon, inline-flex);\n align-items: center;\n flex-shrink: 0;\n }\n\n .button-label {\n white-space: nowrap;\n display: var(--ixfx-button-hide-label, inline);\n }\n\n :host([hide-label]) .button-label {\n display: none;\n }\n\n :host([hide-icon]) .button-icon {\n display: none;\n }\n`;\n","import { html, LitElement, nothing } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { unsafeHTML } from \"lit/directives/unsafe-html.js\";\nimport { getIcon } from \"../icons/index.js\";\nimport { prominenceStyles } from \"../styles/prominence.js\";\nimport { safeCustomElement as customElement } from \"../util/custom-elements.js\";\nimport { buttonStyles } from \"./button-styles.js\";\n\n@customElement(`ixfx-button`)\nexport class ButtonElement extends LitElement {\n @property({ type: Boolean })\n disabled = false;\n\n @property({ type: String })\n icon?: string;\n\n @property({ type: Boolean, attribute: `hide-icon`, reflect: true })\n hideIcon = false;\n\n @property({ type: Boolean, attribute: `hide-label`, reflect: true })\n hideLabel = false;\n\n protected _renderIcon() {\n if (this.hideIcon || !this.icon)\n return nothing;\n\n if (this.icon.startsWith(`<svg`)) {\n return html`<span class=\"button-icon\">${unsafeHTML(this.icon)}</span>`;\n }\n\n const svg = getIcon(this.icon);\n\n if (!svg)\n return nothing;\n\n return html`<ixfx-icon class=\"button-icon\" name=\"${this.icon}\"></ixfx-icon>`;\n }\n\n protected render() {\n const label = this.hideLabel\n ? nothing\n : html`<span class=\"button-label\"><slot></slot></span>`;\n return html`<button ?disabled=${this.disabled}>${this._renderIcon()}${label}</button>`;\n }\n\n static styles = [\n prominenceStyles,\n buttonStyles,\n ];\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"ixfx-button\": ButtonElement;\n }\n}\n"],"mappings":";;;;;;;;AAEA,MAAa,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACOxB,IAAM,gBAAN,MAAM,sBAAsB,WAAW;;;EAEjC,KAAA,WAAA;EAMA,KAAA,WAAA;EAGC,KAAA,YAAA;;CAEZ,cAAwB;EACtB,IAAI,KAAK,YAAY,CAAC,KAAK,MACzB,OAAO;EAET,IAAI,KAAK,KAAK,WAAW,MAAM,GAC7B,OAAO,IAAI,6BAA6B,WAAW,KAAK,IAAI,EAAE;EAKhE,IAAI,CAFQ,QAAQ,KAAK,IAElB,GACL,OAAO;EAET,OAAO,IAAI,wCAAwC,KAAK,KAAK;CAC/D;CAEA,SAAmB;EACjB,MAAM,QAAQ,KAAK,YACf,UACA,IAAI;EACR,OAAO,IAAI,qBAAqB,KAAK,SAAS,GAAG,KAAK,YAAY,IAAI,MAAM;CAC9E;;EAEgB,KAAA,SAAA,CACd,kBACA,YACF;;AACF;AAvCG,WAAA,CAAA,SAAS,EAAE,MAAM,QAAQ,CAAC,CAAA,GAAA,cAAA,WAAA,YAAA,KAAA,CAAA;AAG1B,WAAA,CAAA,SAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA,cAAA,WAAA,QAAA,KAAA,CAAA;AAGzB,WAAA,CAAA,SAAS;CAAE,MAAM;CAAS,WAAW;CAAa,SAAS;AAAK,CAAC,CAAA,GAAA,cAAA,WAAA,YAAA,KAAA,CAAA;AAGjE,WAAA,CAAA,SAAS;CAAE,MAAM;CAAS,WAAW;CAAc,SAAS;AAAK,CAAC,CAAA,GAAA,cAAA,WAAA,aAAA,KAAA,CAAA;AAXpEA,gBAAAA,WAAAA,CAAAA,kBAAc,aAAa,CAAA,GAAA,aAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"icon-DpA9x2Ve.d.ts","names":[],"sources":["../src/icons/icon.ts"],"mappings":";;;;;;;;;;;;;cAoBa,wBAAwB;;EACvB;EACgB;EAChB;EAC0C;EACU;EAQvD;EAKA;YAKU,iBAAM,wBAAA;YAgBN,QAAQ,SAAS;SAWpB,sBAAM;;QAsChB;YACI;IACR,aAAa"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"popup-DiWMxsWj.js","names":[],"sources":["../src/styles/popup.ts"],"sourcesContent":["import { css } from \"lit\";\n\n/**\n * Canonical surface styles for floating popup elements (menus, dropdowns,\n * colour picker, tooltips). Apply by adding `popupSurfaceStyles` to a\n * component's `static styles` array and the class `popup-surface` to the\n * popup container element.\n *\n * Intentionally omitted (remain per-component): positioning, padding,\n * dimensions, z-index, and open/close animations.\n */\nexport const popupSurfaceStyles = css`\n .popup-surface {\n background: var(--surface-5);\n border: 1px solid var(--surface-6);\n border-radius: var(--radius-l);\n box-shadow: var(--shadow-m);\n color: var(--surface-5-text);\n }\n`;\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,qBAAqB,GAAG"}
|