@khanacademy/wonder-blocks-tabs 1.0.14 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +141 -0
- package/dist/components/tab.d.ts +0 -1
- package/dist/es/index.css +430 -0
- package/dist/es/index.css.map +1 -0
- package/dist/es/index.js +32 -15
- package/dist/index.css +430 -0
- package/dist/index.css.map +1 -0
- package/dist/index.js +31 -14
- package/package.json +24 -9
package/dist/es/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { useOnMountEffect, addStyle, View, keys } from '@khanacademy/wonder-blocks-core';
|
|
3
|
-
import { border, semanticColor, sizing, breakpoint } from '@khanacademy/wonder-blocks-tokens';
|
|
4
|
-
import { StyleSheet } from 'aphrodite';
|
|
5
3
|
import * as React from 'react';
|
|
6
4
|
import { createElement } from 'react';
|
|
7
|
-
import {
|
|
5
|
+
import { border, semanticColor } from '@khanacademy/wonder-blocks-tokens';
|
|
6
|
+
import { typographyClassNames } from '@khanacademy/wonder-blocks-typography';
|
|
8
7
|
import { ActionMenu, ActionItem } from '@khanacademy/wonder-blocks-dropdown';
|
|
9
8
|
import Button from '@khanacademy/wonder-blocks-button';
|
|
10
9
|
import caretDown from '@phosphor-icons/core/bold/caret-down-bold.svg';
|
|
@@ -13,32 +12,50 @@ import { PhosphorIcon } from '@khanacademy/wonder-blocks-icon';
|
|
|
13
12
|
import { useWonderBlocksI18n } from '@khanacademy/wonder-blocks-config';
|
|
14
13
|
import Link from '@khanacademy/wonder-blocks-link';
|
|
15
14
|
|
|
16
|
-
const useTabIndicator=props=>{const{animated,tabsContainerRef,isTabActive}=props;const indicatorIsReady=React.useRef(false);const[underlineStyle,setUnderlineStyle]=React.useState({left:0,width:0});const updateUnderlineStyle=React.useCallback(()=>{if(!tabsContainerRef.current){return}const activeTab=Array.from(tabsContainerRef.current.children).find(isTabActive);if(activeTab){const tabRect=activeTab.getBoundingClientRect();const parentRect=tabsContainerRef.current.getBoundingClientRect();const zoomFactor=parentRect.width/tabsContainerRef.current.offsetWidth;const left=(tabRect.left-parentRect.left)/zoomFactor;const width=tabRect.width/zoomFactor;setUnderlineStyle({left,width});}},[setUnderlineStyle,tabsContainerRef,isTabActive]);useOnMountEffect(()=>{if(!tabsContainerRef.current||!window?.ResizeObserver||!window?.MutationObserver){return}const resizeObserver=new window.ResizeObserver(([entry])=>{if(entry){updateUnderlineStyle();if(!indicatorIsReady.current){indicatorIsReady.current=true;}}});resizeObserver.observe(tabsContainerRef.current);const mutationObserver=new window.MutationObserver(([entry])=>{if(entry){updateUnderlineStyle();}});mutationObserver.observe(tabsContainerRef.current,{attributes:true,childList:true,subtree:true});return ()=>{resizeObserver.disconnect();mutationObserver.disconnect();}});const positioningStyle={transform:`translateX(${underlineStyle.left}px)`,width:`${underlineStyle.width}px`};const indicatorProps={style:{...styles
|
|
15
|
+
const useTabIndicator=props=>{const{animated,tabsContainerRef,isTabActive}=props;const indicatorIsReady=React.useRef(false);const[underlineStyle,setUnderlineStyle]=React.useState({left:0,width:0});const updateUnderlineStyle=React.useCallback(()=>{if(!tabsContainerRef.current){return}const activeTab=Array.from(tabsContainerRef.current.children).find(isTabActive);if(activeTab){const tabRect=activeTab.getBoundingClientRect();const parentRect=tabsContainerRef.current.getBoundingClientRect();const zoomFactor=parentRect.width/tabsContainerRef.current.offsetWidth;const left=(tabRect.left-parentRect.left)/zoomFactor;const width=tabRect.width/zoomFactor;setUnderlineStyle({left,width});}},[setUnderlineStyle,tabsContainerRef,isTabActive]);useOnMountEffect(()=>{if(!tabsContainerRef.current||!window?.ResizeObserver||!window?.MutationObserver){return}const resizeObserver=new window.ResizeObserver(([entry])=>{if(entry){updateUnderlineStyle();if(!indicatorIsReady.current){indicatorIsReady.current=true;}}});resizeObserver.observe(tabsContainerRef.current);const mutationObserver=new window.MutationObserver(([entry])=>{if(entry){updateUnderlineStyle();}});mutationObserver.observe(tabsContainerRef.current,{attributes:true,childList:true,subtree:true});return ()=>{resizeObserver.disconnect();mutationObserver.disconnect();}});const positioningStyle={transform:`translateX(${underlineStyle.left}px)`,width:`${underlineStyle.width}px`};const indicatorProps={style:{...styles.currentUnderline,...positioningStyle,...animated?styles.underlineTransition:{},...!indicatorIsReady.current?{display:"none"}:{}},role:"presentation"};return {indicatorProps}};const styles={currentUnderline:{position:"absolute",bottom:0,left:0,height:border.width.thick,backgroundColor:semanticColor.core.background.instructive.default},underlineTransition:{transition:"transform 0.3s ease, width 0.3s ease"}};
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
var modules_49e3ea55={"nav":"wb-navigation-tabs-nav-01a8895f","contents":"wb-navigation-tabs-contents-01a8895f","list":"wb-navigation-tabs-list-01a8895f","divider":"wb-navigation-tabs-divider-01a8895f"};
|
|
19
18
|
|
|
20
|
-
const
|
|
19
|
+
const StyledUl=addStyle("ul");const StyledDiv$3=addStyle("div");const NavigationTabs=React.forwardRef(function NavigationTabs(props,ref){const{id,testId,children,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledBy,styles:stylesProp,animated=false,tag="nav",showDivider=false,...otherProps}=props;const StyledTag=React.useMemo(()=>addStyle(tag),[tag]);const listRef=React.useRef(null);const isTabActive=React.useCallback(navTabItemElement=>{return navTabItemElement.children[0]?.ariaCurrent==="page"},[]);const{indicatorProps}=useTabIndicator({animated,tabsContainerRef:listRef,isTabActive});return jsx(StyledTag,{id:id,"data-testid":testId,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledBy,ref:ref,style:[modules_49e3ea55.nav,showDivider&&modules_49e3ea55.divider,stylesProp?.root],...otherProps,children:jsxs(StyledDiv$3,{style:modules_49e3ea55.contents,children:[jsx(StyledUl,{style:[modules_49e3ea55.list,stylesProp?.list],ref:listRef,children:children}),jsx("div",{...indicatorProps})]})})});
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
var modules_3939f646={"root":"wb-navigation-tab-item-root-5e5c3f40","current":"wb-navigation-tab-item-current-5e5c3f40","link":"wb-navigation-tab-item-link-5e5c3f40","currentLink":"wb-navigation-tab-item-currentLink-5e5c3f40"};
|
|
22
|
+
|
|
23
|
+
const StyledLi=addStyle("li");const NavigationTabItem=React.forwardRef(function NavigationTabItem(props,ref){const{children,id,testId,current,style,...otherProps}=props;function renderChildren(){const linkProps={style:[modules_3939f646.link,current&&modules_3939f646.currentLink],"aria-current":current?"page":undefined};if(typeof children==="function"){return children(linkProps)}return React.cloneElement(children,linkProps)}return jsx(StyledLi,{id:id,"data-testid":testId,style:[modules_3939f646.root,current&&modules_3939f646.current,style],ref:ref,...otherProps,children:renderChildren()})});
|
|
23
24
|
|
|
24
25
|
const FOCUSABLE_ELEMENTS='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';function findFocusableNodes(root){return Array.from(root.querySelectorAll(FOCUSABLE_ELEMENTS))}
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
var modules_163d44a6={"tabPanel":"wb-tab-panel-tabPanel-fc2d02ef"};
|
|
28
|
+
|
|
29
|
+
const StyledDiv$2=addStyle("div");const TabPanel=props=>{const{children,id,"aria-labelledby":ariaLabelledby,active=false,testId,style}=props;const ref=React.useRef(null);const[hasFocusableElement,setHasFocusableElement]=React.useState(null);const updateHasFocusableElement=React.useCallback(element=>{setHasFocusableElement(findFocusableNodes(element).length>0);},[setHasFocusableElement]);React.useEffect(()=>{if(ref.current&&children){updateHasFocusableElement(ref.current);if(active){const mutationObserver=new MutationObserver(()=>{if(ref.current){updateHasFocusableElement(ref.current);}});mutationObserver.observe(ref.current,{childList:true,subtree:true});return ()=>{mutationObserver.disconnect();}}}},[active,ref,children,updateHasFocusableElement]);return jsx(StyledDiv$2,{ref:ref,role:"tabpanel",id:id,"aria-labelledby":ariaLabelledby,tabIndex:hasFocusableElement===false?0:undefined,hidden:!active,"data-testid":testId,style:active&&[modules_163d44a6.tabPanel,style],children:children})};
|
|
30
|
+
|
|
31
|
+
var modules_71633411={"root":"wb-tab-root-d9dd5f00","tab":"wb-tab-tab-d9dd5f00","selectedTab":"wb-tab-selectedTab-d9dd5f00"};
|
|
32
|
+
|
|
33
|
+
const StyledButton=addStyle("button");const Tab=React.forwardRef(function Tab(props,ref){const{children,onClick,id,"aria-controls":ariaControls,selected,onKeyDown,testId,style,icon,...otherProps}=props;return jsxs(StyledButton,{...otherProps,type:"button",role:"tab",onClick:onClick,ref:ref,id:id,"aria-controls":ariaControls,"aria-selected":selected,tabIndex:selected?0:-1,onKeyDown:onKeyDown,"data-testid":testId,style:[typographyClassNames.BodyTextMediumMediumWeight,modules_71633411.root,modules_71633411.tab,selected&&modules_71633411.selectedTab,style],children:[icon&&jsx(View,{children:React.cloneElement(icon,{size:icon.props.size??"medium"})}),children]})});
|
|
34
|
+
|
|
35
|
+
var modules_a5571cbf={"tablist":"wb-tablist-tablist-c7032ebd"};
|
|
27
36
|
|
|
28
|
-
const
|
|
37
|
+
const StyledDiv$1=addStyle("div");const Tablist=React.forwardRef(function Tablist(props,ref){const{id,children,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledby,onBlur,testId,style}=props;return jsx(StyledDiv$1,{id:id,role:"tablist",style:[modules_a5571cbf.tablist,style],ref:ref,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledby,onBlur:onBlur,"data-testid":testId,children:children})});
|
|
29
38
|
|
|
30
|
-
|
|
39
|
+
var modules_40c67f5b={"tabs":"wb-tabs-tabs-25865423","tablistWrapper":"wb-tabs-tablistWrapper-25865423"};
|
|
31
40
|
|
|
32
|
-
function getTabId(tabId){return `${tabId}-tab`}function getTabPanelId(tabId){return `${tabId}-panel`}const StyledDiv=addStyle("div");const Tabs=React.forwardRef(function Tabs(props,ref){const{tabs,selectedTabId,onTabSelected,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledby,activationMode="manual",id,testId,animated=false,styles:stylesProp,mountAllPanels=false,scrollableElementRef}=props;const focusedTabId=React.useRef(selectedTabId);const tabRefs=React.useRef({});const generatedUniqueId=React.useId();const uniqueId=id??generatedUniqueId;const tablistId=`${uniqueId}-tablist`;const visitedTabsRef=React.useRef(new Set);visitedTabsRef.current.add(selectedTabId);const tablistRef=React.useRef(null);const isTabActive=React.useCallback(tabElement=>{return tabElement.ariaSelected==="true"},[]);const{indicatorProps}=useTabIndicator({animated,tabsContainerRef:tablistRef,isTabActive});React.useEffect(()=>{focusedTabId.current=selectedTabId;},[selectedTabId]);const selectTab=React.useCallback(tabId=>{if(tabId!==selectedTabId){onTabSelected(tabId);}},[onTabSelected,selectedTabId]);const handleKeyInteraction=React.useCallback(tabId=>{const tabElement=tabRefs.current[tabId];tabElement?.focus();switch(activationMode){case"manual":{focusedTabId.current=tabId;break}case"automatic":{selectTab(tabId);break}}},[activationMode,selectTab,focusedTabId]);const handleKeyDown=React.useCallback(event=>{const currentIndex=tabs.findIndex(tab=>tab.id===focusedTabId.current);const element=event.currentTarget;const isRtl=!!element.closest("[dir=rtl]");switch(event.key){case isRtl&&keys.right:case!isRtl&&keys.left:{event.preventDefault();const prevIndex=(currentIndex-1+tabs.length)%tabs.length;handleKeyInteraction(tabs[prevIndex].id);break}case isRtl&&keys.left:case!isRtl&&keys.right:{event.preventDefault();const nextIndex=(currentIndex+1)%tabs.length;handleKeyInteraction(tabs[nextIndex].id);break}case keys.home:{event.preventDefault();handleKeyInteraction(tabs[0].id);break}case keys.end:{event.preventDefault();handleKeyInteraction(tabs[tabs.length-1].id);break}case keys.enter:case keys.space:{selectTab(focusedTabId.current);break}}},[handleKeyInteraction,selectTab,tabs,focusedTabId]);const handleTablistBlur=React.useCallback(()=>{focusedTabId.current=selectedTabId;},[selectedTabId]);if(tabs.length===0){return jsx(React.Fragment,{})}return jsxs(StyledDiv,{ref:ref,id:uniqueId,"data-testid":testId,style:[
|
|
41
|
+
function getTabId(tabId){return `${tabId}-tab`}function getTabPanelId(tabId){return `${tabId}-panel`}const StyledDiv=addStyle("div");const Tabs=React.forwardRef(function Tabs(props,ref){const{tabs,selectedTabId,onTabSelected,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledby,activationMode="manual",id,testId,animated=false,styles:stylesProp,mountAllPanels=false,scrollableElementRef}=props;const focusedTabId=React.useRef(selectedTabId);const tabRefs=React.useRef({});const generatedUniqueId=React.useId();const uniqueId=id??generatedUniqueId;const tablistId=`${uniqueId}-tablist`;const visitedTabsRef=React.useRef(new Set);visitedTabsRef.current.add(selectedTabId);const tablistRef=React.useRef(null);const isTabActive=React.useCallback(tabElement=>{return tabElement.ariaSelected==="true"},[]);const{indicatorProps}=useTabIndicator({animated,tabsContainerRef:tablistRef,isTabActive});React.useEffect(()=>{focusedTabId.current=selectedTabId;},[selectedTabId]);const selectTab=React.useCallback(tabId=>{if(tabId!==selectedTabId){onTabSelected(tabId);}},[onTabSelected,selectedTabId]);const handleKeyInteraction=React.useCallback(tabId=>{const tabElement=tabRefs.current[tabId];tabElement?.focus();switch(activationMode){case"manual":{focusedTabId.current=tabId;break}case"automatic":{selectTab(tabId);break}}},[activationMode,selectTab,focusedTabId]);const handleKeyDown=React.useCallback(event=>{const currentIndex=tabs.findIndex(tab=>tab.id===focusedTabId.current);const element=event.currentTarget;const isRtl=!!element.closest("[dir=rtl]");switch(event.key){case isRtl&&keys.right:case!isRtl&&keys.left:{event.preventDefault();const prevIndex=(currentIndex-1+tabs.length)%tabs.length;handleKeyInteraction(tabs[prevIndex].id);break}case isRtl&&keys.left:case!isRtl&&keys.right:{event.preventDefault();const nextIndex=(currentIndex+1)%tabs.length;handleKeyInteraction(tabs[nextIndex].id);break}case keys.home:{event.preventDefault();handleKeyInteraction(tabs[0].id);break}case keys.end:{event.preventDefault();handleKeyInteraction(tabs[tabs.length-1].id);break}case keys.enter:case keys.space:{selectTab(focusedTabId.current);break}}},[handleKeyInteraction,selectTab,tabs,focusedTabId]);const handleTablistBlur=React.useCallback(()=>{focusedTabId.current=selectedTabId;},[selectedTabId]);if(tabs.length===0){return jsx(React.Fragment,{})}return jsxs(StyledDiv,{ref:ref,id:uniqueId,"data-testid":testId,style:[modules_40c67f5b.tabs,stylesProp?.root],children:[jsxs(StyledDiv,{ref:scrollableElementRef,style:modules_40c67f5b.tablistWrapper,children:[jsx(Tablist,{"aria-label":ariaLabel,"aria-labelledby":ariaLabelledby,onBlur:handleTablistBlur,id:tablistId,testId:testId&&`${testId}-tablist`,ref:tablistRef,style:stylesProp?.tablist,children:tabs.map(tab=>{const{id,label,panel:_,testId:tabTestId,icon,...otherProps}=tab;const tabProps={...otherProps,key:id,id:getTabId(id),testId:tabTestId&&getTabId(tabTestId),selected:id===selectedTabId,icon,"aria-controls":getTabPanelId(id),onClick:()=>{onTabSelected(id);},onKeyDown:handleKeyDown,ref:element=>{tabRefs.current[tab.id]=element;},style:stylesProp?.tab};if(typeof label==="function"){return label(tabProps)}return jsx(Tab,{...tabProps,children:label})})}),jsx("div",{...indicatorProps})]}),tabs.map(tab=>{return jsx(TabPanel,{id:getTabPanelId(tab.id),"aria-labelledby":getTabId(tab.id),active:selectedTabId===tab.id,testId:tab.testId&&getTabPanelId(tab.testId),style:stylesProp?.tabPanel,children:(mountAllPanels||visitedTabsRef.current.has(tab.id))&&tab.panel},tab.id)})]})});
|
|
33
42
|
|
|
34
|
-
|
|
43
|
+
var modules_7827e2e1={"root":"wb-tabs-dropdown-root-d707dbaa","actionMenu":"wb-tabs-dropdown-actionMenu-d707dbaa","opener":"wb-tabs-dropdown-opener-d707dbaa","label":"wb-tabs-dropdown-label-d707dbaa"};
|
|
44
|
+
|
|
45
|
+
const TabsDropdown=React.forwardRef((props,ref)=>{const{tabs,selectedTabId,onTabSelected,labels:labelsProp,opened,id:idProp,testId,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledby,styles:stylesProp}=props;const{strings}=useWonderBlocksI18n();const labels=React.useMemo(()=>{return {defaultOpenerLabel:labelsProp?.defaultOpenerLabel||strings.tabs}},[labelsProp,strings.tabs]);const generatedUniqueId=React.useId();const uniqueId=idProp??generatedUniqueId;const openerId=`${uniqueId}-opener`;const panelId=`${uniqueId}-panel`;const selectedTabItem=React.useMemo(()=>{return tabs.find(tab=>tab.id===selectedTabId)},[tabs,selectedTabId]);const processedTabs=React.useMemo(()=>{return tabs.map(tab=>({...tab,leftAccessory:tab.icon?React.cloneElement(tab.icon,{size:tab.icon.props.size??"medium"}):undefined,handleClick:()=>{onTabSelected(tab.id);}}))},[tabs,onTabSelected]);if(tabs.length===0){return jsx(React.Fragment,{})}const menuText=selectedTabItem?.label||labels.defaultOpenerLabel;return jsxs(View,{ref:ref,id:uniqueId,testId:testId,style:[modules_7827e2e1.root,stylesProp?.root],role:"region","aria-label":ariaLabel,"aria-labelledby":ariaLabelledby,children:[jsx(ActionMenu,{opened:opened,id:openerId,menuText:menuText,opener:()=>jsx(Button,{testId:testId?`${testId}-opener`:undefined,kind:"tertiary",endIcon:caretDown,style:[modules_7827e2e1.opener,stylesProp?.opener],labelStyle:modules_7827e2e1.label,"aria-label":selectedTabItem?.["aria-label"],startIcon:selectedTabItem?.icon,children:menuText}),style:[modules_7827e2e1.actionMenu,stylesProp?.actionMenu],children:processedTabs.map(tab=>{return jsx(ActionItem,{label:tab.label,"aria-label":tab["aria-label"],onClick:tab.handleClick,active:tab.id===selectedTabId,testId:tab.testId,rightAccessory:tab.id===selectedTabId?jsx(PhosphorIcon,{icon:checkCircleIcon,size:"medium","aria-hidden":"true"}):undefined,leftAccessory:tab.leftAccessory},tab.id)})}),jsx(View,{id:panelId,role:"group","aria-labelledby":openerId,testId:testId?`${testId}-panel`:undefined,style:stylesProp?.tabPanel,children:selectedTabItem?.panel})]})});
|
|
35
46
|
|
|
36
47
|
function useResponsiveLayout(options){const{tabs,elementWithOverflowRef,containerRef,onLayoutChange}=options;const[showDropdown,setShowDropdown]=React.useState(false);const tabsWidthRef=React.useRef(null);const containerWidthRef=React.useRef(null);const tabsSignature=React.useMemo(()=>tabs.map(t=>`${t.id}:${t.label}-${t.icon?"with-icon":"without-icon"}`).join("|"),[tabs]);const checkOverflow=React.useCallback(()=>{const container=containerRef.current;if(!container){return}if(!showDropdown&&elementWithOverflowRef.current){const scrollableWrapper=elementWithOverflowRef.current;if(scrollableWrapper){const hasOverflow=scrollableWrapper.scrollWidth>scrollableWrapper.clientWidth;if(hasOverflow){tabsWidthRef.current=scrollableWrapper.scrollWidth+(container.clientWidth-scrollableWrapper.clientWidth);setShowDropdown(true);}}}else if(showDropdown&&tabsWidthRef.current){const containerWidth=container.clientWidth;if(containerWidth>=tabsWidthRef.current){setShowDropdown(false);}}},[showDropdown,elementWithOverflowRef,containerRef]);React.useEffect(()=>{if(showDropdown){tabsWidthRef.current=null;setShowDropdown(false);}},[tabsSignature]);React.useEffect(()=>{const container=containerRef.current;if(!container||!window.ResizeObserver){return}const resizeObserver=new ResizeObserver(()=>{if(containerWidthRef.current!==container.clientWidth){containerWidthRef.current=container.clientWidth;checkOverflow();}});resizeObserver.observe(container);return ()=>{resizeObserver.disconnect();}},[checkOverflow,containerRef]);React.useEffect(()=>{const element=elementWithOverflowRef.current;if(!element){return}checkOverflow();const mutationObserver=new MutationObserver(()=>{checkOverflow();});mutationObserver.observe(element,{childList:true,subtree:true,characterData:true});return ()=>{mutationObserver.disconnect();}},[checkOverflow,elementWithOverflowRef]);React.useEffect(()=>{onLayoutChange?.(showDropdown?"dropdown":"tabs");},[showDropdown,onLayoutChange]);return {showDropdown}}
|
|
37
48
|
|
|
38
|
-
|
|
49
|
+
var modules_30a19a4e={"root":"wb-responsive-root-1929a67f","container":"wb-responsive-container-1929a67f","fadeIn":"wb-responsive-fadeIn-1929a67f","fade-in":"wb-responsive-fade-in-1929a67f"};
|
|
50
|
+
|
|
51
|
+
const ResponsiveTabs=props=>{const{tabs,selectedTabId,onTabSelected,onLayoutChange,id,testId,tabsProps,dropdownProps,styles:stylesProp,...ariaProps}=props;const tabsRef=React.useRef(null);const scrollableTabsRef=React.useRef(null);const containerRef=React.useRef(null);const{showDropdown}=useResponsiveLayout({tabs,elementWithOverflowRef:scrollableTabsRef,containerRef,onLayoutChange});return jsx(View,{ref:containerRef,style:[modules_30a19a4e.root,modules_30a19a4e.container,stylesProp?.root],id:id,testId:testId,children:showDropdown?createElement(TabsDropdown,{...dropdownProps,...ariaProps,key:"dropdown",tabs:tabs,selectedTabId:selectedTabId,onTabSelected:onTabSelected,styles:{...dropdownProps?.styles,root:[modules_30a19a4e.fadeIn,dropdownProps?.styles?.root]}}):createElement(Tabs,{...tabsProps,...ariaProps,key:"tabs",ref:tabsRef,scrollableElementRef:scrollableTabsRef,tabs:tabs,selectedTabId:selectedTabId,onTabSelected:onTabSelected,styles:{...tabsProps?.styles,root:[modules_30a19a4e.fadeIn,tabsProps?.styles?.root]}})})};
|
|
39
52
|
|
|
40
|
-
|
|
53
|
+
var modules_7375cf52={"divider":"wb-navigation-tabs-dropdown-divider-72fea2cc","root":"wb-navigation-tabs-dropdown-root-72fea2cc","actionMenu":"wb-navigation-tabs-dropdown-actionMenu-72fea2cc","opener":"wb-navigation-tabs-dropdown-opener-72fea2cc","label":"wb-navigation-tabs-dropdown-label-72fea2cc"};
|
|
41
54
|
|
|
42
|
-
const
|
|
55
|
+
const NavigationTabsDropdown=React.forwardRef((props,ref)=>{const{tabs,selectedTabId,onTabSelected,id:idProp,testId,labels:labelsProp,opened,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledby,tag="nav",styles:stylesProp,showDivider=false}=props;const StyledTag=React.useMemo(()=>addStyle(tag),[tag]);const{strings}=useWonderBlocksI18n();const labels=React.useMemo(()=>{return {defaultOpenerLabel:labelsProp?.defaultOpenerLabel||strings.tabs}},[labelsProp,strings.tabs]);const selectedTabItem=React.useMemo(()=>{return tabs.find(tab=>tab.id===selectedTabId)},[tabs,selectedTabId]);const processedTabs=React.useMemo(()=>{return tabs.map(tab=>({...tab,leftAccessory:tab.icon?React.cloneElement(tab.icon,{size:tab.icon.props.size??"medium"}):undefined,handleClick:onTabSelected?()=>onTabSelected(tab.id):undefined}))},[tabs,onTabSelected]);const generatedUniqueId=React.useId();const uniqueId=idProp??generatedUniqueId;const openerId=`${uniqueId}-opener`;if(tabs.length===0){return jsx(React.Fragment,{})}const menuText=selectedTabItem?.label||labels.defaultOpenerLabel;return jsx(StyledTag,{ref:ref,id:uniqueId,"data-testid":testId,style:[modules_7375cf52.root,showDivider&&modules_7375cf52.divider,stylesProp?.root],"aria-label":ariaLabel,"aria-labelledby":ariaLabelledby,children:jsx(ActionMenu,{opened:opened,id:openerId,menuText:menuText,opener:()=>jsx(Button,{testId:testId?`${testId}-opener`:undefined,kind:"tertiary",endIcon:caretDown,style:[modules_7375cf52.opener,stylesProp?.opener],labelStyle:modules_7375cf52.label,"aria-label":selectedTabItem?.["aria-label"],startIcon:selectedTabItem?.icon,children:menuText}),style:[modules_7375cf52.actionMenu,stylesProp?.actionMenu],children:processedTabs.map(tab=>{return jsx(ActionItem,{label:tab.label,href:tab.href,"aria-label":tab["aria-label"],active:tab.id===selectedTabId,testId:tab.testId,leftAccessory:tab.leftAccessory,onClick:tab.handleClick,rightAccessory:tab.id===selectedTabId?jsx(PhosphorIcon,{icon:checkCircleIcon,size:"medium","aria-hidden":"true"}):undefined},tab.id)})})})});
|
|
56
|
+
|
|
57
|
+
const ResponsiveNavigationTabs=props=>{const{tabs,selectedTabId,onTabSelected,onLayoutChange,id,testId,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledby,tag,tabsProps,dropdownProps,styles:stylesProp,showDivider=false}=props;const navigationTabsRef=React.useRef(null);const containerRef=React.useRef(null);const{showDropdown}=useResponsiveLayout({tabs,elementWithOverflowRef:navigationTabsRef,containerRef,onLayoutChange});const processedTabs=React.useMemo(()=>{return tabs.map(tab=>({...tab,startIcon:tab.icon?React.cloneElement(tab.icon,{size:tab.icon.props.size??"medium"}):undefined,handleClick:onTabSelected?()=>onTabSelected(tab.id):undefined}))},[tabs,onTabSelected]);return jsx(View,{ref:containerRef,style:[modules_30a19a4e.root,modules_30a19a4e.container,stylesProp?.root],id:id,testId:testId,children:showDropdown?createElement(NavigationTabsDropdown,{...dropdownProps,key:"dropdown",tabs:tabs,selectedTabId:selectedTabId,onTabSelected:onTabSelected,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledby,tag:tag,styles:{...dropdownProps?.styles,root:[modules_30a19a4e.fadeIn,dropdownProps?.styles?.root]},showDivider:showDivider}):createElement(NavigationTabs,{...tabsProps,key:"tabs",ref:navigationTabsRef,"aria-label":ariaLabel,"aria-labelledby":ariaLabelledby,tag:tag,styles:{...tabsProps?.styles,root:[modules_30a19a4e.fadeIn,tabsProps?.styles?.root]},showDivider:showDivider},processedTabs.map(tab=>jsx(NavigationTabItem,{current:tab.id===selectedTabId,children:jsx(Link,{href:tab.href,onClick:tab.handleClick,startIcon:tab.startIcon,"aria-label":tab["aria-label"],testId:tab.testId,children:tab.label})},tab.id)))})};
|
|
43
58
|
|
|
44
59
|
export { NavigationTabItem, NavigationTabs, ResponsiveNavigationTabs, ResponsiveTabs, Tab, Tabs };
|
|
60
|
+
|
|
61
|
+
import "./index.css";
|
package/dist/index.css
ADDED
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
@layer shared {/**
|
|
2
|
+
* NavigationTabs styles
|
|
3
|
+
*
|
|
4
|
+
* Every element is rendered by `addStyle`, which ships no class of its own, so
|
|
5
|
+
* these single-class rules don't compete with anything else in
|
|
6
|
+
* `@layer shared`. The consumer's `styles.*` still go through Aphrodite
|
|
7
|
+
* (unlayered and `!important`), so they win over this module as they did
|
|
8
|
+
* before. The build wraps every rule in `@layer shared { … }`.
|
|
9
|
+
*/.wb-navigation-tabs-nav-01a8895f {
|
|
10
|
+
overflow-x: auto;
|
|
11
|
+
}.wb-navigation-tabs-contents-01a8895f {
|
|
12
|
+
position: relative;
|
|
13
|
+
}.wb-navigation-tabs-list-01a8895f {
|
|
14
|
+
/* Add horizontal padding for focus outline of first/last elements */
|
|
15
|
+
padding-inline: var(--wb-sizing-size_040);
|
|
16
|
+
padding-block: var(--wb-sizing-size_0);
|
|
17
|
+
margin: var(--wb-sizing-size_0);
|
|
18
|
+
display: flex;
|
|
19
|
+
gap: var(--wb-sizing-size_160);
|
|
20
|
+
flex-wrap: nowrap;
|
|
21
|
+
}.wb-navigation-tabs-divider-01a8895f {
|
|
22
|
+
border-block-end: var(--wb-border-width-thin) solid
|
|
23
|
+
var(--wb-semanticColor-core-border-neutral-subtle);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@layer shared {/**
|
|
28
|
+
* NavigationTabItem styles
|
|
29
|
+
*
|
|
30
|
+
* `.root` is the list item (rendered by `addStyle`, no class of its own). The
|
|
31
|
+
* link rules style the item's child — usually a Wonder Blocks `Link` — whose
|
|
32
|
+
* own rules sit in the same `@layer shared`. Which package's stylesheet comes
|
|
33
|
+
* first depends on the consumer's bundler and import order, so the link rules
|
|
34
|
+
* are nested inside `.root` to outrank `Link`'s on specificity alone:
|
|
35
|
+
* `Link`'s base classes are (0,1,0) and its states (0,2,0); the rules below
|
|
36
|
+
* are (0,2,0) for the base and (0,3,0)+ for states.
|
|
37
|
+
*
|
|
38
|
+
* The link rule also declares the BodyText medium typography itself rather
|
|
39
|
+
* than applying the typography classes: those are (0,1,0), the same as
|
|
40
|
+
* `Link`'s `font-family` / `font-weight` (bold in thunderblocks), so the winner
|
|
41
|
+
* would depend on load order; and the Aphrodite typography object would beat
|
|
42
|
+
* this rule's `display: flex`.
|
|
43
|
+
*
|
|
44
|
+
* The consumer's `style` still goes through Aphrodite (unlayered and
|
|
45
|
+
* `!important`), so it wins over this module as it did before. Nesting is
|
|
46
|
+
* native CSS: every `&` is explicit and resolves to the flat selector it
|
|
47
|
+
* replaces. The build wraps every rule in `@layer shared { … }`.
|
|
48
|
+
*/.wb-navigation-tab-item-root-5e5c3f40 {
|
|
49
|
+
list-style: none;
|
|
50
|
+
display: inline-flex;
|
|
51
|
+
padding-block: var(--wb-sizing-size_080) var(--wb-sizing-size_180);
|
|
52
|
+
|
|
53
|
+
&:has(a:hover) {
|
|
54
|
+
/* Using background token to match underline styling in Figma */
|
|
55
|
+
box-shadow: inset 0 calc(var(--wb-sizing-size_020) * -1) 0 0
|
|
56
|
+
var(--wb-semanticColor-core-background-instructive-default);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&:has(a:active) {
|
|
60
|
+
/* Using background token to match underline styling in Figma */
|
|
61
|
+
box-shadow: inset 0 calc(var(--wb-sizing-size_060) * -1) 0 0
|
|
62
|
+
var(--wb-semanticColor-core-background-instructive-default);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* breakpoint.mediaQuery.mdOrLarger (min-width: breakpoint.width.mdMin) */
|
|
66
|
+
@media screen and (min-width: 682px) {
|
|
67
|
+
padding-block: var(--wb-sizing-size_200) var(--wb-sizing-size_240);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* Note: The current tab item underline style is provided by
|
|
71
|
+
* NavigationTabs. */
|
|
72
|
+
&.wb-navigation-tab-item-current-5e5c3f40:has(a:hover) {
|
|
73
|
+
/* If it is current, remove hover underline since the tab is already
|
|
74
|
+
* selected. */
|
|
75
|
+
box-shadow: none;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&.wb-navigation-tab-item-current-5e5c3f40:has(a:active):not([aria-disabled="true"]) {
|
|
79
|
+
/* If it is current, make sure there is no box shadow */
|
|
80
|
+
box-shadow: none;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
& .wb-navigation-tab-item-link-5e5c3f40 {
|
|
84
|
+
/* BodyText medium / medium weight — see the note above. */
|
|
85
|
+
font-family: var(--wb-font-family-sans);
|
|
86
|
+
font-size: var(--wb-font-body-size-medium);
|
|
87
|
+
font-weight: var(--wb-font-weight-medium);
|
|
88
|
+
line-height: var(--wb-font-body-lineHeight-medium);
|
|
89
|
+
display: flex;
|
|
90
|
+
margin: 0;
|
|
91
|
+
color: var(--wb-semanticColor-core-foreground-neutral-subtle);
|
|
92
|
+
padding-inline: 0;
|
|
93
|
+
position: relative;
|
|
94
|
+
white-space: nowrap;
|
|
95
|
+
text-decoration: none;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* Declared before the hover / press rules (stylelint's
|
|
99
|
+
* no-descending-specificity); they only overlap on `border: none` and
|
|
100
|
+
* `outline: none`, so the order doesn't change the result. */
|
|
101
|
+
& .wb-navigation-tab-item-link-5e5c3f40:focus-visible {
|
|
102
|
+
border: none;
|
|
103
|
+
outline: none;
|
|
104
|
+
box-shadow:
|
|
105
|
+
0 0 0 var(--wb-sizing-size_020) var(--wb-semanticColor-focus-inner),
|
|
106
|
+
0 0 0 var(--wb-sizing-size_040) var(--wb-semanticColor-focus-outer);
|
|
107
|
+
border-radius: var(--wb-border-radius-radius_0);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* NOTE: We use :not[aria-disabled] to avoid the hover styles to be
|
|
111
|
+
* applied when the interactive element is disabled. */
|
|
112
|
+
& .wb-navigation-tab-item-link-5e5c3f40:hover:not([aria-disabled="true"]) {
|
|
113
|
+
text-decoration: none;
|
|
114
|
+
border: none;
|
|
115
|
+
outline: none;
|
|
116
|
+
color: var(--wb-semanticColor-core-foreground-instructive-default);
|
|
117
|
+
background-color: var(--wb-semanticColor-core-transparent);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
& .wb-navigation-tab-item-link-5e5c3f40:active:not([aria-disabled="true"]) {
|
|
121
|
+
text-decoration: none;
|
|
122
|
+
border: none;
|
|
123
|
+
outline: none;
|
|
124
|
+
color: var(--wb-semanticColor-core-foreground-instructive-default);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
& .wb-navigation-tab-item-currentLink-5e5c3f40 {
|
|
128
|
+
color: var(--wb-semanticColor-core-foreground-instructive-default);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
& .wb-navigation-tab-item-currentLink-5e5c3f40:active:not([aria-disabled="true"]) {
|
|
132
|
+
/* Make sure the current link doesn't change color when pressed */
|
|
133
|
+
color: var(--wb-semanticColor-core-foreground-instructive-default);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@layer shared {/**
|
|
139
|
+
* TabPanel styles
|
|
140
|
+
*
|
|
141
|
+
* The panel is rendered by `addStyle`, which ships no class of its own, so
|
|
142
|
+
* this single-class rule doesn't compete with anything else in
|
|
143
|
+
* `@layer shared`. The consumer's `style` still goes through Aphrodite
|
|
144
|
+
* (unlayered and `!important`), so it wins over this module as it did before.
|
|
145
|
+
* The build wraps every rule in `@layer shared { … }`.
|
|
146
|
+
*//*
|
|
147
|
+
* Cross-package focus-visible mixin.
|
|
148
|
+
*
|
|
149
|
+
* Authors include the mixin via:
|
|
150
|
+
*
|
|
151
|
+
* @import "@khanacademy/wonder-blocks-styles/focus-styles.css";
|
|
152
|
+
*
|
|
153
|
+
* .my-component:focus-visible {
|
|
154
|
+
* @apply --wb-focus-visible;
|
|
155
|
+
* }
|
|
156
|
+
*
|
|
157
|
+
* postcss-import resolves the @import through the workspace and
|
|
158
|
+
* @csstools/postcss-mixins expands the @apply at build time
|
|
159
|
+
* (CSS Mixins Level 1 syntax — note the leading `--` on the name).
|
|
160
|
+
*/.wb-tab-panel-tabPanel-fc2d02ef {
|
|
161
|
+
/* Apply flex so that panel supports rtl */
|
|
162
|
+
display: flex;
|
|
163
|
+
|
|
164
|
+
&:focus-visible {
|
|
165
|
+
box-shadow: 0 0 0 var(--wb-border-width-medium)
|
|
166
|
+
var(--wb-semanticColor-focus-inner);
|
|
167
|
+
outline: var(--wb-border-width-medium) solid
|
|
168
|
+
var(--wb-semanticColor-focus-outer);
|
|
169
|
+
outline-offset: var(--wb-border-width-medium);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
@layer shared {/**
|
|
175
|
+
* Tablist styles
|
|
176
|
+
*
|
|
177
|
+
* The tablist is rendered by `addStyle`, which ships no class of its own, so
|
|
178
|
+
* this single-class rule doesn't compete with anything else in
|
|
179
|
+
* `@layer shared`. The consumer's `style` still goes through Aphrodite
|
|
180
|
+
* (unlayered and `!important`), so it wins over this module as it did before.
|
|
181
|
+
* The build wraps every rule in `@layer shared { … }`.
|
|
182
|
+
*/.wb-tablist-tablist-c7032ebd {
|
|
183
|
+
display: flex;
|
|
184
|
+
gap: var(--wb-sizing-size_240);
|
|
185
|
+
border-block-end: var(--wb-border-width-thin) solid
|
|
186
|
+
var(--wb-semanticColor-core-border-neutral-subtle);
|
|
187
|
+
|
|
188
|
+
/* Add horizontal padding for focus outline of first/last elements */
|
|
189
|
+
padding-inline: var(--wb-sizing-size_040);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
@layer shared {/**
|
|
194
|
+
* Tabs styles
|
|
195
|
+
*
|
|
196
|
+
* Both elements are rendered by `addStyle`, which ships no class of its own,
|
|
197
|
+
* so these single-class rules don't compete with anything else in
|
|
198
|
+
* `@layer shared`. The consumer's `styles.root` still goes through Aphrodite
|
|
199
|
+
* (unlayered and `!important`), so it wins over this module as it did before.
|
|
200
|
+
* The build wraps every rule in `@layer shared { … }`.
|
|
201
|
+
*/.wb-tabs-tabs-25865423 {
|
|
202
|
+
display: inline-flex;
|
|
203
|
+
flex-direction: column;
|
|
204
|
+
align-items: stretch;
|
|
205
|
+
position: relative;
|
|
206
|
+
}.wb-tabs-tablistWrapper-25865423 {
|
|
207
|
+
position: relative;
|
|
208
|
+
overflow-x: auto;
|
|
209
|
+
flex-shrink: 0;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
@layer shared {/**
|
|
214
|
+
* Tab styles
|
|
215
|
+
*
|
|
216
|
+
* Every rule is nested inside `.root` — a marker class on the tab button
|
|
217
|
+
* itself, which carries no declarations of its own. The button also gets the
|
|
218
|
+
* typography classes (`typographyClassNames.BodyTextMediumMediumWeight`), which
|
|
219
|
+
* ship single-class rules in the same `@layer shared` — including `display`
|
|
220
|
+
* and `margin`, both of which this component overrides. At equal specificity
|
|
221
|
+
* stylesheet load order would decide the winner, so the compound selector
|
|
222
|
+
* makes it depend on specificity instead.
|
|
223
|
+
*
|
|
224
|
+
* The consumer's `style` still goes through Aphrodite (unlayered and
|
|
225
|
+
* `!important`), so it wins over this module as it did before. Nesting is
|
|
226
|
+
* native CSS: every `&` is explicit and resolves to the flat selector it
|
|
227
|
+
* replaces (`.root.tab`, `.root.tab::after`, …). The build wraps every rule in
|
|
228
|
+
* `@layer shared { … }`.
|
|
229
|
+
*//*
|
|
230
|
+
* Cross-package focus-visible mixin.
|
|
231
|
+
*
|
|
232
|
+
* Authors include the mixin via:
|
|
233
|
+
*
|
|
234
|
+
* @import "@khanacademy/wonder-blocks-styles/focus-styles.css";
|
|
235
|
+
*
|
|
236
|
+
* .my-component:focus-visible {
|
|
237
|
+
* @apply --wb-focus-visible;
|
|
238
|
+
* }
|
|
239
|
+
*
|
|
240
|
+
* postcss-import resolves the @import through the workspace and
|
|
241
|
+
* @csstools/postcss-mixins expands the @apply at build time
|
|
242
|
+
* (CSS Mixins Level 1 syntax — note the leading `--` on the name).
|
|
243
|
+
*/.wb-tab-root-d9dd5f00 {
|
|
244
|
+
&.wb-tab-tab-d9dd5f00 {
|
|
245
|
+
display: flex;
|
|
246
|
+
align-items: center;
|
|
247
|
+
text-wrap: nowrap;
|
|
248
|
+
background-color: var(--wb-semanticColor-core-transparent);
|
|
249
|
+
border: none;
|
|
250
|
+
margin: 0;
|
|
251
|
+
padding: 0;
|
|
252
|
+
cursor: pointer;
|
|
253
|
+
margin-block: var(--wb-sizing-size_080) var(--wb-sizing-size_140);
|
|
254
|
+
gap: var(--wb-sizing-size_080);
|
|
255
|
+
position: relative;
|
|
256
|
+
color: var(--wb-semanticColor-core-foreground-neutral-subtle);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
&.wb-tab-tab-d9dd5f00:focus-visible {
|
|
260
|
+
box-shadow: 0 0 0 var(--wb-border-width-medium)
|
|
261
|
+
var(--wb-semanticColor-focus-inner);
|
|
262
|
+
outline: var(--wb-border-width-medium) solid
|
|
263
|
+
var(--wb-semanticColor-focus-outer);
|
|
264
|
+
outline-offset: var(--wb-border-width-medium);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/* Using ::after styling to apply the hover/pressed underline styling
|
|
268
|
+
* instead of box-shadow because we use box-shadow for the focus
|
|
269
|
+
* outline. */
|
|
270
|
+
&.wb-tab-tab-d9dd5f00::after {
|
|
271
|
+
content: "";
|
|
272
|
+
position: absolute;
|
|
273
|
+
inset-inline: 0;
|
|
274
|
+
inset-block-end: calc(var(--wb-sizing-size_140) * -1);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/* Only apply hover styles to tabs that are not selected */
|
|
278
|
+
&.wb-tab-tab-d9dd5f00:hover:not([aria-selected="true"]) {
|
|
279
|
+
color: var(--wb-semanticColor-core-foreground-instructive-default);
|
|
280
|
+
|
|
281
|
+
&::after {
|
|
282
|
+
block-size: var(--wb-border-width-thin);
|
|
283
|
+
background-color: var(
|
|
284
|
+
--wb-semanticColor-core-background-instructive-default
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/* Only apply active styles to tabs that are not selected */
|
|
290
|
+
&.wb-tab-tab-d9dd5f00:active:not([aria-selected="true"]) {
|
|
291
|
+
color: var(--wb-semanticColor-core-foreground-instructive-default);
|
|
292
|
+
|
|
293
|
+
&::after {
|
|
294
|
+
block-size: var(--wb-border-width-thick);
|
|
295
|
+
background-color: var(
|
|
296
|
+
--wb-semanticColor-core-background-instructive-default
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
&.wb-tab-selectedTab-d9dd5f00 {
|
|
302
|
+
color: var(--wb-semanticColor-core-foreground-instructive-default);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
@layer shared {/**
|
|
308
|
+
* TabsDropdown styles
|
|
309
|
+
*
|
|
310
|
+
* Every rule is nested inside `.root` — a marker class on the component's root
|
|
311
|
+
* `View`, which carries no declarations of its own. The rules override
|
|
312
|
+
* classes from other packages: `.actionMenu` lands on DropdownCore's
|
|
313
|
+
* `.menuWrapper` `View` (`inline-size`, `align-items`), and `.opener` /
|
|
314
|
+
* `.label` land on `Button` and its `BodyText` label (`block-size`,
|
|
315
|
+
* `padding`). The published bundle loads this package's CSS before its
|
|
316
|
+
* dependencies', so at equal specificity those rules would win. The
|
|
317
|
+
* descendant selectors (0,2,0) make the result depend on specificity instead.
|
|
318
|
+
*
|
|
319
|
+
* The consumer's `styles.*` still go through Aphrodite (unlayered and
|
|
320
|
+
* `!important`) or inline styles, so they win over this module as they did
|
|
321
|
+
* before. The build wraps every rule in `@layer shared { … }`.
|
|
322
|
+
*/.wb-tabs-dropdown-root-d707dbaa {
|
|
323
|
+
.wb-tabs-dropdown-actionMenu-d707dbaa {
|
|
324
|
+
inline-size: 100%;
|
|
325
|
+
align-items: flex-start;
|
|
326
|
+
border-block-end: var(--wb-border-width-thin) solid
|
|
327
|
+
var(--wb-semanticColor-core-border-neutral-subtle);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.wb-tabs-dropdown-opener-d707dbaa {
|
|
331
|
+
position: relative;
|
|
332
|
+
block-size: unset;
|
|
333
|
+
padding-block: var(--wb-sizing-size_120) var(--wb-sizing-size_140);
|
|
334
|
+
padding-inline: var(--wb-sizing-size_180);
|
|
335
|
+
inline-size: 100%;
|
|
336
|
+
justify-content: space-between;
|
|
337
|
+
gap: var(--wb-sizing-size_020);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.wb-tabs-dropdown-label-d707dbaa {
|
|
341
|
+
flex-grow: 1;
|
|
342
|
+
max-inline-size: 100%;
|
|
343
|
+
text-align: start;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
@layer shared {/**
|
|
349
|
+
* NavigationTabsDropdown styles
|
|
350
|
+
*
|
|
351
|
+
* The root element is rendered by `addStyle`, which ships no class of its own,
|
|
352
|
+
* so `.divider` needs no extra specificity.
|
|
353
|
+
*
|
|
354
|
+
* Every other rule is nested inside `.root` — a marker class on that root
|
|
355
|
+
* element, which carries no declarations of its own. Those rules override
|
|
356
|
+
* classes from other packages: `.actionMenu` lands on DropdownCore's
|
|
357
|
+
* `.menuWrapper` `View` (`inline-size`, `align-items`), and `.opener` /
|
|
358
|
+
* `.label` land on `Button` and its `BodyText` label (`block-size`,
|
|
359
|
+
* `padding`). The published bundle loads this package's CSS before its
|
|
360
|
+
* dependencies', so at equal specificity those rules would win. The
|
|
361
|
+
* descendant selectors (0,2,0) make the result depend on specificity instead.
|
|
362
|
+
*
|
|
363
|
+
* The consumer's `styles.*` still go through Aphrodite (unlayered and
|
|
364
|
+
* `!important`) or inline styles, so they win over this module as they did
|
|
365
|
+
* before. The build wraps every rule in `@layer shared { … }`.
|
|
366
|
+
*/.wb-navigation-tabs-dropdown-divider-72fea2cc {
|
|
367
|
+
border-block-end: var(--wb-border-width-thin) solid
|
|
368
|
+
var(--wb-semanticColor-core-border-neutral-subtle);
|
|
369
|
+
}.wb-navigation-tabs-dropdown-root-72fea2cc {
|
|
370
|
+
.wb-navigation-tabs-dropdown-actionMenu-72fea2cc {
|
|
371
|
+
inline-size: 100%;
|
|
372
|
+
align-items: flex-start;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.wb-navigation-tabs-dropdown-opener-72fea2cc {
|
|
376
|
+
position: relative;
|
|
377
|
+
block-size: unset;
|
|
378
|
+
padding-block: var(--wb-sizing-size_120) var(--wb-sizing-size_140);
|
|
379
|
+
padding-inline: var(--wb-sizing-size_180);
|
|
380
|
+
inline-size: 100%;
|
|
381
|
+
justify-content: space-between;
|
|
382
|
+
gap: var(--wb-sizing-size_020);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
.wb-navigation-tabs-dropdown-label-72fea2cc {
|
|
386
|
+
flex-grow: 1;
|
|
387
|
+
max-inline-size: 100%;
|
|
388
|
+
text-align: start;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
@layer shared {/**
|
|
394
|
+
* Shared styles for `ResponsiveTabs` and `ResponsiveNavigationTabs`
|
|
395
|
+
*
|
|
396
|
+
* Every rule is nested inside `.root` — the marker class on the container,
|
|
397
|
+
* which carries no declarations of its own — because the container is a
|
|
398
|
+
* `View`, and this component overrides `View`'s `min-block-size` in the same
|
|
399
|
+
* `@layer shared`. At equal specificity stylesheet load order would decide the
|
|
400
|
+
* winner, so the compound selector makes it depend on specificity instead.
|
|
401
|
+
*
|
|
402
|
+
* `fadeIn` is applied to the tabs / dropdown rendered inside (through their
|
|
403
|
+
* `styles.root`), not to the container. CSS Modules scopes the keyframes name
|
|
404
|
+
* to this file. The build wraps every rule in `@layer shared { … }`.
|
|
405
|
+
*/@keyframes wb-responsive-fade-in-1929a67f {
|
|
406
|
+
from {
|
|
407
|
+
opacity: 0;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
to {
|
|
411
|
+
opacity: 1;
|
|
412
|
+
}
|
|
413
|
+
}.wb-responsive-root-1929a67f {
|
|
414
|
+
&.wb-responsive-container-1929a67f {
|
|
415
|
+
inline-size: 100%;
|
|
416
|
+
|
|
417
|
+
/* override setting the min height: 0 style */
|
|
418
|
+
min-block-size: auto;
|
|
419
|
+
}
|
|
420
|
+
}/* Apply fade in animation to the tabs and the dropdown to ease into the
|
|
421
|
+
* transition between the two layouts. Since this is a fade animation to
|
|
422
|
+
* smoothen the transition, we apply it always, even if prefers reduced motion
|
|
423
|
+
* is enabled */.wb-responsive-fadeIn-1929a67f {
|
|
424
|
+
animation-name: wb-responsive-fade-in-1929a67f;
|
|
425
|
+
animation-duration: 150ms;
|
|
426
|
+
animation-timing-function: ease-in-out;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/*# sourceMappingURL=index.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["<no source>","../src/components/navigation-tabs.module.css","../src/components/navigation-tab-item.module.css","../src/components/tab-panel.module.css","../../wonder-blocks-styles/src/styles/focus-styles.css","../src/components/tablist.module.css","../src/components/tabs.module.css","../src/components/tab.module.css","../src/components/tabs-dropdown.module.css","../src/components/navigation-tabs-dropdown.module.css","../src/components/responsive.module.css"],"names":[],"mappings":"AAAA,eCAA;;;;;;;;EAQE,CAEF;IACI,gBAAgB;AACpB,CAEA;IACI,kBAAkB;AACtB,CAEA;IACI,oEAAoE;IACpE,yCAAyC;IACzC,sCAAsC;IACtC,+BAA+B;IAC/B,aAAa;IACb,8BAA8B;IAC9B,iBAAiB;AACrB,CAEA;IACI;0DACsD;AAC1D;CD/BA;;AAAA,eEAA;;;;;;;;;;;;;;;;;;;;;EAqBE,CAEF;IACI,gBAAgB;IAChB,oBAAoB;IACpB,kEAAkE;;IAElE;QACI,+DAA+D;QAC/D;uEAC+D;IACnE;;IAEA;QACI,+DAA+D;QAC/D;uEAC+D;IACnE;;IAEA,yEAAyE;IACzE;QACI,kEAAkE;IACtE;;IAEA;wBACoB;IACpB;QACI;sBACc;QACd,gBAAgB;IACpB;;IAEA;QACI,uDAAuD;QACvD,gBAAgB;IACpB;;IAEA;QACI,0DAA0D;QAC1D,uCAAuC;QACvC,0CAA0C;QAC1C,yCAAyC;QACzC,kDAAkD;QAClD,aAAa;QACb,SAAS;QACT,6DAA6D;QAC7D,iBAAiB;QACjB,kBAAkB;QAClB,mBAAmB;QACnB,qBAAqB;IACzB;;IAEA;;iEAE6D;IAC7D;QACI,YAAY;QACZ,aAAa;QACb;;+EAEuE;QACvE,+CAA+C;IACnD;;IAEA;0DACsD;IACtD;QACI,qBAAqB;QACrB,YAAY;QACZ,aAAa;QACb,kEAAkE;QAClE,0DAA0D;IAC9D;;IAEA;QACI,qBAAqB;QACrB,YAAY;QACZ,aAAa;QACb,kEAAkE;IACtE;;IAEA;QACI,kEAAkE;IACtE;;IAEA;QACI,iEAAiE;QACjE,kEAAkE;IACtE;AACJ;CF9GA;;AAAA,eGAA;;;;;;;;EAQE,CCRF;;;;;;;;;;;;;;EAcE,CDFF;IACI,0CAA0C;IAC1C,aAAa;;IAEb;ICAA;2CACuC;IACvC;2CACuC;IACvC,6CAA6C;IDF7C;AACJ;CHnBA;;AAAA,eKAA;;;;;;;;EAQE,CAEF;IACI,aAAa;IACb,8BAA8B;IAC9B;0DACsD;;IAEtD,oEAAoE;IACpE,yCAAyC;AAC7C;CLlBA;;AAAA,eMAA;;;;;;;;EAQE,CAEF;IACI,oBAAoB;IACpB,sBAAsB;IACtB,oBAAoB;IACpB,kBAAkB;AACtB,CAEA;IACI,kBAAkB;IAClB,gBAAgB;IAChB,cAAc;AAClB;CNrBA;;AAAA,eOAA;;;;;;;;;;;;;;;;EAgBE,CHhBF;;;;;;;;;;;;;;EAcE,CGMF;IACI;QACI,aAAa;QACb,mBAAmB;QACnB,iBAAiB;QACjB,0DAA0D;QAC1D,YAAY;QACZ,SAAS;QACT,UAAU;QACV,eAAe;QACf,iEAAiE;QACjE,8BAA8B;QAC9B,kBAAkB;QAClB,6DAA6D;IACjE;;IAEA;IHpBA;2CACuC;IACvC;2CACuC;IACvC,6CAA6C;IGkB7C;;IAEA;;iBAEa;IACb;QACI,WAAW;QACX,kBAAkB;QAClB,eAAe;QACf,qDAAqD;IACzD;;IAEA,0DAA0D;IAC1D;QACI,kEAAkE;;QAElE;YACI,uCAAuC;YACvC;;aAEC;QACL;IACJ;;IAEA,2DAA2D;IAC3D;QACI,kEAAkE;;QAElE;YACI,wCAAwC;YACxC;;aAEC;QACL;IACJ;;IAEA;QACI,kEAAkE;IACtE;AACJ;CP7EA;;AAAA,eQAA;;;;;;;;;;;;;;;EAeE,CAEF;IACI;QACI,iBAAiB;QACjB,uBAAuB;QACvB;8DACsD;IAC1D;;IAEA;QACI,kBAAkB;QAClB,iBAAiB;QACjB,kEAAkE;QAClE,yCAAyC;QACzC,iBAAiB;QACjB,8BAA8B;QAC9B,8BAA8B;IAClC;;IAEA;QACI,YAAY;QACZ,qBAAqB;QACrB,iBAAiB;IACrB;AACJ;CRxCA;;AAAA,eSAA;;;;;;;;;;;;;;;;;;EAkBE,CAEF;IACI;0DACsD;AAC1D,CAEA;IACI;QACI,iBAAiB;QACjB,uBAAuB;IAC3B;;IAEA;QACI,kBAAkB;QAClB,iBAAiB;QACjB,kEAAkE;QAClE,yCAAyC;QACzC,iBAAiB;QACjB,8BAA8B;QAC9B,8BAA8B;IAClC;;IAEA;QACI,YAAY;QACZ,qBAAqB;QACrB,iBAAiB;IACrB;AACJ;CT9CA;;AAAA,eUAA;;;;;;;;;;;;EAYE,CAEF;IACI;QACI,UAAU;IACd;;IAEA;QACI,UAAU;IACd;AACJ,CAEA;IACI;QACI,iBAAiB;;QAEjB,6CAA6C;QAC7C,oBAAoB;IACxB;AACJ,CAEA;;;eAGe,CACf;IACI,8CAAuB;IACvB,yBAAyB;IACzB,sCAAsC;AAC1C;CVzCA","file":"index.css","sourcesContent":[null,"/**\n * NavigationTabs styles\n *\n * Every element is rendered by `addStyle`, which ships no class of its own, so\n * these single-class rules don't compete with anything else in\n * `@layer shared`. The consumer's `styles.*` still go through Aphrodite\n * (unlayered and `!important`), so they win over this module as they did\n * before. The build wraps every rule in `@layer shared { … }`.\n */\n\n.nav {\n overflow-x: auto;\n}\n\n.contents {\n position: relative;\n}\n\n.list {\n /* Add horizontal padding for focus outline of first/last elements */\n padding-inline: var(--wb-sizing-size_040);\n padding-block: var(--wb-sizing-size_0);\n margin: var(--wb-sizing-size_0);\n display: flex;\n gap: var(--wb-sizing-size_160);\n flex-wrap: nowrap;\n}\n\n.divider {\n border-block-end: var(--wb-border-width-thin) solid\n var(--wb-semanticColor-core-border-neutral-subtle);\n}\n","/**\n * NavigationTabItem styles\n *\n * `.root` is the list item (rendered by `addStyle`, no class of its own). The\n * link rules style the item's child — usually a Wonder Blocks `Link` — whose\n * own rules sit in the same `@layer shared`. Which package's stylesheet comes\n * first depends on the consumer's bundler and import order, so the link rules\n * are nested inside `.root` to outrank `Link`'s on specificity alone:\n * `Link`'s base classes are (0,1,0) and its states (0,2,0); the rules below\n * are (0,2,0) for the base and (0,3,0)+ for states.\n *\n * The link rule also declares the BodyText medium typography itself rather\n * than applying the typography classes: those are (0,1,0), the same as\n * `Link`'s `font-family` / `font-weight` (bold in thunderblocks), so the winner\n * would depend on load order; and the Aphrodite typography object would beat\n * this rule's `display: flex`.\n *\n * The consumer's `style` still goes through Aphrodite (unlayered and\n * `!important`), so it wins over this module as it did before. Nesting is\n * native CSS: every `&` is explicit and resolves to the flat selector it\n * replaces. The build wraps every rule in `@layer shared { … }`.\n */\n\n.root {\n list-style: none;\n display: inline-flex;\n padding-block: var(--wb-sizing-size_080) var(--wb-sizing-size_180);\n\n &:has(a:hover) {\n /* Using background token to match underline styling in Figma */\n box-shadow: inset 0 calc(var(--wb-sizing-size_020) * -1) 0 0\n var(--wb-semanticColor-core-background-instructive-default);\n }\n\n &:has(a:active) {\n /* Using background token to match underline styling in Figma */\n box-shadow: inset 0 calc(var(--wb-sizing-size_060) * -1) 0 0\n var(--wb-semanticColor-core-background-instructive-default);\n }\n\n /* breakpoint.mediaQuery.mdOrLarger (min-width: breakpoint.width.mdMin) */\n @media (--wb-breakpoint-mediaQuery-mdOrLarger) {\n padding-block: var(--wb-sizing-size_200) var(--wb-sizing-size_240);\n }\n\n /* Note: The current tab item underline style is provided by\n * NavigationTabs. */\n &.current:has(a:hover) {\n /* If it is current, remove hover underline since the tab is already\n * selected. */\n box-shadow: none;\n }\n\n &.current:has(a:active):not([aria-disabled=\"true\"]) {\n /* If it is current, make sure there is no box shadow */\n box-shadow: none;\n }\n\n & .link {\n /* BodyText medium / medium weight — see the note above. */\n font-family: var(--wb-font-family-sans);\n font-size: var(--wb-font-body-size-medium);\n font-weight: var(--wb-font-weight-medium);\n line-height: var(--wb-font-body-lineHeight-medium);\n display: flex;\n margin: 0;\n color: var(--wb-semanticColor-core-foreground-neutral-subtle);\n padding-inline: 0;\n position: relative;\n white-space: nowrap;\n text-decoration: none;\n }\n\n /* Declared before the hover / press rules (stylelint's\n * no-descending-specificity); they only overlap on `border: none` and\n * `outline: none`, so the order doesn't change the result. */\n & .link:focus-visible {\n border: none;\n outline: none;\n box-shadow:\n 0 0 0 var(--wb-sizing-size_020) var(--wb-semanticColor-focus-inner),\n 0 0 0 var(--wb-sizing-size_040) var(--wb-semanticColor-focus-outer);\n border-radius: var(--wb-border-radius-radius_0);\n }\n\n /* NOTE: We use :not[aria-disabled] to avoid the hover styles to be\n * applied when the interactive element is disabled. */\n & .link:hover:not([aria-disabled=\"true\"]) {\n text-decoration: none;\n border: none;\n outline: none;\n color: var(--wb-semanticColor-core-foreground-instructive-default);\n background-color: var(--wb-semanticColor-core-transparent);\n }\n\n & .link:active:not([aria-disabled=\"true\"]) {\n text-decoration: none;\n border: none;\n outline: none;\n color: var(--wb-semanticColor-core-foreground-instructive-default);\n }\n\n & .currentLink {\n color: var(--wb-semanticColor-core-foreground-instructive-default);\n }\n\n & .currentLink:active:not([aria-disabled=\"true\"]) {\n /* Make sure the current link doesn't change color when pressed */\n color: var(--wb-semanticColor-core-foreground-instructive-default);\n }\n}\n","/**\n * TabPanel styles\n *\n * The panel is rendered by `addStyle`, which ships no class of its own, so\n * this single-class rule doesn't compete with anything else in\n * `@layer shared`. The consumer's `style` still goes through Aphrodite\n * (unlayered and `!important`), so it wins over this module as it did before.\n * The build wraps every rule in `@layer shared { … }`.\n */\n\n@import \"@khanacademy/wonder-blocks-styles/focus-styles.css\";\n\n.tabPanel {\n /* Apply flex so that panel supports rtl */\n display: flex;\n\n &:focus-visible {\n @apply --wb-focus-visible;\n }\n}\n","/*\n * Cross-package focus-visible mixin.\n *\n * Authors include the mixin via:\n *\n * @import \"@khanacademy/wonder-blocks-styles/focus-styles.css\";\n *\n * .my-component:focus-visible {\n * @apply --wb-focus-visible;\n * }\n *\n * postcss-import resolves the @import through the workspace and\n * @csstools/postcss-mixins expands the @apply at build time\n * (CSS Mixins Level 1 syntax — note the leading `--` on the name).\n */\n@mixin --wb-focus-visible() {\n box-shadow: 0 0 0 var(--wb-border-width-medium)\n var(--wb-semanticColor-focus-inner);\n outline: var(--wb-border-width-medium) solid\n var(--wb-semanticColor-focus-outer);\n outline-offset: var(--wb-border-width-medium);\n}\n","/**\n * Tablist styles\n *\n * The tablist is rendered by `addStyle`, which ships no class of its own, so\n * this single-class rule doesn't compete with anything else in\n * `@layer shared`. The consumer's `style` still goes through Aphrodite\n * (unlayered and `!important`), so it wins over this module as it did before.\n * The build wraps every rule in `@layer shared { … }`.\n */\n\n.tablist {\n display: flex;\n gap: var(--wb-sizing-size_240);\n border-block-end: var(--wb-border-width-thin) solid\n var(--wb-semanticColor-core-border-neutral-subtle);\n\n /* Add horizontal padding for focus outline of first/last elements */\n padding-inline: var(--wb-sizing-size_040);\n}\n","/**\n * Tabs styles\n *\n * Both elements are rendered by `addStyle`, which ships no class of its own,\n * so these single-class rules don't compete with anything else in\n * `@layer shared`. The consumer's `styles.root` still goes through Aphrodite\n * (unlayered and `!important`), so it wins over this module as it did before.\n * The build wraps every rule in `@layer shared { … }`.\n */\n\n.tabs {\n display: inline-flex;\n flex-direction: column;\n align-items: stretch;\n position: relative;\n}\n\n.tablistWrapper {\n position: relative;\n overflow-x: auto;\n flex-shrink: 0;\n}\n","/**\n * Tab styles\n *\n * Every rule is nested inside `.root` — a marker class on the tab button\n * itself, which carries no declarations of its own. The button also gets the\n * typography classes (`typographyClassNames.BodyTextMediumMediumWeight`), which\n * ship single-class rules in the same `@layer shared` — including `display`\n * and `margin`, both of which this component overrides. At equal specificity\n * stylesheet load order would decide the winner, so the compound selector\n * makes it depend on specificity instead.\n *\n * The consumer's `style` still goes through Aphrodite (unlayered and\n * `!important`), so it wins over this module as it did before. Nesting is\n * native CSS: every `&` is explicit and resolves to the flat selector it\n * replaces (`.root.tab`, `.root.tab::after`, …). The build wraps every rule in\n * `@layer shared { … }`.\n */\n\n@import \"@khanacademy/wonder-blocks-styles/focus-styles.css\";\n\n.root {\n &.tab {\n display: flex;\n align-items: center;\n text-wrap: nowrap;\n background-color: var(--wb-semanticColor-core-transparent);\n border: none;\n margin: 0;\n padding: 0;\n cursor: pointer;\n margin-block: var(--wb-sizing-size_080) var(--wb-sizing-size_140);\n gap: var(--wb-sizing-size_080);\n position: relative;\n color: var(--wb-semanticColor-core-foreground-neutral-subtle);\n }\n\n &.tab:focus-visible {\n @apply --wb-focus-visible;\n }\n\n /* Using ::after styling to apply the hover/pressed underline styling\n * instead of box-shadow because we use box-shadow for the focus\n * outline. */\n &.tab::after {\n content: \"\";\n position: absolute;\n inset-inline: 0;\n inset-block-end: calc(var(--wb-sizing-size_140) * -1);\n }\n\n /* Only apply hover styles to tabs that are not selected */\n &.tab:hover:not([aria-selected=\"true\"]) {\n color: var(--wb-semanticColor-core-foreground-instructive-default);\n\n &::after {\n block-size: var(--wb-border-width-thin);\n background-color: var(\n --wb-semanticColor-core-background-instructive-default\n );\n }\n }\n\n /* Only apply active styles to tabs that are not selected */\n &.tab:active:not([aria-selected=\"true\"]) {\n color: var(--wb-semanticColor-core-foreground-instructive-default);\n\n &::after {\n block-size: var(--wb-border-width-thick);\n background-color: var(\n --wb-semanticColor-core-background-instructive-default\n );\n }\n }\n\n &.selectedTab {\n color: var(--wb-semanticColor-core-foreground-instructive-default);\n }\n}\n","/**\n * TabsDropdown styles\n *\n * Every rule is nested inside `.root` — a marker class on the component's root\n * `View`, which carries no declarations of its own. The rules override\n * classes from other packages: `.actionMenu` lands on DropdownCore's\n * `.menuWrapper` `View` (`inline-size`, `align-items`), and `.opener` /\n * `.label` land on `Button` and its `BodyText` label (`block-size`,\n * `padding`). The published bundle loads this package's CSS before its\n * dependencies', so at equal specificity those rules would win. The\n * descendant selectors (0,2,0) make the result depend on specificity instead.\n *\n * The consumer's `styles.*` still go through Aphrodite (unlayered and\n * `!important`) or inline styles, so they win over this module as they did\n * before. The build wraps every rule in `@layer shared { … }`.\n */\n\n.root {\n .actionMenu {\n inline-size: 100%;\n align-items: flex-start;\n border-block-end: var(--wb-border-width-thin) solid\n var(--wb-semanticColor-core-border-neutral-subtle);\n }\n\n .opener {\n position: relative;\n block-size: unset;\n padding-block: var(--wb-sizing-size_120) var(--wb-sizing-size_140);\n padding-inline: var(--wb-sizing-size_180);\n inline-size: 100%;\n justify-content: space-between;\n gap: var(--wb-sizing-size_020);\n }\n\n .label {\n flex-grow: 1;\n max-inline-size: 100%;\n text-align: start;\n }\n}\n","/**\n * NavigationTabsDropdown styles\n *\n * The root element is rendered by `addStyle`, which ships no class of its own,\n * so `.divider` needs no extra specificity.\n *\n * Every other rule is nested inside `.root` — a marker class on that root\n * element, which carries no declarations of its own. Those rules override\n * classes from other packages: `.actionMenu` lands on DropdownCore's\n * `.menuWrapper` `View` (`inline-size`, `align-items`), and `.opener` /\n * `.label` land on `Button` and its `BodyText` label (`block-size`,\n * `padding`). The published bundle loads this package's CSS before its\n * dependencies', so at equal specificity those rules would win. The\n * descendant selectors (0,2,0) make the result depend on specificity instead.\n *\n * The consumer's `styles.*` still go through Aphrodite (unlayered and\n * `!important`) or inline styles, so they win over this module as they did\n * before. The build wraps every rule in `@layer shared { … }`.\n */\n\n.divider {\n border-block-end: var(--wb-border-width-thin) solid\n var(--wb-semanticColor-core-border-neutral-subtle);\n}\n\n.root {\n .actionMenu {\n inline-size: 100%;\n align-items: flex-start;\n }\n\n .opener {\n position: relative;\n block-size: unset;\n padding-block: var(--wb-sizing-size_120) var(--wb-sizing-size_140);\n padding-inline: var(--wb-sizing-size_180);\n inline-size: 100%;\n justify-content: space-between;\n gap: var(--wb-sizing-size_020);\n }\n\n .label {\n flex-grow: 1;\n max-inline-size: 100%;\n text-align: start;\n }\n}\n","/**\n * Shared styles for `ResponsiveTabs` and `ResponsiveNavigationTabs`\n *\n * Every rule is nested inside `.root` — the marker class on the container,\n * which carries no declarations of its own — because the container is a\n * `View`, and this component overrides `View`'s `min-block-size` in the same\n * `@layer shared`. At equal specificity stylesheet load order would decide the\n * winner, so the compound selector makes it depend on specificity instead.\n *\n * `fadeIn` is applied to the tabs / dropdown rendered inside (through their\n * `styles.root`), not to the container. CSS Modules scopes the keyframes name\n * to this file. The build wraps every rule in `@layer shared { … }`.\n */\n\n@keyframes fade-in {\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n}\n\n.root {\n &.container {\n inline-size: 100%;\n\n /* override setting the min height: 0 style */\n min-block-size: auto;\n }\n}\n\n/* Apply fade in animation to the tabs and the dropdown to ease into the\n * transition between the two layouts. Since this is a fade animation to\n * smoothen the transition, we apply it always, even if prefers reduced motion\n * is enabled */\n.fadeIn {\n animation-name: fade-in;\n animation-duration: 150ms;\n animation-timing-function: ease-in-out;\n}\n"]}
|