@widgetic/design-system 0.5.29 → 0.5.31
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/OptionRow.svelte +1 -1
- package/dist/components/chat/SuggestionCard.svelte +13 -1
- package/dist/components/chat/SuggestionCard.svelte.d.ts +5 -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/modals/BaseModal.svelte +6 -6
- 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 +22 -8
- 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/index.d.ts +1 -0
- package/dist/components/shell/index.js +1 -0
- package/dist/components/toast/ToasterModal.svelte +19 -29
- package/dist/components/ui/button/button.svelte +11 -9
- package/dist/components/ui/button/button.svelte.d.ts +2 -2
- package/dist/components/ui/command/command-item.svelte +1 -1
- package/dist/components/ui/command/command-link-item.svelte +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-item.svelte +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +1 -1
- 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/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 +31 -5
- package/dist/components/ui/tabs/tabs-trigger.svelte +1 -1
- package/dist/components/ui/toggle/toggle.svelte +1 -1
- package/dist/components/ui/toggle/toggle.svelte.d.ts +2 -2
- package/dist/styles/fonts.css +4 -33
- package/dist/styles/global.css +114 -20
- package/dist/styles/tokens.css +6 -10
- package/dist/utils/overlayMotion.d.ts +11 -1
- package/dist/utils/overlayMotion.js +16 -8
- package/dist/utils/toastMotion.d.ts +12 -0
- package/dist/utils/toastMotion.js +12 -0
- package/package.json +2 -2
- package/tailwind.config.ts +4 -11
- package/dist/fonts/Cousine/Cousine-Bold.woff2 +0 -0
- package/dist/fonts/Cousine/Cousine-Regular.woff2 +0 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Figma: Font Picker (component set 190:1825, page Font Picker) with Font Row (189:1175) and Search Field (189:1138);
|
|
3
|
+
frames "Font picker popover" and "Font picker popover / empty (Brand kit)" in Settings / Brand kit / font picker open.
|
|
4
|
+
|
|
5
|
+
The panel to put inside a popover (`<Popover.Content class="w-[374px] p-0">`): a title with an upload button, a search field
|
|
6
|
+
and the list of the fonts it is given, each one written in its own face (the page has to have loaded the font under that
|
|
7
|
+
family name). It lists only `fonts`, so a brand kit passes the files it holds and nothing else shows up.
|
|
8
|
+
A font is picked with a press, removed with the bin at the end of its row; the upload button and the bin only exist when
|
|
9
|
+
`onUpload` and `onDelete` are given. With no fonts at all the list is replaced by an empty state that offers the upload.
|
|
10
|
+
-->
|
|
11
|
+
<script lang="ts" module>
|
|
12
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
13
|
+
import type { FontPickerFont } from './fontPickerLogic.js';
|
|
14
|
+
|
|
15
|
+
export type FontPickerMessages = {
|
|
16
|
+
/** Title of the panel. */
|
|
17
|
+
title: string;
|
|
18
|
+
/** Name of the upload button, and the label of the button of the empty state. */
|
|
19
|
+
upload: string;
|
|
20
|
+
/** Name of the search field for a screen reader. */
|
|
21
|
+
searchLabel: string;
|
|
22
|
+
/** Placeholder of the search field. */
|
|
23
|
+
searchPlaceholder: string;
|
|
24
|
+
/** Name of the button that clears the search. */
|
|
25
|
+
clearSearch: string;
|
|
26
|
+
/** Label above the list of fonts. */
|
|
27
|
+
section: string;
|
|
28
|
+
/** Name of the bin of a row: `{family}` becomes the font. */
|
|
29
|
+
remove: string;
|
|
30
|
+
/** Title of the empty state. */
|
|
31
|
+
emptyTitle: string;
|
|
32
|
+
/** Line under the title of the empty state. */
|
|
33
|
+
emptyDetail: string;
|
|
34
|
+
/** Shown when the search finds nothing: `{query}` becomes the text typed. */
|
|
35
|
+
noMatches: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type FontPickerProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
39
|
+
class?: string;
|
|
40
|
+
/** The fonts to list, by family name. */
|
|
41
|
+
fonts: FontPickerFont[];
|
|
42
|
+
/** The picked family, or null. Bindable. */
|
|
43
|
+
value?: string | null;
|
|
44
|
+
/** Called with the family when a row is pressed. */
|
|
45
|
+
onSelect?: (family: string) => void;
|
|
46
|
+
/** Called with the family when its bin is pressed; the bins show only when this is given. */
|
|
47
|
+
onDelete?: (family: string) => void;
|
|
48
|
+
/** Called when the upload button is pressed; the button shows only when this is given. */
|
|
49
|
+
onUpload?: () => void;
|
|
50
|
+
messages?: Partial<FontPickerMessages>;
|
|
51
|
+
};
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<script lang="ts">
|
|
55
|
+
import IconCheck from '@tabler/icons-svelte/icons/check';
|
|
56
|
+
import IconTrash from '@tabler/icons-svelte/icons/trash';
|
|
57
|
+
import IconUpload from '@tabler/icons-svelte/icons/upload';
|
|
58
|
+
import { cn } from '../../utils.js';
|
|
59
|
+
import { Button } from '../ui/button/index.js';
|
|
60
|
+
import { IconButton } from '../ui/icon-button/index.js';
|
|
61
|
+
import SearchInput from '../search-input/SearchInput.svelte';
|
|
62
|
+
import { describeFont, describeQuery, filterFonts, fontFamilyCss } from './fontPickerLogic.js';
|
|
63
|
+
|
|
64
|
+
const defaultMessages: FontPickerMessages = {
|
|
65
|
+
title: 'Fonts',
|
|
66
|
+
upload: 'Add font files',
|
|
67
|
+
searchLabel: 'Search fonts',
|
|
68
|
+
searchPlaceholder: 'Search…',
|
|
69
|
+
clearSearch: 'Clear search',
|
|
70
|
+
section: 'Your fonts',
|
|
71
|
+
remove: 'Remove {family}',
|
|
72
|
+
emptyTitle: 'No fonts yet',
|
|
73
|
+
emptyDetail: 'Add font files and they show up here.',
|
|
74
|
+
noMatches: 'No fonts match "{query}"'
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
let {
|
|
78
|
+
class: className,
|
|
79
|
+
fonts,
|
|
80
|
+
value = $bindable(null),
|
|
81
|
+
onSelect,
|
|
82
|
+
onDelete,
|
|
83
|
+
onUpload,
|
|
84
|
+
messages: messagesProp,
|
|
85
|
+
...restProps
|
|
86
|
+
}: FontPickerProps = $props();
|
|
87
|
+
|
|
88
|
+
const messages = $derived({ ...defaultMessages, ...messagesProp });
|
|
89
|
+
const titleId = $props.id();
|
|
90
|
+
|
|
91
|
+
let query = $state('');
|
|
92
|
+
const visibleFonts = $derived(filterFonts(fonts, query));
|
|
93
|
+
|
|
94
|
+
function selectFont(family: string): void {
|
|
95
|
+
value = family;
|
|
96
|
+
onSelect?.(family);
|
|
97
|
+
}
|
|
98
|
+
</script>
|
|
99
|
+
|
|
100
|
+
<div role="group" aria-labelledby={titleId} class={cn('flex w-full flex-col', className)} {...restProps}>
|
|
101
|
+
<div class="flex flex-col gap-3 px-4 pt-4 pb-3">
|
|
102
|
+
<div class="flex items-center gap-2">
|
|
103
|
+
<p id={titleId} class="text-heading-section text-foreground min-w-0 flex-1 truncate">{messages.title}</p>
|
|
104
|
+
{#if onUpload}
|
|
105
|
+
<IconButton label={messages.upload} onclick={() => onUpload?.()}>
|
|
106
|
+
<IconUpload aria-hidden="true" />
|
|
107
|
+
</IconButton>
|
|
108
|
+
{/if}
|
|
109
|
+
</div>
|
|
110
|
+
<SearchInput
|
|
111
|
+
bind:value={query}
|
|
112
|
+
placeholder={messages.searchPlaceholder}
|
|
113
|
+
clearLabel={messages.clearSearch}
|
|
114
|
+
inputAttributes={{ 'aria-label': messages.searchLabel, autocomplete: 'off' }}
|
|
115
|
+
/>
|
|
116
|
+
</div>
|
|
117
|
+
<div class="flex flex-col gap-4 p-4">
|
|
118
|
+
{#if fonts.length === 0}
|
|
119
|
+
<div class="flex flex-col items-start gap-3 py-4">
|
|
120
|
+
<p class="text-body-medium text-foreground">{messages.emptyTitle}</p>
|
|
121
|
+
<p class="text-caption text-muted-foreground">{messages.emptyDetail}</p>
|
|
122
|
+
{#if onUpload}
|
|
123
|
+
<Button type="button" variant="outline" size="sm" onclick={() => onUpload?.()}>
|
|
124
|
+
<IconUpload aria-hidden="true" />
|
|
125
|
+
{messages.upload}
|
|
126
|
+
</Button>
|
|
127
|
+
{/if}
|
|
128
|
+
</div>
|
|
129
|
+
{:else if visibleFonts.length === 0}
|
|
130
|
+
<p class="text-caption text-muted-foreground py-4">{describeQuery(messages.noMatches, query)}</p>
|
|
131
|
+
{:else}
|
|
132
|
+
<div class="flex flex-col gap-2">
|
|
133
|
+
<p class="text-caption-medium text-muted-foreground">{messages.section}</p>
|
|
134
|
+
<ul class="flex flex-col gap-0.5">
|
|
135
|
+
{#each visibleFonts as font (font.family)}
|
|
136
|
+
{@const isPicked = value === font.family}
|
|
137
|
+
<li class={cn('duration-fast flex h-8 items-center rounded-lg transition-colors', isPicked ? 'bg-brand-subtle' : 'hover:bg-accent')}>
|
|
138
|
+
<button
|
|
139
|
+
type="button"
|
|
140
|
+
aria-pressed={isPicked}
|
|
141
|
+
class="focus-visible:ring-ring focus-visible:ring-offset-background flex h-8 min-w-0 flex-1 items-center gap-2 rounded-lg ps-2 text-start focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden"
|
|
142
|
+
onclick={() => selectFont(font.family)}
|
|
143
|
+
>
|
|
144
|
+
<span class="flex size-4 shrink-0 items-center justify-center" aria-hidden="true">
|
|
145
|
+
{#if isPicked}
|
|
146
|
+
<IconCheck class="size-4 stroke-2" />
|
|
147
|
+
{/if}
|
|
148
|
+
</span>
|
|
149
|
+
<span class="text-body text-foreground min-w-0 flex-1 truncate" style:font-family={fontFamilyCss(font.family)}>
|
|
150
|
+
{font.family}
|
|
151
|
+
</span>
|
|
152
|
+
</button>
|
|
153
|
+
{#if onDelete}
|
|
154
|
+
<button
|
|
155
|
+
type="button"
|
|
156
|
+
class="text-muted-foreground hover:text-foreground duration-fast focus-visible:ring-ring focus-visible:ring-offset-background flex size-8 shrink-0 items-center justify-center rounded-lg transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden"
|
|
157
|
+
aria-label={describeFont(messages.remove, font.family)}
|
|
158
|
+
onclick={() => onDelete?.(font.family)}
|
|
159
|
+
>
|
|
160
|
+
<IconTrash class="size-4 stroke-2" aria-hidden="true" />
|
|
161
|
+
</button>
|
|
162
|
+
{/if}
|
|
163
|
+
</li>
|
|
164
|
+
{/each}
|
|
165
|
+
</ul>
|
|
166
|
+
</div>
|
|
167
|
+
{/if}
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { FontPickerFont } from './fontPickerLogic.js';
|
|
3
|
+
export type FontPickerMessages = {
|
|
4
|
+
/** Title of the panel. */
|
|
5
|
+
title: string;
|
|
6
|
+
/** Name of the upload button, and the label of the button of the empty state. */
|
|
7
|
+
upload: string;
|
|
8
|
+
/** Name of the search field for a screen reader. */
|
|
9
|
+
searchLabel: string;
|
|
10
|
+
/** Placeholder of the search field. */
|
|
11
|
+
searchPlaceholder: string;
|
|
12
|
+
/** Name of the button that clears the search. */
|
|
13
|
+
clearSearch: string;
|
|
14
|
+
/** Label above the list of fonts. */
|
|
15
|
+
section: string;
|
|
16
|
+
/** Name of the bin of a row: `{family}` becomes the font. */
|
|
17
|
+
remove: string;
|
|
18
|
+
/** Title of the empty state. */
|
|
19
|
+
emptyTitle: string;
|
|
20
|
+
/** Line under the title of the empty state. */
|
|
21
|
+
emptyDetail: string;
|
|
22
|
+
/** Shown when the search finds nothing: `{query}` becomes the text typed. */
|
|
23
|
+
noMatches: string;
|
|
24
|
+
};
|
|
25
|
+
export type FontPickerProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
26
|
+
class?: string;
|
|
27
|
+
/** The fonts to list, by family name. */
|
|
28
|
+
fonts: FontPickerFont[];
|
|
29
|
+
/** The picked family, or null. Bindable. */
|
|
30
|
+
value?: string | null;
|
|
31
|
+
/** Called with the family when a row is pressed. */
|
|
32
|
+
onSelect?: (family: string) => void;
|
|
33
|
+
/** Called with the family when its bin is pressed; the bins show only when this is given. */
|
|
34
|
+
onDelete?: (family: string) => void;
|
|
35
|
+
/** Called when the upload button is pressed; the button shows only when this is given. */
|
|
36
|
+
onUpload?: () => void;
|
|
37
|
+
messages?: Partial<FontPickerMessages>;
|
|
38
|
+
};
|
|
39
|
+
declare const FontPicker: import("svelte").Component<FontPickerProps, {}, "value">;
|
|
40
|
+
type FontPicker = ReturnType<typeof FontPicker>;
|
|
41
|
+
export default FontPicker;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logic of the FontPicker (Figma: Font Picker, component set 190:1825, and Font Row, 189:1175).
|
|
3
|
+
*
|
|
4
|
+
* Pure functions and no DOM, checked by `tests/fontPickerLogic.test.ts` with Node's own test runner.
|
|
5
|
+
*/
|
|
6
|
+
/** A font family the picker lists. `family` is the name the font is registered under and the one shown. */
|
|
7
|
+
export type FontPickerFont = {
|
|
8
|
+
family: string;
|
|
9
|
+
};
|
|
10
|
+
/** The fonts whose name contains the text typed in the search field (ignoring case and the spaces around it). */
|
|
11
|
+
export declare function filterFonts<T extends FontPickerFont>(fonts: readonly T[], query: string | null | undefined): T[];
|
|
12
|
+
/**
|
|
13
|
+
* The `font-family` value that shows a name in its own face: the name in double quotes (a family such as `Playfair Display`
|
|
14
|
+
* has a space), then the generic sans-serif the browser falls back on while the font file is still loading. A quote or a
|
|
15
|
+
* backslash in a name is dropped, so that a family named by a person can never end the quoted string and add a rule.
|
|
16
|
+
*/
|
|
17
|
+
export declare function fontFamilyCss(family: string): string;
|
|
18
|
+
/** Fills the `{family}` of a message template ("Remove {family}") with a family name. */
|
|
19
|
+
export declare function describeFont(template: string, family: string): string;
|
|
20
|
+
/** Fills the `{query}` of a message template ("No fonts match {query}") with the text of the search field. */
|
|
21
|
+
export declare function describeQuery(template: string, query: string): string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logic of the FontPicker (Figma: Font Picker, component set 190:1825, and Font Row, 189:1175).
|
|
3
|
+
*
|
|
4
|
+
* Pure functions and no DOM, checked by `tests/fontPickerLogic.test.ts` with Node's own test runner.
|
|
5
|
+
*/
|
|
6
|
+
/** The fonts whose name contains the text typed in the search field (ignoring case and the spaces around it). */
|
|
7
|
+
export function filterFonts(fonts, query) {
|
|
8
|
+
const needle = (query ?? '').trim().toLowerCase();
|
|
9
|
+
if (!needle)
|
|
10
|
+
return [...fonts];
|
|
11
|
+
return fonts.filter((font) => font.family.toLowerCase().includes(needle));
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The `font-family` value that shows a name in its own face: the name in double quotes (a family such as `Playfair Display`
|
|
15
|
+
* has a space), then the generic sans-serif the browser falls back on while the font file is still loading. A quote or a
|
|
16
|
+
* backslash in a name is dropped, so that a family named by a person can never end the quoted string and add a rule.
|
|
17
|
+
*/
|
|
18
|
+
export function fontFamilyCss(family) {
|
|
19
|
+
const safeName = family.replace(/["\\\n\r;{}]/g, '').trim();
|
|
20
|
+
return safeName ? `"${safeName}", sans-serif` : 'sans-serif';
|
|
21
|
+
}
|
|
22
|
+
/** Fills the `{family}` of a message template ("Remove {family}") with a family name. */
|
|
23
|
+
export function describeFont(template, family) {
|
|
24
|
+
return template.replace('{family}', family);
|
|
25
|
+
}
|
|
26
|
+
/** Fills the `{query}` of a message template ("No fonts match {query}") with the text of the search field. */
|
|
27
|
+
export function describeQuery(template, query) {
|
|
28
|
+
return template.replace('{query}', query.trim());
|
|
29
|
+
}
|
|
@@ -5,7 +5,9 @@ export { default as PasswordInput } from './PasswordInput.svelte';
|
|
|
5
5
|
export { default as ThumbHashImage } from './ThumbHashImage.svelte';
|
|
6
6
|
export { default as WScrollArea } from './WScrollArea.svelte';
|
|
7
7
|
export { Composer, type ComposerMessages, type ComposerProps, Message, type MessageMessages, type MessageProps, type MessageRole, ActivityRow, type ActivityRowProps, type ActivityRowStatus, OptionRow, type OptionRowProps, type OptionRowSelectionMode, TaskRow, type TaskRowProps, type TaskRowStatus, ScrollToBottom, type ScrollToBottomProps, canSendText, clampTextareaHeight, shouldSendOnKeyDown, ChatHeader, PlanCard, QuestionCard, canSubmitQuestion, formatQuestionStep, isFirstQuestion, isLastQuestion, moveFocusedIndex, optionItemRole, primaryQuestionLabel, selectionRole, toggleOption, SuggestionCard } from './chat';
|
|
8
|
+
export { ColorPicker, type ColorPickerMessages, type ColorPickerProps, normalizeHex, hexToHsv, hsvToHex, type Hsv } from './color-picker';
|
|
8
9
|
export { default as DebugGrid } from './debug-grid/DebugGrid.svelte';
|
|
10
|
+
export { FontPicker, type FontPickerMessages, type FontPickerProps, filterFonts, fontFamilyCss, type FontPickerFont } from './font-picker';
|
|
9
11
|
export { default as BrowserInputController } from './ic/browser/BrowserInputController.svelte';
|
|
10
12
|
export { default as ActionModal } from './modals/ActionModal.svelte';
|
|
11
13
|
export { default as BaseModal } from './modals/BaseModal.svelte';
|
|
@@ -16,7 +18,7 @@ export { Breadcrumbs, type BreadcrumbsProps } from './navigation';
|
|
|
16
18
|
export { default as PDFViewer } from './pdf/PDFViewer.svelte';
|
|
17
19
|
export { SearchInput } from './search-input';
|
|
18
20
|
export { ShadEditor, checkShadEditorMessages, type ShadEditorMessageKey, type TipTapEditor, type TipTapEditorLevel } from './shad-editor';
|
|
19
|
-
export { NavRow, navRowVariants, NavSectionLabel, ProfileRow, profileRowVariants, Sidebar, WidgetRow, widgetRowVariants, PageHeader, TopBar, NavDrawer, AppShell, ErrorState, defaultErrorStateMessages, type ErrorStateMessages, NotificationRow, type NotificationRowProps, SettingsNav, type SettingsNavProps, SettingsDialog, type SettingsDialogProps, Stat, type StatProps, statVariants, Banner, type BannerProps, type BannerTone, bannerVariants, Link, type LinkProps, type LinkSize, linkVariants, type SettingsNavGroup, type SettingsNavItem, settingsNavItemIsActive, externalLinkAttributes, statHintClass, type StatTone } from './shell';
|
|
21
|
+
export { NavRow, navRowVariants, NavSectionLabel, ProfileRow, profileRowVariants, Sidebar, WidgetRow, widgetRowVariants, PageHeader, TopBar, NavDrawer, AppShell, ErrorState, defaultErrorStateMessages, type ErrorStateMessages, NotificationRow, type NotificationRowProps, NotificationDetail, type NotificationDetailProps, SettingsNav, type SettingsNavProps, SettingsDialog, type SettingsDialogProps, Stat, type StatProps, statVariants, Banner, type BannerProps, type BannerTone, bannerVariants, Link, type LinkProps, type LinkSize, linkVariants, type SettingsNavGroup, type SettingsNavItem, settingsNavItemIsActive, externalLinkAttributes, statHintClass, type StatTone } from './shell';
|
|
20
22
|
export { ToasterModal, showToast } from './toast';
|
|
21
23
|
export * as Accordion from './ui/accordion';
|
|
22
24
|
export * as Alert from './ui/alert';
|
package/dist/components/index.js
CHANGED
|
@@ -6,7 +6,9 @@ export { default as PasswordInput } from './PasswordInput.svelte';
|
|
|
6
6
|
export { default as ThumbHashImage } from './ThumbHashImage.svelte';
|
|
7
7
|
export { default as WScrollArea } from './WScrollArea.svelte';
|
|
8
8
|
export { Composer, Message, ActivityRow, OptionRow, TaskRow, ScrollToBottom, canSendText, clampTextareaHeight, shouldSendOnKeyDown, ChatHeader, PlanCard, QuestionCard, canSubmitQuestion, formatQuestionStep, isFirstQuestion, isLastQuestion, moveFocusedIndex, optionItemRole, primaryQuestionLabel, selectionRole, toggleOption, SuggestionCard } from './chat';
|
|
9
|
+
export { ColorPicker, normalizeHex, hexToHsv, hsvToHex } from './color-picker';
|
|
9
10
|
export { default as DebugGrid } from './debug-grid/DebugGrid.svelte';
|
|
11
|
+
export { FontPicker, filterFonts, fontFamilyCss } from './font-picker';
|
|
10
12
|
export { default as BrowserInputController } from './ic/browser/BrowserInputController.svelte';
|
|
11
13
|
export { default as ActionModal } from './modals/ActionModal.svelte';
|
|
12
14
|
export { default as BaseModal } from './modals/BaseModal.svelte';
|
|
@@ -17,7 +19,7 @@ export { Breadcrumbs } from './navigation';
|
|
|
17
19
|
export { default as PDFViewer } from './pdf/PDFViewer.svelte';
|
|
18
20
|
export { SearchInput } from './search-input';
|
|
19
21
|
export { ShadEditor, checkShadEditorMessages } from './shad-editor';
|
|
20
|
-
export { NavRow, navRowVariants, NavSectionLabel, ProfileRow, profileRowVariants, Sidebar, WidgetRow, widgetRowVariants, PageHeader, TopBar, NavDrawer, AppShell, ErrorState, defaultErrorStateMessages, NotificationRow, SettingsNav, SettingsDialog, Stat, statVariants, Banner, bannerVariants, Link, linkVariants, settingsNavItemIsActive, externalLinkAttributes, statHintClass } from './shell';
|
|
22
|
+
export { NavRow, navRowVariants, NavSectionLabel, ProfileRow, profileRowVariants, Sidebar, WidgetRow, widgetRowVariants, PageHeader, TopBar, NavDrawer, AppShell, ErrorState, defaultErrorStateMessages, NotificationRow, NotificationDetail, SettingsNav, SettingsDialog, Stat, statVariants, Banner, bannerVariants, Link, linkVariants, settingsNavItemIsActive, externalLinkAttributes, statHintClass } from './shell';
|
|
21
23
|
export { ToasterModal, showToast } from './toast';
|
|
22
24
|
export * as Accordion from './ui/accordion';
|
|
23
25
|
export * as Alert from './ui/alert';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
// Svelte imports
|
|
3
|
-
import { fade,
|
|
3
|
+
import { fade, fly } from 'svelte/transition';
|
|
4
4
|
import { createEventDispatcher, onDestroy, onMount, tick } from 'svelte';
|
|
5
5
|
const dispatch = createEventDispatcher();
|
|
6
6
|
import {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
} from './modalStore';
|
|
28
28
|
import {
|
|
29
29
|
overlayBackdropBlurPx,
|
|
30
|
-
|
|
30
|
+
overlayContentSlidePx,
|
|
31
31
|
overlayTransitionDurationMs,
|
|
32
32
|
overlayTransitionEasing
|
|
33
33
|
} from '../../utils/overlayMotion.js';
|
|
@@ -466,19 +466,19 @@
|
|
|
466
466
|
z-index: 2;
|
|
467
467
|
"
|
|
468
468
|
bind:offsetHeight={modalHeight}
|
|
469
|
-
in:
|
|
469
|
+
in:fly|global={reduceMotion
|
|
470
470
|
? { duration: 0 }
|
|
471
471
|
: {
|
|
472
472
|
duration: transitionDuration,
|
|
473
|
-
|
|
473
|
+
y: overlayContentSlidePx,
|
|
474
474
|
opacity: 0,
|
|
475
475
|
easing
|
|
476
476
|
}}
|
|
477
|
-
out:
|
|
477
|
+
out:fly|global={reduceMotion
|
|
478
478
|
? { duration: 0 }
|
|
479
479
|
: {
|
|
480
480
|
duration: transitionDuration,
|
|
481
|
-
|
|
481
|
+
y: overlayContentSlidePx,
|
|
482
482
|
opacity: 0,
|
|
483
483
|
easing
|
|
484
484
|
}}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Figma: Notification Detail (component set 110:80, page Notification)
|
|
3
|
+
One notification opened from the Inbox list: the way back, the title with the time it happened, the message and at most
|
|
4
|
+
one action. The column is the 728px of the content (`max-w-content`) and the message wraps inside it and is never cut,
|
|
5
|
+
so the page scrolls when a message is longer than the screen. A blank line in the message starts a new paragraph.
|
|
6
|
+
With no time and no action it is also the "no longer in your Inbox" state: the way back, a title and a sentence.
|
|
7
|
+
Back is a link when it is given an address (it can be opened in a new tab and the browser's own Back keeps working) and
|
|
8
|
+
a button otherwise. The title takes the focus when `titleRef` is focused by the page that opened it.
|
|
9
|
+
-->
|
|
10
|
+
<script lang="ts" module>
|
|
11
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
12
|
+
import type { Snippet } from 'svelte';
|
|
13
|
+
|
|
14
|
+
export type NotificationDetailProps = Omit<HTMLAttributes<HTMLElement>, 'title'> & {
|
|
15
|
+
class?: string;
|
|
16
|
+
/** What happened, in a few words ("Widget published"). */
|
|
17
|
+
title: string;
|
|
18
|
+
/** When it happened, as it is shown ("4 Nov 2026, 23:55 CET"). Left out, no line is drawn. */
|
|
19
|
+
time?: string;
|
|
20
|
+
/** The same moment for machines (an ISO date), so the time is a real `<time>` element. */
|
|
21
|
+
dateTime?: string;
|
|
22
|
+
/** The message. A blank line starts a new paragraph, line breaks are kept as written. */
|
|
23
|
+
message: string;
|
|
24
|
+
/** The label of the way back. */
|
|
25
|
+
backLabel?: string;
|
|
26
|
+
/** Where the way back leads. Given, it is a link; left out, it is a button. */
|
|
27
|
+
backHref?: string;
|
|
28
|
+
/** Called when the way back is clicked, as a link or as a button (a page that moves itself calls `event.preventDefault()`). */
|
|
29
|
+
onBack?: (event: MouseEvent) => void;
|
|
30
|
+
/** The level of the title: the page's own heading sits above it, so the default is 2. */
|
|
31
|
+
titleLevel?: 1 | 2 | 3;
|
|
32
|
+
/** The title, so the page can move the focus there when the detail opens. */
|
|
33
|
+
titleRef?: HTMLElement | null;
|
|
34
|
+
/** At most one action, leading to the thing the notification is about. Left out, nothing is drawn. */
|
|
35
|
+
actions?: Snippet;
|
|
36
|
+
};
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<script lang="ts">
|
|
40
|
+
import IconArrowLeft from '@tabler/icons-svelte/icons/arrow-left';
|
|
41
|
+
import { cn } from '../../utils.js';
|
|
42
|
+
import { Button } from '../ui/button/index.js';
|
|
43
|
+
|
|
44
|
+
let {
|
|
45
|
+
class: className,
|
|
46
|
+
title,
|
|
47
|
+
time = undefined,
|
|
48
|
+
dateTime = undefined,
|
|
49
|
+
message,
|
|
50
|
+
backLabel = 'Back to inbox',
|
|
51
|
+
backHref = undefined,
|
|
52
|
+
onBack = undefined,
|
|
53
|
+
titleLevel = 2,
|
|
54
|
+
titleRef = $bindable(null),
|
|
55
|
+
actions = undefined,
|
|
56
|
+
...restProps
|
|
57
|
+
}: NotificationDetailProps = $props();
|
|
58
|
+
|
|
59
|
+
const titleId = $props.id();
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<article
|
|
63
|
+
class={cn('max-w-content flex w-full flex-col items-start gap-6', className)}
|
|
64
|
+
aria-labelledby={titleId}
|
|
65
|
+
{...restProps}
|
|
66
|
+
>
|
|
67
|
+
<Button variant="ghost" href={backHref} onclick={onBack}>
|
|
68
|
+
<IconArrowLeft aria-hidden="true" class="rtl:-scale-x-100" />
|
|
69
|
+
{backLabel}
|
|
70
|
+
</Button>
|
|
71
|
+
|
|
72
|
+
<div class="flex w-full min-w-0 flex-col gap-4">
|
|
73
|
+
<header class="flex min-w-0 flex-col gap-1">
|
|
74
|
+
<!-- tabindex -1: the page moves the focus here when it opens the detail, but the title is not a stop of the Tab key -->
|
|
75
|
+
<svelte:element
|
|
76
|
+
this={`h${titleLevel}`}
|
|
77
|
+
id={titleId}
|
|
78
|
+
bind:this={titleRef}
|
|
79
|
+
tabindex={-1}
|
|
80
|
+
class="text-heading-page text-foreground focus-visible:outline-hidden break-words"
|
|
81
|
+
>
|
|
82
|
+
{title}
|
|
83
|
+
</svelte:element>
|
|
84
|
+
{#if time}
|
|
85
|
+
<time class="text-caption text-muted-foreground" datetime={dateTime}>{time}</time>
|
|
86
|
+
{/if}
|
|
87
|
+
</header>
|
|
88
|
+
<p class="text-body text-foreground break-words whitespace-pre-line">{message}</p>
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
{#if actions}
|
|
92
|
+
<div class="flex w-full flex-wrap items-center gap-2">
|
|
93
|
+
{@render actions()}
|
|
94
|
+
</div>
|
|
95
|
+
{/if}
|
|
96
|
+
</article>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
export type NotificationDetailProps = Omit<HTMLAttributes<HTMLElement>, 'title'> & {
|
|
4
|
+
class?: string;
|
|
5
|
+
/** What happened, in a few words ("Widget published"). */
|
|
6
|
+
title: string;
|
|
7
|
+
/** When it happened, as it is shown ("4 Nov 2026, 23:55 CET"). Left out, no line is drawn. */
|
|
8
|
+
time?: string;
|
|
9
|
+
/** The same moment for machines (an ISO date), so the time is a real `<time>` element. */
|
|
10
|
+
dateTime?: string;
|
|
11
|
+
/** The message. A blank line starts a new paragraph, line breaks are kept as written. */
|
|
12
|
+
message: string;
|
|
13
|
+
/** The label of the way back. */
|
|
14
|
+
backLabel?: string;
|
|
15
|
+
/** Where the way back leads. Given, it is a link; left out, it is a button. */
|
|
16
|
+
backHref?: string;
|
|
17
|
+
/** Called when the way back is clicked, as a link or as a button (a page that moves itself calls `event.preventDefault()`). */
|
|
18
|
+
onBack?: (event: MouseEvent) => void;
|
|
19
|
+
/** The level of the title: the page's own heading sits above it, so the default is 2. */
|
|
20
|
+
titleLevel?: 1 | 2 | 3;
|
|
21
|
+
/** The title, so the page can move the focus there when the detail opens. */
|
|
22
|
+
titleRef?: HTMLElement | null;
|
|
23
|
+
/** At most one action, leading to the thing the notification is about. Left out, nothing is drawn. */
|
|
24
|
+
actions?: Snippet;
|
|
25
|
+
};
|
|
26
|
+
declare const NotificationDetail: import("svelte").Component<NotificationDetailProps, {}, "titleRef">;
|
|
27
|
+
type NotificationDetail = ReturnType<typeof NotificationDetail>;
|
|
28
|
+
export default NotificationDetail;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
Figma: Notification Row (component set 110:77, page Notification)
|
|
3
|
+
|
|
4
|
+
The row fills its container, as the instances in the Inbox list do (1120px wide on the desktop, the width of the list):
|
|
5
|
+
the 728px of the component is its default width, not a cap, so the page decides how wide the list is.
|
|
3
6
|
-->
|
|
4
7
|
<script lang="ts" module>
|
|
5
8
|
import type { WithElementRef } from 'bits-ui';
|
|
@@ -36,7 +39,7 @@
|
|
|
36
39
|
|
|
37
40
|
const rowClass = $derived(
|
|
38
41
|
cn(
|
|
39
|
-
'group flex w-full
|
|
42
|
+
'group flex w-full items-center gap-4 rounded-xl px-4 py-3 text-start transition-colors duration-fast hover:bg-accent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',
|
|
40
43
|
className
|
|
41
44
|
)
|
|
42
45
|
);
|
|
@@ -59,9 +62,8 @@
|
|
|
59
62
|
</span>
|
|
60
63
|
<span class="flex shrink-0 items-center gap-2">
|
|
61
64
|
<span class="text-caption text-muted-foreground">{time}</span>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
{/if}
|
|
65
|
+
<!-- The 8px of the dot are kept when the row is read, so the times of read and unread rows line up, as in Figma -->
|
|
66
|
+
<span class={cn('size-2 shrink-0 rounded-full', unread && 'bg-brand')} aria-hidden="true"></span>
|
|
65
67
|
</span>
|
|
66
68
|
{/snippet}
|
|
67
69
|
|
|
@@ -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
|
|
@@ -131,7 +137,7 @@
|
|
|
131
137
|
<aside
|
|
132
138
|
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"
|
|
133
139
|
>
|
|
134
|
-
<SettingsNav {groups} {activeId} {onSelect} class="flex-1" />
|
|
140
|
+
<SettingsNav {groups} {activeId} {onSelect} pending={navPending} class="flex-1" />
|
|
135
141
|
</aside>
|
|
136
142
|
<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">
|
|
137
143
|
<header class="settings-dialog-header flex shrink-0 flex-col gap-1 ps-8 pe-10">
|
|
@@ -155,8 +161,14 @@
|
|
|
155
161
|
{/if}
|
|
156
162
|
</header>
|
|
157
163
|
<!-- Only the page under the title scrolls. When it overflows, margin+padding centre the bar in the parent's pe-8. -->
|
|
164
|
+
<!--
|
|
165
|
+
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,
|
|
166
|
+
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
|
|
167
|
+
room to spare, as BaseModal's) at the top and at the end, taken back by the same negative margin so the page stays
|
|
168
|
+
where it was. (The start already has ps-8, the bottom pb-8, and an overflowing box sets the end itself, below.)
|
|
169
|
+
-->
|
|
158
170
|
<div
|
|
159
|
-
class="settings-dialog-pane-scroll flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto overflow-x-hidden ps-8 pb-8"
|
|
171
|
+
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"
|
|
160
172
|
use:overlayScrollbar
|
|
161
173
|
style={paneScrollStyle}
|
|
162
174
|
>
|
|
@@ -164,12 +176,14 @@
|
|
|
164
176
|
</div>
|
|
165
177
|
</div>
|
|
166
178
|
</div>
|
|
167
|
-
<
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
179
|
+
<div class="absolute end-2 top-2" data-settings-dialog-close-box>
|
|
180
|
+
<DialogPrimitive.Close
|
|
181
|
+
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"
|
|
182
|
+
>
|
|
183
|
+
<IconX class="size-4 stroke-2" aria-hidden="true" />
|
|
184
|
+
<span class="sr-only">{closeLabel}</span>
|
|
185
|
+
</DialogPrimitive.Close>
|
|
186
|
+
</div>
|
|
173
187
|
</DialogPrimitive.Content>
|
|
174
188
|
</Dialog.Portal>
|
|
175
189
|
</Dialog.Root>
|
|
@@ -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;
|