@pedidopago/ui 1.7.17 → 1.7.18
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.
- package/dist/components/ComposeIcon/styles.d.ts.map +1 -1
- package/dist/components/ComposeIcon/styles.js +8 -25
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Input/index.js +26 -3
- package/dist/components/Input/types.d.ts +2 -0
- package/dist/components/Input/types.d.ts.map +1 -1
- package/dist/components/TimeInput/index.d.ts.map +1 -1
- package/dist/components/TimeInput/index.js +19 -34
- package/dist/components/TimeInput/styles.d.ts.map +1 -1
- package/dist/components/TimeInput/styles.js +1 -1
- package/dist/components/TimeInput/utils.d.ts +1 -0
- package/dist/components/TimeInput/utils.d.ts.map +1 -1
- package/dist/components/TimeInput/utils.js +38 -5
- package/dist/utils/formatters/phone.d.ts +2 -2
- package/dist/utils/formatters/phone.d.ts.map +1 -1
- package/dist/utils/formatters/phone.js +3 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/ComposeIcon/styles.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,eAAO,MAAM,oBAAoB;;;yGAMhC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/ComposeIcon/styles.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,eAAO,MAAM,oBAAoB;;;yGAMhC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;qIAuDjC,CAAC"}
|
|
@@ -25,45 +25,28 @@ var StatusBubbleContainer = _styled.default.div(_templateObject2 || (_templateOb
|
|
|
25
25
|
var bubbleShadow = _ref3.bubbleShadow;
|
|
26
26
|
return bubbleShadow ? 'rgba(0, 0, 0, 0.2) 0px 3px 8px' : 'none';
|
|
27
27
|
}, function (_ref4) {
|
|
28
|
-
var
|
|
29
|
-
_ref4$
|
|
30
|
-
|
|
31
|
-
switch (iconPosition) {
|
|
28
|
+
var _ref4$bubblePosition = _ref4.bubblePosition,
|
|
29
|
+
bubblePosition = _ref4$bubblePosition === void 0 ? 'bottom-right' : _ref4$bubblePosition;
|
|
30
|
+
switch (bubblePosition) {
|
|
32
31
|
case 'center':
|
|
33
32
|
{
|
|
34
|
-
|
|
35
|
-
var leftOffset = 0.31;
|
|
36
|
-
return "\n top: ".concat(size * topOffset, "px;\n left: ").concat(size * leftOffset, "px;\n ");
|
|
33
|
+
return "\n top: 36%;\n left: 50%;\n transform: translate(-50%,-50%);\n ";
|
|
37
34
|
}
|
|
38
35
|
case 'top-left':
|
|
39
36
|
{
|
|
40
|
-
|
|
41
|
-
var _leftOffset = 0.05;
|
|
42
|
-
return "\n top: ".concat(size * _topOffset, "px;\n left: ").concat(size * _leftOffset, "px;\n ");
|
|
37
|
+
return "\n top: 20%;\n left: 0;\n ";
|
|
43
38
|
}
|
|
44
39
|
case 'top-right':
|
|
45
40
|
{
|
|
46
|
-
|
|
47
|
-
var _leftOffset2 = 0.6;
|
|
48
|
-
return "\n top: ".concat(size * _topOffset2, "px;\n left: ").concat(size * _leftOffset2, "px;\n ");
|
|
41
|
+
return "\n top: 20%;\n right: 0;\n ";
|
|
49
42
|
}
|
|
50
43
|
case 'bottom-left':
|
|
51
44
|
{
|
|
52
|
-
|
|
53
|
-
var _leftOffset3 = 0.05;
|
|
54
|
-
return "\n top: ".concat(size * _topOffset3, "px;\n left: ").concat(size * _leftOffset3, "px;\n ");
|
|
45
|
+
return "\n left: 0;\n bottom: 5%;\n ";
|
|
55
46
|
}
|
|
56
47
|
case 'bottom-right':
|
|
57
48
|
{
|
|
58
|
-
|
|
59
|
-
var _leftOffset4 = 0.6;
|
|
60
|
-
return "\n top: ".concat(size * _topOffset4, "px;\n left: ").concat(size * _leftOffset4, "px;\n ");
|
|
61
|
-
}
|
|
62
|
-
default:
|
|
63
|
-
{
|
|
64
|
-
var _topOffset5 = 0.6;
|
|
65
|
-
var _leftOffset5 = 0.6;
|
|
66
|
-
return "\n top: ".concat(size * _topOffset5, "px;\n left: ").concat(size * _leftOffset5, "px;\n ");
|
|
49
|
+
return "\n right: 0;\n bottom: 5%;\n ";
|
|
67
50
|
}
|
|
68
51
|
}
|
|
69
52
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Input/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EAKpB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Input/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EAKpB,MAAM,OAAO,CAAC;AAqBf,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,QAAA,MAAM,KAAK,sJAgIV,CAAC;AAGF,eAAe,KAAK,CAAC"}
|
|
@@ -6,10 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
+
var _Button = _interopRequireDefault(require("../Button"));
|
|
9
10
|
var _styles = require("./styles");
|
|
10
11
|
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
11
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
var _excluded = ["placeholder", "type", "disabled", "label", "labelBackground", "hiddenContent", "helperText", "alert", "withAddon", "addonContent", "withIcon", "leftIcon", "rightIcon"];
|
|
13
|
+
var _excluded = ["placeholder", "type", "disabled", "label", "labelBackground", "hiddenContent", "helperText", "alert", "withAddon", "addonContent", "withIcon", "onLeftIconClick", "onRightIconClick", "leftIcon", "rightIcon"];
|
|
13
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
15
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
16
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -36,6 +37,8 @@ var Input = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
36
37
|
withAddon = _ref.withAddon,
|
|
37
38
|
addonContent = _ref.addonContent,
|
|
38
39
|
withIcon = _ref.withIcon,
|
|
40
|
+
onLeftIconClick = _ref.onLeftIconClick,
|
|
41
|
+
onRightIconClick = _ref.onRightIconClick,
|
|
39
42
|
leftIcon = _ref.leftIcon,
|
|
40
43
|
rightIcon = _ref.rightIcon,
|
|
41
44
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -95,7 +98,17 @@ var Input = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
95
98
|
})
|
|
96
99
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.InputContentRow, {
|
|
97
100
|
children: [(withIcon || leftIcon) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.InputIcon, {
|
|
98
|
-
children:
|
|
101
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
102
|
+
type: "button",
|
|
103
|
+
variant: "ghost",
|
|
104
|
+
style: {
|
|
105
|
+
padding: 0,
|
|
106
|
+
cursor: onLeftIconClick ? 'pointer' : 'default'
|
|
107
|
+
},
|
|
108
|
+
onClick: onLeftIconClick,
|
|
109
|
+
tabIndex: onLeftIconClick ? 0 : -1,
|
|
110
|
+
children: withIcon || leftIcon
|
|
111
|
+
})
|
|
99
112
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Input, _objectSpread(_objectSpread({
|
|
100
113
|
"data-input": "input",
|
|
101
114
|
type: hiddenInfo ? 'password' : type,
|
|
@@ -123,7 +136,17 @@ var Input = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
123
136
|
name: "eye-off"
|
|
124
137
|
})
|
|
125
138
|
}), rightIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.InputIcon, {
|
|
126
|
-
children:
|
|
139
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
140
|
+
type: "button",
|
|
141
|
+
variant: "ghost",
|
|
142
|
+
style: {
|
|
143
|
+
padding: 0,
|
|
144
|
+
cursor: onRightIconClick ? 'pointer' : 'default'
|
|
145
|
+
},
|
|
146
|
+
onClick: onRightIconClick,
|
|
147
|
+
tabIndex: onRightIconClick ? 0 : -1,
|
|
148
|
+
children: rightIcon
|
|
149
|
+
})
|
|
127
150
|
})]
|
|
128
151
|
})]
|
|
129
152
|
})]
|
|
@@ -10,6 +10,8 @@ export interface InputProps extends HTMLAttributes<HTMLInputElement> {
|
|
|
10
10
|
alert?: InputAlertTypes;
|
|
11
11
|
leftIcon?: ReactNode;
|
|
12
12
|
rightIcon?: ReactNode;
|
|
13
|
+
onLeftIconClick?: () => void;
|
|
14
|
+
onRightIconClick?: () => void;
|
|
13
15
|
}
|
|
14
16
|
export interface InputComponentProps extends InputProps {
|
|
15
17
|
hasValueOnInput: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Input/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAA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AAM,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,mBAAoB,SAAQ,UAAU;IACrD,eAAe,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC;CAC5D;AAED,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/TimeInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EAKpB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/TimeInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EAKpB,MAAM,OAAO,CAAC;AAqBf,OAAO,EAAE,cAAc,EAAc,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,eAAO,MAAM,SAAS,uKAiOpB,CAAC"}
|
|
@@ -100,6 +100,9 @@ var TimeInput = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
function handleOpenTimePicker() {
|
|
103
|
+
var _timeInputRef$current, _timeInputRef$current2;
|
|
104
|
+
setSelectedTime((_timeInputRef$current = timeInputRef.current) === null || _timeInputRef$current === void 0 ? void 0 : _timeInputRef$current.value);
|
|
105
|
+
setTimeValue((_timeInputRef$current2 = timeInputRef.current) === null || _timeInputRef$current2 === void 0 ? void 0 : _timeInputRef$current2.value);
|
|
103
106
|
if (!rest.disabled) setIsModalOpen(function (oldState) {
|
|
104
107
|
return !oldState;
|
|
105
108
|
});
|
|
@@ -125,52 +128,34 @@ var TimeInput = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
125
128
|
}
|
|
126
129
|
setIsModalOpen(false);
|
|
127
130
|
}
|
|
128
|
-
|
|
129
|
-
// Setting the default value:
|
|
130
|
-
(0, _react.useEffect)(function () {
|
|
131
|
-
if (rest.defaultValue) {
|
|
132
|
-
setTimeValue(rest.defaultValue);
|
|
133
|
-
if (isAMPMVariant) {
|
|
134
|
-
var period = String(rest.defaultValue).split(' ')[1];
|
|
135
|
-
setPeriodValue(period);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return function () {
|
|
139
|
-
return setTimeValue(undefined);
|
|
140
|
-
};
|
|
141
|
-
}, []);
|
|
142
|
-
|
|
143
|
-
// Setting value from controller components:
|
|
144
|
-
(0, _react.useEffect)(function () {
|
|
145
|
-
if (!timeInputRef.current) return;
|
|
146
|
-
var value = rest.value === undefined ? '' : rest.value;
|
|
147
|
-
(0, _utils.handleSetNativeInputValue)(timeInputRef, value);
|
|
148
|
-
setTimeValue(value);
|
|
149
|
-
setSelectedTime(value);
|
|
150
|
-
if (isAMPMVariant) {
|
|
151
|
-
var period = String(rest.value).split(' ')[1];
|
|
152
|
-
setPeriodValue(period);
|
|
153
|
-
}
|
|
154
|
-
}, [rest.value]);
|
|
155
131
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.TimeInputContainer, {
|
|
156
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Input.default, _objectSpread({
|
|
132
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Input.default, _objectSpread(_objectSpread({
|
|
157
133
|
"data-testid": "time-input",
|
|
158
134
|
ref: timeInputRef,
|
|
159
|
-
|
|
135
|
+
leftIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
160
136
|
name: "clock",
|
|
161
|
-
color: "neutral.
|
|
137
|
+
color: "neutral.neutral5"
|
|
162
138
|
}),
|
|
139
|
+
onLeftIconClick: handleOpenTimePicker,
|
|
163
140
|
label: label,
|
|
164
|
-
type:
|
|
165
|
-
placeholder: "HH:MM",
|
|
141
|
+
type: variant === '24_hours' ? 'tel' : 'text',
|
|
142
|
+
placeholder: placeholder || "HH:MM ".concat(variant === 'am_pm' ? 'AM/PM' : ''),
|
|
166
143
|
helperText: helperText,
|
|
167
144
|
alert: alert,
|
|
168
145
|
disabled: !!rest.disabled,
|
|
169
146
|
tabIndex: rest.disabled ? -1 : 0,
|
|
170
|
-
onClick: handleOpenTimePicker,
|
|
171
147
|
className: rest.className,
|
|
172
148
|
style: rest.style
|
|
173
|
-
}, rest)
|
|
149
|
+
}, rest), {}, {
|
|
150
|
+
onChange: function onChange(event) {
|
|
151
|
+
var _rest$onChange;
|
|
152
|
+
event.currentTarget.value = (0, _utils.onChangeFormatter)(event, isAMPMVariant);
|
|
153
|
+
setTimeValue(event.currentTarget.value);
|
|
154
|
+
setSelectedTime(event.currentTarget.value);
|
|
155
|
+
(0, _utils.handleSetNativeInputValue)(timeInputRef, event.currentTarget.value);
|
|
156
|
+
(_rest$onChange = rest.onChange) === null || _rest$onChange === void 0 ? void 0 : _rest$onChange.call(rest, event);
|
|
157
|
+
}
|
|
158
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.Modal, {
|
|
174
159
|
maxWidth: "min(400px, 90%)",
|
|
175
160
|
maxHeight: "370px",
|
|
176
161
|
open: isModalOpen,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/TimeInput/styles.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,eAAO,MAAM,kBAAkB;;;
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/TimeInput/styles.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,eAAO,MAAM,kBAAkB;;;yGAG9B,CAAC;AAEF,eAAO,MAAM,cAAc;;;yGAqB1B,CAAC;AAEF,eAAO,MAAM,YAAY;;;;aAAyB,cAAc,CAAC,SAAS,CAAC;yGA0F1E,CAAC"}
|
|
@@ -8,7 +8,7 @@ var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
|
8
8
|
var _templateObject, _templateObject2, _templateObject3;
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
10
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
11
|
-
var TimeInputContainer = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n width: 100%;\n
|
|
11
|
+
var TimeInputContainer = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n width: 100%;\n"])));
|
|
12
12
|
exports.TimeInputContainer = TimeInputContainer;
|
|
13
13
|
var DigitContainer = _styled.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n align-items: center;\n\n list-style-type: none;\n overflow-y: scroll;\n user-select: none;\n\n cursor: grab;\n\n li {\n scroll-snap-align: start;\n }\n\n /* hiding scrollbar: */\n ::-webkit-scrollbar {\n display: none;\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n }\n"])));
|
|
14
14
|
exports.DigitContainer = DigitContainer;
|
|
@@ -6,4 +6,5 @@ export declare function setObserverOptions(mainContainer: RefObject<HTMLDivEleme
|
|
|
6
6
|
threshold: number;
|
|
7
7
|
rootMargin: string;
|
|
8
8
|
};
|
|
9
|
+
export declare function onChangeFormatter(event: React.FormEvent<HTMLInputElement> | React.ChangeEvent<HTMLInputElement>, isAMPMVariant: boolean): string;
|
|
9
10
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/TimeInput/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,wBAAgB,oBAAoB,CAClC,gBAAgB,EAAE,SAAS,CAAC,cAAc,CAAC,EAC3C,kBAAkB,EAAE,SAAS,CAAC,cAAc,CAAC,EAC7C,UAAU,EAAE,MAAM,EAClB,sBAAsB,CAAC,EAAE,SAAS,CAAC,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/TimeInput/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,wBAAgB,oBAAoB,CAClC,gBAAgB,EAAE,SAAS,CAAC,cAAc,CAAC,EAC3C,kBAAkB,EAAE,SAAS,CAAC,cAAc,CAAC,EAC7C,UAAU,EAAE,MAAM,EAClB,sBAAsB,CAAC,EAAE,SAAS,CAAC,cAAc,CAAC,QAkCnD;AAED,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,SAAS,CAAC,gBAAgB,CAAC,EACzC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,MAAM,EAAE,QAU5C;AAED,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,SAAS,CAAC,cAAc,CAAC;;;;EAM1E;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,EAC9E,aAAa,EAAE,OAAO,UAiDvB"}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.handleScrollIntoView = handleScrollIntoView;
|
|
7
7
|
exports.handleSetNativeInputValue = handleSetNativeInputValue;
|
|
8
|
+
exports.onChangeFormatter = onChangeFormatter;
|
|
8
9
|
exports.setObserverOptions = setObserverOptions;
|
|
9
10
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
11
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -19,14 +20,14 @@ function handleScrollIntoView(hourContainerRef, minuteContainerRef, inputValue,
|
|
|
19
20
|
hour = _inputValue$split2[0],
|
|
20
21
|
minute = _inputValue$split2[1],
|
|
21
22
|
period = _inputValue$split2[2];
|
|
22
|
-
var targetHourEl = (_hourContainerRef$cur = hourContainerRef.current) === null || _hourContainerRef$cur === void 0 ? void 0 : _hourContainerRef$cur.querySelector("[data-input-hour=\"".concat(hour, "\"]"));
|
|
23
|
-
var targetMinuteEl = (_minuteContainerRef$c = minuteContainerRef.current) === null || _minuteContainerRef$c === void 0 ? void 0 : _minuteContainerRef$c.querySelector("[data-input-minute=\"".concat(minute, "\"]"));
|
|
24
|
-
if (targetHourEl
|
|
25
|
-
targetHourEl.scrollIntoView({
|
|
23
|
+
var targetHourEl = (_hourContainerRef$cur = hourContainerRef.current) === null || _hourContainerRef$cur === void 0 ? void 0 : _hourContainerRef$cur.querySelector("[data-input-hour=\"".concat(hour === null || hour === void 0 ? void 0 : hour.padStart(2, '0'), "\"]"));
|
|
24
|
+
var targetMinuteEl = (_minuteContainerRef$c = minuteContainerRef.current) === null || _minuteContainerRef$c === void 0 ? void 0 : _minuteContainerRef$c.querySelector("[data-input-minute=\"".concat(minute === null || minute === void 0 ? void 0 : minute.padEnd(2, '0'), "\"]"));
|
|
25
|
+
if (targetHourEl || targetMinuteEl) {
|
|
26
|
+
targetHourEl === null || targetHourEl === void 0 ? void 0 : targetHourEl.scrollIntoView({
|
|
26
27
|
behavior: 'auto',
|
|
27
28
|
block: 'center'
|
|
28
29
|
});
|
|
29
|
-
targetMinuteEl.scrollIntoView({
|
|
30
|
+
targetMinuteEl === null || targetMinuteEl === void 0 ? void 0 : targetMinuteEl.scrollIntoView({
|
|
30
31
|
behavior: 'auto',
|
|
31
32
|
block: 'center'
|
|
32
33
|
});
|
|
@@ -58,4 +59,36 @@ function setObserverOptions(mainContainer) {
|
|
|
58
59
|
threshold: 1,
|
|
59
60
|
rootMargin: '-40px'
|
|
60
61
|
};
|
|
62
|
+
}
|
|
63
|
+
function onChangeFormatter(event, isAMPMVariant) {
|
|
64
|
+
if (event.currentTarget.value === undefined || event.currentTarget.value === ':') return '';
|
|
65
|
+
if (isAMPMVariant) {
|
|
66
|
+
event.currentTarget.value = String(event.currentTarget.value).replace(/(\d{2})(\d{2})/, function (match, hours, minutes) {
|
|
67
|
+
var formattedHours = hours;
|
|
68
|
+
var formattedMinutes = minutes;
|
|
69
|
+
if (formattedHours.length === 2) {
|
|
70
|
+
formattedHours = Math.min(parseInt(formattedHours, 10), 12).toString().padStart(2, '0');
|
|
71
|
+
}
|
|
72
|
+
if (formattedMinutes.length === 2) {
|
|
73
|
+
formattedMinutes = Math.min(parseInt(formattedMinutes, 10), 59).toString().padStart(2, '0');
|
|
74
|
+
}
|
|
75
|
+
return "".concat(formattedHours, ":").concat(formattedMinutes);
|
|
76
|
+
}).replace(/(:\d{2})\d*$/, function (match) {
|
|
77
|
+
var minutesMatch = match.substring(1);
|
|
78
|
+
var formattedMinutes = Math.min(parseInt(minutesMatch, 10), 59).toString().padStart(2, '0');
|
|
79
|
+
return ":".concat(formattedMinutes);
|
|
80
|
+
}).substring(0, 11);
|
|
81
|
+
return event.currentTarget.value;
|
|
82
|
+
}
|
|
83
|
+
return String(event.currentTarget.value).replace(/\D/g, '').replace(/(\d{2})(\d)/, function (match, hours, minutes) {
|
|
84
|
+
var formattedHours = hours;
|
|
85
|
+
if (formattedHours.length === 2) {
|
|
86
|
+
formattedHours = Math.min(parseInt(formattedHours, 10), 23).toString().padStart(2, '0');
|
|
87
|
+
}
|
|
88
|
+
return "".concat(formattedHours, ":").concat(minutes);
|
|
89
|
+
}).replace(/(:\d{2})\d*$/, function (match) {
|
|
90
|
+
var minutesMatch = match.substring(1);
|
|
91
|
+
var formattedMinutes = Math.min(parseInt(minutesMatch, 10), 59).toString().padStart(2, '0');
|
|
92
|
+
return ":".concat(formattedMinutes);
|
|
93
|
+
}).substring(0, 5);
|
|
61
94
|
}
|
|
@@ -56,13 +56,13 @@ export declare function formatedPhone(phone: string, options?: {
|
|
|
56
56
|
* @param {string} phoneNumber - The phone number to be formatted.
|
|
57
57
|
* @returns {FormatPhoneProps | null} - An object containing different formats of the phone number or null if the number cannot be parsed.
|
|
58
58
|
*/
|
|
59
|
-
export declare function formatPhone(phoneNumber
|
|
59
|
+
export declare function formatPhone(phoneNumber?: string): FormatPhoneProps | null;
|
|
60
60
|
/**
|
|
61
61
|
* Formats a guest phone number by masking digits except the last four digits for each format.
|
|
62
62
|
* @param phoneNumber - The phone number to be formatted.
|
|
63
63
|
* @returns The formatted phone number object, or null if the formatting is not possible.
|
|
64
64
|
*/
|
|
65
|
-
export declare function formatGuestPhone(phoneNumber
|
|
65
|
+
export declare function formatGuestPhone(phoneNumber?: string): FormatPhoneProps | null;
|
|
66
66
|
/**
|
|
67
67
|
* Validates if a phone number is valid.
|
|
68
68
|
* @param {string | undefined} phoneNumber - The phone number to be validated.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone.d.ts","sourceRoot":"","sources":["../../../src/utils/formatters/phone.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,GAAE,MAAc,GAAG,MAAM,CAkCjF;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAA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;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EACb,EACE,YAA4E,GAC7E,EAAE;IAAE,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3B,OAAO,GAAG,MAAM,CAQlB;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,sBAWrC;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;IACP,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACd,UA2BP;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CA6BzE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAkC9E;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAU3D"}
|
|
@@ -176,10 +176,10 @@ function formatedPhone(phone) {
|
|
|
176
176
|
* @returns {FormatPhoneProps | null} - An object containing different formats of the phone number or null if the number cannot be parsed.
|
|
177
177
|
*/
|
|
178
178
|
function formatPhone(phoneNumber) {
|
|
179
|
-
if (phoneNumber.includes('*')) return formatGuestPhone(phoneNumber);
|
|
179
|
+
if (phoneNumber !== null && phoneNumber !== void 0 && phoneNumber.includes('*')) return formatGuestPhone(phoneNumber);
|
|
180
180
|
|
|
181
181
|
// Parses the phone number
|
|
182
|
-
var parsedNumber = (0, _max.parsePhoneNumberFromString)(phoneNumber);
|
|
182
|
+
var parsedNumber = (0, _max.parsePhoneNumberFromString)(phoneNumber || '');
|
|
183
183
|
if (!parsedNumber) {
|
|
184
184
|
return null;
|
|
185
185
|
}
|
|
@@ -201,7 +201,7 @@ function formatPhone(phoneNumber) {
|
|
|
201
201
|
* @returns The formatted phone number object, or null if the formatting is not possible.
|
|
202
202
|
*/
|
|
203
203
|
function formatGuestPhone(phoneNumber) {
|
|
204
|
-
var phone = phoneNumber.replace(/\*/g, '9');
|
|
204
|
+
var phone = phoneNumber === null || phoneNumber === void 0 ? void 0 : phoneNumber.replace(/\*/g, '9');
|
|
205
205
|
var phoneFormatter = formatPhone(phone);
|
|
206
206
|
if (!phoneFormatter) {
|
|
207
207
|
return null;
|