@app-studio/web 0.9.79 → 0.9.80

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
@@ -3312,11 +3312,23 @@ var ButtonView = _ref5 => {
3312
3312
  getColorHex
3313
3313
  } = useTheme();
3314
3314
  /* MAIN COLOR – determines the entire palette */
3315
- var mainColorKey = (_ref6 = backgroundColor != null ? backgroundColor : color) != null ? _ref6 : 'theme.primary';
3316
- var mainTone = getColorHex(isDisabled ? 'theme.disabled' : mainColorKey);
3315
+ // Priority: explicit backgroundColor/color prop -> theme.button.background -> theme.primary
3316
+ var mainColorKey = (_ref6 = backgroundColor != null ? backgroundColor : color) != null ? _ref6 : 'theme.button.background';
3317
+ // Decide which theme token to resolve based on state
3318
+ var stateColorKey = isDisabled ? 'theme.disabled' : isLoading ? 'theme.loading' : mainColorKey;
3319
+ // Resolve to actual hex color.
3320
+ // If 'theme.button.background' isn't defined, it falls back to 'theme.primary'
3321
+ var mainTone = getColorHex(stateColorKey);
3322
+ if (mainTone === 'theme.button.background' || mainTone === 'theme.loading') {
3323
+ mainTone = getColorHex(isLoading ? 'color.dark.500' : 'theme.primary');
3324
+ }
3317
3325
  /* text color - explicitly provided or default to white */
3318
- var resolvedTextColorKey = textColor != null ? textColor : 'color.white';
3326
+ // Priority: explicit textColor prop -> theme.button.text -> color.white
3327
+ var resolvedTextColorKey = textColor != null ? textColor : 'theme.button.text';
3319
3328
  var resolvedTextColor = getColorHex(resolvedTextColorKey);
3329
+ if (resolvedTextColor === 'theme.button.text') {
3330
+ resolvedTextColor = getColorHex('color.white');
3331
+ }
3320
3332
  /* variant palette */
3321
3333
  var palette = useMemo(() => getButtonVariants(mainTone, resolvedTextColor, reversed), [mainTone, resolvedTextColor, reversed]);
3322
3334
  var base = palette[variant];
@@ -3389,50 +3401,57 @@ var Button = ButtonComponent;
3389
3401
  * - Rounded corners: Consistent border radius
3390
3402
  * - Transitions: Subtle animations
3391
3403
  */
3404
+ /**
3405
+ * Card sizes following the 4px grid system
3406
+ */
3407
+ var CardSizes = {
3408
+ sm: {
3409
+ padding: '12px'
3410
+ },
3411
+ md: {
3412
+ padding: '16px'
3413
+ },
3414
+ lg: {
3415
+ padding: '24px'
3416
+ }
3417
+ };
3392
3418
  /**
3393
3419
  * Card shapes with consistent border radius
3394
3420
  */
3395
3421
  var CardShapes = {
3396
3422
  sharp: 0,
3397
3423
  rounded: '8px',
3398
- pillShaped: '16px'
3424
+ pillShaped: '24px'
3399
3425
  };
3400
3426
  /**
3401
3427
  * Get card variants with consistent styling based on theme mode
3402
3428
  */
