@glasshome/ui 1.21.1 → 1.22.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/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/use-is-mobile.d.ts +3 -1
- package/dist/solid/index.d.ts +9 -9
- package/dist/solid/index.js +5431 -5424
- package/dist/solid/sonner.d.ts +1 -0
- package/dist/{utils-CMk7R3zM.js → utils-D5blHO4O.js} +624 -622
- package/package.json +128 -126
- package/scripts/check-gallery.ts +142 -142
- package/scripts/check-pack.ts +13 -13
- package/scripts/check-structural-classes.ts +20 -20
- package/scripts/check-tokens.ts +27 -27
- package/scripts/check-ui-drift.mjs +103 -103
- package/src/index.ts +75 -80
- package/src/lib/alert-tones.ts +41 -41
- package/src/lib/anchor-placement.ts +21 -21
- package/src/lib/button-variants.ts +28 -28
- package/src/lib/card-classes.ts +9 -9
- package/src/lib/carousel-classes.ts +14 -14
- package/src/lib/glass-tone.ts +11 -11
- package/src/lib/input-classes.ts +6 -6
- package/src/lib/layers.ts +4 -4
- package/src/lib/logo-lockup.ts +8 -8
- package/src/lib/menu-classes.ts +2 -2
- package/src/lib/motion-classes.ts +8 -8
- package/src/lib/motion-window.ts +24 -24
- package/src/lib/overlay-classes.ts +6 -6
- package/src/lib/pill-classes.ts +3 -3
- package/src/lib/position-bar-classes.ts +1 -1
- package/src/lib/spotlight-geometry.ts +67 -67
- package/src/lib/thumb-classes.ts +2 -2
- package/src/lib/tier-badge.ts +16 -16
- package/src/lib/use-is-mobile.ts +17 -14
- package/src/lib/utils.ts +1 -1
- package/src/solid/accordion.tsx +41 -41
- package/src/solid/alert-dialog.tsx +95 -95
- package/src/solid/alert.tsx +88 -88
- package/src/solid/area-picker.tsx +204 -204
- package/src/solid/aspect-ratio.tsx +13 -13
- package/src/solid/avatar.tsx +27 -27
- package/src/solid/badge.tsx +49 -49
- package/src/solid/bottom-sheet/arbitration.ts +22 -22
- package/src/solid/bottom-sheet/bottom-sheet.tsx +394 -394
- package/src/solid/bottom-sheet/drag-controller.ts +201 -201
- package/src/solid/bottom-sheet/focus-trap.ts +51 -47
- package/src/solid/bottom-sheet/index.ts +12 -12
- package/src/solid/bottom-sheet/keyboard.ts +25 -25
- package/src/solid/bottom-sheet/scroll-lock.ts +46 -46
- package/src/solid/bottom-sheet/state-machine.ts +28 -28
- package/src/solid/bottom-sheet/velocity.ts +29 -29
- package/src/solid/breadcrumb.tsx +76 -76
- package/src/solid/button-group.tsx +46 -46
- package/src/solid/button.tsx +19 -19
- package/src/solid/card.tsx +67 -67
- package/src/solid/carousel.tsx +246 -246
- package/src/solid/charts.tsx +253 -253
- package/src/solid/checkbox.tsx +51 -51
- package/src/solid/collapsible.tsx +22 -22
- package/src/solid/color-disc.tsx +213 -213
- package/src/solid/color-slider.tsx +81 -81
- package/src/solid/color-wheel.tsx +61 -61
- package/src/solid/context-menu.tsx +63 -63
- package/src/solid/copy-button.tsx +31 -31
- package/src/solid/count-pill.tsx +11 -11
- package/src/solid/dashboard-preview.tsx +104 -104
- package/src/solid/data-table.tsx +228 -228
- package/src/solid/dialog-parts.tsx +127 -127
- package/src/solid/dialog.tsx +113 -113
- package/src/solid/dock-paging.ts +9 -9
- package/src/solid/dock.tsx +339 -339
- package/src/solid/docked-panel.tsx +35 -35
- package/src/solid/dropdown-menu.tsx +77 -77
- package/src/solid/empty.tsx +70 -70
- package/src/solid/entity-data.ts +38 -38
- package/src/solid/entity-selector.tsx +634 -634
- package/src/solid/field.tsx +205 -205
- package/src/solid/form.tsx +159 -159
- package/src/solid/hero-action.tsx +85 -85
- package/src/solid/hover-card.tsx +11 -11
- package/src/solid/icon-picker.tsx +401 -401
- package/src/solid/icon.tsx +101 -78
- package/src/solid/image-picker.tsx +416 -414
- package/src/solid/index.ts +265 -304
- package/src/solid/input-group.tsx +123 -123
- package/src/solid/input-otp.tsx +143 -143
- package/src/solid/input.tsx +4 -4
- package/src/solid/item.tsx +130 -130
- package/src/solid/kbd.tsx +20 -20
- package/src/solid/label.tsx +12 -12
- package/src/solid/list-reorder.ts +122 -122
- package/src/solid/logo.tsx +60 -60
- package/src/solid/media-copy.ts +21 -21
- package/src/solid/media-store.ts +56 -56
- package/src/solid/media-tile.tsx +85 -85
- package/src/solid/menu-parts.tsx +164 -164
- package/src/solid/number-field.tsx +56 -56
- package/src/solid/option-card.tsx +164 -164
- package/src/solid/ornament.tsx +43 -43
- package/src/solid/overlay.tsx +4 -4
- package/src/solid/page-header.tsx +75 -75
- package/src/solid/pagination.tsx +80 -80
- package/src/solid/password-input.tsx +51 -51
- package/src/solid/picker-row.tsx +83 -83
- package/src/solid/picker-search.tsx +65 -63
- package/src/solid/picker-trigger.tsx +59 -57
- package/src/solid/popover.tsx +54 -54
- package/src/solid/preview-tile.tsx +67 -67
- package/src/solid/progress.tsx +21 -21
- package/src/solid/radio-group.tsx +51 -51
- package/src/solid/resizable.tsx +128 -128
- package/src/solid/responsive-dialog.tsx +134 -134
- package/src/solid/schema-form.tsx +743 -743
- package/src/solid/scope-indicator.tsx +5 -5
- package/src/solid/scroll-area.tsx +16 -16
- package/src/solid/section-card.tsx +281 -281
- package/src/solid/select.tsx +101 -101
- package/src/solid/separator.tsx +25 -25
- package/src/solid/settings-row.tsx +122 -122
- package/src/solid/sheet.tsx +96 -96
- package/src/solid/skeleton.tsx +8 -8
- package/src/solid/slider.tsx +132 -132
- package/src/solid/sliding-indicator.tsx +280 -265
- package/src/solid/sonner.tsx +165 -164
- package/src/solid/spinner.tsx +12 -12
- package/src/solid/spotlight.tsx +140 -140
- package/src/solid/step-indicator.tsx +18 -18
- package/src/solid/swatch-picker.tsx +38 -38
- package/src/solid/switch.tsx +52 -52
- package/src/solid/table.tsx +63 -63
- package/src/solid/tabs.tsx +93 -93
- package/src/solid/textarea.tsx +8 -8
- package/src/solid/toggle-group.tsx +83 -83
- package/src/solid/toggle.tsx +33 -33
- package/src/solid/tooltip.tsx +16 -16
- package/src/solid/widget-card.tsx +90 -90
- package/src/solid/widget-identity.tsx +99 -99
- package/src/solid/widget-trust-badge.tsx +20 -20
- package/src/styles/globals.css +316 -319
- package/src/styles/theme.css +448 -448
- package/src/tokens/hex.ts +29 -29
- package/src/tokens/material.ts +75 -75
- package/src/tokens/presets.ts +303 -303
- package/src/tokens/readability.ts +32 -32
- package/src/tokens/theme-colors.ts +95 -95
- package/src/tokens/theme-css.ts +22 -22
- package/src/tokens/theme-recipe.ts +106 -106
package/src/solid/data-table.tsx
CHANGED
|
@@ -31,7 +31,7 @@ export const TABLE_BLEED = `${BLEED_BY_SECTION_PADDING[SECTION_PADDING]} border-
|
|
|
31
31
|
|
|
32
32
|
export const TABLE_CELL_X = "px-4";
|
|
33
33
|
export const TABLE_ROW_CLASS =
|
|
34
|
-
|
|
34
|
+
"flex items-center gap-4 border-border/50 border-b px-4 py-2.5 transition-colors last:border-b-0 hover:bg-foreground/[0.03]";
|
|
35
35
|
export const TABLE_HEAD_CLASS = "flex items-center gap-4 border-border/50 border-b px-4 py-2";
|
|
36
36
|
/* No vertical cap: a table inside a page that already scrolls got a second
|
|
37
37
|
* scrollbar and hid most of its own rows. A list that genuinely boxes adds its
|
|
@@ -44,79 +44,79 @@ export type SortDirection = "asc" | "desc";
|
|
|
44
44
|
/** Toolbar filter dropdown, built on the Select. Leading filter icon, h-9. Pass
|
|
45
45
|
* `label` to render an option key as display text (include counts there). */
|
|
46
46
|
export function TableFilterSelect(props: {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
options: readonly string[];
|
|
48
|
+
value: string;
|
|
49
|
+
onChange: (value: string) => void;
|
|
50
|
+
label: (value: string) => string;
|
|
51
|
+
ariaLabel: string;
|
|
52
|
+
class?: string;
|
|
53
53
|
}) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
54
|
+
return (
|
|
55
|
+
<Select<string>
|
|
56
|
+
options={[...props.options]}
|
|
57
|
+
value={props.value}
|
|
58
|
+
onChange={(next) => {
|
|
59
|
+
if (next != null) props.onChange(next);
|
|
60
|
+
}}
|
|
61
|
+
itemComponent={(itemProps) => (
|
|
62
|
+
<SelectItem item={itemProps.item}>{props.label(itemProps.item.rawValue)}</SelectItem>
|
|
63
|
+
)}
|
|
64
|
+
>
|
|
65
|
+
<SelectTrigger
|
|
66
|
+
data-slot="table-filter-select"
|
|
67
|
+
class={cn("h-9 w-auto gap-1.5 text-xs", props.class)}
|
|
68
|
+
aria-label={props.ariaLabel}
|
|
69
|
+
>
|
|
70
|
+
<Icon
|
|
71
|
+
icon="lucide:funnel"
|
|
72
|
+
width={14}
|
|
73
|
+
height={14}
|
|
74
|
+
class="text-muted-foreground size-3.5 shrink-0"
|
|
75
|
+
/>
|
|
76
|
+
<SelectValue<string>>{(state) => props.label(state.selectedOption())}</SelectValue>
|
|
77
|
+
</SelectTrigger>
|
|
78
|
+
<SelectContent />
|
|
79
|
+
</Select>
|
|
80
|
+
);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
/** Toolbar search box: leading icon, h-9, trailing clear. Debounce in caller. */
|
|
84
84
|
export function TableSearchInput(props: {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
value: string;
|
|
86
|
+
onInput: (value: string) => void;
|
|
87
|
+
placeholder: string;
|
|
88
|
+
label: string;
|
|
89
|
+
class?: string;
|
|
90
90
|
}) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
91
|
+
return (
|
|
92
|
+
<div data-slot="table-search-input" class={cn("relative w-full sm:w-64", props.class)}>
|
|
93
|
+
<Icon
|
|
94
|
+
icon="lucide:search"
|
|
95
|
+
width={14}
|
|
96
|
+
height={14}
|
|
97
|
+
class="text-muted-foreground pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2"
|
|
98
|
+
/>
|
|
99
|
+
<Input
|
|
100
|
+
placeholder={props.placeholder}
|
|
101
|
+
value={props.value}
|
|
102
|
+
onInput={(e) => props.onInput((e.currentTarget as HTMLInputElement).value)}
|
|
103
|
+
class="h-9 w-full pr-7 pl-7 text-xs"
|
|
104
|
+
aria-label={props.label}
|
|
105
|
+
/>
|
|
106
|
+
<Show when={props.value}>
|
|
107
|
+
<Button
|
|
108
|
+
type="button"
|
|
109
|
+
variant="ghost"
|
|
110
|
+
size="icon"
|
|
111
|
+
onClick={() => props.onInput("")}
|
|
112
|
+
class="text-muted-foreground hover:text-foreground absolute top-1/2 right-1 size-6 -translate-y-1/2 p-1"
|
|
113
|
+
aria-label="Clear search"
|
|
114
|
+
>
|
|
115
|
+
<Icon icon="lucide:x" width={14} height={14} class="size-3.5" />
|
|
116
|
+
</Button>
|
|
117
|
+
</Show>
|
|
118
|
+
</div>
|
|
119
|
+
);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
/**
|
|
@@ -127,52 +127,52 @@ export function TableSearchInput(props: {
|
|
|
127
127
|
* overlay.
|
|
128
128
|
*/
|
|
129
129
|
export function DataTableRow(props: {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
130
|
+
children: JSX.Element;
|
|
131
|
+
/** Activates the whole row. Requires `openLabel`. */
|
|
132
|
+
onOpen?: () => void;
|
|
133
|
+
/** The whole row is a link. Requires `openLabel`. */
|
|
134
|
+
href?: string;
|
|
135
|
+
/** Accessible name for the whole-row activation. */
|
|
136
|
+
openLabel?: string;
|
|
137
|
+
selected?: boolean;
|
|
138
|
+
actions?: JSX.Element;
|
|
139
|
+
class?: string;
|
|
140
140
|
}) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
141
|
+
const opens = () => props.onOpen !== undefined || props.href !== undefined;
|
|
142
|
+
return (
|
|
143
|
+
<div
|
|
144
|
+
data-slot="data-table-row"
|
|
145
|
+
data-state={props.selected ? "selected" : undefined}
|
|
146
|
+
class={cn(
|
|
147
|
+
TABLE_ROW_CLASS,
|
|
148
|
+
// Same selected treatment the semantic TableRow uses, keyed off the
|
|
149
|
+
// same data-state, so the two table families read alike.
|
|
150
|
+
"data-[state=selected]:bg-muted relative",
|
|
151
|
+
opens() && "cursor-pointer",
|
|
152
|
+
props.class,
|
|
153
|
+
)}
|
|
154
|
+
>
|
|
155
|
+
<Show when={props.href}>
|
|
156
|
+
{(href) => (
|
|
157
|
+
<a href={href()} class="absolute inset-0 outline-none">
|
|
158
|
+
<span class="sr-only">{props.openLabel}</span>
|
|
159
|
+
</a>
|
|
160
|
+
)}
|
|
161
|
+
</Show>
|
|
162
|
+
<Show when={props.href === undefined && props.onOpen}>
|
|
163
|
+
<button
|
|
164
|
+
type="button"
|
|
165
|
+
class="absolute inset-0 outline-none"
|
|
166
|
+
aria-label={props.openLabel}
|
|
167
|
+
onClick={() => props.onOpen?.()}
|
|
168
|
+
/>
|
|
169
|
+
</Show>
|
|
170
|
+
{props.children}
|
|
171
|
+
<Show when={props.actions}>
|
|
172
|
+
<div class="relative flex shrink-0 items-center gap-1">{props.actions}</div>
|
|
173
|
+
</Show>
|
|
174
|
+
</div>
|
|
175
|
+
);
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
/**
|
|
@@ -181,94 +181,94 @@ export function DataTableRow(props: {
|
|
|
181
181
|
* background so rows do not read through the glass.
|
|
182
182
|
*/
|
|
183
183
|
export function DataTableHead(props: { children: JSX.Element; sticky?: boolean; class?: string }) {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
184
|
+
return (
|
|
185
|
+
<div
|
|
186
|
+
data-slot="data-table-head"
|
|
187
|
+
class={cn(TABLE_HEAD_CLASS, props.sticky && "bg-background sticky top-0 z-10", props.class)}
|
|
188
|
+
>
|
|
189
|
+
{props.children}
|
|
190
|
+
</div>
|
|
191
|
+
);
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
/** Sortable column header button. `align="end"` for numeric columns. */
|
|
195
195
|
export function TableSortHeader(props: {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
196
|
+
label: string;
|
|
197
|
+
active: boolean;
|
|
198
|
+
dir: SortDirection;
|
|
199
|
+
onClick: () => void;
|
|
200
|
+
align?: "start" | "end";
|
|
201
|
+
class?: string;
|
|
202
202
|
}) {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
203
|
+
return (
|
|
204
|
+
<Button
|
|
205
|
+
type="button"
|
|
206
|
+
variant="ghost"
|
|
207
|
+
size="sm"
|
|
208
|
+
onClick={props.onClick}
|
|
209
|
+
data-slot="table-sort-header"
|
|
210
|
+
class={cn(
|
|
211
|
+
"text-muted-foreground hover:text-foreground h-auto gap-1 px-1.5 py-0.5 text-xs font-medium",
|
|
212
|
+
props.align === "end" && "justify-end",
|
|
213
|
+
props.class,
|
|
214
|
+
)}
|
|
215
|
+
aria-label={`Sort by ${props.label}`}
|
|
216
|
+
>
|
|
217
|
+
{props.label}
|
|
218
|
+
<Show
|
|
219
|
+
when={props.active}
|
|
220
|
+
fallback={
|
|
221
|
+
<Icon icon="lucide:chevrons-up-down" width={12} height={12} class="size-3 opacity-30" />
|
|
222
|
+
}
|
|
223
|
+
>
|
|
224
|
+
<Show
|
|
225
|
+
when={props.dir === "asc"}
|
|
226
|
+
fallback={<Icon icon="lucide:arrow-down" width={12} height={12} class="size-3" />}
|
|
227
|
+
>
|
|
228
|
+
<Icon icon="lucide:arrow-up" width={12} height={12} class="size-3" />
|
|
229
|
+
</Show>
|
|
230
|
+
</Show>
|
|
231
|
+
</Button>
|
|
232
|
+
);
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
/** Centered empty state inside the table body. `icon` takes JSX or an iconify name. */
|
|
236
236
|
export function TableEmpty(props: {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
237
|
+
icon?: JSX.Element | string;
|
|
238
|
+
message: JSX.Element;
|
|
239
|
+
action?: JSX.Element;
|
|
240
240
|
}) {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
241
|
+
return (
|
|
242
|
+
<Empty class="gap-3 rounded-none py-12">
|
|
243
|
+
<EmptyHeader>
|
|
244
|
+
<Show when={props.icon}>
|
|
245
|
+
<EmptyMedia media="icon">
|
|
246
|
+
{typeof props.icon === "string" ? (
|
|
247
|
+
<Icon icon={props.icon} width={24} height={24} />
|
|
248
|
+
) : (
|
|
249
|
+
props.icon
|
|
250
|
+
)}
|
|
251
|
+
</EmptyMedia>
|
|
252
|
+
</Show>
|
|
253
|
+
<EmptyDescription>{props.message}</EmptyDescription>
|
|
254
|
+
</EmptyHeader>
|
|
255
|
+
<Show when={props.action}>
|
|
256
|
+
<EmptyContent>{props.action}</EmptyContent>
|
|
257
|
+
</Show>
|
|
258
|
+
</Empty>
|
|
259
|
+
);
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
/** Inline error state with a Retry button. */
|
|
263
263
|
export function TableError(props: { message: JSX.Element; onRetry: () => void }) {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
264
|
+
return (
|
|
265
|
+
<div data-slot="table-error" class="px-4 py-10 text-center">
|
|
266
|
+
<p class="text-destructive text-sm">{props.message}</p>
|
|
267
|
+
<Button variant="outline" size="sm" class="mt-3" onClick={props.onRetry}>
|
|
268
|
+
Retry
|
|
269
|
+
</Button>
|
|
270
|
+
</div>
|
|
271
|
+
);
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
const SKELETON_TITLE_WIDTHS = ["w-2/5", "w-1/3", "w-1/2", "w-2/5", "w-5/12"] as const;
|
|
@@ -276,49 +276,49 @@ const SKELETON_META_WIDTHS = ["w-1/2", "w-2/5", "w-3/5", "w-1/2", "w-3/5"] as co
|
|
|
276
276
|
|
|
277
277
|
/** Table-shaped loading skeleton: N rows at the shared row height. */
|
|
278
278
|
export function TableSkeleton(props: { count?: number; class?: string }) {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
279
|
+
const n = props.count ?? 5;
|
|
280
|
+
return (
|
|
281
|
+
<div data-slot="table-skeleton" aria-busy="true">
|
|
282
|
+
<For each={Array.from({ length: n })}>
|
|
283
|
+
{(_, i) => (
|
|
284
|
+
<div data-slot="table-skeleton-row" class={cn(TABLE_ROW_CLASS, props.class)}>
|
|
285
|
+
<Skeleton class="h-4 w-4 shrink-0" />
|
|
286
|
+
<div class="flex min-w-0 flex-1 items-start gap-3 sm:items-center">
|
|
287
|
+
<Skeleton class="size-9 shrink-0 rounded-full sm:size-7" />
|
|
288
|
+
<div class="flex min-w-0 flex-1 flex-col gap-1.5">
|
|
289
|
+
<Skeleton
|
|
290
|
+
class={cn("h-3", SKELETON_TITLE_WIDTHS[i() % SKELETON_TITLE_WIDTHS.length])}
|
|
291
|
+
/>
|
|
292
|
+
<Skeleton
|
|
293
|
+
class={cn("h-2.5", SKELETON_META_WIDTHS[i() % SKELETON_META_WIDTHS.length])}
|
|
294
|
+
/>
|
|
295
|
+
<div class="flex gap-1 pt-0.5 sm:hidden">
|
|
296
|
+
<Skeleton class="h-4 w-12 rounded-lg" />
|
|
297
|
+
<Skeleton class="h-4 w-16 rounded-lg" />
|
|
298
|
+
</div>
|
|
299
|
+
</div>
|
|
300
|
+
<Skeleton class="h-3 w-12 shrink-0" />
|
|
301
|
+
</div>
|
|
302
|
+
</div>
|
|
303
|
+
)}
|
|
304
|
+
</For>
|
|
305
|
+
</div>
|
|
306
|
+
);
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
/** Bulk-action bar above the rows when a selection is active. */
|
|
310
310
|
export function TableBulkBar(props: { class?: string; children: JSX.Element }) {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
311
|
+
const [local, rest] = splitProps(props, ["class", "children"]);
|
|
312
|
+
return (
|
|
313
|
+
<div
|
|
314
|
+
data-slot="table-bulk-bar"
|
|
315
|
+
class={cn(
|
|
316
|
+
"border-border/50 bg-foreground/[0.03] flex flex-wrap items-center gap-2 border-b px-4 py-2",
|
|
317
|
+
local.class,
|
|
318
|
+
)}
|
|
319
|
+
{...rest}
|
|
320
|
+
>
|
|
321
|
+
{local.children}
|
|
322
|
+
</div>
|
|
323
|
+
);
|
|
324
324
|
}
|