@hh.ru/magritte-ui-button-stack 2.0.4

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
+ import { FC } from 'react';
2
+ import { ButtonStackProps } from './types';
3
+ export declare const ButtonStack: FC<ButtonStackProps>;
package/ButtonStack.js ADDED
@@ -0,0 +1,13 @@
1
+ import './index.css';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { Children, cloneElement } from 'react';
4
+ import classnames from 'classnames';
5
+
6
+ var styles = {"button-stack":"magritte-button-stack___iVaJJ_2-0-4","buttonStack":"magritte-button-stack___iVaJJ_2-0-4","button-stack_auto":"magritte-button-stack_auto___dqMc9_2-0-4","buttonStackAuto":"magritte-button-stack_auto___dqMc9_2-0-4","button-stack_vertical":"magritte-button-stack_vertical___BNea1_2-0-4","buttonStackVertical":"magritte-button-stack_vertical___BNea1_2-0-4","button-stack_horizontal":"magritte-button-stack_horizontal___W247X_2-0-4","buttonStackHorizontal":"magritte-button-stack_horizontal___W247X_2-0-4","button-stack-item":"magritte-button-stack-item___EHJWa_2-0-4","buttonStackItem":"magritte-button-stack-item___EHJWa_2-0-4"};
7
+
8
+ const ButtonStack = ({ children, orientation = 'auto' }) => {
9
+ return (jsx("div", { className: classnames(styles.buttonStack, styles[`button-stack_${orientation}`]), children: Children.map(children, (child, index) => (jsx("div", { className: classnames({ [styles.buttonStackItem]: orientation !== 'vertical' }), children: cloneElement(child, { stretched: true }) }, index))) }));
10
+ };
11
+
12
+ export { ButtonStack };
13
+ //# sourceMappingURL=ButtonStack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ButtonStack.js","sources":["../src/ButtonStack.tsx"],"sourcesContent":["import { FC, cloneElement, Children, ComponentProps } from 'react';\nimport classnames from 'classnames';\n\nimport { Button } from '@hh.ru/magritte-ui-button';\nimport { ButtonStackProps } from '@hh.ru/magritte-ui-button-stack/types';\n\nimport styles from './button-stack.less';\n\nexport const ButtonStack: FC<ButtonStackProps> = ({ children, orientation = 'auto' }) => {\n return (\n <div className={classnames(styles.buttonStack, styles[`button-stack_${orientation}`])}>\n {Children.map(children, (child, index) => (\n <div key={index} className={classnames({ [styles.buttonStackItem]: orientation !== 'vertical' })}>\n {cloneElement(child, { stretched: true } as ComponentProps<typeof Button>)}\n </div>\n ))}\n </div>\n );\n};\n"],"names":["_jsx"],"mappings":";;;;;;AAQO,MAAM,WAAW,GAAyB,CAAC,EAAE,QAAQ,EAAE,WAAW,GAAG,MAAM,EAAE,KAAI;AACpF,IAAA,QACIA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,gBAAgB,WAAW,CAAA,CAAE,CAAC,CAAC,EAChF,QAAA,EAAA,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,MACjCA,GAAA,CAAA,KAAA,EAAA,EAAiB,SAAS,EAAE,UAAU,CAAC,EAAE,CAAC,MAAM,CAAC,eAAe,GAAG,WAAW,KAAK,UAAU,EAAE,CAAC,EAC3F,QAAA,EAAA,YAAY,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAmC,CAAC,EADpE,EAAA,KAAK,CAET,CACT,CAAC,EAAA,CACA,EACR;AACN;;;;"}
package/index.css ADDED
@@ -0,0 +1,19 @@
1
+ .magritte-button-stack___iVaJJ_2-0-4{
2
+ display:flex;
3
+ gap:12px;
4
+ }
5
+ .magritte-button-stack_auto___dqMc9_2-0-4{
6
+ flex-wrap:wrap;
7
+ max-width:fit-content;
8
+ }
9
+ .magritte-button-stack_vertical___BNea1_2-0-4{
10
+ flex-direction:column;
11
+ }
12
+ .magritte-button-stack_horizontal___W247X_2-0-4{
13
+ flex-direction:row;
14
+ max-width:fit-content;
15
+ }
16
+ .magritte-button-stack-item___EHJWa_2-0-4{
17
+ flex-grow:1;
18
+ min-width:0;
19
+ }
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export * from './ButtonStack';
package/index.js ADDED
@@ -0,0 +1,6 @@
1
+ import './index.css';
2
+ export { ButtonStack } from './ButtonStack.js';
3
+ import 'react/jsx-runtime';
4
+ import 'react';
5
+ import 'classnames';
6
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export { type ButtonStackProps } from './types';
3
+ export declare const ButtonStack: import("react").ForwardRefExoticComponent<Record<string, unknown>>;
package/index.mock.js ADDED
@@ -0,0 +1,9 @@
1
+ import './index.css';
2
+ import { mockComponent } from '@hh.ru/magritte-ui-mock-component';
3
+
4
+ const ButtonStack = mockComponent('ButtonStack', undefined, {
5
+ withChildren: true,
6
+ });
7
+
8
+ export { ButtonStack };
9
+ //# sourceMappingURL=index.mock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mock.js","sources":["../src/index.mock.ts"],"sourcesContent":["import { mockComponent } from '@hh.ru/magritte-ui-mock-component';\n\nexport { type ButtonStackProps } from '@hh.ru/magritte-ui-button-stack/types';\n\nexport const ButtonStack = mockComponent('ButtonStack', undefined, {\n withChildren: true,\n});\n"],"names":[],"mappings":";;MAIa,WAAW,GAAG,aAAa,CAAC,aAAa,EAAE,SAAS,EAAE;AAC/D,IAAA,YAAY,EAAE,IAAI;AACrB,CAAA;;;;"}
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@hh.ru/magritte-ui-button-stack",
3
+ "version": "2.0.4",
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-ui-button": "3.1.14",
23
+ "@hh.ru/magritte-ui-mock-component": "1.0.10"
24
+ },
25
+ "peerDependencies": {
26
+ "classnames": ">=2.3.2",
27
+ "react": ">=18.2.0"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "gitHead": "b660dd64fca3eaad5ec44ea9a73f92bb0d9694aa"
33
+ }
package/types.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ import { ComponentProps, ReactElement } from 'react';
2
+ import { Button } from '@hh.ru/magritte-ui-button';
3
+ export type Orientation = 'vertical' | 'horizontal' | 'auto';
4
+ export interface ButtonStackProps {
5
+ /** Массив кнопок */
6
+ children: ReactElement<ComponentProps<typeof Button>>[];
7
+ /** Ориентация контейнера */
8
+ orientation?: Orientation;
9
+ }
package/types.js ADDED
@@ -0,0 +1,3 @@
1
+ import './index.css';
2
+
3
+ //# sourceMappingURL=types.js.map
package/types.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}