carbon-components-svelte 0.89.5 → 0.89.7
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/package.json
CHANGED
|
@@ -116,7 +116,6 @@
|
|
|
116
116
|
import WarningFilled from "../icons/WarningFilled.svelte";
|
|
117
117
|
import WarningAltFilled from "../icons/WarningAltFilled.svelte";
|
|
118
118
|
import ListBox from "../ListBox/ListBox.svelte";
|
|
119
|
-
import ListBoxField from "../ListBox/ListBoxField.svelte";
|
|
120
119
|
import ListBoxMenu from "../ListBox/ListBoxMenu.svelte";
|
|
121
120
|
import ListBoxMenuIcon from "../ListBox/ListBoxMenuIcon.svelte";
|
|
122
121
|
import ListBoxMenuItem from "../ListBox/ListBoxMenuItem.svelte";
|
|
@@ -254,22 +253,12 @@
|
|
|
254
253
|
{warn}
|
|
255
254
|
{warnText}
|
|
256
255
|
>
|
|
257
|
-
<
|
|
258
|
-
role="button"
|
|
259
|
-
aria-expanded={open}
|
|
260
|
-
on:click={async () => {
|
|
261
|
-
if (disabled) return;
|
|
262
|
-
open = true;
|
|
263
|
-
await tick();
|
|
264
|
-
ref.focus();
|
|
265
|
-
}}
|
|
266
|
-
{id}
|
|
267
|
-
{disabled}
|
|
268
|
-
{translateWithId}
|
|
269
|
-
>
|
|
256
|
+
<div class:bx--list-box__field={true}>
|
|
270
257
|
<input
|
|
271
258
|
bind:this={ref}
|
|
272
259
|
bind:value
|
|
260
|
+
type="text"
|
|
261
|
+
role="combobox"
|
|
273
262
|
tabindex="0"
|
|
274
263
|
autocomplete="off"
|
|
275
264
|
aria-autocomplete="list"
|
|
@@ -287,6 +276,10 @@
|
|
|
287
276
|
class:bx--text-input={true}
|
|
288
277
|
class:bx--text-input--light={light}
|
|
289
278
|
class:bx--text-input--empty={value === ""}
|
|
279
|
+
on:click={() => {
|
|
280
|
+
if (disabled) return;
|
|
281
|
+
open = true;
|
|
282
|
+
}}
|
|
290
283
|
on:input={({ target }) => {
|
|
291
284
|
if (!open && target.value.length > 0) {
|
|
292
285
|
open = true;
|
|
@@ -384,7 +377,7 @@
|
|
|
384
377
|
{translateWithId}
|
|
385
378
|
{open}
|
|
386
379
|
/>
|
|
387
|
-
</
|
|
380
|
+
</div>
|
|
388
381
|
{#if open}
|
|
389
382
|
<ListBoxMenu aria-label={ariaLabel} {id} on:scroll bind:ref={listRef}>
|
|
390
383
|
{#each filteredItems as item, i (item.id)}
|
|
@@ -263,12 +263,13 @@
|
|
|
263
263
|
expanded = expandedRowIds.length === expandableRowIds.length;
|
|
264
264
|
}
|
|
265
265
|
$: if (radio || batchSelection) selectable = true;
|
|
266
|
-
$: headerKeys = headers.map(({ key }) => key);
|
|
267
266
|
$: tableCellsByRowId = rows.reduce((rows, row) => {
|
|
268
|
-
rows[row.id] =
|
|
269
|
-
key
|
|
270
|
-
value: resolvePath(row, key),
|
|
271
|
-
display:
|
|
267
|
+
rows[row.id] = headers.map((header, index) => ({
|
|
268
|
+
key: header.key || `key-${index}`,
|
|
269
|
+
value: header.key ? resolvePath(row, header.key) : undefined,
|
|
270
|
+
display: header.display,
|
|
271
|
+
empty: header.empty,
|
|
272
|
+
columnMenu: header.columnMenu,
|
|
272
273
|
}));
|
|
273
274
|
return rows;
|
|
274
275
|
}, {});
|
|
@@ -557,8 +558,8 @@
|
|
|
557
558
|
</td>
|
|
558
559
|
{/if}
|
|
559
560
|
{#each tableCellsByRowId[row.id] as cell, j (cell.key)}
|
|
560
|
-
{#if
|
|
561
|
-
<td class:bx--table-column-menu={
|
|
561
|
+
{#if cell.empty}
|
|
562
|
+
<td class:bx--table-column-menu={cell.columnMenu}>
|
|
562
563
|
<slot name="cell" {row} {cell} rowIndex={i} cellIndex={j}>
|
|
563
564
|
{cell.display ? cell.display(cell.value, row) : cell.value}
|
|
564
565
|
</slot>
|
|
@@ -167,17 +167,12 @@
|
|
|
167
167
|
$: if ($items[$currentIndex]) {
|
|
168
168
|
focusedId.set($items[$currentIndex].id);
|
|
169
169
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
<\/style>`;
|
|
170
|
+
// Use CSS custom properties instead of dynamic style injection for better
|
|
171
|
+
// performance. The previous approach created individual `style` tags per
|
|
172
|
+
// instance, causing overhead when many OverflowMenu components are rendered.
|
|
173
|
+
$: overflowMenuOptionsAfterWidth = buttonWidth ? buttonWidth + "px" : "2rem";
|
|
175
174
|
</script>
|
|
176
175
|
|
|
177
|
-
<svelte:head>
|
|
178
|
-
{@html styles}
|
|
179
|
-
</svelte:head>
|
|
180
|
-
|
|
181
176
|
<svelte:window
|
|
182
177
|
on:click={({ target }) => {
|
|
183
178
|
if (buttonRef && buttonRef.contains(target)) return;
|
|
@@ -252,8 +247,15 @@
|
|
|
252
247
|
class:bx--overflow-menu-options--xl={size === "xl"}
|
|
253
248
|
class:bx--breadcrumb-menu-options={!!ctxBreadcrumbItem}
|
|
254
249
|
class={menuOptionsClass}
|
|
250
|
+
style="--overflow-menu-options-after-width: {overflowMenuOptionsAfterWidth}"
|
|
255
251
|
>
|
|
256
252
|
<slot />
|
|
257
253
|
</ul>
|
|
258
254
|
{/if}
|
|
259
255
|
</button>
|
|
256
|
+
|
|
257
|
+
<style>
|
|
258
|
+
.bx--overflow-menu-options:after {
|
|
259
|
+
width: var(--overflow-menu-options-after-width, 2rem);
|
|
260
|
+
}
|
|
261
|
+
</style>
|
|
@@ -135,8 +135,8 @@
|
|
|
135
135
|
hideLabel
|
|
136
136
|
noLabel
|
|
137
137
|
inline
|
|
138
|
-
on:
|
|
139
|
-
dispatch("change", { pageSize });
|
|
138
|
+
on:update={(event) => {
|
|
139
|
+
dispatch("change", { pageSize: event.detail });
|
|
140
140
|
}}
|
|
141
141
|
bind:selected={pageSize}
|
|
142
142
|
>
|
|
@@ -165,8 +165,8 @@
|
|
|
165
165
|
labelText="Page number, of {totalPages} pages"
|
|
166
166
|
inline
|
|
167
167
|
hideLabel
|
|
168
|
-
on:
|
|
169
|
-
dispatch("change", { page });
|
|
168
|
+
on:update={(event) => {
|
|
169
|
+
dispatch("change", { page: event.detail });
|
|
170
170
|
}}
|
|
171
171
|
bind:selected={page}
|
|
172
172
|
>
|
package/src/Toggle/Toggle.svelte
CHANGED
|
@@ -39,8 +39,6 @@
|
|
|
39
39
|
import { createEventDispatcher } from "svelte";
|
|
40
40
|
|
|
41
41
|
const dispatch = createEventDispatcher();
|
|
42
|
-
|
|
43
|
-
$: dispatch("toggle", { toggled });
|
|
44
42
|
</script>
|
|
45
43
|
|
|
46
44
|
<!-- svelte-ignore a11y-mouse-events-have-key-events -->
|
|
@@ -63,12 +61,14 @@
|
|
|
63
61
|
checked={toggled}
|
|
64
62
|
on:change={() => {
|
|
65
63
|
toggled = !toggled;
|
|
64
|
+
dispatch("toggle", { toggled });
|
|
66
65
|
}}
|
|
67
66
|
on:change
|
|
68
67
|
on:keyup={(e) => {
|
|
69
68
|
if (e.key === " " || e.key === "Enter") {
|
|
70
69
|
e.preventDefault();
|
|
71
70
|
toggled = !toggled;
|
|
71
|
+
dispatch("toggle", { toggled });
|
|
72
72
|
}
|
|
73
73
|
}}
|
|
74
74
|
on:keyup
|