@rabex-kit/rabex-ui 0.1.4 → 0.1.7

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.
@@ -7,5 +7,5 @@ export declare type ButtonProps = Omit<MuiButtonProps, 'size' | 'color' | 'compo
7
7
  variant?: 'contained' | 'containedSecondary' | 'outlined' | 'text';
8
8
  component?: React.ElementType;
9
9
  };
10
- declare const Button: React.FC<ButtonProps>;
10
+ declare const Button: React.ForwardRefExoticComponent<Pick<ButtonProps, "form" | "slot" | "style" | "title" | "className" | "classes" | "action" | "centerRipple" | "children" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "tabIndex" | "TouchRippleProps" | "touchRippleRef" | "color" | "translate" | "disableElevation" | "disableFocusRipple" | "endIcon" | "fullWidth" | "href" | "size" | "startIcon" | "variant" | "key" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "component" | "isIcon"> & React.RefAttributes<HTMLButtonElement>>;
11
11
  export default Button;
@@ -813,7 +813,6 @@ var typographySizes = {
813
813
  weight: 'semiBold'
814
814
  }
815
815
  };
816
- // Define icon sizes for different button sizes
817
816
  var iconSizes = {
818
817
  xs: 16,
819
818
  sm: 16,
@@ -821,22 +820,12 @@ var iconSizes = {
821
820
  lg: 24,
822
821
  xl: 24
823
822
  };
824
- /**
825
- * Buttons allow users to take actions, and make choices, with a single tap.
826
- *
827
- * This is a custom wrapper component made of Material-UI Button.
828
- *
829
- * You can read Material-UI Button Documentation [here](https://mui.com/material-ui/api/Button/).
830
- *
831
- * ```typescript
832
- * import { Button } from '@rabex-kit/core';
833
- * ```
834
- *
835
- *
836
- * @param props
837
- * @returns
838
- */
839
- var StyledButton = /*#__PURE__*/styled(MuiButton)(function (_ref) {
823
+ // Styled button with shouldForwardProp to exclude 'isIcon' from DOM
824
+ var StyledButton = /*#__PURE__*/styled(MuiButton, {
825
+ shouldForwardProp: function shouldForwardProp(prop) {
826
+ return prop !== 'isIcon';
827
+ }
828
+ })(function (_ref) {
840
829
  var size = _ref.size;
841
830
  return {
842
831
  display: 'flex',
@@ -852,20 +841,21 @@ var StyledButton = /*#__PURE__*/styled(MuiButton)(function (_ref) {
852
841
  }
853
842
  };
854
843
  });
855
- var Button = function Button(props) {
844
+ var Button = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
856
845
  var _props$size = props.size,
857
846
  size = _props$size === void 0 ? 'md' : _props$size,
858
847
  isIcon = props.isIcon,
859
848
  children = props.children,
860
849
  rest = _objectWithoutPropertiesLoose(props, _excluded$2);
861
850
  return React__default.createElement(StyledButton, Object.assign({
851
+ ref: ref,
862
852
  size: size,
863
853
  isIcon: isIcon
864
854
  }, rest), isIcon ? children : React__default.createElement(Typography, {
865
855
  variant: typographySizes[size].variant,
866
856
  weight: typographySizes[size].weight
867
857
  }, children));
868
- };
858
+ });
869
859
  Button.defaultProps = {
870
860
  variant: 'contained',
871
861
  size: 'md',
@@ -2491,43 +2481,49 @@ var components = {
2491
2481
  var palette = _ref2.theme.palette,
2492
2482
  ownerState = _ref2.ownerState;
2493
2483
  var color = (ownerState === null || ownerState === void 0 ? void 0 : ownerState.color) || 'primary';
2484
+ var primaryColor = palette.primary[500] || palette[color].A100;
2485
+ var textColor = palette.text[50] || palette[color].A0;
2486
+ var disableBackgroundColor = palette.primary[400] || palette[color].A60;
2494
2487
  return {
2495
2488
  // backgroundColor: palette[color].A100,
2496
- backgroundColor: palette.primary[500],
2489
+ backgroundColor: primaryColor,
2497
2490
  '&:hover': {
2498
- backgroundColor: colorManipulator_js.darken(palette.primary[500], 0.1)
2491
+ backgroundColor: colorManipulator_js.darken(primaryColor, 0.1)
2499
2492
  },
2500
2493
  '&:active': {
2501
- backgroundColor: colorManipulator_js.darken(palette.primary[500], 0.1)
2494
+ backgroundColor: colorManipulator_js.darken(primaryColor, 0.1)
2502
2495
  },
2503
2496
  '&:focused': {
2504
- backgroundColor: colorManipulator_js.darken(palette.primary[500], 0.1),
2497
+ backgroundColor: colorManipulator_js.darken(primaryColor, 0.1),
2505
2498
  boxShadow: '0px 0px 0px 4px #0000000D'
2506
2499
  },
2507
2500
  '&.Mui-disabled': {
2508
- color: palette.mode === 'light' ? palette.textColor[50] : palette.textColor.A90,
2509
- backgroundColor: palette.mode === 'light' ? palette.primary[400] : colorManipulator_js.darken(palette[color].A100, 0.1)
2501
+ color: palette.mode === 'light' ? textColor : palette.textColor.A90,
2502
+ backgroundColor: palette.mode === 'light' ? disableBackgroundColor : colorManipulator_js.darken(palette[color].A100, 0.1)
2510
2503
  }
2511
2504
  };
2512
2505
  },
2513
2506
  containedSecondary: function containedSecondary(_ref3) {
2514
2507
  var palette = _ref3.theme.palette;
2508
+ var secondaryColor = palette.secondary[500] || palette.secondary.A100;
2509
+ var textColor = palette.textColor[900] || palette.textColor.A80;
2510
+ var hoverColor = palette.secondary[600] || colorManipulator_js.darken(palette.secondary.A100, 0.05);
2515
2511
  return {
2516
- backgroundColor: palette.mode === 'light' ? palette.secondary[500] : palette.secondary.A60,
2517
- color: palette.mode === 'light' ? palette.textColor[900] : palette.textColor.A0,
2512
+ backgroundColor: palette.mode === 'light' ? secondaryColor : palette.secondary.A60,
2513
+ color: palette.mode === 'light' ? textColor : palette.textColor.A0,
2518
2514
  '&:hover': {
2519
- backgroundColor: palette.mode === 'light' ? palette.secondary[600] : palette.secondary.A60
2515
+ backgroundColor: palette.mode === 'light' ? hoverColor : palette.secondary.A60
2520
2516
  },
2521
2517
  '&:active': {
2522
- backgroundColor: palette.mode === 'light' ? palette.secondary[600] : palette.secondary.A60,
2518
+ backgroundColor: palette.mode === 'light' ? palette.secondary[600] || colorManipulator_js.darken(palette.secondary.A100, 0.05) : palette.secondary.A60,
2523
2519
  boxShadow: '0px 0px 0px 4px #0000000D'
2524
2520
  },
2525
2521
  '&:focused': {
2526
- backgroundColor: palette.mode === 'light' ? palette.secondary[600] : palette.secondary.A60,
2522
+ backgroundColor: palette.mode === 'light' ? palette.secondary[600] || colorManipulator_js.darken(palette.secondary.A100, 0.05) : palette.secondary.A60,
2527
2523
  boxShadow: '0px 0px 0px 4px #0000000D'
2528
2524
  },
2529
2525
  '&.Mui-disabled': {
2530
- color: palette.textColor[100],
2526
+ color: palette.textColor[100] || palette.textColor.A40,
2531
2527
  backgroundColor: palette.mode === 'light' ? palette.secondary[400] : palette.secondary.A60
2532
2528
  }
2533
2529
  };
@@ -2538,24 +2534,24 @@ var components = {
2538
2534
  var color = (ownerState === null || ownerState === void 0 ? void 0 : ownerState.color) || 'primary';
2539
2535
  return {
2540
2536
  backgroundColor: 'transparent',
2541
- color: color === 'primary' ? palette.primary[500] : palette[color].A100,
2537
+ color: color === 'primary' ? palette.primary[500] || palette[color].A100 : palette[color].A100,
2542
2538
  border: '1.5px solid',
2543
- borderColor: color === 'primary' ? palette.primary[500] : palette[color].A100,
2539
+ borderColor: color === 'primary' ? palette.primary[500] || palette[color].A100 : palette[color].A100,
2544
2540
  '&:hover': {
2545
- backgroundColor: palette.mode === 'light' ? color === 'primary' ? palette.primary[500] : palette.secondary.A60 : 'transparent',
2541
+ backgroundColor: palette.mode === 'light' ? color === 'primary' ? palette.primary[500] || palette[color].A100 : palette.secondary.A60 : 'transparent',
2546
2542
  border: '1px solid',
2547
- borderColor: color === 'primary' ? palette.primary[600] : palette[color].A100,
2548
- color: palette.textColor[50]
2543
+ borderColor: color === 'primary' ? palette.primary[600] || palette[color].A100 : palette[color].A100,
2544
+ color: palette.textColor[50] || palette[color].A0
2549
2545
  },
2550
2546
  '&:focused': {
2551
2547
  boxShadow: '0px 0px 0px 4px #0000000D',
2552
2548
  border: '1px solid',
2553
2549
  borderColor: color === 'primary' ? palette.primary[500] : palette[color].A100,
2554
- color: palette.textColor[50]
2550
+ color: palette.textColor[50] || palette[color].A0
2555
2551
  },
2556
2552
  '&.Mui-disabled': {
2557
- borderColor: palette.mode === 'light' ? color === 'primary' ? palette.primary[400] : palette[color].A60 : colorManipulator_js.alpha(palette[color].A100, 0.3),
2558
- color: palette.mode === 'light' ? color === 'primary' ? palette.primary[400] : palette[color].A60 : colorManipulator_js.alpha(palette[color].A100, 0.3)
2553
+ borderColor: palette.mode === 'light' ? color === 'primary' ? palette.primary[400] || palette[color].A60 : palette[color].A60 : colorManipulator_js.alpha(palette[color].A100, 0.3),
2554
+ color: palette.mode === 'light' ? color === 'primary' ? palette.primary[400] || palette[color].A60 : palette[color].A60 : colorManipulator_js.alpha(palette[color].A100, 0.3)
2559
2555
  }
2560
2556
  };
2561
2557
  },
@@ -2565,7 +2561,7 @@ var components = {
2565
2561
  var color = (ownerState === null || ownerState === void 0 ? void 0 : ownerState.color) || 'primary';
2566
2562
  return {
2567
2563
  backgroundColor: 'transparent',
2568
- color: palette.mode === 'light' ? palette.textColor[900] : palette[color].A100,
2564
+ color: palette.mode === 'light' ? palette.textColor[900] || palette.textColor.A80 : palette[color].A100,
2569
2565
  border: 'none',
2570
2566
  '&:hover': {
2571
2567
  backgroundColor: palette.mode === 'light' ? palette.secondary.A80 : colorManipulator_js.alpha(palette.secondary.A100, 0.7)
@@ -2582,7 +2578,7 @@ var components = {
2582
2578
  '&.Mui-disabled': {
2583
2579
  backgroundColor: 'transparent',
2584
2580
  borderColor: 'none',
2585
- color: palette.mode === 'light' ? palette.textColor[100] : colorManipulator_js.alpha(palette[color].A100, 0.3)
2581
+ color: palette.mode === 'light' ? palette.textColor[100] || palette.textColor.A40 : colorManipulator_js.alpha(palette[color].A100, 0.3)
2586
2582
  }
2587
2583
  };
2588
2584
  }