@iziui/react 0.0.55-rc → 0.0.57-rc

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.
Files changed (112) hide show
  1. package/dist/chunks/{Alert-Dydy5gdK.js → Alert-B7KYsvPS.js} +2 -2
  2. package/dist/chunks/{Alert-Dydy5gdK.js.map → Alert-B7KYsvPS.js.map} +1 -1
  3. package/dist/chunks/{Alert-BZtq_ZmI.cjs → Alert-D81ZTqW0.cjs} +2 -2
  4. package/dist/chunks/{Alert-BZtq_ZmI.cjs.map → Alert-D81ZTqW0.cjs.map} +1 -1
  5. package/dist/chunks/{Box-DRV8oI-_.js → Box-CVJ6oQ5Z.js} +2 -2
  6. package/dist/chunks/{Box-DRV8oI-_.js.map → Box-CVJ6oQ5Z.js.map} +1 -1
  7. package/dist/chunks/{Box-B3hTyhaq.cjs → Box-phfkLmqG.cjs} +2 -2
  8. package/dist/chunks/{Box-B3hTyhaq.cjs.map → Box-phfkLmqG.cjs.map} +1 -1
  9. package/dist/chunks/{ButtonIcon-CwmXuxvw.js → ButtonIcon-Hx1VrCD_.js} +2 -2
  10. package/dist/chunks/{ButtonIcon-CwmXuxvw.js.map → ButtonIcon-Hx1VrCD_.js.map} +1 -1
  11. package/dist/chunks/{ButtonIcon-BdTxTa54.cjs → ButtonIcon-zVEr-CLA.cjs} +2 -2
  12. package/dist/chunks/{ButtonIcon-BdTxTa54.cjs.map → ButtonIcon-zVEr-CLA.cjs.map} +1 -1
  13. package/dist/chunks/{Card-BNdbHjy2.cjs → Card-DCz0DVsL.cjs} +2 -2
  14. package/dist/chunks/{Card-BNdbHjy2.cjs.map → Card-DCz0DVsL.cjs.map} +1 -1
  15. package/dist/chunks/{Card-CKCzaI7j.js → Card-DE8e0HfC.js} +2 -2
  16. package/dist/chunks/{Card-CKCzaI7j.js.map → Card-DE8e0HfC.js.map} +1 -1
  17. package/dist/chunks/{CardContent-ywggix6Q.js → CardContent-BUVN69Wu.js} +2 -2
  18. package/dist/chunks/{CardContent-ywggix6Q.js.map → CardContent-BUVN69Wu.js.map} +1 -1
  19. package/dist/chunks/{CardContent-BNxQiVc2.cjs → CardContent-CIsEbHXy.cjs} +2 -2
  20. package/dist/chunks/{CardContent-BNxQiVc2.cjs.map → CardContent-CIsEbHXy.cjs.map} +1 -1
  21. package/dist/chunks/{Drawer-CTmTDUBF.cjs → Drawer-CBca7Wbq.cjs} +2 -2
  22. package/dist/chunks/{Drawer-CTmTDUBF.cjs.map → Drawer-CBca7Wbq.cjs.map} +1 -1
  23. package/dist/chunks/{Drawer-CVnRBzFN.js → Drawer-DSSPw818.js} +2 -2
  24. package/dist/chunks/{Drawer-CVnRBzFN.js.map → Drawer-DSSPw818.js.map} +1 -1
  25. package/dist/chunks/{Icon-7g25Bfa3.cjs → Icon-DIpi3iH3.cjs} +2 -2
  26. package/dist/chunks/{Icon-7g25Bfa3.cjs.map → Icon-DIpi3iH3.cjs.map} +1 -1
  27. package/dist/chunks/{Icon-D-uCpp04.js → Icon-DxvM9zZ-.js} +2 -2
  28. package/dist/chunks/{Icon-D-uCpp04.js.map → Icon-DxvM9zZ-.js.map} +1 -1
  29. package/dist/chunks/{MenuButton-BqsEHGiP.cjs → MenuButton-DtJ9D-2D.cjs} +2 -2
  30. package/dist/chunks/{MenuButton-BqsEHGiP.cjs.map → MenuButton-DtJ9D-2D.cjs.map} +1 -1
  31. package/dist/chunks/{MenuButton-CDNaWpre.js → MenuButton-iXeLCqcZ.js} +2 -2
  32. package/dist/chunks/{MenuButton-CDNaWpre.js.map → MenuButton-iXeLCqcZ.js.map} +1 -1
  33. package/dist/chunks/{Stack-D2Y2T_wh.js → Stack-DCtLO2p3.js} +2 -2
  34. package/dist/chunks/{Stack-D2Y2T_wh.js.map → Stack-DCtLO2p3.js.map} +1 -1
  35. package/dist/chunks/{Stack-CTcHQ_9x.cjs → Stack-tYlHcxX7.cjs} +2 -2
  36. package/dist/chunks/{Stack-CTcHQ_9x.cjs.map → Stack-tYlHcxX7.cjs.map} +1 -1
  37. package/dist/chunks/{Typography-DMnJRugi.cjs → Typography-55nrlAH3.cjs} +2 -2
  38. package/dist/chunks/{Typography-DMnJRugi.cjs.map → Typography-55nrlAH3.cjs.map} +1 -1
  39. package/dist/chunks/{Typography-BcgZRln8.js → Typography-on8-n-Tv.js} +2 -2
  40. package/dist/chunks/{Typography-BcgZRln8.js.map → Typography-on8-n-Tv.js.map} +1 -1
  41. package/dist/chunks/{createComponent-Ds819n7r.cjs → createComponent-C-z8CItQ.cjs} +2 -2
  42. package/dist/chunks/{createComponent-Ds819n7r.cjs.map → createComponent-C-z8CItQ.cjs.map} +1 -1
  43. package/dist/chunks/{createComponent-DhHk-x5v.js → createComponent-D8CZM3yo.js} +2 -2
  44. package/dist/chunks/{createComponent-DhHk-x5v.js.map → createComponent-D8CZM3yo.js.map} +1 -1
  45. package/dist/chunks/{useMenu-CBWhhu1S.cjs → useMenu-DefCcCue.cjs} +2 -2
  46. package/dist/chunks/{useMenu-CBWhhu1S.cjs.map → useMenu-DefCcCue.cjs.map} +1 -1
  47. package/dist/chunks/{useMenu-s6oyzklj.js → useMenu-FQ50ImC2.js} +2 -2
  48. package/dist/chunks/{useMenu-s6oyzklj.js.map → useMenu-FQ50ImC2.js.map} +1 -1
  49. package/dist/chunks/{useTheme-BZ0xkY68.cjs → useTheme-C83CaSLO.cjs} +1 -1
  50. package/dist/chunks/{useTheme-BZ0xkY68.cjs.map → useTheme-C83CaSLO.cjs.map} +1 -1
  51. package/dist/chunks/{useTheme-BhIs8Txu.js → useTheme-DNLVLxKW.js} +1 -1
  52. package/dist/chunks/{useTheme-BhIs8Txu.js.map → useTheme-DNLVLxKW.js.map} +1 -1
  53. package/dist/components/Alert/index.cjs +1 -1
  54. package/dist/components/Alert/index.js +1 -1
  55. package/dist/components/Avatar/index.cjs +1 -1
  56. package/dist/components/Avatar/index.js +1 -1
  57. package/dist/components/Box/index.cjs +1 -1
  58. package/dist/components/Box/index.js +1 -1
  59. package/dist/components/Button/index.cjs +1 -1
  60. package/dist/components/Button/index.js +1 -1
  61. package/dist/components/ButtonIcon/index.cjs +1 -1
  62. package/dist/components/ButtonIcon/index.js +1 -1
  63. package/dist/components/Card/index.cjs +1 -1
  64. package/dist/components/Card/index.js +1 -1
  65. package/dist/components/Checkbox/index.cjs +1 -1
  66. package/dist/components/Checkbox/index.js +1 -1
  67. package/dist/components/CheckboxGroup/index.cjs +1 -1
  68. package/dist/components/CheckboxGroup/index.js +1 -1
  69. package/dist/components/Chip/index.cjs +1 -1
  70. package/dist/components/Chip/index.js +1 -1
  71. package/dist/components/ColorPicker/index.cjs +1 -1
  72. package/dist/components/ColorPicker/index.js +1 -1
  73. package/dist/components/Container/index.cjs +1 -1
  74. package/dist/components/Container/index.js +1 -1
  75. package/dist/components/Divider/index.cjs +1 -1
  76. package/dist/components/Divider/index.js +1 -1
  77. package/dist/components/Drawer/index.cjs +1 -1
  78. package/dist/components/Drawer/index.js +1 -1
  79. package/dist/components/Icon/index.cjs +1 -1
  80. package/dist/components/Icon/index.js +1 -1
  81. package/dist/components/Input/index.cjs +1 -1
  82. package/dist/components/Input/index.js +1 -1
  83. package/dist/components/InputFile/index.cjs +1 -1
  84. package/dist/components/InputFile/index.js +1 -1
  85. package/dist/components/Loading/index.cjs +1 -1
  86. package/dist/components/Loading/index.js +1 -1
  87. package/dist/components/Menu/index.cjs +1 -1
  88. package/dist/components/Menu/index.js +1 -1
  89. package/dist/components/Modal/index.cjs +1 -1
  90. package/dist/components/Modal/index.js +1 -1
  91. package/dist/components/Select/index.cjs +1 -1
  92. package/dist/components/Select/index.js +1 -1
  93. package/dist/components/Skeleton/index.cjs +1 -1
  94. package/dist/components/Skeleton/index.js +1 -1
  95. package/dist/components/Stack/index.cjs +1 -1
  96. package/dist/components/Stack/index.js +1 -1
  97. package/dist/components/Switchs/index.cjs +1 -1
  98. package/dist/components/Switchs/index.js +1 -1
  99. package/dist/components/Table/index.cjs +1 -1
  100. package/dist/components/Table/index.js +1 -1
  101. package/dist/components/Toast/index.cjs +1 -1
  102. package/dist/components/Toast/index.js +1 -1
  103. package/dist/components/Tooltip/index.cjs +1 -1
  104. package/dist/components/Tooltip/index.js +1 -1
  105. package/dist/components/Typography/index.cjs +1 -1
  106. package/dist/components/Typography/index.js +1 -1
  107. package/dist/index.cjs +1 -1
  108. package/dist/index.js +1 -1
  109. package/dist/style.css +2 -2
  110. package/dist/theme/index.cjs +1 -1
  111. package/dist/theme/index.js +1 -1
  112. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- import{jsx as P}from"react/jsx-runtime";import{b,c as M,d as S}from"./index-CZ41y9Hn.js";import{u as y}from"./useTheme-BhIs8Txu.js";function B({sx:t,theme:n},...e){return e.reduce((s,a)=>(s={...s,...a(n,t)},s),{})}const w=(t,{color:n})=>{const{palette:e}=t;return n?{color:n(e)}:{}},_=(t,{background:n})=>{const{palette:e}=t;return n?{background:n(e)}:{}},j=(t,{borderColor:n})=>{const{palette:e}=t;return n?{borderColor:n(e)}:{}},C=(t,{backgroundColor:n})=>{const{palette:e}=t;return n?{backgroundColor:n(e)}:{}},O=(t,{borderRadius:n})=>{const{shape:e}=t;return n?{borderRadius:`${e.radius*n}px`}:{}},R=(t,{m:n,mb:e,ml:s,mr:a,mt:i,mx:u,my:g})=>{const{spacing:f}=t,o=c=>c||c===0?`${String(c*f)}px`:"",r=o(n),h=o(i),m=o(e),d=o(g),l=o(u),p=o(s),x=o(a);return{margin:r,marginTop:h||d||r,marginBottom:m||d||r,marginLeft:p||l||r,marginRight:x||l||r}},T=(t,{p:n,pb:e,pl:s,pr:a,pt:i,px:u,py:g})=>{const{spacing:f}=t,o=c=>c||c===0?`${String(c*f)}px`:"",r=o(n),h=o(i),m=o(e),d=o(g),l=o(u),p=o(s),x=o(a);return{padding:r,paddingTop:h||d||r,paddingBottom:m||d||r,paddingLeft:p||l||r,paddingRight:x||l||r}},z=(t,{boxShadow:n})=>n?{boxShadow:{sm:S,md:M,lg:b}[n]}:{},L=Object.freeze(Object.defineProperty({__proto__:null,defineBackground:_,defineBackgroundColor:C,defineBorderColor:j,defineBorderRadius:O,defineBoxShadow:z,defineColor:w,defineMargin:R,definePadding:T},Symbol.toStringTag,{value:"Module"}));function $(t){return Object.values(t).map(n=>n)}function N(t){return t.displayName=t.name,({sx:e,fullWidth:s,...a})=>{const{theme:i}=y(),u=e&&B({theme:i,sx:e},...$(L));return console.log(">>> fullWidth",s),P(t,{...a,style:{...a.style,...u,...s?{width:"100%"}:{}}})}}export{N as c};
