@utahdts/utah-design-system 0.0.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.
Files changed (134) hide show
  1. package/README.md +54 -0
  2. package/css/1-settings/_class-vars.scss +11 -0
  3. package/css/1-settings/_color-swatches.scss +422 -0
  4. package/css/1-settings/_font-stuff.scss +48 -0
  5. package/css/1-settings/_grid.scss +39 -0
  6. package/css/1-settings/_icons.scss +6 -0
  7. package/css/1-settings/_settings-index.scss +116 -0
  8. package/css/1-settings/_spacing.scss +70 -0
  9. package/css/2-tools/_tools-index.scss +47 -0
  10. package/css/3-generic/_generic-index.scss +4 -0
  11. package/css/3-generic/normalize.css +349 -0
  12. package/css/4-elements/_elements-index.scss +89 -0
  13. package/css/5-objects/_objects-index.scss +9 -0
  14. package/css/6-components/_components-index.scss +31 -0
  15. package/css/6-components/base-components/buttons/_button.scss +401 -0
  16. package/css/6-components/base-components/buttons/_icon-button.scss +54 -0
  17. package/css/6-components/base-components/containers/_accordion.scss +31 -0
  18. package/css/6-components/base-components/containers/_tab-group.scss +57 -0
  19. package/css/6-components/base-components/forms/_checkbox.scss +67 -0
  20. package/css/6-components/base-components/forms/_info-box.scss +23 -0
  21. package/css/6-components/base-components/forms/_input-wrapper.scss +9 -0
  22. package/css/6-components/base-components/forms/_input.scss +10 -0
  23. package/css/6-components/base-components/forms/_radio-button.scss +60 -0
  24. package/css/6-components/base-components/forms/_select-input.scss +18 -0
  25. package/css/6-components/base-components/forms/_switch.scss +191 -0
  26. package/css/6-components/base-components/forms/_text-input.scss +15 -0
  27. package/css/6-components/base-components/navigation/_main-menu.scss +69 -0
  28. package/css/6-components/base-components/navigation/_menu-item.scss +44 -0
  29. package/css/6-components/base-components/navigation/_side-panel-navigation.scss +83 -0
  30. package/css/6-components/base-components/tablesAndLists/_table.scss +52 -0
  31. package/css/6-components/base-components/templates/_documenation-template.scss +50 -0
  32. package/css/6-components/base-components/templates/_landing-page-template.scss +8 -0
  33. package/css/6-components/base-components/templates/_on-this-page.scss +33 -0
  34. package/css/6-components/base-components/widgetsInicators/_spinner.scss +38 -0
  35. package/css/6-components/project-components/_popup.scss +22 -0
  36. package/css/6-components/project-components/_swatch-list.scss +41 -0
  37. package/css/7-utilities/_animation.scss +41 -0
  38. package/css/7-utilities/_utilities-index.scss +119 -0
  39. package/css/8-super/_print.scss +38 -0
  40. package/css/8-super/_super-index.scss +6 -0
  41. package/css/9-tip/_tip-index.scss +6 -0
  42. package/css/build/utah-design-system.css +2374 -0
  43. package/css/index.scss +52 -0
  44. package/index.js +117 -0
  45. package/package.json +55 -0
  46. package/react/components/buttons/Button.jsx +103 -0
  47. package/react/components/buttons/IconButton.jsx +36 -0
  48. package/react/components/buttons/SegmentedButton.jsx +1 -0
  49. package/react/components/containers/accordion/Accordion.jsx +67 -0
  50. package/react/components/containers/tabs/Tab.jsx +53 -0
  51. package/react/components/containers/tabs/TabGroup.jsx +66 -0
  52. package/react/components/containers/tabs/TabGroupContext.jsx +3 -0
  53. package/react/components/containers/tabs/TabGroupTitle.jsx +28 -0
  54. package/react/components/containers/tabs/TabList.jsx +31 -0
  55. package/react/components/containers/tabs/TabPanel.jsx +41 -0
  56. package/react/components/containers/tabs/TabPanels.jsx +20 -0
  57. package/react/components/forms/CheckBox.jsx +79 -0
  58. package/react/components/forms/ErrorMessage.jsx +25 -0
  59. package/react/components/forms/Form.jsx +68 -0
  60. package/react/components/forms/FormContext.jsx +3 -0
  61. package/react/components/forms/FormContextProvider.jsx +87 -0
  62. package/react/components/forms/PLACEHOLDER.md +1 -0
  63. package/react/components/forms/Select.jsx +85 -0
  64. package/react/components/forms/SelectOption.jsx +42 -0
  65. package/react/components/forms/Switch.jsx +122 -0
  66. package/react/components/forms/TextInput.jsx +80 -0
  67. package/react/components/icons/Icons.jsx +7 -0
  68. package/react/components/lists/PLACEHOLDER.md +1 -0
  69. package/react/components/map/PLACEHOLDER.md +1 -0
  70. package/react/components/navigation/HorizontalMenu.jsx +46 -0
  71. package/react/components/navigation/MainMenu.jsx +28 -0
  72. package/react/components/navigation/MenuItem.jsx +116 -0
  73. package/react/components/navigation/OnThisPage.jsx +34 -0
  74. package/react/components/navigation/OnThisPageHeadersLevel.jsx +35 -0
  75. package/react/components/navigation/SidePanelNavigation.jsx +41 -0
  76. package/react/components/navigation/util/findElementsByTagNameMatch.js +11 -0
  77. package/react/components/navigation/util/groupElementsByHeaderLevel.js +41 -0
  78. package/react/components/popups/PLACEHOLDER.md +1 -0
  79. package/react/components/table/Table.jsx +34 -0
  80. package/react/components/table/TableBody.jsx +35 -0
  81. package/react/components/table/TableBodyData.jsx +91 -0
  82. package/react/components/table/TableBodyDataCellTemplate.jsx +73 -0
  83. package/react/components/table/TableBodyDataRowContext.jsx +3 -0
  84. package/react/components/table/TableBodyDataRowTemplate.jsx +56 -0
  85. package/react/components/table/TableCell.jsx +50 -0
  86. package/react/components/table/TableContext.jsx +3 -0
  87. package/react/components/table/TableFilterCustom.jsx +34 -0
  88. package/react/components/table/TableFilterNone.jsx +34 -0
  89. package/react/components/table/TableFilterSelect.jsx +34 -0
  90. package/react/components/table/TableFilterSelectOption.jsx +34 -0
  91. package/react/components/table/TableFilterTextInput.jsx +64 -0
  92. package/react/components/table/TableFilters.jsx +88 -0
  93. package/react/components/table/TableFoot.jsx +34 -0
  94. package/react/components/table/TableFootCell.jsx +34 -0
  95. package/react/components/table/TableFootRow.jsx +34 -0
  96. package/react/components/table/TableHead.jsx +39 -0
  97. package/react/components/table/TableHeadCell.jsx +79 -0
  98. package/react/components/table/TableHeadRow.jsx +34 -0
  99. package/react/components/table/TableRow.jsx +49 -0
  100. package/react/components/table/TableSortingRule.jsx +55 -0
  101. package/react/components/table/TableSortingRules.jsx +64 -0
  102. package/react/components/table/TableWrapper.jsx +128 -0
  103. package/react/components/table/useCurrentValuesFromStateContext.js +73 -0
  104. package/react/components/templates/DocumentationTemplate.jsx +52 -0
  105. package/react/components/templates/LandingTemplate.jsx +29 -0
  106. package/react/components/utahHeader/UtahHeader.jsx +25 -0
  107. package/react/components/utahHeader/UtahUnbrand.jsx +50 -0
  108. package/react/components/widgetsIndicators/Spinner.jsx +71 -0
  109. package/react/enums/formElementSizesEnum.js +9 -0
  110. package/react/enums/tableSortingRuleFieldType.js +9 -0
  111. package/react/hooks/forms/useCurrentValuesFromForm.js +44 -0
  112. package/react/hooks/useBanner.js +6 -0
  113. package/react/hooks/useCurrentMenuItem.js +29 -0
  114. package/react/hooks/usePrepMenuItems.js +24 -0
  115. package/react/hooks/useRefAlways.js +8 -0
  116. package/react/hooks/useRefLazy.js +11 -0
  117. package/react/hooks/useScrollPosition.js +18 -0
  118. package/react/hooks/useStateEffect.js +43 -0
  119. package/react/propTypesShapes/MenuItemShape.js +20 -0
  120. package/react/propTypesShapes/MenuItemsShape.js +4 -0
  121. package/react/propTypesShapes/MenuShape.js +10 -0
  122. package/react/propTypesShapes/RefShape.js +9 -0
  123. package/react/util/arrayMatchRecursive.js +21 -0
  124. package/react/util/chainSorters.js +19 -0
  125. package/react/util/handleEvent.js +25 -0
  126. package/react/util/handleKeyPress.js +1 -0
  127. package/react/util/joinClassNames.js +23 -0
  128. package/react/util/menuItems/calculateMenuItemsParents.js +54 -0
  129. package/react/util/menuItems/findMenuItemInMenusByPathname.js +25 -0
  130. package/react/util/onKeyPress.js +12 -0
  131. package/react/util/rectContainsPoint.js +7 -0
  132. package/react/util/state/setValueAtPath.js +80 -0
  133. package/react/util/state/valueAtPath.js +5 -0
  134. package/react/util/stringToId.js +11 -0
