UNPKG

@ebay/ui-core-react

Version:

Skin components build off React

2 lines (1 loc) 1.42 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("../tslib.es6-C4EgNkz1.js"),e=require("react"),m=require("classnames"),c=require("../notice-content-C0ZStfuX.js"),f=require("../notice-content-9iF4T8uB.js"),E=require("../utils-C9NL3q0j.js"),N=require("../icons/ebay-icon-attention-filled-16/index.js"),I=require("../icons/ebay-icon-confirmation-filled-16/index.js"),h=require("../icons/ebay-icon-information-filled-16/index.js"),C={attention:N.EbayIconAttentionFilled16,confirmation:I.EbayIconConfirmationFilled16,information:h.EbayIconInformationFilled16},q=o=>{var{className:r,status:n="general",children:l,hidden:t=!1,"aria-label":s,onNoticeShow:b=()=>{}}=o,u=y.__rest(o,["className","status","children","hidden","aria-label","onNoticeShow"]);if(e.useEffect(()=>{t||b()},[t]),t)return null;const a=E.findComponent(l,c.EbayNoticeContent);if(!a)throw new Error("EbayInlineNotice: Please use a EbayNoticeContent that defines the content of the notice");const i=n==="general",d=i?null:C[n];return e.createElement("div",Object.assign({},u,{className:m(r,"inline-notice",{[`inline-notice--${n}`]:!i})}),i?null:e.createElement("span",{className:"inline-notice__header"},e.createElement(d,{a11yText:s,a11yVariant:"label"})),e.createElement(f.NoticeContent,Object.assign({},a.props,{type:"inline"})))};exports.EbayNoticeContent=c.EbayNoticeContent;exports.EbayInlineNotice=q;