@chayns-components/core 5.0.0-beta.348 → 5.0.0-beta.352
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/lib/components/{filter-button/FilterButton.d.ts → filter-buttons/FilterButtons.d.ts} +3 -3
- package/lib/components/{filter-button/FilterButton.js → filter-buttons/FilterButtons.js} +9 -9
- package/lib/components/filter-buttons/FilterButtons.js.map +1 -0
- package/lib/components/{filter-button/FilterButton.styles.js → filter-buttons/FilterButtons.styles.js} +1 -1
- package/lib/components/filter-buttons/FilterButtons.styles.js.map +1 -0
- package/lib/components/{filter-button/filter-button-item/FilterButtonItem.d.ts → filter-buttons/filter-button/FilterButton.d.ts} +3 -3
- package/lib/components/{filter-button/filter-button-item/FilterButtonItem.js → filter-buttons/filter-button/FilterButton.js} +9 -9
- package/lib/components/filter-buttons/filter-button/FilterButton.js.map +1 -0
- package/lib/components/{filter-button/filter-button-item/FilterButtonItem.styles.js → filter-buttons/filter-button/FilterButton.styles.js} +1 -1
- package/lib/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -0
- package/lib/components/filter-buttons/types.js.map +1 -0
- package/lib/components/truncation/Truncation.js +49 -33
- package/lib/components/truncation/Truncation.js.map +1 -1
- package/lib/components/truncation/Truncation.styles.d.ts +271 -0
- package/lib/components/truncation/Truncation.styles.js +12 -3
- package/lib/components/truncation/Truncation.styles.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
- package/lib/components/filter-button/FilterButton.js.map +0 -1
- package/lib/components/filter-button/FilterButton.styles.js.map +0 -1
- package/lib/components/filter-button/filter-button-item/FilterButtonItem.js.map +0 -1
- package/lib/components/filter-button/filter-button-item/FilterButtonItem.styles.js.map +0 -1
- package/lib/components/filter-button/types.js.map +0 -1
- package/lib/utils/truncation.d.ts +0 -1
- package/lib/utils/truncation.js +0 -34
- package/lib/utils/truncation.js.map +0 -1
- /package/lib/components/{filter-button/FilterButton.styles.d.ts → filter-buttons/FilterButtons.styles.d.ts} +0 -0
- /package/lib/components/{filter-button/filter-button-item/FilterButtonItem.styles.d.ts → filter-buttons/filter-button/FilterButton.styles.d.ts} +0 -0
- /package/lib/components/{filter-button → filter-buttons}/types.d.ts +0 -0
- /package/lib/components/{filter-button → filter-buttons}/types.js +0 -0
package/lib/components/{filter-button/FilterButton.d.ts → filter-buttons/FilterButtons.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { FilterButtonSize, IFilterButtonItem } from './types';
|
|
3
|
-
export type
|
|
3
|
+
export type FilterButtonsProps = {
|
|
4
4
|
/**
|
|
5
5
|
* The items that should be displayed.
|
|
6
6
|
*/
|
|
@@ -18,5 +18,5 @@ export type FilterButtonProps = {
|
|
|
18
18
|
*/
|
|
19
19
|
size?: FilterButtonSize;
|
|
20
20
|
};
|
|
21
|
-
declare const
|
|
22
|
-
export default
|
|
21
|
+
declare const FilterButtons: FC<FilterButtonsProps>;
|
|
22
|
+
export default FilterButtons;
|
|
@@ -5,13 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var
|
|
9
|
-
var
|
|
8
|
+
var _FilterButton = _interopRequireDefault(require("./filter-button/FilterButton"));
|
|
9
|
+
var _FilterButtons = require("./FilterButtons.styles");
|
|
10
10
|
var _types = require("./types");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
13
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
-
const
|
|
14
|
+
const FilterButtons = _ref => {
|
|
15
15
|
let {
|
|
16
16
|
selectedItemIds,
|
|
17
17
|
onSelect,
|
|
@@ -51,7 +51,7 @@ const FilterButton = _ref => {
|
|
|
51
51
|
if (items.length === 0) {
|
|
52
52
|
return null;
|
|
53
53
|
}
|
|
54
|
-
const array = [/*#__PURE__*/_react.default.createElement(
|
|
54
|
+
const array = [/*#__PURE__*/_react.default.createElement(_FilterButton.default, {
|
|
55
55
|
id: "all",
|
|
56
56
|
key: "all",
|
|
57
57
|
onSelect: handleSelect,
|
|
@@ -67,7 +67,7 @@ const FilterButton = _ref => {
|
|
|
67
67
|
color,
|
|
68
68
|
id
|
|
69
69
|
} = _ref2;
|
|
70
|
-
array.push( /*#__PURE__*/_react.default.createElement(
|
|
70
|
+
array.push( /*#__PURE__*/_react.default.createElement(_FilterButton.default, {
|
|
71
71
|
color: color,
|
|
72
72
|
icons: icons,
|
|
73
73
|
id: id,
|
|
@@ -81,8 +81,8 @@ const FilterButton = _ref => {
|
|
|
81
81
|
});
|
|
82
82
|
return array;
|
|
83
83
|
}, [handleSelect, items, selectedIds, size]);
|
|
84
|
-
return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(
|
|
84
|
+
return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(_FilterButtons.StyledFilterButton, null, reactItems), [reactItems]);
|
|
85
85
|
};
|
|
86
|
-
|
|
87
|
-
var _default = exports.default =
|
|
88
|
-
//# sourceMappingURL=
|
|
86
|
+
FilterButtons.displayName = 'FilterButtons';
|
|
87
|
+
var _default = exports.default = FilterButtons;
|
|
88
|
+
//# sourceMappingURL=FilterButtons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterButtons.js","names":["_react","_interopRequireWildcard","require","_FilterButton","_interopRequireDefault","_FilterButtons","_types","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","FilterButtons","_ref","selectedItemIds","onSelect","items","size","FilterButtonSize","Normal","selectedIds","setSelectedIds","useState","useEffect","handleSelect","useCallback","id","newIds","includes","filter","filteredId","length","reactItems","useMemo","array","createElement","key","isSelected","shape","FilterButtonItemShape","Rectangular","text","forEach","_ref2","icons","color","push","Round","StyledFilterButton","displayName","_default","exports"],"sources":["../../../src/components/filter-buttons/FilterButtons.tsx"],"sourcesContent":["import React, { FC, ReactElement, useCallback, useEffect, useMemo, useState } from 'react';\nimport FilterButton from './filter-button/FilterButton';\nimport { StyledFilterButton } from './FilterButtons.styles';\nimport { FilterButtonItemShape, FilterButtonSize, IFilterButtonItem } from './types';\n\nexport type FilterButtonsProps = {\n /**\n * The items that should be displayed.\n */\n items: IFilterButtonItem[];\n /**\n * A function that should be executed when an item is selected.\n */\n onSelect?: (keys: string[]) => void;\n /**\n * The keys of items that should be selected.\n */\n selectedItemIds?: string[];\n /**\n * The size auf the filter buttons. Use the FilterButtonSize enum.\n */\n size?: FilterButtonSize;\n};\n\nconst FilterButtons: FC<FilterButtonsProps> = ({\n selectedItemIds,\n onSelect,\n items,\n size = FilterButtonSize.Normal,\n}) => {\n const [selectedIds, setSelectedIds] = useState<string[]>(['all']);\n\n /**\n * This function set the selectedItemKey\n */\n useEffect(() => {\n if (selectedItemIds) {\n setSelectedIds(selectedItemIds);\n }\n }, [selectedItemIds]);\n\n /**\n * Function to update the selected items\n */\n const handleSelect = useCallback(\n (id: string) => {\n let newIds: string[];\n\n if (id === 'all') {\n newIds = selectedIds.includes('all') ? [] : ['all'];\n } else {\n newIds = selectedIds.includes(id)\n ? selectedIds.filter((filteredId) => filteredId !== id)\n : [...selectedIds.filter((filteredId) => filteredId !== 'all'), id];\n }\n\n if (newIds.length === 0) {\n newIds = ['all'];\n }\n\n setSelectedIds(newIds);\n\n if (typeof onSelect === 'function') {\n onSelect(newIds);\n }\n },\n [onSelect, selectedIds],\n );\n\n const reactItems = useMemo(() => {\n if (items.length === 0) {\n return null;\n }\n\n const array: ReactElement[] = [\n <FilterButton\n id=\"all\"\n key=\"all\"\n onSelect={handleSelect}\n isSelected={selectedIds.includes('all')}\n shape={FilterButtonItemShape.Rectangular}\n size={size}\n text=\"Alle\"\n />,\n ];\n\n items.forEach(({ icons, text, color, id }) => {\n array.push(\n <FilterButton\n color={color}\n icons={icons}\n id={id}\n key={id}\n onSelect={handleSelect}\n isSelected={selectedIds.includes(id)}\n shape={FilterButtonItemShape.Round}\n size={size}\n text={text}\n />,\n );\n });\n\n return array;\n }, [handleSelect, items, selectedIds, size]);\n\n return useMemo(() => <StyledFilterButton>{reactItems}</StyledFilterButton>, [reactItems]);\n};\n\nFilterButtons.displayName = 'FilterButtons';\n\nexport default FilterButtons;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAAqF,SAAAE,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAV,wBAAAU,CAAA,EAAAE,CAAA,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,IAAI,EAAC;IAAM,CACd,CAAC,CACL;IAEDzB,KAAK,CAAC0B,OAAO,CAACC,KAAA,IAAgC;MAAA,IAA/B;QAAEC,KAAK;QAAEH,IAAI;QAAEI,KAAK;QAAEnB;MAAG,CAAC,GAAAiB,KAAA;MACrCT,KAAK,CAACY,IAAI,eACN/D,MAAA,CAAAS,OAAA,CAAA2C,aAAA,CAACjD,aAAA,CAAAM,OAAY;QACTqD,KAAK,EAAEA,KAAM;QACbD,KAAK,EAAEA,KAAM;QACblB,EAAE,EAAEA,EAAG;QACPU,GAAG,EAAEV,EAAG;QACRX,QAAQ,EAAES,YAAa;QACvBa,UAAU,EAAEjB,WAAW,CAACQ,QAAQ,CAACF,EAAE,CAAE;QACrCY,KAAK,EAAEC,4BAAqB,CAACQ,KAAM;QACnC9B,IAAI,EAAEA,IAAK;QACXwB,IAAI,EAAEA;MAAK,CACd,CACL,CAAC;IACL,CAAC,CAAC;IAEF,OAAOP,KAAK;EAChB,CAAC,EAAE,CAACV,YAAY,EAAER,KAAK,EAAEI,WAAW,EAAEH,IAAI,CAAC,CAAC;EAE5C,OAAO,IAAAgB,cAAO,EAAC,mBAAMlD,MAAA,CAAAS,OAAA,CAAA2C,aAAA,CAAC/C,cAAA,CAAA4D,kBAAkB,QAAEhB,UAA+B,CAAC,EAAE,CAACA,UAAU,CAAC,CAAC;AAC7F,CAAC;AAEDpB,aAAa,CAACqC,WAAW,GAAG,eAAe;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA3D,OAAA,GAE7BoB,aAAa"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterButtons.styles.js","names":["_styledComponents","_interopRequireDefault","require","obj","__esModule","default","StyledFilterButton","exports","styled","div"],"sources":["../../../src/components/filter-buttons/FilterButtons.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const StyledFilterButton = styled.div`\n display: flex;\n flex-wrap: wrap;\n gap: 10px;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEhC,MAAMG,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAGE,yBAAM,CAACC,GAAI;AAC7C;AACA;AACA;AACA,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CSSProperties, FC } from 'react';
|
|
2
2
|
import { FilterButtonItemShape, FilterButtonSize } from '../types';
|
|
3
|
-
export type
|
|
3
|
+
export type FilterButtonProps = {
|
|
4
4
|
color?: CSSProperties['color'];
|
|
5
5
|
icons?: string[];
|
|
6
6
|
isSelected: boolean;
|
|
@@ -10,5 +10,5 @@ export type FilterButtonItemProps = {
|
|
|
10
10
|
id: string;
|
|
11
11
|
onSelect: (key: string) => void;
|
|
12
12
|
};
|
|
13
|
-
declare const
|
|
14
|
-
export default
|
|
13
|
+
declare const FilterButton: FC<FilterButtonProps>;
|
|
14
|
+
export default FilterButton;
|
|
@@ -7,11 +7,11 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _Icon = _interopRequireDefault(require("../../icon/Icon"));
|
|
9
9
|
var _types = require("../types");
|
|
10
|
-
var
|
|
10
|
+
var _FilterButton = require("./FilterButton.styles");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
13
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
-
const
|
|
14
|
+
const FilterButton = _ref => {
|
|
15
15
|
let {
|
|
16
16
|
icons,
|
|
17
17
|
size,
|
|
@@ -25,23 +25,23 @@ const FilterButtonItem = _ref => {
|
|
|
25
25
|
const handleClick = (0, _react.useCallback)(() => {
|
|
26
26
|
onSelect(id);
|
|
27
27
|
}, [id, onSelect]);
|
|
28
|
-
return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(
|
|
28
|
+
return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(_FilterButton.StyledFilterButtonItem, {
|
|
29
29
|
isSelected: isSelected,
|
|
30
30
|
size: size,
|
|
31
31
|
onClick: handleClick
|
|
32
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
32
|
+
}, /*#__PURE__*/_react.default.createElement(_FilterButton.StyledFilterButtonItemLabel, null, icons && /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
33
33
|
icons: icons,
|
|
34
34
|
size: size === _types.FilterButtonSize.Normal ? 15 : 10
|
|
35
|
-
}), /*#__PURE__*/_react.default.createElement(
|
|
35
|
+
}), /*#__PURE__*/_react.default.createElement(_FilterButton.StyledFilterButtonItemLabelText, null, text)), /*#__PURE__*/_react.default.createElement(_FilterButton.StyledFilterButtonItemBorder, {
|
|
36
36
|
isSelected: isSelected,
|
|
37
37
|
shape: shape,
|
|
38
38
|
color: color
|
|
39
|
-
}), /*#__PURE__*/_react.default.createElement(
|
|
39
|
+
}), /*#__PURE__*/_react.default.createElement(_FilterButton.StyledMotionFilterButtonItemBackground, {
|
|
40
40
|
isSelected: isSelected,
|
|
41
41
|
shape: shape,
|
|
42
42
|
color: color
|
|
43
43
|
})), [color, handleClick, icons, isSelected, shape, size, text]);
|
|
44
44
|
};
|
|
45
|
-
|
|
46
|
-
var _default = exports.default =
|
|
47
|
-
//# sourceMappingURL=
|
|
45
|
+
FilterButton.displayName = 'FilterButton';
|
|
46
|
+
var _default = exports.default = FilterButton;
|
|
47
|
+
//# sourceMappingURL=FilterButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterButton.js","names":["_react","_interopRequireWildcard","require","_Icon","_interopRequireDefault","_types","_FilterButton","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","FilterButton","_ref","icons","size","shape","text","color","isSelected","id","onSelect","handleClick","useCallback","useMemo","createElement","StyledFilterButtonItem","onClick","StyledFilterButtonItemLabel","FilterButtonSize","Normal","StyledFilterButtonItemLabelText","StyledFilterButtonItemBorder","StyledMotionFilterButtonItemBackground","displayName","_default","exports"],"sources":["../../../../src/components/filter-buttons/filter-button/FilterButton.tsx"],"sourcesContent":["import React, { CSSProperties, FC, useCallback, useMemo } from 'react';\nimport Icon from '../../icon/Icon';\nimport { FilterButtonItemShape, FilterButtonSize } from '../types';\nimport {\n StyledFilterButtonItem,\n StyledFilterButtonItemBorder,\n StyledFilterButtonItemLabel,\n StyledFilterButtonItemLabelText,\n StyledMotionFilterButtonItemBackground,\n} from './FilterButton.styles';\n\nexport type FilterButtonProps = {\n color?: CSSProperties['color'];\n icons?: string[];\n isSelected: boolean;\n shape: FilterButtonItemShape;\n size: FilterButtonSize;\n text: string;\n id: string;\n onSelect: (key: string) => void;\n};\n\nconst FilterButton: FC<FilterButtonProps> = ({\n icons,\n size,\n shape,\n text,\n color,\n isSelected,\n id,\n onSelect,\n}) => {\n const handleClick = useCallback(() => {\n onSelect(id);\n }, [id, onSelect]);\n\n return useMemo(\n () => (\n <StyledFilterButtonItem isSelected={isSelected} size={size} onClick={handleClick}>\n <StyledFilterButtonItemLabel>\n {icons && (\n <Icon icons={icons} size={size === FilterButtonSize.Normal ? 15 : 10} />\n )}\n <StyledFilterButtonItemLabelText>{text}</StyledFilterButtonItemLabelText>\n </StyledFilterButtonItemLabel>\n <StyledFilterButtonItemBorder isSelected={isSelected} shape={shape} color={color} />\n <StyledMotionFilterButtonItemBackground\n isSelected={isSelected}\n shape={shape}\n color={color}\n />\n </StyledFilterButtonItem>\n ),\n [color, handleClick, icons, isSelected, shape, size, text],\n );\n};\n\nFilterButton.displayName = 'FilterButton';\n\nexport default FilterButton;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAM+B,SAAAE,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAV,wBAAAU,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAH,UAAA,SAAAG,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAF,OAAA,EAAAE,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAJ,CAAA,UAAAG,CAAA,CAAAE,GAAA,CAAAL,CAAA,OAAAM,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAZ,CAAA,oBAAAY,CAA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eACD/C,MAAA,CAAAS,OAAA,CAAAiC,aAAA,CAACpC,aAAA,CAAA0C,+BAA+B,QAAEd,IAAsC,CAC/C,CAAC,eAC9BlC,MAAA,CAAAS,OAAA,CAAAiC,aAAA,CAACpC,aAAA,CAAA2C,4BAA4B;IAACb,UAAU,EAAEA,UAAW;IAACH,KAAK,EAAEA,KAAM;IAACE,KAAK,EAAEA;EAAM,CAAE,CAAC,eACpFnC,MAAA,CAAAS,OAAA,CAAAiC,aAAA,CAACpC,aAAA,CAAA4C,sCAAsC;IACnCd,UAAU,EAAEA,UAAW;IACvBH,KAAK,EAAEA,KAAM;IACbE,KAAK,EAAEA;EAAM,CAChB,CACmB,CAC3B,EACD,CAACA,KAAK,EAAEI,WAAW,EAAER,KAAK,EAAEK,UAAU,EAAEH,KAAK,EAAED,IAAI,EAAEE,IAAI,CAC7D,CAAC;AACL,CAAC;AAEDL,YAAY,CAACsB,WAAW,GAAG,cAAc;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA5C,OAAA,GAE3BoB,YAAY"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterButton.styles.js","names":["_framerMotion","require","_styledComponents","_interopRequireWildcard","_types","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","StyledFilterButtonItem","exports","styled","div","_ref","size","FilterButtonSize","Normal","_ref2","isSelected","css","StyledFilterButtonItemLabel","StyledFilterButtonItemLabelText","p","_ref3","theme","text","StyledFilterButtonItemBorder","_ref4","shape","FilterButtonItemShape","Round","_ref5","color","headline","StyledMotionFilterButtonItemBackground","motion","_ref6","_ref7","_ref8"],"sources":["../../../../src/components/filter-buttons/filter-button/FilterButton.styles.ts"],"sourcesContent":["import { motion } from 'framer-motion';\nimport type { CSSProperties } from 'react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\nimport { FilterButtonItemShape, FilterButtonSize } from '../types';\n\ntype StyledFilterButtonItemProps = WithTheme<{ size: FilterButtonSize; isSelected: boolean }>;\n\nexport const StyledFilterButtonItem = styled.div<StyledFilterButtonItemProps>`\n position: relative;\n font-size: ${({ size }) => (size === FilterButtonSize.Normal ? 15 : 12)}px;\n cursor: pointer;\n user-select: none;\n padding: 3px 14px;\n\n &:hover > div:last-child {\n ${({ isSelected }) =>\n !isSelected &&\n css`\n opacity: 0.2;\n `}\n }\n`;\n\nexport const StyledFilterButtonItemLabel = styled.div`\n display: flex;\n gap: 5px;\n align-items: center;\n`;\n\ntype StyledFilterButtonItemLabelTextProps = WithTheme<unknown>;\n\nexport const StyledFilterButtonItemLabelText = styled.p<StyledFilterButtonItemLabelTextProps>`\n color: ${({ theme }: StyledFilterButtonItemLabelTextProps) => theme.text};\n margin-top: 2px;\n`;\n\ntype StyledFilterButtonItemBorderProps = WithTheme<{\n shape: FilterButtonItemShape;\n color: CSSProperties['color'];\n isSelected: boolean;\n}>;\n\nexport const StyledFilterButtonItemBorder = styled.div<StyledFilterButtonItemBorderProps>`\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n opacity: 0.4;\n z-index: -1;\n border-radius: ${({ shape }) => (shape === FilterButtonItemShape.Round ? 100 : 0)}px;\n ${({ color, theme, isSelected }: StyledFilterButtonItemBorderProps) =>\n !isSelected &&\n css`\n border-width: 1px;\n border-style: solid;\n border-color: ${color ?? theme.headline};\n `};\n`;\n\ntype StyledFilterButtonItemBackgroundProps = WithTheme<{\n shape: FilterButtonItemShape;\n color: CSSProperties['color'];\n isSelected: boolean;\n}>;\n\nexport const StyledMotionFilterButtonItemBackground = styled(\n motion.div,\n)<StyledFilterButtonItemBackgroundProps>`\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n z-index: -1;\n opacity: ${({ isSelected }) => (isSelected ? 0.4 : 0)};\n transition: opacity 0.5s ease;\n border-radius: ${({ shape }) => (shape ===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;AACA,4BAA4Ba,KAAK,IAAIR,KAAK,CAACS,QAAS;AACpD,SAAS;AAAA,CAAC;AACV,CAAC;AAQM,MAAMC,sCAAsC,GAAAxB,OAAA,CAAAwB,sCAAA,GAAG,IAAAvB,yBAAM,EACxDwB,oBAAM,CAACvB,GACX,CAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,eAAewB,KAAA;EAAA,IAAC;IAAElB;EAAW,CAAC,GAAAkB,KAAA;EAAA,OAAMlB,UAAU,GAAG,GAAG,GAAG,CAAC;AAAA,CAAE;AAC1D;AACA,qBAAqBmB,KAAA;EAAA,IAAC;IAAET;EAAM,CAAC,GAAAS,KAAA;EAAA,OAAMT,KAAK,KAAKC,4BAAqB,CAACC,KAAK,GAAG,GAAG,GAAG,CAAC;AAAA,CAAE;AACtF,wBAAwBQ,KAAA;EAAA,IAAC;IAAEN,KAAK;IAAER;EAA6C,CAAC,GAAAc,KAAA;EAAA,OACxEN,KAAK,IAAIR,KAAK,CAACS,QAAQ;AAAA,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":["FilterButtonItemShape","exports","FilterButtonSize"],"sources":["../../../src/components/filter-buttons/types.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\n\nexport enum FilterButtonItemShape {\n Round,\n Rectangular,\n}\nexport enum FilterButtonSize {\n Small,\n Normal,\n}\n\nexport interface IFilterButtonItem {\n id: string;\n text: string;\n color?: CSSProperties['color'];\n icons?: string[];\n}\n"],"mappings":";;;;;;IAEYA,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,0BAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;AAAA,IAIrBE,gBAAgB,GAAAD,OAAA,CAAAC,gBAAA,0BAAhBA,gBAAgB;EAAhBA,gBAAgB,CAAhBA,gBAAgB;EAAhBA,gBAAgB,CAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA"}
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _truncation = require("../../utils/truncation");
|
|
9
8
|
var _Truncation = require("./Truncation.styles");
|
|
10
9
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
10
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -17,60 +16,77 @@ const Truncation = _ref => {
|
|
|
17
16
|
onChange,
|
|
18
17
|
children
|
|
19
18
|
} = _ref;
|
|
20
|
-
const childrenContainerRef = (0, _react.useRef)(null);
|
|
21
|
-
const truncatedContentRef = (0, _react.useRef)(null);
|
|
22
|
-
const contentRef = (0, _react.useRef)(null);
|
|
23
|
-
const [childrenContainerHeight, setChildrenContainerHeight] = (0, _react.useState)();
|
|
24
19
|
const [isOpen, setIsOpen] = (0, _react.useState)(false);
|
|
25
20
|
const [showClamp, setShowClamp] = (0, _react.useState)(true);
|
|
21
|
+
const [newCollapsedHeight, setNewCollapsedHeight] = (0, _react.useState)(collapsedHeight);
|
|
22
|
+
const pseudoChildrenRef = (0, _react.useRef)(null);
|
|
26
23
|
|
|
27
|
-
//
|
|
28
|
-
const handleAnimationComplete = (0, _react.useCallback)(() => {
|
|
29
|
-
if (childrenContainerRef.current) {
|
|
30
|
-
childrenContainerRef.current.innerHTML = isOpen ? contentRef.current?.innerHTML ?? '' : truncatedContentRef.current?.innerHTML ?? '';
|
|
31
|
-
}
|
|
32
|
-
}, [isOpen]);
|
|
33
|
-
|
|
34
|
-
// changes the state of the truncation
|
|
24
|
+
// Changes the state of the truncation
|
|
35
25
|
const handleClampClick = (0, _react.useCallback)(event => {
|
|
36
26
|
setIsOpen(current => {
|
|
37
|
-
|
|
27
|
+
if (typeof onChange === 'function') {
|
|
28
|
+
onChange(event, !current);
|
|
29
|
+
}
|
|
38
30
|
return !current;
|
|
39
31
|
});
|
|
40
32
|
}, [onChange]);
|
|
41
|
-
|
|
42
|
-
// initialization logic
|
|
43
|
-
// set the height of the children container to the collapsed height
|
|
44
33
|
(0, _react.useEffect)(() => {
|
|
45
|
-
if (
|
|
34
|
+
if (!pseudoChildrenRef.current) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
let summedHeight = 0;
|
|
38
|
+
const elementChildren = pseudoChildrenRef.current.children;
|
|
39
|
+
if (!elementChildren[0]) {
|
|
46
40
|
return;
|
|
47
41
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
42
|
+
const element = Array.from(elementChildren[0].children);
|
|
43
|
+
const heights = element.map((child, index) => {
|
|
44
|
+
const computedStyle = window.getComputedStyle(child);
|
|
45
|
+
const marginTop = parseFloat(computedStyle.marginTop);
|
|
46
|
+
const marginBottom = parseFloat(computedStyle.marginBottom);
|
|
53
47
|
|
|
54
|
-
|
|
48
|
+
// Höhe des Elements inklusive Margin berechnen
|
|
49
|
+
const totalHeight = child.clientHeight + marginTop + marginBottom;
|
|
50
|
+
return {
|
|
51
|
+
index,
|
|
52
|
+
height: totalHeight
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
let isSummedHeightCalculated = false;
|
|
56
|
+
heights.forEach(_ref2 => {
|
|
57
|
+
let {
|
|
58
|
+
height
|
|
59
|
+
} = _ref2;
|
|
60
|
+
if (summedHeight + height <= collapsedHeight && !isSummedHeightCalculated) {
|
|
61
|
+
summedHeight += height;
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
isSummedHeightCalculated = true;
|
|
65
|
+
});
|
|
66
|
+
setNewCollapsedHeight(summedHeight > 0 ? summedHeight : collapsedHeight);
|
|
67
|
+
}, [collapsedHeight, pseudoChildrenRef]);
|
|
68
|
+
|
|
69
|
+
// Checks if the clamp should be shown
|
|
55
70
|
(0, _react.useEffect)(() => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
71
|
+
if (pseudoChildrenRef.current) {
|
|
72
|
+
setShowClamp(pseudoChildrenRef.current.offsetHeight > newCollapsedHeight);
|
|
73
|
+
}
|
|
74
|
+
}, [collapsedHeight, newCollapsedHeight]);
|
|
75
|
+
return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(_Truncation.StyledTruncation, {
|
|
60
76
|
className: "beta-chayns-truncation"
|
|
61
|
-
}, /*#__PURE__*/_react.default.createElement(_Truncation.
|
|
77
|
+
}, /*#__PURE__*/_react.default.createElement(_Truncation.StyledTruncationPseudoContent, {
|
|
78
|
+
ref: pseudoChildrenRef
|
|
79
|
+
}, children), /*#__PURE__*/_react.default.createElement(_Truncation.StyledMotionTruncationContent, {
|
|
62
80
|
animate: {
|
|
63
|
-
height
|
|
81
|
+
height: isOpen ? 'auto' : newCollapsedHeight
|
|
64
82
|
},
|
|
65
83
|
initial: false,
|
|
66
|
-
onAnimationComplete: handleAnimationComplete,
|
|
67
|
-
ref: childrenContainerRef,
|
|
68
84
|
transition: {
|
|
69
85
|
type: 'tween'
|
|
70
86
|
}
|
|
71
87
|
}, children), showClamp && /*#__PURE__*/_react.default.createElement(_Truncation.StyledTruncationClamp, {
|
|
72
88
|
onClick: handleClampClick
|
|
73
|
-
}, isOpen ? lessLabel : moreLabel));
|
|
89
|
+
}, isOpen ? lessLabel : moreLabel)), [children, handleClampClick, isOpen, lessLabel, moreLabel, newCollapsedHeight, showClamp]);
|
|
74
90
|
};
|
|
75
91
|
var _default = exports.default = Truncation;
|
|
76
92
|
//# sourceMappingURL=Truncation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Truncation.js","names":["_react","_interopRequireWildcard","require","
|
|
1
|
+
{"version":3,"file":"Truncation.js","names":["_react","_interopRequireWildcard","require","_Truncation","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","Truncation","_ref","collapsedHeight","moreLabel","lessLabel","onChange","children","isOpen","setIsOpen","useState","showClamp","setShowClamp","newCollapsedHeight","setNewCollapsedHeight","pseudoChildrenRef","useRef","handleClampClick","useCallback","event","current","useEffect","summedHeight","elementChildren","element","Array","from","heights","map","child","index","computedStyle","window","getComputedStyle","marginTop","parseFloat","marginBottom","totalHeight","clientHeight","height","isSummedHeightCalculated","forEach","_ref2","offsetHeight","useMemo","createElement","StyledTruncation","className","StyledTruncationPseudoContent","ref","StyledMotionTruncationContent","animate","initial","transition","type","StyledTruncationClamp","onClick","_default","exports"],"sources":["../../../src/components/truncation/Truncation.tsx"],"sourcesContent":["import React, {\n FC,\n MouseEvent,\n MouseEventHandler,\n ReactElement,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport {\n StyledMotionTruncationContent,\n StyledTruncation,\n StyledTruncationClamp,\n StyledTruncationPseudoContent,\n} from './Truncation.styles';\n\nexport type TruncationProps = {\n /**\n * The elements that should be expanding or collapsing.\n */\n children: ReactElement;\n /**\n * The height of the children Element in it`s collapsed state.\n */\n collapsedHeight?: number;\n /**\n * A text that should be displayed if the content is expanded.\n */\n lessLabel?: string;\n /**\n * A text that should be displayed if the content is collapsed.\n */\n moreLabel?: string;\n /**\n * Function to be executed when the component is expanding or collapsing.\n */\n onChange?: (event: MouseEvent<HTMLAnchorElement>, isOpen: boolean) => void;\n};\n\nconst Truncation: FC<TruncationProps> = ({\n collapsedHeight = 150,\n moreLabel = 'Mehr',\n lessLabel = 'Weniger',\n onChange,\n children,\n}) => {\n const [isOpen, setIsOpen] = useState(false);\n const [showClamp, setShowClamp] = useState(true);\n const [newCollapsedHeight, setNewCollapsedHeight] = useState(collapsedHeight);\n\n const pseudoChildrenRef = useRef<HTMLDivElement>(null);\n\n // Changes the state of the truncation\n const handleClampClick = useCallback<MouseEventHandler<HTMLAnchorElement>>(\n (event) => {\n setIsOpen((current) => {\n if (typeof onChange === 'function') {\n onChange(event, !current);\n }\n\n return !current;\n });\n },\n [onChange],\n );\n\n useEffect(() => {\n if (!pseudoChildrenRef.current) {\n return;\n }\n\n let summedHeight = 0;\n\n const elementChildren = pseudoChildrenRef.current.children;\n\n if (!elementChildren[0]) {\n return;\n }\n\n const element = Array.from(elementChildren[0].children);\n\n const heights = element.map((child, index) => {\n const computedStyle = window.getComputedStyle(child);\n const marginTop = parseFloat(computedStyle.marginTop);\n const marginBottom = parseFloat(computedStyle.marginBottom);\n\n // Höhe des Elements inklusive Margin berechnen\n const totalHeight = child.clientHeight + marginTop + marginBottom;\n\n return {\n index,\n height: totalHeight,\n };\n });\n\n let isSummedHeightCalculated = false;\n\n heights.forEach(({ height }) => {\n if (summedHeight + height <= collapsedHeight && !isSummedHeightCalculated) {\n summedHeight += height;\n\n return;\n }\n\n isSummedHeightCalculated = true;\n });\n\n setNewCollapsedHeight(summedHeight > 0 ? summedHeight : collapsedHeight);\n }, [collapsedHeight, pseudoChildrenRef]);\n\n // Checks if the clamp should be shown\n useEffect(() => {\n if (pseudoChildrenRef.current) {\n setShowClamp(pseudoChildrenRef.current.offsetHeight > newCollapsedHeight);\n }\n }, [collapsedHeight, newCollapsedHeight]);\n\n return useMemo(\n () => (\n <StyledTruncation className=\"beta-chayns-truncation\">\n <StyledTruncationPseudoContent ref={pseudoChildrenRef}>\n {children}\n </StyledTruncationPseudoContent>\n <StyledMotionTruncationContent\n animate={{ height: isOpen ? 'auto' : newCollapsedHeight }}\n initial={false}\n transition={{ type: 'tween' }}\n >\n {children}\n </StyledMotionTruncationContent>\n {showClamp && (\n <StyledTruncationClamp onClick={handleClampClick}>\n {isOpen ? lessLabel : moreLabel}\n </StyledTruncationClamp>\n )}\n </StyledTruncation>\n ),\n [children, handleClampClick, isOpen, lessLabel, moreLabel, newCollapsedHeight, showClamp],\n );\n};\n\nexport default Truncation;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAWA,IAAAC,WAAA,GAAAD,OAAA;AAK6B,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,G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EzC,OAAO,IAAA+B,cAAO,EACV,mBACIpE,MAAA,CAAAU,OAAA,CAAA2D,aAAA,CAAClE,WAAA,CAAAmE,gBAAgB;IAACC,SAAS,EAAC;EAAwB,gBAChDvE,MAAA,CAAAU,OAAA,CAAA2D,aAAA,CAAClE,WAAA,CAAAqE,6BAA6B;IAACC,GAAG,EAAElC;EAAkB,GACjDR,QAC0B,CAAC,eAChC/B,MAAA,CAAAU,OAAA,CAAA2D,aAAA,CAAClE,WAAA,CAAAuE,6BAA6B;IAC1BC,OAAO,EAAE;MAAEZ,MAAM,EAAE/B,MAAM,GAAG,MAAM,GAAGK;IAAmB,CAAE;IAC1DuC,OAAO,EAAE,KAAM;IACfC,UAAU,EAAE;MAAEC,IAAI,EAAE;IAAQ;EAAE,GAE7B/C,QAC0B,CAAC,EAC/BI,SAAS,iBACNnC,MAAA,CAAAU,OAAA,CAAA2D,aAAA,CAAClE,WAAA,CAAA4E,qBAAqB;IAACC,OAAO,EAAEvC;EAAiB,GAC5CT,MAAM,GAAGH,SAAS,GAAGD,SACH,CAEb,CACrB,EACD,CAACG,QAAQ,EAAEU,gBAAgB,EAAET,MAAM,EAAEH,SAAS,EAAED,SAAS,EAAES,kBAAkB,EAAEF,SAAS,CAC5F,CAAC;AACL,CAAC;AAAC,IAAA8C,QAAA,GAAAC,OAAA,CAAAxE,OAAA,GAEae,UAAU"}
|
|
@@ -536,6 +536,277 @@ export declare const StyledMotionTruncationContent: import("styled-components").
|
|
|
536
536
|
} & import("framer-motion").MotionProps & import("react").RefAttributes<HTMLDivElement>, {
|
|
537
537
|
theme: import("../color-scheme-provider/ColorSchemeProvider").Theme;
|
|
538
538
|
}>> & import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>;
|
|
539
|
+
export declare const StyledTruncationPseudoContent: import("styled-components").IStyledComponent<"web", {
|
|
540
|
+
ref?: import("react").LegacyRef<HTMLDivElement> | undefined;
|
|
541
|
+
key?: import("react").Key | null | undefined;
|
|
542
|
+
defaultChecked?: boolean | undefined;
|
|
543
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
544
|
+
suppressContentEditableWarning?: boolean | undefined;
|
|
545
|
+
suppressHydrationWarning?: boolean | undefined;
|
|
546
|
+
accessKey?: string | undefined;
|
|
547
|
+
autoFocus?: boolean | undefined;
|
|
548
|
+
className?: string | undefined;
|
|
549
|
+
contentEditable?: "inherit" | (boolean | "true" | "false") | "plaintext-only" | undefined;
|
|
550
|
+
contextMenu?: string | undefined;
|
|
551
|
+
dir?: string | undefined;
|
|
552
|
+
draggable?: (boolean | "true" | "false") | undefined;
|
|
553
|
+
hidden?: boolean | undefined;
|
|
554
|
+
id?: string | undefined;
|
|
555
|
+
lang?: string | undefined;
|
|
556
|
+
nonce?: string | undefined;
|
|
557
|
+
slot?: string | undefined;
|
|
558
|
+
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
559
|
+
style?: import("react").CSSProperties | undefined;
|
|
560
|
+
tabIndex?: number | undefined;
|
|
561
|
+
title?: string | undefined;
|
|
562
|
+
translate?: "yes" | "no" | undefined;
|
|
563
|
+
radioGroup?: string | undefined;
|
|
564
|
+
role?: import("react").AriaRole | undefined;
|
|
565
|
+
about?: string | undefined;
|
|
566
|
+
content?: string | undefined;
|
|
567
|
+
datatype?: string | undefined;
|
|
568
|
+
inlist?: any;
|
|
569
|
+
prefix?: string | undefined;
|
|
570
|
+
property?: string | undefined;
|
|
571
|
+
rel?: string | undefined;
|
|
572
|
+
resource?: string | undefined;
|
|
573
|
+
rev?: string | undefined;
|
|
574
|
+
typeof?: string | undefined;
|
|
575
|
+
vocab?: string | undefined;
|
|
576
|
+
autoCapitalize?: string | undefined;
|
|
577
|
+
autoCorrect?: string | undefined;
|
|
578
|
+
autoSave?: string | undefined;
|
|
579
|
+
color?: string | undefined;
|
|
580
|
+
itemProp?: string | undefined;
|
|
581
|
+
itemScope?: boolean | undefined;
|
|
582
|
+
itemType?: string | undefined;
|
|
583
|
+
itemID?: string | undefined;
|
|
584
|
+
itemRef?: string | undefined;
|
|
585
|
+
results?: number | undefined;
|
|
586
|
+
security?: string | undefined;
|
|
587
|
+
unselectable?: "on" | "off" | undefined;
|
|
588
|
+
inputMode?: "search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
|
|
589
|
+
is?: string | undefined;
|
|
590
|
+
"aria-activedescendant"?: string | undefined;
|
|
591
|
+
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
592
|
+
"aria-autocomplete"?: "list" | "none" | "both" | "inline" | undefined;
|
|
593
|
+
"aria-braillelabel"?: string | undefined;
|
|
594
|
+
"aria-brailleroledescription"?: string | undefined;
|
|
595
|
+
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
|
596
|
+
"aria-checked"?: boolean | "true" | "false" | "mixed" | undefined;
|
|
597
|
+
"aria-colcount"?: number | undefined;
|
|
598
|
+
"aria-colindex"?: number | undefined;
|
|
599
|
+
"aria-colindextext"?: string | undefined;
|
|
600
|
+
"aria-colspan"?: number | undefined;
|
|
601
|
+
"aria-controls"?: string | undefined;
|
|
602
|
+
"aria-current"?: boolean | "time" | "true" | "false" | "page" | "step" | "location" | "date" | undefined;
|
|
603
|
+
"aria-describedby"?: string | undefined;
|
|
604
|
+
"aria-description"?: string | undefined;
|
|
605
|
+
"aria-details"?: string | undefined;
|
|
606
|
+
"aria-disabled"?: (boolean | "true" | "false") | undefined;
|
|
607
|
+
"aria-dropeffect"?: "link" | "none" | "copy" | "move" | "execute" | "popup" | undefined;
|
|
608
|
+
"aria-errormessage"?: string | undefined;
|
|
609
|
+
"aria-expanded"?: (boolean | "true" | "false") | undefined;
|
|
610
|
+
"aria-flowto"?: string | undefined;
|
|
611
|
+
"aria-grabbed"?: (boolean | "true" | "false") | undefined;
|
|
612
|
+
"aria-haspopup"?: boolean | "dialog" | "menu" | "true" | "false" | "grid" | "listbox" | "tree" | undefined;
|
|
613
|
+
"aria-hidden"?: (boolean | "true" | "false") | undefined;
|
|
614
|
+
"aria-invalid"?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
|
|
615
|
+
"aria-keyshortcuts"?: string | undefined;
|
|
616
|
+
"aria-label"?: string | undefined;
|
|
617
|
+
"aria-labelledby"?: string | undefined;
|
|
618
|
+
"aria-level"?: number | undefined;
|
|
619
|
+
"aria-live"?: "off" | "assertive" | "polite" | undefined;
|
|
620
|
+
"aria-modal"?: (boolean | "true" | "false") | undefined;
|
|
621
|
+
"aria-multiline"?: (boolean | "true" | "false") | undefined;
|
|
622
|
+
"aria-multiselectable"?: (boolean | "true" | "false") | undefined;
|
|
623
|
+
"aria-orientation"?: "horizontal" | "vertical" | undefined;
|
|
624
|
+
"aria-owns"?: string | undefined;
|
|
625
|
+
"aria-placeholder"?: string | undefined;
|
|
626
|
+
"aria-posinset"?: number | undefined;
|
|
627
|
+
"aria-pressed"?: boolean | "true" | "false" | "mixed" | undefined;
|
|
628
|
+
"aria-readonly"?: (boolean | "true" | "false") | undefined;
|
|
629
|
+
"aria-relevant"?: "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
|
|
630
|
+
"aria-required"?: (boolean | "true" | "false") | undefined;
|
|
631
|
+
"aria-roledescription"?: string | undefined;
|
|
632
|
+
"aria-rowcount"?: number | undefined;
|
|
633
|
+
"aria-rowindex"?: number | undefined;
|
|
634
|
+
"aria-rowindextext"?: string | undefined;
|
|
635
|
+
"aria-rowspan"?: number | undefined;
|
|
636
|
+
"aria-selected"?: (boolean | "true" | "false") | undefined;
|
|
637
|
+
"aria-setsize"?: number | undefined;
|
|
638
|
+
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
|
|
639
|
+
"aria-valuemax"?: number | undefined;
|
|
640
|
+
"aria-valuemin"?: number | undefined;
|
|
641
|
+
"aria-valuenow"?: number | undefined;
|
|
642
|
+
"aria-valuetext"?: string | undefined;
|
|
643
|
+
children?: import("react").ReactNode;
|
|
644
|
+
dangerouslySetInnerHTML?: {
|
|
645
|
+
__html: string | TrustedHTML;
|
|
646
|
+
} | undefined;
|
|
647
|
+
onCopy?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
648
|
+
onCopyCapture?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
649
|
+
onCut?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
650
|
+
onCutCapture?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
651
|
+
onPaste?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
652
|
+
onPasteCapture?: import("react").ClipboardEventHandler<HTMLDivElement> | undefined;
|
|
653
|
+
onCompositionEnd?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
|
|
654
|
+
onCompositionEndCapture?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
|
|
655
|
+
onCompositionStart?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
|
|
656
|
+
onCompositionStartCapture?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
|
|
657
|
+
onCompositionUpdate?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
|
|
658
|
+
onCompositionUpdateCapture?: import("react").CompositionEventHandler<HTMLDivElement> | undefined;
|
|
659
|
+
onFocus?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
|
|
660
|
+
onFocusCapture?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
|
|
661
|
+
onBlur?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
|
|
662
|
+
onBlurCapture?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
|
|
663
|
+
onChange?: import("react").FormEventHandler<HTMLDivElement> | undefined;
|
|
664
|
+
onChangeCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
|
|
665
|
+
onBeforeInput?: import("react").FormEventHandler<HTMLDivElement> | undefined;
|
|
666
|
+
onBeforeInputCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
|
|
667
|
+
onInput?: import("react").FormEventHandler<HTMLDivElement> | undefined;
|
|
668
|
+
onInputCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
|
|
669
|
+
onReset?: import("react").FormEventHandler<HTMLDivElement> | undefined;
|
|
670
|
+
onResetCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
|
|
671
|
+
onSubmit?: import("react").FormEventHandler<HTMLDivElement> | undefined;
|
|
672
|
+
onSubmitCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
|
|
673
|
+
onInvalid?: import("react").FormEventHandler<HTMLDivElement> | undefined;
|
|
674
|
+
onInvalidCapture?: import("react").FormEventHandler<HTMLDivElement> | undefined;
|
|
675
|
+
onLoad?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
676
|
+
onLoadCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
677
|
+
onError?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
678
|
+
onErrorCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
679
|
+
onKeyDown?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
680
|
+
onKeyDownCapture?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
681
|
+
onKeyPress?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
682
|
+
onKeyPressCapture?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
683
|
+
onKeyUp?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
684
|
+
onKeyUpCapture?: import("react").KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
685
|
+
onAbort?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
686
|
+
onAbortCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
687
|
+
onCanPlay?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
688
|
+
onCanPlayCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
689
|
+
onCanPlayThrough?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
690
|
+
onCanPlayThroughCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
691
|
+
onDurationChange?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
692
|
+
onDurationChangeCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
693
|
+
onEmptied?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
694
|
+
onEmptiedCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
695
|
+
onEncrypted?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
696
|
+
onEncryptedCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
697
|
+
onEnded?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
698
|
+
onEndedCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
699
|
+
onLoadedData?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
700
|
+
onLoadedDataCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
701
|
+
onLoadedMetadata?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
702
|
+
onLoadedMetadataCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
703
|
+
onLoadStart?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
704
|
+
onLoadStartCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
705
|
+
onPause?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
706
|
+
onPauseCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
707
|
+
onPlay?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
708
|
+
onPlayCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
709
|
+
onPlaying?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
710
|
+
onPlayingCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
711
|
+
onProgress?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
712
|
+
onProgressCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
713
|
+
onRateChange?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
714
|
+
onRateChangeCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
715
|
+
onResize?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
716
|
+
onResizeCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
717
|
+
onSeeked?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
718
|
+
onSeekedCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
719
|
+
onSeeking?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
720
|
+
onSeekingCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
721
|
+
onStalled?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
722
|
+
onStalledCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
723
|
+
onSuspend?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
724
|
+
onSuspendCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
725
|
+
onTimeUpdate?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
726
|
+
onTimeUpdateCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
727
|
+
onVolumeChange?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
728
|
+
onVolumeChangeCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
729
|
+
onWaiting?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
730
|
+
onWaitingCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
731
|
+
onAuxClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
732
|
+
onAuxClickCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
733
|
+
onClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
734
|
+
onClickCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
735
|
+
onContextMenu?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
736
|
+
onContextMenuCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
737
|
+
onDoubleClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
738
|
+
onDoubleClickCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
739
|
+
onDrag?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
740
|
+
onDragCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
741
|
+
onDragEnd?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
742
|
+
onDragEndCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
743
|
+
onDragEnter?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
744
|
+
onDragEnterCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
745
|
+
onDragExit?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
746
|
+
onDragExitCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
747
|
+
onDragLeave?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
748
|
+
onDragLeaveCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
749
|
+
onDragOver?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
750
|
+
onDragOverCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
751
|
+
onDragStart?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
752
|
+
onDragStartCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
753
|
+
onDrop?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
754
|
+
onDropCapture?: import("react").DragEventHandler<HTMLDivElement> | undefined;
|
|
755
|
+
onMouseDown?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
756
|
+
onMouseDownCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
757
|
+
onMouseEnter?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
758
|
+
onMouseLeave?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
759
|
+
onMouseMove?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
760
|
+
onMouseMoveCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
761
|
+
onMouseOut?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
762
|
+
onMouseOutCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
763
|
+
onMouseOver?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
764
|
+
onMouseOverCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
765
|
+
onMouseUp?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
766
|
+
onMouseUpCapture?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
767
|
+
onSelect?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
768
|
+
onSelectCapture?: import("react").ReactEventHandler<HTMLDivElement> | undefined;
|
|
769
|
+
onTouchCancel?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
|
|
770
|
+
onTouchCancelCapture?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
|
|
771
|
+
onTouchEnd?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
|
|
772
|
+
onTouchEndCapture?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
|
|
773
|
+
onTouchMove?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
|
|
774
|
+
onTouchMoveCapture?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
|
|
775
|
+
onTouchStart?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
|
|
776
|
+
onTouchStartCapture?: import("react").TouchEventHandler<HTMLDivElement> | undefined;
|
|
777
|
+
onPointerDown?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
778
|
+
onPointerDownCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
779
|
+
onPointerMove?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
780
|
+
onPointerMoveCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
781
|
+
onPointerUp?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
782
|
+
onPointerUpCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
783
|
+
onPointerCancel?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
784
|
+
onPointerCancelCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
785
|
+
onPointerEnter?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
786
|
+
onPointerEnterCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
787
|
+
onPointerLeave?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
788
|
+
onPointerLeaveCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
789
|
+
onPointerOver?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
790
|
+
onPointerOverCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
791
|
+
onPointerOut?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
792
|
+
onPointerOutCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
793
|
+
onGotPointerCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
794
|
+
onGotPointerCaptureCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
795
|
+
onLostPointerCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
796
|
+
onLostPointerCaptureCapture?: import("react").PointerEventHandler<HTMLDivElement> | undefined;
|
|
797
|
+
onScroll?: import("react").UIEventHandler<HTMLDivElement> | undefined;
|
|
798
|
+
onScrollCapture?: import("react").UIEventHandler<HTMLDivElement> | undefined;
|
|
799
|
+
onWheel?: import("react").WheelEventHandler<HTMLDivElement> | undefined;
|
|
800
|
+
onWheelCapture?: import("react").WheelEventHandler<HTMLDivElement> | undefined;
|
|
801
|
+
onAnimationStart?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
|
|
802
|
+
onAnimationStartCapture?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
|
|
803
|
+
onAnimationEnd?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
|
|
804
|
+
onAnimationEndCapture?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
|
|
805
|
+
onAnimationIteration?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
|
|
806
|
+
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
|
|
807
|
+
onTransitionEnd?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
808
|
+
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
809
|
+
}>;
|
|
539
810
|
export declare const StyledTruncationClamp: import("styled-components").IStyledComponent<"web", {
|
|
540
811
|
ref?: import("react").LegacyRef<HTMLAnchorElement> | undefined;
|
|
541
812
|
key?: import("react").Key | null | undefined;
|
|
@@ -3,14 +3,23 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.StyledTruncationClamp = exports.StyledTruncation = exports.StyledMotionTruncationContent = void 0;
|
|
6
|
+
exports.StyledTruncationPseudoContent = exports.StyledTruncationClamp = exports.StyledTruncation = exports.StyledMotionTruncationContent = void 0;
|
|
7
7
|
var _framerMotion = require("framer-motion");
|
|
8
8
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
const StyledTruncation = exports.StyledTruncation = _styledComponents.default.div
|
|
10
|
+
const StyledTruncation = exports.StyledTruncation = _styledComponents.default.div`
|
|
11
|
+
position: relative;
|
|
12
|
+
`;
|
|
11
13
|
|
|
12
14
|
// Fix framer-motion bug
|
|
13
|
-
const StyledMotionTruncationContent = exports.StyledMotionTruncationContent = (0, _styledComponents.default)(_framerMotion.motion.div)
|
|
15
|
+
const StyledMotionTruncationContent = exports.StyledMotionTruncationContent = (0, _styledComponents.default)(_framerMotion.motion.div)`
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
`;
|
|
18
|
+
const StyledTruncationPseudoContent = exports.StyledTruncationPseudoContent = _styledComponents.default.div`
|
|
19
|
+
visibility: hidden;
|
|
20
|
+
position: absolute;
|
|
21
|
+
width: fit-content;
|
|
22
|
+
`;
|
|
14
23
|
const StyledTruncationClamp = exports.StyledTruncationClamp = _styledComponents.default.a`
|
|
15
24
|
cursor: pointer;
|
|
16
25
|
float: right;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Truncation.styles.js","names":["_framerMotion","require","_styledComponents","_interopRequireDefault","obj","__esModule","default","StyledTruncation","exports","styled","div","StyledMotionTruncationContent","motion","StyledTruncationClamp","a"],"sources":["../../../src/components/truncation/Truncation.styles.ts"],"sourcesContent":["import { motion } from 'framer-motion';\nimport styled from 'styled-components';\nimport type { FramerMotionBugFix } from '../color-scheme-provider/ColorSchemeProvider';\n\nexport const StyledTruncation = styled.div
|
|
1
|
+
{"version":3,"file":"Truncation.styles.js","names":["_framerMotion","require","_styledComponents","_interopRequireDefault","obj","__esModule","default","StyledTruncation","exports","styled","div","StyledMotionTruncationContent","motion","StyledTruncationPseudoContent","StyledTruncationClamp","a"],"sources":["../../../src/components/truncation/Truncation.styles.ts"],"sourcesContent":["import { motion } from 'framer-motion';\nimport styled from 'styled-components';\nimport type { FramerMotionBugFix } from '../color-scheme-provider/ColorSchemeProvider';\n\nexport const StyledTruncation = styled.div`\n position: relative;\n`;\n\n// Fix framer-motion bug\nexport const StyledMotionTruncationContent = styled(motion.div)<FramerMotionBugFix>`\n overflow: hidden;\n`;\n\nexport const StyledTruncationPseudoContent = styled.div`\n visibility: hidden;\n position: absolute;\n width: fit-content;\n`;\n\nexport const StyledTruncationClamp = styled.a`\n cursor: pointer;\n float: right;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAuC,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAGhC,MAAMG,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAGE,yBAAM,CAACC,GAAI;AAC3C;AACA,CAAC;;AAED;AACO,MAAMC,6BAA6B,GAAAH,OAAA,CAAAG,6BAAA,GAAG,IAAAF,yBAAM,EAACG,oBAAM,CAACF,GAAG,CAAsB;AACpF;AACA,CAAC;AAEM,MAAMG,6BAA6B,GAAAL,OAAA,CAAAK,6BAAA,GAAGJ,yBAAM,CAACC,GAAI;AACxD;AACA;AACA;AACA,CAAC;AAEM,MAAMI,qBAAqB,GAAAN,OAAA,CAAAM,qBAAA,GAAGL,yBAAM,CAACM,CAAE;AAC9C;AACA;AACA,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -16,8 +16,8 @@ export { default as ContentCard } from './components/content-card/ContentCard';
|
|
|
16
16
|
export { default as ContextMenu } from './components/context-menu/ContextMenu';
|
|
17
17
|
export { default as DateInfo } from './components/date-info/DateInfo';
|
|
18
18
|
export { default as FileInput } from './components/file-input/FileInput';
|
|
19
|
-
export { default as
|
|
20
|
-
export type { FilterButtonItemShape, FilterButtonSize, IFilterButtonItem as FilterButtonItem, } from './components/filter-
|
|
19
|
+
export { default as FilterButtons } from './components/filter-buttons/FilterButtons';
|
|
20
|
+
export type { FilterButtonItemShape, FilterButtonSize, IFilterButtonItem as FilterButtonItem, } from './components/filter-buttons/types';
|
|
21
21
|
export { default as GridImage } from './components/grid-image/GridImage';
|
|
22
22
|
export { default as Icon } from './components/icon/Icon';
|
|
23
23
|
export { default as Input } from './components/input/Input';
|
package/lib/index.js
CHANGED
|
@@ -105,10 +105,10 @@ Object.defineProperty(exports, "FileInput", {
|
|
|
105
105
|
return _FileInput.default;
|
|
106
106
|
}
|
|
107
107
|
});
|
|
108
|
-
Object.defineProperty(exports, "
|
|
108
|
+
Object.defineProperty(exports, "FilterButtons", {
|
|
109
109
|
enumerable: true,
|
|
110
110
|
get: function () {
|
|
111
|
-
return
|
|
111
|
+
return _FilterButtons.default;
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
114
|
Object.defineProperty(exports, "GridImage", {
|
|
@@ -307,7 +307,7 @@ var _ContentCard = _interopRequireDefault(require("./components/content-card/Con
|
|
|
307
307
|
var _ContextMenu = _interopRequireDefault(require("./components/context-menu/ContextMenu"));
|
|
308
308
|
var _DateInfo = _interopRequireDefault(require("./components/date-info/DateInfo"));
|
|
309
309
|
var _FileInput = _interopRequireDefault(require("./components/file-input/FileInput"));
|
|
310
|
-
var
|
|
310
|
+
var _FilterButtons = _interopRequireDefault(require("./components/filter-buttons/FilterButtons"));
|
|
311
311
|
var _GridImage = _interopRequireDefault(require("./components/grid-image/GridImage"));
|
|
312
312
|
var _Icon = _interopRequireDefault(require("./components/icon/Icon"));
|
|
313
313
|
var _Input = _interopRequireDefault(require("./components/input/Input"));
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Accordion","_interopRequireDefault","require","_AccordionContent","_AccordionGroup","_AccordionIntro","_AccordionItem","_AmountControl","_Badge","_Button","_Checkbox","_CodeHighlighter","_ColorSchemeProvider","_ComboBox","_ContentCard","_ContextMenu","_DateInfo","_FileInput","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Accordion","_interopRequireDefault","require","_AccordionContent","_AccordionGroup","_AccordionIntro","_AccordionItem","_AmountControl","_Badge","_Button","_Checkbox","_CodeHighlighter","_ColorSchemeProvider","_ComboBox","_ContentCard","_ContextMenu","_DateInfo","_FileInput","_FilterButtons","_GridImage","_Icon","_Input","_List","_ListItemContent","_ListItem","_alignment","_MentionFinder","_NumberInput","_Popup","_ProgressBar","_RadioButtonGroup","_RadioButton","_ScrollView","_SearchBox","_SearchInput","_SetupWizardItem","_SetupWizard","_SharingBar","_Slider","_SmallWaitCursor","_interopRequireWildcard","_TextArea","_Tooltip","_Truncation","_codeHighlighter","_fileDialog","_isTobitEmployee","_uploadFile","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","obj"],"sources":["../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport { default as CodeHighlighter } from './components/code-highlighter/CodeHighlighter';\nexport { default as ColorSchemeProvider } from './components/color-scheme-provider/ColorSchemeProvider';\nexport type {\n FramerMotionBugFix,\n WithTheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport { default as ComboBox } from './components/combobox/ComboBox';\nexport type { IComboBoxItem as ComboBoxItem } from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport { default as ContextMenu } from './components/context-menu/ContextMenu';\nexport { default as DateInfo } from './components/date-info/DateInfo';\nexport { default as FileInput } from './components/file-input/FileInput';\nexport { default as FilterButtons } from './components/filter-buttons/FilterButtons';\nexport type {\n FilterButtonItemShape,\n FilterButtonSize,\n IFilterButtonItem as FilterButtonItem,\n} from './components/filter-buttons/types';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as Icon } from './components/icon/Icon';\nexport { default as Input } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport { default as ListItem } from './components/list/list-item/ListItem';\nexport { MentionFinderPopupAlignment } from './components/mention-finder/constants/alignment';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as Popup } from './components/popup/Popup';\nexport type { PopupRef } from './components/popup/types';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport { default as RadioButtonGroup } from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport type { ISearchBoxItem as SearchBoxItem } from './components/search-box/types';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SetupWizardItem } from './components/setup-wizard/setup-wizard-item/SetupWizardItem';\nexport { default as SetupWizard } from './components/setup-wizard/SetupWizard';\nexport type { SetupWizardRef } from './components/setup-wizard/SetupWizard';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { default as Truncation } from './components/truncation/Truncation';\nexport { CodeHighlighterTheme } from './types/codeHighlighter';\nexport type { CodeHighlighterLanguage, HighlightedLines } from './types/codeHighlighter';\nexport type { FileItem, Image, Meta, Video } from './types/file';\nexport { getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './utils/isTobitEmployee';\nexport { uploadFile } from './utils/uploadFile';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,eAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,eAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,cAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,cAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,MAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,OAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,SAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,gBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,oBAAA,GAAAX,sBAAA,CAAAC,OAAA;AAKA,IAAAW,SAAA,GAAAZ,sBAAA,CAAAC,OAAA;AAEA,IAAAY,YAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,YAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,SAAA,GAAAf,sBAAA,CAAAC,OAAA;AACA,IAAAe,UAAA,GAAAhB,sBAAA,CAAAC,OAAA;AACA,IAAAgB,cAAA,GAAAjB,sBAAA,CAAAC,OAA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GAAAgB,GAAA,KAAAf,OAAA,EAAAe,GAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chayns-components/core",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.352",
|
|
4
4
|
"description": "A set of beautiful React components for developing your own applications with chayns.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chayns",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"publishConfig": {
|
|
71
71
|
"access": "public"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "6e76e0e21a729086a62db418f80cdeb09868f12e"
|
|
74
74
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FilterButton.js","names":["_react","_interopRequireWildcard","require","_FilterButtonItem","_interopRequireDefault","_FilterButton","_types","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","FilterButton","_ref","selectedItemIds","onSelect","items","size","FilterButtonSize","Normal","selectedIds","setSelectedIds","useState","useEffect","handleSelect","useCallback","id","newIds","includes","filter","filteredId","length","reactItems","useMemo","array","createElement","key","isSelected","shape","FilterButtonItemShape","Rectangular","text","forEach","_ref2","icons","color","push","Round","StyledFilterButton","displayName","_default","exports"],"sources":["../../../src/components/filter-button/FilterButton.tsx"],"sourcesContent":["import React, { FC, ReactElement, useCallback, useEffect, useMemo, useState } from 'react';\nimport FilterButtonItem from './filter-button-item/FilterButtonItem';\nimport { StyledFilterButton } from './FilterButton.styles';\nimport { FilterButtonItemShape, FilterButtonSize, IFilterButtonItem } from './types';\n\nexport type FilterButtonProps = {\n /**\n * The items that should be displayed.\n */\n items: IFilterButtonItem[];\n /**\n * A function that should be executed when an item is selected.\n */\n onSelect?: (keys: string[]) => void;\n /**\n * The keys of items that should be selected.\n */\n selectedItemIds?: string[];\n /**\n * The size auf the filter buttons. Use the FilterButtonSize enum.\n */\n size?: FilterButtonSize;\n};\n\nconst FilterButton: FC<FilterButtonProps> = ({\n selectedItemIds,\n onSelect,\n items,\n size = FilterButtonSize.Normal,\n}) => {\n const [selectedIds, setSelectedIds] = useState<string[]>(['all']);\n\n /**\n * This function set the selectedItemKey\n */\n useEffect(() => {\n if (selectedItemIds) {\n setSelectedIds(selectedItemIds);\n }\n }, [selectedItemIds]);\n\n /**\n * Function to update the selected items\n */\n const handleSelect = useCallback(\n (id: string) => {\n let newIds: string[];\n\n if (id === 'all') {\n newIds = selectedIds.includes('all') ? [] : ['all'];\n } else {\n newIds = selectedIds.includes(id)\n ? selectedIds.filter((filteredId) => filteredId !== id)\n : [...selectedIds.filter((filteredId) => filteredId !== 'all'), id];\n }\n\n if (newIds.length === 0) {\n newIds = ['all'];\n }\n\n setSelectedIds(newIds);\n\n if (typeof onSelect === 'function') {\n onSelect(newIds);\n }\n },\n [onSelect, selectedIds]\n );\n\n const reactItems = useMemo(() => {\n if (items.length === 0) {\n return null;\n }\n\n const array: ReactElement[] = [\n <FilterButtonItem\n id=\"all\"\n key=\"all\"\n onSelect={handleSelect}\n isSelected={selectedIds.includes('all')}\n shape={FilterButtonItemShape.Rectangular}\n size={size}\n text=\"Alle\"\n />,\n ];\n\n items.forEach(({ icons, text, color, id }) => {\n array.push(\n <FilterButtonItem\n color={color}\n icons={icons}\n id={id}\n key={id}\n onSelect={handleSelect}\n isSelected={selectedIds.includes(id)}\n shape={FilterButtonItemShape.Round}\n size={size}\n text={text}\n />\n );\n });\n\n return array;\n }, [handleSelect, items, selectedIds, size]);\n\n return useMemo(() => <StyledFilterButton>{reactItems}</StyledFilterButton>, [reactItems]);\n};\n\nFilterButton.displayName = 'FilterButton';\n\nexport default FilterButton;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA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AC,CAAC;AAC7F,CAAC;AAEDpB,YAAY,CAACqC,WAAW,GAAG,cAAc;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA3D,OAAA,GAE3BoB,YAAY"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FilterButton.styles.js","names":["_styledComponents","_interopRequireDefault","require","obj","__esModule","default","StyledFilterButton","exports","styled","div"],"sources":["../../../src/components/filter-button/FilterButton.styles.ts"],"sourcesContent":["import styled from 'styled-components';\n\nexport const StyledFilterButton = styled.div`\n display: flex;\n flex-wrap: wrap;\n gap: 10px;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEhC,MAAMG,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAGE,yBAAM,CAACC,GAAI;AAC7C;AACA;AACA;AACA,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FilterButtonItem.js","names":["_react","_interopRequireWildcard","require","_Icon","_interopRequireDefault","_types","_FilterButtonItem","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","FilterButtonItem","_ref","icons","size","shape","text","color","isSelected","id","onSelect","handleClick","useCallback","useMemo","createElement","StyledFilterButtonItem","onClick","StyledFilterButtonItemLabel","FilterButtonSize","Normal","StyledFilterButtonItemLabelText","StyledFilterButtonItemBorder","StyledMotionFilterButtonItemBackground","displayName","_default","exports"],"sources":["../../../../src/components/filter-button/filter-button-item/FilterButtonItem.tsx"],"sourcesContent":["import React, { CSSProperties, FC, useCallback, useMemo } from 'react';\nimport Icon from '../../icon/Icon';\nimport { FilterButtonItemShape, FilterButtonSize } from '../types';\nimport {\n StyledFilterButtonItem,\n StyledFilterButtonItemBorder,\n StyledFilterButtonItemLabel,\n StyledFilterButtonItemLabelText,\n StyledMotionFilterButtonItemBackground,\n} from './FilterButtonItem.styles';\n\nexport type FilterButtonItemProps = {\n color?: CSSProperties['color'];\n icons?: string[];\n isSelected: boolean;\n shape: FilterButtonItemShape;\n size: FilterButtonSize;\n text: string;\n id: string;\n onSelect: (key: string) => void;\n};\n\nconst FilterButtonItem: FC<FilterButtonItemProps> = ({\n icons,\n size,\n shape,\n text,\n color,\n isSelected,\n id,\n onSelect,\n}) => {\n const handleClick = useCallback(() => {\n onSelect(id);\n }, [id, onSelect]);\n\n return useMemo(\n () => (\n <StyledFilterButtonItem isSelected={isSelected} size={size} onClick={handleClick}>\n <StyledFilterButtonItemLabel>\n {icons && (\n <Icon icons={icons} size={size === FilterButtonSize.Normal ? 15 : 10} />\n )}\n <StyledFilterButtonItemLabelText>{text}</StyledFilterButtonItemLabelText>\n </StyledFilterButtonItemLabel>\n <StyledFilterButtonItemBorder isSelected={isSelected} shape={shape} color={color} />\n <StyledMotionFilterButtonItemBackground\n isSelected={isSelected}\n shape={shape}\n color={color}\n />\n </StyledFilterButtonItem>\n ),\n [color, handleClick, icons, isSelected, shape, size, text]\n );\n};\n\nFilterButtonItem.displayName = 'FilterButtonItem';\n\nexport default FilterButtonItem;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AAMmC,SAAAE,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,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onItem.styles.js","names":["_framerMotion","require","_styledComponents","_interopRequireWildcard","_types","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","StyledFilterButtonItem","exports","styled","div","_ref","size","FilterButtonSize","Normal","_ref2","isSelected","css","StyledFilterButtonItemLabel","StyledFilterButtonItemLabelText","p","_ref3","theme","text","StyledFilterButtonItemBorder","_ref4","shape","FilterButtonItemShape","Round","_ref5","color","headline","StyledMotionFilterButtonItemBackground","motion","_ref6","_ref7","_ref8"],"sources":["../../../../src/components/filter-button/filter-button-item/FilterButtonItem.styles.ts"],"sourcesContent":["import { motion } from 'framer-motion';\nimport type { CSSProperties } from 'react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\nimport { FilterButtonItemShape, FilterButtonSize } from '../types';\n\ntype StyledFilterButtonItemProps = WithTheme<{ size: FilterButtonSize; isSelected: boolean }>;\n\nexport const StyledFilterButtonItem = styled.div<StyledFilterButtonItemProps>`\n position: relative;\n font-size: ${({ size }) => (size === FilterButtonSize.Normal ? 15 : 12)}px;\n cursor: pointer;\n user-select: none;\n padding: 3px 14px;\n\n &:hover > div:last-child {\n ${({ isSelected }) =>\n !isSelected &&\n css`\n opacity: 0.2;\n `}\n }\n`;\n\nexport const StyledFilterButtonItemLabel = styled.div`\n display: flex;\n gap: 5px;\n align-items: center;\n`;\n\ntype StyledFilterButtonItemLabelTextProps = WithTheme<unknown>;\n\nexport const StyledFilterButtonItemLabelText = styled.p<StyledFilterButtonItemLabelTextProps>`\n color: ${({ theme }: StyledFilterButtonItemLabelTextProps) => theme.text};\n margin-top: 2px;\n`;\n\ntype StyledFilterButtonItemBorderProps = WithTheme<{\n shape: FilterButtonItemShape;\n color: CSSProperties['color'];\n isSelected: boolean;\n}>;\n\nexport const StyledFilterButtonItemBorder = styled.div<StyledFilterButtonItemBorderProps>`\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n opacity: 0.4;\n z-index: -1;\n border-radius: ${({ shape }) => (shape === FilterButtonItemShape.Round ? 100 : 0)}px;\n ${({ color, theme, isSelected }: StyledFilterButtonItemBorderProps) =>\n !isSelected &&\n css`\n border-width: 1px;\n border-style: solid;\n border-color: ${color ?? theme.headline};\n `};\n`;\n\ntype StyledFilterButtonItemBackgroundProps = WithTheme<{\n shape: FilterButtonItemShape;\n color: CSSProperties['color'];\n isSelected: boolean;\n}>;\n\nexport const StyledMotionFilterButtonItemBackground = styled(\n motion.div\n)<StyledFilterButtonItemBackgroundProps>`\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n z-index: -1;\n opacity: ${({ isSelected }) => (isSelected ? 0.4 : 0)};\n transition: opacity 0.5s ease;\n border-radius: ${({ shape }) => (shape === FilterButtonItemShape.Round ? 100 : 0)}px;\n background-color: ${({ color, theme }: StyledFilterButtonItemBackgroundProps) =>\n color ?? theme.headline};\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AAAmE,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAA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.js","names":["FilterButtonItemShape","exports","FilterButtonSize"],"sources":["../../../src/components/filter-button/types.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\n\nexport enum FilterButtonItemShape {\n Round,\n Rectangular,\n}\nexport enum FilterButtonSize {\n Small,\n Normal,\n}\n\nexport interface IFilterButtonItem {\n id: string;\n text: string;\n color?: CSSProperties['color'];\n icons?: string[];\n}\n"],"mappings":";;;;;;IAEYA,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,0BAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;AAAA,IAIrBE,gBAAgB,GAAAD,OAAA,CAAAC,gBAAA,0BAAhBA,gBAAgB;EAAhBA,gBAAgB,CAAhBA,gBAAgB;EAAhBA,gBAAgB,CAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const truncateElement: (element: HTMLElement, referenceHeight: number) => void;
|
package/lib/utils/truncation.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.truncateElement = void 0;
|
|
7
|
-
const doesOverflow = (element, referenceHeight) => element.scrollHeight > referenceHeight;
|
|
8
|
-
function hasOnlyText(element) {
|
|
9
|
-
// Check if element has no child elements.
|
|
10
|
-
if (element.children.length === 0) {
|
|
11
|
-
// If element has text (not empty), it is only text.
|
|
12
|
-
return element.textContent !== '';
|
|
13
|
-
}
|
|
14
|
-
// Element has child elements or no text, so it's not only text.
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
const removeLastLeafElement = element => {
|
|
18
|
-
// remove last element of html element where the last element is a leaf element and its content is a string
|
|
19
|
-
const lastChild = element.lastElementChild;
|
|
20
|
-
if (lastChild && !hasOnlyText(lastChild) && lastChild.hasChildNodes()) {
|
|
21
|
-
removeLastLeafElement(lastChild);
|
|
22
|
-
} else if (lastChild && hasOnlyText(lastChild) && lastChild.textContent && lastChild.textContent.length > 25) {
|
|
23
|
-
lastChild.textContent = `${lastChild.textContent.substring(0, lastChild.textContent.length - 25)} ...`;
|
|
24
|
-
} else if (lastChild) {
|
|
25
|
-
element.removeChild(lastChild);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
const truncateElement = (element, referenceHeight) => {
|
|
29
|
-
while (doesOverflow(element, referenceHeight)) {
|
|
30
|
-
removeLastLeafElement(element);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
exports.truncateElement = truncateElement;
|
|
34
|
-
//# sourceMappingURL=truncation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"truncation.js","names":["doesOverflow","element","referenceHeight","scrollHeight","hasOnlyText","children","length","textContent","removeLastLeafElement","lastChild","lastElementChild","hasChildNodes","substring","removeChild","truncateElement","exports"],"sources":["../../src/utils/truncation.ts"],"sourcesContent":["const doesOverflow = (element: HTMLElement, referenceHeight: number): boolean =>\n element.scrollHeight > referenceHeight;\n\nfunction hasOnlyText(element: HTMLElement): boolean {\n // Check if element has no child elements.\n if (element.children.length === 0) {\n // If element has text (not empty), it is only text.\n return element.textContent !== '';\n }\n // Element has child elements or no text, so it's not only text.\n return false;\n}\n\nconst removeLastLeafElement = (element: HTMLElement) => {\n // remove last element of html element where the last element is a leaf element and its content is a string\n const lastChild: Element | null = element.lastElementChild;\n if (lastChild && !hasOnlyText(lastChild as HTMLElement) && lastChild.hasChildNodes()) {\n removeLastLeafElement(lastChild as HTMLElement);\n } else if (\n lastChild &&\n hasOnlyText(lastChild as HTMLElement) &&\n lastChild.textContent &&\n lastChild.textContent.length > 25\n ) {\n lastChild.textContent = `${lastChild.textContent.substring(\n 0,\n lastChild.textContent.length - 25,\n )} ...`;\n } else if (lastChild) {\n element.removeChild(lastChild);\n }\n};\nexport const truncateElement = (element: HTMLElement, referenceHeight: number) => {\n while (doesOverflow(element, referenceHeight)) {\n removeLastLeafElement(element);\n }\n};\n"],"mappings":";;;;;;AAAA,MAAMA,YAAY,GAAGA,CAACC,OAAoB,EAAEC,eAAuB,KAC/DD,OAAO,CAACE,YAAY,GAAGD,eAAe;AAE1C,SAASE,WAAWA,CAACH,OAAoB,EAAW;EAChD;EACA,IAAIA,OAAO,CAACI,QAAQ,CAACC,MAAM,KAAK,CAAC,EAAE;IAC/B;IACA,OAAOL,OAAO,CAACM,WAAW,KAAK,EAAE;EACrC;EACA;EACA,OAAO,KAAK;AAChB;AAEA,MAAMC,qBAAqB,GAAIP,OAAoB,IAAK;EACpD;EACA,MAAMQ,SAAyB,GAAGR,OAAO,CAACS,gBAAgB;EAC1D,IAAID,SAAS,IAAI,CAACL,WAAW,CAACK,SAAwB,CAAC,IAAIA,SAAS,CAACE,aAAa,CAAC,CAAC,EAAE;IAClFH,qBAAqB,CAACC,SAAwB,CAAC;EACnD,CAAC,MAAM,IACHA,SAAS,IACTL,WAAW,CAACK,SAAwB,CAAC,IACrCA,SAAS,CAACF,WAAW,IACrBE,SAAS,CAACF,WAAW,CAACD,MAAM,GAAG,EAAE,EACnC;IACEG,SAAS,CAACF,WAAW,GAAI,GAAEE,SAAS,CAACF,WAAW,CAACK,SAAS,CACtD,CAAC,EACDH,SAAS,CAACF,WAAW,CAACD,MAAM,GAAG,EACnC,CAAE,MAAK;EACX,CAAC,MAAM,IAAIG,SAAS,EAAE;IAClBR,OAAO,CAACY,WAAW,CAACJ,SAAS,CAAC;EAClC;AACJ,CAAC;AACM,MAAMK,eAAe,GAAGA,CAACb,OAAoB,EAAEC,eAAuB,KAAK;EAC9E,OAAOF,YAAY,CAACC,OAAO,EAAEC,eAAe,CAAC,EAAE;IAC3CM,qBAAqB,CAACP,OAAO,CAAC;EAClC;AACJ,CAAC;AAACc,OAAA,CAAAD,eAAA,GAAAA,eAAA"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|