@ansible/ansible-ui-framework 0.0.483 → 0.0.484

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.
@@ -166,7 +166,7 @@ function TableHead(props) {
166
166
  };
167
167
  }, [setSort, setSortDirection, sort, sortDirection]);
168
168
  return ((0, jsx_runtime_1.jsx)(react_table_1.Thead, { children: (0, jsx_runtime_1.jsxs)(react_table_1.Tr, __assign({ style: {
169
- backgroundColor: settings.theme === 'dark' ? 'var(--pf-global--BackgroundColor--300)' : 'white',
169
+ backgroundColor: settings.activeTheme === 'dark' ? 'var(--pf-global--BackgroundColor--300)' : 'white',
170
170
  } }, { children: [expandedRow && (0, jsx_runtime_1.jsx)(react_table_1.Th, { style: { padding: 0, backgroundColor: 'inherit' } }), (showSelect || onSelect) && ((0, jsx_runtime_1.jsx)(react_table_1.Th, __assign({ isStickyColumn: true, stickyMinWidth: "0px", hasRightBorder: props.scrollLeft, style: { backgroundColor: 'inherit' } }, { children: "\u00A0" }))), columns
171
171
  .filter(function (column) { return column.enabled !== false; })
172
172
  .map(function (column, index) {
package/cjs/Settings.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
2
  export interface Settings {
3
3
  theme?: 'system' | 'light' | 'dark';
4
+ activeTheme?: 'light' | 'dark';
4
5
  tableLayout?: 'compact' | 'comfortable';
5
6
  formColumns?: 'single' | 'multiple';
6
7
  formLayout?: 'vertical' | 'horizontal';
package/cjs/Settings.js CHANGED
@@ -45,18 +45,20 @@ function useSettings() {
45
45
  exports.useSettings = useSettings;
46
46
  function SettingsProvider(props) {
47
47
  var _a = __read((0, react_1.useState)(function () {
48
+ var theme = localStorage.getItem('theme');
49
+ var activeTheme = theme !== 'dark' && theme !== 'light'
50
+ ? window.matchMedia('(prefers-color-scheme: dark)').matches
51
+ ? 'dark'
52
+ : 'light'
53
+ : theme;
48
54
  var settings = {
49
- theme: localStorage.getItem('theme'),
55
+ theme: theme,
56
+ activeTheme: activeTheme,
50
57
  tableLayout: localStorage.getItem('tableLayout'),
51
58
  formColumns: localStorage.getItem('formColumns'),
52
59
  formLayout: localStorage.getItem('formLayout'),
53
60
  borders: localStorage.getItem('borders') !== 'false',
54
61
  };
55
- var activeTheme = settings.theme !== 'dark' && settings.theme !== 'light'
56
- ? window.matchMedia('(prefers-color-scheme: dark)').matches
57
- ? 'dark'
58
- : 'light'
59
- : settings.theme;
60
62
  if (activeTheme === 'dark') {
61
63
  document.documentElement.classList.add('pf-theme-dark');
62
64
  }
@@ -72,12 +74,13 @@ function SettingsProvider(props) {
72
74
  localStorage.setItem('formColumns', (_c = settings.formColumns) !== null && _c !== void 0 ? _c : 'multiple');
73
75
  localStorage.setItem('formLayout', (_d = settings.formLayout) !== null && _d !== void 0 ? _d : 'vertical');
74
76
  localStorage.setItem('borders', settings.borders ? 'true' : 'false');
75
- setSettingsState(settings);
76
77
  var activeTheme = settings.theme === 'system'
77
78
  ? window.matchMedia('(prefers-color-scheme: dark)').matches
78
79
  ? 'dark'
79
80
  : 'light'
80
81
  : settings.theme;
82
+ settings.activeTheme = activeTheme;
83
+ setSettingsState(settings);
81
84
  if (activeTheme === 'dark') {
82
85
  document.documentElement.classList.add('pf-theme-dark');
83
86
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ansible/ansible-ui-framework",
3
3
  "description": "A framework for building applications using PatternFly.",
4
- "version": "0.0.483",
4
+ "version": "0.0.484",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",