react-native-mantine 0.10.0 → 0.12.0

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 (100) hide show
  1. package/lib/commonjs/components/Button/Button.styles.js +1 -0
  2. package/lib/commonjs/components/Button/Button.styles.js.map +1 -1
  3. package/lib/commonjs/components/Button/index.js +28 -14
  4. package/lib/commonjs/components/Button/index.js.map +1 -1
  5. package/lib/commonjs/components/Gradient/Gradient.js +2 -2
  6. package/lib/commonjs/components/Gradient/Gradient.js.map +1 -1
  7. package/lib/commonjs/components/LinearGradient/PlatformLinearGradient.js +78 -0
  8. package/lib/commonjs/components/LinearGradient/PlatformLinearGradient.js.map +1 -0
  9. package/lib/commonjs/components/LinearGradient/index.js +13 -0
  10. package/lib/commonjs/components/LinearGradient/index.js.map +1 -0
  11. package/lib/commonjs/components/Pagination/index.js +1 -1
  12. package/lib/commonjs/components/Pagination/index.js.map +1 -1
  13. package/lib/commonjs/components/SegmentedControl/index.js +21 -11
  14. package/lib/commonjs/components/SegmentedControl/index.js.map +1 -1
  15. package/lib/commonjs/components/Table/Table.example.js +197 -5
  16. package/lib/commonjs/components/Table/Table.example.js.map +1 -1
  17. package/lib/commonjs/components/Table/index.js +27 -3
  18. package/lib/commonjs/components/Table/index.js.map +1 -1
  19. package/lib/commonjs/components/index.js +4 -4
  20. package/lib/commonjs/components/index.js.map +1 -1
  21. package/lib/commonjs/theme/create-theme.js +5 -1
  22. package/lib/commonjs/theme/create-theme.js.map +1 -1
  23. package/lib/commonjs/theme/functions/attach-functions.js +1 -0
  24. package/lib/commonjs/theme/functions/attach-functions.js.map +1 -1
  25. package/lib/module/components/Button/Button.styles.js +1 -0
  26. package/lib/module/components/Button/Button.styles.js.map +1 -1
  27. package/lib/module/components/Button/index.js +19 -5
  28. package/lib/module/components/Button/index.js.map +1 -1
  29. package/lib/module/components/Gradient/Gradient.js +2 -2
  30. package/lib/module/components/Gradient/Gradient.js.map +1 -1
  31. package/lib/module/components/LinearGradient/PlatformLinearGradient.js +73 -0
  32. package/lib/module/components/LinearGradient/PlatformLinearGradient.js.map +1 -0
  33. package/lib/module/components/LinearGradient/index.js +4 -0
  34. package/lib/module/components/LinearGradient/index.js.map +1 -0
  35. package/lib/module/components/Pagination/index.js +1 -1
  36. package/lib/module/components/Pagination/index.js.map +1 -1
  37. package/lib/module/components/SegmentedControl/index.js +21 -11
  38. package/lib/module/components/SegmentedControl/index.js.map +1 -1
  39. package/lib/module/components/Table/Table.example.js +195 -5
  40. package/lib/module/components/Table/Table.example.js.map +1 -1
  41. package/lib/module/components/Table/index.js +27 -3
  42. package/lib/module/components/Table/index.js.map +1 -1
  43. package/lib/module/components/index.js +1 -1
  44. package/lib/module/components/index.js.map +1 -1
  45. package/lib/module/theme/create-theme.js +5 -1
  46. package/lib/module/theme/create-theme.js.map +1 -1
  47. package/lib/module/theme/functions/attach-functions.js +1 -0
  48. package/lib/module/theme/functions/attach-functions.js.map +1 -1
  49. package/lib/typescript/commonjs/src/components/Button/Button.styles.d.ts.map +1 -1
  50. package/lib/typescript/commonjs/src/components/Button/index.d.ts.map +1 -1
  51. package/lib/typescript/commonjs/src/components/LinearGradient/PlatformLinearGradient.d.ts +22 -0
  52. package/lib/typescript/commonjs/src/components/LinearGradient/PlatformLinearGradient.d.ts.map +1 -0
  53. package/lib/typescript/commonjs/src/components/LinearGradient/index.d.ts +3 -0
  54. package/lib/typescript/commonjs/src/components/LinearGradient/index.d.ts.map +1 -0
  55. package/lib/typescript/commonjs/src/components/SegmentedControl/index.d.ts.map +1 -1
  56. package/lib/typescript/commonjs/src/components/Table/Table.example.d.ts +10 -0
  57. package/lib/typescript/commonjs/src/components/Table/Table.example.d.ts.map +1 -1
  58. package/lib/typescript/commonjs/src/components/Table/index.d.ts +9 -0
  59. package/lib/typescript/commonjs/src/components/Table/index.d.ts.map +1 -1
  60. package/lib/typescript/commonjs/src/components/index.d.ts +1 -1
  61. package/lib/typescript/commonjs/src/components/index.d.ts.map +1 -1
  62. package/lib/typescript/commonjs/src/theme/create-theme.d.ts.map +1 -1
  63. package/lib/typescript/commonjs/src/theme/functions/attach-functions.d.ts.map +1 -1
  64. package/lib/typescript/module/src/components/Button/Button.styles.d.ts.map +1 -1
  65. package/lib/typescript/module/src/components/Button/index.d.ts.map +1 -1
  66. package/lib/typescript/module/src/components/LinearGradient/PlatformLinearGradient.d.ts +22 -0
  67. package/lib/typescript/module/src/components/LinearGradient/PlatformLinearGradient.d.ts.map +1 -0
  68. package/lib/typescript/module/src/components/LinearGradient/index.d.ts +3 -0
  69. package/lib/typescript/module/src/components/LinearGradient/index.d.ts.map +1 -0
  70. package/lib/typescript/module/src/components/SegmentedControl/index.d.ts.map +1 -1
  71. package/lib/typescript/module/src/components/Table/Table.example.d.ts +10 -0
  72. package/lib/typescript/module/src/components/Table/Table.example.d.ts.map +1 -1
  73. package/lib/typescript/module/src/components/Table/index.d.ts +9 -0
  74. package/lib/typescript/module/src/components/Table/index.d.ts.map +1 -1
  75. package/lib/typescript/module/src/components/index.d.ts +1 -1
  76. package/lib/typescript/module/src/components/index.d.ts.map +1 -1
  77. package/lib/typescript/module/src/theme/create-theme.d.ts.map +1 -1
  78. package/lib/typescript/module/src/theme/functions/attach-functions.d.ts.map +1 -1
  79. package/package.json +1 -1
  80. package/src/components/Button/Button.styles.ts +1 -0
  81. package/src/components/Button/index.tsx +14 -5
  82. package/src/components/Gradient/Gradient.tsx +3 -3
  83. package/src/components/LinearGradient/PlatformLinearGradient.tsx +73 -0
  84. package/src/components/LinearGradient/index.tsx +2 -0
  85. package/src/components/Pagination/index.tsx +1 -1
  86. package/src/components/SegmentedControl/index.tsx +195 -128
  87. package/src/components/Table/Table.example.tsx +135 -5
  88. package/src/components/Table/index.tsx +32 -4
  89. package/src/components/index.tsx +1 -1
  90. package/src/theme/create-theme.ts +5 -1
  91. package/src/theme/functions/attach-functions.ts +1 -0
  92. package/lib/commonjs/components/Burger/index.js +0 -183
  93. package/lib/commonjs/components/Burger/index.js.map +0 -1
  94. package/lib/module/components/Burger/index.js +0 -180
  95. package/lib/module/components/Burger/index.js.map +0 -1
  96. package/lib/typescript/commonjs/src/components/Burger/index.d.ts +0 -21
  97. package/lib/typescript/commonjs/src/components/Burger/index.d.ts.map +0 -1
  98. package/lib/typescript/module/src/components/Burger/index.d.ts +0 -21
  99. package/lib/typescript/module/src/components/Burger/index.d.ts.map +0 -1
  100. package/src/components/Burger/index.tsx +0 -230
