@helpdice/ui 2.1.8 → 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 (100) hide show
  1. package/dist/auto-complete/index.js +2147 -8
  2. package/dist/button/index.js +2 -2
  3. package/dist/carousal/index.js +2 -2
  4. package/dist/container/box.d.ts +42 -0
  5. package/dist/container/index.d.ts +2 -0
  6. package/dist/container/index.js +948 -0
  7. package/dist/copy-to-clipboard/clipboard.d.ts +13 -1
  8. package/dist/copy-to-clipboard/index.d.ts +1 -1
  9. package/dist/copy-to-clipboard/index.js +142 -157
  10. package/dist/grid/index.d.ts +2 -3
  11. package/dist/grid/index.js +0 -1
  12. package/dist/index.d.ts +3 -4
  13. package/dist/index.js +15389 -15350
  14. package/dist/input/index.d.ts +4 -0
  15. package/dist/input/index.js +2151 -9
  16. package/dist/input/phone-input/phone.d.ts +13 -0
  17. package/dist/modal/index.js +2 -2
  18. package/dist/placeholder/index.js +643 -8
  19. package/dist/table/index.js +3515 -1368
  20. package/dist/text/child.d.ts +1 -0
  21. package/dist/text/index.js +686 -8
  22. package/dist/text/text.d.ts +1 -0
  23. package/esm/button/button.js +2 -2
  24. package/esm/container/box.d.ts +42 -0
  25. package/esm/container/box.js +39 -0
  26. package/esm/container/index.d.ts +2 -0
  27. package/esm/container/index.js +2 -0
  28. package/esm/copy-to-clipboard/clipboard.d.ts +13 -1
  29. package/esm/copy-to-clipboard/clipboard.js +91 -0
  30. package/esm/copy-to-clipboard/index.d.ts +1 -1
  31. package/esm/copy-to-clipboard/index.js +1 -1
  32. package/esm/grid/index.d.ts +2 -3
  33. package/esm/grid/index.js +5 -3
  34. package/esm/index.d.ts +3 -4
  35. package/esm/index.js +4 -3
  36. package/esm/input/index.d.ts +4 -0
  37. package/esm/input/index.js +4 -0
  38. package/esm/input/phone-input/phone.d.ts +13 -0
  39. package/esm/input/phone-input/phone.js +166 -0
  40. package/esm/text/child.d.ts +1 -0
  41. package/esm/text/text.d.ts +1 -0
  42. package/esm/text/text.js +25 -3
  43. package/package.json +8 -15
  44. package/dist/currency-input/index.js +0 -862
  45. package/dist/phone-input/index.js +0 -2033
  46. package/dist/phone-input/phone.d.ts +0 -11
  47. package/esm/phone-input/phone.d.ts +0 -11
  48. package/esm/phone-input/phone.js +0 -161
  49. /package/dist/{currency-input → input/currency-input}/components/CurrencyInput.d.ts +0 -0
  50. /package/dist/{currency-input → input/currency-input}/components/CurrencyInputProps.d.ts +0 -0
  51. /package/dist/{currency-input → input/currency-input}/components/utils/cleanValue.d.ts +0 -0
  52. /package/dist/{currency-input → input/currency-input}/components/utils/escapeRegExp.d.ts +0 -0
  53. /package/dist/{currency-input → input/currency-input}/components/utils/fixedDecimalValue.d.ts +0 -0
  54. /package/dist/{currency-input → input/currency-input}/components/utils/formatValue.d.ts +0 -0
  55. /package/dist/{currency-input → input/currency-input}/components/utils/getLocaleConfig.d.ts +0 -0
  56. /package/dist/{currency-input → input/currency-input}/components/utils/getSuffix.d.ts +0 -0
  57. /package/dist/{currency-input → input/currency-input}/components/utils/index.d.ts +0 -0
  58. /package/dist/{currency-input → input/currency-input}/components/utils/isNumber.d.ts +0 -0
  59. /package/dist/{currency-input → input/currency-input}/components/utils/padTrimValue.d.ts +0 -0
  60. /package/dist/{currency-input → input/currency-input}/components/utils/parseAbbrValue.d.ts +0 -0
  61. /package/dist/{currency-input → input/currency-input}/components/utils/removeInvalidChars.d.ts +0 -0
  62. /package/dist/{currency-input → input/currency-input}/components/utils/removeSeparators.d.ts +0 -0
  63. /package/dist/{currency-input → input/currency-input}/components/utils/repositionCursor.d.ts +0 -0
  64. /package/dist/{currency-input → input/currency-input}/index.d.ts +0 -0
  65. /package/dist/{phone-input → input/phone-input}/index.d.ts +0 -0
  66. /package/esm/{currency-input → input/currency-input}/components/CurrencyInput.d.ts +0 -0
  67. /package/esm/{currency-input → input/currency-input}/components/CurrencyInput.js +0 -0
  68. /package/esm/{currency-input → input/currency-input}/components/CurrencyInputProps.d.ts +0 -0
  69. /package/esm/{currency-input → input/currency-input}/components/CurrencyInputProps.js +0 -0
  70. /package/esm/{currency-input → input/currency-input}/components/utils/addSeparators.js +0 -0
  71. /package/esm/{currency-input → input/currency-input}/components/utils/cleanValue.d.ts +0 -0
  72. /package/esm/{currency-input → input/currency-input}/components/utils/cleanValue.js +0 -0
  73. /package/esm/{currency-input → input/currency-input}/components/utils/escapeRegExp.d.ts +0 -0
  74. /package/esm/{currency-input → input/currency-input}/components/utils/escapeRegExp.js +0 -0
  75. /package/esm/{currency-input → input/currency-input}/components/utils/fixedDecimalValue.d.ts +0 -0
  76. /package/esm/{currency-input → input/currency-input}/components/utils/fixedDecimalValue.js +0 -0
  77. /package/esm/{currency-input → input/currency-input}/components/utils/formatValue.d.ts +0 -0
  78. /package/esm/{currency-input → input/currency-input}/components/utils/formatValue.js +0 -0
  79. /package/esm/{currency-input → input/currency-input}/components/utils/getLocaleConfig.d.ts +0 -0
  80. /package/esm/{currency-input → input/currency-input}/components/utils/getLocaleConfig.js +0 -0
  81. /package/esm/{currency-input → input/currency-input}/components/utils/getSuffix.d.ts +0 -0
  82. /package/esm/{currency-input → input/currency-input}/components/utils/getSuffix.js +0 -0
  83. /package/esm/{currency-input → input/currency-input}/components/utils/index.d.ts +0 -0
  84. /package/esm/{currency-input → input/currency-input}/components/utils/index.js +0 -0
  85. /package/esm/{currency-input → input/currency-input}/components/utils/isNumber.d.ts +0 -0
  86. /package/esm/{currency-input → input/currency-input}/components/utils/isNumber.js +0 -0
  87. /package/esm/{currency-input → input/currency-input}/components/utils/padTrimValue.d.ts +0 -0
  88. /package/esm/{currency-input → input/currency-input}/components/utils/padTrimValue.js +0 -0
  89. /package/esm/{currency-input → input/currency-input}/components/utils/parseAbbrValue.d.ts +0 -0
  90. /package/esm/{currency-input → input/currency-input}/components/utils/parseAbbrValue.js +0 -0
  91. /package/esm/{currency-input → input/currency-input}/components/utils/removeInvalidChars.d.ts +0 -0
  92. /package/esm/{currency-input → input/currency-input}/components/utils/removeInvalidChars.js +0 -0
  93. /package/esm/{currency-input → input/currency-input}/components/utils/removeSeparators.d.ts +0 -0
  94. /package/esm/{currency-input → input/currency-input}/components/utils/removeSeparators.js +0 -0
  95. /package/esm/{currency-input → input/currency-input}/components/utils/repositionCursor.d.ts +0 -0
  96. /package/esm/{currency-input → input/currency-input}/components/utils/repositionCursor.js +0 -0
  97. /package/esm/{currency-input → input/currency-input}/index.d.ts +0 -0
  98. /package/esm/{currency-input → input/currency-input}/index.js +0 -0
  99. /package/esm/{phone-input → input/phone-input}/index.d.ts +0 -0
  100. /package/esm/{phone-input → input/phone-input}/index.js +0 -0
