@justfixnyc/component-library 0.60.2 → 0.61.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.
@@ -1,22 +1,23 @@
1
1
  import _extends from '@babel/runtime/helpers/extends';
2
2
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
3
3
  import classNames from 'classnames';
4
- import React, { forwardRef, useId } from 'react';
4
+ import React, { forwardRef, useId, useState, useRef, useCallback, useEffect } from 'react';
5
5
  import { faShieldCheck, faCalculatorSimple, faPlus, faBan, faXmark, faDownload as faDownload$1, faBuildingColumns, faAddressCard, faBuilding, faMapLocationDot, faMemoPad, faLocationDot, faHouse, faGlobe, faUser, faSpinner, faBars, faMailboxOpenLetter as faMailboxOpenLetter$1, faEnvelope as faEnvelope$2, 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, faArrowUpRight, faArrowUp, faArrowRight, faArrowLeft } from '@awesome.me/kit-6863e5a21e/icons/classic/solid';
6
6
  import { faMailboxOpenLetter, faPaperPlane, faEnvelopeCircleCheck, faEnvelope } from '@awesome.me/kit-6863e5a21e/icons/classic/light';
7
7
  import { faPrint, faEyeSlash, faEye, faDownload, faEnvelope as faEnvelope$1, faCircleExclamation, faBookmark } from '@awesome.me/kit-6863e5a21e/icons/classic/regular';
8
8
  import { faXTwitter, faTwitter, faFacebookF } from '@awesome.me/kit-6863e5a21e/icons/classic/brands';
9
9
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
10
10
  import { faEnvelopeCircleExclamationLight } from '@awesome.me/kit-6863e5a21e/icons/kit/custom';
11
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
11
12
  import Select, { components } from 'react-select';
12
13
 
