@dbcdk/react-components 0.0.155 → 0.0.156
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.
|
@@ -15,13 +15,16 @@ function getMaxWidthClass(value, styles2) {
|
|
|
15
15
|
return styles2.maxWidthMd;
|
|
16
16
|
}
|
|
17
17
|
const VALID_ENVIRONMENTS = ["production", "staging", "test"];
|
|
18
|
+
const ENVIRONMENT_ALIASES = { prod: "production" };
|
|
18
19
|
function resolveEnvBanner(environment, customEnv, customEnvSeverity) {
|
|
20
|
+
var _a;
|
|
19
21
|
if (customEnv != null && customEnvSeverity != null) {
|
|
20
22
|
return /* @__PURE__ */ jsxRuntime.jsx(EnvironmentBanner.EnvironmentBanner, { customLabel: customEnv, customSeverity: customEnvSeverity });
|
|
21
23
|
}
|
|
22
24
|
const normalised = environment == null ? void 0 : environment.toLowerCase();
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
const resolved = normalised != null ? (_a = ENVIRONMENT_ALIASES[normalised]) != null ? _a : normalised : void 0;
|
|
26
|
+
if (resolved != null && VALID_ENVIRONMENTS.includes(resolved)) {
|
|
27
|
+
return /* @__PURE__ */ jsxRuntime.jsx(EnvironmentBanner.EnvironmentBanner, { environment: resolved });
|
|
25
28
|
}
|
|
26
29
|
return null;
|
|
27
30
|
}
|
|
@@ -11,7 +11,8 @@ export interface PageLayoutProps extends PropsWithChildren {
|
|
|
11
11
|
containScrolling?: boolean;
|
|
12
12
|
orientation?: Orientation;
|
|
13
13
|
/** Pass a deployment environment string (e.g. process.env.DEPLOYMENT_ENV).
|
|
14
|
-
* Renders a banner for 'production', 'staging', or 'test'.
|
|
14
|
+
* Renders a banner for 'production', 'staging', or 'test'. 'prod' is accepted as an alias for
|
|
15
|
+
* 'production'. Ignored for unknown values or undefined. */
|
|
15
16
|
environment?: string;
|
|
16
17
|
/** Custom banner label — requires customEnvSeverity. */
|
|
17
18
|
customEnv?: string;
|
|
@@ -9,13 +9,16 @@ function getMaxWidthClass(value, styles2) {
|
|
|
9
9
|
return styles2.maxWidthMd;
|
|
10
10
|
}
|
|
11
11
|
const VALID_ENVIRONMENTS = ["production", "staging", "test"];
|
|
12
|
+
const ENVIRONMENT_ALIASES = { prod: "production" };
|
|
12
13
|
function resolveEnvBanner(environment, customEnv, customEnvSeverity) {
|
|
14
|
+
var _a;
|
|
13
15
|
if (customEnv != null && customEnvSeverity != null) {
|
|
14
16
|
return /* @__PURE__ */ jsx(EnvironmentBanner, { customLabel: customEnv, customSeverity: customEnvSeverity });
|
|
15
17
|
}
|
|
16
18
|
const normalised = environment == null ? void 0 : environment.toLowerCase();
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
const resolved = normalised != null ? (_a = ENVIRONMENT_ALIASES[normalised]) != null ? _a : normalised : void 0;
|
|
20
|
+
if (resolved != null && VALID_ENVIRONMENTS.includes(resolved)) {
|
|
21
|
+
return /* @__PURE__ */ jsx(EnvironmentBanner, { environment: resolved });
|
|
19
22
|
}
|
|
20
23
|
return null;
|
|
21
24
|
}
|
|
@@ -64,17 +64,42 @@
|
|
|
64
64
|
grid-template-rows: auto 1fr;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
/* documentScrolling only has `min-height` (so long content can still grow the
|
|
68
|
+
page), which leaves the grid container's own block-size indefinite — and an
|
|
69
|
+
indefinite container makes the `1fr` row above size itself from its content
|
|
70
|
+
(i.e. from the sidebar's own capped height below) instead of from real
|
|
71
|
+
leftover viewport space. Any drift between --page-layout-banner-height's
|
|
72
|
+
estimate and the banner's real rendered height then inflated the whole page,
|
|
73
|
+
but only once the sidenav's content was tall enough to hit that cap — giving
|
|
74
|
+
this one combination a real, definite block-size makes the `1fr` row's size
|
|
75
|
+
come from the banner's actual rendered height, so the estimate is only ever
|
|
76
|
+
used below as a cap, never as the page's actual size. */
|
|
77
|
+
.documentScrolling.vertical.hasBanner {
|
|
78
|
+
height: 100vh;
|
|
79
|
+
height: 100dvh;
|
|
80
|
+
}
|
|
81
|
+
|
|
67
82
|
/* Sidebar */
|
|
68
83
|
.sidebar {
|
|
69
84
|
min-width: 0;
|
|
70
85
|
min-block-size: 0; /* CRITICAL: else a tall sidenav grows the grid row instead of scrolling */
|
|
71
86
|
overflow: hidden;
|
|
72
87
|
background: var(--color-bg-surface);
|
|
88
|
+
|
|
89
|
+
/* Hug the sidebar's own content width instead of stretching to fill the "auto"
|
|
90
|
+
column — some browsers size that column wider than the content once a
|
|
91
|
+
descendant scrollbar reserves space, leaving a visible gap otherwise. */
|
|
92
|
+
justify-self: start;
|
|
73
93
|
}
|
|
74
94
|
|
|
95
|
+
/* The Sidebar/SidebarContainer inside already owns its own internal scrolling
|
|
96
|
+
(its root is height:100%; overflow:auto). This wrapper only needs to cap the
|
|
97
|
+
available height — if it *also* reserves its own scrollbar, that scrollbar's
|
|
98
|
+
width gets folded into this box's max-content size (used by `justify-self:
|
|
99
|
+
start` above), making it a scrollbar's-width wider than the fixed-width
|
|
100
|
+
Sidebar inside and leaving a gap on the right edge. */
|
|
75
101
|
.containScrolling .sidebar {
|
|
76
|
-
overflow:
|
|
77
|
-
-webkit-overflow-scrolling: touch;
|
|
102
|
+
overflow: hidden;
|
|
78
103
|
}
|
|
79
104
|
|
|
80
105
|
/* Pin the sidebar to the viewport and let it scroll independently of the document.
|
|
@@ -85,8 +110,9 @@
|
|
|
85
110
|
top: 0;
|
|
86
111
|
max-block-size: 100vh;
|
|
87
112
|
max-block-size: 100dvh;
|
|
88
|
-
|
|
89
|
-
|
|
113
|
+
/* See the .containScrolling .sidebar comment above — same double-scrollbar
|
|
114
|
+
reasoning applies here. */
|
|
115
|
+
overflow: hidden;
|
|
90
116
|
}
|
|
91
117
|
|
|
92
118
|
/* Leave room for the banner's height, and stick below it instead of at top:0 so it
|
|
@@ -106,9 +132,10 @@
|
|
|
106
132
|
block-size: 100dvh;
|
|
107
133
|
}
|
|
108
134
|
|
|
109
|
-
/* In horizontal orientation, sidebar becomes a top block if used */
|
|
135
|
+
/* In horizontal orientation, sidebar becomes a full-width top block if used */
|
|
110
136
|
.horizontal .sidebar {
|
|
111
137
|
grid-column: 1 / -1;
|
|
138
|
+
justify-self: stretch;
|
|
112
139
|
border-right: none;
|
|
113
140
|
border-bottom: var(--border-width-thin) solid var(--color-border-subtle);
|
|
114
141
|
}
|