@trackunit/react-form-components 0.0.319 → 0.0.321
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.cjs.js
CHANGED
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var i18nLibraryTranslation = require('@trackunit/i18n-library-translation');
|
|
7
7
|
var reactComponents = require('@trackunit/react-components');
|
|
8
|
-
var React = require('react');
|
|
9
8
|
var reactUse = require('react-use');
|
|
10
|
-
var uuid = require('uuid');
|
|
11
9
|
var cssClassVarianceUtilities = require('@trackunit/css-class-variance-utilities');
|
|
10
|
+
var React = require('react');
|
|
11
|
+
var uuid = require('uuid');
|
|
12
12
|
var dateFns = require('date-fns');
|
|
13
13
|
var parsePhoneNumberFromString = require('libphonenumber-js');
|
|
14
14
|
var ReactSelect = require('react-select');
|
|
@@ -119,9 +119,8 @@ const cvaActionContainer = cssClassVarianceUtilities.cvaMerge(["flex", "items-ce
|
|
|
119
119
|
* @param {ActionButtonProps} props - The props for the ActionButton component
|
|
120
120
|
* @returns {JSX.Element} ActionButton component
|
|
121
121
|
*/
|
|
122
|
-
const ActionButton = ({ type, value, dataTestId, iconSize, disabled,
|
|
122
|
+
const ActionButton = ({ type, value, dataTestId, iconSize, disabled, className }) => {
|
|
123
123
|
const [, copyToClipboard] = reactUse.useCopyToClipboard();
|
|
124
|
-
const elementKey = React.useMemo(() => key !== null && key !== void 0 ? key : `ActionButton-${uuid.v4()}`, [key]);
|
|
125
124
|
const getIconName = () => {
|
|
126
125
|
switch (type) {
|
|
127
126
|
case "PHONE_NUMBER":
|
|
@@ -156,7 +155,7 @@ const ActionButton = ({ type, value, dataTestId, iconSize, disabled, key, classN
|
|
|
156
155
|
if (ButtonAction === null) {
|
|
157
156
|
return null;
|
|
158
157
|
}
|
|
159
|
-
return (jsxRuntime.jsx("div", { className: cvaActionContainer({ className }), children: jsxRuntime.jsx(reactComponents.IconButton, { className: cvaActionButton({ size: iconSize }), dataTestId: dataTestId || "testIconButtonId", disabled: disabled, icon: jsxRuntime.jsx(reactComponents.Icon, { name: getIconName(), size: "small" }), onClick: ButtonAction, size: "small", variant: "secondary" }) }
|
|
158
|
+
return (jsxRuntime.jsx("div", { className: cvaActionContainer({ className }), children: jsxRuntime.jsx(reactComponents.IconButton, { className: cvaActionButton({ size: iconSize }), dataTestId: dataTestId || "testIconButtonId", disabled: disabled, icon: jsxRuntime.jsx(reactComponents.Icon, { name: getIconName(), size: "small" }), onClick: ButtonAction, size: "small", variant: "secondary" }) }));
|
|
160
159
|
};
|
|
161
160
|
|
|
162
161
|
/******************************************************************************
|
package/index.esm.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useNamespaceTranslation, registerTranslations } from '@trackunit/i18n-library-translation';
|
|
3
3
|
import { IconButton, Icon, Tooltip, Heading, Text, MenuItem, Tag, Spinner } from '@trackunit/react-components';
|
|
4
|
+
import { useCopyToClipboard } from 'react-use';
|
|
5
|
+
import { cvaMerge } from '@trackunit/css-class-variance-utilities';
|
|
4
6
|
import * as React from 'react';
|
|
5
7
|
import React__default, { useMemo, forwardRef, useCallback, cloneElement, useState, useEffect, useRef, useImperativeHandle } from 'react';
|
|
6
|
-
import { useCopyToClipboard } from 'react-use';
|
|
7
8
|
import { v4 } from 'uuid';
|
|
8
|
-
import { cvaMerge } from '@trackunit/css-class-variance-utilities';
|
|
9
9
|
import { format } from 'date-fns';
|
|
10
10
|
import parsePhoneNumberFromString, { isSupportedCountry, getCountries, getCountryCallingCode, isValidPhoneNumber, parsePhoneNumberFromString as parsePhoneNumberFromString$1 } from 'libphonenumber-js';
|
|
11
11
|
import ReactSelect, { components } from 'react-select';
|
|
@@ -89,9 +89,8 @@ const cvaActionContainer = cvaMerge(["flex", "items-center", "m-1"]);
|
|
|
89
89
|
* @param {ActionButtonProps} props - The props for the ActionButton component
|
|
90
90
|
* @returns {JSX.Element} ActionButton component
|
|
91
91
|
*/
|
|
92
|
-
const ActionButton = ({ type, value, dataTestId, iconSize, disabled,
|
|
92
|
+
const ActionButton = ({ type, value, dataTestId, iconSize, disabled, className }) => {
|
|
93
93
|
const [, copyToClipboard] = useCopyToClipboard();
|
|
94
|
-
const elementKey = useMemo(() => key !== null && key !== void 0 ? key : `ActionButton-${v4()}`, [key]);
|
|
95
94
|
const getIconName = () => {
|
|
96
95
|
switch (type) {
|
|
97
96
|
case "PHONE_NUMBER":
|
|
@@ -126,7 +125,7 @@ const ActionButton = ({ type, value, dataTestId, iconSize, disabled, key, classN
|
|
|
126
125
|
if (ButtonAction === null) {
|
|
127
126
|
return null;
|
|
128
127
|
}
|
|
129
|
-
return (jsx("div", { className: cvaActionContainer({ className }), children: jsx(IconButton, { className: cvaActionButton({ size: iconSize }), dataTestId: dataTestId || "testIconButtonId", disabled: disabled, icon: jsx(Icon, { name: getIconName(), size: "small" }), onClick: ButtonAction, size: "small", variant: "secondary" }) }
|
|
128
|
+
return (jsx("div", { className: cvaActionContainer({ className }), children: jsx(IconButton, { className: cvaActionButton({ size: iconSize }), dataTestId: dataTestId || "testIconButtonId", disabled: disabled, icon: jsx(Icon, { name: getIconName(), size: "small" }), onClick: ButtonAction, size: "small", variant: "secondary" }) }));
|
|
130
129
|
};
|
|
131
130
|
|
|
132
131
|
/******************************************************************************
|
package/package.json
CHANGED
|
@@ -7,10 +7,6 @@ interface AbstractActionButtonProps extends ButtonCommonProps, CommonProps {
|
|
|
7
7
|
* The type of action performed when clicking the button.
|
|
8
8
|
*/
|
|
9
9
|
type: ActionType;
|
|
10
|
-
/**
|
|
11
|
-
* A key to be passed into the button.
|
|
12
|
-
*/
|
|
13
|
-
key?: string;
|
|
14
10
|
/**
|
|
15
11
|
* The value to be passed into the button.
|
|
16
12
|
*/
|
|
@@ -47,5 +43,5 @@ type ActionButtonProps = CopyActionButtonProps | GenericActionButtonProps;
|
|
|
47
43
|
* @param {ActionButtonProps} props - The props for the ActionButton component
|
|
48
44
|
* @returns {JSX.Element} ActionButton component
|
|
49
45
|
*/
|
|
50
|
-
export declare const ActionButton: ({ type, value, dataTestId, iconSize, disabled,
|
|
46
|
+
export declare const ActionButton: ({ type, value, dataTestId, iconSize, disabled, className }: ActionButtonProps) => JSX.Element | null;
|
|
51
47
|
export {};
|