svelte-comp 1.3.5 → 1.3.6
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/LICENSE.md +21 -21
- package/README.md +101 -101
- package/dist/App.svelte +1046 -1046
- package/dist/Container.svelte +59 -59
- package/dist/app.css +234 -234
- package/dist/app.d.ts +10 -10
- package/dist/lib/Accordion.svelte +155 -155
- package/dist/lib/Badge.svelte +44 -44
- package/dist/lib/Button.svelte +185 -185
- package/dist/lib/Calendar.svelte +384 -384
- package/dist/lib/Card.svelte +103 -103
- package/dist/lib/Carousel.svelte +293 -293
- package/dist/lib/CheckBox.svelte +210 -210
- package/dist/lib/CodeView.svelte +308 -308
- package/dist/lib/ColorPicker.svelte +159 -159
- package/dist/lib/ContextMenu.svelte +328 -328
- package/dist/lib/DatePicker.svelte +246 -246
- package/dist/lib/Dialog.svelte +233 -233
- package/dist/lib/Field.svelte +299 -299
- package/dist/lib/FilePicker.svelte +295 -295
- package/dist/lib/Form.svelte +438 -438
- package/dist/lib/Hamburger.svelte +217 -217
- package/dist/lib/InstallPWA.svelte +94 -94
- package/dist/lib/Menu.svelte +623 -623
- package/dist/lib/NoticeBase.svelte +140 -140
- package/dist/lib/PaginatedCard.svelte +73 -73
- package/dist/lib/Pagination.svelte +119 -119
- package/dist/lib/PrimaryColorSelect.svelte +111 -111
- package/dist/lib/ProgressBar.svelte +141 -141
- package/dist/lib/ProgressCircle.svelte +190 -190
- package/dist/lib/Radio.svelte +189 -189
- package/dist/lib/SearchInput.svelte +104 -104
- package/dist/lib/Select.svelte +524 -524
- package/dist/lib/Slider.svelte +253 -253
- package/dist/lib/Splitter.svelte +159 -159
- package/dist/lib/Switch.svelte +168 -168
- package/dist/lib/Table.svelte +299 -299
- package/dist/lib/Tabs.svelte +213 -213
- package/dist/lib/ThemeToggle.svelte +128 -128
- package/dist/lib/TimePicker.svelte +312 -312
- package/dist/lib/TimePickerNew.svelte +634 -634
- package/dist/lib/Toast.svelte +123 -123
- package/dist/lib/Tooltip.svelte +110 -110
- package/dist/lib/Topbar.svelte +112 -112
- package/dist/styles.css +234 -234
- package/package.json +52 -52
package/dist/lib/Tabs.svelte
CHANGED
|
@@ -1,213 +1,213 @@
|
|
|
1
|
-
<!-- src/lib/Tabs.svelte -->
|
|
2
|
-
<script lang="ts">
|
|
3
|
-
/**
|
|
4
|
-
* @component Tabs
|
|
5
|
-
* @description A tab navigation component for switching between sections of content.
|
|
6
|
-
*
|
|
7
|
-
* @prop tabs {TabItem[]} - Array of tab items with `id` and `label`
|
|
8
|
-
* @default []
|
|
9
|
-
*
|
|
10
|
-
* @prop activeTab {string} - The currently active tab id
|
|
11
|
-
* @default ""
|
|
12
|
-
*
|
|
13
|
-
* @prop sz {SizeKey} - Size preset for tabs and content
|
|
14
|
-
* @options xs|sm|md|lg|xl
|
|
15
|
-
* @default md
|
|
16
|
-
*
|
|
17
|
-
* @prop variant {TabsVariant} - Visual style of the tabs
|
|
18
|
-
* @options default|pills|underline
|
|
19
|
-
* @default default
|
|
20
|
-
*
|
|
21
|
-
* @prop fitted {boolean} - Stretches tabs to fill available width
|
|
22
|
-
* @default false
|
|
23
|
-
*
|
|
24
|
-
* @prop onChange {(tabId: string) => void} - Callback when the active tab changes
|
|
25
|
-
*
|
|
26
|
-
* @prop class {string} - Custom class for the container
|
|
27
|
-
* @default ""
|
|
28
|
-
*
|
|
29
|
-
* @prop children {Snippet} - Content panel rendered below the tabs
|
|
30
|
-
*
|
|
31
|
-
* @note Supports multiple visual styles (`default`, `pills`, `underline`).
|
|
32
|
-
* @note Fully accessible with keyboard navigation (Arrow keys, Home, End, Enter).
|
|
33
|
-
* @note Automatically adapts to container width.
|
|
34
|
-
* @note The panel content (`children`) scales visually with the selected tab size.
|
|
35
|
-
*/
|
|
36
|
-
import type { Snippet } from "svelte";
|
|
37
|
-
import type { SizeKey, TabsVariant, TabItem } from "./types";
|
|
38
|
-
import { TEXT } from "./types";
|
|
39
|
-
import { cx } from "../utils";
|
|
40
|
-
|
|
41
|
-
type Props = {
|
|
42
|
-
tabs?: TabItem[];
|
|
43
|
-
activeTab?: string;
|
|
44
|
-
sz?: SizeKey;
|
|
45
|
-
variant?: TabsVariant;
|
|
46
|
-
fitted?: boolean;
|
|
47
|
-
onChange?: (tabId: string) => void;
|
|
48
|
-
class?: string;
|
|
49
|
-
children?: Snippet;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
let {
|
|
53
|
-
tabs = [],
|
|
54
|
-
activeTab = "",
|
|
55
|
-
sz = "md",
|
|
56
|
-
variant = "default",
|
|
57
|
-
fitted = false,
|
|
58
|
-
onChange,
|
|
59
|
-
class: externalClass = "",
|
|
60
|
-
children,
|
|
61
|
-
...rest
|
|
62
|
-
}: Props = $props();
|
|
63
|
-
|
|
64
|
-
$effect(() => {
|
|
65
|
-
if (!activeTab && tabs.length) activeTab = tabs[0].id;
|
|
66
|
-
if (activeTab && !tabs.find((t) => t.id === activeTab) && tabs.length) {
|
|
67
|
-
activeTab = tabs[0].id;
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
function focusActiveButton() {
|
|
72
|
-
if (!activeTab) return;
|
|
73
|
-
const btn = document.getElementById(
|
|
74
|
-
`tab-${activeTab}`
|
|
75
|
-
) as HTMLButtonElement | null;
|
|
76
|
-
btn?.focus();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function handleTabClick(tab: TabItem) {
|
|
80
|
-
if (tab.disabled) return;
|
|
81
|
-
activeTab = tab.id;
|
|
82
|
-
onChange?.(tab.id);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function handleKeyDown(e: KeyboardEvent) {
|
|
86
|
-
const enabled = tabs.filter((t) => !t.disabled);
|
|
87
|
-
if (!enabled.length) return;
|
|
88
|
-
|
|
89
|
-
const idx = Math.max(
|
|
90
|
-
0,
|
|
91
|
-
enabled.findIndex((t) => t.id === activeTab)
|
|
92
|
-
);
|
|
93
|
-
let next: number;
|
|
94
|
-
|
|
95
|
-
if (e.key === "ArrowRight") next = (idx + 1) % enabled.length;
|
|
96
|
-
else if (e.key === "ArrowLeft")
|
|
97
|
-
next = (idx - 1 + enabled.length) % enabled.length;
|
|
98
|
-
else if (e.key === "Home") next = 0;
|
|
99
|
-
else if (e.key === "End") next = enabled.length - 1;
|
|
100
|
-
else return;
|
|
101
|
-
|
|
102
|
-
e.preventDefault();
|
|
103
|
-
const nextId = enabled[next].id;
|
|
104
|
-
activeTab = nextId;
|
|
105
|
-
onChange?.(nextId);
|
|
106
|
-
queueMicrotask(focusActiveButton);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const sizes: Record<SizeKey, string> = {
|
|
110
|
-
xs: "px-2 py-1",
|
|
111
|
-
sm: "px-3 py-1.5",
|
|
112
|
-
md: "px-4 py-2",
|
|
113
|
-
lg: "px-5 py-2.5",
|
|
114
|
-
xl: "px-6 py-3",
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
const base =
|
|
118
|
-
"inline-flex items-center justify-center font-medium transition-colors duration-[var(--transition-fast)] focus-visible:ring-inset focus-visible:ring-2 focus-visible:ring-[var(--border-color-focus)] focus-visible:ring-offset-0 focus:outline-none disabled:opacity-[var(--opacity-disabled)] disabled:cursor-not-allowed [@media(pointer:coarse)]:min-h-11";
|
|
119
|
-
|
|
120
|
-
const variants = $derived({
|
|
121
|
-
default: {
|
|
122
|
-
base: "border-b-2 border-transparent text-[var(--color-text-default)]",
|
|
123
|
-
active:
|
|
124
|
-
"bg-[var(--color-bg-secondary)] !text-[var(--color-text-default)] border-[var(--border-color-strong)]",
|
|
125
|
-
hover:
|
|
126
|
-
"hover:text-[var(--color-text-default)] hover:bg-[var(--color-bg-muted)]",
|
|
127
|
-
},
|
|
128
|
-
underline: {
|
|
129
|
-
base: "border-b-2 border-transparent text-[var(--color-text-default)]",
|
|
130
|
-
active:
|
|
131
|
-
"border-[var(--border-color-focus)] !text-[var(--color-text-default)]",
|
|
132
|
-
hover:
|
|
133
|
-
"hover:text-[var(--color-text-default)] hover:border-[var(--border-color-strong)]",
|
|
134
|
-
},
|
|
135
|
-
pills: {
|
|
136
|
-
base: "text-[var(--color-text-default)] border border-transparent font-medium",
|
|
137
|
-
active:
|
|
138
|
-
"bg-[var(--color-bg-primary)] text-[var(--color-text-default)] border-[var(--color-bg-primary)] font-[var(--font-weight-semibold)]",
|
|
139
|
-
hover:
|
|
140
|
-
"hover:bg-[var(--color-bg-secondary)] hover:text-[var(--color-text-default)]",
|
|
141
|
-
},
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
const rootClass = $derived(
|
|
145
|
-
cx("w-full self-stretch flex flex-col", TEXT[sz], externalClass)
|
|
146
|
-
);
|
|
147
|
-
|
|
148
|
-
const tablistClass = $derived(
|
|
149
|
-
cx(
|
|
150
|
-
"flex w-full flex-nowrap overflow-x-auto whitespace-nowrap relative z-10 bg-[var(--color-bg-surface)]",
|
|
151
|
-
TEXT[sz],
|
|
152
|
-
variant === "pills" && "gap-1",
|
|
153
|
-
variant === "underline" && "gap-6",
|
|
154
|
-
fitted ? "justify-between" : "justify-start"
|
|
155
|
-
)
|
|
156
|
-
);
|
|
157
|
-
</script>
|
|
158
|
-
|
|
159
|
-
<div class={rootClass} {...rest}>
|
|
160
|
-
<div
|
|
161
|
-
role="tablist"
|
|
162
|
-
tabindex="0"
|
|
163
|
-
aria-orientation="horizontal"
|
|
164
|
-
class={tablistClass}
|
|
165
|
-
onkeydown={handleKeyDown}
|
|
166
|
-
onfocus={focusActiveButton}
|
|
167
|
-
>
|
|
168
|
-
{#each tabs as tab (tab.id)}
|
|
169
|
-
<button
|
|
170
|
-
id={`tab-${tab.id}`}
|
|
171
|
-
type="button"
|
|
172
|
-
role="tab"
|
|
173
|
-
aria-selected={tab.id === activeTab ? "true" : "false"}
|
|
174
|
-
aria-controls={`panel-${tab.id}`}
|
|
175
|
-
aria-disabled={tab.disabled ? "true" : "false"}
|
|
176
|
-
tabindex={tab.id === activeTab ? 0 : -1}
|
|
177
|
-
disabled={tab.disabled}
|
|
178
|
-
class={cx(
|
|
179
|
-
"relative z-20",
|
|
180
|
-
base,
|
|
181
|
-
sizes[sz],
|
|
182
|
-
TEXT[sz],
|
|
183
|
-
fitted ? "basis-0 grow flex-1 min-w-0 text-center" : "shrink-0",
|
|
184
|
-
variants[variant]?.base,
|
|
185
|
-
tab.id === activeTab
|
|
186
|
-
? variants[variant]?.active
|
|
187
|
-
: !tab.disabled
|
|
188
|
-
? variants[variant]?.hover
|
|
189
|
-
: ""
|
|
190
|
-
)}
|
|
191
|
-
onclick={() => handleTabClick(tab)}
|
|
192
|
-
onkeydown={(e) => {
|
|
193
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
194
|
-
e.preventDefault();
|
|
195
|
-
handleTabClick(tab);
|
|
196
|
-
}
|
|
197
|
-
}}
|
|
198
|
-
>
|
|
199
|
-
<span>{tab.label}</span>
|
|
200
|
-
</button>
|
|
201
|
-
{/each}
|
|
202
|
-
</div>
|
|
203
|
-
|
|
204
|
-
<div
|
|
205
|
-
id={`panel-${activeTab}`}
|
|
206
|
-
role="tabpanel"
|
|
207
|
-
tabindex="-1"
|
|
208
|
-
aria-labelledby={`tab-${activeTab}`}
|
|
209
|
-
class="w-full min-w-0 relative z-0 border-t border-[var(--border-color-default)] bg-[var(--color-bg-surface)] p-[var(--spacing-md)] rounded-b-[var(--radius-sm)] shadow-[0_1px_2px_0_var(--shadow-color)]"
|
|
210
|
-
>
|
|
211
|
-
{@render children?.()}
|
|
212
|
-
</div>
|
|
213
|
-
</div>
|
|
1
|
+
<!-- src/lib/Tabs.svelte -->
|
|
2
|
+
<script lang="ts">
|
|
3
|
+
/**
|
|
4
|
+
* @component Tabs
|
|
5
|
+
* @description A tab navigation component for switching between sections of content.
|
|
6
|
+
*
|
|
7
|
+
* @prop tabs {TabItem[]} - Array of tab items with `id` and `label`
|
|
8
|
+
* @default []
|
|
9
|
+
*
|
|
10
|
+
* @prop activeTab {string} - The currently active tab id
|
|
11
|
+
* @default ""
|
|
12
|
+
*
|
|
13
|
+
* @prop sz {SizeKey} - Size preset for tabs and content
|
|
14
|
+
* @options xs|sm|md|lg|xl
|
|
15
|
+
* @default md
|
|
16
|
+
*
|
|
17
|
+
* @prop variant {TabsVariant} - Visual style of the tabs
|
|
18
|
+
* @options default|pills|underline
|
|
19
|
+
* @default default
|
|
20
|
+
*
|
|
21
|
+
* @prop fitted {boolean} - Stretches tabs to fill available width
|
|
22
|
+
* @default false
|
|
23
|
+
*
|
|
24
|
+
* @prop onChange {(tabId: string) => void} - Callback when the active tab changes
|
|
25
|
+
*
|
|
26
|
+
* @prop class {string} - Custom class for the container
|
|
27
|
+
* @default ""
|
|
28
|
+
*
|
|
29
|
+
* @prop children {Snippet} - Content panel rendered below the tabs
|
|
30
|
+
*
|
|
31
|
+
* @note Supports multiple visual styles (`default`, `pills`, `underline`).
|
|
32
|
+
* @note Fully accessible with keyboard navigation (Arrow keys, Home, End, Enter).
|
|
33
|
+
* @note Automatically adapts to container width.
|
|
34
|
+
* @note The panel content (`children`) scales visually with the selected tab size.
|
|
35
|
+
*/
|
|
36
|
+
import type { Snippet } from "svelte";
|
|
37
|
+
import type { SizeKey, TabsVariant, TabItem } from "./types";
|
|
38
|
+
import { TEXT } from "./types";
|
|
39
|
+
import { cx } from "../utils";
|
|
40
|
+
|
|
41
|
+
type Props = {
|
|
42
|
+
tabs?: TabItem[];
|
|
43
|
+
activeTab?: string;
|
|
44
|
+
sz?: SizeKey;
|
|
45
|
+
variant?: TabsVariant;
|
|
46
|
+
fitted?: boolean;
|
|
47
|
+
onChange?: (tabId: string) => void;
|
|
48
|
+
class?: string;
|
|
49
|
+
children?: Snippet;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
let {
|
|
53
|
+
tabs = [],
|
|
54
|
+
activeTab = "",
|
|
55
|
+
sz = "md",
|
|
56
|
+
variant = "default",
|
|
57
|
+
fitted = false,
|
|
58
|
+
onChange,
|
|
59
|
+
class: externalClass = "",
|
|
60
|
+
children,
|
|
61
|
+
...rest
|
|
62
|
+
}: Props = $props();
|
|
63
|
+
|
|
64
|
+
$effect(() => {
|
|
65
|
+
if (!activeTab && tabs.length) activeTab = tabs[0].id;
|
|
66
|
+
if (activeTab && !tabs.find((t) => t.id === activeTab) && tabs.length) {
|
|
67
|
+
activeTab = tabs[0].id;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
function focusActiveButton() {
|
|
72
|
+
if (!activeTab) return;
|
|
73
|
+
const btn = document.getElementById(
|
|
74
|
+
`tab-${activeTab}`
|
|
75
|
+
) as HTMLButtonElement | null;
|
|
76
|
+
btn?.focus();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function handleTabClick(tab: TabItem) {
|
|
80
|
+
if (tab.disabled) return;
|
|
81
|
+
activeTab = tab.id;
|
|
82
|
+
onChange?.(tab.id);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function handleKeyDown(e: KeyboardEvent) {
|
|
86
|
+
const enabled = tabs.filter((t) => !t.disabled);
|
|
87
|
+
if (!enabled.length) return;
|
|
88
|
+
|
|
89
|
+
const idx = Math.max(
|
|
90
|
+
0,
|
|
91
|
+
enabled.findIndex((t) => t.id === activeTab)
|
|
92
|
+
);
|
|
93
|
+
let next: number;
|
|
94
|
+
|
|
95
|
+
if (e.key === "ArrowRight") next = (idx + 1) % enabled.length;
|
|
96
|
+
else if (e.key === "ArrowLeft")
|
|
97
|
+
next = (idx - 1 + enabled.length) % enabled.length;
|
|
98
|
+
else if (e.key === "Home") next = 0;
|
|
99
|
+
else if (e.key === "End") next = enabled.length - 1;
|
|
100
|
+
else return;
|
|
101
|
+
|
|
102
|
+
e.preventDefault();
|
|
103
|
+
const nextId = enabled[next].id;
|
|
104
|
+
activeTab = nextId;
|
|
105
|
+
onChange?.(nextId);
|
|
106
|
+
queueMicrotask(focusActiveButton);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const sizes: Record<SizeKey, string> = {
|
|
110
|
+
xs: "px-2 py-1",
|
|
111
|
+
sm: "px-3 py-1.5",
|
|
112
|
+
md: "px-4 py-2",
|
|
113
|
+
lg: "px-5 py-2.5",
|
|
114
|
+
xl: "px-6 py-3",
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const base =
|
|
118
|
+
"inline-flex items-center justify-center font-medium transition-colors duration-[var(--transition-fast)] focus-visible:ring-inset focus-visible:ring-2 focus-visible:ring-[var(--border-color-focus)] focus-visible:ring-offset-0 focus:outline-none disabled:opacity-[var(--opacity-disabled)] disabled:cursor-not-allowed [@media(pointer:coarse)]:min-h-11";
|
|
119
|
+
|
|
120
|
+
const variants = $derived({
|
|
121
|
+
default: {
|
|
122
|
+
base: "border-b-2 border-transparent text-[var(--color-text-default)]",
|
|
123
|
+
active:
|
|
124
|
+
"bg-[var(--color-bg-secondary)] !text-[var(--color-text-default)] border-[var(--border-color-strong)]",
|
|
125
|
+
hover:
|
|
126
|
+
"hover:text-[var(--color-text-default)] hover:bg-[var(--color-bg-muted)]",
|
|
127
|
+
},
|
|
128
|
+
underline: {
|
|
129
|
+
base: "border-b-2 border-transparent text-[var(--color-text-default)]",
|
|
130
|
+
active:
|
|
131
|
+
"border-[var(--border-color-focus)] !text-[var(--color-text-default)]",
|
|
132
|
+
hover:
|
|
133
|
+
"hover:text-[var(--color-text-default)] hover:border-[var(--border-color-strong)]",
|
|
134
|
+
},
|
|
135
|
+
pills: {
|
|
136
|
+
base: "text-[var(--color-text-default)] border border-transparent font-medium",
|
|
137
|
+
active:
|
|
138
|
+
"bg-[var(--color-bg-primary)] text-[var(--color-text-default)] border-[var(--color-bg-primary)] font-[var(--font-weight-semibold)]",
|
|
139
|
+
hover:
|
|
140
|
+
"hover:bg-[var(--color-bg-secondary)] hover:text-[var(--color-text-default)]",
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
const rootClass = $derived(
|
|
145
|
+
cx("w-full self-stretch flex flex-col", TEXT[sz], externalClass)
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
const tablistClass = $derived(
|
|
149
|
+
cx(
|
|
150
|
+
"flex w-full flex-nowrap overflow-x-auto whitespace-nowrap relative z-10 bg-[var(--color-bg-surface)]",
|
|
151
|
+
TEXT[sz],
|
|
152
|
+
variant === "pills" && "gap-1",
|
|
153
|
+
variant === "underline" && "gap-6",
|
|
154
|
+
fitted ? "justify-between" : "justify-start"
|
|
155
|
+
)
|
|
156
|
+
);
|
|
157
|
+
</script>
|
|
158
|
+
|
|
159
|
+
<div class={rootClass} {...rest}>
|
|
160
|
+
<div
|
|
161
|
+
role="tablist"
|
|
162
|
+
tabindex="0"
|
|
163
|
+
aria-orientation="horizontal"
|
|
164
|
+
class={tablistClass}
|
|
165
|
+
onkeydown={handleKeyDown}
|
|
166
|
+
onfocus={focusActiveButton}
|
|
167
|
+
>
|
|
168
|
+
{#each tabs as tab (tab.id)}
|
|
169
|
+
<button
|
|
170
|
+
id={`tab-${tab.id}`}
|
|
171
|
+
type="button"
|
|
172
|
+
role="tab"
|
|
173
|
+
aria-selected={tab.id === activeTab ? "true" : "false"}
|
|
174
|
+
aria-controls={`panel-${tab.id}`}
|
|
175
|
+
aria-disabled={tab.disabled ? "true" : "false"}
|
|
176
|
+
tabindex={tab.id === activeTab ? 0 : -1}
|
|
177
|
+
disabled={tab.disabled}
|
|
178
|
+
class={cx(
|
|
179
|
+
"relative z-20",
|
|
180
|
+
base,
|
|
181
|
+
sizes[sz],
|
|
182
|
+
TEXT[sz],
|
|
183
|
+
fitted ? "basis-0 grow flex-1 min-w-0 text-center" : "shrink-0",
|
|
184
|
+
variants[variant]?.base,
|
|
185
|
+
tab.id === activeTab
|
|
186
|
+
? variants[variant]?.active
|
|
187
|
+
: !tab.disabled
|
|
188
|
+
? variants[variant]?.hover
|
|
189
|
+
: ""
|
|
190
|
+
)}
|
|
191
|
+
onclick={() => handleTabClick(tab)}
|
|
192
|
+
onkeydown={(e) => {
|
|
193
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
194
|
+
e.preventDefault();
|
|
195
|
+
handleTabClick(tab);
|
|
196
|
+
}
|
|
197
|
+
}}
|
|
198
|
+
>
|
|
199
|
+
<span>{tab.label}</span>
|
|
200
|
+
</button>
|
|
201
|
+
{/each}
|
|
202
|
+
</div>
|
|
203
|
+
|
|
204
|
+
<div
|
|
205
|
+
id={`panel-${activeTab}`}
|
|
206
|
+
role="tabpanel"
|
|
207
|
+
tabindex="-1"
|
|
208
|
+
aria-labelledby={`tab-${activeTab}`}
|
|
209
|
+
class="w-full min-w-0 relative z-0 border-t border-[var(--border-color-default)] bg-[var(--color-bg-surface)] p-[var(--spacing-md)] rounded-b-[var(--radius-sm)] shadow-[0_1px_2px_0_var(--shadow-color)]"
|
|
210
|
+
>
|
|
211
|
+
{@render children?.()}
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|