@makolabs/ripple 2.5.8 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +403 -497
- package/dist/adapters/storage/S3Adapter.d.ts +49 -1
- package/dist/adapters/storage/S3Adapter.js +38 -1
- package/dist/adapters/storage/types.d.ts +20 -0
- package/dist/ai/AIChatInterface.svelte +2 -1
- package/dist/ai/AIChatInterface.svelte.d.ts +2 -1
- package/dist/ai/CodeRenderer.svelte +7 -2
- package/dist/ai/CodeRenderer.svelte.d.ts +2 -1
- package/dist/ai/ComposeDropdown.svelte +1 -1
- package/dist/ai/MessageBox.svelte +3 -3
- package/dist/ai/MessageBox.svelte.d.ts +3 -2
- package/dist/ai/ThinkingDisplay.svelte +4 -3
- package/dist/ai/ThinkingDisplay.svelte.d.ts +2 -1
- package/dist/ai/ai-types.d.ts +55 -1
- package/dist/button/Button.svelte +5 -5
- package/dist/button/button-types.d.ts +49 -4
- package/dist/button/button.d.ts +9 -9
- package/dist/button/button.js +6 -6
- package/dist/charts/Chart.svelte +8 -16
- package/dist/charts/chart-types.d.ts +78 -1
- package/dist/drawer/Drawer.svelte +6 -26
- package/dist/drawer/drawer-types.d.ts +33 -12
- package/dist/drawer/drawer.d.ts +3 -3
- package/dist/drawer/drawer.js +1 -1
- package/dist/elements/accordion/Accordion.svelte +6 -17
- package/dist/elements/accordion/accordion-types.d.ts +53 -6
- package/dist/elements/alert/Alert.svelte +3 -0
- package/dist/elements/badge/Badge.svelte +1 -1
- package/dist/elements/badge/badge-types.d.ts +22 -0
- package/dist/elements/badge/badge.d.ts +3 -3
- package/dist/elements/badge/badge.js +1 -1
- package/dist/elements/combobox/ComboBox.svelte +247 -0
- package/dist/elements/combobox/ComboBox.svelte.d.ts +4 -0
- package/dist/elements/combobox/combobox-types.d.ts +41 -0
- package/dist/elements/combobox/combobox-types.js +1 -0
- package/dist/elements/context-menu/ContextMenu.svelte +137 -0
- package/dist/elements/context-menu/ContextMenu.svelte.d.ts +4 -0
- package/dist/elements/context-menu/context-menu-types.d.ts +40 -0
- package/dist/elements/context-menu/context-menu-types.js +1 -0
- package/dist/elements/dropdown/Dropdown.svelte +1 -1
- package/dist/elements/dropdown/Select.svelte +4 -1
- package/dist/elements/dropdown/dropdown-types.d.ts +114 -0
- package/dist/elements/dropdown/dropdown.d.ts +3 -3
- package/dist/elements/dropdown/dropdown.js +2 -2
- package/dist/elements/dropdown/select.d.ts +3 -3
- package/dist/elements/dropdown/select.js +2 -2
- package/dist/elements/empty-state/EmptyState.svelte +1 -1
- package/dist/elements/empty-state/empty-state-types.d.ts +32 -1
- package/dist/elements/empty-state/empty-state.d.ts +3 -3
- package/dist/elements/empty-state/empty-state.js +2 -2
- package/dist/elements/file-upload/FileUpload.svelte +5 -0
- package/dist/elements/file-upload/file-upload-types.d.ts +59 -0
- package/dist/elements/pagination/Pagination.svelte +53 -21
- package/dist/elements/pagination/Pagination.svelte.d.ts +33 -5
- package/dist/elements/popover/Popover.svelte +234 -0
- package/dist/elements/popover/Popover.svelte.d.ts +4 -0
- package/dist/elements/popover/index.d.ts +2 -0
- package/dist/elements/popover/index.js +1 -0
- package/dist/elements/popover/popover-types.d.ts +60 -0
- package/dist/elements/popover/popover-types.js +1 -0
- package/dist/elements/progress/Progress.svelte +32 -7
- package/dist/elements/progress/progress-types.d.ts +48 -1
- package/dist/elements/skeleton/Skeleton.svelte +56 -0
- package/dist/elements/skeleton/Skeleton.svelte.d.ts +4 -0
- package/dist/elements/skeleton/index.d.ts +2 -0
- package/dist/elements/skeleton/index.js +1 -0
- package/dist/elements/skeleton/skeleton-types.d.ts +50 -0
- package/dist/elements/skeleton/skeleton-types.js +1 -0
- package/dist/elements/spinner/Spinner.svelte +1 -1
- package/dist/elements/spinner/spinner-types.d.ts +20 -0
- package/dist/elements/spinner/spinner.d.ts +3 -3
- package/dist/elements/spinner/spinner.js +2 -2
- package/dist/elements/tooltip/Tooltip.svelte +108 -11
- package/dist/elements/tooltip/tooltip-types.d.ts +49 -1
- package/dist/file-browser/FileBrowser.svelte +21 -12
- package/dist/filters/CompactFilters.svelte +221 -33
- package/dist/filters/CompactFilters.svelte.d.ts +1 -1
- package/dist/filters/FilterBar.svelte +184 -0
- package/dist/filters/FilterBar.svelte.d.ts +4 -0
- package/dist/filters/FilterPopover.svelte +346 -0
- package/dist/filters/FilterPopover.svelte.d.ts +4 -0
- package/dist/filters/date-presets.d.ts +15 -0
- package/dist/filters/date-presets.js +107 -0
- package/dist/filters/filter-types.d.ts +69 -3
- package/dist/filters/index.d.ts +5 -0
- package/dist/filters/index.js +4 -0
- package/dist/filters/sync-filters-to-url.svelte.d.ts +37 -0
- package/dist/filters/sync-filters-to-url.svelte.js +114 -0
- package/dist/forms/DateRange.svelte +4 -2
- package/dist/forms/Input.svelte +2 -2
- package/dist/forms/MarketSelector.svelte +8 -3
- package/dist/forms/NumberInput.svelte +4 -4
- package/dist/forms/RadioGroup.svelte +123 -0
- package/dist/forms/RadioGroup.svelte.d.ts +4 -0
- package/dist/forms/SegmentedControl.svelte +11 -4
- package/dist/forms/Slider.svelte +72 -3
- package/dist/forms/Tags.svelte +14 -5
- package/dist/forms/Textarea.svelte +126 -0
- package/dist/forms/Textarea.svelte.d.ts +4 -0
- package/dist/forms/Toggle.svelte +8 -8
- package/dist/forms/calendar/Calendar.svelte +218 -0
- package/dist/forms/calendar/Calendar.svelte.d.ts +4 -0
- package/dist/forms/calendar/calendar-types.d.ts +46 -0
- package/dist/forms/calendar/calendar-types.js +1 -0
- package/dist/forms/calendar/index.d.ts +2 -0
- package/dist/forms/calendar/index.js +1 -0
- package/dist/forms/date-picker/DatePicker.svelte +144 -0
- package/dist/forms/date-picker/DatePicker.svelte.d.ts +4 -0
- package/dist/forms/date-picker/date-picker-types.d.ts +29 -0
- package/dist/forms/date-picker/date-picker-types.js +1 -0
- package/dist/forms/form-types.d.ts +425 -6
- package/dist/forms/market/market-selector-types.d.ts +52 -1
- package/dist/forms/segmented-control.d.ts +5 -2
- package/dist/forms/segmented-control.js +16 -5
- package/dist/forms/slider.d.ts +3 -3
- package/dist/forms/slider.js +2 -2
- package/dist/funcs/user-management.remote.d.ts +1 -1
- package/dist/funcs/user-management.remote.js +2 -2
- package/dist/header/Breadcrumbs.svelte +4 -20
- package/dist/header/PageHeader.svelte +6 -14
- package/dist/header/breadcrumbs.d.ts +3 -11
- package/dist/header/breadcrumbs.js +10 -5
- package/dist/header/header-types.d.ts +62 -11
- package/dist/index.d.ts +35 -9
- package/dist/index.js +24 -4
- package/dist/layout/activity-list/ActivityList.svelte +13 -7
- package/dist/layout/activity-list/activity-list-types.d.ts +46 -7
- package/dist/layout/card/Card.svelte +12 -15
- package/dist/layout/card/MetricCard.svelte +50 -32
- package/dist/layout/card/card-types.d.ts +114 -4
- package/dist/layout/navbar/navbar-types.d.ts +48 -0
- package/dist/layout/navbar/navbar.d.ts +3 -3
- package/dist/layout/navbar/navbar.js +2 -2
- package/dist/layout/sidebar/Sidebar.svelte +87 -11
- package/dist/layout/sidebar/sidebar-types.d.ts +60 -1
- package/dist/layout/stepper/Stepper.svelte +288 -0
- package/dist/layout/stepper/Stepper.svelte.d.ts +4 -0
- package/dist/layout/stepper/stepper-types.d.ts +80 -0
- package/dist/layout/stepper/stepper-types.js +1 -0
- package/dist/layout/table/Table.svelte +91 -85
- package/dist/layout/table/table-types.d.ts +148 -24
- package/dist/layout/table/table.d.ts +3 -3
- package/dist/layout/table/table.js +2 -2
- package/dist/layout/tabs/Tab.svelte +6 -2
- package/dist/layout/tabs/Tab.svelte.d.ts +4 -1
- package/dist/layout/tabs/TabGroup.svelte +9 -2
- package/dist/layout/tabs/tabs-types.d.ts +63 -0
- package/dist/layout/tabs/tabs.d.ts +3 -3
- package/dist/layout/tabs/tabs.js +12 -6
- package/dist/modal/ConfirmDialog.svelte +65 -0
- package/dist/modal/ConfirmDialog.svelte.d.ts +4 -0
- package/dist/modal/Modal.svelte +6 -26
- package/dist/modal/confirm-dialog-types.d.ts +39 -0
- package/dist/modal/confirm-dialog-types.js +1 -0
- package/dist/modal/modal-types.d.ts +51 -12
- package/dist/modal/modal.d.ts +3 -3
- package/dist/modal/modal.js +3 -3
- package/dist/pipeline/Pipeline.svelte +8 -3
- package/dist/pipeline/pipeline-types.d.ts +55 -3
- package/dist/pipeline/pipeline.d.ts +18 -3
- package/dist/pipeline/pipeline.js +7 -2
- package/dist/server/s3.d.ts +35 -3
- package/dist/sonner/Toaster.svelte +29 -0
- package/dist/sonner/Toaster.svelte.d.ts +4 -0
- package/dist/sonner/index.d.ts +21 -0
- package/dist/sonner/index.js +20 -0
- package/dist/user-management/UserManagement.svelte +22 -16
- package/dist/user-management/UserModal.svelte +10 -7
- package/dist/user-management/UserTable.svelte +16 -17
- package/dist/user-management/UserViewModal.svelte +11 -11
- package/dist/user-management/user-management-types.d.ts +118 -31
- package/dist/variants.d.ts +1 -1
- package/dist/variants.js +1 -1
- package/package.json +7 -4
- package/dist/config/ai.d.ts +0 -13
- package/dist/config/ai.js +0 -44
- package/dist/elements/empty-state/EmptyStateTestWrapper.svelte +0 -25
- package/dist/elements/empty-state/EmptyStateTestWrapper.svelte.d.ts +0 -8
- package/dist/elements/tooltip/TooltipTestWrapper.svelte +0 -14
- package/dist/elements/tooltip/TooltipTestWrapper.svelte.d.ts +0 -7
- package/dist/helper/deprecation.d.ts +0 -14
- package/dist/helper/deprecation.js +0 -24
- package/dist/modal/ModalFooterTestWrapper.svelte +0 -17
- package/dist/modal/ModalFooterTestWrapper.svelte.d.ts +0 -8
|
@@ -2,40 +2,103 @@ import type { ClassValue } from 'tailwind-variants';
|
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { Component } from 'svelte';
|
|
4
4
|
import type { VariantColors, VariantSizes } from '../../index.js';
|
|
5
|
+
/** Single tab in a `<TabGroup>`. */
|
|
5
6
|
export type TabItem = {
|
|
7
|
+
/** Underlying value — what you bind to. */
|
|
6
8
|
value: string;
|
|
9
|
+
/** Visible tab label. */
|
|
7
10
|
label: string;
|
|
11
|
+
/** Optional icon rendered before the label. */
|
|
8
12
|
icon?: Component;
|
|
9
13
|
disabled?: boolean;
|
|
10
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Props for `<Tab>` — a single tab trigger. Usually consumed via
|
|
17
|
+
* `<TabGroup>` rather than directly, but exposed for custom compositions.
|
|
18
|
+
*/
|
|
11
19
|
export type TabProps = {
|
|
12
20
|
value: string;
|
|
13
21
|
label: string;
|
|
14
22
|
icon?: Component;
|
|
23
|
+
/** Whether this tab is currently selected. */
|
|
15
24
|
selected?: boolean;
|
|
16
25
|
disabled?: boolean;
|
|
17
26
|
color?: VariantColors;
|
|
18
27
|
size?: VariantSizes;
|
|
28
|
+
/**
|
|
29
|
+
* Visual treatment:
|
|
30
|
+
* - `'line'` (default) — underline under the active tab
|
|
31
|
+
* - `'pill'` — rounded pill for the active tab
|
|
32
|
+
*/
|
|
19
33
|
variant?: 'line' | 'pill';
|
|
20
34
|
onclick?: (event: Event) => void;
|
|
21
35
|
testId?: string;
|
|
22
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* Props for `<TabGroup>` — a tabbed panel container. Pair with
|
|
39
|
+
* `<TabContent>` children to switch between panels.
|
|
40
|
+
*
|
|
41
|
+
* For radio-style one-of-many selection without panels, use
|
|
42
|
+
* `<SegmentedControl>` instead.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```svelte
|
|
46
|
+
* <script lang="ts">
|
|
47
|
+
* import { TabGroup, TabContent } from '@makolabs/ripple';
|
|
48
|
+
* let active = $state('overview');
|
|
49
|
+
* </script>
|
|
50
|
+
*
|
|
51
|
+
* <TabGroup
|
|
52
|
+
* tabs={[
|
|
53
|
+
* { value: 'overview', label: 'Overview' },
|
|
54
|
+
* { value: 'billing', label: 'Billing' },
|
|
55
|
+
* { value: 'team', label: 'Team' }
|
|
56
|
+
* ]}
|
|
57
|
+
* bind:selected={active}
|
|
58
|
+
* >
|
|
59
|
+
* <TabContent value="overview">Overview content…</TabContent>
|
|
60
|
+
* <TabContent value="billing">Billing content…</TabContent>
|
|
61
|
+
* <TabContent value="team">Team content…</TabContent>
|
|
62
|
+
* </TabGroup>
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
23
65
|
export type TabsGroupProps = {
|
|
24
66
|
tabs: TabItem[];
|
|
67
|
+
/** Bindable currently-selected tab value. */
|
|
25
68
|
selected?: string;
|
|
26
69
|
color?: VariantColors;
|
|
27
70
|
size?: VariantSizes;
|
|
71
|
+
/** @default 'line' */
|
|
28
72
|
variant?: 'line' | 'pill';
|
|
29
73
|
class?: ClassValue;
|
|
74
|
+
/** Classes on the tab list row. */
|
|
30
75
|
listClass?: ClassValue;
|
|
76
|
+
/** Classes on each tab button. */
|
|
31
77
|
triggerClass?: ClassValue;
|
|
78
|
+
/** Classes on the panel container. */
|
|
32
79
|
panelClass?: ClassValue;
|
|
80
|
+
/**
|
|
81
|
+
* Content snippet receiving the active tab value. Typically rendered
|
|
82
|
+
* as `<TabContent>` children, but can be any markup.
|
|
83
|
+
*/
|
|
33
84
|
children?: Snippet<[active: string]>;
|
|
85
|
+
/** Fires on selection change. */
|
|
34
86
|
onchange?: (value: string) => void;
|
|
35
87
|
testId?: string;
|
|
36
88
|
};
|
|
89
|
+
/**
|
|
90
|
+
* Props for `<TabContent>` — one panel inside a `<TabGroup>`. Only the
|
|
91
|
+
* active panel is rendered; setting `persisted` keeps all panels mounted
|
|
92
|
+
* (good for heavy widgets you don't want to rebuild on every tab switch).
|
|
93
|
+
*/
|
|
37
94
|
export type TabContentProps = {
|
|
95
|
+
/** Must match one of the parent TabGroup's `tabs[].value`. */
|
|
38
96
|
value: string;
|
|
97
|
+
/**
|
|
98
|
+
* When true, the panel is rendered even when not active (just hidden).
|
|
99
|
+
* Use for panels with expensive setup (charts, maps) where remounting
|
|
100
|
+
* on every switch would be costly. @default false
|
|
101
|
+
*/
|
|
39
102
|
persisted?: boolean;
|
|
40
103
|
panelClass?: ClassValue;
|
|
41
104
|
children?: Snippet<[value: string]>;
|
|
@@ -15,7 +15,7 @@ export declare const tabs: import("tailwind-variants").TVReturnType<{
|
|
|
15
15
|
sm: {
|
|
16
16
|
trigger: string;
|
|
17
17
|
};
|
|
18
|
-
|
|
18
|
+
md: {
|
|
19
19
|
trigger: string;
|
|
20
20
|
};
|
|
21
21
|
lg: {
|
|
@@ -61,7 +61,7 @@ export declare const tabs: import("tailwind-variants").TVReturnType<{
|
|
|
61
61
|
sm: {
|
|
62
62
|
trigger: string;
|
|
63
63
|
};
|
|
64
|
-
|
|
64
|
+
md: {
|
|
65
65
|
trigger: string;
|
|
66
66
|
};
|
|
67
67
|
lg: {
|
|
@@ -107,7 +107,7 @@ export declare const tabs: import("tailwind-variants").TVReturnType<{
|
|
|
107
107
|
sm: {
|
|
108
108
|
trigger: string;
|
|
109
109
|
};
|
|
110
|
-
|
|
110
|
+
md: {
|
|
111
111
|
trigger: string;
|
|
112
112
|
};
|
|
113
113
|
lg: {
|
package/dist/layout/tabs/tabs.js
CHANGED
|
@@ -3,8 +3,14 @@ import { Color, Size } from '../../index.js';
|
|
|
3
3
|
export const tabs = tv({
|
|
4
4
|
slots: {
|
|
5
5
|
base: 'w-full',
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
// `overflow-x-auto` + `flex-nowrap` lets the tab row scroll on
|
|
7
|
+
// narrow viewports instead of wrapping and breaking the underline.
|
|
8
|
+
// `[scrollbar-width:none]` + the `::-webkit` rule keep the scroll
|
|
9
|
+
// available without a visible bar (swipeable on mobile).
|
|
10
|
+
list: 'flex flex-nowrap border-b border-default-200 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden',
|
|
11
|
+
// `shrink-0` stops tabs from being squeezed when the row overflows.
|
|
12
|
+
// `whitespace-nowrap` keeps multi-word labels on one line.
|
|
13
|
+
trigger: 'inline-flex items-center shrink-0 whitespace-nowrap px-3 py-2 text-sm transition-all duration-200 ease-in-out cursor-pointer -mb-px border-b-2 border-transparent',
|
|
8
14
|
panel: 'mt-4 px-3'
|
|
9
15
|
},
|
|
10
16
|
variants: {
|
|
@@ -24,7 +30,7 @@ export const tabs = tv({
|
|
|
24
30
|
[Size.SM]: {
|
|
25
31
|
trigger: 'px-2 py-1 text-xs'
|
|
26
32
|
},
|
|
27
|
-
[Size.
|
|
33
|
+
[Size.MD]: {
|
|
28
34
|
trigger: 'px-3 py-2 text-sm'
|
|
29
35
|
},
|
|
30
36
|
[Size.LG]: {
|
|
@@ -40,8 +46,8 @@ export const tabs = tv({
|
|
|
40
46
|
variant: {
|
|
41
47
|
line: {},
|
|
42
48
|
pill: {
|
|
43
|
-
list: 'flex border-none gap-2 p-1',
|
|
44
|
-
trigger: 'inline-flex items-center px-3 py-2 text-sm transition-all duration-200 ease-in-out cursor-pointer rounded-full border-0'
|
|
49
|
+
list: 'flex flex-nowrap border-none gap-2 p-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden',
|
|
50
|
+
trigger: 'inline-flex items-center shrink-0 whitespace-nowrap px-3 py-2 text-sm transition-all duration-200 ease-in-out cursor-pointer rounded-full border-0'
|
|
45
51
|
}
|
|
46
52
|
},
|
|
47
53
|
selected: {
|
|
@@ -291,7 +297,7 @@ export const tabs = tv({
|
|
|
291
297
|
],
|
|
292
298
|
defaultVariants: {
|
|
293
299
|
color: Color.PRIMARY,
|
|
294
|
-
size: '
|
|
300
|
+
size: 'md',
|
|
295
301
|
variant: 'line',
|
|
296
302
|
selected: false
|
|
297
303
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Modal from './Modal.svelte';
|
|
3
|
+
import ModalFooter from './ModalFooter.svelte';
|
|
4
|
+
import Button from '../button/Button.svelte';
|
|
5
|
+
import type { ConfirmDialogProps } from './confirm-dialog-types.js';
|
|
6
|
+
import { Color } from '../variants.js';
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
open = $bindable(false),
|
|
10
|
+
title,
|
|
11
|
+
message,
|
|
12
|
+
body,
|
|
13
|
+
confirmLabel = 'Confirm',
|
|
14
|
+
cancelLabel = 'Cancel',
|
|
15
|
+
confirmColor = Color.PRIMARY,
|
|
16
|
+
size = 'sm',
|
|
17
|
+
onconfirm,
|
|
18
|
+
oncancel,
|
|
19
|
+
class: className,
|
|
20
|
+
testId
|
|
21
|
+
}: ConfirmDialogProps = $props();
|
|
22
|
+
|
|
23
|
+
let busy = $state(false);
|
|
24
|
+
|
|
25
|
+
async function handleConfirm() {
|
|
26
|
+
if (busy) return;
|
|
27
|
+
try {
|
|
28
|
+
busy = true;
|
|
29
|
+
await onconfirm?.();
|
|
30
|
+
open = false;
|
|
31
|
+
} catch {
|
|
32
|
+
// Keep dialog open; consumer is expected to surface errors via
|
|
33
|
+
// their own state (e.g. a toast). We just stop the spinner.
|
|
34
|
+
} finally {
|
|
35
|
+
busy = false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function handleCancel() {
|
|
40
|
+
if (busy) return;
|
|
41
|
+
oncancel?.();
|
|
42
|
+
open = false;
|
|
43
|
+
}
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<Modal bind:open {title} {size} class={className} onclose={handleCancel} {testId}>
|
|
47
|
+
<div data-testid={testId ? `${testId}-confirm-body` : 'confirm-dialog-body'}>
|
|
48
|
+
{#if body}
|
|
49
|
+
{@render body()}
|
|
50
|
+
{:else if message}
|
|
51
|
+
<p class="text-default-700 text-sm">{message}</p>
|
|
52
|
+
{/if}
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
{#snippet footer()}
|
|
56
|
+
<ModalFooter align="end">
|
|
57
|
+
<Button variant="outline" onclick={handleCancel} disabled={busy}>
|
|
58
|
+
{cancelLabel}
|
|
59
|
+
</Button>
|
|
60
|
+
<Button color={confirmColor} onclick={handleConfirm} loading={busy}>
|
|
61
|
+
{confirmLabel}
|
|
62
|
+
</Button>
|
|
63
|
+
</ModalFooter>
|
|
64
|
+
{/snippet}
|
|
65
|
+
</Modal>
|
package/dist/modal/Modal.svelte
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import { quintOut } from 'svelte/easing';
|
|
6
6
|
import { cn } from '../helper/cls.js';
|
|
7
7
|
import { buildTestId } from '../helper/testid.js';
|
|
8
|
-
import { warnDeprecatedProps } from '../helper/deprecation.js';
|
|
9
8
|
import { modal } from './modal.js';
|
|
10
9
|
import type { ModalProps } from '../index.js';
|
|
11
10
|
|
|
@@ -17,37 +16,18 @@
|
|
|
17
16
|
size,
|
|
18
17
|
hideCloseButton = false,
|
|
19
18
|
class: className = '',
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
headerclass,
|
|
27
|
-
headerClass = headerclass ?? '',
|
|
28
|
-
backdropclass,
|
|
29
|
-
backdropClass = backdropclass ?? '',
|
|
30
|
-
footerclass,
|
|
31
|
-
footerClass = footerclass ?? '',
|
|
19
|
+
contentClass = '',
|
|
20
|
+
bodyClass = '',
|
|
21
|
+
titleClass = '',
|
|
22
|
+
headerClass = '',
|
|
23
|
+
backdropClass = '',
|
|
24
|
+
footerClass = '',
|
|
32
25
|
children,
|
|
33
26
|
footer,
|
|
34
27
|
header,
|
|
35
28
|
testId
|
|
36
29
|
}: ModalProps = $props();
|
|
37
30
|
|
|
38
|
-
warnDeprecatedProps(
|
|
39
|
-
'Modal',
|
|
40
|
-
{ contentclass, bodyclass, titleclass, headerclass, backdropclass, footerclass },
|
|
41
|
-
{
|
|
42
|
-
contentclass: 'contentClass',
|
|
43
|
-
bodyclass: 'bodyClass',
|
|
44
|
-
titleclass: 'titleClass',
|
|
45
|
-
headerclass: 'headerClass',
|
|
46
|
-
backdropclass: 'backdropClass',
|
|
47
|
-
footerclass: 'footerClass'
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
|
|
51
31
|
let modalElement: HTMLDivElement | undefined = $state();
|
|
52
32
|
|
|
53
33
|
const styles = $derived(modal({ size }));
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ClassValue } from 'tailwind-variants';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { VariantColors, VariantSizes } from '../index.js';
|
|
4
|
+
export type ConfirmDialogProps = {
|
|
5
|
+
/** Bindable open state. */
|
|
6
|
+
open?: boolean;
|
|
7
|
+
/** Heading shown at the top. */
|
|
8
|
+
title: string;
|
|
9
|
+
/** Body text. For richer content use the `body` snippet instead. */
|
|
10
|
+
message?: string;
|
|
11
|
+
/** Override the plain `message` with arbitrary markup. */
|
|
12
|
+
body?: Snippet;
|
|
13
|
+
/** Confirm button label. @default 'Confirm' */
|
|
14
|
+
confirmLabel?: string;
|
|
15
|
+
/** Cancel button label. @default 'Cancel' */
|
|
16
|
+
cancelLabel?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Confirm button color. `'danger'` is the common choice for destructive
|
|
19
|
+
* actions ("Delete forever"). @default 'primary'
|
|
20
|
+
*/
|
|
21
|
+
confirmColor?: VariantColors;
|
|
22
|
+
/**
|
|
23
|
+
* Modal size. @default 'sm' (narrower than a default Modal — matches
|
|
24
|
+
* the kind of short yes/no decision these dialogs represent).
|
|
25
|
+
*/
|
|
26
|
+
size?: VariantSizes;
|
|
27
|
+
/**
|
|
28
|
+
* Called when the user clicks Confirm. If it returns a Promise, the
|
|
29
|
+
* Confirm button shows a loading state until it resolves, and the
|
|
30
|
+
* dialog only closes on success. Throw/reject to keep the dialog open
|
|
31
|
+
* with an error state the consumer can display.
|
|
32
|
+
*/
|
|
33
|
+
onconfirm?: () => void | Promise<void>;
|
|
34
|
+
/** Called when the user clicks Cancel or dismisses the dialog. */
|
|
35
|
+
oncancel?: () => void;
|
|
36
|
+
/** Pass-through modal class. */
|
|
37
|
+
class?: ClassValue;
|
|
38
|
+
testId?: string;
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,34 +1,73 @@
|
|
|
1
1
|
import type { ClassValue } from 'tailwind-variants';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { VariantSizes } from '../index.js';
|
|
4
|
+
/**
|
|
5
|
+
* Props for `<Modal>` — a centered overlay dialog with backdrop. Use for
|
|
6
|
+
* focused tasks (forms, settings) that benefit from blocking the rest of
|
|
7
|
+
* the page. For "are you sure?" flows use `<ConfirmDialog>` (a thin
|
|
8
|
+
* wrapper). For side-anchored panels use `<Drawer>`.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```svelte
|
|
12
|
+
* <Modal bind:open title="Edit profile">
|
|
13
|
+
* <ProfileForm />
|
|
14
|
+
* {#snippet footer()}
|
|
15
|
+
* <ModalFooter align="end">
|
|
16
|
+
* <Button variant="outline" onclick={() => (open = false)}>Cancel</Button>
|
|
17
|
+
* <Button onclick={save}>Save</Button>
|
|
18
|
+
* </ModalFooter>
|
|
19
|
+
* {/snippet}
|
|
20
|
+
* </Modal>
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```svelte
|
|
25
|
+
* <!-- Custom header snippet (replaces the default title bar) -->
|
|
26
|
+
* <Modal bind:open size="lg">
|
|
27
|
+
* {#snippet header()}
|
|
28
|
+
* <div class="flex items-center gap-3 p-4">
|
|
29
|
+
* <Avatar />
|
|
30
|
+
* <div>
|
|
31
|
+
* <h2 class="font-semibold">Sarah Chen</h2>
|
|
32
|
+
* <p class="text-xs text-default-500">Engineering</p>
|
|
33
|
+
* </div>
|
|
34
|
+
* </div>
|
|
35
|
+
* {/snippet}
|
|
36
|
+
* <UserDetails user={selected} />
|
|
37
|
+
* </Modal>
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
4
40
|
export type ModalProps = {
|
|
41
|
+
/** Bindable open state. @default false */
|
|
5
42
|
open?: boolean;
|
|
43
|
+
/** Fires when the user dismisses the modal (× button, backdrop click, Escape). */
|
|
6
44
|
onclose?: () => void;
|
|
45
|
+
/** Header text. Ignored if a `header` snippet is provided. */
|
|
7
46
|
title?: string;
|
|
47
|
+
/** Short subtitle below the title. */
|
|
8
48
|
description?: string;
|
|
49
|
+
/** @default 'md' */
|
|
9
50
|
size?: VariantSizes;
|
|
51
|
+
/** Hide the default × button in the corner. @default false */
|
|
10
52
|
hideCloseButton?: boolean;
|
|
11
53
|
class?: ClassValue;
|
|
12
|
-
/**
|
|
13
|
-
contentclass?: ClassValue;
|
|
54
|
+
/** Classes on the dialog container. */
|
|
14
55
|
contentClass?: ClassValue;
|
|
15
|
-
/**
|
|
16
|
-
bodyclass?: ClassValue;
|
|
56
|
+
/** Classes on the body content area. */
|
|
17
57
|
bodyClass?: ClassValue;
|
|
18
|
-
/**
|
|
19
|
-
titleclass?: ClassValue;
|
|
58
|
+
/** Classes on the title element. */
|
|
20
59
|
titleClass?: ClassValue;
|
|
21
|
-
/**
|
|
22
|
-
headerclass?: ClassValue;
|
|
60
|
+
/** Classes on the header row. */
|
|
23
61
|
headerClass?: ClassValue;
|
|
24
|
-
/**
|
|
25
|
-
backdropclass?: ClassValue;
|
|
62
|
+
/** Classes on the backdrop overlay. */
|
|
26
63
|
backdropClass?: ClassValue;
|
|
27
|
-
/**
|
|
28
|
-
footerclass?: ClassValue;
|
|
64
|
+
/** Classes on the footer area. */
|
|
29
65
|
footerClass?: ClassValue;
|
|
66
|
+
/** Body content. */
|
|
30
67
|
children?: Snippet;
|
|
68
|
+
/** Footer content — usually `<ModalFooter>` with action buttons. */
|
|
31
69
|
footer?: Snippet;
|
|
70
|
+
/** Replace the default title bar entirely. */
|
|
32
71
|
header?: Snippet;
|
|
33
72
|
testId?: string;
|
|
34
73
|
};
|
package/dist/modal/modal.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare const modal: import("tailwind-variants").TVReturnType<{
|
|
|
6
6
|
sm: {
|
|
7
7
|
container: string;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
md: {
|
|
10
10
|
container: string;
|
|
11
11
|
};
|
|
12
12
|
lg: {
|
|
@@ -37,7 +37,7 @@ export declare const modal: import("tailwind-variants").TVReturnType<{
|
|
|
37
37
|
sm: {
|
|
38
38
|
container: string;
|
|
39
39
|
};
|
|
40
|
-
|
|
40
|
+
md: {
|
|
41
41
|
container: string;
|
|
42
42
|
};
|
|
43
43
|
lg: {
|
|
@@ -68,7 +68,7 @@ export declare const modal: import("tailwind-variants").TVReturnType<{
|
|
|
68
68
|
sm: {
|
|
69
69
|
container: string;
|
|
70
70
|
};
|
|
71
|
-
|
|
71
|
+
md: {
|
|
72
72
|
container: string;
|
|
73
73
|
};
|
|
74
74
|
lg: {
|
package/dist/modal/modal.js
CHANGED
|
@@ -7,7 +7,7 @@ export const modal = tv({
|
|
|
7
7
|
container: 'relative w-full flex flex-col bg-white rounded-xl shadow-2xl',
|
|
8
8
|
header: 'px-6 py-4 border-b border-default-200 flex items-center justify-between shrink-0',
|
|
9
9
|
body: 'flex-1 px-6 py-4 overflow-y-auto',
|
|
10
|
-
footer: '
|
|
10
|
+
footer: 'bg-default-50/80 rounded-b-xl shrink-0',
|
|
11
11
|
title: 'text-lg font-semibold text-default-900',
|
|
12
12
|
description: 'text-sm text-default-600 mt-1',
|
|
13
13
|
close: 'p-2 -mr-2 ml-4 rounded-lg text-default-400 cursor-pointer hover:text-default-600 hover:bg-default-100 transition-colors'
|
|
@@ -20,7 +20,7 @@ export const modal = tv({
|
|
|
20
20
|
[Size.SM]: {
|
|
21
21
|
container: 'max-w-sm max-h-[85vh]'
|
|
22
22
|
},
|
|
23
|
-
[Size.
|
|
23
|
+
[Size.MD]: {
|
|
24
24
|
container: 'max-w-md max-h-[85vh]'
|
|
25
25
|
},
|
|
26
26
|
[Size.LG]: {
|
|
@@ -35,6 +35,6 @@ export const modal = tv({
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
defaultVariants: {
|
|
38
|
-
size: Size.
|
|
38
|
+
size: Size.MD
|
|
39
39
|
}
|
|
40
40
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { cn } from '../helper/cls.js';
|
|
3
|
+
import { buildTestId } from '../helper/testid.js';
|
|
3
4
|
import { pipelineVariants } from './pipeline.js';
|
|
4
5
|
import type { PipelineProps, PipelineStage } from '../index.js';
|
|
5
6
|
|
|
@@ -8,7 +9,7 @@
|
|
|
8
9
|
let {
|
|
9
10
|
stages = [],
|
|
10
11
|
class: className = '',
|
|
11
|
-
size = '
|
|
12
|
+
size = 'md',
|
|
12
13
|
equalWidth = true,
|
|
13
14
|
chevronGap = 0,
|
|
14
15
|
selectedClass,
|
|
@@ -18,7 +19,8 @@
|
|
|
18
19
|
onstagehover,
|
|
19
20
|
onstageleave,
|
|
20
21
|
children,
|
|
21
|
-
beneathChildren
|
|
22
|
+
beneathChildren,
|
|
23
|
+
testId
|
|
22
24
|
}: PipelineProps = $props();
|
|
23
25
|
|
|
24
26
|
const containerStyles = $derived(pipelineVariants({ size, equalWidth }));
|
|
@@ -80,7 +82,10 @@
|
|
|
80
82
|
</div>
|
|
81
83
|
{/snippet}
|
|
82
84
|
|
|
83
|
-
<div
|
|
85
|
+
<div
|
|
86
|
+
class={cn(containerStyles.container(), className)}
|
|
87
|
+
data-testid={buildTestId('pipeline', undefined, testId)}
|
|
88
|
+
>
|
|
84
89
|
{#each stages as stage, index (stage.label + index)}
|
|
85
90
|
{@const s = getStageStyles(stage)}
|
|
86
91
|
{@const isFirst = index === 0}
|
|
@@ -1,24 +1,67 @@
|
|
|
1
1
|
import type { ClassValue } from 'tailwind-variants';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
|
|
3
|
+
import type { VariantColors } from '../index.js';
|
|
4
|
+
/** Single stage in a `<Pipeline>` chevron bar. */
|
|
4
5
|
export type PipelineStage = {
|
|
6
|
+
/** Display label. */
|
|
5
7
|
label: string;
|
|
8
|
+
/** Optional big number shown below the label (e.g. count, currency). */
|
|
6
9
|
count?: number | string;
|
|
7
|
-
color
|
|
10
|
+
/** Stage color accent. @default 'default' */
|
|
11
|
+
color?: VariantColors;
|
|
12
|
+
/** Whether this stage is currently selected/highlighted. */
|
|
8
13
|
active?: boolean;
|
|
14
|
+
/** Grey out the stage and disable interaction. */
|
|
9
15
|
disabled?: boolean;
|
|
10
16
|
};
|
|
17
|
+
/** Event shape emitted by Pipeline stage interactions. */
|
|
11
18
|
export type PipelineStageEvent<E extends Event = Event> = {
|
|
19
|
+
/** The clicked/hovered stage data. */
|
|
12
20
|
stage: PipelineStage;
|
|
21
|
+
/** Stage index in the `stages` array. */
|
|
13
22
|
index: number;
|
|
23
|
+
/** Native DOM event. */
|
|
14
24
|
event: E;
|
|
15
25
|
};
|
|
26
|
+
/** Mouse-click event on a stage. */
|
|
16
27
|
export type PipelineStageClickEvent = PipelineStageEvent<MouseEvent>;
|
|
28
|
+
/** Mouse hover/leave event on a stage. */
|
|
17
29
|
export type PipelineStagePointerEvent = PipelineStageEvent<MouseEvent>;
|
|
30
|
+
/**
|
|
31
|
+
* Props for `<Pipeline>` — a horizontal chevron-shaped stage bar for
|
|
32
|
+
* visualising funnels, workflows, or sales pipelines. Purely display —
|
|
33
|
+
* for interactive multi-step forms use `<Stepper>` instead.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```svelte
|
|
37
|
+
* <Pipeline
|
|
38
|
+
* stages={[
|
|
39
|
+
* { label: 'Lead', count: 240 },
|
|
40
|
+
* { label: 'Qualified', count: 82, active: true, color: 'primary' },
|
|
41
|
+
* { label: 'Proposal', count: 31 },
|
|
42
|
+
* { label: 'Won', count: 12, color: 'success' }
|
|
43
|
+
* ]}
|
|
44
|
+
* onstageclick={({ stage }) => setFilter(stage.label)}
|
|
45
|
+
* />
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```svelte
|
|
50
|
+
* <!-- Custom content per stage (progress bars under each chevron) -->
|
|
51
|
+
* <Pipeline {stages}>
|
|
52
|
+
* {#snippet beneathChildren(stage, i)}
|
|
53
|
+
* <div class="text-xs">{stage.count} deals</div>
|
|
54
|
+
* {/snippet}
|
|
55
|
+
* </Pipeline>
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
18
58
|
export type PipelineProps = {
|
|
59
|
+
/** Ordered list of stages. */
|
|
19
60
|
stages: PipelineStage[];
|
|
20
61
|
class?: ClassValue;
|
|
21
|
-
|
|
62
|
+
/** @default 'md' */
|
|
63
|
+
size?: 'sm' | 'md' | 'lg';
|
|
64
|
+
/** Force equal-width columns. @default true */
|
|
22
65
|
equalWidth?: boolean;
|
|
23
66
|
/**
|
|
24
67
|
* Pixels of visible gap between chevrons. Independent of the chevron tip width.
|
|
@@ -27,12 +70,21 @@ export type PipelineProps = {
|
|
|
27
70
|
* - negative: more overlap than default (tips extend past notches)
|
|
28
71
|
*/
|
|
29
72
|
chevronGap?: number;
|
|
73
|
+
/** Replace the default label+count content inside each chevron. */
|
|
30
74
|
children?: Snippet<[PipelineStage, number]>;
|
|
75
|
+
/** Render extra content under each stage (progress bars, sub-labels). */
|
|
31
76
|
beneathChildren?: Snippet<[PipelineStage, number]>;
|
|
77
|
+
/** Extra classes applied to the selected (active) stage. */
|
|
32
78
|
selectedClass?: ClassValue;
|
|
79
|
+
/** Extra classes applied to unselected stages. */
|
|
33
80
|
unselectedClass?: ClassValue;
|
|
81
|
+
/** Extra classes applied to disabled stages. */
|
|
34
82
|
disabledClass?: ClassValue;
|
|
83
|
+
/** Fires when a stage is clicked (skipped when the stage is disabled). */
|
|
35
84
|
onstageclick?: (e: PipelineStageClickEvent) => void;
|
|
85
|
+
/** Fires on stage mouseenter. Attaches `role="group"` for accessibility when used. */
|
|
36
86
|
onstagehover?: (e: PipelineStagePointerEvent) => void;
|
|
87
|
+
/** Fires on stage mouseleave. */
|
|
37
88
|
onstageleave?: (e: PipelineStagePointerEvent) => void;
|
|
89
|
+
testId?: string;
|
|
38
90
|
};
|
|
@@ -8,7 +8,7 @@ export declare const pipelineVariants: import("tailwind-variants").TVReturnType<
|
|
|
8
8
|
count: string;
|
|
9
9
|
content: string;
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
md: {
|
|
12
12
|
stage: string;
|
|
13
13
|
borderLayer: string;
|
|
14
14
|
innerLayer: string;
|
|
@@ -34,6 +34,11 @@ export declare const pipelineVariants: import("tailwind-variants").TVReturnType<
|
|
|
34
34
|
label: string;
|
|
35
35
|
count: string;
|
|
36
36
|
};
|
|
37
|
+
secondary: {
|
|
38
|
+
borderLayer: string;
|
|
39
|
+
label: string;
|
|
40
|
+
count: string;
|
|
41
|
+
};
|
|
37
42
|
success: {
|
|
38
43
|
borderLayer: string;
|
|
39
44
|
label: string;
|
|
@@ -93,7 +98,7 @@ export declare const pipelineVariants: import("tailwind-variants").TVReturnType<
|
|
|
93
98
|
count: string;
|
|
94
99
|
content: string;
|
|
95
100
|
};
|
|
96
|
-
|
|
101
|
+
md: {
|
|
97
102
|
stage: string;
|
|
98
103
|
borderLayer: string;
|
|
99
104
|
innerLayer: string;
|
|
@@ -119,6 +124,11 @@ export declare const pipelineVariants: import("tailwind-variants").TVReturnType<
|
|
|
119
124
|
label: string;
|
|
120
125
|
count: string;
|
|
121
126
|
};
|
|
127
|
+
secondary: {
|
|
128
|
+
borderLayer: string;
|
|
129
|
+
label: string;
|
|
130
|
+
count: string;
|
|
131
|
+
};
|
|
122
132
|
success: {
|
|
123
133
|
borderLayer: string;
|
|
124
134
|
label: string;
|
|
@@ -178,7 +188,7 @@ export declare const pipelineVariants: import("tailwind-variants").TVReturnType<
|
|
|
178
188
|
count: string;
|
|
179
189
|
content: string;
|
|
180
190
|
};
|
|
181
|
-
|
|
191
|
+
md: {
|
|
182
192
|
stage: string;
|
|
183
193
|
borderLayer: string;
|
|
184
194
|
innerLayer: string;
|
|
@@ -204,6 +214,11 @@ export declare const pipelineVariants: import("tailwind-variants").TVReturnType<
|
|
|
204
214
|
label: string;
|
|
205
215
|
count: string;
|
|
206
216
|
};
|
|
217
|
+
secondary: {
|
|
218
|
+
borderLayer: string;
|
|
219
|
+
label: string;
|
|
220
|
+
count: string;
|
|
221
|
+
};
|
|
207
222
|
success: {
|
|
208
223
|
borderLayer: string;
|
|
209
224
|
label: string;
|