@canonical/svelte-ds-app-launchpad 0.25.0 → 0.26.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/dist/components/SidePanel/SidePanel.svelte +34 -0
- package/dist/components/SidePanel/SidePanel.svelte.d.ts +13 -0
- package/dist/components/SidePanel/index.d.ts +72 -0
- package/dist/components/SidePanel/index.js +7 -0
- package/dist/components/SidePanel/styles.css +37 -0
- package/dist/components/SidePanel/types.d.ts +3 -0
- package/dist/components/SidePanel/types.js +2 -0
- package/dist/components/Table/Table.svelte +52 -0
- package/dist/components/Table/Table.svelte.d.ts +41 -0
- package/dist/components/Table/common/TH/TH.svelte +40 -0
- package/dist/components/Table/common/TH/TH.svelte.d.ts +5 -0
- package/dist/components/Table/common/TH/common/SortButton/SortButton.svelte +36 -0
- package/dist/components/Table/common/TH/common/SortButton/SortButton.svelte.d.ts +5 -0
- package/dist/components/Table/common/TH/common/SortButton/index.d.ts +2 -0
- package/dist/components/Table/common/TH/common/SortButton/index.js +3 -0
- package/dist/components/Table/common/TH/common/SortButton/styles.css +19 -0
- package/dist/components/Table/common/TH/common/SortButton/types.d.ts +10 -0
- package/dist/components/Table/common/TH/common/SortButton/types.js +2 -0
- package/dist/components/Table/common/TH/common/index.d.ts +1 -0
- package/dist/components/Table/common/TH/common/index.js +1 -0
- package/dist/components/Table/common/TH/context.d.ts +2 -0
- package/dist/components/Table/common/TH/context.js +2 -0
- package/dist/components/Table/common/TH/index.d.ts +10 -0
- package/dist/components/Table/common/TH/index.js +7 -0
- package/dist/components/Table/common/TH/styles.css +22 -0
- package/dist/components/Table/common/TH/types.d.ts +21 -0
- package/dist/components/Table/common/TH/types.js +2 -0
- package/dist/components/Table/common/index.d.ts +1 -0
- package/dist/components/Table/common/index.js +1 -0
- package/dist/components/Table/index.d.ts +21 -0
- package/dist/components/Table/index.js +6 -0
- package/dist/components/Table/styles.css +46 -0
- package/dist/components/Table/types.d.ts +2 -0
- package/dist/components/Table/types.js +2 -0
- package/dist/components/Timeline/Timeline.svelte +51 -0
- package/dist/components/Timeline/Timeline.svelte.d.ts +40 -0
- package/dist/components/Timeline/common/Event/Event.svelte +54 -0
- package/dist/components/Timeline/common/Event/Event.svelte.d.ts +5 -0
- package/dist/components/Timeline/common/Event/common/TitleRow/TitleRow.svelte +32 -0
- package/dist/components/Timeline/common/Event/common/TitleRow/TitleRow.svelte.d.ts +5 -0
- package/dist/components/Timeline/common/Event/common/TitleRow/index.d.ts +2 -0
- package/dist/components/Timeline/common/Event/common/TitleRow/index.js +3 -0
- package/dist/components/Timeline/common/Event/common/TitleRow/styles.css +38 -0
- package/dist/components/Timeline/common/Event/common/TitleRow/types.d.ts +18 -0
- package/dist/components/Timeline/common/Event/common/TitleRow/types.js +2 -0
- package/dist/components/Timeline/common/Event/common/index.d.ts +1 -0
- package/dist/components/Timeline/common/Event/common/index.js +1 -0
- package/dist/components/Timeline/common/Event/index.d.ts +20 -0
- package/dist/components/Timeline/common/Event/index.js +7 -0
- package/dist/components/Timeline/common/Event/styles.css +115 -0
- package/dist/components/Timeline/common/Event/types.d.ts +25 -0
- package/dist/components/Timeline/common/Event/types.js +2 -0
- package/dist/components/Timeline/common/HiddenEvents/HiddenEvents.svelte +24 -0
- package/dist/components/Timeline/common/HiddenEvents/HiddenEvents.svelte.d.ts +5 -0
- package/dist/components/Timeline/common/HiddenEvents/common/Link/Link.svelte +15 -0
- package/dist/components/Timeline/common/HiddenEvents/common/Link/Link.svelte.d.ts +6 -0
- package/dist/components/Timeline/common/HiddenEvents/common/Link/index.d.ts +2 -0
- package/dist/components/Timeline/common/HiddenEvents/common/Link/index.js +3 -0
- package/dist/components/Timeline/common/HiddenEvents/common/Link/styles.css +9 -0
- package/dist/components/Timeline/common/HiddenEvents/common/Link/types.d.ts +2 -0
- package/dist/components/Timeline/common/HiddenEvents/common/Link/types.js +2 -0
- package/dist/components/Timeline/common/HiddenEvents/common/index.d.ts +1 -0
- package/dist/components/Timeline/common/HiddenEvents/common/index.js +1 -0
- package/dist/components/Timeline/common/HiddenEvents/index.d.ts +17 -0
- package/dist/components/Timeline/common/HiddenEvents/index.js +7 -0
- package/dist/components/Timeline/common/HiddenEvents/styles.css +42 -0
- package/dist/components/Timeline/common/HiddenEvents/types.d.ts +9 -0
- package/dist/components/Timeline/common/HiddenEvents/types.js +2 -0
- package/dist/components/Timeline/common/index.d.ts +2 -0
- package/dist/components/Timeline/common/index.js +2 -0
- package/dist/components/Timeline/index.d.ts +39 -0
- package/dist/components/Timeline/index.js +8 -0
- package/dist/components/Timeline/styles.css +12 -0
- package/dist/components/Timeline/types.d.ts +2 -0
- package/dist/components/Timeline/types.js +2 -0
- package/dist/components/UserAvatar/UserAvatar.svelte +63 -0
- package/dist/components/UserAvatar/UserAvatar.svelte.d.ts +17 -0
- package/dist/components/UserAvatar/index.d.ts +2 -0
- package/dist/components/UserAvatar/index.js +3 -0
- package/dist/components/UserAvatar/styles.css +66 -0
- package/dist/components/UserAvatar/types.d.ts +12 -0
- package/dist/components/UserAvatar/types.js +2 -0
- package/dist/components/UserAvatar/utils/getInitials.d.ts +1 -0
- package/dist/components/UserAvatar/utils/getInitials.js +8 -0
- package/dist/components/UserAvatar/utils/index.d.ts +1 -0
- package/dist/components/UserAvatar/utils/index.js +1 -0
- package/dist/components/icons/SortIcon.svelte +25 -0
- package/dist/components/icons/SortIcon.svelte.d.ts +4 -0
- package/dist/components/icons/index.d.ts +1 -0
- package/dist/components/icons/index.js +2 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +4 -0
- package/dist/type-utils/DistributiveOmit.d.ts +4 -0
- package/dist/type-utils/DistributiveOmit.js +1 -0
- package/dist/type-utils/index.d.ts +1 -0
- package/dist/type-utils/index.js +1 -0
- package/package.json +8 -8
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import "./styles.css";
|
|
2
|
+
/**
|
|
3
|
+
* `Timeline` component represents a vertical timeline that displays a series of events in chronological order.
|
|
4
|
+
*
|
|
5
|
+
* ## Example Usage
|
|
6
|
+
* ```svelte
|
|
7
|
+
* <Timeline>
|
|
8
|
+
* <Timeline.Event marker={{userName: "Alvarez Daniella"}} markerSize="large">
|
|
9
|
+
* {#snippet titleRow()}
|
|
10
|
+
* <Timeline.Event.TitleRow leadingText="Alvarez Daniella">
|
|
11
|
+
* did some cool stuff
|
|
12
|
+
* {#snippet date()}
|
|
13
|
+
* <DateTime date="2023-03-15" />
|
|
14
|
+
* {/snippet}
|
|
15
|
+
* </Timeline.Event.TitleRow>
|
|
16
|
+
* {/snippet}
|
|
17
|
+
* Description of the stuff that was done.
|
|
18
|
+
* </Timeline.Event>
|
|
19
|
+
* <Timeline.Event>
|
|
20
|
+
* {#snippet marker()}
|
|
21
|
+
* <StarredIcon />
|
|
22
|
+
* {/snippet}
|
|
23
|
+
* {#snippet titleRow()}
|
|
24
|
+
* <Timeline.Event.TitleRow leadingText="Alvarez Daniella">
|
|
25
|
+
* did other amazing things
|
|
26
|
+
* {#snippet date()}
|
|
27
|
+
* <DateTime date="2023-03-15" />
|
|
28
|
+
* {/snippet}
|
|
29
|
+
* </Timeline.Event.TitleRow>
|
|
30
|
+
* {/snippet}
|
|
31
|
+
* </Timeline.Event>
|
|
32
|
+
* <Timeline.HiddenEvents numHidden={3}>
|
|
33
|
+
* <Timeline.HiddenEvents.Link href="?show-all">Show all</Timeline.HiddenEvents.Link>
|
|
34
|
+
* </Timeline.HiddenEvents>
|
|
35
|
+
* </Timeline>
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
declare const Timeline: import("svelte").Component<import("svelte/elements").HTMLOlAttributes, {}, "">;
|
|
39
|
+
type Timeline = ReturnType<typeof Timeline>;
|
|
40
|
+
export default Timeline;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<!-- @canonical/generator-ds 0.10.0-experimental.2 -->
|
|
2
|
+
|
|
3
|
+
<script lang="ts">
|
|
4
|
+
import { UserAvatar } from "../../../UserAvatar/index.js";
|
|
5
|
+
import type { EventProps } from "./types.js";
|
|
6
|
+
import "./styles.css";
|
|
7
|
+
|
|
8
|
+
const componentCssClassName = "ds timeline-event";
|
|
9
|
+
|
|
10
|
+
let {
|
|
11
|
+
class: className,
|
|
12
|
+
children,
|
|
13
|
+
marker,
|
|
14
|
+
markerSize = "small",
|
|
15
|
+
titleRow,
|
|
16
|
+
...rest
|
|
17
|
+
}: EventProps = $props();
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<li
|
|
21
|
+
class={[
|
|
22
|
+
componentCssClassName,
|
|
23
|
+
className,
|
|
24
|
+
marker
|
|
25
|
+
? markerSize === "small"
|
|
26
|
+
? "marker-small"
|
|
27
|
+
: "marker-large"
|
|
28
|
+
: "marker-empty",
|
|
29
|
+
{ "with-title-row": titleRow },
|
|
30
|
+
]}
|
|
31
|
+
{...rest}
|
|
32
|
+
>
|
|
33
|
+
<div class="marker">
|
|
34
|
+
{#if typeof marker === "function"}
|
|
35
|
+
{@render marker()}
|
|
36
|
+
{:else if marker}
|
|
37
|
+
<UserAvatar {...marker} />
|
|
38
|
+
{/if}
|
|
39
|
+
</div>
|
|
40
|
+
{#if children || titleRow}
|
|
41
|
+
<div class="content">
|
|
42
|
+
{#if titleRow}
|
|
43
|
+
<div class="title-row">
|
|
44
|
+
{@render titleRow?.()}
|
|
45
|
+
</div>
|
|
46
|
+
{/if}
|
|
47
|
+
{#if children}
|
|
48
|
+
<div>
|
|
49
|
+
{@render children()}
|
|
50
|
+
</div>
|
|
51
|
+
{/if}
|
|
52
|
+
</div>
|
|
53
|
+
{/if}
|
|
54
|
+
</li>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<!-- @canonical/generator-ds 0.10.0-experimental.2 -->
|
|
2
|
+
|
|
3
|
+
<script lang="ts">
|
|
4
|
+
import "./styles.css";
|
|
5
|
+
import type { TitleRowProps } from "./types.js";
|
|
6
|
+
|
|
7
|
+
const componentCssClassName = "ds timeline-title-row";
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
class: className,
|
|
11
|
+
children,
|
|
12
|
+
leadingText,
|
|
13
|
+
date,
|
|
14
|
+
...rest
|
|
15
|
+
}: TitleRowProps = $props();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<div
|
|
19
|
+
class={[componentCssClassName, className]}
|
|
20
|
+
data-testid="title-row"
|
|
21
|
+
{...rest}
|
|
22
|
+
>
|
|
23
|
+
<span class="content">
|
|
24
|
+
{#if leadingText}
|
|
25
|
+
<span class="leading-text">{leadingText}</span>
|
|
26
|
+
{/if}
|
|
27
|
+
<span class="description">
|
|
28
|
+
{@render children()}
|
|
29
|
+
</span>
|
|
30
|
+
</span>
|
|
31
|
+
<span class="date">{@render date()}</span>
|
|
32
|
+
</div>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.ds.timeline-title-row {
|
|
2
|
+
--dimension-gap-timeline-event-title-row: var(
|
|
3
|
+
--lp-dimension-spacing-inline-xs
|
|
4
|
+
);
|
|
5
|
+
/* TODO(@Enzo): Add a missing token */
|
|
6
|
+
--dimension-basis-timeline-event-title-row-description: 10rem;
|
|
7
|
+
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: baseline;
|
|
10
|
+
|
|
11
|
+
font: var(--lp-typography-paragraph-s);
|
|
12
|
+
line-height: var(--typography-line-height-timeline-event-title-row);
|
|
13
|
+
gap: var(--dimension-gap-timeline-event-title-row);
|
|
14
|
+
|
|
15
|
+
> .content {
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-grow: 1;
|
|
18
|
+
align-items: baseline;
|
|
19
|
+
flex-wrap: wrap;
|
|
20
|
+
|
|
21
|
+
gap: var(--dimension-gap-timeline-event-title-row);
|
|
22
|
+
|
|
23
|
+
> .leading-text {
|
|
24
|
+
color: var(--lp-color-text-default);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
> .description {
|
|
28
|
+
color: var(--lp-color-text-muted);
|
|
29
|
+
flex-basis: var(--dimension-basis-timeline-event-title-row-description);
|
|
30
|
+
flex-grow: 1;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
> .date {
|
|
35
|
+
color: var(--lp-color-text-muted);
|
|
36
|
+
flex: none;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { SvelteHTMLElements } from "svelte/elements";
|
|
3
|
+
type BaseProps = SvelteHTMLElements["div"];
|
|
4
|
+
export interface TitleRowProps extends BaseProps {
|
|
5
|
+
/**
|
|
6
|
+
* The text to display at the start of the title row.
|
|
7
|
+
*/
|
|
8
|
+
leadingText?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Main content to be displayed in the title row.
|
|
11
|
+
*/
|
|
12
|
+
children: Snippet<[]>;
|
|
13
|
+
/**
|
|
14
|
+
* The date to display at the end of the title row.
|
|
15
|
+
*/
|
|
16
|
+
date: Snippet<[]>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./TitleRow/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./TitleRow/index.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TitleRow } from "./common/index.js";
|
|
2
|
+
import { default as EventRoot } from "./Event.svelte";
|
|
3
|
+
declare const Event: typeof EventRoot & {
|
|
4
|
+
/**
|
|
5
|
+
* `Timeline.Event.TitleRow` is used to display a title row within a timeline event.
|
|
6
|
+
* @example
|
|
7
|
+
* ```svelte
|
|
8
|
+
* <Timeline.Event.TitleRow leadingText="Alvarez Daniella">
|
|
9
|
+
* added labels: Don't merge, Maintenance, Review: QA needed
|
|
10
|
+
* {#snippet date()}
|
|
11
|
+
* <DateTime date="2023-03-15" />
|
|
12
|
+
* {/snippet}
|
|
13
|
+
* </Timeline.Event.TitleRow>
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
TitleRow: typeof TitleRow;
|
|
17
|
+
};
|
|
18
|
+
export type { TitleRowProps } from "./common/index.js";
|
|
19
|
+
export * from "./types.js";
|
|
20
|
+
export { Event };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
.ds.timeline-event {
|
|
2
|
+
--typography-line-height-timeline-event-title-row: var(
|
|
3
|
+
--lp-typography-line-height-s
|
|
4
|
+
);
|
|
5
|
+
|
|
6
|
+
grid-column: 1 / -1;
|
|
7
|
+
display: grid;
|
|
8
|
+
grid-template-columns: subgrid;
|
|
9
|
+
grid-template-rows: 1fr;
|
|
10
|
+
|
|
11
|
+
> * {
|
|
12
|
+
grid-row: 1;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&.marker-small {
|
|
16
|
+
--marker-size: var(--lp-dimension-size-s);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&.marker-large {
|
|
20
|
+
--marker-size: var(--lp-dimension-size-l);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.marker-empty {
|
|
24
|
+
--marker-size: var(--lp-dimension-size-xxxs);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
--marker-title-row-alignment-difference: 0px;
|
|
28
|
+
--marker-alignment-adjustment: 0px;
|
|
29
|
+
|
|
30
|
+
&.with-title-row {
|
|
31
|
+
/* Only calculate this if necessary */
|
|
32
|
+
--marker-title-row-alignment-difference: calc(
|
|
33
|
+
var(--typography-line-height-timeline-event-title-row) /
|
|
34
|
+
2 -
|
|
35
|
+
var(--marker-size) /
|
|
36
|
+
2
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
/* If the marker is bigger that the title row, there's no need to adjust its alignment */
|
|
40
|
+
--marker-alignment-adjustment: max(
|
|
41
|
+
var(--marker-title-row-alignment-difference),
|
|
42
|
+
0px
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&:not(:only-child) {
|
|
47
|
+
&::before {
|
|
48
|
+
content: "";
|
|
49
|
+
display: block;
|
|
50
|
+
grid-column: marker;
|
|
51
|
+
grid-row: 1;
|
|
52
|
+
background-color: var(--color-background-timeline-line);
|
|
53
|
+
width: var(--dimension-width-timeline-line);
|
|
54
|
+
justify-self: center;
|
|
55
|
+
|
|
56
|
+
/* Span the whole height of the event and reach over the gap to the next one */
|
|
57
|
+
height: calc(100% + var(--dimension-gap-row-timeline));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&:first-child::before {
|
|
61
|
+
/* Start the line at the marker */
|
|
62
|
+
height: calc(
|
|
63
|
+
100% +
|
|
64
|
+
var(--dimension-gap-row-timeline) -
|
|
65
|
+
var(--marker-alignment-adjustment)
|
|
66
|
+
);
|
|
67
|
+
margin-block-start: var(--marker-alignment-adjustment);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&:last-child::before {
|
|
71
|
+
/* End the line at the marker */
|
|
72
|
+
height: var(--marker-alignment-adjustment);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
> .marker {
|
|
77
|
+
grid-column: marker;
|
|
78
|
+
justify-self: center;
|
|
79
|
+
display: grid;
|
|
80
|
+
place-content: center;
|
|
81
|
+
align-self: start;
|
|
82
|
+
|
|
83
|
+
width: var(--marker-size);
|
|
84
|
+
height: var(--marker-size);
|
|
85
|
+
border: var(--lp-dimension-stroke-thickness-default) solid
|
|
86
|
+
var(--lp-color-border-default);
|
|
87
|
+
background-color: var(--lp-color-background-alt);
|
|
88
|
+
|
|
89
|
+
margin-block-start: var(--marker-alignment-adjustment);
|
|
90
|
+
|
|
91
|
+
.ds.user-avatar {
|
|
92
|
+
width: 100%;
|
|
93
|
+
height: 100%;
|
|
94
|
+
border: none;
|
|
95
|
+
background-color: transparent;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
> .content {
|
|
100
|
+
grid-column: content;
|
|
101
|
+
align-self: start;
|
|
102
|
+
|
|
103
|
+
> .title-row {
|
|
104
|
+
/* If the title row is bigger than the marker, no adjustment is needed */
|
|
105
|
+
margin-block-start: max(
|
|
106
|
+
calc(var(--marker-title-row-alignment-difference) * -1),
|
|
107
|
+
0px
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
&:not(:only-child) {
|
|
111
|
+
margin-block-end: var(--lp-dimension-spacing-block-xs);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { SvelteHTMLElements } from "svelte/elements";
|
|
3
|
+
import type { UserOptions } from "../../../UserAvatar/index.js";
|
|
4
|
+
type BaseProps = SvelteHTMLElements["li"];
|
|
5
|
+
export interface EventProps extends BaseProps {
|
|
6
|
+
/**
|
|
7
|
+
* The marker to be displayed over the timeline's line. Can be a user avatar or an icon. If not specified, an "empty" marker will be used.
|
|
8
|
+
*/
|
|
9
|
+
marker?: UserOptions | Snippet;
|
|
10
|
+
/**
|
|
11
|
+
* The size of the marker. Has no effect if `marker` is not specified.
|
|
12
|
+
*
|
|
13
|
+
* @default "small"
|
|
14
|
+
*/
|
|
15
|
+
markerSize?: "small" | "large";
|
|
16
|
+
/**
|
|
17
|
+
* Content to be displayed in the event's title row. Consider using `<Timeline.Event.TitleRow>`. If you wish to provide other content, and want the marker to be aligned with the first line of text, override `--typography-line-height-timeline-event-title-row` with the line height of your content.
|
|
18
|
+
*/
|
|
19
|
+
titleRow?: Snippet;
|
|
20
|
+
/**
|
|
21
|
+
* Content to be displayed in the event's body.
|
|
22
|
+
*/
|
|
23
|
+
children?: Snippet;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<!-- @canonical/generator-ds 0.10.0-experimental.2 -->
|
|
2
|
+
|
|
3
|
+
<script lang="ts">
|
|
4
|
+
import "./styles.css";
|
|
5
|
+
import type { HiddenEventsProps } from "./types.js";
|
|
6
|
+
|
|
7
|
+
const componentCssClassName = "ds timeline-hidden-events";
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
class: className,
|
|
11
|
+
children,
|
|
12
|
+
numHidden,
|
|
13
|
+
...rest
|
|
14
|
+
}: HiddenEventsProps = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<li class={[componentCssClassName, className]} {...rest}>
|
|
18
|
+
<div>
|
|
19
|
+
<span>
|
|
20
|
+
{numHidden} hidden
|
|
21
|
+
</span>
|
|
22
|
+
{@render children?.()}
|
|
23
|
+
</div>
|
|
24
|
+
</li>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!-- @canonical/generator-ds 0.10.0-experimental.2 -->
|
|
2
|
+
|
|
3
|
+
<script lang="ts">
|
|
4
|
+
import { Link } from "../../../../../Link/index.js";
|
|
5
|
+
import type { LinkProps } from "./types.js";
|
|
6
|
+
import "./styles.css";
|
|
7
|
+
|
|
8
|
+
const componentCssClassName = "ds timeline-hidden-events-link";
|
|
9
|
+
|
|
10
|
+
let { class: className, ...rest }: LinkProps = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<!-- A separate element instead of a pseudo-element on the link, so it doesn't get underlined on hover -->
|
|
14
|
+
<span class="{componentCssClassName}-separator" aria-hidden="true">•</span>
|
|
15
|
+
<Link class={[componentCssClassName, className]} {...rest} />
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
.ds.timeline-hidden-events-link {
|
|
2
|
+
font: var(--lp-typography-paragraph-xs);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.ds.timeline-hidden-events-link-separator {
|
|
6
|
+
font: var(--lp-typography-paragraph-xs);
|
|
7
|
+
color: var(--lp-color-text-muted);
|
|
8
|
+
margin-inline: var(--lp-dimension-spacing-inline-xs);
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Link/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Link/index.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Link } from "./common/index.js";
|
|
2
|
+
import { default as HiddenEventsRoot } from "./HiddenEvents.svelte";
|
|
3
|
+
declare const HiddenEvents: typeof HiddenEventsRoot & {
|
|
4
|
+
/**
|
|
5
|
+
* `Timeline.HiddenEvents.Link` wraps the `Link` for use inside `Timeline.HiddenEvents`.
|
|
6
|
+
* @example
|
|
7
|
+
* ```svelte
|
|
8
|
+
* <Timeline.HiddenEvents numHidden={3}>
|
|
9
|
+
* <Timeline.HiddenEvents.Link href="?showAll">Show all</Timeline.HiddenEvents.Link>
|
|
10
|
+
* </Timeline.HiddenEvents>
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
Link: typeof Link;
|
|
14
|
+
};
|
|
15
|
+
export type { LinkProps as HiddenEventsLinkProps } from "./common/index.js";
|
|
16
|
+
export * from "./types.js";
|
|
17
|
+
export { HiddenEvents };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/* @canonical/generator-ds 0.10.0-experimental.2 */
|
|
2
|
+
import { Link } from "./common/index.js";
|
|
3
|
+
import { default as HiddenEventsRoot } from "./HiddenEvents.svelte";
|
|
4
|
+
const HiddenEvents = HiddenEventsRoot;
|
|
5
|
+
HiddenEvents.Link = Link;
|
|
6
|
+
export * from "./types.js";
|
|
7
|
+
export { HiddenEvents };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.ds.timeline-hidden-events {
|
|
2
|
+
position: relative;
|
|
3
|
+
grid-column: 1 / -1;
|
|
4
|
+
display: grid;
|
|
5
|
+
grid-template-columns: subgrid;
|
|
6
|
+
font: var(--lp-typography-paragraph-xs-strong);
|
|
7
|
+
|
|
8
|
+
&:not(:last-child)::after {
|
|
9
|
+
/* Line spanning to the next element */
|
|
10
|
+
content: "";
|
|
11
|
+
position: absolute;
|
|
12
|
+
display: block;
|
|
13
|
+
grid-column: marker;
|
|
14
|
+
background-color: var(--color-background-timeline-line);
|
|
15
|
+
width: var(--dimension-width-timeline-line);
|
|
16
|
+
justify-self: center;
|
|
17
|
+
height: var(--dimension-gap-row-timeline);
|
|
18
|
+
top: 100%;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
> div {
|
|
22
|
+
grid-column: 1 / -1;
|
|
23
|
+
justify-self: start;
|
|
24
|
+
display: flex;
|
|
25
|
+
padding-block: var(--lp-dimension-spacing-block-xs);
|
|
26
|
+
padding-inline: var(--lp-dimension-spacing-inline-m);
|
|
27
|
+
border-block: var(--lp-dimension-stroke-thickness-default) solid
|
|
28
|
+
var(--lp-color-border-default);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&:first-child {
|
|
32
|
+
> div {
|
|
33
|
+
border-block-start: none;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&:last-child {
|
|
38
|
+
> div {
|
|
39
|
+
border-block-end: none;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Event, HiddenEvents } from "./common/index.js";
|
|
2
|
+
import { default as TimelineRoot } from "./Timeline.svelte";
|
|
3
|
+
declare const Timeline: typeof TimelineRoot & {
|
|
4
|
+
/**
|
|
5
|
+
* `Timeline.Event` is a component that represents a single event on the timeline. It displays a marker that can optionally show an icon or an avatar (both can either be `small` or `large`).
|
|
6
|
+
*
|
|
7
|
+
* The marker and the first line of the optional `titleRow` are meant to be aligned vertically. This is automatically handled if `<Timeline.Event.TitleRow>` is used. If you wish to provide other content and want this behavior to persist, override `--typography-line-height-timeline-event-title-row` CSS variable with the line height of your content.
|
|
8
|
+
* @example
|
|
9
|
+
* ```svelte
|
|
10
|
+
* <Timeline.Event marker={{ userName: "Alvarez Daniella" }} markerSize="small">
|
|
11
|
+
* {#snippet titleRow()}
|
|
12
|
+
* <Timeline.Event.TitleRow
|
|
13
|
+
* leadingText="Alvarez Daniella"
|
|
14
|
+
* >
|
|
15
|
+
* did something
|
|
16
|
+
* {#snippet date()}
|
|
17
|
+
* <DateTime date="2023-03-15" />
|
|
18
|
+
* {/snippet}
|
|
19
|
+
* </Timeline.Event.TitleRow>
|
|
20
|
+
* {/snippet}
|
|
21
|
+
* and here is some additional content.
|
|
22
|
+
* </Timeline.Event>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
Event: typeof Event;
|
|
26
|
+
/**
|
|
27
|
+
* `Timeline.HiddenEvents` component provides a way to inform the user, that not all events are visible in the timeline. It displays a message indicating the number of events hidden from the view and optionally allows the user to display more or all the hidden events.
|
|
28
|
+
* @example
|
|
29
|
+
* ```svelte
|
|
30
|
+
* <Timeline.HiddenEvents numHidden={888}>
|
|
31
|
+
* <Timeline.HiddenEvents.Link href="?showAll">Show all</Timeline.HiddenEvents.Link>
|
|
32
|
+
* </Timeline.HiddenEvents>
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
HiddenEvents: typeof HiddenEvents;
|
|
36
|
+
};
|
|
37
|
+
export type { EventProps as TimelineEventProps, HiddenEventsLinkProps as TimelineHiddenEventsLinkProps, HiddenEventsProps as TimelineHiddenEventsProps, TitleRowProps as TimelineTitleRowProps, } from "./common/index.js";
|
|
38
|
+
export * from "./types.js";
|
|
39
|
+
export { Timeline };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* @canonical/generator-ds 0.10.0-experimental.2 */
|
|
2
|
+
import { Event, HiddenEvents } from "./common/index.js";
|
|
3
|
+
import { default as TimelineRoot } from "./Timeline.svelte";
|
|
4
|
+
const Timeline = TimelineRoot;
|
|
5
|
+
Timeline.Event = Event;
|
|
6
|
+
Timeline.HiddenEvents = HiddenEvents;
|
|
7
|
+
export * from "./types.js";
|
|
8
|
+
export { Timeline };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
.ds.timeline {
|
|
2
|
+
--dimension-gap-row-timeline: calc(var(--lp-dimension-spacing-block-s) * 2);
|
|
3
|
+
--color-background-timeline-line: var(--lp-color-border-default);
|
|
4
|
+
--dimension-width-timeline-line: var(--lp-dimension-stroke-thickness-default);
|
|
5
|
+
|
|
6
|
+
display: grid;
|
|
7
|
+
grid-template-columns: [marker-start] auto [marker-end content-start] 1fr [content-end];
|
|
8
|
+
list-style: none;
|
|
9
|
+
|
|
10
|
+
row-gap: var(--dimension-gap-row-timeline);
|
|
11
|
+
column-gap: var(--lp-dimension-spacing-inline-m);
|
|
12
|
+
}
|