@helpdice/ui 2.6.0-beta.4 → 2.6.0-beta.6

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.
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ interface ExpandableProps {
3
+ children: React.ReactNode;
4
+ collapsedHeight: number;
5
+ }
6
+ declare const Expandable: React.FC<ExpandableProps>;
7
+ export default Expandable;
@@ -0,0 +1,67 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import Button from "../button";
3
+ import React, { useEffect, useRef, useState } from "react";
4
+ var Expandable = function Expandable(_ref) {
5
+ var children = _ref.children,
6
+ collapsedHeight = _ref.collapsedHeight;
7
+ var contentRef = useRef(null);
8
+ var _useState = useState(false),
9
+ _useState2 = _slicedToArray(_useState, 2),
10
+ expanded = _useState2[0],
11
+ setExpanded = _useState2[1];
12
+ var _useState3 = useState(0),
13
+ _useState4 = _slicedToArray(_useState3, 2),
14
+ fullHeight = _useState4[0],
15
+ setFullHeight = _useState4[1];
16
+ var _useState5 = useState(false),
17
+ _useState6 = _slicedToArray(_useState5, 2),
18
+ isOverflowing = _useState6[0],
19
+ setIsOverflowing = _useState6[1];
20
+ useEffect(function () {
21
+ var el = contentRef.current;
22
+ if (!el) return;
23
+ var updateHeight = function updateHeight() {
24
+ var scrollHeight = el.scrollHeight;
25
+ setFullHeight(scrollHeight);
26
+ setIsOverflowing(scrollHeight > collapsedHeight);
27
+ };
28
+ updateHeight();
29
+ var observer = new ResizeObserver(updateHeight);
30
+ observer.observe(el);
31
+ return function () {
32
+ return observer.disconnect();
33
+ };
34
+ }, [children, collapsedHeight]);
35
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
36
+ style: {
37
+ height: expanded ? fullHeight : collapsedHeight,
38
+ overflow: "hidden",
39
+ transition: "height 0.3s ease",
40
+ position: "relative"
41
+ }
42
+ }, /*#__PURE__*/React.createElement("div", {
43
+ ref: contentRef
44
+ }, children), !expanded && isOverflowing && /*#__PURE__*/React.createElement("div", {
45
+ style: {
46
+ position: "absolute",
47
+ bottom: 0,
48
+ left: 0,
49
+ right: 0,
50
+ height: 40,
51
+ background: "linear-gradient(to bottom, rgba(255,255,255,0), white)"
52
+ }
53
+ })), isOverflowing && /*#__PURE__*/React.createElement(Button, {
54
+ margin: 0,
55
+ padding: 0,
56
+ onClick: function onClick() {
57
+ return setExpanded(function (prev) {
58
+ return !prev;
59
+ });
60
+ },
61
+ effect: false,
62
+ color: "abort",
63
+ scale: 2 / 3,
64
+ auto: true
65
+ }, /*#__PURE__*/React.createElement("b", null, expanded ? 'Show less' : 'Show more')));
66
+ };
67
+ export default Expandable;
@@ -0,0 +1,2 @@
1
+ import Expandable from "./expand";
2
+ export default Expandable;
@@ -0,0 +1,2 @@
1
+ import Expandable from "./expand";
2
+ export default Expandable;
package/esm/index.d.ts CHANGED
@@ -129,3 +129,4 @@ export type { CarouselProps } from './carousal';
129
129
  export { default as useToasts } from './use-toasts';
130
130
  export type { Toast, ToastInput, ToastAction, ToastLayout } from './use-toasts';
131
131
  export { default as Clipboard } from './copy-to-clipboard';
132
+ export { default as Expandable } from './expandable';
package/esm/index.js CHANGED
@@ -88,4 +88,5 @@ export { default as Carousel } from './carousal';
88
88
  // export type { CurrencyInputProps, CurrencyInputOnChangeValues } from './input/input-currency';
89
89
 
90
90
  export { default as useToasts } from './use-toasts';
91
- export { default as Clipboard } from './copy-to-clipboard';
91
+ export { default as Clipboard } from './copy-to-clipboard';
92
+ export { default as Expandable } from './expandable';
@@ -82,26 +82,26 @@ var RadioComponent = function RadioComponent(_ref) {
82
82
  setSelfChecked(Boolean(checked));
83
83
  }, [checked]);
