@helpdice/ui 2.1.5 → 2.1.8

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 (42) hide show
  1. package/dist/auto-complete/index.js +12 -10
  2. package/dist/button/button.d.ts +1 -1
  3. package/dist/button/index.js +73 -16
  4. package/dist/button/styles.d.ts +1 -0
  5. package/dist/carousal/index.js +73 -16
  6. package/dist/copy-to-clipboard/clipboard.d.ts +2 -0
  7. package/dist/copy-to-clipboard/copy.d.ts +2 -0
  8. package/dist/copy-to-clipboard/index.d.ts +2 -0
  9. package/dist/copy-to-clipboard/index.js +1717 -0
  10. package/dist/copy-to-clipboard/toggle-selection.d.ts +1 -0
  11. package/dist/html-renderer/index.js +35 -12
  12. package/dist/index.d.ts +3 -2
  13. package/dist/index.js +539 -220
  14. package/dist/input/index.js +12 -10
  15. package/dist/input/input-props.d.ts +1 -0
  16. package/dist/modal/index.js +73 -16
  17. package/dist/notetip/index.js +690 -0
  18. package/dist/notetip/{index.d.ts → note-tip.d.ts} +2 -2
  19. package/dist/table/index.js +990 -930
  20. package/esm/button/button.d.ts +1 -1
  21. package/esm/button/button.js +51 -5
  22. package/esm/button/styles.d.ts +1 -0
  23. package/esm/button/styles.js +22 -11
  24. package/esm/copy-to-clipboard/clipboard.d.ts +2 -0
  25. package/esm/copy-to-clipboard/copy.d.ts +2 -0
  26. package/esm/copy-to-clipboard/copy.js +105 -0
  27. package/esm/copy-to-clipboard/index.d.ts +2 -0
  28. package/esm/copy-to-clipboard/index.js +2 -0
  29. package/esm/copy-to-clipboard/toggle-selection.d.ts +1 -0
  30. package/esm/copy-to-clipboard/toggle-selection.js +31 -0
  31. package/esm/index.d.ts +3 -2
  32. package/esm/index.js +3 -2
  33. package/esm/input/input-field.js +12 -10
  34. package/esm/input/input-props.d.ts +1 -0
  35. package/esm/notetip/index.js +2 -97
  36. package/esm/notetip/{index.d.ts → note-tip.d.ts} +2 -2
  37. package/esm/notetip/note-tip.js +97 -0
  38. package/esm/table/table-body.js +2 -2
  39. package/esm/table/table-cell.js +1 -1
  40. package/esm/table/table-head.js +4 -2
  41. package/esm/table/table.js +0 -1
  42. package/package.json +14 -7
@@ -4,7 +4,7 @@ interface Props {
4
4
  color?: ButtonTypes;
5
5
  ghost?: boolean;
6
6
  loading?: boolean;
7
- shadow?: boolean;
7
+ shadow?: boolean | string;
8
8
  round?: boolean;
9
9
  auto?: boolean;
10
10
  effect?: boolean;
@@ -71,7 +71,8 @@ var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
71
71
  }, [theme.palette, filteredProps]),
72
72
  bg = _useMemo.bg,
73
73
  border = _useMemo.border,
74
- color = _useMemo.color;
74
+ color = _useMemo.color,
75
+ rippleColor = _useMemo.ripple;
75
76
  var hover = useMemo(function () {
76
77
  return getButtonHoverColors(theme.palette, filteredProps);
77
78
  }, [theme.palette, filteredProps]);
@@ -90,6 +91,45 @@ var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
90
91
  setDripX(0);
91
92
  setDripY(0);
92
93
  };
94
+ var createRipple = function createRipple(event) {
95
+ var button = buttonRef.current;
96
+ if (!button) return;
97
+ var rect = button.getBoundingClientRect();
98
+ var size = Math.max(rect.width, rect.height);
99
+ var x = event.clientX - rect.left - size / 2;
100
+ var y = event.clientY - rect.top - size / 2;
101
+ var rippleCount = 1; // number of rings
102
+ var rippleDelay = 500; // ms between each ripple
103
+ var _loop = function _loop() {
104
+ var ripple = document.createElement('span');
105
+ Object.assign(ripple.style, {
106
+ position: 'absolute',
107
+ borderRadius: '50%',
108
+ backgroundColor: rippleColor,
109
+ width: "".concat(size, "px"),
110
+ height: "".concat(size, "px"),
111
+ left: "".concat(x, "px"),
112
+ top: "".concat(y, "px"),
113
+ pointerEvents: 'none',
114
+ transform: 'scale(0)',
115
+ opacity: '1',
116
+ transition: "transform 600ms ease-out ".concat(i * rippleDelay, "ms, opacity 600ms ease-out ").concat(i * rippleDelay, "ms"),
117
+ zIndex: 1
118
+ });
119
+ button.appendChild(ripple);
120
+
121
+ // Force reflow to start transition
122
+ window.getComputedStyle(ripple).opacity;
123
+ ripple.style.transform = 'scale(2.5)';
124
+ ripple.style.opacity = '0';
125
+ ripple.addEventListener('transitionend', function () {
126
+ ripple.remove();
127
+ });
128
+ };
129
+ for (var i = 0; i < rippleCount; i++) {
130
+ _loop();
131
+ }
132
+ };
93
133
  var clickHandler = function clickHandler(event) {
94
134
  if (disabled || loading) return;
95
135
  var showDrip = !shadow && !ghost && effect;
@@ -100,6 +140,9 @@ var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
100
140
  setDripX(event.clientX - rect.left);
101
141
  setDripY(event.clientY - rect.top);
102
142
  }
