@alfalab/core-components-list 3.1.2 → 3.2.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.
Files changed (61) hide show
  1. package/Component-0887e7cb.d.ts +72 -0
  2. package/Component-71bc37e9.d.ts +15 -0
  3. package/Component-71bc37e9.js +66 -0
  4. package/Component.d.ts +0 -29
  5. package/Component.js +8 -32
  6. package/components/item/Component.d.ts +0 -0
  7. package/components/item/Component.js +12 -0
  8. package/components/item/index.css +49 -0
  9. package/components/item/index.d.ts +1 -0
  10. package/components/item/index.js +12 -0
  11. package/cssm/Component-0887e7cb.d.ts +72 -0
  12. package/cssm/Component-7cc47e0b.d.ts +15 -0
  13. package/cssm/Component-7cc47e0b.js +64 -0
  14. package/cssm/Component.d.ts +0 -29
  15. package/cssm/Component.js +10 -31
  16. package/cssm/components/item/Component.d.ts +0 -0
  17. package/cssm/components/item/Component.js +14 -0
  18. package/cssm/components/item/index.d.ts +1 -0
  19. package/cssm/components/item/index.js +14 -0
  20. package/cssm/components/item/index.module.css +48 -0
  21. package/cssm/index.d.ts +1 -1
  22. package/cssm/index.js +6 -2
  23. package/cssm/index.module.css +8 -21
  24. package/cssm/utils.d.ts +5 -0
  25. package/cssm/utils.js +13 -0
  26. package/esm/Component-0887e7cb.d.ts +72 -0
  27. package/esm/Component-5084b3b8.d.ts +15 -0
  28. package/esm/Component-5084b3b8.js +57 -0
  29. package/esm/Component.d.ts +0 -29
  30. package/esm/Component.js +6 -30
  31. package/esm/components/item/Component.d.ts +0 -0
  32. package/esm/components/item/Component.js +6 -0
  33. package/esm/components/item/index.css +49 -0
  34. package/esm/components/item/index.d.ts +1 -0
  35. package/esm/components/item/index.js +6 -0
  36. package/esm/index.css +12 -25
  37. package/esm/index.d.ts +1 -1
  38. package/esm/index.js +3 -1
  39. package/esm/utils.d.ts +5 -0
  40. package/esm/utils.js +10 -0
  41. package/index.css +12 -25
  42. package/index.d.ts +1 -1
  43. package/index.js +5 -2
  44. package/modern/Component-0887e7cb.d.ts +72 -0
  45. package/modern/Component-368bf140.d.ts +15 -0
  46. package/modern/Component-368bf140.js +52 -0
  47. package/modern/Component.d.ts +0 -29
  48. package/modern/Component.js +5 -27
  49. package/modern/components/item/Component.d.ts +0 -0
  50. package/modern/components/item/Component.js +5 -0
  51. package/modern/components/item/index.css +49 -0
  52. package/modern/components/item/index.d.ts +1 -0
  53. package/modern/components/item/index.js +5 -0
  54. package/modern/index.css +12 -25
  55. package/modern/index.d.ts +1 -1
  56. package/modern/index.js +3 -1
  57. package/modern/utils.d.ts +5 -0
  58. package/modern/utils.js +6 -0
  59. package/package.json +2 -1
  60. package/utils.d.ts +5 -0
  61. package/utils.js +13 -0
package/cssm/index.js CHANGED
@@ -1,13 +1,17 @@
1
1
  'use strict';
2
2
 
3
- var Component = require('./Component.js');
3
+ var components_item_Component = require('./Component-7cc47e0b.js');
4
4
  var presets = require('./presets.js');
5
5
  require('tslib');
6
6
  require('react');
7
7
  require('classnames');
8
+ require('@alfalab/core-components-typography/cssm');
9
+ require('./utils.js');
8
10
  require('./index.module.css');
11
+ require('./components/item/index.module.css');
9
12
 
10
13
 
11
14
 
12
- exports.List = Component.List;
15
+ exports.List = components_item_Component.List;
16
+ exports.ListContext = components_item_Component.ListContext;
13
17
  exports.listPresets = presets.listPresets;
