@iziui/react 0.0.95-rc → 0.0.96-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.
- package/dist/.types/navigation/Menu/Menu.d.ts.map +1 -1
- package/dist/chunks/{Option-DhebqRz5.cjs → Option-B1l_zN4-.cjs} +2 -2
- package/dist/chunks/{Option-DhebqRz5.cjs.map → Option-B1l_zN4-.cjs.map} +1 -1
- package/dist/chunks/{Option-CO-o7wVb.js → Option-BvxuW39r.js} +2 -2
- package/dist/chunks/{Option-CO-o7wVb.js.map → Option-BvxuW39r.js.map} +1 -1
- package/dist/chunks/useMenu-CizlB9PU.js +2 -0
- package/dist/chunks/useMenu-CizlB9PU.js.map +1 -0
- package/dist/chunks/useMenu-D9-CcpCS.cjs +2 -0
- package/dist/chunks/useMenu-D9-CcpCS.cjs.map +1 -0
- package/dist/components/ColorPicker/index.cjs +1 -1
- package/dist/components/ColorPicker/index.js +1 -1
- package/dist/components/Menu/index.cjs +1 -1
- package/dist/components/Menu/index.js +1 -1
- package/dist/components/Select/index.cjs +1 -1
- package/dist/components/Select/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/style.css +2 -2
- package/package.json +1 -1
- package/dist/chunks/useMenu-CvPJe62S.cjs +0 -2
- package/dist/chunks/useMenu-CvPJe62S.cjs.map +0 -1
- package/dist/chunks/useMenu-we523Eob.js +0 -2
- package/dist/chunks/useMenu-we523Eob.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../../src/navigation/Menu/Menu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,aAAa,EAClB,KAAK,cAAc,EAEpB,MAAM,OAAO,CAAC;AAcf,OAAO,oCAAoC,CAAC;AAE5C,KAAK,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAM7C,MAAM,WAAW,SAAU,SAAQ,c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AK,IAAI,CAAC;CAC5D;;AAoID,wBAAqC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const t=require("react/jsx-runtime"),u=require("react"),e=require("./index-DYxwT4uW.cjs"),n=require("./joinClass-Jk3EszKD.cjs"),k=require("./Icon-BN4Kp4Aq.cjs"),d=require("./useMenu-
|
|
2
|
-
//# sourceMappingURL=Option-
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),u=require("react"),e=require("./index-DYxwT4uW.cjs"),n=require("./joinClass-Jk3EszKD.cjs"),k=require("./Icon-BN4Kp4Aq.cjs"),d=require("./useMenu-D9-CcpCS.cjs"),E=require("./createComponent-Bls5N6x8.cjs");function M({error:o,color:c="grey",label:i,helperText:x,startIcon:a,children:m,disabled:l,onChange:p,...r}){const _=u.Children.toArray(m),j=u.useMemo(()=>_.find(s=>s.props.value===r.value)?.props.children||"",[r.value]),[$,N,C]=d.useMenu(),h=n.joinClass(`${e.prefix}-select-container`),b=n.joinClass(`${e.prefix}-select-label`,o&&`${e.prefix}-select-label--error`),y=n.joinClass(`${e.prefix}-select`,l&&`${e.prefix}-select--disabled`,o&&`${e.prefix}-select--error`,r.className),v=n.joinClass(`${e.prefix}-select__helper-text`,x&&`${e.prefix}-select__helper-text--visible`,o&&`${e.prefix}-select__helper-text--error`),q=s=>u.cloneElement(s,{className:n.joinClass(s.props.className,`${e.prefix}-select__icon--left`),type:"button",style:{color:c},onClick:f=>{f.stopPropagation(),s.props.onClick&&!l&&s.props.onClick(f)}}),g=()=>_.map(s=>u.cloneElement(s,{color:c,className:n.joinClass(s.props.className,s.props.value===r.value&&`${e.prefix}-select__option--selected`),onClick:f=>{!s.props.disabled&&p&&p(f)}}));return t.jsxs("div",{className:h,children:[i&&t.jsxs("label",{className:b,children:[i," ",r.required&&"*"]}),t.jsxs("button",{type:"button",className:y,onClick:C,disabled:l,children:[t.jsx("div",{children:a&&q(a)}),t.jsx("input",{...r,readOnly:!0,type:"text",value:j,disabled:l}),t.jsx(k.Icon,{name:"angle-down",sx:{color:({grey:s})=>s.main},className:`${e.prefix}-select__icon--right`})]}),t.jsx(d.Menu,{autoClose:!0,direction:"center",open:$,anchorEl:N,onClose:C,children:g()}),t.jsx("span",{className:v,children:x})]})}const O=E.createComponent(M);function S({children:o,color:c,startIcon:i,disabled:x,...a}){const m=n.joinClass(`${e.prefix}-select__option`,x&&`${e.prefix}-select__option--disabled`,c&&`${e.prefix}-select__option--${c}`,a.className),l=p=>u.cloneElement(p,{type:"button",className:n.joinClass(p.props.className,`${e.prefix}-select__option__icon`)});return t.jsxs("button",{type:"button",...a,className:m,children:[i&&l(i),o]})}exports.Option=S;exports.Select_default=O;
|
|
2
|
+
//# sourceMappingURL=Option-B1l_zN4-.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Option-
|
|
1
|
+
{"version":3,"file":"Option-B1l_zN4-.cjs","sources":["../../src/fields/Select/Select.tsx","../../src/fields/Select/Option.tsx"],"sourcesContent":["import {\n useMemo,\n Children,\n cloneElement,\n type ReactElement,\n type InputHTMLAttributes,\n type ButtonHTMLAttributes,\n} from 'react';\n\nimport { prefix } from '@iziui/tokens/web/js';\n\nimport type { Colors } from '@iziui/core/theme';\nimport { joinClass } from '@iziui/core/utils/joinClass';\n\nimport Icon from '@/display/Icon';\nimport { Menu, useMenu } from '@/navigation/Menu';\n\nimport type { OptionProps } from './Option';\nimport createComponent from '../../core/createComponent';\n\nimport '@iziui/styles/components/Select.scss';\n\nexport interface SelectProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'color'> {\n error?: boolean;\n autoClose?: boolean;\n label?: string;\n helperText?: string;\n color?: Colors;\n startIcon?: React.JSX.Element | boolean;\n children: React.JSX.Element | React.JSX.Element[];\n}\n\nfunction Select({\n error,\n color = 'grey',\n label,\n helperText,\n startIcon,\n children,\n disabled,\n onChange,\n ...props\n}: SelectProps) {\n const arrayChildren = Children.toArray(children) as ReactElement<OptionProps>[];\n\n const newValue = useMemo(() => {\n return arrayChildren.find((child) =>\n child.props.value === props.value)?.props.children || '';\n }, [props.value]);\n\n const [open, el, toggle] = useMenu();\n\n const containerClss = joinClass(\n `${prefix}-select-container`\n );\n\n const labelClss = joinClass(\n `${prefix}-select-label`,\n error && `${prefix}-select-label--error`,\n );\n\n const clss = joinClass(\n `${prefix}-select`,\n disabled && `${prefix}-select--disabled`,\n error && `${prefix}-select--error`,\n props.className\n );\n\n const helperTextClss = joinClass(\n `${prefix}-select__helper-text`,\n helperText && `${prefix}-select__helper-text--visible`,\n error && `${prefix}-select__helper-text--error`\n );\n\n const renderIcon = (icon: ReactElement<ButtonHTMLAttributes<any>>) => {\n return cloneElement(icon, {\n className: joinClass(\n icon.props.className,\n `${prefix}-select__icon--left`\n ),\n type: 'button',\n style: { color },\n onClick: (e) => {\n e.stopPropagation();\n if (icon.props.onClick && !disabled) { icon.props.onClick(e); };\n }\n });\n };\n\n const renderOption = () => {\n return arrayChildren.map((child) => {\n return cloneElement(child, {\n color,\n className: joinClass(\n child.props.className,\n child.props.value === props.value && `${prefix}-select__option--selected`,\n ),\n onClick: (e) => {\n if (!child.props.disabled && onChange) { onChange(e as any); }\n }\n });\n });\n };\n\n return (\n <div className={containerClss}>\n {label && <label className={labelClss}>{label} {props.required && '*'}</label>}\n <button type=\"button\" className={clss} onClick={toggle} disabled={disabled}>\n <div>\n {startIcon && renderIcon(startIcon as React.JSX.Element)}\n </div>\n <input {...props} readOnly type=\"text\" value={newValue} disabled={disabled} />\n <Icon\n name=\"angle-down\"\n sx={{ color: ({ grey }) => grey.main }}\n className={`${prefix}-select__icon--right`}\n />\n </button>\n <Menu\n autoClose\n direction=\"center\"\n open={open}\n anchorEl={el}\n onClose={toggle}\n >\n {renderOption()}\n </Menu>\n <span className={helperTextClss}>{helperText}</span>\n </div>\n );\n}\n\nexport default createComponent(Select);\n","import { ButtonHTMLAttributes, cloneElement, ReactElement } from 'react';\n\nimport { prefix } from '@iziui/tokens/web/js';\n\nimport { joinClass } from '@iziui/core/utils';\nimport type { Colors } from '@iziui/core/theme';\n\nexport interface OptionProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n value: any;\n children: string;\n color?: Colors;\n startIcon?: React.JSX.Element | boolean;\n}\nexport default function Option({ children, color, startIcon, disabled, ...props }: OptionProps) {\n const className = joinClass(\n `${prefix}-select__option`,\n disabled && `${prefix}-select__option--disabled`,\n color && `${prefix}-select__option--${color}`,\n props.className\n );\n\n const renderIcon = (icon: ReactElement<ButtonHTMLAttributes<any>>) => {\n return cloneElement(icon, {\n type: 'button',\n className: joinClass(\n icon.props.className,\n `${prefix}-select__option__icon`,\n ),\n });\n };\n\n return (\n <button type=\"button\" {...props} className={className}>\n {startIcon && renderIcon(startIcon as React.JSX.Element)}\n {children}\n </button>\n );\n};"],"names":["Select","error","color","label","helperText","startIcon","children","disabled","onChange","props","arrayChildren","Children","newValue","useMemo","child","open","el","toggle","useMenu","containerClss","joinClass","prefix","labelClss","clss","helperTextClss","renderIcon","icon","cloneElement","e","renderOption","jsxs","jsx","Icon","grey","Menu","Select_default","createComponent","Option","className"],"mappings":"8PAgCA,SAASA,EAAO,CACd,MAAAC,EACA,MAAAC,EAAQ,OACR,MAAAC,EACA,WAAAC,EACA,UAAAC,EACA,SAAAC,EACA,SAAAC,EACA,SAAAC,EACA,GAAGC,CACL,EAAgB,CACd,MAAMC,EAAgBC,EAAAA,SAAS,QAAQL,CAAQ,EAEzCM,EAAWC,EAAAA,QAAQ,IAChBH,EAAc,KAAMI,GACzBA,EAAM,MAAM,QAAUL,EAAM,KAAK,GAAG,MAAM,UAAY,GACvD,CAACA,EAAM,KAAK,CAAC,EAEV,CAACM,EAAMC,EAAIC,CAAM,EAAIC,EAAAA,QAAA,EAErBC,EAAgBC,EAAAA,UACpB,GAAGC,EAAAA,MAAM,mBAAA,EAGLC,EAAYF,EAAAA,UAChB,GAAGC,EAAAA,MAAM,gBACTpB,GAAS,GAAGoB,EAAAA,MAAM,sBAAA,EAGdE,EAA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,EAC5EwB,EAAAA,IAACC,EAAAA,KAAA,CACC,KAAK,aACL,GAAI,CAAE,MAAO,CAAC,CAAE,KAAAC,CAAA,IAAWA,EAAK,IAAA,EAChC,UAAW,GAAGZ,EAAAA,MAAM,sBAAA,CAAA,CACtB,EACF,EACAU,EAAAA,IAACG,EAAAA,KAAA,CACC,UAAS,GACT,UAAU,SACV,KAAAnB,EACA,SAAUC,EACV,QAASC,EAER,SAAAY,EAAA,CAAa,CAAA,EAEhBE,EAAAA,IAAC,OAAA,CAAK,UAAWP,EAAiB,SAAApB,CAAA,CAAW,CAAA,EAC/C,CAEJ,CAEA,MAAA+B,EAAeC,EAAAA,gBAAgBpC,CAAM,ECvHrC,SAAwBqC,EAAO,CAAE,SAAA/B,EAAU,MAAAJ,EAAO,UAAAG,EAAW,SAAAE,EAAU,GAAGE,GAAsB,CAC9F,MAAM6B,EAAYlB,EAAAA,UAChB,GAAGC,EAAAA,MAAM,kBACTd,GAAY,GAAGc,EAAAA,MAAM,4BACrBnB,GAAS,GAAGmB,EAAAA,MAAM,oBAAoBnB,CAAK,GAC3CO,EAAM,SAAA,EAGFgB,EAAcC,GACXC,EAAAA,aAAaD,EAAM,CACxB,KAAM,SACN,UAAWN,EAAAA,UACTM,EAAK,MAAM,UACX,GAAGL,EAAAA,MAAM,uBAAA,CACX,CACD,EAGH,cACG,SAAA,CAAO,KAAK,SAAU,GAAGZ,EAAO,UAAA6B,EAC9B,SAAA,CAAAjC,GAAaoB,EAAWpB,CAA8B,EACtDC,CAAA,EACH,CAEJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as _,jsx as p}from"react/jsx-runtime";import{Children as M,useMemo as O,cloneElement as $}from"react";import{p as e}from"./index-CZ41y9Hn.js";import{j as s}from"./joinClass-anSpaauN.js";import{I}from"./Icon-DTU52KQE.js";import{u as S,M as w}from"./useMenu-
|
|
2
|
-
//# sourceMappingURL=Option-
|
|
1
|
+
import{jsxs as _,jsx as p}from"react/jsx-runtime";import{Children as M,useMemo as O,cloneElement as $}from"react";import{p as e}from"./index-CZ41y9Hn.js";import{j as s}from"./joinClass-anSpaauN.js";import{I}from"./Icon-DTU52KQE.js";import{u as S,M as w}from"./useMenu-CizlB9PU.js";import{c as E}from"./createComponent-BmdhWozT.js";function q({error:l,color:o="grey",label:r,helperText:m,startIcon:c,children:d,disabled:a,onChange:i,...n}){const f=M.toArray(d),C=O(()=>f.find(t=>t.props.value===n.value)?.props.children||"",[n.value]),[h,b,N]=S(),y=s(`${e}-select-container`),v=s(`${e}-select-label`,l&&`${e}-select-label--error`),x=s(`${e}-select`,a&&`${e}-select--disabled`,l&&`${e}-select--error`,n.className),g=s(`${e}-select__helper-text`,m&&`${e}-select__helper-text--visible`,l&&`${e}-select__helper-text--error`),k=t=>$(t,{className:s(t.props.className,`${e}-select__icon--left`),type:"button",style:{color:o},onClick:u=>{u.stopPropagation(),t.props.onClick&&!a&&t.props.onClick(u)}}),j=()=>f.map(t=>$(t,{color:o,className:s(t.props.className,t.props.value===n.value&&`${e}-select__option--selected`),onClick:u=>{!t.props.disabled&&i&&i(u)}}));return _("div",{className:y,children:[r&&_("label",{className:v,children:[r," ",n.required&&"*"]}),_("button",{type:"button",className:x,onClick:N,disabled:a,children:[p("div",{children:c&&k(c)}),p("input",{...n,readOnly:!0,type:"text",value:C,disabled:a}),p(I,{name:"angle-down",sx:{color:({grey:t})=>t.main},className:`${e}-select__icon--right`})]}),p(w,{autoClose:!0,direction:"center",open:h,anchorEl:b,onClose:N,children:j()}),p("span",{className:g,children:m})]})}const G=E(q);function H({children:l,color:o,startIcon:r,disabled:m,...c}){const d=s(`${e}-select__option`,m&&`${e}-select__option--disabled`,o&&`${e}-select__option--${o}`,c.className);return _("button",{type:"button",...c,className:d,children:[r&&(i=>$(i,{type:"button",className:s(i.props.className,`${e}-select__option__icon`)}))(r),l]})}export{H as O,G as S};
|
|
2
|
+
//# sourceMappingURL=Option-BvxuW39r.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Option-
|
|
1
|
+
{"version":3,"file":"Option-BvxuW39r.js","sources":["../../src/fields/Select/Select.tsx","../../src/fields/Select/Option.tsx"],"sourcesContent":["import {\n useMemo,\n Children,\n cloneElement,\n type ReactElement,\n type InputHTMLAttributes,\n type ButtonHTMLAttributes,\n} from 'react';\n\nimport { prefix } from '@iziui/tokens/web/js';\n\nimport type { Colors } from '@iziui/core/theme';\nimport { joinClass } from '@iziui/core/utils/joinClass';\n\nimport Icon from '@/display/Icon';\nimport { Menu, useMenu } from '@/navigation/Menu';\n\nimport type { OptionProps } from './Option';\nimport createComponent from '../../core/createComponent';\n\nimport '@iziui/styles/components/Select.scss';\n\nexport interface SelectProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'color'> {\n error?: boolean;\n autoClose?: boolean;\n label?: string;\n helperText?: string;\n color?: Colors;\n startIcon?: React.JSX.Element | boolean;\n children: React.JSX.Element | React.JSX.Element[];\n}\n\nfunction Select({\n error,\n color = 'grey',\n label,\n helperText,\n startIcon,\n children,\n disabled,\n onChange,\n ...props\n}: SelectProps) {\n const arrayChildren = Children.toArray(children) as ReactElement<OptionProps>[];\n\n const newValue = useMemo(() => {\n return arrayChildren.find((child) =>\n child.props.value === props.value)?.props.children || '';\n }, [props.value]);\n\n const [open, el, toggle] = useMenu();\n\n const containerClss = joinClass(\n `${prefix}-select-container`\n );\n\n const labelClss = joinClass(\n `${prefix}-select-label`,\n error && `${prefix}-select-label--error`,\n );\n\n const clss = joinClass(\n `${prefix}-select`,\n disabled && `${prefix}-select--disabled`,\n error && `${prefix}-select--error`,\n props.className\n );\n\n const helperTextClss = joinClass(\n `${prefix}-select__helper-text`,\n helperText && `${prefix}-select__helper-text--visible`,\n error && `${prefix}-select__helper-text--error`\n );\n\n const renderIcon = (icon: ReactElement<ButtonHTMLAttributes<any>>) => {\n return cloneElement(icon, {\n className: joinClass(\n icon.props.className,\n `${prefix}-select__icon--left`\n ),\n type: 'button',\n style: { color },\n onClick: (e) => {\n e.stopPropagation();\n if (icon.props.onClick && !disabled) { icon.props.onClick(e); };\n }\n });\n };\n\n const renderOption = () => {\n return arrayChildren.map((child) => {\n return cloneElement(child, {\n color,\n className: joinClass(\n child.props.className,\n child.props.value === props.value && `${prefix}-select__option--selected`,\n ),\n onClick: (e) => {\n if (!child.props.disabled && onChange) { onChange(e as any); }\n }\n });\n });\n };\n\n return (\n <div className={containerClss}>\n {label && <label className={labelClss}>{label} {props.required && '*'}</label>}\n <button type=\"button\" className={clss} onClick={toggle} disabled={disabled}>\n <div>\n {startIcon && renderIcon(startIcon as React.JSX.Element)}\n </div>\n <input {...props} readOnly type=\"text\" value={newValue} disabled={disabled} />\n <Icon\n name=\"angle-down\"\n sx={{ color: ({ grey }) => grey.main }}\n className={`${prefix}-select__icon--right`}\n />\n </button>\n <Menu\n autoClose\n direction=\"center\"\n open={open}\n anchorEl={el}\n onClose={toggle}\n >\n {renderOption()}\n </Menu>\n <span className={helperTextClss}>{helperText}</span>\n </div>\n );\n}\n\nexport default createComponent(Select);\n","import { ButtonHTMLAttributes, cloneElement, ReactElement } from 'react';\n\nimport { prefix } from '@iziui/tokens/web/js';\n\nimport { joinClass } from '@iziui/core/utils';\nimport type { Colors } from '@iziui/core/theme';\n\nexport interface OptionProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n value: any;\n children: string;\n color?: Colors;\n startIcon?: React.JSX.Element | boolean;\n}\nexport default function Option({ children, color, startIcon, disabled, ...props }: OptionProps) {\n const className = joinClass(\n `${prefix}-select__option`,\n disabled && `${prefix}-select__option--disabled`,\n color && `${prefix}-select__option--${color}`,\n props.className\n );\n\n const renderIcon = (icon: ReactElement<ButtonHTMLAttributes<any>>) => {\n return cloneElement(icon, {\n type: 'button',\n className: joinClass(\n icon.props.className,\n `${prefix}-select__option__icon`,\n ),\n });\n };\n\n return (\n <button type=\"button\" {...props} className={className}>\n {startIcon && renderIcon(startIcon as React.JSX.Element)}\n {children}\n </button>\n );\n};"],"names":["Select","error","color","label","helperText","startIcon","children","disabled","onChange","props","arrayChildren","Children","newValue","useMemo","child","open","el","toggle","useMenu","containerClss","joinClass","prefix","labelClss","clss","helperTextClss","renderIcon","icon","cloneElement","e","renderOption","jsxs","jsx","Icon","grey","Menu","Select_default","createComponent","Option","className"],"mappings":"2UAgCA,SAASA,EAAO,CACd,MAAAC,EACA,MAAAC,EAAQ,OACR,MAAAC,EACA,WAAAC,EACA,UAAAC,EACA,SAAAC,EACA,SAAAC,EACA,SAAAC,EACA,GAAGC,CACL,EAAgB,CACd,MAAMC,EAAgBC,EAAS,QAAQL,CAAQ,EAEzCM,EAAWC,EAAQ,IAChBH,EAAc,KAAMI,GACzBA,EAAM,MAAM,QAAUL,EAAM,KAAK,GAAG,MAAM,UAAY,GACvD,CAACA,EAAM,KAAK,CAAC,EAEV,CAACM,EAAMC,EAAIC,CAAM,EAAIC,EAAA,EAErBC,EAAgBC,EACpB,GAAGC,CAAM,mBAAA,EAGLC,EAAYF,EAChB,GAAGC,CAAM,gBACTpB,GAAS,GAAGoB,CAAM,sBAAA,EAGdE,EAAOH,EACX,GAAGC,CAAM,UACTd,GAAY,GAAGc,CAAM,oBACrBpB,GAAS,GAAGoB,CAAM,iBAClBZ,EAAM,SAAA,EAGFe,EAAiBJ,EACrB,GAAGC,CAAM,uBACTjB,GAAc,GAAGiB,CAAM,gCACvBpB,GAAS,GAAGoB,CAAM,6BAAA,EAGdI,EAAcC,GACXC,EAAaD,EAAM,CACxB,UAAWN,EACTM,EAAK,MAAM,UACX,GAAGL,CAAM,qBAAA,EAEX,KAAM,SACN,MAAO,CAAE,MAAAnB,CAAA,EACT,QAAU0B,GAAM,CACdA,EAAE,gBAAA,EACEF,EAAK,MAAM,SAAW,CAACnB,GAAYmB,EAAK,MAAM,QAAQE,CAAC,CAC7D,CAAA,CACD,EAGGC,EAAe,IACZnB,EAAc,IAAKI,GACjBa,EAAab,EAAO,CACzB,MAAAZ,EACA,UAAWkB,EACTN,EAAM,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AjC,IAZeqB,GACXC,EAAaD,EAAM,CACxB,KAAM,SACN,UAAWN,EACTM,EAAK,MAAM,UACX,GAAGL,CAAM,uBAAA,CACX,CACD,GAK0BhB,CAA8B,EACtDC,CAAA,EACH,CAEJ"}
|
|
@@ -0,0 +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-C2mSdoXV.js";import{C as q}from"./CardContent-CViecz1a.js";import{c as J}from"./createComponent-BmdhWozT.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=150,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-CizlB9PU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMenu-CizlB9PU.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 = 150,\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={{\n display: 'flex',\n flexDirection: 'column',\n maxHeight\n }}\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,EAAY,IACZ,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,EAE7BC,EAAUC,EACd,GAAGC,CAAM,QACT,GAAGA,CAAM,UAAUX,GAAQ,SAAS,GACpCL,EAAM,SAAA,EAGRiB,EAAmB,IAAMC,IAAkB,CAACvB,CAAQ,CAAC,EAErDwB,EAAU,IAAM,CAAED,EAAA,CAAkB,EAAG,CAACvB,CAAQ,CAAC,EAGjDwB,EA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,EAAAC,EAAA,CACE,SAAA,CAAAC,EAAC,MAAA,CACC,GAAA1B,EACA,IAAAV,EACC,GAAGD,EACJ,MAAO,CACL,MAAOP,GAASY,EAAO,MACvB,IAAKH,GAAY,IACjB,KAAMA,GAAY,KAClB,QAASG,GAAQ,QAAU,UAAY,QAAU,OACjD,WAAY,OAAOG,CAAkB,aACrC,OAAQ,GACR,GAAGR,EAAM,KAAA,EAEX,UAAWc,EAGT,YACEuB,EAACC,EAAA,CAAK,UAAW,GAAGtB,CAAM,cACxB,SAAAqB,EAACE,EAAA,CACC,UAAW,GAAGvB,CAAM,uBACpB,GAAI,CAAE,GAAI,CAAA,EACV,MAAO,CACL,QAAS,OACT,cAAe,SACf,UAAAnB,CAAA,EAGD,SAAAiC,EAAA,CAAe,CAAA,CAClB,CACF,CAAA,CAAA,EAILtC,KAAS,MAAA,CAAI,UAAW,GAAGwB,CAAM,iBAAkB,QAASK,CAAA,CAAa,CAAA,EAC5E,CAEJ,CAAC,EAEDmB,GAAeC,EAAgBnD,CAAI,ECrKnC,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"}
|
|
@@ -0,0 +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-Bqgukgip.cjs"),S=require("./CardContent-DPL-tBOS.cjs"),B=require("./createComponent-Bls5N6x8.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=150,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-D9-CcpCS.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMenu-D9-CcpCS.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 = 150,\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={{\n display: 'flex',\n flexDirection: 'column',\n maxHeight\n }}\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","Card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kB,aACrC,OAAQ,GACR,GAAGR,EAAM,KAAA,EAEX,UAAWc,EAGT,YACEuB,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,CACL,QAAS,OACT,cAAe,SACf,UAAAnB,CAAA,EAGD,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,ECrKnC,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,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),d=require("react"),e=require("../../chunks/index-DYxwT4uW.cjs"),s=require("../../chunks/joinClass-Jk3EszKD.cjs"),x=require("../../chunks/generateSupportColors-CTMoGhDf.cjs"),P=require("../../chunks/uuid-omnJ9TjZ.cjs"),R=require("../../chunks/Box-CNg55MFq.cjs"),C=require("../../chunks/Icon-BN4Kp4Aq.cjs"),E=require("../../chunks/Stack-CF3Wyma9.cjs"),I=require("../../chunks/useTheme-DsrjDJKC.cjs"),_=require("../../chunks/useMenu-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),d=require("react"),e=require("../../chunks/index-DYxwT4uW.cjs"),s=require("../../chunks/joinClass-Jk3EszKD.cjs"),x=require("../../chunks/generateSupportColors-CTMoGhDf.cjs"),P=require("../../chunks/uuid-omnJ9TjZ.cjs"),R=require("../../chunks/Box-CNg55MFq.cjs"),C=require("../../chunks/Icon-BN4Kp4Aq.cjs"),E=require("../../chunks/Stack-CF3Wyma9.cjs"),I=require("../../chunks/useTheme-DsrjDJKC.cjs"),_=require("../../chunks/useMenu-D9-CcpCS.cjs"),O=require("../../chunks/createComponent-Bls5N6x8.cjs");require("../../chunks/useListenerResized-AwpsZLcP.cjs");require("../../chunks/Card-Bqgukgip.cjs");require("../../chunks/Ripple-Dy4i91j1.cjs");require("../../chunks/CardContent-DPL-tBOS.cjs");const k=["#00aae6","#2e72fe","#6f4dff","#9f40f1","#9e2dbf","#db5bdc","#ea479b","#ff83a8","#d80051","#eb3d32","#fa8d2f","#f5cd2b","#93ca00","#62d26f","#38c5ab","#87969f"];function T({label:n,error:i,helperText:t,fitContent:m,value:c=k[0],autoClose:b,onChange:j,onInput:h,...$}){const{theme:{palette:a}}=I.useTheme(),l=d.useRef(null),[q,g,u]=_.useMenu(),p=d.useMemo(()=>P.uuid(),[]),N=s.joinClass(`${e.prefix}-color-picker__label`,i&&`${e.prefix}-color-picker__label--error`),y=s.joinClass(`${e.prefix}-color-picker-container`,i&&`${e.prefix}-color-picker-container--error`),v=s.joinClass(`${e.prefix}-color-picker`,i&&`${e.prefix}-color-picker--error`),M=s.joinClass(`${e.prefix}-color-picker__value`,i&&`${e.prefix}-color-picker__value--error`),S=s.joinClass(`${e.prefix}-color-picker__helper-text`,t&&`${e.prefix}-color-picker__helper-text--visible`,i&&`${e.prefix}-color-picker__helper-text--error`),f=o=>s.joinClass(`${e.prefix}-color-picker__color__icon`,c===o&&`${e.prefix}-color-picker__color__icon--visible`);function w(o){l.current&&(l.current.value=o,l.current.dispatchEvent(new Event("input",{bubbles:!0})))}return r.jsxs("div",{className:y,children:[n&&r.jsxs("label",{className:N,children:[n," ",$.required&&"*"]}),r.jsxs("button",{type:"button",onClick:u,className:v,children:[r.jsx("div",{className:`${e.prefix}-color-picker__preview`,children:r.jsx("div",{style:{backgroundColor:c}})}),r.jsx("div",{className:M,children:c})]}),r.jsx("span",{className:S,children:t}),r.jsx(_.Menu,{direction:"left",autoClose:b,open:q,anchorEl:g,width:m?"fit-content":"",onClose:u,children:r.jsx(R.Box,{sx:{p:1},children:r.jsxs(E.Stack,{gap:8,flexDirection:"row",justifyContent:"center",style:{flexWrap:"wrap"},children:[k.map(o=>r.jsx("button",{type:"button",className:`${e.prefix}-color-picker__color`,onClick:()=>w(o),style:{backgroundColor:o},children:r.jsx(C.Icon,{name:"check",className:f(o),style:{color:x.getContrastColor(c)}})},o)),r.jsxs("label",{htmlFor:`color-picker-${p}`,className:`${e.prefix}-color-picker__color`,style:{backgroundColor:a.grey.main},children:[r.jsx(C.Icon,{name:"plus",className:f(c),style:{color:x.getContrastColor(a.grey.main)}}),r.jsx("input",{ref:l,type:"color",id:`color-picker-${p}`,value:c,onChange:j,onInput:h})]})]})})})]})}const B=O.createComponent(T);exports.default=B;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as i,jsx as e}from"react/jsx-runtime";import{useRef as P,useMemo as R}from"react";import{p as o}from"../../chunks/index-CZ41y9Hn.js";import{j as l}from"../../chunks/joinClass-anSpaauN.js";import{b as u}from"../../chunks/generateSupportColors-BN5t8dA-.js";import{u as S}from"../../chunks/uuid-dGvr9vBZ.js";import{B}from"../../chunks/Box-DqBZgXYR.js";import{I as _}from"../../chunks/Icon-DTU52KQE.js";import{S as I}from"../../chunks/Stack-CHR_pZC4.js";import{u as O}from"../../chunks/useTheme-BYuNiCiH.js";import{u as q,M as D}from"../../chunks/useMenu-
|
|
1
|
+
import{jsxs as i,jsx as e}from"react/jsx-runtime";import{useRef as P,useMemo as R}from"react";import{p as o}from"../../chunks/index-CZ41y9Hn.js";import{j as l}from"../../chunks/joinClass-anSpaauN.js";import{b as u}from"../../chunks/generateSupportColors-BN5t8dA-.js";import{u as S}from"../../chunks/uuid-dGvr9vBZ.js";import{B}from"../../chunks/Box-DqBZgXYR.js";import{I as _}from"../../chunks/Icon-DTU52KQE.js";import{S as I}from"../../chunks/Stack-CHR_pZC4.js";import{u as O}from"../../chunks/useTheme-BYuNiCiH.js";import{u as q,M as D}from"../../chunks/useMenu-CizlB9PU.js";import{c as F}from"../../chunks/createComponent-BmdhWozT.js";import"../../chunks/useListenerResized-Bnqxrt7k.js";import"../../chunks/Card-C2mSdoXV.js";import"../../chunks/Ripple-Bq9bxg4k.js";import"../../chunks/CardContent-CViecz1a.js";const k=["#00aae6","#2e72fe","#6f4dff","#9f40f1","#9e2dbf","#db5bdc","#ea479b","#ff83a8","#d80051","#eb3d32","#fa8d2f","#f5cd2b","#93ca00","#62d26f","#38c5ab","#87969f"];function L({label:s,error:t,helperText:a,fitContent:b,value:c=k[0],autoClose:h,onChange:C,onInput:$,...N}){const{theme:{palette:p}}=O(),n=P(null),[y,x,m]=q(),f=R(()=>S(),[]),g=l(`${o}-color-picker__label`,t&&`${o}-color-picker__label--error`),v=l(`${o}-color-picker-container`,t&&`${o}-color-picker-container--error`),j=l(`${o}-color-picker`,t&&`${o}-color-picker--error`),w=l(`${o}-color-picker__value`,t&&`${o}-color-picker__value--error`),M=l(`${o}-color-picker__helper-text`,a&&`${o}-color-picker__helper-text--visible`,t&&`${o}-color-picker__helper-text--error`),d=r=>l(`${o}-color-picker__color__icon`,c===r&&`${o}-color-picker__color__icon--visible`);function E(r){n.current&&(n.current.value=r,n.current.dispatchEvent(new Event("input",{bubbles:!0})))}return i("div",{className:v,children:[s&&i("label",{className:g,children:[s," ",N.required&&"*"]}),i("button",{type:"button",onClick:m,className:j,children:[e("div",{className:`${o}-color-picker__preview`,children:e("div",{style:{backgroundColor:c}})}),e("div",{className:w,children:c})]}),e("span",{className:M,children:a}),e(D,{direction:"left",autoClose:h,open:y,anchorEl:x,width:b?"fit-content":"",onClose:m,children:e(B,{sx:{p:1},children:i(I,{gap:8,flexDirection:"row",justifyContent:"center",style:{flexWrap:"wrap"},children:[k.map(r=>e("button",{type:"button",className:`${o}-color-picker__color`,onClick:()=>E(r),style:{backgroundColor:r},children:e(_,{name:"check",className:d(r),style:{color:u(c)}})},r)),i("label",{htmlFor:`color-picker-${f}`,className:`${o}-color-picker__color`,style:{backgroundColor:p.grey.main},children:[e(_,{name:"plus",className:d(c),style:{color:u(p.grey.main)}}),e("input",{ref:n,type:"color",id:`color-picker-${f}`,value:c,onChange:C,onInput:$})]})]})})})]})}const ro=F(L);export{ro 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/useMenu-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/useMenu-D9-CcpCS.cjs"),r=require("../../chunks/MenuButton-Dpbow8YC.cjs");require("react/jsx-runtime");require("react");require("../../chunks/index-DYxwT4uW.cjs");require("../../chunks/joinClass-Jk3EszKD.cjs");require("../../chunks/uuid-omnJ9TjZ.cjs");require("../../chunks/useListenerResized-AwpsZLcP.cjs");require("../../chunks/Card-Bqgukgip.cjs");require("../../chunks/Ripple-Dy4i91j1.cjs");require("../../chunks/createComponent-Bls5N6x8.cjs");require("../../chunks/useTheme-DsrjDJKC.cjs");require("../../chunks/generateSupportColors-CTMoGhDf.cjs");require("../../chunks/CardContent-DPL-tBOS.cjs");exports.Menu=e.Menu;exports.useMenu=e.useMenu;exports.MenuButton=r.MenuButton_default;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{M as B,u as b}from"../../chunks/useMenu-
|
|
1
|
+
import{M as B,u as b}from"../../chunks/useMenu-CizlB9PU.js";import{M as d}from"../../chunks/MenuButton-31ZFG3JW.js";import"react/jsx-runtime";import"react";import"../../chunks/index-CZ41y9Hn.js";import"../../chunks/joinClass-anSpaauN.js";import"../../chunks/uuid-dGvr9vBZ.js";import"../../chunks/useListenerResized-Bnqxrt7k.js";import"../../chunks/Card-C2mSdoXV.js";import"../../chunks/Ripple-Bq9bxg4k.js";import"../../chunks/createComponent-BmdhWozT.js";import"../../chunks/useTheme-BYuNiCiH.js";import"../../chunks/generateSupportColors-BN5t8dA-.js";import"../../chunks/CardContent-CViecz1a.js";export{B as Menu,d as MenuButton,b as useMenu};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/Option-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../chunks/Option-B1l_zN4-.cjs");require("react/jsx-runtime");require("react");require("../../chunks/index-DYxwT4uW.cjs");require("../../chunks/joinClass-Jk3EszKD.cjs");require("../../chunks/Icon-BN4Kp4Aq.cjs");require("../../chunks/createComponent-Bls5N6x8.cjs");require("../../chunks/useTheme-DsrjDJKC.cjs");require("../../chunks/generateSupportColors-CTMoGhDf.cjs");require("../../chunks/useMenu-D9-CcpCS.cjs");require("../../chunks/uuid-omnJ9TjZ.cjs");require("../../chunks/useListenerResized-AwpsZLcP.cjs");require("../../chunks/Card-Bqgukgip.cjs");require("../../chunks/Ripple-Dy4i91j1.cjs");require("../../chunks/CardContent-DPL-tBOS.cjs");exports.Option=e.Option;exports.Select=e.Select_default;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{O as b,S as d}from"../../chunks/Option-
|
|
1
|
+
import{O as b,S as d}from"../../chunks/Option-BvxuW39r.js";import"react/jsx-runtime";import"react";import"../../chunks/index-CZ41y9Hn.js";import"../../chunks/joinClass-anSpaauN.js";import"../../chunks/Icon-DTU52KQE.js";import"../../chunks/createComponent-BmdhWozT.js";import"../../chunks/useTheme-BYuNiCiH.js";import"../../chunks/generateSupportColors-BN5t8dA-.js";import"../../chunks/useMenu-CizlB9PU.js";import"../../chunks/uuid-dGvr9vBZ.js";import"../../chunks/useListenerResized-Bnqxrt7k.js";import"../../chunks/Card-C2mSdoXV.js";import"../../chunks/Ripple-Bq9bxg4k.js";import"../../chunks/CardContent-CViecz1a.js";export{b as Option,d as Select};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./chunks/useTheme-DsrjDJKC.cjs"),i=require("./chunks/Bounce-ByNbJjX0.cjs"),e=require("./chunks/useForm-BNLOy0E6.cjs"),d=require("./chunks/Fade-DfxUFkY4.cjs"),n=require("./chunks/Option-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./chunks/useTheme-DsrjDJKC.cjs"),i=require("./chunks/Bounce-ByNbJjX0.cjs"),e=require("./chunks/useForm-BNLOy0E6.cjs"),d=require("./chunks/Fade-DfxUFkY4.cjs"),n=require("./chunks/Option-B1l_zN4-.cjs"),l=require("./chunks/Slide-D4aLHjYS.cjs"),u=require("./chunks/useTabs-Dcksp_re.cjs"),t=require("./chunks/TableHeader-D0wXM5mO.cjs"),q=require("./chunks/Zoom-BOnqwiDY.cjs"),r=require("./chunks/DrawerContent-BkSL16Os.cjs"),c=require("./chunks/useListenerResized-AwpsZLcP.cjs"),a=require("./chunks/useMenu-D9-CcpCS.cjs"),T=require("./chunks/useResize-Dnf6Ktrn.cjs"),m=require("./chunks/Card-Bqgukgip.cjs"),b=require("./chunks/CardContent-DPL-tBOS.cjs"),s=require("./chunks/GridItem-wwo-SHGR.cjs"),C=require("./chunks/MenuButton-Dpbow8YC.cjs"),F=require("./chunks/Typography-Ch-BLqCH.cjs");require("react");require("react/jsx-runtime");require("./chunks/generateSupportColors-CTMoGhDf.cjs");require("./chunks/wait-CgS79FV1.cjs");require("./chunks/index-DYxwT4uW.cjs");require("./chunks/joinClass-Jk3EszKD.cjs");require("./chunks/Icon-BN4Kp4Aq.cjs");require("./chunks/createComponent-Bls5N6x8.cjs");require("./chunks/uuid-omnJ9TjZ.cjs");require("./chunks/Stack-CF3Wyma9.cjs");require("./chunks/ButtonIcon-Ccq88QaY.cjs");require("./chunks/Ripple-Dy4i91j1.cjs");require("./chunks/convertPathToColor-D8eBpd_D.cjs");exports.ThemeProvider=o.ThemeProvider;exports.createTheme=o.createTheme;exports.useTheme=o.useTheme;exports.Bounce=i.Bounce;exports.Control=e.Control;exports.Form=e.Form;exports.useControl=e.useControl;exports.useForm=e.useForm;exports.useFormGroup=e.useFormGroup;exports.Fade=d.Fade;exports.Option=n.Option;exports.Select=n.Select_default;exports.Slide=l.Slide;exports.TabButton=u.TabButton;exports.TabContent=u.TabContent;exports.Tabs=u.Tabs_default;exports.useTabs=u.useTabs;exports.Table=t.Table_default;exports.TableBody=t.TableBody;exports.TableCell=t.TableCell_default;exports.TableHeader=t.TableHeader;exports.Zoom=q.Zoom;exports.Drawer=r.Drawer_default;exports.DrawerContent=r.DrawerContent_default;exports.DrawerFooter=r.DrawerFooter_default;exports.DrawerHeader=r.DrawerHeader_default;exports.useDrawer=r.useDrawer;exports.useListenerResized=c.useListenerResized;exports.Menu=a.Menu;exports.useMenu=a.useMenu;exports.useResize=T.useResize;exports.Card=m.Card;exports.CardContent=b.CardContent;exports.Grid=s.Grid;exports.GridItem=s.GridItem;exports.MenuButton=C.MenuButton_default;exports.variants=F.variants;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{T as d,c as C,u as l}from"./chunks/useTheme-BYuNiCiH.js";import{B as c}from"./chunks/Bounce-DP0PU3kr.js";import{C as w,F as B,u as M,a as G,b as S}from"./chunks/useForm-iwGfb88g.js";import{F as v}from"./chunks/Fade-CWDTkVB8.js";import{O as H,S as O}from"./chunks/Option-
|
|
1
|
+
import{T as d,c as C,u as l}from"./chunks/useTheme-BYuNiCiH.js";import{B as c}from"./chunks/Bounce-DP0PU3kr.js";import{C as w,F as B,u as M,a as G,b as S}from"./chunks/useForm-iwGfb88g.js";import{F as v}from"./chunks/Fade-CWDTkVB8.js";import{O as H,S as O}from"./chunks/Option-BvxuW39r.js";import{S as Z}from"./chunks/Slide-BxEwoZ70.js";import{T as I,a as L,b as P,u as g}from"./chunks/useTabs-DG53jo4T.js";import{T as k,a as q,b as A,c as E}from"./chunks/TableHeader-CrbbJXyv.js";import{Z as K}from"./chunks/Zoom-DqgU4Wfv.js";import{D as Q,a as U,b as V,c as W,u as X}from"./chunks/DrawerContent-D8NDBDBf.js";import{u as _}from"./chunks/useListenerResized-Bnqxrt7k.js";import{M as rr,u as or}from"./chunks/useMenu-CizlB9PU.js";import{u as ar}from"./chunks/useResize-BUftB918.js";import{C as tr}from"./chunks/Card-C2mSdoXV.js";import{C as pr}from"./chunks/CardContent-CViecz1a.js";import{G as ir,a as fr}from"./chunks/GridItem-CaoPZmBu.js";import{M as nr}from"./chunks/MenuButton-31ZFG3JW.js";import{v as br}from"./chunks/Typography-B_WR62ip.js";import"react";import"react/jsx-runtime";import"./chunks/generateSupportColors-BN5t8dA-.js";import"./chunks/wait-BSgGzoPk.js";import"./chunks/index-CZ41y9Hn.js";import"./chunks/joinClass-anSpaauN.js";import"./chunks/Icon-DTU52KQE.js";import"./chunks/createComponent-BmdhWozT.js";import"./chunks/uuid-dGvr9vBZ.js";import"./chunks/Stack-CHR_pZC4.js";import"./chunks/ButtonIcon-DMetcfYt.js";import"./chunks/Ripple-Bq9bxg4k.js";import"./chunks/convertPathToColor-DtOjH4ZP.js";export{c as Bounce,tr as Card,pr as CardContent,w as Control,Q as Drawer,U as DrawerContent,V as DrawerFooter,W as DrawerHeader,v as Fade,B as Form,ir as Grid,fr as GridItem,rr as Menu,nr as MenuButton,H as Option,O as Select,Z as Slide,I as TabButton,L as TabContent,k as Table,q as TableBody,A as TableCell,E as TableHeader,P as Tabs,d as ThemeProvider,K as Zoom,C as createTheme,M as useControl,X as useDrawer,G as useForm,S as useFormGroup,_ as useListenerResized,or as useMenu,ar as useResize,g as useTabs,l as useTheme,br as variants};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/style.css
CHANGED
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
/* assets/index-Rdw3YS4e.css */
|
|
74
74
|
.iziui-modal{width:600px;box-shadow:0 1px 3px #0000001f,0 1px 2px #0000003d;transition:all .3s cubic-bezier(.4,0,.2,1);transform:translateY(50px)}.iziui-modal--show{transform:translateY(0)}.iziui-modal__content{margin-top:16px}.iziui-modal__container{height:100%;outline:0px;display:flex;justify-content:center;align-items:center;padding:0 16px}.iziui-modal__backdrop{position:fixed;z-index:1300;inset:0;background-color:#000000a3;opacity:0;transition:all .3s cubic-bezier(.4,0,.2,1)}.iziui-modal__backdrop--show{opacity:1}
|
|
75
75
|
/*$vite$:1*/
|
|
76
|
-
/* assets/useMenu-
|
|
77
|
-
.iziui-menu{position:
|
|
76
|
+
/* assets/useMenu-XCECShlg.css */
|
|
77
|
+
.iziui-menu{position:fixed;word-break:break-all;white-space:pre-wrap;display:flex;flex-direction:column;z-index:4}.iziui-menu__overlay{position:fixed;height:100vh;width:100%;top:0;left:0;z-index:3;cursor:auto}.iziui-menu__card{box-shadow:0 1px 3px #0000001f,0 1px 2px #0000003d}.iziui-menu__card__content{overflow:auto;padding:8px 0}.iziui-menu--open{opacity:1;transform:translateY(0)}.iziui-menu--close{transform:translateY(-10px);opacity:0}.iziui-menu__item{border:none;padding:8px 16px;position:relative;white-space:nowrap;background-color:transparent;color:var(--text-primary);transition:all .3s cubic-bezier(.4,0,.2,1);font-size:16px;cursor:pointer;display:flex;align-items:center;justify-content:flex-start}.iziui-menu__item:hover{background-color:var(--divider)}.iziui-menu__item--primary{color:var(--primary)}.iziui-menu__item--primary:hover{background-color:var(--primary-opacity)}.iziui-menu__item--secondary{color:var(--secondary)}.iziui-menu__item--secondary:hover{background-color:var(--secondary-opacity)}.iziui-menu__item--info{color:var(--info)}.iziui-menu__item--info:hover{background-color:var(--info-opacity)}.iziui-menu__item--error{color:var(--error)}.iziui-menu__item--error:hover{background-color:var(--error-opacity)}.iziui-menu__item--warning{color:var(--warning)}.iziui-menu__item--warning:hover{background-color:var(--warning-opacity)}.iziui-menu__item--success{color:var(--success)}.iziui-menu__item--success:hover{background-color:var(--success-opacity)}.iziui-menu__item--grey{color:var(--grey)}.iziui-menu__item--grey:hover{background-color:var(--grey-opacity)}
|
|
78
78
|
/*$vite$:1*/
|
|
79
79
|
/* assets/TableHeader-BihiZoyL.css */
|
|
80
80
|
.iziui-table{width:100%;border-radius:var(--radius);overflow:hidden;border-spacing:0px;border-collapse:separate}.iziui-table__header td{font-size:.875rem;text-transform:uppercase;padding:10.8px 14.4px;font-weight:600;color:var(--text-primary);border-right:1px solid var(--divider);border-bottom:1px solid var(--divider);background-color:var(--background-default);transition:all .3s cubic-bezier(.4,0,.2,1)}.iziui-table__header td:last-child{border-right:0}.iziui-table__body tr{background-color:var(--background-default);transition:all .3s cubic-bezier(.4,0,.2,1)}.iziui-table__body tr:hover{background-color:var(--background-paper)}.iziui-table__body tr td{padding:10.8px 14.4px;font-size:.875rem;border:none;border-right:1px solid var(--divider);border-bottom:1px solid var(--divider);color:var(--text-primary);transition:all .3s cubic-bezier(.4,0,.2,1)}.iziui-table__body tr td:last-child{border-right:none}.iziui-table__body tr:last-child td{border-bottom:none}.iziui-table__cell--center{text-align:center}.iziui-table__cell--right{text-align:right}.iziui-table__cell--left{text-align:left}
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
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-Bqgukgip.cjs"),S=require("./CardContent-DPL-tBOS.cjs"),B=require("./createComponent-Bls5N6x8.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-CvPJe62S.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useMenu-CvPJe62S.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,EAAAA,QAAQ,IAAMC,EAAAA,KAAA,EAAQ,CAAA,CAAE,EAE7BC,EAAUC,EAAAA,UACd,GAAGC,EAAAA,MAAM,QACT,GAAGA,EAAAA,MAAM,UAAUX,GAAQ,SAAS,GACpCL,EAAM,SAAA,EAGRiB,EAAAA,mBAAmB,IAAMC,IAAkB,CAACvB,CAAQ,CAAC,EAErDwB,EAAAA,UAAU,IAAM,CAAED,EAAA,CAAkB,EAAG,CAACvB,CAAQ,CAAC,EAGjDwB,EAAAA,UAAU,IAAM,CAAE3B,EA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C,WAAA,CACE,SAAA,CAAAC,EAAAA,IAAC,MAAA,CACC,GAAA1B,EACA,IAAAV,EACC,GAAGD,EACJ,MAAO,CACL,MAAOP,GAASY,EAAO,MACvB,IAAKH,GAAY,IACjB,KAAMA,GAAY,KAClB,QAASG,GAAQ,QAAU,UAAY,QAAU,OACjD,WAAY,OAAOG,CAAkB,aACrC,OAAQ,GACR,GAAGR,EAAM,KAAA,EAEX,UAAWc,EAGT,YACEuB,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,2 +0,0 @@
|
|
|
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-C2mSdoXV.js";import{C as q}from"./CardContent-CViecz1a.js";import{c as J}from"./createComponent-BmdhWozT.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-we523Eob.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useMenu-we523Eob.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":"oe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