@cerebruminc/cerebellum 16.1.1 → 16.2.0-beta.dangerous.cd6fba9

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 (80) hide show
  1. package/lib/cjs/ColorPickerInput-CBPI8IJ-.js +187 -0
  2. package/lib/cjs/ColorPickerInput-CBPI8IJ-.js.map +1 -0
  3. package/lib/cjs/ColorPickerInput.cjs +25 -0
  4. package/lib/cjs/ColorPickerInput.cjs.map +1 -0
  5. package/lib/cjs/DatePicker.cjs +1 -1
  6. package/lib/cjs/Form.cjs +7 -4
  7. package/lib/cjs/Form.cjs.map +1 -1
  8. package/lib/cjs/FormFieldTypeEnum.cjs +5 -0
  9. package/lib/cjs/FormFieldTypeEnum.cjs.map +1 -1
  10. package/lib/cjs/FormSeparator.cjs +3 -1
  11. package/lib/cjs/FormSeparator.cjs.map +1 -1
  12. package/lib/cjs/{FormStyles-CxgYRZOl.js → FormStyles-oEHUS8Oi.js} +43 -22
  13. package/lib/cjs/{FormStyles-CxgYRZOl.js.map → FormStyles-oEHUS8Oi.js.map} +1 -1
  14. package/lib/cjs/FormWrapper.cjs +3 -1
  15. package/lib/cjs/FormWrapper.cjs.map +1 -1
  16. package/lib/cjs/{FormikContainer-CY2nLsAs.js → FormikContainer-DDXxSB2z.js} +37 -4
  17. package/lib/cjs/{FormikContainer-CY2nLsAs.js.map → FormikContainer-DDXxSB2z.js.map} +1 -1
  18. package/lib/cjs/InlineColorPickerInput.cjs +25 -0
  19. package/lib/cjs/InlineColorPickerInput.cjs.map +1 -0
  20. package/lib/cjs/{InlineDatePicker-DFv_uHo9.js → InlineDatePicker-B7DTwvhv.js} +344 -176
  21. package/lib/cjs/InlineDatePicker-B7DTwvhv.js.map +1 -0
  22. package/lib/cjs/InlineDatePicker.cjs +1 -1
  23. package/lib/cjs/TitleGroup.cjs +3 -1
  24. package/lib/cjs/TitleGroup.cjs.map +1 -1
  25. package/lib/cjs/cerebellumTheme.cjs +5 -0
  26. package/lib/cjs/cerebellumTheme.cjs.map +1 -1
  27. package/lib/cjs/index.cjs +9 -3
  28. package/lib/cjs/index.cjs.map +1 -1
  29. package/lib/cjs/validateColorContrast.cjs +53 -0
  30. package/lib/cjs/validateColorContrast.cjs.map +1 -0
  31. package/lib/cjs/validateColorContrastWithMessage.cjs +10 -0
  32. package/lib/cjs/validateColorContrastWithMessage.cjs.map +1 -0
  33. package/lib/esm/ColorPickerInput-S8X2gIA5.js +180 -0
  34. package/lib/esm/ColorPickerInput-S8X2gIA5.js.map +1 -0
  35. package/lib/esm/ColorPickerInput.js +18 -0
  36. package/lib/esm/ColorPickerInput.js.map +1 -0
  37. package/lib/esm/DatePicker.js +1 -1
  38. package/lib/esm/Form.js +7 -5
  39. package/lib/esm/Form.js.map +1 -1
  40. package/lib/esm/FormFieldTypeEnum.js +5 -1
  41. package/lib/esm/FormFieldTypeEnum.js.map +1 -1
  42. package/lib/esm/FormSeparator.js +3 -1
  43. package/lib/esm/FormSeparator.js.map +1 -1
  44. package/lib/esm/{FormStyles-BQJPyTS0.js → FormStyles-wlDzB1vZ.js} +44 -23
  45. package/lib/esm/{FormStyles-BQJPyTS0.js.map → FormStyles-wlDzB1vZ.js.map} +1 -1
  46. package/lib/esm/FormWrapper.js +3 -1
  47. package/lib/esm/FormWrapper.js.map +1 -1
  48. package/lib/esm/{FormikContainer-SJPYfIkF.js → FormikContainer--y08X-6j.js} +38 -5
  49. package/lib/esm/{FormikContainer-SJPYfIkF.js.map → FormikContainer--y08X-6j.js.map} +1 -1
  50. package/lib/esm/InlineColorPickerInput.js +18 -0
  51. package/lib/esm/InlineColorPickerInput.js.map +1 -0
  52. package/lib/esm/{InlineDatePicker-ClVBWEzW.js → InlineDatePicker-BuxjkoV0.js} +345 -177
  53. package/lib/esm/InlineDatePicker-BuxjkoV0.js.map +1 -0
  54. package/lib/esm/InlineDatePicker.js +1 -1
  55. package/lib/esm/TitleGroup.js +3 -1
  56. package/lib/esm/TitleGroup.js.map +1 -1
  57. package/lib/esm/cerebellumTheme.js +5 -0
  58. package/lib/esm/cerebellumTheme.js.map +1 -1
  59. package/lib/esm/index.js +6 -4
  60. package/lib/esm/index.js.map +1 -1
  61. package/lib/esm/validateColorContrast.js +50 -0
  62. package/lib/esm/validateColorContrast.js.map +1 -0
  63. package/lib/esm/validateColorContrastWithMessage.js +3 -0
  64. package/lib/esm/validateColorContrastWithMessage.js.map +1 -0
  65. package/lib/types/src/components/ColorPickerInput/ColorPickerInput.d.ts +3 -0
  66. package/lib/types/src/components/ColorPickerInput/InlineColorPickerInput.d.ts +3 -0
  67. package/lib/types/src/components/ColorPickerInput/index.d.ts +3 -0
  68. package/lib/types/src/components/ColorPickerInput/types.d.ts +48 -0
  69. package/lib/types/src/components/Form/fields/ColorPickerField/ColorPickerField.d.ts +4 -0
  70. package/lib/types/src/components/Form/fields/ColorPickerField/index.d.ts +1 -0
  71. package/lib/types/src/components/Form/fields/index.d.ts +2 -1
  72. package/lib/types/src/components/Form/index.d.ts +3 -3
  73. package/lib/types/src/components/Form/mocks/fields.d.ts +62 -0
  74. package/lib/types/src/components/Form/types.d.ts +36 -2
  75. package/lib/types/src/helpers/colorValidators.d.ts +19 -0
  76. package/lib/types/src/index.d.ts +5 -1
  77. package/lib/types/src/theme.d.ts +6 -0
  78. package/package.json +1 -1
  79. package/lib/cjs/InlineDatePicker-DFv_uHo9.js.map +0 -1
  80. package/lib/esm/InlineDatePicker-ClVBWEzW.js.map +0 -1