@@ -1,7 +1,7 @@
1
1
  :root {
2
2
  } /* deprecated */ :root {
3
- --color-light-text-primary: #0b1f35;
4
- } :root {
3
+ --color-light-text-primary: #0b1f35; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
4
+ } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
5
5
  } :root {
6
6
  } :root {
7
7
 
@@ -12,15 +12,9 @@
12
12
  /* Hard up */
13
13
  } :root {
14
14
  } :root {
15
- --gap-2xs: 4px;
16
- --gap-xs: 8px;
17
- --gap-s: 12px;
18
15
  --gap-l: 20px;
19
16
  } :root {
20
17
  } :root {
21
- } :root {
22
- --list-marker-color: var(--color-light-text-primary);
23
- --list-item-margin: var(--gap-s);
24
18
  } .list {
25
19
  margin: 0;
26
20
  padding: 0;
@@ -31,21 +25,14 @@
31
25
  line-height: 24px;
32
26
 
33
27
  font-weight: 400;
34
- } .orderedList {
35
- padding-left: var(--gap-l);
36
28
  } .lowerAlpha {
37
29
  list-style-type: lower-alpha;
30
+ padding-left: var(--gap-l);
38
31
  } .decimal {
39
32
  list-style-type: decimal;
40
- } .item {
41
- margin-top: var(--list-item-margin)
42
- } .item:first-child {
43
- margin-top: 0;
44
- } .unorderedItem {
33
+ } ol.list {
45
34
  display: flex;
46
- } .orderedItem {
47
- padding-left: var(--gap-2xs);
48
- } .slot {
49
- margin-right: var(--gap-xs);
50
- color: var(--list-marker-color);
51
- }
35
+ flex-direction: column
36
+ } ol.list.reversed {
37
+ flex-direction: column-reverse;
38
+ }
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { ReactNode } from 'react';
3
+ declare const isItemElement: (obj: JSX.Element, name?: string) => boolean;
4
+ declare const isItem: (child: ReactNode) => boolean;
5
+ export { isItemElement, isItem };
package/cssm/utils.js ADDED
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+
5
+ var isItemElement = function (obj, name) {
6
+ return typeof obj === 'object' && obj.type.displayName === name;
7
+ };
8
+ var isItem = function (child) {
9
+ return React.isValidElement(child) && isItemElement(child, 'ListItem');
10
+ };
11
+
12
+ exports.isItem = isItem;
13
+ exports.isItemElement = isItemElement;
@@ -0,0 +1,72 @@
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ import { ReactNode } from "react";
4
+ type TListContext = {
5
+ /**
6
+ * Упорядоченный список
7
+ */
8
+ orderedList?: boolean;
9
+ /**
10
+ * Маркер
11
+ * @default '—' for ul and 'decimal' for ol
12
+ */
13
+ markerType?: 'lower-alpha' | 'decimal' | string | ReactNode;
14
+ /**
15
+ * Цвет маркера
16
+ */
17
+ colorMarker?: ColorMarkerType;
18
+ /**
19
+ * Список обратного счета
20
+ */
21
+ reversed?: boolean;
22
+ /**
23
+ * Номер пункта
24
+ */
25
+ index?: number;
26
+ /**
27
+ * Начало отсчета элементов списка
28
+ */
29
+ start?: number;
30
+ };
31
+ declare const ListContext: React.Context<TListContext>;
32
+ type ColorMarkerType = 'tertiary' | 'accent' | 'primary' | 'attention' | 'positive' | 'secondary' | 'tertiary-inverted' | 'primary-inverted' | 'secondary-inverted' | 'link' | 'negative';
33
+ type ListProps = {
34
+ /**
35
+ * HTML тег
36
+ * @default 'ul'
37
+ */
38
+ tag?: 'ul' | 'ol';
39
+ /**
40
+ * Маркер
41
+ * @default '—' for ul and 'decimal' for ol
42
+ */
43
+ marker?: 'lower-alpha' | 'decimal' | string | ReactNode;
44
+ /**
45
+ * Css-класс для стилизации
46
+ */
47
+ className?: string;
48
+ /**
49
+ * Цвет маркера
50
+ */
51
+ colorMarker?: ColorMarkerType;
52
+ /**
53
+ * Список обратного счета
54
+ */
55
+ reversed?: boolean;
56
+ /**
57
+ * Начало отсчета элементов списка
58
+ */
59
+ start?: number;
60
+ /**
61
+ * Id компонента для тестов
62
+ */
63
+ dataTestId?: string;
64
+ /**
65
+ * Дочерние элементы
66
+ */
67
+ children?: ReactNode;
68
+ } & Omit<React.OlHTMLAttributes<HTMLOListElement>, 'type'>;
69
+ declare const List: React.FC<ListProps> & {
70
+ Item: React.FC<import("./components/item/index").ItemProps>;
71
+ };
72
+ export { TListContext, ListContext, ListProps, List };
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ import { ReactNode } from "react";
4
+ type ItemProps = {
5
+ /**
6
+ * Дополнительный текст
7
+ */
8
+ caption?: string;
9
+ /**
10
+ * Дочерние элементы.
11
+ */
12
+ children?: ReactNode;
13
+ };
14
+ declare const Item: React.FC<ItemProps>;
15
+ export { ItemProps, Item };
@@ -0,0 +1,57 @@
1
+ import { __rest, __assign } from 'tslib';
2
+ import React, { useContext, Children } from 'react';
3
+ import cn from 'classnames';
4
+ import { Typography } from '@alfalab/core-components-typography/esm';
5
+ import { isItem } from './utils.js';
6
+
7
+ var styles$1 = {"item":"list__item_opye0","reversed":"list__reversed_opye0","unorderedItem":"list__unorderedItem_opye0","slot":"list__slot_opye0","defaultColor":"list__defaultColor_opye0","disc":"list__disc_opye0","caption":"list__caption_opye0"};
8
+ require('./components/item/index.css')
9
+
10
+ var Item = function (_a) {
11
+ var _b, _c;
12
+ var caption = _a.caption, children = _a.children;
13
+ var _d = useContext(ListContext), orderedList = _d.orderedList, markerType = _d.markerType, colorMarker = _d.colorMarker, reversed = _d.reversed, _e = _d.index, index = _e === void 0 ? 0 : _e, _f = _d.start, start = _f === void 0 ? 0 : _f;
14
+ var markerLowerAlpha = markerType === 'lower-alpha';
15
+ var itemClassNames = cn(styles$1.item, (_b = {},
16
+ _b[styles$1.unorderedItem] = markerLowerAlpha,
17
+ _b[styles$1.reversed] = reversed,
18
+ _b));
19
+ var isDisc = markerType === '•';
20
+ var count = start === 0 ? index + 1 : start + index;
21
+ var marker = orderedList || markerType === 'decimal' ? "".concat(count, ".") : markerType;
22
+ return (React.createElement("li", { className: cn(itemClassNames) },
23
+ !markerLowerAlpha && (React.createElement(Typography.Text, { tag: 'div', color: colorMarker, monospaceNumbers: true, view: 'primary-medium', className: cn(styles$1.slot, (_c = {},
24
+ _c[styles$1.disc] = isDisc && !orderedList,
25
+ _c[styles$1.defaultColor] = !colorMarker,
26
+ _c)) }, marker)),
27
+ React.createElement("div", null,
28
+ React.createElement(Typography.Text, { tag: 'div', view: 'primary-medium' }, children),
29
+ caption && (React.createElement(Typography.Text, { tag: 'div', view: 'primary-small', color: 'secondary', className: styles$1.caption }, caption)))));
30
+ };
31
+ Item.displayName = 'ListItem';
32
+
33
+ var styles = {"list":"list__list_1ngae","lowerAlpha":"list__lowerAlpha_1ngae","decimal":"list__decimal_1ngae","reversed":"list__reversed_1ngae"};
34
+ require('./index.css')
35
+
36
+ var ListContext = React.createContext({});
37
+ var ListComponent = function (_a) {
38
+ var _b;
39
+ var _c = _a.tag, tag = _c === void 0 ? 'ul' : _c, marker = _a.marker, className = _a.className, dataTestId = _a.dataTestId, colorMarker = _a.colorMarker, children = _a.children, reversed = _a.reversed, start = _a.start, restProps = __rest(_a, ["tag", "marker", "className", "dataTestId", "colorMarker", "children", "reversed", "start"]);
40
+ var markerType = marker || (tag === 'ul' ? '—' : 'decimal');
41
+ var alphaMarker = markerType === 'lower-alpha';
42
+ var decimalMarker = markerType === 'decimal';
43
+ var Component = tag === 'ul' || alphaMarker ? 'ul' : 'ol';
44
+ var orderedList = Component === 'ol';
45
+ var listClassNames = cn(styles.list, (_b = {},
46
+ _b[styles.lowerAlpha] = alphaMarker,
47
+ _b[styles.decimal] = decimalMarker,
48
+ _b[styles.reversed] = reversed,
49
+ _b), className);
50
+ /* eslint-disable react/jsx-no-constructed-context-values */
51
+ return (React.createElement(Component, __assign({ className: listClassNames, "data-test-id": dataTestId }, restProps), Children.map(children, function (child, index) { return (React.createElement(ListContext.Provider, { value: { orderedList: orderedList, markerType: markerType, colorMarker: colorMarker, reversed: reversed, index: index, start: start } }, isItem(child) ? child : React.createElement(Item, null, child))); })));
52
+ };
53
+ var List = Object.assign(ListComponent, {
54
+ Item: Item,
55
+ });
56
+
57
+ export { Item as I, ListContext as L, List as a };
@@ -1,29 +0,0 @@
1
- /// <reference types="react" />
2
- import React from 'react';
3
- import { ReactNode } from "react";
4
- type ListProps = {
5
- /**
6
- * HTML тег
7
- * @default 'ul'
8
- */
9
- tag?: 'ul' | 'ol';
10
- /**
11
- * Маркер
12
- * @default '—' for ul and 'decimal' for ol
13
- */
14
- marker?: 'lower-alpha' | 'decimal' | string | ReactNode;
15
- /**
16
- * Css-класс для стилизации
17
- */
18
- className?: string;
19
- /**
20
- * Id компонента для тестов
21
- */
22
- dataTestId?: string;
23
- /**
24
- * Дочерние элементы.
25
- */
26
- children?: ReactNode;
27
- } & Omit<React.OlHTMLAttributes<HTMLOListElement>, 'type'>;
28
- declare const List: React.FC<ListProps>;
29
- export { ListProps, List };
package/esm/Component.js CHANGED
@@ -1,30 +1,6 @@
1
- import { __rest, __assign } from 'tslib';
2
- import React, { Children } from 'react';
3
- import cn from 'classnames';
4
-
5
- var styles = {"list":"list__list_h12ja","orderedList":"list__orderedList_h12ja","lowerAlpha":"list__lowerAlpha_h12ja","decimal":"list__decimal_h12ja","item":"list__item_h12ja","unorderedItem":"list__unorderedItem_h12ja","orderedItem":"list__orderedItem_h12ja","slot":"list__slot_h12ja"};
6
- require('./index.css')
7
-
8
- var List = function (_a) {
9
- var _b, _c;
10
- var _d = _a.tag, tag = _d === void 0 ? 'ul' : _d, marker = _a.marker, className = _a.className, dataTestId = _a.dataTestId, children = _a.children, restProps = __rest(_a, ["tag", "marker", "className", "dataTestId", "children"]);
11
- var markerType = marker || (tag === 'ul' ? '—' : 'decimal');
12
- var orderedMarker = markerType === 'decimal' || markerType === 'lower-alpha';
13
- var Component = tag === 'ol' || orderedMarker ? 'ol' : 'ul';
14
- var unorderedList = Component === 'ul';
15
- var orderedList = Component === 'ol';
16
- var listClassNames = cn(styles.list, (_b = {},
17
- _b[styles.lowerAlpha] = markerType === 'lower-alpha',
18
- _b[styles.decimal] = markerType === 'decimal',
19
- _b[styles.orderedList] = orderedList,
20
- _b), className);
21
- var itemClassNames = cn(styles.item, (_c = {},
22
- _c[styles.unorderedItem] = unorderedList,
23
- _c[styles.orderedItem] = orderedList,
24
- _c));
25
- return (React.createElement(Component, __assign({ className: listClassNames, "data-test-id": dataTestId }, restProps), Children.map(children, function (child) { return (React.createElement("li", { className: itemClassNames },
26
- unorderedList && React.createElement("div", { className: styles.slot }, markerType),
27
- child)); })));
28
- };
29
-
30
- export { List };
1
+ import 'tslib';
2
+ import 'react';
3
+ import 'classnames';
4
+ export { a as List, L as ListContext } from './Component-5084b3b8.js';
5
+ import './utils.js';
6
+ import '@alfalab/core-components-typography/esm';
File without changes
@@ -0,0 +1,6 @@
1
+ import 'react';
2
+ import 'classnames';
3
+ import '@alfalab/core-components-typography/esm';
4
+ export { I as Item } from '../../Component-5084b3b8.js';
5
+ import 'tslib';
6
+ import '../../utils.js';
@@ -0,0 +1,49 @@
1
+ /* hash: vfky2 */
2
+ :root {
3
+ } /* deprecated */ :root {
4
+ --color-light-text-primary: #0b1f35; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
5
+ } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
6
+ } :root {
7
+ } :root {
8
+
9
+ /* Hard */
10
+
11
+ /* Up */
12
+
13
+ /* Hard up */
14
+ } :root {
15
+ } :root {
16
+ --gap-3xs: 2px;
17
+ --gap-2xs: 4px;
18
+ --gap-s: 12px;
19
+ } :root {
20
+ } :root {
21
+ } :root {
22
+ --list-marker-color: var(--color-light-text-primary);
23
+ --list-item-margin: var(--gap-s);
24
+ } .list__item_opye0 {
25
+ margin-top: var(--list-item-margin);
26
+ display: flex
27
+ } .list__item_opye0:first-child {
28
+ margin-top: 0;
29
+ } .list__item_opye0.list__reversed_opye0:first-child {
30
+ margin-top: var(--list-item-margin);
31
+ } .list__item_opye0.list__reversed_opye0:last-child {
32
+ margin-top: 0;
33
+ } .list__item_opye0.list__unorderedItem_opye0 {
34
+ display: list-item;
35
+ } .list__slot_opye0 {
36
+ min-width: 20px;
37
+ display: flex;
38
+ box-sizing: border-box;
39
+ justify-content: start;
40
+ padding-right: var(--gap-2xs);
41
+ flex-shrink: 0
42
+ } .list__slot_opye0.list__defaultColor_opye0 {
43
+ color: var(--list-marker-color);
44
+ } .list__slot_opye0.list__disc_opye0 {
45
+ justify-content: center;
46
+ padding: 0 var(--gap-2xs);
47
+ } .list__caption_opye0 {
48
+ margin-top: var(--gap-3xs);
49
+ }
@@ -0,0 +1 @@
1
+ export * from "../../Component-5084b3b8";
@@ -0,0 +1,6 @@
1
+ export { I as Item } from '../../Component-5084b3b8.js';
2
+ import 'tslib';
3
+ import 'react';
4
+ import 'classnames';
5
+ import '@alfalab/core-components-typography/esm';
6
+ import '../../utils.js';
package/esm/index.css CHANGED
@@ -1,8 +1,8 @@
1
- /* hash: 5j49g */
1
+ /* hash: 19no9 */
2
2
  :root {
3
3
  } /* deprecated */ :root {
4
- --color-light-text-primary: #0b1f35;
5
- } :root {
4
+ --color-light-text-primary: #0b1f35; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
5
+ } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
6
6
  } :root {
7
7
  } :root {
8
8
 
@@ -13,16 +13,10 @@
13
13
  /* Hard up */
14
14
  } :root {
15
15
  } :root {
16
- --gap-2xs: 4px;
17
- --gap-xs: 8px;
18
- --gap-s: 12px;
19
16
  --gap-l: 20px;
20
17
  } :root {
21
18
  } :root {
22
- } :root {
23
- --list-marker-color: var(--color-light-text-primary);
24
- --list-item-margin: var(--gap-s);
25
- } .list__list_h12ja {
19
+ } .list__list_1ngae {
26
20
  margin: 0;
27
21
  padding: 0;
28
22
  color: var(--color-light-text-primary);
@@ -32,21 +26,14 @@
32
26
  line-height: 24px;
33
27
 
34
28
  font-weight: 400;
35
- } .list__orderedList_h12ja {
36
- padding-left: var(--gap-l);
37
- } .list__lowerAlpha_h12ja {
29
+ } .list__lowerAlpha_1ngae {
38
30
  list-style-type: lower-alpha;
39
- } .list__decimal_h12ja {
31
+ padding-left: var(--gap-l);
32
+ } .list__decimal_1ngae {
40
33
  list-style-type: decimal;
41
- } .list__item_h12ja {
42
- margin-top: var(--list-item-margin)
43
- } .list__item_h12ja:first-child {
44
- margin-top: 0;
45
- } .list__unorderedItem_h12ja {
34
+ } ol.list__list_1ngae {
46
35
  display: flex;
47
- } .list__orderedItem_h12ja {
48
- padding-left: var(--gap-2xs);
49
- } .list__slot_h12ja {
50
- margin-right: var(--gap-xs);
51
- color: var(--list-marker-color);
52
- }
36
+ flex-direction: column
37
+ } ol.list__list_1ngae.list__reversed_1ngae {
38
+ flex-direction: column-reverse;
39
+ }
package/esm/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./Component";
1
+ export * from "./Component-0887e7cb";
2
2
  export * from "./presets";
