@tylertech/forge 3.3.5 → 3.4.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/custom-elements.json +388 -98
- package/dist/app-bar/forge-app-bar.css +2 -17
- package/dist/field/forge-field.css +4 -17
- package/dist/forge.css +12 -0
- package/dist/icon-button/forge-icon-button.css +1 -0
- package/dist/lib.js +1 -1
- package/dist/lib.js.map +3 -3
- package/dist/toolbar/forge-toolbar.css +2 -1
- package/dist/typography/forge-typography.css +12 -0
- package/dist/vscode.css-custom-data.json +15 -15
- package/dist/vscode.html-custom-data.json +159 -28
- package/esm/app-bar/app-bar/app-bar.d.ts +1 -0
- package/esm/app-bar/app-bar/app-bar.js +2 -1
- package/esm/autocomplete/autocomplete-adapter.js +2 -1
- package/esm/calendar/calendar-core.d.ts +1 -1
- package/esm/calendar/calendar-core.js +1 -1
- package/esm/calendar/calendar-dropdown/calendar-dropdown.js +1 -1
- package/esm/checkbox/checkbox.d.ts +3 -3
- package/esm/checkbox/checkbox.js +1 -1
- package/esm/chip-field/chip-field.js +1 -1
- package/esm/deprecated/icon-button/deprecated-icon-button.js +1 -1
- package/esm/dialog/dialog-core.d.ts +1 -0
- package/esm/dialog/dialog-core.js +10 -6
- package/esm/dialog/dialog.d.ts +4 -4
- package/esm/field/base/with-base-field.js +2 -2
- package/esm/field/field-adapter.d.ts +4 -4
- package/esm/field/field-adapter.js +4 -12
- package/esm/field/field-constants.d.ts +1 -0
- package/esm/field/field-constants.js +2 -1
- package/esm/field/field-core.d.ts +2 -0
- package/esm/field/field-core.js +13 -3
- package/esm/field/field.d.ts +1 -0
- package/esm/field/field.js +3 -2
- package/esm/icon/icon.d.ts +26 -9
- package/esm/icon/icon.js +3 -2
- package/esm/icon-button/icon-button.d.ts +1 -0
- package/esm/icon-button/icon-button.js +2 -1
- package/esm/label/label.d.ts +1 -1
- package/esm/popover/popover-adapter.js +8 -1
- package/esm/radio/radio/radio.d.ts +2 -2
- package/esm/radio/radio/radio.js +1 -1
- package/esm/select/core/base-select-adapter.js +5 -0
- package/esm/skip-link/skip-link.d.ts +1 -1
- package/esm/skip-link/skip-link.js +1 -1
- package/esm/switch/switch.d.ts +2 -2
- package/esm/switch/switch.js +1 -1
- package/esm/tabs/tab/tab-adapter.d.ts +3 -0
- package/esm/tabs/tab/tab-adapter.js +5 -0
- package/esm/tabs/tab/tab-core.d.ts +3 -0
- package/esm/tabs/tab/tab-core.js +5 -0
- package/esm/tabs/tab/tab.d.ts +6 -4
- package/esm/tabs/tab/tab.js +6 -5
- package/esm/tabs/tab-bar/tab-bar-core.js +1 -1
- package/esm/tabs/tab-bar/tab-bar.d.ts +4 -2
- package/esm/tabs/tab-bar/tab-bar.js +3 -3
- package/esm/time-picker/time-picker-adapter.d.ts +2 -2
- package/esm/time-picker/time-picker-adapter.js +44 -30
- package/esm/time-picker/time-picker-core.js +1 -1
- package/esm/time-picker/time-picker.d.ts +125 -28
- package/esm/time-picker/time-picker.js +0 -27
- package/esm/toolbar/toolbar.d.ts +1 -0
- package/esm/toolbar/toolbar.js +2 -1
- package/esm/view-switcher/view-switcher.d.ts +1 -1
- package/package.json +4 -4
- package/sass/app-bar/app-bar/_core.scss +1 -1
- package/sass/checkbox/_core.scss +1 -1
- package/sass/core/styles/_utils.scss +1 -1
- package/sass/core/styles/theme/_utils.scss +1 -1
- package/sass/core/styles/tokens/app-bar/app-bar/_tokens.scss +1 -0
- package/sass/core/styles/tokens/icon-button/_tokens.scss +1 -0
- package/sass/core/styles/tokens/list/list/_tokens.scss +2 -1
- package/sass/core/styles/tokens/tabs/tab/_tokens.scss +6 -6
- package/sass/core/styles/tokens/toolbar/_tokens.scss +2 -1
- package/sass/core/styles/tokens/typography/_tokens.label.scss +10 -0
- package/sass/field/_core.animation.scss +0 -20
- package/sass/field/_core.layout.scss +3 -8
- package/sass/field/_core.scss +1 -0
- package/sass/field/_core.slotted.scss +4 -8
- package/sass/field/field.scss +8 -8
- package/sass/icon-button/_core.scss +1 -0
- package/sass/radio/index.scss +1 -1
- package/sass/radio/radio/_core.scss +1 -1
- package/sass/switch/_core.scss +1 -1
- package/sass/tabs/tab/_core.scss +4 -19
- package/sass/tabs/tab/tab.scss +1 -25
- package/sass/tabs/tab-bar/_core.scss +1 -0
- package/sass/toolbar/_core.scss +1 -1
|
@@ -203,6 +203,11 @@ export class BaseSelectAdapter extends BaseAdapter {
|
|
|
203
203
|
const optionElement = document.createElement('forge-option');
|
|
204
204
|
Object.assign(optionElement, option);
|
|
205
205
|
optionElement.textContent = option.label;
|
|
206
|
+
if (option.elementAttributes) {
|
|
207
|
+
option.elementAttributes.forEach((value, key) => {
|
|
208
|
+
optionElement.setAttribute(key, value);
|
|
209
|
+
});
|
|
210
|
+
}
|
|
206
211
|
return optionElement;
|
|
207
212
|
}
|
|
208
213
|
}
|
|
@@ -94,7 +94,7 @@ export declare class SkipLinkComponent extends BaseComponent implements ISkipLin
|
|
|
94
94
|
/**
|
|
95
95
|
* Sets the skip link to skip browser navigation and scroll to the target element.
|
|
96
96
|
* @default false
|
|
97
|
-
* @attribute
|
|
97
|
+
* @attribute skip-url-change
|
|
98
98
|
*/
|
|
99
99
|
get skipUrlChange(): boolean;
|
|
100
100
|
set skipUrlChange(value: boolean);
|
|
@@ -149,7 +149,7 @@ let SkipLinkComponent = class SkipLinkComponent extends BaseComponent {
|
|
|
149
149
|
/**
|
|
150
150
|
* Sets the skip link to skip browser navigation and scroll to the target element.
|
|
151
151
|
* @default false
|
|
152
|
-
* @attribute
|
|
152
|
+
* @attribute skip-url-change
|
|
153
153
|
*/
|
|
154
154
|
get skipUrlChange() {
|
|
155
155
|
return this._skipUrlChange;
|
package/esm/switch/switch.d.ts
CHANGED
|
@@ -164,7 +164,7 @@ export declare class SwitchComponent extends SwitchComponent_base implements ISw
|
|
|
164
164
|
/**
|
|
165
165
|
* Gets/sets whether the switch is on or off by default.
|
|
166
166
|
* @default false
|
|
167
|
-
* @attribute
|
|
167
|
+
* @attribute default-on
|
|
168
168
|
*/
|
|
169
169
|
defaultOn: boolean;
|
|
170
170
|
/**
|
|
@@ -206,7 +206,7 @@ export declare class SwitchComponent extends SwitchComponent_base implements ISw
|
|
|
206
206
|
/**
|
|
207
207
|
* Controls whether the label appears before or after the switch.
|
|
208
208
|
* @default 'end'
|
|
209
|
-
* @attribute
|
|
209
|
+
* @attribute label-position
|
|
210
210
|
*/
|
|
211
211
|
labelPosition: SwitchLabelPosition;
|
|
212
212
|
/**
|
package/esm/switch/switch.js
CHANGED
|
@@ -18,7 +18,7 @@ import { SwitchAdapter } from './switch-adapter';
|
|
|
18
18
|
import { SWITCH_CONSTANTS } from './switch-constants';
|
|
19
19
|
import { SwitchCore } from './switch-core';
|
|
20
20
|
const template = '<template><div class=\"forge-switch\" part=\"switch\"><div id=\"container\" class=\"container\"><div class=\"track\" part=\"track\"></div><div class=\"handle\" part=\"handle\"><div id=\"icon-off\" class=\"icon icon__off\" part=\"icon-off\"><slot name=\"icon-off\"><svg aria-hidden=\"true\" viewBox=\"0 0 24 24\"><path d=\"M20 13H4v-2h16v2z\"/></svg></slot></div><div id=\"icon-on\" class=\"icon icon__on\" part=\"icon-on\"><slot name=\"icon-on\"><svg aria-hidden=\"true\" viewBox=\"0 0 24 24\"><path d=\"M19.69,5.23L8.96,15.96l-4.23-4.23L2.96,13.5l6,6L21.46,7L19.69,5.23z\"/></svg></slot></div><forge-state-layer target=\":host\" exportparts=\"surface:state-layer\"></forge-state-layer></div><forge-focus-indicator target=\":host\" part=\"focus-indicator\"></forge-focus-indicator></div><label id=\"label\" class=\"label\" part=\"label\"><slot></slot></label></div></template>';
|
|
21
|
-
const styles = ':host{display:inline-block;outline:0;-webkit-tap-highlight-color:transparent}:host([hidden]){display:none}.forge-switch{--_switch-handle-size:var(--forge-switch-handle-size, 20px);--_switch-handle-scale:var(--forge-switch-handle-scale, 1);--_switch-handle-elevation:var(--forge-switch-handle-elevation, 0px 2px 1px -1px rgba(0, 0, 0, 0.2), 0px 1px 1px 0px rgba(0, 0, 0, 0.14), 0px 1px 3px 0px rgba(0, 0, 0, 0.12));--_switch-track-border-width:var(--forge-switch-track-border-width, 0);--_switch-track-border-color:var(--forge-switch-track-border-color, transparent);--_switch-icon-color:var(--forge-switch-icon-color, var(--forge-theme-on-tertiary, #ffffff));--_switch-icon-size:var(--forge-switch-icon-size, 16px);--_switch-icon-scale:var(--forge-switch-icon-scale, 1);--_switch-state-layer-size:var(--forge-switch-state-layer-size, 40px);--_switch-state-layer-dense-size:var(--forge-switch-state-layer-dense-size, 28px);--_switch-handle-on-color:var(--forge-switch-handle-on-color, var(--forge-theme-tertiary, #3d5afe));--_switch-handle-off-color:var(--forge-switch-handle-off-color, var(--forge-theme-surface-container-high, #9e9e9e));--_switch-handle-width:var(--forge-switch-handle-width, var(--_switch-handle-size));--_switch-handle-height:var(--forge-switch-handle-height, var(--_switch-handle-size));--_switch-handle-on-scale:var(--forge-switch-handle-on-scale, var(--_switch-handle-scale));--_switch-handle-off-scale:var(--forge-switch-handle-off-scale, var(--_switch-handle-scale));--_switch-handle-shape:var(--forge-switch-handle-shape, calc(var(--forge-shape-round, 50%) * var(--forge-shape-factor, 1)));--_switch-handle-on-elevation:var(--forge-switch-handle-on-elevation, var(--_switch-handle-elevation));--_switch-handle-off-elevation:var(--forge-switch-handle-off-elevation, var(--_switch-handle-elevation));--_switch-track-on-color:var(--forge-switch-track-on-color, var(--forge-theme-tertiary-container, #d0d7ff));--_switch-track-off-color:var(--forge-switch-track-off-color, var(--forge-theme-surface-container, #e0e0e0));--_switch-track-width:var(--forge-switch-track-width, 36px);--_switch-track-height:var(--forge-switch-track-height, 14px);--_switch-track-shape:var(--forge-switch-track-shape, calc(var(--forge-shape-full, 9999px) * var(--forge-shape-factor, 1)));--_switch-track-on-border-width:var(--forge-switch-track-on-border-width, var(--_switch-track-border-width));--_switch-track-off-border-width:var(--forge-switch-track-off-border-width, var(--_switch-track-border-width));--_switch-track-on-border-color:var(--forge-switch-track-on-border-color, var(--_switch-track-border-color));--_switch-track-off-border-color:var(--forge-switch-track-off-border-color, var(--_switch-track-border-color));--_switch-icon-on-color:var(--forge-switch-icon-on-color, var(--_switch-icon-color));--_switch-icon-off-color:var(--forge-switch-icon-off-color, var(--_switch-icon-color));--_switch-icon-on-size:var(--forge-switch-icon-on-size, var(--_switch-icon-size));--_switch-icon-off-size:var(--forge-switch-icon-off-size, var(--_switch-icon-size));--_switch-icon-on-scale:var(--forge-switch-icon-on-scale, var(--_switch-icon-scale));--_switch-icon-off-scale:var(--forge-switch-icon-off-scale, var(--_switch-icon-scale));--_switch-gap:var(--forge-switch-gap, 0);--_switch-justify:var(--forge-switch-justify, start);--_switch-direction:var(--forge-switch-direction, initial);--_switch-state-layer-width:var(--forge-switch-state-layer-width, var(--_switch-state-layer-size));--_switch-state-layer-height:var(--forge-switch-state-layer-height, var(--_switch-state-layer-size));--_switch-state-layer-on-color:var(--forge-switch-state-layer-on-color, var(--_switch-handle-on-color));--_switch-state-layer-off-color:var(--forge-switch-state-layer-off-color, var(--_switch-color));--_switch-state-layer-dense-width:var(--forge-switch-state-layer-dense-width, var(--_switch-state-layer-dense-size));--_switch-state-layer-dense-height:var(--forge-switch-state-layer-dense-height, var(--_switch-state-layer-dense-size));--_switch-disabled-opacity:var(--forge-switch-disabled-opacity, 0.38);--_switch-handle-active-on-color:var(--forge-switch-handle-active-on-color, var(--_switch-handle-on-color));--_switch-handle-active-off-color:var(--forge-switch-handle-active-off-color, var(--_switch-handle-off-color));--_switch-handle-active-scale:var(--forge-switch-handle-active-scale, 1.2);--_switch-handle-active-on-scale:var(--forge-switch-handle-active-on-scale, var(--_switch-handle-active-scale));--_switch-handle-active-off-scale:var(--forge-switch-handle-active-off-scale, var(--_switch-handle-active-scale));--_switch-handle-active-elevation:var(--forge-switch-handle-active-elevation, var(--_switch-handle-elevation));--_switch-handle-active-on-elevation:var(--forge-switch-handle-active-on-elevation, var(--_switch-handle-active-elevation));--_switch-handle-active-off-elevation:var(--forge-switch-handle-active-off-elevation, var(--_switch-handle-active-elevation));--_switch-track-active-on-color:var(--forge-switch-track-active-on-color, var(--_switch-track-on-color));--_switch-track-active-off-color:var(--forge-switch-track-active-off-color, var(--_switch-track-off-color));--_switch-track-active-on-border-width:var(--forge-switch-track-active-on-border-width, var(--_switch-track-on-border-width));--_switch-track-active-off-border-width:var(--forge-switch-track-active-off-border-width, var(--_switch-track-off-border-width));--_switch-track-active-on-border-color:var(--forge-switch-track-active-on-border-color, var(--_switch-track-on-border-color));--_switch-track-active-off-border-color:var(--forge-switch-track-active-off-border-color, var(--_switch-track-off-border-color));--_switch-icon-active-on-color:var(--forge-switch-icon-active-on-color, var(--_switch-icon-on-color));--_switch-icon-active-off-color:var(--forge-switch-icon-active-off-color, var(--_switch-icon-off-color));--_switch-icon-active-on-scale:var(--forge-switch-icon-active-on-scale, var(--_switch-icon-on-scale));--_switch-icon-active-off-scale:var(--forge-switch-icon-active-off-scale, var(--_switch-icon-off-scale));--_switch-animation-duration:var(--forge-switch-animation-duration, var(--forge-animation-duration-short2, 100ms));--_switch-animation-timing:var(--forge-switch-animation-timing, var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)));--_switch-active-animation-timing:var(--forge-switch-active-animation-timing, var(--forge-animation-easing-linear, cubic-bezier(0, 0, 1, 1)))}.forge-switch{display:flex;position:relative;flex-direction:var(--_switch-direction);flex-shrink:0;align-items:center;justify-content:var(--_switch-justify);gap:var(--_switch-gap);--_switch-current-state-layer-width:var(--_switch-state-layer-width);--_switch-current-state-layer-height:var(--_switch-state-layer-height)}.forge-switch .container{position:relative;align-items:center;display:flex;block-size:max(var(--_switch-handle-height),var(--_switch-track-height),var(--_switch-current-state-layer-height));cursor:pointer}.forge-switch .input{position:absolute;z-index:1;appearance:none;outline:0;margin:0;inline-size:100%;block-size:100%;cursor:unset}.forge-switch .track{transition-property:background-color,border-color,border-width;transition-duration:var(--_switch-animation-duration);transition-timing-function:var(--_switch-animation-timing);box-sizing:border-box;margin-inline:calc(max(var(--_switch-handle-width),var(--_switch-current-state-layer-width))/ 2 - calc(var(--_switch-track-height)/ 2));border-width:var(--_switch-track-off-border-width);border-color:var(--_switch-track-off-border-color);border-style:solid;border-radius:var(--_switch-track-shape);inline-size:var(--_switch-track-width);block-size:var(--_switch-track-height);background-color:var(--_switch-track-off-color)}.forge-switch .handle{position:absolute;justify-content:center;align-items:center;display:flex;transition-property:translate;transition-duration:var(--_switch-animation-duration);transition-timing-function:var(--_switch-animation-timing);border-radius:var(--_switch-handle-shape);inline-size:var(--_switch-current-state-layer-width);block-size:var(--_switch-current-state-layer-height)}.forge-switch .handle::before{content:\"\";position:relative;display:block;scale:var(--_switch-handle-off-scale);transition:background-color var(--_switch-animation-duration) var(--_switch-animation-timing),box-shadow var(--_switch-animation-duration) var(--_switch-animation-timing),scale var(--_switch-animation-duration) var(--_switch-active-animation-timing);box-shadow:var(--_switch-handle-off-elevation);border-radius:var(--_switch-handle-shape);inline-size:var(--_switch-handle-width);block-size:var(--_switch-handle-height);background-color:var(--_switch-handle-off-color)}.forge-switch .icon{position:absolute;align-items:center;justify-content:center;display:flex;transition-property:opacity,scale;transition-duration:var(--_switch-animation-duration);transition-timing-function:var(--_switch-animation-timing);inline-size:var(--_switch-icon-off-size);block-size:var(--_switch-icon-off-size);color:var(--_switch-icon-off-color);fill:var(--_switch-icon-off-color);font-size:var(--_switch-icon-off-size);--forge-icon-font-size:var(--_switch-icon-off-size)}.forge-switch .icon__on{--forge-icon-font-size:var(--_switch-icon-on-size);inline-size:var(--_switch-icon-on-size);block-size:var(--_switch-icon-on-size);color:var(--_switch-icon-on-color);fill:var(--_switch-icon-on-color);font-size:var(--_switch-icon-on-size);opacity:0;scale:0.4}.forge-switch .icon__off{opacity:1;scale:var(--_switch-icon-off-scale)}.forge-switch .label{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:var(--forge-typography-label1-font-family, var(--forge-typography-font-family, \"Roboto\", sans-serif));font-size:var(--forge-typography-label1-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-font-size-scale, .75)));font-weight:var(--forge-typography-label1-font-weight,400);line-height:var(--forge-typography-label1-line-height, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-line-height-scale, 1.25)));letter-spacing:var(--forge-typography-label1-letter-spacing, .0357142857em);text-transform:var(--forge-typography-label1-text-transform,inherit);text-decoration:var(--forge-typography-label1-text-decoration,inherit)}.forge-switch .label:empty{display:none}.forge-switch .hidden{display:none}.forge-switch ::slotted([slot=input]){position:absolute;z-index:1;appearance:none;outline:0;margin:0;inline-size:100%;block-size:100%;cursor:unset}:host([on]) .track{border-width:var(--_switch-track-on-border-width);border-color:var(--_switch-track-on-border-color);background-color:var(--_switch-track-on-color)}:host([on]) .handle{translate:calc(var(--_switch-track-width) - calc(var(--_switch-track-height)/ 2) * 2)}:host([on]) .handle::before{scale:var(--_switch-handle-on-scale);box-shadow:var(--_switch-handle-on-elevation);background-color:var(--_switch-handle-on-color)}:host([on]) .handle .icon__on{opacity:1;scale:var(--_switch-icon-on-scale)}:host([on]) .handle .icon__off{opacity:0;scale:0.4}:host([on]) forge-state-layer{--forge-state-layer-color:var(--_switch-state-layer-on-color)}:host(:not([disabled]):not([readonly])) .forge-switch .container:active .track{border-width:var(--_switch-track-active-off-border-width);border-color:var(--_switch-track-active-off-border-color);background-color:var(--_switch-track-active-off-color)}:host(:not([disabled]):not([readonly])) .forge-switch .container:active .handle::before{scale:var(--_switch-handle-active-off-scale);box-shadow:var(--_switch-handle-active-off-elevation);background-color:var(--_switch-handle-active-off-color)}:host(:not([disabled]):not([readonly])) .forge-switch .container:active .handle .icon{scale:var(--_switch-icon-active-off-scale);color:var(--_switch-icon-active-off-color);fill:var(--_switch-icon-active-off-color)}:host(:not([disabled]):not([readonly])[on]) .forge-switch .container:active .track{border-width:var(--_switch-track-active-on-border-width);border-color:var(--_switch-track-active-on-border-color);background-color:var(--_switch-track-active-on-color)}:host(:not([disabled]):not([readonly])[on]) .forge-switch .container:active .handle::before{scale:var(--_switch-handle-active-on-scale);box-shadow:var(--_switch-handle-active-on-elevation);background-color:var(--_switch-handle-active-on-color)}:host(:not([disabled]):not([readonly])[on]) .forge-switch .container:active .handle .icon{scale:var(--_switch-icon-active-on-scale);color:var(--_switch-icon-active-on-color);fill:var(--_switch-icon-active-on-color)}:host([dense]) .forge-switch{--_switch-current-state-layer-width:var(--_switch-state-layer-dense-width);--_switch-current-state-layer-height:var(--_switch-state-layer-dense-height)}:host([disabled]) .forge-switch .container{opacity:var(--_switch-disabled-opacity);cursor:not-allowed}:host([disabled]) .forge-switch .handle::before{box-shadow:none}:host([readonly]) .forge-switch .container{cursor:not-allowed}@media (prefers-reduced-motion){.switch{--_switch-animation-duration:var(--forge-switch-animation-duration, 0s)}}forge-state-layer{--forge-state-layer-color:var(--_switch-state-layer-off-color)}forge-focus-indicator{--forge-focus-indicator-shape:var(--_switch-track-shape);--forge-focus-indicator-outward-offset:0px}';
|
|
21
|
+
const styles = ':host{display:inline-block;outline:0;-webkit-tap-highlight-color:transparent}:host([hidden]){display:none}.forge-switch{--_switch-handle-size:var(--forge-switch-handle-size, 20px);--_switch-handle-scale:var(--forge-switch-handle-scale, 1);--_switch-handle-elevation:var(--forge-switch-handle-elevation, 0px 2px 1px -1px rgba(0, 0, 0, 0.2), 0px 1px 1px 0px rgba(0, 0, 0, 0.14), 0px 1px 3px 0px rgba(0, 0, 0, 0.12));--_switch-track-border-width:var(--forge-switch-track-border-width, 0);--_switch-track-border-color:var(--forge-switch-track-border-color, transparent);--_switch-icon-color:var(--forge-switch-icon-color, var(--forge-theme-on-tertiary, #ffffff));--_switch-icon-size:var(--forge-switch-icon-size, 16px);--_switch-icon-scale:var(--forge-switch-icon-scale, 1);--_switch-state-layer-size:var(--forge-switch-state-layer-size, 40px);--_switch-state-layer-dense-size:var(--forge-switch-state-layer-dense-size, 28px);--_switch-handle-on-color:var(--forge-switch-handle-on-color, var(--forge-theme-tertiary, #3d5afe));--_switch-handle-off-color:var(--forge-switch-handle-off-color, var(--forge-theme-surface-container-high, #9e9e9e));--_switch-handle-width:var(--forge-switch-handle-width, var(--_switch-handle-size));--_switch-handle-height:var(--forge-switch-handle-height, var(--_switch-handle-size));--_switch-handle-on-scale:var(--forge-switch-handle-on-scale, var(--_switch-handle-scale));--_switch-handle-off-scale:var(--forge-switch-handle-off-scale, var(--_switch-handle-scale));--_switch-handle-shape:var(--forge-switch-handle-shape, calc(var(--forge-shape-round, 50%) * var(--forge-shape-factor, 1)));--_switch-handle-on-elevation:var(--forge-switch-handle-on-elevation, var(--_switch-handle-elevation));--_switch-handle-off-elevation:var(--forge-switch-handle-off-elevation, var(--_switch-handle-elevation));--_switch-track-on-color:var(--forge-switch-track-on-color, var(--forge-theme-tertiary-container, #d0d7ff));--_switch-track-off-color:var(--forge-switch-track-off-color, var(--forge-theme-surface-container, #e0e0e0));--_switch-track-width:var(--forge-switch-track-width, 36px);--_switch-track-height:var(--forge-switch-track-height, 14px);--_switch-track-shape:var(--forge-switch-track-shape, calc(var(--forge-shape-full, 9999px) * var(--forge-shape-factor, 1)));--_switch-track-on-border-width:var(--forge-switch-track-on-border-width, var(--_switch-track-border-width));--_switch-track-off-border-width:var(--forge-switch-track-off-border-width, var(--_switch-track-border-width));--_switch-track-on-border-color:var(--forge-switch-track-on-border-color, var(--_switch-track-border-color));--_switch-track-off-border-color:var(--forge-switch-track-off-border-color, var(--_switch-track-border-color));--_switch-icon-on-color:var(--forge-switch-icon-on-color, var(--_switch-icon-color));--_switch-icon-off-color:var(--forge-switch-icon-off-color, var(--_switch-icon-color));--_switch-icon-on-size:var(--forge-switch-icon-on-size, var(--_switch-icon-size));--_switch-icon-off-size:var(--forge-switch-icon-off-size, var(--_switch-icon-size));--_switch-icon-on-scale:var(--forge-switch-icon-on-scale, var(--_switch-icon-scale));--_switch-icon-off-scale:var(--forge-switch-icon-off-scale, var(--_switch-icon-scale));--_switch-gap:var(--forge-switch-gap, 0);--_switch-justify:var(--forge-switch-justify, start);--_switch-direction:var(--forge-switch-direction, initial);--_switch-state-layer-width:var(--forge-switch-state-layer-width, var(--_switch-state-layer-size));--_switch-state-layer-height:var(--forge-switch-state-layer-height, var(--_switch-state-layer-size));--_switch-state-layer-on-color:var(--forge-switch-state-layer-on-color, var(--_switch-handle-on-color));--_switch-state-layer-off-color:var(--forge-switch-state-layer-off-color, var(--_switch-color));--_switch-state-layer-dense-width:var(--forge-switch-state-layer-dense-width, var(--_switch-state-layer-dense-size));--_switch-state-layer-dense-height:var(--forge-switch-state-layer-dense-height, var(--_switch-state-layer-dense-size));--_switch-disabled-opacity:var(--forge-switch-disabled-opacity, 0.38);--_switch-handle-active-on-color:var(--forge-switch-handle-active-on-color, var(--_switch-handle-on-color));--_switch-handle-active-off-color:var(--forge-switch-handle-active-off-color, var(--_switch-handle-off-color));--_switch-handle-active-scale:var(--forge-switch-handle-active-scale, 1.2);--_switch-handle-active-on-scale:var(--forge-switch-handle-active-on-scale, var(--_switch-handle-active-scale));--_switch-handle-active-off-scale:var(--forge-switch-handle-active-off-scale, var(--_switch-handle-active-scale));--_switch-handle-active-elevation:var(--forge-switch-handle-active-elevation, var(--_switch-handle-elevation));--_switch-handle-active-on-elevation:var(--forge-switch-handle-active-on-elevation, var(--_switch-handle-active-elevation));--_switch-handle-active-off-elevation:var(--forge-switch-handle-active-off-elevation, var(--_switch-handle-active-elevation));--_switch-track-active-on-color:var(--forge-switch-track-active-on-color, var(--_switch-track-on-color));--_switch-track-active-off-color:var(--forge-switch-track-active-off-color, var(--_switch-track-off-color));--_switch-track-active-on-border-width:var(--forge-switch-track-active-on-border-width, var(--_switch-track-on-border-width));--_switch-track-active-off-border-width:var(--forge-switch-track-active-off-border-width, var(--_switch-track-off-border-width));--_switch-track-active-on-border-color:var(--forge-switch-track-active-on-border-color, var(--_switch-track-on-border-color));--_switch-track-active-off-border-color:var(--forge-switch-track-active-off-border-color, var(--_switch-track-off-border-color));--_switch-icon-active-on-color:var(--forge-switch-icon-active-on-color, var(--_switch-icon-on-color));--_switch-icon-active-off-color:var(--forge-switch-icon-active-off-color, var(--_switch-icon-off-color));--_switch-icon-active-on-scale:var(--forge-switch-icon-active-on-scale, var(--_switch-icon-on-scale));--_switch-icon-active-off-scale:var(--forge-switch-icon-active-off-scale, var(--_switch-icon-off-scale));--_switch-animation-duration:var(--forge-switch-animation-duration, var(--forge-animation-duration-short2, 100ms));--_switch-animation-timing:var(--forge-switch-animation-timing, var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)));--_switch-active-animation-timing:var(--forge-switch-active-animation-timing, var(--forge-animation-easing-linear, cubic-bezier(0, 0, 1, 1)))}.forge-switch{display:flex;position:relative;flex-direction:var(--_switch-direction);flex-shrink:0;align-items:center;justify-content:var(--_switch-justify);gap:var(--_switch-gap);--_switch-current-state-layer-width:var(--_switch-state-layer-width);--_switch-current-state-layer-height:var(--_switch-state-layer-height)}.forge-switch .container{position:relative;align-items:center;display:flex;block-size:max(var(--_switch-handle-height),var(--_switch-track-height),var(--_switch-current-state-layer-height));cursor:pointer}.forge-switch .input{position:absolute;z-index:1;appearance:none;outline:0;margin:0;inline-size:100%;block-size:100%;cursor:unset}.forge-switch .track{transition-property:background-color,border-color,border-width;transition-duration:var(--_switch-animation-duration);transition-timing-function:var(--_switch-animation-timing);box-sizing:border-box;margin-inline:calc(max(var(--_switch-handle-width),var(--_switch-current-state-layer-width))/ 2 - calc(var(--_switch-track-height)/ 2));border-width:var(--_switch-track-off-border-width);border-color:var(--_switch-track-off-border-color);border-style:solid;border-radius:var(--_switch-track-shape);inline-size:var(--_switch-track-width);block-size:var(--_switch-track-height);background-color:var(--_switch-track-off-color)}.forge-switch .handle{position:absolute;justify-content:center;align-items:center;display:flex;transition-property:translate;transition-duration:var(--_switch-animation-duration);transition-timing-function:var(--_switch-animation-timing);border-radius:var(--_switch-handle-shape);inline-size:var(--_switch-current-state-layer-width);block-size:var(--_switch-current-state-layer-height)}.forge-switch .handle::before{content:\"\";position:relative;display:block;scale:var(--_switch-handle-off-scale);transition:background-color var(--_switch-animation-duration) var(--_switch-animation-timing),box-shadow var(--_switch-animation-duration) var(--_switch-animation-timing),scale var(--_switch-animation-duration) var(--_switch-active-animation-timing);box-shadow:var(--_switch-handle-off-elevation);border-radius:var(--_switch-handle-shape);inline-size:var(--_switch-handle-width);block-size:var(--_switch-handle-height);background-color:var(--_switch-handle-off-color)}.forge-switch .icon{position:absolute;align-items:center;justify-content:center;display:flex;transition-property:opacity,scale;transition-duration:var(--_switch-animation-duration);transition-timing-function:var(--_switch-animation-timing);inline-size:var(--_switch-icon-off-size);block-size:var(--_switch-icon-off-size);color:var(--_switch-icon-off-color);fill:var(--_switch-icon-off-color);font-size:var(--_switch-icon-off-size);--forge-icon-font-size:var(--_switch-icon-off-size)}.forge-switch .icon__on{--forge-icon-font-size:var(--_switch-icon-on-size);inline-size:var(--_switch-icon-on-size);block-size:var(--_switch-icon-on-size);color:var(--_switch-icon-on-color);fill:var(--_switch-icon-on-color);font-size:var(--_switch-icon-on-size);opacity:0;scale:0.4}.forge-switch .icon__off{opacity:1;scale:var(--_switch-icon-off-scale)}.forge-switch .label{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:var(--forge-typography-label2-font-family, var(--forge-typography-font-family, \"Roboto\", sans-serif));font-size:var(--forge-typography-label2-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-font-size-scale, .8125)));font-weight:var(--forge-typography-label2-font-weight,400);line-height:var(--forge-typography-label2-line-height, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-line-height-scale, 1.25)));letter-spacing:var(--forge-typography-label2-letter-spacing, .0096153846em);text-transform:var(--forge-typography-label2-text-transform,inherit);text-decoration:var(--forge-typography-label2-text-decoration,inherit)}.forge-switch .label:empty{display:none}.forge-switch .hidden{display:none}.forge-switch ::slotted([slot=input]){position:absolute;z-index:1;appearance:none;outline:0;margin:0;inline-size:100%;block-size:100%;cursor:unset}:host([on]) .track{border-width:var(--_switch-track-on-border-width);border-color:var(--_switch-track-on-border-color);background-color:var(--_switch-track-on-color)}:host([on]) .handle{translate:calc(var(--_switch-track-width) - calc(var(--_switch-track-height)/ 2) * 2)}:host([on]) .handle::before{scale:var(--_switch-handle-on-scale);box-shadow:var(--_switch-handle-on-elevation);background-color:var(--_switch-handle-on-color)}:host([on]) .handle .icon__on{opacity:1;scale:var(--_switch-icon-on-scale)}:host([on]) .handle .icon__off{opacity:0;scale:0.4}:host([on]) forge-state-layer{--forge-state-layer-color:var(--_switch-state-layer-on-color)}:host(:not([disabled]):not([readonly])) .forge-switch .container:active .track{border-width:var(--_switch-track-active-off-border-width);border-color:var(--_switch-track-active-off-border-color);background-color:var(--_switch-track-active-off-color)}:host(:not([disabled]):not([readonly])) .forge-switch .container:active .handle::before{scale:var(--_switch-handle-active-off-scale);box-shadow:var(--_switch-handle-active-off-elevation);background-color:var(--_switch-handle-active-off-color)}:host(:not([disabled]):not([readonly])) .forge-switch .container:active .handle .icon{scale:var(--_switch-icon-active-off-scale);color:var(--_switch-icon-active-off-color);fill:var(--_switch-icon-active-off-color)}:host(:not([disabled]):not([readonly])[on]) .forge-switch .container:active .track{border-width:var(--_switch-track-active-on-border-width);border-color:var(--_switch-track-active-on-border-color);background-color:var(--_switch-track-active-on-color)}:host(:not([disabled]):not([readonly])[on]) .forge-switch .container:active .handle::before{scale:var(--_switch-handle-active-on-scale);box-shadow:var(--_switch-handle-active-on-elevation);background-color:var(--_switch-handle-active-on-color)}:host(:not([disabled]):not([readonly])[on]) .forge-switch .container:active .handle .icon{scale:var(--_switch-icon-active-on-scale);color:var(--_switch-icon-active-on-color);fill:var(--_switch-icon-active-on-color)}:host([dense]) .forge-switch{--_switch-current-state-layer-width:var(--_switch-state-layer-dense-width);--_switch-current-state-layer-height:var(--_switch-state-layer-dense-height)}:host([disabled]) .forge-switch .container{opacity:var(--_switch-disabled-opacity);cursor:not-allowed}:host([disabled]) .forge-switch .handle::before{box-shadow:none}:host([readonly]) .forge-switch .container{cursor:not-allowed}@media (prefers-reduced-motion){.switch{--_switch-animation-duration:var(--forge-switch-animation-duration, 0s)}}forge-state-layer{--forge-state-layer-color:var(--_switch-state-layer-off-color)}forge-focus-indicator{--forge-focus-indicator-shape:var(--_switch-track-shape);--forge-focus-indicator-outward-offset:0px}';
|
|
22
22
|
/**
|
|
23
23
|
* @tag forge-switch
|
|
24
24
|
*
|
|
@@ -7,6 +7,7 @@ import { BaseAdapter, IBaseAdapter } from '../../core/base/base-adapter';
|
|
|
7
7
|
import type { ITabComponent } from './tab';
|
|
8
8
|
export interface ITabAdapter extends IBaseAdapter {
|
|
9
9
|
initialize(): void;
|
|
10
|
+
activateFocusIndicator(): void;
|
|
10
11
|
addInteractionListener(type: string, listener: EventListener): void;
|
|
11
12
|
setDisabled(value: boolean): void;
|
|
12
13
|
setSelected(value: boolean): void;
|
|
@@ -15,9 +16,11 @@ export interface ITabAdapter extends IBaseAdapter {
|
|
|
15
16
|
}
|
|
16
17
|
export declare class TabAdapter extends BaseAdapter<ITabComponent> implements ITabAdapter {
|
|
17
18
|
private readonly _tabIndicatorElement;
|
|
19
|
+
private readonly _focusIndicatorElement;
|
|
18
20
|
private readonly _stateLayerElement;
|
|
19
21
|
constructor(component: ITabComponent);
|
|
20
22
|
initialize(): void;
|
|
23
|
+
activateFocusIndicator(): void;
|
|
21
24
|
addInteractionListener(type: string, listener: EventListener): void;
|
|
22
25
|
setDisabled(value: boolean): void;
|
|
23
26
|
setSelected(value: boolean): void;
|
|
@@ -8,10 +8,12 @@ import { STATE_LAYER_CONSTANTS } from '../../state-layer';
|
|
|
8
8
|
import { BaseAdapter } from '../../core/base/base-adapter';
|
|
9
9
|
import { TAB_BAR_CONSTANTS } from '../tab-bar/tab-bar-constants';
|
|
10
10
|
import { TAB_CONSTANTS } from './tab-constants';
|
|
11
|
+
import { FOCUS_INDICATOR_CONSTANTS } from '../../focus-indicator';
|
|
11
12
|
export class TabAdapter extends BaseAdapter {
|
|
12
13
|
constructor(component) {
|
|
13
14
|
super(component);
|
|
14
15
|
this._tabIndicatorElement = getShadowElement(this._component, TAB_CONSTANTS.selectors.INDICATOR);
|
|
16
|
+
this._focusIndicatorElement = getShadowElement(this._component, FOCUS_INDICATOR_CONSTANTS.elementName);
|
|
15
17
|
this._stateLayerElement = getShadowElement(this._component, STATE_LAYER_CONSTANTS.elementName);
|
|
16
18
|
}
|
|
17
19
|
initialize() {
|
|
@@ -19,6 +21,9 @@ export class TabAdapter extends BaseAdapter {
|
|
|
19
21
|
this._component.setAttribute('role', 'tab');
|
|
20
22
|
this._component.setAttribute('aria-selected', this._component.selected ? 'true' : 'false');
|
|
21
23
|
}
|
|
24
|
+
activateFocusIndicator() {
|
|
25
|
+
this._focusIndicatorElement.active = true;
|
|
26
|
+
}
|
|
22
27
|
addInteractionListener(type, listener) {
|
|
23
28
|
this._component.addEventListener(type, listener);
|
|
24
29
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright Tyler Technologies, Inc.
|
|
4
4
|
* License: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { ExperimentalFocusOptions } from '../../constants';
|
|
6
7
|
import { ITabAdapter } from './tab-adapter';
|
|
7
8
|
export interface ITabCore {
|
|
8
9
|
disabled: boolean;
|
|
@@ -11,6 +12,7 @@ export interface ITabCore {
|
|
|
11
12
|
stacked: boolean;
|
|
12
13
|
secondary: boolean;
|
|
13
14
|
inverted: boolean;
|
|
15
|
+
setFocus(options?: ExperimentalFocusOptions): void;
|
|
14
16
|
}
|
|
15
17
|
export declare class TabCore implements ITabCore {
|
|
16
18
|
private _adapter;
|
|
@@ -24,6 +26,7 @@ export declare class TabCore implements ITabCore {
|
|
|
24
26
|
private _keydownListener;
|
|
25
27
|
constructor(_adapter: ITabAdapter);
|
|
26
28
|
initialize(): void;
|
|
29
|
+
setFocus(options?: ExperimentalFocusOptions): void;
|
|
27
30
|
private _onClick;
|
|
28
31
|
private _onKeydown;
|
|
29
32
|
private _dispatchSelectEvent;
|
package/esm/tabs/tab/tab-core.js
CHANGED
|
@@ -22,6 +22,11 @@ export class TabCore {
|
|
|
22
22
|
this._adapter.addInteractionListener('click', this._clickListener);
|
|
23
23
|
this._adapter.addInteractionListener('keydown', this._keydownListener);
|
|
24
24
|
}
|
|
25
|
+
setFocus(options) {
|
|
26
|
+
if (options?.focusVisible) {
|
|
27
|
+
this._adapter.activateFocusIndicator();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
25
30
|
_onClick() {
|
|
26
31
|
if (this._disabled || this._selected) {
|
|
27
32
|
return;
|
package/esm/tabs/tab/tab.d.ts
CHANGED
|
@@ -4,13 +4,16 @@
|
|
|
4
4
|
* License: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { BaseComponent, IBaseComponent } from '../../core/base/base-component';
|
|
7
|
+
import { ExperimentalFocusOptions } from '../../constants';
|
|
7
8
|
export interface ITabComponent extends IBaseComponent {
|
|
8
9
|
disabled: boolean;
|
|
9
10
|
selected: boolean;
|
|
10
11
|
vertical: boolean;
|
|
11
12
|
stacked: boolean;
|
|
13
|
+
/** @deprecated This will be removed in a future version */
|
|
12
14
|
secondary: boolean;
|
|
13
15
|
inverted: boolean;
|
|
16
|
+
focus(options?: ExperimentalFocusOptions): void;
|
|
14
17
|
}
|
|
15
18
|
declare global {
|
|
16
19
|
interface HTMLElementTagNameMap {
|
|
@@ -37,7 +40,7 @@ declare global {
|
|
|
37
40
|
* @attribute [selected=false] - The selected state of the tab.
|
|
38
41
|
* @attribute [vertical=false] - Controls whether the tab is vertical or horizontal.
|
|
39
42
|
* @attribute [stacked=false] - Controls whether the tab is taller to allow for slotted leading/trailing elements.
|
|
40
|
-
* @attribute [secondary=false] - Controls whether the tab is styled as secondary tab navigation.
|
|
43
|
+
* @attribute [secondary=false] - Deprecated. Controls whether the tab is styled as secondary tab navigation.
|
|
41
44
|
* @attribute [inverted=false] - Controls whether the tab indicator is rendered on the opposite side of the tab.
|
|
42
45
|
*
|
|
43
46
|
* @event {CustomEvent<void>} forge-tab-select - Dispatched when the tab is selected. This event bubbles and it can be useful to capture it on the `<forge-tab-bar>` element.
|
|
@@ -53,8 +56,6 @@ declare global {
|
|
|
53
56
|
* @cssproperty --forge-tab-indicator-height - The height of the active tab indicator.
|
|
54
57
|
* @cssproperty --forge-tab-indicator-shape - The shape of the active tab indicator.
|
|
55
58
|
* @cssproperty --forge-tab-vertical-indicator-shape - The shape of the active tab indicator when vertical.
|
|
56
|
-
* @cssproperty --forge-tab-secondary-indicator-height - The height of the secondary tab indicator.
|
|
57
|
-
* @cssproperty --forge-tab-secondary-indicator-shape - The shape of the secondary tab indicator.
|
|
58
59
|
* @cssproperty --forge-tab-inverted-indicator-shape - The shape of the active tab indicator when inverted.
|
|
59
60
|
* @cssproperty --forge-tab-vertical-inverted-indicator-shape - The shape of the active tab indicator when vertical and inverted.
|
|
60
61
|
* @cssproperty --forge-tab-container-color - The color of the tab container.
|
|
@@ -65,7 +66,6 @@ declare global {
|
|
|
65
66
|
* @cssproperty --forge-tab-content-padding - The padding value for both block and inline of the tab content.
|
|
66
67
|
* @cssproperty --forge-tab-content-padding-block - The block padding of the tab content.
|
|
67
68
|
* @cssproperty --forge-tab-content-padding-inline - The inline padding of the tab content.
|
|
68
|
-
* @cssproperty --forge-tab-content-padding-inline-secondary - The inline padding of the tab content when secondary.
|
|
69
69
|
* @cssproperty --forge-tab-active-focus-icon-color - The color of the icon when the tab is active and focused.
|
|
70
70
|
* @cssproperty --forge-tab-active-hover-icon-color - The color of the icon when the tab is active and hovered.
|
|
71
71
|
* @cssproperty --forge-tab-active-icon-color - The color of the icon when the tab is active.
|
|
@@ -103,6 +103,8 @@ export declare class TabComponent extends BaseComponent implements ITabComponent
|
|
|
103
103
|
selected: boolean;
|
|
104
104
|
vertical: boolean;
|
|
105
105
|
stacked: boolean;
|
|
106
|
+
/** @deprecated This will be removed in a future version */
|
|
106
107
|
secondary: boolean;
|
|
107
108
|
inverted: boolean;
|
|
109
|
+
focus(options?: ExperimentalFocusOptions): void;
|
|
108
110
|
}
|
package/esm/tabs/tab/tab.js
CHANGED
|
@@ -12,7 +12,7 @@ import { BaseComponent } from '../../core/base/base-component';
|
|
|
12
12
|
import { FocusIndicatorComponent } from '../../focus-indicator/focus-indicator';
|
|
13
13
|
import { StateLayerComponent } from '../../state-layer/state-layer';
|
|
14
14
|
const template = '<template><div class=\"forge-tab\" part=\"container\"><span class=\"content\" part=\"content\"><slot name=\"start\"><slot name=\"leading\"></slot></slot><span class=\"label\" part=\"label\"><slot></slot></span><slot name=\"end\"><slot name=\"trailing\"></slot></slot><span class=\"indicator\" part=\"indicator\"></span></span><forge-state-layer exportparts=\"surface:state-layer\" target=\":host\"></forge-state-layer><forge-focus-indicator part=\"focus-indicator\" target=\":host\" inward></forge-focus-indicator></div></template>';
|
|
15
|
-
const styles = ':host{display:inline-flex;outline:0;-webkit-tap-highlight-color:transparent;vertical-align:middle}:host([hidden]){display:none}.forge-tab{--_tab-active-color:var(--forge-tab-active-color, var(--forge-theme-primary, #3f51b5));--_tab-inactive-color:var(--forge-tab-inactive-color, var(--forge-theme-text-medium, rgba(0, 0, 0, 0.6)));--_tab-height:var(--forge-tab-height, 48px);--_tab-stacked-height:var(--forge-tab-stacked-height, 64px);--_tab-padding-block:var(--forge-tab-padding-block, 0);--_tab-padding-inline:var(--forge-tab-padding-inline,
|
|
15
|
+
const styles = ':host{display:inline-flex;outline:0;-webkit-tap-highlight-color:transparent;vertical-align:middle}:host([hidden]){display:none}.forge-tab{--_tab-active-color:var(--forge-tab-active-color, var(--forge-theme-primary, #3f51b5));--_tab-inactive-color:var(--forge-tab-inactive-color, var(--forge-theme-text-medium, rgba(0, 0, 0, 0.6)));--_tab-height:var(--forge-tab-height, 48px);--_tab-stacked-height:var(--forge-tab-stacked-height, 64px);--_tab-padding-block:var(--forge-tab-padding-block, 0);--_tab-padding-inline:var(--forge-tab-padding-inline, 0);--_tab-disabled-opacity:var(--forge-tab-disabled-opacity, 0.38);--_tab-indicator-color:var(--forge-tab-indicator-color, var(--_tab-active-color));--_tab-indicator-height:var(--forge-tab-indicator-height, 3px);--_tab-indicator-shape:var(--forge-tab-indicator-shape, 3px 3px 0 0);--_tab-vertical-indicator-shape:var(--forge-tab-vertical-indicator-shape, 3px 0 0 3px);--_tab-secondary-indicator-height:var(--forge-tab-secondary-indicator-height, 2px);--_tab-secondary-indicator-shape:var(--forge-tab-secondary-indicator-shape, 0);--_tab-inverted-indicator-shape:var(--forge-tab-inverted-indicator-shape, 0 0 3px 3px);--_tab-vertical-inverted-indicator-shape:var(--forge-tab-vertical-inverted-indicator-shape, 0 3px 3px 0);--_tab-container-color:var(--forge-tab-container-color, transparent);--_tab-container-height:var(--forge-tab-container-height, var(--_tab-height));--_tab-container-shape:var(--forge-tab-container-shape, 0);--_tab-content-height:var(--forge-tab-content-height, var(--_tab-height));--_tab-content-spacing:var(--forge-tab-content-spacing, var(--forge-spacing-xsmall, 8px));--_tab-content-padding:var(--forge-tab-content-padding, var(--forge-spacing-xxsmall, 4px));--_tab-content-padding-block:var(--forge-tab-content-padding-block, var(--_tab-content-padding));--_tab-content-padding-inline:var(--forge-tab-content-padding-inline, var(--forge-spacing-medium, 16px));--_tab-content-padding-inline-secondary:var(--forge-tab-content-padding-inline-secondary, var(--forge-spacing-medium, 16px));--_tab-active-focus-icon-color:var(--forge-tab-active-focus-icon-color, var(--_tab-active-color));--_tab-active-hover-icon-color:var(--forge-tab-active-hover-icon-color, var(--_tab-active-color));--_tab-active-icon-color:var(--forge-tab-active-icon-color, var(--_tab-active-color));--_tab-active-pressed-icon-color:var(--forge-tab-active-pressed-icon-color, var(--_tab-active-color));--_tab-icon-size:var(--forge-tab-icon-size, 24px);--_tab-focus-icon-color:var(--forge-tab-focus-icon-color, var(--_tab-inactive-color));--_tab-hover-icon-color:var(--forge-tab-hover-icon-color, var(--_tab-inactive-color));--_tab-icon-color:var(--forge-tab-icon-color, var(--_tab-inactive-color));--_tab-pressed-icon-color:var(--forge-tab-pressed-icon-color, var(--_tab-inactive-color));--_tab-active-focus-label-text-color:var(--forge-tab-active-focus-label-text-color, var(--_tab-active-color));--_tab-active-hover-label-text-color:var(--forge-tab-active-hover-label-text-color, var(--_tab-active-color));--_tab-active-label-text-color:var(--forge-tab-active-label-text-color, var(--_tab-active-color));--_tab-active-pressed-label-text-color:var(--forge-tab-active-pressed-label-text-color, var(--_tab-active-color));--_tab-focus-label-text-color:var(--forge-tab-focus-label-text-color, var(--_tab-inactive-color));--_tab-hover-label-text-color:var(--forge-tab-hover-label-text-color, var(--_tab-inactive-color));--_tab-label-text-color:var(--forge-tab-label-text-color, var(--_tab-inactive-color));--_tab-pressed-label-text-color:var(--forge-tab-pressed-label-text-color, var(--_tab-inactive-color))}.forge-tab{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:var(--forge-typography-button-font-family, var(--forge-typography-font-family, \"Roboto\", sans-serif));font-size:var(--forge-typography-button-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-button-font-size-scale, .875)));font-weight:var(--forge-typography-button-font-weight,500);line-height:var(--forge-typography-button-line-height, normal);letter-spacing:var(--forge-typography-button-letter-spacing, .0714285714em);text-transform:var(--forge-typography-button-text-transform,inherit);text-decoration:var(--forge-typography-button-text-decoration,inherit);display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;border:none;outline:0;user-select:none;-webkit-appearance:none;vertical-align:middle;background:0 0;text-decoration:none;width:100%;position:relative;padding-block:var(--_tab-padding-block);padding-inline:var(--_tab-padding-inline);margin:0;z-index:0;background-color:var(--_tab-container-color);color:var(--_tab-label-text-color);min-height:var(--_tab-container-height)}.forge-tab::-moz-focus-inner{padding:0;border:0}.forge-tab ::slotted([slot=leading]),.forge-tab ::slotted([slot=trailing]){display:inline-flex;position:relative;writing-mode:horizontal-tb;fill:currentColor;color:var(--_tab-icon-color);font-size:var(--_tab-icon-size);width:var(--_tab-icon-size);height:var(--_tab-icon-size)}.forge-tab:hover{color:var(--_tab-hover-label-text-color);cursor:pointer}.forge-tab:hover ::slotted([slot=leading]),.forge-tab:hover ::slotted([slot=trailing]){color:var(--_tab-hover-icon-color)}.forge-tab .content{position:relative;box-sizing:border-box;display:inline-flex;flex-direction:row;align-items:center;justify-content:center;white-space:nowrap;transition:150ms color linear;max-height:calc(var(--_tab-content-height) + 2 * var(--_tab-content-padding-block));min-height:var(--_tab-content-height);width:100%;padding-block:var(--_tab-content-padding-block);padding-inline:var(--_tab-content-padding-inline);gap:var(--_tab-content-spacing)}.forge-tab .content .label{display:inline-block;line-height:1}.forge-tab .indicator{position:absolute;box-sizing:border-box;z-index:-1;transform-origin:bottom left;background:var(--_tab-indicator-color);border-radius:var(--_tab-indicator-shape);height:var(--_tab-indicator-height);min-width:100%;inset:auto 0 0;opacity:0}::slotted(*),:host{white-space:nowrap}forge-focus-indicator{--forge-focus-indicator-color:var(--_tab-active-color);--forge-focus-indicator-shape:8px}forge-state-layer{--forge-state-layer-color:var(--_tab-inactive-color)}:host(:focus) .forge-tab{color:var(--_tab-focus-label-text-color)}:host(:focus) .forge-tab ::slotted([slot=leading]),:host(:focus) .forge-tab ::slotted([slot=trailing]){color:var(--_tab-focus-icon-color)}:host(:active) .forge-tab{color:var(--_tab-pressed-label-text-color);outline:0}:host(:active) .forge-tab ::slotted([slot=leading]),:host(:active) .forge-tab ::slotted([slot=trailing]){color:var(--_tab-pressed-icon-color)}:host([disabled]){cursor:not-allowed}:host([disabled]) .forge-tab{opacity:var(--_tab-disabled-opacity);pointer-events:none}:host([selected]) .forge-tab{color:var(--_tab-active-label-text-color)}:host([selected]) .forge-tab ::slotted([slot=end]),:host([selected]) .forge-tab ::slotted([slot=leading]),:host([selected]) .forge-tab ::slotted([slot=start]),:host([selected]) .forge-tab ::slotted([slot=trailing]){color:var(--_tab-active-icon-color)}:host([selected]) .forge-tab:hover{color:var(--_tab-active-hover-label-text-color)}:host([selected]) .forge-tab:hover ::slotted([slot=end]),:host([selected]) .forge-tab:hover ::slotted([slot=leading]),:host([selected]) .forge-tab:hover ::slotted([slot=start]),:host([selected]) .forge-tab:hover ::slotted([slot=trailing]){color:var(--_tab-active-hover-icon-color)}:host([selected]) .forge-tab .indicator{opacity:1}:host([selected]) forge-state-layer{--forge-state-layer-color:var(--_tab-active-color)}:host([selected]:not([vertical])) forge-focus-indicator{--forge-focus-indicator-offset-block:0 calc(var(--_tab-indicator-height) + 1px)}:host([selected]:focus) .forge-tab{color:var(--_tab-active-focus-label-text-color)}:host([selected]:focus) .forge-tab ::slotted([slot=leading]),:host([selected]:focus) .forge-tab ::slotted([slot=trailing]){color:var(--_tab-active-focus-icon-color)}:host([selected]:active) .forge-tab{color:var(--_tab-active-pressed-label-text-color)}:host([selected]:active) .forge-tab ::slotted([slot=leading]),:host([selected]:active) .forge-tab ::slotted([slot=trailing]){color:var(--_tab-active-pressed-icon-color)}:host([stacked]) .forge-tab{--_tab-height:var(--_tab-stacked-height)}:host([stacked]) .forge-tab .content{max-height:none;flex-direction:column;height:100%}:host([vertical]) .forge-tab{--_tab-padding-inline:var(--forge-tab-padding-inline, 0);width:100%;flex-direction:row;border-bottom:none}:host([vertical]) .forge-tab .content{width:100%;min-height:100%}:host([vertical]) .forge-tab .indicator{height:100%;min-width:var(--_tab-indicator-height);inset:0 0 0 auto}:host([vertical]) forge-focus-indicator{--forge-focus-indicator-offset-inline:0 calc(var(--_tab-indicator-height) + 1px)}:host([vertical]) .forge-tab{--_tab-indicator-shape:var(--_tab-vertical-indicator-shape)}:host([inverted]) .forge-tab{--_tab-indicator-shape:var(--_tab-inverted-indicator-shape)}:host([inverted]) .indicator{inset:0 0 auto;transform-origin:top left}:host([inverted][vertical]) .forge-tab{--_tab-indicator-shape:var(--_tab-vertical-inverted-indicator-shape)}:host([inverted][vertical]) .indicator{inset:0 auto 0 0}';
|
|
16
16
|
/**
|
|
17
17
|
* @tag forge-tab
|
|
18
18
|
*
|
|
@@ -30,7 +30,7 @@ const styles = ':host{display:inline-flex;outline:0;-webkit-tap-highlight-color:
|
|
|
30
30
|
* @attribute [selected=false] - The selected state of the tab.
|
|
31
31
|
* @attribute [vertical=false] - Controls whether the tab is vertical or horizontal.
|
|
32
32
|
* @attribute [stacked=false] - Controls whether the tab is taller to allow for slotted leading/trailing elements.
|
|
33
|
-
* @attribute [secondary=false] - Controls whether the tab is styled as secondary tab navigation.
|
|
33
|
+
* @attribute [secondary=false] - Deprecated. Controls whether the tab is styled as secondary tab navigation.
|
|
34
34
|
* @attribute [inverted=false] - Controls whether the tab indicator is rendered on the opposite side of the tab.
|
|
35
35
|
*
|
|
36
36
|
* @event {CustomEvent<void>} forge-tab-select - Dispatched when the tab is selected. This event bubbles and it can be useful to capture it on the `<forge-tab-bar>` element.
|
|
@@ -46,8 +46,6 @@ const styles = ':host{display:inline-flex;outline:0;-webkit-tap-highlight-color:
|
|
|
46
46
|
* @cssproperty --forge-tab-indicator-height - The height of the active tab indicator.
|
|
47
47
|
* @cssproperty --forge-tab-indicator-shape - The shape of the active tab indicator.
|
|
48
48
|
* @cssproperty --forge-tab-vertical-indicator-shape - The shape of the active tab indicator when vertical.
|
|
49
|
-
* @cssproperty --forge-tab-secondary-indicator-height - The height of the secondary tab indicator.
|
|
50
|
-
* @cssproperty --forge-tab-secondary-indicator-shape - The shape of the secondary tab indicator.
|
|
51
49
|
* @cssproperty --forge-tab-inverted-indicator-shape - The shape of the active tab indicator when inverted.
|
|
52
50
|
* @cssproperty --forge-tab-vertical-inverted-indicator-shape - The shape of the active tab indicator when vertical and inverted.
|
|
53
51
|
* @cssproperty --forge-tab-container-color - The color of the tab container.
|
|
@@ -58,7 +56,6 @@ const styles = ':host{display:inline-flex;outline:0;-webkit-tap-highlight-color:
|
|
|
58
56
|
* @cssproperty --forge-tab-content-padding - The padding value for both block and inline of the tab content.
|
|
59
57
|
* @cssproperty --forge-tab-content-padding-block - The block padding of the tab content.
|
|
60
58
|
* @cssproperty --forge-tab-content-padding-inline - The inline padding of the tab content.
|
|
61
|
-
* @cssproperty --forge-tab-content-padding-inline-secondary - The inline padding of the tab content when secondary.
|
|
62
59
|
* @cssproperty --forge-tab-active-focus-icon-color - The color of the icon when the tab is active and focused.
|
|
63
60
|
* @cssproperty --forge-tab-active-hover-icon-color - The color of the icon when the tab is active and hovered.
|
|
64
61
|
* @cssproperty --forge-tab-active-icon-color - The color of the icon when the tab is active.
|
|
@@ -120,6 +117,10 @@ let TabComponent = class TabComponent extends BaseComponent {
|
|
|
120
117
|
break;
|
|
121
118
|
}
|
|
122
119
|
}
|
|
120
|
+
focus(options) {
|
|
121
|
+
super.focus(options);
|
|
122
|
+
this._core.setFocus(options);
|
|
123
|
+
}
|
|
123
124
|
};
|
|
124
125
|
__decorate([
|
|
125
126
|
coreProperty()
|
|
@@ -94,7 +94,7 @@ export class TabBarCore {
|
|
|
94
94
|
this._selectTab(this._tabs[index]);
|
|
95
95
|
}
|
|
96
96
|
else {
|
|
97
|
-
this._tabs[index].focus({ preventScroll: true });
|
|
97
|
+
this._tabs[index].focus({ preventScroll: true, focusVisible: true });
|
|
98
98
|
await this._adapter.tryScrollTabIntoView(this._tabs[index]);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
@@ -11,6 +11,7 @@ export interface ITabBarComponent extends IBaseComponent {
|
|
|
11
11
|
vertical: boolean;
|
|
12
12
|
clustered: boolean;
|
|
13
13
|
stacked: boolean;
|
|
14
|
+
/** @deprecated This will be removed in a future version */
|
|
14
15
|
secondary: boolean;
|
|
15
16
|
inverted: boolean;
|
|
16
17
|
autoActivate: boolean;
|
|
@@ -43,7 +44,7 @@ declare global {
|
|
|
43
44
|
* @property {boolean} [vertical=false] - Controls whether the tab bar is vertical or horizontal.
|
|
44
45
|
* @property {boolean} [clustered=false] - Controls whether the tabs stretch the full width of their container or cluster together at their minimum width.
|
|
45
46
|
* @property {boolean} [stacked=false] - Controls whether the tabs are taller to allow for slotted leading/trailing elements.
|
|
46
|
-
* @property {boolean} [secondary=false] - Controls whether the tabs are styled as secondary tab navigation.
|
|
47
|
+
* @property {boolean} [secondary=false] - Deprecated. Controls whether the tabs are styled as secondary tab navigation.
|
|
47
48
|
* @property {boolean} [inverted=false] - Controls whether the tabs are rendered inverted (tab indicator at top instead of bottom).
|
|
48
49
|
* @property {boolean} [autoActivate=false] - Controls whether the tabs are automatically activated when receiving focus.
|
|
49
50
|
* @property {boolean} [scrollButtons=false] - Controls whether scroll buttons are displayed when the tabs overflow their container.
|
|
@@ -53,7 +54,7 @@ declare global {
|
|
|
53
54
|
* @attribute {boolean} [vertical=false] - Controls whether the tab bar is vertical or horizontal.
|
|
54
55
|
* @attribute {boolean} [clustered=false] - Controls whether the tabs stretch the full width of their container or cluster together at their minimum width.
|
|
55
56
|
* @attribute {boolean} [stacked=false] - Controls whether the tabs are taller to allow for slotted leading/trailing elements.
|
|
56
|
-
* @attribute {boolean} [secondary=false] - Controls whether the tabs are styled as secondary tab navigation.
|
|
57
|
+
* @attribute {boolean} [secondary=false] - Deprecated. Controls whether the tabs are styled as secondary tab navigation.
|
|
57
58
|
* @attribute {boolean} [auto-activate=false] - Controls whether the tabs are automatically activated when receiving focus.
|
|
58
59
|
* @attribute {boolean} [scroll-buttons=false] - Controls whether scroll buttons are displayed when the tabs overflow their container.
|
|
59
60
|
* @attribute {string} [data-aria-label] - The ARIA label to forward to the internal tablist element.
|
|
@@ -80,6 +81,7 @@ export declare class TabBarComponent extends BaseComponent implements ITabBarCom
|
|
|
80
81
|
vertical: boolean;
|
|
81
82
|
clustered: boolean;
|
|
82
83
|
stacked: boolean;
|
|
84
|
+
/** @deprecated This will be removed in a future version */
|
|
83
85
|
secondary: boolean;
|
|
84
86
|
inverted: boolean;
|
|
85
87
|
autoActivate: boolean;
|
|
@@ -14,7 +14,7 @@ import { TAB_BAR_CONSTANTS } from './tab-bar-constants';
|
|
|
14
14
|
import { TabBarCore } from './tab-bar-core';
|
|
15
15
|
import { tylIconKeyboardArrowLeft, tylIconKeyboardArrowRight, tylIconKeyboardArrowUp, tylIconKeyboardArrowDown } from '@tylertech/tyler-icons/standard';
|
|
16
16
|
const template = '<template><div class=\"forge-tab-bar\" part=\"container\"><div role=\"tablist\" class=\"scroll-container\" part=\"scroll-container\"><slot></slot></div></div></template>';
|
|
17
|
-
const styles = ':host{position:relative;display:block}:host([hidden]){display:none}.forge-tab-bar{--_tab-bar-justify:var(--forge-tab-bar-justify, space-between);--_tab-bar-stretch:var(--forge-tab-bar-stretch, 1);--_tab-bar-divider-color:var(--forge-tab-bar-divider-color, var(--forge-theme-outline, #e0e0e0));--_tab-bar-divider-thickness:var(--forge-tab-bar-divider-thickness, 1px)}.forge-tab-bar{position:relative;display:grid;grid-template-columns:auto 1fr auto;max-width:100%;max-height:100%;align-items:center;border-bottom:var(--_tab-bar-divider-thickness) solid var(--_tab-bar-divider-color)}.scroll-container{position:relative;display:flex;justify-content:var(--_tab-bar-justify);align-items:flex-end;box-sizing:border-box;overflow:auto;scroll-behavior:smooth;scrollbar-width:none;grid-column:2}.scroll-container::-webkit-scrollbar{display:none}::slotted(*){flex:var(--_tab-bar-stretch)}::slotted([selected]){z-index:1}forge-icon-button{--forge-icon-button-shape-squared:0px}:host([vertical]) .forge-tab-bar{grid-template-columns:none;grid-template-rows:auto 1fr auto;align-items:initial;border-bottom:none;border-right:var(--_tab-bar-divider-thickness) solid var(--_tab-bar-divider-color);height:100%}:host([vertical]) .scroll-container{display:inline-flex;flex-direction:column;align-items:stretch;gap:0;grid-column:auto;grid-row:2}:host([vertical]) .scroll-button{justify-self:center}:host([inverted]:not([vertical])) .forge-tab-bar{border-bottom:none;border-top:variale(divider-thickness) solid var(--_tab-bar-divider-color)}:host([inverted][vertical]) .forge-tab-bar{border-bottom:none;border-top:var(--_tab-bar-divider-thickness) solid var(--_tab-bar-divider-color)}:host([clustered]) .forge-tab-bar{--_tab-bar-justify:var(--forge-tab-bar-justify, flex-start);--_tab-bar-stretch:var(--forge-tab-bar-stretch, 0)}:host([clustered=start]) .forge-tab-bar{--_tab-bar-justify:var(--forge-tab-bar-justify, flex-start)}:host([clustered=center]) .forge-tab-bar{--_tab-bar-justify:var(--forge-tab-bar-justify, center)}:host([clustered=end]) .forge-tab-bar{--_tab-bar-justify:var(--forge-tab-bar-justify, flex-end)}';
|
|
17
|
+
const styles = ':host{position:relative;display:block}:host([hidden]){display:none}.forge-tab-bar{--_tab-bar-justify:var(--forge-tab-bar-justify, space-between);--_tab-bar-stretch:var(--forge-tab-bar-stretch, 1);--_tab-bar-divider-color:var(--forge-tab-bar-divider-color, var(--forge-theme-outline, #e0e0e0));--_tab-bar-divider-thickness:var(--forge-tab-bar-divider-thickness, 1px)}.forge-tab-bar{position:relative;display:grid;grid-template-columns:auto 1fr auto;max-width:100%;max-height:100%;align-items:center;border-bottom:var(--_tab-bar-divider-thickness) solid var(--_tab-bar-divider-color)}.scroll-container{position:relative;display:flex;justify-content:var(--_tab-bar-justify);align-items:flex-end;box-sizing:border-box;overflow:auto;scroll-behavior:smooth;scrollbar-width:none;grid-column:2}.scroll-container::-webkit-scrollbar{display:none}::slotted(*){flex:var(--_tab-bar-stretch);align-self:stretch}::slotted([selected]){z-index:1}forge-icon-button{--forge-icon-button-shape-squared:0px}:host([vertical]) .forge-tab-bar{grid-template-columns:none;grid-template-rows:auto 1fr auto;align-items:initial;border-bottom:none;border-right:var(--_tab-bar-divider-thickness) solid var(--_tab-bar-divider-color);height:100%}:host([vertical]) .scroll-container{display:inline-flex;flex-direction:column;align-items:stretch;gap:0;grid-column:auto;grid-row:2}:host([vertical]) .scroll-button{justify-self:center}:host([inverted]:not([vertical])) .forge-tab-bar{border-bottom:none;border-top:variale(divider-thickness) solid var(--_tab-bar-divider-color)}:host([inverted][vertical]) .forge-tab-bar{border-bottom:none;border-top:var(--_tab-bar-divider-thickness) solid var(--_tab-bar-divider-color)}:host([clustered]) .forge-tab-bar{--_tab-bar-justify:var(--forge-tab-bar-justify, flex-start);--_tab-bar-stretch:var(--forge-tab-bar-stretch, 0)}:host([clustered=start]) .forge-tab-bar{--_tab-bar-justify:var(--forge-tab-bar-justify, flex-start)}:host([clustered=center]) .forge-tab-bar{--_tab-bar-justify:var(--forge-tab-bar-justify, center)}:host([clustered=end]) .forge-tab-bar{--_tab-bar-justify:var(--forge-tab-bar-justify, flex-end)}';
|
|
18
18
|
/**
|
|
19
19
|
* @tag forge-tab-bar
|
|
20
20
|
*
|
|
@@ -34,7 +34,7 @@ const styles = ':host{position:relative;display:block}:host([hidden]){display:no
|
|
|
34
34
|
* @property {boolean} [vertical=false] - Controls whether the tab bar is vertical or horizontal.
|
|
35
35
|
* @property {boolean} [clustered=false] - Controls whether the tabs stretch the full width of their container or cluster together at their minimum width.
|
|
36
36
|
* @property {boolean} [stacked=false] - Controls whether the tabs are taller to allow for slotted leading/trailing elements.
|
|
37
|
-
* @property {boolean} [secondary=false] - Controls whether the tabs are styled as secondary tab navigation.
|
|
37
|
+
* @property {boolean} [secondary=false] - Deprecated. Controls whether the tabs are styled as secondary tab navigation.
|
|
38
38
|
* @property {boolean} [inverted=false] - Controls whether the tabs are rendered inverted (tab indicator at top instead of bottom).
|
|
39
39
|
* @property {boolean} [autoActivate=false] - Controls whether the tabs are automatically activated when receiving focus.
|
|
40
40
|
* @property {boolean} [scrollButtons=false] - Controls whether scroll buttons are displayed when the tabs overflow their container.
|
|
@@ -44,7 +44,7 @@ const styles = ':host{position:relative;display:block}:host([hidden]){display:no
|
|
|
44
44
|
* @attribute {boolean} [vertical=false] - Controls whether the tab bar is vertical or horizontal.
|
|
45
45
|
* @attribute {boolean} [clustered=false] - Controls whether the tabs stretch the full width of their container or cluster together at their minimum width.
|
|
46
46
|
* @attribute {boolean} [stacked=false] - Controls whether the tabs are taller to allow for slotted leading/trailing elements.
|
|
47
|
-
* @attribute {boolean} [secondary=false] - Controls whether the tabs are styled as secondary tab navigation.
|
|
47
|
+
* @attribute {boolean} [secondary=false] - Deprecated. Controls whether the tabs are styled as secondary tab navigation.
|
|
48
48
|
* @attribute {boolean} [auto-activate=false] - Controls whether the tabs are automatically activated when receiving focus.
|
|
49
49
|
* @attribute {boolean} [scroll-buttons=false] - Controls whether scroll buttons are displayed when the tabs overflow their container.
|
|
50
50
|
* @attribute {string} [data-aria-label] - The ARIA label to forward to the internal tablist element.
|
|
@@ -8,7 +8,7 @@ import { BaseAdapter } from '../core/base/base-adapter';
|
|
|
8
8
|
import { ITimeInputMaskOptions } from '../core/mask/time-input-mask';
|
|
9
9
|
import { IListDropdownConfig, IListDropdownOption } from '../list-dropdown/list-dropdown-constants';
|
|
10
10
|
export interface ITimePickerAdapter extends BaseAdapter<ITimePickerComponent> {
|
|
11
|
-
readonly inputElement: HTMLInputElement;
|
|
11
|
+
readonly inputElement: HTMLInputElement | undefined;
|
|
12
12
|
initialize(): void;
|
|
13
13
|
initializeMask(options: ITimeInputMaskOptions): void;
|
|
14
14
|
destroy(): void;
|
|
@@ -50,7 +50,7 @@ export declare class TimePickerAdapter extends BaseAdapter<ITimePickerComponent>
|
|
|
50
50
|
private _listDropdown?;
|
|
51
51
|
private _targetElement?;
|
|
52
52
|
constructor(component: ITimePickerComponent);
|
|
53
|
-
get inputElement(): HTMLInputElement;
|
|
53
|
+
get inputElement(): HTMLInputElement | undefined;
|
|
54
54
|
initialize(): void;
|
|
55
55
|
initializeMask(options: ITimeInputMaskOptions): void;
|
|
56
56
|
destroy(): void;
|
|
@@ -24,7 +24,9 @@ export class TimePickerAdapter extends BaseAdapter {
|
|
|
24
24
|
}
|
|
25
25
|
initializeMask(options) {
|
|
26
26
|
this.destroyMask();
|
|
27
|
-
|
|
27
|
+
if (this._inputElement) {
|
|
28
|
+
this._inputMask = new TimeInputMask(this._inputElement, options);
|
|
29
|
+
}
|
|
28
30
|
}
|
|
29
31
|
destroy() {
|
|
30
32
|
this._targetElement = undefined;
|
|
@@ -36,25 +38,25 @@ export class TimePickerAdapter extends BaseAdapter {
|
|
|
36
38
|
this._inputMask = undefined;
|
|
37
39
|
}
|
|
38
40
|
initializeAccessibility(identifier) {
|
|
39
|
-
this._inputElement
|
|
40
|
-
this._inputElement
|
|
41
|
-
this._inputElement
|
|
42
|
-
this._inputElement
|
|
43
|
-
this._inputElement
|
|
44
|
-
this._inputElement
|
|
45
|
-
this._inputElement
|
|
46
|
-
this._inputElement
|
|
47
|
-
this._inputElement
|
|
41
|
+
this._inputElement?.setAttribute('autocomplete', 'off');
|
|
42
|
+
this._inputElement?.setAttribute('autocorrect', 'off');
|
|
43
|
+
this._inputElement?.setAttribute('autocapitalize', 'off');
|
|
44
|
+
this._inputElement?.setAttribute('spellcheck', 'false');
|
|
45
|
+
this._inputElement?.setAttribute('role', 'combobox');
|
|
46
|
+
this._inputElement?.setAttribute('aria-live', 'assertive');
|
|
47
|
+
this._inputElement?.setAttribute('aria-atomic', 'true');
|
|
48
|
+
this._inputElement?.setAttribute('aria-haspopup', 'true');
|
|
49
|
+
this._inputElement?.setAttribute('aria-expanded', 'false');
|
|
48
50
|
tryCreateAriaControlsPlaceholder();
|
|
49
|
-
|
|
51
|
+
if (this._inputElement) {
|
|
52
|
+
setAriaControls(this._inputElement);
|
|
53
|
+
}
|
|
50
54
|
}
|
|
51
55
|
addInputListener(type, listener, capture) {
|
|
52
|
-
this._inputElement
|
|
56
|
+
this._inputElement?.addEventListener(type, listener, { capture });
|
|
53
57
|
}
|
|
54
58
|
removeInputListener(type, listener, capture) {
|
|
55
|
-
|
|
56
|
-
this._inputElement.removeEventListener(type, listener, { capture });
|
|
57
|
-
}
|
|
59
|
+
this._inputElement?.removeEventListener(type, listener, { capture });
|
|
58
60
|
}
|
|
59
61
|
addToggleListener(type, listener) {
|
|
60
62
|
if (this._toggleElement) {
|
|
@@ -96,26 +98,28 @@ export class TimePickerAdapter extends BaseAdapter {
|
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
100
|
tryFocusInput() {
|
|
99
|
-
this._inputElement
|
|
101
|
+
this._inputElement?.select();
|
|
100
102
|
}
|
|
101
103
|
tryBlurInput() {
|
|
102
|
-
this._inputElement
|
|
104
|
+
this._inputElement?.blur();
|
|
103
105
|
}
|
|
104
106
|
selectInputText() {
|
|
105
|
-
this._inputElement
|
|
107
|
+
this._inputElement?.select();
|
|
106
108
|
}
|
|
107
109
|
isInputDisabled() {
|
|
108
|
-
return this._inputElement
|
|
110
|
+
return this._inputElement?.disabled ?? false;
|
|
109
111
|
}
|
|
110
112
|
isInputFocused() {
|
|
111
113
|
const activeElement = getActiveElement(this._component.ownerDocument);
|
|
112
114
|
return activeElement === this._inputElement;
|
|
113
115
|
}
|
|
114
116
|
setInputValue(value, emitEvents) {
|
|
115
|
-
if (this._inputElement
|
|
117
|
+
if (this._inputElement?.value === value) {
|
|
116
118
|
return;
|
|
117
119
|
}
|
|
118
|
-
this._inputElement
|
|
120
|
+
if (this._inputElement) {
|
|
121
|
+
this._inputElement.value = value;
|
|
122
|
+
}
|
|
119
123
|
if (this._inputMask) {
|
|
120
124
|
this._inputMask.update();
|
|
121
125
|
}
|
|
@@ -125,11 +129,13 @@ export class TimePickerAdapter extends BaseAdapter {
|
|
|
125
129
|
}
|
|
126
130
|
}
|
|
127
131
|
getInputValue() {
|
|
128
|
-
return this._inputMask ? this._inputMask.maskedValue : this._inputElement
|
|
132
|
+
return this._inputMask ? this._inputMask.maskedValue : (this._inputElement?.value ?? '');
|
|
129
133
|
}
|
|
130
134
|
setDisabled(isDisabled) {
|
|
131
|
-
this._inputElement
|
|
132
|
-
|
|
135
|
+
if (this._inputElement) {
|
|
136
|
+
this._inputElement.disabled = isDisabled;
|
|
137
|
+
this._inputElement.setAttribute('aria-disabled', isDisabled.toString());
|
|
138
|
+
}
|
|
133
139
|
this.setToggleDisabled(isDisabled);
|
|
134
140
|
}
|
|
135
141
|
attachDropdown(config) {
|
|
@@ -138,7 +144,7 @@ export class TimePickerAdapter extends BaseAdapter {
|
|
|
138
144
|
}
|
|
139
145
|
this._listDropdown = new ListDropdown(this._targetElement, config);
|
|
140
146
|
this._listDropdown.open();
|
|
141
|
-
this._inputElement
|
|
147
|
+
this._inputElement?.setAttribute('aria-controls', `list-dropdown-popup-${config.id}`);
|
|
142
148
|
}
|
|
143
149
|
async detachDropdown({ destroy = false } = {}) {
|
|
144
150
|
if (this._listDropdown) {
|
|
@@ -150,26 +156,34 @@ export class TimePickerAdapter extends BaseAdapter {
|
|
|
150
156
|
}
|
|
151
157
|
this._listDropdown = undefined;
|
|
152
158
|
}
|
|
153
|
-
|
|
159
|
+
if (this._inputElement) {
|
|
160
|
+
setAriaControls(this._inputElement);
|
|
161
|
+
}
|
|
154
162
|
}
|
|
155
163
|
propagateKey(key) {
|
|
156
164
|
this._listDropdown?.handleKey(key);
|
|
157
165
|
}
|
|
158
166
|
setActiveDescendant(id) {
|
|
159
|
-
|
|
167
|
+
if (this._inputElement) {
|
|
168
|
+
toggleAttribute(this._inputElement, !!id, 'aria-activedescendant', id);
|
|
169
|
+
}
|
|
160
170
|
}
|
|
161
171
|
getTargetElementWidth(selector) {
|
|
162
172
|
const targetElement = this._getTargetElement(selector);
|
|
163
173
|
return targetElement.getBoundingClientRect().width;
|
|
164
174
|
}
|
|
165
175
|
_emitInputEvent(type) {
|
|
166
|
-
this._inputElement
|
|
176
|
+
this._inputElement?.dispatchEvent(new Event(type));
|
|
167
177
|
}
|
|
168
178
|
emitInputEvent(type, data) {
|
|
169
|
-
|
|
179
|
+
if (this._inputElement) {
|
|
180
|
+
emitEvent(this._inputElement, type, data);
|
|
181
|
+
}
|
|
170
182
|
}
|
|
171
183
|
setInputReadonly(value) {
|
|
172
|
-
this._inputElement
|
|
184
|
+
if (this._inputElement) {
|
|
185
|
+
this._inputElement.readOnly = value;
|
|
186
|
+
}
|
|
173
187
|
}
|
|
174
188
|
setToggleDisabled(value) {
|
|
175
189
|
if (this._toggleElement) {
|
|
@@ -455,7 +455,7 @@ export class TimePickerCore {
|
|
|
455
455
|
}
|
|
456
456
|
_openDropdown() {
|
|
457
457
|
const options = this._generateTimeOptions();
|
|
458
|
-
if (!this.allowDropdown || !options.length) {
|
|
458
|
+
if (!this.allowDropdown || !options.length || !this._adapter.inputElement) {
|
|
459
459
|
return;
|
|
460
460
|
}
|
|
461
461
|
this._formatInputValue();
|