@consta/uikit 4.6.4 → 4.7.1

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 (138) hide show
  1. package/ListCanary/index.d.ts +1 -0
  2. package/ListCanary/index.js +1 -0
  3. package/__internal__/src/components/AutoCompleteCanary/useAutoComplete.d.ts +1 -6
  4. package/__internal__/src/components/Breadcrumbs/useElements.d.ts +6 -6
  5. package/__internal__/src/components/Breadcrumbs/useElements.js +1 -1
  6. package/__internal__/src/components/Breadcrumbs/useElements.js.map +1 -1
  7. package/__internal__/src/components/ContextMenu/ContextMenu.js +1 -1
  8. package/__internal__/src/components/ContextMenu/ContextMenu.js.map +1 -1
  9. package/__internal__/src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.css +1 -1
  10. package/__internal__/src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.js +1 -1
  11. package/__internal__/src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.js.map +1 -1
  12. package/__internal__/src/components/ContextMenu/ContextMenuLevel/index.d.ts +1 -0
  13. package/__internal__/src/components/ContextMenu/ContextMenuLevel/index.js +2 -0
  14. package/__internal__/src/components/ContextMenu/ContextMenuLevel/index.js.map +1 -0
  15. package/__internal__/src/components/ContextMenu/ContextMenuLevels/ContextMenuLevels.js +1 -1
  16. package/__internal__/src/components/ContextMenu/ContextMenuLevels/ContextMenuLevels.js.map +1 -1
  17. package/__internal__/src/components/ContextMenu/ContextMenuLevels/index.d.ts +1 -0
  18. package/__internal__/src/components/ContextMenu/ContextMenuLevels/index.js +2 -0
  19. package/__internal__/src/components/ContextMenu/ContextMenuLevels/index.js.map +1 -0
  20. package/__internal__/src/components/ContextMenu/helpers.d.ts +4 -2
  21. package/__internal__/src/components/ContextMenu/types.d.ts +6 -1
  22. package/__internal__/src/components/ContextMenu/types.js +1 -1
  23. package/__internal__/src/components/ContextMenu/types.js.map +1 -1
  24. package/__internal__/src/components/ListCanary/ListAddItem/ListAddItem.d.ts +3 -0
  25. package/__internal__/src/components/ListCanary/ListAddItem/ListAddItem.js +2 -0
  26. package/__internal__/src/components/ListCanary/ListAddItem/ListAddItem.js.map +1 -0
  27. package/__internal__/src/components/ListCanary/ListAddItem/index.d.ts +1 -0
  28. package/__internal__/src/components/ListCanary/ListAddItem/index.js +2 -0
  29. package/__internal__/src/components/ListCanary/ListAddItem/index.js.map +1 -0
  30. package/__internal__/src/components/ListCanary/ListBox/ListBox.css +1 -0
  31. package/__internal__/src/components/ListCanary/ListBox/ListBox.d.ts +3 -0
  32. package/__internal__/src/components/ListCanary/ListBox/ListBox.js +2 -0
  33. package/__internal__/src/components/ListCanary/ListBox/ListBox.js.map +1 -0
  34. package/__internal__/src/components/ListCanary/ListBox/cnListBox.d.ts +2 -0
  35. package/__internal__/src/components/ListCanary/ListBox/cnListBox.js +2 -0
  36. package/__internal__/src/components/ListCanary/ListBox/cnListBox.js.map +1 -0
  37. package/__internal__/src/components/ListCanary/ListBox/index.d.ts +3 -0
  38. package/__internal__/src/components/ListCanary/ListBox/index.js +2 -0
  39. package/__internal__/src/components/ListCanary/ListBox/index.js.map +1 -0
  40. package/__internal__/src/components/ListCanary/ListBox/mapVerticalSpase.d.ts +3 -0
  41. package/__internal__/src/components/ListCanary/ListBox/mapVerticalSpase.js +2 -0
  42. package/__internal__/src/components/ListCanary/ListBox/mapVerticalSpase.js.map +1 -0
  43. package/__internal__/src/components/ListCanary/ListCanary.d.ts +3 -0
  44. package/__internal__/src/components/ListCanary/ListCanary.js +2 -0
  45. package/__internal__/src/components/ListCanary/ListCanary.js.map +1 -0
  46. package/__internal__/src/components/ListCanary/ListDivider/ListDivider.css +1 -0
  47. package/__internal__/src/components/ListCanary/ListDivider/ListDivider.d.ts +5 -0
  48. package/__internal__/src/components/ListCanary/ListDivider/ListDivider.js +2 -0
  49. package/__internal__/src/components/ListCanary/ListDivider/ListDivider.js.map +1 -0
  50. package/__internal__/src/components/ListCanary/ListDivider/index.d.ts +1 -0
  51. package/__internal__/src/components/ListCanary/ListDivider/index.js +2 -0
  52. package/__internal__/src/components/ListCanary/ListDivider/index.js.map +1 -0
  53. package/__internal__/src/components/ListCanary/ListGroupLabel/ListGroupLabel.css +1 -0
  54. package/__internal__/src/components/ListCanary/ListGroupLabel/ListGroupLabel.d.ts +5 -0
  55. package/__internal__/src/components/ListCanary/ListGroupLabel/ListGroupLabel.js +2 -0
  56. package/__internal__/src/components/ListCanary/ListGroupLabel/ListGroupLabel.js.map +1 -0
  57. package/__internal__/src/components/ListCanary/ListGroupLabel/index.d.ts +1 -0
  58. package/__internal__/src/components/ListCanary/ListGroupLabel/index.js +2 -0
  59. package/__internal__/src/components/ListCanary/ListGroupLabel/index.js.map +1 -0
  60. package/__internal__/src/components/ListCanary/ListItem/ListItem.css +1 -0
  61. package/__internal__/src/components/ListCanary/ListItem/ListItem.d.ts +4 -0
  62. package/__internal__/src/components/ListCanary/ListItem/ListItem.js +2 -0
  63. package/__internal__/src/components/ListCanary/ListItem/ListItem.js.map +1 -0
  64. package/__internal__/src/components/ListCanary/ListItem/index.d.ts +1 -0
  65. package/__internal__/src/components/ListCanary/ListItem/index.js +2 -0
  66. package/__internal__/src/components/ListCanary/ListItem/index.js.map +1 -0
  67. package/__internal__/src/components/ListCanary/ListItemGrid/ListItemGrid.css +1 -0
  68. package/__internal__/src/components/ListCanary/ListItemGrid/ListItemGrid.d.ts +6 -0
  69. package/__internal__/src/components/ListCanary/ListItemGrid/ListItemGrid.js +2 -0
  70. package/__internal__/src/components/ListCanary/ListItemGrid/ListItemGrid.js.map +1 -0
  71. package/__internal__/src/components/ListCanary/ListItemGrid/index.d.ts +1 -0
  72. package/__internal__/src/components/ListCanary/ListItemGrid/index.js +2 -0
  73. package/__internal__/src/components/ListCanary/ListItemGrid/index.js.map +1 -0
  74. package/__internal__/src/components/ListCanary/ListLoader/ListLoader.css +1 -0
  75. package/__internal__/src/components/ListCanary/ListLoader/ListLoader.d.ts +10 -0
  76. package/__internal__/src/components/ListCanary/ListLoader/ListLoader.js +2 -0
  77. package/__internal__/src/components/ListCanary/ListLoader/ListLoader.js.map +1 -0
  78. package/__internal__/src/components/ListCanary/ListLoader/index.d.ts +1 -0
  79. package/__internal__/src/components/ListCanary/ListLoader/index.js +2 -0
  80. package/__internal__/src/components/ListCanary/ListLoader/index.js.map +1 -0
  81. package/__internal__/src/components/ListCanary/helper.d.ts +57 -0
  82. package/__internal__/src/components/ListCanary/helper.js +2 -0
  83. package/__internal__/src/components/ListCanary/helper.js.map +1 -0
  84. package/__internal__/src/components/ListCanary/index.d.ts +10 -0
  85. package/__internal__/src/components/ListCanary/index.js +2 -0
  86. package/__internal__/src/components/ListCanary/index.js.map +1 -0
  87. package/__internal__/src/components/ListCanary/maps.d.ts +9 -0
  88. package/__internal__/src/components/ListCanary/maps.js +2 -0
  89. package/__internal__/src/components/ListCanary/maps.js.map +1 -0
  90. package/__internal__/src/components/ListCanary/types.d.ts +72 -44
  91. package/__internal__/src/components/ListCanary/types.js +1 -1
  92. package/__internal__/src/components/ListCanary/types.js.map +1 -1
  93. package/__internal__/src/components/Popover/helpers.d.ts +1 -1
  94. package/__internal__/src/components/Popover/helpers.js.map +1 -1
  95. package/__internal__/src/components/Radio/Radio.css +1 -1
  96. package/__internal__/src/components/Radio/Radio.d.ts +2 -2
  97. package/__internal__/src/components/Radio/Radio.js +1 -1
  98. package/__internal__/src/components/Radio/Radio.js.map +1 -1
  99. package/__internal__/src/components/RadioGroup/RadioGroup.css +1 -1
  100. package/__internal__/src/components/RadioGroup/helper.d.ts +1 -1
  101. package/__internal__/src/components/RadioGroup/types.d.ts +1 -1
  102. package/__internal__/src/components/RadioGroup/types.js +1 -1
  103. package/__internal__/src/components/RadioGroup/types.js.map +1 -1
  104. package/__internal__/src/components/SelectComponents/SelectCreateButton/SelectCreateButton.css +1 -1
  105. package/__internal__/src/components/SelectComponents/SelectCreateButton/SelectCreateButton.d.ts +1 -1
  106. package/__internal__/src/components/SelectComponents/SelectCreateButton/SelectCreateButton.js +1 -1
  107. package/__internal__/src/components/SelectComponents/SelectCreateButton/SelectCreateButton.js.map +1 -1
  108. package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.css +1 -1
  109. package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.js +1 -1
  110. package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.js.map +1 -1
  111. package/__internal__/src/components/SelectComponents/SelectGroupLabel/SelectGroupLabel.d.ts +1 -3
  112. package/__internal__/src/components/SelectComponents/SelectGroupLabel/SelectGroupLabel.js +1 -1
  113. package/__internal__/src/components/SelectComponents/SelectGroupLabel/SelectGroupLabel.js.map +1 -1
  114. package/__internal__/src/components/SelectComponents/SelectItem/SelectItem.css +1 -1
  115. package/__internal__/src/components/SelectComponents/SelectItem/SelectItem.js +1 -1
  116. package/__internal__/src/components/SelectComponents/SelectItem/SelectItem.js.map +1 -1
  117. package/__internal__/src/components/SelectComponents/helpers.d.ts +1 -1
  118. package/__internal__/src/components/SelectComponents/helpers.js +1 -1
  119. package/__internal__/src/components/SelectComponents/helpers.js.map +1 -1
  120. package/__internal__/src/components/TagBase/TagBase.d.ts +1 -1
  121. package/__internal__/src/components/UserSelect/UserSelectItem/UserSelectItem.css +1 -1
  122. package/__internal__/src/components/UserSelect/UserSelectItem/UserSelectItem.d.ts +1 -1
  123. package/__internal__/src/components/UserSelect/UserSelectItem/UserSelectItem.js +1 -1
  124. package/__internal__/src/components/UserSelect/UserSelectItem/UserSelectItem.js.map +1 -1
  125. package/__internal__/src/hooks/useRefs/useRefs.d.ts +3 -1
  126. package/__internal__/src/hooks/useRefs/useRefs.js +1 -1
  127. package/__internal__/src/hooks/useRefs/useRefs.js.map +1 -1
  128. package/__internal__/src/hooks/useSelect/useSelect.d.ts +1 -6
  129. package/__internal__/src/mixs/MixSpace/MixSpace.d.ts +17 -17
  130. package/__internal__/src/mixs/MixSpace/MixSpace.js.map +1 -1
  131. package/__internal__/src/utils/getGroups.d.ts +1 -1
  132. package/__internal__/src/utils/getGroups.js.map +1 -1
  133. package/package.json +1 -1
  134. package/__internal__/src/components/ContextMenu/ContextMenuItem/ContextMenuItem.css +0 -1
  135. package/__internal__/src/components/ContextMenu/ContextMenuItem/ContextMenuItem.d.ts +0 -4
  136. package/__internal__/src/components/ContextMenu/ContextMenuItem/ContextMenuItem.js +0 -2
  137. package/__internal__/src/components/ContextMenu/ContextMenuItem/ContextMenuItem.js.map +0 -1
  138. package/__internal__/src/components/SelectComponents/SelectGroupLabel/SelectGroupLabel.css +0 -1
@@ -1,104 +1,132 @@
1
1
  import { IconComponent } from '@consta/icons/Icon';
2
2
  import React from 'react';
3
+ import { MixSpaceProps } from "../../mixs/MixSpace";
4
+ import { Group } from "../../utils/getGroups";
5
+ import { PropsWithAsAttributes } from "../../utils/types/PropsWithAsAttributes";
3
6
  import { PropsWithHTMLAttributesAndRef } from "../../utils/types/PropsWithHTMLAttributes";
4
- import { RenderItemProps } from '../SelectComponents/types';
5
- export declare const listPropForm: readonly ["default", "brick", "round"];
6
- export declare type ListPropForm = typeof listPropForm[number];
7
- export declare const defaultListPropForm: "default";
8
7
  export declare const listPropSize: readonly ["m", "xs", "s", "l"];
9
8
  export declare type ListPropSize = typeof listPropSize[number];
10
9
  export declare const defaultListPropSize: "m";
10
+ export declare const listPropInnerOffset: readonly ["normal", "increased"];
11
+ export declare type ListPropInnerOffset = typeof listPropInnerOffset[number];
12
+ export declare const defaultListPropInnerOffset: "normal";
13
+ export declare const listPropStatus: readonly ["alert", "success", "warning"];
14
+ export declare type ListPropStatus = typeof listPropStatus[number];
15
+ export declare const listPropForm: readonly ["default", "brick", "round"];
16
+ export declare type ListPropForm = typeof listPropForm[number];
17
+ export declare const defaultListPropForm: "default";
11
18
  export declare type DefaultListGroup = {
12
19
  id: string | number;
13
- label: string;
20
+ label?: string;
14
21
  rightSide?: React.ReactNode;
15
22
  };
16
23
  export declare type DefaultListItem = {
17
- id: string | number;
18
- label: string;
24
+ label: React.ReactNode;
19
25
  disabled?: boolean;
26
+ active?: boolean;
27
+ checked?: boolean;
28
+ status?: ListPropStatus;
20
29
  groupId?: string | number;
21
30
  leftSide?: React.ReactNode;
22
31
  leftIcon?: IconComponent;
23
32
  rightSide?: React.ReactNode;
24
33
  rightIcon?: IconComponent;
34
+ onClick?: React.MouseEventHandler;
25
35
  };
