@widgetic/design-system 0.5.28 → 0.5.30
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/chat/ChatHeader.svelte +29 -3
- package/dist/components/chat/ChatHeader.svelte.d.ts +5 -0
- package/dist/components/chat/Composer.svelte +58 -1
- package/dist/components/chat/Composer.svelte.d.ts +8 -0
- package/dist/components/chat/MessageCheckpointRow.svelte +87 -0
- package/dist/components/chat/MessageCheckpointRow.svelte.d.ts +21 -0
- package/dist/components/chat/MessageRatingActions.svelte +157 -0
- package/dist/components/chat/MessageRatingActions.svelte.d.ts +26 -0
- package/dist/components/chat/SuggestionCard.svelte +13 -1
- package/dist/components/chat/SuggestionCard.svelte.d.ts +5 -0
- package/dist/components/chat/chatHeaderLogic.d.ts +8 -0
- package/dist/components/chat/chatHeaderLogic.js +14 -0
- package/dist/components/chat/composerModelMenuLogic.d.ts +9 -0
- package/dist/components/chat/composerModelMenuLogic.js +12 -0
- package/dist/components/chat/index.d.ts +10 -0
- package/dist/components/chat/index.js +8 -0
- package/dist/components/chat/messageRatingActionsLogic.d.ts +11 -0
- package/dist/components/chat/messageRatingActionsLogic.js +17 -0
- package/dist/components/chat/messageRatingTypes.d.ts +2 -0
- package/dist/components/chat/messageRatingTypes.js +1 -0
- package/dist/components/color-picker/ColorPicker.svelte +324 -0
- package/dist/components/color-picker/ColorPicker.svelte.d.ts +34 -0
- package/dist/components/color-picker/colorPickerLogic.d.ts +77 -0
- package/dist/components/color-picker/colorPickerLogic.js +184 -0
- package/dist/components/color-picker/index.d.ts +2 -0
- package/dist/components/color-picker/index.js +3 -0
- package/dist/components/font-picker/FontPicker.svelte +169 -0
- package/dist/components/font-picker/FontPicker.svelte.d.ts +41 -0
- package/dist/components/font-picker/fontPickerLogic.d.ts +21 -0
- package/dist/components/font-picker/fontPickerLogic.js +29 -0
- package/dist/components/font-picker/index.d.ts +2 -0
- package/dist/components/font-picker/index.js +3 -0
- package/dist/components/index.d.ts +3 -1
- package/dist/components/index.js +3 -1
- package/dist/components/shell/ErrorState.svelte +5 -2
- package/dist/components/shell/ErrorState.svelte.d.ts +2 -1
- package/dist/components/shell/NotificationDetail.svelte +96 -0
- package/dist/components/shell/NotificationDetail.svelte.d.ts +28 -0
- package/dist/components/shell/NotificationRow.svelte +6 -4
- package/dist/components/shell/SettingsDialog.svelte +106 -9
- package/dist/components/shell/SettingsDialog.svelte.d.ts +5 -0
- package/dist/components/shell/SettingsNav.svelte +72 -23
- package/dist/components/shell/SettingsNav.svelte.d.ts +7 -0
- package/dist/components/shell/WidgetRow.svelte +6 -6
- package/dist/components/shell/WidgetRow.svelte.d.ts +2 -2
- package/dist/components/shell/index.d.ts +1 -0
- package/dist/components/shell/index.js +1 -0
- package/dist/components/toast/ToasterModal.svelte +4 -2
- package/dist/components/ui/button/button.svelte +11 -9
- package/dist/components/ui/button/button.svelte.d.ts +2 -2
- package/dist/components/ui/icon-button/icon-button.svelte +7 -6
- package/dist/components/ui/icon-button/icon-button.svelte.d.ts +2 -2
- package/dist/components/ui/scroll-area/scroll-area-scrollbar.svelte +1 -1
- package/dist/components/ui/select/select-item.svelte +18 -7
- package/dist/components/ui/select/select-item.svelte.d.ts +8 -2
- package/dist/components/ui/slider/slider.svelte +16 -1
- package/package.json +1 -1
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
activeId: string;
|
|
11
11
|
groups: import('./settings-nav-types.js').SettingsNavGroup[];
|
|
12
12
|
onSelect?: (id: string) => void;
|
|
13
|
+
/**
|
|
14
|
+
* The menu is not known yet (the workspace is still loading, and with it what the person may open): skeleton rows take
|
|
15
|
+
* its place, so that it does not grow row by row.
|
|
16
|
+
*/
|
|
17
|
+
navPending?: boolean;
|
|
13
18
|
closeLabel?: string;
|
|
14
19
|
children: import('svelte').Snippet;
|
|
15
20
|
descriptionSlot?: import('svelte').Snippet;
|
|
@@ -35,6 +40,7 @@
|
|
|
35
40
|
activeId,
|
|
36
41
|
groups,
|
|
37
42
|
onSelect,
|
|
43
|
+
navPending = false,
|
|
38
44
|
closeLabel = 'Close',
|
|
39
45
|
children,
|
|
40
46
|
descriptionSlot
|
|
@@ -75,6 +81,48 @@
|
|
|
75
81
|
})
|
|
76
82
|
);
|
|
77
83
|
}
|
|
84
|
+
|
|
85
|
+
// The close button is in the corner of the dialog, above whatever the page under the title shows. While that page is scrolled
|
|
86
|
+
// away from the top the button fades out (250 ms, none with reduced motion) and takes neither clicks nor focus (it is inert);
|
|
87
|
+
// at the top it comes back. Escape and a click on the scrim still close the dialog while the button is away.
|
|
88
|
+
// 1px of tolerance: a page at rest at the top can report a fraction of a pixel on a scaled screen.
|
|
89
|
+
const PANE_SCROLLED_AFTER_PX = 1;
|
|
90
|
+
let paneScrolled = $state(false);
|
|
91
|
+
|
|
92
|
+
function handlePaneScroll(event: Event): void {
|
|
93
|
+
paneScrolled = (event.currentTarget as HTMLElement).scrollTop > PANE_SCROLLED_AFTER_PX;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Parent keeps pe-8 (32px). A native bar always sits against the content box, so when the page scrolls we
|
|
97
|
+
// (1) pull the scroll area into that padding and (2) add matching padding-right so the cards stay on the
|
|
98
|
+
// pe-8 line and the bar is centred in the leftover space between the cards and the dialog edge.
|
|
99
|
+
const PANE_RIGHT_PADDING_PX = 32;
|
|
100
|
+
let paneScrollStyle = $state('');
|
|
101
|
+
|
|
102
|
+
function overlayScrollbar(node: HTMLElement) {
|
|
103
|
+
function check() {
|
|
104
|
+
const overflows = node.scrollHeight > node.clientHeight;
|
|
105
|
+
if (!overflows) {
|
|
106
|
+
paneScrollStyle = '';
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
// Read the real bar width (often ~14px in Chromium, 8px when thin styles apply).
|
|
110
|
+
const barWidth = Math.max(node.offsetWidth - node.clientWidth, 8);
|
|
111
|
+
const outerGap = Math.max((PANE_RIGHT_PADDING_PX - barWidth) / 2, 0);
|
|
112
|
+
const pull = PANE_RIGHT_PADDING_PX - outerGap;
|
|
113
|
+
// End side, not the right: the bar sits at the inline end of the page, so a dialog read right to left mirrors it
|
|
114
|
+
// (tests/rtl/sourcePlacement.test.ts fails on a physical side). Left to right, this is margin-right/padding-right.
|
|
115
|
+
paneScrollStyle = `margin-inline-end: -${pull}px; padding-inline-end: ${outerGap}px`;
|
|
116
|
+
}
|
|
117
|
+
const resizeObserver = new ResizeObserver(check);
|
|
118
|
+
resizeObserver.observe(node);
|
|
119
|
+
check();
|
|
120
|
+
return {
|
|
121
|
+
destroy() {
|
|
122
|
+
resizeObserver.disconnect();
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
78
126
|
</script>
|
|
79
127
|
|
|
80
128
|
<Dialog.Root bind:open={() => open, requestOpenChange}>
|
|
@@ -100,10 +148,10 @@
|
|
|
100
148
|
<aside
|
|
101
149
|
class="border-border bg-sidebar flex w-full shrink-0 flex-col border-b p-3 lg:w-64 lg:border-e lg:border-b-0"
|
|
102
150
|
>
|
|
103
|
-
<SettingsNav {groups} {activeId} {onSelect} class="flex-1" />
|
|
151
|
+
<SettingsNav {groups} {activeId} {onSelect} pending={navPending} class="flex-1" />
|
|
104
152
|
</aside>
|
|
105
|
-
<div class="flex min-h-0 min-w-0 flex-1 flex-col gap-6 overflow-
|
|
106
|
-
<header class="flex flex-col gap-1 pe-10">
|
|
153
|
+
<div class="settings-dialog-main-ct flex min-h-0 min-w-0 flex-1 flex-col gap-6 overflow-hidden pe-8 pt-8">
|
|
154
|
+
<header class="settings-dialog-header flex shrink-0 flex-col gap-1 ps-8 pe-10">
|
|
107
155
|
<DialogPrimitive.Title class="text-heading-page text-foreground"
|
|
108
156
|
>{title}</DialogPrimitive.Title
|
|
109
157
|
>
|
|
@@ -123,15 +171,64 @@
|
|
|
123
171
|
</DialogPrimitive.Description>
|
|
124
172
|
{/if}
|
|
125
173
|
</header>
|
|
126
|
-
|
|
174
|
+
<!-- Only the page under the title scrolls. When it overflows, margin+padding centre the bar in the parent's pe-8. -->
|
|
175
|
+
<!--
|
|
176
|
+
A scroll box clips what is drawn outside its edge, and a focus ring is drawn outside its field: the first field of a page,
|
|
177
|
+
flush with the top, lost the top of its ring. The box therefore has a gutter of 6px (the 2px ring and its 2px offset, with
|
|
178
|
+
room to spare, as BaseModal's) at the top and at the end, taken back by the same negative margin so the page stays
|
|
179
|
+
where it was. (The start already has ps-8, the bottom pb-8, and an overflowing box sets the end itself, below.)
|
|
180
|
+
-->
|
|
181
|
+
<div
|
|
182
|
+
class="settings-dialog-pane-scroll -mt-1.5 -me-1.5 flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto overflow-x-hidden ps-8 pt-1.5 pe-1.5 pb-8"
|
|
183
|
+
use:overlayScrollbar
|
|
184
|
+
style={paneScrollStyle}
|
|
185
|
+
onscroll={handlePaneScroll}
|
|
186
|
+
>
|
|
187
|
+
{@render children()}
|
|
188
|
+
</div>
|
|
127
189
|
</div>
|
|
128
190
|
</div>
|
|
129
|
-
|
|
130
|
-
|
|
191
|
+
<!-- The fade is on a box around the button, so that the button keeps its own quick hover; `inert` takes it out of the
|
|
192
|
+
tab order and of what a screen reader reads while it is hidden. -->
|
|
193
|
+
<div
|
|
194
|
+
class={cn(
|
|
195
|
+
'duration-slow absolute end-2 top-2 transition-opacity motion-reduce:transition-none',
|
|
196
|
+
paneScrolled && 'pointer-events-none opacity-0'
|
|
197
|
+
)}
|
|
198
|
+
inert={paneScrolled || undefined}
|
|
199
|
+
data-settings-dialog-close-box
|
|
200
|
+
data-scrolled={paneScrolled || undefined}
|
|
131
201
|
>
|
|
132
|
-
<
|
|
133
|
-
|
|
134
|
-
|
|
202
|
+
<DialogPrimitive.Close
|
|
203
|
+
class="text-foreground hover:bg-accent duration-fast focus-visible:ring-ring focus-visible:ring-offset-background inline-flex size-8 items-center justify-center rounded-lg transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden"
|
|
204
|
+
>
|
|
205
|
+
<IconX class="size-4 stroke-2" aria-hidden="true" />
|
|
206
|
+
<span class="sr-only">{closeLabel}</span>
|
|
207
|
+
</DialogPrimitive.Close>
|
|
208
|
+
</div>
|
|
135
209
|
</DialogPrimitive.Content>
|
|
136
210
|
</Dialog.Portal>
|
|
137
211
|
</Dialog.Root>
|
|
212
|
+
|
|
213
|
+
<style>
|
|
214
|
+
/* Transparent track; thumb overlays the parent's right padding via the conditional negative margin above. */
|
|
215
|
+
.settings-dialog-pane-scroll {
|
|
216
|
+
scrollbar-width: thin;
|
|
217
|
+
scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
|
|
218
|
+
}
|
|
219
|
+
.settings-dialog-pane-scroll::-webkit-scrollbar {
|
|
220
|
+
width: 8px;
|
|
221
|
+
height: 8px;
|
|
222
|
+
background: transparent;
|
|
223
|
+
}
|
|
224
|
+
.settings-dialog-pane-scroll::-webkit-scrollbar-track {
|
|
225
|
+
background: transparent;
|
|
226
|
+
}
|
|
227
|
+
.settings-dialog-pane-scroll::-webkit-scrollbar-thumb {
|
|
228
|
+
background: rgba(0, 0, 0, 0.2);
|
|
229
|
+
border-radius: 4px;
|
|
230
|
+
}
|
|
231
|
+
.settings-dialog-pane-scroll::-webkit-scrollbar-thumb:hover {
|
|
232
|
+
background: rgba(0, 0, 0, 0.35);
|
|
233
|
+
}
|
|
234
|
+
</style>
|
|
@@ -6,6 +6,11 @@ export type SettingsDialogProps = {
|
|
|
6
6
|
activeId: string;
|
|
7
7
|
groups: import('./settings-nav-types.js').SettingsNavGroup[];
|
|
8
8
|
onSelect?: (id: string) => void;
|
|
9
|
+
/**
|
|
10
|
+
* The menu is not known yet (the workspace is still loading, and with it what the person may open): skeleton rows take
|
|
11
|
+
* its place, so that it does not grow row by row.
|
|
12
|
+
*/
|
|
13
|
+
navPending?: boolean;
|
|
9
14
|
closeLabel?: string;
|
|
10
15
|
children: import('svelte').Snippet;
|
|
11
16
|
descriptionSlot?: import('svelte').Snippet;
|
|
@@ -10,37 +10,86 @@
|
|
|
10
10
|
groups: SettingsNavGroup[];
|
|
11
11
|
activeId: string;
|
|
12
12
|
onSelect?: (id: string) => void;
|
|
13
|
+
/**
|
|
14
|
+
* The menu is not known yet (the workspace the person is in is still loading, and with it what they may open): it is
|
|
15
|
+
* drawn as skeleton rows of the same size as the real ones, so that it does not grow row by row when it is known.
|
|
16
|
+
*/
|
|
17
|
+
pending?: boolean;
|
|
18
|
+
/** What a screen reader says for the menu while it is pending. */
|
|
19
|
+
pendingLabel?: string;
|
|
13
20
|
};
|
|
14
21
|
</script>
|
|
15
22
|
|
|
16
23
|
<script lang="ts">
|
|
17
24
|
import { cn } from '../../utils.js';
|
|
25
|
+
import Skeleton from '../ui/skeleton/skeleton.svelte';
|
|
18
26
|
import NavRow from './NavRow.svelte';
|
|
19
27
|
import NavSectionLabel from './NavSectionLabel.svelte';
|
|
20
28
|
import { settingsNavItemIsActive } from './settings-nav-types.js';
|
|
21
29
|
|
|
22
|
-
let {
|
|
30
|
+
let {
|
|
31
|
+
class: className,
|
|
32
|
+
groups,
|
|
33
|
+
activeId,
|
|
34
|
+
onSelect,
|
|
35
|
+
pending = false,
|
|
36
|
+
pendingLabel = 'Loading settings',
|
|
37
|
+
...restProps
|
|
38
|
+
}: SettingsNavProps = $props();
|
|
39
|
+
|
|
40
|
+
// The shape of the menu while it loads: a Workspace group of five rows and an Account group of two (what an owner sees
|
|
41
|
+
// at the least). Each row is a 16px icon and a label of its own width, on the 32px row of the real menu (Nav Row).
|
|
42
|
+
const pendingGroups: { id: string; labelWidth: string; labelWidths: string[] }[] = [
|
|
43
|
+
{ id: 'workspace', labelWidth: 'w-16', labelWidths: ['w-24', 'w-28', 'w-20', 'w-24', 'w-16'] },
|
|
44
|
+
{ id: 'account', labelWidth: 'w-14', labelWidths: ['w-20', 'w-28'] }
|
|
45
|
+
];
|
|
23
46
|
</script>
|
|
24
47
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
</
|
|
48
|
+
{#if pending}
|
|
49
|
+
<!-- Figma: Settings Nav, Loading (Skeleton rows on the Nav Row grid) -->
|
|
50
|
+
<nav
|
|
51
|
+
class={cn('flex w-full flex-col gap-0.5', className)}
|
|
52
|
+
aria-label="Settings"
|
|
53
|
+
aria-busy="true"
|
|
54
|
+
data-settings-nav-pending
|
|
55
|
+
{...restProps}
|
|
56
|
+
>
|
|
57
|
+
<span class="sr-only" role="status">{pendingLabel}</span>
|
|
58
|
+
{#each pendingGroups as group (group.id)}
|
|
59
|
+
<div class="flex flex-col gap-0.5" aria-hidden="true">
|
|
60
|
+
<div class="flex h-8 w-full min-w-0 items-center py-1 ps-3 pe-2 pb-1">
|
|
61
|
+
<Skeleton class={cn('h-3', group.labelWidth)} pulse="low" />
|
|
62
|
+
</div>
|
|
63
|
+
{#each group.labelWidths as labelWidth, rowIndex (rowIndex)}
|
|
64
|
+
<div class="flex h-8 w-full min-w-0 items-center gap-2 py-1.5 ps-2 pe-2">
|
|
65
|
+
<Skeleton class="size-4 shrink-0" />
|
|
66
|
+
<Skeleton class={cn('h-3', labelWidth)} />
|
|
67
|
+
</div>
|
|
68
|
+
{/each}
|
|
69
|
+
</div>
|
|
70
|
+
{/each}
|
|
71
|
+
</nav>
|
|
72
|
+
{:else}
|
|
73
|
+
<nav class={cn('flex w-full flex-col gap-0.5', className)} aria-label="Settings" {...restProps}>
|
|
74
|
+
{#each groups as group (group.id)}
|
|
75
|
+
<div class="flex flex-col gap-0.5">
|
|
76
|
+
<NavSectionLabel label={group.label} />
|
|
77
|
+
{#each group.items as item (item.id)}
|
|
78
|
+
{@const active = settingsNavItemIsActive(activeId, item.id)}
|
|
79
|
+
<NavRow
|
|
80
|
+
label={item.label}
|
|
81
|
+
{active}
|
|
82
|
+
showIcon={Boolean(item.icon)}
|
|
83
|
+
onclick={() => onSelect?.(item.id)}
|
|
84
|
+
>
|
|
85
|
+
{#snippet icon()}
|
|
86
|
+
{#if item.icon}
|
|
87
|
+
{@render item.icon()}
|
|
88
|
+
{/if}
|
|
89
|
+
{/snippet}
|
|
90
|
+
</NavRow>
|
|
91
|
+
{/each}
|
|
92
|
+
</div>
|
|
93
|
+
{/each}
|
|
94
|
+
</nav>
|
|
95
|
+
{/if}
|
|
@@ -5,6 +5,13 @@ export type SettingsNavProps = HTMLAttributes<HTMLElement> & {
|
|
|
5
5
|
groups: SettingsNavGroup[];
|
|
6
6
|
activeId: string;
|
|
7
7
|
onSelect?: (id: string) => void;
|
|
8
|
+
/**
|
|
9
|
+
* The menu is not known yet (the workspace the person is in is still loading, and with it what they may open): it is
|
|
10
|
+
* drawn as skeleton rows of the same size as the real ones, so that it does not grow row by row when it is known.
|
|
11
|
+
*/
|
|
12
|
+
pending?: boolean;
|
|
13
|
+
/** What a screen reader says for the menu while it is pending. */
|
|
14
|
+
pendingLabel?: string;
|
|
8
15
|
};
|
|
9
16
|
declare const SettingsNav: import("svelte").Component<SettingsNavProps, {}, "">;
|
|
10
17
|
type SettingsNav = ReturnType<typeof SettingsNav>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<!-- Figma: Widget Row (component set 54:5, node 54:5). -->
|
|
1
|
+
<!-- Figma: Widget Row (component set 54:5, node 54:5). The row fills its container (1120px on the desktop dashboard, 720px on tablet, 374px on phones): the page sets the width, the row sets no maximum. -->
|
|
2
2
|
<script lang="ts" module>
|
|
3
3
|
import type { VariantProps } from 'tailwind-variants';
|
|
4
4
|
|
|
5
5
|
export const widgetRowVariants = tv({
|
|
6
|
-
base: 'group/widget-row flex
|
|
6
|
+
base: 'group/widget-row flex h-16 max-h-16 w-full shrink-0 items-center gap-4 overflow-hidden rounded-xl py-3 ps-4 pe-4 transition-colors duration-fast focus-within:outline-hidden',
|
|
7
7
|
variants: {
|
|
8
8
|
selected: {
|
|
9
9
|
true: 'bg-brand-subtle ring-2 ring-brand',
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
{#if isLoading}
|
|
68
68
|
<div
|
|
69
69
|
class={cn(
|
|
70
|
-
'
|
|
70
|
+
'flex h-16 max-h-16 w-full shrink-0 items-center gap-4 overflow-hidden rounded-xl py-3 ps-4 pe-4',
|
|
71
71
|
className
|
|
72
72
|
)}
|
|
73
73
|
role="status"
|
|
@@ -101,10 +101,10 @@
|
|
|
101
101
|
{/if}
|
|
102
102
|
</div>
|
|
103
103
|
|
|
104
|
-
<div class="min-w-0 flex-1 flex-col gap-0 overflow-hidden">
|
|
105
|
-
<span class="text-body-medium text-foreground block truncate">{title}</span>
|
|
104
|
+
<div class="flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-0 overflow-hidden">
|
|
105
|
+
<span class="text-body-medium text-foreground block h-5 truncate leading-5">{title}</span>
|
|
106
106
|
{#if meta}
|
|
107
|
-
<span class="text-caption text-muted-foreground block truncate">{meta}</span>
|
|
107
|
+
<span class="text-caption text-muted-foreground block h-4 truncate leading-4">{meta}</span>
|
|
108
108
|
{/if}
|
|
109
109
|
</div>
|
|
110
110
|
|
|
@@ -7,7 +7,7 @@ export declare const widgetRowVariants: import("tailwind-variants").TVReturnType
|
|
|
7
7
|
true: string;
|
|
8
8
|
false: string;
|
|
9
9
|
};
|
|
10
|
-
}, undefined, "group/widget-row flex
|
|
10
|
+
}, undefined, "group/widget-row flex h-16 max-h-16 w-full shrink-0 items-center gap-4 overflow-hidden rounded-xl py-3 ps-4 pe-4 transition-colors duration-fast focus-within:outline-hidden", {
|
|
11
11
|
responsiveVariants?: boolean | (string | number | symbol)[] | {
|
|
12
12
|
selected?: boolean | (string | number | symbol)[] | undefined;
|
|
13
13
|
loading?: boolean | (string | number | symbol)[] | undefined;
|
|
@@ -38,7 +38,7 @@ export declare const widgetRowVariants: import("tailwind-variants").TVReturnType
|
|
|
38
38
|
true: string;
|
|
39
39
|
false: string;
|
|
40
40
|
};
|
|
41
|
-
}, undefined, "group/widget-row flex
|
|
41
|
+
}, undefined, "group/widget-row flex h-16 max-h-16 w-full shrink-0 items-center gap-4 overflow-hidden rounded-xl py-3 ps-4 pe-4 transition-colors duration-fast focus-within:outline-hidden", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
42
42
|
selected: {
|
|
43
43
|
true: string;
|
|
44
44
|
false: string;
|
|
@@ -11,6 +11,7 @@ export { default as AppShell } from './AppShell.svelte';
|
|
|
11
11
|
export { default as ErrorState } from './ErrorState.svelte';
|
|
12
12
|
export { defaultErrorStateMessages, type ErrorStateMessages } from './error-state-messages.js';
|
|
13
13
|
export { default as NotificationRow, type NotificationRowProps } from './NotificationRow.svelte';
|
|
14
|
+
export { default as NotificationDetail, type NotificationDetailProps } from './NotificationDetail.svelte';
|
|
14
15
|
export { default as SettingsNav, type SettingsNavProps } from './SettingsNav.svelte';
|
|
15
16
|
export { default as SettingsDialog, type SettingsDialogProps } from './SettingsDialog.svelte';
|
|
16
17
|
export { default as Stat, type StatProps, statVariants } from './Stat.svelte';
|
|
@@ -14,6 +14,7 @@ export { default as ErrorState } from './ErrorState.svelte';
|
|
|
14
14
|
export { defaultErrorStateMessages } from './error-state-messages.js';
|
|
15
15
|
// [S2 exports]
|
|
16
16
|
export { default as NotificationRow } from './NotificationRow.svelte';
|
|
17
|
+
export { default as NotificationDetail } from './NotificationDetail.svelte';
|
|
17
18
|
export { default as SettingsNav } from './SettingsNav.svelte';
|
|
18
19
|
export { default as SettingsDialog } from './SettingsDialog.svelte';
|
|
19
20
|
export { default as Stat, statVariants } from './Stat.svelte';
|
|
@@ -90,15 +90,17 @@
|
|
|
90
90
|
classes: {
|
|
91
91
|
toast:
|
|
92
92
|
toastMainClass +
|
|
93
|
-
' !fixed !bottom-5 !end-5 !flex !min-w-[20rem] !max-w-[22.25rem] !items-start !gap-3 !rounded-xl !border !border-border !bg-popover !p-4 !text-popover-foreground !shadow-none [&>[data-icon]]:!mt-0.5 [&>[data-icon]]:!size-4 [&>[data-icon]_svg]:!size-4 [&>[data-icon]_svg]:!stroke-2',
|
|
93
|
+
' !fixed !bottom-5 !end-5 !flex !min-w-[20rem] !max-w-[22.25rem] !items-start !gap-3 !rounded-xl !border !border-border !bg-popover !p-4 !pe-10 !text-popover-foreground !shadow-none [&>[data-icon]]:!mt-0.5 [&>[data-icon]]:!size-4 [&>[data-icon]_svg]:!size-4 [&>[data-icon]_svg]:!stroke-2',
|
|
94
94
|
title: toastMainClass + '-title text-body-medium text-foreground',
|
|
95
95
|
description: toastMainClass + '-description text-body text-muted-foreground',
|
|
96
96
|
actionButton:
|
|
97
97
|
'!h-8 !rounded-lg !border !border-input !bg-background !px-2 !text-label !text-foreground hover:!bg-accent',
|
|
98
98
|
cancelButton: '',
|
|
99
|
+
// The same X as the one of the settings dialog: a plain X, no background, inside the toast at its end and top
|
|
100
|
+
// (16px, 2 stroke; its 32px target tints on hover and on the keyboard focus, as the dialog's does).
|
|
99
101
|
closeButton:
|
|
100
102
|
toastMainClass +
|
|
101
|
-
'-close-button !absolute
|
|
103
|
+
'-close-button !absolute !end-2 !top-2 !flex !size-8 !items-center !justify-center !rounded-lg !border-0 !bg-transparent !p-0 !text-foreground !transition-colors hover:!bg-accent focus-visible:!bg-accent focus-visible:!outline-hidden [&_svg]:!size-4 [&_svg]:!stroke-2',
|
|
102
104
|
// The icon takes the colour of its tone, the Icon modes of Figma: Muted for info (Default), Brand, Warning and Destructive.
|
|
103
105
|
info: '[&>[data-icon]]:!text-muted-foreground',
|
|
104
106
|
success: '[&>[data-icon]]:!text-brand',
|
|
@@ -13,21 +13,23 @@
|
|
|
13
13
|
import type { VariantProps } from "tailwind-variants";
|
|
14
14
|
|
|
15
15
|
export const buttonVariants = tv({
|
|
16
|
-
base: "inline-flex cursor-pointer items-center justify-center gap-1 whitespace-nowrap rounded-lg text-label press-feedback focus-visible:outline-hidden
|
|
16
|
+
base: "inline-flex cursor-pointer items-center justify-center gap-1 whitespace-nowrap rounded-lg text-label press-feedback focus-visible:outline-hidden disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-2",
|
|
17
17
|
variants: {
|
|
18
18
|
variant: {
|
|
19
|
-
|
|
19
|
+
// A button draws no ring when it holds the focus (a ring is drawn outside the button, and the edge of a scroll box
|
|
20
|
+
// or a card cut it off): the keyboard focus takes the look of the hover, inside the button.
|
|
21
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90 focus-visible:bg-primary/90",
|
|
20
22
|
destructive:
|
|
21
|
-
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
23
|
+
"bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:bg-destructive/90",
|
|
22
24
|
outline:
|
|
23
|
-
"border border-input bg-background text-foreground hover:bg-accent hover:text-foreground",
|
|
25
|
+
"border border-input bg-background text-foreground hover:bg-accent hover:text-foreground focus-visible:bg-accent focus-visible:text-foreground",
|
|
24
26
|
secondary:
|
|
25
|
-
"bg-secondary text-secondary-foreground hover:bg-accent hover:text-foreground",
|
|
26
|
-
ghost: "text-foreground hover:bg-accent hover:text-foreground",
|
|
27
|
-
accent: "bg-brand text-brand-foreground hover:bg-brand/90",
|
|
27
|
+
"bg-secondary text-secondary-foreground hover:bg-accent hover:text-foreground focus-visible:bg-accent focus-visible:text-foreground",
|
|
28
|
+
ghost: "text-foreground hover:bg-accent hover:text-foreground focus-visible:bg-accent focus-visible:text-foreground",
|
|
29
|
+
accent: "bg-brand text-brand-foreground hover:bg-brand/90 focus-visible:bg-brand/90",
|
|
28
30
|
stroke:
|
|
29
|
-
"border border-border-strong/30 bg-transparent text-foreground hover:bg-accent hover:text-foreground",
|
|
30
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
31
|
+
"border border-border-strong/30 bg-transparent text-foreground hover:bg-accent hover:text-foreground focus-visible:bg-accent focus-visible:text-foreground",
|
|
32
|
+
link: "text-primary underline-offset-4 hover:underline focus-visible:underline",
|
|
31
33
|
},
|
|
32
34
|
size: {
|
|
33
35
|
// The 12 of the side (small: 8) and the 4 of the label box (see the note at the top), as Figma
|
|
@@ -23,7 +23,7 @@ export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
|
23
23
|
true: string;
|
|
24
24
|
false: string;
|
|
25
25
|
};
|
|
26
|
-
}, undefined, "inline-flex cursor-pointer items-center justify-center gap-1 whitespace-nowrap rounded-lg text-label press-feedback focus-visible:outline-hidden
|
|
26
|
+
}, undefined, "inline-flex cursor-pointer items-center justify-center gap-1 whitespace-nowrap rounded-lg text-label press-feedback focus-visible:outline-hidden disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-2", {
|
|
27
27
|
responsiveVariants?: boolean | (string | number | symbol)[] | {
|
|
28
28
|
size?: boolean | (string | number | symbol)[] | undefined;
|
|
29
29
|
iconPadding?: boolean | (string | number | symbol)[] | undefined;
|
|
@@ -81,7 +81,7 @@ export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
|
81
81
|
true: string;
|
|
82
82
|
false: string;
|
|
83
83
|
};
|
|
84
|
-
}, undefined, "inline-flex cursor-pointer items-center justify-center gap-1 whitespace-nowrap rounded-lg text-label press-feedback focus-visible:outline-hidden
|
|
84
|
+
}, undefined, "inline-flex cursor-pointer items-center justify-center gap-1 whitespace-nowrap rounded-lg text-label press-feedback focus-visible:outline-hidden disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-2", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
85
85
|
variant: {
|
|
86
86
|
default: string;
|
|
87
87
|
destructive: string;
|
|
@@ -8,19 +8,20 @@
|
|
|
8
8
|
import type { VariantProps } from "tailwind-variants";
|
|
9
9
|
|
|
10
10
|
export const iconButtonVariants = tv({
|
|
11
|
-
base: "inline-flex shrink-0 cursor-pointer items-center justify-center press-feedback focus-visible:outline-hidden
|
|
11
|
+
base: "inline-flex shrink-0 cursor-pointer items-center justify-center press-feedback focus-visible:outline-hidden disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-2",
|
|
12
12
|
variants: {
|
|
13
13
|
variant: {
|
|
14
|
+
// No ring when it holds the focus (see Button): the keyboard focus takes the look of the hover.
|
|
14
15
|
ghost:
|
|
15
|
-
"rounded-lg text-foreground hover:bg-accent hover:text-foreground",
|
|
16
|
+
"rounded-lg text-foreground hover:bg-accent hover:text-foreground focus-visible:bg-accent focus-visible:text-foreground",
|
|
16
17
|
secondary:
|
|
17
|
-
"rounded-lg bg-secondary text-secondary-foreground hover:bg-accent hover:text-foreground",
|
|
18
|
+
"rounded-lg bg-secondary text-secondary-foreground hover:bg-accent hover:text-foreground focus-visible:bg-accent focus-visible:text-foreground",
|
|
18
19
|
outline:
|
|
19
|
-
"rounded-lg border border-input bg-background text-foreground hover:bg-accent hover:text-foreground",
|
|
20
|
+
"rounded-lg border border-input bg-background text-foreground hover:bg-accent hover:text-foreground focus-visible:bg-accent focus-visible:text-foreground",
|
|
20
21
|
primary:
|
|
21
|
-
"rounded-full bg-primary text-primary-foreground hover:bg-primary/90",
|
|
22
|
+
"rounded-full bg-primary text-primary-foreground hover:bg-primary/90 focus-visible:bg-primary/90",
|
|
22
23
|
accent:
|
|
23
|
-
"rounded-full bg-brand text-brand-foreground hover:bg-brand/90",
|
|
24
|
+
"rounded-full bg-brand text-brand-foreground hover:bg-brand/90 focus-visible:bg-brand/90",
|
|
24
25
|
},
|
|
25
26
|
size: {
|
|
26
27
|
default: "size-8",
|
|
@@ -13,7 +13,7 @@ export declare const iconButtonVariants: import("tailwind-variants").TVReturnTyp
|
|
|
13
13
|
default: string;
|
|
14
14
|
sm: string;
|
|
15
15
|
};
|
|
16
|
-
}, undefined, "inline-flex shrink-0 cursor-pointer items-center justify-center press-feedback focus-visible:outline-hidden
|
|
16
|
+
}, undefined, "inline-flex shrink-0 cursor-pointer items-center justify-center press-feedback focus-visible:outline-hidden disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-2", {
|
|
17
17
|
responsiveVariants?: boolean | (string | number | symbol)[] | {
|
|
18
18
|
size?: boolean | (string | number | symbol)[] | undefined;
|
|
19
19
|
variant?: boolean | (string | number | symbol)[] | undefined;
|
|
@@ -50,7 +50,7 @@ export declare const iconButtonVariants: import("tailwind-variants").TVReturnTyp
|
|
|
50
50
|
default: string;
|
|
51
51
|
sm: string;
|
|
52
52
|
};
|
|
53
|
-
}, undefined, "inline-flex shrink-0 cursor-pointer items-center justify-center press-feedback focus-visible:outline-hidden
|
|
53
|
+
}, undefined, "inline-flex shrink-0 cursor-pointer items-center justify-center press-feedback focus-visible:outline-hidden disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:stroke-2", import("tailwind-variants/dist/config.js").TVConfig<{
|
|
54
54
|
variant: {
|
|
55
55
|
ghost: string;
|
|
56
56
|
secondary: string;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
bind:ref
|
|
20
20
|
{orientation}
|
|
21
21
|
class={cn(
|
|
22
|
-
"flex touch-none select-none transition-colors",
|
|
22
|
+
"z-10 flex touch-none select-none transition-colors",
|
|
23
23
|
orientation === "vertical" && "h-full w-2.5 border-s border-s-transparent p-px",
|
|
24
24
|
orientation === "horizontal" && "h-2.5 w-full border-t border-t-transparent p-px",
|
|
25
25
|
className
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
<!-- Figma: Select Option (component set 170:135, node 170:135). -->
|
|
2
2
|
<script lang="ts" module>
|
|
3
3
|
import { Select as SelectPrimitive, type WithoutChild } from "bits-ui";
|
|
4
|
-
export type SelectItemProps = WithoutChild<SelectPrimitive.ItemProps
|
|
4
|
+
export type SelectItemProps = WithoutChild<SelectPrimitive.ItemProps> & {
|
|
5
|
+
/**
|
|
6
|
+
* The check at the start of the chosen row (default: shown). Turn it off when the row draws its own leading mark and says
|
|
7
|
+
* "Selected" in words (Figma: Billing, "Paid with": a card icon on every row, "Selected" at the end of the chosen one).
|
|
8
|
+
*/
|
|
9
|
+
showIndicator?: boolean;
|
|
10
|
+
};
|
|
5
11
|
</script>
|
|
6
12
|
|
|
7
13
|
<script lang="ts">
|
|
@@ -13,6 +19,7 @@
|
|
|
13
19
|
class: className,
|
|
14
20
|
value,
|
|
15
21
|
label,
|
|
22
|
+
showIndicator = true,
|
|
16
23
|
children: childrenProp,
|
|
17
24
|
...restProps
|
|
18
25
|
}: SelectItemProps = $props();
|
|
@@ -29,17 +36,21 @@
|
|
|
29
36
|
bind:ref
|
|
30
37
|
{value}
|
|
31
38
|
class={cn(
|
|
32
|
-
"relative flex h-8 w-full cursor-pointer select-none items-center gap-2 rounded-lg px-2 py-1.5
|
|
39
|
+
"relative flex h-8 w-full cursor-pointer select-none items-center gap-2 rounded-lg px-2 py-1.5 text-body outline-hidden data-[selected]:bg-brand-subtle hover:not-data-[selected]:bg-accent [[data-input-modality=keyboard]_&]:not-data-[selected]:data-[highlighted]:bg-accent [[data-input-modality=keyboard]_&]:not-data-[selected]:not-data-[highlighted]:hover:bg-transparent data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
|
|
40
|
+
// The start padding leaves room for the check; a row without one keeps the plain padding for its own leading mark.
|
|
41
|
+
showIndicator && "ps-8",
|
|
33
42
|
className
|
|
34
43
|
)}
|
|
35
44
|
{...restProps}
|
|
36
45
|
>
|
|
37
46
|
{#snippet children({ selected, highlighted })}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
47
|
+
{#if showIndicator}
|
|
48
|
+
<span class="absolute start-2 flex size-3.5 items-center justify-center">
|
|
49
|
+
{#if selected}
|
|
50
|
+
<IconCheck class="size-4 stroke-2" aria-hidden="true" />
|
|
51
|
+
{/if}
|
|
52
|
+
</span>
|
|
53
|
+
{/if}
|
|
43
54
|
{#if childrenProp}
|
|
44
55
|
{@render childrenProp({ selected, highlighted })}
|
|
45
56
|
{:else}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { Select as SelectPrimitive, type WithoutChild } from "bits-ui";
|
|
2
|
-
export type SelectItemProps = WithoutChild<SelectPrimitive.ItemProps
|
|
3
|
-
|
|
2
|
+
export type SelectItemProps = WithoutChild<SelectPrimitive.ItemProps> & {
|
|
3
|
+
/**
|
|
4
|
+
* The check at the start of the chosen row (default: shown). Turn it off when the row draws its own leading mark and says
|
|
5
|
+
* "Selected" in words (Figma: Billing, "Paid with": a card icon on every row, "Selected" at the end of the chosen one).
|
|
6
|
+
*/
|
|
7
|
+
showIndicator?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const SelectItem: import("svelte").Component<SelectItemProps, {}, "ref">;
|
|
4
10
|
type SelectItem = ReturnType<typeof SelectItem>;
|
|
5
11
|
export default SelectItem;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
<!--
|
|
1
|
+
<!--
|
|
2
|
+
Figma: IC Slider (Editor); track input, range primary, 4px track / 16px thumb.
|
|
3
|
+
|
|
4
|
+
`aria-label` and `aria-labelledby` name the thumb, which is the element a screen reader lands on (the root is a plain span with
|
|
5
|
+
no role, so a name on it is never spoken). With two thumbs (a range) each one gets the name and its place: "Price 1", "Price 2".
|
|
6
|
+
-->
|
|
2
7
|
<script lang="ts" module>
|
|
3
8
|
import { Slider as SliderPrimitive, type WithoutChildrenOrChild } from "bits-ui";
|
|
4
9
|
export type SliderProps = WithoutChildrenOrChild<SliderPrimitive.RootProps>;
|
|
@@ -14,8 +19,16 @@
|
|
|
14
19
|
ref = $bindable(null),
|
|
15
20
|
value = $bindable(),
|
|
16
21
|
class: className,
|
|
22
|
+
"aria-label": ariaLabel,
|
|
23
|
+
"aria-labelledby": ariaLabelledby,
|
|
17
24
|
...restProps
|
|
18
25
|
}: SliderProps = $props();
|
|
26
|
+
|
|
27
|
+
/** The name of one thumb: the label as given for a single thumb, numbered for a range. */
|
|
28
|
+
function thumbLabel(thumb: number, thumbCount: number): string | undefined {
|
|
29
|
+
if (!ariaLabel) return undefined;
|
|
30
|
+
return thumbCount > 1 ? `${ariaLabel} ${thumb + 1}` : ariaLabel;
|
|
31
|
+
}
|
|
19
32
|
</script>
|
|
20
33
|
|
|
21
34
|
<SliderPrimitive.Root
|
|
@@ -32,6 +45,8 @@
|
|
|
32
45
|
{#each thumbs as thumb}
|
|
33
46
|
<SliderPrimitive.Thumb
|
|
34
47
|
index={thumb}
|
|
48
|
+
aria-label={thumbLabel(thumb, thumbs.length)}
|
|
49
|
+
aria-labelledby={ariaLabelledby}
|
|
35
50
|
class="relative z-20 block size-4 rounded-full border-2 border-primary bg-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50"
|
|
36
51
|
/>
|
|
37
52
|
{/each}
|