@widgetic/design-system 0.5.22 → 0.5.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/components/CopyableHeader.svelte +260 -448
- package/dist/components/CopyableHeader.svelte.d.ts +8 -5
- package/dist/components/EmptyState.svelte +100 -128
- package/dist/components/EmptyState.svelte.d.ts +16 -19
- package/dist/components/GenerateLoader.svelte +17 -10
- package/dist/components/PasswordInput.svelte +41 -44
- package/dist/components/PasswordInput.svelte.d.ts +2 -0
- package/dist/components/ThumbHashImage.svelte +117 -119
- package/dist/components/WScrollArea.svelte +47 -41
- package/dist/components/chat/ActivityRow.svelte +115 -0
- package/dist/components/chat/ActivityRow.svelte.d.ts +18 -0
- package/dist/components/chat/ChatHeader.svelte +114 -0
- package/dist/components/chat/ChatHeader.svelte.d.ts +26 -0
- package/dist/components/chat/Composer.svelte +172 -0
- package/dist/components/chat/Composer.svelte.d.ts +27 -0
- package/dist/components/chat/Message.svelte +158 -0
- package/dist/components/chat/Message.svelte.d.ts +28 -0
- package/dist/components/chat/OptionRow.svelte +59 -0
- package/dist/components/chat/OptionRow.svelte.d.ts +14 -0
- package/dist/components/chat/PlanCard.svelte +220 -0
- package/dist/components/chat/PlanCard.svelte.d.ts +34 -0
- package/dist/components/chat/QuestionCard.svelte +265 -0
- package/dist/components/chat/QuestionCard.svelte.d.ts +38 -0
- package/dist/components/chat/ScrollToBottom.svelte +51 -0
- package/dist/components/chat/ScrollToBottom.svelte.d.ts +11 -0
- package/dist/components/chat/SuggestionCard.svelte +79 -0
- package/dist/components/chat/SuggestionCard.svelte.d.ts +20 -0
- package/dist/components/chat/TaskRow.svelte +59 -0
- package/dist/components/chat/TaskRow.svelte.d.ts +11 -0
- package/dist/components/chat/composerLogic.d.ts +16 -0
- package/dist/components/chat/composerLogic.js +29 -0
- package/dist/components/chat/index.d.ts +16 -0
- package/dist/components/chat/index.js +16 -0
- package/dist/components/chat/questionCardLogic.d.ts +11 -0
- package/dist/components/chat/questionCardLogic.js +39 -0
- package/dist/components/index.d.ts +10 -1
- package/dist/components/index.js +10 -0
- package/dist/components/modals/ActionModal.svelte +186 -180
- package/dist/components/modals/BaseModal.svelte +495 -401
- package/dist/components/modals/BaseModal.svelte.d.ts +4 -0
- package/dist/components/modals/NewItemDialog.svelte +198 -243
- package/dist/components/modals/Portal.svelte +109 -105
- package/dist/components/modals/README.md +16 -2
- package/dist/components/modals/RenameDialog.svelte +232 -292
- package/dist/components/modals/modalStore.d.ts +9 -1
- package/dist/components/modals/modalStore.js +44 -11
- package/dist/components/navigation/Breadcrumbs.svelte +421 -377
- package/dist/components/navigation/Breadcrumbs.svelte.d.ts +3 -2
- package/dist/components/navigation/breadcrumbsAvailableWidth.d.ts +10 -0
- package/dist/components/navigation/breadcrumbsAvailableWidth.js +10 -0
- package/dist/components/navigation/types.d.ts +2 -0
- package/dist/components/pdf/PDFViewer.svelte +1 -1
- package/dist/components/search-input/SearchInput.svelte +63 -104
- package/dist/components/search-input/SearchInput.svelte.d.ts +13 -27
- package/dist/components/search-input/index2.d.ts +14 -9
- package/dist/components/shad-editor/editor.css +1 -1
- package/dist/components/shad-editor/i18n/messages.d.ts +1 -1
- package/dist/components/shad-editor/i18n/messages.js +1 -1
- package/dist/components/shell/AppShell.svelte +52 -0
- package/dist/components/shell/AppShell.svelte.d.ts +13 -0
- package/dist/components/shell/Banner.svelte +90 -0
- package/dist/components/shell/Banner.svelte.d.ts +61 -0
- package/dist/components/shell/ErrorState.svelte +60 -0
- package/dist/components/shell/ErrorState.svelte.d.ts +13 -0
- package/dist/components/shell/Link.svelte +63 -0
- package/dist/components/shell/Link.svelte.d.ts +53 -0
- package/dist/components/shell/NavDrawer.svelte +117 -0
- package/dist/components/shell/NavDrawer.svelte.d.ts +10 -0
- package/dist/components/shell/NavRow.svelte +128 -0
- package/dist/components/shell/NavRow.svelte.d.ts +65 -0
- package/dist/components/shell/NavSectionLabel.svelte +27 -0
- package/dist/components/shell/NavSectionLabel.svelte.d.ts +9 -0
- package/dist/components/shell/NotificationRow.svelte +76 -0
- package/dist/components/shell/NotificationRow.svelte.d.ts +16 -0
- package/dist/components/shell/PageHeader.svelte +42 -0
- package/dist/components/shell/PageHeader.svelte.d.ts +12 -0
- package/dist/components/shell/ProfileRow.svelte +95 -0
- package/dist/components/shell/ProfileRow.svelte.d.ts +54 -0
- package/dist/components/shell/SettingsDialog.svelte +163 -0
- package/dist/components/shell/SettingsDialog.svelte.d.ts +19 -0
- package/dist/components/shell/SettingsNav.svelte +46 -0
- package/dist/components/shell/SettingsNav.svelte.d.ts +11 -0
- package/dist/components/shell/Sidebar.svelte +82 -0
- package/dist/components/shell/Sidebar.svelte.d.ts +25 -0
- package/dist/components/shell/Stat.svelte +63 -0
- package/dist/components/shell/Stat.svelte.d.ts +58 -0
- package/dist/components/shell/TopBar.svelte +37 -0
- package/dist/components/shell/TopBar.svelte.d.ts +11 -0
- package/dist/components/shell/WidgetRow.svelte +126 -0
- package/dist/components/shell/WidgetRow.svelte.d.ts +78 -0
- package/dist/components/shell/error-state-messages.d.ts +7 -0
- package/dist/components/shell/error-state-messages.js +9 -0
- package/dist/components/shell/index.d.ts +22 -0
- package/dist/components/shell/index.js +25 -0
- package/dist/components/shell/link-external.d.ts +2 -0
- package/dist/components/shell/link-external.js +7 -0
- package/dist/components/shell/messages.d.ts +7 -0
- package/dist/components/shell/messages.js +5 -0
- package/dist/components/shell/nested-modal-guard.d.ts +25 -0
- package/dist/components/shell/nested-modal-guard.js +33 -0
- package/dist/components/shell/settings-nav-types.d.ts +12 -0
- package/dist/components/shell/settings-nav-types.js +3 -0
- package/dist/components/shell/shell-utils.d.ts +7 -0
- package/dist/components/shell/shell-utils.js +27 -0
- package/dist/components/shell/stat-tone.d.ts +3 -0
- package/dist/components/shell/stat-tone.js +11 -0
- package/dist/components/toast/ToasterModal.svelte +102 -168
- package/dist/components/toast/ToasterModal.svelte.d.ts +2 -12
- package/dist/components/ui/accordion/accordion-content.svelte +3 -2
- package/dist/components/ui/accordion/accordion-item.svelte +10 -1
- package/dist/components/ui/accordion/accordion-trigger.svelte +4 -3
- package/dist/components/ui/alert/alert-description.svelte +5 -1
- package/dist/components/ui/alert/alert-title.svelte +2 -1
- package/dist/components/ui/alert/index.d.ts +13 -11
- package/dist/components/ui/alert/index.js +4 -4
- package/dist/components/ui/avatar/avatar-utils.d.ts +2 -0
- package/dist/components/ui/avatar/avatar-utils.js +9 -0
- package/dist/components/ui/avatar/avatar.svelte +63 -0
- package/dist/components/ui/avatar/avatar.svelte.d.ts +80 -0
- package/dist/components/ui/avatar/index.d.ts +4 -0
- package/dist/components/ui/avatar/index.js +4 -0
- package/dist/components/ui/badge/badge.svelte +22 -10
- package/dist/components/ui/badge/badge.svelte.d.ts +14 -15
- package/dist/components/ui/breadcrumb/breadcrumb-ellipsis.svelte +2 -2
- package/dist/components/ui/breadcrumb/breadcrumb-link.svelte +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb-page.svelte +1 -1
- package/dist/components/ui/breadcrumb/breadcrumb-separator.svelte +2 -2
- package/dist/components/ui/button/button-padding.d.ts +9 -0
- package/dist/components/ui/button/button-padding.js +15 -0
- package/dist/components/ui/button/button.svelte +81 -31
- package/dist/components/ui/button/button.svelte.d.ts +48 -29
- package/dist/components/ui/calendar/calendar-cell.svelte +1 -1
- package/dist/components/ui/calendar/calendar-head-cell.svelte +1 -1
- package/dist/components/ui/calendar/calendar-next-button.svelte +2 -2
- package/dist/components/ui/calendar/calendar-prev-button.svelte +2 -2
- package/dist/components/ui/calendar/calendar.svelte.d.ts +1 -1
- package/dist/components/ui/card/card-description.svelte +1 -1
- package/dist/components/ui/card/card-title.svelte +1 -1
- package/dist/components/ui/card/card.svelte +1 -1
- package/dist/components/ui/checkbox/checkbox.svelte +9 -5
- package/dist/components/ui/chip/chip.svelte +48 -0
- package/dist/components/ui/chip/chip.svelte.d.ts +13 -0
- package/dist/components/ui/chip/index.d.ts +2 -0
- package/dist/components/ui/chip/index.js +2 -0
- package/dist/components/ui/command/command-dialog.svelte +1 -1
- package/dist/components/ui/command/command-input.svelte +4 -4
- 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/command/command.svelte +1 -1
- package/dist/components/ui/dialog/dialog-content.svelte +11 -4
- package/dist/components/ui/dialog/dialog-description.svelte +1 -1
- package/dist/components/ui/dialog/dialog-overlay.svelte +8 -1
- package/dist/components/ui/dialog/dialog-title.svelte +1 -1
- package/dist/components/ui/drawer/drawer-content.svelte +1 -1
- package/dist/components/ui/drawer/drawer-overlay.svelte +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +5 -5
- package/dist/components/ui/dropdown-menu/dropdown-menu-content.svelte +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-item.svelte +20 -2
- package/dist/components/ui/dropdown-menu/dropdown-menu-item.svelte.d.ts +4 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu-label.svelte +5 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +3 -3
- package/dist/components/ui/dropdown-menu/dropdown-menu-separator.svelte +2 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +3 -3
- package/dist/components/ui/field/field-ids.d.ts +7 -0
- package/dist/components/ui/field/field-ids.js +15 -0
- package/dist/components/ui/field/field.svelte +62 -0
- package/dist/components/ui/field/field.svelte.d.ts +21 -0
- package/dist/components/ui/field/index.d.ts +3 -0
- package/dist/components/ui/field/index.js +3 -0
- package/dist/components/ui/hover-card/hover-card-content.svelte +1 -1
- package/dist/components/ui/icon-button/icon-button.svelte +72 -0
- package/dist/components/ui/icon-button/icon-button.svelte.d.ts +90 -0
- package/dist/components/ui/icon-button/index.d.ts +2 -0
- package/dist/components/ui/icon-button/index.js +4 -0
- package/dist/components/ui/input/index.d.ts +1 -0
- package/dist/components/ui/input/input.svelte +11 -4
- package/dist/components/ui/input/input.svelte.d.ts +4 -1
- package/dist/components/ui/input-otp/input-otp-separator.svelte +2 -2
- package/dist/components/ui/input-otp/input-otp-slot.svelte +5 -4
- package/dist/components/ui/input-otp/input-otp-slot.svelte.d.ts +1 -1
- package/dist/components/ui/input-otp/input-otp.svelte +1 -1
- package/dist/components/ui/label/label.svelte +3 -2
- package/dist/components/ui/popover/popover-content.svelte +1 -1
- package/dist/components/ui/progress/progress.svelte +19 -5
- package/dist/components/ui/progress/progress.svelte.d.ts +4 -2
- package/dist/components/ui/radio-group/radio-group-item.svelte +4 -4
- package/dist/components/ui/range-calendar/range-calendar-head-cell.svelte +1 -1
- package/dist/components/ui/range-calendar/range-calendar-next-button.svelte +2 -2
- package/dist/components/ui/range-calendar/range-calendar-prev-button.svelte +2 -2
- package/dist/components/ui/range-calendar/range-calendar.svelte.d.ts +1 -1
- package/dist/components/ui/scroll-area/scroll-area-scrollbar.svelte +4 -1
- package/dist/components/ui/scroll-area/scroll-area.svelte +1 -1
- package/dist/components/ui/select/select-content.svelte +1 -3
- package/dist/components/ui/select/select-item.svelte +5 -4
- package/dist/components/ui/select/select-scroll-down-button.svelte +2 -2
- package/dist/components/ui/select/select-scroll-up-button.svelte +2 -2
- package/dist/components/ui/select/select-trigger.svelte +4 -3
- package/dist/components/ui/skeleton/index.d.ts +2 -0
- package/dist/components/ui/skeleton/index.js +2 -0
- package/dist/components/ui/skeleton/skeleton.svelte +24 -0
- package/dist/components/ui/skeleton/skeleton.svelte.d.ts +8 -0
- package/dist/components/ui/slider/slider.svelte +5 -10
- package/dist/components/ui/sonner/sonner.svelte +19 -13
- package/dist/components/ui/stepper-button/index.d.ts +3 -0
- package/dist/components/ui/stepper-button/index.js +2 -0
- package/dist/components/ui/stepper-button/stepper-button.svelte +37 -0
- package/dist/components/ui/stepper-button/stepper-button.svelte.d.ts +9 -0
- package/dist/components/ui/switch/switch.svelte +8 -3
- package/dist/components/ui/table/table-cell.svelte +1 -1
- package/dist/components/ui/table/table-head.svelte +1 -1
- package/dist/components/ui/table/table-row.svelte +1 -1
- package/dist/components/ui/tabs/tabs-list.svelte +1 -1
- package/dist/components/ui/tabs/tabs-trigger.svelte +1 -1
- package/dist/components/ui/tag/index.d.ts +2 -0
- package/dist/components/ui/tag/index.js +2 -0
- package/dist/components/ui/tag/tag.svelte +42 -0
- package/dist/components/ui/tag/tag.svelte.d.ts +11 -0
- package/dist/components/ui/textarea/textarea.svelte +4 -3
- package/dist/components/ui/textarea/textarea.svelte.d.ts +2 -2
- package/dist/components/ui/toggle/toggle.svelte +9 -9
- package/dist/components/ui/toggle/toggle.svelte.d.ts +14 -21
- package/dist/components/ui/tooltip/tooltip-content.svelte +1 -1
- package/dist/fonts/Inter/Inter-Black.woff2 +0 -0
- package/dist/fonts/Inter/Inter-BlackItalic.woff2 +0 -0
- package/dist/fonts/Inter/Inter-Bold.woff2 +0 -0
- package/dist/fonts/Inter/Inter-BoldItalic.woff2 +0 -0
- package/dist/fonts/Inter/Inter-ExtraBold.woff2 +0 -0
- package/dist/fonts/Inter/Inter-ExtraBoldItalic.woff2 +0 -0
- package/dist/fonts/Inter/Inter-ExtraLight-BETA.woff2 +0 -0
- package/dist/fonts/Inter/Inter-ExtraLightItalic-BETA.woff2 +0 -0
- package/dist/fonts/Inter/Inter-Italic.woff2 +0 -0
- package/dist/fonts/Inter/Inter-Light-BETA.woff2 +0 -0
- package/dist/fonts/Inter/Inter-LightItalic-BETA.woff2 +0 -0
- package/dist/fonts/Inter/Inter-Medium.woff2 +0 -0
- package/dist/fonts/Inter/Inter-MediumItalic.woff2 +0 -0
- package/dist/fonts/Inter/Inter-Regular.woff2 +0 -0
- package/dist/fonts/Inter/Inter-SemiBold.woff2 +0 -0
- package/dist/fonts/Inter/Inter-SemiBoldItalic.woff2 +0 -0
- package/dist/fonts/Inter/Inter-Thin-BETA.woff2 +0 -0
- package/dist/fonts/Inter/Inter-ThinItalic-BETA.woff2 +0 -0
- package/dist/fonts/Inter/Inter-italic.var.woff2 +0 -0
- package/dist/fonts/Inter/Inter-upright.var.woff2 +0 -0
- package/dist/fonts/Inter/Inter.var.woff2 +0 -0
- package/dist/fonts/JetBrainsMono/JetBrainsMono-Regular.woff2 +0 -0
- package/dist/i18n/audit/designSystemWords.d.ts +1 -1
- package/dist/i18n/audit/designSystemWords.js +1 -1
- package/dist/styles/fonts.css +18 -14
- package/dist/styles/global.css +10 -21
- package/dist/styles/tokens.css +332 -0
- package/dist/utils/overlayMotion.d.ts +49 -0
- package/dist/utils/overlayMotion.js +71 -0
- package/dist/utils.d.ts +27 -0
- package/dist/utils.js +33 -2
- package/package.json +2 -1
- package/tailwind.config.ts +7 -47
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** Pure selection and keyboard helpers for QuestionCard. */
|
|
2
|
+
export function toggleOption(selected, optionId, multiple) {
|
|
3
|
+
if (multiple) {
|
|
4
|
+
return selected.includes(optionId)
|
|
5
|
+
? selected.filter((id) => id !== optionId)
|
|
6
|
+
: [...selected, optionId];
|
|
7
|
+
}
|
|
8
|
+
return [optionId];
|
|
9
|
+
}
|
|
10
|
+
export function moveFocusedIndex(current, direction, count) {
|
|
11
|
+
if (count <= 0)
|
|
12
|
+
return 0;
|
|
13
|
+
if (direction === 'up') {
|
|
14
|
+
return current <= 0 ? count - 1 : current - 1;
|
|
15
|
+
}
|
|
16
|
+
return current >= count - 1 ? 0 : current + 1;
|
|
17
|
+
}
|
|
18
|
+
export function canSubmitQuestion(selected) {
|
|
19
|
+
return selected.length > 0;
|
|
20
|
+
}
|
|
21
|
+
export function selectionRole(multiple) {
|
|
22
|
+
return multiple ? 'group' : 'radiogroup';
|
|
23
|
+
}
|
|
24
|
+
export function optionItemRole(multiple) {
|
|
25
|
+
return multiple ? 'checkbox' : 'radio';
|
|
26
|
+
}
|
|
27
|
+
/** Format the step line (1-based `current`). */
|
|
28
|
+
export function formatQuestionStep(template, current, total) {
|
|
29
|
+
return template.replace('{current}', String(current)).replace('{total}', String(total));
|
|
30
|
+
}
|
|
31
|
+
export function isFirstQuestion(index) {
|
|
32
|
+
return index <= 0;
|
|
33
|
+
}
|
|
34
|
+
export function isLastQuestion(index, total) {
|
|
35
|
+
return total <= 0 || index >= total - 1;
|
|
36
|
+
}
|
|
37
|
+
export function primaryQuestionLabel(isLast, nextLabel, submitLabel) {
|
|
38
|
+
return isLast ? submitLabel : nextLabel;
|
|
39
|
+
}
|
|
@@ -4,32 +4,38 @@ export { default as GenerateLoader } from './GenerateLoader.svelte';
|
|
|
4
4
|
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
|
+
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';
|
|
7
8
|
export { default as DebugGrid } from './debug-grid/DebugGrid.svelte';
|
|
8
9
|
export { default as BrowserInputController } from './ic/browser/BrowserInputController.svelte';
|
|
9
10
|
export { default as ActionModal } from './modals/ActionModal.svelte';
|
|
10
11
|
export { default as BaseModal } from './modals/BaseModal.svelte';
|
|
11
12
|
export { default as NewItemDialog } from './modals/NewItemDialog.svelte';
|
|
12
|
-
export type { NewItemDialogMessages, RenameDialogMessages } from './modals/messages';
|
|
13
13
|
export { default as Portal } from './modals/Portal.svelte';
|
|
14
14
|
export { default as RenameDialog } from './modals/RenameDialog.svelte';
|
|
15
15
|
export { Breadcrumbs, type BreadcrumbsProps } from './navigation';
|
|
16
16
|
export { default as PDFViewer } from './pdf/PDFViewer.svelte';
|
|
17
17
|
export { SearchInput } from './search-input';
|
|
18
|
+
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, type SettingsDialogMessages, defaultSettingsDialogMessages } from './shell';
|
|
18
20
|
export { ToasterModal, showToast } from './toast';
|
|
19
21
|
export * as Accordion from './ui/accordion';
|
|
20
22
|
export * as Alert from './ui/alert';
|
|
23
|
+
export { avatarInitials, avatarVariants, type AvatarSize, Avatar } from './ui/avatar';
|
|
21
24
|
export { Badge, badgeVariants, type BadgeVariant } from './ui/badge';
|
|
22
25
|
export * as Breadcrumb from './ui/breadcrumb';
|
|
23
26
|
export { type Props, Button, buttonVariants, type ButtonProps, type ButtonSize, type ButtonVariant } from './ui/button';
|
|
24
27
|
export { Calendar } from './ui/calendar';
|
|
25
28
|
export * as Card from './ui/card';
|
|
26
29
|
export { Checkbox } from './ui/checkbox';
|
|
30
|
+
export { Chip } from './ui/chip';
|
|
27
31
|
export * as Collapsible from './ui/collapsible';
|
|
28
32
|
export * as Command from './ui/command';
|
|
29
33
|
export * as Dialog from './ui/dialog';
|
|
30
34
|
export * as Drawer from './ui/drawer';
|
|
31
35
|
export * as DropdownMenu from './ui/dropdown-menu';
|
|
36
|
+
export { createFieldIds, fieldDescribedBy, type FieldIds, Field } from './ui/field';
|
|
32
37
|
export * as HoverCard from './ui/hover-card';
|
|
38
|
+
export { IconButton, iconButtonVariants, type IconButtonProps, type IconButtonSize, type IconButtonVariant } from './ui/icon-button';
|
|
33
39
|
export { Input } from './ui/input';
|
|
34
40
|
export * as InputOtp from './ui/input-otp';
|
|
35
41
|
export { Label } from './ui/label';
|
|
@@ -40,11 +46,14 @@ export { RangeCalendar } from './ui/range-calendar';
|
|
|
40
46
|
export { ScrollArea, ScrollAreaScrollbar } from './ui/scroll-area';
|
|
41
47
|
export * as Select from './ui/select';
|
|
42
48
|
export { Separator } from './ui/separator';
|
|
49
|
+
export { Skeleton } from './ui/skeleton';
|
|
43
50
|
export { Slider, type SliderProps } from './ui/slider';
|
|
44
51
|
export { Toaster, toast } from './ui/sonner';
|
|
52
|
+
export { StepperButton } from './ui/stepper-button';
|
|
45
53
|
export { Switch } from './ui/switch';
|
|
46
54
|
export * as Table from './ui/table';
|
|
47
55
|
export * as Tabs from './ui/tabs';
|
|
56
|
+
export { Tag } from './ui/tag';
|
|
48
57
|
export { Textarea, type TextareaEvents, type FormTextareaEvent } from './ui/textarea';
|
|
49
58
|
export { toggleVariants, type ToggleSize, type ToggleVariant, type ToggleVariants, Toggle } from './ui/toggle';
|
|
50
59
|
export * as ToggleGroup from './ui/toggle-group';
|
package/dist/components/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export { default as GenerateLoader } from './GenerateLoader.svelte';
|
|
|
5
5
|
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
|
+
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';
|
|
8
9
|
export { default as DebugGrid } from './debug-grid/DebugGrid.svelte';
|
|
9
10
|
export { default as BrowserInputController } from './ic/browser/BrowserInputController.svelte';
|
|
10
11
|
export { default as ActionModal } from './modals/ActionModal.svelte';
|
|
@@ -15,21 +16,27 @@ export { default as RenameDialog } from './modals/RenameDialog.svelte';
|
|
|
15
16
|
export { Breadcrumbs } from './navigation';
|
|
16
17
|
export { default as PDFViewer } from './pdf/PDFViewer.svelte';
|
|
17
18
|
export { SearchInput } from './search-input';
|
|
19
|
+
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, defaultSettingsDialogMessages } from './shell';
|
|
18
21
|
export { ToasterModal, showToast } from './toast';
|
|
19
22
|
export * as Accordion from './ui/accordion';
|
|
20
23
|
export * as Alert from './ui/alert';
|
|
24
|
+
export { avatarInitials, avatarVariants, Avatar } from './ui/avatar';
|
|
21
25
|
export { Badge, badgeVariants } from './ui/badge';
|
|
22
26
|
export * as Breadcrumb from './ui/breadcrumb';
|
|
23
27
|
export { Button, buttonVariants } from './ui/button';
|
|
24
28
|
export { Calendar } from './ui/calendar';
|
|
25
29
|
export * as Card from './ui/card';
|
|
26
30
|
export { Checkbox } from './ui/checkbox';
|
|
31
|
+
export { Chip } from './ui/chip';
|
|
27
32
|
export * as Collapsible from './ui/collapsible';
|
|
28
33
|
export * as Command from './ui/command';
|
|
29
34
|
export * as Dialog from './ui/dialog';
|
|
30
35
|
export * as Drawer from './ui/drawer';
|
|
31
36
|
export * as DropdownMenu from './ui/dropdown-menu';
|
|
37
|
+
export { createFieldIds, fieldDescribedBy, Field } from './ui/field';
|
|
32
38
|
export * as HoverCard from './ui/hover-card';
|
|
39
|
+
export { IconButton, iconButtonVariants } from './ui/icon-button';
|
|
33
40
|
export { Input } from './ui/input';
|
|
34
41
|
export * as InputOtp from './ui/input-otp';
|
|
35
42
|
export { Label } from './ui/label';
|
|
@@ -40,11 +47,14 @@ export { RangeCalendar } from './ui/range-calendar';
|
|
|
40
47
|
export { ScrollArea, ScrollAreaScrollbar } from './ui/scroll-area';
|
|
41
48
|
export * as Select from './ui/select';
|
|
42
49
|
export { Separator } from './ui/separator';
|
|
50
|
+
export { Skeleton } from './ui/skeleton';
|
|
43
51
|
export { Slider } from './ui/slider';
|
|
44
52
|
export { Toaster, toast } from './ui/sonner';
|
|
53
|
+
export { StepperButton } from './ui/stepper-button';
|
|
45
54
|
export { Switch } from './ui/switch';
|
|
46
55
|
export * as Table from './ui/table';
|
|
47
56
|
export * as Tabs from './ui/tabs';
|
|
57
|
+
export { Tag } from './ui/tag';
|
|
48
58
|
export { Textarea } from './ui/textarea';
|
|
49
59
|
export { toggleVariants, Toggle } from './ui/toggle';
|
|
50
60
|
export * as ToggleGroup from './ui/toggle-group';
|
|
@@ -1,187 +1,193 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
2
|
+
// Svelte imports
|
|
3
|
+
import { createEventDispatcher, onMount } from 'svelte';
|
|
4
|
+
const dispatch = createEventDispatcher();
|
|
5
|
+
|
|
6
|
+
// Local imports
|
|
7
|
+
import { Button } from '../ui/button';
|
|
8
|
+
import { toast } from '../ui/sonner';
|
|
9
|
+
import BaseModal from './BaseModal.svelte';
|
|
10
|
+
|
|
11
|
+
// For debugging
|
|
12
|
+
const showLogs = true; // You can set to true when debugging
|
|
13
|
+
|
|
14
|
+
// Props
|
|
15
|
+
let className = '';
|
|
16
|
+
export { className as class };
|
|
17
|
+
export let style: string = '';
|
|
18
|
+
//
|
|
19
|
+
export let isOpen = false;
|
|
20
|
+
export let items: any[] = [];
|
|
21
|
+
export let title: string = '';
|
|
22
|
+
export let message: string = '';
|
|
23
|
+
export let confirmLabel: string = 'Confirm';
|
|
24
|
+
export let onConfirm: () => Promise<any> = async () => {};
|
|
25
|
+
export let cancelLabel: string = 'Cancel';
|
|
26
|
+
// The words a screen reader says for the close button (see BaseModal)
|
|
27
|
+
export let closeLabel: string = 'Close modal';
|
|
28
|
+
export let onCancel: () => void = () => {};
|
|
29
|
+
export let width: string = '400px';
|
|
30
|
+
export let height: string = '168px';
|
|
31
|
+
export let target: string = 'action-confirmation-modal'; // target for Portal
|
|
32
|
+
export let isConfirmDisabled: boolean = false;
|
|
33
|
+
/** When false, a failed confirm can leave the dialog open. Callers close it themselves. */
|
|
34
|
+
export let closeOnConfirm: boolean = true;
|
|
35
|
+
export let confirmVariant: 'primary' | 'attention' = 'primary';
|
|
36
|
+
export let actionType: string = 'confirm';
|
|
37
|
+
|
|
38
|
+
// For backwards compatibility with specific implementations
|
|
39
|
+
export let modalType: string = 'actionConfirmation';
|
|
40
|
+
export let modalData: any = null;
|
|
41
|
+
|
|
42
|
+
/* INTERNAL STATE */
|
|
43
|
+
let confirmResult: string = '';
|
|
44
|
+
let isInitialized = false;
|
|
45
|
+
|
|
46
|
+
// Only initialize once mounted
|
|
47
|
+
onMount(() => {
|
|
48
|
+
isInitialized = true;
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Initialize modalData with our current props if not provided externally
|
|
52
|
+
// Only do this when modal is actually open
|
|
53
|
+
$: if (isOpen && isInitialized && modalData === null) {
|
|
54
|
+
modalData = {
|
|
55
|
+
items,
|
|
56
|
+
title,
|
|
57
|
+
message,
|
|
58
|
+
confirmLabel,
|
|
59
|
+
cancelLabel,
|
|
60
|
+
confirmVariant,
|
|
61
|
+
actionType
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Check if buttons are present
|
|
66
|
+
$: hasButtons = cancelLabel || confirmLabel;
|
|
67
|
+
|
|
68
|
+
function handleClose(event: Event) {
|
|
69
|
+
isOpen = false;
|
|
70
|
+
onCancel();
|
|
71
|
+
dispatch('cancel');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function handleConfirm() {
|
|
75
|
+
// call the onConfirm handler
|
|
76
|
+
let result = await onConfirm();
|
|
77
|
+
confirmResult = result || '';
|
|
78
|
+
|
|
79
|
+
// Dispatch a confirmation event with all items
|
|
80
|
+
dispatch('confirm', { items });
|
|
81
|
+
|
|
82
|
+
// Callers that show an error inside the dialog set closeOnConfirm to false.
|
|
83
|
+
if (closeOnConfirm) isOpen = false;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Support for restoring modal state
|
|
87
|
+
function handleRestore(event: CustomEvent) {
|
|
88
|
+
// Skip restoration if modal isn't initialized
|
|
89
|
+
if (!isInitialized) return;
|
|
90
|
+
|
|
91
|
+
if (event.detail) {
|
|
92
|
+
const data = event.detail;
|
|
93
|
+
|
|
94
|
+
// Only process items if modal is actually open
|
|
95
|
+
if (isOpen && data.items) {
|
|
96
|
+
if (Array.isArray(data.items)) {
|
|
97
|
+
items = data.items;
|
|
98
|
+
} else if (typeof data.items === 'object') {
|
|
99
|
+
items = [data.items];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (data.title) title = data.title;
|
|
104
|
+
if (data.message) message = data.message;
|
|
105
|
+
if (data.confirmLabel) confirmLabel = data.confirmLabel;
|
|
106
|
+
if (data.cancelLabel) cancelLabel = data.cancelLabel;
|
|
107
|
+
if (data.confirmVariant) confirmVariant = data.confirmVariant;
|
|
108
|
+
if (data.actionType) actionType = data.actionType;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Only log when modal is actually open
|
|
113
|
+
$: if (isOpen && isInitialized && items && items.length > 0 && showLogs) {
|
|
114
|
+
// console.log('Items in open modal:', items);
|
|
115
|
+
// console.log('First item name:', items[0]?.name);
|
|
116
|
+
}
|
|
117
117
|
</script>
|
|
118
118
|
|
|
119
|
-
<BaseModal
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
class={!hasButtons ? 'no-buttons' : ''}
|
|
119
|
+
<BaseModal
|
|
120
|
+
bind:open={isOpen}
|
|
121
|
+
on:close={handleClose}
|
|
122
|
+
{target}
|
|
123
|
+
{title}
|
|
124
|
+
{width}
|
|
125
|
+
{height}
|
|
126
|
+
{closeLabel}
|
|
127
|
+
{modalType}
|
|
128
|
+
{modalData}
|
|
129
|
+
on:restore={handleRestore}
|
|
130
|
+
class={!hasButtons ? 'no-buttons' : ''}
|
|
132
131
|
>
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
132
|
+
<div
|
|
133
|
+
class="{className
|
|
134
|
+
? `${className} `
|
|
135
|
+
: ''}action-modal-container flex flex-col gap-4 {!hasButtons ? 'pb-0' : ''}"
|
|
136
|
+
{style}
|
|
137
|
+
>
|
|
138
|
+
<!-- Message Container -->
|
|
139
|
+
{#if message}
|
|
140
|
+
<p class="text-body text-muted-foreground text-start">
|
|
141
|
+
{message}
|
|
142
|
+
</p>
|
|
143
|
+
{/if}
|
|
144
|
+
|
|
145
|
+
<!-- Slot for custom content -->
|
|
146
|
+
<slot></slot>
|
|
147
|
+
|
|
148
|
+
<!-- Buttons Container - Only show if at least one button label is provided -->
|
|
149
|
+
{#if hasButtons}
|
|
150
|
+
<div class="buttons-container flex justify-end gap-2">
|
|
151
|
+
{#if cancelLabel}
|
|
152
|
+
<Button
|
|
153
|
+
type="button"
|
|
154
|
+
variant="outline"
|
|
155
|
+
class="cancel-button"
|
|
156
|
+
onclick={handleClose}
|
|
157
|
+
>
|
|
158
|
+
{cancelLabel}
|
|
159
|
+
</Button>
|
|
160
|
+
{/if}
|
|
161
|
+
{#if confirmLabel}
|
|
162
|
+
<Button
|
|
163
|
+
type="button"
|
|
164
|
+
variant={confirmVariant === 'attention' ? 'destructive' : 'default'}
|
|
165
|
+
class="confirm-button"
|
|
166
|
+
onclick={handleConfirm}
|
|
167
|
+
disabled={isConfirmDisabled}
|
|
168
|
+
>
|
|
169
|
+
{confirmLabel}
|
|
170
|
+
</Button>
|
|
171
|
+
{/if}
|
|
172
|
+
</div>
|
|
173
|
+
{/if}
|
|
174
|
+
|
|
175
|
+
<!-- Update result box - Only show if there's a result -->
|
|
176
|
+
{#if confirmResult}
|
|
177
|
+
<p
|
|
178
|
+
class="text-caption mt-4 text-center"
|
|
179
|
+
class:text-brand={!confirmResult.startsWith('Error')}
|
|
180
|
+
class:text-destructive={confirmResult.startsWith('Error')}
|
|
181
|
+
>
|
|
182
|
+
{@html confirmResult}
|
|
183
|
+
</p>
|
|
184
|
+
{/if}
|
|
185
|
+
</div>
|
|
180
186
|
</BaseModal>
|
|
181
187
|
|
|
182
188
|
<style>
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
</style>
|
|
189
|
+
/* Remove bottom padding when no buttons are present */
|
|
190
|
+
:global(.no-buttons .modal-content-inner-container) {
|
|
191
|
+
padding-bottom: 0 !important;
|
|
192
|
+
}
|
|
193
|
+
</style>
|