84
84
  return /*#__PURE__*/React.createElement("div", {
85
- className: _JSXStyle.dynamic([["2664604043", [SCALES.font(1), SCALES.width(1, 'initial'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), isDisabled ? theme.palette.accents_4 : label, isDisabled ? 'not-allowed' : 'pointer', border, isDisabled ? theme.palette.accents_4 : bg]]]) + " " + (useClasses('radio', className) || "")
85
+ className: _JSXStyle.dynamic([["3265978383", [SCALES.font(1), SCALES.width(1, 'initial'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), isDisabled ? theme.palette.accents_4 : label, isDisabled ? 'not-allowed' : 'pointer', border, SCALES.font(0.92), SCALES.font(0.92), isDisabled ? theme.palette.accents_4 : bg]]]) + " " + (useClasses('radio', className) || "")
86
86
  }, /*#__PURE__*/React.createElement("label", {
87
- className: _JSXStyle.dynamic([["2664604043", [SCALES.font(1), SCALES.width(1, 'initial'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), isDisabled ? theme.palette.accents_4 : label, isDisabled ? 'not-allowed' : 'pointer', border, isDisabled ? theme.palette.accents_4 : bg]]])
87
+ className: _JSXStyle.dynamic([["3265978383", [SCALES.font(1), SCALES.width(1, 'initial'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), isDisabled ? theme.palette.accents_4 : label, isDisabled ? 'not-allowed' : 'pointer', border, SCALES.font(0.92), SCALES.font(0.92), isDisabled ? theme.palette.accents_4 : bg]]])
88
88
  }, /*#__PURE__*/React.createElement("input", _extends({
89
89
  type: "radio",
90
90
  value: radioValue,
91
91
  checked: selfChecked,
92
92
  onChange: changeHandler
93
93
  }, props, {
94
- className: _JSXStyle.dynamic([["2664604043", [SCALES.font(1), SCALES.width(1, 'initial'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), isDisabled ? theme.palette.accents_4 : label, isDisabled ? 'not-allowed' : 'pointer', border, isDisabled ? theme.palette.accents_4 : bg]]]) + " " + (props && props.className != null && props.className || "")
94
+ className: _JSXStyle.dynamic([["3265978383", [SCALES.font(1), SCALES.width(1, 'initial'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), isDisabled ? theme.palette.accents_4 : label, isDisabled ? 'not-allowed' : 'pointer', border, SCALES.font(0.92), SCALES.font(0.92), isDisabled ? theme.palette.accents_4 : bg]]]) + " " + (props && props.className != null && props.className || "")
95
95
  })), /*#__PURE__*/React.createElement("span", {
96
- className: _JSXStyle.dynamic([["2664604043", [SCALES.font(1), SCALES.width(1, 'initial'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), isDisabled ? theme.palette.accents_4 : label, isDisabled ? 'not-allowed' : 'pointer', border, isDisabled ? theme.palette.accents_4 : bg]]]) + " " + "name"
96
+ className: _JSXStyle.dynamic([["3265978383", [SCALES.font(1), SCALES.width(1, 'initial'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), isDisabled ? theme.palette.accents_4 : label, isDisabled ? 'not-allowed' : 'pointer', border, SCALES.font(0.92), SCALES.font(0.92), isDisabled ? theme.palette.accents_4 : bg]]]) + " " + "name"
97
97
  }, /*#__PURE__*/React.createElement("span", {
98
- className: _JSXStyle.dynamic([["2664604043", [SCALES.font(1), SCALES.width(1, 'initial'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), isDisabled ? theme.palette.accents_4 : label, isDisabled ? 'not-allowed' : 'pointer', border, isDisabled ? theme.palette.accents_4 : bg]]]) + " " + (useClasses('point', {
98
+ className: _JSXStyle.dynamic([["3265978383", [SCALES.font(1), SCALES.width(1, 'initial'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), isDisabled ? theme.palette.accents_4 : label, isDisabled ? 'not-allowed' : 'pointer', border, SCALES.font(0.92), SCALES.font(0.92), isDisabled ? theme.palette.accents_4 : bg]]]) + " " + (useClasses('point', {
99
99
  active: selfChecked
100
100
  }) || "")
101
101
  }), withoutDescChildren), DescChildren && DescChildren), /*#__PURE__*/React.createElement(_JSXStyle, {
102
- id: "2664604043",
103
- dynamic: [SCALES.font(1), SCALES.width(1, 'initial'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), isDisabled ? theme.palette.accents_4 : label, isDisabled ? 'not-allowed' : 'pointer', border, isDisabled ? theme.palette.accents_4 : bg]
104
- }, "input.__jsx-style-dynamic-selector{opacity:0;visibility:hidden;overflow:hidden;width:1px;height:1px;top:-1000px;right:-1000px;position:fixed;font-size:0;}.radio.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;position:relative;--radio-size:".concat(SCALES.font(1), ";width:").concat(SCALES.width(1, 'initial'), ";height:").concat(SCALES.height(1, 'auto'), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}label.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:start;-webkit-justify-content:flex-start;-ms-flex-pack:start;justify-content:flex-start;color:").concat(isDisabled ? theme.palette.accents_4 : label, ";cursor:").concat(isDisabled ? 'not-allowed' : 'pointer', ";}.name.__jsx-style-dynamic-selector{font-size:var(--radio-size);font-weight:bold;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}.point.__jsx-style-dynamic-selector{height:var(--radio-size);width:var(--radio-size);border-radius:50%;border:1px solid ").concat(border, ";-webkit-transition:all 0.2s ease 0s;transition:all 0.2s ease 0s;position:relative;display:inline-block;-webkit-transform:scale(0.875);-ms-transform:scale(0.875);transform:scale(0.875);margin-right:calc(var(--radio-size) * 0.375);}.point.__jsx-style-dynamic-selector:before{content:'';position:absolute;left:-1px;top:-1px;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);height:var(--radio-size);width:var(--radio-size);border-radius:50%;background-color:").concat(isDisabled ? theme.palette.accents_4 : bg, ";}.active.__jsx-style-dynamic-selector:before{-webkit-transform:scale(0.875);-ms-transform:scale(0.875);transform:scale(0.875);-webkit-transition:all 0.2s ease 0s;transition:all 0.2s ease 0s;}")));
102
+ id: "3265978383",
103
+ dynamic: [SCALES.font(1), SCALES.width(1, 'initial'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), isDisabled ? theme.palette.accents_4 : label, isDisabled ? 'not-allowed' : 'pointer', border, SCALES.font(0.92), SCALES.font(0.92), isDisabled ? theme.palette.accents_4 : bg]
104
+ }, "input.__jsx-style-dynamic-selector{opacity:0;visibility:hidden;overflow:hidden;width:1px;height:1px;top:-1000px;right:-1000px;position:fixed;font-size:0;}.radio.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;position:relative;--radio-size:".concat(SCALES.font(1), ";width:").concat(SCALES.width(1, 'initial'), ";height:").concat(SCALES.height(1, 'auto'), ";padding:").concat(SCALES.pt(0), " ").concat(SCALES.pr(0), " ").concat(SCALES.pb(0), " ").concat(SCALES.pl(0), ";margin:").concat(SCALES.mt(0), " ").concat(SCALES.mr(0), " ").concat(SCALES.mb(0), " ").concat(SCALES.ml(0), ";}label.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:start;-webkit-justify-content:flex-start;-ms-flex-pack:start;justify-content:flex-start;color:").concat(isDisabled ? theme.palette.accents_4 : label, ";cursor:").concat(isDisabled ? 'not-allowed' : 'pointer', ";}.name.__jsx-style-dynamic-selector{font-size:var(--radio-size);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}.point.__jsx-style-dynamic-selector{height:var(--radio-size);width:var(--radio-size);border-radius:50%;border:1px solid ").concat(border, ";-webkit-transition:all 0.2s ease 0s;transition:all 0.2s ease 0s;position:relative;display:inline-block;-webkit-transform:scale(0.875);-ms-transform:scale(0.875);transform:scale(0.875);margin-right:calc(var(--radio-size) * 0.375);}.point.__jsx-style-dynamic-selector:before{content:'';position:absolute;left:-1px;top:-1px;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);width:").concat(SCALES.font(0.92), ";height:").concat(SCALES.font(0.92), ";border-radius:50%;background-color:").concat(isDisabled ? theme.palette.accents_4 : bg, ";margin:1px;}.active.__jsx-style-dynamic-selector:before{-webkit-transform:scale(0.875);-ms-transform:scale(0.875);transform:scale(0.875);-webkit-transition:all 0.2s ease 0s;transition:all 0.2s ease 0s;}")));
105
105
  };
