@glasshome/ui 1.40.0 → 1.42.0

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.
Files changed (105) hide show
  1. package/SPEC.md +25 -2
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +3 -3
  4. package/dist/lib/anchor-placement.d.ts +30 -0
  5. package/dist/lib/behavior/anchored.d.ts +12 -0
  6. package/dist/lib/behavior/collection.d.ts +24 -0
  7. package/dist/lib/behavior/controllable.d.ts +8 -0
  8. package/dist/lib/behavior/dismiss.d.ts +11 -0
  9. package/dist/lib/behavior/focus-scope.d.ts +18 -0
  10. package/dist/lib/behavior/hide-outside.d.ts +7 -0
  11. package/dist/lib/behavior/layer-stack.d.ts +33 -0
  12. package/dist/lib/behavior/modal-root.d.ts +66 -0
  13. package/dist/lib/behavior/polymorphic.d.ts +6 -0
  14. package/dist/lib/behavior/presence.d.ts +18 -0
  15. package/dist/lib/behavior/solid.d.ts +13 -0
  16. package/dist/lib/motion-classes.d.ts +5 -2
  17. package/dist/lib/overlay-classes.d.ts +4 -1
  18. package/dist/lib/page-cover.d.ts +8 -0
  19. package/dist/lib/shadow-layer.d.ts +8 -6
  20. package/dist/solid/alert-dialog.d.ts +13 -15
  21. package/dist/solid/bottom-sheet/bottom-sheet.d.ts +2 -6
  22. package/dist/solid/bottom-sheet/constants.d.ts +1 -1
  23. package/dist/solid/confirm-dialog.d.ts +22 -0
  24. package/dist/solid/dialog-parts.d.ts +78 -15
  25. package/dist/solid/dialog.d.ts +9 -15
  26. package/dist/solid/docked-panel.d.ts +1 -5
  27. package/dist/solid/icon-nodes.d.ts +13 -0
  28. package/dist/solid/index.d.ts +9 -5
  29. package/dist/solid/index.js +8211 -7974
  30. package/dist/solid/responsive-dialog.d.ts +5 -6
  31. package/dist/solid/sheet.d.ts +6 -13
  32. package/dist/solid/stale-veil.d.ts +7 -0
  33. package/dist/solid/tabs.d.ts +29 -8
  34. package/dist/solid/toggle-group.d.ts +30 -5
  35. package/dist/solid/tooltip.d.ts +71 -9
  36. package/dist/{utils-DXEj_oXa.js → utils-CxAii-e9.js} +606 -414
  37. package/package.json +4 -2
  38. package/src/index.ts +1 -0
  39. package/src/lib/anchor-placement.ts +68 -2
  40. package/src/lib/behavior/anchored.ts +88 -0
  41. package/src/lib/behavior/collection.ts +181 -0
  42. package/src/lib/behavior/controllable.ts +22 -0
  43. package/src/lib/behavior/dismiss.ts +145 -0
  44. package/src/lib/behavior/focus-scope.ts +202 -0
  45. package/src/lib/behavior/hide-outside.ts +85 -0
  46. package/src/lib/behavior/layer-stack.ts +125 -0
  47. package/src/lib/behavior/modal-root.tsx +446 -0
  48. package/src/lib/behavior/polymorphic.tsx +30 -0
  49. package/src/lib/behavior/presence.ts +89 -0
  50. package/src/lib/behavior/solid.ts +30 -0
  51. package/src/lib/clipboard.ts +3 -2
  52. package/src/lib/motion-classes.ts +27 -2
  53. package/src/lib/overlay-classes.ts +9 -4
  54. package/src/lib/page-cover.ts +47 -0
  55. package/src/lib/shadow-layer.ts +48 -66
  56. package/src/solid/alert-dialog.tsx +45 -81
  57. package/src/solid/alert.tsx +1 -1
  58. package/src/solid/area-picker.tsx +2 -1
  59. package/src/solid/badge.tsx +5 -5
  60. package/src/solid/bottom-sheet/bottom-sheet.tsx +72 -128
  61. package/src/solid/bottom-sheet/constants.ts +3 -1
  62. package/src/solid/bottom-sheet/drag-controller.ts +11 -0
  63. package/src/solid/breadcrumb.tsx +4 -4
  64. package/src/solid/button-group.tsx +4 -4
  65. package/src/solid/card.tsx +5 -4
  66. package/src/solid/confirm-dialog.tsx +62 -0
  67. package/src/solid/context-menu.tsx +12 -2
  68. package/src/solid/dialog-parts.tsx +181 -42
  69. package/src/solid/dialog.tsx +46 -74
  70. package/src/solid/dock-edit.tsx +5 -4
  71. package/src/solid/dock.tsx +3 -3
  72. package/src/solid/dropdown-menu.tsx +15 -7
  73. package/src/solid/entity-selector.tsx +2 -1
  74. package/src/solid/form.tsx +4 -3
  75. package/src/solid/hover-card.tsx +7 -2
  76. package/src/solid/icon-nodes.ts +71 -0
  77. package/src/solid/icon-picker.tsx +2 -1
  78. package/src/solid/icon.tsx +42 -39
  79. package/src/solid/image-picker.tsx +14 -13
  80. package/src/solid/index.ts +9 -2
  81. package/src/solid/input-group.tsx +5 -3
  82. package/src/solid/input-otp.tsx +2 -1
  83. package/src/solid/item.tsx +4 -4
  84. package/src/solid/logo.tsx +5 -4
  85. package/src/solid/picker-row.tsx +5 -4
  86. package/src/solid/picker-search.tsx +2 -1
  87. package/src/solid/popover.tsx +18 -10
  88. package/src/solid/responsive-dialog.tsx +17 -10
  89. package/src/solid/sheet.tsx +47 -79
  90. package/src/solid/spotlight.tsx +23 -11
  91. package/src/solid/stale-veil.tsx +20 -0
  92. package/src/solid/switch.tsx +8 -6
  93. package/src/solid/tabs.tsx +373 -53
  94. package/src/solid/toggle-group.tsx +305 -93
  95. package/src/solid/tooltip.tsx +285 -26
  96. package/src/styles/globals.css +6 -2
  97. package/src/styles/theme.css +10 -5
  98. package/dist/lib/when-animations-settle.d.ts +0 -4
  99. package/dist/solid/bottom-sheet/focus-trap.d.ts +0 -6
  100. package/dist/solid/bottom-sheet/scroll-lock.d.ts +0 -2
  101. package/dist/solid/bottom-sheet/sheet-motion.d.ts +0 -1
  102. package/src/lib/when-animations-settle.ts +0 -12
  103. package/src/solid/bottom-sheet/focus-trap.ts +0 -63
  104. package/src/solid/bottom-sheet/scroll-lock.ts +0 -66
  105. package/src/solid/bottom-sheet/sheet-motion.ts +0 -4
