@atom-learning/components 3.27.0-beta.2 → 3.27.0-beta.4

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.
@@ -1,2 +1,2 @@
1
- import*as l from"@radix-ui/react-navigation-menu";import n from"react";import{useNavigationMenuContext as u}from"./NavigationMenuContext.js";import{NavigationMenuDropdownContent as g}from"./NavigationMenuDropdownContent.js";import{NavigationMenuDropdownTrigger as s}from"./NavigationMenuDropdownTrigger.js";const a=({children:i,id:t,...r})=>{const{onNodeUpdate:p}=u();return n.createElement(l.Item,{value:t},n.Children.map(i,e=>{const o=n.isValidElement(e)&&e.type===s,d=n.isValidElement(e)&&e.type===g;if(!o&&!d)throw new Error('Only NavigationMenu.Trigger and NavigationMenu.Content can be the passed as a "children" of NavigationMenu.Dropdown');return o?n.cloneElement(e,{...r,ref:m=>p(m,t)}):e}))};a.displayName="NavigationMenuDropdown";export{a as NavigationMenuDropdown};
1
+ import*as l from"@radix-ui/react-navigation-menu";import n from"react";import{useNavigationMenuContext as u}from"./NavigationMenuContext.js";import{NavigationMenuDropdownContent as g}from"./NavigationMenuDropdownContent.js";import{NavigationMenuDropdownTrigger as s}from"./NavigationMenuDropdownTrigger.js";const r=({children:i,id:t,...a})=>{const{onNodeUpdate:p}=u();return n.createElement(l.Item,{value:t},n.Children.map(i,e=>{const o=n.isValidElement(e)&&e.type===s,d=n.isValidElement(e)&&e.type===g;if(!o&&!d)throw new Error('Only NavigationMenu.Trigger and NavigationMenu.Content can be the passed as a "children" of NavigationMenu.Dropdown');return o?n.cloneElement(e,{...a,ref:m=>p(m,t)}):e}))};r.displayName="NavigationMenuDropdown";export{r as NavigationMenuDropdown};
2
2
  //# sourceMappingURL=NavigationMenuDropdown.js.map
@@ -1,2 +1,2 @@
1
- import{ChevronDown as s}from"@atom-learning/icons";import*as m from"@radix-ui/react-navigation-menu";import e from"react";import{styled as p}from"../../stitches.js";import{Icon as d}from"../icon/Icon.js";import{navigationMenuBaseItemStyles as f,navigationMenuActiveItemStyles as c}from"./NavigationMenu.styles.js";import{preventEvent as t}from"../../utilities/event/preventEvent.js";const g=p(m.Trigger,f,{display:"flex",alignItems:"center",borderRadius:"$1",justifyContent:"space-between",'&[data-state="open"]':{background:"$triggerBackgroundOpen"},variants:{active:{true:{...c}}}}),r=e.forwardRef(({children:o,active:n,...a},i)=>e.createElement(g,{active:n,...a,ref:i,onPointerMove:t,onPointerLeave:t},o,e.createElement(d,{is:s,css:{ml:"$1","[data-state=open] &":{transform:"rotate(-180deg)"},"@media (prefers-reduced-motion: no-preference)":{transition:"transform .2s ease"}},size:"sm"})));r.displayName="NavigationMenuDropdownTrigger";export{r as NavigationMenuDropdownTrigger};
1
+ import{ChevronDown as s}from"@atom-learning/icons";import*as m from"@radix-ui/react-navigation-menu";import e from"react";import{styled as p}from"../../stitches.js";import{Icon as d}from"../icon/Icon.js";import{navigationMenuBaseItemStyles as f,navigationMenuActiveItemStyles as c}from"./NavigationMenu.styles.js";import{preventEvent as r}from"../../utilities/event/preventEvent.js";const g=p(m.Trigger,f,{display:"flex",alignItems:"center",borderRadius:"$1",justifyContent:"space-between",'&[data-state="open"]':{background:"$triggerBackgroundOpen"},variants:{active:{true:{...c}}}}),t=e.forwardRef(({children:o,active:n,...a},i)=>e.createElement(g,{active:n,...a,ref:i,onPointerMove:r,onPointerLeave:r},o,e.createElement(d,{is:s,css:{ml:"$1","[data-state=open] &":{transform:"rotate(-180deg)"},"@media (prefers-reduced-motion: no-preference)":{transition:"transform .2s ease"}},size:"sm"})));t.displayName="NavigationMenuDropdownTrigger";export{t as NavigationMenuDropdownTrigger};
2
2
  //# sourceMappingURL=NavigationMenuDropdownTrigger.js.map
