2021-05-12 15:12:33 +00:00
|
|
|
<div class="field">
|
|
|
|
<div class="regex-label-wrapper">
|
|
|
|
<div class="regex-label">
|
2021-12-17 03:44:29 +00:00
|
|
|
<label for={{@attr.name}} class="is-label">
|
2021-05-12 15:12:33 +00:00
|
|
|
{{@labelString}}
|
|
|
|
{{#if @attr.options.helpText}}
|
2021-12-17 03:44:29 +00:00
|
|
|
<InfoTooltip>
|
2021-05-12 15:12:33 +00:00
|
|
|
<span data-test-help-text>
|
|
|
|
{{@attr.options.helpText}}
|
|
|
|
</span>
|
2021-12-17 03:44:29 +00:00
|
|
|
</InfoTooltip>
|
2021-05-12 15:12:33 +00:00
|
|
|
{{/if}}
|
|
|
|
</label>
|
|
|
|
{{#if @attr.options.subText}}
|
2021-12-17 03:44:29 +00:00
|
|
|
<p class="sub-text">
|
|
|
|
{{@attr.options.subText}}
|
|
|
|
{{#if @attr.options.docLink}}
|
|
|
|
<a href={{@attr.options.docLink}} target="_blank" rel="noopener noreferrer">
|
|
|
|
See our documentation
|
|
|
|
</a>
|
|
|
|
for help.
|
|
|
|
{{/if}}
|
|
|
|
</p>
|
2021-05-12 15:12:33 +00:00
|
|
|
{{/if}}
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<Toggle
|
|
|
|
@name={{concat @attr.name "-validation-toggle"}}
|
|
|
|
@status="success"
|
|
|
|
@size="small"
|
|
|
|
@checked={{this.showTestValue}}
|
|
|
|
@onChange={{this.toggleTestValue}}
|
2021-12-17 03:44:29 +00:00
|
|
|
>
|
2021-05-12 15:12:33 +00:00
|
|
|
<span class="has-text-grey">Validation</span>
|
|
|
|
</Toggle>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<input
|
|
|
|
id={{@attr.name}}
|
|
|
|
data-test-input={{@attr.name}}
|
|
|
|
autocomplete="off"
|
|
|
|
spellcheck="false"
|
2021-12-17 03:44:29 +00:00
|
|
|
{{on "change" @onChange}}
|
2021-05-12 15:12:33 +00:00
|
|
|
value={{@value}}
|
|
|
|
class="input"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
{{#if this.showTestValue}}
|
2021-12-17 03:44:29 +00:00
|
|
|
<div data-test-regex-validator-test-string>
|
|
|
|
<label for={{@attr.name}} class="is-label">
|
|
|
|
Test string
|
|
|
|
</label>
|
|
|
|
<input
|
|
|
|
data-test-input={{concat @attr.name "-testval"}}
|
|
|
|
id={{concat @attr.name "-testval"}}
|
|
|
|
autocomplete="off"
|
|
|
|
spellcheck="false"
|
|
|
|
value={{this.testValue}}
|
|
|
|
{{on "change" this.updateTestValue}}
|
|
|
|
class="input {{if this.regexError "has-error"}}"
|
|
|
|
/>
|
2021-05-12 15:12:33 +00:00
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
{{#if (and this.testValue @value)}}
|
|
|
|
<div data-test-regex-validation-message>
|
|
|
|
{{#if this.regexError}}
|
|
|
|
<AlertInline @type="danger" @message="Your regex doesn't match the subject string" />
|
|
|
|
{{else}}
|
|
|
|
<div class="message-inline">
|
|
|
|
<Icon @name="check-circle-fill" class="has-text-success" />
|
|
|
|
<p data-test-inline-success-message>Your regex matches the subject string</p>
|
|
|
|
</div>
|
|
|
|
{{/if}}
|
|
|
|
</div>
|
|
|
|
{{/if}}
|
|
|
|
</div>
|
|
|
|
{{/if}}
|