13
- const _excluded$9 = ["className", "icon"];
14
+ const _excluded$h = ["className", "icon"];
14
15
  const Icon = _ref => {
15
16
  let {
16
17
  className,
17
18
  icon
18
19
  } = _ref,
19
- props = _objectWithoutProperties(_ref, _excluded$9);
20
+ props = _objectWithoutProperties(_ref, _excluded$h);
20
21
  let faIcon;
21
22
  switch (icon) {
22
23
  case 'arrowLeft':
@@ -210,14 +211,14 @@ const Icon = _ref => {
210
211
  };
211
212
  Icon.displayName = 'Icon';
212
213
 
213
- const _excluded$8 = ["icon", "children", "className"];
214
+ const _excluded$g = ["icon", "children", "className"];
214
215
  const Link = /*#__PURE__*/forwardRef((_ref, ref) => {
215
216
  let {
216
217
  icon,
217
218
  children,
218
219
  className
219
220
  } = _ref,
220
- props = _objectWithoutProperties(_ref, _excluded$8);
221
+ props = _objectWithoutProperties(_ref, _excluded$g);
221
222
  const linkClassNames = classNames('jfcl-link', className);
222
223
  const opensInNewTab = props.target === '_blank';
223
224
  // When using this component within a react-router-dom <Link />, a navigate function is passed through the props us here.
@@ -243,7 +244,7 @@ const Link = /*#__PURE__*/forwardRef((_ref, ref) => {
243
244
  });
244
245
  Link.displayName = 'Link';
245
246
 
246
- const _excluded$7 = ["type", "variant", "text", "action", "actionHref", "actionLabel", "className"];
247
+ const _excluded$f = ["type", "variant", "text", "action", "actionHref", "actionLabel", "className"];
247
248
  const Alert = /*#__PURE__*/forwardRef((_ref, ref) => {
248
249
  let {
249
250
  type = 'info',
@@ -254,7 +255,7 @@ const Alert = /*#__PURE__*/forwardRef((_ref, ref) => {
254
255
  actionLabel,
255
256
  className
256
257
  } = _ref,
257
- props = _objectWithoutProperties(_ref, _excluded$7);
258
+ props = _objectWithoutProperties(_ref, _excluded$f);
258
259
  const alertClassNames = classNames('jfcl-alert', "jfcl-variant-".concat(variant), "jfcl-type-".concat(type), className);
259
260
  const hasAction = !!action;
260
261
  const showButton = hasAction && !actionHref;
@@ -290,7 +291,35 @@ const Alert = /*#__PURE__*/forwardRef((_ref, ref) => {
290
291
  });
291
292
  Alert.displayName = 'Alert';
292
293
 
293
- const _excluded$6 = ["labelText", "variant", "size", "loading", "labelIcon", "iconOnRight", "iconOnly", "className"];
294
+ const _excluded$e = ["summary", "children", "open", "className", "onClick", "id"];
295
+ const Accordion = _ref => {
296
+ let {
297
+ summary,
298
+ children,
299
+ open = false,
300
+ className,
301
+ onClick,
302
+ id
303
+ } = _ref,
304
+ props = _objectWithoutProperties(_ref, _excluded$e);
305
+ return /*#__PURE__*/React.createElement("details", _extends({
306
+ className: classNames('jfcl-accordion', className),
307
+ open: open,
308
+ onClick: onClick,
309
+ id: id,
310
+ "data-testid": "jfcl-accordion"
311
+ }, props), /*#__PURE__*/React.createElement("summary", {
312
+ className: "jfcl-accordion__summary"
313
+ }, summary, /*#__PURE__*/React.createElement(Icon, {
314
+ icon: "chevronDown",
315
+ className: "jfcl-accordion__chevron",
316
+ "aria-hidden": true
317
+ })), /*#__PURE__*/React.createElement("div", {
318
+ className: "jfcl-accordion__content"
319
+ }, children));
320
+ };
321
+
322
+ const _excluded$d = ["labelText", "variant", "size", "loading", "labelIcon", "iconOnRight", "iconOnly", "className"];
294
323
  /**
295
324
  * Accepts all `ButtonHTMLAttributes`
296
325
  */
@@ -305,7 +334,7 @@ const Button = /*#__PURE__*/React.forwardRef((_ref, ref) => {
305
334
  iconOnly,
306
335
  className
307
336
  } = _ref,
308
- props = _objectWithoutProperties(_ref, _excluded$6);
337
+ props = _objectWithoutProperties(_ref, _excluded$d);
309
338
  const buttonClassNames = classNames('jfcl-button', "jfcl-variant-".concat(variant), "jfcl-size-".concat(size), "".concat(loading ? 'jfcl-is-loading' : ''), "".concat(iconOnly ? 'jfcl-btn-icon-only' : ''), className);
310
339
  const iconClassNames = classNames('jfcl-button__icon', "".concat(iconOnRight ? 'jfcl-button__icon_right' : ''));
311
340
  const arias = {};
@@ -331,6 +360,80 @@ const Button = /*#__PURE__*/React.forwardRef((_ref, ref) => {
331
360
  });
332
361
  Button.displayName = 'Button';
333
362
 
363
+ const _excluded$c = ["labelText", "variant", "size", "className"];
364
+ /**
365
+ * Use for navigation actions that should look like a button.
366
+ */
367
+ const ButtonStyledLink = /*#__PURE__*/forwardRef((_ref, ref) => {
368
+ let {
369
+ labelText,
370
+ variant = 'primary',
371
+ size = 'large',
372
+ className
373
+ } = _ref,
374
+ props = _objectWithoutProperties(_ref, _excluded$c);
375
+ const linkClassNames = classNames('jfcl-button', 'jfcl-button-styled-link', "jfcl-variant-".concat(variant), "jfcl-size-".concat(size), className);
376
+ return /*#__PURE__*/React.createElement("a", _extends({}, props, {
377
+ ref: ref,
378
+ className: linkClassNames,
379
+ "data-testid": "jfcl-button-styled-link"
380
+ }), /*#__PURE__*/React.createElement("span", {
381
+ className: "jfcl-button__label"
382
+ }, /*#__PURE__*/React.createElement("span", {
383
+ className: "jfcl-button__text"
384
+ }, labelText)));
385
+ });
386
+ ButtonStyledLink.displayName = 'ButtonStyledLink';
387
+
388
+ const _excluded$b = ["children", "className", "level"];
389
+ function isInteger(value) {
390
+ return Number.isInteger(value);
391
+ }
392
+ function isHeadingLevel(value) {
393
+ return [1, 2, 3, 4, 5, 6].includes(value);
394
+ }
395
+ const Heading = /*#__PURE__*/React.forwardRef((_ref, ref) => {
396
+ let {
397
+ children,
398
+ className,
399
+ level
400
+ } = _ref,
401
+ props = _objectWithoutProperties(_ref, _excluded$b);
402
+ if (!isInteger(level)) {
403
+ console.error('Heading level must be integer');
404
+ }
405
+ const Tag = isHeadingLevel(level) ? "h".concat(level) : 'span';
406
+ const headingClassNames = classNames('jfcl-heading', "jfcl-heading--h".concat(level), className);
407
+ return /*#__PURE__*/React.createElement(Tag, _extends({
408
+ ref: ref,
409
+ className: headingClassNames
410
+ }, props), children);
411
+ });
412
+ Heading.displayName = 'Heading';
413
+
414
+ const _excluded$a = ["title", "children", "action", "headingLevel", "className"];
415
+ const CalloutBox = _ref => {
416
+ let {
417
+ title,
418
+ children,
419
+ action,
420
+ headingLevel = 4,
421
+ className
422
+ } = _ref,
423
+ props = _objectWithoutProperties(_ref, _excluded$a);
424
+ return /*#__PURE__*/React.createElement("section", _extends({
425
+ className: classNames('jfcl-callout-box', className),
426
+ "data-testid": "jfcl-callout-box"
427
+ }, props), /*#__PURE__*/React.createElement(Heading, {
428
+ level: headingLevel,
429
+ className: "jfcl-callout-box__header"
430
+ }, title), /*#__PURE__*/React.createElement("div", {
431
+ className: "jfcl-callout-box__content"
432
+ }, children), action && /*#__PURE__*/React.createElement("div", {
433
+ className: "jfcl-callout-box__action"
434
+ }, action));
435
+ };
436
+
334
437
  const HeaderLabel = _ref => {
335
438
  let {
336
439
  labelFor,
@@ -389,7 +492,7 @@ const InputHeader = _ref2 => {
389
492
  }), invalidText)));
390
493
  };
391
494
 
392
- const _excluded$5 = ["className", "invalidText", "invalidRole", "invalid", "headerText", "helperText", "labelText", "disabled", "id"];
495
+ const _excluded$9 = ["className", "invalidText", "invalidRole", "invalid", "headerText", "helperText", "labelText", "disabled", "id"];
393
496
  /**
394
497
  * Accepts all `InputHTMLAttributes`
395
498
  */
@@ -405,7 +508,7 @@ const Checkbox = /*#__PURE__*/React.forwardRef((_ref, ref) => {
405
508
  disabled,
406
509
  id
407
510
  } = _ref,
408
- props = _objectWithoutProperties(_ref, _excluded$5);
511
+ props = _objectWithoutProperties(_ref, _excluded$9);
409
512
  const checkboxClassNames = classNames('jfcl-checkbox', {
410
513
  ['jfcl-checkbox--is-disabled']: disabled
411
514
  }, className);
@@ -444,7 +547,9 @@ const Checkbox = /*#__PURE__*/React.forwardRef((_ref, ref) => {
444
547
  });
445
548
  Checkbox.displayName = 'Checkbox';
446
549
 
447
- const _excluded$4 = ["className", "helperText", "invalid", "invalidText", "invalidRole", "disabled", "labelText", "onChange", "options"];
550
+ const _excluded$8 = ["className", "helperText", "invalid", "invalidText", "invalidRole", "disabled", "labelText", "components"];
551
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
552
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
448
553
  const DropdownIndicator = props => {
449
554
  return /*#__PURE__*/React.createElement(components.DropdownIndicator, props, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
450
555
  icon: faChevronDown
@@ -459,47 +564,41 @@ const Dropdown = _ref => {
459
564
  invalidRole,
460
565
  disabled,
461
566
  labelText,
462
- onChange,
463
- options
567
+ components: selectComponents
464
568
  } = _ref,
465
- props = _objectWithoutProperties(_ref, _excluded$4);
466
- const hasOnChange = !!onChange;
467
-
569
+ props = _objectWithoutProperties(_ref, _excluded$8);
468
570
  // Randomly generated id
469
571
  const instanceId = useId();
470
572
 
471
573
  // format of the id on the actual <input /> element created by react-select
472
574
  // using the instanceID prop
473
575
  const inputId = "react-select-".concat(instanceId, "-input");
576
+ const mergedComponents = _objectSpread({
577
+ DropdownIndicator
578
+ }, selectComponents);
474
579
  const dropdownClassNames = classNames('jfcl-dropdown', {
475
580
  ['jfcl-dropdown--is-invalid']: invalid
476
581
  }, className);
477
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InputHeader, {
582
+ return /*#__PURE__*/React.createElement(React.Fragment, null, labelText || helperText || invalid && invalidText ? /*#__PURE__*/React.createElement(InputHeader, {
478
583
  headerText: labelText,
479
584
  labelFor: inputId,
480
585
  helperText: helperText,
481
586
  invalid: invalid,
482
587
  invalidText: invalidText,
483
588
  invalidRole: invalidRole
484
- }), /*#__PURE__*/React.createElement(Select, _extends({
589
+ }) : null, /*#__PURE__*/React.createElement(Select, _extends({
485
590
  placeholder: null
486
591
  }, props, {
487
592
  instanceId: instanceId,
488
593
  className: dropdownClassNames,
489
594
  classNamePrefix: "jfcl-dropdown",
490
595
  isDisabled: disabled,
491
- options: options
492
- }, hasOnChange && {
493
- onChange: onChange
494
- }, {
495
- components: {
496
- DropdownIndicator
497
- }
596
+ components: mergedComponents
498
597
  })));
499
598
  };
500
599
  Dropdown.displayName = 'Dropdown';
501
600
 
502
- const _excluded$3 = ["className", "children", "invalidText", "invalidRole", "invalid", "helperText", "helperElement", "legendText"];
601
+ const _excluded$7 = ["className", "children", "invalidText", "invalidRole", "invalid", "helperText", "helperElement", "legendText"];
503
602
  /**
504
603
  * Accepts all `HTMLFieldSetElement`
505
604
  */
@@ -514,7 +613,7 @@ const FormGroup = /*#__PURE__*/React.forwardRef((_ref, ref) => {
514
613
  helperElement,
515
614
  legendText
516
615
  } = _ref,
517
- props = _objectWithoutProperties(_ref, _excluded$3);
616
+ props = _objectWithoutProperties(_ref, _excluded$7);
518
617
  const fieldsetClassNames = classNames('jfcl-form-group', {
519
618
  ['jfcl-form-group-is-invalid']: invalid
520
619
  }, className);
@@ -534,6 +633,295 @@ const FormGroup = /*#__PURE__*/React.forwardRef((_ref, ref) => {
534
633
  });
535
634
  FormGroup.displayName = 'FormGroup';
536
635
 
636
+ const _excluded$6 = ["initialAddress", "onSelect", "onChange", "onInputChange", "customGeoAutocompleteUrl", "throttleMs", "includeFullResponse", "serviceUnavailableText", "onRequestError", "noOptionsMessage", "className", "invalid", "invalidText"];
637
+ const DEFAULT_THROTTLE_MS = 250;
638
+ const GEO_AUTOCOMPLETE_URL = 'https://geosearch.planninglabs.nyc/v2/autocomplete';
639
+ const toTitleCase = value => value.replace(/\w\S*/g, text => text.charAt(0).toUpperCase() + text.substring(1).toLowerCase());
640
+ const formatGeosearchAddress = feature => {
641
+ const {
642
+ name,
643
+ borough,
644
+ postalcode
645
+ } = feature.properties;
646
+ const formattedName = toTitleCase(name !== null && name !== void 0 ? name : '');
647
+ const boroughName = borough !== null && borough !== void 0 ? borough : '';
648
+ const zipCode = postalcode !== null && postalcode !== void 0 ? postalcode : '';
649
+ return "".concat(formattedName, ", ").concat(boroughName, ", ").concat(zipCode).trim();
650
+ };
651
+ const normalizeFeature = feature => {
652
+ var _typedFeature$geometr, _typedFeature$geometr2, _typedFeature$geometr3, _typedFeature$propert, _typedFeature$propert2, _typedFeature$propert3, _typedFeature$propert4, _typedFeature$propert5, _typedFeature$propert6, _typedFeature$propert7, _typedFeature$propert8, _typedFeature$propert9;
653
+ const typedFeature = feature;
654
+ return {
655
+ type: typedFeature.type,
656
+ geometry: {
657
+ type: (_typedFeature$geometr = typedFeature.geometry) === null || _typedFeature$geometr === void 0 ? void 0 : _typedFeature$geometr.type,
658
+ coordinates: (_typedFeature$geometr2 = (_typedFeature$geometr3 = typedFeature.geometry) === null || _typedFeature$geometr3 === void 0 ? void 0 : _typedFeature$geometr3.coordinates) !== null && _typedFeature$geometr2 !== void 0 ? _typedFeature$geometr2 : []
659
+ },
660
+ properties: {
661
+ borough: (_typedFeature$propert = typedFeature.properties) === null || _typedFeature$propert === void 0 ? void 0 : _typedFeature$propert.borough,
662
+ borough_gid: (_typedFeature$propert2 = typedFeature.properties) === null || _typedFeature$propert2 === void 0 ? void 0 : _typedFeature$propert2.borough_gid,
663
+ housenumber: (_typedFeature$propert3 = typedFeature.properties) === null || _typedFeature$propert3 === void 0 ? void 0 : _typedFeature$propert3.housenumber,
664
+ street: (_typedFeature$propert4 = typedFeature.properties) === null || _typedFeature$propert4 === void 0 ? void 0 : _typedFeature$propert4.street,
665
+ name: (_typedFeature$propert5 = typedFeature.properties) === null || _typedFeature$propert5 === void 0 ? void 0 : _typedFeature$propert5.name,
666
+ label: (_typedFeature$propert6 = typedFeature.properties) === null || _typedFeature$propert6 === void 0 ? void 0 : _typedFeature$propert6.label,
667
+ addendum: {
668
+ pad: {
669
+ bbl: (_typedFeature$propert7 = typedFeature.properties) === null || _typedFeature$propert7 === void 0 || (_typedFeature$propert7 = _typedFeature$propert7.addendum) === null || _typedFeature$propert7 === void 0 || (_typedFeature$propert7 = _typedFeature$propert7.pad) === null || _typedFeature$propert7 === void 0 ? void 0 : _typedFeature$propert7.bbl,
670
+ bin: (_typedFeature$propert8 = typedFeature.properties) === null || _typedFeature$propert8 === void 0 || (_typedFeature$propert8 = _typedFeature$propert8.addendum) === null || _typedFeature$propert8 === void 0 || (_typedFeature$propert8 = _typedFeature$propert8.pad) === null || _typedFeature$propert8 === void 0 ? void 0 : _typedFeature$propert8.bin
671
+ }
672
+ },
673
+ postalcode: (_typedFeature$propert9 = typedFeature.properties) === null || _typedFeature$propert9 === void 0 ? void 0 : _typedFeature$propert9.postalcode
674
+ }
675
+ };
676
+ };
677
+ const normalizeResults = (rawResults, queryText) => {
678
+ var _typedResults$query$t, _typedResults$query, _typedResults$feature;
679
+ const typedResults = rawResults;
680
+ return {
681
+ bbox: typedResults.bbox,
682
+ query: {
683
+ text: (_typedResults$query$t = (_typedResults$query = typedResults.query) === null || _typedResults$query === void 0 ? void 0 : _typedResults$query.text) !== null && _typedResults$query$t !== void 0 ? _typedResults$query$t : queryText
684
+ },
685
+ features: ((_typedResults$feature = typedResults.features) !== null && _typedResults$feature !== void 0 ? _typedResults$feature : []).map(feature => normalizeFeature(feature))
686
+ };
687
+ };
688
+ const GeoSearchDropdown = _ref => {
689
+ let {
690
+ initialAddress,
691
+ onSelect,
692
+ onChange,
693
+ onInputChange,
694
+ customGeoAutocompleteUrl,
695
+ throttleMs,
696
+ includeFullResponse = false,
697
+ serviceUnavailableText,
698
+ onRequestError,
699
+ noOptionsMessage,
700
+ className,
701
+ invalid,
702
+ invalidText
703
+ } = _ref,
704
+ dropdownProps = _objectWithoutProperties(_ref, _excluded$6);
705
+ const [response, setResponse] = useState(null);
706
+ const [fullResponse, setFullResponse] = useState(null);
707
+ const [options, setOptions] = useState([]);
708
+ const [selectedValue, setSelectedValue] = useState(null);
709
+ const [isServiceUnavailable, setIsServiceUnavailable] = useState(false);
710
+ const requestIdRef = useRef(0);
711
+ const timerRef = useRef(null);
712
+ const abortRef = useRef(null);
713
+ const clearPendingRequests = useCallback(() => {
714
+ if (timerRef.current) {
715
+ clearTimeout(timerRef.current);
716
+ timerRef.current = null;
717
+ }
718
+ if (abortRef.current) {
719
+ abortRef.current.abort();
720
+ abortRef.current = null;
721
+ }
722
+ }, []);
723
+ const runSearch = useCallback(value => {
724
+ requestIdRef.current += 1;
725
+ const requestId = requestIdRef.current;
726
+ clearPendingRequests();
727
+ if (!value.trim()) {
728
+ setIsServiceUnavailable(false);
729
+ setResponse(null);
730
+ setFullResponse(null);
731
+ setOptions([]);
732
+ return;
733
+ }
734
+ timerRef.current = setTimeout(async () => {
735
+ const controller = new AbortController();
736
+ abortRef.current = controller;
737
+ try {
738
+ const endpoint = customGeoAutocompleteUrl || GEO_AUTOCOMPLETE_URL;
739
+ const result = await fetch("".concat(endpoint, "?text=").concat(encodeURIComponent(value)), {
740
+ signal: controller.signal
741
+ });
742
+ if (result.status !== 200) {
743
+ const requestError = new Error("Received HTTP ".concat(result.status));
744
+ requestError.status = result.status;
745
+ throw requestError;
746
+ }
747
+ const rawJson = await result.json();
748
+ const json = normalizeResults(rawJson, value);
749
+ if (requestIdRef.current !== requestId) {
750
+ return;
751
+ }
752
+ setIsServiceUnavailable(false);
753
+ setResponse(json);
754
+ setFullResponse(rawJson);
755
+ setOptions(json.features.map(feature => {
756
+ const label = formatGeosearchAddress(feature);
757
+ return {
758
+ value: label,
759
+ label,
760
+ feature
761
+ };
762
+ }));
763
+ } catch (error) {
764
+ const requestError = error;
765
+ if (requestError.name === 'AbortError') {
766
+ return;
767
+ }
768
+ if (requestIdRef.current !== requestId) {
769
+ return;
770
+ }
771
+ const requestIsServiceUnavailable = requestError.status === 503;
772
+ setIsServiceUnavailable(requestIsServiceUnavailable);
773
+ if (requestIsServiceUnavailable) {
774
+ setResponse(null);
775
+ setFullResponse(null);
776
+ setOptions([]);
777
+ }
778
+ onRequestError === null || onRequestError === void 0 || onRequestError(requestError);
779
+ }
780
+ }, throttleMs !== null && throttleMs !== void 0 ? throttleMs : DEFAULT_THROTTLE_MS);
781
+ }, [clearPendingRequests, customGeoAutocompleteUrl, onRequestError, throttleMs]);
782
+ useEffect(() => {
783
+ if (initialAddress) {
784
+ const addressValue = toTitleCase(initialAddress);
785
+ setSelectedValue({
786
+ value: addressValue,
787
+ label: addressValue
788
+ });
789
+ runSearch(addressValue);
790
+ }
791
+ }, [initialAddress, runSearch]);
792
+ useEffect(() => {
793
+ return () => {
794
+ clearPendingRequests();
795
+ };
796
+ }, [clearPendingRequests]);
797
+ const showServiceUnavailableState = isServiceUnavailable && !!serviceUnavailableText;
798
+ const effectiveInvalid = !!invalid || showServiceUnavailableState;
799
+ const effectiveInvalidText = showServiceUnavailableState ? serviceUnavailableText : invalidText;
800
+ return /*#__PURE__*/React.createElement(Dropdown, _extends({}, dropdownProps, {
801
+ className: "jfcl-geosearch-dropdown ".concat(className !== null && className !== void 0 ? className : '').trim(),
802
+ invalid: effectiveInvalid,
803
+ invalidText: effectiveInvalidText,
804
+ options: options,
805
+ value: selectedValue,
806
+ filterOption: null,
807
+ escapeClearsValue: false,
808
+ noOptionsMessage: noOptionsMessage !== null && noOptionsMessage !== void 0 ? noOptionsMessage : () => 'Enter an address to get started',
809
+ onInputChange: (value, meta) => {
810
+ runSearch(value);
811
+ return onInputChange ? onInputChange(value, meta) : value;
812
+ },
813
+ onChange: (newValue, actionMeta) => {
814
+ setSelectedValue(newValue);
815
+ onChange === null || onChange === void 0 || onChange(newValue, actionMeta);
816
+ if (!newValue || !newValue.feature) {
817
+ onSelect === null || onSelect === void 0 || onSelect(null);
818
+ return;
819
+ }
820
+ onSelect === null || onSelect === void 0 || onSelect({
821
+ option: newValue,
822
+ feature: newValue.feature,
823
+ response,
824
+ fullResponse: includeFullResponse ? fullResponse : undefined
825
+ });
826
+ }
827
+ }));
828
+ };
829
+ GeoSearchDropdown.displayName = 'GeoSearchDropdown';
830
+
831
+ const _excluded$5 = ["children", "color", "role", "className"];
832
+ const InfoBox = _ref => {
833
+ let {
834
+ children,
835
+ color = 'white',
836
+ role,
837
+ className
838
+ } = _ref,
839
+ props = _objectWithoutProperties(_ref, _excluded$5);
840
+ return /*#__PURE__*/React.createElement("div", _extends({
841
+ className: classNames('jfcl-info-box', "jfcl-info-box--".concat(color), className),
842
+ role: role,
843
+ "data-testid": "jfcl-info-box"
844
+ }, props), /*#__PURE__*/React.createElement("div", {
845
+ className: "jfcl-info-box__icon-container"
846
+ }, /*#__PURE__*/React.createElement(Icon, {
847
+ icon: color === 'orange' ? 'circleExclamation' : 'circleInfo',
848
+ "aria-hidden": true
849
+ })), /*#__PURE__*/React.createElement("div", {
850
+ className: "jfcl-info-box__content-container"
851
+ }, children));
852
+ };
853
+
854
+ const _excluded$4 = ["icon", "children", "className", "type"];
855
+ /**
856
+ * Use for in-page actions that should look like a text link.
857
+ */
858
+ const LinkStyledButton = /*#__PURE__*/forwardRef((_ref, ref) => {
859
+ let {
860
+ icon,
861
+ children,
862
+ className,
863
+ type = 'button'
864
+ } = _ref,
865
+ props = _objectWithoutProperties(_ref, _excluded$4);
866
+ const buttonClassNames = classNames('jfcl-link', 'jfcl-link-styled-button', className);
867
+ return /*#__PURE__*/React.createElement("button", _extends({}, props, {
868
+ ref: ref,
869
+ type: type,
870
+ className: buttonClassNames,
871
+ "data-testid": "jfcl-link-styled-button"
872
+ }), children, icon === 'internal' && /*#__PURE__*/React.createElement(Icon, {
873
+ icon: "arrowRight",
874
+ className: "jfcl-link__icon"
875
+ }), icon === 'external' && /*#__PURE__*/React.createElement(Icon, {
876
+ icon: "squareArrowUpRight",
877
+ className: "jfcl-link__icon"
878
+ }));
879
+ });
880
+ LinkStyledButton.displayName = 'LinkStyledButton';
881
+
882
+ const Notice = _ref => {
883
+ let {
884
+ icon,
885
+ color,
886
+ header,
887
+ headingLevel,
888
+ children,
889
+ className
890
+ } = _ref;
891
+ return /*#__PURE__*/React.createElement("div", {
892
+ className: classNames('jfcl-notice', color && "jfcl-notice--".concat(color), className),
893
+ "data-testid": "jfcl-notice"
894
+ }, icon && /*#__PURE__*/React.createElement("div", {
895
+ className: "jfcl-notice__icon-container"
896
+ }, /*#__PURE__*/React.createElement(Icon, {
897
+ icon: icon,
898
+ "aria-hidden": true
899
+ })), /*#__PURE__*/React.createElement("section", {
900
+ className: "jfcl-notice__content-container"
901
+ }, header && /*#__PURE__*/React.createElement(Heading, {
902
+ level: headingLevel,
903
+ className: "jfcl-notice__header"
904
+ }, header), /*#__PURE__*/React.createElement("div", {
905
+ className: "jfcl-notice__body"
906
+ }, children)));
907
+ };
908
+
909
+ const _excluded$3 = ["color", "children", "className", "circle"];
910
+ const Pill = _ref => {
911
+ let {
912
+ color,
913
+ children,
914
+ className,
915
+ circle = false
916
+ } = _ref,
917
+ props = _objectWithoutProperties(_ref, _excluded$3);
918
+ const pillClassNames = classNames('jfcl-pill', "jfcl-pill--".concat(color), circle && 'jfcl-pill--circle', className);
919
+ return /*#__PURE__*/React.createElement("div", _extends({
920
+ className: pillClassNames,
921
+ "data-testid": "jfcl-pill"
922
+ }, props), children);
923
+ };
924
+
537
925
  const _excluded$2 = ["className", "invalidText", "invalidRole", "invalid", "headerText", "helperText", "labelText", "labelElement", "disabled", "id"];
538
926
  /**
539
927
  * Accepts all `InputHTMLAttributes`
@@ -672,4 +1060,4 @@ const TextInput = /*#__PURE__*/React.forwardRef((_ref, ref) => {
672
1060
  });
673
1061
  TextInput.displayName = 'TextInput';
674
1062
 
675
- export { Alert, Button, Checkbox, Dropdown, FormGroup, Icon, Link, RadioButton, SelectButton, TextInput };
1063
+ export { Accordion, Alert, Button, ButtonStyledLink, CalloutBox, Checkbox, Dropdown, FormGroup, GeoSearchDropdown, Heading, Icon, InfoBox, Link, LinkStyledButton, Notice, Pill, RadioButton, SelectButton, TextInput };