Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9a87888f5a | |||
| d61c3b6643 | |||
| c8554418de | |||
| c1a8a57729 | |||
| 053d0c8e8f | |||
| 55e8e192c9 | |||
| 286f6fd120 | |||
| 1401cd2c92 | |||
| 2323d1a01c |
27
changelog.md
27
changelog.md
@@ -1,5 +1,32 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-12-18 - 1.6.0 - feat(conversation-selector)
|
||||||
|
add conversation status badges to conversation selector and include status in sample data
|
||||||
|
|
||||||
|
- Introduce TConversationStatus type and add optional status property to IConversation
|
||||||
|
- Render status badges in sio-conversation-selector with CSS classes and a getBadgeLabel helper
|
||||||
|
- Update sample conversations in sio-combox.ts to include statuses: 'new', 'needs-action', 'waiting', 'resolved'
|
||||||
|
|
||||||
|
## 2025-12-17 - 1.5.0 - feat(combox)
|
||||||
|
Introduce singleton SioCombox attached to document.body with open/close/toggle API and animated show/hide; integrate SioFab to use the singleton and update styles/positioning
|
||||||
|
|
||||||
|
- Add SioCombox.createOnBody() and SioCombox.getInstance() singletons
|
||||||
|
- Add isOpen state, open(), close(), toggle(), getIsOpen() and emit opened/closed/close events
|
||||||
|
- Move combox out of the FAB shadow DOM — attach to body and position fixed bottom-right with z-index and enter/exit transitions
|
||||||
|
- Update mobile layout to full-screen sizing and adjust transform origin for phablet
|
||||||
|
- Update SioFab to create the singleton on firstUpdated(), listen for close events, and toggle the singleton instead of rendering it inside the FAB
|
||||||
|
- Remove previous in-FAB combox container markup/CSS and hasShownOnce logic
|
||||||
|
- Minor visual/UX improvements: scale/opacity transitions, pointer-events control, and positioning variables for consistent behavior
|
||||||
|
|
||||||
|
## 2025-12-17 - 1.4.1 - fix(ui)
|
||||||
|
handle on-screen keyboard visibility to adjust layout and prevent inputs from being obscured
|
||||||
|
|
||||||
|
- Add keyboard visibility state (isKeyboardVisible) and keyboardBlurTimeout in sio-combox.ts
|
||||||
|
- Listen for custom 'input-focus' and 'input-blur' events and toggle keyboard-visible host attribute
|
||||||
|
- Dispatch 'input-focus'/'input-blur' from sio-conversation-selector and sio-message-input on focus/blur
|
||||||
|
- Add connected/disconnected lifecycle handlers and updated() hook to manage attribute and cleanup timeouts
|
||||||
|
- Apply :host([keyboard-visible]) CSS to set height to 100vh / 100dvh when keyboard is visible
|
||||||
|
|
||||||
## 2025-12-17 - 1.4.0 - feat(elements)
|
## 2025-12-17 - 1.4.0 - feat(elements)
|
||||||
update design tokens and sio-fab component; bump deps and update npmextra config
|
update design tokens and sio-fab component; bump deps and update npmextra config
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@social.io/catalog",
|
"name": "@social.io/catalog",
|
||||||
"version": "1.4.0",
|
"version": "1.6.0",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "catalog for social.io",
|
"description": "catalog for social.io",
|
||||||
"main": "dist_ts_web/index.js",
|
"main": "dist_ts_web/index.js",
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@social.io/catalog',
|
name: '@social.io/catalog',
|
||||||
version: '1.4.0',
|
version: '1.6.0',
|
||||||
description: 'catalog for social.io'
|
description: 'catalog for social.io'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,12 +36,41 @@ declare global {
|
|||||||
export class SioCombox extends DeesElement {
|
export class SioCombox extends DeesElement {
|
||||||
public static demo = () => html` <sio-combox></sio-combox> `;
|
public static demo = () => html` <sio-combox></sio-combox> `;
|
||||||
|
|
||||||
|
// Singleton instance
|
||||||
|
private static instance: SioCombox | null = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates and appends a singleton combox to document.body
|
||||||
|
*/
|
||||||
|
public static createOnBody(): SioCombox {
|
||||||
|
if (!SioCombox.instance) {
|
||||||
|
SioCombox.instance = new SioCombox();
|
||||||
|
document.body.appendChild(SioCombox.instance);
|
||||||
|
}
|
||||||
|
return SioCombox.instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the singleton instance if it exists
|
||||||
|
*/
|
||||||
|
public static getInstance(): SioCombox | null {
|
||||||
|
return SioCombox.instance;
|
||||||
|
}
|
||||||
|
|
||||||
@property({ type: Object })
|
@property({ type: Object })
|
||||||
public accessor referenceObject: HTMLElement;
|
public accessor referenceObject: HTMLElement;
|
||||||
|
|
||||||
@state()
|
@state()
|
||||||
private accessor selectedConversationId: string | null = null;
|
private accessor selectedConversationId: string | null = null;
|
||||||
|
|
||||||
|
@state()
|
||||||
|
private accessor isKeyboardVisible: boolean = false;
|
||||||
|
|
||||||
|
@state()
|
||||||
|
private accessor isOpen: boolean = false;
|
||||||
|
|
||||||
|
private keyboardBlurTimeout?: number;
|
||||||
|
|
||||||
@state()
|
@state()
|
||||||
private accessor conversations: IConversation[] = [
|
private accessor conversations: IConversation[] = [
|
||||||
{
|
{
|
||||||
@@ -50,24 +79,28 @@ export class SioCombox extends DeesElement {
|
|||||||
lastMessage: 'Thanks for your help with the login issue!',
|
lastMessage: 'Thanks for your help with the login issue!',
|
||||||
time: '2 min ago',
|
time: '2 min ago',
|
||||||
unread: true,
|
unread: true,
|
||||||
|
status: 'new',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '2',
|
id: '2',
|
||||||
title: 'Billing Question',
|
title: 'Billing Question',
|
||||||
lastMessage: 'I need help understanding my invoice',
|
lastMessage: 'I need help understanding my invoice',
|
||||||
time: '1 hour ago',
|
time: '1 hour ago',
|
||||||
|
status: 'needs-action',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '3',
|
id: '3',
|
||||||
title: 'Feature Request',
|
title: 'Feature Request',
|
||||||
lastMessage: 'That would be great! Looking forward to it',
|
lastMessage: 'That would be great! Looking forward to it',
|
||||||
time: 'Yesterday',
|
time: 'Yesterday',
|
||||||
|
status: 'waiting',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: '4',
|
id: '4',
|
||||||
title: 'General Inquiry',
|
title: 'General Inquiry',
|
||||||
lastMessage: 'Thank you for the information',
|
lastMessage: 'Thank you for the information',
|
||||||
time: '2 days ago',
|
time: '2 days ago',
|
||||||
|
status: 'resolved',
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -127,11 +160,100 @@ export class SioCombox extends DeesElement {
|
|||||||
domtools.DomTools.setupDomTools();
|
domtools.DomTools.setupDomTools();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async connectedCallback() {
|
||||||
|
await super.connectedCallback();
|
||||||
|
this.addEventListener('input-focus', this.handleInputFocus as EventListener);
|
||||||
|
this.addEventListener('input-blur', this.handleInputBlur as EventListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
async disconnectedCallback() {
|
||||||
|
await super.disconnectedCallback();
|
||||||
|
this.removeEventListener('input-focus', this.handleInputFocus as EventListener);
|
||||||
|
this.removeEventListener('input-blur', this.handleInputBlur as EventListener);
|
||||||
|
if (this.keyboardBlurTimeout) {
|
||||||
|
clearTimeout(this.keyboardBlurTimeout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private handleInputFocus = () => {
|
||||||
|
if (this.keyboardBlurTimeout) {
|
||||||
|
clearTimeout(this.keyboardBlurTimeout);
|
||||||
|
this.keyboardBlurTimeout = undefined;
|
||||||
|
}
|
||||||
|
this.isKeyboardVisible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private handleInputBlur = () => {
|
||||||
|
if (this.keyboardBlurTimeout) {
|
||||||
|
clearTimeout(this.keyboardBlurTimeout);
|
||||||
|
}
|
||||||
|
this.keyboardBlurTimeout = window.setTimeout(() => {
|
||||||
|
this.isKeyboardVisible = false;
|
||||||
|
this.keyboardBlurTimeout = undefined;
|
||||||
|
}, 150);
|
||||||
|
}
|
||||||
|
|
||||||
|
updated(changedProperties: Map<string, any>) {
|
||||||
|
super.updated(changedProperties);
|
||||||
|
if (changedProperties.has('isKeyboardVisible')) {
|
||||||
|
if (this.isKeyboardVisible) {
|
||||||
|
this.setAttribute('keyboard-visible', '');
|
||||||
|
} else {
|
||||||
|
this.removeAttribute('keyboard-visible');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (changedProperties.has('isOpen')) {
|
||||||
|
if (this.isOpen) {
|
||||||
|
this.classList.add('open');
|
||||||
|
this.dispatchEvent(new CustomEvent('opened', { bubbles: true, composed: true }));
|
||||||
|
} else {
|
||||||
|
this.classList.remove('open');
|
||||||
|
this.dispatchEvent(new CustomEvent('closed', { bubbles: true, composed: true }));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens the combox
|
||||||
|
*/
|
||||||
|
public open() {
|
||||||
|
this.isOpen = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes the combox
|
||||||
|
*/
|
||||||
|
public close() {
|
||||||
|
this.isOpen = false;
|
||||||
|
this.dispatchEvent(new CustomEvent('close', { bubbles: true, composed: true }));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggles the combox open/closed state
|
||||||
|
*/
|
||||||
|
public toggle() {
|
||||||
|
if (this.isOpen) {
|
||||||
|
this.close();
|
||||||
|
} else {
|
||||||
|
this.open();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the combox is currently open
|
||||||
|
*/
|
||||||
|
public getIsOpen(): boolean {
|
||||||
|
return this.isOpen;
|
||||||
|
}
|
||||||
|
|
||||||
public static styles = [
|
public static styles = [
|
||||||
cssManager.defaultStyles,
|
cssManager.defaultStyles,
|
||||||
css`
|
css`
|
||||||
:host {
|
:host {
|
||||||
display: block;
|
display: block;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 100px;
|
||||||
|
right: 20px;
|
||||||
height: 600px;
|
height: 600px;
|
||||||
width: 800px;
|
width: 800px;
|
||||||
background: ${bdTheme('background')};
|
background: ${bdTheme('background')};
|
||||||
@@ -140,23 +262,20 @@ export class SioCombox extends DeesElement {
|
|||||||
box-shadow: ${unsafeCSS(shadows.xl)};
|
box-shadow: ${unsafeCSS(shadows.xl)};
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
font-family: ${unsafeCSS(fontFamilies.sans)};
|
font-family: ${unsafeCSS(fontFamilies.sans)};
|
||||||
position: relative;
|
|
||||||
transform-origin: bottom right;
|
transform-origin: bottom right;
|
||||||
|
z-index: 10001;
|
||||||
|
|
||||||
|
/* Hidden by default */
|
||||||
|
opacity: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
transform: scale(0.95) translateY(10px);
|
||||||
|
transition: opacity 200ms ease, transform 200ms ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
:host(.animate-in) {
|
:host(.open) {
|
||||||
animation: scaleIn 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
|
opacity: 1;
|
||||||
}
|
pointer-events: all;
|
||||||
|
transform: scale(1) translateY(0);
|
||||||
@keyframes scaleIn {
|
|
||||||
from {
|
|
||||||
opacity: 0;
|
|
||||||
transform: scale(0.9) translateY(10px);
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
opacity: 1;
|
|
||||||
transform: scale(1) translateY(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:host::before {
|
:host::before {
|
||||||
@@ -181,65 +300,84 @@ export class SioCombox extends DeesElement {
|
|||||||
border-radius: ${unsafeCSS(radius['2xl'])};
|
border-radius: ${unsafeCSS(radius['2xl'])};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Responsive layout */
|
/* Desktop layout (default) */
|
||||||
@media (max-width: 600px) {
|
sio-conversation-selector {
|
||||||
:host {
|
width: 320px;
|
||||||
width: 100%;
|
flex-shrink: 0;
|
||||||
height: 100%;
|
|
||||||
border-radius: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
sio-conversation-selector {
|
|
||||||
position: absolute;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
transition: left 300ms ease, opacity 200ms ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
sio-conversation-view {
|
|
||||||
position: absolute;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
transition: left 300ms ease, opacity 200ms ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Mobile navigation states */
|
|
||||||
.container.show-list sio-conversation-selector {
|
|
||||||
left: 0;
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container.show-list sio-conversation-view {
|
|
||||||
left: 100%;
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container.show-conversation sio-conversation-selector {
|
|
||||||
left: -100%;
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container.show-conversation sio-conversation-view {
|
|
||||||
left: 0;
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 601px) {
|
sio-conversation-view {
|
||||||
sio-conversation-selector {
|
flex: 1;
|
||||||
width: 320px;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
sio-conversation-view {
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
|
// Mobile responsive layout - full screen with sliding mechanics
|
||||||
|
cssManager.cssForPhablet(css`
|
||||||
|
:host {
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
height: 100dvh;
|
||||||
|
border-radius: 0;
|
||||||
|
transform-origin: center center;
|
||||||
|
}
|
||||||
|
|
||||||
|
:host(.open) {
|
||||||
|
transform: scale(1) translateY(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
:host::before {
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
sio-conversation-selector {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
transition: left 300ms ease, opacity 200ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
sio-conversation-view {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
transition: left 300ms ease, opacity 200ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Mobile navigation states */
|
||||||
|
.container.show-list sio-conversation-selector {
|
||||||
|
left: 0;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container.show-list sio-conversation-view {
|
||||||
|
left: 100%;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container.show-conversation sio-conversation-selector {
|
||||||
|
left: -100%;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container.show-conversation sio-conversation-view {
|
||||||
|
left: 0;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Keyboard visible adjustments */
|
||||||
|
:host([keyboard-visible]) {
|
||||||
|
height: 100vh;
|
||||||
|
height: 100dvh;
|
||||||
|
}
|
||||||
|
`),
|
||||||
];
|
];
|
||||||
|
|
||||||
public render(): TemplateResult {
|
public render(): TemplateResult {
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ import { spacing, radius, shadows, transitions } from './00tokens.js';
|
|||||||
import { fontFamilies, typography } from './00fonts.js';
|
import { fontFamilies, typography } from './00fonts.js';
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
|
export type TConversationStatus = 'new' | 'waiting' | 'needs-action' | 'resolved';
|
||||||
|
|
||||||
export interface IConversation {
|
export interface IConversation {
|
||||||
id: string;
|
id: string;
|
||||||
title: string;
|
title: string;
|
||||||
@@ -23,6 +25,7 @@ export interface IConversation {
|
|||||||
time: string;
|
time: string;
|
||||||
unread?: boolean;
|
unread?: boolean;
|
||||||
avatar?: string;
|
avatar?: string;
|
||||||
|
status?: TConversationStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
@@ -232,6 +235,38 @@ export class SioConversationSelector extends DeesElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.badge {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 2px ${unsafeCSS(spacing["2"])};
|
||||||
|
font-size: 0.625rem;
|
||||||
|
font-weight: 600;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.025em;
|
||||||
|
border-radius: ${unsafeCSS(radius.full)};
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge.new {
|
||||||
|
background: ${bdTheme('primary')}20;
|
||||||
|
color: ${bdTheme('primary')};
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge.waiting {
|
||||||
|
background: ${bdTheme('muted')};
|
||||||
|
color: ${bdTheme('mutedForeground')};
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge.needs-action {
|
||||||
|
background: hsl(38 92% 50% / 0.15);
|
||||||
|
color: hsl(38 92% 40%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge.resolved {
|
||||||
|
background: ${bdTheme('success')}20;
|
||||||
|
color: ${bdTheme('success')};
|
||||||
|
}
|
||||||
|
|
||||||
.empty-state {
|
.empty-state {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -266,7 +301,17 @@ export class SioConversationSelector extends DeesElement {
|
|||||||
.conversation-list::-webkit-scrollbar-thumb:hover {
|
.conversation-list::-webkit-scrollbar-thumb:hover {
|
||||||
background: ${bdTheme('mutedForeground')};
|
background: ${bdTheme('mutedForeground')};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.close-button {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
`,
|
`,
|
||||||
|
// Mobile: show close button
|
||||||
|
cssManager.cssForPhablet(css`
|
||||||
|
.close-button {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
`),
|
||||||
];
|
];
|
||||||
|
|
||||||
public render(): TemplateResult {
|
public render(): TemplateResult {
|
||||||
@@ -278,6 +323,14 @@ export class SioConversationSelector extends DeesElement {
|
|||||||
return html`
|
return html`
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="header-top">
|
<div class="header-top">
|
||||||
|
<sio-button
|
||||||
|
class="close-button"
|
||||||
|
type="ghost"
|
||||||
|
size="sm"
|
||||||
|
@click=${() => this.handleClose()}
|
||||||
|
>
|
||||||
|
<sio-icon icon="x" size="20"></sio-icon>
|
||||||
|
</sio-button>
|
||||||
<h2 class="title">Messages</h2>
|
<h2 class="title">Messages</h2>
|
||||||
<sio-button
|
<sio-button
|
||||||
type="primary"
|
type="primary"
|
||||||
@@ -295,6 +348,8 @@ export class SioConversationSelector extends DeesElement {
|
|||||||
placeholder="Search conversations..."
|
placeholder="Search conversations..."
|
||||||
.value=${this.searchQuery}
|
.value=${this.searchQuery}
|
||||||
@input=${(e: Event) => this.searchQuery = (e.target as HTMLInputElement).value}
|
@input=${(e: Event) => this.searchQuery = (e.target as HTMLInputElement).value}
|
||||||
|
@focus=${this.handleInputFocus}
|
||||||
|
@blur=${this.handleInputBlur}
|
||||||
/>
|
/>
|
||||||
<sio-icon class="search-icon" icon="search" size="16"></sio-icon>
|
<sio-icon class="search-icon" icon="search" size="16"></sio-icon>
|
||||||
</div>
|
</div>
|
||||||
@@ -311,6 +366,7 @@ export class SioConversationSelector extends DeesElement {
|
|||||||
<span class="conversation-title">
|
<span class="conversation-title">
|
||||||
${conv.title}
|
${conv.title}
|
||||||
${conv.unread ? html`<span class="unread-dot"></span>` : ''}
|
${conv.unread ? html`<span class="unread-dot"></span>` : ''}
|
||||||
|
${conv.status ? html`<span class="badge ${conv.status}">${this.getBadgeLabel(conv.status)}</span>` : ''}
|
||||||
</span>
|
</span>
|
||||||
<span class="conversation-time">${conv.time}</span>
|
<span class="conversation-time">${conv.time}</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -346,4 +402,37 @@ export class SioConversationSelector extends DeesElement {
|
|||||||
composed: true
|
composed: true
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private handleClose() {
|
||||||
|
this.dispatchEvent(new CustomEvent('close', {
|
||||||
|
bubbles: true,
|
||||||
|
composed: true
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
private handleInputFocus() {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.dispatchEvent(new CustomEvent('input-focus', {
|
||||||
|
bubbles: true,
|
||||||
|
composed: true
|
||||||
|
}));
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
private handleInputBlur() {
|
||||||
|
this.dispatchEvent(new CustomEvent('input-blur', {
|
||||||
|
bubbles: true,
|
||||||
|
composed: true
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
private getBadgeLabel(status: TConversationStatus): string {
|
||||||
|
const labels: Record<TConversationStatus, string> = {
|
||||||
|
'new': 'New',
|
||||||
|
'waiting': 'Waiting',
|
||||||
|
'needs-action': 'Action',
|
||||||
|
'resolved': 'Resolved',
|
||||||
|
};
|
||||||
|
return labels[status];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -160,27 +160,6 @@ export class SioDropdownMenu extends DeesElement {
|
|||||||
background: ${bdTheme('border')};
|
background: ${bdTheme('border')};
|
||||||
margin: ${unsafeCSS(spacing["1"])} 0;
|
margin: ${unsafeCSS(spacing["1"])} 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mobile adjustments */
|
|
||||||
@media (max-width: 600px) {
|
|
||||||
.dropdown {
|
|
||||||
position: fixed;
|
|
||||||
top: auto !important;
|
|
||||||
left: ${unsafeCSS(spacing["4"])} !important;
|
|
||||||
right: ${unsafeCSS(spacing["4"])};
|
|
||||||
bottom: ${unsafeCSS(spacing["4"])};
|
|
||||||
width: auto;
|
|
||||||
transform-origin: bottom center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown.open {
|
|
||||||
transform: translateY(0) scale(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown:not(.open) {
|
|
||||||
transform: translateY(10px) scale(0.95);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`,
|
`,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -32,9 +32,6 @@ export class SioFab extends DeesElement {
|
|||||||
@property({ type: Boolean })
|
@property({ type: Boolean })
|
||||||
public accessor showCombox = false;
|
public accessor showCombox = false;
|
||||||
|
|
||||||
@state()
|
|
||||||
private accessor hasShownOnce = false;
|
|
||||||
|
|
||||||
@state()
|
@state()
|
||||||
private accessor shouldPulse = false;
|
private accessor shouldPulse = false;
|
||||||
|
|
||||||
@@ -62,7 +59,6 @@ export class SioFab extends DeesElement {
|
|||||||
--fab-gradient-hover-end: #c026d3;
|
--fab-gradient-hover-end: #c026d3;
|
||||||
--fab-shadow-color: rgba(139, 92, 246, 0.25);
|
--fab-shadow-color: rgba(139, 92, 246, 0.25);
|
||||||
--fab-size: 60px;
|
--fab-size: 60px;
|
||||||
--fab-combox-offset: calc(var(--fab-size) + ${unsafeCSS(spacing["4"])});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#mainbox {
|
#mainbox {
|
||||||
@@ -201,40 +197,11 @@ export class SioFab extends DeesElement {
|
|||||||
#mainbox .icon.close sio-icon {
|
#mainbox .icon.close sio-icon {
|
||||||
transform: scale(1);
|
transform: scale(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#comboxContainer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 0;
|
|
||||||
right: 0;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#comboxContainer sio-combox {
|
|
||||||
position: absolute;
|
|
||||||
bottom: var(--fab-combox-offset);
|
|
||||||
right: 0;
|
|
||||||
transition: ${unsafeCSS(transitions.all)};
|
|
||||||
will-change: transform;
|
|
||||||
transform: translateY(${unsafeCSS(spacing["5"])});
|
|
||||||
opacity: 0;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#comboxContainer.show {
|
|
||||||
pointer-events: all;
|
|
||||||
}
|
|
||||||
|
|
||||||
#comboxContainer.show sio-combox {
|
|
||||||
transform: translateY(0px);
|
|
||||||
opacity: 1;
|
|
||||||
pointer-events: all;
|
|
||||||
}
|
|
||||||
`,
|
`,
|
||||||
// Mobile responsive styles - smaller FAB on phablet and phone
|
// Mobile responsive styles - smaller FAB
|
||||||
cssManager.cssForPhablet(css`
|
cssManager.cssForPhablet(css`
|
||||||
:host {
|
:host {
|
||||||
--fab-size: 48px;
|
--fab-size: 48px;
|
||||||
--fab-combox-offset: calc(var(--fab-size) + ${unsafeCSS(spacing["3"])});
|
|
||||||
bottom: 16px;
|
bottom: 16px;
|
||||||
right: 16px;
|
right: 16px;
|
||||||
}
|
}
|
||||||
@@ -255,11 +222,6 @@ export class SioFab extends DeesElement {
|
|||||||
<sio-icon icon="x" size="20"></sio-icon>
|
<sio-icon icon="x" size="20"></sio-icon>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="comboxContainer" class="${this.showCombox ? 'show' : ''}">
|
|
||||||
${this.showCombox || this.hasShownOnce ? html`
|
|
||||||
<sio-combox @close=${() => this.showCombox = false}></sio-combox>
|
|
||||||
` : ''}
|
|
||||||
</div>
|
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,12 +229,12 @@ export class SioFab extends DeesElement {
|
|||||||
* toggles the combox
|
* toggles the combox
|
||||||
*/
|
*/
|
||||||
public async toggleCombox() {
|
public async toggleCombox() {
|
||||||
console.log('toggle combox');
|
const combox = SioCombox.getInstance();
|
||||||
const wasOpen = this.showCombox;
|
if (combox) {
|
||||||
this.showCombox = !this.showCombox;
|
const wasOpen = combox.getIsOpen();
|
||||||
if (this.showCombox) {
|
combox.toggle();
|
||||||
this.hasShownOnce = true;
|
this.showCombox = combox.getIsOpen();
|
||||||
if (!wasOpen) {
|
if (this.showCombox && !wasOpen) {
|
||||||
this.shouldPulse = true;
|
this.shouldPulse = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -282,6 +244,14 @@ export class SioFab extends DeesElement {
|
|||||||
super.firstUpdated(args);
|
super.firstUpdated(args);
|
||||||
const domtools = await this.domtoolsPromise;
|
const domtools = await this.domtoolsPromise;
|
||||||
|
|
||||||
|
// Create the singleton combox on body
|
||||||
|
const combox = SioCombox.createOnBody();
|
||||||
|
|
||||||
|
// Listen for close events
|
||||||
|
combox.addEventListener('close', () => {
|
||||||
|
this.showCombox = false;
|
||||||
|
});
|
||||||
|
|
||||||
// Set up keyboard shortcut
|
// Set up keyboard shortcut
|
||||||
domtools.keyboard
|
domtools.keyboard
|
||||||
.on([domtools.keyboard.keyEnum.Ctrl, domtools.keyboard.keyEnum.S])
|
.on([domtools.keyboard.keyEnum.Ctrl, domtools.keyboard.keyEnum.S])
|
||||||
@@ -301,15 +271,5 @@ export class SioFab extends DeesElement {
|
|||||||
this.classList.remove('combox-open');
|
this.classList.remove('combox-open');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set reference object when combox is rendered
|
|
||||||
if ((changedProperties.has('showCombox') || changedProperties.has('hasShownOnce')) &&
|
|
||||||
(this.showCombox || this.hasShownOnce)) {
|
|
||||||
const sioCombox: SioCombox = this.shadowRoot.querySelector('sio-combox');
|
|
||||||
const mainBox: HTMLElement = this.shadowRoot.querySelector('#mainbox');
|
|
||||||
if (sioCombox && mainBox && !sioCombox.referenceObject) {
|
|
||||||
sioCombox.referenceObject = mainBox;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,6 +168,8 @@ export class SioMessageInput extends DeesElement {
|
|||||||
.value=${this.messageText}
|
.value=${this.messageText}
|
||||||
@input=${this.handleInput}
|
@input=${this.handleInput}
|
||||||
@keydown=${this.handleKeyDown}
|
@keydown=${this.handleKeyDown}
|
||||||
|
@focus=${this.handleFocus}
|
||||||
|
@blur=${this.handleBlur}
|
||||||
?disabled=${this.disabled}
|
?disabled=${this.disabled}
|
||||||
rows="1"
|
rows="1"
|
||||||
></textarea>
|
></textarea>
|
||||||
@@ -216,6 +218,22 @@ export class SioMessageInput extends DeesElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private handleFocus() {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.dispatchEvent(new CustomEvent('input-focus', {
|
||||||
|
bubbles: true,
|
||||||
|
composed: true
|
||||||
|
}));
|
||||||
|
}, 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
private handleBlur() {
|
||||||
|
this.dispatchEvent(new CustomEvent('input-blur', {
|
||||||
|
bubbles: true,
|
||||||
|
composed: true
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
private sendMessage() {
|
private sendMessage() {
|
||||||
if (!this.messageText.trim() && this.pendingAttachments.length === 0) {
|
if (!this.messageText.trim() && this.pendingAttachments.length === 0) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user