Skip to content

Commit

Permalink
refactor: Renamed property
Browse files Browse the repository at this point in the history
  • Loading branch information
rkaraivanov committed Apr 23, 2024
1 parent 93e6952 commit 38a940c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 31 deletions.
12 changes: 6 additions & 6 deletions src/components/input/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,10 @@ export default class IgcInputComponent extends IgcInputBaseComponent {
* Consider whether to permit user input to exceed the `maxLength` when it is specified for a string type input,
* or to allow spin buttons to surpass the established `min`/`max` limits for a number type input.
*
* @attr soft-validate
* @attr validate-only
*/
@property({ type: Boolean, reflect: true, attribute: 'soft-validate' })
public softValidate = false;
@property({ type: Boolean, reflect: true, attribute: 'validate-only' })
public validateOnly = false;

/**
* @internal
Expand Down Expand Up @@ -345,10 +345,10 @@ export default class IgcInputComponent extends IgcInputBaseComponent {
tabindex=${this.tabIndex}
autocomplete=${ifDefined(this.autocomplete as any)}
inputmode=${ifDefined(this.inputmode)}
min=${ifDefined(this.softValidate ? undefined : this.min)}
max=${ifDefined(this.softValidate ? undefined : this.max)}
min=${ifDefined(this.validateOnly ? undefined : this.min)}
max=${ifDefined(this.validateOnly ? undefined : this.max)}
minlength=${ifDefined(this.minLength)}
maxlength=${ifDefined(this.softValidate ? undefined : this.maxLength)}
maxlength=${ifDefined(this.validateOnly ? undefined : this.maxLength)}
step=${ifDefined(this.step)}
aria-invalid=${this.invalid ? 'true' : 'false'}
@change=${this.handleChange}
Expand Down
8 changes: 4 additions & 4 deletions src/components/textarea/textarea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,10 @@ export default class IgcTextareaComponent extends FormAssociatedRequiredMixin(
/**
* Consider whether to permit user input to exceed the `maxLength` when it is specified.
*
* @attr soft-validate
* @attr validate-only
*/
@property({ type: Boolean, reflect: true, attribute: 'soft-validate' })
public softValidate = false;
@property({ type: Boolean, reflect: true, attribute: 'validate-only' })
public validateOnly = false;

constructor() {
super();
Expand Down Expand Up @@ -476,7 +476,7 @@ export default class IgcTextareaComponent extends FormAssociatedRequiredMixin(
inputmode=${ifDefined(this.inputMode)}
spellcheck=${ifDefined(this.spellcheck)}
minlength=${ifDefined(this.minLength)}
maxlength=${ifDefined(this.softValidate ? undefined : this.maxLength)}
maxlength=${ifDefined(this.validateOnly ? undefined : this.maxLength)}
?disabled=${this.disabled}
?required=${this.required}
?readonly=${this.readOnly}
Expand Down
24 changes: 12 additions & 12 deletions stories/input.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const metadata: Meta<IgcInputComponent> = {
description: 'The autocomplete attribute of the control.',
control: 'text',
},
softValidate: {
validateOnly: {
type: 'boolean',
description:
'Consider whether to permit user input to exceed the `maxLength` when it is specified for a string type input,\nor to allow spin buttons to surpass the established `min`/`max` limits for a number type input.',
Expand Down Expand Up @@ -159,7 +159,7 @@ const metadata: Meta<IgcInputComponent> = {
args: {
type: 'text',
autofocus: false,
softValidate: false,
validateOnly: false,
required: false,
disabled: false,
invalid: false,
Expand Down Expand Up @@ -205,7 +205,7 @@ interface IgcInputArgs {
* Consider whether to permit user input to exceed the `maxLength` when it is specified for a string type input,
* or to allow spin buttons to surpass the established `min`/`max` limits for a number type input.
*/
softValidate: boolean;
validateOnly: boolean;
/** Makes the control a required field in a form context. */
required: boolean;
/** The name attribute of the control. */
Expand Down Expand Up @@ -339,19 +339,19 @@ export const Form: Story = {
maxlength="3"
>
<p slot="helper-text">
With maximum length validator. Since soft validation is not applied,
With maximum length validator. Since validate-only is not applied,
typing in the input beyond the maximum length is not possible.
</p>
</igc-input>
<igc-input
name="input-maximum-soft"
label="Maximum length (3 characters) soft validation"
label="Maximum length (3 characters) validate-only"
maxlength="3"
soft-validate
>
<p slot="helper-text">
With maximum length validator and soft validation applied. Typing in
With maximum length validator and validate-only applied. Typing in
the input beyond the maximum length is possible and will invalidate
the input.
</p>
Expand All @@ -366,7 +366,7 @@ export const Form: Story = {
min="3"
>
<p slot="helper-text">
With minimum value validator. Since soft validation is not applied,
With minimum value validator. Since validate-only is not applied,
using the spin buttons to go below the minimum value is not
possible.
</p>
Expand All @@ -375,12 +375,12 @@ export const Form: Story = {
<igc-input
type="number"
name="input-min-soft"
label="Minimum number (3) soft validation"
label="Minimum number (3) validate-only"
min="3"
soft-validate
>
<p slot="helper-text">
With minimum value validator and soft validation applied. Using the
With minimum value validator and validate-only applied. Using the
spin buttons to go below the minimum value is possible and will
invalidate the input.
</p>
Expand All @@ -393,7 +393,7 @@ export const Form: Story = {
max="17"
>
<p slot="helper-text">
With maximum value validator. Since soft validation is not applied,
With maximum value validator. Since validate-only is not applied,
using the spin buttons to go above the maximum value is not
possible.
</p>
Expand All @@ -402,12 +402,12 @@ export const Form: Story = {
<igc-input
type="number"
name="input-max-soft"
label="Maximum number (17) soft validation"
label="Maximum number (17) validate-only"
max="17"
soft-validate
>
<p slot="helper-text">
With maximum value validator and soft validation applied. Using the
With maximum value validator and validate-only applied. Using the
spin buttons to go above the maximum value is possible and will
invalidate the input.
</p>
Expand Down
17 changes: 8 additions & 9 deletions stories/textarea.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const metadata: Meta<IgcTextareaComponent> = {
control: { type: 'inline-radio' },
table: { defaultValue: { summary: 'soft' } },
},
softValidate: {
validateOnly: {
type: 'boolean',
description:
'Consider whether to permit user input to exceed the `maxLength` when it is specified.',
Expand Down Expand Up @@ -169,7 +169,7 @@ const metadata: Meta<IgcTextareaComponent> = {
value: '',
spellcheck: true,
wrap: 'soft',
softValidate: false,
validateOnly: false,
required: false,
disabled: false,
invalid: false,
Expand Down Expand Up @@ -242,7 +242,7 @@ interface IgcTextareaArgs {
*/
wrap: 'hard' | 'soft' | 'off';
/** Consider whether to permit user input to exceed the `maxLength` when it is specified. */
softValidate: boolean;
validateOnly: boolean;
/** Makes the control a required field in a form context. */
required: boolean;
/** The name attribute of the control. */
Expand Down Expand Up @@ -374,21 +374,20 @@ export const Form: Story = {
maxlength="8"
>
<p slot="helper-text">
With maximum length validator. Since soft validation is not
applied, typing in the input beyond the maximum length is not
possible.
With maximum length validator. Since validate-only is not applied,
typing in the input beyond the maximum length is not possible.
</p>
</igc-textarea>
<igc-textarea
name="textarea-max-length-soft"
label="Maximum length (8) soft validation"
label="Maximum length (8) validate-only"
maxlength="8"
soft-validate
>
<p slot="helper-text">
With maximum length validator and soft validation applied. Typing
in the input beyond the maximum length is possible and will
With maximum length validator and validate-only applied. Typing in
the input beyond the maximum length is possible and will
invalidate the input.
</p>
</igc-textarea>
Expand Down

0 comments on commit 38a940c

Please sign in to comment.