@dspworkplace/ui 1.5.33 → 1.5.34

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 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,174 @@ 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:fit-content;\n padding:12px;\n white-space: nowrap;\n align-items:center;\n gap: ", "\n display:flex;\n visibility: hidden;\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
+ var bounds = contentRef.current.getBoundingClientRect();
6247
+ var windowWidth = window.innerWidth;
6248
+ var windowHeight = window.innerHeight;
6249
+
6250
+ if (bounds.right > windowWidth) {
6251
+ setDir('left');
6252
+ return;
6253
+ } else {
6254
+ return;
6255
+ }
6256
+
6257
+ if (bounds.left < 0) {
6258
+ setDir('bottom');
6259
+ return;
6260
+ }
6261
+
6262
+ if (bounds.bottom > windowHeight) {
6263
+ setDir('top');
6264
+ return;
6265
+ }
6266
+ }, [contentRef]);
6267
+ return /*#__PURE__*/React.createElement(ListContent, {
6268
+ ref: contentRef,
6269
+ direction: dir,
6270
+ spaceBetween: spaceBetween,
6271
+ childrenQuantity: children.length
6272
+ }, children);
6273
+ };
6274
+
6275
+ ButtonList.defaultProps = {
6276
+ direction: 'auto',
6277
+ spaceBetween: '8px'
6278
+ };
6279
+ ButtonIcon.List = ButtonList;
6280
+
6113
6281
  var _ref$1t = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
6114
6282
  id: "clip-path"
6115
6283
  }, /*#__PURE__*/React.createElement("path", {
@@ -6205,51 +6373,51 @@ function _templateObject5$7() {
6205
6373
  return data;
6206
6374
  }
6207
6375
 
6208
- function _templateObject4$9() {
6376
+ function _templateObject4$a() {
6209
6377
  var data = taggedTemplateLiteral(["\n font-size: ", ";\n line-height: ", ";\n"]);
6210
6378
 
6211
- _templateObject4$9 = function _templateObject4() {
6379
+ _templateObject4$a = function _templateObject4() {
6212
6380
  return data;
6213
6381
  };
6214
6382
 
6215
6383
  return data;
6216
6384
  }
6217
6385
 
6218
- function _templateObject3$9() {
6386
+ function _templateObject3$a() {
6219
6387
  var data = taggedTemplateLiteral(["\n font-size: ", ";\n line-height: ", ";\n"]);
6220
6388
 
6221
- _templateObject3$9 = function _templateObject3() {
6389
+ _templateObject3$a = function _templateObject3() {
6222
6390
  return data;
6223
6391
  };
6224
6392
 
6225
6393
  return data;
6226
6394
  }
6227
6395
 
6228
- function _templateObject2$b() {
6396
+ function _templateObject2$c() {
6229
6397
  var data = taggedTemplateLiteral(["\n font-family: ", ";\n font-weight: normal;\n font-size: ", ";\n line-height: ", ";\n"]);
6230
6398
 
6231
- _templateObject2$b = function _templateObject2() {
6399
+ _templateObject2$c = function _templateObject2() {
6232
6400
  return data;
6233
6401
  };
6234
6402
 
6235
6403
  return data;
6236
6404
  }
6237
6405
 
6238
- function _templateObject$h() {
6406
+ function _templateObject$i() {
6239
6407
  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
6408
 
6241
- _templateObject$h = function _templateObject() {
6409
+ _templateObject$i = function _templateObject() {
6242
6410
  return data;
6243
6411
  };
6244
6412
 
6245
6413
  return data;
6246
6414
  }
6247
- var Div = styled.div(_templateObject$h(), theme.defaultRadius, function (props) {
6415
+ var Div = styled.div(_templateObject$i(), theme.defaultRadius, function (props) {
6248
6416
  return props.useClose && "\n padding-right: 32px;\n ";
6249
6417
  });
6250
- var Title$2 = styled.h5(_templateObject2$b(), theme.font.main, theme.font.medium.size, theme.font.big.lineHeight);
6251
- var Content = styled.p(_templateObject3$9(), theme.font.extraSmall.size, theme.font.small.lineHeight);
6252
- var SmallContent = styled(Content)(_templateObject4$9(), theme.font.small.size, theme.font.small.lineHeight);
6418
+ var Title$2 = styled.h5(_templateObject2$c(), theme.font.main, theme.font.medium.size, theme.font.big.lineHeight);
6419
+ var Content = styled.p(_templateObject3$a(), theme.font.extraSmall.size, theme.font.small.lineHeight);
6420
+ var SmallContent = styled(Content)(_templateObject4$a(), theme.font.small.size, theme.font.small.lineHeight);
6253
6421
  var Close = styled.button.attrs(function (props) {
6254
6422
  return {
6255
6423
  type: 'button'
@@ -6335,5 +6503,5 @@ var index = {
6335
6503
  Error: AlertError
6336
6504
  };
6337
6505
 
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 };
6506
+ 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
6507
  //# sourceMappingURL=index.es.js.map