@x33025/sveltely 0.1.23 → 0.1.24
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/components/Library/AnimatedNumber/AnimatedNumber.demo.svelte +3 -2
- package/dist/components/Library/ArticleEditor/Blocks/Table.svelte +133 -172
- package/dist/components/Library/Checkbox/Checkbox.demo.svelte +5 -4
- package/dist/components/Library/Checkbox/Checkbox.svelte +6 -5
- package/dist/components/Library/Checkbox/Checkbox.svelte.d.ts +2 -1
- package/dist/components/Library/ChipInput/ChipInput.demo.svelte +3 -2
- package/dist/components/Library/Dropdown/Dropdown.demo.svelte +17 -14
- package/dist/components/Library/Floating/Floating.svelte +5 -6
- package/dist/components/Library/Grid/Grid.svelte +13 -4
- package/dist/components/Library/Grid/Grid.svelte.d.ts +2 -1
- package/dist/components/Library/Grid/GridItem.svelte +12 -3
- package/dist/components/Library/Grid/GridItem.svelte.d.ts +2 -1
- package/dist/components/Library/HStack/HStack.svelte +4 -4
- package/dist/components/Library/HStack/HStack.svelte.d.ts +2 -1
- package/dist/components/Library/Image/Image.demo.svelte +3 -1
- package/dist/components/Library/Image/Image.demo.svelte.d.ts +2 -0
- package/dist/components/Library/ImageMask/ImageMask.demo.svelte +8 -6
- package/dist/components/Library/Label/Label.demo.svelte +4 -4
- package/dist/components/Library/Label/Label.svelte +5 -13
- package/dist/components/Library/NavigationStack/Link.svelte +1 -4
- package/dist/components/Library/Pagination/Pagination.demo.svelte +3 -2
- package/dist/components/Library/Popover/PopoverDebugOverlay.svelte +3 -3
- package/dist/components/Library/Portal/Content.svelte +20 -0
- package/dist/components/Library/Portal/Content.svelte.d.ts +10 -0
- package/dist/components/Library/Portal/Portal.svelte +4 -0
- package/dist/components/Library/Portal/Portal.svelte.d.ts +1 -0
- package/dist/components/Library/Portal/index.d.ts +1 -0
- package/dist/components/Library/Portal/index.js +1 -0
- package/dist/components/Library/ScrollView/ScrollView.svelte +12 -5
- package/dist/components/Library/SearchField/SearchField.demo.svelte +3 -2
- package/dist/components/Library/SearchField/SearchField.svelte +5 -5
- package/dist/components/Library/SearchField/SearchField.svelte.d.ts +2 -1
- package/dist/components/Library/SegmentedPicker/SegmentedPicker.demo.svelte +3 -2
- package/dist/components/Library/Sheet/Sheet.demo.svelte +3 -2
- package/dist/components/Library/Sheet/Sheet.svelte +3 -3
- package/dist/components/Library/Slider/Slider.demo.svelte +3 -2
- package/dist/components/Library/Spinner/Spinner.demo.svelte +3 -2
- package/dist/components/Library/Switch/Switch.demo.svelte +5 -4
- package/dist/components/Library/Switch/Switch.svelte +6 -5
- package/dist/components/Library/Switch/Switch.svelte.d.ts +2 -1
- package/dist/components/Library/Table/Column.svelte +3 -0
- package/dist/components/Library/Table/Column.svelte.d.ts +1 -0
- package/dist/components/Library/Table/Table.demo.svelte +222 -17
- package/dist/components/Library/Table/Table.svelte +98 -57
- package/dist/components/Library/Table/Table.svelte.d.ts +1 -2
- package/dist/components/Library/Table/types.d.ts +1 -0
- package/dist/components/Library/TextShimmer/TextShimmer.demo.svelte +3 -2
- package/dist/components/Library/TimePicker/TimePicker.demo.svelte +3 -10
- package/dist/components/Library/TokenSearchField/TokenSearchField.demo.svelte +3 -2
- package/dist/components/Library/VStack/VStack.svelte +4 -4
- package/dist/components/Library/VStack/VStack.svelte.d.ts +2 -1
- package/dist/components/Local/ColorStyleControls.svelte +0 -8
- package/dist/components/Local/ComponentGrid.svelte +3 -12
- package/dist/components/Local/HeroCard.svelte +1 -2
- package/dist/components/Local/LayoutStyleControls.svelte +33 -25
- package/dist/components/Local/StyleControls.svelte +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/style/index.css +2 -2
- package/dist/style/layout.d.ts +14 -20
- package/dist/style/layout.js +14 -40
- package/dist/style/surface.d.ts +1 -0
- package/dist/style/surface.js +10 -0
- package/dist/style.css +2 -53
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
<script lang="ts">
|
|
9
9
|
import AnimatedNumber from './AnimatedNumber.svelte';
|
|
10
10
|
import Button from '../Button/Button.svelte';
|
|
11
|
+
import VStack from '../VStack';
|
|
11
12
|
|
|
12
13
|
let value = $state(1234);
|
|
13
14
|
|
|
@@ -16,9 +17,9 @@
|
|
|
16
17
|
};
|
|
17
18
|
</script>
|
|
18
19
|
|
|
19
|
-
<
|
|
20
|
+
<VStack align="center" justify="center" gap={7.5}>
|
|
20
21
|
<div class="text-3xl font-semibold text-[var(--sveltely-text-primary-color)]">
|
|
21
22
|
<AnimatedNumber {value} />
|
|
22
23
|
</div>
|
|
23
24
|
<Button label="Change number" onclick={bump} />
|
|
24
|
-
</
|
|
25
|
+
</VStack>
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Plus, Trash2 } from '@lucide/svelte';
|
|
3
|
+
import Grid from '../../Grid';
|
|
4
|
+
import HStack from '../../HStack';
|
|
5
|
+
import Spacer from '../../Spacer';
|
|
6
|
+
import SveltelyTable from '../../Table';
|
|
7
|
+
import { Column as TableColumn } from '../../Table';
|
|
8
|
+
import VStack from '../../VStack';
|
|
3
9
|
import type { BlockDraft } from '../types.js';
|
|
4
10
|
|
|
11
|
+
type EditorTableRow = {
|
|
12
|
+
id: string;
|
|
13
|
+
rowIndex: number;
|
|
14
|
+
cells: string[];
|
|
15
|
+
};
|
|
16
|
+
|
|
5
17
|
let { block, onUpdateHeader, onUpdateCell, onAddColumn, onAddRow, onRemoveColumn, onRemoveRow } =
|
|
6
18
|
$props<{
|
|
7
19
|
block: BlockDraft;
|
|
@@ -17,6 +29,14 @@
|
|
|
17
29
|
Math.max((block.columns ?? []).length, block.rows?.[0]?.length ?? 0, 1)
|
|
18
30
|
);
|
|
19
31
|
const rowCount = $derived(Math.max((block.rows ?? []).length, 1));
|
|
32
|
+
const columnIndexes = $derived(Array.from({ length: columnCount }, (_, index) => index));
|
|
33
|
+
const tableRows = $derived<EditorTableRow[]>(
|
|
34
|
+
Array.from({ length: rowCount }, (_, rowIndex) => ({
|
|
35
|
+
id: `${block.id}-${rowIndex}`,
|
|
36
|
+
rowIndex,
|
|
37
|
+
cells: block.rows?.[rowIndex] ?? []
|
|
38
|
+
}))
|
|
39
|
+
);
|
|
20
40
|
|
|
21
41
|
const columnHasContent = (columnIndex: number) =>
|
|
22
42
|
Boolean(block.columns?.[columnIndex]?.trim()) ||
|
|
@@ -48,227 +68,168 @@
|
|
|
48
68
|
};
|
|
49
69
|
</script>
|
|
50
70
|
|
|
51
|
-
<
|
|
52
|
-
<
|
|
53
|
-
<
|
|
54
|
-
{#
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
onclick={() => removeColumn(columnIndex)}
|
|
75
|
-
>
|
|
76
|
-
<Trash2 size={14} />
|
|
77
|
-
</button>
|
|
78
|
-
</th>
|
|
79
|
-
{/each}
|
|
80
|
-
</tr>
|
|
81
|
-
</thead>
|
|
82
|
-
{/if}
|
|
83
|
-
<tbody>
|
|
84
|
-
{#each block.rows ?? [] as row, rowIndex}
|
|
85
|
-
<tr class="article-block-table-row">
|
|
86
|
-
{#each row as cell, cellIndex}
|
|
87
|
-
<td class="article-block-table-cell">
|
|
88
|
-
<textarea
|
|
89
|
-
rows="2"
|
|
90
|
-
class="article-block-table-cell-input"
|
|
91
|
-
value={cell}
|
|
92
|
-
oninput={(event) =>
|
|
93
|
-
onUpdateCell(
|
|
94
|
-
block.id,
|
|
95
|
-
rowIndex,
|
|
96
|
-
cellIndex,
|
|
97
|
-
(event.currentTarget as HTMLTextAreaElement).value
|
|
98
|
-
)}
|
|
99
|
-
></textarea>
|
|
100
|
-
</td>
|
|
101
|
-
{/each}
|
|
102
|
-
<td class="article-block-table-row-control">
|
|
71
|
+
<VStack width="100%" gap={0}>
|
|
72
|
+
<Grid columns="minmax(0, 1fr) 2.25rem" gap={0}>
|
|
73
|
+
<SveltelyTable data={tableRows} borderRadius={0} emptyLabel="No rows">
|
|
74
|
+
{#each columnIndexes as columnIndex (columnIndex)}
|
|
75
|
+
<TableColumn
|
|
76
|
+
key={`column-${columnIndex}`}
|
|
77
|
+
label={block.columns?.[columnIndex] || `Column ${columnIndex + 1}`}
|
|
78
|
+
minWidth={180}
|
|
79
|
+
>
|
|
80
|
+
{#snippet header()}
|
|
81
|
+
<HStack width="100%" align="center" gap={5}>
|
|
82
|
+
<input
|
|
83
|
+
class="article-block-table-header-input"
|
|
84
|
+
value={block.columns?.[columnIndex] ?? ''}
|
|
85
|
+
aria-label={`Column ${columnIndex + 1} header`}
|
|
86
|
+
oninput={(event) =>
|
|
87
|
+
onUpdateHeader(
|
|
88
|
+
block.id,
|
|
89
|
+
columnIndex,
|
|
90
|
+
(event.currentTarget as HTMLInputElement).value
|
|
91
|
+
)}
|
|
92
|
+
/>
|
|
93
|
+
<Spacer />
|
|
103
94
|
<button
|
|
104
95
|
type="button"
|
|
105
|
-
aria-label="Remove
|
|
106
|
-
disabled={
|
|
107
|
-
class="article-block-table-remove
|
|
108
|
-
onclick={() =>
|
|
96
|
+
aria-label="Remove column"
|
|
97
|
+
disabled={columnCount <= 1}
|
|
98
|
+
class="article-block-table-remove"
|
|
99
|
+
onclick={() => removeColumn(columnIndex)}
|
|
109
100
|
>
|
|
110
101
|
<Trash2 size={14} />
|
|
111
102
|
</button>
|
|
112
|
-
</
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
103
|
+
</HStack>
|
|
104
|
+
{/snippet}
|
|
105
|
+
|
|
106
|
+
{#snippet cell(row: EditorTableRow)}
|
|
107
|
+
<textarea
|
|
108
|
+
rows="2"
|
|
109
|
+
class="article-block-table-cell-input"
|
|
110
|
+
value={row.cells[columnIndex] ?? ''}
|
|
111
|
+
aria-label={`Row ${row.rowIndex + 1}, column ${columnIndex + 1}`}
|
|
112
|
+
oninput={(event) =>
|
|
113
|
+
onUpdateCell(
|
|
114
|
+
block.id,
|
|
115
|
+
row.rowIndex,
|
|
116
|
+
columnIndex,
|
|
117
|
+
(event.currentTarget as HTMLTextAreaElement).value
|
|
118
|
+
)}
|
|
119
|
+
></textarea>
|
|
120
|
+
{/snippet}
|
|
121
|
+
</TableColumn>
|
|
122
|
+
{/each}
|
|
123
|
+
|
|
124
|
+
<TableColumn key="row-actions" label="" width={44} minWidth={44} alignment="center">
|
|
125
|
+
{#snippet cell(row: EditorTableRow)}
|
|
126
|
+
<button
|
|
127
|
+
type="button"
|
|
128
|
+
aria-label="Remove row"
|
|
129
|
+
disabled={rowCount <= 1}
|
|
130
|
+
class="article-block-table-remove"
|
|
131
|
+
onclick={() => removeRow(row.rowIndex)}
|
|
132
|
+
>
|
|
133
|
+
<Trash2 size={14} />
|
|
134
|
+
</button>
|
|
135
|
+
{/snippet}
|
|
136
|
+
</TableColumn>
|
|
137
|
+
</SveltelyTable>
|
|
138
|
+
|
|
139
|
+
<button
|
|
140
|
+
type="button"
|
|
141
|
+
aria-label="Add column"
|
|
142
|
+
class="article-block-table-add article-block-table-add-column"
|
|
143
|
+
onclick={() => onAddColumn(block.id)}
|
|
144
|
+
>
|
|
145
|
+
<Plus size={16} />
|
|
146
|
+
</button>
|
|
147
|
+
</Grid>
|
|
148
|
+
|
|
149
|
+
<Grid columns="minmax(0, 1fr) 2.25rem" gap={0}>
|
|
150
|
+
<button
|
|
151
|
+
type="button"
|
|
152
|
+
aria-label="Add row"
|
|
153
|
+
class="article-block-table-add article-block-table-add-row"
|
|
154
|
+
onclick={() => onAddRow(block.id)}
|
|
155
|
+
>
|
|
156
|
+
<Plus size={16} />
|
|
157
|
+
</button>
|
|
158
|
+
<div class="article-block-table-corner"></div>
|
|
159
|
+
</Grid>
|
|
160
|
+
</VStack>
|
|
136
161
|
|
|
137
162
|
<style>
|
|
138
|
-
.article-block-table-
|
|
139
|
-
|
|
140
|
-
grid-template-columns: minmax(0, 1fr) 2.25rem;
|
|
141
|
-
grid-template-rows: auto 2.25rem;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.article-block-table-scroll {
|
|
145
|
-
overflow-x: auto;
|
|
146
|
-
border: 1px solid rgba(0, 0, 0, 0.08);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.article-block-table {
|
|
150
|
-
min-width: 100%;
|
|
151
|
-
border-collapse: collapse;
|
|
152
|
-
text-align: left;
|
|
153
|
-
font-size: 0.875rem;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.article-block-table-head {
|
|
157
|
-
background: #fafaf9;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.article-block-table-header {
|
|
161
|
-
position: relative;
|
|
162
|
-
border-bottom: 1px solid rgba(0, 0, 0, 0.08);
|
|
163
|
-
padding: 0.75rem;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.article-block-table-header-input {
|
|
163
|
+
.article-block-table-header-input,
|
|
164
|
+
.article-block-table-cell-input {
|
|
167
165
|
width: 100%;
|
|
166
|
+
min-width: 0;
|
|
168
167
|
border: 0;
|
|
169
168
|
background: transparent;
|
|
170
|
-
|
|
171
|
-
font-weight: 600;
|
|
169
|
+
color: inherit;
|
|
172
170
|
outline: none;
|
|
173
171
|
}
|
|
174
172
|
|
|
175
|
-
.article-block-table-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.article-block-table-cell {
|
|
180
|
-
padding: 0.75rem;
|
|
181
|
-
vertical-align: top;
|
|
173
|
+
.article-block-table-header-input {
|
|
174
|
+
font-weight: 600;
|
|
182
175
|
}
|
|
183
176
|
|
|
184
177
|
.article-block-table-cell-input {
|
|
185
|
-
width: 100%;
|
|
186
178
|
resize: none;
|
|
187
|
-
border: 0;
|
|
188
|
-
background: transparent;
|
|
189
|
-
outline: none;
|
|
190
179
|
}
|
|
191
180
|
|
|
192
|
-
.article-block-table-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
vertical-align: middle;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.article-block-table-remove-column,
|
|
199
|
-
.article-block-table-remove-row,
|
|
200
|
-
.article-block-table-add-column,
|
|
201
|
-
.article-block-table-add-row {
|
|
202
|
-
display: flex;
|
|
181
|
+
.article-block-table-remove,
|
|
182
|
+
.article-block-table-add {
|
|
183
|
+
display: inline-flex;
|
|
203
184
|
align-items: center;
|
|
204
185
|
justify-content: center;
|
|
205
186
|
border: 0;
|
|
206
187
|
background: transparent;
|
|
207
|
-
color:
|
|
188
|
+
color: var(--sveltely-text-tertiary-color);
|
|
208
189
|
transition:
|
|
209
190
|
background-color 150ms,
|
|
210
191
|
color 150ms,
|
|
211
192
|
opacity 150ms;
|
|
212
193
|
}
|
|
213
194
|
|
|
214
|
-
.article-block-table-remove
|
|
215
|
-
position: absolute;
|
|
216
|
-
top: 50%;
|
|
217
|
-
right: 0.5rem;
|
|
218
|
-
width: 1.5rem;
|
|
219
|
-
height: 1.5rem;
|
|
220
|
-
transform: translateY(-50%);
|
|
221
|
-
opacity: 0;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
.article-block-table-remove-row {
|
|
195
|
+
.article-block-table-remove {
|
|
225
196
|
width: 1.75rem;
|
|
226
197
|
height: 1.75rem;
|
|
227
|
-
|
|
198
|
+
flex: 0 0 1.75rem;
|
|
228
199
|
}
|
|
229
200
|
|
|
230
|
-
.article-block-table-
|
|
231
|
-
.article-block-table-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
opacity: 1;
|
|
201
|
+
.article-block-table-remove:hover,
|
|
202
|
+
.article-block-table-add:hover {
|
|
203
|
+
background: var(--sveltely-control-inactive-color);
|
|
204
|
+
color: var(--sveltely-text-primary-color);
|
|
235
205
|
}
|
|
236
206
|
|
|
237
|
-
.article-block-table-remove
|
|
238
|
-
.article-block-table-remove-row:hover {
|
|
239
|
-
background: #fef2f2;
|
|
240
|
-
color: #dc2626;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
.article-block-table-remove-column:disabled,
|
|
244
|
-
.article-block-table-remove-row:disabled {
|
|
207
|
+
.article-block-table-remove:disabled {
|
|
245
208
|
pointer-events: none;
|
|
246
|
-
opacity: 0;
|
|
209
|
+
opacity: 0.25;
|
|
247
210
|
}
|
|
248
211
|
|
|
249
|
-
.article-block-table-add
|
|
250
|
-
|
|
251
|
-
border-color: rgba(0, 0, 0, 0.08);
|
|
212
|
+
.article-block-table-add {
|
|
213
|
+
border-color: var(--sveltely-border-color);
|
|
252
214
|
border-style: solid;
|
|
253
215
|
}
|
|
254
216
|
|
|
255
217
|
.article-block-table-add-column {
|
|
218
|
+
width: 2.25rem;
|
|
256
219
|
border-width: 1px 1px 1px 0;
|
|
257
220
|
}
|
|
258
221
|
|
|
259
222
|
.article-block-table-add-row {
|
|
223
|
+
height: 2.25rem;
|
|
224
|
+
flex: 1 1 auto;
|
|
260
225
|
border-width: 0 1px 1px 1px;
|
|
261
226
|
}
|
|
262
227
|
|
|
263
|
-
.article-block-table-add-column:hover,
|
|
264
|
-
.article-block-table-add-row:hover {
|
|
265
|
-
background: #f5f5f4;
|
|
266
|
-
color: #3f3f46;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
228
|
.article-block-table-corner {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
229
|
+
width: 2.25rem;
|
|
230
|
+
height: 2.25rem;
|
|
231
|
+
border-right: 1px solid var(--sveltely-border-color);
|
|
232
|
+
border-bottom: 1px solid var(--sveltely-border-color);
|
|
233
|
+
background: color-mix(in oklab, var(--sveltely-background-color) 94%, var(--sveltely-border-color));
|
|
273
234
|
}
|
|
274
235
|
</style>
|
|
@@ -8,16 +8,17 @@
|
|
|
8
8
|
<script lang="ts">
|
|
9
9
|
import Checkbox from './Checkbox.svelte';
|
|
10
10
|
import Label from '../Label';
|
|
11
|
+
import VStack from '../VStack';
|
|
11
12
|
|
|
12
13
|
let notificationsEnabled = $state(true);
|
|
13
14
|
let weeklySummaryEnabled = $state(false);
|
|
14
15
|
</script>
|
|
15
16
|
|
|
16
|
-
<
|
|
17
|
-
<Label label="Enable notifications" orientation="leading"
|
|
17
|
+
<VStack gap={7.5}>
|
|
18
|
+
<Label label="Enable notifications" orientation="leading">
|
|
18
19
|
<Checkbox bind:checked={notificationsEnabled} />
|
|
19
20
|
</Label>
|
|
20
|
-
<Label label="Send weekly summary" orientation="leading"
|
|
21
|
+
<Label label="Send weekly summary" orientation="leading">
|
|
21
22
|
<Checkbox bind:checked={weeklySummaryEnabled} />
|
|
22
23
|
</Label>
|
|
23
|
-
</
|
|
24
|
+
</VStack>
|
|
@@ -11,25 +11,26 @@
|
|
|
11
11
|
TooltipProps &
|
|
12
12
|
Omit<HTMLInputAttributes, 'type' | 'class' | 'style' | 'checked'>;
|
|
13
13
|
|
|
14
|
-
let { checked = $bindable(false), tooltip, disabled = false, ...restProps }: Props
|
|
14
|
+
let { checked = $bindable(false), tooltip, disabled = false, ...restProps }: Props &
|
|
15
|
+
Record<string, unknown> = $props();
|
|
15
16
|
|
|
16
17
|
const extractedStyleProps = $derived.by(() => extractStyleProps(restProps));
|
|
17
18
|
const styleProps = $derived(extractedStyleProps.styleProps);
|
|
18
|
-
const
|
|
19
|
+
const forwardedProps = $derived(extractedStyleProps.restProps);
|
|
19
20
|
const rootStyle = $derived.by(() => surfaceStyle(styleProps, 'checkbox'));
|
|
20
21
|
</script>
|
|
21
22
|
|
|
22
|
-
<
|
|
23
|
+
<span
|
|
23
24
|
class="checkbox"
|
|
24
25
|
style={rootStyle}
|
|
25
26
|
data-disabled={disabled ? 'true' : 'false'}
|
|
26
27
|
use:tooltipAction={tooltip}
|
|
27
28
|
>
|
|
28
|
-
<input bind:checked type="checkbox" {disabled} {...
|
|
29
|
+
<input bind:checked type="checkbox" {disabled} {...forwardedProps} />
|
|
29
30
|
<span class="checkbox-mark" aria-hidden="true">
|
|
30
31
|
<CheckIcon class="checkbox-icon" />
|
|
31
32
|
</span>
|
|
32
|
-
</
|
|
33
|
+
</span>
|
|
33
34
|
|
|
34
35
|
<style>
|
|
35
36
|
.checkbox {
|
|
@@ -4,6 +4,7 @@ import type { TooltipProps } from '../../../style/tooltip';
|
|
|
4
4
|
type Props = {
|
|
5
5
|
checked?: boolean;
|
|
6
6
|
} & StyleProps & TooltipProps & Omit<HTMLInputAttributes, 'type' | 'class' | 'style' | 'checked'>;
|
|
7
|
-
|
|
7
|
+
type $$ComponentProps = Props & Record<string, unknown>;
|
|
8
|
+
declare const Checkbox: import("svelte").Component<$$ComponentProps, {}, "checked">;
|
|
8
9
|
type Checkbox = ReturnType<typeof Checkbox>;
|
|
9
10
|
export default Checkbox;
|
|
@@ -6,12 +6,13 @@
|
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<script lang="ts">
|
|
9
|
+
import VStack from '../VStack';
|
|
9
10
|
import ChipInput from './ChipInput.svelte';
|
|
10
11
|
|
|
11
12
|
let tags = $state(['svelte', 'ui', 'search']);
|
|
12
13
|
</script>
|
|
13
14
|
|
|
14
|
-
<
|
|
15
|
+
<VStack width="100%" maxWidth="24rem" gap={5}>
|
|
15
16
|
<ChipInput bind:tags />
|
|
16
17
|
<p class="text-xs text-[var(--sveltely-text-secondary-color)]">Tags: {tags.join(', ')}</p>
|
|
17
|
-
</
|
|
18
|
+
</VStack>
|
|
@@ -8,8 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
<script lang="ts">
|
|
10
10
|
import { CheckIcon, PlusIcon, UserRoundXIcon } from '@lucide/svelte';
|
|
11
|
+
import Grid from '../Grid';
|
|
12
|
+
import HStack from '../HStack';
|
|
11
13
|
import SearchField from '../SearchField';
|
|
12
14
|
import ScrollView, { type ScrollGeometry } from '../ScrollView';
|
|
15
|
+
import VStack from '../VStack';
|
|
13
16
|
import Dropdown from './index';
|
|
14
17
|
|
|
15
18
|
type Website = {
|
|
@@ -87,8 +90,8 @@
|
|
|
87
90
|
});
|
|
88
91
|
</script>
|
|
89
92
|
|
|
90
|
-
<
|
|
91
|
-
<
|
|
93
|
+
<Grid columns="repeat(auto-fit, minmax(min(100%, 18rem), 1fr))" gap={10}>
|
|
94
|
+
<VStack gap={5}>
|
|
92
95
|
<p class="text-sm font-medium text-[var(--sveltely-text-primary-color)]">Default trigger</p>
|
|
93
96
|
<Dropdown bind:value={status} placeholder="Choose status" selectedLabel={selectedStatusLabel}>
|
|
94
97
|
<Dropdown.Section label="Publishing">
|
|
@@ -106,9 +109,9 @@
|
|
|
106
109
|
<p class="text-xs text-[var(--sveltely-text-secondary-color)]">
|
|
107
110
|
Selected: {selectedStatusLabel ?? 'none'}
|
|
108
111
|
</p>
|
|
109
|
-
</
|
|
112
|
+
</VStack>
|
|
110
113
|
|
|
111
|
-
<
|
|
114
|
+
<VStack gap={5}>
|
|
112
115
|
<p class="text-sm font-medium text-[var(--sveltely-text-primary-color)]">
|
|
113
116
|
Custom trigger and rich rows
|
|
114
117
|
</p>
|
|
@@ -120,7 +123,7 @@
|
|
|
120
123
|
{#snippet trigger()}
|
|
121
124
|
<Dropdown.Trigger>
|
|
122
125
|
{#if selectedWebsite}
|
|
123
|
-
<
|
|
126
|
+
<HStack minWidth={0} align="center" gap={5}>
|
|
124
127
|
<span class="truncate text-[var(--sveltely-text-primary-color)]"
|
|
125
128
|
>{selectedWebsite.name}</span
|
|
126
129
|
>
|
|
@@ -129,7 +132,7 @@
|
|
|
129
132
|
{selectedWebsite.domain}
|
|
130
133
|
</span>
|
|
131
134
|
{/if}
|
|
132
|
-
</
|
|
135
|
+
</HStack>
|
|
133
136
|
{:else}
|
|
134
137
|
<span class="text-[var(--sveltely-text-secondary-color)]">Select website</span>
|
|
135
138
|
{/if}
|
|
@@ -152,25 +155,25 @@
|
|
|
152
155
|
No websites found.
|
|
153
156
|
</div>
|
|
154
157
|
{:else}
|
|
155
|
-
<
|
|
158
|
+
<VStack height={9}>
|
|
156
159
|
<ScrollView
|
|
157
160
|
contentStyles={{ paddingX: 0, paddingY: 0 }}
|
|
158
161
|
borderRadius={5}
|
|
159
162
|
background="white"
|
|
160
163
|
onScroll={handleWebsiteScroll}
|
|
161
164
|
>
|
|
162
|
-
<
|
|
165
|
+
<VStack gap={2.5}>
|
|
163
166
|
{#each visibleWebsites as website (website.id)}
|
|
164
167
|
<Dropdown.Item value={website.id}>
|
|
165
168
|
{#snippet children({ selected })}
|
|
166
|
-
<
|
|
169
|
+
<VStack minWidth={0} gap={1.25}>
|
|
167
170
|
<span class="truncate">{website.name}</span>
|
|
168
171
|
{#if website.domain}
|
|
169
172
|
<span class="truncate text-xs text-[var(--sveltely-text-secondary-color)]"
|
|
170
173
|
>{website.domain}</span
|
|
171
174
|
>
|
|
172
175
|
{/if}
|
|
173
|
-
</
|
|
176
|
+
</VStack>
|
|
174
177
|
{#if selected}
|
|
175
178
|
<CheckIcon
|
|
176
179
|
size={14}
|
|
@@ -180,12 +183,12 @@
|
|
|
180
183
|
{/snippet}
|
|
181
184
|
</Dropdown.Item>
|
|
182
185
|
{/each}
|
|
183
|
-
</
|
|
186
|
+
</VStack>
|
|
184
187
|
</ScrollView>
|
|
185
|
-
</
|
|
188
|
+
</VStack>
|
|
186
189
|
{/if}
|
|
187
190
|
</Dropdown.Section>
|
|
188
191
|
</Dropdown>
|
|
189
192
|
<p class="text-xs text-[var(--sveltely-text-secondary-color)]">Actions clicked: {actionCount}</p>
|
|
190
|
-
</
|
|
191
|
-
</
|
|
193
|
+
</VStack>
|
|
194
|
+
</Grid>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { tick, onDestroy } from 'svelte';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
|
-
import {
|
|
4
|
+
import { Content as PortalContent } from '../Portal';
|
|
5
5
|
import { autoAlignForViewport, computePosition, type Anchor } from '../../../utils/positioning';
|
|
6
6
|
import {
|
|
7
7
|
hasOpenChild,
|
|
@@ -385,9 +385,8 @@
|
|
|
385
385
|
{@render trigger({ useTrigger, open, toggle, openPanel, closePanel })}
|
|
386
386
|
|
|
387
387
|
{#if open}
|
|
388
|
-
<
|
|
389
|
-
|
|
390
|
-
bind:this={panelEl}
|
|
388
|
+
<PortalContent
|
|
389
|
+
bind:element={panelEl}
|
|
391
390
|
class={panelClass}
|
|
392
391
|
style={resolvedPanelStyle}
|
|
393
392
|
data-floating
|
|
@@ -395,11 +394,11 @@
|
|
|
395
394
|
data-floating-parent-id={parentFloatingId ?? ''}
|
|
396
395
|
role={panelRole}
|
|
397
396
|
aria-modal={panelAriaModal}
|
|
398
|
-
tabindex=
|
|
397
|
+
tabindex={-1}
|
|
399
398
|
>
|
|
400
399
|
<div bind:this={contentEl} class={contentClass} style={contentStyle}>
|
|
401
400
|
{@render children()}
|
|
402
401
|
</div>
|
|
403
|
-
</
|
|
402
|
+
</PortalContent>
|
|
404
403
|
{/if}
|
|
405
404
|
</div>
|
|
@@ -15,7 +15,14 @@
|
|
|
15
15
|
StyleProps &
|
|
16
16
|
LoaderProps;
|
|
17
17
|
|
|
18
|
-
let {
|
|
18
|
+
let {
|
|
19
|
+
children,
|
|
20
|
+
columns = 1,
|
|
21
|
+
rows,
|
|
22
|
+
autoRows,
|
|
23
|
+
dense = false,
|
|
24
|
+
...restProps
|
|
25
|
+
}: Props & Record<string, unknown> = $props();
|
|
19
26
|
|
|
20
27
|
const extractedLoaderProps = $derived.by(() => extractLoaderProps(restProps));
|
|
21
28
|
const loaderProps = $derived(extractedLoaderProps.loaderProps);
|
|
@@ -26,7 +33,7 @@
|
|
|
26
33
|
const afterLayoutProps = $derived(extractedLayoutProps.restProps);
|
|
27
34
|
const extractedStyleProps = $derived.by(() => extractStyleProps(afterLayoutProps));
|
|
28
35
|
const styleProps = $derived(extractedStyleProps.styleProps);
|
|
29
|
-
const
|
|
36
|
+
const forwardedProps = $derived(extractedStyleProps.restProps);
|
|
30
37
|
const templateColumns = $derived(
|
|
31
38
|
typeof columns === 'number' ? `repeat(${columns}, minmax(0, 1fr))` : columns
|
|
32
39
|
);
|
|
@@ -57,7 +64,7 @@
|
|
|
57
64
|
class="grid"
|
|
58
65
|
class:grid-dense={dense}
|
|
59
66
|
style={rootStyle}
|
|
60
|
-
{...
|
|
67
|
+
{...forwardedProps}
|
|
61
68
|
use:loaderAction={loaderOptions}
|
|
62
69
|
>
|
|
63
70
|
{#if children}
|
|
@@ -68,8 +75,10 @@
|
|
|
68
75
|
<style>
|
|
69
76
|
.grid {
|
|
70
77
|
display: grid;
|
|
78
|
+
width: 100%;
|
|
71
79
|
min-width: 0;
|
|
72
|
-
min-height:
|
|
80
|
+
min-height: 100%;
|
|
81
|
+
align-self: stretch;
|
|
73
82
|
align-items: stretch;
|
|
74
83
|
gap: var(--grid-gap, 0px);
|
|
75
84
|
border-radius: var(--grid-border-radius, 0px);
|
|
@@ -9,6 +9,7 @@ type Props = {
|
|
|
9
9
|
autoRows?: number | string;
|
|
10
10
|
dense?: boolean;
|
|
11
11
|
} & LayoutProps & StyleProps & LoaderProps;
|
|
12
|
-
|
|
12
|
+
type $$ComponentProps = Props & Record<string, unknown>;
|
|
13
|
+
declare const Grid: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
13
14
|
type Grid = ReturnType<typeof Grid>;
|
|
14
15
|
export default Grid;
|