@helpdice/ui 2.1.5 → 2.1.9

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 (124) hide show
  1. package/dist/auto-complete/index.js +2158 -17
  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/container/box.d.ts +42 -0
  7. package/dist/container/index.d.ts +2 -0
  8. package/dist/container/index.js +948 -0
  9. package/dist/copy-to-clipboard/clipboard.d.ts +14 -0
  10. package/dist/copy-to-clipboard/copy.d.ts +2 -0
  11. package/dist/copy-to-clipboard/index.d.ts +2 -0
  12. package/dist/copy-to-clipboard/index.js +1702 -0
  13. package/dist/copy-to-clipboard/toggle-selection.d.ts +1 -0
  14. package/dist/grid/index.d.ts +2 -3
  15. package/dist/grid/index.js +0 -1
  16. package/dist/html-renderer/index.js +35 -12
  17. package/dist/index.d.ts +6 -6
  18. package/dist/index.js +15776 -15418
  19. package/dist/input/index.d.ts +4 -0
  20. package/dist/input/index.js +2162 -18
  21. package/dist/input/input-props.d.ts +1 -0
  22. package/dist/input/phone-input/phone.d.ts +13 -0
  23. package/dist/modal/index.js +73 -16
  24. package/dist/notetip/index.js +690 -0
  25. package/{esm/notetip/index.d.ts → dist/notetip/note-tip.d.ts} +2 -2
  26. package/dist/placeholder/index.js +643 -8
  27. package/dist/table/index.js +4370 -2163
  28. package/dist/text/child.d.ts +1 -0
  29. package/dist/text/index.js +686 -8
  30. package/dist/text/text.d.ts +1 -0
  31. package/esm/button/button.d.ts +1 -1
  32. package/esm/button/button.js +51 -5
  33. package/esm/button/styles.d.ts +1 -0
  34. package/esm/button/styles.js +22 -11
  35. package/esm/container/box.d.ts +42 -0
  36. package/esm/container/box.js +39 -0
  37. package/esm/container/index.d.ts +2 -0
  38. package/esm/container/index.js +2 -0
  39. package/esm/copy-to-clipboard/clipboard.d.ts +14 -0
  40. package/esm/copy-to-clipboard/clipboard.js +91 -0
  41. package/esm/copy-to-clipboard/copy.d.ts +2 -0
  42. package/esm/copy-to-clipboard/copy.js +105 -0
  43. package/esm/copy-to-clipboard/index.d.ts +2 -0
  44. package/esm/copy-to-clipboard/index.js +2 -0
  45. package/esm/copy-to-clipboard/toggle-selection.d.ts +1 -0
  46. package/esm/copy-to-clipboard/toggle-selection.js +31 -0
  47. package/esm/grid/index.d.ts +2 -3
  48. package/esm/grid/index.js +5 -3
  49. package/esm/index.d.ts +6 -6
  50. package/esm/index.js +7 -5
  51. package/esm/input/index.d.ts +4 -0
  52. package/esm/input/index.js +4 -0
  53. package/esm/input/input-field.js +12 -10
  54. package/esm/input/input-props.d.ts +1 -0
  55. package/esm/input/phone-input/phone.d.ts +13 -0
  56. package/esm/input/phone-input/phone.js +166 -0
  57. package/esm/notetip/index.js +2 -97
  58. package/{dist/notetip/index.d.ts → esm/notetip/note-tip.d.ts} +2 -2
  59. package/esm/notetip/note-tip.js +97 -0
  60. package/esm/table/table-body.js +2 -2
  61. package/esm/table/table-cell.js +1 -1
  62. package/esm/table/table-head.js +4 -2
  63. package/esm/table/table.js +0 -1
  64. package/esm/text/child.d.ts +1 -0
  65. package/esm/text/text.d.ts +1 -0
  66. package/esm/text/text.js +25 -3
  67. package/package.json +19 -19
  68. package/dist/currency-input/index.js +0 -862
  69. package/dist/phone-input/index.js +0 -2033
  70. package/dist/phone-input/phone.d.ts +0 -11
  71. package/esm/phone-input/phone.d.ts +0 -11
  72. package/esm/phone-input/phone.js +0 -161
  73. /package/dist/{currency-input → input/currency-input}/components/CurrencyInput.d.ts +0 -0
  74. /package/dist/{currency-input → input/currency-input}/components/CurrencyInputProps.d.ts +0 -0
  75. /package/dist/{currency-input → input/currency-input}/components/utils/cleanValue.d.ts +0 -0
  76. /package/dist/{currency-input → input/currency-input}/components/utils/escapeRegExp.d.ts +0 -0
  77. /package/dist/{currency-input → input/currency-input}/components/utils/fixedDecimalValue.d.ts +0 -0
  78. /package/dist/{currency-input → input/currency-input}/components/utils/formatValue.d.ts +0 -0
  79. /package/dist/{currency-input → input/currency-input}/components/utils/getLocaleConfig.d.ts +0 -0
  80. /package/dist/{currency-input → input/currency-input}/components/utils/getSuffix.d.ts +0 -0
  81. /package/dist/{currency-input → input/currency-input}/components/utils/index.d.ts +0 -0
  82. /package/dist/{currency-input → input/currency-input}/components/utils/isNumber.d.ts +0 -0
  83. /package/dist/{currency-input → input/currency-input}/components/utils/padTrimValue.d.ts +0 -0
  84. /package/dist/{currency-input → input/currency-input}/components/utils/parseAbbrValue.d.ts +0 -0
  85. /package/dist/{currency-input → input/currency-input}/components/utils/removeInvalidChars.d.ts +0 -0
  86. /package/dist/{currency-input → input/currency-input}/components/utils/removeSeparators.d.ts +0 -0
  87. /package/dist/{currency-input → input/currency-input}/components/utils/repositionCursor.d.ts +0 -0
  88. /package/dist/{currency-input → input/currency-input}/index.d.ts +0 -0
  89. /package/dist/{phone-input → input/phone-input}/index.d.ts +0 -0
  90. /package/esm/{currency-input → input/currency-input}/components/CurrencyInput.d.ts +0 -0
  91. /package/esm/{currency-input → input/currency-input}/components/CurrencyInput.js +0 -0
  92. /package/esm/{currency-input → input/currency-input}/components/CurrencyInputProps.d.ts +0 -0
  93. /package/esm/{currency-input → input/currency-input}/components/CurrencyInputProps.js +0 -0
  94. /package/esm/{currency-input → input/currency-input}/components/utils/addSeparators.js +0 -0
  95. /package/esm/{currency-input → input/currency-input}/components/utils/cleanValue.d.ts +0 -0
  96. /package/esm/{currency-input → input/currency-input}/components/utils/cleanValue.js +0 -0
  97. /package/esm/{currency-input → input/currency-input}/components/utils/escapeRegExp.d.ts +0 -0
  98. /package/esm/{currency-input → input/currency-input}/components/utils/escapeRegExp.js +0 -0
  99. /package/esm/{currency-input → input/currency-input}/components/utils/fixedDecimalValue.d.ts +0 -0
  100. /package/esm/{currency-input → input/currency-input}/components/utils/fixedDecimalValue.js +0 -0
  101. /package/esm/{currency-input → input/currency-input}/components/utils/formatValue.d.ts +0 -0
  102. /package/esm/{currency-input → input/currency-input}/components/utils/formatValue.js +0 -0
  103. /package/esm/{currency-input → input/currency-input}/components/utils/getLocaleConfig.d.ts +0 -0
  104. /package/esm/{currency-input → input/currency-input}/components/utils/getLocaleConfig.js +0 -0
  105. /package/esm/{currency-input → input/currency-input}/components/utils/getSuffix.d.ts +0 -0
  106. /package/esm/{currency-input → input/currency-input}/components/utils/getSuffix.js +0 -0
  107. /package/esm/{currency-input → input/currency-input}/components/utils/index.d.ts +0 -0
  108. /package/esm/{currency-input → input/currency-input}/components/utils/index.js +0 -0
  109. /package/esm/{currency-input → input/currency-input}/components/utils/isNumber.d.ts +0 -0
  110. /package/esm/{currency-input → input/currency-input}/components/utils/isNumber.js +0 -0
  111. /package/esm/{currency-input → input/currency-input}/components/utils/padTrimValue.d.ts +0 -0
  112. /package/esm/{currency-input → input/currency-input}/components/utils/padTrimValue.js +0 -0
  113. /package/esm/{currency-input → input/currency-input}/components/utils/parseAbbrValue.d.ts +0 -0
  114. /package/esm/{currency-input → input/currency-input}/components/utils/parseAbbrValue.js +0 -0
  115. /package/esm/{currency-input → input/currency-input}/components/utils/removeInvalidChars.d.ts +0 -0
  116. /package/esm/{currency-input → input/currency-input}/components/utils/removeInvalidChars.js +0 -0
  117. /package/esm/{currency-input → input/currency-input}/components/utils/removeSeparators.d.ts +0 -0
  118. /package/esm/{currency-input → input/currency-input}/components/utils/removeSeparators.js +0 -0
  119. /package/esm/{currency-input → input/currency-input}/components/utils/repositionCursor.d.ts +0 -0
  120. /package/esm/{currency-input → input/currency-input}/components/utils/repositionCursor.js +0 -0
  121. /package/esm/{currency-input → input/currency-input}/index.d.ts +0 -0
  122. /package/esm/{currency-input → input/currency-input}/index.js +0 -0
  123. /package/esm/{phone-input → input/phone-input}/index.d.ts +0 -0
  124. /package/esm/{phone-input → input/phone-input}/index.js +0 -0
