UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 3.97 kB
var i=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?i(...e):typeof e=="object"?Object.keys(e).map((l,n)=>e[n]||e[l]&&l||null).filter(l=>l!==null).join(" "):e).filter(e=>!!e).join(" ");var z=(t,e)=>i({[`${t}-xs`]:e.size==="xsmall",[`${t}-sm`]:e.size==="small",[`${t}-md`]:e.size==="medium",[`${t}-lg`]:e.size==="large",[`${t}-xl`]:e.size==="xlarge",[`${t}-xxl`]:e.size==="xxlarge",[`${t}-xxxl`]:e.size==="xxxlarge"},{[`${t}-${e.fillMode}`]:e.fillMode},{[`${t}-${e.fillMode}-${e.themeColor}`]:e.fillMode&&e.themeColor},{[`${t}-${e.themeColor}`]:e.themeColor&&e.fillMode===void 0},{"k-rounded-sm":e.rounded==="small","k-rounded-md":e.rounded==="medium","k-rounded-lg":e.rounded==="large","k-rounded-full":e.rounded==="full"}),E=(t,e)=>i({"k-valid":e.valid,"k-invalid":e.invalid,"k-hover":e.hover,"k-focus":e.focus,"k-checked":e.checked,"k-active":e.active,"k-selected":e.selected,"k-disabled":e.disabled,"k-indeterminate":e.indeterminate&&!e.checked,"k-loading":e.loading,"k-empty":e.empty,"k-readonly":e.readonly,"k-highlighted":e.highlighted});var u={xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"};var w={open:"open",hover:"hover",focus:"focus",active:"active",selected:"selected",disabled:"disabled",valid:"valid",invalid:"invalid",loading:"loading",required:"required",empty:"empty",indeterminate:"indeterminate",checked:"checked",readonly:"readonly",highlighted:"highlighted"};import{jsx as f,jsxs as F}from"react/jsx-runtime";var N="k-form-field",R=[w.disabled],m=t=>{let{label:e,orientation:l,optional:n,editor:o,hint:d,error:s,info:v,disabled:a,dir:p,colSpan:r}=t;return F("div",{className:i(N,t.className,E(N,{disabled:a}),{[`k-col-span-${r}`]:r}),dir:p,children:[e&&F("label",{className:i("k-label","k-form-label"),children:[e,n&&f("span",{className:"k-label-optional",children:"(Optional)"}),v&&f("span",{className:"k-field-info",children:"(field info)"})]}),l==="horizontal"&&!e&&f("span",{className:"k-label k-form-label k-label-empty"}),F("div",{className:"k-form-field-wrap",children:[o,d&&f("div",{className:"k-form-hint",children:d}),s&&f("div",{className:"k-form-error",children:s})]})]})};m.states=R;m.className=N;import{Fragment as K,jsx as S,jsxs as L}from"react/jsx-runtime";var A="k-form-fieldset",x=t=>{let{legend:e,layout:l,cols:n,gutters:o,colSpan:d}=t;return L("fieldset",{className:i(A,{[`k-col-span-${d}`]:d}),children:[e&&S("legend",{className:"k-form-legend",children:e}),l==="grid"?S("div",{className:i("k-form-layout","k-d-grid",{[`k-grid-cols-${n}`]:n}),style:{...typeof o=="string"&&{gap:o},...typeof o=="object"&&o.rows&&{rowGap:o.rows},...typeof o=="object"&&o.cols&&{columnGap:o.cols}},children:t.children}):S(K,{children:t.children})]})};x.className=A;import{Fragment as P,jsx as g,jsxs as D}from"react/jsx-runtime";import{createElement as $}from"react";var h="k-form",T=[],O={size:[u.small,u.medium,u.large]},b={size:u.medium,layout:"basic",tag:"form"},k=t=>{let{size:e=b.size,orientation:l,layout:n=b.layout,formButtons:o,cols:d,gutters:s,tag:v=b.tag,children:a}=t,p=({tag:c,className:y,children:M})=>c==="form"?g("form",{className:y,children:M}):g("div",{className:y,children:M}),r=[];return a&&(Array.isArray(a)?a.map((c,y)=>{c.type===m?r.push($(m,{...c.props,orientation:l,key:y})):r.push(c)}):a.type===m?r.push($(m,{...a.props,orientation:l,key:`${new Date().getTime()}`})):a.type===x&&r.push($(x,{...a.props,key:`${new Date().getTime()}`}))),D(p,{tag:v,className:i(t.className,h,z(h,{size:e}),{[`${h}-${l}`]:l}),children:[n==="grid"?g("div",{className:i("k-form-layout","k-d-grid",{[`k-grid-cols-${d}`]:d}),style:{...typeof s=="string"&&{gap:s},...typeof s=="object"&&s.rows&&{rowGap:s.rows},...typeof s=="object"&&s.cols&&{columnGap:s.cols}},children:r}):g(P,{children:r}),o&&g("div",{className:"k-form-buttons",children:o})]})};k.states=T;k.options=O;k.className=h;k.defaultOptions=b;var te=k;export{h as FORM_CLASSNAME,k as Form,te as default};