@hh.ru/magritte-ui-text-list 1.1.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/TextList.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { TextTypography } from '@hh.ru/magritte-ui-typography';
2
+ type Paragraph<Typography> = Typography extends `paragraph-${string}` ? Typography : never;
3
+ export interface TextListProps {
4
+ Element?: 'ul' | 'ol';
5
+ typography?: Paragraph<TextTypography>;
6
+ }
7
+ export declare const TextList: React.FC<React.PropsWithChildren<TextListProps & JSX.IntrinsicElements[Required<TextListProps>['Element']]>>;
8
+ export {};
package/TextList.js ADDED
@@ -0,0 +1,21 @@
1
+ import './index.css';
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { Children, cloneElement } from 'react';
4
+ import classnames from 'classnames';
5
+ import { Text, isTextElement } from '@hh.ru/magritte-ui-typography';
6
+
7
+ var styles = {"list":"magritte-list___cNNtz_1-1-0","paragraph-1-regular":"magritte-paragraph-1-regular___et3fO_1-1-0","paragraph1Regular":"magritte-paragraph-1-regular___et3fO_1-1-0","paragraph-2-regular":"magritte-paragraph-2-regular___KBhHQ_1-1-0","paragraph2Regular":"magritte-paragraph-2-regular___KBhHQ_1-1-0","paragraph-3-regular":"magritte-paragraph-3-regular___eyi5y_1-1-0","paragraph3Regular":"magritte-paragraph-3-regular___eyi5y_1-1-0","paragraph-4-regular":"magritte-paragraph-4-regular___zftoT_1-1-0","paragraph4Regular":"magritte-paragraph-4-regular___zftoT_1-1-0","numbered":"magritte-numbered___J770f_1-1-0","item":"magritte-item___kn-Qh_1-1-0","marker":"magritte-marker___r-3yT_1-1-0","marked":"magritte-marked___Fsh2t_1-1-0","content":"magritte-content___Zt8a6_1-1-0"};
8
+
9
+ const TextList = ({ Element = 'ul', children, typography = 'paragraph-2-regular' }) => {
10
+ return (jsx(Element, { className: classnames(styles.list, styles[typography], {
11
+ [styles.marked]: Element === 'ul',
12
+ [styles.numbered]: Element === 'ol',
13
+ }), children: Children.map(children, (child) => {
14
+ return (jsxs("li", { className: styles.item, children: [jsx(Text, { typography: typography, children: jsx("div", { className: styles.marker }) }), jsx("div", { className: styles.content, children: isTextElement(child) && !('typography' in child.props)
15
+ ? cloneElement(child, { typography })
16
+ : child })] }));
17
+ }) }));
18
+ };
19
+
20
+ export { TextList };
21
+ //# sourceMappingURL=TextList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextList.js","sources":["../src/TextList.tsx"],"sourcesContent":["import { Children, cloneElement } from 'react';\nimport classnames from 'classnames';\n\nimport { Text, TextTypography, isTextElement } from '@hh.ru/magritte-ui-typography';\n\nimport styles from './text-list.less';\n\ntype Paragraph<Typography> = Typography extends `paragraph-${string}` ? Typography : never;\n\nexport interface TextListProps {\n Element?: 'ul' | 'ol';\n typography?: Paragraph<TextTypography>;\n}\n\nexport const TextList: React.FC<\n React.PropsWithChildren<TextListProps & JSX.IntrinsicElements[Required<TextListProps>['Element']]>\n> = ({ Element = 'ul', children, typography = 'paragraph-2-regular' }) => {\n return (\n <Element\n className={classnames(styles.list, styles[typography], {\n [styles.marked]: Element === 'ul',\n [styles.numbered]: Element === 'ol',\n })}\n >\n {Children.map(children, (child) => {\n return (\n <li className={styles.item}>\n <Text typography={typography}>\n <div className={styles.marker} />\n </Text>\n <div className={styles.content}>\n {isTextElement(child) && !('typography' in child.props)\n ? cloneElement(child, { typography })\n : child}\n </div>\n </li>\n );\n })}\n </Element>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;AAca,MAAA,QAAQ,GAEjB,CAAC,EAAE,OAAO,GAAG,IAAI,EAAE,QAAQ,EAAE,UAAU,GAAG,qBAAqB,EAAE,KAAI;AACrE,IAAA,QACIA,GAAC,CAAA,OAAO,EACJ,EAAA,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC,EAAE;AACnD,YAAA,CAAC,MAAM,CAAC,MAAM,GAAG,OAAO,KAAK,IAAI;AACjC,YAAA,CAAC,MAAM,CAAC,QAAQ,GAAG,OAAO,KAAK,IAAI;SACtC,CAAC,EAAA,QAAA,EAED,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,KAAI;AAC9B,YAAA,QACIC,IAAI,CAAA,IAAA,EAAA,EAAA,SAAS,EAAE,MAAM,CAAC,IAAI,EACtB,QAAA,EAAA,CAAAD,GAAA,CAAC,IAAI,EAAC,EAAA,UAAU,EAAE,UAAU,EAAA,QAAA,EACxBA,aAAK,SAAS,EAAE,MAAM,CAAC,MAAM,GAAI,EAC9B,CAAA,EACPA,aAAK,SAAS,EAAE,MAAM,CAAC,OAAO,YACzB,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,YAAY,IAAI,KAAK,CAAC,KAAK,CAAC;8BACjD,YAAY,CAAC,KAAK,EAAE,EAAE,UAAU,EAAE,CAAC;AACrC,8BAAE,KAAK,EACT,CAAA,CAAA,EAAA,CACL,EACP;SACL,CAAC,EACI,CAAA,EACZ;AACN;;;;"}
package/index.css ADDED
@@ -0,0 +1,56 @@
1
+ :root{
2
+ --magritte-static-space-200-v22-1-0:8px;
3
+ --magritte-static-space-300-v22-1-0:12px;
4
+ }
5
+ .magritte-list___cNNtz_1-1-0{
6
+ display:grid;
7
+ grid-template-columns:min-content auto;
8
+ list-style-type:none;
9
+ }
10
+ .magritte-paragraph-1-regular___et3fO_1-1-0{
11
+ gap:var(--magritte-static-space-300-v22-1-0) 0;
12
+ }
13
+ .magritte-paragraph-2-regular___KBhHQ_1-1-0{
14
+ gap:var(--magritte-static-space-200-v22-1-0) 0;
15
+ }
16
+ .magritte-paragraph-3-regular___eyi5y_1-1-0{
17
+ gap:var(--magritte-static-space-200-v22-1-0) 0;
18
+ }
19
+ .magritte-paragraph-4-regular___zftoT_1-1-0{
20
+ gap:var(--magritte-static-space-200-v22-1-0) 0;
21
+ }
22
+ .magritte-numbered___J770f_1-1-0{
23
+ counter-set:list-counter;
24
+ }
25
+ .magritte-item___kn-Qh_1-1-0{
26
+ display:contents;
27
+ }
28
+ .magritte-marker___r-3yT_1-1-0{
29
+ display:block;
30
+ text-align:right;
31
+ padding:0 var(--list-marker-padding);
32
+ }
33
+ .magritte-marked___Fsh2t_1-1-0 .magritte-marker___r-3yT_1-1-0::before{
34
+ content:'•';
35
+ }
36
+ .magritte-numbered___J770f_1-1-0 .magritte-marker___r-3yT_1-1-0{
37
+ counter-increment:list-counter;
38
+ }
39
+ .magritte-numbered___J770f_1-1-0 .magritte-marker___r-3yT_1-1-0::before{
40
+ content:counter(list-counter) '.';
41
+ }
42
+ .magritte-paragraph-1-regular___et3fO_1-1-0 .magritte-marker___r-3yT_1-1-0{
43
+ padding:0 10px;
44
+ }
45
+ .magritte-paragraph-2-regular___KBhHQ_1-1-0 .magritte-marker___r-3yT_1-1-0{
46
+ padding:0 9px;
47
+ }
48
+ .magritte-paragraph-3-regular___eyi5y_1-1-0 .magritte-marker___r-3yT_1-1-0{
49
+ padding:0 8px;
50
+ }
51
+ .magritte-paragraph-4-regular___zftoT_1-1-0 .magritte-marker___r-3yT_1-1-0{
52
+ padding:0 7px;
53
+ }
54
+ .magritte-content___Zt8a6_1-1-0{
55
+ display:block;
56
+ }
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from '@hh.ru/magritte-ui-text-list/TextList';
package/index.js ADDED
@@ -0,0 +1,7 @@
1
+ import './index.css';
2
+ export { TextList } from './TextList.js';
3
+ import 'react/jsx-runtime';
4
+ import 'react';
5
+ import 'classnames';
6
+ import '@hh.ru/magritte-ui-typography';
7
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@hh.ru/magritte-ui-text-list",
3
+ "version": "1.1.0",
4
+ "main": "index.js",
5
+ "types": "index.d.ts",
6
+ "sideEffects": [
7
+ "index.css"
8
+ ],
9
+ "scripts": {
10
+ "build": "yarn root:build $(pwd)",
11
+ "build-test-branch": "yarn root:build-test-branch $(pwd)",
12
+ "prepack": "yarn root:prepack $(pwd)",
13
+ "postpublish": "yarn root:postpublish $(pwd)",
14
+ "stylelint-check": "yarn root:stylelint-check $(pwd)",
15
+ "eslint-check": "yarn root:eslint-check $(pwd)",
16
+ "ts-config": "yarn root:ts-config $(pwd)",
17
+ "ts-check": "yarn root:ts-check $(pwd)",
18
+ "test": "yarn root:test $(pwd)",
19
+ "watch": "yarn root:watch $(pwd)"
20
+ },
21
+ "dependencies": {
22
+ "@hh.ru/magritte-ui-mock-component": "1.1.4",
23
+ "@hh.ru/magritte-ui-typography": "4.1.0"
24
+ },
25
+ "peerDependencies": {
26
+ "classnames": ">=2.3.2",
27
+ "react": ">=18.2.0"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "gitHead": "89aedbfa1b7f5abf2a91ce8a543286e75a78385f"
33
+ }