igniteui-astro-components 1.3.0 → 1.5.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/README.md +112 -2
- package/package.json +22 -20
- package/src/chrome/contract.d.mts +12 -0
- package/src/chrome/contract.mjs +92 -0
- package/src/chrome/integration.ts +173 -0
- package/src/components/DocsSidebar/DocsSidebar.astro +21 -1
- package/src/components/DocsSidebar/DocsSidebar.scss +31 -2
- package/src/components/DocsSidebar/README.md +12 -0
- package/src/components/DocsSidebar/SidebarLabel.astro +1 -1
- package/src/components/DocsSidebar/sidebar-tooltip.ts +174 -0
- package/src/components/DocsTree/DocsTreeItem.astro +9 -3
- package/src/components/DocsTree/README.md +13 -12
- package/src/components/DocsTree/docs-tree.scss +106 -39
- package/src/components/ThemingWidget/README.md +2 -1
- package/src/components/mdx/Sample/README.md +13 -0
- package/src/components/mdx/Sample/Sample.astro +160 -114
- package/src/components/mdx/Sample/Sample.scss +59 -58
- package/src/integration.ts +14 -1
- package/src/layouts/DocsLayout/DocsLayout.astro +56 -8
- package/src/layouts/DocsLayout/README.md +17 -0
- package/src/platform.ts +39 -11
- package/src/scripts/sample-widget.ts +31 -18
- package/src/virtual-modules.d.ts +7 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Full-text tooltip for truncated sidebar labels.
|
|
3
|
+
*
|
|
4
|
+
* Leaf labels (`.docs-tree-label`) are clamped to two lines in
|
|
5
|
+
* DocsTree/docs-tree.scss. When a label overflows that clamp, hovering or
|
|
6
|
+
* focusing its row shows the complete text in a single shared <igc-tooltip>
|
|
7
|
+
* so the user can read it before navigating. Rows whose label fits never
|
|
8
|
+
* trigger the tooltip.
|
|
9
|
+
*
|
|
10
|
+
* Design:
|
|
11
|
+
* • One tooltip per sidebar, re-anchored to the hovered/focused row with
|
|
12
|
+
* `tooltip.show(row)`. Hundreds of per-item tooltips would be wasteful.
|
|
13
|
+
* • The tooltip's own triggers are disabled (`show-triggers=""`,
|
|
14
|
+
* `hide-triggers=""`); this module owns show/hide so the truncation
|
|
15
|
+
* check runs on every interaction and stays correct after resizes.
|
|
16
|
+
* • Truncation is measured, not guessed: `scrollHeight > clientHeight` on
|
|
17
|
+
* the clamped label. Works for -webkit-line-clamp and plain overflow.
|
|
18
|
+
* • Hides on pointer leave, focus leave, click (navigation), sidebar scroll
|
|
19
|
+
* and `astro:before-swap`.
|
|
20
|
+
* • Mobile/tablet (< 1280px): docs-tree.scss removes the clamp so labels
|
|
21
|
+
* show in full; nothing measures as truncated and the tooltip never opens.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import type { IgcTooltipComponent } from 'igniteui-webcomponents';
|
|
25
|
+
|
|
26
|
+
const TOOLTIP_SELECTOR = 'igc-tooltip[data-sidebar-tooltip]';
|
|
27
|
+
const SCROLL_SELECTOR = '[data-sidebar-scroll]';
|
|
28
|
+
const ITEM_SELECTOR = 'igc-tree-item';
|
|
29
|
+
const LABEL_SELECTOR = ':scope > [slot="label"] .docs-tree-label';
|
|
30
|
+
|
|
31
|
+
/** Delay before showing, mirrors igc-tooltip's default `show-delay`. */
|
|
32
|
+
const SHOW_DELAY = 200;
|
|
33
|
+
|
|
34
|
+
/** 1px tolerance for sub-pixel rounding between scrollHeight and clientHeight. */
|
|
35
|
+
const OVERFLOW_TOLERANCE = 1;
|
|
36
|
+
|
|
37
|
+
const isTruncated = (el: HTMLElement): boolean =>
|
|
38
|
+
el.scrollHeight - el.clientHeight > OVERFLOW_TOLERANCE;
|
|
39
|
+
|
|
40
|
+
/** The row's own label (not a descendant row's), or null for group rows. */
|
|
41
|
+
const getRowLabel = (row: Element): HTMLElement | null =>
|
|
42
|
+
row.querySelector<HTMLElement>(LABEL_SELECTOR);
|
|
43
|
+
|
|
44
|
+
export class SidebarTooltip {
|
|
45
|
+
private readonly host: HTMLElement;
|
|
46
|
+
private readonly tooltip: IgcTooltipComponent;
|
|
47
|
+
private readonly abort = new AbortController();
|
|
48
|
+
private pendingTimer: ReturnType<typeof setTimeout> | undefined;
|
|
49
|
+
private currentRow: Element | null = null;
|
|
50
|
+
/**
|
|
51
|
+
* Row the user just clicked. Clicking focuses the row (see DocsTree.astro),
|
|
52
|
+
* and that focusin must not re-open the tooltip over a page that is about
|
|
53
|
+
* to navigate. Cleared once the pointer leaves the row.
|
|
54
|
+
*/
|
|
55
|
+
private suppressedRow: Element | null = null;
|
|
56
|
+
|
|
57
|
+
constructor(host: HTMLElement, tooltip: IgcTooltipComponent) {
|
|
58
|
+
this.host = host;
|
|
59
|
+
this.tooltip = tooltip;
|
|
60
|
+
|
|
61
|
+
const { signal } = this.abort;
|
|
62
|
+
const opts: AddEventListenerOptions = { passive: true, signal };
|
|
63
|
+
|
|
64
|
+
host.addEventListener('pointerover', this.onPointerOver, opts);
|
|
65
|
+
host.addEventListener('pointerout', this.onPointerOut, opts);
|
|
66
|
+
// igc-tree-item delegates focus to the slotted <a> and calls
|
|
67
|
+
// stopPropagation() on focusin/focusout inside its shadow root, so the
|
|
68
|
+
// host only ever sees these events in the capture phase.
|
|
69
|
+
host.addEventListener('focusin', this.onFocusIn, { capture: true, ...opts });
|
|
70
|
+
host.addEventListener('focusout', this.onFocusOut, { capture: true, ...opts });
|
|
71
|
+
host.addEventListener('click', this.onClick, { capture: true, ...opts });
|
|
72
|
+
host.querySelector(SCROLL_SELECTOR)?.addEventListener('scroll', this.hide, opts);
|
|
73
|
+
// The host is replaced on client-side navigation; drop everything then.
|
|
74
|
+
document.addEventListener('astro:before-swap', () => this.destroy(), { signal });
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
destroy(): void {
|
|
78
|
+
this.hide();
|
|
79
|
+
this.abort.abort();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// ── Event handlers ────────────────────────────────────────────────────────
|
|
83
|
+
|
|
84
|
+
private onPointerOver = (e: PointerEvent): void => {
|
|
85
|
+
const row = (e.target as Element | null)?.closest(ITEM_SELECTOR);
|
|
86
|
+
if (!row || row === this.currentRow) return;
|
|
87
|
+
if (row !== this.suppressedRow) this.suppressedRow = null;
|
|
88
|
+
this.scheduleShow(row);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
private onPointerOut = (e: PointerEvent): void => {
|
|
92
|
+
const row = (e.target as Element | null)?.closest(ITEM_SELECTOR);
|
|
93
|
+
if (!row) return;
|
|
94
|
+
// Still inside the same row (moved between its child elements)?
|
|
95
|
+
const to = e.relatedTarget as Element | null;
|
|
96
|
+
if (to && row.contains(to) && to.closest(ITEM_SELECTOR) === row) return;
|
|
97
|
+
if (row === this.suppressedRow) this.suppressedRow = null;
|
|
98
|
+
if (row === this.currentRow) this.hide();
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
private onClick = (e: MouseEvent): void => {
|
|
102
|
+
this.suppressedRow = (e.target as Element | null)?.closest(ITEM_SELECTOR) ?? null;
|
|
103
|
+
this.hide();
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
private onFocusIn = (e: FocusEvent): void => {
|
|
107
|
+
const row = (e.target as Element | null)?.closest(ITEM_SELECTOR);
|
|
108
|
+
if (!row) return;
|
|
109
|
+
this.scheduleShow(row);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
private onFocusOut = (e: FocusEvent): void => {
|
|
113
|
+
const to = e.relatedTarget as Element | null;
|
|
114
|
+
if (to && to.closest(ITEM_SELECTOR) === this.currentRow) return;
|
|
115
|
+
this.hide();
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
// ── Show / hide ───────────────────────────────────────────────────────────
|
|
119
|
+
|
|
120
|
+
private scheduleShow(row: Element): void {
|
|
121
|
+
this.cancelPending();
|
|
122
|
+
if (row === this.suppressedRow) return;
|
|
123
|
+
const label = getRowLabel(row);
|
|
124
|
+
if (!label || !isTruncated(label)) {
|
|
125
|
+
// Moving from a truncated row to a non-truncated one: drop the old tooltip.
|
|
126
|
+
if (this.currentRow && this.currentRow !== row) this.hide();
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const text = label.textContent?.trim() ?? '';
|
|
131
|
+
if (!text) return;
|
|
132
|
+
|
|
133
|
+
this.currentRow = row;
|
|
134
|
+
this.pendingTimer = setTimeout(() => {
|
|
135
|
+
this.pendingTimer = undefined;
|
|
136
|
+
if (this.currentRow !== row) return;
|
|
137
|
+
this.tooltip.message = text;
|
|
138
|
+
void this.tooltip.show(row);
|
|
139
|
+
}, SHOW_DELAY);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
private hide = (): void => {
|
|
143
|
+
this.cancelPending();
|
|
144
|
+
this.currentRow = null;
|
|
145
|
+
if (this.tooltip.open) void this.tooltip.hide();
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
private cancelPending(): void {
|
|
149
|
+
if (this.pendingTimer !== undefined) {
|
|
150
|
+
clearTimeout(this.pendingTimer);
|
|
151
|
+
this.pendingTimer = undefined;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// ── Bootstrap ───────────────────────────────────────────────────────────────
|
|
157
|
+
|
|
158
|
+
const instances = new WeakMap<HTMLElement, SidebarTooltip>();
|
|
159
|
+
|
|
160
|
+
/** Attach a SidebarTooltip to every sidebar on the page that has one declared. */
|
|
161
|
+
export function initSidebarTooltips(root: ParentNode = document): void {
|
|
162
|
+
root.querySelectorAll<IgcTooltipComponent>(TOOLTIP_SELECTOR).forEach((tooltip) => {
|
|
163
|
+
const host = tooltip.closest<HTMLElement>('sidebar-filter');
|
|
164
|
+
if (!host || instances.has(host)) return;
|
|
165
|
+
instances.set(host, new SidebarTooltip(host, tooltip));
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const bootstrap = () => {
|
|
170
|
+
customElements.whenDefined('igc-tooltip').then(() => initSidebarTooltips());
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
bootstrap();
|
|
174
|
+
document.addEventListener('astro:page-load', bootstrap);
|
|
@@ -10,12 +10,18 @@
|
|
|
10
10
|
* Sets `data-tree-id`, `data-depth`, and `data-has-children` (when applicable).
|
|
11
11
|
* Any extra `data-*` attributes come from `node.itemData` (kebab-cased keys).
|
|
12
12
|
*
|
|
13
|
+
* The expand/collapse chevron is rendered in the label slot *before* the
|
|
14
|
+
* text (leading position), never in igc-tree-item's native `indicator` part,
|
|
15
|
+
* which is hidden globally via `::part(indicator)`. Nesting is expressed with
|
|
16
|
+
* the native `indentation` part (see `--igc-tree-indentation-size` in
|
|
17
|
+
* docs-tree.scss), so a nested group's chevron sits in its parent's label
|
|
18
|
+
* column.
|
|
19
|
+
*
|
|
13
20
|
* The `active` attribute is intentionally NOT set on <igc-tree-item>:
|
|
14
21
|
* setting it triggers IgcTreeItemComponent.activeChange() synchronously
|
|
15
22
|
* during defineComponents(), before the tree is upgraded, crashing on
|
|
16
23
|
* `this.tree?.expandToItem`. Active-row highlight is CSS-driven via
|
|
17
24
|
* `igc-tree-item:has(a[aria-current])` instead.
|
|
18
|
-
* The default expand indicator is hidden globally via `::part(indicator)`.
|
|
19
25
|
*/
|
|
20
26
|
import type { TreeNode, TreeVariant } from './types';
|
|
21
27
|
|
|
@@ -60,21 +66,21 @@ if (node.itemData) {
|
|
|
60
66
|
class="docs-tree-link"
|
|
61
67
|
{...node.linkAttrs}
|
|
62
68
|
/>
|
|
69
|
+
{hasChildren && <igc-icon name="chevron" collection="docs" class="tree-expand-icon" />}
|
|
63
70
|
{RenderLabel ? (
|
|
64
71
|
<RenderLabel node={node} depth={depth} isLeaf={isLeaf} isActive={isActive} />
|
|
65
72
|
) : (
|
|
66
73
|
<span class="docs-tree-label">{node.label}</span>
|
|
67
74
|
)}
|
|
68
|
-
{hasChildren && <igc-icon name="chevron" collection="docs" class="tree-expand-icon" />}
|
|
69
75
|
</div>
|
|
70
76
|
) : (
|
|
71
77
|
<div slot="label" class="docs-tree-group">
|
|
78
|
+
<igc-icon name="chevron" collection="docs" class="tree-expand-icon" />
|
|
72
79
|
{RenderLabel ? (
|
|
73
80
|
<RenderLabel node={node} depth={depth} isLeaf={isLeaf} isActive={isActive} />
|
|
74
81
|
) : (
|
|
75
82
|
<span class="docs-tree-label">{node.label}</span>
|
|
76
83
|
)}
|
|
77
|
-
<igc-icon name="chevron" collection="docs" class="tree-expand-icon" />
|
|
78
84
|
</div>
|
|
79
85
|
)
|
|
80
86
|
}
|
|
@@ -80,22 +80,23 @@ All structural and per-variant rules are in
|
|
|
80
80
|
[`docs-tree.css`](./docs-tree.css). The file is imported once by
|
|
81
81
|
`DocsTree.astro`; Astro hoists and dedupes it.
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
Sidebar layout tokens (set on `igc-tree[data-variant="sidebar"]`):
|
|
84
84
|
|
|
85
85
|
```
|
|
86
|
-
--docs-tree-row-
|
|
87
|
-
--docs-tree-
|
|
88
|
-
--docs-tree-
|
|
89
|
-
--docs-tree-
|
|
90
|
-
--docs-tree-
|
|
91
|
-
--docs-tree-
|
|
92
|
-
--docs-tree-row-active-bg
|
|
93
|
-
--docs-tree-row-active-color
|
|
94
|
-
--docs-tree-group-color
|
|
95
|
-
--docs-tree-nested-rule
|
|
96
|
-
--docs-tree-nested-pad-x
|
|
86
|
+
--docs-tree-row-inset leading space on every row before chevron/label (6px)
|
|
87
|
+
--docs-tree-indent one indentation step per nesting level (16px)
|
|
88
|
+
--docs-tree-expand-col width of the leading chevron column (14px)
|
|
89
|
+
--docs-tree-expand-icon-size chevron glyph size inside the column (14px)
|
|
90
|
+
--docs-tree-expand-gap gap between the chevron and the group label (8px)
|
|
91
|
+
--docs-tree-leaf-inset extra inset of a leaf label (6px)
|
|
97
92
|
```
|
|
98
93
|
|
|
94
|
+
The chevron is rendered in the label slot _before_ the text; nesting uses
|
|
95
|
+
`igc-tree-item`'s native `indentation` part. Keep the invariant
|
|
96
|
+
`indent + leaf inset == expand column + gap`: it makes a leaf directly under a
|
|
97
|
+
root group line up with that group's label, and puts a nested group's chevron
|
|
98
|
+
in its parent's label column.
|
|
99
|
+
|
|
99
100
|
## Adapters
|
|
100
101
|
|
|
101
102
|
Consumers convert their domain types to `TreeNode[]` via small adapters:
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@use 'igniteui-theming/sass/typography' as *;
|
|
2
|
+
@use '../../styles/global/breakpoints' as *;
|
|
2
3
|
|
|
3
4
|
/*
|
|
4
5
|
* if we need to modify the toc or the sidebar in any way we can use:
|
|
@@ -58,7 +59,50 @@ igc-tree {
|
|
|
58
59
|
// anchor-name: --selected-tree-item;
|
|
59
60
|
//}
|
|
60
61
|
|
|
62
|
+
/*
|
|
63
|
+
* Sidebar layout model (all values overridable):
|
|
64
|
+
*
|
|
65
|
+
* ┌ row (wrapper) ─────────────────────────────────────────────────┐
|
|
66
|
+
* │[indent × level][6px][▸ 14px][8px] Group label │
|
|
67
|
+
* │[indent × level][6px][6px] Leaf label [badges] │
|
|
68
|
+
* └─────────────────────────────────────────────────────────────────┘
|
|
69
|
+
*
|
|
70
|
+
* • --docs-tree-row-inset leading space on every row, before the
|
|
71
|
+
* chevron / label (6px)
|
|
72
|
+
* • --docs-tree-indent one step per nesting level (16px)
|
|
73
|
+
* • --docs-tree-expand-col width of the chevron column (14px)
|
|
74
|
+
* • --docs-tree-expand-icon-size chevron glyph size (14px)
|
|
75
|
+
* • --docs-tree-expand-gap gap between chevron and label (8px)
|
|
76
|
+
* • --docs-tree-leaf-inset extra inset of a leaf label (6px)
|
|
77
|
+
*
|
|
78
|
+
* Invariant: indent + leaf inset == chevron column + gap. That makes a leaf
|
|
79
|
+
* directly under a root group line up with the root group's label, and puts
|
|
80
|
+
* a nested group's chevron in its parent's label column.
|
|
81
|
+
*/
|
|
61
82
|
igc-tree[data-variant='sidebar'] {
|
|
83
|
+
--docs-tree-row-inset: #{rem(6px)};
|
|
84
|
+
--docs-tree-indent: #{rem(16px)};
|
|
85
|
+
--docs-tree-expand-col: #{rem(14px)};
|
|
86
|
+
--docs-tree-expand-icon-size: #{rem(14px)};
|
|
87
|
+
--docs-tree-expand-gap: #{rem(8px)};
|
|
88
|
+
--docs-tree-leaf-inset: #{rem(6px)};
|
|
89
|
+
|
|
90
|
+
igc-tree-item {
|
|
91
|
+
// Drives the width of igc-tree-item's native `indentation` part
|
|
92
|
+
// (width = level × size), which precedes the label slot in the row.
|
|
93
|
+
--igc-tree-indentation-size: var(--docs-tree-indent);
|
|
94
|
+
|
|
95
|
+
&::part(wrapper) {
|
|
96
|
+
border-radius: rem(4px);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// The label part is `width: 100%`, which would otherwise make the
|
|
100
|
+
// indentation flex item shrink and drift the columns by 1–3px per level.
|
|
101
|
+
&::part(indentation) {
|
|
102
|
+
flex-shrink: 0;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
62
106
|
igc-tree-item + igc-tree-item[data-has-children] {
|
|
63
107
|
margin-block-start: rem(4px);
|
|
64
108
|
}
|
|
@@ -70,13 +114,10 @@ igc-tree[data-variant='sidebar'] {
|
|
|
70
114
|
}
|
|
71
115
|
}
|
|
72
116
|
|
|
117
|
+
// ── Group rows ──────────────────────────────────────────────────────────
|
|
73
118
|
igc-tree-item[aria-expanded] {
|
|
74
|
-
&::part(wrapper) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
&:hover {
|
|
78
|
-
background-color: var(--ig-gray-50);
|
|
79
|
-
}
|
|
119
|
+
&::part(wrapper):hover {
|
|
120
|
+
background-color: var(--ig-gray-50);
|
|
80
121
|
}
|
|
81
122
|
|
|
82
123
|
.docs-tree-group {
|
|
@@ -89,6 +130,29 @@ igc-tree[data-variant='sidebar'] {
|
|
|
89
130
|
background-color: var(--ig-gray-50);
|
|
90
131
|
}
|
|
91
132
|
}
|
|
133
|
+
|
|
134
|
+
// Only root groups are bold; nested groups read as regular entries.
|
|
135
|
+
igc-tree-item:not([data-depth='0']) > [slot='label'] .group-label-text {
|
|
136
|
+
font-weight: 400;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// ── Leaf rows ───────────────────────────────────────────────────────────
|
|
140
|
+
// Hover / active backgrounds live on the wrapper so they span the whole
|
|
141
|
+
// row (including the indentation) rather than just the label area.
|
|
142
|
+
igc-tree-item:not([data-has-children]) {
|
|
143
|
+
&::part(wrapper):hover,
|
|
144
|
+
&:has(.docs-tree-link:focus)::part(wrapper) {
|
|
145
|
+
background-color: var(--ig-gray-50);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Leaves directly under a root group are primary entries (dark text);
|
|
150
|
+
// deeper leaves inherit the muted default foreground.
|
|
151
|
+
igc-tree-item[data-depth='1']:not([data-has-children]) {
|
|
152
|
+
--foreground: light-dark(var(--ig-gray-900), var(--ig-gray-600));
|
|
153
|
+
--foreground-active: light-dark(var(--ig-gray-900), var(--ig-gray-50));
|
|
154
|
+
--foreground-hover: light-dark(var(--ig-gray-900), var(--ig-gray-50));
|
|
155
|
+
}
|
|
92
156
|
}
|
|
93
157
|
|
|
94
158
|
igc-tree[data-variant='toc'] {
|
|
@@ -202,13 +266,18 @@ igc-tree-item[data-has-children] {
|
|
|
202
266
|
}
|
|
203
267
|
}
|
|
204
268
|
|
|
269
|
+
/* Leading expand/collapse chevron: a fixed-width column with the glyph
|
|
270
|
+
centred inside it, followed by a gap to the label. */
|
|
205
271
|
.tree-expand-icon {
|
|
206
|
-
|
|
272
|
+
--size: var(--docs-tree-expand-icon-size, #{rem(14px)});
|
|
273
|
+
|
|
207
274
|
flex-shrink: 0;
|
|
275
|
+
width: var(--docs-tree-expand-col, #{rem(14px)});
|
|
276
|
+
height: var(--docs-tree-expand-col, #{rem(14px)});
|
|
277
|
+
margin-inline-end: var(--docs-tree-expand-gap, #{rem(8px)});
|
|
208
278
|
color: inherit;
|
|
209
279
|
transform: rotate(-90deg);
|
|
210
280
|
transition: transform 0.2s ease;
|
|
211
|
-
margin-inline-end: rem(1px);
|
|
212
281
|
}
|
|
213
282
|
|
|
214
283
|
igc-tree-item[aria-expanded='false'] > [slot='label'] {
|
|
@@ -224,10 +293,6 @@ igc-tree-item[aria-expanded='true'] > [slot='label'] {
|
|
|
224
293
|
}
|
|
225
294
|
}
|
|
226
295
|
|
|
227
|
-
igc-tree-item[data-has-children][data-depth='0'] {
|
|
228
|
-
--igc-tree-indentation-size: 0;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
296
|
igc-tree-item[data-has-children] {
|
|
232
297
|
--foreground: light-dark(var(--ig-gray-900), var(--ig-gray-600));
|
|
233
298
|
--foreground-selected: light-dark(var(--ig-gray-900), var(--ig-gray-600));
|
|
@@ -268,9 +333,10 @@ igc-tree-item:not([data-has-children]):hover .docs-tree-label {
|
|
|
268
333
|
|
|
269
334
|
.igd-label-and-badge {
|
|
270
335
|
position: relative;
|
|
271
|
-
border-radius: rem(4px);
|
|
272
336
|
padding-block: rem(8px);
|
|
273
|
-
padding-inline-start:
|
|
337
|
+
padding-inline-start: calc(
|
|
338
|
+
var(--docs-tree-row-inset, #{rem(6px)}) + var(--docs-tree-leaf-inset, #{rem(6px)})
|
|
339
|
+
);
|
|
274
340
|
padding-inline-end: rem(8px);
|
|
275
341
|
height: 100%;
|
|
276
342
|
z-index: -1;
|
|
@@ -287,37 +353,26 @@ igc-tree-item:not([data-has-children]):hover .docs-tree-label {
|
|
|
287
353
|
//}
|
|
288
354
|
}
|
|
289
355
|
|
|
290
|
-
.
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
356
|
+
/* Active (current page) leaf. `selected` is also set on every ancestor of
|
|
357
|
+
the active item (see DocsTree.astro), so restrict to leaves explicitly. */
|
|
358
|
+
igc-tree[data-variant='sidebar'] {
|
|
359
|
+
igc-tree-item[selected]:not([data-has-children]) {
|
|
360
|
+
// Listed explicitly (not just via inheritance from the base rule) because
|
|
361
|
+
// the leaf hover/focus rule above has higher specificity (`:has()`)
|
|
362
|
+
// and would otherwise paint the focused selected row gray.
|
|
363
|
+
&::part(wrapper),
|
|
364
|
+
&::part(wrapper):hover,
|
|
365
|
+
&:has(.docs-tree-link:focus)::part(wrapper) {
|
|
366
|
+
background-color: var(--igd-accent);
|
|
295
367
|
}
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
368
|
|
|
299
|
-
igc-tree-item[selected] {
|
|
300
|
-
igc-tree-item[selected]:not([aria-expanded]) {
|
|
301
369
|
.igd-label-and-badge {
|
|
302
370
|
color: var(--igd-on-accent);
|
|
303
|
-
background-color: var(--igd-accent);
|
|
304
|
-
|
|
305
|
-
.docs-tree-label {
|
|
306
|
-
color: var(--igd-on-accent);
|
|
307
|
-
}
|
|
308
371
|
}
|
|
309
372
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
.igd-label-and-badge {
|
|
314
|
-
background-color: var(--igd-accent);
|
|
315
|
-
|
|
316
|
-
.docs-tree-label {
|
|
317
|
-
color: #fff;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}
|
|
373
|
+
.docs-tree-label,
|
|
374
|
+
&:hover .docs-tree-label {
|
|
375
|
+
color: var(--igd-on-accent);
|
|
321
376
|
}
|
|
322
377
|
|
|
323
378
|
.sidebar-premium-icon {
|
|
@@ -387,6 +442,18 @@ igc-tree[data-variant='toc'] {
|
|
|
387
442
|
}
|
|
388
443
|
}
|
|
389
444
|
|
|
445
|
+
/* Mobile + tablet (< 1280px): the sidebar is a slide-in overlay on touch-first
|
|
446
|
+
devices, so labels show in full instead of clamping. This also disables the
|
|
447
|
+
full-text tooltip, which only opens when a label measures as overflowing
|
|
448
|
+
(see DocsSidebar/sidebar-tooltip.ts). */
|
|
449
|
+
@media (max-width: #{$bp-tablet-max}) {
|
|
450
|
+
igc-tree[data-variant='sidebar'] .docs-tree-label {
|
|
451
|
+
display: block;
|
|
452
|
+
-webkit-line-clamp: unset;
|
|
453
|
+
overflow: visible;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
|
|
390
457
|
/* Filter visibility — driven by <sidebar-filter>. */
|
|
391
458
|
// Removing this will break the filter in the sidebar
|
|
392
459
|
sidebar-filter[data-filtering]
|
|
@@ -93,7 +93,8 @@ defaults.
|
|
|
93
93
|
|
|
94
94
|
`Sample.astro` adds one step on top: when it renders the widget it derives the
|
|
95
95
|
theme from the current platform — Angular → Material, React / Web Components /
|
|
96
|
-
Blazor → Bootstrap
|
|
96
|
+
Blazor → Bootstrap, with a `wc` sample taking the Web Components default on
|
|
97
|
+
any platform — unless `defaultSampleTheme` is set. That default is
|
|
97
98
|
functional, not cosmetic: the picker's selection is posted into the sample
|
|
98
99
|
iframe on every load, so it decides how the demo actually renders.
|
|
99
100
|
|
|
@@ -18,8 +18,10 @@ import Sample from 'igniteui-astro-components/components/mdx/Sample.astro';
|
|
|
18
18
|
| `lob` | `boolean` | `false` | Use `lobDemosBaseUrl` instead of `demosBaseUrl` (LOB/grid-dynamic demos). |
|
|
19
19
|
| `dv` | `boolean` | `false` | Force use of `dvDemosBaseUrl` (data-viz demos). Auto-detected for paths starting with `charts/`, `gauges/`, `maps/`, `excel/`. |
|
|
20
20
|
| `crm` | `boolean` | `false` | Use `crmDemoBaseUrl` (CRM demo samples). |
|
|
21
|
+
| `wc` | `boolean` | `false` | Load the sample from the Web Components samples browser (`wcDemosBaseUrl`) on every platform's docs, for demos the platforms share. Falls back to `demosBaseUrl`. Code tabs and live editing follow it. |
|
|
21
22
|
| `iframeOnly` | `boolean` | `false` | Render only the iframe — no navbar, no code tabs, no live-edit footer. |
|
|
22
23
|
| `fullscreenBtn` | `boolean` | `false` | When `iframeOnly={true}`, also renders a "View in full screen" button below the iframe. |
|
|
24
|
+
| `hideCode` | `boolean` | `false` | Keep the widget's frame but drop its code viewer: no tabs header, no code fetch, no live-edit or full-screen buttons. The footer carries only the theme picker (`showThemePicker`); without it there is no footer. For demos whose code is not a usage example, e.g. ones that fake interaction states. |
|
|
23
25
|
| `fitContent` | `boolean` | `false` | Size the iframe to fit its content — the embedded page dictates the size. Same-origin demos are measured directly; cross-origin demos must report via `postMessage`. Demos with ink overflow (shadows, glows, focus rings) must reserve room for it in their own layout, since an iframe clips at its edge. |
|
|
24
26
|
| `spacing` | `'none' \| 'sm' \| 'md' \| 'lg'` | `'none'` | Padding around the iframe inside the container: `none` = 0, `sm` = 8px, `md` = 16px, `lg` = 32px. Applied by the host container, never inside the embedded page. |
|
|
25
27
|
| `position` | `string` | — | Where the iframe sits inside the container when it doesn't fill it. Accepts a horizontal token (`start`, `center`, `end`) and/or a vertical token (`top`, `center`, `bottom`), space-separated in any order — e.g. `"center"`, `"start top"`, `"end bottom"`. |
|
|
@@ -43,6 +45,10 @@ import Sample from 'igniteui-astro-components/components/mdx/Sample.astro';
|
|
|
43
45
|
|
|
44
46
|
<Sample src="/grid/grid/filtering" lob />
|
|
45
47
|
|
|
48
|
+
{/* Web Components sample shared by every platform's docs */}
|
|
49
|
+
|
|
50
|
+
<Sample src="/themes/palettes/scales" wc fitContent iframeOnly />
|
|
51
|
+
|
|
46
52
|
{/* Bare iframe for embedding */}
|
|
47
53
|
|
|
48
54
|
<Sample src="/charts/bar-chart/overview" iframeOnly height={300} />
|
|
@@ -50,6 +56,10 @@ import Sample from 'igniteui-astro-components/components/mdx/Sample.astro';
|
|
|
50
56
|
{/* Bare iframe + fullscreen link */}
|
|
51
57
|
|
|
52
58
|
<Sample src="/charts/bar-chart/overview" iframeOnly fullscreenBtn height={300} />
|
|
59
|
+
|
|
60
|
+
{/* Demo only, with the theme picker: no code tabs or live-edit buttons */}
|
|
61
|
+
|
|
62
|
+
<Sample src="/inputs/radio/interaction-state" hideCode showThemePicker height={400} />
|
|
53
63
|
```
|
|
54
64
|
|
|
55
65
|
## Environment configuration
|
|
@@ -62,6 +72,9 @@ The base URLs are resolved from `environment.json` at build time via `siteMetaIn
|
|
|
62
72
|
| `dvDemosBaseUrl` | Charts / gauges / maps / excel |
|
|
63
73
|
| `lobDemosBaseUrl` | LOB / grids |
|
|
64
74
|
| `crmDemoBaseUrl` | CRM demos |
|
|
75
|
+
| `wcDemosBaseUrl` | `wc` samples, on any platform |
|
|
76
|
+
|
|
77
|
+
Outside the Web Components site, a `wc` sample needs `wcDemosBaseUrl`: without it the sample falls back to `demosBaseUrl`, the page's own platform browser, and the build logs a warning. Leave unused keys out rather than setting them to `""`: an empty string doesn't fall back, it produces a relative URL.
|
|
65
78
|
|
|
66
79
|
## Code highlighting
|
|
67
80
|
|