@activecollab/components 1.0.249 → 1.0.251

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.
Files changed (32) hide show
  1. package/dist/cjs/components/ComboBox/ComboBox.js +26 -0
  2. package/dist/cjs/components/ComboBox/ComboBox.js.map +1 -1
  3. package/dist/cjs/components/Icons/collection/Gift.js +48 -0
  4. package/dist/cjs/components/Icons/collection/Gift.js.map +1 -0
  5. package/dist/cjs/components/Icons/collection/index.js +7 -0
  6. package/dist/cjs/components/Icons/collection/index.js.map +1 -1
  7. package/dist/cjs/components/Select/Option/Option.js.map +1 -1
  8. package/dist/cjs/components/Select/OptionContent/OptionContent.js +6 -2
  9. package/dist/cjs/components/Select/OptionContent/OptionContent.js.map +1 -1
  10. package/dist/esm/components/ComboBox/ComboBox.d.ts.map +1 -1
  11. package/dist/esm/components/ComboBox/ComboBox.js +26 -0
  12. package/dist/esm/components/ComboBox/ComboBox.js.map +1 -1
  13. package/dist/esm/components/Icons/collection/Gift.d.ts +23 -0
  14. package/dist/esm/components/Icons/collection/Gift.d.ts.map +1 -0
  15. package/dist/esm/components/Icons/collection/Gift.js +41 -0
  16. package/dist/esm/components/Icons/collection/Gift.js.map +1 -0
  17. package/dist/esm/components/Icons/collection/index.d.ts +1 -0
  18. package/dist/esm/components/Icons/collection/index.d.ts.map +1 -1
  19. package/dist/esm/components/Icons/collection/index.js +1 -0
  20. package/dist/esm/components/Icons/collection/index.js.map +1 -1
  21. package/dist/esm/components/Select/Option/Option.d.ts +4 -0
  22. package/dist/esm/components/Select/Option/Option.d.ts.map +1 -1
  23. package/dist/esm/components/Select/Option/Option.js.map +1 -1
  24. package/dist/esm/components/Select/OptionContent/OptionContent.d.ts +1 -1
  25. package/dist/esm/components/Select/OptionContent/OptionContent.d.ts.map +1 -1
  26. package/dist/esm/components/Select/OptionContent/OptionContent.js +6 -2
  27. package/dist/esm/components/Select/OptionContent/OptionContent.js.map +1 -1
  28. package/dist/index.js +182 -115
  29. package/dist/index.js.map +1 -1
  30. package/dist/index.min.js +1 -1
  31. package/dist/index.min.js.map +1 -1
  32. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3876,6 +3876,44 @@
3876
3876
  FolderOutlineIcon.displayName = "FolderOutlineIcon";
3877
3877
  var FolderOutlineIcon$1 = FolderOutlineIcon;
3878
3878
 
