labsense-ui-kit 1.2.40 → 1.2.42

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.
@@ -1,5 +1,6 @@
1
1
  import useClickOutside from './useClickOutside';
2
+ import useCopyToClipboard from './useCopyToClipboard';
2
3
  import useCustomModal from './useCustomModal';
3
4
  import useNotification from './useNotification';
4
5
  import useTheme from './useTheme';
5
- export { useClickOutside, useCustomModal, useNotification, useTheme };
6
+ export { useClickOutside, useCopyToClipboard, useCustomModal, useNotification, useTheme };
@@ -0,0 +1,4 @@
1
+ declare const useCopyToClipboard: () => {
2
+ copyToClipboard: (str: string) => boolean;
3
+ };
4
+ export default useCopyToClipboard;
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ import { ButtonCarousel } from './Carousel';
5
5
  import { Container, Span } from './Container&Span/StyledComponents';
6
6
  import { DatePicker } from './Date-Time';
7
7
  import { ButtonDropdown, MultiSelectDropdown, OptionComponent, SelectedOption, SelectOption, DropdownMenu, Options } from './Dropdown';
8
- import { useClickOutside, useCustomModal, useNotification, useTheme } from './hooks';
8
+ import { useClickOutside, useCopyToClipboard, useCustomModal, useNotification, useTheme } from './hooks';
9
9
  import { Icon, IconNames } from './Icons';
10
10
  import { SearchBox, TextArea, TextField, TextFieldWithDropdown, CheckBox } from './Inputs';
11
11
  import { CircularLoader, Loader } from './Loader';
@@ -24,7 +24,7 @@ export { ButtonCarousel };
24
24
  export { Container, Span };
25
25
  export { DatePicker };
26
26
  export { ButtonDropdown, MultiSelectDropdown, OptionComponent, SelectedOption, SelectOption, DropdownMenu, Options };
27
- export { useClickOutside, useCustomModal, useNotification, useTheme };
27
+ export { useClickOutside, useCopyToClipboard, useCustomModal, useNotification, useTheme };
28
28
  export { Icon, IconNames };
29
29
  export { SearchBox, TextArea, TextField, TextFieldWithDropdown, CheckBox };
30
30
  export { CircularLoader, Loader };
package/dist/index.js CHANGED
@@ -4911,6 +4911,33 @@ var useClickOutside = function useClickOutside(elRef, elCallback) {
4911
4911
  }, [elCallback, elRef]);
4912
4912
  };
4913
4913
 
4914
+ var useCopyToClipboard = function useCopyToClipboard() {
4915
+ var copyToClipboard = React.useCallback(function (str) {
4916
+ var el = document.createElement('textarea');
4917
+ el.value = str;
4918
+ el.setAttribute('readonly', '');
4919
+ el.style.position = 'absolute';
4920
+ el.style.left = '-9999px';
4921
+ document.body.appendChild(el);
4922
+ var selection = document.getSelection();
4923
+ if (selection) {
4924
+ var selected = selection.rangeCount > 0 ? selection.getRangeAt(0) : false;
4925
+ el.select();
4926
+ var success = document.execCommand('copy');
4927
+ document.body.removeChild(el);
4928
+ if (selected) {
4929
+ selection.removeAllRanges();
4930
+ selection.addRange(selected);
4931
+ }
4932
+ return success;
4933
+ }
4934
+ return false;
4935
+ }, []);
4936
+ return {
4937
+ copyToClipboard: copyToClipboard
4938
+ };
4939
+ };
4940
+
4914
4941
  var _templateObject, _templateObject2;
4915
4942
  var ModalOverlay = styled__default.div(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n display: flex;\n align-items: center;\n justify-content: center;\n font-family: NotoSans, sans-serif;\n z-index: 9999;\n backdrop-filter: blur(4px);\n"])));
4916
4943
  var ModalContainer = styled__default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n background: ", ";\n box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);\n border-radius: 8px;\n max-height: 100vh;\n max-width: ", ";\n overflow: visible;\n"])), function (_ref) {
@@ -5990,8 +6017,8 @@ var StyledButton = styled__default.button(_templateObject5$1 || (_templateObject
5990
6017
  return '';
5991
6018
  }
5992
6019
  }, function (_ref16) {
5993
- var color = _ref16.color;
5994
- return color;
6020
+ var $color = _ref16.$color;
6021
+ return $color;
5995
6022
  });
5996
6023
  var ButtonText = styled__default.span(_templateObject6$1 || (_templateObject6$1 = _taggedTemplateLiteralLoose(["\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n white-space: nowrap;\n"])), function (_ref17) {
5997
6024
  var $fontFamily = _ref17.$fontFamily;
@@ -8971,7 +8998,7 @@ var Sidebar = function Sidebar(_ref16) {
8971
8998
  "$color": themeColors.text.medium
8972
8999
  }, child.label), _getTotalNotifications(child) > 0 && React__default.createElement(NotificationBadge, {
8973
9000
  "$position": 'unset'
8974
- }, _getTotalNotifications(child))));
9001
+ }, _getTotalNotifications(child) > 99 ? '99+' : _getTotalNotifications(child))));
8975
9002
  });
8976
9003
  var renderChildLinks = function renderChildLinks(children) {
8977
9004
  return React__default.createElement(Container, {
@@ -9030,7 +9057,7 @@ var Sidebar = function Sidebar(_ref16) {
9030
9057
  size: 20,
9031
9058
  weight: item.iconWeight,
9032
9059
  color: isHovered || isActive ? themeColors.text.white : themeColors.text.medium
9033
- })), _getTotalNotifications(item) > 0 && React__default.createElement(NotificationBadge, null, _getTotalNotifications(item))), React__default.createElement(TextContainer, {
9060
+ })), _getTotalNotifications(item) > 0 && React__default.createElement(NotificationBadge, null, _getTotalNotifications(item) > 99 ? '99+' : _getTotalNotifications(item))), React__default.createElement(TextContainer, {
9034
9061
  "$isExpanded": isExpanded,
9035
9062
  "$fontSize": '14px'
9036
9063
  }, item.label)), hasChildren && React__default.createElement(Container, {
@@ -9604,6 +9631,7 @@ exports.themes = themes;
9604
9631
  exports.timeAgo = timeAgo;
9605
9632
  exports.timeStringToSeconds = timeStringToSeconds;
9606
9633
  exports.useClickOutside = useClickOutside;
9634
+ exports.useCopyToClipboard = useCopyToClipboard;
9607
9635
  exports.useCustomModal = useCustomModal;
9608
9636
  exports.useNotification = useNotification;
9609
9637
  exports.useTheme = useTheme;