package/esm/index.js CHANGED
@@ -1,5 +1,7 @@
1
- export { List } from './Component.js';
1
+ export { a as List, L as ListContext } from './Component-5084b3b8.js';
2
2
  export { listPresets } from './presets.js';
3
3
  import 'tslib';
4
4
  import 'react';
5
5
  import 'classnames';
6
+ import '@alfalab/core-components-typography/esm';
7
+ import './utils.js';
package/esm/utils.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { ReactNode } from 'react';
3
+ declare const isItemElement: (obj: JSX.Element, name?: string) => boolean;
4
+ declare const isItem: (child: ReactNode) => boolean;
5
+ export { isItemElement, isItem };
package/esm/utils.js ADDED
@@ -0,0 +1,10 @@
1
+ import { isValidElement } from 'react';
2
+
3
+ var isItemElement = function (obj, name) {
4
+ return typeof obj === 'object' && obj.type.displayName === name;
5
+ };
6
+ var isItem = function (child) {
7
+ return isValidElement(child) && isItemElement(child, 'ListItem');
8
+ };
9
+
10
+ export { isItem, isItemElement };
package/index.css CHANGED
@@ -1,8 +1,8 @@
1
- /* hash: 5j49g */
1
+ /* hash: 19no9 */
2
2
  :root {
3
3
  } /* deprecated */ :root {
4
- --color-light-text-primary: #0b1f35;
5
- } :root {
4
+ --color-light-text-primary: #0b1f35; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
5
+ } :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
6
6
  } :root {
7
7
  } :root {
8
8
 
@@ -13,16 +13,10 @@
13
13
  /* Hard up */
14
14
  } :root {
15
15
  } :root {
16
- --gap-2xs: 4px;
17
- --gap-xs: 8px;
18
- --gap-s: 12px;
19
16
  --gap-l: 20px;
20
17
  } :root {
21
18
  } :root {
22
- } :root {
23
- --list-marker-color: var(--color-light-text-primary);
24
- --list-item-margin: var(--gap-s);
25
- } .list__list_h12ja {
19
+ } .list__list_1ngae {
26
20
  margin: 0;
27
21
  padding: 0;
28
22
  color: var(--color-light-text-primary);
@@ -32,21 +26,14 @@
32
26
  line-height: 24px;
33
27
 
34
28
  font-weight: 400;
35
- } .list__orderedList_h12ja {
36
- padding-left: var(--gap-l);
37
- } .list__lowerAlpha_h12ja {
29
+ } .list__lowerAlpha_1ngae {
38
30
  list-style-type: lower-alpha;
39
- } .list__decimal_h12ja {
31
+ padding-left: var(--gap-l);
32
+ } .list__decimal_1ngae {
40
33
  list-style-type: decimal;
41
- } .list__item_h12ja {
42
- margin-top: var(--list-item-margin)
43
- } .list__item_h12ja:first-child {
44
- margin-top: 0;
45
- } .list__unorderedItem_h12ja {
34
+ } ol.list__list_1ngae {
46
35
  display: flex;
47
- } .list__orderedItem_h12ja {
48
- padding-left: var(--gap-2xs);
49
- } .list__slot_h12ja {
50
- margin-right: var(--gap-xs);
51
- color: var(--list-marker-color);
52
- }
36
+ flex-direction: column
37
+ } ol.list__list_1ngae.list__reversed_1ngae {
38
+ flex-direction: column-reverse;
39
+ }
package/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./Component";
1
+ export * from "./Component-0887e7cb";
2
2
  export * from "./presets";
