@tecsinapse/react-core 1.12.4 → 1.12.8

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.
Files changed (68) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/components/atoms/Badge/styled.d.ts +3 -2
  3. package/dist/components/atoms/Badge/styled.js +5 -3
  4. package/dist/components/atoms/Badge/styled.js.map +1 -1
  5. package/dist/components/atoms/Button/styled.js +4 -2
  6. package/dist/components/atoms/Button/styled.js.map +1 -1
  7. package/dist/components/atoms/GroupButton/styled.js +4 -2
  8. package/dist/components/atoms/GroupButton/styled.js.map +1 -1
  9. package/dist/components/atoms/Input/styled.js +3 -1
  10. package/dist/components/atoms/Input/styled.js.map +1 -1
  11. package/dist/components/atoms/ProgressBar/styled.d.ts +15 -3
  12. package/dist/components/atoms/ProgressBar/styled.js +3 -1
  13. package/dist/components/atoms/ProgressBar/styled.js.map +1 -1
  14. package/dist/components/atoms/Switch/Switch.js +30 -22
  15. package/dist/components/atoms/Switch/Switch.js.map +1 -1
  16. package/dist/components/atoms/Switch/animation.d.ts +1 -1
  17. package/dist/components/atoms/Switch/animation.js +24 -16
  18. package/dist/components/atoms/Switch/animation.js.map +1 -1
  19. package/dist/components/atoms/Switch/styled.d.ts +16 -2
  20. package/dist/components/atoms/Switch/styled.js +11 -5
  21. package/dist/components/atoms/Switch/styled.js.map +1 -1
  22. package/dist/components/atoms/shared/PaperAndCard.js +3 -4
  23. package/dist/components/atoms/shared/PaperAndCard.js.map +1 -1
  24. package/dist/components/molecules/DatePicker/styled.d.ts +25 -4
  25. package/dist/components/molecules/DatePicker/styled.js +7 -5
  26. package/dist/components/molecules/DatePicker/styled.js.map +1 -1
  27. package/dist/components/molecules/DateTimePicker/styled.js +4 -2
  28. package/dist/components/molecules/DateTimePicker/styled.js.map +1 -1
  29. package/dist/components/molecules/DateTimeSelector/styled.js +3 -1
  30. package/dist/components/molecules/DateTimeSelector/styled.js.map +1 -1
  31. package/dist/components/molecules/Snackbar/styled.js +7 -5
  32. package/dist/components/molecules/Snackbar/styled.js.map +1 -1
  33. package/dist/components/molecules/TextArea/styled.d.ts +13 -6
  34. package/dist/components/molecules/TextArea/styled.js +8 -6
  35. package/dist/components/molecules/TextArea/styled.js.map +1 -1
  36. package/dist/styles/definitions.js +45 -42
  37. package/dist/styles/definitions.js.map +1 -1
  38. package/dist/utils/IPhoneXHelper.d.ts +4 -0
  39. package/dist/utils/IPhoneXHelper.js +38 -0
  40. package/dist/utils/IPhoneXHelper.js.map +1 -0
  41. package/dist/utils/ResponsiveFontSize.d.ts +3 -0
  42. package/dist/utils/ResponsiveFontSize.js +57 -0
  43. package/dist/utils/ResponsiveFontSize.js.map +1 -0
  44. package/dist/utils/extractNumbersFromString.js +1 -1
  45. package/dist/utils/extractNumbersFromString.js.map +1 -1
  46. package/dist/utils/index.d.ts +2 -0
  47. package/dist/utils/index.js +33 -0
  48. package/dist/utils/index.js.map +1 -1
  49. package/package.json +2 -2
  50. package/src/components/atoms/Badge/styled.ts +5 -4
  51. package/src/components/atoms/Button/styled.ts +3 -2
  52. package/src/components/atoms/GroupButton/styled.ts +3 -2
  53. package/src/components/atoms/Input/styled.ts +2 -1
  54. package/src/components/atoms/ProgressBar/styled.ts +3 -2
  55. package/src/components/atoms/Switch/Switch.tsx +29 -32
  56. package/src/components/atoms/Switch/animation.ts +26 -16
  57. package/src/components/atoms/Switch/styled.ts +10 -6
  58. package/src/components/atoms/shared/PaperAndCard.ts +4 -5
  59. package/src/components/molecules/DatePicker/styled.ts +4 -2
  60. package/src/components/molecules/DateTimePicker/styled.ts +4 -3
  61. package/src/components/molecules/DateTimeSelector/styled.ts +2 -1
  62. package/src/components/molecules/Snackbar/styled.ts +6 -5
  63. package/src/components/molecules/TextArea/styled.ts +6 -12
  64. package/src/styles/definitions.ts +44 -43
  65. package/src/utils/IPhoneXHelper.ts +34 -0
  66. package/src/utils/ResponsiveFontSize.ts +52 -0
  67. package/src/utils/extractNumbersFromString.ts +1 -4
  68. package/src/utils/index.ts +2 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,41 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.12.8](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.12.7...@tecsinapse/react-core@1.12.8) (2022-01-17)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * regex method extractDigitsFromString ([99eb01a](https://github.com/tecsinapse/design-system/commit/99eb01a694d013129e4c08b633af003791bc6e9b))
12
+
13
+
14
+
15
+
16
+
17
+ ## [1.12.7](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.12.6...@tecsinapse/react-core@1.12.7) (2022-01-11)
18
+
19
+ **Note:** Version bump only for package @tecsinapse/react-core
20
+
21
+
22
+
23
+
24
+
25
+ ## [1.12.6](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.12.5...@tecsinapse/react-core@1.12.6) (2022-01-06)
26
+
27
+ **Note:** Version bump only for package @tecsinapse/react-core
28
+
29
+
30
+
31
+
32
+
33
+ ## [1.12.5](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.12.4...@tecsinapse/react-core@1.12.5) (2022-01-05)
34
+
35
+ **Note:** Version bump only for package @tecsinapse/react-core
36
+
37
+
38
+
39
+
40
+
6
41
  ## [1.12.4](https://github.com/tecsinapse/design-system/compare/@tecsinapse/react-core@1.12.3...@tecsinapse/react-core@1.12.4) (2021-12-23)
7
42
 
8
43
 
@@ -1,14 +1,15 @@
1
1
  /// <reference types="react" />
2
2
  import { View } from 'react-native';
3
+ import { BadgeProps } from './Badge';
3
4
  export declare const BadgeStyle: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
4
5
  theme?: import("@emotion/react").Theme | undefined;
5
6
  as?: import("react").ElementType<any> | undefined;
6
- } & Partial<any>, {}, {
7
+ } & Partial<import("../../../types/defaults").ThemeProviderProps & BadgeProps>, {}, {
7
8
  ref?: import("react").Ref<View> | undefined;
8
9
  }>;
9
10
  export declare const ViewStyled: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
10
11
  theme?: import("@emotion/react").Theme | undefined;
11
12
  as?: import("react").ElementType<any> | undefined;
12
- } & Partial<any>, {}, {
13
+ } & Partial<import("../../../types/defaults").ThemeProviderProps & BadgeProps>, {}, {
13
14
  ref?: import("react").Ref<View> | undefined;
14
15
  }>;
@@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.ViewStyled = exports.BadgeStyle = void 0;
7
7
 
8
+ var _native = _interopRequireWildcard(require("@emotion/native"));
9
+
8
10
  var _reactNative = require("react-native");
9
11
 
10
- var _native = _interopRequireWildcard(require("@emotion/native"));
12
+ var _utils = require("../../../utils");
11
13
 
12
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
15
 
