pika-ux 1.0.0-beta.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 +9 -0
- package/dist/icon-generator/generate-icon-ts-indices.js +78 -0
- package/dist/shadcn-postinstall/index.js +114 -0
- package/package.json +102 -0
- package/readme.md +50 -0
- package/scripts/setup.js +100 -0
- package/src/App.svelte +51 -0
- package/src/app.css +349 -0
- package/src/icons/ci/index.d.ts +5009 -0
- package/src/icons/lucide/index.d.ts +11274 -0
- package/src/index.ts +23 -0
- package/src/lib/docsite/Navigation.svelte +77 -0
- package/src/lib/docsite/pages/Colors.svelte +35 -0
- package/src/lib/docsite/pages/Components.svelte +50 -0
- package/src/lib/docsite/pages/GettingStarted.svelte +21 -0
- package/src/lib/docsite/pages/Icons.svelte +22 -0
- package/src/lib/docsite/pages/components/Button.svelte +40 -0
- package/src/main.ts +9 -0
- package/src/pika/chip/chip.svelte +95 -0
- package/src/pika/chip/index.ts +1 -0
- package/src/pika/combobox/combobox-types.ts +5 -0
- package/src/pika/combobox/combobox.svelte +221 -0
- package/src/pika/combobox/index.ts +2 -0
- package/src/pika/confirm-dialog/confirm-dialog.svelte +48 -0
- package/src/pika/confirm-dialog/index.ts +1 -0
- package/src/pika/copy-button/copy-button.svelte +134 -0
- package/src/pika/copy-button/index.ts +1 -0
- package/src/pika/create-copy-link-button/create-copy-link-button.svelte +133 -0
- package/src/pika/create-copy-link-button/index.ts +1 -0
- package/src/pika/date-picker/date-picker.svelte +33 -0
- package/src/pika/date-picker/index.ts +1 -0
- package/src/pika/date-range-picker/date-range-picker.svelte +48 -0
- package/src/pika/date-range-picker/index.ts +1 -0
- package/src/pika/date-time-picker/date-time-picker.svelte +336 -0
- package/src/pika/date-time-picker/index.ts +1 -0
- package/src/pika/expandable-container/expandable-container.svelte +155 -0
- package/src/pika/expandable-container/index.ts +1 -0
- package/src/pika/index.ts +29 -0
- package/src/pika/list/index.ts +2 -0
- package/src/pika/list/list-types.ts +5 -0
- package/src/pika/list/list.svelte +349 -0
- package/src/pika/markdown-editor/github.scss +87 -0
- package/src/pika/markdown-editor/index.ts +1 -0
- package/src/pika/markdown-editor/markdown-editor.svelte +44 -0
- package/src/pika/permanent-toast/index.ts +1 -0
- package/src/pika/permanent-toast/permanent-toast.svelte +47 -0
- package/src/pika/pika-alert/index.ts +1 -0
- package/src/pika/pika-alert/pika-alert.svelte +53 -0
- package/src/pika/pika-badge/index.ts +1 -0
- package/src/pika/pika-badge/pika-badge.svelte +61 -0
- package/src/pika/pika-table/index.ts +7 -0
- package/src/pika/pika-table/pika-table-cell.svelte +9 -0
- package/src/pika/pika-table/pika-table-checkbox.svelte +8 -0
- package/src/pika/pika-table/pika-table-column-header.svelte +88 -0
- package/src/pika/pika-table/pika-table-faceted-filter.svelte +109 -0
- package/src/pika/pika-table/pika-table-pagination.svelte +95 -0
- package/src/pika/pika-table/pika-table-row-actions.svelte +58 -0
- package/src/pika/pika-table/pika-table-toolbar.svelte +88 -0
- package/src/pika/pika-table/pika-table-view-options.svelte +35 -0
- package/src/pika/pika-table/pika-table.svelte +295 -0
- package/src/pika/pika-table/types.ts +106 -0
- package/src/pika/pika-tabs/index.ts +18 -0
- package/src/pika/pika-tabs/tabs-content.svelte +16 -0
- package/src/pika/pika-tabs/tabs-list.svelte +12 -0
- package/src/pika/pika-tabs/tabs-trigger.svelte +23 -0
- package/src/pika/popup-help/index.ts +1 -0
- package/src/pika/popup-help/popup-help.svelte +33 -0
- package/src/pika/simple-dropdown/index.ts +2 -0
- package/src/pika/simple-dropdown/simple-dropdown-types.ts +5 -0
- package/src/pika/simple-dropdown/simple-dropdown.svelte +288 -0
- package/src/pika/slideout/constants.ts +5 -0
- package/src/pika/slideout/context.svelte.ts +110 -0
- package/src/pika/slideout/index.ts +19 -0
- package/src/pika/slideout/slideout-content.svelte +36 -0
- package/src/pika/slideout/slideout-panel.svelte +126 -0
- package/src/pika/slideout/slideout-provider.svelte +49 -0
- package/src/pika/slideout/slideout-rail.svelte.die +69 -0
- package/src/pika/slideout/slideout.svelte +33 -0
- package/src/pika/slideout/slideout.svelte.old +113 -0
- package/src/pika/text-wave-shimmer/index.ts +1 -0
- package/src/pika/text-wave-shimmer/text-wave-shimmer.svelte +43 -0
- package/src/pika/tooltip-plus/index.ts +1 -0
- package/src/pika/tooltip-plus/tooltip-plus.svelte +42 -0
- package/src/shadcn/.DS_Store +0 -0
- package/src/shadcn/alert/alert-description.svelte +11 -0
- package/src/shadcn/alert/alert-title.svelte +24 -0
- package/src/shadcn/alert/alert.svelte +39 -0
- package/src/shadcn/alert/index.ts +14 -0
- package/src/shadcn/avatar/avatar-fallback.svelte +13 -0
- package/src/shadcn/avatar/avatar-image.svelte +13 -0
- package/src/shadcn/avatar/avatar.svelte +19 -0
- package/src/shadcn/avatar/index.ts +13 -0
- package/src/shadcn/badge/badge.svelte +48 -0
- package/src/shadcn/badge/index.ts +2 -0
- package/src/shadcn/breadcrumb/breadcrumb-ellipsis.svelte +12 -0
- package/src/shadcn/breadcrumb/breadcrumb-item.svelte +20 -0
- package/src/shadcn/breadcrumb/breadcrumb-link.svelte +31 -0
- package/src/shadcn/breadcrumb/breadcrumb-list.svelte +20 -0
- package/src/shadcn/breadcrumb/breadcrumb-page.svelte +23 -0
- package/src/shadcn/breadcrumb/breadcrumb-separator.svelte +15 -0
- package/src/shadcn/breadcrumb/breadcrumb.svelte +15 -0
- package/src/shadcn/breadcrumb/index.ts +25 -0
- package/src/shadcn/button/button.svelte +81 -0
- package/src/shadcn/button/index.ts +17 -0
- package/src/shadcn/calendar/calendar-caption.svelte +76 -0
- package/src/shadcn/calendar/calendar-cell.svelte +19 -0
- package/src/shadcn/calendar/calendar-day.svelte +31 -0
- package/src/shadcn/calendar/calendar-grid-body.svelte +12 -0
- package/src/shadcn/calendar/calendar-grid-head.svelte +12 -0
- package/src/shadcn/calendar/calendar-grid-row.svelte +12 -0
- package/src/shadcn/calendar/calendar-grid.svelte +16 -0
- package/src/shadcn/calendar/calendar-head-cell.svelte +16 -0
- package/src/shadcn/calendar/calendar-header.svelte +16 -0
- package/src/shadcn/calendar/calendar-heading.svelte +12 -0
- package/src/shadcn/calendar/calendar-month-select.svelte +25 -0
- package/src/shadcn/calendar/calendar-month.svelte +15 -0
- package/src/shadcn/calendar/calendar-months.svelte +20 -0
- package/src/shadcn/calendar/calendar-nav.svelte +19 -0
- package/src/shadcn/calendar/calendar-next-button.svelte +19 -0
- package/src/shadcn/calendar/calendar-prev-button.svelte +19 -0
- package/src/shadcn/calendar/calendar-year-select.svelte +25 -0
- package/src/shadcn/calendar/calendar.svelte +61 -0
- package/src/shadcn/calendar/index.ts +30 -0
- package/src/shadcn/card/card-content.svelte +16 -0
- package/src/shadcn/card/card-description.svelte +16 -0
- package/src/shadcn/card/card-footer.svelte +16 -0
- package/src/shadcn/card/card-header.svelte +16 -0
- package/src/shadcn/card/card-title.svelte +25 -0
- package/src/shadcn/card/card.svelte +20 -0
- package/src/shadcn/card/index.ts +22 -0
- package/src/shadcn/carousel/carousel-content.svelte +39 -0
- package/src/shadcn/carousel/carousel-item.svelte +26 -0
- package/src/shadcn/carousel/carousel-next.svelte +30 -0
- package/src/shadcn/carousel/carousel-previous.svelte +30 -0
- package/src/shadcn/carousel/carousel.svelte +88 -0
- package/src/shadcn/carousel/context.ts +51 -0
- package/src/shadcn/carousel/index.ts +19 -0
- package/src/shadcn/checkbox/checkbox.svelte +36 -0
- package/src/shadcn/checkbox/index.ts +6 -0
- package/src/shadcn/collapsible/collapsible-content.svelte +7 -0
- package/src/shadcn/collapsible/collapsible-trigger.svelte +7 -0
- package/src/shadcn/collapsible/collapsible.svelte +11 -0
- package/src/shadcn/collapsible/index.ts +13 -0
- package/src/shadcn/command/command-dialog.svelte +40 -0
- package/src/shadcn/command/command-empty.svelte +13 -0
- package/src/shadcn/command/command-group.svelte +30 -0
- package/src/shadcn/command/command-input.svelte +21 -0
- package/src/shadcn/command/command-item.svelte +16 -0
- package/src/shadcn/command/command-link-item.svelte +16 -0
- package/src/shadcn/command/command-list.svelte +13 -0
- package/src/shadcn/command/command-separator.svelte +13 -0
- package/src/shadcn/command/command-shortcut.svelte +20 -0
- package/src/shadcn/command/command.svelte +19 -0
- package/src/shadcn/command/index.ts +40 -0
- package/src/shadcn/data-table/data-table.svelte.ts +141 -0
- package/src/shadcn/data-table/flex-render.svelte +36 -0
- package/src/shadcn/data-table/index.ts +3 -0
- package/src/shadcn/data-table/render-helpers.ts +111 -0
- package/src/shadcn/dialog/dialog-close.svelte +7 -0
- package/src/shadcn/dialog/dialog-content.svelte +43 -0
- package/src/shadcn/dialog/dialog-description.svelte +13 -0
- package/src/shadcn/dialog/dialog-footer.svelte +20 -0
- package/src/shadcn/dialog/dialog-header.svelte +20 -0
- package/src/shadcn/dialog/dialog-overlay.svelte +16 -0
- package/src/shadcn/dialog/dialog-title.svelte +13 -0
- package/src/shadcn/dialog/dialog-trigger.svelte +7 -0
- package/src/shadcn/dialog/index.ts +37 -0
- package/src/shadcn/dropdown-menu/dropdown-menu-checkbox-item.svelte +41 -0
- package/src/shadcn/dropdown-menu/dropdown-menu-content.svelte +27 -0
- package/src/shadcn/dropdown-menu/dropdown-menu-group-heading.svelte +22 -0
- package/src/shadcn/dropdown-menu/dropdown-menu-group.svelte +7 -0
- package/src/shadcn/dropdown-menu/dropdown-menu-item.svelte +27 -0
- package/src/shadcn/dropdown-menu/dropdown-menu-label.svelte +24 -0
- package/src/shadcn/dropdown-menu/dropdown-menu-radio-group.svelte +16 -0
- package/src/shadcn/dropdown-menu/dropdown-menu-radio-item.svelte +26 -0
- package/src/shadcn/dropdown-menu/dropdown-menu-separator.svelte +13 -0
- package/src/shadcn/dropdown-menu/dropdown-menu-shortcut.svelte +20 -0
- package/src/shadcn/dropdown-menu/dropdown-menu-sub-content.svelte +16 -0
- package/src/shadcn/dropdown-menu/dropdown-menu-sub-trigger.svelte +29 -0
- package/src/shadcn/dropdown-menu/dropdown-menu-trigger.svelte +7 -0
- package/src/shadcn/dropdown-menu/index.ts +49 -0
- package/src/shadcn/index.ts +40 -0
- package/src/shadcn/input/index.ts +7 -0
- package/src/shadcn/input/input.svelte +51 -0
- package/src/shadcn/is-mobile.svelte.ts +9 -0
- package/src/shadcn/label/index.ts +7 -0
- package/src/shadcn/label/label.svelte +16 -0
- package/src/shadcn/popover/index.ts +17 -0
- package/src/shadcn/popover/popover-content.svelte +29 -0
- package/src/shadcn/popover/popover-trigger.svelte +8 -0
- package/src/shadcn/radio-group/index.ts +10 -0
- package/src/shadcn/radio-group/radio-group-item.svelte +25 -0
- package/src/shadcn/radio-group/radio-group.svelte +19 -0
- package/src/shadcn/range-calendar/index.ts +30 -0
- package/src/shadcn/range-calendar/range-calendar-cell.svelte +19 -0
- package/src/shadcn/range-calendar/range-calendar-day.svelte +35 -0
- package/src/shadcn/range-calendar/range-calendar-grid-body.svelte +12 -0
- package/src/shadcn/range-calendar/range-calendar-grid-head.svelte +12 -0
- package/src/shadcn/range-calendar/range-calendar-grid-row.svelte +12 -0
- package/src/shadcn/range-calendar/range-calendar-grid.svelte +16 -0
- package/src/shadcn/range-calendar/range-calendar-head-cell.svelte +16 -0
- package/src/shadcn/range-calendar/range-calendar-header.svelte +16 -0
- package/src/shadcn/range-calendar/range-calendar-heading.svelte +16 -0
- package/src/shadcn/range-calendar/range-calendar-months.svelte +20 -0
- package/src/shadcn/range-calendar/range-calendar-next-button.svelte +18 -0
- package/src/shadcn/range-calendar/range-calendar-prev-button.svelte +18 -0
- package/src/shadcn/range-calendar/range-calendar.svelte +57 -0
- package/src/shadcn/resizable/index.ts +13 -0
- package/src/shadcn/resizable/resizable-handle.svelte +30 -0
- package/src/shadcn/resizable/resizable-pane-group.svelte +22 -0
- package/src/shadcn/scroll-area/index.ts +10 -0
- package/src/shadcn/scroll-area/scroll-area-scrollbar.svelte +28 -0
- package/src/shadcn/scroll-area/scroll-area.svelte +35 -0
- package/src/shadcn/select/index.ts +37 -0
- package/src/shadcn/select/select-content.svelte +38 -0
- package/src/shadcn/select/select-group-heading.svelte +21 -0
- package/src/shadcn/select/select-group.svelte +7 -0
- package/src/shadcn/select/select-item.svelte +31 -0
- package/src/shadcn/select/select-label.svelte +20 -0
- package/src/shadcn/select/select-scroll-down-button.svelte +11 -0
- package/src/shadcn/select/select-scroll-up-button.svelte +11 -0
- package/src/shadcn/select/select-separator.svelte +14 -0
- package/src/shadcn/select/select-trigger.svelte +30 -0
- package/src/shadcn/separator/index.ts +7 -0
- package/src/shadcn/separator/separator.svelte +16 -0
- package/src/shadcn/sheet/index.ts +36 -0
- package/src/shadcn/sheet/sheet-close.svelte +7 -0
- package/src/shadcn/sheet/sheet-content.svelte +66 -0
- package/src/shadcn/sheet/sheet-description.svelte +13 -0
- package/src/shadcn/sheet/sheet-footer.svelte +15 -0
- package/src/shadcn/sheet/sheet-header.svelte +15 -0
- package/src/shadcn/sheet/sheet-overlay.svelte +16 -0
- package/src/shadcn/sheet/sheet-title.svelte +13 -0
- package/src/shadcn/sheet/sheet-trigger.svelte +7 -0
- package/src/shadcn/sidebar/constants.ts +6 -0
- package/src/shadcn/sidebar/context.svelte.ts +80 -0
- package/src/shadcn/sidebar/index.ts +75 -0
- package/src/shadcn/sidebar/sidebar-content.svelte +24 -0
- package/src/shadcn/sidebar/sidebar-footer.svelte +21 -0
- package/src/shadcn/sidebar/sidebar-group-action.svelte +36 -0
- package/src/shadcn/sidebar/sidebar-group-content.svelte +21 -0
- package/src/shadcn/sidebar/sidebar-group-label.svelte +34 -0
- package/src/shadcn/sidebar/sidebar-group.svelte +21 -0
- package/src/shadcn/sidebar/sidebar-header.svelte +21 -0
- package/src/shadcn/sidebar/sidebar-input.svelte +21 -0
- package/src/shadcn/sidebar/sidebar-inset.svelte +24 -0
- package/src/shadcn/sidebar/sidebar-menu-action.svelte +43 -0
- package/src/shadcn/sidebar/sidebar-menu-badge.svelte +29 -0
- package/src/shadcn/sidebar/sidebar-menu-button.svelte +101 -0
- package/src/shadcn/sidebar/sidebar-menu-item.svelte +21 -0
- package/src/shadcn/sidebar/sidebar-menu-skeleton.svelte +36 -0
- package/src/shadcn/sidebar/sidebar-menu-sub-button.svelte +43 -0
- package/src/shadcn/sidebar/sidebar-menu-sub-item.svelte +21 -0
- package/src/shadcn/sidebar/sidebar-menu-sub.svelte +25 -0
- package/src/shadcn/sidebar/sidebar-menu.svelte +21 -0
- package/src/shadcn/sidebar/sidebar-provider.svelte +46 -0
- package/src/shadcn/sidebar/sidebar-rail.svelte +36 -0
- package/src/shadcn/sidebar/sidebar-separator.svelte +15 -0
- package/src/shadcn/sidebar/sidebar-trigger.svelte +35 -0
- package/src/shadcn/sidebar/sidebar.svelte +94 -0
- package/src/shadcn/skeleton/index.ts +7 -0
- package/src/shadcn/skeleton/skeleton.svelte +17 -0
- package/src/shadcn/slider/index.ts +7 -0
- package/src/shadcn/slider/slider.svelte +44 -0
- package/src/shadcn/sonner/index.ts +1 -0
- package/src/shadcn/sonner/sonner.svelte +13 -0
- package/src/shadcn/switch/index.ts +7 -0
- package/src/shadcn/switch/switch.svelte +27 -0
- package/src/shadcn/table/index.ts +28 -0
- package/src/shadcn/table/table-body.svelte +15 -0
- package/src/shadcn/table/table-caption.svelte +20 -0
- package/src/shadcn/table/table-cell.svelte +20 -0
- package/src/shadcn/table/table-footer.svelte +20 -0
- package/src/shadcn/table/table-head.svelte +23 -0
- package/src/shadcn/table/table-header.svelte +15 -0
- package/src/shadcn/table/table-row.svelte +23 -0
- package/src/shadcn/table/table.svelte +17 -0
- package/src/shadcn/tabs/index.ts +18 -0
- package/src/shadcn/tabs/tabs-content.svelte +21 -0
- package/src/shadcn/tabs/tabs-list.svelte +19 -0
- package/src/shadcn/tabs/tabs-trigger.svelte +21 -0
- package/src/shadcn/textarea/index.ts +7 -0
- package/src/shadcn/textarea/textarea.svelte +22 -0
- package/src/shadcn/toggle/index.ts +13 -0
- package/src/shadcn/toggle/toggle.svelte +51 -0
- package/src/shadcn/toggle-group/index.ts +10 -0
- package/src/shadcn/toggle-group/toggle-group-item.svelte +30 -0
- package/src/shadcn/toggle-group/toggle-group.svelte +41 -0
- package/src/shadcn/tooltip/index.ts +21 -0
- package/src/shadcn/tooltip/tooltip-content.svelte +47 -0
- package/src/shadcn/tooltip/tooltip-trigger.svelte +7 -0
- package/src/shadcn/utils.ts +14 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../shadcn/utils.js';
|
|
3
|
+
import type { WithElementRef } from 'bits-ui';
|
|
4
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
|
+
import { useSlideout } from './context.svelte.js';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
ref = $bindable(null),
|
|
9
|
+
class: className,
|
|
10
|
+
children,
|
|
11
|
+
...restProps
|
|
12
|
+
}: WithElementRef<HTMLAttributes<HTMLButtonElement>, HTMLButtonElement> = $props();
|
|
13
|
+
|
|
14
|
+
const slideout = useSlideout();
|
|
15
|
+
|
|
16
|
+
// Add resize support alongside toggle
|
|
17
|
+
let isDragging = $state(false);
|
|
18
|
+
let startX = $state(0);
|
|
19
|
+
|
|
20
|
+
function handleDragStart(e: MouseEvent) {
|
|
21
|
+
isDragging = true;
|
|
22
|
+
startX = e.clientX;
|
|
23
|
+
|
|
24
|
+
window.addEventListener('mousemove', handleDragMove);
|
|
25
|
+
window.addEventListener('mouseup', handleDragEnd);
|
|
26
|
+
|
|
27
|
+
document.body.style.userSelect = 'none';
|
|
28
|
+
e.preventDefault();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function handleDragMove(e: MouseEvent) {
|
|
32
|
+
if (!isDragging) return;
|
|
33
|
+
// Implement drag resize logic here
|
|
34
|
+
// This should communicate with the panel component
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function handleDragEnd() {
|
|
38
|
+
isDragging = false;
|
|
39
|
+
window.removeEventListener('mousemove', handleDragMove);
|
|
40
|
+
window.removeEventListener('mouseup', handleDragEnd);
|
|
41
|
+
document.body.style.userSelect = '';
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function cleanup() {
|
|
45
|
+
window.removeEventListener('mousemove', handleDragMove);
|
|
46
|
+
window.removeEventListener('mouseup', handleDragEnd);
|
|
47
|
+
}
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<svelte:window on:beforeunload={cleanup} />
|
|
51
|
+
|
|
52
|
+
<button
|
|
53
|
+
bind:this={ref}
|
|
54
|
+
data-slideout="rail"
|
|
55
|
+
aria-label="Toggle Slideout"
|
|
56
|
+
tabIndex={-1}
|
|
57
|
+
onclick={() => slideout.toggle()}
|
|
58
|
+
onmousedown={handleDragStart}
|
|
59
|
+
title="Toggle Slideout"
|
|
60
|
+
class={cn(
|
|
61
|
+
'hover:after:bg-gray-300 absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex',
|
|
62
|
+
'[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize',
|
|
63
|
+
'[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize',
|
|
64
|
+
className
|
|
65
|
+
)}
|
|
66
|
+
{...restProps}
|
|
67
|
+
>
|
|
68
|
+
{@render children?.()}
|
|
69
|
+
</button>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../shadcn/utils.js';
|
|
3
|
+
import type { WithElementRef } from 'bits-ui';
|
|
4
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
|
+
import { useSlideout } from './context.svelte.js';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
ref = $bindable(null),
|
|
9
|
+
class: className,
|
|
10
|
+
children,
|
|
11
|
+
...restProps
|
|
12
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
|
|
13
|
+
|
|
14
|
+
// Use the slideout context
|
|
15
|
+
const slideout = useSlideout();
|
|
16
|
+
|
|
17
|
+
// h-full => h-screen
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<div
|
|
21
|
+
bind:this={ref}
|
|
22
|
+
data-slideout="root"
|
|
23
|
+
data-side={slideout.side}
|
|
24
|
+
data-state={slideout.state}
|
|
25
|
+
class={cn(
|
|
26
|
+
'flex h-screen w-full relative overflow-hidden',
|
|
27
|
+
slideout.side === 'right' ? 'flex-row' : 'flex-row-reverse',
|
|
28
|
+
className
|
|
29
|
+
)}
|
|
30
|
+
{...restProps}
|
|
31
|
+
>
|
|
32
|
+
{@render children?.()}
|
|
33
|
+
</div>
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { tv, type VariantProps } from 'tailwind-variants';
|
|
3
|
+
|
|
4
|
+
export const slideoutPanelVariants = tv({
|
|
5
|
+
base: 'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out z-50 gap-4 transition-all ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 h-full flex flex-col flex-1',
|
|
6
|
+
variants: {
|
|
7
|
+
side: {
|
|
8
|
+
left: 'h-full data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left border-r',
|
|
9
|
+
right: 'h-full data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right border-l',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
defaultVariants: {
|
|
13
|
+
side: 'right',
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type Side = VariantProps<typeof slideoutPanelVariants>['side'];
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
import { X } from '$icons/lucide';
|
|
22
|
+
import type { Snippet } from 'svelte';
|
|
23
|
+
import { cn } from '../../shadcn/utils.js';
|
|
24
|
+
|
|
25
|
+
let {
|
|
26
|
+
open = $bindable(false),
|
|
27
|
+
class: className,
|
|
28
|
+
side = 'right',
|
|
29
|
+
width = '75%',
|
|
30
|
+
minWidth = '20%',
|
|
31
|
+
maxWidth = '95%',
|
|
32
|
+
children,
|
|
33
|
+
...restProps
|
|
34
|
+
}: {
|
|
35
|
+
open?: boolean;
|
|
36
|
+
class?: string;
|
|
37
|
+
side?: Side;
|
|
38
|
+
width?: string;
|
|
39
|
+
minWidth?: string;
|
|
40
|
+
maxWidth?: string;
|
|
41
|
+
children?: Snippet<[]> | undefined;
|
|
42
|
+
} = $props();
|
|
43
|
+
|
|
44
|
+
let isDragging = false;
|
|
45
|
+
let startX = 0;
|
|
46
|
+
let startWidth = 0;
|
|
47
|
+
let currentWidth = width;
|
|
48
|
+
|
|
49
|
+
function handleMouseDown(e: MouseEvent) {
|
|
50
|
+
isDragging = true;
|
|
51
|
+
startX = e.clientX;
|
|
52
|
+
startWidth = parseFloat(currentWidth);
|
|
53
|
+
|
|
54
|
+
window.addEventListener('mousemove', handleMouseMove);
|
|
55
|
+
window.addEventListener('mouseup', handleMouseUp);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function handleMouseMove(e: MouseEvent) {
|
|
59
|
+
if (!isDragging) return;
|
|
60
|
+
|
|
61
|
+
const delta = side === 'right' ? startX - e.clientX : e.clientX - startX;
|
|
62
|
+
|
|
63
|
+
const containerWidth = document.body.clientWidth;
|
|
64
|
+
const newWidthPx = startWidth + delta;
|
|
65
|
+
const newWidthPercent = (newWidthPx / containerWidth) * 100;
|
|
66
|
+
|
|
67
|
+
const minWidthPercent = parseFloat(minWidth);
|
|
68
|
+
const maxWidthPercent = parseFloat(maxWidth);
|
|
69
|
+
|
|
70
|
+
currentWidth = `${Math.min(Math.max(newWidthPercent, minWidthPercent), maxWidthPercent)}%`;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function handleMouseUp() {
|
|
74
|
+
isDragging = false;
|
|
75
|
+
window.removeEventListener('mousemove', handleMouseMove);
|
|
76
|
+
window.removeEventListener('mouseup', handleMouseUp);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const containerClasses = $derived(
|
|
80
|
+
cn(
|
|
81
|
+
'relative flex h-full w-full transition-all duration-500 ease-in-out',
|
|
82
|
+
open ? `w-[${currentWidth}]` : 'w-0 overflow-hidden',
|
|
83
|
+
isDragging && 'select-none'
|
|
84
|
+
)
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
const resizeHandleClasses = $derived(
|
|
88
|
+
cn(
|
|
89
|
+
'absolute top-0 w-1 h-full cursor-col-resize hover:bg-accent/50 active:bg-accent/75 transition-colors',
|
|
90
|
+
side === 'right' ? '-left-0.5' : '-right-0.5'
|
|
91
|
+
)
|
|
92
|
+
);
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<!-- <svelte:window onmouseup={handleMouseUp} /> -->
|
|
96
|
+
|
|
97
|
+
<div class="flex h-full" style="width: {currentWidth}">
|
|
98
|
+
<div class={containerClasses}>
|
|
99
|
+
<div class={cn(slideoutPanelVariants({ side }), className)} {...restProps}>
|
|
100
|
+
<div class={resizeHandleClasses} onmousedown={handleMouseDown} aria-hidden="true"></div>
|
|
101
|
+
<div class="h-full flex-1">
|
|
102
|
+
{@render children?.()}
|
|
103
|
+
</div>
|
|
104
|
+
<!-- <button
|
|
105
|
+
class="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none"
|
|
106
|
+
on:click={() => (open = false)}
|
|
107
|
+
>
|
|
108
|
+
<X class="size-4" />
|
|
109
|
+
<span class="sr-only">Close</span>
|
|
110
|
+
</button> -->
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as TextWaveShimmer } from './text-wave-shimmer.svelte';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { type Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
children?: Snippet<[]>;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { children, disabled }: Props = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
{#if children}
|
|
13
|
+
{#if disabled}
|
|
14
|
+
{@render children()}
|
|
15
|
+
{:else}
|
|
16
|
+
<span class="wave-char">
|
|
17
|
+
{@render children()}
|
|
18
|
+
</span>
|
|
19
|
+
{/if}
|
|
20
|
+
{/if}
|
|
21
|
+
|
|
22
|
+
<style>
|
|
23
|
+
:root {
|
|
24
|
+
--shimmer-duration: 1s;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.wave-char {
|
|
28
|
+
animation: shimmer-wave var(--shimmer-duration) ease-in-out infinite;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@keyframes shimmer-wave {
|
|
32
|
+
0%,
|
|
33
|
+
100% {
|
|
34
|
+
opacity: 0.6;
|
|
35
|
+
}
|
|
36
|
+
25% {
|
|
37
|
+
opacity: 0.75;
|
|
38
|
+
}
|
|
39
|
+
50% {
|
|
40
|
+
opacity: 1;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as TooltipPlus } from './tooltip-plus.svelte';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { AppState } from '$client/app/app.state.svelte';
|
|
3
|
+
import type { HotKey } from '$client/app/types';
|
|
4
|
+
import { getHotKeyHtmlDisplay } from '$lib/utils';
|
|
5
|
+
import * as Tooltip from '../../shadcn/tooltip';
|
|
6
|
+
import { getContext, type Snippet } from 'svelte';
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
tooltip: undefined | string | Snippet<[]>;
|
|
10
|
+
hotKey?: HotKey;
|
|
11
|
+
children?: Snippet<[]>;
|
|
12
|
+
delayDuration?: number;
|
|
13
|
+
allowHoverOverTooltip?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const { tooltip, hotKey, children, delayDuration, allowHoverOverTooltip = false }: Props = $props();
|
|
17
|
+
|
|
18
|
+
const appState = getContext<AppState>('appState');
|
|
19
|
+
let hideTooltip = $derived(appState.settings.data.hideTooltips || !tooltip);
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
{#if !hideTooltip}
|
|
23
|
+
<Tooltip.Provider disableHoverableContent={!allowHoverOverTooltip}>
|
|
24
|
+
<Tooltip.Root delayDuration={delayDuration ?? 0}>
|
|
25
|
+
<Tooltip.Trigger>
|
|
26
|
+
{@render children?.()}
|
|
27
|
+
</Tooltip.Trigger>
|
|
28
|
+
<Tooltip.Content>
|
|
29
|
+
{#if typeof tooltip === 'string'}
|
|
30
|
+
{tooltip}
|
|
31
|
+
{:else}
|
|
32
|
+
{@render tooltip?.()}
|
|
33
|
+
{/if}
|
|
34
|
+
{#if hotKey}
|
|
35
|
+
{@html getHotKeyHtmlDisplay(hotKey)}
|
|
36
|
+
{/if}
|
|
37
|
+
</Tooltip.Content>
|
|
38
|
+
</Tooltip.Root>
|
|
39
|
+
</Tooltip.Provider>
|
|
40
|
+
{:else}
|
|
41
|
+
{@render children?.()}
|
|
42
|
+
{/if}
|
|
Binary file
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { WithElementRef } from 'bits-ui';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
import { cn } from '../utils.js';
|
|
5
|
+
|
|
6
|
+
let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLAttributes<HTMLDivElement>> = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<div bind:this={ref} class={cn('text-sm [&_p]:leading-relaxed', className)} {...restProps}>
|
|
10
|
+
{@render children?.()}
|
|
11
|
+
</div>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import type { WithElementRef } from "bits-ui";
|
|
4
|
+
import { cn } from "../utils.js";
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
level = 5,
|
|
10
|
+
children,
|
|
11
|
+
...restProps
|
|
12
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
13
|
+
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
14
|
+
} = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<div
|
|
18
|
+
bind:this={ref}
|
|
19
|
+
aria-level={level}
|
|
20
|
+
class={cn("mb-1 font-medium leading-none tracking-tight", className)}
|
|
21
|
+
{...restProps}
|
|
22
|
+
>
|
|
23
|
+
{@render children?.()}
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { type VariantProps, tv } from "tailwind-variants";
|
|
3
|
+
|
|
4
|
+
export const alertVariants = tv({
|
|
5
|
+
base: "[&>svg]:text-foreground relative w-full rounded-lg border px-4 py-3 text-sm [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg~*]:pl-7",
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: "bg-background text-foreground",
|
|
9
|
+
destructive:
|
|
10
|
+
"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: {
|
|
14
|
+
variant: "default",
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export type AlertVariant = VariantProps<typeof alertVariants>["variant"];
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<script lang="ts">
|
|
22
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
23
|
+
import type { WithElementRef } from "bits-ui";
|
|
24
|
+
import { cn } from "../utils.js";
|
|
25
|
+
|
|
26
|
+
let {
|
|
27
|
+
ref = $bindable(null),
|
|
28
|
+
class: className,
|
|
29
|
+
variant = "default",
|
|
30
|
+
children,
|
|
31
|
+
...restProps
|
|
32
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
33
|
+
variant?: AlertVariant;
|
|
34
|
+
} = $props();
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<div bind:this={ref} class={cn(alertVariants({ variant }), className)} {...restProps} role="alert">
|
|
38
|
+
{@render children?.()}
|
|
39
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Root from "./alert.svelte";
|
|
2
|
+
import Description from "./alert-description.svelte";
|
|
3
|
+
import Title from "./alert-title.svelte";
|
|
4
|
+
export { alertVariants, type AlertVariant } from "./alert.svelte";
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
Root,
|
|
8
|
+
Description,
|
|
9
|
+
Title,
|
|
10
|
+
//
|
|
11
|
+
Root as Alert,
|
|
12
|
+
Description as AlertDescription,
|
|
13
|
+
Title as AlertTitle,
|
|
14
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Avatar as AvatarPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
let { ref = $bindable(null), class: className, ...restProps }: AvatarPrimitive.FallbackProps = $props();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<AvatarPrimitive.Fallback
|
|
9
|
+
bind:ref
|
|
10
|
+
data-slot="avatar-fallback"
|
|
11
|
+
class={cn('bg-muted flex size-full items-center justify-center rounded-full', className)}
|
|
12
|
+
{...restProps}
|
|
13
|
+
/>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Avatar as AvatarPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
let { ref = $bindable(null), class: className, ...restProps }: AvatarPrimitive.ImageProps = $props();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<AvatarPrimitive.Image
|
|
9
|
+
bind:ref
|
|
10
|
+
data-slot="avatar-image"
|
|
11
|
+
class={cn('aspect-square size-full', className)}
|
|
12
|
+
{...restProps}
|
|
13
|
+
/>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Avatar as AvatarPrimitive } from 'bits-ui';
|
|
3
|
+
import { cn } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
loadingStatus = $bindable('loading'),
|
|
8
|
+
class: className,
|
|
9
|
+
...restProps
|
|
10
|
+
}: AvatarPrimitive.RootProps = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<AvatarPrimitive.Root
|
|
14
|
+
bind:ref
|
|
15
|
+
bind:loadingStatus
|
|
16
|
+
data-slot="avatar"
|
|
17
|
+
class={cn('relative flex size-8 shrink-0 overflow-hidden rounded-full', className)}
|
|
18
|
+
{...restProps}
|
|
19
|
+
/>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Root from "./avatar.svelte";
|
|
2
|
+
import Image from "./avatar-image.svelte";
|
|
3
|
+
import Fallback from "./avatar-fallback.svelte";
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
Root,
|
|
7
|
+
Image,
|
|
8
|
+
Fallback,
|
|
9
|
+
//
|
|
10
|
+
Root as Avatar,
|
|
11
|
+
Image as AvatarImage,
|
|
12
|
+
Fallback as AvatarFallback,
|
|
13
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { type VariantProps, tv } from 'tailwind-variants';
|
|
3
|
+
|
|
4
|
+
export const badgeVariants = tv({
|
|
5
|
+
base: 'focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden whitespace-nowrap rounded-md border px-2 py-0.5 text-xs font-medium transition-[color,box-shadow] focus-visible:ring-[3px] [&>svg]:pointer-events-none [&>svg]:size-3',
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
default: 'bg-primary text-primary-foreground [a&]:hover:bg-primary/90 border-transparent',
|
|
9
|
+
secondary: 'bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90 border-transparent',
|
|
10
|
+
destructive:
|
|
11
|
+
'bg-destructive [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/70 border-transparent text-white',
|
|
12
|
+
outline: 'text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
variant: 'default',
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export type BadgeVariant = VariantProps<typeof badgeVariants>['variant'];
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<script lang="ts">
|
|
24
|
+
import type { HTMLAnchorAttributes } from 'svelte/elements';
|
|
25
|
+
import { cn, type WithElementRef } from '../utils.js';
|
|
26
|
+
|
|
27
|
+
let {
|
|
28
|
+
ref = $bindable(null),
|
|
29
|
+
href,
|
|
30
|
+
class: className,
|
|
31
|
+
variant = 'default',
|
|
32
|
+
children,
|
|
33
|
+
...restProps
|
|
34
|
+
}: WithElementRef<HTMLAnchorAttributes> & {
|
|
35
|
+
variant?: BadgeVariant;
|
|
36
|
+
} = $props();
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<svelte:element
|
|
40
|
+
this={href ? 'a' : 'span'}
|
|
41
|
+
bind:this={ref}
|
|
42
|
+
data-slot="badge"
|
|
43
|
+
{href}
|
|
44
|
+
class={cn(badgeVariants({ variant }), className)}
|
|
45
|
+
{...restProps}
|
|
46
|
+
>
|
|
47
|
+
{@render children?.()}
|
|
48
|
+
</svelte:element>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import EllipsisIcon from '$icons/lucide/ellipsis';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
import { cn, type WithElementRef, type WithoutChildren } from '../utils.js';
|
|
5
|
+
|
|
6
|
+
let { ref = $bindable(null), class: className, ...restProps }: WithoutChildren<WithElementRef<HTMLAttributes<HTMLSpanElement>>> = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<span bind:this={ref} data-slot="breadcrumb-ellipsis" role="presentation" aria-hidden="true" class={cn('flex size-9 items-center justify-center', className)} {...restProps}>
|
|
10
|
+
<EllipsisIcon class="size-4" />
|
|
11
|
+
<span class="sr-only">More</span>
|
|
12
|
+
</span>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLLiAttributes } from 'svelte/elements';
|
|
3
|
+
import { cn, type WithElementRef } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLLiAttributes> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<li
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="breadcrumb-item"
|
|
16
|
+
class={cn('inline-flex items-center gap-1.5', className)}
|
|
17
|
+
{...restProps}
|
|
18
|
+
>
|
|
19
|
+
{@render children?.()}
|
|
20
|
+
</li>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAnchorAttributes } from 'svelte/elements';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import { cn, type WithElementRef } from '../utils.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
href = undefined,
|
|
10
|
+
child,
|
|
11
|
+
children,
|
|
12
|
+
...restProps
|
|
13
|
+
}: WithElementRef<HTMLAnchorAttributes> & {
|
|
14
|
+
child?: Snippet<[{ props: HTMLAnchorAttributes }]>;
|
|
15
|
+
} = $props();
|
|
16
|
+
|
|
17
|
+
const attrs = $derived({
|
|
18
|
+
'data-slot': 'breadcrumb-link',
|
|
19
|
+
class: cn('hover:text-foreground transition-colors', className),
|
|
20
|
+
href,
|
|
21
|
+
...restProps,
|
|
22
|
+
});
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
{#if child}
|
|
26
|
+
{@render child({ props: attrs })}
|
|
27
|
+
{:else}
|
|
28
|
+
<a bind:this={ref} {...attrs}>
|
|
29
|
+
{@render children?.()}
|
|
30
|
+
</a>
|
|
31
|
+
{/if}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLOlAttributes } from 'svelte/elements';
|
|
3
|
+
import { cn, type WithElementRef } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLOlAttributes> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<ol
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="breadcrumb-list"
|
|
16
|
+
class={cn('text-muted-foreground flex flex-wrap items-center gap-1.5 break-words text-sm sm:gap-2.5', className)}
|
|
17
|
+
{...restProps}
|
|
18
|
+
>
|
|
19
|
+
{@render children?.()}
|
|
20
|
+
</ol>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { cn, type WithElementRef } from '../utils.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLSpanElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<span
|
|
14
|
+
bind:this={ref}
|
|
15
|
+
data-slot="breadcrumb-page"
|
|
16
|
+
role="link"
|
|
17
|
+
aria-disabled="true"
|
|
18
|
+
aria-current="page"
|
|
19
|
+
class={cn('text-foreground font-normal', className)}
|
|
20
|
+
{...restProps}
|
|
21
|
+
>
|
|
22
|
+
{@render children?.()}
|
|
23
|
+
</span>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import ChevronRightIcon from '$icons/lucide/chevron-right';
|
|
3
|
+
import { cn, type WithElementRef } from '../utils.js';
|
|
4
|
+
import type { HTMLLiAttributes } from 'svelte/elements';
|
|
5
|
+
|
|
6
|
+
let { ref = $bindable(null), class: className, children, ...restProps }: WithElementRef<HTMLLiAttributes> = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<li bind:this={ref} data-slot="breadcrumb-separator" role="presentation" aria-hidden="true" class={cn('[&>svg]:size-3.5', className)} {...restProps}>
|
|
10
|
+
{#if children}
|
|
11
|
+
{@render children?.()}
|
|
12
|
+
{:else}
|
|
13
|
+
<ChevronRightIcon />
|
|
14
|
+
{/if}
|
|
15
|
+
</li>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { WithElementRef } from '../utils.js';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
class: className,
|
|
8
|
+
children,
|
|
9
|
+
...restProps
|
|
10
|
+
}: WithElementRef<HTMLAttributes<HTMLElement>> = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<nav bind:this={ref} data-slot="breadcrumb" class={className} aria-label="breadcrumb" {...restProps}>
|
|
14
|
+
{@render children?.()}
|
|
15
|
+
</nav>
|