@helpdice/ui 2.3.2 → 2.3.5

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.
@@ -853,7 +853,7 @@ var withScale = function withScale(Render) {
853
853
  return ScaleFC;
854
854
  };
855
855
 
856
- var _excluded$3 = ["src", "stacked", "text", "isSquare", "className", "children"];
856
+ var _excluded$3 = ["src", "errorSrc", "stacked", "text", "isSquare", "className", "children"];
857
857
 
858
858
  // type NativeAttrs = Omit<
859
859
  // Partial<React.ImgHTMLAttributes<any> & React.HTMLAttributes<any>>,
@@ -866,6 +866,7 @@ var safeText = function safeText(text) {
866
866
  };
867
867
  var AvatarComponent = function AvatarComponent(_ref) {
868
868
  var src = _ref.src,
869
+ errorSrc = _ref.errorSrc,
869
870
  _ref$stacked = _ref.stacked,
870
871
  stacked = _ref$stacked === void 0 ? false : _ref$stacked,
871
872
  _ref$text = _ref.text,
@@ -890,6 +891,11 @@ var AvatarComponent = function AvatarComponent(_ref) {
890
891
  src: src,
891
892
  draggable: false
892
893
  }, props, {
894
+ onError: function onError(e) {
895
+ var target = e.currentTarget;
896
+ target.onerror = null; // prevent loop
897
+ target.src = errorSrc !== null && errorSrc !== void 0 ? errorSrc : "https://helpdice.com/avatar.webp";
898
+ },
893
899
  className: _JSXStyle.dynamic([["2295275975", [theme$1.palette.accents_2, radius, theme$1.palette.background, SCALES.width(1.75) || SCALES.height(1.75), SCALES.height(1.75) || SCALES.width(1.75), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), marginLeft, radius, SCALES.font(1)]]]) + " " + (props && props.className != null && props.className || "avatar-img")
894
900
  })), showText && /*#__PURE__*/React.createElement("span", _extends({}, props, {
895
901
  className: _JSXStyle.dynamic([["2295275975", [theme$1.palette.accents_2, radius, theme$1.palette.background, SCALES.width(1.75) || SCALES.height(1.75), SCALES.height(1.75) || SCALES.width(1.75), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), marginLeft, radius, SCALES.font(1)]]]) + " " + (props && props.className != null && props.className || "avatar-text")
@@ -1,6 +1,7 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  interface Props {
3
3
  src?: string;
4
+ errorSrc?: string;
4
5
  stacked?: boolean;
5
6
  text?: string;
6
7
  isSquare?: boolean;
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["src", "stacked", "text", "isSquare", "className", "children"];
3
+ var _excluded = ["src", "errorSrc", "stacked", "text", "isSquare", "className", "children"];
4
4
  import _JSXStyle from "../styled-jsx.es.js";
5
5
  /* "use client" */
6
6
 
@@ -19,6 +19,7 @@ var safeText = function safeText(text) {
19
19
  };
20
20
  var AvatarComponent = function AvatarComponent(_ref) {
21
21
  var src = _ref.src,
22
+ errorSrc = _ref.errorSrc,
22
23
  _ref$stacked = _ref.stacked,
23
24
  stacked = _ref$stacked === void 0 ? false : _ref$stacked,
24
25
  _ref$text = _ref.text,
@@ -43,6 +44,11 @@ var AvatarComponent = function AvatarComponent(_ref) {
43
44
  src: src,
44
45
  draggable: false
45
46
  }, props, {
47
+ onError: function onError(e) {
48
+ var target = e.currentTarget;
49
+ target.onerror = null; // prevent loop
50
+ target.src = errorSrc !== null && errorSrc !== void 0 ? errorSrc : "https://helpdice.com/avatar.webp";
51
+ },
46
52
  className: _JSXStyle.dynamic([["2295275975", [theme.palette.accents_2, radius, theme.palette.background, SCALES.width(1.75) || SCALES.height(1.75), SCALES.height(1.75) || SCALES.width(1.75), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), marginLeft, radius, SCALES.font(1)]]]) + " " + (props && props.className != null && props.className || "avatar-img")
47
53
  })), showText && /*#__PURE__*/React.createElement("span", _extends({}, props, {
48
54
  className: _JSXStyle.dynamic([["2295275975", [theme.palette.accents_2, radius, theme.palette.background, SCALES.width(1.75) || SCALES.height(1.75), SCALES.height(1.75) || SCALES.width(1.75), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), marginLeft, radius, SCALES.font(1)]]]) + " " + (props && props.className != null && props.className || "avatar-text")
@@ -4,8 +4,6 @@ import Button from './button';
4
4
  import { useTheme } from '@helpdice/theme';
5
5
  var CompactButton = function CompactButton(_ref) {
6
6
  var _color = _ref.color,
7
- _ref$to = _ref.to,
8
- to = _ref$to === void 0 ? '/' : _ref$to,
9
7
  children = _ref.children,
10
8
  iconRight = _ref.iconRight,
11
9
  icon = _ref.icon,
@@ -13,27 +11,18 @@ var CompactButton = function CompactButton(_ref) {
13
11
  scale = _ref$scale === void 0 ? 2 / 3 : _ref$scale,
14
12
  type = _ref.type,
15
13
  style = _ref.style,
16
- a = _ref.a,
17
- _ref$target = _ref.target,
18
- target = _ref$target === void 0 ? "_self" : _ref$target,
19
14
  onClick = _ref.onClick;
20
15
  var theme = useTheme();
21
- if (a) {
22
- return /*#__PURE__*/React.createElement(Button, {
23
- icon: icon,
24
- style: _extends({}, style, {
25
- backgroundColor: theme.palette.background
26
- }),
27
- type: type,
28
- onClick: function onClick() {
29
- return window.open(to, target);
30
- },
31
- auto: true,
32
- scale: scale,
33
- px: 0.6,
34
- iconRight: iconRight
35
- }, children);
36
- }
16
+ // if (a) {
17
+ // return (
18
+ // <Button icon={icon} style={{
19
+ // ...style,
20
+ // backgroundColor: theme.palette.background
21
+ // }} type={type} onClick={() => window.open(to, target)} auto scale={scale} px={0.6} iconRight={iconRight}>
22
+ // {children}
23
+ // </Button>
24
+ // );
25
+ // }
37
26
  return /*#__PURE__*/React.createElement(Button, {
38
27
  icon: icon,
39
28
  style: _extends({}, style, {
@@ -6,6 +6,7 @@ interface Props {
6
6
  loading?: boolean;
7
7
  shadow?: boolean | string;
8
8
  round?: boolean;
9
+ a?: boolean;
9
10
  auto?: boolean;
10
11
  effect?: boolean;
11
12
  disabled?: boolean;
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
3
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
- var _excluded = ["children", "disabled", "color", "loading", "shadow", "ghost", "effect", "round", "onClick", "auto", "icon", "type", "iconRight", "className", "crossOrigin"];
4
+ var _excluded = ["children", "disabled", "color", "loading", "shadow", "ghost", "effect", "round", "a", "onClick", "auto", "icon", "type", "iconRight", "className", "crossOrigin"];
5
5
  import _JSXStyle from "../styled-jsx.es.js";
6
6
  /* "use client" */
7
7
 
@@ -52,6 +52,8 @@ var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
52
52
  effect = _filteredProps$effect === void 0 ? true : _filteredProps$effect,
53
53
  _filteredProps$round = filteredProps.round,
54
54
  round = _filteredProps$round === void 0 ? false : _filteredProps$round,
55
+ _filteredProps$a = filteredProps.a,
56
+ a = _filteredProps$a === void 0 ? false : _filteredProps$a,
55
57
  onClick = filteredProps.onClick,
56
58
  _filteredProps$auto = filteredProps.auto,
57
59
  auto = _filteredProps$auto === void 0 ? false : _filteredProps$auto,
@@ -156,7 +158,11 @@ var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
156
158
 
157
159
  // If shadow provided is string then value other default
158
160
  var btnShadow = typeof shadow === 'string' ? shadow : shadow ? theme.shadows.level.z2 : 'none';
159
- return /*#__PURE__*/React.createElement("button", _extends({
161
+ return /*#__PURE__*/React.createElement(React.Fragment, null, a ? /*#__PURE__*/React.createElement("a", _extends({}, props, {
162
+ 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) || "")
163
+ }), loading && /*#__PURE__*/React.createElement(ButtonLoading, {
164
+ color: color
165
+ }), childrenWithIcon) : /*#__PURE__*/React.createElement("button", _extends({
160
166
  ref: buttonRef,
161
167
  type: type,
162
168
  disabled: disabled,
@@ -170,7 +176,7 @@ var ButtonComponent = /*#__PURE__*/React.forwardRef(function (btnProps, ref) {
170
176
  y: dripY,
171
177
  color: dripColor,
172
178
  onCompleted: dripCompletedHandle
173
- }), /*#__PURE__*/React.createElement(_JSXStyle, {
179
+ })), /*#__PURE__*/React.createElement(_JSXStyle, {
174
180
  id: "905110486",
175
181
  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
182
  }, ".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;}}")));
@@ -1,5 +1,9 @@
1
1
  import Button from './button';
2
- export { default as LinkButton } from './button.compact';
2
+ import CompactButton from './button.compact';
3
3
  export type { ButtonProps } from './button';
4
4
  export type { ButtonTypes } from '../utils/prop-types';
5
- export default Button;
5
+ export type ButtonComponentType = typeof Button & {
6
+ Compact: typeof CompactButton;
7
+ };
8
+ declare const _default: ButtonComponentType;
9
+ export default _default;
@@ -1,5 +1,6 @@
1
1
  /* "use client" */
2
2
 
3
3
  import Button from './button';
4
- export { default as LinkButton } from './button.compact';
4
+ import CompactButton from './button.compact';
5
+ Button.Compact = CompactButton;
5
6
  export default Button;
package/esm/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export { default as Badge } from './badge';
6
6
  export type { BadgeProps, BadgeAnchorProps } from './badge';
7
7
  export { default as Breadcrumbs } from './breadcrumbs';
8
8
  export type { BreadcrumbsProps, BreadcrumbsItemProps, BreadcrumbsSeparatorProps, } from './breadcrumbs';
9
- export { default as Button, LinkButton } from './button';
9
+ export { default as Button } from './button';
10
10
  export type { ButtonProps } from './button';
11
11
  export { default as ButtonDropdown } from './button-dropdown';
12
12
  export type { ButtonDropdownProps, ButtonDropdownItemProps } from './button-dropdown';
package/esm/index.js CHANGED
@@ -5,7 +5,7 @@ export { default as AutoComplete } from './auto-complete';
5
5
  export { default as Avatar } from './avatar';
6
6
  export { default as Badge } from './badge';
7
7
  export { default as Breadcrumbs } from './breadcrumbs';
8
- export { default as Button, LinkButton } from './button';
8
+ export { default as Button } from './button';
9
9
  export { default as ButtonDropdown } from './button-dropdown';
10
10
  export { default as ButtonGroup } from './button-group';
11
11
  export { default as Capacity } from './capacity';
@@ -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", "error", "color", "helperText", "type", "icon", "variant", "iconRight", "iconClickable", "onIconClick", "initialValue", "onChange", "readOnly", "value", "onClearClick", "clearable", "className", "onBlur", "onFocus", "autoComplete", "placeholder", "children", "disabled", "fullWidth"];
4
+ var _excluded = ["label", "labelRight", "error", "color", "helperText", "type", "icon", "variant", "iconRight", "iconClickable", "onIconClick", "initialValue", "onChange", "readOnly", "value", "onClearClick", "clearable", "className", "onBlur", "onFocus", "onEnter", "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 */
@@ -50,6 +50,7 @@ var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
50
50
  className = _ref$className === void 0 ? '' : _ref$className,
51
51
  onBlur = _ref.onBlur,
52
52
  onFocus = _ref.onFocus,
53
+ onEnter = _ref.onEnter,
53
54
  _ref$autoComplete = _ref.autoComplete,
54
55
  autoComplete = _ref$autoComplete === void 0 ? 'off' : _ref$autoComplete,
55
56
  _ref$placeholder = _ref.placeholder,
@@ -129,6 +130,11 @@ var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
129
130
  setSelfValue(value);
130
131
  }
131
132
  });
133
+ var handleKeyDown = function handleKeyDown(e) {
134
+ if (e.key === "Enter") {
135
+ onEnter && onEnter(e);
136
+ }
137
+ };
132
138
  var controlledValue = isControlledComponent ? {
133
139
  value: selfValue
134
140
  } : {
@@ -156,7 +162,8 @@ var InputComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
156
162
  onFocus: focusHandler,
157
163
  onBlur: blurHandler,
158
164
  onChange: changeHandler,
159
- autoComplete: autoComplete
165
+ autoComplete: autoComplete,
166
+ onKeyDown: handleKeyDown
160
167
  }, inputProps, {
161
168
  className: _JSXStyle.dynamic([["2582554466", [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({
162
169
  disabled: disabled
@@ -24,6 +24,7 @@ export interface Props {
24
24
  onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;
25
25
  onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
26
26
  onIconClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
27
+ onEnter?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
27
28
  autoComplete?: string;
28
29
  crossOrigin?: any;
29
30
  onPointerEnterCapture?: any;
@@ -1,4 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _typeof from "@babel/runtime/helpers/esm/typeof";
2
3
  import React from 'react';
3
4
  var TableCell = function TableCell(_ref) {
4
5
  var columns = _ref.columns,
@@ -10,7 +11,7 @@ var TableCell = function TableCell(_ref) {
10
11
  return /*#__PURE__*/React.createElement(React.Fragment, null, columns.map(function (column, index) {
11
12
  var _row$_id;
12
13
  var currentRowValue = row[column.prop];
13
- var cellValue = currentRowValue || emptyText;
14
+ var cellValue = _typeof(currentRowValue) === "object" ? currentRowValue === null || currentRowValue === void 0 ? void 0 : currentRowValue.value : currentRowValue || emptyText;
14
15
  var shouldBeRenderElement = column.renderHandler(currentRowValue, row, rowIndex);
15
16
  return /*#__PURE__*/React.createElement("td", {
16
17
  style: _extends({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helpdice/ui",
3
- "version": "2.3.2",
3
+ "version": "2.3.5",
4
4
  "main": "dist/index.js",
5
5
  "types": "esm/index.d.ts",
6
6
  "unpkg": "dist/index.min.js",
@@ -65,7 +65,7 @@
65
65
  "@helpdice/icons": "^1.2.5",
66
66
  "@helpdice/sdk": "^0.4.3",
67
67
  "@helpdice/utils": "^0.1.4",
68
- "@helpdice/pro": "2.0.5",
68
+ "@helpdice/pro": "2.1.0",
69
69
  "@mapbox/rehype-prism": "^0.9.0",
70
70
  "@mdx-js/loader": "^3.1.0",
71
71
  "@mdx-js/react": "^3.1.0",