acinguiux-ds-react-framework 0.1.2 → 0.1.3

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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("./types/layer.js"),S=(u,s,e,t)=>{const r=s.reduce((n,_)=>n==null?void 0:n[_],u);return!(!r||!r[e]||t&&!r[e][t])},c=(u,s,e,t,r,n)=>{const _=o.MODES_BY_PATH[s];if(!S(u[s],t,r,n)){const d=t.findIndex((A,a)=>A!==o.MODES_DEFAULT_VALUES[_[a]]),h=e.findIndex((A,a)=>A!==o.MODES_DEFAULT_VALUES[_[a]]),E=t.map((A,a)=>a===d?o.MODES_DEFAULT_VALUES[_[a]]:a<d&&a>=h&&d!==h?e[a]:A);return c(u,s,e,E,r)}return t.reduce((d,h)=>d[h],u[s])},l=(u,s)=>{const[,e,t]=o.PATH_BY_VARIABLE[u];return e===o.PathKinds.border||e===o.PathKinds.text?s[e][t]:s[e]},L=({variables:u})=>(s={})=>{if(!u)throw new Error("The provided Theme is not supported by the SDS. Please contact the SDS team for support.");const e=Object.values(o.Paths).reduce((t,r)=>({...t,[r]:o.MODES_BY_PATH[r].map(n=>s[n]??o.MODES_DEFAULT_VALUES[n])}),{});return Object.values(o.Variables).reduce((t,r)=>{const[n,_,d]=o.PATH_BY_VARIABLE[r],h=c(u,n,e[n],e[n],_,d),E=l(r,h);return{...t,[r]:E}},{})};exports.themeToLayer=L;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("./types/layer.js"),E=(u,s,r,e)=>{const t=s.reduce((a,l)=>a==null?void 0:a[l],u);return!(!t||!t[r]||e&&!t[r][e])},i=(u,s,r,e,t,a)=>{const l=n.MODES_BY_PATH[s];if(!E(u[s],e,t,a)){const c=e.findIndex((A,o)=>A!==n.MODES_DEFAULT_VALUES[l[o]]),_=r.findIndex((A,o)=>A!==n.MODES_DEFAULT_VALUES[l[o]]),d=e.map((A,o)=>o===c?n.MODES_DEFAULT_VALUES[l[o]]:o<c&&o>=_&&c!==_?r[o]:A);return i(u,s,r,d,t)}return e.reduce((c,_)=>c[_],u[s])},L=(u,s)=>{const[,r,e]=n.PATH_BY_VARIABLE[u];return r===n.PathKinds.border||r===n.PathKinds.text?s[r][e]:s[r]},P=({variables:u})=>(s={})=>{if(!u)return console.warn("Theme variables not available during SSR - using fallback values"),Object.values(n.Variables).reduce((e,t)=>({...e,[t]:"transparent"}),{});const r=Object.values(n.Paths).reduce((e,t)=>({...e,[t]:n.MODES_BY_PATH[t].map(a=>s[a]??n.MODES_DEFAULT_VALUES[a])}),{});return Object.values(n.Variables).reduce((e,t)=>{const[a,l,c]=n.PATH_BY_VARIABLE[t],_=i(u,a,r[a],r[a],l,c),d=L(t,_);return{...e,[t]:d}},{})};exports.themeToLayer=P;
2
2
  //# sourceMappingURL=layer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"layer.js","sources":["../../../../../../react-base/src/theme/layer.ts"],"sourcesContent":["import type { Mode, ThemeInitFn } from './types/theme';\nimport {\n MODES_BY_PATH,\n MODES_DEFAULT_VALUES,\n PATH_BY_VARIABLE,\n Paths,\n PathKinds,\n Variables,\n type LayerFn,\n type VariableValues,\n type ModesType,\n type Modes,\n type VariablePath,\n PathDensityModes,\n PathDensityLayerModes,\n PathLayerModes,\n} from './types/layer';\n\nconst isPathAvailable = (\n obj: object,\n modes: (keyof typeof obj)[],\n searchKey: keyof typeof obj,\n maybeKey?: keyof (typeof obj)[typeof searchKey],\n) => {\n const endPath = modes.reduce((acc, mode) => acc?.[mode], obj);\n\n if (!endPath || !endPath[searchKey] || (maybeKey && !endPath[searchKey][maybeKey])) {\n return false;\n }\n\n return true;\n};\n\nconst findClosestVariablePathWithModes = (\n variables: Mode['variables'],\n mainPath: Paths,\n initialModes: ModesType[Modes][],\n modes: ModesType[Modes][],\n kind: PathKinds,\n maybePathLayer?: PathDensityModes | PathDensityLayerModes | PathLayerModes,\n): VariablePath => {\n const modeNames = MODES_BY_PATH[mainPath];\n\n if (\n !isPathAvailable(\n variables[mainPath],\n modes as (keyof (typeof variables)[typeof mainPath])[],\n kind as keyof (typeof variables)[typeof mainPath],\n maybePathLayer as keyof (typeof variables)[typeof mainPath][typeof kind &\n keyof (typeof variables)[typeof mainPath]],\n )\n ) {\n // if the path is not found, we get the first changed mode and set it to the default value\n const lastChangeIdx = modes.findIndex((modeValue, index) => modeValue !== MODES_DEFAULT_VALUES[modeNames[index]]);\n\n const initialLastChangeIdx = initialModes.findIndex(\n (modeValue, index) => modeValue !== MODES_DEFAULT_VALUES[modeNames[index]],\n );\n\n const newModes = modes.map((modeValue, idx) => {\n if (idx === lastChangeIdx) {\n return MODES_DEFAULT_VALUES[modeNames[idx]];\n }\n if (idx < lastChangeIdx && idx >= initialLastChangeIdx && lastChangeIdx !== initialLastChangeIdx) {\n return initialModes[idx];\n }\n\n return modeValue;\n });\n\n return findClosestVariablePathWithModes(variables, mainPath, initialModes, newModes, kind);\n }\n\n return modes.reduce(\n (acc, modeValue) => acc[modeValue as keyof typeof acc],\n variables[mainPath],\n ) as unknown as VariablePath;\n};\n\nconst getValueFromVariablePath = (variable: Variables, value: VariablePath): string => {\n const [, kind, maybePathLayer] = PATH_BY_VARIABLE[variable];\n\n if (kind === PathKinds.border || kind === PathKinds.text) {\n return value[kind][maybePathLayer];\n }\n\n return value[kind];\n};\n\nexport const themeToLayer: ThemeInitFn<LayerFn> =\n ({ variables }) =>\n (modes = {}) => {\n if (!variables) {\n throw new Error('The provided Theme is not supported by the SDS. Please contact the SDS team for support.');\n }\n\n const wantedModesPerPath = Object.values(Paths).reduce(\n (accPaths, currentPath) => ({\n ...accPaths,\n [currentPath]: MODES_BY_PATH[currentPath].map((mode) => modes[mode] ?? MODES_DEFAULT_VALUES[mode]),\n }),\n {} as Record<Paths, ModesType[Modes][]>,\n );\n\n return Object.values(Variables).reduce((variableValues, variableName) => {\n const [mainPath, kind, maybePathLayer] = PATH_BY_VARIABLE[variableName];\n const closestVariablePath = findClosestVariablePathWithModes(\n variables,\n mainPath,\n wantedModesPerPath[mainPath],\n wantedModesPerPath[mainPath],\n kind,\n maybePathLayer,\n );\n const variableValue = getValueFromVariablePath(variableName, closestVariablePath);\n\n return { ...variableValues, [variableName]: variableValue };\n }, {} as VariableValues);\n };\n"],"names":["isPathAvailable","obj","modes","searchKey","maybeKey","endPath","acc","mode","findClosestVariablePathWithModes","variables","mainPath","initialModes","kind","maybePathLayer","modeNames","MODES_BY_PATH","lastChangeIdx","modeValue","index","MODES_DEFAULT_VALUES","initialLastChangeIdx","newModes","idx","getValueFromVariablePath","variable","value","PATH_BY_VARIABLE","PathKinds","themeToLayer","wantedModesPerPath","Paths","accPaths","currentPath","Variables","variableValues","variableName","closestVariablePath","variableValue"],"mappings":"gJAkBMA,EAAkB,CACtBC,EACAC,EACAC,EACAC,IACG,CACH,MAAMC,EAAUH,EAAM,OAAO,CAACI,EAAKC,IAASD,GAAA,YAAAA,EAAMC,GAAON,CAAG,EAE5D,MAAI,GAACI,GAAW,CAACA,EAAQF,CAAS,GAAMC,GAAY,CAACC,EAAQF,CAAS,EAAEC,CAAQ,EAKlF,EAEMI,EAAmC,CACvCC,EACAC,EACAC,EACAT,EACAU,EACAC,IACiB,CACjB,MAAMC,EAAYC,EAAAA,cAAcL,CAAQ,EAExC,GACE,CAACV,EACCS,EAAUC,CAAQ,EAClBR,EACAU,EACAC,CAAA,EAGF,CAEA,MAAMG,EAAgBd,EAAM,UAAU,CAACe,EAAWC,IAAUD,IAAcE,EAAAA,qBAAqBL,EAAUI,CAAK,CAAC,CAAC,EAE1GE,EAAuBT,EAAa,UACxC,CAACM,EAAWC,IAAUD,IAAcE,EAAAA,qBAAqBL,EAAUI,CAAK,CAAC,CAAA,EAGrEG,EAAWnB,EAAM,IAAI,CAACe,EAAWK,IACjCA,IAAQN,EACHG,EAAAA,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1
