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,6 +1,7 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
|
-
One section of an `Accordion`: its trigger (text or snippet) and its collapsible content.
|
|
3
|
+
One section of an `Accordion`: its trigger (text or snippet) and its collapsible content. A
|
|
4
|
+
disabled section, or a section of a disabled accordion, has a faded trigger.
|
|
4
5
|
-->
|
|
5
6
|
<script lang="ts">
|
|
6
7
|
import type { Snippet } from 'svelte';
|
|
@@ -35,7 +36,7 @@ One section of an `Accordion`: its trigger (text or snippet) and its collapsible
|
|
|
35
36
|
{...rest}
|
|
36
37
|
>
|
|
37
38
|
<Accordion.ItemTrigger
|
|
38
|
-
class="flex w-full items-center justify-between py-4 text-left text-sm font-medium transition-all outline-none focus-visible:rounded-sm focus-visible:ring-2 focus-visible:ring-primary"
|
|
39
|
+
class="flex w-full items-center justify-between py-4 text-left text-sm font-medium transition-all outline-none focus-visible:rounded-sm focus-visible:ring-2 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50"
|
|
39
40
|
data-slot="accordion-trigger"
|
|
40
41
|
>
|
|
41
42
|
{#if typeof trigger === 'string'}
|
|
@@ -11,7 +11,10 @@ type $$ComponentProps = {
|
|
|
11
11
|
/** Other props of Ark's `Accordion.Item`, such as `disabled`. */
|
|
12
12
|
[key: string]: unknown;
|
|
13
13
|
};
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* One section of an `Accordion`: its trigger (text or snippet) and its collapsible content. A
|
|
16
|
+
* disabled section, or a section of a disabled accordion, has a faded trigger.
|
|
17
|
+
*/
|
|
15
18
|
declare const AccordionItem: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
16
19
|
type AccordionItem = ReturnType<typeof AccordionItem>;
|
|
17
20
|
export default AccordionItem;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
A circular control that picks an angle in degrees (Ark AngleSlider), from 0 to 359, with 0 at the
|
|
4
4
|
top and angles growing clockwise, and the angle written under it as `valueText` formats it.
|
|
5
5
|
`label` is its accessible name and `valueText` its spoken value; the arrow keys turn it by `step`.
|
|
6
|
+
Disabled, it is faded; invalid, its ring is the danger colour.
|
|
6
7
|
-->
|
|
7
8
|
<script lang="ts">
|
|
8
9
|
import type { Snippet } from 'svelte';
|
|
@@ -39,13 +40,16 @@ top and angles growing clockwise, and the angle written under it as `valueText`
|
|
|
39
40
|
onValueChange?: (details: { value: number }) => void;
|
|
40
41
|
/** Content under the angle, such as presets. */
|
|
41
42
|
children?: Snippet;
|
|
42
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Other props of Ark's `AngleSlider.Root`, such as `defaultValue`, `disabled`, `readOnly` and
|
|
45
|
+
* `invalid`.
|
|
46
|
+
*/
|
|
43
47
|
[key: string]: unknown;
|
|
44
48
|
} = $props();
|
|
45
49
|
</script>
|
|
46
50
|
|
|
47
51
|
<AngleSlider.Root
|
|
48
|
-
class={cn('flex flex-col items-center gap-3', className)}
|
|
52
|
+
class={cn('flex flex-col items-center gap-3 data-disabled:opacity-50', className)}
|
|
49
53
|
data-slot="angle-slider"
|
|
50
54
|
{step}
|
|
51
55
|
{value}
|
|
@@ -60,12 +64,12 @@ top and angles growing clockwise, and the angle written under it as `valueText`
|
|
|
60
64
|
{#snippet render(slider)}
|
|
61
65
|
{@const text = valueText(slider().value)}
|
|
62
66
|
<AngleSlider.Control
|
|
63
|
-
class="relative rounded-full border-2 border-border bg-hover"
|
|
67
|
+
class="relative rounded-full border-2 border-border bg-hover data-invalid:border-danger"
|
|
64
68
|
style="width: {size}px; height: {size}px;"
|
|
65
69
|
>
|
|
66
70
|
<!-- Zag announces a maximum of 360, but clamps the angle to 359. -->
|
|
67
71
|
<AngleSlider.Thumb
|
|
68
|
-
class="absolute inset-0 cursor-grab rounded-full active:cursor-grabbing"
|
|
72
|
+
class="absolute inset-0 cursor-grab rounded-full active:cursor-grabbing data-disabled:cursor-not-allowed data-readonly:cursor-default"
|
|
69
73
|
aria-valuemax={359}
|
|
70
74
|
aria-valuetext={text}
|
|
71
75
|
>
|
|
@@ -22,13 +22,17 @@ type $$ComponentProps = {
|
|
|
22
22
|
}) => void;
|
|
23
23
|
/** Content under the angle, such as presets. */
|
|
24
24
|
children?: Snippet;
|
|
25
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Other props of Ark's `AngleSlider.Root`, such as `defaultValue`, `disabled`, `readOnly` and
|
|
27
|
+
* `invalid`.
|
|
28
|
+
*/
|
|
26
29
|
[key: string]: unknown;
|
|
27
30
|
};
|
|
28
31
|
/**
|
|
29
32
|
* A circular control that picks an angle in degrees (Ark AngleSlider), from 0 to 359, with 0 at the
|
|
30
33
|
* top and angles growing clockwise, and the angle written under it as `valueText` formats it.
|
|
31
34
|
* `label` is its accessible name and `valueText` its spoken value; the arrow keys turn it by `step`.
|
|
35
|
+
* Disabled, it is faded; invalid, its ring is the danger colour.
|
|
32
36
|
*/
|
|
33
37
|
declare const AngleSlider: import("svelte").Component<$$ComponentProps, {}, "value">;
|
|
34
38
|
type AngleSlider = ReturnType<typeof AngleSlider>;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
3
|
An asset in a list (a store listing, an entry of My assets or of a game's assets): its square
|
|
4
|
-
thumbnail, its name
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
thumbnail, its name, its kind, a `meta` line (votes, the rig profile) and `actions` (Add to my
|
|
5
|
+
assets). Without a thumbnail, `placeholder` (an icon of the kind) is drawn on a neutral fill.
|
|
6
|
+
|
|
7
|
+
It is interactive only when given something to do: with `href`, its name is a link; with `onclick`,
|
|
8
|
+
a button; with `selectable` too, a toggle whose pressed state is `selected`, for pickers. The link
|
|
9
|
+
or button then covers the whole card (pointer cursor, hover fill, focus ring, Enter, and Space for
|
|
10
|
+
a button), and the actions stay their own buttons. With none of them, it is a plain display.
|
|
7
11
|
-->
|
|
8
12
|
<script lang="ts">
|
|
9
13
|
import type { Snippet } from 'svelte';
|
|
@@ -19,6 +23,7 @@ buttons. Without a thumbnail, `placeholder` (an icon of the kind) is drawn on a
|
|
|
19
23
|
placeholder,
|
|
20
24
|
meta,
|
|
21
25
|
actions,
|
|
26
|
+
selectable = false,
|
|
22
27
|
selected = false,
|
|
23
28
|
class: className = ''
|
|
24
29
|
}: {
|
|
@@ -28,7 +33,7 @@ buttons. Without a thumbnail, `placeholder` (an icon of the kind) is drawn on a
|
|
|
28
33
|
kind: string;
|
|
29
34
|
/** Where the card leads. */
|
|
30
35
|
href?: string;
|
|
31
|
-
/** Called when the card is
|
|
36
|
+
/** Called when the card is pressed, when it has no `href`. */
|
|
32
37
|
onclick?: () => void;
|
|
33
38
|
/** The square thumbnail's URL. */
|
|
34
39
|
thumbnail?: string;
|
|
@@ -38,23 +43,29 @@ buttons. Without a thumbnail, `placeholder` (an icon of the kind) is drawn on a
|
|
|
38
43
|
meta?: Snippet;
|
|
39
44
|
/** Buttons of the card, such as Add to my assets. */
|
|
40
45
|
actions?: Snippet;
|
|
41
|
-
/**
|
|
46
|
+
/** Makes the card a toggle, pressed while `selected`, for a picker; it needs `onclick`. */
|
|
47
|
+
selectable?: boolean;
|
|
48
|
+
/** Whether a `selectable` card is the chosen one. */
|
|
42
49
|
selected?: boolean;
|
|
43
50
|
/** Classes merged onto the card. */
|
|
44
51
|
class?: string;
|
|
45
52
|
} = $props();
|
|
46
53
|
|
|
47
54
|
const stretched =
|
|
48
|
-
'outline-none after:absolute after:inset-0 after:z-1 after:rounded-lg focus-visible:after:ring-2 focus-visible:after:ring-primary';
|
|
55
|
+
'cursor-pointer outline-none after:absolute after:inset-0 after:z-1 after:rounded-lg focus-visible:after:ring-2 focus-visible:after:ring-primary';
|
|
56
|
+
const interactive = $derived(Boolean(href || onclick));
|
|
57
|
+
const chosen = $derived(selectable && selected);
|
|
49
58
|
</script>
|
|
50
59
|
|
|
51
60
|
<div
|
|
52
61
|
class={cn(
|
|
53
|
-
'group relative grid min-w-0 content-start gap-2 rounded-lg border border-border bg-surface p-2 transition-colors
|
|
54
|
-
|
|
62
|
+
'group relative grid min-w-0 content-start gap-2 rounded-lg border border-border bg-surface p-2 transition-colors',
|
|
63
|
+
interactive && 'hover:bg-hover',
|
|
64
|
+
chosen && 'border-primary ring-3 ring-primary/20',
|
|
55
65
|
className
|
|
56
66
|
)}
|
|
57
67
|
data-slot="asset-card"
|
|
68
|
+
data-interactive={interactive || undefined}
|
|
58
69
|
>
|
|
59
70
|
<div
|
|
60
71
|
class="relative grid aspect-square place-items-center overflow-hidden rounded-md bg-sunken text-faint [&_svg]:size-8"
|
|
@@ -69,15 +80,17 @@ buttons. Without a thumbnail, `placeholder` (an icon of the kind) is drawn on a
|
|
|
69
80
|
{#if href}
|
|
70
81
|
<!-- eslint-disable-next-line svelte/no-navigation-without-resolve -- the app passes an href it has already resolved -->
|
|
71
82
|
<a {href} class={cn(stretched, 'truncate text-sm font-semibold text-fg')}>{name}</a>
|
|
72
|
-
{:else}
|
|
83
|
+
{:else if onclick}
|
|
73
84
|
<button
|
|
74
85
|
type="button"
|
|
75
86
|
class={cn(stretched, 'truncate text-left text-sm font-semibold text-fg')}
|
|
76
|
-
aria-pressed={
|
|
87
|
+
aria-pressed={selectable ? selected : undefined}
|
|
77
88
|
{onclick}
|
|
78
89
|
>
|
|
79
90
|
{name}
|
|
80
91
|
</button>
|
|
92
|
+
{:else}
|
|
93
|
+
<span class="truncate text-sm font-semibold text-fg">{name}</span>
|
|
81
94
|
{/if}
|
|
82
95
|
<div class="flex min-w-0 items-center gap-1.5 text-xs text-muted">
|
|
83
96
|
<Badge size="sm">{kind}</Badge>
|
|
@@ -6,7 +6,7 @@ type $$ComponentProps = {
|
|
|
6
6
|
kind: string;
|
|
7
7
|
/** Where the card leads. */
|
|
8
8
|
href?: string;
|
|
9
|
-
/** Called when the card is
|
|
9
|
+
/** Called when the card is pressed, when it has no `href`. */
|
|
10
10
|
onclick?: () => void;
|
|
11
11
|
/** The square thumbnail's URL. */
|
|
12
12
|
thumbnail?: string;
|
|
@@ -16,16 +16,22 @@ type $$ComponentProps = {
|
|
|
16
16
|
meta?: Snippet;
|
|
17
17
|
/** Buttons of the card, such as Add to my assets. */
|
|
18
18
|
actions?: Snippet;
|
|
19
|
-
/**
|
|
19
|
+
/** Makes the card a toggle, pressed while `selected`, for a picker; it needs `onclick`. */
|
|
20
|
+
selectable?: boolean;
|
|
21
|
+
/** Whether a `selectable` card is the chosen one. */
|
|
20
22
|
selected?: boolean;
|
|
21
23
|
/** Classes merged onto the card. */
|
|
22
24
|
class?: string;
|
|
23
25
|
};
|
|
24
26
|
/**
|
|
25
27
|
* An asset in a list (a store listing, an entry of My assets or of a game's assets): its square
|
|
26
|
-
* thumbnail, its name
|
|
27
|
-
*
|
|
28
|
-
*
|
|
28
|
+
* thumbnail, its name, its kind, a `meta` line (votes, the rig profile) and `actions` (Add to my
|
|
29
|
+
* assets). Without a thumbnail, `placeholder` (an icon of the kind) is drawn on a neutral fill.
|
|
30
|
+
*
|
|
31
|
+
* It is interactive only when given something to do: with `href`, its name is a link; with `onclick`,
|
|
32
|
+
* a button; with `selectable` too, a toggle whose pressed state is `selected`, for pickers. The link
|
|
33
|
+
* or button then covers the whole card (pointer cursor, hover fill, focus ring, Enter, and Space for
|
|
34
|
+
* a button), and the actions stay their own buttons. With none of them, it is a plain display.
|
|
29
35
|
*/
|
|
30
36
|
declare const AssetCard: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
31
37
|
type AssetCard = ReturnType<typeof AssetCard>;
|
|
@@ -4,7 +4,7 @@ A person's avatar: their image, or their initials on a coloured disc while it lo
|
|
|
4
4
|
is none. With `alt` (the person's name) it is one image of that name for assistive technology;
|
|
5
5
|
without, it is decorative, for when the name is written next to it. The disc's colour is one of
|
|
6
6
|
five avatar tones: `tone`, or one picked from the initials so the same person always gets the
|
|
7
|
-
same colour.
|
|
7
|
+
same colour. It has the same size with or without an image, at every `size`.
|
|
8
8
|
-->
|
|
9
9
|
<script lang="ts">
|
|
10
10
|
import { Avatar } from '@ark-ui/svelte';
|
|
@@ -62,7 +62,13 @@ same colour.
|
|
|
62
62
|
{...rest}
|
|
63
63
|
>
|
|
64
64
|
{#if src}
|
|
65
|
-
|
|
65
|
+
<!-- Laid over the disc, so an image of any intrinsic size never changes the avatar's size. -->
|
|
66
|
+
<Avatar.Image
|
|
67
|
+
{src}
|
|
68
|
+
alt=""
|
|
69
|
+
class="absolute inset-0 size-full object-cover"
|
|
70
|
+
data-slot="avatar-image"
|
|
71
|
+
/>
|
|
66
72
|
{/if}
|
|
67
73
|
<Avatar.Fallback
|
|
68
74
|
class={cn(
|
|
@@ -5,7 +5,7 @@ import { type AvatarTone } from './tone';
|
|
|
5
5
|
* is none. With `alt` (the person's name) it is one image of that name for assistive technology;
|
|
6
6
|
* without, it is decorative, for when the name is written next to it. The disc's colour is one of
|
|
7
7
|
* five avatar tones: `tone`, or one picked from the initials so the same person always gets the
|
|
8
|
-
* same colour.
|
|
8
|
+
* same colour. It has the same size with or without an image, at every `size`.
|
|
9
9
|
*/
|
|
10
10
|
declare const Avatar: import("svelte").Component<{
|
|
11
11
|
[key: string]: unknown;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
3
|
A button. `variant` sets its look (default, primary for the one main action, tint, ghost, danger,
|
|
4
|
-
danger-solid, link) and `size` its height (xs 22 px to lg 40 px; `icon-*` for square icon-only
|
|
4
|
+
danger-solid, art over game art, link) and `size` its height (xs 22 px to lg 40 px; `icon-*` for square icon-only
|
|
5
5
|
buttons, which need an `aria-label`). `loading` shows a spinner, disables it and sets
|
|
6
6
|
`aria-busy`.
|
|
7
7
|
-->
|
|
@@ -23,7 +23,7 @@ type $$ComponentProps = {
|
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
25
25
|
* A button. `variant` sets its look (default, primary for the one main action, tint, ghost, danger,
|
|
26
|
-
* danger-solid, link) and `size` its height (xs 22 px to lg 40 px; `icon-*` for square icon-only
|
|
26
|
+
* danger-solid, art over game art, link) and `size` its height (xs 22 px to lg 40 px; `icon-*` for square icon-only
|
|
27
27
|
* buttons, which need an `aria-label`). `loading` shows a spinner, disables it and sets
|
|
28
28
|
* `aria-busy`.
|
|
29
29
|
*/
|
|
@@ -17,6 +17,8 @@ declare const variants: {
|
|
|
17
17
|
readonly danger: "bg-danger-subtle border-danger-border text-danger hover:bg-danger/20";
|
|
18
18
|
/** The confirming action of a destructive dialog. */
|
|
19
19
|
readonly 'danger-solid': "bg-danger border-danger text-on-danger font-semibold hover:opacity-90";
|
|
20
|
+
/** An action over game art, such as a game page's Back: a dark translucent pill in both themes. */
|
|
21
|
+
readonly art: "bg-art-scrim border-transparent text-on-art hover:bg-art-scrim-hover";
|
|
20
22
|
/** Text that acts like a link. */
|
|
21
23
|
readonly link: "border-transparent text-primary underline-offset-4 hover:underline";
|
|
22
24
|
};
|
|
@@ -13,6 +13,8 @@ const variants = {
|
|
|
13
13
|
danger: 'bg-danger-subtle border-danger-border text-danger hover:bg-danger/20',
|
|
14
14
|
/** The confirming action of a destructive dialog. */
|
|
15
15
|
'danger-solid': 'bg-danger border-danger text-on-danger font-semibold hover:opacity-90',
|
|
16
|
+
/** An action over game art, such as a game page's Back: a dark translucent pill in both themes. */
|
|
17
|
+
art: 'bg-art-scrim border-transparent text-on-art hover:bg-art-scrim-hover',
|
|
16
18
|
/** Text that acts like a link. */
|
|
17
19
|
link: 'border-transparent text-primary underline-offset-4 hover:underline'
|
|
18
20
|
};
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
@component
|
|
3
3
|
A month calendar to pick a date or a range, inline (Ark DatePicker without its field);
|
|
4
|
-
`translations`, required, name its controls
|
|
5
|
-
as.
|
|
4
|
+
`translations`, required, name its controls (the previous and next buttons show their name in a
|
|
5
|
+
tooltip too) and give the role the table of each view is announced as. The day view always shows
|
|
6
|
+
six weeks, and the month and year views take exactly its size, so the calendar never changes size
|
|
7
|
+
as the user moves between them. Its size follows `--cell-size` (36 px by default), which the app
|
|
8
|
+
can set through `class`, such as `[--cell-size:--spacing(8)]`.
|
|
6
9
|
-->
|
|
7
10
|
<script lang="ts">
|
|
11
|
+
import type { ComponentProps } from 'svelte';
|
|
8
12
|
import { DatePicker, type DatePickerRootProps } from '@ark-ui/svelte';
|
|
9
13
|
import type { DatePickerDateView } from '@ark-ui/svelte/date-picker';
|
|
10
14
|
import { cn } from '../../utils.js';
|
|
11
|
-
import
|
|
12
|
-
import
|
|
15
|
+
import CalendarViews from './CalendarViews.svelte';
|
|
16
|
+
import { calendarTriggerIds } from './trigger-ids';
|
|
13
17
|
|
|
14
18
|
let {
|
|
15
19
|
class: className = '',
|
|
16
20
|
translations,
|
|
21
|
+
ids: appIds,
|
|
17
22
|
...rest
|
|
18
23
|
}: {
|
|
19
24
|
/** Classes merged onto the calendar. */
|
|
@@ -30,6 +35,8 @@ as.
|
|
|
30
35
|
'dayCell' | 'prevTrigger' | 'nextTrigger' | 'viewTrigger'
|
|
31
36
|
>
|
|
32
37
|
> & { tableRoleDescription: (view: DatePickerDateView) => string };
|
|
38
|
+
/** Ark's `ids`, merged with the ids the kit gives the buttons it adds a tooltip to, which win. */
|
|
39
|
+
ids?: ComponentProps<typeof DatePicker.Root>['ids'];
|
|
33
40
|
/**
|
|
34
41
|
* Other props of Ark's `DatePicker.Root`: `value` and `onValueChange`, `selectionMode`
|
|
35
42
|
* (`single`, `multiple` or `range`), `locale`.
|
|
@@ -38,175 +45,23 @@ as.
|
|
|
38
45
|
} = $props();
|
|
39
46
|
|
|
40
47
|
const { tableRoleDescription, ...arkTranslations } = $derived(translations);
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
'inline-flex items-center justify-center',
|
|
44
|
-
'h-9 w-full min-w-9',
|
|
45
|
-
'whitespace-nowrap font-normal text-sm text-fg leading-none',
|
|
46
|
-
'rounded-lg border border-transparent',
|
|
47
|
-
'hover:bg-hover hover:text-fg',
|
|
48
|
-
'data-today:after:absolute data-today:after:bottom-1 data-today:after:left-1/2 data-today:after:size-1 data-today:after:-translate-x-1/2 data-today:after:rounded-full data-today:after:bg-primary data-today:data-selected:after:bg-background',
|
|
49
|
-
'outline-none focus-visible:border-primary focus-visible:ring-[3px] focus-visible:ring-primary/30',
|
|
50
|
-
'data-disabled:pointer-events-none data-disabled:opacity-64',
|
|
51
|
-
'data-unavailable:pointer-events-none data-unavailable:line-through data-unavailable:opacity-64',
|
|
52
|
-
'data-selected:bg-primary! data-selected:text-on-primary!'
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
const navBtnClass = cn(
|
|
56
|
-
'inline-flex items-center justify-center size-8 rounded-lg border border-border',
|
|
57
|
-
'bg-transparent hover:bg-hover hover:text-fg',
|
|
58
|
-
'disabled:opacity-40 transition-colors'
|
|
59
|
-
);
|
|
48
|
+
const uid = $props.id();
|
|
49
|
+
const ids = calendarTriggerIds(uid);
|
|
60
50
|
</script>
|
|
61
51
|
|
|
62
52
|
<DatePicker.Root
|
|
63
|
-
class={cn('[--cell-size:--spacing(9)]',
|
|
53
|
+
class={cn('w-fit [--cell-size:--spacing(9)]', className)}
|
|
64
54
|
data-slot="calendar"
|
|
65
55
|
inline
|
|
56
|
+
fixedWeeks
|
|
57
|
+
ids={{ ...appIds, ...ids }}
|
|
66
58
|
translations={arkTranslations}
|
|
67
59
|
{...rest}
|
|
68
60
|
>
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
<MingcuteLeftLine class="size-4" aria-hidden="true" />
|
|
76
|
-
</DatePicker.PrevTrigger>
|
|
77
|
-
<DatePicker.ViewTrigger
|
|
78
|
-
class="h-8 flex-1 rounded-lg px-2 text-sm font-medium transition-colors hover:bg-hover hover:text-fg"
|
|
79
|
-
data-slot="calendar-view-trigger"
|
|
80
|
-
>
|
|
81
|
-
<DatePicker.RangeText data-slot="calendar-range-text" />
|
|
82
|
-
</DatePicker.ViewTrigger>
|
|
83
|
-
<DatePicker.NextTrigger class={navBtnClass} data-slot="calendar-next-trigger">
|
|
84
|
-
<MingcuteRightLine class="size-4" aria-hidden="true" />
|
|
85
|
-
</DatePicker.NextTrigger>
|
|
86
|
-
</DatePicker.ViewControl>
|
|
87
|
-
<DatePicker.Context>
|
|
88
|
-
{#snippet render(api)}
|
|
89
|
-
<DatePicker.Table
|
|
90
|
-
class="group w-full min-w-60 border-collapse"
|
|
91
|
-
aria-roledescription={tableRoleDescription('day')}
|
|
92
|
-
data-slot="calendar-table"
|
|
93
|
-
>
|
|
94
|
-
<DatePicker.TableHead data-slot="calendar-table-head">
|
|
95
|
-
<DatePicker.TableRow class="mt-1 flex w-full" data-slot="calendar-table-row">
|
|
96
|
-
{#each api().weekDays as weekDay (weekDay.long)}
|
|
97
|
-
<DatePicker.TableHeader
|
|
98
|
-
class="flex h-(--cell-size) w-full items-center justify-center rounded-lg text-xs font-medium text-faint"
|
|
99
|
-
data-slot="calendar-table-header"
|
|
100
|
-
>
|
|
101
|
-
{weekDay.narrow}
|
|
102
|
-
</DatePicker.TableHeader>
|
|
103
|
-
{/each}
|
|
104
|
-
</DatePicker.TableRow>
|
|
105
|
-
</DatePicker.TableHead>
|
|
106
|
-
<DatePicker.TableBody data-slot="calendar-table-body">
|
|
107
|
-
{#each api().weeks as week (week[0].toString())}
|
|
108
|
-
<DatePicker.TableRow class="mt-1 flex w-full" data-slot="calendar-table-row">
|
|
109
|
-
{#each week as day (day.toString())}
|
|
110
|
-
<DatePicker.TableCell
|
|
111
|
-
class="relative h-(--cell-size) w-full text-center [&:first-child[aria-selected=true]_div]:rounded-l-lg [&:last-child[aria-selected=true]_div]:rounded-r-lg"
|
|
112
|
-
data-slot="calendar-table-cell"
|
|
113
|
-
value={day}
|
|
114
|
-
>
|
|
115
|
-
<DatePicker.TableCellTrigger
|
|
116
|
-
class={cellClass}
|
|
117
|
-
data-slot="calendar-table-cell-trigger"
|
|
118
|
-
>
|
|
119
|
-
{day.day}
|
|
120
|
-
</DatePicker.TableCellTrigger>
|
|
121
|
-
</DatePicker.TableCell>
|
|
122
|
-
{/each}
|
|
123
|
-
</DatePicker.TableRow>
|
|
124
|
-
{/each}
|
|
125
|
-
</DatePicker.TableBody>
|
|
126
|
-
</DatePicker.Table>
|
|
127
|
-
{/snippet}
|
|
128
|
-
</DatePicker.Context>
|
|
129
|
-
</DatePicker.View>
|
|
130
|
-
|
|
131
|
-
<DatePicker.View view="month" class="flex flex-col gap-1" data-slot="calendar-month-view">
|
|
132
|
-
<DatePicker.ViewControl class="relative flex h-auto w-full items-center gap-1.5">
|
|
133
|
-
<DatePicker.PrevTrigger class={navBtnClass}>
|
|
134
|
-
<MingcuteLeftLine class="size-4" aria-hidden="true" />
|
|
135
|
-
</DatePicker.PrevTrigger>
|
|
136
|
-
<DatePicker.ViewTrigger
|
|
137
|
-
class="h-8 flex-1 rounded-lg px-2 text-sm font-medium transition-colors hover:bg-hover hover:text-fg"
|
|
138
|
-
>
|
|
139
|
-
<DatePicker.RangeText />
|
|
140
|
-
</DatePicker.ViewTrigger>
|
|
141
|
-
<DatePicker.NextTrigger class={navBtnClass}>
|
|
142
|
-
<MingcuteRightLine class="size-4" aria-hidden="true" />
|
|
143
|
-
</DatePicker.NextTrigger>
|
|
144
|
-
</DatePicker.ViewControl>
|
|
145
|
-
<DatePicker.Context>
|
|
146
|
-
{#snippet render(api)}
|
|
147
|
-
<DatePicker.Table
|
|
148
|
-
class="group w-full min-w-60 border-collapse"
|
|
149
|
-
aria-roledescription={tableRoleDescription('month')}
|
|
150
|
-
>
|
|
151
|
-
<DatePicker.TableBody>
|
|
152
|
-
{#each api().getMonthsGrid() as months (months[0].value)}
|
|
153
|
-
<DatePicker.TableRow class="mt-1 flex w-full">
|
|
154
|
-
{#each months as month (month.value)}
|
|
155
|
-
<DatePicker.TableCell
|
|
156
|
-
class="relative h-(--cell-size) w-full text-center"
|
|
157
|
-
value={month.value}
|
|
158
|
-
>
|
|
159
|
-
<DatePicker.TableCellTrigger class={cn(cellClass, 'w-16')}>
|
|
160
|
-
{month.label}
|
|
161
|
-
</DatePicker.TableCellTrigger>
|
|
162
|
-
</DatePicker.TableCell>
|
|
163
|
-
{/each}
|
|
164
|
-
</DatePicker.TableRow>
|
|
165
|
-
{/each}
|
|
166
|
-
</DatePicker.TableBody>
|
|
167
|
-
</DatePicker.Table>
|
|
168
|
-
{/snippet}
|
|
169
|
-
</DatePicker.Context>
|
|
170
|
-
</DatePicker.View>
|
|
171
|
-
|
|
172
|
-
<DatePicker.View view="year" class="flex flex-col gap-1" data-slot="calendar-year-view">
|
|
173
|
-
<DatePicker.ViewControl class="relative flex h-auto w-full items-center gap-1.5">
|
|
174
|
-
<DatePicker.PrevTrigger class={navBtnClass}>
|
|
175
|
-
<MingcuteLeftLine class="size-4" aria-hidden="true" />
|
|
176
|
-
</DatePicker.PrevTrigger>
|
|
177
|
-
<DatePicker.ViewTrigger
|
|
178
|
-
class="h-8 flex-1 rounded-lg px-2 text-sm font-medium transition-colors hover:bg-hover hover:text-fg"
|
|
179
|
-
>
|
|
180
|
-
<DatePicker.RangeText />
|
|
181
|
-
</DatePicker.ViewTrigger>
|
|
182
|
-
<DatePicker.NextTrigger class={navBtnClass}>
|
|
183
|
-
<MingcuteRightLine class="size-4" aria-hidden="true" />
|
|
184
|
-
</DatePicker.NextTrigger>
|
|
185
|
-
</DatePicker.ViewControl>
|
|
186
|
-
<DatePicker.Context>
|
|
187
|
-
{#snippet render(api)}
|
|
188
|
-
<DatePicker.Table
|
|
189
|
-
class="group w-full min-w-60 border-collapse"
|
|
190
|
-
aria-roledescription={tableRoleDescription('year')}
|
|
191
|
-
>
|
|
192
|
-
<DatePicker.TableBody>
|
|
193
|
-
{#each api().getYearsGrid() as years (years[0].value)}
|
|
194
|
-
<DatePicker.TableRow class="mt-1 flex w-full">
|
|
195
|
-
{#each years as year (year.value)}
|
|
196
|
-
<DatePicker.TableCell
|
|
197
|
-
class="relative h-(--cell-size) w-full text-center"
|
|
198
|
-
value={year.value}
|
|
199
|
-
>
|
|
200
|
-
<DatePicker.TableCellTrigger class={cn(cellClass, 'w-16')}>
|
|
201
|
-
{year.label}
|
|
202
|
-
</DatePicker.TableCellTrigger>
|
|
203
|
-
</DatePicker.TableCell>
|
|
204
|
-
{/each}
|
|
205
|
-
</DatePicker.TableRow>
|
|
206
|
-
{/each}
|
|
207
|
-
</DatePicker.TableBody>
|
|
208
|
-
</DatePicker.Table>
|
|
209
|
-
{/snippet}
|
|
210
|
-
</DatePicker.Context>
|
|
211
|
-
</DatePicker.View>
|
|
61
|
+
<CalendarViews
|
|
62
|
+
{ids}
|
|
63
|
+
translations={arkTranslations}
|
|
64
|
+
{tableRoleDescription}
|
|
65
|
+
maxView={rest.maxView as DatePickerDateView | undefined}
|
|
66
|
+
/>
|
|
212
67
|
</DatePicker.Root>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ComponentProps } from 'svelte';
|
|
2
|
+
import { DatePicker, type DatePickerRootProps } from '@ark-ui/svelte';
|
|
2
3
|
import type { DatePickerDateView } from '@ark-ui/svelte/date-picker';
|
|
3
4
|
type $$ComponentProps = {
|
|
4
5
|
/** Classes merged onto the calendar. */
|
|
@@ -12,6 +13,8 @@ type $$ComponentProps = {
|
|
|
12
13
|
translations: Required<Pick<NonNullable<DatePickerRootProps['translations']>, 'dayCell' | 'prevTrigger' | 'nextTrigger' | 'viewTrigger'>> & {
|
|
13
14
|
tableRoleDescription: (view: DatePickerDateView) => string;
|
|
14
15
|
};
|
|
16
|
+
/** Ark's `ids`, merged with the ids the kit gives the buttons it adds a tooltip to, which win. */
|
|
17
|
+
ids?: ComponentProps<typeof DatePicker.Root>['ids'];
|
|
15
18
|
/**
|
|
16
19
|
* Other props of Ark's `DatePicker.Root`: `value` and `onValueChange`, `selectionMode`
|
|
17
20
|
* (`single`, `multiple` or `range`), `locale`.
|
|
@@ -20,8 +23,11 @@ type $$ComponentProps = {
|
|
|
20
23
|
};
|
|
21
24
|
/**
|
|
22
25
|
* A month calendar to pick a date or a range, inline (Ark DatePicker without its field);
|
|
23
|
-
* `translations`, required, name its controls
|
|
24
|
-
* as.
|
|
26
|
+
* `translations`, required, name its controls (the previous and next buttons show their name in a
|
|
27
|
+
* tooltip too) and give the role the table of each view is announced as. The day view always shows
|
|
28
|
+
* six weeks, and the month and year views take exactly its size, so the calendar never changes size
|
|
29
|
+
* as the user moves between them. Its size follows `--cell-size` (36 px by default), which the app
|
|
30
|
+
* can set through `class`, such as `[--cell-size:--spacing(8)]`.
|
|
25
31
|
*/
|
|
26
32
|
declare const Calendar: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
27
33
|
type Calendar = ReturnType<typeof Calendar>;
|