@app-studio/web 0.9.78 → 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.
@@ -23,7 +23,7 @@ export interface ButtonProps extends Omit<$ButtonProps, 'size'> {
23
23
  variant?: Variant;
24
24
  animation?: Animation;
25
25
  color?: string;
26
- scheme?: string;
26
+ textColor?: string;
27
27
  reversed?: boolean;
28
28
  borderMovingDuration?: number;
29
29
  borderMovingGradientColors?: string[];
@@ -21,7 +21,7 @@ export declare const ButtonShapes: Record<Shape, number | string>;
21
21
  * Icon sizes for different button sizes
22
22
  */
23
23
  export declare const IconSizes: Record<Size, ViewProps>;
24
- export declare const getButtonVariants: (color: string, isLight: boolean, reversed?: boolean) => Record<Variant, ViewProps>;
24
+ export declare const getButtonVariants: (color: string, textColor: string, reversed?: boolean) => Record<Variant, ViewProps>;
25
25
  /**
26
26
  * Generate offset path for border animation
27
27
  */
@@ -31,7 +31,6 @@ require('core-js/modules/es.parse-int.js');
31
31
  var reactRouterDom = require('react-router-dom');
32
32
  require('core-js/modules/es.parse-float.js');
33
33
  require('core-js/modules/es.string.ends-with.js');
34
- var contrast = _interopDefault(require('contrast'));
35
34
  require('core-js/modules/es.promise.js');
36
35
  require('core-js/modules/es.array.reduce.js');
37
36
  require('core-js/modules/es.number.to-fixed.js');
@@ -42,6 +41,7 @@ require('core-js/modules/es.regexp.exec.js');
42
41
  var formik = require('formik');
43
42
  require('core-js/modules/es.string.replace.js');
44
43
  require('core-js/modules/es.string.split.js');
44
+ var contrast = _interopDefault(require('contrast'));
45
45
  require('core-js/modules/es.promise.finally.js');
46
46
  require('core-js/modules/es.string.match.js');
47
47
  require('core-js/modules/es.string.search.js');
@@ -2785,11 +2785,10 @@ var IconSizes$1 = {
2785
2785
  padding: 14
2786
2786
  }
2787
2787
  };