@@ -0,0 +1,50 @@
1
+ import { contrast } from './pressedEnter.js';
2
+
3
+ /**
4
+ * Validates that a color has sufficient contrast against a background color
5
+ * according to WCAG AA accessibility standards (4.5:1 ratio for normal text).
6
+ *
7
+ * @param color - The foreground color (hex format, e.g., "#ff0000")
8
+ * @param backgroundColor - The background color to check against (hex format, defaults to "#ffffff")
9
+ * @returns boolean - true if the contrast ratio is >= 4.5:1, false otherwise
10
+ */
11
+ var validateColorContrast = function (color, backgroundColor) {
12
+ if (backgroundColor === void 0) { backgroundColor = "#ffffff"; }
13
+ if (!color) {
14
+ return true; // Allow empty values, let required validation handle this
15
+ }
16
+ try {
17
+ var contrastRatio = contrast(color, backgroundColor);
18
+ // WCAG AA requires 4.5:1 for normal text, 3:1 for large text
19
+ // Using 4.5 as the threshold for accessibility compliance
20
+ return contrastRatio >= 4.5;
21
+ }
22
+ catch (error) {
23
+ // If there's an error in contrast calculation (invalid color format, etc.)
24
+ // return true to avoid blocking the form, let other validation handle format issues
25
+ return true;
26
+ }
27
+ };
28
+ /**
29
+ * Validates that a color has sufficient contrast against a background color
30
+ * and returns an error message if validation fails.
31
+ *
32
+ * @param color - The foreground color (hex format, e.g., "#ff0000")
33
+ * @param backgroundColor - The background color to check against (hex format, defaults to "#ffffff")
34
+ * @param errorMessage - Custom error message (optional)
35
+ * @returns string | null - Error message if validation fails, null if valid
36
+ */
37
+ var validateColorContrastWithMessage = function (color, backgroundColor, errorMessage) {
38
+ if (backgroundColor === void 0) { backgroundColor = "#ffffff"; }
39
+ if (!color) {
40
+ return null; // Allow empty values, let required validation handle this
41
+ }
42
+ var isValid = validateColorContrast(color, backgroundColor);
43
+ if (!isValid) {
44
+ return errorMessage || "This color does not have sufficient contrast for accessibility";
45
+ }
46
+ return null;
47
+ };
48
+
49
+ export { validateColorContrast, validateColorContrastWithMessage };
50
+ //# sourceMappingURL=validateColorContrast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateColorContrast.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,3 @@
1
+ import './pressedEnter.js';
2
+ export { validateColorContrast, validateColorContrastWithMessage } from './validateColorContrast.js';
3
+ //# sourceMappingURL=validateColorContrastWithMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateColorContrastWithMessage.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,3 @@
1
+ import { FC } from "react";
2
+ import { ColorPickerInputType } from "./types";
3
+ export declare const ColorPickerInput: FC<ColorPickerInputType>;
@@ -0,0 +1,3 @@
1
+ import { FC } from "react";
2
+ import { InlineColorPickerInputType } from "./types";
3
+ export declare const InlineColorPickerInput: FC<InlineColorPickerInputType>;
@@ -0,0 +1,3 @@
1
+ export { ColorPickerInput } from "./ColorPickerInput";
2
+ export { InlineColorPickerInput } from "./InlineColorPickerInput";
3
+ export type { ColorPickerInputType, InlineColorPickerInputType, ThemeOverride, ColorPickerInputThemeOverride } from "./types";
@@ -0,0 +1,48 @@
1
+ import { ReactElement, ReactNode } from "react";
2
+ import { InlineInputType } from "../InlineInput";
3
+ export interface InlineColorPickerInputType extends Omit<InlineInputType, "activeColor" | "characterLimit" | "clearButton" | "failColor" | "failColorSecondary" | "inputMode" | "LeadingIcon" | "lookLikeAButton" | "numberArrows" | "onValueChange" | "placeholder" | "placeholderColor" | "required" | "step" | "textColor" | "TrailingIcon" | "trailingIconColor" | "trailingIconFunction" | "trailingText" | "type" | "value"> {
4
+ /** If true, checks if the color is legible against the background color */
5
+ checkLegible?: boolean;
6
+ /** The background color to check legibility against. Defaults to #ffffff (white) */
7
+ legibleAgainst?: string;
8
+ /** Called when the value is changed & returns the new value. Required if you want to update `value`. If not present, `InlineColorPickerInput` becomes a display only component */
9
+ onValueChange?: (value: string) => void;
10
+ /** You can override the theme by passing a `themeOverride` object. */
11
+ themeOverride?: ThemeOverride;
12
+ /** Input value - a hex color string (e.g., "#ff0000") */
13
+ value: string;
14
+ }
15
+ export interface ColorPickerInputType extends Omit<InlineColorPickerInputType, "themeOverride"> {
16
+ /** Descriptive text for your input. Keep it short & concise */
17
+ helperText?: string | ReactElement;
18
+ /** A label for your input. Not required, but strongly recommended. */
19
+ inputLabel?: ReactNode;
20
+ /** Instructional text, that goes between the label and the color picker. */
21
+ instructionalText?: string;
22
+ /** You can override the theme by passing a `themeOverride` object. */
23
+ themeOverride?: ColorPickerInputThemeOverride;
24
+ /** A message for when the input fails validation. Only displays if `showValidationMessage: true` */
25
+ validationMessage?: string;
26
+ }
27
+ export interface ThemeOverride {
28
+ activeBackgroundColor?: string;
29
+ activeBorderColor?: string;
30
+ activeColor?: string;
31
+ disabledBorderColor?: string;
32
+ disabledColor?: string;
33
+ failColor?: string;
34
+ failColorSecondary?: string;
35
+ hoverBorderColor?: string;
36
+ inactiveBorderColor?: string;
37
+ inputBackgroundColor?: string;
38
+ inputBorderRadius?: number;
39
+ inputHeight?: number;
40
+ inputPadding?: number;
41
+ }
42
+ export interface ColorPickerInputThemeOverride extends ThemeOverride {
43
+ helperTextColor?: string;
44
+ instructionalTextColor?: string;
45
+ instructionalTextFontSize?: number;
46
+ labelColor?: string;
47
+ legibilityFontSize?: number;
48
+ }
@@ -0,0 +1,4 @@
1
+ import { FC } from "react";
2
+ import { ColorPickerFieldProps } from "../../types";
3
+ export declare const ColorPickerField: FC<ColorPickerFieldProps>;
4
+ export default ColorPickerField;
@@ -0,0 +1 @@
1
+ export { ColorPickerField } from "./ColorPickerField";
@@ -1,6 +1,7 @@
1
1
  import { AddressField } from "./AddressField/AddressField";
