@rabex-kit/rabex-ui 0.2.5 → 0.2.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.
@@ -9,7 +9,7 @@ export declare type GridProps = MuiGridProps;
9
9
  * You can read Material-UI Button Documentation [here](https://mui.com/material-ui/react-grid2/).
10
10
  *
11
11
  * ```typescript
12
- * import { Grid } from '@rabex-kit/core';
12
+ * import { Grid } from '@rabex-kit/rabex-ui';
13
13
  * ```
14
14
  *
15
15
  *
@@ -1,5 +1,16 @@
1
1
  /// <reference types="react" />
2
2
  import { IconButtonProps as MuiIconButtonProps } from '@mui/material';
3
+ declare module '@mui/material/IconButton' {
4
+ interface IconButtonPropsSizeOverrides {
5
+ xs: true;
6
+ sm: true;
7
+ md: true;
8
+ lg: true;
9
+ small: false;
10
+ medium: false;
11
+ large: false;
12
+ }
13
+ }
3
14
  export interface IconButtonProps extends MuiIconButtonProps {
4
15
  variant?: 'circular' | 'square' | 'rounded';
5
16
  hasBg?: boolean;
@@ -7,12 +18,11 @@ export interface IconButtonProps extends MuiIconButtonProps {
7
18
  bgColor?: string;
8
19
  }
9
20
  /**
10
- *
11
21
  * Icon buttons are commonly found in app bars and toolbars.
12
22
  * Icons are also appropriate for toggle buttons that allow a single choice to be selected or deselected,
13
23
  * such as adding or removing a star to an item.
14
24
  *
15
- * You can read Material-UI Button Documentation [here](https://mui.com/material-ui/api/icon-button/).
25
+ * You can read Material-UI IconButton Documentation [here](https://mui.com/material-ui/api/icon-button/).
16
26
  *
17
27
  * ```typescript
18
28
  * import { IconButton } from '@rabex-kit/rabex-ui';
@@ -6,20 +6,27 @@ declare const _default: {
6
6
  ownerState: any;
7
7
  theme: any;
8
8
  }) => {
9
- borderRadius?: string | number;
9
+ color: string;
10
+ '&:hover': {
11
+ backgroundColor: string;
12
+ };
10
13
  };
11
14
  };
12
15
  variants: ({
13
16
  props: Partial<IconButtonProps>;
14
17
  style: ({ theme, ownerState }: any) => {
18
+ backgroundColor: any;
15
19
  '&:hover': {
16
20
  backgroundColor: any;
17
21
  };
18
22
  };
19
23
  } | {
20
24
  props: Partial<IconButtonProps>;
21
- style: () => {
22
- color: string;
25
+ style: ({ theme }: any) => {
26
+ color: any;
27
+ '&:hover': {
28
+ backgroundColor: any;
29
+ };
23
30
  };
24
31
  })[];
25
32
  };
@@ -1257,7 +1257,7 @@ var FormLabel = function FormLabel(_ref) {
1257
1257
  * You can read Material-UI Button Documentation [here](https://mui.com/material-ui/react-grid2/).
1258
1258
  *
1259
1259
  * ```typescript
1260
- * import { Grid } from '@rabex-kit/core';
1260
+ * import { Grid } from '@rabex-kit/rabex-ui';
1261
1261
  * ```
1262
1262
  *
1263
1263
  *
@@ -1270,12 +1270,11 @@ var Grid = function Grid(_ref) {
1270
1270
  };
1271
1271
 
1272
1272
  /**
1273
- *
1274
1273
  * Icon buttons are commonly found in app bars and toolbars.
1275
1274
  * Icons are also appropriate for toggle buttons that allow a single choice to be selected or deselected,
1276
1275
  * such as adding or removing a star to an item.
1277
1276
  *
1278
- * You can read Material-UI Button Documentation [here](https://mui.com/material-ui/api/icon-button/).
1277
+ * You can read Material-UI IconButton Documentation [here](https://mui.com/material-ui/api/icon-button/).
1279
1278
  *
1280
1279
  * ```typescript
1281
1280
  * import { IconButton } from '@rabex-kit/rabex-ui';
@@ -1287,15 +1286,61 @@ var Grid = function Grid(_ref) {
1287
1286
  var IconButton = /*#__PURE__*/styled(MuiIconButton, {
1288
1287
  name: 'MuiIconButton',
1289
1288
  shouldForwardProp: function shouldForwardProp(prop) {
1290
- return !['hasBg', 'disableOpacity', 'bgColor'].includes(prop.toString());
1289
+ return !['hasBg', 'disableOpacity', 'bgColor', 'variant'].includes(prop.toString());
1291
1290
  }
1292
- })(function () {
1293
- return {};
1291
+ })(function (_ref) {
1292
+ var theme = _ref.theme,
1293
+ _ref$size = _ref.size,
1294
+ size = _ref$size === void 0 ? 'md' : _ref$size,
1295
+ _ref$variant = _ref.variant,
1296
+ variant = _ref$variant === void 0 ? 'circular' : _ref$variant;
1297
+ // Size configurations
1298
+ var sizeConfig = {
1299
+ xs: {
1300
+ button: 24,
1301
+ icon: 16,
1302
+ padding: 4
1303
+ },
1304
+ sm: {
1305
+ button: 32,
1306
+ icon: 16,
1307
+ padding: 8
1308
+ },
1309
+ md: {
1310
+ button: 40,
1311
+ icon: 24,
1312
+ padding: 8
1313
+ },
1314
+ lg: {
1315
+ button: 48,
1316
+ icon: 24,
1317
+ padding: 12
1318
+ }
1319
+ };
1320
+ var config = sizeConfig[size];
1321
+ return _extends({
1322
+ width: config.button,
1323
+ height: config.button,
1324
+ padding: theme.spacing(config.padding / 4),
1325
+ // Icon size
1326
+ '& .MuiSvgIcon-root': {
1327
+ fontSize: config.icon
1328
+ }
1329
+ }, variant === 'circular' && {
1330
+ borderRadius: '50%'
1331
+ }, variant === 'rounded' && {
1332
+ borderRadius: theme.spacing(1)
1333
+ }, variant === 'square' && {
1334
+ borderRadius: 0
1335
+ });
1294
1336
  });
1337
+ // Set default props
1295
1338
  IconButton.defaultProps = {
1296
1339
  variant: 'circular',
1297
1340
  hasBg: false,
1298
- disableOpacity: false
1341
+ disableOpacity: false,
1342
+ size: 'md',
1343
+ disableRipple: true
1299
1344
  };
1300
1345
 
1301
1346
  function _handleHelperColor(props, key) {
@@ -3889,12 +3934,11 @@ var RabexIconButton = {
3889
3934
  styleOverrides: {
3890
3935
  root: function root(_ref) {
3891
3936
  var ownerState = _ref.ownerState;
3892
- return _extends({}, ownerState.variant === 'circular' && {
3893
- borderRadius: '50%'
3894
- }, ownerState.variant === 'rounded' && {
3895
- borderRadius: 8
3896
- }, ownerState.variant === 'square' && {
3897
- borderRadius: 0
3937
+ return _extends({}, ownerState.disableOpacity && {
3938
+ color: 'inherit',
3939
+ '&:hover': {
3940
+ backgroundColor: 'transparent'
3941
+ }
3898
3942
  });
3899
3943
  }
3900
3944
  },
@@ -3906,18 +3950,63 @@ var RabexIconButton = {
3906
3950
  var theme = _ref2.theme,
3907
3951
  ownerState = _ref2.ownerState;
3908
3952
  return {
3953
+ backgroundColor: (ownerState === null || ownerState === void 0 ? void 0 : ownerState.bgColor) || theme.palette.secondary.A100,
3909
3954
  '&:hover': {
3910
- backgroundColor: (ownerState === null || ownerState === void 0 ? void 0 : ownerState.bgColor) || theme.palette.secondary.main
3955
+ backgroundColor: ownerState !== null && ownerState !== void 0 && ownerState.bgColor ? ownerState.bgColor + "CC" // Add opacity to custom color
3956
+ : theme.palette.secondary.A60
3911
3957
  }
3912
3958
  };
3913
3959
  }
3914
3960
  }, {
3915
3961
  props: {
3916
- disableOpacity: true
3962
+ color: 'primary'
3917
3963
  },
3918
- style: function style() {
3964
+ style: function style(_ref3) {
3965
+ var theme = _ref3.theme;
3919
3966
  return {
3920
- color: 'inherit'
3967
+ color: theme.palette.primary.A100,
3968
+ '&:hover': {
3969
+ backgroundColor: theme.palette.mode === 'light' ? theme.palette.primary.A10 : theme.palette.primary.A60
3970
+ }
3971
+ };
3972
+ }
3973
+ }, {
3974
+ props: {
3975
+ color: 'secondary'
3976
+ },
3977
+ style: function style(_ref4) {
3978
+ var theme = _ref4.theme;
3979
+ return {
3980
+ color: theme.palette.secondary.A100,
3981
+ '&:hover': {
3982
+ backgroundColor: theme.palette.mode === 'light' ? theme.palette.secondary.A10 : theme.palette.secondary.A60
3983
+ }
3984
+ };
3985
+ }
3986
+ }, {
3987
+ props: {
3988
+ color: 'error'
3989
+ },
3990
+ style: function style(_ref5) {
3991
+ var theme = _ref5.theme;
3992
+ return {
3993
+ color: theme.palette.error.A100,
3994
+ '&:hover': {
3995
+ backgroundColor: theme.palette.mode === 'light' ? theme.palette.error.A10 : theme.palette.error.A60
3996
+ }
3997
+ };
3998
+ }
3999
+ }, {
4000
+ props: {
4001
+ color: 'success'
4002
+ },
4003
+ style: function style(_ref6) {
4004
+ var theme = _ref6.theme;
4005
+ return {
4006
+ color: theme.palette.success.A100,
4007
+ '&:hover': {
4008
+ backgroundColor: theme.palette.mode === 'light' ? theme.palette.success.A10 : theme.palette.success.A60
4009
+ }
3921
4010
  };
3922
4011
  }
3923
4012
  }]