3403
3429
  var getCardVariants = themeMode => {
3430
+ var isDark = themeMode === 'dark';
3404
3431
  return {
3405
3432
  default: {
3406
- backgroundColor: 'color.white',
3433
+ backgroundColor: isDark ? 'color.gray.900' : 'color.white',
3407
3434
  border: 'none',
3408
3435
  transition: 'background-color 0.2s ease, box-shadow 0.2s ease'
3409
3436
  },
3410
3437
  outlined: {
3411
- backgroundColor: 'color.white',
3438
+ backgroundColor: isDark ? 'color.gray.900' : 'color.white',
3412
3439
  borderWidth: '1px',
3413
3440
  borderStyle: 'solid',
3414
- borderColor: 'color.gray.200',
3441
+ borderColor: isDark ? 'color.gray.700' : 'color.gray.200',
3415
3442
  transition: 'border-color 0.2s ease, box-shadow 0.2s ease',
3416
3443
  _hover: {
3417
- borderColor: 'color.gray.300',
3444
+ borderColor: isDark ? 'color.gray.600' : 'color.gray.300',
3418
3445
  boxShadow: '0px 1px 3px rgba(0, 0, 0, 0.05)'
3419
- },
3420
- _focusVisible: {
3421
- outline: 'none',
3422
- boxShadow: '0 0 0 2px rgba(255, 255, 255, 1), 0 0 0 4px rgba(0, 0, 0, 0.1)'
3423
3446
  }
3424
3447
  },
3425
3448
  elevated: {
3426
- backgroundColor: 'color.white',
3427
- boxShadow: '0px 1px 3px rgba(0, 0, 0, 0.08), 0px 1px 2px rgba(0, 0, 0, 0.06)',
3449
+ backgroundColor: isDark ? 'color.gray.900' : 'color.white',
3450
+ boxShadow: isDark ? '0px 4px 12px rgba(0, 0, 0, 0.3)' : '0px 1px 3px rgba(0, 0, 0, 0.08), 0px 1px 2px rgba(0, 0, 0, 0.06)',
3428
3451
  border: 'none',
3429
3452
  transition: 'box-shadow 0.2s ease',
3430
3453
  _hover: {
3431
- boxShadow: '0px 4px 6px rgba(0, 0, 0, 0.08), 0px 2px 4px rgba(0, 0, 0, 0.06)'
3432
- },
3433
- _focusVisible: {
3434
- outline: 'none',
3435
- boxShadow: '0 0 0 2px rgba(255, 255, 255, 1), 0 0 0 4px rgba(0, 0, 0, 0.1), 0px 4px 6px rgba(0, 0, 0, 0.08)'
3454
+ boxShadow: isDark ? '0px 8px 16px rgba(0, 0, 0, 0.4)' : '0px 4px 6px rgba(0, 0, 0, 0.08), 0px 2px 4px rgba(0, 0, 0, 0.06)'
3436
3455
  }
3437
3456
  }
3438
3457
  };
@@ -3442,50 +3461,31 @@ var getCardVariants = themeMode => {
3442
3461
  * @param theme - Theme object from useTheme hook
3443
3462
  */
3444
3463
  var getDefaultCardStyles = theme => {
3464
+ var isDark = theme.themeMode === 'dark';
3445
3465
  return {
3446
3466
  container: {
3447
- backgroundColor: 'color.white',
3448
- color: 'color.black',
3467
+ backgroundColor: isDark ? 'color.gray.900' : 'color.white',
3468
+ color: isDark ? 'color.white' : 'color.black',
3449
3469
  borderRadius: '8px',
3450
3470
  overflow: 'hidden',
3451
- transition: 'all 0.2s ease',
3452
- media: {
3453
- mobile: {
3454
- borderRadius: '4px'
3455
- }
3456
- }
3471
+ transition: 'all 0.2s ease'
3457
3472
  },
3458
3473
  header: {
3459
3474
  padding: '16px',
3460
3475
  borderBottomWidth: '1px',
3461
3476
  borderBottomStyle: 'solid',
3462
- borderBottomColor: 'color.gray.200',
3463
- color: 'color.black',
3464
- media: {
3465
- mobile: {
3466
- padding: '12px'
3467
- }
3468
- }
3477
+ borderBottomColor: isDark ? 'color.gray.800' : 'color.gray.100',
3478
+ color: 'theme.primary'
3469
3479
  },
3470
3480
  content: {
3471
3481
  padding: '16px',
3472
- color: 'color.black',
3473
- media: {
3474
- mobile: {
3475
- padding: '12px'
3476
- }
3477
- }
3482
+ color: isDark ? 'color.gray.300' : 'color.gray.600'
3478
3483
  },
3479
3484
  footer: {
3480
3485
  padding: '16px',
3481
3486
  borderTopWidth: '1px',
3482
3487
  borderTopStyle: 'solid',
3483
- borderTopColor: 'color.gray.200',
3484
- media: {
3485
- mobile: {
3486
- padding: '12px'
3487
- }
3488
- }
3488
+ borderTopColor: isDark ? 'color.gray.800' : 'color.gray.100'
3489
3489
  }
3490
3490
  };
3491
3491
  };
@@ -3510,12 +3510,14 @@ var CardHeader = _ref => {
3510
3510
  var {
3511
3511
  styles: contextStyles
3512
3512
  } = useCardContext();
3513
- var defaultStyles = getDefaultCardStyles().header;
3513
+ var defaultStyles = getDefaultCardStyles(theme).header;
3514
3514
  // Merge styles: Default < Context Override < Direct Props/Style
3515
3515
  var mergedProps = Object.assign({}, defaultStyles, contextStyles == null ? void 0 : contextStyles.header, props, {
3516
3516
  style: Object.assign({}, defaultStyles == null ? void 0 : defaultStyles.style, contextStyles == null || (_contextStyles$header = contextStyles.header) == null ? void 0 : _contextStyles$header.style, style)
3517
3517
  });
3518
- return /*#__PURE__*/React.createElement(View, Object.assign({}, mergedProps), children);
3518
+ return /*#__PURE__*/React.createElement(Vertical, Object.assign({
3519
+ gap: 8
3520
+ }, mergedProps), children);
3519
3521
  };
3520
3522
  var CardContent = _ref2 => {
3521
3523
  var _contextStyles$conten;
@@ -3528,12 +3530,14 @@ var CardContent = _ref2 => {
3528
3530
  var {
3529
3531
  styles: contextStyles
3530
3532
  } = useCardContext();
3531
- var defaultStyles = getDefaultCardStyles().content;
3533
+ var defaultStyles = getDefaultCardStyles(theme).content;
3532
3534
  // Merge styles: Default < Context Override < Direct Props/Style
3533
3535
  var mergedProps = Object.assign({}, defaultStyles, contextStyles == null ? void 0 : contextStyles.content, props, {
3534
3536
  style: Object.assign({}, defaultStyles == null ? void 0 : defaultStyles.style, contextStyles == null || (_contextStyles$conten = contextStyles.content) == null ? void 0 : _contextStyles$conten.style, style)
3535
3537
  });
3536
- return /*#__PURE__*/React.createElement(View, Object.assign({}, mergedProps), children);
3538
+ return /*#__PURE__*/React.createElement(Vertical, Object.assign({
3539
+ gap: 12
3540
+ }, mergedProps), children);
3537
3541
  };
3538
3542
  var CardFooter = _ref3 => {
3539
3543
  var _contextStyles$footer;
@@ -3546,15 +3550,17 @@ var CardFooter = _ref3 => {
3546
3550
  var {
3547
3551
  styles: contextStyles
3548
3552
  } = useCardContext();
3549
- var defaultStyles = getDefaultCardStyles().footer;
3553
+ var defaultStyles = getDefaultCardStyles(theme).footer;
3550
3554
  // Merge styles: Default < Context Override < Direct Props/Style
3551
3555
  var mergedProps = Object.assign({}, defaultStyles, contextStyles == null ? void 0 : contextStyles.footer, props, {
3552
3556
  style: Object.assign({}, defaultStyles == null ? void 0 : defaultStyles.style, contextStyles == null || (_contextStyles$footer = contextStyles.footer) == null ? void 0 : _contextStyles$footer.style, style)
3553
3557
  });
3554
- return /*#__PURE__*/React.createElement(View, Object.assign({}, mergedProps), children);
3558
+ return /*#__PURE__*/React.createElement(Vertical, Object.assign({
3559
+ gap: 8
3560
+ }, mergedProps), children);
3555
3561
  };
3556
3562
  var CardView = _ref4 => {
3557
- var _contextValue$styles$;
3563
+ var _CardSizes$size, _contextValue$styles$;
3558
3564
  var {
3559
3565
  variant = 'default',
3560
3566
  size = 'md',
@@ -3569,20 +3575,32 @@ var CardView = _ref4 => {
3569
3575
  } = _ref4,
3570
3576
  props = _objectWithoutPropertiesLoose(_ref4, _excluded4$3);
3571
3577
  var theme = useTheme();
3572
- var defaultStyles = getDefaultCardStyles();
3578
+ var defaultStyles = getDefaultCardStyles(theme);
3579
+ // Get size padding
3580
+ var sizePadding = ((_CardSizes$size = CardSizes[size]) == null ? void 0 : _CardSizes$size.padding) || '16px';
3573
3581
  // Prepare context value, merging default styles with user's `views` overrides
3574
3582
  var contextValue = useMemo(() => ({
3575
3583
  styles: {
3576
3584
  container: Object.assign({}, defaultStyles.container, views == null ? void 0 : views.container),
3577
- header: Object.assign({}, defaultStyles.header, views == null ? void 0 : views.header),
3578
- content: Object.assign({}, defaultStyles.content, views == null ? void 0 : views.content),
3579
- footer: Object.assign({}, defaultStyles.footer, views == null ? void 0 : views.footer)
3580
- }
3581
- }), [defaultStyles, views]);
3585
+ header: Object.assign({}, defaultStyles.header, {
3586
+ padding: sizePadding
3587
+ }, views == null ? void 0 : views.header),
3588
+ content: Object.assign({}, defaultStyles.content, {
3589
+ padding: sizePadding
3590
+ }, views == null ? void 0 : views.content),
3591
+ footer: Object.assign({}, defaultStyles.footer, {
3592
+ padding: sizePadding
3593
+ }, views == null ? void 0 : views.footer)
3594
+ }
3595
+ }), [defaultStyles, views, sizePadding]);
3582
3596
  // Determine if we have explicit Card.Header, Card.Content, Card.Footer components
3583
- // or if we need to wrap children in a default layout
3584
3597
  var hasExplicitStructure = React.Children.toArray(children).some(child => /*#__PURE__*/React.isValidElement(child) && (child.type === CardHeader || child.type === CardContent || child.type === CardFooter));
3585
- var variantStyles = getCardVariants()[variant];
3598
+ // Get the appropriate variant styles based on theme mode
3599
+ var {
3600
+ themeMode
3601
+ } = theme;
3602
+ var currentThemeMode = elementMode || themeMode;
3603
+ var variantStyles = getCardVariants(currentThemeMode)[variant];
3586
3604
  // Merge styles for the root element
3587
3605
  var mergedRootProps = Object.assign({
3588
3606
  width: isFullWidth ? '100%' : 'auto',
@@ -3593,7 +3611,9 @@ var CardView = _ref4 => {
3593
3611
  });
3594
3612
  return /*#__PURE__*/React.createElement(CardContext.Provider, {
3595
3613
  value: contextValue
3596
- }, /*#__PURE__*/React.createElement(View, Object.assign({}, mergedRootProps), hasExplicitStructure ? children : (/*#__PURE__*/React.createElement(Vertical, null, header && /*#__PURE__*/React.createElement(CardHeader, null, header), /*#__PURE__*/React.createElement(CardContent, null, children), footer && /*#__PURE__*/React.createElement(CardFooter, null, footer)))));
3614
+ }, /*#__PURE__*/React.createElement(View, Object.assign({}, mergedRootProps), hasExplicitStructure ? children : (/*#__PURE__*/React.createElement(Vertical, {
3615
+ width: "100%"
3616
+ }, header && /*#__PURE__*/React.createElement(CardHeader, null, header), /*#__PURE__*/React.createElement(CardContent, null, children), footer && /*#__PURE__*/React.createElement(CardFooter, null, footer)))));
3597
3617
  };
