@alfalab/core-components-list 3.1.1 → 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 -70
  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 -69
  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 +7 -2
  23. package/cssm/index.module.css +18 -37
  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 -68
  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 +19 -38
  37. package/esm/index.d.ts +1 -1
  38. package/esm/index.js +4 -1
  39. package/esm/utils.d.ts +5 -0
  40. package/esm/utils.js +10 -0
  41. package/index.css +19 -38
  42. package/index.d.ts +1 -1
  43. package/index.js +6 -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 +19 -38
  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 +4 -2
  60. package/utils.d.ts +5 -0
  61. package/utils.js +13 -0
package/index.css CHANGED
@@ -1,26 +1,22 @@
1
- /* hash: h40dj */
2
- :root {
3
- --color-light-text-primary: #0b1f35;
4
- }
1
+ /* hash: 19no9 */
5
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 {
6
8
 
7
9
  /* Hard */
8
10
 
9
11
  /* Up */
10
12
 
11
13
  /* Hard up */
12
- }
13
- :root {
14
- --gap-2xs: 4px;
15
- --gap-xs: 8px;
16
- --gap-s: 12px;
14
+ } :root {
15
+ } :root {
17
16
  --gap-l: 20px;
18
- }
19
- :root {
20
- --list-marker-color: var(--color-light-text-primary);
21
- --list-item-margin: var(--gap-s);
22
- }
23
- .list__list_dvhxd {
17
+ } :root {
18
+ } :root {
19
+ } .list__list_1ngae {
24
20
  margin: 0;
25
21
  padding: 0;
26
22
  color: var(--color-light-text-primary);
@@ -30,29 +26,14 @@
30
26
  line-height: 24px;
31
27
 
32
28
  font-weight: 400;
33
- }
34
- .list__orderedList_dvhxd {
35
- padding-left: var(--gap-l);
36
- }
37
- .list__lowerAlpha_dvhxd {
29
+ } .list__lowerAlpha_1ngae {
38
30
  list-style-type: lower-alpha;
39
- }
40
- .list__decimal_dvhxd {
31
+ padding-left: var(--gap-l);
32
+ } .list__decimal_1ngae {
41
33
  list-style-type: decimal;
42
- }
43
- .list__item_dvhxd {
44
- margin-top: var(--list-item-margin)
45
- }
46
- .list__item_dvhxd:first-child {
47
- margin-top: 0;
48
- }
49
- .list__unorderedItem_dvhxd {
34
+ } ol.list__list_1ngae {
50
35
  display: flex;
51
- }
52
- .list__orderedItem_dvhxd {
53
- padding-left: var(--gap-2xs);
54
- }
55
- .list__slot_dvhxd {
56
- margin-right: var(--gap-xs);
57
- color: var(--list-marker-color);
58
- }
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,11 +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
+ require('tslib');
5
6
  require('react');
6
7
  require('classnames');
8
+ require('@alfalab/core-components-typography');
9
+ require('./utils.js');
7
10
 
8
11
 
9
12
 