+ {"version":3,"file":"layer.js","sources":["../../../../../../react-base/src/theme/layer.ts"],"sourcesContent":["import type { Mode, ThemeInitFn } from './types/theme';\nimport {\n MODES_BY_PATH,\n MODES_DEFAULT_VALUES,\n PATH_BY_VARIABLE,\n Paths,\n PathKinds,\n Variables,\n type LayerFn,\n type VariableValues,\n type ModesType,\n type Modes,\n type VariablePath,\n PathDensityModes,\n PathDensityLayerModes,\n PathLayerModes,\n} from './types/layer';\n\nconst isPathAvailable = (\n obj: object,\n modes: (keyof typeof obj)[],\n searchKey: keyof typeof obj,\n maybeKey?: keyof (typeof obj)[typeof searchKey],\n) => {\n const endPath = modes.reduce((acc, mode) => acc?.[mode], obj);\n\n if (!endPath || !endPath[searchKey] || (maybeKey && !endPath[searchKey][maybeKey])) {\n return false;\n }\n\n return true;\n};\n\nconst findClosestVariablePathWithModes = (\n variables: Mode['variables'],\n mainPath: Paths,\n initialModes: ModesType[Modes][],\n modes: ModesType[Modes][],\n kind: PathKinds,\n maybePathLayer?: PathDensityModes | PathDensityLayerModes | PathLayerModes,\n): VariablePath => {\n const modeNames = MODES_BY_PATH[mainPath];\n\n if (\n !isPathAvailable(\n variables[mainPath],\n modes as (keyof (typeof variables)[typeof mainPath])[],\n kind as keyof (typeof variables)[typeof mainPath],\n maybePathLayer as keyof (typeof variables)[typeof mainPath][typeof kind &\n keyof (typeof variables)[typeof mainPath]],\n )\n ) {\n // if the path is not found, we get the first changed mode and set it to the default value\n const lastChangeIdx = modes.findIndex((modeValue, index) => modeValue !== MODES_DEFAULT_VALUES[modeNames[index]]);\n\n const initialLastChangeIdx = initialModes.findIndex(\n (modeValue, index) => modeValue !== MODES_DEFAULT_VALUES[modeNames[index]],\n );\n\n const newModes = modes.map((modeValue, idx) => {\n if (idx === lastChangeIdx) {\n return MODES_DEFAULT_VALUES[modeNames[idx]];\n }\n if (idx < lastChangeIdx && idx >= initialLastChangeIdx && lastChangeIdx !== initialLastChangeIdx) {\n return initialModes[idx];\n }\n\n return modeValue;\n });\n\n return findClosestVariablePathWithModes(variables, mainPath, initialModes, newModes, kind);\n }\n\n return modes.reduce(\n (acc, modeValue) => acc[modeValue as keyof typeof acc],\n variables[mainPath],\n ) as unknown as VariablePath;\n};\n\nconst getValueFromVariablePath = (variable: Variables, value: VariablePath): string => {\n const [, kind, maybePathLayer] = PATH_BY_VARIABLE[variable];\n\n if (kind === PathKinds.border || kind === PathKinds.text) {\n return value[kind][maybePathLayer];\n }\n\n return value[kind];\n};\n\nexport const themeToLayer: ThemeInitFn<LayerFn> =\n ({ variables }) =>\n (modes = {}) => {\n if (!variables) {\n // SSR-safe fallback: return empty object with default values\n console.warn('Theme variables not available during SSR - using fallback values');\n return Object.values(Variables).reduce((variableValues, variableName) => {\n return { ...variableValues, [variableName]: 'transparent' };\n }, {} as VariableValues);\n }\n\n const wantedModesPerPath = Object.values(Paths).reduce(\n (accPaths, currentPath) => ({\n ...accPaths,\n [currentPath]: MODES_BY_PATH[currentPath].map((mode) => modes[mode] ?? MODES_DEFAULT_VALUES[mode]),\n }),\n {} as Record<Paths, ModesType[Modes][]>,\n );\n\n return Object.values(Variables).reduce((variableValues, variableName) => {\n const [mainPath, kind, maybePathLayer] = PATH_BY_VARIABLE[variableName];\n const closestVariablePath = findClosestVariablePathWithModes(\n variables,\n mainPath,\n wantedModesPerPath[mainPath],\n wantedModesPerPath[mainPath],\n kind,\n maybePathLayer,\n );\n const variableValue = getValueFromVariablePath(variableName, closestVariablePath);\n\n return { ...variableValues, [variableName]: variableValue };\n }, {} as VariableValues);\n };\n"],"names":["isPathAvailable","obj","modes","searchKey","maybeKey","endPath","acc","mode","findClosestVariablePathWithModes","variables","mainPath","initialModes","kind","maybePathLayer","modeNames","MODES_BY_PATH","lastChangeIdx","modeValue","index","MODES_DEFAULT_VALUES","initialLastChangeIdx","newModes","idx","getValueFromVariablePath","variable","value","PATH_BY_VARIABLE","PathKinds","themeToLayer","Variables","variableValues","variableName","wantedModesPerPath","Paths","accPaths","currentPath","closestVariableP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EAAQ,CAAA,IAAO,CACd,GAAI,CAACO,EAEH,eAAQ,KAAK,kEAAkE,EACxE,OAAO,OAAOoB,EAAAA,SAAS,EAAE,OAAO,CAACC,EAAgBC,KAC/C,CAAE,GAAGD,EAAgB,CAACC,CAAY,EAAG,aAAA,GAC3C,CAAA,CAAoB,EAGzB,MAAMC,EAAqB,OAAO,OAAOC,EAAAA,KAAK,EAAE,OAC9C,CAACC,EAAUC,KAAiB,CAC1B,GAAGD,EACH,CAACC,CAAW,EAAGpB,EAAAA,cAAcoB,CAAW,EAAE,IAAK5B,GAASL,EAAMK,CAAI,GAAKY,EAAAA,qBAAqBZ,CAAI,CAAC,CAAA,GAEnG,CAAA,CAAC,EAGH,OAAO,OAAO,OAAOsB,EAAAA,SAAS,EAAE,OAAO,CAACC,EAAgBC,IAAiB,CACvE,KAAM,CAACrB,EAAUE,EAAMC,CAAc,EAAIa,EAAAA,iBAAiBK,CAAY,EAChEK,EAAsB5B,EAC1BC,EACAC,EACAsB,EAAmBtB,CAAQ,EAC3BsB,EAAmBtB,CAAQ,EAC3BE,EACAC,CAAA,EAEIwB,EAAgBd,EAAyBQ,EAAcK,CAAmB,EAEhF,MAAO,CAAE,GAAGN,EAAgB,CAACC,CAAY,EAAGM,CAAA,CAC9C,EAAG,CAAA,CAAoB,CACzB"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("acinguiux-ds-fabrics"),g=require("./types/typography.js"),p=t=>({...t,fontWeight:`${t.fontWeight??"normal"}`,fontSize:`${t.fontSize??0}px`,lineHeight:`${t.lineHeight??0}px`,paragraphSpacing:`${t.paragraphSpacing??0}px`,letterSpacing:`${t.letterSpacing??0}px`}),i=(t,e="medium",o="regular")=>g.isTypographyWeighted(t)?p(r.Typography[t][o][e]):p(r.Typography[t][e]);exports.typography=i;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("acinguiux-ds-fabrics"),o=require("./types/typography.js"),p=r=>({...r,fontWeight:`${r.fontWeight??"normal"}`,fontSize:`${r.fontSize??0}px`,lineHeight:`${r.lineHeight??0}px`,paragraphSpacing:`${r.paragraphSpacing??0}px`,letterSpacing:`${r.letterSpacing??0}px`}),i=(r,e="medium",t="regular")=>{if(!a.Typography||!a.Typography[r])return console.warn(`Typography object or kind "${r}" not available during SSR - using fallback values`),{fontFamily:"Arial, sans-serif",fontStyle:"normal",fontWeight:"normal",fontSize:"16px",lineHeight:"24px",paragraphSpacing:"0px",letterSpacing:"0px"};try{return o.isTypographyWeighted(r)?p(a.Typography[r][t][e]):p(a.Typography[r][e])}catch(n){return console.warn(`Error accessing typography values for kind "${r}", size "${e}", weight "${t}" - using fallback`,n),{fontFamily:"Arial, sans-serif",fontStyle:"normal",fontWeight:"normal",fontSize:"16px",lineHeight:"24px",paragraphSpacing:"0px",letterSpacing:"0px"}}};exports.typography=i;
2
2
  //# sourceMappingURL=typography.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"typography.js","sources":["../../../../../../react-base/src/theme/typography.ts"],"sourcesContent":["import { Typography, type TypographyType } from 'acinguiux-ds-fabrics';\n\nimport {\n isTypographyWeighted,\n TypographyKind,\n TypographySize,\n TypographyWeights,\n type TypographyElement,\n type TypographyElementPx,\n type TypographyFn,\n} from './types/typography';\n\nconst transformValuesToPx = <T extends TypographyElement>(value: T): TypographyElementPx => ({\n ...value,\n fontWeight: `${value.fontWeight ?? 'normal'}`,\n fontSize: `${value.fontSize ?? 0}px`,\n lineHeight: `${value.lineHeight ?? 0}px`,\n paragraphSpacing: `${value.paragraphSpacing ?? 0}px`,\n letterSpacing: `${value.letterSpacing ?? 0}px`,\n});\n\n/**\n * typography() is a function that returns a typography element with the specified values.\n *\n * @param kind the typography content type ('label', 'paragraph', 'heading' or 'display')\n * @param size the size of the typography content ('extraSmall', 'small', 'medium', 'large', 'extraLarge' or 'smallest')\n * @param weight the weight of the typography content ('regular' or 'strong')\n * @returns the typography element with the specified values\n *\n * @defaults typography('paragraph', 'medium', 'regular')\n */\nexport const typography: TypographyFn = <\n Kind extends TypographyKind,\n Size extends TypographySize<Kind>,\n Weight extends TypographyWeights<Kind>,\n>(\n kind: Kind,\n size = 'medium' as Size,\n weight = 'regular' as Weight,\n) =>\n isTypographyWeighted(kind)\n ? transformValuesToPx(Typography[kind][weight][size as keyof TypographyType[Kind][Weight]] as TypographyElement)\n : transformValuesToPx(Typography[kind][size as keyof TypographyType[typeof kind]] as TypographyElement);\n"],"names":["transformValuesToPx","value","typography","kind","size","weight","isTypographyWeighted","Typography"],"mappings":"uLAYMA,EAAoDC,IAAmC,CAC3F,GAAGA,EACH,WAAY,GAAGA,EAAM,YAAc,QAAQ,GAC3C,SAAU,GAAGA,EAAM,UAAY,CAAC,KAChC,WAAY,GAAGA,EAAM,YAAc,CAAC,KACpC,iBAAkB,GAAGA,EAAM,kBAAoB,CAAC,KAChD,cAAe,GAAGA,EAAM,eAAiB,CAAC,IAC5C,GAYaC,EAA2B,CAKtCC,EACAC,EAAO,SACPC,EAAS,YAETC,EAAAA,qBAAqBH,CAAI,EACrBH,EAAoBO,EAAAA,WAAWJ,CAAI,EAAEE,CAAM,EAAED,CAA0C,CAAsB,EAC7GJ,EAAoBO,EAAAA,WAAWJ,CAAI,EAAEC,CAAyC,CAAsB"}
1
+ {"version":3,"file":"typography.js","sources":["../../../../../../react-base/src/theme/typography.ts"],"sourcesContent":["import { Typography, type TypographyType } from 'acinguiux-ds-fabrics';\n\nimport {\n isTypographyWeighted,\n TypographyKind,\n TypographySize,\n TypographyWeights,\n type TypographyElement,\n type TypographyElementPx,\n type TypographyFn,\n} from './types/typography';\n\nconst transformValuesToPx = <T extends TypographyElement>(value: T): TypographyElementPx => ({\n ...value,\n fontWeight: `${value.fontWeight ?? 'normal'}`,\n fontSize: `${value.fontSize ?? 0}px`,\n lineHeight: `${value.lineHeight ?? 0}px`,\n paragraphSpacing: `${value.paragraphSpacing ?? 0}px`,\n letterSpacing: `${value.letterSpacing ?? 0}px`,\n});\n\n/**\n * typography() is a function that returns a typography element with the specified values.\n *\n * @param kind the typography content type ('label', 'paragraph', 'heading' or 'display')\n * @param size the size of the typography content ('extraSmall', 'small', 'medium', 'large', 'extraLarge' or 'smallest')\n * @param weight the weight of the typography content ('regular' or 'strong')\n * @returns the typography element with the specified values\n *\n * @defaults typography('paragraph', 'medium', 'regular')\n */\nexport const typography: TypographyFn = <\n Kind extends TypographyKind,\n Size extends TypographySize<Kind>,\n Weight extends TypographyWeights<Kind>,\n>(\n kind: Kind,\n size = 'medium' as Size,\n weight = 'regular' as Weight,\n) => {\n // SSR-safe check for Typography object\n if (!Typography || !Typography[kind]) {\n console.warn(`Typography object or kind \"${kind}\" not available during SSR - using fallback values`);\n return {\n fontFamily: 'Arial, sans-serif',\n fontStyle: 'normal',\n fontWeight: 'normal',\n fontSize: '16px',\n lineHeight: '24px',\n paragraphSpacing: '0px',\n letterSpacing: '0px',\n } as TypographyElementPx;\n }\n\n try {\n return isTypographyWeighted(kind)\n ? transformValuesToPx(Typography[kind][weight][size as keyof TypographyType[Kind][Weight]] as TypographyElement)\n : transformValuesToPx(Typography[kind][size as keyof TypographyType[typeof kind]] as TypographyElement);\n } catch (error) {\n console.warn(`Error accessing typography values for kind \"${kind}\", size \"${size}\", weight \"${weight}\" - using fallback`, error);\n return {\n fontFamily: 'Arial, sans-serif',\n fontStyle: 'normal',\n fontWeight: 'normal',\n fontSize: '16px',\n lineHeight: '24px',\n paragraphSpacing: '0px',\n letterSpacing: '0px',\n } as TypographyElementPx;\n }\n};\n"],"names":["transformValuesToPx","value","typography","kind","size","weight","Typography","isTypographyWeighted","error"],"mappings":"uLAYMA,EAAoDC,IAAmC,CAC3F,GAAGA,EACH,WAAY,GAAGA,EAAM,YAAc,QAAQ,GAC3C,SAAU,GAAGA,EAAM,UAAY,CAAC,KAChC,WAAY,GAAGA,EAAM,YAAc,CAAC,KACpC,iBAAkB,GAAGA,EAAM,kBAAoB,CAAC,KAChD,cAAe,GAAGA,EAAM,eAAiB,CAAC,IAC5C,GAYaC,EAA2B,CAKtCC,EACAC,EAAO,SACPC,EAAS,YACN,CAEH,GAAI,CAACC,EAAAA,YAAc,CAACA,EAAAA,WAAWH,CAAI,EACjC,eAAQ,KAAK,8BAA8BA,CAAI,oDAAoD,EAC5F,CACL,WAAY,oBACZ,UAAW,SACX,WAAY,SACZ,SAAU,OACV,WAAY,OACZ,iBAAkB,MAClB,cAAe,KAAA,EAInB,GAAI,CACF,OAAOI,EAAAA,qBAAqBJ,CAAI,EAC5BH,EAAoBM,EAAAA,WAAWH,CAAI,EAAEE,CAAM,EAAED,CAA0C,CAAsB,EAC7GJ,EAAoBM,EAAAA,WAAWH,CAAI,EAAEC,CAAyC,CAAsB,CAC1G,OAASI,EAAO,CACd,eAAQ,KAAK,+CAA+CL,CAAI,YAAYC,CAAI,cAAcC,CAAM,qBAAsBG,CAAK,EACxH,CACL,WAAY,oBACZ,UAAW,SACX,WAAY,SACZ,SAAU,OACV,WAAY,OACZ,iBAAkB,MAClB,cAAe,KAAA,CAEnB,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"layer.d.ts","sourceRoot":"","sources":["../../../../../../react-base/src/theme/layer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAOL,KAAK,OAAO,EAQb,MAAM,eAAe,CAAC;AAyEvB,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,OAAO,CA6B3C,CAAC"}
1
+ {"version":3,"file":"layer.d.ts","sourceRoot":"","sources":["../../../../../../react-base/src/theme/layer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAOL,KAAK,OAAO,EAQb,MAAM,eAAe,CAAC;AAyEvB,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,OAAO,CAiC3C,CAAC"}
@@ -1,50 +1,50 @@
1
- import { Paths as A, MODES_BY_PATH as p, MODES_DEFAULT_VALUES as f, Variables as L, PATH_BY_VARIABLE as i, PathKinds as l } from "./types/layer.js";
2
- const S = (s, o, t, e) => {
3
- const r = o.reduce((n, a) => n == null ? void 0 : n[a], s);
4
- return !(!r || !r[t] || e && !r[t][e]);
5
- }, V = (s, o, t, e, r, n) => {
6
- const a = p[o];
7
- if (!S(
8
- s[o],
1
+ import { Variables as i, Paths as L, MODES_BY_PATH as b, MODES_DEFAULT_VALUES as f, PATH_BY_VARIABLE as V, PathKinds as P } from "./types/layer.js";
2
+ const _ = (a, s, r, e) => {
3
+ const t = s.reduce((n, o) => n == null ? void 0 : n[o], a);
4
+ return !(!t || !t[r] || e && !t[r][e]);
5
+ }, A = (a, s, r, e, t, n) => {
6
+ const o = b[s];
7
+ if (!_(
8
+ a[s],
9
9
  e,
10
- r,
10
+ t,
11
11
  n
12
12
  )) {
13
- const h = e.findIndex((d, u) => d !== f[a[u]]), c = t.findIndex(
14
- (d, u) => d !== f[a[u]]
15
- ), P = e.map((d, u) => u === h ? f[a[u]] : u < h && u >= c && h !== c ? t[u] : d);
16
- return V(s, o, t, P, r);
13
+ const l = e.findIndex((d, u) => d !== f[o[u]]), c = r.findIndex(
14
+ (d, u) => d !== f[o[u]]
15
+ ), h = e.map((d, u) => u === l ? f[o[u]] : u < l && u >= c && l !== c ? r[u] : d);
16
+ return A(a, s, r, h, t);
17
17
  }
18
18
  return e.reduce(
19
- (h, c) => h[c],
20
- s[o]
19
+ (l, c) => l[c],
20
+ a[s]
21
21
  );
22
- }, b = (s, o) => {
23
- const [, t, e] = i[s];
24
- return t === l.border || t === l.text ? o[t][e] : o[t];
25
- }, T = ({ variables: s }) => (o = {}) => {
26
- if (!s)
27
- throw new Error("The provided Theme is not supported by the SDS. Please contact the SDS team for support.");
28
- const t = Object.values(A).reduce(
29
- (e, r) => ({
22
+ }, g = (a, s) => {
23
+ const [, r, e] = V[a];
24
+ return r === P.border || r === P.text ? s[r][e] : s[r];
25
+ }, E = ({ variables: a }) => (s = {}) => {
26
+ if (!a)
27
+ return console.warn("Theme variables not available during SSR - using fallback values"), Object.values(i).reduce((e, t) => ({ ...e, [t]: "transparent" }), {});
28
+ const r = Object.values(L).reduce(
29
+ (e, t) => ({
30
30
  ...e,
31
- [r]: p[r].map((n) => o[n] ?? f[n])
31
+ [t]: b[t].map((n) => s[n] ?? f[n])
32
32
  }),
33
33
  {}
34
34
  );
35
- return Object.values(L).reduce((e, r) => {
36
- const [n, a, h] = i[r], c = V(
37
- s,
38
- n,
39
- t[n],
40
- t[n],
35
+ return Object.values(i).reduce((e, t) => {
36
+ const [n, o, l] = V[t], c = A(
41
37
  a,
42
- h
43
- ), P = b(r, c);
44
- return { ...e, [r]: P };
38
+ n,
39
+ r[n],
40
+ r[n],
41
+ o,
42
+ l
43
+ ), h = g(t, c);
44
+ return { ...e, [t]: h };
45
45
  }, {});
46
46
  };
47
47
  export {
48
- T as themeToLayer
48
+ E as themeToLayer
49
49
  };
50
50
  //# sourceMappingURL=layer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"layer.js","sources":["../../../../../../react-base/src/theme/layer.ts"],"sourcesContent":["import type { Mode, ThemeInitFn } from './types/theme';\nimport {\n MODES_BY_PATH,\n MODES_DEFAULT_VALUES,\n PATH_BY_VARIABLE,\n Paths,\n PathKinds,\n Variables,\n type LayerFn,\n type VariableValues,\n type ModesType,\n type Modes,\n type VariablePath,\n PathDensityModes,\n PathDensityLayerModes,\n PathLayerModes,\n} from './types/layer';\n\nconst isPathAvailable = (\n obj: object,\n modes: (keyof typeof obj)[],\n searchKey: keyof typeof obj,\n maybeKey?: keyof (typeof obj)[typeof searchKey],\n) => {\n const endPath = modes.reduce((acc, mode) => acc?.[mode], obj);\n\n if (!endPath || !endPath[searchKey] || (maybeKey && !endPath[searchKey][maybeKey])) {\n return false;\n }\n\n return true;\n};\n\nconst findClosestVariablePathWithModes = (\n variables: Mode['variables'],\n mainPath: Paths,\n initialModes: ModesType[Modes][],\n modes: ModesType[Modes][],\n kind: PathKinds,\n maybePathLayer?: PathDensityModes | PathDensityLayerModes | PathLayerModes,\n): VariablePath => {\n const modeNames = MODES_BY_PATH[mainPath];\n\n if (\n !isPathAvailable(\n variables[mainPath],\n modes as (keyof (typeof variables)[typeof mainPath])[],\n kind as keyof (typeof variables)[typeof mainPath],\n maybePathLayer as keyof (typeof variables)[typeof mainPath][typeof kind &\n keyof (typeof variables)[typeof mainPath]],\n )\n ) {\n // if the path is not found, we get the first changed mode and set it to the default value\n const lastChangeIdx = modes.findIndex((modeValue, index) => modeValue !== MODES_DEFAULT_VALUES[modeNames[index]]);\n\n const initialLastChangeIdx = initialModes.findIndex(\n (modeValue, index) => modeValue !== MODES_DEFAULT_VALUES[modeNames[index]],\n );\n\n const newModes = modes.map((modeValue, idx) => {\n if (idx === lastChangeIdx) {\n return MODES_DEFAULT_VALUES[modeNames[idx]];\n }\n if (idx < lastChangeIdx && idx >= initialLastChangeIdx && lastChangeIdx !== initialLastChangeIdx) {\n return initialModes[idx];\n }\n\n return modeValue;\n });\n\n return findClosestVariablePathWithModes(variables, mainPath, initialModes, newModes, kind);\n }\n\n return modes.reduce(\n (acc, modeValue) => acc[modeValue as keyof typeof acc],\n variables[mainPath],\n ) as unknown as VariablePath;\n};\n\nconst getValueFromVariablePath = (variable: Variables, value: VariablePath): string => {\n const [, kind, maybePathLayer] = PATH_BY_VARIABLE[variable];\n\n if (kind === PathKinds.border || kind === PathKinds.text) {\n return value[kind][maybePathLayer];\n }\n\n return value[kind];\n};\n\nexport const themeToLayer: ThemeInitFn<LayerFn> =\n ({ variables }) =>\n (modes = {}) => {\n if (!variables) {\n throw new Error('The provided Theme is not supported by the SDS. Please contact the SDS team for support.');\n }\n\n const wantedModesPerPath = Object.values(Paths).reduce(\n (accPaths, currentPath) => ({\n ...accPaths,\n [currentPath]: MODES_BY_PATH[currentPath].map((mode) => modes[mode] ?? MODES_DEFAULT_VALUES[mode]),\n }),\n {} as Record<Paths, ModesType[Modes][]>,\n );\n\n return Object.values(Variables).reduce((variableValues, variableName) => {\n const [mainPath, kind, maybePathLayer] = PATH_BY_VARIABLE[variableName];\n const closestVariablePath = findClosestVariablePathWithModes(\n variables,\n mainPath,\n wantedModesPerPath[mainPath],\n wantedModesPerPath[mainPath],\n kind,\n maybePathLayer,\n );\n const variableValue = getValueFromVariablePath(variableName, closestVariablePath);\n\n return { ...variableValues, [variableName]: variableValue };\n }, {} as VariableValues);\n };\n"],"names":["isPathAvailable","obj","modes","searchKey","maybeKey","endPath","acc","mode","findClosestVariablePathWithModes","variables","mainPath","initialModes","kind","maybePathLayer","modeNames","MODES_BY_PATH","lastChangeIdx","modeValue","index","MODES_DEFAULT_VALUES","initialLastChangeIdx","newModes","idx","getValueFromVariablePath","variable","value","PATH_BY_VARIABLE","PathKinds","themeToLayer","wantedModesPerPath","Paths","accPaths","currentPath","Variables","variableValues","variableName","closestVariablePath","variableValue"],"mappings":";AAkBA,MAAMA,IAAkB,CACtBC,GACAC,GACAC,GACAC,MACG;AACH,QAAMC,IAAUH,EAAM,OAAO,CAACI,GAAKC,MAASD,KAAA,gBAAAA,EAAMC,IAAON,CAAG;AAE5D,SAAI,GAACI,KAAW,CAACA,EAAQF,CAAS,KAAMC,KAAY,CAACC,EAAQF,CAAS,EAAEC,CAAQ;AAKlF,GAEMI,IAAmC,CACvCC,GACAC,GACAC,GACAT,GACAU,GACAC,MACiB;AACjB,QAAMC,IAAYC,EAAcL,CAAQ;AAExC,MACE,CAACV;AAAA,IACCS,EAAUC,CAAQ;AAAA,IAClBR;AAAA,IACAU;AAAA,IACAC;AAAA,EAAA,GAGF;AAEA,UAAMG,IAAgBd,EAAM,UAAU,CAACe,GAAWC,MAAUD,MAAcE,EAAqBL,EAAUI,CAAK,CAAC,CAAC,GAE1GE,IAAuBT,EAAa;AAAA,MACxC,CAACM,GAAWC,MAAUD,MAAcE,EAAqBL,EAAUI,CAAK,CAAC;AAAA,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yBY,GAAcC,CAAmB;AAEhF,WAAO,EAAE,GAAGF,GAAgB,CAACC,CAAY,GAAGE,EAAA;AAAA,EAC9C,GAAG,CAAA,CAAoB;AACzB;"}
1
+ {"version":3,"file":"layer.js","sources":["../../../../../../react-base/src/theme/layer.ts"],"sourcesContent":["import type { Mode, ThemeInitFn } from './types/theme';\nimport {\n MODES_BY_PATH,\n MODES_DEFAULT_VALUES,\n PATH_BY_VARIABLE,\n Paths,\n PathKinds,\n Variables,\n type LayerFn,\n type VariableValues,\n type ModesType,\n type Modes,\n type VariablePath,\n PathDensityModes,\n PathDensityLayerModes,\n PathLayerModes,\n} from './types/layer';\n\nconst isPathAvailable = (\n obj: object,\n modes: (keyof typeof obj)[],\n searchKey: keyof typeof obj,\n maybeKey?: keyof (typeof obj)[typeof searchKey],\n) => {\n const endPath = modes.reduce((acc, mode) => acc?.[mode], obj);\n\n if (!endPath || !endPath[searchKey] || (maybeKey && !endPath[searchKey][maybeKey])) {\n return false;\n }\n\n return true;\n};\n\nconst findClosestVariablePathWithModes = (\n variables: Mode['variables'],\n mainPath: Paths,\n initialModes: ModesType[Modes][],\n modes: ModesType[Modes][],\n kind: PathKinds,\n maybePathLayer?: PathDensityModes | PathDensityLayerModes | PathLayerModes,\n): VariablePath => {\n const modeNames = MODES_BY_PATH[mainPath];\n\n if (\n !isPathAvailable(\n variables[mainPath],\n modes as (keyof (typeof variables)[typeof mainPath])[],\n kind as keyof (typeof variables)[typeof mainPath],\n maybePathLayer as keyof (typeof variables)[typeof mainPath][typeof kind &\n keyof (typeof variables)[typeof mainPath]],\n )\n ) {\n // if the path is not found, we get the first changed mode and set it to the default value\n const lastChangeIdx = modes.findIndex((modeValue, index) => modeValue !== MODES_DEFAULT_VALUES[modeNames[index]]);\n\n const initialLastChangeIdx = initialModes.findIndex(\n (modeValue, index) => modeValue !== MODES_DEFAULT_VALUES[modeNames[index]],\n );\n\n const newModes = modes.map((modeValue, idx) => {\n if (idx === lastChangeIdx) {\n return MODES_DEFAULT_VALUES[modeNames[idx]];\n }\n if (idx < lastChangeIdx && idx >= initialLastChangeIdx && lastChangeIdx !== initialLastChangeIdx) {\n return initialModes[idx];\n }\n\n return modeValue;\n });\n\n return findClosestVariablePathWithModes(variables, mainPath, initialModes, newModes, kind);\n }\n\n return modes.reduce(\n (acc, modeValue) => acc[modeValue as keyof typeof acc],\n variables[mainPath],\n ) as unknown as VariablePath;\n};\n\nconst getValueFromVariablePath = (variable: Variables, value: VariablePath): string => {\n const [, kind, maybePathLayer] = PATH_BY_VARIABLE[variable];\n\n if (kind === PathKinds.border || kind === PathKinds.text) {\n return value[kind][maybePathLayer];\n }\n\n return value[kind];\n};\n\nexport const themeToLayer: ThemeInitFn<LayerFn> =\n ({ variables }) =>\n (modes = {}) => {\n if (!variables) {\n // SSR-safe fallback: return empty object with default values\n console.warn('Theme variables not available during SSR - using fallback values');\n return Object.values(Variables).reduce((variableValues, variableName) => {\n return { ...variableValues, [variableName]: 'transparent' };\n }, {} as VariableValues);\n }\n\n const wantedModesPerPath = Object.values(Paths).reduce(\n (accPaths, currentPath) => ({\n ...accPaths,\n [currentPath]: MODES_BY_PATH[currentPath].map((mode) => modes[mode] ?? MODES_DEFAULT_VALUES[mode]),\n }),\n {} as Record<Paths, ModesType[Modes][]>,\n );\n\n return Object.values(Variables).reduce((variableValues, variableName) => {\n const [mainPath, kind, maybePathLayer] = PATH_BY_VARIABLE[variableName];\n const closestVariablePath = findClosestVariablePathWithModes(\n variables,\n mainPath,\n wantedModesPerPath[mainPath],\n wantedModesPerPath[mainPath],\n kind,\n maybePathLayer,\n );\n const variableValue = getValueFromVariablePath(variableName, closestVariablePath);\n\n return { ...variableValues, [variableName]: variableValue };\n }, {} as VariableValues);\n };\n"],"names":["isPathAvailable","obj","modes","searchKey","maybeKey","endPath","acc","mode","findClosestVariablePathWithModes","variables","mainPath","initialModes","kind","maybePathLayer","modeNames","MODES_BY_PATH","lastChangeIdx","modeValue","index","MODES_DEFAULT_VALUES","initialLastChangeIdx","newModes","idx","getValueFromVariablePath","variable","value","PATH_BY_VARIABLE","PathKinds","themeToLayer","Variables","variableValues","variableName","wantedModesPerPath","Paths","accPaths","currentPath","closestVariablePath","variableValue"],"mappings":";AAkBA,MAAMA,IAAkB,CACtBC,GACAC,GACAC,GACAC,MACG;AACH,QAAMC,IAAUH,EAAM,OAAO,CAACI,GAAKC,MAASD,KAAA,gBAAAA,EAAMC,IAAON,CAAG;AAE5D,SAAI,GAACI,KAAW,CAACA,EAAQF,CAAS,KAAMC,KAAY,CAACC,EAAQF,CAAS,EAAEC,CAAQ;AAKlF,GAEMI,IAAmC,CACvCC,GACAC,GACAC,GACAT,GACAU,GACAC,MACiB;AACjB,QAAMC,IAAYC,EAAcL,CAAQ;AAExC,MACE,CAACV;AAAA,IACCS,EAAUC,CAAQ;AAAA,IAClBR;AAAA,IACAU;AAAA,IACAC;AAAA,EAAA,GAGF;AAEA,UAAMG,IAAgBd,EAAM,UAAU,CAACe,GAAWC,MAAUD,MAAcE,EAAqBL,EAAUI,CAAK,CAAC,CAAC,GAE1GE,IAAuBT,EAAa;AAAA,MACxC,CAACM,GAAWC,MAAUD,MAAcE,EAAqBL,EAAUI,CAAK,CAAC;AAAA,IAAA,GAGrEG,IAAWnB,EAAM,IAAI,CAACe,GAAWK,MACjCA,MAAQN,IACHG,EAAqBL,EAAUQ,CAAG,CAAC,IAExCA,IAAMN,KAAiBM,KAAOF,KAAwBJ,MAAkBI,IACnET,EAAaW,CAAG,IAGlBL,CACR;AAED,WAAOT,EAAiCC,GAAWC,GAAUC,GAAcU,GAAUT,CAAI;AAAA,EAC3F;AAEA,SAAOV,EAAM;AAAA,IACX,CAACI,GAAKW,MAAcX,EAAIW,CAA6B;AAAA,IACrDR,EAAUC,CAAQ;AAAA,EAAA;AAEtB,GAEMa,IAA2B,CAACC,GAAqBC,MAAgC;AACrF,QAAM,CAAA,EAAGb,GAAMC,CAAc,IAAIa,EAAiBF,CAAQ;AAE1D,SAAIZ,MAASe,EAAU,UAAUf,MAASe,EAAU,OAC3CF,EAAMb,CAAI,EAAEC,CAAc,IAG5BY,EAAMb,CAAI;AACnB,GAEagB,IACX,CAAC,EAAE,WAAAnB,EAAA,MACH,CAACP,IAAQ,CAAA,MAAO;AACd,MAAI,CAACO;AAEH,mBAAQ,KAAK,kEAAkE,GACxE,OAAO,OAAOoB,CAAS,EAAE,OAAO,CAACC,GAAgBC,OAC/C,EAAE,GAAGD,GAAgB,CAACC,CAAY,GAAG,cAAA,IAC3C,CAAA,CAAoB;AAGzB,QAAMC,IAAqB,OAAO,OAAOC,CAAK,EAAE;AAAA,IAC9C,CAACC,GAAUC,OAAiB;AAAA,MAC1B,GAAGD;AAAA,MACH,CAACC,CAAW,GAAGpB,EAAcoB,CAAW,EAAE,IAAI,CAAC5B,MAASL,EAAMK,CAAI,KAAKY,EAAqBZ,CAAI,CAAC;AAAA,IAAA;AAAA,IAEnG,CAAA;AAAA,EAAC;AAGH,SAAO,OAAO,OAAOsB,CAAS,EAAE,OAAO,CAACC,GAAgBC,MAAiB;AACvE,UAAM,CAACrB,GAAUE,GAAMC,CAAc,IAAIa,EAAiBK,CAAY,GAChEK,IAAsB5B;AAAA,MAC1BC;AAAA,MACAC;AAAA,MACAsB,EAAmBtB,CAAQ;AAAA,MAC3BsB,EAAmBtB,CAAQ;AAAA,MAC3BE;AAAA,MACAC;AAAA,IAAA,GAEIwB,IAAgBd,EAAyBQ,GAAcK,CAAmB;AAEhF,WAAO,EAAE,GAAGN,GAAgB,CAACC,CAAY,GAAGM,EAAA;AAAA,EAC9C,GAAG,CAAA,CAAoB;AACzB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../../../../../react-base/src/theme/typography.ts"],"names":[],"mappings":"AAEA,OAAO,EAOL,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAW5B;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU,EAAE,YAWkF,CAAC"}
1
+ {"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../../../../../react-base/src/theme/typography.ts"],"names":[],"mappings":"AAEA,OAAO,EAOL,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAW5B;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU,EAAE,YAuCxB,CAAC"}
@@ -1,14 +1,38 @@
1
- import { Typography as r } from "acinguiux-ds-fabrics";
2
- import { isTypographyWeighted as i } from "./types/typography.js";
3
- const o = (p) => ({
4
- ...p,
5
- fontWeight: `${p.fontWeight ?? "normal"}`,
6
- fontSize: `${p.fontSize ?? 0}px`,
7
- lineHeight: `${p.lineHeight ?? 0}px`,
8
- paragraphSpacing: `${p.paragraphSpacing ?? 0}px`,
9
- letterSpacing: `${p.letterSpacing ?? 0}px`
10
- }), n = (p, t = "medium", g = "regular") => i(p) ? o(r[p][g][t]) : o(r[p][t]);
1
+ import { Typography as a } from "acinguiux-ds-fabrics";
2
+ import { isTypographyWeighted as e } from "./types/typography.js";
3
+ const o = (r) => ({
4
+ ...r,
5
+ fontWeight: `${r.fontWeight ?? "normal"}`,
6
+ fontSize: `${r.fontSize ?? 0}px`,
7
+ lineHeight: `${r.lineHeight ?? 0}px`,
8
+ paragraphSpacing: `${r.paragraphSpacing ?? 0}px`,
9
+ letterSpacing: `${r.letterSpacing ?? 0}px`
10
+ }), l = (r, t = "medium", n = "regular") => {
11
+ if (!a || !a[r])
12
+ return console.warn(`Typography object or kind "${r}" not available during SSR - using fallback values`), {
13
+ fontFamily: "Arial, sans-serif",
14
+ fontStyle: "normal",
15
+ fontWeight: "normal",
16
+ fontSize: "16px",
17
+ lineHeight: "24px",
18
+ paragraphSpacing: "0px",
19
+ letterSpacing: "0px"
20
+ };
21
+ try {
22
+ return e(r) ? o(a[r][n][t]) : o(a[r][t]);
23
+ } catch (p) {
24
+ return console.warn(`Error accessing typography values for kind "${r}", size "${t}", weight "${n}" - using fallback`, p), {
25
+ fontFamily: "Arial, sans-serif",
26
+ fontStyle: "normal",
27
+ fontWeight: "normal",
28
+ fontSize: "16px",
29
+ lineHeight: "24px",
30
+ paragraphSpacing: "0px",
31
+ letterSpacing: "0px"
32
+ };
33
+ }
34
+ };
11
35
  export {
12
- n as typography
36
+ l as typography
13
37
  };
14
38
  //# sourceMappingURL=typography.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"typography.js","sources":["../../../../../../react-base/src/theme/typography.ts"],"sourcesContent":["import { Typography, type TypographyType } from 'acinguiux-ds-fabrics';\n\nimport {\n isTypographyWeighted,\n TypographyKind,\n TypographySize,\n TypographyWeights,\n type TypographyElement,\n type TypographyElementPx,\n type TypographyFn,\n} from './types/typography';\n\nconst transformValuesToPx = <T extends TypographyElement>(value: T): TypographyElementPx => ({\n ...value,\n fontWeight: `${value.fontWeight ?? 'normal'}`,\n fontSize: `${value.fontSize ?? 0}px`,\n lineHeight: `${value.lineHeight ?? 0}px`,\n paragraphSpacing: `${value.paragraphSpacing ?? 0}px`,\n letterSpacing: `${value.letterSpacing ?? 0}px`,\n});\n\n/**\n * typography() is a function that returns a typography element with the specified values.\n *\n * @param kind the typography content type ('label', 'paragraph', 'heading' or 'display')\n * @param size the size of the typography content ('extraSmall', 'small', 'medium', 'large', 'extraLarge' or 'smallest')\n * @param weight the weight of the typography content ('regular' or 'strong')\n * @returns the typography element with the specified values\n *\n * @defaults typography('paragraph', 'medium', 'regular')\n */\nexport const typography: TypographyFn = <\n Kind extends TypographyKind,\n Size extends TypographySize<Kind>,\n Weight extends TypographyWeights<Kind>,\n>(\n kind: Kind,\n size = 'medium' as Size,\n weight = 'regular' as Weight,\n) =>\n isTypographyWeighted(kind)\n ? transformValuesToPx(Typography[kind][weight][size as keyof TypographyType[Kind][Weight]] as TypographyElement)\n : transformValuesToPx(Typography[kind][size as keyof TypographyType[typeof kind]] as TypographyElement);\n"],"names":["transformValuesToPx","value","typography","kind","size","weight","isTypographyWeighted","Typography"],"mappings":";;AAYA,MAAMA,IAAsB,CAA8BC,OAAmC;AAAA,EAC3F,GAAGA;AAAA,EACH,YAAY,GAAGA,EAAM,cAAc,QAAQ;AAAA,EAC3C,UAAU,GAAGA,EAAM,YAAY,CAAC;AAAA,EAChC,YAAY,GAAGA,EAAM,cAAc,CAAC;AAAA,EACpC,kBAAkB,GAAGA,EAAM,oBAAoB,CAAC;AAAA,EAChD,eAAe,GAAGA,EAAM,iBAAiB,CAAC;AAC5C,IAYaC,IAA2B,CAKtCC,GACAC,IAAO,UACPC,IAAS,cAETC,EAAqBH,CAAI,IACrBH,EAAoBO,EAAWJ,CAAI,EAAEE,CAAM,EAAED,CAA0C,CAAsB,IAC7GJ,EAAoBO,EAAWJ,CAAI,EAAEC,CAAyC,CAAsB;"}
1
+ {"version":3,"file":"typography.js","sources":["../../../../../../react-base/src/theme/typography.ts"],"sourcesContent":["import { Typography, type TypographyType } from 'acinguiux-ds-fabrics';\n\nimport {\n isTypographyWeighted,\n TypographyKind,\n TypographySize,\n TypographyWeights,\n type TypographyElement,\n type TypographyElementPx,\n type TypographyFn,\n} from './types/typography';\n\nconst transformValuesToPx = <T extends TypographyElement>(value: T): TypographyElementPx => ({\n ...value,\n fontWeight: `${value.fontWeight ?? 'normal'}`,\n fontSize: `${value.fontSize ?? 0}px`,\n lineHeight: `${value.lineHeight ?? 0}px`,\n paragraphSpacing: `${value.paragraphSpacing ?? 0}px`,\n letterSpacing: `${value.letterSpacing ?? 0}px`,\n});\n\n/**\n * typography() is a function that returns a typography element with the specified values.\n *\n * @param kind the typography content type ('label', 'paragraph', 'heading' or 'display')\n * @param size the size of the typography content ('extraSmall', 'small', 'medium', 'large', 'extraLarge' or 'smallest')\n * @param weight the weight of the typography content ('regular' or 'strong')\n * @returns the typography element with the specified values\n *\n * @defaults typography('paragraph', 'medium', 'regular')\n */\nexport const typography: TypographyFn = <\n Kind extends TypographyKind,\n Size extends TypographySize<Kind>,\n Weight extends TypographyWeights<Kind>,\n>(\n kind: Kind,\n size = 'medium' as Size,\n weight = 'regular' as Weight,\n) => {\n // SSR-safe check for Typography object\n if (!Typography || !Typography[kind]) {\n console.warn(`Typography object or kind \"${kind}\" not available during SSR - using fallback values`);\n return {\n fontFamily: 'Arial, sans-serif',\n fontStyle: 'normal',\n fontWeight: 'normal',\n fontSize: '16px',\n lineHeight: '24px',\n paragraphSpacing: '0px',\n letterSpacing: '0px',\n } as TypographyElementPx;\n }\n\n try {\n return isTypographyWeighted(kind)\n ? transformValuesToPx(Typography[kind][weight][size as keyof TypographyType[Kind][Weight]] as TypographyElement)\n : transformValuesToPx(Typography[kind][size as keyof TypographyType[typeof kind]] as TypographyElement);\n } catch (error) {\n console.warn(`Error accessing typography values for kind \"${kind}\", size \"${size}\", weight \"${weight}\" - using fallback`, error);\n return {\n fontFamily: 'Arial, sans-serif',\n fontStyle: 'normal',\n fontWeight: 'normal',\n fontSize: '16px',\n lineHeight: '24px',\n paragraphSpacing: '0px',\n letterSpacing: '0px',\n } as TypographyElementPx;\n }\n};\n"],"names":["transformValuesToPx","value","typography","kind","size","weight","Typography","isTypographyWeighted","error"],"mappings":";;AAYA,MAAMA,IAAsB,CAA8BC,OAAmC;AAAA,EAC3F,GAAGA;AAAA,EACH,YAAY,GAAGA,EAAM,cAAc,QAAQ;AAAA,EAC3C,UAAU,GAAGA,EAAM,YAAY,CAAC;AAAA,EAChC,YAAY,GAAGA,EAAM,cAAc,CAAC;AAAA,EACpC,kBAAkB,GAAGA,EAAM,oBAAoB,CAAC;AAAA,EAChD,eAAe,GAAGA,EAAM,iBAAiB,CAAC;AAC5C,IAYaC,IAA2B,CAKtCC,GACAC,IAAO,UACPC,IAAS,cACN;AAEH,MAAI,CAACC,KAAc,CAACA,EAAWH,CAAI;AACjC,mBAAQ,KAAK,8BAA8BA,CAAI,oDAAoD,GAC5F;AAAA,MACL,YAAY;AAAA,MACZ,WAAW;AAAA,MACX,YAAY;AAAA,MACZ,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,kBAAkB;AAAA,MAClB,eAAe;AAAA,IAAA;AAInB,MAAI;AACF,WAAOI,EAAqBJ,CAAI,IAC5BH,EAAoBM,EAAWH,CAAI,EAAEE,CAAM,EAAED,CAA0C,CAAsB,IAC7GJ,EAAoBM,EAAWH,CAAI,EAAEC,CAAyC,CAAsB;AAAA,EAC1G,SAASI,GAAO;AACd,mBAAQ,KAAK,+CAA+CL,CAAI,YAAYC,CAAI,cAAcC,CAAM,sBAAsBG,CAAK,GACxH;AAAA,MACL,YAAY;AAAA,MACZ,WAAW;AAAA,MACX,YAAY;AAAA,MACZ,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,kBAAkB;AAAA,MAClB,eAAe;AAAA,IAAA;AAAA,EAEnB;AACF;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "acinguiux-ds-react-framework",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "acinguiux UI Web Library",
5
5
  "main": "./build/cjs/index.js",
6
6
  "module": "./build/esm/index.js",