Skip to content

Commit aa0d102

Browse files
update storybook patterns to be strings
1 parent 7638191 commit aa0d102

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

packages/dataviews/src/stories/dataform.story.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ const ValidationComponent = ( {
922922
required,
923923
elements: elements !== 'none' ? true : false,
924924
custom: maybeCustomRule( customTextRule ),
925-
pattern: pattern ? /^[a-zA-Z0-9_]+$/ : undefined,
925+
pattern: pattern ? '^[a-zA-Z0-9_]+$' : undefined,
926926
},
927927
},
928928
{
@@ -989,9 +989,7 @@ const ValidationComponent = ( {
989989
required,
990990
elements: elements !== 'none' ? true : false,
991991
custom: maybeCustomRule( customEmailRule ),
992-
pattern: pattern
993-
? /^[a-zA-Z0-9]+@company\.com$/
994-
: undefined,
992+
pattern: pattern ? '^[a-zA-Z0-9]+@company.com$' : undefined,
995993
},
996994
},
997995
{
@@ -1006,7 +1004,9 @@ const ValidationComponent = ( {
10061004
required,
10071005
elements: elements !== 'none' ? true : false,
10081006
custom: maybeCustomRule( customTelephoneRule ),
1009-
pattern: pattern ? /^\+1-\d{3}-\d{3}-\d{4}$/ : undefined,
1007+
pattern: pattern
1008+
? '^\\+1-\\d{3}-\\d{3}-\\d{4}$'
1009+
: undefined,
10101010
},
10111011
},
10121012
{
@@ -1023,7 +1023,9 @@ const ValidationComponent = ( {
10231023
required,
10241024
elements: elements !== 'none' ? true : false,
10251025
custom: maybeCustomRule( customUrlRule ),
1026-
pattern: pattern ? /^https:\/\/github\.com\/.*/ : undefined,
1026+
pattern: pattern
1027+
? '^https:\\/\\/github\\.com\\/.*'
1028+
: undefined,
10271029
},
10281030
},
10291031
{
@@ -1113,7 +1115,7 @@ const ValidationComponent = ( {
11131115
required,
11141116
elements: elements !== 'none' ? true : false,
11151117
custom: maybeCustomRule( customPasswordRule ),
1116-
pattern: pattern ? /^[0-9a-zA-Z]{8}$/ : undefined,
1118+
pattern: pattern ? '^[0-9a-zA-Z]{8}$' : undefined,
11171119
},
11181120
},
11191121
{

0 commit comments

Comments
 (0)