@@ -27,8 +29,8 @@ const baseStyle = ({
27
29
  justify-content: center;
28
30
  height: ${theme.iconSize.centi};
29
31
  width: ${theme.iconSize.centi};
30
- top: -4px;
31
- right: -4px;
32
+ top: ${(0, _utils.RFValueStr)('-4px')};
33
+ right: ${(0, _utils.RFValueStr)('-4px')};
32
34
  `;
33
35
  };
34
36
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/atoms/Badge/styled.ts"],"names":["baseStyle","theme","color","tone","borderRadius","pill","iconSize","centi","BadgeStyle","View","ViewStyled"],"mappings":";;;;;;;AAAA;;AACA;;;;;;AAIA,MAAMA,SAAS,GAAG,CAAC;AACjBC,EAAAA,KADiB;AAEjBC,EAAAA,KAAK,GAAG,SAFS;AAGjBC,EAAAA,IAAI,GAAG;AAHU,CAAD,KAIsB;AACtC,SAAO,gBAAI;AACb,qBAAqBF,KAAK,CAACG,YAAN,CAAmBC,IAAK;AAC7C,wBAAwBJ,KAAK,CAACC,KAAN,CAAYA,KAAZ,EAAmBC,IAAnB,CAAyB;AACjD;AACA;AACA;AACA;AACA,cAAcF,KAAK,CAACK,QAAN,CAAeC,KAAM;AACnC,aAAaN,KAAK,CAACK,QAAN,CAAeC,KAAM;AAClC;AACA;AACA,GAXE;AAYD,CAjBD;;AAmBO,MAAMC,UAAU,GAAG,qBAAOC,iBAAP,EACxBT,SADwB,CAAnB;;AAIA,MAAMU,UAAU,GAAG,qBAAOD,iBAAP,CAA+C;AACzE;AACA;AACA;AACA;AACA,CALO","sourcesContent":["import { View } from 'react-native';\nimport styled, { css } from '@emotion/native';\nimport { StyleProps } from '@tecsinapse/react-core';\nimport { BadgeProps } from './Badge';\n\nconst baseStyle = ({\n theme,\n color = 'primary',\n tone = 'medium',\n}: StyleProps & Partial<BadgeProps>) => {\n return css`\n border-radius: ${theme.borderRadius.pill};\n background-color: ${theme.color[color][tone]};\n position: absolute;\n align-items: center;\n display: flex;\n justify-content: center;\n height: ${theme.iconSize.centi};\n width: ${theme.iconSize.centi};\n top: -4px;\n right: -4px;\n `;\n};\n\nexport const BadgeStyle = styled(View)<Partial<StyleProps & BadgeProps>>(\n baseStyle\n);\n\nexport const ViewStyled = styled(View)<Partial<StyleProps & BadgeProps>>`\n align-items: center;\n justify-content: center;\n position: relative;\n align-self: center;\n`;\n"],"file":"styled.js"}
1
+ {"version":3,"sources":["../../../../src/components/atoms/Badge/styled.ts"],"names":["baseStyle","theme","color","tone","borderRadius","pill","iconSize","centi","BadgeStyle","View","ViewStyled"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;;;AAGA,MAAMA,SAAS,GAAG,CAAC;AACjBC,EAAAA,KADiB;AAEjBC,EAAAA,KAAK,GAAG,SAFS;AAGjBC,EAAAA,IAAI,GAAG;AAHU,CAAD,KAIsB;AACtC,SAAO,gBAAI;AACb,qBAAqBF,KAAK,CAACG,YAAN,CAAmBC,IAAK;AAC7C,wBAAwBJ,KAAK,CAACC,KAAN,CAAYA,KAAZ,EAAmBC,IAAnB,CAAyB;AACjD;AACA;AACA;AACA;AACA,cAAcF,KAAK,CAACK,QAAN,CAAeC,KAAM;AACnC,aAAaN,KAAK,CAACK,QAAN,CAAeC,KAAM;AAClC,WAAW,uBAAW,MAAX,CAAmB;AAC9B,aAAa,uBAAW,MAAX,CAAmB;AAChC,GAXE;AAYD,CAjBD;;AAmBO,MAAMC,UAAU,GAAG,qBAAOC,iBAAP,EACxBT,SADwB,CAAnB;;AAIA,MAAMU,UAAU,GAAG,qBAAOD,iBAAP,CAA+C;AACzE;AACA;AACA;AACA;AACA,CALO","sourcesContent":["import styled, { css } from '@emotion/native';\nimport { View } from 'react-native';\nimport { StyleProps } from '../../../types/defaults';\nimport { RFValueStr } from '../../../utils';\nimport { BadgeProps } from './Badge';\n\nconst baseStyle = ({\n theme,\n color = 'primary',\n tone = 'medium',\n}: StyleProps & Partial<BadgeProps>) => {\n return css`\n border-radius: ${theme.borderRadius.pill};\n background-color: ${theme.color[color][tone]};\n position: absolute;\n align-items: center;\n display: flex;\n justify-content: center;\n height: ${theme.iconSize.centi};\n width: ${theme.iconSize.centi};\n top: ${RFValueStr('-4px')};\n right: ${RFValueStr('-4px')};\n `;\n};\n\nexport const BadgeStyle = styled(View)<Partial<StyleProps & BadgeProps>>(\n baseStyle\n);\n\nexport const ViewStyled = styled(View)<Partial<StyleProps & BadgeProps>>`\n align-items: center;\n justify-content: center;\n position: relative;\n align-self: center;\n`;\n"],"file":"styled.js"}
@@ -7,6 +7,8 @@ exports.StyledButton = void 0;
7
7
 
8
8
  var _native = _interopRequireWildcard(require("@emotion/native"));
9
9
 
10
+ var _utils = require("../../../utils");
11
+
10
12
  var _PressableSurface = require("../PressableSurface");
11
13
 
12
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -31,13 +33,13 @@ const sizeStyles = ({
31
33
  case 'small':
32
34
  return (0, _native.css)`
33
35
  padding: ${theme.spacing.mili} ${theme.spacing.deca};
34
- min-height: 34px;
36
+ min-height: ${(0, _utils.RFValueStr)('34px')};
35
37
  `;
36
38
 
37
39
  default:
38
40
  return (0, _native.css)`
39
41
  padding: ${theme.spacing.mili} ${theme.spacing.kilo};
40
- min-height: 44px;
42
+ min-height: ${(0, _utils.RFValueStr)('44px')};
41
43
  `;
42
44
  }
43
45
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/atoms/Button/styled.ts"],"names":["outlineVariant","theme","color","variant","tone","borderWidth","pico","sizeStyles","size","spacing","mili","deca","kilo","StyledButtonBase","PressableSurface","borderRadius","StyledButton","props"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;AAGA,MAAMA,cAAc,GAAG,CAAC;AACtBC,EAAAA,KADsB;AAEtBC,EAAAA,KAAK,GAAG,SAFc;AAGtBC,EAAAA,OAHsB;AAItBC,EAAAA,IAAI,GAAG;AAJe,CAAD,KAMrBD,OAAO,KAAK,UAAZ,IACA,gBAAI;AACN,oBAAoBF,KAAK,CAACC,KAAN,CAAYA,KAAZ,EAAmBE,IAAnB,CAAyB;AAC7C,oBAAoBH,KAAK,CAACI,WAAN,CAAkBC,IAAK;AAC3C,GAVA;;AAYA,MAAMC,UAAU,GAAG,CAAC;AAAEN,EAAAA,KAAF;AAASO,EAAAA,IAAI,GAAG;AAAhB,CAAD,KAA2D;AAC5E,UAAQA,IAAR;AACE,SAAK,OAAL;AACE,aAAO,gBAAI;AACjB,mBAAmBP,KAAK,CAACQ,OAAN,CAAcC,IAAK,IAAGT,KAAK,CAACQ,OAAN,CAAcE,IAAK;AAC5D;AACA,OAHM;;AAIF;AACE,aAAO,gBAAI;AACjB,mBAAmBV,KAAK,CAACQ,OAAN,CAAcC,IAAK,IAAGT,KAAK,CAACQ,OAAN,CAAcG,IAAK;AAC5D;AACA,OAHM;AAPJ;AAYD,CAbD;;AAeA,MAAMC,gBAAgB,GAAG,qBAAOC,kCAAP,CAEvB;AACF,mBAAmB,CAAC;AAAEb,EAAAA,KAAF;AAASc,EAAAA,YAAY,GAAG;AAAxB,CAAD,KACfd,KAAK,CAACc,YAAN,CAAmBA,YAAnB,CAAiC;AACrC;AACA;AACA;AACA,CARA;AAUO,MAAMC,YAAY,GAAG,qBAAOH,gBAAP,EAG1BI,KAAK,IAAI,gBAAI;AACf,MAAMjB,cAAc,CAACiB,KAAD,CAAQ;AAC5B,MAAMV,UAAU,CAACU,KAAD,CAAQ;AACxB,GAN4B,CAArB","sourcesContent":["import styled, { css } from '@emotion/native';\nimport { StyleProps } from '../../../types/defaults';\nimport { PressableSurface } from '../PressableSurface';\nimport { ButtonProps } from './Button';\n\nconst outlineVariant = ({\n theme,\n color = 'primary',\n variant,\n tone = 'medium',\n}: StyleProps & ButtonProps) =>\n variant === 'outlined' &&\n css`\n border-color: ${theme.color[color][tone]};\n border-width: ${theme.borderWidth.pico};\n `;\n\nconst sizeStyles = ({ theme, size = 'default' }: StyleProps & ButtonProps) => {\n switch (size) {\n case 'small':\n return css`\n padding: ${theme.spacing.mili} ${theme.spacing.deca};\n min-height: 34px;\n `;\n default:\n return css`\n padding: ${theme.spacing.mili} ${theme.spacing.kilo};\n min-height: 44px;\n `;\n }\n};\n\nconst StyledButtonBase = styled(PressableSurface)<\n ButtonProps & Partial<StyleProps>\n>`\n border-radius: ${({ theme, borderRadius = 'mili' }) =>\n theme.borderRadius[borderRadius]};\n flex-direction: row;\n justify-content: center;\n align-items: center;\n`;\n\nexport const StyledButton = styled(StyledButtonBase)<\n ButtonProps & Partial<StyleProps>\n>(\n props => css`\n ${outlineVariant(props)}\n ${sizeStyles(props)}\n `\n);\n"],"file":"styled.js"}
1
+ {"version":3,"sources":["../../../../src/components/atoms/Button/styled.ts"],"names":["outlineVariant","theme","color","variant","tone","borderWidth","pico","sizeStyles","size","spacing","mili","deca","kilo","StyledButtonBase","PressableSurface","borderRadius","StyledButton","props"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;;;;;AAGA,MAAMA,cAAc,GAAG,CAAC;AACtBC,EAAAA,KADsB;AAEtBC,EAAAA,KAAK,GAAG,SAFc;AAGtBC,EAAAA,OAHsB;AAItBC,EAAAA,IAAI,GAAG;AAJe,CAAD,KAMrBD,OAAO,KAAK,UAAZ,IACA,gBAAI;AACN,oBAAoBF,KAAK,CAACC,KAAN,CAAYA,KAAZ,EAAmBE,IAAnB,CAAyB;AAC7C,oBAAoBH,KAAK,CAACI,WAAN,CAAkBC,IAAK;AAC3C,GAVA;;AAYA,MAAMC,UAAU,GAAG,CAAC;AAAEN,EAAAA,KAAF;AAASO,EAAAA,IAAI,GAAG;AAAhB,CAAD,KAA2D;AAC5E,UAAQA,IAAR;AACE,SAAK,OAAL;AACE,aAAO,gBAAI;AACjB,mBAAmBP,KAAK,CAACQ,OAAN,CAAcC,IAAK,IAAGT,KAAK,CAACQ,OAAN,CAAcE,IAAK;AAC5D,sBAAsB,uBAAW,MAAX,CAAmB;AACzC,OAHM;;AAIF;AACE,aAAO,gBAAI;AACjB,mBAAmBV,KAAK,CAACQ,OAAN,CAAcC,IAAK,IAAGT,KAAK,CAACQ,OAAN,CAAcG,IAAK;AAC5D,sBAAsB,uBAAW,MAAX,CAAmB;AACzC,OAHM;AAPJ;AAYD,CAbD;;AAeA,MAAMC,gBAAgB,GAAG,qBAAOC,kCAAP,CAEvB;AACF,mBAAmB,CAAC;AAAEb,EAAAA,KAAF;AAASc,EAAAA,YAAY,GAAG;AAAxB,CAAD,KACfd,KAAK,CAACc,YAAN,CAAmBA,YAAnB,CAAiC;AACrC;AACA;AACA;AACA,CARA;AAUO,MAAMC,YAAY,GAAG,qBAAOH,gBAAP,EAG1BI,KAAK,IAAI,gBAAI;AACf,MAAMjB,cAAc,CAACiB,KAAD,CAAQ;AAC5B,MAAMV,UAAU,CAACU,KAAD,CAAQ;AACxB,GAN4B,CAArB","sourcesContent":["import styled, { css } from '@emotion/native';\nimport { StyleProps } from '../../../types/defaults';\nimport { RFValueStr } from '../../../utils';\nimport { PressableSurface } from '../PressableSurface';\nimport { ButtonProps } from './Button';\n\nconst outlineVariant = ({\n theme,\n color = 'primary',\n variant,\n tone = 'medium',\n}: StyleProps & ButtonProps) =>\n variant === 'outlined' &&\n css`\n border-color: ${theme.color[color][tone]};\n border-width: ${theme.borderWidth.pico};\n `;\n\nconst sizeStyles = ({ theme, size = 'default' }: StyleProps & ButtonProps) => {\n switch (size) {\n case 'small':\n return css`\n padding: ${theme.spacing.mili} ${theme.spacing.deca};\n min-height: ${RFValueStr('34px')};\n `;\n default:\n return css`\n padding: ${theme.spacing.mili} ${theme.spacing.kilo};\n min-height: ${RFValueStr('44px')};\n `;\n }\n};\n\nconst StyledButtonBase = styled(PressableSurface)<\n ButtonProps & Partial<StyleProps>\n>`\n border-radius: ${({ theme, borderRadius = 'mili' }) =>\n theme.borderRadius[borderRadius]};\n flex-direction: row;\n justify-content: center;\n align-items: center;\n`;\n\nexport const StyledButton = styled(StyledButtonBase)<\n ButtonProps & Partial<StyleProps>\n>(\n props => css`\n ${outlineVariant(props)}\n ${sizeStyles(props)}\n `\n);\n"],"file":"styled.js"}
@@ -7,6 +7,8 @@ exports.StyledPressable = exports.StyledDivider = exports.StyledOption = exports
7
7
 
8
8
  var _native = _interopRequireWildcard(require("@emotion/native"));
9
9
 
10
+ var _utils = require("../../../utils");
11
+
10
12
  var _PressableSurface = require("../PressableSurface");
11
13
 
12
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -92,13 +94,13 @@ const sizeStyles = ({
92
94
  case 'small':
93
95
  return (0, _native.css)`
94
96
  padding: ${theme === null || theme === void 0 ? void 0 : theme.spacing.mili} ${theme === null || theme === void 0 ? void 0 : theme.spacing.deca};
95
- min-height: 34px;
97
+ min-height: ${(0, _utils.RFValueStr)('34px')};
96
98
  `;
97
99
 
98
100
  default:
99
101
  return (0, _native.css)`
100
102
  padding: ${theme === null || theme === void 0 ? void 0 : theme.spacing.mili} ${theme === null || theme === void 0 ? void 0 : theme.spacing.kilo};
101
- min-height: 44px;
103
+ min-height: ${(0, _utils.RFValueStr)('44px')};
102
104
  `;
103
105
  }
104
106
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/atoms/GroupButton/styled.ts"],"names":["StyledGroupButton","styled","View","disabledStyles","disabled","isActive","getStyledGroupItemText","component","active","theme","miscellaneous","surfaceColor","color","secondary","medium","activeStyles","activeBorderColor","activeBorderColorTone","inactiveStyles","inactiveBackgroundColor","inactiveBackgroundColorTone","inactiveBorderColor","inactiveBorderColorTone","leftStyles","isFirstOption","borderRadius","mili","borderWidth","pico","rightStyles","isLastOption","sizeStyles","buttonSize","spacing","deca","kilo","StyledPressableBase","PressableSurface","StyledOption","StyledDivider","light","StyledPressable","props"],"mappings":";;;;;;;AAAA;;AAIA;;;;;;AAYO,MAAMA,iBAAiB,GAAGC,gBAAOC,IAA0B;AAClE;AACA,CAFO;;;AAKP,MAAMC,cAAc,GAAG,CAAC;AACtBC,EAAAA,QADsB;AAEtBC,EAAAA;AAFsB,CAAD,KAIrBD,QAAQ,IACR,CAACC,QADD,IAEA,gBAAI;AACN;AACA,GARA;;AAUO,MAAMC,sBAAsB,GAAIC,SAAD,IAA8B;AAClE,SAAO,qBAAOA,SAAP,CAEL;AACJ,aAAa,CAAC;AAAEC,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAAD,KACPD,MAAM,GAAGC,KAAK,CAACC,aAAN,CAAoBC,YAAvB,GAAsCF,KAAK,CAACG,KAAN,CAAYC,SAAZ,CAAsBC,MAAO;AAC/E,GALE;A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O;;AAKA,MAAMqC,aAAa,GAAGtC,gBAAOC,IAA0B;AAC9D,WAAW,CAAC;AAAEO,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACkB,WAAN,CAAkBC,IAAK;AACjD,sBAAsB,CAAC;AAAEnB,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACG,KAAN,CAAYC,SAAZ,CAAsB2B,KAAM;AACjE,CAHO;;AAKA,MAAMC,eAAe,GAAG,qBAAOL,mBAAP,EAC5BM,KAAD,IAAmD,gBAAI;AACzD,MAAM3B,YAAY,CAAC2B,KAAD,CAAQ;AAC1B,MAAMxB,cAAc,CAACwB,KAAD,CAAQ;AAC5B,MAAMnB,UAAU,CAACmB,KAAD,CAAQ;AACxB,MAAMb,WAAW,CAACa,KAAD,CAAQ;AACzB,MAAMX,UAAU,CAACW,KAAD,CAAQ;AACxB,MAAMvC,cAAc,CAACuC,KAAD,CAAQ;AAC5B,GAR+B,CAAxB","sourcesContent":["import styled, { css } from '@emotion/native';\nimport { FC } from 'react';\nimport { StyleProps } from '../../../types/defaults';\nimport { ButtonSizeType } from '../Button';\nimport { PressableSurface } from '../PressableSurface';\nimport { TextProps } from '../Text';\nimport { GroupButtonOptions } from './GroupButton';\nimport { GroupButtonOptionProps } from './GroupButtonOption';\n\ninterface PressableOptions extends GroupButtonOptions {\n isActive: boolean;\n isFirstOption: boolean;\n isLastOption: boolean;\n buttonSize?: ButtonSizeType;\n}\n\nexport const StyledGroupButton = styled.View<Partial<StyleProps>>`\n flex-direction: row;\n`;\n\n// TO FIXED: hexa color to theme definitions\nconst disabledStyles = ({\n disabled,\n isActive,\n}: PressableOptions & Partial<StyleProps>) =>\n disabled &&\n !isActive &&\n css`\n background-color: #dcdcdc;\n `;\n\nexport const getStyledGroupItemText = (component: FC<TextProps>) => {\n return styled(component)<\n Partial<GroupButtonOptionProps> & Partial<StyleProps>\n >`\n color: ${({ active, theme }) =>\n active ? theme.miscellaneous.surfaceColor : theme.color.secondary.medium};\n `;\n};\n\nconst activeStyles = ({\n theme,\n isActive,\n activeBorderColor = 'secondary',\n activeBorderColorTone = 'medium',\n}: PressableOptions & Partial<StyleProps>) =>\n isActive &&\n css`\n border-color: ${theme?.color[activeBorderColor][activeBorderColorTone]};\n `;\n\nconst inactiveStyles = ({\n theme,\n isActive,\n inactiveBackgroundColor,\n inactiveBackgroundColorTone,\n inactiveBorderColor = 'secondary',\n inactiveBorderColorTone = 'light',\n}: PressableOptions & Partial<StyleProps>) => {\n if (!isActive && inactiveBackgroundColor && inactiveBackgroundColorTone) {\n return css`\n border-color: ${theme?.color[inactiveBorderColor][\n inactiveBorderColorTone\n ]};\n `;\n }\n\n if (!isActive) {\n return css`\n border-color: ${theme?.color[inactiveBorderColor][\n inactiveBorderColorTone\n ]};\n `;\n }\n};\n\nconst leftStyles = ({\n theme,\n isFirstOption,\n}: PressableOptions & Partial<StyleProps>) =>\n isFirstOption &&\n css`\n border-top-left-radius: ${theme?.borderRadius.mili};\n border-bottom-left-radius: ${theme?.borderRadius.mili};\n border-left-width: ${theme?.borderWidth.pico};\n `;\n\nconst rightStyles = ({\n theme,\n isLastOption,\n}: PressableOptions & Partial<StyleProps>) =>\n isLastOption &&\n css`\n border-top-right-radius: ${theme?.borderRadius.mili};\n border-bottom-right-radius: ${theme?.borderRadius.mili};\n border-right-width: ${theme?.borderWidth.pico};\n `;\n\nconst sizeStyles = ({\n theme,\n buttonSize = 'small',\n}: PressableOptions & Partial<StyleProps>) => {\n switch (buttonSize) {\n case 'small':\n return css`\n padding: ${theme?.spacing.mili} ${theme?.spacing.deca};\n min-height: 34px;\n `;\n default:\n return css`\n padding: ${theme?.spacing.mili} ${theme?.spacing.kilo};\n min-height: 44px;\n `;\n }\n};\n\nconst StyledPressableBase = styled(PressableSurface)<\n PressableOptions & Partial<StyleProps>\n>`\n border-top-width: ${({ theme }) => theme.borderWidth.pico};\n border-bottom-width: ${({ theme }) => theme.borderWidth.pico};\n justify-content: center;\n align-items: center;\n flex: 1;\n`;\n\nexport const StyledOption = styled.View`\n flex-direction: row;\n flex: 1;\n`;\n\nexport const StyledDivider = styled.View<Partial<StyleProps>>`\n width: ${({ theme }) => theme.borderWidth.pico};\n background-color: ${({ theme }) => theme.color.secondary.light}; ;\n`;\n\nexport const StyledPressable = styled(StyledPressableBase)(\n (props: PressableOptions & Partial<StyleProps>) => css`\n ${activeStyles(props)}\n ${inactiveStyles(props)}\n ${leftStyles(props)}\n ${rightStyles(props)}\n ${sizeStyles(props)}\n ${disabledStyles(props)}\n `\n);\n"],"file":"styled.js"}
1
+ {"version":3,"sources":["../../../../src/components/atoms/GroupButton/styled.ts"],"names":["StyledGroupButton","styled","View","disabledStyles","disabled","isActive","getStyledGroupItemText","component","active","theme","miscellaneous","surfaceColor","color","secondary","medium","activeStyles","activeBorderColor","activeBorderColorTone","inactiveStyles","inactiveBackgroundColor","inactiveBackgroundColorTone","inactiveBorderColor","inactiveBorderColorTone","leftStyles","isFirstOption","borderRadius","mili","borderWidth","pico","rightStyles","isLastOption","sizeStyles","buttonSize","spacing","deca","kilo","StyledPressableBase","PressableSurface","StyledOption","StyledDivider","light","StyledPressable","props"],"mappings":";;;;;;;AAAA;;AAGA;;AAEA;;;;;;AAYO,MAAMA,iBAAiB,GAAGC,gBAAOC,IAA0B;AAClE;AACA,CAFO;;;AAKP,MAAMC,cAAc,GAAG,CAAC;AACtBC,EAAAA,QADsB;AAEtBC,EAAAA;AAFsB,CAAD,KAIrBD,QAAQ,IACR,CAACC,QADD,IAEA,gBAAI;AACN;AACA,GARA;;AAUO,MAAMC,sBAAsB,GAAIC,SAAD,IAA8B;AAClE,SAAO,qBAAOA,SAAP,CAEL;AACJ,aAAa,CAAC;AAAEC,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAAD,KACPD,MAAM,GAAGC,KAAK,CAACC,aAAN,CAAoBC,YAAvB,GAAsCF,KAAK,CAACG,KAAN,CAAYC,SAAZ,CAAsBC,MAAO;AAC/E,GALE;AAMD,CAPM;;;;AASP,MAA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rC,gBAAOC,IAAK;AACxC;AACA;AACA,CAHO;;AAKA,MAAMqC,aAAa,GAAGtC,gBAAOC,IAA0B;AAC9D,WAAW,CAAC;AAAEO,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACkB,WAAN,CAAkBC,IAAK;AACjD,sBAAsB,CAAC;AAAEnB,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACG,KAAN,CAAYC,SAAZ,CAAsB2B,KAAM;AACjE,CAHO;;AAKA,MAAMC,eAAe,GAAG,qBAAOL,mBAAP,EAC5BM,KAAD,IAAmD,gBAAI;AACzD,MAAM3B,YAAY,CAAC2B,KAAD,CAAQ;AAC1B,MAAMxB,cAAc,CAACwB,KAAD,CAAQ;AAC5B,MAAMnB,UAAU,CAACmB,KAAD,CAAQ;AACxB,MAAMb,WAAW,CAACa,KAAD,CAAQ;AACzB,MAAMX,UAAU,CAACW,KAAD,CAAQ;AACxB,MAAMvC,cAAc,CAACuC,KAAD,CAAQ;AAC5B,GAR+B,CAAxB","sourcesContent":["import styled, { css } from '@emotion/native';\nimport { FC } from 'react';\nimport { StyleProps } from '../../../types/defaults';\nimport { RFValueStr } from '../../../utils';\nimport { ButtonSizeType } from '../Button';\nimport { PressableSurface } from '../PressableSurface';\nimport { TextProps } from '../Text';\nimport { GroupButtonOptions } from './GroupButton';\nimport { GroupButtonOptionProps } from './GroupButtonOption';\n\ninterface PressableOptions extends GroupButtonOptions {\n isActive: boolean;\n isFirstOption: boolean;\n isLastOption: boolean;\n buttonSize?: ButtonSizeType;\n}\n\nexport const StyledGroupButton = styled.View<Partial<StyleProps>>`\n flex-direction: row;\n`;\n\n// TO FIXED: hexa color to theme definitions\nconst disabledStyles = ({\n disabled,\n isActive,\n}: PressableOptions & Partial<StyleProps>) =>\n disabled &&\n !isActive &&\n css`\n background-color: #dcdcdc;\n `;\n\nexport const getStyledGroupItemText = (component: FC<TextProps>) => {\n return styled(component)<\n Partial<GroupButtonOptionProps> & Partial<StyleProps>\n >`\n color: ${({ active, theme }) =>\n active ? theme.miscellaneous.surfaceColor : theme.color.secondary.medium};\n `;\n};\n\nconst activeStyles = ({\n theme,\n isActive,\n activeBorderColor = 'secondary',\n activeBorderColorTone = 'medium',\n}: PressableOptions & Partial<StyleProps>) =>\n isActive &&\n css`\n border-color: ${theme?.color[activeBorderColor][activeBorderColorTone]};\n `;\n\nconst inactiveStyles = ({\n theme,\n isActive,\n inactiveBackgroundColor,\n inactiveBackgroundColorTone,\n inactiveBorderColor = 'secondary',\n inactiveBorderColorTone = 'light',\n}: PressableOptions & Partial<StyleProps>) => {\n if (!isActive && inactiveBackgroundColor && inactiveBackgroundColorTone) {\n return css`\n border-color: ${theme?.color[inactiveBorderColor][\n inactiveBorderColorTone\n ]};\n `;\n }\n\n if (!isActive) {\n return css`\n border-color: ${theme?.color[inactiveBorderColor][\n inactiveBorderColorTone\n ]};\n `;\n }\n};\n\nconst leftStyles = ({\n theme,\n isFirstOption,\n}: PressableOptions & Partial<StyleProps>) =>\n isFirstOption &&\n css`\n border-top-left-radius: ${theme?.borderRadius.mili};\n border-bottom-left-radius: ${theme?.borderRadius.mili};\n border-left-width: ${theme?.borderWidth.pico};\n `;\n\nconst rightStyles = ({\n theme,\n isLastOption,\n}: PressableOptions & Partial<StyleProps>) =>\n isLastOption &&\n css`\n border-top-right-radius: ${theme?.borderRadius.mili};\n border-bottom-right-radius: ${theme?.borderRadius.mili};\n border-right-width: ${theme?.borderWidth.pico};\n `;\n\nconst sizeStyles = ({\n theme,\n buttonSize = 'small',\n}: PressableOptions & Partial<StyleProps>) => {\n switch (buttonSize) {\n case 'small':\n return css`\n padding: ${theme?.spacing.mili} ${theme?.spacing.deca};\n min-height: ${RFValueStr('34px')};\n `;\n default:\n return css`\n padding: ${theme?.spacing.mili} ${theme?.spacing.kilo};\n min-height: ${RFValueStr('44px')};\n `;\n }\n};\n\nconst StyledPressableBase = styled(PressableSurface)<\n PressableOptions & Partial<StyleProps>\n>`\n border-top-width: ${({ theme }) => theme.borderWidth.pico};\n border-bottom-width: ${({ theme }) => theme.borderWidth.pico};\n justify-content: center;\n align-items: center;\n flex: 1;\n`;\n\nexport const StyledOption = styled.View`\n flex-direction: row;\n flex: 1;\n`;\n\nexport const StyledDivider = styled.View<Partial<StyleProps>>`\n width: ${({ theme }) => theme.borderWidth.pico};\n background-color: ${({ theme }) => theme.color.secondary.light}; ;\n`;\n\nexport const StyledPressable = styled(StyledPressableBase)(\n (props: PressableOptions & Partial<StyleProps>) => css`\n ${activeStyles(props)}\n ${inactiveStyles(props)}\n ${leftStyles(props)}\n ${rightStyles(props)}\n ${sizeStyles(props)}\n ${disabledStyles(props)}\n `\n);\n"],"file":"styled.js"}
@@ -9,6 +9,8 @@ var _native = _interopRequireWildcard(require("@emotion/native"));
9
9
 
10
10
  var _reactNative = require("react-native");
11
11
 
12
+ var _utils = require("../../../utils");
13
+
12
14
  var _Icon = require("../Icon");
13
15
 
14
16
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -64,7 +66,7 @@ exports.StyledIconContent = StyledIconContent;
64
66
  const StyledInputContainer = _native.default.View`
65
67
  flex-direction: row;
66
68
  align-items: center;
67
- min-height: 44px;
69
+ min-height: ${(0, _utils.RFValueStr)('44px')};
68
70
  `;
69
71
  exports.StyledInputContainer = StyledInputContainer;
70
72
  const StyledInputElementBase = (0, _native.default)(_reactNative.TextInput)`
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/atoms/Input/styled.ts"],"names":["leftIconStyles","leftComponent","theme","spacing","centi","rightIconStyles","rightComponent","disabledContainerStyles","disabled","disabledInputStyles","color","secondary","light","focusedStyles","focused","borderColor","borderWidth","nano","dark","StyledIconContent","styled","View","zIndex","default","StyledInputContainer","StyledInputElementBase","TextInput","font","stack","typography","base","fontSize","weight","bold","StyledLabelContainer","props","micro","StyledBorderKeeperBase","miscellaneous","surfaceColor","borderColorGradation","borderRadius","mili","pico","StyledBorderKeeper","StyledInputElement","StyledHintContainer","StyledHintIcon","Icon"],"mappings":";;;;;;;AAAA;;AACA;;AAGA;;;;;;AAGA,MAAMA,cAAc,GAAG,CAAC;AACtBC,EAAAA,aADsB;AAEtBC,EAAAA;AAFsB,CAAD,KAIrB,CAACD,aAAD,IACA,gBAAI;AACN,oBAAoBC,KAAK,CAACC,OAAN,CAAcC,KAAM;AACxC,GAPA;;AASA,MAAMC,eAAe,GAAG,CAAC;AACvBC,EAAAA,cADuB;AAEvBJ,EAAAA;AAFuB,CAAD,KAItB,CAACI,cAAD,IACA,gBAAI;AACN,qBAAqBJ,KAAK,CAACC,OAAN,CAAcC,KAAM;AACzC,GAPA;;AASA,MAAMG,uBAAuB,GAAG,CAAC;AAC/BC,EAAAA;AAD+B,CAAD,KAG9BA,QAAQ,IACR,gBAAI;AACN;AACA,GANA;;AAQO,MAAMC,mBAAmB,GAAG,CAAC;AAClCD,EAAAA,QADkC;AAElCN,EAAAA;AAFkC,CAAD,KAIjCM,QAAQ,IACR,gBAAI;AACN,aAAaN,KADR,aACQA,KADR,uBACQA,KAAK,CAAEQ,KAAP,CAAaC,SAAb,CAAuBC,KAAM;AAC1C,GAPO;;;;AASP,MAAMC,aAAa,GAAG,CAAC;AACrBC,EAAAA,OADqB;AAErBC,EAAAA,WAAW,GAAG,WAFO;AAGrBb,EAAAA;AAHqB,CAAD,KAKpBY,OAAO,IACP,gBAAI;AACN,oBAAoBZ,KAAK,CAACc,WAAN,CAAkBC,IAAK;AAC3C,oBAAoBf,KAAK,CAACQ,KAAN,CAAYK,WAAZ,EAAyBG,IAAK;AAClD,GATA;;AAWO,MAAMC,iBAAiB,GAAGC,gBAAOC,IAA0B;AAClE,aAAa,CAAC;AAAEnB,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACoB,MAAN,CAAaC,OAAQ;AACjD;AACA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,CAAC;AAAExC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACc,WAAN,CAAkB2B,IAAK;AACxD;AACA;AACA;AACA,CAdA;AAgBO,MAAMC,kBAAkB,GAAG,qBAAOP,sBAAP,EAGhCF,KAAK,IAAI,gBAAI;AACf,MAAMtB,aAAa,CAACsB,KAAD,CAAQ;AAC3B,MAAM5B,uBAAuB,CAAC4B,KAAD,CAAQ;AACrC,GANkC,CAA3B;;AASA,MAAMU,kBAAkB,GAAG,qBAAOpB,sBAAP,EAGhCU,KAAK,IAAI,gBAAI;AACf,MAAM1B,mBAAmB,CAAC0B,KAAD,CAAQ;AACjC,GALkC,CAA3B;;AAQA,MAAMW,mBAAmB,GAAG1B,gBAAOC,IAA0B;AACpE,gBAAgB,CAAC;AAAEnB,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,OAAN,CAAciC,KAAM;AACnD;AACA;AACA,CAJO;;AAMA,MAAMW,cAAc,GAAG,qBAAOC,UAAP,CAAkC;AAChE,kBAAkB,CAAC;AAAE9C,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,OAAN,CAAciC,KAAM;AACrD,CAFO","sourcesContent":["import styled, { css } from '@emotion/native';\nimport { TextInput } from 'react-native';\nimport { InputElementProps } from '.';\nimport { StyleProps } from '../../../types/defaults';\nimport { Icon } from '../Icon';\nimport { InputContainerProps } from './InputContainer/InputContainer';\n\nconst leftIconStyles = ({\n leftComponent,\n theme,\n}: Partial<InputContainerProps> & StyleProps) =>\n !leftComponent &&\n css`\n padding-left: ${theme.spacing.centi};\n `;\n\nconst rightIconStyles = ({\n rightComponent,\n theme,\n}: Partial<InputContainerProps> & StyleProps) =>\n !rightComponent &&\n css`\n padding-right: ${theme.spacing.centi};\n `;\n\nconst disabledContainerStyles = ({\n disabled,\n}: Partial<InputContainerProps> & StyleProps) =>\n disabled &&\n css`\n background-color: transparent;\n `;\n\nexport const disabledInputStyles = ({\n disabled,\n theme,\n}: Partial<InputContainerProps> & Partial<StyleProps>) =>\n disabled &&\n css`\n color: ${theme?.color.secondary.light};\n `;\n\nconst focusedStyles = ({\n focused,\n borderColor = 'secondary',\n theme,\n}: Partial<InputContainerProps> & StyleProps) =>\n focused &&\n css`\n border-width: ${theme.borderWidth.nano};\n border-color: ${theme.color[borderColor].dark};\n `;\n\nexport const StyledIconContent = styled.View<Partial<StyleProps>>`\n z-index: ${({ theme }) => theme.zIndex.default};\n flex-direction: row;\n align-items: center;\n`;\n\nexport const StyledInputContainer = styled.View<\n Partial<InputContainerProps> & Partial<StyleProps>\n>`\n flex-direction: row;\n align-items: center;\n min-height: 44px;\n`;\n\nexport const StyledInputElementBase = styled(TextInput)<\n InputElementProps & Partial<StyleProps>\n>`\n font-family: ${({ theme }) => `'${theme.font.stack.default}'`};\n font-size: ${({ theme }) => theme.typography.base.fontSize};\n font-weight: ${({ theme }) => theme.font.weight.bold};\n color: ${({ theme }) => theme.font.color.dark};\n`;\n\nexport const StyledLabelContainer = styled.View<\n Partial<InputContainerProps> & Partial<StyleProps>\n>(\n props => css`\n flex: 1;\n padding: ${props.theme.spacing.micro} 0;\n ${leftIconStyles(props)}\n ${rightIconStyles(props)}\n `\n);\n\nconst StyledBorderKeeperBase = styled.View<\n Partial<InputContainerProps> & Partial<StyleProps>\n>`\n background-color: ${({ theme }) => theme.miscellaneous.surfaceColor};\n border-color: ${({\n theme,\n borderColor = 'secondary',\n borderColorGradation = 'light',\n }) => theme.color[borderColor][borderColorGradation]};\n border-radius: ${({ theme }) => theme.borderRadius.mili};\n border-width: ${({ theme }) => theme.borderWidth.pico};\n position: absolute;\n width: 100%;\n height: 100%;\n`;\n\nexport const StyledBorderKeeper = styled(StyledBorderKeeperBase)<\n Partial<StyleProps>\n>(\n props => css`\n ${focusedStyles(props)}\n ${disabledContainerStyles(props)}\n `\n);\n\nexport const StyledInputElement = styled(StyledInputElementBase)<\n InputElementProps & Partial<StyleProps>\n>(\n props => css`\n ${disabledInputStyles(props)}\n `\n);\n\nexport const StyledHintContainer = styled.View<Partial<StyleProps>>`\n margin-top: ${({ theme }) => theme.spacing.micro};\n flex-direction: row;\n align-items: center;\n`;\n\nexport const StyledHintIcon = styled(Icon)<Partial<StyleProps>>`\n margin-right: ${({ theme }) => theme.spacing.micro};\n`;\n"],"file":"styled.js"}
1
+ {"version":3,"sources":["../../../../src/components/atoms/Input/styled.ts"],"names":["leftIconStyles","leftComponent","theme","spacing","centi","rightIconStyles","rightComponent","disabledContainerStyles","disabled","disabledInputStyles","color","secondary","light","focusedStyles","focused","borderColor","borderWidth","nano","dark","StyledIconContent","styled","View","zIndex","default","StyledInputContainer","StyledInputElementBase","TextInput","font","stack","typography","base","fontSize","weight","bold","StyledLabelContainer","props","micro","StyledBorderKeeperBase","miscellaneous","surfaceColor","borderColorGradation","borderRadius","mili","pico","StyledBorderKeeper","StyledInputElement","StyledHintContainer","StyledHintIcon","Icon"],"mappings":";;;;;;;AAAA;;AACA;;AAGA;;AACA;;;;;;AAGA,MAAMA,cAAc,GAAG,CAAC;AACtBC,EAAAA,aADsB;AAEtBC,EAAAA;AAFsB,CAAD,KAIrB,CAACD,aAAD,IACA,gBAAI;AACN,oBAAoBC,KAAK,CAACC,OAAN,CAAcC,KAAM;AACxC,GAPA;;AASA,MAAMC,eAAe,GAAG,CAAC;AACvBC,EAAAA,cADuB;AAEvBJ,EAAAA;AAFuB,CAAD,KAItB,CAACI,cAAD,IACA,gBAAI;AACN,qBAAqBJ,KAAK,CAACC,OAAN,CAAcC,KAAM;AACzC,GAPA;;AASA,MAAMG,uBAAuB,GAAG,CAAC;AAC/BC,EAAAA;AAD+B,CAAD,KAG9BA,QAAQ,IACR,gBAAI;AACN;AACA,GANA;;AAQO,MAAMC,mBAAmB,GAAG,CAAC;AAClCD,EAAAA,QADkC;AAElCN,EAAAA;AAFkC,CAAD,KAIjCM,QAAQ,IACR,gBAAI;AACN,aAAaN,KADR,aACQA,KADR,uBACQA,KAAK,CAAEQ,KAAP,CAAaC,SAAb,CAAuBC,KAAM;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AAD,CAAQ;AAC7B,GARoC,CAA7B;;;AAWP,MAAME,sBAAsB,GAAGjB,gBAAOC,IAEpC;AACF,sBAAsB,CAAC;AAAEnB,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACoC,aAAN,CAAoBC,YAAa;AACtE,kBAAkB,CAAC;AACfrC,EAAAA,KADe;AAEfa,EAAAA,WAAW,GAAG,WAFC;AAGfyB,EAAAA,oBAAoB,GAAG;AAHR,CAAD,KAIVtC,KAAK,CAACQ,KAAN,CAAYK,WAAZ,EAAyByB,oBAAzB,CAA+C;AACvD,mBAAmB,CAAC;AAAEtC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACuC,YAAN,CAAmBC,IAAK;AAC1D,kBAAkB,CAAC;AAAExC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACc,WAAN,CAAkB2B,IAAK;AACxD;AACA;AACA;AACA,CAdA;AAgBO,MAAMC,kBAAkB,GAAG,qBAAOP,sBAAP,EAGhCF,KAAK,IAAI,gBAAI;AACf,MAAMtB,aAAa,CAACsB,KAAD,CAAQ;AAC3B,MAAM5B,uBAAuB,CAAC4B,KAAD,CAAQ;AACrC,GANkC,CAA3B;;AASA,MAAMU,kBAAkB,GAAG,qBAAOpB,sBAAP,EAGhCU,KAAK,IAAI,gBAAI;AACf,MAAM1B,mBAAmB,CAAC0B,KAAD,CAAQ;AACjC,GALkC,CAA3B;;AAQA,MAAMW,mBAAmB,GAAG1B,gBAAOC,IAA0B;AACpE,gBAAgB,CAAC;AAAEnB,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,OAAN,CAAciC,KAAM;AACnD;AACA;AACA,CAJO;;AAMA,MAAMW,cAAc,GAAG,qBAAOC,UAAP,CAAkC;AAChE,kBAAkB,CAAC;AAAE9C,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,OAAN,CAAciC,KAAM;AACrD,CAFO","sourcesContent":["import styled, { css } from '@emotion/native';\nimport { TextInput } from 'react-native';\nimport { InputElementProps } from '.';\nimport { StyleProps } from '../../../types/defaults';\nimport { RFValueStr } from '../../../utils';\nimport { Icon } from '../Icon';\nimport { InputContainerProps } from './InputContainer/InputContainer';\n\nconst leftIconStyles = ({\n leftComponent,\n theme,\n}: Partial<InputContainerProps> & StyleProps) =>\n !leftComponent &&\n css`\n padding-left: ${theme.spacing.centi};\n `;\n\nconst rightIconStyles = ({\n rightComponent,\n theme,\n}: Partial<InputContainerProps> & StyleProps) =>\n !rightComponent &&\n css`\n padding-right: ${theme.spacing.centi};\n `;\n\nconst disabledContainerStyles = ({\n disabled,\n}: Partial<InputContainerProps> & StyleProps) =>\n disabled &&\n css`\n background-color: transparent;\n `;\n\nexport const disabledInputStyles = ({\n disabled,\n theme,\n}: Partial<InputContainerProps> & Partial<StyleProps>) =>\n disabled &&\n css`\n color: ${theme?.color.secondary.light};\n `;\n\nconst focusedStyles = ({\n focused,\n borderColor = 'secondary',\n theme,\n}: Partial<InputContainerProps> & StyleProps) =>\n focused &&\n css`\n border-width: ${theme.borderWidth.nano};\n border-color: ${theme.color[borderColor].dark};\n `;\n\nexport const StyledIconContent = styled.View<Partial<StyleProps>>`\n z-index: ${({ theme }) => theme.zIndex.default};\n flex-direction: row;\n align-items: center;\n`;\n\nexport const StyledInputContainer = styled.View<\n Partial<InputContainerProps> & Partial<StyleProps>\n>`\n flex-direction: row;\n align-items: center;\n min-height: ${RFValueStr('44px')};\n`;\n\nexport const StyledInputElementBase = styled(TextInput)<\n InputElementProps & Partial<StyleProps>\n>`\n font-family: ${({ theme }) => `'${theme.font.stack.default}'`};\n font-size: ${({ theme }) => theme.typography.base.fontSize};\n font-weight: ${({ theme }) => theme.font.weight.bold};\n color: ${({ theme }) => theme.font.color.dark};\n`;\n\nexport const StyledLabelContainer = styled.View<\n Partial<InputContainerProps> & Partial<StyleProps>\n>(\n props => css`\n flex: 1;\n padding: ${props.theme.spacing.micro} 0;\n ${leftIconStyles(props)}\n ${rightIconStyles(props)}\n `\n);\n\nconst StyledBorderKeeperBase = styled.View<\n Partial<InputContainerProps> & Partial<StyleProps>\n>`\n background-color: ${({ theme }) => theme.miscellaneous.surfaceColor};\n border-color: ${({\n theme,\n borderColor = 'secondary',\n borderColorGradation = 'light',\n }) => theme.color[borderColor][borderColorGradation]};\n border-radius: ${({ theme }) => theme.borderRadius.mili};\n border-width: ${({ theme }) => theme.borderWidth.pico};\n position: absolute;\n width: 100%;\n height: 100%;\n`;\n\nexport const StyledBorderKeeper = styled(StyledBorderKeeperBase)<\n Partial<StyleProps>\n>(\n props => css`\n ${focusedStyles(props)}\n ${disabledContainerStyles(props)}\n `\n);\n\nexport const StyledInputElement = styled(StyledInputElementBase)<\n InputElementProps & Partial<StyleProps>\n>(\n props => css`\n ${disabledInputStyles(props)}\n `\n);\n\nexport const StyledHintContainer = styled.View<Partial<StyleProps>>`\n margin-top: ${({ theme }) => theme.spacing.micro};\n flex-direction: row;\n align-items: center;\n`;\n\nexport const StyledHintIcon = styled(Icon)<Partial<StyleProps>>`\n margin-right: ${({ theme }) => theme.spacing.micro};\n`;\n"],"file":"styled.js"}
@@ -1,8 +1,20 @@
1
1
  /// <reference types="react" />
2
- export declare const Container: import("@emotion/native").StyledComponent<any, {}, {
2
+ import { Animated } from 'react-native';
3
+ export declare const Container: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
4
+ theme?: import("@emotion/react").Theme | undefined;
5
+ as?: import("react").ElementType<any> | undefined;
6
+ } & Partial<import("../../../types/defaults").ThemeProviderProps>, {}, {
3
7
  ref?: import("react").Ref<import("react-native").View> | undefined;
4
8
  }>;
5
- export declare const Segment: import("@emotion/native").StyledComponent<any, {}, {
9
+ export declare const Segment: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
10
+ theme?: import("@emotion/react").Theme | undefined;
11
+ as?: import("react").ElementType<any> | undefined;
12
+ } & Partial<import("../../../types/defaults").ThemeProviderProps>, {}, {
6
13
  ref?: import("react").Ref<import("react-native").View> | undefined;
7
14
  }>;
8
- export declare const Progress: import("@emotion/native").StyledComponent<any, {}, {}>;
15
+ export declare const Progress: import("@emotion/native").StyledComponent<Animated.AnimatedProps<import("react-native").ViewProps & import("react").RefAttributes<import("react-native").View>> & {
16
+ children?: import("react").ReactNode;
17
+ } & {
18
+ theme?: import("@emotion/react").Theme | undefined;
19
+ as?: import("react").ElementType<any> | undefined;
20
+ } & Partial<import("../../../types/defaults").ThemeProviderProps>, {}, {}>;
@@ -9,6 +9,8 @@ var _native = _interopRequireDefault(require("@emotion/native"));
9
9
 
10
10
  var _reactNative = require("react-native");
11
11
 
12
+ var _utils = require("../../../utils");
13
+
12
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
15
 
14
16
  const Container = _native.default.View`
@@ -29,7 +31,7 @@ const Segment = _native.default.View`
29
31
  background-color: ${({
30
32
  theme
31
33
  }) => theme.color.secondary.light};
32
- border-right-width: 2px;
34
+ border-right-width: ${(0, _utils.RFValueStr)('2px')};
33
35
  border-color: ${({
34
36
  theme
35
37
  }) => theme.color.secondary.xlight};
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/atoms/ProgressBar/styled.ts"],"names":["Container","styled","View","theme","spacing","mili","Segment","color","secondary","light","xlight","Progress","Animated"],"mappings":";;;;;;;AAAA;;AAEA;;;;AAEO,MAAMA,SAAS,GAAGC,gBAAOC,IAA0B;AAC1D;AACA,YAAY,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,OAAN,CAAcC,IAAK;AAC9C,mBAAmB,CAAC;AAAEF,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,OAAN,CAAcC,IAAK;AACrD;AACA;AACA;AACA,CAPO;;AASA,MAAMC,OAAO,GAAGL,gBAAOC,IAA0B;AACxD;AACA,sBAAsB,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACI,KAAN,CAAYC,SAAZ,CAAsBC,KAAM;AACjE;AACA,kBAAkB,CAAC;AAAEN,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACI,KAAN,CAAYC,SAAZ,CAAsBE,MAAO;AAC9D,CALO;;AAOA,MAAMC,QAAQ,GAAG,qBAAOC,sBAASV,IAAhB,CAA2C;AACnE;AACA,kBAAkB,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACI,KAAN,CAAYC,SAAZ,CAAsBE,MAAO;AAC9D,CAHO","sourcesContent":["import styled from '@emotion/native';\nimport { StyleProps } from '@tecsinapse/react-core';\nimport { Animated } from 'react-native';\n\nexport const Container = styled.View<Partial<StyleProps>>`\n display: flex;\n height: ${({ theme }) => theme.spacing.mili};\n border-radius: ${({ theme }) => theme.spacing.mili};\n width: 100%;\n flex-direction: row;\n overflow: hidden;\n`;\n\nexport const Segment = styled.View<Partial<StyleProps>>`\n flex: 1;\n background-color: ${({ theme }) => theme.color.secondary.light};\n border-right-width: 2px;\n border-color: ${({ theme }) => theme.color.secondary.xlight};\n`;\n\nexport const Progress = styled(Animated.View)<Partial<StyleProps>>`\n height: 100%;\n border-color: ${({ theme }) => theme.color.secondary.xlight};\n`;\n"],"file":"styled.js"}
1
+ {"version":3,"sources":["../../../../src/components/atoms/ProgressBar/styled.ts"],"names":["Container","styled","View","theme","spacing","mili","Segment","color","secondary","light","xlight","Progress","Animated"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;AAEO,MAAMA,SAAS,GAAGC,gBAAOC,IAA0B;AAC1D;AACA,YAAY,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,OAAN,CAAcC,IAAK;AAC9C,mBAAmB,CAAC;AAAEF,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,OAAN,CAAcC,IAAK;AACrD;AACA;AACA;AACA,CAPO;;AASA,MAAMC,OAAO,GAAGL,gBAAOC,IAA0B;AACxD;AACA,sBAAsB,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACI,KAAN,CAAYC,SAAZ,CAAsBC,KAAM;AACjE,wBAAwB,uBAAW,KAAX,CAAkB;AAC1C,kBAAkB,CAAC;AAAEN,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACI,KAAN,CAAYC,SAAZ,CAAsBE,MAAO;AAC9D,CALO;;AAOA,MAAMC,QAAQ,GAAG,qBAAOC,sBAASV,IAAhB,CAA2C;AACnE;AACA,kBAAkB,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACI,KAAN,CAAYC,SAAZ,CAAsBE,MAAO;AAC9D,CAHO","sourcesContent":["import styled from '@emotion/native';\nimport { Animated } from 'react-native';\nimport { StyleProps } from '../../../types/defaults';\nimport { RFValueStr } from '../../../utils';\n\nexport const Container = styled.View<Partial<StyleProps>>`\n display: flex;\n height: ${({ theme }) => theme.spacing.mili};\n border-radius: ${({ theme }) => theme.spacing.mili};\n width: 100%;\n flex-direction: row;\n overflow: hidden;\n`;\n\nexport const Segment = styled.View<Partial<StyleProps>>`\n flex: 1;\n background-color: ${({ theme }) => theme.color.secondary.light};\n border-right-width: ${RFValueStr('2px')};\n border-color: ${({ theme }) => theme.color.secondary.xlight};\n`;\n\nexport const Progress = styled(Animated.View)<Partial<StyleProps>>`\n height: 100%;\n border-color: ${({ theme }) => theme.color.secondary.xlight};\n`;\n"],"file":"styled.js"}
@@ -11,13 +11,13 @@ var _react2 = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _reactNative = require("react-native");
13
13
 
14
- var _PressableSurface = require("../PressableSurface");
14
+ var _utils = require("../../../utils");
15
15
 
16
- var _styled = require("./styled");
16
+ var _PressableSurface = require("../PressableSurface");
17
17
 
18
18
  var _animation = require("./animation");
19
19
 
20
- var _utils = require("../../../utils");
20
+ var _styled = require("./styled");
21
21
 
22
22
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
23
 
@@ -38,42 +38,50 @@ const Switch = ({
38
38
  }) => {
39
39
  const theme = (0, _react.useTheme)();
40
40
 
41
- const transitionValue = _react2.default.useRef(new _reactNative.Animated.Value(active ? 16.5 : 0)).current;
41
+ const width = _react2.default.useRef(0);
42
+
43
+ const transitionValue = _react2.default.useRef(new _reactNative.Animated.Value(0)).current;
42
44
 
43
- const animatedColor = _react2.default.useRef(new _reactNative.Animated.Value(active ? 1 : 0)).current;
45
+ const animatedColor = _react2.default.useRef(new _reactNative.Animated.Value(0)).current;
44
46
 
45
- const getBackgroundColor = (color, variation) => {
46
- return disabled ? (0, _utils.lightenDarkenColor)(color, variation) : color;
47
+ const calculateTranslate = () => {
48
+ if (width.current > 0) {
49
+ return width.current - (0, _utils.extractNumbersFromString)(theme.spacing.micro) * 2 - (0, _utils.extractNumbersFromString)((0, _utils.RFValueStr)(_styled.SWITCH_PIN_WIDTH));
50
+ }
51
+
52
+ return 0;
53
+ };
54
+
55
+ const getBackgroundColor = color => {
56
+ return disabled ? (0, _utils.lightenDarkenColor)(theme.color[inactiveColor][inactiveColorTone], 20) : color;
47
57
  };
48
58
 
49
59
  const interpolateColor = animatedColor.interpolate({
50
60
  inputRange: [0, 1],
51
- outputRange: [getBackgroundColor(theme.color[inactiveColor][inactiveColorTone], 25), getBackgroundColor(theme.color[activeColor][activeColorTone], 50)]
61
+ outputRange: [getBackgroundColor(theme.color[inactiveColor][inactiveColorTone]), getBackgroundColor(theme.color[activeColor][activeColorTone])]
52
62
  });
53
- const animatedStyle = {
54
- backgroundColor: interpolateColor
55
- };
56
63
  (0, _react2.useEffect)(() => {
57
- (0, _animation.transitionSwitch)(!active, transitionValue, animatedColor);
64
+ const translate = calculateTranslate();
65
+ (0, _animation.transitionSwitch)(active, translate, transitionValue, animatedColor);
58
66
  }, [active]);
59
67
  const handleChange = (0, _react2.useCallback)(() => {
60
68
  onChange(!active);
61
69
  }, [active, onChange]);
62
- const stylesDefault = {
63
- borderRadius: (0, _utils.extractNumbersFromString)(theme.borderRadius.pill),
64
- paddingHorizontal: (0, _utils.extractNumbersFromString)(theme.spacing.micro),
65
- paddingVertical: 0,
66
- justifyContent: 'center',
67
- width: 40,
68
- height: 22
70
+
71
+ const handleSwitchLayout = lce => {
72
+ width.current = lce.nativeEvent.layout.width;
73
+ const translate = calculateTranslate();
74
+ (0, _animation.transitionSwitch)(active, translate, transitionValue, animatedColor);
69
75
  };
76
+
70
77
  return _react2.default.createElement(_PressableSurface.PressableSurface, _extends({}, rest, {
71
78
  onPress: handleChange,
72
79
  effect: "none",
73
80
  disabled: disabled
74
- }), _react2.default.createElement(_reactNative.Animated.View, {
75
- style: { ...animatedStyle,
76
- ...stylesDefault
81
+ }), _react2.default.createElement(_styled.StyledSwitchContent, {
82
+ onLayout: handleSwitchLayout,
83
+ style: {
84
+ backgroundColor: interpolateColor
77
85
  }
78
86
  }, _react2.default.createElement(_styled.StyledSwitch, {
79
87
  style: [dotStyle, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/atoms/Switch/Switch.tsx"],"names":["Switch","onChange","activeColor","activeColorTone","inactiveColor","inactiveColorTone","active","dotStyle","disabled","rest","theme","transitionValue","React","useRef","Animated","Value","current","animatedColor","getBackgroundColor","color","variation","interpolateColor","interpolate","inputRange","outputRange","animatedStyle","backgroundColor","handleChange","stylesDefault","borderRadius","pill","paddingHorizontal","spacing","micro","paddingVertical","justifyContent","width","height","transform","translateX"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;;;;;;;AAcA,MAAMA,MAAuB,GAAG,CAAC;AAC/BC,EAAAA,QAD+B;AAE/BC,EAAAA,WAAW,GAAG,SAFiB;AAG/BC,EAAAA,eAAe,GAAG,QAHa;AAI/BC,EAAAA,aAAa,GAAG,WAJe;AAK/BC,EAAAA,iBAAiB,GAAG,OALW;AAM/BC,EAAAA,MAN+B;AAO/BC,EAAAA,QAP+B;AAQ/BC,EAAAA,QAAQ,GAA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AACmB,YAAN,CAAmBC,IAA5C,CADiB;AAE/BC,IAAAA,iBAAiB,EAAE,qCAAyBrB,KAAK,CAACsB,OAAN,CAAcC,KAAvC,CAFY;AAG/BC,IAAAA,eAAe,EAAE,CAHc;AAI/BC,IAAAA,cAAc,EAAE,QAJe;AAK/BC,IAAAA,KAAK,EAAE,EALwB;AAM/BC,IAAAA,MAAM,EAAE;AANuB,GAAjC;AASA,SACE,8BAAC,kCAAD,eACM5B,IADN;AAEE,IAAA,OAAO,EAAEkB,YAFX;AAGE,IAAA,MAAM,EAAC,MAHT;AAIE,IAAA,QAAQ,EAAEnB;AAJZ,MAME,8BAAC,qBAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAE,EAAE,GAAGiB,aAAL;AAAoB,SAAGG;AAAvB;AAAtB,KACE,8BAAC,oBAAD;AACE,IAAA,KAAK,EAAE,CAACrB,QAAD,EAAW;AAAE+B,MAAAA,SAAS,EAAE,CAAC;AAAEC,QAAAA,UAAU,EAAE5B;AAAd,OAAD;AAAb,KAAX;AADT,IADF,CANF,CADF;AAcD,CAlED;;eAoEeX,M","sourcesContent":["import { useTheme } from '@emotion/react';\nimport React, { FC, useCallback, useEffect } from 'react';\nimport { Animated, StyleProp, ViewStyle, Text } from 'react-native';\nimport {\n ColorGradationType,\n ColorType,\n ThemeProp,\n} from '../../../types/defaults';\nimport { PressableSurface } from '../PressableSurface';\nimport { StyledSwitch } from './styled';\nimport { transitionSwitch } from './animation';\nimport { extractNumbersFromString, lightenDarkenColor } from '../../../utils';\n\nexport interface SwitchProps {\n onChange: (active: boolean) => void;\n active: boolean;\n activeColor?: ColorType;\n activeColorTone?: ColorGradationType;\n inactiveColor?: ColorType;\n inactiveColorTone?: ColorGradationType;\n style?: StyleProp<ViewStyle>;\n dotStyle?: StyleProp<ViewStyle>;\n disabled?: boolean;\n}\n\nconst Switch: FC<SwitchProps> = ({\n onChange,\n activeColor = 'primary',\n activeColorTone = 'medium',\n inactiveColor = 'secondary',\n inactiveColorTone = 'light',\n active,\n dotStyle,\n disabled = false,\n ...rest\n}): JSX.Element => {\n const theme = useTheme() as ThemeProp;\n\n const transitionValue = React.useRef(new Animated.Value(active ? 16.5 : 0))\n .current;\n\n const animatedColor = React.useRef(new Animated.Value(active ? 1 : 0))\n .current;\n\n const getBackgroundColor = (color: string, variation: number) => {\n return disabled ? lightenDarkenColor(color, variation) : color;\n };\n\n const interpolateColor = animatedColor.interpolate({\n inputRange: [0, 1],\n outputRange: [\n getBackgroundColor(theme.color[inactiveColor][inactiveColorTone], 25),\n getBackgroundColor(theme.color[activeColor][activeColorTone], 50),\n ],\n });\n\n const animatedStyle = {\n backgroundColor: interpolateColor,\n };\n\n useEffect(() => {\n transitionSwitch(!active, transitionValue, animatedColor);\n }, [active]);\n\n const handleChange = useCallback(() => {\n onChange(!active);\n }, [active, onChange]);\n\n const stylesDefault: ViewStyle = {\n borderRadius: extractNumbersFromString(theme.borderRadius.pill),\n paddingHorizontal: extractNumbersFromString(theme.spacing.micro),\n paddingVertical: 0,\n justifyContent: 'center',\n width: 40,\n height: 22,\n };\n\n return (\n <PressableSurface\n {...rest}\n onPress={handleChange}\n effect=\"none\"\n disabled={disabled}\n >\n <Animated.View style={{ ...animatedStyle, ...stylesDefault }}>\n <StyledSwitch\n style={[dotStyle, { transform: [{ translateX: transitionValue }] }]}\n />\n </Animated.View>\n </PressableSurface>\n );\n};\n\nexport default Switch;\n"],"file":"Switch.js"}
1
+ {"version":3,"sources":["../../../../src/components/atoms/Switch/Switch.tsx"],"names":["Switch","onChange","activeColor","activeColorTone","inactiveColor","inactiveColorTone","active","dotStyle","disabled","rest","theme","width","React","useRef","transitionValue","Animated","Value","current","animatedColor","calculateTranslate","spacing","micro","SWITCH_PIN_WIDTH","getBackgroundColor","color","interpolateColor","interpolate","inputRange","outputRange","translate","handleChange","handleSwitchLayout","lce","nativeEvent","layout","backgroundColor","transform","translateX"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAMA;;AACA;;AACA;;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} from 'react';\nimport { Animated, LayoutChangeEvent, StyleProp, ViewStyle } from 'react-native';\nimport {\n ColorGradationType,\n ColorType,\n ThemeProp\n} from '../../../types/defaults';\nimport { extractNumbersFromString, lightenDarkenColor, RFValueStr } from '../../../utils';\nimport { PressableSurface } from '../PressableSurface';\nimport { transitionSwitch } from './animation';\nimport { StyledSwitch, StyledSwitchContent, SWITCH_PIN_WIDTH } from './styled';\n\nexport interface SwitchProps {\n onChange: (active: boolean) => void;\n active: boolean;\n activeColor?: ColorType;\n activeColorTone?: ColorGradationType;\n inactiveColor?: ColorType;\n inactiveColorTone?: ColorGradationType;\n style?: StyleProp<ViewStyle>;\n dotStyle?: StyleProp<ViewStyle>;\n disabled?: boolean;\n}\n\nconst Switch: FC<SwitchProps> = ({\n onChange,\n activeColor = 'primary',\n activeColorTone = 'medium',\n inactiveColor = 'secondary',\n inactiveColorTone = 'light',\n active,\n dotStyle,\n disabled = false,\n ...rest\n}): JSX.Element => {\n const theme = useTheme() as ThemeProp;\n\n const width = React.useRef(0)\n const transitionValue = React.useRef(new Animated.Value(0)).current\n const animatedColor = React.useRef(new Animated.Value(0)).current\n \n const calculateTranslate = () => {\n if (width.current > 0) {\n return width.current - (extractNumbersFromString(theme.spacing.micro) * 2) - (extractNumbersFromString(RFValueStr(SWITCH_PIN_WIDTH)))\n }\n return 0\n }\n\n const getBackgroundColor = (color: string) => {\n return disabled ? lightenDarkenColor(theme.color[inactiveColor][inactiveColorTone], 20) : color;\n };\n\n const interpolateColor = animatedColor.interpolate({\n inputRange: [0, 1],\n outputRange: [\n getBackgroundColor(theme.color[inactiveColor][inactiveColorTone]),\n getBackgroundColor(theme.color[activeColor][activeColorTone]),\n ]\n });\n\n useEffect(() => {\n const translate = calculateTranslate()\n transitionSwitch(active, translate, transitionValue, animatedColor);\n }, [active]);\n\n const handleChange = useCallback(() => {\n onChange(!active);\n }, [active, onChange]);\n\n const handleSwitchLayout = (lce: LayoutChangeEvent) => {\n width.current = lce.nativeEvent.layout.width\n const translate = calculateTranslate()\n transitionSwitch(active, translate, transitionValue, animatedColor);\n }\n\n return (\n <PressableSurface\n {...rest}\n onPress={handleChange}\n effect=\"none\"\n disabled={disabled}\n >\n <StyledSwitchContent onLayout={handleSwitchLayout} style={{ backgroundColor: interpolateColor }}>\n <StyledSwitch style={[dotStyle, { transform: [{ translateX: transitionValue }] }]}/>\n </StyledSwitchContent>\n </PressableSurface>\n );\n};\n\nexport default Switch;\n"],"file":"Switch.js"}
@@ -1,2 +1,2 @@
1
1
  import { Animated } from 'react-native';
2
- export declare const transitionSwitch: (active: boolean, transitionValue: Animated.Value, animatedColor: Animated.Value) => void;
2
+ export declare const transitionSwitch: (active: boolean, translate: number, transitionValue: Animated.Value, animatedColor: Animated.Value) => void;
@@ -7,32 +7,40 @@ exports.transitionSwitch = void 0;
7
7
 
8
8
  var _reactNative = require("react-native");
9
9
 
10
- const transitionSwitch = (active, transitionValue, animatedColor) => {
11
- if (active) {
12
- _reactNative.Animated.timing(transitionValue, {
13
- toValue: 0,
14
- duration: 150,
15
- useNativeDriver: true
16
- }).start();
10
+ const ANIMATION_SPEED = 140;
17
11
 
18
- _reactNative.Animated.timing(animatedColor, {
19
- toValue: 0,
20
- duration: 150,
21
- useNativeDriver: false
22
- }).start();
23
- } else {
12
+ const transitionSwitch = (active, translate, transitionValue, animatedColor) => {
13
+ if (translate <= 0) return;
14
+
15
+ if (active) {
24
16
  _reactNative.Animated.timing(transitionValue, {
25
- toValue: 16.5,
26
- duration: 150,
17
+ toValue: translate,
18
+ duration: ANIMATION_SPEED,
19
+ easing: _reactNative.Easing.out(_reactNative.Easing.ease),
27
20
  useNativeDriver: true
28
21
  }).start();
29
22
 
30
23
  _reactNative.Animated.timing(animatedColor, {
31
24
  toValue: 1,
32
- duration: 150,
25
+ duration: ANIMATION_SPEED,
33
26
  useNativeDriver: false
34
27
  }).start();
28
+
29
+ return;
35
30
  }
31
+
32
+ _reactNative.Animated.timing(transitionValue, {
33
+ toValue: 0,
34
+ duration: ANIMATION_SPEED,
35
+ easing: _reactNative.Easing.out(_reactNative.Easing.ease),
36
+ useNativeDriver: true
37
+ }).start();
38
+
39
+ _reactNative.Animated.timing(animatedColor, {
40
+ toValue: 0,
41
+ duration: ANIMATION_SPEED,
42
+ useNativeDriver: false
43
+ }).start();
36
44
  };
37
45
 
38
46
  exports.transitionSwitch = transitionSwitch;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/atoms/Switch/animation.ts"],"names":["transitionSwitch","active","transitionValue","animatedColor","Animated","timing","toValue","duration","useNativeDriver","start"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,gBAAgB,GAAG,CAC9BC,MAD8B,EAE9BC,eAF8B,EAG9BC,aAH8B,KAIrB;AACT,MAAIF,MAAJ,EAAY;AACVG,0BAASC,MAAT,CAAgBH,eAAhB,EAAiC;AAC/BI,MAAAA,OAAO,EAAE,CADsB;AAE/BC,MAAAA,QAAQ,EAAE,GAFqB;AAG/BC,MAAAA,eAAe,EAAE;AAHc,KAAjC,EAIGC,KAJH;;AAKAL,0BAASC,MAAT,CAAgBF,aAAhB,EAA+B;AAC7BG,MAAAA,OAAO,EAAE,CADoB;AAE7BC,MAAAA,QAAQ,EAAE,GAFmB;AAG7BC,MAAAA,eAAe,EAAE;AAHY,KAA/B,EAIGC,KAJH;AAKD,GAXD,MAWO;AACLL,0BAASC,MAAT,CAAgBH,eAAhB,EAAiC;AAC/BI,MAAAA,OAAO,EAAE,IADsB;AAE/BC,MAAAA,QAAQ,EAAE,GAFqB;AAG/BC,MAAAA,eAAe,EAAE;AAHc,KAAjC,EAIGC,KAJH;;AAKAL,0BAASC,MAAT,CAAgBF,aAAhB,EAA+B;AAC7BG,MAAAA,OAAO,EAAE,CADoB;AAE7BC,MAAAA,QAAQ,EAAE,GAFmB;AAG7BC,MAAAA,eAAe,EAAE;AAHY,KAA/B,EAIGC,KAJH;AAKD;AACF,CA5BM","sourcesContent":["import { Animated } from 'react-native';\n\nexport const transitionSwitch = (\n active: boolean,\n transitionValue: Animated.Value,\n animatedColor: Animated.Value\n): void => {\n if (active) {\n Animated.timing(transitionValue, {\n toValue: 0,\n duration: 150,\n useNativeDriver: true,\n }).start();\n Animated.timing(animatedColor, {\n toValue: 0,\n duration: 150,\n useNativeDriver: false,\n }).start();\n } else {\n Animated.timing(transitionValue, {\n toValue: 16.5,\n duration: 150,\n useNativeDriver: true,\n }).start();\n Animated.timing(animatedColor, {\n toValue: 1,\n duration: 150,\n useNativeDriver: false,\n }).start();\n }\n};\n"],"file":"animation.js"}
1
+ {"version":3,"sources":["../../../../src/components/atoms/Switch/animation.ts"],"names":["ANIMATION_SPEED","transitionSwitch","active","translate","transitionValue","animatedColor","Animated","timing","toValue","duration","easing","Easing","out","ease","useNativeDriver","start"],"mappings":";;;;;;;AAAA;;AAEA,MAAMA,eAAe,GAAG,GAAxB;;AAEO,MAAMC,gBAAgB,GAAG,CAC9BC,MAD8B,EAE9BC,SAF8B,EAG9BC,eAH8B,EAI9BC,aAJ8B,KAKrB;AAET,MAAIF,SAAS,IAAI,CAAjB,EAAoB;;AAEpB,MAAID,MAAJ,EAAY;AACVI,0BAASC,MAAT,CAAgBH,eAAhB,EAAiC;AAC/BI,MAAAA,OAAO,EAAEL,SADsB;AAE/BM,MAAAA,QAAQ,EAAET,eAFqB;AAG/BU,MAAAA,MAAM,EAAEC,oBAAOC,GAAP,CAAWD,oBAAOE,IAAlB,CAHuB;AAI/BC,MAAAA,eAAe,EAAE;AAJc,KAAjC,EAKGC,KALH;;AAMAT,0BAASC,MAAT,CAAgBF,aAAhB,EAA+B;AAC7BG,MAAAA,OAAO,EAAE,CADoB;AAE7BC,MAAAA,QAAQ,EAAET,eAFmB;AAG7Bc,MAAAA,eAAe,EAAE;AAHY,KAA/B,EAIGC,KAJH;;AAKA;AACD;;AAEDT,wBAASC,MAAT,CAAgBH,eAAhB,EAAiC;AAC/BI,IAAAA,OAAO,EAAE,CADsB;AAE/BC,IAAAA,QAAQ,EAAET,eAFqB;AAG/BU,IAAAA,MAAM,EAAEC,oBAAOC,GAAP,CAAWD,oBAAOE,IAAlB,CAHuB;AAI/BC,IAAAA,eAAe,EAAE;AAJc,GAAjC,EAKGC,KALH;;AAMAT,wBAASC,MAAT,CAAgBF,aAAhB,EAA+B;AAC7BG,IAAAA,OAAO,EAAE,CADoB;AAE7BC,IAAAA,QAAQ,EAAET,eAFmB;AAG7Bc,IAAAA,eAAe,EAAE;AAHY,GAA/B,EAIGC,KAJH;AAMD,CApCM","sourcesContent":["import { Animated, Easing } from 'react-native';\n\nconst ANIMATION_SPEED = 140\n\nexport const transitionSwitch = (\n active: boolean,\n translate: number,\n transitionValue: Animated.Value,\n animatedColor: Animated.Value\n): void => {\n\n if (translate <= 0) return\n \n if (active) {\n Animated.timing(transitionValue, {\n toValue: translate,\n duration: ANIMATION_SPEED,\n easing: Easing.out(Easing.ease),\n useNativeDriver: true,\n }).start();\n Animated.timing(animatedColor, {\n toValue: 1,\n duration: ANIMATION_SPEED,\n useNativeDriver: false,\n }).start();\n return\n } \n\n Animated.timing(transitionValue, {\n toValue: 0,\n duration: ANIMATION_SPEED,\n easing: Easing.out(Easing.ease),\n useNativeDriver: true,\n }).start();\n Animated.timing(animatedColor, {\n toValue: 0,\n duration: ANIMATION_SPEED,\n useNativeDriver: false,\n }).start();\n\n};\n"],"file":"animation.js"}
@@ -1,2 +1,16 @@
1
- export declare const StyledSwitchContent: import("@emotion/native").StyledComponent<any, {}, {}>;
2
- export declare const StyledSwitch: import("@emotion/native").StyledComponent<any, {}, {}>;
1
+ /// <reference types="react" />
2
+ import { Animated } from 'react-native';
3
+ export declare const SWITCH_BODY_WIDTH = "40px";
4
+ export declare const SWITCH_PIN_WIDTH = "16px";
5
+ export declare const StyledSwitchContent: import("@emotion/native").StyledComponent<Animated.AnimatedProps<import("react-native").ViewProps & import("react").RefAttributes<import("react-native").View>> & {
6
+ children?: import("react").ReactNode;
7
+ } & {
8
+ theme?: import("@emotion/react").Theme | undefined;
9
+ as?: import("react").ElementType<any> | undefined;
10
+ } & Partial<import("../../../types/defaults").ThemeProviderProps>, {}, {}>;
11
+ export declare const StyledSwitch: import("@emotion/native").StyledComponent<Animated.AnimatedProps<import("react-native").ViewProps & import("react").RefAttributes<import("react-native").View>> & {
12
+ children?: import("react").ReactNode;
13
+ } & {
14
+ theme?: import("@emotion/react").Theme | undefined;
15
+ as?: import("react").ElementType<any> | undefined;
16
+ } & Partial<import("../../../types/defaults").ThemeProviderProps>, {}, {}>;
@@ -3,14 +3,20 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.StyledSwitch = exports.StyledSwitchContent = void 0;
6
+ exports.StyledSwitch = exports.StyledSwitchContent = exports.SWITCH_PIN_WIDTH = exports.SWITCH_BODY_WIDTH = void 0;
7
7
 
8
8
  var _native = _interopRequireDefault(require("@emotion/native"));
9
9
 
10
10
  var _reactNative = require("react-native");
11
11
 
12
+ var _utils = require("../../../utils");
13
+
12
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
15
 
16
+ const SWITCH_BODY_WIDTH = '40px';
17
+ exports.SWITCH_BODY_WIDTH = SWITCH_BODY_WIDTH;
18
+ const SWITCH_PIN_WIDTH = '16px';
19
+ exports.SWITCH_PIN_WIDTH = SWITCH_PIN_WIDTH;
14
20
  const StyledSwitchContent = (0, _native.default)(_reactNative.Animated.View)`
15
21
  border-radius: ${({
16
22
  theme
@@ -19,8 +25,8 @@ const StyledSwitchContent = (0, _native.default)(_reactNative.Animated.View)`
19
25
  theme
20
26
  }) => theme.spacing.micro};
21
27
  justify-content: center;
22
- width: 40px;
23
- height: 22px;
28
+ width: ${(0, _utils.RFValueStr)(SWITCH_BODY_WIDTH)};
29
+ height: ${(0, _utils.RFValueStr)('22px')};
24
30
  `;
25
31
  exports.StyledSwitchContent = StyledSwitchContent;
26
32
  const StyledSwitch = (0, _native.default)(_reactNative.Animated.View)`
@@ -30,8 +36,8 @@ const StyledSwitch = (0, _native.default)(_reactNative.Animated.View)`
30
36
  background-color: ${({
31
37
  theme
32
38
  }) => theme.miscellaneous.surfaceColor};
33
- width: 16px;
34
- height: 16px;
39
+ width: ${(0, _utils.RFValueStr)(SWITCH_PIN_WIDTH)};
40
+ height: ${(0, _utils.RFValueStr)('16px')};
35
41
  `;
36
42
  exports.StyledSwitch = StyledSwitch;
37
43
  //# sourceMappingURL=styled.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/atoms/Switch/styled.ts"],"names":["StyledSwitchContent","Animated","View","theme","borderRadius","pill","spacing","micro","StyledSwitch","miscellaneous","surfaceColor"],"mappings":";;;;;;;AAAA;;AAEA;;;;AAEO,MAAMA,mBAAmB,GAAG,qBAAOC,sBAASC,IAAhB,CAEjC;AACF,mBAAmB,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,YAAN,CAAmBC,IAAK;AAC1D,eAAe,CAAC;AAAEF,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACG,OAAN,CAAcC,KAAM;AAClD;AACA;AACA;AACA,CARO;;AAUA,MAAMC,YAAY,GAAG,qBAAOP,sBAASC,IAAhB,CAA2C;AACvE,mBAAmB,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,YAAN,CAAmBC,IAAK;AAC1D,sBAAsB,CAAC;AAAEF,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACM,aAAN,CAAoBC,YAAa;AACtE;AACA;AACA,CALO","sourcesContent":["import styled from '@emotion/native';\nimport { StyleProps, SwitchProps } from '@tecsinapse/react-core';\nimport { Animated } from 'react-native';\n\nexport const StyledSwitchContent = styled(Animated.View)<\n Partial<SwitchProps> & Partial<StyleProps>\n>`\n border-radius: ${({ theme }) => theme.borderRadius.pill};\n padding: 0 ${({ theme }) => theme.spacing.micro};\n justify-content: center;\n width: 40px;\n height: 22px;\n`;\n\nexport const StyledSwitch = styled(Animated.View)<Partial<StyleProps>>`\n border-radius: ${({ theme }) => theme.borderRadius.pill};\n background-color: ${({ theme }) => theme.miscellaneous.surfaceColor};\n width: 16px;\n height: 16px;\n`;\n"],"file":"styled.js"}
1
+ {"version":3,"sources":["../../../../src/components/atoms/Switch/styled.ts"],"names":["SWITCH_BODY_WIDTH","SWITCH_PIN_WIDTH","StyledSwitchContent","Animated","View","theme","borderRadius","pill","spacing","micro","StyledSwitch","miscellaneous","surfaceColor"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;AAEO,MAAMA,iBAAiB,GAAG,MAA1B;;AACA,MAAMC,gBAAgB,GAAG,MAAzB;;AAEA,MAAMC,mBAAmB,GAAG,qBAAOC,sBAASC,IAAhB,CAEjC;AACF,mBAAmB,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,YAAN,CAAmBC,IAAK;AAC1D,eAAe,CAAC;AAAEF,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACG,OAAN,CAAcC,KAAM;AAClD;AACA,WAAW,uBAAWT,iBAAX,CAA8B;AACzC,YAAY,uBAAW,MAAX,CAAmB;AAC/B,CARO;;AAUA,MAAMU,YAAY,GAAG,qBAAOP,sBAASC,IAAhB,CAA2C;AACvE,mBAAmB,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACC,YAAN,CAAmBC,IAAK;AAC1D,sBAAsB,CAAC;AAAEF,EAAAA;AAAF,CAAD,KAAeA,KAAK,CAACM,aAAN,CAAoBC,YAAa;AACtE,WAAW,uBAAWX,gBAAX,CAA6B;AACxC,YAAY,uBAAW,MAAX,CAAmB;AAC/B,CALO","sourcesContent":["import styled from '@emotion/native';\nimport { Animated } from 'react-native';\nimport { StyleProps } from '../../../types/defaults';\nimport { RFValueStr } from '../../../utils';\n\nexport const SWITCH_BODY_WIDTH = '40px'\nexport const SWITCH_PIN_WIDTH = '16px'\n\nexport const StyledSwitchContent = styled(Animated.View)<\n Partial<StyleProps>\n>`\n border-radius: ${({ theme }) => theme.borderRadius.pill};\n padding: 0 ${({ theme }) => theme.spacing.micro};\n justify-content: center;\n width: ${RFValueStr(SWITCH_BODY_WIDTH)};\n height: ${RFValueStr('22px')};\n`;\n\nexport const StyledSwitch = styled(Animated.View)<Partial<StyleProps>>`\n border-radius: ${({ theme }) => theme.borderRadius.pill};\n background-color: ${({ theme }) => theme.miscellaneous.surfaceColor};\n width: ${RFValueStr(SWITCH_PIN_WIDTH)};\n height: ${RFValueStr('16px')};\n`;\n"],"file":"styled.js"}