3598
3618
 
3599
3619
  /**
@@ -7329,12 +7349,9 @@ var ColorSchemes = {
7329
7349
  // State-specific colors
7330
7350
  states: {
7331
7351
  hover: {
7332
- active: {
7333
- opacity: 0.9
7334
- },
7335
- inactive: {
7336
- backgroundColor: 'color.gray.400'
7337
- }
7352
+ active: 'theme.primary',
7353
+ inactive: 'color.gray.400',
7354
+ activeOpacity: 0.9
7338
7355
  },
7339
7356
  focus: {
7340
7357
  active: {
@@ -7348,6 +7365,17 @@ var ColorSchemes = {
7348
7365
  }
7349
7366
  }
7350
7367
  };
7368
+ /**
7369
+ * Transition styles for the Switch component
7370
+ */
7371
+ var TransitionStyles = {
7372
+ slider: {
7373
+ transition: 'all 0.3s cubic-bezier(0.4, 0, 0.2, 1)'
7374
+ },
7375
+ knob: {
7376
+ transition: 'all 0.3s cubic-bezier(0.4, 0, 0.2, 1)'
7377
+ }
7378
+ };
7351
7379
 
7352
7380
  var _excluded$t = ["id", "name", "label", "inActiveChild", "isChecked", "activeChild", "labelPosition", "shadow", "size", "value", "isHovered", "isDisabled", "isReadOnly", "on", "setOn", "onChange", "setValue", "setIsHovered", "helperText", "views"];
