ali-mohammadi-design-system 2.0.3 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,20 +1,20 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const S=require("react/jsx-runtime"),p=require("react"),u=require("prop-types"),m={neutral:{0:"#FFFFFF",50:"#FAFAFA"},primary:{50:"#e3f2fd",500:"#2196f3"}},z={Neutral:{0:"#FFFFFF",50:"#FAFAFA",100:"#F4F4F5",200:"#EAEAEB",300:"#D4D5D6",400:"#AAABAD",500:"#7F8185",600:"#55575C",700:"#2A2D33",800:"#232529",900:"#1B1D21"},Purple:{100:"#F9F2FD",200:"#E6D9EC",300:"#D9C5E2",400:"#B38CC5",500:"#9A65B2",600:"#813F9F",700:"#67327F",800:"#4D265F",900:"#341940"},Blue:{100:"#E5EDFB",200:"#CCDAF7",300:"#B2C8F3",400:"#99B5EF",500:"#6691E8",600:"#336CE0",700:"#0047D8",800:"#0039AD",900:"#002B82"},Violet:{100:"#EDECFC",200:"#DCDAFA",300:"#CAC7F7",400:"#B9B5F5",500:"#9690EF",600:"#736BEA",700:"#5046E5",800:"#4038B8",900:"#191547",950:"#110E30"},Yellow:{100:"#FEF8E9",200:"#FDF1D3",300:"#FCEABD",400:"#FBE3A7",500:"#FAD67C",600:"#F8C850",700:"#F6BA24",800:"#ECAD11",900:"#CE960A"},Red:{100:"#FFEBEB",200:"#FFD6D6",300:"#FFC2C2",400:"#FFADAD",500:"#FF8585",600:"#FF5C5C",700:"#FF3333",800:"#CE2929",900:"#9D1F1F"},Green:{100:"#EBFAF1",200:"#D7F4E4",300:"#AFE9C8",400:"#87DFAD",500:"#5FD491",600:"#5FD491",700:"#2CA15E",800:"#217947",900:"#16502F"},Orange:{100:"#FFF4EB",200:"#FFE9D6",300:"#FFDEC2",400:"#FFD3AE",500:"#FFBD85",600:"#FFA75D",700:"#FF9134",800:"#E8842F",900:"#DF771E"},Cyan:{100:"#E8F6FF",200:"#DCF2FF",300:"#C4E9FF",400:"#A0DAFF",500:"#87D1FF",600:"#56BFFF",700:"#1DA6FB",800:"#0B89D6",900:"#0467A4"},TypeScale:{Weight:{Regular:"Regular",Bold:"Bold",SemiBold:"Semibold"},FontFamily:{YekanBakh:"Yekan Bakh FaNum"},Size:{10:10,11:11,12:12,14:14,16:16,18:18,20:20,24:24,28:28,32:32,36:36,48:48,64:64},Height:{10:10,12:12,14:14,16:16,20:20,24:24,28:28,32:32,36:36,40:40,44:44,48:48,74:74}},NumberScale:{Radius:{"Radius-12":12,"Radius-8":8,"Radius-4":4,"Radius-24":24,"Radius-20":20,"Radius-16":16,"Radius-Full":1e3,"Radius-28":28},Spacing:{"spacing-4":4,"spacing-8":8,"spacing-12":12,"spacing-16":16,"spacing-20":20,"spacing-24":24,"spacing-32":32,"spacing-40":40,"spacing-48":48,"spacing-56":56,"spacing-64":64,"spacing-72":72,"spacing-80":80},StrokeWeight:{StrokeWeight1:1,StrokeWeight2:1.5,StrokeWeight4:3,StrokeWeight3:2,StrokeWeight5:4},IconSize:{IconSizesmall:16,IconSizeMedium:20,IconSizeLarge:24,IconSizeExtraLarge:32}},Peach:{100:"#FFEEE5",200:"#FFDDCC",300:"#FFCCB2",400:"#FFBB99",500:"#FF9966",600:"#FF7733",700:"#FF5500",800:"#CC4400",900:"#993300"},Buttons:104,MinWidth:64},f={brand:z};function T(){const r={colors:{},typography:{},spacing:{},radius:{},shadows:{}};if(f.brand&&Object.entries(f.brand).forEach(([n,t])=>{if(typeof t=="object"&&!Array.isArray(t)){const e=n.toLowerCase();r.colors[e]={},Object.entries(t).forEach(([s,a])=>{(typeof a=="string"||typeof a=="number")&&(r.colors[e][s]=a)})}}),f.brand?.TypeScale){const n=f.brand.TypeScale;r.typography={fontFamily:n.FontFamily?.YekanBakh,sizes:n.Size||{},lineHeights:n.Height||{},weights:n.Weight||{}}}if(f.brand?.NumberScale){const n=f.brand.NumberScale;n.Spacing&&(r.spacing={},Object.entries(n.Spacing).forEach(([t,e])=>{const s=t.replace("spacing-","");r.spacing[s]=typeof e=="number"?e:parseInt(e)})),n.Radius&&(r.radius={},Object.entries(n.Radius).forEach(([t,e])=>{const s=t.replace("Radius-","").toLowerCase();r.radius[s]=typeof e=="number"?e:parseInt(e)}))}return r}const $={colors:{primary:{50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1"},neutral:{0:"#FFFFFF",50:"#FAFAFA",100:"#F5F5F5",200:"#EEEEEE",300:"#E0E0E0",400:"#BDBDBD",500:"#9E9E9E",600:"#757575",700:"#616161",800:"#424242",900:"#212121"},success:{50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"},error:{50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c"},warning:{50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100"},info:{50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1"}},typography:{fontFamily:"system-ui, -apple-system, sans-serif",baseSize:16,minSize:14,scaleRatio:1.25,sizes:{10:10,11:11,12:12,14:14,16:16,18:18,20:20,24:24,28:28,32:32,36:36,48:48,64:64},lineHeights:{10:10,12:12,14:14,16:16,20:20,24:24,28:28,32:32,36:36,40:40,44:44,48:48,74:74},weights:{regular:"400",semibold:"600",bold:"700"}},spacing:{unit:4,4:4,8:8,12:12,16:16,20:20,24:24,32:32,40:40,48:48,56:56,64:64,72:72,80:80},radius:{xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":28,full:1e3},shadows:{sm:"0px 1px 2px rgba(0, 0, 0, 0.05)",md:"0px 4px 6px rgba(0, 0, 0, 0.1)",lg:"0px 10px 15px rgba(0, 0, 0, 0.1)",xl:"0px 20px 25px rgba(0, 0, 0, 0.1)"}};function y(r,n){const t={...r};return b(r)&&b(n)&&Object.keys(n).forEach(e=>{b(n[e])?e in r?t[e]=y(r[e],n[e]):Object.assign(t,{[e]:n[e]}):Object.assign(t,{[e]:n[e]})}),t}function b(r){return r&&typeof r=="object"&&!Array.isArray(r)}const j=T(),F=y($,j);function h(r={}){return y(F,r)}function E(r={}){const n=h(r),t=document.createElement("style");t.id="ds-theme";let e=`:root {
2
- `;Object.entries(n.colors).forEach(([o,i])=>{typeof i=="object"&&Object.entries(i).forEach(([l,d])=>{e+=` --${o}-${l}: ${d};
3
- `})});const s=n.typography;if(e+=` --font-family: ${s.fontFamily};
4
- `,s.baseSize&&s.minSize){const o=(s.baseSize-s.minSize)/1600,l=`${-320*o+s.minSize}px + ${o*100}vw`;e+=` --font-size-base: clamp(${s.minSize}px, ${l}, ${s.baseSize}px);
5
- `}else e+=` --font-size-base: ${s.baseSize||16}px;
6
- `;e+=` --type-scale: ${s.scaleRatio||1.25};
7
- `,s.sizes&&Object.entries(s.sizes).forEach(([o,i])=>{e+=` --font-size-${o}: ${i}px;
8
- `}),s.lineHeights&&Object.entries(s.lineHeights).forEach(([o,i])=>{e+=` --line-height-${o}: ${i}px;
9
- `}),s.weights&&Object.entries(s.weights).forEach(([o,i])=>{e+=` --font-weight-${o}: ${i};
10
- `});const a=n.spacing.unit||4;e+=` --space-unit: ${a}px;
11
- `,Object.entries(n.spacing).forEach(([o,i])=>{o!=="unit"&&(e+=` --space-${o}: ${i}px;
12
- `)}),Object.entries(n.radius).forEach(([o,i])=>{e+=` --radius-${o}: ${i}px;
13
- `}),n.shadows&&Object.entries(n.shadows).forEach(([o,i])=>{e+=` --shadow-${o}: ${i};
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const D=require("react/jsx-runtime"),g=require("react"),p=require("prop-types"),$={neutral:{0:"#FFFFFF",50:"#FAFAFA"},primary:{50:"#e3f2fd",500:"#2196f3"}},k={Neutral:{0:"#FFFFFF",50:"#FAFAFA",100:"#F4F4F5",200:"#EAEAEB",300:"#D4D5D6",400:"#AAABAD",500:"#7F8185",600:"#55575C",700:"#2A2D33",800:"#232529",900:"#1B1D21"},Purple:{100:"#F9F2FD",200:"#E6D9EC",300:"#D9C5E2",400:"#B38CC5",500:"#9A65B2",600:"#813F9F",700:"#67327F",800:"#4D265F",900:"#341940"},Blue:{100:"#E5EDFB",200:"#CCDAF7",300:"#B2C8F3",400:"#99B5EF",500:"#6691E8",600:"#336CE0",700:"#0047D8",800:"#0039AD",900:"#002B82"},Violet:{100:"#EDECFC",200:"#DCDAFA",300:"#CAC7F7",400:"#B9B5F5",500:"#9690EF",600:"#736BEA",700:"#5046E5",800:"#4038B8",900:"#191547",950:"#110E30"},Yellow:{100:"#FEF8E9",200:"#FDF1D3",300:"#FCEABD",400:"#FBE3A7",500:"#FAD67C",600:"#F8C850",700:"#F6BA24",800:"#ECAD11",900:"#CE960A"},Red:{100:"#FFEBEB",200:"#FFD6D6",300:"#FFC2C2",400:"#FFADAD",500:"#FF8585",600:"#FF5C5C",700:"#FF3333",800:"#CE2929",900:"#9D1F1F"},Green:{100:"#EBFAF1",200:"#D7F4E4",300:"#AFE9C8",400:"#87DFAD",500:"#5FD491",600:"#5FD491",700:"#2CA15E",800:"#217947",900:"#16502F"},Orange:{100:"#FFF4EB",200:"#FFE9D6",300:"#FFDEC2",400:"#FFD3AE",500:"#FFBD85",600:"#FFA75D",700:"#FF9134",800:"#E8842F",900:"#DF771E"},Cyan:{100:"#E8F6FF",200:"#DCF2FF",300:"#C4E9FF",400:"#A0DAFF",500:"#87D1FF",600:"#56BFFF",700:"#1DA6FB",800:"#0B89D6",900:"#0467A4"},TypeScale:{Weight:{Regular:"Regular",Bold:"Bold",SemiBold:"Semibold"},FontFamily:{YekanBakh:"Yekan Bakh FaNum"},Size:{10:10,11:11,12:12,14:14,16:16,18:18,20:20,24:24,28:28,32:32,36:36,48:48,64:64},Height:{10:10,12:12,14:14,16:16,20:20,24:24,28:28,32:32,36:36,40:40,44:44,48:48,74:74}},NumberScale:{Radius:{"Radius-12":12,"Radius-8":8,"Radius-4":4,"Radius-24":24,"Radius-20":20,"Radius-16":16,"Radius-Full":1e3,"Radius-28":28},Spacing:{"spacing-4":4,"spacing-8":8,"spacing-12":12,"spacing-16":16,"spacing-20":20,"spacing-24":24,"spacing-32":32,"spacing-40":40,"spacing-48":48,"spacing-56":56,"spacing-64":64,"spacing-72":72,"spacing-80":80},StrokeWeight:{StrokeWeight1:1,StrokeWeight2:1.5,StrokeWeight4:3,StrokeWeight3:2,StrokeWeight5:4},IconSize:{IconSizesmall:16,IconSizeMedium:20,IconSizeLarge:24,IconSizeExtraLarge:32}},Peach:{100:"#FFEEE5",200:"#FFDDCC",300:"#FFCCB2",400:"#FFBB99",500:"#FF9966",600:"#FF7733",700:"#FF5500",800:"#CC4400",900:"#993300"},Buttons:104,MinWidth:64},d={brand:k};function O(){const n={colors:{},typography:{},spacing:{},radius:{},shadows:{}};if(d.brand&&Object.entries(d.brand).forEach(([t,r])=>{if(typeof r=="object"&&!Array.isArray(r)){const e=t.toLowerCase();n.colors[e]={},Object.entries(r).forEach(([o,i])=>{(typeof i=="string"||typeof i=="number")&&(n.colors[e][o]=i)})}}),d.brand?.TypeScale){const t=d.brand.TypeScale;n.typography={fontFamily:t.FontFamily?.YekanBakh,sizes:t.Size||{},lineHeights:t.Height||{},weights:t.Weight||{}}}if(d.brand?.NumberScale){const t=d.brand.NumberScale;t.Spacing&&(n.spacing={},Object.entries(t.Spacing).forEach(([r,e])=>{const o=r.replace("spacing-","");n.spacing[o]=typeof e=="number"?e:parseInt(e)})),t.Radius&&(n.radius={},Object.entries(t.Radius).forEach(([r,e])=>{const o=r.replace("Radius-","").toLowerCase();n.radius[o]=typeof e=="number"?e:parseInt(e)}))}return n}const w={colors:{primary:{50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1"},neutral:{0:"#FFFFFF",50:"#FAFAFA",100:"#F5F5F5",200:"#EEEEEE",300:"#E0E0E0",400:"#BDBDBD",500:"#9E9E9E",600:"#757575",700:"#616161",800:"#424242",900:"#212121"},success:{50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20"},error:{50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c"},warning:{50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100"},info:{50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1"}},typography:{fontFamily:"system-ui, -apple-system, sans-serif",baseSize:16,minSize:14,scaleRatio:1.25,sizes:{10:10,11:11,12:12,14:14,16:16,18:18,20:20,24:24,28:28,32:32,36:36,48:48,64:64},lineHeights:{10:10,12:12,14:14,16:16,20:20,24:24,28:28,32:32,36:36,40:40,44:44,48:48,74:74},weights:{regular:"400",semibold:"600",bold:"700"}},spacing:{unit:4,4:4,8:8,12:12,16:16,20:20,24:24,32:32,40:40,48:48,56:56,64:64,72:72,80:80},radius:{xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":28,full:1e3},shadows:{sm:"0px 1px 2px rgba(0, 0, 0, 0.05)",md:"0px 4px 6px rgba(0, 0, 0, 0.1)",lg:"0px 10px 15px rgba(0, 0, 0, 0.1)",xl:"0px 20px 25px rgba(0, 0, 0, 0.1)"}};function S(n,t){const r={...n};return E(n)&&E(t)&&Object.keys(t).forEach(e=>{E(t[e])?e in n?r[e]=S(n[e],t[e]):Object.assign(r,{[e]:t[e]}):Object.assign(r,{[e]:t[e]})}),r}function E(n){return n&&typeof n=="object"&&!Array.isArray(n)}const I=O(),b=S(w,I);function C(n={}){return S(b,n)}function x(n={}){const t=C(n),r=document.createElement("style");r.id="ds-theme";let e=`:root {
2
+ `;Object.entries(t.colors).forEach(([s,a])=>{typeof a=="object"&&Object.entries(a).forEach(([m,y])=>{e+=` --${s}-${m}: ${y};
3
+ `})});const o=t.typography;if(e+=` --font-family: ${o.fontFamily};
4
+ `,o.baseSize&&o.minSize){const s=(o.baseSize-o.minSize)/1600,m=`${-320*s+o.minSize}px + ${s*100}vw`;e+=` --font-size-base: clamp(${o.minSize}px, ${m}, ${o.baseSize}px);
5
+ `}else e+=` --font-size-base: ${o.baseSize||16}px;
6
+ `;e+=` --type-scale: ${o.scaleRatio||1.25};
7
+ `,o.sizes&&Object.entries(o.sizes).forEach(([s,a])=>{e+=` --font-size-${s}: ${a}px;
8
+ `}),o.lineHeights&&Object.entries(o.lineHeights).forEach(([s,a])=>{e+=` --line-height-${s}: ${a}px;
9
+ `}),o.weights&&Object.entries(o.weights).forEach(([s,a])=>{e+=` --font-weight-${s}: ${a};
10
+ `});const i=t.spacing.unit||4;e+=` --space-unit: ${i}px;
11
+ `,Object.entries(t.spacing).forEach(([s,a])=>{s!=="unit"&&(e+=` --space-${s}: ${a}px;
12
+ `)}),Object.entries(t.radius).forEach(([s,a])=>{e+=` --radius-${s}: ${a}px;
13
+ `}),t.shadows&&Object.entries(t.shadows).forEach(([s,a])=>{e+=` --shadow-${s}: ${a};
14
14
  `}),e+=`}
15
15
  `,e+=`html { font-size: var(--font-size-base); }
16
16
  `,e+=`body { font-family: var(--font-family); }
17
- `,t.textContent=e;const c=document.getElementById("ds-theme");c&&c.remove(),document.head.appendChild(t)}const x=p.createContext(null);function C({tokens:r={},children:n}){const t=p.useMemo(()=>h(r),[r]);p.useEffect(()=>{E(t)},[t]);const e=p.useMemo(()=>({tokens:t,getToken:s=>{const a=s.split(".");let c=t;for(const o of a)if(c&&typeof c=="object"&&o in c)c=c[o];else return;return c}}),[t]);return S.jsx(x.Provider,{value:e,children:n})}C.propTypes={tokens:u.object,children:u.node.isRequired};function D(){const r=p.useContext(x);return r||(console.warn("useTheme must be used within ThemeProvider. Using default tokens."),{tokens:F,getToken:n=>{const t=n.split(".");let e=F;for(const s of t)if(e&&typeof e=="object"&&s in e)e=e[s];else return;return e}})}function A(){const{tokens:r,getToken:n}=D();return{color:t=>{const e=n(`colors.${t}`);if(e)return e;const[s,a]=t.split(".");return`var(--${s}-${a}, #000)`},spacing:t=>{const e=n(`spacing.${t}`);return e?`${e}px`:`var(--space-${t}, ${t*(r.spacing?.unit||4)}px)`},radius:t=>{const e=n(`radius.${t}`);return e?`${e}px`:`var(--radius-${t}, 8px)`},typography:t=>{const e=n(`typography.${t}`);return e?typeof e=="number"?`${e}px`:e:t==="fontFamily"?"var(--font-family, system-ui, sans-serif)":`var(--font-${t}, 16px)`},shadow:t=>{const e=n(`shadows.${t}`);return e||`var(--shadow-${t}, none)`},tokens:r,getToken:n}}const B=({variant:r="primary",size:n="md",children:t,className:e="",...s})=>{const{color:a,spacing:c,radius:o,typography:i}=A(),l={primary:{backgroundColor:a("primary.500"),color:"#ffffff",border:"none"},outline:{backgroundColor:"transparent",border:`2px solid ${a("primary.500")}`,color:a("primary.500")},text:{backgroundColor:"transparent",border:"none",color:a("primary.500")},secondary:{backgroundColor:a("neutral.200"),color:a("neutral.900"),border:"none"},success:{backgroundColor:a("success.500"),color:"#ffffff",border:"none"},error:{backgroundColor:a("error.500"),color:"#ffffff",border:"none"}},d={sm:{padding:`${c(2)} ${c(4)}`,fontSize:i("sizes.14")||"14px"},md:{padding:`${c(3)} ${c(6)}`,fontSize:i("sizes.16")||"16px"},lg:{padding:`${c(4)} ${c(8)}`,fontSize:i("sizes.18")||"18px"}};return S.jsx("button",{className:`ds-button ds-button--${r} ds-button--${n} ${e}`,style:{borderRadius:o("md"),fontFamily:i("fontFamily"),fontWeight:"500",cursor:"pointer",transition:"all 0.2s ease",...l[r],...d[n],...s.style},onMouseEnter:g=>{r==="primary"&&(g.currentTarget.style.opacity="0.9")},onMouseLeave:g=>{r==="primary"&&(g.currentTarget.style.opacity="1")},...s,children:t})};B.propTypes={children:u.node.isRequired,variant:u.oneOf(["primary","outline","text","secondary","success","error"]),size:u.oneOf(["sm","md","lg"]),className:u.string};function k(r={}){E(r)}const v={};function w(r={}){let n="";Object.entries(r.colors?.primary||{}).forEach(([t,e])=>{n+=`$primary-${t}: ${e};
18
- `}),n+=`$font-family: "${r.typography?.fontFamily||"sans-serif"}";
19
- `,n+=`$font-size-base: ${r.typography?.baseSize||16}px;
20
- `,v.writeFileSync("custom-variables.scss",n)}const O={colors:{primary:m.primary,neutral:m.neutral},spacing:{unit:4},typography:{fontFamily:"system-ui, sans-serif",baseSize:16}};exports.Button=B;exports.ThemeProvider=C;exports.baseTokens=F;exports.createTokens=h;exports.default=C;exports.defaultColors=m;exports.defaultConfig=O;exports.defaultTokens=$;exports.generateSCSS=w;exports.generateTheme=E;exports.injectCSS=k;exports.useTheme=D;exports.useTokens=A;
17
+ `,r.textContent=e;const c=document.getElementById("ds-theme");c&&c.remove(),document.head.appendChild(r)}const z=g.createContext(null);function A({tokens:n={},children:t}){const r=g.useMemo(()=>C(n),[n]);g.useEffect(()=>{x(r)},[r]);const e=g.useMemo(()=>({tokens:r,getToken:o=>{const i=o.split(".");let c=r;for(const s of i)if(c&&typeof c=="object"&&s in c)c=c[s];else return;return c}}),[r]);return D.jsx(z.Provider,{value:e,children:t})}A.propTypes={tokens:p.object,children:p.node.isRequired};function B(){const n=g.useContext(z);return n||(console.warn("useTheme must be used within ThemeProvider. Using default tokens."),{tokens:b,getToken:t=>{const r=t.split(".");let e=b;for(const o of r)if(e&&typeof e=="object"&&o in e)e=e[o];else return;return e}})}function T(){const{tokens:n,getToken:t}=B();return{color:r=>{const e=t(`colors.${r}`);if(e)return e;const[o,i]=r.split(".");return`var(--${o}-${i}, #000)`},spacing:r=>{const e=t(`spacing.${r}`);return e?`${e}px`:`var(--space-${r}, ${r*(n.spacing?.unit||4)}px)`},radius:r=>{const e=t(`radius.${r}`);return e?`${e}px`:`var(--radius-${r}, 8px)`},typography:r=>{const e=t(`typography.${r}`);return e?typeof e=="number"?`${e}px`:e:r==="fontFamily"?"var(--font-family, system-ui, sans-serif)":`var(--font-${r}, 16px)`},shadow:r=>{const e=t(`shadows.${r}`);return e||`var(--shadow-${r}, none)`},tokens:n,getToken:t}}const u={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},l={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function f(n="all",t={}){const{duration:r=l.standard,easing:e=u.easeInOut,delay:o=0}=t;return`${Array.isArray(n)?n.join(", "):n} ${r}ms ${e} ${o}ms`}const F={create:f,easing:u,duration:l,all:n=>f("all",n),color:n=>f(["color","background-color","border-color"],n),backgroundColor:n=>f("background-color",n),opacity:n=>f("opacity",n),transform:n=>f("transform",n),boxShadow:n=>f("box-shadow",n),standard:n=>f("all",{duration:l.standard,easing:u.easeInOut,...n}),enter:n=>f("all",{duration:l.enteringScreen,easing:u.easeOut,...n}),leave:n=>f("all",{duration:l.leavingScreen,easing:u.easeIn,...n})};function v(n="all",t={}){return f(n,t)}const M={fadeIn:{from:{opacity:0},to:{opacity:1}},fadeOut:{from:{opacity:1},to:{opacity:0}},slideUp:{from:{transform:"translateY(20px)",opacity:0},to:{transform:"translateY(0)",opacity:1}},slideDown:{from:{transform:"translateY(-20px)",opacity:0},to:{transform:"translateY(0)",opacity:1}},scaleIn:{from:{transform:"scale(0.8)",opacity:0},to:{transform:"scale(1)",opacity:1}},scaleOut:{from:{transform:"scale(1)",opacity:1},to:{transform:"scale(0.8)",opacity:0}}};function R(n,t={}){const{duration:r=l.standard,easing:e=u.easeInOut,delay:o=0,iterationCount:i=1,direction:c="normal",fillMode:s="both"}=t;return`${n} ${r}ms ${e} ${o}ms ${i} ${c} ${s}`}const j=({variant:n="primary",size:t="md",children:r,className:e="",...o})=>{const{color:i,spacing:c,radius:s,typography:a}=T(),m={primary:{backgroundColor:i("primary.500"),color:"#ffffff",border:"none"},outline:{backgroundColor:"transparent",border:`2px solid ${i("primary.500")}`,color:i("primary.500")},text:{backgroundColor:"transparent",border:"none",color:i("primary.500")},secondary:{backgroundColor:i("neutral.200"),color:i("neutral.900"),border:"none"},success:{backgroundColor:i("success.500"),color:"#ffffff",border:"none"},error:{backgroundColor:i("error.500"),color:"#ffffff",border:"none"}},y={sm:{padding:`${c(2)} ${c(4)}`,fontSize:a("sizes.14")||"14px"},md:{padding:`${c(3)} ${c(6)}`,fontSize:a("sizes.16")||"16px"},lg:{padding:`${c(4)} ${c(8)}`,fontSize:a("sizes.18")||"18px"}};return D.jsx("button",{className:`ds-button ds-button--${n} ds-button--${t} ${e}`,style:{borderRadius:s("md"),fontFamily:a("fontFamily"),fontWeight:"500",cursor:"pointer",transition:F.standard({duration:200}),...m[n],...y[t],...o.style},onMouseEnter:h=>{n==="primary"&&(h.currentTarget.style.opacity="0.9")},onMouseLeave:h=>{n==="primary"&&(h.currentTarget.style.opacity="1")},...o,children:r})};j.propTypes={children:p.node.isRequired,variant:p.oneOf(["primary","outline","text","secondary","success","error"]),size:p.oneOf(["sm","md","lg"]),className:p.string};function U(n={}){if(typeof window<"u"&&(window.MUI||window.mui))try{return{create:window.MUI?.transitions?.create||F.create,easing:window.MUI?.transitions?.easing||F.easing,duration:window.MUI?.transitions?.duration||F.duration,useMUI:!0}}catch{}return{...F,useMUI:!1}}function W(){if(typeof window<"u"&&(window.MUI||window.mui))try{return window.MUI?.theme||window.mui?.theme||null}catch{return null}return null}function N(n={}){x(n)}const P={};function Y(n={}){let t="";Object.entries(n.colors?.primary||{}).forEach(([r,e])=>{t+=`$primary-${r}: ${e};
18
+ `}),t+=`$font-family: "${n.typography?.fontFamily||"sans-serif"}";
19
+ `,t+=`$font-size-base: ${n.typography?.baseSize||16}px;
20
+ `,P.writeFileSync("custom-variables.scss",t)}const H={colors:{primary:$.primary,neutral:$.neutral},spacing:{unit:4},typography:{fontFamily:"system-ui, sans-serif",baseSize:16}};exports.Button=j;exports.ThemeProvider=A;exports.baseTokens=b;exports.createAnimation=R;exports.createTokens=C;exports.createTransition=f;exports.default=A;exports.defaultColors=$;exports.defaultConfig=H;exports.defaultTokens=w;exports.duration=l;exports.easing=u;exports.generateSCSS=Y;exports.generateTheme=x;exports.injectCSS=N;exports.keyframes=M;exports.transitions=F;exports.useMUITheme=W;exports.useMUITransitions=U;exports.useTheme=B;exports.useTokens=T;exports.useTransition=v;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { jsx as E } from "react/jsx-runtime";
2
- import { createContext as S, useMemo as b, useEffect as x, useContext as D } from "react";
3
- import p from "prop-types";
4
- const y = {
1
+ import { jsx as S } from "react/jsx-runtime";
2
+ import { createContext as w, useMemo as $, useEffect as z, useContext as B } from "react";
3
+ import l from "prop-types";
4
+ const C = {
5
5
  neutral: {
6
6
  0: "#FFFFFF",
7
7
  50: "#FAFAFA"
@@ -10,46 +10,46 @@ const y = {
10
10
  50: "#e3f2fd",
11
11
  500: "#2196f3"
12
12
  }
13
- }, A = { Neutral: { 0: "#FFFFFF", 50: "#FAFAFA", 100: "#F4F4F5", 200: "#EAEAEB", 300: "#D4D5D6", 400: "#AAABAD", 500: "#7F8185", 600: "#55575C", 700: "#2A2D33", 800: "#232529", 900: "#1B1D21" }, Purple: { 100: "#F9F2FD", 200: "#E6D9EC", 300: "#D9C5E2", 400: "#B38CC5", 500: "#9A65B2", 600: "#813F9F", 700: "#67327F", 800: "#4D265F", 900: "#341940" }, Blue: { 100: "#E5EDFB", 200: "#CCDAF7", 300: "#B2C8F3", 400: "#99B5EF", 500: "#6691E8", 600: "#336CE0", 700: "#0047D8", 800: "#0039AD", 900: "#002B82" }, Violet: { 100: "#EDECFC", 200: "#DCDAFA", 300: "#CAC7F7", 400: "#B9B5F5", 500: "#9690EF", 600: "#736BEA", 700: "#5046E5", 800: "#4038B8", 900: "#191547", 950: "#110E30" }, Yellow: { 100: "#FEF8E9", 200: "#FDF1D3", 300: "#FCEABD", 400: "#FBE3A7", 500: "#FAD67C", 600: "#F8C850", 700: "#F6BA24", 800: "#ECAD11", 900: "#CE960A" }, Red: { 100: "#FFEBEB", 200: "#FFD6D6", 300: "#FFC2C2", 400: "#FFADAD", 500: "#FF8585", 600: "#FF5C5C", 700: "#FF3333", 800: "#CE2929", 900: "#9D1F1F" }, Green: { 100: "#EBFAF1", 200: "#D7F4E4", 300: "#AFE9C8", 400: "#87DFAD", 500: "#5FD491", 600: "#5FD491", 700: "#2CA15E", 800: "#217947", 900: "#16502F" }, Orange: { 100: "#FFF4EB", 200: "#FFE9D6", 300: "#FFDEC2", 400: "#FFD3AE", 500: "#FFBD85", 600: "#FFA75D", 700: "#FF9134", 800: "#E8842F", 900: "#DF771E" }, Cyan: { 100: "#E8F6FF", 200: "#DCF2FF", 300: "#C4E9FF", 400: "#A0DAFF", 500: "#87D1FF", 600: "#56BFFF", 700: "#1DA6FB", 800: "#0B89D6", 900: "#0467A4" }, TypeScale: { Weight: { Regular: "Regular", Bold: "Bold", SemiBold: "Semibold" }, FontFamily: { YekanBakh: "Yekan Bakh FaNum" }, Size: { 10: 10, 11: 11, 12: 12, 14: 14, 16: 16, 18: 18, 20: 20, 24: 24, 28: 28, 32: 32, 36: 36, 48: 48, 64: 64 }, Height: { 10: 10, 12: 12, 14: 14, 16: 16, 20: 20, 24: 24, 28: 28, 32: 32, 36: 36, 40: 40, 44: 44, 48: 48, 74: 74 } }, NumberScale: { Radius: { "Radius-12": 12, "Radius-8": 8, "Radius-4": 4, "Radius-24": 24, "Radius-20": 20, "Radius-16": 16, "Radius-Full": 1e3, "Radius-28": 28 }, Spacing: { "spacing-4": 4, "spacing-8": 8, "spacing-12": 12, "spacing-16": 16, "spacing-20": 20, "spacing-24": 24, "spacing-32": 32, "spacing-40": 40, "spacing-48": 48, "spacing-56": 56, "spacing-64": 64, "spacing-72": 72, "spacing-80": 80 }, StrokeWeight: { StrokeWeight1: 1, StrokeWeight2: 1.5, StrokeWeight4: 3, StrokeWeight3: 2, StrokeWeight5: 4 }, IconSize: { IconSizesmall: 16, IconSizeMedium: 20, IconSizeLarge: 24, IconSizeExtraLarge: 32 } }, Peach: { 100: "#FFEEE5", 200: "#FFDDCC", 300: "#FFCCB2", 400: "#FFBB99", 500: "#FF9966", 600: "#FF7733", 700: "#FF5500", 800: "#CC4400", 900: "#993300" }, Buttons: 104, MinWidth: 64 }, f = {
14
- brand: A
13
+ }, O = { Neutral: { 0: "#FFFFFF", 50: "#FAFAFA", 100: "#F4F4F5", 200: "#EAEAEB", 300: "#D4D5D6", 400: "#AAABAD", 500: "#7F8185", 600: "#55575C", 700: "#2A2D33", 800: "#232529", 900: "#1B1D21" }, Purple: { 100: "#F9F2FD", 200: "#E6D9EC", 300: "#D9C5E2", 400: "#B38CC5", 500: "#9A65B2", 600: "#813F9F", 700: "#67327F", 800: "#4D265F", 900: "#341940" }, Blue: { 100: "#E5EDFB", 200: "#CCDAF7", 300: "#B2C8F3", 400: "#99B5EF", 500: "#6691E8", 600: "#336CE0", 700: "#0047D8", 800: "#0039AD", 900: "#002B82" }, Violet: { 100: "#EDECFC", 200: "#DCDAFA", 300: "#CAC7F7", 400: "#B9B5F5", 500: "#9690EF", 600: "#736BEA", 700: "#5046E5", 800: "#4038B8", 900: "#191547", 950: "#110E30" }, Yellow: { 100: "#FEF8E9", 200: "#FDF1D3", 300: "#FCEABD", 400: "#FBE3A7", 500: "#FAD67C", 600: "#F8C850", 700: "#F6BA24", 800: "#ECAD11", 900: "#CE960A" }, Red: { 100: "#FFEBEB", 200: "#FFD6D6", 300: "#FFC2C2", 400: "#FFADAD", 500: "#FF8585", 600: "#FF5C5C", 700: "#FF3333", 800: "#CE2929", 900: "#9D1F1F" }, Green: { 100: "#EBFAF1", 200: "#D7F4E4", 300: "#AFE9C8", 400: "#87DFAD", 500: "#5FD491", 600: "#5FD491", 700: "#2CA15E", 800: "#217947", 900: "#16502F" }, Orange: { 100: "#FFF4EB", 200: "#FFE9D6", 300: "#FFDEC2", 400: "#FFD3AE", 500: "#FFBD85", 600: "#FFA75D", 700: "#FF9134", 800: "#E8842F", 900: "#DF771E" }, Cyan: { 100: "#E8F6FF", 200: "#DCF2FF", 300: "#C4E9FF", 400: "#A0DAFF", 500: "#87D1FF", 600: "#56BFFF", 700: "#1DA6FB", 800: "#0B89D6", 900: "#0467A4" }, TypeScale: { Weight: { Regular: "Regular", Bold: "Bold", SemiBold: "Semibold" }, FontFamily: { YekanBakh: "Yekan Bakh FaNum" }, Size: { 10: 10, 11: 11, 12: 12, 14: 14, 16: 16, 18: 18, 20: 20, 24: 24, 28: 28, 32: 32, 36: 36, 48: 48, 64: 64 }, Height: { 10: 10, 12: 12, 14: 14, 16: 16, 20: 20, 24: 24, 28: 28, 32: 32, 36: 36, 40: 40, 44: 44, 48: 48, 74: 74 } }, NumberScale: { Radius: { "Radius-12": 12, "Radius-8": 8, "Radius-4": 4, "Radius-24": 24, "Radius-20": 20, "Radius-16": 16, "Radius-Full": 1e3, "Radius-28": 28 }, Spacing: { "spacing-4": 4, "spacing-8": 8, "spacing-12": 12, "spacing-16": 16, "spacing-20": 20, "spacing-24": 24, "spacing-32": 32, "spacing-40": 40, "spacing-48": 48, "spacing-56": 56, "spacing-64": 64, "spacing-72": 72, "spacing-80": 80 }, StrokeWeight: { StrokeWeight1: 1, StrokeWeight2: 1.5, StrokeWeight4: 3, StrokeWeight3: 2, StrokeWeight5: 4 }, IconSize: { IconSizesmall: 16, IconSizeMedium: 20, IconSizeLarge: 24, IconSizeExtraLarge: 32 } }, Peach: { 100: "#FFEEE5", 200: "#FFDDCC", 300: "#FFCCB2", 400: "#FFBB99", 500: "#FF9966", 600: "#FF7733", 700: "#FF5500", 800: "#CC4400", 900: "#993300" }, Buttons: 104, MinWidth: 64 }, u = {
14
+ brand: O
15
15
  };
16
- function z() {
17
- const r = {
16
+ function j() {
17
+ const n = {
18
18
  colors: {},
19
19
  typography: {},
20
20
  spacing: {},
21
21
  radius: {},
22
22
  shadows: {}
23
23
  };
24
- if (f.brand && Object.entries(f.brand).forEach(([n, t]) => {
25
- if (typeof t == "object" && !Array.isArray(t)) {
26
- const e = n.toLowerCase();
27
- r.colors[e] = {}, Object.entries(t).forEach(([o, a]) => {
28
- (typeof a == "string" || typeof a == "number") && (r.colors[e][o] = a);
24
+ if (u.brand && Object.entries(u.brand).forEach(([t, r]) => {
25
+ if (typeof r == "object" && !Array.isArray(r)) {
26
+ const e = t.toLowerCase();
27
+ n.colors[e] = {}, Object.entries(r).forEach(([o, a]) => {
28
+ (typeof a == "string" || typeof a == "number") && (n.colors[e][o] = a);
29
29
  });
30
30
  }
31
- }), f.brand?.TypeScale) {
32
- const n = f.brand.TypeScale;
33
- r.typography = {
34
- fontFamily: n.FontFamily?.YekanBakh,
35
- sizes: n.Size || {},
36
- lineHeights: n.Height || {},
37
- weights: n.Weight || {}
31
+ }), u.brand?.TypeScale) {
32
+ const t = u.brand.TypeScale;
33
+ n.typography = {
34
+ fontFamily: t.FontFamily?.YekanBakh,
35
+ sizes: t.Size || {},
36
+ lineHeights: t.Height || {},
37
+ weights: t.Weight || {}
38
38
  };
39
39
  }
40
- if (f.brand?.NumberScale) {
41
- const n = f.brand.NumberScale;
42
- n.Spacing && (r.spacing = {}, Object.entries(n.Spacing).forEach(([t, e]) => {
43
- const o = t.replace("spacing-", "");
44
- r.spacing[o] = typeof e == "number" ? e : parseInt(e);
45
- })), n.Radius && (r.radius = {}, Object.entries(n.Radius).forEach(([t, e]) => {
46
- const o = t.replace("Radius-", "").toLowerCase();
47
- r.radius[o] = typeof e == "number" ? e : parseInt(e);
40
+ if (u.brand?.NumberScale) {
41
+ const t = u.brand.NumberScale;
42
+ t.Spacing && (n.spacing = {}, Object.entries(t.Spacing).forEach(([r, e]) => {
43
+ const o = r.replace("spacing-", "");
44
+ n.spacing[o] = typeof e == "number" ? e : parseInt(e);
45
+ })), t.Radius && (n.radius = {}, Object.entries(t.Radius).forEach(([r, e]) => {
46
+ const o = r.replace("Radius-", "").toLowerCase();
47
+ n.radius[o] = typeof e == "number" ? e : parseInt(e);
48
48
  }));
49
49
  }
50
- return r;
50
+ return n;
51
51
  }
52
- const B = {
52
+ const T = {
53
53
  colors: {
54
54
  primary: {
55
55
  50: "#e3f2fd",
@@ -199,101 +199,101 @@ const B = {
199
199
  xl: "0px 20px 25px rgba(0, 0, 0, 0.1)"
200
200
  }
201
201
  };
202
- function m(r, n) {
203
- const t = { ...r };
204
- return d(r) && d(n) && Object.keys(n).forEach((e) => {
205
- d(n[e]) ? e in r ? t[e] = m(r[e], n[e]) : Object.assign(t, { [e]: n[e] }) : Object.assign(t, { [e]: n[e] });
206
- }), t;
202
+ function E(n, t) {
203
+ const r = { ...n };
204
+ return b(n) && b(t) && Object.keys(t).forEach((e) => {
205
+ b(t[e]) ? e in n ? r[e] = E(n[e], t[e]) : Object.assign(r, { [e]: t[e] }) : Object.assign(r, { [e]: t[e] });
206
+ }), r;
207
207
  }
208
- function d(r) {
209
- return r && typeof r == "object" && !Array.isArray(r);
208
+ function b(n) {
209
+ return n && typeof n == "object" && !Array.isArray(n);
210
210
  }
211
- const j = z(), g = m(B, j);
212
- function h(r = {}) {
213
- return m(g, r);
211
+ const k = j(), h = E(T, k);
212
+ function x(n = {}) {
213
+ return E(h, n);
214
214
  }
215
- function $(r = {}) {
216
- const n = h(r), t = document.createElement("style");
217
- t.id = "ds-theme";
215
+ function D(n = {}) {
216
+ const t = x(n), r = document.createElement("style");
217
+ r.id = "ds-theme";
218
218
  let e = `:root {
219
219
  `;
220
- Object.entries(n.colors).forEach(([s, i]) => {
221
- typeof i == "object" && Object.entries(i).forEach(([F, l]) => {
222
- e += ` --${s}-${F}: ${l};
220
+ Object.entries(t.colors).forEach(([i, s]) => {
221
+ typeof s == "object" && Object.entries(s).forEach(([F, g]) => {
222
+ e += ` --${i}-${F}: ${g};
223
223
  `;
224
224
  });
225
225
  });
226
- const o = n.typography;
226
+ const o = t.typography;
227
227
  if (e += ` --font-family: ${o.fontFamily};
228
228
  `, o.baseSize && o.minSize) {
229
- const s = (o.baseSize - o.minSize) / 1600, F = `${-320 * s + o.minSize}px + ${s * 100}vw`;
229
+ const i = (o.baseSize - o.minSize) / 1600, F = `${-320 * i + o.minSize}px + ${i * 100}vw`;
230
230
  e += ` --font-size-base: clamp(${o.minSize}px, ${F}, ${o.baseSize}px);
231
231
  `;
232
232
  } else
233
233
  e += ` --font-size-base: ${o.baseSize || 16}px;
234
234
  `;
235
235
  e += ` --type-scale: ${o.scaleRatio || 1.25};
236
- `, o.sizes && Object.entries(o.sizes).forEach(([s, i]) => {
237
- e += ` --font-size-${s}: ${i}px;
236
+ `, o.sizes && Object.entries(o.sizes).forEach(([i, s]) => {
237
+ e += ` --font-size-${i}: ${s}px;
238
238
  `;
239
- }), o.lineHeights && Object.entries(o.lineHeights).forEach(([s, i]) => {
240
- e += ` --line-height-${s}: ${i}px;
239
+ }), o.lineHeights && Object.entries(o.lineHeights).forEach(([i, s]) => {
240
+ e += ` --line-height-${i}: ${s}px;
241
241
  `;
242
- }), o.weights && Object.entries(o.weights).forEach(([s, i]) => {
243
- e += ` --font-weight-${s}: ${i};
242
+ }), o.weights && Object.entries(o.weights).forEach(([i, s]) => {
243
+ e += ` --font-weight-${i}: ${s};
244
244
  `;
245
245
  });
246
- const a = n.spacing.unit || 4;
246
+ const a = t.spacing.unit || 4;
247
247
  e += ` --space-unit: ${a}px;
248
- `, Object.entries(n.spacing).forEach(([s, i]) => {
249
- s !== "unit" && (e += ` --space-${s}: ${i}px;
248
+ `, Object.entries(t.spacing).forEach(([i, s]) => {
249
+ i !== "unit" && (e += ` --space-${i}: ${s}px;
250
250
  `);
251
- }), Object.entries(n.radius).forEach(([s, i]) => {
252
- e += ` --radius-${s}: ${i}px;
251
+ }), Object.entries(t.radius).forEach(([i, s]) => {
252
+ e += ` --radius-${i}: ${s}px;
253
253
  `;
254
- }), n.shadows && Object.entries(n.shadows).forEach(([s, i]) => {
255
- e += ` --shadow-${s}: ${i};
254
+ }), t.shadows && Object.entries(t.shadows).forEach(([i, s]) => {
255
+ e += ` --shadow-${i}: ${s};
256
256
  `;
257
257
  }), e += `}
258
258
  `, e += `html { font-size: var(--font-size-base); }
259
259
  `, e += `body { font-family: var(--font-family); }
260
- `, t.textContent = e;
260
+ `, r.textContent = e;
261
261
  const c = document.getElementById("ds-theme");
262
- c && c.remove(), document.head.appendChild(t);
262
+ c && c.remove(), document.head.appendChild(r);
263
263
  }
264
- const C = S(null);
265
- function T({ tokens: r = {}, children: n }) {
266
- const t = b(() => h(r), [r]);
267
- x(() => {
268
- $(t);
269
- }, [t]);
270
- const e = b(() => ({
271
- tokens: t,
264
+ const A = w(null);
265
+ function I({ tokens: n = {}, children: t }) {
266
+ const r = $(() => x(n), [n]);
267
+ z(() => {
268
+ D(r);
269
+ }, [r]);
270
+ const e = $(() => ({
271
+ tokens: r,
272
272
  getToken: (o) => {
273
273
  const a = o.split(".");
274
- let c = t;
275
- for (const s of a)
276
- if (c && typeof c == "object" && s in c)
277
- c = c[s];
274
+ let c = r;
275
+ for (const i of a)
276
+ if (c && typeof c == "object" && i in c)
277
+ c = c[i];
278
278
  else
279
279
  return;
280
280
  return c;
281
281
  }
282
- }), [t]);
283
- return /* @__PURE__ */ E(C.Provider, { value: e, children: n });
282
+ }), [r]);
283
+ return /* @__PURE__ */ S(A.Provider, { value: e, children: t });
284
284
  }
285
- T.propTypes = {
286
- tokens: p.object,
287
- children: p.node.isRequired
285
+ I.propTypes = {
286
+ tokens: l.object,
287
+ children: l.node.isRequired
288
288
  };
289
- function k() {
290
- const r = D(C);
291
- return r || (console.warn("useTheme must be used within ThemeProvider. Using default tokens."), {
292
- tokens: g,
293
- getToken: (n) => {
294
- const t = n.split(".");
295
- let e = g;
296
- for (const o of t)
289
+ function v() {
290
+ const n = B(A);
291
+ return n || (console.warn("useTheme must be used within ThemeProvider. Using default tokens."), {
292
+ tokens: h,
293
+ getToken: (t) => {
294
+ const r = t.split(".");
295
+ let e = h;
296
+ for (const o of r)
297
297
  if (e && typeof e == "object" && o in e)
298
298
  e = e[o];
299
299
  else
@@ -302,18 +302,18 @@ function k() {
302
302
  }
303
303
  });
304
304
  }
305
- function w() {
306
- const { tokens: r, getToken: n } = k();
305
+ function R() {
306
+ const { tokens: n, getToken: t } = v();
307
307
  return {
308
308
  /**
309
309
  * دریافت رنگ
310
310
  * @param {string} path - مسیر رنگ مثل 'primary.500' یا 'neutral.100'
311
311
  * @returns {string} مقدار رنگ
312
312
  */
313
- color: (t) => {
314
- const e = n(`colors.${t}`);
313
+ color: (r) => {
314
+ const e = t(`colors.${r}`);
315
315
  if (e) return e;
316
- const [o, a] = t.split(".");
316
+ const [o, a] = r.split(".");
317
317
  return `var(--${o}-${a}, #000)`;
318
318
  },
319
319
  /**
@@ -321,49 +321,142 @@ function w() {
321
321
  * @param {string|number} key - کلید spacing مثل '4' یا 'sm'
322
322
  * @returns {string} مقدار spacing با واحد px
323
323
  */
324
- spacing: (t) => {
325
- const e = n(`spacing.${t}`);
326
- return e ? `${e}px` : `var(--space-${t}, ${t * (r.spacing?.unit || 4)}px)`;
324
+ spacing: (r) => {
325
+ const e = t(`spacing.${r}`);
326
+ return e ? `${e}px` : `var(--space-${r}, ${r * (n.spacing?.unit || 4)}px)`;
327
327
  },
328
328
  /**
329
329
  * دریافت radius
330
330
  * @param {string} key - کلید radius مثل 'md' یا 'lg'
331
331
  * @returns {string} مقدار radius با واحد px
332
332
  */
333
- radius: (t) => {
334
- const e = n(`radius.${t}`);
335
- return e ? `${e}px` : `var(--radius-${t}, 8px)`;
333
+ radius: (r) => {
334
+ const e = t(`radius.${r}`);
335
+ return e ? `${e}px` : `var(--radius-${r}, 8px)`;
336
336
  },
337
337
  /**
338
338
  * دریافت typography
339
339
  * @param {string} property - ویژگی typography مثل 'fontFamily', 'sizes.16'
340
340
  * @returns {string|number} مقدار typography
341
341
  */
342
- typography: (t) => {
343
- const e = n(`typography.${t}`);
344
- return e ? typeof e == "number" ? `${e}px` : e : t === "fontFamily" ? "var(--font-family, system-ui, sans-serif)" : `var(--font-${t}, 16px)`;
342
+ typography: (r) => {
343
+ const e = t(`typography.${r}`);
344
+ return e ? typeof e == "number" ? `${e}px` : e : r === "fontFamily" ? "var(--font-family, system-ui, sans-serif)" : `var(--font-${r}, 16px)`;
345
345
  },
346
346
  /**
347
347
  * دریافت shadow
348
348
  * @param {string} key - کلید shadow مثل 'sm' یا 'md'
349
349
  * @returns {string} مقدار shadow
350
350
  */
351
- shadow: (t) => {
352
- const e = n(`shadows.${t}`);
353
- return e || `var(--shadow-${t}, none)`;
351
+ shadow: (r) => {
352
+ const e = t(`shadows.${r}`);
353
+ return e || `var(--shadow-${r}, none)`;
354
354
  },
355
355
  /**
356
356
  * دسترسی مستقیم به توکن‌ها
357
357
  */
358
- tokens: r,
358
+ tokens: n,
359
359
  /**
360
360
  * دریافت توکن با مسیر دلخواه
361
361
  */
362
- getToken: n
362
+ getToken: t
363
363
  };
364
364
  }
365
- const O = ({ variant: r = "primary", size: n = "md", children: t, className: e = "", ...o }) => {
366
- const { color: a, spacing: c, radius: s, typography: i } = w(), F = {
365
+ const d = {
366
+ // MUI-compatible easing functions
367
+ easeInOut: "cubic-bezier(0.4, 0, 0.2, 1)",
368
+ easeOut: "cubic-bezier(0.0, 0, 0.2, 1)",
369
+ easeIn: "cubic-bezier(0.4, 0, 1, 1)",
370
+ sharp: "cubic-bezier(0.4, 0, 0.6, 1)"
371
+ }, p = {
372
+ shortest: 150,
373
+ shorter: 200,
374
+ short: 250,
375
+ standard: 300,
376
+ complex: 375,
377
+ enteringScreen: 225,
378
+ leavingScreen: 195
379
+ };
380
+ function f(n = "all", t = {}) {
381
+ const {
382
+ duration: r = p.standard,
383
+ easing: e = d.easeInOut,
384
+ delay: o = 0
385
+ } = t;
386
+ return `${Array.isArray(n) ? n.join(", ") : n} ${r}ms ${e} ${o}ms`;
387
+ }
388
+ const m = {
389
+ // Standard transitions
390
+ create: f,
391
+ // Common transitions
392
+ easing: d,
393
+ duration: p,
394
+ // Preset transitions
395
+ all: (n) => f("all", n),
396
+ color: (n) => f(["color", "background-color", "border-color"], n),
397
+ backgroundColor: (n) => f("background-color", n),
398
+ opacity: (n) => f("opacity", n),
399
+ transform: (n) => f("transform", n),
400
+ boxShadow: (n) => f("box-shadow", n),
401
+ // Complex transitions
402
+ standard: (n) => f("all", {
403
+ duration: p.standard,
404
+ easing: d.easeInOut,
405
+ ...n
406
+ }),
407
+ enter: (n) => f("all", {
408
+ duration: p.enteringScreen,
409
+ easing: d.easeOut,
410
+ ...n
411
+ }),
412
+ leave: (n) => f("all", {
413
+ duration: p.leavingScreen,
414
+ easing: d.easeIn,
415
+ ...n
416
+ })
417
+ };
418
+ function P(n = "all", t = {}) {
419
+ return f(n, t);
420
+ }
421
+ const H = {
422
+ fadeIn: {
423
+ from: { opacity: 0 },
424
+ to: { opacity: 1 }
425
+ },
426
+ fadeOut: {
427
+ from: { opacity: 1 },
428
+ to: { opacity: 0 }
429
+ },
430
+ slideUp: {
431
+ from: { transform: "translateY(20px)", opacity: 0 },
432
+ to: { transform: "translateY(0)", opacity: 1 }
433
+ },
434
+ slideDown: {
435
+ from: { transform: "translateY(-20px)", opacity: 0 },
436
+ to: { transform: "translateY(0)", opacity: 1 }
437
+ },
438
+ scaleIn: {
439
+ from: { transform: "scale(0.8)", opacity: 0 },
440
+ to: { transform: "scale(1)", opacity: 1 }
441
+ },
442
+ scaleOut: {
443
+ from: { transform: "scale(1)", opacity: 1 },
444
+ to: { transform: "scale(0.8)", opacity: 0 }
445
+ }
446
+ };
447
+ function L(n, t = {}) {
448
+ const {
449
+ duration: r = p.standard,
450
+ easing: e = d.easeInOut,
451
+ delay: o = 0,
452
+ iterationCount: a = 1,
453
+ direction: c = "normal",
454
+ fillMode: i = "both"
455
+ } = t;
456
+ return `${n} ${r}ms ${e} ${o}ms ${a} ${c} ${i}`;
457
+ }
458
+ const M = ({ variant: n = "primary", size: t = "md", children: r, className: e = "", ...o }) => {
459
+ const { color: a, spacing: c, radius: i, typography: s } = R(), F = {
367
460
  primary: {
368
461
  backgroundColor: a("primary.500"),
369
462
  color: "#ffffff",
@@ -394,85 +487,119 @@ const O = ({ variant: r = "primary", size: n = "md", children: t, className: e =
394
487
  color: "#ffffff",
395
488
  border: "none"
396
489
  }
397
- }, l = {
490
+ }, g = {
398
491
  sm: {
399
492
  padding: `${c(2)} ${c(4)}`,
400
- fontSize: i("sizes.14") || "14px"
493
+ fontSize: s("sizes.14") || "14px"
401
494
  },
402
495
  md: {
403
496
  padding: `${c(3)} ${c(6)}`,
404
- fontSize: i("sizes.16") || "16px"
497
+ fontSize: s("sizes.16") || "16px"
405
498
  },
406
499
  lg: {
407
500
  padding: `${c(4)} ${c(8)}`,
408
- fontSize: i("sizes.18") || "18px"
501
+ fontSize: s("sizes.18") || "18px"
409
502
  }
410
503
  };
411
- return /* @__PURE__ */ E(
504
+ return /* @__PURE__ */ S(
412
505
  "button",
413
506
  {
414
- className: `ds-button ds-button--${r} ds-button--${n} ${e}`,
507
+ className: `ds-button ds-button--${n} ds-button--${t} ${e}`,
415
508
  style: {
416
- borderRadius: s("md"),
417
- fontFamily: i("fontFamily"),
509
+ borderRadius: i("md"),
510
+ fontFamily: s("fontFamily"),
418
511
  fontWeight: "500",
419
512
  cursor: "pointer",
420
- transition: "all 0.2s ease",
421
- ...F[r],
422
- ...l[n],
513
+ transition: m.standard({ duration: 200 }),
514
+ ...F[n],
515
+ ...g[t],
423
516
  ...o.style
424
517
  },
425
- onMouseEnter: (u) => {
426
- r === "primary" && (u.currentTarget.style.opacity = "0.9");
518
+ onMouseEnter: (y) => {
519
+ n === "primary" && (y.currentTarget.style.opacity = "0.9");
427
520
  },
428
- onMouseLeave: (u) => {
429
- r === "primary" && (u.currentTarget.style.opacity = "1");
521
+ onMouseLeave: (y) => {
522
+ n === "primary" && (y.currentTarget.style.opacity = "1");
430
523
  },
431
524
  ...o,
432
- children: t
525
+ children: r
433
526
  }
434
527
  );
435
528
  };
436
- O.propTypes = {
437
- children: p.node.isRequired,
438
- variant: p.oneOf(["primary", "outline", "text", "secondary", "success", "error"]),
439
- size: p.oneOf(["sm", "md", "lg"]),
440
- className: p.string
529
+ M.propTypes = {
530
+ children: l.node.isRequired,
531
+ variant: l.oneOf(["primary", "outline", "text", "secondary", "success", "error"]),
532
+ size: l.oneOf(["sm", "md", "lg"]),
533
+ className: l.string
441
534
  };
442
- function N(r = {}) {
443
- $(r);
535
+ function q(n = {}) {
536
+ if (typeof window < "u" && (window.MUI || window.mui))
537
+ try {
538
+ return {
539
+ create: window.MUI?.transitions?.create || m.create,
540
+ easing: window.MUI?.transitions?.easing || m.easing,
541
+ duration: window.MUI?.transitions?.duration || m.duration,
542
+ useMUI: !0
543
+ };
544
+ } catch {
545
+ }
546
+ return {
547
+ ...m,
548
+ useMUI: !1
549
+ };
550
+ }
551
+ function K() {
552
+ if (typeof window < "u" && (window.MUI || window.mui))
553
+ try {
554
+ return window.MUI?.theme || window.mui?.theme || null;
555
+ } catch {
556
+ return null;
557
+ }
558
+ return null;
444
559
  }
445
- const R = {};
446
- function P(r = {}) {
447
- let n = "";
448
- Object.entries(r.colors?.primary || {}).forEach(([t, e]) => {
449
- n += `$primary-${t}: ${e};
560
+ function V(n = {}) {
561
+ D(n);
562
+ }
563
+ const U = {};
564
+ function G(n = {}) {
565
+ let t = "";
566
+ Object.entries(n.colors?.primary || {}).forEach(([r, e]) => {
567
+ t += `$primary-${r}: ${e};
450
568
  `;
451
- }), n += `$font-family: "${r.typography?.fontFamily || "sans-serif"}";
452
- `, n += `$font-size-base: ${r.typography?.baseSize || 16}px;
453
- `, R.writeFileSync("custom-variables.scss", n);
569
+ }), t += `$font-family: "${n.typography?.fontFamily || "sans-serif"}";
570
+ `, t += `$font-size-base: ${n.typography?.baseSize || 16}px;
571
+ `, U.writeFileSync("custom-variables.scss", t);
454
572
  }
455
- const H = {
573
+ const J = {
456
574
  colors: {
457
- primary: y.primary,
458
- neutral: y.neutral
575
+ primary: C.primary,
576
+ neutral: C.neutral
459
577
  },
460
578
  spacing: { unit: 4 },
461
579
  // 1 = 4px
462
580
  typography: { fontFamily: "system-ui, sans-serif", baseSize: 16 }
463
581
  };
464
582
  export {
465
- O as Button,
466
- T as ThemeProvider,
467
- g as baseTokens,
468
- h as createTokens,
469
- T as default,
470
- y as defaultColors,
471
- H as defaultConfig,
472
- B as defaultTokens,
473
- P as generateSCSS,
474
- $ as generateTheme,
475
- N as injectCSS,
476
- k as useTheme,
477
- w as useTokens
583
+ M as Button,
584
+ I as ThemeProvider,
585
+ h as baseTokens,
586
+ L as createAnimation,
587
+ x as createTokens,
588
+ f as createTransition,
589
+ I as default,
590
+ C as defaultColors,
591
+ J as defaultConfig,
592
+ T as defaultTokens,
593
+ p as duration,
594
+ d as easing,
595
+ G as generateSCSS,
596
+ D as generateTheme,
597
+ V as injectCSS,
598
+ H as keyframes,
599
+ m as transitions,
600
+ K as useMUITheme,
601
+ q as useMUITransitions,
602
+ v as useTheme,
603
+ R as useTokens,
604
+ P as useTransition
478
605
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ali-mohammadi-design-system",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "خنثی و dynamic Design System — tokens از پروژه میاد",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -30,6 +30,14 @@
30
30
  "react": ">=18 <20",
31
31
  "react-dom": ">=18 <20"
32
32
  },
33
+ "peerDependenciesMeta": {
34
+ "@mui/material": {
35
+ "optional": true
36
+ },
37
+ "@mui/system": {
38
+ "optional": true
39
+ }
40
+ },
33
41
  "exports": {
34
42
  ".": {
35
43
  "import": "./dist/index.js",
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { useTokens } from '../../utils/useTokens.js';
4
+ import { transitions } from '../../utils/animations.js';
4
5
 
5
6
  /**
6
7
  * Button Component - کامپوننت دکمه با پشتیبانی از تم
@@ -72,7 +73,7 @@ const Button = ({ variant = 'primary', size = 'md', children, className = '', ..
72
73
  fontFamily: typography('fontFamily'),
73
74
  fontWeight: '500',
74
75
  cursor: 'pointer',
75
- transition: 'all 0.2s ease',
76
+ transition: transitions.standard({ duration: 200 }),
76
77
  ...variantStyles[variant],
77
78
  ...sizeStyles[size],
78
79
  ...props.style,
package/src/index.js CHANGED
@@ -5,6 +5,10 @@ export * from './components/index.js';
5
5
  export { ThemeProvider, useTheme } from './theme/ThemeProvider.jsx';
6
6
  export { useTokens } from './utils/useTokens.js';
7
7
 
8
+ // Export Animations و Transitions
9
+ export { transitions, easing, duration, keyframes, createTransition, createAnimation, useTransition } from './utils/animations.js';
10
+ export { useMUITransitions, useMUITheme } from './utils/useMUI.js';
11
+
8
12
  // Export توکن‌ها
9
13
  export { defaultTokens, baseTokens, createTokens, defaultColors } from './tokens/index.js';
10
14
 
@@ -0,0 +1,159 @@
1
+ /**
2
+ * Utilities برای animations و transitions
3
+ * اگر MUI موجود باشد از آن استفاده می‌کند، وگرنه از CSS animations استفاده می‌کند
4
+ */
5
+
6
+ // MUI به صورت optional است و در runtime بررسی می‌شود
7
+ // در build time از CSS animations استفاده می‌کنیم
8
+
9
+ /**
10
+ * Easing functions (مشابه MUI)
11
+ * این easing functions مشابه MUI هستند و بدون نیاز به MUI کار می‌کنند
12
+ */
13
+ export const easing = {
14
+ // MUI-compatible easing functions
15
+ easeInOut: 'cubic-bezier(0.4, 0, 0.2, 1)',
16
+ easeOut: 'cubic-bezier(0.0, 0, 0.2, 1)',
17
+ easeIn: 'cubic-bezier(0.4, 0, 1, 1)',
18
+ sharp: 'cubic-bezier(0.4, 0, 0.6, 1)',
19
+ };
20
+
21
+ /**
22
+ * Duration values (مشابه MUI)
23
+ */
24
+ export const duration = {
25
+ shortest: 150,
26
+ shorter: 200,
27
+ short: 250,
28
+ standard: 300,
29
+ complex: 375,
30
+ enteringScreen: 225,
31
+ leavingScreen: 195,
32
+ };
33
+
34
+ /**
35
+ * ایجاد transition string برای CSS
36
+ * @param {string|string[]} props - ویژگی‌هایی که باید transition شوند
37
+ * @param {Object} options - گزینه‌های transition
38
+ * @returns {string} CSS transition string
39
+ */
40
+ export function createTransition(props = 'all', options = {}) {
41
+ const {
42
+ duration: durationOption = duration.standard,
43
+ easing: easingOption = easing.easeInOut,
44
+ delay = 0,
45
+ } = options;
46
+
47
+ const properties = Array.isArray(props) ? props.join(', ') : props;
48
+
49
+ return `${properties} ${durationOption}ms ${easingOption} ${delay}ms`;
50
+ }
51
+
52
+ /**
53
+ * Transition presets (مشابه MUI)
54
+ */
55
+ export const transitions = {
56
+ // Standard transitions
57
+ create: createTransition,
58
+
59
+ // Common transitions
60
+ easing,
61
+ duration,
62
+
63
+ // Preset transitions
64
+ all: (options) => createTransition('all', options),
65
+ color: (options) => createTransition(['color', 'background-color', 'border-color'], options),
66
+ backgroundColor: (options) => createTransition('background-color', options),
67
+ opacity: (options) => createTransition('opacity', options),
68
+ transform: (options) => createTransition('transform', options),
69
+ boxShadow: (options) => createTransition('box-shadow', options),
70
+
71
+ // Complex transitions
72
+ standard: (options) => createTransition('all', {
73
+ duration: duration.standard,
74
+ easing: easing.easeInOut,
75
+ ...options
76
+ }),
77
+
78
+ enter: (options) => createTransition('all', {
79
+ duration: duration.enteringScreen,
80
+ easing: easing.easeOut,
81
+ ...options
82
+ }),
83
+
84
+ leave: (options) => createTransition('all', {
85
+ duration: duration.leavingScreen,
86
+ easing: easing.easeIn,
87
+ ...options
88
+ }),
89
+ };
90
+
91
+ /**
92
+ * Hook برای استفاده از transitions در کامپوننت‌ها
93
+ * @param {string|string[]} props - ویژگی‌هایی که باید transition شوند
94
+ * @param {Object} options - گزینه‌های transition
95
+ * @returns {string} CSS transition string
96
+ */
97
+ export function useTransition(props = 'all', options = {}) {
98
+ return createTransition(props, options);
99
+ }
100
+
101
+ /**
102
+ * Animation keyframes (CSS-based)
103
+ */
104
+ export const keyframes = {
105
+ fadeIn: {
106
+ from: { opacity: 0 },
107
+ to: { opacity: 1 },
108
+ },
109
+ fadeOut: {
110
+ from: { opacity: 1 },
111
+ to: { opacity: 0 },
112
+ },
113
+ slideUp: {
114
+ from: { transform: 'translateY(20px)', opacity: 0 },
115
+ to: { transform: 'translateY(0)', opacity: 1 },
116
+ },
117
+ slideDown: {
118
+ from: { transform: 'translateY(-20px)', opacity: 0 },
119
+ to: { transform: 'translateY(0)', opacity: 1 },
120
+ },
121
+ scaleIn: {
122
+ from: { transform: 'scale(0.8)', opacity: 0 },
123
+ to: { transform: 'scale(1)', opacity: 1 },
124
+ },
125
+ scaleOut: {
126
+ from: { transform: 'scale(1)', opacity: 1 },
127
+ to: { transform: 'scale(0.8)', opacity: 0 },
128
+ },
129
+ };
130
+
131
+ /**
132
+ * ایجاد animation string برای CSS
133
+ * @param {string} name - نام animation
134
+ * @param {Object} options - گزینه‌های animation
135
+ * @returns {string} CSS animation string
136
+ */
137
+ export function createAnimation(name, options = {}) {
138
+ const {
139
+ duration: durationOption = duration.standard,
140
+ easing: easingOption = easing.easeInOut,
141
+ delay = 0,
142
+ iterationCount = 1,
143
+ direction = 'normal',
144
+ fillMode = 'both',
145
+ } = options;
146
+
147
+ return `${name} ${durationOption}ms ${easingOption} ${delay}ms ${iterationCount} ${direction} ${fillMode}`;
148
+ }
149
+
150
+ export default {
151
+ transitions,
152
+ easing,
153
+ duration,
154
+ keyframes,
155
+ createTransition,
156
+ createAnimation,
157
+ useTransition,
158
+ };
159
+
@@ -0,0 +1,4 @@
1
+ export { useTokens } from './useTokens.js';
2
+ export { transitions, easing, duration, keyframes, createTransition, createAnimation, useTransition } from './animations.js';
3
+ export { useMUITransitions, useMUITheme, checkMUIAvailability } from './useMUI.js';
4
+
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Hook برای استفاده اختیاری از MUI
3
+ * اگر MUI موجود باشد از آن استفاده می‌کند، وگرنه fallback می‌کند
4
+ *
5
+ * توجه: این hook فقط در runtime کار می‌کند و MUI باید در پروژه کاربر نصب شده باشد
6
+ */
7
+
8
+ import { transitions } from './animations.js';
9
+
10
+ /**
11
+ * Hook برای استفاده از MUI transitions (اگر موجود باشد)
12
+ * در runtime بررسی می‌کند که آیا MUI در window یا global موجود است
13
+ *
14
+ * @param {Object} options - گزینه‌های transition
15
+ * @returns {Object} Transition utilities
16
+ */
17
+ export function useMUITransitions(options = {}) {
18
+ // در runtime بررسی می‌کنیم
19
+ if (typeof window !== 'undefined') {
20
+ // اگر MUI در window موجود باشد (مثلاً از CDN)
21
+ if (window.MUI || window.mui) {
22
+ try {
23
+ // استفاده از MUI transitions
24
+ return {
25
+ create: window.MUI?.transitions?.create || transitions.create,
26
+ easing: window.MUI?.transitions?.easing || transitions.easing,
27
+ duration: window.MUI?.transitions?.duration || transitions.duration,
28
+ useMUI: true,
29
+ };
30
+ } catch {
31
+ // Fallback
32
+ }
33
+ }
34
+ }
35
+
36
+ // Fallback به animations.js (همیشه کار می‌کند)
37
+ return {
38
+ ...transitions,
39
+ useMUI: false,
40
+ };
41
+ }
42
+
43
+ /**
44
+ * دریافت MUI theme (اگر موجود باشد)
45
+ * این hook فقط در runtime کار می‌کند
46
+ */
47
+ export function useMUITheme() {
48
+ // در runtime بررسی می‌کنیم
49
+ if (typeof window !== 'undefined') {
50
+ // اگر MUI در window موجود باشد
51
+ if (window.MUI || window.mui) {
52
+ try {
53
+ // استفاده از MUI theme
54
+ return window.MUI?.theme || window.mui?.theme || null;
55
+ } catch {
56
+ return null;
57
+ }
58
+ }
59
+ }
60
+
61
+ return null;
62
+ }
63
+
64
+ /**
65
+ * بررسی اینکه آیا MUI در پروژه نصب شده است (برای documentation)
66
+ * این فقط یک helper است و در runtime کار نمی‌کند
67
+ */
68
+ export function checkMUIAvailability() {
69
+ return { available: false, message: 'MUI باید در پروژه کاربر نصب شود' };
70
+ }
71
+
72
+ export default {
73
+ useMUITransitions,
74
+ useMUITheme,
75
+ checkMUIAvailability,
76
+ };
77
+