@mirai/core 0.3.171 → 0.3.172
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/.env +7 -4
- package/build/components/Booking/components/Hotelverse/Hotelverse.js +1 -1
- package/build/components/Booking/components/Hotelverse/Hotelverse.js.map +1 -1
- package/build/components/Chat/Chat.constants.js +28 -0
- package/build/components/Chat/Chat.constants.js.map +1 -0
- package/build/components/Chat/Chat.js +231 -0
- package/build/components/Chat/Chat.js.map +1 -0
- package/build/components/Chat/Chat.l10n.js +24 -0
- package/build/components/Chat/Chat.l10n.js.map +1 -0
- package/build/components/Chat/Chat.module.css +90 -0
- package/build/components/Chat/Chat.theme.module.css +49 -0
- package/build/components/Chat/components/Avatar/Avatar.js +68 -0
- package/build/components/Chat/components/Avatar/Avatar.js.map +1 -0
- package/build/components/Chat/components/Avatar/Avatar.module.css +81 -0
- package/build/components/Chat/components/Avatar/__tests__/__snapshots__/Avatar.test.jsx.snap +97 -0
- package/build/components/Chat/components/Avatar/index.js +17 -0
- package/build/components/Chat/components/Avatar/index.js.map +1 -0
- package/build/components/Chat/components/Input/Input.js +72 -0
- package/build/components/Chat/components/Input/Input.js.map +1 -0
- package/build/components/Chat/components/Input/Input.l10n.js +15 -0
- package/build/components/Chat/components/Input/Input.l10n.js.map +1 -0
- package/build/components/Chat/components/Input/Input.module.css +19 -0
- package/build/components/Chat/components/Input/__tests__/__snapshots__/Input.test.jsx.snap +175 -0
- package/build/components/Chat/components/Input/index.js +17 -0
- package/build/components/Chat/components/Input/index.js.map +1 -0
- package/build/components/Chat/components/InputRich/InputRich.List.js +52 -0
- package/build/components/Chat/components/InputRich/InputRich.List.js.map +1 -0
- package/build/components/Chat/components/InputRich/InputRich.js +182 -0
- package/build/components/Chat/components/InputRich/InputRich.js.map +1 -0
- package/build/components/Chat/components/InputRich/InputRich.l10n.js +12 -0
- package/build/components/Chat/components/InputRich/InputRich.l10n.js.map +1 -0
- package/build/components/Chat/components/InputRich/InputRich.module.css +73 -0
- package/build/components/Chat/components/InputRich/__tests__/__snapshots__/InputRich.test.jsx.snap +275 -0
- package/build/components/Chat/components/InputRich/helpers/getVerboseList.js +20 -0
- package/build/components/Chat/components/InputRich/helpers/getVerboseList.js.map +1 -0
- package/build/components/Chat/components/InputRich/helpers/getVerboseOccupation.js +27 -0
- package/build/components/Chat/components/InputRich/helpers/getVerboseOccupation.js.map +1 -0
- package/build/components/Chat/components/InputRich/helpers/index.js +28 -0
- package/build/components/Chat/components/InputRich/helpers/index.js.map +1 -0
- package/build/components/Chat/components/InputRich/index.js +17 -0
- package/build/components/Chat/components/InputRich/index.js.map +1 -0
- package/build/components/Chat/components/Message/Message.constants.js +18 -0
- package/build/components/Chat/components/Message/Message.constants.js.map +1 -0
- package/build/components/Chat/components/Message/Message.js +104 -0
- package/build/components/Chat/components/Message/Message.js.map +1 -0
- package/build/components/Chat/components/Message/Message.module.css +126 -0
- package/build/components/Chat/components/Message/__tests__/__snapshots__/Message.test.jsx.snap +211 -0
- package/build/components/Chat/components/Message/components/Booking.js +63 -0
- package/build/components/Chat/components/Message/components/Booking.js.map +1 -0
- package/build/components/Chat/components/Message/components/Card.js +67 -0
- package/build/components/Chat/components/Message/components/Card.js.map +1 -0
- package/build/components/Chat/components/Message/components/Card.module.css +41 -0
- package/build/components/Chat/components/Message/components/Environment.js +58 -0
- package/build/components/Chat/components/Message/components/Environment.js.map +1 -0
- package/build/components/Chat/components/Message/components/Environment.module.css +22 -0
- package/build/components/Chat/components/Message/components/index.js +39 -0
- package/build/components/Chat/components/Message/components/index.js.map +1 -0
- package/build/components/Chat/components/Message/helpers/getActionIcon.js +13 -0
- package/build/components/Chat/components/Message/helpers/getActionIcon.js.map +1 -0
- package/build/components/Chat/components/Message/helpers/getTime.js +28 -0
- package/build/components/Chat/components/Message/helpers/getTime.js.map +1 -0
- package/build/components/Chat/components/Message/helpers/index.js +28 -0
- package/build/components/Chat/components/Message/helpers/index.js.map +1 -0
- package/build/components/Chat/components/Message/index.js +17 -0
- package/build/components/Chat/components/Message/index.js.map +1 -0
- package/build/components/Chat/components/Message/intents/BookingQuery.js +66 -0
- package/build/components/Chat/components/Message/intents/BookingQuery.js.map +1 -0
- package/build/components/Chat/components/Message/intents/HotelInfo.js +73 -0
- package/build/components/Chat/components/Message/intents/HotelInfo.js.map +1 -0
- package/build/components/Chat/components/Message/intents/Offers.js +57 -0
- package/build/components/Chat/components/Message/intents/Offers.js.map +1 -0
- package/build/components/Chat/components/Message/intents/Unknown.js +67 -0
- package/build/components/Chat/components/Message/intents/Unknown.js.map +1 -0
- package/build/components/Chat/components/Message/intents/index.js +50 -0
- package/build/components/Chat/components/Message/intents/index.js.map +1 -0
- package/build/components/Chat/components/Offline/Offline.js +22 -0
- package/build/components/Chat/components/Offline/Offline.js.map +1 -0
- package/build/components/Chat/components/Offline/Offline.module.css +3 -0
- package/build/components/Chat/components/Offline/index.js +17 -0
- package/build/components/Chat/components/Offline/index.js.map +1 -0
- package/build/components/Chat/components/index.js +61 -0
- package/build/components/Chat/components/index.js.map +1 -0
- package/build/components/Chat/helpers/getVerboseDate.js +18 -0
- package/build/components/Chat/helpers/getVerboseDate.js.map +1 -0
- package/build/components/Chat/helpers/index.js +17 -0
- package/build/components/Chat/helpers/index.js.map +1 -0
- package/build/components/Chat/index.js +17 -0
- package/build/components/Chat/index.js.map +1 -0
- package/build/components/Checkout/partials/__tests__/__snapshots__/Checkout.Form.test.js.snap +440 -16
- package/build/components/Rates/Rates.constants.js +1 -0
- package/build/components/Rates/Rates.constants.js.map +1 -1
- package/build/components/Rates/Rates.js +2 -0
- package/build/components/Rates/Rates.js.map +1 -1
- package/build/components/Rates/components/Hotelverse/Hotelverse.js +1 -1
- package/build/components/Rates/components/Hotelverse/Hotelverse.js.map +1 -1
- package/build/components/Rates/components/Item/components/Features/Features.js +27 -2
- package/build/components/Rates/components/Item/components/Features/Features.js.map +1 -1
- package/build/components/Rates/components/Item/components/ModalInfo/ModalInfo.js +5 -1
- package/build/components/Rates/components/Item/components/ModalInfo/ModalInfo.js.map +1 -1
- package/build/components/Rates/components/Item/components/ModalRateInfo/ModalRateInfo.js +1 -1
- package/build/components/Rates/components/Item/components/ModalRateInfo/ModalRateInfo.js.map +1 -1
- package/build/components/__shared__/Payment/Payment.js +1 -1
- package/build/components/__shared__/Payment/Payment.js.map +1 -1
- package/build/components/__shared__/Payment/__tests__/__snapshots__/Payment.test.js.snap +290 -8
- package/build/components/__shared__/Payment/components/PCI/PCI.constants.js +1 -2
- package/build/components/__shared__/Payment/components/PCI/PCI.constants.js.map +1 -1
- package/build/components/__shared__/Payment/components/PCI/PCI.js +59 -56
- package/build/components/__shared__/Payment/components/PCI/PCI.js.map +1 -1
- package/build/components/__shared__/Payment/components/PCI/__tests__/__snapshots__/PCI.test.js.snap +15 -0
- package/build/components/helpers/ICON.js +13 -0
- package/build/components/helpers/ICON.js.map +1 -1
- package/build/components/index.js +2 -0
- package/build/components/index.js.map +1 -1
- package/build/services/Lisa/action.js +28 -0
- package/build/services/Lisa/action.js.map +1 -0
- package/build/services/Lisa/index.js +17 -0
- package/build/services/Lisa/index.js.map +1 -0
- package/build/services/Lisa/message.js +26 -0
- package/build/services/Lisa/message.js.map +1 -0
- package/build/services/Lisa/status.js +13 -0
- package/build/services/Lisa/status.js.map +1 -0
- package/build/services/Lisa/welcome.js +25 -0
- package/build/services/Lisa/welcome.js.map +1 -0
- package/build/services/Rates/__tests__/__mocks__/rates-response-cancel-types.json +21 -0
- package/build/services/Rates/__tests__/__mocks__/rates-response-no-taxes-no-local.json +6 -0
- package/build/services/Rates/__tests__/__mocks__/rates-response-no-taxes.json +4 -0
- package/build/services/Rates/__tests__/__mocks__/rates-response.json +6 -0
- package/build/services/Rates/extras.js +1 -1
- package/build/services/Rates/extras.js.map +1 -1
- package/build/services/Rates/helpers/getItems.js +1 -1
- package/build/services/Rates/helpers/getItems.js.map +1 -1
- package/build/services/Rates/helpers/parseBoards.js +1 -0
- package/build/services/Rates/helpers/parseBoards.js.map +1 -1
- package/build/services/index.js +11 -0
- package/build/services/index.js.map +1 -1
- package/package.json +1 -1
- package/public/App.Container.jsx +2 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
.face {
|
|
2
|
+
width: 64px;
|
|
3
|
+
height: 64px;
|
|
4
|
+
background-color: var(--mirai-chat-avatar-background);
|
|
5
|
+
border-radius: var(--mirai-chat-avatar-border-radius);
|
|
6
|
+
position: relative;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.face.small {
|
|
10
|
+
min-height: 36px;
|
|
11
|
+
height: 36px;
|
|
12
|
+
min-width: 36px;
|
|
13
|
+
width: 36px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.eyes {
|
|
17
|
+
position: absolute;
|
|
18
|
+
bottom: 27.5%;
|
|
19
|
+
left: 0;
|
|
20
|
+
right: 0;
|
|
21
|
+
height: 17.5%;
|
|
22
|
+
transition: transform 40ms;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.eye {
|
|
26
|
+
animation: blink 8s infinite;
|
|
27
|
+
background-color: var(--mirai-chat-avatar-background);
|
|
28
|
+
border-radius: 50%;
|
|
29
|
+
height: 100%;
|
|
30
|
+
position: absolute;
|
|
31
|
+
width: 17.5%;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.face:not(.small) .eye {
|
|
35
|
+
box-shadow: 0 0 0 6px var(--mirai-chat-avatar-color);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.face.small .eye {
|
|
39
|
+
box-shadow: 0 0 0 3px var(--mirai-chat-avatar-color);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.eye.left {
|
|
43
|
+
left: 27.5%;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.eye.right {
|
|
47
|
+
right: 27.5%;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@keyframes blink {
|
|
51
|
+
0%,
|
|
52
|
+
100% {
|
|
53
|
+
transform: scaleY(100%);
|
|
54
|
+
}
|
|
55
|
+
/* double-blink */
|
|
56
|
+
31% {
|
|
57
|
+
transform: scaleY(100%);
|
|
58
|
+
}
|
|
59
|
+
32% {
|
|
60
|
+
transform: scaleY(15%);
|
|
61
|
+
}
|
|
62
|
+
33% {
|
|
63
|
+
transform: scaleY(100%);
|
|
64
|
+
}
|
|
65
|
+
34% {
|
|
66
|
+
transform: scaleY(15%);
|
|
67
|
+
}
|
|
68
|
+
35% {
|
|
69
|
+
transform: scaleY(100%);
|
|
70
|
+
}
|
|
71
|
+
/* single-blink */
|
|
72
|
+
61% {
|
|
73
|
+
transform: scaleY(100%);
|
|
74
|
+
}
|
|
75
|
+
62% {
|
|
76
|
+
transform: scaleY(15%);
|
|
77
|
+
}
|
|
78
|
+
63% {
|
|
79
|
+
transform: scaleY(100%);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`component:<Avatar> inherit:className 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<div
|
|
6
|
+
class="view mirai"
|
|
7
|
+
>
|
|
8
|
+
<div
|
|
9
|
+
class="view"
|
|
10
|
+
>
|
|
11
|
+
<div
|
|
12
|
+
class="view"
|
|
13
|
+
/>
|
|
14
|
+
<div
|
|
15
|
+
class="view"
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
</DocumentFragment>
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
exports[`component:<Avatar> prop:disabled 1`] = `
|
|
23
|
+
<DocumentFragment>
|
|
24
|
+
<div
|
|
25
|
+
class="view"
|
|
26
|
+
>
|
|
27
|
+
<div
|
|
28
|
+
class="view"
|
|
29
|
+
>
|
|
30
|
+
<div
|
|
31
|
+
class="view"
|
|
32
|
+
/>
|
|
33
|
+
<div
|
|
34
|
+
class="view"
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</DocumentFragment>
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
exports[`component:<Avatar> prop:small 1`] = `
|
|
42
|
+
<DocumentFragment>
|
|
43
|
+
<div
|
|
44
|
+
class="view"
|
|
45
|
+
>
|
|
46
|
+
<div
|
|
47
|
+
class="view"
|
|
48
|
+
>
|
|
49
|
+
<div
|
|
50
|
+
class="view"
|
|
51
|
+
/>
|
|
52
|
+
<div
|
|
53
|
+
class="view"
|
|
54
|
+
/>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</DocumentFragment>
|
|
58
|
+
`;
|
|
59
|
+
|
|
60
|
+
exports[`component:<Avatar> renders 1`] = `
|
|
61
|
+
<DocumentFragment>
|
|
62
|
+
<div
|
|
63
|
+
class="view"
|
|
64
|
+
>
|
|
65
|
+
<div
|
|
66
|
+
class="view"
|
|
67
|
+
>
|
|
68
|
+
<div
|
|
69
|
+
class="view"
|
|
70
|
+
/>
|
|
71
|
+
<div
|
|
72
|
+
class="view"
|
|
73
|
+
/>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
</DocumentFragment>
|
|
77
|
+
`;
|
|
78
|
+
|
|
79
|
+
exports[`component:<Avatar> testId 1`] = `
|
|
80
|
+
<DocumentFragment>
|
|
81
|
+
<div
|
|
82
|
+
class="view"
|
|
83
|
+
data-testid="mirai"
|
|
84
|
+
>
|
|
85
|
+
<div
|
|
86
|
+
class="view"
|
|
87
|
+
>
|
|
88
|
+
<div
|
|
89
|
+
class="view"
|
|
90
|
+
/>
|
|
91
|
+
<div
|
|
92
|
+
class="view"
|
|
93
|
+
/>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
</DocumentFragment>
|
|
97
|
+
`;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _Avatar = require("./Avatar");
|
|
7
|
+
Object.keys(_Avatar).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _Avatar[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _Avatar[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Avatar","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../../../src/components/Chat/components/Avatar/index.js"],"sourcesContent":["export * from './Avatar';\n"],"mappings":";;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,OAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,OAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,OAAA,CAAAK,GAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Input = void 0;
|
|
7
|
+
var _locale = require("@mirai/locale");
|
|
8
|
+
var _ui = require("@mirai/ui");
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _Input = require("./Input.l10n");
|
|
12
|
+
var style = _interopRequireWildcard(require("./Input.module.css"));
|
|
13
|
+
var _helpers = require("../../../helpers");
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
18
|
+
const Input = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
disabled = false,
|
|
21
|
+
onValue = () => {},
|
|
22
|
+
...others
|
|
23
|
+
} = _ref;
|
|
24
|
+
const {
|
|
25
|
+
translate
|
|
26
|
+
} = (0, _locale.useLocale)();
|
|
27
|
+
const [value, setValue] = (0, _react.useState)();
|
|
28
|
+
const handleChange = value => {
|
|
29
|
+
setValue(value);
|
|
30
|
+
};
|
|
31
|
+
const handleKeyPress = function () {
|
|
32
|
+
let {
|
|
33
|
+
key
|
|
34
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
35
|
+
if (key === 'Enter') handlePress();
|
|
36
|
+
};
|
|
37
|
+
const handlePress = () => {
|
|
38
|
+
if (isEmpty) return;
|
|
39
|
+
onValue(value);
|
|
40
|
+
setValue();
|
|
41
|
+
};
|
|
42
|
+
const isEmpty = !value || value.trim().length === 0;
|
|
43
|
+
return /*#__PURE__*/_react.default.createElement(_ui.View, _extends({}, others, {
|
|
44
|
+
row: true,
|
|
45
|
+
className: style.container
|
|
46
|
+
}), /*#__PURE__*/_react.default.createElement(_ui.Input, {
|
|
47
|
+
autoResize: true,
|
|
48
|
+
multiLine: true,
|
|
49
|
+
name: "input",
|
|
50
|
+
placeholder: translate(_Input.L10N.LABEL_SEND_MESSAGE),
|
|
51
|
+
value: value,
|
|
52
|
+
onChange: handleChange,
|
|
53
|
+
onKeyPress: handleKeyPress,
|
|
54
|
+
className: style.input
|
|
55
|
+
}), /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
56
|
+
disabled: disabled,
|
|
57
|
+
small: true,
|
|
58
|
+
squared: true,
|
|
59
|
+
tooltip: translate(_Input.L10N.ACTION_SEND),
|
|
60
|
+
transparent: true,
|
|
61
|
+
onPress: handlePress
|
|
62
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.Icon, {
|
|
63
|
+
lighten: isEmpty,
|
|
64
|
+
value: _helpers.ICON.SEND
|
|
65
|
+
})));
|
|
66
|
+
};
|
|
67
|
+
exports.Input = Input;
|
|
68
|
+
Input.propTypes = {
|
|
69
|
+
disabled: _propTypes.default.bool,
|
|
70
|
+
onValue: _propTypes.default.func
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=Input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.js","names":["_locale","require","_ui","_propTypes","_interopRequireDefault","_react","_interopRequireWildcard","_Input","style","_helpers","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","obj","_extends","assign","bind","target","arguments","length","source","key","apply","Input","_ref","disabled","onValue","others","translate","useLocale","value","setValue","useState","handleChange","handleKeyPress","undefined","handlePress","isEmpty","trim","createElement","View","row","className","container","autoResize","multiLine","name","placeholder","L10N","LABEL_SEND_MESSAGE","onChange","onKeyPress","input","Button","small","squared","tooltip","ACTION_SEND","transparent","onPress","Icon","lighten","ICON","SEND","exports","propTypes","PropTypes","bool","func"],"sources":["../../../../../src/components/Chat/components/Input/Input.jsx"],"sourcesContent":["import { useLocale } from '@mirai/locale';\nimport { Button, Icon, Input as InputBase, View } from '@mirai/ui';\nimport PropTypes from 'prop-types';\nimport React, { useState } from 'react';\n\nimport { L10N } from './Input.l10n';\nimport * as style from './Input.module.css';\nimport { ICON } from '../../../helpers';\n\nconst Input = ({ disabled = false, onValue = () => {}, ...others }) => {\n const { translate } = useLocale();\n\n const [value, setValue] = useState();\n\n const handleChange = (value) => {\n setValue(value);\n };\n\n const handleKeyPress = ({ key } = {}) => {\n if (key === 'Enter') handlePress();\n };\n\n const handlePress = () => {\n if (isEmpty) return;\n\n onValue(value);\n setValue();\n };\n\n const isEmpty = !value || value.trim().length === 0;\n\n return (\n <View {...others} row className={style.container}>\n <InputBase\n autoResize\n multiLine\n name=\"input\"\n placeholder={translate(L10N.LABEL_SEND_MESSAGE)}\n value={value}\n onChange={handleChange}\n onKeyPress={handleKeyPress}\n className={style.input}\n />\n\n <Button disabled={disabled} small squared tooltip={translate(L10N.ACTION_SEND)} transparent onPress={handlePress}>\n <Icon lighten={isEmpty} value={ICON.SEND} />\n </Button>\n </View>\n );\n};\n\nInput.propTypes = {\n disabled: PropTypes.bool,\n onValue: PropTypes.func,\n};\n\nexport { Input };\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,GAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,MAAA,GAAAC,uBAAA,CAAAL,OAAA;AAEA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAF,uBAAA,CAAAL,OAAA;AACA,IAAAQ,QAAA,GAAAR,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= void 0;
|
|
7
|
+
const L10N = exports.L10N = {
|
|
8
|
+
ACTION_SEND: {
|
|
9
|
+
id: 'common.action.send'
|
|
10
|
+
},
|
|
11
|
+
LABEL_SEND_MESSAGE: {
|
|
12
|
+
id: 'lisa.label.send_message'
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=Input.l10n.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.l10n.js","names":["L10N","exports","ACTION_SEND","id","LABEL_SEND_MESSAGE"],"sources":["../../../../../src/components/Chat/components/Input/Input.l10n.js"],"sourcesContent":["export const L10N = {\n ACTION_SEND: { id: 'common.action.send' },\n LABEL_SEND_MESSAGE: { id: 'lisa.label.send_message' },\n};\n"],"mappings":";;;;;;AAAO,MAAMA,IAAI,GAAAC,OAAA,CAAAD,IAAA,GAAG;EAClBE,WAAW,EAAE;IAAEC,EAAE,EAAE;EAAqB,CAAC;EACzCC,kBAAkB,EAAE;IAAED,EAAE,EAAE;EAA0B;AACtD,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
background-color: var(--mirai-chat-input-background);
|
|
3
|
+
border-radius: calc(var(--mirai-chat-border-radius) / 2);
|
|
4
|
+
box-shadow: 0 0 0 var(--mirai-chat-border-size) var(--mirai-chat-input-border-color);
|
|
5
|
+
justify-content: center;
|
|
6
|
+
margin: calc(var(--mirai-chat-space) * -1) var(--mirai-chat-space) var(--mirai-chat-space) var(--mirai-chat-space);
|
|
7
|
+
padding-right: calc(var(--mirai-chat-space) / 2);
|
|
8
|
+
z-index: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.input {
|
|
12
|
+
background-color: transparent;
|
|
13
|
+
color: var(--mirai-chat-text-color);
|
|
14
|
+
font-size: var(--mirai-chat-text-font-size);
|
|
15
|
+
font-weight: var(--mirai-chat-text-font-weight);
|
|
16
|
+
height: calc(var(--mirai-chat-text-line-height) + calc(var(--mirai-ui-space-S) * 2));
|
|
17
|
+
line-height: var(--mirai-chat-text-line-height);
|
|
18
|
+
padding: var(--mirai-ui-space-S);
|
|
19
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`component:<Input> inherit:className 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<div
|
|
6
|
+
class="view row"
|
|
7
|
+
>
|
|
8
|
+
<textarea
|
|
9
|
+
class="input autoResize"
|
|
10
|
+
name="input"
|
|
11
|
+
placeholder="lisa.label.send_message"
|
|
12
|
+
/>
|
|
13
|
+
<span
|
|
14
|
+
class="container"
|
|
15
|
+
>
|
|
16
|
+
<button
|
|
17
|
+
class="pressable dispatcher button small squared transparent"
|
|
18
|
+
>
|
|
19
|
+
<span
|
|
20
|
+
class="icon headline-3 lighten"
|
|
21
|
+
>
|
|
22
|
+
<svg
|
|
23
|
+
fill="currentColor"
|
|
24
|
+
height="1em"
|
|
25
|
+
stroke="currentColor"
|
|
26
|
+
stroke-width="0"
|
|
27
|
+
viewBox="0 0 24 24"
|
|
28
|
+
width="1em"
|
|
29
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
30
|
+
>
|
|
31
|
+
<path
|
|
32
|
+
d="M0 0h24v24H0z"
|
|
33
|
+
fill="none"
|
|
34
|
+
/>
|
|
35
|
+
<path
|
|
36
|
+
d="M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"
|
|
37
|
+
/>
|
|
38
|
+
</svg>
|
|
39
|
+
</span>
|
|
40
|
+
</button>
|
|
41
|
+
</span>
|
|
42
|
+
</div>
|
|
43
|
+
</DocumentFragment>
|
|
44
|
+
`;
|
|
45
|
+
|
|
46
|
+
exports[`component:<Input> prop:disabled 1`] = `
|
|
47
|
+
<DocumentFragment>
|
|
48
|
+
<div
|
|
49
|
+
class="view row"
|
|
50
|
+
>
|
|
51
|
+
<textarea
|
|
52
|
+
class="input autoResize"
|
|
53
|
+
name="input"
|
|
54
|
+
placeholder="lisa.label.send_message"
|
|
55
|
+
/>
|
|
56
|
+
<span
|
|
57
|
+
class="container"
|
|
58
|
+
>
|
|
59
|
+
<button
|
|
60
|
+
class="pressable disabled dispatcher button small squared transparent disabled"
|
|
61
|
+
disabled=""
|
|
62
|
+
>
|
|
63
|
+
<span
|
|
64
|
+
class="icon headline-3 lighten"
|
|
65
|
+
>
|
|
66
|
+
<svg
|
|
67
|
+
fill="currentColor"
|
|
68
|
+
height="1em"
|
|
69
|
+
stroke="currentColor"
|
|
70
|
+
stroke-width="0"
|
|
71
|
+
viewBox="0 0 24 24"
|
|
72
|
+
width="1em"
|
|
73
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
74
|
+
>
|
|
75
|
+
<path
|
|
76
|
+
d="M0 0h24v24H0z"
|
|
77
|
+
fill="none"
|
|
78
|
+
/>
|
|
79
|
+
<path
|
|
80
|
+
d="M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"
|
|
81
|
+
/>
|
|
82
|
+
</svg>
|
|
83
|
+
</span>
|
|
84
|
+
</button>
|
|
85
|
+
</span>
|
|
86
|
+
</div>
|
|
87
|
+
</DocumentFragment>
|
|
88
|
+
`;
|
|
89
|
+
|
|
90
|
+
exports[`component:<Input> renders 1`] = `
|
|
91
|
+
<DocumentFragment>
|
|
92
|
+
<div
|
|
93
|
+
class="view row"
|
|
94
|
+
>
|
|
95
|
+
<textarea
|
|
96
|
+
class="input autoResize"
|
|
97
|
+
name="input"
|
|
98
|
+
placeholder="lisa.label.send_message"
|
|
99
|
+
/>
|
|
100
|
+
<span
|
|
101
|
+
class="container"
|
|
102
|
+
>
|
|
103
|
+
<button
|
|
104
|
+
class="pressable dispatcher button small squared transparent"
|
|
105
|
+
>
|
|
106
|
+
<span
|
|
107
|
+
class="icon headline-3 lighten"
|
|
108
|
+
>
|
|
109
|
+
<svg
|
|
110
|
+
fill="currentColor"
|
|
111
|
+
height="1em"
|
|
112
|
+
stroke="currentColor"
|
|
113
|
+
stroke-width="0"
|
|
114
|
+
viewBox="0 0 24 24"
|
|
115
|
+
width="1em"
|
|
116
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
117
|
+
>
|
|
118
|
+
<path
|
|
119
|
+
d="M0 0h24v24H0z"
|
|
120
|
+
fill="none"
|
|
121
|
+
/>
|
|
122
|
+
<path
|
|
123
|
+
d="M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"
|
|
124
|
+
/>
|
|
125
|
+
</svg>
|
|
126
|
+
</span>
|
|
127
|
+
</button>
|
|
128
|
+
</span>
|
|
129
|
+
</div>
|
|
130
|
+
</DocumentFragment>
|
|
131
|
+
`;
|
|
132
|
+
|
|
133
|
+
exports[`component:<Input> testId 1`] = `
|
|
134
|
+
<DocumentFragment>
|
|
135
|
+
<div
|
|
136
|
+
class="view row"
|
|
137
|
+
data-testid="mirai"
|
|
138
|
+
>
|
|
139
|
+
<textarea
|
|
140
|
+
class="input autoResize"
|
|
141
|
+
name="input"
|
|
142
|
+
placeholder="lisa.label.send_message"
|
|
143
|
+
/>
|
|
144
|
+
<span
|
|
145
|
+
class="container"
|
|
146
|
+
>
|
|
147
|
+
<button
|
|
148
|
+
class="pressable dispatcher button small squared transparent"
|
|
149
|
+
>
|
|
150
|
+
<span
|
|
151
|
+
class="icon headline-3 lighten"
|
|
152
|
+
>
|
|
153
|
+
<svg
|
|
154
|
+
fill="currentColor"
|
|
155
|
+
height="1em"
|
|
156
|
+
stroke="currentColor"
|
|
157
|
+
stroke-width="0"
|
|
158
|
+
viewBox="0 0 24 24"
|
|
159
|
+
width="1em"
|
|
160
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
161
|
+
>
|
|
162
|
+
<path
|
|
163
|
+
d="M0 0h24v24H0z"
|
|
164
|
+
fill="none"
|
|
165
|
+
/>
|
|
166
|
+
<path
|
|
167
|
+
d="M2.01 21 23 12 2.01 3 2 10l15 2-15 2z"
|
|
168
|
+
/>
|
|
169
|
+
</svg>
|
|
170
|
+
</span>
|
|
171
|
+
</button>
|
|
172
|
+
</span>
|
|
173
|
+
</div>
|
|
174
|
+
</DocumentFragment>
|
|
175
|
+
`;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _Input = require("./Input");
|
|
7
|
+
Object.keys(_Input).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _Input[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _Input[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Input","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../../../src/components/Chat/components/Input/index.js"],"sourcesContent":["export * from './Input';\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.List = void 0;
|
|
7
|
+
var _ui = require("@mirai/ui");
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var style = _interopRequireWildcard(require("./InputRich.module.css"));
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
|
+
const List = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
options = [],
|
|
18
|
+
value,
|
|
19
|
+
onChange = () => {},
|
|
20
|
+
onValid = () => {},
|
|
21
|
+
...others
|
|
22
|
+
} = _ref;
|
|
23
|
+
const handlePress = id => {
|
|
24
|
+
onChange(id);
|
|
25
|
+
onValid(true);
|
|
26
|
+
};
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement(_ui.ScrollView, _extends({}, others, {
|
|
28
|
+
height: 128,
|
|
29
|
+
className: (0, _ui.styles)(style.list, others.className)
|
|
30
|
+
}), options.map(function () {
|
|
31
|
+
let {
|
|
32
|
+
id,
|
|
33
|
+
label
|
|
34
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement(_ui.Pressable, {
|
|
36
|
+
key: id,
|
|
37
|
+
onPress: () => handlePress(id),
|
|
38
|
+
className: (0, _ui.styles)(style.item, value === id && style.selected)
|
|
39
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.Text, null, label));
|
|
40
|
+
}));
|
|
41
|
+
};
|
|
42
|
+
exports.List = List;
|
|
43
|
+
List.propTypes = {
|
|
44
|
+
options: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
45
|
+
id: _propTypes.default.string,
|
|
46
|
+
label: _propTypes.default.label
|
|
47
|
+
})),
|
|
48
|
+
value: _propTypes.default.string,
|
|
49
|
+
onChange: _propTypes.default.func,
|
|
50
|
+
onValid: _propTypes.default.func
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=InputRich.List.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputRich.List.js","names":["_ui","require","_propTypes","_interopRequireDefault","_react","style","_interopRequireWildcard","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","obj","_extends","assign","bind","target","arguments","length","source","key","apply","List","_ref","options","value","onChange","onValid","others","handlePress","id","createElement","ScrollView","height","className","styles","list","map","label","undefined","Pressable","onPress","item","selected","Text","exports","propTypes","PropTypes","arrayOf","shape","string","func"],"sources":["../../../../../src/components/Chat/components/InputRich/InputRich.List.jsx"],"sourcesContent":["import { Pressable, ScrollView, styles, Text } from '@mirai/ui';\nimport PropTypes from 'prop-types';\nimport React from 'react';\n\nimport * as style from './InputRich.module.css';\n\nconst List = ({ options = [], value, onChange = () => {}, onValid = () => {}, ...others }) => {\n const handlePress = (id) => {\n onChange(id);\n onValid(true);\n };\n\n return (\n <ScrollView {...others} height={128} className={styles(style.list, others.className)}>\n {options.map(({ id, label } = {}) => (\n <Pressable\n key={id}\n onPress={() => handlePress(id)}\n className={styles(style.item, value === id && style.selected)}\n >\n <Text>{label}</Text>\n </Pressable>\n ))}\n </ScrollView>\n );\n};\n\nList.propTypes = {\n options: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string,\n label: PropTypes.label,\n }),\n ),\n value: PropTypes.string,\n onChange: PropTypes.func,\n onValid: PropTypes.func,\n};\n\nexport { List };\n"],"mappings":";;;;;;AAAA,IAAAA,GAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,KAAA,GAAAC,uBAAA,CAAAL,OAAA;AAAgD,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAF,wBAAAE,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MA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