@galaxy-io/dls 2.10.0 → 2.10.2
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/dist/menu/ContextMenu.d.ts +6 -0
- package/dist/menu/Menu.d.ts +7 -0
- package/dist/menu/Menu.js +30 -18
- package/dist/navigation/Tabs.d.ts +4 -2
- package/dist/navigation/Tabs.js +52 -32
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -34,6 +34,12 @@ export interface ContextMenuProps extends AriaAttributes {
|
|
|
34
34
|
* @default MenuVariant.BASE
|
|
35
35
|
*/
|
|
36
36
|
variant?: MenuVariant;
|
|
37
|
+
/**
|
|
38
|
+
* Accepted for parity with `Menu` and has no effect: a context menu opens at the pointer, so
|
|
39
|
+
* there is no trigger box to match. It sizes to its rows.
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
shouldMatchTriggerWidth?: boolean;
|
|
37
43
|
/** Controlled open state. When set, ContextMenu calls `onOpenChange` and lets the caller decide. */
|
|
38
44
|
isOpen?: boolean;
|
|
39
45
|
/**
|
package/dist/menu/Menu.d.ts
CHANGED
|
@@ -56,6 +56,13 @@ export interface MenuProps extends AriaAttributes {
|
|
|
56
56
|
* @default false
|
|
57
57
|
*/
|
|
58
58
|
isSearchable?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* The panel takes the trigger's width (a menu opened from a full-width row, such as a sidebar
|
|
61
|
+
* account button). The rows fill it. Never narrower than 160px. The root panel only: submenus
|
|
62
|
+
* size to their rows. No effect on `ContextMenu`, which opens at the pointer and has no trigger box.
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
shouldMatchTriggerWidth?: boolean;
|
|
59
66
|
/** Controlled open state. When set, Menu calls `onOpenChange` and lets the caller decide. */
|
|
60
67
|
isOpen?: boolean;
|
|
61
68
|
/**
|
package/dist/menu/Menu.js
CHANGED
|
@@ -163,18 +163,25 @@ var List = /*#__PURE__*/ styled("div")({
|
|
|
163
163
|
class: "gx-Menu-List-letxokg",
|
|
164
164
|
propsAsIs: false
|
|
165
165
|
});
|
|
166
|
+
/** `shouldMatchTriggerWidth`, root list: fills the panel at any width, still never under the minimum. */
|
|
167
|
+
var LIST_MATCH_TRIGGER_WIDTH_CSS = "gx-Menu-LIST_MATCH_TRIGGER_WIDTH_CSS-l1m37gth";
|
|
168
|
+
/**
|
|
169
|
+
* `shouldMatchTriggerWidth`, root panel: a trigger narrower than the list's minimum still gets the
|
|
170
|
+
* whole list (the panel is `border-box` with a hairline left and right).
|
|
171
|
+
*/
|
|
172
|
+
var PANEL_MATCH_TRIGGER_WIDTH_CSS = "gx-Menu-PANEL_MATCH_TRIGGER_WIDTH_CSS-p1ab151u";
|
|
166
173
|
/** With search: the pinned field over the scrolling list, capped to the room on screen. */
|
|
167
174
|
var SearchLayout = /*#__PURE__*/ styled("div")({
|
|
168
175
|
name: "SearchLayout",
|
|
169
|
-
class: "gx-Menu-SearchLayout-
|
|
176
|
+
class: "gx-Menu-SearchLayout-s1nyz30c",
|
|
170
177
|
propsAsIs: false
|
|
171
178
|
});
|
|
172
179
|
/** With search: only the rows scroll. */
|
|
173
|
-
var SEARCH_LIST_CSS = "gx-Menu-SEARCH_LIST_CSS-
|
|
180
|
+
var SEARCH_LIST_CSS = "gx-Menu-SEARCH_LIST_CSS-s1hougl1";
|
|
174
181
|
/** "No results": a row's box, not interactive. */
|
|
175
182
|
var MenuEmpty = /*#__PURE__*/ styled("div")({
|
|
176
183
|
name: "MenuEmpty",
|
|
177
|
-
class: "gx-Menu-MenuEmpty-
|
|
184
|
+
class: "gx-Menu-MenuEmpty-mjsjxm5",
|
|
178
185
|
propsAsIs: false
|
|
179
186
|
});
|
|
180
187
|
/**
|
|
@@ -183,53 +190,53 @@ var MenuEmpty = /*#__PURE__*/ styled("div")({
|
|
|
183
190
|
* where they are.
|
|
184
191
|
*/
|
|
185
192
|
var MENU_ITEM_VARIANT_TO_CSS_MAP = {
|
|
186
|
-
["DEFAULT"]: "gx-Menu-DEFAULT-
|
|
187
|
-
["ERROR"]: "gx-Menu-ERROR-
|
|
193
|
+
["DEFAULT"]: "gx-Menu-DEFAULT-d11wn83l",
|
|
194
|
+
["ERROR"]: "gx-Menu-ERROR-eotc445"
|
|
188
195
|
};
|
|
189
196
|
/** A disabled row. Declared after the mode map. */
|
|
190
|
-
var ITEM_DISABLED_CSS = "gx-Menu-ITEM_DISABLED_CSS-
|
|
197
|
+
var ITEM_DISABLED_CSS = "gx-Menu-ITEM_DISABLED_CSS-imfg9k5";
|
|
191
198
|
/** `leading` / `trailing`: never squeezed, so only the text shrinks. */
|
|
192
199
|
var Slot = /*#__PURE__*/ styled("span")({
|
|
193
200
|
name: "Slot",
|
|
194
|
-
class: "gx-Menu-Slot-
|
|
201
|
+
class: "gx-Menu-Slot-s1aves2k",
|
|
195
202
|
propsAsIs: false
|
|
196
203
|
});
|
|
197
204
|
/** Label and description, stacked; the only part that shrinks. */
|
|
198
205
|
var Content = /*#__PURE__*/ styled("span")({
|
|
199
206
|
name: "Content",
|
|
200
|
-
class: "gx-Menu-Content-
|
|
207
|
+
class: "gx-Menu-Content-c1n04r8w",
|
|
201
208
|
propsAsIs: false
|
|
202
209
|
});
|
|
203
210
|
/** The check marker's box (width per rung). */
|
|
204
211
|
var CheckSlot = /*#__PURE__*/ styled("span")({
|
|
205
212
|
name: "CheckSlot",
|
|
206
|
-
class: "gx-Menu-CheckSlot-
|
|
213
|
+
class: "gx-Menu-CheckSlot-cwavq3l",
|
|
207
214
|
propsAsIs: false
|
|
208
215
|
});
|
|
209
216
|
/** Icons, caps and markers never shrink. */
|
|
210
|
-
var NO_SHRINK_CSS = "gx-Menu-NO_SHRINK_CSS-
|
|
217
|
+
var NO_SHRINK_CSS = "gx-Menu-NO_SHRINK_CSS-n1dkclye";
|
|
211
218
|
/** A section of rows. */
|
|
212
219
|
var GroupRoot = /*#__PURE__*/ styled("div")({
|
|
213
220
|
name: "GroupRoot",
|
|
214
|
-
class: "gx-Menu-GroupRoot-
|
|
221
|
+
class: "gx-Menu-GroupRoot-g1wbdfpl",
|
|
215
222
|
propsAsIs: false
|
|
216
223
|
});
|
|
217
224
|
/** The section heading. */
|
|
218
225
|
var GroupLabel = /*#__PURE__*/ styled("div")({
|
|
219
226
|
name: "GroupLabel",
|
|
220
|
-
class: "gx-Menu-GroupLabel-
|
|
227
|
+
class: "gx-Menu-GroupLabel-g1e1rrjq",
|
|
221
228
|
propsAsIs: false
|
|
222
229
|
});
|
|
223
230
|
/** While a term is set, a section with no row left disappears (a structural role selector). */
|
|
224
|
-
var GROUP_FILTERED_CSS = "gx-Menu-GROUP_FILTERED_CSS-
|
|
231
|
+
var GROUP_FILTERED_CSS = "gx-Menu-GROUP_FILTERED_CSS-g28zrrg";
|
|
225
232
|
/** The separator wrapper (`role="none"`; the `<hr>` inside is the separator). */
|
|
226
233
|
var SeparatorRoot = /*#__PURE__*/ styled("div")({
|
|
227
234
|
name: "SeparatorRoot",
|
|
228
|
-
class: "gx-Menu-SeparatorRoot-
|
|
235
|
+
class: "gx-Menu-SeparatorRoot-s1c0ylq3",
|
|
229
236
|
propsAsIs: false
|
|
230
237
|
});
|
|
231
238
|
/** Space above and below a separator's rule. */
|
|
232
|
-
var SEPARATOR_CSS = "gx-Menu-SEPARATOR_CSS-
|
|
239
|
+
var SEPARATOR_CSS = "gx-Menu-SEPARATOR_CSS-sd934y5";
|
|
233
240
|
var MenuRootContext = createContext(null);
|
|
234
241
|
var MenuContext = createContext(null);
|
|
235
242
|
/** The context for a part; throws outside a menu. */
|
|
@@ -447,7 +454,7 @@ function MenuList({ children, menuAttributes, className }) {
|
|
|
447
454
|
children: /* @__PURE__ */ jsx(List, {
|
|
448
455
|
...menuAttributes,
|
|
449
456
|
ref: setListRef,
|
|
450
|
-
className,
|
|
457
|
+
className: cx(depth === 0 && root.shouldMatchTriggerWidth && LIST_MATCH_TRIGGER_WIDTH_CSS, className),
|
|
451
458
|
onKeyDown: handleKeyDown,
|
|
452
459
|
onFocus: handleFocus,
|
|
453
460
|
onPointerEnter: handlePointerEnter,
|
|
@@ -891,7 +898,7 @@ function MenuSearchBody({ children, listId, triggerId, ariaLabel }) {
|
|
|
891
898
|
* @internal Shared by Menu and ContextMenu; apps use those. The menu engine: a Popover in `MENU`
|
|
892
899
|
* role (or `DIALOG` around a search field) holding the rows, opened by `popoverTrigger`.
|
|
893
900
|
*/
|
|
894
|
-
var MenuRoot = forwardRef(function MenuRoot({ trigger, children, size = "MEDIUM", variant: variantProp, placement = Placement.BOTTOM_START, isSearchable = false, isOpen, defaultIsOpen = false, onOpenChange, isDisabled = false, ariaLabel, popoverTrigger, id, className, style, ...rest }, ref) {
|
|
901
|
+
var MenuRoot = forwardRef(function MenuRoot({ trigger, children, size = "MEDIUM", variant: variantProp, placement = Placement.BOTTOM_START, isSearchable = false, shouldMatchTriggerWidth = false, isOpen, defaultIsOpen = false, onOpenChange, isDisabled = false, ariaLabel, popoverTrigger, id, className, style, ...rest }, ref) {
|
|
895
902
|
const variant = variantProp ?? "BASE";
|
|
896
903
|
const { isOpen: isOpenState, setOpen } = useControlledOpenState({
|
|
897
904
|
isOpen,
|
|
@@ -913,11 +920,14 @@ var MenuRoot = forwardRef(function MenuRoot({ trigger, children, size = "MEDIUM"
|
|
|
913
920
|
const triggerId = typeof triggerProps.id === "string" ? triggerProps.id : generatedTriggerId;
|
|
914
921
|
const closeTree = useCallback(() => setOpen(false), [setOpen]);
|
|
915
922
|
const term = isSearchable ? normalizeSearchTerm(rawTerm) : "";
|
|
923
|
+
const isMatchingTriggerWidth = shouldMatchTriggerWidth && popoverTrigger !== PopoverTrigger.CONTEXT_MENU;
|
|
924
|
+
const panelClassName = isMatchingTriggerWidth ? cx(PANEL_MATCH_TRIGGER_WIDTH_CSS, className) : className;
|
|
916
925
|
const rootValue = useMemo(() => ({
|
|
917
926
|
size,
|
|
918
927
|
variant,
|
|
919
928
|
term,
|
|
920
929
|
isSearchable,
|
|
930
|
+
shouldMatchTriggerWidth: isMatchingTriggerWidth,
|
|
921
931
|
closeTree,
|
|
922
932
|
search: isSearchable ? {
|
|
923
933
|
inputRef,
|
|
@@ -931,6 +941,7 @@ var MenuRoot = forwardRef(function MenuRoot({ trigger, children, size = "MEDIUM"
|
|
|
931
941
|
variant,
|
|
932
942
|
term,
|
|
933
943
|
isSearchable,
|
|
944
|
+
isMatchingTriggerWidth,
|
|
934
945
|
closeTree,
|
|
935
946
|
rawTerm
|
|
936
947
|
]);
|
|
@@ -973,12 +984,13 @@ var MenuRoot = forwardRef(function MenuRoot({ trigger, children, size = "MEDIUM"
|
|
|
973
984
|
role: isSearchable ? PopoverRole.DIALOG : PopoverRole.MENU,
|
|
974
985
|
variant: MENU_VARIANT_TO_POPOVER_VARIANT_MAP[variant],
|
|
975
986
|
placement,
|
|
987
|
+
shouldMatchTriggerWidth: isMatchingTriggerWidth,
|
|
976
988
|
isOpen: isOpenState,
|
|
977
989
|
onOpenChange: setOpen,
|
|
978
990
|
isDisabled,
|
|
979
991
|
...ariaLabel === void 0 ? {} : { ariaLabel },
|
|
980
992
|
...id === void 0 ? {} : { id },
|
|
981
|
-
...
|
|
993
|
+
...panelClassName === void 0 ? {} : { className: panelClassName },
|
|
982
994
|
...style === void 0 ? {} : { style },
|
|
983
995
|
body,
|
|
984
996
|
children: triggerClone
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Icon as PhosphorIcon } from "@phosphor-icons/react";
|
|
2
2
|
import { type AriaAttributes, type CSSProperties, type ElementType, type ReactElement, type ReactNode, type RefAttributes } from "react";
|
|
3
3
|
import { Orientation, type Space } from "../theme/enums.js";
|
|
4
|
-
/** Mode (
|
|
4
|
+
/** Mode (AGENTS.md "Variant": a declared mode set, Tabs UNDERLINE / PILL; listed in scripts/lint-dls.ts MODE_SETS). */
|
|
5
5
|
export declare enum TabsVariant {
|
|
6
6
|
/** Tabs on a hairline; the selected tab has a `text.primary` indicator on the edge facing the panel. The default. */
|
|
7
7
|
UNDERLINE = "UNDERLINE",
|
|
@@ -27,7 +27,9 @@ interface TabItemBase<TId extends string = string> {
|
|
|
27
27
|
id: TId;
|
|
28
28
|
/** Visible tab text, one short word or two. Also the overflow menu row's label. */
|
|
29
29
|
label: string;
|
|
30
|
-
/**
|
|
30
|
+
/** Anything else before the label (an `Avatar`, a connector logo). Must not be interactive. */
|
|
31
|
+
leading?: ReactNode;
|
|
32
|
+
/** Phosphor icon component (`GitBranchIcon`, not `<GitBranchIcon />`), before the label (after `leading`). */
|
|
31
33
|
icon?: PhosphorIcon;
|
|
32
34
|
/** Number after the label, as a count `Chip` (0 or less is hidden; above 99 shows "99+"). */
|
|
33
35
|
count?: number;
|
package/dist/navigation/Tabs.js
CHANGED
|
@@ -17,7 +17,7 @@ import { CaretDownIcon } from "@phosphor-icons/react";
|
|
|
17
17
|
* Switches between peer views of one place: Canvas / History / Settings of a pipeline, Overview /
|
|
18
18
|
* Logs of a run. A row (or a column) of labelled tabs marks the selected one and either renders
|
|
19
19
|
* the selected item's `panel` beside it or, when the items are links (`href` + a router `as`),
|
|
20
|
-
* navigates. Each tab can show an icon and a count `Chip`. `UNDERLINE` is the page-level mode (a
|
|
20
|
+
* navigates. Each tab can show a leading mark (a connector logo), an icon and a count `Chip`. `UNDERLINE` is the page-level mode (a
|
|
21
21
|
* hairline with a `text.primary` indicator under the selected tab); `PILL` is a quieter second level (the
|
|
22
22
|
* selected tab is a filled pill). Horizontal tabs that do not fit collapse into a "More" menu at
|
|
23
23
|
* the end of the row, so the row never wraps or scrolls. `inset` pads the row (or column) from its
|
|
@@ -37,7 +37,7 @@ import { CaretDownIcon } from "@phosphor-icons/react";
|
|
|
37
37
|
* SSR: every tab renders on the server (clipped while unmeasured); measurement and the
|
|
38
38
|
* `ResizeObserver` start in an effect. Nothing touches `window` or `document` at module scope.
|
|
39
39
|
*/
|
|
40
|
-
/** Mode (
|
|
40
|
+
/** Mode (AGENTS.md "Variant": a declared mode set, Tabs UNDERLINE / PILL; listed in scripts/lint-dls.ts MODE_SETS). */
|
|
41
41
|
var TabsVariant = /* @__PURE__ */ function(TabsVariant) {
|
|
42
42
|
/** Tabs on a hairline; the selected tab has a `text.primary` indicator on the edge facing the panel. The default. */
|
|
43
43
|
TabsVariant["UNDERLINE"] = "UNDERLINE";
|
|
@@ -97,30 +97,39 @@ var Tab = /*#__PURE__*/ styled("button")({
|
|
|
97
97
|
class: "gx-Tabs-Tab-t1ynoa32",
|
|
98
98
|
propsAsIs: false
|
|
99
99
|
});
|
|
100
|
+
/**
|
|
101
|
+
* A tab's `leading` node, in the icon's slot and gap: centered on the tab, kept at its own size
|
|
102
|
+
* (never stretched, squeezed or clipped), so only the label truncates.
|
|
103
|
+
*/
|
|
104
|
+
var LeadingSlot = /*#__PURE__*/ styled("span")({
|
|
105
|
+
name: "LeadingSlot",
|
|
106
|
+
class: "gx-Tabs-LeadingSlot-l1ecacuu",
|
|
107
|
+
propsAsIs: false
|
|
108
|
+
});
|
|
100
109
|
/** Controls after the tabs (or under the column). */
|
|
101
110
|
var Actions = /*#__PURE__*/ styled("div")({
|
|
102
111
|
name: "Actions",
|
|
103
|
-
class: "gx-Tabs-Actions-
|
|
112
|
+
class: "gx-Tabs-Actions-a1hrazk9",
|
|
104
113
|
propsAsIs: false
|
|
105
114
|
});
|
|
106
115
|
/** The selected panel tab's content. */
|
|
107
116
|
var Panel = /*#__PURE__*/ styled("div")({
|
|
108
117
|
name: "Panel",
|
|
109
|
-
class: "gx-Tabs-Panel-
|
|
118
|
+
class: "gx-Tabs-Panel-p1r67x9f",
|
|
110
119
|
propsAsIs: false
|
|
111
120
|
});
|
|
112
121
|
var TABS_ORIENTATION_TO_CSS_MAP = {
|
|
113
|
-
[Orientation.HORIZONTAL]: "gx-Tabs-Orientation_HORIZONTAL-
|
|
114
|
-
[Orientation.VERTICAL]: "gx-Tabs-Orientation_VERTICAL-
|
|
122
|
+
[Orientation.HORIZONTAL]: "gx-Tabs-Orientation_HORIZONTAL-o2dkvh9",
|
|
123
|
+
[Orientation.VERTICAL]: "gx-Tabs-Orientation_VERTICAL-os6iug3"
|
|
115
124
|
};
|
|
116
125
|
/** Horizontal `fillWidth`: the row spans its parent and every tab takes an equal share. */
|
|
117
|
-
var FILL_WIDTH_CSS = "gx-Tabs-FILL_WIDTH_CSS-
|
|
126
|
+
var FILL_WIDTH_CSS = "gx-Tabs-FILL_WIDTH_CSS-fvxftzj";
|
|
118
127
|
/** Vertical `fillWidth`: a column with no panel beside it spans its parent, so the hairline sits on the parent's edge. */
|
|
119
|
-
var VERTICAL_FILL_WIDTH_CSS = "gx-Tabs-VERTICAL_FILL_WIDTH_CSS-
|
|
128
|
+
var VERTICAL_FILL_WIDTH_CSS = "gx-Tabs-VERTICAL_FILL_WIDTH_CSS-vduyhd6";
|
|
120
129
|
/** The bar's `inset` is padding on the bar itself, so the `UNDERLINE` hairline (drawn on the bar's edge) spans it. */
|
|
121
130
|
var TABS_ORIENTATION_TO_BAR_CSS_MAP = {
|
|
122
|
-
[Orientation.HORIZONTAL]: "gx-Tabs-Orientation_HORIZONTAL-
|
|
123
|
-
[Orientation.VERTICAL]: "gx-Tabs-Orientation_VERTICAL-
|
|
131
|
+
[Orientation.HORIZONTAL]: "gx-Tabs-Orientation_HORIZONTAL-oux4b2d",
|
|
132
|
+
[Orientation.VERTICAL]: "gx-Tabs-Orientation_VERTICAL-o6lhzlg"
|
|
124
133
|
};
|
|
125
134
|
/**
|
|
126
135
|
* The hairline on the edge facing the panel (`UNDERLINE` only). A horizontal row draws it as an
|
|
@@ -131,52 +140,54 @@ var TABS_ORIENTATION_TO_BAR_CSS_MAP = {
|
|
|
131
140
|
*/
|
|
132
141
|
var TABS_VARIANT_TO_BAR_CSS_MAP = {
|
|
133
142
|
["UNDERLINE"]: {
|
|
134
|
-
[Orientation.HORIZONTAL]: "gx-Tabs-Orientation_HORIZONTAL-
|
|
135
|
-
[Orientation.VERTICAL]: "gx-Tabs-Orientation_VERTICAL-
|
|
143
|
+
[Orientation.HORIZONTAL]: "gx-Tabs-Orientation_HORIZONTAL-otj50wv",
|
|
144
|
+
[Orientation.VERTICAL]: "gx-Tabs-Orientation_VERTICAL-o1wa4rz3"
|
|
136
145
|
},
|
|
137
146
|
["PILL"]: {
|
|
138
|
-
[Orientation.HORIZONTAL]: "gx-Tabs-Orientation_HORIZONTAL-
|
|
139
|
-
[Orientation.VERTICAL]: "gx-Tabs-Orientation_VERTICAL-
|
|
147
|
+
[Orientation.HORIZONTAL]: "gx-Tabs-Orientation_HORIZONTAL-o19ax5w1",
|
|
148
|
+
[Orientation.VERTICAL]: "gx-Tabs-Orientation_VERTICAL-o6on29c"
|
|
140
149
|
}
|
|
141
150
|
};
|
|
142
151
|
var TABS_ORIENTATION_TO_LIST_CSS_MAP = {
|
|
143
|
-
[Orientation.HORIZONTAL]: "gx-Tabs-Orientation_HORIZONTAL-
|
|
144
|
-
[Orientation.VERTICAL]: "gx-Tabs-Orientation_VERTICAL-
|
|
152
|
+
[Orientation.HORIZONTAL]: "gx-Tabs-Orientation_HORIZONTAL-o1cleozi",
|
|
153
|
+
[Orientation.VERTICAL]: "gx-Tabs-Orientation_VERTICAL-ofzxznm"
|
|
145
154
|
};
|
|
146
155
|
/** While unmeasured (server, first paint, after items change): every tab renders, clipped. */
|
|
147
|
-
var MEASURING_CSS = "gx-Tabs-MEASURING_CSS-
|
|
156
|
+
var MEASURING_CSS = "gx-Tabs-MEASURING_CSS-m10e4gpz";
|
|
148
157
|
/** The overflow trigger copy that is only measured. */
|
|
149
|
-
var MEASURING_TRIGGER_CSS = "gx-Tabs-MEASURING_TRIGGER_CSS-
|
|
158
|
+
var MEASURING_TRIGGER_CSS = "gx-Tabs-MEASURING_TRIGGER_CSS-m1k4ei2n";
|
|
150
159
|
/**
|
|
151
160
|
* Height, padding and icon-label gap per rung (custom properties on `Bar`). `--gx-tabs-row-height`
|
|
152
161
|
* is the horizontal `UNDERLINE` row's minimum: the label centered with 8 / 12 / 12px above and
|
|
153
162
|
* below it, the 2px indicator drawn over the bottom of that space.
|
|
154
163
|
*/
|
|
155
164
|
var TABS_SIZE_TO_CSS_MAP = {
|
|
156
|
-
["SMALL"]: "gx-Tabs-SMALL-
|
|
157
|
-
["MEDIUM"]: "gx-Tabs-MEDIUM-
|
|
158
|
-
["LARGE"]: "gx-Tabs-LARGE-
|
|
165
|
+
["SMALL"]: "gx-Tabs-SMALL-s1fu2ke2",
|
|
166
|
+
["MEDIUM"]: "gx-Tabs-MEDIUM-m1q90ijz",
|
|
167
|
+
["LARGE"]: "gx-Tabs-LARGE-l1xzvabb"
|
|
159
168
|
};
|
|
160
169
|
/** Shape per mode (every tab and the overflow trigger). */
|
|
161
170
|
var TABS_VARIANT_TO_TAB_CSS_MAP = {
|
|
162
|
-
["UNDERLINE"]: "gx-Tabs-UNDERLINE-
|
|
163
|
-
["PILL"]: "gx-Tabs-PILL-
|
|
171
|
+
["UNDERLINE"]: "gx-Tabs-UNDERLINE-uxgth9d",
|
|
172
|
+
["PILL"]: "gx-Tabs-PILL-p15kodi3"
|
|
164
173
|
};
|
|
165
174
|
/** Hover and press on an enabled, unselected tab (and the overflow trigger). */
|
|
166
175
|
var TABS_VARIANT_TO_INTERACTIVE_CSS_MAP = {
|
|
167
|
-
["UNDERLINE"]: "gx-Tabs-UNDERLINE-
|
|
168
|
-
["PILL"]: "gx-Tabs-PILL-
|
|
176
|
+
["UNDERLINE"]: "gx-Tabs-UNDERLINE-uhu3rsh",
|
|
177
|
+
["PILL"]: "gx-Tabs-PILL-p1nmauec"
|
|
169
178
|
};
|
|
170
179
|
var TABS_VARIANT_TO_SELECTED_CSS_MAP = {
|
|
171
|
-
["UNDERLINE"]: "gx-Tabs-UNDERLINE-
|
|
172
|
-
["PILL"]: "gx-Tabs-PILL-
|
|
180
|
+
["UNDERLINE"]: "gx-Tabs-UNDERLINE-u14ug43i",
|
|
181
|
+
["PILL"]: "gx-Tabs-PILL-p1qvds3x"
|
|
173
182
|
};
|
|
174
183
|
/** The `UNDERLINE` indicator's edge: always the one facing the panel, over the bar hairline. */
|
|
175
184
|
var TABS_ORIENTATION_TO_INDICATOR_CSS_MAP = {
|
|
176
|
-
[Orientation.HORIZONTAL]: "gx-Tabs-Orientation_HORIZONTAL-
|
|
177
|
-
[Orientation.VERTICAL]: "gx-Tabs-Orientation_VERTICAL-
|
|
185
|
+
[Orientation.HORIZONTAL]: "gx-Tabs-Orientation_HORIZONTAL-oa8x8b6",
|
|
186
|
+
[Orientation.VERTICAL]: "gx-Tabs-Orientation_VERTICAL-o2u7szj"
|
|
178
187
|
};
|
|
179
|
-
var TAB_DISABLED_CSS = "gx-Tabs-TAB_DISABLED_CSS-
|
|
188
|
+
var TAB_DISABLED_CSS = "gx-Tabs-TAB_DISABLED_CSS-t15gyusk";
|
|
189
|
+
/** A disabled tab's `leading`: `color` dims an icon or text, not a logo's own fills, so it fades with the label. */
|
|
190
|
+
var LEADING_DISABLED_CSS = "gx-Tabs-LEADING_DISABLED_CSS-l1semd88";
|
|
180
191
|
/** Tab icon px per rung: one step below the rung's III-A.4 icon (Mitch, 2026-10-04). */
|
|
181
192
|
var TABS_SIZE_TO_ICON_PX_MAP = {
|
|
182
193
|
["SMALL"]: 12,
|
|
@@ -228,7 +239,11 @@ var OverflowTrigger = forwardRef(function OverflowTrigger({ size, variant, class
|
|
|
228
239
|
OverflowTrigger.displayName = "TabsOverflowTrigger";
|
|
229
240
|
/** The parts of `items` that change a tab's width, plus the rung and mode. */
|
|
230
241
|
function measurementSignature(items, size, variant) {
|
|
231
|
-
return `${size}\u0001${variant}\u0001${items.map((item) => `${item.id}\u0000${item.label}\u0000${item.count ?? ""}\u0000${item.icon === void 0 ? 0 : 1}`).join("")}`;
|
|
242
|
+
return `${size}\u0001${variant}\u0001${items.map((item) => `${item.id}\u0000${item.label}\u0000${item.count ?? ""}\u0000${item.icon === void 0 ? 0 : 1}\u0000${hasNode(item.leading) ? 1 : 0}`).join("")}`;
|
|
243
|
+
}
|
|
244
|
+
/** A slot holds something (not `undefined`, `null` or `false`). */
|
|
245
|
+
function hasNode(node) {
|
|
246
|
+
return node !== void 0 && node !== null && node !== false;
|
|
232
247
|
}
|
|
233
248
|
/** A CSS length in px, or 0. */
|
|
234
249
|
function pxOf(value) {
|
|
@@ -284,7 +299,7 @@ function TabsImpl(props, ref) {
|
|
|
284
299
|
const [measurement, setMeasurement] = useState(null);
|
|
285
300
|
const [available, setAvailable] = useState(null);
|
|
286
301
|
const isMeasuring = isOverflowMode && (measurement === null || measurement.signature !== signature);
|
|
287
|
-
const hasActions = actions
|
|
302
|
+
const hasActions = hasNode(actions);
|
|
288
303
|
/** The row's width for tabs and the trigger: the bar minus its `inset` padding, `actions` and its gap. */
|
|
289
304
|
const readAvailable = useCallback(() => {
|
|
290
305
|
const bar = barRef.current;
|
|
@@ -399,6 +414,10 @@ function TabsImpl(props, ref) {
|
|
|
399
414
|
const isSelected = index === selectedIndex;
|
|
400
415
|
const isItemDisabled = item.isDisabled === true;
|
|
401
416
|
const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
417
|
+
hasNode(item.leading) && /* @__PURE__ */ jsx(LeadingSlot, {
|
|
418
|
+
className: cx(isItemDisabled && LEADING_DISABLED_CSS),
|
|
419
|
+
children: item.leading
|
|
420
|
+
}),
|
|
402
421
|
item.icon !== void 0 && /* @__PURE__ */ jsx(Icon, {
|
|
403
422
|
component: item.icon,
|
|
404
423
|
size: TABS_SIZE_TO_ICON_PX_MAP[size],
|
|
@@ -519,6 +538,7 @@ function TabsImpl(props, ref) {
|
|
|
519
538
|
} };
|
|
520
539
|
return /* @__PURE__ */ jsx(MenuItem, {
|
|
521
540
|
label: item.label,
|
|
541
|
+
...hasNode(item.leading) ? { leading: item.leading } : {},
|
|
522
542
|
...item.icon === void 0 ? {} : { icon: item.icon },
|
|
523
543
|
...trailing === void 0 ? {} : { trailing },
|
|
524
544
|
isDisabled: item.isDisabled === true,
|