@hh.ru/magritte-ui-action-list 8.1.118 → 8.1.120
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ActionList.d.ts +1 -1
- package/ActionList.js +40 -21
- package/ActionList.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.mock.d.ts +1 -1
- package/index.mock.js +2 -2
- package/index.mock.js.map +1 -1
- package/package.json +7 -7
package/ActionList.d.ts
CHANGED
package/ActionList.js
CHANGED
|
@@ -7,28 +7,47 @@ import { Drop } from '@hh.ru/magritte-ui-drop';
|
|
|
7
7
|
import { VSpacing } from '@hh.ru/magritte-ui-spacing';
|
|
8
8
|
|
|
9
9
|
const ActionList = ({ children, dropProps, bottomSheetProps, visible, ...commonProps }) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
10
|
+
const closedByKeyboardRef = useRef(false);
|
|
11
|
+
const dropRef = useRef(null);
|
|
12
|
+
const dropRefCallback = useMultipleRefs(dropRef, dropProps.ref);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (!visible) {
|
|
15
|
+
if (closedByKeyboardRef.current && dropProps.activatorRef.current !== null) {
|
|
16
|
+
dropProps.activatorRef.current.focus();
|
|
17
|
+
}
|
|
18
|
+
closedByKeyboardRef.current = false;
|
|
19
|
+
}
|
|
20
|
+
}, [dropProps.activatorRef, visible]);
|
|
21
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22
|
+
/* @__PURE__ */ jsx(
|
|
23
|
+
Drop,
|
|
24
|
+
{
|
|
25
|
+
...dropProps,
|
|
26
|
+
...commonProps,
|
|
27
|
+
autoFocusWhenOpened: true,
|
|
28
|
+
keyboardNavigationMode: "list",
|
|
29
|
+
onKeyDownCapture: (event) => {
|
|
30
|
+
if (keyboardMatches(event.nativeEvent, [
|
|
31
|
+
keyboardKeys.Enter,
|
|
32
|
+
keyboardKeys.Escape,
|
|
33
|
+
keyboardKeys.Space
|
|
34
|
+
])) {
|
|
35
|
+
closedByKeyboardRef.current = true;
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
ref: dropRefCallback,
|
|
39
|
+
padding: dropProps.padding ?? 16,
|
|
40
|
+
visible,
|
|
41
|
+
children
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
/* @__PURE__ */ jsxs(BottomSheet, { ...bottomSheetProps, ...commonProps, height: "content", visible, children: [
|
|
45
|
+
children,
|
|
46
|
+
/* @__PURE__ */ jsx(VSpacing, { default: 16 })
|
|
47
|
+
] })
|
|
48
|
+
] });
|
|
30
49
|
};
|
|
31
|
-
ActionList.displayName =
|
|
50
|
+
ActionList.displayName = "ActionList";
|
|
32
51
|
|
|
33
52
|
export { ActionList };
|
|
34
53
|
//# sourceMappingURL=ActionList.js.map
|
package/ActionList.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionList.js","sources":["src/ActionList.tsx"],"sourcesContent":["import { FC, KeyboardEvent as ReactKeyboardEvent, useEffect, useRef } from 'react';\n\nimport { keyboardKeys, keyboardMatches } from '@hh.ru/magritte-common-keyboard';\nimport { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';\nimport { ActionListProps } from '@hh.ru/magritte-ui-action-list/types';\nimport { BottomSheet } from '@hh.ru/magritte-ui-bottom-sheet';\nimport { Drop } from '@hh.ru/magritte-ui-drop';\nimport { VSpacing } from '@hh.ru/magritte-ui-spacing';\n\nexport const ActionList: FC<ActionListProps> = ({ children, dropProps, bottomSheetProps, visible, ...commonProps }) => {\n const closedByKeyboardRef = useRef(false);\n const dropRef = useRef<HTMLElement>(null);\n const dropRefCallback = useMultipleRefs(dropRef, dropProps.ref as React.Ref<HTMLElement>);\n\n useEffect(() => {\n if (!visible) {\n if (closedByKeyboardRef.current && dropProps.activatorRef.current !== null) {\n dropProps.activatorRef.current.focus();\n }\n closedByKeyboardRef.current = false;\n }\n }, [dropProps.activatorRef, visible]);\n\n return (\n <>\n <Drop\n {...dropProps}\n {...commonProps}\n autoFocusWhenOpened\n keyboardNavigationMode=\"list\"\n onKeyDownCapture={(event: ReactKeyboardEvent) => {\n if (\n keyboardMatches(event.nativeEvent, [\n keyboardKeys.Enter,\n keyboardKeys.Escape,\n keyboardKeys.Space,\n ])\n ) {\n closedByKeyboardRef.current = true;\n }\n }}\n ref={dropRefCallback}\n padding={dropProps.padding ?? 16}\n visible={visible}\n >\n {children}\n </Drop>\n <BottomSheet {...bottomSheetProps} {...commonProps} height=\"content\" visible={visible}>\n {children}\n <VSpacing default={16} />\n </BottomSheet>\n </>\n );\n};\n\nActionList.displayName = 'ActionList';\n"],"names":[
|
|
1
|
+
{"version":3,"file":"ActionList.js","sources":["src/ActionList.tsx"],"sourcesContent":["import { FC, KeyboardEvent as ReactKeyboardEvent, useEffect, useRef } from 'react';\n\nimport { keyboardKeys, keyboardMatches } from '@hh.ru/magritte-common-keyboard';\nimport { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';\nimport { ActionListProps } from '@hh.ru/magritte-ui-action-list/types';\nimport { BottomSheet } from '@hh.ru/magritte-ui-bottom-sheet';\nimport { Drop } from '@hh.ru/magritte-ui-drop';\nimport { VSpacing } from '@hh.ru/magritte-ui-spacing';\n\nexport const ActionList: FC<ActionListProps> = ({ children, dropProps, bottomSheetProps, visible, ...commonProps }) => {\n const closedByKeyboardRef = useRef(false);\n const dropRef = useRef<HTMLElement>(null);\n const dropRefCallback = useMultipleRefs(dropRef, dropProps.ref as React.Ref<HTMLElement>);\n\n useEffect(() => {\n if (!visible) {\n if (closedByKeyboardRef.current && dropProps.activatorRef.current !== null) {\n dropProps.activatorRef.current.focus();\n }\n closedByKeyboardRef.current = false;\n }\n }, [dropProps.activatorRef, visible]);\n\n return (\n <>\n <Drop\n {...dropProps}\n {...commonProps}\n autoFocusWhenOpened\n keyboardNavigationMode=\"list\"\n onKeyDownCapture={(event: ReactKeyboardEvent) => {\n if (\n keyboardMatches(event.nativeEvent, [\n keyboardKeys.Enter,\n keyboardKeys.Escape,\n keyboardKeys.Space,\n ])\n ) {\n closedByKeyboardRef.current = true;\n }\n }}\n ref={dropRefCallback}\n padding={dropProps.padding ?? 16}\n visible={visible}\n >\n {children}\n </Drop>\n <BottomSheet {...bottomSheetProps} {...commonProps} height=\"content\" visible={visible}>\n {children}\n <VSpacing default={16} />\n </BottomSheet>\n </>\n );\n};\n\nActionList.displayName = 'ActionList';\n"],"names":[],"mappings":";;;;;;;;AASa,MAAA,UAAA,GAAkC,CAAC,EAAE,QAAA,EAAU,WAAW,gBAAkB,EAAA,OAAA,EAAS,GAAG,WAAA,EAAkB,KAAA;AACnH,EAAM,MAAA,mBAAA,GAAsB,OAAO,KAAK,CAAA,CAAA;AACxC,EAAM,MAAA,OAAA,GAAU,OAAoB,IAAI,CAAA,CAAA;AACxC,EAAA,MAAM,eAAkB,GAAA,eAAA,CAAgB,OAAS,EAAA,SAAA,CAAU,GAA6B,CAAA,CAAA;AAExF,EAAA,SAAA,CAAU,MAAM;AACZ,IAAA,IAAI,CAAC,OAAS,EAAA;AACV,MAAA,IAAI,mBAAoB,CAAA,OAAA,IAAW,SAAU,CAAA,YAAA,CAAa,YAAY,IAAM,EAAA;AACxE,QAAU,SAAA,CAAA,YAAA,CAAa,QAAQ,KAAM,EAAA,CAAA;AAAA,OACzC;AACA,MAAA,mBAAA,CAAoB,OAAU,GAAA,KAAA,CAAA;AAAA,KAClC;AAAA,GACD,EAAA,CAAC,SAAU,CAAA,YAAA,EAAc,OAAO,CAAC,CAAA,CAAA;AAEpC,EAAA,uBAEQ,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,IAAA;AAAA,MAAA;AAAA,QACI,GAAG,SAAA;AAAA,QACH,GAAG,WAAA;AAAA,QACJ,mBAAmB,EAAA,IAAA;AAAA,QACnB,sBAAuB,EAAA,MAAA;AAAA,QACvB,gBAAA,EAAkB,CAAC,KAA8B,KAAA;AAC7C,UACI,IAAA,eAAA,CAAgB,MAAM,WAAa,EAAA;AAAA,YAC/B,YAAa,CAAA,KAAA;AAAA,YACb,YAAa,CAAA,MAAA;AAAA,YACb,YAAa,CAAA,KAAA;AAAA,WAChB,CACH,EAAA;AACE,YAAA,mBAAA,CAAoB,OAAU,GAAA,IAAA,CAAA;AAAA,WAClC;AAAA,SACJ;AAAA,QACA,GAAK,EAAA,eAAA;AAAA,QACL,OAAA,EAAS,UAAU,OAAW,IAAA,EAAA;AAAA,QAC9B,OAAA;AAAA,QAEC,QAAA;AAAA,OAAA;AAAA,KACL;AAAA,oBACA,IAAA,CAAC,eAAa,GAAG,gBAAA,EAAmB,GAAG,WAAa,EAAA,MAAA,EAAO,WAAU,OAChE,EAAA,QAAA,EAAA;AAAA,MAAA,QAAA;AAAA,sBACD,GAAA,CAAC,QAAS,EAAA,EAAA,OAAA,EAAS,EAAI,EAAA,CAAA;AAAA,KAC3B,EAAA,CAAA;AAAA,GACJ,EAAA,CAAA,CAAA;AAER,EAAA;AAEA,UAAA,CAAW,WAAc,GAAA,YAAA;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { type ActionListProps } from '
|
|
2
|
-
export * from '
|
|
1
|
+
export { type ActionListProps } from './types';
|
|
2
|
+
export * from './ActionList';
|
package/index.mock.d.ts
CHANGED
package/index.mock.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mockComponent } from '@hh.ru/magritte-ui-mock-component';
|
|
2
2
|
|
|
3
|
-
const ActionList = mockComponent(
|
|
4
|
-
|
|
3
|
+
const ActionList = mockComponent("ActionList", void 0, {
|
|
4
|
+
withChildren: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
7
|
export { ActionList };
|
package/index.mock.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mock.js","sources":["src/index.mock.ts"],"sourcesContent":["import { FC } from 'react';\n\nimport { mockComponent } from '@hh.ru/magritte-ui-mock-component';\n\nexport { type ActionListProps } from '@hh.ru/magritte-ui-action-list/types';\n\nexport const ActionList: FC<Record<string, unknown>> = mockComponent('ActionList', undefined, {\n withChildren: true,\n});\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.mock.js","sources":["src/index.mock.ts"],"sourcesContent":["import { FC } from 'react';\n\nimport { mockComponent } from '@hh.ru/magritte-ui-mock-component';\n\nexport { type ActionListProps } from '@hh.ru/magritte-ui-action-list/types';\n\nexport const ActionList: FC<Record<string, unknown>> = mockComponent('ActionList', undefined, {\n withChildren: true,\n});\n"],"names":[],"mappings":";;AAMa,MAAA,UAAA,GAA0C,aAAc,CAAA,YAAA,EAAc,KAAW,CAAA,EAAA;AAAA,EAC1F,YAAc,EAAA,IAAA;AAClB,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hh.ru/magritte-ui-action-list",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.120",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"sideEffects": [
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@hh.ru/magritte-common-keyboard": "4.3.6",
|
|
23
23
|
"@hh.ru/magritte-common-use-multiple-refs": "1.1.12",
|
|
24
|
-
"@hh.ru/magritte-internal-drop-base": "7.2.
|
|
25
|
-
"@hh.ru/magritte-ui-bottom-sheet": "9.4.
|
|
24
|
+
"@hh.ru/magritte-internal-drop-base": "7.2.22",
|
|
25
|
+
"@hh.ru/magritte-ui-bottom-sheet": "9.4.49",
|
|
26
26
|
"@hh.ru/magritte-ui-breakpoint": "6.1.2",
|
|
27
|
-
"@hh.ru/magritte-ui-button": "7.3.
|
|
28
|
-
"@hh.ru/magritte-ui-drop": "12.3.
|
|
27
|
+
"@hh.ru/magritte-ui-button": "7.3.7",
|
|
28
|
+
"@hh.ru/magritte-ui-drop": "12.3.61",
|
|
29
29
|
"@hh.ru/magritte-ui-mock-component": "1.1.8",
|
|
30
|
-
"@hh.ru/magritte-ui-spacing": "2.1.
|
|
30
|
+
"@hh.ru/magritte-ui-spacing": "2.1.31"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"react": ">=18.2.0"
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "f6539d7a0e7cd42dd851458db1de04a748bbee03"
|
|
39
39
|
}
|