@nectary/components 5.32.0 → 5.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle.d.ts +3 -0
- package/bundle.js +772 -176
- package/bundle.ts +3 -0
- package/floating-panel/global/index.d.ts +1 -0
- package/floating-panel/global/index.js +2 -0
- package/floating-panel/index.d.ts +41 -0
- package/floating-panel/index.js +502 -0
- package/floating-panel/types.d.ts +80 -0
- package/floating-panel/types.js +1 -0
- package/floating-panel-button/index.d.ts +11 -0
- package/floating-panel-button/index.js +43 -0
- package/floating-panel-button/types.d.ts +35 -0
- package/floating-panel-button/types.js +1 -0
- package/floating-panel-icon-button/index.d.ts +12 -0
- package/floating-panel-icon-button/index.js +50 -0
- package/floating-panel-icon-button/types.d.ts +35 -0
- package/floating-panel-icon-button/types.js +1 -0
- package/icon/generated-icon-type.d.ts +1 -1
- package/icon/index.js +30 -4
- package/package.json +3 -3
- package/pop/index.js +1 -1
- package/standalone.d.ts +3 -0
- package/standalone.js +3 -0
- package/standalone.ts +3 -0
- package/tooltip/index.js +4 -4
- package/utils/component-names.d.ts +2 -2
- package/utils/component-names.js +3 -0
- package/utils/element.d.ts +3 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { isAttrEqual, updateAttribute, getAttribute } from "../utils/dom.js";
|
|
2
|
+
import { defineCustomElement, NectaryElement } from "../utils/element.js";
|
|
3
|
+
import "../button/index.js";
|
|
4
|
+
const templateHTML = '<style>:host{display:flex;flex-shrink:0;height:100%;min-height:40px;color:var(--sinch-comp-floating-panel-color-text,var(--sinch-sys-color-primary-foreground))}sinch-button{height:100%;padding:0;white-space:nowrap;--sinch-button-shape-radius-base:0;--sinch-comp-button-color-subtle-secondary-default-border-initial:var(--sinch-sys-color-basic-transparent);--sinch-comp-button-color-subtle-secondary-disabled-border-initial:var(--sinch-sys-color-basic-transparent);--sinch-comp-button-spacing-padding-m:16px;--sinch-comp-button-color-subtle-secondary-default-text-initial:var(--sinch-comp-floating-panel-color-button-text-initial, var(--sinch-sys-color-primary-foreground));--sinch-comp-button-color-subtle-secondary-default-background-initial:var(--sinch-comp-floating-panel-color-button-background-initial, transparent);--sinch-comp-button-color-subtle-secondary-default-background-hover:var(--sinch-comp-floating-panel-color-button-background-hover);--sinch-comp-button-color-subtle-secondary-default-background-active:var(--sinch-comp-floating-panel-color-button-background-active);--sinch-comp-button-shadow-subtle-hover:none;--sinch-comp-button-shadow-subtle-active:none}sinch-button:focus-visible{--sinch-comp-button-color-subtle-secondary-default-background-initial:var(--sinch-comp-floating-panel-color-button-background-hover);--sinch-comp-button-shadow-subtle-focus:none}</style><sinch-button id="button" type="subtle-secondary"></sinch-button>';
|
|
5
|
+
const template = document.createElement("template");
|
|
6
|
+
template.innerHTML = templateHTML;
|
|
7
|
+
class FloatingPanelButton extends NectaryElement {
|
|
8
|
+
#$button;
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
const shadowRoot = this.attachShadow();
|
|
12
|
+
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
13
|
+
this.#$button = shadowRoot.querySelector("#button");
|
|
14
|
+
}
|
|
15
|
+
static get observedAttributes() {
|
|
16
|
+
return ["text", "aria-label"];
|
|
17
|
+
}
|
|
18
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
19
|
+
if (isAttrEqual(oldVal, newVal)) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (name === "text") {
|
|
23
|
+
this.#$button.setAttribute("text", newVal ?? "");
|
|
24
|
+
}
|
|
25
|
+
if (name === "aria-label") {
|
|
26
|
+
if (newVal !== null) {
|
|
27
|
+
this.#$button.setAttribute("aria-label", newVal);
|
|
28
|
+
} else {
|
|
29
|
+
this.#$button.removeAttribute("aria-label");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
set text(value) {
|
|
34
|
+
updateAttribute(this, "text", value);
|
|
35
|
+
}
|
|
36
|
+
get text() {
|
|
37
|
+
return getAttribute(this, "text");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
defineCustomElement("sinch-floating-panel-button", FloatingPanelButton);
|
|
41
|
+
export {
|
|
42
|
+
FloatingPanelButton
|
|
43
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { NectaryComponentReact, NectaryComponentReactByType, NectaryComponentVanilla, NectaryComponentVanillaByType } from '../types';
|
|
2
|
+
export type TSinchFloatingPanelButtonProps = {
|
|
3
|
+
/** The button label text */
|
|
4
|
+
text?: string;
|
|
5
|
+
'aria-label'?: string;
|
|
6
|
+
};
|
|
7
|
+
export type TSinchFloatingPanelButtonEvents = Record<string, never>;
|
|
8
|
+
export type TSinchFloatingPanelButtonStyle = Record<string, never>;
|
|
9
|
+
export type TSinchFloatingPanelButton = {
|
|
10
|
+
props: TSinchFloatingPanelButtonProps;
|
|
11
|
+
events: TSinchFloatingPanelButtonEvents;
|
|
12
|
+
style: TSinchFloatingPanelButtonStyle;
|
|
13
|
+
};
|
|
14
|
+
export type TSinchFloatingPanelButtonElement = NectaryComponentVanillaByType<TSinchFloatingPanelButton>;
|
|
15
|
+
export type TSinchFloatingPanelButtonReact = NectaryComponentReactByType<TSinchFloatingPanelButton>;
|
|
16
|
+
declare global {
|
|
17
|
+
interface NectaryComponentMap {
|
|
18
|
+
'sinch-floating-panel-button': TSinchFloatingPanelButton;
|
|
19
|
+
}
|
|
20
|
+
interface HTMLElementTagNameMap {
|
|
21
|
+
'sinch-floating-panel-button': NectaryComponentVanilla<'sinch-floating-panel-button'>;
|
|
22
|
+
}
|
|
23
|
+
namespace JSX {
|
|
24
|
+
interface IntrinsicElements {
|
|
25
|
+
'sinch-floating-panel-button': NectaryComponentReact<'sinch-floating-panel-button'>;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
declare module 'react' {
|
|
30
|
+
namespace JSX {
|
|
31
|
+
interface IntrinsicElements extends globalThis.JSX.IntrinsicElements {
|
|
32
|
+
'sinch-floating-panel-button': NectaryComponentReact<'sinch-floating-panel-button'>;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NectaryElement } from '../utils';
|
|
2
|
+
import '../button';
|
|
3
|
+
import '../icon';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export declare class FloatingPanelIconButton extends NectaryElement {
|
|
6
|
+
#private;
|
|
7
|
+
constructor();
|
|
8
|
+
static get observedAttributes(): string[];
|
|
9
|
+
attributeChangedCallback(name: string, oldVal: string | null, newVal: string | null): void;
|
|
10
|
+
set icon(value: string | null);
|
|
11
|
+
get icon(): string | null;
|
|
12
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { isAttrEqual, updateAttribute, getAttribute } from "../utils/dom.js";
|
|
2
|
+
import { defineCustomElement, NectaryElement } from "../utils/element.js";
|
|
3
|
+
import "../button/index.js";
|
|
4
|
+
import "../icon/index.js";
|
|
5
|
+
const templateHTML = '<style>:host{display:flex;align-items:center;justify-content:center;width:40px;height:40px;flex-shrink:0;box-sizing:border-box;cursor:pointer}sinch-button{display:flex;align-items:center;justify-content:center;width:100%;height:100%;--sinch-button-shape-radius-base:0;--sinch-comp-button-color-subtle-secondary-default-border-initial:var(--sinch-sys-color-basic-transparent);--sinch-comp-button-color-subtle-secondary-disabled-border-initial:var(--sinch-sys-color-basic-transparent);--sinch-comp-button-color-subtle-secondary-default-background-initial:transparent;--sinch-comp-button-color-subtle-secondary-default-icon-initial:var(--sinch-comp-floating-panel-color-text, var(--sinch-sys-color-primary-foreground));--sinch-comp-button-color-subtle-secondary-default-text-initial:var(--sinch-comp-floating-panel-color-text, var(--sinch-sys-color-primary-foreground));--sinch-comp-button-color-subtle-secondary-default-background-hover:var(--sinch-comp-floating-panel-color-button-background-hover);--sinch-comp-button-color-subtle-secondary-default-background-active:var(--sinch-comp-floating-panel-color-button-background-active);--sinch-comp-button-shadow-subtle-hover:none;--sinch-comp-button-shadow-subtle-active:none}sinch-button:focus-visible{--sinch-comp-button-color-subtle-secondary-default-background-initial:var(--sinch-comp-floating-panel-color-button-background-hover);--sinch-comp-button-shadow-subtle-focus:none}:host(.edge-start:active) sinch-button,:host(.edge-start:focus) sinch-button,:host(.edge-start:hover) sinch-button{--sinch-button-shape-radius-top-left:var(--sinch-comp-floating-panel-shape-radius);--sinch-button-shape-radius-bottom-left:var(--sinch-comp-floating-panel-shape-radius)}:host(.edge-end:active) sinch-button,:host(.edge-end:focus) sinch-button,:host(.edge-end:hover) sinch-button{--sinch-button-shape-radius-top-right:var(--sinch-comp-floating-panel-shape-radius);--sinch-button-shape-radius-bottom-right:var(--sinch-comp-floating-panel-shape-radius)}sinch-icon{--sinch-global-color-icon:var(--sinch-comp-floating-panel-color-text, var(--sinch-sys-color-primary-foreground));--sinch-global-size-icon:var(--sinch-comp-floating-panel-size-button-icon)}</style><sinch-button id="button" type="subtle-secondary"><sinch-icon id="icon" icons-version="2" slot="icon"></sinch-icon></sinch-button>';
|
|
6
|
+
const template = document.createElement("template");
|
|
7
|
+
template.innerHTML = templateHTML;
|
|
8
|
+
class FloatingPanelIconButton extends NectaryElement {
|
|
9
|
+
#$icon;
|
|
10
|
+
#$button;
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
const shadowRoot = this.attachShadow();
|
|
14
|
+
shadowRoot.appendChild(template.content.cloneNode(true));
|
|
15
|
+
this.#$icon = shadowRoot.querySelector("#icon");
|
|
16
|
+
this.#$button = shadowRoot.querySelector("#button");
|
|
17
|
+
}
|
|
18
|
+
static get observedAttributes() {
|
|
19
|
+
return ["icon", "aria-label"];
|
|
20
|
+
}
|
|
21
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
22
|
+
if (isAttrEqual(oldVal, newVal)) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (name === "icon") {
|
|
26
|
+
if (newVal !== null) {
|
|
27
|
+
this.#$icon.setAttribute("name", newVal);
|
|
28
|
+
} else {
|
|
29
|
+
this.#$icon.removeAttribute("name");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (name === "aria-label") {
|
|
33
|
+
if (newVal !== null) {
|
|
34
|
+
this.#$button.setAttribute("aria-label", newVal);
|
|
35
|
+
} else {
|
|
36
|
+
this.#$button.removeAttribute("aria-label");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
set icon(value) {
|
|
41
|
+
updateAttribute(this, "icon", value);
|
|
42
|
+
}
|
|
43
|
+
get icon() {
|
|
44
|
+
return getAttribute(this, "icon");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
defineCustomElement("sinch-floating-panel-icon-button", FloatingPanelIconButton);
|
|
48
|
+
export {
|
|
49
|
+
FloatingPanelIconButton
|
|
50
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { NectaryComponentReact, NectaryComponentReactByType, NectaryComponentVanilla, NectaryComponentVanillaByType } from '../types';
|
|
2
|
+
export type TSinchFloatingPanelIconButtonProps = {
|
|
3
|
+
/** The icon name */
|
|
4
|
+
icon?: string;
|
|
5
|
+
'aria-label'?: string;
|
|
6
|
+
};
|
|
7
|
+
export type TSinchFloatingPanelIconButtonEvents = Record<string, never>;
|
|
8
|
+
export type TSinchFloatingPanelIconButtonStyle = Record<string, never>;
|
|
9
|
+
export type TSinchFloatingPanelIconButton = {
|
|
10
|
+
props: TSinchFloatingPanelIconButtonProps;
|
|
11
|
+
events: TSinchFloatingPanelIconButtonEvents;
|
|
12
|
+
style: TSinchFloatingPanelIconButtonStyle;
|
|
13
|
+
};
|
|
14
|
+
export type TSinchFloatingPanelIconButtonElement = NectaryComponentVanillaByType<TSinchFloatingPanelIconButton>;
|
|
15
|
+
export type TSinchFloatingPanelIconButtonReact = NectaryComponentReactByType<TSinchFloatingPanelIconButton>;
|
|
16
|
+
declare global {
|
|
17
|
+
interface NectaryComponentMap {
|
|
18
|
+
'sinch-floating-panel-icon-button': TSinchFloatingPanelIconButton;
|
|
19
|
+
}
|
|
20
|
+
interface HTMLElementTagNameMap {
|
|
21
|
+
'sinch-floating-panel-icon-button': NectaryComponentVanilla<'sinch-floating-panel-icon-button'>;
|
|
22
|
+
}
|
|
23
|
+
namespace JSX {
|
|
24
|
+
interface IntrinsicElements {
|
|
25
|
+
'sinch-floating-panel-icon-button': NectaryComponentReact<'sinch-floating-panel-icon-button'>;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
declare module 'react' {
|
|
30
|
+
namespace JSX {
|
|
31
|
+
interface IntrinsicElements extends globalThis.JSX.IntrinsicElements {
|
|
32
|
+
'sinch-floating-panel-icon-button': NectaryComponentReact<'sinch-floating-panel-icon-button'>;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|