@@ -15,6 +15,7 @@ interface Props {
15
15
  span?: boolean;
16
16
  del?: boolean;
17
17
  em?: boolean;
18
+ collapse?: number;
18
19
  blockquote?: boolean;
19
20
  noWrap?: boolean;
20
21
  className?: string;
@@ -162,7 +162,7 @@ var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
162
162
  disabled: disabled,
163
163
  onClick: clickHandler
164
164
  }, props, {
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) || "")
165
+ className: _JSXStyle.dynamic([["905110486", [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) || "")
166
166
  }), loading && /*#__PURE__*/React.createElement(ButtonLoading, {
167
167
  color: color
168
168
  }), childrenWithIcon, dripShow && /*#__PURE__*/React.createElement(ButtonDrip, {
@@ -171,7 +171,7 @@ var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
171
171
  color: dripColor,
172
172
  onCompleted: dripCompletedHandle
173
173
  }), /*#__PURE__*/React.createElement(_JSXStyle, {
174
- id: "960361315",
174
+ id: "905110486",
175
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
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;}}")));
177
177
  });
@@ -0,0 +1,42 @@
1
+ declare const wrap: ["nowrap", "wrap", "wrap-reverse"];
2
+ export type Wrap = typeof wrap[number];
3
+ type ContainerProps = {
4
+ gap?: number;
5
+ children?: React.ReactNode;
6
+ wrap?: Wrap;
7
+ className?: string;
8
+ };
9
+ declare const _default: import("react").ForwardRefExoticComponent<ContainerProps & {
10
+ width?: string | number;
11
+ height?: string | number;
12
+ padding?: string | number;
13
+ margin?: string | number;
14
+ w?: string | number;
15
+ h?: string | number;
16
+ paddingLeft?: string | number;
17
+ paddingRight?: string | number;
18
+ paddingTop?: string | number;
19
+ paddingBottom?: string | number;
20
+ pl?: string | number;
21
+ pr?: string | number;
22
+ pt?: string | number;
23
+ pb?: string | number;
24
+ marginLeft?: string | number;
25
+ marginRight?: string | number;
26
+ marginTop?: string | number;
27
+ marginBottom?: string | number;
28
+ ml?: string | number;
29
+ mr?: string | number;
30
+ mt?: string | number;
31
+ mb?: string | number;
32
+ px?: string | number;
33
+ py?: string | number;
34
+ mx?: string | number;
35
+ my?: string | number;
36
+ font?: string | number;
37
+ unit?: string;
38
+ scale?: number;
39
+ children?: any;
40
+ className?: string;
41
+ } & import("react").InputHTMLAttributes<any> & import("react").RefAttributes<unknown>>;
42
+ export default _default;
@@ -0,0 +1,39 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["gap", "children", "className"];
4
+ import _JSXStyle from "../styled-jsx.es.js";
5
+ import GridBasicItem from "../grid/basic-item";
6
+ import useScale, { withScale } from '../use-scale';
7
+ import { useMemo } from "react";
8
+ import { useClasses } from '@helpdice/theme';
9
+ import { tuple } from '../utils/prop-types';
10
+ var wrap = tuple('nowrap', 'wrap', 'wrap-reverse');
11
+ var Container = function Container(_ref) {
12
+ var _ref$gap = _ref.gap,
13
+ gap = _ref$gap === void 0 ? 0 : _ref$gap,
14
+ children = _ref.children,
15
+ _ref$className = _ref.className,
16
+ className = _ref$className === void 0 ? '' : _ref$className,
17
+ props = _objectWithoutProperties(_ref, _excluded);
18
+ var _useScale = useScale(),
19
+ unit = _useScale.unit,
20
+ SCALES = _useScale.SCALES;
21
+ var gapUnit = useMemo(function () {
22
+ return "calc(".concat(gap, " * ").concat(unit, " * 1/3)");
23
+ }, [gap, unit]);
24
+ var _styles$className = {
25
+ styles: /*#__PURE__*/React.createElement(_JSXStyle, {
26
+ id: "2955470113",
27
+ dynamic: [gapUnit, wrap, SCALES.width(1, 'var(--container-width)')]
28
+ }, "div.__jsx-style-dynamic-selector{--gap-unit:".concat(gapUnit, ";--container-width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:").concat(wrap, ";-ms-flex-wrap:").concat(wrap, ";flex-wrap:").concat(wrap, ";box-sizing:border-box;gap:var(--gap-unit);width:").concat(SCALES.width(1, 'var(--container-width)'), ";}")),
29
+ className: _JSXStyle.dynamic([["2955470113", [gapUnit, wrap, SCALES.width(1, 'var(--container-width)')]]])
30
+ },
31
+ resolveClassName = _styles$className.className,
32
+ styles = _styles$className.styles;
33
+ var classes = useClasses(resolveClassName, className);
34
+ return /*#__PURE__*/React.createElement(GridBasicItem, _extends({
35
+ className: classes
36
+ }, props), children, styles);
37
+ };
38
+ Container.displayName = 'Container';
39
+ export default withScale(Container);
@@ -0,0 +1,2 @@
1
+ import Container from "./box";
2
+ export default Container;
@@ -0,0 +1,2 @@
1
+ import Container from "./box";
2
+ export default Container;
@@ -1,2 +1,14 @@
1
- export function Clipboard(props: any): React.JSX.Element;
2
1
  import React from 'react';