26
- export declare type ListPropValue<ITEM, MULTIPLE extends boolean> = (MULTIPLE extends true ? ITEM[] : ITEM) | null | undefined;
27
- export declare type ListPropOnChange<ITEM, MULTIPLE extends boolean> = (props: {
28
- value: (MULTIPLE extends true ? ITEM[] : ITEM) | null;
29
- e: React.SyntheticEvent;
36
+ export declare type ListPropOnItemClick<ITEM> = (item: ITEM, params: {
37
+ e: React.MouseEvent;
38
+ item: ITEM;
30
39
  }) => void;
31
- export declare type ListPropRenderItem<ITEM> = (props: RenderItemProps<ITEM>) => React.ReactElement | null;
32
- export declare type ListPropGetItemKey<ITEM> = (item: ITEM) => string | number;
33
- export declare type ListPropGetItemLabel<ITEM> = (item: ITEM) => string;
40
+ export declare type ListPropRenderItem<ITEM> = (item: ITEM) => React.ReactElement | null;
41
+ export declare type ListPropGetItemLabel<ITEM> = (item: ITEM) => React.ReactNode;
42
+ export declare type ListPropGetItemAdditionalClassName<ITEM> = (item: ITEM) => string;
34
43
  export declare type ListPropGetItemDisabled<ITEM> = (item: ITEM) => boolean | undefined;
44
+ export declare type ListPropGetItemActive<ITEM> = (item: ITEM) => boolean | undefined;
45
+ export declare type ListPropGetItemChecked<ITEM> = (item: ITEM) => boolean | undefined;
46
+ export declare type ListPropGetItemStatus<ITEM> = (item: ITEM) => ListPropStatus | undefined;
35
47
  export declare type ListPropGetItemGroupId<ITEM> = (item: ITEM) => string | number | undefined;
36
48
  export declare type ListPropGetItemLeftSide<ITEM> = (item: ITEM) => React.ReactNode | undefined;
37
49
  export declare type ListPropGetItemLeftIcon<ITEM> = (item: ITEM) => IconComponent | undefined;
38
50
  export declare type ListPropGetItemRightSide<ITEM> = (item: ITEM) => React.ReactNode | undefined;
39
51
  export declare type ListPropGetItemRightIcon<ITEM> = (item: ITEM) => IconComponent | undefined;
52
+ export declare type ListPropGetItemAs<ITEM> = (item: ITEM) => keyof JSX.IntrinsicElements | undefined;
53
+ export declare type ListPropGetItemAttributes<ITEM> = (item: ITEM) => JSX.IntrinsicElements[keyof JSX.IntrinsicElements] | undefined;
54
+ export declare type ListPropGetItemOnClick<ITEM> = (item: ITEM) => React.MouseEventHandler | undefined;
55
+ export declare type ListPropSortGroup<ITEM, GROUP> = (a: Group<ITEM, GROUP>, b: Group<ITEM, GROUP>) => number;
40
56
  export declare type ListPropGetGroupKey<GROUP> = (item: GROUP) => string | number;
41
- export declare type ListPropGetGroupLabel<GROUP> = (item: GROUP) => string;
57
+ export declare type ListPropGetGroupAdditionalClassName<GROUP> = (item: GROUP) => string;
58
+ export declare type ListPropGetGroupLabel<GROUP> = (item: GROUP) => string | undefined;
42
59
  export declare type ListPropGetGroupRightSide<GROUP> = (item: GROUP) => React.ReactNode | undefined;
43
- export declare type ListProps<ITEM = DefaultListItem, GROUP = DefaultListGroup, MULTIPLE extends boolean = false> = PropsWithHTMLAttributesAndRef<{
60
+ export declare type ListPropGetItemRef<ITEM> = (item: ITEM) => React.RefObject<HTMLElement> | undefined;
61
+ export declare type ListProps<ITEM = DefaultListItem, GROUP = DefaultListGroup> = {
44
62
  size?: ListPropSize;
45
- form?: ListPropForm;
46
- multiple?: MULTIPLE;
47
- value?: ListPropValue<ITEM, MULTIPLE>;
48
- onChange?: ListPropOnChange<ITEM, MULTIPLE>;
49
63
  items: ITEM[];
50
- getItemKey?: ListPropGetItemKey<ITEM>;
64
+ innerOffset?: ListPropInnerOffset;
65
+ itemSpase?: MixSpaceProps;
66
+ groupLabelSpase?: MixSpaceProps;
67
+ dividerSpase?: MixSpaceProps;
68
+ onItemClick?: ListPropOnItemClick<ITEM>;
51
69
  getItemLabel?: ListPropGetItemLabel<ITEM>;
52
70
  getItemDisabled?: ListPropGetItemDisabled<ITEM>;
71
+ getItemActive?: ListPropGetItemActive<ITEM>;
72
+ getItemChecked?: ListPropGetItemActive<ITEM>;
53
73
  getItemLeftSide?: ListPropGetItemLeftSide<ITEM>;
54
74
  getItemLeftIcon?: ListPropGetItemLeftIcon<ITEM>;
55
75
  getItemRightSide?: ListPropGetItemRightSide<ITEM>;
56
76
  getItemRightIcon?: ListPropGetItemRightIcon<ITEM>;
57
77
  getItemGroupKey?: ListPropGetItemGroupId<ITEM>;
78
+ getItemOnClick?: ListPropGetItemOnClick<ITEM>;
79
+ getItemStatus?: ListPropGetItemStatus<ITEM>;
80
+ getItemAs?: ListPropGetItemAs<ITEM>;
81
+ getItemAttributes?: ListPropGetItemAttributes<ITEM>;
82
+ getItemRef?: ListPropGetItemRef<ITEM>;
83
+ getItemAdditionalClassName?: ListPropGetItemAdditionalClassName<ITEM>;
58
84
  renderItem?: ListPropRenderItem<ITEM>;
59
85
  groups?: GROUP[];
60
86
  getGroupKey?: ListPropGetGroupKey<GROUP>;
61
87
  getGroupLabel?: ListPropGetGroupLabel<GROUP>;
62
88
  getGroupRightSide?: ListPropGetGroupRightSide<GROUP>;
63
- isLoading?: boolean;
89
+ sortGroup?: ListPropSortGroup<ITEM, GROUP>;
90
+ getGroupAdditionalClassName?: ListPropGetGroupAdditionalClassName<GROUP>;
64
91
  disabled?: boolean;
65
- }, HTMLDivElement> & (ITEM extends {
92
+ } & (ITEM extends {
66
93
  label: DefaultListItem['label'];
67
94
  } ? {} : {
68
95
  getItemLabel: ListPropGetItemLabel<ITEM>;
69
- }) & (ITEM extends {
70
- id: DefaultListItem['id'];
71
- } ? {} : {
72
- getItemKey: ListPropGetItemKey<ITEM>;
73
- }) & (GROUP extends {
74
- label: DefaultListGroup['label'];
75
- } ? {} : {
76
- getGroupLabel: ListPropGetGroupLabel<GROUP>;
77
96
  }) & (GROUP extends {
78
97
  id: DefaultListGroup['id'];
79
98
  } ? {} : {
80
99
  getGroupKey: ListPropGetGroupKey<GROUP>;
81
100
  });
82
- export declare type ListComponent = <ITEM = DefaultListItem, GROUP = DefaultListGroup, MULTIPLE extends boolean = false>(props: ListProps<ITEM, GROUP, MULTIPLE>) => React.ReactElement | null;
83
- export declare type ListItemProps = PropsWithHTMLAttributesAndRef<Omit<DefaultListItem, 'id' | 'groupId'> & {
84
- active?: boolean;
85
- hovered?: boolean;
86
- multiple?: boolean;
101
+ export declare type ListComponent = <ITEM = DefaultListItem, GROUP = DefaultListGroup>(props: ListProps<ITEM, GROUP>) => React.ReactElement | null;
102
+ export declare type ListItemProps<AS extends keyof JSX.IntrinsicElements = 'div'> = PropsWithAsAttributes<Omit<DefaultListItem, 'id' | 'groupId' | 'attributes' | 'onClick'> & {
87
103
  size?: ListPropSize;
88
- indent?: 'normal' | 'increased';
89
- }, HTMLDivElement>;
104
+ innerOffset?: 'normal' | 'increased';
105
+ space?: MixSpaceProps;
106
+ }, AS> & React.RefAttributes<HTMLDivElement>;
107
+ export declare type ListItemComponent = <AS extends keyof JSX.IntrinsicElements = 'div'>(props: ListItemProps<AS>, ref: React.Ref<HTMLElement>) => React.ReactElement | null;
90
108
  export declare type ListGroupLabelProps = PropsWithHTMLAttributesAndRef<{
91
109
  size?: ListPropSize;
92
- label?: string;
110
+ label: string;
111
+ innerOffset?: ListPropInnerOffset;
93
112
  rightSide?: React.ReactNode;
113
+ space?: MixSpaceProps;
94
114
  }, HTMLDivElement>;
95
- export declare type ListAddItemProps = PropsWithHTMLAttributesAndRef<{
115
+ export declare type ListDividerProps = PropsWithHTMLAttributesAndRef<{
96
116
  size?: ListPropSize;
97
- label?: React.ReactNode;
98
- indent?: 'normal' | 'increased';
99
- disabled?: boolean;
117
+ innerOffset?: ListPropInnerOffset;
118
+ space?: MixSpaceProps;
100
119
  }, HTMLDivElement>;
101
- export declare type ListWrapperProps = PropsWithHTMLAttributesAndRef<{
120
+ export declare type ListBoxProps = PropsWithHTMLAttributesAndRef<{
102
121
  size?: ListPropSize;
103
122
  form?: ListPropForm;
123
+ border?: boolean;
124
+ shadow?: boolean;
125
+ }, HTMLDivElement>;
126
+ export declare type ListAddItemProps = PropsWithHTMLAttributesAndRef<{
127
+ size?: ListPropSize;
128
+ label: React.ReactNode;
129
+ innerOffset?: ListPropInnerOffset;
130
+ active?: boolean;
131
+ underLine?: boolean;
104
132
  }, HTMLDivElement>;
@@ -1,2 +1,2 @@
1
- export var listPropForm=["default","brick","round"];export var defaultListPropForm=listPropForm[0];export var listPropSize=["m","xs","s","l"];export var defaultListPropSize=listPropSize[0];
1
+ export var listPropSize=["m","xs","s","l"];export var defaultListPropSize=listPropSize[0];export var listPropInnerOffset=["normal","increased"];export var defaultListPropInnerOffset=listPropInnerOffset[0];export var listPropStatus=["alert","success","warning"];export var listPropForm=["default","brick","round"];export var defaultListPropForm=listPropForm[0];
2
2
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":["listPropForm","defaultListPropForm","listPropSize","defaultListPropSize"],"sources":["../../../../../src/components/ListCanary/types.ts"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\nimport React from 'react';\n\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nimport { RenderItemProps } from '../SelectComponents/types';\n\nexport const listPropForm = ['default', 'brick', 'round'] as const;\nexport type ListPropForm = typeof listPropForm[number];\nexport const defaultListPropForm = listPropForm[0];\n\nexport const listPropSize = ['m', 'xs', 's', 'l'] as const;\nexport type ListPropSize = typeof listPropSize[number];\nexport const defaultListPropSize = listPropSize[0];\n\nexport type DefaultListGroup = {\n id: string | number;\n label: string;\n rightSide?: React.ReactNode;\n};\n\nexport type DefaultListItem = {\n id: string | number;\n label: string;\n disabled?: boolean;\n groupId?: string | number;\n leftSide?: React.ReactNode;\n leftIcon?: IconComponent;\n rightSide?: React.ReactNode;\n rightIcon?: IconComponent;\n};\n\nexport type ListPropValue<ITEM, MULTIPLE extends boolean> =\n | (MULTIPLE extends true ? ITEM[] : ITEM)\n | null\n | undefined;\n\nexport type ListPropOnChange<ITEM, MULTIPLE extends boolean> = (props: {\n value: (MULTIPLE extends true ? ITEM[] : ITEM) | null;\n e: React.SyntheticEvent;\n}) => void;\n\nexport type ListPropRenderItem<ITEM> = (\n props: RenderItemProps<ITEM>,\n) => React.ReactElement | null;\n\n// ITEMS\nexport type ListPropGetItemKey<ITEM> = (item: ITEM) => string | number;\nexport type ListPropGetItemLabel<ITEM> = (item: ITEM) => string;\nexport type ListPropGetItemDisabled<ITEM> = (item: ITEM) => boolean | undefined;\nexport type ListPropGetItemGroupId<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\nexport type ListPropGetItemLeftSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | undefined;\nexport type ListPropGetItemLeftIcon<ITEM> = (\n item: ITEM,\n) => IconComponent | undefined;\nexport type ListPropGetItemRightSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | undefined;\nexport type ListPropGetItemRightIcon<ITEM> = (\n item: ITEM,\n) => IconComponent | undefined;\n\n// GROUPS\nexport type ListPropGetGroupKey<GROUP> = (item: GROUP) => string | number;\nexport type ListPropGetGroupLabel<GROUP> = (item: GROUP) => string;\nexport type ListPropGetGroupRightSide<GROUP> = (\n item: GROUP,\n) => React.ReactNode | undefined;\n\nexport type ListProps<\n ITEM = DefaultListItem,\n GROUP = DefaultListGroup,\n MULTIPLE extends boolean = false,\n> = PropsWithHTMLAttributesAndRef<\n {\n size?: ListPropSize;\n form?: ListPropForm;\n multiple?: MULTIPLE;\n value?: ListPropValue<ITEM, MULTIPLE>;\n onChange?: ListPropOnChange<ITEM, MULTIPLE>;\n items: ITEM[];\n getItemKey?: ListPropGetItemKey<ITEM>;\n getItemLabel?: ListPropGetItemLabel<ITEM>;\n getItemDisabled?: ListPropGetItemDisabled<ITEM>;\n getItemLeftSide?: ListPropGetItemLeftSide<ITEM>;\n getItemLeftIcon?: ListPropGetItemLeftIcon<ITEM>;\n getItemRightSide?: ListPropGetItemRightSide<ITEM>;\n getItemRightIcon?: ListPropGetItemRightIcon<ITEM>;\n getItemGroupKey?: ListPropGetItemGroupId<ITEM>;\n renderItem?: ListPropRenderItem<ITEM>;\n groups?: GROUP[];\n getGroupKey?: ListPropGetGroupKey<GROUP>;\n getGroupLabel?: ListPropGetGroupLabel<GROUP>;\n getGroupRightSide?: ListPropGetGroupRightSide<GROUP>;\n isLoading?: boolean;\n disabled?: boolean;\n },\n HTMLDivElement\n> &\n (ITEM extends { label: DefaultListItem['label'] }\n ? {}\n : { getItemLabel: ListPropGetItemLabel<ITEM> }) &\n (ITEM extends { id: DefaultListItem['id'] }\n ? {}\n : { getItemKey: ListPropGetItemKey<ITEM> }) &\n (GROUP extends { label: DefaultListGroup['label'] }\n ? {}\n : { getGroupLabel: ListPropGetGroupLabel<GROUP> }) &\n (GROUP extends { id: DefaultListGroup['id'] }\n ? {}\n : { getGroupKey: ListPropGetGroupKey<GROUP> });\n\nexport type ListComponent = <\n ITEM = DefaultListItem,\n GROUP = DefaultListGroup,\n MULTIPLE extends boolean = false,\n>(\n props: ListProps<ITEM, GROUP, MULTIPLE>,\n) => React.ReactElement | null;\n\nexport type ListItemProps = PropsWithHTMLAttributesAndRef<\n Omit<DefaultListItem, 'id' | 'groupId'> & {\n active?: boolean;\n hovered?: boolean;\n multiple?: boolean;\n size?: ListPropSize;\n indent?: 'normal' | 'increased';\n },\n HTMLDivElement\n>;\n\nexport type ListGroupLabelProps = PropsWithHTMLAttributesAndRef<\n {\n size?: ListPropSize;\n label?: string;\n rightSide?: React.ReactNode;\n },\n HTMLDivElement\n>;\n\nexport type ListAddItemProps = PropsWithHTMLAttributesAndRef<\n {\n size?: ListPropSize;\n label?: React.ReactNode;\n indent?: 'normal' | 'increased';\n disabled?: boolean;\n },\n HTMLDivElement\n>;\n\nexport type ListWrapperProps = PropsWithHTMLAttributesAndRef<\n {\n size?: ListPropSize;\n form?: ListPropForm;\n },\n HTMLDivElement\n>;\n"],"mappings":"AAOA,MAAO,IAAMA,aAAY,CAAG,CAAC,SAAD,CAAY,OAAZ,CAAqB,OAArB,CAArB,CAEP,MAAO,IAAMC,oBAAmB,CAAGD,YAAY,CAAC,CAAD,CAAxC,CAEP,MAAO,IAAME,aAAY,CAAG,CAAC,GAAD,CAAM,IAAN,CAAY,GAAZ,CAAiB,GAAjB,CAArB,CAEP,MAAO,IAAMC,oBAAmB,CAAGD,YAAY,CAAC,CAAD,CAAxC"}
1
+ {"version":3,"file":"types.js","names":["listPropSize","defaultListPropSize","listPropInnerOffset","defaultListPropInnerOffset","listPropStatus","listPropForm","defaultListPropForm"],"sources":["../../../../../src/components/ListCanary/types.ts"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\nimport React from 'react';\n\nimport { MixSpaceProps } from '##/mixs/MixSpace';\nimport { Group } from '##/utils/getGroups';\nimport { PropsWithAsAttributes } from '##/utils/types/PropsWithAsAttributes';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nexport const listPropSize = ['m', 'xs', 's', 'l'] as const;\nexport type ListPropSize = typeof listPropSize[number];\nexport const defaultListPropSize = listPropSize[0];\n\nexport const listPropInnerOffset = ['normal', 'increased'] as const;\nexport type ListPropInnerOffset = typeof listPropInnerOffset[number];\nexport const defaultListPropInnerOffset = listPropInnerOffset[0];\n\nexport const listPropStatus = ['alert', 'success', 'warning'] as const;\nexport type ListPropStatus = typeof listPropStatus[number];\n\nexport const listPropForm = ['default', 'brick', 'round'] as const;\nexport type ListPropForm = typeof listPropForm[number];\nexport const defaultListPropForm = listPropForm[0];\n\nexport type DefaultListGroup = {\n id: string | number;\n label?: string;\n rightSide?: React.ReactNode;\n};\n\nexport type DefaultListItem = {\n label: React.ReactNode;\n disabled?: boolean;\n active?: boolean;\n checked?: boolean;\n status?: ListPropStatus;\n groupId?: string | number;\n leftSide?: React.ReactNode;\n leftIcon?: IconComponent;\n rightSide?: React.ReactNode;\n rightIcon?: IconComponent;\n onClick?: React.MouseEventHandler;\n};\n\nexport type ListPropOnItemClick<ITEM> = (\n item: ITEM,\n params: {\n e: React.MouseEvent;\n item: ITEM;\n },\n) => void;\n\nexport type ListPropRenderItem<ITEM> = (\n item: ITEM,\n) => React.ReactElement | null;\n\n// ITEMS\n\nexport type ListPropGetItemLabel<ITEM> = (item: ITEM) => React.ReactNode;\n\nexport type ListPropGetItemAdditionalClassName<ITEM> = (item: ITEM) => string;\n\nexport type ListPropGetItemDisabled<ITEM> = (item: ITEM) => boolean | undefined;\n\nexport type ListPropGetItemActive<ITEM> = (item: ITEM) => boolean | undefined;\n\nexport type ListPropGetItemChecked<ITEM> = (item: ITEM) => boolean | undefined;\n\nexport type ListPropGetItemStatus<ITEM> = (\n item: ITEM,\n) => ListPropStatus | undefined;\n\nexport type ListPropGetItemGroupId<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\n\nexport type ListPropGetItemLeftSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | undefined;\n\nexport type ListPropGetItemLeftIcon<ITEM> = (\n item: ITEM,\n) => IconComponent | undefined;\n\nexport type ListPropGetItemRightSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | undefined;\n\nexport type ListPropGetItemRightIcon<ITEM> = (\n item: ITEM,\n) => IconComponent | undefined;\n\nexport type ListPropGetItemAs<ITEM> = (\n item: ITEM,\n) => keyof JSX.IntrinsicElements | undefined;\n\nexport type ListPropGetItemAttributes<ITEM> = (\n item: ITEM,\n) => JSX.IntrinsicElements[keyof JSX.IntrinsicElements] | undefined;\n\nexport type ListPropGetItemOnClick<ITEM> = (\n item: ITEM,\n) => React.MouseEventHandler | undefined;\n\nexport type ListPropSortGroup<ITEM, GROUP> = (\n a: Group<ITEM, GROUP>,\n b: Group<ITEM, GROUP>,\n) => number;\n\n// GROUPS\nexport type ListPropGetGroupKey<GROUP> = (item: GROUP) => string | number;\nexport type ListPropGetGroupAdditionalClassName<GROUP> = (\n item: GROUP,\n) => string;\n\nexport type ListPropGetGroupLabel<GROUP> = (item: GROUP) => string | undefined;\nexport type ListPropGetGroupRightSide<GROUP> = (\n item: GROUP,\n) => React.ReactNode | undefined;\n\nexport type ListPropGetItemRef<ITEM> = (\n item: ITEM,\n) => React.RefObject<HTMLElement> | undefined;\n\nexport type ListProps<ITEM = DefaultListItem, GROUP = DefaultListGroup> = {\n size?: ListPropSize;\n items: ITEM[];\n innerOffset?: ListPropInnerOffset;\n itemSpase?: MixSpaceProps;\n groupLabelSpase?: MixSpaceProps;\n dividerSpase?: MixSpaceProps;\n onItemClick?: ListPropOnItemClick<ITEM>;\n getItemLabel?: ListPropGetItemLabel<ITEM>;\n getItemDisabled?: ListPropGetItemDisabled<ITEM>;\n getItemActive?: ListPropGetItemActive<ITEM>;\n getItemChecked?: ListPropGetItemActive<ITEM>;\n getItemLeftSide?: ListPropGetItemLeftSide<ITEM>;\n getItemLeftIcon?: ListPropGetItemLeftIcon<ITEM>;\n getItemRightSide?: ListPropGetItemRightSide<ITEM>;\n getItemRightIcon?: ListPropGetItemRightIcon<ITEM>;\n getItemGroupKey?: ListPropGetItemGroupId<ITEM>;\n getItemOnClick?: ListPropGetItemOnClick<ITEM>;\n getItemStatus?: ListPropGetItemStatus<ITEM>;\n getItemAs?: ListPropGetItemAs<ITEM>;\n getItemAttributes?: ListPropGetItemAttributes<ITEM>;\n getItemRef?: ListPropGetItemRef<ITEM>;\n getItemAdditionalClassName?: ListPropGetItemAdditionalClassName<ITEM>;\n renderItem?: ListPropRenderItem<ITEM>;\n groups?: GROUP[];\n getGroupKey?: ListPropGetGroupKey<GROUP>;\n getGroupLabel?: ListPropGetGroupLabel<GROUP>;\n getGroupRightSide?: ListPropGetGroupRightSide<GROUP>;\n sortGroup?: ListPropSortGroup<ITEM, GROUP>;\n getGroupAdditionalClassName?: ListPropGetGroupAdditionalClassName<GROUP>;\n disabled?: boolean;\n} & (ITEM extends { label: DefaultListItem['label'] }\n ? {}\n : { getItemLabel: ListPropGetItemLabel<ITEM> }) &\n (GROUP extends { id: DefaultListGroup['id'] }\n ? {}\n : { getGroupKey: ListPropGetGroupKey<GROUP> });\n\nexport type ListComponent = <ITEM = DefaultListItem, GROUP = DefaultListGroup>(\n props: ListProps<ITEM, GROUP>,\n) => React.ReactElement | null;\n\nexport type ListItemProps<AS extends keyof JSX.IntrinsicElements = 'div'> =\n PropsWithAsAttributes<\n Omit<DefaultListItem, 'id' | 'groupId' | 'attributes' | 'onClick'> & {\n size?: ListPropSize;\n innerOffset?: 'normal' | 'increased';\n space?: MixSpaceProps;\n },\n AS\n > &\n React.RefAttributes<HTMLDivElement>;\n\nexport type ListItemComponent = <\n AS extends keyof JSX.IntrinsicElements = 'div',\n>(\n props: ListItemProps<AS>,\n ref: React.Ref<HTMLElement>,\n) => React.ReactElement | null;\n\nexport type ListGroupLabelProps = PropsWithHTMLAttributesAndRef<\n {\n size?: ListPropSize;\n label: string;\n innerOffset?: ListPropInnerOffset;\n rightSide?: React.ReactNode;\n space?: MixSpaceProps;\n },\n HTMLDivElement\n>;\n\nexport type ListDividerProps = PropsWithHTMLAttributesAndRef<\n {\n size?: ListPropSize;\n innerOffset?: ListPropInnerOffset;\n space?: MixSpaceProps;\n },\n HTMLDivElement\n>;\n\nexport type ListBoxProps = PropsWithHTMLAttributesAndRef<\n {\n size?: ListPropSize;\n form?: ListPropForm;\n border?: boolean;\n shadow?: boolean;\n },\n HTMLDivElement\n>;\n\nexport type ListAddItemProps = PropsWithHTMLAttributesAndRef<\n {\n size?: ListPropSize;\n label: React.ReactNode;\n innerOffset?: ListPropInnerOffset;\n active?: boolean;\n underLine?: boolean;\n },\n HTMLDivElement\n>;\n"],"mappings":"AAQA,MAAO,IAAMA,aAAY,CAAG,CAAC,GAAD,CAAM,IAAN,CAAY,GAAZ,CAAiB,GAAjB,CAArB,CAEP,MAAO,IAAMC,oBAAmB,CAAGD,YAAY,CAAC,CAAD,CAAxC,CAEP,MAAO,IAAME,oBAAmB,CAAG,CAAC,QAAD,CAAW,WAAX,CAA5B,CAEP,MAAO,IAAMC,2BAA0B,CAAGD,mBAAmB,CAAC,CAAD,CAAtD,CAEP,MAAO,IAAME,eAAc,CAAG,CAAC,OAAD,CAAU,SAAV,CAAqB,SAArB,CAAvB,CAGP,MAAO,IAAMC,aAAY,CAAG,CAAC,SAAD,CAAY,OAAZ,CAAqB,OAArB,CAArB,CAEP,MAAO,IAAMC,oBAAmB,CAAGD,YAAY,CAAC,CAAD,CAAxC"}
@@ -1,5 +1,5 @@
1
1
  import { Direction, Position } from './Popover';
2
- declare type Size = Pick<ClientRect, 'width' | 'height'>;
2
+ declare type Size = Pick<DOMRect, 'width' | 'height'>;
3
3
  declare type PositionsByDirection = Record<Direction, NonNullable<Position>>;
4
4
  export declare const getPositionsByDirection: ({ contentSize, anchorSize, position: { x, y }, arrowOffset, offset, }: {
5
5
  contentSize: Size;
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","names":["getPosition","x","y","Math","round","getPositionsByDirection","contentSize","anchorSize","position","arrowOffset","offset","contentWidth","width","contentHeight","height","anchorWidth","anchorHeight","anchorCenter","xForRightDirections","xForLeftDirections","xForVerticalDirections","right","center","left","yForDownDirections","yForUpDirections","yForHorizontalDirections","up","down","xForStartLeftDirections","xForStartRightDirections","yForStartUpDirections","yForStartDownDirections","upLeft","upCenter","upRight","downLeft","downCenter","downRight","rightUp","rightCenter","rightDown","leftUp","leftCenter","leftDown","downStartLeft","downStartRight","upStartLeft","upStartRight","leftStartUp","leftStartDown","rightStartUp","rightStartDown","getComputedPositionAndDirection","initialPosition","viewportSize","initialDirection","direction","possibleDirections","bannedDirections","spareDirection","positionsByDirection","filter","dir","includes","find","pos","isFittingDown","isFittingUp","isFittingLeft","isFittingRight"],"sources":["../../../../../src/components/Popover/helpers.ts"],"sourcesContent":["import { Direction, Position } from './Popover';\n\ntype Size = Pick<ClientRect, 'width' | 'height'>;\n\ntype PositionsByDirection = Record<Direction, NonNullable<Position>>;\n\nconst getPosition = (x: number, y: number): NonNullable<Position> => ({\n x: Math.round(x),\n y: Math.round(y),\n});\n\nexport const getPositionsByDirection = ({\n contentSize,\n anchorSize,\n position: { x, y },\n arrowOffset = 0,\n offset = 0,\n}: {\n contentSize: Size;\n anchorSize: Size;\n position: NonNullable<Position>;\n arrowOffset?: number;\n offset?: number;\n}): PositionsByDirection => {\n const { width: contentWidth, height: contentHeight } = contentSize;\n const { width: anchorWidth, height: anchorHeight } = anchorSize;\n const anchorCenter = {\n x: x + anchorWidth / 2,\n y: y + anchorHeight / 2,\n };\n\n const xForRightDirections = x + anchorWidth + offset;\n const xForLeftDirections = x - contentWidth - offset;\n const xForVerticalDirections = {\n right: anchorCenter.x - arrowOffset,\n center: anchorCenter.x - contentWidth / 2,\n left: anchorCenter.x - contentWidth + arrowOffset,\n };\n\n const yForDownDirections = y + anchorHeight + offset;\n const yForUpDirections = y - contentHeight - offset;\n const yForHorizontalDirections = {\n up: anchorCenter.y - contentHeight + arrowOffset,\n center: anchorCenter.y - contentHeight / 2,\n down: anchorCenter.y - arrowOffset,\n };\n\n const xForStartLeftDirections = x;\n const xForStartRightDirections = x - contentWidth + anchorWidth;\n\n const yForStartUpDirections = y;\n const yForStartDownDirections = y - contentHeight + anchorHeight;\n\n return {\n upLeft: getPosition(xForVerticalDirections.left, yForUpDirections),\n upCenter: getPosition(xForVerticalDirections.center, yForUpDirections),\n upRight: getPosition(xForVerticalDirections.right, yForUpDirections),\n\n downLeft: getPosition(xForVerticalDirections.left, yForDownDirections),\n downCenter: getPosition(xForVerticalDirections.center, yForDownDirections),\n downRight: getPosition(xForVerticalDirections.right, yForDownDirections),\n\n rightUp: getPosition(xForRightDirections, yForHorizontalDirections.up),\n rightCenter: getPosition(\n xForRightDirections,\n yForHorizontalDirections.center,\n ),\n rightDown: getPosition(xForRightDirections, yForHorizontalDirections.down),\n\n leftUp: getPosition(xForLeftDirections, yForHorizontalDirections.up),\n leftCenter: getPosition(\n xForLeftDirections,\n yForHorizontalDirections.center,\n ),\n leftDown: getPosition(xForLeftDirections, yForHorizontalDirections.down),\n\n downStartLeft: getPosition(xForStartLeftDirections, yForDownDirections),\n downStartRight: getPosition(xForStartRightDirections, yForDownDirections),\n\n upStartLeft: getPosition(xForStartLeftDirections, yForUpDirections),\n upStartRight: getPosition(xForStartRightDirections, yForUpDirections),\n\n leftStartUp: getPosition(xForLeftDirections, yForStartUpDirections),\n leftStartDown: getPosition(xForLeftDirections, yForStartDownDirections),\n\n rightStartUp: getPosition(xForRightDirections, yForStartUpDirections),\n rightStartDown: getPosition(xForRightDirections, yForStartDownDirections),\n };\n};\n\ntype ComputedPositionAndDirectionParams = {\n // Координата точки, к которой крепится поповер. Для якоря — координата левой верхней точки якоря\n position: Position;\n contentSize: Size;\n viewportSize: Size;\n anchorSize?: Size;\n offset?: number;\n arrowOffset?: number;\n direction: Direction;\n spareDirection: Direction;\n possibleDirections: readonly Direction[];\n bannedDirections: readonly Direction[];\n};\n\nexport const getComputedPositionAndDirection = ({\n position: initialPosition,\n contentSize,\n viewportSize,\n anchorSize = { width: 0, height: 0 },\n arrowOffset,\n direction: initialDirection,\n possibleDirections,\n bannedDirections,\n spareDirection,\n offset = 0,\n}: ComputedPositionAndDirectionParams): {\n direction: Direction;\n position: Position;\n} => {\n if (!initialPosition) {\n return { position: initialPosition, direction: initialDirection };\n }\n\n const positionsByDirection = getPositionsByDirection({\n contentSize,\n anchorSize,\n position: initialPosition,\n arrowOffset,\n offset,\n });\n\n const direction =\n [initialDirection, ...possibleDirections]\n .filter((dir) => !bannedDirections.includes(dir))\n .find((dir) => {\n const pos = positionsByDirection[dir];\n const { width, height } = contentSize;\n\n const isFittingDown = pos.y + height <= viewportSize.height;\n const isFittingUp = pos.y >= 0;\n\n const isFittingLeft = pos.x >= 0;\n const isFittingRight = pos.x + width <= viewportSize.width;\n\n return isFittingUp && isFittingDown && isFittingLeft && isFittingRight;\n }) || spareDirection;\n\n return {\n direction,\n position: positionsByDirection[direction],\n };\n};\n"],"mappings":"yEAMA,GAAMA,YAAW,CAAG,SAACC,CAAD,CAAYC,CAAZ,QA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,CAAXA,CAJmD,CAKnDC,MAAM,CAANA,CALmD,CAAD,CALjD,CAaG+C,CAAS,CACb,CAACD,CAAD,4BAAsBE,CAAtB,GACGI,MADH,CACU,SAACC,CAAD,QAAS,CAACJ,CAAgB,CAACK,QAAjB,CAA0BD,CAA1B,CAAV,CADV,EAEGE,IAFH,CAEQ,SAACF,CAAD,CAAS,IACPG,EAAG,CAAGL,CAAoB,CAACE,CAAD,CADnB,CAELnD,CAFK,CAEaN,CAFb,CAELM,KAFK,CAEEE,CAFF,CAEaR,CAFb,CAEEQ,MAFF,CAIPqD,CAAa,CAAGD,CAAG,CAAChE,CAAJ,CAAQY,CAAR,EAAkByC,CAAY,CAACzC,MAJxC,CAKPsD,CAAW,CAAY,CAAT,EAAAF,CAAG,CAAChE,CALX,CAOPmE,CAAa,CAAY,CAAT,EAAAH,CAAG,CAACjE,CAPb,CAQPqE,CAAc,CAAGJ,CAAG,CAACjE,CAAJ,CAAQW,CAAR,EAAiB2C,CAAY,CAAC3C,KARxC,CAUb,MAAOwD,EAAW,EAAID,CAAf,EAAgCE,CAAhC,EAAiDC,CACzD,CAbH,GAaQV,CA3BP,CA6BH,MAAO,CACLH,SAAS,CAATA,CADK,CAELjD,QAAQ,CAAEqD,CAAoB,CAACJ,CAAD,CAFzB,CAIR,CA/CM"}
1
+ {"version":3,"file":"helpers.js","names":["getPosition","x","y","Math","round","getPositionsByDirection","contentSize","anchorSize","position","arrowOffset","offset","contentWidth","width","contentHeight","height","anchorWidth","anchorHeight","anchorCenter","xForRightDirections","xForLeftDirections","xForVerticalDirections","right","center","left","yForDownDirections","yForUpDirections","yForHorizontalDirections","up","down","xForStartLeftDirections","xForStartRightDirections","yForStartUpDirections","yForStartDownDirections","upLeft","upCenter","upRight","downLeft","downCenter","downRight","rightUp","rightCenter","rightDown","leftUp","leftCenter","leftDown","downStartLeft","downStartRight","upStartLeft","upStartRight","leftStartUp","leftStartDown","rightStartUp","rightStartDown","getComputedPositionAndDirection","initialPosition","viewportSize","initialDirection","direction","possibleDirections","bannedDirections","spareDirection","positionsByDirection","filter","dir","includes","find","pos","isFittingDown","isFittingUp","isFittingLeft","isFittingRight"],"sources":["../../../../../src/components/Popover/helpers.ts"],"sourcesContent":["import { Direction, Position } from './Popover';\n\ntype Size = Pick<DOMRect, 'width' | 'height'>;\n\ntype PositionsByDirection = Record<Direction, NonNullable<Position>>;\n\nconst getPosition = (x: number, y: number): NonNullable<Position> => ({\n x: Math.round(x),\n y: Math.round(y),\n});\n\nexport const getPositionsByDirection = ({\n contentSize,\n anchorSize,\n position: { x, y },\n arrowOffset = 0,\n offset = 0,\n}: {\n contentSize: Size;\n anchorSize: Size;\n position: NonNullable<Position>;\n arrowOffset?: number;\n offset?: number;\n}): PositionsByDirection => {\n const { width: contentWidth, height: contentHeight } = contentSize;\n const { width: anchorWidth, height: anchorHeight } = anchorSize;\n const anchorCenter = {\n x: x + anchorWidth / 2,\n y: y + anchorHeight / 2,\n };\n\n const xForRightDirections = x + anchorWidth + offset;\n const xForLeftDirections = x - contentWidth - offset;\n const xForVerticalDirections = {\n right: anchorCenter.x - arrowOffset,\n center: anchorCenter.x - contentWidth / 2,\n left: anchorCenter.x - contentWidth + arrowOffset,\n };\n\n const yForDownDirections = y + anchorHeight + offset;\n const yForUpDirections = y - contentHeight - offset;\n const yForHorizontalDirections = {\n up: anchorCenter.y - contentHeight + arrowOffset,\n center: anchorCenter.y - contentHeight / 2,\n down: anchorCenter.y - arrowOffset,\n };\n\n const xForStartLeftDirections = x;\n const xForStartRightDirections = x - contentWidth + anchorWidth;\n\n const yForStartUpDirections = y;\n const yForStartDownDirections = y - contentHeight + anchorHeight;\n\n return {\n upLeft: getPosition(xForVerticalDirections.left, yForUpDirections),\n upCenter: getPosition(xForVerticalDirections.center, yForUpDirections),\n upRight: getPosition(xForVerticalDirections.right, yForUpDirections),\n\n downLeft: getPosition(xForVerticalDirections.left, yForDownDirections),\n downCenter: getPosition(xForVerticalDirections.center, yForDownDirections),\n downRight: getPosition(xForVerticalDirections.right, yForDownDirections),\n\n rightUp: getPosition(xForRightDirections, yForHorizontalDirections.up),\n rightCenter: getPosition(\n xForRightDirections,\n yForHorizontalDirections.center,\n ),\n rightDown: getPosition(xForRightDirections, yForHorizontalDirections.down),\n\n leftUp: getPosition(xForLeftDirections, yForHorizontalDirections.up),\n leftCenter: getPosition(\n xForLeftDirections,\n yForHorizontalDirections.center,\n ),\n leftDown: getPosition(xForLeftDirections, yForHorizontalDirections.down),\n\n downStartLeft: getPosition(xForStartLeftDirections, yForDownDirections),\n downStartRight: getPosition(xForStartRightDirections, yForDownDirections),\n\n upStartLeft: getPosition(xForStartLeftDirections, yForUpDirections),\n upStartRight: getPosition(xForStartRightDirections, yForUpDirections),\n\n leftStartUp: getPosition(xForLeftDirections, yForStartUpDirections),\n leftStartDown: getPosition(xForLeftDirections, yForStartDownDirections),\n\n rightStartUp: getPosition(xForRightDirections, yForStartUpDirections),\n rightStartDown: getPosition(xForRightDirections, yForStartDownDirections),\n };\n};\n\ntype ComputedPositionAndDirectionParams = {\n // Координата точки, к которой крепится поповер. Для якоря — координата левой верхней точки якоря\n position: Position;\n contentSize: Size;\n viewportSize: Size;\n anchorSize?: Size;\n offset?: number;\n arrowOffset?: number;\n direction: Direction;\n spareDirection: Direction;\n possibleDirections: readonly Direction[];\n bannedDirections: readonly Direction[];\n};\n\nexport const getComputedPositionAndDirection = ({\n position: initialPosition,\n contentSize,\n viewportSize,\n anchorSize = { width: 0, height: 0 },\n arrowOffset,\n direction: initialDirection,\n possibleDirections,\n bannedDirections,\n spareDirection,\n offset = 0,\n}: ComputedPositionAndDirectionParams): {\n direction: Direction;\n position: Position;\n} => {\n if (!initialPosition) {\n return { position: initialPosition, direction: initialDirection };\n }\n\n const positionsByDirection = getPositionsByDirection({\n contentSize,\n anchorSize,\n position: initialPosition,\n arrowOffset,\n offset,\n });\n\n const direction =\n [initialDirection, ...possibleDirections]\n .filter((dir) => !bannedDirections.includes(dir))\n .find((dir) => {\n const pos = positionsByDirection[dir];\n const { width, height } = contentSize;\n\n const isFittingDown = pos.y + height <= viewportSize.height;\n const isFittingUp = pos.y >= 0;\n\n const isFittingLeft = pos.x >= 0;\n const isFittingRight = pos.x + width <= viewportSize.width;\n\n return isFittingUp && isFittingDown && isFittingLeft && isFittingRight;\n }) || spareDirection;\n\n return {\n direction,\n position: positionsByDirection[direction],\n };\n};\n"],"mappings":"yEAMA,GAAMA,YAAW,CAAG,SAACC,CAAD,CAAYC,CAAZ,QAAkD,CACpED,CAAC,CAAEE,IAAI,CAACC,KAAL,CAAWH,CAAX,CADiE,CAEpEC,CAAC,CAAEC,IAAI,CAACC,KAAL,CAAWF,CAAX,CAFiE,CAAlD,CAApB,CAKA,MAAO,IAAMG,wBAAuB,CAAG,WAYX,IAX1BC,EAW0B,GAX1BA,WAW0B,CAV1BC,CAU0B,GAV1BA,UAU0B,KAT1BC,QAS0B,CATdP,CASc,GATdA,CASc,CATXC,CASW,GATXA,CASW,KAR1BO,WAQ0B,CAR1BA,CAQ0B,YARZ,CAQY,OAP1BC,MAO0B,CAP1BA,CAO0B,YAPjB,CAOiB,GACXC,CADW,CAC6BL,CAD7B,CAClBM,KADkB,CACWC,CADX,CAC6BP,CAD7B,CACGQ,MADH,CAEXC,CAFW,CAE2BR,CAF3B,CAElBK,KAFkB,CAEUI,CAFV,CAE2BT,CAF3B,CAEEO,MAFF,CAGpBG,CAAY,CAAG,CACnBhB,CAAC,CAAEA,CAAC,CAAGc,CAAW,CAAG,CADF,CAEnBb,CAAC,CAAEA,CAAC,CAAGc,CAAY,CAAG,CAFH,CAHK,CAQpBE,CAAmB,CAAGjB,CAAC,CAAGc,CAAJ,CAAkBL,CARpB,CASpBS,CAAkB,CAAGlB,CAAC,CAAGU,CAAJ,CAAmBD,CATpB,CAUpBU,CAAsB,CAAG,CAC7BC,KAAK,CAAEJ,CAAY,CAAChB,CAAb,CAAiBQ,CADK,CAE7Ba,MAAM,CAAEL,CAAY,CAAChB,CAAb,CAAiB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ALHC,CAKG,GALHA,cAKG,KAJHlD,MAIG,CAJHA,CAIG,YAJM,CAIN,GACH,GAAI,CAAC4C,CAAL,CACE,MAAO,CAAE9C,QAAQ,CAAE8C,CAAZ,CAA6BG,SAAS,CAAED,CAAxC,CAAP,CAFC,GAKGK,EAAoB,CAAGxD,uBAAuB,CAAC,CACnDC,WAAW,CAAXA,CADmD,CAEnDC,UAAU,CAAVA,CAFmD,CAGnDC,QAAQ,CAAE8C,CAHyC,CAInD7C,WAAW,CAAXA,CAJmD,CAKnDC,MAAM,CAANA,CALmD,CAAD,CALjD,CAaG+C,CAAS,CACb,CAACD,CAAD,4BAAsBE,CAAtB,GACGI,MADH,CACU,SAACC,CAAD,QAAS,CAACJ,CAAgB,CAACK,QAAjB,CAA0BD,CAA1B,CAAV,CADV,EAEGE,IAFH,CAEQ,SAACF,CAAD,CAAS,IACPG,EAAG,CAAGL,CAAoB,CAACE,CAAD,CADnB,CAELnD,CAFK,CAEaN,CAFb,CAELM,KAFK,CAEEE,CAFF,CAEaR,CAFb,CAEEQ,MAFF,CAIPqD,CAAa,CAAGD,CAAG,CAAChE,CAAJ,CAAQY,CAAR,EAAkByC,CAAY,CAACzC,MAJxC,CAKPsD,CAAW,CAAY,CAAT,EAAAF,CAAG,CAAChE,CALX,CAOPmE,CAAa,CAAY,CAAT,EAAAH,CAAG,CAACjE,CAPb,CAQPqE,CAAc,CAAGJ,CAAG,CAACjE,CAAJ,CAAQW,CAAR,EAAiB2C,CAAY,CAAC3C,KARxC,CAUb,MAAOwD,EAAW,EAAID,CAAf,EAAgCE,CAAhC,EAAiDC,CACzD,CAbH,GAaQV,CA3BP,CA6BH,MAAO,CACLH,SAAS,CAATA,CADK,CAELjD,QAAQ,CAAEqD,CAAoB,CAACJ,CAAD,CAFzB,CAIR,CA/CM"}
@@ -1 +1 @@
1
- .Radio{cursor:pointer;display:inline-flex;font-family:var(--font-sans);position:relative}.Radio-Input{-webkit-appearance:none;border:var(--control-border-width) solid;cursor:pointer;flex-shrink:0;margin:0;position:relative;transition:border-color .15s,background-color .15s}.Radio-Input,.Radio-Input:before{border-radius:50%;box-sizing:border-box;height:var(--box-size);width:var(--box-size)}.Radio-Input:before{content:"";left:calc(50% - var(--box-size)/2);opacity:0;position:absolute;top:calc(50% - var(--box-size)/2);transform:scale(0);transition:background-color .15s,opacity .15s,transform .15s}.Radio-Label{color:var(--color-control-typo-default);font-size:var(--radio-font-size);margin-left:var(--offset)}.Radio_size_m{--radio-font-size:var(--control-text-size-m);--box-size:var(--control-box-size-m);--offset:var(--space-xs)}.Radio_size_l{--radio-font-size:var(--control-text-size-l);--box-size:var(--control-box-size-l);--offset:var(--space-s)}.Radio_view_primary:hover .Radio-Input{border-color:var(--color-control-bg-border-default-hover)}.Radio_view_primary .Radio-Input{border-color:var(--color-control-bg-border-default)}.Radio_view_primary .Radio-Input:before{background-color:var(--color-control-bg-primary)}.Radio_view_primary .Radio-Input:checked{border-color:var(--color-control-bg-primary)}.Radio_view_primary .Radio-Input:checked:before{background-color:var(--color-control-bg-primary)}.Radio_view_primary:hover .Radio-Input:checked{border-color:var(--color-control-bg-primary-hover)}.Radio_view_primary:hover .Radio-Input:checked:before{background-color:var(--color-control-bg-primary-hover)}.Radio_view_ghost:hover .Radio-Input{border-color:var(--color-control-bg-border-default-hover)}.Radio_view_ghost .Radio-Input{border-color:var(--color-control-bg-border-default)}.Radio_view_ghost .Radio-Input:before{background-color:var(--color-control-bg-primary)}.Radio_view_ghost .Radio-Input:checked{background-color:var(--color-control-bg-ghost);border-color:var(--color-control-bg-border-default)}.Radio_view_ghost .Radio-Input:checked:before{background-color:var(--color-control-typo-ghost)}.Radio_view_ghost:hover .Radio-Input:checked{background-color:var(--color-control-bg-ghost-hover);border-color:var(--color-control-bg-border-default)}.Radio_view_ghost:hover .Radio-Input:checked:before{background-color:var(--color-control-typo-ghost-hover)}.Radio-Input:checked:before{opacity:1;transform:scale(.4)}.Radio_disabled{pointer-events:none}.Radio_disabled .Radio-Input:disabled{background-color:var(--color-control-bg-disable);border-color:transparent}.Radio_disabled .Radio-Input:disabled:before{background-color:var(--color-control-typo-disable)}.Radio_disabled .Radio-Input:disabled~.Radio-Label{color:var(--color-control-typo-disable)}.Radio_align_center{align-items:center}.Radio_align_top{align-items:top}.Radio_align_top .Radio-Input{margin-top:var(--space-3xs)}
1
+ .Radio{cursor:pointer;display:inline-flex;font-family:var(--font-sans);position:relative}.Radio-Input{-webkit-appearance:none;border:var(--control-border-width) solid;cursor:pointer;flex-shrink:0;margin:0;position:relative;transition:border-color .15s,background-color .15s}.Radio-Input,.Radio-Input:before{border-radius:50%;box-sizing:border-box;height:var(--radio-size);width:var(--radio-size)}.Radio-Input:before{content:"";left:calc(50% - var(--radio-size)/2);opacity:0;position:absolute;top:calc(50% - var(--radio-size)/2);transform:scale(0);transition:background-color .15s,opacity .15s,transform .15s}.Radio-Label{color:var(--color-control-typo-default);font-size:var(--radio-font-size);margin-left:var(--radio-offset)}.Radio_size_xs{--radio-font-size:var(--control-text-size-xs);--radio-size:var(--control-box-size-s);--radio-offset:var(--space-xs)}.Radio_size_s{--radio-font-size:var(--control-text-size-s);--radio-size:var(--control-box-size-s);--radio-offset:var(--space-xs)}.Radio_size_m{--radio-font-size:var(--control-text-size-m);--radio-size:var(--control-box-size-m);--radio-offset:var(--space-xs)}.Radio_size_l{--radio-font-size:var(--control-text-size-l);--radio-size:var(--control-box-size-l);--radio-offset:var(--space-s)}.Radio_view_primary:hover .Radio-Input{border-color:var(--color-control-bg-border-default-hover)}.Radio_view_primary .Radio-Input{border-color:var(--color-control-bg-border-default)}.Radio_view_primary .Radio-Input:before{background-color:var(--color-control-bg-primary)}.Radio_view_primary .Radio-Input:checked{border-color:var(--color-control-bg-primary)}.Radio_view_primary .Radio-Input:checked:before{background-color:var(--color-control-bg-primary)}.Radio_view_primary:hover .Radio-Input:checked{border-color:var(--color-control-bg-primary-hover)}.Radio_view_primary:hover .Radio-Input:checked:before{background-color:var(--color-control-bg-primary-hover)}.Radio_view_ghost:hover .Radio-Input{border-color:var(--color-control-bg-border-default-hover)}.Radio_view_ghost .Radio-Input{border-color:var(--color-control-bg-border-default)}.Radio_view_ghost .Radio-Input:before{background-color:var(--color-control-bg-primary)}.Radio_view_ghost .Radio-Input:checked{background-color:var(--color-control-bg-ghost);border-color:var(--color-control-bg-border-default)}.Radio_view_ghost .Radio-Input:checked:before{background-color:var(--color-control-typo-ghost)}.Radio_view_ghost:hover .Radio-Input:checked{background-color:var(--color-control-bg-ghost-hover);border-color:var(--color-control-bg-border-default)}.Radio_view_ghost:hover .Radio-Input:checked:before{background-color:var(--color-control-typo-ghost-hover)}.Radio-Input:checked:before{opacity:1;transform:scale(.4)}.Radio_disabled{pointer-events:none}.Radio_disabled .Radio-Input:disabled{background-color:var(--color-control-bg-disable);border-color:transparent}.Radio_disabled .Radio-Input:disabled:before{background-color:var(--color-control-typo-disable)}.Radio_disabled .Radio-Input:disabled~.Radio-Label{color:var(--color-control-typo-disable)}.Radio_align_center{align-items:center}.Radio_align_top{align-items:top}.Radio_align_top .Radio-Input{margin-top:var(--space-3xs)}
@@ -1,7 +1,7 @@
1
1
  import './Radio.css';
2
2
  import React from 'react';
3
3
  import { PropsWithHTMLAttributes } from '../../utils/types/PropsWithHTMLAttributes';
4
- export declare const radioPropSize: readonly ["m", "l"];
4
+ export declare const radioPropSize: readonly ["m", "l", "s", "xs"];
5
5
  export declare type RadioPropSize = typeof radioPropSize[number];
6
6
  export declare const radioPropSizeDefault: RadioPropSize;
7
7
  export declare const radioPropView: readonly ["primary", "ghost"];
@@ -15,7 +15,7 @@ export declare type RadioPropOnChange = (object: {
15
15
  checked: boolean;
16
16
  }) => void;
17
17
  export declare type Props = {
18
- checked: boolean | undefined;
18
+ checked?: boolean;
19
19
  size?: RadioPropSize;
20
20
  view?: RadioPropView;
21
21
  align?: RadioPropAlign;
@@ -1,2 +1,2 @@
1
- import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["checked","name","size","view","align","disabled","className","label","onChange","onFocus","onBlur","readOnly","required","step","tabIndex","inputId","inputRef"];import"./Radio.css";import React,{useRef}from"react";import{useForkRef}from"../../hooks/useForkRef/useForkRef";import{cnMixFocus}from"../../mixs/MixFocus/MixFocus";import{cn}from"../../utils/bem";import{usePropsHandler}from"../EventInterceptor/usePropsHandler";export var radioPropSize=["m","l"];export var radioPropSizeDefault=radioPropSize[0];export var radioPropView=["primary","ghost"];export var radioPropViewDefault=radioPropView[0];export var radioPropAlign=["center","top"];export var radioPropAlignDefault=radioPropAlign[0];export var cnRadio=cn("Radio");export var COMPONENT_NAME="Radio";export var Radio=React.forwardRef(function(a,b){var c=useRef(null),d=usePropsHandler(COMPONENT_NAME,a,c),e=d.checked,f=void 0!==e&&e,g=d.name,h=d.size,i=void 0===h?radioPropSizeDefault:h,j=d.view,k=void 0===j?radioPropViewDefault:j,l=d.align,m=void 0===l?radioPropAlignDefault:l,n=d.disabled,o=d.className,p=d.label,q=d.onChange,r=d.onFocus,s=d.onBlur,t=d.readOnly,u=d.required,v=d.step,w=d.tabIndex,x=d.inputId,y=d.inputRef,z=_objectWithoutProperties(d,_excluded);return React.createElement("label",Object.assign({},z,{className:cnRadio({size:i,view:k,disabled:n,align:m},[o]),ref:useForkRef([b,c])}),React.createElement("input",{type:"radio",name:g,className:cnRadio("Input",[cnMixFocus()]),checked:f,disabled:n,onChange:function handleChange(a){q&&q({e:a,checked:!f})},onFocus:r,onBlur:s,readOnly:t,required:u,step:v,id:x,tabIndex:w,ref:y}),p&&React.createElement("span",{className:cnRadio("Label")},p))});
1
+ import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["checked","name","size","view","align","disabled","className","label","onChange","onFocus","onBlur","readOnly","required","step","tabIndex","inputId","inputRef"];import"./Radio.css";import React,{useRef}from"react";import{useForkRef}from"../../hooks/useForkRef/useForkRef";import{cnMixFocus}from"../../mixs/MixFocus/MixFocus";import{cn}from"../../utils/bem";import{usePropsHandler}from"../EventInterceptor/usePropsHandler";export var radioPropSize=["m","l","s","xs"];export var radioPropSizeDefault=radioPropSize[0];export var radioPropView=["primary","ghost"];export var radioPropViewDefault=radioPropView[0];export var radioPropAlign=["center","top"];export var radioPropAlignDefault=radioPropAlign[0];export var cnRadio=cn("Radio");export var COMPONENT_NAME="Radio";export var Radio=React.forwardRef(function(a,b){var c=useRef(null),d=usePropsHandler(COMPONENT_NAME,a,c),e=d.checked,f=void 0!==e&&e,g=d.name,h=d.size,i=void 0===h?radioPropSizeDefault:h,j=d.view,k=void 0===j?radioPropViewDefault:j,l=d.align,m=void 0===l?radioPropAlignDefault:l,n=d.disabled,o=d.className,p=d.label,q=d.onChange,r=d.onFocus,s=d.onBlur,t=d.readOnly,u=d.required,v=d.step,w=d.tabIndex,x=d.inputId,y=d.inputRef,z=_objectWithoutProperties(d,_excluded);return React.createElement("label",Object.assign({},z,{className:cnRadio({size:i,view:k,disabled:n,align:m},[o]),ref:useForkRef([b,c])}),React.createElement("input",{type:"radio",name:g,className:cnRadio("Input",[cnMixFocus()]),checked:f,disabled:n,onChange:function handleChange(a){q&&q({e:a,checked:!f})},onFocus:r,onBlur:s,readOnly:t,required:u,step:v,id:x,tabIndex:w,ref:y}),p&&React.createElement("span",{className:cnRadio("Label")},p))});
2
2
  //# sourceMappingURL=Radio.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.js","names":["React","useRef","useForkRef","cnMixFocus","cn","usePropsHandler","radioPropSize","radioPropSizeDefault","radioPropView","radioPropViewDefault","radioPropAlign","radioPropAlignDefault","cnRadio","COMPONENT_NAME","Radio","forwardRef","props","ref","radioRef","checked","name","size","view","align","disabled","className","label","onChange","onFocus","onBlur","readOnly","required","step","tabIndex","inputId","inputRef","otherProps","handleChange","e"],"sources":["../../../../../src/components/Radio/Radio.tsx"],"sourcesContent":["import './Radio.css';\n\nimport React, { ChangeEventHandler, useRef } from 'react';\n\nimport { useForkRef } from '../../hooks/useForkRef/useForkRef';\nimport { cnMixFocus } from '../../mixs/MixFocus/MixFocus';\nimport { cn } from '../../utils/bem';\nimport { PropsWithHTMLAttributes } from '../../utils/types/PropsWithHTMLAttributes';\nimport { usePropsHandler } from '../EventInterceptor/usePropsHandler';\n\nexport const radioPropSize = ['m', 'l'] as const;\nexport type RadioPropSize = typeof radioPropSize[number];\nexport const radioPropSizeDefault: RadioPropSize = radioPropSize[0];\n\nexport const radioPropView = ['primary', 'ghost'] as const;\nexport type RadioPropView = typeof radioPropView[number];\nexport const radioPropViewDefault: RadioPropView = radioPropView[0];\n\nexport const radioPropAlign = ['center', 'top'] as const;\nexport type RadioPropAlign = typeof radioPropAlign[number];\nexport const radioPropAlignDefault: RadioPropAlign = radioPropAlign[0];\n\nexport type RadioPropOnChange = (object: {\n e: React.ChangeEvent<HTMLInputElement>;\n checked: boolean;\n}) => void;\n\nexport type Props = {\n checked: boolean | undefined;\n size?: RadioPropSize;\n view?: RadioPropView;\n align?: RadioPropAlign;\n disabled?: boolean;\n className?: string;\n label?: string;\n onChange?: RadioPropOnChange;\n name?: string;\n onFocus?: React.FocusEventHandler<HTMLInputElement>;\n onBlur?: React.FocusEventHandler<HTMLInputElement>;\n autoFocus?: boolean;\n readOnly?: boolean;\n required?: boolean;\n step?: number | string;\n tabIndex?: number;\n inputRef?: React.Ref<HTMLInputElement>;\n children?: never;\n for?: string;\n inputId?: string;\n};\n\nexport type RadioProps = PropsWithHTMLAttributes<Props, HTMLLabelElement>;\n\nexport const cnRadio = cn('Radio');\n\nexport const COMPONENT_NAME = 'Radio' as const;\n\nexport const Radio = React.forwardRef<HTMLLabelElement, RadioProps>(\n (props, ref) => {\n const radioRef = useRef<HTMLLabelElement>(null);\n\n const {\n checked = false,\n name,\n size = radioPropSizeDefault,\n view = radioPropViewDefault,\n align = radioPropAlignDefault,\n disabled,\n className,\n label,\n onChange,\n onFocus,\n onBlur,\n readOnly,\n required,\n step,\n tabIndex,\n inputId,\n inputRef,\n ...otherProps\n } = usePropsHandler(COMPONENT_NAME, props, radioRef);\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (e) => {\n if (onChange) {\n onChange({ e, checked: !checked });\n }\n };\n\n return (\n <label\n {...otherProps}\n className={cnRadio({ size, view, disabled, align }, [className])}\n ref={useForkRef([ref, radioRef])}\n >\n <input\n type=\"radio\"\n name={name}\n className={cnRadio('Input', [cnMixFocus()])}\n checked={checked}\n disabled={disabled}\n onChange={handleChange}\n onFocus={onFocus}\n onBlur={onBlur}\n readOnly={readOnly}\n required={required}\n step={step}\n id={inputId}\n tabIndex={tabIndex}\n ref={inputRef}\n />\n {label && <span className={cnRadio('Label')}>{label}</span>}\n </label>\n );\n },\n);\n"],"mappings":"sQAAA,oBAEA,MAAOA,MAAP,EAAoCC,MAApC,KAAkD,OAAlD,CAEA,OAASC,UAAT,yCACA,OAASC,UAAT,oCACA,OAASC,EAAT,uBAEA,OAASC,eAAT,2CAEA,MAAO,IAAMC,cAAa,CAAG,CAAC,GAAD,CAAM,GAAN,CAAtB,CAEP,MAAO,IAAMC,qBAAmC,CAAGD,aAAa,CAAC,CAAD,CAAzD,CAEP,MAAO,IAAME,cAAa,CAAG,CAAC,SAAD,CAAY,OAAZ,CAAtB,CAEP,MAAO,IAAMC,qBAAmC,CAAGD,aAAa,CAAC,CAAD,CAAzD,CAEP,MAAO,IAAME,eAAc,CAAG,CAAC,QAAD,CAAW,KAAX,CAAvB,CAEP,MAAO,IAAMC,sBAAqC,CAAGD,cAAc,CAAC,CAAD,CAA5D,CAgCP,MAAO,IAAME,QAAO,CAAGR,EAAE,CAAC,OAAD,CAAlB,CAEP,MAAO,IAAMS,eAAc,CAAG,OAAvB,CAEP,MAAO,IAAMC,MAAK,CAAGd,KAAK,CAACe,UAAN,CACnB,SAACC,CAAD,CAAQC,CAAR,CAAgB,IACRC,EAAQ,CAAGjB,MAAM,CAAmB,IAAnB,CADT,GAsBVI,eAAe,CAACQ,cAAD,CAAiBG,CAAjB,CAAwBE,CAAxB,CAtBL,KAIZC,OAJY,CAIZA,CA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C,CAXR,CAYE,EAAE,CAAEE,CAZN,CAaE,QAAQ,CAAED,CAbZ,CAcE,GAAG,CAAEE,CAdP,EALF,CAqBGT,CAAK,EAAI,4BAAM,SAAS,CAAEd,OAAO,CAAC,OAAD,CAAxB,EAAoCc,CAApC,CArBZ,CAwBH,CAxDkB,CAAd"}
1
+ {"version":3,"file":"Radio.js","names":["React","useRef","useForkRef","cnMixFocus","cn","usePropsHandler","radioPropSize","radioPropSizeDefault","radioPropView","radioPropViewDefault","radioPropAlign","radioPropAlignDefault","cnRadio","COMPONENT_NAME","Radio","forwardRef","props","ref","radioRef","checked","name","size","view","align","disabled","className","label","onChange","onFocus","onBlur","readOnly","required","step","tabIndex","inputId","inputRef","otherProps","handleChange","e"],"sources":["../../../../../src/components/Radio/Radio.tsx"],"sourcesContent":["import './Radio.css';\n\nimport React, { ChangeEventHandler, useRef } from 'react';\n\nimport { useForkRef } from '../../hooks/useForkRef/useForkRef';\nimport { cnMixFocus } from '../../mixs/MixFocus/MixFocus';\nimport { cn } from '../../utils/bem';\nimport { PropsWithHTMLAttributes } from '../../utils/types/PropsWithHTMLAttributes';\nimport { usePropsHandler } from '../EventInterceptor/usePropsHandler';\n\nexport const radioPropSize = ['m', 'l', 's', 'xs'] as const;\nexport type RadioPropSize = typeof radioPropSize[number];\nexport const radioPropSizeDefault: RadioPropSize = radioPropSize[0];\n\nexport const radioPropView = ['primary', 'ghost'] as const;\nexport type RadioPropView = typeof radioPropView[number];\nexport const radioPropViewDefault: RadioPropView = radioPropView[0];\n\nexport const radioPropAlign = ['center', 'top'] as const;\nexport type RadioPropAlign = typeof radioPropAlign[number];\nexport const radioPropAlignDefault: RadioPropAlign = radioPropAlign[0];\n\nexport type RadioPropOnChange = (object: {\n e: React.ChangeEvent<HTMLInputElement>;\n checked: boolean;\n}) => void;\n\nexport type Props = {\n checked?: boolean;\n size?: RadioPropSize;\n view?: RadioPropView;\n align?: RadioPropAlign;\n disabled?: boolean;\n className?: string;\n label?: string;\n onChange?: RadioPropOnChange;\n name?: string;\n onFocus?: React.FocusEventHandler<HTMLInputElement>;\n onBlur?: React.FocusEventHandler<HTMLInputElement>;\n autoFocus?: boolean;\n readOnly?: boolean;\n required?: boolean;\n step?: number | string;\n tabIndex?: number;\n inputRef?: React.Ref<HTMLInputElement>;\n children?: never;\n for?: string;\n inputId?: string;\n};\n\nexport type RadioProps = PropsWithHTMLAttributes<Props, HTMLLabelElement>;\n\nexport const cnRadio = cn('Radio');\n\nexport const COMPONENT_NAME = 'Radio' as const;\n\nexport const Radio = React.forwardRef<HTMLLabelElement, RadioProps>(\n (props, ref) => {\n const radioRef = useRef<HTMLLabelElement>(null);\n\n const {\n checked = false,\n name,\n size = radioPropSizeDefault,\n view = radioPropViewDefault,\n align = radioPropAlignDefault,\n disabled,\n className,\n label,\n onChange,\n onFocus,\n onBlur,\n readOnly,\n required,\n step,\n tabIndex,\n inputId,\n inputRef,\n ...otherProps\n } = usePropsHandler(COMPONENT_NAME, props, radioRef);\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (e) => {\n if (onChange) {\n onChange({ e, checked: !checked });\n }\n };\n\n return (\n <label\n {...otherProps}\n className={cnRadio({ size, view, disabled, align }, [className])}\n ref={useForkRef([ref, radioRef])}\n >\n <input\n type=\"radio\"\n name={name}\n className={cnRadio('Input', [cnMixFocus()])}\n checked={checked}\n disabled={disabled}\n onChange={handleChange}\n onFocus={onFocus}\n onBlur={onBlur}\n readOnly={readOnly}\n required={required}\n step={step}\n id={inputId}\n tabIndex={tabIndex}\n ref={inputRef}\n />\n {label && <span className={cnRadio('Label')}>{label}</span>}\n </label>\n );\n },\n);\n"],"mappings":"sQAAA,oBAEA,MAAOA,MAAP,EAAoCC,MAApC,KAAkD,OAAlD,CAEA,OAASC,UAAT,yCACA,OAASC,UAAT,oCACA,OAASC,EAAT,uBAEA,OAASC,eAAT,2CAEA,MAAO,IAAMC,cAAa,CAAG,CAAC,GAAD,CAAM,GAAN,CAAW,GAAX,CAAgB,IA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A,CAAR,CAAcE,QAAQ,CAARA,CAAd,CAAwBD,KAAK,CAALA,CAAxB,CAAD,CAAkC,CAACE,CAAD,CAAlC,CAFpB,CAGE,GAAG,CAAEvB,UAAU,CAAC,CAACe,CAAD,CAAMC,CAAN,CAAD,CAHjB,GAKE,6BACE,IAAI,CAAC,OADP,CAEE,IAAI,CAAEE,CAFR,CAGE,SAAS,CAAER,OAAO,CAAC,OAAD,CAAU,CAACT,UAAU,EAAX,CAAV,CAHpB,CAIE,OAAO,CAAEgB,CAJX,CAKE,QAAQ,CAAEK,CALZ,CAME,QAAQ,CAlB6C,QAArDa,aAAqD,CAACC,CAAD,CAAO,CAC5DX,CAD4D,EAE9DA,CAAQ,CAAC,CAAEW,CAAC,CAADA,CAAF,CAAKnB,OAAO,CAAE,CAACA,CAAf,CAAD,CAEX,CAQG,CAOE,OAAO,CAAES,CAPX,CAQE,MAAM,CAAEC,CARV,CASE,QAAQ,CAAEC,CATZ,CAUE,QAAQ,CAAEC,CAVZ,CAWE,IAAI,CAAEC,CAXR,CAYE,EAAE,CAAEE,CAZN,CAaE,QAAQ,CAAED,CAbZ,CAcE,GAAG,CAAEE,CAdP,EALF,CAqBGT,CAAK,EAAI,4BAAM,SAAS,CAAEd,OAAO,CAAC,OAAD,CAAxB,EAAoCc,CAApC,CArBZ,CAwBH,CAxDkB,CAAd"}
@@ -1 +1 @@
1
- .RadioGroup{display:flex}.RadioGroup_direction_column{flex-direction:column}.RadioGroup_direction_column .RadioGroup-Item:not(:last-child){margin-bottom:var(--offset)}.RadioGroup_direction_row{flex-direction:row}.RadioGroup_direction_row .RadioGroup-Item:not(:last-child){margin-right:var(--offset)}.RadioGroup_size_m{--offset:var(--space-xs)}.RadioGroup_size_l{--offset:var(--space-s)}
1
+ .RadioGroup{display:flex}.RadioGroup_direction_column{flex-direction:column}.RadioGroup_direction_column .RadioGroup-Item:not(:last-child){margin-bottom:var(--offset)}.RadioGroup_direction_row{flex-direction:row}.RadioGroup_direction_row .RadioGroup-Item:not(:last-child){margin-right:var(--offset)}.RadioGroup_size_xs{--offset:var(--space-3xs)}.RadioGroup_size_s{--offset:var(--space-2xs)}.RadioGroup_size_m{--offset:var(--space-xs)}.RadioGroup_size_l{--offset:var(--space-s)}
@@ -12,7 +12,7 @@ export declare const withDefaultGetters: (props: RadioGroupProps) => {
12
12
  }) => void;
13
13
  name?: string | undefined;
14
14
  direction?: "row" | "column" | undefined;
15
- size?: "m" | "l" | undefined;
15
+ size?: "s" | "m" | "xs" | "l" | undefined;
16
16
  view?: "primary" | "ghost" | undefined;
17
17
  disabled?: boolean | undefined;
18
18
  className?: string | undefined;
@@ -7,7 +7,7 @@ export declare type RadioGroupDefaultItem = {
7
7
  export declare const radioGroupDirections: readonly ["column", "row"];
8
8
  export declare type RadioGroupDirection = typeof radioGroupDirections[number];
9
9
  export declare const radioGroupDefaultDirection: RadioGroupDirection;
10
- export declare const radioGroupSizes: readonly ["m", "l"];
10
+ export declare const radioGroupSizes: readonly ["m", "l", "xs", "s"];
11
11
  export declare type RadioGroupPropSize = typeof radioGroupSizes[number];
12
12
  export declare const radioGroupDefaultSize: RadioGroupPropSize;
13
13
  export declare const radioGroupViews: readonly ["primary", "ghost"];
@@ -1,2 +1,2 @@
1
- export var radioGroupDirections=["column","row"];export var radioGroupDefaultDirection=radioGroupDirections[0];export var radioGroupSizes=["m","l"];export var radioGroupDefaultSize=radioGroupSizes[0];export var radioGroupViews=["primary","ghost"];export var radioGroupDefaultView=radioGroupViews[0];export var radioGroupPropAlign=["center","top"];export var radioGroupPropAlignDefault=radioGroupPropAlign[0];
1
+ export var radioGroupDirections=["column","row"];export var radioGroupDefaultDirection=radioGroupDirections[0];export var radioGroupSizes=["m","l","xs","s"];export var radioGroupDefaultSize=radioGroupSizes[0];export var radioGroupViews=["primary","ghost"];export var radioGroupDefaultView=radioGroupViews[0];export var radioGroupPropAlign=["center","top"];export var radioGroupPropAlignDefault=radioGroupPropAlign[0];
2
2
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":["radioGroupDirections","radioGroupDefaultDirection","radioGroupSizes","radioGroupDefaultSize","radioGroupViews","radioGroupDefaultView","radioGroupPropAlign","radioGroupPropAlignDefault"],"sources":["../../../../../src/components/RadioGroup/types.ts"],"sourcesContent":["import { PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes';\n\nexport type RadioGroupDefaultItem = {\n label: string;\n disabled?: boolean;\n};\n\nexport const radioGroupDirections = ['column', 'row'] as const;\nexport type RadioGroupDirection = typeof radioGroupDirections[number];\nexport const radioGroupDefaultDirection: RadioGroupDirection =\n radioGroupDirections[0];\n\nexport const radioGroupSizes = ['m', 'l'] as const;\nexport type RadioGroupPropSize = typeof radioGroupSizes[number];\nexport const radioGroupDefaultSize: RadioGroupPropSize = radioGroupSizes[0];\n\nexport const radioGroupViews = ['primary', 'ghost'] as const;\nexport type RadioGroupPropView = typeof radioGroupViews[number];\nexport const radioGroupDefaultView: RadioGroupPropView = radioGroupViews[0];\n\nexport const radioGroupPropAlign = ['center', 'top'] as const;\nexport type RadioGroupPropAlign = typeof radioGroupPropAlign[number];\nexport const radioGroupPropAlignDefault: RadioGroupPropAlign =\n radioGroupPropAlign[0];\n\nexport type RadioGroupPropGetItemLabel<ITEM> = (item: ITEM) => string;\nexport type RadioGroupPropGetItemDisabled<ITEM> = (\n item: ITEM,\n) => boolean | undefined;\n\nexport type RadioGroupProps<ITEM = RadioGroupDefaultItem> =\n PropsWithHTMLAttributesAndRef<\n {\n align?: RadioGroupPropAlign;\n value?: ITEM | null;\n items: ITEM[];\n getItemLabel?: RadioGroupPropGetItemLabel<ITEM>;\n getItemDisabled?: RadioGroupPropGetItemDisabled<ITEM>;\n onChange: (props: {\n e: React.ChangeEvent<HTMLInputElement>;\n value: ITEM;\n }) => void;\n name?: string;\n direction?: RadioGroupDirection;\n size?: RadioGroupPropSize;\n view?: RadioGroupPropView;\n disabled?: boolean;\n className?: string;\n },\n HTMLDivElement\n > &\n (ITEM extends { label: RadioGroupDefaultItem['label'] }\n ? {}\n : {\n getItemLabel: RadioGroupPropGetItemLabel<ITEM>;\n });\n\nexport type RadioGroupComponent = <ITEM = RadioGroupDefaultItem>(\n props: RadioGroupProps<ITEM>,\n) => React.ReactElement | null;\n"],"mappings":"AAOA,MAAO,IAAMA,qBAAoB,CAAG,CAAC,QAAD,CAAW,KAAX,CAA7B,CAEP,MAAO,IAAMC,2BAA+C,CAC1DD,oBAAoB,CAAC,CAAD,CADf,CAGP,MAAO,IAAME,gBAAe,CAAG,CAAC,GAAD,CAAM,GAAN,CAAxB,CAEP,MAAO,IAAMC,sBAAyC,CAAGD,eAAe,CAAC,CAAD,CAAjE,CAEP,MAAO,IAAME,gBAAe,CAAG,CAAC,SAAD,CAAY,OAAZ,CAAxB,CAEP,MAAO,IAAMC,sBAAyC,CAAGD,eAAe,CAAC,CAAD,CAAjE,CAEP,MAAO,IAAME,oBAAmB,CAAG,CAAC,QAAD,CAAW,KAAX,CAA5B,CAEP,MAAO,IAAMC,2BAA+C,CAC1DD,mBAAmB,CAAC,CAAD,CADd"}
1
+ {"version":3,"file":"types.js","names":["radioGroupDirections","radioGroupDefaultDirection","radioGroupSizes","radioGroupDefaultSize","radioGroupViews","radioGroupDefaultView","radioGroupPropAlign","radioGroupPropAlignDefault"],"sources":["../../../../../src/components/RadioGroup/types.ts"],"sourcesContent":["import { PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes';\n\nexport type RadioGroupDefaultItem = {\n label: string;\n disabled?: boolean;\n};\n\nexport const radioGroupDirections = ['column', 'row'] as const;\nexport type RadioGroupDirection = typeof radioGroupDirections[number];\nexport const radioGroupDefaultDirection: RadioGroupDirection =\n radioGroupDirections[0];\n\nexport const radioGroupSizes = ['m', 'l', 'xs', 's'] as const;\nexport type RadioGroupPropSize = typeof radioGroupSizes[number];\nexport const radioGroupDefaultSize: RadioGroupPropSize = radioGroupSizes[0];\n\nexport const radioGroupViews = ['primary', 'ghost'] as const;\nexport type RadioGroupPropView = typeof radioGroupViews[number];\nexport const radioGroupDefaultView: RadioGroupPropView = radioGroupViews[0];\n\nexport const radioGroupPropAlign = ['center', 'top'] as const;\nexport type RadioGroupPropAlign = typeof radioGroupPropAlign[number];\nexport const radioGroupPropAlignDefault: RadioGroupPropAlign =\n radioGroupPropAlign[0];\n\nexport type RadioGroupPropGetItemLabel<ITEM> = (item: ITEM) => string;\nexport type RadioGroupPropGetItemDisabled<ITEM> = (\n item: ITEM,\n) => boolean | undefined;\n\nexport type RadioGroupProps<ITEM = RadioGroupDefaultItem> =\n PropsWithHTMLAttributesAndRef<\n {\n align?: RadioGroupPropAlign;\n value?: ITEM | null;\n items: ITEM[];\n getItemLabel?: RadioGroupPropGetItemLabel<ITEM>;\n getItemDisabled?: RadioGroupPropGetItemDisabled<ITEM>;\n onChange: (props: {\n e: React.ChangeEvent<HTMLInputElement>;\n value: ITEM;\n }) => void;\n name?: string;\n direction?: RadioGroupDirection;\n size?: RadioGroupPropSize;\n view?: RadioGroupPropView;\n disabled?: boolean;\n className?: string;\n },\n HTMLDivElement\n > &\n (ITEM extends { label: RadioGroupDefaultItem['label'] }\n ? {}\n : {\n getItemLabel: RadioGroupPropGetItemLabel<ITEM>;\n });\n\nexport type RadioGroupComponent = <ITEM = RadioGroupDefaultItem>(\n props: RadioGroupProps<ITEM>,\n) => React.ReactElement | null;\n"],"mappings":"AAOA,MAAO,IAAMA,qBAAoB,CAAG,CAAC,QAAD,CAAW,KAAX,CAA7B,CAEP,MAAO,IAAMC,2BAA+C,CAC1DD,oBAAoB,CAAC,CAAD,CADf,CAGP,MAAO,IAAME,gBAAe,CAAG,CAAC,GAAD,CAAM,GAAN,CAAW,IAAX,CAAiB,GAAjB,CAAxB,CAEP,MAAO,IAAMC,sBAAyC,CAAGD,eAAe,CAAC,CAAD,CAAjE,CAEP,MAAO,IAAME,gBAAe,CAAG,CAAC,SAAD,CAAY,OAAZ,CAAxB,CAEP,MAAO,IAAMC,sBAAyC,CAAGD,eAAe,CAAC,CAAD,CAAjE,CAEP,MAAO,IAAME,oBAAmB,CAAG,CAAC,QAAD,CAAW,KAAX,CAA5B,CAEP,MAAO,IAAMC,2BAA+C,CAC1DD,mBAAmB,CAAC,CAAD,CADd"}
@@ -1 +1 @@
1
- .SelectCreateButton{background-color:var(--color-control-bg-clear);border:none;color:var(--color-control-typo-default);cursor:pointer;display:block;font-size:var(--font-size);padding:var(--vertical-space) var(--horizontal-space);position:relative}.SelectCreateButton_size_xs{--horizontal-space:calc(var(--control-space-xs)*0.5);--vertical-space:calc(var(--control-space-s)*0.25);--font-size:var(--control-text-size-xs)}.SelectCreateButton_size_s{--horizontal-space:calc(var(--control-space-s)*0.5);--vertical-space:calc(var(--control-space-s)*0.25);--font-size:var(--control-text-size-s)}.SelectCreateButton_size_m{--horizontal-space:calc(var(--control-space-m)*0.5);--vertical-space:calc(var(--control-space-s)*0.5);--font-size:var(--control-text-size-m)}.SelectCreateButton_size_l{--horizontal-space:calc(var(--control-space-l)*0.5);--vertical-space:calc(var(--control-space-s)*0.5);--font-size:var(--control-text-size-l)}.SelectCreateButton_hovered{background-color:var(--color-control-bg-clear-hover)}.SelectCreateButton_active{color:var(--color-control-typo-secondary)}.SelectCreateButton_indent_increased{padding-left:calc(var(--horizontal-space)*2.6)}
1
+ .ListItem.SelectCreateButton:hover:not(.ListItem_active){background:transparent}
@@ -1,6 +1,6 @@
1
1
  import './SelectCreateButton.css';
2
2
  import React from 'react';
3
- import { PropsWithHTMLAttributes } from '../../../utils/types/PropsWithHTMLAttributes';
3
+ import { PropsWithHTMLAttributes } from "../../../utils/types/PropsWithHTMLAttributes";
4
4
  import { PropSize } from '../types';
5
5
  declare type SelectCreateButtonProps = PropsWithHTMLAttributes<{
6
6
  labelForCreate?: string;
@@ -1,2 +1,2 @@
1
- import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","labelForCreate","inputValue","active","hovered","size","indent"];import"./SelectCreateButton.css";import React from"react";import{cn}from"../../../utils/bem";export var cnSelectCreateButton=cn("SelectCreateButton");export var SelectCreateButton=function(a){var b=a.className,c=a.labelForCreate,d=a.inputValue,e=a.active,f=a.hovered,g=a.size,h=a.indent,i=_objectWithoutProperties(a,_excluded);return React.createElement("div",Object.assign({},i,{className:cnSelectCreateButton({active:e,hovered:f,size:g,indent:h},[b]),"aria-selected":e,role:"option"}),c," \xAB",React.createElement("b",null,d),"\xBB")};
1
+ import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","labelForCreate","inputValue","active","hovered","size","indent"];import"./SelectCreateButton.css";import React from"react";import{ListAddItem}from"../../ListCanary";import{cn}from"../../../utils/bem";export var cnSelectCreateButton=cn("SelectCreateButton");export var SelectCreateButton=function(a){var b=a.className,c=a.labelForCreate,d=a.inputValue,e=a.active,f=a.hovered,g=a.size,h=a.indent,i=_objectWithoutProperties(a,_excluded);return React.createElement(ListAddItem,Object.assign({},i,{className:cnSelectCreateButton(null,[b]),"aria-selected":e,role:"option",active:f,size:g,innerOffset:h,label:React.createElement(React.Fragment,null,c," \xAB",React.createElement("b",null,d),"\xBB")}))};
2
2
  //# sourceMappingURL=SelectCreateButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectCreateButton.js","names":["React","cn","cnSelectCreateButton","SelectCreateButton","props","className","labelForCreate","inputValue","active","hovered","size","indent","otherProps"],"sources":["../../../../../../src/components/SelectComponents/SelectCreateButton/SelectCreateButton.tsx"],"sourcesContent":["import './SelectCreateButton.css';\n\nimport React from 'react';\n\nimport { cn } from '../../../utils/bem';\nimport { PropsWithHTMLAttributes } from '../../../utils/types/PropsWithHTMLAttributes';\nimport { PropSize } from '../types';\n\ntype SelectCreateButtonProps = PropsWithHTMLAttributes<\n {\n labelForCreate?: string;\n inputValue?: string;\n active: boolean;\n hovered: boolean;\n size: PropSize;\n indent: 'normal' | 'increased';\n },\n HTMLDivElement\n>;\n\nexport const cnSelectCreateButton = cn('SelectCreateButton');\n\nexport const SelectCreateButton: React.FC<SelectCreateButtonProps> = (\n props,\n) => {\n const {\n className,\n labelForCreate,\n inputValue,\n active,\n hovered,\n size,\n indent,\n ...otherProps\n } = props;\n\n return (\n <div\n {...otherProps}\n className={cnSelectCreateButton({ active, hovered, size, indent }, [\n className,\n ])}\n aria-selected={active}\n role=\"option\"\n >\n {labelForCreate} «<b>{inputValue}</b>»\n </div>\n );\n};\n"],"mappings":"kLAAA,iCAEA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,EAAT,0BAgBA,MAAO,IAAMC,qBAAoB,CAAGD,EAAE,CAAC,oBAAD,CAA/B,CAEP,MAAO,IAAME,mBAAqD,CAAG,SACnEC,CADmE,CAEhE,CACH,GACEC,EADF,CASID,CATJ,CACEC,SADF,CAEEC,CAFF,CASIF,CATJ,CAEEE,cAFF,CAGEC,CAHF,CASIH,CATJ,CAGEG,UAHF,CAIEC,CAJF,CASIJ,CATJ,CAIEI,MAJF,CAKEC,CALF,CASIL,CATJ,CAKEK,OALF,CAMEC,CANF,CASIN,CATJ,CAMEM,IANF,CAOEC,CAPF,CASIP,CATJ,CAOEO,MAPF,CAQKC,CARL,0BASIR,CATJ,YAWA,MACE,4CACMQ,CADN,EAEE,SAAS,CAAEV,oBAAoB,CAAC,CAAEM,MAAM,CAANA,CAAF,CAAUC,OAAO,CAAPA,CAAV,CAAmBC,IAAI,CAAJA,CAAnB,CAAyBC,MAAM,CAANA,CAAzB,CAAD,CAAoC,CACjEN,CADiE,CAApC,CAFjC,CAKE,gBAAeG,CALjB,CAME,IAAI,CAAC,QANP,GAQGF,CARH,SAQoB,6BAAIC,CAAJ,CARpB,QAWH,CA1BM"}
1
+ {"version":3,"file":"SelectCreateButton.js","names":["React","ListAddItem","cn","cnSelectCreateButton","SelectCreateButton","props","className","labelForCreate","inputValue","active","hovered","size","indent","otherProps"],"sources":["../../../../../../src/components/SelectComponents/SelectCreateButton/SelectCreateButton.tsx"],"sourcesContent":["import './SelectCreateButton.css';\n\nimport React from 'react';\n\nimport { ListAddItem } from '##/components/ListCanary';\nimport { cn } from '##/utils/bem';\nimport { PropsWithHTMLAttributes } from '##/utils/types/PropsWithHTMLAttributes';\n\nimport { PropSize } from '../types';\n\ntype SelectCreateButtonProps = PropsWithHTMLAttributes<\n {\n labelForCreate?: string;\n inputValue?: string;\n active: boolean;\n hovered: boolean;\n size: PropSize;\n indent: 'normal' | 'increased';\n },\n HTMLDivElement\n>;\n\nexport const cnSelectCreateButton = cn('SelectCreateButton');\n\nexport const SelectCreateButton: React.FC<SelectCreateButtonProps> = (\n props,\n) => {\n const {\n className,\n labelForCreate,\n inputValue,\n active,\n hovered,\n size,\n indent,\n ...otherProps\n } = props;\n\n return (\n <ListAddItem\n {...otherProps}\n className={cnSelectCreateButton(null, [className])}\n aria-selected={active}\n role=\"option\"\n active={hovered}\n size={size}\n innerOffset={indent}\n label={\n <>\n {labelForCreate} «<b>{inputValue}</b>»\n </>\n }\n />\n );\n};\n"],"mappings":"kLAAA,iCAEA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,WAAT,wBACA,OAASC,EAAT,0BAiBA,MAAO,IAAMC,qBAAoB,CAAGD,EAAE,CAAC,oBAAD,CAA/B,CAEP,MAAO,IAAME,mBAAqD,CAAG,SACnEC,CADmE,CAEhE,CACH,GACEC,EADF,CASID,CATJ,CACEC,SADF,CAEEC,CAFF,CASIF,CATJ,CAEEE,cAFF,CAGEC,CAHF,CASIH,CATJ,CAGEG,UAHF,CAIEC,CAJF,CASIJ,CATJ,CAIEI,MAJF,CAKEC,CALF,CASIL,CATJ,CAKEK,OALF,CAMEC,CANF,CASIN,CATJ,CAMEM,IANF,CAOEC,CAPF,CASIP,CATJ,CAOEO,MAPF,CAQKC,CARL,0BASIR,CATJ,YAWA,MACE,qBAAC,WAAD,kBACMQ,CADN,EAEE,SAAS,CAAEV,oBAAoB,CAAC,IAAD,CAAO,CAACG,CAAD,CAAP,CAFjC,CAGE,gBAAeG,CAHjB,CAIE,IAAI,CAAC,QAJP,CAKE,MAAM,CAAEC,CALV,CAME,IAAI,CAAEC,CANR,CAOE,WAAW,CAAEC,CAPf,CAQE,KAAK,CACH,wCACGL,CADH,SACoB,6BAAIC,CAAJ,CADpB,QATJ,GAeH,CA9BM"}
@@ -1 +1 @@
1
- .SelectDropdown{background:var(--color-bg-default);border:var(--control-border-width) solid var(--color-control-bg-border-default);box-shadow:var(--shadow-layer);box-sizing:border-box;font-size:var(--font-size);margin:-1px 0 -1px;min-width:220px;outline:none;overflow:hidden}.SelectDropdown_size_xs{--input-height:var(--control-height-xs);--font-size:var(--control-text-size-xs);--input-space:calc(var(--control-space-xs)*0.5);--list-spase:var(--space-2xs)}.SelectDropdown_size_s{--input-height:var(--control-height-s);--font-size:var(--control-text-size-s);--input-space:calc(var(--control-space-s)*0.5);--list-spase:var(--space-2xs)}.SelectDropdown_size_m{--input-height:var(--control-height-m);--font-size:var(--control-text-size-m);--input-space:calc(var(--control-space-m)*0.5);--list-spase:var(--space-xs)}.SelectDropdown_size_l{--input-height:var(--control-height-l);--font-size:var(--control-text-size-l);--input-space:calc(var(--control-space-l)*0.5);--list-spase:var(--space-xs)}.SelectDropdown_form_default{border-radius:var(--control-radius)}.SelectDropdown_form_brick{border-radius:0}.SelectDropdown_form_round{border-radius:calc(var(--input-height)*.5)}.SelectDropdown-LabelForEmptyItems,.SelectDropdown-LabelForNotFound{padding:0 var(--space-xs)}.SelectDropdown-List{line-height:120%;max-height:200px;overflow-y:auto;padding:var(--list-spase) 0;width:100%}
1
+ .SelectDropdown{min-width:220px;outline:none}.SelectDropdown-List{max-height:200px;overflow:auto}
@@ -1,2 +1,2 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["controlRef","size","getOptionProps","dropdownRef","labelForCreate","className","labelForNotFound","labelForEmptyItems","hasItems","form","isOpen","renderItem","visibleItems","isLoading","getGroupLabel","notFound"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import"./SelectDropdown.css";import React,{Fragment,useMemo,useRef}from"react";import{Transition}from"react-transition-group";import{isOptionForCreate}from"../../../hooks/useSelect/useSelect";import{animateTimeout,cnMixPopoverAnimate}from"../../../mixs/MixPopoverAnimate/MixPopoverAnimate";import{cn}from"../../../utils/bem";import{fabricIndex}from"../../../utils/fabricIndex";import{Popover}from"../../Popover/Popover";import{Text}from"../../Text/Text";import{SelectCreateButton}from"../SelectCreateButton/SelectCreateButton";import{SelectGroupLabel}from"../SelectGroupLabel/SelectGroupLabel";import{SelectLoader}from"../SelectLoader/SelectLoader";export var selectDropdownform=["default","brick","round"];export var defaultSelectDropdownPropForm=selectDropdownform[0];var cnSelectDropdown=cn("SelectDropdown");export var SelectDropdown=function(a){var b=a.controlRef,c=a.size,d=a.getOptionProps,e=a.dropdownRef,f=a.labelForCreate,g=a.className,h=a.labelForNotFound,i=a.labelForEmptyItems,j=a.hasItems,k=!(void 0!==j)||j,l=a.form,m=a.isOpen,n=a.renderItem,o=a.visibleItems,p=a.isLoading,q=a.getGroupLabel,r=a.notFound,s=_objectWithoutProperties(a,_excluded),t="round"===l?"increased":"normal",u=useRef(null),v=useMemo(function(){return 0<o.filter(function(a){return isOptionForCreate(a)||Array.isArray(a.items)&&0<a.items.length}).length},[o]);return React.createElement(Transition,{in:m,unmountOnExit:!0,nodeRef:u,timeout:animateTimeout},function(a){var j=fabricIndex(-1);return React.createElement(Popover,Object.assign({},s,{anchorRef:b,direction:"downStartLeft",possibleDirections:["downStartLeft","upStartLeft","downStartRight","upStartRight"],offset:"2xs",ref:u,role:"listbox",className:cnSelectDropdown({form:l,size:c},[g,cnMixPopoverAnimate({animate:a})]),equalAnchorWidth:!0}),React.createElement("div",{className:cnSelectDropdown("List",{size:c,form:l}),ref:e},p&&React.createElement(SelectLoader,{mode:v?"blur":"empty"}),o.map(function(a){return isOptionForCreate(a)?React.createElement(SelectCreateButton,Object.assign({size:c,labelForCreate:f,inputValue:a.label,indent:t},d({index:j(),item:a}))):React.createElement(Fragment,{key:a.key},a.group&&q&&React.createElement(SelectGroupLabel,{label:q(a.group),size:c,indent:t}),a.items.map(function(b,c){return React.createElement(Fragment,{key:"".concat(a.key,"-").concat(c)},n(_objectSpread({item:b},d({index:j(),item:b}))))}))}),!p&&k&&r&&h&&React.createElement(Text,{className:cnSelectDropdown("LabelForNotFound")},h),!p&&!k&&i&&React.createElement(Text,{className:cnSelectDropdown("LabelForEmptyItems")},i)))})};
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["controlRef","size","getOptionProps","dropdownRef","labelForCreate","className","labelForNotFound","labelForEmptyItems","hasItems","form","isOpen","renderItem","visibleItems","isLoading","getGroupLabel","notFound"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import"./SelectDropdown.css";import React,{Fragment,useMemo,useRef}from"react";import{Transition}from"react-transition-group";import{cnListBox,ListItem,mapVerticalSpase}from"../../ListCanary";import{cnMixSpace}from"../../../mixs/MixSpace";import{isOptionForCreate}from"../../../hooks/useSelect/useSelect";import{animateTimeout,cnMixPopoverAnimate}from"../../../mixs/MixPopoverAnimate/MixPopoverAnimate";import{cn}from"../../../utils/bem";import{fabricIndex}from"../../../utils/fabricIndex";import{Popover}from"../../Popover/Popover";import{SelectCreateButton}from"../SelectCreateButton/SelectCreateButton";import{SelectGroupLabel}from"../SelectGroupLabel/SelectGroupLabel";import{SelectLoader}from"../SelectLoader/SelectLoader";export var selectDropdownform=["default","brick","round"];export var defaultSelectDropdownPropForm=selectDropdownform[0];var cnSelectDropdown=cn("SelectDropdown");export var SelectDropdown=function(a){var b=a.controlRef,c=a.size,d=a.getOptionProps,e=a.dropdownRef,f=a.labelForCreate,g=a.className,h=a.labelForNotFound,i=a.labelForEmptyItems,j=a.hasItems,k=!(void 0!==j)||j,l=a.form,m=a.isOpen,n=a.renderItem,o=a.visibleItems,p=a.isLoading,q=a.getGroupLabel,r=a.notFound,s=_objectWithoutProperties(a,_excluded),t="round"===l?"increased":"normal",u=useRef(null),v=useMemo(function(){return 0<o.filter(function(a){return isOptionForCreate(a)||Array.isArray(a.items)&&0<a.items.length}).length},[o]);return React.createElement(Transition,{in:m,unmountOnExit:!0,nodeRef:u,timeout:animateTimeout},function(a){var j=fabricIndex(-1);return React.createElement(Popover,Object.assign({},s,{anchorRef:b,direction:"downStartLeft",possibleDirections:["downStartLeft","upStartLeft","downStartRight","upStartRight"],offset:"2xs",ref:u,role:"listbox",className:cnSelectDropdown(null,[cnListBox({size:c,form:l,border:!0,shadow:!0}),cnMixPopoverAnimate({animate:a}),g]),equalAnchorWidth:!0}),React.createElement("div",{className:cnSelectDropdown("List",[cnMixSpace({pV:mapVerticalSpase[c]})]),ref:e},p&&React.createElement(SelectLoader,{mode:v?"blur":"empty"}),o.map(function(a){return isOptionForCreate(a)?React.createElement(SelectCreateButton,Object.assign({size:c,labelForCreate:f,inputValue:a.label,indent:t},d({index:j(),item:a}))):React.createElement(Fragment,{key:a.key},a.group&&q&&React.createElement(SelectGroupLabel,{label:q(a.group),size:c,indent:t}),a.items.map(function(b,c){return React.createElement(Fragment,{key:"".concat(a.key,"-").concat(c)},n(_objectSpread({item:b},d({index:j(),item:b}))))}))}),!p&&k&&r&&h&&React.createElement(ListItem,{size:c,label:h,innerOffset:t},h),!p&&!k&&i&&React.createElement(ListItem,{size:c,label:h,innerOffset:t},i)))})};
2
2
  //# sourceMappingURL=SelectDropdown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectDropdown.js","names":["React","Fragment","useMemo","useRef","Transition","isOptionForCreate","animateTimeout","cnMixPopoverAnimate","cn","fabricIndex","Popover","Text","SelectCreateButton","SelectGroupLabel","SelectLoader","selectDropdownform","defaultSelectDropdownPropForm","cnSelectDropdown","SelectDropdown","props","controlRef","size","getOptionProps","dropdownRef","labelForCreate","className","labelForNotFound","labelForEmptyItems","hasItems","form","isOpen","renderItem","visibleItems","isLoading","getGroupLabel","notFound","otherProps","indent","popoverRef","isListShowed","filter","group","Array","isArray","items","length","animate","getIndex","map","label","index","item","key","i"],"sources":["../../../../../../src/components/SelectComponents/SelectDropdown/SelectDropdown.tsx"],"sourcesContent":["import './SelectDropdown.css';\n\nimport React, { Fragment, useMemo, useRef } from 'react';\nimport { Transition } from 'react-transition-group';\n\nimport {\n GetOptionPropsResult,\n isOptionForCreate,\n OptionForCreate,\n OptionProps,\n} from '../../../hooks/useSelect/useSelect';\nimport {\n animateTimeout,\n cnMixPopoverAnimate,\n} from '../../../mixs/MixPopoverAnimate/MixPopoverAnimate';\nimport { cn } from '../../../utils/bem';\nimport { fabricIndex } from '../../../utils/fabricIndex';\nimport { PropsWithJsxAttributes } from '../../../utils/types/PropsWithJsxAttributes';\nimport { Popover } from '../../Popover/Popover';\nimport { Text } from '../../Text/Text';\nimport { SelectCreateButton } from '../SelectCreateButton/SelectCreateButton';\nimport { SelectGroupLabel } from '../SelectGroupLabel/SelectGroupLabel';\nimport { SelectLoader } from '../SelectLoader/SelectLoader';\nimport { PropSize, RenderItemProps } from '../types';\n\nexport const selectDropdownform = ['default', 'brick', 'round'] as const;\nexport type SelectDropdownPropForm = typeof selectDropdownform[number];\nexport const defaultSelectDropdownPropForm = selectDropdownform[0];\n\ntype Props<ITEM, GROUP> = PropsWithJsxAttributes<{\n size: PropSize;\n controlRef: React.MutableRefObject<HTMLDivElement | null>;\n dropdownRef: React.MutableRefObject<HTMLDivElement | null>;\n getOptionProps(props: OptionProps<ITEM>): GetOptionPropsResult;\n form: SelectDropdownPropForm;\n isOpen: boolean;\n isLoading?: boolean;\n renderItem: (props: RenderItemProps<ITEM>) => JSX.Element | null;\n visibleItems: (\n | OptionForCreate\n | {\n items: ITEM[];\n key: string | number;\n group?: GROUP;\n groupIndex: number;\n }\n )[];\n getGroupLabel?: (group: GROUP) => string;\n labelForCreate?: string;\n labelForNotFound?: string;\n labelForEmptyItems?: string;\n notFound?: boolean;\n hasItems?: boolean;\n}>;\n\ntype SelectDropdown = <ITEM, GROUP>(\n props: Props<ITEM, GROUP>,\n) => React.ReactElement | null;\n\nconst cnSelectDropdown = cn('SelectDropdown');\n\nexport const SelectDropdown: SelectDropdown = (props) => {\n const {\n controlRef,\n size,\n getOptionProps,\n dropdownRef,\n labelForCreate,\n className,\n labelForNotFound,\n labelForEmptyItems,\n hasItems = true,\n form,\n isOpen,\n renderItem,\n visibleItems,\n isLoading,\n getGroupLabel,\n notFound,\n ...otherProps\n } = props;\n\n const indent = form === 'round' ? 'increased' : 'normal';\n\n const popoverRef = useRef<HTMLDivElement>(null);\n\n const isListShowed = useMemo(() => {\n return (\n visibleItems.filter(\n (group) =>\n isOptionForCreate(group) ||\n (Array.isArray(group.items) && group.items.length > 0),\n ).length > 0\n );\n }, [visibleItems]);\n\n return (\n <Transition\n in={isOpen}\n unmountOnExit\n nodeRef={popoverRef}\n timeout={animateTimeout}\n >\n {(animate) => {\n const getIndex = fabricIndex(-1);\n return (\n <Popover\n {...otherProps}\n anchorRef={controlRef}\n direction=\"downStartLeft\"\n possibleDirections={[\n 'downStartLeft',\n 'upStartLeft',\n 'downStartRight',\n 'upStartRight',\n ]}\n offset=\"2xs\"\n ref={popoverRef}\n role=\"listbox\"\n className={cnSelectDropdown({ form, size }, [\n className,\n cnMixPopoverAnimate({ animate }),\n ])}\n equalAnchorWidth\n >\n <div\n className={cnSelectDropdown('List', { size, form })}\n ref={dropdownRef}\n >\n {isLoading && (\n <SelectLoader mode={isListShowed ? 'blur' : 'empty'} />\n )}\n {visibleItems.map((group) => {\n if (isOptionForCreate(group)) {\n return (\n <SelectCreateButton\n size={size}\n labelForCreate={labelForCreate}\n inputValue={group.label}\n indent={indent}\n {...getOptionProps({ index: getIndex(), item: group })}\n />\n );\n }\n return (\n <Fragment key={group.key}>\n {group.group && getGroupLabel && (\n <SelectGroupLabel\n label={getGroupLabel(group.group)}\n size={size}\n indent={indent}\n />\n )}\n {group.items.map((item, i) => {\n return (\n <Fragment key={`${group.key}-${i}`}>\n {renderItem({\n item,\n ...getOptionProps({ index: getIndex(), item }),\n })}\n </Fragment>\n );\n })}\n </Fragment>\n );\n })}\n {!isLoading && hasItems && notFound && labelForNotFound && (\n <Text className={cnSelectDropdown('LabelForNotFound')}>\n {labelForNotFound}\n </Text>\n )}\n {!isLoading && !hasItems && labelForEmptyItems && (\n <Text className={cnSelectDropdown('LabelForEmptyItems')}>\n {labelForEmptyItems}\n </Text>\n )}\n </div>\n </Popover>\n );\n }}\n </Transition>\n );\n};\n"],"mappings":"g+BAAA,6BAEA,MAAOA,MAAP,EAAgBC,QAAhB,CAA0BC,OAA1B,CAAmCC,MAAnC,KAAiD,OAAjD,CACA,OAASC,UAAT,KAA2B,wBAA3B,CAEA,OAEEC,iBAFF,0CAMA,OACEC,cADF,CAEEC,mBAFF,yDAIA,OAASC,EAAT,0BAC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BF,CAyEH,CAlFH,CAqFH,CAzHM"}
1
+ {"version":3,"file":"SelectDropdown.js","names":["React","Fragment","useMemo","useRef","Transition","cnListBox","ListItem","mapVerticalSpase","cnMixSpace","isOptionForCreate","animateTimeout","cnMixPopoverAnimate","cn","fabricIndex","Popover","SelectCreateButton","SelectGroupLabel","SelectLoader","selectDropdownform","defaultSelectDropdownPropForm","cnSelectDropdown","SelectDropdown","props","controlRef","size","getOptionProps","dropdownRef","labelForCreate","className","labelForNotFound","labelForEmptyItems","hasItems","form","isOpen","renderItem","visibleItems","isLoading","getGroupLabel","notFound","otherProps","indent","popoverRef","isListShowed","filter","group","Array","isArray","items","length","animate","getIndex","border","shadow","pV","map","label","index","item","key","i"],"sources":["../../../../../../src/components/SelectComponents/SelectDropdown/SelectDropdown.tsx"],"sourcesContent":["import './SelectDropdown.css';\n\nimport React, { Fragment, useMemo, useRef } from 'react';\nimport { Transition } from 'react-transition-group';\n\nimport {\n cnListBox,\n ListItem,\n mapVerticalSpase,\n} from '##/components/ListCanary';\nimport { cnMixSpace } from '##/mixs/MixSpace';\n\nimport {\n GetOptionPropsResult,\n isOptionForCreate,\n OptionForCreate,\n OptionProps,\n} from '../../../hooks/useSelect/useSelect';\nimport {\n animateTimeout,\n cnMixPopoverAnimate,\n} from '../../../mixs/MixPopoverAnimate/MixPopoverAnimate';\nimport { cn } from '../../../utils/bem';\nimport { fabricIndex } from '../../../utils/fabricIndex';\nimport { PropsWithJsxAttributes } from '../../../utils/types/PropsWithJsxAttributes';\nimport { Popover } from '../../Popover/Popover';\nimport { SelectCreateButton } from '../SelectCreateButton/SelectCreateButton';\nimport { SelectGroupLabel } from '../SelectGroupLabel/SelectGroupLabel';\nimport { SelectLoader } from '../SelectLoader/SelectLoader';\nimport { PropSize, RenderItemProps } from '../types';\n\nexport const selectDropdownform = ['default', 'brick', 'round'] as const;\nexport type SelectDropdownPropForm = typeof selectDropdownform[number];\nexport const defaultSelectDropdownPropForm = selectDropdownform[0];\n\ntype Props<ITEM, GROUP> = PropsWithJsxAttributes<{\n size: PropSize;\n controlRef: React.MutableRefObject<HTMLDivElement | null>;\n dropdownRef: React.MutableRefObject<HTMLDivElement | null>;\n getOptionProps(props: OptionProps<ITEM>): GetOptionPropsResult;\n form: SelectDropdownPropForm;\n isOpen: boolean;\n isLoading?: boolean;\n renderItem: (props: RenderItemProps<ITEM>) => JSX.Element | null;\n visibleItems: (\n | OptionForCreate\n | {\n items: ITEM[];\n key: string | number;\n group?: GROUP;\n groupIndex: number;\n }\n )[];\n getGroupLabel?: (group: GROUP) => string;\n labelForCreate?: string;\n labelForNotFound?: string;\n labelForEmptyItems?: string;\n notFound?: boolean;\n hasItems?: boolean;\n}>;\n\ntype SelectDropdown = <ITEM, GROUP>(\n props: Props<ITEM, GROUP>,\n) => React.ReactElement | null;\n\nconst cnSelectDropdown = cn('SelectDropdown');\n\nexport const SelectDropdown: SelectDropdown = (props) => {\n const {\n controlRef,\n size,\n getOptionProps,\n dropdownRef,\n labelForCreate,\n className,\n labelForNotFound,\n labelForEmptyItems,\n hasItems = true,\n form,\n isOpen,\n renderItem,\n visibleItems,\n isLoading,\n getGroupLabel,\n notFound,\n ...otherProps\n } = props;\n\n const indent = form === 'round' ? 'increased' : 'normal';\n\n const popoverRef = useRef<HTMLDivElement>(null);\n\n const isListShowed = useMemo(() => {\n return (\n visibleItems.filter(\n (group) =>\n isOptionForCreate(group) ||\n (Array.isArray(group.items) && group.items.length > 0),\n ).length > 0\n );\n }, [visibleItems]);\n\n return (\n <Transition\n in={isOpen}\n unmountOnExit\n nodeRef={popoverRef}\n timeout={animateTimeout}\n >\n {(animate) => {\n const getIndex = fabricIndex(-1);\n return (\n <Popover\n {...otherProps}\n anchorRef={controlRef}\n direction=\"downStartLeft\"\n possibleDirections={[\n 'downStartLeft',\n 'upStartLeft',\n 'downStartRight',\n 'upStartRight',\n ]}\n offset=\"2xs\"\n ref={popoverRef}\n role=\"listbox\"\n className={cnSelectDropdown(null, [\n cnListBox({ size, form, border: true, shadow: true }),\n cnMixPopoverAnimate({ animate }),\n className,\n ])}\n equalAnchorWidth\n >\n <div\n className={cnSelectDropdown('List', [\n cnMixSpace({\n pV: mapVerticalSpase[size],\n }),\n ])}\n ref={dropdownRef}\n >\n {isLoading && (\n <SelectLoader mode={isListShowed ? 'blur' : 'empty'} />\n )}\n {visibleItems.map((group) => {\n if (isOptionForCreate(group)) {\n return (\n <SelectCreateButton\n size={size}\n labelForCreate={labelForCreate}\n inputValue={group.label}\n indent={indent}\n {...getOptionProps({ index: getIndex(), item: group })}\n />\n );\n }\n return (\n <Fragment key={group.key}>\n {group.group && getGroupLabel && (\n <SelectGroupLabel\n label={getGroupLabel(group.group)}\n size={size}\n indent={indent}\n />\n )}\n {group.items.map((item, i) => {\n return (\n <Fragment key={`${group.key}-${i}`}>\n {renderItem({\n item,\n ...getOptionProps({ index: getIndex(), item }),\n })}\n </Fragment>\n );\n })}\n </Fragment>\n );\n })}\n {!isLoading && hasItems && notFound && labelForNotFound && (\n <ListItem\n size={size}\n label={labelForNotFound}\n innerOffset={indent}\n >\n {labelForNotFound}\n </ListItem>\n )}\n {!isLoading && !hasItems && labelForEmptyItems && (\n <ListItem\n size={size}\n label={labelForNotFound}\n innerOffset={indent}\n >\n {labelForEmptyItems}\n </ListItem>\n )}\n </div>\n </Popover>\n );\n }}\n </Transition>\n );\n};\n"],"mappings":"g+BAAA,6BAEA,MAAOA,MAAP,EAAgBC,QAAhB,CAA0BC,OAA1B,CAAmCC,MAAnC,KAAiD,OAAjD,CACA,OAASC,UAAT,KAA2B,wBAA3B,CAEA,OACEC,SADF,CAEEC,QAFF,CAGEC,gBAHF,wBAKA,OAASC,UAAT,8BAEA,OAEEC,iBAFF,0CAMA,OACEC,cADF,CAEEC,mBAFF,yDAIA,OAASC,EAAT,0BACA,OAASC,WAAT,kCAEA,OAASC,OAAT,6BACA,OAASC,kBAAT,gDACA,OAASC,gBAAT,4CACA,OAASC,YAAT,oCAGA,MAAO,IAAMC,mB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H,CAvDJ,CApBF,CAsFH,CA/FH,CAkGH,CAtIM"}
@@ -1,12 +1,10 @@
1
- import './SelectGroupLabel.css';
2
1
  import React from 'react';
3
2
  import { PropsWithHTMLAttributes } from '../../../utils/types/PropsWithHTMLAttributes';
4
3
  import { PropSize } from '../types';
5
4
  declare type SelectGroupLabelProps = PropsWithHTMLAttributes<{
6
- label?: string;
5
+ label: string;
7
6
  size: PropSize;
8
7
  indent: 'normal' | 'increased';
9
8
  }, HTMLDivElement>;
10
- export declare const cnSelectGroupLabel: import("@bem-react/classname").ClassNameFormatter;
11
9
  export declare const SelectGroupLabel: React.FC<SelectGroupLabelProps>;
12
10
  export {};
@@ -1,2 +1,2 @@
1
- import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","label","size","indent"];import"./SelectGroupLabel.css";import React from"react";import{cn}from"../../../utils/bem";export var cnSelectGroupLabel=cn("SelectGroupLabel");export var SelectGroupLabel=function(a){var b=a.className,c=a.label,d=a.size,e=a.indent,f=_objectWithoutProperties(a,_excluded);return React.createElement("div",Object.assign({},f,{className:cnSelectGroupLabel({size:d,indent:e},[b])}),c)};
1
+ import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["indent"];import React from"react";import{ListGroupLabel}from"../../ListCanary";export var SelectGroupLabel=function(a){var b=a.indent,c=_objectWithoutProperties(a,_excluded);return React.createElement(ListGroupLabel,Object.assign({},c,{innerOffset:b}))};
2
2
  //# sourceMappingURL=SelectGroupLabel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectGroupLabel.js","names":["React","cn","cnSelectGroupLabel","SelectGroupLabel","props","className","label","size","indent","otherProps"],"sources":["../../../../../../src/components/SelectComponents/SelectGroupLabel/SelectGroupLabel.tsx"],"sourcesContent":["import './SelectGroupLabel.css';\n\nimport React from 'react';\n\nimport { cn } from '../../../utils/bem';\nimport { PropsWithHTMLAttributes } from '../../../utils/types/PropsWithHTMLAttributes';\nimport { PropSize } from '../types';\n\ntype SelectGroupLabelProps = PropsWithHTMLAttributes<\n {\n label?: string;\n size: PropSize;\n indent: 'normal' | 'increased';\n },\n HTMLDivElement\n>;\n\nexport const cnSelectGroupLabel = cn('SelectGroupLabel');\n\nexport const SelectGroupLabel: React.FC<SelectGroupLabelProps> = (props) => {\n const { className, label, size, indent, ...otherProps } = props;\n\n return (\n <div\n {...otherProps}\n className={cnSelectGroupLabel({ size, indent }, [className])}\n >\n {label}\n </div>\n );\n};\n"],"mappings":"yIAAA,+BAEA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,EAAT,0BAaA,MAAO,IAAMC,mBAAkB,CAAGD,EAAE,CAAC,kBAAD,CAA7B,CAEP,MAAO,IAAME,iBAAiD,CAAG,SAACC,CAAD,CAAW,CAC1E,GAAQC,EAAR,CAA0DD,CAA1D,CAAQC,SAAR,CAAmBC,CAAnB,CAA0DF,CAA1D,CAAmBE,KAAnB,CAA0BC,CAA1B,CAA0DH,CAA1D,CAA0BG,IAA1B,CAAgCC,CAAhC,CAA0DJ,CAA1D,CAAgCI,MAAhC,CAA2CC,CAA3C,0BAA0DL,CAA1D,YAEA,MACE,4CACMK,CADN,EAEE,SAAS,CAAEP,kBAAkB,CAAC,CAAEK,IAAI,CAAJA,CAAF,CAAQC,MAAM,CAANA,CAAR,CAAD,CAAmB,CAACH,CAAD,CAAnB,CAF/B,GAIGC,CAJH,CAOH,CAXM"}
1
+ {"version":3,"file":"SelectGroupLabel.js","names":["React","ListGroupLabel","SelectGroupLabel","props","indent","otherProps"],"sources":["../../../../../../src/components/SelectComponents/SelectGroupLabel/SelectGroupLabel.tsx"],"sourcesContent":["import React from 'react';\n\nimport { ListGroupLabel } from '##/components/ListCanary';\n\nimport { PropsWithHTMLAttributes } from '../../../utils/types/PropsWithHTMLAttributes';\nimport { PropSize } from '../types';\n\ntype SelectGroupLabelProps = PropsWithHTMLAttributes<\n {\n label: string;\n size: PropSize;\n indent: 'normal' | 'increased';\n },\n HTMLDivElement\n>;\n\nexport const SelectGroupLabel: React.FC<SelectGroupLabelProps> = (props) => {\n const { indent, ...otherProps } = props;\n\n return <ListGroupLabel {...otherProps} innerOffset={indent} />;\n};\n"],"mappings":"8GAAA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,cAAT,wBAcA,MAAO,IAAMC,iBAAiD,CAAG,SAACC,CAAD,CAAW,CAC1E,GAAQC,EAAR,CAAkCD,CAAlC,CAAQC,MAAR,CAAmBC,CAAnB,0BAAkCF,CAAlC,YAEA,MAAO,qBAAC,cAAD,kBAAoBE,CAApB,EAAgC,WAAW,CAAED,CAA7C,GACR,CAJM"}