horizon-design 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +153 -105
- package/dist/components/accordion/AccordionItem.svelte +3 -2
- package/dist/components/accordion/AccordionItem.svelte.d.ts +4 -1
- package/dist/components/angle-slider/AngleSlider.svelte +8 -4
- package/dist/components/angle-slider/AngleSlider.svelte.d.ts +5 -1
- package/dist/components/asset-card/AssetCard.svelte +23 -10
- package/dist/components/asset-card/AssetCard.svelte.d.ts +11 -5
- package/dist/components/avatar/Avatar.svelte +8 -2
- package/dist/components/avatar/Avatar.svelte.d.ts +1 -1
- package/dist/components/button/Button.svelte +1 -1
- package/dist/components/button/Button.svelte.d.ts +1 -1
- package/dist/components/button/button-variants.d.ts +2 -0
- package/dist/components/button/button-variants.js +2 -0
- package/dist/components/calendar/Calendar.svelte +22 -167
- package/dist/components/calendar/Calendar.svelte.d.ts +9 -3
- package/dist/components/calendar/CalendarViews.svelte +204 -0
- package/dist/components/calendar/CalendarViews.svelte.d.ts +24 -0
- package/dist/components/calendar/trigger-ids.d.ts +14 -0
- package/dist/components/calendar/trigger-ids.js +7 -0
- package/dist/components/card/Card.svelte +8 -2
- package/dist/components/card/Card.svelte.d.ts +4 -1
- package/dist/components/carousel/Carousel.svelte +57 -19
- package/dist/components/carousel/Carousel.svelte.d.ts +5 -2
- package/dist/components/checkbox/Checkbox.svelte +7 -7
- package/dist/components/checkbox/Checkbox.svelte.d.ts +1 -1
- package/dist/components/circular-progress/CircularProgress.svelte +3 -9
- package/dist/components/circular-progress/CircularProgress.svelte.d.ts +1 -1
- package/dist/components/circular-slider/CircularSlider.svelte +5 -11
- package/dist/components/circular-slider/CircularSlider.svelte.d.ts +1 -1
- package/dist/components/clipboard/Clipboard.svelte +30 -13
- package/dist/components/clipboard/Clipboard.svelte.d.ts +6 -2
- package/dist/components/collapsible/Collapsible.svelte +10 -3
- package/dist/components/collapsible/Collapsible.svelte.d.ts +7 -2
- package/dist/components/color-picker/ColorPicker.svelte +105 -28
- package/dist/components/color-picker/ColorPicker.svelte.d.ts +20 -5
- package/dist/components/color-picker/formats.d.ts +23 -0
- package/dist/components/color-picker/formats.js +52 -0
- package/dist/components/color-picker/index.d.ts +3 -1
- package/dist/components/color-picker/index.js +2 -1
- package/dist/components/combobox/Combobox.svelte +28 -4
- package/dist/components/combobox/Combobox.svelte.d.ts +9 -1
- package/dist/components/date-picker/DatePicker.svelte +46 -139
- package/dist/components/date-picker/DatePicker.svelte.d.ts +12 -2
- package/dist/components/dialog/Dialog.svelte +28 -10
- package/dist/components/dialog/Dialog.svelte.d.ts +6 -3
- package/dist/components/dialog/DialogClose.svelte +48 -21
- package/dist/components/dialog/DialogClose.svelte.d.ts +16 -6
- package/dist/components/dialog/context.d.ts +9 -0
- package/dist/components/dialog/context.js +16 -0
- package/dist/components/drawer/Drawer.svelte +25 -10
- package/dist/components/drawer/Drawer.svelte.d.ts +5 -3
- package/dist/components/editable/Editable.svelte +3 -0
- package/dist/components/file-upload/FileUpload.svelte +8 -6
- package/dist/components/file-upload/FileUpload.svelte.d.ts +4 -3
- package/dist/components/floating-panel/FloatingPanel.svelte +16 -9
- package/dist/components/floating-panel/FloatingPanel.svelte.d.ts +3 -2
- package/dist/components/frame/Frame.svelte +10 -6
- package/dist/components/frame/Frame.svelte.d.ts +2 -1
- package/dist/components/game-hero/GameHero.svelte +1 -1
- package/dist/components/game-hero/GameHero.svelte.d.ts +1 -1
- package/dist/components/icon-button/IconButton.svelte +60 -0
- package/dist/components/icon-button/IconButton.svelte.d.ts +31 -0
- package/dist/components/icon-button/index.d.ts +5 -0
- package/dist/components/icon-button/index.js +5 -0
- package/dist/components/item/Item.svelte +34 -11
- package/dist/components/item/Item.svelte.d.ts +11 -2
- package/dist/components/kbd/Kbd.svelte +34 -4
- package/dist/components/kbd/Kbd.svelte.d.ts +16 -2
- package/dist/components/listbox/Listbox.svelte +6 -3
- package/dist/components/listbox/Listbox.svelte.d.ts +4 -1
- package/dist/components/menu/Menu.svelte +33 -5
- package/dist/components/menu/Menu.svelte.d.ts +12 -2
- package/dist/components/native-select/NativeSelect.svelte +3 -2
- package/dist/components/native-select/NativeSelect.svelte.d.ts +2 -1
- package/dist/components/notification-center/NotificationCenter.svelte +1 -1
- package/dist/components/number-input/NumberInput.svelte +39 -13
- package/dist/components/number-input/NumberInput.svelte.d.ts +5 -3
- package/dist/components/pagination/Pagination.svelte +4 -3
- package/dist/components/pagination/Pagination.svelte.d.ts +2 -1
- package/dist/components/pagination/PaginationNextTrigger.svelte +30 -11
- package/dist/components/pagination/PaginationNextTrigger.svelte.d.ts +9 -1
- package/dist/components/pagination/PaginationPrevTrigger.svelte +30 -11
- package/dist/components/pagination/PaginationPrevTrigger.svelte.d.ts +9 -1
- package/dist/components/pin-input/PinInput.svelte +3 -2
- package/dist/components/pin-input/PinInput.svelte.d.ts +2 -1
- package/dist/components/popover/Popover.svelte +34 -6
- package/dist/components/popover/Popover.svelte.d.ts +11 -3
- package/dist/components/popover/PopoverClose.svelte +24 -9
- package/dist/components/popover/PopoverClose.svelte.d.ts +6 -1
- package/dist/components/progress/Progress.svelte +3 -3
- package/dist/components/radio-group/RadioGroup.svelte +43 -34
- package/dist/components/radio-group/RadioGroup.svelte.d.ts +3 -1
- package/dist/components/rating-group/RatingGroup.svelte +7 -2
- package/dist/components/rating-group/RatingGroup.svelte.d.ts +1 -0
- package/dist/components/ring/Ring.svelte +42 -0
- package/dist/components/ring/Ring.svelte.d.ts +16 -0
- package/dist/components/scroll-area/ScrollArea.svelte +30 -10
- package/dist/components/scroll-area/ScrollArea.svelte.d.ts +9 -1
- package/dist/components/segment-group/SegmentGroup.svelte +38 -17
- package/dist/components/segment-group/SegmentGroup.svelte.d.ts +9 -4
- package/dist/components/select/Select.svelte +2 -2
- package/dist/components/select/Select.svelte.d.ts +1 -1
- package/dist/components/sheet/Sheet.svelte +54 -15
- package/dist/components/sheet/Sheet.svelte.d.ts +15 -6
- package/dist/components/sidebar/Sidebar.svelte +18 -3
- package/dist/components/sidebar/Sidebar.svelte.d.ts +9 -3
- package/dist/components/sidebar/SidebarItem.svelte +53 -26
- package/dist/components/sidebar/SidebarItem.svelte.d.ts +8 -4
- package/dist/components/sidebar/SidebarSection.svelte +1 -1
- package/dist/components/sidebar/context.d.ts +9 -0
- package/dist/components/sidebar/context.js +15 -0
- package/dist/components/signature-pad/SignaturePad.svelte +3 -2
- package/dist/components/signature-pad/SignaturePad.svelte.d.ts +2 -1
- package/dist/components/slider/Slider.svelte +21 -10
- package/dist/components/slider/Slider.svelte.d.ts +3 -1
- package/dist/components/splitter/Splitter.svelte +8 -2
- package/dist/components/splitter/Splitter.svelte.d.ts +2 -1
- package/dist/components/switch/Switch.svelte +26 -41
- package/dist/components/switch/Switch.svelte.d.ts +2 -2
- package/dist/components/table/Table.svelte +21 -26
- package/dist/components/table/Table.svelte.d.ts +41 -22
- package/dist/components/table/index.d.ts +2 -2
- package/dist/components/table/index.js +1 -1
- package/dist/components/tag-picker/TagPicker.svelte +3 -5
- package/dist/components/tag-picker/TagPicker.svelte.d.ts +1 -1
- package/dist/components/textarea/Textarea.svelte +8 -2
- package/dist/components/textarea/Textarea.svelte.d.ts +4 -1
- package/dist/components/theme-switch/ThemeSwitch.svelte +64 -18
- package/dist/components/theme-switch/ThemeSwitch.svelte.d.ts +6 -3
- package/dist/components/thumb-card/ThumbCard.svelte +19 -6
- package/dist/components/thumb-card/ThumbCard.svelte.d.ts +9 -2
- package/dist/components/timer/Timer.svelte +26 -15
- package/dist/components/timer/Timer.svelte.d.ts +3 -2
- package/dist/components/toast/Toast.svelte +15 -8
- package/dist/components/toast/Toast.svelte.d.ts +3 -2
- package/dist/components/toast/Toaster.svelte +1 -1
- package/dist/components/toast/Toaster.svelte.d.ts +1 -1
- package/dist/components/toggle/Toggle.svelte +4 -2
- package/dist/components/toggle/Toggle.svelte.d.ts +4 -2
- package/dist/components/toggle-group/ToggleGroup.svelte +61 -14
- package/dist/components/toggle-group/ToggleGroup.svelte.d.ts +13 -5
- package/dist/components/toggle-tooltip/ToggleTooltip.svelte +26 -29
- package/dist/components/toggle-tooltip/ToggleTooltip.svelte.d.ts +4 -3
- package/dist/components/tooltip/Tooltip.svelte +31 -5
- package/dist/components/tooltip/Tooltip.svelte.d.ts +10 -2
- package/dist/components/tour/Tour.svelte +21 -13
- package/dist/components/tour/Tour.svelte.d.ts +3 -3
- package/dist/components/virtual-tree/VirtualTree.svelte +7 -6
- package/dist/components/virtual-tree/VirtualTree.svelte.d.ts +3 -2
- package/dist/editor/horizon-layout/HorizonLayout.svelte +8 -7
- package/dist/editor/horizon-layout/HorizonLayout.svelte.d.ts +2 -2
- package/dist/editor/inspector-panel/InspectorPanel.svelte +60 -9
- package/dist/editor/inspector-panel/InspectorPanel.svelte.d.ts +19 -1
- package/dist/generated/theme.css +16 -11
- package/dist/generated/tokens.d.ts +1 -1
- package/dist/generated/tokens.js +13 -11
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/dist/motion/sliding-indicator.d.ts +28 -0
- package/dist/motion/sliding-indicator.js +54 -0
- package/dist/platform.d.ts +21 -0
- package/dist/platform.js +19 -0
- package/dist/theme.svelte.d.ts +3 -3
- package/dist/theme.svelte.js +7 -7
- package/package.json +12 -12
- package/dist/components/tabs/Tabs.svelte +0 -119
- package/dist/components/tabs/Tabs.svelte.d.ts +0 -31
- package/dist/components/tabs/index.d.ts +0 -5
- package/dist/components/tabs/index.js +0 -5
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
3
|
A date field with a calendar popover (Ark DatePicker). `label` names the field; `placeholder` and
|
|
4
|
-
`translations` (the names of the controls
|
|
5
|
-
as) are passed in.
|
|
4
|
+
`translations` (the names of the controls, which the icon buttons show in a tooltip too, and the
|
|
5
|
+
roles the popover and its tables are announced as) are passed in. The popover's calendar is
|
|
6
|
+
`Calendar`'s: six weeks, and month and year views of the same size. `openOnClick` opens it as soon
|
|
7
|
+
as the field is pressed.
|
|
6
8
|
-->
|
|
7
9
|
<script lang="ts">
|
|
10
|
+
import type { ComponentProps } from 'svelte';
|
|
8
11
|
import { DatePicker, type DatePickerRootProps } from '@ark-ui/svelte';
|
|
9
12
|
import type {
|
|
10
13
|
DatePickerDateView,
|
|
@@ -14,8 +17,9 @@ as) are passed in.
|
|
|
14
17
|
import { Portal } from '@ark-ui/svelte/portal';
|
|
15
18
|
import { cn } from '../../utils.js';
|
|
16
19
|
import MingcuteCalendarLine from '~icons/mingcute/calendar-line';
|
|
17
|
-
import
|
|
18
|
-
import
|
|
20
|
+
import CalendarViews from '../calendar/CalendarViews.svelte';
|
|
21
|
+
import { calendarTriggerIds } from '../calendar/trigger-ids';
|
|
22
|
+
import Tooltip from '../tooltip/Tooltip.svelte';
|
|
19
23
|
|
|
20
24
|
let {
|
|
21
25
|
class: className = '',
|
|
@@ -23,7 +27,9 @@ as) are passed in.
|
|
|
23
27
|
placeholder = '',
|
|
24
28
|
value = $bindable(),
|
|
25
29
|
onValueChange,
|
|
30
|
+
openOnClick = false,
|
|
26
31
|
translations,
|
|
32
|
+
ids: appIds,
|
|
27
33
|
...rest
|
|
28
34
|
}: {
|
|
29
35
|
/** Classes merged onto the root. */
|
|
@@ -36,6 +42,11 @@ as) are passed in.
|
|
|
36
42
|
value?: DateValue[];
|
|
37
43
|
/** Called with the new dates when they change. */
|
|
38
44
|
onValueChange?: (details: DatePickerValueChangeDetails) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Opens the calendar as soon as the field is pressed, not only from the calendar button or
|
|
47
|
+
* the arrow keys; the field keeps the focus, so typing a date starts at once.
|
|
48
|
+
*/
|
|
49
|
+
openOnClick?: boolean;
|
|
39
50
|
/**
|
|
40
51
|
* The accessible names Ark gives the controls: the calendar button (`trigger(open)`), the
|
|
41
52
|
* popover (`content`), each day (`dayCell(state)`, from its formatted `valueText`), the
|
|
@@ -52,6 +63,8 @@ as) are passed in.
|
|
|
52
63
|
contentRoleDescription: string;
|
|
53
64
|
tableRoleDescription: (view: DatePickerDateView) => string;
|
|
54
65
|
};
|
|
66
|
+
/** Ark's `ids`, merged with the ids the kit gives the buttons it adds a tooltip to, which win. */
|
|
67
|
+
ids?: ComponentProps<typeof DatePicker.Root>['ids'];
|
|
55
68
|
/**
|
|
56
69
|
* Other props of Ark's `DatePicker.Root`: `selectionMode` (`single`, `multiple` or
|
|
57
70
|
* `range`), `locale`, `min` and `max`.
|
|
@@ -62,17 +75,20 @@ as) are passed in.
|
|
|
62
75
|
const { contentRoleDescription, tableRoleDescription, ...arkTranslations } =
|
|
63
76
|
$derived(translations);
|
|
64
77
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
|
|
78
|
+
// The ids of the buttons that have a tooltip, shared by Ark's date picker and the tooltips,
|
|
79
|
+
// which both find them by id.
|
|
80
|
+
const uid = $props.id();
|
|
81
|
+
const triggerId = `${uid}-trigger`;
|
|
82
|
+
const ids = calendarTriggerIds(uid);
|
|
70
83
|
</script>
|
|
71
84
|
|
|
72
85
|
<DatePicker.Root
|
|
73
86
|
class={cn('flex flex-col gap-1.5', className)}
|
|
74
87
|
data-slot="date-picker"
|
|
75
88
|
{value}
|
|
89
|
+
{openOnClick}
|
|
90
|
+
fixedWeeks
|
|
91
|
+
ids={{ ...appIds, trigger: triggerId, ...ids }}
|
|
76
92
|
translations={arkTranslations}
|
|
77
93
|
onValueChange={(details) => {
|
|
78
94
|
value = details.value;
|
|
@@ -86,143 +102,34 @@ as) are passed in.
|
|
|
86
102
|
class="flex h-8 w-full rounded-lg border border-border bg-sunken px-3 py-1 pr-9 text-sm text-fg shadow-sm outline-none placeholder:text-muted focus-visible:border-primary focus-visible:ring-2 focus-visible:ring-primary"
|
|
87
103
|
{placeholder}
|
|
88
104
|
/>
|
|
89
|
-
<DatePicker.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
105
|
+
<DatePicker.Context>
|
|
106
|
+
{#snippet render(api)}
|
|
107
|
+
<Tooltip content={arkTranslations.trigger(api().open)} {triggerId}>
|
|
108
|
+
{#snippet trigger(props)}
|
|
109
|
+
<DatePicker.Trigger
|
|
110
|
+
{...props}
|
|
111
|
+
class="absolute top-1/2 right-2 -translate-y-1/2 text-muted transition-colors hover:text-fg"
|
|
112
|
+
>
|
|
113
|
+
<MingcuteCalendarLine class="size-4" aria-hidden="true" />
|
|
114
|
+
</DatePicker.Trigger>
|
|
115
|
+
{/snippet}
|
|
116
|
+
</Tooltip>
|
|
117
|
+
{/snippet}
|
|
118
|
+
</DatePicker.Context>
|
|
94
119
|
</DatePicker.Control>
|
|
95
120
|
<Portal>
|
|
96
121
|
<DatePicker.Positioner>
|
|
97
122
|
<DatePicker.Content
|
|
98
123
|
aria-roledescription={contentRoleDescription}
|
|
99
|
-
class="z-50 w-fit rounded-xl border border-border bg-raised p-3 shadow-lg outline-none data-[state=closed]:animate-zoom-out data-[state=open]:animate-zoom-in"
|
|
124
|
+
class="z-50 w-fit rounded-xl border border-border bg-raised p-3 shadow-lg outline-none [--cell-size:--spacing(9)] data-[state=closed]:animate-zoom-out data-[state=open]:animate-zoom-in"
|
|
100
125
|
data-slot="date-picker-content"
|
|
101
126
|
>
|
|
102
|
-
<
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
class="text-sm font-medium text-fg transition-colors hover:text-primary"
|
|
109
|
-
>
|
|
110
|
-
<DatePicker.RangeText />
|
|
111
|
-
</DatePicker.ViewTrigger>
|
|
112
|
-
<DatePicker.NextTrigger class={navBtnClass}>
|
|
113
|
-
<MingcuteRightLine class="size-4" aria-hidden="true" />
|
|
114
|
-
</DatePicker.NextTrigger>
|
|
115
|
-
</div>
|
|
116
|
-
<DatePicker.Context>
|
|
117
|
-
{#snippet render(api)}
|
|
118
|
-
<DatePicker.Table
|
|
119
|
-
class="w-full border-collapse"
|
|
120
|
-
aria-roledescription={tableRoleDescription('day')}
|
|
121
|
-
>
|
|
122
|
-
<DatePicker.TableHead>
|
|
123
|
-
<DatePicker.TableRow>
|
|
124
|
-
{#each api().weekDays as weekDay (weekDay.long)}
|
|
125
|
-
<DatePicker.TableHeader
|
|
126
|
-
class="h-8 w-8 pb-2 text-center text-xs font-medium text-muted"
|
|
127
|
-
>
|
|
128
|
-
{weekDay.short}
|
|
129
|
-
</DatePicker.TableHeader>
|
|
130
|
-
{/each}
|
|
131
|
-
</DatePicker.TableRow>
|
|
132
|
-
</DatePicker.TableHead>
|
|
133
|
-
<DatePicker.TableBody>
|
|
134
|
-
{#each api().weeks as week (week[0].toString())}
|
|
135
|
-
<DatePicker.TableRow>
|
|
136
|
-
{#each week as day (day.toString())}
|
|
137
|
-
<DatePicker.TableCell value={day}>
|
|
138
|
-
<DatePicker.TableCellTrigger class={cellClass}>
|
|
139
|
-
{day.day}
|
|
140
|
-
</DatePicker.TableCellTrigger>
|
|
141
|
-
</DatePicker.TableCell>
|
|
142
|
-
{/each}
|
|
143
|
-
</DatePicker.TableRow>
|
|
144
|
-
{/each}
|
|
145
|
-
</DatePicker.TableBody>
|
|
146
|
-
</DatePicker.Table>
|
|
147
|
-
{/snippet}
|
|
148
|
-
</DatePicker.Context>
|
|
149
|
-
</DatePicker.View>
|
|
150
|
-
|
|
151
|
-
<DatePicker.View view="month">
|
|
152
|
-
<div class="mb-3 flex items-center justify-between">
|
|
153
|
-
<DatePicker.PrevTrigger class={navBtnClass}>
|
|
154
|
-
<MingcuteLeftLine class="size-4" aria-hidden="true" />
|
|
155
|
-
</DatePicker.PrevTrigger>
|
|
156
|
-
<DatePicker.ViewTrigger
|
|
157
|
-
class="text-sm font-medium text-fg transition-colors hover:text-primary"
|
|
158
|
-
>
|
|
159
|
-
<DatePicker.RangeText />
|
|
160
|
-
</DatePicker.ViewTrigger>
|
|
161
|
-
<DatePicker.NextTrigger class={navBtnClass}>
|
|
162
|
-
<MingcuteRightLine class="size-4" aria-hidden="true" />
|
|
163
|
-
</DatePicker.NextTrigger>
|
|
164
|
-
</div>
|
|
165
|
-
<DatePicker.Context>
|
|
166
|
-
{#snippet render(api)}
|
|
167
|
-
<DatePicker.Table
|
|
168
|
-
class="w-full border-collapse"
|
|
169
|
-
aria-roledescription={tableRoleDescription('month')}
|
|
170
|
-
>
|
|
171
|
-
<DatePicker.TableBody>
|
|
172
|
-
{#each api().getMonthsGrid() as months (months[0].value)}
|
|
173
|
-
<DatePicker.TableRow>
|
|
174
|
-
{#each months as month (month.value)}
|
|
175
|
-
<DatePicker.TableCell value={month.value}>
|
|
176
|
-
<DatePicker.TableCellTrigger class={cn(cellClass, 'w-16')}>
|
|
177
|
-
{month.label}
|
|
178
|
-
</DatePicker.TableCellTrigger>
|
|
179
|
-
</DatePicker.TableCell>
|
|
180
|
-
{/each}
|
|
181
|
-
</DatePicker.TableRow>
|
|
182
|
-
{/each}
|
|
183
|
-
</DatePicker.TableBody>
|
|
184
|
-
</DatePicker.Table>
|
|
185
|
-
{/snippet}
|
|
186
|
-
</DatePicker.Context>
|
|
187
|
-
</DatePicker.View>
|
|
188
|
-
|
|
189
|
-
<DatePicker.View view="year">
|
|
190
|
-
<div class="mb-3 flex items-center justify-between">
|
|
191
|
-
<DatePicker.PrevTrigger class={navBtnClass}>
|
|
192
|
-
<MingcuteLeftLine class="size-4" aria-hidden="true" />
|
|
193
|
-
</DatePicker.PrevTrigger>
|
|
194
|
-
<DatePicker.ViewTrigger
|
|
195
|
-
class="text-sm font-medium text-fg transition-colors hover:text-primary"
|
|
196
|
-
>
|
|
197
|
-
<DatePicker.RangeText />
|
|
198
|
-
</DatePicker.ViewTrigger>
|
|
199
|
-
<DatePicker.NextTrigger class={navBtnClass}>
|
|
200
|
-
<MingcuteRightLine class="size-4" aria-hidden="true" />
|
|
201
|
-
</DatePicker.NextTrigger>
|
|
202
|
-
</div>
|
|
203
|
-
<DatePicker.Context>
|
|
204
|
-
{#snippet render(api)}
|
|
205
|
-
<DatePicker.Table
|
|
206
|
-
class="w-full border-collapse"
|
|
207
|
-
aria-roledescription={tableRoleDescription('year')}
|
|
208
|
-
>
|
|
209
|
-
<DatePicker.TableBody>
|
|
210
|
-
{#each api().getYearsGrid() as years (years[0].value)}
|
|
211
|
-
<DatePicker.TableRow>
|
|
212
|
-
{#each years as year (year.value)}
|
|
213
|
-
<DatePicker.TableCell value={year.value}>
|
|
214
|
-
<DatePicker.TableCellTrigger class={cn(cellClass, 'w-12')}>
|
|
215
|
-
{year.label}
|
|
216
|
-
</DatePicker.TableCellTrigger>
|
|
217
|
-
</DatePicker.TableCell>
|
|
218
|
-
{/each}
|
|
219
|
-
</DatePicker.TableRow>
|
|
220
|
-
{/each}
|
|
221
|
-
</DatePicker.TableBody>
|
|
222
|
-
</DatePicker.Table>
|
|
223
|
-
{/snippet}
|
|
224
|
-
</DatePicker.Context>
|
|
225
|
-
</DatePicker.View>
|
|
127
|
+
<CalendarViews
|
|
128
|
+
{ids}
|
|
129
|
+
translations={arkTranslations}
|
|
130
|
+
{tableRoleDescription}
|
|
131
|
+
maxView={rest.maxView as DatePickerDateView | undefined}
|
|
132
|
+
/>
|
|
226
133
|
</DatePicker.Content>
|
|
227
134
|
</DatePicker.Positioner>
|
|
228
135
|
</Portal>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ComponentProps } from 'svelte';
|
|
1
2
|
import { DatePicker, type DatePickerRootProps } from '@ark-ui/svelte';
|
|
2
3
|
import type { DatePickerDateView, DatePickerValueChangeDetails, DateValue } from '@ark-ui/svelte/date-picker';
|
|
3
4
|
type $$ComponentProps = {
|
|
@@ -11,6 +12,11 @@ type $$ComponentProps = {
|
|
|
11
12
|
value?: DateValue[];
|
|
12
13
|
/** Called with the new dates when they change. */
|
|
13
14
|
onValueChange?: (details: DatePickerValueChangeDetails) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Opens the calendar as soon as the field is pressed, not only from the calendar button or
|
|
17
|
+
* the arrow keys; the field keeps the focus, so typing a date starts at once.
|
|
18
|
+
*/
|
|
19
|
+
openOnClick?: boolean;
|
|
14
20
|
/**
|
|
15
21
|
* The accessible names Ark gives the controls: the calendar button (`trigger(open)`), the
|
|
16
22
|
* popover (`content`), each day (`dayCell(state)`, from its formatted `valueText`), the
|
|
@@ -22,6 +28,8 @@ type $$ComponentProps = {
|
|
|
22
28
|
contentRoleDescription: string;
|
|
23
29
|
tableRoleDescription: (view: DatePickerDateView) => string;
|
|
24
30
|
};
|
|
31
|
+
/** Ark's `ids`, merged with the ids the kit gives the buttons it adds a tooltip to, which win. */
|
|
32
|
+
ids?: ComponentProps<typeof DatePicker.Root>['ids'];
|
|
25
33
|
/**
|
|
26
34
|
* Other props of Ark's `DatePicker.Root`: `selectionMode` (`single`, `multiple` or
|
|
27
35
|
* `range`), `locale`, `min` and `max`.
|
|
@@ -30,8 +38,10 @@ type $$ComponentProps = {
|
|
|
30
38
|
};
|
|
31
39
|
/**
|
|
32
40
|
* A date field with a calendar popover (Ark DatePicker). `label` names the field; `placeholder` and
|
|
33
|
-
* `translations` (the names of the controls
|
|
34
|
-
* as) are passed in.
|
|
41
|
+
* `translations` (the names of the controls, which the icon buttons show in a tooltip too, and the
|
|
42
|
+
* roles the popover and its tables are announced as) are passed in. The popover's calendar is
|
|
43
|
+
* `Calendar`'s: six weeks, and month and year views of the same size. `openOnClick` opens it as soon
|
|
44
|
+
* as the field is pressed.
|
|
35
45
|
*/
|
|
36
46
|
declare const DatePicker: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
37
47
|
type DatePicker = ReturnType<typeof DatePicker>;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
3
|
A modal dialog (Ark Dialog): a title, a description, the content and a footer, on the raised
|
|
4
|
-
surface over a scrim; `closeLabel` names its close button; `frosted` for a
|
|
4
|
+
surface over a scrim; `closeLabel` names its close button and is its tooltip; `frosted` for a
|
|
5
|
+
translucent surface.
|
|
5
6
|
-->
|
|
6
7
|
<script lang="ts">
|
|
7
|
-
import type { Snippet } from 'svelte';
|
|
8
|
+
import type { ComponentProps, Snippet } from 'svelte';
|
|
8
9
|
import { Dialog, type DialogOpenChangeDetails } from '@ark-ui/svelte';
|
|
9
10
|
import { Portal } from '@ark-ui/svelte/portal';
|
|
10
11
|
import { cn } from '../../utils.js';
|
|
12
|
+
import Tooltip from '../tooltip/Tooltip.svelte';
|
|
13
|
+
import { setDialogContext } from './context';
|
|
11
14
|
import MingcuteCloseLine from '~icons/mingcute/close-line';
|
|
12
15
|
|
|
13
16
|
let {
|
|
@@ -23,6 +26,7 @@ surface over a scrim; `closeLabel` names its close button; `frosted` for a trans
|
|
|
23
26
|
class: className = '',
|
|
24
27
|
open = $bindable(),
|
|
25
28
|
onOpenChange,
|
|
29
|
+
ids: appIds,
|
|
26
30
|
...rest
|
|
27
31
|
}: {
|
|
28
32
|
/** The content of the button that opens the dialog; no trigger when unset. */
|
|
@@ -39,7 +43,7 @@ surface over a scrim; `closeLabel` names its close button; `frosted` for a trans
|
|
|
39
43
|
footer?: Snippet;
|
|
40
44
|
/** Whether to show the close button at the top right. */
|
|
41
45
|
showClose?: boolean;
|
|
42
|
-
/** The close button's accessible name, such as "Close". */
|
|
46
|
+
/** The close button's accessible name and tooltip, such as "Close". */
|
|
43
47
|
closeLabel: string;
|
|
44
48
|
/** A translucent, blurred surface: for overlays above busy content only. */
|
|
45
49
|
frosted?: boolean;
|
|
@@ -49,12 +53,21 @@ surface over a scrim; `closeLabel` names its close button; `frosted` for a trans
|
|
|
49
53
|
open?: boolean;
|
|
50
54
|
/** Called with the new state when the dialog opens or closes. */
|
|
51
55
|
onOpenChange?: (details: DialogOpenChangeDetails) => void;
|
|
56
|
+
/** Ark's `ids`, merged with the ids the kit gives the buttons it adds a tooltip to, which win. */
|
|
57
|
+
ids?: ComponentProps<typeof Dialog.Root>['ids'];
|
|
52
58
|
/** Other props of Ark's `Dialog.Root`, such as `role="alertdialog"` or `onExitComplete`. */
|
|
53
59
|
[key: string]: unknown;
|
|
54
60
|
} = $props();
|
|
61
|
+
|
|
62
|
+
// The close button's id, shared by Ark's dialog (which focuses it first in an alert dialog) and
|
|
63
|
+
// its tooltip, which both find it by id.
|
|
64
|
+
const uid = $props.id();
|
|
65
|
+
const closeTriggerId = `${uid}-close`;
|
|
66
|
+
setDialogContext({ closeTriggerId });
|
|
55
67
|
</script>
|
|
56
68
|
|
|
57
69
|
<Dialog.Root
|
|
70
|
+
ids={{ ...appIds, closeTrigger: closeTriggerId }}
|
|
58
71
|
{open}
|
|
59
72
|
onOpenChange={(details) => {
|
|
60
73
|
open = details.open;
|
|
@@ -81,13 +94,18 @@ surface over a scrim; `closeLabel` names its close button; `frosted` for a trans
|
|
|
81
94
|
data-slot="dialog-content"
|
|
82
95
|
>
|
|
83
96
|
{#if showClose}
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
97
|
+
<Tooltip content={closeLabel} triggerId={closeTriggerId}>
|
|
98
|
+
{#snippet trigger(props)}
|
|
99
|
+
<Dialog.CloseTrigger
|
|
100
|
+
{...props}
|
|
101
|
+
class="absolute top-3.5 right-3.5 inline-flex size-7 items-center justify-center rounded-md text-muted transition-colors outline-none hover:bg-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-primary"
|
|
102
|
+
aria-label={closeLabel}
|
|
103
|
+
data-slot="dialog-close"
|
|
104
|
+
>
|
|
105
|
+
<MingcuteCloseLine class="size-4" aria-hidden="true" />
|
|
106
|
+
</Dialog.CloseTrigger>
|
|
107
|
+
{/snippet}
|
|
108
|
+
</Tooltip>
|
|
91
109
|
{/if}
|
|
92
110
|
{#if title || description}
|
|
93
111
|
<div class="flex flex-col gap-1 px-4.5 pt-4 pr-12 pb-3" data-slot="dialog-header">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte';
|
|
1
|
+
import type { ComponentProps, Snippet } from 'svelte';
|
|
2
2
|
import { Dialog, type DialogOpenChangeDetails } from '@ark-ui/svelte';
|
|
3
3
|
type $$ComponentProps = {
|
|
4
4
|
/** The content of the button that opens the dialog; no trigger when unset. */
|
|
@@ -15,7 +15,7 @@ type $$ComponentProps = {
|
|
|
15
15
|
footer?: Snippet;
|
|
16
16
|
/** Whether to show the close button at the top right. */
|
|
17
17
|
showClose?: boolean;
|
|
18
|
-
/** The close button's accessible name, such as "Close". */
|
|
18
|
+
/** The close button's accessible name and tooltip, such as "Close". */
|
|
19
19
|
closeLabel: string;
|
|
20
20
|
/** A translucent, blurred surface: for overlays above busy content only. */
|
|
21
21
|
frosted?: boolean;
|
|
@@ -25,12 +25,15 @@ type $$ComponentProps = {
|
|
|
25
25
|
open?: boolean;
|
|
26
26
|
/** Called with the new state when the dialog opens or closes. */
|
|
27
27
|
onOpenChange?: (details: DialogOpenChangeDetails) => void;
|
|
28
|
+
/** Ark's `ids`, merged with the ids the kit gives the buttons it adds a tooltip to, which win. */
|
|
29
|
+
ids?: ComponentProps<typeof Dialog.Root>['ids'];
|
|
28
30
|
/** Other props of Ark's `Dialog.Root`, such as `role="alertdialog"` or `onExitComplete`. */
|
|
29
31
|
[key: string]: unknown;
|
|
30
32
|
};
|
|
31
33
|
/**
|
|
32
34
|
* A modal dialog (Ark Dialog): a title, a description, the content and a footer, on the raised
|
|
33
|
-
* surface over a scrim; `closeLabel` names its close button; `frosted` for a
|
|
35
|
+
* surface over a scrim; `closeLabel` names its close button and is its tooltip; `frosted` for a
|
|
36
|
+
* translucent surface.
|
|
34
37
|
*/
|
|
35
38
|
declare const Dialog: import("svelte").Component<$$ComponentProps, {}, "open">;
|
|
36
39
|
type Dialog = ReturnType<typeof Dialog>;
|
|
@@ -1,43 +1,70 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
|
-
A button that closes the `Dialog` it is in: the children, or
|
|
3
|
+
A button that closes the `Dialog` it is in: the children, or a close icon named by `label`, which
|
|
4
|
+
is then also its tooltip.
|
|
4
5
|
-->
|
|
5
6
|
<script lang="ts">
|
|
6
7
|
import type { Snippet } from 'svelte';
|
|
7
8
|
import { Dialog } from '@ark-ui/svelte';
|
|
9
|
+
import { mergeProps } from '@ark-ui/svelte/utils';
|
|
8
10
|
import { cn } from '../../utils.js';
|
|
11
|
+
import Tooltip from '../tooltip/Tooltip.svelte';
|
|
12
|
+
import { dialogContext } from './context';
|
|
9
13
|
import MingcuteCloseLine from '~icons/mingcute/close-line';
|
|
10
14
|
|
|
15
|
+
type Content =
|
|
16
|
+
| {
|
|
17
|
+
/** The button's content, such as its text. */
|
|
18
|
+
children: Snippet;
|
|
19
|
+
/** The button's accessible name, when its content doesn't say it. */
|
|
20
|
+
label?: string;
|
|
21
|
+
}
|
|
22
|
+
| {
|
|
23
|
+
/** Unset: a close icon at the dialog's top right. */
|
|
24
|
+
children?: undefined;
|
|
25
|
+
/** The icon's accessible name and tooltip, such as "Close". */
|
|
26
|
+
label: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
11
29
|
let {
|
|
12
30
|
class: className = '',
|
|
13
31
|
label,
|
|
14
32
|
children,
|
|
15
33
|
...rest
|
|
16
|
-
}: {
|
|
34
|
+
}: Content & {
|
|
17
35
|
/** Classes merged onto the button, such as `buttonVariants(…)`. */
|
|
18
36
|
class?: string;
|
|
19
|
-
/** The button's accessible name, such as "Close"; needed when it has no text of its own. */
|
|
20
|
-
label?: string;
|
|
21
|
-
/** The button's content; a close icon at the dialog's top right when unset. */
|
|
22
|
-
children?: Snippet;
|
|
23
37
|
/** Other props of Ark's `Dialog.CloseTrigger`. */
|
|
24
38
|
[key: string]: unknown;
|
|
25
39
|
} = $props();
|
|
40
|
+
|
|
41
|
+
// The dialog's close button id, shared with the icon's tooltip (see `context.ts`).
|
|
42
|
+
const closeTriggerId = dialogContext()?.closeTriggerId;
|
|
43
|
+
|
|
44
|
+
const classes = $derived(
|
|
45
|
+
cn(
|
|
46
|
+
'rounded-sm text-muted transition-opacity outline-none focus-visible:ring-2 focus-visible:ring-primary disabled:pointer-events-none',
|
|
47
|
+
{ 'absolute top-4 right-4 p-1 opacity-70 hover:opacity-100': !children },
|
|
48
|
+
className
|
|
49
|
+
)
|
|
50
|
+
);
|
|
26
51
|
</script>
|
|
27
52
|
|
|
28
|
-
|
|
29
|
-
class={
|
|
30
|
-
'rounded-sm text-muted transition-opacity outline-none focus-visible:ring-2 focus-visible:ring-primary disabled:pointer-events-none',
|
|
31
|
-
{ 'absolute top-4 right-4 p-1 opacity-70 hover:opacity-100': !children },
|
|
32
|
-
className
|
|
33
|
-
)}
|
|
34
|
-
aria-label={label}
|
|
35
|
-
data-slot="dialog-close"
|
|
36
|
-
{...rest}
|
|
37
|
-
>
|
|
38
|
-
{#if children}
|
|
53
|
+
{#if children}
|
|
54
|
+
<Dialog.CloseTrigger class={classes} aria-label={label} data-slot="dialog-close" {...rest}>
|
|
39
55
|
{@render children()}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
{
|
|
43
|
-
|
|
56
|
+
</Dialog.CloseTrigger>
|
|
57
|
+
{:else}
|
|
58
|
+
<Tooltip content={label} triggerId={closeTriggerId}>
|
|
59
|
+
{#snippet trigger(props)}
|
|
60
|
+
<Dialog.CloseTrigger
|
|
61
|
+
{...mergeProps(props, rest)}
|
|
62
|
+
class={classes}
|
|
63
|
+
aria-label={label}
|
|
64
|
+
data-slot="dialog-close"
|
|
65
|
+
>
|
|
66
|
+
<MingcuteCloseLine class="size-4" aria-hidden="true" />
|
|
67
|
+
</Dialog.CloseTrigger>
|
|
68
|
+
{/snippet}
|
|
69
|
+
</Tooltip>
|
|
70
|
+
{/if}
|
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
type
|
|
2
|
+
type Content = {
|
|
3
|
+
/** The button's content, such as its text. */
|
|
4
|
+
children: Snippet;
|
|
5
|
+
/** The button's accessible name, when its content doesn't say it. */
|
|
6
|
+
label?: string;
|
|
7
|
+
} | {
|
|
8
|
+
/** Unset: a close icon at the dialog's top right. */
|
|
9
|
+
children?: undefined;
|
|
10
|
+
/** The icon's accessible name and tooltip, such as "Close". */
|
|
11
|
+
label: string;
|
|
12
|
+
};
|
|
13
|
+
type $$ComponentProps = Content & {
|
|
3
14
|
/** Classes merged onto the button, such as `buttonVariants(…)`. */
|
|
4
15
|
class?: string;
|
|
5
|
-
/** The button's accessible name, such as "Close"; needed when it has no text of its own. */
|
|
6
|
-
label?: string;
|
|
7
|
-
/** The button's content; a close icon at the dialog's top right when unset. */
|
|
8
|
-
children?: Snippet;
|
|
9
16
|
/** Other props of Ark's `Dialog.CloseTrigger`. */
|
|
10
17
|
[key: string]: unknown;
|
|
11
18
|
};
|
|
12
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* A button that closes the `Dialog` it is in: the children, or a close icon named by `label`, which
|
|
21
|
+
* is then also its tooltip.
|
|
22
|
+
*/
|
|
13
23
|
declare const DialogClose: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
14
24
|
type DialogClose = ReturnType<typeof DialogClose>;
|
|
15
25
|
export default DialogClose;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** What a dialog tells its close buttons. */
|
|
2
|
+
export interface DialogContext {
|
|
3
|
+
/** The id the dialog gives its close button (Ark's `ids.closeTrigger`). */
|
|
4
|
+
closeTriggerId: string;
|
|
5
|
+
}
|
|
6
|
+
/** Gives the close buttons inside the calling dialog its close button's id. */
|
|
7
|
+
export declare function setDialogContext(context: DialogContext): void;
|
|
8
|
+
/** The context of the dialog around the calling button, or `undefined` outside one of the kit's. */
|
|
9
|
+
export declare function dialogContext(): DialogContext | undefined;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The context a `Dialog` (or a `Sheet`, also an Ark dialog) gives the `DialogClose` buttons inside
|
|
3
|
+
* it: its close button's id, which Ark's dialog finds the button by (it focuses it first in an alert
|
|
4
|
+
* dialog), so an icon `DialogClose` gives its tooltip that same id.
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import { createContext } from 'svelte';
|
|
8
|
+
const [getContext, setContext, hasContext] = createContext();
|
|
9
|
+
/** Gives the close buttons inside the calling dialog its close button's id. */
|
|
10
|
+
export function setDialogContext(context) {
|
|
11
|
+
setContext(context);
|
|
12
|
+
}
|
|
13
|
+
/** The context of the dialog around the calling button, or `undefined` outside one of the kit's. */
|
|
14
|
+
export function dialogContext() {
|
|
15
|
+
return hasContext() ? getContext() : undefined;
|
|
16
|
+
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
3
|
A panel that slides in from the end edge of the window (Ark Drawer), with a title, content and
|
|
4
|
-
footer; `title` names it and `closeLabel` names its close button. It is swiped toward that edge to
|
|
4
|
+
footer; `title` names it and `closeLabel` names its close button and is its tooltip. It is swiped toward that edge to
|
|
5
5
|
dismiss it.
|
|
6
6
|
-->
|
|
7
7
|
<script lang="ts">
|
|
8
|
-
import type { Snippet } from 'svelte';
|
|
8
|
+
import type { ComponentProps, Snippet } from 'svelte';
|
|
9
9
|
import { Drawer, type DrawerOpenChangeDetails } from '@ark-ui/svelte';
|
|
10
10
|
import { Portal } from '@ark-ui/svelte/portal';
|
|
11
11
|
import { cn } from '../../utils.js';
|
|
12
|
+
import Tooltip from '../tooltip/Tooltip.svelte';
|
|
12
13
|
import MingcuteCloseLine from '~icons/mingcute/close-line';
|
|
13
14
|
|
|
14
15
|
let {
|
|
@@ -24,6 +25,7 @@ dismiss it.
|
|
|
24
25
|
class: className = '',
|
|
25
26
|
open = $bindable(),
|
|
26
27
|
onOpenChange,
|
|
28
|
+
ids: appIds,
|
|
27
29
|
...rest
|
|
28
30
|
}: {
|
|
29
31
|
/** The content of the button that opens the drawer; no trigger when unset. */
|
|
@@ -40,7 +42,7 @@ dismiss it.
|
|
|
40
42
|
footer?: Snippet;
|
|
41
43
|
/** Whether to show the close button at the top right. */
|
|
42
44
|
showClose?: boolean;
|
|
43
|
-
/** The close button's accessible name, such as "Close". */
|
|
45
|
+
/** The close button's accessible name and tooltip, such as "Close". */
|
|
44
46
|
closeLabel: string;
|
|
45
47
|
/** A translucent, blurred surface: for overlays above busy content only. */
|
|
46
48
|
frosted?: boolean;
|
|
@@ -50,12 +52,20 @@ dismiss it.
|
|
|
50
52
|
open?: boolean;
|
|
51
53
|
/** Called with the new state when the drawer opens or closes. */
|
|
52
54
|
onOpenChange?: (details: DrawerOpenChangeDetails) => void;
|
|
55
|
+
/** Ark's `ids`, merged with the ids the kit gives the buttons it adds a tooltip to, which win. */
|
|
56
|
+
ids?: ComponentProps<typeof Drawer.Root>['ids'];
|
|
53
57
|
/** Other props of Ark's `Drawer.Root`, such as `onExitComplete`. */
|
|
54
58
|
[key: string]: unknown;
|
|
55
59
|
} = $props();
|
|
60
|
+
|
|
61
|
+
// The close button's id, shared by Ark's dialog (which focuses it first in an alert dialog) and
|
|
62
|
+
// its tooltip, which both find it by id.
|
|
63
|
+
const uid = $props.id();
|
|
64
|
+
const closeTriggerId = `${uid}-close`;
|
|
56
65
|
</script>
|
|
57
66
|
|
|
58
67
|
<Drawer.Root
|
|
68
|
+
ids={{ ...appIds, closeTrigger: closeTriggerId }}
|
|
59
69
|
swipeDirection="end"
|
|
60
70
|
{open}
|
|
61
71
|
onOpenChange={(details) => {
|
|
@@ -83,13 +93,18 @@ dismiss it.
|
|
|
83
93
|
data-slot="drawer-content"
|
|
84
94
|
>
|
|
85
95
|
{#if showClose}
|
|
86
|
-
<
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
96
|
+
<Tooltip content={closeLabel} triggerId={closeTriggerId}>
|
|
97
|
+
{#snippet trigger(props)}
|
|
98
|
+
<Drawer.CloseTrigger
|
|
99
|
+
{...props}
|
|
100
|
+
class="absolute top-3.5 right-3.5 inline-flex size-7 items-center justify-center rounded-md text-muted transition-colors outline-none hover:bg-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-primary"
|
|
101
|
+
aria-label={closeLabel}
|
|
102
|
+
data-slot="drawer-close"
|
|
103
|
+
>
|
|
104
|
+
<MingcuteCloseLine class="size-4" aria-hidden="true" />
|
|
105
|
+
</Drawer.CloseTrigger>
|
|
106
|
+
{/snippet}
|
|
107
|
+
</Tooltip>
|
|
93
108
|
{/if}
|
|
94
109
|
<div class="flex flex-col space-y-1.5 p-6 pb-0" data-slot="drawer-header">
|
|
95
110
|
<Drawer.Title class="text-[1.0625rem] font-bold" data-slot="drawer-title">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte';
|
|
1
|
+
import type { ComponentProps, Snippet } from 'svelte';
|
|
2
2
|
import { Drawer, type DrawerOpenChangeDetails } from '@ark-ui/svelte';
|
|
3
3
|
type $$ComponentProps = {
|
|
4
4
|
/** The content of the button that opens the drawer; no trigger when unset. */
|
|
@@ -15,7 +15,7 @@ type $$ComponentProps = {
|
|
|
15
15
|
footer?: Snippet;
|
|
16
16
|
/** Whether to show the close button at the top right. */
|
|
17
17
|
showClose?: boolean;
|
|
18
|
-
/** The close button's accessible name, such as "Close". */
|
|
18
|
+
/** The close button's accessible name and tooltip, such as "Close". */
|
|
19
19
|
closeLabel: string;
|
|
20
20
|
/** A translucent, blurred surface: for overlays above busy content only. */
|
|
21
21
|
frosted?: boolean;
|
|
@@ -25,12 +25,14 @@ type $$ComponentProps = {
|
|
|
25
25
|
open?: boolean;
|
|
26
26
|
/** Called with the new state when the drawer opens or closes. */
|
|
27
27
|
onOpenChange?: (details: DrawerOpenChangeDetails) => void;
|
|
28
|
+
/** Ark's `ids`, merged with the ids the kit gives the buttons it adds a tooltip to, which win. */
|
|
29
|
+
ids?: ComponentProps<typeof Drawer.Root>['ids'];
|
|
28
30
|
/** Other props of Ark's `Drawer.Root`, such as `onExitComplete`. */
|
|
29
31
|
[key: string]: unknown;
|
|
30
32
|
};
|
|
31
33
|
/**
|
|
32
34
|
* A panel that slides in from the end edge of the window (Ark Drawer), with a title, content and
|
|
33
|
-
* footer; `title` names it and `closeLabel` names its close button. It is swiped toward that edge to
|
|
35
|
+
* footer; `title` names it and `closeLabel` names its close button and is its tooltip. It is swiped toward that edge to
|
|
34
36
|
* dismiss it.
|
|
35
37
|
*/
|
|
36
38
|
declare const Drawer: import("svelte").Component<$$ComponentProps, {}, "open">;
|