package/index.js CHANGED
@@ -1,12 +1,15 @@
1
1
  'use strict';
2
2
 
3
- var Component = require('./Component.js');
3
+ var components_item_Component = require('./Component-71bc37e9.js');
4
4
  var presets = require('./presets.js');
5
5
  require('tslib');
6
6
  require('react');
7
7
  require('classnames');
8
+ require('@alfalab/core-components-typography');
9
+ require('./utils.js');
8
10
 
9
11
 
10
12
 
11
- exports.List = Component.List;
13
+ exports.List = components_item_Component.List;
14
+ exports.ListContext = components_item_Component.ListContext;
12
15
  exports.listPresets = presets.listPresets;
@@ -0,0 +1,72 @@
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ import { ReactNode } from "react";
4
+ type TListContext = {
5
+ /**
6
+ * Упорядоченный список
7
+ */
8
+ orderedList?: boolean;
9
+ /**
10
+ * Маркер
11
+ * @default '—' for ul and 'decimal' for ol
12
+ */
13
+ markerType?: 'lower-alpha' | 'decimal' | string | ReactNode;
14
+ /**
15
+ * Цвет маркера
16
+ */
17
+ colorMarker?: ColorMarkerType;
18
+ /**
19
+ * Список обратного счета
20
+ */
21
+ reversed?: boolean;
22
+ /**
23
+ * Номер пункта
24
+ */
25
+ index?: number;
26
+ /**
27
+ * Начало отсчета элементов списка
28
+ */
29
+ start?: number;
30
+ };
31
+ declare const ListContext: React.Context<TListContext>;
32
+ type ColorMarkerType = 'tertiary' | 'accent' | 'primary' | 'attention' | 'positive' | 'secondary' | 'tertiary-inverted' | 'primary-inverted' | 'secondary-inverted' | 'link' | 'negative';
33
+ type ListProps = {
34
+ /**
35
+ * HTML тег
36
+ * @default 'ul'
37
+ */
38
+ tag?: 'ul' | 'ol';
39
+ /**
40
+ * Маркер
41
+ * @default '—' for ul and 'decimal' for ol
42
+ */
43
+ marker?: 'lower-alpha' | 'decimal' | string | ReactNode;
44
+ /**
45
+ * Css-класс для стилизации
46
+ */
47
+ className?: string;
48
+ /**
49
+ * Цвет маркера
50
+ */
51
+ colorMarker?: ColorMarkerType;
52
+ /**
53
+ * Список обратного счета
54
+ */
55
+ reversed?: boolean;
56
+ /**
57
+ * Начало отсчета элементов списка
58
+ */
59
+ start?: number;
60
+ /**
61
+ * Id компонента для тестов
62
+ */
63
+ dataTestId?: string;
64
+ /**
65
+ * Дочерние элементы
66
+ */
67
+ children?: ReactNode;
68
+ } & Omit<React.OlHTMLAttributes<HTMLOListElement>, 'type'>;
69
+ declare const List: React.FC<ListProps> & {
70
+ Item: React.FC<import("./components/item/index").ItemProps>;
71
+ };
72
+ export { TListContext, ListContext, ListProps, List };
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import React from 'react';
3
+ import { ReactNode } from "react";
4
+ type ItemProps = {
5
+ /**
6
+ * Дополнительный текст
7
+ */
8
+ caption?: string;
9
+ /**
10
+ * Дочерние элементы.
11
+ */
12
+ children?: ReactNode;
13
+ };
14
+ declare const Item: React.FC<ItemProps>;
15
+ export { ItemProps, Item };