@justfixnyc/component-library 0.54.0 → 0.54.2

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,6 +1,6 @@
1
1
  import _extends from '@babel/runtime/helpers/extends';
2
2
  import classNames from 'classnames';
3
- import React, { forwardRef, useId, useState } from 'react';
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';
@@ -319,7 +319,8 @@ const InputHeader = _ref2 => {
319
319
  helperText,
320
320
  helperElement,
321
321
  invalid,
322
- invalidText
322
+ invalidText,
323
+ invalidRole
323
324
  } = _ref2;
324
325
  const showHeader = headerText || helperText || invalid && invalidText;
325
326
  return /*#__PURE__*/React.createElement(React.Fragment, null, showHeader && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(HeaderLabel, {
@@ -332,7 +333,8 @@ const InputHeader = _ref2 => {
332
333
  "data-testid": "helper-text"
333
334
  }, helperText), helperElement, invalid && invalidText && /*#__PURE__*/React.createElement("div", {
334
335
  className: "jfcl-input-header__invalid_text",
335
- "data-testid": "error"
336
+ "data-testid": "error",
337
+ role: invalidRole
336
338
  }, /*#__PURE__*/React.createElement(Icon, {
337
339
  icon: "circleExclamation",
338
340
  className: "jfcl-input-header__invalid_icon"
@@ -346,6 +348,7 @@ const Checkbox = /*#__PURE__*/React.forwardRef((_ref, ref) => {
346
348
  let {
347
349
  className,
348
350
  invalidText,
351
+ invalidRole,
349
352
  invalid,
350
353
  headerText,
351
354
  helperText,
@@ -367,7 +370,8 @@ const Checkbox = /*#__PURE__*/React.forwardRef((_ref, ref) => {
367
370
  headerText: headerText,
368
371
  helperText: helperText,
369
372
  invalid: invalid,
370
- invalidText: invalidText
373
+ invalidText: invalidText,
374
+ invalidRole: invalidRole
371
375
  }), /*#__PURE__*/React.createElement("div", {
372
376
  className: "jfcl-checkbox__checkmark-label-wrapper"
373
377
  }, /*#__PURE__*/React.createElement("input", _extends({
@@ -402,6 +406,7 @@ const Dropdown = _ref => {
402
406
  helperText,
403
407
  invalid,
404
408
  invalidText,
409
+ invalidRole,
405
410
  disabled,
406
411
  labelText,
407
412
  onChange,
@@ -424,7 +429,8 @@ const Dropdown = _ref => {
424
429
  labelFor: inputId,
425
430
  helperText: helperText,
426
431
  invalid: invalid,
427
- invalidText: invalidText
432
+ invalidText: invalidText,
433
+ invalidRole: invalidRole
428
434
  }), /*#__PURE__*/React.createElement(Select, _extends({
429
435
  placeholder: null
430
436
  }, props, {
@@ -451,6 +457,7 @@ const FormGroup = /*#__PURE__*/React.forwardRef((_ref, ref) => {
451
457
  className,
452
458
  children,
453
459
  invalidText,
460
+ invalidRole,
454
461
  invalid,
455
462
  helperText,
456
463
  helperElement,
@@ -470,6 +477,7 @@ const FormGroup = /*#__PURE__*/React.forwardRef((_ref, ref) => {
470
477
  helperElement: helperElement,
471
478
  invalid: invalid,
472
479
  invalidText: invalidText,
480
+ invalidRole: invalidRole,
473
481
  isLegend: true
474
482
  }), children);
475
483
  });
@@ -482,6 +490,7 @@ const RadioButton = /*#__PURE__*/React.forwardRef((_ref, ref) => {
482
490
  let {
483
491
  className,
484
492
  invalidText,
493
+ invalidRole,
485
494
  invalid,
486
495
  headerText,
487
496
  helperText,
@@ -504,7 +513,8 @@ const RadioButton = /*#__PURE__*/React.forwardRef((_ref, ref) => {
504
513
  headerText: headerText,
505
514
  helperText: helperText,
506
515
  invalid: invalid,
507
- invalidText: invalidText
516
+ invalidText: invalidText,
517
+ invalidRole: invalidRole
508
518
  }), /*#__PURE__*/React.createElement("input", _extends({
509
519
  ref: ref
510
520
  }, props, {
@@ -563,6 +573,7 @@ const TextInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
563
573
  let {
564
574
  className,
565
575
  invalidText,
576
+ invalidRole,
566
577
  invalid,
567
578
  helperText,
568
579
  helperElement,
@@ -581,32 +592,6 @@ const TextInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
581
592
  const textInputClassNames = classNames('jfcl-text-input__input', {
582
593
  ["jfcl-text-input--size-".concat(size)]: size
583
594
  });
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
595
  return /*#__PURE__*/React.createElement("div", {
611
596
  className: textInputWrapperClassNames,
612
597
  "data-testid": "jfcl-text-input"
@@ -615,6 +600,7 @@ const TextInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
615
600
  helperText: helperText,
616
601
  helperElement: helperElement,
617
602
  invalidText: invalidText,
603
+ invalidRole: invalidRole,
618
604
  invalid: invalid,
619
605
  labelFor: id
620
606
  }), /*#__PURE__*/React.createElement("div", {
@@ -626,9 +612,7 @@ const TextInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
626
612
  }, props, {
627
613
  id: id,
628
614
  className: textInputClassNames,
629
- type: inputType,
630
- value: inputValue,
631
- onChange: handleChange
615
+ type: inputType
632
616
  }))));
633
617
  });
634
618
  TextInput.displayName = 'TextInput';
package/dist/src/index.js CHANGED
@@ -330,7 +330,8 @@ const InputHeader = _ref2 => {
330
330
  helperText,
331
331
  helperElement,
332
332
  invalid,
333
- invalidText
333
+ invalidText,
334
+ invalidRole
334
335
  } = _ref2;
335
336
  const showHeader = headerText || helperText || invalid && invalidText;
336
337
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, showHeader && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(HeaderLabel, {
@@ -343,7 +344,8 @@ const InputHeader = _ref2 => {
343
344
  "data-testid": "helper-text"
344
345
  }, helperText), helperElement, invalid && invalidText && /*#__PURE__*/React__default["default"].createElement("div", {
345
346
  className: "jfcl-input-header__invalid_text",
346
- "data-testid": "error"
347
+ "data-testid": "error",
348
+ role: invalidRole
347
349
  }, /*#__PURE__*/React__default["default"].createElement(Icon, {
348
350
  icon: "circleExclamation",
349
351
  className: "jfcl-input-header__invalid_icon"
@@ -357,6 +359,7 @@ const Checkbox = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
357
359
  let {
358
360
  className,
359
361
  invalidText,
362
+ invalidRole,
360
363
  invalid,
361
364
  headerText,
362
365
  helperText,
@@ -378,7 +381,8 @@ const Checkbox = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref) =
378
381
  headerText: headerText,
379
382
  helperText: helperText,
380
383
  invalid: invalid,
381
- invalidText: invalidText
384
+ invalidText: invalidText,
385
+ invalidRole: invalidRole
382
386
  }), /*#__PURE__*/React__default["default"].createElement("div", {
383
387
  className: "jfcl-checkbox__checkmark-label-wrapper"
384
388
  }, /*#__PURE__*/React__default["default"].createElement("input", _extends__default["default"]({
@@ -413,6 +417,7 @@ const Dropdown = _ref => {
413
417
  helperText,
414
418
  invalid,
415
419
  invalidText,
420
+ invalidRole,
416
421
  disabled,
417
422
  labelText,
418
423
  onChange,
@@ -435,7 +440,8 @@ const Dropdown = _ref => {
435
440
  labelFor: inputId,
436
441
  helperText: helperText,
437
442
  invalid: invalid,
438
- invalidText: invalidText
443
+ invalidText: invalidText,
444
+ invalidRole: invalidRole
439
445
  }), /*#__PURE__*/React__default["default"].createElement(Select__default["default"], _extends__default["default"]({
440
446
  placeholder: null
441
447
  }, props, {
@@ -462,6 +468,7 @@ const FormGroup = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref)
462
468
  className,
463
469
  children,
464
470
  invalidText,
471
+ invalidRole,
465
472
  invalid,
466
473
  helperText,
467
474
  helperElement,
@@ -481,6 +488,7 @@ const FormGroup = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref)
481
488
  helperElement: helperElement,
482
489
  invalid: invalid,
483
490
  invalidText: invalidText,
491
+ invalidRole: invalidRole,
484
492
  isLegend: true
485
493
  }), children);
486
494
  });
@@ -493,6 +501,7 @@ const RadioButton = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref
493
501
  let {
494
502
  className,
495
503
  invalidText,
504
+ invalidRole,
496
505
  invalid,
497
506
  headerText,
498
507
  helperText,
@@ -515,7 +524,8 @@ const RadioButton = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref
515
524
  headerText: headerText,
516
525
  helperText: helperText,
517
526
  invalid: invalid,
518
- invalidText: invalidText
527
+ invalidText: invalidText,
528
+ invalidRole: invalidRole
519
529
  }), /*#__PURE__*/React__default["default"].createElement("input", _extends__default["default"]({
520
530
  ref: ref
521
531
  }, props, {
@@ -574,6 +584,7 @@ const TextInput = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref)
574
584
  let {
575
585
  className,
576
586
  invalidText,
587
+ invalidRole,
577
588
  invalid,
578
589
  helperText,
579
590
  helperElement,
@@ -592,32 +603,6 @@ const TextInput = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref)
592
603
  const textInputClassNames = classNames__default["default"]('jfcl-text-input__input', {
593
604
  ["jfcl-text-input--size-".concat(size)]: size
594
605
  });
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
606
  return /*#__PURE__*/React__default["default"].createElement("div", {
622
607
  className: textInputWrapperClassNames,
623
608
  "data-testid": "jfcl-text-input"
@@ -626,6 +611,7 @@ const TextInput = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref)
626
611
  helperText: helperText,
627
612
  helperElement: helperElement,
628
613
  invalidText: invalidText,
614
+ invalidRole: invalidRole,
629
615
  invalid: invalid,
630
616
  labelFor: id
631
617
  }), /*#__PURE__*/React__default["default"].createElement("div", {
@@ -637,9 +623,7 @@ const TextInput = /*#__PURE__*/React__default["default"].forwardRef((_ref, ref)
637
623
  }, props, {
638
624
  id: id,
639
625
  className: textInputClassNames,
640
- type: inputType,
641
- value: inputValue,
642
- onChange: handleChange
626
+ type: inputType
643
627
  }))));
644
628
  });
645
629
  TextInput.displayName = 'TextInput';
@@ -6,6 +6,7 @@ export interface CheckboxProps extends React.InputHTMLAttributes<HTMLInputElemen
6
6
  helperText?: string;
7
7
  invalid?: boolean;
8
8
  invalidText?: string;
9
+ invalidRole?: string;
9
10
  className?: string;
10
11
  disabled?: boolean;
11
12
  id: string;
@@ -11,6 +11,7 @@ export interface DropdownProps {
11
11
  labelText: string;
12
12
  helperText?: string;
13
13
  invalidText?: string;
14
+ invalidRole?: string;
14
15
  invalid?: boolean;
15
16
  disabled?: boolean;
16
17
  }
@@ -6,6 +6,7 @@ export interface FormGroupProps extends React.FieldsetHTMLAttributes<HTMLFieldSe
6
6
  helperElement?: React.ReactNode;
7
7
  invalid?: boolean;
8
8
  invalidText?: string;
9
+ invalidRole?: string;
9
10
  className?: string;
10
11
  }
11
12
  /**
@@ -9,5 +9,6 @@ export interface InputHeaderProps {
9
9
  helperElement?: React.ReactNode;
10
10
  invalidText?: string;
11
11
  invalid?: boolean;
12
+ invalidRole?: string;
12
13
  }
13
14
  export declare const InputHeader: React.FC<InputHeaderProps>;
@@ -6,6 +6,7 @@ export interface RadioButtonProps extends React.InputHTMLAttributes<HTMLInputEle
6
6
  helperText?: string;
7
7
  invalid?: boolean;
8
8
  invalidText?: string;
9
+ invalidRole?: string;
9
10
  className?: string;
10
11
  disabled?: boolean;
11
12
  id: string;
@@ -8,6 +8,7 @@ export interface TextInputProps extends Omit<React.InputHTMLAttributes<HTMLInput
8
8
  helperElement?: React.ReactNode;
9
9
  invalid?: boolean;
10
10
  invalidText?: string;
11
+ invalidRole?: string;
11
12
  className?: string;
12
13
  type?: string;
13
14
  }
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.54.0",
5
+ "version": "0.54.2",
6
6
  "main": "dist/src/index.js",
7
7
  "module": "dist/src/index.es.js",
8
8
  "files": [