106
106
  RadioComponent.displayName = 'Radio';
107
107
  var Radio = withScale(RadioComponent);
@@ -127,7 +127,7 @@ var TableBody = function TableBody(_ref) {
127
127
  // <tr>
128
128
  // <td colSpan={columns?.length}>
129
129
  // <div>
130
- // <Placeholder empty textOnly={textPlaceholder} msg="No Entries Found" />
130
+ // <Placeholder empty textOnly={textPlaceholder} msg="No Entries Found" />
131
131
  // </div>
132
132
  // </td>
133
133
  // </tr>
@@ -15,7 +15,6 @@ interface Props {
15
15
  span?: boolean;
16
16
  del?: boolean;
17
17
  em?: boolean;
18
- collapse?: number;
19
18
  blockquote?: boolean;
20
19
  noWrap?: boolean;
21
20
  className?: string;
package/esm/text/text.js CHANGED
@@ -1,12 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- var _excluded = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "b", "small", "i", "span", "del", "em", "blockquote", "noWrap", "collapse", "children", "className", "display", "alignItems", "justify"];
3
+ var _excluded = ["h1", "h2", "h3", "h4", "h5", "h6", "p", "b", "small", "i", "span", "del", "em", "blockquote", "noWrap", "children", "className", "display", "alignItems", "justify"];
5
4
  /* "use client" */;
6
- import React, { useMemo, useState } from 'react';
5
+ import React, { useMemo } from 'react';
7
6
  import TextChild from './child';
8
7
  import { withScale } from '../use-scale';
9
- import Button from '../button';
10
8
  var _getModifierChild = function getModifierChild(tags, children) {
11
9
  if (!tags.length) return children;
12
10
  var nextTag = tags.slice(1, tags.length);
@@ -45,8 +43,6 @@ var TextComponent = function TextComponent(_ref) {
45
43
  blockquote = _ref$blockquote === void 0 ? false : _ref$blockquote,
46
44
  _ref$noWrap = _ref.noWrap,
47
45
  noWrap = _ref$noWrap === void 0 ? false : _ref$noWrap,
48
- _ref$collapse = _ref.collapse,
49
- collapse = _ref$collapse === void 0 ? 0 : _ref$collapse,
50
46
  children = _ref.children,
51
47
  _ref$className = _ref.className,
52
48
  className = _ref$className === void 0 ? '' : _ref$className,
@@ -90,10 +86,6 @@ var TextComponent = function TextComponent(_ref) {
90
86
  *
91
87
  */
92
88
 
93
- var _useState = useState(false),
94
- _useState2 = _slicedToArray(_useState, 2),
95
- expand = _useState2[0],
96
- setExpand = _useState2[1];
97
89
  var tag = useMemo(function () {
98
90
  if (names[0]) return names[0];
99
91
  if (inlineNames[0]) return inlineNames[0];
@@ -115,21 +107,7 @@ var TextComponent = function TextComponent(_ref) {
115
107
  },
116
108
  className: "".concat(className, " ").concat(noWrap ? 'no-wrap' : ''),
117
109
  tag: tag
118
- }, 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, {
119
- margin: 0,
120
- onClick: function onClick() {
121
- return setExpand(!expand);
122
- },
123
- style: {
124
- textTransform: 'lowercase'
125
- },
126
- effect: false,
127
- color: "abort",
128
- scale: 2 / 3,
129
- px: 0.2,
130
- py: 0,
131
- auto: true
132
- }, /*#__PURE__*/React.createElement("b", null, expand ? 'less' : 'more'))) : modifers);
110
+ }, props), modifers);
133
111
  };