143
+ if (shadow) {
144
+ createRipple(event);
145
+ }
103
146
  onClick && onClick(event);
104
147
  };
105
148
  var childrenWithIcon = useMemo(function () {
@@ -110,13 +153,16 @@ var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
110
153
  }, [auto, children, icon, iconRight]);
111
154
  var paddingLeft = auto ? SCALES.pl(1.15) : SCALES.pl(1.375),
112
155
  paddingRight = auto ? SCALES.pr(1.15) : SCALES.pr(1.375);
156
+
157
+ // If shadow provided is string then value other default
158
+ var btnShadow = typeof shadow === 'string' ? shadow : shadow ? theme.shadows.level.z2 : 'none';
113
159
  return /*#__PURE__*/React.createElement("button", _extends({
114
160
  ref: buttonRef,
115
161
  type: type,
116
162
  disabled: disabled,
117
163
  onClick: clickHandler
118
164
  }, props, {
119
- className: _JSXStyle.dynamic([["1558010596", [SCALES.height(2.5), round ? '50%' : theme.layout.radius, SCALES.font(0.875), color, bg, border, cursor, events, shadow ? theme.expressiveness.shadowSmall : 'none', SCALES.pl(0.727), SCALES.height(2.5), color, bg, auto ? 'min-content' : SCALES.width(10.5), auto ? 'auto' : 'initial', SCALES.height(2.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hover.color, hover.color, hover.bg, hover.border, cursor, events, shadow ? theme.expressiveness.shadowMedium : 'none', shadow ? '-1px' : '0px']]]) + " " + (props && props.className != null && props.className || useClasses('btn', className) || "")
165
+ className: _JSXStyle.dynamic([["960361315", [SCALES.height(2.5), round ? '50%' : theme.layout.radius, SCALES.font(0.875), color, bg, shadow ? 'transparent' : border, cursor, events, shadow ? btnShadow : 'none', SCALES.pl(0.727), SCALES.height(2.5), color, bg, auto ? 'min-content' : SCALES.width(10.5), auto ? 'auto' : 'initial', SCALES.height(2.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hover.color, hover.color, hover.bg, hover.border, cursor, events, btnShadow, shadow ? '-1px' : '0px']]]) + " " + (props && props.className != null && props.className || useClasses('btn', className) || "")
120
166
  }), loading && /*#__PURE__*/React.createElement(ButtonLoading, {
121
167
  color: color
122
168
  }), childrenWithIcon, dripShow && /*#__PURE__*/React.createElement(ButtonDrip, {
@@ -125,9 +171,9 @@ var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
125
171
  color: dripColor,
126
172
  onCompleted: dripCompletedHandle
127
173
  }), /*#__PURE__*/React.createElement(_JSXStyle, {
128
- id: "1558010596",
129
- dynamic: [SCALES.height(2.5), round ? '50%' : theme.layout.radius, SCALES.font(0.875), color, bg, border, cursor, events, shadow ? theme.expressiveness.shadowSmall : 'none', SCALES.pl(0.727), SCALES.height(2.5), color, bg, auto ? 'min-content' : SCALES.width(10.5), auto ? 'auto' : 'initial', SCALES.height(2.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hover.color, hover.color, hover.bg, hover.border, cursor, events, shadow ? theme.expressiveness.shadowMedium : 'none', shadow ? '-1px' : '0px']
130
- }, ".btn.__jsx-style-dynamic-selector{box-sizing:border-box;display:inline-block;line-height:".concat(SCALES.height(2.5), ";border-radius:").concat(round ? '50%' : theme.layout.radius, ";font-weight:400;font-size:").concat(SCALES.font(0.875), ";-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;outline:none;text-transform:capitalize;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center;white-space:nowrap;-webkit-transition:background-color 200ms ease 0ms,box-shadow 200ms ease 0ms, border 200ms ease 0ms,color 200ms ease 0ms;transition:background-color 200ms ease 0ms,box-shadow 200ms ease 0ms, border 200ms ease 0ms,color 200ms ease 0ms;position:relative;overflow:hidden;color:").concat(color, ";background-color:").concat(bg, ";border:1px solid ").concat(border, ";cursor:").concat(cursor, ";pointer-events:").concat(events, ";box-shadow:").concat(shadow ? theme.expressiveness.shadowSmall : 'none', ";--helpdice-ui-button-icon-padding:").concat(SCALES.pl(0.727), ";--helpdice-ui-button-height:").concat(SCALES.height(2.5), ";--helpdice-ui-button-color:").concat(color, ";--helpdice-ui-button-bg:").concat(bg, ";min-width:").concat(auto ? 'min-content' : SCALES.width(10.5), ";width:").concat(auto ? 'auto' : 'initial', ";height:").concat(SCALES.height(2.5), ";padding:").concat(SCALES.pt(0), " ").concat(paddingRight, " ").concat(SCALES.pb(0), " ").concat(paddingLeft, ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.btn.__jsx-style-dynamic-selector:hover,.btn.__jsx-style-dynamic-selector:focus{color:").concat(hover.color, ";--helpdice-ui-button-color:").concat(hover.color, ";background-color:").concat(hover.bg, ";border-color:").concat(hover.border, ";cursor:").concat(cursor, ";pointer-events:").concat(events, ";box-shadow:").concat(shadow ? theme.expressiveness.shadowMedium : 'none', ";-webkit-transform:translate3d(0px,").concat(shadow ? '-1px' : '0px', ",0px);-ms-transform:translate3d(0px,").concat(shadow ? '-1px' : '0px', ",0px);transform:translate3d(0px,").concat(shadow ? '-1px' : '0px', ",0px);}.btn.__jsx-style-dynamic-selector .text{position:relative;z-index:1;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;text-align:center;line-height:inherit;top:-1px;}.btn.__jsx-style-dynamic-selector .text p,.btn.__jsx-style-dynamic-selector .text pre,.btn.__jsx-style-dynamic-selector .text div{margin:0;}")));
174
+ id: "960361315",
175
+ dynamic: [SCALES.height(2.5), round ? '50%' : theme.layout.radius, SCALES.font(0.875), color, bg, shadow ? 'transparent' : border, cursor, events, shadow ? btnShadow : 'none', SCALES.pl(0.727), SCALES.height(2.5), color, bg, auto ? 'min-content' : SCALES.width(10.5), auto ? 'auto' : 'initial', SCALES.height(2.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hover.color, hover.color, hover.bg, hover.border, cursor, events, btnShadow, shadow ? '-1px' : '0px']
176
+ }, ".btn.__jsx-style-dynamic-selector{box-sizing:border-box;display:inline-block;line-height:".concat(SCALES.height(2.5), ";border-radius:").concat(round ? '50%' : theme.layout.radius, ";font-weight:400;font-size:").concat(SCALES.font(0.875), ";-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;outline:none;text-transform:capitalize;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center;white-space:nowrap;-webkit-transition:background-color 200ms ease 0ms,box-shadow 200ms ease 0ms, border 200ms ease 0ms,color 200ms ease 0ms;transition:background-color 200ms ease 0ms,box-shadow 200ms ease 0ms, border 200ms ease 0ms,color 200ms ease 0ms;position:relative;overflow:hidden;color:").concat(color, ";background-color:").concat(bg, ";border:1px solid ").concat(shadow ? 'transparent' : border, ";cursor:").concat(cursor, ";pointer-events:").concat(events, ";box-shadow:").concat(shadow ? btnShadow : 'none', ";--helpdice-ui-button-icon-padding:").concat(SCALES.pl(0.727), ";--helpdice-ui-button-height:").concat(SCALES.height(2.5), ";--helpdice-ui-button-color:").concat(color, ";--helpdice-ui-button-bg:").concat(bg, ";min-width:").concat(auto ? 'min-content' : SCALES.width(10.5), ";width:").concat(auto ? 'auto' : 'initial', ";height:").concat(SCALES.height(2.5), ";padding:").concat(SCALES.pt(0), " ").concat(paddingRight, " ").concat(SCALES.pb(0), " ").concat(paddingLeft, ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.btn.__jsx-style-dynamic-selector:hover,.btn.__jsx-style-dynamic-selector:focus{color:").concat(hover.color, ";--helpdice-ui-button-color:").concat(hover.color, ";background-color:").concat(hover.bg, ";border-color:").concat(hover.border, ";cursor:").concat(cursor, ";pointer-events:").concat(events, ";box-shadow:").concat(btnShadow, ";}.btn.__jsx-style-dynamic-selector .text{position:relative;z-index:1;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;text-align:center;line-height:inherit;top:-1px;}.btn.__jsx-style-dynamic-selector .text p,.btn.__jsx-style-dynamic-selector .text pre,.btn.__jsx-style-dynamic-selector .text div{margin:0;}.ripple.__jsx-style-dynamic-selector{position:absolute;border-radius:50%;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);-webkit-animation:ripple-animation-__jsx-style-dynamic-selector 600ms ease-out;animation:ripple-animation-__jsx-style-dynamic-selector 600ms ease-out;background-color:rgba(0,0,0,0.3);pointer-events:none;z-index:1;}@-webkit-keyframes ripple-animation-__jsx-style-dynamic-selector{to{-webkit-transform:scale(2.5);-ms-transform:scale(2.5);transform:scale(2.5);opacity:0;}}@keyframes ripple-animation-__jsx-style-dynamic-selector{to{-webkit-transform:scale(2.5);-ms-transform:scale(2.5);transform:scale(2.5);opacity:0;}}")));
131
177
  });
132
178
  ButtonComponent.displayName = 'Button';
133
179
  var Button = withScale(ButtonComponent);
@@ -5,6 +5,7 @@ export interface ButtonColorGroup {
5
5
  bg: string;
6
6
  border: string;
7
7
  color: string;
8
+ ripple?: string;
8
9
  }
9
10
  export declare const getButtonGhostColors: (palette: HUIThemesPalette, _color: ButtonTypes) => ButtonColorGroup | null;
10
11
  export declare const getButtonColors: (palette: HUIThemesPalette, props: ButtonProps) => ButtonColorGroup;
@@ -5,22 +5,26 @@ export var getButtonGhostColors = function getButtonGhostColors(palette, _color)
5
5
  secondary: {
6
6
  bg: palette.background,
7
7
  border: palette.foreground,
8
- color: palette.foreground
8
+ color: palette.foreground,
9
+ ripple: ''
9
10
  },
10
11
  success: {
11
12
  bg: palette.background,
12
13
  border: palette.success,
13
- color: palette.success
14
+ color: palette.success,
15
+ ripple: ''
14
16
  },
15
17
  warning: {
16
18
  bg: palette.background,
17
19
  border: palette.warning,
18
- color: palette.warning
20
+ color: palette.warning,
21
+ ripple: ''
19
22
  },
20
23
  error: {
21
24
  bg: palette.background,
22
25
  border: palette.error,
23
- color: palette.error
26
+ color: palette.error,
27
+ ripple: ''
24
28
  }
25
29
  };
26
30
  return colors[_color] || null;
@@ -33,38 +37,45 @@ export var getButtonColors = function getButtonColors(palette, props) {
33
37
  "default": {
34
38
  bg: palette.background,
35
39
  border: palette.border,
36
- color: palette.accents_5
40
+ color: palette.accents_5,
41
+ ripple: palette.accents_1
37
42
  },
38
43
  secondary: {
39
44
  bg: palette.foreground,
40
45
  border: palette.foreground,
41
- color: palette.background
46
+ color: palette.background,
47
+ ripple: palette.accents_1
42
48
  },
43
49
  success: {
44
50
  bg: palette.success,
45
51
  border: palette.success,
46
- color: '#fff'
52
+ color: '#fff',
53
+ ripple: '#1f93ffff'
47
54
  },
48
55
  warning: {
49
56
  bg: palette.warning,
50
57
  border: palette.warning,
51
- color: '#fff'
58
+ color: '#fff',
59
+ ripple: '#ffca29ff'
52
60
  },
53
61
  error: {
54
62
  bg: palette.error,
55
63
  border: palette.error,
56
- color: '#fff'
64
+ color: '#fff',
65
+ ripple: '#ff5a55ff'
57
66
  },
58
67
  abort: {
59
68
  bg: 'transparent',
60
69
  border: 'transparent',
61
- color: palette.accents_5
70
+ color: palette.accents_5,
71
+ ripple: palette.accents_1
62
72
  }
63
73
  };
64
74
  if (disabled) return {
65
75
  bg: palette.accents_1,
66
76
  border: palette.accents_2,
67
- color: '#ccc'
77
+ color: '#ccc',
78
+ ripple: ''
68
79
  };
69
80
 
70
81
  /**
@@ -0,0 +1,2 @@
1
+ export function Clipboard(props: any): React.JSX.Element;
2
+ import React from 'react';
@@ -0,0 +1,2 @@
1
+ export default copy;
2
+ declare function copy(text: any, options: any): boolean;
@@ -0,0 +1,105 @@
1
+ 'use strict';
2
+
3
+ import deselectCurrent from './toggle-selection';
4
+ var clipboardToIE11Formatting = {
5
+ 'text/plain': 'Text',
6
+ 'text/html': 'Url',
7
+ "default": 'Text'
8
+ };
9
+ var defaultMessage = 'Copy to clipboard: #{key}, Enter';
10
+ function format(message) {
11
+ var copyKey = (/mac os x/i.test(navigator.userAgent) ? '⌘' : 'Ctrl') + '+C';
12
+ return message.replace(/#{\s*key\s*}/g, copyKey);
13
+ }
14
+ function copy(text, options) {
15
+ var debug,
16
+ message,
17
+ reselectPrevious,
18
+ range,
19
+ selection,
20
+ mark,
21
+ success = false;
22
+ if (!options) {
23
+ options = {};
24
+ }
25
+ debug = options.debug || false;
26
+ try {
27
+ reselectPrevious = deselectCurrent();
28
+ range = document.createRange();
29
+ selection = document.getSelection();
30
+ mark = document.createElement('span');
31
+ mark.textContent = text;
32
+ // avoid screen readers from reading out loud the text
33
+ mark.ariaHidden = 'true';
34
+ // reset user styles for span element
35
+ mark.style.all = 'unset';
36
+ // prevents scrolling to the end of the page
37
+ mark.style.position = 'fixed';
38
+ mark.style.top = 0;
39
+ mark.style.clip = 'rect(0, 0, 0, 0)';
40
+ // used to preserve spaces and line breaks
41
+ mark.style.whiteSpace = 'pre';
42
+ // do not inherit user-select (it may be `none`)
43
+ mark.style.webkitUserSelect = 'text';
44
+ mark.style.MozUserSelect = 'text';
45
+ mark.style.msUserSelect = 'text';
46
+ mark.style.userSelect = 'text';
47
+ mark.addEventListener('copy', function (e) {
48
+ e.stopPropagation();
49
+ if (options.format) {
50
+ e.preventDefault();
51
+ if (typeof e.clipboardData === 'undefined') {
52
+ // IE 11
53
+ debug && console.warn('unable to use e.clipboardData');
54
+ debug && console.warn('trying IE specific stuff');
55
+ window.clipboardData.clearData();
56
+ var format = clipboardToIE11Formatting[options.format] || clipboardToIE11Formatting['default'];
57
+ window.clipboardData.setData(format, text);
58
+ } else {
59
+ // all other browsers
60
+ e.clipboardData.clearData();
61
+ e.clipboardData.setData(options.format, text);
62
+ }
63
+ }
64
+ if (options.onCopy) {
65
+ e.preventDefault();
66
+ options.onCopy(e.clipboardData);
67
+ }
68
+ });
69
+ document.body.appendChild(mark);
70
+ range.selectNodeContents(mark);
71
+ selection.addRange(range);
72
+ var successful = document.execCommand('copy');
73
+ if (!successful) {
74
+ throw new Error('copy command was unsuccessful');
75
+ }
76
+ success = true;
77
+ } catch (err) {
78
+ debug && console.error('unable to copy using execCommand: ', err);
79
+ debug && console.warn('trying IE specific stuff');
80
+ try {
81
+ window.clipboardData.setData(options.format || 'text', text);
82
+ options.onCopy && options.onCopy(window.clipboardData);
83
+ success = true;
84
+ } catch (err) {
85
+ debug && console.error('unable to copy using clipboardData: ', err);
86
+ debug && console.error('falling back to prompt');
87
+ message = format('message' in options ? options.message : defaultMessage);
88
+ window.prompt(message, text);
89
+ }
90
+ } finally {
91
+ if (selection) {
92
+ if (typeof selection.removeRange == 'function') {
93
+ selection.removeRange(range);
94
+ } else {
95
+ selection.removeAllRanges();
96
+ }
97
+ }
98
+ if (mark) {
99
+ document.body.removeChild(mark);
100
+ }
101
+ reselectPrevious();
102
+ }
103
+ return success;
104
+ }
105
+ export default copy;
@@ -0,0 +1,2 @@
1
+ import { Clipboard } from "./clipboard.jsx";
2
+ export default Clipboard;
@@ -0,0 +1,2 @@
1
+ import { Clipboard } from "./clipboard.jsx";
2
+ export default Clipboard;
@@ -0,0 +1 @@
1
+ export default function _default(): () => void;
@@ -0,0 +1,31 @@
1
+ export default function () {
2
+ var selection = document.getSelection();
3
+ if (!selection.rangeCount) {
4
+ return function () {};
5
+ }
6
+ var active = document.activeElement;
7
+ var ranges = [];
8
+ for (var i = 0; i < selection.rangeCount; i++) {
9
+ ranges.push(selection.getRangeAt(i));
10
+ }
11
+ switch (active.tagName.toUpperCase() // .toUpperCase handles XHTML
12
+ ) {
13
+ case 'INPUT':
14
+ case 'TEXTAREA':
15
+ active.blur();
16
+ break;
17
+ default:
18
+ active = null;
19
+ break;
20
+ }
21
+ selection.removeAllRanges();
22
+ return function () {
23
+ selection.type === 'Caret' && selection.removeAllRanges();
24
+ if (!selection.rangeCount) {
25
+ ranges.forEach(function (range) {
26
+ selection.addRange(range);
27
+ });
28
+ }
29
+ active && active.focus();
30
+ };
31
+ }
package/esm/index.d.ts CHANGED
@@ -93,9 +93,9 @@ export type { HUIThemes, HUserTheme } from './themes';
93
93
  export { default as Toggle } from './toggle';
94
94
  export type { ToggleProps } from './toggle';
95
95
  export { default as Tooltip } from './tooltip';
96
- export { default as Notetip } from './notetip';
96
+ export { default as Notetip } from './notetip/note-tip';
97
97
  export type { TooltipProps } from './tooltip';
98
- export type { NotetipProps } from './notetip';
98
+ export type { NotetipProps } from './notetip/note-tip';
99
99
  export { default as Tree } from './tree';
100
100
  export type { TreeProps } from './tree';
101
101
  export { useTime, useTimer, useStopwatch } from './timer';
@@ -129,3 +129,4 @@ export { default as CurrencyInput } from './currency-input';
129
129
  export type { CurrencyInputProps, CurrencyInputOnChangeValues } from './currency-input';
130
130
  export { default as useToasts } from './use-toasts';
131
131
  export type { Toast, ToastInput, ToastAction, ToastLayout } from './use-toasts';
132
+ export { default as Clipboard } from './copy-to-clipboard';
package/esm/index.js CHANGED
@@ -55,7 +55,7 @@ export { default as Textarea } from './textarea';
55
55
  export { default as Themes } from './themes';
56
56
  export { default as Toggle } from './toggle';
57
57
  export { default as Tooltip } from './tooltip';
58
- export { default as Notetip } from './notetip';
58
+ export { default as Notetip } from './notetip/note-tip';
59
59
  export { default as Tree } from './tree';
60
60
  export { useTime, useTimer, useStopwatch } from './timer';
61
61
  export { default as User } from './user';
@@ -86,4 +86,5 @@ export { default as Swipe } from './swipe';
86
86
  export { Carousel } from './carousal';
87
87
  // Currency Input
88
88
  export { default as CurrencyInput } from './currency-input';
89
- export { default as useToasts } from './use-toasts';
89
+ export { default as useToasts } from './use-toasts';
90
+ export { default as Clipboard } from './copy-to-clipboard';
@@ -1,7 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
- var _excluded = ["label", "labelRight", "color", "error", "type", "icon", "iconRight", "iconClickable", "onIconClick", "initialValue", "onChange", "readOnly", "value", "onClearClick", "clearable", "className", "onBlur", "onFocus", "autoComplete", "placeholder", "children", "disabled", "fullWidth"];
4
+ var _excluded = ["label", "labelRight", "color", "error", "type", "icon", "variant", "iconRight", "iconClickable", "onIconClick", "initialValue", "onChange", "readOnly", "value", "onClearClick", "clearable", "className", "onBlur", "onFocus", "autoComplete", "placeholder", "children", "disabled", "fullWidth"];
5
5
  import _JSXStyle from "../styled-jsx.es.js";
6
6
  /* eslint-disable @typescript-eslint/no-unused-vars */
7
7
  /* eslint-disable react/jsx-no-undef */
@@ -30,6 +30,8 @@ var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
30
30
  _ref$type = _ref.type,
31
31
  type = _ref$type === void 0 ? 'text' : _ref$type,
32
32
  icon = _ref.icon,
33
+ _ref$variant = _ref.variant,
34
+ variant = _ref$variant === void 0 ? 'normal' : _ref$variant,
33
35
  iconRight = _ref.iconRight,
34
36
  _ref$iconClickable = _ref.iconClickable,
35
37
  iconClickable = _ref$iconClickable === void 0 ? false : _ref$iconClickable,
@@ -134,11 +136,11 @@ var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
134
136
  var inputProps = _extends({}, props, controlledValue);
135
137
  var defaultWidth = fullWidth ? '100%' : 'initial';
136
138
  return /*#__PURE__*/React.createElement("div", {
137
- className: _JSXStyle.dynamic([["3279091727", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), theme.layout.radius, borderColor, theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + "with-label"
139
+ className: _JSXStyle.dynamic([["3970712841", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + "with-label"
138
140
  }, children && /*#__PURE__*/React.createElement(InputBlockLabel, null, children), /*#__PURE__*/React.createElement("div", {
139
- className: _JSXStyle.dynamic([["3279091727", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), theme.layout.radius, borderColor, theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + (useClasses('input-container', className) || "")
141
+ className: _JSXStyle.dynamic([["3970712841", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + (useClasses('input-container', className) || "")
140
142
  }, label && /*#__PURE__*/React.createElement(InputLabel, null, label), /*#__PURE__*/React.createElement("div", {
141
- className: _JSXStyle.dynamic([["3279091727", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), theme.layout.radius, borderColor, theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + (useClasses('input-wrapper', {
143
+ className: _JSXStyle.dynamic([["3970712841", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + (useClasses('input-wrapper', {
142
144
  hover: hover,
143
145
  disabled: disabled
144
146
  }, labelClasses) || "")
@@ -155,7 +157,7 @@ var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
155
157
  onChange: changeHandler,
156
158
  autoComplete: autoComplete
157
159
  }, inputProps, {
158
- className: _JSXStyle.dynamic([["3279091727", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), theme.layout.radius, borderColor, theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + (inputProps && inputProps.className != null && inputProps.className || useClasses({
160
+ className: _JSXStyle.dynamic([["3970712841", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + (inputProps && inputProps.className != null && inputProps.className || useClasses({
159
161
  disabled: disabled
160
162
  }, iconClasses) || "")
161
163
  })), clearable && /*#__PURE__*/React.createElement(InputClearIcon, {
@@ -167,7 +169,7 @@ var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
167
169
  }, iconProps))), labelRight && /*#__PURE__*/React.createElement(InputLabel, {
168
170
  isRight: true
169
171
  }, labelRight), /*#__PURE__*/React.createElement("br", {
170
- className: _JSXStyle.dynamic([["3279091727", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), theme.layout.radius, borderColor, theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]])
172
+ className: _JSXStyle.dynamic([["3970712841", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]])
171
173
  })), error && /*#__PURE__*/React.createElement("p", {
172
174
  style: {
173
175
  marginTop: 0.4,
@@ -176,11 +178,11 @@ var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
176
178
  marginBottom: '0.4rem',
177
179
  textAlign: 'left'
178
180
  },
179
- className: _JSXStyle.dynamic([["3279091727", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), theme.layout.radius, borderColor, theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + "input-error"
181
+ className: _JSXStyle.dynamic([["3970712841", [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]]]) + " " + "input-error"
180
182
  }, error), /*#__PURE__*/React.createElement(_JSXStyle, {
181
- id: "3279091727",
182
- dynamic: [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), theme.layout.radius, borderColor, theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]
183
- }, ".with-label.__jsx-style-dynamic-selector{display:inline-block;box-sizing:border-box;-webkit-box-align:center;--input-height:".concat(SCALES.height(2.25), ";font-size:").concat(SCALES.font(0.875), ";width:").concat(SCALES.width(1, defaultWidth), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.input-error.__jsx-style-dynamic-selector{color:#aa4a44;}.input-container.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:").concat(SCALES.width(1, defaultWidth), ";height:var(--input-height);}.input-wrapper.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;vertical-align:middle;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:100%;-webkit-flex:1;-ms-flex:1;flex:1;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:").concat(theme.layout.radius, ";border:1px solid ").concat(borderColor, ";-webkit-transition:border 0.2s ease 0s,color 0.2s ease 0s;transition:border 0.2s ease 0s,color 0.2s ease 0s;}.input-wrapper.left-label.__jsx-style-dynamic-selector{border-top-left-radius:0;border-bottom-left-radius:0;}.input-wrapper.right-label.__jsx-style-dynamic-selector{border-top-right-radius:0;border-bottom-right-radius:0;}.input-wrapper.disabled.__jsx-style-dynamic-selector{background-color:").concat(theme.palette.accents_1, ";border-color:").concat(theme.palette.accents_2, ";cursor:not-allowed;}input.disabled.__jsx-style-dynamic-selector{cursor:not-allowed;}.input-wrapper.hover.__jsx-style-dynamic-selector{border-color:").concat(hoverBorder, ";}input.__jsx-style-dynamic-selector{margin:0.25em 0.625em;padding:0;box-shadow:none;font-size:").concat(SCALES.font(0.875), ";background-color:transparent;border:none;color:").concat(color, ";outline:none;border-radius:0;width:100%;min-width:0;-webkit-appearance:none;}input.left-icon.__jsx-style-dynamic-selector{margin-left:0;}input.right-icon.__jsx-style-dynamic-selector{margin-right:0;}.__jsx-style-dynamic-selector::-webkit-input-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme.palette.accents_3, ";}.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme.palette.accents_3, ";}.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme.palette.accents_3, ";}.__jsx-style-dynamic-selector::placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme.palette.accents_3, ";}.__jsx-style-dynamic-selector::-ms-reveal{display:none !important;}input.__jsx-style-dynamic-selector:-webkit-autofill,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:hover,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:active,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:focus{-webkit-box-shadow:0 0 0 30px ").concat(theme.palette.background, " inset !important;-webkit-text-fill-color:").concat(color, " !important;}")));
183
+ id: "3970712841",
184
+ dynamic: [SCALES.height(2.25), SCALES.font(0.875), SCALES.width(1, defaultWidth), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), SCALES.width(1, defaultWidth), variant === 'normal' ? theme.layout.radius : '', variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), theme.palette.accents_1, theme.palette.accents_2, hoverBorder, SCALES.font(0.875), color, theme.palette.accents_3, theme.palette.background, color]
185
+ }, ".with-label.__jsx-style-dynamic-selector{display:inline-block;box-sizing:border-box;-webkit-box-align:center;--input-height:".concat(SCALES.height(2.25), ";font-size:").concat(SCALES.font(0.875), ";width:").concat(SCALES.width(1, defaultWidth), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.input-error.__jsx-style-dynamic-selector{color:#aa4a44;}.input-container.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:").concat(SCALES.width(1, defaultWidth), ";height:var(--input-height);}.input-wrapper.__jsx-style-dynamic-selector{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;vertical-align:middle;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:100%;-webkit-flex:1;-ms-flex:1;flex:1;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:").concat(variant === 'normal' ? theme.layout.radius : '', ";").concat(variant === 'none' ? '' : variant === 'line' ? "border-bottom: 1px solid ".concat(borderColor) : "border: 1px solid ".concat(borderColor), ";-webkit-transition:border 0.2s ease 0s,color 0.2s ease 0s;transition:border 0.2s ease 0s,color 0.2s ease 0s;}.input-wrapper.left-label.__jsx-style-dynamic-selector{border-top-left-radius:0;border-bottom-left-radius:0;}.input-wrapper.right-label.__jsx-style-dynamic-selector{border-top-right-radius:0;border-bottom-right-radius:0;}.input-wrapper.disabled.__jsx-style-dynamic-selector{background-color:").concat(theme.palette.accents_1, ";border-color:").concat(theme.palette.accents_2, ";cursor:not-allowed;}input.disabled.__jsx-style-dynamic-selector{cursor:not-allowed;}.input-wrapper.hover.__jsx-style-dynamic-selector{border-color:").concat(hoverBorder, ";}input.__jsx-style-dynamic-selector{margin:0.25em 0.625em;padding:0;box-shadow:none;font-size:").concat(SCALES.font(0.875), ";background-color:transparent;border:none;color:").concat(color, ";outline:none;border-radius:0;width:100%;min-width:0;-webkit-appearance:none;}input.left-icon.__jsx-style-dynamic-selector{margin-left:0;}input.right-icon.__jsx-style-dynamic-selector{margin-right:0;}.__jsx-style-dynamic-selector::-webkit-input-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme.palette.accents_3, ";}.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme.palette.accents_3, ";}.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme.palette.accents_3, ";}.__jsx-style-dynamic-selector::placeholder,.__jsx-style-dynamic-selector::-moz-placeholder,.__jsx-style-dynamic-selector:-ms-input-placeholder,.__jsx-style-dynamic-selector::-webkit-input-placeholder{color:").concat(theme.palette.accents_3, ";}.__jsx-style-dynamic-selector::-ms-reveal{display:none !important;}input.__jsx-style-dynamic-selector:-webkit-autofill,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:hover,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:active,input.__jsx-style-dynamic-selector:-webkit-autofill.__jsx-style-dynamic-selector:focus{-webkit-box-shadow:0 0 0 30px ").concat(theme.palette.background, " inset !important;-webkit-text-fill-color:").concat(color, " !important;}")));
184
186
  });
185
187
  InputComponent.displayName = 'Input';
186
188
  var Input = withScale(InputComponent);
@@ -6,6 +6,7 @@ export interface Props {
6
6
  placeholder?: string;
7
7
  color?: InputTypes;
8
8
  type?: string;
9
+ variant?: string;
9
10
  readOnly?: boolean;
10
11
  disabled?: boolean;
11
12
  label?: string;
@@ -1,97 +1,2 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import _JSXStyle from "../styled-jsx.es.js";
3
- import React, { useState, useRef, useEffect } from 'react';
4
- import { useFloating, offset, flip, shift, arrow } from '@floating-ui/react-dom';
5
- import { useTheme } from '@helpdice/theme';
6
- import { createPortal } from 'react-dom';
7
- var Tooltip = function Tooltip(_ref) {
8
- var children = _ref.children,
9
- text = _ref.text,
10
- _ref$placement = _ref.placement,
11
- placement = _ref$placement === void 0 ? 'top' : _ref$placement,
12
- _ref$delay = _ref.delay,
13
- delay = _ref$delay === void 0 ? 0 : _ref$delay,
14
- _ref$duration = _ref.duration,
15
- duration = _ref$duration === void 0 ? 200 : _ref$duration,
16
- _ref$animation = _ref.animation,
17
- animation = _ref$animation === void 0 ? 'fade' : _ref$animation;
18
- var theme = useTheme();
19
- var _useState = useState(false),
20
- _useState2 = _slicedToArray(_useState, 2),
21
- open = _useState2[0],
22
- setOpen = _useState2[1];
23
- var _useState3 = useState(false),
24
- _useState4 = _slicedToArray(_useState3, 2),
25
- show = _useState4[0],
26
- setShow = _useState4[1];
27
- var arrowRef = useRef(null);
28
- var _useFloating = useFloating({
29
- placement: placement,
30
- middleware: [offset(8), flip(), shift({
31
- padding: 5
32
- }), arrow({
33
- element: arrowRef
34
- })]
35
- }),
36
- x = _useFloating.x,
37
- y = _useFloating.y,
38
- refs = _useFloating.refs,
39
- strategy = _useFloating.strategy;
40
- useEffect(function () {
41
- var timer;
42
- if (open) {
43
- timer = setTimeout(function () {
44
- return setShow(true);
45
- }, delay);
46
- } else {
47
- setShow(false);
48
- }
49
- return function () {
50
- return clearTimeout(timer);
51
- };
52
- }, [open, delay]);
53
- var handleMouseEnter = function handleMouseEnter() {
54
- return setOpen(true);
55
- };
56
- var handleMouseLeave = function handleMouseLeave() {
57
- return setOpen(false);
58
- };
59
- var handleTouchStart = function handleTouchStart() {
60
- setOpen(true);
61
- setTimeout(function () {
62
- return setOpen(false);
63
- }, 2000); // auto-hide
64
- };
65
-
66
- // const staticSide = {
67
- // top: 'bottom',
68
- // right: 'left',
69
- // bottom: 'top',
70
- // left: 'right',
71
- // }[finalPlacement.split('-')[0]];
72
-
73
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
74
- ref: refs.setReference,
75
- onMouseEnter: handleMouseEnter,
76
- onMouseLeave: handleMouseLeave,
77
- onTouchStart: handleTouchStart,
78
- className: _JSXStyle.dynamic([["2501444323", [theme.palette.accents_7, duration, duration, duration]]]) + " " + "tooltip-reference"
79
- }, children), show && x != null && y != null ? /*#__PURE__*/createPortal(/*#__PURE__*/React.createElement("div", {
80
- ref: refs.setFloating,
81
- style: {
82
- position: strategy,
83
- top: y !== null && y !== void 0 ? y : 0,
84
- left: x !== null && x !== void 0 ? x : 0,
85
- zIndex: 9999,
86
- // opacity: show ? 1 : 0,
87
- // visibility: x == null || y == null ? 'hidden' : 'visible',
88
- transitionProperty: 'opacity, transform',
89
- transitionDuration: "".concat(duration, "ms")
90
- },
91
- className: _JSXStyle.dynamic([["2501444323", [theme.palette.accents_7, duration, duration, duration]]]) + " " + "tooltip-box ".concat(animation)
92
- }, text), document.body) : null, /*#__PURE__*/React.createElement(_JSXStyle, {
93
- id: "2501444323",
94
- dynamic: [theme.palette.accents_7, duration, duration, duration]
95
- }, ".tooltip-box.__jsx-style-dynamic-selector{background:".concat(theme.palette.accents_7, ";color:white;padding:4px 10px;border-radius:4px;font-size:12px;white-space:nowrap;z-index:9999;opacity:0;}.fade.__jsx-style-dynamic-selector{-webkit-animation:fadeIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;animation:fadeIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;}@-webkit-keyframes fadeIn-__jsx-style-dynamic-selector{from{opacity:0;}to{opacity:1;}}@keyframes fadeIn-__jsx-style-dynamic-selector{from{opacity:0;}to{opacity:1;}}.scale.__jsx-style-dynamic-selector{-webkit-animation:scaleIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;animation:scaleIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;}@-webkit-keyframes scaleIn-__jsx-style-dynamic-selector{from{opacity:0;-webkit-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95);}to{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}}@keyframes scaleIn-__jsx-style-dynamic-selector{from{opacity:0;-webkit-transform:scale(0.95);-ms-transform:scale(0.95);transform:scale(0.95);}to{opacity:1;-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);}}.slide.__jsx-style-dynamic-selector{-webkit-animation:slideIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;animation:slideIn-__jsx-style-dynamic-selector ").concat(duration, "ms ease forwards;}@-webkit-keyframes slideIn-__jsx-style-dynamic-selector{from{opacity:0;-webkit-transform:translateY(5px);-ms-transform:translateY(5px);transform:translateY(5px);}to{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);}}@keyframes slideIn-__jsx-style-dynamic-selector{from{opacity:0;-webkit-transform:translateY(5px);-ms-transform:translateY(5px);transform:translateY(5px);}to{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0);}}")));
96
- };
97
- export default Tooltip;
1
+ import Notetip from "./note-tip";
2
+ export default Notetip;
@@ -9,5 +9,5 @@ export type NotetipProps = {
9
9
  duration?: number;
10
10
  animation?: AnimationVariant;
11
11
  };
12
- declare const Tooltip: React.FC<NotetipProps>;
13
- export default Tooltip;
12
+ declare const Notetip: React.FC<NotetipProps>;
13
+ export default Notetip;