Skip to content

Commit

Permalink
Docs: improve TextEdit examples
Browse files Browse the repository at this point in the history
  • Loading branch information
stsrki committed Oct 14, 2023
1 parent 325265f commit 7a5bd3f
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 15 deletions.
47 changes: 42 additions & 5 deletions Documentation/Blazorise.Docs/Models/Snippets.generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4073,7 +4073,24 @@ therefore re-calculated.

public const string TextEditDisabledExample = @"<TextEdit Disabled />";

public const string TextEditMaskExample = @"<TextEdit MaskType=""MaskType.RegEx"" EditMask=""^[a-zA-Z ]*$"" />";
public const string TextEditMaskExample = @"<Fields>
<Field ColumnSize=""ColumnSize.Is6.OnDesktop.Is12.OnMobile"">
<FieldLabel>
Text only
</FieldLabel>
<FieldBody>
<TextEdit MaskType=""MaskType.RegEx"" EditMask=""^[a-zA-Z ]*$"" />
</FieldBody>
</Field>
<Field ColumnSize=""ColumnSize.Is6.OnDesktop.Is12.OnMobile"">
<FieldLabel>
Numbers only
</FieldLabel>
<FieldBody>
<TextEdit MaskType=""MaskType.RegEx"" EditMask=""^(\d+(.\d{0,2})?|.?\d{1,2})$"" />
</FieldBody>
</Field>
</Fields>";

public const string TextEditPatternExample = @"<Validation UsePattern>
<TextEdit Pattern=""[A-Za-z]{3}"">
Expand All @@ -4089,11 +4106,31 @@ therefore re-calculated.

public const string TextEditReadonlyExample = @"<TextEdit ReadOnly />";

public const string TextEditRoleExample = @"<TextEdit Role=""TextRole.Email"" />
<TextEdit Role=""TextRole.Password"" />";
public const string TextEditRoleExample = @"<Fields>
<Field ColumnSize=""ColumnSize.Is6.OnDesktop.Is12.OnMobile"">
<FieldLabel>
Email
</FieldLabel>
<FieldBody>
<TextEdit Role=""TextRole.Email"" />
</FieldBody>
</Field>
<Field ColumnSize=""ColumnSize.Is6.OnDesktop.Is12.OnMobile"">
<FieldLabel>
Password
</FieldLabel>
<FieldBody>
<TextEdit Role=""TextRole.Password"" autocomplete=""new-password"" />
</FieldBody>
</Field>
</Fields>";

public const string TextEditSizingExample = @"<TextEdit Size=""Size.Small"" />
<TextEdit Size=""Size.Large"" />";
public const string TextEditSizingExample = @"<Field>
<TextEdit Size=""Size.Small"" />
</Field>
<Field>
<TextEdit Size=""Size.Large"" />
</Field>";