2788
- var getButtonVariants = function getButtonVariants(color, isLight, reversed) {
2788
+ var getButtonVariants = function getButtonVariants(color, textColor, reversed) {
2789
2789
  if (reversed === void 0) {
2790
2790
  reversed = false;
2791
2791
  }
2792
- var textColor = isLight ? '#000000' : '#FFFFFF';
2793
2792
  // Determine effective colors based on reversed state
2794
2793
  var effectiveBg = reversed ? textColor : color;
2795
2794
  var effectiveContent = reversed ? color : textColor;
@@ -2916,8 +2915,8 @@ var getButtonVariants = function getButtonVariants(color, isLight, reversed) {
2916
2915
 
2917
2916
  var _excluded$d = ["asComponent", "isDisabled", "isLoading", "isWrapped", "borderRadius", "width", "height", "baseStyles", "sizeStyles", "iconPad", "mainTone", "resolvedTextColor", "children", "borderWidth"],
2918
2917
  _excluded2$3 = ["shape", "isDisabled", "onClick", "shadow", "borderWidth", "isAuto", "isFilled", "views", "children"],
2919
- _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"],
2920
- _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"];
2918
+ _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"],
2919
+ _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"];
2921
2920
  // --- Helper: Button Content ---
2922
2921
  // Renders the inner content: Loader, Icon, and Children.
2923
2922
  var ButtonContent = _ref => {
@@ -3277,7 +3276,7 @@ var StandardButton = _ref4 => {
3277
3276
  // --- Main Component ---
3278
3277
  // --- Main Component ---
3279
3278
  var ButtonView = _ref5 => {
3280
- var _ref6, _ref7, _base$color;
3279
+ var _ref6, _base$color;
3281
3280
  var {
3282
3281
  /* behaviour */
3283
3282
  variant = 'filled',
@@ -3286,13 +3285,13 @@ var ButtonView = _ref5 => {
3286
3285
  iconPosition = 'left',
3287
3286
  loaderPosition = 'left',
3288
3287
  backgroundColor,
3289
- // primary candidate for main color
3288
+ // Primary override for main color
3290
3289
  color,
3291
- // 2nd candidate for main color (NOT text‑color)
3292
- scheme,
3293
- // New scheme prop
3290
+ // Main button color (theme tokens or color palette)
3291
+ textColor,
3292
+ // Explicit text color
3294
3293
  reversed = false,
3295
- // New reversed prop
3294
+ // Reverse colors for dark backgrounds
3296
3295
  isAuto = true,
3297
3296
  isFilled,
3298
3297
  isDisabled,
@@ -3317,24 +3316,18 @@ var ButtonView = _ref5 => {
3317
3316
  props = _objectWithoutPropertiesLoose(_ref5, _excluded4$2);
3318
3317
  /* theme helpers */
3319
3318
  var {
3320
- getColorHex,
3321
- themeMode
3319
+ getColorHex
3322
3320
  } = appStudio.useTheme();
3323
3321
  /* MAIN COLOR – determines the entire palette */
3324
- var mainColorKey = (_ref6 = (_ref7 = backgroundColor != null ? backgroundColor : color) != null ? _ref7 : scheme) != null ? _ref6 : 'theme.primary';
3322
+ var mainColorKey = (_ref6 = backgroundColor != null ? backgroundColor : color) != null ? _ref6 : 'theme.primary';
3325
3323
  var mainTone = getColorHex(isDisabled ? 'theme.disabled' : mainColorKey);
3326
- var tone = contrast(mainTone);
3327
- /* text color with mixBlendMode for maximum visibility */
3328
- var textColor;
3329
- if (tone === 'light') {
3330
- textColor = '#000000';
3331
- } else {
3332
- textColor = '#FFFFFF';
3333
- }
3324
+ /* text color - explicitly provided or default to white */
3325
+ var resolvedTextColorKey = textColor != null ? textColor : 'color.white';
3326
+ var resolvedTextColor = getColorHex(resolvedTextColorKey);
3334
3327
  /* variant palette */
3335
- var palette = React.useMemo(() => getButtonVariants(mainTone, tone === 'light', reversed), [mainTone, tone, reversed]);
3328
+ var palette = React.useMemo(() => getButtonVariants(mainTone, resolvedTextColor, reversed), [mainTone, resolvedTextColor, reversed]);
3336
3329
  var base = palette[variant];
3337
- var resolvedTextColor = (_base$color = base == null ? void 0 : base.color) != null ? _base$color : textColor;
3330
+ var finalContentColor = (_base$color = base == null ? void 0 : base.color) != null ? _base$color : resolvedTextColor;
3338
3331
  // Render content logic safely
3339
3332
  var content = /*#__PURE__*/React__default.createElement(ButtonContent, {
3340
3333
  icon: icon,
@@ -3342,7 +3335,7 @@ var ButtonView = _ref5 => {
3342
3335
  iconPosition: iconPosition,
3343
3336
  loaderPosition: loaderPosition,
3344
3337
  size: size,
3345
- resolvedTextColor: resolvedTextColor,
3338
+ resolvedTextColor: finalContentColor,
3346
3339
  isIconRounded: isIconRounded,
3347
3340
  views: views
3348
3341
  }, children);
@@ -3365,11 +3358,10 @@ var ButtonView = _ref5 => {
3365
3358
  baseStyles: base,
3366
3359
  sizeStyles: sizeStyles,
3367
3360
  iconPad: iconPad,
3368
- resolvedTextColor: resolvedTextColor,
3361
+ resolvedTextColor: finalContentColor,
3369
3362
  content: content,
3370
3363
  size: size,
3371
3364
  mainTone: mainTone,
3372
- tone: tone,
3373
3365
  borderMovingDuration: borderMovingDuration,
3374
3366
  borderMovingGradientColors: borderMovingGradientColors,
3375
3367
  animatedStrokeAccentColor: animatedStrokeAccentColor,