2
+ type ClipboardProps = {
3
+ showIcon: boolean;
4
+ text: string;
5
+ children: React.ReactNode;
6
+ onCopy: (text: string, result: any) => void;
7
+ options: {
8
+ debug: boolean;
9
+ message: string;
10
+ format: string;
11
+ };
12
+ };
13
+ export default function Clipboard(props: ClipboardProps): React.JSX.Element;
14
+ export {};
@@ -0,0 +1,91 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import React, { Children } from 'react';
3
+ import copy from './copy';
4
+ import { Copy } from '@helpdice/icons';
5
+ import Button from '../button';
6
+ import { useToasts } from '@helpdice/theme';
7
+ // export function Clipboard(props: ClipboardProps) {
8
+ // const { setToast } = useToasts();
9
+ // const { showIcon, text, onCopy, options: options, children, } = props;
10
+ // const elem: ReactNode = React.Children.only(children) as ReactNode;
11
+ // const onClick = (event: MouseEventHandler<HTMLButtonElement | MouseEvent>) => {
12
+ // const result = copy(text, options);
13
+
14
+ // if (result) {
15
+ // setToast({
16
+ // text: 'Text Copied'
17
+ // });
18
+ // }
19
+
20
+ // if (onCopy) {
21
+ // onCopy(text, result);
22
+ // }
23
+
24
+ // // Bypass onClick if it was present
25
+ // if (elem && elem.props && typeof elem.props.onClick === 'function') {
26
+ // elem.props.onClick(event);
27
+ // }
28
+ // };
29
+
30
+ // if (showIcon) {
31
+ // return React.cloneElement(
32
+ // <div>
33
+ // {elem}
34
+ // <Button auto scale={0.1} px={0.6} onClick={onClick} icon={<Copy />} />
35
+ // </div>,
36
+ // { ...props }
37
+ // );
38
+ // }
39
+
40
+ // return React.cloneElement(
41
+ // <div onClick={onClick}>
42
+ // {elem}
43
+ // </div>,
44
+ // { ...props }
45
+ // );
46
+ // }
47
+
48
+ export default function Clipboard(props) {
49
+ var _useToasts = useToasts(),
50
+ setToast = _useToasts.setToast;
51
+ var showIcon = props.showIcon,
52
+ text = props.text,
53
+ onCopy = props.onCopy,
54
+ options = props.options,
55
+ children = props.children;
56
+ var elem = Children.only(children);
57
+ var _onClick = function onClick() {
58
+ var result = copy(text, options);
59
+ if (result) {
60
+ setToast({
61
+ text: 'Text Copied'
62
+ });
63
+ }
64
+ if (onCopy) {
65
+ onCopy(text, result);
66
+ }
67
+
68
+ // ✅ Safely invoke child's onClick if it exists
69
+ // if (isValidElement(elem) && typeof elem?.props?.onClick === 'function') {
70
+ // elem.props.onClick();
71
+ // }
72
+ };
73
+
74
+ // If showIcon is true, render the child + a copy icon button
75
+ if (showIcon) {
76
+ return /*#__PURE__*/React.createElement("div", null, elem, /*#__PURE__*/React.createElement(Button, {
77
+ auto: true,
78
+ scale: 0.1,
79
+ px: 0.6,
80
+ onClick: function onClick() {
81
+ return _onClick;
82
+ },
83
+ icon: /*#__PURE__*/React.createElement(Copy, null)
84
+ }));
85
+ }
86
+
87
+ // Otherwise, make the entire div clickable for copy
88
+ return /*#__PURE__*/React.cloneElement(/*#__PURE__*/React.createElement("div", {
89
+ onClick: _onClick
90
+ }, elem), _extends({}, props));
91
+ }
@@ -1,2 +1,2 @@
1
- import { Clipboard } from "./clipboard.jsx";
1
+ import Clipboard from "./clipboard";
2
2
  export default Clipboard;