134
112
  TextComponent.displayName = 'Text';
135
113
  var Text = withScale(TextComponent);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helpdice/ui",
3
- "version": "2.6.0-beta.4",
3
+ "version": "2.6.0-beta.6",
4
4
  "main": "dist/index.js",
5
5
  "types": "esm/index.d.ts",
6
6
  "unpkg": "dist/index.min.js",
@@ -141,7 +141,9 @@
141
141
  },
142
142
  "peerDependencies": {
143
143
  "@helpdice/theme": "^1.1.0",
144
+ "dashjs": "^5.1.1",
144
145
  "react": "^19.2.3",
146
+ "hls.js": "^1.6.15",
145
147
  "react-dom": "^19.2.3",
146
148
  "react-router-dom": "^7.8.2"
147
149
  },
@@ -273,6 +275,11 @@
273
275
  "require": "./dist/drawer/index.js",
274
276
  "types": "./dist/drawer/index.d.ts"
275
277
  },
278
+ "./Expandable": {
279
+ "import": "./esm/expandable/index.js",
280
+ "require": "./dist/expandable/index.js",
281
+ "types": "./dist/expandable/index.d.ts"
282
+ },
276
283
  "./Fieldset": {
277
284
  "import": "./esm/fieldset/index.js",
278
285
  "require": "./dist/fieldset/index.js",
@@ -587,6 +594,9 @@
587
594
  "Drawer": [
588
595
  "dist/drawer/index.d.ts"
589
596
  ],
597
+ "Expandable": [
598
+ "dist/expandable/index.d.ts"
599
+ ],
590
600
  "Fieldset": [
591
601
  "dist/fieldset/index.d.ts"
592
602
  ],