@@ -0,0 +1,128 @@
1
+ import { useMemo } from 'react';
2
+ import { useImmer } from 'use-immer';
3
+ import PropTypes from 'prop-types';
4
+ import RefShape from '../../propTypesShapes/RefShape';
5
+ import TableContext from './TableContext';
6
+ import joinClassNames from '../../util/joinClassNames';
7
+ import useRefAlways from '../../hooks/useRefAlways';
8
+ import tableSortingRuleFieldType from '../../enums/tableSortingRuleFieldType';
9
+ import valueAtPath from '../../util/state/valueAtPath';
10
+
11
+ const propTypes = {
12
+ children: PropTypes.node.isRequired,
13
+ className: PropTypes.string,
14
+ innerRef: RefShape,
15
+ id: PropTypes.string,
16
+ };
17
+ const defaultProps = {
18
+ className: null,
19
+ innerRef: null,
20
+ id: null,
21
+ };
22
+
23
+ function TableWrapper({
24
+ children,
25
+ className,
26
+ innerRef,
27
+ id,
28
+ ...rest
29
+ }) {
30
+ const [state, setState] = useImmer({
31
+ // when sorting, should the sort order for a rule be the "default"
32
+ // ie a rule defaults to ascending so when currentSortingOrderIsDefault is true then sort that rule ascending
33
+ currentSortingOrderIsDefault: true,
34
+ // [recordFieldPath]: filterValue <== the current filtering values from <TableFilter... /> components
35
+ filterValues: {
36
+ // context level values from a <TableFilters /> component (<TableFilter... /> child components would override/chain these values)
37
+ // defaultValue - object of [recordFieldPath]:value pairs for filtering inputs
38
+ defaultValue: null,
39
+ // onChange to call for any filter change
40
+ onChange: null,
41
+ // value - object of [recordFieldPath]:value pairs for filtering inputs
42
+ value: null,
43
+ },
44
+ // these are the sorting rules to which a <TableHeadCell> connects assumes order is add order
45
+ sortingRules: {},
46
+ // (func) when table sorting changes, this callback will be called: from <TableSortingRules>
47
+ tableSortingOnChange: null,
48
+ // (string | [string]) the current recordFieldPath name for the current header being sorted
49
+ // array if <TableHeadCell> specifies sort order; otherwise, sort fields in registration order
50
+ // set when a TableHeadCell is selected and sets its tableSortingFieldPaths as the tableSortingFieldPath
51
+ // TableBodyData uses this value to sort its records
52
+ tableSortingFieldPath: null,
53
+ // a TableHeadCell can provide tableSortingFieldPaths to customize which sorters to use in which order
54
+ tableSortingFieldPaths: null,
55
+ });
56
+ const stateRef = useRefAlways(state);
57
+
58
+ const contextValue = useMemo(
59
+ () => ({
60
+ // register a new rule for sorting, generally from a <TableSortingRule>
61
+ registerSortingRule: (sortingRule) => setState((draftState) => {
62
+ draftState.sortingRules[sortingRule.recordFieldPath] = {
63
+ ...sortingRule,
64
+ sorter: (
65
+ (recordA, recordB, records) => {
66
+ const fieldValueA = valueAtPath({ object: recordA.record, path: sortingRule.recordFieldPath });
67
+ const fieldValueB = valueAtPath({ object: recordB.record, path: sortingRule.recordFieldPath });
68
+
69
+ let result;
70
+ if (sortingRule.customSort) {
71
+ // custom sorting
72
+ result = sortingRule.customSort({
73
+ fieldValueA,
74
+ fieldValueB,
75
+ recordA: recordA.record,
76
+ recordAIndex: recordA.recordIndex,
77
+ recordB: recordB.record,
78
+ recordBIndex: recordB.recordIndex,
79
+ records,
80
+ });
81
+ } else {
82
+ // sort by field type
83
+ switch (sortingRule.fieldType) {
84
+ case tableSortingRuleFieldType.DATE:
85
+ result = (fieldValueA?.getTime() || 0) - (fieldValueB?.getTime() || 0);
86
+ break;
87
+
88
+ case tableSortingRuleFieldType.NUMBER:
89
+ result = Number(fieldValueA || 0) - Number(fieldValueB || 0);
90
+ break;
91
+
92
+ case tableSortingRuleFieldType.STRING:
93
+ result = (fieldValueA || '').localeCompare(fieldValueB || '');
94
+ break;
95
+
96
+ default:
97
+ throw new Error(`Unknown tableSortingRuleFieldType '${sortingRule.fieldType}'`);
98
+ }
99
+ }
100
+
101
+ // return sort result modified for sort order
102
+ return result * (stateRef.current.currentSortingOrderIsDefault ? 1 : -1) * (sortingRule.defaultIsAscending ? 1 : -1);
103
+ }
104
+ ),
105
+ };
106
+ }),
107
+ // unregister a rule for sorting, generally when a <TableSortingRule> unmounts
108
+ unregisterSortingRule: (recordFieldPath) => setState((draftState) => { delete draftState.sortingRules[recordFieldPath]; }),
109
+
110
+ setState,
111
+ state,
112
+ }),
113
+ [state]
114
+ );
115
+
116
+ return (
117
+ <TableContext.Provider value={contextValue}>
118
+ <div className={joinClassNames('some-table-wrapper-classname', className)} id={id} ref={innerRef} {...rest}>
119
+ {children}
120
+ </div>
121
+ </TableContext.Provider>
122
+ );
123
+ }
124
+
125
+ TableWrapper.propTypes = propTypes;
126
+ TableWrapper.defaultProps = defaultProps;
127
+
128
+ export default TableWrapper;
@@ -0,0 +1,73 @@
1
+ import { useContext, useEffect } from 'react';
2
+ import { useImmer } from 'use-immer';
3
+ import setValueAtPath from '../../util/state/setValueAtPath';
4
+ import valueAtPath from '../../util/state/valueAtPath';
5
+
6
+ /**
7
+ * An input can be controlled, uncontrolled, default value, or controlled by a parent context
8
+ * This function takes these values in to account and provides a current value and onChange event
9
+ * The passed in values trump those of the parent context. A local state is used if neither passed in nor
10
+ * context have a value.
11
+ *
12
+ * @param {context} React.createContext from which to pull state/setState
13
+ * @param {contextStatePath} string the path to the data inside the state; ie {filterValues:{...}} where filterValues is actual state in the context
14
+ * @param {defaultValue} string starting value for this component (controlled and uncontrolled)
15
+ * @param {onChange} func when the value changes, call this function; ie (e) => { do something with e }
16
+ * @param {value} any the current value of this item
17
+ */
18
+ export default function useCurrentValuesFromStateContext({
19
+ // the React.createContext being questioned
20
+ context,
21
+ // the path in the state object of the context to the data being used
22
+ contextStatePath,
23
+ // if onChange is not found on context nor passed in, then use this onChange to get the value
24
+ defaultOnChange,
25
+ // the defaultValue the child component was given
26
+ defaultValue,
27
+ // the onChange the child component was given
28
+ onChange,
29
+ // the value the child component was given
30
+ value,
31
+ }) {
32
+ const { setState: setStateContext, state: stateContext } = useContext(context);
33
+ const [stateLocal, setStateLocal] = useImmer(defaultValue);
34
+
35
+ const fullContextStatePath = `filterValues.value.${contextStatePath}`;
36
+
37
+ // put default value in to current filter value on mount if there is one
38
+ useEffect(
39
+ () => {
40
+ if (defaultValue) {
41
+ setStateContext((draftStateContext) => {
42
+ setValueAtPath({ object: draftStateContext, path: fullContextStatePath, value: defaultValue });
43
+ });
44
+ }
45
+ },
46
+ [defaultValue]
47
+ );
48
+
49
+ return {
50
+ currentOnChange: (
51
+ // use passed in onChange
52
+ onChange
53
+ // use onChange from context (controlled by <TableFilters />)
54
+ || (stateContext?.filterValues?.onChange && ((e) => (
55
+ stateContext?.filterValues?.onChange({ recordFieldPath: contextStatePath, value: defaultOnChange(e) })
56
+ )))
57
+ // set context filterValues directly (not controlled by <TableFilters />)
58
+ || (setStateContext && ((e) => setStateContext((draftStateContext) => {
59
+ setValueAtPath({ object: draftStateContext, path: fullContextStatePath, value: defaultOnChange(e) });
60
+ })))
61
+ // no context, so use local state
62
+ || ((newValue) => setStateLocal(defaultOnChange(newValue)))
63
+ ),
64
+ currentValue: (
65
+ // passed in value (controlled)
66
+ value
67
+ // context's value (context controlled)
68
+ ?? valueAtPath({ object: stateContext, path: fullContextStatePath })
69
+ // pull from local state (which defaults to defaultValue)
70
+ ?? stateLocal
71
+ ),
72
+ };
73
+ }
@@ -0,0 +1,52 @@
1
+ import PropTypes from 'prop-types';
2
+ import MenuItemShape from '../../propTypesShapes/MenuItemShape';
3
+ import MenuShape from '../../propTypesShapes/MenuShape';
4
+ import UtahHeader from '../utahHeader/UtahHeader';
5
+ import MainMenu from '../navigation/MainMenu';
6
+ import RefShape from '../../propTypesShapes/RefShape';
7
+
8
+ const propTypes = {
9
+ content: PropTypes.element.isRequired,
10
+ contentRef: RefShape.isRequired,
11
+ currentMenuItem: MenuItemShape,
12
+ mainMenu: MenuShape.isRequired,
13
+ sidePanelRightContent: PropTypes.element.isRequired,
14
+ sidePanelLeftContent: PropTypes.element.isRequired,
15
+ };
16
+ const defaultProps = {
17
+ currentMenuItem: null,
18
+ };
19
+
20
+ function DocumentationTemplate({
21
+ content,
22
+ contentRef,
23
+ currentMenuItem,
24
+ mainMenu,
25
+ sidePanelRightContent,
26
+ sidePanelLeftContent,
27
+ }) {
28
+ return (
29
+ <>
30
+ <UtahHeader />
31
+ <MainMenu currentMenuItem={currentMenuItem} menu={mainMenu} />
32
+ <div className="documentation-template__wrapper">
33
+ <div className="documentation-template">
34
+ <div className="documentation-template__side-panel-left">
35
+ {sidePanelLeftContent}
36
+ </div>
37
+ <main className="documentation-template__content" ref={contentRef}>
38
+ {content}
39
+ </main>
40
+ <div className="documentation-template__side-panel-right">
41
+ {sidePanelRightContent}
42
+ </div>
43
+ </div>
44
+ </div>
45
+ </>
46
+ );
47
+ }
48
+
49
+ DocumentationTemplate.propTypes = propTypes;
50
+ DocumentationTemplate.defaultProps = defaultProps;
51
+
52
+ export default DocumentationTemplate;
@@ -0,0 +1,29 @@
1
+ import PropTypes from 'prop-types';
2
+ import MenuItemShape from '../../propTypesShapes/MenuItemShape';
3
+ import MenuShape from '../../propTypesShapes/MenuShape';
4
+ import MainMenu from '../navigation/MainMenu';
5
+ import UtahHeader from '../utahHeader/UtahHeader';
6
+
7
+ const propTypes = {
8
+ content: PropTypes.element.isRequired,
9
+ currentMenuItem: MenuItemShape,
10
+ mainMenu: MenuShape.isRequired,
11
+ };
12
+ const defaultProps = {
13
+ currentMenuItem: null,
14
+ };
15
+
16
+ function LandingTemplate({ content, currentMenuItem, mainMenu }) {
17
+ return (
18
+ <>
19
+ <UtahHeader />
20
+ <MainMenu currentMenuItem={currentMenuItem} menu={mainMenu} />
21
+ {content}
22
+ </>
23
+ );
24
+ }
25
+
26
+ LandingTemplate.propTypes = propTypes;
27
+ LandingTemplate.defaultProps = defaultProps;
28
+
29
+ export default LandingTemplate;
@@ -0,0 +1,25 @@
1
+ import UtahUnbrand from './UtahUnbrand';
2
+
3
+ const propTypes = {};
4
+ const defaultProps = {};
5
+
6
+ function UtahHeader() {
7
+ return (
8
+ <div className="header">
9
+ <UtahUnbrand className="header__utah-brand" />
10
+
11
+ <span className="header__vertical-rule" />
12
+ <span className="header__department">
13
+ Utah Design System
14
+ </span>
15
+ <button className="header__sign-in button--solid" type="button">
16
+ Sign In
17
+ </button>
18
+ </div>
19
+ );
20
+ }
21
+
22
+ UtahHeader.propTypes = propTypes;
23
+ UtahHeader.defaultProps = defaultProps;
24
+
25
+ export default UtahHeader;
@@ -0,0 +1,50 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import joinClassNames from '../../util/joinClassNames';
4
+
5
+ const propTypes = {
6
+ className: PropTypes.string,
7
+ };
8
+ const defaultProps = {
9
+ className: undefined,
10
+ };
11
+
12
+ function UtahUnbrand({ className }) {
13
+ return (
14
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 137.363 52.7618" className={joinClassNames(['utah-brand', className])}>
15
+ <g>
16
+ <g>
17
+ <path d="M15.972,39.161c-5.4,0-9.4127-1.5667-12.038-4.7C1.3087,31.3277-.0027,26.466,0,19.876V0H10.175V21.06c0,3.4313,.4633,5.847,1.39,7.247,.9909,1.434,2.669,2.2337,4.407,2.1,1.7525,.124,3.4436-.6712,4.466-2.1,.966-1.4,1.449-3.8157,1.449-7.247V0h9.82V19.876c0,6.586-1.2817,11.4467-3.845,14.582-2.5633,3.1353-6.5267,4.703-11.89,4.703Zm31.353-.711V8.518h-10.175V0h30.525V8.518h-10.175v29.932h-10.175Zm33.6-18.693l-.651,2.662h7.1l-.651-2.662c-.4733-1.8533-.9467-3.8647-1.42-6.034-.4733-2.1693-.945-4.2197-1.415-6.151h-.237c-.434,1.972-.8777,4.0327-1.331,6.182s-.918,4.1507-1.394,6.004l-.001-.001Zm-14.788,18.693L77.85,0h12.3l11.717,38.45h-10.767l-1.893-8.162h-10.766l-1.893,8.162h-10.411Zm39.4,0V0h10.175V14.316h11.476V0h10.175V38.45h-10.175v-15.261h-11.479v15.261h-10.172Z" />
18
+ </g>
19
+ <g>
20
+ <path d="M.0839,52.5939l3.1079-9.1841h1.3159l3.1084,9.1841h-1.2461l-.8682-2.7998H2.1557l-.8818,2.7998H.0839Zm2.7998-5.1382l-.4336,1.4004h2.7578l-.4341-1.4004c-.168-.5132-.3267-1.0239-.4761-1.5327s-.2988-1.0293-.4478-1.561h-.0562c-.1401,.5317-.2847,1.0522-.4341,1.561s-.3081,1.0195-.4761,1.5327Z" />
21
+ <path d="M8.8056,52.5939v-6.8042h.9521l.0981,.98h.042c.3262-.3262,.6694-.5996,1.0288-.8188s.7769-.3291,1.2529-.3291c.7188,0,1.2437,.2241,1.5752,.6724,.3311,.4478,.4971,1.1108,.4971,1.9878v4.312h-1.1484v-4.1582c0-.6436-.1025-1.1079-.3076-1.3926-.2056-.2847-.5322-.4272-.98-.4272-.355,0-.6675,.0889-.938,.2661-.271,.1772-.5791,.439-.9243,.7837v4.9282h-1.1479Z" />
22
+ <path d="M21.9096,52.7618c-.4199,0-.8188-.0796-1.1968-.2378-.3779-.1587-.7119-.3896-1.001-.6934-.2896-.3032-.5205-.6763-.6934-1.1196s-.2588-.9453-.2588-1.5054c0-.5688,.0859-1.0752,.2588-1.519,.1729-.4429,.4038-.8188,.6934-1.127,.2891-.3076,.623-.541,1.001-.6997s.7769-.2383,1.1968-.2383,.8188,.0796,1.1973,.2383c.3779,.1587,.7114,.3921,1.001,.6997,.2891,.3081,.52,.6841,.6929,1.127,.1724,.4438,.2588,.9502,.2588,1.519,0,.5601-.0864,1.062-.2588,1.5054-.1729,.4434-.4038,.8164-.6929,1.1196-.2896,.3037-.623,.5347-1.001,.6934-.3784,.1582-.7773,.2378-1.1973,.2378Zm0-.9521c.2891,0,.5552-.063,.7979-.189s.4502-.3032,.623-.5317,.3057-.502,.3989-.8193c.0933-.3169,.1401-.6719,.1401-1.064,0-.3916-.0469-.749-.1401-1.0708s-.2261-.5996-.3989-.833-.3804-.4131-.623-.5391-.5088-.189-.7979-.189c-.2896,0-.5552,.063-.7979,.189s-.4507,.3057-.623,.5391c-.1729,.2334-.3057,.5112-.3989,.833-.0938,.3218-.1401,.6792-.1401,1.0708,0,.3921,.0464,.7471,.1401,1.064,.0933,.3174,.2261,.5908,.3989,.8193,.1724,.2285,.3804,.4058,.623,.5317s.5083,.189,.7979,.189Z" />
23
+ <path d="M31.0375,52.5939v-5.8662h-2.8418v5.8662h-1.1479v-5.8662h-.9243v-.8677l.9243-.0703v-.896c0-.709,.1748-1.269,.5249-1.6797s.8794-.6162,1.5889-.6162c.2241,0,.4458,.0234,.665,.0703,.2192,.0464,.4131,.1074,.5811,.1816l-.2383,.8682c-.2798-.1211-.583-.1821-.9097-.1821-.3359,0-.5977,.1191-.7842,.3569-.187,.2383-.2798,.5811-.2798,1.0293v.8677h2.8418v-1.0776c0-.7002,.1611-1.251,.4829-1.6523,.3223-.4009,.8237-.6021,1.5049-.6021,.2148,0,.418,.021,.6094,.063,.1909,.0425,.3662,.0962,.5249,.1611l-.252,.8823c-.252-.1123-.5088-.1685-.77-.1685-.6348,0-.9521,.439-.9521,1.3164v1.0776h1.4419v.938h-1.4419v5.8662h-1.1479Z" />
24
+ <path d="M35.5175,44.3898c-.2236,0-.4126-.0698-.5669-.21-.1538-.1401-.231-.3169-.231-.5317,0-.2241,.0771-.4038,.231-.5391,.1543-.1353,.3433-.2031,.5669-.2031,.2241,0,.4131,.0679,.5674,.2031,.1538,.1353,.231,.3149,.231,.5391,0,.2148-.0771,.3916-.231,.5317-.1543,.1401-.3433,.21-.5674,.21Zm-.5879,8.2041v-6.8042h1.1479v6.8042h-1.1479Z" />
25
+ <path d="M41.0614,52.7618c-.4478,0-.8682-.0796-1.2598-.2378-.3921-.1587-.7305-.3896-1.0151-.6934-.2847-.3032-.5088-.6763-.6719-1.1196-.1636-.4434-.2451-.9453-.2451-1.5054,0-.5688,.0884-1.0752,.2661-1.519,.1772-.4429,.415-.8188,.7139-1.127,.2983-.3076,.646-.541,1.043-.6997,.3965-.1587,.814-.2383,1.2529-.2383,.4482,0,.8306,.0796,1.1479,.2383s.5972,.3452,.8403,.5601l-.5884,.7559c-.1958-.1772-.4038-.3223-.623-.4341s-.4644-.168-.7349-.168c-.3081,0-.5928,.063-.854,.189s-.4854,.3057-.6719,.5391c-.187,.2334-.334,.5112-.4409,.833-.1074,.3218-.1611,.6792-.1611,1.0708,0,.3921,.0513,.7471,.1538,1.064,.103,.3174,.2451,.5908,.4272,.8193s.4033,.4058,.665,.5317c.2612,.126,.5459,.189,.854,.189,.3169,0,.6089-.0674,.875-.2026s.5063-.2964,.7207-.4834l.5044,.77c-.3081,.271-.6489,.4834-1.022,.6372-.3735,.1538-.7656,.231-1.1763,.231Z" />
26
+ <path d="M45.3451,44.3898c-.2236,0-.4126-.0698-.5669-.21-.1538-.1401-.231-.3169-.231-.5317,0-.2241,.0771-.4038,.231-.5391,.1543-.1353,.3433-.2031,.5669-.2031,.2241,0,.4131,.0679,.5674,.2031,.1533,.1353,.2314,.3149,.2314,.5391,0,.2148-.0781,.3916-.2314,.5317-.1543,.1401-.3433,.21-.5674,.21Zm-.5879,8.2041v-6.8042h1.1484v6.8042h-1.1484Z" />
27
+ <path d="M49.769,52.7618c-.5693,0-1.043-.168-1.4209-.5039s-.5674-.812-.5674-1.4282c0-.7466,.332-1.3179,.9941-1.7148,.6631-.3965,1.7227-.6743,3.1787-.833,0-.2144-.0215-.4248-.0635-.6299s-.1143-.3872-.2168-.5459-.2451-.2871-.4268-.3853c-.1826-.0981-.4131-.147-.6934-.147-.3916,0-.7607,.0747-1.1064,.2241-.3447,.1494-.6533,.3174-.9238,.5039l-.4473-.7979c.3164-.2056,.7041-.4038,1.1611-.5952,.458-.1909,.9619-.2871,1.5127-.2871,.8301,0,1.4326,.2544,1.8057,.7632s.5596,1.188,.5596,2.0371v4.1719h-.9512l-.0986-.812h-.042c-.3262,.271-.6768,.502-1.0498,.6929-.373,.1914-.7744,.2871-1.2041,.2871Zm.3359-.9238c.3271,0,.6348-.0771,.9238-.231,.29-.1543,.5977-.3804,.9248-.6792v-1.8901c-.5693,.0752-1.0479,.1636-1.4355,.2661-.3877,.103-.7002,.2241-.9375,.3643-.2383,.1396-.4111,.3008-.5186,.4829-.1074,.1816-.1611,.3804-.1611,.5947,0,.3921,.1172,.6724,.3506,.8403s.5176,.252,.8535,.252Z" />
28
+ <path d="M56.475,52.7618c-.4395,0-.752-.1309-.9385-.3921s-.2793-.644-.2793-1.1479v-8.5957h1.1475v8.6797c0,.187,.0322,.3174,.0977,.3921s.1406,.1118,.2246,.1118h.1045c.0332,0,.082-.0088,.1475-.0278l.1543,.8682c-.0752,.0371-.1641,.0649-.2666,.084-.1025,.0186-.2334,.0278-.3916,.0278Z" />
29
+ <path d="M63.4047,52.7618c-.4854,0-.9473-.0889-1.3857-.2661s-.8213-.4009-1.1484-.6719l.5742-.77c.2988,.2427,.6045,.439,.917,.5879,.3125,.1494,.6748,.2241,1.085,.2241,.4482,0,.7842-.1025,1.0078-.3081,.2246-.2051,.3359-.457,.3359-.7559,0-.1772-.0459-.3311-.1396-.4619s-.2119-.2451-.3564-.3433c-.1455-.0977-.3105-.1841-.4971-.2588-.1875-.0747-.374-.1494-.5605-.2241-.2422-.084-.4854-.1797-.7275-.2871-.2432-.1069-.46-.2378-.6514-.3916-.1914-.1543-.3477-.334-.4688-.5391-.1211-.2056-.1826-.4526-.1826-.7422,0-.2705,.0537-.5249,.1611-.7632,.1074-.2378,.2617-.4429,.4619-.6157,.2012-.1729,.4463-.3081,.7354-.4062,.2891-.0977,.6162-.147,.9805-.147,.4287,0,.8232,.0752,1.1826,.2241,.3594,.1494,.6699,.3315,.9307,.5459l-.5459,.728c-.2334-.1772-.4756-.3218-.7275-.4341-.252-.1118-.5273-.168-.8262-.168-.4297,0-.7441,.0981-.9453,.2939-.2002,.1963-.3008,.4248-.3008,.686,0,.1592,.042,.2964,.126,.4131s.1963,.2197,.3359,.3081c.1396,.0889,.3008,.168,.4834,.2378,.1816,.0703,.3711,.1426,.5664,.2173,.2432,.0933,.4883,.1914,.7354,.2939,.2471,.103,.4688,.231,.665,.3848,.1963,.1543,.3564,.3433,.4824,.5674,.127,.2236,.1895,.4946,.1895,.812,0,.2798-.0537,.541-.1611,.7837-.1074,.2432-.2656,.4575-.4756,.644-.21,.187-.4717,.334-.7842,.4409-.3125,.1074-.6699,.1611-1.0713,.1611Z" />
30
+ <path d="M69.3549,52.7618c-.3643,0-.6699-.0562-.917-.168s-.4482-.2661-.6016-.4619c-.1543-.1963-.2646-.4341-.3291-.7139-.0654-.2803-.0986-.5884-.0986-.9243v-3.7661h-1.0078v-.8677l1.0645-.0703,.1396-1.9038h.9658v1.9038h1.834v.938h-1.834v3.7803c0,.4199,.0771,.7441,.2314,.9731,.1533,.2285,.4268,.3428,.8184,.3428,.1211,0,.252-.0186,.3926-.0562,.1396-.0371,.2656-.0791,.3779-.126l.2236,.8682c-.1865,.0654-.3896,.1235-.6084,.1748-.2197,.0513-.4365,.0771-.6514,.0771Z" />
31
+ <path d="M73.2192,52.7618c-.5693,0-1.043-.168-1.4209-.5039s-.5674-.812-.5674-1.4282c0-.7466,.332-1.3179,.9941-1.7148,.6631-.3965,1.7227-.6743,3.1787-.833,0-.2144-.0215-.4248-.0635-.6299s-.1143-.3872-.2168-.5459-.2451-.2871-.4268-.3853c-.1826-.0981-.4131-.147-.6934-.147-.3916,0-.7607,.0747-1.1064,.2241-.3447,.1494-.6533,.3174-.9238,.5039l-.4473-.7979c.3164-.2056,.7041-.4038,1.1611-.5952,.458-.1909,.9619-.2871,1.5127-.2871,.8301,0,1.4326,.2544,1.8057,.7632s.5596,1.188,.5596,2.0371v4.1719h-.9512l-.0986-.812h-.042c-.3262,.271-.6768,.502-1.0498,.6929-.373,.1914-.7744,.2871-1.2041,.2871Zm.3359-.9238c.3271,0,.6348-.0771,.9238-.231,.29-.1543,.5977-.3804,.9248-.6792v-1.8901c-.5693,.0752-1.0479,.1636-1.4355,.2661-.3877,.103-.7002,.2241-.9375,.3643-.2383,.1396-.4111,.3008-.5186,.4829-.1074,.1816-.1611,.3804-.1611,.5947,0,.3921,.1172,.6724,.3506,.8403s.5176,.252,.8535,.252Z" />
32
+ <path d="M80.6528,52.7618c-.3643,0-.6699-.0562-.917-.168s-.4482-.2661-.6016-.4619c-.1543-.1963-.2646-.4341-.3291-.7139-.0654-.2803-.0986-.5884-.0986-.9243v-3.7661h-1.0078v-.8677l1.0645-.0703,.1396-1.9038h.9658v1.9038h1.834v.938h-1.834v3.7803c0,.4199,.0771,.7441,.2314,.9731,.1533,.2285,.4268,.3428,.8184,.3428,.1211,0,.252-.0186,.3926-.0562,.1396-.0371,.2656-.0791,.3779-.126l.2236,.8682c-.1865,.0654-.3896,.1235-.6084,.1748-.2197,.0513-.4365,.0771-.6514,.0771Z" />
33
+ <path d="M85.8051,52.7618c-.458,0-.8848-.0815-1.2812-.2451-.3965-.1631-.7422-.3965-1.0361-.6997s-.5244-.6743-.6924-1.1133c-.1689-.4385-.2529-.938-.2529-1.498s.0869-1.0615,.2598-1.5049c.1719-.4434,.4004-.8188,.6855-1.127s.6094-.5435,.9727-.707c.3643-.1631,.7422-.2451,1.1348-.2451,.4287,0,.8135,.0752,1.1543,.2241,.3408,.1494,.626,.3643,.8545,.644s.4033,.6162,.5254,1.0078c.1211,.3921,.1816,.8311,.1816,1.3164,0,.1211-.0029,.2402-.0068,.3569-.0049,.1167-.0166,.2168-.0352,.3008h-4.5918c.0459,.728,.2725,1.3047,.6787,1.729,.4062,.4248,.9355,.6372,1.5889,.6372,.3271,0,.6279-.0493,.9033-.147,.2754-.0981,.5391-.2266,.791-.3853l.4062,.7559c-.2988,.187-.6309,.3501-.9941,.4902-.3643,.1401-.7793,.21-1.2461,.21Zm-2.1426-4.1162h3.6406c0-.6904-.1475-1.2153-.4414-1.5747s-.707-.5391-1.2393-.5391c-.2422,0-.4736,.0469-.6924,.1401-.2197,.0933-.418,.231-.5957,.4131-.1768,.1816-.3242,.4038-.4404,.6646-.1172,.2617-.1943,.5601-.2314,.896Z" />
34
+ <path d="M93.8686,52.5939l-1.8896-6.8042h1.1758l1.0078,3.9341c.0752,.3271,.1455,.644,.2109,.9521,.0645,.3081,.1299,.6206,.1953,.938h.0566c.0742-.3174,.1484-.6323,.2236-.9448,.0742-.313,.1543-.6279,.2383-.9453l1.0498-3.9341h1.1201l1.0635,3.9341c.084,.3271,.166,.644,.2451,.9521s.1562,.6206,.2314,.938h.0557c.0742-.3174,.1445-.6299,.21-.938s.1357-.625,.21-.9521l.9941-3.9341h1.0918l-1.8193,6.8042h-1.4004l-.9805-3.6538c-.084-.3267-.1602-.6489-.2305-.9663-.0703-.3169-.1475-.6484-.2314-.9937h-.0557c-.0752,.3452-.1494,.6787-.2236,1.001-.0752,.3218-.1592,.646-.252,.9727l-.9521,3.6401h-1.3447Z" />
35
+ <path d="M105.5453,52.7618c-.458,0-.8848-.0815-1.2812-.2451-.3965-.1631-.7422-.3965-1.0361-.6997s-.5244-.6743-.6924-1.1133c-.1689-.4385-.2529-.938-.2529-1.498s.0869-1.0615,.2598-1.5049c.1719-.4434,.4004-.8188,.6855-1.127s.6094-.5435,.9727-.707c.3643-.1631,.7422-.2451,1.1348-.2451,.4287,0,.8135,.0752,1.1543,.2241,.3408,.1494,.626,.3643,.8545,.644s.4033,.6162,.5254,1.0078c.1211,.3921,.1816,.8311,.1816,1.3164,0,.1211-.0029,.2402-.0068,.3569-.0049,.1167-.0166,.2168-.0352,.3008h-4.5918c.0459,.728,.2725,1.3047,.6787,1.729,.4062,.4248,.9355,.6372,1.5889,.6372,.3271,0,.6279-.0493,.9033-.147,.2754-.0981,.5391-.2266,.791-.3853l.4062,.7559c-.2988,.187-.6309,.3501-.9941,.4902-.3643,.1401-.7793,.21-1.2461,.21Zm-2.1426-4.1162h3.6406c0-.6904-.1475-1.2153-.4414-1.5747s-.707-.5391-1.2393-.5391c-.2422,0-.4736,.0469-.6924,.1401-.2197,.0933-.418,.231-.5957,.4131-.1768,.1816-.3242,.4038-.4404,.6646-.1172,.2617-.1943,.5601-.2314,.896Z" />
36
+ <path d="M112.7406,52.7618c-.3174,0-.6465-.0771-.9873-.231s-.6602-.3662-.959-.6372h-.042l-.0977,.7002h-.9238v-9.9678h1.1475v2.7158l-.0283,1.2319c.3086-.2705,.6445-.4971,1.0088-.6792,.3633-.1816,.7373-.2729,1.1201-.2729,.4385,0,.8252,.082,1.1611,.2451,.3359,.1636,.6182,.397,.8477,.7002,.2285,.3032,.4014,.6675,.5176,1.0918,.1172,.4248,.1748,.8984,.1748,1.4209,0,.5791-.0791,1.0972-.2373,1.5542-.1592,.4575-.374,.8447-.6445,1.1621s-.583,.5576-.9375,.7207c-.3555,.1636-.7285,.2451-1.1201,.2451Zm-.1963-.9658c.2803,0,.5391-.063,.7773-.189,.2373-.126,.4434-.3032,.6162-.5322,.1719-.2285,.3076-.5107,.4053-.8472,.0986-.3359,.1475-.7139,.1475-1.1338,0-.373-.0332-.7139-.0986-1.022s-.1699-.5718-.3145-.791-.3311-.3896-.5605-.5112c-.2285-.1211-.501-.1816-.8184-.1816-.5508,0-1.1572,.3076-1.8203,.9238v3.5698c.2988,.2617,.5947,.4458,.8887,.5532s.5537,.1611,.7773,.1611Z" />
37
+ <path d="M119.2504,52.7618c-.4854,0-.9473-.0889-1.3857-.2661s-.8213-.4009-1.1484-.6719l.5742-.77c.2988,.2427,.6045,.439,.917,.5879,.3125,.1494,.6748,.2241,1.085,.2241,.4482,0,.7842-.1025,1.0078-.3081,.2246-.2051,.3359-.457,.3359-.7559,0-.1772-.0459-.3311-.1396-.4619s-.2119-.2451-.3564-.3433c-.1455-.0977-.3105-.1841-.4971-.2588-.1875-.0747-.374-.1494-.5605-.2241-.2422-.084-.4854-.1797-.7275-.2871-.2432-.1069-.46-.2378-.6514-.3916-.1914-.1543-.3477-.334-.4688-.5391-.1211-.2056-.1826-.4526-.1826-.7422,0-.2705,.0537-.5249,.1611-.7632,.1074-.2378,.2617-.4429,.4619-.6157,.2012-.1729,.4463-.3081,.7354-.4062,.2891-.0977,.6162-.147,.9805-.147,.4287,0,.8232,.0752,1.1826,.2241,.3594,.1494,.6699,.3315,.9307,.5459l-.5459,.728c-.2334-.1772-.4756-.3218-.7275-.4341-.252-.1118-.5273-.168-.8262-.168-.4297,0-.7441,.0981-.9453,.2939-.2002,.1963-.3008,.4248-.3008,.686,0,.1592,.042,.2964,.126,.4131s.1963,.2197,.3359,.3081c.1396,.0889,.3008,.168,.4834,.2378,.1816,.0703,.3711,.1426,.5664,.2173,.2432,.0933,.4883,.1914,.7354,.2939,.2471,.103,.4688,.231,.665,.3848,.1963,.1543,.3564,.3433,.4824,.5674,.127,.2236,.1895,.4946,.1895,.812,0,.2798-.0537,.541-.1611,.7837-.1074,.2432-.2656,.4575-.4756,.644-.21,.187-.4717,.334-.7842,.4409-.3125,.1074-.6699,.1611-1.0713,.1611Z" />
38
+ <path d="M123.9262,44.3898c-.2246,0-.4131-.0698-.5674-.21s-.2305-.3169-.2305-.5317c0-.2241,.0762-.4038,.2305-.5391s.3428-.2031,.5674-.2031c.2236,0,.4131,.0679,.5664,.2031,.1543,.1353,.2314,.3149,.2314,.5391,0,.2148-.0771,.3916-.2314,.5317-.1533,.1401-.3428,.21-.5664,.21Zm-.5879,8.2041v-6.8042h1.1475v6.8042h-1.1475Z" />
39
+ <path d="M128.9242,52.7618c-.3643,0-.6699-.0562-.917-.168s-.4482-.2661-.6016-.4619c-.1543-.1963-.2646-.4341-.3291-.7139-.0654-.2803-.0986-.5884-.0986-.9243v-3.7661h-1.0078v-.8677l1.0645-.0703,.1396-1.9038h.9658v1.9038h1.834v.938h-1.834v3.7803c0,.4199,.0771,.7441,.2314,.9731,.1533,.2285,.4268,.3428,.8184,.3428,.1211,0,.252-.0186,.3926-.0562,.1396-.0371,.2656-.0791,.3779-.126l.2236,.8682c-.1865,.0654-.3896,.1235-.6084,.1748-.2197,.0513-.4365,.0771-.6514,.0771Z" />
40
+ <path d="M134.0766,52.7618c-.458,0-.8848-.0815-1.2812-.2451-.3965-.1631-.7422-.3965-1.0361-.6997s-.5244-.6743-.6924-1.1133c-.1689-.4385-.2529-.938-.2529-1.498s.0869-1.0615,.2598-1.5049c.1719-.4434,.4004-.8188,.6855-1.127s.6094-.5435,.9727-.707c.3643-.1631,.7422-.2451,1.1348-.2451,.4287,0,.8135,.0752,1.1543,.2241,.3408,.1494,.626,.3643,.8545,.644s.4033,.6162,.5254,1.0078c.1211,.3921,.1816,.8311,.1816,1.3164,0,.1211-.0029,.2402-.0068,.3569-.0049,.1167-.0166,.2168-.0352,.3008h-4.5918c.0459,.728,.2725,1.3047,.6787,1.729,.4062,.4248,.9355,.6372,1.5889,.6372,.3271,0,.6279-.0493,.9033-.147,.2754-.0981,.5391-.2266,.791-.3853l.4062,.7559c-.2988,.187-.6309,.3501-.9941,.4902-.3643,.1401-.7793,.21-1.2461,.21Zm-2.1426-4.1162h3.6406c0-.6904-.1475-1.2153-.4414-1.5747s-.707-.5391-1.2393-.5391c-.2422,0-.4736,.0469-.6924,.1401-.2197,.0933-.418,.231-.5957,.4131-.1768,.1816-.3242,.4038-.4404,.6646-.1172,.2617-.1943,.5601-.2314,.896Z" />
41
+ </g>
42
+ </g>
43
+ </svg>
44
+ );
45
+ }
46
+
47
+ UtahUnbrand.propTypes = propTypes;
48
+ UtahUnbrand.defaultProps = defaultProps;
49
+
50
+ export default UtahUnbrand;
@@ -0,0 +1,71 @@
1
+ import PropTypes from 'prop-types';
2
+ import RefShape from '../../propTypesShapes/RefShape';
3
+ import joinClassNames from '../../util/joinClassNames';
4
+
5
+ const propTypes = {
6
+ children: PropTypes.node,
7
+ className: PropTypes.string,
8
+ id: PropTypes.string,
9
+ innerRef: RefShape,
10
+ size: PropTypes.number,
11
+ strokeWidth: PropTypes.number,
12
+ value: (props, propName, componentName) => {
13
+ const number = Number(props[propName]);
14
+ if (!Number.isNaN(props[propName]) && Number.isNaN(number)) {
15
+ throw new Error(`Invalid prop '${propName}' passed to ${componentName}. Must be a number.`);
16
+ }
17
+ if (number !== undefined && (number < 0 || number > 1)) {
18
+ throw new Error(`Invalid prop '${propName}' passed to ${componentName}. Must be a number between 0 and 1 (inclusive).`);
19
+ }
20
+ return false;
21
+ },
22
+ };
23
+ const defaultProps = {
24
+ children: null,
25
+ className: null,
26
+ id: null,
27
+ innerRef: null,
28
+ size: 60,
29
+ strokeWidth: 10,
30
+ value: NaN,
31
+ };
32
+
33
+ function Spinner({
34
+ children,
35
+ className,
36
+ id,
37
+ innerRef,
38
+ size,
39
+ strokeWidth,
40
+ value,
41
+ }) {
42
+ return (
43
+ <div
44
+ aria-valuemax="100"
45
+ aria-valuemin="0"
46
+ aria-valuenow="20.000000000000004"
47
+ className={joinClassNames(
48
+ className,
49
+ 'spinner'
50
+ )}
51
+ id={id}
52
+ ref={innerRef}
53
+ role="progressbar"
54
+ aria-label={Number.isNaN(value) ? 'Loading...' : `Loading ${(value * 100).toFixed(2)}% complete`}
55
+ size="50"
56
+ >
57
+ <div className="spinner__animation">
58
+ <svg width={size} height={size} strokeWidth={strokeWidth} viewBox="-10.00 -10.00 120.00 120.00" role="presentation">
59
+ <path className="spinner__track" d="M 50,50 m 0,-45 a 45,45 0 1 1 0,90 a 45,45 0 1 1 0,-90" />
60
+ <path className="spinner__value" d="M 50,50 m 0,-45 a 45,45 0 1 1 0,90 a 45,45 0 1 1 0,-90" pathLength="280" strokeDasharray="280 280" strokeDashoffset={Number.isNaN(value) ? 0 : (280 * (1 - value))} />
61
+ </svg>
62
+ </div>
63
+ {children}
64
+ </div>
65
+ );
66
+ }
67
+
68
+ Spinner.propTypes = propTypes;
69
+ Spinner.defaultProps = defaultProps;
70
+
71
+ export default Spinner;
@@ -0,0 +1,9 @@
1
+ export default {
2
+ SMALL3X: 'small3x',
3
+ SMALL2X: 'small2x',
4
+ SMALL1X: 'small1x',
5
+ SMALL: 'small',
6
+ MEDIUM: 'medium',
7
+ LARGE: 'large',
8
+ LARGE1X: 'large1x',
9
+ };
@@ -0,0 +1,9 @@
1
+ export default {
2
+ // compares dates as Date() objects
3
+ // dates represented by an ISO string should use the STRING enum value
4
+ DATE: 'date',
5
+ // compares numbers (does do Number(fieldValue)) conversion so it is safe to pass strings as numbers)
6
+ NUMBER: 'number',
7
+ // does simple localeCompare() string comparison; is safe for null strings
8
+ STRING: 'string',
9
+ };
@@ -0,0 +1,44 @@
1
+ import { useContext } from 'react';
2
+ import FormContext from '../../components/forms/FormContext';
3
+ import valueAtPath from '../../util/state/valueAtPath';
4
+ import onKeyPress from '../../util/onKeyPress';
5
+
6
+ /**
7
+ * A component can be
8
+ * • uncontrolled (no value/onchange)
9
+ * • controlled by form (<Form> has onChange and state, but Component itself does not)
10
+ * • controlled by component (<Form> may or may not have onChange and state, but Component itself specifies overriding value and onChange)
11
+ *
12
+ * @param {string} object.errorMessage errorMessage from the component that overrides the one from the form context
13
+ * @param {string|number} object.id id of the component that is also the path to the data for the component in the form context
14
+ * @param {func} object.onChange when component changes, call this function, overrides the one from the form context
15
+ * @param {func} object.onSubmit when enter key pressed ,or some other submitting event, call this function, overrides the one from the form context
16
+ * @param {string|bool|number|any} object.value current value of the component, overrides the one from the form context
17
+ * @returns the same passed in parameters but checking if the component overrides the form's context values
18
+ */
19
+ export default function useCurrentValuesFromForm({
20
+ errorMessage,
21
+ id,
22
+ onChange,
23
+ onSubmit,
24
+ value,
25
+ }) {
26
+ if (!id) {
27
+ console.error('useCurrentValuesFromForm: `id` is required');
28
+ }
29
+ const {
30
+ onChange: contextOnChange,
31
+ onSubmit: contextOnSubmit,
32
+ state,
33
+ validationErrors,
34
+ } = useContext(FormContext) || {};
35
+
36
+ const currentOnSubmit = onSubmit ?? contextOnSubmit;
37
+ return {
38
+ currentErrorMessage: errorMessage ?? (validationErrors && validationErrors[id]),
39
+ currentOnChange: onChange ?? (contextOnChange && ((e, newValue) => contextOnChange({ e, id, newValue }))),
40
+ currentOnSubmit,
41
+ currentValue: (value ?? (state && valueAtPath({ object: state, path: id }))) || '',
42
+ currentOnFormKeyPress: onKeyPress({ targetKey: 'Enter', func: (e) => currentOnSubmit && currentOnSubmit(e) }),
43
+ };
44
+ }
@@ -0,0 +1,6 @@
1
+ export default function useBanner() {
2
+ return ({ message }) => {
3
+ // TODO: replace this console.log with adding the banner to the banner queue in the design system context
4
+ console.log(message);
5
+ };
6
+ }
@@ -0,0 +1,29 @@
1
+ import { useLocation } from 'react-router-dom';
2
+ import useRefAlways from './useRefAlways';
3
+ import findMenuItemInMenusByPathname from '../util/menuItems/findMenuItemInMenusByPathname';
4
+ import useStateEffect from './useStateEffect';
5
+
6
+ /**
7
+ * Compares lists of menuItems against the current url location to determine which menu
8
+ * item is the currently visited menu item.
9
+ *
10
+ * @param menus all the known menus
11
+ * @returns the first menu item from all the menus that matches the current url
12
+ */
13
+ function useCurrentMenuItem(menus) {
14
+ const { pathname } = useLocation();
15
+ const pathnameRef = useRefAlways(pathname);
16
+
17
+ const menusRef = useRefAlways(menus);
18
+ const [currentMenuItem] = useStateEffect({
19
+ calculateValueFn: () => findMenuItemInMenusByPathname({
20
+ menus: menusRef.current,
21
+ pathname: pathnameRef.current,
22
+ }),
23
+ dependencyList: [...menus, pathname],
24
+ });
25
+
26
+ return currentMenuItem;
27
+ }
28
+
29
+ export default useCurrentMenuItem;
@@ -0,0 +1,24 @@
1
+ import cloneDeep from 'lodash/cloneDeep';
2
+ import calculateMenuItemsParents from '../util/menuItems/calculateMenuItemsParents';
3
+ import useStateEffect from './useStateEffect';
4
+
5
+ /**
6
+ * Prep menu items for display. This includes such tasks as determining `parentLinks` chaining.
7
+ *
8
+ * @param [MenuItemShape] menuItems the menu item information to interpret
9
+ * @returns new list of menu items with added calculated data like `parentLinks`
10
+ */
11
+ function usePrepMenuItems({ menuItems }) {
12
+ const [menuItemsPrepped] = useStateEffect({
13
+ calculateValueFn: () => {
14
+ const newMenuItems = cloneDeep(menuItems);
15
+
16
+ return calculateMenuItemsParents({ menuItems: newMenuItems });
17
+ },
18
+ dependencyList: [menuItems],
19
+ });
20
+
21
+ return menuItemsPrepped;
22
+ }
23
+
24
+ export default usePrepMenuItems;
@@ -0,0 +1,8 @@
1
+ import { useRef } from 'react';
2
+
3
+ // always sets ref to the given value
4
+ export default (value) => {
5
+ const ref = useRef(value);
6
+ ref.current = value;
7
+ return ref;
8
+ };
@@ -0,0 +1,11 @@
1
+ import isFunction from 'lodash/isFunction';
2
+ import { useRef } from 'react';
3
+
4
+ // lazy loads the ref like how useState() can lazy load state via a function
5
+ export default (lazyFunc) => {
6
+ const ref = useRef(undefined);
7
+ if (ref.current === undefined) {
8
+ ref.current = (lazyFunc && isFunction(lazyFunc)) ? lazyFunc() : lazyFunc;
9
+ }
10
+ return ref;
11
+ };
@@ -0,0 +1,18 @@
1
+ import { useEffect, useState } from 'react';
2
+
3
+ const useScrollPosition = (elementRef) => {
4
+ const [scrollPosition, setScrollPosition] = useState(0);
5
+ const ele = elementRef || window;
6
+ useEffect(() => {
7
+ const updatePosition = () => {
8
+ setScrollPosition(ele.scrollY);
9
+ };
10
+ ele.addEventListener('scroll', updatePosition);
11
+ updatePosition();
12
+ return () => ele.removeEventListener('scroll', updatePosition);
13
+ }, []);
14
+
15
+ return scrollPosition;
16
+ };
17
+
18
+ export default useScrollPosition;