@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.
- package/dist/auto-complete/index.js +2158 -17
- package/dist/button/button.d.ts +1 -1
- package/dist/button/index.js +73 -16
- package/dist/button/styles.d.ts +1 -0
- package/dist/carousal/index.js +73 -16
- package/dist/container/box.d.ts +42 -0
- package/dist/container/index.d.ts +2 -0
- package/dist/container/index.js +948 -0
- package/dist/copy-to-clipboard/clipboard.d.ts +14 -0
- package/dist/copy-to-clipboard/copy.d.ts +2 -0
- package/dist/copy-to-clipboard/index.d.ts +2 -0
- package/dist/copy-to-clipboard/index.js +1702 -0
- package/dist/copy-to-clipboard/toggle-selection.d.ts +1 -0
- package/dist/grid/index.d.ts +2 -3
- package/dist/grid/index.js +0 -1
- package/dist/html-renderer/index.js +35 -12
- package/dist/index.d.ts +6 -6
- package/dist/index.js +15776 -15418
- package/dist/input/index.d.ts +4 -0
- package/dist/input/index.js +2162 -18
- package/dist/input/input-props.d.ts +1 -0
- package/dist/input/phone-input/phone.d.ts +13 -0
- package/dist/modal/index.js +73 -16
- package/dist/notetip/index.js +690 -0
- package/{esm/notetip/index.d.ts → dist/notetip/note-tip.d.ts} +2 -2
- package/dist/placeholder/index.js +643 -8
- package/dist/table/index.js +4370 -2163
- package/dist/text/child.d.ts +1 -0
- package/dist/text/index.js +686 -8
- package/dist/text/text.d.ts +1 -0
- package/esm/button/button.d.ts +1 -1
- package/esm/button/button.js +51 -5
- package/esm/button/styles.d.ts +1 -0
- package/esm/button/styles.js +22 -11
- package/esm/container/box.d.ts +42 -0
- package/esm/container/box.js +39 -0
- package/esm/container/index.d.ts +2 -0
- package/esm/container/index.js +2 -0
- package/esm/copy-to-clipboard/clipboard.d.ts +14 -0
- package/esm/copy-to-clipboard/clipboard.js +91 -0
- package/esm/copy-to-clipboard/copy.d.ts +2 -0
- package/esm/copy-to-clipboard/copy.js +105 -0
- package/esm/copy-to-clipboard/index.d.ts +2 -0
- package/esm/copy-to-clipboard/index.js +2 -0
- package/esm/copy-to-clipboard/toggle-selection.d.ts +1 -0
- package/esm/copy-to-clipboard/toggle-selection.js +31 -0
- package/esm/grid/index.d.ts +2 -3
- package/esm/grid/index.js +5 -3
- package/esm/index.d.ts +6 -6
- package/esm/index.js +7 -5
- package/esm/input/index.d.ts +4 -0
- package/esm/input/index.js +4 -0
- package/esm/input/input-field.js +12 -10
- package/esm/input/input-props.d.ts +1 -0
- package/esm/input/phone-input/phone.d.ts +13 -0
- package/esm/input/phone-input/phone.js +166 -0
- package/esm/notetip/index.js +2 -97
- package/{dist/notetip/index.d.ts → esm/notetip/note-tip.d.ts} +2 -2
- package/esm/notetip/note-tip.js +97 -0
- package/esm/table/table-body.js +2 -2
- package/esm/table/table-cell.js +1 -1
- package/esm/table/table-head.js +4 -2
- package/esm/table/table.js +0 -1
- package/esm/text/child.d.ts +1 -0
- package/esm/text/text.d.ts +1 -0
- package/esm/text/text.js +25 -3
- package/package.json +19 -19
- package/dist/currency-input/index.js +0 -862
- package/dist/phone-input/index.js +0 -2033
- package/dist/phone-input/phone.d.ts +0 -11
- package/esm/phone-input/phone.d.ts +0 -11
- package/esm/phone-input/phone.js +0 -161
- /package/dist/{currency-input → input/currency-input}/components/CurrencyInput.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/CurrencyInputProps.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/cleanValue.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/escapeRegExp.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/fixedDecimalValue.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/formatValue.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/getLocaleConfig.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/getSuffix.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/index.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/isNumber.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/padTrimValue.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/parseAbbrValue.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/removeInvalidChars.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/removeSeparators.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/components/utils/repositionCursor.d.ts +0 -0
- /package/dist/{currency-input → input/currency-input}/index.d.ts +0 -0
- /package/dist/{phone-input → input/phone-input}/index.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/CurrencyInput.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/CurrencyInput.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/CurrencyInputProps.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/CurrencyInputProps.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/addSeparators.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/cleanValue.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/cleanValue.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/escapeRegExp.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/escapeRegExp.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/fixedDecimalValue.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/fixedDecimalValue.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/formatValue.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/formatValue.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/getLocaleConfig.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/getLocaleConfig.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/getSuffix.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/getSuffix.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/index.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/index.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/isNumber.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/isNumber.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/padTrimValue.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/padTrimValue.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/parseAbbrValue.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/parseAbbrValue.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/removeInvalidChars.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/removeInvalidChars.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/removeSeparators.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/removeSeparators.js +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/repositionCursor.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/components/utils/repositionCursor.js +0 -0
- /package/esm/{currency-input → input/currency-input}/index.d.ts +0 -0
- /package/esm/{currency-input → input/currency-input}/index.js +0 -0
- /package/esm/{phone-input → input/phone-input}/index.d.ts +0 -0
- /package/esm/{phone-input → input/phone-input}/index.js +0 -0
package/dist/text/text.d.ts
CHANGED
package/esm/button/button.d.ts
CHANGED
package/esm/button/button.js
CHANGED
|
@@ -71,7 +71,8 @@ var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
|
|
|
71
71
|
}, [theme.palette, filteredProps]),
|
|
72
72
|
bg = _useMemo.bg,
|
|
73
73
|
border = _useMemo.border,
|
|
74
|
-
color = _useMemo.color
|
|
74
|
+
color = _useMemo.color,
|
|
75
|
+
rippleColor = _useMemo.ripple;
|
|
75
76
|
var hover = useMemo(function () {
|
|
76
77
|
return getButtonHoverColors(theme.palette, filteredProps);
|
|
77
78
|
}, [theme.palette, filteredProps]);
|
|
@@ -90,6 +91,45 @@ var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
|
|
|
90
91
|
setDripX(0);
|
|
91
92
|
setDripY(0);
|
|
92
93
|
};
|
|
94
|
+
var createRipple = function createRipple(event) {
|
|
95
|
+
var button = buttonRef.current;
|
|
96
|
+
if (!button) return;
|
|
97
|
+
var rect = button.getBoundingClientRect();
|
|
98
|
+
var size = Math.max(rect.width, rect.height);
|
|
99
|
+
var x = event.clientX - rect.left - size / 2;
|
|
100
|
+
var y = event.clientY - rect.top - size / 2;
|
|
101
|
+
var rippleCount = 1; // number of rings
|
|
102
|
+
var rippleDelay = 500; // ms between each ripple
|
|
103
|
+
var _loop = function _loop() {
|
|
104
|
+
var ripple = document.createElement('span');
|
|
105
|
+
Object.assign(ripple.style, {
|
|
106
|
+
position: 'absolute',
|
|
107
|
+
borderRadius: '50%',
|
|
108
|
+
backgroundColor: rippleColor,
|
|
109
|
+
width: "".concat(size, "px"),
|
|
110
|
+
height: "".concat(size, "px"),
|
|
111
|
+
left: "".concat(x, "px"),
|
|
112
|
+
top: "".concat(y, "px"),
|
|
113
|
+
pointerEvents: 'none',
|
|
114
|
+
transform: 'scale(0)',
|
|
115
|
+
opacity: '1',
|
|
116
|
+
transition: "transform 600ms ease-out ".concat(i * rippleDelay, "ms, opacity 600ms ease-out ").concat(i * rippleDelay, "ms"),
|
|
117
|
+
zIndex: 1
|
|
118
|
+
});
|
|
119
|
+
button.appendChild(ripple);
|
|
120
|
+
|
|
121
|
+
// Force reflow to start transition
|
|
122
|
+
window.getComputedStyle(ripple).opacity;
|
|
123
|
+
ripple.style.transform = 'scale(2.5)';
|
|
124
|
+
ripple.style.opacity = '0';
|
|
125
|
+
ripple.addEventListener('transitionend', function () {
|
|
126
|
+
ripple.remove();
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
for (var i = 0; i < rippleCount; i++) {
|
|
130
|
+
_loop();
|
|
131
|
+
}
|
|
132
|
+
};
|
|
93
133
|
var clickHandler = function clickHandler(event) {
|
|
94
134
|
if (disabled || loading) return;
|
|
95
135
|
var showDrip = !shadow && !ghost && effect;
|
|
@@ -100,6 +140,9 @@ var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
|
|
|
100
140
|
setDripX(event.clientX - rect.left);
|
|
101
141
|
setDripY(event.clientY - rect.top);
|
|
102
142
|
}
|
|
143
|
+
if (shadow) {
|
|
144
|
+
createRipple(event);
|
|
145
|
+
}
|
|
103
146
|
onClick && onClick(event);
|
|
104
147
|
};
|
|
105
148
|
var childrenWithIcon = useMemo(function () {
|
|
@@ -110,13 +153,16 @@ var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
|
|
|
110
153
|
}, [auto, children, icon, iconRight]);
|
|
111
154
|
var paddingLeft = auto ? SCALES.pl(1.15) : SCALES.pl(1.375),
|
|
112
155
|
paddingRight = auto ? SCALES.pr(1.15) : SCALES.pr(1.375);
|
|
156
|
+
|
|
157
|
+
// If shadow provided is string then value other default
|
|
158
|
+
var btnShadow = typeof shadow === 'string' ? shadow : shadow ? theme.shadows.level.z2 : 'none';
|
|
113
159
|
return /*#__PURE__*/React.createElement("button", _extends({
|
|
114
160
|
ref: buttonRef,
|
|
115
161
|
type: type,
|
|
116
162
|
disabled: disabled,
|
|
117
163
|
onClick: clickHandler
|
|
118
164
|
}, props, {
|
|
119
|
-
className: _JSXStyle.dynamic([["
|
|
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) || "")
|
|
120
166
|
}), loading && /*#__PURE__*/React.createElement(ButtonLoading, {
|
|
121
167
|
color: color
|
|
122
168
|
}), childrenWithIcon, dripShow && /*#__PURE__*/React.createElement(ButtonDrip, {
|
|
@@ -125,9 +171,9 @@ var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
|
|
|
125
171
|
color: dripColor,
|
|
126
172
|
onCompleted: dripCompletedHandle
|
|
127
173
|
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
128
|
-
id: "
|
|
129
|
-
dynamic: [SCALES.height(2.5), round ? '50%' : theme.layout.radius, SCALES.font(0.875), color, bg, border, cursor, events, shadow ?
|
|
130
|
-
}, ".btn.__jsx-style-dynamic-selector{box-sizing:border-box;display:inline-block;line-height:".concat(SCALES.height(2.5), ";border-radius:").concat(round ? '50%' : theme.layout.radius, ";font-weight:400;font-size:").concat(SCALES.font(0.875), ";-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;outline:none;text-transform:capitalize;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center;white-space:nowrap;-webkit-transition:background-color 200ms ease 0ms,box-shadow 200ms ease 0ms, border 200ms ease 0ms,color 200ms ease 0ms;transition:background-color 200ms ease 0ms,box-shadow 200ms ease 0ms, border 200ms ease 0ms,color 200ms ease 0ms;position:relative;overflow:hidden;color:").concat(color, ";background-color:").concat(bg, ";border:1px solid ").concat(border, ";cursor:").concat(cursor, ";pointer-events:").concat(events, ";box-shadow:").concat(shadow ?
|
|
174
|
+
id: "905110486",
|
|
175
|
+
dynamic: [SCALES.height(2.5), round ? '50%' : theme.layout.radius, SCALES.font(0.875), color, bg, shadow ? 'transparent' : border, cursor, events, shadow ? btnShadow : 'none', SCALES.pl(0.727), SCALES.height(2.5), color, bg, auto ? 'min-content' : SCALES.width(10.5), auto ? 'auto' : 'initial', SCALES.height(2.5), SCALES.pt(0), paddingRight, SCALES.pb(0), paddingLeft, SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), hover.color, hover.color, hover.bg, hover.border, cursor, events, btnShadow, shadow ? '-1px' : '0px']
|
|
176
|
+
}, ".btn.__jsx-style-dynamic-selector{box-sizing:border-box;display:inline-block;line-height:".concat(SCALES.height(2.5), ";border-radius:").concat(round ? '50%' : theme.layout.radius, ";font-weight:400;font-size:").concat(SCALES.font(0.875), ";-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;outline:none;text-transform:capitalize;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center;white-space:nowrap;-webkit-transition:background-color 200ms ease 0ms,box-shadow 200ms ease 0ms, border 200ms ease 0ms,color 200ms ease 0ms;transition:background-color 200ms ease 0ms,box-shadow 200ms ease 0ms, border 200ms ease 0ms,color 200ms ease 0ms;position:relative;overflow:hidden;color:").concat(color, ";background-color:").concat(bg, ";border:1px solid ").concat(shadow ? 'transparent' : border, ";cursor:").concat(cursor, ";pointer-events:").concat(events, ";box-shadow:").concat(shadow ? btnShadow : 'none', ";--helpdice-ui-button-icon-padding:").concat(SCALES.pl(0.727), ";--helpdice-ui-button-height:").concat(SCALES.height(2.5), ";--helpdice-ui-button-color:").concat(color, ";--helpdice-ui-button-bg:").concat(bg, ";min-width:").concat(auto ? 'min-content' : SCALES.width(10.5), ";width:").concat(auto ? 'auto' : 'initial', ";height:").concat(SCALES.height(2.5), ";padding:").concat(SCALES.pt(0), " ").concat(paddingRight, " ").concat(SCALES.pb(0), " ").concat(paddingLeft, ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}.btn.__jsx-style-dynamic-selector:hover,.btn.__jsx-style-dynamic-selector:focus{color:").concat(hover.color, ";--helpdice-ui-button-color:").concat(hover.color, ";background-color:").concat(hover.bg, ";border-color:").concat(hover.border, ";cursor:").concat(cursor, ";pointer-events:").concat(events, ";box-shadow:").concat(btnShadow, ";}.btn.__jsx-style-dynamic-selector .text{position:relative;z-index:1;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;text-align:center;line-height:inherit;top:-1px;}.btn.__jsx-style-dynamic-selector .text p,.btn.__jsx-style-dynamic-selector .text pre,.btn.__jsx-style-dynamic-selector .text div{margin:0;}.ripple.__jsx-style-dynamic-selector{position:absolute;border-radius:50%;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);-webkit-animation:ripple-animation-__jsx-style-dynamic-selector 600ms ease-out;animation:ripple-animation-__jsx-style-dynamic-selector 600ms ease-out;background-color:rgba(0,0,0,0.3);pointer-events:none;z-index:1;}@-webkit-keyframes ripple-animation-__jsx-style-dynamic-selector{to{-webkit-transform:scale(2.5);-ms-transform:scale(2.5);transform:scale(2.5);opacity:0;}}@keyframes ripple-animation-__jsx-style-dynamic-selector{to{-webkit-transform:scale(2.5);-ms-transform:scale(2.5);transform:scale(2.5);opacity:0;}}")));
|
|
131
177
|
});
|
|
132
178
|
ButtonComponent.displayName = 'Button';
|
|
133
179
|
var Button = withScale(ButtonComponent);
|
package/esm/button/styles.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export interface ButtonColorGroup {
|
|
|
5
5
|
bg: string;
|
|
6
6
|
border: string;
|
|
7
7
|
color: string;
|
|
8
|
+
ripple?: string;
|
|
8
9
|
}
|
|
9
10
|
export declare const getButtonGhostColors: (palette: HUIThemesPalette, _color: ButtonTypes) => ButtonColorGroup | null;
|
|
10
11
|
export declare const getButtonColors: (palette: HUIThemesPalette, props: ButtonProps) => ButtonColorGroup;
|
package/esm/button/styles.js
CHANGED
|
@@ -5,22 +5,26 @@ export var getButtonGhostColors = function getButtonGhostColors(palette, _color)
|
|
|
5
5
|
secondary: {
|
|
6
6
|
bg: palette.background,
|
|
7
7
|
border: palette.foreground,
|
|
8
|
-
color: palette.foreground
|
|
8
|
+
color: palette.foreground,
|
|
9
|
+
ripple: ''
|
|
9
10
|
},
|
|
10
11
|
success: {
|
|
11
12
|
bg: palette.background,
|
|
12
13
|
border: palette.success,
|
|
13
|
-
color: palette.success
|
|
14
|
+
color: palette.success,
|
|
15
|
+
ripple: ''
|
|
14
16
|
},
|
|
15
17
|
warning: {
|
|
16
18
|
bg: palette.background,
|
|
17
19
|
border: palette.warning,
|
|
18
|
-
color: palette.warning
|
|
20
|
+
color: palette.warning,
|
|
21
|
+
ripple: ''
|
|
19
22
|
},
|
|
20
23
|
error: {
|
|
21
24
|
bg: palette.background,
|
|
22
25
|
border: palette.error,
|
|
23
|
-
color: palette.error
|
|
26
|
+
color: palette.error,
|
|
27
|
+
ripple: ''
|
|
24
28
|
}
|
|
25
29
|
};
|
|
26
30
|
return colors[_color] || null;
|
|
@@ -33,38 +37,45 @@ export var getButtonColors = function getButtonColors(palette, props) {
|
|
|
33
37
|
"default": {
|
|
34
38
|
bg: palette.background,
|
|
35
39
|
border: palette.border,
|
|
36
|
-
color: palette.accents_5
|
|
40
|
+
color: palette.accents_5,
|
|
41
|
+
ripple: palette.accents_1
|
|
37
42
|
},
|
|
38
43
|
secondary: {
|
|
39
44
|
bg: palette.foreground,
|
|
40
45
|
border: palette.foreground,
|
|
41
|
-
color: palette.background
|
|
46
|
+
color: palette.background,
|
|
47
|
+
ripple: palette.accents_1
|
|
42
48
|
},
|
|
43
49
|
success: {
|
|
44
50
|
bg: palette.success,
|
|
45
51
|
border: palette.success,
|
|
46
|
-
color: '#fff'
|
|
52
|
+
color: '#fff',
|
|
53
|
+
ripple: '#1f93ffff'
|
|
47
54
|
},
|
|
48
55
|
warning: {
|
|
49
56
|
bg: palette.warning,
|
|
50
57
|
border: palette.warning,
|
|
51
|
-
color: '#fff'
|
|
58
|
+
color: '#fff',
|
|
59
|
+
ripple: '#ffca29ff'
|
|
52
60
|
},
|
|
53
61
|
error: {
|
|
54
62
|
bg: palette.error,
|
|
55
63
|
border: palette.error,
|
|
56
|
-
color: '#fff'
|
|
64
|
+
color: '#fff',
|
|
65
|
+
ripple: '#ff5a55ff'
|
|
57
66
|
},
|
|
58
67
|
abort: {
|
|
59
68
|
bg: 'transparent',
|
|
60
69
|
border: 'transparent',
|
|
61
|
-
color: palette.accents_5
|
|
70
|
+
color: palette.accents_5,
|
|
71
|
+
ripple: palette.accents_1
|
|
62
72
|
}
|
|
63
73
|
};
|
|
64
74
|
if (disabled) return {
|
|
65
75
|
bg: palette.accents_1,
|
|
66
76
|
border: palette.accents_2,
|
|
67
|
-
color: '#ccc'
|
|
77
|
+
color: '#ccc',
|
|
78
|
+
ripple: ''
|
|
68
79
|
};
|
|
69
80
|
|
|
70
81
|
/**
|
|
@@ -0,0 +1,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,14 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
import deselectCurrent from './toggle-selection';
|
|
4
|
+
var clipboardToIE11Formatting = {
|
|
5
|
+
'text/plain': 'Text',
|
|
6
|
+
'text/html': 'Url',
|
|
7
|
+
"default": 'Text'
|
|
8
|
+
};
|
|
9
|
+
var defaultMessage = 'Copy to clipboard: #{key}, Enter';
|
|
10
|
+
function format(message) {
|
|
11
|
+
var copyKey = (/mac os x/i.test(navigator.userAgent) ? '⌘' : 'Ctrl') + '+C';
|
|
12
|
+
return message.replace(/#{\s*key\s*}/g, copyKey);
|
|
13
|
+
}
|
|
14
|
+
function copy(text, options) {
|
|
15
|
+
var debug,
|
|
16
|
+
message,
|
|
17
|
+
reselectPrevious,
|
|
18
|
+
range,
|
|
19
|
+
selection,
|
|
20
|
+
mark,
|
|
21
|
+
success = false;
|
|
22
|
+
if (!options) {
|
|
23
|
+
options = {};
|
|
24
|
+
}
|
|
25
|
+
debug = options.debug || false;
|
|
26
|
+
try {
|
|
27
|
+
reselectPrevious = deselectCurrent();
|
|
28
|
+
range = document.createRange();
|
|
29
|
+
selection = document.getSelection();
|
|
30
|
+
mark = document.createElement('span');
|
|
31
|
+
mark.textContent = text;
|
|
32
|
+
// avoid screen readers from reading out loud the text
|
|
33
|
+
mark.ariaHidden = 'true';
|
|
34
|
+
// reset user styles for span element
|
|
35
|
+
mark.style.all = 'unset';
|
|
36
|
+
// prevents scrolling to the end of the page
|
|
37
|
+
mark.style.position = 'fixed';
|
|
38
|
+
mark.style.top = 0;
|
|
39
|
+
mark.style.clip = 'rect(0, 0, 0, 0)';
|
|
40
|
+
// used to preserve spaces and line breaks
|
|
41
|
+
mark.style.whiteSpace = 'pre';
|
|
42
|
+
// do not inherit user-select (it may be `none`)
|
|
43
|
+
mark.style.webkitUserSelect = 'text';
|
|
44
|
+
mark.style.MozUserSelect = 'text';
|
|
45
|
+
mark.style.msUserSelect = 'text';
|
|
46
|
+
mark.style.userSelect = 'text';
|
|
47
|
+
mark.addEventListener('copy', function (e) {
|
|
48
|
+
e.stopPropagation();
|
|
49
|
+
if (options.format) {
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
if (typeof e.clipboardData === 'undefined') {
|
|
52
|
+
// IE 11
|
|
53
|
+
debug && console.warn('unable to use e.clipboardData');
|
|
54
|
+
debug && console.warn('trying IE specific stuff');
|
|
55
|
+
window.clipboardData.clearData();
|
|
56
|
+
var format = clipboardToIE11Formatting[options.format] || clipboardToIE11Formatting['default'];
|
|
57
|
+
window.clipboardData.setData(format, text);
|
|
58
|
+
} else {
|
|
59
|
+
// all other browsers
|
|
60
|
+
e.clipboardData.clearData();
|
|
61
|
+
e.clipboardData.setData(options.format, text);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (options.onCopy) {
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
options.onCopy(e.clipboardData);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
document.body.appendChild(mark);
|
|
70
|
+
range.selectNodeContents(mark);
|
|
71
|
+
selection.addRange(range);
|
|
72
|
+
var successful = document.execCommand('copy');
|
|
73
|
+
if (!successful) {
|
|
74
|
+
throw new Error('copy command was unsuccessful');
|
|
75
|
+
}
|
|
76
|
+
success = true;
|
|
77
|
+
} catch (err) {
|
|
78
|
+
debug && console.error('unable to copy using execCommand: ', err);
|
|
79
|
+
debug && console.warn('trying IE specific stuff');
|
|
80
|
+
try {
|
|
81
|
+
window.clipboardData.setData(options.format || 'text', text);
|
|
82
|
+
options.onCopy && options.onCopy(window.clipboardData);
|
|
83
|
+
success = true;
|
|
84
|
+
} catch (err) {
|
|
85
|
+
debug && console.error('unable to copy using clipboardData: ', err);
|
|
86
|
+
debug && console.error('falling back to prompt');
|
|
87
|
+
message = format('message' in options ? options.message : defaultMessage);
|
|
88
|
+
window.prompt(message, text);
|
|
89
|
+
}
|
|
90
|
+
} finally {
|
|
91
|
+
if (selection) {
|
|
92
|
+
if (typeof selection.removeRange == 'function') {
|
|
93
|
+
selection.removeRange(range);
|
|
94
|
+
} else {
|
|
95
|
+
selection.removeAllRanges();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (mark) {
|
|
99
|
+
document.body.removeChild(mark);
|
|
100
|
+
}
|
|
101
|
+
reselectPrevious();
|
|
102
|
+
}
|
|
103
|
+
return success;
|
|
104
|
+
}
|
|
105
|
+
export default copy;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function _default(): () => void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export default function () {
|
|
2
|
+
var selection = document.getSelection();
|
|
3
|
+
if (!selection.rangeCount) {
|
|
4
|
+
return function () {};
|
|
5
|
+
}
|
|
6
|
+
var active = document.activeElement;
|
|
7
|
+
var ranges = [];
|
|
8
|
+
for (var i = 0; i < selection.rangeCount; i++) {
|
|
9
|
+
ranges.push(selection.getRangeAt(i));
|
|
10
|
+
}
|
|
11
|
+
switch (active.tagName.toUpperCase() // .toUpperCase handles XHTML
|
|
12
|
+
) {
|
|
13
|
+
case 'INPUT':
|
|
14
|
+
case 'TEXTAREA':
|
|
15
|
+
active.blur();
|
|
16
|
+
break;
|
|
17
|
+
default:
|
|
18
|
+
active = null;
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
selection.removeAllRanges();
|
|
22
|
+
return function () {
|
|
23
|
+
selection.type === 'Caret' && selection.removeAllRanges();
|
|
24
|
+
if (!selection.rangeCount) {
|
|
25
|
+
ranges.forEach(function (range) {
|
|
26
|
+
selection.addRange(range);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
active && active.focus();
|
|
30
|
+
};
|
|
31
|
+
}
|
package/esm/grid/index.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import Grid from './grid-base';
|
|
2
|
-
import
|
|
2
|
+
import GridContainer from './grid-container';
|
|
3
3
|
export type GridComponentType = typeof Grid & {
|
|
4
|
-
Container: typeof
|
|
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
|
|
4
|
-
Grid.Container =
|
|
5
|
-
export {
|
|
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
|
|
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';
|
|
@@ -93,9 +93,9 @@ export type { HUIThemes, HUserTheme } from './themes';
|
|
|
93
93
|
export { default as Toggle } from './toggle';
|
|
94
94
|
export type { ToggleProps } from './toggle';
|
|
95
95
|
export { default as Tooltip } from './tooltip';
|
|
96
|
-
export { default as Notetip } from './notetip';
|
|
96
|
+
export { default as Notetip } from './notetip/note-tip';
|
|
97
97
|
export type { TooltipProps } from './tooltip';
|
|
98
|
-
export type { NotetipProps } from './notetip';
|
|
98
|
+
export type { NotetipProps } from './notetip/note-tip';
|
|
99
99
|
export { default as Tree } from './tree';
|
|
100
100
|
export type { TreeProps } from './tree';
|
|
101
101
|
export { useTime, useTimer, useStopwatch } from './timer';
|
|
@@ -125,7 +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 {
|
|
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';
|
|
131
|
+
export { default as Clipboard } from './copy-to-clipboard';
|