package/esm/index.js CHANGED
@@ -24,7 +24,8 @@ export * from './form';
24
24
 
25
25
  // export * as captcha from './captcha'
26
26
 
27
- export { default as Grid, Container } from './grid';
27
+ export { default as Grid } from './grid';
28
+ export { default as Container } from './container';
28
29
  export { default as HtmlRenderer } from './html-renderer';
29
30
  export { default as Image } from './image';
30
31
  export { default as Input, getColors } from './input';
@@ -38,7 +39,6 @@ export { default as Pagination } from './pagination';
38
39
  export { default as Popover } from './popover';
39
40
  export { default as List } from './list';
40
41
  export { default as Menu } from './menu';
41
- export { default as PhoneInput } from './phone-input';
42
42
  export { default as Progress } from './progress';
43
43
  export { default as Radio } from './radio';
44
44
  export { default as Rating } from './rating';
@@ -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';
@@ -84,6 +84,8 @@ export * from './login-with';
84
84
  export { default as Swipe } from './swipe';
85
85
  // Carousel
86
86
  export { Carousel } from './carousal';
87
+
87
88
  // Currency Input
88
- export { default as CurrencyInput } from './currency-input';
89
- export { default as useToasts } from './use-toasts';
89
+
90
+ export { default as useToasts } from './use-toasts';
91
+ export { default as Clipboard } from './copy-to-clipboard';
@@ -1,9 +1,13 @@
1
1
  import Input from './input-field';
