scb-wc-test 0.1.71 → 0.1.73

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/all.js CHANGED
@@ -43,6 +43,7 @@ import './mvc/components/scb-menu/scb-menu.js';
43
43
  import './mvc/components/scb-menu/scb-sub-menu.js';
44
44
  import './mvc/components/scb-notification/scb-notification.js';
45
45
  import './mvc/components/scb-notification-card/scb-notification-card.js';
46
+ import './mvc/components/scb-pagination/scb-pagination.js';
46
47
  import './mvc/components/scb-progress-indicator/scb-progress-indicator.js';
47
48
  import './mvc/components/scb-radio-button/scb-radio-button.js';
48
49
  import './mvc/components/scb-radio-button/scb-radio-group.js';
@@ -105,6 +106,7 @@ import './scb-menu/scb-menu.js';
105
106
  import './scb-menu/scb-sub-menu.js';
106
107
  import './scb-notification/scb-notification.js';
107
108
  import './scb-notification-card/scb-notification-card.js';
109
+ import './scb-pagination/scb-pagination.js';
108
110
  import './scb-progress-indicator/scb-progress-indicator.js';
109
111
  import './scb-radio-button/scb-radio-button.js';
110
112
  import './scb-radio-button/scb-radio-group.js';
package/index.d.ts CHANGED
@@ -40,6 +40,7 @@ export * from './scb-menu/scb-menu';
40
40
  export * from './scb-menu/scb-sub-menu';
41
41
  export * from './scb-notification/scb-notification';
42
42
  export * from './scb-notification-card/scb-notification-card';
43
+ export * from './scb-pagination/scb-pagination';
43
44
  export * from './scb-progress-indicator/scb-progress-indicator';
44
45
  export * from './scb-radio-button/scb-radio-button';
45
46
  export * from './scb-radio-button/scb-radio-group';
package/index.js CHANGED
@@ -8,13 +8,13 @@ import { SCBBreadcrumb as n } from "./scb-breadcrumb/scb-breadcrumb.js";
8
8
  import { ScbButton as C } from "./scb-button/scb-button.js";
9
9
  import { ScbCalendarCard as l } from "./scb-calendar-card/scb-calendar-card.js";
10
10
  import { ScbCard as D } from "./scb-card/scb-card.js";
11
- import { ScbCheckboxGroup as w } from "./scb-checkbox/scb-checkbox-group.js";
11
+ import { ScbCheckboxGroup as g } from "./scb-checkbox/scb-checkbox-group.js";
12
12
  import { ScbCheckbox as s } from "./scb-checkbox/scb-checkbox.js";
13
13
  import { ScbChip as H } from "./scb-chip/scb-chip.js";
14
14
  import { ScbDialog as k } from "./scb-dialog/scb-dialog.js";
15
15
  import { ScbDivider as y } from "./scb-divider/scb-divider.js";
16
- import { ScbDrawerItem as L } from "./scb-drawer/scb-drawer-item.js";
17
- import { ScbDrawerSection as P } from "./scb-drawer/scb-drawer-section.js";
16
+ import { ScbDrawerItem as P } from "./scb-drawer/scb-drawer-item.js";
17
+ import { ScbDrawerSection as M } from "./scb-drawer/scb-drawer-section.js";
18
18
  import { ScbDrawer as N } from "./scb-drawer/scb-drawer.js";
19
19
  import { ScbSubDrawer as z } from "./scb-drawer/scb-sub-drawer.js";
20
20
  import { ScbFactCardContent as U } from "./scb-fact-card/scb-fact-card-content.js";
@@ -35,27 +35,28 @@ import { ScbKeyFigureCard as nr } from "./scb-keyfigure-card/scb-keyfigure-card.
35
35
  import { ScbLink as Cr } from "./scb-link/scb-link.js";
36
36
  import { ScbListItem as lr } from "./scb-list/scb-list-item.js";
37
37
  import { ScbList as Dr } from "./scb-list/scb-list.js";
38
- import { ScbMenuItem as wr } from "./scb-menu/scb-menu-item.js";
38
+ import { ScbMenuItem as gr } from "./scb-menu/scb-menu-item.js";
39
39
  import { ScbMenu as sr } from "./scb-menu/scb-menu.js";
40
40
  import { ScbSubMenu as Hr } from "./scb-menu/scb-sub-menu.js";
41
41
  import { ScbNotification as kr } from "./scb-notification/scb-notification.js";
42
42
  import { ScbNotificationCard as yr } from "./scb-notification-card/scb-notification-card.js";
