nzk-react-components 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/icons/games.svg.js +137 -0
- package/dist/assets/icons/games.svg.js.map +1 -0
- package/dist/components/Icon/icons.d.ts +1 -0
- package/dist/components/Icon/icons.js +2 -0
- package/dist/components/Icon/icons.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/DrawingTool/DrawingTool.d.ts +0 -29
- package/dist/components/DrawingTool/DrawingTool.js +0 -277
- package/dist/components/DrawingTool/DrawingTool.js.map +0 -1
- package/dist/components/DrawingTool/DrawingTool.stories.d.ts +0 -6
- package/dist/components/DrawingTool/DrawingTool.styles.d.ts +0 -41
- package/dist/components/DrawingTool/DrawingTool.styles.js +0 -54
- package/dist/components/DrawingTool/DrawingTool.styles.js.map +0 -1
- package/dist/components/DrawingTool/DrawingToolProvider.d.ts +0 -56
- package/dist/components/DrawingTool/DrawingToolProvider.js +0 -182
- package/dist/components/DrawingTool/DrawingToolProvider.js.map +0 -1
- package/dist/components/DrawingTool/components/ColourToolbar/ColourToolbar.d.ts +0 -21
- package/dist/components/DrawingTool/components/ColourToolbar/ColourToolbar.js +0 -89
- package/dist/components/DrawingTool/components/ColourToolbar/ColourToolbar.js.map +0 -1
- package/dist/components/DrawingTool/components/ColourToolbar/ColourToolbar.styles.d.ts +0 -9
- package/dist/components/DrawingTool/components/ColourToolbar/ColourToolbar.styles.js +0 -18
- package/dist/components/DrawingTool/components/ColourToolbar/ColourToolbar.styles.js.map +0 -1
- package/dist/components/DrawingTool/components/ColourToolbar/index.d.ts +0 -2
- package/dist/components/DrawingTool/components/ColourToolbar/index.js +0 -8
- package/dist/components/DrawingTool/components/ColourToolbar/index.js.map +0 -1
- package/dist/components/DrawingTool/components/FileInput/FileInput.d.ts +0 -9
- package/dist/components/DrawingTool/components/FileInput/FileInput.js +0 -88
- package/dist/components/DrawingTool/components/FileInput/FileInput.js.map +0 -1
- package/dist/components/DrawingTool/components/FileInput/FileInput.styles.d.ts +0 -4
- package/dist/components/DrawingTool/components/FileInput/FileInput.styles.js +0 -22
- package/dist/components/DrawingTool/components/FileInput/FileInput.styles.js.map +0 -1
- package/dist/components/DrawingTool/components/FileInput/index.d.ts +0 -2
- package/dist/components/DrawingTool/components/FileInput/index.js +0 -8
- package/dist/components/DrawingTool/components/FileInput/index.js.map +0 -1
- package/dist/components/DrawingTool/components/Header/Header.d.ts +0 -9
- package/dist/components/DrawingTool/components/Header/Header.js +0 -38
- package/dist/components/DrawingTool/components/Header/Header.js.map +0 -1
- package/dist/components/DrawingTool/components/Header/index.d.ts +0 -2
- package/dist/components/DrawingTool/components/Header/index.js +0 -8
- package/dist/components/DrawingTool/components/Header/index.js.map +0 -1
- package/dist/components/DrawingTool/components/OpacityToggle/OpacityToggle.d.ts +0 -8
- package/dist/components/DrawingTool/components/OpacityToggle/OpacityToggle.js +0 -31
- package/dist/components/DrawingTool/components/OpacityToggle/OpacityToggle.js.map +0 -1
- package/dist/components/DrawingTool/components/OpacityToggle/OpacityToggle.styles.d.ts +0 -9
- package/dist/components/DrawingTool/components/OpacityToggle/OpacityToggle.styles.js +0 -18
- package/dist/components/DrawingTool/components/OpacityToggle/OpacityToggle.styles.js.map +0 -1
- package/dist/components/DrawingTool/components/OpacityToggle/index.d.ts +0 -2
- package/dist/components/DrawingTool/components/OpacityToggle/index.js +0 -8
- package/dist/components/DrawingTool/components/OpacityToggle/index.js.map +0 -1
- package/dist/components/DrawingTool/components/Placeable/index.d.ts +0 -9
- package/dist/components/DrawingTool/components/Placeable/index.js +0 -22
- package/dist/components/DrawingTool/components/Placeable/index.js.map +0 -1
- package/dist/components/DrawingTool/index.d.ts +0 -2
- package/dist/components/DrawingTool/lib/Sketch.d.ts +0 -90
- package/dist/components/DrawingTool/lib/Sketch.js +0 -414
- package/dist/components/DrawingTool/lib/Sketch.js.map +0 -1
- package/dist/components/DrawingTool/lib/SketchCut.d.ts +0 -22
- package/dist/components/DrawingTool/lib/SketchCut.js +0 -98
- package/dist/components/DrawingTool/lib/SketchCut.js.map +0 -1
- package/dist/components/DrawingTool/lib/SketchCutModel.d.ts +0 -6
- package/dist/components/DrawingTool/lib/SketchCutModel.js +0 -20
- package/dist/components/DrawingTool/lib/SketchCutModel.js.map +0 -1
- package/dist/components/DrawingTool/lib/SketchLayer.d.ts +0 -27
- package/dist/components/DrawingTool/lib/SketchLayer.js +0 -59
- package/dist/components/DrawingTool/lib/SketchLayer.js.map +0 -1
- package/dist/components/DrawingTool/lib/SketchModel.d.ts +0 -65
- package/dist/components/DrawingTool/lib/SketchModel.js +0 -137
- package/dist/components/DrawingTool/lib/SketchModel.js.map +0 -1
- package/dist/components/DrawingTool/lib/SketchStrokeModel.d.ts +0 -33
- package/dist/components/DrawingTool/lib/SketchStrokeModel.js +0 -48
- package/dist/components/DrawingTool/lib/SketchStrokeModel.js.map +0 -1
- package/dist/components/DrawingTool/lib/createInteractionSurface.d.ts +0 -16
- package/dist/components/DrawingTool/lib/createInteractionSurface.js +0 -56
- package/dist/components/DrawingTool/lib/createInteractionSurface.js.map +0 -1
- package/dist/components/DrawingTool/lib/trace.d.ts +0 -3
- package/dist/components/DrawingTool/lib/trace.js +0 -24
- package/dist/components/DrawingTool/lib/trace.js.map +0 -1
- package/dist/components/DrawingTool/lib/trimCanvas.d.ts +0 -2
- package/dist/components/DrawingTool/lib/trimCanvas.js +0 -42
- package/dist/components/DrawingTool/lib/trimCanvas.js.map +0 -1
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var tslib = require('tslib');
|
|
6
|
-
var styled = require('styled-components');
|
|
7
|
-
|
|
8
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
-
|
|
10
|
-
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
11
|
-
|
|
12
|
-
var getToolbarWidth = function (props) {
|
|
13
|
-
if (props.orientation === 'PORTRAIT')
|
|
14
|
-
return '100%';
|
|
15
|
-
return props.buttonSize + 10 + "px";
|
|
16
|
-
};
|
|
17
|
-
var getToolbarHeight = function (props) {
|
|
18
|
-
if (props.orientation === 'LANDSCAPE')
|
|
19
|
-
return '100%';
|
|
20
|
-
return props.buttonSize + 10 + "px";
|
|
21
|
-
};
|
|
22
|
-
var Container = styled__default['default'].div(templateObject_1 || (templateObject_1 = tslib.__makeTemplateObject(["\n position: relative;\n width: calc(100% - 40px);\n height: 100%;\n margin-left: auto;\n margin-right: auto;\n max-width: ", "px;\n max-height: ", "px;\n * {\n box-sizing: border-box;\n }\n"], ["\n position: relative;\n width: calc(100% - 40px);\n height: 100%;\n margin-left: auto;\n margin-right: auto;\n max-width: ", "px;\n max-height: ", "px;\n * {\n box-sizing: border-box;\n }\n"])), function (props) { return props.maxWidth; }, function (props) { return props.maxHeight; });
|
|
23
|
-
var Tool = styled__default['default'].div(templateObject_2 || (templateObject_2 = tslib.__makeTemplateObject(["\n position: absolute;\n top: ", "px;\n height: ", ";\n width: 100%;\n display: flex;\n flex-shrink: none;\n flex-direction: ", ";\n"], ["\n position: absolute;\n top: ", "px;\n height: ", ";\n width: 100%;\n display: flex;\n flex-shrink: none;\n flex-direction: ", ";\n"])), function (props) { return props.hasHeader ? props.headerHeight : 0; }, function (props) { return props.hasHeader ? "calc(100% - " + (props.headerHeight + 20) + "px)" : 'calc(100% - 20px)'; }, function (props) { return props.orientation === 'LANDSCAPE' ? 'row' : 'column'; });
|
|
24
|
-
var ButtonGroup = styled__default['default'].div(templateObject_3 || (templateObject_3 = tslib.__makeTemplateObject(["\n display: flex;\n flex-shrink: none;\n flex-wrap: wrap;\n justify-content: center;\n align-items: center;\n > div {\n user-select: none;\n margin-bottom: ", ";\n margin-right: ", ";\n }\n"], ["\n display: flex;\n flex-shrink: none;\n flex-wrap: wrap;\n justify-content: center;\n align-items: center;\n > div {\n user-select: none;\n margin-bottom: ", ";\n margin-right: ", ";\n }\n"])), function (props) { return props.orientation === 'LANDSCAPE' ? Math.floor(props.buttonSize / 5) + "px" : 0; }, function (props) { return props.orientation === 'PORTRAIT' ? Math.floor(props.buttonSize / 5) + "px" : 0; });
|
|
25
|
-
styled__default['default'].div(templateObject_4 || (templateObject_4 = tslib.__makeTemplateObject(["\n background-color: rgba(255, 255, 255, .5);\n border-radius: ", "px;\n padding-top: 8px;\n padding-bottom: 8px;\n padding-left: ", ";\n padding-right: ", ";\n display: flex;\n height: 70%;\n flex-wrap: ", ";\n justify-content: center;\n align-items: center;\n overflow: hidden;\n > div {\n margin-bottom: ", ";\n margin-right: ", ";\n }\n"], ["\n background-color: rgba(255, 255, 255, .5);\n border-radius: ", "px;\n padding-top: 8px;\n padding-bottom: 8px;\n padding-left: ", ";\n padding-right: ", ";\n display: flex;\n height: 70%;\n flex-wrap: ", ";\n justify-content: center;\n align-items: center;\n overflow: hidden;\n > div {\n margin-bottom: ", ";\n margin-right: ", ";\n }\n"])), function (props) { return props.buttonSize; }, function (props) { return props.orientation === 'PORTRAIT' ? '8px' : 0; }, function (props) { return props.orientation === 'PORTRAIT' ? '8px' : 0; }, function (props) { return props.orientation === 'LANDSCAPE' ? 'wrap' : 'no-wrap'; }, function (props) { return props.orientation === 'LANDSCAPE' ? Math.floor(props.buttonSize / 5) + "px" : 0; }, function (props) { return props.orientation === 'PORTRAIT' ? Math.floor(props.buttonSize / 5) + "px" : 0; });
|
|
26
|
-
styled__default['default'].div(templateObject_5 || (templateObject_5 = tslib.__makeTemplateObject(["\n overflow: hidden;\n"], ["\n overflow: hidden;\n"])));
|
|
27
|
-
var LeftToolbarContainer = styled__default['default'].div(templateObject_6 || (templateObject_6 = tslib.__makeTemplateObject(["\n position: relative;\n pointer-events: ", ";\n opacity: ", ";\n filter: ", ";\n width: ", ";\n height: ", ";\n order: ", ";\n display: flex;\n flex-direction: ", ";\n justify-content: space-between;\n align-items: center;\n"], ["\n position: relative;\n pointer-events: ", ";\n opacity: ", ";\n filter: ", ";\n width: ", ";\n height: ", ";\n order: ", ";\n display: flex;\n flex-direction: ", ";\n justify-content: space-between;\n align-items: center;\n"])), function (props) { return props.disabled ? 'none' : 'all'; }, function (props) { return props.disabled ? 0.5 : 1; }, function (props) { return props.disabled ? 'grayscale(100%)' : 'none'; }, function (props) { return getToolbarWidth(props); }, function (props) { return getToolbarHeight(props); }, function (props) { return props.orientation === 'LANDSCAPE' ? 1 : 2; }, function (props) { return props.orientation === 'LANDSCAPE' ? 'column' : 'row'; });
|
|
28
|
-
var RightToolbarContainer = styled__default['default'].div(templateObject_7 || (templateObject_7 = tslib.__makeTemplateObject(["\n position: relative;\n width: ", ";\n max-height: ", ";\n opacity: ", ";\n pointer-events: ", ";\n filter: ", ";\n order: 3;\n justify-content: space-between;\n display: flex;\n flex-direction: ", ";\n margin-top: ", ";\n align-items: center;\n"], ["\n position: relative;\n width: ", ";\n max-height: ", ";\n opacity: ", ";\n pointer-events: ", ";\n filter: ", ";\n order: 3;\n justify-content: space-between;\n display: flex;\n flex-direction: ", ";\n margin-top: ", ";\n align-items: center;\n"])), function (props) { return getToolbarWidth(props); }, function (props) { return getToolbarHeight(props); }, function (props) { return props.disabled ? 0.5 : 1; }, function (props) { return props.disabled ? 'none' : 'all'; }, function (props) { return props.disabled ? 'grayscale(100%)' : 'none'; }, function (props) { return props.orientation === 'LANDSCAPE' ? 'column' : 'row'; }, function (props) { return props.orientation === 'PORTRAIT' ? '10px' : '0px'; });
|
|
29
|
-
var SketchContainer = styled__default['default'].div(templateObject_8 || (templateObject_8 = tslib.__makeTemplateObject(["\n position: relative;\n flex: 1 1 auto;\n margin-left: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n order: ", ";\n\n .moveable-rotation .moveable-control.moveable-rotation-control {\n border: none !important;\n width: 24px !important;\n height: 24px !important;\n margin-top: -12px !important;\n margin-left: -12px !important;\n cursor: alias;\n opacity: 0;\n }\n\n .moveable-control {\n width: 24px !important;\n height: 24px !important;\n margin-top: -12px !important;\n margin-left: -12px !important;\n border: none !important;\n }\n\n .moveable-line.moveable-rotation-line {\n width: 4px !important;\n height: 40px !important;\n margin-left: -1px;\n }\n\n .moveable-line {\n height: 4px !important;\n }\n\n .moveable-origin {\n display: none !important;\n }\n}"], ["\n position: relative;\n flex: 1 1 auto;\n margin-left: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n order: ", ";\n\n .moveable-rotation .moveable-control.moveable-rotation-control {\n border: none !important;\n width: 24px !important;\n height: 24px !important;\n margin-top: -12px !important;\n margin-left: -12px !important;\n cursor: alias;\n opacity: 0;\n }\n\n .moveable-control {\n width: 24px !important;\n height: 24px !important;\n margin-top: -12px !important;\n margin-left: -12px !important;\n border: none !important;\n }\n\n .moveable-line.moveable-rotation-line {\n width: 4px !important;\n height: 40px !important;\n margin-left: -1px;\n }\n\n .moveable-line {\n height: 4px !important;\n }\n\n .moveable-origin {\n display: none !important;\n }\n}"])), function (props) { return props.orientation === 'LANDSCAPE' ? '10px' : '0px'; }, function (props) { return props.orientation === 'LANDSCAPE' ? '20px' : '0px'; }, function (props) { return props.orientation === 'LANDSCAPE' ? '0px' : '10px'; }, function (props) { return props.orientation === 'LANDSCAPE' ? 2 : 1; });
|
|
30
|
-
var PaperBackground = styled__default['default'].div(templateObject_9 || (templateObject_9 = tslib.__makeTemplateObject(["\n position: absolute;\n top: 0px;\n left: 0px;\n width: 100%;\n height: 100%;\n box-shadow: 0px 4px 0px #C7C7C6;\n background: ", ";\n\n &:before, &:after {\n z-index: -1;\n position: absolute;\n content: \"\";\n bottom: 7px;\n left: 10px;\n width: 50%;\n top: 80%;\n max-width: 300px;\n background: rgba(0,0,0,.3);\n box-shadow: 0 15px 0px rgba(0,0,0,.3);\n transform: rotate(-3deg);\n }\n &:after {\n transform: rotate(3deg);\n right: 10px;\n left: auto;\n }\n"], ["\n position: absolute;\n top: 0px;\n left: 0px;\n width: 100%;\n height: 100%;\n box-shadow: 0px 4px 0px #C7C7C6;\n background: ", ";\n\n &:before, &:after {\n z-index: -1;\n position: absolute;\n content: \"\";\n bottom: 7px;\n left: 10px;\n width: 50%;\n top: 80%;\n max-width: 300px;\n background: rgba(0,0,0,.3);\n box-shadow: 0 15px 0px rgba(0,0,0,.3);\n transform: rotate(-3deg);\n }\n &:after {\n transform: rotate(3deg);\n right: 10px;\n left: auto;\n }\n"])), function (props) { return props.cutMode
|
|
31
|
-
? 'repeating-linear-gradient(-45deg, #ebebeb, #ebebeb 20px, #dfdfdf 20px, #dfdfdf 40px)'
|
|
32
|
-
: '#ebebeb'; });
|
|
33
|
-
var InSketchActions = styled__default['default'].div(templateObject_10 || (templateObject_10 = tslib.__makeTemplateObject(["\n position: absolute;\n width: 100%;\n bottom: 20px;\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 102;\n @media (max-width: 768px) {\n bottom: 10px;\n }\n @media (max-height: 500px) {\n bottom: 10px;\n }\n"], ["\n position: absolute;\n width: 100%;\n bottom: 20px;\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 102;\n @media (max-width: 768px) {\n bottom: 10px;\n }\n @media (max-height: 500px) {\n bottom: 10px;\n }\n"])));
|
|
34
|
-
var InSketchAction = styled__default['default'].div(templateObject_11 || (templateObject_11 = tslib.__makeTemplateObject(["\n position: relative;\n margin-right: 20px;\n"], ["\n position: relative;\n margin-right: 20px;\n"])));
|
|
35
|
-
var ModalOverlay = styled__default['default'].div(templateObject_12 || (templateObject_12 = tslib.__makeTemplateObject(["\n position: absolute;\n top: 0px;\n left: 0px;\n width: 100%;\n height: 100%;\n z-index: 100;\n display: flex;\n justify-content: center;\n align-items: center;\n"], ["\n position: absolute;\n top: 0px;\n left: 0px;\n width: 100%;\n height: 100%;\n z-index: 100;\n display: flex;\n justify-content: center;\n align-items: center;\n"])));
|
|
36
|
-
var ImageToPlaceContainer = styled__default['default'].div(templateObject_13 || (templateObject_13 = tslib.__makeTemplateObject(["\n position: absolute;\n left: 0;\n top: 0;\n z-index: 101;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n}"], ["\n position: absolute;\n left: 0;\n top: 0;\n z-index: 101;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n}"])));
|
|
37
|
-
var ImageToPlace = styled__default['default'].img(templateObject_14 || (templateObject_14 = tslib.__makeTemplateObject(["\n position: absolute;\n width: 80%;\n max-width: 400px;\n @media (max-width: 768px) {\n max-width: 200px;\n }\n @media (max-height: 600px) {\n width: auto;\n height: 80%;\n max-width: none;\n max-height: 200px;\n }\n}\n"], ["\n position: absolute;\n width: 80%;\n max-width: 400px;\n @media (max-width: 768px) {\n max-width: 200px;\n }\n @media (max-height: 600px) {\n width: auto;\n height: 80%;\n max-width: none;\n max-height: 200px;\n }\n}\n"])));
|
|
38
|
-
var CutImageTutorial = styled__default['default'].div(templateObject_15 || (templateObject_15 = tslib.__makeTemplateObject(["\n position: absolute;\n display: flex;\n flex-wrap: wrap;\n justify-content: center;\n align-items: center;\n left: 50%;\n top: 50%;\n width: 90%;\n height: 90%;\n transform: translate(-50%, -50%);\n max-width: 800px;\n max-height: 600px;\n background-color: white;\n z-index: 101;\n border-radius: 50px;\n padding: 40px;\n background-color: #341644;\n box-shadow: 0 -5px 0 #531D75, 0 10px 0 #1C042B, 0 14px 0 rgba(0,0,0,0.3);\n box-sizing: border-box;\n color: white;\n font-size: 30px;\n text-align: center;\n\n @media (max-width: 960px) {\n font-size: 24px;\n }\n\n @media (max-width: 760px), (max-height: 600px) {\n font-size: 16px;\n width: 95%;\n padding: 30px;\n }\n\n img {\n width: 100%;\n max-width: 350px;\n @media (max-width: 960px) {\n max-width: 250px;\n }\n @media (max-width: 760px), (max-height: 600px) {\n max-width: 120px;\n }\n }\n > :last-child {\n width: 100%;\n display: flex;\n justify-content: center;\n }\n\n"], ["\n position: absolute;\n display: flex;\n flex-wrap: wrap;\n justify-content: center;\n align-items: center;\n left: 50%;\n top: 50%;\n width: 90%;\n height: 90%;\n transform: translate(-50%, -50%);\n max-width: 800px;\n max-height: 600px;\n background-color: white;\n z-index: 101;\n border-radius: 50px;\n padding: 40px;\n background-color: #341644;\n box-shadow: 0 -5px 0 #531D75, 0 10px 0 #1C042B, 0 14px 0 rgba(0,0,0,0.3);\n box-sizing: border-box;\n color: white;\n font-size: 30px;\n text-align: center;\n\n @media (max-width: 960px) {\n font-size: 24px;\n }\n\n @media (max-width: 760px), (max-height: 600px) {\n font-size: 16px;\n width: 95%;\n padding: 30px;\n }\n\n img {\n width: 100%;\n max-width: 350px;\n @media (max-width: 960px) {\n max-width: 250px;\n }\n @media (max-width: 760px), (max-height: 600px) {\n max-width: 120px;\n }\n }\n > :last-child {\n width: 100%;\n display: flex;\n justify-content: center;\n }\n\n"])));
|
|
39
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15;
|
|
40
|
-
|
|
41
|
-
exports.ButtonGroup = ButtonGroup;
|
|
42
|
-
exports.Container = Container;
|
|
43
|
-
exports.CutImageTutorial = CutImageTutorial;
|
|
44
|
-
exports.ImageToPlace = ImageToPlace;
|
|
45
|
-
exports.ImageToPlaceContainer = ImageToPlaceContainer;
|
|
46
|
-
exports.InSketchAction = InSketchAction;
|
|
47
|
-
exports.InSketchActions = InSketchActions;
|
|
48
|
-
exports.LeftToolbarContainer = LeftToolbarContainer;
|
|
49
|
-
exports.ModalOverlay = ModalOverlay;
|
|
50
|
-
exports.PaperBackground = PaperBackground;
|
|
51
|
-
exports.RightToolbarContainer = RightToolbarContainer;
|
|
52
|
-
exports.SketchContainer = SketchContainer;
|
|
53
|
-
exports.Tool = Tool;
|
|
54
|
-
//# sourceMappingURL=DrawingTool.styles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DrawingTool.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { SketchActionMergeData } from './lib/SketchModel';
|
|
3
|
-
export declare const BrushSize: {
|
|
4
|
-
small: number;
|
|
5
|
-
medium: number;
|
|
6
|
-
large: number;
|
|
7
|
-
};
|
|
8
|
-
export declare type BrushType = 'fill' | 'line' | 'eraser';
|
|
9
|
-
export declare const Colours: {
|
|
10
|
-
rgb: number[];
|
|
11
|
-
hex: string;
|
|
12
|
-
}[];
|
|
13
|
-
export interface Colour {
|
|
14
|
-
rgb: number[];
|
|
15
|
-
hex: string;
|
|
16
|
-
}
|
|
17
|
-
declare type ToolMode = 'LOADING' | 'DRAW' | 'CUT' | 'PLACE';
|
|
18
|
-
export interface Props {
|
|
19
|
-
cache?: string;
|
|
20
|
-
}
|
|
21
|
-
export declare const DrawingToolProvider: import("react").ComponentType<import("unstated-next").ContainerProviderProps<Props>>;
|
|
22
|
-
export declare const useDrawingTool: () => {
|
|
23
|
-
initSketch: (containerEl: any) => void;
|
|
24
|
-
initSketchCut: (containerEl: any, imageToCut: HTMLImageElement, onImageCut: () => void) => void;
|
|
25
|
-
exportSketch: (options?: {
|
|
26
|
-
crop: boolean;
|
|
27
|
-
}) => string;
|
|
28
|
-
exportSketchCut: () => string;
|
|
29
|
-
currentColour: {
|
|
30
|
-
rgb: number[];
|
|
31
|
-
hex: string;
|
|
32
|
-
};
|
|
33
|
-
setCurrentColour: import("react").Dispatch<import("react").SetStateAction<{
|
|
34
|
-
rgb: number[];
|
|
35
|
-
hex: string;
|
|
36
|
-
}>>;
|
|
37
|
-
brushOpacity: number;
|
|
38
|
-
setBruchOpacity: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
39
|
-
brushSize: number;
|
|
40
|
-
setBrushSize: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
41
|
-
brushType: string;
|
|
42
|
-
setBrushType: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
43
|
-
undo: () => void;
|
|
44
|
-
redo: () => void;
|
|
45
|
-
restart: () => void;
|
|
46
|
-
onSketchChange: () => void;
|
|
47
|
-
setCacheKey: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
48
|
-
setAutoCache: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
49
|
-
clearCache: () => void;
|
|
50
|
-
resetCut: () => void;
|
|
51
|
-
mergeImage: (data: SketchActionMergeData) => void | null;
|
|
52
|
-
setToolMode: import("react").Dispatch<import("react").SetStateAction<ToolMode>>;
|
|
53
|
-
toolMode: ToolMode;
|
|
54
|
-
exportCache: () => string | null;
|
|
55
|
-
};
|
|
56
|
-
export {};
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var React = require('react');
|
|
6
|
-
var unstatedNext = require('unstated-next');
|
|
7
|
-
var Sketch = require('./lib/Sketch.js');
|
|
8
|
-
var SketchCut = require('./lib/SketchCut.js');
|
|
9
|
-
|
|
10
|
-
var BrushSize = {
|
|
11
|
-
small: 7,
|
|
12
|
-
medium: 21,
|
|
13
|
-
large: 42
|
|
14
|
-
};
|
|
15
|
-
var Colours = [
|
|
16
|
-
{ rgb: [53, 162, 218], hex: '#35a2da' },
|
|
17
|
-
{ rgb: [0, 156, 149], hex: '#009c95' },
|
|
18
|
-
{ rgb: [0, 137, 54], hex: '#008936' },
|
|
19
|
-
{ rgb: [147, 192, 31], hex: '#93c01f' },
|
|
20
|
-
{ rgb: [201, 216, 0], hex: '#c9d800' },
|
|
21
|
-
{ rgb: [255, 236, 0], hex: '#ffec00' },
|
|
22
|
-
{ rgb: [255, 145, 0], hex: '#ff9100' },
|
|
23
|
-
{ rgb: [255, 0, 25], hex: '#ff0019' },
|
|
24
|
-
{ rgb: [255, 0, 164], hex: '#ff00a4' },
|
|
25
|
-
{ rgb: [186, 13, 108], hex: '#ba0d6c' },
|
|
26
|
-
{ rgb: [135, 0, 198], hex: '#8700c6' },
|
|
27
|
-
{ rgb: [104, 59, 17], hex: '#683b11' },
|
|
28
|
-
{ rgb: [29, 29, 27], hex: '#1d1d1b' },
|
|
29
|
-
{ rgb: [134, 134, 134], hex: '#868686' },
|
|
30
|
-
{ rgb: [255, 255, 255], hex: '#FFFFFF' },
|
|
31
|
-
];
|
|
32
|
-
var DrawingToolState = function (props) {
|
|
33
|
-
var sketchRef = React.useRef();
|
|
34
|
-
var sketchCutRef = React.useRef();
|
|
35
|
-
var _a = React.useState(true), autoCache = _a[0], setAutoCache = _a[1];
|
|
36
|
-
var _b = React.useState('nzk-sketch-cache'), cacheKey = _b[0], setCacheKey = _b[1];
|
|
37
|
-
var _c = React.useState(BrushSize.small), brushSize = _c[0], setBrushSize = _c[1];
|
|
38
|
-
var _d = React.useState('line'), brushType = _d[0], setBrushType = _d[1];
|
|
39
|
-
var _e = React.useState(Colours[0]), currentColour = _e[0], setCurrentColour = _e[1];
|
|
40
|
-
var _f = React.useState(1), brushOpacity = _f[0], setBruchOpacity = _f[1];
|
|
41
|
-
var _g = React.useState('LOADING'), toolMode = _g[0], setToolMode = _g[1];
|
|
42
|
-
var setSketchRef = React.useCallback(function (node) {
|
|
43
|
-
sketchRef.current = node;
|
|
44
|
-
if (sketchRef.current) {
|
|
45
|
-
sketchRef.current.setBrush({
|
|
46
|
-
size: brushSize,
|
|
47
|
-
colour: currentColour.rgb,
|
|
48
|
-
opacity: brushOpacity,
|
|
49
|
-
fill: brushType === 'fill',
|
|
50
|
-
eraser: brushType === 'eraser'
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}, []);
|
|
54
|
-
var setSketchCutRef = React.useCallback(function (node) {
|
|
55
|
-
sketchCutRef.current = node;
|
|
56
|
-
}, []);
|
|
57
|
-
React.useEffect(function () {
|
|
58
|
-
if (sketchRef && sketchRef.current)
|
|
59
|
-
sketchRef.current.setBrush({
|
|
60
|
-
size: brushSize,
|
|
61
|
-
colour: currentColour.rgb,
|
|
62
|
-
opacity: brushType === 'eraser' ? 1 : brushOpacity,
|
|
63
|
-
fill: brushType === 'fill',
|
|
64
|
-
eraser: brushType === 'eraser'
|
|
65
|
-
});
|
|
66
|
-
}, [sketchRef.current, brushSize, currentColour, brushOpacity, brushType]);
|
|
67
|
-
var onSketchChange = function () {
|
|
68
|
-
if (!autoCache || !sketchRef.current)
|
|
69
|
-
return;
|
|
70
|
-
window.localStorage.setItem(cacheKey, JSON.stringify(sketchRef.current.serialize()));
|
|
71
|
-
};
|
|
72
|
-
var clearCache = function () {
|
|
73
|
-
window.localStorage.removeItem(cacheKey);
|
|
74
|
-
};
|
|
75
|
-
var getCache = function () {
|
|
76
|
-
return (props && props.cache) || window.localStorage.getItem(cacheKey);
|
|
77
|
-
};
|
|
78
|
-
var initSketch = function (containerEl) {
|
|
79
|
-
var data;
|
|
80
|
-
if (sketchRef.current) {
|
|
81
|
-
data = sketchRef.current.serialize();
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
var cachedRawData = getCache();
|
|
85
|
-
if (cachedRawData) {
|
|
86
|
-
data = JSON.parse(cachedRawData);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
setSketchRef(new Sketch({
|
|
90
|
-
containerEl: containerEl,
|
|
91
|
-
sketchData: data,
|
|
92
|
-
onChange: onSketchChange,
|
|
93
|
-
onReady: function () {
|
|
94
|
-
setToolMode('DRAW');
|
|
95
|
-
}
|
|
96
|
-
}));
|
|
97
|
-
};
|
|
98
|
-
var initSketchCut = function (containerEl, imageToCut, onImageCut) {
|
|
99
|
-
setSketchCutRef(new SketchCut({
|
|
100
|
-
containerEl: containerEl,
|
|
101
|
-
imageToCut: imageToCut,
|
|
102
|
-
onImageCut: onImageCut
|
|
103
|
-
}));
|
|
104
|
-
};
|
|
105
|
-
var resetCut = function () {
|
|
106
|
-
if (sketchCutRef && sketchCutRef.current) {
|
|
107
|
-
sketchCutRef.current.resetCut();
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
var exportSketch = function (options) {
|
|
111
|
-
if (options === void 0) { options = { crop: true }; }
|
|
112
|
-
if (sketchRef.current) {
|
|
113
|
-
return sketchRef.current.export(options);
|
|
114
|
-
}
|
|
115
|
-
return '';
|
|
116
|
-
};
|
|
117
|
-
var exportSketchCut = function () {
|
|
118
|
-
if (sketchCutRef.current) {
|
|
119
|
-
return sketchCutRef.current.export({ crop: true });
|
|
120
|
-
}
|
|
121
|
-
return '';
|
|
122
|
-
};
|
|
123
|
-
var exportCache = function () {
|
|
124
|
-
if (sketchRef.current) {
|
|
125
|
-
return JSON.stringify(sketchRef.current.serialize());
|
|
126
|
-
}
|
|
127
|
-
return null;
|
|
128
|
-
};
|
|
129
|
-
var mergeImage = function (data) {
|
|
130
|
-
if (sketchRef.current) {
|
|
131
|
-
return sketchRef.current.mergeImage(data);
|
|
132
|
-
}
|
|
133
|
-
return null;
|
|
134
|
-
};
|
|
135
|
-
var undo = function () {
|
|
136
|
-
if (sketchRef.current)
|
|
137
|
-
sketchRef.current.undo();
|
|
138
|
-
};
|
|
139
|
-
var redo = function () {
|
|
140
|
-
if (sketchRef.current)
|
|
141
|
-
sketchRef.current.redo();
|
|
142
|
-
};
|
|
143
|
-
var restart = function () {
|
|
144
|
-
if (sketchRef.current)
|
|
145
|
-
sketchRef.current.restart();
|
|
146
|
-
};
|
|
147
|
-
return {
|
|
148
|
-
initSketch: initSketch,
|
|
149
|
-
initSketchCut: initSketchCut,
|
|
150
|
-
exportSketch: exportSketch,
|
|
151
|
-
exportSketchCut: exportSketchCut,
|
|
152
|
-
currentColour: currentColour,
|
|
153
|
-
setCurrentColour: setCurrentColour,
|
|
154
|
-
brushOpacity: brushOpacity,
|
|
155
|
-
setBruchOpacity: setBruchOpacity,
|
|
156
|
-
brushSize: brushSize,
|
|
157
|
-
setBrushSize: setBrushSize,
|
|
158
|
-
brushType: brushType,
|
|
159
|
-
setBrushType: setBrushType,
|
|
160
|
-
undo: undo,
|
|
161
|
-
redo: redo,
|
|
162
|
-
restart: restart,
|
|
163
|
-
onSketchChange: onSketchChange,
|
|
164
|
-
setCacheKey: setCacheKey,
|
|
165
|
-
setAutoCache: setAutoCache,
|
|
166
|
-
clearCache: clearCache,
|
|
167
|
-
resetCut: resetCut,
|
|
168
|
-
mergeImage: mergeImage,
|
|
169
|
-
setToolMode: setToolMode,
|
|
170
|
-
toolMode: toolMode,
|
|
171
|
-
exportCache: exportCache
|
|
172
|
-
};
|
|
173
|
-
};
|
|
174
|
-
var DrawingToolProviderContainer = unstatedNext.createContainer(DrawingToolState);
|
|
175
|
-
var DrawingToolProvider = DrawingToolProviderContainer.Provider;
|
|
176
|
-
var useDrawingTool = DrawingToolProviderContainer.useContainer;
|
|
177
|
-
|
|
178
|
-
exports.BrushSize = BrushSize;
|
|
179
|
-
exports.Colours = Colours;
|
|
180
|
-
exports.DrawingToolProvider = DrawingToolProvider;
|
|
181
|
-
exports.useDrawingTool = useDrawingTool;
|
|
182
|
-
//# sourceMappingURL=DrawingToolProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DrawingToolProvider.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { Orientation } from '../../DrawingTool';
|
|
3
|
-
import { Colour } from '../../DrawingToolProvider';
|
|
4
|
-
export interface Props {
|
|
5
|
-
size: number;
|
|
6
|
-
orientation: Orientation;
|
|
7
|
-
currentColour: Colour;
|
|
8
|
-
}
|
|
9
|
-
declare const ColourToolbar: {
|
|
10
|
-
(props: Props): JSX.Element;
|
|
11
|
-
defaultProps: {
|
|
12
|
-
mode: string;
|
|
13
|
-
size: number;
|
|
14
|
-
onSelectColour: () => void;
|
|
15
|
-
currentColor: {
|
|
16
|
-
rgb: number[];
|
|
17
|
-
hex: string;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
export default ColourToolbar;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var React = require('react');
|
|
4
|
-
var ColourToolbar_styles = require('./ColourToolbar.styles.js');
|
|
5
|
-
var Button = require('../../../Button/Button.js');
|
|
6
|
-
var Icon = require('../../../Icon/Icon.js');
|
|
7
|
-
var DrawingToolProvider = require('../../DrawingToolProvider.js');
|
|
8
|
-
|
|
9
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
-
|
|
11
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
12
|
-
|
|
13
|
-
var ColourToolbar = function (props) {
|
|
14
|
-
var scrollRef = React.useRef(null);
|
|
15
|
-
var _a = React.useState(true), disableScrollUp = _a[0], setDisableScrollUp = _a[1];
|
|
16
|
-
var _b = React.useState(false), disableScrollDown = _b[0], setDisableScrollDown = _b[1];
|
|
17
|
-
var _c = DrawingToolProvider.useDrawingTool(), setCurrentColour = _c.setCurrentColour, brushType = _c.brushType, setBrushType = _c.setBrushType;
|
|
18
|
-
var onSetColour = function (colour) {
|
|
19
|
-
if (brushType === 'eraser') {
|
|
20
|
-
setBrushType('line');
|
|
21
|
-
}
|
|
22
|
-
setCurrentColour(colour);
|
|
23
|
-
};
|
|
24
|
-
var onScroll = function (e) {
|
|
25
|
-
if (props.orientation === 'LANDSCAPE') {
|
|
26
|
-
if (e.target.scrollTop === 0) {
|
|
27
|
-
setDisableScrollUp(true);
|
|
28
|
-
}
|
|
29
|
-
else if (disableScrollUp) {
|
|
30
|
-
setDisableScrollUp(false);
|
|
31
|
-
}
|
|
32
|
-
if ((e.target.scrollHeight - e.target.scrollTop) <= e.target.clientHeight + 3) {
|
|
33
|
-
setDisableScrollDown(true);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
setDisableScrollDown(false);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
if (e.target.scrollLeft === 0) {
|
|
41
|
-
setDisableScrollUp(true);
|
|
42
|
-
}
|
|
43
|
-
else if (disableScrollUp) {
|
|
44
|
-
setDisableScrollUp(false);
|
|
45
|
-
}
|
|
46
|
-
if ((e.target.scrollWidth - e.target.scrollLeft) <= e.target.clientWidth + 3) {
|
|
47
|
-
setDisableScrollDown(true);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
setDisableScrollDown(false);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
var onClickUp = function () {
|
|
55
|
-
if (!disableScrollUp && scrollRef && scrollRef.current) {
|
|
56
|
-
if (props.orientation === 'LANDSCAPE') {
|
|
57
|
-
scrollRef.current.scrollTop = Math.max(0, scrollRef.current.scrollTop - props.size * 3);
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
scrollRef.current.scrollLeft = Math.max(0, scrollRef.current.scrollLeft - props.size * 3);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
var onClickDown = function () {
|
|
65
|
-
if (!disableScrollDown && scrollRef && scrollRef.current) {
|
|
66
|
-
if (props.orientation === 'LANDSCAPE') {
|
|
67
|
-
scrollRef.current.scrollTop = Math.min(scrollRef.current.scrollHeight, scrollRef.current.scrollTop + props.size * 3);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
scrollRef.current.scrollLeft = Math.min(scrollRef.current.scrollWidth, scrollRef.current.scrollLeft + props.size * 3);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
return React__default['default'].createElement(ColourToolbar_styles.Container, { orientation: props.orientation, size: props.size },
|
|
75
|
-
React__default['default'].createElement(Button, { disabled: disableScrollUp, round: true, height: props.size, theme: "white", onClick: onClickUp },
|
|
76
|
-
React__default['default'].createElement(Icon, { name: props.orientation === 'LANDSCAPE' ? 'drawing-tool-arrow-up' : 'drawing-tool-arrow-left', fill: disableScrollUp ? '#c2bebe' : props.currentColour.hex })),
|
|
77
|
-
React__default['default'].createElement(ColourToolbar_styles.ScrollContainer, { ref: scrollRef, onScroll: onScroll, orientation: props.orientation, size: props.size }, DrawingToolProvider.Colours.map(function (c) { return (React__default['default'].createElement(Button, { key: c.hex, height: Math.floor(props.size * .9), round: true, dropShadowColor: "transparent", backgroundColor: c.hex, strokeColor: c.hex, onClick: function () { return onSetColour(c); } })); })),
|
|
78
|
-
React__default['default'].createElement(Button, { disabled: disableScrollDown, round: true, height: props.size, theme: "white", onClick: onClickDown },
|
|
79
|
-
React__default['default'].createElement(Icon, { name: props.orientation === 'LANDSCAPE' ? 'drawing-tool-arrow-down' : 'drawing-tool-arrow-right', fill: disableScrollDown ? '#c2bebe' : props.currentColour.hex })));
|
|
80
|
-
};
|
|
81
|
-
ColourToolbar.defaultProps = {
|
|
82
|
-
mode: 'landcape',
|
|
83
|
-
size: 80,
|
|
84
|
-
onSelectColour: function () { },
|
|
85
|
-
currentColor: DrawingToolProvider.Colours[0]
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
module.exports = ColourToolbar;
|
|
89
|
-
//# sourceMappingURL=ColourToolbar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ColourToolbar.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Orientation } from '../../DrawingTool';
|
|
2
|
-
export declare const Container: import("styled-components").StyledComponent<"div", any, {
|
|
3
|
-
orientation: Orientation;
|
|
4
|
-
size: number;
|
|
5
|
-
}, never>;
|
|
6
|
-
export declare const ScrollContainer: import("styled-components").StyledComponent<"div", any, {
|
|
7
|
-
orientation: Orientation;
|
|
8
|
-
size: number;
|
|
9
|
-
}, never>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var tslib = require('tslib');
|
|
6
|
-
var styled = require('styled-components');
|
|
7
|
-
|
|
8
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
-
|
|
10
|
-
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
11
|
-
|
|
12
|
-
var Container = styled__default['default'].div(templateObject_1 || (templateObject_1 = tslib.__makeTemplateObject(["\n display: flex;\n justify-content: center;\n align-items: center;\n align-content: flex-start;\n flex-wrap: ", ";\n height: ", ";\n width: ", ";\n"], ["\n display: flex;\n justify-content: center;\n align-items: center;\n align-content: flex-start;\n flex-wrap: ", ";\n height: ", ";\n width: ", ";\n"])), function (props) { return props.orientation === 'LANDSCAPE' ? 'wrap' : 'no-wrap'; }, function (props) { return props.orientation === 'PORTRAIT' ? 'auto' : '80%'; }, function (props) { return props.orientation === 'PORTRAIT' ? '80%' : 'auto'; });
|
|
13
|
-
var ScrollContainer = styled__default['default'].div(templateObject_2 || (templateObject_2 = tslib.__makeTemplateObject(["\n height: ", ";\n background-color: rgba(255, 255, 255, .5);\n border-radius: ", "px;\n padding-top: 8px;\n padding-bottom: 8px;\n padding-left: ", ";\n padding-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n margin-right: ", ";\n position: relative;\n flex: 1 1 auto;\n display: flex;\n flex-wrap: ", ";\n justify-content: ", ";;\n align-items: center;\n -ms-overflow-style: none;\n scrollbar-width: none;\n overflow: scroll;\n scroll-behavior: smooth;\n &::-webkit-scrollbar {\n display: none;\n }\n > div {\n margin-bottom: ", ";\n margin-right: ", ";\n }\n"], ["\n height: ", ";\n background-color: rgba(255, 255, 255, .5);\n border-radius: ", "px;\n padding-top: 8px;\n padding-bottom: 8px;\n padding-left: ", ";\n padding-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n margin-right: ", ";\n position: relative;\n flex: 1 1 auto;\n display: flex;\n flex-wrap: ", ";\n justify-content: ", ";;\n align-items: center;\n -ms-overflow-style: none;\n scrollbar-width: none;\n overflow: scroll;\n scroll-behavior: smooth;\n &::-webkit-scrollbar {\n display: none;\n }\n > div {\n margin-bottom: ", ";\n margin-right: ", ";\n }\n"])), function (props) { return "calc(100% - " + 3.5 * props.size + "px)"; }, function (props) { return props.size; }, function (props) { return props.orientation === 'PORTRAIT' ? '8px' : 0; }, function (props) { return props.orientation === 'PORTRAIT' ? '8px' : 0; }, function (props) { return props.orientation === 'PORTRAIT' ? '0px' : '7px'; }, function (props) { return props.orientation === 'PORTRAIT' ? '7px' : '0px'; }, function (props) { return props.orientation === 'PORTRAIT' ? '7px' : '0px'; }, function (props) { return props.orientation === 'LANDSCAPE' ? 'wrap' : 'no-wrap'; }, function (props) { return props.orientation === 'LANDSCAPE' ? 'center' : 'flex-start'; }, function (props) { return props.orientation === 'LANDSCAPE' ? Math.floor(props.size / 5) + "px" : 0; }, function (props) { return props.orientation === 'PORTRAIT' ? Math.floor(props.size / 5) + "px" : 0; });
|
|
14
|
-
var templateObject_1, templateObject_2;
|
|
15
|
-
|
|
16
|
-
exports.Container = Container;
|
|
17
|
-
exports.ScrollContainer = ScrollContainer;
|
|
18
|
-
//# sourceMappingURL=ColourToolbar.styles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ColourToolbar.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export interface Props {
|
|
3
|
-
dismiss?: () => void;
|
|
4
|
-
onImageUploaded?: (image: HTMLImageElement) => void;
|
|
5
|
-
minImageSize?: number;
|
|
6
|
-
isMobile: boolean;
|
|
7
|
-
}
|
|
8
|
-
declare const _default: (props: Props) => JSX.Element;
|
|
9
|
-
export default _default;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var tslib = require('tslib');
|
|
4
|
-
var React = require('react');
|
|
5
|
-
var reactDropzone = require('react-dropzone');
|
|
6
|
-
var FileInput_styles = require('./FileInput.styles.js');
|
|
7
|
-
var Button = require('../../../Button/Button.js');
|
|
8
|
-
var Icon = require('../../../Icon/Icon.js');
|
|
9
|
-
|
|
10
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
|
-
|
|
12
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
13
|
-
|
|
14
|
-
var bytesForHuman = function (bytes) {
|
|
15
|
-
var bytes$ = bytes;
|
|
16
|
-
var units = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB'];
|
|
17
|
-
var i = 0;
|
|
18
|
-
for (i; bytes$ > 1024; i += 1) {
|
|
19
|
-
bytes$ /= 1024;
|
|
20
|
-
}
|
|
21
|
-
return "" + parseFloat(bytes$.toFixed(1)) + units[i];
|
|
22
|
-
};
|
|
23
|
-
var FileInput = (function (props) {
|
|
24
|
-
function fileSizeValidator(file) {
|
|
25
|
-
var minSize = props.minImageSize || 1024 * 10;
|
|
26
|
-
if (file.size < minSize) {
|
|
27
|
-
return {
|
|
28
|
-
code: "image-to-small",
|
|
29
|
-
message: "This image is too small. Please pick an image over " + bytesForHuman(minSize)
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
var _a = reactDropzone.useDropzone({
|
|
35
|
-
accept: 'image/jpeg, image/png',
|
|
36
|
-
maxFiles: 1,
|
|
37
|
-
validator: fileSizeValidator
|
|
38
|
-
}), acceptedFiles = _a.acceptedFiles, fileRejections = _a.fileRejections, getRootProps = _a.getRootProps, getInputProps = _a.getInputProps, isDragActive = _a.isDragActive;
|
|
39
|
-
var _b = React.useState(true), supportDragAndDrop = _b[0], setSupportDragAndDrop = _b[1];
|
|
40
|
-
React.useEffect(function () {
|
|
41
|
-
if ('draggable' in document.createElement('span')) {
|
|
42
|
-
setSupportDragAndDrop(true);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
setSupportDragAndDrop(false);
|
|
46
|
-
}
|
|
47
|
-
}, []);
|
|
48
|
-
React.useEffect(function () {
|
|
49
|
-
if (acceptedFiles && acceptedFiles.length) {
|
|
50
|
-
var img_1 = new Image();
|
|
51
|
-
img_1.onload = function () {
|
|
52
|
-
if (props.onImageUploaded) {
|
|
53
|
-
props.onImageUploaded(img_1);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
var reader = new FileReader();
|
|
57
|
-
reader.readAsDataURL(acceptedFiles[0]);
|
|
58
|
-
reader.onloadend = function (e) {
|
|
59
|
-
if (e.target) {
|
|
60
|
-
img_1.src = e.target.result;
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
}, [acceptedFiles]);
|
|
65
|
-
var ErrorMessage = fileRejections && fileRejections.length
|
|
66
|
-
? React__default['default'].createElement(FileInput_styles.ErrorMessage, null, fileRejections[0].errors[0].message)
|
|
67
|
-
: null;
|
|
68
|
-
var onDismiss = function (ev) {
|
|
69
|
-
ev.stopPropagation();
|
|
70
|
-
if (props.dismiss)
|
|
71
|
-
props.dismiss();
|
|
72
|
-
};
|
|
73
|
-
return React__default['default'].createElement(FileInput_styles.Container, tslib.__assign({}, getRootProps()),
|
|
74
|
-
React__default['default'].createElement(FileInput_styles.QuitButton, { onClick: onDismiss },
|
|
75
|
-
React__default['default'].createElement(Button, { round: true, theme: 'red', size: props.isMobile ? "small" : "regular" },
|
|
76
|
-
React__default['default'].createElement(Icon, { name: 'close' }))),
|
|
77
|
-
React__default['default'].createElement("input", tslib.__assign({}, getInputProps())),
|
|
78
|
-
isDragActive
|
|
79
|
-
? React__default['default'].createElement("p", null, "Drop your image here...")
|
|
80
|
-
: (React__default['default'].createElement(FileInput_styles.Instructions, null,
|
|
81
|
-
ErrorMessage,
|
|
82
|
-
React__default['default'].createElement("p", null, !supportDragAndDrop ? "Upload a drawing" : "Drag and drop a drawing here"),
|
|
83
|
-
supportDragAndDrop && React__default['default'].createElement("p", null, "Or"),
|
|
84
|
-
React__default['default'].createElement(Button, { theme: "primary", size: props.isMobile ? "small" : "regular" }, "Select Image"))));
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
module.exports = FileInput;
|
|
88
|
-
//# sourceMappingURL=FileInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileInput.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const Container: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
-
export declare const Instructions: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
-
export declare const QuitButton: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
-
export declare const ErrorMessage: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var tslib = require('tslib');
|
|
6
|
-
var styled = require('styled-components');
|
|
7
|
-
|
|
8
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
-
|
|
10
|
-
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
11
|
-
|
|
12
|
-
var Container = styled__default['default'].div(templateObject_1 || (templateObject_1 = tslib.__makeTemplateObject(["\n position: relative;\n display: flex;\n width: 100%;\n height: 100%;\n max-width: 900px;\n max-height: 675px;\n border-radius: 50px;\n justify-content: center;\n align-items: center;\n padding: 40px;\n background-color: #341644;\n box-shadow: 0 -5px 0 #531D75, 0 10px 0 #1C042B, 0 14px 0 rgba(0,0,0,0.3);\n box-sizing: border-box;\n color: white;\n font-size: 36px;\n @media (max-width: 768px) {\n font-size: 18px;\n max-width: 95%;\n max-height: 95%;\n }\n\n @media (max-height: 500px) {\n font-size: 18px;\n max-width: 90%;\n max-height: 90%;\n }\n"], ["\n position: relative;\n display: flex;\n width: 100%;\n height: 100%;\n max-width: 900px;\n max-height: 675px;\n border-radius: 50px;\n justify-content: center;\n align-items: center;\n padding: 40px;\n background-color: #341644;\n box-shadow: 0 -5px 0 #531D75, 0 10px 0 #1C042B, 0 14px 0 rgba(0,0,0,0.3);\n box-sizing: border-box;\n color: white;\n font-size: 36px;\n @media (max-width: 768px) {\n font-size: 18px;\n max-width: 95%;\n max-height: 95%;\n }\n\n @media (max-height: 500px) {\n font-size: 18px;\n max-width: 90%;\n max-height: 90%;\n }\n"])));
|
|
13
|
-
var Instructions = styled__default['default'].div(templateObject_2 || (templateObject_2 = tslib.__makeTemplateObject(["\n text-align: center;\n @media (max-width: 768px) {\n font-size: 20px;\n }\n"], ["\n text-align: center;\n @media (max-width: 768px) {\n font-size: 20px;\n }\n"])));
|
|
14
|
-
var QuitButton = styled__default['default'].div(templateObject_3 || (templateObject_3 = tslib.__makeTemplateObject(["\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(15px, -15px);\n @media (max-width: 768px) {\n transform: translate(10px, -10px);\n }\n"], ["\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(15px, -15px);\n @media (max-width: 768px) {\n transform: translate(10px, -10px);\n }\n"])));
|
|
15
|
-
var ErrorMessage = styled__default['default'].div(templateObject_4 || (templateObject_4 = tslib.__makeTemplateObject(["\n padding: 15px;\n border-radius: 10px;\n background-color: #E30514;\n color: white;\n font-size: 20px;\n"], ["\n padding: 15px;\n border-radius: 10px;\n background-color: #E30514;\n color: white;\n font-size: 20px;\n"])));
|
|
16
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
17
|
-
|
|
18
|
-
exports.Container = Container;
|
|
19
|
-
exports.ErrorMessage = ErrorMessage;
|
|
20
|
-
exports.Instructions = Instructions;
|
|
21
|
-
exports.QuitButton = QuitButton;
|
|
22
|
-
//# sourceMappingURL=FileInput.styles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileInput.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
|