@thecb/components 6.1.0-beta.7 → 6.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "6.1.0-beta.7",
3
+ "version": "6.1.2",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -124,6 +124,8 @@ const Checkbox = ({
124
124
  checked={checked}
125
125
  onChange={onChange}
126
126
  tabIndex="-1"
127
+ aria-invalid={error}
128
+ aria-describedby={`${name}-error-message`}
127
129
  />
128
130
  <StyledCheckbox
129
131
  error={error}
@@ -48,10 +48,12 @@ const PeriscopeDashboardIframe = ({
48
48
 
49
49
  useEffect(() => {
50
50
  time.timer = setTimeout(() => {
51
- periscopeDataRequestFailure();
51
+ if (!periscopeDataSuccess) {
52
+ periscopeDataRequestFailure();
53
+ }
52
54
  }, 10000);
53
55
  return () => clearTimeout(time.timer);
54
- }, []);
56
+ }, [periscopeDataSuccess]);
55
57
 
56
58
  const Dashboard = height => url => (
57
59
  <DashboardIframe
@@ -1,17 +1,15 @@
1
1
  import { useEffect } from "react";
2
2
 
3
3
  const useFocusInvalidInput = (hasErrors, resetHasErrors = () => {}) => {
4
- console.log("hey show errors", hasErrors);
5
4
  // Only move focus when "hasErrors" is true
6
5
  // "hasErrors" is managed by container page of form
7
6
  // typically set to "true" on attempted form submission, if errors exist
7
+ // Reset errors, if provided, resets the error state tracking in order to properly re-run
8
8
  useEffect(() => {
9
- console.log("inside use effect show errors", hasErrors);
10
9
  if (hasErrors) {
11
10
  const inputsWithErrors = document.querySelectorAll(
12
11
  "input[aria-invalid=true]"
13
12
  );
14
- console.log("inputs with errors is", inputsWithErrors);
15
13
  inputsWithErrors?.[0]?.focus();
16
14
  }
17
15
  return () => resetHasErrors(false);
@@ -46,19 +46,8 @@ export const safeChildren = (children, replacement = []) => {
46
46
  return unsafeValues.includes(children) ? replacement : children;
47
47
  };
48
48
 
49
- export const generateClickHandler = (
50
- form,
51
- handleErrors,
52
- submitForm,
53
- resetErrors
54
- ) => e => {
49
+ export const generateClickHandler = (form, handleErrors, submitForm) => e => {
55
50
  e.preventDefault();
56
- if (resetErrors) {
57
- console.log("reset errors", resetErrors);
58
- // if provided, will reset error state tracker
59
- // allows hooks that depend on error state to re-run
60
- resetErrors(false);
61
- }
62
51
  const formHasError = Object.values(form.fields).reduce(
63
52
  (acc, curr) => acc || curr.hasErrors,
64
53
  false
package/src/.DS_Store DELETED
Binary file