klip-components 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts
CHANGED
|
@@ -516,8 +516,6 @@ export declare interface TableProps extends default_2.TableHTMLAttributes<HTMLTa
|
|
|
516
516
|
variant?: 'default' | 'bordered' | 'striped' | 'hover' | 'detached';
|
|
517
517
|
/** Whether the table should use dense/compact spacing */
|
|
518
518
|
dense?: boolean;
|
|
519
|
-
/** Whether the table should be responsive */
|
|
520
|
-
responsive?: boolean;
|
|
521
519
|
/** Children elements */
|
|
522
520
|
children: default_2.ReactNode;
|
|
523
521
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=Object.defineProperty,a=Object.defineProperties,r=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,i=(a,r,s)=>r in a?e(a,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[r]=s,l=(e,a)=>{for(var r in a||(a={}))t.call(a,r)&&i(e,r,a[r]);if(s)for(var r of s(a))n.call(a,r)&&i(e,r,a[r]);return e},o=(e,s)=>a(e,r(s)),c=(e,a)=>{var r={};for(var i in e)t.call(e,i)&&a.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&s)for(var i of s(e))a.indexOf(i)<0&&n.call(e,i)&&(r[i]=e[i]);return r};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),h=require("react");function p(e){var a,r,s="";if("string"==typeof e||"number"==typeof e)s+=e;else if("object"==typeof e)if(Array.isArray(e)){var t=e.length;for(a=0;a<t;a++)e[a]&&(r=p(e[a]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}function u(){for(var e,a,r=0,s="",t=arguments.length;r<t;r++)(e=arguments[r])&&(a=p(e))&&(s&&(s+=" "),s+=a);return s}function x(...e){const a=e.join(" ").split(" ").filter(Boolean);return[...new Set(a)].join(" ")}function m(...e){return x(u(...e))}const g=({width:e=24,height:a=24})=>d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:a,viewBox:"0 0 24 24",children:d.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m15 6l-6 6l6 6"})}),b=({width:e=24,height:a=24})=>d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:a,viewBox:"0 0 24 24",children:d.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 6l6 6l-6 6"})}),f=({color:e="currentColor",size:a=24})=>d.jsxs("svg",{width:a,height:a,stroke:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[d.jsx("style",{children:"\n .spinner_V8m1{transform-origin:center;animation:spinner_zKoa 2s linear infinite}\n .spinner_V8m1 circle{stroke-linecap:round;animation:spinner_YpZS 1.5s ease-in-out infinite}\n @keyframes spinner_zKoa{100%{transform:rotate(360deg)}}\n @keyframes spinner_YpZS{\n 0%{stroke-dasharray:0 150;stroke-dashoffset:0}\n 47.5%{stroke-dasharray:42 150;stroke-dashoffset:-16}\n 95%,100%{stroke-dasharray:42 150;stroke-dashoffset:-59}\n }\n "}),d.jsx("g",{className:"spinner_V8m1",children:d.jsx("circle",{cx:"12",cy:"12",r:"9.5",fill:"none",strokeWidth:"3"})})]}),v=e=>{var a=e,{variant:r="primary",size:s="md",shape:t="rectangle",startIcon:n,endIcon:i,className:h="",children:p,loading:u,disabled:x}=a,g=c(a,["variant","size","shape","startIcon","endIcon","className","children","loading","disabled"]);return d.jsx("button",o(l({className:m("btn",`btn-${r}`,`btn-${s}`,`btn-${t}`,{"btn-loading":u},h),disabled:x||u},g),{children:u?d.jsx(f,{}):d.jsxs(d.Fragment,{children:[n&&d.jsx("span",{className:"btn-icon-start",children:n}),p,i&&d.jsx("span",{className:"btn-icon-end",children:i})]})}))},j="...",y=({currentPage:e,totalPages:a,siblingCount:r=1})=>h.useMemo(()=>{if(a<=7)return Array.from({length:a},(e,a)=>a+1);const s=Math.max(e-r,1),t=Math.min(e+r,a),n=s>2,i=t<a-1;if(!n&&!i)return Array.from({length:a},(e,a)=>a+1);if(!n&&i){const e=3+2*r;return[...Array.from({length:e},(e,a)=>a+1),j,a]}if(n&&!i){const e=3+2*r;return[1,j,...Array.from({length:e},(r,s)=>a-e+s+1)]}return[1,j,...Array.from({length:t-s+1},(e,a)=>s+a),j,a]},[e,a,r]),N=e=>{var a=e,{className:r="",children:s}=a,t=c(a,["className","children"]);return d.jsx("thead",o(l({className:m("table-header",r)},t),{children:s}))},w=e=>{var a=e,{className:r="",children:s}=a,t=c(a,["className","children"]);return d.jsx("tbody",o(l({className:m("table-body",r)},t),{children:s}))},k=e=>{var a=e,{className:r="",children:s}=a,t=c(a,["className","children"]);return d.jsx("tfoot",o(l({className:m("table-footer",r)},t),{children:s}))},C=e=>{var a=e,{className:r="",selected:s=!1,children:t}=a,n=c(a,["className","selected","children"]);return d.jsx("tr",o(l({className:m("table-row",{"table-row-selected":s},r)},n),{children:t}))},P=e=>{var a=e,{className:r="",header:s=!1,align:t="left",minWidth:n,maxWidth:i,width:h,children:p,style:u}=a,x=c(a,["className","header","align","minWidth","maxWidth","width","children","style"]);const g=s?"th":"td",b=l(l(l(l({},n&&{minWidth:n}),i&&{maxWidth:i}),h&&{width:h}),u);return d.jsx(g,o(l({className:m("table-cell",`table-cell-${t}`,{"table-cell-header":s},r),style:Object.keys(b).length>0?b:u},x),{children:p}))},z=e=>{var a=e,{className:r="",variant:s="default",dense:t=!1,
|
|
1
|
+
"use strict";var e=Object.defineProperty,a=Object.defineProperties,r=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,i=(a,r,s)=>r in a?e(a,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[r]=s,l=(e,a)=>{for(var r in a||(a={}))t.call(a,r)&&i(e,r,a[r]);if(s)for(var r of s(a))n.call(a,r)&&i(e,r,a[r]);return e},o=(e,s)=>a(e,r(s)),c=(e,a)=>{var r={};for(var i in e)t.call(e,i)&&a.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&s)for(var i of s(e))a.indexOf(i)<0&&n.call(e,i)&&(r[i]=e[i]);return r};Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),h=require("react");function p(e){var a,r,s="";if("string"==typeof e||"number"==typeof e)s+=e;else if("object"==typeof e)if(Array.isArray(e)){var t=e.length;for(a=0;a<t;a++)e[a]&&(r=p(e[a]))&&(s&&(s+=" "),s+=r)}else for(r in e)e[r]&&(s&&(s+=" "),s+=r);return s}function u(){for(var e,a,r=0,s="",t=arguments.length;r<t;r++)(e=arguments[r])&&(a=p(e))&&(s&&(s+=" "),s+=a);return s}function x(...e){const a=e.join(" ").split(" ").filter(Boolean);return[...new Set(a)].join(" ")}function m(...e){return x(u(...e))}const g=({width:e=24,height:a=24})=>d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:a,viewBox:"0 0 24 24",children:d.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m15 6l-6 6l6 6"})}),b=({width:e=24,height:a=24})=>d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:a,viewBox:"0 0 24 24",children:d.jsx("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m9 6l6 6l-6 6"})}),f=({color:e="currentColor",size:a=24})=>d.jsxs("svg",{width:a,height:a,stroke:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[d.jsx("style",{children:"\n .spinner_V8m1{transform-origin:center;animation:spinner_zKoa 2s linear infinite}\n .spinner_V8m1 circle{stroke-linecap:round;animation:spinner_YpZS 1.5s ease-in-out infinite}\n @keyframes spinner_zKoa{100%{transform:rotate(360deg)}}\n @keyframes spinner_YpZS{\n 0%{stroke-dasharray:0 150;stroke-dashoffset:0}\n 47.5%{stroke-dasharray:42 150;stroke-dashoffset:-16}\n 95%,100%{stroke-dasharray:42 150;stroke-dashoffset:-59}\n }\n "}),d.jsx("g",{className:"spinner_V8m1",children:d.jsx("circle",{cx:"12",cy:"12",r:"9.5",fill:"none",strokeWidth:"3"})})]}),v=e=>{var a=e,{variant:r="primary",size:s="md",shape:t="rectangle",startIcon:n,endIcon:i,className:h="",children:p,loading:u,disabled:x}=a,g=c(a,["variant","size","shape","startIcon","endIcon","className","children","loading","disabled"]);return d.jsx("button",o(l({className:m("btn",`btn-${r}`,`btn-${s}`,`btn-${t}`,{"btn-loading":u},h),disabled:x||u},g),{children:u?d.jsx(f,{}):d.jsxs(d.Fragment,{children:[n&&d.jsx("span",{className:"btn-icon-start",children:n}),p,i&&d.jsx("span",{className:"btn-icon-end",children:i})]})}))},j="...",y=({currentPage:e,totalPages:a,siblingCount:r=1})=>h.useMemo(()=>{if(a<=7)return Array.from({length:a},(e,a)=>a+1);const s=Math.max(e-r,1),t=Math.min(e+r,a),n=s>2,i=t<a-1;if(!n&&!i)return Array.from({length:a},(e,a)=>a+1);if(!n&&i){const e=3+2*r;return[...Array.from({length:e},(e,a)=>a+1),j,a]}if(n&&!i){const e=3+2*r;return[1,j,...Array.from({length:e},(r,s)=>a-e+s+1)]}return[1,j,...Array.from({length:t-s+1},(e,a)=>s+a),j,a]},[e,a,r]),N=e=>{var a=e,{className:r="",children:s}=a,t=c(a,["className","children"]);return d.jsx("thead",o(l({className:m("table-header",r)},t),{children:s}))},w=e=>{var a=e,{className:r="",children:s}=a,t=c(a,["className","children"]);return d.jsx("tbody",o(l({className:m("table-body",r)},t),{children:s}))},k=e=>{var a=e,{className:r="",children:s}=a,t=c(a,["className","children"]);return d.jsx("tfoot",o(l({className:m("table-footer",r)},t),{children:s}))},C=e=>{var a=e,{className:r="",selected:s=!1,children:t}=a,n=c(a,["className","selected","children"]);return d.jsx("tr",o(l({className:m("table-row",{"table-row-selected":s},r)},n),{children:t}))},P=e=>{var a=e,{className:r="",header:s=!1,align:t="left",minWidth:n,maxWidth:i,width:h,children:p,style:u}=a,x=c(a,["className","header","align","minWidth","maxWidth","width","children","style"]);const g=s?"th":"td",b=l(l(l(l({},n&&{minWidth:n}),i&&{maxWidth:i}),h&&{width:h}),u);return d.jsx(g,o(l({className:m("table-cell",`table-cell-${t}`,{"table-cell-header":s},r),style:Object.keys(b).length>0?b:u},x),{children:p}))},z=e=>{var a=e,{className:r="",variant:s="default",dense:t=!1,children:n}=a,i=c(a,["className","variant","dense","children"]);const h=d.jsx("table",o(l({className:m("table",`table-${s}`,{"table-dense":t},r)},i),{children:n}));return d.jsx("div",{className:"table-responsive",children:h})};z.Header=N,z.Body=w,z.Footer=k,z.Row=C,z.Cell=P,exports.Button=v,exports.ButtonSelect=({options:e,value:a,onChange:r,disabled:s=!1,multiple:t=!1})=>{const n=e=>Array.isArray(a)?a.includes(e):e===a;return d.jsx("div",{className:"button-select "+(s?"disabled":""),children:e.map(({value:e,child:i})=>d.jsx("button",{className:"button-select-option "+(n(e)?"selected":""),onClick:()=>(e=>{if(s)return;if(!t)return void r(e);const n=Array.isArray(a)?a:[],i=n.includes(e)?n.filter(a=>a!==e):[...n,e];r(i)})(e),disabled:s,type:"button",children:i},e))})},exports.ChevronLeft=g,exports.ChevronRight=b,exports.DOTS=j,exports.Input=e=>{var a=e,{variant:r="primary",type:s="text",label:t,prefix:n,suffix:i,helperText:o,className:p,labelClass:u,helperTextClass:x,onChange:g,id:b,hasError:v,loading:j=!1,disabled:y}=a,N=c(a,["variant","type","label","prefix","suffix","helperText","className","labelClass","helperTextClass","onChange","id","hasError","loading","disabled"]);const w=h.useId(),k=b||`input-${w}`,C=m("form-field",{"has-prefix":!!n,"has-suffix":!!i},{[`variant-${r}`]:r},{loading:j},p);return d.jsxs("article",{className:"input-container",children:[t&&d.jsx("label",{htmlFor:k,className:m("input-label",u),children:t}),d.jsxs("section",{className:m("input-wrapper",{loading:j}),children:[n&&d.jsx("article",{className:"input-prefix",children:n}),d.jsx("input",l({id:k,type:s,className:C,onChange:e=>null==g?void 0:g(e.target.value),disabled:y||j},N)),j?d.jsx("article",{className:"input-suffix",children:d.jsx(f,{})}):i&&d.jsx("article",{className:"input-suffix",children:i})]}),o&&d.jsx("small",{className:m("input-helper-text",x),style:{color:v?"var(--color-danger)":"inherit"},children:o})]})},exports.Pagination=({currentPage:e,totalPages:a,onPageChange:r,siblingCount:s=1,hidePrevButton:t=!1,hideNextButton:n=!1,size:i="md",variant:l="secondary",className:o="",disabled:c=!1,mobile:h=!1})=>{const p=y({currentPage:e,totalPages:a,siblingCount:s});if(0===e||0===a)return null;const u=()=>{e<a&&!c&&r(e+1)},x=()=>{e>1&&!c&&r(e-1)},f=p[p.length-1];return h?d.jsxs("article",{className:m("pagination","pagination--mobile",o),"aria-label":"pagination navigation",children:[!t&&d.jsx(v,{variant:l,size:i,onClick:x,disabled:1===e||c,"aria-label":"Go to previous page",shape:"square",children:d.jsx(g,{})}),d.jsxs("span",{className:"pagination__page-indicator","aria-live":"polite",children:[e," / ",a," pages"]}),!n&&d.jsx(v,{variant:l,size:i,onClick:u,disabled:e===f||c,"aria-label":"Go to next page",shape:"square",children:d.jsx(b,{})})]}):d.jsxs("article",{className:m("pagination",o),"aria-label":"pagination navigation",children:[!t&&d.jsx(v,{variant:l,size:i,onClick:x,disabled:1===e||c,"aria-label":"Go to previous page",shape:"square",children:d.jsx(g,{})}),p.map((s,t)=>s===j?d.jsx(v,{variant:l,size:i,"aria-label":"More pages",shape:"square",disabled:c,children:"…"},t):d.jsx(v,{variant:s===e?"primary":l,size:i,onClick:()=>!c&&r(s),disabled:c||1===a,"aria-label":s===e?`Current page, page ${s}`:`Go to page ${s}`,"aria-current":s===e?"page":void 0,shape:"square",children:s},t)),!n&&d.jsx(v,{variant:l,size:i,onClick:u,disabled:e===f||c,"aria-label":"Go to next page",shape:"square",children:d.jsx(b,{})})]})},exports.Spinner=f,exports.Table=z,exports.TableBody=w,exports.TableCell=P,exports.TableFooter=k,exports.TableHeader=N,exports.TableRow=C,exports.Toggle=e=>{var a=e,{color:r="var(--color-primary)",size:s="3.75rem",checked:t=!1,onChange:n,label:i,labelPosition:o="right",className:h}=a,p=c(a,["color","size","checked","onChange","label","labelPosition","className"]);return d.jsxs("label",{className:m("switch-container",o,h),children:[d.jsxs("div",{className:"toggle-switch",style:{"--switch-size":s,"--switch-color":r},children:[d.jsx("input",l({type:"checkbox",role:"switch",checked:t,onChange:e=>null==n?void 0:n(e.target.checked)},p)),d.jsx("span",{className:"slider"})]}),i&&d.jsx("span",{className:"switch-label",children:i})]})},exports.clsx=u,exports.cn=m,exports.mergeClasses=x,exports.usePagination=y;
|