@@ -1,183 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Burger = void 0;
7
- var _react = require("react");
8
- var _reactNative = require("react-native");
9
- var _themeProvider = require("../../theme/theme-provider.js");
10
- var _index = require("../../theme/index.js");
11
- var _jsxRuntime = require("react/jsx-runtime");
12
- const sizes = {
13
- xs: 12,
14
- sm: 18,
15
- md: 24,
16
- lg: 34,
17
- xl: 42
18
- };
19
- const useStyles = (0, _index.createStyles)((_theme, {
20
- size,
21
- color,
22
- disabled
23
- }) => {
24
- const burgerSize = typeof size === 'number' ? size : (0, _index.getSize)({
25
- size,
26
- sizes
27
- });
28
- return {
29
- root: {
30
- width: burgerSize + 8,
31
- height: burgerSize,
32
- justifyContent: 'center',
33
- alignItems: 'center',
34
- opacity: disabled ? 0.4 : 1
35
- },
36
- burger: {
37
- width: burgerSize,
38
- height: burgerSize,
39
- justifyContent: 'space-between',
40
- position: 'relative'
41
- },
42
- line: {
43
- height: Math.max(1, Math.round(burgerSize / 12)),
44
- backgroundColor: color,
45
- borderRadius: burgerSize / 24
46
- }
47
- };
48
- });
49
- const defaultProps = {
50
- size: 'md',
51
- transitionDuration: 300,
52
- accessibilityLabel: 'Toggle navigation',
53
- disabled: false
54
- };
55
- const Burger = exports.Burger = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
56
- const {
57
- opened,
58
- onPress,
59
- color,
60
- size = 'md',
61
- transitionDuration,
62
- accessibilityLabel,
63
- style,
64
- disabled,
65
- ...others
66
- } = (0, _themeProvider.useComponentDefaultProps)('Burger', defaultProps, props);
67
- const topLineRotation = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
68
- const middleLineOpacity = (0, _react.useRef)(new _reactNative.Animated.Value(1)).current;
69
- const bottomLineRotation = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
70
- const topLineTranslateY = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
71
- const bottomLineTranslateY = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
72
- const burgerSize = typeof size === 'number' ? size : (0, _index.getSize)({
73
- size,
74
- sizes
75
- });
76
- const lineHeight = Math.max(1, Math.round(burgerSize / 12));
77
- const spacing = (burgerSize - lineHeight * 3) / 2;
78
- const {
79
- styles,
80
- sx
81
- } = useStyles({
82
- size,
83
- color: color || '#000',
84
- disabled: disabled || false
85
- }, {
86
- name: 'Burger'
87
- });
88
- (0, _react.useEffect)(() => {
89
- const config = {
90
- duration: transitionDuration,
91
- useNativeDriver: true
92
- };
93
- if (opened) {
94
- _reactNative.Animated.parallel([_reactNative.Animated.timing(topLineRotation, {
95
- toValue: 1,
96
- ...config
97
- }), _reactNative.Animated.timing(middleLineOpacity, {
98
- toValue: 0,
99
- ...config
100
- }), _reactNative.Animated.timing(bottomLineRotation, {
101
- toValue: 1,
102
- ...config
103
- }), _reactNative.Animated.timing(topLineTranslateY, {
104
- toValue: 1,
105
- ...config
106
- }), _reactNative.Animated.timing(bottomLineTranslateY, {
107
- toValue: 1,
108
- ...config
109
- })]).start();
110
- } else {
111
- _reactNative.Animated.parallel([_reactNative.Animated.timing(topLineRotation, {
112
- toValue: 0,
113
- ...config
114
- }), _reactNative.Animated.timing(middleLineOpacity, {
115
- toValue: 1,
116
- ...config
117
- }), _reactNative.Animated.timing(bottomLineRotation, {
118
- toValue: 0,
119
- ...config
120
- }), _reactNative.Animated.timing(topLineTranslateY, {
121
- toValue: 0,
122
- ...config
123
- }), _reactNative.Animated.timing(bottomLineTranslateY, {
124
- toValue: 0,
125
- ...config
126
- })]).start();
127
- }
128
- }, [opened, transitionDuration, topLineRotation, middleLineOpacity, bottomLineRotation, topLineTranslateY, bottomLineTranslateY]);
129
- const topLineStyle = {
130
- transform: [{
131
- translateY: topLineTranslateY.interpolate({
132
- inputRange: [0, 1],
133
- outputRange: [0, spacing + lineHeight]
134
- })
135
- }, {
136
- rotate: topLineRotation.interpolate({
137
- inputRange: [0, 1],
138
- outputRange: ['0deg', '45deg']
139
- })
140
- }]
141
- };
142
- const bottomLineStyle = {
143
- transform: [{
144
- translateY: bottomLineTranslateY.interpolate({
145
- inputRange: [0, 1],
146
- outputRange: [0, -(spacing + lineHeight)]
147
- })
148
- }, {
149
- rotate: bottomLineRotation.interpolate({
150
- inputRange: [0, 1],
151
- outputRange: ['0deg', '-45deg']
152
- })
153
- }]
154
- };
155
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
156
- ref: ref,
157
- onPress: onPress,
158
- disabled: disabled,
159
- activeOpacity: 0.6,
160
- accessible: true,
161
- accessibilityLabel: accessibilityLabel,
162
- accessibilityRole: "button",
163
- accessibilityState: {
164
- expanded: opened
165
- },
166
- style: sx(styles.root, style),
167
- ...others,
168
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Animated.View, {
169
- style: styles.burger,
170
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
171
- style: [styles.line, topLineStyle]
172
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
173
- style: [styles.line, {
174
- opacity: middleLineOpacity
175
- }]
176
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
177
- style: [styles.line, bottomLineStyle]
178
- })]
179
- })
180
- });
181
- });
182
- Burger.displayName = 'Burger';
183
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","require","_reactNative","_themeProvider","_index","_jsxRuntime","sizes","xs","sm","md","lg","xl","useStyles","createStyles","_theme","size","color","disabled","burgerSize","getSize","root","width","height","justifyContent","alignItems","opacity","burger","position","line","Math","max","round","backgroundColor","borderRadius","defaultProps","transitionDuration","accessibilityLabel","Burger","exports","forwardRef","props","ref","opened","onPress","style","others","useComponentDefaultProps","topLineRotation","useRef","Animated","Value","current","middleLineOpacity","bottomLineRotation","topLineTranslateY","bottomLineTranslateY","lineHeight","spacing","styles","sx","name","useEffect","config","duration","useNativeDriver","parallel","timing","toValue","start","topLineStyle","transform","translateY","interpolate","inputRange","outputRange","rotate","bottomLineStyle","jsx","TouchableOpacity","activeOpacity","accessible","accessibilityRole","accessibilityState","expanded","children","jsxs","View","displayName"],"sourceRoot":"../../../../src","sources":["components/Burger/index.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAA2C,IAAAI,WAAA,GAAAJ,OAAA;AA6B3C,MAAMK,KAAK,GAAG;EACZC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE;AACN,CAAC;AAED,MAAMC,SAAS,GAAG,IAAAC,mBAAY,EAC5B,CACEC,MAAM,EACN;EACEC,IAAI;EACJC,KAAK;EACLC;AAKF,CAAC,KACE;EACH,MAAMC,UAAU,GAAG,OAAOH,IAAI,KAAK,QAAQ,GAAGA,IAAI,GAAI,IAAAI,cAAO,EAAC;IAAEJ,IAAI;IAAET;EAAM,CAAC,CAAuB;EAEpG,OAAO;IACLc,IAAI,EAAE;MACJC,KAAK,EAAEH,UAAU,GAAG,CAAC;MACrBI,MAAM,EAAEJ,UAAU;MAClBK,cAAc,EAAE,QAAiB;MACjCC,UAAU,EAAE,QAAiB;MAC7BC,OAAO,EAAER,QAAQ,GAAG,GAAG,GAAG;I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IAAI,EAAEyC,YAAY;MAAE,CAAE,CAAC,eACrD,IAAAhE,WAAA,CAAAwE,GAAA,EAAC3E,YAAA,CAAA+C,QAAQ,CAACqC,IAAI;QAAC1C,KAAK,EAAE,CAACc,MAAM,CAAC9B,IAAI,EAAE;UAAEH,OAAO,EAAE2B;QAAkB,CAAC;MAAE,CAAE,CAAC,eACvE,IAAA/C,WAAA,CAAAwE,GAAA,EAAC3E,YAAA,CAAA+C,QAAQ,CAACqC,IAAI;QAAC1C,KAAK,EAAE,CAACc,MAAM,CAAC9B,IAAI,EAAEgD,eAAe;MAAE,CAAE,CAAC;IAAA,CAC3C;EAAC,CACA,CAAC;AAEvB,CAAC,CAAC;AAEFvC,MAAM,CAACkD,WAAW,GAAG,QAAQ","ignoreList":[]}
@@ -1,180 +0,0 @@
1
- "use strict";
2
-
3
- import { forwardRef, useEffect, useRef } from 'react';
4
- import { TouchableOpacity, Animated } from 'react-native';
5
- import { useComponentDefaultProps } from "../../theme/theme-provider.js";
6
- import { createStyles } from "../../theme/index.js";
7
- import { getSize } from "../../theme/index.js";
8
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
- const sizes = {
10
- xs: 12,
11
- sm: 18,
12
- md: 24,
13
- lg: 34,
14
- xl: 42
15
- };
16
- const useStyles = createStyles((_theme, {
17
- size,
18
- color,
19
- disabled
20
- }) => {
21
- const burgerSize = typeof size === 'number' ? size : getSize({
22
- size,
23
- sizes
24
- });
25
- return {
26
- root: {
27
- width: burgerSize + 8,
28
- height: burgerSize,
29
- justifyContent: 'center',
30
- alignItems: 'center',
31
- opacity: disabled ? 0.4 : 1
32
- },
33
- burger: {
34
- width: burgerSize,
35
- height: burgerSize,
36
- justifyContent: 'space-between',
37
- position: 'relative'
38
- },
39
- line: {
40
- height: Math.max(1, Math.round(burgerSize / 12)),
41
- backgroundColor: color,
42
- borderRadius: burgerSize / 24
43
- }
44
- };
45
- });
46
- const defaultProps = {
47
- size: 'md',
48
- transitionDuration: 300,
49
- accessibilityLabel: 'Toggle navigation',
50
- disabled: false
51
- };
52
- export const Burger = /*#__PURE__*/forwardRef((props, ref) => {
53
- const {
54
- opened,
55
- onPress,
56
- color,
57
- size = 'md',
58
- transitionDuration,
59
- accessibilityLabel,
60
- style,
61
- disabled,
62
- ...others
63
- } = useComponentDefaultProps('Burger', defaultProps, props);
64
- const topLineRotation = useRef(new Animated.Value(0)).current;
65
- const middleLineOpacity = useRef(new Animated.Value(1)).current;
66
- const bottomLineRotation = useRef(new Animated.Value(0)).current;
67
- const topLineTranslateY = useRef(new Animated.Value(0)).current;
68
- const bottomLineTranslateY = useRef(new Animated.Value(0)).current;
69
- const burgerSize = typeof size === 'number' ? size : getSize({
70
- size,
71
- sizes
72
- });
73
- const lineHeight = Math.max(1, Math.round(burgerSize / 12));
74
- const spacing = (burgerSize - lineHeight * 3) / 2;
75
- const {
76
- styles,
77
- sx
78
- } = useStyles({
79
- size,
80
- color: color || '#000',
81
- disabled: disabled || false
82
- }, {
83
- name: 'Burger'
84
- });
85
- useEffect(() => {
86
- const config = {
87
- duration: transitionDuration,
88
- useNativeDriver: true
89
- };
90
- if (opened) {
91
- Animated.parallel([Animated.timing(topLineRotation, {
92
- toValue: 1,
93
- ...config
94
- }), Animated.timing(middleLineOpacity, {
95
- toValue: 0,
96
- ...config
97
- }), Animated.timing(bottomLineRotation, {
98
- toValue: 1,
99
- ...config
100
- }), Animated.timing(topLineTranslateY, {
101
- toValue: 1,
102
- ...config
103
- }), Animated.timing(bottomLineTranslateY, {
104
- toValue: 1,
105
- ...config
106
- })]).start();
107
- } else {
108
- Animated.parallel([Animated.timing(topLineRotation, {
109
- toValue: 0,
110
- ...config
111
- }), Animated.timing(middleLineOpacity, {
112
- toValue: 1,
113
- ...config
114
- }), Animated.timing(bottomLineRotation, {
115
- toValue: 0,
116
- ...config
117
- }), Animated.timing(topLineTranslateY, {
118
- toValue: 0,
119
- ...config
120
- }), Animated.timing(bottomLineTranslateY, {
121
- toValue: 0,
122
- ...config
123
- })]).start();
124
- }
125
- }, [opened, transitionDuration, topLineRotation, middleLineOpacity, bottomLineRotation, topLineTranslateY, bottomLineTranslateY]);
126
- const topLineStyle = {
127
- transform: [{
128
- translateY: topLineTranslateY.interpolate({
129
- inputRange: [0, 1],
130
- outputRange: [0, spacing + lineHeight]
131
- })
132
- }, {
133
- rotate: topLineRotation.interpolate({
134
- inputRange: [0, 1],
135
- outputRange: ['0deg', '45deg']
136
- })
137
- }]
138
- };
139
- const bottomLineStyle = {
140
- transform: [{
141
- translateY: bottomLineTranslateY.interpolate({
142
- inputRange: [0, 1],
143
- outputRange: [0, -(spacing + lineHeight)]
144
- })
145
- }, {
146
- rotate: bottomLineRotation.interpolate({
147
- inputRange: [0, 1],
148
- outputRange: ['0deg', '-45deg']
149
- })
150
- }]
151
- };
152
- return /*#__PURE__*/_jsx(TouchableOpacity, {
153
- ref: ref,
154
- onPress: onPress,
155
- disabled: disabled,
156
- activeOpacity: 0.6,
157
- accessible: true,
158
- accessibilityLabel: accessibilityLabel,
159
- accessibilityRole: "button",
160
- accessibilityState: {
161
- expanded: opened
162
- },
163
- style: sx(styles.root, style),
164
- ...others,
165
- children: /*#__PURE__*/_jsxs(Animated.View, {
166
- style: styles.burger,
167
- children: [/*#__PURE__*/_jsx(Animated.View, {
168
- style: [styles.line, topLineStyle]
169
- }), /*#__PURE__*/_jsx(Animated.View, {
170
- style: [styles.line, {
171
- opacity: middleLineOpacity
172
- }]
173
- }), /*#__PURE__*/_jsx(Animated.View, {
174
- style: [styles.line, bottomLineStyle]
175
- })]
176
- })
177
- });
178
- });
179
- Burger.displayName = 'Burger';
180
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["forwardRef","useEffect","useRef","TouchableOpacity","Animated","useComponentDefaultProps","createStyles","getSize","jsx","_jsx","jsxs","_jsxs","sizes","xs","sm","md","lg","xl","useStyles","_theme","size","color","disabled","burgerSize","root","width","height","justifyContent","alignItems","opacity","burger","position","line","Math","max","round","backgroundColor","borderRadius","defaultProps","transitionDuration","accessibilityLabel","Burger","props","ref","opened","onPress","style","others","topLineRotation","Value","current","middleLineOpacity","bottomLineRotation","topLineTranslateY","bottomLineTranslateY","lineHeight","spacing","styles","sx","name","config","duration","useNativeDriver","parallel","timing","toValue","start","topLineStyle","transform","translateY","interpolate","inputRange","outputRange","rotate","bottomLineStyle","activeOpacity","accessible","accessibilityRole","accessibilityState","expanded","children","View","displayName"],"sourceRoot":"../../../../src","sources":["components/Burger/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACrD,SAASC,gBAAgB,EAAEC,QAAQ,QAAQ,cAAc;AAEzD,SAASC,wBAAwB,QAAQ,+BAA4B;AACrE,SAASC,YAAY,QAAQ,sBAAa;AAC1C,SAASC,OAAO,QAAQ,sBAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AA4BtC,MAAMC,KAAK,GAAG;EACZC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE;AACN,CAAC;AAED,MAAMC,SAAS,GAAGZ,YAAY,CAC5B,CACEa,MAAM,EACN;EACEC,IAAI;EACJC,KAAK;EACLC;AAKF,CAAC,KACE;EACH,MAAMC,UAAU,GAAG,OAAOH,IAAI,KAAK,QAAQ,GAAGA,IAAI,GAAIb,OAAO,CAAC;IAAEa,IAAI;IAAER;EAAM,CAAC,CAAuB;EAEpG,OAAO;IACLY,IAAI,EAAE;MACJC,KAAK,EAAEF,UAAU,GAAG,CAAC;MACrBG,MAAM,EAAEH,UAAU;MAClBI,cAAc,EAAE,QAAiB;MACjCC,UAAU,EAAE,QAAiB;MAC7BC,OAAO,EAAEP,QAAQ,GAAG,GAAG,GAAG;IAC5B,CAAC;IACDQ,MAAM,EAAE;MACNL,KAAK,EAAEF,UAAU;MACj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AACnC,KAAK,EAAE,CAACW,MAAM,CAACzB,IAAI,EAAE0C,eAAe;MAAE,CAAE,CAAC;IAAA,CAC3C;EAAC,CACA,CAAC;AAEvB,CAAC,CAAC;AAEFjC,MAAM,CAACyC,WAAW,GAAG,QAAQ","ignoreList":[]}
@@ -1,21 +0,0 @@
1
- import type { DefaultProps, MantineSize } from '../../theme/types';
2
- export interface BurgerProps extends DefaultProps {
3
- /** Burger state: true for cross, false for burger */
4
- opened: boolean;
5
- /** Called when burger is pressed */
6
- onPress?: () => void;
7
- /** Burger color */
8
- color?: string;
9
- /** Predefined burger size or number to set width and height in px */
10
- size?: MantineSize | number;
11
- /** Transition duration in ms */
12
- transitionDuration?: number;
13
- /** Accessibility label */
14
- accessibilityLabel?: string;
15
- /** Additional styles */
16
- style?: any;
17
- /** Disabled state */
18
- disabled?: boolean;
19
- }
20
- export declare const Burger: import("react").ForwardRefExoticComponent<BurgerProps & import("react").RefAttributes<any>>;
21
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Burger/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKnE,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC/C,qDAAqD;IACrD,MAAM,EAAE,OAAO,CAAC;IAEhB,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB,mBAAmB;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,qEAAqE;IACrE,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAE5B,gCAAgC;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,0BAA0B;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,wBAAwB;IACxB,KAAK,CAAC,EAAE,GAAG,CAAC;IAEZ,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAuDD,eAAO,MAAM,MAAM,6FA6IjB,CAAC"}
@@ -1,21 +0,0 @@
1
- import type { DefaultProps, MantineSize } from '../../theme/types';
2
- export interface BurgerProps extends DefaultProps {
3
- /** Burger state: true for cross, false for burger */
4
- opened: boolean;
5
- /** Called when burger is pressed */
6
- onPress?: () => void;
7
- /** Burger color */
8
- color?: string;
9
- /** Predefined burger size or number to set width and height in px */
10
- size?: MantineSize | number;
11
- /** Transition duration in ms */
12
- transitionDuration?: number;
13
- /** Accessibility label */
14
- accessibilityLabel?: string;
15
- /** Additional styles */
16
- style?: any;
17
- /** Disabled state */
18
- disabled?: boolean;
19
- }
20
- export declare const Burger: import("react").ForwardRefExoticComponent<BurgerProps & import("react").RefAttributes<any>>;
21
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Burger/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKnE,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC/C,qDAAqD;IACrD,MAAM,EAAE,OAAO,CAAC;IAEhB,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB,mBAAmB;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,qEAAqE;IACrE,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAE5B,gCAAgC;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,0BAA0B;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,wBAAwB;IACxB,KAAK,CAAC,EAAE,GAAG,CAAC;IAEZ,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAuDD,eAAO,MAAM,MAAM,6FA6IjB,CAAC"}
@@ -1,230 +0,0 @@
1
- import { forwardRef, useEffect, useRef } from 'react';
2
- import { TouchableOpacity, Animated } from 'react-native';
3
- import type { DefaultProps, MantineSize } from '../../theme/types';
4
- import { useComponentDefaultProps } from '../../theme/theme-provider';
5
- import { createStyles } from '../../theme';
6
- import { getSize } from '../../theme';
7
-
8
- export interface BurgerProps extends DefaultProps {
9
- /** Burger state: true for cross, false for burger */
10
- opened: boolean;
11
-
12
- /** Called when burger is pressed */
13
- onPress?: () => void;
14
-
15
- /** Burger color */
16
- color?: string;
17
-
18
- /** Predefined burger size or number to set width and height in px */
19
- size?: MantineSize | number;
20
-
21
- /** Transition duration in ms */
22
- transitionDuration?: number;
23
-
24
- /** Accessibility label */
25
- accessibilityLabel?: string;
26
-
27
- /** Additional styles */
28
- style?: any;
29
-
30
- /** Disabled state */
31
- disabled?: boolean;
32
- }
33
-
34
- const sizes = {
35
- xs: 12,
36
- sm: 18,
37
- md: 24,
38
- lg: 34,
39
- xl: 42,
40
- };
41
-
42
- const useStyles = createStyles(
43
- (
44
- _theme,
45
- {
46
- size,
47
- color,
48
- disabled,
49
- }: {
50
- size: MantineSize | number;
51
- color: string;
52
- disabled: boolean;
53
- }
54
- ) => {
55
- const burgerSize = typeof size === 'number' ? size : (getSize({ size, sizes }) as unknown as number);
56
-
57
- return {
58
- root: {
59
- width: burgerSize + 8,
60
- height: burgerSize,
61
- justifyContent: 'center' as const,
62
- alignItems: 'center' as const,
63
- opacity: disabled ? 0.4 : 1,
64
- },
65
- burger: {
66
- width: burgerSize,
67
- height: burgerSize,
68
- justifyContent: 'space-between' as const,
69
- position: 'relative' as const,
70
- },
71
- line: {
72
- height: Math.max(1, Math.round(burgerSize / 12)),
73
- backgroundColor: color,
74
- borderRadius: burgerSize / 24,
75
- },
76
- };
77
- }
78
- );
79
-
80
- const defaultProps: Partial<BurgerProps> = {
81
- size: 'md',
82
- transitionDuration: 300,
83
- accessibilityLabel: 'Toggle navigation',
84
- disabled: false,
85
- };
86
-
87
- export const Burger = forwardRef<any, BurgerProps>((props, ref) => {
88
- const {
89
- opened,
90
- onPress,
91
- color,
92
- size = 'md',
93
- transitionDuration,
94
- accessibilityLabel,
95
- style,
96
- disabled,
97
- ...others
98
- } = useComponentDefaultProps('Burger', defaultProps, props);
99
-
100
- const topLineRotation = useRef(new Animated.Value(0)).current;
101
- const middleLineOpacity = useRef(new Animated.Value(1)).current;
102
- const bottomLineRotation = useRef(new Animated.Value(0)).current;
103
- const topLineTranslateY = useRef(new Animated.Value(0)).current;
104
- const bottomLineTranslateY = useRef(new Animated.Value(0)).current;
105
-
106
- const burgerSize = typeof size === 'number' ? size : (getSize({ size, sizes }) as unknown as number);
107
- const lineHeight = Math.max(1, Math.round(burgerSize / 12));
108
- const spacing = (burgerSize - lineHeight * 3) / 2;
109
-
110
- const { styles, sx } = useStyles(
111
- {
112
- size,
113
- color: color || '#000',
114
- disabled: disabled || false,
115
- },
116
- { name: 'Burger' }
117
- ) as any;
118
-
119
- useEffect(() => {
120
- const config = {
121
- duration: transitionDuration,
122
- useNativeDriver: true,
123
- };
124
-
125
- if (opened) {
126
- Animated.parallel([
127
- Animated.timing(topLineRotation, {
128
- toValue: 1,
129
- ...config,
130
- }),
131
- Animated.timing(middleLineOpacity, {
132
- toValue: 0,
133
- ...config,
134
- }),
135
- Animated.timing(bottomLineRotation, {
136
- toValue: 1,
137
- ...config,
138
- }),
139
- Animated.timing(topLineTranslateY, {
140
- toValue: 1,
141
- ...config,
142
- }),
143
- Animated.timing(bottomLineTranslateY, {
144
- toValue: 1,
145
- ...config,
146
- }),
147
- ]).start();
148
- } else {
149
- Animated.parallel([
150
- Animated.timing(topLineRotation, {
151
- toValue: 0,
152
- ...config,
153
- }),
154
- Animated.timing(middleLineOpacity, {
155
- toValue: 1,
156
- ...config,
157
- }),
158
- Animated.timing(bottomLineRotation, {
159
- toValue: 0,
160
- ...config,
161
- }),
162
- Animated.timing(topLineTranslateY, {
163
- toValue: 0,
164
- ...config,
165
- }),
166
- Animated.timing(bottomLineTranslateY, {
167
- toValue: 0,
168
- ...config,
169
- }),
170
- ]).start();
171
- }
172
- }, [opened, transitionDuration, topLineRotation, middleLineOpacity, bottomLineRotation, topLineTranslateY, bottomLineTranslateY]);
173
-
174
- const topLineStyle = {
175
- transform: [
176
- {
177
- translateY: topLineTranslateY.interpolate({
178
- inputRange: [0, 1],
179
- outputRange: [0, spacing + lineHeight],
180
- }),
181
- },
182
- {
183
- rotate: topLineRotation.interpolate({
184
- inputRange: [0, 1],
185
- outputRange: ['0deg', '45deg'],
186
- }),
187
- },
188
- ],
189
- };
190
-
191
- const bottomLineStyle = {
192
- transform: [
193
- {
194
- translateY: bottomLineTranslateY.interpolate({
195
- inputRange: [0, 1],
196
- outputRange: [0, -(spacing + lineHeight)],
197
- }),
198
- },
199
- {
200
- rotate: bottomLineRotation.interpolate({
201
- inputRange: [0, 1],
202
- outputRange: ['0deg', '-45deg'],
203
- }),
204
- },
205
- ],
206
- };
207
-
208
- return (
209
- <TouchableOpacity
210
- ref={ref}
211
- onPress={onPress}
212
- disabled={disabled}
213
- activeOpacity={0.6}
214
- accessible={true}
215
- accessibilityLabel={accessibilityLabel}
216
- accessibilityRole="button"
217
- accessibilityState={{ expanded: opened }}
218
- style={sx(styles.root, style)}
219
- {...others}
220
- >
221
- <Animated.View style={styles.burger}>
222
- <Animated.View style={[styles.line, topLineStyle]} />
223
- <Animated.View style={[styles.line, { opacity: middleLineOpacity }]} />
224
- <Animated.View style={[styles.line, bottomLineStyle]} />
225
- </Animated.View>
226
- </TouchableOpacity>
227
- );
228
- });
229
-
230
- Burger.displayName = 'Burger';