@prom-ui/core 0.0.22 → 0.0.30
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/Body/cjs/index.development.js +14 -0
- package/Body/cjs/index.production.js +1 -0
- package/Body/cjs/style.development.css +1 -0
- package/Body/cjs/style.production.css +1 -0
- package/Body/index.js +5 -12
- package/Body/package.json +1 -1
- package/Box/cjs/index.development.js +20 -0
- package/Box/cjs/index.production.js +1 -0
- package/Box/cjs/style.development.css +1 -0
- package/Box/cjs/style.production.css +1 -0
- package/Box/index.js +5 -18
- package/Box/package.json +1 -1
- package/Button/cjs/index.development.js +95 -0
- package/Button/cjs/index.production.js +1 -0
- package/Button/cjs/style.development.css +1 -0
- package/Button/cjs/style.production.css +1 -0
- package/Button/index.d.ts +5 -4
- package/Button/index.js +4 -81
- package/Button/package.json +1 -1
- package/ButtonPageUp/cjs/index.development.js +170 -0
- package/ButtonPageUp/cjs/index.production.js +1 -0
- package/ButtonPageUp/index.d.ts +12 -5
- package/ButtonPageUp/index.js +4 -169
- package/ButtonPageUp/package.json +1 -2
- package/Checkbox/cjs/index.development.js +111 -0
- package/Checkbox/cjs/index.production.js +1 -0
- package/Checkbox/cjs/style.development.css +1 -0
- package/Checkbox/cjs/style.production.css +1 -0
- package/Checkbox/index.d.ts +4 -4
- package/Checkbox/index.js +4 -96
- package/Checkbox/package.json +1 -1
- package/Flex/cjs/index.development.js +25 -0
- package/Flex/cjs/index.production.js +1 -0
- package/Flex/cjs/style.development.css +1 -0
- package/Flex/cjs/style.production.css +1 -0
- package/Flex/index.js +5 -23
- package/Flex/package.json +1 -1
- package/Grid/cjs/index.development.js +25 -0
- package/Grid/cjs/index.production.js +1 -0
- package/Grid/cjs/style.development.css +1 -0
- package/Grid/cjs/style.production.css +1 -0
- package/Grid/index.js +5 -23
- package/Grid/package.json +1 -1
- package/Icon/cjs/index.development.js +41 -0
- package/Icon/cjs/index.production.js +1 -0
- package/Icon/cjs/style.development.css +1 -0
- package/Icon/cjs/style.production.css +1 -0
- package/Icon/index.d.ts +7 -12
- package/Icon/index.js +4 -76
- package/Icon/package.json +1 -1
- package/Image/cjs/index.development.js +20 -0
- package/Image/cjs/index.production.js +1 -0
- package/Image/cjs/style.development.css +1 -0
- package/Image/cjs/style.production.css +1 -0
- package/Image/index.js +5 -18
- package/Image/package.json +1 -1
- package/ImageEmoji/cjs/index.development.js +90 -0
- package/ImageEmoji/cjs/index.production.js +1 -0
- package/ImageEmoji/index.d.ts +6 -4
- package/ImageEmoji/index.js +4 -86
- package/ImageEmoji/package.json +1 -1
- package/Input/cjs/index.development.js +39 -0
- package/Input/cjs/index.production.js +1 -0
- package/Input/cjs/style.development.css +1 -0
- package/Input/cjs/style.production.css +1 -0
- package/Input/index.d.ts +23 -23
- package/Input/index.js +4 -81
- package/Input/package.json +1 -1
- package/KeyPress/cjs/index.development.js +56 -0
- package/KeyPress/cjs/index.production.js +1 -0
- package/KeyPress/index.d.ts +8 -7
- package/KeyPress/index.js +5 -53
- package/KeyPress/package.json +2 -5
- package/Line/cjs/index.development.js +20 -0
- package/Line/cjs/index.production.js +1 -0
- package/Line/cjs/style.development.css +1 -0
- package/Line/cjs/style.production.css +1 -0
- package/Line/index.js +5 -18
- package/Line/package.json +1 -1
- package/Link/cjs/index.development.js +22 -0
- package/Link/cjs/index.production.js +1 -0
- package/Link/cjs/style.development.css +1 -0
- package/Link/cjs/style.production.css +1 -0
- package/Link/index.js +5 -20
- package/Link/package.json +1 -1
- package/List/cjs/index.development.js +25 -0
- package/List/cjs/index.production.js +1 -0
- package/List/cjs/style.development.css +1 -0
- package/List/cjs/style.production.css +1 -0
- package/List/index.js +5 -23
- package/List/package.json +1 -1
- package/Media/breakpoints.d.ts +17 -0
- package/Media/cjs/index.development.js +60 -0
- package/Media/cjs/index.production.js +1 -0
- package/Media/index.d.ts +11 -0
- package/Media/index.js +7 -0
- package/{Tooltip → Media}/package.json +3 -3
- package/Media/useMedia.d.ts +7 -0
- package/{Tooltip/Trigger/index.js → OutsideClick/cjs/index.development.js} +32 -24
- package/OutsideClick/cjs/index.production.js +1 -0
- package/OutsideClick/index.d.ts +6 -3
- package/OutsideClick/index.js +4 -74
- package/OutsideClick/package.json +2 -5
- package/Picture/cjs/index.development.js +25 -0
- package/Picture/cjs/index.production.js +1 -0
- package/Picture/cjs/style.development.css +1 -0
- package/Picture/cjs/style.production.css +1 -0
- package/Picture/index.js +5 -23
- package/Picture/package.json +1 -1
- package/PortableOverlay/cjs/index.development.js +111 -0
- package/PortableOverlay/cjs/index.production.js +1 -0
- package/PortableOverlay/cjs/style.development.css +1 -0
- package/PortableOverlay/cjs/style.production.css +1 -0
- package/PortableOverlay/index.d.ts +6 -4
- package/PortableOverlay/index.js +5 -112
- package/PortableOverlay/package.json +1 -2
- package/Portal/cjs/index.development.js +57 -0
- package/Portal/cjs/index.production.js +1 -0
- package/Portal/index.d.ts +6 -4
- package/Portal/index.js +5 -52
- package/Portal/package.json +2 -5
- package/Rating/cjs/index.development.js +105 -0
- package/Rating/cjs/index.production.js +1 -0
- package/Rating/cjs/style.development.css +1 -0
- package/Rating/cjs/style.production.css +1 -0
- package/Rating/index.d.ts +6 -5
- package/Rating/index.js +4 -98
- package/Rating/package.json +1 -1
- package/SafeQuery/cjs/index.development.js +181 -0
- package/SafeQuery/cjs/index.production.js +1 -0
- package/SafeQuery/cjs/style.development.css +1 -0
- package/SafeQuery/cjs/style.production.css +1 -0
- package/SafeQuery/components/Error.d.ts +7 -0
- package/SafeQuery/index.d.ts +10 -0
- package/SafeQuery/index.js +7 -0
- package/SafeQuery/package.json +12 -0
- package/Scroll/cjs/index.development.js +40 -0
- package/Scroll/cjs/index.production.js +1 -0
- package/Scroll/cjs/style.development.css +1 -0
- package/Scroll/cjs/style.production.css +1 -0
- package/Scroll/index.d.ts +18 -16
- package/Scroll/index.js +4 -76
- package/Scroll/package.json +1 -1
- package/ScrollControls/cjs/index.development.js +243 -0
- package/ScrollControls/cjs/index.production.js +1 -0
- package/ScrollControls/cjs/style.development.css +1 -0
- package/ScrollControls/cjs/style.production.css +1 -0
- package/ScrollControls/index.d.ts +16 -6
- package/ScrollControls/index.js +4 -244
- package/ScrollControls/package.json +1 -2
- package/SideOverlay/cjs/index.development.js +210 -0
- package/SideOverlay/cjs/index.production.js +1 -0
- package/SideOverlay/cjs/style.development.css +1 -0
- package/SideOverlay/cjs/style.production.css +1 -0
- package/SideOverlay/index.d.ts +28 -13
- package/SideOverlay/index.js +4 -251
- package/SideOverlay/package.json +1 -1
- package/SimpleSlider/cjs/index.development.js +433 -0
- package/SimpleSlider/cjs/index.production.js +1 -0
- package/SimpleSlider/cjs/style.development.css +1 -0
- package/SimpleSlider/cjs/style.production.css +1 -0
- package/SimpleSlider/index.d.ts +17 -3
- package/SimpleSlider/index.js +4 -477
- package/SimpleSlider/package.json +1 -1
- package/Skeleton/cjs/index.development.js +103 -0
- package/Skeleton/cjs/index.production.js +1 -0
- package/Skeleton/cjs/style.development.css +1 -0
- package/Skeleton/cjs/style.production.css +1 -0
- package/Skeleton/index.d.ts +9 -5
- package/Skeleton/index.js +4 -110
- package/Skeleton/package.json +1 -1
- package/Spinner/cjs/index.development.js +85 -0
- package/Spinner/cjs/index.production.js +1 -0
- package/Spinner/cjs/style.development.css +1 -0
- package/Spinner/cjs/style.production.css +1 -0
- package/Spinner/index.d.ts +7 -6
- package/Spinner/index.js +5 -76
- package/Spinner/package.json +1 -1
- package/Text/cjs/index.development.js +20 -0
- package/Text/cjs/index.production.js +1 -0
- package/Text/cjs/style.development.css +1 -0
- package/Text/cjs/style.production.css +1 -0
- package/Text/index.js +5 -18
- package/Text/package.json +1 -1
- package/TextEmoji/cjs/index.development.js +94 -0
- package/TextEmoji/cjs/index.production.js +1 -0
- package/TextEmoji/index.d.ts +4 -4
- package/TextEmoji/index.js +4 -84
- package/TextEmoji/package.json +1 -1
- package/Tumbler/cjs/index.development.js +110 -0
- package/Tumbler/cjs/index.production.js +1 -0
- package/Tumbler/cjs/style.development.css +1 -0
- package/Tumbler/cjs/style.production.css +1 -0
- package/Tumbler/index.d.ts +4 -4
- package/Tumbler/index.js +4 -95
- package/Tumbler/package.json +1 -1
- package/package.json +15 -9
- package/Body/style.css +0 -741
- package/Box/style.css +0 -9676
- package/Button/style.css +0 -3393
- package/Checkbox/style.css +0 -133
- package/Flex/style.css +0 -786
- package/Grid/style.css +0 -7350
- package/Icon/style.css +0 -46
- package/Image/style.css +0 -664
- package/Input/style.css +0 -345
- package/Line/style.css +0 -138
- package/Link/style.css +0 -259
- package/List/style.css +0 -312
- package/Picture/style.css +0 -1426
- package/PortableOverlay/style.css +0 -44
- package/Rating/style.css +0 -26
- package/Scroll/style.css +0 -169
- package/ScrollControls/style.css +0 -67
- package/SideOverlay/style.css +0 -208
- package/SimpleSlider/style.css +0 -134
- package/Skeleton/style.css +0 -145
- package/Spinner/style.css +0 -80
- package/Text/style.css +0 -840
- package/Tooltip/Popper/index.d.ts +0 -12
- package/Tooltip/Popper/index.js +0 -88
- package/Tooltip/Popper/package.json +0 -9
- package/Tooltip/Popper/style.css +0 -133
- package/Tooltip/Trigger/index.d.ts +0 -5
- package/Tooltip/Trigger/package.json +0 -9
- package/Tooltip/Trigger/style.css +0 -36
- package/Tooltip/index.d.ts +0 -24
- package/Tooltip/index.js +0 -284
- package/Tooltip/style.css +0 -170
- package/Tooltip/utils.d.ts +0 -1
- package/Tumbler/style.css +0 -118
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var ttag = require('ttag');
|
|
7
|
+
var tsDebounce = require('ts-debounce');
|
|
8
|
+
var Portal = require('@prom-ui/core/Portal');
|
|
9
|
+
var Button = require('@prom-ui/core/Button');
|
|
10
|
+
var Icon = require('@prom-ui/core/Icon');
|
|
11
|
+
var ArrowUp = require('@prom-ui/icons/ArrowUp');
|
|
12
|
+
|
|
13
|
+
function _interopNamespace(e) {
|
|
14
|
+
if (e && e.__esModule) return e;
|
|
15
|
+
var n = Object.create(null);
|
|
16
|
+
if (e) {
|
|
17
|
+
Object.keys(e).forEach(function (k) {
|
|
18
|
+
if (k !== 'default') {
|
|
19
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return e[k]; }
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
n["default"] = e;
|
|
28
|
+
return Object.freeze(n);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
32
|
+
|
|
33
|
+
/******************************************************************************
|
|
34
|
+
Copyright (c) Microsoft Corporation.
|
|
35
|
+
|
|
36
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
37
|
+
purpose with or without fee is hereby granted.
|
|
38
|
+
|
|
39
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
40
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
41
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
42
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
43
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
44
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
45
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
46
|
+
***************************************************************************** */
|
|
47
|
+
|
|
48
|
+
var __assign = function() {
|
|
49
|
+
__assign = Object.assign || function __assign(t) {
|
|
50
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
51
|
+
s = arguments[i];
|
|
52
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
53
|
+
}
|
|
54
|
+
return t;
|
|
55
|
+
};
|
|
56
|
+
return __assign.apply(this, arguments);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
function __rest(s, e) {
|
|
60
|
+
var t = {};
|
|
61
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
62
|
+
t[p] = s[p];
|
|
63
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
64
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
65
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
66
|
+
t[p[i]] = s[p[i]];
|
|
67
|
+
}
|
|
68
|
+
return t;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function __makeTemplateObject(cooked, raw) {
|
|
72
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
73
|
+
return cooked;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
var POSITION_FIXED = {
|
|
77
|
+
position: 'fixed',
|
|
78
|
+
right: 0,
|
|
79
|
+
bottom: 0,
|
|
80
|
+
width: '100%'
|
|
81
|
+
};
|
|
82
|
+
var POSITION_STICKY = {
|
|
83
|
+
position: 'sticky',
|
|
84
|
+
bottom: 0,
|
|
85
|
+
height: 0,
|
|
86
|
+
width: '100%'
|
|
87
|
+
};
|
|
88
|
+
var defaultProps = {
|
|
89
|
+
scrollDelay: 100,
|
|
90
|
+
scrollOffset: 100,
|
|
91
|
+
margin: '0 18px 18px 0',
|
|
92
|
+
zIndex: 10
|
|
93
|
+
};
|
|
94
|
+
var ButtonPageUp = React__namespace.memo(function (_a) {
|
|
95
|
+
var children = _a.children,
|
|
96
|
+
scrollDelay = _a.scrollDelay,
|
|
97
|
+
scrollOffset = _a.scrollOffset,
|
|
98
|
+
scrollRef = _a.scrollRef,
|
|
99
|
+
onClick = _a.onClick,
|
|
100
|
+
margin = _a.margin,
|
|
101
|
+
zIndex = _a.zIndex,
|
|
102
|
+
props = __rest(_a, ["children", "scrollDelay", "scrollOffset", "scrollRef", "onClick", "margin", "zIndex"]);
|
|
103
|
+
|
|
104
|
+
var _b = React__namespace.useState(false),
|
|
105
|
+
visible = _b[0],
|
|
106
|
+
setVisible = _b[1];
|
|
107
|
+
|
|
108
|
+
var getRootElement = function () {
|
|
109
|
+
return (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current) || document.documentElement;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
var handleScrollToTop = function (e) {
|
|
113
|
+
if (typeof onClick === 'function') {
|
|
114
|
+
onClick(e);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
getRootElement().scroll({
|
|
118
|
+
top: 0,
|
|
119
|
+
behavior: 'smooth'
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
var handleSetVisible = tsDebounce.debounce(function () {
|
|
124
|
+
var rootElement = getRootElement();
|
|
125
|
+
var isScrollAllow = rootElement.scrollHeight - rootElement.clientHeight > 0;
|
|
126
|
+
var isScrollСorrect = rootElement.scrollTop >= scrollOffset;
|
|
127
|
+
setVisible(isScrollAllow && isScrollСorrect);
|
|
128
|
+
}, scrollDelay);
|
|
129
|
+
React__namespace.useEffect(function () {
|
|
130
|
+
var rootElement = (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current) || document;
|
|
131
|
+
rootElement.addEventListener('resize', handleSetVisible);
|
|
132
|
+
rootElement.addEventListener('scroll', handleSetVisible);
|
|
133
|
+
handleSetVisible();
|
|
134
|
+
return function () {
|
|
135
|
+
rootElement.removeEventListener('resize', handleSetVisible);
|
|
136
|
+
rootElement.removeEventListener('scroll', handleSetVisible);
|
|
137
|
+
};
|
|
138
|
+
}, []);
|
|
139
|
+
if (!visible) return null;
|
|
140
|
+
var Parent = (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current) ? React__namespace.Fragment : Portal.Portal;
|
|
141
|
+
var positionStyle = (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current) ? POSITION_STICKY : POSITION_FIXED;
|
|
142
|
+
return React__namespace.createElement(Parent, null, React__namespace.createElement("div", {
|
|
143
|
+
style: __assign(__assign({}, positionStyle), {
|
|
144
|
+
zIndex: zIndex
|
|
145
|
+
})
|
|
146
|
+
}, React__namespace.createElement(Button.Button, __assign({
|
|
147
|
+
"button-padding": 'xs',
|
|
148
|
+
"button-theme": 'white',
|
|
149
|
+
"button-round": 'full',
|
|
150
|
+
"aria-label": ttag.t(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\u041D\u0430\u0432\u0435\u0440\u0445"], ["\u041D\u0430\u0432\u0435\u0440\u0445"])))
|
|
151
|
+
}, props, {
|
|
152
|
+
style: {
|
|
153
|
+
position: 'absolute',
|
|
154
|
+
right: 0,
|
|
155
|
+
bottom: 0,
|
|
156
|
+
margin: margin
|
|
157
|
+
},
|
|
158
|
+
onClick: handleScrollToTop
|
|
159
|
+
}), children || React__namespace.createElement(Icon.Icon, {
|
|
160
|
+
"icon-as": ArrowUp.ArrowUp,
|
|
161
|
+
style: {
|
|
162
|
+
width: 24,
|
|
163
|
+
height: 24
|
|
164
|
+
}
|
|
165
|
+
}))));
|
|
166
|
+
});
|
|
167
|
+
ButtonPageUp.defaultProps = defaultProps;
|
|
168
|
+
var templateObject_1;
|
|
169
|
+
|
|
170
|
+
exports.ButtonPageUp = ButtonPageUp;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("ttag"),r=require("ts-debounce"),n=require("@prom-ui/core/Portal"),o=require("@prom-ui/core/Button"),l=require("@prom-ui/core/Icon"),i=require("@prom-ui/icons/ArrowUp");function c(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var u=c(e),a=function(){return a=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)};var s,f={position:"fixed",right:0,bottom:0,width:"100%"},p={position:"sticky",bottom:0,height:0,width:"100%"},d=u.memo((function(e){var c=e.children,d=e.scrollDelay,m=e.scrollOffset,b=e.scrollRef,v=e.onClick,y=e.margin,O=e.zIndex,h=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(e,["children","scrollDelay","scrollOffset","scrollRef","onClick","margin","zIndex"]),g=u.useState(!1),j=g[0],w=g[1],P=function(){return(null==b?void 0:b.current)||document.documentElement},x=r.debounce((function(){var e=P(),t=e.scrollHeight-e.clientHeight>0,r=e.scrollTop>=m;w(t&&r)}),d);if(u.useEffect((function(){var e=(null==b?void 0:b.current)||document;return e.addEventListener("resize",x),e.addEventListener("scroll",x),x(),function(){e.removeEventListener("resize",x),e.removeEventListener("scroll",x)}}),[]),!j)return null;var E,q,z=(null==b?void 0:b.current)?u.Fragment:n.Portal,I=(null==b?void 0:b.current)?p:f;return u.createElement(z,null,u.createElement("div",{style:a(a({},I),{zIndex:O})},u.createElement(o.Button,a({"button-padding":"xs","button-theme":"white","button-round":"full","aria-label":t.t(s||(E=["Наверх"],q=["Наверх"],Object.defineProperty?Object.defineProperty(E,"raw",{value:q}):E.raw=q,s=E))},h,{style:{position:"absolute",right:0,bottom:0,margin:y},onClick:function(e){"function"==typeof v&&v(e),P().scroll({top:0,behavior:"smooth"})}}),c||u.createElement(l.Icon,{"icon-as":i.ArrowUp,style:{width:24,height:24}}))))}));d.defaultProps={scrollDelay:100,scrollOffset:100,margin:"0 18px 18px 0",zIndex:10},exports.ButtonPageUp=d;
|
package/ButtonPageUp/index.d.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ButtonProps } from '@prom-ui/core/Button';
|
|
3
|
+
export declare type ButtonPageUpProps = ButtonProps & {
|
|
4
|
+
/** Задержка в `ms` */
|
|
5
|
+
scrollDelay: number;
|
|
6
|
+
/** Смещение скрола для отображения в `px` */
|
|
7
|
+
scrollOffset: number;
|
|
5
8
|
scrollRef?: React.RefObject<HTMLElement>;
|
|
9
|
+
/** Для аналитики */
|
|
6
10
|
onClick?: (e: MouseEvent) => void;
|
|
11
|
+
/** Внешние отступы */
|
|
7
12
|
margin?: number | string;
|
|
13
|
+
/** CSS z-index */
|
|
8
14
|
zIndex?: number;
|
|
15
|
+
/** Содержимое кнопки, по умолчанию стрелка */
|
|
9
16
|
children?: React.ReactNode;
|
|
10
17
|
};
|
|
11
|
-
export declare const ButtonPageUp: React.FC<
|
|
18
|
+
export declare const ButtonPageUp: React.FC<ButtonPageUpProps>;
|
package/ButtonPageUp/index.js
CHANGED
|
@@ -1,172 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var ttag = require('ttag');
|
|
8
|
-
var tsDebounce = require('ts-debounce');
|
|
9
|
-
var Portal = require('@prom-ui/core/Portal');
|
|
10
|
-
var Button = require('@prom-ui/core/Button');
|
|
11
|
-
var Icon = require('@prom-ui/core/Icon');
|
|
12
|
-
var ArrowUp = require('@prom-ui/icons/ArrowUp');
|
|
13
|
-
|
|
14
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
|
-
|
|
16
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
17
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
18
|
-
|
|
19
|
-
/******************************************************************************
|
|
20
|
-
Copyright (c) Microsoft Corporation.
|
|
21
|
-
|
|
22
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
23
|
-
purpose with or without fee is hereby granted.
|
|
24
|
-
|
|
25
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
26
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
27
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
28
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
29
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
30
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
31
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
32
|
-
***************************************************************************** */
|
|
33
|
-
|
|
34
|
-
var __assign = function() {
|
|
35
|
-
__assign = Object.assign || function __assign(t) {
|
|
36
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
37
|
-
s = arguments[i];
|
|
38
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
39
|
-
}
|
|
40
|
-
return t;
|
|
41
|
-
};
|
|
42
|
-
return __assign.apply(this, arguments);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
function __rest(s, e) {
|
|
46
|
-
var t = {};
|
|
47
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
48
|
-
t[p] = s[p];
|
|
49
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
50
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
51
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
52
|
-
t[p[i]] = s[p[i]];
|
|
53
|
-
}
|
|
54
|
-
return t;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function __makeTemplateObject(cooked, raw) {
|
|
58
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
59
|
-
return cooked;
|
|
3
|
+
if (process.env.NODE_ENV === 'production') {
|
|
4
|
+
module.exports = require('./cjs/index.production.js');
|
|
5
|
+
} else {
|
|
6
|
+
module.exports = require('./cjs/index.development.js');
|
|
60
7
|
}
|
|
61
|
-
|
|
62
|
-
var POSITION_FIXED = {
|
|
63
|
-
position: 'fixed',
|
|
64
|
-
right: 0,
|
|
65
|
-
bottom: 0,
|
|
66
|
-
width: '100%'
|
|
67
|
-
};
|
|
68
|
-
var POSITION_STICKY = {
|
|
69
|
-
position: 'sticky',
|
|
70
|
-
bottom: 0,
|
|
71
|
-
height: 0,
|
|
72
|
-
width: '100%'
|
|
73
|
-
};
|
|
74
|
-
var ButtonPageUp = React.memo(function (_a) {
|
|
75
|
-
var _b = _a.children,
|
|
76
|
-
children = _b === void 0 ? null : _b,
|
|
77
|
-
_c = _a.scrollDelay,
|
|
78
|
-
scrollDelay = _c === void 0 ? 100 : _c,
|
|
79
|
-
_d = _a.scrollOffset,
|
|
80
|
-
scrollOffset = _d === void 0 ? 100 : _d,
|
|
81
|
-
_e = _a.scrollRef,
|
|
82
|
-
scrollRef = _e === void 0 ? null : _e,
|
|
83
|
-
_f = _a.onClick,
|
|
84
|
-
onClick = _f === void 0 ? function () {} : _f,
|
|
85
|
-
_g = _a.margin,
|
|
86
|
-
margin = _g === void 0 ? '0 18px 18px 0' : _g,
|
|
87
|
-
_h = _a.zIndex,
|
|
88
|
-
zIndex = _h === void 0 ? 10 : _h,
|
|
89
|
-
props = __rest(_a, ["children", "scrollDelay", "scrollOffset", "scrollRef", "onClick", "margin", "zIndex"]);
|
|
90
|
-
|
|
91
|
-
var _j = React.useState(false),
|
|
92
|
-
visible = _j[0],
|
|
93
|
-
setVisible = _j[1];
|
|
94
|
-
|
|
95
|
-
var getRootElement = function () {
|
|
96
|
-
return (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current) || document.documentElement;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
var handleScrollToTop = function (e) {
|
|
100
|
-
if (typeof onClick === 'function') {
|
|
101
|
-
onClick(e);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
getRootElement().scroll({
|
|
105
|
-
top: 0,
|
|
106
|
-
behavior: 'smooth'
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
var handleSetVisible = tsDebounce.debounce(function () {
|
|
111
|
-
var rootElement = getRootElement();
|
|
112
|
-
var isScrollAllow = rootElement.scrollHeight - rootElement.clientHeight > 0;
|
|
113
|
-
var isScrollСorrect = rootElement.scrollTop >= scrollOffset;
|
|
114
|
-
setVisible(isScrollAllow && isScrollСorrect);
|
|
115
|
-
}, scrollDelay);
|
|
116
|
-
React.useEffect(function () {
|
|
117
|
-
var rootElement = (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current) || document;
|
|
118
|
-
rootElement.addEventListener('resize', handleSetVisible);
|
|
119
|
-
rootElement.addEventListener('scroll', handleSetVisible);
|
|
120
|
-
handleSetVisible();
|
|
121
|
-
return function () {
|
|
122
|
-
rootElement.removeEventListener('resize', handleSetVisible);
|
|
123
|
-
rootElement.removeEventListener('scroll', handleSetVisible);
|
|
124
|
-
};
|
|
125
|
-
}, []);
|
|
126
|
-
if (!visible) return null;
|
|
127
|
-
var Parent = (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current) ? React.Fragment : Portal.Portal;
|
|
128
|
-
var positionStyle = (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current) ? POSITION_STICKY : POSITION_FIXED;
|
|
129
|
-
return React__default["default"].createElement(Parent, null, React__default["default"].createElement("div", {
|
|
130
|
-
style: __assign(__assign({}, positionStyle), {
|
|
131
|
-
zIndex: zIndex
|
|
132
|
-
})
|
|
133
|
-
}, React__default["default"].createElement(Button.Button, __assign({
|
|
134
|
-
"button-padding": 'xs',
|
|
135
|
-
"button-theme": 'white',
|
|
136
|
-
"button-round": 'full',
|
|
137
|
-
"aria-label": ttag.t(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\u041D\u0430\u0432\u0435\u0440\u0445"], ["\u041D\u0430\u0432\u0435\u0440\u0445"])))
|
|
138
|
-
}, props, {
|
|
139
|
-
style: {
|
|
140
|
-
position: 'absolute',
|
|
141
|
-
right: 0,
|
|
142
|
-
bottom: 0,
|
|
143
|
-
margin: margin
|
|
144
|
-
},
|
|
145
|
-
onClick: handleScrollToTop
|
|
146
|
-
}), children || React__default["default"].createElement(Icon.Icon, {
|
|
147
|
-
"icon-as": ArrowUp.ArrowUp,
|
|
148
|
-
style: {
|
|
149
|
-
width: 24,
|
|
150
|
-
height: 24
|
|
151
|
-
}
|
|
152
|
-
}))));
|
|
153
|
-
});
|
|
154
|
-
ButtonPageUp.propTypes = {
|
|
155
|
-
/** Задержка в `ms` */
|
|
156
|
-
scrollDelay: PropTypes__default["default"].number,
|
|
157
|
-
|
|
158
|
-
/** Смещение скрола для отображения в `px` */
|
|
159
|
-
scrollOffset: PropTypes__default["default"].number,
|
|
160
|
-
|
|
161
|
-
/** Для аналитики */
|
|
162
|
-
onClick: PropTypes__default["default"].func,
|
|
163
|
-
|
|
164
|
-
/** Внешние отступы */
|
|
165
|
-
margin: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string, PropTypes__default["default"].number]),
|
|
166
|
-
|
|
167
|
-
/** CSS z-index */
|
|
168
|
-
zIndex: PropTypes__default["default"].number
|
|
169
|
-
};
|
|
170
|
-
var templateObject_1;
|
|
171
|
-
|
|
172
|
-
exports.ButtonPageUp = ButtonPageUp;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prom-ui/core/ButtonPageUp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.30",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"*.css"
|
|
8
8
|
],
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@prom-ui/icons": "^0.0.5",
|
|
11
10
|
"ts-debounce": "^4.0.0",
|
|
12
11
|
"ttag": "^1.7.24"
|
|
13
12
|
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var reactTransitionGroup = require('react-transition-group');
|
|
7
|
+
var classNames = require('classnames');
|
|
8
|
+
var Spinner = require('@prom-ui/core/Spinner');
|
|
9
|
+
|
|
10
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
|
+
|
|
12
|
+
function _interopNamespace(e) {
|
|
13
|
+
if (e && e.__esModule) return e;
|
|
14
|
+
var n = Object.create(null);
|
|
15
|
+
if (e) {
|
|
16
|
+
Object.keys(e).forEach(function (k) {
|
|
17
|
+
if (k !== 'default') {
|
|
18
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
19
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return e[k]; }
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
n["default"] = e;
|
|
27
|
+
return Object.freeze(n);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
31
|
+
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
32
|
+
|
|
33
|
+
/******************************************************************************
|
|
34
|
+
Copyright (c) Microsoft Corporation.
|
|
35
|
+
|
|
36
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
37
|
+
purpose with or without fee is hereby granted.
|
|
38
|
+
|
|
39
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
40
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
41
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
42
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
43
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
44
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
45
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
46
|
+
***************************************************************************** */
|
|
47
|
+
|
|
48
|
+
var __assign = function() {
|
|
49
|
+
__assign = Object.assign || function __assign(t) {
|
|
50
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
51
|
+
s = arguments[i];
|
|
52
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
53
|
+
}
|
|
54
|
+
return t;
|
|
55
|
+
};
|
|
56
|
+
return __assign.apply(this, arguments);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
function __rest(s, e) {
|
|
60
|
+
var t = {};
|
|
61
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
62
|
+
t[p] = s[p];
|
|
63
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
64
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
65
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
66
|
+
t[p[i]] = s[p[i]];
|
|
67
|
+
}
|
|
68
|
+
return t;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
var css = {"root":"Checkbox__root___JbPkR","view":"Checkbox__view___Smb1v","input":"Checkbox__input___-KDH8","inputLoading":"Checkbox__inputLoading___3-2zC","spinner":"Checkbox__spinner___K7NKz","spinnerEnterActive":"Checkbox__spinnerEnterActive___ASYih","spinnerEnterDone":"Checkbox__spinnerEnterDone___vsNQ-","spinnerExitActive":"Checkbox__spinnerExitActive___X-b7M","spinnerExitDone":"Checkbox__spinnerExitDone___MP3D6"};
|
|
72
|
+
|
|
73
|
+
var Checkbox = React__namespace.forwardRef(function (_a, ref) {
|
|
74
|
+
var _b;
|
|
75
|
+
|
|
76
|
+
var className = _a.className,
|
|
77
|
+
_c = _a.type,
|
|
78
|
+
type = _c === void 0 ? 'checkbox' : _c,
|
|
79
|
+
_d = _a.loading,
|
|
80
|
+
loading = _d === void 0 ? false : _d,
|
|
81
|
+
props = __rest(_a, ["className", "type", "loading"]);
|
|
82
|
+
|
|
83
|
+
return React__namespace.createElement("div", {
|
|
84
|
+
className: classNames__default["default"](css.root, className)
|
|
85
|
+
}, React__namespace.createElement("input", __assign({
|
|
86
|
+
className: classNames__default["default"](css.input, (_b = {}, _b[css.inputLoading] = loading, _b)),
|
|
87
|
+
ref: ref,
|
|
88
|
+
disabled: loading,
|
|
89
|
+
type: type
|
|
90
|
+
}, props)), React__namespace.createElement("div", {
|
|
91
|
+
className: css.view
|
|
92
|
+
}, React__namespace.createElement(reactTransitionGroup.CSSTransition, {
|
|
93
|
+
in: loading,
|
|
94
|
+
timeout: 100,
|
|
95
|
+
classNames: {
|
|
96
|
+
enterActive: css.spinnerEnterActive,
|
|
97
|
+
enterDone: css.spinnerEnterDone,
|
|
98
|
+
exitActive: css.spinnerExitActive,
|
|
99
|
+
exitDone: css.spinnerExitDone
|
|
100
|
+
},
|
|
101
|
+
unmountOnExit: true
|
|
102
|
+
}, React__namespace.createElement(Spinner.Spinner, {
|
|
103
|
+
className: css.spinner,
|
|
104
|
+
width: '100%',
|
|
105
|
+
height: '100%'
|
|
106
|
+
}))));
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
exports.Checkbox = Checkbox;
|
|
110
|
+
|
|
111
|
+
require('./style.development.css');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("react-transition-group"),r=require("classnames"),n=require("@prom-ui/core/Spinner");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var i=o(e),c=a(r),l=function(){return l=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},l.apply(this,arguments)};var u="JbPkR",s="Smb1v",f="-KDH8",p="_3-2zC",b="K7NKz",d="ASYih",m="vsNQ-",y="X-b7M",v="MP3D6",O=i.forwardRef((function(e,r){var a,o=e.className,O=e.type,j=void 0===O?"checkbox":O,g=e.loading,h=void 0!==g&&g,x=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}(e,["className","type","loading"]);return i.createElement("div",{className:c.default(u,o)},i.createElement("input",l({className:c.default(f,(a={},a[p]=h,a)),ref:r,disabled:h,type:j},x)),i.createElement("div",{className:s},i.createElement(t.CSSTransition,{in:h,timeout:100,classNames:{enterActive:d,enterDone:m,exitActive:y,exitDone:v},unmountOnExit:!0},i.createElement(n.Spinner,{className:b,width:"100%",height:"100%"}))))}));exports.Checkbox=O,require("./style.production.css");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.Checkbox__root___JbPkR{display:block;box-sizing:border-box;width:18px;height:18px;position:relative;margin:calc((var(--pds-line-height) - 18px)/2)0;flex-shrink:0}.Checkbox__view___Smb1v{width:100%;height:100%;position:relative}.Checkbox__view___Smb1v::before,.Checkbox__view___Smb1v::after{content:"";position:absolute;left:0;top:0;width:100%;height:100%;box-sizing:border-box;transition:100ms ease-in-out;transition-property:border-radius,background-color,border-color,opacity}.Checkbox__view___Smb1v::before{border-radius:var(--pds-round-xxs);border:2px var(--black-400) solid;background:var(--white)}.Checkbox__view___Smb1v::after{background-repeat:no-repeat;background-position:center;opacity:0}.Checkbox__input___-KDH8{position:absolute;left:0;top:0;width:100%;height:100%;z-index:1;-webkit-appearance:none;-moz-appearance:none;appearance:none;opacity:0;padding:0;margin:0;cursor:pointer}.Checkbox__input___-KDH8:disabled{cursor:default}.Checkbox__input___-KDH8[type=checkbox]+.Checkbox__view___Smb1v::after{background-image:url("data:image/svg+xml,%3Csvg width='10' height='9' viewBox='0 0 10 9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 4.807L3.64375 7.345L8.93125 1' stroke='%2301011B' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E")}.Checkbox__input___-KDH8[type=radio]+.Checkbox__view___Smb1v::before{border-radius:50%}.Checkbox__input___-KDH8[type=radio]+.Checkbox__view___Smb1v::after{background-image:url("data:image/svg+xml,%3Csvg width='8' height='8' viewBox='0 0 8 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='4' cy='4' r='4' fill='%2301011B'/%3E%3C/svg%3E")}.Checkbox__input___-KDH8:focus-visible+.Checkbox__view___Smb1v::before{outline:var(--pds-round-xxs) auto Highlight;outline:var(--pds-round-xxs) auto -webkit-focus-ring-color}.Checkbox__input___-KDH8:checked+.Checkbox__view___Smb1v::before{background-color:var(--yellow-500);border-color:var(--yellow-500)}.Checkbox__input___-KDH8:checked+.Checkbox__view___Smb1v::after{opacity:1}.Checkbox__input___-KDH8:disabled+.Checkbox__view___Smb1v::before{background-color:var(--black-200);border-color:var(--black-200);color:var(--black-700)}.Checkbox__input___-KDH8.Checkbox__inputLoading___3-2zC+.Checkbox__view___Smb1v::before{border-radius:50%;background-color:var(--white);border-color:var(--black-400)}.Checkbox__input___-KDH8:checked:disabled+.Checkbox__view___Smb1v::after{opacity:.5}.Checkbox__spinner___K7NKz{color:var(--violet-500);opacity:0;transition:opacity 100ms ease-in-out}.Checkbox__spinnerEnterActive___ASYih,.Checkbox__spinnerEnterDone___vsNQ-{opacity:1}.Checkbox__spinnerExitActive___X-b7M,.Checkbox__spinnerExitDone___MP3D6{opacity:0}@media (hover){.Checkbox__input___-KDH8:hover+.Checkbox__view___Smb1v::before{border-color:var(--black-500)}.Checkbox__input___-KDH8:checked:hover+.Checkbox__view___Smb1v::before{border-color:var(--yellow-500)}.Checkbox__input___-KDH8:disabled:hover+.Checkbox__view___Smb1v::before{border-color:var(--black-200)}.Checkbox__input___-KDH8.Checkbox__inputLoading___3-2zC:hover+.Checkbox__view___Smb1v::before{border-color:var(--black-400)}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.JbPkR{display:block;box-sizing:border-box;width:18px;height:18px;position:relative;margin:calc((var(--pds-line-height) - 18px)/2)0;flex-shrink:0}.Smb1v{width:100%;height:100%;position:relative}.Smb1v::before,.Smb1v::after{content:"";position:absolute;left:0;top:0;width:100%;height:100%;box-sizing:border-box;transition:100ms ease-in-out;transition-property:border-radius,background-color,border-color,opacity}.Smb1v::before{border-radius:var(--pds-round-xxs);border:2px var(--black-400) solid;background:var(--white)}.Smb1v::after{background-repeat:no-repeat;background-position:center;opacity:0}.-KDH8{position:absolute;left:0;top:0;width:100%;height:100%;z-index:1;-webkit-appearance:none;-moz-appearance:none;appearance:none;opacity:0;padding:0;margin:0;cursor:pointer}.-KDH8:disabled{cursor:default}.-KDH8[type=checkbox]+.Smb1v::after{background-image:url("data:image/svg+xml,%3Csvg width='10' height='9' viewBox='0 0 10 9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 4.807L3.64375 7.345L8.93125 1' stroke='%2301011B' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E")}.-KDH8[type=radio]+.Smb1v::before{border-radius:50%}.-KDH8[type=radio]+.Smb1v::after{background-image:url("data:image/svg+xml,%3Csvg width='8' height='8' viewBox='0 0 8 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='4' cy='4' r='4' fill='%2301011B'/%3E%3C/svg%3E")}.-KDH8:focus-visible+.Smb1v::before{outline:var(--pds-round-xxs) auto Highlight;outline:var(--pds-round-xxs) auto -webkit-focus-ring-color}.-KDH8:checked+.Smb1v::before{background-color:var(--yellow-500);border-color:var(--yellow-500)}.-KDH8:checked+.Smb1v::after{opacity:1}.-KDH8:disabled+.Smb1v::before{background-color:var(--black-200);border-color:var(--black-200);color:var(--black-700)}.-KDH8._3-2zC+.Smb1v::before{border-radius:50%;background-color:var(--white);border-color:var(--black-400)}.-KDH8:checked:disabled+.Smb1v::after{opacity:.5}.K7NKz{color:var(--violet-500);opacity:0;transition:opacity 100ms ease-in-out}.ASYih,.vsNQ-{opacity:1}.X-b7M,.MP3D6{opacity:0}@media (hover){.-KDH8:hover+.Smb1v::before{border-color:var(--black-500)}.-KDH8:checked:hover+.Smb1v::before{border-color:var(--yellow-500)}.-KDH8:disabled:hover+.Smb1v::before{border-color:var(--black-200)}.-KDH8._3-2zC:hover+.Smb1v::before{border-color:var(--black-400)}}
|
package/Checkbox/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
declare type
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare type CheckboxProps = React.ComponentPropsWithRef<"input"> & {
|
|
3
3
|
type?: 'checkbox' | 'radio';
|
|
4
4
|
className?: string;
|
|
5
|
+
/** Спиннер */
|
|
5
6
|
loading?: boolean;
|
|
6
7
|
};
|
|
7
|
-
export declare const Checkbox: React.
|
|
8
|
-
export {};
|
|
8
|
+
export declare const Checkbox: React.ForwardRefExoticComponent<Pick<CheckboxProps, "key" | keyof React.InputHTMLAttributes<HTMLInputElement> | "loading"> & React.RefAttributes<HTMLInputElement>>;
|
package/Checkbox/index.js
CHANGED
|
@@ -1,99 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var PropTypes = require('prop-types');
|
|
8
|
-
var classNames = require('classnames');
|
|
9
|
-
var Spinner = require('@prom-ui/core/Spinner');
|
|
10
|
-
|
|
11
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
|
-
|
|
13
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
14
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
15
|
-
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
16
|
-
|
|
17
|
-
/******************************************************************************
|
|
18
|
-
Copyright (c) Microsoft Corporation.
|
|
19
|
-
|
|
20
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
21
|
-
purpose with or without fee is hereby granted.
|
|
22
|
-
|
|
23
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
24
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
25
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
26
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
27
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
28
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
29
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
30
|
-
***************************************************************************** */
|
|
31
|
-
|
|
32
|
-
var __assign = function() {
|
|
33
|
-
__assign = Object.assign || function __assign(t) {
|
|
34
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
35
|
-
s = arguments[i];
|
|
36
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
37
|
-
}
|
|
38
|
-
return t;
|
|
39
|
-
};
|
|
40
|
-
return __assign.apply(this, arguments);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
function __rest(s, e) {
|
|
44
|
-
var t = {};
|
|
45
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
46
|
-
t[p] = s[p];
|
|
47
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
48
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
49
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
50
|
-
t[p[i]] = s[p[i]];
|
|
51
|
-
}
|
|
52
|
-
return t;
|
|
3
|
+
if (process.env.NODE_ENV === 'production') {
|
|
4
|
+
module.exports = require('./cjs/index.production.js');
|
|
5
|
+
} else {
|
|
6
|
+
module.exports = require('./cjs/index.development.js');
|
|
53
7
|
}
|
|
54
|
-
|
|
55
|
-
var css = {"root":"Checkbox__root___JbPkR","view":"Checkbox__view___Smb1v","input":"Checkbox__input___-KDH8","inputLoading":"Checkbox__inputLoading___3-2zC","spinner":"Checkbox__spinner___K7NKz","spinnerEnterActive":"Checkbox__spinnerEnterActive___ASYih","spinnerEnterDone":"Checkbox__spinnerEnterDone___vsNQ-","spinnerExitActive":"Checkbox__spinnerExitActive___X-b7M","spinnerExitDone":"Checkbox__spinnerExitDone___MP3D6"};
|
|
56
|
-
|
|
57
|
-
var Checkbox = React.forwardRef(function (_a, ref) {
|
|
58
|
-
var _b;
|
|
59
|
-
|
|
60
|
-
var className = _a.className,
|
|
61
|
-
loading = _a.loading,
|
|
62
|
-
props = __rest(_a, ["className", "loading"]);
|
|
63
|
-
|
|
64
|
-
return React__default["default"].createElement("div", {
|
|
65
|
-
className: classNames__default["default"](css.root, className)
|
|
66
|
-
}, React__default["default"].createElement("input", __assign({
|
|
67
|
-
className: classNames__default["default"](css.input, (_b = {}, _b[css.inputLoading] = loading, _b)),
|
|
68
|
-
ref: ref,
|
|
69
|
-
disabled: loading
|
|
70
|
-
}, props)), React__default["default"].createElement("div", {
|
|
71
|
-
className: css.view
|
|
72
|
-
}, React__default["default"].createElement(reactTransitionGroup.CSSTransition, {
|
|
73
|
-
in: loading,
|
|
74
|
-
timeout: 100,
|
|
75
|
-
classNames: {
|
|
76
|
-
enterActive: css.spinnerEnterActive,
|
|
77
|
-
enterDone: css.spinnerEnterDone,
|
|
78
|
-
exitActive: css.spinnerExitActive,
|
|
79
|
-
exitDone: css.spinnerExitDone
|
|
80
|
-
},
|
|
81
|
-
unmountOnExit: true
|
|
82
|
-
}, React__default["default"].createElement(Spinner.Spinner, {
|
|
83
|
-
className: css.spinner,
|
|
84
|
-
width: '100%',
|
|
85
|
-
height: '100%'
|
|
86
|
-
}))));
|
|
87
|
-
});
|
|
88
|
-
Checkbox.propTypes = {
|
|
89
|
-
type: PropTypes__default["default"].oneOf(['checkbox', 'radio']),
|
|
90
|
-
loading: PropTypes__default["default"].bool
|
|
91
|
-
};
|
|
92
|
-
Checkbox.defaultProps = {
|
|
93
|
-
type: 'checkbox',
|
|
94
|
-
loading: false
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
exports.Checkbox = Checkbox;
|
|
98
|
-
|
|
99
|
-
require('./style.css');
|