10
- exports.List = Component.List;
13
+ exports.List = components_item_Component.List;
14
+ exports.ListContext = components_item_Component.ListContext;
11
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 };
@@ -0,0 +1,52 @@
1
+ import React, { useContext, Children } from 'react';
2
+ import cn from 'classnames';
3
+ import { Typography } from '@alfalab/core-components-typography/modern';
4
+ import { isItem } from './utils.js';
5
+
6
+ const 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"};
7
+ require('./components/item/index.css')
8
+
9
+ const Item = ({ caption, children }) => {
10
+ const { orderedList, markerType, colorMarker, reversed, index = 0, start = 0, } = useContext(ListContext);
11
+ const markerLowerAlpha = markerType === 'lower-alpha';
12
+ const itemClassNames = cn(styles$1.item, {
13
+ [styles$1.unorderedItem]: markerLowerAlpha,
14
+ [styles$1.reversed]: reversed,
15
+ });
16
+ const isDisc = markerType === '•';
17
+ const count = start === 0 ? index + 1 : start + index;
18
+ const marker = orderedList || markerType === 'decimal' ? `${count}.` : markerType;
19
+ return (React.createElement("li", { className: cn(itemClassNames) },
20
+ !markerLowerAlpha && (React.createElement(Typography.Text, { tag: 'div', color: colorMarker, monospaceNumbers: true, view: 'primary-medium', className: cn(styles$1.slot, {
21
+ [styles$1.disc]: isDisc && !orderedList,
22
+ [styles$1.defaultColor]: !colorMarker,
23
+ }) }, marker)),
24
+ React.createElement("div", null,
25
+ React.createElement(Typography.Text, { tag: 'div', view: 'primary-medium' }, children),
26
+ caption && (React.createElement(Typography.Text, { tag: 'div', view: 'primary-small', color: 'secondary', className: styles$1.caption }, caption)))));
27
+ };
28
+ Item.displayName = 'ListItem';
29
+
30
+ const styles = {"list":"list__list_1ngae","lowerAlpha":"list__lowerAlpha_1ngae","decimal":"list__decimal_1ngae","reversed":"list__reversed_1ngae"};
31
+ require('./index.css')
32
+
33
+ const ListContext = React.createContext({});
34
+ const ListComponent = ({ tag = 'ul', marker, className, dataTestId, colorMarker, children, reversed, start, ...restProps }) => {
35
+ const markerType = marker || (tag === 'ul' ? '—' : 'decimal');
36
+ const alphaMarker = markerType === 'lower-alpha';
37
+ const decimalMarker = markerType === 'decimal';
38
+ const Component = tag === 'ul' || alphaMarker ? 'ul' : 'ol';
39
+ const orderedList = Component === 'ol';
40
+ const listClassNames = cn(styles.list, {
41
+ [styles.lowerAlpha]: alphaMarker,
42
+ [styles.decimal]: decimalMarker,
43
+ [styles.reversed]: reversed,
44
+ }, className);
45
+ /* eslint-disable react/jsx-no-constructed-context-values */
46
+ return (React.createElement(Component, { className: listClassNames, "data-test-id": dataTestId, ...restProps }, Children.map(children, (child, index) => (React.createElement(ListContext.Provider, { value: { orderedList, markerType, colorMarker, reversed, index, start } }, isItem(child) ? child : React.createElement(Item, null, child))))));
47
+ };
48
+ const List = Object.assign(ListComponent, {
49
+ Item,
50
+ });
51
+
52
+ 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 };
@@ -1,27 +1,5 @@
1
- import React, { Children } from 'react';
2
- import cn from 'classnames';
3
-
4
- const styles = {"list":"list__list_dvhxd","orderedList":"list__orderedList_dvhxd","lowerAlpha":"list__lowerAlpha_dvhxd","decimal":"list__decimal_dvhxd","item":"list__item_dvhxd","unorderedItem":"list__unorderedItem_dvhxd","orderedItem":"list__orderedItem_dvhxd","slot":"list__slot_dvhxd"};
5
- require('./index.css')
6
-
7
- const List = ({ tag = 'ul', marker, className, dataTestId, children, ...restProps }) => {
8
- const markerType = marker || (tag === 'ul' ? '—' : 'decimal');
9
- const orderedMarker = markerType === 'decimal' || markerType === 'lower-alpha';
10
- const Component = tag === 'ol' || orderedMarker ? 'ol' : 'ul';
11
- const unorderedList = Component === 'ul';
12
- const orderedList = Component === 'ol';
13
- const listClassNames = cn(styles.list, {
14
- [styles.lowerAlpha]: markerType === 'lower-alpha',
15
- [styles.decimal]: markerType === 'decimal',
16
- [styles.orderedList]: orderedList,
17
- }, className);
18
- const itemClassNames = cn(styles.item, {
19
- [styles.unorderedItem]: unorderedList,
20
- [styles.orderedItem]: orderedList,
21
- });
22
- return (React.createElement(Component, { className: listClassNames, "data-test-id": dataTestId, ...restProps }, Children.map(children, (child) => (React.createElement("li", { className: itemClassNames },
23
- unorderedList && React.createElement("div", { className: styles.slot }, markerType),
24
- child)))));
25
- };
26
-
27
- export { List };
1
+ import 'react';
2
+ import 'classnames';
3
+ export { a as List, L as ListContext } from './Component-368bf140.js';
4
+ import './utils.js';
5
+ import '@alfalab/core-components-typography/modern';
File without changes
@@ -0,0 +1,5 @@
1
+ import 'react';
2
+ import 'classnames';
3
+ import '@alfalab/core-components-typography/modern';
4
+ export { I as Item } from '../../Component-368bf140.js';
5
+ 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-368bf140";
@@ -0,0 +1,5 @@
1
+ export { I as Item } from '../../Component-368bf140.js';
2
+ import 'react';
3
+ import 'classnames';
4
+ import '@alfalab/core-components-typography/modern';
5
+ import '../../utils.js';
package/modern/index.css CHANGED
@@ -1,26 +1,22 @@
1
- /* hash: h40dj */
2
- :root {
3
- --color-light-text-primary: #0b1f35;
4
- }
1
+ /* hash: 19no9 */
5
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 {
6
8
 
7
9
  /* Hard */
8
10
 
9
11
  /* Up */
10
12
 
11
13
  /* Hard up */
12
- }
13
- :root {
14
- --gap-2xs: 4px;
15
- --gap-xs: 8px;
16
- --gap-s: 12px;
14
+ } :root {
15
+ } :root {
17
16
  --gap-l: 20px;
18
- }
19
- :root {
20
- --list-marker-color: var(--color-light-text-primary);
21
- --list-item-margin: var(--gap-s);
22
- }
23
- .list__list_dvhxd {
17
+ } :root {
18
+ } :root {
19
+ } .list__list_1ngae {
24
20
  margin: 0;
25
21
  padding: 0;
26
22
  color: var(--color-light-text-primary);
@@ -30,29 +26,14 @@
30
26
  line-height: 24px;
31
27
 
32
28
  font-weight: 400;
33
- }
34
- .list__orderedList_dvhxd {
35
- padding-left: var(--gap-l);
36
- }
37
- .list__lowerAlpha_dvhxd {
29
+ } .list__lowerAlpha_1ngae {
38
30
  list-style-type: lower-alpha;
39
- }
40
- .list__decimal_dvhxd {
31
+ padding-left: var(--gap-l);
32
+ } .list__decimal_1ngae {
41
33
  list-style-type: decimal;
42
- }
43
- .list__item_dvhxd {
44
- margin-top: var(--list-item-margin)
45
- }
46
- .list__item_dvhxd:first-child {
47
- margin-top: 0;
48
- }
49
- .list__unorderedItem_dvhxd {
34
+ } ol.list__list_1ngae {
50
35
  display: flex;
51
- }
52
- .list__orderedItem_dvhxd {
53
- padding-left: var(--gap-2xs);
54
- }
55
- .list__slot_dvhxd {
56
- margin-right: var(--gap-xs);
57
- color: var(--list-marker-color);
58
- }
36
+ flex-direction: column
37
+ } ol.list__list_1ngae.list__reversed_1ngae {
38
+ flex-direction: column-reverse;
39
+ }
package/modern/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./Component";
1
+ export * from "./Component-0887e7cb";
2
2
  export * from "./presets";
package/modern/index.js CHANGED
@@ -1,4 +1,6 @@
1
- export { List } from './Component.js';
1
+ export { a as List, L as ListContext } from './Component-368bf140.js';
2
2
  export { listPresets } from './presets.js';
3
3
  import 'react';
4
4
  import 'classnames';
5
+ import '@alfalab/core-components-typography/modern';
6
+ import './utils.js';
@@ -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 };
@@ -0,0 +1,6 @@
1
+ import { isValidElement } from 'react';
2
+
3
+ const isItemElement = (obj, name) => typeof obj === 'object' && obj.type.displayName === name;
4
+ const isItem = (child) => isValidElement(child) && isItemElement(child, 'ListItem');
5
+
6
+ export { isItem, isItemElement };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-list",
3
- "version": "3.1.1",
3
+ "version": "3.2.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -17,6 +17,8 @@
17
17
  "react": "^16.9.0 || ^17.0.1 || ^18.0.0"
18
18
  },
19
19
  "dependencies": {
20
- "classnames": "^2.3.1"
20
+ "@alfalab/core-components-typography": "^3.1.1",
21
+ "classnames": "^2.3.1",
22
+ "tslib": "^2.4.0"
21
23
  }
22
24
  }
package/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/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;