3879
+ /**
3880
+ * @component GiftIcon
3881
+ * @description
3882
+ *
3883
+ * The React Icon component is a visual element that displays an icon to represent a concept, object, or action.
3884
+ * The Icon component is
3885
+ * customizable, allowing for variations in size, color, and style to fit the needs of the application.
3886
+ *
3887
+ *
3888
+ * @example
3889
+ * return (
3890
+ * <GiftIcon className="mr-2" />
3891
+ * )
3892
+ *
3893
+ * @see
3894
+ * https://system.activecollab.com/?path=/story/foundation-icons-icons--icons
3895
+ * @see
3896
+ * https://design.activecollab.com/docs/foundations/icons
3897
+ */
3898
+ var GiftIcon = /*#__PURE__*/React__default["default"].forwardRef(function (props, svgRef) {
3899
+ return /*#__PURE__*/React__default["default"].createElement("svg", _extends({
3900
+ width: 24,
3901
+ height: 24,
3902
+ viewBox: "0 0 24 24",
3903
+ xmlns: "http://www.w3.org/2000/svg",
3904
+ "data-testid": "GiftIcon",
3905
+ fill: "var(--color-theme-600)",
3906
+ focusable: false,
3907
+ ref: svgRef
3908
+ }, props), /*#__PURE__*/React__default["default"].createElement("path", {
3909
+ fillRule: "evenodd",
3910
+ clipRule: "evenodd",
3911
+ d: "M22 12v8a2 2 0 01-2 2H4a2 2 0 01-2-2v-8a1 1 0 01-1-1V8a2 2 0 012-2h3.17A3 3 0 019 2c1 0 1.88.5 2.43 1.24v-.01L12 4l.57-.77v.01C13.12 2.5 14 2 15 2a3 3 0 012.83 4H21a2 2 0 012 2v3a1 1 0 01-1 1zM4 20h7v-8H4v8zm16 0v-8h-7v8h7zM9 4a1 1 0 100 2 1 1 0 000-2zm6 0a1 1 0 100 2 1 1 0 000-2zM3 8v2h8V8H3zm10 0v2h8V8h-8z"
3912
+ }));
3913
+ });
3914
+ GiftIcon.displayName = "GiftIcon";
3915
+ var GiftIcon$1 = GiftIcon;
3916
+
3879
3917
  /**
3880
3918
  * @component HelpIcon
3881
3919
  * @description
@@ -10378,6 +10416,119 @@
10378
10416
  })(["margin:0 0 0 5px;line-height:18px;flex-shrink:0;"]);
10379
10417
  StyledAdditionalInfo.displayName = "StyledAdditionalInfo";
10380
10418
 
10419
+ var StyledMultiAvatarImg = styled.css(["width:inherit;height:inherit;"]);
10420
+ var StyledMultiAvatarInner = styled__default["default"].div.withConfig({
10421
+ displayName: "Styles__StyledMultiAvatarInner",
10422
+ componentId: "sc-k6nldn-0"
10423
+ })(["overflow:hidden;position:absolute;"]);
10424
+ var StyledMultiAvatar = styled__default["default"].div.withConfig({
10425
+ displayName: "Styles__StyledMultiAvatar",
10426
+ componentId: "sc-k6nldn-1"
10427
+ })(["", " border-radius:100%;position:relative;overflow:hidden;", " ", " ", ""], BoxSizingStyle, function (props) {
10428
+ return props.$urlCount === 2 && styled.css(["", ":first-child{left:0;img{transform:translateX(-20%);}}", ":last-child{right:0;img{transform:translateX(-20%);}}"], StyledMultiAvatarInner, StyledMultiAvatarInner);
10429
+ }, function (props) {
10430
+ return props.$urlCount === 3 && styled.css(["", ":nth-child(1){left:0;img{transform:translateX(-20%);}}", ":nth-child(2){right:0;top:0;img{", "}}", ":nth-child(3){right:0;bottom:0;img{", "}}"], StyledMultiAvatarInner, StyledMultiAvatarInner, StyledMultiAvatarImg, StyledMultiAvatarInner, StyledMultiAvatarImg);
10431
+ }, function (props) {
10432
+ return props.$urlCount > 3 && styled.css(["img{", "}", ":nth-child(1){left:0;}", ":nth-child(2){left:0;bottom:0;}", ":nth-child(3){right:0;top:0;}", ":nth-child(4){right:0;bottom:0;}"], StyledMultiAvatarImg, StyledMultiAvatarInner, StyledMultiAvatarInner, StyledMultiAvatarInner, StyledMultiAvatarInner);
10433
+ });
10434
+ StyledMultiAvatar.displayName = "StyledMultiAvatar";
10435
+ StyledMultiAvatarInner.displayName = "StyledMultiAvatarInner";
10436
+
10437
+ /**
10438
+ * @component MultiAvatar
10439
+ * @description
10440
+ * The MultiAvatar component is used to represent user, and displays the profile picture, initials or fallback icon.
10441
+ *
10442
+ * @prop {url} - The image urls of the MultiAvatar.
10443
+ * @prop {size} - controls the size of an MultiAvatar (width and height) in pixels.
10444
+ * @prop {alt} - alt attributes of the imgs.
10445
+ *
10446
+ * @example
10447
+ * <MultiAvatar
10448
+ * url={["https://faces-img.xcdn.link/image-lorem-face-954.jpg", "https://faces-img.xcdn.link/image-lorem-face-953.jpg"]}
10449
+ * alt={["Profile picture of John", "Profile picture of Sarah"]} />
10450
+ *
10451
+ * @example
10452
+ * <MultiAvatar
10453
+ * url={["https://faces-img.xcdn.link/image-lorem-face-954.jpg", "https://faces-img.xcdn.link/image-lorem-face-953.jpg"]}
10454
+ * alt={["Profile picture of John", "Profile picture of Sarah"]}
10455
+ * >
10456
+ * <Badge />
10457
+ * </MultiAvatar>
10458
+ *
10459
+ * @see
10460
+ * https://system.activecollab.com/?path=/story/components-button-indicators-avatar--avatar
10461
+ * @see
10462
+ * https://design.activecollab.com/docs/components/avatar
10463
+ */
10464
+ var MultiAvatar = function MultiAvatar(_ref) {
10465
+ var url = _ref.url,
10466
+ alt = _ref.alt,
10467
+ _ref$size = _ref.size,
10468
+ size = _ref$size === void 0 ? 24 : _ref$size,
10469
+ className = _ref.className,
10470
+ children = _ref.children;
10471
+ var setSize = React.useCallback(function (i) {
10472
+ switch (url.length) {
10473
+ case 1:
10474
+ return {
10475
+ width: "".concat(size, "px"),
10476
+ height: "".concat(size, "px")
10477
+ };
10478
+ case 2:
10479
+ return {
10480
+ width: "".concat(size / 2, "px"),
10481
+ height: "".concat(size, "px")
10482
+ };
10483
+ case 3:
10484
+ if (i === 0) {
10485
+ return {
10486
+ width: "".concat(size / 2, "px"),
10487
+ height: "".concat(size, "px")
10488
+ };
10489
+ } else {
10490
+ return {
10491
+ width: "".concat(size / 2, "px"),
10492
+ height: "".concat(size / 2, "px")
10493
+ };
10494
+ }
10495
+ default:
10496
+ return {
10497
+ width: "".concat(size / 2, "px"),
10498
+ height: "".concat(size / 2, "px")
10499
+ };
10500
+ }
10501
+ }, [size, url.length]);
10502
+ var slicedUrl = React.useMemo(function () {
10503
+ if ((url === null || url === void 0 ? void 0 : url.length) > 4) {
10504
+ return url.slice(0, 4);
10505
+ }
10506
+ return url;
10507
+ }, [url]);
10508
+ return /*#__PURE__*/React__default["default"].createElement("span", {
10509
+ className: "tw-relative tw-inline-flex"
10510
+ }, /*#__PURE__*/React__default["default"].createElement(StyledMultiAvatar, {
10511
+ style: {
10512
+ width: "".concat(size, "px"),
10513
+ height: "".concat(size, "px")
10514
+ },
10515
+ className: className,
10516
+ $urlCount: url.length
10517
+ }, slicedUrl.map(function (v, i) {
10518
+ return /*#__PURE__*/React__default["default"].createElement(StyledMultiAvatarInner, {
10519
+ style: setSize(i),
10520
+ className: "c-multi-avatar__wrapper",
10521
+ key: "avatar_".concat(i)
10522
+ }, /*#__PURE__*/React__default["default"].createElement("img", {
10523
+ src: v,
10524
+ alt: alt && alt[i] ? alt[i] : "avatar_".concat(i),
10525
+ width: size,
10526
+ height: size
10527
+ }));
10528
+ })), children);
10529
+ };
10530
+ MultiAvatar.displayName = "MultiAvatar";
10531
+
10381
10532
  var OptionContent = function OptionContent(_ref) {
10382
10533
  var imageUrl = _ref.imageUrl,
10383
10534
  color = _ref.color,
@@ -10387,10 +10538,13 @@
10387
10538
  return /*#__PURE__*/React__default["default"].createElement(StyledOptionContentWrapper, null, imageUrl || color ? /*#__PURE__*/React__default["default"].createElement(StyledOptionIndicator, {
10388
10539
  className: "c-option--label",
10389
10540
  backgroundColor: color
10390
- }, imageUrl ? /*#__PURE__*/React__default["default"].createElement(Avatar, {
10541
+ }, imageUrl ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, Array.isArray(imageUrl) ? /*#__PURE__*/React__default["default"].createElement(MultiAvatar, {
10542
+ className: "c-option--multi-avatar",
10543
+ url: imageUrl
10544
+ }) : /*#__PURE__*/React__default["default"].createElement(Avatar, {
10391
10545
  className: "c-option--avatar",
10392
10546
  url: imageUrl
10393
- }) : null) : null, /*#__PURE__*/React__default["default"].createElement(StyledOptionText, {
10547
+ })) : null) : null, /*#__PURE__*/React__default["default"].createElement(StyledOptionText, {
10394
10548
  className: "c-option--text",
10395
10549
  textColor: textColor
10396
10550
  }, name), additionalInfo ? /*#__PURE__*/React__default["default"].createElement(StyledAdditionalInfo, null, additionalInfo) : null);
