@app-studio/web 0.9.77 → 0.9.79

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/web.esm.js CHANGED
@@ -24,7 +24,6 @@ import 'core-js/modules/es.parse-int.js';
24
24
  import { Link as Link$1 } from 'react-router-dom';
25
25
  import 'core-js/modules/es.parse-float.js';
26
26
  import 'core-js/modules/es.string.ends-with.js';
27
- import contrast from 'contrast';
28
27
  import 'core-js/modules/es.promise.js';
29
28
  import 'core-js/modules/es.array.reduce.js';
30
29
  import 'core-js/modules/es.number.to-fixed.js';
@@ -35,6 +34,7 @@ import 'core-js/modules/es.regexp.exec.js';
35
34
  import { useFormikContext, getIn } from 'formik';
36
35
  import 'core-js/modules/es.string.replace.js';
37
36
  import 'core-js/modules/es.string.split.js';
37
+ import contrast from 'contrast';
38
38
  import 'core-js/modules/es.promise.finally.js';
39
39
  import 'core-js/modules/es.string.match.js';
40
40
  import 'core-js/modules/es.string.search.js';
@@ -2778,11 +2778,10 @@ var IconSizes$1 = {
2778
2778
  padding: 14
2779
2779
  }
2780
2780
  };
2781
- var getButtonVariants = function getButtonVariants(color, isLight, reversed) {
2781
+ var getButtonVariants = function getButtonVariants(color, textColor, reversed) {
2782
2782
  if (reversed === void 0) {
2783
2783
  reversed = false;
2784
2784
  }
2785
- var textColor = isLight ? '#000000' : '#FFFFFF';
2786
2785
  // Determine effective colors based on reversed state
2787
2786
  var effectiveBg = reversed ? textColor : color;
2788
2787
  var effectiveContent = reversed ? color : textColor;
@@ -2909,8 +2908,8 @@ var getButtonVariants = function getButtonVariants(color, isLight, reversed) {
2909
2908
 
2910
2909
  var _excluded$d = ["asComponent", "isDisabled", "isLoading", "isWrapped", "borderRadius", "width", "height", "baseStyles", "sizeStyles", "iconPad", "mainTone", "resolvedTextColor", "children", "borderWidth"],
2911
2910
  _excluded2$3 = ["shape", "isDisabled", "onClick", "shadow", "borderWidth", "isAuto", "isFilled", "views", "children"],
2912
- _excluded3$2 = ["variant", "animation", "to", "isDisabled", "isLoading", "isAuto", "isFilled", "isExternal", "shape", "shadow", "onClick", "views", "baseStyles", "sizeStyles", "iconPad", "resolvedTextColor", "content", "size", "mainTone", "tone", "borderMovingDuration", "borderMovingGradientColors", "animatedStrokeAccentColor", "animatedStrokeTextColor", "getColor"],
2913
- _excluded4$2 = ["variant", "size", "shape", "iconPosition", "loaderPosition", "backgroundColor", "color", "scheme", "reversed", "isAuto", "isFilled", "isDisabled", "isLoading", "isIconRounded", "icon", "children", "to", "isExternal", "shadow", "onClick", "views", "borderMovingDuration", "borderMovingGradientColors", "animatedStrokeAccentColor", "animatedStrokeTextColor"];
2911
+ _excluded3$2 = ["variant", "animation", "to", "isDisabled", "isLoading", "isAuto", "isFilled", "isExternal", "shape", "shadow", "onClick", "views", "baseStyles", "sizeStyles", "iconPad", "resolvedTextColor", "content", "size", "mainTone", "borderMovingDuration", "borderMovingGradientColors", "animatedStrokeAccentColor", "animatedStrokeTextColor", "getColor"],
2912
+ _excluded4$2 = ["variant", "size", "shape", "iconPosition", "loaderPosition", "backgroundColor", "color", "textColor", "reversed", "isAuto", "isFilled", "isDisabled", "isLoading", "isIconRounded", "icon", "children", "to", "isExternal", "shadow", "onClick", "views", "borderMovingDuration", "borderMovingGradientColors", "animatedStrokeAccentColor", "animatedStrokeTextColor"];
2914
2913
  // --- Helper: Button Content ---
2915
2914
  // Renders the inner content: Loader, Icon, and Children.
2916
2915
  var ButtonContent = _ref => {
@@ -3270,7 +3269,7 @@ var StandardButton = _ref4 => {
3270
3269
  // --- Main Component ---
3271
3270
  // --- Main Component ---
3272
3271
  var ButtonView = _ref5 => {
3273
- var _ref6, _ref7, _base$color;
3272
+ var _ref6, _base$color;
3274
3273
  var {
3275
3274
  /* behaviour */
3276
3275
  variant = 'filled',
@@ -3279,13 +3278,13 @@ var ButtonView = _ref5 => {
3279
3278
  iconPosition = 'left',
3280
3279
  loaderPosition = 'left',
3281
3280
  backgroundColor,
3282
- // primary candidate for main color
3281
+ // Primary override for main color
3283
3282
  color,
3284
- // 2nd candidate for main color (NOT text‑color)
3285
- scheme,
3286
- // New scheme prop
3283
+ // Main button color (theme tokens or color palette)
3284
+ textColor,
3285
+ // Explicit text color
3287
3286
  reversed = false,
3288
- // New reversed prop
3287
+ // Reverse colors for dark backgrounds
3289
3288
  isAuto = true,
3290
3289
  isFilled,
3291
3290
  isDisabled,
@@ -3310,24 +3309,18 @@ var ButtonView = _ref5 => {
3310
3309
  props = _objectWithoutPropertiesLoose(_ref5, _excluded4$2);
3311
3310
  /* theme helpers */
3312
3311
  var {
3313
- getColorHex,
3314
- themeMode
3312
+ getColorHex
3315
3313
  } = useTheme();
3316
3314
  /* MAIN COLOR – determines the entire palette */
3317
- var mainColorKey = (_ref6 = (_ref7 = backgroundColor != null ? backgroundColor : color) != null ? _ref7 : scheme) != null ? _ref6 : 'theme.primary';
3315
+ var mainColorKey = (_ref6 = backgroundColor != null ? backgroundColor : color) != null ? _ref6 : 'theme.primary';
3318
3316
  var mainTone = getColorHex(isDisabled ? 'theme.disabled' : mainColorKey);
3319
- var tone = contrast(mainTone);
3320
- /* text color with mixBlendMode for maximum visibility */
3321
- var textColor;
3322
- if (tone === 'light') {
3323
- textColor = '#000000';
3324
- } else {
3325
- textColor = '#FFFFFF';
3326
- }
3317
+ /* text color - explicitly provided or default to white */
3318
+ var resolvedTextColorKey = textColor != null ? textColor : 'color.white';
3319
+ var resolvedTextColor = getColorHex(resolvedTextColorKey);
3327
3320
  /* variant palette */
3328
- var palette = useMemo(() => getButtonVariants(mainTone, tone === 'light', reversed), [mainTone, tone, reversed]);
3321
+ var palette = useMemo(() => getButtonVariants(mainTone, resolvedTextColor, reversed), [mainTone, resolvedTextColor, reversed]);
3329
3322
  var base = palette[variant];
3330
- var resolvedTextColor = (_base$color = base == null ? void 0 : base.color) != null ? _base$color : textColor;
3323
+ var finalContentColor = (_base$color = base == null ? void 0 : base.color) != null ? _base$color : resolvedTextColor;
3331
3324
  // Render content logic safely
3332
3325
  var content = /*#__PURE__*/React.createElement(ButtonContent, {
3333
3326
  icon: icon,
@@ -3335,7 +3328,7 @@ var ButtonView = _ref5 => {
3335
3328
  iconPosition: iconPosition,
3336
3329
  loaderPosition: loaderPosition,
3337
3330
  size: size,
3338
- resolvedTextColor: resolvedTextColor,
3331
+ resolvedTextColor: finalContentColor,
3339
3332
  isIconRounded: isIconRounded,
3340
3333
  views: views
3341
3334
  }, children);
@@ -3358,11 +3351,10 @@ var ButtonView = _ref5 => {
3358
3351
  baseStyles: base,
3359
3352
  sizeStyles: sizeStyles,
3360
3353
  iconPad: iconPad,
3361
- resolvedTextColor: resolvedTextColor,
3354
+ resolvedTextColor: finalContentColor,
3362
3355
  content: content,
3363
3356
  size: size,
3364
3357
  mainTone: mainTone,
3365
- tone: tone,
3366
3358
  borderMovingDuration: borderMovingDuration,
3367
3359
  borderMovingGradientColors: borderMovingGradientColors,
3368
3360
  animatedStrokeAccentColor: animatedStrokeAccentColor,
@@ -25626,7 +25618,7 @@ var _excluded$1o = ["children", "showRadialGradient", "views", "themeMode"],
25626
25618
  _excluded7 = ["children", "src", "backgroundSize", "backgroundPosition", "backgroundRepeat", "backgroundAttachment", "imageOpacity", "overlay", "blendMode", "views", "themeMode"],
25627
25619
  _excluded8 = ["children", "src", "autoPlay", "loop", "muted", "playsInline", "overlay", "blendMode", "views", "themeMode"],
25628
25620
  _excluded9 = ["children"],
25629
- _excluded10 = ["contentPosition"],
25621
+ _excluded10 = ["contentPosition", "backgroundColor"],
25630
25622
  _excluded11 = ["children", "views"],
25631
25623
  _excluded12 = ["children", "designProps", "shape", "decorationRotation", "decorationScale", "decorationOpacity", "views"];
25632
25624
  // Background Context
@@ -26081,23 +26073,34 @@ var BackgroundGradient = _ref9 => {
26081
26073
  */
26082
26074
  var BackgroundOverlay = _ref10 => {
26083
26075
  var {
26084
- contentPosition
26076
+ contentPosition,
26077
+ backgroundColor = 'color.black.900'
26085
26078
  } = _ref10,
26086
26079
  props = _objectWithoutPropertiesLoose(_ref10, _excluded10);
26087
26080
  var getDefaultOverlay = () => {
26081
+ var ligthBackground = backgroundColor + ".100";
26082
+ var darkBackground = backgroundColor + ".900";
26083
+ var midBackground = backgroundColor + ".600";
26084
+ var midDarkBackground = backgroundColor + ".400";
26085
+ if (backgroundColor.indexOf('.') === -1) {
26086
+ ligthBackground = "color-mix(in srgb, " + backgroundColor + " 10%, transparent)";
26087
+ darkBackground = "color-mix(in srgb, " + backgroundColor + " 90%, transparent)";
26088
+ midBackground = "color-mix(in srgb, " + backgroundColor + " 70%, transparent)";
26089
+ midDarkBackground = "color-mix(in srgb, " + backgroundColor + " 50%, transparent)";
26090
+ }
26088
26091
  switch (contentPosition) {
26089
26092
  case 'left':
26090
- return 'radial-gradient(circle at 80% 50%, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.1) 100%), linear-gradient(to right, rgba(0,0,0,1) 0%, rgba(0,0,0,0.6) 80%, rgba(0,0,0,0.2) 100%)';
26093
+ return "radial-gradient(circle at 70% 50%, " + ligthBackground + " 0%, " + ligthBackground + " 100%), linear-gradient(to right, " + darkBackground + " 0%, " + midBackground + " 65%, " + ligthBackground + " 100%)";
26091
26094
  case 'right':
26092
- return 'radial-gradient(circle at 20% 50%, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.1) 100%), linear-gradient(to left, rgba(0,0,0,1) 0%, rgba(0,0,0,0.6) 80%, rgba(0,0,0,0.2) 100%)';
26095
+ return "radial-gradient(circle at 30% 50%, " + ligthBackground + " 0%, " + ligthBackground + " 100%), linear-gradient(to left, " + darkBackground + " 0%, " + midBackground + " 65%, " + ligthBackground + " 100%)";
26093
26096
  case 'top':
26094
- return 'radial-gradient(circle at 50% 80%, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.1) 100%), linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,0.6) 80%, rgba(0,0,0,0.1) 100%)';
26097
+ return "radial-gradient(circle at 50% 40%, " + ligthBackground + " 0%, " + ligthBackground + " 100%), linear-gradient(to bottom, " + darkBackground + " 0%, " + midBackground + " 60%, " + ligthBackground + " 100%)";
26095
26098
  case 'bottom':
26096
- return 'radial-gradient(circle at 50% 80%, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.1) 100%), linear-gradient(to top, rgba(0,0,0,1) 0%, rgba(0,0,0,0.6) 80%, rgba(0,0,0,0.1) 100%)';
26099
+ return "radial-gradient(circle at 50% 60%, " + ligthBackground + " 0%, " + ligthBackground + " 100%), linear-gradient(to top, " + darkBackground + " 0%, " + midBackground + " 60%, " + ligthBackground + " 100%)";
26097
26100
  case 'center':
26098
- return 'radial-gradient(circle at 50% 70%, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%)';
26101
+ return "radial-gradient(circle at 50% 70%, " + darkBackground + " 0%, " + ligthBackground + " 100%)";
26099
26102
  default:
26100
- return 'rgba(0,0,0,0.5)';
26103
+ return midDarkBackground;
26101
26104
  }
26102
26105
  };
26103
26106
  var background = getDefaultOverlay();