@@ -1,5 +1,22 @@
1
- import { Tabs as TabsPrimitive } from "@kobalte/core/tabs";
2
- import { type Component, type ComponentProps, onCleanup, onMount, splitProps } from "solid-js";
1
+ import {
2
+ type Accessor,
3
+ type Component,
4
+ type ComponentProps,
5
+ createContext,
6
+ createSignal,
7
+ createUniqueId,
8
+ onCleanup,
9
+ onMount,
10
+ Show,
11
+ splitProps,
12
+ useContext,
13
+ type ValidComponent,
14
+ } from "solid-js";
15
+ import { type Collection, createCollection } from "../lib/behavior/collection.js";
16
+ import { createControllableSignal } from "../lib/behavior/controllable.js";
17
+ import { CANDIDATES, focusWithoutTracking, hasFocus } from "../lib/behavior/focus-scope.js";
18
+ import { Polymorphic } from "../lib/behavior/polymorphic.js";
19
+ import { effect, merge } from "../lib/behavior/solid.js";
3
20
  import { TRACK_SURFACE } from "../lib/card-classes.js";
4
21
  import { PRESS_DIP, SETTLE_MOTION } from "../lib/motion-classes.js";
5
22
  import { SCROLL_TRACK_FADE, trackScroll } from "../lib/scroll-track.js";
@@ -13,94 +30,397 @@ import { SelectionHighlight, SelectionScope } from "./selection.js";
13
30
  * them. */
14
31
  type TabsLayout = "stack" | "split";
15
32
 
33
+ type Orientation = "horizontal" | "vertical";
34
+
16
35
  const TABS_LAYOUT: Record<TabsLayout, string> = {
17
36
  stack: "flex flex-col gap-2",
18
37
  split: "contents",
19
38
  };
20
39
 
