@primer/react 0.0.0-20260218182540 → 0.0.0-20260218205658
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 +4 -24
- package/dist/ActionList/Description.js +35 -113
- package/dist/ActionList/Divider.js +11 -30
- package/dist/ActionList/Group.js +117 -294
- package/dist/ActionList/Heading.js +22 -77
- package/dist/ActionList/Item.js +37 -98
- package/dist/ActionList/LinkItem.js +24 -80
- package/dist/ActionList/List.js +33 -143
- package/dist/ActionList/Selection.js +30 -78
- package/dist/ActionList/TrailingAction.js +23 -83
- package/dist/ActionList/Visuals.js +64 -162
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +62 -72
- package/dist/Button/Button.js +11 -34
- package/dist/Button/ButtonBase.d.ts.map +1 -1
- package/dist/Button/ButtonBase.js +14 -9
- package/dist/Button/IconButton.js +51 -140
- package/dist/Button/LinkButton.js +11 -39
- package/dist/FilteredActionList/FilteredActionList-f6c2dc7a.css +2 -0
- package/dist/FilteredActionList/FilteredActionList-f6c2dc7a.css.map +1 -0
- package/dist/FilteredActionList/FilteredActionList.module.css.js +2 -2
- package/dist/PageLayout/PageLayout-06f4c069.css +2 -0
- package/dist/PageLayout/PageLayout-06f4c069.css.map +1 -0
- package/dist/PageLayout/PageLayout.d.ts +71 -2
- package/dist/PageLayout/PageLayout.d.ts.map +1 -1
- package/dist/PageLayout/PageLayout.js +498 -44
- package/dist/PageLayout/PageLayout.module.css.js +2 -2
- package/dist/PageLayout/usePaneWidth.d.ts +16 -4
- package/dist/PageLayout/usePaneWidth.d.ts.map +1 -1
- package/dist/PageLayout/usePaneWidth.js +123 -109
- package/dist/SplitPageLayout/SplitPageLayout.d.ts +4 -1
- package/dist/SplitPageLayout/SplitPageLayout.d.ts.map +1 -1
- package/dist/SplitPageLayout/SplitPageLayout.js +54 -2
- package/dist/UnderlineNav/UnderlineNav.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNav.js +4 -11
- package/dist/experimental/SelectPanel2/SelectPanel-1f8c23b5.css +2 -0
- package/dist/experimental/SelectPanel2/{SelectPanel-f0c4b9ca.css.map → SelectPanel-1f8c23b5.css.map} +1 -1
- package/dist/experimental/SelectPanel2/SelectPanel.module.css.js +1 -1
- package/dist/hooks/useIsMacOS.d.ts +3 -15
- package/dist/hooks/useIsMacOS.d.ts.map +1 -1
- package/dist/hooks/useIsMacOS.js +26 -24
- package/dist/hooks/useSlots.d.ts +6 -50
- package/dist/hooks/useSlots.d.ts.map +1 -1
- package/dist/hooks/useSlots.js +36 -114
- package/dist/internal/components/UnderlineTabbedInterface-20c3ba3d.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-20c3ba3d.css.map +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
- package/dist/live-region/Announce.d.ts.map +1 -1
- package/dist/live-region/Announce.js +4 -7
- package/dist/utils/environment.js +9 -0
- package/generated/components.json +200 -2
- package/package.json +2 -2
- package/dist/FilteredActionList/FilteredActionList-02db90c6.css +0 -2
- package/dist/FilteredActionList/FilteredActionList-02db90c6.css.map +0 -1
- package/dist/PageLayout/PageLayout-cb491b47.css +0 -2
- package/dist/PageLayout/PageLayout-cb491b47.css.map +0 -1
- package/dist/experimental/SelectPanel2/SelectPanel-f0c4b9ca.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css.map +0 -1
|
@@ -20,6 +20,12 @@ export type UsePaneWidthOptions = {
|
|
|
20
20
|
paneRef: React.RefObject<HTMLDivElement | null>;
|
|
21
21
|
handleRef: React.RefObject<HTMLDivElement | null>;
|
|
22
22
|
contentWrapperRef: React.RefObject<HTMLDivElement | null>;
|
|
23
|
+
/**
|
|
24
|
+
* When true, custom max width values are capped to the viewport-based max.
|
|
25
|
+
* This prevents overflow in non-wrapping flex layouts (e.g., Sidebar).
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
constrainToViewport?: boolean;
|
|
23
29
|
/** Callback fired when a resize operation ends (drag release or keyboard key up) */
|
|
24
30
|
onResizeEnd?: (width: number) => void;
|
|
25
31
|
/** Current/controlled width value in pixels (used instead of internal state; default from `width` is still used for reset) */
|
|
@@ -46,6 +52,11 @@ export type UsePaneWidthResult = {
|
|
|
46
52
|
* Imported from CSS to ensure JS fallback matches the CSS default.
|
|
47
53
|
*/
|
|
48
54
|
export declare const DEFAULT_MAX_WIDTH_DIFF: number;
|
|
55
|
+
/**
|
|
56
|
+
* Default value for --sidebar-max-width-diff CSS variable.
|
|
57
|
+
* Unlike --pane-max-width-diff, this is constant across all viewport sizes.
|
|
58
|
+
*/
|
|
59
|
+
export declare const DEFAULT_SIDEBAR_MAX_WIDTH_DIFF: number;
|
|
49
60
|
/**
|
|
50
61
|
* Default max pane width for SSR when viewport is unknown.
|
|
51
62
|
* Updated to actual value in layout effect before paint.
|
|
@@ -62,11 +73,12 @@ export declare const isCustomWidthOptions: (width: PaneWidthValue) => width is C
|
|
|
62
73
|
export declare const isPaneWidth: (width: PaneWidthValue) => width is PaneWidth;
|
|
63
74
|
export declare const getDefaultPaneWidth: (w: PaneWidthValue) => number;
|
|
64
75
|
/**
|
|
65
|
-
* Gets the
|
|
66
|
-
*
|
|
76
|
+
* Gets the max-width-diff CSS variable value from a pane element.
|
|
77
|
+
* For sidebars, reads --sidebar-max-width-diff (constant across viewports).
|
|
78
|
+
* For panes, reads --pane-max-width-diff (changes at 1280px breakpoint).
|
|
67
79
|
* Note: This calls getComputedStyle which forces layout - cache the result when possible.
|
|
68
80
|
*/
|
|
69
|
-
export declare function getPaneMaxWidthDiff(paneElement: HTMLElement | null): number;
|
|
81
|
+
export declare function getPaneMaxWidthDiff(paneElement: HTMLElement | null, isSidebar?: boolean): number;
|
|
70
82
|
export declare const updateAriaValues: (handle: HTMLElement | null, values: {
|
|
71
83
|
current?: number;
|
|
72
84
|
min?: number;
|
|
@@ -82,6 +94,6 @@ export declare const updateAriaValues: (handle: HTMLElement | null, values: {
|
|
|
82
94
|
* - When `onResizeEnd` is provided: Calls the callback instead of localStorage
|
|
83
95
|
* - When `resizable` is `false` or `undefined`: Not resizable, no persistence
|
|
84
96
|
*/
|
|
85
|
-
export declare function usePaneWidth({ width, minWidth, resizable, widthStorageKey, paneRef, handleRef, contentWrapperRef, onResizeEnd, currentWidth: controlledWidth, }: UsePaneWidthOptions): UsePaneWidthResult;
|
|
97
|
+
export declare function usePaneWidth({ width, minWidth, resizable, widthStorageKey, paneRef, handleRef, contentWrapperRef, constrainToViewport, onResizeEnd, currentWidth: controlledWidth, }: UsePaneWidthOptions): UsePaneWidthResult;
|
|
86
98
|
export {};
|
|
87
99
|
//# sourceMappingURL=usePaneWidth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePaneWidth.d.ts","sourceRoot":"","sources":["../../src/PageLayout/usePaneWidth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAiC,MAAM,OAAO,CAAA;AAOrD,KAAK,WAAW,GAAG,GAAG,MAAM,IAAI,CAAA;AAEhC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,GAAG,EAAE,WAAW,CAAA;IAChB,OAAO,EAAE,WAAW,CAAA;IACpB,GAAG,EAAE,WAAW,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;AAEpD;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,kBAAkB,CAAA;AAE3D,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,cAAc,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,OAAO,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;IACvB,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IAC/C,SAAS,EAAE,KAAK,CAAC,SAA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,gBAAgB,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAyC,CAAA;AAKhG,eAAO,MAAM,oBAAoB,GAAI,OAAO,cAAc,KAAG,KAAK,IAAI,kBAErE,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,OAAO,cAAc,KAAG,KAAK,IAAI,SAE5D,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,GAAG,cAAc,KAAG,MAOvD,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,EAAE,SAAS,UAAQ,GAAG,MAAM,CAM9F;AAID,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,WAAW,GAAG,IAAI,EAC1B,QAAQ;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAC,SASvD,CAAA;AA8BD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,QAAQ,EACR,SAAS,EACT,eAAe,EACf,OAAO,EACP,SAAS,EACT,iBAAiB,EACjB,mBAA2B,EAC3B,WAAW,EACX,YAAY,EAAE,eAAe,GAC9B,EAAE,mBAAmB,GAAG,kBAAkB,CAuQ1C"}
|
|
@@ -21,6 +21,12 @@ import classes from './PageLayout.module.css.js';
|
|
|
21
21
|
*/
|
|
22
22
|
const DEFAULT_MAX_WIDTH_DIFF = Number(classes.paneMaxWidthDiffDefault);
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Default value for --sidebar-max-width-diff CSS variable.
|
|
26
|
+
* Unlike --pane-max-width-diff, this is constant across all viewport sizes.
|
|
27
|
+
*/
|
|
28
|
+
const DEFAULT_SIDEBAR_MAX_WIDTH_DIFF = Number(classes.sidebarMaxWidthDiffDefault);
|
|
29
|
+
|
|
24
30
|
// --pane-max-width-diff changes at this breakpoint in PageLayout.module.css.
|
|
25
31
|
const DEFAULT_PANE_MAX_WIDTH_DIFF_BREAKPOINT = Number(classes.paneMaxWidthDiffBreakpoint);
|
|
26
32
|
/**
|
|
@@ -61,14 +67,17 @@ const getDefaultPaneWidth = w => {
|
|
|
61
67
|
};
|
|
62
68
|
|
|
63
69
|
/**
|
|
64
|
-
* Gets the
|
|
65
|
-
*
|
|
70
|
+
* Gets the max-width-diff CSS variable value from a pane element.
|
|
71
|
+
* For sidebars, reads --sidebar-max-width-diff (constant across viewports).
|
|
72
|
+
* For panes, reads --pane-max-width-diff (changes at 1280px breakpoint).
|
|
66
73
|
* Note: This calls getComputedStyle which forces layout - cache the result when possible.
|
|
67
74
|
*/
|
|
68
|
-
function getPaneMaxWidthDiff(paneElement) {
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
75
|
+
function getPaneMaxWidthDiff(paneElement, isSidebar = false) {
|
|
76
|
+
const defaultValue = isSidebar ? DEFAULT_SIDEBAR_MAX_WIDTH_DIFF : DEFAULT_MAX_WIDTH_DIFF;
|
|
77
|
+
const cssVar = isSidebar ? '--sidebar-max-width-diff' : '--pane-max-width-diff';
|
|
78
|
+
if (!paneElement) return defaultValue;
|
|
79
|
+
const value = parseInt(getComputedStyle(paneElement).getPropertyValue(cssVar), 10);
|
|
80
|
+
return value > 0 ? value : defaultValue;
|
|
72
81
|
}
|
|
73
82
|
|
|
74
83
|
// Helper to update ARIA slider attributes via direct DOM manipulation
|
|
@@ -121,7 +130,7 @@ const localStoragePersister = {
|
|
|
121
130
|
* - When `resizable` is `false` or `undefined`: Not resizable, no persistence
|
|
122
131
|
*/
|
|
123
132
|
function usePaneWidth(t0) {
|
|
124
|
-
const $ = c(
|
|
133
|
+
const $ = c(42);
|
|
125
134
|
const {
|
|
126
135
|
width,
|
|
127
136
|
minWidth,
|
|
@@ -130,56 +139,60 @@ function usePaneWidth(t0) {
|
|
|
130
139
|
paneRef,
|
|
131
140
|
handleRef,
|
|
132
141
|
contentWrapperRef,
|
|
142
|
+
constrainToViewport: t1,
|
|
133
143
|
onResizeEnd,
|
|
134
144
|
currentWidth: controlledWidth
|
|
135
145
|
} = t0;
|
|
146
|
+
const constrainToViewport = t1 === undefined ? false : t1;
|
|
136
147
|
const isCustomWidth = isCustomWidthOptions(width);
|
|
137
148
|
const minPaneWidth = isCustomWidth ? parseInt(width.min, 10) : minWidth;
|
|
138
149
|
const customMaxWidth = isCustomWidth ? parseInt(width.max, 10) : null;
|
|
139
150
|
const widthStorageKeyRef = React.useRef(widthStorageKey);
|
|
140
151
|
const onResizeEndRef = React.useRef(onResizeEnd);
|
|
141
|
-
let
|
|
152
|
+
let t2;
|
|
142
153
|
if ($[0] !== onResizeEnd || $[1] !== widthStorageKey) {
|
|
143
|
-
|
|
154
|
+
t2 = () => {
|
|
144
155
|
widthStorageKeyRef.current = widthStorageKey;
|
|
145
156
|
onResizeEndRef.current = onResizeEnd;
|
|
146
157
|
};
|
|
147
158
|
$[0] = onResizeEnd;
|
|
148
159
|
$[1] = widthStorageKey;
|
|
149
|
-
$[2] =
|
|
160
|
+
$[2] = t2;
|
|
150
161
|
} else {
|
|
151
|
-
|
|
162
|
+
t2 = $[2];
|
|
152
163
|
}
|
|
153
|
-
useIsomorphicLayoutEffect(
|
|
154
|
-
const maxWidthDiffRef = React.useRef(DEFAULT_MAX_WIDTH_DIFF);
|
|
155
|
-
let
|
|
156
|
-
if ($[3] !==
|
|
157
|
-
|
|
164
|
+
useIsomorphicLayoutEffect(t2);
|
|
165
|
+
const maxWidthDiffRef = React.useRef(constrainToViewport ? DEFAULT_SIDEBAR_MAX_WIDTH_DIFF : DEFAULT_MAX_WIDTH_DIFF);
|
|
166
|
+
let t3;
|
|
167
|
+
if ($[3] !== constrainToViewport || $[4] !== customMaxWidth || $[5] !== minPaneWidth) {
|
|
168
|
+
t3 = () => {
|
|
169
|
+
const viewportWidth = window.innerWidth;
|
|
170
|
+
const viewportMax = viewportWidth > 0 ? Math.max(minPaneWidth, viewportWidth - maxWidthDiffRef.current) : minPaneWidth;
|
|
158
171
|
if (customMaxWidth !== null) {
|
|
159
|
-
return customMaxWidth;
|
|
172
|
+
return constrainToViewport ? Math.min(customMaxWidth, viewportMax) : customMaxWidth;
|
|
160
173
|
}
|
|
161
|
-
|
|
162
|
-
return viewportWidth > 0 ? Math.max(minPaneWidth, viewportWidth - maxWidthDiffRef.current) : minPaneWidth;
|
|
174
|
+
return viewportMax;
|
|
163
175
|
};
|
|
164
|
-
$[3] =
|
|
165
|
-
$[4] =
|
|
166
|
-
$[5] =
|
|
176
|
+
$[3] = constrainToViewport;
|
|
177
|
+
$[4] = customMaxWidth;
|
|
178
|
+
$[5] = minPaneWidth;
|
|
179
|
+
$[6] = t3;
|
|
167
180
|
} else {
|
|
168
|
-
|
|
181
|
+
t3 = $[6];
|
|
169
182
|
}
|
|
170
|
-
const getMaxPaneWidth =
|
|
171
|
-
let
|
|
172
|
-
if ($[
|
|
173
|
-
|
|
174
|
-
$[
|
|
175
|
-
$[
|
|
183
|
+
const getMaxPaneWidth = t3;
|
|
184
|
+
let t4;
|
|
185
|
+
if ($[7] !== width) {
|
|
186
|
+
t4 = getDefaultPaneWidth(width);
|
|
187
|
+
$[7] = width;
|
|
188
|
+
$[8] = t4;
|
|
176
189
|
} else {
|
|
177
|
-
|
|
190
|
+
t4 = $[8];
|
|
178
191
|
}
|
|
179
|
-
const defaultWidth =
|
|
180
|
-
let
|
|
181
|
-
if ($[
|
|
182
|
-
|
|
192
|
+
const defaultWidth = t4;
|
|
193
|
+
let t5;
|
|
194
|
+
if ($[9] !== controlledWidth || $[10] !== defaultWidth || $[11] !== onResizeEnd || $[12] !== resizable || $[13] !== widthStorageKey) {
|
|
195
|
+
t5 = () => {
|
|
183
196
|
if (typeof controlledWidth === "number") {
|
|
184
197
|
return controlledWidth;
|
|
185
198
|
}
|
|
@@ -192,16 +205,16 @@ function usePaneWidth(t0) {
|
|
|
192
205
|
}
|
|
193
206
|
return defaultWidth;
|
|
194
207
|
};
|
|
195
|
-
$[
|
|
196
|
-
$[
|
|
197
|
-
$[
|
|
198
|
-
$[
|
|
199
|
-
$[
|
|
200
|
-
$[
|
|
208
|
+
$[9] = controlledWidth;
|
|
209
|
+
$[10] = defaultWidth;
|
|
210
|
+
$[11] = onResizeEnd;
|
|
211
|
+
$[12] = resizable;
|
|
212
|
+
$[13] = widthStorageKey;
|
|
213
|
+
$[14] = t5;
|
|
201
214
|
} else {
|
|
202
|
-
|
|
215
|
+
t5 = $[14];
|
|
203
216
|
}
|
|
204
|
-
const [currentWidthState, setCurrentWidthState] = React.useState(
|
|
217
|
+
const [currentWidthState, setCurrentWidthState] = React.useState(t5);
|
|
205
218
|
const [prevDefaultWidth, setPrevDefaultWidth] = React.useState(defaultWidth);
|
|
206
219
|
const [prevControlledWidth, setPrevControlledWidth] = React.useState(controlledWidth);
|
|
207
220
|
const controlledWidthChanged = controlledWidth !== prevControlledWidth;
|
|
@@ -224,42 +237,42 @@ function usePaneWidth(t0) {
|
|
|
224
237
|
}
|
|
225
238
|
const currentWidth = controlledWidth !== null && controlledWidth !== void 0 ? controlledWidth : currentWidthState;
|
|
226
239
|
const currentWidthRef = React.useRef(currentWidth);
|
|
227
|
-
let
|
|
228
|
-
if ($[
|
|
229
|
-
|
|
230
|
-
$[
|
|
231
|
-
$[
|
|
240
|
+
let t6;
|
|
241
|
+
if ($[15] !== customMaxWidth) {
|
|
242
|
+
t6 = () => customMaxWidth !== null && customMaxWidth !== void 0 ? customMaxWidth : SSR_DEFAULT_MAX_WIDTH;
|
|
243
|
+
$[15] = customMaxWidth;
|
|
244
|
+
$[16] = t6;
|
|
232
245
|
} else {
|
|
233
|
-
|
|
246
|
+
t6 = $[16];
|
|
234
247
|
}
|
|
235
|
-
const [maxPaneWidth, setMaxPaneWidth] = React.useState(
|
|
236
|
-
let t6;
|
|
248
|
+
const [maxPaneWidth, setMaxPaneWidth] = React.useState(t6);
|
|
237
249
|
let t7;
|
|
238
|
-
|
|
239
|
-
|
|
250
|
+
let t8;
|
|
251
|
+
if ($[17] !== currentWidth) {
|
|
252
|
+
t7 = () => {
|
|
240
253
|
currentWidthRef.current = currentWidth;
|
|
241
254
|
};
|
|
242
|
-
|
|
243
|
-
$[
|
|
244
|
-
$[17] = t6;
|
|
255
|
+
t8 = [currentWidth];
|
|
256
|
+
$[17] = currentWidth;
|
|
245
257
|
$[18] = t7;
|
|
258
|
+
$[19] = t8;
|
|
246
259
|
} else {
|
|
247
|
-
t6 = $[17];
|
|
248
260
|
t7 = $[18];
|
|
261
|
+
t8 = $[19];
|
|
249
262
|
}
|
|
250
|
-
useIsomorphicLayoutEffect(
|
|
251
|
-
let
|
|
252
|
-
if ($[
|
|
253
|
-
|
|
254
|
-
$[
|
|
255
|
-
$[
|
|
263
|
+
useIsomorphicLayoutEffect(t7, t8);
|
|
264
|
+
let t9;
|
|
265
|
+
if ($[20] !== width) {
|
|
266
|
+
t9 = () => getDefaultPaneWidth(width);
|
|
267
|
+
$[20] = width;
|
|
268
|
+
$[21] = t9;
|
|
256
269
|
} else {
|
|
257
|
-
|
|
270
|
+
t9 = $[21];
|
|
258
271
|
}
|
|
259
|
-
const getDefaultWidth =
|
|
260
|
-
let
|
|
261
|
-
if ($[
|
|
262
|
-
|
|
272
|
+
const getDefaultWidth = t9;
|
|
273
|
+
let t10;
|
|
274
|
+
if ($[22] !== resizable) {
|
|
275
|
+
t10 = value => {
|
|
263
276
|
const rounded = Math.round(value);
|
|
264
277
|
currentWidthRef.current = rounded;
|
|
265
278
|
startTransition(() => {
|
|
@@ -275,28 +288,28 @@ function usePaneWidth(t0) {
|
|
|
275
288
|
localStoragePersister.save(widthStorageKeyRef.current, rounded);
|
|
276
289
|
}
|
|
277
290
|
};
|
|
278
|
-
$[
|
|
279
|
-
$[
|
|
291
|
+
$[22] = resizable;
|
|
292
|
+
$[23] = t10;
|
|
280
293
|
} else {
|
|
281
|
-
|
|
294
|
+
t10 = $[23];
|
|
282
295
|
}
|
|
283
|
-
const saveWidth =
|
|
296
|
+
const saveWidth = t10;
|
|
284
297
|
const getMaxPaneWidthRef = React.useRef(getMaxPaneWidth);
|
|
285
|
-
let
|
|
286
|
-
if ($[
|
|
287
|
-
|
|
298
|
+
let t11;
|
|
299
|
+
if ($[24] !== getMaxPaneWidth) {
|
|
300
|
+
t11 = () => {
|
|
288
301
|
getMaxPaneWidthRef.current = getMaxPaneWidth;
|
|
289
302
|
};
|
|
290
|
-
$[
|
|
291
|
-
$[
|
|
303
|
+
$[24] = getMaxPaneWidth;
|
|
304
|
+
$[25] = t11;
|
|
292
305
|
} else {
|
|
293
|
-
|
|
306
|
+
t11 = $[25];
|
|
294
307
|
}
|
|
295
|
-
useIsomorphicLayoutEffect(
|
|
296
|
-
let t11;
|
|
308
|
+
useIsomorphicLayoutEffect(t11);
|
|
297
309
|
let t12;
|
|
298
|
-
|
|
299
|
-
|
|
310
|
+
let t13;
|
|
311
|
+
if ($[26] !== constrainToViewport || $[27] !== contentWrapperRef || $[28] !== customMaxWidth || $[29] !== handleRef || $[30] !== minPaneWidth || $[31] !== paneRef || $[32] !== resizable) {
|
|
312
|
+
t12 = () => {
|
|
300
313
|
var _paneRef$current3;
|
|
301
314
|
if (!resizable) {
|
|
302
315
|
return;
|
|
@@ -308,7 +321,7 @@ function usePaneWidth(t0) {
|
|
|
308
321
|
const crossedBreakpoint = lastViewportWidth < DEFAULT_PANE_MAX_WIDTH_DIFF_BREAKPOINT && currentViewportWidth >= DEFAULT_PANE_MAX_WIDTH_DIFF_BREAKPOINT || lastViewportWidth >= DEFAULT_PANE_MAX_WIDTH_DIFF_BREAKPOINT && currentViewportWidth < DEFAULT_PANE_MAX_WIDTH_DIFF_BREAKPOINT;
|
|
309
322
|
lastViewportWidth = currentViewportWidth;
|
|
310
323
|
if (crossedBreakpoint) {
|
|
311
|
-
maxWidthDiffRef.current = getPaneMaxWidthDiff(paneRef.current);
|
|
324
|
+
maxWidthDiffRef.current = getPaneMaxWidthDiff(paneRef.current, constrainToViewport);
|
|
312
325
|
}
|
|
313
326
|
const actualMax = getMaxPaneWidthRef.current();
|
|
314
327
|
(_paneRef$current = paneRef.current) === null || _paneRef$current === void 0 ? void 0 : _paneRef$current.style.setProperty("--pane-max-width", `${actualMax}px`);
|
|
@@ -329,7 +342,7 @@ function usePaneWidth(t0) {
|
|
|
329
342
|
}
|
|
330
343
|
});
|
|
331
344
|
};
|
|
332
|
-
maxWidthDiffRef.current = getPaneMaxWidthDiff(paneRef.current);
|
|
345
|
+
maxWidthDiffRef.current = getPaneMaxWidthDiff(paneRef.current, constrainToViewport);
|
|
333
346
|
const initialMax = getMaxPaneWidthRef.current();
|
|
334
347
|
setMaxPaneWidth(initialMax);
|
|
335
348
|
(_paneRef$current3 = paneRef.current) === null || _paneRef$current3 === void 0 ? void 0 : _paneRef$current3.style.setProperty("--pane-max-width", `${initialMax}px`);
|
|
@@ -338,7 +351,7 @@ function usePaneWidth(t0) {
|
|
|
338
351
|
max: initialMax,
|
|
339
352
|
current: currentWidthRef.current
|
|
340
353
|
});
|
|
341
|
-
if (customMaxWidth !== null) {
|
|
354
|
+
if (customMaxWidth !== null && !constrainToViewport) {
|
|
342
355
|
return;
|
|
343
356
|
}
|
|
344
357
|
let lastUpdateTime = 0;
|
|
@@ -401,23 +414,24 @@ function usePaneWidth(t0) {
|
|
|
401
414
|
window.removeEventListener("resize", handleResize);
|
|
402
415
|
};
|
|
403
416
|
};
|
|
404
|
-
|
|
405
|
-
$[
|
|
406
|
-
$[
|
|
407
|
-
$[
|
|
408
|
-
$[
|
|
409
|
-
$[
|
|
410
|
-
$[
|
|
411
|
-
$[
|
|
412
|
-
$[
|
|
417
|
+
t13 = [resizable, customMaxWidth, constrainToViewport, minPaneWidth, paneRef, handleRef, contentWrapperRef];
|
|
418
|
+
$[26] = constrainToViewport;
|
|
419
|
+
$[27] = contentWrapperRef;
|
|
420
|
+
$[28] = customMaxWidth;
|
|
421
|
+
$[29] = handleRef;
|
|
422
|
+
$[30] = minPaneWidth;
|
|
423
|
+
$[31] = paneRef;
|
|
424
|
+
$[32] = resizable;
|
|
425
|
+
$[33] = t12;
|
|
426
|
+
$[34] = t13;
|
|
413
427
|
} else {
|
|
414
|
-
|
|
415
|
-
|
|
428
|
+
t12 = $[33];
|
|
429
|
+
t13 = $[34];
|
|
416
430
|
}
|
|
417
|
-
useIsomorphicLayoutEffect(
|
|
418
|
-
let
|
|
419
|
-
if ($[
|
|
420
|
-
|
|
431
|
+
useIsomorphicLayoutEffect(t12, t13);
|
|
432
|
+
let t14;
|
|
433
|
+
if ($[35] !== currentWidth || $[36] !== getDefaultWidth || $[37] !== getMaxPaneWidth || $[38] !== maxPaneWidth || $[39] !== minPaneWidth || $[40] !== saveWidth) {
|
|
434
|
+
t14 = {
|
|
421
435
|
currentWidth,
|
|
422
436
|
currentWidthRef,
|
|
423
437
|
minPaneWidth,
|
|
@@ -426,17 +440,17 @@ function usePaneWidth(t0) {
|
|
|
426
440
|
saveWidth,
|
|
427
441
|
getDefaultWidth
|
|
428
442
|
};
|
|
429
|
-
$[
|
|
430
|
-
$[
|
|
431
|
-
$[
|
|
432
|
-
$[
|
|
433
|
-
$[
|
|
434
|
-
$[
|
|
435
|
-
$[
|
|
443
|
+
$[35] = currentWidth;
|
|
444
|
+
$[36] = getDefaultWidth;
|
|
445
|
+
$[37] = getMaxPaneWidth;
|
|
446
|
+
$[38] = maxPaneWidth;
|
|
447
|
+
$[39] = minPaneWidth;
|
|
448
|
+
$[40] = saveWidth;
|
|
449
|
+
$[41] = t14;
|
|
436
450
|
} else {
|
|
437
|
-
|
|
451
|
+
t14 = $[41];
|
|
438
452
|
}
|
|
439
|
-
return
|
|
453
|
+
return t14;
|
|
440
454
|
}
|
|
441
455
|
|
|
442
|
-
export { ARROW_KEY_STEP, DEFAULT_MAX_WIDTH_DIFF, SSR_DEFAULT_MAX_WIDTH, defaultPaneWidth, getDefaultPaneWidth, getPaneMaxWidthDiff, isCustomWidthOptions, isPaneWidth, updateAriaValues, usePaneWidth };
|
|
456
|
+
export { ARROW_KEY_STEP, DEFAULT_MAX_WIDTH_DIFF, DEFAULT_SIDEBAR_MAX_WIDTH_DIFF, SSR_DEFAULT_MAX_WIDTH, defaultPaneWidth, getDefaultPaneWidth, getPaneMaxWidthDiff, isCustomWidthOptions, isPaneWidth, updateAriaValues, usePaneWidth };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type { PageLayoutContentProps, PageLayoutFooterProps, PageLayoutHeaderProps, PageLayoutPaneProps } from '../PageLayout';
|
|
2
|
+
import type { PageLayoutContentProps, PageLayoutFooterProps, PageLayoutHeaderProps, PageLayoutPaneProps, PageLayoutSidebarProps } from '../PageLayout';
|
|
3
3
|
export type SplitPageLayoutProps = {
|
|
4
4
|
className?: string;
|
|
5
5
|
};
|
|
@@ -10,12 +10,15 @@ export type SplitPageLayoutContentProps = PageLayoutContentProps;
|
|
|
10
10
|
export declare const Content: React.FC<React.PropsWithChildren<SplitPageLayoutContentProps>>;
|
|
11
11
|
export type SplitPageLayoutPaneProps = PageLayoutPaneProps;
|
|
12
12
|
export declare const Pane: React.FC<React.PropsWithChildren<SplitPageLayoutPaneProps>>;
|
|
13
|
+
export type SplitPageLayoutSidebarProps = PageLayoutSidebarProps;
|
|
14
|
+
export declare const Sidebar: React.FC<React.PropsWithChildren<SplitPageLayoutSidebarProps>>;
|
|
13
15
|
export type SplitPageLayoutFooterProps = PageLayoutFooterProps;
|
|
14
16
|
export declare const Footer: React.FC<React.PropsWithChildren<SplitPageLayoutFooterProps>>;
|
|
15
17
|
export declare const SplitPageLayout: React.FC<React.PropsWithChildren<SplitPageLayoutProps>> & {
|
|
16
18
|
Header: React.FC<React.PropsWithChildren<PageLayoutHeaderProps>>;
|
|
17
19
|
Content: React.FC<React.PropsWithChildren<PageLayoutContentProps>>;
|
|
18
20
|
Pane: React.FC<React.PropsWithChildren<PageLayoutPaneProps>>;
|
|
21
|
+
Sidebar: React.FC<React.PropsWithChildren<PageLayoutSidebarProps>>;
|
|
19
22
|
Footer: React.FC<React.PropsWithChildren<PageLayoutFooterProps>>;
|
|
20
23
|
};
|
|
21
24
|
//# sourceMappingURL=SplitPageLayout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SplitPageLayout.d.ts","sourceRoot":"","sources":["../../src/SplitPageLayout/SplitPageLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"SplitPageLayout.d.ts","sourceRoot":"","sources":["../../src/SplitPageLayout/SplitPageLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,eAAe,CAAA;AAMtB,MAAM,MAAM,oBAAoB,GAAG;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAC,CAAA;AAEvD,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAexE,CAAA;AAOD,MAAM,MAAM,0BAA0B,GAAG,qBAAqB,CAAA;AAE9D,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,0BAA0B,CAAC,CAOhF,CAAA;AAOD,MAAM,MAAM,2BAA2B,GAAG,sBAAsB,CAAA;AAEhE,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,2BAA2B,CAAC,CAMlF,CAAA;AAOD,MAAM,MAAM,wBAAwB,GAAG,mBAAmB,CAAA;AAE1D,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,wBAAwB,CAAC,CAgB5E,CAAA;AAMD,MAAM,MAAM,2BAA2B,GAAG,sBAAsB,CAAA;AAEhE,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,2BAA2B,CAAC,CAOlF,CAAA;AAOD,MAAM,MAAM,0BAA0B,GAAG,qBAAqB,CAAA;AAE9D,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,0BAA0B,CAAC,CAOhF,CAAA;AAOD,eAAO,MAAM,eAAe;;;;;;CAM1B,CAAA"}
|
|
@@ -8,7 +8,8 @@ const Root = props => {
|
|
|
8
8
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
9
9
|
t0 = {
|
|
10
10
|
header: Header,
|
|
11
|
-
footer: Footer
|
|
11
|
+
footer: Footer,
|
|
12
|
+
sidebar: Sidebar
|
|
12
13
|
};
|
|
13
14
|
$[0] = t0;
|
|
14
15
|
} else {
|
|
@@ -176,6 +177,56 @@ const Pane = t0 => {
|
|
|
176
177
|
};
|
|
177
178
|
Pane.displayName = 'SplitPageLayout.Pane';
|
|
178
179
|
|
|
180
|
+
// ----------------------------------------------------------------------------
|
|
181
|
+
// SplitPageLayout.Sidebar
|
|
182
|
+
|
|
183
|
+
const Sidebar = t0 => {
|
|
184
|
+
const $ = c(10);
|
|
185
|
+
let props;
|
|
186
|
+
let t1;
|
|
187
|
+
let t2;
|
|
188
|
+
let t3;
|
|
189
|
+
if ($[0] !== t0) {
|
|
190
|
+
({
|
|
191
|
+
position: t1,
|
|
192
|
+
padding: t2,
|
|
193
|
+
divider: t3,
|
|
194
|
+
...props
|
|
195
|
+
} = t0);
|
|
196
|
+
$[0] = t0;
|
|
197
|
+
$[1] = props;
|
|
198
|
+
$[2] = t1;
|
|
199
|
+
$[3] = t2;
|
|
200
|
+
$[4] = t3;
|
|
201
|
+
} else {
|
|
202
|
+
props = $[1];
|
|
203
|
+
t1 = $[2];
|
|
204
|
+
t2 = $[3];
|
|
205
|
+
t3 = $[4];
|
|
206
|
+
}
|
|
207
|
+
const position = t1 === undefined ? "start" : t1;
|
|
208
|
+
const padding = t2 === undefined ? "normal" : t2;
|
|
209
|
+
const divider = t3 === undefined ? "line" : t3;
|
|
210
|
+
let t4;
|
|
211
|
+
if ($[5] !== divider || $[6] !== padding || $[7] !== position || $[8] !== props) {
|
|
212
|
+
t4 = /*#__PURE__*/jsx(PageLayout.Sidebar, {
|
|
213
|
+
position: position,
|
|
214
|
+
padding: padding,
|
|
215
|
+
divider: divider,
|
|
216
|
+
...props
|
|
217
|
+
});
|
|
218
|
+
$[5] = divider;
|
|
219
|
+
$[6] = padding;
|
|
220
|
+
$[7] = position;
|
|
221
|
+
$[8] = props;
|
|
222
|
+
$[9] = t4;
|
|
223
|
+
} else {
|
|
224
|
+
t4 = $[9];
|
|
225
|
+
}
|
|
226
|
+
return t4;
|
|
227
|
+
};
|
|
228
|
+
Sidebar.displayName = 'SplitPageLayout.Sidebar';
|
|
229
|
+
|
|
179
230
|
// ----------------------------------------------------------------------------
|
|
180
231
|
// SplitPageLayout.Footer
|
|
181
232
|
|
|
@@ -226,7 +277,8 @@ const SplitPageLayout = Object.assign(Root, {
|
|
|
226
277
|
Header,
|
|
227
278
|
Content,
|
|
228
279
|
Pane,
|
|
280
|
+
Sidebar,
|
|
229
281
|
Footer
|
|
230
282
|
});
|
|
231
283
|
|
|
232
|
-
export { Content, Footer, Header, Pane, Root, SplitPageLayout };
|
|
284
|
+
export { Content, Footer, Header, Pane, Root, Sidebar, SplitPageLayout };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnderlineNav.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNav.tsx"],"names":[],"mappings":"AACA,OAAO,KAA6D,MAAM,OAAO,CAAA;AAmBjF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;IACjD,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAA;CAC5B,CAAA;AAGD,eAAO,MAAM,cAAc,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"UnderlineNav.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNav.tsx"],"names":[],"mappings":"AACA,OAAO,KAA6D,MAAM,OAAO,CAAA;AAmBjF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;IACjD,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAA;CAC5B,CAAA;AAGD,eAAO,MAAM,cAAc,KAAK,CAAA;AAuEhC,eAAO,MAAM,gBAAgB,GAAI,UAAU,KAAK,CAAC,SAAS,KAEgC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,EAChH,CAAA;AAgCD,eAAO,MAAM,YAAY,mFA8RxB,CAAA"}
|
|
@@ -27,8 +27,7 @@ const overflowEffect = (navWidth, moreMenuWidth, childArray, childWidthArray, no
|
|
|
27
27
|
updateListAndMenu({
|
|
28
28
|
items: childArray,
|
|
29
29
|
menuItems: []
|
|
30
|
-
}, iconsVisible
|
|
31
|
-
return;
|
|
30
|
+
}, iconsVisible);
|
|
32
31
|
}
|
|
33
32
|
const numberOfItemsPossible = calculatePossibleItems(childWidthArray, navWidth);
|
|
34
33
|
const numberOfItemsWithoutIconPossible = calculatePossibleItems(noIconChildWidthArray, navWidth);
|
|
@@ -79,7 +78,7 @@ const overflowEffect = (navWidth, moreMenuWidth, childArray, childWidthArray, no
|
|
|
79
78
|
updateListAndMenu({
|
|
80
79
|
items,
|
|
81
80
|
menuItems
|
|
82
|
-
}, iconsVisible
|
|
81
|
+
}, iconsVisible);
|
|
83
82
|
};
|
|
84
83
|
const getValidChildren = children => {
|
|
85
84
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -134,8 +133,6 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
|
|
|
134
133
|
const [iconsVisible, setIconsVisible] = useState(true);
|
|
135
134
|
const [childWidthArray, setChildWidthArray] = useState([]);
|
|
136
135
|
const [noIconChildWidthArray, setNoIconChildWidthArray] = useState([]);
|
|
137
|
-
// Track whether the initial overflow calculation is complete to prevent CLS
|
|
138
|
-
const [isOverflowMeasured, setIsOverflowMeasured] = useState(false);
|
|
139
136
|
const validChildren = getValidChildren(children);
|
|
140
137
|
|
|
141
138
|
// Responsive props object manages which items are in the list and which items are in the menu.
|
|
@@ -195,7 +192,7 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
|
|
|
195
192
|
callback({
|
|
196
193
|
items: updatedItemList,
|
|
197
194
|
menuItems: updatedMenuItems
|
|
198
|
-
}, false
|
|
195
|
+
}, false);
|
|
199
196
|
};
|
|
200
197
|
// How many items do we need to pull in to the menu to make room for the selected menu item.
|
|
201
198
|
function getBreakpointForItemSwapping(widthToFitIntoList, availableSpace) {
|
|
@@ -210,12 +207,9 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
|
|
|
210
207
|
}
|
|
211
208
|
return breakpoint;
|
|
212
209
|
}
|
|
213
|
-
const updateListAndMenu = useCallback((props, displayIcons
|
|
210
|
+
const updateListAndMenu = useCallback((props, displayIcons) => {
|
|
214
211
|
setResponsiveProps(props);
|
|
215
212
|
setIconsVisible(displayIcons);
|
|
216
|
-
if (overflowMeasured) {
|
|
217
|
-
setIsOverflowMeasured(true);
|
|
218
|
-
}
|
|
219
213
|
}, []);
|
|
220
214
|
const setChildrenWidth = useCallback(size => {
|
|
221
215
|
setChildWidthArray(arr => {
|
|
@@ -294,7 +288,6 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
|
|
|
294
288
|
className: className,
|
|
295
289
|
ref: navRef,
|
|
296
290
|
"data-variant": variant,
|
|
297
|
-
"data-overflow-measured": isOverflowMeasured ? 'true' : 'false',
|
|
298
291
|
children: /*#__PURE__*/jsxs(UnderlineItemList, {
|
|
299
292
|
ref: listRef,
|
|
300
293
|
role: "list",
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.prc-SelectPanel2-Overlay--Q-FI{border:none;color:var(--fgColor-default,var(--color-fg-default));padding:0;--max-height:0;--position-top:0;--position-left:0}.prc-SelectPanel2-Overlay--Q-FI:where([open]){display:flex}.prc-SelectPanel2-Overlay--Q-FI:where([data-variant=anchored]),.prc-SelectPanel2-Overlay--Q-FI:where([data-variant=full-screen]){left:var(--position-left);margin:0;top:var(--position-top)}:is(.prc-SelectPanel2-Overlay--Q-FI:where([data-variant=anchored]),.prc-SelectPanel2-Overlay--Q-FI:where([data-variant=full-screen]))::backdrop{background-color:transparent}.prc-SelectPanel2-Overlay--Q-FI:where([data-variant=modal]){bottom:0;left:0;right:0;top:0}.prc-SelectPanel2-Overlay--Q-FI:where([data-variant=modal])::backdrop{background-color:var(--overlay-backdrop-bgColor,var(--color-overlay-backdrop))}.prc-SelectPanel2-Overlay--Q-FI:where([data-variant=full-screen]){border-radius:unset;height:100%;left:0;margin:0;max-height:100vh;max-width:100vw;top:0;width:100%}.prc-SelectPanel2-Overlay--Q-FI:where([data-variant=bottom-sheet]){border-bottom-left-radius:0;border-bottom-right-radius:0;bottom:0;left:0;margin:0;max-height:calc(100vh - 64px);max-width:100vw;top:auto;width:100%}.prc-SelectPanel2-Form-bZ9HS{width:100%}.prc-SelectPanel2-Container-e5e6-,.prc-SelectPanel2-Form-bZ9HS{display:flex;flex-direction:column}.prc-SelectPanel2-Container-e5e6-{flex-grow:1;flex-shrink:1;justify-content:space-between;overflow:hidden}.prc-SelectPanel2-Container-e5e6- ul{flex-grow:1;overflow-y:auto}.prc-SelectPanel2-HeaderContent-MsaAS{align-items:center;display:flex;justify-content:space-between;margin-bottom:0}.prc-SelectPanel2-HeaderContent-MsaAS:where([data-description]){align-items:flex-start}.prc-SelectPanel2-HeaderContent-MsaAS:where([data-search-input]){margin-bottom:var(--base-size-8,.5rem)}.prc-SelectPanel2-TitleWrapper-HzPu3{margin-left:var(--base-size-8,.5rem);margin-top:0}.prc-SelectPanel2-TitleWrapper-HzPu3:where([data-description]){margin-top:2px}.prc-SelectPanel2-TitleWrapper-HzPu3:where([data-on-back]){margin-left:var(--base-size-4,.25rem)}.prc-SelectPanel2-TextInput-lHH1n{padding-left:var(--base-size-8,.5rem)!important}.prc-SelectPanel2-TextInput-lHH1n:has(input:placeholder-shown) .TextInput-action{display:none}.prc-SelectPanel2-Checkbox-AYR38{margin-top:0}.prc-SelectPanel2-FlexBox-gWPRg{display:flex}.prc-SelectPanel2-Title-T-h3f{font-size:var(--text-body-size-medium,.875rem);font-weight:var(--base-text-weight-semibold,600)}.prc-SelectPanel2-Description-qTXfi{display:block;font-size:var(--text-body-size-small,.75rem)}.prc-SelectPanel2-ClearAction-tQj-f,.prc-SelectPanel2-Description-qTXfi{color:var(--fgColor-muted,var(--color-fg-muted))}.prc-SelectPanel2-ClearAction-tQj-f{background:none}.prc-SelectPanel2-Footer-TibV0{align-items:center;border-top:var(--borderWidth-thin,.0625rem) solid;border-top-color:var(--borderColor-default,var(--color-border-default));display:flex;flex-shrink:0;justify-content:space-between;min-height:44px;padding:var(--base-size-16,1rem)}.prc-SelectPanel2-Footer-TibV0:where([data-hide-primary-actions]){padding:var(--base-size-8,.5rem)}.prc-SelectPanel2-FooterContent-UjAOM{flex-grow:0}.prc-SelectPanel2-FooterContent-UjAOM:where([data-hide-primary-actions]){flex-grow:1}.prc-SelectPanel2-FooterActions-T6yQR,.prc-SelectPanel2-SecondaryCheckbox-omkf-{display:flex;gap:var(--stack-gap-condensed,.5rem)}.prc-SelectPanel2-SecondaryCheckbox-omkf-{align-items:center}.prc-SelectPanel2-SmallText-c42ay{font-size:var(--text-body-size-small,.75rem)}.prc-SelectPanel2-SelectPanelLoading-mtyhD{align-items:center;display:flex;flex-direction:column;gap:var(--stack-gap-normal,1rem);height:100%;justify-content:center;min-height:min(calc(var(--max-height) - 150px),324px)}.prc-SelectPanel2-LoadingText-DB0wN{color:var(--fgColor-muted,var(--color-fg-muted));font-size:var(--text-body-size-medium,.875rem)}.prc-SelectPanel2-MessageFull-nY-qF{align-items:center;display:flex;flex-direction:column;flex-grow:1;gap:var(--base-size-4,.25rem);height:100%;justify-content:center;min-height:min(calc(var(--max-height) - 150px),324px);padding-left:var(--base-size-24,1.5rem);padding-right:var(--base-size-24,1.5rem);text-align:center}.prc-SelectPanel2-MessageFull-nY-qF a{color:inherit;-webkit-text-decoration:underline;text-decoration:underline}.prc-SelectPanel2-Octicon-zt-zU{margin-bottom:var(--base-size-8,.5rem)}.prc-SelectPanel2-Octicon-zt-zU.prc-SelectPanel2-Error-ZrZQQ{color:var(--fgColor-danger,var(--color-danger-fg))}.prc-SelectPanel2-Octicon-zt-zU.prc-SelectPanel2-Warning-PDsVF{color:var(--fgColor-attention,var(--color-attention-fg))}.prc-SelectPanel2-MessageTitle-T7v9d{font-size:var(--text-body-size-medium,.875rem);font-weight:var(--base-text-weight-medium,500)}.prc-SelectPanel2-MessageContent-UZ9vY{align-items:center;color:var(--fgColor-muted,var(--color-fg-muted));flex-direction:column;font-size:var(--text-body-size-medium,.875rem)}.prc-SelectPanel2-MessageContent-UZ9vY,.prc-SelectPanel2-MessageInline-sErQf{display:flex;gap:var(--stack-gap-condensed,.5rem)}.prc-SelectPanel2-MessageInline-sErQf{border-bottom:var(--borderWidth-thin,.0625rem) solid;font-size:var(--text-body-size-small,.75rem);padding:var(--base-size-12,.75rem) var(--base-size-16,1rem)}.prc-SelectPanel2-MessageInline-sErQf a{color:inherit;-webkit-text-decoration:underline;text-decoration:underline}.prc-SelectPanel2-MessageInline-sErQf:where([data-variant=error]){background-color:var(--bgColor-danger-muted,var(--color-danger-subtle));border-color:var(--borderColor-danger-muted,var(--color-danger-muted));color:var(--fgColor-danger,var(--color-danger-fg))}.prc-SelectPanel2-MessageInline-sErQf:where([data-variant=warning]){background-color:var(--bgColor-attention-muted,var(--color-attention-subtle));border-color:var(--borderColor-attention-muted,var(--color-attention-muted));color:var(--fgColor-attention,var(--color-attention-fg))}.prc-SelectPanel2-Header-LKyEJ{border-bottom:var(--borderWidth-thin,.0625rem) solid;border-bottom-color:var(--borderColor-default,var(--color-border-default));display:flex;flex-direction:column;padding:var(--base-size-8,.5rem)}
|
|
2
|
+
/*# sourceMappingURL=SelectPanel-1f8c23b5.css.map */
|
package/dist/experimental/SelectPanel2/{SelectPanel-f0c4b9ca.css.map → SelectPanel-1f8c23b5.css.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/experimental/SelectPanel2/SelectPanel.module.css.js"],"names":[],"mappings":"AAAA,gCAGE,WAAY,CADZ,oDAA6B,CAD7B,SAAU,CAKV,cAAe,CACf,gBAAiB,CACjB,iBAoDF,CAlDE,8CACE,YACF,CAEA,iIAKE,yBAA0B,CAC1B,QAAS,CAHT,uBAQF,CAHE,gJACE,4BACF,CAGF,4DAIE,QAAS,CAFT,MAAO,CACP,OAAQ,CAFR,KAIF,CAEA,sEACE,8EACF,CAEA,kEAQE,mBAAoB,CAHpB,WAAY,CAHZ,MAAO,CAKP,QAAS,CADT,gBAAiB,CAFjB,eAAgB,CAHhB,KAAM,CAEN,UAMF,CAEA,mEASE,2BAA4B,CAD5B,4BAA6B,CAN7B,QAAS,CACT,MAAO,CAIP,QAAS,CADT,6BAA8B,CAD9B,eAAgB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E,kEACE,gCACF,CAGF,sCACE,WAKF,CAHE,yEACE,WACF,CAQF,gFAJE,YAAa,CACb,oCAOF,CAJA,0CAEE,kBAEF,CAEA,kCACE,4CACF,CAEA,2CAQE,kBAAmB,CAPnB,YAAa,CAKb,qBAAsB,CAGtB,gCAA4B,CAP5B,WAAY,CAKZ,sBAAuB,CAFvB,qDAKF,CAEA,oCAEE,gDAA2B,CAD3B,8CAEF,CAEA,oCAWE,kBAAmB,CAVnB,YAAa,CAQb,qBAAsB,CAGtB,WAAY,CACZ,6BAAuB,CAXvB,WAAY,CAQZ,sBAAuB,CALvB,qDAAuD,CAEvD,uCAAiC,CADjC,wCAAkC,CAElC,iBAWF,CAJE,sCACE,aAAc,CACd,iCAA0B,CAA1B,yBACF,CAGF,gCACE,sCASF,CAPE,6DACE,kDACF,CAEA,+DACE,wDACF,CAGF,qCACE,8CAAuC,CACvC,8CACF,CAEA,uCAME,kBAAmB,CAHnB,gDAA2B,CAC3B,qBAAsB,CAFtB,8CAKF,CAEA,6EARE,YAAa,CAIb,oCA8BF,CA1BA,sCAOE,oDAA4C,CAD5C,4CAAsC,CADtC,2DAqBF,CAhBE,wCACE,aAAc,CACd,iCAA0B,CAA1B,yBACF,CAEA,kEAEE,uEAA6C,CAC7C,sEAA6C,CAF7C,kDAGF,CAEA,oEAEE,6EAAgD,CAChD,4EAAgD,CAFhD,wDAGF,CAGF,+BAIE,oDAA4C,CAC5C,0EAA+C,CAJ/C,YAAa,CAEb,qBAAsB,CADtB,gCAIF","file":"SelectPanel-1f8c23b5.css","sourcesContent":[".Overlay {\n padding: 0;\n color: var(--fgColor-default);\n border: none;\n\n /* CSS variables values are passed in via styles */\n --max-height: 0;\n --position-top: 0;\n --position-left: 0;\n\n &:where([open]) {\n display: flex; /* to fit children */\n }\n\n &:where([data-variant='anchored']),\n &:where([data-variant='full-screen']) {\n /* stylelint-disable-next-line primer/spacing */\n top: var(--position-top);\n /* stylelint-disable-next-line primer/spacing */\n left: var(--position-left);\n margin: 0;\n\n &::backdrop {\n background-color: transparent;\n }\n }\n\n &:where([data-variant='modal']) {\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n }\n\n &:where([data-variant='modal'])::backdrop {\n background-color: var(--overlay-backdrop-bgColor);\n }\n\n &:where([data-variant='full-screen']) {\n top: 0;\n left: 0;\n width: 100%;\n max-width: 100vw;\n height: 100%;\n max-height: 100vh;\n margin: 0;\n border-radius: unset;\n }\n\n &:where([data-variant='bottom-sheet']) {\n top: auto;\n bottom: 0;\n left: 0;\n width: 100%;\n max-width: 100vw;\n max-height: calc(100vh - 64px);\n margin: 0;\n border-bottom-right-radius: 0;\n border-bottom-left-radius: 0;\n }\n}\n\n.Form {\n display: flex;\n width: 100%;\n flex-direction: column;\n}\n\n.Container {\n display: flex;\n overflow: hidden;\n flex-direction: column;\n flex-shrink: 1;\n flex-grow: 1;\n justify-content: space-between;\n\n ul {\n overflow-y: auto;\n flex-grow: 1;\n }\n}\n\n.HeaderContent {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 0;\n\n &:where([data-description]) {\n align-items: flex-start;\n }\n\n &:where([data-search-input]) {\n margin-bottom: var(--base-size-8);\n }\n}\n\n.TitleWrapper {\n margin-top: 0;\n margin-left: var(--base-size-8);\n\n &:where([data-description]) {\n /* stylelint-disable-next-line primer/spacing */\n margin-top: 2px;\n }\n\n &:where([data-on-back]) {\n margin-left: var(--base-size-4);\n }\n}\n\n.TextInput {\n padding-left: var(--base-size-8) !important;\n\n /* stylelint-disable-next-line selector-class-pattern */\n &:has(input:placeholder-shown) :global(.TextInput-action) {\n display: none;\n }\n}\n\n.Checkbox {\n margin-top: 0;\n}\n\n.FlexBox {\n display: flex;\n}\n\n.Title {\n font-size: var(--text-body-size-medium);\n font-weight: var(--base-text-weight-semibold);\n}\n\n.Description {\n display: block;\n font-size: var(--text-body-size-small);\n color: var(--fgColor-muted);\n}\n\n.ClearAction {\n color: var(--fgColor-muted);\n background: none;\n}\n\n.Footer {\n display: flex;\n min-height: 44px;\n padding: var(--base-size-16);\n border-top: var(--borderWidth-thin) solid;\n border-top-color: var(--borderColor-default);\n justify-content: space-between;\n align-items: center;\n flex-shrink: 0;\n\n &:where([data-hide-primary-actions]) {\n padding: var(--base-size-8);\n }\n}\n\n.FooterContent {\n flex-grow: 0;\n\n &:where([data-hide-primary-actions]) {\n flex-grow: 1;\n }\n}\n\n.FooterActions {\n display: flex;\n gap: var(--stack-gap-condensed);\n}\n\n.SecondaryCheckbox {\n display: flex;\n align-items: center;\n gap: var(--stack-gap-condensed);\n}\n\n.SmallText {\n font-size: var(--text-body-size-small);\n}\n\n.SelectPanelLoading {\n display: flex;\n height: 100%;\n\n /* maxHeight of dialog - (header & footer) */\n min-height: min(calc(var(--max-height) - 150px), 324px);\n flex-direction: column;\n justify-content: center;\n align-items: center;\n gap: var(--stack-gap-normal);\n}\n\n.LoadingText {\n font-size: var(--text-body-size-medium);\n color: var(--fgColor-muted);\n}\n\n.MessageFull {\n display: flex;\n height: 100%;\n\n /* maxHeight of dialog - (header & footer) */\n min-height: min(calc(var(--max-height) - 150px), 324px);\n padding-right: var(--base-size-24);\n padding-left: var(--base-size-24);\n text-align: center;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n flex-grow: 1;\n gap: var(--base-size-4);\n\n a {\n color: inherit;\n text-decoration: underline;\n }\n}\n\n.Octicon {\n margin-bottom: var(--base-size-8);\n\n &.Error {\n color: var(--fgColor-danger);\n }\n\n &.Warning {\n color: var(--fgColor-attention);\n }\n}\n\n.MessageTitle {\n font-size: var(--text-body-size-medium);\n font-weight: var(--base-text-weight-medium);\n}\n\n.MessageContent {\n display: flex;\n font-size: var(--text-body-size-medium);\n color: var(--fgColor-muted);\n flex-direction: column;\n gap: var(--stack-gap-condensed);\n align-items: center;\n}\n\n.MessageInline {\n display: flex;\n padding-top: var(--base-size-12);\n padding-right: var(--base-size-16);\n padding-bottom: var(--base-size-12);\n padding-left: var(--base-size-16);\n font-size: var(--text-body-size-small);\n border-bottom: var(--borderWidth-thin) solid;\n gap: var(--stack-gap-condensed);\n\n a {\n color: inherit;\n text-decoration: underline;\n }\n\n &:where([data-variant='error']) {\n color: var(--fgColor-danger);\n background-color: var(--bgColor-danger-muted);\n border-color: var(--borderColor-danger-muted);\n }\n\n &:where([data-variant='warning']) {\n color: var(--fgColor-attention);\n background-color: var(--bgColor-attention-muted);\n border-color: var(--borderColor-attention-muted);\n }\n}\n\n.Header {\n display: flex;\n padding: var(--base-size-8);\n flex-direction: column;\n border-bottom: var(--borderWidth-thin) solid;\n border-bottom-color: var(--borderColor-default);\n}\n"]}
|