igniteui-astro-components 0.0.7 → 0.0.8
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/package.json +4 -2
- package/src/assets/icons/open-link-blank.svg +1 -1
- package/src/assets/logos/code-sandbox.svg +14 -0
- package/src/assets/logos/stackblitz.svg +13 -0
- package/src/components/DocsBreadcrumb/DocsBreadcrumb.scss +1 -1
- package/src/components/DocsSidebar/DocsSidebar.astro +15 -8
- package/src/components/DocsSidebar/DocsSidebar.scss +152 -2
- package/src/components/DocsSidebar/SidebarFilterInput.scss +7 -3
- package/src/components/DocsSidebar/SidebarLabel.astro +25 -4
- package/src/components/DocsSidebar/toTreeNodes.ts +1 -1
- package/src/components/DocsSubHeader/DocsSubHeader.astro +119 -302
- package/src/components/DocsSubHeader/DocsSubHeader.scss +111 -11
- package/src/components/DocsToc/DocsToc.astro +5 -2
- package/src/components/DocsTree/DocsTree.astro +9 -0
- package/src/components/DocsTree/docs-tree.scss +139 -118
- package/src/components/GlobalNavBar/GlobalNavBar.module.scss +16 -1
- package/src/components/LicenseIndicator/LicenseIndicator.astro +19 -0
- package/src/components/LicenseIndicator/LicenseIndicator.scss +5 -0
- package/src/components/Search/Search.astro +34 -15
- package/src/components/Search/Search.scss +10 -42
- package/src/components/SearchAdvanced/SearchAdvanced.astro +182 -355
- package/src/components/SearchAdvanced/SearchAdvanced.scss +177 -0
- package/src/components/mdx/ApiRef/README.md +1 -1
- package/src/components/mdx/DocsAside/DocsAside.astro +37 -32
- package/src/components/mdx/DocsAside/DocsAside.scss +123 -35
- package/src/components/mdx/Sample/Sample.astro +55 -45
- package/src/components/mdx/Sample/Sample.scss +173 -30
- package/src/integration.ts +7 -0
- package/src/layouts/DocsLayout/DocsLayout.astro +58 -16
- package/src/layouts/DocsLayout/DocsLayout.scss +51 -6
- package/src/lib/sidebar/helpers.ts +14 -1
- package/src/lib/sidebar/types.ts +5 -7
- package/src/plugins/rehype-heading-anchors.ts +74 -0
- package/src/plugins/rehype-table-wrapper.ts +49 -0
- package/src/plugins/remark-docfx.ts +0 -0
- package/src/scripts/sample-widget.ts +107 -114
- package/src/styles/global/_breakpoints.scss +4 -4
- package/src/styles/global/_code-blocks.scss +1 -1
- package/src/styles/global/_component-themes.scss +118 -18
- package/src/styles/global/_index.scss +2 -2
- package/src/styles/global/_markdown.scss +444 -32
- package/src/styles/global/_palette.scss +7 -0
- package/src/styles/global/_search-shared.scss +273 -0
- package/src/styles/global/_variables.scss +58 -3
- package/src/styles/theme.scss +80 -11
- package/src/assets/icons/copy-clipboard.svg +0 -3
- package/src/assets/icons/filter-clear.svg +0 -1
- package/src/styles/custom.scss +0 -20
|
@@ -14,172 +14,193 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
igc-tree {
|
|
17
|
-
--ig-tree-background: transparent;
|
|
18
|
-
--ig-size: 1;
|
|
19
|
-
|
|
20
|
-
position: relative;
|
|
21
|
-
|
|
22
|
-
&::before {
|
|
23
|
-
content: '';
|
|
24
|
-
position: absolute;
|
|
25
|
-
position-anchor: --selected-tree-item;
|
|
26
|
-
top: anchor(top);
|
|
27
|
-
height: anchor-size(height);
|
|
28
|
-
inset-inline-start: 0;
|
|
29
|
-
width: rem(1px);
|
|
30
|
-
background-color: var(--igd-accent);
|
|
31
|
-
transition: top 0.2s ease, height 0.2s ease;
|
|
32
|
-
display: none;
|
|
33
|
-
z-index: 1;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
&::
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
17
|
+
--ig-tree-background: transparent;
|
|
18
|
+
--ig-size: 1;
|
|
19
|
+
|
|
20
|
+
position: relative;
|
|
21
|
+
|
|
22
|
+
&::before {
|
|
23
|
+
content: '';
|
|
24
|
+
position: absolute;
|
|
25
|
+
position-anchor: --selected-tree-item;
|
|
26
|
+
top: anchor(top);
|
|
27
|
+
height: anchor-size(height);
|
|
28
|
+
inset-inline-start: 0;
|
|
29
|
+
width: rem(1px);
|
|
30
|
+
background-color: var(--igd-accent);
|
|
31
|
+
transition: top 0.2s ease, height 0.2s ease;
|
|
32
|
+
display: none;
|
|
33
|
+
z-index: 1;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
body.is-resizing &::before {
|
|
37
|
+
transition: none;
|
|
38
|
+
}
|
|
39
|
+
&::after {
|
|
40
|
+
content: '';
|
|
41
|
+
position: absolute;
|
|
42
|
+
width: rem(1px);
|
|
43
|
+
inset-inline-start: 0;
|
|
44
|
+
top: 0;
|
|
45
|
+
z-index: 0;
|
|
46
|
+
height: 100%;
|
|
47
|
+
background: light-dark(var(--ig-gray-200), var(--ig-gray-300));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&:has(igc-tree-item[selected])::before {
|
|
51
|
+
display: block;
|
|
52
|
+
}
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
/* Sidebar: only leaf items get selected, so item height = single row */
|
|
53
56
|
igc-tree[data-variant='sidebar'] igc-tree-item[selected] {
|
|
54
|
-
anchor-name: --selected-tree-item;
|
|
57
|
+
anchor-name: --selected-tree-item;
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
/* TOC: groups can be selected (h2 with h3 children); anchor to the label div
|
|
58
61
|
so height tracks only the row, not the expanded children below */
|
|
59
62
|
igc-tree[data-variant='toc'] igc-tree-item[selected] > [slot='label'] {
|
|
60
|
-
anchor-name: --selected-tree-item;
|
|
63
|
+
anchor-name: --selected-tree-item;
|
|
61
64
|
}
|
|
62
65
|
|
|
63
66
|
igc-tree-item {
|
|
64
|
-
--igc-tree-indentation-size: #{rem(20px)};
|
|
65
|
-
|
|
66
|
-
--
|
|
67
|
-
--
|
|
68
|
-
--background-
|
|
69
|
-
--
|
|
70
|
-
--foreground-
|
|
71
|
-
--
|
|
72
|
-
--
|
|
73
|
-
--hover-color: transparent;
|
|
74
|
-
--
|
|
75
|
-
--
|
|
76
|
-
--foreground-selected: var(--igd-accent);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
a {
|
|
80
|
-
position: absolute;
|
|
81
|
-
inset: 0;
|
|
82
|
-
align-items: center;
|
|
83
|
-
color: inherit;
|
|
84
|
-
text-decoration: none;
|
|
85
|
-
width: 100%;
|
|
86
|
-
height: 100%;
|
|
87
|
-
|
|
88
|
-
&:focus {
|
|
89
|
-
outline: none;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
cursor: default;
|
|
94
|
-
|
|
95
|
-
&:hover,
|
|
96
|
-
&:focus {
|
|
97
|
-
> a {
|
|
98
|
-
color: var(--igd-accent);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
67
|
+
--igc-tree-indentation-size: #{rem(20px)};
|
|
68
|
+
--background: transparent;
|
|
69
|
+
--foreground: light-dark(var(--ig-gray-600), var(--ig-gray-500));
|
|
70
|
+
--background-selected: transparent;
|
|
71
|
+
--background-active: transparent;
|
|
72
|
+
--foreground-active: var(--igd-accent);
|
|
73
|
+
--foreground-hover: var(--igd-accent);
|
|
74
|
+
--background-disabled: transparent;
|
|
75
|
+
--hover-color: transparent;
|
|
76
|
+
--hover-selected-color: transparent;
|
|
77
|
+
--background-active-selected: transparent;
|
|
78
|
+
--foreground-selected: var(--igd-accent);
|
|
79
|
+
--foreground-active-selected: var(--igd-accent);
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
a {
|
|
83
|
+
position: absolute;
|
|
84
|
+
inset: 0;
|
|
85
|
+
align-items: center;
|
|
86
|
+
color: inherit;
|
|
87
|
+
text-decoration: none;
|
|
88
|
+
width: 100%;
|
|
89
|
+
height: 100%;
|
|
90
|
+
|
|
91
|
+
&:focus {
|
|
92
|
+
outline: none;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
cursor: default;
|
|
97
|
+
|
|
98
|
+
&:hover,
|
|
99
|
+
&:focus {
|
|
100
|
+
> a {
|
|
101
|
+
color: var(--igd-accent);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
igc-tree-item::part(wrapper) {
|
|
104
|
-
@include type-style('body-2') {
|
|
105
|
-
margin-block: 0;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
padding-inline-
|
|
107
|
+
@include type-style('body-2') {
|
|
108
|
+
margin-block: 0;
|
|
109
|
+
}
|
|
110
|
+
;
|
|
111
|
+
padding-inline-start: rem(24px);
|
|
112
|
+
padding-inline-end: rem(8px);
|
|
109
113
|
}
|
|
110
114
|
|
|
111
115
|
igc-tree-item::part(focused) {
|
|
112
|
-
box-shadow: none;
|
|
116
|
+
box-shadow: none;
|
|
113
117
|
}
|
|
114
118
|
|
|
115
119
|
igc-tree-item::part(indicator) {
|
|
116
|
-
display: none;
|
|
120
|
+
display: none;
|
|
117
121
|
}
|
|
118
122
|
|
|
119
123
|
igc-tree-item::part(label) {
|
|
120
|
-
width: 100%;
|
|
124
|
+
width: 100%;
|
|
125
|
+
max-height: 100%;
|
|
121
126
|
}
|
|
122
127
|
|
|
123
|
-
igc-tree-item[data-has-children]
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
128
|
+
igc-tree-item[data-has-children] {
|
|
129
|
+
> [slot='label'] {
|
|
130
|
+
display: flex;
|
|
131
|
+
align-items: center;
|
|
132
|
+
width: 100%;
|
|
133
|
+
}
|
|
127
134
|
}
|
|
128
135
|
|
|
129
136
|
.tree-expand-icon {
|
|
130
|
-
margin-inline-start: auto;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
137
|
+
margin-inline-start: auto;
|
|
138
|
+
//margin-inline-end: rem(4px);
|
|
139
|
+
flex-shrink: 0;
|
|
140
|
+
color: inherit;
|
|
141
|
+
transform: rotate(-90deg);
|
|
142
|
+
transition: transform 0.2s ease;
|
|
135
143
|
}
|
|
136
144
|
|
|
137
|
-
igc-tree-item[aria-expanded='true']
|
|
138
|
-
|
|
139
|
-
|
|
145
|
+
igc-tree-item[aria-expanded='true'] {
|
|
146
|
+
.tree-expand-icon {
|
|
147
|
+
transform: rotate(0deg);
|
|
148
|
+
color: var(--igd-accent);
|
|
149
|
+
}
|
|
140
150
|
}
|
|
141
151
|
|
|
142
152
|
igc-tree-item[data-has-children][data-depth='0'] {
|
|
143
|
-
--igc-tree-indentation-size: 0;
|
|
153
|
+
--igc-tree-indentation-size: 0;
|
|
144
154
|
}
|
|
145
155
|
|
|
146
156
|
igc-tree-item[data-has-children] {
|
|
147
|
-
--foreground: light-dark(var(--ig-gray-900), var(--ig-gray-50));
|
|
148
|
-
--foreground-selected: light-dark(var(--ig-gray-900), var(--ig-gray-50));
|
|
149
|
-
--foreground-active-selected: light-dark(var(--ig-gray-900), var(--ig-gray-50));
|
|
150
|
-
--foreground-active: light-dark(var(--ig-gray-900), var(--ig-gray-50));
|
|
151
|
-
--foreground-hover: light-dark(var(--ig-gray-900), var(--ig-gray-50));
|
|
157
|
+
--foreground: light-dark(var(--ig-gray-900), var(--ig-gray-50));
|
|
158
|
+
--foreground-selected: light-dark(var(--ig-gray-900), var(--ig-gray-50));
|
|
159
|
+
--foreground-active-selected: light-dark(var(--ig-gray-900), var(--ig-gray-50));
|
|
160
|
+
--foreground-active: light-dark(var(--ig-gray-900), var(--ig-gray-50));
|
|
161
|
+
--foreground-hover: light-dark(var(--ig-gray-900), var(--ig-gray-50));
|
|
152
162
|
}
|
|
153
163
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
color: var(--igd-accent);
|
|
164
|
+
.docs-tree-label {
|
|
165
|
+
white-space: normal;
|
|
157
166
|
}
|
|
158
167
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
--foreground-active-selected: light-dark(var(--ig-gray-900), var(--ig-gray-50));
|
|
164
|
-
--foreground-active: light-dark(var(--ig-gray-900), var(--ig-gray-50));
|
|
165
|
-
--foreground-hover: light-dark(var(--ig-gray-900), var(--ig-gray-50));
|
|
166
|
-
}
|
|
168
|
+
/* Hover accent applies to leaf items (sidebar) and all linked items (TOC) */
|
|
169
|
+
.docs-tree-link:hover ~ .docs-tree-label,
|
|
170
|
+
igc-tree-item:not([data-has-children]):hover .docs-tree-label {
|
|
171
|
+
color: var(--igd-accent);
|
|
167
172
|
}
|
|
168
173
|
|
|
169
|
-
igc-tree[data-variant='
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
+
igc-tree[data-variant='sidebar'] {
|
|
175
|
+
overflow: hidden;
|
|
176
|
+
|
|
177
|
+
igc-tree-item[data-has-children] {
|
|
178
|
+
--foreground: light-dark(var(--ig-gray-900), var(--ig-gray-50));
|
|
179
|
+
--foreground-selected: light-dark(var(--ig-gray-900), var(--ig-gray-50));
|
|
180
|
+
--foreground-active-selected: light-dark(var(--ig-gray-900), var(--ig-gray-50));
|
|
181
|
+
--foreground-active: light-dark(var(--ig-gray-900), var(--ig-gray-50));
|
|
182
|
+
--foreground-hover: light-dark(var(--ig-gray-900), var(--ig-gray-50));
|
|
183
|
+
}
|
|
174
184
|
}
|
|
175
185
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
186
|
+
igc-tree[data-variant='toc'] {
|
|
187
|
+
/* TOC variant — active link highlighted by scroll-spy via aria-current="true". */
|
|
188
|
+
.docs-tree-link[aria-current='true'] {
|
|
189
|
+
color: var(--igd-accent);
|
|
190
|
+
|
|
191
|
+
+ .docs-tree-label {
|
|
192
|
+
color: var(--igd-accent);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/* No expand/collapse icons in the TOC — all items are links */
|
|
197
|
+
.tree-expand-icon {
|
|
198
|
+
display: none;
|
|
199
|
+
}
|
|
179
200
|
}
|
|
180
201
|
|
|
181
202
|
/* Filter visibility — driven by <sidebar-filter>. */
|
|
182
203
|
// Removing this will break the filter in the sidebar
|
|
183
204
|
sidebar-filter[data-filtering] igc-tree[data-variant='sidebar'] igc-tree-item[data-path]:not([data-filter-match]) {
|
|
184
|
-
display: none;
|
|
205
|
+
display: none;
|
|
185
206
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@use '../../styles/global/breakpoints' as *;
|
|
1
2
|
@use 'igniteui-theming/sass/typography/functions' as *;
|
|
2
3
|
|
|
3
4
|
/*
|
|
@@ -48,11 +49,19 @@
|
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
|
|
52
|
+
:global(.globalnav__mobile-menu) {
|
|
53
|
+
top: -1px;
|
|
54
|
+
}
|
|
55
|
+
|
|
51
56
|
// Class names below come from the injected headerHtml / static fallback markup.
|
|
52
57
|
// CSS Modules would hash them, breaking the match — :global() prevents that.
|
|
53
58
|
:global(.globalnav__primary) {
|
|
54
|
-
padding-inline: rem(
|
|
59
|
+
padding-inline: rem(16px);
|
|
55
60
|
border-bottom: var(--igd-app-outline) !important;
|
|
61
|
+
|
|
62
|
+
@media (max-width: #{$bp-tablet-max}) {
|
|
63
|
+
padding-inline-end: 0;
|
|
64
|
+
}
|
|
56
65
|
}
|
|
57
66
|
|
|
58
67
|
:global(.navbar-inverse) {
|
|
@@ -181,6 +190,12 @@
|
|
|
181
190
|
padding: 0;
|
|
182
191
|
}
|
|
183
192
|
|
|
193
|
+
:global(.globalnav__brand) {
|
|
194
|
+
@media (max-width: #{$bp-tablet-max}) {
|
|
195
|
+
margin-inline-start: 0;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
184
199
|
@media only screen and (min-width: 961px) {
|
|
185
200
|
[data-mega-menu='true'] :global(.globalnav__primary) :global(.globalnav__wrapper) {
|
|
186
201
|
position: static;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
import './LicenseIndicator.scss';
|
|
3
|
+
|
|
4
|
+
export interface Props {
|
|
5
|
+
/** 'premium' shows a purple Premium badge; 'opensource' shows a green Open Source badge; false/undefined hides the badge. */
|
|
6
|
+
license?: 'premium' | 'opensource' | false;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { license } = Astro.props;
|
|
10
|
+
const label = license === 'premium' ? 'Premium' : 'Open Source';
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
{license && (
|
|
14
|
+
<igc-badge class={`sidebar-badge ${license}`}>
|
|
15
|
+
<span>{label}</span>
|
|
16
|
+
|
|
17
|
+
{license === 'premium' && <igc-icon name="premium" collection="docs" class="sidebar-premium-icon" aria-hidden="true"></igc-icon>}
|
|
18
|
+
</igc-badge>
|
|
19
|
+
)}
|
|
@@ -17,10 +17,12 @@ import './Search.scss';
|
|
|
17
17
|
class="search-trigger"
|
|
18
18
|
aria-label="Search documentation"
|
|
19
19
|
title="Search (Ctrl+K)"
|
|
20
|
+
commandfor="search-dialog"
|
|
21
|
+
command="show-modal"
|
|
20
22
|
>
|
|
21
23
|
<igc-icon name="search" collection="docs" aria-hidden="true"></igc-icon>
|
|
22
24
|
<span class="search-trigger__label">Search</span>
|
|
23
|
-
<
|
|
25
|
+
<kbd class="search-trigger__hint" style="display:none;"><kbd>Ctrl</kbd><kbd>K</kbd></kbd>
|
|
24
26
|
</button>
|
|
25
27
|
|
|
26
28
|
<script>
|
|
@@ -30,7 +32,8 @@ import './Search.scss';
|
|
|
30
32
|
</script>
|
|
31
33
|
|
|
32
34
|
<dialog id="search-dialog" class="search-dialog" aria-label="Search">
|
|
33
|
-
<div class="search-
|
|
35
|
+
<div class="igd-search-shell">
|
|
36
|
+
<div class="igd-search-status" aria-live="polite"></div>
|
|
34
37
|
<div id="search-pagefind"></div>
|
|
35
38
|
</div>
|
|
36
39
|
</dialog>
|
|
@@ -43,13 +46,10 @@ import './Search.scss';
|
|
|
43
46
|
// State is kept on `window` so it survives re-executions.
|
|
44
47
|
const _w = window as any;
|
|
45
48
|
|
|
46
|
-
async function
|
|
49
|
+
async function loadAndMountPagefind() {
|
|
47
50
|
const dialog = document.getElementById('search-dialog') as HTMLDialogElement | null;
|
|
48
51
|
if (!dialog) return;
|
|
49
52
|
|
|
50
|
-
// Load pagefind-ui.js only once — it's an IIFE that sets window.PagefindUI.
|
|
51
|
-
// Checking window.PagefindUI avoids appending a duplicate <script> tag whose
|
|
52
|
-
// onload never fires (cached scripts don't re-trigger onload).
|
|
53
53
|
if (!_w.PagefindUI) {
|
|
54
54
|
try {
|
|
55
55
|
const link = Object.assign(document.createElement('link'), {
|
|
@@ -69,12 +69,10 @@ import './Search.scss';
|
|
|
69
69
|
console.error('[Search] pagefind failed to load:', err);
|
|
70
70
|
const el = document.getElementById('search-pagefind');
|
|
71
71
|
if (el) el.textContent = 'Search index not available — run a production build first.';
|
|
72
|
-
dialog.showModal();
|
|
73
72
|
return;
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
75
|
|
|
77
|
-
// Mount the UI if the container is empty (first open, or after DOM swap).
|
|
78
76
|
const container = document.getElementById('search-pagefind');
|
|
79
77
|
if (container && !container.firstChild) {
|
|
80
78
|
try {
|
|
@@ -91,21 +89,41 @@ import './Search.scss';
|
|
|
91
89
|
}
|
|
92
90
|
}
|
|
93
91
|
|
|
94
|
-
dialog.showModal();
|
|
95
92
|
requestAnimationFrame(() => {
|
|
96
93
|
(dialog.querySelector('input') as HTMLInputElement | null)?.focus();
|
|
97
94
|
});
|
|
98
95
|
}
|
|
99
96
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
async function openSearch() {
|
|
98
|
+
const dialog = document.getElementById('search-dialog') as HTMLDialogElement | null;
|
|
99
|
+
if (!dialog) return;
|
|
100
|
+
await loadAndMountPagefind();
|
|
101
|
+
dialog.showModal();
|
|
102
|
+
}
|
|
103
|
+
|
|
103
104
|
if (!_w.__searchListeners) {
|
|
104
105
|
_w.__searchListeners = true;
|
|
105
106
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (
|
|
107
|
+
function updateSearchHint() {
|
|
108
|
+
const hint = document.querySelector<HTMLElement>('kbd.search-trigger__hint');
|
|
109
|
+
if (!hint) return;
|
|
110
|
+
const isMac = /Mac|iPhone|iPod|iPad/i.test(navigator.userAgent);
|
|
111
|
+
const modKey = hint.querySelector('kbd');
|
|
112
|
+
if (modKey) modKey.textContent = isMac ? '\u2318' : 'Ctrl';
|
|
113
|
+
const btn = document.getElementById('search-trigger');
|
|
114
|
+
btn?.setAttribute('aria-keyshortcuts', isMac ? 'Meta+K' : 'Control+K');
|
|
115
|
+
btn?.setAttribute('title', isMac ? 'Search (\u2318K)' : 'Search (Ctrl+K)');
|
|
116
|
+
hint.style.display = '';
|
|
117
|
+
}
|
|
118
|
+
updateSearchHint();
|
|
119
|
+
|
|
120
|
+
// Declarative show-modal via commandfor fires a `command` event on the dialog —
|
|
121
|
+
// use it to load page find and focus the input.
|
|
122
|
+
document.addEventListener('command', async (e: Event) => {
|
|
123
|
+
const ce = e as CommandEvent;
|
|
124
|
+
if (ce.target instanceof HTMLDialogElement && ce.target.id === 'search-dialog') {
|
|
125
|
+
await loadAndMountPagefind();
|
|
126
|
+
}
|
|
109
127
|
});
|
|
110
128
|
|
|
111
129
|
// Keyboard shortcut
|
|
@@ -127,6 +145,7 @@ import './Search.scss';
|
|
|
127
145
|
document.addEventListener('astro:page-load', () => {
|
|
128
146
|
const dialog = document.getElementById('search-dialog') as HTMLDialogElement | null;
|
|
129
147
|
dialog?.close();
|
|
148
|
+
updateSearchHint();
|
|
130
149
|
});
|
|
131
150
|
}
|
|
132
151
|
</script>
|
|
@@ -1,50 +1,18 @@
|
|
|
1
|
-
@use '../../styles/global/
|
|
2
|
-
@use 'igniteui-theming/sass/typography' as *;
|
|
1
|
+
@use '../../styles/global/search-shared' as *;
|
|
3
2
|
|
|
4
|
-
.search-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
max-width: rem(330px);
|
|
9
|
-
display: flex;
|
|
10
|
-
height: 100%;
|
|
11
|
-
align-items: center;
|
|
3
|
+
.search-dialog {
|
|
4
|
+
@include search-dialog-base-styles;
|
|
5
|
+
background: var(--igd-layout-sections-bg);
|
|
6
|
+
color: inherit;
|
|
12
7
|
border: none;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
gap: rem(8px);
|
|
16
|
-
white-space: nowrap;
|
|
17
|
-
|
|
18
|
-
// Override native button styles
|
|
19
|
-
background-color: transparent;
|
|
20
|
-
box-shadow: none;
|
|
21
|
-
|
|
8
|
+
padding: 0;
|
|
9
|
+
|
|
22
10
|
&:focus-visible {
|
|
23
11
|
outline: none;
|
|
24
|
-
box-shadow: inset 0 0 0 1px var(--igd-accent);
|
|
25
12
|
}
|
|
26
|
-
}
|
|
27
13
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
display: flex;
|
|
34
|
-
align-items: center;
|
|
35
|
-
margin-inline-start: auto;
|
|
36
|
-
|
|
37
|
-
span {
|
|
38
|
-
@include type-style('detail-1', false) {
|
|
39
|
-
margin: 0;
|
|
40
|
-
};
|
|
14
|
+
&::backdrop {
|
|
15
|
+
@include search-dialog-backdrop;
|
|
16
|
+
@include search-dialog-backdrop-open;
|
|
41
17
|
}
|
|
42
18
|
}
|
|
43
|
-
|
|
44
|
-
.search-trigger__label {
|
|
45
|
-
@include type-style('body-2') {
|
|
46
|
-
margin: 0;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
color: var(--ig-gray-600);
|
|
50
|
-
}
|