2021-08-04 23:31:54 +00:00
|
|
|
<!--
|
|
|
|
// Copyright © 2020 Anticrm Platform Contributors.
|
|
|
|
//
|
|
|
|
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License. You may
|
|
|
|
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
//
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
-->
|
|
|
|
<script lang="ts">
|
2021-08-06 06:49:54 +00:00
|
|
|
import type { IntlString } from '@anticrm/platform'
|
|
|
|
import Label from './Label.svelte'
|
2021-08-04 23:31:54 +00:00
|
|
|
|
2021-08-06 06:49:54 +00:00
|
|
|
export let label: IntlString | undefined = undefined
|
2021-08-04 23:31:54 +00:00
|
|
|
export let width: string | undefined = undefined
|
|
|
|
export let value: string | undefined = undefined
|
2021-08-06 06:49:54 +00:00
|
|
|
export let error: string | undefined = undefined
|
|
|
|
export let password: boolean | undefined = undefined
|
|
|
|
export let id: string | undefined = undefined
|
2021-08-04 23:31:54 +00:00
|
|
|
</script>
|
|
|
|
|
2021-08-06 06:49:54 +00:00
|
|
|
<div class="editbox{error ? ' error' : ''}" style={width ? 'width: ' + width : ''}>
|
|
|
|
{#if password}
|
2021-08-17 14:46:06 +00:00
|
|
|
<input type="password" class:nolabel={!label} {id} bind:value on:change on:keyup autocomplete="off" placeholder=" " />
|
2021-08-06 06:49:54 +00:00
|
|
|
{:else}
|
2021-08-17 14:46:06 +00:00
|
|
|
<input type="text" class:nolabel={!label} {id} bind:value on:change on:keyup autocomplete="off" placeholder=" " />
|
2021-08-06 06:49:54 +00:00
|
|
|
{/if}
|
|
|
|
{#if label}
|
|
|
|
<div class="label"><Label {label} /></div>
|
|
|
|
{/if}
|
2021-08-04 23:31:54 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.editbox {
|
2021-08-06 06:49:54 +00:00
|
|
|
position: relative;
|
2021-08-04 23:31:54 +00:00
|
|
|
display: flex;
|
2021-08-06 06:49:54 +00:00
|
|
|
flex-direction: column;
|
2021-08-04 23:31:54 +00:00
|
|
|
padding: 0;
|
2021-08-17 14:46:06 +00:00
|
|
|
min-width: 3rem;
|
|
|
|
height: 3.25rem;
|
2021-08-06 06:49:54 +00:00
|
|
|
background-color: var(--theme-bg-accent-color);
|
|
|
|
border: 1px solid var(--theme-bg-accent-hover);
|
2021-08-17 14:46:06 +00:00
|
|
|
border-radius: .75rem;
|
2021-08-04 23:31:54 +00:00
|
|
|
&:focus-within {
|
2021-08-06 06:49:54 +00:00
|
|
|
background-color: var(--theme-bg-focused-color);
|
2021-08-04 23:31:54 +00:00
|
|
|
border-color: var(--theme-bg-focused-border);
|
|
|
|
}
|
|
|
|
input {
|
2021-08-17 14:46:06 +00:00
|
|
|
height: 3.25rem;
|
2021-08-04 23:31:54 +00:00
|
|
|
margin: 0;
|
2021-08-17 14:46:06 +00:00
|
|
|
padding: .875rem 1.25rem 0px;
|
2021-08-04 23:31:54 +00:00
|
|
|
background-color: transparent;
|
|
|
|
border: none;
|
2021-08-17 14:46:06 +00:00
|
|
|
border-radius: .75rem;
|
2021-08-06 06:49:54 +00:00
|
|
|
}
|
|
|
|
.nolabel {
|
|
|
|
padding-top: 0;
|
2021-08-04 23:31:54 +00:00
|
|
|
}
|
|
|
|
|
2021-08-06 06:49:54 +00:00
|
|
|
.label {
|
|
|
|
position: absolute;
|
2021-08-17 14:46:06 +00:00
|
|
|
top: 1rem;
|
|
|
|
left: 1.25rem;
|
|
|
|
font-size: .75rem;
|
2021-08-06 06:49:54 +00:00
|
|
|
color: var(--theme-caption-color);
|
2021-08-17 14:46:06 +00:00
|
|
|
opacity: .3;
|
2021-08-06 06:49:54 +00:00
|
|
|
transition: top 200ms;
|
2021-08-17 14:46:06 +00:00
|
|
|
pointer-events: none;
|
2021-08-06 06:49:54 +00:00
|
|
|
user-select: none;
|
|
|
|
}
|
|
|
|
input:focus + .label,
|
|
|
|
input:not(:placeholder-shown) + .label {
|
2021-08-17 14:46:06 +00:00
|
|
|
top: .5rem;
|
2021-08-06 06:49:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
.error {
|
|
|
|
border: 1px solid var(--system-error-60-color);
|
|
|
|
&:focus-within {
|
|
|
|
border-color: var(--system-error-color);
|
2021-08-04 23:31:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|