@sabrenski/spire-ui 0.0.1
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 +21 -0
- package/README.md +233 -0
- package/dist/index.d.ts +4981 -0
- package/dist/spire-ui.css +1 -0
- package/dist/spire-ui.es.js +18403 -0
- package/dist/spire-ui.umd.js +45 -0
- package/package.json +83 -0
- package/src/components/Accordion/Accordion.test.ts +218 -0
- package/src/components/Accordion/AccordionContent.vue +112 -0
- package/src/components/Accordion/AccordionItem.vue +87 -0
- package/src/components/Accordion/AccordionRoot.vue +111 -0
- package/src/components/Accordion/AccordionTrigger.vue +125 -0
- package/src/components/Accordion/index.ts +11 -0
- package/src/components/Accordion/keys.ts +23 -0
- package/src/components/Avatar/Avatar.test.ts +181 -0
- package/src/components/Avatar/Avatar.vue +150 -0
- package/src/components/Avatar/index.ts +2 -0
- package/src/components/Badge/Badge.test.ts +141 -0
- package/src/components/Badge/Badge.vue +133 -0
- package/src/components/Badge/index.ts +2 -0
- package/src/components/BadgeContainer/BadgeContainer.test.ts +150 -0
- package/src/components/BadgeContainer/BadgeContainer.vue +90 -0
- package/src/components/BadgeContainer/index.ts +2 -0
- package/src/components/Breadcrumb/Breadcrumb.test.ts +342 -0
- package/src/components/Breadcrumb/BreadcrumbEllipsis.vue +96 -0
- package/src/components/Breadcrumb/BreadcrumbItem.vue +16 -0
- package/src/components/Breadcrumb/BreadcrumbLink.vue +67 -0
- package/src/components/Breadcrumb/BreadcrumbList.vue +20 -0
- package/src/components/Breadcrumb/BreadcrumbPage.vue +25 -0
- package/src/components/Breadcrumb/BreadcrumbRoot.vue +41 -0
- package/src/components/Breadcrumb/BreadcrumbSeparator.vue +63 -0
- package/src/components/Breadcrumb/index.ts +13 -0
- package/src/components/Breadcrumb/keys.ts +7 -0
- package/src/components/Button/Button.test.ts +231 -0
- package/src/components/Button/Button.vue +349 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Callout/Callout.test.ts +260 -0
- package/src/components/Callout/Callout.vue +341 -0
- package/src/components/Callout/index.ts +2 -0
- package/src/components/Card/Card.test.ts +565 -0
- package/src/components/Card/Card.vue +209 -0
- package/src/components/Card/CardContent.vue +57 -0
- package/src/components/Card/CardFooter.vue +72 -0
- package/src/components/Card/CardHeader.vue +111 -0
- package/src/components/Card/CardImage.vue +124 -0
- package/src/components/Card/index.ts +14 -0
- package/src/components/Chart/BarChart.vue +208 -0
- package/src/components/Chart/BaseChart.vue +444 -0
- package/src/components/Chart/Chart.test.ts +359 -0
- package/src/components/Chart/DonutChart.vue +283 -0
- package/src/components/Chart/LineChart.vue +211 -0
- package/src/components/Chart/index.ts +20 -0
- package/src/components/Chart/useChartTheme.ts +192 -0
- package/src/components/Checkbox/Checkbox.test.ts +209 -0
- package/src/components/Checkbox/Checkbox.vue +285 -0
- package/src/components/Checkbox/index.ts +2 -0
- package/src/components/ChoiceChip/ChoiceChip.test.ts +142 -0
- package/src/components/ChoiceChip/ChoiceChip.vue +218 -0
- package/src/components/ChoiceChip/index.ts +2 -0
- package/src/components/ChoiceChipGroup/ChoiceChipGroup.test.ts +151 -0
- package/src/components/ChoiceChipGroup/ChoiceChipGroup.vue +70 -0
- package/src/components/ChoiceChipGroup/index.ts +2 -0
- package/src/components/ColorPicker/ColorArea.vue +159 -0
- package/src/components/ColorPicker/ColorPicker.test.ts +250 -0
- package/src/components/ColorPicker/ColorPicker.vue +339 -0
- package/src/components/ColorPicker/ColorSlider.vue +191 -0
- package/src/components/ColorPicker/index.ts +7 -0
- package/src/components/Combobox/Combobox.test.ts +891 -0
- package/src/components/Combobox/Combobox.vue +934 -0
- package/src/components/Combobox/index.ts +2 -0
- package/src/components/DataTable/DataTable.test.ts +1221 -0
- package/src/components/DataTable/DataTable.vue +1415 -0
- package/src/components/DataTable/index.ts +10 -0
- package/src/components/DatePicker/DatePicker.test.ts +625 -0
- package/src/components/DatePicker/DatePicker.vue +1586 -0
- package/src/components/DatePicker/index.ts +2 -0
- package/src/components/Drawer/Drawer.test.ts +336 -0
- package/src/components/Drawer/Drawer.vue +466 -0
- package/src/components/Drawer/index.ts +2 -0
- package/src/components/Dropdown/Dropdown.test.ts +607 -0
- package/src/components/Dropdown/Dropdown.vue +807 -0
- package/src/components/Dropdown/DropdownItem.vue +227 -0
- package/src/components/Dropdown/DropdownSeparator.vue +14 -0
- package/src/components/Dropdown/DropdownSub.vue +104 -0
- package/src/components/Dropdown/DropdownSubContent.vue +187 -0
- package/src/components/Dropdown/DropdownSubTrigger.vue +151 -0
- package/src/components/Dropdown/index.ts +14 -0
- package/src/components/EmptyState/EmptyState.test.ts +180 -0
- package/src/components/EmptyState/EmptyState.vue +137 -0
- package/src/components/EmptyState/index.ts +2 -0
- package/src/components/FileUpload/FileUpload.test.ts +1151 -0
- package/src/components/FileUpload/FileUpload.vue +1042 -0
- package/src/components/FileUpload/index.ts +2 -0
- package/src/components/Heading/Heading.test.ts +107 -0
- package/src/components/Heading/Heading.vue +67 -0
- package/src/components/Heading/index.ts +2 -0
- package/src/components/Icon/Icon.test.ts +157 -0
- package/src/components/Icon/Icon.vue +86 -0
- package/src/components/Icon/index.ts +2 -0
- package/src/components/Input/Input.test.ts +273 -0
- package/src/components/Input/Input.vue +388 -0
- package/src/components/Input/index.ts +2 -0
- package/src/components/Layout/Container.vue +67 -0
- package/src/components/Layout/Grid.vue +159 -0
- package/src/components/Layout/GridItem.vue +154 -0
- package/src/components/Layout/Layout.test.ts +202 -0
- package/src/components/Layout/Stack.vue +128 -0
- package/src/components/Layout/index.ts +9 -0
- package/src/components/Layout/keys.ts +7 -0
- package/src/components/Modal/Modal.test.ts +311 -0
- package/src/components/Modal/Modal.vue +336 -0
- package/src/components/Modal/index.ts +2 -0
- package/src/components/Pagination/Pagination.test.ts +303 -0
- package/src/components/Pagination/Pagination.vue +212 -0
- package/src/components/Pagination/index.ts +3 -0
- package/src/components/Pagination/utils.ts +86 -0
- package/src/components/Popover/Popover.test.ts +285 -0
- package/src/components/Popover/Popover.vue +441 -0
- package/src/components/Popover/index.ts +2 -0
- package/src/components/Progress/Progress.test.ts +361 -0
- package/src/components/Progress/Progress.vue +363 -0
- package/src/components/Progress/index.ts +7 -0
- package/src/components/Radio/Radio.test.ts +216 -0
- package/src/components/Radio/Radio.vue +214 -0
- package/src/components/Radio/index.ts +2 -0
- package/src/components/Rating/Rating.test.ts +319 -0
- package/src/components/Rating/Rating.vue +247 -0
- package/src/components/Rating/index.ts +2 -0
- package/src/components/SegmentedControl/SegmentedControl.test.ts +292 -0
- package/src/components/SegmentedControl/SegmentedControl.vue +288 -0
- package/src/components/SegmentedControl/index.ts +2 -0
- package/src/components/Select/Select.test.ts +589 -0
- package/src/components/Select/Select.vue +666 -0
- package/src/components/Select/index.ts +2 -0
- package/src/components/Sidebar/Sidebar.test.ts +301 -0
- package/src/components/Sidebar/SidebarGroup.vue +103 -0
- package/src/components/Sidebar/SidebarItem.vue +196 -0
- package/src/components/Sidebar/SidebarLayout.vue +42 -0
- package/src/components/Sidebar/SidebarRoot.vue +122 -0
- package/src/components/Sidebar/index.ts +11 -0
- package/src/components/Sidebar/keys.ts +14 -0
- package/src/components/Skeleton/Skeleton.test.ts +130 -0
- package/src/components/Skeleton/Skeleton.vue +104 -0
- package/src/components/Skeleton/index.ts +2 -0
- package/src/components/Slider/Slider.test.ts +416 -0
- package/src/components/Slider/Slider.vue +435 -0
- package/src/components/Slider/index.ts +2 -0
- package/src/components/Slider/utils.ts +91 -0
- package/src/components/Spinner/Spinner.test.ts +79 -0
- package/src/components/Spinner/Spinner.vue +159 -0
- package/src/components/Spinner/index.ts +2 -0
- package/src/components/SpireProvider/SpireProvider.vue +71 -0
- package/src/components/SpireProvider/index.ts +11 -0
- package/src/components/Stepper/Stepper.test.ts +221 -0
- package/src/components/Stepper/StepperContent.vue +51 -0
- package/src/components/Stepper/StepperItem.vue +89 -0
- package/src/components/Stepper/StepperRoot.vue +101 -0
- package/src/components/Stepper/StepperSeparator.vue +52 -0
- package/src/components/Stepper/StepperTrigger.vue +144 -0
- package/src/components/Stepper/index.ts +11 -0
- package/src/components/Stepper/keys.ts +27 -0
- package/src/components/Switch/Switch.test.ts +214 -0
- package/src/components/Switch/Switch.vue +235 -0
- package/src/components/Switch/index.ts +2 -0
- package/src/components/Tabs/Tabs.test.ts +363 -0
- package/src/components/Tabs/Tabs.vue +318 -0
- package/src/components/Tabs/index.ts +2 -0
- package/src/components/Text/Text.test.ts +154 -0
- package/src/components/Text/Text.vue +100 -0
- package/src/components/Text/index.ts +2 -0
- package/src/components/Textarea/Textarea.test.ts +432 -0
- package/src/components/Textarea/Textarea.vue +411 -0
- package/src/components/Textarea/index.ts +2 -0
- package/src/components/TimePicker/TimePicker.test.ts +352 -0
- package/src/components/TimePicker/TimePicker.vue +569 -0
- package/src/components/TimePicker/index.ts +2 -0
- package/src/components/Timeline/Timeline.test.ts +193 -0
- package/src/components/Timeline/Timeline.vue +111 -0
- package/src/components/Timeline/TimelineItem.vue +167 -0
- package/src/components/Timeline/index.ts +13 -0
- package/src/components/Timeline/keys.ts +21 -0
- package/src/components/Toast/ToastItem.test.ts +289 -0
- package/src/components/Toast/ToastItem.vue +370 -0
- package/src/components/Toast/ToastProvider.test.ts +158 -0
- package/src/components/Toast/ToastProvider.vue +181 -0
- package/src/components/Toast/index.ts +83 -0
- package/src/components/Toast/toastState.test.ts +165 -0
- package/src/components/Toast/toastState.ts +161 -0
- package/src/components/ToggleButton/ToggleButton.test.ts +166 -0
- package/src/components/ToggleButton/ToggleButton.vue +197 -0
- package/src/components/ToggleButton/index.ts +2 -0
- package/src/components/ToggleGroup/ToggleGroup.test.ts +181 -0
- package/src/components/ToggleGroup/ToggleGroup.vue +130 -0
- package/src/components/ToggleGroup/index.ts +2 -0
- package/src/components/Tooltip/Tooltip.test.ts +238 -0
- package/src/components/Tooltip/Tooltip.vue +217 -0
- package/src/components/Tooltip/index.ts +2 -0
- package/src/components/TreeView/TreeView.test.ts +357 -0
- package/src/components/TreeView/TreeView.vue +251 -0
- package/src/components/TreeView/TreeViewItem.vue +288 -0
- package/src/components/TreeView/index.ts +11 -0
- package/src/components/TreeView/keys.ts +35 -0
- package/src/composables/index.ts +12 -0
- package/src/composables/useClickOutside.ts +36 -0
- package/src/composables/useClipboard.ts +35 -0
- package/src/composables/useEventListener.ts +48 -0
- package/src/composables/useFocusTrap.ts +58 -0
- package/src/composables/useHoverReveal.ts +98 -0
- package/src/composables/useId.ts +10 -0
- package/src/composables/useMagnetic.ts +171 -0
- package/src/composables/useRelativePosition.ts +127 -0
- package/src/composables/useRipple.ts +146 -0
- package/src/composables/useScrollLock.ts +25 -0
- package/src/composables/useSpireConfig.ts +27 -0
- package/src/composables/useStagger.ts +224 -0
- package/src/config/icons.test.ts +115 -0
- package/src/config/icons.ts +170 -0
- package/src/index.ts +361 -0
- package/src/styles/depth.css +129 -0
- package/src/styles/effects.css +169 -0
- package/src/styles/fallback.css +152 -0
- package/src/styles/main.css +25 -0
- package/src/styles/mood.css +211 -0
- package/src/styles/motion.css +159 -0
- package/src/styles/reset.css +97 -0
- package/src/styles/theme.css +708 -0
- package/src/styles/tokens.css +183 -0
- package/src/utils/.gitkeep +0 -0
- package/src/utils/color.ts +277 -0
- package/src/utils/date.test.ts +522 -0
- package/src/utils/date.ts +380 -0
- package/src/utils/index.ts +23 -0
- package/src/utils/object.test.ts +80 -0
- package/src/utils/object.ts +25 -0
- package/src/utils/string.test.ts +64 -0
- package/src/utils/string.ts +32 -0
- package/src/utils/time.ts +156 -0
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
ref,
|
|
4
|
+
computed,
|
|
5
|
+
watch,
|
|
6
|
+
onMounted,
|
|
7
|
+
onUnmounted,
|
|
8
|
+
nextTick
|
|
9
|
+
} from 'vue'
|
|
10
|
+
import { useId, useScrollLock } from '../../composables'
|
|
11
|
+
|
|
12
|
+
export type DrawerPlacement = 'right' | 'left' | 'bottom'
|
|
13
|
+
export type DrawerVariant = 'default' | 'floating'
|
|
14
|
+
export type DrawerSize = 'sm' | 'md' | 'lg' | 'xl' | 'full'
|
|
15
|
+
|
|
16
|
+
export interface DrawerProps {
|
|
17
|
+
/** Controls visibility (v-model) */
|
|
18
|
+
modelValue?: boolean
|
|
19
|
+
/** Drawer title */
|
|
20
|
+
title?: string
|
|
21
|
+
/** Visual variant */
|
|
22
|
+
variant?: DrawerVariant
|
|
23
|
+
/** Placement on desktop */
|
|
24
|
+
placement?: DrawerPlacement
|
|
25
|
+
/** Width/height preset */
|
|
26
|
+
size?: DrawerSize
|
|
27
|
+
/** Allow closing by clicking backdrop */
|
|
28
|
+
maskClosable?: boolean
|
|
29
|
+
/** Allow closing with Escape key */
|
|
30
|
+
closeOnEscape?: boolean
|
|
31
|
+
/** Show close button in header */
|
|
32
|
+
showClose?: boolean
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const props = withDefaults(defineProps<DrawerProps>(), {
|
|
36
|
+
modelValue: false,
|
|
37
|
+
variant: 'default',
|
|
38
|
+
placement: 'right',
|
|
39
|
+
size: 'md',
|
|
40
|
+
maskClosable: true,
|
|
41
|
+
closeOnEscape: true,
|
|
42
|
+
showClose: true
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
const emit = defineEmits<{
|
|
46
|
+
'update:modelValue': [value: boolean]
|
|
47
|
+
open: []
|
|
48
|
+
close: []
|
|
49
|
+
}>()
|
|
50
|
+
|
|
51
|
+
const drawerRef = ref<HTMLElement | null>(null)
|
|
52
|
+
const drawerId = useId('drawer')
|
|
53
|
+
const titleId = useId('drawer-title')
|
|
54
|
+
|
|
55
|
+
const isOpen = computed({
|
|
56
|
+
get: () => props.modelValue,
|
|
57
|
+
set: (value) => emit('update:modelValue', value)
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
const isMobile = ref(false)
|
|
61
|
+
|
|
62
|
+
function checkMobile() {
|
|
63
|
+
isMobile.value = window.innerWidth < 640
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
onMounted(() => {
|
|
67
|
+
checkMobile()
|
|
68
|
+
window.addEventListener('resize', checkMobile)
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
onUnmounted(() => {
|
|
72
|
+
window.removeEventListener('resize', checkMobile)
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
const actualPlacement = computed(() => {
|
|
76
|
+
return isMobile.value ? 'bottom' : props.placement
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
const shouldLockScroll = computed(() => isOpen.value)
|
|
80
|
+
useScrollLock(shouldLockScroll)
|
|
81
|
+
|
|
82
|
+
const FOCUSABLE_SELECTOR = 'a[href], button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
|
83
|
+
|
|
84
|
+
function trapFocus(e: KeyboardEvent) {
|
|
85
|
+
if (!drawerRef.value) return
|
|
86
|
+
if (e.key !== 'Tab') return
|
|
87
|
+
|
|
88
|
+
const elements = drawerRef.value.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)
|
|
89
|
+
if (elements.length === 0) return
|
|
90
|
+
|
|
91
|
+
const first = elements[0]
|
|
92
|
+
const last = elements[elements.length - 1]
|
|
93
|
+
|
|
94
|
+
if (e.shiftKey) {
|
|
95
|
+
if (document.activeElement === first) {
|
|
96
|
+
e.preventDefault()
|
|
97
|
+
last.focus()
|
|
98
|
+
}
|
|
99
|
+
} else {
|
|
100
|
+
if (document.activeElement === last) {
|
|
101
|
+
e.preventDefault()
|
|
102
|
+
first.focus()
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function focusFirstElement() {
|
|
108
|
+
if (!drawerRef.value) return
|
|
109
|
+
nextTick(() => {
|
|
110
|
+
const first = drawerRef.value?.querySelector<HTMLElement>(FOCUSABLE_SELECTOR)
|
|
111
|
+
first?.focus()
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
let previousActiveElement: HTMLElement | null = null
|
|
116
|
+
|
|
117
|
+
function open() {
|
|
118
|
+
previousActiveElement = document.activeElement as HTMLElement
|
|
119
|
+
emit('open')
|
|
120
|
+
nextTick(() => {
|
|
121
|
+
focusFirstElement()
|
|
122
|
+
window.addEventListener('keydown', trapFocus)
|
|
123
|
+
})
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function close() {
|
|
127
|
+
isOpen.value = false
|
|
128
|
+
window.removeEventListener('keydown', trapFocus)
|
|
129
|
+
emit('close')
|
|
130
|
+
nextTick(() => {
|
|
131
|
+
previousActiveElement?.focus()
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function handleBackdropClick() {
|
|
136
|
+
if (props.maskClosable) {
|
|
137
|
+
close()
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function handleKeydown(event: KeyboardEvent) {
|
|
142
|
+
if (event.key === 'Escape' && props.closeOnEscape) {
|
|
143
|
+
event.preventDefault()
|
|
144
|
+
close()
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
watch(isOpen, (newValue) => {
|
|
149
|
+
if (newValue) {
|
|
150
|
+
open()
|
|
151
|
+
}
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
onUnmounted(() => {
|
|
155
|
+
window.removeEventListener('keydown', trapFocus)
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
const drawerClasses = computed(() => [
|
|
159
|
+
'ui-drawer__panel',
|
|
160
|
+
`ui-drawer__panel--${actualPlacement.value}`,
|
|
161
|
+
`ui-drawer__panel--${props.variant}`,
|
|
162
|
+
`ui-drawer__panel--${props.size}`,
|
|
163
|
+
{ 'ui-drawer__panel--mobile': isMobile.value }
|
|
164
|
+
])
|
|
165
|
+
|
|
166
|
+
const transitionName = computed(() => {
|
|
167
|
+
return `ui-drawer-${actualPlacement.value}`
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
defineExpose({
|
|
171
|
+
close
|
|
172
|
+
})
|
|
173
|
+
</script>
|
|
174
|
+
|
|
175
|
+
<template>
|
|
176
|
+
<Teleport to="body">
|
|
177
|
+
<Transition :name="transitionName">
|
|
178
|
+
<div
|
|
179
|
+
v-if="isOpen"
|
|
180
|
+
class="ui-drawer"
|
|
181
|
+
@keydown="handleKeydown"
|
|
182
|
+
>
|
|
183
|
+
<div
|
|
184
|
+
class="ui-drawer__backdrop"
|
|
185
|
+
@click="handleBackdropClick"
|
|
186
|
+
/>
|
|
187
|
+
<div
|
|
188
|
+
ref="drawerRef"
|
|
189
|
+
:class="drawerClasses"
|
|
190
|
+
:id="drawerId"
|
|
191
|
+
role="dialog"
|
|
192
|
+
aria-modal="true"
|
|
193
|
+
:aria-labelledby="title ? titleId : undefined"
|
|
194
|
+
>
|
|
195
|
+
<header v-if="title || showClose || $slots.header" class="ui-drawer__header">
|
|
196
|
+
<slot name="header">
|
|
197
|
+
<h2 v-if="title" :id="titleId" class="ui-drawer__title">{{ title }}</h2>
|
|
198
|
+
</slot>
|
|
199
|
+
<button
|
|
200
|
+
v-if="showClose"
|
|
201
|
+
type="button"
|
|
202
|
+
class="ui-drawer__close"
|
|
203
|
+
aria-label="Close drawer"
|
|
204
|
+
@click="close"
|
|
205
|
+
>
|
|
206
|
+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
207
|
+
<path d="M18 6L6 18M6 6l12 12" />
|
|
208
|
+
</svg>
|
|
209
|
+
</button>
|
|
210
|
+
</header>
|
|
211
|
+
|
|
212
|
+
<div class="ui-drawer__body">
|
|
213
|
+
<slot />
|
|
214
|
+
</div>
|
|
215
|
+
|
|
216
|
+
<footer v-if="$slots.footer" class="ui-drawer__footer">
|
|
217
|
+
<slot name="footer" :close="close" />
|
|
218
|
+
</footer>
|
|
219
|
+
</div>
|
|
220
|
+
</div>
|
|
221
|
+
</Transition>
|
|
222
|
+
</Teleport>
|
|
223
|
+
</template>
|
|
224
|
+
|
|
225
|
+
<style scoped>
|
|
226
|
+
.ui-drawer {
|
|
227
|
+
position: fixed;
|
|
228
|
+
inset: 0;
|
|
229
|
+
z-index: var(--z-modal, 100);
|
|
230
|
+
display: flex;
|
|
231
|
+
align-items: stretch;
|
|
232
|
+
justify-content: flex-end;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.ui-drawer__backdrop {
|
|
236
|
+
position: absolute;
|
|
237
|
+
inset: 0;
|
|
238
|
+
background: var(--modal-backdrop, rgba(0, 0, 0, 0.5));
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.ui-drawer__panel {
|
|
242
|
+
position: relative;
|
|
243
|
+
display: flex;
|
|
244
|
+
flex-direction: column;
|
|
245
|
+
background: var(--drawer-bg, var(--modal-bg));
|
|
246
|
+
box-shadow: var(--shadow-2xl);
|
|
247
|
+
max-width: 100%;
|
|
248
|
+
max-height: 100%;
|
|
249
|
+
overflow: hidden;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/* Placement: Right (default) */
|
|
253
|
+
.ui-drawer__panel--right {
|
|
254
|
+
height: 100%;
|
|
255
|
+
margin-left: auto;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/* Placement: Left */
|
|
259
|
+
.ui-drawer__panel--left {
|
|
260
|
+
height: 100%;
|
|
261
|
+
margin-right: auto;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/* Placement: Bottom */
|
|
265
|
+
.ui-drawer__panel--bottom {
|
|
266
|
+
width: 100%;
|
|
267
|
+
max-height: 90vh;
|
|
268
|
+
margin-top: auto;
|
|
269
|
+
border-radius: var(--radius-xl) var(--radius-xl) 0 0;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/* Variant: Default (edge-to-edge) */
|
|
273
|
+
.ui-drawer__panel--default.ui-drawer__panel--right,
|
|
274
|
+
.ui-drawer__panel--default.ui-drawer__panel--left {
|
|
275
|
+
border-radius: 0;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/* Variant: Floating */
|
|
279
|
+
.ui-drawer__panel--floating.ui-drawer__panel--right {
|
|
280
|
+
margin: var(--space-4);
|
|
281
|
+
height: calc(100vh - var(--space-8));
|
|
282
|
+
border-radius: var(--radius-xl);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.ui-drawer__panel--floating.ui-drawer__panel--left {
|
|
286
|
+
margin: var(--space-4);
|
|
287
|
+
height: calc(100vh - var(--space-8));
|
|
288
|
+
border-radius: var(--radius-xl);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/* Floating reverts to default on mobile */
|
|
292
|
+
.ui-drawer__panel--mobile.ui-drawer__panel--floating {
|
|
293
|
+
margin: 0;
|
|
294
|
+
border-radius: var(--radius-xl) var(--radius-xl) 0 0;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/* Sizes */
|
|
298
|
+
.ui-drawer__panel--sm {
|
|
299
|
+
width: 320px;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.ui-drawer__panel--md {
|
|
303
|
+
width: 400px;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.ui-drawer__panel--lg {
|
|
307
|
+
width: 560px;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.ui-drawer__panel--xl {
|
|
311
|
+
width: 720px;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.ui-drawer__panel--full {
|
|
315
|
+
width: 100%;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/* Bottom placement overrides width */
|
|
319
|
+
.ui-drawer__panel--bottom {
|
|
320
|
+
width: 100% !important;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/* Header */
|
|
324
|
+
.ui-drawer__header {
|
|
325
|
+
display: flex;
|
|
326
|
+
align-items: center;
|
|
327
|
+
justify-content: space-between;
|
|
328
|
+
gap: var(--space-4);
|
|
329
|
+
padding: var(--space-4) var(--space-6);
|
|
330
|
+
border-bottom: 1px solid var(--drawer-border, var(--modal-border, var(--border-default)));
|
|
331
|
+
flex-shrink: 0;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.ui-drawer__title {
|
|
335
|
+
margin: 0;
|
|
336
|
+
font-size: var(--text-lg);
|
|
337
|
+
font-weight: var(--font-semibold);
|
|
338
|
+
color: var(--drawer-title, var(--modal-title, var(--text-primary)));
|
|
339
|
+
font-family: var(--font-sans);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.ui-drawer__close {
|
|
343
|
+
display: flex;
|
|
344
|
+
align-items: center;
|
|
345
|
+
justify-content: center;
|
|
346
|
+
width: 32px;
|
|
347
|
+
height: 32px;
|
|
348
|
+
padding: 0;
|
|
349
|
+
margin-left: auto;
|
|
350
|
+
background: transparent;
|
|
351
|
+
border: none;
|
|
352
|
+
border-radius: var(--radius-md);
|
|
353
|
+
color: var(--drawer-close, var(--modal-close, var(--text-secondary)));
|
|
354
|
+
cursor: pointer;
|
|
355
|
+
transition: background-color var(--duration-fast) var(--ease-default),
|
|
356
|
+
color var(--duration-fast) var(--ease-default);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.ui-drawer__close:hover {
|
|
360
|
+
background: var(--drawer-close-hover-bg, var(--modal-close-hover-bg, var(--surface-hover)));
|
|
361
|
+
color: var(--drawer-close-hover, var(--modal-close-hover, var(--text-primary)));
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.ui-drawer__close:focus-visible {
|
|
365
|
+
outline: 2px solid var(--focus-ring);
|
|
366
|
+
outline-offset: 2px;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/* Body */
|
|
370
|
+
.ui-drawer__body {
|
|
371
|
+
flex: 1;
|
|
372
|
+
overflow-y: auto;
|
|
373
|
+
padding: var(--space-6);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/* Footer */
|
|
377
|
+
.ui-drawer__footer {
|
|
378
|
+
display: flex;
|
|
379
|
+
align-items: center;
|
|
380
|
+
justify-content: flex-end;
|
|
381
|
+
gap: var(--space-3);
|
|
382
|
+
padding: var(--space-4) var(--space-6);
|
|
383
|
+
border-top: 1px solid var(--drawer-border, var(--modal-border, var(--border-default)));
|
|
384
|
+
flex-shrink: 0;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/* Animations - Expo Out curve */
|
|
388
|
+
|
|
389
|
+
/* Right slide */
|
|
390
|
+
.ui-drawer-right-enter-active .ui-drawer__backdrop,
|
|
391
|
+
.ui-drawer-right-leave-active .ui-drawer__backdrop {
|
|
392
|
+
transition: opacity 300ms var(--ease-default);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.ui-drawer-right-enter-active .ui-drawer__panel,
|
|
396
|
+
.ui-drawer-right-leave-active .ui-drawer__panel {
|
|
397
|
+
transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
.ui-drawer-right-enter-from .ui-drawer__backdrop,
|
|
401
|
+
.ui-drawer-right-leave-to .ui-drawer__backdrop {
|
|
402
|
+
opacity: 0;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.ui-drawer-right-enter-from .ui-drawer__panel,
|
|
406
|
+
.ui-drawer-right-leave-to .ui-drawer__panel {
|
|
407
|
+
transform: translateX(100%);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/* Left slide */
|
|
411
|
+
.ui-drawer-left-enter-active .ui-drawer__backdrop,
|
|
412
|
+
.ui-drawer-left-leave-active .ui-drawer__backdrop {
|
|
413
|
+
transition: opacity 300ms var(--ease-default);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
.ui-drawer-left-enter-active .ui-drawer__panel,
|
|
417
|
+
.ui-drawer-left-leave-active .ui-drawer__panel {
|
|
418
|
+
transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
.ui-drawer-left-enter-from .ui-drawer__backdrop,
|
|
422
|
+
.ui-drawer-left-leave-to .ui-drawer__backdrop {
|
|
423
|
+
opacity: 0;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
.ui-drawer-left-enter-from .ui-drawer__panel,
|
|
427
|
+
.ui-drawer-left-leave-to .ui-drawer__panel {
|
|
428
|
+
transform: translateX(-100%);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/* Bottom slide */
|
|
432
|
+
.ui-drawer-bottom-enter-active .ui-drawer__backdrop,
|
|
433
|
+
.ui-drawer-bottom-leave-active .ui-drawer__backdrop {
|
|
434
|
+
transition: opacity 300ms var(--ease-default);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.ui-drawer-bottom-enter-active .ui-drawer__panel,
|
|
438
|
+
.ui-drawer-bottom-leave-active .ui-drawer__panel {
|
|
439
|
+
transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
.ui-drawer-bottom-enter-from .ui-drawer__backdrop,
|
|
443
|
+
.ui-drawer-bottom-leave-to .ui-drawer__backdrop {
|
|
444
|
+
opacity: 0;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
.ui-drawer-bottom-enter-from .ui-drawer__panel,
|
|
448
|
+
.ui-drawer-bottom-leave-to .ui-drawer__panel {
|
|
449
|
+
transform: translateY(100%);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/* Mobile adjustments */
|
|
453
|
+
@media (max-width: 639px) {
|
|
454
|
+
.ui-drawer {
|
|
455
|
+
align-items: flex-end;
|
|
456
|
+
justify-content: stretch;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.ui-drawer__panel {
|
|
460
|
+
width: 100% !important;
|
|
461
|
+
max-height: 90vh;
|
|
462
|
+
margin: 0;
|
|
463
|
+
border-radius: var(--radius-xl) var(--radius-xl) 0 0;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
</style>
|