2
- //# sourceMappingURL=createComponent-DhHk-x5v.js.map
1
+ import{jsx as P}from"react/jsx-runtime";import{b,c as M,d as S}from"./index-CZ41y9Hn.js";import{u as y}from"./useTheme-DNLVLxKW.js";function B({sx:t,theme:n},...e){return e.reduce((s,a)=>(s={...s,...a(n,t)},s),{})}const w=(t,{color:n})=>{const{palette:e}=t;return n?{color:n(e)}:{}},_=(t,{background:n})=>{const{palette:e}=t;return n?{background:n(e)}:{}},j=(t,{borderColor:n})=>{const{palette:e}=t;return n?{borderColor:n(e)}:{}},C=(t,{backgroundColor:n})=>{const{palette:e}=t;return n?{backgroundColor:n(e)}:{}},O=(t,{borderRadius:n})=>{const{shape:e}=t;return n?{borderRadius:`${e.radius*n}px`}:{}},R=(t,{m:n,mb:e,ml:s,mr:a,mt:i,mx:u,my:g})=>{const{spacing:f}=t,o=c=>c||c===0?`${String(c*f)}px`:"",r=o(n),h=o(i),m=o(e),d=o(g),l=o(u),p=o(s),x=o(a);return{margin:r,marginTop:h||d||r,marginBottom:m||d||r,marginLeft:p||l||r,marginRight:x||l||r}},T=(t,{p:n,pb:e,pl:s,pr:a,pt:i,px:u,py:g})=>{const{spacing:f}=t,o=c=>c||c===0?`${String(c*f)}px`:"",r=o(n),h=o(i),m=o(e),d=o(g),l=o(u),p=o(s),x=o(a);return{padding:r,paddingTop:h||d||r,paddingBottom:m||d||r,paddingLeft:p||l||r,paddingRight:x||l||r}},z=(t,{boxShadow:n})=>n?{boxShadow:{sm:S,md:M,lg:b}[n]}:{},L=Object.freeze(Object.defineProperty({__proto__:null,defineBackground:_,defineBackgroundColor:C,defineBorderColor:j,defineBorderRadius:O,defineBoxShadow:z,defineColor:w,defineMargin:R,definePadding:T},Symbol.toStringTag,{value:"Module"}));function $(t){return Object.values(t).map(n=>n)}function N(t){return t.displayName=t.name,({sx:e,fullWidth:s,...a})=>{const{theme:i}=y(),u=e&&B({theme:i,sx:e},...$(L));return console.log(">>> fullWidth",s),P(t,{...a,style:{...a.style,...u,...s?{width:"100%"}:{}}})}}export{N as c};
2
+ //# sourceMappingURL=createComponent-D8CZM3yo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createComponent-DhHk-x5v.js","sources":["../../../../core/src/options/createOptions/createOptions.ts","../../../../core/src/plugin/color/defineColor/defineColor.ts","../../../../core/src/plugin/color/defineBackground/defineBackground.ts","../../../../core/src/plugin/color/defineBorderColor/defineBorderColor.ts","../../../../core/src/plugin/color/defineBackgroundColor/defineBackgroundColor.ts","../../../../core/src/plugin/shape/defineBorderRadius/defineBorderRadius.ts","../../../../core/src/plugin/spacing/defineMargin/defineMargin.ts","../../../../core/src/plugin/spacing/definePadding/definePadding.ts","../../../../core/src/plugin/behavior/defineBoxShadow/defineBoxShadow.ts","../../src/core/createComponent.tsx"],"sourcesContent":["import type { Properties } from 'csstype';\n\nimport type { Plugin } from '../../plugin';\nimport type { ThemeBuilded } from '../../theme';\nimport type { CustomOptions } from '../CustomOptions';\n\ntype Data = {\n sx: CustomOptions;\n theme: ThemeBuilded;\n}\n\nexport default function createOptions({ sx, theme }: Data, ...plugins: Plugin[]): Properties {\n return plugins.reduce<Properties>((acc, plugin) => {\n acc = { ...acc, ...plugin(theme, sx) };\n\n return acc;\n }, {});\n}","import definePlugin from '../../definePlugin';\n\nexport default definePlugin((theme, { color }) => {\n const { palette } = theme;\n\n if (!color) { return {}; }\n\n return {\n color: color(palette)\n };\n});","import definePlugin from '../../definePlugin';\n\nexport default definePlugin((theme, { background }) => {\n const { palette } = theme;\n\n if (!background) { return {}; }\n\n return {\n background: background(palette)\n };\n});","import definePlugin from '../../definePlugin';\n\nexport default definePlugin((theme, { borderColor }) => {\n const { palette } = theme;\n\n if (!borderColor) { return {}; }\n\n return {\n borderColor: borderColor(palette)\n };\n});","import definePlugin from '../../definePlugin';\n\nexport default definePlugin((theme, { backgroundColor }) => {\n const { palette } = theme;\n\n if (!backgroundColor) { return {}; }\n\n return {\n backgroundColor: backgroundColor(palette)\n };\n});","import definePlugin from '../../definePlugin';\n\nexport default definePlugin((theme, { borderRadius }) => {\n const { shape } = theme;\n\n if (!borderRadius) { return {}; }\n\n return {\n borderRadius: `${shape.radius * borderRadius}px`\n };\n});","import definePlugin from '../../definePlugin';\n\nexport default definePlugin((theme, { m, mb, ml, mr, mt, mx, my }) => {\n const { spacing } = theme;\n\n const calculateMargin = (mg?: number) => {\n return !!mg || mg === 0 ? `${String(mg * spacing)}px` : '';\n };\n\n const hasM = calculateMargin(m);\n\n const hasMt = calculateMargin(mt);\n const hasMb = calculateMargin(mb);\n\n const hasMy = calculateMargin(my);\n const hasMx = calculateMargin(mx);\n\n const hasMl = calculateMargin(ml);\n const hasMr = calculateMargin(mr);\n\n return {\n margin: hasM,\n marginTop: hasMt || hasMy || hasM,\n marginBottom: hasMb || hasMy || hasM,\n marginLeft: hasMl || hasMx || hasM,\n marginRight: hasMr || hasMx || hasM,\n };\n});","import definePlugin from '../../definePlugin';\n\nexport default definePlugin((theme, { p, pb, pl, pr, pt, px, py }) => {\n const { spacing } = theme;\n\n const calculatePadding = (pd?: number) => {\n return !!pd || pd === 0 ? `${String(pd * spacing)}px` : '';\n };\n\n const hasP = calculatePadding(p);\n\n const hasPt = calculatePadding(pt);\n const hasPb = calculatePadding(pb);\n\n const hasPy = calculatePadding(py);\n const hasPx = calculatePadding(px);\n\n const hasPl = calculatePadding(pl);\n const hasPr = calculatePadding(pr);\n\n return {\n padding: hasP,\n paddingTop: hasPt || hasPy || hasP,\n paddingBottom: hasPb || hasPy || hasP,\n paddingLeft: hasPl || hasPx || hasP,\n paddingRight: hasPr || hasPx || hasP,\n };\n});","import { boxShadowSmall, boxShadowRegular, boxShadowLarge } from '@iziui/tokens/web/js';\n\nimport definePlugin from '../../definePlugin';\nimport type { CustomOptions } from '../../../options/CustomOptions';\n\ntype ExtractSize = NonNullable<CustomOptions['boxShadow']>;\n\nexport default definePlugin((_, { boxShadow }) => {\n\n if (!boxShadow) { return {}; }\n\n const sizes: { [s in ExtractSize]: string } = {\n sm: boxShadowSmall,\n md: boxShadowRegular,\n lg: boxShadowLarge,\n };\n\n return {\n boxShadow: sizes[boxShadow]\n };\n});","import type { ComponentType, FC } from 'react';\n\nimport type { Sx } from '@iziui/core/options';\nimport type { Plugin } from '@iziui/core/plugin';\nimport createOptions from '@iziui/core/options';\nimport * as plugins from '@iziui/core/plugin';\n\nimport { useTheme } from '@/theme';\n\nfunction extract(module: { [key: string]: Plugin }) {\n return Object.values(module).map((fn) => fn);\n}\n\nexport default function createComponent<P>(WrappedComponent: ComponentType<P>) {\n WrappedComponent.displayName = WrappedComponent.name;\n\n const EnhancedComponent: FC<Sx<P>> = ({ sx, fullWidth, ...props }) => {\n const { theme } = useTheme();\n\n const options = sx && createOptions({ theme, sx },\n ...extract(plugins),\n );\n\n console.log('>>> fullWidth', fullWidth);\n\n return (\n <WrappedComponent\n {...(props as P)}\n style={{\n ...props['style'],\n ...options,\n ...(fullWidth ? { width: '100%' } : {}),\n }}\n />\n );\n };\n\n return EnhancedComponent;\n}"],"names":["createOptions","sx","theme","plugins","acc","plugin","defineColor","color","palette","defineBackground","background","defineBorderColor","borderColor","defineBackgroundColor","backgroundColor","defineBorderRadius","borderRadius","shape","defineMargin","m","mb","ml","mr","mt","mx","my","spacing","calculateMargin","mg","hasM","hasMt","hasMb","hasMy","hasMx","hasMl","hasMr","definePadding","p","pb","pl","pr","pt","px","py","calculatePadding","pd","hasP","hasPt","hasPb","hasPy","hasPx","hasPl","hasPr","defineBoxShadow","_","boxShadow","boxShadowSmall","boxShadowRegular","boxShadowLarge","extract","module","fn","createComponent","WrappedComponent","fullWidth","props","useTheme","options","jsx"],"mappings":"oIAWA,SAAwBA,EAAc,CAAE,GAAAC,EAAI,MAAAC,CAAA,KAAkBC,EAA+B,CAC3F,OAAOA,EAAQ,OAAmB,CAACC,EAAKC,KACtCD,EAAM,CAAE,GAAGA,EAAK,GAAGC,EAAOH,EAAOD,CAAE,CAAA,EAE5BG,GACN,CAAA,CAAE,CACP,CCfA,MAAAE,EAA4B,CAACJ,EAAO,CAAE,MAAAK,KAAY,CAChD,KAAM,CAAE,QAAAC,GAAYN,EAEpB,OAAKK,EAEE,CACL,MAAOA,EAAMC,CAAO,CAAA,EAHD,CAAA,CAKvB,ECRAC,EAA4B,CAACP,EAAO,CAAE,WAAAQ,KAAiB,CACrD,KAAM,CAAE,QAAAF,GAAYN,EAEpB,OAAKQ,EAEE,CACL,WAAYA,EAAWF,CAAO,CAAA,EAHN,CAAA,CAK5B,ECRAG,EAA4B,CAACT,EAAO,CAAE,YAAAU,KAAkB,CACtD,KAAM,CAAE,QAAAJ,GAAYN,EAEpB,OAAKU,EAEE,CACL,YAAaA,EAAYJ,CAAO,CAAA,EAHP,CAAA,CAK7B,ECRAK,EAA4B,CAACX,EAAO,CAAE,gBAAAY,KAAsB,CAC1D,KAAM,CAAE,QAAAN,GAAYN,EAEpB,OAAKY,EAEE,CACL,gBAAiBA,EAAgBN,CAAO,CAAA,EAHX,CAAA,CAKjC,ECRAO,EAA4B,CAACb,EAAO,CAAE,aAAAc,KAAmB,CACvD,KAAM,CAAE,MAAAC,GAAUf,EAElB,OAAKc,EAEE,CACL,aAAc,GAAGC,EAAM,OAASD,CAAY,IAAA,EAHlB,CAAA,CAK9B,ECRAE,EAA4B,CAAChB,EAAO,CAAE,EAAAiB,EAAG,GAAAC,EAAI,GAAAC,EAAI,GAAAC,EAAI,GAAAC,EAAI,GAAAC,EAAI,GAAAC,KAAS,CACpE,KAAM,C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mC,CAClD,OAAO,OAAO,OAAOA,CAAM,EAAE,IAAKC,GAAOA,CAAE,CAC7C,CAEA,SAAwBC,EAAmBC,EAAoC,CAC7E,OAAAA,EAAiB,YAAcA,EAAiB,KAEX,CAAC,CAAE,GAAA9D,EAAI,UAAA+D,EAAW,GAAGC,KAAY,CACpE,KAAM,CAAE,MAAA/D,CAAA,EAAUgE,EAAA,EAEZC,EAAUlE,GAAMD,EAAc,CAAE,MAAAE,EAAO,GAAAD,CAAA,EAC3C,GAAG0D,EAAQxD,CAAO,CAAA,EAGpB,eAAQ,IAAI,gBAAiB6D,CAAS,EAGpCI,EAACL,EAAA,CACE,GAAIE,EACL,MAAO,CACL,GAAGA,EAAM,MACT,GAAGE,EACH,GAAIH,EAAY,CAAE,MAAO,QAAW,CAAA,CAAC,CACvC,CAAA,CAGN,CAGF"}
1
+ {"version":3,"file":"createComponent-D8CZM3yo.js","sources":["../../../../core/src/options/createOptions/createOptions.ts","../../../../core/src/plugin/color/defineColor/defineColor.ts","../../../../core/src/plugin/color/defineBackground/defineBackground.ts","../../../../core/src/plugin/color/defineBorderColor/defineBorderColor.ts","../../../../core/src/plugin/color/defineBackgroundColor/defineBackgroundColor.ts","../../../../core/src/plugin/shape/defineBorderRadius/defineBorderRadius.ts","../../../../core/src/plugin/spacing/defineMargin/defineMargin.ts","../../../../core/src/plugin/spacing/definePadding/definePadding.ts","../../../../core/src/plugin/behavior/defineBoxShadow/defineBoxShadow.ts","../../src/core/createComponent.tsx"],"sourcesContent":["import type { Properties } from 'csstype';\n\nimport type { Plugin } from '../../plugin';\nimport type { ThemeBuilded } from '../../theme';\nimport type { CustomOptions } from '../CustomOptions';\n\ntype Data = {\n sx: CustomOptions;\n theme: ThemeBuilded;\n}\n\nexport default function createOptions({ sx, theme }: Data, ...plugins: Plugin[]): Properties {\n return plugins.reduce<Properties>((acc, plugin) => {\n acc = { ...acc, ...plugin(theme, sx) };\n\n return acc;\n }, {});\n}","import definePlugin from '../../definePlugin';\n\nexport default definePlugin((theme, { color }) => {\n const { palette } = theme;\n\n if (!color) { return {}; }\n\n return {\n color: color(palette)\n };\n});","import definePlugin from '../../definePlugin';\n\nexport default definePlugin((theme, { background }) => {\n const { palette } = theme;\n\n if (!background) { return {}; }\n\n return {\n background: background(palette)\n };\n});","import definePlugin from '../../definePlugin';\n\nexport default definePlugin((theme, { borderColor }) => {\n const { palette } = theme;\n\n if (!borderColor) { return {}; }\n\n return {\n borderColor: borderColor(palette)\n };\n});","import definePlugin from '../../definePlugin';\n\nexport default definePlugin((theme, { backgroundColor }) => {\n const { palette } = theme;\n\n if (!backgroundColor) { return {}; }\n\n return {\n backgroundColor: backgroundColor(palette)\n };\n});","import definePlugin from '../../definePlugin';\n\nexport default definePlugin((theme, { borderRadius }) => {\n const { shape } = theme;\n\n if (!borderRadius) { return {}; }\n\n return {\n borderRadius: `${shape.radius * borderRadius}px`\n };\n});","import definePlugin from '../../definePlugin';\n\nexport default definePlugin((theme, { m, mb, ml, mr, mt, mx, my }) => {\n const { spacing } = theme;\n\n const calculateMargin = (mg?: number) => {\n return !!mg || mg === 0 ? `${String(mg * spacing)}px` : '';\n };\n\n const hasM = calculateMargin(m);\n\n const hasMt = calculateMargin(mt);\n const hasMb = calculateMargin(mb);\n\n const hasMy = calculateMargin(my);\n const hasMx = calculateMargin(mx);\n\n const hasMl = calculateMargin(ml);\n const hasMr = calculateMargin(mr);\n\n return {\n margin: hasM,\n marginTop: hasMt || hasMy || hasM,\n marginBottom: hasMb || hasMy || hasM,\n marginLeft: hasMl || hasMx || hasM,\n marginRight: hasMr || hasMx || hasM,\n };\n});","import definePlugin from '../../definePlugin';\n\nexport default definePlugin((theme, { p, pb, pl, pr, pt, px, py }) => {\n const { spacing } = theme;\n\n const calculatePadding = (pd?: number) => {\n return !!pd || pd === 0 ? `${String(pd * spacing)}px` : '';\n };\n\n const hasP = calculatePadding(p);\n\n const hasPt = calculatePadding(pt);\n const hasPb = calculatePadding(pb);\n\n const hasPy = calculatePadding(py);\n const hasPx = calculatePadding(px);\n\n const hasPl = calculatePadding(pl);\n const hasPr = calculatePadding(pr);\n\n return {\n padding: hasP,\n paddingTop: hasPt || hasPy || hasP,\n paddingBottom: hasPb || hasPy || hasP,\n paddingLeft: hasPl || hasPx || hasP,\n paddingRight: hasPr || hasPx || hasP,\n };\n});","import { boxShadowSmall, boxShadowRegular, boxShadowLarge } from '@iziui/tokens/web/js';\n\nimport definePlugin from '../../definePlugin';\nimport type { CustomOptions } from '../../../options/CustomOptions';\n\ntype ExtractSize = NonNullable<CustomOptions['boxShadow']>;\n\nexport default definePlugin((_, { boxShadow }) => {\n\n if (!boxShadow) { return {}; }\n\n const sizes: { [s in ExtractSize]: string } = {\n sm: boxShadowSmall,\n md: boxShadowRegular,\n lg: boxShadowLarge,\n };\n\n return {\n boxShadow: sizes[boxShadow]\n };\n});","import type { ComponentType, FC } from 'react';\n\nimport type { Sx } from '@iziui/core/options';\nimport type { Plugin } from '@iziui/core/plugin';\nimport createOptions from '@iziui/core/options';\nimport * as plugins from '@iziui/core/plugin';\n\nimport { useTheme } from '@/theme';\n\nfunction extract(module: { [key: string]: Plugin }) {\n return Object.values(module).map((fn) => fn);\n}\n\nexport default function createComponent<P>(WrappedComponent: ComponentType<P>) {\n WrappedComponent.displayName = WrappedComponent.name;\n\n const EnhancedComponent: FC<Sx<P>> = ({ sx, fullWidth, ...props }) => {\n const { theme } = useTheme();\n\n const options = sx && createOptions({ theme, sx },\n ...extract(plugins),\n );\n\n console.log('>>> fullWidth', fullWidth);\n\n return (\n <WrappedComponent\n {...(props as P)}\n style={{\n ...props['style'],\n ...options,\n ...(fullWidth ? { width: '100%' } : {}),\n }}\n />\n );\n };\n\n return EnhancedComponent;\n}"],"names":["createOptions","sx","theme","plugins","acc","plugin","defineColor","color","palette","defineBackground","background","defineBorderColor","borderColor","defineBackgroundColor","backgroundColor","defineBorderRadius","borderRadius","shape","defineMargin","m","mb","ml","mr","mt","mx","my","spacing","calculateMargin","mg","hasM","hasMt","hasMb","hasMy","hasMx","hasMl","hasMr","definePadding","p","pb","pl","pr","pt","px","py","calculatePadding","pd","hasP","hasPt","hasPb","hasPy","hasPx","hasPl","hasPr","defineBoxShadow","_","boxShadow","boxShadowSmall","boxShadowRegular","boxShadowLarge","extract","module","fn","createComponent","WrappedComponent","fullWidth","props","useTheme","options","jsx"],"mappings":"oIAWA,SAAwBA,EAAc,CAAE,GAAAC,EAAI,MAAAC,CAAA,KAAkBC,EAA+B,CAC3F,OAAOA,EAAQ,OAAmB,CAACC,EAAKC,KACtCD,EAAM,CAAE,GAAGA,EAAK,GAAGC,EAAOH,EAAOD,CAAE,CAAA,EAE5BG,GACN,CAAA,CAAE,CACP,CCfA,MAAAE,EAA4B,CAACJ,EAAO,CAAE,MAAAK,KAAY,CAChD,KAAM,CAAE,QAAAC,GAAYN,EAEpB,OAAKK,EAEE,CACL,MAAOA,EAAMC,CAAO,CAAA,EAHD,CAAA,CAKvB,ECRAC,EAA4B,CAACP,EAAO,CAAE,WAAAQ,KAAiB,CACrD,KAAM,CAAE,QAAAF,GAAYN,EAEpB,OAAKQ,EAEE,CACL,WAAYA,EAAWF,CAAO,CAAA,EAHN,CAAA,CAK5B,ECRAG,EAA4B,CAACT,EAAO,CAAE,YAAAU,KAAkB,CACtD,KAAM,CAAE,QAAAJ,GAAYN,EAEpB,OAAKU,EAEE,CACL,YAAaA,EAAYJ,CAAO,CAAA,EAHP,CAAA,CAK7B,ECRAK,EAA4B,CAACX,EAAO,CAAE,gBAAAY,KAAsB,CAC1D,KAAM,CAAE,QAAAN,GAAYN,EAEpB,OAAKY,EAEE,CACL,gBAAiBA,EAAgBN,CAAO,CAAA,EAHX,CAAA,CAKjC,ECRAO,EAA4B,CAACb,EAAO,CAAE,aAAAc,KAAmB,CACvD,KAAM,CAAE,MAAAC,GAAUf,EAElB,OAAKc,EAEE,CACL,aAAc,GAAGC,EAAM,OAASD,CAAY,IAAA,EAHlB,CAAA,CAK9B,ECRAE,EAA4B,CAAChB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EAQE,CACL,UAP4C,CAC5C,GAAIC,EACJ,GAAIC,EACJ,GAAIC,CAAA,EAIaH,CAAS,CAAA,EATH,CAAA,kPCA3B,SAASI,EAAQC,EAAmC,CAClD,OAAO,OAAO,OAAOA,CAAM,EAAE,IAAKC,GAAOA,CAAE,CAC7C,CAEA,SAAwBC,EAAmBC,EAAoC,CAC7E,OAAAA,EAAiB,YAAcA,EAAiB,KAEX,CAAC,CAAE,GAAA9D,EAAI,UAAA+D,EAAW,GAAGC,KAAY,CACpE,KAAM,CAAE,MAAA/D,CAAA,EAAUgE,EAAA,EAEZC,EAAUlE,GAAMD,EAAc,CAAE,MAAAE,EAAO,GAAAD,CAAA,EAC3C,GAAG0D,EAAQxD,CAAO,CAAA,EAGpB,eAAQ,IAAI,gBAAiB6D,CAAS,EAGpCI,EAACL,EAAA,CACE,GAAIE,EACL,MAAO,CACL,GAAGA,EAAM,MACT,GAAGE,EACH,GAAIH,EAAY,CAAE,MAAO,QAAW,CAAA,CAAC,CACvC,CAAA,CAGN,CAGF"}
@@ -1,2 +1,2 @@
1
- "use strict";const c=require("react/jsx-runtime"),n=require("react"),l=require("./index-DYxwT4uW.cjs"),z=require("./joinClass-Jk3EszKD.cjs"),D=require("./uuid-omnJ9TjZ.cjs"),E=require("./useListenerResized-AwpsZLcP.cjs"),L=require("./Card-BNdbHjy2.cjs"),S=require("./CardContent-BNxQiVc2.cjs"),B=require("./createComponent-Ds819n7r.cjs");class P{delay(t,s=500){if(!s){t();return}clearTimeout(this.timeout),this.timeout=setTimeout(()=>{t()},s)}}const W=new P,F=n.forwardRef(function({open:t,width:s,children:f,anchorEl:o,direction:d="left",maxHeight:i,autoClose:_,onClose:$,...m},j){const[g,M]=n.useState(),[h,a]=n.useState({state:"invisible",animation:"close",width:"auto"}),N=16,y=150,k=n.Children.toArray(f),T=n.useMemo(()=>D.uuid(),[]),v=z.joinClass(`${l.prefix}-menu`,`${l.prefix}-menu--${h?.animation}`,m.className);E.useListenerResized(()=>b(),[o]),n.useEffect(()=>{b()},[o]),n.useEffect(()=>{t?w():C()},[t]);const b=()=>{o&&setTimeout(()=>{let e={};const{offsetWidth:r,offsetHeight:p,offsetLeft:q,offsetTop:I}=o;a(O=>({...O,width:r}));const x=I+p+N/2,R=document.getElementById(T);d==="center"&&(e={top:x,right:r}),d==="left"&&(e={top:x,left:q}),d==="right"&&(e={top:x,left:q-(R.offsetWidth-r)}),M(e)},0)},w=()=>{a(e=>({...e,state:"visible"})),setTimeout(()=>{a(e=>({...e,animation:"open"}))},10)},C=()=>{a(e=>({...e,animation:"close"})),setTimeout(()=>{a(e=>({...e,state:"invisible"})),$()},y)},A=()=>k.map((e,r)=>n.cloneElement(e,{tabIndex:r+1,key:`button-${r}`,onClick:p=>{W.delay(()=>{_&&C(),e.props.onClick&&e.props.onClick(p)},0)}}));return c.jsxs(c.Fragment,{children:[c.jsx("div",{id:T,ref:j,...m,style:{width:s||h.width,top:g?.top,left:g?.left,display:h?.state==="visible"?"block":"none",transition:`all ${y}ms ease-in`,zIndex:50,...m.style},className:v,children:t&&c.jsx(L.Card,{className:`${l.prefix}-menu__card`,children:c.jsx(S.CardContent,{className:`${l.prefix}-menu__card__content`,sx:{py:1},style:{display:"flex",flexDirection:"column",maxHeight:i},children:A()})})}),t&&c.jsx("div",{className:`${l.prefix}-menu__overlay`,onClick:C})]})}),G=B.createComponent(F);function H(){const[u,t]=n.useState(null),s=!!u,f=i=>{t(i?i.currentTarget:null)},o=()=>{t(null)};return[s,u,i=>{if(s){o();return}f(i)}]}exports.Menu=G;exports.useMenu=H;
2
- //# sourceMappingURL=useMenu-CBWhhu1S.cjs.map
1
+ "use strict";const c=require("react/jsx-runtime"),n=require("react"),l=require("./index-DYxwT4uW.cjs"),z=require("./joinClass-Jk3EszKD.cjs"),D=require("./uuid-omnJ9TjZ.cjs"),E=require("./useListenerResized-AwpsZLcP.cjs"),L=require("./Card-DCz0DVsL.cjs"),S=require("./CardContent-CIsEbHXy.cjs"),B=require("./createComponent-C-z8CItQ.cjs");class P{delay(t,s=500){if(!s){t();return}clearTimeout(this.timeout),this.timeout=setTimeout(()=>{t()},s)}}const W=new P,F=n.forwardRef(function({open:t,width:s,children:f,anchorEl:o,direction:d="left",maxHeight:i,autoClose:_,onClose:$,...m},j){const[g,M]=n.useState(),[h,a]=n.useState({state:"invisible",animation:"close",width:"auto"}),N=16,y=150,k=n.Children.toArray(f),T=n.useMemo(()=>D.uuid(),[]),v=z.joinClass(`${l.prefix}-menu`,`${l.prefix}-menu--${h?.animation}`,m.className);E.useListenerResized(()=>b(),[o]),n.useEffect(()=>{b()},[o]),n.useEffect(()=>{t?w():C()},[t]);const b=()=>{o&&setTimeout(()=>{let e={};const{offsetWidth:r,offsetHeight:p,offsetLeft:q,offsetTop:I}=o;a(O=>({...O,width:r}));const x=I+p+N/2,R=document.getElementById(T);d==="center"&&(e={top:x,right:r}),d==="left"&&(e={top:x,left:q}),d==="right"&&(e={top:x,left:q-(R.offsetWidth-r)}),M(e)},0)},w=()=>{a(e=>({...e,state:"visible"})),setTimeout(()=>{a(e=>({...e,animation:"open"}))},10)},C=()=>{a(e=>({...e,animation:"close"})),setTimeout(()=>{a(e=>({...e,state:"invisible"})),$()},y)},A=()=>k.map((e,r)=>n.cloneElement(e,{tabIndex:r+1,key:`button-${r}`,onClick:p=>{W.delay(()=>{_&&C(),e.props.onClick&&e.props.onClick(p)},0)}}));return c.jsxs(c.Fragment,{children:[c.jsx("div",{id:T,ref:j,...m,style:{width:s||h.width,top:g?.top,left:g?.left,display:h?.state==="visible"?"block":"none",transition:`all ${y}ms ease-in`,zIndex:50,...m.style},className:v,children:t&&c.jsx(L.Card,{className:`${l.prefix}-menu__card`,children:c.jsx(S.CardContent,{className:`${l.prefix}-menu__card__content`,sx:{py:1},style:{display:"flex",flexDirection:"column",maxHeight:i},children:A()})})}),t&&c.jsx("div",{className:`${l.prefix}-menu__overlay`,onClick:C})]})}),G=B.createComponent(F);function H(){const[u,t]=n.useState(null),s=!!u,f=i=>{t(i?i.currentTarget:null)},o=()=>{t(null)};return[s,u,i=>{if(s){o();return}f(i)}]}exports.Menu=G;exports.useMenu=H;
2
+ //# sourceMappingURL=useMenu-DefCcCue.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useMenu-CBWhhu1S.cjs","sources":["../../../../toolkit/src/debounce/debounce.ts","../../src/navigation/Menu/Menu.tsx","../../src/navigation/Menu/useMenu.ts"],"sourcesContent":["class Debounce {\n private timeout: NodeJS.Timeout | undefined;\n public delay(func: (a?: any) => void, milliseconds = 500) {\n if (!milliseconds) {\n func();\n return;\n }\n\n clearTimeout(this.timeout);\n this.timeout = setTimeout(() => { func(); }, milliseconds);\n }\n}\n\nexport const debounce = new Debounce();\n","import {\n useMemo,\n useState,\n useEffect,\n Children,\n forwardRef,\n type ReactElement,\n type CSSProperties,\n type HTMLAttributes,\n cloneElement\n} from 'react';\n\nimport { prefix } from '@iziui/tokens/web/js';\n\nimport { joinClass } from '@iziui/core/utils';\n\nimport { uuid } from '@iziui/toolkit/uuid';\nimport { debounce } from '@iziui/toolkit/debounce';\n\nimport useListenerResized from '@/hooks/useListenerResized';\nimport { Card, CardContent } from '@/display/Card';\n\nimport createComponent from '../../core/createComponent';\n\nimport '@iziui/styles/components/Menu.scss';\n\ntype Direction = 'left' | 'right' | 'center';\ntype AnimationClass = 'open' | 'close';\ntype State = 'visible' | 'invisible';\ntype Coordinates = { top?: number; right?: number; bottom?: number; left?: number; };\ntype Config = { animation: AnimationClass, state: State; width: CSSProperties['width'] };\n\nexport interface MenuProps extends HTMLAttributes<HTMLDivElement> {\n open: boolean;\n autoClose?: boolean;\n maxHeight?: CSSProperties['maxHeight'];\n direction?: Direction;\n anchorEl: HTMLElement | null;\n width?: CSSProperties['width'];\n children: React.JSX.Element | React.JSX.Element[];\n onClose: (e?: React.MouseEvent<HTMLButtonElement>) => void;\n}\n\nconst Menu = forwardRef<HTMLDivElement, MenuProps>(function Menu({\n open,\n width,\n children,\n anchorEl,\n direction = 'left',\n maxHeight,\n autoClose,\n onClose,\n ...props\n}: MenuProps, ref) {\n const [coordinate, setCoordinate] = useState<Coordinates>();\n const [config, setConfig] = useState<Config>({ state: 'invisible', animation: 'close', width: 'auto' });\n\n const GAP = 16;\n const ANIMATION_DURATION = 150;\n\n const arrayChildren = Children.toArray(children) as ReactElement<any>[];\n\n const id = useMemo(() => uuid(), []);\n\n const classes = joinClass(\n `${prefix}-menu`,\n `${prefix}-menu--${config?.animation}`,\n props.className\n );\n\n useListenerResized(() => changePosition(), [anchorEl]);\n\n useEffect(() => { changePosition(); }, [anchorEl]);\n\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n useEffect(() => { open ? handleOpen() : handleClose(); }, [open]);\n\n const changePosition = () => {\n if (!anchorEl) { return; }\n\n setTimeout(() => {\n let coordinates: Coordinates = {};\n\n const { offsetWidth, offsetHeight, offsetLeft, offsetTop } = anchorEl;\n\n setConfig(prev => ({ ...prev, width: offsetWidth }));\n\n const top = offsetTop + offsetHeight + (GAP / 2);\n\n const el = document.getElementById(id) as HTMLElement;\n\n if (direction === 'center') { coordinates = { top, right: offsetWidth }; }\n\n if (direction === 'left') { coordinates = { top, left: offsetLeft }; }\n\n if (direction === 'right') { coordinates = { top, left: offsetLeft - (el.offsetWidth - offsetWidth) }; }\n\n setCoordinate(coordinates);\n }, 0);\n };\n\n const handleOpen = () => {\n setConfig(prev => ({ ...prev, state: 'visible' }));\n\n setTimeout(() => { setConfig(prev => ({ ...prev, animation: 'open' })); }, 10);\n };\n\n const handleClose = () => {\n setConfig(prev => ({ ...prev, animation: 'close' }));\n\n setTimeout(() => {\n setConfig(prev => ({ ...prev, state: 'invisible' }));\n onClose();\n }, ANIMATION_DURATION);\n };\n\n const renderChildren = () => {\n return arrayChildren.map((child, index) => {\n return cloneElement(child, {\n 'tabIndex': index + 1,\n key: `button-${index}`,\n onClick: (e: React.MouseEvent<HTMLButtonElement>) => {\n debounce.delay(() => {\n\n if (autoClose) { handleClose(); }\n\n if (child.props.onClick) { child.props.onClick(e); }\n }, 0);\n },\n });\n });\n };\n\n return (\n <>\n <div\n id={id}\n ref={ref}\n {...props}\n style={{\n width: width || config.width,\n top: coordinate?.top,\n left: coordinate?.left,\n display: config?.state === 'visible' ? 'block' : 'none',\n transition: `all ${ANIMATION_DURATION}ms ease-in`,\n zIndex: 50,\n ...props.style\n }}\n className={classes}\n >\n {\n open && (\n <Card className={`${prefix}-menu__card`}>\n <CardContent\n className={`${prefix}-menu__card__content`}\n sx={{ py: 1 }}\n style={{ display: 'flex', flexDirection: 'column', maxHeight }}\n >\n {renderChildren()}\n </CardContent>\n </Card>\n )\n }\n </div>\n {open && <div className={`${prefix}-menu__overlay`} onClick={handleClose} />}\n </>\n );\n});\n\nexport default createComponent(Menu);\n","import { useState } from 'react';\n\ntype UseMenu = [\n boolean,\n HTMLElement | null,\n (event?: React.MouseEvent<HTMLButtonElement>) => void,\n];\n\nexport default function useMenu(): UseMenu {\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const open = Boolean(anchorEl);\n\n const handleOpen = (event?: React.MouseEvent<HTMLElement, MouseEvent>) => {\n setAnchorEl(event ? event.currentTarget : null);\n };\n\n const handleClose = () => { setAnchorEl(null); };\n\n const handleToggle = (event?: React.MouseEvent<HTMLElement, MouseEvent>) => {\n if (open) {\n handleClose();\n return;\n }\n\n handleOpen(event);\n };\n\n return [open, anchorEl, handleToggle];\n}\n"],"names":["Debounce","func","milliseconds","debounce","Menu","forwardRef","open","width","children","anchorEl","direction","maxHeight","autoClose","onClose","props","ref","coordinate","setCoordinate","useState","config","setConfig","GAP","ANIMATION_DURATION","arrayChildren","Children","id","useMemo","uuid","classes","joinClass","prefix","useListenerResized","changePosition","useEffect","handleOpen","handleClose","coordinates","offsetWidth","offsetHeight","offsetLeft","offsetTop","prev","top","el","renderChildren","child","index","cloneElement","e","jsxs","Fragment","jsx","Card","CardContent","createComponent","useMenu","setAnchorEl","event"],"mappings":"kVAAA,MAAMA,CAAS,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uB,MAACC,EAAAA,KAAA,CAAK,UAAW,GAAGtB,QAAM,cACxB,SAAAqB,EAAAA,IAACE,EAAAA,YAAA,CACC,UAAW,GAAGvB,EAAAA,MAAM,uBACpB,GAAI,CAAE,GAAI,CAAA,EACV,MAAO,CAAE,QAAS,OAAQ,cAAe,SAAU,UAAAnB,CAAA,EAElD,SAAAiC,EAAA,CAAe,CAAA,CAClB,CACF,CAAA,CAAA,EAILtC,SAAS,MAAA,CAAI,UAAW,GAAGwB,EAAAA,MAAM,iBAAkB,QAASK,CAAA,CAAa,CAAA,EAC5E,CAEJ,CAAC,EAED/B,EAAekD,EAAAA,gBAAgBlD,CAAI,ECjKnC,SAAwBmD,GAAmB,CACzC,KAAM,CAAC9C,EAAU+C,CAAW,EAAItC,EAAAA,SAA6B,IAAI,EAE3DZ,EAAO,EAAQG,EAEfyB,EAAcuB,GAAsD,CACxED,EAAYC,EAAQA,EAAM,cAAgB,IAAI,CAChD,EAEMtB,EAAc,IAAM,CAAEqB,EAAY,IAAI,CAAG,EAW/C,MAAO,CAAClD,EAAMG,EATQgD,GAAsD,CAC1E,GAAInD,EAAM,CACR6B,EAAA,EACA,MACF,CAEAD,EAAWuB,CAAK,CAClB,CAEoC,CACtC"}
1
+ {"version":3,"file":"useMenu-DefCcCue.cjs","sources":["../../../../toolkit/src/debounce/debounce.ts","../../src/navigation/Menu/Menu.tsx","../../src/navigation/Menu/useMenu.ts"],"sourcesContent":["class Debounce {\n private timeout: NodeJS.Timeout | undefined;\n public delay(func: (a?: any) => void, milliseconds = 500) {\n if (!milliseconds) {\n func();\n return;\n }\n\n clearTimeout(this.timeout);\n this.timeout = setTimeout(() => { func(); }, milliseconds);\n }\n}\n\nexport const debounce = new Debounce();\n","import {\n useMemo,\n useState,\n useEffect,\n Children,\n forwardRef,\n type ReactElement,\n type CSSProperties,\n type HTMLAttributes,\n cloneElement\n} from 'react';\n\nimport { prefix } from '@iziui/tokens/web/js';\n\nimport { joinClass } from '@iziui/core/utils';\n\nimport { uuid } from '@iziui/toolkit/uuid';\nimport { debounce } from '@iziui/toolkit/debounce';\n\nimport useListenerResized from '@/hooks/useListenerResized';\nimport { Card, CardContent } from '@/display/Card';\n\nimport createComponent from '../../core/createComponent';\n\nimport '@iziui/styles/components/Menu.scss';\n\ntype Direction = 'left' | 'right' | 'center';\ntype AnimationClass = 'open' | 'close';\ntype State = 'visible' | 'invisible';\ntype Coordinates = { top?: number; right?: number; bottom?: number; left?: number; };\ntype Config = { animation: AnimationClass, state: State; width: CSSProperties['width'] };\n\nexport interface MenuProps extends HTMLAttributes<HTMLDivElement> {\n open: boolean;\n autoClose?: boolean;\n maxHeight?: CSSProperties['maxHeight'];\n direction?: Direction;\n anchorEl: HTMLElement | null;\n width?: CSSProperties['width'];\n children: React.JSX.Element | React.JSX.Element[];\n onClose: (e?: React.MouseEvent<HTMLButtonElement>) => void;\n}\n\nconst Menu = forwardRef<HTMLDivElement, MenuProps>(function Menu({\n open,\n width,\n children,\n anchorEl,\n direction = 'left',\n maxHeight,\n autoClose,\n onClose,\n ...props\n}: MenuProps, ref) {\n const [coordinate, setCoordinate] = useState<Coordinates>();\n const [config, setConfig] = useState<Config>({ state: 'invisible', animation: 'close', width: 'auto' });\n\n const GAP = 16;\n const ANIMATION_DURATION = 150;\n\n const arrayChildren = Children.toArray(children) as ReactElement<any>[];\n\n const id = useMemo(() => uuid(), []);\n\n const classes = joinClass(\n `${prefix}-menu`,\n `${prefix}-menu--${config?.animation}`,\n props.className\n );\n\n useListenerResized(() => changePosition(), [anchorEl]);\n\n useEffect(() => { changePosition(); }, [anchorEl]);\n\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n useEffect(() => { open ? handleOpen() : handleClose(); }, [open]);\n\n const changePosition = () => {\n if (!anchorEl) { return; }\n\n setTimeout(() => {\n let coordinates: Coordinates = {};\n\n const { offsetWidth, offsetHeight, offsetLeft, offsetTop } = anchorEl;\n\n setConfig(prev => ({ ...prev, width: offsetWidth }));\n\n const top = offsetTop + offsetHeight + (GAP / 2);\n\n const el = document.getElementById(id) as HTMLElement;\n\n if (direction === 'center') { coordinates = { top, right: offsetWidth }; }\n\n if (direction === 'left') { coordinates = { top, left: offsetLeft }; }\n\n if (direction === 'right') { coordinates = { top, left: offsetLeft - (el.offsetWidth - offsetWidth) }; }\n\n setCoordinate(coordinates);\n }, 0);\n };\n\n const handleOpen = () => {\n setConfig(prev => ({ ...prev, state: 'visible' }));\n\n setTimeout(() => { setConfig(prev => ({ ...prev, animation: 'open' })); }, 10);\n };\n\n const handleClose = () => {\n setConfig(prev => ({ ...prev, animation: 'close' }));\n\n setTimeout(() => {\n setConfig(prev => ({ ...prev, state: 'invisible' }));\n onClose();\n }, ANIMATION_DURATION);\n };\n\n const renderChildren = () => {\n return arrayChildren.map((child, index) => {\n return cloneElement(child, {\n 'tabIndex': index + 1,\n key: `button-${index}`,\n onClick: (e: React.MouseEvent<HTMLButtonElement>) => {\n debounce.delay(() => {\n\n if (autoClose) { handleClose(); }\n\n if (child.props.onClick) { child.props.onClick(e); }\n }, 0);\n },\n });\n });\n };\n\n return (\n <>\n <div\n id={id}\n ref={ref}\n {...props}\n style={{\n width: width || config.width,\n top: coordinate?.top,\n left: coordinate?.left,\n display: config?.state === 'visible' ? 'block' : 'none',\n transition: `all ${ANIMATION_DURATION}ms ease-in`,\n zIndex: 50,\n ...props.style\n }}\n className={classes}\n >\n {\n open && (\n <Card className={`${prefix}-menu__card`}>\n <CardContent\n className={`${prefix}-menu__card__content`}\n sx={{ py: 1 }}\n style={{ display: 'flex', flexDirection: 'column', maxHeight }}\n >\n {renderChildren()}\n </CardContent>\n </Card>\n )\n }\n </div>\n {open && <div className={`${prefix}-menu__overlay`} onClick={handleClose} />}\n </>\n );\n});\n\nexport default createComponent(Menu);\n","import { useState } from 'react';\n\ntype UseMenu = [\n boolean,\n HTMLElement | null,\n (event?: React.MouseEvent<HTMLButtonElement>) => void,\n];\n\nexport default function useMenu(): UseMenu {\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const open = Boolean(anchorEl);\n\n const handleOpen = (event?: React.MouseEvent<HTMLElement, MouseEvent>) => {\n setAnchorEl(event ? event.currentTarget : null);\n };\n\n const handleClose = () => { setAnchorEl(null); };\n\n const handleToggle = (event?: React.MouseEvent<HTMLElement, MouseEvent>) => {\n if (open) {\n handleClose();\n return;\n }\n\n handleOpen(event);\n };\n\n return [open, anchorEl, handleToggle];\n}\n"],"names":["Debounce","func","milliseconds","debounce","Menu","forwardRef","open","width","children","anchorEl","direction","maxHeight","autoClose","onClose","props","ref","coordinate","setCoordinate","useState","config","setConfig","GAP","ANIMATION_DURATION","arrayChildren","Children","id","useMemo","uuid","classes","joinClass","prefix","useListenerResized","changePosition","useEffect","handleOpen","handleClose","coordinates","offsetWidth","offsetHeight","offsetLeft","offsetTop","prev","top","el","renderChildren","child","index","cloneElement","e","jsxs","Fragment","jsx","Card","CardContent","createComponent","useMenu","setAnchorEl","event"],"mappings":"kVAAA,MAAMA,CAAS,CAEN,MAAMC,EAAyBC,EAAe,IAAK,CACxD,GAAI,CAACA,EAAc,CACjBD,EAAA,EACA,MACF,CAEA,aAAa,KAAK,OAAO,EACzB,KAAK,QAAU,WAAW,IAAM,CAAEA,EAAA,CAAQ,EAAGC,CAAY,CAC3D,CACF,CAEO,MAAMC,EAAW,IAAIH,EC8BtBI,EAAOC,EAAAA,WAAsC,SAAc,CAC/D,KAAAC,EACA,MAAAC,EACA,SAAAC,EACA,SAAAC,EACA,UAAAC,EAAY,OACZ,UAAAC,EACA,UAAAC,EACA,QAAAC,EACA,GAAGC,CACL,EAAcC,EAAK,CACjB,KAAM,CAACC,EAAYC,CAAa,EAAIC,WAAA,EAC9B,CAACC,EAAQC,CAAS,EAAIF,EAAAA,SAAiB,CAAE,MAAO,YAAa,UAAW,QAAS,MAAO,MAAA,CAAQ,EAEhGG,EAAM,GACNC,EAAqB,IAErBC,EAAgBC,EAAAA,SAAS,QAAQhB,CAAQ,EAEzCiB,EAAKC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,CAAEqB,EAAY,IAAI,CAAG,EAW/C,MAAO,CAAClD,EAAMG,EATQgD,GAAsD,CAC1E,GAAInD,EAAM,CACR6B,EAAA,EACA,MACF,CAEAD,EAAWuB,CAAK,CAClB,CAEoC,CACtC"}
@@ -1,2 +1,2 @@
1
- import{jsxs as B,Fragment as E,jsx as m}from"react/jsx-runtime";import{forwardRef as L,useState as g,Children as P,useMemo as W,useEffect as x,cloneElement as F}from"react";import{p as r}from"./index-CZ41y9Hn.js";import{j as G}from"./joinClass-anSpaauN.js";import{u as H}from"./uuid-dGvr9vBZ.js";import{u as S}from"./useListenerResized-Bnqxrt7k.js";import{C as U}from"./Card-CKCzaI7j.js";import{C as q}from"./CardContent-ywggix6Q.js";import{c as J}from"./createComponent-DhHk-x5v.js";class K{delay(t,n=500){if(!n){t();return}clearTimeout(this.timeout),this.timeout=setTimeout(()=>{t()},n)}}const Q=new K,V=L(function({open:t,width:n,children:f,anchorEl:o,direction:c="left",maxHeight:s,autoClose:N,onClose:M,...u},k){const[y,v]=g(),[d,a]=g({state:"invisible",animation:"close",width:"auto"}),w=16,T=150,A=P.toArray(f),b=W(()=>H(),[]),I=G(`${r}-menu`,`${r}-menu--${d?.animation}`,u.className);S(()=>_(),[o]),x(()=>{_()},[o]),x(()=>{t?j():h()},[t]);const _=()=>{o&&setTimeout(()=>{let e={};const{offsetWidth:i,offsetHeight:p,offsetLeft:$,offsetTop:D}=o;a(z=>({...z,width:i}));const C=D+p+w/2,R=document.getElementById(b);c==="center"&&(e={top:C,right:i}),c==="left"&&(e={top:C,left:$}),c==="right"&&(e={top:C,left:$-(R.offsetWidth-i)}),v(e)},0)},j=()=>{a(e=>({...e,state:"visible"})),setTimeout(()=>{a(e=>({...e,animation:"open"}))},10)},h=()=>{a(e=>({...e,animation:"close"})),setTimeout(()=>{a(e=>({...e,state:"invisible"})),M()},T)},O=()=>A.map((e,i)=>F(e,{tabIndex:i+1,key:`button-${i}`,onClick:p=>{Q.delay(()=>{N&&h(),e.props.onClick&&e.props.onClick(p)},0)}}));return B(E,{children:[m("div",{id:b,ref:k,...u,style:{width:n||d.width,top:y?.top,left:y?.left,display:d?.state==="visible"?"block":"none",transition:`all ${T}ms ease-in`,zIndex:50,...u.style},className:I,children:t&&m(U,{className:`${r}-menu__card`,children:m(q,{className:`${r}-menu__card__content`,sx:{py:1},style:{display:"flex",flexDirection:"column",maxHeight:s},children:O()})})}),t&&m("div",{className:`${r}-menu__overlay`,onClick:h})]})}),ae=J(V);function re(){const[l,t]=g(null),n=!!l,f=s=>{t(s?s.currentTarget:null)},o=()=>{t(null)};return[n,l,s=>{if(n){o();return}f(s)}]}export{ae as M,re as u};
2
- //# sourceMappingURL=useMenu-s6oyzklj.js.map
1
+ import{jsxs as B,Fragment as E,jsx as m}from"react/jsx-runtime";import{forwardRef as L,useState as g,Children as P,useMemo as W,useEffect as x,cloneElement as F}from"react";import{p as r}from"./index-CZ41y9Hn.js";import{j as G}from"./joinClass-anSpaauN.js";import{u as H}from"./uuid-dGvr9vBZ.js";import{u as S}from"./useListenerResized-Bnqxrt7k.js";import{C as U}from"./Card-DE8e0HfC.js";import{C as q}from"./CardContent-BUVN69Wu.js";import{c as J}from"./createComponent-D8CZM3yo.js";class K{delay(t,n=500){if(!n){t();return}clearTimeout(this.timeout),this.timeout=setTimeout(()=>{t()},n)}}const Q=new K,V=L(function({open:t,width:n,children:f,anchorEl:o,direction:c="left",maxHeight:s,autoClose:N,onClose:M,...u},k){const[y,v]=g(),[d,a]=g({state:"invisible",animation:"close",width:"auto"}),w=16,T=150,A=P.toArray(f),b=W(()=>H(),[]),I=G(`${r}-menu`,`${r}-menu--${d?.animation}`,u.className);S(()=>_(),[o]),x(()=>{_()},[o]),x(()=>{t?j():h()},[t]);const _=()=>{o&&setTimeout(()=>{let e={};const{offsetWidth:i,offsetHeight:p,offsetLeft:$,offsetTop:D}=o;a(z=>({...z,width:i}));const C=D+p+w/2,R=document.getElementById(b);c==="center"&&(e={top:C,right:i}),c==="left"&&(e={top:C,left:$}),c==="right"&&(e={top:C,left:$-(R.offsetWidth-i)}),v(e)},0)},j=()=>{a(e=>({...e,state:"visible"})),setTimeout(()=>{a(e=>({...e,animation:"open"}))},10)},h=()=>{a(e=>({...e,animation:"close"})),setTimeout(()=>{a(e=>({...e,state:"invisible"})),M()},T)},O=()=>A.map((e,i)=>F(e,{tabIndex:i+1,key:`button-${i}`,onClick:p=>{Q.delay(()=>{N&&h(),e.props.onClick&&e.props.onClick(p)},0)}}));return B(E,{children:[m("div",{id:b,ref:k,...u,style:{width:n||d.width,top:y?.top,left:y?.left,display:d?.state==="visible"?"block":"none",transition:`all ${T}ms ease-in`,zIndex:50,...u.style},className:I,children:t&&m(U,{className:`${r}-menu__card`,children:m(q,{className:`${r}-menu__card__content`,sx:{py:1},style:{display:"flex",flexDirection:"column",maxHeight:s},children:O()})})}),t&&m("div",{className:`${r}-menu__overlay`,onClick:h})]})}),ae=J(V);function re(){const[l,t]=g(null),n=!!l,f=s=>{t(s?s.currentTarget:null)},o=()=>{t(null)};return[n,l,s=>{if(n){o();return}f(s)}]}export{ae as M,re as u};
2
+ //# sourceMappingURL=useMenu-FQ50ImC2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useMenu-s6oyzklj.js","sources":["../../../../toolkit/src/debounce/debounce.ts","../../src/navigation/Menu/Menu.tsx","../../src/navigation/Menu/useMenu.ts"],"sourcesContent":["class Debounce {\n private timeout: NodeJS.Timeout | undefined;\n public delay(func: (a?: any) => void, milliseconds = 500) {\n if (!milliseconds) {\n func();\n return;\n }\n\n clearTimeout(this.timeout);\n this.timeout = setTimeout(() => { func(); }, milliseconds);\n }\n}\n\nexport const debounce = new Debounce();\n","import {\n useMemo,\n useState,\n useEffect,\n Children,\n forwardRef,\n type ReactElement,\n type CSSProperties,\n type HTMLAttributes,\n cloneElement\n} from 'react';\n\nimport { prefix } from '@iziui/tokens/web/js';\n\nimport { joinClass } from '@iziui/core/utils';\n\nimport { uuid } from '@iziui/toolkit/uuid';\nimport { debounce } from '@iziui/toolkit/debounce';\n\nimport useListenerResized from '@/hooks/useListenerResized';\nimport { Card, CardContent } from '@/display/Card';\n\nimport createComponent from '../../core/createComponent';\n\nimport '@iziui/styles/components/Menu.scss';\n\ntype Direction = 'left' | 'right' | 'center';\ntype AnimationClass = 'open' | 'close';\ntype State = 'visible' | 'invisible';\ntype Coordinates = { top?: number; right?: number; bottom?: number; left?: number; };\ntype Config = { animation: AnimationClass, state: State; width: CSSProperties['width'] };\n\nexport interface MenuProps extends HTMLAttributes<HTMLDivElement> {\n open: boolean;\n autoClose?: boolean;\n maxHeight?: CSSProperties['maxHeight'];\n direction?: Direction;\n anchorEl: HTMLElement | null;\n width?: CSSProperties['width'];\n children: React.JSX.Element | React.JSX.Element[];\n onClose: (e?: React.MouseEvent<HTMLButtonElement>) => void;\n}\n\nconst Menu = forwardRef<HTMLDivElement, MenuProps>(function Menu({\n open,\n width,\n children,\n anchorEl,\n direction = 'left',\n maxHeight,\n autoClose,\n onClose,\n ...props\n}: MenuProps, ref) {\n const [coordinate, setCoordinate] = useState<Coordinates>();\n const [config, setConfig] = useState<Config>({ state: 'invisible', animation: 'close', width: 'auto' });\n\n const GAP = 16;\n const ANIMATION_DURATION = 150;\n\n const arrayChildren = Children.toArray(children) as ReactElement<any>[];\n\n const id = useMemo(() => uuid(), []);\n\n const classes = joinClass(\n `${prefix}-menu`,\n `${prefix}-menu--${config?.animation}`,\n props.className\n );\n\n useListenerResized(() => changePosition(), [anchorEl]);\n\n useEffect(() => { changePosition(); }, [anchorEl]);\n\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n useEffect(() => { open ? handleOpen() : handleClose(); }, [open]);\n\n const changePosition = () => {\n if (!anchorEl) { return; }\n\n setTimeout(() => {\n let coordinates: Coordinates = {};\n\n const { offsetWidth, offsetHeight, offsetLeft, offsetTop } = anchorEl;\n\n setConfig(prev => ({ ...prev, width: offsetWidth }));\n\n const top = offsetTop + offsetHeight + (GAP / 2);\n\n const el = document.getElementById(id) as HTMLElement;\n\n if (direction === 'center') { coordinates = { top, right: offsetWidth }; }\n\n if (direction === 'left') { coordinates = { top, left: offsetLeft }; }\n\n if (direction === 'right') { coordinates = { top, left: offsetLeft - (el.offsetWidth - offsetWidth) }; }\n\n setCoordinate(coordinates);\n }, 0);\n };\n\n const handleOpen = () => {\n setConfig(prev => ({ ...prev, state: 'visible' }));\n\n setTimeout(() => { setConfig(prev => ({ ...prev, animation: 'open' })); }, 10);\n };\n\n const handleClose = () => {\n setConfig(prev => ({ ...prev, animation: 'close' }));\n\n setTimeout(() => {\n setConfig(prev => ({ ...prev, state: 'invisible' }));\n onClose();\n }, ANIMATION_DURATION);\n };\n\n const renderChildren = () => {\n return arrayChildren.map((child, index) => {\n return cloneElement(child, {\n 'tabIndex': index + 1,\n key: `button-${index}`,\n onClick: (e: React.MouseEvent<HTMLButtonElement>) => {\n debounce.delay(() => {\n\n if (autoClose) { handleClose(); }\n\n if (child.props.onClick) { child.props.onClick(e); }\n }, 0);\n },\n });\n });\n };\n\n return (\n <>\n <div\n id={id}\n ref={ref}\n {...props}\n style={{\n width: width || config.width,\n top: coordinate?.top,\n left: coordinate?.left,\n display: config?.state === 'visible' ? 'block' : 'none',\n transition: `all ${ANIMATION_DURATION}ms ease-in`,\n zIndex: 50,\n ...props.style\n }}\n className={classes}\n >\n {\n open && (\n <Card className={`${prefix}-menu__card`}>\n <CardContent\n className={`${prefix}-menu__card__content`}\n sx={{ py: 1 }}\n style={{ display: 'flex', flexDirection: 'column', maxHeight }}\n >\n {renderChildren()}\n </CardContent>\n </Card>\n )\n }\n </div>\n {open && <div className={`${prefix}-menu__overlay`} onClick={handleClose} />}\n </>\n );\n});\n\nexport default createComponent(Menu);\n","import { useState } from 'react';\n\ntype UseMenu = [\n boolean,\n HTMLElement | null,\n (event?: React.MouseEvent<HTMLButtonElement>) => void,\n];\n\nexport default function useMenu(): UseMenu {\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const open = Boolean(anchorEl);\n\n const handleOpen = (event?: React.MouseEvent<HTMLElement, MouseEvent>) => {\n setAnchorEl(event ? event.currentTarget : null);\n };\n\n const handleClose = () => { setAnchorEl(null); };\n\n const handleToggle = (event?: React.MouseEvent<HTMLElement, MouseEvent>) => {\n if (open) {\n handleClose();\n return;\n }\n\n handleOpen(event);\n };\n\n return [open, anchorEl, handleToggle];\n}\n"],"names":["Debounce","func","milliseconds","debounce","Menu","forwardRef","open","width","children","anchorEl","direction","maxHeight","autoClose","onClose","props","ref","coordinate","setCoordinate","useState","config","setConfig","GAP","ANIMATION_DURATION","arrayChildren","Children","id","useMemo","uuid","classes","joinClass","prefix","useListenerResized","changePosition","useEffect","handleOpen","handleClose","coordinates","offsetWidth","offsetHeight","offsetLeft","offsetTop","prev","top","el","renderChildren","child","index","cloneElement","e","jsxs","Fragment","jsx","Card","CardContent","Menu$1","createComponent","useMenu","setAnchorEl","event"],"mappings":"oeAAA,MAAMA,CAAS,CAEN,MAAMC,EAAyBC,EAAe,IAAK,CACxD,GAAI,CAACA,EAAc,CACjBD,EAAA,EACA,MACF,CAEA,aAAa,KAAK,OAAO,EACzB,KAAK,QAAU,WAAW,IAAM,CAAEA,EAAA,CAAQ,EAAGC,CAAY,CAC3D,CACF,CAEO,MAAMC,EAAW,IAAIH,EC8BtBI,EAAOC,EAAsC,SAAc,CAC/D,KAAAC,EACA,MAAAC,EACA,SAAAC,EACA,SAAAC,EACA,UAAAC,EAAY,OACZ,UAAAC,EACA,UAAAC,EACA,QAAAC,EACA,GAAGC,CACL,EAAcC,EAAK,CACjB,KAAM,CAACC,EAAYC,CAAa,EAAIC,EAAA,EAC9B,CAACC,EAAQC,CAAS,EAAIF,EAAiB,CAAE,MAAO,YAAa,UAAW,QAAS,MAAO,MAAA,CAAQ,EAEhGG,EAAM,GACNC,EAAqB,IAErBC,EAAgBC,EAAS,QAAQhB,CAAQ,EAEzCiB,EAAKC,EAAQ,IAAMC,EAAA,EAAQ,CAAA,CAAE,E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":"useMenu-FQ50ImC2.js","sources":["../../../../toolkit/src/debounce/debounce.ts","../../src/navigation/Menu/Menu.tsx","../../src/navigation/Menu/useMenu.ts"],"sourcesContent":["class Debounce {\n private timeout: NodeJS.Timeout | undefined;\n public delay(func: (a?: any) => void, milliseconds = 500) {\n if (!milliseconds) {\n func();\n return;\n }\n\n clearTimeout(this.timeout);\n this.timeout = setTimeout(() => { func(); }, milliseconds);\n }\n}\n\nexport const debounce = new Debounce();\n","import {\n useMemo,\n useState,\n useEffect,\n Children,\n forwardRef,\n type ReactElement,\n type CSSProperties,\n type HTMLAttributes,\n cloneElement\n} from 'react';\n\nimport { prefix } from '@iziui/tokens/web/js';\n\nimport { joinClass } from '@iziui/core/utils';\n\nimport { uuid } from '@iziui/toolkit/uuid';\nimport { debounce } from '@iziui/toolkit/debounce';\n\nimport useListenerResized from '@/hooks/useListenerResized';\nimport { Card, CardContent } from '@/display/Card';\n\nimport createComponent from '../../core/createComponent';\n\nimport '@iziui/styles/components/Menu.scss';\n\ntype Direction = 'left' | 'right' | 'center';\ntype AnimationClass = 'open' | 'close';\ntype State = 'visible' | 'invisible';\ntype Coordinates = { top?: number; right?: number; bottom?: number; left?: number; };\ntype Config = { animation: AnimationClass, state: State; width: CSSProperties['width'] };\n\nexport interface MenuProps extends HTMLAttributes<HTMLDivElement> {\n open: boolean;\n autoClose?: boolean;\n maxHeight?: CSSProperties['maxHeight'];\n direction?: Direction;\n anchorEl: HTMLElement | null;\n width?: CSSProperties['width'];\n children: React.JSX.Element | React.JSX.Element[];\n onClose: (e?: React.MouseEvent<HTMLButtonElement>) => void;\n}\n\nconst Menu = forwardRef<HTMLDivElement, MenuProps>(function Menu({\n open,\n width,\n children,\n anchorEl,\n direction = 'left',\n maxHeight,\n autoClose,\n onClose,\n ...props\n}: MenuProps, ref) {\n const [coordinate, setCoordinate] = useState<Coordinates>();\n const [config, setConfig] = useState<Config>({ state: 'invisible', animation: 'close', width: 'auto' });\n\n const GAP = 16;\n const ANIMATION_DURATION = 150;\n\n const arrayChildren = Children.toArray(children) as ReactElement<any>[];\n\n const id = useMemo(() => uuid(), []);\n\n const classes = joinClass(\n `${prefix}-menu`,\n `${prefix}-menu--${config?.animation}`,\n props.className\n );\n\n useListenerResized(() => changePosition(), [anchorEl]);\n\n useEffect(() => { changePosition(); }, [anchorEl]);\n\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n useEffect(() => { open ? handleOpen() : handleClose(); }, [open]);\n\n const changePosition = () => {\n if (!anchorEl) { return; }\n\n setTimeout(() => {\n let coordinates: Coordinates = {};\n\n const { offsetWidth, offsetHeight, offsetLeft, offsetTop } = anchorEl;\n\n setConfig(prev => ({ ...prev, width: offsetWidth }));\n\n const top = offsetTop + offsetHeight + (GAP / 2);\n\n const el = document.getElementById(id) as HTMLElement;\n\n if (direction === 'center') { coordinates = { top, right: offsetWidth }; }\n\n if (direction === 'left') { coordinates = { top, left: offsetLeft }; }\n\n if (direction === 'right') { coordinates = { top, left: offsetLeft - (el.offsetWidth - offsetWidth) }; }\n\n setCoordinate(coordinates);\n }, 0);\n };\n\n const handleOpen = () => {\n setConfig(prev => ({ ...prev, state: 'visible' }));\n\n setTimeout(() => { setConfig(prev => ({ ...prev, animation: 'open' })); }, 10);\n };\n\n const handleClose = () => {\n setConfig(prev => ({ ...prev, animation: 'close' }));\n\n setTimeout(() => {\n setConfig(prev => ({ ...prev, state: 'invisible' }));\n onClose();\n }, ANIMATION_DURATION);\n };\n\n const renderChildren = () => {\n return arrayChildren.map((child, index) => {\n return cloneElement(child, {\n 'tabIndex': index + 1,\n key: `button-${index}`,\n onClick: (e: React.MouseEvent<HTMLButtonElement>) => {\n debounce.delay(() => {\n\n if (autoClose) { handleClose(); }\n\n if (child.props.onClick) { child.props.onClick(e); }\n }, 0);\n },\n });\n });\n };\n\n return (\n <>\n <div\n id={id}\n ref={ref}\n {...props}\n style={{\n width: width || config.width,\n top: coordinate?.top,\n left: coordinate?.left,\n display: config?.state === 'visible' ? 'block' : 'none',\n transition: `all ${ANIMATION_DURATION}ms ease-in`,\n zIndex: 50,\n ...props.style\n }}\n className={classes}\n >\n {\n open && (\n <Card className={`${prefix}-menu__card`}>\n <CardContent\n className={`${prefix}-menu__card__content`}\n sx={{ py: 1 }}\n style={{ display: 'flex', flexDirection: 'column', maxHeight }}\n >\n {renderChildren()}\n </CardContent>\n </Card>\n )\n }\n </div>\n {open && <div className={`${prefix}-menu__overlay`} onClick={handleClose} />}\n </>\n );\n});\n\nexport default createComponent(Menu);\n","import { useState } from 'react';\n\ntype UseMenu = [\n boolean,\n HTMLElement | null,\n (event?: React.MouseEvent<HTMLButtonElement>) => void,\n];\n\nexport default function useMenu(): UseMenu {\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);\n\n const open = Boolean(anchorEl);\n\n const handleOpen = (event?: React.MouseEvent<HTMLElement, MouseEvent>) => {\n setAnchorEl(event ? event.currentTarget : null);\n };\n\n const handleClose = () => { setAnchorEl(null); };\n\n const handleToggle = (event?: React.MouseEvent<HTMLElement, MouseEvent>) => {\n if (open) {\n handleClose();\n return;\n }\n\n handleOpen(event);\n };\n\n return [open, anchorEl, handleToggle];\n}\n"],"names":["Debounce","func","milliseconds","debounce","Menu","forwardRef","open","width","children","anchorEl","direction","maxHeight","autoClose","onClose","props","ref","coordinate","setCoordinate","useState","config","setConfig","GAP","ANIMATION_DURATION","arrayChildren","Children","id","useMemo","uuid","classes","joinClass","prefix","useListenerResized","changePosition","useEffect","handleOpen","handleClose","coordinates","offsetWidth","offsetHeight","offsetLeft","offsetTop","prev","top","el","renderChildren","child","index","cloneElement","e","jsxs","Fragment","jsx","Card","CardContent","Menu$1","createComponent","useMenu","setAnchorEl","event"],"mappings":"oeAAA,MAAMA,CAAS,CAEN,MAAMC,EAAyBC,EAAe,IAAK,CACxD,GAAI,CAACA,EAAc,CACjBD,EAAA,EACA,MACF,CAEA,aAAa,KAAK,OAAO,EACzB,KAAK,QAAU,WAAW,IAAM,CAAEA,EAAA,CAA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A,CAAI,UAAW,GAAGwB,CAAM,iBAAkB,QAASK,CAAA,CAAa,CAAA,EAC5E,CAEJ,CAAC,EAEDmB,GAAeC,EAAgBnD,CAAI,ECjKnC,SAAwBoD,IAAmB,CACzC,KAAM,CAAC/C,EAAUgD,CAAW,EAAIvC,EAA6B,IAAI,EAE3DZ,EAAO,EAAQG,EAEfyB,EAAcwB,GAAsD,CACxED,EAAYC,EAAQA,EAAM,cAAgB,IAAI,CAChD,EAEMvB,EAAc,IAAM,CAAEsB,EAAY,IAAI,CAAG,EAW/C,MAAO,CAACnD,EAAMG,EATQiD,GAAsD,CAC1E,GAAIpD,EAAM,CACR6B,EAAA,EACA,MACF,CAEAD,EAAWwB,CAAK,CAClB,CAEoC,CACtC"}
@@ -1,2 +1,2 @@
1
1
  "use strict";const u=require("react"),P=require("react/jsx-runtime");function $(t,e,n){e/=100,n/=100;const r=(1-Math.abs(2*n-1))*e,s=r*(1-Math.abs(t/60%2-1)),o=n-r/2;let a=0,c=0,i=0;0<=t&&t<60?(a=r,c=s,i=0):60<=t&&t<120?(a=s,c=r,i=0):120<=t&&t<180?(a=0,c=r,i=s):180<=t&&t<240?(a=0,c=s,i=r):240<=t&&t<300?(a=s,c=0,i=r):300<=t&&t<360&&(a=r,c=0,i=s);const p=Math.round((a+o)*255).toString(16).padStart(2,"0"),F=Math.round((c+o)*255).toString(16).padStart(2,"0"),E=Math.round((i+o)*255).toString(16).padStart(2,"0");return`#${p}${F}${E}`}function l(t,e,n,r){return n=Math.min(Math.max(n+r,0),100),$(t,e,n)}function k(t){const e=parseInt(t.slice(1,3),16)/255,n=parseInt(t.slice(3,5),16)/255,r=parseInt(t.slice(5,7),16)/255,s=Math.max(e,n,r),o=Math.min(e,n,r);let a=0,c=0;const i=(s+o)/2;if(s===o)a=c=0;else{const p=s-o;switch(c=i>.5?p/(2-s-o):p/(s+o),s){case e:a=(n-r)/p+(n<r?6:0);break;case n:a=(r-e)/p+2;break;case r:a=(e-n)/p+4;break}a*=60}return{h:a,s:c*100,l:i*100}}function w(t,e){if(!/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(t))throw new Error("Cor inválida. Use um formato hexadecimal (#RRGGBB ou #RGB).");t.length===4&&(t=`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`);const s=Math.round(e*255).toString(16).padStart(2,"0").toUpperCase();return`${t}${s}`}function m(t){const e=parseInt(t.slice(1,3),16)/255,n=parseInt(t.slice(3,5),16)/255,r=parseInt(t.slice(5,7),16)/255;return .2126*e+.7152*n+.0722*r>.6?"#000000":"#ffffff"}function v(t){const n=k(t),r=m(t),s=l(n.h,n.s,n.l,20),o=l(n.h,n.s,n.l,-20*1.7),a=w(t,20/100);return{main:t,dark:o,light:s,opacity:a,contrast:r}}function x(t){return[`${t}.main`,`${t}.dark`,`${t}.light`,`${t}.opacity`,`${t}.contrast`]}function S(t){return t.reduce((e,n)=>{const r=x(n);return e=[...e,...r],e},["text.primary","text.secondary","text.disabled","background.paper","background.default","divider"])}const T=["primary","secondary","error","warning","success","info"];S(T);function d(t,e){document.documentElement.style.setProperty(`--${t}`,e.main),document.documentElement.style.setProperty(`--${t}-light`,e.light),document.documentElement.style.setProperty(`--${t}-dark`,e.dark),document.documentElement.style.setProperty(`--${t}-contrast`,e.contrast),document.documentElement.style.setProperty(`--${t}-opacity`,e.opacity)}function C(t){if(document.querySelector(`link[href="${t}"]`))return;const e=document.createElement("link");e.rel="stylesheet",e.href=t,document.head.appendChild(e)}function M(t){if(typeof window>"u")return;const{palette:e,shape:n,spacing:r,typography:s}=t;s.url&&C(s.url),d("info",e.info),d("error",e.error),d("warning",e.warning),d("success",e.success),d("primary",e.primary),d("secondary",e.secondary),d("grey",e.grey),document.documentElement.style.setProperty("--typography",s.family),document.documentElement.style.setProperty("--text-primary",e.text?.primary),document.documentElement.style.setProperty("--text-secondary",e.text?.secondary),document.documentElement.style.setProperty("--text-disabled",e.text?.disabled),document.documentElement.style.setProperty("--background-paper",e.background?.paper),document.documentElement.style.setProperty("--background-default",e.background?.default),document.documentElement.style.setProperty("--divider",e.divider),document.documentElement.style.setProperty("--radius",`${n.radius}px`),document.documentElement.style.setProperty("--spacing",`${r}px`)}const y=8,g={radius:8},f={mode:"light",palette:{info:"#72E4FC",error:"#FF5377",warning:"#FF9457",success:"#36E79B",primary:"#6C37F4",secondary:"#FB7185",grey:"#F4F4F4",text:{primary:"rgb(31, 41, 55)",secondary:"rgb(75, 85, 99)",disabled:"rgb(172, 172, 172)"},background:{paper:"#F9F8F9",default:"#FFF"},divider:"rgba(0, 0, 0, 0.12)"},spacing:y,shape:g,typography:{family:"Poppins",url:"https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap"}},B={palette:{info:"#72E4FC",error:"#FF5377",warning:"#FF9457",success:"#36E79B",primary:"#6C37F4",secondary:"#EBFF5E",grey:"#2A2A2A",text:{primary:"rgba(255, 255, 255, 0.87)",secondary:"rgba(255, 255, 255, 0.6)",disabled:"rgba(255, 255, 255, 0.38)"},background:{paper:"#0D0225",default:"#30294E"},divider:"rgba(255, 255, 255, 0.12)"},spacing:y,shape:g,typography:{family:"Poppins",url:"https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap"}},R=["primary","secondary","error","warning","success","info","grey"];function h(t){const e=t?.mode??"light",n=e==="dark"?B:f,r=t?.palette??{},s=n.palette,o=Object.fromEntries(R.map(a=>[a,v(r[a]??s[a])]));return{mode:e,palette:{text:r.text??s.text,background:r.background??s.background,divider:r.divider??s.divider,...o},shape:t?.shape??n.shape,spacing:t?.spacing??n.spacing,typography:t?.typography??n.typography}}const b=u.createContext({theme:h(f),updateTheme:()=>{}});function I({theme:t,children:e}){const[n,r]=u.useState(t),s=u.useMemo(()=>({theme:n,updateTheme:a=>o(a)}),[t,n]);u.useEffect(()=>{M(n)},[n]);const o=a=>{r(a)};return P.jsx(b.Provider,{value:s,children:e})}function A(){return u.useContext(b)}exports.ThemeProvider=I;exports.createTheme=h;exports.getContrastColor=m;exports.useTheme=A;
