UNPKG

@progress/kendo-themes-html

Version:

A collection of HTML helpers used for developing Kendo UI themes

2 lines (1 loc) 4.23 kB
var E=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var S=(t,e)=>{for(var n in e)E(t,n,{get:e[n],enumerable:!0})},B=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of _(e))!H.call(t,o)&&o!==n&&E(t,o,{get:()=>e[o],enumerable:!(r=R(e,o))||r.enumerable});return t};var K=t=>B(E({},"__esModule",{value:!0}),t);var j={};S(j,{CheckboxWithLabelBefore:()=>X});module.exports=K(j);var d=(...t)=>t.filter(e=>e!==!0&&!!e).map(e=>Array.isArray(e)?d(...e):typeof e=="object"?Object.keys(e).map((n,r)=>e[r]||e[n]&&n||null).filter(n=>n!==null).join(" "):e).filter(e=>!!e).join(" ");var w=(t,e)=>d({[`${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.themeColor}`]:e.themeColor},{"k-rounded-sm":e.rounded==="small","k-rounded-md":e.rounded==="medium","k-rounded-lg":e.rounded==="large","k-rounded-full":e.rounded==="full","k-rounded-none":e.rounded==="none"}),z=(t,e)=>{let{valid:n,invalid:r,hover:o,focus:b,checked:c,active:m,selected:k,disabled:f,indeterminate:g,loading:p,empty:y,readonly:v,highlighted:L,...C}=e;return d({"k-valid":n,"k-invalid":r,"k-hover":o,"k-focus":b,"k-checked":c,"k-active":m,"k-selected":k,"k-disabled":f,"k-indeterminate":g&&!c,"k-loading":p,"k-empty":y,"k-readonly":v,"k-highlighted":L},Object.keys(C).reduce((M,u)=>(u.startsWith("k-")?M[u]=C[u]:M[`k-${u}`]=C[u],M),{}))};var h={undefined:void 0,xsmall:"xsmall",small:"small",medium:"medium",large:"large",xlarge:"xlarge",xxlarge:"xxlarge",xxxlarge:"xxxlarge"},l={undefined:void 0,none:"none",small:"small",medium:"medium",large:"large",full:"full"};var i={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",generating:"generating",expanded:"expanded"};var O="checkbox",A=O;var $=require("react/jsx-runtime"),x="k-checkbox",T=[i.hover,i.focus,i.valid,i.invalid,i.required,i.disabled,i.checked,i.indeterminate],q={size:[h.undefined,h.small,h.medium,h.large],rounded:[l.undefined,l.none,l.small,l.medium,l.large,l.full]},F={},a=t=>{let{id:e,checked:n,indeterminate:r,hover:o,focus:b,disabled:c,invalid:m,valid:k,required:f,size:g,rounded:p,wrapperRole:y,...v}=t;return(0,$.jsx)("span",{className:"k-checkbox-wrap",role:y,children:(0,$.jsx)("input",{...v,id:e,type:"checkbox",defaultChecked:n,required:f,disabled:c||void 0,"aria-invalid":m?"true":void 0,className:d(t.className,x,w(x,{size:g,rounded:p}),z(x,{hover:o,focus:b,disabled:c,invalid:m,valid:k,indeterminate:r,checked:n}))})})};a.states=T;a.options=q;a.className=x;a.defaultOptions=F;a.moduleName=O;a.folderName=A;a.ariaSpec={selector:".k-checkbox",rules:[{selector:".k-checkbox",attribute:"role=checkbox or type=checkbox",usage:"Announces the checkbox role of the element."},{selector:".k-checkbox",attribute:"label for or aria-label or aria-labelledby (when has accessible name)",usage:"The input requires an accessible name to which it will be assigned."},{selector:".k-checkbox",attribute:"aria-checked=true/false/mixed or checked",usage:"For native checkboxes the checked state is handled by the browser. aria-checked is used for custom implementations."},{selector:".k-checkbox",attribute:"aria-describedby (when has hint or error)",usage:"Points to the hint or error message for the checkbox."},{selector:".k-checkbox",attribute:"disabled or aria-disabled=true (when disabled)",usage:"For native checkboxes use the HTML disabled attribute. aria-disabled for custom implementations."},{selector:".k-invalid, .ng-invalid",attribute:"aria-invalid=true (when invalid)",usage:"Rendered only when the CheckBox is in a form and announces the invalid state."}]};var N=a;var s=require("react/jsx-runtime"),X=({children:t,id:e,...n})=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("label",{className:"k-checkbox-label",htmlFor:e,children:t}),(0,s.jsx)(N,{id:e,...n})]});