mtrl 0.10.4 → 0.10.6
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/README.md +15 -5
- package/dist/README.md +15 -5
- package/dist/components/bottom-app-bar/bottom-app-bar.js +2 -1
- package/dist/components/bottom-app-bar/index.d.ts +3 -1
- package/dist/components/button/api.js +3 -0
- package/dist/components/button/constants.d.ts +2 -0
- package/dist/components/button/index.d.ts +1 -0
- package/dist/components/button/types.d.ts +7 -1
- package/dist/components/button-group/button-group.js +25 -6
- package/dist/components/button-group/config.js +2 -2
- package/dist/components/button-group/constants.d.ts +8 -2
- package/dist/components/button-group/index.d.ts +1 -0
- package/dist/components/button-group/types.d.ts +5 -1
- package/dist/components/card/index.d.ts +21 -3
- package/dist/components/card/index.js +1 -1
- package/dist/components/card/types.d.ts +20 -4
- package/dist/components/carousel/api.d.ts +1 -0
- package/dist/components/carousel/api.js +4 -0
- package/dist/components/carousel/features/scroll.d.ts +1 -0
- package/dist/components/carousel/features/scroll.js +117 -2
- package/dist/components/carousel/types.d.ts +11 -0
- package/dist/components/checkbox/api.js +3 -0
- package/dist/components/checkbox/config.js +1 -0
- package/dist/components/checkbox/types.d.ts +8 -2
- package/dist/components/chips/types.d.ts +10 -2
- package/dist/components/datepicker/index.d.ts +3 -1
- package/dist/components/datepicker/index.js +1 -1
- package/dist/components/extended-fab/api.d.ts +2 -0
- package/dist/components/extended-fab/api.js +3 -0
- package/dist/components/extended-fab/config.d.ts +1 -0
- package/dist/components/extended-fab/config.js +1 -0
- package/dist/components/extended-fab/types.d.ts +2 -0
- package/dist/components/fab/api.d.ts +2 -0
- package/dist/components/fab/api.js +3 -0
- package/dist/components/fab/config.d.ts +1 -0
- package/dist/components/fab/config.js +1 -0
- package/dist/components/fab/constants.d.ts +2 -1
- package/dist/components/fab/types.d.ts +2 -0
- package/dist/components/fab-menu/fab-menu.js +2 -1
- package/dist/components/icon-button/api.js +3 -0
- package/dist/components/icon-button/constants.d.ts +2 -0
- package/dist/components/icon-button/types.d.ts +5 -0
- package/dist/components/index.d.ts +18 -5
- package/dist/components/index.js +2 -1
- package/dist/components/list/types.d.ts +5 -3
- package/dist/components/menu/features/keyboard.js +8 -5
- package/dist/components/menu/features/opener.js +1 -1
- package/dist/components/menu/index.d.ts +1 -0
- package/dist/components/navigation-rail/types.d.ts +2 -0
- package/dist/components/progress/features/canvas.js +1 -1
- package/dist/components/progress/features/colors.d.ts +2 -1
- package/dist/components/progress/features/colors.js +20 -10
- package/dist/components/radios/api.d.ts +1 -0
- package/dist/components/radios/api.js +3 -0
- package/dist/components/radios/constants.d.ts +9 -9
- package/dist/components/radios/radio.d.ts +1 -0
- package/dist/components/radios/radio.js +1 -0
- package/dist/components/radios/types.d.ts +10 -3
- package/dist/components/search/features/states.d.ts +2 -0
- package/dist/components/search/features/states.js +12 -1
- package/dist/components/search/features/structure.js +2 -0
- package/dist/components/search/types.d.ts +6 -6
- package/dist/components/segmented-button/config.js +2 -2
- package/dist/components/select/api.js +3 -0
- package/dist/components/select/constants.d.ts +1 -1
- package/dist/components/select/features.js +2 -0
- package/dist/components/select/index.d.ts +1 -0
- package/dist/components/select/types.d.ts +6 -0
- package/dist/components/split-button/types.d.ts +5 -1
- package/dist/components/switch/api.js +3 -0
- package/dist/components/switch/config.js +1 -0
- package/dist/components/switch/index.d.ts +6 -2
- package/dist/components/switch/index.js +1 -1
- package/dist/components/switch/types.d.ts +6 -2
- package/dist/components/tabs/config.js +2 -2
- package/dist/components/tabs/index.d.ts +36 -3
- package/dist/components/tabs/index.js +2 -1
- package/dist/components/tabs/tab.js +8 -1
- package/dist/components/tabs/types.d.ts +3 -1
- package/dist/components/tabs/utils.js +2 -1
- package/dist/components/textfield/api.d.ts +5 -0
- package/dist/components/textfield/api.js +209 -188
- package/dist/components/textfield/config.js +4 -3
- package/dist/components/textfield/constants.d.ts +24 -7
- package/dist/components/textfield/constants.js +9 -7
- package/dist/components/textfield/features/index.d.ts +3 -1
- package/dist/components/textfield/features/index.js +1 -0
- package/dist/components/textfield/features/leading-icon.js +1 -0
- package/dist/components/textfield/features/placement.js +15 -2
- package/dist/components/textfield/features/required.d.ts +33 -0
- package/dist/components/textfield/features/required.js +50 -0
- package/dist/components/textfield/features/supporting-text.js +43 -21
- package/dist/components/textfield/features/trailing-icon.d.ts +23 -1
- package/dist/components/textfield/features/trailing-icon.js +39 -5
- package/dist/components/textfield/index.d.ts +16 -1
- package/dist/components/textfield/index.js +1 -0
- package/dist/components/textfield/textfield.js +2 -2
- package/dist/components/textfield/types.d.ts +33 -3
- package/dist/components/timepicker/types.d.ts +2 -1
- package/dist/components/toolbar/toolbar.js +2 -1
- package/dist/components/tooltip/api.js +20 -18
- package/dist/components/tooltip/constants.d.ts +4 -1
- package/dist/components/top-app-bar/index.d.ts +3 -1
- package/dist/components/top-app-bar/top-app-bar.d.ts +2 -57
- package/dist/components/top-app-bar/top-app-bar.js +2 -1
- package/dist/core/compose/features/input.d.ts +9 -2
- package/dist/core/utils/theme.d.ts +6 -2
- package/dist/core/utils/theme.js +12 -19
- package/dist/elements/carousel.d.ts +5 -0
- package/dist/elements/carousel.js +1 -0
- package/dist/elements/css/textfield.js +1 -1
- package/dist/elements/define.d.ts +8 -0
- package/dist/elements/define.js +2 -1
- package/dist/elements/dialog.js +1 -1
- package/dist/elements/icon-button.d.ts +3 -2
- package/dist/elements/index.d.ts +15 -4
- package/dist/elements/index.js +2 -1
- package/dist/elements/preupgrade.css +1 -1
- package/dist/elements/textfield.d.ts +1 -1
- package/dist/elements/textfield.js +1 -1
- package/dist/index.cjs +0 -0
- package/dist/package.json +1 -1
- package/dist/react/dialog.d.ts +3 -0
- package/dist/react/dialog.js +3 -0
- package/dist/react/index.d.ts +4 -1
- package/dist/react/index.js +2 -1
- package/dist/solid/dialog.d.ts +3 -0
- package/dist/solid/dialog.js +3 -0
- package/dist/solid/index.d.ts +4 -1
- package/dist/solid/index.js +2 -1
- package/dist/styles/badge.css +1 -1
- package/dist/styles/base.css +2 -2
- package/dist/styles/bottom-app-bar.css +1 -1
- package/dist/styles/bottom-sheet.css +1 -1
- package/dist/styles/button-group.css +1 -1
- package/dist/styles/button.css +1 -1
- package/dist/styles/card.css +1 -1
- package/dist/styles/carousel.css +1 -1
- package/dist/styles/checkbox.css +1 -1
- package/dist/styles/chips.css +1 -1
- package/dist/styles/datepicker.css +1 -1
- package/dist/styles/dialog.css +1 -1
- package/dist/styles/divider.css +1 -1
- package/dist/styles/drawer.css +1 -1
- package/dist/styles/extended-fab.css +1 -1
- package/dist/styles/fab-menu.css +1 -1
- package/dist/styles/fab.css +1 -1
- package/dist/styles/icon-button.css +1 -1
- package/dist/styles/list.css +1 -1
- package/dist/styles/loading-indicator.css +1 -1
- package/dist/styles/menu.css +1 -1
- package/dist/styles/navigation-rail.css +1 -1
- package/dist/styles/progress.css +1 -1
- package/dist/styles/radios.css +1 -1
- package/dist/styles/search.css +1 -1
- package/dist/styles/segmented-button.css +1 -1
- package/dist/styles/select.css +1 -1
- package/dist/styles/side-sheet.css +1 -1
- package/dist/styles/slider.css +1 -1
- package/dist/styles/snackbar.css +1 -1
- package/dist/styles/split-button.css +1 -1
- package/dist/styles/switch.css +1 -1
- package/dist/styles/tabs.css +1 -1
- package/dist/styles/textfield.css +2 -2
- package/dist/styles/timepicker.css +1 -1
- package/dist/styles/toolbar.css +1 -1
- package/dist/styles/tooltip.css +1 -1
- package/dist/styles/top-app-bar.css +1 -1
- package/dist/styles/utilities.css +1 -1
- package/dist/styles.css +2 -2
- package/dist/svelte/Dialog.svelte +3 -0
- package/dist/svelte/index.d.ts +5 -1
- package/dist/svelte/index.js +5 -1
- package/dist/themes/autumn.css +2 -2
- package/dist/themes/baseline.css +2 -2
- package/dist/themes/brownbeige.css +2 -2
- package/dist/themes/browngreen.css +2 -2
- package/dist/themes/content.css +2 -2
- package/dist/themes/desert.css +2 -2
- package/dist/themes/expressive.css +2 -2
- package/dist/themes/fidelity.css +2 -2
- package/dist/themes/forest.css +2 -2
- package/dist/themes/fruit-salad.css +2 -2
- package/dist/themes/highcontrast.css +2 -2
- package/dist/themes/legacy.css +2 -2
- package/dist/themes/material.css +2 -2
- package/dist/themes/monochrome.css +2 -2
- package/dist/themes/neutral.css +2 -2
- package/dist/themes/ocean.css +2 -2
- package/dist/themes/rainbow.css +2 -2
- package/dist/themes/sageivory.css +2 -2
- package/dist/themes/spring.css +2 -2
- package/dist/themes/summer.css +2 -2
- package/dist/themes/sunset.css +2 -2
- package/dist/themes/tealcaramel.css +2 -2
- package/dist/themes/vibrant.css +2 -2
- package/dist/themes/winter.css +2 -2
- package/dist/vue/dialog.d.ts +3 -0
- package/dist/vue/dialog.js +3 -0
- package/dist/vue/index.d.ts +4 -1
- package/dist/vue/index.js +2 -1
- package/package.json +1 -1
- package/src/styles/abstract/_theme.scss +6 -6
- package/src/styles/abstract/_variables.scss +14 -4
- package/src/styles/components/_textfield.scss +61 -8
- package/src/styles/themes/_autumn.scss +173 -0
- package/src/styles/themes/_base-theme.scss +100 -12
- package/src/styles/themes/_baseline.scss +172 -0
- package/src/styles/themes/_brownbeige.scss +150 -0
- package/src/styles/themes/_browngreen.scss +183 -0
- package/src/styles/themes/_content.scss +148 -0
- package/src/styles/themes/_desert.scss +150 -0
- package/src/styles/themes/_expressive.scss +150 -0
- package/src/styles/themes/_fidelity.scss +148 -0
- package/src/styles/themes/_forest.scss +175 -0
- package/src/styles/themes/_fruit-salad.scss +150 -0
- package/src/styles/themes/_highcontrast.scss +74 -0
- package/src/styles/themes/_legacy.scss +181 -0
- package/src/styles/themes/_material.scss +181 -0
- package/src/styles/themes/_monochrome.scss +134 -0
- package/src/styles/themes/_neutral.scss +150 -0
- package/src/styles/themes/_ocean.scss +175 -0
- package/src/styles/themes/_rainbow.scss +150 -0
- package/src/styles/themes/_sageivory.scss +150 -0
- package/src/styles/themes/_spring.scss +171 -0
- package/src/styles/themes/_summer.scss +150 -0
- package/src/styles/themes/_sunset.scss +175 -0
- package/src/styles/themes/_tealcaramel.scss +150 -0
- package/src/styles/themes/_vibrant.scss +150 -0
- package/src/styles/themes/_winter.scss +181 -0
|
@@ -101,7 +101,10 @@ export interface RadioItem {
|
|
|
101
101
|
}
|
|
102
102
|
/** Selection or unknown-value clearing reported by the radio group. */
|
|
103
103
|
export interface RadiosChangePayload {
|
|
104
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* Selected value, or an empty string when an unknown value clears selection.
|
|
106
|
+
* In 1.0 that is `null`, as the select and `<m-radios>` report it.
|
|
107
|
+
*/
|
|
105
108
|
value: string;
|
|
106
109
|
/** Native input change event; undefined for programmatic clearing. */
|
|
107
110
|
originalEvent: Event | undefined;
|
|
@@ -133,12 +136,14 @@ export interface RadiosComponent {
|
|
|
133
136
|
*/
|
|
134
137
|
getClass: (name: string) => string;
|
|
135
138
|
/**
|
|
136
|
-
* Gets the radios component name
|
|
139
|
+
* Gets the radios component name.
|
|
140
|
+
* In 1.0 it returns `null`, not an empty string, when nothing is selected.
|
|
137
141
|
* @returns Selected radio value or empty string if none selected
|
|
138
142
|
*/
|
|
139
143
|
getValue: () => string;
|
|
140
144
|
/**
|
|
141
|
-
* Sets the radios component value (selects a radio)
|
|
145
|
+
* Sets the radios component value (selects a radio).
|
|
146
|
+
* In 1.0 it also accepts `null`, which clears the selection.
|
|
142
147
|
* @param value - Value to select
|
|
143
148
|
* @returns The radios component for chaining
|
|
144
149
|
*/
|
|
@@ -170,6 +175,8 @@ export interface RadiosComponent {
|
|
|
170
175
|
* @returns The radios component for chaining
|
|
171
176
|
*/
|
|
172
177
|
disable: () => RadiosComponent;
|
|
178
|
+
/** Whether the whole group is disabled (FLO-384) */
|
|
179
|
+
isDisabled: () => boolean;
|
|
173
180
|
/**
|
|
174
181
|
* Enables a specific radio option
|
|
175
182
|
* @param value - Value of the radio to enable
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SearchComponent } from "../types.js";
|
|
2
2
|
import { SearchConfig, SearchState, SearchStructure, SearchViewMode, SearchVariant } from "../types.js";
|
|
3
|
+
import { type CleanupScope } from "../../../core/compose/cleanup.js";
|
|
3
4
|
/**
|
|
4
5
|
* Adds state management features to the search component
|
|
5
6
|
* Handles bar ↔ view transitions per MD3 specifications
|
|
@@ -11,6 +12,7 @@ import { SearchConfig, SearchState, SearchStructure, SearchViewMode, SearchVaria
|
|
|
11
12
|
interface StatesHost {
|
|
12
13
|
element: HTMLElement;
|
|
13
14
|
getClass: (name: string) => string;
|
|
15
|
+
resources?: CleanupScope;
|
|
14
16
|
structure?: SearchStructure;
|
|
15
17
|
emit?: (event: string, data: unknown) => unknown;
|
|
16
18
|
}
|
|
@@ -3,11 +3,20 @@ import { setHTML } from "../../../core/dom/html.js";
|
|
|
3
3
|
import { PREFIX } from "../../../core/config.js";
|
|
4
4
|
import { hideFromTopLayer, showInTopLayer } from "../../../core/dom/layer.js";
|
|
5
5
|
import { activeElementOf } from "../../../core/dom/focus.js";
|
|
6
|
+
import { getCleanup } from "../../../core/compose/cleanup.js";
|
|
6
7
|
export const withStates = (config, getComponent) => (component) => {
|
|
7
8
|
let currentState = config.initialState || SEARCH_STATES.BAR;
|
|
8
9
|
let currentViewMode = config.viewMode || SEARCH_VIEW_MODES.DOCKED;
|
|
9
10
|
let currentVariant = config.variant === "divided" ? "divided" : "contained";
|
|
10
11
|
let isDisabled = config.disabled === true;
|
|
12
|
+
const resources = getCleanup(component);
|
|
13
|
+
let focusFrame = null;
|
|
14
|
+
const cancelPendingFocus = () => {
|
|
15
|
+
if (focusFrame !== null)
|
|
16
|
+
cancelAnimationFrame(focusFrame);
|
|
17
|
+
focusFrame = null;
|
|
18
|
+
};
|
|
19
|
+
resources.add(cancelPendingFocus);
|
|
11
20
|
const getClass = (className) => {
|
|
12
21
|
return component.getClass ? component.getClass(className) : className;
|
|
13
22
|
};
|
|
@@ -94,7 +103,8 @@ export const withStates = (config, getComponent) => (component) => {
|
|
|
94
103
|
openSurface();
|
|
95
104
|
structure?.input.setAttribute("aria-expanded", "true");
|
|
96
105
|
if (structure?.input) {
|
|
97
|
-
requestAnimationFrame(() => {
|
|
106
|
+
focusFrame = requestAnimationFrame(() => {
|
|
107
|
+
focusFrame = null;
|
|
98
108
|
structure.input.focus();
|
|
99
109
|
});
|
|
100
110
|
}
|
|
@@ -114,6 +124,7 @@ export const withStates = (config, getComponent) => (component) => {
|
|
|
114
124
|
const element = component.element;
|
|
115
125
|
const structure = component.structure;
|
|
116
126
|
currentState = SEARCH_STATES.BAR;
|
|
127
|
+
cancelPendingFocus();
|
|
117
128
|
element.classList.remove(getClass(SEARCH_CLASSES.STATE_VIEW));
|
|
118
129
|
element.classList.add(getClass(SEARCH_CLASSES.STATE_BAR));
|
|
119
130
|
if (structure?.leadingIcon) {
|
|
@@ -2,6 +2,7 @@ import { SEARCH_CLASSES, SEARCH_ICONS, SEARCH_STATES } from "../constants.js";
|
|
|
2
2
|
import { createElement } from "../../../core/dom/create.js";
|
|
3
3
|
import { setHTML } from "../../../core/dom/html.js";
|
|
4
4
|
import { PREFIX } from "../../../core/config.js";
|
|
5
|
+
import { processClassNames } from "../../../core/config/component.js";
|
|
5
6
|
let searches = 0;
|
|
6
7
|
export const withStructure = (config) => (component) => {
|
|
7
8
|
const isDisabled = config.disabled === true;
|
|
@@ -23,6 +24,7 @@ export const withStructure = (config) => (component) => {
|
|
|
23
24
|
getClass(config.variant === "divided"
|
|
24
25
|
? SEARCH_CLASSES.VARIANT_DIVIDED
|
|
25
26
|
: SEARCH_CLASSES.VARIANT_CONTAINED),
|
|
27
|
+
processClassNames(config.className || ""),
|
|
26
28
|
];
|
|
27
29
|
if (config.fullWidth) {
|
|
28
30
|
rootClasses.push(getClass(SEARCH_CLASSES.FULL_WIDTH));
|
|
@@ -116,17 +116,17 @@ export interface SearchConfig {
|
|
|
116
116
|
class?: string;
|
|
117
117
|
/** Component prefix for class names */
|
|
118
118
|
prefix?: string;
|
|
119
|
-
/** Called when search is submitted */
|
|
119
|
+
/** Called when search is submitted. In 1.0 it receives the `SearchEvent` a `submit` listener receives: read `event.value`. */
|
|
120
120
|
onSubmit?: (value: string) => void;
|
|
121
|
-
/** Called when input value changes */
|
|
121
|
+
/** Called when input value changes. In 1.0 it receives the `SearchEvent` an `input` listener receives: read `event.value`. */
|
|
122
122
|
onInput?: (value: string) => void;
|
|
123
|
-
/** Called when search is cleared */
|
|
123
|
+
/** Called when search is cleared. In 1.0 it receives the `SearchEvent` a `clear` listener receives. */
|
|
124
124
|
onClear?: () => void;
|
|
125
|
-
/** Called when view expands */
|
|
125
|
+
/** Called when view expands. In 1.0 it receives the object an `expand` listener receives. */
|
|
126
126
|
onExpand?: () => void;
|
|
127
|
-
/** Called when view collapses */
|
|
127
|
+
/** Called when view collapses. In 1.0 it receives the object a `collapse` listener receives. */
|
|
128
128
|
onCollapse?: () => void;
|
|
129
|
-
/** Called when a suggestion is selected */
|
|
129
|
+
/** Called when a suggestion is selected. In 1.0 it receives the `SearchEvent`: the suggestion is `event.suggestion`. */
|
|
130
130
|
onSuggestionSelect?: (suggestion: SearchSuggestion) => void;
|
|
131
131
|
/** Event handlers map */
|
|
132
132
|
on?: Partial<Record<SearchEventType, (event: SearchEvent) => void>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createComponentConfig } from "../../core/config/component.js";
|
|
1
|
+
import { createComponentConfig, processClassNames } from "../../core/config/component.js";
|
|
2
2
|
import { SelectionMode, Density } from "./types.js";
|
|
3
3
|
import { SEGMENTED_BUTTON_DEFAULTS } from "./constants.js";
|
|
4
4
|
export const DEFAULT_CONFIG = {
|
|
@@ -19,7 +19,7 @@ export const getContainerConfig = (config) => {
|
|
|
19
19
|
"data-density": density,
|
|
20
20
|
},
|
|
21
21
|
className: [
|
|
22
|
-
config.
|
|
22
|
+
processClassNames(config.className || ""),
|
|
23
23
|
config.disabled ? `${config.prefix}-segmented-button--disabled` : null,
|
|
24
24
|
density !== Density.DEFAULT
|
|
25
25
|
? `${config.prefix}-segmented-button--${density}`
|
|
@@ -73,6 +73,9 @@ export const withAPI = (options) => (component) => ({
|
|
|
73
73
|
options.disabled.disable();
|
|
74
74
|
return this;
|
|
75
75
|
},
|
|
76
|
+
isDisabled() {
|
|
77
|
+
return component.textfield?.input?.disabled === true;
|
|
78
|
+
},
|
|
76
79
|
setError(error, message) {
|
|
77
80
|
if (component.textfield?.setError) {
|
|
78
81
|
component.textfield.setError(error, message);
|
|
@@ -80,7 +80,7 @@ export declare const SELECT_DEFAULTS: {
|
|
|
80
80
|
export declare const SELECT_CLASSES: {
|
|
81
81
|
/** Container element */
|
|
82
82
|
readonly CONTAINER: "select";
|
|
83
|
-
/**
|
|
83
|
+
/** @deprecated Renamed `TEXT_FIELD` in 1.0 (FLO-383); the class stays `select__textfield`. */
|
|
84
84
|
readonly TEXTFIELD: "select__textfield";
|
|
85
85
|
/** Dropdown icon */
|
|
86
86
|
readonly DROPDOWN_ICON: "select__dropdown-icon";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { processClassNames } from "../../core/config/component.js";
|
|
1
2
|
import createTextfield from "../textfield/index.js";
|
|
2
3
|
import createMenu from "../menu/index.js";
|
|
3
4
|
import { warnUnknownValue } from "../../core/utils/warn.js";
|
|
@@ -12,6 +13,7 @@ export const withTextfield = (config) => (component) => {
|
|
|
12
13
|
}
|
|
13
14
|
const dropdownIcon = '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M7 10l5 5 5-5H7z"/></svg>';
|
|
14
15
|
const textfield = createTextfield({
|
|
16
|
+
class: processClassNames(config.className || ""),
|
|
15
17
|
label: config.label,
|
|
16
18
|
variant: config.variant || "filled",
|
|
17
19
|
density: config.density || "default",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* @category Components
|
|
9
9
|
*/
|
|
10
10
|
export { default } from "./select.js";
|
|
11
|
+
export type { SelectEvents } from "./types.js";
|
|
11
12
|
export type { SelectConfig, SelectComponent, SelectOption, SelectEvent, SelectChangeEvent } from "./types.js";
|
|
12
13
|
/**
|
|
13
14
|
* Constants for select configuration
|
|
@@ -160,10 +160,14 @@ export interface SelectComponent {
|
|
|
160
160
|
element: HTMLElement;
|
|
161
161
|
/**
|
|
162
162
|
* The textfield component
|
|
163
|
+
* @deprecated Renamed `textField` in 1.0 (FLO-383), where `select.textfield` is `undefined`.
|
|
164
|
+
* 0.10.x has no `textField`, so rename it when you upgrade.
|
|
163
165
|
*/
|
|
164
166
|
textfield: TextfieldComponent;
|
|
165
167
|
/**
|
|
166
168
|
* The menu component
|
|
169
|
+
* @deprecated Removed in 1.0. Use the select's own methods and events: `open()`,
|
|
170
|
+
* `close()`, `isOpen()`, `getOptions()`, `setOptions()`, and `open`, `close` and `change`.
|
|
167
171
|
*/
|
|
168
172
|
menu: MenuComponent;
|
|
169
173
|
/**
|
|
@@ -249,6 +253,8 @@ export interface SelectComponent {
|
|
|
249
253
|
* @returns Select component for chaining
|
|
250
254
|
*/
|
|
251
255
|
disable: () => SelectComponent;
|
|
256
|
+
/** Whether the select is disabled (FLO-384) */
|
|
257
|
+
isDisabled: () => boolean;
|
|
252
258
|
/**
|
|
253
259
|
* Sets the error state on the select
|
|
254
260
|
* @param error - Whether to show error state
|
|
@@ -84,7 +84,11 @@ export interface SplitButtonComponent {
|
|
|
84
84
|
leadingElement: HTMLButtonElement;
|
|
85
85
|
/** The trailing button's element */
|
|
86
86
|
trailingElement: HTMLButtonElement;
|
|
87
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* The menu, when the component was given items
|
|
89
|
+
* @deprecated Removed in 1.0. Use the split button's own methods and events: `expand()`,
|
|
90
|
+
* `collapse()`, `isExpanded()`, and `expand`, `collapse` and `select`.
|
|
91
|
+
*/
|
|
88
92
|
menu?: MenuComponent;
|
|
89
93
|
/** Sets the leading button's label */
|
|
90
94
|
setText: (text: string) => SplitButtonComponent;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export { default } from "./switch.js";
|
|
2
2
|
export { SWITCH_LABEL_POSITIONS, SWITCH_STATES, SWITCH_EVENTS, SWITCH_DEFAULTS, SWITCH_CLASSES } from "./constants.js";
|
|
3
3
|
export type { SwitchConfig, SwitchComponent, SwitchEvents, SwitchChangePayload } from "./types.js";
|
|
4
|
-
export {
|
|
5
|
-
|
|
4
|
+
export {
|
|
5
|
+
/** @deprecated Internal, no replacement: removed from mtrl/components/switch in 1.0.0 (FLO-381). */
|
|
6
|
+
withSupportingText, } from "./features.js";
|
|
7
|
+
export type {
|
|
8
|
+
/** @deprecated Internal, no replacement: removed from mtrl/components/switch in 1.0.0 (FLO-381). */
|
|
9
|
+
SupportingTextComponent, } from "./features.js";
|
|
@@ -47,13 +47,13 @@ export interface SwitchConfig {
|
|
|
47
47
|
/** Index signature for additional properties */
|
|
48
48
|
[key: string]: unknown;
|
|
49
49
|
}
|
|
50
|
-
/** A checked-state change from
|
|
50
|
+
/** A checked-state change from native input activation. Public setters are silent. */
|
|
51
51
|
export interface SwitchChangePayload {
|
|
52
52
|
/** The new checked state. */
|
|
53
53
|
checked: boolean;
|
|
54
54
|
/** The input's HTML value attribute, not the boolean checked state. */
|
|
55
55
|
value: string;
|
|
56
|
-
/**
|
|
56
|
+
/** The original native change event, when supplied by the emitter. */
|
|
57
57
|
nativeEvent?: Event;
|
|
58
58
|
}
|
|
59
59
|
/** Emitter events: change, and the input's focus and blur (FLO-267). */
|
|
@@ -108,6 +108,8 @@ export interface SwitchComponent {
|
|
|
108
108
|
enable: () => SwitchComponent;
|
|
109
109
|
/** Disables the switch */
|
|
110
110
|
disable: () => SwitchComponent;
|
|
111
|
+
/** Whether the switch is disabled (FLO-384) */
|
|
112
|
+
isDisabled: () => boolean;
|
|
111
113
|
/** Destroys the switch component and cleans up resources */
|
|
112
114
|
destroy: () => void;
|
|
113
115
|
}
|
|
@@ -118,6 +120,7 @@ export interface ApiOptions {
|
|
|
118
120
|
disabled: {
|
|
119
121
|
enable: () => void;
|
|
120
122
|
disable: () => void;
|
|
123
|
+
isDisabled: () => boolean;
|
|
121
124
|
};
|
|
122
125
|
lifecycle: {
|
|
123
126
|
destroy: () => void;
|
|
@@ -146,6 +149,7 @@ export interface BaseComponent {
|
|
|
146
149
|
disabled?: {
|
|
147
150
|
enable: () => void;
|
|
148
151
|
disable: () => void;
|
|
152
|
+
isDisabled: () => boolean;
|
|
149
153
|
};
|
|
150
154
|
lifecycle?: {
|
|
151
155
|
destroy: () => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createComponentConfig } from "../../core/config/component.js";
|
|
1
|
+
import { createComponentConfig, processClassNames } from "../../core/config/component.js";
|
|
2
2
|
import { withElement } from "../../core/compose/component.js";
|
|
3
3
|
import { TAB_STATES, TABS_DEFAULTS } from "./constants.js";
|
|
4
4
|
export const defaultTabConfig = {
|
|
@@ -24,7 +24,7 @@ export const getTabsElementConfig = (config) => {
|
|
|
24
24
|
className: [
|
|
25
25
|
`${config.prefix}-tabs`,
|
|
26
26
|
`${config.prefix}-tabs--${config.variant || "primary"}`,
|
|
27
|
-
config.
|
|
27
|
+
processClassNames(config.className || ""),
|
|
28
28
|
].filter((name) => Boolean(name)),
|
|
29
29
|
};
|
|
30
30
|
return (component) => withElement(elementConfig)(component);
|
|
@@ -6,7 +6,40 @@ import { createTabIndicator } from "./indicator.js";
|
|
|
6
6
|
import { updateTabPanels, setupKeyboardNavigation } from "./utils.js";
|
|
7
7
|
export { TAB_VARIANTS, TAB_STATES, TAB_INDICATOR_WIDTH_STRATEGIES, TAB_EVENTS, TABS_EVENTS, TABS_DEFAULTS, TABS_CLASSES, TAB_CLASSES, } from "./constants.js";
|
|
8
8
|
export type { TabsConfig, TabsComponent, TabComponent, TabConfig, TabChangeEventData, IndicatorConfig, } from "./types.js";
|
|
9
|
-
export {
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
export {
|
|
10
|
+
/** @deprecated Internal, no replacement: removed from mtrl/components/tabs in 1.0.0 (FLO-381). */
|
|
11
|
+
addScrollIndicators, setupResponsiveBehavior,
|
|
12
|
+
/** @deprecated Internal, no replacement: removed from mtrl/components/tabs in 1.0.0 (FLO-381). */
|
|
13
|
+
createTabsState,
|
|
14
|
+
/** @deprecated Internal, no replacement: removed from mtrl/components/tabs in 1.0.0 (FLO-381). */
|
|
15
|
+
createTabIndicator,
|
|
16
|
+
/** @deprecated Internal, no replacement: removed from mtrl/components/tabs in 1.0.0 (FLO-381). */
|
|
17
|
+
updateTabPanels,
|
|
18
|
+
/** @deprecated Internal, no replacement: removed from mtrl/components/tabs in 1.0.0 (FLO-381). */
|
|
19
|
+
setupKeyboardNavigation, };
|
|
20
|
+
export {
|
|
21
|
+
/** @deprecated Internal, no replacement: removed from mtrl/components/tabs in 1.0.0 (FLO-381). */
|
|
22
|
+
withTabsManagement,
|
|
23
|
+
/** @deprecated Internal, no replacement: removed from mtrl/components/tabs in 1.0.0 (FLO-381). */
|
|
24
|
+
withScrollable,
|
|
25
|
+
/** @deprecated Internal, no replacement: removed from mtrl/components/tabs in 1.0.0 (FLO-381). */
|
|
26
|
+
withDivider,
|
|
27
|
+
/** @deprecated Internal, no replacement: removed from mtrl/components/tabs in 1.0.0 (FLO-381). */
|
|
28
|
+
withIndicator, } from "./features.js";
|
|
29
|
+
export type {
|
|
30
|
+
/** @deprecated Internal, no replacement: removed from mtrl/components/tabs in 1.0.0 (FLO-381). */
|
|
31
|
+
TabsManagementConfig,
|
|
32
|
+
/** @deprecated Internal, no replacement: removed from mtrl/components/tabs in 1.0.0 (FLO-381). */
|
|
33
|
+
TabsManagementComponent,
|
|
34
|
+
/** @deprecated Internal, no replacement: removed from mtrl/components/tabs in 1.0.0 (FLO-381). */
|
|
35
|
+
ScrollableConfig,
|
|
36
|
+
/** @deprecated Internal, no replacement: removed from mtrl/components/tabs in 1.0.0 (FLO-381). */
|
|
37
|
+
ScrollableComponent,
|
|
38
|
+
/** @deprecated Internal, no replacement: removed from mtrl/components/tabs in 1.0.0 (FLO-381). */
|
|
39
|
+
DividerConfig,
|
|
40
|
+
/** @deprecated Internal, no replacement: removed from mtrl/components/tabs in 1.0.0 (FLO-381). */
|
|
41
|
+
IndicatorFeatureConfig,
|
|
42
|
+
/** @deprecated Internal, no replacement: removed from mtrl/components/tabs in 1.0.0 (FLO-381). */
|
|
43
|
+
IndicatorComponent, } from "./features.js";
|
|
12
44
|
export default createTabs;
|
|
45
|
+
export { createTab } from "./tab.js";
|
|
@@ -6,5 +6,6 @@ import { createTabIndicator } from "./indicator.js";
|
|
|
6
6
|
import { updateTabPanels, setupKeyboardNavigation } from "./utils.js";
|
|
7
7
|
export { TAB_VARIANTS, TAB_STATES, TAB_INDICATOR_WIDTH_STRATEGIES, TAB_EVENTS, TABS_EVENTS, TABS_DEFAULTS, TABS_CLASSES, TAB_CLASSES, } from "./constants.js";
|
|
8
8
|
export { addScrollIndicators, setupResponsiveBehavior, createTabsState, createTabIndicator, updateTabPanels, setupKeyboardNavigation, };
|
|
9
|
-
export { withTabsManagement, withScrollable, withDivider, withIndicator } from "./features.js";
|
|
9
|
+
export { withTabsManagement, withScrollable, withDivider, withIndicator, } from "./features.js";
|
|
10
10
|
export default createTabs;
|
|
11
|
+
export { createTab } from "./tab.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { processClassNames } from "../../core/config/component.js";
|
|
1
2
|
import { syncTabControls, tabIdFor } from "./utils.js";
|
|
2
3
|
import { pipe } from "../../core/compose/index.js";
|
|
3
4
|
import { createBase } from "../../core/compose/component.js";
|
|
@@ -24,7 +25,10 @@ export const createTab = (config = {}) => {
|
|
|
24
25
|
value: baseConfig.value,
|
|
25
26
|
prefix: baseConfig.prefix,
|
|
26
27
|
variant: "text",
|
|
27
|
-
class:
|
|
28
|
+
class: [
|
|
29
|
+
`${baseConfig.prefix}-tab`,
|
|
30
|
+
processClassNames(baseConfig.className || ""),
|
|
31
|
+
].filter(Boolean).join(" "),
|
|
28
32
|
});
|
|
29
33
|
baseComponent.element = button.element;
|
|
30
34
|
baseComponent.element.setAttribute("role", "tab");
|
|
@@ -95,6 +99,9 @@ export const createTab = (config = {}) => {
|
|
|
95
99
|
this.element.setAttribute("aria-disabled", "true");
|
|
96
100
|
return this;
|
|
97
101
|
},
|
|
102
|
+
isDisabled() {
|
|
103
|
+
return button.isDisabled();
|
|
104
|
+
},
|
|
98
105
|
setText(content) {
|
|
99
106
|
button.setText(content);
|
|
100
107
|
this.updateLayoutStyle();
|
|
@@ -299,6 +299,8 @@ export interface TabComponent {
|
|
|
299
299
|
enable: () => TabComponent;
|
|
300
300
|
/** Disables the tab (adds disabled attribute) */
|
|
301
301
|
disable: () => TabComponent;
|
|
302
|
+
/** Whether the tab is disabled (FLO-384) */
|
|
303
|
+
isDisabled: () => boolean;
|
|
302
304
|
/** Sets the tab's text content */
|
|
303
305
|
setText: (content: string) => TabComponent;
|
|
304
306
|
/** Gets the tab's text content */
|
|
@@ -405,7 +407,7 @@ export interface TabsComponent {
|
|
|
405
407
|
*/
|
|
406
408
|
off(event: string, handler: Function): this;
|
|
407
409
|
/**
|
|
408
|
-
* Emit an event
|
|
410
|
+
* Emit an event. In 1.0, `emit` accepts only the tabs' own events.
|
|
409
411
|
* @param event - Event name
|
|
410
412
|
* @param data - Event data
|
|
411
413
|
* @returns Tabs component for chaining
|
|
@@ -21,7 +21,8 @@ export function findRegisteredPanel(tab) {
|
|
|
21
21
|
const tabId = tab.id;
|
|
22
22
|
if (!tabId || typeof document === "undefined")
|
|
23
23
|
return null;
|
|
24
|
-
const labelled = document.
|
|
24
|
+
const labelled = Array.from(document.querySelectorAll('[role="tabpanel"]'))
|
|
25
|
+
.find((panel) => panel.getAttribute("aria-labelledby") === tabId);
|
|
25
26
|
if (labelled)
|
|
26
27
|
return labelled;
|
|
27
28
|
if (tabId.startsWith("tab-")) {
|
|
@@ -12,6 +12,11 @@ type ComponentWithDensity = BaseComponent & {
|
|
|
12
12
|
setError?: (error: boolean, message?: string) => void;
|
|
13
13
|
isError?: () => boolean;
|
|
14
14
|
field?: HTMLElement;
|
|
15
|
+
input?: HTMLInputElement | HTMLTextAreaElement;
|
|
16
|
+
trailingIcon?: HTMLElement | null;
|
|
17
|
+
setTrailingIcon?: (html: string, label?: string) => void;
|
|
18
|
+
setRequired?: (required: boolean) => void;
|
|
19
|
+
isRequired?: () => boolean;
|
|
15
20
|
};
|
|
16
21
|
/**
|
|
17
22
|
* Enhances textfield component with API methods
|