2
- //# sourceMappingURL=useTheme-BZ0xkY68.cjs.map
2
+ //# sourceMappingURL=useTheme-C83CaSLO.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTheme-BZ0xkY68.cjs","sources":["../../../../core/src/utils/hslToHex/hslToHex.ts","../../../../core/src/utils/adjustLightness/adjustLightness.ts","../../../../core/src/utils/hexToHsl/hexToHsl.ts","../../../../core/src/utils/getOpacityColor/getOpacityColor.ts","../../../../core/src/utils/getContrastColor/getContrastColor.ts","../../../../core/src/utils/generateSupportColors/generateSupportColors.ts","../../../../core/src/theme/createMappedColors.ts","../../../../core/src/theme/Theme.ts","../../../../core/src/theme/applyTheme/applyTheme.ts","../../../../core/src/theme/defaultTheme.ts","../../../../core/src/theme/createTheme/createTheme.ts","../../src/theme/ThemeProvider.tsx","../../src/theme/useTheme.ts"],"sourcesContent":["export function hslToHex(h: number, s: number, l: number) {\n s /= 100;\n l /= 100;\n\n const c = (1 - Math.abs(2 * l - 1)) * s;\n const x = c * (1 - Math.abs((h / 60) % 2 - 1));\n const m = l - c / 2;\n let r = 0, g = 0, b = 0;\n\n if (0 <= h && h < 60) { r = c; g = x; b = 0; }\n else if (60 <= h && h < 120) { r = x; g = c; b = 0; }\n else if (120 <= h && h < 180) { r = 0; g = c; b = x; }\n else if (180 <= h && h < 240) { r = 0; g = x; b = c; }\n else if (240 <= h && h < 300) { r = x; g = 0; b = c; }\n else if (300 <= h && h < 360) { r = c; g = 0; b = x; }\n\n const newR = Math.round((r + m) * 255).toString(16).padStart(2, '0');\n const newG = Math.round((g + m) * 255).toString(16).padStart(2, '0');\n const newB = Math.round((b + m) * 255).toString(16).padStart(2, '0');\n\n return `#${newR}${newG}${newB}`;\n}","import { hslToHex } from '../hslToHex';\n\nexport function adjustLightness(h: number, s: number, l: number, amount: number) {\n l = Math.min(Math.max(l + amount, 0), 100);\n return hslToHex(h, s, l);\n}","export function hexToHsl(hex: string) {\n const r = parseInt(hex.slice(1, 3), 16) / 255;\n const g = parseInt(hex.slice(3, 5), 16) / 255;\n const b = parseInt(hex.slice(5, 7), 16) / 255;\n\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n let h = 0, s = 0;\n const l = (max + min) / 2;\n\n if (max === min) {\n h = s = 0; // acromático\n } else {\n const d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n\n switch (max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n h *= 60;\n }\n\n return { h, s: s * 100, l: l * 100 };\n}","/**\n * Adiciona opacidade a uma cor em hexadecimal.\n * @param hexColor - A cor em hexadecimal (ex: #RRGGBB ou #RGB).\n * @param opacity - O valor da opacidade (entre 0 e 1).\n * @returns A cor hexadecimal com opacidade (ex: #RRGGBBAA).\n */\nexport function getOpacityColor(hexColor: string, opacity: number): string {\n // Validar entrada do hexadecimal\n const hexPattern = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;\n if (!hexPattern.test(hexColor)) {\n throw new Error('Cor inválida. Use um formato hexadecimal (#RRGGBB ou #RGB).');\n }\n\n // Expandir formato #RGB para #RRGGBB\n if (hexColor.length === 4) {\n hexColor = `#${hexColor[1]}${hexColor[1]}${hexColor[2]}${hexColor[2]}${hexColor[3]}${hexColor[3]}`;\n }\n\n // Converter opacidade para formato hexadecimal (0 a 255)\n const alpha = Math.round(opacity * 255);\n const alphaHex = alpha.toString(16).padStart(2, '0').toUpperCase();\n\n // Combinar cor com opacidade\n return `${hexColor}${alphaHex}`;\n}","export function getContrastColor(hexColor: string) {\n // Converter hexadecimal para RGB\n const r = parseInt(hexColor.slice(1, 3), 16) / 255;\n const g = parseInt(hexColor.slice(3, 5), 16) / 255;\n const b = parseInt(hexColor.slice(5, 7), 16) / 255;\n\n // Calcular a luminância relativa\n const luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;\n\n // Se a luminância for baixa, usar branco como contraste, senão preto\n return luminance > 0.6 ? '#000000' : '#ffffff';\n}","import type { Color } from '../../theme';\nimport { hexToHsl } from '../hexToHsl';\nimport { adjustLightness } from '../adjustLightness';\nimport { getOpacityColor } from '../getOpacityColor';\nimport { getContrastColor } from '../getContrastColor/getContrastColor';\n\nexport function generateSupportColors(hex: string): Color {\n const variation = 20;\n\n const hsl = hexToHsl(hex);\n\n const contrastColor = getContrastColor(hex);\n const lighterColor = adjustLightness(hsl.h, hsl.s, hsl.l, variation);\n const darkerColor = adjustLightness(hsl.h, hsl.s, hsl.l, -variation * 1.7);\n const opacityColor = getOpacityColor(hex, variation / 100);\n\n return {\n main: hex,\n dark: darkerColor,\n light: lighterColor,\n opacity: opacityColor,\n contrast: contrastColor\n };\n}","import type { MappedColors, Colors, colors } from './Theme';\n\nfunction generateMappedColor(color: Colors): MappedColors[] {\n return [\n `${color}.main`,\n `${color}.dark`,\n `${color}.light`,\n `${color}.opacity`,\n `${color}.contrast`,\n ];\n}\n\nexport function createMappedColors(_colors: typeof colors): MappedColors[] {\n return _colors.reduce<MappedColors[]>((acc, color) => {\n const mapped = generateMappedColor(color);\n\n acc = [...acc, ...mapped];\n\n return acc;\n }, [\n 'text.primary',\n 'text.secondary',\n 'text.disabled',\n 'background.paper',\n 'background.default',\n 'divider'\n ]);\n}","import type { Path } from '@iziui/toolkit/interface';\n\nimport { createMappedColors } from './createMappedColors';\n\nexport const colors = ['primary', 'secondary', 'error', 'warning', 'success', 'info'] as const;\nexport const mappedColors = createMappedColors(colors);\n\nexport type Mode = 'light' | 'dark'\n\nexport type MappedColors = Path<PaletteBuilded>;\nexport type Colors = typeof colors[number];\n\nexport type Size = 'small' | 'medium' | 'large';\n\nexport interface Color {\n main: string;\n dark: string;\n light: string;\n opacity: string;\n contrast: string;\n}\n\nexport interface Palette {\n info: string;\n error: string;\n warning: string;\n success: string;\n primary: string;\n secondary: string;\n grey: string;\n text: {\n primary: string;\n secondary: string;\n disabled: string;\n };\n background: {\n paper: string;\n default: string;\n };\n divider: string;\n}\n\nexport type Spacing = number;\nexport type Shape = { radius: number; }\nexport type Typography = { family: string; url?: string; }\n\nexport interface PaletteBuilded extends Pick<Palette, 'text' | 'background' | 'divider'> {\n grey: Color;\n info: Color;\n error: Color;\n warning: Color;\n success: Color;\n primary: Color;\n secondary: Color;\n}\n\nexport interface Theme {\n mode: Mode;\n shape: Shape;\n palette: Palette;\n spacing: Spacing;\n typography: Typography;\n}\n\nexport interface ThemeOptions extends Omit<Partial<Theme>, 'palette'> {\n palette?: Partial<Palette>;\n}\nexport interface ThemeBuilded extends Omit<Theme, 'palette'> {\n palette: PaletteBuilded;\n}\n","import type { ThemeBuilded, Color } from '../Theme';\n\nfunction setColor(name: string, color: Color) {\n document.documentElement.style.setProperty(`--${name}`, color.main);\n document.documentElement.style.setProperty(`--${name}-light`, color.light);\n document.documentElement.style.setProperty(`--${name}-dark`, color.dark);\n document.documentElement.style.setProperty(`--${name}-contrast`, color.contrast);\n document.documentElement.style.setProperty(`--${name}-opacity`, color.opacity);\n}\n\nfunction ensureStylesheet(href: string) {\n if (document.querySelector(`link[href=\"${href}\"]`)) return;\n const link = document.createElement('link');\n link.rel = 'stylesheet';\n link.href = href;\n document.head.appendChild(link);\n}\n\nexport function applyTheme(theme: ThemeBuilded) {\n if (typeof window === 'undefined') { return; }\n\n const { palette, shape, spacing, typography } = theme;\n\n if (typography.url) { ensureStylesheet(typography.url); }\n\n // COLORS\n setColor('info', palette.info);\n setColor('error', palette.error);\n setColor('warning', palette.warning);\n setColor('success', palette.success);\n setColor('primary', palette.primary);\n setColor('secondary', palette.secondary);\n\n // GREY\n setColor('grey', palette.grey);\n\n // TYPOGRAPHY\n document.documentElement.style.setProperty('--typography', typography.family);\n\n // TEXT\n document.documentElement.style.setProperty('--text-primary', palette.text?.primary);\n document.documentElement.style.setProperty('--text-secondary', palette.text?.secondary);\n document.documentElement.style.setProperty('--text-disabled', palette.text?.disabled);\n\n // BACKGROUND\n document.documentElement.style.setProperty('--background-paper', palette.background?.paper);\n document.documentElement.style.setProperty('--background-default', palette.background?.default);\n\n // DIVIDER\n document.documentElement.style.setProperty('--divider', palette.divider);\n\n // SHAPE\n document.documentElement.style.setProperty('--radius', `${shape.radius}px`);\n\n // SPACING\n document.documentElement.style.setProperty('--spacing', `${spacing}px`);\n}","import type { Theme } from './Theme';\n\nexport const defaultSpacing: Theme['spacing'] = 8;\nexport const defaultShape: Theme['shape'] = { radius: 8 };\n\nexport const themeDefaultLight: Theme = {\n mode: 'light',\n palette: {\n info: '#72E4FC',\n error: '#FF5377',\n warning: '#FF9457',\n success: '#36E79B',\n primary: '#6C37F4',\n secondary: '#FB7185', //C026D3 // F97316 // FB7185 // F59E0B\n grey: '#F4F4F4',\n text: {\n primary: 'rgb(31, 41, 55)',\n secondary: 'rgb(75, 85, 99)',\n disabled: 'rgb(172, 172, 172)'\n },\n background: {\n paper: '#F9F8F9',\n default: '#FFF',\n },\n divider: 'rgba(0, 0, 0, 0.12)'\n },\n spacing: defaultSpacing,\n shape: defaultShape,\n typography: {\n family: 'Poppins',\n // eslint-disable-next-line\n url: 'https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap'\n }\n};\n\nexport const themeDefaultDark: Theme = {\n mode: 'dark',\n palette: {\n info: '#72E4FC',\n error: '#FF5377',\n warning: '#FF9457',\n success: '#36E79B',\n primary: '#6C37F4',\n secondary: '#EBFF5E',\n grey: '#2A2A2A',\n text: {\n primary: 'rgba(255, 255, 255, 0.87)',\n secondary: 'rgba(255, 255, 255, 0.6)',\n disabled: 'rgba(255, 255, 255, 0.38)'\n },\n background: {\n paper: '#0D0225',\n default: '#30294E',\n },\n divider: 'rgba(255, 255, 255, 0.12)'\n },\n spacing: defaultSpacing,\n shape: defaultShape,\n typography: {\n family: 'Poppins',\n // eslint-disable-next-line\n url: 'https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap'\n }\n};","import { generateSupportColors } from '../../utils';\nimport type { ThemeBuilded, ThemeOptions } from '../Theme';\nimport { themeDefaultDark, themeDefaultLight } from '../defaultTheme';\n\nconst SUPPORT_KEYS = [\n 'primary',\n 'secondary',\n 'error',\n 'warning',\n 'success',\n 'info',\n 'grey',\n] as const;\n\ntype SupportKey = (typeof SUPPORT_KEYS)[number];\n\nexport function createTheme(theme?: ThemeOptions): ThemeBuilded {\n const mode = theme?.mode ?? 'light';\n const ref = mode === 'dark' ? themeDefaultDark : themeDefaultLight;\n\n const paletteFromUser = theme?.palette ?? {};\n const paletteFromRef = ref.palette;\n\n const supportColors = Object.fromEntries(\n SUPPORT_KEYS.map((key) => [\n key,\n generateSupportColors(paletteFromUser[key] ?? paletteFromRef[key]),\n ])\n ) as Record<SupportKey, ThemeBuilded['palette'][SupportKey]>;\n\n return {\n mode,\n palette: {\n text: paletteFromUser.text ?? paletteFromRef.text,\n background: paletteFromUser.background ?? paletteFromRef.background,\n divider: paletteFromUser.divider ?? paletteFromRef.divider,\n ...supportColors,\n },\n shape: theme?.shape ?? ref.shape,\n spacing: theme?.spacing ?? ref.spacing,\n typography: theme?.typography ?? ref.typography,\n };\n}","import { createContext, useEffect, useMemo, useState, type PropsWithChildren } from 'react';\n\nimport type { ThemeBuilded } from '@iziui/core/theme';\nimport { createTheme, applyTheme, themeDefaultLight } from '@iziui/core/theme';\n\nimport '@iziui/styles/base/_base.scss';\n\nexport interface ThemeContextConfig {\n theme: ThemeBuilded;\n updateTheme: (theme: ThemeBuilded) => void;\n}\n\nexport const ThemeContext = createContext<ThemeContextConfig>({\n theme: createTheme(themeDefaultLight),\n updateTheme: () => { },\n});\n\ntype ThemeProviderProps = PropsWithChildren<{ theme: ThemeBuilded; }>\nexport default function ThemeProvider({ theme, children }: ThemeProviderProps) {\n const [_theme, setTheme] = useState<ThemeBuilded>(theme);\n\n const context = useMemo<ThemeContextConfig>(() => ({\n theme: _theme,\n updateTheme: (newTheme: ThemeBuilded) => updateTheme(newTheme),\n }), [theme, _theme]);\n\n useEffect(() => { applyTheme(_theme); }, [_theme]);\n\n const updateTheme = (newTheme: ThemeBuilded) => { setTheme(newTheme); };\n\n return (\n <ThemeContext.Provider value={context}>\n {children}\n </ThemeContext.Provider>\n );\n}\n\n","import { useContext } from 'react';\n\nimport { ThemeContext } from './ThemeProvider';\n\nexport default function useTheme() {\n return useContext(ThemeContext);\n}"],"names":["hslToHex","h","s","l","c","x","m","r","g","b","newR","newG","newB","adjustLightness","amount","hexToHsl","hex","max","min","d","getOpacityColor","hexColor","opacity","alphaHex","getContrastColor","generateSupportColors","hsl","contrastColor","lighterColor","darkerColor","opacityColor","generateMappedColor","color","createMappedColors","_colors","acc","mapped","colors","setColor","name","ensureStylesheet","href","link","applyTheme","theme","palette","shape","spacing","typography","defaultSpacing","defaultShape","themeDefaultLight","themeDefaultDark","SUPPORT_KEYS","createTheme","mode","ref","paletteFromUser","paletteFromRef","supportColors","key","ThemeContext","createContext","ThemeProvider","children","_theme","setTheme","useState","context","useMemo","newTheme","updateTheme","useEffect","useTheme","useContext"],"mappings":"qEAAO,SAASA,EAASC,EAAWC,EAAWC,EAAW,CACxDD,GAAK,IACLC,GAAK,IAEL,MAAMC,GAAK,EAAI,KAAK,IAAI,EAAID,EAAI,CAAC,GAAKD,EAChCG,EAAID,GAAK,EAAI,KAAK,IAAKH,EAAI,GAAM,EAAI,CAAC,GACtCK,EAAIH,EAAIC,EAAI,EAClB,IAAIG,EAAI,EAAGC,EAAI,EAAGC,EAAI,EAElB,GAAKR,GAAKA,EAAI,IAAMM,EAAIH,EAAGI,EAAIH,EAAGI,EAAI,GACjC,IAAMR,GAAKA,EAAI,KAAOM,EAAIF,EAAGG,EAAIJ,EAAGK,EAAI,GACxC,KAAOR,GAAKA,EAAI,KAAOM,EAAI,EAAGC,EAAIJ,EAAGK,EAAIJ,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Q,CAAA,GAC3D,CAAC1B,EAAOqB,CAAM,CAAC,EAEnBO,EAAAA,UAAU,IAAM,CAAE7B,EAAWsB,CAAM,CAAG,EAAG,CAACA,CAAM,CAAC,EAEjD,MAAMM,EAAeD,GAA2B,CAAEJ,EAASI,CAAQ,CAAG,EAEtE,aACGT,EAAa,SAAb,CAAsB,MAAOO,EAC3B,SAAAJ,EACH,CAEJ,CC/BA,SAAwBS,GAAW,CACjC,OAAOC,EAAAA,WAAWb,CAAY,CAChC"}
1
+ {"version":3,"file":"useTheme-C83CaSLO.cjs","sources":["../../../../core/src/utils/hslToHex/hslToHex.ts","../../../../core/src/utils/adjustLightness/adjustLightness.ts","../../../../core/src/utils/hexToHsl/hexToHsl.ts","../../../../core/src/utils/getOpacityColor/getOpacityColor.ts","../../../../core/src/utils/getContrastColor/getContrastColor.ts","../../../../core/src/utils/generateSupportColors/generateSupportColors.ts","../../../../core/src/theme/createMappedColors.ts","../../../../core/src/theme/Theme.ts","../../../../core/src/theme/applyTheme/applyTheme.ts","../../../../core/src/theme/defaultTheme.ts","../../../../core/src/theme/createTheme/createTheme.ts","../../src/theme/ThemeProvider.tsx","../../src/theme/useTheme.ts"],"sourcesContent":["export function hslToHex(h: number, s: number, l: number) {\n s /= 100;\n l /= 100;\n\n const c = (1 - Math.abs(2 * l - 1)) * s;\n const x = c * (1 - Math.abs((h / 60) % 2 - 1));\n const m = l - c / 2;\n let r = 0, g = 0, b = 0;\n\n if (0 <= h && h < 60) { r = c; g = x; b = 0; }\n else if (60 <= h && h < 120) { r = x; g = c; b = 0; }\n else if (120 <= h && h < 180) { r = 0; g = c; b = x; }\n else if (180 <= h && h < 240) { r = 0; g = x; b = c; }\n else if (240 <= h && h < 300) { r = x; g = 0; b = c; }\n else if (300 <= h && h < 360) { r = c; g = 0; b = x; }\n\n const newR = Math.round((r + m) * 255).toString(16).padStart(2, '0');\n const newG = Math.round((g + m) * 255).toString(16).padStart(2, '0');\n const newB = Math.round((b + m) * 255).toString(16).padStart(2, '0');\n\n return `#${newR}${newG}${newB}`;\n}","import { hslToHex } from '../hslToHex';\n\nexport function adjustLightness(h: number, s: number, l: number, amount: number) {\n l = Math.min(Math.max(l + amount, 0), 100);\n return hslToHex(h, s, l);\n}","export function hexToHsl(hex: string) {\n const r = parseInt(hex.slice(1, 3), 16) / 255;\n const g = parseInt(hex.slice(3, 5), 16) / 255;\n const b = parseInt(hex.slice(5, 7), 16) / 255;\n\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n let h = 0, s = 0;\n const l = (max + min) / 2;\n\n if (max === min) {\n h = s = 0; // acromático\n } else {\n const d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n\n switch (max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n h *= 60;\n }\n\n return { h, s: s * 100, l: l * 100 };\n}","/**\n * Adiciona opacidade a uma cor em hexadecimal.\n * @param hexColor - A cor em hexadecimal (ex: #RRGGBB ou #RGB).\n * @param opacity - O valor da opacidade (entre 0 e 1).\n * @returns A cor hexadecimal com opacidade (ex: #RRGGBBAA).\n */\nexport function getOpacityColor(hexColor: string, opacity: number): string {\n // Validar entrada do hexadecimal\n const hexPattern = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;\n if (!hexPattern.test(hexColor)) {\n throw new Error('Cor inválida. Use um formato hexadecimal (#RRGGBB ou #RGB).');\n }\n\n // Expandir formato #RGB para #RRGGBB\n if (hexColor.length === 4) {\n hexColor = `#${hexColor[1]}${hexColor[1]}${hexColor[2]}${hexColor[2]}${hexColor[3]}${hexColor[3]}`;\n }\n\n // Converter opacidade para formato hexadecimal (0 a 255)\n const alpha = Math.round(opacity * 255);\n const alphaHex = alpha.toString(16).padStart(2, '0').toUpperCase();\n\n // Combinar cor com opacidade\n return `${hexColor}${alphaHex}`;\n}","export function getContrastColor(hexColor: string) {\n // Converter hexadecimal para RGB\n const r = parseInt(hexColor.slice(1, 3), 16) / 255;\n const g = parseInt(hexColor.slice(3, 5), 16) / 255;\n const b = parseInt(hexColor.slice(5, 7), 16) / 255;\n\n // Calcular a luminância relativa\n const luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;\n\n // Se a luminância for baixa, usar branco como contraste, senão preto\n return luminance > 0.6 ? '#000000' : '#ffffff';\n}","import type { Color } from '../../theme';\nimport { hexToHsl } from '../hexToHsl';\nimport { adjustLightness } from '../adjustLightness';\nimport { getOpacityColor } from '../getOpacityColor';\nimport { getContrastColor } from '../getContrastColor/getContrastColor';\n\nexport function generateSupportColors(hex: string): Color {\n const variation = 20;\n\n const hsl = hexToHsl(hex);\n\n const contrastColor = getContrastColor(hex);\n const lighterColor = adjustLightness(hsl.h, hsl.s, hsl.l, variation);\n const darkerColor = adjustLightness(hsl.h, hsl.s, hsl.l, -variation * 1.7);\n const opacityColor = getOpacityColor(hex, variation / 100);\n\n return {\n main: hex,\n dark: darkerColor,\n light: lighterColor,\n opacity: opacityColor,\n contrast: contrastColor\n };\n}","import type { MappedColors, Colors, colors } from './Theme';\n\nfunction generateMappedColor(color: Colors): MappedColors[] {\n return [\n `${color}.main`,\n `${color}.dark`,\n `${color}.light`,\n `${color}.opacity`,\n `${color}.contrast`,\n ];\n}\n\nexport function createMappedColors(_colors: typeof colors): MappedColors[] {\n return _colors.reduce<MappedColors[]>((acc, color) => {\n const mapped = generateMappedColor(color);\n\n acc = [...acc, ...mapped];\n\n return acc;\n }, [\n 'text.primary',\n 'text.secondary',\n 'text.disabled',\n 'background.paper',\n 'background.default',\n 'divider'\n ]);\n}","import type { Path } from '@iziui/toolkit/interface';\n\nimport { createMappedColors } from './createMappedColors';\n\nexport const colors = ['primary', 'secondary', 'error', 'warning', 'success', 'info'] as const;\nexport const mappedColors = createMappedColors(colors);\n\nexport type Mode = 'light' | 'dark'\n\nexport type MappedColors = Path<PaletteBuilded>;\nexport type Colors = typeof colors[number];\n\nexport type Size = 'small' | 'medium' | 'large';\n\nexport interface Color {\n main: string;\n dark: string;\n light: string;\n opacity: string;\n contrast: string;\n}\n\nexport interface Palette {\n info: string;\n error: string;\n warning: string;\n success: string;\n primary: string;\n secondary: string;\n grey: string;\n text: {\n primary: string;\n secondary: string;\n disabled: string;\n };\n background: {\n paper: string;\n default: string;\n };\n divider: string;\n}\n\nexport type Spacing = number;\nexport type Shape = { radius: number; }\nexport type Typography = { family: string; url?: string; }\n\nexport interface PaletteBuilded extends Pick<Palette, 'text' | 'background' | 'divider'> {\n grey: Color;\n info: Color;\n error: Color;\n warning: Color;\n success: Color;\n primary: Color;\n secondary: Color;\n}\n\nexport interface Theme {\n mode: Mode;\n shape: Shape;\n palette: Palette;\n spacing: Spacing;\n typography: Typography;\n}\n\nexport interface ThemeOptions extends Omit<Partial<Theme>, 'palette'> {\n palette?: Partial<Palette>;\n}\nexport interface ThemeBuilded extends Omit<Theme, 'palette'> {\n palette: PaletteBuilded;\n}\n","import type { ThemeBuilded, Color } from '../Theme';\n\nfunction setColor(name: string, color: Color) {\n document.documentElement.style.setProperty(`--${name}`, color.main);\n document.documentElement.style.setProperty(`--${name}-light`, color.light);\n document.documentElement.style.setProperty(`--${name}-dark`, color.dark);\n document.documentElement.style.setProperty(`--${name}-contrast`, color.contrast);\n document.documentElement.style.setProperty(`--${name}-opacity`, color.opacity);\n}\n\nfunction ensureStylesheet(href: string) {\n if (document.querySelector(`link[href=\"${href}\"]`)) return;\n const link = document.createElement('link');\n link.rel = 'stylesheet';\n link.href = href;\n document.head.appendChild(link);\n}\n\nexport function applyTheme(theme: ThemeBuilded) {\n if (typeof window === 'undefined') { return; }\n\n const { palette, shape, spacing, typography } = theme;\n\n if (typography.url) { ensureStylesheet(typography.url); }\n\n // COLORS\n setColor('info', palette.info);\n setColor('error', palette.error);\n setColor('warning', palette.warning);\n setColor('success', palette.success);\n setColor('primary', palette.primary);\n setColor('secondary', palette.secondary);\n\n // GREY\n setColor('grey', palette.grey);\n\n // TYPOGRAPHY\n document.documentElement.style.setProperty('--typography', typography.family);\n\n // TEXT\n document.documentElement.style.setProperty('--text-primary', palette.text?.primary);\n document.documentElement.style.setProperty('--text-secondary', palette.text?.secondary);\n document.documentElement.style.setProperty('--text-disabled', palette.text?.disabled);\n\n // BACKGROUND\n document.documentElement.style.setProperty('--background-paper', palette.background?.paper);\n document.documentElement.style.setProperty('--background-default', palette.background?.default);\n\n // DIVIDER\n document.documentElement.style.setProperty('--divider', palette.divider);\n\n // SHAPE\n document.documentElement.style.setProperty('--radius', `${shape.radius}px`);\n\n // SPACING\n document.documentElement.style.setProperty('--spacing', `${spacing}px`);\n}","import type { Theme } from './Theme';\n\nexport const defaultSpacing: Theme['spacing'] = 8;\nexport const defaultShape: Theme['shape'] = { radius: 8 };\n\nexport const themeDefaultLight: Theme = {\n mode: 'light',\n palette: {\n info: '#72E4FC',\n error: '#FF5377',\n warning: '#FF9457',\n success: '#36E79B',\n primary: '#6C37F4',\n secondary: '#FB7185', //C026D3 // F97316 // FB7185 // F59E0B\n grey: '#F4F4F4',\n text: {\n primary: 'rgb(31, 41, 55)',\n secondary: 'rgb(75, 85, 99)',\n disabled: 'rgb(172, 172, 172)'\n },\n background: {\n paper: '#F9F8F9',\n default: '#FFF',\n },\n divider: 'rgba(0, 0, 0, 0.12)'\n },\n spacing: defaultSpacing,\n shape: defaultShape,\n typography: {\n family: 'Poppins',\n // eslint-disable-next-line\n url: 'https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap'\n }\n};\n\nexport const themeDefaultDark: Theme = {\n mode: 'dark',\n palette: {\n info: '#72E4FC',\n error: '#FF5377',\n warning: '#FF9457',\n success: '#36E79B',\n primary: '#6C37F4',\n secondary: '#EBFF5E',\n grey: '#2A2A2A',\n text: {\n primary: 'rgba(255, 255, 255, 0.87)',\n secondary: 'rgba(255, 255, 255, 0.6)',\n disabled: 'rgba(255, 255, 255, 0.38)'\n },\n background: {\n paper: '#0D0225',\n default: '#30294E',\n },\n divider: 'rgba(255, 255, 255, 0.12)'\n },\n spacing: defaultSpacing,\n shape: defaultShape,\n typography: {\n family: 'Poppins',\n // eslint-disable-next-line\n url: 'https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap'\n }\n};","import { generateSupportColors } from '../../utils';\nimport type { ThemeBuilded, ThemeOptions } from '../Theme';\nimport { themeDefaultDark, themeDefaultLight } from '../defaultTheme';\n\nconst SUPPORT_KEYS = [\n 'primary',\n 'secondary',\n 'error',\n 'warning',\n 'success',\n 'info',\n 'grey',\n] as const;\n\ntype SupportKey = (typeof SUPPORT_KEYS)[number];\n\nexport function createTheme(theme?: ThemeOptions): ThemeBuilded {\n const mode = theme?.mode ?? 'light';\n const ref = mode === 'dark' ? themeDefaultDark : themeDefaultLight;\n\n const paletteFromUser = theme?.palette ?? {};\n const paletteFromRef = ref.palette;\n\n const supportColors = Object.fromEntries(\n SUPPORT_KEYS.map((key) => [\n key,\n generateSupportColors(paletteFromUser[key] ?? paletteFromRef[key]),\n ])\n ) as Record<SupportKey, ThemeBuilded['palette'][SupportKey]>;\n\n return {\n mode,\n palette: {\n text: paletteFromUser.text ?? paletteFromRef.text,\n background: paletteFromUser.background ?? paletteFromRef.background,\n divider: paletteFromUser.divider ?? paletteFromRef.divider,\n ...supportColors,\n },\n shape: theme?.shape ?? ref.shape,\n spacing: theme?.spacing ?? ref.spacing,\n typography: theme?.typography ?? ref.typography,\n };\n}","import { createContext, useEffect, useMemo, useState, type PropsWithChildren } from 'react';\n\nimport type { ThemeBuilded } from '@iziui/core/theme';\nimport { createTheme, applyTheme, themeDefaultLight } from '@iziui/core/theme';\n\nimport '@iziui/styles/base/_base.scss';\n\nexport interface ThemeContextConfig {\n theme: ThemeBuilded;\n updateTheme: (theme: ThemeBuilded) => void;\n}\n\nexport const ThemeContext = createContext<ThemeContextConfig>({\n theme: createTheme(themeDefaultLight),\n updateTheme: () => { },\n});\n\ntype ThemeProviderProps = PropsWithChildren<{ theme: ThemeBuilded; }>\nexport default function ThemeProvider({ theme, children }: ThemeProviderProps) {\n const [_theme, setTheme] = useState<ThemeBuilded>(theme);\n\n const context = useMemo<ThemeContextConfig>(() => ({\n theme: _theme,\n updateTheme: (newTheme: ThemeBuilded) => updateTheme(newTheme),\n }), [theme, _theme]);\n\n useEffect(() => { applyTheme(_theme); }, [_theme]);\n\n const updateTheme = (newTheme: ThemeBuilded) => { setTheme(newTheme); };\n\n return (\n <ThemeContext.Provider value={context}>\n {children}\n </ThemeContext.Provider>\n );\n}\n\n","import { useContext } from 'react';\n\nimport { ThemeContext } from './ThemeProvider';\n\nexport default function useTheme() {\n return useContext(ThemeContext);\n}"],"names":["hslToHex","h","s","l","c","x","m","r","g","b","newR","newG","newB","adjustLightness","amount","hexToHsl","hex","max","min","d","getOpacityColor","hexColor","opacity","alphaHex","getContrastColor","generateSupportColors","hsl","contrastColor","lighterColor","darkerColor","opacityColor","generateMappedColor","color","createMappedColors","_colors","acc","mapped","colors","setColor","name","ensureStylesheet","href","link","applyTheme","theme","palette","shape","spacing","typography","defaultSpacing","defaultShape","themeDefaultLight","themeDefaultDark","SUPPORT_KEYS","createTheme","mode","ref","paletteFromUser","paletteFromRef","supportColors","key","ThemeContext","createContext","ThemeProvider","children","_theme","setTheme","useState","context","useMemo","newTheme","updateTheme","useEffect","useTheme","useContext"],"mappings":"qEAAO,SAASA,EAASC,EAAWC,EAAWC,EAAW,CACxDD,GAAK,IACLC,GAAK,IAEL,MAAMC,GAAK,EAAI,KAAK,IAAI,EAAID,EAAI,CAAC,GAAKD,EAChCG,EAAID,GAAK,EAAI,KAAK,IAAKH,EAAI,GAAM,EAAI,CAAC,GACtCK,EAAIH,EAAIC,EAAI,EAClB,IAAIG,EAAI,EAAGC,EAAI,EAAGC,EAAI,EAElB,GAAKR,GAAKA,EAAI,IAAMM,EAAIH,EAAGI,EAAIH,EAAGI,EAAI,GACjC,IAAMR,GA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AQC,CAAQ,EAAIC,EAAAA,SAAuBvB,CAAK,EAEjDwB,EAAUC,EAAAA,QAA4B,KAAO,CACjD,MAAOJ,EACP,YAAcK,GAA2BC,EAAYD,CAAQ,CAAA,GAC3D,CAAC1B,EAAOqB,CAAM,CAAC,EAEnBO,EAAAA,UAAU,IAAM,CAAE7B,EAAWsB,CAAM,CAAG,EAAG,CAACA,CAAM,CAAC,EAEjD,MAAMM,EAAeD,GAA2B,CAAEJ,EAASI,CAAQ,CAAG,EAEtE,aACGT,EAAa,SAAb,CAAsB,MAAOO,EAC3B,SAAAJ,EACH,CAEJ,CC/BA,SAAwBS,GAAW,CACjC,OAAOC,EAAAA,WAAWb,CAAY,CAChC"}
@@ -1,2 +1,2 @@
1
1
  import{useState as b,useMemo as F,useEffect as E,createContext as $,useContext as P}from"react";import{jsx as k}from"react/jsx-runtime";function w(t,e,n){e/=100,n/=100;const r=(1-Math.abs(2*n-1))*e,a=r*(1-Math.abs(t/60%2-1)),o=n-r/2;let s=0,c=0,i=0;0<=t&&t<60?(s=r,c=a,i=0):60<=t&&t<120?(s=a,c=r,i=0):120<=t&&t<180?(s=0,c=r,i=a):180<=t&&t<240?(s=0,c=a,i=r):240<=t&&t<300?(s=a,c=0,i=r):300<=t&&t<360&&(s=r,c=0,i=a);const p=Math.round((s+o)*255).toString(16).padStart(2,"0"),f=Math.round((c+o)*255).toString(16).padStart(2,"0"),h=Math.round((i+o)*255).toString(16).padStart(2,"0");return`#${p}${f}${h}`}function u(t,e,n,r){return n=Math.min(Math.max(n+r,0),100),w(t,e,n)}function v(t){const e=parseInt(t.slice(1,3),16)/255,n=parseInt(t.slice(3,5),16)/255,r=parseInt(t.slice(5,7),16)/255,a=Math.max(e,n,r),o=Math.min(e,n,r);let s=0,c=0;const i=(a+o)/2;if(a===o)s=c=0;else{const p=a-o;switch(c=i>.5?p/(2-a-o):p/(a+o),a){case e:s=(n-r)/p+(n<r?6:0);break;case n:s=(r-e)/p+2;break;case r:s=(e-n)/p+4;break}s*=60}return{h:s,s:c*100,l:i*100}}function x(t,e){if(!/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(t))throw new Error("Cor inválida. Use um formato hexadecimal (#RRGGBB ou #RGB).");t.length===4&&(t=`#${t[1]}${t[1]}${t[2]}${t[2]}${t[3]}${t[3]}`);const a=Math.round(e*255).toString(16).padStart(2,"0").toUpperCase();return`${t}${a}`}function S(t){const e=parseInt(t.slice(1,3),16)/255,n=parseInt(t.slice(3,5),16)/255,r=parseInt(t.slice(5,7),16)/255;return .2126*e+.7152*n+.0722*r>.6?"#000000":"#ffffff"}function M(t){const n=v(t),r=S(t),a=u(n.h,n.s,n.l,20),o=u(n.h,n.s,n.l,-20*1.7),s=x(t,20/100);return{main:t,dark:o,light:a,opacity:s,contrast:r}}function T(t){return[`${t}.main`,`${t}.dark`,`${t}.light`,`${t}.opacity`,`${t}.contrast`]}function C(t){return t.reduce((e,n)=>{const r=T(n);return e=[...e,...r],e},["text.primary","text.secondary","text.disabled","background.paper","background.default","divider"])}const B=["primary","secondary","error","warning","success","info"];C(B);function d(t,e){document.documentElement.style.setProperty(`--${t}`,e.main),document.documentElement.style.setProperty(`--${t}-light`,e.light),document.documentElement.style.setProperty(`--${t}-dark`,e.dark),document.documentElement.style.setProperty(`--${t}-contrast`,e.contrast),document.documentElement.style.setProperty(`--${t}-opacity`,e.opacity)}function I(t){if(document.querySelector(`link[href="${t}"]`))return;const e=document.createElement("link");e.rel="stylesheet",e.href=t,document.head.appendChild(e)}function R(t){if(typeof window>"u")return;const{palette:e,shape:n,spacing:r,typography:a}=t;a.url&&I(a.url),d("info",e.info),d("error",e.error),d("warning",e.warning),d("success",e.success),d("primary",e.primary),d("secondary",e.secondary),d("grey",e.grey),document.documentElement.style.setProperty("--typography",a.family),document.documentElement.style.setProperty("--text-primary",e.text?.primary),document.documentElement.style.setProperty("--text-secondary",e.text?.secondary),document.documentElement.style.setProperty("--text-disabled",e.text?.disabled),document.documentElement.style.setProperty("--background-paper",e.background?.paper),document.documentElement.style.setProperty("--background-default",e.background?.default),document.documentElement.style.setProperty("--divider",e.divider),document.documentElement.style.setProperty("--radius",`${n.radius}px`),document.documentElement.style.setProperty("--spacing",`${r}px`)}const l=8,m={radius:8},y={mode:"light",palette:{info:"#72E4FC",error:"#FF5377",warning:"#FF9457",success:"#36E79B",primary:"#6C37F4",secondary:"#FB7185",grey:"#F4F4F4",text:{primary:"rgb(31, 41, 55)",secondary:"rgb(75, 85, 99)",disabled:"rgb(172, 172, 172)"},background:{paper:"#F9F8F9",default:"#FFF"},divider:"rgba(0, 0, 0, 0.12)"},spacing:l,shape:m,typography:{family:"Poppins",url:"https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap"}},A={palette:{info:"#72E4FC",error:"#FF5377",warning:"#FF9457",success:"#36E79B",primary:"#6C37F4",secondary:"#EBFF5E",grey:"#2A2A2A",text:{primary:"rgba(255, 255, 255, 0.87)",secondary:"rgba(255, 255, 255, 0.6)",disabled:"rgba(255, 255, 255, 0.38)"},background:{paper:"#0D0225",default:"#30294E"},divider:"rgba(255, 255, 255, 0.12)"},spacing:l,shape:m,typography:{family:"Poppins",url:"https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap"}},D=["primary","secondary","error","warning","success","info","grey"];function G(t){const e=t?.mode??"light",n=e==="dark"?A:y,r=t?.palette??{},a=n.palette,o=Object.fromEntries(D.map(s=>[s,M(r[s]??a[s])]));return{mode:e,palette:{text:r.text??a.text,background:r.background??a.background,divider:r.divider??a.divider,...o},shape:t?.shape??n.shape,spacing:t?.spacing??n.spacing,typography:t?.typography??n.typography}}const g=$({theme:G(y),updateTheme:()=>{}});function H({theme:t,children:e}){const[n,r]=b(t),a=F(()=>({theme:n,updateTheme:s=>o(s)}),[t,n]);E(()=>{R(n)},[n]);const o=s=>{r(s)};return k(g.Provider,{value:a,children:e})}function O(){return P(g)}export{H as T,G as c,S as g,O as u};
