UNPKG

@snowball-tech/fractal

Version:

Fractal's (Snowball's design system) React component library based on RadixUI and TailwindCSS

2 lines 1.63 kB
"use client";import{a as e}from"../constants-CW2-utNH.js";import{n as t,r as n}from"../helpers-DBEwVIlX.js";import{Typography as r}from"../Typography/Typography.js";import{r as i}from"../utils-K22C_6qC.js";import{GROUP_NAME as a}from"./Autocomplete.constants.js";import{Loader as o}from"../Loader/Loader.js";import*as s from"@radix-ui/react-dropdown-menu";import c from"lodash/fp/isEmpty.js";import l from"lodash/fp/isString.js";import u from"lodash/fp/omit.js";import{jsx as d,jsxs as f}from"react/jsx-runtime";import p from"lodash/fp/isBoolean.js";const m=({children:m,icon:h=!0,label:g,spin:_=!0,...v})=>{let y=!!m;!y&&!g&&console.warn("You must provide a `label` or `children` to the `AutocompleteLoading` component");let b=l(g)?g:c(g)?i(m):i(g);return f(s.Item,{className:n(`${e}-${a}__loading`,`flex items-center gap-2 rounded-sm p-2 outline-none`,h?`${e}-${a}__loadingwith-icon`:``,_&&h!==!0?`${e}-${a}__loading--spinning`:``,v.className),onSelect:e=>e.preventDefault(),...u([`className`,`disabled`,`onSelect`],v),"aria-label":b,title:b,children:[h&&f(`div`,{className:t(`fractal-autocomplete__loading__icon`,`flex items-center justify-center`,p(h)?`fractal-autocomplete__loading__icon--loader`:`fractal-autocomplete__loading__icon--icon min-w-3 [&>svg]:min-w-3`,_&&!p(h)?`fractal-autocomplete__loading__icon--icon--spinning [&>svg]:animate-spin`:``),children:[`\xA0`,p(h)?d(o,{size:`s`}):h]}),d(r,{className:t(`${e}-${a}__loading__label`,`w-full flex-1`),element:`div`,children:y?m:g})]})};m.displayName=`AutocompleteLoading`;export{m as AutocompleteLoading,m as default}; //# sourceMappingURL=AutocompleteLoading.js.map