@cavilha/breadcrumb
Advanced tools
Comparing version 0.1.1 to 0.1.2
# @cavilha/breadcrumb | ||
## 0.1.2 | ||
### Patch Changes | ||
- dc40453: fix label "Página inicial" | ||
## 0.1.1 | ||
@@ -4,0 +10,0 @@ |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("react-responsive"),r=require("@cavilha/theme"),a=require("@fortawesome/pro-regular-svg-icons"),l=require("@cavilha/button"),i=require("@cavilha/icon");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(e),c=n(l),u=n(i),d=function(){return d=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var l in t=arguments[r])Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l]);return e},d.apply(this,arguments)};function s(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(a=Object.getOwnPropertySymbols(e);l<a.length;l++)t.indexOf(a[l])<0&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]])}return r}var m=r.styled("div",{display:"flex",flexWrap:"wrap",alignItems:"center",padding:"$small3 0",variants:{scrollMobile:{true:{flexWrap:"initial",minWidth:"max-content","@md":{flexWrap:"wrap"}}}}}),f=r.styled("div",{display:"flex",fontSize:"$bodySmall","& p":{margin:0},"& a":{textDecoration:"none",borderRadius:"$small","&:hover":{textDecoration:"underline"},"&:focus":{outline:"none",boxShadow:"$focusPressed"},"&:active":{outline:"none",boxShadow:"$focusPressed"}},variants:{active:{true:{color:"$neutral5","& a":{color:"$neutral5"}},false:{"& a":{color:"$secondary4"}}},isMobile:{true:{"& p":{maxWidth:"20ch",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},isLastItemLimited:{true:{"& p":{maxWidth:"300px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}}}}),v=r.styled("div",{color:"$neutral4",padding:"0 $small2"}),h=r.styled("div",{padding:"1px 2px",borderRadius:"$small",textDecoration:"none",variants:{active:{false:{"&:hover":{background:"$secondaryHover0"}}}}}),p=r.styled("div",{borderRadius:"$small",cursor:"pointer",fontSize:"$bodySmall",color:"$neutral5","& a":{textDecoration:"none",borderRadius:"$small",fontSize:"$bodySmall",fontWeight:"$bold",color:"$neutral5 !important",p:"$none","&:hover":{textDecoration:"underline",backgroundColor:"$none"}}}),b=r.styled("button",{background:"none",border:"none",borderRadius:"$small",cursor:"pointer","&:hover":{textDecoration:"underline"},"&:focus":{outline:"none",boxShadow:"$focusPressed"},"&:active":{outline:"none",boxShadow:"$focusPressed"}}),E=r.styled("div",{display:"flex",variants:{scrollMobile:{true:{overflow:"scroll",width:"100%",minWidth:"max-content"}}}}),y=function(e){var t=e.marker,r=s(e,["marker"]);return o.default.createElement(b,d({},r),t)},g=function(e){var t=e.marker,r="string"==typeof t?t:o.default.createElement(u.default,{icon:t,iconSize:14});return o.default.createElement(v,null,r)},x=function(e){var t=e.children,r=e.path,l=e.hasMark,i=void 0!==l&&l,n=e.markPosition,c=void 0===n?"left":n,u=e.isActive,d=void 0!==u&&u,s=e.isMobile,m=void 0!==s&&s,v=e.isLastItemLimited,h=void 0!==v&&v,p="left"===c&&o.default.createElement(g,{marker:a.faChevronRight}),b="right"===c&&o.default.createElement(g,{marker:a.faChevronRight});return o.default.createElement(f,{active:d,isMobile:m,isLastItemLimited:h},i&&p,function(e,t,r){return void 0===r&&(r=!1),r?o.default.createElement("p",null,e):"string"==typeof e&&t?o.default.createElement("a",{href:t},e):e}(t,r,d),i&&b)},k=function(e){var t=e.isActive,r=e.homePath;return o.default.createElement(h,{active:t},o.default.createElement(x,{isActive:t},t?o.default.createElement(u.default,{icon:a.faHomeAlt,iconSize:14}):o.default.createElement("a",{href:r},o.default.createElement(u.default,{icon:a.faHomeAlt,iconSize:14}))))},L=function(e){var t=e.isActive,r=e.homePath;return o.default.createElement(h,null,o.default.createElement(x,{isActive:t},o.default.createElement("a",{href:r,title:"Voltar a Página inicial"},"Página inicial")))},M=function(a){var l=a.isActive,i=a.onBackButtonClick,n=t.useMediaQuery({query:r.media.md}),u=e.useMemo((function(){return n?"Voltar a página anterior":"Voltar"}),[n]);return o.default.createElement(p,null,o.default.createElement(x,{isActive:l},o.default.createElement(c.default,{as:"a",variant:"terciary",onClick:i,label:u})))},$=function(e){var t=e.crumbs,r=e.isLastItemLimited;return t.map((function(e,a){var l=e.key,i=e.path,n=e.name,c=e.childElement,u=void 0===c?null:c,d=function(e,t){return e===t-1}(a,t.length);return u?o.default.createElement(x,{key:l,hasMark:!0,isActive:d},u):o.default.createElement(x,{key:l,hasMark:!0,path:i,isActive:d,isMobile:!1,isLastItemLimited:r&&d},n)}))},w=function(e){var t=e.crumbs,r=e.scrollMobile,a=e.isLastItemLimited,l=s(e,["crumbs","scrollMobile","isLastItemLimited"]),i=t[t.length-1],n=i.name,c=i.childElement;return r?o.default.createElement(E,{scrollMobile:!0},o.default.createElement($,{crumbs:t,isLastItemLimited:a})):o.default.createElement(E,null,o.default.createElement(x,{hasMark:!0},o.default.createElement(y,d({marker:"..."},l))),c?o.default.createElement(x,{hasMark:!0,isActive:!0,isMobile:!0},c):o.default.createElement(x,{hasMark:!0,isActive:!0,isMobile:!0},n))},S=function(a){var l=a.crumbs,i=a.isLastItemLimited,n=a.scrollMobile,c=t.useMediaQuery({query:r.media.md}),u=e.useState(!1),d=u[0],s=u[1];if(e.useEffect((function(){s(!c&&l.length>1)}),[l,c]),d){return o.default.createElement(w,{crumbs:l,onClick:function(e){e.preventDefault(),s(!1)},scrollMobile:n,isLastItemLimited:i})}return o.default.createElement($,{crumbs:l,isLastItemLimited:i})};exports.BreadcrumbItem=x,exports.default=function(e){var t=e.crumbs,r=void 0===t?[]:t,l=e.homePath,i=void 0===l?"/":l,n=e.showHomeButton,c=void 0===n||n,u=e.showBackButton,d=void 0!==u&&u,s=e.onBackButtonClick,f=e.isLastItemLimited,v=void 0!==f&&f,h=e.scrollMobile,p=void 0!==h&&h,b=e.homeButtonType,E=void 0===b?"icon":b;return o.default.createElement(m,{scrollMobile:p},d&&s&&o.default.createElement(o.default.Fragment,null,o.default.createElement(g,{marker:a.faChevronLeft}),o.default.createElement(M,{onBackButtonClick:s,isActive:!(null==r?void 0:r.length)}),!!c&&o.default.createElement(g,{marker:"꣎"})),c&&"icon"===E&&o.default.createElement(k,{isActive:!(null==r?void 0:r.length),homePath:i}),c&&"text"===E&&o.default.createElement(L,{isActive:!(null==r?void 0:r.length),homePath:i}),(null==r?void 0:r.length)?o.default.createElement(S,{crumbs:r,isLastItemLimited:v,scrollMobile:p}):null)}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("react-responsive"),r=require("@cavilha/theme"),a=require("@fortawesome/pro-regular-svg-icons"),l=require("@cavilha/button"),i=require("@cavilha/icon");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(e),c=n(l),u=n(i),d=function(){return d=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var l in t=arguments[r])Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l]);return e},d.apply(this,arguments)};function s(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(a=Object.getOwnPropertySymbols(e);l<a.length;l++)t.indexOf(a[l])<0&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(r[a[l]]=e[a[l]])}return r}var m=r.styled("div",{display:"flex",flexWrap:"wrap",alignItems:"center",padding:"$small3 0",variants:{scrollMobile:{true:{flexWrap:"initial",minWidth:"max-content","@md":{flexWrap:"wrap"}}}}}),f=r.styled("div",{display:"flex",fontSize:"$bodySmall","& p":{margin:0},"& a":{textDecoration:"none",borderRadius:"$small",minWidth:"max-content","&:hover":{textDecoration:"underline"},"&:focus":{outline:"none",boxShadow:"$focusPressed"},"&:active":{outline:"none",boxShadow:"$focusPressed"}},variants:{active:{true:{color:"$neutral5","& a":{color:"$neutral5"}},false:{"& a":{color:"$secondary4"}}},isMobile:{true:{"& p":{maxWidth:"20ch",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},isLastItemLimited:{true:{"& p":{maxWidth:"300px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}}}}),v=r.styled("div",{color:"$neutral4",padding:"0 $small2"}),h=r.styled("div",{padding:"1px 2px",borderRadius:"$small",textDecoration:"none",variants:{active:{false:{"&:hover":{background:"$secondaryHover0"}}}}}),p=r.styled("div",{borderRadius:"$small",cursor:"pointer",fontSize:"$bodySmall",color:"$neutral5","& a":{textDecoration:"none",borderRadius:"$small",fontSize:"$bodySmall",fontWeight:"$bold",color:"$neutral5 !important",p:"$none","&:hover":{textDecoration:"underline",backgroundColor:"$none"}}}),b=r.styled("button",{background:"none",border:"none",borderRadius:"$small",cursor:"pointer","&:hover":{textDecoration:"underline"},"&:focus":{outline:"none",boxShadow:"$focusPressed"},"&:active":{outline:"none",boxShadow:"$focusPressed"}}),E=r.styled("div",{display:"flex",variants:{scrollMobile:{true:{overflow:"scroll",width:"100%",minWidth:"max-content"}}}}),y=function(e){var t=e.marker,r=s(e,["marker"]);return o.default.createElement(b,d({},r),t)},g=function(e){var t=e.marker,r="string"==typeof t?t:o.default.createElement(u.default,{icon:t,iconSize:14});return o.default.createElement(v,null,r)},x=function(e){var t=e.children,r=e.path,l=e.hasMark,i=void 0!==l&&l,n=e.markPosition,c=void 0===n?"left":n,u=e.isActive,d=void 0!==u&&u,s=e.isMobile,m=void 0!==s&&s,v=e.isLastItemLimited,h=void 0!==v&&v,p="left"===c&&o.default.createElement(g,{marker:a.faChevronRight}),b="right"===c&&o.default.createElement(g,{marker:a.faChevronRight});return o.default.createElement(f,{active:d,isMobile:m,isLastItemLimited:h},i&&p,function(e,t,r){return void 0===r&&(r=!1),r?o.default.createElement("p",null,e):"string"==typeof e&&t?o.default.createElement("a",{href:t},e):e}(t,r,d),i&&b)},k=function(e){var t=e.isActive,r=e.homePath;return o.default.createElement(h,{active:t},o.default.createElement(x,{isActive:t},t?o.default.createElement(u.default,{icon:a.faHomeAlt,iconSize:14}):o.default.createElement("a",{href:r},o.default.createElement(u.default,{icon:a.faHomeAlt,iconSize:14}))))},L=function(e){var t=e.isActive,r=e.homePath;return o.default.createElement(h,null,o.default.createElement(x,{isActive:t},o.default.createElement("a",{href:r,title:"Voltar a Página inicial"},"Página inicial")))},M=function(a){var l=a.isActive,i=a.onBackButtonClick,n=t.useMediaQuery({query:r.media.md}),u=e.useMemo((function(){return n?"Voltar a página anterior":"Voltar"}),[n]);return o.default.createElement(p,null,o.default.createElement(x,{isActive:l},o.default.createElement(c.default,{as:"a",variant:"terciary",onClick:i,label:u})))},$=function(e){var t=e.crumbs,r=e.isLastItemLimited;return t.map((function(e,a){var l=e.key,i=e.path,n=e.name,c=e.childElement,u=void 0===c?null:c,d=function(e,t){return e===t-1}(a,t.length);return u?o.default.createElement(x,{key:l,hasMark:!0,isActive:d},u):o.default.createElement(x,{key:l,hasMark:!0,path:i,isActive:d,isMobile:!1,isLastItemLimited:r&&d},n)}))},w=function(e){var t=e.crumbs,r=e.scrollMobile,a=e.isLastItemLimited,l=s(e,["crumbs","scrollMobile","isLastItemLimited"]),i=t[t.length-1],n=i.name,c=i.childElement;return r?o.default.createElement(E,{scrollMobile:!0},o.default.createElement($,{crumbs:t,isLastItemLimited:a})):o.default.createElement(E,null,o.default.createElement(x,{hasMark:!0},o.default.createElement(y,d({marker:"..."},l))),c?o.default.createElement(x,{hasMark:!0,isActive:!0,isMobile:!0},c):o.default.createElement(x,{hasMark:!0,isActive:!0,isMobile:!0},n))},S=function(a){var l=a.crumbs,i=a.isLastItemLimited,n=a.scrollMobile,c=t.useMediaQuery({query:r.media.md}),u=e.useState(!1),d=u[0],s=u[1];if(e.useEffect((function(){s(!c&&l.length>1)}),[l,c]),d){return o.default.createElement(w,{crumbs:l,onClick:function(e){e.preventDefault(),s(!1)},scrollMobile:n,isLastItemLimited:i})}return o.default.createElement($,{crumbs:l,isLastItemLimited:i})};exports.BreadcrumbItem=x,exports.default=function(e){var t=e.crumbs,r=void 0===t?[]:t,l=e.homePath,i=void 0===l?"/":l,n=e.showHomeButton,c=void 0===n||n,u=e.showBackButton,d=void 0!==u&&u,s=e.onBackButtonClick,f=e.isLastItemLimited,v=void 0!==f&&f,h=e.scrollMobile,p=void 0!==h&&h,b=e.homeButtonType,E=void 0===b?"icon":b;return o.default.createElement(m,{scrollMobile:p},d&&s&&o.default.createElement(o.default.Fragment,null,o.default.createElement(g,{marker:a.faChevronLeft}),o.default.createElement(M,{onBackButtonClick:s,isActive:!(null==r?void 0:r.length)}),!!c&&o.default.createElement(g,{marker:"꣎"})),c&&"icon"===E&&o.default.createElement(k,{isActive:!(null==r?void 0:r.length),homePath:i}),c&&"text"===E&&o.default.createElement(L,{isActive:!(null==r?void 0:r.length),homePath:i}),(null==r?void 0:r.length)?o.default.createElement(S,{crumbs:r,isLastItemLimited:v,scrollMobile:p}):null)}; |
@@ -1,1 +0,1 @@ | ||
import e,{useMemo as t,useState as r,useEffect as i}from"react";import{useMediaQuery as n}from"react-responsive";import{styled as o,media as a}from"@cavilha/theme";import{faChevronRight as l,faHomeAlt as c,faChevronLeft as s}from"@fortawesome/pro-regular-svg-icons";import m from"@cavilha/button";import u from"@cavilha/icon";var d=function(){return d=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},d.apply(this,arguments)};function v(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r}var f=o("div",{display:"flex",flexWrap:"wrap",alignItems:"center",padding:"$small3 0",variants:{scrollMobile:{true:{flexWrap:"initial",minWidth:"max-content","@md":{flexWrap:"wrap"}}}}}),h=o("div",{display:"flex",fontSize:"$bodySmall","& p":{margin:0},"& a":{textDecoration:"none",borderRadius:"$small","&:hover":{textDecoration:"underline"},"&:focus":{outline:"none",boxShadow:"$focusPressed"},"&:active":{outline:"none",boxShadow:"$focusPressed"}},variants:{active:{true:{color:"$neutral5","& a":{color:"$neutral5"}},false:{"& a":{color:"$secondary4"}}},isMobile:{true:{"& p":{maxWidth:"20ch",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},isLastItemLimited:{true:{"& p":{maxWidth:"300px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}}}}),p=o("div",{color:"$neutral4",padding:"0 $small2"}),b=o("div",{padding:"1px 2px",borderRadius:"$small",textDecoration:"none",variants:{active:{false:{"&:hover":{background:"$secondaryHover0"}}}}}),E=o("div",{borderRadius:"$small",cursor:"pointer",fontSize:"$bodySmall",color:"$neutral5","& a":{textDecoration:"none",borderRadius:"$small",fontSize:"$bodySmall",fontWeight:"$bold",color:"$neutral5 !important",p:"$none","&:hover":{textDecoration:"underline",backgroundColor:"$none"}}}),g=o("button",{background:"none",border:"none",borderRadius:"$small",cursor:"pointer","&:hover":{textDecoration:"underline"},"&:focus":{outline:"none",boxShadow:"$focusPressed"},"&:active":{outline:"none",boxShadow:"$focusPressed"}}),k=o("div",{display:"flex",variants:{scrollMobile:{true:{overflow:"scroll",width:"100%",minWidth:"max-content"}}}}),x=function(t){var r=t.marker,i=v(t,["marker"]);return e.createElement(g,d({},i),r)},y=function(t){var r=t.marker,i="string"==typeof r?r:e.createElement(u,{icon:r,iconSize:14});return e.createElement(p,null,i)},L=function(t){var r=t.children,i=t.path,n=t.hasMark,o=void 0!==n&&n,a=t.markPosition,c=void 0===a?"left":a,s=t.isActive,m=void 0!==s&&s,u=t.isMobile,d=void 0!==u&&u,v=t.isLastItemLimited,f=void 0!==v&&v,p="left"===c&&e.createElement(y,{marker:l}),b="right"===c&&e.createElement(y,{marker:l});return e.createElement(h,{active:m,isMobile:d,isLastItemLimited:f},o&&p,function(t,r,i){return void 0===i&&(i=!1),i?e.createElement("p",null,t):"string"==typeof t&&r?e.createElement("a",{href:r},t):t}(r,i,m),o&&b)},$=function(t){var r=t.isActive,i=t.homePath;return e.createElement(b,{active:r},e.createElement(L,{isActive:r},r?e.createElement(u,{icon:c,iconSize:14}):e.createElement("a",{href:i},e.createElement(u,{icon:c,iconSize:14}))))},w=function(t){var r=t.isActive,i=t.homePath;return e.createElement(b,null,e.createElement(L,{isActive:r},e.createElement("a",{href:i,title:"Voltar a Página inicial"},"Página inicial")))},M=function(r){var i=r.isActive,o=r.onBackButtonClick,l=n({query:a.md}),c=t((function(){return l?"Voltar a página anterior":"Voltar"}),[l]);return e.createElement(E,null,e.createElement(L,{isActive:i},e.createElement(m,{as:"a",variant:"terciary",onClick:o,label:c})))},S=function(t){var r=t.crumbs,i=t.isLastItemLimited;return r.map((function(t,n){var o=t.key,a=t.path,l=t.name,c=t.childElement,s=void 0===c?null:c,m=function(e,t){return e===t-1}(n,r.length);return s?e.createElement(L,{key:o,hasMark:!0,isActive:m},s):e.createElement(L,{key:o,hasMark:!0,path:a,isActive:m,isMobile:!1,isLastItemLimited:i&&m},l)}))},P=function(t){var r=t.crumbs,i=t.scrollMobile,n=t.isLastItemLimited,o=v(t,["crumbs","scrollMobile","isLastItemLimited"]),a=r[r.length-1],l=a.name,c=a.childElement;return i?e.createElement(k,{scrollMobile:!0},e.createElement(S,{crumbs:r,isLastItemLimited:n})):e.createElement(k,null,e.createElement(L,{hasMark:!0},e.createElement(x,d({marker:"..."},o))),c?e.createElement(L,{hasMark:!0,isActive:!0,isMobile:!0},c):e.createElement(L,{hasMark:!0,isActive:!0,isMobile:!0},l))},I=function(t){var o=t.crumbs,l=t.isLastItemLimited,c=t.scrollMobile,s=n({query:a.md}),m=r(!1),u=m[0],d=m[1];if(i((function(){d(!s&&o.length>1)}),[o,s]),u){return e.createElement(P,{crumbs:o,onClick:function(e){e.preventDefault(),d(!1)},scrollMobile:c,isLastItemLimited:l})}return e.createElement(S,{crumbs:o,isLastItemLimited:l})},A=function(t){var r=t.crumbs,i=void 0===r?[]:r,n=t.homePath,o=void 0===n?"/":n,a=t.showHomeButton,l=void 0===a||a,c=t.showBackButton,m=void 0!==c&&c,u=t.onBackButtonClick,d=t.isLastItemLimited,v=void 0!==d&&d,h=t.scrollMobile,p=void 0!==h&&h,b=t.homeButtonType,E=void 0===b?"icon":b;return e.createElement(f,{scrollMobile:p},m&&u&&e.createElement(e.Fragment,null,e.createElement(y,{marker:s}),e.createElement(M,{onBackButtonClick:u,isActive:!(null==i?void 0:i.length)}),!!l&&e.createElement(y,{marker:"꣎"})),l&&"icon"===E&&e.createElement($,{isActive:!(null==i?void 0:i.length),homePath:o}),l&&"text"===E&&e.createElement(w,{isActive:!(null==i?void 0:i.length),homePath:o}),(null==i?void 0:i.length)?e.createElement(I,{crumbs:i,isLastItemLimited:v,scrollMobile:p}):null)};export{L as BreadcrumbItem,A as default}; | ||
import e,{useMemo as t,useState as r,useEffect as i}from"react";import{useMediaQuery as n}from"react-responsive";import{styled as o,media as a}from"@cavilha/theme";import{faChevronRight as l,faHomeAlt as c,faChevronLeft as m}from"@fortawesome/pro-regular-svg-icons";import s from"@cavilha/button";import u from"@cavilha/icon";var d=function(){return d=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},d.apply(this,arguments)};function v(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r}var f=o("div",{display:"flex",flexWrap:"wrap",alignItems:"center",padding:"$small3 0",variants:{scrollMobile:{true:{flexWrap:"initial",minWidth:"max-content","@md":{flexWrap:"wrap"}}}}}),h=o("div",{display:"flex",fontSize:"$bodySmall","& p":{margin:0},"& a":{textDecoration:"none",borderRadius:"$small",minWidth:"max-content","&:hover":{textDecoration:"underline"},"&:focus":{outline:"none",boxShadow:"$focusPressed"},"&:active":{outline:"none",boxShadow:"$focusPressed"}},variants:{active:{true:{color:"$neutral5","& a":{color:"$neutral5"}},false:{"& a":{color:"$secondary4"}}},isMobile:{true:{"& p":{maxWidth:"20ch",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},isLastItemLimited:{true:{"& p":{maxWidth:"300px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}}}}),p=o("div",{color:"$neutral4",padding:"0 $small2"}),b=o("div",{padding:"1px 2px",borderRadius:"$small",textDecoration:"none",variants:{active:{false:{"&:hover":{background:"$secondaryHover0"}}}}}),E=o("div",{borderRadius:"$small",cursor:"pointer",fontSize:"$bodySmall",color:"$neutral5","& a":{textDecoration:"none",borderRadius:"$small",fontSize:"$bodySmall",fontWeight:"$bold",color:"$neutral5 !important",p:"$none","&:hover":{textDecoration:"underline",backgroundColor:"$none"}}}),g=o("button",{background:"none",border:"none",borderRadius:"$small",cursor:"pointer","&:hover":{textDecoration:"underline"},"&:focus":{outline:"none",boxShadow:"$focusPressed"},"&:active":{outline:"none",boxShadow:"$focusPressed"}}),k=o("div",{display:"flex",variants:{scrollMobile:{true:{overflow:"scroll",width:"100%",minWidth:"max-content"}}}}),x=function(t){var r=t.marker,i=v(t,["marker"]);return e.createElement(g,d({},i),r)},y=function(t){var r=t.marker,i="string"==typeof r?r:e.createElement(u,{icon:r,iconSize:14});return e.createElement(p,null,i)},L=function(t){var r=t.children,i=t.path,n=t.hasMark,o=void 0!==n&&n,a=t.markPosition,c=void 0===a?"left":a,m=t.isActive,s=void 0!==m&&m,u=t.isMobile,d=void 0!==u&&u,v=t.isLastItemLimited,f=void 0!==v&&v,p="left"===c&&e.createElement(y,{marker:l}),b="right"===c&&e.createElement(y,{marker:l});return e.createElement(h,{active:s,isMobile:d,isLastItemLimited:f},o&&p,function(t,r,i){return void 0===i&&(i=!1),i?e.createElement("p",null,t):"string"==typeof t&&r?e.createElement("a",{href:r},t):t}(r,i,s),o&&b)},$=function(t){var r=t.isActive,i=t.homePath;return e.createElement(b,{active:r},e.createElement(L,{isActive:r},r?e.createElement(u,{icon:c,iconSize:14}):e.createElement("a",{href:i},e.createElement(u,{icon:c,iconSize:14}))))},w=function(t){var r=t.isActive,i=t.homePath;return e.createElement(b,null,e.createElement(L,{isActive:r},e.createElement("a",{href:i,title:"Voltar a Página inicial"},"Página inicial")))},M=function(r){var i=r.isActive,o=r.onBackButtonClick,l=n({query:a.md}),c=t((function(){return l?"Voltar a página anterior":"Voltar"}),[l]);return e.createElement(E,null,e.createElement(L,{isActive:i},e.createElement(s,{as:"a",variant:"terciary",onClick:o,label:c})))},S=function(t){var r=t.crumbs,i=t.isLastItemLimited;return r.map((function(t,n){var o=t.key,a=t.path,l=t.name,c=t.childElement,m=void 0===c?null:c,s=function(e,t){return e===t-1}(n,r.length);return m?e.createElement(L,{key:o,hasMark:!0,isActive:s},m):e.createElement(L,{key:o,hasMark:!0,path:a,isActive:s,isMobile:!1,isLastItemLimited:i&&s},l)}))},P=function(t){var r=t.crumbs,i=t.scrollMobile,n=t.isLastItemLimited,o=v(t,["crumbs","scrollMobile","isLastItemLimited"]),a=r[r.length-1],l=a.name,c=a.childElement;return i?e.createElement(k,{scrollMobile:!0},e.createElement(S,{crumbs:r,isLastItemLimited:n})):e.createElement(k,null,e.createElement(L,{hasMark:!0},e.createElement(x,d({marker:"..."},o))),c?e.createElement(L,{hasMark:!0,isActive:!0,isMobile:!0},c):e.createElement(L,{hasMark:!0,isActive:!0,isMobile:!0},l))},I=function(t){var o=t.crumbs,l=t.isLastItemLimited,c=t.scrollMobile,m=n({query:a.md}),s=r(!1),u=s[0],d=s[1];if(i((function(){d(!m&&o.length>1)}),[o,m]),u){return e.createElement(P,{crumbs:o,onClick:function(e){e.preventDefault(),d(!1)},scrollMobile:c,isLastItemLimited:l})}return e.createElement(S,{crumbs:o,isLastItemLimited:l})},A=function(t){var r=t.crumbs,i=void 0===r?[]:r,n=t.homePath,o=void 0===n?"/":n,a=t.showHomeButton,l=void 0===a||a,c=t.showBackButton,s=void 0!==c&&c,u=t.onBackButtonClick,d=t.isLastItemLimited,v=void 0!==d&&d,h=t.scrollMobile,p=void 0!==h&&h,b=t.homeButtonType,E=void 0===b?"icon":b;return e.createElement(f,{scrollMobile:p},s&&u&&e.createElement(e.Fragment,null,e.createElement(y,{marker:m}),e.createElement(M,{onBackButtonClick:u,isActive:!(null==i?void 0:i.length)}),!!l&&e.createElement(y,{marker:"꣎"})),l&&"icon"===E&&e.createElement($,{isActive:!(null==i?void 0:i.length),homePath:o}),l&&"text"===E&&e.createElement(w,{isActive:!(null==i?void 0:i.length),homePath:o}),(null==i?void 0:i.length)?e.createElement(I,{crumbs:i,isLastItemLimited:v,scrollMobile:p}):null)};export{L as BreadcrumbItem,A as default}; |
{ | ||
"name": "@cavilha/breadcrumb", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"author": "MadeiraMadeira webstore squads", | ||
@@ -5,0 +5,0 @@ "description": "A component responsible for navigating the user in a visual way.", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67487