43
- import { ScbProgressIndicator as Lr } from "./scb-progress-indicator/scb-progress-indicator.js";
44
- import { ScbRadioButton as Pr } from "./scb-radio-button/scb-radio-button.js";
45
- import { ScbRadioGroup as Nr } from "./scb-radio-button/scb-radio-group.js";
46
- import { ScbSearch as zr } from "./scb-search/scb-search.js";
47
- import { ScbSegmentedButton as Ur } from "./scb-segmented-button/scb-segmented-button.js";
48
- import { ScbSegmentedItem as qr } from "./scb-segmented-button/scb-segmented-item.js";
49
- import { ScbSnackbar as Jr } from "./scb-snackbar/scb-snackbar.js";
50
- import { ScbStatusPill as Qr } from "./scb-status-pill/scb-status-pill.js";
51
- import { ScbSwitch as Wr } from "./scb-switch/scb-switch.js";
52
- import { ScbPrimaryTab as Yr } from "./scb-tabs/scb-primary-tab.js";
53
- import { ScbSecondaryTab as _r } from "./scb-tabs/scb-secondary-tab.js";
54
- import { ScbTabs as ro } from "./scb-tabs/scb-tabs.js";
55
- import { ScbTextField2 as eo } from "./scb-textfield/scb-textfield.js";
56
- import { ScbTocItem as co } from "./scb-toc/scb-toc-item.js";
57
- import { ScbToc as So } from "./scb-toc/scb-toc.js";
58
- import { ScbTooltip as po } from "./scb-tooltip/scb-tooltip.js";
43
+ import { ScbPagination as Pr } from "./scb-pagination/scb-pagination.js";
44
+ import { ScbProgressIndicator as Mr } from "./scb-progress-indicator/scb-progress-indicator.js";
45
+ import { ScbRadioButton as Nr } from "./scb-radio-button/scb-radio-button.js";
46
+ import { ScbRadioGroup as zr } from "./scb-radio-button/scb-radio-group.js";
47
+ import { ScbSearch as Ur } from "./scb-search/scb-search.js";
48
+ import { ScbSegmentedButton as qr } from "./scb-segmented-button/scb-segmented-button.js";
49
+ import { ScbSegmentedItem as Jr } from "./scb-segmented-button/scb-segmented-item.js";
50
+ import { ScbSnackbar as Qr } from "./scb-snackbar/scb-snackbar.js";
51
+ import { ScbStatusPill as Wr } from "./scb-status-pill/scb-status-pill.js";
52
+ import { ScbSwitch as Yr } from "./scb-switch/scb-switch.js";
53
+ import { ScbPrimaryTab as _r } from "./scb-tabs/scb-primary-tab.js";
54
+ import { ScbSecondaryTab as ro } from "./scb-tabs/scb-secondary-tab.js";
55
+ import { ScbTabs as eo } from "./scb-tabs/scb-tabs.js";
56
+ import { ScbTextField2 as co } from "./scb-textfield/scb-textfield.js";
57
+ import { ScbTocItem as So } from "./scb-toc/scb-toc-item.js";
58
+ import { ScbToc as po } from "./scb-toc/scb-toc.js";
59
+ import { ScbTooltip as fo } from "./scb-tooltip/scb-tooltip.js";
59
60
  export {
60
61
  n as SCBBreadcrumb,
61
62
  i as SCBBreadcrumbItem,
@@ -68,13 +69,13 @@ export {
68
69
  l as ScbCalendarCard,
69
70
  D as ScbCard,
70
71
  s as ScbCheckbox,
71
- w as ScbCheckboxGroup,
72
+ g as ScbCheckboxGroup,
72
73
  H as ScbChip,
73
74
  k as ScbDialog,
74
75
  y as ScbDivider,
75
76
  N as ScbDrawer,
76
- L as ScbDrawerItem,
77
- P as ScbDrawerSection,
77
+ P as ScbDrawerItem,
78
+ M as ScbDrawerSection,
78
79
  q as ScbFactCard,
79
80
  U as ScbFactCardContent,
80
81
  Q as ScbFooter,
@@ -93,26 +94,27 @@ export {
93
94
  Dr as ScbList,
94
95
  lr as ScbListItem,
95
96
  sr as ScbMenu,
96
- wr as ScbMenuItem,
97
+ gr as ScbMenuItem,
97
98
  kr as ScbNotification,
98
99
  yr as ScbNotificationCard,
99
- Yr as ScbPrimaryTab,
100
- Lr as ScbProgressIndicator,
101
- Pr as ScbRadioButton,
102
- Nr as ScbRadioGroup,
103
- zr as ScbSearch,
104
- _r as ScbSecondaryTab,
105
- Ur as ScbSegmentedButton,
106
- qr as ScbSegmentedItem,
107
- Jr as ScbSnackbar,
100
+ Pr as ScbPagination,
101
+ _r as ScbPrimaryTab,
102
+ Mr as ScbProgressIndicator,
103
+ Nr as ScbRadioButton,
104
+ zr as ScbRadioGroup,
105
+ Ur as ScbSearch,
106
+ ro as ScbSecondaryTab,
107
+ qr as ScbSegmentedButton,
108
+ Jr as ScbSegmentedItem,
109
+ Qr as ScbSnackbar,
108
110
  _ as ScbStack,
109
- Qr as ScbStatusPill,
111
+ Wr as ScbStatusPill,
110
112
  z as ScbSubDrawer,
111
113
  Hr as ScbSubMenu,
112
- Wr as ScbSwitch,
113
- ro as ScbTabs,
114
- eo as ScbTextField2,
115
- So as ScbToc,
116
- co as ScbTocItem,
117
- po as ScbTooltip
114
+ Yr as ScbSwitch,
115
+ eo as ScbTabs,
116
+ co as ScbTextField2,
117
+ po as ScbToc,
118
+ So as ScbTocItem,
119
+ fo as ScbTooltip
118
120
  };
@@ -40,6 +40,7 @@ import './scb-menu/scb-menu-item.js';
40
40
  import './scb-menu/scb-sub-menu.js';
41
41
  import './scb-notification-card/scb-notification-card.js';
42
42
  import './scb-notification/scb-notification.js';
43
+ import './scb-pagination/scb-pagination.js';
43
44
  import './scb-progress-indicator/scb-progress-indicator.js';
44
45
  import './scb-radio-button/scb-radio-button.js';
45
46
  import './scb-radio-button/scb-radio-group.js';
@@ -1,24 +1,24 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../scb-drawer/scb-drawer.js","../../vendor/preload-helper.js","../../vendor/vendor.js","../scb-divider/scb-divider.js","../scb-tabs/scb-tabs.js","../../vendor/vendor-material.js","../scb-tabs/scb-primary-tab.js","../scb-tabs/scb-secondary-tab.js","../scb-search/scb-search.js","../scb-list/scb-list.js","../scb-list/scb-list-item.js"])))=>i.map(i=>d[i]);
2
- import{_ as g}from"../../vendor/preload-helper.js";import{a as x,n as l,r as u,i as S,x as c,E as d,t as C}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";import"../scb-grid/scb-grid-item.js";import"../scb-grid/scb-grid.js";import"../scb-link/scb-link.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-button/scb-button.js";import"../scb-tooltip/scb-tooltip.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(s,a,o){try{customElements.get(s)||t(s,a,o)}catch(n){var h=String(n||"");if(h.indexOf("already been used")===-1&&h.indexOf("NotSupportedError")===-1)throw n}}}}catch{}})();var T=Object.defineProperty,A=Object.getOwnPropertyDescriptor,i=(e,t,s,a)=>{for(var o=a>1?void 0:a?A(t,s):t,h=e.length-1,n;h>=0;h--)(n=e[h])&&(o=(a?n(t,s,o):n(o))||o);return a&&o&&T(t,s,o),o};const w={fromAttribute:e=>e==null?!0:!/^(false|0|off|no)$/i.test(e),toAttribute:e=>String(!!e)};let r=class extends S{constructor(){super(...arguments),this.maxWidth="1440px",this.logoText="",this.logoHref="/",this.banner=!1,this.tabs=[],this.activeTab=0,this.utilityItems=[],this.showDrawer=!0,this.showSearch=!0,this.includeUtilityInDrawer=!1,this._drawerId="main-drawer",this._drawerMounted=!1,this._drawerExpanded=!1,this._searchId="header-search",this._slotTabs=[],this._slotUtils=[],this._slotMenu=[],this._measureScheduled=!1,this._scheduleMeasure=()=>{this._measureScheduled||(this._measureScheduled=!0,requestAnimationFrame(()=>{this._measureScheduled=!1,this._measure()}))},this._onWindowResize=()=>{this._scheduleMeasure()},this._onDrawerSelect=e=>{this.dispatchEvent(new CustomEvent("drawer-select",{detail:e.detail,bubbles:!0,composed:!0})),this._closeDrawerNow()},this._collapsed=!1,this._unlockAtWidth=0,this._hideLogoText=!1,this._logoTextUnlockAt=0,this._harvestPending=!1,this.__drawerLoaded=!1,this.__tabsLoaded=!1,this.__searchLoaded=!1,this._harvest=()=>{const e=this._slotEl;if(!e)return;const t=e.assignedElements({flatten:!0}),s=[],a=[],o=[],h=n=>({label:n.getAttribute("label")??"",href:n.getAttribute("href")??void 0,icon:n.getAttribute("icon")??void 0});for(const n of t){const p=n.tagName.toLowerCase();if(p==="scb-header-tab"){s.push({label:n.getAttribute("label")??"",href:n.getAttribute("href")??"#"});continue}if(p==="scb-header-utility"){a.push({label:n.getAttribute("label")??"",href:n.getAttribute("href")??"#",target:n.getAttribute("target")??void 0});continue}if(p==="scb-header-drawer-group"){const b={label:n.getAttribute("label")??"",icon:n.getAttribute("icon")??void 0,children:[]};n.querySelectorAll("scb-header-drawer-item").forEach(m=>b.children.push(h(m))),o.push(b);continue}p==="scb-header-drawer-item"&&o.push(h(n))}this._slotTabs=s,this._slotUtils=a,this._slotMenu=o,queueMicrotask(()=>{this.updateComplete.then(()=>{this._applyActiveToTabs(),this._scheduleMeasure()})})},this._measure=()=>{const e=this._top,t=this._logoGroup;if(!e||!t)return;const s=window.innerWidth,a=e.clientWidth,o=this._overflows(this._util),h=this._overflows(this._tabsEl),n=s<this.BP_MD||o||h;this._collapsed?!n&&a>=this._unlockAtWidth&&this._setCollapsed(!1):n&&(this._unlockAtWidth=a+this._HYST,this._setCollapsed(!0));let p=!1;if(this.showSearch&&s>=this.BP_SM&&s<this.BP_MD&&this._searchWrap){const m=getComputedStyle(this._searchWrap),y=Math.max(this._num(m.minWidth,this._tokenPx("--scb-header-search-min",320)),this._tokenPx("--scb-header-search-min",320)),_=this._num(getComputedStyle(e).gap,this._tokenPx("--spacing-7",24)),f=this.showDrawer&&(s<this.BP_MD||this._collapsed)?this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-large",48):0;p=t.getBoundingClientRect().width+_+y+_+f+8>a+.5}this._setHideSearch(p);let b=!1;if(this.showDrawer&&(s<this.BP_MD||this._collapsed)&&!this._visible(this._util)&&!this._visible(this._searchWrap)){const m=this._num(getComputedStyle(e).gap,this._tokenPx("--spacing-7",24)),y=this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-large",48),_=(this._logoGroup?.getBoundingClientRect().width||0)+m+y;this._hideLogoText?b=!(a>=this._logoTextUnlockAt):_>a+.5&&(b=!0,this._logoTextUnlockAt=a+this._HYST)}else b=!1,this._logoTextUnlockAt=0;this._setHideLogoText(b)},this._onMenuClick=async e=>{e.preventDefault(),e.stopPropagation(),this.showDrawer&&(this.dispatchEvent(new CustomEvent("menu-click",{bubbles:!0,composed:!0})),await this._ensureDrawerMounted(),await r._nextFrame(),await r._nextFrame(),this._openDrawerNow())},this._onSearchClick=e=>{const t=this._searchEl;if(t?.submit&&typeof t.submit=="function"){t.submit();return}const s=t?.value??void 0;this.dispatchEvent(new CustomEvent("search-click",{detail:{value:s},bubbles:!0,composed:!0})),t?.focus?.()},this._onTabsChange=e=>{const s=e?.detail?.activeTabIndex??e.target?.activeTabIndex??0;this.activeTab=s;const o=(this._slotTabs.length?this._slotTabs:this.tabs)[s]?.href??"";this.dispatchEvent(new CustomEvent("tab-change",{detail:{index:s,href:o},bubbles:!0,composed:!0}))}}get _HYST(){return this._tokenPx("--spacing-11",64)}get BP_SM(){return this._tokenPx("--bp-sm",r.BP_SM_DEFAULT)}get BP_MD(){return this._tokenPx("--bp-md",r.BP_MD_DEFAULT)}_scheduleHarvest(){this._harvestPending||(this._harvestPending=!0,queueMicrotask(()=>{this._harvestPending=!1,this._harvest()}))}async __ensureDrawer(){if(!this.__drawerLoaded)return this.__ensureDrawerPromise??(this.__ensureDrawerPromise=(async()=>{await g(()=>import("../scb-drawer/scb-drawer.js"),__vite__mapDeps([0,1,2,3]),import.meta.url),this.__drawerLoaded=!0})()),this.__ensureDrawerPromise}async __ensureTabs(){if(!this.__tabsLoaded)return this.__ensureTabsPromise??(this.__ensureTabsPromise=(async()=>{await Promise.all([g(()=>import("../scb-tabs/scb-tabs.js"),__vite__mapDeps([4,5,2,6,1,7]),import.meta.url),g(()=>import("../scb-tabs/scb-secondary-tab.js"),__vite__mapDeps([7,1,5,2]),import.meta.url)]),this.__tabsLoaded=!0})()),this.__ensureTabsPromise}async __ensureSearch(){if(!this.__searchLoaded)return this.__ensureSearchPromise??(this.__ensureSearchPromise=(async()=>{await g(()=>import("../scb-search/scb-search.js"),__vite__mapDeps([8,2,9,1,10,5]),import.meta.url),this.__searchLoaded=!0})()),this.__ensureSearchPromise}get _slotEl(){return this.shadowRoot?.querySelector("slot#data-slot")??null}get _top(){return this.renderRoot.querySelector(".top-row")}get _util(){return this.renderRoot.querySelector(".utility")}get _tabsEl(){return this.renderRoot.querySelector("scb-tabs")}get _logoGroup(){return this.renderRoot.querySelector(".logo-wrap")||this.renderRoot.querySelector(".logo-group")}get _searchWrap(){return this.renderRoot.querySelector(".search")}get _menuBtn(){return this.renderRoot.querySelector(".menu-trigger")}get _searchEl(){return this.renderRoot.querySelector(`#${this._searchId}`)}_attachSlotObservers(){this._slotMo?.disconnect();const e=new MutationObserver(t=>{this._scheduleHarvest()});this._slotMo=e,e.observe(this,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["label","href","icon","target"]})}_setCollapsed(e){this._collapsed!==e&&(this._collapsed=e,e?this.setAttribute("data-collapsed",""):this.removeAttribute("data-collapsed"))}_setHideSearch(e){e?this.setAttribute("data-hide-search",""):this.removeAttribute("data-hide-search")}_setHideLogoText(e){this._hideLogoText!==e&&(this._hideLogoText=e,e?this.setAttribute("data-hide-logo-text",""):this.removeAttribute("data-hide-logo-text"))}_num(e,t){const s=Number.parseFloat(String(e??"").trim());return Number.isFinite(s)?s:t}_tokenPx(e,t){const s=getComputedStyle(this);return this._num(s.getPropertyValue(e),t)}_visible(e){return e?getComputedStyle(e).display!=="none":!1}_overflows(e){return!e||!this._visible(e)?!1:e.scrollWidth>e.clientWidth+1}firstUpdated(){this.updateComplete.then(()=>{this._harvest(),this._attachSlotObservers()});const e=this._top;e&&(this._ro=new ResizeObserver(()=>this._scheduleMeasure()),this._ro.observe(e)),window.addEventListener("resize",this._onWindowResize,{passive:!0});const t=this._menuBtn,s=()=>this._ensureDrawerMounted();t?.addEventListener("pointerenter",s,{once:!0}),t?.addEventListener("focusin",s,{once:!0}),t?.addEventListener("touchstart",s,{once:!0,passive:!0});const a=o=>"requestIdleCallback"in window?window.requestIdleCallback(o,{timeout:1500}):setTimeout(o,600);this.showDrawer&&a(()=>{this.__ensureDrawer()}),this._collapsed||a(()=>{this.__ensureTabs()}),this.showSearch&&a(()=>{this.__ensureSearch()})}updated(e){e.has("searchMax")&&this.style.setProperty("--scb-header-search-max",this.searchMax??"480px"),e.has("searchMin")&&this.style.setProperty("--scb-header-search-min",this.searchMin??"320px"),e.has("searchHeight")&&(this.searchHeight&&this.searchHeight.trim()?this.style.setProperty("--scb-search-height",this.searchHeight.trim()):this.style.removeProperty("--scb-search-height")),(e.has("utilityItems")||e.has("tabs")||e.has("logoText")||e.has("activeTab")||e.has("_slotTabs")||e.has("_slotUtils")||e.has("_slotMenu")||e.has("showDrawer")||e.has("showSearch")||e.has("searchMax")||e.has("searchMin"))&&this.updateComplete.then(()=>{this._scheduleMeasure(),this._applyActiveToTabs()}),e.has("showSearch")&&this.showSearch&&!this.__searchLoaded&&this.__ensureSearch()}disconnectedCallback(){this._ro?.disconnect(),this._slotMo?.disconnect(),window.removeEventListener("resize",this._onWindowResize),super.disconnectedCallback()}async _ensureDrawerMounted(){this._drawerMounted||(await this.__ensureDrawer(),this._drawerMounted=!0,await this.updateComplete)}_openDrawerNow(){const e=this.renderRoot.querySelector(`#${this._drawerId}`);e&&(e.open=!0,e.setAttribute("open",""),e.show?.(),e.openDrawer?.(),this._drawerExpanded=!0,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent("drawer-open",{bubbles:!0,composed:!0})))}_closeDrawerNow(){const e=this.renderRoot.querySelector(`#${this._drawerId}`);e&&(e.open=!1),this._drawerExpanded=!1,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent("drawer-close",{bubbles:!0,composed:!0}))}_syncMenuBtnAria(){const e=this.renderRoot.querySelector(".menu-trigger");e&&e.setAttribute("aria-expanded",String(this._drawerExpanded))}_applyActiveToTabs(){const e=this._tabsEl;if(!e)return;e.activeTabIndex=this.activeTab,e.querySelectorAll("scb-secondary-tab").forEach((s,a)=>{s.selected=a===this.activeTab})}_renderDrawerNodes(e){return!e||e.length===0?c``:c`${e.map(t=>{const s=Array.isArray(t.children)&&t.children.length>0;return c`
2
+ import{_ as g}from"../../vendor/preload-helper.js";import{a as x,n as l,r as u,i as S,x as c,E as d,t as C}from"../../vendor/vendor.js";import"../../vendor/vendor-material.js";import"../scb-grid/scb-grid-item.js";import"../scb-grid/scb-grid.js";import"../scb-link/scb-link.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-button/scb-button.js";import"../scb-tooltip/scb-tooltip.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(r,i,o){try{customElements.get(r)||t(r,i,o)}catch(n){var h=String(n||"");if(h.indexOf("already been used")===-1&&h.indexOf("NotSupportedError")===-1)throw n}}}}catch{}})();var T=Object.defineProperty,$=Object.getOwnPropertyDescriptor,a=(e,t,r,i)=>{for(var o=i>1?void 0:i?$(t,r):t,h=e.length-1,n;h>=0;h--)(n=e[h])&&(o=(i?n(t,r,o):n(o))||o);return i&&o&&T(t,r,o),o};const v={fromAttribute:e=>e==null?!0:!/^(false|0|off|no)$/i.test(e),toAttribute:e=>String(!!e)};let s=class extends S{constructor(){super(...arguments),this.maxWidth="1440px",this.logoText="",this.logoHref="/",this.banner=!1,this.tabs=[],this.activeTab=0,this.utilityItems=[],this.showDrawer=!0,this.showSearch=!0,this.includeUtilityInDrawer=!1,this.searchText="",this._drawerId="main-drawer",this._drawerMounted=!1,this._drawerExpanded=!1,this._searchId="header-search",this._slotTabs=[],this._slotUtils=[],this._slotMenu=[],this._measureScheduled=!1,this._scheduleMeasure=()=>{this._measureScheduled||(this._measureScheduled=!0,requestAnimationFrame(()=>{this._measureScheduled=!1,this._measure()}))},this._onWindowResize=()=>{this._scheduleMeasure()},this._onDrawerSelect=e=>{this.dispatchEvent(new CustomEvent("drawer-select",{detail:e.detail,bubbles:!0,composed:!0})),this._closeDrawerNow()},this._collapsed=!1,this._unlockAtWidth=0,this._hideLogoText=!1,this._logoTextUnlockAt=0,this._harvestPending=!1,this.__drawerLoaded=!1,this.__tabsLoaded=!1,this.__searchLoaded=!1,this._harvest=()=>{const e=this._slotEl;if(!e)return;const t=e.assignedElements({flatten:!0}),r=[],i=[],o=[],h=n=>({label:n.getAttribute("label")??"",href:n.getAttribute("href")??void 0,icon:n.getAttribute("icon")??void 0});for(const n of t){const p=n.tagName.toLowerCase();if(p==="scb-header-tab"){r.push({label:n.getAttribute("label")??"",href:n.getAttribute("href")??"#"});continue}if(p==="scb-header-utility"){i.push({label:n.getAttribute("label")??"",href:n.getAttribute("href")??"#",target:n.getAttribute("target")??void 0});continue}if(p==="scb-header-drawer-group"){const b={label:n.getAttribute("label")??"",icon:n.getAttribute("icon")??void 0,children:[]};n.querySelectorAll("scb-header-drawer-item").forEach(m=>b.children.push(h(m))),o.push(b);continue}p==="scb-header-drawer-item"&&o.push(h(n))}this._slotTabs=r,this._slotUtils=i,this._slotMenu=o,queueMicrotask(()=>{this.updateComplete.then(()=>{this._applyActiveToTabs(),this._scheduleMeasure()})})},this._measure=()=>{const e=this._top,t=this._logoGroup;if(!e||!t)return;const r=window.innerWidth,i=e.clientWidth,o=this._overflows(this._util),h=this._overflows(this._tabsEl),n=r<this.BP_MD||o||h;this._collapsed?!n&&i>=this._unlockAtWidth&&this._setCollapsed(!1):n&&(this._unlockAtWidth=i+this._HYST,this._setCollapsed(!0));let p=!1;if(this.showSearch&&r>=this.BP_SM&&r<this.BP_MD&&this._searchWrap){const m=getComputedStyle(this._searchWrap),y=Math.max(this._num(m.minWidth,this._tokenPx("--scb-header-search-min",320)),this._tokenPx("--scb-header-search-min",320)),_=this._num(getComputedStyle(e).gap,this._tokenPx("--spacing-7",24)),f=this.showDrawer&&(r<this.BP_MD||this._collapsed)?this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-large",48):0;p=t.getBoundingClientRect().width+_+y+_+f+8>i+.5}this._setHideSearch(p);let b=!1;if(this.showDrawer&&(r<this.BP_MD||this._collapsed)&&!this._visible(this._util)&&!this._visible(this._searchWrap)){const m=this._num(getComputedStyle(e).gap,this._tokenPx("--spacing-7",24)),y=this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-large",48),_=(this._logoGroup?.getBoundingClientRect().width||0)+m+y;this._hideLogoText?b=!(i>=this._logoTextUnlockAt):_>i+.5&&(b=!0,this._logoTextUnlockAt=i+this._HYST)}else b=!1,this._logoTextUnlockAt=0;this._setHideLogoText(b)},this._onMenuClick=async e=>{e.preventDefault(),e.stopPropagation(),this.showDrawer&&(this.dispatchEvent(new CustomEvent("menu-click",{bubbles:!0,composed:!0})),await this._ensureDrawerMounted(),await s._nextFrame(),await s._nextFrame(),this._openDrawerNow())},this._onSearchClick=e=>{const t=this._searchEl;if(t?.submit&&typeof t.submit=="function"){t.submit();return}const r=t?.value??"";this.searchText=r,this.dispatchEvent(new CustomEvent("search-click",{detail:{value:r},bubbles:!0,composed:!0})),t?.focus?.()},this._onTabsChange=e=>{const r=e?.detail?.activeTabIndex??e.target?.activeTabIndex??0;this.activeTab=r;const o=(this._slotTabs.length?this._slotTabs:this.tabs)[r]?.href??"";this.dispatchEvent(new CustomEvent("tab-change",{detail:{index:r,href:o},bubbles:!0,composed:!0}))},this._onSearchInput=e=>{this.searchText=e.detail?.value??"",this.dispatchEvent(new CustomEvent("search-input",{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("search-text-change",{detail:{value:this.searchText},bubbles:!0,composed:!0}))},this._onSearchSubmit=e=>{this.searchText=e.detail?.value??"",this.dispatchEvent(new CustomEvent("search-change",{detail:{value:this.searchText,active:e.detail?.active},bubbles:!0,composed:!0}))},this._onSearchClear=()=>{this.searchText="",this.dispatchEvent(new CustomEvent("search-text-change",{detail:{value:""},bubbles:!0,composed:!0}))}}get _HYST(){return this._tokenPx("--spacing-11",64)}get BP_SM(){return this._tokenPx("--bp-sm",s.BP_SM_DEFAULT)}get BP_MD(){return this._tokenPx("--bp-md",s.BP_MD_DEFAULT)}_scheduleHarvest(){this._harvestPending||(this._harvestPending=!0,queueMicrotask(()=>{this._harvestPending=!1,this._harvest()}))}async __ensureDrawer(){if(!this.__drawerLoaded)return this.__ensureDrawerPromise??(this.__ensureDrawerPromise=(async()=>{await g(()=>import("../scb-drawer/scb-drawer.js"),__vite__mapDeps([0,1,2,3]),import.meta.url),this.__drawerLoaded=!0})()),this.__ensureDrawerPromise}async __ensureTabs(){if(!this.__tabsLoaded)return this.__ensureTabsPromise??(this.__ensureTabsPromise=(async()=>{await Promise.all([g(()=>import("../scb-tabs/scb-tabs.js"),__vite__mapDeps([4,5,2,6,1,7]),import.meta.url),g(()=>import("../scb-tabs/scb-secondary-tab.js"),__vite__mapDeps([7,1,5,2]),import.meta.url)]),this.__tabsLoaded=!0})()),this.__ensureTabsPromise}async __ensureSearch(){if(!this.__searchLoaded)return this.__ensureSearchPromise??(this.__ensureSearchPromise=(async()=>{await g(()=>import("../scb-search/scb-search.js"),__vite__mapDeps([8,2,9,1,10,5]),import.meta.url),this.__searchLoaded=!0})()),this.__ensureSearchPromise}get _slotEl(){return this.shadowRoot?.querySelector("slot#data-slot")??null}get _top(){return this.renderRoot.querySelector(".top-row")}get _util(){return this.renderRoot.querySelector(".utility")}get _tabsEl(){return this.renderRoot.querySelector("scb-tabs")}get _logoGroup(){return this.renderRoot.querySelector(".logo-wrap")||this.renderRoot.querySelector(".logo-group")}get _searchWrap(){return this.renderRoot.querySelector(".search")}get _menuBtn(){return this.renderRoot.querySelector(".menu-trigger")}get _searchEl(){return this.renderRoot.querySelector(`#${this._searchId}`)}_attachSlotObservers(){this._slotMo?.disconnect();const e=new MutationObserver(t=>{this._scheduleHarvest()});this._slotMo=e,e.observe(this,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["label","href","icon","target"]})}_setCollapsed(e){this._collapsed!==e&&(this._collapsed=e,e?this.setAttribute("data-collapsed",""):this.removeAttribute("data-collapsed"))}_setHideSearch(e){e?this.setAttribute("data-hide-search",""):this.removeAttribute("data-hide-search")}_setHideLogoText(e){this._hideLogoText!==e&&(this._hideLogoText=e,e?this.setAttribute("data-hide-logo-text",""):this.removeAttribute("data-hide-logo-text"))}_num(e,t){const r=Number.parseFloat(String(e??"").trim());return Number.isFinite(r)?r:t}_tokenPx(e,t){const r=getComputedStyle(this);return this._num(r.getPropertyValue(e),t)}_visible(e){return e?getComputedStyle(e).display!=="none":!1}_overflows(e){return!e||!this._visible(e)?!1:e.scrollWidth>e.clientWidth+1}firstUpdated(){this.updateComplete.then(()=>{this._harvest(),this._attachSlotObservers()});const e=this._top;e&&(this._ro=new ResizeObserver(()=>this._scheduleMeasure()),this._ro.observe(e)),window.addEventListener("resize",this._onWindowResize,{passive:!0});const t=this._menuBtn,r=()=>this._ensureDrawerMounted();t?.addEventListener("pointerenter",r,{once:!0}),t?.addEventListener("focusin",r,{once:!0}),t?.addEventListener("touchstart",r,{once:!0,passive:!0});const i=o=>"requestIdleCallback"in window?window.requestIdleCallback(o,{timeout:1500}):setTimeout(o,600);this.showDrawer&&i(()=>{this.__ensureDrawer()}),this._collapsed||i(()=>{this.__ensureTabs()}),this.showSearch&&i(()=>{this.__ensureSearch()})}updated(e){e.has("searchMax")&&this.style.setProperty("--scb-header-search-max",this.searchMax??"480px"),e.has("searchMin")&&this.style.setProperty("--scb-header-search-min",this.searchMin??"320px"),e.has("searchHeight")&&(this.searchHeight&&this.searchHeight.trim()?this.style.setProperty("--scb-search-height",this.searchHeight.trim()):this.style.removeProperty("--scb-search-height")),(e.has("utilityItems")||e.has("tabs")||e.has("logoText")||e.has("activeTab")||e.has("_slotTabs")||e.has("_slotUtils")||e.has("_slotMenu")||e.has("showDrawer")||e.has("showSearch")||e.has("searchMax")||e.has("searchMin"))&&this.updateComplete.then(()=>{this._scheduleMeasure(),this._applyActiveToTabs()}),e.has("showSearch")&&this.showSearch&&!this.__searchLoaded&&this.__ensureSearch()}disconnectedCallback(){this._ro?.disconnect(),this._slotMo?.disconnect(),window.removeEventListener("resize",this._onWindowResize),super.disconnectedCallback()}async _ensureDrawerMounted(){this._drawerMounted||(await this.__ensureDrawer(),this._drawerMounted=!0,await this.updateComplete)}_openDrawerNow(){const e=this.renderRoot.querySelector(`#${this._drawerId}`);e&&(e.open=!0,e.setAttribute("open",""),e.show?.(),e.openDrawer?.(),this._drawerExpanded=!0,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent("drawer-open",{bubbles:!0,composed:!0})))}_closeDrawerNow(){const e=this.renderRoot.querySelector(`#${this._drawerId}`);e&&(e.open=!1),this._drawerExpanded=!1,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent("drawer-close",{bubbles:!0,composed:!0}))}_syncMenuBtnAria(){const e=this.renderRoot.querySelector(".menu-trigger");e&&e.setAttribute("aria-expanded",String(this._drawerExpanded))}_applyActiveToTabs(){const e=this._tabsEl;if(!e)return;e.activeTabIndex=this.activeTab,e.querySelectorAll("scb-secondary-tab").forEach((r,i)=>{r.selected=i===this.activeTab})}_renderDrawerNodes(e){return!e||e.length===0?c``:c`${e.map(t=>{const r=Array.isArray(t.children)&&t.children.length>0;return c`
3
3
  <scb-drawer-item
4
4
  label=${t.label}
5
5
  ?selected=${!1}
6
6
  leading-icon=${t.icon??""}
7
7
  item-href=${t.href??""}
8
8
  >
9
- ${s?c`
9
+ ${r?c`
10
10
  <scb-sub-drawer label=${t.label}>
11
- ${t.children.map(a=>c`
11
+ ${t.children.map(i=>c`
12
12
  <scb-drawer-item
13
- label=${a.label}
14
- item-href=${a.href??""}
15
- leading-icon=${a.icon??""}
13
+ label=${i.label}
14
+ item-href=${i.href??""}
15
+ leading-icon=${i.icon??""}
16
16
  ></scb-drawer-item>
17
17
  `)}
18
18
  </scb-sub-drawer>
19
19
  `:d}
20
20
  </scb-drawer-item>
21
- `})}`}_syncFlags(e,t){this.toggleAttribute("data-no-utility",e),this.toggleAttribute("data-no-search",t)}render(){const e=this._slotTabs.length?this._slotTabs:this.tabs,t=this._slotUtils.length?this._slotUtils:this.utilityItems,s=this._slotMenu.length?this._slotMenu:this.menuData??[];this._syncFlags(t.length===0,!this.showSearch);const a=this.searchHeight&&this.searchHeight.trim()?`--scb-search-height:${this.searchHeight.trim()}`:d;return c`
21
+ `})}`}_syncFlags(e,t){this.toggleAttribute("data-no-utility",e),this.toggleAttribute("data-no-search",t)}render(){const e=this._slotTabs.length?this._slotTabs:this.tabs,t=this._slotUtils.length?this._slotUtils:this.utilityItems,r=this._slotMenu.length?this._slotMenu:this.menuData??[];this._syncFlags(t.length===0,!this.showSearch);const i=this.searchHeight&&this.searchHeight.trim()?`--scb-search-height:${this.searchHeight.trim()}`:d;return c`
22
22
  <slot id="data-slot" @slotchange=${()=>{this._harvest(),this._attachSlotObservers()}} hidden></slot>
