igniteui-astro-components 0.0.7 → 0.0.9

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.
Files changed (54) hide show
  1. package/package.json +4 -2
  2. package/src/assets/icons/open-link-blank.svg +1 -1
  3. package/src/assets/logos/code-sandbox.svg +14 -0
  4. package/src/assets/logos/stackblitz.svg +13 -0
  5. package/src/components/DocsBreadcrumb/DocsBreadcrumb.astro +3 -3
  6. package/src/components/DocsBreadcrumb/DocsBreadcrumb.scss +13 -4
  7. package/src/components/DocsSidebar/DocsSidebar.astro +19 -8
  8. package/src/components/DocsSidebar/DocsSidebar.scss +140 -3
  9. package/src/components/DocsSidebar/SidebarFilterInput.astro +3 -4
  10. package/src/components/DocsSidebar/SidebarFilterInput.scss +9 -6
  11. package/src/components/DocsSidebar/SidebarLabel.astro +25 -4
  12. package/src/components/DocsSidebar/toTreeNodes.ts +1 -1
  13. package/src/components/DocsSubHeader/DocsSubHeader.astro +128 -302
  14. package/src/components/DocsSubHeader/DocsSubHeader.scss +115 -18
  15. package/src/components/DocsToc/DocsToc.astro +15 -7
  16. package/src/components/DocsToc/DocsToc.scss +10 -11
  17. package/src/components/DocsTree/DocsTree.astro +9 -0
  18. package/src/components/DocsTree/docs-tree.scss +146 -118
  19. package/src/components/GlobalNavBar/GlobalNavBar.module.scss +16 -1
  20. package/src/components/LicenseIndicator/LicenseIndicator.astro +19 -0
  21. package/src/components/LicenseIndicator/LicenseIndicator.scss +5 -0
  22. package/src/components/MobileTocToggle/MobileTocToggle.astro +96 -0
  23. package/src/components/MobileTocToggle/MobileTocToggle.scss +74 -0
  24. package/src/components/Search/Search.astro +45 -15
  25. package/src/components/Search/Search.scss +21 -40
  26. package/src/components/SearchAdvanced/SearchAdvanced.astro +196 -355
  27. package/src/components/SearchAdvanced/SearchAdvanced.scss +208 -0
  28. package/src/components/mdx/ApiRef/README.md +1 -1
  29. package/src/components/mdx/DocsAside/DocsAside.astro +37 -32
  30. package/src/components/mdx/DocsAside/DocsAside.scss +106 -35
  31. package/src/components/mdx/Sample/Sample.astro +55 -45
  32. package/src/components/mdx/Sample/Sample.scss +173 -30
  33. package/src/integration.ts +7 -0
  34. package/src/layouts/DocsLayout/DocsLayout.astro +81 -21
  35. package/src/layouts/DocsLayout/DocsLayout.scss +251 -46
  36. package/src/lib/sidebar/helpers.ts +14 -1
  37. package/src/lib/sidebar/types.ts +5 -7
  38. package/src/plugins/rehype-heading-anchors.ts +74 -0
  39. package/src/plugins/rehype-table-wrapper.ts +49 -0
  40. package/src/plugins/remark-docfx.ts +0 -0
  41. package/src/scripts/sample-widget.ts +107 -114
  42. package/src/styles/global/_breakpoints.scss +15 -37
  43. package/src/styles/global/_code-blocks.scss +1 -1
  44. package/src/styles/global/_component-themes.scss +99 -18
  45. package/src/styles/global/_index.scss +2 -2
  46. package/src/styles/global/_markdown.scss +552 -78
  47. package/src/styles/global/_palette.scss +8 -0
  48. package/src/styles/global/_search-shared.scss +272 -0
  49. package/src/styles/global/_type-scale.scss +2 -2
  50. package/src/styles/global/_variables.scss +55 -13
  51. package/src/styles/theme.scss +98 -11
  52. package/src/assets/icons/copy-clipboard.svg +0 -3
  53. package/src/assets/icons/filter-clear.svg +0 -1
  54. package/src/styles/custom.scss +0 -20
