@hh.ru/magritte-ui-text-list 1.1.42 → 1.1.44

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 CHANGED
@@ -1,8 +1,2 @@
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
- }
1
+ import type { TextListProps } from '@hh.ru/magritte-ui-text-list/types';
7
2
  export declare const TextList: React.FC<React.PropsWithChildren<TextListProps & JSX.IntrinsicElements[Required<TextListProps>['Element']]>>;
8
- export {};
package/TextList.js CHANGED
@@ -2,11 +2,15 @@ import './index.css';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { Children, cloneElement } from 'react';
4
4
  import classnames from 'classnames';
5
+ import { useTextListDefaultProps } from './defaultProps.js';
5
6
  import { Text, isTextElement } from '@hh.ru/magritte-ui-typography';
7
+ import '@hh.ru/magritte-internal-default-props-context';
6
8
 
7
- var styles = {"list":"magritte-list___cNNtz_1-1-42","paragraph-1-regular":"magritte-paragraph-1-regular___et3fO_1-1-42","paragraph1Regular":"magritte-paragraph-1-regular___et3fO_1-1-42","paragraph-2-regular":"magritte-paragraph-2-regular___KBhHQ_1-1-42","paragraph2Regular":"magritte-paragraph-2-regular___KBhHQ_1-1-42","paragraph-3-regular":"magritte-paragraph-3-regular___eyi5y_1-1-42","paragraph3Regular":"magritte-paragraph-3-regular___eyi5y_1-1-42","paragraph-4-regular":"magritte-paragraph-4-regular___zftoT_1-1-42","paragraph4Regular":"magritte-paragraph-4-regular___zftoT_1-1-42","numbered":"magritte-numbered___J770f_1-1-42","item":"magritte-item___kn-Qh_1-1-42","marker":"magritte-marker___r-3yT_1-1-42","marked":"magritte-marked___Fsh2t_1-1-42","content":"magritte-content___Zt8a6_1-1-42"};
9
+ var styles = {"list":"magritte-list___cNNtz_1-1-44","paragraph-1-regular":"magritte-paragraph-1-regular___et3fO_1-1-44","paragraph1Regular":"magritte-paragraph-1-regular___et3fO_1-1-44","paragraph-2-regular":"magritte-paragraph-2-regular___KBhHQ_1-1-44","paragraph2Regular":"magritte-paragraph-2-regular___KBhHQ_1-1-44","paragraph-3-regular":"magritte-paragraph-3-regular___eyi5y_1-1-44","paragraph3Regular":"magritte-paragraph-3-regular___eyi5y_1-1-44","paragraph-4-regular":"magritte-paragraph-4-regular___zftoT_1-1-44","paragraph4Regular":"magritte-paragraph-4-regular___zftoT_1-1-44","numbered":"magritte-numbered___J770f_1-1-44","item":"magritte-item___kn-Qh_1-1-44","marker":"magritte-marker___r-3yT_1-1-44","marked":"magritte-marked___Fsh2t_1-1-44","content":"magritte-content___Zt8a6_1-1-44"};
8
10
 