23
23
 
24
24
  <div
@@ -42,12 +42,16 @@ import{_ as g}from"../../vendor/preload-helper.js";import{a as x,n as l,r as u,i
42
42
  </nav>
43
43
 
44
44
  ${this.showSearch?c`
45
- <div class="search" style=${a} @focusin=${()=>this.__ensureSearch()} @pointerenter=${()=>this.__ensureSearch()}>
45
+ <div class="search" style=${i} @focusin=${()=>this.__ensureSearch()} @pointerenter=${()=>this.__ensureSearch()}>
46
46
  <scb-search
47
47
  id=${this._searchId}
48
48
  size="compact"
49
- style=${a}
49
+ style=${i}
50
+ .value=${this.searchText}
50
51
  .supportingText=${this.searchPlaceholder??""}
52
+ @scb-search-input=${this._onSearchInput}
53
+ @scb-search-submit=${this._onSearchSubmit}
54
+ @scb-search-clear=${this._onSearchClear}
51
55
  ></scb-search>
52
56
  <scb-button
53
57
  variant="filled-tonal"
@@ -100,7 +104,7 @@ import{_ as g}from"../../vendor/preload-helper.js";import{a as x,n as l,r as u,i
100
104
 
101
105
  ${this.drawerSectionLabel?c`<scb-drawer-section .label=${this.drawerSectionLabel}></scb-drawer-section>`:d}
102
106
 
103
- ${this._renderDrawerNodes(s)}
107
+ ${this._renderDrawerNodes(r)}
104
108
 
105
109
  ${this.includeUtilityInDrawer&&(t?.length??0)>0?c`
106
110
  <scb-drawer-section label=''></scb-drawer-section>
@@ -120,7 +124,7 @@ import{_ as g}from"../../vendor/preload-helper.js";import{a as x,n as l,r as u,i
120
124
  </g>
121
125
  <defs><clipPath id="clip0_scb_header"><rect width="48" height="54" fill="white" /></clipPath></defs>
122
126
  </svg>
123
- `}};r._JSON_ARRAY={fromAttribute:e=>{if(e==null||e==="")return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}},toAttribute:e=>e==null?null:JSON.stringify(e)};r.BP_SM_DEFAULT=600;r.BP_MD_DEFAULT=840;r.styles=x`
127
+ `}};s._JSON_ARRAY={fromAttribute:e=>{if(e==null||e==="")return[];try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}},toAttribute:e=>e==null?null:JSON.stringify(e)};s.BP_SM_DEFAULT=600;s.BP_MD_DEFAULT=840;s.styles=x`
124
128
  :host {
125
129
  display:block;
126
130
  background: var(--scb-header-background, var(--md-sys-color-surface))
@@ -265,4 +269,4 @@ import{_ as g}from"../../vendor/preload-helper.js";import{a as x,n as l,r as u,i
265
269
  :host([data-hide-logo-text]) .logo-text {
266
270
  display: none;
267
271
  }
268
- `;r._nextFrame=()=>new Promise(e=>requestAnimationFrame(()=>e()));i([l({type:String,attribute:"max-width"})],r.prototype,"maxWidth",2);i([l({type:String,attribute:"logo-text"})],r.prototype,"logoText",2);i([l({type:String,attribute:"logo-href"})],r.prototype,"logoHref",2);i([l({type:Boolean,reflect:!0})],r.prototype,"banner",2);i([l({type:String,attribute:"banner-label"})],r.prototype,"bannerLabel",2);i([l({attribute:"tabs",converter:r._JSON_ARRAY})],r.prototype,"tabs",2);i([l({type:Number,attribute:"active-tab"})],r.prototype,"activeTab",2);i([l({attribute:"utility-items",converter:r._JSON_ARRAY})],r.prototype,"utilityItems",2);i([l({type:String,attribute:"search-placeholder"})],r.prototype,"searchPlaceholder",2);i([l({type:String,attribute:"drawer-label"})],r.prototype,"drawerLabel",2);i([l({type:String,attribute:"drawer-sub-label"})],r.prototype,"drawerSubLabel",2);i([l({type:String,attribute:"drawer-section-label"})],r.prototype,"drawerSectionLabel",2);i([l({type:String,attribute:"drawer-search-placeholder"})],r.prototype,"drawerSearchPlaceholder",2);i([l({attribute:"menu-data",converter:r._JSON_ARRAY})],r.prototype,"menuData",2);i([l({attribute:"show-drawer",reflect:!0,converter:w})],r.prototype,"showDrawer",2);i([l({attribute:"show-search",reflect:!0,converter:w})],r.prototype,"showSearch",2);i([l({attribute:"include-utility-in-drawer",reflect:!0,converter:w})],r.prototype,"includeUtilityInDrawer",2);i([l({type:String,attribute:"search-max"})],r.prototype,"searchMax",2);i([l({type:String,attribute:"search-min"})],r.prototype,"searchMin",2);i([l({type:String,attribute:"search-height"})],r.prototype,"searchHeight",2);i([u()],r.prototype,"_drawerId",2);i([u()],r.prototype,"_drawerMounted",2);i([u()],r.prototype,"_drawerExpanded",2);i([u()],r.prototype,"_searchId",2);i([u()],r.prototype,"_slotTabs",2);i([u()],r.prototype,"_slotUtils",2);i([u()],r.prototype,"_slotMenu",2);i([u()],r.prototype,"_collapsed",2);i([u()],r.prototype,"_hideLogoText",2);r=i([C("scb-header")],r);
272
+ `;s._nextFrame=()=>new Promise(e=>requestAnimationFrame(()=>e()));a([l({type:String,attribute:"max-width"})],s.prototype,"maxWidth",2);a([l({type:String,attribute:"logo-text"})],s.prototype,"logoText",2);a([l({type:String,attribute:"logo-href"})],s.prototype,"logoHref",2);a([l({type:Boolean,reflect:!0})],s.prototype,"banner",2);a([l({type:String,attribute:"banner-label"})],s.prototype,"bannerLabel",2);a([l({attribute:"tabs",converter:s._JSON_ARRAY})],s.prototype,"tabs",2);a([l({type:Number,attribute:"active-tab"})],s.prototype,"activeTab",2);a([l({attribute:"utility-items",converter:s._JSON_ARRAY})],s.prototype,"utilityItems",2);a([l({type:String,attribute:"search-placeholder"})],s.prototype,"searchPlaceholder",2);a([l({type:String,attribute:"drawer-label"})],s.prototype,"drawerLabel",2);a([l({type:String,attribute:"drawer-sub-label"})],s.prototype,"drawerSubLabel",2);a([l({type:String,attribute:"drawer-section-label"})],s.prototype,"drawerSectionLabel",2);a([l({type:String,attribute:"drawer-search-placeholder"})],s.prototype,"drawerSearchPlaceholder",2);a([l({attribute:"menu-data",converter:s._JSON_ARRAY})],s.prototype,"menuData",2);a([l({attribute:"show-drawer",reflect:!0,converter:v})],s.prototype,"showDrawer",2);a([l({attribute:"show-search",reflect:!0,converter:v})],s.prototype,"showSearch",2);a([l({attribute:"include-utility-in-drawer",reflect:!0,converter:v})],s.prototype,"includeUtilityInDrawer",2);a([l({type:String,attribute:"search-max"})],s.prototype,"searchMax",2);a([l({type:String,attribute:"search-min"})],s.prototype,"searchMin",2);a([l({type:String,attribute:"search-height"})],s.prototype,"searchHeight",2);a([l({type:String,attribute:"search-text",reflect:!0})],s.prototype,"searchText",2);a([u()],s.prototype,"_drawerId",2);a([u()],s.prototype,"_drawerMounted",2);a([u()],s.prototype,"_drawerExpanded",2);a([u()],s.prototype,"_searchId",2);a([u()],s.prototype,"_slotTabs",2);a([u()],s.prototype,"_slotUtils",2);a([u()],s.prototype,"_slotMenu",2);a([u()],s.prototype,"_collapsed",2);a([u()],s.prototype,"_hideLogoText",2);s=a([C("scb-header")],s);
@@ -0,0 +1,175 @@
1
+ import{a as g,n as d,i as b,x as s,t as h}from"../../vendor/vendor.js";import"../scb-link/scb-link.js";import"../scb-button/scb-button.js";import"../scb-icon-button/scb-icon-button.js";import"../../vendor/vendor-material.js";import"../../vendor/preload-helper.js";import"../scb-tooltip/scb-tooltip.js";(function(){try{var p=typeof globalThis<"u"?globalThis:window;if(!p.__scb_ce_guard_installed__){p.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(n,i,r){try{customElements.get(n)||e(n,i,r)}catch(a){var o=String(a||"");if(o.indexOf("already been used")===-1&&o.indexOf("NotSupportedError")===-1)throw a}}}}catch{}})();var u=Object.defineProperty,v=Object.getOwnPropertyDescriptor,c=(p,e,n,i)=>{for(var r=i>1?void 0:i?v(e,n):e,o=p.length-1,a;o>=0;o--)(a=p[o])&&(r=(i?a(e,n,r):a(r))||r);return i&&r&&u(e,n,r),r};let l=class extends b{constructor(){super(...arguments),this.variant="icon-text",this.page=1,this.totalPages=0,this.pagingHref="/products?page=",this.paginationAriaLabel="Paginering",this.currentAriaLabel="Nuvarande sida, ",this.pagingNumberAriaLabel="Gå till sida ",this.isNarrow=window.innerWidth<=768,this._onResize=()=>{this.isNarrow=window.innerWidth<=768}}_prevPage(){this.page>1&&this.page--,this.dispatchEvent(new CustomEvent("page-change",{detail:{page:this.page}}))}_nextPage(){this.page<this.totalPages&&this.page++,this.dispatchEvent(new CustomEvent("page-change",{detail:{page:this.page}}))}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this._onResize),this._onResize()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this._onResize)}render(){if(this.totalPages===0)return null;const p=this.variant?`${this.variant.toLowerCase()}`:"",e=[],{page:n,totalPages:i}=this,r=window.innerWidth<=768,o=r?1:2,a=t=>t===n?s`
2
+ <li>
3
+ <span
4
+ class="page-number active"
5
+ aria-current="page"
6
+ aria-label="${this.currentAriaLabel} ${t}"
7
+ >${t}</span>
8
+ </li>
9
+ `:s`
10
+ <li>
11
+ <scb-link
12
+ class="page-number${t===n?" active":""}"
13
+ @click=${()=>{this.page=t,this.dispatchEvent(new CustomEvent("page-change",{detail:{page:t}}))}}
14
+ aria-current=${t===n?"page":void 0}
15
+ aria-label="${this.pagingNumberAriaLabel} ${t}"
16
+ href=${this.pagingHref}${t}
17
+ ?disabled=${t===n}>${t}
18
+ </scb-link>
19
+ </li>
20
+ `;if(i<=8)for(let t=1;t<=i;t++)e.push(a(t));else if(e.push(a(1)),n<=4&&!r){for(let t=2;t<=5;t++)e.push(a(t));i>6?(e.push(s`<li><span class="ellipsis" aria-hidden="true">…</span></li>`),e.push(a(i))):i===6&&e.push(a(i))}else if(n<=3&&r){for(let t=2;t<=3;t++)e.push(a(t));i>4?(e.push(s`<li><span class="ellipsis" aria-hidden="true">…</span></li>`),e.push(a(i))):i===4&&e.push(a(i))}else if(n>=i-(o+1)){e.push(s`<li><span class="ellipsis" aria-hidden="true">…</span></li>`);for(let t=i-o*2;t<=i;t++)t>1&&e.push(a(t))}else{e.push(s`<li><span class="ellipsis" aria-hidden="true">…</span></li>`);for(let t=n-o;t<=n+o;t++)t>1&&t<i&&e.push(a(t));e.push(s`<li><span class="ellipsis" aria-hidden="true">…</span></li>`),e.push(a(i))}return r?s`
21
+ <nav aria-label="${this.paginationAriaLabel}" class="pagination ${p}">
22
+ <div class="pagination-row">
23
+ <div class="prev">
24
+ ${this.variant==="icon"?s`<scb-icon-button icon="chevron_left" @click=${this._prevPage} ?disabled=${this.page===1} aria-label="Föregående sida"></scb-icon-button>`:s`<scb-button variant="text" label="Föregående" icon="chevron_left" @click=${this._prevPage} ?disabled=${this.page===1} aria-label="Föregående sida"></scb-button>`}
25
+ </div>
26
+ <ol>
27
+ ${e}
28
+ </ol>
29
+ </div>
30
+ <div class="next">
31
+ ${this.variant==="icon"?s`<scb-icon-button icon="chevron_right" @click=${this._nextPage} ?disabled=${this.page===this.totalPages} aria-label="Nästa sida"></scb-icon-button>`:s`<scb-button variant="text" label="Nästa" icon="chevron_right" iconPosition="right" @click=${this._nextPage} ?disabled=${this.page===this.totalPages} aria-label="Nästa sida" trailing-icon></scb-button>`}
32
+ </div>
33
+ </nav>
34
+ `:s`
35
+ <nav aria-label="${this.paginationAriaLabel}" class="pagination ${p}">
36
+ <div class="pagination-row">
37
+ <div class="prev">
38
+ ${this.variant==="icon"?s`<scb-icon-button icon="chevron_left" @click=${this._prevPage} ?disabled=${this.page===1} aria-label="Föregående sida"></scb-icon-button>`:s`<scb-button variant="text" label="Föregående" icon="chevron_left" @click=${this._prevPage} ?disabled=${this.page===1} aria-label="Föregående sida"></scb-button>`}
39
+ </div>
40
+ <ol>
41
+ ${e}
42
+ </ol>
43
+ <div class="next">
44
+ ${this.variant==="icon"?s`<scb-icon-button icon="chevron_right" @click=${this._nextPage} ?disabled=${this.page===this.totalPages} aria-label="Nästa sida"></scb-icon-button>`:s`<scb-button variant="text" label="Nästa" icon="chevron_right" iconPosition="right" @click=${this._nextPage} ?disabled=${this.page===this.totalPages} aria-label="Nästa sida" trailing-icon></scb-button>`}
45
+ </div>
46
+ </div>
47
+ </nav>
48
+ `}};l.styles=[g`
49
+ :host .pagination {
50
+ --md-text-button-label-text-color: var(--md-sys-color-on-surface, #0F0865);
51
+ --md-text-button-pressed-state-layer-color: var(--md-sys-color-on-surface, #0F0865);
52
+ --md-text-button-focus-label-text-color: var(--md-sys-color-on-surface, #0F0865);
53
+ --md-text-button-hover-label-text-color: var(--md-sys-color-on-surface, #0F0865);
54
+ --md-text-button-pressed-label-text-color: var(--md-sys-color-on-surface, #0F0865);
55
+ --md-text-button-label-text-weight: var(--weight-regular, 400);
56
+ --md-text-button-label-text-line-height: var(--md-sys-typescale-body-medium-line-height, 24px);
57
+ --md-text-button-label-text-size: var(--md-sys-typescale-body-medium-size, 16px);
58
+ --md-text-button-icon-color : var(--md-sys-color-on-surface, #0F0865);
59
+ --md-text-button-focus-icon-color : var(--md-sys-color-on-surface, #0F0865);
60
+ --md-text-button-hover-icon-color : var(--md-sys-color-on-surface, #0F0865);
61
+ --md-text-button-pressed-icon-color : var(--md-sys-color-on-surface, #0F0865);
62
+ --scb-link-decoration: none;
63
+ --scb-link-color: var(--md-sys-color-on-surface, #0F0865);
64
+
65
+ scb-link.page-number a {
66
+ cursor: pointer;
67
+ text-decoration: none;
68
+ display: inline-flex;
69
+ }
70
+ }
71
+
72
+ .pagination {
73
+ width: 100%;
74
+ display: flex;
75
+ flex-direction: column;
76
+ gap: 0;
77
+ }
78
+ .pagination-row {
79
+ width: 100%;
80
+ display: flex;
81
+ flex-direction: row;
82
+ align-items: center;
83
+ gap: 4px;
84
+ }
85
+ .pagination-row .prev {
86
+ display: flex;
87
+ justify-content: flex-start;
88
+ width: auto;
89
+ }
90
+ .pagination-row ol {
91
+ width: auto;
92
+ display: flex;
93
+ flex-direction: row;
94
+ justify-content: flex-start;
95
+ gap: 4px;
96
+ margin: 0;
97
+ padding: 0;
98
+ list-style: none;
99
+ }
100
+ .pagination-row ol li {
101
+ min-width: 40px;
102
+ min-height: 40px;
103
+ display: flex;
104
+ align-items: center;
105
+ justify-content: center;
106
+ }
107
+ .pagination-row .next {
108
+ display: flex;
109
+ justify-content: flex-start;
110
+ align-items: center;
111
+ width: auto;
112
+ margin-top: 0;
113
+ }
114
+ scb-link.page-number a {
115
+ cursor: pointer;
116
+ text-decoration: none;
117
+ display: inline-flex;
118
+ }
119
+ .page-number.active {
120
+ display: inline-flex;
121
+ align-items: center;
122
+ justify-content: center;
123
+ border-radius: 50%;
124
+ background: var(--md-sys-color-primary, #1F44FF);
125
+ color: var(--md-sys-color-on-primary, #FFF);
126
+ text-align: center;
127
+ width: 40px;
128
+ height: 40px;
129
+ }
130
+ .page-number.active {
131
+ font-family: var(--brand-font, 'Inter', sans-serif);
132
+ }
133
+ .ellipsis {
134
+ margin: 0 4px;
135
+ color: #888;
136
+ user-select: none;
137
+ pointer-events: none;
138
+ }
139
+ scb-button[disabled] {
140
+ opacity: 0.5;
141
+ pointer-events: none;
142
+ }
143
+
144
+ @media (max-width: 768px) {
145
+
146
+ .pagination .prev {
147
+ display: flex;
148
+ justify-content: flex-start;
149
+ }
150
+ .pagination .next {
151
+ width: 100%;
152
+ margin-top: 8px;
153
+ }
154
+ }
155
+
156
+ @media (max-width: 390px) {
157
+ .pagination-row {
158
+ flex-direction: column;
159
+ gap: 0;
160
+ }
161
+ .pagination-row .prev {
162
+ width: 100%;
163
+ margin-bottom: 8px;
164
+ align-items: center;
165
+ }
166
+ .pagination-row ol {
167
+ width: 100%;
168
+ align-items: center;
169
+ }
170
+ .pagination-row .next {
171
+ width: 100%;
172
+ margin-top: 8px;
173
+ }
174
+ }
175
+ `];c([d({type:String})],l.prototype,"variant",2);c([d({type:Number})],l.prototype,"page",2);c([d({type:Number,attribute:"total-pages"})],l.prototype,"totalPages",2);c([d({type:String,attribute:"paging-href"})],l.prototype,"pagingHref",2);c([d({type:String,attribute:"pagination-aria-label"})],l.prototype,"paginationAriaLabel",2);c([d({type:String,attribute:"current-aria-label"})],l.prototype,"currentAriaLabel",2);c([d({type:String,attribute:"paging-number-aria-label"})],l.prototype,"pagingNumberAriaLabel",2);c([d({type:Boolean})],l.prototype,"isNarrow",2);l=c([h("scb-pagination")],l);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scb-wc-test",
3
- "version": "0.1.71",
3
+ "version": "0.1.73",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -226,6 +226,10 @@
226
226
  "import": "./scb-notification-card/scb-notification-card.js",
227
227
  "require": "./scb-notification-card/scb-notification-card.js"
228
228
  },
229
+ "./scb-pagination": {
230
+ "import": "./scb-pagination/scb-pagination.js",
231
+ "require": "./scb-pagination/scb-pagination.js"
232
+ },
229
233
  "./scb-progress-indicator": {
230
234
  "import": "./scb-progress-indicator/scb-progress-indicator.js",
231
235
  "require": "./scb-progress-indicator/scb-progress-indicator.js"
@@ -292,5 +296,5 @@
292
296
  },
293
297
  "./mvc/*": "./mvc/*"
294
298
  },