@@ -1,2 +1,2 @@
1
- import*as n from"@radix-ui/react-navigation-menu";import e from"react";import{styled as t}from"../../stitches.js";import{getExternalAnchorProps as u}from"../../utilities/uri/index.js";import{navigationMenuBaseItemStyles as i,navigationMenuDisabledItemStyles as v,navigationMenuActiveItemStyles as b}from"./NavigationMenu.styles.js";const p=t("button",{...i,...v}),f=t(n.Item),g=t(n.Link,i,{display:"block",textDecoration:"none",lineHeight:1,variants:{elementType:{dropdownItem:{"&[data-active]":{background:"$backgroundSelected",color:"$textSelected","&:hover":{background:"$backgroundSelectedHover",color:"$textSelectedHover"},"&:active":{background:"$backgroundSelectedPressed",color:"$textSelectedPressed"},"&:focus-visible":{boxShadow:"0 0 0 2px $colors$primary800",color:"$textSelectedFocus"}}},link:{"&[data-active]":{...b}}}}}),c=e.forwardRef(({children:o,href:r,disabled:l,css:a,variant:d="link",ref:k,...s},m)=>e.createElement(f,null,l?e.createElement(p,{disabled:!0,css:a},o):e.createElement(g,{href:r,ref:m,elementType:d,css:a,...u(r),...s},o)));c.displayName="NavigationMenuLink";export{c as NavigationMenuLink};
1
+ import*as a from"@radix-ui/react-navigation-menu";import e from"react";import{useRouter as f}from"../../context/router/index.js";import{styled as o}from"../../stitches.js";import{getExternalAnchorProps as p}from"../../utilities/uri/index.js";import{navigationMenuBaseItemStyles as i,navigationMenuDisabledItemStyles as v,navigationMenuActiveItemStyles as b}from"./NavigationMenu.styles.js";const g=o("button",{...i,...v}),k=o(a.Item),S=o(a.Link,i,{display:"block",textDecoration:"none",lineHeight:1,variants:{elementType:{dropdownItem:{"&[data-active]":{background:"$backgroundSelected",color:"$textSelected","&:hover":{background:"$backgroundSelectedHover",color:"$textSelectedHover"},"&:active":{background:"$backgroundSelectedPressed",color:"$textSelectedPressed"},"&:focus-visible":{boxShadow:"0 0 0 2px $colors$primary800",color:"$textSelectedFocus"}}},link:{"&[data-active]":{...b}}}}}),l=e.forwardRef(({children:r,href:t,disabled:c,css:n,variant:d="link",ref:y,...s},m)=>{const{RouterLink:u}=f({href:t});return e.createElement(k,null,c?e.createElement(g,{disabled:!0,css:n},r):e.createElement(S,{href:t,ref:m,elementType:d,css:n,...p(t),...s,asChild:!0},e.createElement(u,null,r)))});l.displayName="NavigationMenuLink";export{l as NavigationMenuLink};
2
2
  //# sourceMappingURL=NavigationMenuLink.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationMenuLink.js","sources":["../../../src/components/navigation/NavigationMenuLink.tsx"],"sourcesContent":["import * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu'\nimport React from 'react'\n\nimport { styled } from '~/stitches'\nimport { getExternalAnchorProps } from '~/utilities/uri'\n\nimport {\n navigationMenuActiveItemStyles,\n navigationMenuBaseItemStyles,\n navigationMenuDisabledItemStyles\n} from './NavigationMenu.styles'\n\nconst DisabledButton = styled('button', {\n ...navigationMenuBaseItemStyles,\n ...navigationMenuDisabledItemStyles\n})\n\nconst ListItem = styled(NavigationMenuPrimitive.Item)\n\nconst StyledLink = styled(\n NavigationMenuPrimitive.Link,\n navigationMenuBaseItemStyles,\n {\n display: 'block',\n textDecoration: 'none',\n lineHeight: 1,\n variants: {\n elementType: {\n dropdownItem: {\n '&[data-active]': {\n background: '$backgroundSelected',\n color: '$textSelected',\n '&:hover': {\n background: '$backgroundSelectedHover',\n color: '$textSelectedHover'\n },\n '&:active': {\n background: '$backgroundSelectedPressed',\n color: '$textSelectedPressed'\n },\n '&:focus-visible': {\n boxShadow: '0 0 0 2px $colors$primary800',\n color: '$textSelectedFocus'\n }\n }\n },\n link: {\n '&[data-active]': { ...navigationMenuActiveItemStyles }\n }\n }\n }\n }\n)\n\nexport const NavigationMenuLink: React.ForwardRefExoticComponent<\n Omit<React.ComponentProps<typeof StyledLink>, 'elementType'> & {\n disabled?: boolean\n variant?: React.ComponentProps<typeof StyledLink>['elementType']\n }\n> = React.forwardRef(\n (\n { children, href, disabled, css, variant = 'link', ref, ...props },\n forwardedRef\n ) => (\n <ListItem>\n {disabled ? (\n <DisabledButton disabled css={css}>\n {children}\n </DisabledButton>\n ) : (\n <StyledLink\n href={href}\n ref={forwardedRef}\n elementType={variant}\n css={css}\n {...getExternalAnchorProps(href)}\n {...props}\n >\n {children}\n </StyledLink>\n )}\n </ListItem>\n )\n)\n\nNavigationMenuLink.displayName = 'NavigationMenuLink'\n"],"names":["DisabledButton","styled","navigationMenuBaseItemStyles","navigationMenuDisabledItemStyles","ListItem","NavigationMenuPrimitive","StyledLink","navigationMenuActiveItemStyles","NavigationMenuLink","React","children","href","disabled","css","variant","ref","props","forwardedRef","getExternalAnchorProps"],"mappings":"4UAYA,MAAMA,EAAiBC,EAAO,SAAU,CACtC,GAAGC,EACH,GAAGC,CACL,CAAC,EAEKC,EAAWH,EAAOI,EAAwB,IAAI,EAE9CC,EAAaL,EACjBI,EAAwB,KACxBH,EACA,CACE,QAAS,QACT,eAAgB,OAChB,WAAY,EACZ,SAAU,CACR,YAAa,CACX,aAAc,CACZ,iBAAkB,CAChB,WAAY,sBACZ,MAAO,gBACP,UAAW,CACT,WAAY,2BACZ,MAAO,oBACT,EACA,WAAY,CACV,WAAY,6BACZ,MAAO,sBACT,EACA,kBAAmB,CACjB,UAAW,+BACX,MAAO,oBACT,CACF,CACF,EACA,KAAM,CACJ,iBAAkB,CAAE,GAAGK,CAA+B,CACxD,CACF,CACF,CACF,CACF,EAEaC,EAKTC,EAAM,WACR,CACE,CAAE,SAAAC,EAAU,KAAAC,EAAM,SAAAC,EAAU,IAAAC,EAAK,QAAAC,EAAU,OAAQ,IAAAC,KAAQC,CAAM,EACjEC,IAEAR,EAAA,cAACL,EAAA,KACEQ,EACCH,EAAA,cAACT,EAAA,CAAe,SAAQ,GAAC,IAAKa,GAC3BH,CACH,EAEAD,EAAA,cAACH,EAAA,CACC,KAAMK,EACN,IAAKM,EACL,YAAaH,EACb,IAAKD,EACJ,GAAGK,EAAuBP,CAAI,EAC9B,GAAGK,GAEHN,CACH,CAEJ,CAEJ,EAEAF,EAAmB,YAAc"}
