igniteui-astro-components 0.0.10 → 0.0.12

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "igniteui-astro-components",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "Reusable Astro components, layouts, and integrations for Infragistics / Ignite UI documentation sites. Replaces the Starlight defaults with project-specific implementations.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -1,155 +1,178 @@
1
1
  @use 'igniteui-theming/sass/typography' as *;
2
2
 
3
3
  @layer components {
4
-
5
- // Desktop base. On tablet/mobile DocsLayout.scss turns this into a slide-in overlay.
6
- .docs-sidebar {
7
- --igd-sidebar-z-index: 0;
8
- display: flex;
9
- flex-direction: column;
10
- z-index: var(--igd-sidebar-z-index);
11
- border-inline-end: var(--igd-app-outline);
12
- padding-inline: var(--igd-padding-md);
13
- padding-block: calc(var(--igd-padding-lg) + rem(14px));
14
- background-color: var(--igd-layout-sections-bg);
15
- position: sticky;
16
- top: var(--igd-header-height);
17
- height: calc(100dvh - var(--igd-header-height));
18
- max-height: 100dvh;
19
- align-self: start;
20
- gap: rem(24px);
21
-
22
- .sidebar-gutter {
23
- overflow-y: hidden;
4
+ // Desktop base. On tablet/mobile DocsLayout.scss turns this into a slide-in overlay.
5
+ .docs-sidebar {
6
+ --igd-sidebar-z-index: 0;
7
+ display: flex;
8
+ flex-direction: column;
9
+ z-index: var(--igd-sidebar-z-index);
10
+ border-inline-end: var(--igd-app-outline);
11
+ padding-inline: var(--igd-padding-md);
12
+ padding-block: calc(var(--igd-padding-lg) + rem(14px));
13
+ background-color: var(--igd-layout-sections-bg);
14
+ position: sticky;
15
+ top: var(--igd-header-height);
16
+ height: calc(100dvh - var(--igd-header-height));
17
+ max-height: 100dvh;
18
+ align-self: start;
19
+ gap: rem(24px);
20
+
21
+ .sidebar-gutter {
22
+ overflow-y: hidden;
23
+ scrollbar-gutter: stable;
24
+
25
+ // This Makes sure the input border is visible
26
+ // This is the height of the input in fluent theme + 8px padding
27
+ // TODO this can be made smart using a css variable to override the original height of the input and used here
28
+ min-height: rem(40px);
29
+
30
+
31
+ igc-icon {
32
+ color: light-dark(var(--ig-gray-800), var(--ig-gray-300));
33
+ }
34
+
35
+ &:empty {
36
+ display: none;
37
+ }
38
+ }
39
+ }
40
+
41
+ // Hidden by default. DocsLayout.scss reveals it on tablet/mobile when the sidebar is open.
42
+ .docs-sidebar-backdrop {
43
+ display: none;
44
+ }
45
+
46
+ .sidebar-logo {
47
+ display: none;
48
+ margin-block-end: rem(8px);
49
+ padding-inline-start: rem(20px);
50
+
51
+ > svg {
52
+ width: rem(79px);
53
+
54
+ .logo-type {
55
+ fill: var(--igd-logo-type);
56
+ }
57
+ }
58
+ }
59
+
60
+ .sidebar-scroll {
61
+ overflow-y: auto;
24
62
  scrollbar-gutter: stable;
25
-
26
- // This Makes sure the input border is visible
27
- // This is the height of the input in fluent theme + 8px padding
28
- // TODO this can be made smart using a css variable to override the original height of the input and used here
29
- min-height: rem(40px);
30
-
31
-
63
+ }
64
+
65
+ .sidebar-badge {
66
+ --border-radius: #{rem(4px)};
67
+ --elevation: none;
68
+
69
+ &::part(base) {
70
+ @include type-style('overline') {
71
+ margin: 0;
72
+ };
73
+
74
+ border-radius: var(--border-radius);
75
+ border-width: rem(1px);
76
+ border-style: solid;
77
+ border-color: var(--border-color);
78
+ }
79
+
32
80
  igc-icon {
33
- color: light-dark(var(--ig-gray-800), var(--ig-gray-300));
81
+ --size: #{rem(18px)}
34
82
  }
35
-
36
- &:empty {
37
- display: none;
83
+
84
+ // TODO, This has to be fixed inside the component
85
+ span {
86
+ position: relative;
87
+ padding-inline: rem(3px);
38
88
  }
39
89
  }
40
- }
41
-
42
- // Hidden by default. DocsLayout.scss reveals it on tablet/mobile when the sidebar is open.
43
- .docs-sidebar-backdrop {
44
- display: none;
45
- }
46
-
47
- .sidebar-logo {
48
- display: none;
49
- margin-block-end: rem(8px);
50
- padding-inline-start: rem(20px);
51
-
52
- > svg {
53
- width: rem(79px);
54
-
55
- .logo-type {
56
- fill: var(--igd-logo-type);
90
+
91
+ .updated {
92
+ --background-color: var(--igd-updated-bg);
93
+ --text-color: var(--igd-updated-color);
94
+ --icon-color: var(--igd-updated-color);
95
+ --border-color: var(--igd-updated-border);
96
+ }
97
+
98
+ .new {
99
+ --background-color: var(--igd-new-bg);
100
+ --text-color: var(--igd-new-color);
101
+ --icon-color: var(--igd-new-color);
102
+ --border-color: var(--igd-new-border);
103
+ }
104
+
105
+ .preview {
106
+ --background-color: var(--igd-preview-bg);
107
+ --text-color: var(--igd-preview-color);
108
+ --icon-color: var(--igd-preview-color);
109
+ --border-color: var(--igd-preview-border);
110
+ }
111
+
112
+ .premium {
113
+ --background-color: var(--igd-premium-bg);
114
+ --text-color: var(--igd-premium-color);
115
+ --icon-color: var(--igd-premium-color);
116
+ --border-color: var(--igd-premium-border);
117
+ }
118
+
119
+ .opensource {
120
+ --background-color: var(--igd-opensource-bg);
121
+ --text-color: var(--igd-opensource-color);
122
+ --icon-color: var(--igd-opensource-color);
123
+ --border-color: var(--igd-opensource-border);
124
+ }
125
+
126
+ .sidebar-premium-icon {
127
+ --size: #{rem(24px)};
128
+
129
+ justify-self: end;
130
+ color: var(--igd-premium-color);
131
+ flex-shrink: 0;
132
+ }
133
+
134
+ .igd-label-and-badge {
135
+ display: flex;
136
+ align-items: center;
137
+ gap: rem(8px);
138
+
139
+ igc-badge {
140
+ justify-self: end;
57
141
  }
58
142
  }
59
- }
60
-
61
- .sidebar-scroll {
62
- overflow-y: auto;
63
- scrollbar-gutter: stable;
64
- }
65
-
66
- .sidebar-badge {
67
- --border-radius: #{rem(4px)};
68
- --elevation: none;
69
143
 
70
- &::part(base) {
71
- @include type-style('overline') {
72
- margin: 0;
144
+ .docs-tree-group {
145
+ gap: rem(8px);
146
+ }
147
+
148
+ .group-label-text {
149
+ @include type-style('body-2') {
150
+ margin-block: 0;
73
151
  };
74
152
 
75
- border-radius: var(--border-radius);
76
- border-width: rem(1px);
77
- border-style: solid;
78
- border-color: var(--border-color);
153
+ color: light-dark(var(--ig-gray-800), var(--ig-gray-600));
154
+
155
+ &:hover {
156
+ color: var(--igd-accent);
157
+ }
79
158
  }
80
- }
81
-
82
- .updated {
83
- --background-color: var(--igd-updated-bg);
84
- --text-color: var(--igd-updated-color);
85
- --icon-color: var(--igd-updated-color);
86
- --border-color: var(--igd-updated-border);
87
- }
88
-
89
- .new {
90
- --background-color: var(--igd-new-bg);
91
- --text-color: var(--igd-new-color);
92
- --icon-color: var(--igd-new-color);
93
- --border-color: var(--igd-new-border);
94
- }
95
-
96
- .preview {
97
- --background-color: var(--igd-preview-bg);
98
- --text-color: var(--igd-preview-color);
99
- --icon-color: var(--igd-preview-color);
100
- --border-color: var(--igd-preview-border);
101
- }
102
-
103
-
104
- .premium {
105
- --background-color: var(--igd-premium-bg);
106
- --text-color: var(--igd-premium-color);
107
- --icon-color: var(--igd-premium-color);
108
- --border-color: var(--igd-premium-border);
109
- }
110
-
111
- .opensource {
112
- --background-color: var(--igd-opensource-bg);
113
- --text-color: var(--igd-opensource-color);
114
- --icon-color: var(--igd-opensource-color);
115
- --border-color: var(--igd-opensource-border);
116
- }
117
-
118
- .sidebar-premium-icon {
119
- justify-self: end;
120
- color: var(--igd-premium-color);
121
- flex-shrink: 0;
122
- }
123
-
124
- .igd-lable-and-badge {
125
- display: flex;
126
- align-items: center;
127
- gap: rem(4px);
128
159
 
129
- igc-badge {
130
- justify-self: end;
160
+ igc-tree-item[active] {
161
+ .group-label-text {
162
+ color: var(--igd-accent);
163
+ }
131
164
  }
132
- }
133
-
134
- .group-label-text {
135
- @include type-style('body-2') {
136
- margin: 0;
137
- };
138
165
 
139
- color: light-dark(var(--ig-gray-800), var(--ig-gray-600));
140
- }
141
-
142
- .group-label-count {
143
- color: light-dark(var(--ig-gray-500), var(--ig-gray-600));
144
- margin-inline-start: rem(8px)
145
- }
146
-
147
- .igd-badge-container {
148
- display: flex;
149
- align-items: center;
150
- gap: rem(4px);
151
- margin-left: auto;
152
- }
153
-
166
+ .group-label-count {
167
+ color: light-dark(var(--ig-gray-500), var(--ig-gray-600));
168
+ margin-inline-start: rem(8px)
169
+ }
170
+
171
+ .igd-badge-container {
172
+ display: flex;
173
+ align-items: center;
174
+ gap: rem(4px);
175
+ margin-left: auto;
176
+ }
154
177
  }
155
178
 
@@ -28,13 +28,13 @@ const badges = (node.meta?.badges ?? []) as SidebarBadge[];
28
28
 
29
29
  {isLeaf ? (
30
30
  <>
31
- <div class="igd-lable-and-badge">
31
+ <div class="igd-label-and-badge">
32
32
  <span class="docs-tree-label">{node.label}</span>
33
33
  {badges.length > 0 && (
34
34
  <div class="igd-badge-container">
35
35
  {badges.filter(b => b.variant !== 'premium').map((badge) => (
36
36
  <>
37
- <igc-badge class={`sidebar-badge ${badge.variant}`} aria-hidden="true">{badge.text}</igc-badge>
37
+ <igc-badge class={`sidebar-badge ${badge.variant}`} aria-hidden="true"><span>{badge.text}</span></igc-badge>
38
38
  <span class="visually-hidden">, {badge.text}</span>
39
39
  </>
40
40
  ))}
@@ -14,7 +14,7 @@
14
14
  max-height: calc(100vh - var(--igd-header-height));
15
15
  overflow-y: auto;
16
16
  padding: rem(46px) rem(24px);
17
- border-inline: var(--igd-app-outline);
17
+ border-inline-end: var(--igd-app-outline);
18
18
  border-block-end: var(--igd-app-outline);
19
19
  background-color: var(--igd-layout-sections-bg);
20
20
  }
@@ -78,6 +78,36 @@ const { nodes, variant, activeId, toggleNodeOnClick, ariaLabel, renderLabel } =
78
78
  selectActiveTreeItem();
79
79
  document.addEventListener('astro:page-load', selectActiveTreeItem);
80
80
 
81
+ // Restore sidebar focus when navigation was triggered from within the tree.
82
+ // Astro's ClientRouter moves focus to main content on every page-load;
83
+ // this counteracts that for keyboard users browsing the sidebar.
84
+ let focusWasInTree = false;
85
+
86
+ document.addEventListener('astro:before-preparation', () => {
87
+ focusWasInTree = !!document.activeElement?.closest('igc-tree[data-variant="sidebar"]');
88
+ });
89
+
90
+ document.addEventListener('astro:page-load', () => {
91
+ if (!focusWasInTree) return;
92
+ focusWasInTree = false;
93
+ customElements.whenDefined('igc-tree-item').then(() => {
94
+ const activeItem = document.querySelector<HTMLElement>(
95
+ 'igc-tree[data-variant="sidebar"] igc-tree-item:has(a[aria-current="page"])'
96
+ );
97
+ activeItem?.focus();
98
+ });
99
+ });
100
+
101
+ // When clicking a tree link, focus the parent igc-tree-item so that
102
+ // up/down arrow key navigation works immediately after the click.
103
+ // The <a> overlay is position:absolute and captures clicks, but igc-tree's
104
+ // keyboard handler only fires when igc-tree-item itself has focus.
105
+ document.addEventListener('click', (e) => {
106
+ const link = (e.target as Element).closest('igc-tree[data-variant="sidebar"] a.docs-tree-link');
107
+ if (!link) return;
108
+ link.closest<HTMLElement>('igc-tree-item')?.focus();
109
+ }, { capture: true });
110
+
81
111
  // Suppress the active-indicator transition during window resize so the
82
112
  // anchor-positioned ::before bar doesn't slowly slide to its new position.
83
113
  let resizeTimer: ReturnType<typeof setTimeout>;
@@ -124,6 +124,10 @@ igc-tree-item::part(label) {
124
124
  width: 100%;
125
125
  max-height: 100%;
126
126
  padding-block: rem(6px);
127
+ text-overflow: unset;
128
+ white-space: unset;
129
+ word-break: break-all;
130
+ overflow: unset;
127
131
  }
128
132
 
129
133
  igc-tree-item[data-has-children] {
@@ -136,7 +140,6 @@ igc-tree-item[data-has-children] {
136
140
 
137
141
  .tree-expand-icon {
138
142
  margin-inline-start: auto;
139
- //margin-inline-end: rem(4px);
140
143
  flex-shrink: 0;
141
144
  color: inherit;
142
145
  transform: rotate(-90deg);