@hh.ru/magritte-ui-action-list 5.2.42

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.
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { type ActionListProps } from '@hh.ru/magritte-ui-action-list';
3
+ export declare const ActionList: import("react").NamedExoticComponent<ActionListProps>;
package/ActionList.js ADDED
@@ -0,0 +1,21 @@
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import { memo } from 'react';
3
+ import { BottomSheet } from '@hh.ru/magritte-ui-bottom-sheet';
4
+ import { Drop } from '@hh.ru/magritte-ui-drop';
5
+
6
+ const ActionList = memo(({ children, dropProps, bottomSheetProps, ...commonProps }) => {
7
+ const dropClickHandler = (event) => {
8
+ const target = event.target;
9
+ const currentTarget = event.currentTarget;
10
+ const isClickOnButton = currentTarget.contains(target.closest('button, [role="button"]'));
11
+ if (isClickOnButton) {
12
+ /** Требование из спецификации компонента: при клике по Button, находящейся в Drop, возвращаем фокус на активатор */
13
+ dropProps.activatorRef?.current?.focus();
14
+ }
15
+ };
16
+ return (jsxs(Fragment, { children: [jsx(Drop, { ...dropProps, ...commonProps, space: 400, arrowNavigation: true, onClick: dropClickHandler, children: children }), jsx(BottomSheet, { ...bottomSheetProps, ...commonProps, height: "content", children: children })] }));
17
+ });
18
+ ActionList.displayName = 'ActionList';
19
+
20
+ export { ActionList };
21
+ //# sourceMappingURL=ActionList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionList.js","sources":["../src/ActionList.tsx"],"sourcesContent":["import { MouseEventHandler, memo } from 'react';\n\nimport { type ActionListProps } from '@hh.ru/magritte-ui-action-list';\nimport { BottomSheet } from '@hh.ru/magritte-ui-bottom-sheet';\nimport { Drop } from '@hh.ru/magritte-ui-drop';\n\nexport const ActionList = memo<ActionListProps>(({ children, dropProps, bottomSheetProps, ...commonProps }) => {\n const dropClickHandler: MouseEventHandler<HTMLDivElement> = (event) => {\n const target = event.target as Element;\n const currentTarget = event.currentTarget as Element;\n const isClickOnButton = currentTarget.contains(target.closest('button, [role=\"button\"]'));\n\n if (isClickOnButton) {\n /** Требование из спецификации компонента: при клике по Button, находящейся в Drop, возвращаем фокус на активатор */\n dropProps.activatorRef?.current?.focus();\n }\n };\n\n return (\n <>\n <Drop {...dropProps} {...commonProps} space={400} arrowNavigation onClick={dropClickHandler}>\n {children}\n </Drop>\n <BottomSheet {...bottomSheetProps} {...commonProps} height=\"content\">\n {children}\n </BottomSheet>\n </>\n );\n});\n\nActionList.displayName = 'ActionList';\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;AAMa,MAAA,UAAU,GAAG,IAAI,CAAkB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,WAAW,EAAE,KAAI;AAC1G,IAAA,MAAM,gBAAgB,GAAsC,CAAC,KAAK,KAAI;AAClE,QAAA,MAAM,MAAM,GAAG,KAAK,CAAC,MAAiB,CAAC;AACvC,QAAA,MAAM,aAAa,GAAG,KAAK,CAAC,aAAwB,CAAC;AACrD,QAAA,MAAM,eAAe,GAAG,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC,CAAC;AAE1F,QAAA,IAAI,eAAe,EAAE;;AAEjB,YAAA,SAAS,CAAC,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC5C,SAAA;AACL,KAAC,CAAC;AAEF,IAAA,QACIA,IACI,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CAAAC,GAAA,CAAC,IAAI,EAAA,EAAA,GAAK,SAAS,EAAM,GAAA,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,eAAe,EAAA,IAAA,EAAC,OAAO,EAAE,gBAAgB,EACtF,QAAA,EAAA,QAAQ,GACN,EACPA,GAAA,CAAC,WAAW,EAAA,EAAA,GAAK,gBAAgB,EAAM,GAAA,WAAW,EAAE,MAAM,EAAC,SAAS,EAAA,QAAA,EAC/D,QAAQ,EACC,CAAA,CAAA,EAAA,CACf,EACL;AACN,CAAC,EAAE;AAEH,UAAU,CAAC,WAAW,GAAG,YAAY;;;;"}
package/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export { type ActionListProps } from './types';
2
+ export * from './ActionList';
3
+ export * from '@hh.ru/magritte-ui-theme-provider';
package/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export { ActionList } from './ActionList.js';
2
+ export * from '@hh.ru/magritte-ui-theme-provider';
3
+ import 'react/jsx-runtime';
4
+ import 'react';
5
+ import '@hh.ru/magritte-ui-bottom-sheet';
6
+ import '@hh.ru/magritte-ui-drop';
7
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@hh.ru/magritte-ui-action-list",
3
+ "version": "5.2.42",
4
+ "main": "index.js",
5
+ "types": "index.d.ts",
6
+ "sideEffects": [
7
+ "index.css"
8
+ ],
9
+ "scripts": {
10
+ "build": "yarn root:build $(pwd)",
11
+ "build-test-branch": "yarn root:build-test-branch $(pwd)",
12
+ "changelog": "yarn root:changelog $(pwd)",
13
+ "prepack": "yarn root:prepack $(pwd)",
14
+ "postpublish": "yarn root:postpublish $(pwd)",
15
+ "stylelint-test": "yarn root:stylelint-test $(pwd)",
16
+ "eslint-test": "yarn root:eslint-test $(pwd)",
17
+ "ts-config": "yarn root:ts-config $(pwd)",
18
+ "ts-check": "yarn root:ts-check $(pwd)",
19
+ "test": "yarn root:test $(pwd)"
20
+ },
21
+ "dependencies": {
22
+ "@hh.ru/magritte-internal-drop-base": "5.0.4",
23
+ "@hh.ru/magritte-ui-bottom-sheet": "4.1.22",
24
+ "@hh.ru/magritte-ui-breakpoint": "4.0.1",
25
+ "@hh.ru/magritte-ui-button": "3.1.14",
26
+ "@hh.ru/magritte-ui-drop": "5.0.8",
27
+ "@hh.ru/magritte-ui-theme-provider": "1.1.21"
28
+ },
29
+ "peerDependencies": {
30
+ "react": ">=18.2.0"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "gitHead": "b660dd64fca3eaad5ec44ea9a73f92bb0d9694aa"
36
+ }
package/types.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { ComponentProps, ReactNode } from 'react';
2
+ import { DropBaseHorizontalPositionWithoutCenter, DropBaseVerticalPositionWithoutCenter } from '@hh.ru/magritte-internal-drop-base';
3
+ import { BottomSheet } from '@hh.ru/magritte-ui-bottom-sheet';
4
+ import { Drop } from '@hh.ru/magritte-ui-drop';
5
+ export interface ActionListProps {
6
+ /** Флаг, отвечает за отображение Drop/BottomSheet, `true` — показать, `false` — скрыть */
7
+ visible: boolean;
8
+ /** Колбек, вызываемый при закрытии компонента, который обязательно должен устанавливать visible=false */
9
+ onClose: VoidFunction;
10
+ /** Основной контент */
11
+ children: ReactNode | ReactNode[];
12
+ /** Props компонента Drop */
13
+ dropProps: Omit<ComponentProps<typeof Drop>, 'space' | 'footer' | 'children' | 'dividerState' | 'visible' | 'onClose'> & (DropBaseHorizontalPositionWithoutCenter | DropBaseVerticalPositionWithoutCenter);
14
+ /** Props компонента BottomSheet */
15
+ bottomSheetProps?: Omit<ComponentProps<typeof BottomSheet>, 'footer' | 'header' | 'height' | 'children' | 'showDivider' | 'visible' | 'onClose'>;
16
+ }
package/types.js ADDED
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=types.js.map
package/types.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}