2020-06-02 06:24:46 +02:00
|
|
|
<svelte:options tag="lite-emoji-picker" />
|
2020-05-18 04:08:00 +02:00
|
|
|
<section
|
2020-06-03 06:50:52 +02:00
|
|
|
class="picker"
|
2020-05-18 04:08:00 +02:00
|
|
|
aria-label={i18n.regionLabel}
|
|
|
|
bind:this={rootElement}
|
|
|
|
>
|
2020-06-03 06:50:52 +02:00
|
|
|
<div class="search-row">
|
|
|
|
<div class="search-wrapper"
|
2020-06-02 17:42:33 +02:00
|
|
|
role="combobox"
|
2020-06-03 17:41:57 +02:00
|
|
|
aria-expanded={!!(searchMode && currentEmojis.length)}
|
2020-06-03 06:50:52 +02:00
|
|
|
aria-owns="search-results"
|
2020-06-02 17:42:33 +02:00
|
|
|
aria-haspopup="listbox"
|
|
|
|
aria-label={i18n.search}
|
|
|
|
>
|
2020-05-31 23:42:21 +02:00
|
|
|
<input
|
2020-06-03 06:50:52 +02:00
|
|
|
id="search"
|
|
|
|
class="search"
|
2020-05-31 23:42:21 +02:00
|
|
|
type="text"
|
|
|
|
placeholder={i18n.search}
|
|
|
|
autocapitalize="none"
|
|
|
|
spellcheck="true"
|
2020-06-03 06:50:52 +02:00
|
|
|
aria-controls="search-results"
|
2020-06-02 17:42:33 +02:00
|
|
|
aria-autocomplete="list"
|
2020-06-03 06:50:52 +02:00
|
|
|
aria-activedescendant={activeSearchItem === -1 ? '' : `emoji-${currentEmojis[activeSearchItem].unicode}`}
|
2020-05-31 23:42:21 +02:00
|
|
|
bind:value={rawSearchText}
|
2020-06-02 17:42:33 +02:00
|
|
|
on:keydown={onSearchKeydown}
|
2020-05-31 23:42:21 +02:00
|
|
|
>
|
2020-06-03 06:50:52 +02:00
|
|
|
<label class="sr-only" for="search">{i18n.search}</label>
|
2020-05-31 23:42:21 +02:00
|
|
|
</div>
|
2020-06-03 06:50:52 +02:00
|
|
|
<button class="emoji skintone-button" aria-label={i18n.skinToneLabel}>👍</button>
|
2020-05-31 23:42:21 +02:00
|
|
|
|
2020-05-18 04:08:00 +02:00
|
|
|
</div>
|
2020-06-03 06:50:52 +02:00
|
|
|
<div class="nav"
|
2020-06-01 04:25:38 +02:00
|
|
|
role="tablist"
|
|
|
|
style="grid-template-columns: repeat({categories.length}, 1fr);"
|
2020-06-04 03:42:27 +02:00
|
|
|
aria-label={i18n.categoriesLabel}
|
|
|
|
on:keydown={onNavKeydown}>
|
2020-05-18 04:08:00 +02:00
|
|
|
{#each categories as category (category.group)}
|
2020-06-01 04:25:38 +02:00
|
|
|
<button role="tab"
|
2020-06-03 06:50:52 +02:00
|
|
|
class="nav-button"
|
|
|
|
aria-controls="tab-{category.group}"
|
2020-06-01 04:25:38 +02:00
|
|
|
aria-label={i18n.categories[category.name]}
|
|
|
|
aria-selected={currentCategory.group === category.group}
|
|
|
|
title={i18n.categories[category.name]}
|
|
|
|
on:click={() => handleCategoryClick(category)}>
|
2020-06-03 06:50:52 +02:00
|
|
|
<div class="emoji">
|
2020-06-01 03:05:51 +02:00
|
|
|
{category.emoji}
|
|
|
|
</div>
|
2020-06-01 04:25:38 +02:00
|
|
|
</button>
|
|
|
|
{/each}
|
|
|
|
</div>
|
2020-06-03 06:50:52 +02:00
|
|
|
<div class="indicators"
|
2020-06-01 04:25:38 +02:00
|
|
|
aria-hidden="true">
|
|
|
|
{#each categories as category (category.group)}
|
2020-06-03 06:50:52 +02:00
|
|
|
<div class="indicator {currentCategory.group === category.group ? '' : 'hidden'}">
|
2020-06-01 04:58:07 +02:00
|
|
|
</div>
|
2020-05-18 04:08:00 +02:00
|
|
|
{/each}
|
|
|
|
</div>
|
2020-06-03 06:50:52 +02:00
|
|
|
<div class="tabpanel"
|
2020-06-03 17:41:57 +02:00
|
|
|
role={searchMode ? '' : 'tabpanel'}
|
|
|
|
aria-label={searchMode ? '' : i18n.categories[currentCategory.name]}
|
|
|
|
id={searchMode ? '' : `tab-${currentCategory.group}`}
|
|
|
|
tabindex="{searchMode ? '' : '0'}"
|
2020-06-02 17:42:33 +02:00
|
|
|
>
|
2020-06-03 06:50:52 +02:00
|
|
|
<div class="emoji-menu"
|
2020-06-03 17:41:57 +02:00
|
|
|
role={searchMode ? 'listbox' : 'menu'}
|
|
|
|
aria-label={searchMode ? i18n.searchResultsLabel : i18n.categories[currentCategory.name]}
|
|
|
|
id="search-results"
|
|
|
|
>
|
2020-06-02 17:42:33 +02:00
|
|
|
{#each currentEmojis as emoji, i (emoji.unicode)}
|
|
|
|
<button role={searchMode ? 'option' : 'menuitem'}
|
|
|
|
aria-selected={searchMode && i === activeSearchItem}
|
2020-06-03 06:50:52 +02:00
|
|
|
class="tabpanel-emoji emoji {searchMode && i === activeSearchItem ? 'active-search-item' : ''}"
|
|
|
|
id="emoji-{emoji.unicode}">
|
2020-06-01 04:58:07 +02:00
|
|
|
{emoji.unicode}
|
|
|
|
</button>
|
|
|
|
{/each}
|
2020-05-18 04:08:00 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-06-03 06:50:52 +02:00
|
|
|
<div aria-hidden="true" class="hidden abs-pos">
|
|
|
|
<button class="emoji baseline-emoji" bind:this={baselineEmoji}>😀</button>
|
2020-05-18 04:08:00 +02:00
|
|
|
</div>
|
|
|
|
</section>
|