@justfixnyc/component-library 0.54.0 → 0.54.1
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/dist/src/assets/index.css +1 -0
- package/dist/src/assets/index.es.css +1 -0
- package/dist/src/index.es.js +2 -30
- package/dist/src/index.js +1 -29
- package/package.json +1 -1
package/dist/src/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from '@babel/runtime/helpers/extends';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import React, { forwardRef, useId
|
|
3
|
+
import React, { forwardRef, useId } from 'react';
|
|
4
4
|
import { faBan, faXmark, faDownload as faDownload$1, faBuildingColumns, faAddressCard, faBuilding, faMapLocationDot, faMemoPad, faLocationDot, faHouse, faGlobe, faUser, faSpinner, faBars, faEnvelope as faEnvelope$1, faCommentSms, faCopy, faCirclePlus, faCircleInfo, faCircleExclamation as faCircleExclamation$1, faChevronRight, faChevronLeft, faChevronDown, faChevronUp, faCheckDouble, faCheck, faCaretDown, faCaretRight, faBookmark as faBookmark$1, faSquareArrowUpRight, faArrowsRotateReverse, faArrowDownWideShort, faArrowUpShortWide, faArrowUpArrowDown, faArrowDownLong, faArrowUpLong, faArrowDown, faArrowUp, faArrowRight, faArrowLeft } from '@awesome.me/kit-dd32553919/icons/classic/solid';
|
|
5
5
|
import { faPrint, faEyeSlash, faEye, faDownload, faEnvelope, faCircleExclamation, faBookmark } from '@awesome.me/kit-dd32553919/icons/classic/regular';
|
|
6
6
|
import { faXTwitter, faTwitter, faFacebookF } from '@awesome.me/kit-dd32553919/icons/classic/brands';
|
|
@@ -581,32 +581,6 @@ const TextInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
581
581
|
const textInputClassNames = classNames('jfcl-text-input__input', {
|
|
582
582
|
["jfcl-text-input--size-".concat(size)]: size
|
|
583
583
|
});
|
|
584
|
-
const formatPhoneNumber = value => {
|
|
585
|
-
// remove all non-digit characters
|
|
586
|
-
const cleaned = value.replace(/\D/g, '');
|
|
587
|
-
// limit to 10 characters
|
|
588
|
-
const limited = cleaned.slice(0, 10);
|
|
589
|
-
|
|
590
|
-
// format with parentheses and dashes e.g. (555) 666-7777
|
|
591
|
-
const match = limited.match(/^(\d{0,3})(\d{0,3})(\d{0,4})$/);
|
|
592
|
-
if (match) {
|
|
593
|
-
const [, part1, part2, part3] = match;
|
|
594
|
-
const formatted = [part1 ? "(".concat(part1) : '', part2 ? ") ".concat(part2) : '', part3 ? "-".concat(part3) : ''].join('').trim();
|
|
595
|
-
return formatted;
|
|
596
|
-
}
|
|
597
|
-
return value;
|
|
598
|
-
};
|
|
599
|
-
const [inputValue, setInputValue] = useState('');
|
|
600
|
-
const handleChange = e => {
|
|
601
|
-
let formattedValue = e.target.value;
|
|
602
|
-
if (type === 'tel') {
|
|
603
|
-
formattedValue = formatPhoneNumber(e.target.value);
|
|
604
|
-
}
|
|
605
|
-
setInputValue(formattedValue);
|
|
606
|
-
if (props.onChange) {
|
|
607
|
-
props.onChange(e); // call original onChange if provided
|
|
608
|
-
}
|
|
609
|
-
};
|
|
610
584
|
return /*#__PURE__*/React.createElement("div", {
|
|
611
585
|
className: textInputWrapperClassNames,
|
|
612
586
|
"data-testid": "jfcl-text-input"
|
|
@@ -626,9 +600,7 @@ const TextInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
626
600
|
}, props, {
|
|
627
601
|
id: id,
|
|
628
602
|
className: textInputClassNames,
|
|
629
|
-
type: inputType
|
|
630
|
-
value: inputValue,
|
|
631
|
-
onChange: handleChange
|
|
603
|
+
type: inputType
|
|
632
604
|
}))));
|
|
633
605
|
});
|
|
634
606
|
TextInput.displayName = 'TextInput';
|
package/dist/src/index.js
CHANGED
|
@@ -592,32 +592,6 @@ const TextInput = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref)
|
|
|
592
592
|
const textInputClassNames = classNames__default["default"]('jfcl-text-input__input', {
|
|
593
593
|
["jfcl-text-input--size-".concat(size)]: size
|
|
594
594
|
});
|
|
595
|
-
const formatPhoneNumber = value => {
|
|
596
|
-
// remove all non-digit characters
|
|
597
|
-
const cleaned = value.replace(/\D/g, '');
|
|
598
|
-
// limit to 10 characters
|
|
599
|
-
const limited = cleaned.slice(0, 10);
|
|
600
|
-
|
|
601
|
-
// format with parentheses and dashes e.g. (555) 666-7777
|
|
602
|
-
const match = limited.match(/^(\d{0,3})(\d{0,3})(\d{0,4})$/);
|
|
603
|
-
if (match) {
|
|
604
|
-
const [, part1, part2, part3] = match;
|
|
605
|
-
const formatted = [part1 ? "(".concat(part1) : '', part2 ? ") ".concat(part2) : '', part3 ? "-".concat(part3) : ''].join('').trim();
|
|
606
|
-
return formatted;
|
|
607
|
-
}
|
|
608
|
-
return value;
|
|
609
|
-
};
|
|
610
|
-
const [inputValue, setInputValue] = React.useState('');
|
|
611
|
-
const handleChange = e => {
|
|
612
|
-
let formattedValue = e.target.value;
|
|
613
|
-
if (type === 'tel') {
|
|
614
|
-
formattedValue = formatPhoneNumber(e.target.value);
|
|
615
|
-
}
|
|
616
|
-
setInputValue(formattedValue);
|
|
617
|
-
if (props.onChange) {
|
|
618
|
-
props.onChange(e); // call original onChange if provided
|
|
619
|
-
}
|
|
620
|
-
};
|
|
621
595
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
622
596
|
className: textInputWrapperClassNames,
|
|
623
597
|
"data-testid": "jfcl-text-input"
|
|
@@ -637,9 +611,7 @@ const TextInput = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref)
|
|
|
637
611
|
}, props, {
|
|
638
612
|
id: id,
|
|
639
613
|
className: textInputClassNames,
|
|
640
|
-
type: inputType
|
|
641
|
-
value: inputValue,
|
|
642
|
-
onChange: handleChange
|
|
614
|
+
type: inputType
|
|
643
615
|
}))));
|
|
644
616
|
});
|
|
645
617
|
TextInput.displayName = 'TextInput';
|