@placeholderco/placeholder-ui 1.0.11 → 2.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/LICENSE +1 -1
- package/README.md +134 -130
- package/dist/app.css +178 -0
- package/dist/bootstrap.min.css +3600 -0
- package/dist/cards/GitCard.svelte +115 -0
- package/dist/cards/GitCard.svelte.d.ts +22 -0
- package/dist/display/Avatar.svelte +29 -17
- package/dist/display/Avatar.svelte.d.ts +12 -2
- package/dist/display/LinkCollection.svelte +40 -18
- package/dist/display/LinkCollection.svelte.d.ts +9 -2
- package/dist/display/Paper.svelte +31 -19
- package/dist/display/Paper.svelte.d.ts +12 -3
- package/dist/display/alert/Alert.svelte +129 -0
- package/dist/display/alert/Alert.svelte.d.ts +15 -0
- package/dist/display/alert/AlertVariant.d.ts +1 -0
- package/dist/display/alert/AlertVariant.js +1 -0
- package/dist/display/filetree/FileTree.svelte +259 -0
- package/dist/display/filetree/FileTree.svelte.d.ts +76 -0
- package/dist/display/filetree/FileTreeItem.svelte +396 -0
- package/dist/display/filetree/FileTreeItem.svelte.d.ts +40 -0
- package/dist/display/filetree/FileTreeNode.d.ts +46 -0
- package/dist/display/filetree/FileTreeNode.js +115 -0
- package/dist/display/filetree/index.d.ts +5 -0
- package/dist/display/filetree/index.js +3 -0
- package/dist/editors/CodeMirror.svelte +306 -0
- package/dist/editors/CodeMirror.svelte.d.ts +31 -0
- package/dist/editors/tiptap/LinkActionMenu.svelte +307 -0
- package/dist/editors/tiptap/LinkActionMenu.svelte.d.ts +8 -0
- package/dist/editors/tiptap/TipTap.svelte +856 -0
- package/dist/editors/tiptap/TipTap.svelte.d.ts +54 -0
- package/dist/editors/tiptap/TipTapBubble.svelte +790 -0
- package/dist/editors/tiptap/TipTapBubble.svelte.d.ts +44 -0
- package/dist/editors/tiptap/collaboration.d.ts +55 -0
- package/dist/editors/tiptap/collaboration.js +1 -0
- package/dist/editors/tiptap/extensions/Alert.d.ts +18 -0
- package/dist/editors/tiptap/extensions/Alert.js +72 -0
- package/dist/editors/tiptap/extensions/CodeBlockEditor.d.ts +21 -0
- package/dist/editors/tiptap/extensions/CodeBlockEditor.js +326 -0
- package/dist/editors/tiptap/extensions/Div.d.ts +19 -0
- package/dist/editors/tiptap/extensions/Div.js +89 -0
- package/dist/editors/tiptap/extensions/Span.d.ts +5 -0
- package/dist/editors/tiptap/extensions/Span.js +56 -0
- package/dist/editors/tiptap/extensions/codeBlockEditor.css +236 -0
- package/dist/editors/tiptap/extensions/codeBlockLanguages.d.ts +17 -0
- package/dist/editors/tiptap/extensions/codeBlockLanguages.js +124 -0
- package/dist/editors/tiptap/extensions/index.d.ts +7 -0
- package/dist/editors/tiptap/extensions/index.js +5 -0
- package/dist/editors/tiptap/toolbar/AlertButton.svelte +261 -0
- package/dist/editors/tiptap/toolbar/AlertButton.svelte.d.ts +7 -0
- package/dist/editors/tiptap/toolbar/AlignCenterButton.svelte +18 -0
- package/dist/editors/tiptap/toolbar/AlignCenterButton.svelte.d.ts +7 -0
- package/dist/editors/tiptap/toolbar/AlignJustifyButton.svelte +18 -0
- package/dist/editors/tiptap/toolbar/AlignJustifyButton.svelte.d.ts +7 -0
- package/dist/editors/tiptap/toolbar/AlignLeftButton.svelte +18 -0
- package/dist/editors/tiptap/toolbar/AlignLeftButton.svelte.d.ts +7 -0
- package/dist/editors/tiptap/toolbar/AlignRightButton.svelte +18 -0
- package/dist/editors/tiptap/toolbar/AlignRightButton.svelte.d.ts +7 -0
- package/dist/editors/tiptap/toolbar/BoldButton.svelte +18 -0
- package/dist/editors/tiptap/toolbar/BoldButton.svelte.d.ts +7 -0
- package/dist/editors/tiptap/toolbar/BulletListButton.svelte +18 -0
- package/dist/editors/tiptap/toolbar/BulletListButton.svelte.d.ts +7 -0
- package/dist/editors/tiptap/toolbar/CodeBlockButton.svelte +18 -0
- package/dist/editors/tiptap/toolbar/CodeBlockButton.svelte.d.ts +7 -0
- package/dist/editors/tiptap/toolbar/CodeButton.svelte +18 -0
- package/dist/editors/tiptap/toolbar/CodeButton.svelte.d.ts +7 -0
- package/dist/editors/tiptap/toolbar/ColorButton.svelte +299 -0
- package/dist/editors/tiptap/toolbar/ColorButton.svelte.d.ts +20 -0
- package/dist/editors/tiptap/toolbar/DocumentButton.svelte +58 -0
- package/dist/editors/tiptap/toolbar/DocumentButton.svelte.d.ts +9 -0
- package/dist/editors/tiptap/toolbar/HeadingButton.svelte +30 -0
- package/dist/editors/tiptap/toolbar/HeadingButton.svelte.d.ts +8 -0
- package/dist/editors/tiptap/toolbar/HtmlButton.svelte +68 -0
- package/dist/editors/tiptap/toolbar/HtmlButton.svelte.d.ts +7 -0
- package/dist/editors/tiptap/toolbar/ImageButton.svelte +54 -0
- package/dist/editors/tiptap/toolbar/ImageButton.svelte.d.ts +8 -0
- package/dist/editors/tiptap/toolbar/ItalicButton.svelte +18 -0
- package/dist/editors/tiptap/toolbar/ItalicButton.svelte.d.ts +7 -0
- package/dist/editors/tiptap/toolbar/LinkButton.svelte +257 -0
- package/dist/editors/tiptap/toolbar/LinkButton.svelte.d.ts +7 -0
- package/dist/editors/tiptap/toolbar/OrderedListButton.svelte +18 -0
- package/dist/editors/tiptap/toolbar/OrderedListButton.svelte.d.ts +7 -0
- package/dist/editors/tiptap/toolbar/RedoButton.svelte +18 -0
- package/dist/editors/tiptap/toolbar/RedoButton.svelte.d.ts +7 -0
- package/dist/editors/tiptap/toolbar/StrikethroughButton.svelte +18 -0
- package/dist/editors/tiptap/toolbar/StrikethroughButton.svelte.d.ts +7 -0
- package/dist/editors/tiptap/toolbar/SubscriptButton.svelte +18 -0
- package/dist/editors/tiptap/toolbar/SubscriptButton.svelte.d.ts +7 -0
- package/dist/editors/tiptap/toolbar/SuperscriptButton.svelte +18 -0
- package/dist/editors/tiptap/toolbar/SuperscriptButton.svelte.d.ts +7 -0
- package/dist/editors/tiptap/toolbar/TableButton.svelte +258 -0
- package/dist/editors/tiptap/toolbar/TableButton.svelte.d.ts +7 -0
- package/dist/editors/tiptap/toolbar/ToolbarButton.svelte +84 -0
- package/dist/editors/tiptap/toolbar/ToolbarButton.svelte.d.ts +10 -0
- package/dist/editors/tiptap/toolbar/UnderlineButton.svelte +18 -0
- package/dist/editors/tiptap/toolbar/UnderlineButton.svelte.d.ts +7 -0
- package/dist/editors/tiptap/toolbar/UndoButton.svelte +18 -0
- package/dist/editors/tiptap/toolbar/UndoButton.svelte.d.ts +7 -0
- package/dist/form/Autocomplete.svelte +270 -137
- package/dist/form/Autocomplete.svelte.d.ts +58 -10
- package/dist/form/AutocompleteMulti.svelte +385 -227
- package/dist/form/AutocompleteMulti.svelte.d.ts +59 -10
- package/dist/form/Checkbox.svelte +124 -43
- package/dist/form/Checkbox.svelte.d.ts +26 -2
- package/dist/form/Chips.svelte +47 -17
- package/dist/form/Chips.svelte.d.ts +24 -3
- package/dist/form/ComboBox.svelte +30 -20
- package/dist/form/ComboBox.svelte.d.ts +1 -1
- package/dist/form/ComboBoxItemBuilder.svelte +161 -188
- package/dist/form/ComboBoxItemBuilder.svelte.d.ts +19 -2
- package/dist/form/ComboBoxMulti.svelte +38 -24
- package/dist/form/ComboBoxMulti.svelte.d.ts +1 -1
- package/dist/form/CronBuilder.svelte +84 -67
- package/dist/form/CronBuilder.svelte.d.ts +16 -3
- package/dist/form/DatePicker.svelte +177 -191
- package/dist/form/DatePicker.svelte.d.ts +17 -2
- package/dist/form/DateRangePicker.svelte +775 -0
- package/dist/form/DateRangePicker.svelte.d.ts +23 -0
- package/dist/form/DateTimePicker.svelte +168 -209
- package/dist/form/DateTimePicker.svelte.d.ts +10 -2
- package/dist/form/FormGroup.svelte +33 -10
- package/dist/form/FormGroup.svelte.d.ts +12 -2
- package/dist/form/Number.svelte +71 -29
- package/dist/form/Number.svelte.d.ts +39 -6
- package/dist/form/Radio.svelte +174 -0
- package/dist/form/Radio.svelte.d.ts +21 -0
- package/dist/form/RadioGroup.svelte +52 -138
- package/dist/form/RadioGroup.svelte.d.ts +19 -2
- package/dist/form/SegmentedControl.svelte +103 -57
- package/dist/form/SegmentedControl.svelte.d.ts +12 -2
- package/dist/form/Select.svelte +160 -229
- package/dist/form/Select.svelte.d.ts +35 -6
- package/dist/form/SelectMulti.svelte +166 -277
- package/dist/form/SelectMulti.svelte.d.ts +37 -6
- package/dist/form/Slider.svelte +185 -268
- package/dist/form/Slider.svelte.d.ts +33 -16
- package/dist/form/StringArrayBuilder.svelte +249 -0
- package/dist/form/StringArrayBuilder.svelte.d.ts +15 -0
- package/dist/form/Switch.svelte +164 -106
- package/dist/form/Switch.svelte.d.ts +22 -3
- package/dist/form/TextArea.svelte +80 -45
- package/dist/form/TextArea.svelte.d.ts +35 -10
- package/dist/form/Textbox.svelte +80 -47
- package/dist/form/Textbox.svelte.d.ts +41 -8
- package/dist/form/TimePicker.svelte +42 -47
- package/dist/form/TimePicker.svelte.d.ts +12 -2
- package/dist/form/comboBoxCore.svelte.d.ts +99 -0
- package/dist/form/comboBoxCore.svelte.js +243 -0
- package/dist/icon/Icon.svelte +8 -3
- package/dist/icon/Icon.svelte.d.ts +8 -3
- package/dist/icon/cube-send.svg +1 -0
- package/dist/icon/file-type-bmp.svg +1 -0
- package/dist/icon/file-type-csv.svg +1 -0
- package/dist/icon/file-type-doc.svg +1 -0
- package/dist/icon/file-type-docx.svg +1 -0
- package/dist/icon/file-type-jpg.svg +1 -0
- package/dist/icon/file-type-pdf.svg +1 -0
- package/dist/icon/file-type-png.svg +1 -0
- package/dist/icon/file-type-ppt.svg +1 -0
- package/dist/icon/file-type-svg.svg +1 -0
- package/dist/icon/file-type-txt.svg +1 -0
- package/dist/icon/file-type-xls.svg +1 -0
- package/dist/icon/file-type-zip.svg +1 -0
- package/dist/icon/index.d.ts +166 -145
- package/dist/icon/index.js +166 -146
- package/dist/icon/layout-sidebar-left-collapse.svg +1 -0
- package/dist/icon/layout-sidebar-left-expand.svg +1 -0
- package/dist/icon/logo-placeholder.svg +6 -0
- package/dist/icon/paperclip.svg +1 -0
- package/dist/icon/source-code.svg +1 -0
- package/dist/icon/sun-moon.svg +1 -0
- package/dist/icon/table.svg +6 -0
- package/dist/icon/thumb-down.svg +1 -0
- package/dist/icon/thumb-up.svg +1 -0
- package/dist/index.d.ts +93 -22
- package/dist/index.js +28 -27
- package/dist/layout/AppShell.svelte +12 -162
- package/dist/layout/AppShell.svelte.d.ts +6 -27
- package/dist/layout/CustomNavbar.svelte +9 -7
- package/dist/layout/CustomNavbar.svelte.d.ts +4 -2
- package/dist/layout/Navbar.svelte +158 -110
- package/dist/layout/Navbar.svelte.d.ts +26 -12
- package/dist/layout/NavbarItemDisplay.svelte +2 -2
- package/dist/layout/NavbarItemView.svelte +182 -0
- package/dist/layout/NavbarItemView.svelte.d.ts +10 -0
- package/dist/layout/Sidenav.svelte +280 -341
- package/dist/layout/Sidenav.svelte.d.ts +36 -4
- package/dist/models/ComboBoxItem.d.ts +2 -0
- package/dist/models/Employee.d.ts +53 -0
- package/dist/models/Employee.js +23 -0
- package/dist/models/Hyperlink.d.ts +3 -1
- package/dist/models/LinkCollectionItem.d.ts +3 -1
- package/dist/models/NavbarItem.d.ts +6 -2
- package/dist/theme.svelte.d.ts +0 -1
- package/dist/theme.svelte.js +46 -58
- package/dist/ui/Accordion.svelte +81 -242
- package/dist/ui/Accordion.svelte.d.ts +37 -14
- package/dist/ui/AccordionItem.svelte +303 -0
- package/dist/ui/AccordionItem.svelte.d.ts +21 -0
- package/dist/ui/ActionIcon.svelte +25 -21
- package/dist/ui/ActionIcon.svelte.d.ts +15 -2
- package/dist/ui/Badge.svelte +170 -161
- package/dist/ui/Badge.svelte.d.ts +16 -4
- package/dist/ui/Button.svelte +178 -205
- package/dist/ui/Button.svelte.d.ts +19 -2
- package/dist/ui/ButtonVariant.d.ts +15 -1
- package/dist/ui/ContextMenu.svelte +146 -0
- package/dist/ui/ContextMenu.svelte.d.ts +37 -0
- package/dist/ui/ContextMenuList.svelte +188 -0
- package/dist/ui/ContextMenuList.svelte.d.ts +12 -0
- package/dist/ui/Dialog.svelte +183 -104
- package/dist/ui/Dialog.svelte.d.ts +21 -2
- package/dist/ui/Drawer.svelte +237 -184
- package/dist/ui/Drawer.svelte.d.ts +20 -2
- package/dist/ui/Dropdown.svelte +24 -14
- package/dist/ui/Dropdown.svelte.d.ts +11 -2
- package/dist/ui/Dropzone.svelte +159 -57
- package/dist/ui/Dropzone.svelte.d.ts +29 -2
- package/dist/ui/Link.svelte +12 -4
- package/dist/ui/Link.svelte.d.ts +8 -2
- package/dist/ui/Loader.svelte +23 -18
- package/dist/ui/Loader.svelte.d.ts +5 -2
- package/dist/ui/Logo.svelte +37 -0
- package/dist/ui/Logo.svelte.d.ts +16 -0
- package/dist/ui/MultiSortable.svelte +287 -0
- package/dist/ui/MultiSortable.svelte.d.ts +50 -0
- package/dist/ui/Pagination.svelte +12 -6
- package/dist/ui/Pagination.svelte.d.ts +6 -2
- package/dist/ui/Popover.svelte +43 -65
- package/dist/ui/Popover.svelte.d.ts +14 -5
- package/dist/ui/ProgressBar.svelte +169 -0
- package/dist/ui/ProgressBar.svelte.d.ts +30 -0
- package/dist/ui/ProgressBarVariant.d.ts +7 -0
- package/dist/ui/ProgressBarVariant.js +1 -0
- package/dist/ui/SegmentedControl.svelte +0 -0
- package/dist/ui/SegmentedControl.svelte.d.ts +26 -0
- package/dist/ui/Sortable.svelte +163 -0
- package/dist/ui/Sortable.svelte.d.ts +47 -0
- package/dist/ui/Table.svelte +497 -56
- package/dist/ui/Table.svelte.d.ts +64 -2
- package/dist/ui/Tabs.svelte +22 -18
- package/dist/ui/Tabs.svelte.d.ts +6 -2
- package/dist/ui/ThemeSwitcher.svelte +26 -7
- package/dist/ui/ThemeSwitcher.svelte.d.ts +4 -2
- package/dist/ui/Tooltip.svelte +312 -180
- package/dist/ui/Tooltip.svelte.d.ts +4 -3
- package/dist/uiTheme.svelte.d.ts +86 -0
- package/dist/uiTheme.svelte.js +214 -0
- package/dist/util/DateFunctions.js +1 -1
- package/dist/util/DragDrop.d.ts +50 -0
- package/dist/util/DragDrop.js +154 -0
- package/dist/util/NavigateTo.js +2 -2
- package/dist/util/dayjs.d.ts +4 -0
- package/dist/util/dayjs.js +15 -0
- package/dist/util/interceptLinkClick.d.ts +13 -0
- package/dist/util/interceptLinkClick.js +33 -0
- package/package.json +66 -26
- package/dist/display/Alert.svelte +0 -179
- package/dist/display/Alert.svelte.d.ts +0 -13
- package/dist/form/FileInput.svelte +0 -235
- package/dist/form/FileInput.svelte.d.ts +0 -23
- package/dist/form/PasswordInput.svelte +0 -252
- package/dist/form/PasswordInput.svelte.d.ts +0 -33
- package/dist/form/Rating.svelte +0 -235
- package/dist/form/Rating.svelte.d.ts +0 -21
- package/dist/styles/components.css +0 -199
- package/dist/styles/dark.css +0 -146
- package/dist/styles/index.css +0 -116
- package/dist/styles/reset.css +0 -110
- package/dist/styles/semantic.css +0 -86
- package/dist/styles/tokens.css +0 -203
- package/dist/styles/utilities.css +0 -523
- package/dist/ui/Breadcrumbs.svelte +0 -131
- package/dist/ui/Breadcrumbs.svelte.d.ts +0 -16
- package/dist/ui/LoadingOverlay.svelte +0 -53
- package/dist/ui/LoadingOverlay.svelte.d.ts +0 -11
- package/dist/ui/Progress.svelte +0 -191
- package/dist/ui/Progress.svelte.d.ts +0 -15
- package/dist/ui/RingProgress.svelte +0 -141
- package/dist/ui/RingProgress.svelte.d.ts +0 -18
- package/dist/ui/Skeleton.svelte +0 -85
- package/dist/ui/Skeleton.svelte.d.ts +0 -12
- package/dist/ui/Stepper.svelte +0 -355
- package/dist/ui/Stepper.svelte.d.ts +0 -24
- package/dist/ui/Timeline.svelte +0 -225
- package/dist/ui/Timeline.svelte.d.ts +0 -23
- /package/dist/{actions → util}/ClickOutside.d.ts +0 -0
- /package/dist/{actions → util}/ClickOutside.js +0 -0
- /package/dist/{transitions → util}/Transitions.d.ts +0 -0
- /package/dist/{transitions → util}/Transitions.js +0 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ProgressBarVariant } from './ProgressBarVariant.js';
|
|
3
|
+
|
|
4
|
+
export interface ProgressBarSegment {
|
|
5
|
+
/** Percentage width of this segment (0-100). All segments should sum to <= 100. */
|
|
6
|
+
value: number;
|
|
7
|
+
/** Color variant for this segment */
|
|
8
|
+
variant?: ProgressBarVariant;
|
|
9
|
+
/** Label text displayed inside the segment */
|
|
10
|
+
label?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface ProgressBarProps {
|
|
14
|
+
/** Current progress value (0-100). Used in simple mode. */
|
|
15
|
+
value?: number;
|
|
16
|
+
/** Color variant for simple mode */
|
|
17
|
+
variant?: ProgressBarVariant;
|
|
18
|
+
/** Label text displayed centered on the filled portion */
|
|
19
|
+
label?: string;
|
|
20
|
+
/** Array of segments for multi-segment mode. Overrides value/variant/label when provided. */
|
|
21
|
+
segments?: ProgressBarSegment[];
|
|
22
|
+
/** Height of the bar */
|
|
23
|
+
size?: 'sm' | 'md' | 'lg';
|
|
24
|
+
/** Whether the bar has rounded ends */
|
|
25
|
+
rounded?: boolean;
|
|
26
|
+
/** Whether to animate width changes */
|
|
27
|
+
animated?: boolean;
|
|
28
|
+
/** Additional CSS classes */
|
|
29
|
+
class?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let {
|
|
33
|
+
value = 0,
|
|
34
|
+
variant = 'primary',
|
|
35
|
+
label = undefined,
|
|
36
|
+
segments = undefined,
|
|
37
|
+
size = 'md',
|
|
38
|
+
rounded = true,
|
|
39
|
+
animated = true,
|
|
40
|
+
class: classes = ''
|
|
41
|
+
}: ProgressBarProps = $props();
|
|
42
|
+
|
|
43
|
+
let clampedValue = $derived(Math.min(100, Math.max(0, value)));
|
|
44
|
+
let isMultiSegment = $derived(segments !== undefined && segments.length > 0);
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<div
|
|
48
|
+
class="progress-bar size-{size} {rounded ? 'rounded' : ''} {classes}"
|
|
49
|
+
role="progressbar"
|
|
50
|
+
aria-valuenow={isMultiSegment ? undefined : clampedValue}
|
|
51
|
+
aria-valuemin={0}
|
|
52
|
+
aria-valuemax={100}
|
|
53
|
+
>
|
|
54
|
+
{#if isMultiSegment && segments}
|
|
55
|
+
{#each segments as segment}
|
|
56
|
+
<div
|
|
57
|
+
class="segment {segment.variant ?? 'primary'} {animated ? 'animated' : ''}"
|
|
58
|
+
style="width: {Math.min(100, Math.max(0, segment.value))}%"
|
|
59
|
+
>
|
|
60
|
+
{#if segment.label}
|
|
61
|
+
<span class="label">{segment.label}</span>
|
|
62
|
+
{/if}
|
|
63
|
+
</div>
|
|
64
|
+
{/each}
|
|
65
|
+
{:else}
|
|
66
|
+
<div
|
|
67
|
+
class="fill {variant} {animated ? 'animated' : ''}"
|
|
68
|
+
style="width: {clampedValue}%"
|
|
69
|
+
>
|
|
70
|
+
{#if label}
|
|
71
|
+
<span class="label">{label}</span>
|
|
72
|
+
{/if}
|
|
73
|
+
</div>
|
|
74
|
+
{/if}
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<style>
|
|
78
|
+
.progress-bar {
|
|
79
|
+
width: 100%;
|
|
80
|
+
background-color: var(--border-color);
|
|
81
|
+
overflow: hidden;
|
|
82
|
+
display: flex;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.rounded {
|
|
86
|
+
border-radius: 9999px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.size-sm {
|
|
90
|
+
height: 8px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.size-md {
|
|
94
|
+
height: 20px;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.size-lg {
|
|
98
|
+
height: 28px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.fill,
|
|
102
|
+
.segment {
|
|
103
|
+
display: flex;
|
|
104
|
+
align-items: center;
|
|
105
|
+
justify-content: center;
|
|
106
|
+
overflow: hidden;
|
|
107
|
+
white-space: nowrap;
|
|
108
|
+
min-width: 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.animated {
|
|
112
|
+
transition: width 0.4s ease-in-out;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.label {
|
|
116
|
+
font-weight: 600;
|
|
117
|
+
line-height: 1;
|
|
118
|
+
text-overflow: ellipsis;
|
|
119
|
+
overflow: hidden;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.size-sm .label {
|
|
123
|
+
font-size: 0.5rem;
|
|
124
|
+
padding: 0 0.125rem;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.size-md .label {
|
|
128
|
+
font-size: 0.75rem;
|
|
129
|
+
padding: 0 0.5rem;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.size-lg .label {
|
|
133
|
+
font-size: 0.875rem;
|
|
134
|
+
padding: 0 0.625rem;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* Variant colors */
|
|
138
|
+
.primary,
|
|
139
|
+
.midnight {
|
|
140
|
+
background-color: var(--ui-primary);
|
|
141
|
+
color: #fff;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.accent,
|
|
145
|
+
.pistachio {
|
|
146
|
+
background-color: var(--ui-accent);
|
|
147
|
+
color: var(--ui-primary);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.tertiary,
|
|
151
|
+
.turquoise {
|
|
152
|
+
background-color: var(--ui-tertiary);
|
|
153
|
+
color: var(--ui-primary);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.danger {
|
|
157
|
+
background-color: var(--danger-bg);
|
|
158
|
+
color: #fff;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.secondary {
|
|
162
|
+
background-color: var(--accent-color);
|
|
163
|
+
color: #fff;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
:global(.dark) .secondary {
|
|
167
|
+
color: var(--ui-primary);
|
|
168
|
+
}
|
|
169
|
+
</style>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ProgressBarVariant } from './ProgressBarVariant.js';
|
|
2
|
+
export interface ProgressBarSegment {
|
|
3
|
+
/** Percentage width of this segment (0-100). All segments should sum to <= 100. */
|
|
4
|
+
value: number;
|
|
5
|
+
/** Color variant for this segment */
|
|
6
|
+
variant?: ProgressBarVariant;
|
|
7
|
+
/** Label text displayed inside the segment */
|
|
8
|
+
label?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ProgressBarProps {
|
|
11
|
+
/** Current progress value (0-100). Used in simple mode. */
|
|
12
|
+
value?: number;
|
|
13
|
+
/** Color variant for simple mode */
|
|
14
|
+
variant?: ProgressBarVariant;
|
|
15
|
+
/** Label text displayed centered on the filled portion */
|
|
16
|
+
label?: string;
|
|
17
|
+
/** Array of segments for multi-segment mode. Overrides value/variant/label when provided. */
|
|
18
|
+
segments?: ProgressBarSegment[];
|
|
19
|
+
/** Height of the bar */
|
|
20
|
+
size?: 'sm' | 'md' | 'lg';
|
|
21
|
+
/** Whether the bar has rounded ends */
|
|
22
|
+
rounded?: boolean;
|
|
23
|
+
/** Whether to animate width changes */
|
|
24
|
+
animated?: boolean;
|
|
25
|
+
/** Additional CSS classes */
|
|
26
|
+
class?: string;
|
|
27
|
+
}
|
|
28
|
+
declare const ProgressBar: import("svelte").Component<ProgressBarProps, {}, "">;
|
|
29
|
+
type ProgressBar = ReturnType<typeof ProgressBar>;
|
|
30
|
+
export default ProgressBar;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Colour variants for ProgressBar. `midnight`, `pistachio` and `turquoise` are
|
|
3
|
+
* legacy aliases for `primary`, `accent` and `tertiary`.
|
|
4
|
+
*/
|
|
5
|
+
export type ProgressBarVariant = 'primary' | 'accent' | 'tertiary' | 'danger' | 'secondary' | LegacyProgressBarVariant;
|
|
6
|
+
/** @deprecated Use `primary`, `accent` and `tertiary` instead. */
|
|
7
|
+
export type LegacyProgressBarVariant = 'midnight' | 'pistachio' | 'turquoise';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default SegmentedControl;
|
|
2
|
+
type SegmentedControl = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const SegmentedControl: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
export interface SortableProps<T> {
|
|
3
|
+
/** Items to render — bindable so reorders write back */
|
|
4
|
+
items: T[];
|
|
5
|
+
/** Renders each item. Receives (item, index, dragging). */
|
|
6
|
+
children: import('svelte').Snippet<[T, number, boolean]>;
|
|
7
|
+
/** Stable key per item — defaults to index (not safe for reordered lists with snippets that need identity) */
|
|
8
|
+
getKey?: (item: T, index: number) => string | number;
|
|
9
|
+
/** Layout direction */
|
|
10
|
+
direction?: 'vertical' | 'horizontal';
|
|
11
|
+
/** When true, dragging is disabled */
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/** CSS selector for drag handle within each item. When set, drag starts only from this element. */
|
|
14
|
+
handle?: string;
|
|
15
|
+
/** Group name — scopes this list's drag type. Note: Sortable is single-list reorder only; to move
|
|
16
|
+
* items between containers use MultiSortable, whose grouped lists exchange items. */
|
|
17
|
+
group?: string;
|
|
18
|
+
/** FLIP animation duration in ms as items shift during a drag. 0 disables. Requires a stable
|
|
19
|
+
* getKey — with the default index key, reordering swaps content in place and nothing moves. */
|
|
20
|
+
animation?: number;
|
|
21
|
+
/** Fires when the order changes */
|
|
22
|
+
onChange?: (items: T[]) => void;
|
|
23
|
+
class?: string;
|
|
24
|
+
}
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<script lang="ts" generics="T">
|
|
28
|
+
import { flip } from 'svelte/animate';
|
|
29
|
+
import { draggable, droppable, type DragContext } from '../util/DragDrop.js';
|
|
30
|
+
|
|
31
|
+
let {
|
|
32
|
+
items = $bindable(),
|
|
33
|
+
children,
|
|
34
|
+
getKey = (_: T, i: number) => i,
|
|
35
|
+
direction = 'vertical',
|
|
36
|
+
disabled = false,
|
|
37
|
+
handle,
|
|
38
|
+
group = 'default',
|
|
39
|
+
animation = 150,
|
|
40
|
+
onChange,
|
|
41
|
+
class: classes = ''
|
|
42
|
+
}: SortableProps<T> = $props();
|
|
43
|
+
|
|
44
|
+
const SORTABLE_ID = Math.random().toString(36).slice(2);
|
|
45
|
+
const TYPE = $derived(`pui-sortable:${group}`);
|
|
46
|
+
|
|
47
|
+
const reducedMotion =
|
|
48
|
+
typeof window !== 'undefined' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
49
|
+
const flipDuration = $derived(reducedMotion ? 0 : animation);
|
|
50
|
+
|
|
51
|
+
interface SortablePayload {
|
|
52
|
+
sortableId: string;
|
|
53
|
+
index: number;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
let draggingIndex = $state<number | null>(null);
|
|
57
|
+
let container = $state<HTMLElement>();
|
|
58
|
+
/** Order at drag start — restored if the drag is cancelled (Esc or dropped outside the list). */
|
|
59
|
+
let dragSnapshot: T[] | null = null;
|
|
60
|
+
let dropped = false;
|
|
61
|
+
|
|
62
|
+
function isOwnDrag(ctx: DragContext<SortablePayload>) {
|
|
63
|
+
return ctx.payload.sortableId === SORTABLE_ID;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Live reorder: instead of showing a drop marker, the dragged item moves in the array
|
|
68
|
+
* as the pointer crosses item midpoints and FLIP animates everything into place. The
|
|
69
|
+
* target slot is the number of midpoints (dragged item excluded) the pointer has
|
|
70
|
+
* passed — comparing that against the current index is what keeps this stable while
|
|
71
|
+
* displaced items are still animating under the pointer.
|
|
72
|
+
*/
|
|
73
|
+
function handleDragOver(e: DragEvent, ctx: DragContext<SortablePayload>) {
|
|
74
|
+
if (!isOwnDrag(ctx) || draggingIndex === null || !container) return;
|
|
75
|
+
const els = container.querySelectorAll<HTMLElement>(':scope > .pui-sortable-item');
|
|
76
|
+
const pointer = direction === 'vertical' ? e.clientY : e.clientX;
|
|
77
|
+
let target = 0;
|
|
78
|
+
for (let idx = 0; idx < els.length; idx++) {
|
|
79
|
+
if (idx === draggingIndex) continue;
|
|
80
|
+
const rect = els[idx].getBoundingClientRect();
|
|
81
|
+
const mid =
|
|
82
|
+
direction === 'vertical' ? rect.top + rect.height / 2 : rect.left + rect.width / 2;
|
|
83
|
+
if (pointer > mid) target++;
|
|
84
|
+
}
|
|
85
|
+
if (target === draggingIndex) return;
|
|
86
|
+
const next = items.slice();
|
|
87
|
+
const [moved] = next.splice(draggingIndex, 1);
|
|
88
|
+
next.splice(target, 0, moved);
|
|
89
|
+
items = next;
|
|
90
|
+
draggingIndex = target;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function handleDrop(ctx: DragContext<SortablePayload>) {
|
|
94
|
+
if (!isOwnDrag(ctx)) return;
|
|
95
|
+
dropped = true;
|
|
96
|
+
const snapshot = dragSnapshot;
|
|
97
|
+
if (snapshot && items.some((item, idx) => item !== snapshot[idx])) {
|
|
98
|
+
onChange?.(items);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<div
|
|
104
|
+
bind:this={container}
|
|
105
|
+
class="pui-sortable {direction} {classes}"
|
|
106
|
+
use:droppable={{
|
|
107
|
+
accepts: TYPE,
|
|
108
|
+
canDrop: (ctx) => isOwnDrag(ctx as DragContext<SortablePayload>),
|
|
109
|
+
onDragOver: (ctx, e) => handleDragOver(e, ctx as DragContext<SortablePayload>),
|
|
110
|
+
onDrop: (ctx) => handleDrop(ctx as DragContext<SortablePayload>)
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
{#each items as item, i (getKey(item, i))}
|
|
114
|
+
<div
|
|
115
|
+
class="pui-sortable-item"
|
|
116
|
+
class:is-dragging={draggingIndex === i}
|
|
117
|
+
animate:flip={{ duration: flipDuration }}
|
|
118
|
+
use:draggable={{
|
|
119
|
+
payload: { sortableId: SORTABLE_ID, index: i } satisfies SortablePayload,
|
|
120
|
+
type: TYPE,
|
|
121
|
+
source: SORTABLE_ID,
|
|
122
|
+
disabled,
|
|
123
|
+
handle,
|
|
124
|
+
onDragStart: () => {
|
|
125
|
+
draggingIndex = i;
|
|
126
|
+
dragSnapshot = items.slice();
|
|
127
|
+
dropped = false;
|
|
128
|
+
},
|
|
129
|
+
onDragEnd: () => {
|
|
130
|
+
if (!dropped && dragSnapshot) items = dragSnapshot;
|
|
131
|
+
draggingIndex = null;
|
|
132
|
+
dragSnapshot = null;
|
|
133
|
+
}
|
|
134
|
+
}}
|
|
135
|
+
>
|
|
136
|
+
{@render children(item, i, draggingIndex === i)}
|
|
137
|
+
</div>
|
|
138
|
+
{/each}
|
|
139
|
+
</div>
|
|
140
|
+
|
|
141
|
+
<style>
|
|
142
|
+
.pui-sortable {
|
|
143
|
+
display: flex;
|
|
144
|
+
gap: 0.25rem;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.pui-sortable.vertical {
|
|
148
|
+
flex-direction: column;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.pui-sortable.horizontal {
|
|
152
|
+
flex-direction: row;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.pui-sortable-item {
|
|
156
|
+
position: relative;
|
|
157
|
+
transition: opacity 0.15s ease;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.pui-sortable-item.is-dragging {
|
|
161
|
+
opacity: 0.35;
|
|
162
|
+
}
|
|
163
|
+
</style>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export interface SortableProps<T> {
|
|
2
|
+
/** Items to render — bindable so reorders write back */
|
|
3
|
+
items: T[];
|
|
4
|
+
/** Renders each item. Receives (item, index, dragging). */
|
|
5
|
+
children: import('svelte').Snippet<[T, number, boolean]>;
|
|
6
|
+
/** Stable key per item — defaults to index (not safe for reordered lists with snippets that need identity) */
|
|
7
|
+
getKey?: (item: T, index: number) => string | number;
|
|
8
|
+
/** Layout direction */
|
|
9
|
+
direction?: 'vertical' | 'horizontal';
|
|
10
|
+
/** When true, dragging is disabled */
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/** CSS selector for drag handle within each item. When set, drag starts only from this element. */
|
|
13
|
+
handle?: string;
|
|
14
|
+
/** Group name — scopes this list's drag type. Note: Sortable is single-list reorder only; to move
|
|
15
|
+
* items between containers use MultiSortable, whose grouped lists exchange items. */
|
|
16
|
+
group?: string;
|
|
17
|
+
/** FLIP animation duration in ms as items shift during a drag. 0 disables. Requires a stable
|
|
18
|
+
* getKey — with the default index key, reordering swaps content in place and nothing moves. */
|
|
19
|
+
animation?: number;
|
|
20
|
+
/** Fires when the order changes */
|
|
21
|
+
onChange?: (items: T[]) => void;
|
|
22
|
+
class?: string;
|
|
23
|
+
}
|
|
24
|
+
declare function $$render<T>(): {
|
|
25
|
+
props: SortableProps<T>;
|
|
26
|
+
exports: {};
|
|
27
|
+
bindings: "items";
|
|
28
|
+
slots: {};
|
|
29
|
+
events: {};
|
|
30
|
+
};
|
|
31
|
+
declare class __sveltets_Render<T> {
|
|
32
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
33
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
34
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
35
|
+
bindings(): "items";
|
|
36
|
+
exports(): {};
|
|
37
|
+
}
|
|
38
|
+
interface $$IsomorphicComponent {
|
|
39
|
+
new <T>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
40
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
41
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
42
|
+
<T>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
43
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
44
|
+
}
|
|
45
|
+
declare const Sortable: $$IsomorphicComponent;
|
|
46
|
+
type Sortable<T> = InstanceType<typeof Sortable<T>>;
|
|
47
|
+
export default Sortable;
|