@justfixnyc/component-library 0.53.8 → 0.53.10

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.
@@ -661,6 +661,7 @@
661
661
 
662
662
  .jfcl-select-button__input:checked + .jfcl-select-button__label {
663
663
  background-color: #c6d8ff;
664
+ border-color: #242323;
664
665
  }
665
666
 
666
667
  .jfcl-select-button__input:focus-visible + .jfcl-select-button__label {
@@ -661,6 +661,7 @@
661
661
 
662
662
  .jfcl-select-button__input:checked + .jfcl-select-button__label {
663
663
  background-color: #c6d8ff;
664
+ border-color: #242323;
664
665
  }
665
666
 
666
667
  .jfcl-select-button__input:focus-visible + .jfcl-select-button__label {
@@ -1,7 +1,7 @@
1
1
  import _extends from '@babel/runtime/helpers/extends';
2
2
  import classNames from 'classnames';
3
- import React, { forwardRef, useId } from 'react';
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, 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';
3
+ import React, { forwardRef, useId, useState } from 'react';
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';
7
7
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
@@ -61,6 +61,9 @@ const Icon = _ref => {
61
61
  case 'check':
62
62
  faIcon = faCheck;
63
63
  break;
64
+ case 'checkDouble':
65
+ faIcon = faCheckDouble;
66
+ break;
64
67
  case 'chevronUp':
65
68
  faIcon = faChevronUp;
66
69
  break;
@@ -578,6 +581,32 @@ const TextInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
578
581
  const textInputClassNames = classNames('jfcl-text-input__input', {
579
582
  ["jfcl-text-input--size-".concat(size)]: size
580
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
+ };
581
610
  return /*#__PURE__*/React.createElement("div", {
582
611
  className: textInputWrapperClassNames,
583
612
  "data-testid": "jfcl-text-input"
@@ -597,7 +626,9 @@ const TextInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
597
626
  }, props, {
598
627
  id: id,
599
628
  className: textInputClassNames,
600
- type: inputType
629
+ type: inputType,
630
+ value: inputValue,
631
+ onChange: handleChange
601
632
  }))));
602
633
  });
603
634
  TextInput.displayName = 'TextInput';
package/dist/src/index.js CHANGED
@@ -72,6 +72,9 @@ const Icon = _ref => {
72
72
  case 'check':
73
73
  faIcon = solid.faCheck;
74
74
  break;
75
+ case 'checkDouble':
76
+ faIcon = solid.faCheckDouble;
77
+ break;
75
78
  case 'chevronUp':
76
79
  faIcon = solid.faChevronUp;
77
80
  break;
@@ -589,6 +592,32 @@ const TextInput = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref)
589
592
  const textInputClassNames = classNames__default["default"]('jfcl-text-input__input', {
590
593
  ["jfcl-text-input--size-".concat(size)]: size
591
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
+ };
592
621
  return /*#__PURE__*/React__default["default"].createElement("div", {
593
622
  className: textInputWrapperClassNames,
594
623
  "data-testid": "jfcl-text-input"
@@ -608,7 +637,9 @@ const TextInput = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref)
608
637
  }, props, {
609
638
  id: id,
610
639
  className: textInputClassNames,
611
- type: inputType
640
+ type: inputType,
641
+ value: inputValue,
642
+ onChange: handleChange
612
643
  }))));
613
644
  });
614
645
  TextInput.displayName = 'TextInput';
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { FontAwesomeIconProps } from '@fortawesome/react-fontawesome';
3
- export type IconNames = 'arrowLeft' | 'arrowRight' | 'arrowUp' | 'arrowDown' | 'arrowUpLong' | 'arrowDownLong' | 'arrowUpArrowDown' | 'arrowUpShortWide' | 'arrowDownWideShort' | 'arrowsRotateReverse' | 'squareArrowUpRight' | 'bookmark' | 'caretRight' | 'caretDown' | 'check' | 'chevronUp' | 'chevronDown' | 'chevronLeft' | 'chevronRight' | 'circleExclamation' | 'circleInfo' | 'circlePlus' | 'copy' | 'facebook' | 'twitter' | 'xTwitter' | 'sms' | 'envelope' | 'bars' | 'spinner' | 'user' | 'globe' | 'house' | 'locationDot' | 'memoPad' | 'mapLocationDot' | 'building' | 'addressCard' | 'buildingColumns' | 'download' | 'downloadRegular' | 'xmark' | 'ban' | 'eye' | 'eyeSlash' | 'print';
3
+ export type IconNames = 'arrowLeft' | 'arrowRight' | 'arrowUp' | 'arrowDown' | 'arrowUpLong' | 'arrowDownLong' | 'arrowUpArrowDown' | 'arrowUpShortWide' | 'arrowDownWideShort' | 'arrowsRotateReverse' | 'squareArrowUpRight' | 'bookmark' | 'caretRight' | 'caretDown' | 'check' | 'checkDouble' | 'chevronUp' | 'chevronDown' | 'chevronLeft' | 'chevronRight' | 'circleExclamation' | 'circleInfo' | 'circlePlus' | 'copy' | 'facebook' | 'twitter' | 'xTwitter' | 'sms' | 'envelope' | 'bars' | 'spinner' | 'user' | 'globe' | 'house' | 'locationDot' | 'memoPad' | 'mapLocationDot' | 'building' | 'addressCard' | 'buildingColumns' | 'download' | 'downloadRegular' | 'xmark' | 'ban' | 'eye' | 'eyeSlash' | 'print';
4
4
  export interface IconProps extends Omit<FontAwesomeIconProps, 'icon'> {
5
5
  className?: string;
6
6
  icon?: IconNames;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@justfixnyc/component-library",
3
3
  "description": "JustFix Component Library",
4
4
  "license": "MIT",
5
- "version": "0.53.8",
5
+ "version": "0.53.10",
6
6
  "main": "dist/src/index.js",
7
7
  "module": "dist/src/index.es.js",
8
8
  "files": [