@patternfly/documentation-framework 6.28.0 → 6.28.1

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 6.28.1 (2025-10-13)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **docs-framework:** remove useTheme from footer to fix theme state bug ([#4817](https://github.com/patternfly/patternfly-org/issues/4817)) ([44c02a0](https://github.com/patternfly/patternfly-org/commit/44c02a07c8ba3443429d4fa8afa5bf0014a36e27))
12
+
13
+
14
+
15
+
16
+
6
17
  # 6.28.0 (2025-10-13)
7
18
 
8
19
 
@@ -11,6 +11,7 @@ import {
11
11
  ToggleGroupItem,
12
12
  Icon,
13
13
  Divider,
14
+ Spinner,
14
15
  Label,
15
16
  Popover,
16
17
  Button
@@ -125,8 +126,10 @@ export const ThemeSelector = ({ id }) => {
125
126
  return SunIcon;
126
127
  case colorModes.DARK:
127
128
  return MoonIcon;
128
- default:
129
+ case colorModes.SYSTEM:
129
130
  return DesktopIcon;
131
+ default:
132
+ return <Spinner size="sm" />;
130
133
  }
131
134
  };
132
135
 
@@ -148,7 +151,7 @@ export const ThemeSelector = ({ id }) => {
148
151
  )}
149
152
  shouldFocusToggleOnSelect
150
153
  onOpenChangeKeys={['Escape']}
151
- popperProps={{
154
+ popperProps={{
152
155
  position: 'right',
153
156
  enableFlip: true,
154
157
  preventOverflow: true
@@ -167,35 +170,36 @@ export const ThemeSelector = ({ id }) => {
167
170
  </SelectOption>
168
171
  </SelectList>
169
172
  </SelectGroup>
170
- {process.env.hasHighContrastSwitcher && (<>
171
- <Divider />
172
- <SelectGroup label={HighContrastGroupLabel}>
173
- <MenuSearch>
174
- <MenuSearchInput>
175
- <ToggleGroup aria-label="High contrast theme switcher">
176
- <ToggleGroupItem
177
- text="System"
178
- buttonId={highContrastModes.SYSTEM}
179
- isSelected={highContrastMode === highContrastModes.SYSTEM}
180
- onChange={handleHighContrastThemeSelection}
181
- />
182
- <ToggleGroupItem
183
- text="On"
184
- buttonId={highContrastModes.ON}
185
- isSelected={highContrastMode === highContrastModes.ON}
186
- onChange={handleHighContrastThemeSelection}
187
- />
188
- <ToggleGroupItem
189
- text="Off"
190
- buttonId={highContrastModes.OFF}
191
- isSelected={highContrastMode === highContrastModes.OFF}
192
- onChange={handleHighContrastThemeSelection}
193
- />
194
- </ToggleGroup>
195
- </MenuSearchInput>
196
- </MenuSearch>
197
- </SelectGroup>
198
- </>
173
+ {process.env.hasHighContrastSwitcher && (
174
+ <>
175
+ <Divider />
176
+ <SelectGroup label="High Contrast">
177
+ <MenuSearch>
178
+ <MenuSearchInput>
179
+ <ToggleGroup aria-label="High contrast theme switcher">
180
+ <ToggleGroupItem
181
+ text="System"
182
+ buttonId={highContrastModes.SYSTEM}
183
+ isSelected={highContrastMode === highContrastModes.SYSTEM}
184
+ onChange={handleHighContrastThemeSelection}
185
+ />
186
+ <ToggleGroupItem
187
+ text="On"
188
+ buttonId={highContrastModes.ON}
189
+ isSelected={highContrastMode === highContrastModes.ON}
190
+ onChange={handleHighContrastThemeSelection}
191
+ />
192
+ <ToggleGroupItem
193
+ text="Off"
194
+ buttonId={highContrastModes.OFF}
195
+ isSelected={highContrastMode === highContrastModes.OFF}
196
+ onChange={handleHighContrastThemeSelection}
197
+ />
198
+ </ToggleGroup>
199
+ </MenuSearchInput>
200
+ </MenuSearch>
201
+ </SelectGroup>
202
+ </>
199
203
  )}
200
204
  </Select>
201
205
  );
@@ -208,6 +208,10 @@ export function attachDocSearch(algolia, inputSelector, timeout) {
208
208
  }
209
209
  }
210
210
 
211
+ function getIsDarkTheme() {
212
+ return document.documentElement.classList.contains('pf-v6-theme-dark');
213
+ }
214
+
211
215
  export const SideNavLayout = ({ children, groupedRoutes, navOpen: navOpenProp }) => {
212
216
  const algolia = process.env.algolia;
213
217
  const hasGdprBanner = process.env.hasGdprBanner;
@@ -221,8 +225,30 @@ export const SideNavLayout = ({ children, groupedRoutes, navOpen: navOpenProp })
221
225
 
222
226
  const [versions, setVersions] = useState({ ...staticVersions });
223
227
  const [isRTL, setIsRTL] = useState(false);
228
+ const [isDarkTheme, setIsDarkTheme] = useState(true);
229
+
230
+ useEffect(() => {
231
+ setIsDarkTheme(getIsDarkTheme());
224
232
 
225
- const { resolvedTheme } = useTheme(THEME_TYPES.COLOR);
233
+ const observer = new MutationObserver((mutationsList) => {
234
+ for (const mutation of mutationsList) {
235
+ if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
236
+ setIsDarkTheme(getIsDarkTheme());
237
+ }
238
+ }
239
+ });
240
+
241
+ const config = {
242
+ attributes: true,
243
+ attributeFilter: ['class']
244
+ };
245
+
246
+ observer.observe(document.documentElement, config);
247
+
248
+ return () => {
249
+ observer.disconnect();
250
+ };
251
+ }, []);
226
252
 
227
253
  useEffect(() => {
228
254
  if (typeof window === 'undefined') {
@@ -335,7 +361,7 @@ export const SideNavLayout = ({ children, groupedRoutes, navOpen: navOpenProp })
335
361
  defaultManagedSidebarIsOpen={navOpenProp}
336
362
  >
337
363
  {children}
338
- {process.env.hasFooter && <Footer isDarkTheme={resolvedTheme === 'dark'} />}
364
+ {process.env.hasFooter && <Footer isDarkTheme={isDarkTheme} />}
339
365
  </Page>
340
366
  <div id="ws-page-banners">{hasGdprBanner && <GdprBanner />}</div>
341
367
  </RtlContext.Provider>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@patternfly/documentation-framework",
3
3
  "description": "A framework to build documentation for PatternFly.",
4
- "version": "6.28.0",
4
+ "version": "6.28.1",
5
5
  "author": "Red Hat",
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -12,7 +12,7 @@
12
12
  "@babel/preset-env": "7.27.1",
13
13
  "@babel/preset-react": "^7.24.1",
14
14
  "@mdx-js/util": "1.6.16",
15
- "@patternfly/ast-helpers": "^1.4.0-alpha.294",
15
+ "@patternfly/ast-helpers": "^1.4.0-alpha.295",
16
16
  "@reach/router": "npm:@gatsbyjs/reach-router@1.3.9",
17
17
  "autoprefixer": "10.4.19",
18
18
  "babel-loader": "^9.1.3",
@@ -95,5 +95,5 @@
95
95
  "http-cache-semantics": ">=4.1.1",
96
96
  "nanoid": "3.3.8"
97
97
  },
98
- "gitHead": "9b6d11065953f56deaa15d1013cc5a603d025503"
98
+ "gitHead": "683bdaf612aa0bd6b7c15daa4dc8d1c0ab514739"
99
99
  }