@dspworkplace/ui 1.5.33 → 1.5.36
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/index.es.js +184 -15
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +257 -86
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { forwardRef, useState, Fragment, useCallback, useEffect, useRef } from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
1
|
+
import React, { forwardRef, useState, Fragment, useCallback, useEffect, useRef, Children } from 'react';
|
|
2
|
+
import styled, { keyframes } from 'styled-components';
|
|
3
3
|
|
|
4
4
|
var defaultRadius = '2px';
|
|
5
5
|
var colors = {
|
|
@@ -6110,6 +6110,175 @@ var ButtonGroup = function ButtonGroup(_ref) {
|
|
|
6110
6110
|
}));
|
|
6111
6111
|
};
|
|
6112
6112
|
|
|
6113
|
+
function _templateObject4$9() {
|
|
6114
|
+
var data = taggedTemplateLiteral(["\n position:relative;\n\n &:hover > ", " > * {\n animation-name: ", ";\n animation-duration: 300ms;\n animation-fill-mode: both;\n animation-timing-function: ease-in-out;\n }\n"]);
|
|
6115
|
+
|
|
6116
|
+
_templateObject4$9 = function _templateObject4() {
|
|
6117
|
+
return data;
|
|
6118
|
+
};
|
|
6119
|
+
|
|
6120
|
+
return data;
|
|
6121
|
+
}
|
|
6122
|
+
|
|
6123
|
+
function _templateObject3$9() {
|
|
6124
|
+
var data = taggedTemplateLiteral(["\n cursor:pointer;\n background:white;\n border-radius:100%;\n padding:8px;\n display:flex;\n justify-content:center;\n border:1px solid rgb(204, 204, 204);\n"]);
|
|
6125
|
+
|
|
6126
|
+
_templateObject3$9 = function _templateObject3() {
|
|
6127
|
+
return data;
|
|
6128
|
+
};
|
|
6129
|
+
|
|
6130
|
+
return data;
|
|
6131
|
+
}
|
|
6132
|
+
|
|
6133
|
+
function _templateObject2$b() {
|
|
6134
|
+
var data = taggedTemplateLiteral(["\n position:absolute;\n height:100%;\n padding:12px;\n white-space: nowrap;\n align-items:center;\n gap: ", "\n display:flex;\n visibility: hidden;\n\n &:hover {\n visibility: visible;\n }\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n\n ", "\n"]);
|
|
6135
|
+
|
|
6136
|
+
_templateObject2$b = function _templateObject2() {
|
|
6137
|
+
return data;
|
|
6138
|
+
};
|
|
6139
|
+
|
|
6140
|
+
return data;
|
|
6141
|
+
}
|
|
6142
|
+
|
|
6143
|
+
function _templateObject$h() {
|
|
6144
|
+
var data = taggedTemplateLiteral(["\n 0% {\n opacity:0;\n visibility: hidden;\n transform: scale(0.6) translateY(-8px);\n }\n\n 100% {\n visibility: visible;\n opacity:1;\n }\n"]);
|
|
6145
|
+
|
|
6146
|
+
_templateObject$h = function _templateObject() {
|
|
6147
|
+
return data;
|
|
6148
|
+
};
|
|
6149
|
+
|
|
6150
|
+
return data;
|
|
6151
|
+
}
|
|
6152
|
+
var listAnimation = keyframes(_templateObject$h());
|
|
6153
|
+
var POSITION_LIST = '100%';
|
|
6154
|
+
var POSITION_LIST_DISTANCE = '10%';
|
|
6155
|
+
|
|
6156
|
+
var generateAnimationDelay = function generateAnimationDelay(n, direction) {
|
|
6157
|
+
var style = '';
|
|
6158
|
+
|
|
6159
|
+
if (['left', 'top'].includes(direction)) {
|
|
6160
|
+
var delayNumber = 1;
|
|
6161
|
+
|
|
6162
|
+
for (var i = n; i >= 1; --i) {
|
|
6163
|
+
style += "\n > :nth-child(".concat(i, ") {\n animation-delay: ").concat(delayNumber * 90, "ms;\n }\n ");
|
|
6164
|
+
delayNumber++;
|
|
6165
|
+
}
|
|
6166
|
+
} else {
|
|
6167
|
+
for (var _i = 1; _i <= n; ++_i) {
|
|
6168
|
+
style += "\n > :nth-child(".concat(_i, ") {\n animation-delay: ").concat(_i * 90, "ms;\n }\n ");
|
|
6169
|
+
}
|
|
6170
|
+
}
|
|
6171
|
+
|
|
6172
|
+
return style;
|
|
6173
|
+
};
|
|
6174
|
+
|
|
6175
|
+
var ListContent = styled.div(_templateObject2$b(), function (props) {
|
|
6176
|
+
return props.spaceBetween;
|
|
6177
|
+
}, function (props) {
|
|
6178
|
+
return generateAnimationDelay(props.childrenQuantity, props.direction);
|
|
6179
|
+
}, function (props) {
|
|
6180
|
+
return props.direction === 'right' || props.direction === 'auto' && "\n flex-direction:row;\n top:0;\n bottom:0;\n left:".concat(POSITION_LIST, ";\n padding-left:").concat(POSITION_LIST_DISTANCE, ";\n ");
|
|
6181
|
+
}, function (props) {
|
|
6182
|
+
return props.direction === 'left' && "\n flex-direction:row;\n top:0;\n bottom:0;\n right:".concat(POSITION_LIST, ";\n padding-right:").concat(POSITION_LIST_DISTANCE, ";\n ");
|
|
6183
|
+
}, function (props) {
|
|
6184
|
+
return props.direction === 'top' && "\n flex-direction:column;\n justify-content:end;\n bottom:".concat(POSITION_LIST, ";\n right:0;\n left:0;\n padding-top:").concat(POSITION_LIST_DISTANCE, ";\n ");
|
|
6185
|
+
}, function (props) {
|
|
6186
|
+
return props.directiondirection === 'bottom' && "\n flex-direction:column;\n justify-content:start;\n top:".concat(POSITION_LIST, ";\n bottom:0;\n right:0;\n left:0;\n padding-top:").concat(POSITION_LIST_DISTANCE, ";\n ");
|
|
6187
|
+
});
|
|
6188
|
+
var PreviewContent = styled.div(_templateObject3$9());
|
|
6189
|
+
var Container$1 = styled.div(_templateObject4$9(), ListContent, listAnimation);
|
|
6190
|
+
|
|
6191
|
+
var ButtonIcon = function ButtonIcon(_ref) {
|
|
6192
|
+
var children = _ref.children,
|
|
6193
|
+
_ref$event = _ref.event;
|
|
6194
|
+
|
|
6195
|
+
if (children.length > 2) {
|
|
6196
|
+
throw 'This component only accepts a Button.Preview and Button.List component';
|
|
6197
|
+
}
|
|
6198
|
+
|
|
6199
|
+
var _children = slicedToArray(children, 2),
|
|
6200
|
+
Preview = _children[0],
|
|
6201
|
+
List = _children[1];
|
|
6202
|
+
|
|
6203
|
+
if (Preview.type.name !== 'ButtonPreview') {
|
|
6204
|
+
throw "The first component should be ButtonIcon.Preview, but got ".concat(Preview.type.name);
|
|
6205
|
+
}
|
|
6206
|
+
|
|
6207
|
+
if (List.type.name !== 'ButtonList') {
|
|
6208
|
+
throw "The first component should be ButtonIcon.List, but got ".concat(Preview.type.name);
|
|
6209
|
+
}
|
|
6210
|
+
|
|
6211
|
+
return /*#__PURE__*/React.createElement(Container$1, null, Preview, List);
|
|
6212
|
+
};
|
|
6213
|
+
|
|
6214
|
+
var ButtonPreview = function ButtonPreview(_ref2) {
|
|
6215
|
+
var children = _ref2.children;
|
|
6216
|
+
var previewRef = useRef();
|
|
6217
|
+
return /*#__PURE__*/React.createElement(PreviewContent, {
|
|
6218
|
+
ref: previewRef
|
|
6219
|
+
}, children);
|
|
6220
|
+
};
|
|
6221
|
+
|
|
6222
|
+
ButtonIcon.Preview = ButtonPreview;
|
|
6223
|
+
var DIRECTIONS = ['bottom', 'left', 'right', 'top', 'auto'];
|
|
6224
|
+
|
|
6225
|
+
var ButtonList = function ButtonList(_ref3) {
|
|
6226
|
+
var children = _ref3.children,
|
|
6227
|
+
direction = _ref3.direction,
|
|
6228
|
+
spaceBetween = _ref3.spaceBetween;
|
|
6229
|
+
|
|
6230
|
+
var _useState = useState(direction),
|
|
6231
|
+
_useState2 = slicedToArray(_useState, 2),
|
|
6232
|
+
dir = _useState2[0],
|
|
6233
|
+
setDir = _useState2[1];
|
|
6234
|
+
|
|
6235
|
+
if (!DIRECTIONS.includes(dir)) {
|
|
6236
|
+
throw "Invalid direction argument on component ButtonIcon.List, expect ".concat(DIRECTIONS.join(', '));
|
|
6237
|
+
}
|
|
6238
|
+
|
|
6239
|
+
if (['left', 'top'].includes(dir)) {
|
|
6240
|
+
children = Children.toArray(children).reverse();
|
|
6241
|
+
}
|
|
6242
|
+
|
|
6243
|
+
var contentRef = useRef();
|
|
6244
|
+
useEffect(function () {
|
|
6245
|
+
if (!(contentRef === null || contentRef === void 0 ? void 0 : contentRef.current)) return;
|
|
6246
|
+
if (dir !== 'auto') return;
|
|
6247
|
+
var bounds = contentRef.current.getBoundingClientRect();
|
|
6248
|
+
var windowWidth = window.innerWidth;
|
|
6249
|
+
var windowHeight = window.innerHeight;
|
|
6250
|
+
|
|
6251
|
+
if (bounds.right > windowWidth) {
|
|
6252
|
+
setDir('left');
|
|
6253
|
+
return;
|
|
6254
|
+
} else {
|
|
6255
|
+
return;
|
|
6256
|
+
}
|
|
6257
|
+
|
|
6258
|
+
if (bounds.left < 0) {
|
|
6259
|
+
setDir('bottom');
|
|
6260
|
+
return;
|
|
6261
|
+
}
|
|
6262
|
+
|
|
6263
|
+
if (bounds.bottom > windowHeight) {
|
|
6264
|
+
setDir('top');
|
|
6265
|
+
return;
|
|
6266
|
+
}
|
|
6267
|
+
}, [contentRef]);
|
|
6268
|
+
return /*#__PURE__*/React.createElement(ListContent, {
|
|
6269
|
+
ref: contentRef,
|
|
6270
|
+
direction: dir,
|
|
6271
|
+
spaceBetween: spaceBetween,
|
|
6272
|
+
childrenQuantity: children.length
|
|
6273
|
+
}, children);
|
|
6274
|
+
};
|
|
6275
|
+
|
|
6276
|
+
ButtonList.defaultProps = {
|
|
6277
|
+
direction: 'auto',
|
|
6278
|
+
spaceBetween: '8px'
|
|
6279
|
+
};
|
|
6280
|
+
ButtonIcon.List = ButtonList;
|
|
6281
|
+
|
|
6113
6282
|
var _ref$1t = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
|
|
6114
6283
|
id: "clip-path"
|
|
6115
6284
|
}, /*#__PURE__*/React.createElement("path", {
|
|
@@ -6205,51 +6374,51 @@ function _templateObject5$7() {
|
|
|
6205
6374
|
return data;
|
|
6206
6375
|
}
|
|
6207
6376
|
|
|
6208
|
-
function _templateObject4$
|
|
6377
|
+
function _templateObject4$a() {
|
|
6209
6378
|
var data = taggedTemplateLiteral(["\n font-size: ", ";\n line-height: ", ";\n"]);
|
|
6210
6379
|
|
|
6211
|
-
_templateObject4$
|
|
6380
|
+
_templateObject4$a = function _templateObject4() {
|
|
6212
6381
|
return data;
|
|
6213
6382
|
};
|
|
6214
6383
|
|
|
6215
6384
|
return data;
|
|
6216
6385
|
}
|
|
6217
6386
|
|
|
6218
|
-
function _templateObject3$
|
|
6387
|
+
function _templateObject3$a() {
|
|
6219
6388
|
var data = taggedTemplateLiteral(["\n font-size: ", ";\n line-height: ", ";\n"]);
|
|
6220
6389
|
|
|
6221
|
-
_templateObject3$
|
|
6390
|
+
_templateObject3$a = function _templateObject3() {
|
|
6222
6391
|
return data;
|
|
6223
6392
|
};
|
|
6224
6393
|
|
|
6225
6394
|
return data;
|
|
6226
6395
|
}
|
|
6227
6396
|
|
|
6228
|
-
function _templateObject2$
|
|
6397
|
+
function _templateObject2$c() {
|
|
6229
6398
|
var data = taggedTemplateLiteral(["\n font-family: ", ";\n font-weight: normal;\n font-size: ", ";\n line-height: ", ";\n"]);
|
|
6230
6399
|
|
|
6231
|
-
_templateObject2$
|
|
6400
|
+
_templateObject2$c = function _templateObject2() {
|
|
6232
6401
|
return data;
|
|
6233
6402
|
};
|
|
6234
6403
|
|
|
6235
6404
|
return data;
|
|
6236
6405
|
}
|
|
6237
6406
|
|
|
6238
|
-
function _templateObject$
|
|
6407
|
+
function _templateObject$i() {
|
|
6239
6408
|
var data = taggedTemplateLiteral(["\n padding: 7px;\n border-radius: ", ";\n border-width:1px;\n border-style:solid;\n display:flex;\n align-items:center;\n position:relative;\n\n ", "\n\n svg {\n margin-right: 8px;\n display: block;\n }\n"]);
|
|
6240
6409
|
|
|
6241
|
-
_templateObject$
|
|
6410
|
+
_templateObject$i = function _templateObject() {
|
|
6242
6411
|
return data;
|
|
6243
6412
|
};
|
|
6244
6413
|
|
|
6245
6414
|
return data;
|
|
6246
6415
|
}
|
|
6247
|
-
var Div = styled.div(_templateObject$
|
|
6416
|
+
var Div = styled.div(_templateObject$i(), theme.defaultRadius, function (props) {
|
|
6248
6417
|
return props.useClose && "\n padding-right: 32px;\n ";
|
|
6249
6418
|
});
|
|
6250
|
-
var Title$2 = styled.h5(_templateObject2$
|
|
6251
|
-
var Content = styled.p(_templateObject3$
|
|
6252
|
-
var SmallContent = styled(Content)(_templateObject4$
|
|
6419
|
+
var Title$2 = styled.h5(_templateObject2$c(), theme.font.main, theme.font.medium.size, theme.font.big.lineHeight);
|
|
6420
|
+
var Content = styled.p(_templateObject3$a(), theme.font.extraSmall.size, theme.font.small.lineHeight);
|
|
6421
|
+
var SmallContent = styled(Content)(_templateObject4$a(), theme.font.small.size, theme.font.small.lineHeight);
|
|
6253
6422
|
var Close = styled.button.attrs(function (props) {
|
|
6254
6423
|
return {
|
|
6255
6424
|
type: 'button'
|
|
@@ -6335,5 +6504,5 @@ var index = {
|
|
|
6335
6504
|
Error: AlertError
|
|
6336
6505
|
};
|
|
6337
6506
|
|
|
6338
|
-
export { theme as Theme, Exported as Button, Dropdown$1 as ButtonDropdown, ButtonGroup, Form, Input, Password, CheckBox, RadioBox, Dropdown, CustomDropdown, Tag as TagInput, InputColor, Uploader, Toggle, TimePicker, DropUploader, Title, SubTitle, ThirdTitle, Text, index as Alert, Spacer, Icons as Icon, logo as Logo, dspwLoading as Loading };
|
|
6507
|
+
export { theme as Theme, ButtonIcon, Exported as Button, Dropdown$1 as ButtonDropdown, ButtonGroup, Form, Input, Password, CheckBox, RadioBox, Dropdown, CustomDropdown, Tag as TagInput, InputColor, Uploader, Toggle, TimePicker, DropUploader, Title, SubTitle, ThirdTitle, Text, index as Alert, Spacer, Icons as Icon, logo as Logo, dspwLoading as Loading };
|
|
6339
6508
|
//# sourceMappingURL=index.es.js.map
|