7353
7381
  var SwitchContent = props => /*#__PURE__*/React.createElement(Input, Object.assign({
@@ -7386,7 +7414,8 @@ var SwitchView = _ref => {
7386
7414
  if (onChange) onChange(newValue);
7387
7415
  }
7388
7416
  };
7389
- var handleHover = () => setIsHovered(!isHovered);
7417
+ var handleMouseEnter = () => setIsHovered(true);
7418
+ var handleMouseLeave = () => setIsHovered(false);
7390
7419
  /**
7391
7420
  * Styles for the switch component
7392
7421
  */
@@ -7408,8 +7437,8 @@ var SwitchView = _ref => {
7408
7437
  };
7409
7438
  return /*#__PURE__*/React.createElement(Label, Object.assign({
7410
7439
  htmlFor: id,
7411
- onMouseEnter: handleHover,
7412
- onMouseLeave: handleHover
7440
+ onMouseEnter: handleMouseEnter,
7441
+ onMouseLeave: handleMouseLeave
7413
7442
  }, switchStyle.container, props), /*#__PURE__*/React.createElement(SwitchContent, Object.assign({
7414
7443
  id: id,
7415
7444
  name: name,
@@ -7437,12 +7466,10 @@ var SwitchView = _ref => {
7437
7466
  borderRadius: "9999px" // Full rounded for pill shape
7438
7467
  ,
7439
7468
  backgroundColor: isDisabled ? ColorSchemes.default.disabled : value ? isHovered ? ColorSchemes.states.hover.active : ColorSchemes.default.active : isHovered ? ColorSchemes.states.hover.inactive : ColorSchemes.default.inactive,
7440
- overflow: "hidden",
7469
+ opacity: !isDisabled && value && isHovered ? ColorSchemes.states.hover.activeOpacity : 1,
7441
7470
  // State properties
7442
- cursor: "pointer",
7443
- // Animation
7444
- transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
7445
- }, shadow, SliderPadding[size], SliderSizes[size], views['slider']), activeChild && value && (/*#__PURE__*/React.createElement(View, {
7471
+ cursor: "pointer"
7472
+ }, TransitionStyles.slider, shadow, SliderPadding[size], SliderSizes[size], views['slider']), activeChild && value && (/*#__PURE__*/React.createElement(View, {
7446
7473
  marginLeft: 8,
7447
7474
  marginRight: 4,
7448
7475
  transition: "all 0.3s ease",
@@ -7453,8 +7480,9 @@ var SwitchView = _ref => {
7453
7480
  }, activeChild)), /*#__PURE__*/React.createElement(View, Object.assign({
7454
7481
  borderRadius: "50%",
7455
7482
  backgroundColor: ColorSchemes.default.knob,
7456
- boxShadow: "0 1px 2px rgba(0, 0, 0, 0.1)",
7457
- transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
7483
+ boxShadow: isHovered ? '0 2px 4px rgba(0, 0, 0, 0.2)' : '0 1px 2px rgba(0, 0, 0, 0.1)',
7484
+ transform: isHovered ? 'scale(1.05)' : 'scale(1)'
7485
+ }, TransitionStyles.knob, {
7458
7486
  zIndex: 1
7459
7487
  }, KnobSizes[size], views['circle'])), inActiveChild && !value && (/*#__PURE__*/React.createElement(View, {
7460
7488
  marginRight: 8,
@@ -11266,29 +11294,32 @@ var TagChip = _ref => {
11266
11294
  alignItems: "center",
11267
11295
  gap: 6,
11268
11296
  padding: chipSize.padding,
11269
- backgroundColor: "white",
11297
+ backgroundColor: "color.gray.100",
11270
11298
  borderRadius: "16px",
11271
- border: "1px solid",
11272
- borderColor: "color.black.100",
11299
+ borderWidth: "1px",
11300
+ borderStyle: "solid",
11301
+ borderColor: "color.gray.300",
11273
11302
  boxShadow: "0 1px 2px rgba(0,0,0,0.05)",
11274
11303
  transition: "all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
11275
11304
  opacity: isDisabled ? 0.6 : 1,
11276
11305
  _hover: !isDisabled && !isReadOnly ? {
11277
- borderColor: 'color.gray.300',
11306
+ backgroundColor: 'color.gray.200',
11307
+ borderColor: 'color.gray.400',
11278
11308
  boxShadow: '0 4px 6px rgba(0,0,0,0.05)',
11279
11309
  transform: 'translateY(-1px)'
11280
11310
  } : {}
11281
11311
  }, views == null ? void 0 : views.tag), /*#__PURE__*/React.createElement(Text, Object.assign({
11282
11312
  fontSize: chipSize.fontSize,
11283
- color: isDisabled ? 'color.gray.400' : 'color.gray.700',
11284
- fontWeight: "500",
11313
+ color: isDisabled ? 'color.gray.400' : 'theme.primary',
11314
+ fontWeight: "bold",
11285
11315
  whiteSpace: "nowrap"
11286
11316
  }, views == null ? void 0 : views.tagText), tag), isRemovable && !isDisabled && !isReadOnly && (/*#__PURE__*/React.createElement(View, Object.assign({
11287
11317
  cursor: "pointer",
11288
11318
  padding: "2px",
11289
11319
  borderRadius: "50%",
11290
11320
  transition: "all 0.2s ease",
11291
- backgroundColor: isRemoveHovered ? 'color.red.50' : 'transparent',
11321
+ backgroundColor: isRemoveHovered ? 'color.red.100' : 'transparent',
11322
+ opacity: isRemoveHovered ? 1 : 0.7,
11292
11323
  onMouseEnter: () => setIsRemoveHovered(true),
11293
11324
  onMouseLeave: () => setIsRemoveHovered(false),
11294
11325
  onClick: e => {
@@ -11355,7 +11386,7 @@ var TagInputView = _ref2 => {
11355
11386
  outline: 'none',
11356
11387
  backgroundColor: 'transparent',
11357
11388
  fontSize: Typography.fontSizes[size],
11358
- color: isDisabled ? 'color.gray.400' : 'color.gray.900',
11389
+ color: isDisabled ? 'color.gray.400' : 'color.gray.800',
11359
11390
  flex: 1,
11360
11391
  minWidth: '120px'
11361
11392
  }, views == null ? void 0 : views.input);