@streamscloud/kit 0.17.0 → 0.18.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.
- package/dist/ui/badge/cmp.badge.svelte +4 -0
- package/dist/ui/badge/cmp.badge.svelte.d.ts +1 -0
- package/dist/ui/page-toolbar/cmp.reorderable-checkbox-list.svelte +131 -0
- package/dist/ui/page-toolbar/cmp.reorderable-checkbox-list.svelte.d.ts +31 -0
- package/dist/ui/page-toolbar/cmp.toolbar-checkbox.svelte +14 -0
- package/dist/ui/page-toolbar/cmp.toolbar-checkbox.svelte.d.ts +19 -0
- package/dist/ui/page-toolbar/cmp.toolbar-divider.svelte +19 -0
- package/dist/ui/page-toolbar/cmp.toolbar-divider.svelte.d.ts +35 -0
- package/dist/ui/page-toolbar/cmp.toolbar-filter-select.svelte +143 -0
- package/dist/ui/page-toolbar/cmp.toolbar-filter-select.svelte.d.ts +68 -0
- package/dist/ui/page-toolbar/cmp.toolbar-icon-button.svelte +71 -0
- package/dist/ui/page-toolbar/cmp.toolbar-icon-button.svelte.d.ts +32 -0
- package/dist/ui/page-toolbar/cmp.toolbar-option.svelte +189 -0
- package/dist/ui/page-toolbar/cmp.toolbar-option.svelte.d.ts +47 -0
- package/dist/ui/page-toolbar/cmp.toolbar-popover.svelte +23 -8
- package/dist/ui/page-toolbar/cmp.toolbar-popover.svelte.d.ts +14 -6
- package/dist/ui/page-toolbar/cmp.toolbar-section-title.svelte +46 -0
- package/dist/ui/page-toolbar/cmp.toolbar-section-title.svelte.d.ts +24 -0
- package/dist/ui/page-toolbar/cmp.toolbar-sort-select.svelte +31 -0
- package/dist/ui/page-toolbar/cmp.toolbar-sort-select.svelte.d.ts +44 -0
- package/dist/ui/page-toolbar/{cmp.toolbar-switch-item.svelte → cmp.toolbar-switch.svelte} +10 -10
- package/dist/ui/page-toolbar/{cmp.toolbar-switch-item.svelte.d.ts → cmp.toolbar-switch.svelte.d.ts} +2 -2
- package/dist/ui/page-toolbar/cmp.toolbar-toggle.svelte +14 -0
- package/dist/ui/page-toolbar/cmp.toolbar-toggle.svelte.d.ts +19 -0
- package/dist/ui/page-toolbar/cmp.toolbar-view-controls.svelte +51 -0
- package/dist/ui/page-toolbar/cmp.toolbar-view-controls.svelte.d.ts +27 -0
- package/dist/ui/page-toolbar/index.d.ts +12 -7
- package/dist/ui/page-toolbar/index.js +11 -6
- package/dist/ui/page-toolbar/reorderable-checkbox-list-localization.d.ts +5 -0
- package/dist/ui/page-toolbar/reorderable-checkbox-list-localization.js +17 -0
- package/dist/ui/page-toolbar/toolbar-filter-select-localization.d.ts +5 -0
- package/dist/ui/page-toolbar/toolbar-filter-select-localization.js +20 -0
- package/dist/ui/page-toolbar/toolbar-sort-select-localization.d.ts +3 -0
- package/dist/ui/page-toolbar/toolbar-sort-select-localization.js +9 -0
- package/dist/ui/page-toolbar/toolbar-view-controls-localization.d.ts +5 -0
- package/dist/ui/page-toolbar/toolbar-view-controls-localization.js +17 -0
- package/dist/ui/page-toolbar/types.d.ts +1 -1
- package/dist/ui/select/index.d.ts +1 -0
- package/dist/ui/select/index.js +1 -0
- package/dist/ui/select/select-listbox.svelte +11 -5
- package/dist/ui/select/select-listbox.svelte.d.ts +1 -1
- package/dist/ui/table/_table-styles.scss +156 -0
- package/dist/ui/table/cmp.table-draggable.svelte +338 -0
- package/dist/ui/table/cmp.table-draggable.svelte.d.ts +79 -0
- package/dist/ui/table/cmp.table.svelte +96 -265
- package/dist/ui/table/cmp.table.svelte.d.ts +16 -8
- package/dist/ui/table/index.d.ts +1 -0
- package/dist/ui/table/index.js +1 -0
- package/dist/ui/table/table-cells/index.d.ts +1 -12
- package/dist/ui/table/table-cells/index.js +1 -12
- package/dist/ui/table/table-cells/table-cell.svelte +77 -0
- package/dist/ui/table/table-cells/{table-select-cell.svelte.d.ts → table-cell.svelte.d.ts} +12 -6
- package/dist/ui/table/table-column-models.svelte.d.ts +1 -2
- package/dist/ui/table/table-column-models.svelte.js +0 -1
- package/dist/ui/table/table-columns-manager/cmp.table-columns-manager.svelte +20 -47
- package/dist/ui/table/table-columns-manager/cmp.table-columns-manager.svelte.d.ts +3 -7
- package/dist/ui/table/table-columns-manager/table-columns-manager-localization.d.ts +1 -1
- package/dist/ui/table/table-columns-manager/table-columns-manager-localization.js +7 -7
- package/dist/ui/table/table-localization.d.ts +0 -2
- package/dist/ui/table/table-localization.js +0 -14
- package/dist/ui/table/table-model.svelte.d.ts +2 -3
- package/dist/ui/table/table-model.svelte.js +5 -35
- package/dist/ui/table/table-view.svelte.d.ts +14 -0
- package/dist/ui/table/table-view.svelte.js +32 -0
- package/dist/ui/table/types.d.ts +5 -28
- package/dist/ui/toggle/cmp.toggle.svelte +32 -26
- package/dist/ui/toggle/cmp.toggle.svelte.d.ts +2 -0
- package/dist/ui/tree/cmp.tree-node-view.svelte +7 -2
- package/dist/ui/tree/cmp.tree.svelte +9 -1
- package/dist/ui/tree/cmp.tree.svelte.d.ts +1 -1
- package/dist/ui/tree/tree-navigation.svelte.d.ts +2 -0
- package/dist/ui/tree/tree-navigation.svelte.js +3 -0
- package/package.json +1 -1
- package/dist/ui/page-toolbar/cmp.reorderable-toggle-list.svelte +0 -153
- package/dist/ui/page-toolbar/cmp.reorderable-toggle-list.svelte.d.ts +0 -20
- package/dist/ui/page-toolbar/cmp.toolbar-checkbox-item.svelte +0 -19
- package/dist/ui/page-toolbar/cmp.toolbar-checkbox-item.svelte.d.ts +0 -12
- package/dist/ui/page-toolbar/cmp.toolbar-panel-button.svelte +0 -42
- package/dist/ui/page-toolbar/cmp.toolbar-panel-button.svelte.d.ts +0 -20
- package/dist/ui/page-toolbar/cmp.toolbar-panel.svelte +0 -57
- package/dist/ui/page-toolbar/cmp.toolbar-panel.svelte.d.ts +0 -19
- package/dist/ui/page-toolbar/cmp.toolbar-toggle-item.svelte +0 -16
- package/dist/ui/page-toolbar/cmp.toolbar-toggle-item.svelte.d.ts +0 -12
- package/dist/ui/table/table-cells/table-select-cell.svelte +0 -28
- package/dist/ui/table/table-cells/table-text-input-cell.svelte +0 -69
- package/dist/ui/table/table-cells/table-text-input-cell.svelte.d.ts +0 -38
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
<script lang="ts">import { Icon } from '../icon';
|
|
2
|
+
import { Toggle } from '../toggle';
|
|
3
|
+
import IconCheckboxChecked from '@fluentui/svg-icons/icons/checkbox_checked_16_filled.svg?raw';
|
|
4
|
+
import IconCheckboxIndeterminate from '@fluentui/svg-icons/icons/checkbox_indeterminate_16_filled.svg?raw';
|
|
5
|
+
import IconCheckboxUnchecked from '@fluentui/svg-icons/icons/checkbox_unchecked_16_regular.svg?raw';
|
|
6
|
+
import IconCheckmark from '@fluentui/svg-icons/icons/checkmark_16_regular.svg?raw';
|
|
7
|
+
const { selectable, size = 'md', variant = 'normal', indent = false, disabled = false, prepend, children, on } = $props();
|
|
8
|
+
const display = $derived(selectable?.display ?? 'checkbox');
|
|
9
|
+
const checkboxState = $derived(selectable?.selected === 'indeterminate' ? 'indeterminate' : selectable?.selected ? 'checked' : 'unchecked');
|
|
10
|
+
const isChecked = $derived(selectable?.selected === true);
|
|
11
|
+
const tinted = $derived(isChecked && variant === 'normal');
|
|
12
|
+
const strong = $derived(isChecked && display === 'checkmark');
|
|
13
|
+
const ariaChecked = $derived(selectable && display === 'checkbox' ? (checkboxState === 'indeterminate' ? 'mixed' : checkboxState === 'checked') : undefined);
|
|
14
|
+
const ariaPressed = $derived(selectable && display !== 'checkbox' ? isChecked : undefined);
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<button
|
|
18
|
+
type="button"
|
|
19
|
+
class="toolbar-option toolbar-option--{size} toolbar-option--{variant}"
|
|
20
|
+
class:toolbar-option--selected={tinted}
|
|
21
|
+
class:toolbar-option--strong={strong}
|
|
22
|
+
class:toolbar-option--indent={indent}
|
|
23
|
+
class:toolbar-option--disabled={disabled}
|
|
24
|
+
class:toolbar-option--muted-sm={variant === 'muted' && size === 'sm'}
|
|
25
|
+
class:toolbar-option--muted-md={variant === 'muted' && size === 'md'}
|
|
26
|
+
disabled={disabled}
|
|
27
|
+
role={selectable && display === 'checkbox' ? 'checkbox' : undefined}
|
|
28
|
+
aria-checked={ariaChecked}
|
|
29
|
+
aria-pressed={ariaPressed}
|
|
30
|
+
onclick={() => on?.click?.()}>
|
|
31
|
+
{#if prepend}
|
|
32
|
+
<span class="toolbar-option__prepend">{@render prepend()}</span>
|
|
33
|
+
{/if}
|
|
34
|
+
{#if selectable && display === 'checkbox'}
|
|
35
|
+
<span class="toolbar-option__check toolbar-option__check--{checkboxState}">
|
|
36
|
+
{#if checkboxState === 'checked'}
|
|
37
|
+
<Icon src={IconCheckboxChecked} />
|
|
38
|
+
{:else if checkboxState === 'indeterminate'}
|
|
39
|
+
<Icon src={IconCheckboxIndeterminate} />
|
|
40
|
+
{:else}
|
|
41
|
+
<Icon src={IconCheckboxUnchecked} />
|
|
42
|
+
{/if}
|
|
43
|
+
</span>
|
|
44
|
+
{/if}
|
|
45
|
+
<span class="toolbar-option__label">{@render children()}</span>
|
|
46
|
+
{#if selectable && display === 'checkmark'}
|
|
47
|
+
<span class="toolbar-option__checkmark" class:toolbar-option__checkmark--hidden={!isChecked}><Icon src={IconCheckmark} /></span>
|
|
48
|
+
{:else if selectable && display === 'switch'}
|
|
49
|
+
<span class="toolbar-option__switch"><Toggle presentational checked={isChecked} disabled={disabled} /></span>
|
|
50
|
+
{/if}
|
|
51
|
+
</button>
|
|
52
|
+
|
|
53
|
+
<!--
|
|
54
|
+
@component
|
|
55
|
+
A single row for toolbar dropdowns, matching the kit select listbox options. Pass `selectable` for a
|
|
56
|
+
multi (`display='checkbox'`, tri-state) or single (`display='checkmark'`) option; omit it for a plain
|
|
57
|
+
button-like row. `variant` covers group headers (`emphasis`) and secondary actions (`muted`). Mix
|
|
58
|
+
these — plus `ToolbarSectionTitle` — inside one panel to build column / field pickers.
|
|
59
|
+
|
|
60
|
+
### CSS Custom Properties
|
|
61
|
+
| Property | Description | Default |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| `--sc-kit--toolbar-option--height` | Row height | per size (28 / 32px) |
|
|
64
|
+
| `--sc-kit--toolbar-option--padding-inline` | Horizontal padding | per size |
|
|
65
|
+
| `--sc-kit--toolbar-option--font-size` | Label font size | per size |
|
|
66
|
+
| `--sc-kit--toolbar-option--gap` | Gap between glyph and label | `var(--sc-kit--space--2)` |
|
|
67
|
+
| `--sc-kit--toolbar-option--border-radius` | Corner radius | `var(--sc-kit--radius--sm)` |
|
|
68
|
+
| `--sc-kit--toolbar-option--color` | Label color | `var(--sc-kit--color--text--primary)` |
|
|
69
|
+
| `--sc-kit--toolbar-option--color--selected` | Selected label + glyph color | `var(--sc-kit--color--accent)` |
|
|
70
|
+
| `--sc-kit--toolbar-option--color--muted` | `muted` variant color | `var(--sc-kit--color--text--secondary)` |
|
|
71
|
+
| `--sc-kit--toolbar-option--background--hover` | Hover background | `var(--sc-kit--color--accent--softer)` |
|
|
72
|
+
| `--sc-kit--toolbar-option--glyph--color` | Unselected checkbox glyph color | `var(--sc-kit--color--text--muted)` |
|
|
73
|
+
| `--sc-kit--toolbar-option--glyph--size` | Selection glyph (checkbox / checkmark) size | per size (14 / 16px) |
|
|
74
|
+
-->
|
|
75
|
+
|
|
76
|
+
<style>.toolbar-option {
|
|
77
|
+
--_opt--height: var(--sc-kit--toolbar-option--height, var(--_opt--size-height));
|
|
78
|
+
--_opt--padding-inline: var(--sc-kit--toolbar-option--padding-inline, var(--_opt--size-padding-inline));
|
|
79
|
+
--_opt--font-size: var(--sc-kit--toolbar-option--font-size, var(--_opt--size-font-size));
|
|
80
|
+
--_opt--gap: var(--sc-kit--toolbar-option--gap, var(--sc-kit--space--2));
|
|
81
|
+
--_opt--border-radius: var(--sc-kit--toolbar-option--border-radius, var(--sc-kit--radius--sm));
|
|
82
|
+
--_opt--color: var(--sc-kit--toolbar-option--color, var(--sc-kit--color--text--primary));
|
|
83
|
+
--_opt--color-selected: var(--sc-kit--toolbar-option--color--selected, var(--sc-kit--color--accent));
|
|
84
|
+
--_opt--color-muted: var(--sc-kit--toolbar-option--color--muted, var(--sc-kit--color--text--secondary));
|
|
85
|
+
--_opt--background-hover: var(--sc-kit--toolbar-option--background--hover, var(--sc-kit--color--accent--softer));
|
|
86
|
+
--_opt--glyph-color: var(--sc-kit--toolbar-option--glyph--color, var(--sc-kit--color--text--muted));
|
|
87
|
+
--_opt--glyph-size: var(--sc-kit--toolbar-option--glyph--size, var(--_opt--size-glyph-size));
|
|
88
|
+
appearance: none;
|
|
89
|
+
border: 0;
|
|
90
|
+
background: transparent;
|
|
91
|
+
text-align: inherit;
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
user-select: none;
|
|
94
|
+
display: flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
gap: var(--_opt--gap);
|
|
97
|
+
flex-shrink: 0;
|
|
98
|
+
inline-size: 100%;
|
|
99
|
+
block-size: var(--_opt--height);
|
|
100
|
+
padding-block: 0;
|
|
101
|
+
padding-inline: var(--_opt--padding-inline);
|
|
102
|
+
border-radius: var(--_opt--border-radius);
|
|
103
|
+
color: var(--_opt--color);
|
|
104
|
+
font-size: var(--_opt--font-size);
|
|
105
|
+
line-height: var(--sc-kit--leading--tight);
|
|
106
|
+
transition: background-color var(--sc-kit--duration--base) var(--sc-kit--ease--default), color var(--sc-kit--duration--base) var(--sc-kit--ease--default);
|
|
107
|
+
}
|
|
108
|
+
.toolbar-option--sm {
|
|
109
|
+
--_opt--size-height: var(--sc-kit--field--height--sm);
|
|
110
|
+
--_opt--size-padding-inline: var(--sc-kit--space--2);
|
|
111
|
+
--_opt--size-font-size: var(--sc-kit--font-size--sm);
|
|
112
|
+
--_opt--size-glyph-size: var(--sc-kit--field--icon--size--sm);
|
|
113
|
+
}
|
|
114
|
+
.toolbar-option--md {
|
|
115
|
+
--_opt--size-height: var(--sc-kit--field--height--md);
|
|
116
|
+
--_opt--size-padding-inline: var(--sc-kit--space--3);
|
|
117
|
+
--_opt--size-font-size: var(--sc-kit--font-size--md);
|
|
118
|
+
--_opt--size-glyph-size: var(--sc-kit--field--icon--size--md);
|
|
119
|
+
}
|
|
120
|
+
.toolbar-option:hover {
|
|
121
|
+
background: var(--_opt--background-hover);
|
|
122
|
+
}
|
|
123
|
+
.toolbar-option--indent {
|
|
124
|
+
padding-inline-start: calc(var(--_opt--padding-inline) + var(--_opt--glyph-size) + var(--_opt--gap));
|
|
125
|
+
}
|
|
126
|
+
.toolbar-option--selected {
|
|
127
|
+
--_opt--color: var(--_opt--color-selected);
|
|
128
|
+
}
|
|
129
|
+
.toolbar-option--strong {
|
|
130
|
+
font-weight: var(--sc-kit--font-weight--semibold);
|
|
131
|
+
}
|
|
132
|
+
.toolbar-option--emphasis {
|
|
133
|
+
font-weight: var(--sc-kit--font-weight--semibold);
|
|
134
|
+
}
|
|
135
|
+
.toolbar-option--muted {
|
|
136
|
+
--_opt--color: var(--_opt--color-muted);
|
|
137
|
+
}
|
|
138
|
+
.toolbar-option--muted-sm {
|
|
139
|
+
--_opt--size-font-size: var(--sc-kit--font-size--xs);
|
|
140
|
+
}
|
|
141
|
+
.toolbar-option--muted-md {
|
|
142
|
+
--_opt--size-font-size: var(--sc-kit--font-size--sm);
|
|
143
|
+
}
|
|
144
|
+
.toolbar-option--disabled {
|
|
145
|
+
--_opt--color: var(--sc-kit--color--text--muted);
|
|
146
|
+
cursor: default;
|
|
147
|
+
}
|
|
148
|
+
.toolbar-option__prepend {
|
|
149
|
+
flex-shrink: 0;
|
|
150
|
+
display: inline-flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
}
|
|
153
|
+
.toolbar-option__check {
|
|
154
|
+
--sc-kit--icon--size: var(--_opt--glyph-size);
|
|
155
|
+
--sc-kit--icon--color: var(--_opt--glyph-color);
|
|
156
|
+
flex-shrink: 0;
|
|
157
|
+
display: inline-flex;
|
|
158
|
+
align-items: center;
|
|
159
|
+
}
|
|
160
|
+
.toolbar-option__check--checked, .toolbar-option__check--indeterminate {
|
|
161
|
+
--sc-kit--icon--color: var(--_opt--color-selected);
|
|
162
|
+
}
|
|
163
|
+
.toolbar-option__label {
|
|
164
|
+
flex: 1;
|
|
165
|
+
min-width: 0;
|
|
166
|
+
text-overflow: ellipsis;
|
|
167
|
+
max-width: 100%;
|
|
168
|
+
white-space: nowrap;
|
|
169
|
+
overflow: hidden;
|
|
170
|
+
}
|
|
171
|
+
.toolbar-option__checkmark {
|
|
172
|
+
--sc-kit--icon--size: var(--_opt--glyph-size);
|
|
173
|
+
--sc-kit--icon--color: var(--_opt--color-selected);
|
|
174
|
+
flex-shrink: 0;
|
|
175
|
+
display: inline-flex;
|
|
176
|
+
align-items: center;
|
|
177
|
+
}
|
|
178
|
+
.toolbar-option__checkmark--hidden {
|
|
179
|
+
visibility: hidden;
|
|
180
|
+
}
|
|
181
|
+
.toolbar-option__switch {
|
|
182
|
+
flex-shrink: 0;
|
|
183
|
+
display: inline-flex;
|
|
184
|
+
align-items: center;
|
|
185
|
+
--sc-kit--toggle--track-height: var(--_opt--glyph-size);
|
|
186
|
+
--sc-kit--toggle--track-width: calc(var(--_opt--glyph-size) * 1.8);
|
|
187
|
+
--sc-kit--toggle--thumb-size: calc(var(--_opt--glyph-size) - 0.25rem);
|
|
188
|
+
--sc-kit--toggle--thumb-travel: calc(var(--_opt--glyph-size) * 0.8);
|
|
189
|
+
}</style>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type Selectable = {
|
|
3
|
+
selected: boolean | 'indeterminate';
|
|
4
|
+
/** Glyph for the selection: a left checkbox (multi), a right checkmark (single / preset), or a right switch (toggle). @default 'checkbox' */
|
|
5
|
+
display?: 'checkbox' | 'checkmark' | 'switch';
|
|
6
|
+
};
|
|
7
|
+
type Props = {
|
|
8
|
+
/** Selection behavior. Omit entirely for a plain, button-like row (e.g. a `Clear all` action). */
|
|
9
|
+
selectable?: Selectable;
|
|
10
|
+
/** Row density. @default 'md' */
|
|
11
|
+
size?: 'sm' | 'md';
|
|
12
|
+
/** Label treatment: `emphasis` = semibold, never tinted (group headers); `muted` = dimmed + one step smaller font (secondary actions). @default 'normal' */
|
|
13
|
+
variant?: 'normal' | 'emphasis' | 'muted';
|
|
14
|
+
/** Indent under a section title / group header. @default false */
|
|
15
|
+
indent?: boolean;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/** Leading content drawn before the standard glyph + label, inside the option's own padding / gap (e.g. a drag handle). */
|
|
18
|
+
prepend?: Snippet;
|
|
19
|
+
children: Snippet;
|
|
20
|
+
on?: {
|
|
21
|
+
click?: () => void;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* A single row for toolbar dropdowns, matching the kit select listbox options. Pass `selectable` for a
|
|
26
|
+
* multi (`display='checkbox'`, tri-state) or single (`display='checkmark'`) option; omit it for a plain
|
|
27
|
+
* button-like row. `variant` covers group headers (`emphasis`) and secondary actions (`muted`). Mix
|
|
28
|
+
* these — plus `ToolbarSectionTitle` — inside one panel to build column / field pickers.
|
|
29
|
+
*
|
|
30
|
+
* ### CSS Custom Properties
|
|
31
|
+
* | Property | Description | Default |
|
|
32
|
+
* |---|---|---|
|
|
33
|
+
* | `--sc-kit--toolbar-option--height` | Row height | per size (28 / 32px) |
|
|
34
|
+
* | `--sc-kit--toolbar-option--padding-inline` | Horizontal padding | per size |
|
|
35
|
+
* | `--sc-kit--toolbar-option--font-size` | Label font size | per size |
|
|
36
|
+
* | `--sc-kit--toolbar-option--gap` | Gap between glyph and label | `var(--sc-kit--space--2)` |
|
|
37
|
+
* | `--sc-kit--toolbar-option--border-radius` | Corner radius | `var(--sc-kit--radius--sm)` |
|
|
38
|
+
* | `--sc-kit--toolbar-option--color` | Label color | `var(--sc-kit--color--text--primary)` |
|
|
39
|
+
* | `--sc-kit--toolbar-option--color--selected` | Selected label + glyph color | `var(--sc-kit--color--accent)` |
|
|
40
|
+
* | `--sc-kit--toolbar-option--color--muted` | `muted` variant color | `var(--sc-kit--color--text--secondary)` |
|
|
41
|
+
* | `--sc-kit--toolbar-option--background--hover` | Hover background | `var(--sc-kit--color--accent--softer)` |
|
|
42
|
+
* | `--sc-kit--toolbar-option--glyph--color` | Unselected checkbox glyph color | `var(--sc-kit--color--text--muted)` |
|
|
43
|
+
* | `--sc-kit--toolbar-option--glyph--size` | Selection glyph (checkbox / checkmark) size | per size (14 / 16px) |
|
|
44
|
+
*/
|
|
45
|
+
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
46
|
+
type Cmp = ReturnType<typeof Cmp>;
|
|
47
|
+
export default Cmp;
|
|
@@ -1,31 +1,46 @@
|
|
|
1
1
|
<script lang="ts">import { Button } from '../button';
|
|
2
2
|
import { IconText } from '../icon-text';
|
|
3
3
|
import { Popover } from '../popover';
|
|
4
|
-
import ToolbarPanel from './cmp.toolbar-panel.svelte';
|
|
5
4
|
import IconChevronDown from '@fluentui/svg-icons/icons/chevron_down_20_regular.svg?raw';
|
|
6
|
-
const {
|
|
5
|
+
const { triggerLabel, icon, size = 'sm', borderless = false, position = 'bottom-start', columnFlex = true, children } = $props();
|
|
7
6
|
</script>
|
|
8
7
|
|
|
9
8
|
<div class="toolbar-popover">
|
|
10
9
|
<Popover position={position} keepOpen>
|
|
11
10
|
{#snippet trigger()}
|
|
12
|
-
<Button type="presentational" variant=
|
|
11
|
+
<Button type="presentational" variant={borderless ? 'ghost' : 'secondary'} size={size}>
|
|
13
12
|
<IconText icon={icon} secondaryIcon={IconChevronDown} size={size} iconScale="large">{triggerLabel}</IconText>
|
|
14
13
|
</Button>
|
|
15
14
|
{/snippet}
|
|
16
|
-
|
|
15
|
+
{#if columnFlex}
|
|
16
|
+
<div class="toolbar-popover__content">{@render children()}</div>
|
|
17
|
+
{:else}
|
|
17
18
|
{@render children()}
|
|
18
|
-
|
|
19
|
+
{/if}
|
|
19
20
|
</Popover>
|
|
20
21
|
</div>
|
|
21
22
|
|
|
22
23
|
<!--
|
|
23
24
|
@component
|
|
24
|
-
A toolbar popover button
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
A toolbar popover button — a secondary `Button` trigger (sharing the `sm | md | lg` field size preset)
|
|
26
|
+
opening a `Popover` panel. By default the content is laid out as a flex column (`columnFlex`); pass
|
|
27
|
+
`columnFlex={false}` to render it raw. Compose the panel from `ToolbarOption`, `ToolbarSectionTitle`,
|
|
28
|
+
`ToolbarDivider`, etc.
|
|
29
|
+
|
|
30
|
+
### CSS Custom Properties
|
|
31
|
+
| Property | Description | Default |
|
|
32
|
+
|---|---|---|
|
|
33
|
+
| `--sc-kit--toolbar-popover--gap` | Gap between flex-column children | `0.125rem` (2px) |
|
|
27
34
|
-->
|
|
28
35
|
|
|
29
36
|
<style>.toolbar-popover {
|
|
37
|
+
--_toolbar-popover--gap: var(--sc-kit--toolbar-popover--gap, 0.125rem);
|
|
30
38
|
display: contents;
|
|
39
|
+
--sc-kit--popover--content--padding: var(--sc-kit--space--2);
|
|
40
|
+
}
|
|
41
|
+
.toolbar-popover__content {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
gap: var(--_toolbar-popover--gap);
|
|
45
|
+
min-inline-size: 12.5rem;
|
|
31
46
|
}</style>
|
|
@@ -2,21 +2,29 @@ import type { IconProp } from '../icon';
|
|
|
2
2
|
import type { Placement } from '@floating-ui/dom';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
type Props = {
|
|
5
|
-
title: string;
|
|
6
5
|
triggerLabel: string;
|
|
7
6
|
/** Leading icon on the trigger button. */
|
|
8
7
|
icon?: IconProp;
|
|
9
8
|
/** Button size preset — shared with the kit Button. @default 'sm' */
|
|
10
9
|
size?: 'sm' | 'md' | 'lg';
|
|
11
|
-
/** @default
|
|
10
|
+
/** Render the trigger as a borderless (ghost) button instead of secondary. @default false */
|
|
11
|
+
borderless?: boolean;
|
|
12
|
+
/** @default 'bottom-start' */
|
|
12
13
|
position?: Placement;
|
|
14
|
+
/** Lay the panel content out as a flex column, so callers don't wrap it themselves. @default true */
|
|
15
|
+
columnFlex?: boolean;
|
|
13
16
|
children: Snippet;
|
|
14
|
-
footer?: Snippet;
|
|
15
17
|
};
|
|
16
18
|
/**
|
|
17
|
-
* A toolbar popover button
|
|
18
|
-
*
|
|
19
|
-
*
|
|
19
|
+
* A toolbar popover button — a secondary `Button` trigger (sharing the `sm | md | lg` field size preset)
|
|
20
|
+
* opening a `Popover` panel. By default the content is laid out as a flex column (`columnFlex`); pass
|
|
21
|
+
* `columnFlex={false}` to render it raw. Compose the panel from `ToolbarOption`, `ToolbarSectionTitle`,
|
|
22
|
+
* `ToolbarDivider`, etc.
|
|
23
|
+
*
|
|
24
|
+
* ### CSS Custom Properties
|
|
25
|
+
* | Property | Description | Default |
|
|
26
|
+
* |---|---|---|
|
|
27
|
+
* | `--sc-kit--toolbar-popover--gap` | Gap between flex-column children | `0.125rem` (2px) |
|
|
20
28
|
*/
|
|
21
29
|
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
22
30
|
type Cmp = ReturnType<typeof Cmp>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script lang="ts">const { size = 'xs', spaced = false, children } = $props();
|
|
2
|
+
export {};
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<div class="toolbar-section-title toolbar-section-title--{size}" class:toolbar-section-title--spaced={spaced}>{@render children()}</div>
|
|
6
|
+
|
|
7
|
+
<!--
|
|
8
|
+
@component
|
|
9
|
+
A non-interactive section label inside a toolbar dropdown (e.g. `FIELDS` above a column list).
|
|
10
|
+
Matches the kit select listbox group-header style. `spaced` adds extra top padding to set the
|
|
11
|
+
section off from content above it.
|
|
12
|
+
|
|
13
|
+
### CSS Custom Properties
|
|
14
|
+
| Property | Description | Default |
|
|
15
|
+
|---|---|---|
|
|
16
|
+
| `--sc-kit--toolbar-section-title--color` | Text color | `var(--sc-kit--color--text--muted)` |
|
|
17
|
+
| `--sc-kit--toolbar-section-title--font-family` | Font family | `var(--sc-kit--font--mono)` |
|
|
18
|
+
| `--sc-kit--toolbar-section-title--font-size` | Font size | per size (xs / sm / md) |
|
|
19
|
+
| `--sc-kit--toolbar-section-title--padding-block-start` | Top padding | per `spaced` |
|
|
20
|
+
-->
|
|
21
|
+
|
|
22
|
+
<style>.toolbar-section-title {
|
|
23
|
+
--_title--color: var(--sc-kit--toolbar-section-title--color, var(--sc-kit--color--text--muted));
|
|
24
|
+
--_title--font-family: var(--sc-kit--toolbar-section-title--font-family, var(--sc-kit--font--mono));
|
|
25
|
+
--_title--font-size: var(--sc-kit--toolbar-section-title--font-size, var(--_title--size-font-size));
|
|
26
|
+
--_title--padding-block-start: var(--sc-kit--toolbar-section-title--padding-block-start, var(--sc-kit--space--1));
|
|
27
|
+
padding: var(--_title--padding-block-start) var(--sc-kit--space--2) var(--sc-kit--space--1);
|
|
28
|
+
color: var(--_title--color);
|
|
29
|
+
font-family: var(--_title--font-family);
|
|
30
|
+
font-size: var(--_title--font-size);
|
|
31
|
+
font-weight: var(--sc-kit--font-weight--medium);
|
|
32
|
+
text-transform: uppercase;
|
|
33
|
+
letter-spacing: var(--sc-kit--letter-spacing--wide);
|
|
34
|
+
}
|
|
35
|
+
.toolbar-section-title--xs {
|
|
36
|
+
--_title--size-font-size: var(--sc-kit--font-size--xs);
|
|
37
|
+
}
|
|
38
|
+
.toolbar-section-title--sm {
|
|
39
|
+
--_title--size-font-size: var(--sc-kit--font-size--sm);
|
|
40
|
+
}
|
|
41
|
+
.toolbar-section-title--md {
|
|
42
|
+
--_title--size-font-size: var(--sc-kit--font-size--md);
|
|
43
|
+
}
|
|
44
|
+
.toolbar-section-title--spaced {
|
|
45
|
+
--_title--padding-block-start: var(--sc-kit--space--3);
|
|
46
|
+
}</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type Props = {
|
|
3
|
+
/** Font size. @default 'xs' */
|
|
4
|
+
size?: 'xs' | 'sm' | 'md';
|
|
5
|
+
/** Add extra top padding to separate the section from content above it. @default false */
|
|
6
|
+
spaced?: boolean;
|
|
7
|
+
children: Snippet;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* A non-interactive section label inside a toolbar dropdown (e.g. `FIELDS` above a column list).
|
|
11
|
+
* Matches the kit select listbox group-header style. `spaced` adds extra top padding to set the
|
|
12
|
+
* section off from content above it.
|
|
13
|
+
*
|
|
14
|
+
* ### CSS Custom Properties
|
|
15
|
+
* | Property | Description | Default |
|
|
16
|
+
* |---|---|---|
|
|
17
|
+
* | `--sc-kit--toolbar-section-title--color` | Text color | `var(--sc-kit--color--text--muted)` |
|
|
18
|
+
* | `--sc-kit--toolbar-section-title--font-family` | Font family | `var(--sc-kit--font--mono)` |
|
|
19
|
+
* | `--sc-kit--toolbar-section-title--font-size` | Font size | per size (xs / sm / md) |
|
|
20
|
+
* | `--sc-kit--toolbar-section-title--padding-block-start` | Top padding | per `spaced` |
|
|
21
|
+
*/
|
|
22
|
+
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
23
|
+
type Cmp = ReturnType<typeof Cmp>;
|
|
24
|
+
export default Cmp;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script lang="ts" generics="S">import ToolbarFilterSelect from './cmp.toolbar-filter-select.svelte';
|
|
2
|
+
import ToolbarIconButton from './cmp.toolbar-icon-button.svelte';
|
|
3
|
+
import ToolbarSectionTitle from './cmp.toolbar-section-title.svelte';
|
|
4
|
+
import { ToolbarSortSelectLocalization } from './toolbar-sort-select-localization';
|
|
5
|
+
import IconFilter from '@fluentui/svg-icons/icons/filter_20_regular.svg?raw';
|
|
6
|
+
const { options, value, label, size = 'sm', icon, compare, on } = $props();
|
|
7
|
+
const localization = new ToolbarSortSelectLocalization();
|
|
8
|
+
const orderByLabel = $derived(label ?? localization.orderBy);
|
|
9
|
+
const selection = $derived([value]);
|
|
10
|
+
const onChange = (next) => {
|
|
11
|
+
if (next.length > 0) {
|
|
12
|
+
on?.change?.(next[0]);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<ToolbarFilterSelect label={orderByLabel} single footer={false} size={size} options={options} value={selection} compare={compare} on={{ change: onChange }}>
|
|
18
|
+
{#snippet header()}
|
|
19
|
+
<ToolbarSectionTitle>{orderByLabel}</ToolbarSectionTitle>
|
|
20
|
+
{/snippet}
|
|
21
|
+
{#snippet trigger()}
|
|
22
|
+
<ToolbarIconButton presentational icon={icon ?? IconFilter} size={size} />
|
|
23
|
+
{/snippet}
|
|
24
|
+
</ToolbarFilterSelect>
|
|
25
|
+
|
|
26
|
+
<!--
|
|
27
|
+
@component
|
|
28
|
+
A toolbar sort control: a `ToolbarFilterSelect` in single-select mode behind a flat icon trigger
|
|
29
|
+
(`ToolbarIconButton`), with an `Order by` section title above the options. Stand-alone, or composed into
|
|
30
|
+
`ToolbarViewControls` via its `prepend` snippet.
|
|
31
|
+
-->
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { SelectItem } from '../select';
|
|
2
|
+
declare function $$render<S>(): {
|
|
3
|
+
props: {
|
|
4
|
+
options: SelectItem<S>[];
|
|
5
|
+
value: S;
|
|
6
|
+
/** Title shown above the options. @default localized `Order by` */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** Button size preset — sm = 28px, md = 32px. @default 'sm' */
|
|
9
|
+
size?: "sm" | "md";
|
|
10
|
+
/** Trigger glyph (a string SVG source). @default a filter glyph */
|
|
11
|
+
icon?: string;
|
|
12
|
+
/** Equality comparator — required when `S` is an object. */
|
|
13
|
+
compare?: (a: S, b: S) => boolean;
|
|
14
|
+
on?: {
|
|
15
|
+
change?: (value: S) => void;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
exports: {};
|
|
19
|
+
bindings: "";
|
|
20
|
+
slots: {};
|
|
21
|
+
events: {};
|
|
22
|
+
};
|
|
23
|
+
declare class __sveltets_Render<S> {
|
|
24
|
+
props(): ReturnType<typeof $$render<S>>['props'];
|
|
25
|
+
events(): ReturnType<typeof $$render<S>>['events'];
|
|
26
|
+
slots(): ReturnType<typeof $$render<S>>['slots'];
|
|
27
|
+
bindings(): "";
|
|
28
|
+
exports(): {};
|
|
29
|
+
}
|
|
30
|
+
interface $$IsomorphicComponent {
|
|
31
|
+
new <S>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<S>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<S>['props']>, ReturnType<__sveltets_Render<S>['events']>, ReturnType<__sveltets_Render<S>['slots']>> & {
|
|
32
|
+
$$bindings?: ReturnType<__sveltets_Render<S>['bindings']>;
|
|
33
|
+
} & ReturnType<__sveltets_Render<S>['exports']>;
|
|
34
|
+
<S>(internal: unknown, props: ReturnType<__sveltets_Render<S>['props']> & {}): ReturnType<__sveltets_Render<S>['exports']>;
|
|
35
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A toolbar sort control: a `ToolbarFilterSelect` in single-select mode behind a flat icon trigger
|
|
39
|
+
* (`ToolbarIconButton`), with an `Order by` section title above the options. Stand-alone, or composed into
|
|
40
|
+
* `ToolbarViewControls` via its `prepend` snippet.
|
|
41
|
+
*/
|
|
42
|
+
declare const Cmp: $$IsomorphicComponent;
|
|
43
|
+
type Cmp<S> = InstanceType<typeof Cmp<S>>;
|
|
44
|
+
export default Cmp;
|
|
@@ -2,45 +2,45 @@
|
|
|
2
2
|
const { segments, value, children, on } = $props();
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
|
-
<div class="toolbar-switch
|
|
6
|
-
<div class="toolbar-
|
|
5
|
+
<div class="toolbar-switch">
|
|
6
|
+
<div class="toolbar-switch__label">
|
|
7
7
|
{@render children()}
|
|
8
8
|
</div>
|
|
9
|
-
<div class="toolbar-
|
|
9
|
+
<div class="toolbar-switch__switch">
|
|
10
10
|
<SegmentedControl segments={segments} value={value} variant="outlined" size="sm" on={{ change: (v: T) => on?.change?.(v) }} />
|
|
11
11
|
</div>
|
|
12
12
|
</div>
|
|
13
13
|
|
|
14
14
|
<!--
|
|
15
15
|
@component
|
|
16
|
-
A switch
|
|
16
|
+
A labeled switch for toolbar dropdowns. Shows a label on the left and a segmented control on the right.
|
|
17
17
|
|
|
18
18
|
### CSS Custom Properties
|
|
19
19
|
| Property | Description | Default |
|
|
20
20
|
|---|---|---|
|
|
21
|
-
| `--sc-kit--toolbar-switch
|
|
21
|
+
| `--sc-kit--toolbar-switch--label--color` | Label text color | `var(--sc-kit--color--text--primary)` |
|
|
22
22
|
-->
|
|
23
23
|
|
|
24
|
-
<style>.toolbar-switch
|
|
25
|
-
--_toolbar-switch
|
|
24
|
+
<style>.toolbar-switch {
|
|
25
|
+
--_toolbar-switch--label--color: var(--sc-kit--toolbar-switch--label--color, var(--sc-kit--color--text--primary));
|
|
26
26
|
display: flex;
|
|
27
27
|
align-items: center;
|
|
28
28
|
justify-content: space-between;
|
|
29
29
|
gap: var(--sc-kit--space--2);
|
|
30
30
|
padding: var(--sc-kit--space--1) var(--sc-kit--space--2);
|
|
31
31
|
}
|
|
32
|
-
.toolbar-
|
|
32
|
+
.toolbar-switch__label {
|
|
33
33
|
font-size: var(--sc-kit--font-size--md);
|
|
34
34
|
font-weight: var(--sc-kit--font-weight--regular);
|
|
35
35
|
line-height: var(--sc-kit--line-height--md);
|
|
36
|
-
color: var(--_toolbar-switch
|
|
36
|
+
color: var(--_toolbar-switch--label--color);
|
|
37
37
|
min-width: 0;
|
|
38
38
|
text-overflow: ellipsis;
|
|
39
39
|
max-width: 100%;
|
|
40
40
|
white-space: nowrap;
|
|
41
41
|
overflow: hidden;
|
|
42
42
|
}
|
|
43
|
-
.toolbar-
|
|
43
|
+
.toolbar-switch__switch {
|
|
44
44
|
flex-shrink: 0;
|
|
45
45
|
--sc-kit--segmented-control--border-radius: var(--sc-kit--radius--md);
|
|
46
46
|
--sc-kit--segmented-control--background--active: var(--sc-kit--color--accent);
|
package/dist/ui/page-toolbar/{cmp.toolbar-switch-item.svelte.d.ts → cmp.toolbar-switch.svelte.d.ts}
RENAMED
|
@@ -29,12 +29,12 @@ interface $$IsomorphicComponent {
|
|
|
29
29
|
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
* A switch
|
|
32
|
+
* A labeled switch for toolbar dropdowns. Shows a label on the left and a segmented control on the right.
|
|
33
33
|
*
|
|
34
34
|
* ### CSS Custom Properties
|
|
35
35
|
* | Property | Description | Default |
|
|
36
36
|
* |---|---|---|
|
|
37
|
-
* | `--sc-kit--toolbar-switch
|
|
37
|
+
* | `--sc-kit--toolbar-switch--label--color` | Label text color | `var(--sc-kit--color--text--primary)` |
|
|
38
38
|
*/
|
|
39
39
|
declare const Cmp: $$IsomorphicComponent;
|
|
40
40
|
type Cmp<T> = InstanceType<typeof Cmp<T>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script lang="ts">import ToolbarOption from './cmp.toolbar-option.svelte';
|
|
2
|
+
const { checked, size = 'md', disabled = false, children, on } = $props();
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<ToolbarOption size={size} disabled={disabled} selectable={{ selected: checked, display: 'switch' }} on={{ click: () => on?.change?.(!checked) }}>
|
|
6
|
+
{@render children()}
|
|
7
|
+
</ToolbarOption>
|
|
8
|
+
|
|
9
|
+
<!--
|
|
10
|
+
@component
|
|
11
|
+
A toggle row for toolbar dropdowns — a thin wrapper over `ToolbarOption` with a trailing switch. The
|
|
12
|
+
whole row is the click target; clicking flips `checked` through `on.change`. The switch is a
|
|
13
|
+
presentational `Toggle` sized to the option glyph; sizing and styling come from `ToolbarOption`.
|
|
14
|
+
-->
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type Props = {
|
|
3
|
+
checked: boolean;
|
|
4
|
+
/** Row density — forwarded to `ToolbarOption`. @default 'md' */
|
|
5
|
+
size?: 'sm' | 'md';
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
children: Snippet;
|
|
8
|
+
on?: {
|
|
9
|
+
change?: (value: boolean) => void;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* A toggle row for toolbar dropdowns — a thin wrapper over `ToolbarOption` with a trailing switch. The
|
|
14
|
+
* whole row is the click target; clicking flips `checked` through `on.change`. The switch is a
|
|
15
|
+
* presentational `Toggle` sized to the option glyph; sizing and styling come from `ToolbarOption`.
|
|
16
|
+
*/
|
|
17
|
+
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
18
|
+
type Cmp = ReturnType<typeof Cmp>;
|
|
19
|
+
export default Cmp;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<script lang="ts">import { LocalStorageItem } from '../../core/local-storage';
|
|
2
|
+
import ToolbarIconButton from './cmp.toolbar-icon-button.svelte';
|
|
3
|
+
import { ToolbarViewControlsLocalization } from './toolbar-view-controls-localization';
|
|
4
|
+
import IconAppsList from '@fluentui/svg-icons/icons/apps_list_20_regular.svg?raw';
|
|
5
|
+
import IconGrid from '@fluentui/svg-icons/icons/grid_20_regular.svg?raw';
|
|
6
|
+
import { untrack } from 'svelte';
|
|
7
|
+
const { view, size = 'sm', viewStorageKey, prepend, on } = $props();
|
|
8
|
+
const localization = new ToolbarViewControlsLocalization();
|
|
9
|
+
let storage = null;
|
|
10
|
+
$effect(() => untrack(() => {
|
|
11
|
+
if (!viewStorageKey) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
storage = LocalStorageItem.of(viewStorageKey);
|
|
15
|
+
const saved = storage.get();
|
|
16
|
+
if (saved === 'list' || saved === 'grid') {
|
|
17
|
+
on?.viewChange?.(saved);
|
|
18
|
+
}
|
|
19
|
+
}));
|
|
20
|
+
const setView = (next) => {
|
|
21
|
+
storage?.set(next);
|
|
22
|
+
on?.viewChange?.(next);
|
|
23
|
+
};
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<div class="toolbar-view-controls" role="group" aria-label={localization.label}>
|
|
27
|
+
{#if prepend}
|
|
28
|
+
{@render prepend()}
|
|
29
|
+
{/if}
|
|
30
|
+
<ToolbarIconButton icon={IconAppsList} size={size} active={view === 'list'} aria-label={localization.listView} on={{ click: () => setView('list') }} />
|
|
31
|
+
<ToolbarIconButton icon={IconGrid} size={size} active={view === 'grid'} aria-label={localization.gridView} on={{ click: () => setView('grid') }} />
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
<!--
|
|
35
|
+
@component
|
|
36
|
+
A toolbar view switcher: a `list` / `grid` toggle built on the shared `ToolbarIconButton` (flat, 28px at
|
|
37
|
+
`sm` / 32px at `md`, 20px glyph). Pass `viewStorageKey` to persist the view across reloads, and compose a
|
|
38
|
+
leading control — e.g. `ToolbarSortSelect` — through the `prepend` snippet.
|
|
39
|
+
|
|
40
|
+
### CSS Custom Properties
|
|
41
|
+
| Property | Description | Default |
|
|
42
|
+
|---|---|---|
|
|
43
|
+
| `--sc-kit--toolbar-view-controls--gap` | Gap between the controls | `var(--sc-kit--space--3)` |
|
|
44
|
+
-->
|
|
45
|
+
|
|
46
|
+
<style>.toolbar-view-controls {
|
|
47
|
+
--_tvc--gap: var(--sc-kit--toolbar-view-controls--gap, var(--sc-kit--space--3));
|
|
48
|
+
display: inline-flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
gap: var(--_tvc--gap);
|
|
51
|
+
}</style>
|