@artsy/palette 44.2.0 → 45.0.0-canary.1472.32632.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/elements/ReadMore/ReadMore.d.ts +1 -1
- package/dist/elements/ReadMore/ReadMore.js +54 -42
- package/dist/elements/ReadMore/ReadMore.js.map +1 -1
- package/dist/elements/ReadMore/ReadMore.story.d.ts +5 -5
- package/dist/elements/ReadMore/ReadMore.story.js +8 -8
- package/dist/elements/ReadMore/ReadMore.story.js.map +1 -1
- package/package.json +2 -2
|
@@ -7,13 +7,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.ReadMore = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
|
-
var _truncHtml = _interopRequireDefault(require("trunc-html"));
|
|
11
10
|
var _Clickable = require("../Clickable");
|
|
12
11
|
var _Text = require("../Text");
|
|
13
|
-
var
|
|
12
|
+
var _Theme = require("../../Theme");
|
|
14
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
17
17
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
18
18
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19
19
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -27,69 +27,81 @@ var ReadMore = exports.ReadMore = function ReadMore(_ref) {
|
|
|
27
27
|
_ref$inlineReadMoreLi = _ref.inlineReadMoreLink,
|
|
28
28
|
inlineReadMoreLink = _ref$inlineReadMoreLi === void 0 ? true : _ref$inlineReadMoreLi,
|
|
29
29
|
isExpanded = _ref.isExpanded,
|
|
30
|
-
_ref$
|
|
31
|
-
|
|
30
|
+
_ref$maxLines = _ref.maxLines,
|
|
31
|
+
maxLines = _ref$maxLines === void 0 ? Infinity : _ref$maxLines,
|
|
32
32
|
onReadLessClicked = _ref.onReadLessClicked,
|
|
33
33
|
onReadMoreClicked = _ref.onReadMoreClicked;
|
|
34
|
-
var
|
|
34
|
+
var ref = (0, _react.useRef)(null);
|
|
35
|
+
var _useTheme = (0, _Theme.useTheme)(),
|
|
36
|
+
theme = _useTheme.theme;
|
|
37
|
+
var _useState = (0, _react.useState)(false),
|
|
35
38
|
_useState2 = _slicedToArray(_useState, 2),
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
isOverflowing = _useState2[0],
|
|
40
|
+
setIsOverflowing = _useState2[1];
|
|
41
|
+
var _useState3 = (0, _react.useState)(0),
|
|
42
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
43
|
+
singleLineHeight = _useState4[0],
|
|
44
|
+
setSingleLineHeight = _useState4[1];
|
|
45
|
+
var _useState5 = (0, _react.useState)(!!isExpanded),
|
|
46
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
47
|
+
expanded = _useState6[0],
|
|
48
|
+
setExpanded = _useState6[1];
|
|
49
|
+
var maxLinesToShow = expanded ? Infinity : maxLines;
|
|
50
|
+
var sentinelSpan = "<span data-readmore-sentinel aria-hidden=\"true\" style=\"display:inline-block;width:0;padding:0;margin:0;\">​</span>";
|
|
38
51
|
if (typeof expandedHTML !== "string") return null;
|
|
39
|
-
var charCount = expandedHTML.replace(HTML_TAG_REGEX, "").length;
|
|
40
|
-
var truncatedHTML = (0, _truncHtml.default)(expandedHTML, maxChars).html;
|
|
41
|
-
var visible = charCount > maxChars;
|
|
42
52
|
var handleClick = function handleClick() {
|
|
43
53
|
if (disabled) return;
|
|
44
54
|
setExpanded(function (expandedState) {
|
|
45
55
|
return !expandedState;
|
|
46
56
|
});
|
|
47
|
-
expanded ? onReadLessClicked
|
|
57
|
+
expanded ? onReadLessClicked === null || onReadLessClicked === void 0 ? void 0 : onReadLessClicked() : onReadMoreClicked === null || onReadMoreClicked === void 0 ? void 0 : onReadMoreClicked();
|
|
48
58
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
59
|
+
(0, _react.useEffect)(function () {
|
|
60
|
+
if (!ref.current) return;
|
|
61
|
+
setIsOverflowing(ref.current.scrollHeight > ref.current.clientHeight);
|
|
62
|
+
var sentinel = ref.current.querySelector("[data-readmore-sentinel]");
|
|
63
|
+
if (!sentinel) return;
|
|
64
|
+
setSingleLineHeight(sentinel.clientHeight);
|
|
65
|
+
}, []);
|
|
56
66
|
return /*#__PURE__*/_react.default.createElement(Container, {
|
|
57
67
|
"aria-expanded": expanded
|
|
58
|
-
},
|
|
68
|
+
}, /*#__PURE__*/_react.default.createElement(LineClamp, {
|
|
69
|
+
ref: ref,
|
|
70
|
+
lineClamp: maxLinesToShow,
|
|
59
71
|
dangerouslySetInnerHTML: {
|
|
60
|
-
__html: expandedHTML
|
|
72
|
+
__html: expanded ? expandedHTML : "".concat(expandedHTML).concat(sentinelSpan)
|
|
61
73
|
}
|
|
62
|
-
}), /*#__PURE__*/_react.default.createElement(_Clickable.Clickable, {
|
|
74
|
+
}), isOverflowing && /*#__PURE__*/_react.default.createElement(_Clickable.Clickable, _extends({
|
|
63
75
|
cursor: "pointer",
|
|
64
76
|
textDecoration: "underline",
|
|
65
77
|
onClick: handleClick
|
|
66
|
-
},
|
|
78
|
+
}, !expanded && inlineReadMoreLink ? {
|
|
79
|
+
position: "absolute",
|
|
80
|
+
bottom: 0,
|
|
81
|
+
right: 0,
|
|
82
|
+
background: "linear-gradient(to left, ".concat(theme.colors.mono0, " 0, ").concat(theme.colors.mono0, " calc(100% - ").concat(theme.space[4], "), transparent 100%)"),
|
|
83
|
+
pl: 4,
|
|
84
|
+
height: singleLineHeight,
|
|
85
|
+
display: "flex",
|
|
86
|
+
alignItems: "center",
|
|
87
|
+
justifyContent: "center"
|
|
88
|
+
} : {}), /*#__PURE__*/_react.default.createElement(_Text.Text, {
|
|
67
89
|
variant: "xs",
|
|
68
90
|
fontWeight: "bold"
|
|
69
|
-
}, "Read less")))
|
|
70
|
-
onClick: handleClick
|
|
71
|
-
}, inlineReadMoreLink ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
72
|
-
dangerouslySetInnerHTML: {
|
|
73
|
-
__html: truncatedHTML
|
|
74
|
-
}
|
|
75
|
-
}), " ") : /*#__PURE__*/_react.default.createElement(_Box.Box, {
|
|
76
|
-
dangerouslySetInnerHTML: {
|
|
77
|
-
__html: truncatedHTML
|
|
78
|
-
}
|
|
79
|
-
}), /*#__PURE__*/_react.default.createElement(_Text.Text, {
|
|
80
|
-
as: "span",
|
|
81
|
-
variant: "xs",
|
|
82
|
-
fontWeight: "bold",
|
|
83
|
-
style: {
|
|
84
|
-
textDecoration: "underline"
|
|
85
|
-
}
|
|
86
|
-
}, "Read more")));
|
|
91
|
+
}, "Read ", expanded ? "less" : "more")));
|
|
87
92
|
};
|
|
88
93
|
ReadMore.displayName = "ReadMore";
|
|
89
94
|
var Container = _styledComponents.default.div.withConfig({
|
|
90
95
|
displayName: "ReadMore__Container",
|
|
91
96
|
componentId: "sc-1bqy0ya-0"
|
|
92
|
-
})(["
|
|
97
|
+
})(["position:relative;"]);
|
|
93
98
|
Container.displayName = "Container";
|
|
94
|
-
var
|
|
99
|
+
var LineClamp = _styledComponents.default.div.withConfig({
|
|
100
|
+
displayName: "ReadMore__LineClamp",
|
|
101
|
+
componentId: "sc-1bqy0ya-1"
|
|
102
|
+
})(["display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:", ";line-clamp:", ";overflow:hidden;"], function (props) {
|
|
103
|
+
return props.lineClamp;
|
|
104
|
+
}, function (props) {
|
|
105
|
+
return props.lineClamp;
|
|
106
|
+
});
|
|
95
107
|
//# sourceMappingURL=ReadMore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadMore.js","names":["_react","_interopRequireWildcard","require","_styledComponents","_interopRequireDefault","_truncHtml","_Clickable","_Text","_Box","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_slicedToArray","arr","i","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","o","minLen","_arrayLikeToArray","n","toString","slice","constructor","name","Array","from","test","len","length","arr2","_i","Symbol","iterator","_s","_e","_x","_r","_arr","_n","_d","next","done","push","value","err","return","isArray","ReadMore","exports","_ref","expandedHTML","content","disabled","_ref$inlineReadMoreLi","inlineReadMoreLink","isExpanded","_ref$maxChars","maxChars","Infinity","onReadLessClicked","onReadMoreClicked","_useState","useState","_useState2","expanded","setExpanded","charCount","replace","HTML_TAG_REGEX","truncatedHTML","truncate","html","visible","handleClick","expandedState","createElement","dangerouslySetInnerHTML","__html","Container","Fragment","Box","Clickable","cursor","textDecoration","onClick","Text","variant","fontWeight","as","style","displayName","styled","div","withConfig","componentId"],"sources":["../../../src/elements/ReadMore/ReadMore.tsx"],"sourcesContent":["import React, { useState } from \"react\"\nimport styled from \"styled-components\"\nimport truncate from \"trunc-html\"\nimport { Clickable } from \"../Clickable\"\nimport { Text } from \"../Text\"\nimport { Box } from \"../Box\"\n\nexport interface ReadMoreProps {\n content: string\n disabled?: boolean\n inlineReadMoreLink?: boolean\n isExpanded?: boolean\n maxChars?: number\n onReadLessClicked?: () => void\n onReadMoreClicked?: () => void\n}\n\n/** ReadMore */\nexport const ReadMore: React.FC<React.PropsWithChildren<ReadMoreProps>> = ({\n content: expandedHTML,\n disabled,\n inlineReadMoreLink = true,\n isExpanded,\n maxChars = Infinity,\n onReadLessClicked,\n onReadMoreClicked,\n}) => {\n const [expanded, setExpanded] = useState(!!isExpanded)\n\n if (typeof expandedHTML !== \"string\") return null\n\n const charCount = expandedHTML.replace(HTML_TAG_REGEX, \"\").length\n\n const truncatedHTML = truncate(expandedHTML, maxChars).html\n\n const visible = charCount > maxChars\n\n const handleClick = () => {\n if (disabled) return\n setExpanded((expandedState) => !expandedState)\n\n expanded\n ? onReadLessClicked && onReadLessClicked()\n : onReadMoreClicked && onReadMoreClicked()\n }\n\n if (!visible) {\n return (\n <span\n dangerouslySetInnerHTML={{\n __html: expandedHTML,\n }}\n />\n )\n }\n\n return (\n <Container aria-expanded={expanded}>\n {expanded ? (\n <>\n <Box dangerouslySetInnerHTML={{ __html: expandedHTML }} />\n\n <Clickable\n cursor=\"pointer\"\n textDecoration=\"underline\"\n onClick={handleClick}\n >\n <Text variant=\"xs\" fontWeight=\"bold\">\n Read less\n </Text>\n </Clickable>\n </>\n ) : (\n <Clickable onClick={handleClick}>\n {inlineReadMoreLink ? (\n <>\n <span dangerouslySetInnerHTML={{ __html: truncatedHTML }} />{\" \"}\n </>\n ) : (\n <Box dangerouslySetInnerHTML={{ __html: truncatedHTML }} />\n )}\n\n <Text\n as=\"span\"\n variant=\"xs\"\n fontWeight=\"bold\"\n style={{ textDecoration: \"underline\" }}\n >\n Read more\n </Text>\n </Clickable>\n )}\n </Container>\n )\n}\n\nconst Container = styled.div`\n > * > span > *:last-child {\n display: inherit;\n }\n`\n\nContainer.displayName = \"Container\"\n\nconst HTML_TAG_REGEX = /(<([^>]+)>)/gi\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,UAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,IAAA,GAAAN,OAAA;AAA4B,SAAAE,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,i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,MAAA,CAAAW,OAAA,CAAA4F,QAAA,qBACEvG,MAAA,CAAAW,OAAA,CAAAwF,aAAA;IAAMC,uBAAuB,EAAE;MAAEC,MAAM,EAAER;IAAc;EAAE,EAAG,EAAC,GAAG,CAC/D,gBAEH7F,MAAA,CAAAW,OAAA,CAAAwF,aAAA,CAAC3F,IAAA,CAAAgG,GAAG;IAACJ,uBAAuB,EAAE;MAAEC,MAAM,EAAER;IAAc;EAAE,EACzD,eAED7F,MAAA,CAAAW,OAAA,CAAAwF,aAAA,CAAC5F,KAAA,CAAAsG,IAAI;IACHG,EAAE,EAAC,MAAM;IACTF,OAAO,EAAC,IAAI;IACZC,UAAU,EAAC,MAAM;IACjBE,KAAK,EAAE;MAAEN,cAAc,EAAE;IAAY;EAAE,GACxC,WAED,CAAO,CAEV,CACS;AAEhB,CAAC;AA5EYpC,QAA0D,CAAA2C,WAAA;AA8EvE,IAAMZ,SAAS,GAAGa,yBAAM,CAACC,GAAG,CAAAC,UAAA;EAAAH,WAAA;EAAAI,WAAA;AAAA,mDAI3B;AAEDhB,SAAS,CAACY,WAAW,GAAG,WAAW;AAEnC,IAAMtB,cAAc,GAAG,eAAe"}
|
|
1
|
+
{"version":3,"file":"ReadMore.js","names":["_react","_interopRequireWildcard","require","_styledComponents","_interopRequireDefault","_Clickable","_Text","_Theme","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_extends","assign","bind","target","i","arguments","length","source","apply","_slicedToArray","arr","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","o","minLen","_arrayLikeToArray","n","toString","slice","constructor","name","Array","from","test","len","arr2","_i","Symbol","iterator","_s","_e","_x","_r","_arr","_n","_d","next","done","push","value","err","return","isArray","ReadMore","exports","_ref","expandedHTML","content","disabled","_ref$inlineReadMoreLi","inlineReadMoreLink","isExpanded","_ref$maxLines","maxLines","Infinity","onReadLessClicked","onReadMoreClicked","ref","useRef","_useTheme","useTheme","theme","_useState","useState","_useState2","isOverflowing","setIsOverflowing","_useState3","_useState4","singleLineHeight","setSingleLineHeight","_useState5","_useState6","expanded","setExpanded","maxLinesToShow","sentinelSpan","handleClick","expandedState","useEffect","current","scrollHeight","clientHeight","sentinel","querySelector","createElement","Container","LineClamp","lineClamp","dangerouslySetInnerHTML","__html","concat","Clickable","cursor","textDecoration","onClick","position","bottom","right","background","colors","mono0","space","pl","height","display","alignItems","justifyContent","Text","variant","fontWeight","displayName","styled","div","withConfig","componentId","props"],"sources":["../../../src/elements/ReadMore/ReadMore.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from \"react\"\nimport styled from \"styled-components\"\nimport { Clickable } from \"../Clickable\"\nimport { Text } from \"../Text\"\nimport { useTheme } from \"../../Theme\"\n\nexport interface ReadMoreProps {\n content: string\n disabled?: boolean\n inlineReadMoreLink?: boolean\n isExpanded?: boolean\n maxLines?: number\n onReadLessClicked?: () => void\n onReadMoreClicked?: () => void\n}\n\n/** ReadMore */\nexport const ReadMore: React.FC<React.PropsWithChildren<ReadMoreProps>> = ({\n content: expandedHTML,\n disabled,\n inlineReadMoreLink = true,\n isExpanded,\n maxLines = Infinity,\n onReadLessClicked,\n onReadMoreClicked,\n}) => {\n const ref = useRef<HTMLDivElement>(null)\n\n const { theme } = useTheme()\n\n const [isOverflowing, setIsOverflowing] = useState(false)\n const [singleLineHeight, setSingleLineHeight] = useState(0)\n const [expanded, setExpanded] = useState(!!isExpanded)\n\n const maxLinesToShow = expanded ? Infinity : maxLines\n const sentinelSpan = `<span data-readmore-sentinel aria-hidden=\"true\" style=\"display:inline-block;width:0;padding:0;margin:0;\">​</span>`\n\n if (typeof expandedHTML !== \"string\") return null\n\n const handleClick = () => {\n if (disabled) return\n\n setExpanded((expandedState) => !expandedState)\n\n expanded ? onReadLessClicked?.() : onReadMoreClicked?.()\n }\n\n useEffect(() => {\n if (!ref.current) return\n\n setIsOverflowing(ref.current.scrollHeight > ref.current.clientHeight)\n\n const sentinel = ref.current.querySelector(\"[data-readmore-sentinel]\")\n if (!sentinel) return\n\n setSingleLineHeight(sentinel.clientHeight)\n }, [])\n\n return (\n <Container aria-expanded={expanded}>\n <LineClamp\n ref={ref}\n lineClamp={maxLinesToShow}\n dangerouslySetInnerHTML={{\n __html: expanded ? expandedHTML : `${expandedHTML}${sentinelSpan}`,\n }}\n />\n\n {isOverflowing && (\n <Clickable\n cursor=\"pointer\"\n textDecoration=\"underline\"\n onClick={handleClick}\n {...(!expanded && inlineReadMoreLink\n ? {\n position: \"absolute\",\n bottom: 0,\n right: 0,\n background: `linear-gradient(to left, ${theme.colors.mono0} 0, ${theme.colors.mono0} calc(100% - ${theme.space[4]}), transparent 100%)`,\n pl: 4,\n height: singleLineHeight,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n }\n : {})}\n >\n <Text variant=\"xs\" fontWeight=\"bold\">\n Read {expanded ? \"less\" : \"more\"}\n </Text>\n </Clickable>\n )}\n </Container>\n )\n}\n\nconst Container = styled.div`\n position: relative;\n`\n\nContainer.displayName = \"Container\"\n\nconst LineClamp = styled.div<{ lineClamp: number }>`\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: ${(props) => props.lineClamp};\n line-clamp: ${(props) => props.lineClamp};\n overflow: hidden;\n`\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAAsC,SAAAE,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBA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AE,EAAE,CAAC;IACLC,MAAM,EAAEnC,gBAAgB;IACxBoC,OAAO,EAAE,MAAM;IACfC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB,CAAC,GACD,CAAC,CAAC,gBAEN7I,MAAA,CAAAU,OAAA,CAAA6G,aAAA,CAACjH,KAAA,CAAAwI,IAAI;IAACC,OAAO,EAAC,IAAI;IAACC,UAAU,EAAC;EAAM,GAAC,OAC9B,EAACrC,QAAQ,GAAG,MAAM,GAAG,MAAM,CAC3B,CAEV,CACS;AAEhB,CAAC;AA7EY9B,QAA0D,CAAAoE,WAAA;AA+EvE,IAAMzB,SAAS,GAAG0B,yBAAM,CAACC,GAAG,CAAAC,UAAA;EAAAH,WAAA;EAAAI,WAAA;AAAA,0BAE3B;AAED7B,SAAS,CAACyB,WAAW,GAAG,WAAW;AAEnC,IAAMxB,SAAS,GAAGyB,yBAAM,CAACC,GAAG,CAAAC,UAAA;EAAAH,WAAA;EAAAI,WAAA;AAAA,iHAGJ,UAACC,KAAK;EAAA,OAAKA,KAAK,CAAC5B,SAAS;AAAA,GAClC,UAAC4B,KAAK;EAAA,OAAKA,KAAK,CAAC5B,SAAS;AAAA,EAEzC"}
|
|
@@ -17,7 +17,7 @@ declare const _default: {
|
|
|
17
17
|
export default _default;
|
|
18
18
|
export declare const Default: {
|
|
19
19
|
args: {
|
|
20
|
-
|
|
20
|
+
maxLines: number;
|
|
21
21
|
content: string;
|
|
22
22
|
};
|
|
23
23
|
parameters: {
|
|
@@ -30,7 +30,7 @@ export declare const Default: {
|
|
|
30
30
|
};
|
|
31
31
|
export declare const ShortContent: {
|
|
32
32
|
args: {
|
|
33
|
-
|
|
33
|
+
maxLines: number;
|
|
34
34
|
content: string;
|
|
35
35
|
};
|
|
36
36
|
parameters: {
|
|
@@ -43,7 +43,7 @@ export declare const ShortContent: {
|
|
|
43
43
|
};
|
|
44
44
|
export declare const AsString: {
|
|
45
45
|
args: {
|
|
46
|
-
|
|
46
|
+
maxLines: number;
|
|
47
47
|
content: string;
|
|
48
48
|
};
|
|
49
49
|
parameters: {
|
|
@@ -56,7 +56,7 @@ export declare const AsString: {
|
|
|
56
56
|
};
|
|
57
57
|
export declare const CharacterCapWithHtml: {
|
|
58
58
|
args: {
|
|
59
|
-
|
|
59
|
+
maxLines: number;
|
|
60
60
|
content: string;
|
|
61
61
|
};
|
|
62
62
|
parameters: {
|
|
@@ -90,7 +90,7 @@ export declare const WithCustomizableTypography2: {
|
|
|
90
90
|
export declare const CharacterCapWithHtmlDisabled: {
|
|
91
91
|
args: {
|
|
92
92
|
disabled: boolean;
|
|
93
|
-
|
|
93
|
+
maxLines: number;
|
|
94
94
|
content: string;
|
|
95
95
|
};
|
|
96
96
|
parameters: {
|
|
@@ -27,7 +27,7 @@ var _default = exports.default = {
|
|
|
27
27
|
};
|
|
28
28
|
var Default = exports.Default = {
|
|
29
29
|
args: {
|
|
30
|
-
|
|
30
|
+
maxLines: 2,
|
|
31
31
|
content: "<div>\n Donald Judd, widely regarded as one of the most significant American\n artists of <a href=\"#\">the post-war period</a>, is perhaps best-known\n for the large-scale outdoor installations and long, spacious interiors\n he designed in Marfa. Donald Judd, widely regarded as one of the most\n significant American artists of the post-war period, is perhaps\n best-known for the large-scale outdoor installations and long,\n spacious interiors he designed in Marfa.\n </div>"
|
|
32
32
|
},
|
|
33
33
|
parameters: {
|
|
@@ -40,7 +40,7 @@ var Default = exports.Default = {
|
|
|
40
40
|
};
|
|
41
41
|
var ShortContent = exports.ShortContent = {
|
|
42
42
|
args: {
|
|
43
|
-
|
|
43
|
+
maxLines: 3,
|
|
44
44
|
content: "<div>\n Donald Judd, widely regarded as one of the most significant American\n artists of <a href=\"#\">the post-war period</a>.\n </div>"
|
|
45
45
|
},
|
|
46
46
|
parameters: {
|
|
@@ -53,7 +53,7 @@ var ShortContent = exports.ShortContent = {
|
|
|
53
53
|
};
|
|
54
54
|
var AsString = exports.AsString = {
|
|
55
55
|
args: {
|
|
56
|
-
|
|
56
|
+
maxLines: 2,
|
|
57
57
|
content: "Donald Judd, widely regarded as one of the most significant American artists of the post-war period, is perhaps best-known for the large-scale outdoor installations and long, spacious interiors he designed in Marfa. Donald Judd, widely regarded as one of the most significant American artists of the post-war period, is perhaps best-known for the large-scale outdoor installations and long, spacious interiors he designed in Marfa."
|
|
58
58
|
},
|
|
59
59
|
parameters: {
|
|
@@ -66,7 +66,7 @@ var AsString = exports.AsString = {
|
|
|
66
66
|
};
|
|
67
67
|
var CharacterCapWithHtml = exports.CharacterCapWithHtml = {
|
|
68
68
|
args: {
|
|
69
|
-
|
|
69
|
+
maxLines: 2,
|
|
70
70
|
content: "<p>\n Donald Judd, widely regarded as one of the most significant American\n artists of <a href=\"#\">the post-war period</a>, is perhaps\n best-known for the large-scale outdoor installations and long,\n spacious interiors he designed in Marfa. Donald Judd, widely\n regarded as one of the most significant American artists of the\n post-war period, is perhaps best-known for the large-scale outdoor\n installations and long, spacious interiors he designed in Marfa.\n </p>\n <hr />\n <p>\n <strong>Lorem ipsum dolor</strong> sit amet consectetur adipisicing\n elit. Ducimus eligendi obcaecati voluptate\n <em>molestias vero nobis voluptatum</em>, tenetur dolorum assumenda.\n </p>\n <p>\n Lorem ipsum dolor sit amet consectetur adipisicing elit. Debitis\n eveniet aliquid laborum fugiat quibusdam id suscipit est temporibus\n labore sint aliquam, laudantium tempore. Tenetur adipisci cumque\n alias facilis animi. Illum.\n </p>"
|
|
71
71
|
},
|
|
72
72
|
parameters: {
|
|
@@ -80,7 +80,7 @@ var CharacterCapWithHtml = exports.CharacterCapWithHtml = {
|
|
|
80
80
|
var WithCustomizableTypography = exports.WithCustomizableTypography = {
|
|
81
81
|
render: function render() {
|
|
82
82
|
return /*#__PURE__*/_react.default.createElement(_HTML.HTML, null, /*#__PURE__*/_react.default.createElement(_ReadMore.ReadMore, {
|
|
83
|
-
|
|
83
|
+
maxLines: 3,
|
|
84
84
|
content: "\n <p>\n Donald Judd, widely regarded as one of the most significant\n American artists of <a href=\"#\">the post-war period</a>, is\n perhaps best-known for the large-scale outdoor installations and\n long, spacious interiors he designed in Marfa. Donald Judd, widely\n regarded as one of the most significant American artists of the\n post-war period, is perhaps best-known for the large-scale outdoor\n installations and long, spacious interiors he designed in Marfa.\n </p>\n <hr />\n <p>\n <strong>Lorem ipsum dolor</strong> sit amet consectetur\n adipisicing elit. Ducimus eligendi obcaecati voluptate\n <em>molestias vero nobis voluptatum</em>, tenetur dolorum\n assumenda.\n </p>\n <p>\n Lorem ipsum dolor sit amet consectetur adipisicing elit. Debitis\n eveniet aliquid laborum fugiat quibusdam id suscipit est\n temporibus labore sint aliquam, laudantium tempore. Tenetur\n adipisci cumque alias facilis animi. Illum.\n </p>"
|
|
85
85
|
}));
|
|
86
86
|
},
|
|
@@ -97,7 +97,7 @@ var WithCustomizableTypography2 = exports.WithCustomizableTypography2 = {
|
|
|
97
97
|
return /*#__PURE__*/_react.default.createElement(_HTML.HTML, {
|
|
98
98
|
variant: "lg"
|
|
99
99
|
}, /*#__PURE__*/_react.default.createElement(_ReadMore.ReadMore, {
|
|
100
|
-
|
|
100
|
+
maxLines: 3,
|
|
101
101
|
content: "<p>\n Donald Judd, widely regarded as one of the most significant\n American artists of <a href=\"#\">the post-war period</a>, is\n perhaps best-known for the large-scale outdoor installations and\n long, spacious interiors he designed in Marfa. Donald Judd, widely\n regarded as one of the most significant American artists of the\n post-war period, is perhaps best-known for the large-scale outdoor\n installations and long, spacious interiors he designed in Marfa.\n </p>\n <hr />\n <p>\n <strong>Lorem ipsum dolor</strong> sit amet consectetur\n adipisicing elit. Ducimus eligendi obcaecati voluptate\n <em>molestias vero nobis voluptatum</em>, tenetur dolorum\n assumenda.\n </p>\n <p>\n Lorem ipsum dolor sit amet consectetur adipisicing elit. Debitis\n eveniet aliquid laborum fugiat quibusdam id suscipit est\n temporibus labore sint aliquam, laudantium tempore. Tenetur\n adipisci cumque alias facilis animi. Illum.\n </p>"
|
|
102
102
|
}));
|
|
103
103
|
},
|
|
@@ -112,7 +112,7 @@ var WithCustomizableTypography2 = exports.WithCustomizableTypography2 = {
|
|
|
112
112
|
var CharacterCapWithHtmlDisabled = exports.CharacterCapWithHtmlDisabled = {
|
|
113
113
|
args: {
|
|
114
114
|
disabled: true,
|
|
115
|
-
|
|
115
|
+
maxLines: 3,
|
|
116
116
|
content: "<div>\n Donald Judd, widely regarded as one of the most significant American\n artists of <a href=\"#\">the post-war period</a>, is perhaps best-known\n for the large-scale outdoor installations and long, spacious interiors\n he designed in Marfa. Donald Judd, widely regarded as one of the most\n significant American artists of the post-war period, is perhaps\n best-known for the large-scale outdoor installations and long,\n spacious interiors he designed in Marfa.\n </div>"
|
|
117
117
|
},
|
|
118
118
|
parameters: {
|
|
@@ -132,7 +132,7 @@ var WithBottomReadMore = exports.WithBottomReadMore = {
|
|
|
132
132
|
variant: "lg"
|
|
133
133
|
}, /*#__PURE__*/_react.default.createElement(_ReadMore.ReadMore, {
|
|
134
134
|
inlineReadMoreLink: false,
|
|
135
|
-
|
|
135
|
+
maxLines: 3,
|
|
136
136
|
content: "<div>\n Donald Judd, widely regarded as one of the most significant American\n artists of <a href=\"#\">the post-war period</a>, is perhaps best-known\n for the large-scale outdoor installations and long, spacious interiors\n he designed in Marfa. Donald Judd, widely regarded as one of the most\n significant American artists of the post-war period, is perhaps\n best-known for the large-scale outdoor installations and long,\n spacious interiors he designed in Marfa.\n </div>"
|
|
137
137
|
})));
|
|
138
138
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadMore.story.js","names":["_react","_interopRequireDefault","require","_HTML","_ReadMore","_Box","_storybookBlocklist","obj","__esModule","default","_default","exports","component","ReadMore","title","tags","parameters","docs","description","controls","exclude","STORYBOOK_PROPS_BLOCKLIST","Default","args","maxChars","content","story","ShortContent","AsString","CharacterCapWithHtml","WithCustomizableTypography","render","createElement","HTML","WithCustomizableTypography2","variant","CharacterCapWithHtmlDisabled","disabled","WithBottomReadMore","Box","textAlign","width","inlineReadMoreLink"],"sources":["../../../src/elements/ReadMore/ReadMore.story.tsx"],"sourcesContent":["import React from \"react\"\nimport { HTML } from \"../HTML\"\nimport { ReadMore } from \"./ReadMore\"\nimport { Box } from \"../Box\"\nimport { STORYBOOK_PROPS_BLOCKLIST } from \"../../utils/storybookBlocklist\"\n\nexport default {\n component: ReadMore,\n title: \"Components/ReadMore\",\n tags: [\"autodocs\"],\n parameters: {\n docs: {\n description: {\n component:\n \"A component that truncates content and provides a 'read more' link to expand the full content.\",\n },\n },\n controls: {\n exclude: STORYBOOK_PROPS_BLOCKLIST,\n },\n },\n}\n\nexport const Default = {\n args: {\n maxChars: 300,\n content: `<div>\n Donald Judd, widely regarded as one of the most significant American\n artists of <a href=\"#\">the post-war period</a>, is perhaps best-known\n for the large-scale outdoor installations and long, spacious interiors\n he designed in Marfa. Donald Judd, widely regarded as one of the most\n significant American artists of the post-war period, is perhaps\n best-known for the large-scale outdoor installations and long,\n spacious interiors he designed in Marfa.\n </div>`,\n },\n parameters: {\n docs: {\n description: {\n story: \"Read more component with character limit truncation.\",\n },\n },\n },\n}\n\nexport const ShortContent = {\n args: {\n maxChars: 300,\n content: `<div>\n Donald Judd, widely regarded as one of the most significant American\n artists of <a href=\"#\">the post-war period</a>.\n </div>`,\n },\n parameters: {\n docs: {\n description: {\n story: \"Read more with content shorter than the character limit.\",\n },\n },\n },\n}\n\nexport const AsString = {\n args: {\n maxChars: 300,\n content:\n \"Donald Judd, widely regarded as one of the most significant American artists of the post-war period, is perhaps best-known for the large-scale outdoor installations and long, spacious interiors he designed in Marfa. Donald Judd, widely regarded as one of the most significant American artists of the post-war period, is perhaps best-known for the large-scale outdoor installations and long, spacious interiors he designed in Marfa.\",\n },\n parameters: {\n docs: {\n description: {\n story: \"Read more with plain string content instead of HTML.\",\n },\n },\n },\n}\n\nexport const CharacterCapWithHtml = {\n args: {\n maxChars: 300,\n content: `<p>\n Donald Judd, widely regarded as one of the most significant American\n artists of <a href=\"#\">the post-war period</a>, is perhaps\n best-known for the large-scale outdoor installations and long,\n spacious interiors he designed in Marfa. Donald Judd, widely\n regarded as one of the most significant American artists of the\n post-war period, is perhaps best-known for the large-scale outdoor\n installations and long, spacious interiors he designed in Marfa.\n </p>\n <hr />\n <p>\n <strong>Lorem ipsum dolor</strong> sit amet consectetur adipisicing\n elit. Ducimus eligendi obcaecati voluptate\n <em>molestias vero nobis voluptatum</em>, tenetur dolorum assumenda.\n </p>\n <p>\n Lorem ipsum dolor sit amet consectetur adipisicing elit. Debitis\n eveniet aliquid laborum fugiat quibusdam id suscipit est temporibus\n labore sint aliquam, laudantium tempore. Tenetur adipisci cumque\n alias facilis animi. Illum.\n </p>`,\n },\n parameters: {\n docs: {\n description: {\n story: \"Character cap with HTML content.\",\n },\n },\n },\n}\n\nexport const WithCustomizableTypography = {\n render: () => (\n <HTML>\n <ReadMore\n maxChars={300}\n content={`\n <p>\n Donald Judd, widely regarded as one of the most significant\n American artists of <a href=\"#\">the post-war period</a>, is\n perhaps best-known for the large-scale outdoor installations and\n long, spacious interiors he designed in Marfa. Donald Judd, widely\n regarded as one of the most significant American artists of the\n post-war period, is perhaps best-known for the large-scale outdoor\n installations and long, spacious interiors he designed in Marfa.\n </p>\n <hr />\n <p>\n <strong>Lorem ipsum dolor</strong> sit amet consectetur\n adipisicing elit. Ducimus eligendi obcaecati voluptate\n <em>molestias vero nobis voluptatum</em>, tenetur dolorum\n assumenda.\n </p>\n <p>\n Lorem ipsum dolor sit amet consectetur adipisicing elit. Debitis\n eveniet aliquid laborum fugiat quibusdam id suscipit est\n temporibus labore sint aliquam, laudantium tempore. Tenetur\n adipisci cumque alias facilis animi. Illum.\n </p>`}\n />\n </HTML>\n ),\n parameters: {\n docs: {\n description: {\n story: \"ReadMore with customizable typography using HTML wrapper.\",\n },\n },\n },\n}\n\nexport const WithCustomizableTypography2 = {\n render: () => (\n <HTML variant=\"lg\">\n <ReadMore\n maxChars={300}\n content={`<p>\n Donald Judd, widely regarded as one of the most significant\n American artists of <a href=\"#\">the post-war period</a>, is\n perhaps best-known for the large-scale outdoor installations and\n long, spacious interiors he designed in Marfa. Donald Judd, widely\n regarded as one of the most significant American artists of the\n post-war period, is perhaps best-known for the large-scale outdoor\n installations and long, spacious interiors he designed in Marfa.\n </p>\n <hr />\n <p>\n <strong>Lorem ipsum dolor</strong> sit amet consectetur\n adipisicing elit. Ducimus eligendi obcaecati voluptate\n <em>molestias vero nobis voluptatum</em>, tenetur dolorum\n assumenda.\n </p>\n <p>\n Lorem ipsum dolor sit amet consectetur adipisicing elit. Debitis\n eveniet aliquid laborum fugiat quibusdam id suscipit est\n temporibus labore sint aliquam, laudantium tempore. Tenetur\n adipisci cumque alias facilis animi. Illum.\n </p>`}\n />\n </HTML>\n ),\n parameters: {\n docs: {\n description: {\n story:\n \"ReadMore with customizable large typography using HTML wrapper.\",\n },\n },\n },\n}\n\nexport const CharacterCapWithHtmlDisabled = {\n args: {\n disabled: true,\n maxChars: 300,\n content: `<div>\n Donald Judd, widely regarded as one of the most significant American\n artists of <a href=\"#\">the post-war period</a>, is perhaps best-known\n for the large-scale outdoor installations and long, spacious interiors\n he designed in Marfa. Donald Judd, widely regarded as one of the most\n significant American artists of the post-war period, is perhaps\n best-known for the large-scale outdoor installations and long,\n spacious interiors he designed in Marfa.\n </div>`,\n },\n parameters: {\n docs: {\n description: {\n story: \"Character cap with HTML content when disabled.\",\n },\n },\n },\n}\n\nexport const WithBottomReadMore = {\n render: () => (\n <Box textAlign=\"center\" width={600}>\n <HTML variant=\"lg\">\n <ReadMore\n inlineReadMoreLink={false}\n maxChars={280}\n content={`<div>\n Donald Judd, widely regarded as one of the most significant American\n artists of <a href=\"#\">the post-war period</a>, is perhaps best-known\n for the large-scale outdoor installations and long, spacious interiors\n he designed in Marfa. Donald Judd, widely regarded as one of the most\n significant American artists of the post-war period, is perhaps\n best-known for the large-scale outdoor installations and long,\n spacious interiors he designed in Marfa.\n </div>`}\n />\n </HTML>\n </Box>\n ),\n parameters: {\n docs: {\n description: {\n story: \"ReadMore with b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E,IAAI;IACdb,QAAQ,EAAE,GAAG;IACbC,OAAO;EAST,CAAC;EACDT,UAAU,EAAE;IACVC,IAAI,EAAE;MACJC,WAAW,EAAE;QACXQ,KAAK,EAAE;MACT;IACF;EACF;AACF,CAAC;AAEM,IAAMY,kBAAkB,GAAA3B,OAAA,CAAA2B,kBAAA,GAAG;EAChCP,MAAM,EAAE,SAARA,MAAMA,CAAA;IAAA,oBACJ/B,MAAA,CAAAS,OAAA,CAAAuB,aAAA,CAAC3B,IAAA,CAAAkC,GAAG;MAACC,SAAS,EAAC,QAAQ;MAACC,KAAK,EAAE;IAAI,gBACjCzC,MAAA,CAAAS,OAAA,CAAAuB,aAAA,CAAC7B,KAAA,CAAA8B,IAAI;MAACE,OAAO,EAAC;IAAI,gBAChBnC,MAAA,CAAAS,OAAA,CAAAuB,aAAA,CAAC5B,SAAA,CAAAS,QAAQ;MACP6B,kBAAkB,EAAE,KAAM;MAC1BlB,QAAQ,EAAE,GAAI;MACdC,OAAO;IAQD,EACN,CACG,CACH;EAAA,CACP;EACDT,UAAU,EAAE;IACVC,IAAI,EAAE;MACJC,WAAW,EAAE;QACXQ,KAAK,EAAE;MACT;IACF;EACF;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"ReadMore.story.js","names":["_react","_interopRequireDefault","require","_HTML","_ReadMore","_Box","_storybookBlocklist","obj","__esModule","default","_default","exports","component","ReadMore","title","tags","parameters","docs","description","controls","exclude","STORYBOOK_PROPS_BLOCKLIST","Default","args","maxLines","content","story","ShortContent","AsString","CharacterCapWithHtml","WithCustomizableTypography","render","createElement","HTML","WithCustomizableTypography2","variant","CharacterCapWithHtmlDisabled","disabled","WithBottomReadMore","Box","textAlign","width","inlineReadMoreLink"],"sources":["../../../src/elements/ReadMore/ReadMore.story.tsx"],"sourcesContent":["import React from \"react\"\nimport { HTML } from \"../HTML\"\nimport { ReadMore } from \"./ReadMore\"\nimport { Box } from \"../Box\"\nimport { STORYBOOK_PROPS_BLOCKLIST } from \"../../utils/storybookBlocklist\"\n\nexport default {\n component: ReadMore,\n title: \"Components/ReadMore\",\n tags: [\"autodocs\"],\n parameters: {\n docs: {\n description: {\n component:\n \"A component that truncates content and provides a 'read more' link to expand the full content.\",\n },\n },\n controls: {\n exclude: STORYBOOK_PROPS_BLOCKLIST,\n },\n },\n}\n\nexport const Default = {\n args: {\n maxLines: 2,\n content: `<div>\n Donald Judd, widely regarded as one of the most significant American\n artists of <a href=\"#\">the post-war period</a>, is perhaps best-known\n for the large-scale outdoor installations and long, spacious interiors\n he designed in Marfa. Donald Judd, widely regarded as one of the most\n significant American artists of the post-war period, is perhaps\n best-known for the large-scale outdoor installations and long,\n spacious interiors he designed in Marfa.\n </div>`,\n },\n parameters: {\n docs: {\n description: {\n story: \"Read more component with character limit truncation.\",\n },\n },\n },\n}\n\nexport const ShortContent = {\n args: {\n maxLines: 3,\n content: `<div>\n Donald Judd, widely regarded as one of the most significant American\n artists of <a href=\"#\">the post-war period</a>.\n </div>`,\n },\n parameters: {\n docs: {\n description: {\n story: \"Read more with content shorter than the character limit.\",\n },\n },\n },\n}\n\nexport const AsString = {\n args: {\n maxLines: 2,\n content:\n \"Donald Judd, widely regarded as one of the most significant American artists of the post-war period, is perhaps best-known for the large-scale outdoor installations and long, spacious interiors he designed in Marfa. Donald Judd, widely regarded as one of the most significant American artists of the post-war period, is perhaps best-known for the large-scale outdoor installations and long, spacious interiors he designed in Marfa.\",\n },\n parameters: {\n docs: {\n description: {\n story: \"Read more with plain string content instead of HTML.\",\n },\n },\n },\n}\n\nexport const CharacterCapWithHtml = {\n args: {\n maxLines: 2,\n content: `<p>\n Donald Judd, widely regarded as one of the most significant American\n artists of <a href=\"#\">the post-war period</a>, is perhaps\n best-known for the large-scale outdoor installations and long,\n spacious interiors he designed in Marfa. Donald Judd, widely\n regarded as one of the most significant American artists of the\n post-war period, is perhaps best-known for the large-scale outdoor\n installations and long, spacious interiors he designed in Marfa.\n </p>\n <hr />\n <p>\n <strong>Lorem ipsum dolor</strong> sit amet consectetur adipisicing\n elit. Ducimus eligendi obcaecati voluptate\n <em>molestias vero nobis voluptatum</em>, tenetur dolorum assumenda.\n </p>\n <p>\n Lorem ipsum dolor sit amet consectetur adipisicing elit. Debitis\n eveniet aliquid laborum fugiat quibusdam id suscipit est temporibus\n labore sint aliquam, laudantium tempore. Tenetur adipisci cumque\n alias facilis animi. Illum.\n </p>`,\n },\n parameters: {\n docs: {\n description: {\n story: \"Character cap with HTML content.\",\n },\n },\n },\n}\n\nexport const WithCustomizableTypography = {\n render: () => (\n <HTML>\n <ReadMore\n maxLines={3}\n content={`\n <p>\n Donald Judd, widely regarded as one of the most significant\n American artists of <a href=\"#\">the post-war period</a>, is\n perhaps best-known for the large-scale outdoor installations and\n long, spacious interiors he designed in Marfa. Donald Judd, widely\n regarded as one of the most significant American artists of the\n post-war period, is perhaps best-known for the large-scale outdoor\n installations and long, spacious interiors he designed in Marfa.\n </p>\n <hr />\n <p>\n <strong>Lorem ipsum dolor</strong> sit amet consectetur\n adipisicing elit. Ducimus eligendi obcaecati voluptate\n <em>molestias vero nobis voluptatum</em>, tenetur dolorum\n assumenda.\n </p>\n <p>\n Lorem ipsum dolor sit amet consectetur adipisicing elit. Debitis\n eveniet aliquid laborum fugiat quibusdam id suscipit est\n temporibus labore sint aliquam, laudantium tempore. Tenetur\n adipisci cumque alias facilis animi. Illum.\n </p>`}\n />\n </HTML>\n ),\n parameters: {\n docs: {\n description: {\n story: \"ReadMore with customizable typography using HTML wrapper.\",\n },\n },\n },\n}\n\nexport const WithCustomizableTypography2 = {\n render: () => (\n <HTML variant=\"lg\">\n <ReadMore\n maxLines={3}\n content={`<p>\n Donald Judd, widely regarded as one of the most significant\n American artists of <a href=\"#\">the post-war period</a>, is\n perhaps best-known for the large-scale outdoor installations and\n long, spacious interiors he designed in Marfa. Donald Judd, widely\n regarded as one of the most significant American artists of the\n post-war period, is perhaps best-known for the large-scale outdoor\n installations and long, spacious interiors he designed in Marfa.\n </p>\n <hr />\n <p>\n <strong>Lorem ipsum dolor</strong> sit amet consectetur\n adipisicing elit. Ducimus eligendi obcaecati voluptate\n <em>molestias vero nobis voluptatum</em>, tenetur dolorum\n assumenda.\n </p>\n <p>\n Lorem ipsum dolor sit amet consectetur adipisicing elit. Debitis\n eveniet aliquid laborum fugiat quibusdam id suscipit est\n temporibus labore sint aliquam, laudantium tempore. Tenetur\n adipisci cumque alias facilis animi. Illum.\n </p>`}\n />\n </HTML>\n ),\n parameters: {\n docs: {\n description: {\n story:\n \"ReadMore with customizable large typography using HTML wrapper.\",\n },\n },\n },\n}\n\nexport const CharacterCapWithHtmlDisabled = {\n args: {\n disabled: true,\n maxLines: 3,\n content: `<div>\n Donald Judd, widely regarded as one of the most significant American\n artists of <a href=\"#\">the post-war period</a>, is perhaps best-known\n for the large-scale outdoor installations and long, spacious interiors\n he designed in Marfa. Donald Judd, widely regarded as one of the most\n significant American artists of the post-war period, is perhaps\n best-known for the large-scale outdoor installations and long,\n spacious interiors he designed in Marfa.\n </div>`,\n },\n parameters: {\n docs: {\n description: {\n story: \"Character cap with HTML content when disabled.\",\n },\n },\n },\n}\n\nexport const WithBottomReadMore = {\n render: () => (\n <Box textAlign=\"center\" width={600}>\n <HTML variant=\"lg\">\n <ReadMore\n inlineReadMoreLink={false}\n maxLines={3}\n content={`<div>\n Donald Judd, widely regarded as one of the most significant American\n artists of <a href=\"#\">the post-war period</a>, is perhaps best-known\n for the large-scale outdoor installations and long, spacious interiors\n he designed in Marfa. Donald Judd, widely regarded as one of the most\n significant American artists of the post-war period, is perhaps\n best-known for the large-scale outdoor installations and long,\n spacious interiors he designed in Marfa.\n </div>`}\n />\n </HTML>\n </Box>\n ),\n parameters: {\n docs: {\n description: {\n story: \"ReadMore with bottom-placed 'Read More' link.\",\n },\n },\n },\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,O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AEM,IAAMY,kBAAkB,GAAA3B,OAAA,CAAA2B,kBAAA,GAAG;EAChCP,MAAM,EAAE,SAARA,MAAMA,CAAA;IAAA,oBACJ/B,MAAA,CAAAS,OAAA,CAAAuB,aAAA,CAAC3B,IAAA,CAAAkC,GAAG;MAACC,SAAS,EAAC,QAAQ;MAACC,KAAK,EAAE;IAAI,gBACjCzC,MAAA,CAAAS,OAAA,CAAAuB,aAAA,CAAC7B,KAAA,CAAA8B,IAAI;MAACE,OAAO,EAAC;IAAI,gBAChBnC,MAAA,CAAAS,OAAA,CAAAuB,aAAA,CAAC5B,SAAA,CAAAS,QAAQ;MACP6B,kBAAkB,EAAE,KAAM;MAC1BlB,QAAQ,EAAE,CAAE;MACZC,OAAO;IAQD,EACN,CACG,CACH;EAAA,CACP;EACDT,UAAU,EAAE;IACVC,IAAI,EAAE;MACJC,WAAW,EAAE;QACXQ,KAAK,EAAE;MACT;IACF;EACF;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@artsy/palette",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "45.0.0-canary.1472.32632.0",
|
|
4
4
|
"description": "Design system library for react components",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -191,5 +191,5 @@
|
|
|
191
191
|
"url": "http://localhost"
|
|
192
192
|
}
|
|
193
193
|
},
|
|
194
|
-
"gitHead": "
|
|
194
|
+
"gitHead": "6fd6954f5cbcfaaf8633ad5a5281d916573070b5"
|
|
195
195
|
}
|