@asgardeo/javascript 0.1.9 → 0.1.10

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/cjs/index.js CHANGED
@@ -3363,10 +3363,31 @@ var toCssVariables = (theme) => {
3363
3363
  }
3364
3364
  });
3365
3365
  }
3366
+ if (theme.components?.Button?.styleOverrides?.root?.borderRadius) {
3367
+ cssVars[`--${prefix}-component-button-root-borderRadius`] = theme.components.Button.styleOverrides.root.borderRadius;
3368
+ }
3369
+ if (theme.components?.Field?.styleOverrides?.root?.borderRadius) {
3370
+ cssVars[`--${prefix}-component-field-root-borderRadius`] = theme.components.Field.styleOverrides.root.borderRadius;
3371
+ }
3366
3372
  return cssVars;
3367
3373
  };
3368
3374
  var toThemeVars = (theme) => {
3369
3375
  const prefix = theme.cssVarPrefix || VendorConstants_default.VENDOR_PREFIX;
3376
+ const componentVars = {};
3377
+ if (theme.components?.Button?.styleOverrides?.root?.borderRadius) {
3378
+ componentVars.Button = {
3379
+ root: {
3380
+ borderRadius: `var(--${prefix}-component-button-root-borderRadius)`
3381
+ }
3382
+ };
3383
+ }
3384
+ if (theme.components?.Field?.styleOverrides?.root?.borderRadius) {
3385
+ componentVars.Field = {
3386
+ root: {
3387
+ borderRadius: `var(--${prefix}-component-field-root-borderRadius)`
3388
+ }
3389
+ };
3390
+ }
3370
3391
  const themeVars = {
3371
3392
  colors: {
3372
3393
  action: {
@@ -3467,6 +3488,9 @@ var toThemeVars = (theme) => {
3467
3488
  };
3468
3489
  });
3469
3490
  }
3491
+ if (Object.keys(componentVars).length > 0) {
3492
+ themeVars.components = componentVars;
3493
+ }
3470
3494
  return themeVars;
3471
3495
  };
3472
3496
  var createTheme = (config = {}, isDark = false) => {
@@ -3990,7 +4014,7 @@ var transformThemeVariant = (themeVariant, isDark = false) => {
3990
4014
  const buttons = themeVariant.buttons;
3991
4015
  const inputs = themeVariant.inputs;
3992
4016
  const images = themeVariant.images;
3993
- return {
4017
+ const config = {
3994
4018
  colors: {
3995
4019
  action: {
3996
4020
  active: isDark ? "rgba(255, 255, 255, 0.70)" : "rgba(0, 0, 0, 0.54)",
@@ -4051,13 +4075,6 @@ var transformThemeVariant = (themeVariant, isDark = false) => {
4051
4075
  dark: colors?.alerts?.warning?.dark || colors?.alerts?.warning?.main
4052
4076
  }
4053
4077
  },
4054
- // Extract border radius from buttons or inputs
4055
- borderRadius: {
4056
- small: buttons?.primary?.base?.border?.borderRadius || inputs?.base?.border?.borderRadius,
4057
- medium: buttons?.secondary?.base?.border?.borderRadius,
4058
- large: buttons?.externalConnection?.base?.border?.borderRadius
4059
- },
4060
- // Extract and transform images
4061
4078
  images: {
4062
4079
  favicon: images?.favicon ? {
4063
4080
  url: images.favicon.imgURL,
@@ -4071,6 +4088,31 @@ var transformThemeVariant = (themeVariant, isDark = false) => {
4071
4088
  } : void 0
4072
4089
  }
4073
4090
  };
4091
+ const buttonBorderRadius = buttons?.primary?.base?.border?.borderRadius;
4092
+ const fieldBorderRadius = inputs?.base?.border?.borderRadius;
4093
+ if (buttonBorderRadius || fieldBorderRadius) {
4094
+ config.components = {
4095
+ ...buttonBorderRadius && {
4096
+ Button: {
4097
+ styleOverrides: {
4098
+ root: {
4099
+ borderRadius: buttonBorderRadius
4100
+ }
4101
+ }
4102
+ }
4103
+ },
4104
+ ...fieldBorderRadius && {
4105
+ Field: {
4106
+ styleOverrides: {
4107
+ root: {
4108
+ borderRadius: fieldBorderRadius
4109
+ }
4110
+ }
4111
+ }
4112
+ }
4113
+ };
4114
+ }
4115
+ return config;
4074
4116
  };
4075
4117
  var transformBrandingPreferenceToTheme = (brandingPreference, forceTheme) => {
4076
4118
  const themeConfig = brandingPreference?.preference?.theme;