2
- //# sourceMappingURL=useTheme-BhIs8Txu.js.map
2
+ //# sourceMappingURL=useTheme-DNLVLxKW.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTheme-BhIs8Txu.js","sources":["../../../../core/src/utils/hslToHex/hslToHex.ts","../../../../core/src/utils/adjustLightness/adjustLightness.ts","../../../../core/src/utils/hexToHsl/hexToHsl.ts","../../../../core/src/utils/getOpacityColor/getOpacityColor.ts","../../../../core/src/utils/getContrastColor/getContrastColor.ts","../../../../core/src/utils/generateSupportColors/generateSupportColors.ts","../../../../core/src/theme/createMappedColors.ts","../../../../core/src/theme/Theme.ts","../../../../core/src/theme/applyTheme/applyTheme.ts","../../../../core/src/theme/defaultTheme.ts","../../../../core/src/theme/createTheme/createTheme.ts","../../src/theme/ThemeProvider.tsx","../../src/theme/useTheme.ts"],"sourcesContent":["export function hslToHex(h: number, s: number, l: number) {\n s /= 100;\n l /= 100;\n\n const c = (1 - Math.abs(2 * l - 1)) * s;\n const x = c * (1 - Math.abs((h / 60) % 2 - 1));\n const m = l - c / 2;\n let r = 0, g = 0, b = 0;\n\n if (0 <= h && h < 60) { r = c; g = x; b = 0; }\n else if (60 <= h && h < 120) { r = x; g = c; b = 0; }\n else if (120 <= h && h < 180) { r = 0; g = c; b = x; }\n else if (180 <= h && h < 240) { r = 0; g = x; b = c; }\n else if (240 <= h && h < 300) { r = x; g = 0; b = c; }\n else if (300 <= h && h < 360) { r = c; g = 0; b = x; }\n\n const newR = Math.round((r + m) * 255).toString(16).padStart(2, '0');\n const newG = Math.round((g + m) * 255).toString(16).padStart(2, '0');\n const newB = Math.round((b + m) * 255).toString(16).padStart(2, '0');\n\n return `#${newR}${newG}${newB}`;\n}","import { hslToHex } from '../hslToHex';\n\nexport function adjustLightness(h: number, s: number, l: number, amount: number) {\n l = Math.min(Math.max(l + amount, 0), 100);\n return hslToHex(h, s, l);\n}","export function hexToHsl(hex: string) {\n const r = parseInt(hex.slice(1, 3), 16) / 255;\n const g = parseInt(hex.slice(3, 5), 16) / 255;\n const b = parseInt(hex.slice(5, 7), 16) / 255;\n\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n let h = 0, s = 0;\n const l = (max + min) / 2;\n\n if (max === min) {\n h = s = 0; // acromático\n } else {\n const d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n\n switch (max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n h *= 60;\n }\n\n return { h, s: s * 100, l: l * 100 };\n}","/**\n * Adiciona opacidade a uma cor em hexadecimal.\n * @param hexColor - A cor em hexadecimal (ex: #RRGGBB ou #RGB).\n * @param opacity - O valor da opacidade (entre 0 e 1).\n * @returns A cor hexadecimal com opacidade (ex: #RRGGBBAA).\n */\nexport function getOpacityColor(hexColor: string, opacity: number): string {\n // Validar entrada do hexadecimal\n const hexPattern = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;\n if (!hexPattern.test(hexColor)) {\n throw new Error('Cor inválida. Use um formato hexadecimal (#RRGGBB ou #RGB).');\n }\n\n // Expandir formato #RGB para #RRGGBB\n if (hexColor.length === 4) {\n hexColor = `#${hexColor[1]}${hexColor[1]}${hexColor[2]}${hexColor[2]}${hexColor[3]}${hexColor[3]}`;\n }\n\n // Converter opacidade para formato hexadecimal (0 a 255)\n const alpha = Math.round(opacity * 255);\n const alphaHex = alpha.toString(16).padStart(2, '0').toUpperCase();\n\n // Combinar cor com opacidade\n return `${hexColor}${alphaHex}`;\n}","export function getContrastColor(hexColor: string) {\n // Converter hexadecimal para RGB\n const r = parseInt(hexColor.slice(1, 3), 16) / 255;\n const g = parseInt(hexColor.slice(3, 5), 16) / 255;\n const b = parseInt(hexColor.slice(5, 7), 16) / 255;\n\n // Calcular a luminância relativa\n const luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;\n\n // Se a luminância for baixa, usar branco como contraste, senão preto\n return luminance > 0.6 ? '#000000' : '#ffffff';\n}","import type { Color } from '../../theme';\nimport { hexToHsl } from '../hexToHsl';\nimport { adjustLightness } from '../adjustLightness';\nimport { getOpacityColor } from '../getOpacityColor';\nimport { getContrastColor } from '../getContrastColor/getContrastColor';\n\nexport function generateSupportColors(hex: string): Color {\n const variation = 20;\n\n const hsl = hexToHsl(hex);\n\n const contrastColor = getContrastColor(hex);\n const lighterColor = adjustLightness(hsl.h, hsl.s, hsl.l, variation);\n const darkerColor = adjustLightness(hsl.h, hsl.s, hsl.l, -variation * 1.7);\n const opacityColor = getOpacityColor(hex, variation / 100);\n\n return {\n main: hex,\n dark: darkerColor,\n light: lighterColor,\n opacity: opacityColor,\n contrast: contrastColor\n };\n}","import type { MappedColors, Colors, colors } from './Theme';\n\nfunction generateMappedColor(color: Colors): MappedColors[] {\n return [\n `${color}.main`,\n `${color}.dark`,\n `${color}.light`,\n `${color}.opacity`,\n `${color}.contrast`,\n ];\n}\n\nexport function createMappedColors(_colors: typeof colors): MappedColors[] {\n return _colors.reduce<MappedColors[]>((acc, color) => {\n const mapped = generateMappedColor(color);\n\n acc = [...acc, ...mapped];\n\n return acc;\n }, [\n 'text.primary',\n 'text.secondary',\n 'text.disabled',\n 'background.paper',\n 'background.default',\n 'divider'\n ]);\n}","import type { Path } from '@iziui/toolkit/interface';\n\nimport { createMappedColors } from './createMappedColors';\n\nexport const colors = ['primary', 'secondary', 'error', 'warning', 'success', 'info'] as const;\nexport const mappedColors = createMappedColors(colors);\n\nexport type Mode = 'light' | 'dark'\n\nexport type MappedColors = Path<PaletteBuilded>;\nexport type Colors = typeof colors[number];\n\nexport type Size = 'small' | 'medium' | 'large';\n\nexport interface Color {\n main: string;\n dark: string;\n light: string;\n opacity: string;\n contrast: string;\n}\n\nexport interface Palette {\n info: string;\n error: string;\n warning: string;\n success: string;\n primary: string;\n secondary: string;\n grey: string;\n text: {\n primary: string;\n secondary: string;\n disabled: string;\n };\n background: {\n paper: string;\n default: string;\n };\n divider: string;\n}\n\nexport type Spacing = number;\nexport type Shape = { radius: number; }\nexport type Typography = { family: string; url?: string; }\n\nexport interface PaletteBuilded extends Pick<Palette, 'text' | 'background' | 'divider'> {\n grey: Color;\n info: Color;\n error: Color;\n warning: Color;\n success: Color;\n primary: Color;\n secondary: Color;\n}\n\nexport interface Theme {\n mode: Mode;\n shape: Shape;\n palette: Palette;\n spacing: Spacing;\n typography: Typography;\n}\n\nexport interface ThemeOptions extends Omit<Partial<Theme>, 'palette'> {\n palette?: Partial<Palette>;\n}\nexport interface ThemeBuilded extends Omit<Theme, 'palette'> {\n palette: PaletteBuilded;\n}\n","import type { ThemeBuilded, Color } from '../Theme';\n\nfunction setColor(name: string, color: Color) {\n document.documentElement.style.setProperty(`--${name}`, color.main);\n document.documentElement.style.setProperty(`--${name}-light`, color.light);\n document.documentElement.style.setProperty(`--${name}-dark`, color.dark);\n document.documentElement.style.setProperty(`--${name}-contrast`, color.contrast);\n document.documentElement.style.setProperty(`--${name}-opacity`, color.opacity);\n}\n\nfunction ensureStylesheet(href: string) {\n if (document.querySelector(`link[href=\"${href}\"]`)) return;\n const link = document.createElement('link');\n link.rel = 'stylesheet';\n link.href = href;\n document.head.appendChild(link);\n}\n\nexport function applyTheme(theme: ThemeBuilded) {\n if (typeof window === 'undefined') { return; }\n\n const { palette, shape, spacing, typography } = theme;\n\n if (typography.url) { ensureStylesheet(typography.url); }\n\n // COLORS\n setColor('info', palette.info);\n setColor('error', palette.error);\n setColor('warning', palette.warning);\n setColor('success', palette.success);\n setColor('primary', palette.primary);\n setColor('secondary', palette.secondary);\n\n // GREY\n setColor('grey', palette.grey);\n\n // TYPOGRAPHY\n document.documentElement.style.setProperty('--typography', typography.family);\n\n // TEXT\n document.documentElement.style.setProperty('--text-primary', palette.text?.primary);\n document.documentElement.style.setProperty('--text-secondary', palette.text?.secondary);\n document.documentElement.style.setProperty('--text-disabled', palette.text?.disabled);\n\n // BACKGROUND\n document.documentElement.style.setProperty('--background-paper', palette.background?.paper);\n document.documentElement.style.setProperty('--background-default', palette.background?.default);\n\n // DIVIDER\n document.documentElement.style.setProperty('--divider', palette.divider);\n\n // SHAPE\n document.documentElement.style.setProperty('--radius', `${shape.radius}px`);\n\n // SPACING\n document.documentElement.style.setProperty('--spacing', `${spacing}px`);\n}","import type { Theme } from './Theme';\n\nexport const defaultSpacing: Theme['spacing'] = 8;\nexport const defaultShape: Theme['shape'] = { radius: 8 };\n\nexport const themeDefaultLight: Theme = {\n mode: 'light',\n palette: {\n info: '#72E4FC',\n error: '#FF5377',\n warning: '#FF9457',\n success: '#36E79B',\n primary: '#6C37F4',\n secondary: '#FB7185', //C026D3 // F97316 // FB7185 // F59E0B\n grey: '#F4F4F4',\n text: {\n primary: 'rgb(31, 41, 55)',\n secondary: 'rgb(75, 85, 99)',\n disabled: 'rgb(172, 172, 172)'\n },\n background: {\n paper: '#F9F8F9',\n default: '#FFF',\n },\n divider: 'rgba(0, 0, 0, 0.12)'\n },\n spacing: defaultSpacing,\n shape: defaultShape,\n typography: {\n family: 'Poppins',\n // eslint-disable-next-line\n url: 'https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap'\n }\n};\n\nexport const themeDefaultDark: Theme = {\n mode: 'dark',\n palette: {\n info: '#72E4FC',\n error: '#FF5377',\n warning: '#FF9457',\n success: '#36E79B',\n primary: '#6C37F4',\n secondary: '#EBFF5E',\n grey: '#2A2A2A',\n text: {\n primary: 'rgba(255, 255, 255, 0.87)',\n secondary: 'rgba(255, 255, 255, 0.6)',\n disabled: 'rgba(255, 255, 255, 0.38)'\n },\n background: {\n paper: '#0D0225',\n default: '#30294E',\n },\n divider: 'rgba(255, 255, 255, 0.12)'\n },\n spacing: defaultSpacing,\n shape: defaultShape,\n typography: {\n family: 'Poppins',\n // eslint-disable-next-line\n url: 'https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap'\n }\n};","import { generateSupportColors } from '../../utils';\nimport type { ThemeBuilded, ThemeOptions } from '../Theme';\nimport { themeDefaultDark, themeDefaultLight } from '../defaultTheme';\n\nconst SUPPORT_KEYS = [\n 'primary',\n 'secondary',\n 'error',\n 'warning',\n 'success',\n 'info',\n 'grey',\n] as const;\n\ntype SupportKey = (typeof SUPPORT_KEYS)[number];\n\nexport function createTheme(theme?: ThemeOptions): ThemeBuilded {\n const mode = theme?.mode ?? 'light';\n const ref = mode === 'dark' ? themeDefaultDark : themeDefaultLight;\n\n const paletteFromUser = theme?.palette ?? {};\n const paletteFromRef = ref.palette;\n\n const supportColors = Object.fromEntries(\n SUPPORT_KEYS.map((key) => [\n key,\n generateSupportColors(paletteFromUser[key] ?? paletteFromRef[key]),\n ])\n ) as Record<SupportKey, ThemeBuilded['palette'][SupportKey]>;\n\n return {\n mode,\n palette: {\n text: paletteFromUser.text ?? paletteFromRef.text,\n background: paletteFromUser.background ?? paletteFromRef.background,\n divider: paletteFromUser.divider ?? paletteFromRef.divider,\n ...supportColors,\n },\n shape: theme?.shape ?? ref.shape,\n spacing: theme?.spacing ?? ref.spacing,\n typography: theme?.typography ?? ref.typography,\n };\n}","import { createContext, useEffect, useMemo, useState, type PropsWithChildren } from 'react';\n\nimport type { ThemeBuilded } from '@iziui/core/theme';\nimport { createTheme, applyTheme, themeDefaultLight } from '@iziui/core/theme';\n\nimport '@iziui/styles/base/_base.scss';\n\nexport interface ThemeContextConfig {\n theme: ThemeBuilded;\n updateTheme: (theme: ThemeBuilded) => void;\n}\n\nexport const ThemeContext = createContext<ThemeContextConfig>({\n theme: createTheme(themeDefaultLight),\n updateTheme: () => { },\n});\n\ntype ThemeProviderProps = PropsWithChildren<{ theme: ThemeBuilded; }>\nexport default function ThemeProvider({ theme, children }: ThemeProviderProps) {\n const [_theme, setTheme] = useState<ThemeBuilded>(theme);\n\n const context = useMemo<ThemeContextConfig>(() => ({\n theme: _theme,\n updateTheme: (newTheme: ThemeBuilded) => updateTheme(newTheme),\n }), [theme, _theme]);\n\n useEffect(() => { applyTheme(_theme); }, [_theme]);\n\n const updateTheme = (newTheme: ThemeBuilded) => { setTheme(newTheme); };\n\n return (\n <ThemeContext.Provider value={context}>\n {children}\n </ThemeContext.Provider>\n );\n}\n\n","import { useContext } from 'react';\n\nimport { ThemeContext } from './ThemeProvider';\n\nexport default function useTheme() {\n return useContext(ThemeContext);\n}"],"names":["hslToHex","h","s","l","c","x","m","r","g","b","newR","newG","newB","adjustLightness","amount","hexToHsl","hex","max","min","d","getOpacityColor","hexColor","opacity","alphaHex","getContrastColor","generateSupportColors","hsl","contrastColor","lighterColor","darkerColor","opacityColor","generateMappedColor","color","createMappedColors","_colors","acc","mapped","colors","setColor","name","ensureStylesheet","href","link","applyTheme","theme","palette","shape","spacing","typography","defaultSpacing","defaultShape","themeDefaultLight","themeDefaultDark","SUPPORT_KEYS","createTheme","mode","ref","paletteFromUser","paletteFromRef","supportColors","key","ThemeContext","createContext","ThemeProvider","children","_theme","setTheme","useState","context","useMemo","newTheme","updateTheme","useEffect","useTheme","useContext"],"mappings":"wIAAO,SAASA,EAASC,EAAWC,EAAWC,EAAW,CACxDD,GAAK,IACLC,GAAK,IAEL,MAAMC,GAAK,EAAI,KAAK,IAAI,EAAID,EAAI,CAAC,GAAKD,EAChCG,EAAID,GAAK,EAAI,KAAK,IAAKH,EAAI,GAAM,EAAI,CAAC,GACtCK,EAAIH,EAAIC,EAAI,EAClB,IAAIG,EAAI,EAAGC,EAAI,EAAGC,EAAI,EAElB,GAAKR,GAAKA,EAAI,IAAMM,EAAIH,EAAGI,EAAIH,EAAGI,EAAI,GACjC,IAAMR,GAAKA,EAAI,KAAOM,EAAIF,EAAGG,EAAIJ,EAAGK,EAAI,GACxC,KAAOR,GAAKA,EAAI,KAAOM,EAAI,EAAGC,EAAIJ,EAAGK,EAAIJ,GACzC,KAAOJ,GAAKA,EAAI,KAAOM,EAAI,EAAGC,EAAIH,EA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sB,CAAM,CAAG,EAAG,CAACA,CAAM,CAAC,EAEjD,MAAMM,EAAeD,GAA2B,CAAEJ,EAASI,CAAQ,CAAG,EAEtE,SACGT,EAAa,SAAb,CAAsB,MAAOO,EAC3B,SAAAJ,EACH,CAEJ,CC/BA,SAAwBS,GAAW,CACjC,OAAOC,EAAWb,CAAY,CAChC"}
1
+ {"version":3,"file":"useTheme-DNLVLxKW.js","sources":["../../../../core/src/utils/hslToHex/hslToHex.ts","../../../../core/src/utils/adjustLightness/adjustLightness.ts","../../../../core/src/utils/hexToHsl/hexToHsl.ts","../../../../core/src/utils/getOpacityColor/getOpacityColor.ts","../../../../core/src/utils/getContrastColor/getContrastColor.ts","../../../../core/src/utils/generateSupportColors/generateSupportColors.ts","../../../../core/src/theme/createMappedColors.ts","../../../../core/src/theme/Theme.ts","../../../../core/src/theme/applyTheme/applyTheme.ts","../../../../core/src/theme/defaultTheme.ts","../../../../core/src/theme/createTheme/createTheme.ts","../../src/theme/ThemeProvider.tsx","../../src/theme/useTheme.ts"],"sourcesContent":["export function hslToHex(h: number, s: number, l: number) {\n s /= 100;\n l /= 100;\n\n const c = (1 - Math.abs(2 * l - 1)) * s;\n const x = c * (1 - Math.abs((h / 60) % 2 - 1));\n const m = l - c / 2;\n let r = 0, g = 0, b = 0;\n\n if (0 <= h && h < 60) { r = c; g = x; b = 0; }\n else if (60 <= h && h < 120) { r = x; g = c; b = 0; }\n else if (120 <= h && h < 180) { r = 0; g = c; b = x; }\n else if (180 <= h && h < 240) { r = 0; g = x; b = c; }\n else if (240 <= h && h < 300) { r = x; g = 0; b = c; }\n else if (300 <= h && h < 360) { r = c; g = 0; b = x; }\n\n const newR = Math.round((r + m) * 255).toString(16).padStart(2, '0');\n const newG = Math.round((g + m) * 255).toString(16).padStart(2, '0');\n const newB = Math.round((b + m) * 255).toString(16).padStart(2, '0');\n\n return `#${newR}${newG}${newB}`;\n}","import { hslToHex } from '../hslToHex';\n\nexport function adjustLightness(h: number, s: number, l: number, amount: number) {\n l = Math.min(Math.max(l + amount, 0), 100);\n return hslToHex(h, s, l);\n}","export function hexToHsl(hex: string) {\n const r = parseInt(hex.slice(1, 3), 16) / 255;\n const g = parseInt(hex.slice(3, 5), 16) / 255;\n const b = parseInt(hex.slice(5, 7), 16) / 255;\n\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n let h = 0, s = 0;\n const l = (max + min) / 2;\n\n if (max === min) {\n h = s = 0; // acromático\n } else {\n const d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n\n switch (max) {\n case r: h = (g - b) / d + (g < b ? 6 : 0); break;\n case g: h = (b - r) / d + 2; break;\n case b: h = (r - g) / d + 4; break;\n }\n h *= 60;\n }\n\n return { h, s: s * 100, l: l * 100 };\n}","/**\n * Adiciona opacidade a uma cor em hexadecimal.\n * @param hexColor - A cor em hexadecimal (ex: #RRGGBB ou #RGB).\n * @param opacity - O valor da opacidade (entre 0 e 1).\n * @returns A cor hexadecimal com opacidade (ex: #RRGGBBAA).\n */\nexport function getOpacityColor(hexColor: string, opacity: number): string {\n // Validar entrada do hexadecimal\n const hexPattern = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;\n if (!hexPattern.test(hexColor)) {\n throw new Error('Cor inválida. Use um formato hexadecimal (#RRGGBB ou #RGB).');\n }\n\n // Expandir formato #RGB para #RRGGBB\n if (hexColor.length === 4) {\n hexColor = `#${hexColor[1]}${hexColor[1]}${hexColor[2]}${hexColor[2]}${hexColor[3]}${hexColor[3]}`;\n }\n\n // Converter opacidade para formato hexadecimal (0 a 255)\n const alpha = Math.round(opacity * 255);\n const alphaHex = alpha.toString(16).padStart(2, '0').toUpperCase();\n\n // Combinar cor com opacidade\n return `${hexColor}${alphaHex}`;\n}","export function getContrastColor(hexColor: string) {\n // Converter hexadecimal para RGB\n const r = parseInt(hexColor.slice(1, 3), 16) / 255;\n const g = parseInt(hexColor.slice(3, 5), 16) / 255;\n const b = parseInt(hexColor.slice(5, 7), 16) / 255;\n\n // Calcular a luminância relativa\n const luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;\n\n // Se a luminância for baixa, usar branco como contraste, senão preto\n return luminance > 0.6 ? '#000000' : '#ffffff';\n}","import type { Color } from '../../theme';\nimport { hexToHsl } from '../hexToHsl';\nimport { adjustLightness } from '../adjustLightness';\nimport { getOpacityColor } from '../getOpacityColor';\nimport { getContrastColor } from '../getContrastColor/getContrastColor';\n\nexport function generateSupportColors(hex: string): Color {\n const variation = 20;\n\n const hsl = hexToHsl(hex);\n\n const contrastColor = getContrastColor(hex);\n const lighterColor = adjustLightness(hsl.h, hsl.s, hsl.l, variation);\n const darkerColor = adjustLightness(hsl.h, hsl.s, hsl.l, -variation * 1.7);\n const opacityColor = getOpacityColor(hex, variation / 100);\n\n return {\n main: hex,\n dark: darkerColor,\n light: lighterColor,\n opacity: opacityColor,\n contrast: contrastColor\n };\n}","import type { MappedColors, Colors, colors } from './Theme';\n\nfunction generateMappedColor(color: Colors): MappedColors[] {\n return [\n `${color}.main`,\n `${color}.dark`,\n `${color}.light`,\n `${color}.opacity`,\n `${color}.contrast`,\n ];\n}\n\nexport function createMappedColors(_colors: typeof colors): MappedColors[] {\n return _colors.reduce<MappedColors[]>((acc, color) => {\n const mapped = generateMappedColor(color);\n\n acc = [...acc, ...mapped];\n\n return acc;\n }, [\n 'text.primary',\n 'text.secondary',\n 'text.disabled',\n 'background.paper',\n 'background.default',\n 'divider'\n ]);\n}","import type { Path } from '@iziui/toolkit/interface';\n\nimport { createMappedColors } from './createMappedColors';\n\nexport const colors = ['primary', 'secondary', 'error', 'warning', 'success', 'info'] as const;\nexport const mappedColors = createMappedColors(colors);\n\nexport type Mode = 'light' | 'dark'\n\nexport type MappedColors = Path<PaletteBuilded>;\nexport type Colors = typeof colors[number];\n\nexport type Size = 'small' | 'medium' | 'large';\n\nexport interface Color {\n main: string;\n dark: string;\n light: string;\n opacity: string;\n contrast: string;\n}\n\nexport interface Palette {\n info: string;\n error: string;\n warning: string;\n success: string;\n primary: string;\n secondary: string;\n grey: string;\n text: {\n primary: string;\n secondary: string;\n disabled: string;\n };\n background: {\n paper: string;\n default: string;\n };\n divider: string;\n}\n\nexport type Spacing = number;\nexport type Shape = { radius: number; }\nexport type Typography = { family: string; url?: string; }\n\nexport interface PaletteBuilded extends Pick<Palette, 'text' | 'background' | 'divider'> {\n grey: Color;\n info: Color;\n error: Color;\n warning: Color;\n success: Color;\n primary: Color;\n secondary: Color;\n}\n\nexport interface Theme {\n mode: Mode;\n shape: Shape;\n palette: Palette;\n spacing: Spacing;\n typography: Typography;\n}\n\nexport interface ThemeOptions extends Omit<Partial<Theme>, 'palette'> {\n palette?: Partial<Palette>;\n}\nexport interface ThemeBuilded extends Omit<Theme, 'palette'> {\n palette: PaletteBuilded;\n}\n","import type { ThemeBuilded, Color } from '../Theme';\n\nfunction setColor(name: string, color: Color) {\n document.documentElement.style.setProperty(`--${name}`, color.main);\n document.documentElement.style.setProperty(`--${name}-light`, color.light);\n document.documentElement.style.setProperty(`--${name}-dark`, color.dark);\n document.documentElement.style.setProperty(`--${name}-contrast`, color.contrast);\n document.documentElement.style.setProperty(`--${name}-opacity`, color.opacity);\n}\n\nfunction ensureStylesheet(href: string) {\n if (document.querySelector(`link[href=\"${href}\"]`)) return;\n const link = document.createElement('link');\n link.rel = 'stylesheet';\n link.href = href;\n document.head.appendChild(link);\n}\n\nexport function applyTheme(theme: ThemeBuilded) {\n if (typeof window === 'undefined') { return; }\n\n const { palette, shape, spacing, typography } = theme;\n\n if (typography.url) { ensureStylesheet(typography.url); }\n\n // COLORS\n setColor('info', palette.info);\n setColor('error', palette.error);\n setColor('warning', palette.warning);\n setColor('success', palette.success);\n setColor('primary', palette.primary);\n setColor('secondary', palette.secondary);\n\n // GREY\n setColor('grey', palette.grey);\n\n // TYPOGRAPHY\n document.documentElement.style.setProperty('--typography', typography.family);\n\n // TEXT\n document.documentElement.style.setProperty('--text-primary', palette.text?.primary);\n document.documentElement.style.setProperty('--text-secondary', palette.text?.secondary);\n document.documentElement.style.setProperty('--text-disabled', palette.text?.disabled);\n\n // BACKGROUND\n document.documentElement.style.setProperty('--background-paper', palette.background?.paper);\n document.documentElement.style.setProperty('--background-default', palette.background?.default);\n\n // DIVIDER\n document.documentElement.style.setProperty('--divider', palette.divider);\n\n // SHAPE\n document.documentElement.style.setProperty('--radius', `${shape.radius}px`);\n\n // SPACING\n document.documentElement.style.setProperty('--spacing', `${spacing}px`);\n}","import type { Theme } from './Theme';\n\nexport const defaultSpacing: Theme['spacing'] = 8;\nexport const defaultShape: Theme['shape'] = { radius: 8 };\n\nexport const themeDefaultLight: Theme = {\n mode: 'light',\n palette: {\n info: '#72E4FC',\n error: '#FF5377',\n warning: '#FF9457',\n success: '#36E79B',\n primary: '#6C37F4',\n secondary: '#FB7185', //C026D3 // F97316 // FB7185 // F59E0B\n grey: '#F4F4F4',\n text: {\n primary: 'rgb(31, 41, 55)',\n secondary: 'rgb(75, 85, 99)',\n disabled: 'rgb(172, 172, 172)'\n },\n background: {\n paper: '#F9F8F9',\n default: '#FFF',\n },\n divider: 'rgba(0, 0, 0, 0.12)'\n },\n spacing: defaultSpacing,\n shape: defaultShape,\n typography: {\n family: 'Poppins',\n // eslint-disable-next-line\n url: 'https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap'\n }\n};\n\nexport const themeDefaultDark: Theme = {\n mode: 'dark',\n palette: {\n info: '#72E4FC',\n error: '#FF5377',\n warning: '#FF9457',\n success: '#36E79B',\n primary: '#6C37F4',\n secondary: '#EBFF5E',\n grey: '#2A2A2A',\n text: {\n primary: 'rgba(255, 255, 255, 0.87)',\n secondary: 'rgba(255, 255, 255, 0.6)',\n disabled: 'rgba(255, 255, 255, 0.38)'\n },\n background: {\n paper: '#0D0225',\n default: '#30294E',\n },\n divider: 'rgba(255, 255, 255, 0.12)'\n },\n spacing: defaultSpacing,\n shape: defaultShape,\n typography: {\n family: 'Poppins',\n // eslint-disable-next-line\n url: 'https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap'\n }\n};","import { generateSupportColors } from '../../utils';\nimport type { ThemeBuilded, ThemeOptions } from '../Theme';\nimport { themeDefaultDark, themeDefaultLight } from '../defaultTheme';\n\nconst SUPPORT_KEYS = [\n 'primary',\n 'secondary',\n 'error',\n 'warning',\n 'success',\n 'info',\n 'grey',\n] as const;\n\ntype SupportKey = (typeof SUPPORT_KEYS)[number];\n\nexport function createTheme(theme?: ThemeOptions): ThemeBuilded {\n const mode = theme?.mode ?? 'light';\n const ref = mode === 'dark' ? themeDefaultDark : themeDefaultLight;\n\n const paletteFromUser = theme?.palette ?? {};\n const paletteFromRef = ref.palette;\n\n const supportColors = Object.fromEntries(\n SUPPORT_KEYS.map((key) => [\n key,\n generateSupportColors(paletteFromUser[key] ?? paletteFromRef[key]),\n ])\n ) as Record<SupportKey, ThemeBuilded['palette'][SupportKey]>;\n\n return {\n mode,\n palette: {\n text: paletteFromUser.text ?? paletteFromRef.text,\n background: paletteFromUser.background ?? paletteFromRef.background,\n divider: paletteFromUser.divider ?? paletteFromRef.divider,\n ...supportColors,\n },\n shape: theme?.shape ?? ref.shape,\n spacing: theme?.spacing ?? ref.spacing,\n typography: theme?.typography ?? ref.typography,\n };\n}","import { createContext, useEffect, useMemo, useState, type PropsWithChildren } from 'react';\n\nimport type { ThemeBuilded } from '@iziui/core/theme';\nimport { createTheme, applyTheme, themeDefaultLight } from '@iziui/core/theme';\n\nimport '@iziui/styles/base/_base.scss';\n\nexport interface ThemeContextConfig {\n theme: ThemeBuilded;\n updateTheme: (theme: ThemeBuilded) => void;\n}\n\nexport const ThemeContext = createContext<ThemeContextConfig>({\n theme: createTheme(themeDefaultLight),\n updateTheme: () => { },\n});\n\ntype ThemeProviderProps = PropsWithChildren<{ theme: ThemeBuilded; }>\nexport default function ThemeProvider({ theme, children }: ThemeProviderProps) {\n const [_theme, setTheme] = useState<ThemeBuilded>(theme);\n\n const context = useMemo<ThemeContextConfig>(() => ({\n theme: _theme,\n updateTheme: (newTheme: ThemeBuilded) => updateTheme(newTheme),\n }), [theme, _theme]);\n\n useEffect(() => { applyTheme(_theme); }, [_theme]);\n\n const updateTheme = (newTheme: ThemeBuilded) => { setTheme(newTheme); };\n\n return (\n <ThemeContext.Provider value={context}>\n {children}\n </ThemeContext.Provider>\n );\n}\n\n","import { useContext } from 'react';\n\nimport { ThemeContext } from './ThemeProvider';\n\nexport default function useTheme() {\n return useContext(ThemeContext);\n}"],"names":["hslToHex","h","s","l","c","x","m","r","g","b","newR","newG","newB","adjustLightness","amount","hexToHsl","hex","max","min","d","getOpacityColor","hexColor","opacity","alphaHex","getContrastColor","generateSupportColors","hsl","contrastColor","lighterColor","darkerColor","opacityColor","generateMappedColor","color","createMappedColors","_colors","acc","mapped","colors","setColor","name","ensureStylesheet","href","link","applyTheme","theme","palette","shape","spacing","typography","defaultSpacing","defaultShape","themeDefaultLight","themeDefaultDark","SUPPORT_KEYS","createTheme","mode","ref","paletteFromUser","paletteFromRef","supportColors","key","ThemeContext","createContext","ThemeProvider","children","_theme","setTheme","useState","context","useMemo","newTheme","updateTheme","useEffect","useTheme","useContext"],"mappings":"wIAAO,SAASA,EAASC,EAAWC,EAAWC,EAAW,CACxDD,GAAK,IACLC,GAAK,IAEL,MAAMC,GAAK,EAAI,KAAK,IAAI,EAAID,EAAI,CAAC,GAAKD,EAChCG,EAAID,GAAK,EAAI,KAAK,IAAKH,EAAI,GAAM,EAAI,CAAC,GACtCK,EAAIH,EAAIC,EAAI,EAClB,IAAIG,EAAI,EAAGC,EAAI,EAAGC,EAAI,EAElB,GAAKR,GAAKA,EAAI,IAAMM,EAAIH,EAAGI,EAAIH,EAAGI,EAAI,GACjC,IAAMR,GAAKA,EAAI,KAAOM,EAAIF,EAAGG,EAAIJ,EAAGK,EAAI,GACxC,KAAOR,GAAKA,EAAI,KAAOM,EAAI,E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AYD,CAAQ,CAAA,GAC3D,CAAC1B,EAAOqB,CAAM,CAAC,EAEnBO,EAAU,IAAM,CAAE7B,EAAWsB,CAAM,CAAG,EAAG,CAACA,CAAM,CAAC,EAEjD,MAAMM,EAAeD,GAA2B,CAAEJ,EAASI,CAAQ,CAAG,EAEtE,SACGT,EAAa,SAAb,CAAsB,MAAOO,EAC3B,SAAAJ,EACH,CAEJ,CC/BA,SAAwBS,GAAW,CACjC,OAAOC,EAAWb,CAAY,CAChC"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../chunks/Alert-BZtq_ZmI.cjs");require("react/jsx-runtime");require("react");require("../../chunks/index-DYxwT4uW.cjs");require("../../chunks/joinClass-Jk3EszKD.cjs");require("../../chunks/Stack-CTcHQ_9x.cjs");require("../../chunks/createComponent-Ds819n7r.cjs");require("../../chunks/useTheme-BZ0xkY68.cjs");require("../../chunks/Typography-DMnJRugi.cjs");require("../../chunks/convertPathToColor-BlQMLS4V.cjs");require("../../chunks/ButtonIcon-BdTxTa54.cjs");require("../../chunks/Ripple-Dy4i91j1.cjs");require("../../chunks/Icon-7g25Bfa3.cjs");exports.default=e.Alert;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../chunks/Alert-D81ZTqW0.cjs");require("react/jsx-runtime");require("react");require("../../chunks/index-DYxwT4uW.cjs");require("../../chunks/joinClass-Jk3EszKD.cjs");require("../../chunks/Stack-tYlHcxX7.cjs");require("../../chunks/createComponent-C-z8CItQ.cjs");require("../../chunks/useTheme-C83CaSLO.cjs");require("../../chunks/Typography-55nrlAH3.cjs");require("../../chunks/convertPathToColor-BlQMLS4V.cjs");require("../../chunks/ButtonIcon-zVEr-CLA.cjs");require("../../chunks/Ripple-Dy4i91j1.cjs");require("../../chunks/Icon-DIpi3iH3.cjs");exports.default=e.Alert;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,2 +1,2 @@
1
- import{A}from"../../chunks/Alert-Dydy5gdK.js";import"react/jsx-runtime";import"react";import"../../chunks/index-CZ41y9Hn.js";import"../../chunks/joinClass-anSpaauN.js";import"../../chunks/Stack-D2Y2T_wh.js";import"../../chunks/createComponent-DhHk-x5v.js";import"../../chunks/useTheme-BhIs8Txu.js";import"../../chunks/Typography-BcgZRln8.js";import"../../chunks/convertPathToColor-D2SdAqGh.js";import"../../chunks/ButtonIcon-CwmXuxvw.js";import"../../chunks/Ripple-Bq9bxg4k.js";import"../../chunks/Icon-D-uCpp04.js";export{A as default};
1
+ import{A}from"../../chunks/Alert-B7KYsvPS.js";import"react/jsx-runtime";import"react";import"../../chunks/index-CZ41y9Hn.js";import"../../chunks/joinClass-anSpaauN.js";import"../../chunks/Stack-DCtLO2p3.js";import"../../chunks/createComponent-D8CZM3yo.js";import"../../chunks/useTheme-DNLVLxKW.js";import"../../chunks/Typography-on8-n-Tv.js";import"../../chunks/convertPathToColor-D2SdAqGh.js";import"../../chunks/ButtonIcon-Hx1VrCD_.js";import"../../chunks/Ripple-Bq9bxg4k.js";import"../../chunks/Icon-DxvM9zZ-.js";export{A as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),t=require("../../chunks/index-DYxwT4uW.cjs"),f=require("../../chunks/joinClass-Jk3EszKD.cjs"),d=require("../../chunks/Ripple-Dy4i91j1.cjs"),g=require("../../chunks/createComponent-Ds819n7r.cjs"),v=require("../../chunks/Icon-7g25Bfa3.cjs"),x=require("../../chunks/Typography-DMnJRugi.cjs");require("react");require("../../chunks/useTheme-BZ0xkY68.cjs");require("../../chunks/convertPathToColor-BlQMLS4V.cjs");function s(e){return e.normalize("NFD").trim().toLowerCase().replace(/a-zA-Z0-9_.-+/g,"").replace(/_/g,"").replace(/[^\w\s]/gi,"")}function m(e){const a=e.trim().split(" "),i=a.length===1,r=s(a[0]).charAt(0).toLocaleUpperCase(),c=i?s(a[0]).charAt(1).toLocaleUpperCase():s(a.reverse()[0]).charAt(0).toLocaleUpperCase();return r+c}function y({src:e,alt:a,name:i,size:r=40,variant:c="circular",color:u="primary",icon:l,...n}){const h=f.joinClass(`${t.prefix}-avatar`,`${t.prefix}-avatar--${c}`,`${t.prefix}-avatar--${u}`,e&&`${t.prefix}-avatar--image`,i&&`${t.prefix}-avatar--name`,!e&&!i||l&&`${t.prefix}-avatar--icon`,n.onClick&&`${t.prefix}-avatar--clickable`,n.className),p=()=>e?o.jsx("img",{src:e,alt:a,width:r,height:r,sizes:"100vw",loading:"lazy",style:{width:"100%",height:"auto"}}):i?o.jsx(x.Typography,{style:{fontSize:r/2,color:"currentColor"},children:m(i)}):l||o.jsx(v.Icon,{name:"user",size:r/1.6,style:{color:"currentColor"}});return o.jsxs("div",{...n,style:{width:r,height:r,...n.style},className:h,children:[p(),n.children,n.onClick&&o.jsx(d.Ripple,{})]})}const C=g.createComponent(y);exports.default=C;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),t=require("../../chunks/index-DYxwT4uW.cjs"),f=require("../../chunks/joinClass-Jk3EszKD.cjs"),d=require("../../chunks/Ripple-Dy4i91j1.cjs"),g=require("../../chunks/createComponent-C-z8CItQ.cjs"),v=require("../../chunks/Icon-DIpi3iH3.cjs"),x=require("../../chunks/Typography-55nrlAH3.cjs");require("react");require("../../chunks/useTheme-C83CaSLO.cjs");require("../../chunks/convertPathToColor-BlQMLS4V.cjs");function s(e){return e.normalize("NFD").trim().toLowerCase().replace(/a-zA-Z0-9_.-+/g,"").replace(/_/g,"").replace(/[^\w\s]/gi,"")}function m(e){const a=e.trim().split(" "),i=a.length===1,r=s(a[0]).charAt(0).toLocaleUpperCase(),c=i?s(a[0]).charAt(1).toLocaleUpperCase():s(a.reverse()[0]).charAt(0).toLocaleUpperCase();return r+c}function y({src:e,alt:a,name:i,size:r=40,variant:c="circular",color:u="primary",icon:l,...n}){const h=f.joinClass(`${t.prefix}-avatar`,`${t.prefix}-avatar--${c}`,`${t.prefix}-avatar--${u}`,e&&`${t.prefix}-avatar--image`,i&&`${t.prefix}-avatar--name`,!e&&!i||l&&`${t.prefix}-avatar--icon`,n.onClick&&`${t.prefix}-avatar--clickable`,n.className),p=()=>e?o.jsx("img",{src:e,alt:a,width:r,height:r,sizes:"100vw",loading:"lazy",style:{width:"100%",height:"auto"}}):i?o.jsx(x.Typography,{style:{fontSize:r/2,color:"currentColor"},children:m(i)}):l||o.jsx(v.Icon,{name:"user",size:r/1.6,style:{color:"currentColor"}});return o.jsxs("div",{...n,style:{width:r,height:r,...n.style},className:h,children:[p(),n.children,n.onClick&&o.jsx(d.Ripple,{})]})}const C=g.createComponent(y);exports.default=C;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,2 +1,2 @@
1
- import{jsxs as h,jsx as n}from"react/jsx-runtime";import{p as r}from"../../chunks/index-CZ41y9Hn.js";import{j as u}from"../../chunks/joinClass-anSpaauN.js";import{R as g}from"../../chunks/Ripple-Bq9bxg4k.js";import{c as v}from"../../chunks/createComponent-DhHk-x5v.js";import{I as d}from"../../chunks/Icon-D-uCpp04.js";import{T as C}from"../../chunks/Typography-BcgZRln8.js";import"react";import"../../chunks/useTheme-BhIs8Txu.js";import"../../chunks/convertPathToColor-D2SdAqGh.js";function s(t){return t.normalize("NFD").trim().toLowerCase().replace(/a-zA-Z0-9_.-+/g,"").replace(/_/g,"").replace(/[^\w\s]/gi,"")}function y(t){const e=t.trim().split(" "),o=e.length===1,a=s(e[0]).charAt(0).toLocaleUpperCase(),l=o?s(e[0]).charAt(1).toLocaleUpperCase():s(e.reverse()[0]).charAt(0).toLocaleUpperCase();return a+l}function $({src:t,alt:e,name:o,size:a=40,variant:l="circular",color:m="primary",icon:c,...i}){const p=u(`${r}-avatar`,`${r}-avatar--${l}`,`${r}-avatar--${m}`,t&&`${r}-avatar--image`,o&&`${r}-avatar--name`,!t&&!o||c&&`${r}-avatar--icon`,i.onClick&&`${r}-avatar--clickable`,i.className),f=()=>t?n("img",{src:t,alt:e,width:a,height:a,sizes:"100vw",loading:"lazy",style:{width:"100%",height:"auto"}}):o?n(C,{style:{fontSize:a/2,color:"currentColor"},children:y(o)}):c||n(d,{name:"user",size:a/1.6,style:{color:"currentColor"}});return h("div",{...i,style:{width:a,height:a,...i.style},className:p,children:[f(),i.children,i.onClick&&n(g,{})]})}const z=v($);export{z as default};
1
+ import{jsxs as h,jsx as n}from"react/jsx-runtime";import{p as r}from"../../chunks/index-CZ41y9Hn.js";import{j as u}from"../../chunks/joinClass-anSpaauN.js";import{R as g}from"../../chunks/Ripple-Bq9bxg4k.js";import{c as v}from"../../chunks/createComponent-D8CZM3yo.js";import{I as d}from"../../chunks/Icon-DxvM9zZ-.js";import{T as C}from"../../chunks/Typography-on8-n-Tv.js";import"react";import"../../chunks/useTheme-DNLVLxKW.js";import"../../chunks/convertPathToColor-D2SdAqGh.js";function s(t){return t.normalize("NFD").trim().toLowerCase().replace(/a-zA-Z0-9_.-+/g,"").replace(/_/g,"").replace(/[^\w\s]/gi,"")}function y(t){const e=t.trim().split(" "),o=e.length===1,a=s(e[0]).charAt(0).toLocaleUpperCase(),l=o?s(e[0]).charAt(1).toLocaleUpperCase():s(e.reverse()[0]).charAt(0).toLocaleUpperCase();return a+l}function $({src:t,alt:e,name:o,size:a=40,variant:l="circular",color:m="primary",icon:c,...i}){const p=u(`${r}-avatar`,`${r}-avatar--${l}`,`${r}-avatar--${m}`,t&&`${r}-avatar--image`,o&&`${r}-avatar--name`,!t&&!o||c&&`${r}-avatar--icon`,i.onClick&&`${r}-avatar--clickable`,i.className),f=()=>t?n("img",{src:t,alt:e,width:a,height:a,sizes:"100vw",loading:"lazy",style:{width:"100%",height:"auto"}}):o?n(C,{style:{fontSize:a/2,color:"currentColor"},children:y(o)}):c||n(d,{name:"user",size:a/1.6,style:{color:"currentColor"}});return h("div",{...i,style:{width:a,height:a,...i.style},className:p,children:[f(),i.children,i.onClick&&n(g,{})]})}const z=v($);export{z as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../chunks/Box-B3hTyhaq.cjs");require("react/jsx-runtime");require("react");require("../../chunks/createComponent-Ds819n7r.cjs");require("../../chunks/index-DYxwT4uW.cjs");require("../../chunks/useTheme-BZ0xkY68.cjs");exports.default=e.Box;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../chunks/Box-phfkLmqG.cjs");require("react/jsx-runtime");require("react");require("../../chunks/createComponent-C-z8CItQ.cjs");require("../../chunks/index-DYxwT4uW.cjs");require("../../chunks/useTheme-C83CaSLO.cjs");exports.default=e.Box;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,2 +1,2 @@
1
- import{B as e}from"../../chunks/Box-DRV8oI-_.js";import"react/jsx-runtime";import"react";import"../../chunks/createComponent-DhHk-x5v.js";import"../../chunks/index-CZ41y9Hn.js";import"../../chunks/useTheme-BhIs8Txu.js";export{e as default};
1
+ import{B as e}from"../../chunks/Box-CVJ6oQ5Z.js";import"react/jsx-runtime";import"react";import"../../chunks/createComponent-D8CZM3yo.js";import"../../chunks/index-CZ41y9Hn.js";import"../../chunks/useTheme-DNLVLxKW.js";export{e as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),m=require("react"),e=require("../../chunks/index-DYxwT4uW.cjs"),i=require("../../chunks/joinClass-Jk3EszKD.cjs"),d=require("../../chunks/Ripple-Dy4i91j1.cjs"),_=require("../../chunks/createComponent-Ds819n7r.cjs");require("../../chunks/useTheme-BZ0xkY68.cjs");function j({size:u="medium",color:o="primary",variant:p="contained",startIcon:c,endIcon:l,loading:s,children:$,...n}){const f=i.joinClass(`${e.prefix}-button`,`${e.prefix}-button--${u}`,`${e.prefix}-button--${o}`,`${e.prefix}-button--${o}--${p}`,n.className),a=(t,b)=>m.cloneElement(t,{color:`${o}.contrast`,className:i.joinClass(t.props.className,`${e.prefix}-button__icon`,`${e.prefix}-button__icon--${b}`)}),x=t=>m.cloneElement(t,{className:i.joinClass(t.props.className,`${e.prefix}-button__loading`,`${e.prefix}-button__loading--${u}`),size:"1.1rem"});return console.log(">>> props",n),r.jsxs("button",{...n,className:f,onClick:t=>!s&&n.onClick?.(t),children:[s?x(s):r.jsxs(r.Fragment,{children:[c&&a(c,"left"),$,l&&a(l,"right")]}),r.jsx(d.Ripple,{})]})}const C=_.createComponent(j);exports.default=C;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),m=require("react"),e=require("../../chunks/index-DYxwT4uW.cjs"),i=require("../../chunks/joinClass-Jk3EszKD.cjs"),d=require("../../chunks/Ripple-Dy4i91j1.cjs"),_=require("../../chunks/createComponent-C-z8CItQ.cjs");require("../../chunks/useTheme-C83CaSLO.cjs");function j({size:u="medium",color:o="primary",variant:p="contained",startIcon:c,endIcon:l,loading:s,children:$,...n}){const f=i.joinClass(`${e.prefix}-button`,`${e.prefix}-button--${u}`,`${e.prefix}-button--${o}`,`${e.prefix}-button--${o}--${p}`,n.className),a=(t,b)=>m.cloneElement(t,{color:`${o}.contrast`,className:i.joinClass(t.props.className,`${e.prefix}-button__icon`,`${e.prefix}-button__icon--${b}`)}),x=t=>m.cloneElement(t,{className:i.joinClass(t.props.className,`${e.prefix}-button__loading`,`${e.prefix}-button__loading--${u}`),size:"1.1rem"});return console.log(">>> props",n),r.jsxs("button",{...n,className:f,onClick:t=>!s&&n.onClick?.(t),children:[s?x(s):r.jsxs(r.Fragment,{children:[c&&a(c,"left"),$,l&&a(l,"right")]}),r.jsx(d.Ripple,{})]})}const C=_.createComponent(j);exports.default=C;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,2 +1,2 @@
1
- import{jsxs as l,Fragment as d,jsx as N}from"react/jsx-runtime";import{cloneElement as u}from"react";import{p as t}from"../../chunks/index-CZ41y9Hn.js";import{j as s}from"../../chunks/joinClass-anSpaauN.js";import{R as j}from"../../chunks/Ripple-Bq9bxg4k.js";import{c as x}from"../../chunks/createComponent-DhHk-x5v.js";import"../../chunks/useTheme-BhIs8Txu.js";function C({size:m="medium",color:r="primary",variant:$="contained",startIcon:a,endIcon:c,loading:e,children:p,...n}){const f=s(`${t}-button`,`${t}-button--${m}`,`${t}-button--${r}`,`${t}-button--${r}--${$}`,n.className),i=(o,_)=>u(o,{color:`${r}.contrast`,className:s(o.props.className,`${t}-button__icon`,`${t}-button__icon--${_}`)}),b=o=>u(o,{className:s(o.props.className,`${t}-button__loading`,`${t}-button__loading--${m}`),size:"1.1rem"});return console.log(">>> props",n),l("button",{...n,className:f,onClick:o=>!e&&n.onClick?.(o),children:[e?b(e):l(d,{children:[a&&i(a,"left"),p,c&&i(c,"right")]}),N(j,{})]})}const F=x(C);export{F as default};
1
+ import{jsxs as l,Fragment as d,jsx as N}from"react/jsx-runtime";import{cloneElement as u}from"react";import{p as t}from"../../chunks/index-CZ41y9Hn.js";import{j as s}from"../../chunks/joinClass-anSpaauN.js";import{R as j}from"../../chunks/Ripple-Bq9bxg4k.js";import{c as x}from"../../chunks/createComponent-D8CZM3yo.js";import"../../chunks/useTheme-DNLVLxKW.js";function C({size:m="medium",color:r="primary",variant:$="contained",startIcon:a,endIcon:c,loading:e,children:p,...n}){const f=s(`${t}-button`,`${t}-button--${m}`,`${t}-button--${r}`,`${t}-button--${r}--${$}`,n.className),i=(o,_)=>u(o,{color:`${r}.contrast`,className:s(o.props.className,`${t}-button__icon`,`${t}-button__icon--${_}`)}),b=o=>u(o,{className:s(o.props.className,`${t}-button__loading`,`${t}-button__loading--${m}`),size:"1.1rem"});return console.log(">>> props",n),l("button",{...n,className:f,onClick:o=>!e&&n.onClick?.(o),children:[e?b(e):l(d,{children:[a&&i(a,"left"),p,c&&i(c,"right")]}),N(j,{})]})}const F=x(C);export{F as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../chunks/ButtonIcon-BdTxTa54.cjs");require("react/jsx-runtime");require("react");require("../../chunks/index-DYxwT4uW.cjs");require("../../chunks/joinClass-Jk3EszKD.cjs");require("../../chunks/convertPathToColor-BlQMLS4V.cjs");require("../../chunks/useTheme-BZ0xkY68.cjs");require("../../chunks/Ripple-Dy4i91j1.cjs");require("../../chunks/createComponent-Ds819n7r.cjs");exports.default=e.ButtonIcon;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../chunks/ButtonIcon-zVEr-CLA.cjs");require("react/jsx-runtime");require("react");require("../../chunks/index-DYxwT4uW.cjs");require("../../chunks/joinClass-Jk3EszKD.cjs");require("../../chunks/convertPathToColor-BlQMLS4V.cjs");require("../../chunks/useTheme-C83CaSLO.cjs");require("../../chunks/Ripple-Dy4i91j1.cjs");require("../../chunks/createComponent-C-z8CItQ.cjs");exports.default=e.ButtonIcon;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,2 +1,2 @@
1
- import{B as l}from"../../chunks/ButtonIcon-CwmXuxvw.js";import"react/jsx-runtime";import"react";import"../../chunks/index-CZ41y9Hn.js";import"../../chunks/joinClass-anSpaauN.js";import"../../chunks/convertPathToColor-D2SdAqGh.js";import"../../chunks/useTheme-BhIs8Txu.js";import"../../chunks/Ripple-Bq9bxg4k.js";import"../../chunks/createComponent-DhHk-x5v.js";export{l as default};
1
+ import{B as l}from"../../chunks/ButtonIcon-Hx1VrCD_.js";import"react/jsx-runtime";import"react";import"../../chunks/index-CZ41y9Hn.js";import"../../chunks/joinClass-anSpaauN.js";import"../../chunks/convertPathToColor-D2SdAqGh.js";import"../../chunks/useTheme-DNLVLxKW.js";import"../../chunks/Ripple-Bq9bxg4k.js";import"../../chunks/createComponent-D8CZM3yo.js";export{l as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/Card-BNdbHjy2.cjs"),r=require("../../chunks/CardContent-BNxQiVc2.cjs");require("react/jsx-runtime");require("../../chunks/index-DYxwT4uW.cjs");require("../../chunks/joinClass-Jk3EszKD.cjs");require("../../chunks/Ripple-Dy4i91j1.cjs");require("react");require("../../chunks/createComponent-Ds819n7r.cjs");require("../../chunks/useTheme-BZ0xkY68.cjs");exports.Card=e.Card;exports.CardContent=r.CardContent;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/Card-DCz0DVsL.cjs"),r=require("../../chunks/CardContent-CIsEbHXy.cjs");require("react/jsx-runtime");require("../../chunks/index-DYxwT4uW.cjs");require("../../chunks/joinClass-Jk3EszKD.cjs");require("../../chunks/Ripple-Dy4i91j1.cjs");require("react");require("../../chunks/createComponent-C-z8CItQ.cjs");require("../../chunks/useTheme-C83CaSLO.cjs");exports.Card=e.Card;exports.CardContent=r.CardContent;
2
2
  //# sourceMappingURL=index.cjs.map