mtrl 0.4.0 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/badge/api.d.ts +5 -5
- package/dist/components/badge/config.d.ts +17 -7
- package/dist/components/bottom-app-bar/bottom-app-bar.d.ts +1 -1
- package/dist/components/bottom-app-bar/config.d.ts +1 -1
- package/dist/components/button/api.d.ts +19 -3
- package/dist/components/button/button.d.ts +41 -1
- package/dist/components/button/config.d.ts +17 -6
- package/dist/components/button/constants.d.ts +36 -0
- package/dist/components/button/features/progress.d.ts +26 -0
- package/dist/components/button/types.d.ts +108 -1
- package/dist/components/card/config.d.ts +1 -1
- package/dist/components/card/features.d.ts +14 -1
- package/dist/components/card/index.d.ts +6 -6
- package/dist/components/carousel/api.d.ts +15 -11
- package/dist/components/carousel/carousel.d.ts +1 -1
- package/dist/components/carousel/config.d.ts +1 -1
- package/dist/components/carousel/features/drag.d.ts +1 -1
- package/dist/components/carousel/features/slides.d.ts +1 -1
- package/dist/components/checkbox/config.d.ts +1 -1
- package/dist/components/checkbox/types.d.ts +2 -2
- package/dist/components/chips/chip/chip.d.ts +1 -1
- package/dist/components/chips/chip/config.d.ts +1 -1
- package/dist/components/chips/chips.d.ts +1 -1
- package/dist/components/chips/features/chip-items.d.ts +1 -1
- package/dist/components/chips/schema.d.ts +0 -1
- package/dist/components/datepicker/api.d.ts +1 -1
- package/dist/components/datepicker/config.d.ts +1 -1
- package/dist/components/datepicker/datepicker.d.ts +1 -1
- package/dist/components/datepicker/render.d.ts +5 -5
- package/dist/components/dialog/features.d.ts +1 -1
- package/dist/components/divider/divider.d.ts +2 -2
- package/dist/components/extended-fab/config.d.ts +1 -1
- package/dist/components/fab/config.d.ts +1 -1
- package/dist/components/index.d.ts +2 -1
- package/dist/components/menu/api.d.ts +14 -14
- package/dist/components/menu/config.d.ts +1 -1
- package/dist/components/menu/features/controller.d.ts +1 -1
- package/dist/components/menu/features/keyboard.d.ts +2 -2
- package/dist/components/menu/features/submenu.d.ts +1 -1
- package/dist/components/menu/menu.d.ts +1 -1
- package/dist/components/navigation/config.d.ts +1 -1
- package/dist/components/navigation/features/controller.d.ts +1 -1
- package/dist/components/navigation/features/items.d.ts +2 -1
- package/dist/components/navigation/navigation.d.ts +1 -1
- package/dist/components/navigation/system/core.d.ts +1 -1
- package/dist/components/navigation/system/events.d.ts +1 -1
- package/dist/components/navigation/system/index.d.ts +2 -2
- package/dist/components/progress/api.d.ts +33 -2
- package/dist/components/progress/config.d.ts +2 -2
- package/dist/components/progress/constants.d.ts +25 -21
- package/dist/components/progress/features/canvas.d.ts +34 -5
- package/dist/components/progress/features/circular.d.ts +2 -2
- package/dist/components/progress/features/linear.d.ts +2 -2
- package/dist/components/progress/features/state.d.ts +9 -1
- package/dist/components/progress/progress.d.ts +1 -1
- package/dist/components/progress/types.d.ts +18 -6
- package/dist/components/radios/api.d.ts +11 -11
- package/dist/components/radios/config.d.ts +1 -1
- package/dist/components/radios/radios.d.ts +1 -1
- package/dist/components/search/api.d.ts +15 -11
- package/dist/components/search/features/search.d.ts +1 -1
- package/dist/components/segmented-button/config.d.ts +6 -6
- package/dist/components/select/api.d.ts +1 -1
- package/dist/components/select/config.d.ts +1 -1
- package/dist/components/select/features.d.ts +1 -1
- package/dist/components/select/types.d.ts +20 -5
- package/dist/components/sheet/config.d.ts +1 -1
- package/dist/components/sheet/sheet.d.ts +1 -1
- package/dist/components/slider/api.d.ts +3 -2
- package/dist/components/slider/config.d.ts +1 -1
- package/dist/components/slider/constants.d.ts +50 -21
- package/dist/components/slider/features/canvas.d.ts +47 -0
- package/dist/components/slider/features/controller.d.ts +1 -1
- package/dist/components/slider/features/handlers.d.ts +1 -1
- package/dist/components/slider/features/index.d.ts +1 -0
- package/dist/components/slider/features/states.d.ts +1 -1
- package/dist/components/slider/schema.d.ts +4 -47
- package/dist/components/slider/slider.d.ts +5 -4
- package/dist/components/slider/types.d.ts +10 -37
- package/dist/components/snackbar/api.d.ts +1 -1
- package/dist/components/snackbar/config.d.ts +2 -2
- package/dist/components/switch/api.d.ts +1 -1
- package/dist/components/switch/config.d.ts +1 -1
- package/dist/components/switch/features.d.ts +4 -4
- package/dist/components/switch/switch.d.ts +1 -1
- package/dist/components/switch/types.d.ts +22 -17
- package/dist/components/tabs/config.d.ts +2 -3
- package/dist/components/tabs/features.d.ts +5 -5
- package/dist/components/tabs/index.d.ts +10 -10
- package/dist/components/tabs/tab.d.ts +1 -1
- package/dist/components/tabs/utils.d.ts +1 -1
- package/dist/components/textfield/api.d.ts +13 -3
- package/dist/components/textfield/config.d.ts +1 -1
- package/dist/components/textfield/constants.d.ts +12 -20
- package/dist/components/textfield/features/density.d.ts +28 -0
- package/dist/components/textfield/features/index.d.ts +13 -12
- package/dist/components/textfield/index.d.ts +3 -3
- package/dist/components/textfield/textfield.d.ts +1 -1
- package/dist/components/textfield/types.d.ts +42 -35
- package/dist/components/timepicker/clockdial.d.ts +2 -2
- package/dist/components/timepicker/config.d.ts +1 -1
- package/dist/components/timepicker/render.d.ts +1 -1
- package/dist/components/timepicker/timepicker.d.ts +1 -1
- package/dist/components/timepicker/utils.d.ts +2 -2
- package/dist/components/tooltip/api.d.ts +1 -1
- package/dist/components/tooltip/config.d.ts +1 -1
- package/dist/components/top-app-bar/top-app-bar.d.ts +2 -2
- package/dist/constants.d.ts +30 -30
- package/dist/core/canvas/animation.d.ts +27 -0
- package/dist/core/canvas/drawing.d.ts +57 -0
- package/dist/core/canvas/index.d.ts +6 -3
- package/dist/core/canvas/utils.d.ts +84 -0
- package/dist/core/collection/collection.d.ts +7 -7
- package/dist/core/collection/list-manager/index.d.ts +2 -2
- package/dist/core/collection/list-manager/renderer.d.ts +3 -3
- package/dist/core/collection/list-manager/scroll-tracker.d.ts +1 -1
- package/dist/core/compose/component.d.ts +1 -0
- package/dist/core/compose/features/checkable.d.ts +2 -2
- package/dist/core/compose/features/gestures/longpress.d.ts +2 -2
- package/dist/core/compose/features/gestures/pan.d.ts +2 -2
- package/dist/core/compose/features/gestures/pinch.d.ts +2 -2
- package/dist/core/compose/features/gestures/rotate.d.ts +2 -2
- package/dist/core/compose/features/gestures/swipe.d.ts +2 -2
- package/dist/core/compose/features/gestures/tap.d.ts +2 -2
- package/dist/core/compose/features/gestures.d.ts +2 -2
- package/dist/core/compose/features/input.d.ts +1 -1
- package/dist/core/compose/features/ripple.d.ts +2 -2
- package/dist/core/compose/features/size.d.ts +1 -1
- package/dist/core/compose/features/textinput.d.ts +1 -1
- package/dist/core/compose/features/throttle.d.ts +1 -1
- package/dist/core/compose/features/variant.d.ts +1 -1
- package/dist/core/compose/features/withEvents.d.ts +1 -1
- package/dist/core/composition/features/label.d.ts +1 -1
- package/dist/core/config/component.d.ts +2 -0
- package/dist/core/config/global.d.ts +65 -0
- package/dist/core/dom/create.d.ts +1 -1
- package/dist/core/gestures/pan.d.ts +1 -1
- package/dist/core/gestures/pinch.d.ts +1 -1
- package/dist/core/gestures/rotate.d.ts +1 -1
- package/dist/core/index.d.ts +2 -0
- package/dist/core/layout/array.d.ts +7 -2
- package/dist/core/layout/object.d.ts +1 -1
- package/dist/core/layout/processor.d.ts +2 -2
- package/dist/core/layout/utils.d.ts +1 -1
- package/dist/core/utils/color.d.ts +14 -0
- package/dist/core/utils/index.d.ts +1 -0
- package/dist/index.cjs +15 -15
- package/dist/index.cjs.map +149 -140
- package/dist/index.d.ts +7 -7
- package/dist/index.js +15 -15
- package/dist/index.js.map +149 -140
- package/dist/package.json +1 -1
- package/dist/styles.css +2 -2
- package/package.json +8 -2
- package/dist/components/progress/features.d.ts +0 -40
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BadgeComponent } from
|
|
1
|
+
import { BadgeComponent } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* API configuration options for badge component
|
|
4
4
|
* @category Components
|
|
@@ -29,10 +29,10 @@ interface ComponentWithElements {
|
|
|
29
29
|
variant?: string;
|
|
30
30
|
};
|
|
31
31
|
getClass: (name: string) => string;
|
|
32
|
-
addClass: (...classes: string[]) =>
|
|
33
|
-
removeClass: (...classes: string[]) =>
|
|
34
|
-
on: (event: string, handler: Function) =>
|
|
35
|
-
off: (event: string, handler: Function) =>
|
|
32
|
+
addClass: (...classes: string[]) => ComponentWithElements;
|
|
33
|
+
removeClass: (...classes: string[]) => ComponentWithElements;
|
|
34
|
+
on: (event: string, handler: Function) => ComponentWithElements;
|
|
35
|
+
off: (event: string, handler: Function) => ComponentWithElements;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Enhances a badge component with API methods.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BadgeConfig } from
|
|
1
|
+
import { BadgeConfig } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* Default configuration for the Badge component
|
|
4
4
|
* These values will be used when not explicitly specified by the user.
|
|
@@ -47,15 +47,25 @@ export declare const getElementConfig: (config: BadgeConfig) => {
|
|
|
47
47
|
* @category Components
|
|
48
48
|
* @internal
|
|
49
49
|
*/
|
|
50
|
-
export declare const getApiConfig: (comp:
|
|
50
|
+
export declare const getApiConfig: (comp: {
|
|
51
51
|
visibility: {
|
|
52
|
-
show: () =>
|
|
53
|
-
hide: () =>
|
|
54
|
-
toggle: (visible?: boolean) =>
|
|
55
|
-
isVisible: () =>
|
|
52
|
+
show: () => void;
|
|
53
|
+
hide: () => void;
|
|
54
|
+
toggle: (visible?: boolean) => void;
|
|
55
|
+
isVisible: () => boolean;
|
|
56
56
|
};
|
|
57
57
|
lifecycle: {
|
|
58
|
-
destroy: () =>
|
|
58
|
+
destroy: () => void;
|
|
59
|
+
};
|
|
60
|
+
}) => {
|
|
61
|
+
visibility: {
|
|
62
|
+
show: () => void;
|
|
63
|
+
hide: () => void;
|
|
64
|
+
toggle: (visible?: boolean) => void;
|
|
65
|
+
isVisible: () => boolean;
|
|
66
|
+
};
|
|
67
|
+
lifecycle: {
|
|
68
|
+
destroy: () => void;
|
|
59
69
|
};
|
|
60
70
|
};
|
|
61
71
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ButtonComponent } from
|
|
1
|
+
import { ButtonComponent } from "./types";
|
|
2
|
+
import { ProgressComponent } from "../progress/types";
|
|
2
3
|
/**
|
|
3
4
|
* API configuration options for button component
|
|
4
5
|
* @category Components
|
|
@@ -8,6 +9,7 @@ interface ApiOptions {
|
|
|
8
9
|
disabled: {
|
|
9
10
|
enable: () => void;
|
|
10
11
|
disable: () => void;
|
|
12
|
+
isDisabled: () => boolean;
|
|
11
13
|
};
|
|
12
14
|
lifecycle: {
|
|
13
15
|
destroy: () => void;
|
|
@@ -21,17 +23,31 @@ interface ApiOptions {
|
|
|
21
23
|
interface ComponentWithElements {
|
|
22
24
|
element: HTMLElement;
|
|
23
25
|
text: {
|
|
24
|
-
setText: (content: string) =>
|
|
26
|
+
setText: (content: string) => void;
|
|
25
27
|
getText: () => string;
|
|
26
28
|
getElement: () => HTMLElement | null;
|
|
27
29
|
};
|
|
28
30
|
icon: {
|
|
29
|
-
setIcon: (html: string) =>
|
|
31
|
+
setIcon: (html: string) => void;
|
|
30
32
|
getIcon: () => string;
|
|
31
33
|
getElement: () => HTMLElement | null;
|
|
32
34
|
};
|
|
33
35
|
getClass: (name: string) => string;
|
|
34
36
|
componentName?: string;
|
|
37
|
+
on?: (event: string, handler: Function) => ComponentWithElements;
|
|
38
|
+
off?: (event: string, handler: Function) => ComponentWithElements;
|
|
39
|
+
addClass?: (...classes: string[]) => ComponentWithElements;
|
|
40
|
+
progress?: ProgressComponent;
|
|
41
|
+
showProgress?: () => Promise<ComponentWithElements>;
|
|
42
|
+
showProgressSync?: () => ComponentWithElements;
|
|
43
|
+
hideProgress?: () => Promise<ComponentWithElements>;
|
|
44
|
+
hideProgressSync?: () => ComponentWithElements;
|
|
45
|
+
setProgress?: (value: number) => Promise<ComponentWithElements>;
|
|
46
|
+
setProgressSync?: (value: number) => ComponentWithElements;
|
|
47
|
+
setIndeterminate?: (indeterminate: boolean) => Promise<ComponentWithElements>;
|
|
48
|
+
setIndeterminateSync?: (indeterminate: boolean) => ComponentWithElements;
|
|
49
|
+
setLoading?: (loading: boolean, text?: string) => Promise<ComponentWithElements>;
|
|
50
|
+
setLoadingSync?: (loading: boolean, text?: string) => ComponentWithElements;
|
|
35
51
|
}
|
|
36
52
|
/**
|
|
37
53
|
* Enhances a button component with API methods.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ButtonConfig } from
|
|
1
|
+
import { ButtonConfig } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* Creates a new Button component with the specified configuration.
|
|
4
4
|
*
|
|
@@ -19,6 +19,46 @@ import { ButtonConfig } from './types';
|
|
|
19
19
|
*
|
|
20
20
|
* @throws {Error} Throws an error if button creation fails for any reason
|
|
21
21
|
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* // Create a button with integrated progress
|
|
25
|
+
* const submitButton = createButton({
|
|
26
|
+
* text: 'Submit',
|
|
27
|
+
* variant: 'filled',
|
|
28
|
+
* progress: {
|
|
29
|
+
* variant: 'circular',
|
|
30
|
+
* size: 18,
|
|
31
|
+
* indeterminate: true
|
|
32
|
+
* }
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* // Create a square button with different sizes
|
|
36
|
+
* const squareButton = createButton({
|
|
37
|
+
* text: 'Square Button',
|
|
38
|
+
* variant: 'tonal',
|
|
39
|
+
* shape: 'square',
|
|
40
|
+
* size: 'm' // Square buttons have size-specific corner radius
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* // Synchronous usage (common for UI interactions)
|
|
44
|
+
* submitButton.on('click', () => {
|
|
45
|
+
* submitButton.setLoadingSync(true, 'Submitting...');
|
|
46
|
+
*
|
|
47
|
+
* // Simulate async work
|
|
48
|
+
* setTimeout(() => {
|
|
49
|
+
* submitButton.setLoadingSync(false, 'Submit');
|
|
50
|
+
* }, 2000);
|
|
51
|
+
* });
|
|
52
|
+
*
|
|
53
|
+
* // Asynchronous usage (when you need to ensure progress is loaded)
|
|
54
|
+
* submitButton.on('click', async () => {
|
|
55
|
+
* await submitButton.setLoading(true, 'Processing...');
|
|
56
|
+
* await submitButton.setProgress(50);
|
|
57
|
+
* // ... more async operations
|
|
58
|
+
* await submitButton.setLoading(false, 'Done');
|
|
59
|
+
* });
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
22
62
|
* @category Components
|
|
23
63
|
*/
|
|
24
64
|
declare const createButton: (config?: ButtonConfig) => any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ButtonConfig } from
|
|
1
|
+
import { ButtonConfig } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* Default configuration for the Button component.
|
|
4
4
|
* These values will be used when not explicitly specified by the user.
|
|
@@ -8,7 +8,8 @@ import { ButtonConfig } from './types';
|
|
|
8
8
|
export declare const defaultConfig: ButtonConfig;
|
|
9
9
|
/**
|
|
10
10
|
* Creates the base configuration for Button component by merging user-provided
|
|
11
|
-
* config with default values.
|
|
11
|
+
* config with default values. Global configuration is automatically applied
|
|
12
|
+
* by createComponentConfig.
|
|
12
13
|
*
|
|
13
14
|
* @param {ButtonConfig} config - User provided configuration
|
|
14
15
|
* @returns {ButtonConfig} Complete configuration with defaults applied
|
|
@@ -47,13 +48,23 @@ export declare const getElementConfig: (config: ButtonConfig) => {
|
|
|
47
48
|
* @category Components
|
|
48
49
|
* @internal
|
|
49
50
|
*/
|
|
50
|
-
export declare const getApiConfig: (comp:
|
|
51
|
+
export declare const getApiConfig: (comp: {
|
|
51
52
|
disabled: {
|
|
52
|
-
enable: () =>
|
|
53
|
-
disable: () =>
|
|
53
|
+
enable: () => void;
|
|
54
|
+
disable: () => void;
|
|
55
|
+
isDisabled: () => boolean;
|
|
54
56
|
};
|
|
55
57
|
lifecycle: {
|
|
56
|
-
destroy: () =>
|
|
58
|
+
destroy: () => void;
|
|
59
|
+
};
|
|
60
|
+
}) => {
|
|
61
|
+
disabled: {
|
|
62
|
+
enable: () => void;
|
|
63
|
+
disable: () => void;
|
|
64
|
+
isDisabled: () => boolean;
|
|
65
|
+
};
|
|
66
|
+
lifecycle: {
|
|
67
|
+
destroy: () => void;
|
|
57
68
|
};
|
|
58
69
|
};
|
|
59
70
|
export default defaultConfig;
|
|
@@ -13,6 +13,42 @@ export declare const BUTTON_VARIANTS: {
|
|
|
13
13
|
/** Button that appears as text without background or border (low emphasis) */
|
|
14
14
|
readonly TEXT: "text";
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Available button size variants matching MD3 specifications
|
|
18
|
+
* @category Components
|
|
19
|
+
*/
|
|
20
|
+
export declare const BUTTON_SIZES: {
|
|
21
|
+
/** Extra small size - 32px height */
|
|
22
|
+
readonly XS: "xs";
|
|
23
|
+
/** Small size - 40px height (default) */
|
|
24
|
+
readonly S: "s";
|
|
25
|
+
/** Medium size - 56px height */
|
|
26
|
+
readonly M: "m";
|
|
27
|
+
/** Large size - 96px height */
|
|
28
|
+
readonly L: "l";
|
|
29
|
+
/** Extra large size - 136px height */
|
|
30
|
+
readonly XL: "xl";
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Button size type
|
|
34
|
+
* @category Components
|
|
35
|
+
*/
|
|
36
|
+
export type ButtonSize = keyof typeof BUTTON_SIZES;
|
|
37
|
+
/**
|
|
38
|
+
* Available button shape variants
|
|
39
|
+
* @category Components
|
|
40
|
+
*/
|
|
41
|
+
export declare const BUTTON_SHAPES: {
|
|
42
|
+
/** Round shape - pill-shaped buttons (default) */
|
|
43
|
+
readonly ROUND: "round";
|
|
44
|
+
/** Square shape - buttons with size-specific corner radius */
|
|
45
|
+
readonly SQUARE: "square";
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Button shape type
|
|
49
|
+
* @category Components
|
|
50
|
+
*/
|
|
51
|
+
export type ButtonShape = keyof typeof BUTTON_SHAPES;
|
|
16
52
|
/**
|
|
17
53
|
* Default button types
|
|
18
54
|
*/
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ProgressComponent } from "../../progress/types";
|
|
2
|
+
import { ButtonConfig } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Component with progress capabilities
|
|
5
|
+
*/
|
|
6
|
+
interface ProgressEnhancedComponent {
|
|
7
|
+
element: HTMLElement;
|
|
8
|
+
icon?: any;
|
|
9
|
+
getClass: (name: string) => string;
|
|
10
|
+
progress?: ProgressComponent;
|
|
11
|
+
disabled?: {
|
|
12
|
+
enable: () => void;
|
|
13
|
+
disable: () => void;
|
|
14
|
+
};
|
|
15
|
+
setText?: (text: string) => any;
|
|
16
|
+
getText?: () => string;
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Adds progress functionality to a button component
|
|
21
|
+
*
|
|
22
|
+
* @param config - Button configuration with progress options
|
|
23
|
+
* @returns Component enhancer function
|
|
24
|
+
*/
|
|
25
|
+
export declare const withProgress: (config: ButtonConfig) => (component: ProgressEnhancedComponent) => ProgressEnhancedComponent;
|
|
26
|
+
export {};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { BaseComponentConfig } from '../../core/config/component';
|
|
2
|
+
import { ProgressConfig, ProgressComponent } from '../progress/types';
|
|
3
|
+
import { ButtonSize, ButtonShape } from './constants';
|
|
1
4
|
/**
|
|
2
5
|
* Button variant types - controls the visual style of the button
|
|
3
6
|
* @category Components
|
|
@@ -13,12 +16,22 @@ export type ButtonVariant = 'filled' | 'tonal' | 'outlined' | 'elevated' | 'text
|
|
|
13
16
|
* Configuration interface for the Button component
|
|
14
17
|
* @category Components
|
|
15
18
|
*/
|
|
16
|
-
export interface ButtonConfig {
|
|
19
|
+
export interface ButtonConfig extends BaseComponentConfig {
|
|
17
20
|
/**
|
|
18
21
|
* Button variant that determines visual styling
|
|
19
22
|
* @default 'filled'
|
|
20
23
|
*/
|
|
21
24
|
variant?: ButtonVariant | string;
|
|
25
|
+
/**
|
|
26
|
+
* Button size variant
|
|
27
|
+
* @default 's'
|
|
28
|
+
*/
|
|
29
|
+
size?: ButtonSize | string;
|
|
30
|
+
/**
|
|
31
|
+
* Button shape variant
|
|
32
|
+
* @default 'round'
|
|
33
|
+
*/
|
|
34
|
+
shape?: ButtonShape | string;
|
|
22
35
|
/**
|
|
23
36
|
* Whether the button is initially disabled
|
|
24
37
|
* @default false
|
|
@@ -83,6 +96,16 @@ export interface ButtonConfig {
|
|
|
83
96
|
* Required for icon-only buttons without text
|
|
84
97
|
*/
|
|
85
98
|
ariaLabel?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Progress indicator configuration
|
|
101
|
+
* When provided, integrates a progress component as the button's icon
|
|
102
|
+
*/
|
|
103
|
+
progress?: ProgressConfig | boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Whether to show progress initially
|
|
106
|
+
* @default false
|
|
107
|
+
*/
|
|
108
|
+
showProgress?: boolean;
|
|
86
109
|
}
|
|
87
110
|
/**
|
|
88
111
|
* Icon API interface for managing button icons
|
|
@@ -181,6 +204,28 @@ export interface ButtonComponent {
|
|
|
181
204
|
* @returns The button component for chaining
|
|
182
205
|
*/
|
|
183
206
|
setVariant: (variant: ButtonVariant | string) => ButtonComponent;
|
|
207
|
+
/**
|
|
208
|
+
* Gets the button's current size
|
|
209
|
+
* @returns Current size name ('xs', 's', 'm', 'l', 'xl')
|
|
210
|
+
*/
|
|
211
|
+
getSize: () => ButtonSize | string;
|
|
212
|
+
/**
|
|
213
|
+
* Sets the button's size
|
|
214
|
+
* @param size - New size to apply ('xs', 's', 'm', 'l', 'xl')
|
|
215
|
+
* @returns The button component for chaining
|
|
216
|
+
*/
|
|
217
|
+
setSize: (size: ButtonSize | string) => ButtonComponent;
|
|
218
|
+
/**
|
|
219
|
+
* Gets the button's current shape
|
|
220
|
+
* @returns Current shape name ('round', 'square')
|
|
221
|
+
*/
|
|
222
|
+
getShape: () => ButtonShape | string;
|
|
223
|
+
/**
|
|
224
|
+
* Sets the button's shape
|
|
225
|
+
* @param shape - New shape to apply ('round', 'square')
|
|
226
|
+
* @returns The button component for chaining
|
|
227
|
+
*/
|
|
228
|
+
setShape: (shape: ButtonShape | string) => ButtonComponent;
|
|
184
229
|
/**
|
|
185
230
|
* Enables the button (removes disabled attribute)
|
|
186
231
|
* @returns The button component for chaining
|
|
@@ -262,4 +307,66 @@ export interface ButtonComponent {
|
|
|
262
307
|
* @returns The button component for chaining
|
|
263
308
|
*/
|
|
264
309
|
setAriaLabel: (label: string) => ButtonComponent;
|
|
310
|
+
/**
|
|
311
|
+
* Progress component instance (if progress is enabled)
|
|
312
|
+
*/
|
|
313
|
+
progress?: ProgressComponent;
|
|
314
|
+
/**
|
|
315
|
+
* Shows the progress indicator (if progress is enabled)
|
|
316
|
+
* @returns The button component for chaining
|
|
317
|
+
*/
|
|
318
|
+
showProgress?: () => Promise<ButtonComponent>;
|
|
319
|
+
/**
|
|
320
|
+
* Shows the progress indicator synchronously (if progress is enabled)
|
|
321
|
+
* @returns The button component for chaining
|
|
322
|
+
*/
|
|
323
|
+
showProgressSync?: () => ButtonComponent;
|
|
324
|
+
/**
|
|
325
|
+
* Hides the progress indicator (if progress is enabled)
|
|
326
|
+
* @returns The button component for chaining
|
|
327
|
+
*/
|
|
328
|
+
hideProgress?: () => Promise<ButtonComponent>;
|
|
329
|
+
/**
|
|
330
|
+
* Hides the progress indicator synchronously (if progress is enabled)
|
|
331
|
+
* @returns The button component for chaining
|
|
332
|
+
*/
|
|
333
|
+
hideProgressSync?: () => ButtonComponent;
|
|
334
|
+
/**
|
|
335
|
+
* Sets the progress value (0-100) (if progress is enabled)
|
|
336
|
+
* @param value - Progress value
|
|
337
|
+
* @returns The button component for chaining
|
|
338
|
+
*/
|
|
339
|
+
setProgress?: (value: number) => Promise<ButtonComponent>;
|
|
340
|
+
/**
|
|
341
|
+
* Sets the progress value synchronously (0-100) (if progress is enabled)
|
|
342
|
+
* @param value - Progress value
|
|
343
|
+
* @returns The button component for chaining
|
|
344
|
+
*/
|
|
345
|
+
setProgressSync?: (value: number) => ButtonComponent;
|
|
346
|
+
/**
|
|
347
|
+
* Sets the progress to indeterminate mode (if progress is enabled)
|
|
348
|
+
* @param indeterminate - Whether progress should be indeterminate
|
|
349
|
+
* @returns The button component for chaining
|
|
350
|
+
*/
|
|
351
|
+
setIndeterminate?: (indeterminate: boolean) => Promise<ButtonComponent>;
|
|
352
|
+
/**
|
|
353
|
+
* Sets the progress to indeterminate mode synchronously (if progress is enabled)
|
|
354
|
+
* @param indeterminate - Whether progress should be indeterminate
|
|
355
|
+
* @returns The button component for chaining
|
|
356
|
+
*/
|
|
357
|
+
setIndeterminateSync?: (indeterminate: boolean) => ButtonComponent;
|
|
358
|
+
/**
|
|
359
|
+
* Updates both button text and progress for loading states (if progress is enabled)
|
|
360
|
+
* @param loading - Whether to show loading state
|
|
361
|
+
* @param text - Optional text to display while loading
|
|
362
|
+
* @returns The button component for chaining
|
|
363
|
+
*/
|
|
364
|
+
setLoading?: (loading: boolean, text?: string) => Promise<ButtonComponent>;
|
|
365
|
+
/**
|
|
366
|
+
* Updates both button text and progress for loading states synchronously (if progress is enabled)
|
|
367
|
+
* @param loading - Whether to show loading state
|
|
368
|
+
* @param text - Optional text to display while loading
|
|
369
|
+
* @returns The button component for chaining
|
|
370
|
+
*/
|
|
371
|
+
setLoadingSync?: (loading: boolean, text?: string) => ButtonComponent;
|
|
265
372
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseComponent, CardComponent, LoadingFeature, ExpandableFeature, SwipeableFeature } from
|
|
1
|
+
import { BaseComponent, CardComponent, LoadingFeature, ExpandableFeature, SwipeableFeature } from "./types";
|
|
2
2
|
interface LoadingConfig {
|
|
3
3
|
initialState?: boolean;
|
|
4
4
|
}
|
|
@@ -11,6 +11,19 @@ interface SwipeableConfig {
|
|
|
11
11
|
onSwipeRight?: (component: CardComponent) => void;
|
|
12
12
|
threshold?: number;
|
|
13
13
|
}
|
|
14
|
+
export type JSONValue = string | number | boolean | null | JSONObject | JSONArray;
|
|
15
|
+
export type JSONObject = {
|
|
16
|
+
[key: string]: JSONValue;
|
|
17
|
+
};
|
|
18
|
+
export type JSONArray = JSONValue[];
|
|
19
|
+
export type UnknownObject = Record<string, unknown>;
|
|
20
|
+
export type UnknownArray = unknown[];
|
|
21
|
+
export type UnknownFunction = (...args: unknown[]) => unknown;
|
|
22
|
+
export type APIResponse<T = unknown> = {
|
|
23
|
+
data: T;
|
|
24
|
+
meta?: Record<string, unknown>;
|
|
25
|
+
error?: string;
|
|
26
|
+
};
|
|
14
27
|
/**
|
|
15
28
|
* Higher-order function to add loading state to a card.
|
|
16
29
|
* Adds a loading overlay with spinner and proper ARIA attributes
|
|
@@ -59,14 +59,14 @@
|
|
|
59
59
|
* Factory function to create a new Card component.
|
|
60
60
|
* @see CardComponent for the full API reference
|
|
61
61
|
*/
|
|
62
|
-
export { default } from
|
|
62
|
+
export { default } from "./card";
|
|
63
63
|
/**
|
|
64
64
|
* Card component types and interfaces
|
|
65
65
|
*
|
|
66
66
|
* These types define the structure and behavior of the Card component.
|
|
67
67
|
*/
|
|
68
|
-
export { CardVariant, CardElevationLevel, CardSchema, CardHeaderConfig, CardContentConfig, CardActionsConfig, CardMediaConfig, CardAriaAttributes, CardComponent, LoadingFeature, ExpandableFeature, SwipeableFeature } from
|
|
69
|
-
export { createCardContent, createCardHeader, createCardActions, createCardMedia } from
|
|
70
|
-
export { withAPI } from
|
|
71
|
-
export { withLoading, withExpandable, withSwipeable, withElevation } from
|
|
72
|
-
export { CARD_VARIANTS, CARD_ELEVATIONS, CARD_WIDTHS, CARD_CORNER_RADIUS, CARD_ASPECT_RATIOS, CARD_ACTION_ALIGNMENT, CARD_MEDIA_POSITION, CARD_CLASSES } from
|
|
68
|
+
export { CardVariant, CardElevationLevel, CardSchema, CardHeaderConfig, CardContentConfig, CardActionsConfig, CardMediaConfig, CardAriaAttributes, CardComponent, LoadingFeature, ExpandableFeature, SwipeableFeature, } from "./types";
|
|
69
|
+
export { createCardContent, createCardHeader, createCardActions, createCardMedia, } from "./content";
|
|
70
|
+
export { withAPI } from "./api";
|
|
71
|
+
export { withLoading, withExpandable, withSwipeable, withElevation, } from "./features";
|
|
72
|
+
export { CARD_VARIANTS, CARD_ELEVATIONS, CARD_WIDTHS, CARD_CORNER_RADIUS, CARD_ASPECT_RATIOS, CARD_ACTION_ALIGNMENT, CARD_MEDIA_POSITION, CARD_CLASSES, } from "./constants";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CarouselComponent, CarouselSlide } from
|
|
1
|
+
import { CarouselComponent, CarouselSlide } from "./types";
|
|
2
2
|
interface ApiOptions {
|
|
3
3
|
slides: {
|
|
4
|
-
addSlide: (slide: CarouselSlide, index?: number) =>
|
|
5
|
-
removeSlide: (index: number) =>
|
|
6
|
-
updateSlide: (index: number, slide: CarouselSlide) =>
|
|
4
|
+
addSlide: (slide: CarouselSlide, index?: number) => void;
|
|
5
|
+
removeSlide: (index: number) => void;
|
|
6
|
+
updateSlide: (index: number, slide: CarouselSlide) => void;
|
|
7
7
|
getCount: () => number;
|
|
8
8
|
getElements: () => HTMLElement[];
|
|
9
9
|
};
|
|
@@ -15,13 +15,17 @@ interface ComponentWithElements {
|
|
|
15
15
|
element: HTMLElement;
|
|
16
16
|
getClass: (name: string) => string;
|
|
17
17
|
getCurrentSlide: () => number;
|
|
18
|
-
goTo: (index: number) =>
|
|
19
|
-
next: () =>
|
|
20
|
-
prev: () =>
|
|
21
|
-
enableLoop: () =>
|
|
22
|
-
disableLoop: () =>
|
|
23
|
-
setBorderRadius?: (radius: number) =>
|
|
24
|
-
setGap?: (gap: number) =>
|
|
18
|
+
goTo: (index: number) => void;
|
|
19
|
+
next: () => void;
|
|
20
|
+
prev: () => void;
|
|
21
|
+
enableLoop: () => void;
|
|
22
|
+
disableLoop: () => void;
|
|
23
|
+
setBorderRadius?: (radius: number) => void;
|
|
24
|
+
setGap?: (gap: number) => void;
|
|
25
|
+
on?: (event: string, handler: Function) => void;
|
|
26
|
+
off?: (event: string, handler: Function) => void;
|
|
27
|
+
addClass?: (...classes: string[]) => void;
|
|
28
|
+
slideData?: CarouselSlide[];
|
|
25
29
|
}
|
|
26
30
|
/**
|
|
27
31
|
* Enhances a carousel component with API methods
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* @module components/carousel
|
|
14
14
|
* @category Components
|
|
15
15
|
*/
|
|
16
|
-
import { CarouselConfig, CarouselComponent } from
|
|
16
|
+
import { CarouselConfig, CarouselComponent } from "./types";
|
|
17
17
|
/**
|
|
18
18
|
* Creates a new carousel component with the specified configuration.
|
|
19
19
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - filled: Checkbox with filled background when checked (default)
|
|
7
7
|
* - outlined: Checkbox with outline only, for less visual emphasis
|
|
8
8
|
*/
|
|
9
|
-
export type CheckboxVariant =
|
|
9
|
+
export type CheckboxVariant = "filled" | "outlined";
|
|
10
10
|
/**
|
|
11
11
|
* Checkbox label position types - controls where the label appears
|
|
12
12
|
*
|
|
@@ -15,7 +15,7 @@ export type CheckboxVariant = 'filled' | 'outlined';
|
|
|
15
15
|
* - start: Label appears before (to the left of) the checkbox
|
|
16
16
|
* - end: Label appears after (to the right of) the checkbox (default)
|
|
17
17
|
*/
|
|
18
|
-
export type CheckboxLabelPosition =
|
|
18
|
+
export type CheckboxLabelPosition = "start" | "end";
|
|
19
19
|
/**
|
|
20
20
|
* Configuration interface for the Checkbox component
|
|
21
21
|
*
|