@commercetools/nimbus 0.0.9-rc2 → 0.0.9-rc4
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/dist/{index.cjs.js → index.cjs} +1 -1
- package/dist/index.cjs.map +1 -0
- package/dist/{setup-jsdom-polyfills.cjs.js → setup-jsdom-polyfills.cjs} +1 -1
- package/dist/setup-jsdom-polyfills.cjs.map +1 -0
- package/package.json +3 -4
- package/dist/index.cjs.js.map +0 -1
- package/dist/setup-jsdom-polyfills.cjs.js.map +0 -1
|
@@ -40,4 +40,4 @@
|
|
|
40
40
|
</g>
|
|
41
41
|
</svg>
|
|
42
42
|
`)}")`,backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"200 200",width:"400",height:"400"}},variants:{size:{sm:{minH:800,textStyle:"sm",px:300,py:100},md:{minH:1e3,textStyle:"md",px:400,py:200}},variant:{solid:{"--border-width":"sizes.25","--border-color":"colors.neutral.7",backgroundColor:"neutral.1",_hover:{backgroundColor:"primary.2"}},ghost:{_hover:{backgroundColor:"primary.2"}}}},defaultVariants:{size:"md",variant:"solid"}}),{withContext:u6}=T.createRecipeContext({recipe:_h}),s6=u6("textarea"),Uh=e=>{const{ref:t,rows:n=1,autoGrow:r=!1,...o}=e,i=T.useRecipe({recipe:_h}),l=u.useRef(null),a=me(T.mergeRefs(l,t)),[s,d]=i.splitVariantProps(o),[f,c]=Ne(d),{inputProps:p}=_n(c,a),m=u.useCallback(()=>{const b=a.current;if(!b||!r)return;b.style.height="auto";const $=b.scrollHeight,g=window.getComputedStyle(b),D=parseInt(g.maxHeight),w=D?Math.min($,D):$;b.style.height=`${w}px`},[r,a]);return u.useEffect(()=>{const b=a.current;if(!b||!r)return;m();const v=()=>{m()};return b.addEventListener("input",v),()=>{b.removeEventListener("input",v)}},[m,r,a]),y.jsx(s6,{...s,...f,asChild:!0,children:y.jsx(A1,{ref:a,rows:n,...p})})};Uh.displayName="MultilineTextInput";const{withProvider:d6,withContext:c6}=T.createSlotRecipeContext({key:"radioInput"}),f6=d6("div","root"),p6=c6("span","option"),Rl=e=>{const t=T.useSlotRecipe({recipe:hl}),[n,r]=t.splitVariantProps(e),[o,i]=Ne(r);return y.jsx(f6,{...n,...o,asChild:!0,children:y.jsx(s5,{...i,children:e.children})})};Rl.displayName="RadioInputRoot";const Il=({children:e,value:t,...n})=>{const[r,o]=Ne(n),{isFocused:i,focusProps:l}=Se();return y.jsx(p6,{...r,...l,"data-focus":i||void 0,asChild:!0,children:y.jsx(d5,{value:t,...o,children:a=>{const s=typeof e=="function"?e({...a}):e;return y.jsxs(y.Fragment,{children:[a.isSelected?y.jsx(ie.RadioButtonChecked,{}):y.jsx(ie.RadioButtonUnchecked,{}),s]})}})})};Il.displayName="RadioInputOption";const m6={Root:Rl,Option:Il},{withProvider:b6,withContext:Ml}=T.createSlotRecipeContext({key:"switch"}),h6=b6("label","root"),v6=Ml("span","label"),$6=Ml("span","track"),g6=Ml("span","thumb"),Wh=({ref:e,...t})=>{const n=u.useRef(null),r=me(e?T.mergeRefs(n,e):n),o=T.useSlotRecipe({recipe:vh}),[i,l]=o.splitVariantProps(t),[a,s]=Ne(l),d=Wi(t),{inputProps:f}=yy(s,d,r),{isFocused:c,focusProps:p}=Se(),m={"data-selected":d.isSelected,"data-invalid":t.isInvalid,"data-disabled":t.isDisabled,"data-focus":c||void 0};return y.jsxs(h6,{"data-slot":"root",...i,...m,...a,children:[y.jsxs($6,{"data-slot":"track",...m,children:[y.jsx(g6,{"data-slot":"thumb",...m}),y.jsx(mo,{as:"span",children:y.jsx("input",{"data-slot":"input",...z(f,p),ref:r})})]}),t.children&&y.jsx(v6,{"data-slot":"label",...m,children:t.children})]})};Wh.displayName="Switch";const{withProvider:y6,withContext:Gh}=T.createSlotRecipeContext({key:"taggroup"}),x6=y6(v5,"root"),C6=e=>{const{ref:t,...n}=e,r=Gh(g5,"tagList");return y.jsx(r,{...n,ref:t})},D6=Gh(x5,"tag"),qh=({children:e,onRemove:t,selectionMode:n,ref:r,...o})=>(t&&(n==="multiple"||n==="single")&&console.warn('Nimbus TagGroup: when "selectionMode" is "single" or "mutiple", Tags cannot be removed'),y.jsx(x6,{ref:r,onRemove:t,selectionMode:n,...o,children:e}));qh.displayName="TagGroup.Root";const Zh=({children:e,ref:t,...n})=>y.jsx(C6,{ref:t,...n,children:e});Zh.displayName="TagGroup.TagList";const Yh=({children:e,ref:t,...n})=>{const r=typeof e=="string"?e:void 0;return y.jsx(D6,{ref:t,textValue:r,...n,children:({allowsRemoving:o,isSelected:i,selectionMode:l})=>y.jsxs(y.Fragment,{children:[e,o&&l!=="multiple"&&l!=="single"&&y.jsx(Qe,{size:"2xs",variant:i?"solid":"ghost",slot:"remove",tone:i?void 0:"neutral",children:y.jsx(ie.Close,{})})]})})};Yh.displayName="TagGroup.Tag";const Er={Root:qh,TagList:Zh,Tag:Yh};var wu,Su,ku,Bu;const E6=T.defineSlotRecipe({slots:["root","button"],className:"nimbus-toggle-button-group",base:{root:{display:"inline-flex"},button:{...Mt.base,...(wu=Mt.variants)==null?void 0:wu.variant.outline,borderRadius:"0",borderRightWidth:"0","&:first-of-type":{borderLeftRadius:"200"},"&:last-of-type":{borderRightWidth:"1px",borderRightRadius:"200"},"&[data-selected=true]":(Su=Mt.variants)==null?void 0:Su.variant.solid}},variants:{size:{xs:{button:(ku=Mt.variants)==null?void 0:ku.size.xs},md:{button:(Bu=Mt.variants)==null?void 0:Bu.size.md}},tone:{primary:{button:{colorPalette:"primary"}},critical:{button:{colorPalette:"critical"}},neutral:{button:{colorPalette:"neutral"}}}},defaultVariants:{size:"md"}}),{withContext:P6,withProvider:w6}=T.createSlotRecipeContext({recipe:E6}),S6=w6(D5,"root"),k6=P6(P5,"button"),Ll=e=>{const{ref:t,children:n,...r}=e;return y.jsx(S6,{ref:t,...r,children:n})};Ll.displayName="ToggleButtonGroup.Root";const Nl=e=>{const{ref:t,children:n,...r}=e;return y.jsx(k6,{...r,ref:t,children:n})};Nl.displayName="ToggleButtonGroup.Button";const B6={Root:Ll,Button:Nl};function Ci(){return Ci=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ci.apply(null,arguments)}var Jh=["shift","alt","meta","mod","ctrl"],T6={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function xt(e){return(e&&T6[e]||e||"").trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function A6(e){return Jh.includes(e)}function Wo(e,t){return t===void 0&&(t=","),e.split(t)}function Go(e,t,n){t===void 0&&(t="+");var r=e.toLocaleLowerCase().split(t).map(function(l){return xt(l)}),o={alt:r.includes("alt"),ctrl:r.includes("ctrl")||r.includes("control"),shift:r.includes("shift"),meta:r.includes("meta"),mod:r.includes("mod")},i=r.filter(function(l){return!Jh.includes(l)});return Ci({},o,{keys:i,description:n,hotkey:e})}(function(){typeof document<"u"&&(document.addEventListener("keydown",function(e){e.key!==void 0&&Xh([xt(e.key),xt(e.code)])}),document.addEventListener("keyup",function(e){e.key!==void 0&&Qh([xt(e.key),xt(e.code)])})),typeof window<"u"&&window.addEventListener("blur",function(){Ct.clear()})})();var Ct=new Set;function Kl(e){return Array.isArray(e)}function F6(e,t){t===void 0&&(t=",");var n=Kl(e)?e:e.split(t);return n.every(function(r){return Ct.has(r.trim().toLowerCase())})}function Xh(e){var t=Array.isArray(e)?e:[e];Ct.has("meta")&&Ct.forEach(function(n){return!A6(n)&&Ct.delete(n.toLowerCase())}),t.forEach(function(n){return Ct.add(n.toLowerCase())})}function Qh(e){var t=Array.isArray(e)?e:[e];e==="meta"?Ct.clear():t.forEach(function(n){return Ct.delete(n.toLowerCase())})}function R6(e,t,n){(typeof n=="function"&&n(e,t)||n===!0)&&e.preventDefault()}function I6(e,t,n){return typeof n=="function"?n(e,t):n===!0||n===void 0}function M6(e){return ev(e,["input","textarea","select"])}function ev(e,t){t===void 0&&(t=!1);var n=e.target,r=e.composed,o=null;return L6(n)&&r?o=e.composedPath()[0]&&e.composedPath()[0].tagName:o=n&&n.tagName,Kl(t)?!!(o&&t&&t.some(function(i){var l;return i.toLowerCase()===((l=o)==null?void 0:l.toLowerCase())})):!!(o&&t&&t)}function L6(e){return!!e.tagName&&!e.tagName.startsWith("-")&&e.tagName.includes("-")}function N6(e,t){return e.length===0&&t?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):t?e.some(function(n){return t.includes(n)})||e.includes("*"):!0}var K6=function(t,n,r){r===void 0&&(r=!1);var o=n.alt,i=n.meta,l=n.mod,a=n.shift,s=n.ctrl,d=n.keys,f=t.key,c=t.code,p=t.ctrlKey,m=t.metaKey,b=t.shiftKey,v=t.altKey,$=xt(c),g=f.toLowerCase();if(!(d!=null&&d.includes($))&&!(d!=null&&d.includes(g))&&!["ctrl","control","unknown","meta","alt","shift","os"].includes($))return!1;if(!r){if(o===!v&&g!=="alt"||a===!b&&g!=="shift")return!1;if(l){if(!m&&!p)return!1}else if(i===!m&&g!=="meta"&&g!=="os"||s===!p&&g!=="ctrl"&&g!=="control")return!1}return d&&d.length===1&&(d.includes(g)||d.includes($))?!0:d?F6(d):!d},V6=u.createContext(void 0),O6=function(){return u.useContext(V6)};function tv(e,t){return e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce(function(n,r){return n&&tv(e[r],t[r])},!0):e===t}var z6=u.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),j6=function(){return u.useContext(z6)};function H6(e){var t=u.useRef(void 0);return tv(t.current,e)||(t.current=e),t.current}var mu=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},_6=typeof window<"u"?u.useLayoutEffect:u.useEffect;function U6(e,t,n,r){var o=u.useState(null),i=o[0],l=o[1],a=u.useRef(!1),s=n instanceof Array?r instanceof Array?void 0:r:n,d=Kl(e)?e.join(s==null?void 0:s.splitKey):e,f=n instanceof Array?n:r instanceof Array?r:void 0,c=u.useCallback(t,f??[]),p=u.useRef(c);f?p.current=c:p.current=t;var m=H6(s),b=j6(),v=b.enabledScopes,$=O6();return _6(function(){if(!((m==null?void 0:m.enabled)===!1||!N6(v,m==null?void 0:m.scopes))){var g=function(P,L){var I;if(L===void 0&&(L=!1),!(M6(P)&&!ev(P,m==null?void 0:m.enableOnFormTags))){if(i!==null){var V=i.getRootNode();if((V instanceof Document||V instanceof ShadowRoot)&&V.activeElement!==i&&!i.contains(V.activeElement)){mu(P);return}}(I=P.target)!=null&&I.isContentEditable&&!(m!=null&&m.enableOnContentEditable)||Wo(d,m==null?void 0:m.splitKey).forEach(function(A){var h,S=Go(A,m==null?void 0:m.combinationKey);if(K6(P,S,m==null?void 0:m.ignoreModifiers)||(h=S.keys)!=null&&h.includes("*")){if(m!=null&&m.ignoreEventWhen!=null&&m.ignoreEventWhen(P)||L&&a.current)return;if(R6(P,S,m==null?void 0:m.preventDefault),!I6(P,S,m==null?void 0:m.enabled)){mu(P);return}p.current(P,S),L||(a.current=!0)}})}},D=function(P){P.key!==void 0&&(Xh(xt(P.code)),((m==null?void 0:m.keydown)===void 0&&(m==null?void 0:m.keyup)!==!0||m!=null&&m.keydown)&&g(P))},w=function(P){P.key!==void 0&&(Qh(xt(P.code)),a.current=!1,m!=null&&m.keyup&&g(P,!0))},B=i||(s==null?void 0:s.document)||document;return B.addEventListener("keyup",w,s==null?void 0:s.eventListenerOptions),B.addEventListener("keydown",D,s==null?void 0:s.eventListenerOptions),$&&Wo(d,m==null?void 0:m.splitKey).forEach(function(k){return $.addHotkey(Go(k,m==null?void 0:m.combinationKey,m==null?void 0:m.description))}),function(){B.removeEventListener("keyup",w,s==null?void 0:s.eventListenerOptions),B.removeEventListener("keydown",D,s==null?void 0:s.eventListenerOptions),$&&Wo(d,m==null?void 0:m.splitKey).forEach(function(k){return $.removeHotkey(Go(k,m==null?void 0:m.combinationKey,m==null?void 0:m.description))})}}},[i,d,m,v]),l}function W6(){var e=u.useRef(!1),t=u.useCallback(function(){return e.current},[]);return u.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),t}var G6=function(e){e===void 0&&(e={});var t=u.useState(e),n=t[0],r=t[1],o=u.useCallback(function(i){r(function(l){return Object.assign({},l,i instanceof Function?i(l):i)})},[]);return[n,o]},qo,bu;function q6(){return bu||(bu=1,qo=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null;break}return e.removeAllRanges(),function(){e.type==="Caret"&&e.removeAllRanges(),e.rangeCount||n.forEach(function(o){e.addRange(o)}),t&&t.focus()}}),qo}var Zo,hu;function Z6(){if(hu)return Zo;hu=1;var e=q6(),t={"text/plain":"Text","text/html":"Url",default:"Text"},n="Copy to clipboard: #{key}, Enter";function r(i){var l=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return i.replace(/#{\s*key\s*}/g,l)}function o(i,l){var a,s,d,f,c,p,m=!1;l||(l={}),a=l.debug||!1;try{d=e(),f=document.createRange(),c=document.getSelection(),p=document.createElement("span"),p.textContent=i,p.ariaHidden="true",p.style.all="unset",p.style.position="fixed",p.style.top=0,p.style.clip="rect(0, 0, 0, 0)",p.style.whiteSpace="pre",p.style.webkitUserSelect="text",p.style.MozUserSelect="text",p.style.msUserSelect="text",p.style.userSelect="text",p.addEventListener("copy",function(v){if(v.stopPropagation(),l.format)if(v.preventDefault(),typeof v.clipboardData>"u"){a&&console.warn("unable to use e.clipboardData"),a&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var $=t[l.format]||t.default;window.clipboardData.setData($,i)}else v.clipboardData.clearData(),v.clipboardData.setData(l.format,i);l.onCopy&&(v.preventDefault(),l.onCopy(v.clipboardData))}),document.body.appendChild(p),f.selectNodeContents(p),c.addRange(f);var b=document.execCommand("copy");if(!b)throw new Error("copy command was unsuccessful");m=!0}catch(v){a&&console.error("unable to copy using execCommand: ",v),a&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(l.format||"text",i),l.onCopy&&l.onCopy(window.clipboardData),m=!0}catch($){a&&console.error("unable to copy using clipboardData: ",$),a&&console.error("falling back to prompt"),s=r("message"in l?l.message:n),window.prompt(s,i)}}finally{c&&(typeof c.removeRange=="function"?c.removeRange(f):c.removeAllRanges()),p&&document.body.removeChild(p),d()}return m}return Zo=o,Zo}var Y6=Z6();const J6=sy(Y6);var X6=function(){var e=W6(),t=G6({value:void 0,error:void 0,noUserInteraction:!0}),n=t[0],r=t[1],o=u.useCallback(function(i){if(e()){var l,a;try{if(typeof i!="string"&&typeof i!="number"){var s=new Error("Cannot copy typeof "+typeof i+" to clipboard, must be a string");process.env.NODE_ENV==="development"&&console.error(s),r({value:i,error:s,noUserInteraction:!0});return}else if(i===""){var s=new Error("Cannot copy empty string to clipboard.");process.env.NODE_ENV==="development"&&console.error(s),r({value:i,error:s,noUserInteraction:!0});return}a=i.toString(),l=J6(a),r({value:a,error:void 0,noUserInteraction:l})}catch(d){r({value:a,error:d,noUserInteraction:l})}}},[]);return[n,o]};Object.defineProperty(exports,"Flex",{enumerable:!0,get:()=>T.Flex});Object.defineProperty(exports,"Heading",{enumerable:!0,get:()=>T.Heading});Object.defineProperty(exports,"Table",{enumerable:!0,get:()=>T.Table});exports.Accordion=g2;exports.Alert=B2;exports.Avatar=Au;exports.Badge=Th;exports.Box=we;exports.Button=Ji;exports.Card=K2;exports.Checkbox=xh;exports.Code=Ay;exports.ComboBox=L5;exports.Dialog=K5;exports.FormField=Z2;exports.Grid=o2;exports.Icon=Kh;exports.IconButton=Qe;exports.Image=ih;exports.Kbd=V5;exports.Link=ah;exports.List=j5;exports.LoadingSpinner=Vh;exports.MakeElementFocusable=mh;exports.MultilineTextInput=Uh;exports.NimbusProvider=Wx;exports.NumberInput=Ch;exports.PasswordInput=Oh;exports.RadioInput=m6;exports.Select=f2;exports.SimpleGrid=H5;exports.Stack=po;exports.Switch=Wh;exports.TagGroup=Er;exports.Text=fh;exports.TextInput=vl;exports.TimeInput=Hh;exports.ToggleButtonGroup=B6;exports.Tooltip=xi;exports.VisuallyHidden=mo;exports._AccordionContent=kh;exports._AccordionHeader=Sh;exports._AccordionHeaderRightContent=jr;exports._AccordionItem=Bh;exports._AccordionRoot=wh;exports._AlertActions=Sl;exports._AlertDescription=wl;exports._AlertDismissButton=kl;exports._AlertRoot=El;exports._AlertTitle=Pl;exports._CardContent=Fl;exports._CardHeader=Al;exports._CardRoot=Tl;exports._ComboBoxOption=cl;exports._ComboBoxOptionGroup=dl;exports._ComboBoxRoot=sl;exports._FormFieldDescription=Mh;exports._FormFieldError=Lh;exports._FormFieldInfoBox=Nh;exports._FormFieldInput=Ih;exports._FormFieldLabel=Rh;exports._FormFieldRoot=Fh;exports._ListIndicator=dh;exports._ListItem=sh;exports._ListRoot=uh;exports._RadioInputOption=Il;exports._RadioInputRoot=Rl;exports._SelectOption=xl;exports._SelectOptionGroup=Cl;exports._SelectOptions=yl;exports._SelectRoot=gl;exports._ToggleButtonGroupButton=Nl;exports._ToggleButtonGroupRoot=Ll;exports._TooltipContent=pl;exports._TooltipRoot=fl;exports.system=gh;exports.useColorMode=hh;exports.useColorModeValue=rx;exports.useColorScheme=Ux;exports.useCopyToClipboard=X6;exports.useHotkeys=U6;
|
|
43
|
-
//# sourceMappingURL=index.cjs.
|
|
43
|
+
//# sourceMappingURL=index.cjs.map
|