@verifiedinc-public/shared-ui-elements 0.14.5-beta.4 → 0.14.5-beta.6

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,4 +1,5 @@
1
1
  import * as zod from 'zod';
2
2
  export declare const birthDateSchema: zod.ZodEffects<zod.ZodString, string, string>;
3
+ export declare const birthDateSchemaWithPastOnlyValidation: zod.ZodEffects<zod.ZodDate, Date, Date>;
3
4
  export declare const simpleBirthDateSchema: zod.ZodEffects<zod.ZodString, string, string>;
4
5
  export declare const shortenBirthDateSchema: zod.ZodEffects<zod.ZodString, string, string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verifiedinc-public/shared-ui-elements",
3
- "version": "0.14.5-beta.4",
3
+ "version": "0.14.5-beta.6",
4
4
  "description": "A set of UI components, utilities that is shareable with the core apps.",
5
5
  "private": false,
6
6
  "keywords": [],
@@ -1,4 +1,4 @@
1
- import { Autocomplete } from '@mui/material';
1
+ import { Autocomplete, AutocompleteProps } from '@mui/material';
2
2
  import { useState } from 'react';
3
3
  import {
4
4
  TextField,
@@ -21,6 +21,7 @@ interface SelectInputProps {
21
21
  value?: Option | null; // Controlled value
22
22
  defaultOption?: Option;
23
23
  InputProps?: TextFieldProps;
24
+ disableClearable?: boolean;
24
25
  }
25
26
 
26
27
  /**
@@ -33,6 +34,7 @@ export function SelectInput({
33
34
  value: controlledValue,
34
35
  onChange,
35
36
  onClear,
37
+ disableClearable,
36
38
  ...props
37
39
  }: SelectInputProps): React.JSX.Element {
38
40
  const [internalValue, setInternalValue] = useState<Option | null>(
@@ -74,6 +76,7 @@ export function SelectInput({
74
76
  autoHighlight
75
77
  defaultValue={defaultOption}
76
78
  options={options}
79
+ disableClearable={disableClearable}
77
80
  isOptionEqualToValue={(option, value) => option?.id === value?.id}
78
81
  value={value}
79
82
  onChange={(_event, newInputValue) => {
package/src/utils/ssn.ts CHANGED
@@ -4,5 +4,5 @@
4
4
  * @param {string} rawValue the raw value of the ssncredential
5
5
  * @returns {string} the formatted value
6
6
  */
7
- export const ssnFormatter = (rawValue: string) =>
7
+ export const ssnFormatter = (rawValue: string): string =>
8
8
  rawValue.replace(/(\d{3})-?(\d{2})-?(\d{4})/, '•••-••-$3');
@@ -32,6 +32,12 @@ export const birthDateSchema = zod.string().refine((value: string) => {
32
32
  return false;
33
33
  }, 'Date of Birth is invalid');
34
34
 
35
+ export const birthDateSchemaWithPastOnlyValidation = zod.z
36
+ .date()
37
+ .refine((date) => date.getTime() < Date.now(), {
38
+ message: 'Birthday must be in the past',
39
+ });
40
+
35
41
  export const simpleBirthDateSchema = zod.string().refine((value: string) => {
36
42
  const regex = /^\d{2}\d{2}\d{4}$/;
37
43
  if (regex.test(value)) {