@compa11y/web 0.1.2 → 0.1.5
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/dist/compa11y.iife.js +207 -89
- package/dist/compa11y.js +1253 -994
- package/dist/components/button.d.ts +0 -1
- package/dist/components/checkbox.d.ts +0 -1
- package/dist/components/combobox.d.ts +0 -1
- package/dist/components/dialog.d.ts +0 -1
- package/dist/components/dialog.test.d.ts +0 -1
- package/dist/components/input.d.ts +0 -1
- package/dist/components/listbox.d.ts +3 -4
- package/dist/components/menu.d.ts +3 -1
- package/dist/components/menu.test.d.ts +0 -1
- package/dist/components/radio-group.d.ts +0 -1
- package/dist/components/select.d.ts +0 -1
- package/dist/components/switch.d.ts +0 -1
- package/dist/components/tabs.d.ts +5 -1
- package/dist/components/tabs.test.d.ts +0 -1
- package/dist/components/textarea.d.ts +0 -1
- package/dist/components/toast.d.ts +48 -0
- package/dist/index.d.ts +2 -2
- package/dist/utils/base-element.d.ts +0 -1
- package/dist/utils/styles.d.ts +5 -2
- package/package.json +2 -2
- package/dist/compa11y.iife.js.map +0 -1
- package/dist/compa11y.js.map +0 -1
- package/dist/compa11y.umd.cjs +0 -1633
- package/dist/compa11y.umd.cjs.map +0 -1
- package/dist/components/button.d.ts.map +0 -1
- package/dist/components/checkbox.d.ts.map +0 -1
- package/dist/components/combobox.d.ts.map +0 -1
- package/dist/components/dialog.d.ts.map +0 -1
- package/dist/components/dialog.test.d.ts.map +0 -1
- package/dist/components/input.d.ts.map +0 -1
- package/dist/components/listbox.d.ts.map +0 -1
- package/dist/components/menu.d.ts.map +0 -1
- package/dist/components/menu.test.d.ts.map +0 -1
- package/dist/components/radio-group.d.ts.map +0 -1
- package/dist/components/select.d.ts.map +0 -1
- package/dist/components/switch.d.ts.map +0 -1
- package/dist/components/tabs.d.ts.map +0 -1
- package/dist/components/tabs.test.d.ts.map +0 -1
- package/dist/components/textarea.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/utils/base-element.d.ts.map +0 -1
- package/dist/utils/styles.d.ts.map +0 -1
|
@@ -13,7 +13,7 @@ export declare class A11yOptgroup extends Compa11yElement {
|
|
|
13
13
|
protected setupEventListeners(): void;
|
|
14
14
|
protected cleanupEventListeners(): void;
|
|
15
15
|
private updateLabel;
|
|
16
|
-
|
|
16
|
+
protected onAttributeChange(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
17
17
|
}
|
|
18
18
|
export declare class A11yOption extends Compa11yElement {
|
|
19
19
|
private _value;
|
|
@@ -38,7 +38,7 @@ export declare class A11yOption extends Compa11yElement {
|
|
|
38
38
|
protected setupEventListeners(): void;
|
|
39
39
|
protected cleanupEventListeners(): void;
|
|
40
40
|
private handleClick;
|
|
41
|
-
|
|
41
|
+
protected onAttributeChange(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
42
42
|
}
|
|
43
43
|
export declare class A11yListbox extends Compa11yElement {
|
|
44
44
|
private _value;
|
|
@@ -81,6 +81,5 @@ export declare class A11yListbox extends Compa11yElement {
|
|
|
81
81
|
private handleFocus;
|
|
82
82
|
private handleOptionSelect;
|
|
83
83
|
private handleKeyDown;
|
|
84
|
-
|
|
84
|
+
protected onAttributeChange(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
85
85
|
}
|
|
86
|
-
//# sourceMappingURL=listbox.d.ts.map
|
|
@@ -4,6 +4,9 @@ export declare class A11yMenu extends Compa11yElement {
|
|
|
4
4
|
private _open;
|
|
5
5
|
private _highlightedIndex;
|
|
6
6
|
private _menuItems;
|
|
7
|
+
private _triggerEl;
|
|
8
|
+
private _triggerSlotEl;
|
|
9
|
+
private _defaultSlotEl;
|
|
7
10
|
static get observedAttributes(): string[];
|
|
8
11
|
get open(): boolean;
|
|
9
12
|
set open(value: boolean);
|
|
@@ -37,4 +40,3 @@ export declare class A11yMenu extends Compa11yElement {
|
|
|
37
40
|
toggle(): void;
|
|
38
41
|
}
|
|
39
42
|
export default A11yMenu;
|
|
40
|
-
//# sourceMappingURL=menu.d.ts.map
|
|
@@ -4,6 +4,10 @@ export declare class A11yTabs extends Compa11yElement {
|
|
|
4
4
|
private _tabs;
|
|
5
5
|
private _panels;
|
|
6
6
|
private _selectedIndex;
|
|
7
|
+
private _focusedIndex;
|
|
8
|
+
private _tabSlotEl;
|
|
9
|
+
private _panelSlotEl;
|
|
10
|
+
private _defaultSlotEl;
|
|
7
11
|
static get observedAttributes(): string[];
|
|
8
12
|
get selectedIndex(): number;
|
|
9
13
|
set selectedIndex(value: number);
|
|
@@ -12,6 +16,7 @@ export declare class A11yTabs extends Compa11yElement {
|
|
|
12
16
|
protected setupAccessibility(): void;
|
|
13
17
|
protected render(): void;
|
|
14
18
|
protected setupEventListeners(): void;
|
|
19
|
+
protected cleanupEventListeners(): void;
|
|
15
20
|
protected onAttributeChange(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
16
21
|
private updateTabsAndPanels;
|
|
17
22
|
private handleClick;
|
|
@@ -32,4 +37,3 @@ export declare class A11yTabs extends Compa11yElement {
|
|
|
32
37
|
previous(): void;
|
|
33
38
|
}
|
|
34
39
|
export default A11yTabs;
|
|
35
|
-
//# sourceMappingURL=tabs.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Compa11yElement } from '../utils/base-element';
|
|
2
|
+
|
|
3
|
+
export interface ToastOptions {
|
|
4
|
+
type?: 'info' | 'success' | 'warning' | 'error';
|
|
5
|
+
title?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
duration?: number;
|
|
8
|
+
action?: {
|
|
9
|
+
label: string;
|
|
10
|
+
onClick: () => void;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export declare class A11yToast extends Compa11yElement {
|
|
14
|
+
private _toasts;
|
|
15
|
+
private _counter;
|
|
16
|
+
private _containerEl;
|
|
17
|
+
private _maxToasts;
|
|
18
|
+
static get observedAttributes(): string[];
|
|
19
|
+
get position(): string;
|
|
20
|
+
get duration(): number;
|
|
21
|
+
get maxToasts(): number;
|
|
22
|
+
get label(): string;
|
|
23
|
+
protected setupAccessibility(): void;
|
|
24
|
+
protected render(): void;
|
|
25
|
+
protected setupEventListeners(): void;
|
|
26
|
+
protected cleanupEventListeners(): void;
|
|
27
|
+
protected onAttributeChange(name: string, _oldValue: string | null, newValue: string | null): void;
|
|
28
|
+
/**
|
|
29
|
+
* Add a toast notification. Returns the toast ID.
|
|
30
|
+
*/
|
|
31
|
+
add(options: ToastOptions): string;
|
|
32
|
+
/**
|
|
33
|
+
* Remove a toast by ID.
|
|
34
|
+
*/
|
|
35
|
+
remove(id: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Remove all toasts.
|
|
38
|
+
*/
|
|
39
|
+
clear(): void;
|
|
40
|
+
private _renderToast;
|
|
41
|
+
private _removeElement;
|
|
42
|
+
private _startTimer;
|
|
43
|
+
private _pauseTimer;
|
|
44
|
+
private _resumeTimer;
|
|
45
|
+
private _handleClick;
|
|
46
|
+
private _escapeHtml;
|
|
47
|
+
}
|
|
48
|
+
export default A11yToast;
|
package/dist/index.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ import { A11yButton } from './components/button';
|
|
|
10
10
|
import { A11yListbox, A11yOption, A11yOptgroup } from './components/listbox';
|
|
11
11
|
import { A11yCheckbox, A11yCheckboxGroup } from './components/checkbox';
|
|
12
12
|
import { A11yRadioGroup, A11yRadio } from './components/radio-group';
|
|
13
|
+
import { A11yToast } from './components/toast';
|
|
13
14
|
import { initAnnouncer, announce, announcePolite, announceAssertive, announceStatus, announceError, initFocusVisible, createFocusTrap, createFocusScope, createRovingTabindex, createKeyboardManager, KeyboardPatterns, createTypeAhead, aria, buildAriaProps, hasAccessibleName, isBrowser, prefersReducedMotion, prefersHighContrast, prefersDarkMode } from '@compa11y/core';
|
|
14
15
|
|
|
15
|
-
export { A11yDialog, A11yMenu, A11yTabs, A11yCombobox, A11ySwitch, A11ySelect, A11yInput, A11yTextarea, A11yButton, A11yListbox, A11yOption, A11yOptgroup, A11yCheckbox, A11yCheckboxGroup, A11yRadioGroup, A11yRadio, };
|
|
16
|
+
export { A11yDialog, A11yMenu, A11yTabs, A11yCombobox, A11ySwitch, A11ySelect, A11yInput, A11yTextarea, A11yButton, A11yListbox, A11yOption, A11yOptgroup, A11yCheckbox, A11yCheckboxGroup, A11yRadioGroup, A11yRadio, A11yToast, };
|
|
16
17
|
export { initAnnouncer, announce, announcePolite, announceAssertive, announceStatus, announceError, initFocusVisible, createFocusTrap, createFocusScope, createRovingTabindex, createKeyboardManager, KeyboardPatterns, createTypeAhead, aria, buildAriaProps, hasAccessibleName, isBrowser, prefersReducedMotion, prefersHighContrast, prefersDarkMode, };
|
|
17
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/utils/styles.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export declare const BUTTON_STYLES = "\n \n :host {\n display: block;\n
|
|
|
47
47
|
/**
|
|
48
48
|
* Listbox-specific styles
|
|
49
49
|
*/
|
|
50
|
-
export declare const LISTBOX_STYLES = "\n \n :host {\n display: block;\n box-sizing: border-box;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n\n *,\n *::before,\n *::after {\n box-sizing: inherit;\n }\n\n \n :host(:focus-visible),\n :focus-visible {\n outline: 2px solid var(--compa11y-focus-color, #0066cc);\n outline-offset: 2px;\n }\n\n\n\n :host {\n display: block;\n width: var(--compa11y-listbox-width, 250px);\n }\n\n .listbox-wrapper {\n max-height: var(--compa11y-listbox-max-height, 300px);\n overflow-y: auto;\n border: var(--compa11y-listbox-border, 1px solid #e0e0e0);\n border-radius: var(--compa11y-listbox-radius, 4px);\n background: var(--compa11y-listbox-bg, white);\n padding: var(--compa11y-listbox-padding, 0.25rem 0);\n }\n\n :host([disabled]) .listbox-wrapper {\n opacity: var(--compa11y-listbox-disabled-opacity, 0.5);\n cursor: not-allowed;\n }\n\n :host(:focus-visible) .listbox-wrapper {\n outline:
|
|
50
|
+
export declare const LISTBOX_STYLES = "\n \n :host {\n display: block;\n box-sizing: border-box;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n\n *,\n *::before,\n *::after {\n box-sizing: inherit;\n }\n\n \n :host(:focus-visible),\n :focus-visible {\n outline: 2px solid var(--compa11y-focus-color, #0066cc);\n outline-offset: 2px;\n }\n\n\n\n :host {\n display: block;\n width: var(--compa11y-listbox-width, 250px);\n }\n\n .listbox-wrapper {\n max-height: var(--compa11y-listbox-max-height, 300px);\n overflow-y: auto;\n border: var(--compa11y-listbox-border, 1px solid #e0e0e0);\n border-radius: var(--compa11y-listbox-radius, 4px);\n background: var(--compa11y-listbox-bg, white);\n padding: var(--compa11y-listbox-padding, 0.25rem 0);\n }\n\n :host([disabled]) .listbox-wrapper {\n opacity: var(--compa11y-listbox-disabled-opacity, 0.5);\n cursor: not-allowed;\n }\n\n /* Focus indicator lives on the active option (via data-focused),\n not on the container, to avoid a double focus ring. */\n :host(:focus-visible) .listbox-wrapper {\n outline: none;\n }\n\n :host([orientation=\"horizontal\"]) .listbox-wrapper {\n display: flex;\n flex-wrap: wrap;\n max-height: none;\n overflow-y: visible;\n }\n";
|
|
51
51
|
/**
|
|
52
52
|
* Option-specific styles (for a11y-option inside listbox)
|
|
53
53
|
*/
|
|
@@ -72,4 +72,7 @@ export declare const RADIO_GROUP_STYLES = "\n \n :host {\n display: block;\
|
|
|
72
72
|
* Radio-specific styles
|
|
73
73
|
*/
|
|
74
74
|
export declare const RADIO_STYLES = "\n \n :host {\n display: block;\n box-sizing: border-box;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n\n *,\n *::before,\n *::after {\n box-sizing: inherit;\n }\n\n \n :host(:focus-visible),\n :focus-visible {\n outline: 2px solid var(--compa11y-focus-color, #0066cc);\n outline-offset: 2px;\n }\n\n\n\n :host {\n display: inline-block;\n }\n\n .radio-wrapper {\n display: inline-flex;\n align-items: flex-start;\n gap: var(--compa11y-radio-gap, 0.5rem);\n cursor: pointer;\n user-select: none;\n }\n\n :host([disabled]) .radio-wrapper {\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n .radio-control {\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n }\n\n .radio-input {\n position: absolute;\n opacity: 0;\n width: 100%;\n height: 100%;\n margin: 0;\n cursor: inherit;\n z-index: 1;\n }\n\n .radio-circle {\n width: var(--compa11y-radio-size, 1.25rem);\n height: var(--compa11y-radio-size, 1.25rem);\n min-width: 24px;\n min-height: 24px;\n border: var(--compa11y-radio-border, 2px solid #666);\n border-radius: 50%;\n background: var(--compa11y-radio-bg, white);\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n transition: all 0.15s ease;\n pointer-events: none;\n }\n\n :host([checked]) .radio-circle {\n background: var(--compa11y-radio-checked-bg, #0066cc);\n border-color: var(--compa11y-radio-checked-border, #0066cc);\n }\n\n /* Focus visible on circle when input is focused */\n .radio-input:focus-visible + .radio-circle {\n outline: 2px solid var(--compa11y-focus-color, #0066cc);\n outline-offset: 2px;\n }\n\n /* Hover */\n .radio-wrapper:hover:not([disabled]) .radio-circle {\n border-color: var(--compa11y-radio-hover-border, #0066cc);\n }\n\n /* Inner dot */\n .radio-dot {\n width: var(--compa11y-radio-dot-size, 0.5rem);\n height: var(--compa11y-radio-dot-size, 0.5rem);\n border-radius: 50%;\n background: var(--compa11y-radio-dot-color, white);\n opacity: 0;\n transform: scale(0);\n transition: all 0.15s ease;\n }\n\n :host([checked]) .radio-dot {\n opacity: 1;\n transform: scale(1);\n }\n\n /* Label and text */\n .radio-content {\n display: flex;\n flex-direction: column;\n gap: 0.125rem;\n padding-top: 0.125rem;\n }\n\n .radio-label {\n color: var(--compa11y-radio-label-color, inherit);\n font-size: var(--compa11y-radio-label-size, 1rem);\n cursor: inherit;\n }\n\n .radio-hint {\n color: var(--compa11y-radio-hint-color, #666);\n font-size: var(--compa11y-radio-hint-size, 0.8125rem);\n }\n\n /* Forced colors / high contrast mode */\n @media (forced-colors: active) {\n .radio-circle {\n border: 2px solid ButtonText;\n }\n\n :host([checked]) .radio-circle {\n background: Highlight;\n border-color: Highlight;\n }\n\n .radio-dot {\n background: HighlightText;\n }\n }\n";
|
|
75
|
-
|
|
75
|
+
/**
|
|
76
|
+
* Toast-specific styles
|
|
77
|
+
*/
|
|
78
|
+
export declare const TOAST_STYLES = "\n \n :host {\n display: block;\n box-sizing: border-box;\n }\n\n :host([hidden]) {\n display: none !important;\n }\n\n *,\n *::before,\n *::after {\n box-sizing: inherit;\n }\n\n \n :host(:focus-visible),\n :focus-visible {\n outline: 2px solid var(--compa11y-focus-color, #0066cc);\n outline-offset: 2px;\n }\n\n\n\n :host {\n position: fixed;\n z-index: var(--compa11y-toast-z-index, 9999);\n padding: var(--compa11y-toast-viewport-padding, 1rem);\n display: flex;\n flex-direction: column;\n gap: var(--compa11y-toast-gap, 0.5rem);\n pointer-events: none;\n }\n\n /* Position variants */\n :host([position=\"top-left\"]) { top: 0; left: 0; }\n :host([position=\"top-center\"]) { top: 0; left: 50%; transform: translateX(-50%); }\n :host([position=\"top-right\"]) { top: 0; right: 0; }\n :host([position=\"bottom-left\"]) { bottom: 0; left: 0; }\n :host(:not([position])),\n :host([position=\"bottom-right\"]) { bottom: 0; right: 0; }\n :host([position=\"bottom-center\"]) { bottom: 0; left: 50%; transform: translateX(-50%); }\n\n .toast {\n pointer-events: auto;\n display: flex;\n align-items: flex-start;\n gap: 0.75rem;\n padding: var(--compa11y-toast-padding, 0.75rem 1rem);\n background: var(--compa11y-toast-bg, white);\n border: var(--compa11y-toast-border, 1px solid #e0e0e0);\n border-radius: var(--compa11y-toast-radius, 6px);\n box-shadow: var(--compa11y-toast-shadow, 0 4px 12px rgba(0, 0, 0, 0.15));\n min-width: var(--compa11y-toast-min-width, 250px);\n max-width: var(--compa11y-toast-max-width, 420px);\n }\n\n .toast[data-type=\"error\"] {\n border-left: 4px solid var(--compa11y-toast-error-color, #ef4444);\n }\n\n .toast[data-type=\"warning\"] {\n border-left: 4px solid var(--compa11y-toast-warning-color, #f59e0b);\n }\n\n .toast[data-type=\"success\"] {\n border-left: 4px solid var(--compa11y-toast-success-color, #22c55e);\n }\n\n .toast[data-type=\"info\"] {\n border-left: 4px solid var(--compa11y-toast-info-color, #3b82f6);\n }\n\n .toast-content {\n flex: 1;\n min-width: 0;\n }\n\n .toast-title {\n font-weight: var(--compa11y-toast-title-weight, 600);\n font-size: var(--compa11y-toast-title-size, 0.875rem);\n }\n\n .toast-description {\n color: var(--compa11y-toast-description-color, #666);\n font-size: var(--compa11y-toast-description-size, 0.8125rem);\n margin-top: 0.125rem;\n }\n\n .toast-close {\n \n appearance: none;\n background: none;\n border: none;\n padding: 0;\n margin: 0;\n font: inherit;\n color: inherit;\n cursor: pointer;\n\n flex-shrink: 0;\n width: 1.5rem;\n height: 1.5rem;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: var(--compa11y-toast-close-radius, 4px);\n color: var(--compa11y-toast-close-color, #999);\n font-size: 1.125rem;\n line-height: 1;\n }\n\n .toast-close:hover {\n background: var(--compa11y-toast-close-hover-bg, rgba(0, 0, 0, 0.05));\n color: var(--compa11y-toast-close-hover-color, #333);\n }\n\n .toast-close:focus-visible {\n outline: 2px solid var(--compa11y-focus-color, #0066cc);\n outline-offset: 2px;\n }\n\n .toast-action {\n \n appearance: none;\n background: none;\n border: none;\n padding: 0;\n margin: 0;\n font: inherit;\n color: inherit;\n cursor: pointer;\n\n margin-top: 0.375rem;\n font-size: var(--compa11y-toast-action-size, 0.8125rem);\n font-weight: 500;\n color: var(--compa11y-toast-action-color, #0066cc);\n text-decoration: underline;\n }\n\n .toast-action:hover {\n color: var(--compa11y-toast-action-hover-color, #0052a3);\n }\n\n .toast-action:focus-visible {\n outline: 2px solid var(--compa11y-focus-color, #0066cc);\n outline-offset: 2px;\n }\n";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@compa11y/web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Accessible Web Components for any HTML page - CDN ready",
|
|
5
5
|
"author": "Ivan Trajkovski",
|
|
6
6
|
"license": "MIT",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"LICENSE"
|
|
84
84
|
],
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@compa11y/core": "0.1.
|
|
86
|
+
"@compa11y/core": "0.1.5"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
89
|
"@types/node": "^20.11.0",
|