@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
package/esm/Component.js.map
CHANGED
|
@@ -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,IAAM,aAAa,GAAwB,UAAC,EAU3C,EAAA;;AATG,IAAA,IAAA,EAAU,GAAA,EAAA,CAAA,GAAA,EAAV,GAAG,GAAA,EAAA,KAAA,MAAA,GAAG,IAAI,GAAA,EAAA,EACV,MAAM,GAAA,EAAA,CAAA,MAAA,EACN,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,WAAW,GAAA,EAAA,CAAA,WAAA,EACX,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,KAAK,GAAA,EAAA,CAAA,KAAA,EACF,SAAS,GAAA,MAAA,CAAA,EAAA,EAT4B,4FAU3C,CADe;AAEZ,IAAA,IAAM,UAAU,GAAG,MAAM,KAAK,GAAG,KAAK,IAAI,GAAG,GAAG,GAAG,SAAS,CAAC;AAC7D,IAAA,IAAM,WAAW,GAAG,UAAU,KAAK,aAAa;AAChD,IAAA,IAAM,aAAa,GAAG,UAAU,KAAK,SAAS;AAC9C,IAAA,IAAM,SAAS,GAAG,GAAG,KAAK,IAAI,IAAI,WAAW,GAAG,IAAI,GAAG,IAAI;AAE3D,IAAA,IAAM,WAAW,GAAG,SAAS,KAAK,IAAI;AAEtC,IAAA,IAAM,cAAc,GAAG,EAAE,CACrB,MAAM,CAAC,IAAI,GAAA,EAAA,GAAA,EAAA;AAEP,QAAA,EAAA,CAAC,MAAM,CAAC,UAAU,CAAA,GAAG,WAAW;AAChC,QAAA,EAAA,CAAC,MAAM,CAAC,OAAO,CAAA,GAAG,aAAa;AAC/B,QAAA,EAAA,CAAC,MAAM,CAAC,QAAQ,CAAA,GAAG,QAAQ;AAE/B,QAAA,EAAA,GAAA,SAAS,CACZ;;AAGD,IAAA,QACI,KAAA,CAAA,aAAA,CAAC,SAAS,EAAA,QAAA,CAAA,EAAC,SAAS,EAAE,cAAc,EAAgB,cAAA,EAAA,UAAU,IAAM,SAAS,CAAA,EACxE,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAC,KAAK,EAAE,KAAK,EAAK,EAAA,QACtC,KAAC,CAAA,aAAA,CAAA,WAAW,CAAC,QAAQ,IACjB,KAAK,EAAE,EAAE,WAAW,aAAA,EAAE,UAAU,EAAA,UAAA,EAAE,WAAW,EAAA,WAAA,EAAE,QAAQ,EAAA,QAAA,EAAE,KAAK,EAAA,KAAA,EAAE,KAAK,OAAA,EAAE,EAAA,EAEtE,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,KAAA,CAAA,aAAA,CAAC,IAAI,EAAE,IAAA,EAAA,KAAK,CAAQ,CAC1B,EALe,EAMzC,CAAC,CACM;AAEpB,CAAC;IAEY,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE;AAC7C,IAAA,IAAI,EAAA,IAAA;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/esm';
|
|
4
|
-
import { ListContext } from '../../
|
|
4
|
+
import { ListContext } from '../../context.js';
|
|
5
5
|
import styles from './index.module.css.js';
|
|
6
6
|
|
|
7
7
|
var Item = function (_a) {
|
|
@@ -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":";;;;;;AAoCO,IAAM,IAAI,GAAwB,UAAC,EAMzC,EAAA;;AALG,IAAA,IAAA,OAAO,GAAA,EAAA,CAAA,OAAA,EACP,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,eAAe,GAAA,EAAA,CAAA,eAAA,EACf,UAAU,GAAA,EAAA,CAAA,UAAA;AAEJ,IAAA,IAAA,EAOF,GAAA,UAAU,CAAC,WAAW,CAAC,EANvB,WAAW,GAAA,EAAA,CAAA,WAAA,EACX,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,WAAW,GAAA,EAAA,CAAA,WAAA,EACX,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,EAAA,GAAA,EAAA,CAAA,KAAS,EAAT,KAAK,mBAAG,CAAC,GAAA,EAAA,EACT,EAAA,GAAA,EAAA,CAAA,KAAS,EAAT,KAAK,GAAG,EAAA,KAAA,MAAA,GAAA,CAAC,KACc;AAE3B,IAAA,IAAM,gBAAgB,GAAG,UAAU,KAAK,aAAa;IAErD,IAAM,cAAc,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,GAAA,EAAA,GAAA,EAAA;AAC5C,QAAA,EAAA,CAAC,MAAM,CAAC,aAAa,CAAA,GAAG,gBAAgB;AACxC,QAAA,EAAA,CAAC,MAAM,CAAC,QAAQ,CAAA,GAAG,QAAQ;YAC7B;AAEF,IAAA,IAAM,MAAM,GAAG,UAAU,KAAK,GAAG;AAEjC,IAAA,IAAM,KAAK,GAAG,KAAK,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,KAAK;AACrD,IAAA,IAAM,MAAM,GAAG,WAAW,IAAI,UAAU,KAAK,SAAS,GAAG,UAAG,KAAK,EAAA,GAAA,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,GAAA,EAAA,GAAA,EAAA;AACtC,gBAAA,EAAA,CAAC,MAAM,CAAC,IAAI,IAAG,MAAM,IAAI,CAAC,WAAW;AACrC,gBAAA,EAAA,CAAC,MAAM,CAAC,YAAY,CAAA,GAAG,CAAC,WAAW;oBACrC,EAED,EAAA,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;;;;"}
|
|
@@ -11,29 +11,29 @@
|
|
|
11
11
|
} :root {
|
|
12
12
|
--list-marker-color: var(--color-light-text-primary);
|
|
13
13
|
--list-item-margin: var(--gap-12);
|
|
14
|
-
} .
|
|
14
|
+
} .list__item_1xe6h {
|
|
15
15
|
margin-top: var(--list-item-margin);
|
|
16
|
-
display: flex
|
|
17
|
-
} .
|
|
16
|
+
display: flex;
|
|
17
|
+
} .list__item_1xe6h:first-child {
|
|
18
18
|
margin-top: var(--gap-0);
|
|
19
|
-
} .
|
|
19
|
+
} .list__item_1xe6h.list__reversed_1xe6h:first-child {
|
|
20
20
|
margin-top: var(--list-item-margin);
|
|
21
|
-
} .
|
|
21
|
+
} .list__item_1xe6h.list__reversed_1xe6h:last-child {
|
|
22
22
|
margin-top: var(--gap-0);
|
|
23
|
-
} .
|
|
23
|
+
} .list__item_1xe6h.list__unorderedItem_1xe6h {
|
|
24
24
|
display: list-item;
|
|
25
|
-
} .
|
|
25
|
+
} .list__slot_1xe6h {
|
|
26
26
|
min-width: 20px;
|
|
27
27
|
display: flex;
|
|
28
28
|
box-sizing: border-box;
|
|
29
29
|
justify-content: flex-start;
|
|
30
30
|
padding-right: var(--gap-4);
|
|
31
|
-
flex-shrink: 0
|
|
32
|
-
} .
|
|
31
|
+
flex-shrink: 0;
|
|
32
|
+
} .list__slot_1xe6h.list__defaultColor_1xe6h {
|
|
33
33
|
color: var(--list-marker-color);
|
|
34
|
-
} .
|
|
34
|
+
} .list__slot_1xe6h.list__disc_1xe6h {
|
|
35
35
|
justify-content: center;
|
|
36
36
|
padding: var(--gap-0) var(--gap-4);
|
|
37
|
-
} .
|
|
37
|
+
} .list__caption_1xe6h {
|
|
38
38
|
margin-top: var(--gap-2);
|
|
39
39
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
var styles = {"item":"
|
|
3
|
+
var styles = {"item":"list__item_1xe6h","reversed":"list__reversed_1xe6h","unorderedItem":"list__unorderedItem_1xe6h","slot":"list__slot_1xe6h","defaultColor":"list__defaultColor_1xe6h","disc":"list__disc_1xe6h","caption":"list__caption_1xe6h"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":["../../src/components/item/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n:root {\n --list-marker-color: var(--color-light-text-primary);\n --list-item-margin: var(--gap-12);\n}\n\n.item {\n margin-top: var(--list-item-margin);\n display: flex;\n\n &:first-child {\n margin-top: var(--gap-0);\n }\n\n &.reversed:first-child {\n margin-top: var(--list-item-margin);\n }\n\n &.reversed:last-child {\n margin-top: var(--gap-0);\n }\n\n &.unorderedItem {\n display: list-item;\n }\n}\n\n.slot {\n min-width: 20px;\n display: flex;\n box-sizing: border-box;\n justify-content: flex-start;\n padding-right: var(--gap-4);\n flex-shrink: 0;\n\n &.defaultColor {\n color: var(--list-marker-color);\n }\n\n &.disc {\n justify-content: center;\n padding: var(--gap-0) var(--gap-4);\n }\n}\n\n.caption {\n margin-top: var(--gap-2);\n}\n"],"names":[],"mappings":";;AAEgB,aAAe,CAAC,MAAM,CAAC,kBAAkB,CAAC,UAAU,CAAC,sBAAsB,CAAC,eAAe,CAAC,2BAA2B,CAAC,MAAM,CAAC,kBAAkB,CAAC,cAAc,CAAC,0BAA0B,CAAC,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,qBAAqB,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["../../src/components/item/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/no-typography-index.css';\n\n:root {\n --list-marker-color: var(--color-light-text-primary);\n --list-item-margin: var(--gap-12);\n}\n\n.item {\n margin-top: var(--list-item-margin);\n display: flex;\n\n &:first-child {\n margin-top: var(--gap-0);\n }\n\n &.reversed:first-child {\n margin-top: var(--list-item-margin);\n }\n\n &.reversed:last-child {\n margin-top: var(--gap-0);\n }\n\n &.unorderedItem {\n display: list-item;\n }\n}\n\n.slot {\n min-width: 20px;\n display: flex;\n box-sizing: border-box;\n justify-content: flex-start;\n padding-right: var(--gap-4);\n flex-shrink: 0;\n\n &.defaultColor {\n color: var(--list-marker-color);\n }\n\n &.disc {\n justify-content: center;\n padding: var(--gap-0) var(--gap-4);\n }\n}\n\n.caption {\n margin-top: var(--gap-2);\n}\n"],"names":[],"mappings":";;AAEgB,aAAe,CAAC,MAAM,CAAC,kBAAkB,CAAC,UAAU,CAAC,sBAAsB,CAAC,eAAe,CAAC,2BAA2B,CAAC,MAAM,CAAC,kBAAkB,CAAC,cAAc,CAAC,0BAA0B,CAAC,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,qBAAqB,CAAC;;;;"}
|
package/esm/context.d.ts
ADDED
|
@@ -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>;
|
package/esm/context.js
ADDED
|
@@ -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":";;IAqCa,WAAW,GAAG,aAAa,CAAe,EAAE;;;;"}
|
package/esm/index.css
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
--gap-l: 20px;
|
|
5
5
|
--gap-0: 0px;
|
|
6
6
|
--gap-20: var(--gap-l);
|
|
7
|
-
} .
|
|
7
|
+
} .list__list_1kjr2 {
|
|
8
8
|
margin: var(--gap-0);
|
|
9
9
|
padding: var(--gap-0);
|
|
10
10
|
color: var(--color-light-text-primary);
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
line-height: 24px;
|
|
15
15
|
|
|
16
16
|
font-weight: 400;
|
|
17
|
-
} .
|
|
17
|
+
} .list__lowerAlpha_1kjr2 {
|
|
18
18
|
list-style-type: lower-alpha;
|
|
19
19
|
padding-left: var(--gap-20);
|
|
20
|
-
} .
|
|
20
|
+
} .list__decimal_1kjr2 {
|
|
21
21
|
list-style-type: decimal;
|
|
22
|
-
} ol.
|
|
22
|
+
} ol.list__list_1kjr2 {
|
|
23
23
|
display: flex;
|
|
24
|
-
flex-direction: column
|
|
25
|
-
} ol.
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
} ol.list__list_1kjr2.list__reversed_1kjr2 {
|
|
26
26
|
flex-direction: column-reverse;
|
|
27
27
|
}
|
package/esm/index.js
CHANGED
package/esm/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/esm/index.module.css.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
var styles = {"list":"
|
|
3
|
+
var styles = {"list":"list__list_1kjr2","lowerAlpha":"list__lowerAlpha_1kjr2","decimal":"list__decimal_1kjr2","reversed":"list__reversed_1kjr2"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n.list {\n margin: var(--gap-0);\n padding: var(--gap-0);\n color: var(--color-light-text-primary);\n\n @mixin paragraph_primary_medium;\n}\n\n.lowerAlpha {\n list-style-type: lower-alpha;\n padding-left: var(--gap-20);\n}\n\n.decimal {\n list-style-type: decimal;\n}\n\nol.list {\n display: flex;\n flex-direction: column;\n\n &.reversed {\n flex-direction: column-reverse;\n }\n}\n"],"names":[],"mappings":";;AAEgB,aAAe,CAAC,MAAM,CAAC,kBAAkB,CAAC,YAAY,CAAC,wBAAwB,CAAC,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,sBAAsB,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/no-typography-index.css';\n\n.list {\n margin: var(--gap-0);\n padding: var(--gap-0);\n color: var(--color-light-text-primary);\n\n @mixin paragraph_primary_medium;\n}\n\n.lowerAlpha {\n list-style-type: lower-alpha;\n padding-left: var(--gap-20);\n}\n\n.decimal {\n list-style-type: decimal;\n}\n\nol.list {\n display: flex;\n flex-direction: column;\n\n &.reversed {\n flex-direction: column-reverse;\n }\n}\n"],"names":[],"mappings":";;AAEgB,aAAe,CAAC,MAAM,CAAC,kBAAkB,CAAC,YAAY,CAAC,wBAAwB,CAAC,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,sBAAsB,CAAC;;;;"}
|
package/esm/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/esm/types.js
ADDED
package/esm/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/esm/utils.d.ts
CHANGED
package/esm/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":";;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,OAAA,cAAc,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":[],"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,OAAA,cAAc,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,KAAK,EAAE,UAAU,CAAC;AAAzD;;;;"}
|
package/index.css
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
--gap-l: 20px;
|
|
5
5
|
--gap-0: 0px;
|
|
6
6
|
--gap-20: var(--gap-l);
|
|
7
|
-
} .
|
|
7
|
+
} .list__list_1kjr2 {
|
|
8
8
|
margin: var(--gap-0);
|
|
9
9
|
padding: var(--gap-0);
|
|
10
10
|
color: var(--color-light-text-primary);
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
line-height: 24px;
|
|
15
15
|
|
|
16
16
|
font-weight: 400;
|
|
17
|
-
} .
|
|
17
|
+
} .list__lowerAlpha_1kjr2 {
|
|
18
18
|
list-style-type: lower-alpha;
|
|
19
19
|
padding-left: var(--gap-20);
|
|
20
|
-
} .
|
|
20
|
+
} .list__decimal_1kjr2 {
|
|
21
21
|
list-style-type: decimal;
|
|
22
|
-
} ol.
|
|
22
|
+
} ol.list__list_1kjr2 {
|
|
23
23
|
display: flex;
|
|
24
|
-
flex-direction: column
|
|
25
|
-
} ol.
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
} ol.list__list_1kjr2.list__reversed_1kjr2 {
|
|
26
26
|
flex-direction: column-reverse;
|
|
27
27
|
}
|
package/index.js
CHANGED
|
@@ -4,10 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var Component = require('./Component.js');
|
|
6
6
|
var presets = require('./presets.js');
|
|
7
|
+
var context = require('./context.js');
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
exports.List = Component.List;
|
|
11
|
-
exports.ListContext = Component.ListContext;
|
|
12
12
|
exports.listPresets = presets.listPresets;
|
|
13
|
+
exports.ListContext = context.ListContext;
|
|
13
14
|
//# 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.module.css.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require('./index.css');
|
|
4
4
|
|
|
5
|
-
var styles = {"list":"
|
|
5
|
+
var styles = {"list":"list__list_1kjr2","lowerAlpha":"list__lowerAlpha_1kjr2","decimal":"list__decimal_1kjr2","reversed":"list__reversed_1kjr2"};
|
|
6
6
|
|
|
7
7
|
module.exports = styles;
|
|
8
8
|
//# sourceMappingURL=index.module.css.js.map
|
package/index.module.css.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n.list {\n margin: var(--gap-0);\n padding: var(--gap-0);\n color: var(--color-light-text-primary);\n\n @mixin paragraph_primary_medium;\n}\n\n.lowerAlpha {\n list-style-type: lower-alpha;\n padding-left: var(--gap-20);\n}\n\n.decimal {\n list-style-type: decimal;\n}\n\nol.list {\n display: flex;\n flex-direction: column;\n\n &.reversed {\n flex-direction: column-reverse;\n }\n}\n"],"names":[],"mappings":";;;;AAEgB,aAAe,CAAC,MAAM,CAAC,kBAAkB,CAAC,YAAY,CAAC,wBAAwB,CAAC,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,sBAAsB,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/no-typography-index.css';\n\n.list {\n margin: var(--gap-0);\n padding: var(--gap-0);\n color: var(--color-light-text-primary);\n\n @mixin paragraph_primary_medium;\n}\n\n.lowerAlpha {\n list-style-type: lower-alpha;\n padding-left: var(--gap-20);\n}\n\n.decimal {\n list-style-type: decimal;\n}\n\nol.list {\n display: flex;\n flex-direction: column;\n\n &.reversed {\n flex-direction: column-reverse;\n }\n}\n"],"names":[],"mappings":";;;;AAEgB,aAAe,CAAC,MAAM,CAAC,kBAAkB,CAAC,YAAY,CAAC,wBAAwB,CAAC,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,sBAAsB,CAAC;;;;"}
|
package/modern/Component.d.ts
CHANGED
|
@@ -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/modern/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.js';
|
|
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';
|
package/modern/Component.js.map
CHANGED
|
@@ -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/modern';
|
|
4
|
-
import { ListContext } from '../../
|
|
4
|
+
import { ListContext } from '../../context.js';
|
|
5
5
|
import styles from './index.module.css.js';
|
|
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;;;;"}
|
|
@@ -11,29 +11,29 @@
|
|
|
11
11
|
} :root {
|
|
12
12
|
--list-marker-color: var(--color-light-text-primary);
|
|
13
13
|
--list-item-margin: var(--gap-12);
|
|
14
|
-
} .
|
|
14
|
+
} .list__item_1xe6h {
|
|
15
15
|
margin-top: var(--list-item-margin);
|
|
16
|
-
display: flex
|
|
17
|
-
} .
|
|
16
|
+
display: flex;
|
|
17
|
+
} .list__item_1xe6h:first-child {
|
|
18
18
|
margin-top: var(--gap-0);
|
|
19
|
-
} .
|
|
19
|
+
} .list__item_1xe6h.list__reversed_1xe6h:first-child {
|
|
20
20
|
margin-top: var(--list-item-margin);
|
|
21
|
-
} .
|
|
21
|
+
} .list__item_1xe6h.list__reversed_1xe6h:last-child {
|
|
22
22
|
margin-top: var(--gap-0);
|
|
23
|
-
} .
|
|
23
|
+
} .list__item_1xe6h.list__unorderedItem_1xe6h {
|
|
24
24
|
display: list-item;
|
|
25
|
-
} .
|
|
25
|
+
} .list__slot_1xe6h {
|
|
26
26
|
min-width: 20px;
|
|
27
27
|
display: flex;
|
|
28
28
|
box-sizing: border-box;
|
|
29
29
|
justify-content: flex-start;
|
|
30
30
|
padding-right: var(--gap-4);
|
|
31
|
-
flex-shrink: 0
|
|
32
|
-
} .
|
|
31
|
+
flex-shrink: 0;
|
|
32
|
+
} .list__slot_1xe6h.list__defaultColor_1xe6h {
|
|
33
33
|
color: var(--list-marker-color);
|
|
34
|
-
} .
|
|
34
|
+
} .list__slot_1xe6h.list__disc_1xe6h {
|
|
35
35
|
justify-content: center;
|
|
36
36
|
padding: var(--gap-0) var(--gap-4);
|
|
37
|
-
} .
|
|
37
|
+
} .list__caption_1xe6h {
|
|
38
38
|
margin-top: var(--gap-2);
|
|
39
39
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
const styles = {"item":"
|
|
3
|
+
const styles = {"item":"list__item_1xe6h","reversed":"list__reversed_1xe6h","unorderedItem":"list__unorderedItem_1xe6h","slot":"list__slot_1xe6h","defaultColor":"list__defaultColor_1xe6h","disc":"list__disc_1xe6h","caption":"list__caption_1xe6h"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":["../../src/components/item/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n:root {\n --list-marker-color: var(--color-light-text-primary);\n --list-item-margin: var(--gap-12);\n}\n\n.item {\n margin-top: var(--list-item-margin);\n display: flex;\n\n &:first-child {\n margin-top: var(--gap-0);\n }\n\n &.reversed:first-child {\n margin-top: var(--list-item-margin);\n }\n\n &.reversed:last-child {\n margin-top: var(--gap-0);\n }\n\n &.unorderedItem {\n display: list-item;\n }\n}\n\n.slot {\n min-width: 20px;\n display: flex;\n box-sizing: border-box;\n justify-content: flex-start;\n padding-right: var(--gap-4);\n flex-shrink: 0;\n\n &.defaultColor {\n color: var(--list-marker-color);\n }\n\n &.disc {\n justify-content: center;\n padding: var(--gap-0) var(--gap-4);\n }\n}\n\n.caption {\n margin-top: var(--gap-2);\n}\n"],"names":[],"mappings":";;AAEgB,eAAe,CAAC,MAAM,CAAC,kBAAkB,CAAC,UAAU,CAAC,sBAAsB,CAAC,eAAe,CAAC,2BAA2B,CAAC,MAAM,CAAC,kBAAkB,CAAC,cAAc,CAAC,0BAA0B,CAAC,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,qBAAqB,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["../../src/components/item/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/no-typography-index.css';\n\n:root {\n --list-marker-color: var(--color-light-text-primary);\n --list-item-margin: var(--gap-12);\n}\n\n.item {\n margin-top: var(--list-item-margin);\n display: flex;\n\n &:first-child {\n margin-top: var(--gap-0);\n }\n\n &.reversed:first-child {\n margin-top: var(--list-item-margin);\n }\n\n &.reversed:last-child {\n margin-top: var(--gap-0);\n }\n\n &.unorderedItem {\n display: list-item;\n }\n}\n\n.slot {\n min-width: 20px;\n display: flex;\n box-sizing: border-box;\n justify-content: flex-start;\n padding-right: var(--gap-4);\n flex-shrink: 0;\n\n &.defaultColor {\n color: var(--list-marker-color);\n }\n\n &.disc {\n justify-content: center;\n padding: var(--gap-0) var(--gap-4);\n }\n}\n\n.caption {\n margin-top: var(--gap-2);\n}\n"],"names":[],"mappings":";;AAEgB,eAAe,CAAC,MAAM,CAAC,kBAAkB,CAAC,UAAU,CAAC,sBAAsB,CAAC,eAAe,CAAC,2BAA2B,CAAC,MAAM,CAAC,kBAAkB,CAAC,cAAc,CAAC,0BAA0B,CAAC,MAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,qBAAqB,CAAC;;;;"}
|
|
@@ -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/modern/index.css
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
--gap-l: 20px;
|
|
5
5
|
--gap-0: 0px;
|
|
6
6
|
--gap-20: var(--gap-l);
|
|
7
|
-
} .
|
|
7
|
+
} .list__list_1kjr2 {
|
|
8
8
|
margin: var(--gap-0);
|
|
9
9
|
padding: var(--gap-0);
|
|
10
10
|
color: var(--color-light-text-primary);
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
line-height: 24px;
|
|
15
15
|
|
|
16
16
|
font-weight: 400;
|
|
17
|
-
} .
|
|
17
|
+
} .list__lowerAlpha_1kjr2 {
|
|
18
18
|
list-style-type: lower-alpha;
|
|
19
19
|
padding-left: var(--gap-20);
|
|
20
|
-
} .
|
|
20
|
+
} .list__decimal_1kjr2 {
|
|
21
21
|
list-style-type: decimal;
|
|
22
|
-
} ol.
|
|
22
|
+
} ol.list__list_1kjr2 {
|
|
23
23
|
display: flex;
|
|
24
|
-
flex-direction: column
|
|
25
|
-
} ol.
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
} ol.list__list_1kjr2.list__reversed_1kjr2 {
|
|
26
26
|
flex-direction: column-reverse;
|
|
27
27
|
}
|
package/modern/index.js
CHANGED
package/modern/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":";;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
const styles = {"list":"
|
|
3
|
+
const styles = {"list":"list__list_1kjr2","lowerAlpha":"list__lowerAlpha_1kjr2","decimal":"list__decimal_1kjr2","reversed":"list__reversed_1kjr2"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n\n.list {\n margin: var(--gap-0);\n padding: var(--gap-0);\n color: var(--color-light-text-primary);\n\n @mixin paragraph_primary_medium;\n}\n\n.lowerAlpha {\n list-style-type: lower-alpha;\n padding-left: var(--gap-20);\n}\n\n.decimal {\n list-style-type: decimal;\n}\n\nol.list {\n display: flex;\n flex-direction: column;\n\n &.reversed {\n flex-direction: column-reverse;\n }\n}\n"],"names":[],"mappings":";;AAEgB,eAAe,CAAC,MAAM,CAAC,kBAAkB,CAAC,YAAY,CAAC,wBAAwB,CAAC,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,sBAAsB,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["src/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/no-typography-index.css';\n\n.list {\n margin: var(--gap-0);\n padding: var(--gap-0);\n color: var(--color-light-text-primary);\n\n @mixin paragraph_primary_medium;\n}\n\n.lowerAlpha {\n list-style-type: lower-alpha;\n padding-left: var(--gap-20);\n}\n\n.decimal {\n list-style-type: decimal;\n}\n\nol.list {\n display: flex;\n flex-direction: column;\n\n &.reversed {\n flex-direction: column-reverse;\n }\n}\n"],"names":[],"mappings":";;AAEgB,eAAe,CAAC,MAAM,CAAC,kBAAkB,CAAC,YAAY,CAAC,wBAAwB,CAAC,SAAS,CAAC,qBAAqB,CAAC,UAAU,CAAC,sBAAsB,CAAC;;;;"}
|