@@ -1,2 +1,2 @@
1
- import { Clipboard } from "./clipboard.jsx";
1
+ import Clipboard from "./clipboard";
2
2
  export default Clipboard;
@@ -1,12 +1,11 @@
1
1
  import Grid from './grid-base';
2
- import Container from './grid-container';
2
+ import GridContainer from './grid-container';
3
3
  export type GridComponentType = typeof Grid & {
4
- Container: typeof Container;
4
+ Container: typeof GridContainer;
5
5
  };
6
6
  export type { GridContainerProps } from './grid-container';
7
7
  export type { GridProps } from './grid-base';
8
8
  export type { GridBreakpointsValue } from './basic-item';
9
9
  export type { GridAlignContent, GridAlignItems, GridDirection, GridJustify, GridWrap, } from './grid-types';
10
- export { Container };
11
10
  declare const _default: GridComponentType;
12
11
  export default _default;
package/esm/grid/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  /* "use client" */;
2
2
  import Grid from './grid-base';
3
- import Container from './grid-container';
4
- Grid.Container = Container;
5
- export { Container };
3
+ import GridContainer from './grid-container';
4
+ Grid.Container = GridContainer;
5
+ // export {
6
+ // Container
7
+ // }
6
8
  export default Grid;
package/esm/index.d.ts CHANGED
@@ -36,8 +36,9 @@ export type { DrawerProps } from './drawer';
36
36
  export { default as Fieldset } from './fieldset';
