@canonical/svelte-ds-app-launchpad 0.26.0 → 0.27.1-experimental.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/NumberInput/types.d.ts +2 -2
- package/dist/components/Popover/Popover.svelte +1 -1
- package/dist/components/SearchBox/SearchBox.svelte +79 -0
- package/dist/components/SearchBox/SearchBox.svelte.d.ts +36 -0
- package/dist/components/SearchBox/common/SearchButton/SearchButton.svelte +31 -0
- package/dist/components/SearchBox/common/SearchButton/SearchButton.svelte.d.ts +5 -0
- package/dist/components/SearchBox/common/SearchButton/index.d.ts +2 -0
- package/dist/components/SearchBox/common/SearchButton/index.js +1 -0
- package/dist/components/SearchBox/common/SearchButton/styles.css +11 -0
- package/dist/components/SearchBox/common/SearchButton/types.d.ts +2 -0
- package/dist/components/SearchBox/common/SearchButton/types.js +1 -0
- package/dist/components/SearchBox/common/index.d.ts +1 -0
- package/dist/components/SearchBox/common/index.js +1 -0
- package/dist/components/SearchBox/context.d.ts +2 -0
- package/dist/components/SearchBox/context.js +2 -0
- package/dist/components/SearchBox/index.d.ts +22 -0
- package/dist/components/SearchBox/index.js +6 -0
- package/dist/components/SearchBox/styles.css +35 -0
- package/dist/components/SearchBox/types.d.ts +26 -0
- package/dist/components/SearchBox/types.js +2 -0
- package/dist/components/Select/Select.svelte +51 -0
- package/dist/components/Select/Select.svelte.d.ts +17 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Select/index.js +3 -0
- package/dist/components/Select/styles.css +162 -0
- package/dist/components/Select/types.d.ts +7 -0
- package/dist/components/Select/types.js +2 -0
- package/dist/components/SideNavigation/SideNavigation.svelte +120 -0
- package/dist/components/SideNavigation/SideNavigation.svelte.d.ts +65 -0
- package/dist/components/SideNavigation/common/ExpandToggle/ExpandToggle.svelte +14 -0
- package/dist/components/SideNavigation/common/ExpandToggle/ExpandToggle.svelte.d.ts +5 -0
- package/dist/components/SideNavigation/common/ExpandToggle/index.d.ts +2 -0
- package/dist/components/SideNavigation/common/ExpandToggle/index.js +2 -0
- package/dist/components/SideNavigation/common/ExpandToggle/styles.css +14 -0
- package/dist/components/SideNavigation/common/ExpandToggle/types.d.ts +2 -0
- package/dist/components/SideNavigation/common/ExpandToggle/types.js +1 -0
- package/dist/components/SideNavigation/common/NavigationItem/NavigationItem.svelte +33 -0
- package/dist/components/SideNavigation/common/NavigationItem/NavigationItem.svelte.d.ts +5 -0
- package/dist/components/SideNavigation/common/NavigationItem/index.d.ts +2 -0
- package/dist/components/SideNavigation/common/NavigationItem/index.js +2 -0
- package/dist/components/SideNavigation/common/NavigationItem/styles.css +52 -0
- package/dist/components/SideNavigation/common/NavigationItem/types.d.ts +16 -0
- package/dist/components/SideNavigation/common/NavigationItem/types.js +1 -0
- package/dist/components/SideNavigation/common/index.d.ts +2 -0
- package/dist/components/SideNavigation/common/index.js +2 -0
- package/dist/components/SideNavigation/index.d.ts +15 -0
- package/dist/components/SideNavigation/index.js +7 -0
- package/dist/components/SideNavigation/styles.css +124 -0
- package/dist/components/SideNavigation/types.d.ts +39 -0
- package/dist/components/SideNavigation/types.js +2 -0
- package/dist/components/TextInput/types.d.ts +2 -2
- package/dist/components/Tooltip/Tooltip.svelte +165 -0
- package/dist/components/Tooltip/Tooltip.svelte.d.ts +23 -0
- package/dist/components/Tooltip/index.d.ts +2 -0
- package/dist/components/Tooltip/index.js +3 -0
- package/dist/components/Tooltip/styles.css +111 -0
- package/dist/components/Tooltip/types.d.ts +43 -0
- package/dist/components/Tooltip/types.js +2 -0
- package/dist/components/Tooltip/utils/ChainingManager.d.ts +18 -0
- package/dist/components/Tooltip/utils/ChainingManager.js +29 -0
- package/dist/components/Tooltip/utils/useDelayedOpen.svelte.d.ts +15 -0
- package/dist/components/Tooltip/utils/useDelayedOpen.svelte.js +42 -0
- package/dist/components/Tooltip/utils/useTooltipPosition.svelte.d.ts +24 -0
- package/dist/components/Tooltip/utils/useTooltipPosition.svelte.js +40 -0
- package/dist/components/icons/ExpandRightIcon.svelte +22 -0
- package/dist/components/icons/ExpandRightIcon.svelte.d.ts +4 -0
- package/dist/components/icons/index.d.ts +1 -0
- package/dist/components/icons/index.js +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +4 -0
- package/dist/transitions/cssControlledFade.d.ts +9 -0
- package/dist/transitions/cssControlledFade.js +39 -0
- package/package.json +11 -8
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cssControlledFade } from "../../transitions/cssControlledFade.js";
|
|
3
|
+
import "./styles.css";
|
|
4
|
+
import type { SideNavigationProps } from "./types.js";
|
|
5
|
+
|
|
6
|
+
const componentCssClassName = "ds side-navigation";
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
class: className,
|
|
10
|
+
children,
|
|
11
|
+
logo,
|
|
12
|
+
footer,
|
|
13
|
+
expandToggle,
|
|
14
|
+
expanded = true,
|
|
15
|
+
...rest
|
|
16
|
+
}: SideNavigationProps = $props();
|
|
17
|
+
|
|
18
|
+
const navId = $props.id();
|
|
19
|
+
|
|
20
|
+
// We need to track if expanded has changed from its initial value to avoid animating on first render
|
|
21
|
+
let expandedChanged = $state(false);
|
|
22
|
+
// svelte-ignore state_referenced_locally
|
|
23
|
+
const initialExpanded = expanded;
|
|
24
|
+
$effect.pre(() => {
|
|
25
|
+
if (expanded !== initialExpanded) expandedChanged = true;
|
|
26
|
+
});
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<header
|
|
30
|
+
class={[componentCssClassName, className]}
|
|
31
|
+
class:collapsed={!expanded}
|
|
32
|
+
class:expanded-changed={expandedChanged}
|
|
33
|
+
{...rest}
|
|
34
|
+
>
|
|
35
|
+
<div class="logo">
|
|
36
|
+
{@render logo()}
|
|
37
|
+
</div>
|
|
38
|
+
{@render expandToggle?.({
|
|
39
|
+
"aria-expanded": expanded,
|
|
40
|
+
"aria-controls": navId,
|
|
41
|
+
"aria-label": expanded ? "Collapse navigation" : "Expand navigation",
|
|
42
|
+
})}
|
|
43
|
+
{#if expanded}
|
|
44
|
+
<nav
|
|
45
|
+
id={navId}
|
|
46
|
+
transition:cssControlledFade={{
|
|
47
|
+
durationVar: "--transition-duration-side-navigation",
|
|
48
|
+
easingVar: "--transition-easing-side-navigation",
|
|
49
|
+
}}
|
|
50
|
+
>
|
|
51
|
+
{@render children?.()}
|
|
52
|
+
</nav>
|
|
53
|
+
{/if}
|
|
54
|
+
{#if footer}
|
|
55
|
+
<div class="footer">
|
|
56
|
+
{@render footer()}
|
|
57
|
+
</div>
|
|
58
|
+
{/if}
|
|
59
|
+
</header>
|
|
60
|
+
|
|
61
|
+
<!-- @component
|
|
62
|
+
`SideNavigation` is the primary navigation component containing links to navigate between different sections of an application. The component can be expanded or collapsed (depending on the `expanded` prop).
|
|
63
|
+
|
|
64
|
+
The component has two sections:
|
|
65
|
+
- main navigation area (children) - it is hidden when component is collapsed;
|
|
66
|
+
- footer area (footer) - if component is collapsed, only icons are shown.
|
|
67
|
+
|
|
68
|
+
## Example Usage
|
|
69
|
+
```svelte
|
|
70
|
+
<script lang="ts">
|
|
71
|
+
let expanded = $state(true);
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<SideNavigation {expanded}>
|
|
75
|
+
{#snippet logo()}
|
|
76
|
+
<a href="/" aria-label="Home">
|
|
77
|
+
<Logo />
|
|
78
|
+
</a>
|
|
79
|
+
{/snippet}
|
|
80
|
+
{#snippet expandToggle(toggleProps)}
|
|
81
|
+
<SideNavigation.ExpandToggle
|
|
82
|
+
{...toggleProps}
|
|
83
|
+
onclick={() => (expanded = !expanded)}
|
|
84
|
+
/>
|
|
85
|
+
{/snippet}
|
|
86
|
+
<SideNavigation.NavigationItem href="/dashboard">
|
|
87
|
+
{#snippet icon()}
|
|
88
|
+
<Dashboard />
|
|
89
|
+
{/snippet}
|
|
90
|
+
Dashboard
|
|
91
|
+
</SideNavigation.NavigationItem>
|
|
92
|
+
<SideNavigation.NavigationItem href="/projects">
|
|
93
|
+
{#snippet icon()}
|
|
94
|
+
<Folder />
|
|
95
|
+
{/snippet}
|
|
96
|
+
Projects
|
|
97
|
+
</SideNavigation.NavigationItem>
|
|
98
|
+
{#snippet footer()}
|
|
99
|
+
<SideNavigation.NavigationItem onclick={doSomething}>
|
|
100
|
+
{#snippet icon()}
|
|
101
|
+
<ColorPalette />
|
|
102
|
+
{/snippet}
|
|
103
|
+
Theme
|
|
104
|
+
</SideNavigation.NavigationItem>
|
|
105
|
+
<SideNavigation.NavigationItem href="/profile">
|
|
106
|
+
{#snippet icon()}
|
|
107
|
+
<User />
|
|
108
|
+
{/snippet}
|
|
109
|
+
John Doe
|
|
110
|
+
</SideNavigation.NavigationItem>
|
|
111
|
+
<SideNavigation.NavigationItem onclick={doSomethingElse}>
|
|
112
|
+
{#snippet icon()}
|
|
113
|
+
<LogOut />
|
|
114
|
+
{/snippet}
|
|
115
|
+
Logout
|
|
116
|
+
</SideNavigation.NavigationItem>
|
|
117
|
+
{/snippet}
|
|
118
|
+
</SideNavigation>
|
|
119
|
+
```
|
|
120
|
+
-->
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import "./styles.css";
|
|
2
|
+
import type { SideNavigationProps } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* `SideNavigation` is the primary navigation component containing links to navigate between different sections of an application. The component can be expanded or collapsed (depending on the `expanded` prop).
|
|
5
|
+
*
|
|
6
|
+
* The component has two sections:
|
|
7
|
+
* - main navigation area (children) - it is hidden when component is collapsed;
|
|
8
|
+
* - footer area (footer) - if component is collapsed, only icons are shown.
|
|
9
|
+
*
|
|
10
|
+
* ## Example Usage
|
|
11
|
+
* ```svelte
|
|
12
|
+
* <script lang="ts">
|
|
13
|
+
* let expanded = $state(true);
|
|
14
|
+
* </script>
|
|
15
|
+
*
|
|
16
|
+
* <SideNavigation {expanded}>
|
|
17
|
+
* {#snippet logo()}
|
|
18
|
+
* <a href="/" aria-label="Home">
|
|
19
|
+
* <Logo />
|
|
20
|
+
* </a>
|
|
21
|
+
* {/snippet}
|
|
22
|
+
* {#snippet expandToggle(toggleProps)}
|
|
23
|
+
* <SideNavigation.ExpandToggle
|
|
24
|
+
* {...toggleProps}
|
|
25
|
+
* onclick={() => (expanded = !expanded)}
|
|
26
|
+
* />
|
|
27
|
+
* {/snippet}
|
|
28
|
+
* <SideNavigation.NavigationItem href="/dashboard">
|
|
29
|
+
* {#snippet icon()}
|
|
30
|
+
* <Dashboard />
|
|
31
|
+
* {/snippet}
|
|
32
|
+
* Dashboard
|
|
33
|
+
* </SideNavigation.NavigationItem>
|
|
34
|
+
* <SideNavigation.NavigationItem href="/projects">
|
|
35
|
+
* {#snippet icon()}
|
|
36
|
+
* <Folder />
|
|
37
|
+
* {/snippet}
|
|
38
|
+
* Projects
|
|
39
|
+
* </SideNavigation.NavigationItem>
|
|
40
|
+
* {#snippet footer()}
|
|
41
|
+
* <SideNavigation.NavigationItem onclick={doSomething}>
|
|
42
|
+
* {#snippet icon()}
|
|
43
|
+
* <ColorPalette />
|
|
44
|
+
* {/snippet}
|
|
45
|
+
* Theme
|
|
46
|
+
* </SideNavigation.NavigationItem>
|
|
47
|
+
* <SideNavigation.NavigationItem href="/profile">
|
|
48
|
+
* {#snippet icon()}
|
|
49
|
+
* <User />
|
|
50
|
+
* {/snippet}
|
|
51
|
+
* John Doe
|
|
52
|
+
* </SideNavigation.NavigationItem>
|
|
53
|
+
* <SideNavigation.NavigationItem onclick={doSomethingElse}>
|
|
54
|
+
* {#snippet icon()}
|
|
55
|
+
* <LogOut />
|
|
56
|
+
* {/snippet}
|
|
57
|
+
* Logout
|
|
58
|
+
* </SideNavigation.NavigationItem>
|
|
59
|
+
* {/snippet}
|
|
60
|
+
* </SideNavigation>
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
declare const SideNavigation: import("svelte").Component<SideNavigationProps, {}, "">;
|
|
64
|
+
type SideNavigation = ReturnType<typeof SideNavigation>;
|
|
65
|
+
export default SideNavigation;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { ButtonPrimitive } from "../../../common/ButtonPrimitive/index.js";
|
|
3
|
+
import { ExpandRightIcon } from "../../../icons/index.js";
|
|
4
|
+
import "./styles.css";
|
|
5
|
+
import type { ExpandToggleProps } from "./types.js";
|
|
6
|
+
|
|
7
|
+
const componentCssClassName = "ds side-navigation-expand-toggle";
|
|
8
|
+
|
|
9
|
+
let { class: className, ...rest }: ExpandToggleProps = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<ButtonPrimitive class={[componentCssClassName, className]} {...rest}>
|
|
13
|
+
<ExpandRightIcon class="expand-icon" />
|
|
14
|
+
</ButtonPrimitive>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
.ds.side-navigation-expand-toggle.button-primitive {
|
|
2
|
+
display: grid;
|
|
3
|
+
place-items: center;
|
|
4
|
+
box-sizing: content-box;
|
|
5
|
+
&[aria-expanded="true"] .expand-icon {
|
|
6
|
+
transform: rotate(180deg);
|
|
7
|
+
}
|
|
8
|
+
&[aria-expanded="false"] {
|
|
9
|
+
min-height: 1lh;
|
|
10
|
+
--dimension-padding-block-button: var(
|
|
11
|
+
--dimension-padding-block-side-navigation-item
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { ButtonPrimitive } from "../../../common/ButtonPrimitive/index.js";
|
|
3
|
+
import "./styles.css";
|
|
4
|
+
import type { NavigationItemProps } from "./types.js";
|
|
5
|
+
|
|
6
|
+
const componentCssClassName = "ds navigation-item";
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
class: className,
|
|
10
|
+
children,
|
|
11
|
+
icon,
|
|
12
|
+
selected,
|
|
13
|
+
...rest
|
|
14
|
+
}: NavigationItemProps = $props();
|
|
15
|
+
|
|
16
|
+
const labelId = $props.id();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<ButtonPrimitive
|
|
20
|
+
class={[componentCssClassName, className, { selected }]}
|
|
21
|
+
aria-labelledby={labelId}
|
|
22
|
+
{...rest}
|
|
23
|
+
>
|
|
24
|
+
{#if icon}
|
|
25
|
+
<div class="icon">
|
|
26
|
+
{@render icon()}
|
|
27
|
+
</div>
|
|
28
|
+
{/if}
|
|
29
|
+
<!-- using labeled-by exposes the contents to a11y tree even if the label is visually hidden -->
|
|
30
|
+
<div id={labelId} class="label">
|
|
31
|
+
{@render children()}
|
|
32
|
+
</div>
|
|
33
|
+
</ButtonPrimitive>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
.ds.navigation-item.button-primitive {
|
|
2
|
+
display: grid;
|
|
3
|
+
position: relative;
|
|
4
|
+
grid-column: 1 / -1;
|
|
5
|
+
border: none;
|
|
6
|
+
|
|
7
|
+
--dimension-padding-inline-button: 0;
|
|
8
|
+
--dimension-padding-block-button: var(--lp-dimension-spacing-block-xxs);
|
|
9
|
+
--dimension-padding-inline-start-button-label: var(
|
|
10
|
+
--lp-dimension-spacing-inline-xs
|
|
11
|
+
);
|
|
12
|
+
--color-background-button-selected: var(
|
|
13
|
+
--tmp-color-background-neutral-active
|
|
14
|
+
);
|
|
15
|
+
--dimension-width-button-selected-indicator: var(
|
|
16
|
+
--lp-dimension-stroke-thickness-large
|
|
17
|
+
);
|
|
18
|
+
--color-background-button-selected-indicator: var(
|
|
19
|
+
--tmp-color-border-highlight
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
grid-template-columns: subgrid;
|
|
23
|
+
|
|
24
|
+
> .icon {
|
|
25
|
+
grid-column: logo;
|
|
26
|
+
place-self: center;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
> .label {
|
|
30
|
+
grid-column: expanded-start / content-end;
|
|
31
|
+
text-align: left;
|
|
32
|
+
white-space: nowrap;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
text-overflow: ellipsis;
|
|
35
|
+
padding-inline-start: var(--dimension-padding-inline-start-button-label);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&.selected {
|
|
39
|
+
--color-background-button: var(--color-background-button-selected);
|
|
40
|
+
--color-background-button-hover: var(--color-background-button-selected);
|
|
41
|
+
--color-background-button-active: var(--color-background-button-selected);
|
|
42
|
+
|
|
43
|
+
&::before {
|
|
44
|
+
content: "";
|
|
45
|
+
position: absolute;
|
|
46
|
+
height: 100%;
|
|
47
|
+
width: var(--dimension-width-button-selected-indicator);
|
|
48
|
+
inset-inline-start: 0;
|
|
49
|
+
background-color: var(--color-background-button-selected-indicator);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { ButtonPrimitiveProps } from "../../../common/index.js";
|
|
3
|
+
export type NavigationItemProps = ButtonPrimitiveProps & {
|
|
4
|
+
/**
|
|
5
|
+
* Whether the item should appear selected.
|
|
6
|
+
*/
|
|
7
|
+
selected?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* An optional icon to be displayed alongside the item text.
|
|
10
|
+
*/
|
|
11
|
+
icon?: Snippet<[]>;
|
|
12
|
+
/**
|
|
13
|
+
* Content to be displayed inside the item.
|
|
14
|
+
*/
|
|
15
|
+
children: Snippet<[]>;
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ExpandToggle, NavigationItem } from "./common/index.js";
|
|
2
|
+
import { default as SideNavigationRoot } from "./SideNavigation.svelte";
|
|
3
|
+
declare const SideNavigation: typeof SideNavigationRoot & {
|
|
4
|
+
/**
|
|
5
|
+
* `SideNavigation.NavigationItem` A clickable button item within the side navigation.
|
|
6
|
+
*/
|
|
7
|
+
NavigationItem: typeof NavigationItem;
|
|
8
|
+
/**
|
|
9
|
+
* `SideNavigation.ExpandToggle` A button to toggle the expansion of the side navigation.
|
|
10
|
+
*/
|
|
11
|
+
ExpandToggle: typeof ExpandToggle;
|
|
12
|
+
};
|
|
13
|
+
export type { NavigationItemProps as SideNavigationItemProps } from "./common/index.js";
|
|
14
|
+
export type { ExpandToggleProps as SideNavigationExpandToggleProps, SideNavigationProps, } from "./types.js";
|
|
15
|
+
export { SideNavigation };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/* @canonical/generator-ds 0.17.1 */
|
|
2
|
+
import { ExpandToggle, NavigationItem } from "./common/index.js";
|
|
3
|
+
import { default as SideNavigationRoot } from "./SideNavigation.svelte";
|
|
4
|
+
const SideNavigation = SideNavigationRoot;
|
|
5
|
+
SideNavigation.NavigationItem = NavigationItem;
|
|
6
|
+
SideNavigation.ExpandToggle = ExpandToggle;
|
|
7
|
+
export { SideNavigation };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
.ds.side-navigation {
|
|
2
|
+
--color-background-side-navigation: var(--lp-color-background-alt);
|
|
3
|
+
--transition-duration-side-navigation: var(--lp-transition-duration-brisk);
|
|
4
|
+
--transition-easing-side-navigation: var(--lp-transition-timing-ease-out);
|
|
5
|
+
--dimension-padding-side-navigation: var(--lp-dimension-spacing-inline-s);
|
|
6
|
+
--dimension-width-side-navigation-logo-column: 21px;
|
|
7
|
+
--dimension-width-side-navigation-expanded: 240px;
|
|
8
|
+
--dimension-padding-block-start-side-navigation-nav: 40px;
|
|
9
|
+
--dimension-padding-block-end-side-navigation-footer: var(
|
|
10
|
+
--lp-dimension-spacing-block-xs
|
|
11
|
+
);
|
|
12
|
+
--dimension-padding-block-end-side-navigation-nav: var(
|
|
13
|
+
--lp-dimension-spacing-block-xxl
|
|
14
|
+
);
|
|
15
|
+
--dimension-padding-block-side-navigation-item: var(
|
|
16
|
+
--lp-dimension-spacing-block-xxs
|
|
17
|
+
);
|
|
18
|
+
--typography-side-navigation: var(--lp-typography-paragraph-default);
|
|
19
|
+
|
|
20
|
+
width: var(--dimension-width-side-navigation-expanded);
|
|
21
|
+
background-color: var(--color-background-side-navigation);
|
|
22
|
+
|
|
23
|
+
position: sticky;
|
|
24
|
+
top: 0;
|
|
25
|
+
height: 100dvh;
|
|
26
|
+
display: grid;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
font: var(--typography-side-navigation);
|
|
29
|
+
grid-template-columns:
|
|
30
|
+
var(--dimension-padding-side-navigation)
|
|
31
|
+
[logo-start content-start] var(
|
|
32
|
+
--dimension-width-side-navigation-logo-column
|
|
33
|
+
)
|
|
34
|
+
[logo-end expanded-start] minmax(0, 1fr)
|
|
35
|
+
[expanded-end] auto [content-end] var(--dimension-padding-side-navigation);
|
|
36
|
+
grid-template-rows: [header-start] auto [header-end nav-start] 1fr [nav-end
|
|
37
|
+
footer-start] auto [footer-end];
|
|
38
|
+
|
|
39
|
+
transition: width var(--transition-duration-side-navigation)
|
|
40
|
+
var(--transition-easing-side-navigation);
|
|
41
|
+
|
|
42
|
+
& > .logo {
|
|
43
|
+
grid-column: logo-start / expanded-end;
|
|
44
|
+
min-width: max-content;
|
|
45
|
+
grid-row: header;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
& > nav {
|
|
49
|
+
grid-row: nav;
|
|
50
|
+
grid-column: 1 / -1;
|
|
51
|
+
overflow-y: auto;
|
|
52
|
+
overflow-x: hidden;
|
|
53
|
+
display: grid;
|
|
54
|
+
grid-template-columns: subgrid;
|
|
55
|
+
place-content: start stretch;
|
|
56
|
+
|
|
57
|
+
margin-block-start: var(
|
|
58
|
+
--dimension-padding-block-start-side-navigation-nav
|
|
59
|
+
);
|
|
60
|
+
padding-block-end: var(--dimension-padding-block-end-side-navigation-nav);
|
|
61
|
+
mask-image: linear-gradient(
|
|
62
|
+
to top,
|
|
63
|
+
transparent,
|
|
64
|
+
black var(--dimension-padding-block-end-side-navigation-nav)
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
& > .footer {
|
|
69
|
+
grid-row: footer;
|
|
70
|
+
grid-column: 1 / -1;
|
|
71
|
+
display: grid;
|
|
72
|
+
grid-template-columns: subgrid;
|
|
73
|
+
|
|
74
|
+
padding-block-end: var(
|
|
75
|
+
--dimension-padding-block-end-side-navigation-footer
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
& .ds.side-navigation-expand-toggle {
|
|
80
|
+
grid-row: header;
|
|
81
|
+
grid-column: expanded-end / content-end;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* Collapsed state */
|
|
85
|
+
|
|
86
|
+
&.collapsed {
|
|
87
|
+
width: calc(
|
|
88
|
+
var(--dimension-width-side-navigation-logo-column) +
|
|
89
|
+
var(--dimension-padding-side-navigation) *
|
|
90
|
+
2
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
& .ds.side-navigation-expand-toggle {
|
|
94
|
+
grid-row: nav;
|
|
95
|
+
grid-column: 1 / -1;
|
|
96
|
+
|
|
97
|
+
grid-template-columns: subgrid;
|
|
98
|
+
align-self: self-start;
|
|
99
|
+
|
|
100
|
+
margin-block-start: var(--lp-dimension-spacing-block-m);
|
|
101
|
+
|
|
102
|
+
& .expand-icon {
|
|
103
|
+
grid-column: logo;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* Footer items fade */
|
|
109
|
+
|
|
110
|
+
> .footer .navigation-item > .label {
|
|
111
|
+
transition: opacity var(--transition-duration-side-navigation)
|
|
112
|
+
var(--transition-easing-side-navigation);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&.expanded-changed > .footer .navigation-item > .label {
|
|
116
|
+
@starting-style {
|
|
117
|
+
opacity: 0;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&.collapsed > .footer .navigation-item > .label {
|
|
122
|
+
opacity: 0;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { SvelteHTMLElements } from "svelte/elements";
|
|
3
|
+
export type ExpandToggleProps = {
|
|
4
|
+
"aria-expanded": boolean;
|
|
5
|
+
"aria-controls": string;
|
|
6
|
+
"aria-label": string;
|
|
7
|
+
};
|
|
8
|
+
type BaseProps = SvelteHTMLElements["header"];
|
|
9
|
+
export interface SideNavigationProps extends BaseProps {
|
|
10
|
+
/**
|
|
11
|
+
* A snippet containing the logo to be displayed at the top of the side navigation.
|
|
12
|
+
*/
|
|
13
|
+
logo: Snippet<[]>;
|
|
14
|
+
/**
|
|
15
|
+
* A snippet containing a button to toggle the expansion of the side navigation.
|
|
16
|
+
*
|
|
17
|
+
* Snippet arguments:
|
|
18
|
+
* - `expandToggleProps`: Props that should be spread on the button element to provide accessibility information:
|
|
19
|
+
* - `aria-expanded`: A boolean indicating whether the side navigation is expanded or collapsed;
|
|
20
|
+
* - `aria-controls`: The id of the side navigation's `nav` element;
|
|
21
|
+
* - `aria-label`: A label describing the action of the button.
|
|
22
|
+
*/
|
|
23
|
+
expandToggle?: Snippet<[expandToggleProps: ExpandToggleProps]>;
|
|
24
|
+
/**
|
|
25
|
+
* A snippet containing content to be displayed at the bottom of the side navigation, below the navigation items. The icons of the items in the footer will always be visible, even when the side navigation is collapsed.
|
|
26
|
+
*/
|
|
27
|
+
footer?: Snippet<[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the side navigation is expanded or collapsed.
|
|
30
|
+
*
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
33
|
+
expanded?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Main page navigation items.
|
|
36
|
+
*/
|
|
37
|
+
children: Snippet<[]>;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ModifierFamily } from "../../modifier-families/index.js";
|
|
1
|
+
import type { ModifierFamily, ModifierFamilyValues } from "../../modifier-families/index.js";
|
|
2
2
|
import type { TextInputPrimitiveProps } from "../common/index.js";
|
|
3
3
|
export interface TextInputProps extends TextInputPrimitiveProps, ModifierFamily<"severity"> {
|
|
4
|
-
density?: "dense" | "medium"
|
|
4
|
+
density?: Extract<ModifierFamilyValues["density"], "dense" | "medium">;
|
|
5
5
|
}
|