@wonderflow/react-components 10.0.0-beta.1 → 10.0.0-beta.2

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.
@@ -9,8 +9,12 @@ export declare type ClampTextProps = {
9
9
  * Define how many lines the text should be clamped to.
10
10
  */
11
11
  rows?: number;
12
+ /**
13
+ * Show the full text when element is hovered with pointer.
14
+ */
15
+ expandable?: boolean;
12
16
  };
13
- declare type PolymorphicClampText = Polymorphic.ForwardRefComponent<'span', ClampTextProps>;
17
+ declare type PolymorphicClampText = Polymorphic.ForwardRefComponent<'div', ClampTextProps>;
14
18
  export declare const ClampText: PolymorphicClampText;
15
19
  export {};
16
20
  //# sourceMappingURL=clamp-text.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"clamp-text.d.ts","sourceRoot":"","sources":["../../../src/components/clamp-text/clamp-text.tsx"],"names":[],"mappings":"AACA,OAAO,EAA6B,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAI3C,oBAAY,cAAc,GAAG;IAC3B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAA;AAED,aAAK,oBAAoB,GAAG,WAAW,CAAC,mBAAmB,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAEpF,eAAO,MAAM,SAAS,sBAsBI,CAAC"}
1
+ {"version":3,"file":"clamp-text.d.ts","sourceRoot":"","sources":["../../../src/components/clamp-text/clamp-text.tsx"],"names":[],"mappings":"AACA,OAAO,EACsB,SAAS,EACrC,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,WAAW,EAAyB,MAAM,cAAc,CAAC;AAIlE,oBAAY,cAAc,GAAG;IAC3B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAA;AAED,aAAK,oBAAoB,GAAG,WAAW,CAAC,mBAAmB,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;AAEnF,eAAO,MAAM,SAAS,sBAgDI,CAAC"}
@@ -1,10 +1,12 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import clsx from 'clsx';
3
- import { forwardRef } from 'react';
3
+ import { forwardRef, useState, } from 'react';
4
+ import { ToggleButton, Tooltip } from '../..';
4
5
  import styles from './clamp-text.module.css';
5
- export const ClampText = forwardRef(({ className, children, rows = 1, style, as: Wrapper = 'span', ...otherProps }, forwardedRef) => {
6
+ export const ClampText = forwardRef(({ className, children, rows = 1, style, expandable, as: Wrapper = 'div', ...otherProps }, forwardedRef) => {
7
+ const [isExpanded, setIsExpandend] = useState(false);
6
8
  const dynamicStyle = {
7
9
  '--r': rows,
8
10
  };
9
- return (_jsx(Wrapper, { ref: forwardedRef, style: { ...dynamicStyle, ...style }, className: clsx(styles.ClampText, className), ...otherProps, children: children }));
11
+ return (_jsxs(Wrapper, { ref: forwardedRef, className: clsx(styles.ClampText, className), ...otherProps, children: [_jsx("span", { className: styles.Content, "data-clamp-text-expanded": isExpanded, style: { ...dynamicStyle, ...style }, children: children }), expandable && (_jsxs(Tooltip, { trigger: (_jsx(ToggleButton, { className: styles.Trigger, pressed: isExpanded, onClick: () => setIsExpandend(state => !state), restingIcon: "plus", pressedIcon: "minus", dimension: "small", kind: "secondary" })), children: [`${isExpanded ? 'Collapse' : 'Expand'} text`, ' ', "text"] }))] }));
10
12
  });
@@ -1 +1 @@
1
- .ClampText{-webkit-line-clamp:var(--r,1);-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}
1
+ .ClampText{display:inline-block;position:relative}.Content{-webkit-line-clamp:var(--r,1);-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden;padding-right:1.75rem}.Content[data-clamp-text-expanded=true]{-webkit-line-clamp:unset}.Trigger{position:absolute;right:0;top:.25rem}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wonderflow/react-components",
3
- "version": "10.0.0-beta.1",
3
+ "version": "10.0.0-beta.2",
4
4
  "description": "UI components from Wonderflow's Wanda design system",
5
5
  "author": "Wonderflow",
6
6
  "license": "MIT",
@@ -70,8 +70,8 @@
70
70
  "@types/react": "17.0.43",
71
71
  "@types/react-dom": "17.0.14",
72
72
  "@types/react-table": "7.7.12",
73
- "@wonderflow/config": "10.0.0-beta.1",
74
- "@wonderflow/tokens": "10.0.0-beta.1",
73
+ "@wonderflow/config": "10.0.0-beta.2",
74
+ "@wonderflow/tokens": "10.0.0-beta.2",
75
75
  "babel-loader": "8.2.5",
76
76
  "cpy-cli": "3.1.1",
77
77
  "postcss": "8.4.14",