Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions packages/ui/src/components/CheckBoxWithLabel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@
position: relative;
margin-left: 16px;
color: var(--theme-caption-color);
&.onEdit {
margin: 2px 0px 1px 17px;
text-decoration: none;
}

.edit-item {
max-width: 100%;
Expand Down
76 changes: 76 additions & 0 deletions packages/ui/src/components/EditWithIcon.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<!--
// 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">
import type { IntlString, Asset } from '@anticrm/platform'
import type { AnySvelteComponent } from '../types'
import Icon from './Icon.svelte'

export let icon: Asset | AnySvelteComponent
export let width: string | undefined = undefined
export let value: string | undefined = undefined
export let placeholder: string = 'placeholder'
</script>

<div class="editbox" style={width ? 'width: ' + width : ''}>
<input type="text" bind:value {placeholder} />
<div class="icon">
{#if typeof (icon) === 'string'}
<Icon {icon} size={'small'} />
{:else}
<svelte:component this={icon} size={'small'} />
{/if}
</div>
</div>

<style lang="scss">
.editbox {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0;
min-width: 268px;
height: 40px;
background-color: var(--theme-bg-focused-color);
border: 1px solid var(--theme-bg-accent-color);
border-radius: 8px;

&:focus-within {
border-color: var(--theme-bg-focused-border);
}
input {
width: 100%;
height: 40px;
margin: 0;
padding: 10px 12px;
font-family: inherit;
color: var(--theme-caption-color);
background-color: transparent;
outline: none;
border: none;
border-radius: 8px;

&::placeholder {
color: var(--theme-content-trans-color);
}
}

.icon {
margin: 12px;
width: 16px;
height: 16px;
opacity: .3;
}
}
</style>
87 changes: 52 additions & 35 deletions packages/ui/src/components/StylishEdit.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,64 +13,81 @@
// limitations under the License.
-->
<script lang="ts">
import type { IntlString, Asset } from '@anticrm/platform'
import type { AnySvelteComponent } from '../types'
import Icon from './Icon.svelte'
import type { IntlString } from '@anticrm/platform'
import Label from './Label.svelte'

export let icon: Asset | AnySvelteComponent
export let label: IntlString | undefined = undefined
export let width: string | undefined = undefined
export let value: string | undefined = undefined
export let placeholder: string = 'placeholder'
export let error: string | undefined = undefined
export let password: boolean | undefined = undefined
export let id: string | undefined = undefined
</script>

<div class="editbox" style={width ? 'width: ' + width : ''}>
<input type="text" bind:value {placeholder} />
<div class="icon">
{#if typeof (icon) === 'string'}
<Icon {icon} size={'small'} />
{:else}
<svelte:component this={icon} size={'small'} />
{/if}
</div>
<div class="editbox{error ? ' error' : ''}" style={width ? 'width: ' + width : ''}>
{#if password}
<input type="password" class:nolabel={!label} {id} bind:value on:change on:keyup placeholder=" " />
{:else}
<input type="text" class:nolabel={!label} {id} bind:value on:change on:keyup placeholder=" " />
{/if}
{#if label}
<div class="label"><Label {label} /></div>
{/if}
</div>

<style lang="scss">
.editbox {
position: relative;
display: flex;
justify-content: space-between;
align-items: center;
flex-direction: column;
padding: 0;
min-width: 268px;
height: 40px;
background-color: var(--theme-bg-focused-color);
border: 1px solid var(--theme-bg-accent-color);
border-radius: 8px;

min-width: 50px;
height: 52px;
background-color: var(--theme-bg-accent-color);
border: 1px solid var(--theme-bg-accent-hover);
border-radius: 12px;
&:focus-within {
background-color: var(--theme-bg-focused-color);
border-color: var(--theme-bg-focused-border);
}
input {
width: 100%;
height: 40px;
height: 52px;
margin: 0;
padding: 10px 12px;
padding: 14px 20px 0px;
font-family: inherit;
color: var(--theme-caption-color);
background-color: transparent;
outline: none;
border: none;
border-radius: 8px;

&::placeholder {
color: var(--theme-content-trans-color);
}
border-radius: 12px;
font-size: 14px;
line-height: 17px;
}
.nolabel {
padding-top: 0;
}

.icon {
margin: 12px;
width: 16px;
height: 16px;
opacity: .3;
.label {
position: absolute;
top: 18px;
left: 20px;
font-size: 12px;
line-height: 14px;
color: var(--theme-caption-color);
pointer-events: none;
opacity: 0.3;
transition: top 200ms;
user-select: none;
}
input:focus + .label,
input:not(:placeholder-shown) + .label {
top: 10px;
}
}
.error {
border: 1px solid var(--system-error-60-color);
&:focus-within {
border-color: var(--system-error-color);
}
}
</style>
1 change: 1 addition & 0 deletions packages/ui/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export { default as DialogHeader } from './components/DialogHeader.svelte'
export { default as CheckBoxWithLabel } from './components/CheckBoxWithLabel.svelte'
export { default as CheckBoxList } from './components/CheckBoxList.svelte'
export { default as IconSize } from './components/IconSize.svelte'
export { default as EditWithIcon } from './components/EditWithIcon.svelte'

export { default as IconAdd } from './components/icons/Add.svelte'
export { default as IconSearch } from './components/icons/Search.svelte'
Expand Down
2 changes: 1 addition & 1 deletion rush.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
* LTS schedule: https://nodejs.org/en/about/releases/
* LTS versions: https://nodejs.org/en/download/releases/
*/
"nodeSupportedVersionRange": ">=12.13.0 <13.0.0 || >=14.15.0 <15.0.0",
"nodeSupportedVersionRange": ">=12.13.0 <13.0.0 || >=14.15.0 <15.0.0 || >=16.0.0",

/**
* Odd-numbered major versions of Node.js are experimental. Even-numbered releases
Expand Down