@@ -1,6 +1,13 @@
1
1
  @use '../../styles/global/breakpoints' as *;
2
2
  @use 'igniteui-theming/sass/typography/functions' as *;
3
3
 
4
+ // ────────────────────────────────────────────────────────────────────────────
5
+ // Base (desktop-default) styles. Responsive overrides live in the
6
+ // "RESPONSIVE" section at the bottom of this file — that is the single
7
+ // place where every breakpoint-driven rule for the docs layout (and the
8
+ // components it contains) is defined.
9
+ // ────────────────────────────────────────────────────────────────────────────
10
+
4
11
  .igd-page-layout {
5
12
  display: grid;
6
13
  grid-template-columns: var(--igd-page-layout-grid);
@@ -8,16 +15,7 @@
8
15
  color: var(--igd-on-app-bg);
9
16
  margin: 0;
10
17
  z-index: 0;
11
-
12
- @media (min-width: #{$bp-tablet-min}) {
13
- justify-content: center;
14
- padding-inline: 0;
15
- }
16
-
17
- @media (max-width: #{$bp-mobile-horizontal-max}) {
18
- padding-inline: rem(32px);
19
- }
20
-
18
+
21
19
  &:not(:has(.igd-right-sidebar)) {
22
20
  .igd-main-pane {
23
21
  > main {
@@ -29,17 +27,8 @@
29
27
 
30
28
  .igd-main-content {
31
29
  display: grid;
32
- padding-inline: rem(32px);
33
30
  position: relative;
34
-
35
- @media (min-width: #{$bp-tablet-min}) {
36
- padding-inline: 0;
37
- }
38
-
39
- @media (max-width: #{$bp-mobile-horizontal-max}) {
40
- padding-inline: rem(32px);
41
- }
42
-
31
+
43
32
  &:not(:has(.igd-right-sidebar)) {
44
33
  .igd-main-pane {
45
34
  > main {
@@ -47,7 +36,7 @@
47
36
  }
48
37
  }
49
38
  }
50
-
39
+
51
40
  // ── Static square grid background ────────────────────────────────────────────
52
41
  // Pure CSS: two repeating-linear-gradients intersected via mask-composite
53
42
  // create 4×4px squares at a 35px grid pitch.
@@ -60,40 +49,34 @@
60
49
  pointer-events: none;
61
50
  user-select: none;
62
51
  z-index: 0;
63
-
52
+
64
53
  $pitch: 35px;
65
54
  $sq: 3px;
66
55
  $pad: 15.5px;
67
-
56
+
68
57
  background-color: light-dark(var(--ig-gray-500), var(--igd-accent));
69
-
70
- // Three mask layers, all intersected:
71
- // vignette ∩ horizontal-strips ∩ vertical-strips → squares that fade at the edges
58
+
59
+ // Two mask layers intersected:
60
+ // horizontal-strips ∩ vertical-strips → squares with no edge fade
72
61
  mask-image:
73
- // 1. Vignette — opaque center, transparent at edges
74
- radial-gradient(ellipse 80% 80% at 50% 40%, black 40%, transparent 100%),
75
- // 2. Horizontal 4px bands at 35px pitch (repeating-linear 0deg = top-to-bottom)
62
+ // 1. Horizontal 4px bands at 35px pitch (repeating-linear 0deg = top-to-bottom)
76
63
  repeating-linear-gradient(0deg,
77
64
  transparent 0, transparent #{$pad},
78
65
  black #{$pad}, black #{$pad + $sq},
79
66
  transparent #{$pad + $sq}, transparent #{$pitch}
80
67
  ),
81
- // 3. Vertical 4px bands at 35px pitch (repeating-linear 90deg = left-to-right)
68
+ // 2. Vertical 4px bands at 35px pitch (repeating-linear 90deg = left-to-right)
82
69
  repeating-linear-gradient(90deg,
83
70
  transparent 0, transparent #{$pad},
84
71
  black #{$pad}, black #{$pad + $sq},
85
72
  transparent #{$pad + $sq}, transparent #{$pitch}
86
73
  );
87
-
88
- mask-size: 100% 100%, #{$pitch} #{$pitch}, #{$pitch} #{$pitch};
89
- mask-composite: intersect, intersect;
90
- -webkit-mask-composite: source-in, source-in;
91
-
74
+
75
+ mask-size: #{$pitch} #{$pitch}, #{$pitch} #{$pitch};
76
+ mask-composite: intersect;
77
+ -webkit-mask-composite: source-in;
78
+
92
79
  opacity: .5;
93
-
94
- @media (max-width: #{$bp-mobile-max}) {
95
- display: none;
96
- }
97
80
  }
98
81
  }
99
82
 
@@ -102,8 +85,12 @@
102
85
  gap: var(--ig-padding);
103
86
  background-color: var(--igd-layout-sections-bg);
104
87
  border-inline: var(--igd-app-outline);
105
- width: clamp(rem(300px), 100%, rem(940px));
106
- margin-inline-start: auto;
88
+ width: clamp(rem(1000px), 100%, rem(1200px));
89
+ margin-inline: auto;
90
+ }
91
+
92
+ .igd-main-content__page + aside {
93
+ margin-inline-end: auto;
107
94
  }
108
95
 
109
96
  .igd-main-content__inner {
@@ -111,15 +98,233 @@
111
98
  gap: rem(70px);
112
99
  padding-inline: rem(70px) rem(32px);
113
100
  position: relative;
114
-
115
- aside {
116
- margin-inline-end: auto;
101
+
102
+ &:has(aside) {
103
+ .igd-main-content__page {
104
+ margin-inline-end: 0;
105
+ }
117
106
  }
118
107
  }
119
108
 
120
109
  .content {
121
110
  max-width: 60rem;
122
111
  margin: 0 auto;
123
- padding-inline: var(--igd-page-padding);
124
- padding-block-end: var(--igd-page-padding);
112
+ padding: 0;
113
+ }
114
+
115
+ // ════════════════════════════════════════════════════════════════════════════
116
+ // RESPONSIVE — 3 viewport tiers
117
+ //
118
+ // mobile: < 768px (max-width: $bp-mobile-max)
119
+ // tablet: 768–1279px (max-width: $bp-tablet-max / min-width: $bp-tablet-min)
120
+ // desktop: ≥ 1280px (default — no media query)
121
+ //
122
+ // This is the single source of truth for every responsive rule that affects
123
+ // the docs layout and the components rendered inside `.igd-page-layout`.
124
+ // ════════════════════════════════════════════════════════════════════════════
125
+
126
+
127
+ @media (max-width: #{$bp-reduce-sidebar}) {
128
+ .igd-page-layout {
129
+ --igd-page-layout-grid: #{minmax(rem(200px), rem(290px)) 1fr};
130
+ }
131
+
132
+ .igd-main-content__inner {
133
+ padding-inline: rem(26px) 0;
134
+ gap: rem(26px);
135
+ }
136
+ }
137
+
138
+ // ── Mobile + Tablet (< 1280px) — everything below desktop ──────────────────
139
+ @media (max-width: #{$bp-tablet-max}) {
140
+ :root {
141
+ --igd-header-height: #{rem(50px)};
142
+ --igd-page-padding: #{rem(38px)};
143
+ }
144
+
145
+ // Single-column page grid; subheader follows via subgrid.
146
+ .igd-page-layout {
147
+ --igd-page-layout-grid: 1fr;
148
+ }
149
+
150
+ .igd-main-content {
151
+ grid-row: 2;
152
+ }
153
+
154
+ // Logo only shown on desktop, where it can sit in its own sidebar-aligned column.
155
+ .igd-logo {
156
+ display: none;
157
+ }
158
+
159
+ // Search: collapse trigger to icon-only and reveal the mobile-only close UI.
160
+ .search-trigger {
161
+ max-width: none;
162
+ width: auto;
163
+ }
164
+
165
+ .search-trigger__label,
166
+ .search-trigger__lable,
167
+ .search-trigger__hint {
168
+ display: none;
169
+ }
170
+
171
+ .igd-search-mobile-bar {
172
+ display: flex;
173
+ }
174
+
175
+ // Sidebar becomes a fixed slide-in overlay, hidden off-screen by default.
176
+ .docs-sidebar {
177
+ --igd-sidebar-z-index: 1000;
178
+
179
+ position: fixed;
180
+ inset-block: 0;
181
+ inset-inline-start: 0;
182
+ height: 100dvh;
183
+ max-height: 100dvh;
184
+ width: min(rem(360px), 85vw);
185
+ transform: translateX(-100%);
186
+ transition: transform 250ms ease, box-shadow 250ms ease;
187
+ box-shadow: none;
188
+ }
189
+
190
+ .docs-sidebar-backdrop {
191
+ display: block;
192
+ position: fixed;
193
+ inset: 0;
194
+ z-index: 99;
195
+ background: light-dark(var(--ig-gray-900), var(--ig-gray-100));
196
+ opacity: 0;
197
+ pointer-events: none;
198
+ transition: opacity 250ms ease;
199
+ }
200
+
201
+ body[data-sidebar-open] {
202
+ overflow: hidden;
203
+
204
+ .docs-sidebar {
205
+ transform: translateX(0);
206
+ box-shadow: var(--ig-elevation-8);
207
+ }
208
+
209
+ .docs-sidebar-backdrop {
210
+ opacity: .6;
211
+ pointer-events: auto;
212
+ backdrop-filter: blur(10px);
213
+ }
214
+ }
215
+
216
+ // Subheader sidebar toggle reveals when the sidebar is not persistent.
217
+ .subheader-sidebar-toggle {
218
+ display: flex;
219
+ flex-shrink: 0;
220
+ }
221
+
222
+ // Logo inside the slide-in sidebar (visible only when sidebar is an overlay).
223
+ .sidebar-logo {
224
+ display: flex;
225
+ margin-block-end: rem(16px);
226
+ }
227
+
228
+ .igd-main-content__inner {
229
+ padding-inline: 0;
230
+ }
231
+
232
+ // This is the height of the input in fluent theme + 8px padding + height of the logo above
233
+ .sidebar-gutter {
234
+ min-height: rem(80px);
235
+ }
236
+ }
237
+
238
+ // ── Mobile only (< 768px) ──────────────────────────────────────────────────
239
+ @media (max-width: #{$bp-mobile-max}) {
240
+ .igd-main-content::before {
241
+ display: none;
242
+ }
243
+
244
+ .igd-version-select {
245
+ max-width: rem(90px);
246
+ }
247
+
248
+ .igd-docs-subheader {
249
+ padding-inline-end: rem(16px);
250
+ }
251
+
252
+ .igd-docs-subheader__content:last-child {
253
+ margin-inline-end: 0;
254
+ }
255
+
256
+ .mobile-toc {
257
+ display: block;
258
+ position: sticky;
259
+ top: var(--igd-header-height);
260
+ z-index: 10;
261
+ grid-column: 1 / -1;
262
+ border-block-end: var(--igd-app-outline);
263
+ background-color: var(--igd-layout-sections-bg);
264
+ }
265
+
266
+ .igd-main-content__markdown {
267
+ padding-inline: rem(32px);
268
+ }
269
+
270
+ // Search dialog goes fullscreen on mobile only.
271
+ // `.igd-page-layout` prefix bumps specificity so this beats the
272
+ // centered-card base styles declared in Search.scss / SearchAdvanced.scss
273
+ // (those files load after this one in the Astro bundle).
274
+ .igd-page-layout .search-dialog,
275
+ .igd-page-layout .igd-search-dialog::part(base) {
276
+ margin: 0;
277
+ width: 100%;
278
+ max-width: 100%;
279
+ height: 100dvh;
280
+ max-height: 100dvh;
281
+ border-radius: 0;
282
+ }
283
+
284
+ .search-trigger.search-close {
285
+ display: flex;
286
+ flex-shrink: 0;
287
+ padding-inline: var(--igd-padding-sm);
288
+ }
289
+
290
+ igc-input {
291
+ &::part(container) {
292
+ &:focus-within {
293
+ box-shadow:
294
+ 0 0 0 1px var(--igd-accent),
295
+ inset 0 1px 0 var(--igd-accent),
296
+ inset 0 -1px 0 var(--igd-accent),
297
+ -1px 0 0 var(--igd-accent);
298
+ }
299
+ }
300
+ }
301
+ }
302
+
303
+ @media (max-width: #{$bp-hide-toc}) {
304
+ .igd-main-content__inner {
305
+ aside {
306
+ display: none;
307
+ }
308
+ }
309
+
310
+
311
+ .igd-main-content__page {
312
+ border: none;
313
+ }
314
+ }
315
+
316
+ // ── Tablet + Desktop (≥ 768px) ─────────────────────────────────────────────
317
+ @media (min-width: #{$bp-tablet-min}) {
318
+ .igd-page-layout {
319
+ justify-content: center;
320
+ }
321
+
322
+ .igd-package-select::part(native-input),
323
+ .igd-version-select::part(native-input) {
324
+ field-sizing: content;
325
+
326
+ &::part(base) {
327
+ min-width: 100%;
328
+ }
329
+ }
125
330
  }
@@ -3,7 +3,7 @@
3
3
  * Shared by the SSR components and any consumer that walks the tree.
4
4
  */
5
5
 
6
- import type { SidebarEntry, SidebarGroup } from './types';
6
+ import type { SidebarEntry, SidebarGroup, SidebarLink } from './types';
7
7
 
8
8
  export const isGroup = (e: SidebarEntry): e is SidebarGroup => 'items' in e;
9
9
 
@@ -69,6 +69,19 @@ export const getActiveLabel = (items: SidebarEntry[], currentSlug: string): stri
69
69
  return '';
70
70
  };
71
71
 
72
+ /** Returns the active SidebarLink for the current slug, or null if not found. */
73
+ export const getActiveLink = (items: SidebarEntry[], currentSlug: string): SidebarLink | null => {
74
+ for (const item of items) {
75
+ if (isGroup(item)) {
76
+ const found = getActiveLink(item.items, currentSlug);
77
+ if (found) return found;
78
+ } else if (isActive(item.slug, currentSlug)) {
79
+ return item;
80
+ }
81
+ }
82
+ return null;
83
+ };
84
+
72
85
  /**
73
86
  * Breadcrumb for the current page, starting **below** the root group (root is
74
87
  * dropped — UI shows the site title there) and ending with the active item's
@@ -7,12 +7,10 @@
7
7
  */
8
8
 
9
9
  export type SidebarBadgeVariant =
10
- | 'note'
11
- | 'danger'
12
- | 'success'
13
- | 'caution'
14
- | 'tip'
15
- | 'default';
10
+ | 'new'
11
+ | 'updated'
12
+ | 'preview'
13
+ | 'premium';
16
14
 
17
15
  export interface SidebarBadge {
18
16
  text: string;
@@ -22,7 +20,7 @@ export interface SidebarBadge {
22
20
  export interface SidebarLink {
23
21
  label: string;
24
22
  slug: string;
25
- badge?: SidebarBadge;
23
+ badges?: SidebarBadge[];
26
24
  attrs?: Record<string, string | number | boolean | undefined>;
27
25
  }
28
26
 
@@ -0,0 +1,74 @@
1
+ import { visit } from 'unist-util-visit';
2
+ import Slugger from 'github-slugger';
3
+
4
+ const HEADING_TAGS = new Set(['h2', 'h3', 'h4', 'h5', 'h6']);
5
+
6
+ // Extract the text content of a hast node (ignores child elements, reads text/raw nodes).
7
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
+ function textContent(node: any): string {
9
+ let text = '';
10
+ visit(node, (child) => {
11
+ if (child.type === 'text' || child.type === 'raw') text += child.value ?? '';
12
+ });
13
+ return text;
14
+ }
15
+
16
+ /**
17
+ * Rehype plugin that appends a copy-link icon button to every heading
18
+ * (h2–h6).
19
+ *
20
+ * Runs before Astro's internal `rehypeHeadingIds` pass so it must
21
+ * generate its own slug using the same `github-slugger` algorithm.
22
+ * If the heading already has an `id` (e.g. set in raw HTML), it is reused.
23
+ * Headings without an existing id get one assigned here — `rehypeHeadingIds`
24
+ * will then see the id already present and skip re-assigning it, ensuring
25
+ * the button href and the heading's id always match.
26
+ */
27
+ export function rehypeHeadingAnchors() {
28
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
+ return (tree: any) => {
30
+ const slugger = new Slugger();
31
+
32
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
+ visit(tree, 'element', (node: any) => {
34
+ if (!HEADING_TAGS.has(node.tagName)) return;
35
+
36
+ node.properties ??= {};
37
+
38
+ // Reuse an existing id or generate one from heading text.
39
+ if (typeof node.properties.id !== 'string') {
40
+ node.properties.id = slugger.slug(textContent(node));
41
+ } else {
42
+ // Keep slugger in sync so it doesn't generate duplicate ids.
43
+ slugger.slug(node.properties.id);
44
+ }
45
+
46
+ const id = node.properties.id as string;
47
+
48
+ const iconButton = {
49
+ type: 'element',
50
+ tagName: 'igc-icon-button',
51
+ properties: {
52
+ class: 'igd-anchor-link',
53
+ href: `#${id}`,
54
+ variant: 'flat',
55
+ 'aria-label': 'Link to this section',
56
+ tabIndex: 0,
57
+ },
58
+ children: [
59
+ {
60
+ type: 'element',
61
+ tagName: 'igc-icon',
62
+ properties: {
63
+ name: 'link',
64
+ collection: 'docs',
65
+ },
66
+ children: [],
67
+ },
68
+ ],
69
+ };
70
+
71
+ node.children.push(iconButton);
72
+ });
73
+ };
74
+ }
@@ -0,0 +1,49 @@
1
+ import { visit } from 'unist-util-visit';
2
+
3
+ let _counter = 0;
4
+
5
+ /**
6
+ * Rehype plugin that wraps every <table> in a scroll container div.
7
+ * The wrapper is fully accessible per the recommendations in:
8
+ * https://piccalil.li/blog/styling-tables-the-modern-css-way/
9
+ *
10
+ * - role="region" + aria-labelledby pointing to the <caption> (or a generated id)
11
+ * - tabindex="0" makes the scroll region keyboard-focusable
12
+ */
13
+ export function rehypeTableWrapper() {
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
+ return (tree: any) => {
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
+ visit(tree, 'element', (node: any, index: number | undefined, parent: any) => {
18
+ if (node.tagName !== 'table' || !parent || index == null) return;
19
+
20
+ // Find an existing <caption> to use as the accessible label.
21
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
+ const caption = node.children?.find((c: any) => c.tagName === 'caption');
23
+ let labelId: string;
24
+
25
+ if (caption) {
26
+ // Reuse or assign an id on the caption element.
27
+ labelId = caption.properties?.id || `igd-table-caption-${++_counter}`;
28
+ caption.properties = { ...caption.properties, id: labelId };
29
+ } else {
30
+ // No caption — generate a unique id for the wrapper itself.
31
+ labelId = `igd-table-${++_counter}`;
32
+ }
33
+
34
+ const wrapper = {
35
+ type: 'element',
36
+ tagName: 'div',
37
+ properties: {
38
+ className: ['igd-table-wrapper'],
39
+ role: 'region',
40
+ 'aria-labelledby': labelId,
41
+ tabIndex: 0,
42
+ },
43
+ children: [node],
44
+ };
45
+
46
+ parent.children[index] = wrapper;
47
+ });
48
+ };
49
+ }
File without changes