@hh.ru/magritte-ui-trigger 4.3.46 → 4.3.47

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/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from '@hh.ru/magritte-ui-trigger/types';
2
- export * from '@hh.ru/magritte-ui-trigger/Trigger';
3
- export * from '@hh.ru/magritte-ui-trigger/BaseTrigger';
1
+ export * from './types';
2
+ export * from './Trigger';
3
+ export * from './BaseTrigger';
package/index.mock.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { ForwardRefExoticComponent } from 'react';
2
- export type * from '@hh.ru/magritte-ui-trigger/types';
2
+ export type * from './types';
3
3
  export declare const Trigger: ForwardRefExoticComponent<Record<string, unknown>>;
package/index.mock.js CHANGED
@@ -2,37 +2,38 @@ import './index.css';
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { forwardRef } from 'react';
4
4
 
5
- function enhance(mockComponent, staticProps) {
6
- // удаляем внутренний свойства реакта, чтобы не перезаписать ими mockComponent
7
- delete staticProps.type;
8
- delete staticProps.$$typeof;
9
- delete staticProps.render;
10
- for (const prop in staticProps) {
11
- mockComponent[prop] = staticProps[prop];
12
- }
5
+ function enhance(mockComponent2, staticProps) {
6
+ delete staticProps.type;
7
+ delete staticProps.$$typeof;
8
+ delete staticProps.render;
9
+ for (const prop in staticProps) {
10
+ mockComponent2[prop] = staticProps[prop];
11
+ }
13
12
  }
14
13
  const MockComponent = ({ style, ...props }) => (
15
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
16
- // @ts-ignore
17
- // eslint-disable-next-line react/jsx-no-undef
18
- jsx("magritte-component-mock", { "style-data": style, ...props }));
19
- /**
20
- * Возвращает mock React компонента
21
- */
14
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
15
+ // @ts-ignore
16
+ // eslint-disable-next-line react/jsx-no-undef
17
+ /* @__PURE__ */ jsx("magritte-component-mock", { "style-data": style, ...props })
18
+ );
22
19
  const mockComponent = (componentName, staticProps = {}, { withChildren, innerDependence, WrapperComponent } = {}) => {
23
- const mockWrapper = forwardRef(({ children, ...props }, ref) => {
24
- const mock = (
25
- // eslint-disable-next-line react/jsx-no-undef
26
- jsxs(MockComponent, { ...props, _component: componentName, children: [innerDependence ? innerDependence(props, ref) : null, withChildren ? children : null] }));
27
- return WrapperComponent ? jsx(WrapperComponent, { ...props, children: mock }) : mock;
28
- });
29
- staticProps && enhance(mockWrapper, staticProps);
30
- mockWrapper.displayName = 'magritte-ref';
31
- return mockWrapper;
20
+ const mockWrapper = forwardRef(({ children, ...props }, ref) => {
21
+ const mock = (
22
+ // eslint-disable-next-line react/jsx-no-undef
23
+ /* @__PURE__ */ jsxs(MockComponent, { ...props, _component: componentName, children: [
24
+ innerDependence ? innerDependence(props, ref) : null,
25
+ withChildren ? children : null
26
+ ] })
27
+ );
28
+ return WrapperComponent ? /* @__PURE__ */ jsx(WrapperComponent, { ...props, children: mock }) : mock;
29
+ });
30
+ staticProps && enhance(mockWrapper, staticProps);
31
+ mockWrapper.displayName = "magritte-ref";
32
+ return mockWrapper;
32
33
  };
33
34
 