21
- type TabsProps = ComponentProps<typeof TabsPrimitive> & { layout?: TabsLayout };
40
+ type TabsProps = Omit<ComponentProps<"div">, "onChange"> & {
41
+ as?: ValidComponent;
42
+ layout?: TabsLayout;
43
+ value?: string;
44
+ defaultValue?: string;
45
+ onChange?: (value: string) => void;
46
+ orientation?: Orientation;
47
+ activationMode?: "automatic" | "manual";
48
+ disabled?: boolean;
49
+ };
50
+
51
+ interface TabsContextValue {
52
+ value: Accessor<string | undefined>;
53
+ select: (value: string) => void;
54
+ orientation: Accessor<Orientation>;
55
+ disabled: Accessor<boolean>;
56
+ automatic: Accessor<boolean>;
57
+ collection: Collection;
58
+ setList: (el: HTMLElement | undefined) => void;
59
+ register: (part: "trigger" | "content", value: string, id: string | undefined) => () => void;
60
+ triggerId: (value: string) => string;
61
+ contentId: (value: string) => string;
62
+ }
63
+
64
+ const TabsContext = createContext<TabsContextValue | null>(null);
65
+
66
+ const useTabs = (): TabsContextValue => {
67
+ const ctx = useContext(TabsContext);
68
+ if (!ctx) throw new Error("Tabs parts render inside a Tabs");
69
+ return ctx;
70
+ };
71
+
72
+ const TAB = '[role="tab"][data-key]';
73
+
74
+ type Ids = Record<string, string | undefined>;
22
75
 
23
76
  const Tabs: Component<TabsProps> = (props) => {
24
- const [local, others] = splitProps(props, ["class", "layout"]);
77
+ const [local, others] = splitProps(props, [
78
+ "class",
79
+ "layout",
80
+ "value",
81
+ "defaultValue",
82
+ "onChange",
83
+ "orientation",
84
+ "activationMode",
85
+ "disabled",
86
+ "id",
87
+ "as",
88
+ ]);
89
+ const fallbackId = `tabs-${createUniqueId()}`;
90
+ const id = () => local.id ?? fallbackId;
91
+ const orientation = () => local.orientation ?? "horizontal";
92
+ const [value, setValue] = createControllableSignal<string | undefined>({
93
+ value: () => local.value,
94
+ defaultValue: () => local.defaultValue,
95
+ onChange: (next) => next !== undefined && local.onChange?.(next),
96
+ });
97
+ const [list, setList] = createSignal<HTMLElement>();
98
+ const [triggerIds, setTriggerIds] = createSignal<Ids>({});
99
+ const [contentIds, setContentIds] = createSignal<Ids>({});
100
+ const collection = createCollection({
101
+ root: list,
102
+ itemSelector: TAB,
103
+ orientation,
104
+ focus: "roving",
105
+ loop: () => true,
106
+ dir: () => (list()?.closest("[dir]")?.getAttribute("dir") === "rtl" ? "rtl" : "ltr"),
107
+ preferred: () => {
108
+ const current = value();
109
+ return current === undefined ? [] : [current];
110
+ },
111
+ });
112
+
113
+ const select = (next: string) => {
114
+ if (next === value()) local.onChange?.(next);
115
+ else setValue(next);
116
+ };
117
+
118
+ effect(
119
+ () => [list(), value(), triggerIds()] as const,
120
+ ([el, current]) => {
121
+ if (!el) return;
122
+ const tabs = [...el.querySelectorAll<HTMLElement>(TAB)];
123
+ if (tabs.some((tab) => tab.dataset.key === current)) return;
124
+ const first = tabs.find((tab) => !tab.hasAttribute("data-disabled")) ?? tabs[0];
125
+ if (first?.dataset.key !== undefined) setValue(first.dataset.key);
126
+ },
127
+ );
128
+
129
+ const register: TabsContextValue["register"] = (part, key, custom) => {
130
+ const set = part === "trigger" ? setTriggerIds : setContentIds;
131
+ set((ids) => ({ ...ids, [key]: custom }));
132
+ return () =>
133
+ set((ids) => {
134
+ const { [key]: _gone, ...kept } = ids;
135
+ return kept;
136
+ });
137
+ };
138
+
139
+ const context: TabsContextValue = {
140
+ value,
141
+ select,
142
+ orientation,
143
+ disabled: () => local.disabled ?? false,
144
+ automatic: () => (local.activationMode ?? "automatic") === "automatic",
145
+ collection,
146
+ setList,
147
+ register,
148
+ triggerId: (key) => triggerIds()[key] ?? `${id()}-trigger-${key}`,
149
+ contentId: (key) => contentIds()[key] ?? `${id()}-content-${key}`,
150
+ };
151
+
25
152
  return (
26
- <TabsPrimitive
27
- data-slot="tabs"
28
- data-layout={local.layout ?? "stack"}
29
- class={cn(TABS_LAYOUT[local.layout ?? "stack"], local.class)}
30
- {...others}
31
- />
153
+ <TabsContext.Provider value={context}>
154
+ <Polymorphic
155
+ {...merge({ "data-slot": "tabs" }, others, {
156
+ as: local.as,
157
+ defaultAs: "div" as ValidComponent,
158
+ get id() {
159
+ return id();
160
+ },
161
+ get "data-orientation"() {
162
+ return orientation();
163
+ },
164
+ get "data-layout"() {
165
+ return local.layout ?? "stack";
166
+ },
167
+ get class() {
168
+ return cn(TABS_LAYOUT[local.layout ?? "stack"], local.class);
169
+ },
170
+ })}
171
+ />
172
+ </TabsContext.Provider>
32
173
  );
33
174
  };
