@dbcdk/react-components 0.0.211 → 0.0.212
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/README.md +6 -1
- package/dist/components/button/Button.cjs +2 -1
- package/dist/components/button/Button.d.ts +6 -1
- package/dist/components/button/Button.js +2 -1
- package/dist/components/button/Button.module.css +14 -0
- package/dist/components/color-scheme-button/ColorSchemeButton.cjs +2 -2
- package/dist/components/color-scheme-button/ColorSchemeButton.js +2 -2
- package/dist/components/forms/file-upload/FileUpload.cjs +4 -0
- package/dist/components/forms/file-upload/FileUpload.js +4 -0
- package/dist/components/forms/form-select/FormSelect.cjs +4 -0
- package/dist/components/forms/form-select/FormSelect.d.ts +1 -1
- package/dist/components/forms/form-select/FormSelect.js +4 -0
- package/dist/components/forms/input/Input.cjs +4 -0
- package/dist/components/forms/input/Input.js +4 -0
- package/dist/components/forms/radio-buttons/RadioButtonGroup.cjs +6 -5
- package/dist/components/forms/radio-buttons/RadioButtonGroup.js +2 -5
- package/dist/components/forms/radio-buttons/RadioButtons.module.css +15 -0
- package/dist/components/forms/select/Select.cjs +4 -0
- package/dist/components/forms/select/Select.d.ts +1 -1
- package/dist/components/forms/select/Select.js +4 -0
- package/dist/components/forms/text-area/Textarea.cjs +4 -0
- package/dist/components/forms/text-area/Textarea.js +4 -0
- package/dist/components/forms/typeahead/Typeahead.cjs +109 -42
- package/dist/components/forms/typeahead/Typeahead.d.ts +6 -0
- package/dist/components/forms/typeahead/Typeahead.js +109 -42
- package/dist/components/forms/typeahead/Typeahead.module.css +16 -0
- package/dist/components/headline/CollapsibleHeadline.cjs +15 -18
- package/dist/components/headline/CollapsibleHeadline.d.ts +2 -2
- package/dist/components/headline/CollapsibleHeadline.js +15 -18
- package/dist/components/headline/Headline.module.css +22 -0
- package/dist/components/sidebar/components/SidebarItem.cjs +2 -0
- package/dist/components/sidebar/components/SidebarItem.d.ts +2 -1
- package/dist/components/sidebar/components/SidebarItem.js +2 -0
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.cjs +2 -0
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.d.ts +2 -1
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.js +2 -0
- package/dist/components/sidebar/components/expandable-sidebar-item/ExpandableSidebarItem.module.css +1 -1
- package/dist/components/sidebar/components/sidebar-container/SidebarContainer.module.css +40 -0
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.cjs +2 -0
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.d.ts +2 -1
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.js +2 -0
- package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.module.css +9 -0
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.cjs +6 -4
- package/dist/components/sidebar/components/sidebar-items/SidebarItems.js +6 -4
- package/dist/components/theme-script/ThemeScript.cjs +1 -1
- package/dist/components/theme-script/ThemeScript.d.ts +1 -1
- package/dist/components/theme-script/ThemeScript.js +1 -1
- package/dist/hooks/useColorScheme.cjs +1 -1
- package/dist/hooks/useColorScheme.js +1 -1
- package/dist/hooks/useGetActiveTheme.cjs +1 -1
- package/dist/hooks/useGetActiveTheme.js +1 -1
- package/dist/styles/themes/dbc/colors.css +4 -4
- package/package.json +1 -1
package/dist/components/sidebar/components/sidebar-item-content/SidebarItemContent.module.css
CHANGED
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
background-clip: padding-box;
|
|
10
10
|
padding-block: var(--spacing-xs);
|
|
11
11
|
padding-inline: var(--spacing-xs);
|
|
12
|
+
/* Indent content, keeping every row's background and hit area at full width. */
|
|
13
|
+
padding-inline-start: calc(
|
|
14
|
+
var(--spacing-xs) + var(--sidebar-item-depth, 0) * (var(--icon-size-sm) + var(--spacing-sm))
|
|
15
|
+
);
|
|
12
16
|
text-decoration: none;
|
|
13
17
|
color: var(--color-fg-muted);
|
|
14
18
|
cursor: pointer;
|
|
@@ -82,6 +86,11 @@
|
|
|
82
86
|
min-inline-size: var(--sidebar-item-icon-width, var(--icon-size-sm));
|
|
83
87
|
}
|
|
84
88
|
|
|
89
|
+
/* Nested rows do not reserve a second icon gutter when they have no icon. */
|
|
90
|
+
.icon:empty {
|
|
91
|
+
display: var(--sidebar-empty-icon-display, flex);
|
|
92
|
+
}
|
|
93
|
+
|
|
85
94
|
.icon svg,
|
|
86
95
|
.suffixIcon svg {
|
|
87
96
|
inline-size: var(--icon-size-sm);
|
|
@@ -17,12 +17,12 @@ function SidebarItems({ activeLink }) {
|
|
|
17
17
|
react.useEffect(() => {
|
|
18
18
|
setActiveLink(activeLink != null ? activeLink : "");
|
|
19
19
|
}, [activeLink, setActiveLink]);
|
|
20
|
-
const renderItem = (item, key) => {
|
|
20
|
+
const renderItem = (item, key, depth = 0) => {
|
|
21
21
|
var _a, _b;
|
|
22
22
|
if (item.type === "group") {
|
|
23
|
-
return isSidebarCollapsed ? (_a = item.children) == null ? void 0 : _a.map((child, idx) => renderItem(child, `${key}-c${idx}
|
|
23
|
+
return isSidebarCollapsed ? (_a = item.children) == null ? void 0 : _a.map((child, idx) => renderItem(child, `${key}-c${idx}`, depth)) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles__default.default.group, children: [
|
|
24
24
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles__default.default.groupLabel, children: item.label }),
|
|
25
|
-
(_b = item.children) == null ? void 0 : _b.map((child, idx) => renderItem(child, `${key}-c${idx}
|
|
25
|
+
(_b = item.children) == null ? void 0 : _b.map((child, idx) => renderItem(child, `${key}-c${idx}`, depth))
|
|
26
26
|
] }, key);
|
|
27
27
|
}
|
|
28
28
|
if (item.type === "expandable") {
|
|
@@ -36,7 +36,8 @@ function SidebarItems({ activeLink }) {
|
|
|
36
36
|
iconWidth: item.iconWidth,
|
|
37
37
|
truncateLabel: item.truncateLabel,
|
|
38
38
|
enabled: item.enabled,
|
|
39
|
-
|
|
39
|
+
depth,
|
|
40
|
+
children: item.children.map((child, idx) => renderItem(child, `${key}-c${idx}`, depth + 1))
|
|
40
41
|
},
|
|
41
42
|
key
|
|
42
43
|
);
|
|
@@ -53,6 +54,7 @@ function SidebarItems({ activeLink }) {
|
|
|
53
54
|
iconWidth,
|
|
54
55
|
truncateLabel,
|
|
55
56
|
enabled: item.enabled,
|
|
57
|
+
depth,
|
|
56
58
|
external: item.external
|
|
57
59
|
},
|
|
58
60
|
key
|
|
@@ -11,12 +11,12 @@ function SidebarItems({ activeLink }) {
|
|
|
11
11
|
useEffect(() => {
|
|
12
12
|
setActiveLink(activeLink != null ? activeLink : "");
|
|
13
13
|
}, [activeLink, setActiveLink]);
|
|
14
|
-
const renderItem = (item, key) => {
|
|
14
|
+
const renderItem = (item, key, depth = 0) => {
|
|
15
15
|
var _a, _b;
|
|
16
16
|
if (item.type === "group") {
|
|
17
|
-
return isSidebarCollapsed ? (_a = item.children) == null ? void 0 : _a.map((child, idx) => renderItem(child, `${key}-c${idx}
|
|
17
|
+
return isSidebarCollapsed ? (_a = item.children) == null ? void 0 : _a.map((child, idx) => renderItem(child, `${key}-c${idx}`, depth)) : /* @__PURE__ */ jsxs("div", { className: styles.group, children: [
|
|
18
18
|
/* @__PURE__ */ jsx("div", { className: styles.groupLabel, children: item.label }),
|
|
19
|
-
(_b = item.children) == null ? void 0 : _b.map((child, idx) => renderItem(child, `${key}-c${idx}
|
|
19
|
+
(_b = item.children) == null ? void 0 : _b.map((child, idx) => renderItem(child, `${key}-c${idx}`, depth))
|
|
20
20
|
] }, key);
|
|
21
21
|
}
|
|
22
22
|
if (item.type === "expandable") {
|
|
@@ -30,7 +30,8 @@ function SidebarItems({ activeLink }) {
|
|
|
30
30
|
iconWidth: item.iconWidth,
|
|
31
31
|
truncateLabel: item.truncateLabel,
|
|
32
32
|
enabled: item.enabled,
|
|
33
|
-
|
|
33
|
+
depth,
|
|
34
|
+
children: item.children.map((child, idx) => renderItem(child, `${key}-c${idx}`, depth + 1))
|
|
34
35
|
},
|
|
35
36
|
key
|
|
36
37
|
);
|
|
@@ -47,6 +48,7 @@ function SidebarItems({ activeLink }) {
|
|
|
47
48
|
iconWidth,
|
|
48
49
|
truncateLabel,
|
|
49
50
|
enabled: item.enabled,
|
|
51
|
+
depth,
|
|
50
52
|
external: item.external
|
|
51
53
|
},
|
|
52
54
|
key
|
|
@@ -50,7 +50,7 @@ function buildInitScript(defaultColorScheme, defaultTheme, storageKey, colorSche
|
|
|
50
50
|
})();`;
|
|
51
51
|
}
|
|
52
52
|
function ThemeScript({
|
|
53
|
-
defaultColorScheme = "
|
|
53
|
+
defaultColorScheme = "light",
|
|
54
54
|
defaultTheme,
|
|
55
55
|
storageKey = theme_constants.THEME_STORAGE_KEY,
|
|
56
56
|
colorSchemeStorageKey = colorScheme_constants.COLOR_SCHEME_STORAGE_KEY
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ThemeId } from '../../styles/themes/types';
|
|
2
2
|
import type { ColorScheme } from '../../utils/color-scheme.constants';
|
|
3
3
|
export interface ThemeScriptProps {
|
|
4
|
-
/** Color scheme applied when nothing is stored yet. Defaults to '
|
|
4
|
+
/** Color scheme applied when nothing is stored yet. Defaults to 'light'. */
|
|
5
5
|
defaultColorScheme?: ColorScheme;
|
|
6
6
|
/**
|
|
7
7
|
* The product theme the app already loads via a normal static import. Omit
|
|
@@ -48,7 +48,7 @@ function buildInitScript(defaultColorScheme, defaultTheme, storageKey, colorSche
|
|
|
48
48
|
})();`;
|
|
49
49
|
}
|
|
50
50
|
function ThemeScript({
|
|
51
|
-
defaultColorScheme = "
|
|
51
|
+
defaultColorScheme = "light",
|
|
52
52
|
defaultTheme,
|
|
53
53
|
storageKey = THEME_STORAGE_KEY,
|
|
54
54
|
colorSchemeStorageKey = COLOR_SCHEME_STORAGE_KEY
|
|
@@ -63,7 +63,7 @@ function switchColorSchemeInternal(storageKey, id, persistence) {
|
|
|
63
63
|
notify();
|
|
64
64
|
return id;
|
|
65
65
|
}
|
|
66
|
-
function useColorScheme(initialColorScheme = "
|
|
66
|
+
function useColorScheme(initialColorScheme = "light", options = {}) {
|
|
67
67
|
const { storageKey = colorScheme_constants.COLOR_SCHEME_STORAGE_KEY, persistence = "both" } = options;
|
|
68
68
|
react.useEffect(() => {
|
|
69
69
|
ensureResolved(initialColorScheme, storageKey, persistence);
|
|
@@ -61,7 +61,7 @@ function switchColorSchemeInternal(storageKey, id, persistence) {
|
|
|
61
61
|
notify();
|
|
62
62
|
return id;
|
|
63
63
|
}
|
|
64
|
-
function useColorScheme(initialColorScheme = "
|
|
64
|
+
function useColorScheme(initialColorScheme = "light", options = {}) {
|
|
65
65
|
const { storageKey = COLOR_SCHEME_STORAGE_KEY, persistence = "both" } = options;
|
|
66
66
|
useEffect(() => {
|
|
67
67
|
ensureResolved(initialColorScheme, storageKey, persistence);
|
|
@@ -7,7 +7,7 @@ var useTheme = require('./useTheme');
|
|
|
7
7
|
function useGetActiveTheme(options = {}) {
|
|
8
8
|
const { storageKey, colorSchemeStorageKey } = options;
|
|
9
9
|
const { theme } = useTheme.useTheme({ storageKey });
|
|
10
|
-
const { colorScheme } = useColorScheme.useColorScheme(
|
|
10
|
+
const { colorScheme } = useColorScheme.useColorScheme(void 0, { storageKey: colorSchemeStorageKey });
|
|
11
11
|
const themeKey = theme && colorScheme ? `${theme}-${colorScheme}` : null;
|
|
12
12
|
return { theme, colorScheme, themeKey };
|
|
13
13
|
}
|
|
@@ -5,7 +5,7 @@ import { useTheme } from './useTheme';
|
|
|
5
5
|
function useGetActiveTheme(options = {}) {
|
|
6
6
|
const { storageKey, colorSchemeStorageKey } = options;
|
|
7
7
|
const { theme } = useTheme({ storageKey });
|
|
8
|
-
const { colorScheme } = useColorScheme(
|
|
8
|
+
const { colorScheme } = useColorScheme(void 0, { storageKey: colorSchemeStorageKey });
|
|
9
9
|
const themeKey = theme && colorScheme ? `${theme}-${colorScheme}` : null;
|
|
10
10
|
return { theme, colorScheme, themeKey };
|
|
11
11
|
}
|
|
@@ -3,11 +3,11 @@ html {
|
|
|
3
3
|
* PRIMITIVES (THEME-DEPENDENT)
|
|
4
4
|
* ======================================================================= */
|
|
5
5
|
|
|
6
|
-
color-scheme: light
|
|
6
|
+
color-scheme: light;
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
&[data-theme='system'] {
|
|
9
|
+
color-scheme: light dark;
|
|
10
|
+
}
|
|
11
11
|
|
|
12
12
|
&[data-theme='dark'] {
|
|
13
13
|
color-scheme: dark;
|