+ {hasMultipleTabs &&
+ tabs.map((tab) => {
+ const isActive = tab.id === activeTabId;
+ const nameForWidth = isActive ? activeTab.filename : tab.filename;
+ const labelWidthCh = Math.min(
+ 24,
+ Math.max(10, nameForWidth.length + 3),
+ );
+ const labelWidthStyle = {
+ width: `${labelWidthCh}ch`,
+ minWidth: `${labelWidthCh}ch`,
+ } as const;
+
+ return (
+
+ {isActive ? (
+
+ updateActiveTabFilename(event.target.value)
+ }
+ onClick={(event) => event.stopPropagation()}
+ className="placeholder:text-primary-foreground/70 min-w-0 bg-transparent px-3 py-0 text-sm font-medium leading-none outline-none focus-visible:ring-0"
+ style={labelWidthStyle}
+ placeholder="file.ts"
+ aria-label="Filename"
+ />
+ ) : (
+
+ )}
+
+
+
+ );
+ })}
+
+
+