@tap-payments/os-micro-frontend-shared 0.1.31-test.10 → 0.1.31-test.12

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.
@@ -10,7 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { useState } from 'react';
13
+ import { useMemo, useState } from 'react';
14
14
  import Box from '@mui/material/Box';
15
15
  import { useTranslation } from 'react-i18next';
16
16
  import { AnimatePresence, motion } from 'framer-motion';
@@ -22,9 +22,6 @@ const StatusChip = (_a) => {
22
22
  var { children, unknownText, copyText } = _a, props = __rest(_a, ["children", "unknownText", "copyText"]);
23
23
  const [showCopy, setShowCopy] = useState(false);
24
24
  const { t } = useTranslation();
25
- if (!children) {
26
- return (_jsx(ChipStyled, Object.assign({}, unknownGeographyColors, props, { children: unknownText ? t(unknownText) : t('unknown') })));
27
- }
28
25
  const handleCopy = (e) => {
29
26
  e.stopPropagation();
30
27
  if (copyText) {
@@ -38,20 +35,24 @@ const StatusChip = (_a) => {
38
35
  };
39
36
  }
40
37
  };
41
- return (_jsxs(Box, Object.assign({ sx: { position: 'relative', zIndex: props.isSelected ? 3 : 0 } }, { children: [_jsx(ChipStyled, Object.assign({}, props, { sx: { visibility: 'hidden', pointerEvents: 'none' } }, { children: _jsx(Wrapper, { children: children }) })), _jsx(motion.div, Object.assign({ layout: true, transition: {
42
- type: 'spring',
43
- stiffness: 180,
44
- damping: 25,
45
- mass: 0.4,
46
- } }, { children: _jsxs(ChipStyled, Object.assign({}, props, { sx: {
47
- position: 'absolute',
48
- top: 0,
49
- left: 0,
50
- zIndex: props.isSelected ? 3 : 0,
51
- } }, { children: [_jsx(Wrapper, { children: children }), _jsx(AnimatePresence, Object.assign({ mode: "wait" }, { children: props.isSelected && copyText && (_jsx(motion.img, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, onClick: handleCopy, src: showCopy ? greenCheckIcon : blueCopyIcon, style: {
52
- height: 12,
53
- width: 12,
54
- objectFit: 'contain',
55
- } })) }))] })) }))] })));
38
+ const renderCopy = useMemo(() => (_jsx(motion.div, Object.assign({ layout: true, transition: {
39
+ type: 'spring',
40
+ stiffness: 180,
41
+ damping: 25,
42
+ mass: 0.4,
43
+ } }, { children: _jsxs(ChipStyled, Object.assign({}, props, { sx: {
44
+ position: 'absolute',
45
+ top: 0,
46
+ left: 0,
47
+ zIndex: props.isSelected ? 3 : 0,
48
+ } }, { children: [_jsx(Wrapper, { children: children }), _jsx(AnimatePresence, Object.assign({ mode: "wait" }, { children: props.isSelected && copyText && (_jsx(motion.img, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, onClick: handleCopy, src: showCopy ? greenCheckIcon : blueCopyIcon, style: {
49
+ height: 12,
50
+ width: 12,
51
+ objectFit: 'contain',
52
+ } })) }))] })) }))), [props.isSelected, copyText, showCopy]);
53
+ if (!children) {
54
+ return (_jsxs(Box, Object.assign({ sx: { position: 'relative', zIndex: props.isSelected ? 3 : 0 } }, { children: [_jsx(ChipStyled, Object.assign({}, unknownGeographyColors, props, { children: unknownText ? t(unknownText) : t('unknown') })), renderCopy] })));
55
+ }
56
+ return (_jsxs(Box, Object.assign({ sx: { position: 'relative', zIndex: props.isSelected ? 3 : 0 } }, { children: [_jsx(ChipStyled, Object.assign({}, props, { sx: { visibility: 'hidden', pointerEvents: 'none' } }, { children: _jsx(Wrapper, { children: children }) })), renderCopy] })));
56
57
  };
57
58
  export default StatusChip;
@@ -1,11 +1,11 @@
1
1
  /// <reference types="react" />
2
- import { BoxProps } from '@mui/material/Box';
2
+ import { StatusChipProps } from '../StatusChip';
3
3
  import { ChipSelection } from '../../types/index.js';
4
- export interface StatusChipWithCopyProps extends BoxProps {
4
+ export interface StatusChipWithCopyProps extends StatusChipProps {
5
5
  copyText?: string;
6
6
  chipIndex: number;
7
7
  chipSelection: ChipSelection;
8
8
  }
9
- declare function StatusChipWithCopy({ children, copyText, chipIndex, chipSelection: { onChipClick, rowIndex, colIndex, selectedChip }, }: StatusChipWithCopyProps): import("react/jsx-runtime").JSX.Element;
9
+ declare function StatusChipWithCopy({ children, copyText, chipIndex, chipSelection: { onChipClick, rowIndex, colIndex, selectedChip }, ...reset }: StatusChipWithCopyProps): import("react/jsx-runtime").JSX.Element;
10
10
  declare const _default: import("react").MemoExoticComponent<typeof StatusChipWithCopy>;
11
11
  export default _default;
@@ -1,11 +1,22 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
1
12
  import { jsx as _jsx } from "react/jsx-runtime";
2
13
  import { memo, useMemo } from 'react';
3
14
  import StatusChip from '../StatusChip';
4
15
  import { checkIsChipSelected } from './utils';
5
- function StatusChipWithCopy({ children, copyText, chipIndex, chipSelection: { onChipClick, rowIndex, colIndex, selectedChip }, }) {
16
+ function StatusChipWithCopy(_a) {
17
+ var { children, copyText, chipIndex, chipSelection: { onChipClick, rowIndex, colIndex, selectedChip } } = _a, reset = __rest(_a, ["children", "copyText", "chipIndex", "chipSelection"]);
6
18
  const isSelected = useMemo(() => checkIsChipSelected({ rowIndex, colIndex, selectedChip, chipIndex }), [rowIndex, colIndex, selectedChip, chipIndex]);
7
- return (_jsx(StatusChip, Object.assign({ copyText: copyText, onClick: (e) => {
8
- console.log('click', onChipClick);
19
+ return (_jsx(StatusChip, Object.assign({}, reset, { copyText: copyText, onClick: (e) => {
9
20
  onChipClick === null || onChipClick === void 0 ? void 0 : onChipClick(e, chipIndex);
10
21
  }, isSelected: isSelected }, { children: children })));
11
22
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@tap-payments/os-micro-frontend-shared",
3
3
  "description": "Shared components and utilities for Tap Payments micro frontends",
4
- "version": "0.1.31-test.10",
5
- "testVersion": 10,
4
+ "version": "0.1.31-test.12",
5
+ "testVersion": 12,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",