@momo-kits/calculator-keyboard 0.125.4-rc.7 → 0.150.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,115 @@
1
+ import UIKit
2
+ import Foundation
3
+
4
+ import UIKit
5
+ import Foundation
6
+
7
+ class CalculatorKeyboardView: UIView {
8
+ weak var input: InputCalculator?
9
+
10
+ private let keys: [[String]] = [
11
+ ["AC", "÷", "×", "back"],
12
+ ["7", "8", "9", "-"],
13
+ ["4", "5", "6", "+"],
14
+ ["1", "2", "3", "="],
15
+ ["000", "0"]
16
+ ]
17
+ private let SEPARATOR_WIDTH: CGFloat = 4
18
+ private let specialKeys: Set<String> = ["=", "-", "×", "÷", "AC", "back", "+"]
19
+
20
+ override init(frame: CGRect) {
21
+ super.init(frame: frame)
22
+ setup()
23
+ }
24
+
25
+ required init?(coder aDecoder: NSCoder) {
26
+ fatalError("init(coder:) has not been implemented")
27
+ }
28
+
29
+ public func setKeyboardColor(_ color: UIColor) {
30
+ self.setup(color)
31
+ }
32
+
33
+ private func setup(_ color: UIColor = UIColor(hex: "#d8d8d8")) {
34
+ self.subviews.forEach { $0.removeFromSuperview() }
35
+
36
+ backgroundColor = UIColor(hex: "#f2f2f6")
37
+ let buttonWidth = (UIScreen.main.bounds.width - SEPARATOR_WIDTH * 2 - 3 * SEPARATOR_WIDTH) / 4
38
+ let buttonHeight: CGFloat = (290 - SEPARATOR_WIDTH * 2 - 4 * SEPARATOR_WIDTH) / 5
39
+
40
+ // Create a wrapper view
41
+ let contentView = UIView()
42
+ contentView.translatesAutoresizingMaskIntoConstraints = false
43
+ addSubview(contentView)
44
+
45
+ // Set contentView constraints
46
+ NSLayoutConstraint.activate([
47
+ contentView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: SEPARATOR_WIDTH),
48
+ contentView.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -SEPARATOR_WIDTH),
49
+ contentView.topAnchor.constraint(equalTo: topAnchor, constant: SEPARATOR_WIDTH),
50
+ contentView.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -SEPARATOR_WIDTH)
51
+ ])
52
+
53
+ // Add buttons to the wrapper view
54
+ var yOffset: CGFloat = 0
55
+ for row in keys {
56
+ var xOffset: CGFloat = 0
57
+ for key in row {
58
+ let button = UIButton(type: .system)
59
+ button.backgroundColor = UIColor.white
60
+ button.layer.cornerRadius = 8
61
+ button.setTitle(key, for: .normal)
62
+ button.setTitleColor(.black, for: .normal)
63
+ button.titleLabel?.font = UIFont.systemFont(ofSize: 24, weight: .medium)
64
+ button.nativeID = key
65
+
66
+ var buttonFrame = CGRect(x: xOffset, y: yOffset, width: buttonWidth, height: buttonHeight)
67
+ if key == "=" {
68
+ buttonFrame.size.height = buttonHeight * 2 + SEPARATOR_WIDTH
69
+ }
70
+ if key == "000" {
71
+ buttonFrame.size.width = buttonWidth * 2 + SEPARATOR_WIDTH
72
+ }
73
+
74
+ button.frame = buttonFrame
75
+
76
+ if key == "back" {
77
+ button.setTitle("", for: .normal)
78
+ let image = UIImage(systemName: "delete.backward", withConfiguration: UIImage.SymbolConfiguration(weight: .bold))
79
+ button.setImage(image, for: .normal)
80
+ button.tintColor = .black
81
+ }
82
+
83
+ if specialKeys.contains(key) {
84
+ button.setTitleColor(.black, for: .normal)
85
+ button.backgroundColor = color
86
+ }
87
+
88
+ button.addTarget(self, action: #selector(keyPressed(_:)), for: .touchUpInside)
89
+ contentView.addSubview(button)
90
+
91
+ // Adjust xOffset for the next button in the row
92
+ xOffset += buttonFrame.width + SEPARATOR_WIDTH
93
+ }
94
+ // Adjust yOffset for the next row
95
+ yOffset += buttonHeight + SEPARATOR_WIDTH
96
+ }
97
+ }
98
+
99
+
100
+ @objc private func keyPressed(_ sender: UIButton) {
101
+ guard let key = sender.nativeID else { return }
102
+ switch key {
103
+ case "AC":
104
+ input?.clearText()
105
+ case "back":
106
+ input?.onBackSpace()
107
+ case "=":
108
+ input?.calculateResult()
109
+ case "+", "-", "÷", "×":
110
+ input?.keyDidPress(" \(key) ")
111
+ default:
112
+ input?.keyDidPress(key)
113
+ }
114
+ }
115
+ }
@@ -0,0 +1,23 @@
1
+ #import <React/RCTBridgeModule.h>
2
+ #import <React/RCTViewManager.h>
3
+ #import <React/RCTBaseTextInputViewManager.h>
4
+ #import <React/RCTSinglelineTextInputView.h>
5
+ #import <React/RCTUITextField.h>
6
+ #import <React/RCTBaseTextInputViewManager.h>
7
+
8
+ #import <React/RCTBridge.h>
9
+ #import <React/RCTConvert.h>
10
+ #import <React/RCTFont.h>
11
+ #import <React/RCTShadowView+Layout.h>
12
+ #import <React/RCTShadowView.h>
13
+ #import <React/RCTUIManager.h>
14
+ #import <React/RCTUIManagerObserverCoordinator.h>
15
+ #import <React/RCTUIManagerUtils.h>
16
+
17
+ #import <React/RCTBaseTextInputShadowView.h>
18
+ #import <React/RCTBaseTextInputView.h>
19
+ #import <React/RCTConvert+Text.h>
20
+
21
+ @interface Calculator : NSObject <RCTBridgeModule>
22
+
23
+ @end
@@ -0,0 +1,76 @@
1
+ #import <InputCalculator-Bridging-Header.h>
2
+
3
+ @implementation Calculator
4
+
5
+ - (dispatch_queue_t)methodQueue
6
+ {
7
+ return dispatch_get_main_queue();
8
+ }
9
+
10
+ RCT_EXPORT_MODULE()
11
+
12
+ @end
13
+
14
+ @interface RCT_EXTERN_MODULE(RCTInputCalculator, RCTViewManager)
15
+
16
+ RCT_REMAP_VIEW_PROPERTY(autoCapitalize, backedTextInputView.autocapitalizationType, UITextAutocapitalizationType)
17
+ RCT_REMAP_VIEW_PROPERTY(autoCorrect, backedTextInputView.autocorrectionType, UITextAutocorrectionType)
18
+ RCT_REMAP_VIEW_PROPERTY(contextMenuHidden, backedTextInputView.contextMenuHidden, BOOL)
19
+ RCT_REMAP_VIEW_PROPERTY(editable, backedTextInputView.editable, BOOL)
20
+ RCT_REMAP_VIEW_PROPERTY(enablesReturnKeyAutomatically, backedTextInputView.enablesReturnKeyAutomatically, BOOL)
21
+ RCT_REMAP_VIEW_PROPERTY(keyboardAppearance, backedTextInputView.keyboardAppearance, UIKeyboardAppearance)
22
+ RCT_REMAP_VIEW_PROPERTY(placeholder, backedTextInputView.placeholder, NSString)
23
+ RCT_REMAP_VIEW_PROPERTY(placeholderTextColor, backedTextInputView.placeholderColor, UIColor)
24
+ RCT_REMAP_VIEW_PROPERTY(returnKeyType, backedTextInputView.returnKeyType, UIReturnKeyType)
25
+ RCT_REMAP_VIEW_PROPERTY(selectionColor, backedTextInputView.tintColor, UIColor)
26
+ RCT_REMAP_VIEW_PROPERTY(spellCheck, backedTextInputView.spellCheckingType, UITextSpellCheckingType)
27
+ RCT_REMAP_VIEW_PROPERTY(caretHidden, backedTextInputView.caretHidden, BOOL)
28
+ RCT_REMAP_VIEW_PROPERTY(clearButtonMode, backedTextInputView.clearButtonMode, UITextFieldViewMode)
29
+ RCT_REMAP_VIEW_PROPERTY(scrollEnabled, backedTextInputView.scrollEnabled, BOOL)
30
+ RCT_REMAP_VIEW_PROPERTY(secureTextEntry, backedTextInputView.secureTextEntry, BOOL)
31
+ RCT_REMAP_VIEW_PROPERTY(smartInsertDelete, backedTextInputView.smartInsertDeleteType, UITextSmartInsertDeleteType)
32
+
33
+ RCT_EXPORT_VIEW_PROPERTY(autoFocus, BOOL)
34
+ RCT_EXPORT_VIEW_PROPERTY(submitBehavior, NSString)
35
+ RCT_EXPORT_VIEW_PROPERTY(clearTextOnFocus, BOOL)
36
+ RCT_EXPORT_VIEW_PROPERTY(keyboardType, UIKeyboardType)
37
+ RCT_EXPORT_VIEW_PROPERTY(showSoftInputOnFocus, BOOL)
38
+ RCT_EXPORT_VIEW_PROPERTY(maxLength, NSNumber)
39
+ RCT_EXPORT_VIEW_PROPERTY(selectTextOnFocus, BOOL)
40
+ RCT_EXPORT_VIEW_PROPERTY(selection, RCTTextSelection)
41
+ RCT_EXPORT_VIEW_PROPERTY(inputAccessoryViewID, NSString)
42
+ RCT_EXPORT_VIEW_PROPERTY(textContentType, NSString)
43
+ RCT_EXPORT_VIEW_PROPERTY(passwordRules, NSString)
44
+
45
+ RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock)
46
+ RCT_EXPORT_VIEW_PROPERTY(onKeyPressSync, RCTDirectEventBlock)
47
+ RCT_EXPORT_VIEW_PROPERTY(onChangeSync, RCTDirectEventBlock)
48
+ RCT_EXPORT_VIEW_PROPERTY(onSelectionChange, RCTDirectEventBlock)
49
+ RCT_EXPORT_VIEW_PROPERTY(onScroll, RCTDirectEventBlock)
50
+
51
+ RCT_EXPORT_VIEW_PROPERTY(mostRecentEventCount, NSInteger)
52
+
53
+ RCT_EXPORT_SHADOW_PROPERTY(text, NSString)
54
+ RCT_EXPORT_SHADOW_PROPERTY(placeholder, NSString)
55
+ RCT_EXPORT_SHADOW_PROPERTY(onContentSizeChange, RCTDirectEventBlock)
56
+
57
+ RCT_EXPORT_METHOD(focus : (nonnull NSNumber *)viewTag)
58
+ {
59
+ [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
60
+ UIView *view = viewRegistry[viewTag];
61
+ [view reactFocus];
62
+ }];
63
+ }
64
+
65
+ RCT_EXPORT_METHOD(blur : (nonnull NSNumber *)viewTag)
66
+ {
67
+ [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
68
+ UIView *view = viewRegistry[viewTag];
69
+ [view reactBlur];
70
+ }];
71
+ }
72
+
73
+ RCT_EXPORT_VIEW_PROPERTY(keyboardColor, UIColor)
74
+
75
+ @end
76
+
@@ -0,0 +1,103 @@
1
+ import Foundation
2
+ import UIKit
3
+
4
+ @objc(RCTInputCalculator)
5
+ class RCTInputCalculator: RCTBaseTextInputViewManager {
6
+ override func view() -> UIView! {
7
+ return InputCalculator(bridge: bridge)
8
+ }
9
+
10
+ override static func requiresMainQueueSetup() -> Bool {
11
+ return true
12
+ }
13
+
14
+ }
15
+
16
+ class InputCalculator: RCTSinglelineTextInputView {
17
+ var bridge: RCTBridge?
18
+ var keyboardView: CalculatorKeyboardView?
19
+
20
+ @objc var value: String = ""
21
+
22
+ @objc var keyboardColor: UIColor = UIColor(hex: "#d9d9d9") {
23
+ didSet {
24
+ self.keyboardView?.setKeyboardColor(keyboardColor)
25
+ }
26
+ }
27
+
28
+ override init(bridge: RCTBridge) {
29
+ super.init(bridge: bridge)
30
+ self.bridge = bridge
31
+ self.keyboardView = CalculatorKeyboardView()
32
+ self.keyboardView!.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.size.width, height: 290 + getbottomInset())
33
+ self.keyboardView!.input = self
34
+
35
+ backedTextInputView.inputView = self.keyboardView
36
+ backedTextInputView.inputView?.reloadInputViews()
37
+ }
38
+ func getbottomInset() -> CGFloat {
39
+ let window = UIApplication.shared.windows.first?.rootViewController?.view
40
+ let bottom = (window?.safeAreaInsets.bottom ?? 0) > 0 ? 21 : 0
41
+ return CGFloat(bottom)
42
+ }
43
+
44
+ func keyDidPress(_ key: String) {
45
+ backedTextInputView.insertText(key)
46
+ value += key
47
+ if let bridge = bridge {
48
+ bridge.eventDispatcher().sendTextEvent(with: .change, reactTag: reactTag, text: value, key: "\(key)", eventCount: 1)
49
+ }
50
+ }
51
+
52
+ func clearText() {
53
+ value = ""
54
+ (backedTextInputView as? UITextField)?.text = ""
55
+ if let bridge = bridge {
56
+ bridge.eventDispatcher().sendTextEvent(with: .change, reactTag: reactTag, text: value, key: "clear", eventCount: 1)
57
+ }
58
+ }
59
+
60
+ func onBackSpace() {
61
+ value = value.dropLast().description
62
+ DispatchQueue.main.async {
63
+ if let range = self.backedTextInputView.selectedTextRange,
64
+ let fromRange = self.backedTextInputView.position(from: range.start, offset: -1),
65
+ let newRange = self.backedTextInputView.textRange(from: fromRange, to: range.start)
66
+ {
67
+ self.backedTextInputView.replace(newRange, withText: "")
68
+ }
69
+ }
70
+
71
+ if let bridge = bridge {
72
+ bridge.eventDispatcher().sendTextEvent(with: .change, reactTag: reactTag, text: value, key: "back", eventCount: 1)
73
+ }
74
+ }
75
+
76
+ func calculateResult() {
77
+ guard let textField = backedTextInputView as? UITextField,
78
+ let text = textField.text?.replacingOccurrences(of: "×", with: "*").replacingOccurrences(of: "÷", with: "/")
79
+ else {
80
+ return
81
+ }
82
+
83
+ let pattern = "^\\s*(-?\\d+(\\.\\d+)?\\s*[-+*/]\\s*)*-?\\d+(\\.\\d+)?\\s*$"
84
+ let regex = try? NSRegularExpression(pattern: pattern)
85
+ let range = NSRange(location: 0, length: text.utf16.count)
86
+
87
+ if regex?.firstMatch(in: text, options: [], range: range) != nil {
88
+ let expression = NSExpression(format: text)
89
+ if let result = expression.expressionValue(with: nil, context: nil) as? NSNumber {
90
+ textField.text = result.stringValue
91
+ value = result.stringValue
92
+ if let bridge = bridge {
93
+ bridge.eventDispatcher().sendTextEvent(with: .change, reactTag: reactTag, text: value, key: "=", eventCount: 1)
94
+ }
95
+ }
96
+ }
97
+ else {
98
+ print("Invalid expression")
99
+ }
100
+ }
101
+
102
+ }
103
+
@@ -0,0 +1,23 @@
1
+
2
+ import Foundation
3
+ import UIKit
4
+
5
+ extension UIColor {
6
+ convenience init(hex: String) {
7
+ let hex = hex.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)
8
+ var int = UInt64()
9
+ Scanner(string: hex).scanHexInt64(&int)
10
+ let a, r, g, b: UInt64
11
+ switch hex.count {
12
+ case 3: // RGB (12-bit)
13
+ (a, r, g, b) = (255, (int >> 8) * 17, (int >> 4 & 0xF) * 17, (int & 0xF) * 17)
14
+ case 6: // RGB (24-bit)
15
+ (a, r, g, b) = (255, int >> 16, int >> 8 & 0xFF, int & 0xFF)
16
+ case 8: // ARGB (32-bit)
17
+ (a, r, g, b) = (int >> 24, int >> 16 & 0xFF, int >> 8 & 0xFF, int & 0xFF)
18
+ default:
19
+ (a, r, g, b) = (255, 0, 0, 0)
20
+ }
21
+ self.init(red: CGFloat(r) / 255, green: CGFloat(g) / 255, blue: CGFloat(b) / 255, alpha: CGFloat(a) / 255)
22
+ }
23
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _jsxRuntime = require("react/jsx-runtime");
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ const NativeInput = (0, _reactNative.requireNativeComponent)('RCTInputCalculator');
12
+ const InputCalculator = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
13
+ const _onChange = event => {
14
+ const currentText = event.nativeEvent.text;
15
+ props.onChange && props.onChange(event);
16
+ props.onChangeText && props.onChangeText(currentText);
17
+ };
18
+ const text = props.text || props.defaultValue || '';
19
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(NativeInput, {
20
+ ...props,
21
+ ref: ref,
22
+ onChange: _onChange,
23
+ text: text,
24
+ keybardColor: (0, _reactNative.processColor)(props.keyboardColor)
25
+ });
26
+ });
27
+ var _default = exports.default = InputCalculator;
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_jsxRuntime","e","__esModule","default","NativeInput","requireNativeComponent","InputCalculator","React","forwardRef","props","ref","_onChange","event","currentText","nativeEvent","text","onChange","onChangeText","defaultValue","jsx","keybardColor","processColor","keyboardColor","_default","exports"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAMsB,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGtB,MAAMG,WAAW,GAAG,IAAAC,mCAAsB,EAAM,oBAAoB,CAAC;AAOrE,MAAMC,eAAe,gBAAGC,cAAK,CAACC,UAAU,CACtC,CAACC,KAAK,EAAEC,GAAG,KAAK;EACd,MAAMC,SAAS,GACbC,KAAqD,IAClD;IACH,MAAMC,WAAW,GAAGD,KAAK,CAACE,WAAW,CAACC,IAAI;IAC1CN,KAAK,CAACO,QAAQ,IAAIP,KAAK,CAACO,QAAQ,CAACJ,KAAK,CAAC;IACvCH,KAAK,CAACQ,YAAY,IAAIR,KAAK,CAACQ,YAAY,CAACJ,WAAW,CAAC;EACvD,CAAC;EAED,MAAME,IAAI,GAAGN,KAAK,CAACM,IAAI,IAAIN,KAAK,CAACS,YAAY,IAAI,EAAE;EAEnD,oBACE,IAAAlB,WAAA,CAAAmB,GAAA,EAACf,WAAW;IAAA,GACNK,KAAK;IACTC,GAAG,EAAEA,GAAI;IACTM,QAAQ,EAAEL,SAAU;IACpBI,IAAI,EAAEA,IAAK;IACXK,YAAY,EAAE,IAAAC,yBAAY,EAACZ,KAAK,CAACa,aAAa;EAAE,CACjD,CAAC;AAEN,CACF,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAArB,OAAA,GAEaG,eAAe","ignoreList":[]}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ import React from 'react';
4
+ import { processColor } from 'react-native';
5
+ import { requireNativeComponent } from 'react-native';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ const NativeInput = requireNativeComponent('RCTInputCalculator');
8
+ const InputCalculator = /*#__PURE__*/React.forwardRef((props, ref) => {
9
+ const _onChange = event => {
10
+ const currentText = event.nativeEvent.text;
11
+ props.onChange && props.onChange(event);
12
+ props.onChangeText && props.onChangeText(currentText);
13
+ };
14
+ const text = props.text || props.defaultValue || '';
15
+ return /*#__PURE__*/_jsx(NativeInput, {
16
+ ...props,
17
+ ref: ref,
18
+ onChange: _onChange,
19
+ text: text,
20
+ keybardColor: processColor(props.keyboardColor)
21
+ });
22
+ });
23
+ export default InputCalculator;
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","processColor","requireNativeComponent","jsx","_jsx","NativeInput","InputCalculator","forwardRef","props","ref","_onChange","event","currentText","nativeEvent","text","onChange","onChangeText","defaultValue","keybardColor","keyboardColor"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAKEC,YAAY,QACP,cAAc;AACrB,SAASC,sBAAsB,QAAmB,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEjE,MAAMC,WAAW,GAAGH,sBAAsB,CAAM,oBAAoB,CAAC;AAOrE,MAAMI,eAAe,gBAAGN,KAAK,CAACO,UAAU,CACtC,CAACC,KAAK,EAAEC,GAAG,KAAK;EACd,MAAMC,SAAS,GACbC,KAAqD,IAClD;IACH,MAAMC,WAAW,GAAGD,KAAK,CAACE,WAAW,CAACC,IAAI;IAC1CN,KAAK,CAACO,QAAQ,IAAIP,KAAK,CAACO,QAAQ,CAACJ,KAAK,CAAC;IACvCH,KAAK,CAACQ,YAAY,IAAIR,KAAK,CAACQ,YAAY,CAACJ,WAAW,CAAC;EACvD,CAAC;EAED,MAAME,IAAI,GAAGN,KAAK,CAACM,IAAI,IAAIN,KAAK,CAACS,YAAY,IAAI,EAAE;EAEnD,oBACEb,IAAA,CAACC,WAAW;IAAA,GACNG,KAAK;IACTC,GAAG,EAAEA,GAAI;IACTM,QAAQ,EAAEL,SAAU;IACpBI,IAAI,EAAEA,IAAK;IACXI,YAAY,EAAEjB,YAAY,CAACO,KAAK,CAACW,aAAa;EAAE,CACjD,CAAC;AAEN,CACF,CAAC;AAED,eAAeb,eAAe","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { type TextInputProps, type ColorValue } from 'react-native';
3
+ import { TextInput } from 'react-native';
4
+ interface InputCalculatorProps extends TextInputProps {
5
+ text?: string | undefined;
6
+ keyboardColor?: ColorValue;
7
+ }
8
+ declare const InputCalculator: React.ForwardRefExoticComponent<InputCalculatorProps & React.RefAttributes<TextInput>>;
9
+ export default InputCalculator;
10
+ export type { InputCalculatorProps };
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,UAAU,EAEhB,MAAM,cAAc,CAAC;AACtB,OAAO,EAA0B,SAAS,EAAE,MAAM,cAAc,CAAC;AAIjE,UAAU,oBAAqB,SAAQ,cAAc;IACnD,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,aAAa,CAAC,EAAE,UAAU,CAAC;CAC5B;AAED,QAAA,MAAM,eAAe,wFAsBpB,CAAC;AAEF,eAAe,eAAe,CAAC;AAE/B,YAAY,EAAE,oBAAoB,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { type TextInputProps, type ColorValue } from 'react-native';
3
+ import { TextInput } from 'react-native';
4
+ interface InputCalculatorProps extends TextInputProps {
5
+ text?: string | undefined;
6
+ keyboardColor?: ColorValue;
7
+ }
8
+ declare const InputCalculator: React.ForwardRefExoticComponent<InputCalculatorProps & React.RefAttributes<TextInput>>;
9
+ export default InputCalculator;
10
+ export type { InputCalculatorProps };
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,UAAU,EAEhB,MAAM,cAAc,CAAC;AACtB,OAAO,EAA0B,SAAS,EAAE,MAAM,cAAc,CAAC;AAIjE,UAAU,oBAAqB,SAAQ,cAAc;IACnD,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,aAAa,CAAC,EAAE,UAAU,CAAC;CAC5B;AAED,QAAA,MAAM,eAAe,wFAsBpB,CAAC;AAEF,eAAe,eAAe,CAAC;AAE/B,YAAY,EAAE,oBAAoB,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,20 +1,185 @@
1
1
  {
2
- "name": "@momo-kits/calculator-keyboard",
3
- "version": "0.125.4-rc.7",
4
- "private": false,
5
- "main": "index.tsx",
6
- "peerDependencies": {
7
- "@momo-kits/foundation": "latest",
8
- "react": "16.9.0",
9
- "react-native": ">=0.55",
10
- "prop-types": "^15.7.2"
11
- },
12
- "devDependencies": {
13
- "@momo-platform/versions": "4.1.11"
14
- },
15
- "license": "MoMo",
16
- "publishConfig": {
17
- "registry": "https://registry.npmjs.org/"
18
- },
19
- "dependencies": {}
20
- }
2
+ "name": "@momo-kits/calculator-keyboard",
3
+ "version": "0.150.1-beta.1",
4
+ "description": "react native calculator keyboard",
5
+ "source": "./src/index.tsx",
6
+ "main": "./lib/commonjs/index.js",
7
+ "module": "./lib/module/index.js",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./lib/typescript/module/src/index.d.ts",
12
+ "default": "./lib/module/index.js"
13
+ },
14
+ "require": {
15
+ "types": "./lib/typescript/commonjs/src/index.d.ts",
16
+ "default": "./lib/commonjs/index.js"
17
+ }
18
+ }
19
+ },
20
+ "files": [
21
+ "src",
22
+ "lib",
23
+ "android",
24
+ "ios",
25
+ "cpp",
26
+ "*.podspec",
27
+ "react-native.config.js",
28
+ "!ios/build",
29
+ "!android/build",
30
+ "!android/gradle",
31
+ "!android/gradlew",
32
+ "!android/gradlew.bat",
33
+ "!android/local.properties",
34
+ "!**/__tests__",
35
+ "!**/__fixtures__",
36
+ "!**/__mocks__",
37
+ "!**/.*"
38
+ ],
39
+ "scripts": {
40
+ "test": "jest",
41
+ "typecheck": "tsc",
42
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
43
+ "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
44
+ "build": "bob build",
45
+ "release": "release-it"
46
+ },
47
+ "keywords": [
48
+ "react-native",
49
+ "ios",
50
+ "android"
51
+ ],
52
+ "repository": {
53
+ "type": "git",
54
+ "url": "git+https://github.com/wem2017/react-native-calculator-keyboard.git/react-native-calculator-keyboard.git"
55
+ },
56
+ "author": "Dũng (Wem) <huynh.developer@gmail.com> (https://github.com/wem2017/react-native-calculator-keyboard.git)",
57
+ "license": "MIT",
58
+ "bugs": {
59
+ "url": "https://github.com/wem2017/react-native-calculator-keyboard.git/react-native-calculator-keyboard/issues"
60
+ },
61
+ "homepage": "https://github.com/wem2017/react-native-calculator-keyboard.git/react-native-calculator-keyboard#readme",
62
+ "publishConfig": {
63
+ "registry": "https://registry.npmjs.org/"
64
+ },
65
+ "devDependencies": {
66
+ "@commitlint/config-conventional": "^17.0.2",
67
+ "@evilmartians/lefthook": "^1.5.0",
68
+ "@react-native-community/cli": "15.0.1",
69
+ "@react-native/eslint-config": "^0.73.1",
70
+ "@release-it/conventional-changelog": "^9.0.2",
71
+ "@types/jest": "^29.5.5",
72
+ "@types/react": "^18.2.44",
73
+ "commitlint": "^17.0.2",
74
+ "del-cli": "^5.1.0",
75
+ "eslint": "^8.51.0",
76
+ "eslint-config-prettier": "^9.0.0",
77
+ "eslint-plugin-prettier": "^5.0.1",
78
+ "jest": "^29.7.0",
79
+ "prettier": "^3.0.3",
80
+ "react": "18.3.1",
81
+ "react-native": "0.76.5",
82
+ "react-native-builder-bob": "^0.32.0",
83
+ "release-it": "^17.10.0",
84
+ "turbo": "^1.10.7",
85
+ "typescript": "^5.2.2"
86
+ },
87
+ "resolutions": {
88
+ "@types/react": "^18.2.44"
89
+ },
90
+ "peerDependencies": {
91
+ "react": "*",
92
+ "react-native": "*"
93
+ },
94
+ "jest": {
95
+ "preset": "react-native",
96
+ "modulePathIgnorePatterns": [
97
+ "<rootDir>/example/node_modules",
98
+ "<rootDir>/lib/"
99
+ ]
100
+ },
101
+ "commitlint": {
102
+ "extends": [
103
+ "@commitlint/config-conventional"
104
+ ]
105
+ },
106
+ "release-it": {
107
+ "git": {
108
+ "commitMessage": "chore: release ${version}",
109
+ "tagName": "v${version}"
110
+ },
111
+ "npm": {
112
+ "publish": true
113
+ },
114
+ "github": {
115
+ "release": true
116
+ },
117
+ "plugins": {
118
+ "@release-it/conventional-changelog": {
119
+ "preset": "angular"
120
+ }
121
+ }
122
+ },
123
+ "eslintConfig": {
124
+ "root": true,
125
+ "extends": [
126
+ "@react-native",
127
+ "prettier"
128
+ ],
129
+ "rules": {
130
+ "react/react-in-jsx-scope": "off",
131
+ "prettier/prettier": [
132
+ "error",
133
+ {
134
+ "quoteProps": "consistent",
135
+ "singleQuote": true,
136
+ "tabWidth": 2,
137
+ "trailingComma": "es5",
138
+ "useTabs": false
139
+ }
140
+ ]
141
+ }
142
+ },
143
+ "eslintIgnore": [
144
+ "node_modules/",
145
+ "lib/"
146
+ ],
147
+ "prettier": {
148
+ "quoteProps": "consistent",
149
+ "singleQuote": true,
150
+ "tabWidth": 2,
151
+ "trailingComma": "es5",
152
+ "useTabs": false
153
+ },
154
+ "react-native-builder-bob": {
155
+ "source": "src",
156
+ "output": "lib",
157
+ "targets": [
158
+ [
159
+ "commonjs",
160
+ {
161
+ "esm": true
162
+ }
163
+ ],
164
+ [
165
+ "module",
166
+ {
167
+ "esm": true
168
+ }
169
+ ],
170
+ [
171
+ "typescript",
172
+ {
173
+ "project": "tsconfig.build.json",
174
+ "esm": true
175
+ }
176
+ ]
177
+ ]
178
+ },
179
+ "create-react-native-library": {
180
+ "type": "legacy-view",
181
+ "languages": "kotlin-swift",
182
+ "version": "0.45.5"
183
+ },
184
+ "dependencies": {}
185
+ }