37
37
  export type { FieldsetProps, FieldsetTitleProps, FieldsetSubtitleProps, FieldsetGroupProps, FieldsetFooterProps, FieldsetContentProps, } from './fieldset';
38
38
  export * from './form';
39
- export { default as Grid, Container } from './grid';
39
+ export { default as Grid } from './grid';
40
40
  export type { GridProps, GridContainerProps } from './grid';
41
+ export { default as Container } from './container';
41
42
  export { default as HtmlRenderer } from './html-renderer';
42
43
  export { default as Image } from './image';
43
44
  export type { ImageProps, ImageBrowserProps } from './image';
@@ -61,7 +62,6 @@ export { default as Popover } from './popover';
61
62
  export type { PopoverProps, PopoverItemProps } from './popover';
62
63
  export { default as List } from './list';
63
64
  export { default as Menu } from './menu';
64
- export { default as PhoneInput } from './phone-input';
65
65
  export { default as Progress } from './progress';
66
66
  export type { ProgressProps } from './progress';
67
67
  export { default as Radio } from './radio';
@@ -125,8 +125,7 @@ export { default as Swipe } from './swipe';
125
125
  export type { SwipeProps } from './swipe';
126
126
  export { Carousel } from './carousal';
127
127
  export type { CarouselProps } from './carousal';
128
- export { default as CurrencyInput } from './currency-input';
129
- export type { CurrencyInputProps, CurrencyInputOnChangeValues } from './currency-input';
128
+ export type { CurrencyInputProps, CurrencyInputOnChangeValues } from './input/currency-input';
130
129
  export { default as useToasts } from './use-toasts';
