mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 11:36:36 +00:00
Merge 48b63b9246
into 0405edee7d
This commit is contained in:
commit
20ea4fe8c2
15 changed files with 40 additions and 40 deletions
|
@ -1613,7 +1613,7 @@ None.
|
||||||
| Prop name | Required | Kind | Reactive | Type | Default value | Description |
|
| Prop name | Required | Kind | Reactive | Type | Default value | Description |
|
||||||
| :------------------------- | :------- | :--------------- | :------- | ----------------------------------------------------------------- | ------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
|
| :------------------------- | :------- | :--------------- | :------- | ----------------------------------------------------------------- | ------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
|
||||||
| ref | No | <code>let</code> | Yes | <code>null | HTMLButtonElement</code> | <code>null</code> | Obtain a reference to the button HTML element |
|
| ref | No | <code>let</code> | Yes | <code>null | HTMLButtonElement</code> | <code>null</code> | Obtain a reference to the button HTML element |
|
||||||
| isOpen | No | <code>let</code> | Yes | <code>boolean</code> | <code>false</code> | Set to `true` to open the panel |
|
| open | No | <code>let</code> | Yes | <code>boolean</code> | <code>false</code> | Set to `true` to open the panel |
|
||||||
| icon | No | <code>let</code> | No | <code>typeof import("svelte").SvelteComponent<any></code> | <code>undefined</code> | Specify the icon to render when the action panel is closed.<br />Defaults to `<Switcher size={20} />` |
|
| icon | No | <code>let</code> | No | <code>typeof import("svelte").SvelteComponent<any></code> | <code>undefined</code> | Specify the icon to render when the action panel is closed.<br />Defaults to `<Switcher size={20} />` |
|
||||||
| closeIcon | No | <code>let</code> | No | <code>typeof import("svelte").SvelteComponent<any></code> | <code>undefined</code> | Specify the icon to render when the action panel is open.<br />Defaults to `<Close size={20} />` |
|
| closeIcon | No | <code>let</code> | No | <code>typeof import("svelte").SvelteComponent<any></code> | <code>undefined</code> | Specify the icon to render when the action panel is open.<br />Defaults to `<Close size={20} />` |
|
||||||
| text | No | <code>let</code> | No | <code>string</code> | <code>undefined</code> | Specify the text.<br />Alternatively, use the named slot "text" (e.g., `<div slot="text">...</div>`) |
|
| text | No | <code>let</code> | No | <code>string</code> | <code>undefined</code> | Specify the text.<br />Alternatively, use the named slot "text" (e.g., `<div slot="text">...</div>`) |
|
||||||
|
@ -3310,7 +3310,7 @@ None.
|
||||||
|
|
||||||
| Prop name | Required | Kind | Reactive | Type | Default value | Description |
|
| Prop name | Required | Kind | Reactive | Type | Default value | Description |
|
||||||
| :------------------ | :------- | :--------------- | :------- | -------------------- | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| :------------------ | :------- | :--------------- | :------- | -------------------- | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| isOpen | No | <code>let</code> | Yes | <code>boolean</code> | <code>false</code> | Set to `true` to toggle the expanded state |
|
| open | No | <code>let</code> | Yes | <code>boolean</code> | <code>false</code> | Set to `true` to toggle the expanded state |
|
||||||
| fixed | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to use the fixed variant |
|
| fixed | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to use the fixed variant |
|
||||||
| rail | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to use the rail variant |
|
| rail | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to use the rail variant |
|
||||||
| ariaLabel | No | <code>let</code> | No | <code>string</code> | <code>undefined</code> | Specify the ARIA label for the nav |
|
| ariaLabel | No | <code>let</code> | No | <code>string</code> | <code>undefined</code> | Specify the ARIA label for the nav |
|
||||||
|
|
|
@ -4897,7 +4897,7 @@
|
||||||
"filePath": "src/UIShell/HeaderAction.svelte",
|
"filePath": "src/UIShell/HeaderAction.svelte",
|
||||||
"props": [
|
"props": [
|
||||||
{
|
{
|
||||||
"name": "isOpen",
|
"name": "open",
|
||||||
"kind": "let",
|
"kind": "let",
|
||||||
"description": "Set to `true` to open the panel",
|
"description": "Set to `true` to open the panel",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
|
@ -10733,7 +10733,7 @@
|
||||||
"reactive": false
|
"reactive": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "isOpen",
|
"name": "open",
|
||||||
"kind": "let",
|
"kind": "let",
|
||||||
"description": "Set to `true` to toggle the expanded state",
|
"description": "Set to `true` to toggle the expanded state",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
let active = false;
|
let active = false;
|
||||||
$: results = miniSearch.search(value).slice(0, 10);
|
$: results = miniSearch.search(value).slice(0, 10);
|
||||||
|
|
||||||
let isOpen = false;
|
let open = false;
|
||||||
let isSideNavOpen = true;
|
let isSideNavOpen = true;
|
||||||
let innerWidth = 2048;
|
let innerWidth = 2048;
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@
|
||||||
href="https://github.com/carbon-design-system/carbon-components-svelte"
|
href="https://github.com/carbon-design-system/carbon-components-svelte"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
/>
|
/>
|
||||||
<HeaderAction transition="{false}" bind:isOpen>
|
<HeaderAction transition="{false}" bind:open>
|
||||||
<HeaderPanelLinks>
|
<HeaderPanelLinks>
|
||||||
<HeaderPanelDivider>Carbon Svelte portfolio</HeaderPanelDivider>
|
<HeaderPanelDivider>Carbon Svelte portfolio</HeaderPanelDivider>
|
||||||
<HeaderPanelLink
|
<HeaderPanelLink
|
||||||
|
@ -156,7 +156,7 @@
|
||||||
</HeaderUtilities>
|
</HeaderUtilities>
|
||||||
</Header>
|
</Header>
|
||||||
|
|
||||||
<SideNav bind:isOpen="{isSideNavOpen}">
|
<SideNav bind:open="{isSideNavOpen}">
|
||||||
<SideNavItems>
|
<SideNavItems>
|
||||||
{#each components.children.filter((child) => !deprecated.includes(child.title)) as child (child.path)}
|
{#each components.children.filter((child) => !deprecated.includes(child.title)) as child (child.path)}
|
||||||
<SideNavMenuItem
|
<SideNavMenuItem
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
</HeaderNav>
|
</HeaderNav>
|
||||||
</Header>
|
</Header>
|
||||||
|
|
||||||
<SideNav bind:isOpen="{isSideNavOpen}">
|
<SideNav bind:open="{isSideNavOpen}">
|
||||||
<SideNavItems>
|
<SideNavItems>
|
||||||
<SideNavLink text="Link 1" />
|
<SideNavLink text="Link 1" />
|
||||||
<SideNavLink text="Link 2" />
|
<SideNavLink text="Link 2" />
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
</HeaderNav>
|
</HeaderNav>
|
||||||
</Header>
|
</Header>
|
||||||
|
|
||||||
<SideNav bind:isOpen="{isSideNavOpen}" rail>
|
<SideNav bind:open="{isSideNavOpen}" rail>
|
||||||
<SideNavItems>
|
<SideNavItems>
|
||||||
<SideNavLink icon="{Fade}" text="Link 1" href="/" isSelected />
|
<SideNavLink icon="{Fade}" text="Link 1" href="/" isSelected />
|
||||||
<SideNavLink icon="{Fade}" text="Link 2" href="/" />
|
<SideNavLink icon="{Fade}" text="Link 2" href="/" />
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
import { expoIn } from "svelte/easing";
|
import { expoIn } from "svelte/easing";
|
||||||
|
|
||||||
let isSideNavOpen = false;
|
let isSideNavOpen = false;
|
||||||
let isOpen = false;
|
let open = false;
|
||||||
let selected = "0";
|
let selected = "0";
|
||||||
let transitions = {
|
let transitions = {
|
||||||
"0": {
|
"0": {
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
<SkipToContent />
|
<SkipToContent />
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
<HeaderUtilities>
|
<HeaderUtilities>
|
||||||
<HeaderAction bind:isOpen transition="{transitions[selected].value}">
|
<HeaderAction bind:open transition="{transitions[selected].value}">
|
||||||
<HeaderPanelLinks>
|
<HeaderPanelLinks>
|
||||||
<HeaderPanelDivider>Switcher subject 1</HeaderPanelDivider>
|
<HeaderPanelDivider>Switcher subject 1</HeaderPanelDivider>
|
||||||
<HeaderPanelLink>Switcher item 1</HeaderPanelLink>
|
<HeaderPanelLink>Switcher item 1</HeaderPanelLink>
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
</HeaderUtilities>
|
</HeaderUtilities>
|
||||||
</Header>
|
</Header>
|
||||||
|
|
||||||
<SideNav bind:isOpen="{isSideNavOpen}">
|
<SideNav bind:open="{isSideNavOpen}">
|
||||||
<SideNavItems>
|
<SideNavItems>
|
||||||
<SideNavLink text="Link 1" />
|
<SideNavLink text="Link 1" />
|
||||||
<SideNavLink text="Link 2" />
|
<SideNavLink text="Link 2" />
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
<HeaderUtilities>
|
<HeaderUtilities>
|
||||||
<HeaderGlobalAction aria-label="Settings" icon="{SettingsAdjust}" />
|
<HeaderGlobalAction aria-label="Settings" icon="{SettingsAdjust}" />
|
||||||
<HeaderAction
|
<HeaderAction
|
||||||
bind:isOpen="{isOpen1}"
|
bind:open="{isOpen1}"
|
||||||
icon="{UserAvatarFilledAlt}"
|
icon="{UserAvatarFilledAlt}"
|
||||||
closeIcon="{UserAvatarFilledAlt}"
|
closeIcon="{UserAvatarFilledAlt}"
|
||||||
>
|
>
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
<HeaderPanelLink>Switcher item 1</HeaderPanelLink>
|
<HeaderPanelLink>Switcher item 1</HeaderPanelLink>
|
||||||
</HeaderPanelLinks>
|
</HeaderPanelLinks>
|
||||||
</HeaderAction>
|
</HeaderAction>
|
||||||
<HeaderAction bind:isOpen="{isOpen2}">
|
<HeaderAction bind:open="{isOpen2}">
|
||||||
<HeaderPanelLinks>
|
<HeaderPanelLinks>
|
||||||
<HeaderPanelDivider>Switcher subject 1</HeaderPanelDivider>
|
<HeaderPanelDivider>Switcher subject 1</HeaderPanelDivider>
|
||||||
<HeaderPanelLink>Switcher item 1</HeaderPanelLink>
|
<HeaderPanelLink>Switcher item 1</HeaderPanelLink>
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
</HeaderUtilities>
|
</HeaderUtilities>
|
||||||
</Header>
|
</Header>
|
||||||
|
|
||||||
<SideNav bind:isOpen="{isSideNavOpen}">
|
<SideNav bind:open="{isSideNavOpen}">
|
||||||
<SideNavItems>
|
<SideNavItems>
|
||||||
<SideNavLink text="Link 1" />
|
<SideNavLink text="Link 1" />
|
||||||
<SideNavLink text="Link 2" />
|
<SideNavLink text="Link 2" />
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
</HeaderNav>
|
</HeaderNav>
|
||||||
</Header>
|
</Header>
|
||||||
|
|
||||||
<SideNav bind:isOpen="{isSideNavOpen}">
|
<SideNav bind:open="{isSideNavOpen}">
|
||||||
<SideNavItems>
|
<SideNavItems>
|
||||||
<SideNavLink text="Link 1" />
|
<SideNavLink text="Link 1" />
|
||||||
<SideNavLink text="Link 2" />
|
<SideNavLink text="Link 2" />
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
export let ariaLabel = undefined;
|
export let ariaLabel = undefined;
|
||||||
|
|
||||||
/** Set to `true` to toggle the open state */
|
/** Set to `true` to toggle the open state */
|
||||||
export let isOpen = false;
|
export let open = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify the icon to render for the closed state.
|
* Specify the icon to render for the closed state.
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
class:bx--header__menu-toggle="{true}"
|
class:bx--header__menu-toggle="{true}"
|
||||||
{...$$restProps}
|
{...$$restProps}
|
||||||
on:click
|
on:click
|
||||||
on:click="{() => (isOpen = !isOpen)}"
|
on:click="{() => (open = !open)}"
|
||||||
>
|
>
|
||||||
<svelte:component this="{isOpen ? iconClose : iconMenu}" size="{20}" />
|
<svelte:component this="{open ? iconClose : iconMenu}" size="{20}" />
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
<slot name="skip-to-content" />
|
<slot name="skip-to-content" />
|
||||||
{#if ($shouldRenderHamburgerMenu && winWidth < expansionBreakpoint) || persistentHamburgerMenu}
|
{#if ($shouldRenderHamburgerMenu && winWidth < expansionBreakpoint) || persistentHamburgerMenu}
|
||||||
<HamburgerMenu
|
<HamburgerMenu
|
||||||
bind:isOpen="{isSideNavOpen}"
|
bind:open="{isSideNavOpen}"
|
||||||
iconClose="{iconClose}"
|
iconClose="{iconClose}"
|
||||||
iconMenu="{iconMenu}"
|
iconMenu="{iconMenu}"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** Set to `true` to open the panel */
|
/** Set to `true` to open the panel */
|
||||||
export let isOpen = false;
|
export let open = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify the icon to render when the action panel is closed.
|
* Specify the icon to render when the action panel is closed.
|
||||||
|
@ -54,12 +54,12 @@
|
||||||
<svelte:window
|
<svelte:window
|
||||||
on:click="{({ target }) => {
|
on:click="{({ target }) => {
|
||||||
if (
|
if (
|
||||||
isOpen &&
|
open &&
|
||||||
!ref.contains(target) &&
|
!ref.contains(target) &&
|
||||||
!refPanel.contains(target) &&
|
!refPanel.contains(target) &&
|
||||||
!preventCloseOnClickOutside
|
!preventCloseOnClickOutside
|
||||||
) {
|
) {
|
||||||
isOpen = false;
|
open = false;
|
||||||
dispatch('close');
|
dispatch('close');
|
||||||
}
|
}
|
||||||
}}"
|
}}"
|
||||||
|
@ -69,16 +69,16 @@
|
||||||
bind:this="{ref}"
|
bind:this="{ref}"
|
||||||
type="button"
|
type="button"
|
||||||
class:bx--header__action="{true}"
|
class:bx--header__action="{true}"
|
||||||
class:bx--header__action--active="{isOpen}"
|
class:bx--header__action--active="{open}"
|
||||||
class:action-text="{text}"
|
class:action-text="{text}"
|
||||||
{...$$restProps}
|
{...$$restProps}
|
||||||
on:click
|
on:click
|
||||||
on:click|stopPropagation="{() => {
|
on:click|stopPropagation="{() => {
|
||||||
isOpen = !isOpen;
|
open = !open;
|
||||||
dispatch(isOpen ? 'open' : 'close');
|
dispatch(open ? 'open' : 'close');
|
||||||
}}"
|
}}"
|
||||||
>
|
>
|
||||||
{#if isOpen}
|
{#if open}
|
||||||
<slot name="closeIcon">
|
<slot name="closeIcon">
|
||||||
<svelte:component this="{closeIcon}" size="{20}" />
|
<svelte:component this="{closeIcon}" size="{20}" />
|
||||||
</slot>
|
</slot>
|
||||||
|
@ -91,7 +91,7 @@
|
||||||
{#if text}<span>{text}</span>{/if}
|
{#if text}<span>{text}</span>{/if}
|
||||||
</slot>
|
</slot>
|
||||||
</button>
|
</button>
|
||||||
{#if isOpen}
|
{#if open}
|
||||||
<div
|
<div
|
||||||
bind:this="{refPanel}"
|
bind:this="{refPanel}"
|
||||||
class:bx--header-panel="{true}"
|
class:bx--header-panel="{true}"
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
export let ariaLabel = undefined;
|
export let ariaLabel = undefined;
|
||||||
|
|
||||||
/** Set to `true` to toggle the expanded state */
|
/** Set to `true` to toggle the expanded state */
|
||||||
export let isOpen = false;
|
export let open = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The window width (px) at which the SideNav is expanded and the hamburger menu is hidden.
|
* The window width (px) at which the SideNav is expanded and the hamburger menu is hidden.
|
||||||
|
@ -42,8 +42,8 @@
|
||||||
|
|
||||||
let winWidth = undefined;
|
let winWidth = undefined;
|
||||||
|
|
||||||
$: dispatch(isOpen ? "open" : "close");
|
$: dispatch(open ? "open" : "close");
|
||||||
$: $isSideNavCollapsed = !isOpen;
|
$: $isSideNavCollapsed = !open;
|
||||||
$: $isSideNavRail = rail;
|
$: $isSideNavRail = rail;
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
@ -60,23 +60,23 @@
|
||||||
<div
|
<div
|
||||||
on:click="{() => {
|
on:click="{() => {
|
||||||
dispatch('click:overlay');
|
dispatch('click:overlay');
|
||||||
isOpen = false;
|
open = false;
|
||||||
}}"
|
}}"
|
||||||
class:bx--side-nav__overlay="{true}"
|
class:bx--side-nav__overlay="{true}"
|
||||||
class:bx--side-nav__overlay-active="{isOpen}"
|
class:bx--side-nav__overlay-active="{open}"
|
||||||
style:z-index="{isOpen ? 6000 : undefined}"
|
style:z-index="{open ? 6000 : undefined}"
|
||||||
></div>
|
></div>
|
||||||
{/if}
|
{/if}
|
||||||
<nav
|
<nav
|
||||||
aria-hidden="{!isOpen}"
|
aria-hidden="{!open}"
|
||||||
aria-label="{ariaLabel}"
|
aria-label="{ariaLabel}"
|
||||||
class:bx--side-nav__navigation="{true}"
|
class:bx--side-nav__navigation="{true}"
|
||||||
class:bx--side-nav="{true}"
|
class:bx--side-nav="{true}"
|
||||||
class:bx--side-nav--ux="{true}"
|
class:bx--side-nav--ux="{true}"
|
||||||
class:bx--side-nav--expanded="{rail && winWidth >= expansionBreakpoint
|
class:bx--side-nav--expanded="{rail && winWidth >= expansionBreakpoint
|
||||||
? false
|
? false
|
||||||
: isOpen}"
|
: open}"
|
||||||
class:bx--side-nav--collapsed="{!isOpen && !rail}"
|
class:bx--side-nav--collapsed="{!open && !rail}"
|
||||||
class:bx--side-nav--rail="{rail}"
|
class:bx--side-nav--rail="{rail}"
|
||||||
{...$$restProps}
|
{...$$restProps}
|
||||||
>
|
>
|
||||||
|
|
2
types/UIShell/HeaderAction.svelte.d.ts
vendored
2
types/UIShell/HeaderAction.svelte.d.ts
vendored
|
@ -8,7 +8,7 @@ export interface HeaderActionProps extends RestProps {
|
||||||
* Set to `true` to open the panel
|
* Set to `true` to open the panel
|
||||||
* @default false
|
* @default false
|
||||||
*/
|
*/
|
||||||
isOpen?: boolean;
|
open?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify the icon to render when the action panel is closed.
|
* Specify the icon to render when the action panel is closed.
|
||||||
|
|
2
types/UIShell/SideNav.svelte.d.ts
vendored
2
types/UIShell/SideNav.svelte.d.ts
vendored
|
@ -26,7 +26,7 @@ export interface SideNavProps extends RestProps {
|
||||||
* Set to `true` to toggle the expanded state
|
* Set to `true` to toggle the expanded state
|
||||||
* @default false
|
* @default false
|
||||||
*/
|
*/
|
||||||
isOpen?: boolean;
|
open?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The window width (px) at which the SideNav is expanded and the hamburger menu is hidden.
|
* The window width (px) at which the SideNav is expanded and the hamburger menu is hidden.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue