@teppen/react-ui 0.0.3 → 0.0.5

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/cjs/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("react/jsx-runtime");exports.BaseTable=function(t){var a=t.cols,r=t.rows;return e.jsxs("table",{className:"",children:[e.jsx("thead",{className:"",children:e.jsx("tr",{"data-testid":"table-header",children:a.map((function(t){return e.jsx("th",{className:"",children:t.label},t.key)}))})}),e.jsx("tbody",{children:r.map((function(t){return e.jsx("tr",{"data-testid":t.id,className:"",onClick:t.onClick,children:a.map((function(a){return e.jsx("td",{children:e.jsx("div",{className:"",onClick:function(e){e.preventDefault(),e.stopPropagation()},children:t[a.key]})},a.key)}))},t.id)}))})]})};
1
+ "use strict";var t=require("react/jsx-runtime");!function(t,e){void 0===e&&(e={});var o=e.insertAt;if(t&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===o&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}}('/*! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.table{display:table}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.table-auto{table-layout:auto}.cursor-default{cursor:default}.bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.p-2{padding:.5rem}.text-left{text-align:left}.text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity))}.hover\\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}',{insertAt:"top"}),exports.BaseTable=function(e){var o=e.cols,i=e.rows;return t.jsxs("table",{className:"table table-auto w-full",children:[t.jsx("thead",{className:"bg-gray-200 text-gray-600",children:t.jsx("tr",{"data-testid":"table-header",children:o.map((function(e){return t.jsx("th",{className:"",children:e.label},e.key)}))})}),t.jsx("tbody",{children:i.map((function(e){return t.jsx("tr",{"data-testid":e.id,className:"hover:bg-gray-100",onClick:e.onClick,children:o.map((function(o){return t.jsx("td",{children:t.jsx("div",{className:"p-2 w-fit text-left cursor-default",onClick:function(t){t.preventDefault(),t.stopPropagation()},children:e[o.key]})},o.key)}))},e.id)}))})]})};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/table/base.tsx"],"sourcesContent":["type DataObject = {\n [key: string]: any;\n id: number | string;\n onClick?: React.MouseEventHandler<HTMLTableRowElement>;\n};\n\ntype TPropsTable<T extends DataObject> = {\n cols: { key: string; label?: string }[];\n rows: T[];\n};\n\nexport default function BaseTable<T extends DataObject>(props: TPropsTable<T>) {\n const { cols, rows } = props;\n\n return (\n <table className={``}>\n <thead className={``}>\n <tr data-testid=\"table-header\">\n {cols.map((col) => (\n <th key={col.key} className={``}>\n {col.label}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((r) => (\n <tr key={r.id} data-testid={r.id} className={``} onClick={r.onClick}>\n {cols.map((col) => (\n <td key={col.key}>\n <div\n className={``}\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n }}\n >\n {r[col.key]}\n </div>\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n}\n"],"names":["props","cols","rows","_jsxs","className","children","_jsx","map","col","label","key","jsx","r","id","onClick","e","preventDefault","stopPropagation"],"mappings":"kEAWwB,SAAgCA,GAC9C,IAAAC,EAAeD,EAAKC,KAAdC,EAASF,EAAKE,KAE5B,OACEC,EAAAA,KAAO,QAAA,CAAAC,UAAW,GAAEC,SAAA,CAClBC,eAAOF,UAAW,GAAEC,SAClBC,EAAAA,wBAAgB,eAAcD,SAC3BJ,EAAKM,KAAI,SAACC,GAAQ,OACjBF,EAAAA,IAAkB,KAAA,CAAAF,UAAW,GAAEC,SAC5BG,EAAIC,OADED,EAAIE,IAGd,QAGLJ,EACGK,IAAA,QAAA,CAAAN,SAAAH,EAAKK,KAAI,SAACK,GAAM,OACfN,EAAAK,IAAA,KAAA,CAAA,cAA4BC,EAAEC,GAAIT,UAAW,GAAIU,QAASF,EAAEE,iBACzDb,EAAKM,KAAI,SAACC,GAAQ,OACjBF,EAAAA,IACE,KAAA,CAAAD,SAAAC,EAAAA,IAAA,MAAA,CACEF,UAAW,GACXU,QAAS,SAACC,GACRA,EAAEC,iBACFD,EAAEE,iBACJ,EAECZ,SAAAO,EAAEJ,EAAIE,QARFF,EAAIE,IADI,KADZE,EAAEC,GAeZ,QAIT"}
1
+ {"version":3,"file":"index.js","sources":["../../node_modules/style-inject/dist/style-inject.es.js","../../src/table/base.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","type DataObject = {\n [key: string]: any;\n id: number | string;\n onClick?: React.MouseEventHandler<HTMLTableRowElement>;\n};\n\ntype TPropsTable<T extends DataObject> = {\n cols: { key: string; label?: string }[];\n rows: T[];\n};\n\nexport default function BaseTable<T extends DataObject>(props: TPropsTable<T>) {\n const { cols, rows } = props;\n\n return (\n <table className={`table table-auto w-full`}>\n <thead className={`bg-gray-200 text-gray-600`}>\n <tr data-testid=\"table-header\">\n {cols.map((col) => (\n <th key={col.key} className={``}>\n {col.label}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((r) => (\n <tr\n key={r.id}\n data-testid={r.id}\n className={`hover:bg-gray-100`}\n onClick={r.onClick}\n >\n {cols.map((col) => (\n <td key={col.key}>\n <div\n className={`p-2 w-fit text-left cursor-default`}\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n }}\n >\n {r[col.key]}\n </div>\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n}\n"],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","props","cols","rows","_jsxs","className","children","_jsx","map","col","label","key","jsx","r","id","onClick","e","preventDefault","stopPropagation"],"mappings":"iDAAA,SAAqBA,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBY,CAqB1D,63JCdwB,SAAgCe,GAC9C,IAAAC,EAAeD,EAAKC,KAAdC,EAASF,EAAKE,KAE5B,OACEC,EAAAA,KAAO,QAAA,CAAAC,UAAW,0BAAyBC,SAAA,CACzCC,eAAOF,UAAW,4BAA2BC,SAC3CC,EAAAA,wBAAgB,eAAcD,SAC3BJ,EAAKM,KAAI,SAACC,GAAQ,OACjBF,EAAAA,IAAkB,KAAA,CAAAF,UAAW,GAAEC,SAC5BG,EAAIC,OADED,EAAIE,IAGd,QAGLJ,EACGK,IAAA,QAAA,CAAAN,SAAAH,EAAKK,KAAI,SAACK,GAAM,OACfN,EAAAK,IAAA,KAAA,CAAA,cAEeC,EAAEC,GACfT,UAAW,oBACXU,QAASF,EAAEE,iBAEVb,EAAKM,KAAI,SAACC,GAAQ,OACjBF,EAAAA,IACE,KAAA,CAAAD,SAAAC,EAAAA,IAAA,MAAA,CACEF,UAAW,qCACXU,QAAS,SAACC,GACRA,EAAEC,iBACFD,EAAEE,iBACJ,EAECZ,SAAAO,EAAEJ,EAAIE,QARFF,EAAIE,IADI,KALdE,EAAEC,GAmBV,QAIT","x_google_ignoreList":[0]}
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";function n(n){var r=n.cols,a=n.rows;return e("table",{className:"",children:[t("thead",{className:"",children:t("tr",{"data-testid":"table-header",children:r.map((function(e){return t("th",{className:"",children:e.label},e.key)}))})}),t("tbody",{children:a.map((function(e){return t("tr",{"data-testid":e.id,className:"",onClick:e.onClick,children:r.map((function(n){return t("td",{children:t("div",{className:"",onClick:function(e){e.preventDefault(),e.stopPropagation()},children:e[n.key]})},n.key)}))},e.id)}))})]})}export{n as BaseTable};
1
+ import{jsxs as t,jsx as e}from"react/jsx-runtime";function o(o){var i=o.cols,r=o.rows;return t("table",{className:"table table-auto w-full",children:[e("thead",{className:"bg-gray-200 text-gray-600",children:e("tr",{"data-testid":"table-header",children:i.map((function(t){return e("th",{className:"",children:t.label},t.key)}))})}),e("tbody",{children:r.map((function(t){return e("tr",{"data-testid":t.id,className:"hover:bg-gray-100",onClick:t.onClick,children:i.map((function(o){return e("td",{children:e("div",{className:"p-2 w-fit text-left cursor-default",onClick:function(t){t.preventDefault(),t.stopPropagation()},children:t[o.key]})},o.key)}))},t.id)}))})]})}!function(t,e){void 0===e&&(e={});var o=e.insertAt;if(t&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===o&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}}('/*! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.table{display:table}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.table-auto{table-layout:auto}.cursor-default{cursor:default}.bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.p-2{padding:.5rem}.text-left{text-align:left}.text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity))}.hover\\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}',{insertAt:"top"});export{o as BaseTable};
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/table/base.tsx"],"sourcesContent":["type DataObject = {\n [key: string]: any;\n id: number | string;\n onClick?: React.MouseEventHandler<HTMLTableRowElement>;\n};\n\ntype TPropsTable<T extends DataObject> = {\n cols: { key: string; label?: string }[];\n rows: T[];\n};\n\nexport default function BaseTable<T extends DataObject>(props: TPropsTable<T>) {\n const { cols, rows } = props;\n\n return (\n <table className={``}>\n <thead className={``}>\n <tr data-testid=\"table-header\">\n {cols.map((col) => (\n <th key={col.key} className={``}>\n {col.label}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((r) => (\n <tr key={r.id} data-testid={r.id} className={``} onClick={r.onClick}>\n {cols.map((col) => (\n <td key={col.key}>\n <div\n className={``}\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n }}\n >\n {r[col.key]}\n </div>\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n}\n"],"names":["BaseTable","props","cols","rows","_jsxs","className","children","_jsx","map","col","label","key","r","id","onClick","e","preventDefault","stopPropagation"],"mappings":"kDAWwB,SAAAA,EAAgCC,GAC9C,IAAAC,EAAeD,EAAKC,KAAdC,EAASF,EAAKE,KAE5B,OACEC,EAAO,QAAA,CAAAC,UAAW,GAAEC,SAAA,CAClBC,WAAOF,UAAW,GAAEC,SAClBC,sBAAgB,eAAcD,SAC3BJ,EAAKM,KAAI,SAACC,GAAQ,OACjBF,EAAkB,KAAA,CAAAF,UAAW,GAAEC,SAC5BG,EAAIC,OADED,EAAIE,IAGd,QAGLJ,EACG,QAAA,CAAAD,SAAAH,EAAKK,KAAI,SAACI,GAAM,OACfL,EAAA,KAAA,CAAA,cAA4BK,EAAEC,GAAIR,UAAW,GAAIS,QAASF,EAAEE,iBACzDZ,EAAKM,KAAI,SAACC,GAAQ,OACjBF,EACE,KAAA,CAAAD,SAAAC,EAAA,MAAA,CACEF,UAAW,GACXS,QAAS,SAACC,GACRA,EAAEC,iBACFD,EAAEE,iBACJ,EAECX,SAAAM,EAAEH,EAAIE,QARFF,EAAIE,IADI,KADZC,EAAEC,GAeZ,QAIT"}
1
+ {"version":3,"file":"index.js","sources":["../../src/table/base.tsx","../../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":["type DataObject = {\n [key: string]: any;\n id: number | string;\n onClick?: React.MouseEventHandler<HTMLTableRowElement>;\n};\n\ntype TPropsTable<T extends DataObject> = {\n cols: { key: string; label?: string }[];\n rows: T[];\n};\n\nexport default function BaseTable<T extends DataObject>(props: TPropsTable<T>) {\n const { cols, rows } = props;\n\n return (\n <table className={`table table-auto w-full`}>\n <thead className={`bg-gray-200 text-gray-600`}>\n <tr data-testid=\"table-header\">\n {cols.map((col) => (\n <th key={col.key} className={``}>\n {col.label}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((r) => (\n <tr\n key={r.id}\n data-testid={r.id}\n className={`hover:bg-gray-100`}\n onClick={r.onClick}\n >\n {cols.map((col) => (\n <td key={col.key}>\n <div\n className={`p-2 w-fit text-left cursor-default`}\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n }}\n >\n {r[col.key]}\n </div>\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n}\n","function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n"],"names":["BaseTable","props","cols","rows","_jsxs","className","children","_jsx","map","col","label","key","r","id","onClick","e","preventDefault","stopPropagation","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode"],"mappings":"kDAWwB,SAAAA,EAAgCC,GAC9C,IAAAC,EAAeD,EAAKC,KAAdC,EAASF,EAAKE,KAE5B,OACEC,EAAO,QAAA,CAAAC,UAAW,0BAAyBC,SAAA,CACzCC,WAAOF,UAAW,4BAA2BC,SAC3CC,sBAAgB,eAAcD,SAC3BJ,EAAKM,KAAI,SAACC,GAAQ,OACjBF,EAAkB,KAAA,CAAAF,UAAW,GAAEC,SAC5BG,EAAIC,OADED,EAAIE,IAGd,QAGLJ,EACG,QAAA,CAAAD,SAAAH,EAAKK,KAAI,SAACI,GAAM,OACfL,EAAA,KAAA,CAAA,cAEeK,EAAEC,GACfR,UAAW,oBACXS,QAASF,EAAEE,iBAEVZ,EAAKM,KAAI,SAACC,GAAQ,OACjBF,EACE,KAAA,CAAAD,SAAAC,EAAA,MAAA,CACEF,UAAW,qCACXS,QAAS,SAACC,GACRA,EAAEC,iBACFD,EAAEE,iBACJ,EAECX,SAAAM,EAAEH,EAAIE,QARFF,EAAIE,IADI,KALdC,EAAEC,GAmBV,QAIT,ECnDA,SAAqBK,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBY,CAqB1D","x_google_ignoreList":[1]}
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@teppen/react-ui",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "React UI Component",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
9
- "rollup": "rollup -c --bundleConfigAsCjs",
9
+ "clean": "rimraf dist",
10
+ "rollup": "npm run clean && rollup -c --bundleConfigAsCjs",
10
11
  "storybook": "storybook dev -p 6006",
11
12
  "build-storybook": "storybook build",
12
13
  "test": "jest"
@@ -33,15 +34,19 @@
33
34
  "@testing-library/react": "^14.2.1",
34
35
  "@types/jest": "^29.5.12",
35
36
  "@types/react": "^18.2.60",
37
+ "autoprefixer": "^10.4.17",
36
38
  "babel-jest": "^29.7.0",
37
39
  "identity-obj-proxy": "^3.0.0",
38
40
  "jest": "^29.7.0",
39
41
  "jest-environment-jsdom": "^29.7.0",
42
+ "postcss": "^8.4.35",
43
+ "rimraf": "^5.0.5",
40
44
  "rollup": "^4.12.0",
41
45
  "rollup-plugin-dts": "^6.1.0",
42
46
  "rollup-plugin-peer-deps-external": "^2.2.4",
43
47
  "rollup-plugin-postcss": "^4.0.2",
44
48
  "storybook": "^7.6.17",
49
+ "tailwindcss": "^3.4.1",
45
50
  "tslib": "^2.6.2",
46
51
  "typescript": "^5.3.3"
47
52
  },