public const string TextEditTextChangedModeExample = @"public void ConfigureServices( IServiceCollection services )
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
<div class="blazorise-codeblock">
<div class="html"><pre>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">TextEdit</span> <span class="htmlAttributeName">MaskType</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="enum">MaskType</span><span class="enumValue">.RegEx</span><span class="quot">&quot;</span> <span class="htmlAttributeName">EditMask</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue">^[a-zA-Z ]*$</span><span class="quot">&quot;</span> <span class="htmlTagDelimiter">/&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">Fields</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">Field</span> <span class="htmlAttributeName">ColumnSize</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue">ColumnSize.Is6.OnDesktop.Is12.OnMobile</span><span class="quot">&quot;</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">FieldLabel</span><span class="htmlTagDelimiter">&gt;</span>
Text only
<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">FieldLabel</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">FieldBody</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">TextEdit</span> <span class="htmlAttributeName">MaskType</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="enum">MaskType</span><span class="enumValue">.RegEx</span><span class="quot">&quot;</span> <span class="htmlAttributeName">EditMask</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue">^[a-zA-Z ]*$</span><span class="quot">&quot;</span> <span class="htmlTagDelimiter">/&gt;</span>
<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">FieldBody</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">Field</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">Field</span> <span class="htmlAttributeName">ColumnSize</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue">ColumnSize.Is6.OnDesktop.Is12.OnMobile</span><span class="quot">&quot;</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">FieldLabel</span><span class="htmlTagDelimiter">&gt;</span>
Numbers only
<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">FieldLabel</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">FieldBody</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">TextEdit</span> <span class="htmlAttributeName">MaskType</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="enum">MaskType</span><span class="enumValue">.RegEx</span><span class="quot">&quot;</span> <span class="htmlAttributeName">EditMask</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue">^(\d+(.\d{0,2})?|.?\d{1,2})$</span><span class="quot">&quot;</span> <span class="htmlTagDelimiter">/&gt;</span>
<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">FieldBody</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">Field</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">Fields</span><span class="htmlTagDelimiter">&gt;</span>
</pre></div>
</div>
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
<div class="blazorise-codeblock">
<div class="html"><pre>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">TextEdit</span> <span class="htmlAttributeName">Role</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="enum">TextRole</span><span class="enumValue">.Email</span><span class="quot">&quot;</span> <span class="htmlTagDelimiter">/&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">TextEdit</span> <span class="htmlAttributeName">Role</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="enum">TextRole</span><span class="enumValue">.Password</span><span class="quot">&quot;</span> <span class="htmlTagDelimiter">/&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">Fields</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">Field</span> <span class="htmlAttributeName">ColumnSize</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue">ColumnSize.Is6.OnDesktop.Is12.OnMobile</span><span class="quot">&quot;</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">FieldLabel</span><span class="htmlTagDelimiter">&gt;</span>
Email
<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">FieldLabel</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">FieldBody</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">TextEdit</span> <span class="htmlAttributeName">Role</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="enum">TextRole</span><span class="enumValue">.Email</span><span class="quot">&quot;</span> <span class="htmlTagDelimiter">/&gt;</span>
<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">FieldBody</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">Field</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">Field</span> <span class="htmlAttributeName">ColumnSize</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue">ColumnSize.Is6.OnDesktop.Is12.OnMobile</span><span class="quot">&quot;</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">FieldLabel</span><span class="htmlTagDelimiter">&gt;</span>
Password
<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">FieldLabel</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">FieldBody</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">TextEdit</span> <span class="htmlAttributeName">Role</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="enum">TextRole</span><span class="enumValue">.Password</span><span class="quot">&quot;</span> <span class="htmlAttributeName">autocomplete</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue">new-password</span><span class="quot">&quot;</span> <span class="htmlTagDelimiter">/&gt;</span>
<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">FieldBody</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">Field</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">Fields</span><span class="htmlTagDelimiter">&gt;</span>
</pre></div>
</div>
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<div class="blazorise-codeblock">
<div class="html"><pre>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">TextEdit</span> <span class="htmlAttributeName">Size</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="enum">Size</span><span class="enumValue">.Small</span><span class="quot">&quot;</span> <span class="htmlTagDelimiter">/&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">TextEdit</span> <span class="htmlAttributeName">Size</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="enum">Size</span><span class="enumValue">.Large</span><span class="quot">&quot;</span> <span class="htmlTagDelimiter">/&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">Field</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">TextEdit</span> <span class="htmlAttributeName">Size</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="enum">Size</span><span class="enumValue">.Small</span><span class="quot">&quot;</span> <span class="htmlTagDelimiter">/&gt;</span>
<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">Field</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">Field</span><span class="htmlTagDelimiter">&gt;</span>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">TextEdit</span> <span class="htmlAttributeName">Size</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="enum">Size</span><span class="enumValue">.Large</span><span class="quot">&quot;</span> <span class="htmlTagDelimiter">/&gt;</span>
<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">Field</span><span class="htmlTagDelimiter">&gt;</span>
</pre></div>
</div>
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
@namespace Blazorise.Docs.Docs.Examples

<TextEdit MaskType="MaskType.RegEx" EditMask="^[a-zA-Z ]*$" />
<Fields>
<Field ColumnSize="ColumnSize.Is6.OnDesktop.Is12.OnMobile">
<FieldLabel>
Text only
</FieldLabel>
<FieldBody>
<TextEdit MaskType="MaskType.RegEx" EditMask="^[a-zA-Z ]*$" />
</FieldBody>
</Field>
<Field ColumnSize="ColumnSize.Is6.OnDesktop.Is12.OnMobile">
<FieldLabel>
Numbers only
</FieldLabel>
<FieldBody>
<TextEdit MaskType="MaskType.RegEx" EditMask="^(\d+(.\d{0,2})?|.?\d{1,2})$" />
</FieldBody>
</Field>
</Fields>
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
@namespace Blazorise.Docs.Docs.Examples

<TextEdit Role="TextRole.Email" />
<TextEdit Role="TextRole.Password" />
<Fields>
<Field ColumnSize="ColumnSize.Is6.OnDesktop.Is12.OnMobile">
<FieldLabel>
Email
</FieldLabel>
<FieldBody>
<TextEdit Role="TextRole.Email" />
</FieldBody>
</Field>
<Field ColumnSize="ColumnSize.Is6.OnDesktop.Is12.OnMobile">
<FieldLabel>
Password
</FieldLabel>
<FieldBody>
<TextEdit Role="TextRole.Password" autocomplete="new-password" />
</FieldBody>
</Field>
</Fields>
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
@namespace Blazorise.Docs.Docs.Examples

<TextEdit Size="Size.Small" />
<TextEdit Size="Size.Large" />
<Field>
<TextEdit Size="Size.Small" />
</Field>
<Field>
<TextEdit Size="Size.Large" />
</Field>
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,18 @@
</AlertDescription>
</Alert>

<DocsPageSubtitle>
Best Practices
</DocsPageSubtitle>

<Heading Size="HeadingSize.Is3">
Prevent autocomplete
</Heading>

<DocsPageParagraph>
When working with email and password fields, in some cases browsers might automatically autofill them with the values from user system. To prevent it you can define an <Code>autocomplete</Code> attribute, eg. <Code>autocomplete="new-password"</Code> on an input field.
</DocsPageParagraph>

<DocsPageSubtitle>
API
</DocsPageSubtitle>
Expand Down

0 comments on commit 7a5bd3f

Please sign in to comment.