@fluentui/web-components 3.0.0-beta.34 → 3.0.0-beta.36
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/CHANGELOG.md +20 -2
- package/dist/dts/drawer/define.d.ts +1 -0
- package/dist/dts/drawer/drawer.d.ts +93 -0
- package/dist/dts/drawer/drawer.definition.d.ts +8 -0
- package/dist/dts/drawer/drawer.options.d.ts +40 -0
- package/dist/dts/drawer/drawer.styles.d.ts +4 -0
- package/dist/dts/drawer/drawer.template.d.ts +8 -0
- package/dist/dts/drawer/index.d.ts +5 -0
- package/dist/dts/drawer-body/define.d.ts +1 -0
- package/dist/dts/drawer-body/drawer-body.d.ts +3 -0
- package/dist/dts/drawer-body/drawer-body.definition.d.ts +8 -0
- package/dist/dts/drawer-body/drawer-body.styles.d.ts +4 -0
- package/dist/dts/drawer-body/drawer-body.template.d.ts +8 -0
- package/dist/dts/drawer-body/index.d.ts +4 -0
- package/dist/dts/index-rollup.d.ts +1 -0
- package/dist/dts/index.d.ts +1 -0
- package/dist/dts/text/text.d.ts +40 -1
- package/dist/esm/drawer/define.js +4 -0
- package/dist/esm/drawer/define.js.map +1 -0
- package/dist/esm/drawer/drawer.definition.js +16 -0
- package/dist/esm/drawer/drawer.definition.js.map +1 -0
- package/dist/esm/drawer/drawer.js +132 -0
- package/dist/esm/drawer/drawer.js.map +1 -0
- package/dist/esm/drawer/drawer.options.js +25 -0
- package/dist/esm/drawer/drawer.options.js.map +1 -0
- package/dist/esm/drawer/drawer.styles.js +138 -0
- package/dist/esm/drawer/drawer.styles.js.map +1 -0
- package/dist/esm/drawer/drawer.template.js +28 -0
- package/dist/esm/drawer/drawer.template.js.map +1 -0
- package/dist/esm/drawer/index.js +6 -0
- package/dist/esm/drawer/index.js.map +1 -0
- package/dist/esm/drawer-body/define.js +4 -0
- package/dist/esm/drawer-body/define.js.map +1 -0
- package/dist/esm/drawer-body/drawer-body.definition.js +16 -0
- package/dist/esm/drawer-body/drawer-body.definition.js.map +1 -0
- package/dist/esm/drawer-body/drawer-body.js +4 -0
- package/dist/esm/drawer-body/drawer-body.js.map +1 -0
- package/dist/esm/drawer-body/drawer-body.styles.js +31 -0
- package/dist/esm/drawer-body/drawer-body.styles.js.map +1 -0
- package/dist/esm/drawer-body/drawer-body.template.js +21 -0
- package/dist/esm/drawer-body/drawer-body.template.js.map +1 -0
- package/dist/esm/drawer-body/index.js +5 -0
- package/dist/esm/drawer-body/index.js.map +1 -0
- package/dist/esm/index-rollup.js +1 -0
- package/dist/esm/index-rollup.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/text/text.js +91 -1
- package/dist/esm/text/text.js.map +1 -1
- package/dist/esm/text/text.styles.js +56 -57
- package/dist/esm/text/text.styles.js.map +1 -1
- package/dist/web-components.d.ts +192 -1
- package/dist/web-components.js +445 -232
- package/dist/web-components.min.js +236 -233
- package/package.json +9 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
# Change Log - @fluentui/web-components
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 26 Jun 2024 04:07:48 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [3.0.0-beta.36](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v3.0.0-beta.36)
|
|
8
|
+
|
|
9
|
+
Wed, 26 Jun 2024 04:07:48 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v3.0.0-beta.35..@fluentui/web-components_v3.0.0-beta.36)
|
|
11
|
+
|
|
12
|
+
### Changes
|
|
13
|
+
|
|
14
|
+
- feat(drawer): add drawer web component ([PR #31521](https://github.com/microsoft/fluentui/pull/31521) by email not defined)
|
|
15
|
+
|
|
16
|
+
## [3.0.0-beta.35](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v3.0.0-beta.35)
|
|
17
|
+
|
|
18
|
+
Tue, 25 Jun 2024 04:06:35 GMT
|
|
19
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v3.0.0-beta.34..@fluentui/web-components_v3.0.0-beta.35)
|
|
20
|
+
|
|
21
|
+
### Changes
|
|
22
|
+
|
|
23
|
+
- updates the Text component to use Element Internals custom states for presentational attributes ([PR #31770](https://github.com/microsoft/fluentui/pull/31770) by 13071055+chrisdholt@users.noreply.github.com)
|
|
24
|
+
|
|
7
25
|
## [3.0.0-beta.34](https://github.com/microsoft/fluentui/tree/@fluentui/web-components_v3.0.0-beta.34)
|
|
8
26
|
|
|
9
|
-
Mon, 24 Jun 2024 04:
|
|
27
|
+
Mon, 24 Jun 2024 04:06:02 GMT
|
|
10
28
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/web-components_v3.0.0-beta.33..@fluentui/web-components_v3.0.0-beta.34)
|
|
11
29
|
|
|
12
30
|
### Changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { FASTElement } from '@microsoft/fast-element';
|
|
2
|
+
import { DrawerPosition, DrawerSize, DrawerType } from './drawer.options.js';
|
|
3
|
+
/**
|
|
4
|
+
* A Drawer component that allows content to be displayed in a side panel. It can be rendered as modal or non-modal.
|
|
5
|
+
* @extends FASTElement
|
|
6
|
+
*
|
|
7
|
+
* @attr {DrawerType} type - Determines whether the drawer should be displayed as modal, non-modal, or alert.
|
|
8
|
+
* @attr {DrawerPosition} position - Sets the position of the drawer (start/end).
|
|
9
|
+
* @attr {DrawerSize} size - Sets the size of the drawer (small/medium/large).
|
|
10
|
+
* @attr {string} ariaDescribedby - The ID of the element that describes the drawer.
|
|
11
|
+
* @attr {string} ariaLabelledby - The ID of the element that labels the drawer.
|
|
12
|
+
*
|
|
13
|
+
* @csspart dialog - The dialog element of the drawer.
|
|
14
|
+
*
|
|
15
|
+
* @slot - Default slot for the content of the drawer.
|
|
16
|
+
*
|
|
17
|
+
* @fires toggle - Event emitted after the dialog's open state changes.
|
|
18
|
+
* @fires beforetoggle - Event emitted before the dialog's open state changes.
|
|
19
|
+
*
|
|
20
|
+
* @method show - Method to show the drawer.
|
|
21
|
+
* @method hide - Method to hide the drawer.
|
|
22
|
+
* @method clickHandler - Handles click events on the drawer.
|
|
23
|
+
* @method emitToggle - Emits an event after the dialog's open state changes.
|
|
24
|
+
* @method emitBeforeToggle - Emits an event before the dialog's open state changes.
|
|
25
|
+
*
|
|
26
|
+
* @summary A component that provides a drawer for displaying content in a side panel.
|
|
27
|
+
*
|
|
28
|
+
* @tag fluent-drawer
|
|
29
|
+
*/
|
|
30
|
+
export declare class Drawer extends FASTElement {
|
|
31
|
+
/**
|
|
32
|
+
* @public
|
|
33
|
+
* Determines whether the drawer should be displayed as modal or non-modal
|
|
34
|
+
* When rendered as a modal, an overlay is applied over the rest of the view.
|
|
35
|
+
*/
|
|
36
|
+
type: DrawerType;
|
|
37
|
+
/**
|
|
38
|
+
* @public
|
|
39
|
+
* The ID of the element that labels the drawer.
|
|
40
|
+
*/
|
|
41
|
+
ariaLabelledby?: string;
|
|
42
|
+
/**
|
|
43
|
+
* @public
|
|
44
|
+
* The ID of the element that describes the drawer.
|
|
45
|
+
*/
|
|
46
|
+
ariaDescribedby?: string;
|
|
47
|
+
/**""
|
|
48
|
+
* @public
|
|
49
|
+
* @defaultValue start
|
|
50
|
+
* Sets the position of the drawer (start/end).
|
|
51
|
+
*/
|
|
52
|
+
position: DrawerPosition;
|
|
53
|
+
/**
|
|
54
|
+
* @public
|
|
55
|
+
* @defaultValue medium
|
|
56
|
+
* Sets the size of the drawer (small/medium/large).
|
|
57
|
+
*/
|
|
58
|
+
size: DrawerSize;
|
|
59
|
+
/**
|
|
60
|
+
* @public
|
|
61
|
+
* The dialog element.
|
|
62
|
+
*/
|
|
63
|
+
dialog: HTMLDialogElement;
|
|
64
|
+
/**
|
|
65
|
+
* @public
|
|
66
|
+
* Method to emit an event after the dialog's open state changes
|
|
67
|
+
* HTML spec proposal: https://github.com/whatwg/html/issues/9733
|
|
68
|
+
*/
|
|
69
|
+
emitToggle: () => void;
|
|
70
|
+
/**
|
|
71
|
+
* @public
|
|
72
|
+
* Method to emit an event before the dialog's open state changes
|
|
73
|
+
* HTML spec proposal: https://github.com/whatwg/html/issues/9733
|
|
74
|
+
*/
|
|
75
|
+
emitBeforeToggle: () => void;
|
|
76
|
+
/**
|
|
77
|
+
* @public
|
|
78
|
+
* Method to show the drawer
|
|
79
|
+
*/
|
|
80
|
+
show(): void;
|
|
81
|
+
/**
|
|
82
|
+
* @public
|
|
83
|
+
* Method to hide the drawer
|
|
84
|
+
*/
|
|
85
|
+
hide(): void;
|
|
86
|
+
/**
|
|
87
|
+
* @public
|
|
88
|
+
* @param event - The click event
|
|
89
|
+
* @returns boolean - Always returns true
|
|
90
|
+
* Handles click events on the drawer.
|
|
91
|
+
*/
|
|
92
|
+
clickHandler(event: Event): boolean;
|
|
93
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ValuesOf } from '../utils/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* A drawer can be positioned on the left or right side of the viewport.
|
|
4
|
+
*/
|
|
5
|
+
export declare const DrawerPosition: {
|
|
6
|
+
readonly start: "start";
|
|
7
|
+
readonly end: "end";
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* The position of the drawer.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export type DrawerPosition = ValuesOf<typeof DrawerPosition>;
|
|
14
|
+
/**
|
|
15
|
+
* A drawer can be different sizes
|
|
16
|
+
*/
|
|
17
|
+
export declare const DrawerSize: {
|
|
18
|
+
readonly small: "small";
|
|
19
|
+
readonly medium: "medium";
|
|
20
|
+
readonly large: "large";
|
|
21
|
+
readonly full: "full";
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* The size of the drawer.
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export type DrawerSize = ValuesOf<typeof DrawerSize>;
|
|
28
|
+
/**
|
|
29
|
+
* A drawer can be different sizes
|
|
30
|
+
*/
|
|
31
|
+
export declare const DrawerType: {
|
|
32
|
+
readonly nonModal: "non-modal";
|
|
33
|
+
readonly modal: "modal";
|
|
34
|
+
readonly inline: "inline";
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* The size of the drawer.
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
export type DrawerType = ValuesOf<typeof DrawerType>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ElementViewTemplate } from '@microsoft/fast-element';
|
|
2
|
+
import type { Drawer } from './drawer.js';
|
|
3
|
+
/**
|
|
4
|
+
* The template for the Drawer component.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare function drawerTemplate<T extends Drawer>(): ElementViewTemplate<T>;
|
|
8
|
+
export declare const template: ElementViewTemplate<Drawer>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from './drawer.js';
|
|
2
|
+
export * from './drawer.options.js';
|
|
3
|
+
export { definition as DrawerDefinition } from './drawer.definition.js';
|
|
4
|
+
export { styles as DrawerStyles } from './drawer.styles.js';
|
|
5
|
+
export { template as DrawerTemplate } from './drawer.template.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ElementViewTemplate } from '@microsoft/fast-element';
|
|
2
|
+
import type { DrawerBody } from './drawer-body.js';
|
|
3
|
+
/**
|
|
4
|
+
* The template for the Drawer component.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare function drawerBodyTemplate<T extends DrawerBody>(): ElementViewTemplate<T>;
|
|
8
|
+
export declare const template: ElementViewTemplate<DrawerBody>;
|
|
@@ -10,6 +10,7 @@ import './counter-badge/define.js';
|
|
|
10
10
|
import './dialog/define.js';
|
|
11
11
|
import './dialog-body/define.js';
|
|
12
12
|
import './divider/define.js';
|
|
13
|
+
import './drawer/define.js';
|
|
13
14
|
import './field/define.js';
|
|
14
15
|
import './image/define.js';
|
|
15
16
|
import './label/define.js';
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export { CounterBadge, CounterBadgeAppearance, CounterBadgeColor, CounterBadgeDe
|
|
|
13
13
|
export { Dialog, DialogType, DialogDefinition, DialogTemplate, DialogStyles } from './dialog/index.js';
|
|
14
14
|
export { DialogBody, DialogBodyDefinition, DialogBodyTemplate, DialogBodyStyles } from './dialog-body/index.js';
|
|
15
15
|
export { Divider, DividerAlignContent, DividerAppearance, DividerDefinition, DividerOrientation, DividerRole, DividerStyles, DividerTemplate, } from './divider/index.js';
|
|
16
|
+
export { Drawer, DrawerDefinition, DrawerPosition, DrawerSize, DrawerType, DrawerTemplate, DrawerStyles, } from './drawer/index.js';
|
|
16
17
|
export { Field, FieldLabelPosition, ValidationFlags, FieldDefinition, FieldStyles, FieldTemplate, } from './field/index.js';
|
|
17
18
|
export type { SlottableInput } from './field/index.js';
|
|
18
19
|
export { FluentDesignSystem } from './fluent-design-system.js';
|
package/dist/dts/text/text.d.ts
CHANGED
|
@@ -5,6 +5,12 @@ import type { TextAlign, TextFont, TextSize, TextWeight } from './text.options.j
|
|
|
5
5
|
* @public
|
|
6
6
|
*/
|
|
7
7
|
export declare class Text extends FASTElement {
|
|
8
|
+
/**
|
|
9
|
+
* The internal {@link https://developer.mozilla.org/docs/Web/API/ElementInternals | `ElementInternals`} instance for the component.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
elementInternals: ElementInternals;
|
|
8
14
|
/**
|
|
9
15
|
* The text will not wrap
|
|
10
16
|
* NOTE: In Fluent UI React v9 this is "wrap"
|
|
@@ -64,6 +70,12 @@ export declare class Text extends FASTElement {
|
|
|
64
70
|
*
|
|
65
71
|
*/
|
|
66
72
|
size?: TextSize;
|
|
73
|
+
/**
|
|
74
|
+
* Handles changes to size attribute custom states
|
|
75
|
+
* @param prev - the previous state
|
|
76
|
+
* @param next - the next state
|
|
77
|
+
*/
|
|
78
|
+
sizeChanged(prev: TextSize | undefined, next: TextSize | undefined): void;
|
|
67
79
|
/**
|
|
68
80
|
* THe Text font
|
|
69
81
|
*
|
|
@@ -73,13 +85,25 @@ export declare class Text extends FASTElement {
|
|
|
73
85
|
*/
|
|
74
86
|
font?: TextFont;
|
|
75
87
|
/**
|
|
76
|
-
*
|
|
88
|
+
* Handles changes to font attribute custom states
|
|
89
|
+
* @param prev - the previous state
|
|
90
|
+
* @param next - the next state
|
|
91
|
+
*/
|
|
92
|
+
fontChanged(prev: TextFont | undefined, next: TextFont | undefined): void;
|
|
93
|
+
/**
|
|
94
|
+
* The Text weight
|
|
77
95
|
*
|
|
78
96
|
* @public
|
|
79
97
|
* @remarks
|
|
80
98
|
* HTML Attribute: weight
|
|
81
99
|
*/
|
|
82
100
|
weight?: TextWeight;
|
|
101
|
+
/**
|
|
102
|
+
* Handles changes to weight attribute custom states
|
|
103
|
+
* @param prev - the previous state
|
|
104
|
+
* @param next - the next state
|
|
105
|
+
*/
|
|
106
|
+
weightChanged(prev: TextWeight | undefined, next: TextWeight | undefined): void;
|
|
83
107
|
/**
|
|
84
108
|
* THe Text align
|
|
85
109
|
*
|
|
@@ -88,4 +112,19 @@ export declare class Text extends FASTElement {
|
|
|
88
112
|
* HTML Attribute: align
|
|
89
113
|
*/
|
|
90
114
|
align?: TextAlign;
|
|
115
|
+
/**
|
|
116
|
+
* Handles changes to align attribute custom states
|
|
117
|
+
* @param prev - the previous state
|
|
118
|
+
* @param next - the next state
|
|
119
|
+
*/
|
|
120
|
+
alignChanged(prev: TextAlign | undefined, next: TextAlign | undefined): void;
|
|
121
|
+
connectedCallback(): void;
|
|
122
|
+
disconnectedCallback(): void;
|
|
123
|
+
/**
|
|
124
|
+
* Handles changes to observable properties
|
|
125
|
+
* @internal
|
|
126
|
+
* @param source - the source of the change
|
|
127
|
+
* @param propertyName - the property name being changed
|
|
128
|
+
*/
|
|
129
|
+
handleChange(source: any, propertyName: string): void;
|
|
91
130
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.js","sourceRoot":"","sources":["../../../src/drawer/define.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,UAAU,CAAC,MAAM,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FluentDesignSystem } from '../fluent-design-system.js';
|
|
2
|
+
import { Drawer } from './drawer.js';
|
|
3
|
+
import { styles } from './drawer.styles.js';
|
|
4
|
+
import { template } from './drawer.template.js';
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
* @remarks
|
|
9
|
+
* HTML Element: <fluent-drawer>
|
|
10
|
+
*/
|
|
11
|
+
export const definition = Drawer.compose({
|
|
12
|
+
name: `${FluentDesignSystem.prefix}-drawer`,
|
|
13
|
+
template,
|
|
14
|
+
styles,
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=drawer.definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.definition.js","sourceRoot":"","sources":["../../../src/drawer/drawer.definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC;IACvC,IAAI,EAAE,GAAG,kBAAkB,CAAC,MAAM,SAAS;IAC3C,QAAQ;IACR,MAAM;CACP,CAAC,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr, FASTElement, observable, Updates } from '@microsoft/fast-element';
|
|
3
|
+
import { DrawerPosition, DrawerSize, DrawerType } from './drawer.options.js';
|
|
4
|
+
/**
|
|
5
|
+
* A Drawer component that allows content to be displayed in a side panel. It can be rendered as modal or non-modal.
|
|
6
|
+
* @extends FASTElement
|
|
7
|
+
*
|
|
8
|
+
* @attr {DrawerType} type - Determines whether the drawer should be displayed as modal, non-modal, or alert.
|
|
9
|
+
* @attr {DrawerPosition} position - Sets the position of the drawer (start/end).
|
|
10
|
+
* @attr {DrawerSize} size - Sets the size of the drawer (small/medium/large).
|
|
11
|
+
* @attr {string} ariaDescribedby - The ID of the element that describes the drawer.
|
|
12
|
+
* @attr {string} ariaLabelledby - The ID of the element that labels the drawer.
|
|
13
|
+
*
|
|
14
|
+
* @csspart dialog - The dialog element of the drawer.
|
|
15
|
+
*
|
|
16
|
+
* @slot - Default slot for the content of the drawer.
|
|
17
|
+
*
|
|
18
|
+
* @fires toggle - Event emitted after the dialog's open state changes.
|
|
19
|
+
* @fires beforetoggle - Event emitted before the dialog's open state changes.
|
|
20
|
+
*
|
|
21
|
+
* @method show - Method to show the drawer.
|
|
22
|
+
* @method hide - Method to hide the drawer.
|
|
23
|
+
* @method clickHandler - Handles click events on the drawer.
|
|
24
|
+
* @method emitToggle - Emits an event after the dialog's open state changes.
|
|
25
|
+
* @method emitBeforeToggle - Emits an event before the dialog's open state changes.
|
|
26
|
+
*
|
|
27
|
+
* @summary A component that provides a drawer for displaying content in a side panel.
|
|
28
|
+
*
|
|
29
|
+
* @tag fluent-drawer
|
|
30
|
+
*/
|
|
31
|
+
export class Drawer extends FASTElement {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
/**
|
|
35
|
+
* @public
|
|
36
|
+
* Determines whether the drawer should be displayed as modal or non-modal
|
|
37
|
+
* When rendered as a modal, an overlay is applied over the rest of the view.
|
|
38
|
+
*/
|
|
39
|
+
this.type = DrawerType.modal;
|
|
40
|
+
/**""
|
|
41
|
+
* @public
|
|
42
|
+
* @defaultValue start
|
|
43
|
+
* Sets the position of the drawer (start/end).
|
|
44
|
+
*/
|
|
45
|
+
this.position = DrawerPosition.start;
|
|
46
|
+
/**
|
|
47
|
+
* @public
|
|
48
|
+
* @defaultValue medium
|
|
49
|
+
* Sets the size of the drawer (small/medium/large).
|
|
50
|
+
*/
|
|
51
|
+
this.size = DrawerSize.medium;
|
|
52
|
+
/**
|
|
53
|
+
* @public
|
|
54
|
+
* Method to emit an event after the dialog's open state changes
|
|
55
|
+
* HTML spec proposal: https://github.com/whatwg/html/issues/9733
|
|
56
|
+
*/
|
|
57
|
+
this.emitToggle = () => {
|
|
58
|
+
this.$emit('toggle', {
|
|
59
|
+
oldState: this.dialog.open ? 'closed' : 'open',
|
|
60
|
+
newState: this.dialog.open ? 'open' : 'closed',
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* @public
|
|
65
|
+
* Method to emit an event before the dialog's open state changes
|
|
66
|
+
* HTML spec proposal: https://github.com/whatwg/html/issues/9733
|
|
67
|
+
*/
|
|
68
|
+
this.emitBeforeToggle = () => {
|
|
69
|
+
this.$emit('beforetoggle', {
|
|
70
|
+
oldState: this.dialog.open ? 'open' : 'closed',
|
|
71
|
+
newState: this.dialog.open ? 'closed' : 'open',
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* @public
|
|
77
|
+
* Method to show the drawer
|
|
78
|
+
*/
|
|
79
|
+
show() {
|
|
80
|
+
Updates.enqueue(() => {
|
|
81
|
+
this.emitBeforeToggle();
|
|
82
|
+
if (this.type === DrawerType.inline || this.type === DrawerType.nonModal) {
|
|
83
|
+
this.dialog.show();
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
this.dialog.showModal();
|
|
87
|
+
}
|
|
88
|
+
this.emitToggle();
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* @public
|
|
93
|
+
* Method to hide the drawer
|
|
94
|
+
*/
|
|
95
|
+
hide() {
|
|
96
|
+
this.emitBeforeToggle();
|
|
97
|
+
this.dialog.close();
|
|
98
|
+
this.emitToggle();
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* @public
|
|
102
|
+
* @param event - The click event
|
|
103
|
+
* @returns boolean - Always returns true
|
|
104
|
+
* Handles click events on the drawer.
|
|
105
|
+
*/
|
|
106
|
+
clickHandler(event) {
|
|
107
|
+
event.preventDefault();
|
|
108
|
+
if (this.dialog.open && event.target === this.dialog) {
|
|
109
|
+
this.hide();
|
|
110
|
+
}
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
__decorate([
|
|
115
|
+
attr
|
|
116
|
+
], Drawer.prototype, "type", void 0);
|
|
117
|
+
__decorate([
|
|
118
|
+
attr({ attribute: 'aria-labelledby' })
|
|
119
|
+
], Drawer.prototype, "ariaLabelledby", void 0);
|
|
120
|
+
__decorate([
|
|
121
|
+
attr({ attribute: 'aria-describedby' })
|
|
122
|
+
], Drawer.prototype, "ariaDescribedby", void 0);
|
|
123
|
+
__decorate([
|
|
124
|
+
attr
|
|
125
|
+
], Drawer.prototype, "position", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
attr({ attribute: 'size' })
|
|
128
|
+
], Drawer.prototype, "size", void 0);
|
|
129
|
+
__decorate([
|
|
130
|
+
observable
|
|
131
|
+
], Drawer.prototype, "dialog", void 0);
|
|
132
|
+
//# sourceMappingURL=drawer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.js","sourceRoot":"","sources":["../../../src/drawer/drawer.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,OAAO,MAAO,SAAQ,WAAW;IAAvC;;QACE;;;;WAIG;QAEI,SAAI,GAAe,UAAU,CAAC,KAAK,CAAC;QAgB3C;;;;WAIG;QAEI,aAAQ,GAAmB,cAAc,CAAC,KAAK,CAAC;QAEvD;;;;WAIG;QAEI,SAAI,GAAe,UAAU,CAAC,MAAM,CAAC;QAS5C;;;;WAIG;QACI,eAAU,GAAG,GAAS,EAAE;YAC7B,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;gBACnB,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM;gBAC9C,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ;aAC/C,CAAC,CAAC;QACL,CAAC,CAAC;QAEF;;;;WAIG;QACI,qBAAgB,GAAG,GAAS,EAAE;YACnC,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE;gBACzB,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ;gBAC9C,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM;aAC/C,CAAC,CAAC;QACL,CAAC,CAAC;IAyCJ,CAAC;IAvCC;;;OAGG;IACI,IAAI;QACT,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE;YACnB,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACxB,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC,QAAQ,EAAE;gBACxE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;aACpB;iBAAM;gBACL,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;aACzB;YACD,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACI,IAAI;QACT,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACpB,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;IAED;;;;;OAKG;IACI,YAAY,CAAC,KAAY;QAC9B,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE;YACpD,IAAI,CAAC,IAAI,EAAE,CAAC;SACb;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAtGC;IADC,IAAI;oCACsC;AAO3C;IADC,IAAI,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;8CACR;AAO/B;IADC,IAAI,CAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;+CACR;AAQhC;IADC,IAAI;wCACkD;AAQvD;IADC,IAAI,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;oCACgB;AAO5C;IADC,UAAU;sCACuB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A drawer can be positioned on the left or right side of the viewport.
|
|
3
|
+
*/
|
|
4
|
+
export const DrawerPosition = {
|
|
5
|
+
start: 'start',
|
|
6
|
+
end: 'end',
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* A drawer can be different sizes
|
|
10
|
+
*/
|
|
11
|
+
export const DrawerSize = {
|
|
12
|
+
small: 'small',
|
|
13
|
+
medium: 'medium',
|
|
14
|
+
large: 'large',
|
|
15
|
+
full: 'full',
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* A drawer can be different sizes
|
|
19
|
+
*/
|
|
20
|
+
export const DrawerType = {
|
|
21
|
+
nonModal: 'non-modal',
|
|
22
|
+
modal: 'modal',
|
|
23
|
+
inline: 'inline',
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=drawer.options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.options.js","sourceRoot":"","sources":["../../../src/drawer/drawer.options.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,KAAK,EAAE,OAAO;IACd,GAAG,EAAE,KAAK;CACF,CAAC;AAQX;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;CACJ,CAAC;AAQX;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,QAAQ,EAAE,WAAW;IACrB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;CACR,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { css } from '@microsoft/fast-element';
|
|
2
|
+
import { display } from '../utils/index.js';
|
|
3
|
+
import { colorBackgroundOverlay, colorNeutralBackground1, colorNeutralForeground1, colorTransparentStroke, curveAccelerateMid, curveDecelerateMid, curveLinear, durationGentle, fontFamilyBase, fontSizeBase300, fontWeightRegular, lineHeightBase300, shadow64, strokeWidthThin, } from '../theme/design-tokens.js';
|
|
4
|
+
/** Drawer styles
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export const styles = css `
|
|
8
|
+
${display('block')}
|
|
9
|
+
|
|
10
|
+
:host {
|
|
11
|
+
--dialog-backdrop: ${colorBackgroundOverlay};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
:host([type='non-modal']) dialog[open]::backdrop {
|
|
15
|
+
display: none;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:host([type='non-modal']) dialog {
|
|
19
|
+
position: fixed;
|
|
20
|
+
top: 0;
|
|
21
|
+
bottom: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:host([type='inline']) {
|
|
25
|
+
height: 100%;
|
|
26
|
+
width: fit-content;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:host([type='inline']) dialog[open] {
|
|
30
|
+
box-shadow: none;
|
|
31
|
+
position: relative;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:host([size='small']) dialog {
|
|
35
|
+
width: 320px;
|
|
36
|
+
max-width: 320px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:host([size='large']) dialog {
|
|
40
|
+
width: 940px;
|
|
41
|
+
max-width: 940px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
:host([size='full']) dialog {
|
|
45
|
+
width: 100%;
|
|
46
|
+
max-width: 100%;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
:host([position='end']) dialog {
|
|
50
|
+
margin-inline-start: auto;
|
|
51
|
+
margin-inline-end: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
dialog {
|
|
55
|
+
box-sizing: border-box;
|
|
56
|
+
z-index: var(--drawer-elevation, 1000);
|
|
57
|
+
font-size: ${fontSizeBase300};
|
|
58
|
+
line-height: ${lineHeightBase300};
|
|
59
|
+
font-family: ${fontFamilyBase};
|
|
60
|
+
font-weight: ${fontWeightRegular};
|
|
61
|
+
color: ${colorNeutralForeground1};
|
|
62
|
+
max-width: var(--drawer-width, 592px);
|
|
63
|
+
max-height: 100vh;
|
|
64
|
+
height: 100%;
|
|
65
|
+
margin-inline-start: 0;
|
|
66
|
+
margin-inline-end: auto;
|
|
67
|
+
border-inline-end-color: ${colorTransparentStroke};
|
|
68
|
+
border-inline-start-color: var(--drawer-separator, ${colorTransparentStroke});
|
|
69
|
+
outline: none;
|
|
70
|
+
top: 0;
|
|
71
|
+
bottom: 0;
|
|
72
|
+
width: var(--drawer-width, 592px);
|
|
73
|
+
border-radius: 0;
|
|
74
|
+
padding: 0;
|
|
75
|
+
max-width: var(--drawer-width, 592px);
|
|
76
|
+
box-shadow: ${shadow64};
|
|
77
|
+
border: ${strokeWidthThin} solid ${colorTransparentStroke};
|
|
78
|
+
background: ${colorNeutralBackground1};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
dialog::backdrop {
|
|
82
|
+
background: var(--dialog-backdrop);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@layer animations {
|
|
86
|
+
/* Disable animations for reduced motion */
|
|
87
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
88
|
+
dialog {
|
|
89
|
+
transition: display allow-discrete, opacity, overlay allow-discrete, transform;
|
|
90
|
+
transition-duration: ${durationGentle};
|
|
91
|
+
transition-timing-function: ${curveDecelerateMid};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* Exit styles for dialog */
|
|
95
|
+
:host dialog:not([open]) {
|
|
96
|
+
transform: translateX(-100%);
|
|
97
|
+
transition-timing-function: ${curveAccelerateMid};
|
|
98
|
+
}
|
|
99
|
+
:host([position='end']) dialog:not([open]) {
|
|
100
|
+
transform: translateX(100%);
|
|
101
|
+
transition-timing-function: ${curveAccelerateMid};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
dialog[open] {
|
|
105
|
+
transform: translateX(0);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
dialog::backdrop {
|
|
109
|
+
transition: display allow-discrete, opacity, overlay allow-discrete, scale;
|
|
110
|
+
transition-duration: ${durationGentle};
|
|
111
|
+
transition-timing-function: ${curveDecelerateMid};
|
|
112
|
+
background: var(--dialog-backdrop, ${colorBackgroundOverlay});
|
|
113
|
+
opacity: 0;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
dialog[open]::backdrop {
|
|
117
|
+
opacity: 1;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
dialog::backdrop {
|
|
121
|
+
transition-timing-function: ${curveLinear};
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@starting-style {
|
|
126
|
+
dialog[open] {
|
|
127
|
+
transform: translateX(-100%);
|
|
128
|
+
}
|
|
129
|
+
:host([position='end']) dialog[open] {
|
|
130
|
+
transform: translateX(100%);
|
|
131
|
+
}
|
|
132
|
+
dialog[open]::backdrop {
|
|
133
|
+
opacity: 0;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
`;
|
|
138
|
+
//# sourceMappingURL=drawer.styles.js.map
|