@invopop/popui 0.1.96 → 0.1.98
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/dist/CounterWidget.svelte +65 -30
- package/dist/GlobalSearch.svelte +1 -1
- package/dist/MenuItem.svelte +106 -29
- package/dist/ProgressBarCircle.svelte +9 -6
- package/dist/index.d.ts +36 -1
- package/dist/index.js +74 -0
- package/dist/separator/index.d.ts +2 -0
- package/dist/separator/index.js +4 -0
- package/dist/separator/separator.svelte +21 -0
- package/dist/separator/separator.svelte.d.ts +4 -0
- package/dist/sheet/index.d.ts +11 -0
- package/dist/sheet/index.js +13 -0
- package/dist/sheet/sheet-close.svelte +7 -0
- package/dist/sheet/sheet-close.svelte.d.ts +4 -0
- package/dist/sheet/sheet-content.svelte +65 -0
- package/dist/sheet/sheet-content.svelte.d.ts +15 -0
- package/dist/sheet/sheet-description.svelte +17 -0
- package/dist/sheet/sheet-description.svelte.d.ts +4 -0
- package/dist/sheet/sheet-footer.svelte +20 -0
- package/dist/sheet/sheet-footer.svelte.d.ts +5 -0
- package/dist/sheet/sheet-header.svelte +20 -0
- package/dist/sheet/sheet-header.svelte.d.ts +5 -0
- package/dist/sheet/sheet-overlay.svelte +20 -0
- package/dist/sheet/sheet-overlay.svelte.d.ts +4 -0
- package/dist/sheet/sheet-portal.svelte +7 -0
- package/dist/sheet/sheet-portal.svelte.d.ts +3 -0
- package/dist/sheet/sheet-title.svelte +17 -0
- package/dist/sheet/sheet-title.svelte.d.ts +4 -0
- package/dist/sheet/sheet-trigger.svelte +7 -0
- package/dist/sheet/sheet-trigger.svelte.d.ts +4 -0
- package/dist/sheet/sheet.svelte +7 -0
- package/dist/sheet/sheet.svelte.d.ts +3 -0
- package/dist/sidebar/constants.d.ts +10 -0
- package/dist/sidebar/constants.js +10 -0
- package/dist/sidebar/context.svelte.d.ts +23 -0
- package/dist/sidebar/context.svelte.js +58 -0
- package/dist/sidebar/index.d.ts +25 -0
- package/dist/sidebar/index.js +27 -0
- package/dist/sidebar/is-mobile.svelte.d.ts +4 -0
- package/dist/sidebar/is-mobile.svelte.js +7 -0
- package/dist/sidebar/sidebar-content.svelte +25 -0
- package/dist/sidebar/sidebar-content.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-footer.svelte +21 -0
- package/dist/sidebar/sidebar-footer.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-group-action.svelte +33 -0
- package/dist/sidebar/sidebar-group-action.svelte.d.ts +11 -0
- package/dist/sidebar/sidebar-group-content.svelte +21 -0
- package/dist/sidebar/sidebar-group-content.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-group-label.svelte +33 -0
- package/dist/sidebar/sidebar-group-label.svelte.d.ts +11 -0
- package/dist/sidebar/sidebar-group.svelte +21 -0
- package/dist/sidebar/sidebar-group.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-header.svelte +21 -0
- package/dist/sidebar/sidebar-header.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-input.svelte +23 -0
- package/dist/sidebar/sidebar-input.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-inset.svelte +23 -0
- package/dist/sidebar/sidebar-inset.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-menu-action.svelte +37 -0
- package/dist/sidebar/sidebar-menu-action.svelte.d.ts +12 -0
- package/dist/sidebar/sidebar-menu-badge.svelte +24 -0
- package/dist/sidebar/sidebar-menu-badge.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-menu-button.svelte +102 -0
- package/dist/sidebar/sidebar-menu-button.svelte.d.ts +51 -0
- package/dist/sidebar/sidebar-menu-item.svelte +21 -0
- package/dist/sidebar/sidebar-menu-item.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-menu-skeleton.svelte +35 -0
- package/dist/sidebar/sidebar-menu-skeleton.svelte.d.ts +8 -0
- package/dist/sidebar/sidebar-menu-sub-button.svelte +39 -0
- package/dist/sidebar/sidebar-menu-sub-button.svelte.d.ts +13 -0
- package/dist/sidebar/sidebar-menu-sub-item.svelte +21 -0
- package/dist/sidebar/sidebar-menu-sub-item.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-menu-sub.svelte +24 -0
- package/dist/sidebar/sidebar-menu-sub.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-menu.svelte +21 -0
- package/dist/sidebar/sidebar-menu.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-provider.svelte +47 -0
- package/dist/sidebar/sidebar-provider.svelte.d.ts +9 -0
- package/dist/sidebar/sidebar-rail.svelte +165 -0
- package/dist/sidebar/sidebar-rail.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar-separator.svelte +19 -0
- package/dist/sidebar/sidebar-separator.svelte.d.ts +13 -0
- package/dist/sidebar/sidebar-trigger.svelte +35 -0
- package/dist/sidebar/sidebar-trigger.svelte.d.ts +5 -0
- package/dist/sidebar/sidebar.svelte +106 -0
- package/dist/sidebar/sidebar.svelte.d.ts +10 -0
- package/dist/tailwind.theme.css +20 -0
- package/dist/types.d.ts +3 -1
- package/package.json +2 -1
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
3
|
+
import ShortcutWrapper from '../ShortcutWrapper.svelte'
|
|
4
|
+
import { cn, type WithElementRef } from '../utils.js'
|
|
5
|
+
import { SIDEBAR_DRAG_THRESHOLD_PX } from './constants.js'
|
|
6
|
+
import { useSidebar } from './context.svelte.js'
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
ref = $bindable(null),
|
|
10
|
+
class: className,
|
|
11
|
+
children,
|
|
12
|
+
...restProps
|
|
13
|
+
}: WithElementRef<HTMLAttributes<HTMLButtonElement>, HTMLButtonElement> = $props()
|
|
14
|
+
|
|
15
|
+
const sidebar = useSidebar()
|
|
16
|
+
|
|
17
|
+
let dragStartX = 0
|
|
18
|
+
let dragStartWidthPx = 0
|
|
19
|
+
let dragMoved = false
|
|
20
|
+
let dragDirection: 1 | -1 = 1
|
|
21
|
+
|
|
22
|
+
let isHovering = $state(false)
|
|
23
|
+
let isDragging = $state(false)
|
|
24
|
+
let tooltipVisible = $derived(isHovering && !isDragging)
|
|
25
|
+
let tooltipX = $state(0)
|
|
26
|
+
let tooltipY = $state(0)
|
|
27
|
+
let tooltipWidth = $state(0)
|
|
28
|
+
let tooltipHeight = $state(0)
|
|
29
|
+
|
|
30
|
+
const TOOLTIP_CURSOR_OFFSET = 12
|
|
31
|
+
const TOOLTIP_VIEWPORT_PADDING = 8
|
|
32
|
+
|
|
33
|
+
let tooltipLeft = $derived.by(() => {
|
|
34
|
+
if (tooltipWidth === 0 || typeof window === 'undefined') return tooltipX
|
|
35
|
+
const desired = tooltipX - tooltipWidth / 2
|
|
36
|
+
const minX = TOOLTIP_VIEWPORT_PADDING
|
|
37
|
+
const maxX = window.innerWidth - tooltipWidth - TOOLTIP_VIEWPORT_PADDING
|
|
38
|
+
return Math.max(minX, Math.min(maxX, desired))
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
let tooltipTop = $derived.by(() => {
|
|
42
|
+
const desired = tooltipY + TOOLTIP_CURSOR_OFFSET
|
|
43
|
+
if (tooltipHeight === 0 || typeof window === 'undefined') return desired
|
|
44
|
+
const maxY = window.innerHeight - tooltipHeight - TOOLTIP_VIEWPORT_PADDING
|
|
45
|
+
return Math.min(maxY, desired)
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
function updateTooltipPosition(e: PointerEvent) {
|
|
49
|
+
tooltipX = e.clientX
|
|
50
|
+
tooltipY = e.clientY
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function onPointerEnter(e: PointerEvent) {
|
|
54
|
+
const sidebarRoot = (e.currentTarget as HTMLElement).closest('[data-slot="sidebar"]')
|
|
55
|
+
dragDirection = sidebarRoot?.getAttribute('data-side') === 'right' ? -1 : 1
|
|
56
|
+
updateTooltipPosition(e)
|
|
57
|
+
isHovering = true
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function onPointerLeave() {
|
|
61
|
+
isHovering = false
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function onPointerDown(e: PointerEvent) {
|
|
65
|
+
if (sidebar.state !== 'expanded' || sidebar.isMobile) return
|
|
66
|
+
const button = e.currentTarget as HTMLButtonElement
|
|
67
|
+
const sidebarRoot = button.closest('[data-slot="sidebar"]')
|
|
68
|
+
dragDirection = sidebarRoot?.getAttribute('data-side') === 'right' ? -1 : 1
|
|
69
|
+
|
|
70
|
+
const container = sidebarRoot?.querySelector('[data-slot="sidebar-container"]')
|
|
71
|
+
dragStartWidthPx = container instanceof HTMLElement ? container.offsetWidth : 256
|
|
72
|
+
dragStartX = e.clientX
|
|
73
|
+
dragMoved = false
|
|
74
|
+
button.setPointerCapture(e.pointerId)
|
|
75
|
+
document.body.style.cursor = 'col-resize'
|
|
76
|
+
document.body.style.userSelect = 'none'
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function onPointerMove(e: PointerEvent) {
|
|
80
|
+
if (tooltipVisible) updateTooltipPosition(e)
|
|
81
|
+
const button = e.currentTarget as HTMLButtonElement
|
|
82
|
+
if (!button.hasPointerCapture(e.pointerId)) return
|
|
83
|
+
const delta = (e.clientX - dragStartX) * dragDirection
|
|
84
|
+
if (Math.abs(delta) > SIDEBAR_DRAG_THRESHOLD_PX) {
|
|
85
|
+
dragMoved = true
|
|
86
|
+
isDragging = true
|
|
87
|
+
}
|
|
88
|
+
if (dragMoved) sidebar.setWidth(dragStartWidthPx + delta)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function onPointerUp(e: PointerEvent) {
|
|
92
|
+
const button = e.currentTarget as HTMLButtonElement
|
|
93
|
+
if (button.hasPointerCapture(e.pointerId)) button.releasePointerCapture(e.pointerId)
|
|
94
|
+
document.body.style.cursor = ''
|
|
95
|
+
document.body.style.userSelect = ''
|
|
96
|
+
isDragging = false
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function onClick(e: MouseEvent) {
|
|
100
|
+
if (dragMoved) {
|
|
101
|
+
e.preventDefault()
|
|
102
|
+
e.stopPropagation()
|
|
103
|
+
dragMoved = false
|
|
104
|
+
return
|
|
105
|
+
}
|
|
106
|
+
sidebar.toggle()
|
|
107
|
+
}
|
|
108
|
+
</script>
|
|
109
|
+
|
|
110
|
+
<button
|
|
111
|
+
bind:this={ref}
|
|
112
|
+
data-sidebar="rail"
|
|
113
|
+
data-slot="sidebar-rail"
|
|
114
|
+
aria-label="Toggle Sidebar"
|
|
115
|
+
tabindex={-1}
|
|
116
|
+
type="button"
|
|
117
|
+
onpointerenter={onPointerEnter}
|
|
118
|
+
onpointerleave={onPointerLeave}
|
|
119
|
+
onpointerdown={onPointerDown}
|
|
120
|
+
onpointermove={onPointerMove}
|
|
121
|
+
onpointerup={onPointerUp}
|
|
122
|
+
onpointercancel={onPointerUp}
|
|
123
|
+
onclick={onClick}
|
|
124
|
+
class={cn(
|
|
125
|
+
'absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex',
|
|
126
|
+
'after:absolute after:inset-y-0 after:left-1/2 after:w-[2px]',
|
|
127
|
+
'hover:after:bg-sidebar-border',
|
|
128
|
+
'group-data-[side=left]:cursor-w-resize group-data-[side=right]:cursor-e-resize',
|
|
129
|
+
'[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize',
|
|
130
|
+
'hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full',
|
|
131
|
+
'[[data-side=left][data-collapsible=offcanvas]_&]:-right-2',
|
|
132
|
+
'[[data-side=right][data-collapsible=offcanvas]_&]:-left-2',
|
|
133
|
+
className
|
|
134
|
+
)}
|
|
135
|
+
{...restProps}
|
|
136
|
+
>
|
|
137
|
+
{@render children?.()}
|
|
138
|
+
</button>
|
|
139
|
+
|
|
140
|
+
{#if tooltipVisible}
|
|
141
|
+
<div
|
|
142
|
+
role="tooltip"
|
|
143
|
+
bind:offsetWidth={tooltipWidth}
|
|
144
|
+
bind:offsetHeight={tooltipHeight}
|
|
145
|
+
class="fixed z-[1002] pointer-events-none rounded-md border border-border-inverse bg-background-default-negative px-3 py-2 text-sm font-medium text-foreground-inverse leading-5 tracking-tight shadow-md"
|
|
146
|
+
style="left: {tooltipLeft}px; top: {tooltipTop}px; visibility: {tooltipWidth > 0
|
|
147
|
+
? 'visible'
|
|
148
|
+
: 'hidden'};"
|
|
149
|
+
>
|
|
150
|
+
<div class="flex flex-col gap-1.5">
|
|
151
|
+
{#if sidebar.state === 'expanded'}
|
|
152
|
+
<div>Drag to resize</div>
|
|
153
|
+
{/if}
|
|
154
|
+
<div class="flex items-center justify-between gap-3">
|
|
155
|
+
<span>
|
|
156
|
+
{sidebar.state === 'expanded' ? 'Click to collapse' : 'Click to expand'}
|
|
157
|
+
</span>
|
|
158
|
+
<div class="flex items-center gap-1">
|
|
159
|
+
<ShortcutWrapper size="md" theme="navigation">⌘</ShortcutWrapper>
|
|
160
|
+
<ShortcutWrapper size="md" theme="navigation">.</ShortcutWrapper>
|
|
161
|
+
</div>
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
{/if}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import { type WithElementRef } from '../utils.js';
|
|
3
|
+
declare const SidebarRail: import("svelte").Component<WithElementRef<HTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}, "ref">;
|
|
4
|
+
type SidebarRail = ReturnType<typeof SidebarRail>;
|
|
5
|
+
export default SidebarRail;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ComponentProps } from 'svelte'
|
|
3
|
+
import { Separator } from '../separator/index.js'
|
|
4
|
+
import { cn } from '../utils.js'
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
ref = $bindable(null),
|
|
8
|
+
class: className,
|
|
9
|
+
...restProps
|
|
10
|
+
}: ComponentProps<typeof Separator> = $props()
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<Separator
|
|
14
|
+
bind:ref
|
|
15
|
+
data-slot="sidebar-separator"
|
|
16
|
+
data-sidebar="separator"
|
|
17
|
+
class={cn('bg-sidebar-border mx-2 w-auto', className)}
|
|
18
|
+
{...restProps}
|
|
19
|
+
/>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare const SidebarSeparator: import("svelte").Component<Omit<{
|
|
2
|
+
orientation?: import("bits-ui").Orientation;
|
|
3
|
+
decorative?: boolean;
|
|
4
|
+
}, "children" | "child"> & {
|
|
5
|
+
child?: import("svelte").Snippet<[{
|
|
6
|
+
props: Record<string, unknown>;
|
|
7
|
+
}]> | undefined;
|
|
8
|
+
children?: import("svelte").Snippet<[]> | undefined;
|
|
9
|
+
style?: import("bits-ui").StyleProperties | string | null | undefined;
|
|
10
|
+
ref?: HTMLElement | null | undefined;
|
|
11
|
+
} & import("bits-ui").Without<import("bits-ui").BitsPrimitiveDivAttributes, import("bits-ui").SeparatorRootPropsWithoutHTML>, {}, "ref">;
|
|
12
|
+
type SidebarSeparator = ReturnType<typeof SidebarSeparator>;
|
|
13
|
+
export default SidebarSeparator;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLButtonAttributes } from 'svelte/elements'
|
|
3
|
+
import { SidebarShow } from '@invopop/ui-icons'
|
|
4
|
+
import { Icon } from '@steeze-ui/svelte-icon'
|
|
5
|
+
import { cn, type WithElementRef } from '../utils.js'
|
|
6
|
+
import { useSidebar } from './context.svelte.js'
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
ref = $bindable(null),
|
|
10
|
+
class: className,
|
|
11
|
+
onclick,
|
|
12
|
+
...restProps
|
|
13
|
+
}: WithElementRef<HTMLButtonAttributes, HTMLButtonElement> = $props()
|
|
14
|
+
|
|
15
|
+
const sidebar = useSidebar()
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<button
|
|
19
|
+
bind:this={ref}
|
|
20
|
+
data-sidebar="trigger"
|
|
21
|
+
data-slot="sidebar-trigger"
|
|
22
|
+
type="button"
|
|
23
|
+
class={cn(
|
|
24
|
+
'inline-flex size-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sidebar-ring disabled:pointer-events-none disabled:opacity-50',
|
|
25
|
+
className
|
|
26
|
+
)}
|
|
27
|
+
onclick={(e) => {
|
|
28
|
+
onclick?.(e)
|
|
29
|
+
sidebar.toggle()
|
|
30
|
+
}}
|
|
31
|
+
{...restProps}
|
|
32
|
+
>
|
|
33
|
+
<Icon src={SidebarShow} class="size-4" />
|
|
34
|
+
<span class="sr-only">Toggle Sidebar</span>
|
|
35
|
+
</button>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
2
|
+
import { type WithElementRef } from '../utils.js';
|
|
3
|
+
declare const SidebarTrigger: import("svelte").Component<WithElementRef<HTMLButtonAttributes, HTMLButtonElement>, {}, "ref">;
|
|
4
|
+
type SidebarTrigger = ReturnType<typeof SidebarTrigger>;
|
|
5
|
+
export default SidebarTrigger;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
3
|
+
import * as Sheet from '../sheet/index.js'
|
|
4
|
+
import { cn, type WithElementRef } from '../utils.js'
|
|
5
|
+
import { SIDEBAR_WIDTH_MOBILE } from './constants.js'
|
|
6
|
+
import { useSidebar } from './context.svelte.js'
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
ref = $bindable(null),
|
|
10
|
+
side = 'left',
|
|
11
|
+
variant = 'sidebar',
|
|
12
|
+
collapsible = 'offcanvas',
|
|
13
|
+
class: className,
|
|
14
|
+
children,
|
|
15
|
+
...restProps
|
|
16
|
+
}: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
17
|
+
side?: 'left' | 'right'
|
|
18
|
+
variant?: 'sidebar' | 'floating' | 'inset'
|
|
19
|
+
collapsible?: 'offcanvas' | 'icon' | 'none'
|
|
20
|
+
} = $props()
|
|
21
|
+
|
|
22
|
+
const sidebar = useSidebar()
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
{#if collapsible === 'none'}
|
|
26
|
+
<div
|
|
27
|
+
class={cn(
|
|
28
|
+
'bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col',
|
|
29
|
+
className
|
|
30
|
+
)}
|
|
31
|
+
bind:this={ref}
|
|
32
|
+
{...restProps}
|
|
33
|
+
>
|
|
34
|
+
{@render children?.()}
|
|
35
|
+
</div>
|
|
36
|
+
{:else if sidebar.isMobile}
|
|
37
|
+
<Sheet.Root
|
|
38
|
+
bind:open={() => sidebar.openMobile, (v) => sidebar.setOpenMobile(v)}
|
|
39
|
+
{...restProps}
|
|
40
|
+
>
|
|
41
|
+
<Sheet.Content
|
|
42
|
+
data-sidebar="sidebar"
|
|
43
|
+
data-slot="sidebar"
|
|
44
|
+
data-mobile="true"
|
|
45
|
+
class={cn(
|
|
46
|
+
'bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden',
|
|
47
|
+
className
|
|
48
|
+
)}
|
|
49
|
+
style="--sidebar-width: {SIDEBAR_WIDTH_MOBILE};"
|
|
50
|
+
{side}
|
|
51
|
+
showCloseButton={false}
|
|
52
|
+
>
|
|
53
|
+
<Sheet.Header class="sr-only">
|
|
54
|
+
<Sheet.Title>Sidebar</Sheet.Title>
|
|
55
|
+
<Sheet.Description>Displays the mobile sidebar.</Sheet.Description>
|
|
56
|
+
</Sheet.Header>
|
|
57
|
+
<div class="flex h-full w-full flex-col">
|
|
58
|
+
{@render children?.()}
|
|
59
|
+
</div>
|
|
60
|
+
</Sheet.Content>
|
|
61
|
+
</Sheet.Root>
|
|
62
|
+
{:else}
|
|
63
|
+
<div
|
|
64
|
+
bind:this={ref}
|
|
65
|
+
class="text-sidebar-foreground group peer hidden md:block"
|
|
66
|
+
data-state={sidebar.state}
|
|
67
|
+
data-collapsible={sidebar.state === 'collapsed' ? collapsible : ''}
|
|
68
|
+
data-variant={variant}
|
|
69
|
+
data-side={side}
|
|
70
|
+
data-slot="sidebar"
|
|
71
|
+
>
|
|
72
|
+
<div
|
|
73
|
+
data-slot="sidebar-gap"
|
|
74
|
+
class={cn(
|
|
75
|
+
'relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear',
|
|
76
|
+
'group-data-[collapsible=offcanvas]:w-0',
|
|
77
|
+
'group-data-[side=right]:rotate-180',
|
|
78
|
+
variant === 'floating' || variant === 'inset'
|
|
79
|
+
? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem)]'
|
|
80
|
+
: 'group-data-[collapsible=icon]:w-(--sidebar-width-icon)'
|
|
81
|
+
)}
|
|
82
|
+
></div>
|
|
83
|
+
<div
|
|
84
|
+
data-slot="sidebar-container"
|
|
85
|
+
class={cn(
|
|
86
|
+
'fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex',
|
|
87
|
+
side === 'left'
|
|
88
|
+
? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'
|
|
89
|
+
: 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',
|
|
90
|
+
variant === 'floating' || variant === 'inset'
|
|
91
|
+
? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem+2px)]'
|
|
92
|
+
: 'group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l',
|
|
93
|
+
className
|
|
94
|
+
)}
|
|
95
|
+
{...restProps}
|
|
96
|
+
>
|
|
97
|
+
<div
|
|
98
|
+
data-sidebar="sidebar"
|
|
99
|
+
data-slot="sidebar-inner"
|
|
100
|
+
class="flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border"
|
|
101
|
+
>
|
|
102
|
+
{@render children?.()}
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
{/if}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
import { type WithElementRef } from '../utils.js';
|
|
3
|
+
type $$ComponentProps = WithElementRef<HTMLAttributes<HTMLDivElement>> & {
|
|
4
|
+
side?: 'left' | 'right';
|
|
5
|
+
variant?: 'sidebar' | 'floating' | 'inset';
|
|
6
|
+
collapsible?: 'offcanvas' | 'icon' | 'none';
|
|
7
|
+
};
|
|
8
|
+
declare const Sidebar: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
9
|
+
type Sidebar = ReturnType<typeof Sidebar>;
|
|
10
|
+
export default Sidebar;
|
package/dist/tailwind.theme.css
CHANGED
|
@@ -837,6 +837,26 @@
|
|
|
837
837
|
--text-xs: 10px;
|
|
838
838
|
--text-xs--line-height: 12px;
|
|
839
839
|
--text-xs--letter-spacing: var(--tracking-wide);
|
|
840
|
+
|
|
841
|
+
/* ============================================
|
|
842
|
+
SHADCN-COMPATIBLE TOKEN ALIASES (Sheet, Separator, Sidebar)
|
|
843
|
+
============================================ */
|
|
844
|
+
|
|
845
|
+
/* Generic aliases used by Sheet and Sidebar.Input */
|
|
846
|
+
--color-foreground-secondary: var(--color-foreground-default-secondary);
|
|
847
|
+
--color-input: var(--color-border-default-default);
|
|
848
|
+
--color-ring: var(--color-foreground-default-default);
|
|
849
|
+
|
|
850
|
+
/* Sidebar — defaults to the brand-bold (inverse/dark) surface so popui's
|
|
851
|
+
Sidebar matches the existing dark chrome out of the box. */
|
|
852
|
+
--color-sidebar: var(--color-background-default-bold);
|
|
853
|
+
--color-sidebar-foreground: var(--color-foreground-inverse-default);
|
|
854
|
+
--color-sidebar-primary: var(--color-foreground-inverse-default);
|
|
855
|
+
--color-sidebar-primary-foreground: var(--color-background-default-bold);
|
|
856
|
+
--color-sidebar-accent: var(--color-background-selected-inverse);
|
|
857
|
+
--color-sidebar-accent-foreground: var(--color-foreground-inverse-default);
|
|
858
|
+
--color-sidebar-border: var(--color-border-inverse-default);
|
|
859
|
+
--color-sidebar-ring: var(--color-border-inverse-secondary);
|
|
840
860
|
}
|
|
841
861
|
|
|
842
862
|
@layer theme {
|
package/dist/types.d.ts
CHANGED
|
@@ -200,6 +200,7 @@ export interface CounterWidgetProps {
|
|
|
200
200
|
resetDate?: string;
|
|
201
201
|
icon?: IconSource;
|
|
202
202
|
allowOverage?: boolean;
|
|
203
|
+
collapsed?: boolean;
|
|
203
204
|
}
|
|
204
205
|
export interface ProgressBarProps {
|
|
205
206
|
percentage?: number;
|
|
@@ -211,7 +212,7 @@ export interface ProgressBarProps {
|
|
|
211
212
|
export interface ProgressBarCircleProps {
|
|
212
213
|
progress: number;
|
|
213
214
|
size: number;
|
|
214
|
-
variant?: 'default' | 'dark';
|
|
215
|
+
variant?: 'default' | 'dark' | 'warning' | 'critical';
|
|
215
216
|
}
|
|
216
217
|
export interface TagProgressProps {
|
|
217
218
|
progress: number;
|
|
@@ -533,6 +534,7 @@ export interface MenuItemProps {
|
|
|
533
534
|
collapsable?: boolean;
|
|
534
535
|
open?: boolean;
|
|
535
536
|
active?: boolean;
|
|
537
|
+
collapsedSidebar?: boolean;
|
|
536
538
|
iconTheme?: IconTheme;
|
|
537
539
|
icon?: IconSource | string | undefined;
|
|
538
540
|
imageUrl?: string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@invopop/popui",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.98",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/invopop/popui"
|
|
7
7
|
},
|
|
@@ -106,6 +106,7 @@
|
|
|
106
106
|
"svelte-intersection-observer-action": "^0.0.4",
|
|
107
107
|
"svelte-portal": "^2.2.1",
|
|
108
108
|
"svelte-sonner": "^1.0.5",
|
|
109
|
+
"svelte-toolbelt": "^0.10.6",
|
|
109
110
|
"svelte-transition": "^0.0.17",
|
|
110
111
|
"svelte-viewport-info": "^1.0.2",
|
|
111
112
|
"tailwind-variants": "^1.0.0",
|