@trackunit/react-form-components 0.0.107-alpha-a3e6a36823.0 → 0.0.114
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 +4 -15
- package/index.esm.js +4 -15
- package/package.json +4 -5
package/index.cjs.js
CHANGED
|
@@ -7,7 +7,6 @@ var i18nLibraryTranslation = require('@trackunit/i18n-library-translation');
|
|
|
7
7
|
var reactComponents = require('@trackunit/react-components');
|
|
8
8
|
var cssClassVarianceUtilities = require('@trackunit/css-class-variance-utilities');
|
|
9
9
|
var React = require('react');
|
|
10
|
-
var tailwindStyledComponents = require('@trackunit/tailwind-styled-components');
|
|
11
10
|
var reactDom = require('react-dom');
|
|
12
11
|
|
|
13
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -14167,7 +14166,7 @@ const TagsContainer = ({ items, width = "100%", itemsGap = 5, postFix, disabled
|
|
|
14167
14166
|
}
|
|
14168
14167
|
const itemCanFit = spaceNeeded <= availableSpace;
|
|
14169
14168
|
if (itemCanFit) {
|
|
14170
|
-
return (jsxRuntime.jsx(TagWithWidth, { onWidthKnown: onWidthKnownHandler, className:
|
|
14169
|
+
return (jsxRuntime.jsx(TagWithWidth, { onWidthKnown: onWidthKnownHandler, className: "shrink-0 inline-flex", onClose: e => {
|
|
14171
14170
|
e.stopPropagation();
|
|
14172
14171
|
item.onClick();
|
|
14173
14172
|
}, color: item.disabled ? "unknown" : "primary", dataTestId: item.text, disabled: disabled, children: item.text }, item.text + index));
|
|
@@ -14530,13 +14529,8 @@ const PhoneInput = React.forwardRef((_a, ref) => {
|
|
|
14530
14529
|
React.useEffect(() => {
|
|
14531
14530
|
onChangeGetSeparateValues && onChangeGetSeparateValues({ countryCode, phoneNumber });
|
|
14532
14531
|
}, [countryCode, onChangeGetSeparateValues, phoneNumber]);
|
|
14533
|
-
return (jsxRuntime.jsxs(
|
|
14532
|
+
return (jsxRuntime.jsxs("div", { className: "grid grid-cols-min-fr gap-2", "data-testid": dataTestId && `${dataTestId}-container`, children: [jsxRuntime.jsx("input", { hidden: true, id: "phone-input", "data-testid": dataTestId, value: combinedValue, ref: hiddenInputRef, onChange: onChange, "aria-invalid": isCombinedValueInvalid || isInvalid }), jsxRuntime.jsx(CountryCodeSelect, { dataTestId: dataTestId && `${dataTestId}-countryCodeSelect`, countryCode: countryCode, onChange: handleCountryCodeChange, disabled: disabled, readOnly: readOnly, isInvalid: isCountryCodeInvalid || isInvalid, placeholder: "+45" }), jsxRuntime.jsx(BaseInput, Object.assign({ id: "phoneInput-number", dataTestId: dataTestId && `${dataTestId}-phoneNumberInput`, fieldSize: fieldSize, type: "tel", value: phoneNumber, disabled: disabled, readOnly: readOnly, onChange: handlePhoneNumberChange, isInvalid: isPhoneNumberInvalid || isInvalid, actions: !disableAction && (jsxRuntime.jsx(ActionButton, { disabled: disabled || isInvalid || isCountryCodeInvalid || isPhoneNumberInvalid, value: `${countryCode}${phoneNumber}`, type: "PHONE_NUMBER", dataTestId: dataTestId && `${dataTestId}-phoneIcon`, iconSize: fieldSize })) }, rest))] }));
|
|
14534
14533
|
});
|
|
14535
|
-
const Container = tailwindStyledComponents.tw.div `
|
|
14536
|
-
grid
|
|
14537
|
-
grid-cols-min-fr
|
|
14538
|
-
gap-2
|
|
14539
|
-
`;
|
|
14540
14534
|
|
|
14541
14535
|
/**
|
|
14542
14536
|
* The PhoneField component is used to enter phone number.
|
|
@@ -14857,11 +14851,8 @@ const TextArea = React__namespace.forwardRef((_a, ref) => {
|
|
|
14857
14851
|
* @returns {JSX.Element} TextLengthIndicator component
|
|
14858
14852
|
*/
|
|
14859
14853
|
const TextLengthIndicator = ({ length, maxLength }) => {
|
|
14860
|
-
return (jsxRuntime.jsxs(
|
|
14854
|
+
return (jsxRuntime.jsxs("span", { className: "font-mono", children: [length, "/", maxLength] }));
|
|
14861
14855
|
};
|
|
14862
|
-
const Root = tailwindStyledComponents.tw.span `
|
|
14863
|
-
font-mono
|
|
14864
|
-
`;
|
|
14865
14856
|
|
|
14866
14857
|
const TextAreaField = React__namespace.forwardRef((_a, ref) => {
|
|
14867
14858
|
var { id, label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, dataTestId } = _a, rest = __rest(_a, ["id", "label", "tip", "helpText", "helpAddon", "errorMessage", "isInvalid", "maxLength", "onChange", "className", "value", "dataTestId"]);
|
|
@@ -15009,7 +15000,7 @@ const cvaUploadInputAddonBefore = cssClassVarianceUtilities.cvaMerge(["block", "
|
|
|
15009
15000
|
*/
|
|
15010
15001
|
const UploadInput = React.forwardRef((_a, ref) => {
|
|
15011
15002
|
var { disabled, acceptedTypes, nonInteractive, uploadLabel, multipleFiles } = _a, rest = __rest(_a, ["disabled", "acceptedTypes", "nonInteractive", "uploadLabel", "multipleFiles"]);
|
|
15012
|
-
return (jsxRuntime.jsx(
|
|
15003
|
+
return (jsxRuntime.jsx("label", { className: "tu-upload-input", children: jsxRuntime.jsx(BaseInput, Object.assign({ inputClassName: cvaUploadInputField(), addonBefore: uploadLabel, addonBeforeClassName: cvaUploadInputAddonBefore(), ref: ref, disabled: disabled, accept: acceptedTypes, multiple: multipleFiles, type: "file", nonInteractive: nonInteractive,
|
|
15013
15004
|
// onClick used to work with nonInteractive option
|
|
15014
15005
|
onClick: event => {
|
|
15015
15006
|
if (nonInteractive) {
|
|
@@ -15018,8 +15009,6 @@ const UploadInput = React.forwardRef((_a, ref) => {
|
|
|
15018
15009
|
}
|
|
15019
15010
|
} }, rest)) }));
|
|
15020
15011
|
});
|
|
15021
|
-
const UploadInputContainer = tailwindStyledComponents.tw.label `
|
|
15022
|
-
tu-upload-input`;
|
|
15023
15012
|
|
|
15024
15013
|
/**
|
|
15025
15014
|
* Upload fields enable the user to upload Files.
|
package/index.esm.js
CHANGED
|
@@ -4,7 +4,6 @@ import { IconButton, Icon, Tip, Heading, Text, MenuItem, Tag, Spinner } from '@t
|
|
|
4
4
|
import { cvaMerge } from '@trackunit/css-class-variance-utilities';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import React__default, { useMemo, forwardRef, useState, cloneElement, useEffect, useCallback, useLayoutEffect, useContext, createElement, Fragment, createContext, useRef, Component } from 'react';
|
|
7
|
-
import { tws, tw } from '@trackunit/tailwind-styled-components';
|
|
8
7
|
import { createPortal } from 'react-dom';
|
|
9
8
|
|
|
10
9
|
var defaultTranslations = {
|
|
@@ -14141,7 +14140,7 @@ const TagsContainer = ({ items, width = "100%", itemsGap = 5, postFix, disabled
|
|
|
14141
14140
|
}
|
|
14142
14141
|
const itemCanFit = spaceNeeded <= availableSpace;
|
|
14143
14142
|
if (itemCanFit) {
|
|
14144
|
-
return (jsx$1(TagWithWidth, { onWidthKnown: onWidthKnownHandler, className:
|
|
14143
|
+
return (jsx$1(TagWithWidth, { onWidthKnown: onWidthKnownHandler, className: "shrink-0 inline-flex", onClose: e => {
|
|
14145
14144
|
e.stopPropagation();
|
|
14146
14145
|
item.onClick();
|
|
14147
14146
|
}, color: item.disabled ? "unknown" : "primary", dataTestId: item.text, disabled: disabled, children: item.text }, item.text + index));
|
|
@@ -14504,13 +14503,8 @@ const PhoneInput = forwardRef((_a, ref) => {
|
|
|
14504
14503
|
useEffect(() => {
|
|
14505
14504
|
onChangeGetSeparateValues && onChangeGetSeparateValues({ countryCode, phoneNumber });
|
|
14506
14505
|
}, [countryCode, onChangeGetSeparateValues, phoneNumber]);
|
|
14507
|
-
return (jsxs(
|
|
14506
|
+
return (jsxs("div", { className: "grid grid-cols-min-fr gap-2", "data-testid": dataTestId && `${dataTestId}-container`, children: [jsx$1("input", { hidden: true, id: "phone-input", "data-testid": dataTestId, value: combinedValue, ref: hiddenInputRef, onChange: onChange, "aria-invalid": isCombinedValueInvalid || isInvalid }), jsx$1(CountryCodeSelect, { dataTestId: dataTestId && `${dataTestId}-countryCodeSelect`, countryCode: countryCode, onChange: handleCountryCodeChange, disabled: disabled, readOnly: readOnly, isInvalid: isCountryCodeInvalid || isInvalid, placeholder: "+45" }), jsx$1(BaseInput, Object.assign({ id: "phoneInput-number", dataTestId: dataTestId && `${dataTestId}-phoneNumberInput`, fieldSize: fieldSize, type: "tel", value: phoneNumber, disabled: disabled, readOnly: readOnly, onChange: handlePhoneNumberChange, isInvalid: isPhoneNumberInvalid || isInvalid, actions: !disableAction && (jsx$1(ActionButton, { disabled: disabled || isInvalid || isCountryCodeInvalid || isPhoneNumberInvalid, value: `${countryCode}${phoneNumber}`, type: "PHONE_NUMBER", dataTestId: dataTestId && `${dataTestId}-phoneIcon`, iconSize: fieldSize })) }, rest))] }));
|
|
14508
14507
|
});
|
|
14509
|
-
const Container = tw.div `
|
|
14510
|
-
grid
|
|
14511
|
-
grid-cols-min-fr
|
|
14512
|
-
gap-2
|
|
14513
|
-
`;
|
|
14514
14508
|
|
|
14515
14509
|
/**
|
|
14516
14510
|
* The PhoneField component is used to enter phone number.
|
|
@@ -14831,11 +14825,8 @@ const TextArea = React.forwardRef((_a, ref) => {
|
|
|
14831
14825
|
* @returns {JSX.Element} TextLengthIndicator component
|
|
14832
14826
|
*/
|
|
14833
14827
|
const TextLengthIndicator = ({ length, maxLength }) => {
|
|
14834
|
-
return (jsxs(
|
|
14828
|
+
return (jsxs("span", { className: "font-mono", children: [length, "/", maxLength] }));
|
|
14835
14829
|
};
|
|
14836
|
-
const Root = tw.span `
|
|
14837
|
-
font-mono
|
|
14838
|
-
`;
|
|
14839
14830
|
|
|
14840
14831
|
const TextAreaField = React.forwardRef((_a, ref) => {
|
|
14841
14832
|
var { id, label, tip, helpText, helpAddon, errorMessage, isInvalid, maxLength, onChange, className, value, dataTestId } = _a, rest = __rest(_a, ["id", "label", "tip", "helpText", "helpAddon", "errorMessage", "isInvalid", "maxLength", "onChange", "className", "value", "dataTestId"]);
|
|
@@ -14983,7 +14974,7 @@ const cvaUploadInputAddonBefore = cvaMerge(["block", "truncate", "w-28", "pt-2"]
|
|
|
14983
14974
|
*/
|
|
14984
14975
|
const UploadInput = forwardRef((_a, ref) => {
|
|
14985
14976
|
var { disabled, acceptedTypes, nonInteractive, uploadLabel, multipleFiles } = _a, rest = __rest(_a, ["disabled", "acceptedTypes", "nonInteractive", "uploadLabel", "multipleFiles"]);
|
|
14986
|
-
return (jsx$1(
|
|
14977
|
+
return (jsx$1("label", { className: "tu-upload-input", children: jsx$1(BaseInput, Object.assign({ inputClassName: cvaUploadInputField(), addonBefore: uploadLabel, addonBeforeClassName: cvaUploadInputAddonBefore(), ref: ref, disabled: disabled, accept: acceptedTypes, multiple: multipleFiles, type: "file", nonInteractive: nonInteractive,
|
|
14987
14978
|
// onClick used to work with nonInteractive option
|
|
14988
14979
|
onClick: event => {
|
|
14989
14980
|
if (nonInteractive) {
|
|
@@ -14992,8 +14983,6 @@ const UploadInput = forwardRef((_a, ref) => {
|
|
|
14992
14983
|
}
|
|
14993
14984
|
} }, rest)) }));
|
|
14994
14985
|
});
|
|
14995
|
-
const UploadInputContainer = tw.label `
|
|
14996
|
-
tu-upload-input`;
|
|
14997
14986
|
|
|
14998
14987
|
/**
|
|
14999
14988
|
* Upload fields enable the user to upload Files.
|
package/package.json
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-form-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.114",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=18.x"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@trackunit/css-class-variance-utilities": "0.0.
|
|
11
|
-
"@trackunit/i18n-library-translation": "0.0.68
|
|
12
|
-
"@trackunit/react-components": "0.1.
|
|
13
|
-
"@trackunit/tailwind-styled-components": "0.0.61-alpha-a3e6a36823.0",
|
|
10
|
+
"@trackunit/css-class-variance-utilities": "0.0.11",
|
|
11
|
+
"@trackunit/i18n-library-translation": "0.0.68",
|
|
12
|
+
"@trackunit/react-components": "0.1.145",
|
|
14
13
|
"date-fns": "2.29.3",
|
|
15
14
|
"libphonenumber-js": "1.10.36",
|
|
16
15
|
"react": "18.2.0",
|