@@ -11137,119 +11291,6 @@
11137
11291
  };
11138
11292
  MenuSelector.displayName = "MenuSelector";
11139
11293
 
11140
- var StyledMultiAvatarImg = styled.css(["width:inherit;height:inherit;"]);
11141
- var StyledMultiAvatarInner = styled__default["default"].div.withConfig({
11142
- displayName: "Styles__StyledMultiAvatarInner",
11143
- componentId: "sc-k6nldn-0"
11144
- })(["overflow:hidden;position:absolute;"]);
11145
- var StyledMultiAvatar = styled__default["default"].div.withConfig({
11146
- displayName: "Styles__StyledMultiAvatar",
11147
- componentId: "sc-k6nldn-1"
11148
- })(["", " border-radius:100%;position:relative;overflow:hidden;", " ", " ", ""], BoxSizingStyle, function (props) {
11149
- return props.$urlCount === 2 && styled.css(["", ":first-child{left:0;img{transform:translateX(-20%);}}", ":last-child{right:0;img{transform:translateX(-20%);}}"], StyledMultiAvatarInner, StyledMultiAvatarInner);
11150
- }, function (props) {
11151
- return props.$urlCount === 3 && styled.css(["", ":nth-child(1){left:0;img{transform:translateX(-20%);}}", ":nth-child(2){right:0;top:0;img{", "}}", ":nth-child(3){right:0;bottom:0;img{", "}}"], StyledMultiAvatarInner, StyledMultiAvatarInner, StyledMultiAvatarImg, StyledMultiAvatarInner, StyledMultiAvatarImg);
11152
- }, function (props) {
11153
- return props.$urlCount > 3 && styled.css(["img{", "}", ":nth-child(1){left:0;}", ":nth-child(2){left:0;bottom:0;}", ":nth-child(3){right:0;top:0;}", ":nth-child(4){right:0;bottom:0;}"], StyledMultiAvatarImg, StyledMultiAvatarInner, StyledMultiAvatarInner, StyledMultiAvatarInner, StyledMultiAvatarInner);
11154
- });
11155
- StyledMultiAvatar.displayName = "StyledMultiAvatar";
11156
- StyledMultiAvatarInner.displayName = "StyledMultiAvatarInner";
11157
-
11158
- /**
11159
- * @component MultiAvatar
11160
- * @description
11161
- * The MultiAvatar component is used to represent user, and displays the profile picture, initials or fallback icon.
11162
- *
11163
- * @prop {url} - The image urls of the MultiAvatar.
11164
- * @prop {size} - controls the size of an MultiAvatar (width and height) in pixels.
11165
- * @prop {alt} - alt attributes of the imgs.
11166
- *
11167
- * @example
11168
- * <MultiAvatar
11169
- * url={["https://faces-img.xcdn.link/image-lorem-face-954.jpg", "https://faces-img.xcdn.link/image-lorem-face-953.jpg"]}
11170
- * alt={["Profile picture of John", "Profile picture of Sarah"]} />
11171
- *
11172
- * @example
11173
- * <MultiAvatar
11174
- * url={["https://faces-img.xcdn.link/image-lorem-face-954.jpg", "https://faces-img.xcdn.link/image-lorem-face-953.jpg"]}
11175
- * alt={["Profile picture of John", "Profile picture of Sarah"]}
11176
- * >
11177
- * <Badge />
11178
- * </MultiAvatar>
11179
- *
11180
- * @see
11181
- * https://system.activecollab.com/?path=/story/components-button-indicators-avatar--avatar
11182
- * @see
11183
- * https://design.activecollab.com/docs/components/avatar
11184
- */
11185
- var MultiAvatar = function MultiAvatar(_ref) {
11186
- var url = _ref.url,
11187
- alt = _ref.alt,
11188
- _ref$size = _ref.size,
11189
- size = _ref$size === void 0 ? 24 : _ref$size,
11190
- className = _ref.className,
11191
- children = _ref.children;
11192
- var setSize = React.useCallback(function (i) {
11193
- switch (url.length) {
11194
- case 1:
11195
- return {
11196
- width: "".concat(size, "px"),
11197
- height: "".concat(size, "px")
11198
- };
11199
- case 2:
11200
- return {
11201
- width: "".concat(size / 2, "px"),
11202
- height: "".concat(size, "px")
11203
- };
11204
- case 3:
11205
- if (i === 0) {
11206
- return {
11207
- width: "".concat(size / 2, "px"),
11208
- height: "".concat(size, "px")
11209
- };
11210
- } else {
11211
- return {
11212
- width: "".concat(size / 2, "px"),
11213
- height: "".concat(size / 2, "px")
11214
- };
11215
- }
11216
- default:
11217
- return {
11218
- width: "".concat(size / 2, "px"),
11219
- height: "".concat(size / 2, "px")
11220
- };
11221
- }
11222
- }, [size, url.length]);
11223
- var slicedUrl = React.useMemo(function () {
11224
- if ((url === null || url === void 0 ? void 0 : url.length) > 4) {
11225
- return url.slice(0, 4);
11226
- }
11227
- return url;
11228
- }, [url]);
11229
- return /*#__PURE__*/React__default["default"].createElement("span", {
11230
- className: "tw-relative tw-inline-flex"
11231
- }, /*#__PURE__*/React__default["default"].createElement(StyledMultiAvatar, {
11232
- style: {
11233
- width: "".concat(size, "px"),
11234
- height: "".concat(size, "px")
11235
- },
11236
- className: className,
11237
- $urlCount: url.length
11238
- }, slicedUrl.map(function (v, i) {
11239
- return /*#__PURE__*/React__default["default"].createElement(StyledMultiAvatarInner, {
11240
- style: setSize(i),
11241
- className: "c-multi-avatar__wrapper",
11242
- key: "avatar_".concat(i)
11243
- }, /*#__PURE__*/React__default["default"].createElement("img", {
11244
- src: v,
11245
- alt: alt && alt[i] ? alt[i] : "avatar_".concat(i),
11246
- width: size,
11247
- height: size
11248
- }));
11249
- })), children);
11250
- };
11251
- MultiAvatar.displayName = "MultiAvatar";
11252
-
11253
11294
  var StyledTextarea = styled__default["default"].textarea.withConfig({
11254
11295
  displayName: "Styles__StyledTextarea",
11255
11296
  componentId: "sc-m6jqw8-0"
@@ -13853,6 +13894,31 @@
13853
13894
  variant: size === "small" ? "Caption 1" : size === "regular" ? "Body 2" : "Body 1"
13854
13895
  }, typeof hiddenNumberText === "function" ? hiddenNumberText(_hidden) : "+".concat(_hidden)));
