diff --git a/v2/pink-sb/src/lib/index.ts b/v2/pink-sb/src/lib/index.ts index c10ed07de6..d74d1b79b2 100644 --- a/v2/pink-sb/src/lib/index.ts +++ b/v2/pink-sb/src/lib/index.ts @@ -19,6 +19,7 @@ export { default as Layout } from './layout/index.js'; export { default as Input } from './input/index.js'; export { default as Selector } from './selector/index.js'; export { default as Tabs } from './tabs/index.js'; +export { default as OverflowTabs } from './lab/overflow-tabs/index.js'; export { default as ActionList } from './action-list/index.js'; export { default as ActionMenu } from './action-menu/index.js'; export { default as Upload } from './upload/index.js'; diff --git a/v2/pink-sb/src/lib/lab/overflow-tabs/Button.svelte b/v2/pink-sb/src/lib/lab/overflow-tabs/Button.svelte new file mode 100644 index 0000000000..ed0056831c --- /dev/null +++ b/v2/pink-sb/src/lib/lab/overflow-tabs/Button.svelte @@ -0,0 +1,51 @@ + + + + + diff --git a/v2/pink-sb/src/lib/lab/overflow-tabs/Link.svelte b/v2/pink-sb/src/lib/lab/overflow-tabs/Link.svelte new file mode 100644 index 0000000000..41e22067fc --- /dev/null +++ b/v2/pink-sb/src/lib/lab/overflow-tabs/Link.svelte @@ -0,0 +1,54 @@ + + + + + + + diff --git a/v2/pink-sb/src/lib/lab/overflow-tabs/Root.svelte b/v2/pink-sb/src/lib/lab/overflow-tabs/Root.svelte new file mode 100644 index 0000000000..bca5e05375 --- /dev/null +++ b/v2/pink-sb/src/lib/lab/overflow-tabs/Root.svelte @@ -0,0 +1,178 @@ + + + + +
+ + + {#if hasOverflow} + { + return { + label: item.text, + value: item.text.toLocaleLowerCase() + }; + })} + /> + {/if} +
+ + diff --git a/v2/pink-sb/src/lib/lab/overflow-tabs/_tabs.scss b/v2/pink-sb/src/lib/lab/overflow-tabs/_tabs.scss new file mode 100644 index 0000000000..65844fb579 --- /dev/null +++ b/v2/pink-sb/src/lib/lab/overflow-tabs/_tabs.scss @@ -0,0 +1,89 @@ +@use '../../../scss/mixins/transitions'; + +@mixin base { + @include transitions.common; + cursor: pointer; + display: inline-flex; + padding: var(--space-3) var(--space-6); + justify-content: center; + align-items: center; + gap: var(--space-3); + outline-offset: var(--border-width-m); + border: var(--border-width-s) solid transparent; + white-space: nowrap; + + color: var(--color-fgcolor-neutral-secondary); + text-align: center; + font-family: var(--font-family-sansserif); + font-size: var(--font-size-s); + font-style: normal; + font-weight: 400; + line-height: 140%; /* 19.6px */ + letter-spacing: -0.063px; + + &.tab- { + &primary { + background: var(--color-bgcolor-neutral-secondary); + border-radius: var(--border-radius-s); + + &:not(.active):not(&:disabled):not(&[aria-disabled='true']) { + &:hover, + &:active { + background: var(--color-overlay-neutral-hover); + } + } + + &.active { + color: var(--color-fgcolor-neutral-primary); + border: var(--border-width-s) solid var(--color-border-neutral); + background: var(--color-bgcolor-neutral-primary); + box-shadow: + 0px 1px 3px 0px rgba(0, 0, 0, 0.03), + 0px 4px 4px 0px rgba(0, 0, 0, 0.04); + } + + &:disabled, + &[aria-disabled='true'] { + cursor: default; + opacity: 0.4; + background: var(--color-bgcolor-neutral-secondary); + } + + &:focus-visible { + outline: var(--border-width-l) solid var(--color-border-focus); + z-index: 1000; + } + } + + &secondary { + background: transparent; + &:not(.active):not(&:disabled):not(&[aria-disabled='true']) { + &:hover, + &:active { + color: var(--color-fgcolor-neutral-primary); + } + } + + &.active { + color: var(--color-fgcolor-neutral-primary); + font-weight: 500; + // border: var(--border-width-s) solid var(--color-border-neutral); + // background: var(--color-bgcolor-neutral-primary); + border-block-end: 1px solid var(--color-border-neutral-strongest); + } + + &:disabled, + &[aria-disabled='true'] { + cursor: default; + opacity: 0.4; + } + + &:focus-visible { + outline: var(--border-width-l) solid var(--color-border-focus); + } + } + &stretch { + flex: 1; + } + } +} diff --git a/v2/pink-sb/src/lib/lab/overflow-tabs/index.ts b/v2/pink-sb/src/lib/lab/overflow-tabs/index.ts new file mode 100644 index 0000000000..32de2336fa --- /dev/null +++ b/v2/pink-sb/src/lib/lab/overflow-tabs/index.ts @@ -0,0 +1,11 @@ +import Root from './Root.svelte'; +import Link from './Link.svelte'; +import Button from './Button.svelte'; + +export default { + Root, + Item: { + Link, + Button + } +}; diff --git a/v2/pink-sb/src/lib/lab/overflow-tabs/types.ts b/v2/pink-sb/src/lib/lab/overflow-tabs/types.ts new file mode 100644 index 0000000000..65af7f01ab --- /dev/null +++ b/v2/pink-sb/src/lib/lab/overflow-tabs/types.ts @@ -0,0 +1,10 @@ +export type Variant = 'primary' | 'secondary'; + +export type RootContext = { + variant: Variant; + stretch: boolean; + updateTabWidths: (width: number) => void; + registerTabNode: (node: HTMLElement) => { destroy: () => void }; + hasOverflow: boolean; + overflowedItems: { text: string; disabled: boolean; active: boolean }[]; +}; diff --git a/v2/pink-sb/src/stories/OverflowTabs.stories.svelte b/v2/pink-sb/src/stories/OverflowTabs.stories.svelte new file mode 100644 index 0000000000..fb32984cfa --- /dev/null +++ b/v2/pink-sb/src/stories/OverflowTabs.stories.svelte @@ -0,0 +1,25 @@ + + + + + + + Tab Item + Really long Tab Item + Tab Item + Tab Item + Tab Item + Tab Item + +