@widgetic/design-system 0.5.39 → 0.5.41
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/README.md +73 -0
- package/dist/components/ContentRefreshOverlay.svelte +103 -0
- package/dist/components/ContentRefreshOverlay.svelte.d.ts +18 -0
- package/dist/components/chat/Composer.svelte +381 -20
- package/dist/components/chat/Composer.svelte.d.ts +88 -1
- package/dist/components/chat/PlanCard.svelte +218 -88
- package/dist/components/chat/PlanCard.svelte.d.ts +11 -0
- package/dist/components/chat/QuestionCard.svelte +180 -70
- package/dist/components/chat/QuestionCard.svelte.d.ts +28 -2
- package/dist/components/chat/QuestionCardSummary.svelte +96 -0
- package/dist/components/chat/QuestionCardSummary.svelte.d.ts +20 -0
- package/dist/components/chat/QueueCard.svelte +185 -0
- package/dist/components/chat/QueueCard.svelte.d.ts +40 -0
- package/dist/components/chat/composerLogic.d.ts +31 -0
- package/dist/components/chat/composerLogic.js +37 -0
- package/dist/components/chat/composerReferences.d.ts +28 -0
- package/dist/components/chat/composerReferences.js +23 -0
- package/dist/components/chat/index.d.ts +8 -3
- package/dist/components/chat/index.js +10 -2
- package/dist/components/chat/questionCardLogic.d.ts +40 -3
- package/dist/components/chat/questionCardLogic.js +54 -3
- package/dist/components/chat/queueCardLogic.d.ts +7 -0
- package/dist/components/chat/queueCardLogic.js +5 -0
- package/dist/components/creator/index.d.ts +1 -2
- package/dist/components/creator/index.js +2 -0
- package/dist/components/filters/FilterByButton.svelte +2 -1
- package/dist/components/index.d.ts +8 -7
- package/dist/components/index.js +8 -6
- package/dist/components/modals/BaseModal.svelte +14 -4
- package/dist/components/navigation/Breadcrumbs.svelte +1 -1
- package/dist/components/navigation/breadcrumbSlideIn.d.ts +6 -2
- package/dist/components/navigation/breadcrumbSlideIn.js +6 -6
- package/dist/components/search-input/SearchInput.svelte +282 -14
- package/dist/components/search-input/SearchInput.svelte.d.ts +3 -0
- package/dist/components/search-input/index.d.ts +1 -0
- package/dist/components/search-input/index.js +1 -0
- package/dist/components/search-input/index2.d.ts +4 -0
- package/dist/components/search-input/recentSearches.d.ts +12 -0
- package/dist/components/search-input/recentSearches.js +124 -0
- package/dist/components/toast/ToasterModal.svelte +8 -2
- package/dist/components/toast/ToasterModal.svelte.d.ts +2 -0
- package/dist/components/ui/chip/chip.svelte +39 -1
- package/dist/components/ui/chip/chip.svelte.d.ts +8 -0
- package/dist/components/ui/chip/chipProgress.d.ts +14 -0
- package/dist/components/ui/chip/chipProgress.js +21 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu-content.svelte +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte +1 -1
- package/dist/components/ui/icon-button/icon-button.svelte +2 -0
- package/dist/components/ui/icon-button/icon-button.svelte.d.ts +5 -0
- package/dist/components/ui/number-controls/index.d.ts +2 -0
- package/dist/components/ui/number-controls/index.js +2 -0
- package/dist/components/ui/number-controls/number-controls.svelte +530 -0
- package/dist/components/ui/number-controls/number-controls.svelte.d.ts +46 -0
- package/dist/components/ui/number-controls/numberControlsSteps.d.ts +17 -0
- package/dist/components/ui/number-controls/numberControlsSteps.js +23 -0
- package/dist/components/ui/number-controls/numberControlsValueArea.d.ts +29 -0
- package/dist/components/ui/number-controls/numberControlsValueArea.js +51 -0
- package/dist/components/ui/text-flip/index.d.ts +1 -0
- package/dist/components/ui/text-flip/index.js +1 -0
- package/dist/components/ui/text-flip/text-flip.svelte +103 -0
- package/dist/components/ui/text-flip/text-flip.svelte.d.ts +15 -0
- package/dist/components/ui/text-flip/textFlipLogic.d.ts +49 -0
- package/dist/components/ui/text-flip/textFlipLogic.js +151 -0
- package/dist/inline-completion/completionAnswer.d.ts +11 -0
- package/dist/inline-completion/completionAnswer.js +49 -0
- package/dist/inline-completion/completionCache.d.ts +24 -0
- package/dist/inline-completion/completionCache.js +47 -0
- package/dist/inline-completion/completionController.d.ts +61 -0
- package/dist/inline-completion/completionController.js +280 -0
- package/dist/inline-completion/completionKeys.d.ts +21 -0
- package/dist/inline-completion/completionKeys.js +19 -0
- package/dist/inline-completion/completionText.d.ts +53 -0
- package/dist/inline-completion/completionText.js +79 -0
- package/dist/inline-completion/completionTypes.d.ts +71 -0
- package/dist/inline-completion/completionTypes.js +5 -0
- package/dist/inline-completion/gatewayCompletion.d.ts +37 -0
- package/dist/inline-completion/gatewayCompletion.js +77 -0
- package/dist/inline-completion/ghostTap.d.ts +19 -0
- package/dist/inline-completion/ghostTap.js +20 -0
- package/dist/inline-completion/hintMemory.d.ts +43 -0
- package/dist/inline-completion/hintMemory.js +90 -0
- package/dist/inline-completion/httpSource.d.ts +40 -0
- package/dist/inline-completion/httpSource.js +149 -0
- package/dist/inline-completion/index.d.ts +30 -0
- package/dist/inline-completion/index.js +20 -0
- package/dist/inline-completion/inlineCompletionAction.d.ts +54 -0
- package/dist/inline-completion/inlineCompletionAction.js +310 -0
- package/dist/inline-completion/outcomeReporter.d.ts +49 -0
- package/dist/inline-completion/outcomeReporter.js +139 -0
- package/dist/inline-completion/promiseLike.d.ts +9 -0
- package/dist/inline-completion/promiseLike.js +9 -0
- package/dist/prompt-references/ReferenceMenu.svelte +344 -0
- package/dist/prompt-references/ReferenceMenu.svelte.d.ts +26 -0
- package/dist/prompt-references/index.d.ts +27 -0
- package/dist/prompt-references/index.js +20 -0
- package/dist/prompt-references/neutralizingSource.d.ts +21 -0
- package/dist/prompt-references/neutralizingSource.js +29 -0
- package/dist/prompt-references/promptReferences.d.ts +28 -0
- package/dist/prompt-references/promptReferences.js +766 -0
- package/dist/prompt-references/referenceBadge.d.ts +61 -0
- package/dist/prompt-references/referenceBadge.js +82 -0
- package/dist/prompt-references/referenceBadgePainter.d.ts +31 -0
- package/dist/prompt-references/referenceBadgePainter.js +106 -0
- package/dist/prompt-references/referenceEditing.d.ts +60 -0
- package/dist/prompt-references/referenceEditing.js +135 -0
- package/dist/prompt-references/referenceLabels.d.ts +56 -0
- package/dist/prompt-references/referenceLabels.js +215 -0
- package/dist/prompt-references/referenceMeasure.d.ts +12 -0
- package/dist/prompt-references/referenceMeasure.js +63 -0
- package/dist/prompt-references/referenceMenuHost.svelte.d.ts +29 -0
- package/dist/prompt-references/referenceMenuHost.svelte.js +43 -0
- package/dist/prompt-references/referenceMenuKeys.d.ts +26 -0
- package/dist/prompt-references/referenceMenuKeys.js +49 -0
- package/dist/prompt-references/referenceMenuPlacement.d.ts +63 -0
- package/dist/prompt-references/referenceMenuPlacement.js +66 -0
- package/dist/prompt-references/referenceTokens.d.ts +175 -0
- package/dist/prompt-references/referenceTokens.js +332 -0
- package/dist/prompt-references/referenceTrigger.d.ts +52 -0
- package/dist/prompt-references/referenceTrigger.js +100 -0
- package/dist/prompt-references/referenceTypes.d.ts +38 -0
- package/dist/prompt-references/referenceTypes.js +4 -0
- package/dist/prompt-references/sentReferences.d.ts +50 -0
- package/dist/prompt-references/sentReferences.js +122 -0
- package/dist/styles/tokens.css +58 -0
- package/dist/textarea-overlay/index.d.ts +9 -0
- package/dist/textarea-overlay/index.js +7 -0
- package/dist/textarea-overlay/mirrorSegments.d.ts +31 -0
- package/dist/textarea-overlay/mirrorSegments.js +47 -0
- package/dist/textarea-overlay/mirrorSizing.d.ts +39 -0
- package/dist/textarea-overlay/mirrorSizing.js +40 -0
- package/dist/textarea-overlay/textareaOverlay.d.ts +25 -0
- package/dist/textarea-overlay/textareaOverlay.js +277 -0
- package/dist/utils/overlayMotion.d.ts +1 -0
- package/dist/utils/overlayMotion.js +3 -3
- package/dist/utils/reducedMotion.d.ts +9 -0
- package/dist/utils/reducedMotion.js +13 -0
- package/package.json +16 -1
- package/dist/components/ui/number-stepper/index.d.ts +0 -3
- package/dist/components/ui/number-stepper/index.js +0 -3
- package/dist/components/ui/number-stepper/number-stepper.svelte +0 -212
- package/dist/components/ui/number-stepper/number-stepper.svelte.d.ts +0 -24
- package/dist/components/ui/number-stepper/numberStepperSteps.d.ts +0 -26
- package/dist/components/ui/number-stepper/numberStepperSteps.js +0 -45
|
@@ -4,18 +4,22 @@
|
|
|
4
4
|
<script lang="ts">
|
|
5
5
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
6
6
|
import type { Snippet } from 'svelte';
|
|
7
|
+
import { cubicOut } from 'svelte/easing';
|
|
8
|
+
import { slide } from 'svelte/transition';
|
|
7
9
|
import IconChevronDown from '@tabler/icons-svelte/icons/chevron-down';
|
|
8
10
|
import IconCircle from '@tabler/icons-svelte/icons/circle';
|
|
9
11
|
import IconCircleCheck from '@tabler/icons-svelte/icons/circle-check';
|
|
12
|
+
import IconCircleDashed from '@tabler/icons-svelte/icons/circle-dashed';
|
|
10
13
|
import IconDeviceDesktop from '@tabler/icons-svelte/icons/device-desktop';
|
|
11
14
|
import IconDeviceMobile from '@tabler/icons-svelte/icons/device-mobile';
|
|
12
15
|
import IconDeviceTablet from '@tabler/icons-svelte/icons/device-tablet';
|
|
13
16
|
import IconListCheck from '@tabler/icons-svelte/icons/list-check';
|
|
14
|
-
import IconLoader2 from '@tabler/icons-svelte/icons/loader-2';
|
|
15
17
|
import { Badge } from '../ui/badge';
|
|
16
18
|
import { Button } from '../ui/button';
|
|
17
19
|
import * as Collapsible from '../ui/collapsible';
|
|
20
|
+
import { TextFlip } from '../ui/text-flip';
|
|
18
21
|
import { cn } from '../../utils.js';
|
|
22
|
+
import { prefersReducedMotion } from '../../utils/reducedMotion.js';
|
|
19
23
|
|
|
20
24
|
export type PlanTask = {
|
|
21
25
|
id: string;
|
|
@@ -43,6 +47,12 @@
|
|
|
43
47
|
responsiveMobile: string;
|
|
44
48
|
responsiveTablet: string;
|
|
45
49
|
responsiveDesktop: string;
|
|
50
|
+
/** The word on the closed card while the plan is being written. */
|
|
51
|
+
planning: string;
|
|
52
|
+
/** Said before each task by a screen reader (the marks of the tasks are only drawn), so it hears where the task stands. */
|
|
53
|
+
taskPending: string;
|
|
54
|
+
taskActive: string;
|
|
55
|
+
taskDone: string;
|
|
46
56
|
};
|
|
47
57
|
|
|
48
58
|
const defaultMessages: PlanCardMessages = {
|
|
@@ -54,7 +64,11 @@
|
|
|
54
64
|
responsiveTitle: 'Responsive',
|
|
55
65
|
responsiveMobile: 'Mobile',
|
|
56
66
|
responsiveTablet: 'Tablet',
|
|
57
|
-
responsiveDesktop: 'Desktop'
|
|
67
|
+
responsiveDesktop: 'Desktop',
|
|
68
|
+
planning: 'Planning',
|
|
69
|
+
taskPending: 'To do',
|
|
70
|
+
taskActive: 'In progress',
|
|
71
|
+
taskDone: 'Done'
|
|
58
72
|
};
|
|
59
73
|
|
|
60
74
|
type Props = HTMLAttributes<HTMLDivElement> & {
|
|
@@ -62,6 +76,11 @@
|
|
|
62
76
|
class?: string;
|
|
63
77
|
title: string;
|
|
64
78
|
tasks: PlanTask[];
|
|
79
|
+
/**
|
|
80
|
+
* True while the plan is still being written: the card is closed to a slim bar that says "Planning" in a shimmer, with no tasks and
|
|
81
|
+
* no progress yet. When it turns false the card opens, the title takes the place of the word and the progress arrives.
|
|
82
|
+
*/
|
|
83
|
+
planning?: boolean;
|
|
65
84
|
/** Shown in the header badge; defaults from active task index and task count. */
|
|
66
85
|
progressCurrent?: number;
|
|
67
86
|
progressTotal?: number;
|
|
@@ -82,6 +101,7 @@
|
|
|
82
101
|
class: className,
|
|
83
102
|
title,
|
|
84
103
|
tasks,
|
|
104
|
+
planning = false,
|
|
85
105
|
progressCurrent,
|
|
86
106
|
progressTotal,
|
|
87
107
|
visibleTaskCount = 3,
|
|
@@ -129,19 +149,55 @@
|
|
|
129
149
|
const responsiveRows = $derived(
|
|
130
150
|
responsive
|
|
131
151
|
? [
|
|
132
|
-
{
|
|
133
|
-
|
|
134
|
-
|
|
152
|
+
{
|
|
153
|
+
id: 'mobile',
|
|
154
|
+
Icon: IconDeviceMobile,
|
|
155
|
+
label: messages.responsiveMobile,
|
|
156
|
+
text: responsive.mobile
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
id: 'tablet',
|
|
160
|
+
Icon: IconDeviceTablet,
|
|
161
|
+
label: messages.responsiveTablet,
|
|
162
|
+
text: responsive.tablet
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
id: 'desktop',
|
|
166
|
+
Icon: IconDeviceDesktop,
|
|
167
|
+
label: messages.responsiveDesktop,
|
|
168
|
+
text: responsive.desktop
|
|
169
|
+
}
|
|
135
170
|
].filter((row) => row.text.trim() !== '')
|
|
136
171
|
: []
|
|
137
172
|
);
|
|
138
173
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
174
|
+
// How long the card takes to open to its tasks once the plan arrives, in ms (0 with reduced motion: it is simply open)
|
|
175
|
+
const openingDurationMs = 300;
|
|
176
|
+
|
|
177
|
+
/** The words a screen reader says before a task, for the state it is in. */
|
|
178
|
+
function taskStatusWord(status: PlanTask['status']): string {
|
|
179
|
+
if (status === 'done') return messages.taskDone;
|
|
180
|
+
if (status === 'active') return messages.taskActive;
|
|
181
|
+
return messages.taskPending;
|
|
143
182
|
}
|
|
144
183
|
|
|
184
|
+
// The three marks of a task's state share one place: the one that is current shows and the other two are scaled down to nothing, so a task
|
|
185
|
+
// that changes state plays a transition instead of swapping an icon. It all follows `data-status` of the row (`group/task`) in CSS, so a
|
|
186
|
+
// row that is drawn already active or done is simply there, and with reduced motion the transitions are off.
|
|
187
|
+
const pendingMarkClasses =
|
|
188
|
+
'text-muted-foreground size-4 stroke-2 transition-[opacity,scale] duration-fast ease-out motion-reduce:transition-none group-data-[status=active]/task:scale-50 group-data-[status=active]/task:opacity-0 group-data-[status=done]/task:scale-50 group-data-[status=done]/task:opacity-0';
|
|
189
|
+
// The dashed ring of the task being worked on: it grows from nothing to its place quickly, turns while the task is active (see the style
|
|
190
|
+
// below) and shrinks away when the task is done. A row that is drawn already active (the first task, as the card opens) grows its ring
|
|
191
|
+
// too: the `starting:` classes give the ring its first look, so it is not simply there. (The check has none: a row drawn done stays still.)
|
|
192
|
+
const workingRingClasses =
|
|
193
|
+
'plan-card-working-ring text-foreground grid size-4 scale-0 opacity-0 transition-[opacity,scale] duration-fast ease-out motion-reduce:transition-none group-data-[status=active]/task:scale-100 group-data-[status=active]/task:opacity-100 group-data-[status=active]/task:duration-base group-data-[status=active]/task:starting:scale-0 group-data-[status=active]/task:starting:opacity-0';
|
|
194
|
+
// The check pops up in the green of the brand once the ring is nearly gone: it overshoots its size and settles.
|
|
195
|
+
const doneMarkClasses =
|
|
196
|
+
'text-brand size-4 scale-0 stroke-2 opacity-0 transition-[opacity,scale] duration-fast ease-out motion-reduce:transition-none group-data-[status=done]/task:scale-100 group-data-[status=done]/task:opacity-100 group-data-[status=done]/task:delay-100 group-data-[status=done]/task:duration-[360ms] group-data-[status=done]/task:ease-[cubic-bezier(0.34,1.56,0.64,1)]';
|
|
197
|
+
// The line through a finished task grows from where the text starts (the left, or the right on a right to left screen) to where it ends.
|
|
198
|
+
const strikeLineClasses =
|
|
199
|
+
'absolute inset-x-0 top-1/2 h-px origin-left scale-x-0 bg-current transition-[scale] duration-slow ease-out delay-100 motion-reduce:transition-none rtl:origin-right group-data-[status=done]/task:scale-x-100';
|
|
200
|
+
|
|
145
201
|
function handlePrimary() {
|
|
146
202
|
if (!onPrimary) return;
|
|
147
203
|
try {
|
|
@@ -162,25 +218,27 @@
|
|
|
162
218
|
</script>
|
|
163
219
|
|
|
164
220
|
{#snippet taskRow(task: PlanTask)}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
class={
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
/>
|
|
221
|
+
<div class="group/task flex min-h-7 items-center gap-2 px-0 py-1" data-status={task.status}>
|
|
222
|
+
<span class="relative grid size-4 shrink-0 *:col-start-1 *:row-start-1" aria-hidden="true">
|
|
223
|
+
<IconCircle class={pendingMarkClasses} />
|
|
224
|
+
<span class={workingRingClasses}>
|
|
225
|
+
<IconCircleDashed class="size-4 stroke-2" />
|
|
226
|
+
</span>
|
|
227
|
+
<IconCircleCheck class={doneMarkClasses} />
|
|
228
|
+
</span>
|
|
229
|
+
<span class="sr-only">{taskStatusWord(task.status)}</span>
|
|
175
230
|
<span
|
|
176
|
-
class={cn(
|
|
177
|
-
'text-body min-w-0 flex-1 truncate',
|
|
178
|
-
task.status === 'pending' && 'text-muted-foreground',
|
|
179
|
-
task.status === 'active' && 'text-body-medium text-foreground',
|
|
180
|
-
task.status === 'done' && 'text-muted-foreground line-through'
|
|
181
|
-
)}
|
|
231
|
+
class={cn('relative max-w-full min-w-0', task.status !== 'active' && 'text-muted-foreground')}
|
|
182
232
|
>
|
|
183
|
-
|
|
233
|
+
<span
|
|
234
|
+
class={cn(
|
|
235
|
+
'text-body block truncate',
|
|
236
|
+
task.status === 'active' && 'text-body-medium shimmer'
|
|
237
|
+
)}
|
|
238
|
+
>
|
|
239
|
+
{task.label}
|
|
240
|
+
</span>
|
|
241
|
+
<span class={strikeLineClasses} aria-hidden="true"></span>
|
|
184
242
|
</span>
|
|
185
243
|
</div>
|
|
186
244
|
{/snippet}
|
|
@@ -188,9 +246,11 @@
|
|
|
188
246
|
<div
|
|
189
247
|
bind:this={ref}
|
|
190
248
|
class={cn(
|
|
191
|
-
'rounded-card border-border bg-background flex w-full max-w-full flex-col
|
|
249
|
+
'rounded-card border-border bg-background flex w-full max-w-full flex-col border p-4',
|
|
192
250
|
className
|
|
193
251
|
)}
|
|
252
|
+
data-plan-state={planning ? 'planning' : 'ready'}
|
|
253
|
+
aria-busy={planning ? true : undefined}
|
|
194
254
|
{...restProps}
|
|
195
255
|
>
|
|
196
256
|
<header class="flex min-w-0 items-center gap-2">
|
|
@@ -201,73 +261,143 @@
|
|
|
201
261
|
<IconListCheck class="size-4 stroke-2" aria-hidden="true" />
|
|
202
262
|
{/if}
|
|
203
263
|
</span>
|
|
204
|
-
|
|
205
|
-
|
|
264
|
+
<!--
|
|
265
|
+
The word and the title share one place: the word fades up out of it when the plan arrives and the title rises into it. The title
|
|
266
|
+
(a heading) exists only once there is a plan to name, so a screen reader never meets an empty or a hidden heading.
|
|
267
|
+
The word is as wide as itself (`justify-self-start`, kept inside the cell by `max-w-full`): the shimmer sweeps the box of the
|
|
268
|
+
element, so a box stretched over the whole header would let the glint pass over the word for only a moment of each turn.
|
|
269
|
+
-->
|
|
270
|
+
<div class="grid min-w-0 flex-1">
|
|
271
|
+
<span
|
|
272
|
+
class={cn(
|
|
273
|
+
'text-body-medium duration-base col-start-1 row-start-1 max-w-full min-w-0 justify-self-start truncate transition-[opacity,translate] ease-out motion-reduce:transition-none',
|
|
274
|
+
planning ? 'shimmer translate-y-0 opacity-100' : '-translate-y-1 opacity-0'
|
|
275
|
+
)}
|
|
276
|
+
aria-hidden={planning ? undefined : true}
|
|
277
|
+
>
|
|
278
|
+
{messages.planning}
|
|
279
|
+
</span>
|
|
280
|
+
{#if !planning}
|
|
281
|
+
<h3
|
|
282
|
+
class="text-body-medium text-foreground duration-base col-start-1 row-start-1 min-w-0 translate-y-0 truncate opacity-100 transition-[opacity,translate] delay-75 ease-out motion-reduce:transition-none starting:translate-y-1 starting:opacity-0"
|
|
283
|
+
>
|
|
284
|
+
{title}
|
|
285
|
+
</h3>
|
|
286
|
+
{/if}
|
|
287
|
+
</div>
|
|
288
|
+
{#if !planning}
|
|
289
|
+
<Badge
|
|
290
|
+
variant="default"
|
|
291
|
+
class="duration-slow shrink-0 scale-100 opacity-100 transition-[opacity,scale] ease-out motion-reduce:transition-none starting:scale-90 starting:opacity-0"
|
|
292
|
+
>
|
|
293
|
+
<TextFlip text={progressLabel} />
|
|
294
|
+
</Badge>
|
|
295
|
+
{/if}
|
|
206
296
|
</header>
|
|
207
297
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
298
|
+
{#if !planning}
|
|
299
|
+
<!-- The card opens to its tasks when the plan arrives (and closes again if it goes back to planning); drawn from the start, it is simply open -->
|
|
300
|
+
<div
|
|
301
|
+
class="flex flex-col gap-3 pt-3"
|
|
302
|
+
transition:slide={{
|
|
303
|
+
duration: prefersReducedMotion() ? 0 : openingDurationMs,
|
|
304
|
+
easing: cubicOut
|
|
305
|
+
}}
|
|
306
|
+
>
|
|
307
|
+
<div class="flex flex-col">
|
|
308
|
+
{#each visibleTasks as task (task.id)}
|
|
309
|
+
{@render taskRow(task)}
|
|
310
|
+
{/each}
|
|
311
|
+
|
|
312
|
+
{#if hiddenCount > 0}
|
|
313
|
+
<Collapsible.Root bind:open={expanded}>
|
|
314
|
+
<Collapsible.Trigger
|
|
315
|
+
class="text-label text-foreground duration-fast hover:bg-accent focus-visible:ring-ring focus-visible:ring-offset-background mt-1 inline-flex h-8 items-center gap-1 rounded-lg px-2 transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden"
|
|
316
|
+
>
|
|
317
|
+
{showMoreLabel}
|
|
318
|
+
<IconChevronDown
|
|
319
|
+
class={cn(
|
|
320
|
+
'duration-base size-4 stroke-2 transition-transform motion-reduce:transition-none',
|
|
321
|
+
expanded && 'rotate-180'
|
|
322
|
+
)}
|
|
323
|
+
aria-hidden="true"
|
|
324
|
+
/>
|
|
325
|
+
</Collapsible.Trigger>
|
|
326
|
+
<Collapsible.Content
|
|
327
|
+
class="flex flex-col overflow-hidden motion-reduce:transition-none"
|
|
328
|
+
>
|
|
329
|
+
{#each hiddenTasks as task (task.id)}
|
|
330
|
+
{@render taskRow(task)}
|
|
331
|
+
{/each}
|
|
332
|
+
</Collapsible.Content>
|
|
333
|
+
</Collapsible.Root>
|
|
334
|
+
{/if}
|
|
335
|
+
</div>
|
|
212
336
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
337
|
+
{#if responsiveRows.length > 0}
|
|
338
|
+
<section
|
|
339
|
+
class="border-border flex flex-col gap-1 border-t pt-3"
|
|
340
|
+
aria-labelledby="plan-card-responsive-title"
|
|
217
341
|
>
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
342
|
+
<h4 id="plan-card-responsive-title" class="text-label-small text-muted-foreground">
|
|
343
|
+
{messages.responsiveTitle}
|
|
344
|
+
</h4>
|
|
345
|
+
{#each responsiveRows as row (row.id)}
|
|
346
|
+
{@const RowIcon = row.Icon}
|
|
347
|
+
<div class="flex items-start gap-2 py-1">
|
|
348
|
+
<RowIcon class="text-foreground mt-0.5 size-4 shrink-0 stroke-2" aria-hidden="true" />
|
|
349
|
+
<p class="text-body min-w-0 flex-1">
|
|
350
|
+
<span class="text-body-medium text-foreground">{row.label}</span>
|
|
351
|
+
<span class="text-muted-foreground">{row.text}</span>
|
|
352
|
+
</p>
|
|
353
|
+
</div>
|
|
230
354
|
{/each}
|
|
231
|
-
</
|
|
232
|
-
</Collapsible.Root>
|
|
233
|
-
{/if}
|
|
234
|
-
</div>
|
|
235
|
-
|
|
236
|
-
{#if responsiveRows.length > 0}
|
|
237
|
-
<section class="border-border flex flex-col gap-1 border-t pt-3" aria-labelledby="plan-card-responsive-title">
|
|
238
|
-
<h4 id="plan-card-responsive-title" class="text-label-small text-muted-foreground">
|
|
239
|
-
{messages.responsiveTitle}
|
|
240
|
-
</h4>
|
|
241
|
-
{#each responsiveRows as row (row.id)}
|
|
242
|
-
{@const RowIcon = row.Icon}
|
|
243
|
-
<div class="flex items-start gap-2 py-1">
|
|
244
|
-
<RowIcon class="text-foreground mt-0.5 size-4 shrink-0 stroke-2" aria-hidden="true" />
|
|
245
|
-
<p class="text-body min-w-0 flex-1">
|
|
246
|
-
<span class="text-body-medium text-foreground">{row.label}</span>
|
|
247
|
-
<span class="text-muted-foreground">{row.text}</span>
|
|
248
|
-
</p>
|
|
249
|
-
</div>
|
|
250
|
-
{/each}
|
|
251
|
-
</section>
|
|
252
|
-
{/if}
|
|
253
|
-
|
|
254
|
-
{#if showFooter}
|
|
255
|
-
<footer class="flex flex-wrap items-center gap-2 pt-1">
|
|
256
|
-
{#if secondaryAction}
|
|
257
|
-
{@render secondaryAction()}
|
|
258
|
-
{:else if onSecondary}
|
|
259
|
-
<Button variant="outline" size="sm" class="shrink-0" onclick={handleSecondary}>
|
|
260
|
-
{messages.secondaryAction}
|
|
261
|
-
</Button>
|
|
355
|
+
</section>
|
|
262
356
|
{/if}
|
|
263
|
-
|
|
264
|
-
{#if
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
{
|
|
269
|
-
|
|
357
|
+
|
|
358
|
+
{#if showFooter}
|
|
359
|
+
<footer class="flex flex-wrap items-center gap-2 pt-1">
|
|
360
|
+
{#if secondaryAction}
|
|
361
|
+
{@render secondaryAction()}
|
|
362
|
+
{:else if onSecondary}
|
|
363
|
+
<Button variant="outline" size="sm" class="shrink-0" onclick={handleSecondary}>
|
|
364
|
+
{messages.secondaryAction}
|
|
365
|
+
</Button>
|
|
366
|
+
{/if}
|
|
367
|
+
<span class="min-w-0 flex-1" aria-hidden="true"></span>
|
|
368
|
+
{#if primaryAction}
|
|
369
|
+
{@render primaryAction()}
|
|
370
|
+
{:else if onPrimary}
|
|
371
|
+
<!-- Secondary, not the filled main button: the screen has its own main call to action, and a card must not add a
|
|
372
|
+
second one. -->
|
|
373
|
+
<Button variant="secondary" size="sm" class="shrink-0" onclick={handlePrimary}>
|
|
374
|
+
{messages.primaryAction}
|
|
375
|
+
</Button>
|
|
376
|
+
{/if}
|
|
377
|
+
</footer>
|
|
270
378
|
{/if}
|
|
271
|
-
</
|
|
379
|
+
</div>
|
|
272
380
|
{/if}
|
|
273
381
|
</div>
|
|
382
|
+
|
|
383
|
+
<style>
|
|
384
|
+
/* The dashed ring of the task being worked on turns once every 2.4s. It is paused, not reset, when the task stops being the active one,
|
|
385
|
+
so it does not snap back while it shrinks away. With reduced motion it stands still. */
|
|
386
|
+
.plan-card-working-ring {
|
|
387
|
+
animation: plan-card-working-ring-turn 2.4s linear infinite;
|
|
388
|
+
animation-play-state: paused;
|
|
389
|
+
}
|
|
390
|
+
[data-status='active'] .plan-card-working-ring {
|
|
391
|
+
animation-play-state: running;
|
|
392
|
+
}
|
|
393
|
+
@keyframes plan-card-working-ring-turn {
|
|
394
|
+
to {
|
|
395
|
+
transform: rotate(360deg);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
@media (prefers-reduced-motion: reduce) {
|
|
399
|
+
.plan-card-working-ring {
|
|
400
|
+
animation: none;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
</style>
|
|
@@ -24,12 +24,23 @@ export type PlanCardMessages = {
|
|
|
24
24
|
responsiveMobile: string;
|
|
25
25
|
responsiveTablet: string;
|
|
26
26
|
responsiveDesktop: string;
|
|
27
|
+
/** The word on the closed card while the plan is being written. */
|
|
28
|
+
planning: string;
|
|
29
|
+
/** Said before each task by a screen reader (the marks of the tasks are only drawn), so it hears where the task stands. */
|
|
30
|
+
taskPending: string;
|
|
31
|
+
taskActive: string;
|
|
32
|
+
taskDone: string;
|
|
27
33
|
};
|
|
28
34
|
type Props = HTMLAttributes<HTMLDivElement> & {
|
|
29
35
|
ref?: HTMLDivElement | null;
|
|
30
36
|
class?: string;
|
|
31
37
|
title: string;
|
|
32
38
|
tasks: PlanTask[];
|
|
39
|
+
/**
|
|
40
|
+
* True while the plan is still being written: the card is closed to a slim bar that says "Planning" in a shimmer, with no tasks and
|
|
41
|
+
* no progress yet. When it turns false the card opens, the title takes the place of the word and the progress arrives.
|
|
42
|
+
*/
|
|
43
|
+
planning?: boolean;
|
|
33
44
|
/** Shown in the header badge; defaults from active task index and task count. */
|
|
34
45
|
progressCurrent?: number;
|
|
35
46
|
progressTotal?: number;
|