@rabex-kit/rabex-ui 0.2.73 → 0.2.75

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.
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import { SwitchProps as MuiSwitchProps } from '@mui/material';
3
+ export declare type SwitchProps = MuiSwitchProps;
4
+ declare module '@mui/material/Switch' {
5
+ interface SwitchPropsSizeOverrides {
6
+ small: true;
7
+ medium: true;
8
+ sm: true;
9
+ xs: true;
10
+ '2xs': true;
11
+ }
12
+ }
13
+ /**
14
+ * Rabex Switch
15
+ *
16
+ * A thin wrapper around MUI Switch.
17
+ *
18
+ * Styling and behavior are controlled exclusively via theme overrides.
19
+ * This keeps the component lightweight, predictable, and consistent
20
+ * across the application.
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * import { Switch } from '@rabex-kit/rabex-ui';
25
+ *
26
+ * <Switch checked={value} onChange={handleChange} />
27
+ * ```
28
+ *
29
+ * For labeling, always use `FormControlLabel`.
30
+ */
31
+ declare const Switch: React.FC<SwitchProps>;
32
+ export default Switch;
@@ -0,0 +1,18 @@
1
+ import { Theme } from '@mui/material';
2
+ declare const _default: {
3
+ components: {
4
+ defaultProps?: Partial<import("@mui/material").SwitchProps> | undefined;
5
+ styleOverrides?: Partial<Record<"root" | "edgeStart" | "edgeEnd" | "switchBase" | "colorPrimary" | "colorSecondary" | "sizeSmall" | "sizeMedium" | "checked" | "disabled" | "input" | "thumb" | "track", string | number | boolean | import("@mui/styled-engine").CSSObject | import("@mui/styled-engine").ComponentSelector | import("@mui/styled-engine").Keyframes | import("@mui/styled-engine").SerializedStyles | import("@mui/styled-engine").ArrayCSSInterpolation | ((props: {
6
+ ownerState: import("@mui/material").SwitchProps & Record<string, unknown>;
7
+ } & {
8
+ theme: Pick<Theme, "unstable_sx" | "unstable_sxConfig" | "mixins" | "palette" | "shadows" | "transitions" | "typography" | "zIndex" | "unstable_strictMode" | "shape" | "breakpoints" | "direction" | "spacing">;
9
+ } & Record<string, unknown>) => import("@mui/styled-engine").CSSInterpolation) | null | undefined>> | undefined;
10
+ variants?: {
11
+ props: Partial<import("@mui/material").SwitchProps>;
12
+ style: import("@mui/styled-engine").Interpolation<{
13
+ theme: Theme;
14
+ }>;
15
+ }[] | undefined;
16
+ };
17
+ };
18
+ export default _default;
@@ -3246,15 +3246,15 @@ var RabexTypography = {
3246
3246
  },
3247
3247
  body1: {
3248
3248
  fontSize: '16px',
3249
- lineHeight: '26px'
3249
+ lineHeight: '32px'
3250
3250
  },
3251
3251
  largeButton: {
3252
3252
  fontSize: '16px',
3253
- lineHeight: '26px'
3253
+ lineHeight: '32px'
3254
3254
  },
3255
3255
  inputLabel: {
3256
3256
  fontSize: '16px',
3257
- lineHeight: '26px'
3257
+ lineHeight: '32px'
3258
3258
  },