2
2
  import Textarea from '../textarea';
3
3
  import InputPassword from './password';
4
+ import PhoneInput from './phone-input';
5
+ import CurrencyInput from './currency-input';
4
6
  export type InputComponentType = typeof Input & {
5
7
  Textarea: typeof Textarea;
6
8
  Password: typeof InputPassword;
9
+ Phone: typeof PhoneInput;
10
+ Currency: typeof CurrencyInput;
7
11
  };
8
12
  export { getColors } from './styles';
9
13
  export type { InputProps } from './input-field';
@@ -2,7 +2,11 @@
2
2
  import Input from './input-field';
3
3
  import Textarea from '../textarea';
4
4
  import InputPassword from './password';
5
+ import PhoneInput from './phone-input';
6
+ import CurrencyInput from './currency-input';
5
7
  Input.Textarea = Textarea;
6
8
  Input.Password = InputPassword;
9
+ Input.Phone = PhoneInput;
10
+ Input.Currency = CurrencyInput;
7
11
  export { getColors } from './styles';
8
12
  export default Input;
@@ -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;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { InputTypes } from '..';
3
+ type PhoneInputProps = {
4
+ onChange: (data: string) => void;
5
+ value?: string;
6
+ fullWidth?: boolean;
7
+ children?: React.ReactNode;
8
+ country?: string;
9
+ placeholder?: string;
10
+ color?: InputTypes;
11
+ };
12
+ declare function PhoneInput({ onChange, value, country, placeholder, color: _color, children, fullWidth }: PhoneInputProps): React.JSX.Element;
13
+ export default PhoneInput;
@@ -0,0 +1,166 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import _JSXStyle from "../styled-jsx.es.js";
3
+ import React, { useState, useRef, useEffect, useMemo } from 'react';
4
+ import countries from './countries.json';
5
+ import { useTheme } from '@helpdice/theme';
6
+ import { getColors } from '../styles';
7
+ import useScale from '../../use-scale';
8
+ import InputBlockLabel from '../input-block-label';
9
+ function PhoneInput(_ref) {
10
+ var onChange = _ref.onChange,
11
+ _ref$value = _ref.value,
12
+ value = _ref$value === void 0 ? '' : _ref$value,
13
+ country = _ref.country,
14
+ _ref$placeholder = _ref.placeholder,
15
+ placeholder = _ref$placeholder === void 0 ? 'Enter phone number' : _ref$placeholder,
16
+ _ref$color = _ref.color,
17
+ _color = _ref$color === void 0 ? 'default' : _ref$color,
18
+ children = _ref.children,
19
+ fullWidth = _ref.fullWidth;
20
+ var theme = useTheme();
21
+ var _useScale = useScale(),
22
+ SCALES = _useScale.SCALES;
23
+ var defaultValue = country ? countries.findIndex(function (cn) {
24
+ return cn.code == country;
25
+ }) : 103;
26
+ var _useState = useState(countries[defaultValue]),
27
+ _useState2 = _slicedToArray(_useState, 2),
28
+ selectedCountry = _useState2[0],
29
+ setSelectedCountry = _useState2[1];
30
+ var _useState3 = useState(value),
31
+ _useState4 = _slicedToArray(_useState3, 2),
32
+ phoneNumber = _useState4[0],
33
+ setPhoneNumber = _useState4[1];
34
+ var _useState5 = useState(false),
35
+ _useState6 = _slicedToArray(_useState5, 2),
36
+ isFocused = _useState6[0],
37
+ setIsFocused = _useState6[1];
38
+ var _useState7 = useState(false),
39
+ _useState8 = _slicedToArray(_useState7, 2),
40
+ dropdownOpen = _useState8[0],
41
+ setDropdownOpen = _useState8[1];
42
+ var _useState9 = useState(''),
43
+ _useState10 = _slicedToArray(_useState9, 2),
44
+ searchTerm = _useState10[0],
45
+ setSearchTerm = _useState10[1];
46
+ var dropdownRef = useRef(null);
47
+ var _useMemo = useMemo(function () {
48
+ return getColors(theme.palette, _color);
49
+ }, [theme.palette]),
50
+ borderColor = _useMemo.borderColor,
51
+ hoverBorder = _useMemo.hoverBorder;
52
+ var handleSelectCountry = function handleSelectCountry(country) {
53
+ setSelectedCountry(country);
54
+ setDropdownOpen(false);
55
+ setSearchTerm('');
56
+ if (onChange) onChange("".concat(country.code, ":").concat(phoneNumber));
57
+ };
58
+ var handlePhoneChange = function handlePhoneChange(e) {
59
+ var value = e.target.value.replace(/[^\d]/g, '');
60
+ setPhoneNumber(value);
61
+ if (onChange) onChange("".concat(selectedCountry.phone, ",").concat(value));
62
+ };
63
+ var handleClickOutside = function handleClickOutside(e) {
64
+ if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
65
+ setDropdownOpen(false);
66
+ setSearchTerm('');
67
+ }
68
+ };
69
+ useEffect(function () {
70
+ document.addEventListener('mousedown', handleClickOutside);
71
+ return function () {
72
+ return document.removeEventListener('mousedown', handleClickOutside);
73
+ };
74
+ }, []);
75
+ var filteredCountries = countries.filter(function (c) {
76
+ return "".concat(c.label, " ").concat(c.code, " ").concat(c.phone).toLowerCase().includes(searchTerm.toLowerCase());
77
+ });
78
+ var defaultWidth = fullWidth ? '100%' : 'initial';
79
+ return /*#__PURE__*/React.createElement("div", {
80
+ ref: dropdownRef,
81
+ className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "phone-input-container ".concat(isFocused ? 'focused' : '')
82
+ }, children && /*#__PURE__*/React.createElement(InputBlockLabel, null, children), /*#__PURE__*/React.createElement("div", {
83
+ className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "input-wrapper"
84
+ }, /*#__PURE__*/React.createElement("div", {
85
+ onClick: function onClick() {
86
+ return setDropdownOpen(!dropdownOpen);
87
+ },
88
+ className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "dropdown-toggle"
89
+ }, /*#__PURE__*/React.createElement("span", {
90
+ style: {
91
+ display: 'flex',
92
+ alignItems: 'center',
93
+ gap: 5
94
+ },
95
+ className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]])
96
+ }, /*#__PURE__*/React.createElement("img", {
97
+ loading: "lazy",
98
+ width: "20",
99
+ height: "20",
100
+ src: "https://flagcdn.com/w20/".concat(selectedCountry.code.toLowerCase(), ".png"),
101
+ srcSet: "https://flagcdn.com/w40/".concat(selectedCountry.code.toLowerCase(), ".png 2x"),
102
+ alt: "Flag of ".concat(selectedCountry.label),
103
+ className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]])
104
+ }), /*#__PURE__*/React.createElement("span", {
105
+ className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]])
106
+ }, selectedCountry.phone))), /*#__PURE__*/React.createElement("input", {
107
+ type: "tel",
108
+ placeholder: placeholder,
109
+ value: phoneNumber,
110
+ onChange: handlePhoneChange,
111
+ onFocus: function onFocus() {
112
+ return setIsFocused(true);
113
+ },
114
+ onBlur: function onBlur() {
115
+ return setIsFocused(false);
116
+ },
117
+ className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "phone-input"
118
+ })), dropdownOpen && /*#__PURE__*/React.createElement("div", {
119
+ className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "dropdown"
120
+ }, /*#__PURE__*/React.createElement("input", {
121
+ type: "text",
122
+ placeholder: "Search country...",
123
+ value: searchTerm,
124
+ onChange: function onChange(e) {
125
+ return setSearchTerm(e.target.value);
126
+ },
127
+ className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "search-input"
128
+ }), /*#__PURE__*/React.createElement("div", {
129
+ className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "country-list"
130
+ }, filteredCountries.length > 0 ? filteredCountries.map(function (c) {
131
+ return /*#__PURE__*/React.createElement("div", {
132
+ key: c.code,
133
+ onClick: function onClick() {
134
+ return handleSelectCountry(c);
135
+ },
136
+ className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "dropdown-item"
137
+ }, /*#__PURE__*/React.createElement("span", {
138
+ style: {
139
+ display: 'flex',
140
+ alignItems: 'center',
141
+ gap: 5
142
+ },
143
+ className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]])
144
+ }, /*#__PURE__*/React.createElement("img", {
145
+ loading: "lazy",
146
+ width: "23",
147
+ height: "23",
148
+ src: "https://flagcdn.com/w20/".concat(c.code.toLowerCase(), ".png"),
149
+ srcSet: "https://flagcdn.com/w40/".concat(c.code.toLowerCase(), ".png 2x"),
150
+ alt: "Flag of ".concat(c.label),
151
+ className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]])
152
+ }), c.phone, " ", /*#__PURE__*/React.createElement("span", {
153
+ style: {
154
+ color: 'grey'
155
+ },
156
+ className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]])
157
+ }, c.label)));
158
+ }) : /*#__PURE__*/React.createElement("div", {
159
+ className: _JSXStyle.dynamic([["3237870810", [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "dropdown-item disabled"
160
+ }, "No results"))), /*#__PURE__*/React.createElement(_JSXStyle, {
161
+ id: "3237870810",
162
+ dynamic: [SCALES.width(1, defaultWidth), SCALES.height(2.25), hoverBorder, borderColor, borderColor, SCALES.width(1, defaultWidth), theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']
163
+ }, ".phone-input-container.__jsx-style-dynamic-selector{position:relative;width:".concat(SCALES.width(1, defaultWidth), ";height:").concat(SCALES.height(2.25), ";}.phone-input-container.focused.__jsx-style-dynamic-selector{outline:1px solid ").concat(hoverBorder, ";border-radius:6px;}.input-wrapper.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border:1px solid ").concat(borderColor, ";border-radius:6px;overflow:hidden;}.dropdown-toggle.__jsx-style-dynamic-selector{padding:7px 12px;border-radius:6px 0px 0px 6px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;font-size:14px;border-right:1px solid ").concat(borderColor, ";}.phone-input.__jsx-style-dynamic-selector{width:100%;min-width:0;padding:5px 10px;background-color:transparent;font-size:14px;border:none;}.phone-input.__jsx-style-dynamic-selector:focus{outline:none;}.dropdown.__jsx-style-dynamic-selector{position:absolute;top:100%;left:0;width:").concat(SCALES.width(1, defaultWidth), ";background:").concat(theme.type == 'dark' ? 'black' : 'white', ";border:1px solid ").concat(borderColor, ";border-radius:6px;margin-top:4px;z-index:999;box-shadow:0 4px 10px rgba(0,0,0,0.1);}.search-input.__jsx-style-dynamic-selector{width:100%;padding:8px 10px;border:none;background-color:transparent;border-bottom:1px solid ").concat(borderColor, ";font-size:14px;}.search-input.__jsx-style-dynamic-selector:focus{outline:none;}.country-list.__jsx-style-dynamic-selector{max-height:200px;overflow-y:auto;}.dropdown-item.__jsx-style-dynamic-selector{padding:10px;cursor:pointer;font-size:14px;}.dropdown-item.__jsx-style-dynamic-selector:hover{background:").concat(theme.type == 'dark' ? '#3a3d3d' : '#efefef', ";}.dropdown-item.disabled.__jsx-style-dynamic-selector{color:#888;cursor:default;}")));
164
+ }
165
+ ;
166
+ export default PhoneInput;
@@ -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;
@@ -0,0 +1,97 @@
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 Notetip = function Notetip(_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([["4210526695", [theme.palette.accents_1, duration, duration, duration]]]) + " " + "tooltip-reference"
79
+ }, children), show && x != null && y != null && text != 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([["4210526695", [theme.palette.accents_1, duration, duration, duration]]]) + " " + "tooltip-box ".concat(animation)
92
+ }, text), document.body) : null, /*#__PURE__*/React.createElement(_JSXStyle, {
93
+ id: "4210526695",
94
+ dynamic: [theme.palette.accents_1, duration, duration, duration]
95
+ }, ".tooltip-box.__jsx-style-dynamic-selector{background:".concat(theme.palette.accents_1, ";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 Notetip;
@@ -73,7 +73,7 @@ var TableBody = function TableBody(_ref) {
73
73
 
74
74
  function renderRow(cols, row, index) {
75
75
  var _row$style;
76
- var urid = _.uniqueId();
76
+ // const urid = _.uniqueId();
77
77
  var className = rowClassName(row, index);
78
78
  var rw = _extends({}, row);
79
79
  var rowStyle = (_row$style = row === null || row === void 0 ? void 0 : row.style) !== null && _row$style !== void 0 ? _row$style : {};
@@ -94,7 +94,7 @@ var TableBody = function TableBody(_ref) {
94
94
  onDragStart: onDragStart,
95
95
  "aria-checked": selected.indexOf(row) !== -1,
96
96
  tabIndex: -1,
97
- key: urid,
97
+ key: "table-row-".concat(rw.id),
98
98
  style: _extends({
99
99
  cursor: 'pointer',
100
100
  backgroundColor: isRowSelected ? hoverColor : ''
@@ -22,7 +22,7 @@ var TableCell = function TableCell(_ref) {
22
22
  whiteSpace: column !== null && column !== void 0 && column.noWrap ? 'nowrap' : 'normal'
23
23
  }, currentRowValue === null || currentRowValue === void 0 ? void 0 : currentRowValue.style),
24
24
  "data-column": column.prop,
25
- key: "row-td-".concat(index, "-").concat(column.prop.toString()),
25
+ key: "row-td-".concat(currentRowValue.id, "-").concat(column.prop.toString()),
26
26
  onClick: function onClick() {
27
27
  return onCellClick && onCellClick(currentRowValue, rowIndex, index);
28
28
  },
@@ -5,10 +5,12 @@ import _JSXStyle from "../styled-jsx.es.js";
5
5
  import React, { useMemo } from 'react';
6
6
  import { useTheme } from '@helpdice/theme';
7
7
  import Input from '../input';
8
+ import { uniqueId } from 'lodash';
8
9
  import Select from '../select';
9
10
  // import Button from '../button'
10
11
 
11
12
  var makeColgroup = function makeColgroup(width, columns) {
13
+ var colId = uniqueId('col');
12
14
  var unsetWidthCount = columns.filter(function (c) {
13
15
  return !c.width;
14
16
  }).length;
@@ -17,9 +19,9 @@ var makeColgroup = function makeColgroup(width, columns) {
17
19
  }, 0);
18
20
  var averageWidth = (width - customWidthTotal) / unsetWidthCount;
19
21
  if (averageWidth <= 0) return /*#__PURE__*/React.createElement("colgroup", null);
20
- return /*#__PURE__*/React.createElement("colgroup", null, columns.map(function (column, index) {
22
+ return /*#__PURE__*/React.createElement("colgroup", null, columns.map(function (column) {
21
23
  return /*#__PURE__*/React.createElement("col", {
22
- key: "colgroup-".concat(index),
24
+ key: "colgroup-".concat(colId),
23
25
  width: column.width || averageWidth
24
26
  });
25
27
  }));
@@ -5,7 +5,6 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
5
5
  var _excluded = ["children", "data", "initialData", "hover", "emptyText", "rowDraggable", "readOnly", "cursorPagination", "previousCursor", "nextCursor", "hasMore", "onNextPage", "onPreviousPage", "onRow", "onCell", "onChange", "onFilters", "onPageChange", "showFilters", "stickyHeader", "textPlaceholder", "onSelected", "dataLength", "viewLength", "className", "rowClassName"];
6
6
  import _JSXStyle from "../styled-jsx.es.js";
7
7
  /* "use client" */
8
-
9
8
  import React, { useEffect, useMemo, useRef, useState } from 'react';
10
9
  import TableHead from './table-head';
11
10
  import TableBody from './table-body';