295
- "buildHash": "4AFCE4286FCF8A151F1ACB56B2D0ABAE1670938C70F8E5DADA1BEA57F7034084"
299
+ "buildHash": "1E21267DF6FC15177380C53642516E5D5CB28925177DA537848C86C04E5E3520"
296
300
  }
@@ -36,6 +36,7 @@ export declare class ScbHeader extends LitElement {
36
36
  searchMax?: string;
37
37
  searchMin?: string;
38
38
  searchHeight?: string;
39
+ searchText: string;
39
40
  private _drawerId;
40
41
  private _drawerMounted;
41
42
  private _drawerExpanded;
@@ -102,6 +103,9 @@ export declare class ScbHeader extends LitElement {
102
103
  private _applyActiveToTabs;
103
104
  private _renderDrawerNodes;
104
105
  private _syncFlags;
106
+ private _onSearchInput;
107
+ private _onSearchSubmit;
108
+ private _onSearchClear;
105
109
  render(): TemplateResult;
106
110
  private _renderLogo;
107
111
  }
@@ -1,15 +1,15 @@
1
1
  import { css as C, LitElement as T, html as h, nothing as u } from "lit";
2
- import { property as l, state as p, customElement as M } from "lit/decorators.js";
2
+ import { property as l, state as p, customElement as $ } from "lit/decorators.js";
3
3
  import "@material/web/focus/md-focus-ring.js";
4
4
  import "../scb-grid/scb-grid-item.js";
5
5
  import "../scb-grid/scb-grid.js";
6
6
  import "../scb-link/scb-link.js";
7
7
  import "../scb-icon-button/scb-icon-button.js";
8
8
  import "../scb-button/scb-button.js";
9
- var $ = Object.defineProperty, A = Object.getOwnPropertyDescriptor, i = (e, t, r, a) => {
9
+ var M = Object.defineProperty, A = Object.getOwnPropertyDescriptor, i = (e, t, r, a) => {
10
10
  for (var o = a > 1 ? void 0 : a ? A(t, r) : t, c = e.length - 1, n; c >= 0; c--)
11
11
  (n = e[c]) && (o = (a ? n(t, r, o) : n(o)) || o);
12
- return a && o && $(t, r, o), o;
12
+ return a && o && M(t, r, o), o;
13
13
  };
14
14
  const w = {
15
15
  fromAttribute: (e) => e == null ? !0 : !/^(false|0|off|no)$/i.test(e),
@@ -17,7 +17,7 @@ const w = {
17
17
  };
18
18
  let s = class extends T {
19
19
  constructor() {
20
- super(...arguments), this.maxWidth = "1440px", this.logoText = "", this.logoHref = "/", this.banner = !1, this.tabs = [], this.activeTab = 0, this.utilityItems = [], this.showDrawer = !0, this.showSearch = !0, this.includeUtilityInDrawer = !1, this._drawerId = "main-drawer", this._drawerMounted = !1, this._drawerExpanded = !1, this._searchId = "header-search", this._slotTabs = [], this._slotUtils = [], this._slotMenu = [], this._measureScheduled = !1, this._scheduleMeasure = () => {
20
+ super(...arguments), this.maxWidth = "1440px", this.logoText = "", this.logoHref = "/", this.banner = !1, this.tabs = [], this.activeTab = 0, this.utilityItems = [], this.showDrawer = !0, this.showSearch = !0, this.includeUtilityInDrawer = !1, this.searchText = "", this._drawerId = "main-drawer", this._drawerMounted = !1, this._drawerExpanded = !1, this._searchId = "header-search", this._slotTabs = [], this._slotUtils = [], this._slotMenu = [], this._measureScheduled = !1, this._scheduleMeasure = () => {
21
21
  this._measureScheduled || (this._measureScheduled = !0, requestAnimationFrame(() => {
22
22
  this._measureScheduled = !1, this._measure();
23
23
  }));
@@ -98,8 +98,8 @@ let s = class extends T {
98
98
  t.submit();
99
99
  return;
100
100
  }
101
- const r = (t == null ? void 0 : t.value) ?? void 0;
102
- this.dispatchEvent(new CustomEvent("search-click", {
101
+ const r = (t == null ? void 0 : t.value) ?? "";
102
+ this.searchText = r, this.dispatchEvent(new CustomEvent("search-click", {
103
103
  detail: { value: r },
104
104
  bubbles: !0,
105
105
  composed: !0
@@ -114,6 +114,30 @@ let s = class extends T {
114
114
  bubbles: !0,
115
115
  composed: !0
116
116
  }));
117
+ }, this._onSearchInput = (e) => {
118
+ var t;
119
+ this.searchText = ((t = e.detail) == null ? void 0 : t.value) ?? "", this.dispatchEvent(new CustomEvent("search-input", {
120
+ detail: { value: this.searchText },
121
+ bubbles: !0,
122
+ composed: !0
123
+ })), this.dispatchEvent(new CustomEvent("search-text-change", {
124
+ detail: { value: this.searchText },
125
+ bubbles: !0,
126
+ composed: !0
127
+ }));
128
+ }, this._onSearchSubmit = (e) => {
129
+ var t, r;
130
+ this.searchText = ((t = e.detail) == null ? void 0 : t.value) ?? "", this.dispatchEvent(new CustomEvent("search-change", {
131
+ detail: { value: this.searchText, active: (r = e.detail) == null ? void 0 : r.active },
132
+ bubbles: !0,
133
+ composed: !0
134
+ }));
135
+ }, this._onSearchClear = () => {
136
+ this.searchText = "", this.dispatchEvent(new CustomEvent("search-text-change", {
137
+ detail: { value: "" },
138
+ bubbles: !0,
139
+ composed: !0
140
+ }));
117
141
  };
118
142
  }
119
143
  get _HYST() {
@@ -324,7 +348,11 @@ let s = class extends T {
324
348
  id=${this._searchId}
325
349
  size="compact"
326
350
  style=${a}
351
+ .value=${this.searchText}
327
352
  .supportingText=${this.searchPlaceholder ?? ""}
353
+ @scb-search-input=${this._onSearchInput}
354
+ @scb-search-submit=${this._onSearchSubmit}
355
+ @scb-search-clear=${this._onSearchClear}
328
356
  ></scb-search>
329
357
  <scb-button
330
358
  variant="filled-tonal"
@@ -624,6 +652,9 @@ i([
624
652
  i([
625
653
  l({ type: String, attribute: "search-height" })
626
654
  ], s.prototype, "searchHeight", 2);
655
+ i([
656
+ l({ type: String, attribute: "search-text", reflect: !0 })
657
+ ], s.prototype, "searchText", 2);
627
658
  i([
628
659
  p()
629
660
  ], s.prototype, "_drawerId", 2);
@@ -652,7 +683,7 @@ i([
652
683
  p()
653
684
  ], s.prototype, "_hideLogoText", 2);
654
685
  s = i([
655
- M("scb-header")
686
+ $("scb-header")
656
687
  ], s);
657
688
  export {
658
689
  s as ScbHeader