1
+ {"version":3,"file":"NavigationMenuLink.js","sources":["../../../src/components/navigation/NavigationMenuLink.tsx"],"sourcesContent":["import * as NavigationMenuPrimitive from '@radix-ui/react-navigation-menu'\nimport React from 'react'\n\nimport { useRouter } from '~/context/router'\nimport { styled } from '~/stitches'\nimport { getExternalAnchorProps } from '~/utilities/uri'\n\nimport {\n navigationMenuActiveItemStyles,\n navigationMenuBaseItemStyles,\n navigationMenuDisabledItemStyles\n} from './NavigationMenu.styles'\n\nconst DisabledButton = styled('button', {\n ...navigationMenuBaseItemStyles,\n ...navigationMenuDisabledItemStyles\n})\n\nconst ListItem = styled(NavigationMenuPrimitive.Item)\n\nconst StyledLink = styled(\n NavigationMenuPrimitive.Link,\n navigationMenuBaseItemStyles,\n {\n display: 'block',\n textDecoration: 'none',\n lineHeight: 1,\n variants: {\n elementType: {\n dropdownItem: {\n '&[data-active]': {\n background: '$backgroundSelected',\n color: '$textSelected',\n '&:hover': {\n background: '$backgroundSelectedHover',\n color: '$textSelectedHover'\n },\n '&:active': {\n background: '$backgroundSelectedPressed',\n color: '$textSelectedPressed'\n },\n '&:focus-visible': {\n boxShadow: '0 0 0 2px $colors$primary800',\n color: '$textSelectedFocus'\n }\n }\n },\n link: {\n '&[data-active]': { ...navigationMenuActiveItemStyles }\n }\n }\n }\n }\n)\n\nexport const NavigationMenuLink: React.ForwardRefExoticComponent<\n Omit<React.ComponentProps<typeof StyledLink>, 'elementType'> & {\n disabled?: boolean\n variant?: React.ComponentProps<typeof StyledLink>['elementType']\n }\n> = React.forwardRef(\n (\n { children, href, disabled, css, variant = 'link', ref, ...props },\n forwardedRef\n ) => {\n const { RouterLink } = useRouter({ href })\n return (\n <ListItem>\n {disabled ? (\n <DisabledButton disabled css={css}>\n {children}\n </DisabledButton>\n ) : (\n <StyledLink\n href={href}\n ref={forwardedRef}\n elementType={variant}\n css={css}\n {...getExternalAnchorProps(href)}\n {...props}\n asChild\n >\n <RouterLink>{children}</RouterLink>\n </StyledLink>\n )}\n </ListItem>\n )\n }\n)\n\nNavigationMenuLink.displayName = 'NavigationMenuLink'\n"],"names":["DisabledButton","styled","navigationMenuBaseItemStyles","navigationMenuDisabledItemStyles","ListItem","NavigationMenuPrimitive","StyledLink","navigationMenuActiveItemStyles","NavigationMenuLink","React","children","href","disabled","css","variant","ref","props","forwardedRef","RouterLink","useRouter","getExternalAnchorProps"],"mappings":"sYAaA,MAAMA,EAAiBC,EAAO,SAAU,CACtC,GAAGC,EACH,GAAGC,CACL,CAAC,EAEKC,EAAWH,EAAOI,EAAwB,IAAI,EAE9CC,EAAaL,EACjBI,EAAwB,KACxBH,EACA,CACE,QAAS,QACT,eAAgB,OAChB,WAAY,EACZ,SAAU,CACR,YAAa,CACX,aAAc,CACZ,iBAAkB,CAChB,WAAY,sBACZ,MAAO,gBACP,UAAW,CACT,WAAY,2BACZ,MAAO,oBACT,EACA,WAAY,CACV,WAAY,6BACZ,MAAO,sBACT,EACA,kBAAmB,CACjB,UAAW,+BACX,MAAO,oBACT,CACF,CACF,EACA,KAAM,CACJ,iBAAkB,CAAE,GAAGK,CAA+B,CACxD,CACF,CACF,CACF,CACF,EAEaC,EAKTC,EAAM,WACR,CACE,CAAE,SAAAC,EAAU,KAAAC,EAAM,SAAAC,EAAU,IAAAC,EAAK,QAAAC,EAAU,OAAQ,IAAAC,KAAQC,CAAM,EACjEC,IACG,CACH,KAAM,CAAE,WAAAC,CAAW,EAAIC,EAAU,CAAE,KAAAR,CAAK,CAAC,EACzC,OACEF,EAAA,cAACL,EAAA,KACEQ,EACCH,EAAA,cAACT,EAAA,CAAe,SAAQ,GAAC,IAAKa,GAC3BH,CACH,EAEAD,EAAA,cAACH,EAAA,CACC,KAAMK,EACN,IAAKM,EACL,YAAaH,EACb,IAAKD,EACJ,GAAGO,EAAuBT,CAAI,EAC9B,GAAGK,EACJ,QAAO,EAEPP,EAAAA,EAAA,cAACS,EAAA,KAAYR,CAAS,CACxB,CAEJ,CAEJ,CACF,EAEAF,EAAmB,YAAc"}
@@ -1,2 +1,2 @@
1
- import*as r from"react";import{isExternalUrl as n}from"../../utilities/uri/index.js";const o=r.createContext({Link:e=>r.createElement("a",{...e})}),i=({children:e,Link:t})=>r.createElement(o.Provider,{value:{Link:t}},e),a=({href:e})=>{const{Link:t}=r.useContext(o);return{RouterLink:n(e)?"a":t}};export{i as RouterProvider,a as useRouter};
1
+ import*as r from"react";import{isExternalUrl as n,isUriScheme as i}from"../../utilities/uri/index.js";const s=e=>!n(e)&&!i(e),o=r.createContext({Link:e=>r.createElement("a",{...e})}),a=({children:e,Link:t})=>r.createElement(o.Provider,{value:{Link:t}},e),c=({href:e})=>{const{Link:t}=r.useContext(o);return{RouterLink:s(e)?t:"a"}};export{a as RouterProvider,c as useRouter};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/context/router/index.tsx"],"sourcesContent":["import * as React from 'react'\nimport { isExternalUrl } from '~/utilities/uri'\n\nconst RouterContext = React.createContext({\n // eslint-disable-next-line jsx-a11y/anchor-has-content\n Link: (props) => <a {...props} />\n})\n\nexport const RouterProvider = ({ children, Link }) => (\n <RouterContext.Provider value={{ Link }}>{children}</RouterContext.Provider>\n)\n\nexport const useRouter = ({ href }: { href?: string }) => {\n const { Link: RouterLink } = React.useContext(RouterContext)\n\n return {\n RouterLink: isExternalUrl(href) ? 'a' : RouterLink\n }\n}\n"],"names":["RouterContext","React","props","RouterProvider","children","Link","useRouter","href","RouterLink","isExternalUrl"],"mappings":"qFAGA,MAAMA,EAAgBC,EAAM,cAAc,CAExC,KAAOC,GAAUD,EAAA,cAAC,IAAG,CAAA,GAAGC,CAAO,CAAA,CACjC,CAAC,EAEYC,EAAiB,CAAC,CAAE,SAAAC,EAAU,KAAAC,CAAK,IAC9CJ,EAAA,cAACD,EAAc,SAAd,CAAuB,MAAO,CAAE,KAAAK,CAAK,CAAID,EAAAA,CAAS,EAGxCE,EAAY,CAAC,CAAE,KAAAC,CAAK,IAAyB,CACxD,KAAM,CAAE,KAAMC,CAAW,EAAIP,EAAM,WAAWD,CAAa,EAE3D,MAAO,CACL,WAAYS,EAAcF,CAAI,EAAI,IAAMC,CAC1C,CACF"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/context/router/index.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { isExternalUrl, isUriScheme } from '~/utilities/uri'\n\nconst shouldUseRouter = (url) => !isExternalUrl(url) && !isUriScheme(url)\n\nconst RouterContext = React.createContext({\n // eslint-disable-next-line jsx-a11y/anchor-has-content\n Link: (props) => <a {...props} />\n})\n\nexport const RouterProvider = ({ children, Link }) => (\n <RouterContext.Provider value={{ Link }}>{children}</RouterContext.Provider>\n)\n\nexport const useRouter = ({ href }: { href?: string }) => {\n const { Link: RouterLink } = React.useContext(RouterContext)\n\n return {\n RouterLink: shouldUseRouter(href) ? RouterLink : 'a'\n }\n}\n"],"names":["shouldUseRouter","url","isExternalUrl","isUriScheme","RouterContext","React","props","RouterProvider","children","Link","useRouter","href","RouterLink"],"mappings":"sGAIA,MAAMA,EAAmBC,GAAQ,CAACC,EAAcD,CAAG,GAAK,CAACE,EAAYF,CAAG,EAElEG,EAAgBC,EAAM,cAAc,CAExC,KAAOC,GAAUD,EAAA,cAAC,IAAA,CAAG,GAAGC,CAAAA,CAAO,CACjC,CAAC,EAEYC,EAAiB,CAAC,CAAE,SAAAC,EAAU,KAAAC,CAAK,IAC9CJ,EAAA,cAACD,EAAc,SAAd,CAAuB,MAAO,CAAE,KAAAK,CAAK,GAAID,CAAS,EAGxCE,EAAY,CAAC,CAAE,KAAAC,CAAK,IAAyB,CACxD,KAAM,CAAE,KAAMC,CAAW,EAAIP,EAAM,WAAWD,CAAa,EAE3D,MAAO,CACL,WAAYJ,EAAgBW,CAAI,EAAIC,EAAa,GACnD,CACF"}