UNPKG

@szum-tech/design-system

Version:

Szum-Tech design system with tailwindcss support

1 lines 4.01 kB
import {a as a$1}from'./chunk-XKHU627O.js';import {a as a$2}from'./chunk-ZGZS5I45.js';import {a}from'./chunk-JUNHRB4B.js';import {cva}from'class-variance-authority';import {jsx,jsxs}from'react/jsx-runtime';import*as f from'react';var n=cva("group/field flex w-full gap-2 data-[invalid=true]:text-error",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});function S({className:t,orientation:e="vertical",...a$1}){return jsx("div",{role:"group","data-slot":"field","data-orientation":e,className:a(n({orientation:e}),t),...a$1})}function T({className:t,...e}){return jsx("div",{"data-slot":"field-content",className:a("group/field-content flex flex-1 flex-col gap-0.5 leading-snug",t),...e})}function q({className:t,...e}){return jsx("p",{"data-slot":"field-description",className:a("text-muted-foreground text-left text-sm leading-normal font-normal group-has-data-[orientation=horizontal]/field:text-balance [[data-variant=legend]+&]:-mt-1.5","last:mt-0 nth-last-2:-mt-1","[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",t),...e})}function I({className:t,children:e,errors:a$1,...c}){let p=f.useMemo(()=>{if(e)return e;if(!a$1?.length)return null;let l=[...new Map(a$1.map(r=>[r?.message,r])).values()];return l?.length==1?l[0]?.message:jsx("ul",{className:"ml-4 flex list-disc flex-col gap-1",children:l.map((r,u)=>r?.message&&jsx("li",{children:r.message},u))})},[e,a$1]);return p?jsx("div",{role:"alert","data-slot":"field-error",className:a("text-error text-sm font-normal",t),...c,children:p}):null}function Q({className:t,...e}){return jsx("div",{"data-slot":"field-group",className:a("group/field-group @container/field-group flex w-full flex-col gap-5 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4",t),...e})}function Z({className:t,...e}){return jsx(a$1,{"data-slot":"field-label",className:a("group/field-label peer/field-label has-data-[state=checked]:border-primary/30 has-data-[state=checked]:bg-primary/5 dark:has-data-[state=checked]:border-primary/20 dark:has-data-[state=checked]:bg-primary/10 flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border *:data-[slot=field]:p-2.5","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",t),...e})}function ee({className:t,variant:e="legend",...a$1}){return jsx("legend",{"data-slot":"field-legend","data-variant":e,className:a("mb-1.5 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base",t),...a$1})}function le({children:t,className:e,...a$1}){return jsxs("div",{"data-slot":"field-separator","data-content":!!t,className:a("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",e),...a$1,children:[jsx(a$2,{className:"absolute inset-0 top-1/2"}),t?jsx("span",{className:"bg-background text-muted-foreground relative mx-auto block w-fit px-2","data-slot":"field-separator-content",children:t}):null]})}function se({className:t,...e}){return jsx("fieldset",{"data-slot":"field-set",className:a("flex flex-col gap-6","has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",t),...e})}function ce({className:t,...e}){return jsx("div",{"data-slot":"field-label",className:a("flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50",t),...e})}export{S as a,T as b,q as c,I as d,Q as e,Z as f,ee as g,le as h,se as i,ce as j};