ekm-ui 0.3.2 → 0.3.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/.turbo/turbo-build.log +89 -72
- package/CHANGELOG.md +12 -0
- package/dist/button.d.ts +8 -7
- package/dist/button.mjs +1 -1
- package/dist/card-payment-block.css +1 -1
- package/dist/card-payment-block.css.map +1 -1
- package/dist/card-payment-block.mjs +12 -11
- package/dist/card.d.ts +7 -0
- package/dist/card.mjs +9 -0
- package/dist/card.mjs.map +1 -0
- package/dist/{chunk-YQAMEBON.mjs → chunk-2PQACPVE.mjs} +2 -2
- package/dist/chunk-2PQACPVE.mjs.map +1 -0
- package/dist/chunk-ASCPOK5F.mjs +9 -0
- package/dist/chunk-ASCPOK5F.mjs.map +1 -0
- package/dist/chunk-KC6MIMS4.mjs +9 -0
- package/dist/chunk-KC6MIMS4.mjs.map +1 -0
- package/dist/{chunk-OZBN2ZC6.mjs → chunk-SQ6HYZPW.mjs} +2 -2
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +12 -11
- package/dist/layout/layout.css +1 -1
- package/dist/layout/layout.css.map +1 -1
- package/dist/layout/layout.mjs +12 -11
- package/dist/page-header.d.ts +1 -1
- package/dist/page-header.mjs +1 -1
- package/dist/radio.d.ts +5 -0
- package/dist/radio.mjs +10 -0
- package/dist/radio.mjs.map +1 -0
- package/dist/stacked-list-item.css +1 -1
- package/dist/stacked-list-item.css.map +1 -1
- package/dist/stacked-list-item.mjs +12 -11
- package/dist/textinput.d.ts +5 -0
- package/dist/textinput.mjs +11 -0
- package/dist/textinput.mjs.map +1 -0
- package/dist/toggleswitch.d.ts +5 -0
- package/dist/toggleswitch.mjs +10 -0
- package/dist/toggleswitch.mjs.map +1 -0
- package/dist/tooltip/tooltip.d.ts +8 -0
- package/dist/tooltip/tooltip.mjs +4 -0
- package/dist/tooltip/tooltip.mjs.map +1 -0
- package/package.json +1 -1
- package/src/button.tsx +141 -34
- package/src/card.tsx +18 -0
- package/src/index.tsx +1 -0
- package/src/page-header.tsx +2 -1
- package/src/radio.tsx +26 -0
- package/src/textinput.tsx +122 -0
- package/src/toggleswitch.tsx +38 -0
- package/src/tooltip/tooltip.tsx +65 -0
- package/dist/chunk-LN7UO7PK.mjs +0 -10
- package/dist/chunk-LN7UO7PK.mjs.map +0 -1
- package/dist/chunk-YQAMEBON.mjs.map +0 -1
- /package/dist/{chunk-OZBN2ZC6.mjs.map → chunk-SQ6HYZPW.mjs.map} +0 -0
|
@@ -1,38 +1,39 @@
|
|
|
1
|
-
export { a as StackedListItem } from './chunk-
|
|
1
|
+
export { a as StackedListItem } from './chunk-SQ6HYZPW.mjs';
|
|
2
|
+
import './chunk-ZHHTK7UM.mjs';
|
|
3
|
+
import './chunk-QWPN2UNV.mjs';
|
|
4
|
+
import './chunk-ASCPOK5F.mjs';
|
|
5
|
+
import './chunk-FAFXVD4P.mjs';
|
|
6
|
+
import './chunk-256SAVHD.mjs';
|
|
7
|
+
import './chunk-VPLCWU7T.mjs';
|
|
2
8
|
import './chunk-3ZCDEN7B.mjs';
|
|
3
9
|
import './chunk-HDNA6QBW.mjs';
|
|
4
10
|
import './chunk-HAQTLD4G.mjs';
|
|
5
11
|
import './chunk-X6GXSTW7.mjs';
|
|
6
|
-
import './chunk-
|
|
7
|
-
import './chunk-QWPN2UNV.mjs';
|
|
12
|
+
import './chunk-EQANFKDN.mjs';
|
|
8
13
|
import './chunk-RMX72FR3.mjs';
|
|
9
14
|
import './chunk-NI4IFVX3.mjs';
|
|
10
15
|
import './chunk-25FJ277C.mjs';
|
|
11
|
-
import './chunk-
|
|
12
|
-
import './chunk-256SAVHD.mjs';
|
|
13
|
-
import './chunk-VPLCWU7T.mjs';
|
|
16
|
+
import './chunk-BIU2AAPZ.mjs';
|
|
14
17
|
import './chunk-EIUBW4B6.mjs';
|
|
15
18
|
import './chunk-B2KVPYRJ.mjs';
|
|
16
19
|
import './chunk-OT256LE6.mjs';
|
|
17
20
|
import './chunk-FJQEJBBY.mjs';
|
|
18
21
|
import './chunk-UVKFEZEW.mjs';
|
|
19
22
|
import './chunk-EWNPNF2B.mjs';
|
|
20
|
-
import './chunk-
|
|
21
|
-
import './chunk-
|
|
23
|
+
import './chunk-2PQACPVE.mjs';
|
|
24
|
+
import './chunk-ER4YVWM3.mjs';
|
|
22
25
|
import './chunk-ZT7KDTGF.mjs';
|
|
23
26
|
import './chunk-WU66HPYP.mjs';
|
|
24
27
|
import './chunk-FRIXS4BL.mjs';
|
|
25
28
|
import './chunk-LWDFKEBO.mjs';
|
|
26
29
|
import './chunk-PJMH47GY.mjs';
|
|
27
30
|
import './chunk-KAQJAKQH.mjs';
|
|
28
|
-
import './chunk-BIU2AAPZ.mjs';
|
|
29
31
|
import './chunk-VASBTVLS.mjs';
|
|
30
32
|
import './chunk-YTTLKTRL.mjs';
|
|
31
33
|
import './chunk-T2OVPC6F.mjs';
|
|
32
34
|
import './chunk-2IZBG5JT.mjs';
|
|
33
35
|
import './chunk-ZPLTGYYM.mjs';
|
|
34
36
|
import './chunk-QRNTMHBL.mjs';
|
|
35
|
-
import './chunk-ER4YVWM3.mjs';
|
|
36
37
|
import './chunk-NS6AVKX7.mjs';
|
|
37
38
|
import './chunk-BISZCSUR.mjs';
|
|
38
39
|
import './chunk-O3QYDTAF.mjs';
|
|
@@ -42,7 +43,7 @@ import './chunk-UGSJ7PI7.mjs';
|
|
|
42
43
|
import './chunk-S7V4MUJ2.mjs';
|
|
43
44
|
import './chunk-QTAUYFKM.mjs';
|
|
44
45
|
import './chunk-SAXGEQRG.mjs';
|
|
45
|
-
import './chunk-
|
|
46
|
+
import './chunk-KC6MIMS4.mjs';
|
|
46
47
|
import './chunk-RUPJ2ZHA.mjs';
|
|
47
48
|
//# sourceMappingURL=out.js.map
|
|
48
49
|
//# sourceMappingURL=stacked-list-item.mjs.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { a } from './chunk-QTAUYFKM.mjs';
|
|
2
|
+
import { e, a as a$1, b } from './chunk-RUPJ2ZHA.mjs';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { variantProps } from 'classname-variants/react';
|
|
5
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var d=e(a());var x=variantProps({base:"block p-2.5 w-full text-sm border text-sm rounded-lg",variants:{color:{success:"bg-green-50 border border-green-500 text-green-900 dark:text-green-400 placeholder-green-700 dark:placeholder-green-500 text-sm focus:ring-green-500 focus:border-green-500 block w-full p-2.5 dark:bg-gray-700 dark:border-green-500",failure:"bg-red-50 border border-red-500 text-red-900 placeholder-red-700 text-sm rounded-lg focus:ring-red-500 dark:bg-gray-700 focus:border-red-500 block w-full p-2.5 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500",gray:"text-gray-900 bg-gray-50 border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"}},defaultVariants:{color:"gray"}}),m=variantProps({base:"block p-2.5 w-full text-sm border text-sm rounded-lg ps-10",variants:{color:{success:"bg-green-50 border border-green-500 text-green-900 dark:text-green-400 placeholder-green-700 dark:placeholder-green-500 text-sm focus:ring-green-500 focus:border-green-500 block w-full p-2.5 dark:bg-gray-700 dark:border-green-500",failure:"bg-red-50 border border-red-500 text-red-900 placeholder-red-700 text-sm rounded-lg focus:ring-red-500 dark:bg-gray-700 focus:border-red-500 block w-full p-2.5 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500",gray:"text-gray-900 bg-gray-50 border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"}},defaultVariants:{color:"gray"}}),h=variantProps({base:"block p-2.5 w-full text-sm border min-w-0 flex-1 rounded-none rounded-r-lg",variants:{color:{success:"bg-green-50 border border-green-500 text-green-900 dark:text-green-400 placeholder-green-700 dark:placeholder-green-500 text-sm focus:ring-green-500 focus:border-green-500 block w-full p-2.5 dark:bg-gray-700 dark:border-green-500",failure:"bg-red-50 border border-red-500 text-red-900 placeholder-red-700 text-sm rounded-lg focus:ring-red-500 dark:bg-gray-700 focus:border-red-500 block w-full p-2.5 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500",gray:"text-gray-900 bg-gray-50 border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"}},defaultVariants:{color:"gray"}}),v=forwardRef(function(t,f){let{color:g,disabled:a,type:o,placeholder:n,id:s,icon:c,addon:u}=t;return c?jsxs("div",{className:"relative",children:[jsx("div",{className:"pointer-events-none absolute inset-y-0 start-0 flex items-center ps-3.5",children:c}),jsx("div",{className:a&&"cursor-not-allowed opacity-50",children:jsx("input",a$1(b(a$1({},m({color:g})),{type:o||"text",id:s,placeholder:n||"Enter your tet here ..."}),t))})]}):u?jsxs("div",{className:a?"flex cursor-not-allowed opacity-50":"flex",children:[jsx("span",{className:"rounded-e-0 inline-flex items-center rounded-s-md border border-gray-300 bg-gray-200 px-3 text-sm text-gray-900 dark:border-gray-600 dark:bg-gray-600 dark:text-gray-400",children:u}),jsx("input",a$1(b(a$1({},h({color:g,disabled:a})),{type:o||"text",id:s,placeholder:n||"Enter your text here..."}),t))]}):jsx("div",{className:a?"relative cursor-not-allowed opacity-50":"relative",children:jsx("input",a$1(b(a$1({type:o||"text",ref:f,id:s},x({color:g,disabled:a})),{placeholder:n||"Enter your text here...",disabled:!1}),t))})});v.propTypes={id:d.default.string.isRequired,placeholder:d.default.string,color:d.default.oneOf(["gray","failure","success"]),icon:d.default.element,addon:d.default.element,disabled:d.default.boolean};
|
|
8
|
+
|
|
9
|
+
export { v as TextInput };
|
|
10
|
+
//# sourceMappingURL=out.js.map
|
|
11
|
+
//# sourceMappingURL=textinput.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/textinput.tsx"],"names":["import_prop_types","forwardRef","variantProps","jsx","jsxs","textInputProps","iconProps","addonProps","TextInput","props","ref","color","disabled","type","placeholder","id","icon","addon","__spreadValues","__spreadProps","PropTypes"],"mappings":"gGAGA,IAAAA,EAAsB,OAFtB,OAAS,cAAAC,MAAkB,QAC3B,OAAS,gBAAAC,MAAoB,2BAuDvB,OACE,OAAAC,EADF,QAAAC,MAAA,oBApDN,IAAMC,EAAiBH,EAAa,CAClC,KAAM,uDACN,SAAU,CACR,MAAO,CACL,QACE,wOACF,QACE,iOACF,KAAM,wNACR,CACF,EACA,gBAAiB,CACf,MAAO,MACT,CACF,CAAC,EAEKI,EAAYJ,EAAa,CAC7B,KAAM,6DACN,SAAU,CACR,MAAO,CACL,QACE,wOACF,QACE,iOACF,KAAM,wNACR,CACF,EACA,gBAAiB,CACf,MAAO,MACT,CACF,CAAC,EAEKK,EAAaL,EAAa,CAC9B,KAAM,6EACN,SAAU,CACR,MAAO,CACL,QACE,wOACF,QACE,iOACF,KAAM,wNACR,CACF,EACA,gBAAiB,CACf,MAAO,MACT,CACF,CAAC,EAEYM,EAAYP,EAAW,SAAmBQ,EAAOC,EAAK,CACjE,GAAM,CAAE,MAAAC,EAAO,SAAAC,EAAU,KAAAC,EAAM,YAAAC,EAAa,GAAAC,EAAI,KAAAC,EAAM,MAAAC,CAAM,EAAIR,EAChE,OAAIO,EAEAZ,EAAC,OAAI,UAAU,WACb,UAAAD,EAAC,OAAI,UAAU,0EACZ,SAAAa,EACH,EACAb,EAAC,OAAI,UAAWS,GAAY,gCAC1B,SAAAT,EAAC,QAAAe,EAAAC,EAAAD,EAAA,GACKZ,EAAU,CAAE,MAAAK,CAAM,CAAC,GADxB,CAEC,KAAME,GAAc,OACpB,GAAIE,EACJ,YAAaD,GAAe,4BACxBL,EACN,EACF,GACF,EAEOQ,EAEPb,EAAC,OAAI,UAAWQ,EAAW,qCAAuC,OAChE,UAAAT,EAAC,QAAK,UAAU,2KACb,SAAAc,EACH,EACAd,EAAC,QAAAe,EAAAC,EAAAD,EAAA,GACKX,EAAW,CAAE,MAAAI,EAAO,SAAAC,CAAS,CAAC,GADnC,CAEC,KAAMC,GAAc,OACpB,GAAIE,EACJ,YAAaD,GAAe,4BACxBL,EACN,GACF,EAIAN,EAAC,OACC,UACES,EAAW,yCAA2C,WAGxD,SAAAT,EAAC,QAAAe,EAAAC,EAAAD,EAAA,CACC,KAAML,GAAc,OACpB,IAAKH,EACL,GAAIK,GACAV,EAAe,CAAE,MAAAM,EAAO,SAAAC,CAAS,CAAC,GAJvC,CAKC,YAAaE,GAAe,0BAC5B,SAAU,KACNL,EACN,EACF,CAGN,CAAC,EAEDD,EAAU,UAAY,CAEpB,GAAI,EAAAY,QAAU,OAAO,WAErB,YAAa,EAAAA,QAAU,OAEvB,MAAO,EAAAA,QAAU,MAAM,CAAC,OAAQ,UAAW,SAAS,CAAC,EAErD,KAAM,EAAAA,QAAU,QAEhB,MAAO,EAAAA,QAAU,QAEjB,SAAU,EAAAA,QAAU,OACtB","sourcesContent":["//@ts-nocheck\nimport { forwardRef } from \"react\";\nimport { variantProps } from \"classname-variants/react\";\nimport PropTypes from \"prop-types\";\n\nconst textInputProps = variantProps({\n base: \"block p-2.5 w-full text-sm border text-sm rounded-lg\",\n variants: {\n color: {\n success:\n \"bg-green-50 border border-green-500 text-green-900 dark:text-green-400 placeholder-green-700 dark:placeholder-green-500 text-sm focus:ring-green-500 focus:border-green-500 block w-full p-2.5 dark:bg-gray-700 dark:border-green-500\",\n failure:\n \"bg-red-50 border border-red-500 text-red-900 placeholder-red-700 text-sm rounded-lg focus:ring-red-500 dark:bg-gray-700 focus:border-red-500 block w-full p-2.5 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500\",\n gray: \"text-gray-900 bg-gray-50 border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500\",\n },\n },\n defaultVariants: {\n color: \"gray\",\n },\n});\n\nconst iconProps = variantProps({\n base: \"block p-2.5 w-full text-sm border text-sm rounded-lg ps-10\",\n variants: {\n color: {\n success:\n \"bg-green-50 border border-green-500 text-green-900 dark:text-green-400 placeholder-green-700 dark:placeholder-green-500 text-sm focus:ring-green-500 focus:border-green-500 block w-full p-2.5 dark:bg-gray-700 dark:border-green-500\",\n failure:\n \"bg-red-50 border border-red-500 text-red-900 placeholder-red-700 text-sm rounded-lg focus:ring-red-500 dark:bg-gray-700 focus:border-red-500 block w-full p-2.5 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500\",\n gray: \"text-gray-900 bg-gray-50 border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500\",\n },\n },\n defaultVariants: {\n color: \"gray\",\n },\n});\n\nconst addonProps = variantProps({\n base: \"block p-2.5 w-full text-sm border min-w-0 flex-1 rounded-none rounded-r-lg\",\n variants: {\n color: {\n success:\n \"bg-green-50 border border-green-500 text-green-900 dark:text-green-400 placeholder-green-700 dark:placeholder-green-500 text-sm focus:ring-green-500 focus:border-green-500 block w-full p-2.5 dark:bg-gray-700 dark:border-green-500\",\n failure:\n \"bg-red-50 border border-red-500 text-red-900 placeholder-red-700 text-sm rounded-lg focus:ring-red-500 dark:bg-gray-700 focus:border-red-500 block w-full p-2.5 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500\",\n gray: \"text-gray-900 bg-gray-50 border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500\",\n },\n },\n defaultVariants: {\n color: \"gray\",\n },\n});\n\nexport const TextInput = forwardRef(function TextInput(props, ref) {\n const { color, disabled, type, placeholder, id, icon, addon } = props;\n if (icon) {\n return (\n <div className=\"relative\">\n <div className=\"pointer-events-none absolute inset-y-0 start-0 flex items-center ps-3.5\">\n {icon}\n </div>\n <div className={disabled && \"cursor-not-allowed opacity-50\"}>\n <input\n {...iconProps({ color })}\n type={type ? type : \"text\"}\n id={id}\n placeholder={placeholder || \"Enter your tet here ...\"}\n {...props}\n />\n </div>\n </div>\n );\n } else if (addon) {\n return (\n <div className={disabled ? \"flex cursor-not-allowed opacity-50\" : \"flex\"}>\n <span className=\"rounded-e-0 inline-flex items-center rounded-s-md border border-gray-300 bg-gray-200 px-3 text-sm text-gray-900 dark:border-gray-600 dark:bg-gray-600 dark:text-gray-400\">\n {addon}\n </span>\n <input\n {...addonProps({ color, disabled })}\n type={type ? type : \"text\"}\n id={id}\n placeholder={placeholder || \"Enter your text here...\"}\n {...props}\n />\n </div>\n );\n } else {\n return (\n <div\n className={\n disabled ? \"relative cursor-not-allowed opacity-50\" : \"relative\"\n }\n >\n <input\n type={type ? type : \"text\"}\n ref={ref}\n id={id}\n {...textInputProps({ color, disabled })}\n placeholder={placeholder || \"Enter your text here...\"}\n disabled={false}\n {...props}\n />\n </div>\n );\n }\n});\n\nTextInput.propTypes = {\n /** Unique id for the TextInput Component */\n id: PropTypes.string.isRequired,\n /** Optional placeholder text for TextInput Component */\n placeholder: PropTypes.string,\n /** Optional color defaults to gray. Failure and Success options available*/\n color: PropTypes.oneOf([\"gray\", \"failure\", \"success\"]),\n /** Optional icon TextInput Component */\n icon: PropTypes.element,\n /** Optional addon TextInput Component */\n addon: PropTypes.element,\n /** Optional to disable component */\n disabled: PropTypes.boolean,\n};\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { a } from './chunk-QTAUYFKM.mjs';
|
|
2
|
+
import { e, a as a$1 } from './chunk-RUPJ2ZHA.mjs';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var r=e(a());var l=forwardRef(function(e,o){return jsxs("label",{className:`relative mb-5 inline-flex items-center ${e.disabled&&"cursor-not-allowed opacity-50"}`,children:[jsx("input",a$1({id:e.id,ref:o,type:"checkbox",className:"peer sr-only",onChange:e.onChange},e)),jsx("div",{className:"peer h-6 w-11 rounded-full bg-gray-200 after:absolute after:start-[2px] after:top-0.5 after:h-5 after:w-5 after:rounded-full after:border after:border-gray-300 after:bg-white after:transition-all after:content-[''] peer-checked:bg-blue-600 peer-checked:after:translate-x-full peer-checked:after:border-white rtl:peer-checked:after:-translate-x-full dark:border-gray-600 dark:bg-gray-700"}),e.label&&jsx("span",{class:"ms-3 text-sm font-medium text-gray-900 dark:text-gray-300",children:e.label})]})}),b=l;l.propTypes={id:r.default.string.isRequired,checked:r.default.bool,disabled:r.default.bool,onChange:r.default.func,label:r.default.string};
|
|
7
|
+
|
|
8
|
+
export { l as ToggleSwitch, b as default };
|
|
9
|
+
//# sourceMappingURL=out.js.map
|
|
10
|
+
//# sourceMappingURL=toggleswitch.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/toggleswitch.tsx"],"names":["import_prop_types","forwardRef","jsx","jsxs","ToggleSwitch","props","ref","__spreadValues","toggleswitch_default","PropTypes"],"mappings":"yFAEA,IAAAA,EAAsB,OADtB,OAAS,cAAAC,MAAkB,QAKvB,OAKE,OAAAC,EALF,QAAAC,MAAA,oBAFG,IAAMC,EAAeH,EAAW,SAAsBI,EAAOC,EAAK,CACvE,OACEH,EAAC,SACC,UAAW,0CACTE,EAAM,UAAY,kCAGpB,UAAAH,EAAC,QAAAK,EAAA,CACC,GAAIF,EAAM,GACV,IAAKC,EACL,KAAK,WACL,UAAW,eACX,SAAUD,EAAM,UACZA,EACN,EACAH,EAAC,OAAI,UAAU,qYAAqY,EACnZG,EAAM,OACLH,EAAC,QAAK,MAAM,4DACT,SAAAG,EAAM,MACT,GAEJ,CAEJ,CAAC,EAEMG,EAAQJ,EAEfA,EAAa,UAAY,CACvB,GAAI,EAAAK,QAAU,OAAO,WACrB,QAAS,EAAAA,QAAU,KACnB,SAAU,EAAAA,QAAU,KACpB,SAAU,EAAAA,QAAU,KACpB,MAAO,EAAAA,QAAU,MACnB","sourcesContent":["//@ts-nocheck\nimport { forwardRef } from \"react\";\nimport PropTypes from \"prop-types\";\n\nexport const ToggleSwitch = forwardRef(function ToggleSwitch(props, ref) {\n return (\n <label\n className={`relative mb-5 inline-flex items-center ${\n props.disabled && \"cursor-not-allowed opacity-50\"\n }`}\n >\n <input\n id={props.id}\n ref={ref}\n type=\"checkbox\"\n className={`peer sr-only`}\n onChange={props.onChange}\n {...props}\n />\n <div className=\"peer h-6 w-11 rounded-full bg-gray-200 after:absolute after:start-[2px] after:top-0.5 after:h-5 after:w-5 after:rounded-full after:border after:border-gray-300 after:bg-white after:transition-all after:content-[''] peer-checked:bg-blue-600 peer-checked:after:translate-x-full peer-checked:after:border-white rtl:peer-checked:after:-translate-x-full dark:border-gray-600 dark:bg-gray-700\" />\n {props.label && (\n <span class=\"ms-3 text-sm font-medium text-gray-900 dark:text-gray-300\">\n {props.label}\n </span>\n )}\n </label>\n );\n});\n\nexport default ToggleSwitch;\n\nToggleSwitch.propTypes = {\n id: PropTypes.string.isRequired,\n checked: PropTypes.bool,\n disabled: PropTypes.bool,\n onChange: PropTypes.func,\n label: PropTypes.string,\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/package.json
CHANGED
package/src/button.tsx
CHANGED
|
@@ -1,38 +1,145 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
import { variantProps } from "classname-variants/react";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const buttonProps = variantProps({
|
|
5
|
+
base: "group flex items-stretch items-center justify-center p-0.5 text-center font-medium relative focus:z-10 focus:outline-none rounded-lg",
|
|
6
|
+
variants: {
|
|
7
|
+
color: {
|
|
8
|
+
default:
|
|
9
|
+
"focus:outline-none text-white bg-cyan-700 border border-transparent enabled:hover:bg-cyan-800 focus:ring-cyan-300 dark:bg-cyan-600 dark:enabled:hover:bg-cyan-700 dark:focus:ring-cyan-800 rounded-lg focus:ring-2",
|
|
10
|
+
dark: "enabled:hover:bg-gray-900 focus:ring-4 focus:ring-gray-300 dark:bg-gray-800 dark:enabled:hover:bg-gray-700 dark:focus:ring-gray-800 dark:border-gray-700",
|
|
11
|
+
failure:
|
|
12
|
+
"enabled:hover:bg-red-800 focus:ring-4 focus:ring-red-300 dark:enabled:hover:bg-red-700 dark:focus:ring-red-900",
|
|
13
|
+
gray: "text-gray-900 bg-white border border-gray-200 enabled:hover:bg-gray-100 enabled:hover:text-cyan-700 :ring-cyan-700 focus:text-cyan-700 dark:bg-transparent dark:text-gray-400 dark:border-gray-600 dark:enabled:hover:text-white dark:enabled:hover:bg-gray-700 focus:ring-2",
|
|
14
|
+
info: "enabled:hover:bg-cyan-800 focus:ring-4 focus:ring-cyan-300 dark:bg-cyan-600 dark:enabled:hover:bg-cyan-700 dark:focus:ring-cyan-800",
|
|
15
|
+
light:
|
|
16
|
+
"text-gray-900 bg-white border border-gray-300 enabled:hover:bg-gray-100 focus:ring-4 focus:ring-cyan-300 dark:bg-gray-600 dark:text-white dark:border-gray-600 dark:enabled:hover:bg-gray-700 dark:enabled:hover:border-gray-700 dark:focus:ring-gray-700",
|
|
17
|
+
success:
|
|
18
|
+
"enabled:hover:bg-green-800 focus:ring-4 focus:ring-green-300 dark:enabled:hover:bg-green-700 dark:focus:ring-green-800",
|
|
19
|
+
warning:
|
|
20
|
+
"enabled:hover:bg-yellow-500 focus:ring-4 focus:ring-yellow-300 dark:focus:ring-yellow-900",
|
|
21
|
+
},
|
|
22
|
+
disabled: {
|
|
23
|
+
true: "cursor-not-allowed opacity-50",
|
|
24
|
+
false: "",
|
|
25
|
+
},
|
|
26
|
+
outline: {
|
|
27
|
+
true: "border bg-transparent",
|
|
28
|
+
false: "",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
compoundVariants: [
|
|
32
|
+
{
|
|
33
|
+
variants: {
|
|
34
|
+
color: "dark",
|
|
35
|
+
outline: true,
|
|
36
|
+
},
|
|
37
|
+
className: "text-gray-800 border-gray-800 hover:text-white",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
variants: {
|
|
41
|
+
color: "dark",
|
|
42
|
+
outline: false,
|
|
43
|
+
},
|
|
44
|
+
className: "border-0 text-white bg-gray-800",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
variants: {
|
|
48
|
+
color: "failure",
|
|
49
|
+
outline: true,
|
|
50
|
+
},
|
|
51
|
+
className: "text-red-700 border-red-700 hover:text-white",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
variants: {
|
|
55
|
+
color: "failure",
|
|
56
|
+
outline: false,
|
|
57
|
+
},
|
|
58
|
+
className: "border-0 text-white bg-red-700",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
variants: {
|
|
62
|
+
color: "info",
|
|
63
|
+
outline: true,
|
|
64
|
+
},
|
|
65
|
+
className: "text-cyan-700 border-cyan-700 hover:text-white",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
variants: {
|
|
69
|
+
color: "info",
|
|
70
|
+
outline: false,
|
|
71
|
+
},
|
|
72
|
+
className: "text-white bg-cyan-700",
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
variants: {
|
|
76
|
+
color: "success",
|
|
77
|
+
outline: true,
|
|
78
|
+
},
|
|
79
|
+
className: "text-green-700 border-green-700 hover:text-white",
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
variants: {
|
|
83
|
+
color: "success",
|
|
84
|
+
outline: false,
|
|
85
|
+
},
|
|
86
|
+
className: "text-white bg-green-700",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
variants: {
|
|
90
|
+
color: "warning",
|
|
91
|
+
outline: true,
|
|
92
|
+
},
|
|
93
|
+
className: "text-yellow-400 border-yellow-400 hover:text-white",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
variants: {
|
|
97
|
+
color: "warning",
|
|
98
|
+
outline: false,
|
|
99
|
+
},
|
|
100
|
+
className: "text-white bg-yellow-400",
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
variants: {
|
|
104
|
+
color: "gray",
|
|
105
|
+
outline: true,
|
|
106
|
+
},
|
|
107
|
+
className:
|
|
108
|
+
"text-gray-900 bg-white hover:text-white border border-gray-200",
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
variants: {
|
|
112
|
+
color: "gray",
|
|
113
|
+
outline: false,
|
|
114
|
+
},
|
|
115
|
+
className: "text-gray-900 bg-white border border-gray-200",
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const sizes = Object.freeze({
|
|
121
|
+
xs: "text-xs px-2 py-1",
|
|
122
|
+
sm: "text-sm px-3 py-1.5",
|
|
123
|
+
md: "text-sm px-4 py-2",
|
|
124
|
+
lg: "text-base px-5 py-2.5",
|
|
125
|
+
xl: "text-base px-6 py-3",
|
|
126
|
+
});
|
|
7
127
|
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
128
|
+
export function Button({
|
|
129
|
+
color = "default",
|
|
130
|
+
disabled,
|
|
131
|
+
outline,
|
|
132
|
+
size = "md",
|
|
133
|
+
children,
|
|
134
|
+
...props
|
|
135
|
+
}) {
|
|
136
|
+
return (
|
|
137
|
+
<button {...buttonProps({ color, disabled, outline })} {...props}>
|
|
138
|
+
<span
|
|
139
|
+
className={`flex items-center rounded-md transition-all duration-200 ${sizes[size]}`}
|
|
21
140
|
>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/>
|
|
26
|
-
<path
|
|
27
|
-
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
|
|
28
|
-
fill="currentColor"
|
|
29
|
-
/>
|
|
30
|
-
</svg>
|
|
31
|
-
{children}
|
|
32
|
-
</FlowbiteButton>
|
|
33
|
-
) : (
|
|
34
|
-
<FlowbiteButton ref={ref} {...props}>
|
|
35
|
-
{children}
|
|
36
|
-
</FlowbiteButton>
|
|
141
|
+
{children}
|
|
142
|
+
</span>
|
|
143
|
+
</button>
|
|
37
144
|
);
|
|
38
|
-
}
|
|
145
|
+
}
|
package/src/card.tsx
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
3
|
+
|
|
4
|
+
export function Card({ className, children, ...props }) {
|
|
5
|
+
return (
|
|
6
|
+
<div
|
|
7
|
+
className={twMerge(
|
|
8
|
+
"flex flex-col rounded-lg border border-gray-200 bg-white px-5 py-4 shadow-sm dark:border-gray-700 dark:bg-gray-800",
|
|
9
|
+
className && className
|
|
10
|
+
)}
|
|
11
|
+
{...props}
|
|
12
|
+
>
|
|
13
|
+
<div className="flex h-full flex-col justify-center gap-4">
|
|
14
|
+
{children}
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
}
|
package/src/index.tsx
CHANGED
package/src/page-header.tsx
CHANGED
package/src/radio.tsx
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
|
|
5
|
+
export const Radio = forwardRef(function Radio(props, ref) {
|
|
6
|
+
return (
|
|
7
|
+
<div className="flex items-center">
|
|
8
|
+
<input
|
|
9
|
+
id={props.id}
|
|
10
|
+
ref={ref}
|
|
11
|
+
type="radio"
|
|
12
|
+
className={`h-4 w-4 rounded-full border-gray-300 bg-gray-100 text-blue-600 focus:ring-2 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:ring-offset-gray-800 dark:focus:ring-blue-600 ${
|
|
13
|
+
disabled && "opacity-50"
|
|
14
|
+
}`}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
Radio.propTypes = {
|
|
22
|
+
id: PropTypes.string.isRequired,
|
|
23
|
+
checked: PropTypes.bool,
|
|
24
|
+
disabled: PropTypes.bool,
|
|
25
|
+
onChange: PropTypes.func,
|
|
26
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { variantProps } from "classname-variants/react";
|
|
4
|
+
import PropTypes from "prop-types";
|
|
5
|
+
|
|
6
|
+
const textInputProps = variantProps({
|
|
7
|
+
base: "block p-2.5 w-full text-sm border text-sm rounded-lg",
|
|
8
|
+
variants: {
|
|
9
|
+
color: {
|
|
10
|
+
success:
|
|
11
|
+
"bg-green-50 border border-green-500 text-green-900 dark:text-green-400 placeholder-green-700 dark:placeholder-green-500 text-sm focus:ring-green-500 focus:border-green-500 block w-full p-2.5 dark:bg-gray-700 dark:border-green-500",
|
|
12
|
+
failure:
|
|
13
|
+
"bg-red-50 border border-red-500 text-red-900 placeholder-red-700 text-sm rounded-lg focus:ring-red-500 dark:bg-gray-700 focus:border-red-500 block w-full p-2.5 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500",
|
|
14
|
+
gray: "text-gray-900 bg-gray-50 border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
color: "gray",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const iconProps = variantProps({
|
|
23
|
+
base: "block p-2.5 w-full text-sm border text-sm rounded-lg ps-10",
|
|
24
|
+
variants: {
|
|
25
|
+
color: {
|
|
26
|
+
success:
|
|
27
|
+
"bg-green-50 border border-green-500 text-green-900 dark:text-green-400 placeholder-green-700 dark:placeholder-green-500 text-sm focus:ring-green-500 focus:border-green-500 block w-full p-2.5 dark:bg-gray-700 dark:border-green-500",
|
|
28
|
+
failure:
|
|
29
|
+
"bg-red-50 border border-red-500 text-red-900 placeholder-red-700 text-sm rounded-lg focus:ring-red-500 dark:bg-gray-700 focus:border-red-500 block w-full p-2.5 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500",
|
|
30
|
+
gray: "text-gray-900 bg-gray-50 border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
defaultVariants: {
|
|
34
|
+
color: "gray",
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const addonProps = variantProps({
|
|
39
|
+
base: "block p-2.5 w-full text-sm border min-w-0 flex-1 rounded-none rounded-r-lg",
|
|
40
|
+
variants: {
|
|
41
|
+
color: {
|
|
42
|
+
success:
|
|
43
|
+
"bg-green-50 border border-green-500 text-green-900 dark:text-green-400 placeholder-green-700 dark:placeholder-green-500 text-sm focus:ring-green-500 focus:border-green-500 block w-full p-2.5 dark:bg-gray-700 dark:border-green-500",
|
|
44
|
+
failure:
|
|
45
|
+
"bg-red-50 border border-red-500 text-red-900 placeholder-red-700 text-sm rounded-lg focus:ring-red-500 dark:bg-gray-700 focus:border-red-500 block w-full p-2.5 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500",
|
|
46
|
+
gray: "text-gray-900 bg-gray-50 border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
defaultVariants: {
|
|
50
|
+
color: "gray",
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export const TextInput = forwardRef(function TextInput(props, ref) {
|
|
55
|
+
const { color, disabled, type, placeholder, id, icon, addon } = props;
|
|
56
|
+
if (icon) {
|
|
57
|
+
return (
|
|
58
|
+
<div className="relative">
|
|
59
|
+
<div className="pointer-events-none absolute inset-y-0 start-0 flex items-center ps-3.5">
|
|
60
|
+
{icon}
|
|
61
|
+
</div>
|
|
62
|
+
<div className={disabled && "cursor-not-allowed opacity-50"}>
|
|
63
|
+
<input
|
|
64
|
+
{...iconProps({ color })}
|
|
65
|
+
type={type ? type : "text"}
|
|
66
|
+
id={id}
|
|
67
|
+
placeholder={placeholder || "Enter your tet here ..."}
|
|
68
|
+
{...props}
|
|
69
|
+
/>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
} else if (addon) {
|
|
74
|
+
return (
|
|
75
|
+
<div className={disabled ? "flex cursor-not-allowed opacity-50" : "flex"}>
|
|
76
|
+
<span className="rounded-e-0 inline-flex items-center rounded-s-md border border-gray-300 bg-gray-200 px-3 text-sm text-gray-900 dark:border-gray-600 dark:bg-gray-600 dark:text-gray-400">
|
|
77
|
+
{addon}
|
|
78
|
+
</span>
|
|
79
|
+
<input
|
|
80
|
+
{...addonProps({ color, disabled })}
|
|
81
|
+
type={type ? type : "text"}
|
|
82
|
+
id={id}
|
|
83
|
+
placeholder={placeholder || "Enter your text here..."}
|
|
84
|
+
{...props}
|
|
85
|
+
/>
|
|
86
|
+
</div>
|
|
87
|
+
);
|
|
88
|
+
} else {
|
|
89
|
+
return (
|
|
90
|
+
<div
|
|
91
|
+
className={
|
|
92
|
+
disabled ? "relative cursor-not-allowed opacity-50" : "relative"
|
|
93
|
+
}
|
|
94
|
+
>
|
|
95
|
+
<input
|
|
96
|
+
type={type ? type : "text"}
|
|
97
|
+
ref={ref}
|
|
98
|
+
id={id}
|
|
99
|
+
{...textInputProps({ color, disabled })}
|
|
100
|
+
placeholder={placeholder || "Enter your text here..."}
|
|
101
|
+
disabled={false}
|
|
102
|
+
{...props}
|
|
103
|
+
/>
|
|
104
|
+
</div>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
TextInput.propTypes = {
|
|
110
|
+
/** Unique id for the TextInput Component */
|
|
111
|
+
id: PropTypes.string.isRequired,
|
|
112
|
+
/** Optional placeholder text for TextInput Component */
|
|
113
|
+
placeholder: PropTypes.string,
|
|
114
|
+
/** Optional color defaults to gray. Failure and Success options available*/
|
|
115
|
+
color: PropTypes.oneOf(["gray", "failure", "success"]),
|
|
116
|
+
/** Optional icon TextInput Component */
|
|
117
|
+
icon: PropTypes.element,
|
|
118
|
+
/** Optional addon TextInput Component */
|
|
119
|
+
addon: PropTypes.element,
|
|
120
|
+
/** Optional to disable component */
|
|
121
|
+
disabled: PropTypes.boolean,
|
|
122
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
|
|
5
|
+
export const ToggleSwitch = forwardRef(function ToggleSwitch(props, ref) {
|
|
6
|
+
return (
|
|
7
|
+
<label
|
|
8
|
+
className={`relative mb-5 inline-flex items-center ${
|
|
9
|
+
props.disabled && "cursor-not-allowed opacity-50"
|
|
10
|
+
}`}
|
|
11
|
+
>
|
|
12
|
+
<input
|
|
13
|
+
id={props.id}
|
|
14
|
+
ref={ref}
|
|
15
|
+
type="checkbox"
|
|
16
|
+
className={`peer sr-only`}
|
|
17
|
+
onChange={props.onChange}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
<div className="peer h-6 w-11 rounded-full bg-gray-200 after:absolute after:start-[2px] after:top-0.5 after:h-5 after:w-5 after:rounded-full after:border after:border-gray-300 after:bg-white after:transition-all after:content-[''] peer-checked:bg-blue-600 peer-checked:after:translate-x-full peer-checked:after:border-white rtl:peer-checked:after:-translate-x-full dark:border-gray-600 dark:bg-gray-700" />
|
|
21
|
+
{props.label && (
|
|
22
|
+
<span class="ms-3 text-sm font-medium text-gray-900 dark:text-gray-300">
|
|
23
|
+
{props.label}
|
|
24
|
+
</span>
|
|
25
|
+
)}
|
|
26
|
+
</label>
|
|
27
|
+
);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export default ToggleSwitch;
|
|
31
|
+
|
|
32
|
+
ToggleSwitch.propTypes = {
|
|
33
|
+
id: PropTypes.string.isRequired,
|
|
34
|
+
checked: PropTypes.bool,
|
|
35
|
+
disabled: PropTypes.bool,
|
|
36
|
+
onChange: PropTypes.func,
|
|
37
|
+
label: PropTypes.string,
|
|
38
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
import { useState, useEffect, useRef } from "react";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
|
|
5
|
+
export function ToolTip({ children, content, tooltopPos, width }) {
|
|
6
|
+
const tooltipRef = useRef();
|
|
7
|
+
const childRef = useRef();
|
|
8
|
+
|
|
9
|
+
const updateTooltipPosition = () => {
|
|
10
|
+
if (childRef.current && tooltipRef.current) {
|
|
11
|
+
const childRect = childRef.current.getBoundingClientRect();
|
|
12
|
+
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
13
|
+
const positions = ["top", "right", "bottom", "left"];
|
|
14
|
+
|
|
15
|
+
// Find a position where the tooltip fits
|
|
16
|
+
const newPosition = positions.find((pos) => {
|
|
17
|
+
switch (pos) {
|
|
18
|
+
case "top":
|
|
19
|
+
return childRect.top >= tooltipRect.height;
|
|
20
|
+
case "right":
|
|
21
|
+
return window.innerWidth - childRect.right >= tooltipRect.width;
|
|
22
|
+
case "bottom":
|
|
23
|
+
return window.innerHeight - childRect.bottom >= tooltipRect.height;
|
|
24
|
+
case "left":
|
|
25
|
+
return childRect.left >= tooltipRect.width;
|
|
26
|
+
default:
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
updateTooltipPosition();
|
|
35
|
+
window.addEventListener("resize", updateTooltipPosition);
|
|
36
|
+
|
|
37
|
+
return () => {
|
|
38
|
+
window.removeEventListener("resize", updateTooltipPosition);
|
|
39
|
+
};
|
|
40
|
+
}, []);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div className="group relative block w-fit p-2" ref={childRef}>
|
|
44
|
+
{children}
|
|
45
|
+
<div
|
|
46
|
+
className={clsx(
|
|
47
|
+
"invisible absolute z-50 w-full whitespace-normal break-words rounded-md bg-black px-3 py-1 text-xs text-white opacity-0 after:absolute after:h-0 after:w-0 after:border-solid group-hover:visible group-hover:opacity-100 dark:bg-gray-700",
|
|
48
|
+
{
|
|
49
|
+
top: "bottom-full left-1/2 -translate-x-1/2 after:-bottom-[4px] after:left-1/2 after:-translate-x-1/2 after:border-b-0 after:border-l-[5px] after:border-r-[5px] after:border-t-[5px] after:border-transparent after:border-t-black dark:after:border-t-gray-700",
|
|
50
|
+
right:
|
|
51
|
+
"left-full top-1/2 -translate-y-1/2 after:-left-[4px] after:top-1/2 after:-translate-y-1/2 after:border-b-[5px] after:border-l-[0px] after:border-r-[5px] after:border-t-[5px] after:border-transparent after:border-r-black dark:after:border-r-gray-700",
|
|
52
|
+
bottom:
|
|
53
|
+
"left-1/2 top-full -translate-x-1/2 after:-top-[4px] after:left-1/2 after:-translate-x-1/2 after:border-b-[5px] after:border-l-[5px] after:border-r-[5px] after:border-t-[0px] after:border-transparent after:border-b-black dark:after:border-b-gray-700",
|
|
54
|
+
left: "right-full top-1/2 -translate-y-1/2 after:-right-[4px] after:top-1/2 after:-translate-y-1/2 after:border-b-[5px] after:border-l-[5px] after:border-r-[0px] after:border-t-[5px] after:border-transparent after:border-l-black dark:after:border-l-gray-700",
|
|
55
|
+
}[tooltopPos]
|
|
56
|
+
// takes the tooltip Positon and adds the relevant classes to the tooltip box to adjust the position of the box to the child element.
|
|
57
|
+
)}
|
|
58
|
+
ref={tooltipRef}
|
|
59
|
+
style={{ width: `${width}px` }}
|
|
60
|
+
>
|
|
61
|
+
{content}
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
}
|
package/dist/chunk-LN7UO7PK.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { c, b, a } from './chunk-RUPJ2ZHA.mjs';
|
|
2
|
-
import { Button } from 'flowbite-react';
|
|
3
|
-
import { forwardRef } from 'react';
|
|
4
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
-
|
|
6
|
-
var m=forwardRef(function(u,C){var a$1=u,{children:i}=a$1,t=c(a$1,["children"]);return t.isLoading?jsxs(Button,b(a({ref:C},t),{disabled:!0,children:[jsxs("svg",{"aria-hidden":"true",role:"status",className:"mr-3 inline h-4 w-4 animate-spin text-white",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"#E5E7EB"}),jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentColor"})]}),i]})):jsx(Button,b(a({ref:C},t),{children:i}))});
|
|
7
|
-
|
|
8
|
-
export { m as a };
|
|
9
|
-
//# sourceMappingURL=out.js.map
|
|
10
|
-
//# sourceMappingURL=chunk-LN7UO7PK.mjs.map
|