131
130
  export type { Toast, ToastInput, ToastAction, ToastLayout } from './use-toasts';
132
131
  export { default as Clipboard } from './copy-to-clipboard';
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';
@@ -84,7 +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
+
89
90
  export { default as useToasts } from './use-toasts';
90
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;
@@ -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;
@@ -4,6 +4,7 @@ export interface Props {
4
4
  tag: keyof JSX.IntrinsicElements;
5
5
  color?: NormalTypes;
6
6
  className?: string;
7
+ collapse?: number;
7
8
  }
8
9
  type NativeAttrs = Omit<React.DetailsHTMLAttributes<any>, keyof Props>;
9
10
  export type TextChildProps = Props & NativeAttrs;
@@ -15,6 +15,7 @@ interface Props {
15
15
  span?: boolean;
16
16
  del?: boolean;
17
17
  em?: boolean;
18
+ collapse?: number;
18
19
  blockquote?: boolean;
19
20
  noWrap?: boolean;
20
21
  className?: string;
package/esm/text/text.js CHANGED
@@ -1,10 +1,12 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "b", "small", "i", "span", "del", "em", "blockquote", "noWrap", "children", "className"];
4
+ var _excluded = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "b", "small", "i", "span", "del", "em", "blockquote", "noWrap", "collapse", "children", "className"];
4
5
  /* "use client" */;
5
- import React, { useMemo } from 'react';
6
+ import React, { useMemo, useState } from 'react';
6
7
  import TextChild from './child';
7
8
  import { withScale } from '../use-scale';
9
+ import Button from '../button';
8
10
  var _getModifierChild = function getModifierChild(tags, children) {
9
11
  if (!tags.length) return children;
10
12
  var nextTag = tags.slice(1, tags.length);
@@ -43,6 +45,8 @@ var TextComponent = function TextComponent(_ref) {
43
45
  blockquote = _ref$blockquote === void 0 ? false : _ref$blockquote,
44
46
  _ref$noWrap = _ref.noWrap,
45
47
  noWrap = _ref$noWrap === void 0 ? false : _ref$noWrap,
48
+ _ref$collapse = _ref.collapse,
49
+ collapse = _ref$collapse === void 0 ? 0 : _ref$collapse,
46
50
  children = _ref.children,
47
51
  _ref$className = _ref.className,
48
52
  className = _ref$className === void 0 ? '' : _ref$className,
@@ -82,6 +86,10 @@ var TextComponent = function TextComponent(_ref) {
82
86
  *
83
87
  */
84
88
 
89
+ var _useState = useState(false),
90
+ _useState2 = _slicedToArray(_useState, 2),
91
+ expand = _useState2[0],
92
+ setExpand = _useState2[1];
85
93
  var tag = useMemo(function () {
86
94
  if (names[0]) return names[0];
87
95
  if (inlineNames[0]) return inlineNames[0];
@@ -100,7 +108,21 @@ var TextComponent = function TextComponent(_ref) {
100
108
  },
101
109
  className: "".concat(className, " ").concat(noWrap ? 'no-wrap' : ''),
102
110
  tag: tag
103
- }, props), modifers);
111
+ }, props), typeof children === 'string' && collapse > 50 ? /*#__PURE__*/React.createElement(React.Fragment, null, expand ? modifers : (modifers === null || modifers === void 0 ? void 0 : modifers.toString().substring(0, collapse)) + '...', /*#__PURE__*/React.createElement(Button, {
112
+ margin: 0,
113
+ onClick: function onClick() {
114
+ return setExpand(!expand);
115
+ },
116
+ style: {
117
+ textTransform: 'lowercase'
118
+ },
119
+ effect: false,
120
+ color: "abort",
121
+ scale: 2 / 3,
122
+ px: 0.2,
123
+ py: 0,
124
+ auto: true
125
+ }, /*#__PURE__*/React.createElement("b", null, expand ? 'less' : 'more'))) : modifers);
104
126
  };
105
127
  TextComponent.displayName = 'Text';
106
128
  var Text = withScale(TextComponent);