@ohos-ports/salutejs-plasma-hope 1.388.1-beta.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.
- package/LICENSE.txt +21 -0
- package/README.md +5 -0
- package/collectPackageInfo.d.ts +12 -0
- package/collectPackageInfo.js +29 -0
- package/components/AudioPlayer/AudioPlayer.component-test.js +50 -0
- package/components/AudioPlayer/AudioPlayer.d.ts +46 -0
- package/components/AudioPlayer/AudioPlayer.d.ts.map +1 -0
- package/components/AudioPlayer/AudioPlayer.js +78 -0
- package/components/AudioPlayer/index.d.ts +3 -0
- package/components/AudioPlayer/index.d.ts.map +1 -0
- package/components/AudioPlayer/index.js +12 -0
- package/components/AudioPlayer/utils.d.ts +15 -0
- package/components/AudioPlayer/utils.d.ts.map +1 -0
- package/components/AudioPlayer/utils.js +51 -0
- package/components/AudioPlayer/utils.test.d.ts +2 -0
- package/components/AudioPlayer/utils.test.d.ts.map +1 -0
- package/components/AudioPlayer/utils.test.js +59 -0
- package/components/Button/Button.d.ts +4 -0
- package/components/Button/Button.d.ts.map +1 -0
- package/components/Button/Button.js +33 -0
- package/components/Button/Button.props.d.ts +24 -0
- package/components/Button/Button.props.d.ts.map +1 -0
- package/components/Button/Button.props.js +28 -0
- package/components/Button/index.d.ts +5 -0
- package/components/Button/index.d.ts.map +1 -0
- package/components/Button/index.js +19 -0
- package/components/Button/types.d.ts +13 -0
- package/components/Button/types.d.ts.map +1 -0
- package/components/Button/types.js +10 -0
- package/components/Button/views/b2c/ButtonB2C.d.ts +3 -0
- package/components/Button/views/b2c/ButtonB2C.d.ts.map +1 -0
- package/components/Button/views/b2c/ButtonB2C.js +51 -0
- package/components/Button/views/web/ButtonWeb.d.ts +3 -0
- package/components/Button/views/web/ButtonWeb.d.ts.map +1 -0
- package/components/Button/views/web/ButtonWeb.js +54 -0
- package/components/Card/Card.d.ts +14 -0
- package/components/Card/Card.d.ts.map +1 -0
- package/components/Card/Card.js +34 -0
- package/components/Card/CardBadge.d.ts +13 -0
- package/components/Card/CardBadge.d.ts.map +1 -0
- package/components/Card/CardBadge.js +29 -0
- package/components/Card/CardBody.d.ts +3 -0
- package/components/Card/CardBody.d.ts.map +1 -0
- package/components/Card/CardBody.js +14 -0
- package/components/Card/CardContent.d.ts +7 -0
- package/components/Card/CardContent.d.ts.map +1 -0
- package/components/Card/CardContent.js +21 -0
- package/components/Card/CardMedia.d.ts +3 -0
- package/components/Card/CardMedia.d.ts.map +1 -0
- package/components/Card/CardMedia.js +12 -0
- package/components/Card/index.d.ts +10 -0
- package/components/Card/index.d.ts.map +1 -0
- package/components/Card/index.js +46 -0
- package/components/ElasticGrid/ElasticGrid.component-test.js +54 -0
- package/components/ElasticGrid/ElasticGrid.d.ts +20 -0
- package/components/ElasticGrid/ElasticGrid.d.ts.map +1 -0
- package/components/ElasticGrid/ElasticGrid.js +89 -0
- package/components/ElasticGrid/index.d.ts +2 -0
- package/components/ElasticGrid/index.d.ts.map +1 -0
- package/components/ElasticGrid/index.js +16 -0
- package/components/Modal/Modal.d.ts +48 -0
- package/components/Modal/Modal.d.ts.map +1 -0
- package/components/Modal/Modal.js +154 -0
- package/components/Modal/ModalView.d.ts +24 -0
- package/components/Modal/ModalView.d.ts.map +1 -0
- package/components/Modal/ModalView.js +62 -0
- package/components/Modal/ModalsContext.d.ts +16 -0
- package/components/Modal/ModalsContext.d.ts.map +1 -0
- package/components/Modal/ModalsContext.js +61 -0
- package/components/Modal/index.d.ts +6 -0
- package/components/Modal/index.d.ts.map +1 -0
- package/components/Modal/index.js +26 -0
- package/components/PaginationDots/PaginationDot.d.ts +9 -0
- package/components/PaginationDots/PaginationDot.d.ts.map +1 -0
- package/components/PaginationDots/PaginationDot.js +22 -0
- package/components/PaginationDots/PaginationDots.d.ts +8 -0
- package/components/PaginationDots/PaginationDots.d.ts.map +1 -0
- package/components/PaginationDots/PaginationDots.js +18 -0
- package/components/PaginationDots/SmartPaginationDots.d.ts +14 -0
- package/components/PaginationDots/SmartPaginationDots.d.ts.map +1 -0
- package/components/PaginationDots/SmartPaginationDots.js +44 -0
- package/components/PaginationDots/index.d.ts +6 -0
- package/components/PaginationDots/index.d.ts.map +1 -0
- package/components/PaginationDots/index.js +26 -0
- package/components/Popup/index.d.ts +3 -0
- package/components/Popup/index.d.ts.map +1 -0
- package/components/Popup/index.js +12 -0
- package/components/PreviewGallery/PreviewGallery.component-test.js +266 -0
- package/components/PreviewGallery/PreviewGallery.d.ts +47 -0
- package/components/PreviewGallery/PreviewGallery.d.ts.map +1 -0
- package/components/PreviewGallery/PreviewGallery.js +66 -0
- package/components/PreviewGallery/PreviewGalleryItemBase.d.ts +56 -0
- package/components/PreviewGallery/PreviewGalleryItemBase.d.ts.map +1 -0
- package/components/PreviewGallery/PreviewGalleryItemBase.js +94 -0
- package/components/PreviewGallery/PreviewGalleryItemError.d.ts +8 -0
- package/components/PreviewGallery/PreviewGalleryItemError.d.ts.map +1 -0
- package/components/PreviewGallery/PreviewGalleryItemError.js +47 -0
- package/components/PreviewGallery/PreviewGalleryItemWithTooltip.d.ts +7 -0
- package/components/PreviewGallery/PreviewGalleryItemWithTooltip.d.ts.map +1 -0
- package/components/PreviewGallery/PreviewGalleryItemWithTooltip.js +44 -0
- package/components/PreviewGallery/PreviewGalleryItems.d.ts +24 -0
- package/components/PreviewGallery/PreviewGalleryItems.d.ts.map +1 -0
- package/components/PreviewGallery/PreviewGalleryItems.js +75 -0
- package/components/PreviewGallery/index.d.ts +6 -0
- package/components/PreviewGallery/index.d.ts.map +1 -0
- package/components/PreviewGallery/index.js +38 -0
- package/components/PreviewGallery/types.d.ts +24 -0
- package/components/PreviewGallery/types.d.ts.map +1 -0
- package/components/PreviewGallery/types.js +5 -0
- package/components/PreviewGallery/utils.d.ts +29 -0
- package/components/PreviewGallery/utils.d.ts.map +1 -0
- package/components/PreviewGallery/utils.js +92 -0
- package/components/PreviewGallery/utils.test.d.ts +2 -0
- package/components/PreviewGallery/utils.test.d.ts.map +1 -0
- package/components/PreviewGallery/utils.test.js +240 -0
- package/components/TextArea/index.d.ts +2 -0
- package/components/TextArea/index.d.ts.map +1 -0
- package/components/TextArea/index.js +5 -0
- package/components/TextArea/types.d.ts +49 -0
- package/components/TextArea/types.d.ts.map +1 -0
- package/components/TextArea/types.js +7 -0
- package/components/TextField/TextField.d.ts +4 -0
- package/components/TextField/TextField.d.ts.map +1 -0
- package/components/TextField/TextField.js +49 -0
- package/components/TextField/index.d.ts +4 -0
- package/components/TextField/index.d.ts.map +1 -0
- package/components/TextField/index.js +19 -0
- package/components/TextField/types.d.ts +62 -0
- package/components/TextField/types.d.ts.map +1 -0
- package/components/TextField/types.js +13 -0
- package/components/TextField/views/b2c/Caption.d.ts +7 -0
- package/components/TextField/views/b2c/Caption.d.ts.map +1 -0
- package/components/TextField/views/b2c/Caption.js +25 -0
- package/components/TextField/views/b2c/Content.d.ts +4 -0
- package/components/TextField/views/b2c/Content.d.ts.map +1 -0
- package/components/TextField/views/b2c/Content.js +15 -0
- package/components/TextField/views/b2c/Field.d.ts +14 -0
- package/components/TextField/views/b2c/Field.d.ts.map +1 -0
- package/components/TextField/views/b2c/Field.js +45 -0
- package/components/TextField/views/b2c/Input.d.ts +2 -0
- package/components/TextField/views/b2c/Input.d.ts.map +1 -0
- package/components/TextField/views/b2c/Input.js +13 -0
- package/components/TextField/views/b2c/Placeholder.d.ts +5 -0
- package/components/TextField/views/b2c/Placeholder.d.ts.map +1 -0
- package/components/TextField/views/b2c/Placeholder.js +19 -0
- package/components/TextField/views/b2c/TextField.props.d.ts +7 -0
- package/components/TextField/views/b2c/TextField.props.d.ts.map +1 -0
- package/components/TextField/views/b2c/TextField.props.js +13 -0
- package/components/TextField/views/b2c/TextFieldB2C.d.ts +4 -0
- package/components/TextField/views/b2c/TextFieldB2C.d.ts.map +1 -0
- package/components/TextField/views/b2c/TextFieldB2C.js +86 -0
- package/components/TextField/views/b2c/mixins.d.ts +4 -0
- package/components/TextField/views/b2c/mixins.d.ts.map +1 -0
- package/components/TextField/views/b2c/mixins.js +13 -0
- package/components/TextField/views/web/Field.d.ts +6 -0
- package/components/TextField/views/web/Field.d.ts.map +1 -0
- package/components/TextField/views/web/Field.js +56 -0
- package/components/TextField/views/web/Field.props.d.ts +6 -0
- package/components/TextField/views/web/Field.props.d.ts.map +1 -0
- package/components/TextField/views/web/Field.props.js +12 -0
- package/components/TextField/views/web/Input.d.ts +32 -0
- package/components/TextField/views/web/Input.d.ts.map +1 -0
- package/components/TextField/views/web/Input.js +123 -0
- package/components/TextField/views/web/Input.props.d.ts +44 -0
- package/components/TextField/views/web/Input.props.d.ts.map +1 -0
- package/components/TextField/views/web/Input.props.js +52 -0
- package/components/TextField/views/web/TextFieldWeb.d.ts +4 -0
- package/components/TextField/views/web/TextFieldWeb.d.ts.map +1 -0
- package/components/TextField/views/web/TextFieldWeb.js +53 -0
- package/components/Tooltip/Tooltip.d.ts +41 -0
- package/components/Tooltip/Tooltip.d.ts.map +1 -0
- package/components/Tooltip/Tooltip.js +129 -0
- package/components/Tooltip/index.d.ts +3 -0
- package/components/Tooltip/index.d.ts.map +1 -0
- package/components/Tooltip/index.js +12 -0
- package/components/Upload/Upload.component-test.js +183 -0
- package/components/Upload/Upload.d.ts +21 -0
- package/components/Upload/Upload.d.ts.map +1 -0
- package/components/Upload/Upload.js +48 -0
- package/components/Upload/UploadButton.d.ts +77 -0
- package/components/Upload/UploadButton.d.ts.map +1 -0
- package/components/Upload/UploadButton.js +132 -0
- package/components/Upload/UploadMessage.d.ts +8 -0
- package/components/Upload/UploadMessage.d.ts.map +1 -0
- package/components/Upload/UploadMessage.js +26 -0
- package/components/Upload/UploadProgress.d.ts +7 -0
- package/components/Upload/UploadProgress.d.ts.map +1 -0
- package/components/Upload/UploadProgress.js +41 -0
- package/components/Upload/UploadRoot.d.ts +2 -0
- package/components/Upload/UploadRoot.d.ts.map +1 -0
- package/components/Upload/UploadRoot.js +11 -0
- package/components/Upload/index.d.ts +7 -0
- package/components/Upload/index.d.ts.map +1 -0
- package/components/Upload/index.js +26 -0
- package/components/Upload/types.d.ts +7 -0
- package/components/Upload/types.d.ts.map +1 -0
- package/components/Upload/types.js +5 -0
- package/components/Upload/utils.d.ts +10 -0
- package/components/Upload/utils.d.ts.map +1 -0
- package/components/Upload/utils.js +43 -0
- package/components/Upload/utils.test.d.ts +2 -0
- package/components/Upload/utils.test.d.ts.map +1 -0
- package/components/Upload/utils.test.js +45 -0
- package/components/UploadAudio/UploadAudio.component-test.js +16 -0
- package/components/UploadAudio/UploadAudio.d.ts +13 -0
- package/components/UploadAudio/UploadAudio.d.ts.map +1 -0
- package/components/UploadAudio/UploadAudio.js +41 -0
- package/components/UploadAudio/index.d.ts +3 -0
- package/components/UploadAudio/index.d.ts.map +1 -0
- package/components/UploadAudio/index.js +12 -0
- package/components/UploadVisual/UploadVisual.component-test.js +56 -0
- package/components/UploadVisual/UploadVisual.d.ts +15 -0
- package/components/UploadVisual/UploadVisual.d.ts.map +1 -0
- package/components/UploadVisual/UploadVisual.js +71 -0
- package/components/UploadVisual/index.d.ts +3 -0
- package/components/UploadVisual/index.d.ts.map +1 -0
- package/components/UploadVisual/index.js +12 -0
- package/es/collectPackageInfo.js +21 -0
- package/es/components/AudioPlayer/AudioPlayer.component-test.js +47 -0
- package/es/components/AudioPlayer/AudioPlayer.js +70 -0
- package/es/components/AudioPlayer/index.js +1 -0
- package/es/components/AudioPlayer/utils.js +46 -0
- package/es/components/AudioPlayer/utils.test.js +57 -0
- package/es/components/Button/Button.js +25 -0
- package/es/components/Button/Button.props.js +23 -0
- package/es/components/Button/index.js +2 -0
- package/es/components/Button/types.js +6 -0
- package/es/components/Button/views/b2c/ButtonB2C.js +44 -0
- package/es/components/Button/views/web/ButtonWeb.js +47 -0
- package/es/components/Card/Card.js +21 -0
- package/es/components/Card/CardBadge.js +21 -0
- package/es/components/Card/CardBody.js +7 -0
- package/es/components/Card/CardContent.js +13 -0
- package/es/components/Card/CardMedia.js +1 -0
- package/es/components/Card/index.js +5 -0
- package/es/components/ElasticGrid/ElasticGrid.component-test.js +51 -0
- package/es/components/ElasticGrid/ElasticGrid.js +80 -0
- package/es/components/ElasticGrid/index.js +1 -0
- package/es/components/Modal/Modal.js +145 -0
- package/es/components/Modal/ModalView.js +55 -0
- package/es/components/Modal/ModalsContext.js +56 -0
- package/es/components/Modal/index.js +3 -0
- package/es/components/PaginationDots/PaginationDot.js +14 -0
- package/es/components/PaginationDots/PaginationDots.js +12 -0
- package/es/components/PaginationDots/SmartPaginationDots.js +37 -0
- package/es/components/PaginationDots/index.js +3 -0
- package/es/components/Popup/index.js +1 -0
- package/es/components/PreviewGallery/PreviewGallery.component-test.js +263 -0
- package/es/components/PreviewGallery/PreviewGallery.js +58 -0
- package/es/components/PreviewGallery/PreviewGalleryItemBase.js +86 -0
- package/es/components/PreviewGallery/PreviewGalleryItemError.js +38 -0
- package/es/components/PreviewGallery/PreviewGalleryItemWithTooltip.js +35 -0
- package/es/components/PreviewGallery/PreviewGalleryItems.js +67 -0
- package/es/components/PreviewGallery/index.js +3 -0
- package/es/components/PreviewGallery/types.js +1 -0
- package/es/components/PreviewGallery/utils.js +87 -0
- package/es/components/PreviewGallery/utils.test.js +238 -0
- package/es/components/TextArea/index.js +1 -0
- package/es/components/TextArea/types.js +3 -0
- package/es/components/TextField/TextField.js +41 -0
- package/es/components/TextField/index.js +2 -0
- package/es/components/TextField/types.js +7 -0
- package/es/components/TextField/views/b2c/Caption.js +18 -0
- package/es/components/TextField/views/b2c/Content.js +8 -0
- package/es/components/TextField/views/b2c/Field.js +37 -0
- package/es/components/TextField/views/b2c/Input.js +6 -0
- package/es/components/TextField/views/b2c/Placeholder.js +12 -0
- package/es/components/TextField/views/b2c/TextField.props.js +7 -0
- package/es/components/TextField/views/b2c/TextFieldB2C.js +79 -0
- package/es/components/TextField/views/b2c/mixins.js +7 -0
- package/es/components/TextField/views/web/Field.js +49 -0
- package/es/components/TextField/views/web/Field.props.js +6 -0
- package/es/components/TextField/views/web/Input.js +115 -0
- package/es/components/TextField/views/web/Input.props.js +46 -0
- package/es/components/TextField/views/web/TextFieldWeb.js +46 -0
- package/es/components/Tooltip/Tooltip.js +122 -0
- package/es/components/Tooltip/index.js +1 -0
- package/es/components/Upload/Upload.component-test.js +180 -0
- package/es/components/Upload/Upload.js +41 -0
- package/es/components/Upload/UploadButton.js +125 -0
- package/es/components/Upload/UploadMessage.js +19 -0
- package/es/components/Upload/UploadProgress.js +34 -0
- package/es/components/Upload/UploadRoot.js +4 -0
- package/es/components/Upload/index.js +3 -0
- package/es/components/Upload/types.js +1 -0
- package/es/components/Upload/utils.js +37 -0
- package/es/components/Upload/utils.test.js +43 -0
- package/es/components/UploadAudio/UploadAudio.component-test.js +13 -0
- package/es/components/UploadAudio/UploadAudio.js +34 -0
- package/es/components/UploadAudio/index.js +1 -0
- package/es/components/UploadVisual/UploadVisual.component-test.js +53 -0
- package/es/components/UploadVisual/UploadVisual.js +62 -0
- package/es/components/UploadVisual/index.js +1 -0
- package/es/hocs/index.js +1 -0
- package/es/hooks/index.js +1 -0
- package/es/index.js +19 -0
- package/es/mixins/index.js +1 -0
- package/es/tokens/colors.js +45 -0
- package/es/tokens/index.js +3 -0
- package/es/tokens/sizes.js +6 -0
- package/es/tokens/typography.js +48 -0
- package/es/types/index.js +1 -0
- package/es/utils/clearSelection.js +9 -0
- package/es/utils/index.js +4 -0
- package/es/utils/mediaQuery.js +58 -0
- package/es/utils/selectText.js +17 -0
- package/hocs/index.d.ts +3 -0
- package/hocs/index.d.ts.map +1 -0
- package/hocs/index.js +12 -0
- package/hooks/index.d.ts +2 -0
- package/hooks/index.d.ts.map +1 -0
- package/hooks/index.js +36 -0
- package/index.d.ts +20 -0
- package/index.js +214 -0
- package/mixins/index.d.ts +3 -0
- package/mixins/index.d.ts.map +1 -0
- package/mixins/index.js +102 -0
- package/package.json +80 -0
- package/tokens/colors.d.ts +46 -0
- package/tokens/colors.d.ts.map +1 -0
- package/tokens/colors.js +51 -0
- package/tokens/index.d.ts +4 -0
- package/tokens/index.d.ts.map +1 -0
- package/tokens/index.js +38 -0
- package/tokens/sizes.d.ts +7 -0
- package/tokens/sizes.d.ts.map +1 -0
- package/tokens/sizes.js +12 -0
- package/tokens/typography.d.ts +8 -0
- package/tokens/typography.d.ts.map +1 -0
- package/tokens/typography.js +54 -0
- package/types/index.d.ts +2 -0
- package/types/index.d.ts.map +1 -0
- package/types/index.js +5 -0
- package/utils/clearSelection.d.ts +2 -0
- package/utils/clearSelection.d.ts.map +1 -0
- package/utils/clearSelection.js +15 -0
- package/utils/index.d.ts +7 -0
- package/utils/index.d.ts.map +1 -0
- package/utils/index.js +159 -0
- package/utils/mediaQuery.d.ts +37 -0
- package/utils/mediaQuery.d.ts.map +1 -0
- package/utils/mediaQuery.js +64 -0
- package/utils/selectText.d.ts +2 -0
- package/utils/selectText.d.ts.map +1 -0
- package/utils/selectText.js +23 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Salute Devices
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Window {
|
|
3
|
+
__PLASMA_INFO__: {
|
|
4
|
+
[k: string]: {
|
|
5
|
+
version: string;
|
|
6
|
+
entities: string[];
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export declare const collectPackageInfo: (entityName: string) => void;
|
|
12
|
+
//# sourceMappingURL=collectPackageInfo.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.collectPackageInfo = void 0;
|
|
7
|
+
var _package2 = /*#__PURE__*/_interopRequireDefault(/*#__PURE__*/require("./package.json"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
9
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment, no-underscore-dangle */
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
|
|
12
|
+
var collectPackageInfo = exports.collectPackageInfo = function collectPackageInfo(entityName) {
|
|
13
|
+
if (typeof window === 'undefined') {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
var name = _package2["default"].name,
|
|
17
|
+
version = _package2["default"].version;
|
|
18
|
+
if (!window.__PLASMA_INFO__) {
|
|
19
|
+
window.__PLASMA_INFO__ = {};
|
|
20
|
+
}
|
|
21
|
+
if (!window.__PLASMA_INFO__[name]) {
|
|
22
|
+
window.__PLASMA_INFO__[name] = {
|
|
23
|
+
version: version,
|
|
24
|
+
entities: [entityName]
|
|
25
|
+
};
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
window.__PLASMA_INFO__[name].entities.push(entityName);
|
|
29
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _react = /*#__PURE__*/_interopRequireDefault(/*#__PURE__*/require("react"));
|
|
4
|
+
var _plasmaCyUtils = /*#__PURE__*/require("@salutejs/plasma-cy-utils");
|
|
5
|
+
var _PadMe, _PadMe2;
|
|
6
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
7
|
+
describe('plasma-hope: AudioPlayer', function () {
|
|
8
|
+
var AudioPlayer = (0, _plasmaCyUtils.getComponent)('AudioPlayer');
|
|
9
|
+
var item = {
|
|
10
|
+
name: 'Kavinsky - Nightcall',
|
|
11
|
+
duration: 128,
|
|
12
|
+
isPlaying: false,
|
|
13
|
+
isSelected: false
|
|
14
|
+
};
|
|
15
|
+
it('simple', function () {
|
|
16
|
+
(0, _plasmaCyUtils.mount)(/*#__PURE__*/_react["default"].createElement(_plasmaCyUtils.CypressTestDecorator, null, /*#__PURE__*/_react["default"].createElement(AudioPlayer, {
|
|
17
|
+
title: item.name,
|
|
18
|
+
duration: item.duration,
|
|
19
|
+
isPlaying: item.isPlaying,
|
|
20
|
+
isSelected: item.isSelected
|
|
21
|
+
})));
|
|
22
|
+
cy.matchImageSnapshot();
|
|
23
|
+
});
|
|
24
|
+
it('_isPlaying', function () {
|
|
25
|
+
(0, _plasmaCyUtils.mount)(/*#__PURE__*/_react["default"].createElement(_plasmaCyUtils.CypressTestDecorator, null, /*#__PURE__*/_react["default"].createElement(AudioPlayer, {
|
|
26
|
+
title: item.name,
|
|
27
|
+
duration: item.duration,
|
|
28
|
+
isSelected: item.isSelected
|
|
29
|
+
}), _PadMe || (_PadMe = /*#__PURE__*/_react["default"].createElement(_plasmaCyUtils.PadMe, null)), /*#__PURE__*/_react["default"].createElement(AudioPlayer, {
|
|
30
|
+
title: item.name,
|
|
31
|
+
duration: item.duration,
|
|
32
|
+
isSelected: item.isSelected,
|
|
33
|
+
isPlaying: true
|
|
34
|
+
})));
|
|
35
|
+
cy.matchImageSnapshot();
|
|
36
|
+
});
|
|
37
|
+
it('_isSelected', function () {
|
|
38
|
+
(0, _plasmaCyUtils.mount)(/*#__PURE__*/_react["default"].createElement(_plasmaCyUtils.CypressTestDecorator, null, /*#__PURE__*/_react["default"].createElement(AudioPlayer, {
|
|
39
|
+
title: item.name,
|
|
40
|
+
duration: item.duration,
|
|
41
|
+
isPlaying: item.isPlaying
|
|
42
|
+
}), _PadMe2 || (_PadMe2 = /*#__PURE__*/_react["default"].createElement(_plasmaCyUtils.PadMe, null)), /*#__PURE__*/_react["default"].createElement(AudioPlayer, {
|
|
43
|
+
title: item.name,
|
|
44
|
+
duration: item.duration,
|
|
45
|
+
isPlaying: item.isPlaying,
|
|
46
|
+
isSelected: true
|
|
47
|
+
})));
|
|
48
|
+
cy.matchImageSnapshot();
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FC } from 'react';
|
|
3
|
+
export declare const StyledControl: import("styled-components").StyledComponent<"button", any, {}, never>;
|
|
4
|
+
export interface AudioPlayerProps {
|
|
5
|
+
/**
|
|
6
|
+
* Название трека.
|
|
7
|
+
*/
|
|
8
|
+
title: string;
|
|
9
|
+
/**
|
|
10
|
+
* Адрес расположения трека.
|
|
11
|
+
*/
|
|
12
|
+
url: string;
|
|
13
|
+
/**
|
|
14
|
+
* Длительность трека в секундах.
|
|
15
|
+
*/
|
|
16
|
+
duration?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Выделен ли компонент.
|
|
19
|
+
*/
|
|
20
|
+
isSelected: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Воспроизводится ли трек.
|
|
23
|
+
*/
|
|
24
|
+
isPlaying: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Можно ли удалить компонент.
|
|
27
|
+
*/
|
|
28
|
+
canDelete: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Callback на клик по компоненту.
|
|
31
|
+
*/
|
|
32
|
+
onClick: () => void;
|
|
33
|
+
/**
|
|
34
|
+
* Callback на удаление компонента.
|
|
35
|
+
*/
|
|
36
|
+
onDelete: () => void;
|
|
37
|
+
/**
|
|
38
|
+
* Callback на воспроизведение трека.
|
|
39
|
+
*/
|
|
40
|
+
onPlay: (event: React.MouseEvent<HTMLSpanElement, MouseEvent>) => void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Компонент для воспроизведения аудио.
|
|
44
|
+
*/
|
|
45
|
+
export declare const AudioPlayer: FC<AudioPlayerProps>;
|
|
46
|
+
//# sourceMappingURL=AudioPlayer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AudioPlayer.d.ts","sourceRoot":"","sources":["../../src/components/AudioPlayer/AudioPlayer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAC;AACtC,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AA+BhC,eAAO,MAAM,aAAa,uEAMzB,CAAC;AAsEF,MAAM,WAAW,gBAAgB;IAC7B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB;;OAEG;IACH,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,eAAe,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;CAC1E;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CA+B5C,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.StyledControl = exports.AudioPlayer = void 0;
|
|
8
|
+
var _react = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("react"));
|
|
9
|
+
var _styledComponents = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("styled-components"));
|
|
10
|
+
var _plasmaCore = /*#__PURE__*/require("@salutejs/plasma-core");
|
|
11
|
+
var _plasmaIcons = /*#__PURE__*/require("@salutejs/plasma-icons");
|
|
12
|
+
var _utils = /*#__PURE__*/require("./utils");
|
|
13
|
+
var _collectPackageInfo = /*#__PURE__*/require("../../collectPackageInfo");
|
|
14
|
+
var _IconPause, _IconPlay, _IconTrashFilled;
|
|
15
|
+
var _excluded = ["title", "duration", "url", "isPlaying", "isSelected", "canDelete", "onClick", "onDelete", "onPlay"];
|
|
16
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
17
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
18
|
+
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
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
20
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
21
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
22
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
23
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
24
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
25
|
+
(0, _collectPackageInfo.collectPackageInfo)('AudioPlayer/AudioPlayer');
|
|
26
|
+
var ButtonDelete = /*#__PURE__*/_styledComponents["default"].button.withConfig({
|
|
27
|
+
componentId: "plasma-web-core__sc-1cldicm-0"
|
|
28
|
+
})(["position:absolute;right:1.25rem;top:1.25rem;display:none;padding-top:0;padding-bottom:0;line-height:0;background-color:transparent;border:0;cursor:pointer;svg{color:var(--surface-transparent-tertiary);}&:hover{svg{color:var(--text-primary);}}"]);
|
|
29
|
+
var StyledControl = exports.StyledControl = /*#__PURE__*/_styledComponents["default"].button.withConfig({
|
|
30
|
+
componentId: "plasma-web-core__sc-1cldicm-1"
|
|
31
|
+
})(["background:transparent;border:0;cursor:pointer;display:flex;"]);
|
|
32
|
+
var StyledContainer = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
33
|
+
componentId: "plasma-web-core__sc-1cldicm-2"
|
|
34
|
+
})(["position:relative;display:flex;align-items:center;box-sizing:border-box;width:100%;height:4rem;padding:1.25rem 1rem;appearance:none;border-radius:0.75rem;cursor:pointer;", " ", "{", "}"], function (_ref) {
|
|
35
|
+
var isSelected = _ref.isSelected;
|
|
36
|
+
return isSelected && (0, _styledComponents.css)(["background-color:var(--surface-transparent-tertiary);"]);
|
|
37
|
+
}, StyledControl, function (_ref2) {
|
|
38
|
+
var isDisabled = _ref2.isDisabled;
|
|
39
|
+
return isDisabled && (0, _styledComponents.css)(["opacity:0.24;pointer-events:none;"]);
|
|
40
|
+
});
|
|
41
|
+
var StyledDuration = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
42
|
+
componentId: "plasma-web-core__sc-1cldicm-3"
|
|
43
|
+
})(["position:absolute;right:1rem;text-align:right;color:var(--text-primary);mix-blend-mode:normal;opacity:0.5;"]);
|
|
44
|
+
var StyledRoot = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
45
|
+
componentId: "plasma-web-core__sc-1cldicm-4"
|
|
46
|
+
})(["", ";position:relative;width:100%;&:hover ", "{display:block;}&:hover ", "{display:none;}&:hover ", "{background-color:var(--surface-transparent-secondary);}"], _plasmaCore.footnote1, ButtonDelete, StyledDuration, StyledContainer);
|
|
47
|
+
var StyledTitle = /*#__PURE__*/_styledComponents["default"].div.withConfig({
|
|
48
|
+
componentId: "plasma-web-core__sc-1cldicm-5"
|
|
49
|
+
})(["margin-left:1rem;color:var(--text-primary);"]);
|
|
50
|
+
/**
|
|
51
|
+
* Компонент для воспроизведения аудио.
|
|
52
|
+
*/
|
|
53
|
+
var AudioPlayer = exports.AudioPlayer = function AudioPlayer(_ref3) {
|
|
54
|
+
var title = _ref3.title,
|
|
55
|
+
duration = _ref3.duration,
|
|
56
|
+
url = _ref3.url,
|
|
57
|
+
isPlaying = _ref3.isPlaying,
|
|
58
|
+
isSelected = _ref3.isSelected,
|
|
59
|
+
canDelete = _ref3.canDelete,
|
|
60
|
+
onClick = _ref3.onClick,
|
|
61
|
+
onDelete = _ref3.onDelete,
|
|
62
|
+
onPlay = _ref3.onPlay,
|
|
63
|
+
props = _objectWithoutProperties(_ref3, _excluded);
|
|
64
|
+
var ref = (0, _react.useRef)();
|
|
65
|
+
var _useAudioPlayer = (0, _utils.useAudioPlayer)(url, isPlaying, ref),
|
|
66
|
+
_useAudioPlayer2 = _slicedToArray(_useAudioPlayer, 1),
|
|
67
|
+
canPlaying = _useAudioPlayer2[0];
|
|
68
|
+
return /*#__PURE__*/_react["default"].createElement(StyledRoot, props, /*#__PURE__*/_react["default"].createElement(StyledContainer, {
|
|
69
|
+
isSelected: isSelected,
|
|
70
|
+
isDisabled: !canPlaying,
|
|
71
|
+
onClick: onClick
|
|
72
|
+
}, /*#__PURE__*/_react["default"].createElement(StyledControl, {
|
|
73
|
+
onClick: onPlay
|
|
74
|
+
}, isPlaying ? _IconPause || (_IconPause = /*#__PURE__*/_react["default"].createElement(_plasmaIcons.IconPause, null)) : _IconPlay || (_IconPlay = /*#__PURE__*/_react["default"].createElement(_plasmaIcons.IconPlay, null))), /*#__PURE__*/_react["default"].createElement(StyledTitle, null, title), duration && /*#__PURE__*/_react["default"].createElement(StyledDuration, null, (0, _utils.formatSecondsToMintues)(duration))), canDelete && /*#__PURE__*/_react["default"].createElement(ButtonDelete, {
|
|
75
|
+
type: "button",
|
|
76
|
+
onClick: onDelete
|
|
77
|
+
}, _IconTrashFilled || (_IconTrashFilled = /*#__PURE__*/_react["default"].createElement(_plasmaIcons.IconTrashFilled, null))));
|
|
78
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/AudioPlayer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "AudioPlayer", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _AudioPlayer.AudioPlayer;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _AudioPlayer = /*#__PURE__*/require("./AudioPlayer");
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Метод для форматирования секунд в минуты в формате `SS:SS`
|
|
3
|
+
* @param {number} seconds время в секундах
|
|
4
|
+
* @returns {string} строка времени в минутах
|
|
5
|
+
*/
|
|
6
|
+
export declare const formatSecondsToMintues: (seconds: number) => string;
|
|
7
|
+
/**
|
|
8
|
+
* Хук для воспроизведения аудио, возвращает состояние возможности проиграть аудио
|
|
9
|
+
* @param {string} url конечный адрес до файла
|
|
10
|
+
* @param {boolean} isPlaying воспроизводится ли сейчас трек
|
|
11
|
+
* @param {React.MutableRefObject<HTMLAudioElement | undefined>} refAudio ссылка на ref-объект
|
|
12
|
+
* @returns {boolean} возможность воспроизвести трек
|
|
13
|
+
*/
|
|
14
|
+
export declare const useAudioPlayer: (url: string, isPlaying: boolean, refAudio: React.MutableRefObject<HTMLAudioElement | undefined>) => boolean[];
|
|
15
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/components/AudioPlayer/utils.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,YAAa,MAAM,WACkC,CAAC;AAEzF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,QAClB,MAAM,aACA,OAAO,YACR,KAAK,CAAC,gBAAgB,CAAC,gBAAgB,GAAG,SAAS,CAAC,cA4BjE,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useAudioPlayer = exports.formatSecondsToMintues = void 0;
|
|
7
|
+
var _react = /*#__PURE__*/require("react");
|
|
8
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
9
|
+
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."); }
|
|
10
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
11
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
12
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
13
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
14
|
+
/**
|
|
15
|
+
* Метод для форматирования секунд в минуты в формате `SS:SS`
|
|
16
|
+
* @param {number} seconds время в секундах
|
|
17
|
+
* @returns {string} строка времени в минутах
|
|
18
|
+
*/
|
|
19
|
+
var formatSecondsToMintues = exports.formatSecondsToMintues = function formatSecondsToMintues(seconds) {
|
|
20
|
+
return new Date(Math.round(seconds) * 1000).toISOString().substr(11, 8).replace(/^00:/, '');
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Хук для воспроизведения аудио, возвращает состояние возможности проиграть аудио
|
|
25
|
+
* @param {string} url конечный адрес до файла
|
|
26
|
+
* @param {boolean} isPlaying воспроизводится ли сейчас трек
|
|
27
|
+
* @param {React.MutableRefObject<HTMLAudioElement | undefined>} refAudio ссылка на ref-объект
|
|
28
|
+
* @returns {boolean} возможность воспроизвести трек
|
|
29
|
+
*/
|
|
30
|
+
var useAudioPlayer = exports.useAudioPlayer = function useAudioPlayer(url, isPlaying, refAudio) {
|
|
31
|
+
var _useState = (0, _react.useState)(false),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
canPlaying = _useState2[0],
|
|
34
|
+
setCanPlaying = _useState2[1];
|
|
35
|
+
var canPlay = (0, _react.useCallback)(function canPlay() {
|
|
36
|
+
refAudio.current = this;
|
|
37
|
+
setCanPlaying(true);
|
|
38
|
+
}, [refAudio]);
|
|
39
|
+
(0, _react.useEffect)(function () {
|
|
40
|
+
if (refAudio.current) {
|
|
41
|
+
refAudio.current[isPlaying ? 'play' : 'pause']();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
var audio = new Audio(url);
|
|
45
|
+
audio.addEventListener('canplaythrough', canPlay);
|
|
46
|
+
return function () {
|
|
47
|
+
audio.addEventListener('canplaythrough', canPlay);
|
|
48
|
+
};
|
|
49
|
+
}, [canPlay, url, refAudio, isPlaying]);
|
|
50
|
+
return [canPlaying];
|
|
51
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.test.d.ts","sourceRoot":"","sources":["../../src/components/AudioPlayer/utils.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _dom = /*#__PURE__*/require("@testing-library/react-hooks/dom");
|
|
4
|
+
var _utils = /*#__PURE__*/require("./utils");
|
|
5
|
+
describe('AudioPlayer utils', function () {
|
|
6
|
+
describe('formatSecondsToMintues', function () {
|
|
7
|
+
it('Should return empty array', function () {
|
|
8
|
+
expect((0, _utils.formatSecondsToMintues)(0)).toBe('00:00');
|
|
9
|
+
});
|
|
10
|
+
it('Should return new array without element by number id', function () {
|
|
11
|
+
expect((0, _utils.formatSecondsToMintues)(120)).toBe('02:00');
|
|
12
|
+
});
|
|
13
|
+
it('Should return new array without element by string id', function () {
|
|
14
|
+
expect((0, _utils.formatSecondsToMintues)(321)).toBe('05:21');
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// ToDo: improve test
|
|
19
|
+
describe('useAudioPlayer', function () {
|
|
20
|
+
it('Should call play', function () {
|
|
21
|
+
var refAudio = {
|
|
22
|
+
current: {
|
|
23
|
+
play: jest.fn(),
|
|
24
|
+
pause: jest.fn()
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var isPlaying = true;
|
|
28
|
+
(0, _dom.renderHook)(function () {
|
|
29
|
+
return (0, _utils.useAudioPlayer)('mock-url', isPlaying, refAudio);
|
|
30
|
+
});
|
|
31
|
+
expect(refAudio.current.pause).toBeCalledTimes(0);
|
|
32
|
+
expect(refAudio.current.play).toBeCalledTimes(1);
|
|
33
|
+
});
|
|
34
|
+
it('Should call pause', function () {
|
|
35
|
+
var refAudio = {
|
|
36
|
+
current: {
|
|
37
|
+
play: jest.fn(),
|
|
38
|
+
pause: jest.fn()
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var isPlaying = false;
|
|
42
|
+
(0, _dom.renderHook)(function () {
|
|
43
|
+
return (0, _utils.useAudioPlayer)('mock-url', isPlaying, refAudio);
|
|
44
|
+
});
|
|
45
|
+
expect(refAudio.current.pause).toBeCalledTimes(1);
|
|
46
|
+
expect(refAudio.current.play).toBeCalledTimes(0);
|
|
47
|
+
});
|
|
48
|
+
it('Should return false', function () {
|
|
49
|
+
var refAudio = {
|
|
50
|
+
current: undefined
|
|
51
|
+
};
|
|
52
|
+
var _renderHook = (0, _dom.renderHook)(function () {
|
|
53
|
+
return (0, _utils.useAudioPlayer)('mock-url', false, refAudio);
|
|
54
|
+
}),
|
|
55
|
+
canPlaying = _renderHook.result;
|
|
56
|
+
expect(canPlaying.current).toEqual([false]);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAK1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAOnD,eAAO,MAAM,MAAM,eAAgB,MAAM,0FAUxC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.Button = void 0;
|
|
8
|
+
var _react = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("react"));
|
|
9
|
+
var _plasmaCore = /*#__PURE__*/require("@salutejs/plasma-core");
|
|
10
|
+
var _ButtonWeb = /*#__PURE__*/require("./views/web/ButtonWeb");
|
|
11
|
+
var _ButtonB2C = /*#__PURE__*/require("./views/b2c/ButtonB2C");
|
|
12
|
+
var _collectPackageInfo = /*#__PURE__*/require("../../collectPackageInfo");
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
14
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
15
|
+
(0, _collectPackageInfo.collectPackageInfo)('Button/Button');
|
|
16
|
+
var componentMap = {
|
|
17
|
+
web: _ButtonWeb.ButtonWeb,
|
|
18
|
+
b2c: _ButtonB2C.ButtonB2C
|
|
19
|
+
};
|
|
20
|
+
var Button = exports.Button = function Button(_ref) {
|
|
21
|
+
var design = _ref.design;
|
|
22
|
+
var ButtonView = (0, _plasmaCore.createButton)(componentMap[design]);
|
|
23
|
+
ButtonView.defaultProps = {
|
|
24
|
+
size: 'm',
|
|
25
|
+
view: 'secondary',
|
|
26
|
+
pin: 'square-square'
|
|
27
|
+
};
|
|
28
|
+
return /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
29
|
+
return /*#__PURE__*/_react["default"].createElement(ButtonView, _extends({}, props, {
|
|
30
|
+
ref: ref
|
|
31
|
+
}));
|
|
32
|
+
});
|
|
33
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Views (colors) for both B2B and B2C
|
|
3
|
+
*/
|
|
4
|
+
export declare const buttonViews: {
|
|
5
|
+
primary: import("styled-components").FlattenSimpleInterpolation;
|
|
6
|
+
success: import("styled-components").FlattenSimpleInterpolation;
|
|
7
|
+
warning: import("styled-components").FlattenSimpleInterpolation;
|
|
8
|
+
critical: import("styled-components").FlattenSimpleInterpolation;
|
|
9
|
+
secondary: import("styled-components").FlattenSimpleInterpolation;
|
|
10
|
+
checked: import("styled-components").FlattenSimpleInterpolation;
|
|
11
|
+
overlay: {
|
|
12
|
+
backgroundColor: string;
|
|
13
|
+
color: string;
|
|
14
|
+
};
|
|
15
|
+
clear: {
|
|
16
|
+
backgroundColor: string;
|
|
17
|
+
color: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* @private
|
|
22
|
+
*/
|
|
23
|
+
export type ButtonView = keyof typeof buttonViews;
|
|
24
|
+
//# sourceMappingURL=Button.props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.props.d.ts","sourceRoot":"","sources":["../../src/components/Button/Button.props.ts"],"names":[],"mappings":"AAoBA;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;CAiFvB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,WAAW,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.buttonViews = void 0;
|
|
7
|
+
var _styledComponents = /*#__PURE__*/require("styled-components");
|
|
8
|
+
var _plasmaCore = /*#__PURE__*/require("@salutejs/plasma-core");
|
|
9
|
+
var _tokens = /*#__PURE__*/require("../../tokens");
|
|
10
|
+
var _collectPackageInfo = /*#__PURE__*/require("../../collectPackageInfo");
|
|
11
|
+
/**
|
|
12
|
+
* Views (colors) for both B2B and B2C
|
|
13
|
+
*/
|
|
14
|
+
(0, _collectPackageInfo.collectPackageInfo)('Button/Button.props');
|
|
15
|
+
var buttonViews = exports.buttonViews = {
|
|
16
|
+
primary: /*#__PURE__*/(0, _styledComponents.css)(["", " &:hover{background-color:", ";color:", ";}&:active{background-color:", ";color:", ";}"], _plasmaCore.buttonViews.primary, _tokens.buttonPrimaryHover, _plasmaCore.buttonViews.primary.color, _tokens.buttonPrimaryActive, _plasmaCore.buttonViews.primary.color),
|
|
17
|
+
success: /*#__PURE__*/(0, _styledComponents.css)(["", " &:hover{background-color:", ";color:", ";}&:active{background-color:", ";color:", ";}"], _plasmaCore.buttonViews.success, _tokens.buttonSuccessHover, _plasmaCore.buttonViews.success.color, _tokens.buttonSuccessActive, _plasmaCore.buttonViews.success.color),
|
|
18
|
+
warning: /*#__PURE__*/(0, _styledComponents.css)(["", " &:hover{background-color:", ";color:", ";}&:active{background-color:", ";color:", ";}"], _plasmaCore.buttonViews.warning, _tokens.buttonWarningHover, _plasmaCore.buttonViews.warning.color, _tokens.buttonWarningActive, _plasmaCore.buttonViews.warning.color),
|
|
19
|
+
critical: /*#__PURE__*/(0, _styledComponents.css)(["", " &:hover{background-color:", ";color:", ";}&:active{background-color:", ";color:", ";}"], _plasmaCore.buttonViews.critical, _tokens.buttonCriticalHover, _plasmaCore.buttonViews.critical.color, _tokens.buttonCriticalActive, _plasmaCore.buttonViews.critical.color),
|
|
20
|
+
secondary: /*#__PURE__*/(0, _styledComponents.css)(["", " &:hover{background-color:", ";color:", ";}&:active{background-color:", ";color:", ";}"], _plasmaCore.buttonViews.secondary, _tokens.buttonSecondaryHover, _plasmaCore.buttonViews.secondary.color, _tokens.buttonSecondaryActive, _plasmaCore.buttonViews.secondary.color),
|
|
21
|
+
checked: /*#__PURE__*/(0, _styledComponents.css)(["", " &:hover{background-color:", ";color:", ";}&:active{background-color:", ";color:", ";}"], _plasmaCore.buttonViews.checked, _tokens.buttonCheckedHover, _tokens.buttonCheckedHoverColor, _tokens.buttonCheckedActive, _tokens.buttonCheckedActiveColor),
|
|
22
|
+
overlay: _plasmaCore.buttonViews.overlay,
|
|
23
|
+
clear: _plasmaCore.buttonViews.clear
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @private
|
|
28
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/Button/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Button", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _Button.Button;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "buttonViews", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _Button2.buttonViews;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _Button = /*#__PURE__*/require("./Button");
|
|
19
|
+
var _Button2 = /*#__PURE__*/require("./Button.props");
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ButtonProps as BaseProps, ButtonContentProps, ButtonViewProps } from '@salutejs/plasma-core';
|
|
2
|
+
import { ButtonView } from './Button.props';
|
|
3
|
+
/**
|
|
4
|
+
* Размер кнопки
|
|
5
|
+
*/
|
|
6
|
+
export type ButtonSizes = {
|
|
7
|
+
size: 'l' | 'm' | 's' | 'xs' | 'xxs';
|
|
8
|
+
};
|
|
9
|
+
export type ButtonProps = BaseProps & Partial<ButtonSizes> & Partial<ButtonViewProps<ButtonView>> & ButtonContentProps;
|
|
10
|
+
export type Design = {
|
|
11
|
+
design: 'b2c' | 'web';
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/components/Button/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,IAAI,SAAS,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE3G,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IAAE,IAAI,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,KAAK,CAAA;CAAE,CAAC;AAEnE,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,GAAG,kBAAkB,CAAC;AAEvH,MAAM,MAAM,MAAM,GAAG;IACjB,MAAM,EAAE,KAAK,GAAG,KAAK,CAAC;CACzB,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ButtonSizeProps, ButtonViewProps } from '@salutejs/plasma-core';
|
|
2
|
+
export declare const ButtonB2C: import("styled-components").StyledComponent<"button", any, import("@salutejs/plasma-core/components/Button/Button.types").StyledButtonProps & Partial<ButtonSizeProps<string | number>> & Partial<ButtonViewProps<"checked" | "overlay" | "clear" | "primary" | "secondary" | "success" | "warning" | "critical">>, never>;
|
|
3
|
+
//# sourceMappingURL=ButtonB2C.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonB2C.d.ts","sourceRoot":"","sources":["../../../../src/components/Button/views/b2c/ButtonB2C.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAsC9E,eAAO,MAAM,SAAS,4TAGrB,CAAC"}
|