@snowball-tech/fractal
Version:
Fractal's (Snowball's design system) React component library based on RadixUI and TailwindCSS
2 lines • 1.52 kB
JavaScript
"use client";import{a as e}from"../constants-CW2-utNH.js";import{r as t}from"../helpers-DBEwVIlX.js";import{Typography as n}from"../Typography/Typography.js";import{r}from"../utils-K22C_6qC.js";import{GROUP_NAME as i}from"./Select.constants.js";import{SelectContext as a}from"./SelectContext.js";import{SelectGroupContext as o}from"./SelectGroupContext.js";import{useContext as s}from"react";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*as p from"@radix-ui/react-select";const m=({children:m,disabled:h=!1,label:g,labelElement:_,rainbow:v=!0,value:y,...b})=>{let x=!!m;!x&&!g&&console.warn("You must provide a `label` or `children` to the `SelectItem` component");let{disabled:S,rainbow:C}=s(o),{disabled:w,rainbow:T}=s(a),E=h||S||w,D=v&&C&&T,O=l(g)?g:c(g)?r(m):r(g);return f(p.Item,{"aria-label":O,className:t(`${e}-${i}__item`,D?`alternatee`:``,`flex select-none items-center gap-1 rounded-sm p-2 outline-none transition-background-color duration-300 ease-out`,E?`${e}-${i}__item--disabled cursor-not-allowed !bg-transparent text-disabled`:`cursor-pointer text-dark`,!E&&!D?`hover:bg-decorative-pink-90`:``,b.className),disabled:E,title:O,value:y,...u([`className`],b),children:[d(p.ItemText,{asChild:!0,children:d(n,{element:_||(l(x?m:g)?void 0:`div`),children:x?m:g})}),d(p.ItemIndicator,{})]})};m.displayName=`SelectItem`;export{m as SelectItem,m as default};
//# sourceMappingURL=SelectItem.js.map