9
- const TextList = ({ Element = 'ul', children, typography = 'paragraph-2-regular' }) => {
11
+ const TextList = (props) => {
12
+ const defaultProps = useTextListDefaultProps();
13
+ const { Element = 'ul', children, typography = 'paragraph-2-regular' } = { ...defaultProps, ...props };
10
14
  return (jsx(Element, { className: classnames(styles.list, styles[typography], {
11
15
  [styles.marked]: Element === 'ul',
12
16
  [styles.numbered]: Element === 'ol',
package/TextList.js.map CHANGED
@@ -1 +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;;;;"}
1
+ {"version":3,"file":"TextList.js","sources":["src/TextList.tsx"],"sourcesContent":["import { Children, cloneElement } from 'react';\nimport classnames from 'classnames';\n\nimport { useTextListDefaultProps } from '@hh.ru/magritte-ui-text-list/defaultProps';\nimport type { TextListProps } from '@hh.ru/magritte-ui-text-list/types';\nimport { Text, isTextElement } from '@hh.ru/magritte-ui-typography';\n\nimport styles from './text-list.less';\n\nexport const TextList: React.FC<\n React.PropsWithChildren<TextListProps & JSX.IntrinsicElements[Required<TextListProps>['Element']]>\n> = (props) => {\n const defaultProps = useTextListDefaultProps();\n const { Element = 'ul', children, typography = 'paragraph-2-regular' } = { ...defaultProps, ...props };\n\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":";;;;;;;;;AASa,MAAA,QAAQ,GAEjB,CAAC,KAAK,KAAI;AACV,IAAA,MAAM,YAAY,GAAG,uBAAuB,EAAE,CAAC;AAC/C,IAAA,MAAM,EAAE,OAAO,GAAG,IAAI,EAAE,QAAQ,EAAE,UAAU,GAAG,qBAAqB,EAAE,GAAG,EAAE,GAAG,YAAY,EAAE,GAAG,KAAK,EAAE,CAAC;AAEvG,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;;;;"}
@@ -0,0 +1,3 @@
1
+ import type { TextListProps } from '@hh.ru/magritte-ui-text-list/types';
2
+ export declare const TextListDefaultPropsContext: import("react").FC<import("@hh.ru/magritte-internal-default-props-context").BoundDefaultPropsContextProps<TextListProps>>;
3
+ export declare const useTextListDefaultProps: () => Partial<TextListProps>;
@@ -0,0 +1,9 @@
1
+ import './index.css';
2
+ import { createDefaultPropsContext } from '@hh.ru/magritte-internal-default-props-context';
3
+
4
+ const { DefaultPropsContext, useDefaultProps } = createDefaultPropsContext('TextList');
5
+ const TextListDefaultPropsContext = DefaultPropsContext;
6
+ const useTextListDefaultProps = useDefaultProps;
7
+
8
+ export { TextListDefaultPropsContext, useTextListDefaultProps };
9
+ //# sourceMappingURL=defaultProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultProps.js","sources":["src/defaultProps.ts"],"sourcesContent":["import { createDefaultPropsContext } from '@hh.ru/magritte-internal-default-props-context';\nimport type { TextListProps } from '@hh.ru/magritte-ui-text-list/types';\n\nconst { DefaultPropsContext, useDefaultProps } = createDefaultPropsContext<TextListProps>('TextList');\n\nexport const TextListDefaultPropsContext = DefaultPropsContext;\n\nexport const useTextListDefaultProps = useDefaultProps;\n"],"names":[],"mappings":";;AAGA,MAAM,EAAE,mBAAmB,EAAE,eAAe,EAAE,GAAG,yBAAyB,CAAgB,UAAU,CAAC,CAAC;AAE/F,MAAM,2BAA2B,GAAG,oBAAoB;AAExD,MAAM,uBAAuB,GAAG;;;;"}
package/index.css CHANGED
@@ -1,52 +1,52 @@
1
- .magritte-list___cNNtz_1-1-42{
1
+ .magritte-list___cNNtz_1-1-44{
2
2
  display:grid;
3
3
  grid-template-columns:min-content auto;
4
4
  list-style-type:none;
5
5
  }
6
- .magritte-paragraph-1-regular___et3fO_1-1-42{
6
+ .magritte-paragraph-1-regular___et3fO_1-1-44{
7
7
  gap:12px 0;
8
8
  }
9
- .magritte-paragraph-2-regular___KBhHQ_1-1-42{
9
+ .magritte-paragraph-2-regular___KBhHQ_1-1-44{
10
10
  gap:8px 0;
11
11
  }
12
- .magritte-paragraph-3-regular___eyi5y_1-1-42{
12
+ .magritte-paragraph-3-regular___eyi5y_1-1-44{
13
13
  gap:8px 0;
14
14
  }
15
- .magritte-paragraph-4-regular___zftoT_1-1-42{
15
+ .magritte-paragraph-4-regular___zftoT_1-1-44{
16
16
  gap:8px 0;
17
17
  }
18
- .magritte-numbered___J770f_1-1-42{
18
+ .magritte-numbered___J770f_1-1-44{
19
19
  counter-set:list-counter;
20
20
  }
21
- .magritte-item___kn-Qh_1-1-42{
21
+ .magritte-item___kn-Qh_1-1-44{
22
22
  display:contents;
23
23
  }
24
- .magritte-marker___r-3yT_1-1-42{
24
+ .magritte-marker___r-3yT_1-1-44{
25
25
  display:block;
26
26
  text-align:right;
27
27
  padding:0 var(--list-marker-padding);
28
28
  }
29
- .magritte-marked___Fsh2t_1-1-42 .magritte-marker___r-3yT_1-1-42::before{
29
+ .magritte-marked___Fsh2t_1-1-44 .magritte-marker___r-3yT_1-1-44::before{
30
30
  content:'•';
31
31
  }
32
- .magritte-numbered___J770f_1-1-42 .magritte-marker___r-3yT_1-1-42{
32
+ .magritte-numbered___J770f_1-1-44 .magritte-marker___r-3yT_1-1-44{
33
33
  counter-increment:list-counter;
34
34
  }
35
- .magritte-numbered___J770f_1-1-42 .magritte-marker___r-3yT_1-1-42::before{
35
+ .magritte-numbered___J770f_1-1-44 .magritte-marker___r-3yT_1-1-44::before{
36
36
  content:counter(list-counter) '.';
37
37
  }
38
- .magritte-paragraph-1-regular___et3fO_1-1-42 .magritte-marker___r-3yT_1-1-42{
38
+ .magritte-paragraph-1-regular___et3fO_1-1-44 .magritte-marker___r-3yT_1-1-44{
39
39
  padding:0 10px;
40
40
  }
41
- .magritte-paragraph-2-regular___KBhHQ_1-1-42 .magritte-marker___r-3yT_1-1-42{
41
+ .magritte-paragraph-2-regular___KBhHQ_1-1-44 .magritte-marker___r-3yT_1-1-44{
42
42
  padding:0 9px;
43
43
  }
44
- .magritte-paragraph-3-regular___eyi5y_1-1-42 .magritte-marker___r-3yT_1-1-42{
44
+ .magritte-paragraph-3-regular___eyi5y_1-1-44 .magritte-marker___r-3yT_1-1-44{
45
45
  padding:0 8px;
46
46
  }
47
- .magritte-paragraph-4-regular___zftoT_1-1-42 .magritte-marker___r-3yT_1-1-42{
47
+ .magritte-paragraph-4-regular___zftoT_1-1-44 .magritte-marker___r-3yT_1-1-44{
48
48
  padding:0 7px;
49
49
  }
50
- .magritte-content___Zt8a6_1-1-42{
50
+ .magritte-content___Zt8a6_1-1-44{
51
51
  display:block;
52
52
  }
package/index.d.ts CHANGED
@@ -1 +1,3 @@
1
- export * from '@hh.ru/magritte-ui-text-list/TextList';
1
+ export { TextList } from '@hh.ru/magritte-ui-text-list/TextList';
2
+ export { TextListDefaultPropsContext } from '@hh.ru/magritte-ui-text-list/defaultProps';
3
+ export { type TextListProps } from '@hh.ru/magritte-ui-text-list/types';
package/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  import './index.css';
2
2
  export { TextList } from './TextList.js';
3
+ export { TextListDefaultPropsContext } from './defaultProps.js';
3
4
  import 'react/jsx-runtime';
4
5
  import 'react';
5
6
  import 'classnames';
6
7
  import '@hh.ru/magritte-ui-typography';
8
+ import '@hh.ru/magritte-internal-default-props-context';
7
9
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
package/index.mock.d.ts CHANGED
@@ -1,2 +1,4 @@
1
1
  import { FC } from 'react';
2
+ export * from '@hh.ru/magritte-ui-text-list/types';
2
3
  export declare const TextList: FC<Record<string, unknown>>;
4
+ export { TextListDefaultPropsContext } from '@hh.ru/magritte-ui-text-list/defaultProps';
package/index.mock.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import './index.css';
2
2
  import { mockComponent } from '@hh.ru/magritte-ui-mock-component';
3
+ export { TextListDefaultPropsContext } from './defaultProps.js';
4
+ import '@hh.ru/magritte-internal-default-props-context';
3
5
 
4
6
  const TextList = mockComponent('TextList', undefined, {
5
7
  withChildren: true,
package/index.mock.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.mock.js","sources":["src/index.mock.ts"],"sourcesContent":["import { FC } from 'react';\n\nimport { mockComponent } from '@hh.ru/magritte-ui-mock-component';\n\nexport const TextList: FC<Record<string, unknown>> = mockComponent('TextList', undefined, {\n withChildren: true,\n});\n"],"names":[],"mappings":";;MAIa,QAAQ,GAAgC,aAAa,CAAC,UAAU,EAAE,SAAS,EAAE;AACtF,IAAA,YAAY,EAAE,IAAI;AACrB,CAAA;;;;"}
1
+ {"version":3,"file":"index.mock.js","sources":["src/index.mock.ts"],"sourcesContent":["import { FC } from 'react';\n\nimport { mockComponent } from '@hh.ru/magritte-ui-mock-component';\n\nexport * from '@hh.ru/magritte-ui-text-list/types';\n\nexport const TextList: FC<Record<string, unknown>> = mockComponent('TextList', undefined, {\n withChildren: true,\n});\n\nexport { TextListDefaultPropsContext } from '@hh.ru/magritte-ui-text-list/defaultProps';\n"],"names":[],"mappings":";;;;MAMa,QAAQ,GAAgC,aAAa,CAAC,UAAU,EAAE,SAAS,EAAE;AACtF,IAAA,YAAY,EAAE,IAAI;AACrB,CAAA;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hh.ru/magritte-ui-text-list",
3
- "version": "1.1.42",
3
+ "version": "1.1.44",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "sideEffects": [
@@ -19,8 +19,9 @@
19
19
  "watch": "yarn root:watch $(pwd)"
20
20
  },
21
21
  "dependencies": {
22
+ "@hh.ru/magritte-internal-default-props-context": "1.0.2",
22
23
  "@hh.ru/magritte-ui-mock-component": "1.1.7",
23
- "@hh.ru/magritte-ui-typography": "5.3.10"
24
+ "@hh.ru/magritte-ui-typography": "5.3.11"
24
25
  },
25
26
  "peerDependencies": {
26
27
  "classnames": ">=2.3.2",
@@ -29,5 +30,5 @@
29
30
  "publishConfig": {
30
31
  "access": "public"
31
32
  },
32
- "gitHead": "8b57ec2cfaa40d2fb16738d26166f47bfb44b208"
33
+ "gitHead": "08aac121ba96883fe09737d35cee6bde2263e3b7"
33
34
  }
package/types.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ import type { TextTypography } from '@hh.ru/magritte-ui-typography';
2
+ type Paragraph<Typography> = Typography extends `paragraph-${string}` ? Typography : never;
3
+ export interface TextListProps {
4
+ /** @default ul */
5
+ Element?: 'ul' | 'ol';
6
+ /** @default paragraph-2-regular */
7
+ typography?: Paragraph<TextTypography>;
8
+ }
9
+ export {};
package/types.js ADDED
@@ -0,0 +1,3 @@
1
+ import './index.css';
2
+
3
+ //# sourceMappingURL=types.js.map
package/types.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}