2
2
  import { CheckboxField } from "./CheckboxField/CheckboxField";
3
3
  import { CheckboxGroupField } from "./CheckboxGroupField/CheckboxGroupField";
4
+ import { ColorPickerField } from "./ColorPickerField/ColorPickerField";
4
5
  import { ConfigurableInputField } from "./ConfigurableInputField/ConfigurableInputField";
5
6
  import { CountrySelectField } from "./CountrySelectField/CountrySelectField";
6
7
  import { CountySelectField } from "./CountySelectField/CountySelectField";
@@ -28,4 +29,4 @@ import { TextareaField } from "./TextareaField/TextareaField";
28
29
  import { ToggleField } from "./ToggleField/ToggleField";
29
30
  import { ToggleGroupField } from "./ToggleGroupField/ToggleGroupField";
30
31
  import { ZipCodeField } from "./ZipCodeField/ZipCodeField";
31
- export { AddressField, CheckboxField, CheckboxGroupField, ConfigurableInputField, CountySelectField, CountrySelectField, CreditCardField, CurrencyField, DatePickerField, DescriptiveDropdownInputField, EmailField, HiddenField, ImagePickerField, MultiSelectField, NationalitySelectField, NumberField, PasswordField, PhoneField, RadioGroupField, RemovableField, SectionHeader, SelectField, SocialSecurityField, SplitLineField, StateSelectField, TextField, TextareaField, ToggleField, ToggleGroupField, ZipCodeField, };
32
+ export { AddressField, CheckboxField, CheckboxGroupField, ColorPickerField, ConfigurableInputField, CountySelectField, CountrySelectField, CreditCardField, CurrencyField, DatePickerField, DescriptiveDropdownInputField, EmailField, HiddenField, ImagePickerField, MultiSelectField, NationalitySelectField, NumberField, PasswordField, PhoneField, RadioGroupField, RemovableField, SectionHeader, SelectField, SocialSecurityField, SplitLineField, StateSelectField, TextField, TextareaField, ToggleField, ToggleGroupField, ZipCodeField, };
@@ -1,5 +1,5 @@
1
1
  import { FormWrapper } from "./FormStyles";
2
2
  import { FormikContainer as Form } from "./FormikContainer";
