mtrl 0.10.4 → 0.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +3 -0
- 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 +2 -0
- package/dist/components/card/index.d.ts +21 -3
- package/dist/components/card/index.js +1 -1
- package/dist/components/card/types.d.ts +19 -3
- 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 +10 -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 +5 -1
- 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 +2 -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/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 +6 -6
- package/dist/components/radios/radio.d.ts +1 -0
- package/dist/components/radios/radio.js +1 -0
- package/dist/components/radios/types.d.ts +2 -0
- 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/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 +4 -0
- 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 +2 -0
- 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/toolbar/toolbar.js +2 -1
- 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/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/dialog.js +1 -1
- 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
|
@@ -43,11 +43,15 @@ export interface ChipConfig {
|
|
|
43
43
|
prefix?: string;
|
|
44
44
|
componentName?: string;
|
|
45
45
|
ripple?: boolean;
|
|
46
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* @internal Selection belongs to the chips container.
|
|
48
|
+
* @deprecated Not for apps: moves out of ChipConfig in 1.0.0 (FLO-381).
|
|
49
|
+
*/
|
|
47
50
|
managedSelection?: boolean;
|
|
48
51
|
/**
|
|
49
52
|
* @internal The chip is a cell of a chip set's grid (FLO-261): the root is a
|
|
50
53
|
* `gridcell`, and a one-action chip's cell is its focus target.
|
|
54
|
+
* @deprecated Not for apps: moves out of ChipConfig in 1.0.0 (FLO-381).
|
|
51
55
|
*/
|
|
52
56
|
cell?: boolean;
|
|
53
57
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { default } from "./datepicker.js";
|
|
2
2
|
export type { DatePickerConfig, DatePickerComponent, DatePickerEvents, DatePickerValue, DatePickerValueOf, DatePickerInput, DatePickerChangePayload, DatePickerVisibilityPayload, DatePickerTapPayload, DatePickerSwipePayload, DatePickerVariant, DatePickerView, DatePickerSelectionMode, } from "./types.js";
|
|
3
|
-
export {
|
|
3
|
+
export {
|
|
4
|
+
/** @deprecated Internal, no replacement: removed from mtrl/components/datepicker in 1.0.0 (FLO-381). */
|
|
5
|
+
DEFAULT_DATE_FORMAT, } from "./types.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default } from "./datepicker.js";
|
|
2
|
-
export { DEFAULT_DATE_FORMAT } from "./types.js";
|
|
2
|
+
export { DEFAULT_DATE_FORMAT, } from "./types.js";
|
|
@@ -53,7 +53,7 @@ export declare const FAB_CLASSES: {
|
|
|
53
53
|
readonly ICON: "fab__icon";
|
|
54
54
|
/** Applied when FAB is lowered (pressed state) */
|
|
55
55
|
readonly LOWERED: "fab--lowered";
|
|
56
|
-
/** Applied to small FABs */
|
|
56
|
+
/** @deprecated Applied to small FABs; the small size is deprecated (FAB_SIZES.SMALL). Removed in 1.0. */
|
|
57
57
|
readonly SMALL: "fab--small";
|
|
58
58
|
/** Applied to medium FABs */
|
|
59
59
|
readonly MEDIUM: "fab--medium";
|
|
@@ -72,6 +72,7 @@ export declare const FAB_TYPES: {
|
|
|
72
72
|
* Default icon sizes based on FAB size
|
|
73
73
|
*/
|
|
74
74
|
export declare const FAB_ICON_SIZES: {
|
|
75
|
+
/** @deprecated The small FAB's icon size; the small size is deprecated (FAB_SIZES.SMALL). Removed in 1.0. */
|
|
75
76
|
readonly SMALL: "24px";
|
|
76
77
|
readonly DEFAULT: "24px";
|
|
77
78
|
readonly MEDIUM: "28px";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { processClassNames } from "../../core/config/component.js";
|
|
1
2
|
import { pipe } from "../../core/compose/pipe.js";
|
|
2
3
|
import { createBase, withElement } from "../../core/compose/component.js";
|
|
3
4
|
import { withEvents, withLifecycle } from "../../core/compose/features/index.js";
|
|
@@ -27,7 +28,7 @@ const createFabMenu = (config) => {
|
|
|
27
28
|
`${block}--${color}`,
|
|
28
29
|
`${block}--${size}`,
|
|
29
30
|
placement !== "none" ? `${block}--${placement}` : "",
|
|
30
|
-
settings.
|
|
31
|
+
processClassNames(settings.className || ""),
|
|
31
32
|
].filter(Boolean),
|
|
32
33
|
}), withLifecycle())(settings);
|
|
33
34
|
const resources = getCleanup(component);
|
|
@@ -109,6 +109,9 @@ export const withAPI = ({ disabled, lifecycle, toggleState }) => (component) =>
|
|
|
109
109
|
disabled.enable();
|
|
110
110
|
return iconButtonComponent;
|
|
111
111
|
},
|
|
112
|
+
isDisabled() {
|
|
113
|
+
return disabled.isDisabled();
|
|
114
|
+
},
|
|
112
115
|
disable() {
|
|
113
116
|
disabled.disable();
|
|
114
117
|
return iconButtonComponent;
|
|
@@ -115,7 +115,9 @@ export declare const ICON_BUTTON_CLASSES: {
|
|
|
115
115
|
*/
|
|
116
116
|
export declare const DEFAULT_RIPPLE_CONFIG: {
|
|
117
117
|
readonly DURATION: 450;
|
|
118
|
+
/** @deprecated Has no effect: the option it is the default of is never applied (FLO-268). Removed in 1.0. */
|
|
118
119
|
readonly TIMING: "cubic-bezier(0.4, 0.0, 0.2, 1)";
|
|
120
|
+
/** @deprecated Has no effect: the option it is the default of is never applied (FLO-268). Removed in 1.0. */
|
|
119
121
|
readonly OPACITY: [string, string];
|
|
120
122
|
};
|
|
121
123
|
/**
|
|
@@ -310,6 +310,8 @@ export interface IconButtonComponent {
|
|
|
310
310
|
* @returns The IconButton component for chaining
|
|
311
311
|
*/
|
|
312
312
|
disable: () => IconButtonComponent;
|
|
313
|
+
/** Whether the icon button is disabled (FLO-384) */
|
|
314
|
+
isDisabled: () => boolean;
|
|
313
315
|
/**
|
|
314
316
|
* Sets the IconButton's icon
|
|
315
317
|
* @param icon - Icon HTML content
|
|
@@ -49,19 +49,26 @@ export { clearSnackbars } from "./snackbar/index.js";
|
|
|
49
49
|
export { default as createSwitch } from "./switch/index.js";
|
|
50
50
|
export { default as createTabs } from "./tabs/index.js";
|
|
51
51
|
export { createTab } from "./tabs/tab.js";
|
|
52
|
-
export { default as
|
|
52
|
+
export { default as createTextField } from "./textfield/index.js";
|
|
53
|
+
export {
|
|
54
|
+
/** @deprecated Use createTextField: M3 writes "text field" as two words. Removed in 1.0 (FLO-383). */
|
|
55
|
+
default as createTextfield, } from "./textfield/index.js";
|
|
53
56
|
export { default as createTimePicker } from "./timepicker/index.js";
|
|
54
57
|
export { default as createToolbar } from "./toolbar/index.js";
|
|
55
58
|
export { default as createTopAppBar } from "./top-app-bar/index.js";
|
|
56
59
|
export { default as createTooltip } from "./tooltip/index.js";
|
|
57
60
|
export { createCardContent, createCardHeader, createCardActions, createCardMedia, } from "./card/content.js";
|
|
58
61
|
export type { BadgeConfig, BadgeComponent } from "./badge/types.js";
|
|
59
|
-
export type { BottomAppBarConfig, BottomAppBar
|
|
62
|
+
export type { BottomAppBarConfig, BottomAppBar as BottomAppBarComponent,
|
|
63
|
+
/** @deprecated Use BottomAppBarComponent, the name every component type has. Removed in 1.0 (FLO-383). */
|
|
64
|
+
BottomAppBar, } from "./bottom-app-bar/types.js";
|
|
60
65
|
export type { BottomSheetConfig, BottomSheetComponent, BottomSheetVariant, BottomSheetState, BottomSheetStateEvent, BottomSheetEventHandlers, } from "./bottom-sheet/types.js";
|
|
61
66
|
export type { SideSheetConfig, SideSheetComponent, SideSheetVariant, SideSheetPosition, SideSheetEventHandlers, } from "./side-sheet/types.js";
|
|
62
67
|
export type { ButtonConfig, ButtonComponent, ButtonVariant, } from "./button/types.js";
|
|
63
68
|
export type { ButtonGroupConfig, ButtonGroupComponent, ButtonGroupItemConfig, ButtonGroupEvent, ButtonGroupEventType, ButtonGroupVariant, ButtonGroupOrientation, ButtonGroupDensity, } from "./button-group/types.js";
|
|
64
|
-
export type { CardSchema
|
|
69
|
+
export type { CardSchema as CardConfig,
|
|
70
|
+
/** @deprecated Use CardConfig. Removed in 1.0 (FLO-383). */
|
|
71
|
+
CardSchema, } from "./card/types.js";
|
|
65
72
|
export type { CarouselConfig, CarouselComponent } from "./carousel/types.js";
|
|
66
73
|
export type { CheckboxConfig, CheckboxComponent } from "./checkbox/types.js";
|
|
67
74
|
export type { ChipConfig, ChipComponent, ChipType, ChipEvents, ChipChangePayload, AssistChipConfig, FilterChipConfig, InputChipConfig, SuggestionChipConfig, ChipsConfig, ChipsComponent, } from "./chips/types.js";
|
|
@@ -86,9 +93,15 @@ export type { SliderConfig, SliderComponent, SliderEvent, } from "./slider/types
|
|
|
86
93
|
export type { SnackbarConfig, SnackbarComponent } from "./snackbar/types.js";
|
|
87
94
|
export type { SwitchConfig, SwitchComponent } from "./switch/types.js";
|
|
88
95
|
export type { TabsConfig, TabsComponent, TabConfig, TabComponent, } from "./tabs/types.js";
|
|
89
|
-
export type { TextfieldConfig, TextfieldComponent
|
|
96
|
+
export type { TextfieldConfig as TextFieldConfig, TextfieldComponent as TextFieldComponent,
|
|
97
|
+
/** @deprecated Use TextFieldConfig: M3 writes "text field" as two words. Removed in 1.0 (FLO-383). */
|
|
98
|
+
TextfieldConfig,
|
|
99
|
+
/** @deprecated Use TextFieldComponent: M3 writes "text field" as two words. Removed in 1.0 (FLO-383). */
|
|
100
|
+
TextfieldComponent, } from "./textfield/types.js";
|
|
90
101
|
export type { TimePickerConfig, TimePickerComponent } from "./timepicker/types.js";
|
|
91
102
|
export type { FabMenuConfig, FabMenuComponent, FabMenuEvents, FabMenuItem } from "./fab-menu/types.js";
|
|
92
103
|
export type { ToolbarConfig, ToolbarComponent, ToolbarEvents, ToolbarItem, } from "./toolbar/types.js";
|
|
93
|
-
export type { TopAppBarConfig, TopAppBar
|
|
104
|
+
export type { TopAppBarConfig, TopAppBar as TopAppBarComponent,
|
|
105
|
+
/** @deprecated Use TopAppBarComponent, the name every component type has. Removed in 1.0 (FLO-383). */
|
|
106
|
+
TopAppBar, } from "./top-app-bar/types.js";
|
|
94
107
|
export type { TooltipConfig, TooltipComponent } from "./tooltip/types.js";
|
package/dist/components/index.js
CHANGED
|
@@ -33,7 +33,8 @@ export { clearSnackbars } from "./snackbar/index.js";
|
|
|
33
33
|
export { default as createSwitch } from "./switch/index.js";
|
|
34
34
|
export { default as createTabs } from "./tabs/index.js";
|
|
35
35
|
export { createTab } from "./tabs/tab.js";
|
|
36
|
-
export { default as
|
|
36
|
+
export { default as createTextField } from "./textfield/index.js";
|
|
37
|
+
export { default as createTextfield, } from "./textfield/index.js";
|
|
37
38
|
export { default as createTimePicker } from "./timepicker/index.js";
|
|
38
39
|
export { default as createToolbar } from "./toolbar/index.js";
|
|
39
40
|
export { default as createTopAppBar } from "./top-app-bar/index.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ForwardedEventPayload } from "../../core/dom/index.js";
|
|
1
2
|
/**
|
|
2
3
|
* Configuration for the List component
|
|
3
4
|
* @interface ListConfig
|
|
@@ -375,8 +376,9 @@ export interface ListComponent<T = unknown> {
|
|
|
375
376
|
export interface ListEvents<T = unknown> {
|
|
376
377
|
select: (event: SelectEvent<T>) => void;
|
|
377
378
|
load: (event: LoadEvent<T>) => void;
|
|
378
|
-
scroll: (event: {
|
|
379
|
-
|
|
380
|
-
component
|
|
379
|
+
scroll: (event: ForwardedEventPayload<Event, HTMLElement> & {
|
|
380
|
+
/** @deprecated Never sent: the root's scroll is forwarded without it. Removed in 1.0 (FLO-380, FLO-384). */
|
|
381
|
+
component?: ListComponent<T>;
|
|
381
382
|
}) => void;
|
|
383
|
+
keydown: (event: ForwardedEventPayload<KeyboardEvent, HTMLElement>) => void;
|
|
382
384
|
}
|
|
@@ -41,11 +41,11 @@ export const createKeyboardNavigation = (component) => {
|
|
|
41
41
|
return null;
|
|
42
42
|
const level = parseInt(menuElement.getAttribute("data-level") || "1", 10);
|
|
43
43
|
const owner = component.element.id;
|
|
44
|
-
const ownerFilter = owner ? `[data-owner="${owner}"]` : "";
|
|
45
44
|
const scope = level <= 1
|
|
46
45
|
? component.element
|
|
47
|
-
: menuElement.getRootNode().
|
|
48
|
-
|
|
46
|
+
: Array.from(menuElement.getRootNode().querySelectorAll(`.${component.getClass("menu--submenu")}`)).find((candidate) => (!owner || candidate.getAttribute("data-owner") === owner) &&
|
|
47
|
+
candidate.getAttribute("data-level") === String(level - 1));
|
|
48
|
+
return Array.from((scope ?? component.element).querySelectorAll(`.${component.getClass("menu__item")}`)).find((candidate) => candidate.getAttribute("data-id") === parentId) ?? null;
|
|
49
49
|
};
|
|
50
50
|
const menuItems = (menuElement) => Array.from(menuElement.querySelectorAll(`.${component.getClass("menu__item")}`));
|
|
51
51
|
const resetTypeahead = () => {
|
|
@@ -59,8 +59,11 @@ export const createKeyboardNavigation = (component) => {
|
|
|
59
59
|
resetTypeahead();
|
|
60
60
|
const items = menuItems(menuElement);
|
|
61
61
|
items.forEach((item) => item.setAttribute("tabindex", "-1"));
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
items[0]?.setAttribute("tabindex", "0");
|
|
63
|
+
const focused = activeElementOf(menuElement);
|
|
64
|
+
if (focused !== menuElement && menuElement.contains(focused) ||
|
|
65
|
+
focused?.closest(`.${component.getClass("menu--submenu")}`)?.getAttribute("data-owner") === menuElement.id)
|
|
66
|
+
return;
|
|
64
67
|
if (interactionType === "keyboard" && items.length > 0) {
|
|
65
68
|
items[0].focus();
|
|
66
69
|
return;
|
|
@@ -50,7 +50,7 @@ const withOpener = (config) => (component) => {
|
|
|
50
50
|
};
|
|
51
51
|
const determineActiveClass = (element) => {
|
|
52
52
|
const classPrefix = component.getClass("").split("-")[0];
|
|
53
|
-
if (element.tagName === "BUTTON") {
|
|
53
|
+
if (element.tagName === "BUTTON" && element.classList.contains(`${classPrefix}-button`)) {
|
|
54
54
|
return `${classPrefix}-button--active`;
|
|
55
55
|
}
|
|
56
56
|
else if (element.classList.contains(`${classPrefix}-chip`)) {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* @category Components
|
|
9
9
|
*/
|
|
10
10
|
export { default } from "./menu.js";
|
|
11
|
+
export type { MenuEvents } from "./types.js";
|
|
11
12
|
export type { MenuConfig, MenuComponent, MenuItem, MenuDivider, MenuGap, MenuContent, MenuEvent, MenuSelectEvent, MenuPosition } from "./types.js";
|
|
12
13
|
/**
|
|
13
14
|
* Constants for menu position values - use these instead of string literals
|
|
@@ -45,7 +45,7 @@ export const withCanvas = (config) => (component) => {
|
|
|
45
45
|
const strokeWidth = () => getStrokeWidth(currentThickness);
|
|
46
46
|
const max = () => component.state?.max ?? config.max ?? 100;
|
|
47
47
|
const isIndeterminate = () => component.state?.indeterminate ?? config.indeterminate ?? false;
|
|
48
|
-
const colors = createColors(() => draw(animationTime));
|
|
48
|
+
const colors = createColors(component.element, () => draw(animationTime));
|
|
49
49
|
const measure = () => {
|
|
50
50
|
if (!context)
|
|
51
51
|
return;
|
|
@@ -6,10 +6,11 @@ export interface ProgressColors {
|
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* Keeps the palette for one indicator, refreshed when the theme changes.
|
|
9
|
+
* @param element - the indicator's element, where its theme is read
|
|
9
10
|
* @param onChange - called after the colours change, to redraw
|
|
10
11
|
* @returns the palette getter and a cleanup function
|
|
11
12
|
*/
|
|
12
|
-
export declare const createColors: (onChange: () => void) => {
|
|
13
|
+
export declare const createColors: (element: Element, onChange: () => void) => {
|
|
13
14
|
get: () => ProgressColors;
|
|
14
15
|
refresh: () => void;
|
|
15
16
|
destroy: () => void;
|
|
@@ -7,27 +7,34 @@ const FALLBACKS = {
|
|
|
7
7
|
stop: "#6750A4",
|
|
8
8
|
buffer: "#EADDFF",
|
|
9
9
|
};
|
|
10
|
-
const read = () => ({
|
|
11
|
-
indicator: getThemeColor(PROGRESS_COLORS.INDICATOR, { fallback: FALLBACKS.indicator }),
|
|
12
|
-
track: getThemeColor(PROGRESS_COLORS.TRACK, { fallback: FALLBACKS.track }),
|
|
13
|
-
stop: getThemeColor(PROGRESS_COLORS.STOP, { fallback: FALLBACKS.stop }),
|
|
14
|
-
buffer: getThemeColor(PROGRESS_COLORS.BUFFER, { fallback: FALLBACKS.buffer }),
|
|
10
|
+
const read = (element) => ({
|
|
11
|
+
indicator: getThemeColor(PROGRESS_COLORS.INDICATOR, { element, fallback: FALLBACKS.indicator }),
|
|
12
|
+
track: getThemeColor(PROGRESS_COLORS.TRACK, { element, fallback: FALLBACKS.track }),
|
|
13
|
+
stop: getThemeColor(PROGRESS_COLORS.STOP, { element, fallback: FALLBACKS.stop }),
|
|
14
|
+
buffer: getThemeColor(PROGRESS_COLORS.BUFFER, { element, fallback: FALLBACKS.buffer }),
|
|
15
15
|
});
|
|
16
|
-
export const createColors = (onChange) => {
|
|
16
|
+
export const createColors = (element, onChange) => {
|
|
17
17
|
let colors = FALLBACKS;
|
|
18
18
|
let read_ = false;
|
|
19
19
|
const refresh = () => {
|
|
20
|
+
if (!element.isConnected)
|
|
21
|
+
return;
|
|
20
22
|
try {
|
|
21
|
-
colors = read();
|
|
23
|
+
colors = read(element);
|
|
22
24
|
read_ = true;
|
|
23
25
|
}
|
|
24
26
|
catch {
|
|
25
27
|
}
|
|
26
28
|
};
|
|
27
|
-
const
|
|
29
|
+
const update = () => {
|
|
28
30
|
refresh();
|
|
29
31
|
onChange();
|
|
30
|
-
}
|
|
32
|
+
};
|
|
33
|
+
const offThemeChange = onThemeChange(update);
|
|
34
|
+
const observer = typeof ResizeObserver !== "undefined"
|
|
35
|
+
? new ResizeObserver(update)
|
|
36
|
+
: null;
|
|
37
|
+
observer?.observe(element);
|
|
31
38
|
return {
|
|
32
39
|
get: () => {
|
|
33
40
|
if (!read_)
|
|
@@ -35,6 +42,9 @@ export const createColors = (onChange) => {
|
|
|
35
42
|
return colors;
|
|
36
43
|
},
|
|
37
44
|
refresh,
|
|
38
|
-
destroy:
|
|
45
|
+
destroy: () => {
|
|
46
|
+
observer?.disconnect();
|
|
47
|
+
offThemeChange();
|
|
48
|
+
},
|
|
39
49
|
};
|
|
40
50
|
};
|
|
@@ -19,6 +19,7 @@ interface ComponentWithRadio {
|
|
|
19
19
|
removeOption: (value: string) => void;
|
|
20
20
|
enable: () => void;
|
|
21
21
|
disable: () => void;
|
|
22
|
+
isDisabled: () => boolean;
|
|
22
23
|
enableOption: (value: string) => void;
|
|
23
24
|
disableOption: (value: string) => void;
|
|
24
25
|
getClass: (name: string) => string;
|
|
@@ -21,8 +21,8 @@ export declare const RADIO_DIRECTIONS: {
|
|
|
21
21
|
readonly HORIZONTAL: "horizontal";
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
|
-
* @deprecated Read by
|
|
25
|
-
* and has one size and variant (FLO-266).
|
|
24
|
+
* @deprecated Read only by `RADIO_DEFAULTS`, which the component does not read:
|
|
25
|
+
* it builds its class names itself and has one size and variant (FLO-266).
|
|
26
26
|
*/
|
|
27
27
|
export declare const RADIO_VARIANTS: {
|
|
28
28
|
/** Standard radio button */
|
|
@@ -33,8 +33,8 @@ export declare const RADIO_VARIANTS: {
|
|
|
33
33
|
readonly OUTLINED: "outlined";
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
36
|
-
* @deprecated Read by
|
|
37
|
-
* and has one size and variant (FLO-266).
|
|
36
|
+
* @deprecated Read only by `RADIO_DEFAULTS`, which the component does not read:
|
|
37
|
+
* it builds its class names itself and has one size and variant (FLO-266).
|
|
38
38
|
*/
|
|
39
39
|
export declare const RADIO_LABEL_POSITIONS: {
|
|
40
40
|
/** Label to the right of the radio (default) */
|
|
@@ -43,8 +43,8 @@ export declare const RADIO_LABEL_POSITIONS: {
|
|
|
43
43
|
readonly LEFT: "left";
|
|
44
44
|
};
|
|
45
45
|
/**
|
|
46
|
-
* @deprecated Read by
|
|
47
|
-
* and has one size and variant (FLO-266).
|
|
46
|
+
* @deprecated Read only by `RADIO_DEFAULTS`, which the component does not read:
|
|
47
|
+
* it builds its class names itself and has one size and variant (FLO-266).
|
|
48
48
|
*/
|
|
49
49
|
export declare const RADIO_SIZES: {
|
|
50
50
|
/** Small radio button */
|
|
@@ -18,6 +18,7 @@ export declare const withRadio: (config: RadiosConfig) => <C extends RadioHost>(
|
|
|
18
18
|
addOption: (option: RadioOptionConfig) => C;
|
|
19
19
|
removeOption: (value: string) => C;
|
|
20
20
|
enable: () => C;
|
|
21
|
+
isDisabled: () => boolean;
|
|
21
22
|
disable: () => C;
|
|
22
23
|
enableOption: (value: string) => C;
|
|
23
24
|
disableOption: (value: string) => C;
|
|
@@ -131,6 +131,7 @@ export const withRadio = (config) => (component) => {
|
|
|
131
131
|
});
|
|
132
132
|
return component;
|
|
133
133
|
},
|
|
134
|
+
isDisabled: () => component.element.classList.contains(`${radiosClass}--disabled`),
|
|
134
135
|
disable: () => {
|
|
135
136
|
component.element.classList.add(`${radiosClass}--disabled`);
|
|
136
137
|
radios.forEach(radio => {
|
|
@@ -170,6 +170,8 @@ export interface RadiosComponent {
|
|
|
170
170
|
* @returns The radios component for chaining
|
|
171
171
|
*/
|
|
172
172
|
disable: () => RadiosComponent;
|
|
173
|
+
/** Whether the whole group is disabled (FLO-384) */
|
|
174
|
+
isDisabled: () => boolean;
|
|
173
175
|
/**
|
|
174
176
|
* Enables a specific radio option
|
|
175
177
|
* @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));
|
|
@@ -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
|