@alfalab/core-components-list 4.0.1-snapshot-c2c8d5a → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Component.d.ts +4 -31
- package/Component.js +3 -3
- package/Component.js.map +1 -1
- package/components/item/Component.d.ts +1 -1
- package/components/item/Component.js +2 -2
- package/components/item/Component.js.map +1 -1
- package/components/item/index.css +11 -11
- package/components/item/index.module.css.js +1 -1
- package/components/item/index.module.css.js.map +1 -1
- package/context.d.ts +30 -0
- package/context.js +10 -0
- package/context.js.map +1 -0
- package/cssm/Component.d.ts +4 -31
- package/cssm/Component.js +3 -3
- package/cssm/Component.js.map +1 -1
- package/cssm/components/item/Component.d.ts +1 -1
- package/cssm/components/item/Component.js +2 -2
- package/cssm/components/item/Component.js.map +1 -1
- package/cssm/components/item/index.module.css +2 -2
- package/cssm/context.d.ts +30 -0
- package/cssm/context.js +10 -0
- package/cssm/context.js.map +1 -0
- package/cssm/index.js +2 -1
- package/cssm/index.js.map +1 -1
- package/cssm/index.module.css +1 -1
- package/cssm/types.d.ts +1 -0
- package/cssm/types.js +3 -0
- package/cssm/types.js.map +1 -0
- package/cssm/utils.d.ts +1 -1
- package/cssm/utils.js.map +1 -1
- package/esm/Component.d.ts +4 -31
- package/esm/Component.js +1 -1
- package/esm/Component.js.map +1 -1
- package/esm/components/item/Component.d.ts +1 -1
- package/esm/components/item/Component.js +1 -1
- package/esm/components/item/Component.js.map +1 -1
- package/esm/components/item/index.css +11 -11
- package/esm/components/item/index.module.css.js +1 -1
- package/esm/components/item/index.module.css.js.map +1 -1
- package/esm/context.d.ts +30 -0
- package/esm/context.js +6 -0
- package/esm/context.js.map +1 -0
- package/esm/index.css +6 -6
- package/esm/index.js +2 -1
- package/esm/index.js.map +1 -1
- package/esm/index.module.css.js +1 -1
- package/esm/index.module.css.js.map +1 -1
- package/esm/types.d.ts +1 -0
- package/esm/types.js +2 -0
- package/esm/types.js.map +1 -0
- package/esm/utils.d.ts +1 -1
- package/esm/utils.js.map +1 -1
- package/index.css +6 -6
- package/index.js +2 -1
- package/index.js.map +1 -1
- package/index.module.css.js +1 -1
- package/index.module.css.js.map +1 -1
- package/modern/Component.d.ts +4 -31
- package/modern/Component.js +1 -1
- package/modern/Component.js.map +1 -1
- package/modern/components/item/Component.d.ts +1 -1
- package/modern/components/item/Component.js +1 -1
- package/modern/components/item/Component.js.map +1 -1
- package/modern/components/item/index.css +11 -11
- package/modern/components/item/index.module.css.js +1 -1
- package/modern/components/item/index.module.css.js.map +1 -1
- package/modern/context.d.ts +30 -0
- package/modern/context.js +6 -0
- package/modern/context.js.map +1 -0
- package/modern/index.css +6 -6
- package/modern/index.js +2 -1
- package/modern/index.js.map +1 -1
- package/modern/index.module.css.js +1 -1
- package/modern/index.module.css.js.map +1 -1
- package/modern/types.d.ts +1 -0
- package/modern/types.js +2 -0
- package/modern/types.js.map +1 -0
- package/modern/utils.d.ts +1 -1
- package/modern/utils.js.map +1 -1
- package/moderncssm/Component.d.ts +4 -31
- package/moderncssm/Component.js +1 -1
- package/moderncssm/Component.js.map +1 -1
- package/moderncssm/components/item/Component.d.ts +1 -1
- package/moderncssm/components/item/Component.js +1 -1
- package/moderncssm/components/item/Component.js.map +1 -1
- package/moderncssm/components/item/index.module.css +4 -2
- package/moderncssm/context.d.ts +30 -0
- package/moderncssm/context.js +6 -0
- package/moderncssm/context.js.map +1 -0
- package/moderncssm/index.js +2 -1
- package/moderncssm/index.js.map +1 -1
- package/moderncssm/index.module.css +3 -1
- package/moderncssm/types.d.ts +1 -0
- package/moderncssm/types.js +2 -0
- package/moderncssm/types.js.map +1 -0
- package/moderncssm/utils.d.ts +1 -1
- package/moderncssm/utils.js.map +1 -1
- package/package.json +4 -4
- package/src/Component.tsx +4 -48
- package/src/components/item/Component.tsx +2 -2
- package/src/components/item/index.module.css +1 -1
- package/src/context.ts +38 -0
- package/src/index.module.css +1 -1
- package/src/types.ts +12 -0
- package/src/utils.ts +1 -1
- package/types.d.ts +1 -0
- package/types.js +3 -0
- package/types.js.map +1 -0
- package/utils.d.ts +1 -1
- package/utils.js.map +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type ColorMarkerType = 'tertiary' | 'accent' | 'primary' | 'attention' | 'positive' | 'secondary' | 'tertiary-inverted' | 'primary-inverted' | 'secondary-inverted' | 'link' | 'negative';
|
package/modern/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/modern/utils.d.ts
CHANGED
package/modern/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["import { isValidElement, ReactNode } from 'react';\n\nexport const isItemElement = (obj: JSX.Element, name?: string): boolean =>\n typeof obj === 'object' && obj.type.displayName === name;\n\nexport const isItem = (child: ReactNode) =>\n isValidElement(child) && isItemElement(child, 'ListItem');\n"],"names":[],"mappings":";;MAEa,aAAa,GAAG,CAAC,GAAgB,EAAE,IAAa,KACzD,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,CAAC,WAAW,KAAK;MAE3C,MAAM,GAAG,CAAC,KAAgB,KACnC,cAAc,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,KAAK,EAAE,UAAU;;;;"}
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["import { isValidElement, type ReactNode } from 'react';\n\nexport const isItemElement = (obj: JSX.Element, name?: string): boolean =>\n typeof obj === 'object' && obj.type.displayName === name;\n\nexport const isItem = (child: ReactNode) =>\n isValidElement(child) && isItemElement(child, 'ListItem');\n"],"names":[],"mappings":";;MAEa,aAAa,GAAG,CAAC,GAAgB,EAAE,IAAa,KACzD,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,CAAC,WAAW,KAAK;MAE3C,MAAM,GAAG,CAAC,KAAgB,KACnC,cAAc,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,KAAK,EAAE,UAAU;;;;"}
|
|
@@ -1,33 +1,7 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
|
-
orderedList?: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Маркер
|
|
9
|
-
* @default '–' for ul and 'decimal' for ol
|
|
10
|
-
*/
|
|
11
|
-
markerType?: 'lower-alpha' | 'decimal' | string | ReactNode;
|
|
12
|
-
/**
|
|
13
|
-
* Цвет маркера
|
|
14
|
-
*/
|
|
15
|
-
colorMarker?: ColorMarkerType;
|
|
16
|
-
/**
|
|
17
|
-
* Список обратного счета
|
|
18
|
-
*/
|
|
19
|
-
reversed?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Номер пункта
|
|
22
|
-
*/
|
|
23
|
-
index?: number;
|
|
24
|
-
/**
|
|
25
|
-
* Начало отсчета элементов списка
|
|
26
|
-
*/
|
|
27
|
-
start?: number;
|
|
28
|
-
};
|
|
29
|
-
export declare const ListContext: React.Context<TListContext>;
|
|
30
|
-
declare type ColorMarkerType = 'tertiary' | 'accent' | 'primary' | 'attention' | 'positive' | 'secondary' | 'tertiary-inverted' | 'primary-inverted' | 'secondary-inverted' | 'link' | 'negative';
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
import { ListContext, type TListContext } from './context';
|
|
3
|
+
import { type ColorMarkerType } from './types';
|
|
4
|
+
export { ListContext, type TListContext };
|
|
31
5
|
export declare type ListProps = {
|
|
32
6
|
/**
|
|
33
7
|
* HTML тег
|
|
@@ -67,4 +41,3 @@ export declare type ListProps = {
|
|
|
67
41
|
export declare const List: React.FC<ListProps> & {
|
|
68
42
|
Item: React.FC<import("./components/item").ItemProps>;
|
|
69
43
|
};
|
|
70
|
-
export {};
|
package/moderncssm/Component.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { Children } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import { Item } from './components/item/Component.js';
|
|
4
|
+
import { ListContext } from './context.js';
|
|
4
5
|
import { isItem } from './utils.js';
|
|
5
6
|
import styles from './index.module.css';
|
|
6
7
|
|
|
7
|
-
const ListContext = React.createContext({});
|
|
8
8
|
const ListComponent = ({ tag = 'ul', marker, className, dataTestId, colorMarker, children, reversed, start, ...restProps }) => {
|
|
9
9
|
const markerType = marker || (tag === 'ul' ? '–' : 'decimal');
|
|
10
10
|
const alphaMarker = markerType === 'lower-alpha';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../src/Component.tsx"],"sourcesContent":["import React, { Children, ReactNode } from 'react';\nimport cn from 'classnames';\n\nimport { Item } from './components/item';\nimport {
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["../src/Component.tsx"],"sourcesContent":["import React, { Children, type ReactNode } from 'react';\nimport cn from 'classnames';\n\nimport { Item } from './components/item';\nimport { ListContext, type TListContext } from './context';\nimport { type ColorMarkerType } from './types';\nimport { isItem } from './utils';\n\nimport styles from './index.module.css';\n\nexport { ListContext, type TListContext };\n\nexport type ListProps = {\n /**\n * HTML тег\n * @default 'ul'\n */\n tag?: 'ul' | 'ol';\n\n /**\n * Маркер\n * @default '–' for ul and 'decimal' for ol\n */\n marker?: 'lower-alpha' | 'decimal' | string | ReactNode;\n\n /**\n * Css-класс для стилизации\n */\n className?: string;\n\n /**\n * Цвет маркера\n */\n colorMarker?: ColorMarkerType;\n\n /**\n * Список обратного счета\n */\n reversed?: boolean;\n\n /**\n * Начало отсчета элементов списка\n */\n start?: number;\n\n /**\n * Id компонента для тестов\n */\n dataTestId?: string;\n\n /**\n * Дочерние элементы\n */\n children?: ReactNode;\n} & Omit<React.OlHTMLAttributes<HTMLOListElement>, 'type'>;\n\nconst ListComponent: React.FC<ListProps> = ({\n tag = 'ul',\n marker,\n className,\n dataTestId,\n colorMarker,\n children,\n reversed,\n start,\n ...restProps\n}) => {\n const markerType = marker || (tag === 'ul' ? '–' : 'decimal');\n const alphaMarker = markerType === 'lower-alpha';\n const decimalMarker = markerType === 'decimal';\n const Component = tag === 'ul' || alphaMarker ? 'ul' : 'ol';\n\n const orderedList = Component === 'ol';\n\n const listClassNames = cn(\n styles.list,\n {\n [styles.lowerAlpha]: alphaMarker,\n [styles.decimal]: decimalMarker,\n [styles.reversed]: reversed,\n },\n className,\n );\n\n /* eslint-disable react/jsx-no-constructed-context-values */\n return (\n <Component className={listClassNames} data-test-id={dataTestId} {...restProps}>\n {Children.map(children, (child, index) => (\n <ListContext.Provider\n value={{ orderedList, markerType, colorMarker, reversed, index, start }}\n >\n {isItem(child) ? child : <Item>{child}</Item>}\n </ListContext.Provider>\n ))}\n </Component>\n );\n};\n\nexport const List = Object.assign(ListComponent, {\n Item,\n});\n"],"names":[],"mappings":";;;;;;;AAwDA,MAAM,aAAa,GAAwB,CAAC,EACxC,GAAG,GAAG,IAAI,EACV,MAAM,EACN,SAAS,EACT,UAAU,EACV,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,GAAG,SAAS,EACf,KAAI;AACD,IAAA,MAAM,UAAU,GAAG,MAAM,KAAK,GAAG,KAAK,IAAI,GAAG,GAAG,GAAG,SAAS,CAAC;AAC7D,IAAA,MAAM,WAAW,GAAG,UAAU,KAAK,aAAa;AAChD,IAAA,MAAM,aAAa,GAAG,UAAU,KAAK,SAAS;AAC9C,IAAA,MAAM,SAAS,GAAG,GAAG,KAAK,IAAI,IAAI,WAAW,GAAG,IAAI,GAAG,IAAI;AAE3D,IAAA,MAAM,WAAW,GAAG,SAAS,KAAK,IAAI;AAEtC,IAAA,MAAM,cAAc,GAAG,EAAE,CACrB,MAAM,CAAC,IAAI,EACX;AACI,QAAA,CAAC,MAAM,CAAC,UAAU,GAAG,WAAW;AAChC,QAAA,CAAC,MAAM,CAAC,OAAO,GAAG,aAAa;AAC/B,QAAA,CAAC,MAAM,CAAC,QAAQ,GAAG,QAAQ;KAC9B,EACD,SAAS,CACZ;;AAGD,IAAA,QACI,KAAA,CAAA,aAAA,CAAC,SAAS,EAAA,EAAC,SAAS,EAAE,cAAc,EAAgB,cAAA,EAAA,UAAU,EAAM,GAAA,SAAS,EACxE,EAAA,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,MACjC,KAAA,CAAA,aAAA,CAAC,WAAW,CAAC,QAAQ,EAAA,EACjB,KAAK,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAA,EAEtE,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,oBAAC,IAAI,EAAA,IAAA,EAAE,KAAK,CAAQ,CAC1B,CAC1B,CAAC,CACM;AAEpB,CAAC;MAEY,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE;IAC7C,IAAI;AACP,CAAA;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import { Text } from '@alfalab/core-components-typography/moderncssm';
|
|
4
|
-
import { ListContext } from '../../
|
|
4
|
+
import { ListContext } from '../../context.js';
|
|
5
5
|
import styles from './index.module.css';
|
|
6
6
|
|
|
7
7
|
const Item = ({ caption, children, className, markerClassName, dataTestId, }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sources":["../../../src/components/item/Component.tsx"],"sourcesContent":["import React, { ReactNode, useContext } from 'react';\nimport cn from 'classnames';\n\nimport { Text } from '@alfalab/core-components-typography';\n\nimport { ListContext } from '../../
|
|
1
|
+
{"version":3,"file":"Component.js","sources":["../../../src/components/item/Component.tsx"],"sourcesContent":["import React, { type ReactNode, useContext } from 'react';\nimport cn from 'classnames';\n\nimport { Text } from '@alfalab/core-components-typography';\n\nimport { ListContext } from '../../context';\n\nimport styles from './index.module.css';\n\nexport type ItemProps = {\n /**\n * Дополнительный текст\n */\n caption?: string;\n\n /**\n * Дочерние элементы.\n */\n children?: ReactNode;\n\n /**\n * Дополнительный класс\n */\n className?: string;\n\n /**\n * Дополнительный класс для маркера\n */\n markerClassName?: string;\n\n /**\n * Дополнительный класс для маркера\n */\n dataTestId?: string;\n};\n\nexport const Item: React.FC<ItemProps> = ({\n caption,\n children,\n className,\n markerClassName,\n dataTestId,\n}) => {\n const {\n orderedList,\n markerType,\n colorMarker,\n reversed,\n index = 0,\n start = 0,\n } = useContext(ListContext);\n\n const markerLowerAlpha = markerType === 'lower-alpha';\n\n const itemClassNames = cn(styles.item, className, {\n [styles.unorderedItem]: markerLowerAlpha,\n [styles.reversed]: reversed,\n });\n\n const isDisc = markerType === '•';\n\n const count = start === 0 ? index + 1 : start + index;\n const marker = orderedList || markerType === 'decimal' ? `${count}.` : markerType;\n\n return (\n <li className={cn(itemClassNames)} data-test-id={dataTestId}>\n {!markerLowerAlpha && (\n <Text\n tag='div'\n color={colorMarker}\n monospaceNumbers={true}\n view='primary-medium'\n className={cn(styles.slot, markerClassName, {\n [styles.disc]: isDisc && !orderedList,\n [styles.defaultColor]: !colorMarker,\n })}\n >\n {marker}\n </Text>\n )}\n <div>\n <Text tag='div' view='primary-medium'>\n {children}\n </Text>\n {caption && (\n <Text\n tag='div'\n view='primary-small'\n color='secondary'\n className={styles.caption}\n >\n {caption}\n </Text>\n )}\n </div>\n </li>\n );\n};\n\nItem.displayName = 'ListItem';\n"],"names":[],"mappings":";;;;;;AAoCa,MAAA,IAAI,GAAwB,CAAC,EACtC,OAAO,EACP,QAAQ,EACR,SAAS,EACT,eAAe,EACf,UAAU,GACb,KAAI;IACD,MAAM,EACF,WAAW,EACX,UAAU,EACV,WAAW,EACX,QAAQ,EACR,KAAK,GAAG,CAAC,EACT,KAAK,GAAG,CAAC,GACZ,GAAG,UAAU,CAAC,WAAW,CAAC;AAE3B,IAAA,MAAM,gBAAgB,GAAG,UAAU,KAAK,aAAa;IAErD,MAAM,cAAc,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE;AAC9C,QAAA,CAAC,MAAM,CAAC,aAAa,GAAG,gBAAgB;AACxC,QAAA,CAAC,MAAM,CAAC,QAAQ,GAAG,QAAQ;AAC9B,KAAA,CAAC;AAEF,IAAA,MAAM,MAAM,GAAG,UAAU,KAAK,GAAG;AAEjC,IAAA,MAAM,KAAK,GAAG,KAAK,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,KAAK;AACrD,IAAA,MAAM,MAAM,GAAG,WAAW,IAAI,UAAU,KAAK,SAAS,GAAG,GAAG,KAAK,CAAA,CAAA,CAAG,GAAG,UAAU;IAEjF,QACI,4BAAI,SAAS,EAAE,EAAE,CAAC,cAAc,CAAC,EAAA,cAAA,EAAgB,UAAU,EAAA;AACtD,QAAA,CAAC,gBAAgB,KACd,KAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EACD,GAAG,EAAC,KAAK,EACT,KAAK,EAAE,WAAW,EAClB,gBAAgB,EAAE,IAAI,EACtB,IAAI,EAAC,gBAAgB,EACrB,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,EAAE;gBACxC,CAAC,MAAM,CAAC,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW;AACrC,gBAAA,CAAC,MAAM,CAAC,YAAY,GAAG,CAAC,WAAW;aACtC,CAAC,EAAA,EAED,MAAM,CACJ,CACV;AACD,QAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA;YACI,KAAC,CAAA,aAAA,CAAA,IAAI,EAAC,EAAA,GAAG,EAAC,KAAK,EAAC,IAAI,EAAC,gBAAgB,EAChC,EAAA,QAAQ,CACN;AACN,YAAA,OAAO,KACJ,KAAC,CAAA,aAAA,CAAA,IAAI,EACD,EAAA,GAAG,EAAC,KAAK,EACT,IAAI,EAAC,eAAe,EACpB,KAAK,EAAC,WAAW,EACjB,SAAS,EAAE,MAAM,CAAC,OAAO,EAExB,EAAA,OAAO,CACL,CACV,CACC,CACL;AAEb;AAEA,IAAI,CAAC,WAAW,GAAG,UAAU;;;;"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
1
3
|
:root {
|
|
2
4
|
--list-marker-color: var(--color-light-text-primary);
|
|
3
5
|
--list-item-margin: var(--gap-12);
|
|
@@ -5,7 +7,7 @@
|
|
|
5
7
|
|
|
6
8
|
.item {
|
|
7
9
|
margin-top: var(--list-item-margin);
|
|
8
|
-
display: flex
|
|
10
|
+
display: flex;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
.item:first-child {
|
|
@@ -30,7 +32,7 @@
|
|
|
30
32
|
box-sizing: border-box;
|
|
31
33
|
justify-content: flex-start;
|
|
32
34
|
padding-right: var(--gap-4);
|
|
33
|
-
flex-shrink: 0
|
|
35
|
+
flex-shrink: 0;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
.slot.defaultColor {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type ColorMarkerType } from './types';
|
|
3
|
+
export declare type TListContext = {
|
|
4
|
+
/**
|
|
5
|
+
* Упорядоченный список
|
|
6
|
+
*/
|
|
7
|
+
orderedList?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Маркер
|
|
10
|
+
* @default '–' for ul and 'decimal' for ol
|
|
11
|
+
*/
|
|
12
|
+
markerType?: 'lower-alpha' | 'decimal' | string | ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Цвет маркера
|
|
15
|
+
*/
|
|
16
|
+
colorMarker?: ColorMarkerType;
|
|
17
|
+
/**
|
|
18
|
+
* Список обратного счета
|
|
19
|
+
*/
|
|
20
|
+
reversed?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Номер пункта
|
|
23
|
+
*/
|
|
24
|
+
index?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Начало отсчета элементов списка
|
|
27
|
+
*/
|
|
28
|
+
start?: number;
|
|
29
|
+
};
|
|
30
|
+
export declare const ListContext: import("react").Context<TListContext>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../src/context.ts"],"sourcesContent":["import { createContext, type ReactNode } from 'react';\n\nimport { type ColorMarkerType } from './types';\n\nexport type TListContext = {\n /**\n * Упорядоченный список\n */\n orderedList?: boolean;\n\n /**\n * Маркер\n * @default '–' for ul and 'decimal' for ol\n */\n markerType?: 'lower-alpha' | 'decimal' | string | ReactNode;\n\n /**\n * Цвет маркера\n */\n colorMarker?: ColorMarkerType;\n\n /**\n * Список обратного счета\n */\n reversed?: boolean;\n\n /**\n * Номер пункта\n */\n index?: number;\n\n /**\n * Начало отсчета элементов списка\n */\n start?: number;\n};\n\nexport const ListContext = createContext<TListContext>({});\n"],"names":[],"mappings":";;MAqCa,WAAW,GAAG,aAAa,CAAe,EAAE;;;;"}
|
package/moderncssm/index.js
CHANGED
package/moderncssm/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":";;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type ColorMarkerType = 'tertiary' | 'accent' | 'primary' | 'attention' | 'positive' | 'secondary' | 'tertiary-inverted' | 'primary-inverted' | 'secondary-inverted' | 'link' | 'negative';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/moderncssm/utils.d.ts
CHANGED
package/moderncssm/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["import { isValidElement, ReactNode } from 'react';\n\nexport const isItemElement = (obj: JSX.Element, name?: string): boolean =>\n typeof obj === 'object' && obj.type.displayName === name;\n\nexport const isItem = (child: ReactNode) =>\n isValidElement(child) && isItemElement(child, 'ListItem');\n"],"names":[],"mappings":";;MAEa,aAAa,GAAG,CAAC,GAAgB,EAAE,IAAa,KACzD,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,CAAC,WAAW,KAAK;MAE3C,MAAM,GAAG,CAAC,KAAgB,KACnC,cAAc,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,KAAK,EAAE,UAAU;;;;"}
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["import { isValidElement, type ReactNode } from 'react';\n\nexport const isItemElement = (obj: JSX.Element, name?: string): boolean =>\n typeof obj === 'object' && obj.type.displayName === name;\n\nexport const isItem = (child: ReactNode) =>\n isValidElement(child) && isItemElement(child, 'ListItem');\n"],"names":[],"mappings":";;MAEa,aAAa,GAAG,CAAC,GAAgB,EAAE,IAAa,KACzD,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,CAAC,WAAW,KAAK;MAE3C,MAAM,GAAG,CAAC,KAAgB,KACnC,cAAc,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,KAAK,EAAE,UAAU;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-list",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"main": "index.js",
|
|
11
11
|
"module": "./esm/index.js",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@alfalab/core-components-typography": "5.0.
|
|
13
|
+
"@alfalab/core-components-typography": "^5.0.2",
|
|
14
14
|
"classnames": "^2.5.1",
|
|
15
15
|
"tslib": "^2.4.0"
|
|
16
16
|
},
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
"access": "public",
|
|
23
23
|
"directory": "dist"
|
|
24
24
|
},
|
|
25
|
-
"themesVersion": "14.
|
|
26
|
-
"varsVersion": "10.0
|
|
25
|
+
"themesVersion": "14.1.2",
|
|
26
|
+
"varsVersion": "10.1.0"
|
|
27
27
|
}
|
package/src/Component.tsx
CHANGED
|
@@ -1,58 +1,14 @@
|
|
|
1
|
-
import React, { Children, ReactNode } from 'react';
|
|
1
|
+
import React, { Children, type ReactNode } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
4
|
import { Item } from './components/item';
|
|
5
|
+
import { ListContext, type TListContext } from './context';
|
|
6
|
+
import { type ColorMarkerType } from './types';
|
|
5
7
|
import { isItem } from './utils';
|
|
6
8
|
|
|
7
9
|
import styles from './index.module.css';
|
|
8
10
|
|
|
9
|
-
export type TListContext
|
|
10
|
-
/**
|
|
11
|
-
* Упорядоченный список
|
|
12
|
-
*/
|
|
13
|
-
orderedList?: boolean;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Маркер
|
|
17
|
-
* @default '–' for ul and 'decimal' for ol
|
|
18
|
-
*/
|
|
19
|
-
markerType?: 'lower-alpha' | 'decimal' | string | ReactNode;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Цвет маркера
|
|
23
|
-
*/
|
|
24
|
-
colorMarker?: ColorMarkerType;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Список обратного счета
|
|
28
|
-
*/
|
|
29
|
-
reversed?: boolean;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Номер пункта
|
|
33
|
-
*/
|
|
34
|
-
index?: number;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Начало отсчета элементов списка
|
|
38
|
-
*/
|
|
39
|
-
start?: number;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export const ListContext = React.createContext<TListContext>({});
|
|
43
|
-
|
|
44
|
-
type ColorMarkerType =
|
|
45
|
-
| 'tertiary'
|
|
46
|
-
| 'accent'
|
|
47
|
-
| 'primary'
|
|
48
|
-
| 'attention'
|
|
49
|
-
| 'positive'
|
|
50
|
-
| 'secondary'
|
|
51
|
-
| 'tertiary-inverted'
|
|
52
|
-
| 'primary-inverted'
|
|
53
|
-
| 'secondary-inverted'
|
|
54
|
-
| 'link'
|
|
55
|
-
| 'negative';
|
|
11
|
+
export { ListContext, type TListContext };
|
|
56
12
|
|
|
57
13
|
export type ListProps = {
|
|
58
14
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React, { ReactNode, useContext } from 'react';
|
|
1
|
+
import React, { type ReactNode, useContext } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
4
|
import { Text } from '@alfalab/core-components-typography';
|
|
5
5
|
|
|
6
|
-
import { ListContext } from '../../
|
|
6
|
+
import { ListContext } from '../../context';
|
|
7
7
|
|
|
8
8
|
import styles from './index.module.css';
|
|
9
9
|
|
package/src/context.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createContext, type ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { type ColorMarkerType } from './types';
|
|
4
|
+
|
|
5
|
+
export type TListContext = {
|
|
6
|
+
/**
|
|
7
|
+
* Упорядоченный список
|
|
8
|
+
*/
|
|
9
|
+
orderedList?: boolean;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Маркер
|
|
13
|
+
* @default '–' for ul and 'decimal' for ol
|
|
14
|
+
*/
|
|
15
|
+
markerType?: 'lower-alpha' | 'decimal' | string | ReactNode;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Цвет маркера
|
|
19
|
+
*/
|
|
20
|
+
colorMarker?: ColorMarkerType;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Список обратного счета
|
|
24
|
+
*/
|
|
25
|
+
reversed?: boolean;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Номер пункта
|
|
29
|
+
*/
|
|
30
|
+
index?: number;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Начало отсчета элементов списка
|
|
34
|
+
*/
|
|
35
|
+
start?: number;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const ListContext = createContext<TListContext>({});
|
package/src/index.module.css
CHANGED
package/src/types.ts
ADDED
package/src/utils.ts
CHANGED
package/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type ColorMarkerType = 'tertiary' | 'accent' | 'primary' | 'attention' | 'positive' | 'secondary' | 'tertiary-inverted' | 'primary-inverted' | 'secondary-inverted' | 'link' | 'negative';
|
package/types.js
ADDED
package/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
package/utils.d.ts
CHANGED
package/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["src/utils.ts"],"sourcesContent":["import { isValidElement, ReactNode } from 'react';\n\nexport const isItemElement = (obj: JSX.Element, name?: string): boolean =>\n typeof obj === 'object' && obj.type.displayName === name;\n\nexport const isItem = (child: ReactNode) =>\n isValidElement(child) && isItemElement(child, 'ListItem');\n"],"names":["isValidElement"],"mappings":";;;;;;AAEa,IAAA,aAAa,GAAG,UAAC,GAAgB,EAAE,IAAa,EAAA;IACzD,OAAA,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,CAAC,WAAW,KAAK,IAAI;AAAxD;AAEG,IAAM,MAAM,GAAG,UAAC,KAAgB,EAAA;IACnC,OAAAA,oBAAc,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,KAAK,EAAE,UAAU,CAAC;AAAzD;;;;;"}
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["src/utils.ts"],"sourcesContent":["import { isValidElement, type ReactNode } from 'react';\n\nexport const isItemElement = (obj: JSX.Element, name?: string): boolean =>\n typeof obj === 'object' && obj.type.displayName === name;\n\nexport const isItem = (child: ReactNode) =>\n isValidElement(child) && isItemElement(child, 'ListItem');\n"],"names":["isValidElement"],"mappings":";;;;;;AAEa,IAAA,aAAa,GAAG,UAAC,GAAgB,EAAE,IAAa,EAAA;IACzD,OAAA,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,CAAC,WAAW,KAAK,IAAI;AAAxD;AAEG,IAAM,MAAM,GAAG,UAAC,KAAgB,EAAA;IACnC,OAAAA,oBAAc,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,KAAK,EAAE,UAAU,CAAC;AAAzD;;;;;"}
|