@galaxy-io/dls 2.10.0 → 2.10.1

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.
@@ -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 (Constitution V-A local mode set: Tabs UNDERLINE / PILL; declared in scripts/lint-dls.ts MODE_SETS). */
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
- /** Phosphor icon component (`GitBranchIcon`, not `<GitBranchIcon />`), before the label. */
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;
@@ -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 (Constitution V-A local mode set: Tabs UNDERLINE / PILL; declared in scripts/lint-dls.ts MODE_SETS). */
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-a1ecacuu",
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-p1hrazk9",
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-o1r67x9f",
114
- [Orientation.VERTICAL]: "gx-Tabs-Orientation_VERTICAL-o2dkvh9"
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-fs6iug3";
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-vvxftzj";
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-oduyhd6",
123
- [Orientation.VERTICAL]: "gx-Tabs-Orientation_VERTICAL-oux4b2d"
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-o6lhzlg",
135
- [Orientation.VERTICAL]: "gx-Tabs-Orientation_VERTICAL-otj50wv"
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-o1wa4rz3",
139
- [Orientation.VERTICAL]: "gx-Tabs-Orientation_VERTICAL-o19ax5w1"
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-o6on29c",
144
- [Orientation.VERTICAL]: "gx-Tabs-Orientation_VERTICAL-o1cleozi"
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-mfzxznm";
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-m10e4gpz";
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-s1k4ei2n",
157
- ["MEDIUM"]: "gx-Tabs-MEDIUM-m1fu2ke2",
158
- ["LARGE"]: "gx-Tabs-LARGE-l1q90ijz"
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-u1xzvabb",
163
- ["PILL"]: "gx-Tabs-PILL-pxgth9d"
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-u15kodi3",
168
- ["PILL"]: "gx-Tabs-PILL-phu3rsh"
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-u1nmauec",
172
- ["PILL"]: "gx-Tabs-PILL-p14ug43i"
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-o1qvds3x",
177
- [Orientation.VERTICAL]: "gx-Tabs-Orientation_VERTICAL-oa8x8b6"
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-t2u7szj";
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 !== void 0 && actions !== null && actions !== false;
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,