13855
13896
  }
13897
+ if (type === "single" && selected) {
13898
+ var optionItem;
13899
+ options.forEach(function (option) {
13900
+ if (isOptionGroup(option)) {
13901
+ optionItem = option.options.find(function (child) {
13902
+ return child.id === selected;
13903
+ });
13904
+ } else if (!optionItem && option.id === selected) {
13905
+ optionItem = option;
13906
+ }
13907
+ });
13908
+ if (optionItem && optionItem.image) {
13909
+ var avatarSize = size === "big" ? 22 : size === "regular" ? 18 : 14;
13910
+ if (Array.isArray(optionItem.image)) {
13911
+ return /*#__PURE__*/React__default["default"].createElement(MultiAvatar, {
13912
+ url: optionItem.image,
13913
+ size: avatarSize
13914
+ });
13915
+ }
13916
+ return /*#__PURE__*/React__default["default"].createElement(Avatar, {
13917
+ url: optionItem.image,
13918
+ size: avatarSize
13919
+ });
13920
+ }
13921
+ }
13856
13922
  return undefined;
13857
13923
  }, [type, selected, options, open, limitChips, hiddenNumberText, renderChipAdornment, size]);
13858
13924
  var showXIcon = Array.isArray(selected) && type === "multiple" && selected.length > 0;
@@ -15555,6 +15621,7 @@
15555
15621
  exports.FolderMoveIcon = FolderMoveIcon$1;
15556
15622
  exports.FolderOutlineIcon = FolderOutlineIcon$1;
15557
15623
  exports.FromElement = FromElement;
15624
+ exports.GiftIcon = GiftIcon$1;
15558
15625
  exports.GlobalAddButton = GlobalAddButton;
15559
15626
  exports.GlobalStyle = GlobalStyle;
15560
15627
  exports.Header = Header;