3
- import { AddressOptionsType, CheckboxGroupOptionsType, CheckboxOptionsType, CountySelectOptionsType, CreditCardOptionsType, CurrencyOptionsType, DatePickerOptionsType, EmailOptionsType, FormFieldType, FormFieldTypeEnum, FormReturnType, FormWrapperType, IconCheckboxesOptionsType, MultiSelectOptionsType, NationalitySelectOptionsType, NumberOptionsType, PasswordOptionsType, PhoneOptionsType, RadioGroupOptionsType, RemovableFieldType, RemovableFieldTypeEnum, SelectOptionType, SelectOptionsType, ShowIfType, SingleOrMultipleFieldType, SocialSecurityOptionsType, SplitLineFieldType, StateSelectOptionsType, TextOptionsType, TextareaOptionsType, ToggleGroupOptionsType, ToggleOptionsType, ZipCodeOptionsType, isAddress, isCheckbox, isCheckboxGroup, isConfigurableInput, isCountrySelect, isCountySelect, isCreditCard, isCurrency, isDatePicker, isDescriptiveDropdownInput, isEmail, isFormFieldType, isImagePicker, isMultiSelect, isNationalitySelect, isNumber, isPassword, isPhone, isRadioGroup, isRemovable, isSectionHeader, isSelect, isSocialSecurity, isSplitLine, isStateSelect, isTextarea, isToggle, isToggleGroup, isZipCode } from "./types";
4
- export { Form, FormFieldTypeEnum, FormWrapper, RemovableFieldTypeEnum, isAddress, isCheckbox, isCheckboxGroup, isConfigurableInput, isCountrySelect, isCountySelect, isCreditCard, isCurrency, isDatePicker, isDescriptiveDropdownInput, isEmail, isFormFieldType, isImagePicker, isMultiSelect, isNationalitySelect, isNumber, isPassword, isPhone, isRadioGroup, isRemovable, isSectionHeader, isSelect, isSocialSecurity, isSplitLine, isStateSelect, isTextarea, isToggle, isToggleGroup, isZipCode, };
5
- export type { AddressOptionsType, CheckboxOptionsType, CheckboxGroupOptionsType, CountySelectOptionsType, CreditCardOptionsType, CurrencyOptionsType, DatePickerOptionsType, EmailOptionsType, FormFieldType, FormReturnType, FormWrapperType, IconCheckboxesOptionsType, MultiSelectOptionsType, NationalitySelectOptionsType, NumberOptionsType, PasswordOptionsType, PhoneOptionsType, RadioGroupOptionsType, RemovableFieldType, SelectOptionType, SelectOptionsType, ShowIfType, SingleOrMultipleFieldType, SocialSecurityOptionsType, SplitLineFieldType, StateSelectOptionsType, TextOptionsType, TextareaOptionsType, ToggleOptionsType, ToggleGroupOptionsType, ZipCodeOptionsType, };
3
+ import { AddressOptionsType, CheckboxGroupOptionsType, CheckboxOptionsType, ColorPickerOptionsType, CountySelectOptionsType, CreditCardOptionsType, CurrencyOptionsType, DatePickerOptionsType, EmailOptionsType, FormFieldType, FormFieldTypeEnum, FormReturnType, FormWrapperType, IconCheckboxesOptionsType, MultiSelectOptionsType, NationalitySelectOptionsType, NumberOptionsType, PasswordOptionsType, PhoneOptionsType, RadioGroupOptionsType, RemovableFieldType, RemovableFieldTypeEnum, SelectOptionType, SelectOptionsType, ShowIfType, SingleOrMultipleFieldType, SocialSecurityOptionsType, SplitLineFieldType, StateSelectOptionsType, TextOptionsType, TextareaOptionsType, ToggleGroupOptionsType, ToggleOptionsType, ZipCodeOptionsType, isAddress, isCheckbox, isCheckboxGroup, isColorPicker, isConfigurableInput, isCountrySelect, isCountySelect, isCreditCard, isCurrency, isDatePicker, isDescriptiveDropdownInput, isEmail, isFormFieldType, isImagePicker, isMultiSelect, isNationalitySelect, isNumber, isPassword, isPhone, isRadioGroup, isRemovable, isSectionHeader, isSelect, isSocialSecurity, isSplitLine, isStateSelect, isTextarea, isToggle, isToggleGroup, isZipCode } from "./types";
4
+ export { Form, FormFieldTypeEnum, FormWrapper, RemovableFieldTypeEnum, isAddress, isCheckbox, isCheckboxGroup, isColorPicker, isConfigurableInput, isCountrySelect, isCountySelect, isCreditCard, isCurrency, isDatePicker, isDescriptiveDropdownInput, isEmail, isFormFieldType, isImagePicker, isMultiSelect, isNationalitySelect, isNumber, isPassword, isPhone, isRadioGroup, isRemovable, isSectionHeader, isSelect, isSocialSecurity, isSplitLine, isStateSelect, isTextarea, isToggle, isToggleGroup, isZipCode, };
5
+ export type { AddressOptionsType, CheckboxOptionsType, CheckboxGroupOptionsType, ColorPickerOptionsType, CountySelectOptionsType, CreditCardOptionsType, CurrencyOptionsType, DatePickerOptionsType, EmailOptionsType, FormFieldType, FormReturnType, FormWrapperType, IconCheckboxesOptionsType, MultiSelectOptionsType, NationalitySelectOptionsType, NumberOptionsType, PasswordOptionsType, PhoneOptionsType, RadioGroupOptionsType, RemovableFieldType, SelectOptionType, SelectOptionsType, ShowIfType, SingleOrMultipleFieldType, SocialSecurityOptionsType, SplitLineFieldType, StateSelectOptionsType, TextOptionsType, TextareaOptionsType, ToggleOptionsType, ToggleGroupOptionsType, ZipCodeOptionsType, };
@@ -104,6 +104,7 @@ export declare const allFieldTypes: ({
104
104
  stateFieldName?: undefined;
105
105
  center?: undefined;
106
106
  leftLabel?: undefined;
107
+ checkLegible?: undefined;
107
108
  placeholderInitials?: undefined;
108
109
  menuOptions?: undefined;
109
110
  switchType?: undefined;
@@ -143,6 +144,7 @@ export declare const allFieldTypes: ({
143
144
  stateFieldName?: undefined;
144
145
  center?: undefined;
145
146
  leftLabel?: undefined;
147
+ checkLegible?: undefined;
146
148
  placeholderInitials?: undefined;
147
149
  menuOptions?: undefined;
148
150
  switchType?: undefined;
@@ -181,6 +183,7 @@ export declare const allFieldTypes: ({
181
183
  stateFieldName?: undefined;
182
184
  center?: undefined;
183
185
  leftLabel?: undefined;
186
+ checkLegible?: undefined;
184
187
  placeholderInitials?: undefined;
185
188
  menuOptions?: undefined;
186
189
  switchType?: undefined;
@@ -219,6 +222,7 @@ export declare const allFieldTypes: ({
219
222
  stateFieldName?: undefined;
220
223
  center?: undefined;
221
224
  leftLabel?: undefined;
225
+ checkLegible?: undefined;
222
226
  placeholderInitials?: undefined;
223
227
  menuOptions?: undefined;
224
228
  switchType?: undefined;
@@ -257,6 +261,7 @@ export declare const allFieldTypes: ({
257
261
  stateFieldName?: undefined;
258
262
  center?: undefined;
259
263
  leftLabel?: undefined;
264
+ checkLegible?: undefined;
260
265
  placeholderInitials?: undefined;
261
266
  menuOptions?: undefined;
262
267
  switchType?: undefined;
@@ -295,6 +300,7 @@ export declare const allFieldTypes: ({
295
300
  stateFieldName?: undefined;
296
301
  center?: undefined;
297
302
  leftLabel?: undefined;
303
+ checkLegible?: undefined;
298
304
  placeholderInitials?: undefined;
299
305
  menuOptions?: undefined;
300
306
  switchType?: undefined;
@@ -335,6 +341,7 @@ export declare const allFieldTypes: ({
335
341
  stateFieldName?: undefined;
336
342
  center?: undefined;
337
343
  leftLabel?: undefined;
344
+ checkLegible?: undefined;
338
345
  placeholderInitials?: undefined;
339
346
  menuOptions?: undefined;
340
347
  switchType?: undefined;
@@ -378,6 +385,7 @@ export declare const allFieldTypes: ({
378
385
  stateFieldName?: undefined;
379
386
  center?: undefined;
380
387
  leftLabel?: undefined;
388
+ checkLegible?: undefined;
381
389
  placeholderInitials?: undefined;
382
390
  menuOptions?: undefined;
383
391
  switchType?: undefined;
@@ -416,6 +424,7 @@ export declare const allFieldTypes: ({
416
424
  stateFieldName?: undefined;
417
425
  center?: undefined;
418
426
  leftLabel?: undefined;
427
+ checkLegible?: undefined;
419
428
  placeholderInitials?: undefined;
420
429
  menuOptions?: undefined;
421
430
  switchType?: undefined;
@@ -454,6 +463,7 @@ export declare const allFieldTypes: ({
454
463
  stateFieldName?: undefined;
455
464
  center?: undefined;
456
465
  leftLabel?: undefined;
466
+ checkLegible?: undefined;
457
467
  placeholderInitials?: undefined;
458
468
  menuOptions?: undefined;
459
469
  switchType?: undefined;
@@ -492,6 +502,7 @@ export declare const allFieldTypes: ({
492
502
  stateFieldName?: undefined;
493
503
  center?: undefined;
494
504
  leftLabel?: undefined;
505
+ checkLegible?: undefined;
495
506
  placeholderInitials?: undefined;
496
507
  menuOptions?: undefined;
497
508
  switchType?: undefined;
@@ -530,6 +541,7 @@ export declare const allFieldTypes: ({
530
541
  countyFieldName?: undefined;
531
542
  center?: undefined;
532
543
  leftLabel?: undefined;
544
+ checkLegible?: undefined;
533
545
  placeholderInitials?: undefined;
534
546
  menuOptions?: undefined;
535
547
  switchType?: undefined;
@@ -567,6 +579,7 @@ export declare const allFieldTypes: ({
567
579
  maxDateUnix?: undefined;
568
580
  countyFieldName?: undefined;
569
581
  stateFieldName?: undefined;
582
+ checkLegible?: undefined;
570
583
  placeholderInitials?: undefined;
571
584
  menuOptions?: undefined;
572
585
  switchType?: undefined;
@@ -605,6 +618,46 @@ export declare const allFieldTypes: ({
605
618
  stateFieldName?: undefined;
606
619
  center?: undefined;
607
620
  leftLabel?: undefined;
621
+ checkLegible?: undefined;
622
+ placeholderInitials?: undefined;
623
+ menuOptions?: undefined;
624
+ switchType?: undefined;
625
+ selectOptions?: undefined;
626
+ label?: undefined;
627
+ toggles?: undefined;
628
+ region?: undefined;
629
+ checkboxes?: undefined;
630
+ maskedRadios?: undefined;
631
+ };
632
+ initialValue?: undefined;
633
+ required?: undefined;
634
+ width?: undefined;
635
+ header?: undefined;
636
+ separator?: undefined;
637
+ subHeader?: undefined;
638
+ text?: undefined;
639
+ validationMessage?: undefined;
640
+ inlineFields?: undefined;
641
+ } | {
642
+ fieldLabel: string;
643
+ name: string;
644
+ type: FormFieldTypeEnum;
645
+ options: {
646
+ helperText: string;
647
+ checkLegible: boolean;
648
+ placeholder?: undefined;
649
+ disabled?: undefined;
650
+ showIcon?: undefined;
651
+ clearButton?: undefined;
652
+ showFlag?: undefined;
653
+ radios?: undefined;
654
+ characterLimit?: undefined;
655
+ initialValue?: undefined;
656
+ maxDateUnix?: undefined;
657
+ countyFieldName?: undefined;
658
+ stateFieldName?: undefined;
659
+ center?: undefined;
660
+ leftLabel?: undefined;
608
661
  placeholderInitials?: undefined;
609
662
  menuOptions?: undefined;
610
663
  switchType?: undefined;
@@ -645,6 +698,7 @@ export declare const allFieldTypes: ({
645
698
  stateFieldName?: undefined;
646
699
  center?: undefined;
647
700
  leftLabel?: undefined;
701
+ checkLegible?: undefined;
648
702
  menuOptions?: undefined;
649
703
  switchType?: undefined;
650
704
  selectOptions?: undefined;
@@ -684,6 +738,7 @@ export declare const allFieldTypes: ({
684
738
  stateFieldName?: undefined;
685
739
  center?: undefined;
686
740
  leftLabel?: undefined;
741
+ checkLegible?: undefined;
687
742
  placeholderInitials?: undefined;
688
743
  selectOptions?: undefined;
689
744
  label?: undefined;
@@ -731,6 +786,7 @@ export declare const allFieldTypes: ({
731
786
  stateFieldName?: undefined;
732
787
  center?: undefined;
733
788
  leftLabel?: undefined;
789
+ checkLegible?: undefined;
734
790
  placeholderInitials?: undefined;
735
791
  menuOptions?: undefined;
736
792
  switchType?: undefined;
@@ -770,6 +826,7 @@ export declare const allFieldTypes: ({
770
826
  stateFieldName?: undefined;
771
827
  center?: undefined;
772
828
  leftLabel?: undefined;
829
+ checkLegible?: undefined;
773
830
  placeholderInitials?: undefined;
774
831
  menuOptions?: undefined;
775
832
  switchType?: undefined;
@@ -821,6 +878,7 @@ export declare const allFieldTypes: ({
821
878
  stateFieldName?: undefined;
822
879
  center?: undefined;
823
880
  leftLabel?: undefined;
881
+ checkLegible?: undefined;
824
882
  placeholderInitials?: undefined;
825
883
  menuOptions?: undefined;
826
884
  switchType?: undefined;
@@ -857,6 +915,7 @@ export declare const allFieldTypes: ({
857
915
  stateFieldName?: undefined;
858
916
  center?: undefined;
859
917
  leftLabel?: undefined;
918
+ checkLegible?: undefined;
860
919
  placeholderInitials?: undefined;
861
920
  menuOptions?: undefined;
862
921
  switchType?: undefined;
@@ -924,6 +983,7 @@ export declare const allFieldTypes: ({
924
983
  countyFieldName?: undefined;
925
984
  stateFieldName?: undefined;
926
985
  center?: undefined;
986
+ checkLegible?: undefined;
927
987
  placeholderInitials?: undefined;
928
988
  menuOptions?: undefined;
929
989
  switchType?: undefined;
@@ -970,6 +1030,7 @@ export declare const allFieldTypes: ({
970
1030
  stateFieldName?: undefined;
971
1031
  center?: undefined;
972
1032
  leftLabel?: undefined;
1033
+ checkLegible?: undefined;
973
1034
  placeholderInitials?: undefined;
974
1035
  menuOptions?: undefined;
975
1036
  switchType?: undefined;
@@ -1030,6 +1091,7 @@ export declare const allFieldTypes: ({
1030
1091
  stateFieldName?: undefined;
1031
1092
  center?: undefined;
1032
1093
  leftLabel?: undefined;
1094
+ checkLegible?: undefined;
1033
1095
  placeholderInitials?: undefined;
1034
1096
  menuOptions?: undefined;
1035
1097
  switchType?: undefined;
@@ -151,7 +151,7 @@ export interface ValuesType {
151
151
  export interface ShowIfType {
152
152
  values: ValuesType;
153
153
  }
154
- type OptionTypes = AddressOptionsType | CheckboxOptionsType | CheckboxGroupOptionsType | CountySelectOptionsType | CountrySelectOptionsType | CreditCardOptionsType | CurrencyOptionsType | DatePickerOptionsType | DescriptiveDropdownInputOptionsType | EmailOptionsType | HiddenOptionsType | ImagePickerOptionsType | IconCheckboxesOptionsType | MultiSelectOptionsType | NumberOptionsType | PasswordOptionsType | PhoneOptionsType | RadioGroupOptionsType | SelectOptionsType | SocialSecurityOptionsType | StateSelectOptionsType | TextOptionsType | TextareaOptionsType | ToggleOptionsType | ToggleGroupOptionsType | ZipCodeOptionsType;
154
+ type OptionTypes = AddressOptionsType | CheckboxOptionsType | CheckboxGroupOptionsType | ColorPickerOptionsType | CountySelectOptionsType | CountrySelectOptionsType | CreditCardOptionsType | CurrencyOptionsType | DatePickerOptionsType | DescriptiveDropdownInputOptionsType | EmailOptionsType | HiddenOptionsType | ImagePickerOptionsType | IconCheckboxesOptionsType | MultiSelectOptionsType | NumberOptionsType | PasswordOptionsType | PhoneOptionsType | RadioGroupOptionsType | SelectOptionsType | SocialSecurityOptionsType | StateSelectOptionsType | TextOptionsType | TextareaOptionsType | ToggleOptionsType | ToggleGroupOptionsType | ZipCodeOptionsType;
155
155
  export interface AddButtonType {
156
156
  addFunction: () => void;
157
157
  color?: ButtonColorFamilyEnum;
@@ -193,6 +193,22 @@ export interface CheckboxGroupOptionsType {
193
193
  breakText?: boolean;
194
194
  onCheckboxClick?: (event: ChangeEvent<HTMLInputElement>) => void;
195
195
  }
196
+ export interface ColorPickerOptionsType {
197
+ checkLegible?: boolean;
198
+ helperText?: string | ReactElement;
199
+ innerRef?: RefObject<HTMLInputElement>;
200
+ instructionalText?: string;
201
+ legibleAgainst?: string;
202
+ onEnter?: () => void;
203
+ onInputBlur?: (event: FocusEvent<HTMLInputElement>) => void;
204
+ onInputFocus?: () => void;
205
+ onChange?: (event: {
206
+ target: {
207
+ value: string;
208
+ name?: string;
209
+ };
210
+ }) => void;
211
+ }
196
212
  export interface ConfigurableInputOptionsType {
197
213
  clearButton?: boolean;
198
214
  defaultId?: string;
@@ -600,6 +616,7 @@ export declare enum FormFieldTypeEnum {
600
616
  Address = "ADDRESS",
601
617
  Checkbox = "CHECKBOX",
602
618
  CheckboxGroup = "CHECKBOX_GROUP",
619
+ ColorPicker = "COLOR_PICKER",
603
620
  ConfigurableInput = "CONFIGURABLE_INPUT",
604
621
  CountySelect = "COUNTY_SELECT",
605
622
  CountrySelect = "COUNTRY_SELECT",
@@ -684,6 +701,23 @@ export interface CheckboxGroupFieldProps {
684
701
  submitAttempt: boolean;
685
702
  submitOnBlur?: boolean;
686
703
  }
704
+ export interface ColorPickerFieldType extends Omit<FormFieldType, "options"> {
705
+ options?: ColorPickerOptionsType;
706
+ }
707
+ export declare const isColorPicker: (field: FormFieldType) => field is ColorPickerFieldType;
708
+ export interface ColorPickerFieldProps {
709
+ fade?: boolean;
710
+ field: ColorPickerFieldType;
711
+ formikProps: any;
712
+ leftLabels?: boolean;
713
+ leftLabelWidth?: number;
714
+ leftLabelsRightGutter?: number;
715
+ rowGap?: number;
716
+ setHasValues: Dispatch<SetStateAction<boolean>>;
717
+ setSubmitAttempt: Dispatch<SetStateAction<boolean>>;
718
+ submitAttempt: boolean;
719
+ submitOnBlur?: boolean;
720
+ }
687
721
  export interface ConfigurableInputFieldType extends Omit<FormFieldType, "options"> {
688
722
  options: ConfigurableInputOptionsType;
689
723
  }
@@ -1082,7 +1116,7 @@ export interface InlineFieldType {
1082
1116
  validationFunction?: YupSchema;
1083
1117
  nextGap?: number;
1084
1118
  }
1085
- type SplitLineOptionTypes = AddressOptionsType | CheckboxOptionsType | CountySelectOptionsType | CountrySelectOptionsType | CreditCardOptionsType | CurrencyOptionsType | DatePickerOptionsType | DescriptiveDropdownInputOptionsType | EmailOptionsType | ImagePickerOptionsType | MultiSelectOptionsType | NumberOptionsType | PasswordOptionsType | PhoneOptionsType | SelectOptionsType | SocialSecurityOptionsType | StateSelectOptionsType | TextOptionsType | ToggleOptionsType | ZipCodeOptionsType;
1119
+ type SplitLineOptionTypes = AddressOptionsType | CheckboxOptionsType | ColorPickerOptionsType | CountySelectOptionsType | CountrySelectOptionsType | CreditCardOptionsType | CurrencyOptionsType | DatePickerOptionsType | DescriptiveDropdownInputOptionsType | EmailOptionsType | ImagePickerOptionsType | MultiSelectOptionsType | NumberOptionsType | PasswordOptionsType | PhoneOptionsType | SelectOptionsType | SocialSecurityOptionsType | StateSelectOptionsType | TextOptionsType | ToggleOptionsType | ZipCodeOptionsType;
1086
1120
  export declare const isSplitLine: (field: SingleOrMultipleFieldType) => field is SplitLineFieldType;
1087
1121
  export interface SplitLineFieldProps {
1088
1122
  fade?: boolean;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Validates that a color has sufficient contrast against a background color
3
+ * according to WCAG AA accessibility standards (4.5:1 ratio for normal text).
4
+ *
5
+ * @param color - The foreground color (hex format, e.g., "#ff0000")
6
+ * @param backgroundColor - The background color to check against (hex format, defaults to "#ffffff")
7
+ * @returns boolean - true if the contrast ratio is >= 4.5:1, false otherwise
8
+ */
9
+ export declare const validateColorContrast: (color: string, backgroundColor?: string) => boolean;
10
+ /**
11
+ * Validates that a color has sufficient contrast against a background color
12
+ * and returns an error message if validation fails.
13
+ *
14
+ * @param color - The foreground color (hex format, e.g., "#ff0000")
15
+ * @param backgroundColor - The background color to check against (hex format, defaults to "#ffffff")
16
+ * @param errorMessage - Custom error message (optional)
17
+ * @returns string | null - Error message if validation fails, null if valid
18
+ */
19
+ export declare const validateColorContrastWithMessage: (color: string, backgroundColor?: string, errorMessage?: string) => string | null;
@@ -9,6 +9,7 @@ export { CheckboxGroup } from "./components/CheckboxGroup";
9
9
  export { ClearableTag } from "./components/ClearableTag";
10
10
  export { ClickOutHandler } from "./components/ClickOutHandler";
11
11
  export { ColorButton } from "./components/ColorButton";
12
+ export { ColorPickerInput, InlineColorPickerInput } from "./components/ColorPickerInput";
12
13
  export { ColorPickerMenu } from "./components/ColorPickerMenu";
13
14
  export { ConfigurableInput } from "./components/ConfigurableInput";
14
15
  export { ConfirmModal } from "./components/ConfirmModal";
@@ -101,6 +102,7 @@ export { usStates } from "./const/usStates";
101
102
  export { addOrRemoveById, addOrRemoveString, getObjectById, makeIdString, removeById, removeByIdArray, removeString, replaceObjectById, setAllKeysToValue, setObjectById, toggleObjectById, } from "./helpers/arrays";
102
103
  export { getPosition } from "./helpers/position";
103
104
  export { pressedEnter, higherContrast } from "./helpers/accessibility";
105
+ export { validateColorContrast, validateColorContrastWithMessage } from "./helpers/colorValidators";
104
106
  export { northAmericanPhoneMask, colombianPhoneMask, brazilianPhoneMask, mexicanPhoneMask } from "./helpers/inputMasks";
105
107
  export { formatBytesToString, formatNumberToString } from "./helpers/numbers";
106
108
  export { northAmericanNumberingPlanRegex, validateRegex } from "./helpers/phoneValidators";
@@ -136,6 +138,7 @@ export type { CheckboxItemType } from "./components/CheckboxItem";
136
138
  export type { ClearableTagType } from "./components/ClearableTag";
137
139
  export type { ClickOutHandlerType } from "./components/ClickOutHandler";
138
140
  export type { ColorButtonType } from "./components/ColorButton";
141
+ export type { ColorPickerInputType, ColorPickerInputThemeOverride, ThemeOverride as InlineColorPickerInputThemeOverride, } from "./components/ColorPickerInput";
139
142
  export type { ColorPickerMenuType } from "./components/ColorPickerMenu";
140
143
  export type { ConfigurableInputType, MaskedRadioType } from "./components/ConfigurableInput";
141
144
  export type { ConfirmModalType } from "./components/ConfirmModal";
@@ -149,12 +152,13 @@ export type { DrawerDividerType } from "./components/Drawer/DrawerDivider";
149
152
  export type { EmailInputType } from "./components/EmailInput";
150
153
  export type { FiltersBarType } from "./components/FiltersBar";
151
154
  export type { FooterProps } from "./components/Footer";
152
- export type { AddressOptionsType, CheckboxOptionsType, CheckboxGroupOptionsType, CountySelectOptionsType, CreditCardOptionsType, CurrencyOptionsType, DatePickerOptionsType, EmailOptionsType, FormFieldType, FormReturnType, FormWrapperType, IconCheckboxesOptionsType, MultiSelectOptionsType, NationalitySelectOptionsType, NumberOptionsType, PasswordOptionsType, PhoneOptionsType, RadioGroupOptionsType, RemovableFieldType, SelectOptionType, SelectOptionsType, ShowIfType, SingleOrMultipleFieldType, SocialSecurityOptionsType, SplitLineFieldType, StateSelectOptionsType, TextOptionsType, TextareaOptionsType, ToggleOptionsType, ToggleGroupOptionsType, ZipCodeOptionsType, } from "./components/Form";
155
+ export type { AddressOptionsType, CheckboxOptionsType, CheckboxGroupOptionsType, ColorPickerOptionsType, CountySelectOptionsType, CreditCardOptionsType, CurrencyOptionsType, DatePickerOptionsType, EmailOptionsType, FormFieldType, FormReturnType, FormWrapperType, IconCheckboxesOptionsType, MultiSelectOptionsType, NationalitySelectOptionsType, NumberOptionsType, PasswordOptionsType, PhoneOptionsType, RadioGroupOptionsType, RemovableFieldType, SelectOptionType, SelectOptionsType, ShowIfType, SingleOrMultipleFieldType, SocialSecurityOptionsType, SplitLineFieldType, StateSelectOptionsType, TextOptionsType, TextareaOptionsType, ToggleOptionsType, ToggleGroupOptionsType, ZipCodeOptionsType, } from "./components/Form";
153
156
  export type { HorizontalTabMenuType } from "./components/HorizontalTabMenu";
154
157
  export type { IconButtonType } from "./components/IconButton";
155
158
  export type { IconProps, IconType } from "./components/Icons";
156
159
  export type { IconTileType } from "./components/IconTile";
157
160
  export type { ImagePickerType } from "./components/ImagePicker";
161
+ export type { InlineColorPickerInputType } from "./components/ColorPickerInput";
158
162
  export type { InlineEmailInputType } from "./components/InlineEmailInput";
159
163
  export type { InlineCreditCardInputType } from "./components/InlineCreditCardInput";
160
164
  export type { InlineCurrencyInputType } from "./components/InlineCurrencyInput";
@@ -53,6 +53,11 @@ interface ColorButtonTheme {
53
53
  focusColor: string;
54
54
  borderColor: string;
55
55
  }
56
+ interface ColorPickerInputTheme {
57
+ instructionalTextColor: string;
58
+ instructionalTextFontSize: number;
59
+ padding: number;
60
+ }
56
61
  interface ColorPickerTheme {
57
62
  borderColor: string;
58
63
  buttonSize: number;
@@ -584,6 +589,7 @@ interface CustomTheme {
584
589
  colorButton: ColorButtonTheme;
585
590
  colorFamilies: ColorFamilyTheme;
586
591
  colorPicker: ColorPickerTheme;
592
+ colorPickerInput: ColorPickerInputTheme;
587
593
  colorPickerMenu: ColorPickerMenuTheme;
588
594
  configurableInput: ConfigurableInputTheme;
589
595
  confirmModal: ConfirmModalTheme;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerebruminc/cerebellum",
3
- "version": "16.1.1",
3
+ "version": "16.2.0-beta.dangerous.cd6fba9",
4
4
  "description": "Cerebrum's React Component Library",
5
5
  "type": "module",
6
6
  "main": "lib/cjs/index.cjs",