@govtechsg/sgds-web-component 3.26.1-rc.0 → 3.26.1-rc.2
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/components/Breadcrumb/index.umd.min.js +25 -25
- package/components/Breadcrumb/index.umd.min.js.map +1 -1
- package/components/Dropdown/dropdown-item.js +1 -1
- package/components/Dropdown/index.umd.min.js +4 -4
- package/components/Dropdown/index.umd.min.js.map +1 -1
- package/components/Dropdown/sgds-dropdown-item.d.ts +2 -0
- package/components/Dropdown/sgds-dropdown-item.js +8 -2
- package/components/Dropdown/sgds-dropdown-item.js.map +1 -1
- package/components/Mainnav/index.d.ts +2 -0
- package/components/Mainnav/index.js +2 -0
- package/components/Mainnav/index.js.map +1 -1
- package/components/Mainnav/index.umd.min.js +327 -286
- package/components/Mainnav/index.umd.min.js.map +1 -1
- package/components/Mainnav/mainnav-dropdown.js +1 -1
- package/components/Mainnav/mainnav-item.js +1 -1
- package/components/Mainnav/mainnav-profile.js +6 -0
- package/components/Mainnav/mainnav-profile.js.map +1 -0
- package/components/Mainnav/mainnav.js +1 -1
- package/components/Mainnav/sgds-mainnav-profile.d.ts +41 -0
- package/components/Mainnav/sgds-mainnav-profile.js +136 -0
- package/components/Mainnav/sgds-mainnav-profile.js.map +1 -0
- package/components/Mainnav/sgds-mainnav.d.ts +14 -16
- package/components/Mainnav/sgds-mainnav.js +59 -21
- package/components/Mainnav/sgds-mainnav.js.map +1 -1
- package/components/OverflowMenu/index.umd.min.js +4 -4
- package/components/OverflowMenu/index.umd.min.js.map +1 -1
- package/components/QuantityToggle/index.umd.min.js +22 -22
- package/components/QuantityToggle/index.umd.min.js.map +1 -1
- package/components/QuantityToggle/sgds-quantity-toggle.js +9 -11
- package/components/QuantityToggle/sgds-quantity-toggle.js.map +1 -1
- package/components/index.d.ts +1 -0
- package/components/index.js +1 -0
- package/components/index.js.map +1 -1
- package/components/index.umd.min.js +336 -295
- package/components/index.umd.min.js.map +1 -1
- package/css/fouc.css +3 -2
- package/custom-elements.json +6127 -5751
- package/index.umd.min.js +404 -363
- package/index.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/react/components/Dropdown/dropdown-item.cjs.js +1 -1
- package/react/components/Dropdown/dropdown-item.js +1 -1
- package/react/components/Dropdown/sgds-dropdown-item.cjs.js +8 -2
- package/react/components/Dropdown/sgds-dropdown-item.cjs.js.map +1 -1
- package/react/components/Dropdown/sgds-dropdown-item.js +8 -2
- package/react/components/Dropdown/sgds-dropdown-item.js.map +1 -1
- package/react/components/Mainnav/mainnav-dropdown.cjs.js +1 -1
- package/react/components/Mainnav/mainnav-dropdown.js +1 -1
- package/react/components/Mainnav/mainnav-item.cjs.js +1 -1
- package/react/components/Mainnav/mainnav-item.js +1 -1
- package/react/components/Mainnav/mainnav-profile.cjs.js +11 -0
- package/react/components/Mainnav/mainnav-profile.cjs.js.map +1 -0
- package/react/components/Mainnav/mainnav-profile.js +7 -0
- package/react/components/Mainnav/mainnav-profile.js.map +1 -0
- package/react/components/Mainnav/mainnav.cjs.js +1 -1
- package/react/components/Mainnav/mainnav.js +1 -1
- package/react/components/Mainnav/sgds-mainnav-profile.cjs.js +142 -0
- package/react/components/Mainnav/sgds-mainnav-profile.cjs.js.map +1 -0
- package/react/components/Mainnav/sgds-mainnav-profile.js +137 -0
- package/react/components/Mainnav/sgds-mainnav-profile.js.map +1 -0
- package/react/components/Mainnav/sgds-mainnav.cjs.js +58 -20
- package/react/components/Mainnav/sgds-mainnav.cjs.js.map +1 -1
- package/react/components/Mainnav/sgds-mainnav.js +59 -21
- package/react/components/Mainnav/sgds-mainnav.js.map +1 -1
- package/react/components/QuantityToggle/sgds-quantity-toggle.cjs.js +9 -11
- package/react/components/QuantityToggle/sgds-quantity-toggle.cjs.js.map +1 -1
- package/react/components/QuantityToggle/sgds-quantity-toggle.js +9 -11
- package/react/components/QuantityToggle/sgds-quantity-toggle.js.map +1 -1
- package/react/index.cjs.js +82 -80
- package/react/index.cjs.js.map +1 -1
- package/react/index.d.ts +3 -2
- package/react/index.js +3 -2
- package/react/index.js.map +1 -1
- package/react/mainnav-profile/index.cjs.js +40 -0
- package/react/mainnav-profile/index.cjs.js.map +1 -0
- package/react/mainnav-profile/index.d.ts +4 -0
- package/react/mainnav-profile/index.js +16 -0
- package/react/mainnav-profile/index.js.map +1 -0
- package/themes/blue.css +11 -11
- package/themes/cyan.css +10 -10
- package/themes/gt/blue.css +11 -11
- package/themes/gt/cyan.css +10 -10
- package/themes/gt/magenta.css +11 -11
- package/themes/gt/pink.css +11 -11
- package/themes/gt/purple.css +11 -11
- package/themes/gt/red.css +11 -11
- package/themes/magenta.css +11 -11
- package/themes/pink.css +11 -11
- package/themes/purple.css +11 -11
- package/themes/red.css +11 -11
- package/themes/root.css +5 -0
- package/types/react.d.ts +71 -51
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
|
|
3
|
-
var css_248z = css`:host([expand=always]) .nav-link{border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}@media (min-width:512px){:host([expand=sm]) .nav-link{border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}}@media (min-width:768px){:host([expand=md]) .nav-link{border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}}@media (min-width:1024px){:host(:not([expand])) .nav-link,:host([expand=lg]) .nav-link{border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}}@media (min-width:1280px){:host([expand=xl]) .nav-link{border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}}@media (min-width:1440px){:host([expand=xxl]) .nav-link{border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}}.nav-link{align-items:center;box-sizing:border-box;cursor:pointer;display:flex;font-size:var(--sgds-font-size-label-sm);gap:var(--sgds-gap-xs);line-height:var(--sgds-line-height-2-xs,20px);padding:var(--sgds-padding-sm) var(--sgds-mainnav-mobile-padding-x);text-decoration:none}.nav-link.show,.nav-link:not(.disabled).active{border-color:var(--sgds-primary-border-color-default);color:var(--sgds-primary-color-default)}.nav-link:not(.disabled):hover{color:var(--sgds-primary-color-default)}.nav-link:not(.disabled):focus-visible{color:var(--sgds-primary-color-default);outline:var(--sgds-outline-focus);outline-offset:var(--sgds-outline-offset-focus)}.nav-link.disabled{cursor:not-allowed;opacity:var(--sgds-opacity-40)}.dropdown-items{background-color:var(--sgds-surface-default);height:100%;left:100%;overflow-y:auto;padding:var(--sgds-padding-md) 0;position:absolute;top:0;width:100%}.dropdown-items a{align-items:center;color:var(--sgds-color-default);cursor:pointer;display:flex;font-size:var(--sgds-font-size-label-sm);gap:var(--sgds-gap-xs);line-height:var(--sgds-line-height-2-xs,20px);margin:auto;max-width:var(--sgds-mainnav-max-width,1440px);padding:var(--sgds-padding-sm) var(--sgds-mainnav-mobile-padding-x);text-decoration:none}.dropdown-items a:hover{color:var(--sgds-primary-color-default)}.dropdown-items a:focus-visible{color:var(--sgds-primary-color-default);outline:var(--sgds-outline-focus);outline-offset:var(--sgds-outline-offset-focus);outline-offset:-5px}slot[name=toggler]::slotted(*){flex:1}sgds-dropdown{display:block;height:100%}@media screen and (min-width:1024px){.dropdown-items a,.nav-link{padding:var(--sgds-padding-sm) var(--sgds-mainnav-padding-x)}}`;
|
|
3
|
+
var css_248z = css`:host([expand=always]) .nav-link{border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}@media (min-width:512px){:host([expand=sm]) .nav-link{border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}}@media (min-width:768px){:host([expand=md]) .nav-link{border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}}@media (min-width:1024px){:host(:not([expand])) .nav-link,:host([expand=lg]) .nav-link{border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}}@media (min-width:1280px){:host([expand=xl]) .nav-link{border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}}@media (min-width:1440px){:host([expand=xxl]) .nav-link{border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}}.nav-link{align-items:center;box-sizing:border-box;color:var(--sgds-color-default);cursor:pointer;display:flex;font-size:var(--sgds-font-size-label-sm);gap:var(--sgds-gap-xs);line-height:var(--sgds-line-height-2-xs,20px);padding:var(--sgds-padding-sm) var(--sgds-mainnav-mobile-padding-x);text-decoration:none}:host([tone=brand][expand=always]) .nav-link,:host([tone^=gradient][expand=always]) .nav-link{color:var(--sgds-color-fixed-light)}@media screen and (min-width:512px){:host([tone=brand][expand=sm]) .nav-link,:host([tone^=gradient][expand=sm]) .nav-link{color:var(--sgds-color-fixed-light)}}@media screen and (min-width:768px){:host([tone=brand][expand=md]) .nav-link,:host([tone^=gradient][expand=md]) .nav-link{color:var(--sgds-color-fixed-light)}}@media screen and (min-width:1024px){:host([tone=brand][expand=lg]) .nav-link,:host([tone^=gradient][expand=lg]) .nav-link{color:var(--sgds-color-fixed-light)}}@media screen and (min-width:1280px){:host([tone=brand][expand=xl]) .nav-link,:host([tone^=gradient][expand=xl]) .nav-link{color:var(--sgds-color-fixed-light)}}@media screen and (min-width:1440px){:host([tone=brand][expand=xxl]) .nav-link,:host([tone^=gradient][expand=xxl]) .nav-link{color:var(--sgds-color-fixed-light)}}.nav-link.show,.nav-link:not(.disabled).active{border-color:var(--sgds-primary-border-color-default);color:var(--sgds-primary-color-default)}.nav-link:not(.disabled):hover{color:var(--sgds-primary-color-default)}.nav-link:not(.disabled):focus-visible{color:var(--sgds-primary-color-default);outline:var(--sgds-outline-focus);outline-offset:var(--sgds-outline-offset-focus)}.nav-link.disabled{cursor:not-allowed;opacity:var(--sgds-opacity-40)}.dropdown-items{background-color:var(--sgds-surface-default);height:100%;left:100%;overflow-y:auto;padding:var(--sgds-padding-md) 0;position:absolute;top:0;width:100%}.dropdown-items a{align-items:center;color:var(--sgds-color-default);cursor:pointer;display:flex;font-size:var(--sgds-font-size-label-sm);gap:var(--sgds-gap-xs);line-height:var(--sgds-line-height-2-xs,20px);margin:auto;max-width:var(--sgds-mainnav-max-width,1440px);padding:var(--sgds-padding-sm) var(--sgds-mainnav-mobile-padding-x);text-decoration:none}.dropdown-items a:hover{color:var(--sgds-primary-color-default)}.dropdown-items a:focus-visible{color:var(--sgds-primary-color-default);outline:var(--sgds-outline-focus);outline-offset:var(--sgds-outline-offset-focus);outline-offset:-5px}:host([tone=brand][expand=always]) slot[name=toggler]::slotted(*),:host([tone^=gradient][expand=always]) slot[name=toggler]::slotted(*){color:var(--sgds-color-fixed-light)}@media screen and (min-width:512px){:host([tone=brand][expand=sm]) slot[name=toggler]::slotted(*),:host([tone^=gradient][expand=sm]) slot[name=toggler]::slotted(*){color:var(--sgds-color-fixed-light)}}@media screen and (min-width:768px){:host([tone=brand][expand=md]) slot[name=toggler]::slotted(*),:host([tone^=gradient][expand=md]) slot[name=toggler]::slotted(*){color:var(--sgds-color-fixed-light)}}@media screen and (min-width:1024px){:host([tone=brand][expand=lg]) slot[name=toggler]::slotted(*),:host([tone^=gradient][expand=lg]) slot[name=toggler]::slotted(*){color:var(--sgds-color-fixed-light)}}@media screen and (min-width:1280px){:host([tone=brand][expand=xl]) slot[name=toggler]::slotted(*),:host([tone^=gradient][expand=xl]) slot[name=toggler]::slotted(*){color:var(--sgds-color-fixed-light)}}@media screen and (min-width:1440px){:host([tone=brand][expand=xxl]) slot[name=toggler]::slotted(*),:host([tone^=gradient][expand=xxl]) slot[name=toggler]::slotted(*){color:var(--sgds-color-fixed-light)}}slot[name=toggler]::slotted(*){flex:1}sgds-dropdown{display:block;height:100%}@media screen and (min-width:1024px){.dropdown-items a,.nav-link{padding:var(--sgds-padding-sm) var(--sgds-mainnav-padding-x)}}`;
|
|
4
4
|
|
|
5
5
|
export { css_248z as default };
|
|
6
6
|
//# sourceMappingURL=mainnav-dropdown.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
|
|
3
|
-
var css_248z = css`:host([expand=always]) ::slotted(*){border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}@media screen and (min-width:512px){:host([expand=sm]) ::slotted(*){border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}:host(:not([disabled])[active][expand=sm]) ::slotted(*){border-color:var(--sgds-primary-border-color-default)}}@media screen and (min-width:768px){:host([expand=md]) ::slotted(*){border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}:host(:not([disabled])[active][expand=md]) ::slotted(*){border-color:var(--sgds-primary-border-color-default)}}@media screen and (min-width:1024px){:host([expand=lg]) ::slotted(*){border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}:host(:not([disabled])[active][expand=lg]) ::slotted(*){border-color:var(--sgds-primary-border-color-default)}}@media screen and (min-width:1280px){:host([expand=xl]) ::slotted(*){border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}:host(:not([disabled])[active][expand=xl]) ::slotted(*){border-color:var(--sgds-primary-border-color-default)}}@media screen and (min-width:1440px){:host([expand=xxl]) ::slotted(*){border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}:host(:not([disabled])[active][expand=xxl]) ::slotted(*){border-color:var(--sgds-primary-border-color-default)}}@media screen and (max-width:511px){:host(:not([disabled])[active][expand=sm]) ::slotted(*){background-color:var(--sgds-bg-translucent-subtle)}}@media screen and (max-width:767px){:host(:not([disabled])[active][expand=md]) ::slotted(*){background-color:var(--sgds-bg-translucent-subtle)}}@media screen and (max-width:1023px){:host(:not([disabled])[active][expand=lg]) ::slotted(*){background-color:var(--sgds-bg-translucent-subtle)}}@media screen and (max-width:1279px){:host(:not([disabled])[active][expand=xl]) ::slotted(*){background-color:var(--sgds-bg-translucent-subtle)}}@media screen and (max-width:1439px){:host(:not([disabled])[active][expand=xxl]) ::slotted(*){background-color:var(--sgds-bg-translucent-subtle)}}::slotted(*){--sgds-link-color-default:var(--sgds-color-default);--sgds-link-color-emphasis:var(--sgds-color-default);align-items:center;box-sizing:border-box;color:var(--sgds-color-default)!important;cursor:pointer;display:flex;font-size:var(--sgds-font-size-label-sm);height:auto!important;line-height:var(--sgds-line-height-2-xs,20px);padding:var(--sgds-padding-sm) var(--sgds-mainnav-mobile-padding-x);text-decoration:none!important}@media screen and (min-width:1024px){::slotted(*){padding:var(--sgds-padding-sm) var(--sgds-mainnav-padding-x)}}:host(:not([disabled])[active]) ::slotted(*){--sgds-link-color-default:var(--sgds-primary-color-default);--sgds-link-color-emphasis:var(--sgds-primary-color-default);color:var(--sgds-primary-color-default)!important}:host(:not([disabled]):not([active])) ::slotted(a:hover){--sgds-link-color-emphasis:var(--sgds-color-default);color:var(--sgds-color-default)!important}:host(:not([disabled])[active]) ::slotted(a:hover){--sgds-link-color-emphasis:var(--sgds-primary-color-default);color:var(--sgds-primary-color-default)!important}:host([disabled]) ::slotted(a:hover){--sgds-link-color-emphasis:var(--sgds-color-default);color:var(--sgds-color-default)!important}:host(:not([disabled]):not([active])) ::slotted(a:active){color:var(--sgds-color-default)!important}:host(:not([disabled])[active]) ::slotted(a:active){color:var(--sgds-primary-color-default)!important}::slotted(a:focus-visible){--sgds-link-color-emphasis:var(--sgds-primary-color-default);color:var(--sgds-primary-color-default)!important;outline:var(--sgds-outline-focus);outline-offset:var(--sgds-outline-offset-focus)}:host([disabled]) ::slotted(*){cursor:not-allowed;opacity:var(--sgds-opacity-40)}`;
|
|
3
|
+
var css_248z = css`:host([expand=always]) ::slotted(*){border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}@media screen and (min-width:512px){:host([expand=sm]) ::slotted(*){border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}:host(:not([disabled])[active][expand=sm]) ::slotted(*){border-color:var(--sgds-primary-border-color-default)}}@media screen and (min-width:768px){:host([expand=md]) ::slotted(*){border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}:host(:not([disabled])[active][expand=md]) ::slotted(*){border-color:var(--sgds-primary-border-color-default)}}@media screen and (min-width:1024px){:host([expand=lg]) ::slotted(*){border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}:host(:not([disabled])[active][expand=lg]) ::slotted(*){border-color:var(--sgds-primary-border-color-default)}}@media screen and (min-width:1280px){:host([expand=xl]) ::slotted(*){border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}:host(:not([disabled])[active][expand=xl]) ::slotted(*){border-color:var(--sgds-primary-border-color-default)}}@media screen and (min-width:1440px){:host([expand=xxl]) ::slotted(*){border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}:host(:not([disabled])[active][expand=xxl]) ::slotted(*){border-color:var(--sgds-primary-border-color-default)}}@media screen and (max-width:511px){:host(:not([disabled])[active][expand=sm]) ::slotted(*){background-color:var(--sgds-bg-translucent-subtle)}}@media screen and (max-width:767px){:host(:not([disabled])[active][expand=md]) ::slotted(*){background-color:var(--sgds-bg-translucent-subtle)}}@media screen and (max-width:1023px){:host(:not([disabled])[active][expand=lg]) ::slotted(*){background-color:var(--sgds-bg-translucent-subtle)}}@media screen and (max-width:1279px){:host(:not([disabled])[active][expand=xl]) ::slotted(*){background-color:var(--sgds-bg-translucent-subtle)}}@media screen and (max-width:1439px){:host(:not([disabled])[active][expand=xxl]) ::slotted(*){background-color:var(--sgds-bg-translucent-subtle)}}::slotted(*){--sgds-link-color-default:var(--sgds-color-default);--sgds-link-color-emphasis:var(--sgds-color-default);align-items:center;box-sizing:border-box;color:var(--sgds-color-default)!important;cursor:pointer;display:flex;font-size:var(--sgds-font-size-label-sm);height:auto!important;line-height:var(--sgds-line-height-2-xs,20px);padding:var(--sgds-padding-sm) var(--sgds-mainnav-mobile-padding-x);text-decoration:none!important}:host([tone=brand][expand=always]) ::slotted(*),:host([tone^=gradient][expand=always]) ::slotted(*){--sgds-link-color-default:var(--sgds-color-fixed-light);--sgds-link-color-emphasis:var(--sgds-color-fixed-light);color:var(--sgds-color-fixed-light)!important}:host([tone=brand][expand=always]:not([disabled])[active]) ::slotted(*),:host([tone^=gradient][expand=always]:not([disabled])[active]) ::slotted(*){border-color:var(--sgds-color-fixed-light)}@media screen and (min-width:512px){:host([tone=brand][expand=sm]) ::slotted(*),:host([tone^=gradient][expand=sm]) ::slotted(*){--sgds-link-color-default:var(--sgds-color-fixed-light);--sgds-link-color-emphasis:var(--sgds-color-fixed-light);color:var(--sgds-color-fixed-light)!important}:host([tone=brand][expand=sm]:not([disabled])[active]) ::slotted(*),:host([tone^=gradient][expand=sm]:not([disabled])[active]) ::slotted(*){border-color:var(--sgds-color-fixed-light)}}@media screen and (min-width:768px){:host([tone=brand][expand=md]) ::slotted(*),:host([tone^=gradient][expand=md]) ::slotted(*){--sgds-link-color-default:var(--sgds-color-fixed-light);--sgds-link-color-emphasis:var(--sgds-color-fixed-light);color:var(--sgds-color-fixed-light)!important}:host([tone=brand][expand=md]:not([disabled])[active]) ::slotted(*),:host([tone^=gradient][expand=md]:not([disabled])[active]) ::slotted(*){border-color:var(--sgds-color-fixed-light)}}@media screen and (min-width:1024px){:host([tone=brand][expand=lg]) ::slotted(*),:host([tone^=gradient][expand=lg]) ::slotted(*){--sgds-link-color-default:var(--sgds-color-fixed-light);--sgds-link-color-emphasis:var(--sgds-color-fixed-light);color:var(--sgds-color-fixed-light)!important}:host([tone=brand][expand=lg]:not([disabled])[active]) ::slotted(*),:host([tone^=gradient][expand=lg]:not([disabled])[active]) ::slotted(*){border-color:var(--sgds-color-fixed-light)}}@media screen and (min-width:1280px){:host([tone=brand][expand=xl]) ::slotted(*),:host([tone^=gradient][expand=xl]) ::slotted(*){--sgds-link-color-default:var(--sgds-color-fixed-light);--sgds-link-color-emphasis:var(--sgds-color-fixed-light);color:var(--sgds-color-fixed-light)!important}:host([tone=brand][expand=xl]:not([disabled])[active]) ::slotted(*),:host([tone^=gradient][expand=xl]:not([disabled])[active]) ::slotted(*){border-color:var(--sgds-color-fixed-light)}}@media screen and (min-width:1440px){:host([tone=brand][expand=xxl]) ::slotted(*),:host([tone^=gradient][expand=xxl]) ::slotted(*){--sgds-link-color-default:var(--sgds-color-fixed-light);--sgds-link-color-emphasis:var(--sgds-color-fixed-light);color:var(--sgds-color-fixed-light)!important}:host([tone=brand][expand=xxl]:not([disabled])[active]) ::slotted(*),:host([tone^=gradient][expand=xxl]:not([disabled])[active]) ::slotted(*){border-color:var(--sgds-color-fixed-light)}}@media screen and (min-width:1024px){::slotted(*){padding:var(--sgds-padding-sm) var(--sgds-mainnav-padding-x)}}:host(:not([disabled])[active]) ::slotted(*){--sgds-link-color-default:var(--sgds-primary-color-default);--sgds-link-color-emphasis:var(--sgds-primary-color-default);color:var(--sgds-primary-color-default)!important}:host(:not([disabled]):not([active])) ::slotted(a:hover){--sgds-link-color-emphasis:var(--sgds-color-default);color:var(--sgds-color-default)!important}:host(:not([disabled])[active]) ::slotted(a:hover){--sgds-link-color-emphasis:var(--sgds-primary-color-default);color:var(--sgds-primary-color-default)!important}:host([tone=brand][expand=always]:not([disabled])[active]) ::slotted(*),:host([tone=brand][expand=always]:not([disabled])[active]) ::slotted(a:hover),:host([tone^=gradient][expand=always]:not([disabled])[active]) ::slotted(*),:host([tone^=gradient][expand=always]:not([disabled])[active]) ::slotted(a:hover){--sgds-link-color-default:var(--sgds-color-fixed-light);--sgds-link-color-emphasis:var(--sgds-color-fixed-light);color:var(--sgds-color-fixed-light)!important}@media screen and (min-width:512px){:host([tone=brand][expand=sm]:not([disabled])[active]) ::slotted(*),:host([tone=brand][expand=sm]:not([disabled])[active]) ::slotted(a:hover),:host([tone^=gradient][expand=sm]:not([disabled])[active]) ::slotted(*),:host([tone^=gradient][expand=sm]:not([disabled])[active]) ::slotted(a:hover){--sgds-link-color-default:var(--sgds-color-fixed-light);--sgds-link-color-emphasis:var(--sgds-color-fixed-light);color:var(--sgds-color-fixed-light)!important}}@media screen and (min-width:768px){:host([tone=brand][expand=md]:not([disabled])[active]) ::slotted(*),:host([tone=brand][expand=md]:not([disabled])[active]) ::slotted(a:hover),:host([tone^=gradient][expand=md]:not([disabled])[active]) ::slotted(*),:host([tone^=gradient][expand=md]:not([disabled])[active]) ::slotted(a:hover){--sgds-link-color-default:var(--sgds-color-fixed-light);--sgds-link-color-emphasis:var(--sgds-color-fixed-light);color:var(--sgds-color-fixed-light)!important}}@media screen and (min-width:1024px){:host([tone=brand][expand=lg]:not([disabled])[active]) ::slotted(*),:host([tone=brand][expand=lg]:not([disabled])[active]) ::slotted(a:hover),:host([tone^=gradient][expand=lg]:not([disabled])[active]) ::slotted(*),:host([tone^=gradient][expand=lg]:not([disabled])[active]) ::slotted(a:hover){--sgds-link-color-default:var(--sgds-color-fixed-light);--sgds-link-color-emphasis:var(--sgds-color-fixed-light);color:var(--sgds-color-fixed-light)!important}}@media screen and (min-width:1280px){:host([tone=brand][expand=xl]:not([disabled])[active]) ::slotted(*),:host([tone=brand][expand=xl]:not([disabled])[active]) ::slotted(a:hover),:host([tone^=gradient][expand=xl]:not([disabled])[active]) ::slotted(*),:host([tone^=gradient][expand=xl]:not([disabled])[active]) ::slotted(a:hover){--sgds-link-color-default:var(--sgds-color-fixed-light);--sgds-link-color-emphasis:var(--sgds-color-fixed-light);color:var(--sgds-color-fixed-light)!important}}@media screen and (min-width:1440px){:host([tone=brand][expand=xxl]:not([disabled])[active]) ::slotted(*),:host([tone=brand][expand=xxl]:not([disabled])[active]) ::slotted(a:hover),:host([tone^=gradient][expand=xxl]:not([disabled])[active]) ::slotted(*),:host([tone^=gradient][expand=xxl]:not([disabled])[active]) ::slotted(a:hover){--sgds-link-color-default:var(--sgds-color-fixed-light);--sgds-link-color-emphasis:var(--sgds-color-fixed-light);color:var(--sgds-color-fixed-light)!important}}:host([disabled]) ::slotted(a:hover){--sgds-link-color-emphasis:var(--sgds-color-default);color:var(--sgds-color-default)!important}:host(:not([disabled]):not([active])) ::slotted(a:active){color:var(--sgds-color-default)!important}:host(:not([disabled])[active]) ::slotted(a:active){color:var(--sgds-primary-color-default)!important}::slotted(a:focus-visible){--sgds-link-color-emphasis:var(--sgds-primary-color-default);color:var(--sgds-primary-color-default)!important;outline:var(--sgds-outline-focus);outline-offset:var(--sgds-outline-offset-focus)}:host([disabled]) ::slotted(*){cursor:not-allowed;opacity:var(--sgds-opacity-40)}`;
|
|
4
4
|
|
|
5
5
|
export { css_248z as default };
|
|
6
6
|
//# sourceMappingURL=mainnav-item.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
var css_248z = css`:host([expand=always]) .nav-link{border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}@media (min-width:512px){:host([expand=sm]) .nav-link{border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}}@media (min-width:768px){:host([expand=md]) .nav-link{border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}}@media (min-width:1024px){:host(:not([expand])) .nav-link,:host([expand=lg]) .nav-link{border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}}@media (min-width:1280px){:host([expand=xl]) .nav-link{border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}}@media (min-width:1440px){:host([expand=xxl]) .nav-link{border-bottom:var(--sgds-border-width-4) solid transparent;min-height:100%;padding:0 var(--sgds-padding-md)}}button.nav-link{appearance:none;background:none;border:none;font-family:inherit}.nav-link{align-items:center;box-sizing:border-box;color:var(--sgds-color-default);cursor:pointer;display:flex;font-size:var(--sgds-font-size-label-sm);gap:var(--sgds-gap-xs);line-height:var(--sgds-line-height-2-xs,20px);padding:var(--sgds-padding-sm) var(--sgds-mainnav-mobile-padding-x);text-decoration:none}.nav-link:not(.disabled):hover{color:var(--sgds-primary-color-default)}.nav-link:not(.disabled):focus-visible{color:var(--sgds-primary-color-default);outline:var(--sgds-outline-focus);outline-offset:var(--sgds-outline-offset-focus)}.nav-link.disabled{cursor:not-allowed;opacity:var(--sgds-opacity-40)}:host([tone=brand][expand=always]) .nav-link,:host([tone^=gradient][expand=always]) .nav-link{color:var(--sgds-color-fixed-light)}@media screen and (min-width:512px){:host([tone=brand][expand=sm]) .nav-link,:host([tone^=gradient][expand=sm]) .nav-link{color:var(--sgds-color-fixed-light)}}@media screen and (min-width:768px){:host([tone=brand][expand=md]) .nav-link,:host([tone^=gradient][expand=md]) .nav-link{color:var(--sgds-color-fixed-light)}}@media screen and (min-width:1024px){:host([tone=brand][expand=lg]) .nav-link,:host([tone^=gradient][expand=lg]) .nav-link{color:var(--sgds-color-fixed-light)}}@media screen and (min-width:1280px){:host([tone=brand][expand=xl]) .nav-link,:host([tone^=gradient][expand=xl]) .nav-link{color:var(--sgds-color-fixed-light)}}@media screen and (min-width:1440px){:host([tone=brand][expand=xxl]) .nav-link,:host([tone^=gradient][expand=xxl]) .nav-link{color:var(--sgds-color-fixed-light)}}.profile-text{display:flex;flex:1;flex-direction:column;gap:var(--sgds-gap-text-2-xs,2px);text-align:left}.profile-label{font-weight:var(--sgds-font-weight-semibold)}.profile-label,.profile-secondary-text{font-size:var(--sgds-font-size-body-xs);line-height:var(--sgds-line-height-3-xs,16px)}sgds-dropdown{display:block;height:100%}.profile-avatar-mobile{align-items:center;border-radius:var(--sgds-border-radius-full);cursor:pointer;display:flex;height:100%}.profile-avatar-mobile:focus-visible{outline:var(--sgds-outline-focus);outline-offset:var(--sgds-outline-offset-focus)}.profile-mobile-panel{animation:profile-panel-show .2s ease-in-out;background-color:var(--sgds-surface-default);border-top:var(--sgds-border-width-1) solid var(--sgds-border-color-translucent);box-shadow:0 2px 4px 0 hsla(0,0%,5%,.08);left:0;overflow:hidden;padding:var(--sgds-padding-md) 0;position:absolute;top:100%;width:100%;z-index:var(--sgds-z-index-floating)}.profile-mobile-panel[hidden]{display:none}@keyframes profile-panel-show{0%{max-height:0;opacity:0}to{max-height:100dvh;opacity:1}}.profile-mobile-items{display:flex;flex-direction:column;margin:auto;max-height:calc(100dvh - 72px);max-width:var(--sgds-mainnav-max-width,1440px);overflow-y:auto;width:100%}@media screen and (min-width:1024px){.nav-link{padding:var(--sgds-padding-sm) var(--sgds-mainnav-padding-x)}}`;
|
|
4
|
+
|
|
5
|
+
export { css_248z as default };
|
|
6
|
+
//# sourceMappingURL=mainnav-profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mainnav-profile.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
|
|
3
|
-
var css_248z = css`:host{display:block}nav{background-color:var(--sgds-surface-default);box-shadow:0 2px
|
|
3
|
+
var css_248z = css`:host{display:block}nav{background-color:var(--sgds-surface-default);box-shadow:0 2px 4px 0 hsla(0,0%,5%,.08);position:relative;z-index:var(--sgds-z-index-floating)}:host([tone=brand]) nav{background-color:var(--sgds-primary-surface-default)}:host([tone=gradient-1]) nav{background:var(--sgds-gradient-1)}:host([tone=gradient-2]) nav{background:var(--sgds-gradient-2)}:host([tone=gradient-3]) nav{background:var(--sgds-gradient-3)}:host([tone=gradient-4]) nav{background:var(--sgds-gradient-4)}.navbar{align-items:stretch;display:flex;flex-wrap:wrap;font-size:var(--sgds-font-size-label-sm);gap:var(--sgds-gap-xs);justify-content:flex-start;margin:auto;max-width:var(--sgds-mainnav-max-width,1440px);min-height:var(--sgds-mainnav-height,72px);padding:0 var(--sgds-mainnav-mobile-padding-x);width:100%}:host([fluid]) .navbar{max-width:none}.navbar-brand{align-items:center;color:var(--sgds-color-default);display:flex;text-decoration:none;white-space:nowrap}:host([tone=brand]) .navbar-brand,:host([tone^=gradient]) .navbar-brand{color:var(--sgds-color-fixed-light)}.navbar-brand:focus-visible{outline:var(--sgds-outline-focus);outline-offset:var(--sgds-outline-offset-focus)}.navbar-nav{display:flex;flex-direction:column;height:100%;margin-bottom:0;margin-top:0;width:100%}nav>.navbar-body{background-color:var(--sgds-surface-default);border-top:var(--sgds-border-width-1) solid var(--sgds-border-color-translucent);box-shadow:0 2px 4px 0 hsla(0,0%,5%,.08);padding:var(--sgds-padding-md) 0;position:absolute;transition:transform .2s ease-in-out;width:100%;z-index:var(--sgds-z-index-floating)}nav>.navbar-body .navbar-nav{height:100dvh;margin:auto;max-width:var(--sgds-mainnav-max-width,1440px)}nav>.navbar-body slot::slotted(:not(sgds-mainnav-item):not(sgds-mainnav-dropdown):not(sgds-mainnav-profile)){padding:var(--sgds-padding-sm) var(--sgds-mainnav-mobile-padding-x)}.navbar-collapse{align-items:center;flex-basis:100%;flex-grow:1}.navbar-toggler{align-self:center}:host([tone=brand]) .navbar-toggler,:host([tone^=gradient]) .navbar-toggler{color:var(--sgds-color-fixed-light)}@media (prefers-reduced-motion:reduce){.navbar-toggler{transition:none}}.navbar-nav-scroll{overflow-y:auto}@media (min-width:512px){.navbar-expand-sm{flex-wrap:nowrap;gap:var(--sgds-gap-xl);justify-content:flex-start}.navbar-expand-sm .navbar-nav{flex-direction:row}.navbar-expand-sm .navbar-nav-scroll{overflow:visible}.navbar-expand-sm .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-sm .navbar-toggler{display:none}}@media (min-width:768px){.navbar-expand-md{flex-wrap:nowrap;gap:var(--sgds-gap-xl);justify-content:flex-start}.navbar-expand-md .navbar-nav{flex-direction:row}.navbar-expand-md .navbar-nav-scroll{overflow:visible}.navbar-expand-md .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-md .navbar-toggler{display:none}}@media (min-width:1024px){.navbar{padding:0 var(--sgds-mainnav-padding-x)}.navbar-expand-lg{flex-wrap:nowrap;gap:var(--sgds-gap-xl);justify-content:flex-start}.navbar-expand-lg .navbar-nav{flex-direction:row}.navbar-expand-lg .navbar-nav-scroll{overflow:visible}.navbar-expand-lg .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-lg .navbar-toggler{display:none}}@media (min-width:1280px){.navbar-expand-xl{flex-wrap:nowrap;gap:var(--sgds-gap-xl);justify-content:flex-start}.navbar-expand-xl .navbar-nav{flex-direction:row}.navbar-expand-xl .navbar-nav .nav-link{padding-left:var(--mainnav-nav-link-padding-x);padding-right:var(--mainnav-nav-link-padding-x)}.navbar-expand-xl .navbar-nav-scroll{overflow:visible}.navbar-expand-xl .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-xl .navbar-toggler{display:none}}@media (min-width:1440px){.navbar-expand-xxl{flex-wrap:nowrap;gap:var(--sgds-gap-xl);justify-content:flex-start}.navbar-expand-xxl .navbar-nav{flex-direction:row}.navbar-expand-xxl .navbar-nav-scroll{overflow:visible}.navbar-expand-xxl .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-xxl .navbar-toggler{display:none}}.navbar-expand{flex-wrap:nowrap;gap:var(--sgds-gap-xl);justify-content:flex-start}.navbar-expand .navbar-nav{flex-direction:row}.navbar-expand .navbar-nav-scroll{overflow:visible}.navbar-expand .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand .navbar-toggler{display:none}.navbar-end{margin-left:auto}.navbar-end,slot[name=start]{align-items:center;display:flex;gap:var(--sgds-gap-xs)}slot[name=profile]{align-self:stretch;display:flex}slot[name=non-collapsible]{align-items:center;display:flex;gap:var(--sgds-spacer-4)}slot[name=non-collapsible].non-collapsible-empty{display:none}:host([tone=brand]) slot[name=non-collapsible]::slotted(*),:host([tone^=gradient]) slot[name=non-collapsible]::slotted(*){color:var(--sgds-color-fixed-light)}.slot-end{align-items:stretch;display:flex;gap:var(--sgds-gap-xs);height:inherit;margin-left:auto}.slot-end::slotted(:not([name$=-mainnav-item]):not([name$=-mainnav-dropdown])){align-self:center}`;
|
|
4
4
|
|
|
5
5
|
export { css_248z as default };
|
|
6
6
|
//# sourceMappingURL=mainnav.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import SgdsElement from "../../base/sgds-element";
|
|
2
|
+
import SgdsDropdown from "../Dropdown/sgds-dropdown";
|
|
3
|
+
import SgdsDropdownItem from "../Dropdown/sgds-dropdown-item";
|
|
4
|
+
import SgdsIcon from "../Icon/sgds-icon";
|
|
5
|
+
/**
|
|
6
|
+
* @summary A profile component for the mainnav that shows a full dropdown in desktop and handles its own mobile menu.
|
|
7
|
+
* In desktop: renders avatar + label + secondaryText with a dropdown.
|
|
8
|
+
* In mobile: renders the avatar as a toggler that opens a self-contained mobile panel with profile items.
|
|
9
|
+
* When present, it disables the mainnav's default hamburger toggler.
|
|
10
|
+
*
|
|
11
|
+
* @slot avatar - Avatar element displayed in both desktop (before label) and mobile (as toggler)
|
|
12
|
+
* @slot default - Profile menu items (sgds-dropdown-item elements)
|
|
13
|
+
*/
|
|
14
|
+
export declare class SgdsMainnavProfile extends SgdsElement {
|
|
15
|
+
static styles: import("lit").CSSResult[];
|
|
16
|
+
/** @internal */
|
|
17
|
+
static dependencies: {
|
|
18
|
+
"sgds-dropdown": typeof SgdsDropdown;
|
|
19
|
+
"sgds-dropdown-item": typeof SgdsDropdownItem;
|
|
20
|
+
"sgds-icon": typeof SgdsIcon;
|
|
21
|
+
};
|
|
22
|
+
private _breakpointReached;
|
|
23
|
+
/** @internal Whether the mobile menu is open */
|
|
24
|
+
private _mobileMenuOpen;
|
|
25
|
+
/** Primary text displayed next to the avatar in desktop (e.g. user name) */
|
|
26
|
+
label: string;
|
|
27
|
+
/** Secondary text displayed below the label in desktop (e.g. agency or role) */
|
|
28
|
+
secondaryText: string;
|
|
29
|
+
/** When true, disables the profile dropdown */
|
|
30
|
+
disabled: boolean;
|
|
31
|
+
/** Accessible label for the profile toggle button */
|
|
32
|
+
ariaLabel: string;
|
|
33
|
+
/** Controls dropdown close behavior. "default" auto-closes on item/outside click, "outside" closes only on outside click, "inside" prevents auto-close. */
|
|
34
|
+
close: "default" | "outside" | "inside";
|
|
35
|
+
/** @internal */
|
|
36
|
+
private togglerId;
|
|
37
|
+
private _handleMobileToggle;
|
|
38
|
+
private _handleKeydown;
|
|
39
|
+
render(): import("lit").TemplateResult<1>;
|
|
40
|
+
}
|
|
41
|
+
export default SgdsMainnavProfile;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { __decorate } from 'tslib';
|
|
2
|
+
import { html, nothing } from 'lit';
|
|
3
|
+
import { consume } from '@lit/context';
|
|
4
|
+
import { state, property } from 'lit/decorators.js';
|
|
5
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
6
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
7
|
+
import { offset } from '@floating-ui/dom';
|
|
8
|
+
import SgdsElement from '../../base/sgds-element.js';
|
|
9
|
+
import { SgdsDropdown } from '../Dropdown/sgds-dropdown.js';
|
|
10
|
+
import { SgdsDropdownItem } from '../Dropdown/sgds-dropdown-item.js';
|
|
11
|
+
import { SgdsIcon } from '../Icon/sgds-icon.js';
|
|
12
|
+
import { MainnavBreakpointContext } from './mainnav-context.js';
|
|
13
|
+
import css_248z from './mainnav-profile.js';
|
|
14
|
+
import genId from '../../utils/generateId.js';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @summary A profile component for the mainnav that shows a full dropdown in desktop and handles its own mobile menu.
|
|
18
|
+
* In desktop: renders avatar + label + secondaryText with a dropdown.
|
|
19
|
+
* In mobile: renders the avatar as a toggler that opens a self-contained mobile panel with profile items.
|
|
20
|
+
* When present, it disables the mainnav's default hamburger toggler.
|
|
21
|
+
*
|
|
22
|
+
* @slot avatar - Avatar element displayed in both desktop (before label) and mobile (as toggler)
|
|
23
|
+
* @slot default - Profile menu items (sgds-dropdown-item elements)
|
|
24
|
+
*/
|
|
25
|
+
class SgdsMainnavProfile extends SgdsElement {
|
|
26
|
+
constructor() {
|
|
27
|
+
super(...arguments);
|
|
28
|
+
this._breakpointReached = true;
|
|
29
|
+
/** @internal Whether the mobile menu is open */
|
|
30
|
+
this._mobileMenuOpen = false;
|
|
31
|
+
/** Primary text displayed next to the avatar in desktop (e.g. user name) */
|
|
32
|
+
this.label = "";
|
|
33
|
+
/** Secondary text displayed below the label in desktop (e.g. agency or role) */
|
|
34
|
+
this.secondaryText = "";
|
|
35
|
+
/** When true, disables the profile dropdown */
|
|
36
|
+
this.disabled = false;
|
|
37
|
+
/** Accessible label for the profile toggle button */
|
|
38
|
+
this.ariaLabel = "";
|
|
39
|
+
/** Controls dropdown close behavior. "default" auto-closes on item/outside click, "outside" closes only on outside click, "inside" prevents auto-close. */
|
|
40
|
+
this.close = "default";
|
|
41
|
+
/** @internal */
|
|
42
|
+
this.togglerId = genId("profile", "button");
|
|
43
|
+
this._handleMobileToggle = () => {
|
|
44
|
+
this._mobileMenuOpen = !this._mobileMenuOpen;
|
|
45
|
+
};
|
|
46
|
+
this._handleKeydown = (e) => {
|
|
47
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
this._handleMobileToggle();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
render() {
|
|
54
|
+
if (!this._breakpointReached) {
|
|
55
|
+
// Desktop: dropdown with avatar + label + secondaryText
|
|
56
|
+
return html `
|
|
57
|
+
<sgds-dropdown .floatingOpts=${{ middleware: [offset(0)] }} ?disabled=${this.disabled} close=${this.close}>
|
|
58
|
+
<button
|
|
59
|
+
class="${classMap({
|
|
60
|
+
"nav-link": true,
|
|
61
|
+
disabled: this.disabled
|
|
62
|
+
})}"
|
|
63
|
+
aria-disabled=${this.disabled ? "true" : "false"}
|
|
64
|
+
aria-label=${ifDefined(this.ariaLabel)}
|
|
65
|
+
id=${this.togglerId}
|
|
66
|
+
tabindex=${this.disabled ? "-1" : "0"}
|
|
67
|
+
slot="toggler"
|
|
68
|
+
>
|
|
69
|
+
<slot name="avatar"></slot>
|
|
70
|
+
${this.label || this.secondaryText
|
|
71
|
+
? html `<div class="profile-text">
|
|
72
|
+
${this.label ? html `<span class="profile-label">${this.label}</span>` : nothing}
|
|
73
|
+
${this.secondaryText
|
|
74
|
+
? html `<span class="profile-secondary-text">${this.secondaryText}</span>`
|
|
75
|
+
: nothing}
|
|
76
|
+
</div>`
|
|
77
|
+
: nothing}
|
|
78
|
+
<sgds-icon name="chevron-down" size="md"></sgds-icon>
|
|
79
|
+
</button>
|
|
80
|
+
<slot></slot>
|
|
81
|
+
</sgds-dropdown>
|
|
82
|
+
`;
|
|
83
|
+
}
|
|
84
|
+
// Mobile: avatar toggler + self-contained mobile panel
|
|
85
|
+
return html `
|
|
86
|
+
<div
|
|
87
|
+
class="profile-avatar-mobile"
|
|
88
|
+
role="button"
|
|
89
|
+
tabindex="0"
|
|
90
|
+
aria-label=${this.ariaLabel || "Toggle navigation"}
|
|
91
|
+
aria-expanded=${this._mobileMenuOpen ? "true" : "false"}
|
|
92
|
+
@click=${this._handleMobileToggle}
|
|
93
|
+
@keydown=${this._handleKeydown}
|
|
94
|
+
>
|
|
95
|
+
<slot name="avatar"></slot>
|
|
96
|
+
</div>
|
|
97
|
+
<div class="profile-mobile-panel" ?hidden=${!this._mobileMenuOpen}>
|
|
98
|
+
<div class="profile-mobile-items">
|
|
99
|
+
<slot></slot>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
`;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
SgdsMainnavProfile.styles = [...SgdsElement.styles, css_248z];
|
|
106
|
+
/** @internal */
|
|
107
|
+
SgdsMainnavProfile.dependencies = {
|
|
108
|
+
"sgds-dropdown": SgdsDropdown,
|
|
109
|
+
"sgds-dropdown-item": SgdsDropdownItem,
|
|
110
|
+
"sgds-icon": SgdsIcon
|
|
111
|
+
};
|
|
112
|
+
__decorate([
|
|
113
|
+
consume({ context: MainnavBreakpointContext, subscribe: true }),
|
|
114
|
+
state()
|
|
115
|
+
], SgdsMainnavProfile.prototype, "_breakpointReached", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
state()
|
|
118
|
+
], SgdsMainnavProfile.prototype, "_mobileMenuOpen", void 0);
|
|
119
|
+
__decorate([
|
|
120
|
+
property({ type: String, reflect: true })
|
|
121
|
+
], SgdsMainnavProfile.prototype, "label", void 0);
|
|
122
|
+
__decorate([
|
|
123
|
+
property({ type: String, reflect: true })
|
|
124
|
+
], SgdsMainnavProfile.prototype, "secondaryText", void 0);
|
|
125
|
+
__decorate([
|
|
126
|
+
property({ type: Boolean })
|
|
127
|
+
], SgdsMainnavProfile.prototype, "disabled", void 0);
|
|
128
|
+
__decorate([
|
|
129
|
+
property({ type: String })
|
|
130
|
+
], SgdsMainnavProfile.prototype, "ariaLabel", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
property({ type: String })
|
|
133
|
+
], SgdsMainnavProfile.prototype, "close", void 0);
|
|
134
|
+
|
|
135
|
+
export { SgdsMainnavProfile, SgdsMainnavProfile as default };
|
|
136
|
+
//# sourceMappingURL=sgds-mainnav-profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sgds-mainnav-profile.js","sources":["../../../src/components/Mainnav/sgds-mainnav-profile.ts"],"sourcesContent":["import { html, nothing } from \"lit\";\nimport { consume } from \"@lit/context\";\nimport { property, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { offset } from \"@floating-ui/dom\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport SgdsDropdown from \"../Dropdown/sgds-dropdown\";\nimport SgdsDropdownItem from \"../Dropdown/sgds-dropdown-item\";\nimport SgdsIcon from \"../Icon/sgds-icon\";\nimport { MainnavBreakpointContext } from \"./mainnav-context\";\nimport mainnavProfileStyle from \"./mainnav-profile.css\";\nimport genId from \"../../utils/generateId\";\n\n/**\n * @summary A profile component for the mainnav that shows a full dropdown in desktop and handles its own mobile menu.\n * In desktop: renders avatar + label + secondaryText with a dropdown.\n * In mobile: renders the avatar as a toggler that opens a self-contained mobile panel with profile items.\n * When present, it disables the mainnav's default hamburger toggler.\n *\n * @slot avatar - Avatar element displayed in both desktop (before label) and mobile (as toggler)\n * @slot default - Profile menu items (sgds-dropdown-item elements)\n */\nexport class SgdsMainnavProfile extends SgdsElement {\n static styles = [...SgdsElement.styles, mainnavProfileStyle];\n /** @internal */\n static dependencies = {\n \"sgds-dropdown\": SgdsDropdown,\n \"sgds-dropdown-item\": SgdsDropdownItem,\n \"sgds-icon\": SgdsIcon\n };\n\n @consume({ context: MainnavBreakpointContext, subscribe: true })\n @state()\n private _breakpointReached = true;\n\n /** @internal Whether the mobile menu is open */\n @state()\n private _mobileMenuOpen = false;\n\n /** Primary text displayed next to the avatar in desktop (e.g. user name) */\n @property({ type: String, reflect: true })\n label = \"\";\n\n /** Secondary text displayed below the label in desktop (e.g. agency or role) */\n @property({ type: String, reflect: true })\n secondaryText = \"\";\n\n /** When true, disables the profile dropdown */\n @property({ type: Boolean })\n disabled = false;\n\n /** Accessible label for the profile toggle button */\n @property({ type: String })\n ariaLabel = \"\";\n\n /** Controls dropdown close behavior. \"default\" auto-closes on item/outside click, \"outside\" closes only on outside click, \"inside\" prevents auto-close. */\n @property({ type: String })\n close: \"default\" | \"outside\" | \"inside\" = \"default\";\n\n /** @internal */\n private togglerId: string = genId(\"profile\", \"button\");\n\n private _handleMobileToggle = () => {\n this._mobileMenuOpen = !this._mobileMenuOpen;\n };\n\n private _handleKeydown = (e: KeyboardEvent) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n this._handleMobileToggle();\n }\n };\n\n render() {\n if (!this._breakpointReached) {\n // Desktop: dropdown with avatar + label + secondaryText\n return html`\n <sgds-dropdown .floatingOpts=${{ middleware: [offset(0)] }} ?disabled=${this.disabled} close=${this.close}>\n <button\n class=\"${classMap({\n \"nav-link\": true,\n disabled: this.disabled\n })}\"\n aria-disabled=${this.disabled ? \"true\" : \"false\"}\n aria-label=${ifDefined(this.ariaLabel)}\n id=${this.togglerId}\n tabindex=${this.disabled ? \"-1\" : \"0\"}\n slot=\"toggler\"\n >\n <slot name=\"avatar\"></slot>\n ${this.label || this.secondaryText\n ? html`<div class=\"profile-text\">\n ${this.label ? html`<span class=\"profile-label\">${this.label}</span>` : nothing}\n ${this.secondaryText\n ? html`<span class=\"profile-secondary-text\">${this.secondaryText}</span>`\n : nothing}\n </div>`\n : nothing}\n <sgds-icon name=\"chevron-down\" size=\"md\"></sgds-icon>\n </button>\n <slot></slot>\n </sgds-dropdown>\n `;\n }\n\n // Mobile: avatar toggler + self-contained mobile panel\n return html`\n <div\n class=\"profile-avatar-mobile\"\n role=\"button\"\n tabindex=\"0\"\n aria-label=${this.ariaLabel || \"Toggle navigation\"}\n aria-expanded=${this._mobileMenuOpen ? \"true\" : \"false\"}\n @click=${this._handleMobileToggle}\n @keydown=${this._handleKeydown}\n >\n <slot name=\"avatar\"></slot>\n </div>\n <div class=\"profile-mobile-panel\" ?hidden=${!this._mobileMenuOpen}>\n <div class=\"profile-mobile-items\">\n <slot></slot>\n </div>\n </div>\n `;\n }\n}\n\nexport default SgdsMainnavProfile;\n"],"names":["mainnavProfileStyle"],"mappings":"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"}
|
|
@@ -4,6 +4,7 @@ import SgdsIconButton from "../IconButton/sgds-icon-button";
|
|
|
4
4
|
import SgdsMainnavDropdown from "./sgds-mainnav-dropdown";
|
|
5
5
|
import SgdsMainnavItem from "./sgds-mainnav-item";
|
|
6
6
|
export type MainnavExpandSize = "sm" | "md" | "lg" | "xl" | "xxl" | "always" | "never";
|
|
7
|
+
export type MainnavTone = "default" | "brand" | "gradient-1" | "gradient-2" | "gradient-3" | "gradient-4";
|
|
7
8
|
/**
|
|
8
9
|
* @summary This component is the primary means that your users will use to navigate through your portal. It includes horizontal navigation and branding to identify your site.
|
|
9
10
|
*
|
|
@@ -13,8 +14,10 @@ export type MainnavExpandSize = "sm" | "md" | "lg" | "xl" | "xxl" | "always" | "
|
|
|
13
14
|
* @event sgds-after-hide - Emitted on hide after animation has completed. Only for collapsed menu.
|
|
14
15
|
*
|
|
15
16
|
* @slot default - Default slot of SgdsMainnav. Pass in SgdsMainnavItem elements here.
|
|
17
|
+
* @slot start - Elements in this slot will be positioned to the left of the brand.
|
|
16
18
|
* @slot end - Elements in this slot will be positioned to the right end of .navbar-nav. Elements in this slot will also be included in collapsed menu.
|
|
17
19
|
* @slot brand - Brand slot of SgdsMainnav. Pass in brand logo img here
|
|
20
|
+
* @slot profile - Profile slot positioned at the far right in desktop. In mobile, moves into the collapsed menu as the first item.
|
|
18
21
|
* @slot non-collapsible - Elements in this slot will not be collapsed
|
|
19
22
|
*
|
|
20
23
|
*/
|
|
@@ -29,32 +32,26 @@ export declare class SgdsMainnav extends SgdsElement {
|
|
|
29
32
|
private expanded;
|
|
30
33
|
/** Denotes the transition state of mobile mainnav menu opening */
|
|
31
34
|
private expanding;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
/** @internal */
|
|
39
|
-
|
|
40
|
-
/** @internal */
|
|
41
|
-
navScroll: HTMLElement;
|
|
42
|
-
/** @internal */
|
|
43
|
-
nonCollapsibleSlot: HTMLSlotElement;
|
|
35
|
+
private nav;
|
|
36
|
+
private navbar;
|
|
37
|
+
private header;
|
|
38
|
+
private body;
|
|
39
|
+
private navScroll;
|
|
40
|
+
private navbarEnd;
|
|
41
|
+
/** @internal Whether sgds-mainnav-profile is slotted in the profile slot */
|
|
42
|
+
private _hasProfileComponent;
|
|
44
43
|
/** Used only for SSR to indicate the presence of the `non-collapsible` slot. */
|
|
45
44
|
hasNonCollapsibleSlot: boolean;
|
|
46
45
|
/** The href link for brand logo */
|
|
47
46
|
brandHref: string;
|
|
47
|
+
tone: MainnavTone;
|
|
48
48
|
private collapseId;
|
|
49
49
|
/** The breakpoint, below which, the Navbar will collapse. When always the Navbar will always be expanded regardless of screen size. When never, the Navbar will always be collapsed */
|
|
50
50
|
expand: MainnavExpandSize;
|
|
51
51
|
/** When true, removes max-width constraint to allow content to stretch full screen width */
|
|
52
52
|
fluid: boolean;
|
|
53
|
-
|
|
54
|
-
breakpointReached: boolean;
|
|
55
|
-
/** @internal */
|
|
53
|
+
private breakpointReached;
|
|
56
54
|
private defaultNodes;
|
|
57
|
-
/** @internal */
|
|
58
55
|
private endNodes;
|
|
59
56
|
/** @internal */
|
|
60
57
|
get defaultSlotItems(): SgdsMainnavItem[] | SgdsMainnavDropdown[];
|
|
@@ -81,6 +78,7 @@ export declare class SgdsMainnav extends SgdsElement {
|
|
|
81
78
|
hide(): Promise<void>;
|
|
82
79
|
private _handleDefaultSlotChange;
|
|
83
80
|
private _handleSlotChange;
|
|
81
|
+
private _handleProfileSlotChange;
|
|
84
82
|
render(): import("lit").TemplateResult<1>;
|
|
85
83
|
_expandClass(): string;
|
|
86
84
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
2
|
import { provide } from '@lit/context';
|
|
3
|
-
import { html } from 'lit';
|
|
3
|
+
import { html, nothing } from 'lit';
|
|
4
4
|
import { state, query, property, queryAssignedElements } from 'lit/decorators.js';
|
|
5
5
|
import { classMap } from 'lit/directives/class-map.js';
|
|
6
6
|
import SgdsElement from '../../base/sgds-element.js';
|
|
@@ -33,8 +33,10 @@ const SIZES = {
|
|
|
33
33
|
* @event sgds-after-hide - Emitted on hide after animation has completed. Only for collapsed menu.
|
|
34
34
|
*
|
|
35
35
|
* @slot default - Default slot of SgdsMainnav. Pass in SgdsMainnavItem elements here.
|
|
36
|
+
* @slot start - Elements in this slot will be positioned to the left of the brand.
|
|
36
37
|
* @slot end - Elements in this slot will be positioned to the right end of .navbar-nav. Elements in this slot will also be included in collapsed menu.
|
|
37
38
|
* @slot brand - Brand slot of SgdsMainnav. Pass in brand logo img here
|
|
39
|
+
* @slot profile - Profile slot positioned at the far right in desktop. In mobile, moves into the collapsed menu as the first item.
|
|
38
40
|
* @slot non-collapsible - Elements in this slot will not be collapsed
|
|
39
41
|
*
|
|
40
42
|
*/
|
|
@@ -46,16 +48,18 @@ class SgdsMainnav extends SgdsElement {
|
|
|
46
48
|
this.expanded = false;
|
|
47
49
|
/** Denotes the transition state of mobile mainnav menu opening */
|
|
48
50
|
this.expanding = false;
|
|
51
|
+
/** @internal Whether sgds-mainnav-profile is slotted in the profile slot */
|
|
52
|
+
this._hasProfileComponent = false;
|
|
49
53
|
/** Used only for SSR to indicate the presence of the `non-collapsible` slot. */
|
|
50
54
|
this.hasNonCollapsibleSlot = false;
|
|
51
55
|
/** The href link for brand logo */
|
|
52
56
|
this.brandHref = "";
|
|
57
|
+
this.tone = "default";
|
|
53
58
|
this.collapseId = genId("mainnav", "collapse");
|
|
54
59
|
/** The breakpoint, below which, the Navbar will collapse. When always the Navbar will always be expanded regardless of screen size. When never, the Navbar will always be collapsed */
|
|
55
60
|
this.expand = "lg";
|
|
56
61
|
/** When true, removes max-width constraint to allow content to stretch full screen width */
|
|
57
62
|
this.fluid = false;
|
|
58
|
-
/** @internal */
|
|
59
63
|
this.breakpointReached = false;
|
|
60
64
|
this.hasSlotController = new HasSlotController(this, "non-collapsible");
|
|
61
65
|
this._handleMobileNavBound = this._handleMobileNav.bind(this);
|
|
@@ -93,7 +97,7 @@ class SgdsMainnav extends SgdsElement {
|
|
|
93
97
|
this.hasNonCollapsibleSlot = this.hasSlotController.test("non-collapsible");
|
|
94
98
|
}
|
|
95
99
|
_handleClickOutOfElement(e, self) {
|
|
96
|
-
if (!e.composedPath().includes(self) && !e.composedPath().includes(this.header)) {
|
|
100
|
+
if (!e.composedPath().includes(self) && !(this.header && e.composedPath().includes(this.header))) {
|
|
97
101
|
this.hide();
|
|
98
102
|
}
|
|
99
103
|
}
|
|
@@ -140,7 +144,7 @@ class SgdsMainnav extends SgdsElement {
|
|
|
140
144
|
}
|
|
141
145
|
_handleDesktopNav() {
|
|
142
146
|
var _a;
|
|
143
|
-
(_a = this.navbar) === null || _a === void 0 ? void 0 : _a.insertBefore(this.body, this.
|
|
147
|
+
(_a = this.navbar) === null || _a === void 0 ? void 0 : _a.insertBefore(this.body, this.navbarEnd);
|
|
144
148
|
}
|
|
145
149
|
async _animateToShow() {
|
|
146
150
|
const sgdsShow = this.emit("sgds-show", { cancelable: true });
|
|
@@ -172,13 +176,14 @@ class SgdsMainnav extends SgdsElement {
|
|
|
172
176
|
}
|
|
173
177
|
/** @internal */
|
|
174
178
|
async handleOpenChange() {
|
|
179
|
+
var _a;
|
|
175
180
|
if (this.expanding) {
|
|
176
181
|
// Show
|
|
177
182
|
await this._animateToShow();
|
|
178
183
|
this.expanded = true;
|
|
179
184
|
}
|
|
180
185
|
else {
|
|
181
|
-
this.header.focus();
|
|
186
|
+
(_a = this.header) === null || _a === void 0 ? void 0 : _a.focus();
|
|
182
187
|
// Hide
|
|
183
188
|
await this._animateToHide();
|
|
184
189
|
this.expanded = false;
|
|
@@ -205,7 +210,13 @@ class SgdsMainnav extends SgdsElement {
|
|
|
205
210
|
const childElements = e.target.assignedElements({ flatten: true });
|
|
206
211
|
childElements.forEach(el => {
|
|
207
212
|
el.setAttribute("expand", this.expand);
|
|
213
|
+
el.setAttribute("tone", this.tone);
|
|
208
214
|
});
|
|
215
|
+
if (this._hasProfileComponent && childElements.length > 0) {
|
|
216
|
+
console.warn("[sgds-mainnav] Using <sgds-mainnav-item> alongside <sgds-mainnav-profile> is not recommended. " +
|
|
217
|
+
"The profile component disables the mainnav hamburger menu, so nav items will have no mobile menu. " +
|
|
218
|
+
"Use a sidebar for navigation in operational apps.");
|
|
219
|
+
}
|
|
209
220
|
}
|
|
210
221
|
// assigning name attribute to elements added in slot="end", to use wildcard css selector to assign styles only to *-mainnav-item
|
|
211
222
|
_handleSlotChange(e) {
|
|
@@ -213,13 +224,28 @@ class SgdsMainnav extends SgdsElement {
|
|
|
213
224
|
childElements.forEach(e => {
|
|
214
225
|
e.setAttribute("name", e.tagName.toLowerCase());
|
|
215
226
|
e.setAttribute("expand", this.expand);
|
|
227
|
+
e.setAttribute("tone", this.tone);
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
_handleProfileSlotChange(e) {
|
|
231
|
+
const childElements = e.target.assignedElements({ flatten: true });
|
|
232
|
+
this._hasProfileComponent = childElements.some(el => el.tagName.toLowerCase() === "sgds-mainnav-profile");
|
|
233
|
+
childElements.forEach(el => {
|
|
234
|
+
el.setAttribute("expand", this.expand);
|
|
235
|
+
el.setAttribute("tone", this.tone);
|
|
216
236
|
});
|
|
237
|
+
if (this._hasProfileComponent && this.defaultSlotItems.length > 0) {
|
|
238
|
+
console.warn("[sgds-mainnav] Using <sgds-mainnav-item> alongside <sgds-mainnav-profile> is not recommended. " +
|
|
239
|
+
"The profile component disables the mainnav hamburger menu, so nav items will have no mobile menu. " +
|
|
240
|
+
"Use a sidebar for navigation in operational apps.");
|
|
241
|
+
}
|
|
217
242
|
}
|
|
218
243
|
render() {
|
|
219
244
|
this.breakpointReached = window.innerWidth < SIZES[this.expand];
|
|
220
245
|
return html `
|
|
221
246
|
<nav>
|
|
222
247
|
<div class="navbar ${this._expandClass()}">
|
|
248
|
+
<slot name="start"></slot>
|
|
223
249
|
<a class="navbar-brand" href=${this.brandHref} aria-label="brand-link">
|
|
224
250
|
<slot name="brand"></slot>
|
|
225
251
|
</a>
|
|
@@ -233,20 +259,26 @@ class SgdsMainnav extends SgdsElement {
|
|
|
233
259
|
></slot>
|
|
234
260
|
</div>
|
|
235
261
|
</div>
|
|
236
|
-
<
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
name=${this.
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
262
|
+
<div class="navbar-end">
|
|
263
|
+
<slot
|
|
264
|
+
name="non-collapsible"
|
|
265
|
+
class=${classMap({ "non-collapsible-empty": !this.hasNonCollapsibleSlot })}
|
|
266
|
+
></slot>
|
|
267
|
+
<slot name="profile" @slotchange=${this._handleProfileSlotChange}></slot>
|
|
268
|
+
${!(this._hasProfileComponent && this.breakpointReached)
|
|
269
|
+
? html `<sgds-icon-button
|
|
270
|
+
name=${this.expanded ? "cross" : "menu"}
|
|
271
|
+
variant="ghost"
|
|
272
|
+
size="sm"
|
|
273
|
+
tone=${this.tone !== "default" ? "fixed-light" : nothing}
|
|
274
|
+
class="navbar-toggler"
|
|
275
|
+
@click=${this._handleSummaryClick}
|
|
276
|
+
aria-controls="${this.collapseId}"
|
|
277
|
+
aria-expanded="${this.expanded}"
|
|
278
|
+
.ariaLabel=${"Toggle navigation"}
|
|
279
|
+
></sgds-icon-button>`
|
|
280
|
+
: nothing}
|
|
281
|
+
</div>
|
|
250
282
|
</div>
|
|
251
283
|
</nav>
|
|
252
284
|
`;
|
|
@@ -294,14 +326,20 @@ __decorate([
|
|
|
294
326
|
query(".navbar-nav-scroll")
|
|
295
327
|
], SgdsMainnav.prototype, "navScroll", void 0);
|
|
296
328
|
__decorate([
|
|
297
|
-
query("
|
|
298
|
-
], SgdsMainnav.prototype, "
|
|
329
|
+
query(".navbar-end")
|
|
330
|
+
], SgdsMainnav.prototype, "navbarEnd", void 0);
|
|
331
|
+
__decorate([
|
|
332
|
+
state()
|
|
333
|
+
], SgdsMainnav.prototype, "_hasProfileComponent", void 0);
|
|
299
334
|
__decorate([
|
|
300
335
|
property({ type: Boolean })
|
|
301
336
|
], SgdsMainnav.prototype, "hasNonCollapsibleSlot", void 0);
|
|
302
337
|
__decorate([
|
|
303
338
|
property({ type: String })
|
|
304
339
|
], SgdsMainnav.prototype, "brandHref", void 0);
|
|
340
|
+
__decorate([
|
|
341
|
+
property({ type: String, reflect: true })
|
|
342
|
+
], SgdsMainnav.prototype, "tone", void 0);
|
|
305
343
|
__decorate([
|
|
306
344
|
property({ type: String })
|
|
307
345
|
], SgdsMainnav.prototype, "expand", void 0);
|