34
- const Trigger = mockComponent('Trigger', undefined, {
35
- withChildren: false,
35
+ const Trigger = mockComponent("Trigger", void 0, {
36
+ withChildren: false
36
37
  });
37
38
 
38
39
  export { Trigger };
package/index.mock.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.mock.js","sources":["../mock-component/lib/setupMockComponent.js","src/index.mock.ts"],"sourcesContent":["import { jsxs, jsx } from 'react/jsx-runtime';\nimport { forwardRef } from 'react';\n\nfunction enhance(mockComponent, staticProps) {\n // удаляем внутренний свойства реакта, чтобы не перезаписать ими mockComponent\n delete staticProps.type;\n delete staticProps.$$typeof;\n delete staticProps.render;\n for (const prop in staticProps) {\n mockComponent[prop] = staticProps[prop];\n }\n}\nconst MockComponent = ({ style, ...props }) => (\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\n// eslint-disable-next-line react/jsx-no-undef\njsx(\"magritte-component-mock\", { \"style-data\": style, ...props }));\nconst MockComponentRenderProp = ({ style, ...props }) => (\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\n// eslint-disable-next-line react/jsx-no-undef\njsx(\"magritte-component-mock-render-prop\", { \"style-data\": style, ...props }));\n/**\n * Возвращает mock React компонента\n */\nconst mockComponent = (componentName, staticProps = {}, { withChildren, innerDependence, WrapperComponent } = {}) => {\n const mockWrapper = forwardRef(({ children, ...props }, ref) => {\n const mock = (\n // eslint-disable-next-line react/jsx-no-undef\n jsxs(MockComponent, { ...props, _component: componentName, children: [innerDependence ? innerDependence(props, ref) : null, withChildren ? children : null] }));\n return WrapperComponent ? jsx(WrapperComponent, { ...props, children: mock }) : mock;\n });\n staticProps && enhance(mockWrapper, staticProps);\n mockWrapper.displayName = 'magritte-ref';\n return mockWrapper;\n};\n/**\n * Возвращает mock React компонента, который рендерит переданный в него пропс render\n *\n * @param {String} componentName наименование компонента\n * @param {Object} [staticProps] объект со свойствами, которыми необходимо усилить mock\n * @param {Object} [options] параметры мока\n * @param {boolean} [options.withChildren] флаг отвечает за рендеринг children компонента\n * @param {React.Component} [options.innerDependence] Реакт компонент, который рендерится внутри мока.\n * Необходим, когда mock компоненту требуется иметь\n * дополнительные элементы\n */\nconst mockComponentRenderProp = (componentName, staticProps, { withChildren, innerDependence, renderArguments } = { renderArguments: [] }) => {\n const mockWrapper = ({ render, children, ...props }) => (jsxs(MockComponentRenderProp, { ...props, _component: componentName, children: [innerDependence ? innerDependence(props) : null, withChildren ? children : null, render?.(...(renderArguments || []))] }));\n staticProps && enhance(mockWrapper, staticProps);\n mockWrapper.displayName = 'magritte-component-mock-render-prop';\n return mockWrapper;\n};\n\nexport { mockComponent, mockComponentRenderProp };\n//# sourceMappingURL=setupMockComponent.js.map\n","import { ForwardRefExoticComponent } from 'react';\n\nimport { mockComponent } from '@hh.ru/magritte-ui-mock-component';\n\nexport type * from '@hh.ru/magritte-ui-trigger/types';\n\nexport const Trigger: ForwardRefExoticComponent<Record<string, unknown>> = mockComponent('Trigger', undefined, {\n withChildren: false,\n});\n"],"names":[],"mappings":";;;AAGA,SAAS,OAAO,CAAC,aAAa,EAAE,WAAW,EAAE;AAC7C;AACA,IAAI,OAAO,WAAW,CAAC,IAAI,CAAC;AAC5B,IAAI,OAAO,WAAW,CAAC,QAAQ,CAAC;AAChC,IAAI,OAAO,WAAW,CAAC,MAAM,CAAC;AAC9B,IAAI,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE;AACpC,QAAQ,aAAa,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;AAChD,KAAK;AACL,CAAC;AACD,MAAM,aAAa,GAAG,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE;AAC1C;AACA;AACA;AACA,GAAG,CAAC,yBAAyB,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC;AAMnE;AACA;AACA;AACA,MAAM,aAAa,GAAG,CAAC,aAAa,EAAE,WAAW,GAAG,EAAE,EAAE,EAAE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,GAAG,EAAE,KAAK;AACrH,IAAI,MAAM,WAAW,GAAG,UAAU,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAK;AACpE,QAAQ,MAAM,IAAI;AAClB;AACA,QAAQ,IAAI,CAAC,aAAa,EAAE,EAAE,GAAG,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,eAAe,GAAG,eAAe,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE,YAAY,GAAG,QAAQ,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AACxK,QAAQ,OAAO,gBAAgB,GAAG,GAAG,CAAC,gBAAgB,EAAE,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;AAC7F,KAAK,CAAC,CAAC;AACP,IAAI,WAAW,IAAI,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AACrD,IAAI,WAAW,CAAC,WAAW,GAAG,cAAc,CAAC;AAC7C,IAAI,OAAO,WAAW,CAAC;AACvB,CAAC;;MC7BY,OAAO,GAAuD,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE;AAC3G,IAAA,YAAY,EAAE,KAAK;AACtB,CAAA;;;;"}
1
+ {"version":3,"file":"index.mock.js","sources":["../mock-component/lib/setupMockComponent.js","src/index.mock.ts"],"sourcesContent":["import { jsxs, jsx } from 'react/jsx-runtime';\nimport { forwardRef } from 'react';\n\nfunction enhance(mockComponent2, staticProps) {\n delete staticProps.type;\n delete staticProps.$$typeof;\n delete staticProps.render;\n for (const prop in staticProps) {\n mockComponent2[prop] = staticProps[prop];\n }\n}\nconst MockComponent = ({ style, ...props }) => (\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line react/jsx-no-undef\n /* @__PURE__ */ jsx(\"magritte-component-mock\", { \"style-data\": style, ...props })\n);\nconst MockComponentRenderProp = ({ style, ...props }) => (\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line react/jsx-no-undef\n /* @__PURE__ */ jsx(\"magritte-component-mock-render-prop\", { \"style-data\": style, ...props })\n);\nconst mockComponent = (componentName, staticProps = {}, { withChildren, innerDependence, WrapperComponent } = {}) => {\n const mockWrapper = forwardRef(({ children, ...props }, ref) => {\n const mock = (\n // eslint-disable-next-line react/jsx-no-undef\n /* @__PURE__ */ jsxs(MockComponent, { ...props, _component: componentName, children: [\n innerDependence ? innerDependence(props, ref) : null,\n withChildren ? children : null\n ] })\n );\n return WrapperComponent ? /* @__PURE__ */ jsx(WrapperComponent, { ...props, children: mock }) : mock;\n });\n staticProps && enhance(mockWrapper, staticProps);\n mockWrapper.displayName = \"magritte-ref\";\n return mockWrapper;\n};\nconst mockComponentRenderProp = (componentName, staticProps, { withChildren, innerDependence, renderArguments } = { renderArguments: [] }) => {\n const mockWrapper = ({\n render,\n children,\n ...props\n }) => /* @__PURE__ */ jsxs(MockComponentRenderProp, { ...props, _component: componentName, children: [\n innerDependence ? innerDependence(props) : null,\n withChildren ? children : null,\n render?.(...renderArguments || [])\n ] });\n staticProps && enhance(mockWrapper, staticProps);\n mockWrapper.displayName = \"magritte-component-mock-render-prop\";\n return mockWrapper;\n};\n\nexport { mockComponent, mockComponentRenderProp };\n//# sourceMappingURL=setupMockComponent.js.map\n","import { ForwardRefExoticComponent } from 'react';\n\nimport { mockComponent } from '@hh.ru/magritte-ui-mock-component';\n\nexport type * from '@hh.ru/magritte-ui-trigger/types';\n\nexport const Trigger: ForwardRefExoticComponent<Record<string, unknown>> = mockComponent('Trigger', undefined, {\n withChildren: false,\n});\n"],"names":[],"mappings":";;;AAGA,SAAS,OAAO,CAAC,cAAc,EAAE,WAAW,EAAE;AAC9C,EAAE,OAAO,WAAW,CAAC,IAAI,CAAC;AAC1B,EAAE,OAAO,WAAW,CAAC,QAAQ,CAAC;AAC9B,EAAE,OAAO,WAAW,CAAC,MAAM,CAAC;AAC5B,EAAE,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE;AAClC,IAAI,cAAc,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;AAC7C,GAAG;AACH,CAAC;AACD,MAAM,aAAa,GAAG,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE;AAC1C;AACA;AACA;AACA,kBAAkB,GAAG,CAAC,yBAAyB,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CAAC;AACnF,CAAC,CAAC;AAOF,MAAM,aAAa,GAAG,CAAC,aAAa,EAAE,WAAW,GAAG,EAAE,EAAE,EAAE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,GAAG,EAAE,KAAK;AACrH,EAAE,MAAM,WAAW,GAAG,UAAU,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAK;AAClE,IAAI,MAAM,IAAI;AACd;AACA,sBAAsB,IAAI,CAAC,aAAa,EAAE,EAAE,GAAG,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE;AAC3F,QAAQ,eAAe,GAAG,eAAe,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,IAAI;AAC5D,QAAQ,YAAY,GAAG,QAAQ,GAAG,IAAI;AACtC,OAAO,EAAE,CAAC;AACV,KAAK,CAAC;AACN,IAAI,OAAO,gBAAgB,mBAAmB,GAAG,CAAC,gBAAgB,EAAE,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;AACzG,GAAG,CAAC,CAAC;AACL,EAAE,WAAW,IAAI,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AACnD,EAAE,WAAW,CAAC,WAAW,GAAG,cAAc,CAAC;AAC3C,EAAE,OAAO,WAAW,CAAC;AACrB,CAAC;;AC/BY,MAAA,OAAA,GAA8D,aAAc,CAAA,SAAA,EAAW,KAAW,CAAA,EAAA;AAAA,EAC3G,YAAc,EAAA,KAAA;AAClB,CAAC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hh.ru/magritte-ui-trigger",
3
- "version": "4.3.46",
3
+ "version": "4.3.47",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "sideEffects": [
@@ -29,10 +29,10 @@
29
29
  "@hh.ru/magritte-common-keyboard": "4.3.6",
30
30
  "@hh.ru/magritte-common-resize": "0.2.3",
31
31
  "@hh.ru/magritte-common-use-multiple-refs": "1.1.12",
32
- "@hh.ru/magritte-design-tokens": "26.0.0",
33
- "@hh.ru/magritte-ui-button": "7.3.6",
34
- "@hh.ru/magritte-ui-form-helper": "2.1.24",
35
- "@hh.ru/magritte-ui-icon": "15.1.4"
32
+ "@hh.ru/magritte-design-tokens": "26.0.1",
33
+ "@hh.ru/magritte-ui-button": "7.3.7",
34
+ "@hh.ru/magritte-ui-form-helper": "2.1.25",
35
+ "@hh.ru/magritte-ui-icon": "15.1.5"
36
36
  },
37
- "gitHead": "b0ff5da48fb29d516c8289082560ee1882d16986"
37
+ "gitHead": "f6539d7a0e7cd42dd851458db1de04a748bbee03"
38
38
  }
package/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ReactNode, KeyboardEventHandler, AriaAttributes, AriaRole } from 'react';
2
- import { BaseTrigger } from '@hh.ru/magritte-ui-trigger/BaseTrigger';
2
+ import { BaseTrigger } from './BaseTrigger';
3
3
  export type LargeTriggerSize = 'large';
4
4
  export type OtherTriggerSizes = 'medium' | 'small' | 'xsmall';
5
5
  export type TriggerSize = LargeTriggerSize | OtherTriggerSizes;