3259
3259
  body2: {
3260
3260
  fontSize: '14px',
@@ -5971,6 +5971,108 @@ var RabexSkeleton = {
5971
5971
  components: components$a
5972
5972
  };
5973
5973
 
5974
+ var SIZE_MAP = {
5975
+ sm: {
5976
+ trackWidth: 60,
5977
+ trackHeight: 32,
5978
+ thumb: 24,
5979
+ translateX: 28,
5980
+ top: 2,
5981
+ left: 2
5982
+ },
5983
+ xs: {
5984
+ trackWidth: 44,
5985
+ trackHeight: 24,
5986
+ thumb: 16,
5987
+ translateX: 20,
5988
+ top: 2,
5989
+ left: 2
5990
+ },
5991
+ '2xs': {
5992
+ trackWidth: 32,
5993
+ trackHeight: 16,
5994
+ thumb: 12,
5995
+ translateX: 16,
5996
+ top: 0,
5997
+ left: 0
5998
+ }
5999
+ };
6000
+ var components$b = {
6001
+ styleOverrides: {
6002
+ root: function root(_ref) {
6003
+ var ownerState = _ref.ownerState,
6004
+ theme = _ref.theme;
6005
+ var size = SIZE_MAP[ownerState.size] || SIZE_MAP['2xs'];
6006
+ return {
6007
+ padding: 0,
6008
+ width: size.trackWidth,
6009
+ height: size.trackHeight,
6010
+ marginRight: 8,
6011
+ '&.Mui-disabled + .MuiFormControlLabel-label': {
6012
+ color: theme.palette.textColor[400],
6013
+ opacity: '32%'
6014
+ },
6015
+ '& + .MuiFormControlLabel-label': {
6016
+ color: theme.palette.textColor[900]
6017
+ }
6018
+ };
6019
+ },
6020
+ switchBase: function switchBase(_ref2) {
6021
+ var ownerState = _ref2.ownerState,
6022
+ theme = _ref2.theme;
6023
+ var size = SIZE_MAP[ownerState.size] || SIZE_MAP['2xs'];
6024
+ return {
6025
+ padding: 0,
6026
+ margin: 2,
6027
+ top: size.top,
6028
+ left: size.left,
6029
+ '&.Mui-checked': {
6030
+ transform: "translateX(" + size.translateX + "px)",
6031
+ color: theme.palette.base[50],
6032
+ '& + .MuiSwitch-track': {
6033
+ backgroundColor: theme.palette.primary[500],
6034
+ opacity: 1
6035
+ }
6036
+ },
6037
+ '&.Mui-disabled': {
6038
+ color: theme.palette.base[200],
6039
+ opacity: '32%',
6040
+ '& + .MuiSwitch-track': {
6041
+ backgroundColor: theme.palette.base[200],
6042
+ opacity: '32%'
6043
+ }
6044
+ }
6045
+ };
6046
+ },
6047
+ thumb: function thumb(_ref3) {
6048
+ var ownerState = _ref3.ownerState,
6049
+ theme = _ref3.theme;
6050
+ var size = SIZE_MAP[ownerState.size] || SIZE_MAP['2xs'];
6051
+ return {
6052
+ width: size.thumb,
6053
+ height: size.thumb,
6054
+ backgroundColor: theme.palette.base[50],
6055
+ boxShadow: 'none'
6056
+ };
6057
+ },
6058
+ track: function track(_ref4) {
6059
+ var ownerState = _ref4.ownerState,
6060
+ theme = _ref4.theme;
6061
+ var size = SIZE_MAP[ownerState.size] || SIZE_MAP['2xs'];
6062
+ return {
6063
+ width: size.trackWidth,
6064
+ height: size.trackHeight,
6065
+ borderRadius: size.trackHeight / 2,
6066
+ backgroundColor: theme.palette.base[300],
6067
+ opacity: 1
6068
+ };
6069
+ }
6070
+ }
6071
+ };
6072
+ var RabexSwitch = {
6073
+ components: components$b
6074
+ };
6075
+
5974
6076
  var getDesignTokens = function getDesignTokens(_ref) {
5975
6077
  var deviceType = _ref.deviceType,
5976
6078
  _ref$mode = _ref.mode,
@@ -6034,7 +6136,8 @@ var getDesignTokens = function getDesignTokens(_ref) {
6034
6136
  MuiGrid: RabexGrid.components,
6035
6137
  MuiLoadingButton: RabexLoadingButton.components,
6036
6138
  MuiAutocomplete: RabexAutocomplete.components,
6037
- MuiSkeleton: RabexSkeleton.components
6139
+ MuiSkeleton: RabexSkeleton.components,
6140
+ MuiSwitch: RabexSwitch.components
6038
6141
  }),
6039
6142
  palette: _extends({}, mode === 'light' ? createPalette(RabexLightPalette) : createPalette(RabexDarkPalette)),
6040
6143
  typography: RabexTypography.typography,