34
175
 
35
- const TabsList: Component<ComponentProps<typeof TabsPrimitive.List>> = (props) => {
36
- const [local, others] = splitProps(props, ["class", "children"]);
37
- let listRef: HTMLDivElement | undefined;
176
+ type TabsListProps = ComponentProps<"div"> & { as?: ValidComponent };
177
+
178
+ const TabsList: Component<TabsListProps> = (props) => {
179
+ const ctx = useTabs();
180
+ const [local, others] = splitProps(props, ["class", "children", "ref", "as"]);
181
+ const [el, setEl] = createSignal<HTMLElement>();
38
182
  onMount(() => {
39
- if (listRef) onCleanup(trackScroll(listRef, "[data-selected]", "data-selected"));
183
+ const listEl = el();
184
+ if (listEl) onCleanup(trackScroll(listEl, "[data-selected]", "data-selected"));
185
+ });
186
+ onCleanup(() => ctx.setList(undefined));
187
+
188
+ effect(el, (node) => {
189
+ if (!node) return;
190
+ const keydown = (event: KeyboardEvent) => {
191
+ const before = ctx.collection.highlighted();
192
+ ctx.collection.onKeyDown(event);
193
+ const after = ctx.collection.highlighted();
194
+ if (after !== undefined && after !== before && ctx.automatic()) ctx.select(after);
195
+ };
196
+ node.addEventListener("keydown", keydown);
197
+ return () => node.removeEventListener("keydown", keydown);
40
198
  });
199
+
41
200
  return (
42
- <TabsPrimitive.List
43
- ref={listRef}
44
- data-slot="tabs-list"
45
- class={cn(
46
- `scrollbar-hide inline-flex h-9 w-full items-center overflow-x-auto rounded-lg has-[[data-slot=tabs-trigger-icon]]:h-auto ${TRACK_SURFACE} ${SCROLL_TRACK_FADE} text-muted-foreground p-1`,
47
- local.class,
48
- )}
49
- {...others}
201
+ <Polymorphic
202
+ {...merge({ "data-slot": "tabs-list" }, others, {
203
+ as: local.as,
204
+ defaultAs: "div" as ValidComponent,
205
+ ref: (node: HTMLElement) => {
206
+ setEl(node);
207
+ ctx.setList(node);
208
+ if (typeof local.ref === "function") local.ref(node as HTMLDivElement);
209
+ },
210
+ role: "tablist",
211
+ get "aria-orientation"() {
212
+ return ctx.orientation();
213
+ },
214
+ get "data-orientation"() {
215
+ return ctx.orientation();
216
+ },
217
+ get class() {
218
+ return cn(
219
+ `scrollbar-hide inline-flex h-9 w-full items-center overflow-x-auto rounded-lg has-[[data-slot=tabs-trigger-icon]]:h-auto ${TRACK_SURFACE} ${SCROLL_TRACK_FADE} text-muted-foreground p-1`,
220
+ local.class,
221
+ );
222
+ },
223
+ })}
50
224
  >
51
225
  {/* w-max so triggers keep their natural width and the track scrolls;
52
226
  w-full alone squeezed them past the rounded edge, unreachable. */}
53
227
  <SelectionScope marker="selected" class="flex h-full w-max min-w-full items-center gap-1">
54
228
  {local.children}
55
229
  </SelectionScope>
56
- </TabsPrimitive.List>
230
+ </Polymorphic>
57
231
  );
58
232
  };
59
233
 
60
- /** `icon` stacks a glyph over the word, so a tab row reads apart from the toggle groups under it. */
61
- const TabsTrigger: Component<ComponentProps<typeof TabsPrimitive.Trigger> & { icon?: string }> = (
62
- props,
63
- ) => {
64
- const [local, others] = splitProps(props, ["class", "icon", "children"]);
234
+ type TabsTriggerProps = ComponentProps<"button"> & {
235
+ as?: ValidComponent;
236
+ value: string;
237
+ disabled?: boolean;
238
+ icon?: string;
239
+ inline?: boolean;
240
+ };
241
+
242
+ /** `icon` stacks a glyph over the word, so a tab row reads apart from the toggle groups under it.
243
+ * `inline` sets the glyph beside the word instead, for a row that stands alone. */
244
+ const TabsTrigger: Component<TabsTriggerProps> = (props) => {
245
+ const ctx = useTabs();
246
+ const [local, others] = splitProps(props, [
247
+ "class",
248
+ "icon",
249
+ "inline",
250
+ "children",
251
+ "value",
252
+ "disabled",
253
+ "id",
254
+ "ref",
255
+ "as",
256
+ ]);
257
+ const [el, setEl] = createSignal<HTMLElement>();
258
+ const disabled = () => local.disabled || ctx.disabled();
259
+ effect(disabled, () => ctx.collection.refresh());
260
+ onCleanup(() => ctx.collection.refresh());
261
+ const selected = () => ctx.value() === local.value;
262
+
263
+ effect(
264
+ () => [local.value, local.id] as const,
265
+ ([key, custom]) => ctx.register("trigger", key, custom),
266
+ );
267
+
268
+ effect(el, (node) => {
269
+ if (!node) return;
270
+ let mousePressed = false;
271
+ const choose = () => {
272
+ if (disabled()) return;
273
+ ctx.select(local.value);
274
+ ctx.collection.highlight(local.value, "pointer");
275
+ };
276
+ // A mouse selects on press, so focus lands on a tab already selected and is announced so.
277
+ const pointerdown = (event: PointerEvent) => {
278
+ mousePressed = event.pointerType === "mouse" && event.button === 0;
279
+ if (mousePressed) choose();
280
+ };
281
+ const click = (event: MouseEvent) => {
282
+ // WebKit leaves a clicked button unfocused.
283
+ if (!disabled() && !hasFocus(node)) focusWithoutTracking(node);
284
+ if (event.detail === 0 || !mousePressed) choose();
285
+ mousePressed = false;
286
+ };
287
+ const focus = () => ctx.collection.highlight(local.value, "pointer");
288
+ node.addEventListener("pointerdown", pointerdown);
289
+ node.addEventListener("click", click);
290
+ node.addEventListener("focus", focus);
291
+ return () => {
292
+ node.removeEventListener("pointerdown", pointerdown);
293
+ node.removeEventListener("click", click);
294
+ node.removeEventListener("focus", focus);
295
+ };
296
+ });
297
+
65
298
  return (
66
- <TabsPrimitive.Trigger
67
- data-slot="tabs-trigger"
68
- class={cn(
69
- SEGMENT_ITEM,
70
- PRESS_DIP,
71
- "not-data-[selected]:hover:text-foreground relative isolate data-[selected]:text-(--material-accent)",
72
- local.icon && "h-auto flex-1 flex-col gap-1 py-2 text-xs",
73
- local.class,
74
- )}
75
- {...others}
299
+ <Polymorphic
300
+ {...merge({ "data-slot": "tabs-trigger" }, others, {
301
+ as: local.as,
302
+ defaultAs: "button" as ValidComponent,
303
+ ref: (node: HTMLElement) => {
304
+ setEl(node);
305
+ if (typeof local.ref === "function") local.ref(node as HTMLButtonElement);
306
+ },
307
+ get id() {
308
+ return ctx.triggerId(local.value);
309
+ },
310
+ role: "tab",
311
+ get tabIndex() {
312
+ return disabled() ? undefined : ctx.collection.tabIndex(local.value);
313
+ },
314
+ get disabled() {
315
+ return disabled();
316
+ },
317
+ get "aria-selected"() {
318
+ return selected();
319
+ },
320
+ get "aria-disabled"() {
321
+ return disabled() || undefined;
322
+ },
323
+ get "aria-controls"() {
324
+ return selected() ? ctx.contentId(local.value) : undefined;
325
+ },
326
+ get "data-key"() {
327
+ return local.value;
328
+ },
329
+ get "data-orientation"() {
330
+ return ctx.orientation();
331
+ },
332
+ get "data-selected"() {
333
+ return selected() ? "" : undefined;
334
+ },
335
+ get "data-highlighted"() {
336
+ return ctx.collection.highlighted() === local.value ? "" : undefined;
337
+ },
338
+ get "data-disabled"() {
339
+ return disabled() ? "" : undefined;
340
+ },
341
+ get class() {
342
+ return cn(
343
+ SEGMENT_ITEM,
344
+ PRESS_DIP,
345
+ "not-data-[selected]:hover:text-foreground relative isolate data-[selected]:text-(--material-accent)",
346
+ local.icon && !local.inline && "h-auto flex-1 flex-col gap-1 py-2 text-xs",
347
+ local.class,
348
+ );
349
+ },
350
+ })}
76
351
  >
77
352
  <SelectionHighlight />
78
353
  {local.icon && (
79
354
  <Icon
80
- data-slot="tabs-trigger-icon"
355
+ data-slot={local.inline ? "tabs-trigger-inline-icon" : "tabs-trigger-icon"}
81
356
  icon={local.icon}
82
- width={18}
83
- height={18}
357
+ width={local.inline ? 16 : 18}
358
+ height={local.inline ? 16 : 18}
84
359
  aria-hidden="true"
85
360
  />
86
361
  )}
87
362
  {local.children}
88
- </TabsPrimitive.Trigger>
363
+ </Polymorphic>
89
364
  );
90
365
  };
91
366
 
92
- const TabsContent: Component<ComponentProps<typeof TabsPrimitive.Content>> = (props) => {
93
- const [local, others] = splitProps(props, ["class"]);
367
+ type TabsContentProps = ComponentProps<"div"> & {
368
+ as?: ValidComponent;
369
+ value: string;
370
+ forceMount?: boolean;
371
+ };
372
+
373
+ const TabsContent: Component<TabsContentProps> = (props) => {
374
+ const ctx = useTabs();
375
+ const [local, others] = splitProps(props, ["class", "value", "forceMount", "id", "ref", "as"]);
376
+ const [el, setEl] = createSignal<HTMLElement>();
377
+ const [holdsTabStop, setHoldsTabStop] = createSignal(false);
378
+ const selected = () => ctx.value() === local.value;
379
+
380
+ effect(
381
+ () => [local.value, local.id] as const,
382
+ ([key, custom]) => ctx.register("content", key, custom),
383
+ );
384
+ effect(el, (node) => {
385
+ if (node) setHoldsTabStop(node.querySelector(CANDIDATES) !== null);
386
+ });
387
+
94
388
  return (
95
- <TabsPrimitive.Content
96
- data-slot="tabs-content"
97
- class={cn(
98
- SETTLE_MOTION,
99
- "focus-visible:border-ring focus-visible:ring-ring/50 outline-none focus-visible:ring-[3px]",
100
- local.class,
101
- )}
102
- {...others}
103
- />
389
+ <Show when={local.forceMount || selected()}>
390
+ <Polymorphic
391
+ {...merge({ "data-slot": "tabs-content" }, others, {
392
+ as: local.as,
393
+ defaultAs: "div" as ValidComponent,
394
+ ref: (node: HTMLElement) => {
395
+ setEl(node);
396
+ if (typeof local.ref === "function") local.ref(node as HTMLDivElement);
397
+ },
398
+ get id() {
399
+ return ctx.contentId(local.value);
400
+ },
401
+ role: "tabpanel",
402
+ get tabIndex() {
403
+ return holdsTabStop() ? undefined : 0;
404
+ },
405
+ get "aria-labelledby"() {
406
+ return ctx.triggerId(local.value);
407
+ },
408
+ get "data-orientation"() {
409
+ return ctx.orientation();
410
+ },
411
+ get "data-selected"() {
412
+ return selected() ? "" : undefined;
413
+ },
414
+ get class() {
415
+ return cn(
416
+ SETTLE_MOTION,
417
+ "focus-visible:border-ring focus-visible:ring-ring/50 outline-none focus-visible:ring-[3px]",
418
+ local.class,
419
+ );
420
+ },
421
+ })}
422
+ />
423
+ </Show>
104
424
  );
105
425
  };
106
426