Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dialog): adds new dialog component and deprecates the modal component #9751

Merged
merged 81 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
57dd466
dialog WIP
driskull Jul 8, 2024
595df41
WIP
driskull Jul 8, 2024
587952d
WIP
driskull Jul 9, 2024
204b1a4
WIP
driskull Jul 9, 2024
8662fa9
Merge branch 'dev' into dris0000/dialog
driskull Jul 9, 2024
224cdd3
scale
driskull Jul 9, 2024
150b792
wip
driskull Jul 9, 2024
ef470f4
WIP
driskull Jul 9, 2024
59e1891
WIP
driskull Jul 9, 2024
5408e5c
WIP
driskull Jul 9, 2024
5047695
WIP
driskull Jul 9, 2024
0cf10dc
WIP
driskull Jul 9, 2024
c4c7044
WIP
driskull Jul 9, 2024
f0b1c0a
WIP
driskull Jul 9, 2024
209e072
cleanup
driskull Jul 9, 2024
2b8c4af
WIP
driskull Jul 9, 2024
bc17fe2
WIP
driskull Jul 9, 2024
9840498
WIP
driskull Jul 9, 2024
56e0efa
feat(dialog): adds new dialog component and deprecates the modal comp…
driskull Jul 9, 2024
1a3cfe3
cleanup
driskull Jul 10, 2024
5b4ab5a
WIP
driskull Jul 10, 2024
3d08942
cleanup
driskull Jul 11, 2024
c7e237c
cleanup
driskull Jul 11, 2024
af40f98
fix tests
driskull Jul 11, 2024
624337e
no disabled prop, fix tests
driskull Jul 11, 2024
f6d0f5f
cleanup
driskull Jul 11, 2024
3b8ddc8
WIP
driskull Jul 11, 2024
5a03a15
modal swapping
driskull Jul 11, 2024
fdb891e
tests
driskull Jul 11, 2024
c5b52df
cleanup
driskull Jul 11, 2024
48467f4
remove code
driskull Jul 11, 2024
9638516
cleanup
driskull Jul 11, 2024
e4c5c1e
theming
driskull Jul 11, 2024
323da6f
cleanup
driskull Jul 11, 2024
3f0f2ed
Merge branch 'dev' into dris0000/dialog
driskull Jul 11, 2024
1856d46
placement option
driskull Jul 12, 2024
ed970a9
WIP
driskull Jul 12, 2024
70c711c
cleanup
driskull Jul 12, 2024
a68f55a
cleanup
driskull Jul 12, 2024
f0e81f2
WIP
driskull Jul 12, 2024
2f152b9
WIP
driskull Jul 12, 2024
55342ea
cleanup
driskull Jul 13, 2024
b63b8c7
WIP
driskull Jul 15, 2024
defc018
cleanup
driskull Jul 15, 2024
7c5a5d0
demos
driskull Jul 15, 2024
31cf83e
Merge branch 'dev' into dris0000/dialog
driskull Jul 15, 2024
c86f35c
fix tests
driskull Jul 15, 2024
c898a7e
add test for calcitePanelClose
driskull Jul 15, 2024
863075d
cleanup
driskull Jul 15, 2024
d33bfdb
cleanup
driskull Jul 15, 2024
9e56b4c
get demo page working in shadow dom.
driskull Jul 15, 2024
ee05c98
fix alert slots and test
driskull Jul 15, 2024
9ff443d
Merge branch 'dev' into dris0000/dialog
driskull Jul 16, 2024
f78e9e5
update stories
driskull Jul 16, 2024
5635633
cleanup css
driskull Jul 16, 2024
2e73172
Merge branch 'dev' into dris0000/dialog
driskull Jul 16, 2024
dbf56a1
tokens review fixes
driskull Jul 17, 2024
4fb101e
review fixes
driskull Jul 19, 2024
3e7c455
update typings
driskull Jul 19, 2024
b2073a0
review fixes
driskull Jul 23, 2024
8dbd5af
fix story attribute
driskull Jul 23, 2024
d88ddfc
partial review fixes
driskull Jul 24, 2024
f58bba0
Merge branch 'dev' into dris0000/dialog
driskull Jul 24, 2024
71a86a2
review fixes
driskull Jul 24, 2024
eca5c70
review fixes
driskull Jul 24, 2024
82182d5
review fixes
driskull Jul 24, 2024
990822a
style review fixes
driskull Jul 24, 2024
224a9fb
Merge branch 'dev' into dris0000/dialog
driskull Jul 25, 2024
041c832
cleanup
driskull Jul 25, 2024
a46f75a
cleanup
driskull Jul 25, 2024
9cebcde
Merge branch 'dev' into dris0000/dialog
driskull Jul 25, 2024
3f77cc6
cleanup
driskull Jul 25, 2024
4c34db4
Merge branch 'dris0000/dialog' of github.com:Esri/calcite-design-syst…
driskull Jul 25, 2024
0d4cfd8
cleanup
driskull Jul 25, 2024
ce38c51
fix story
driskull Jul 25, 2024
c5dbebe
cleanup
driskull Jul 25, 2024
69c90f1
cleanup
driskull Jul 25, 2024
90f9c9e
Merge branch 'dev' into dris0000/dialog
driskull Jul 25, 2024
92fc5f5
cleanup demo
driskull Jul 25, 2024
ca2bd5c
cleanup stories
driskull Jul 25, 2024
7d07808
cleanup stories
driskull Jul 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/calcite-components/.storybook/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { TextType } from "../src/components/input/interfaces.ts";
import { TimeZoneMode } from "../src/components/input-time-zone/interfaces.ts";
import { DisplayMode } from "../src/components/sheet/interfaces.ts";
import { ShellDisplayMode } from "../src/components/shell/interfaces.ts";
import { OverlayPositioning } from "../src/components";

interface AttributeMetadata<T> {
values: T[];
Expand Down Expand Up @@ -58,6 +59,7 @@ interface CommonAttributes {
mode: AttributeMetadata<TimeZoneMode>;
selectionAppearance: AttributeMetadata<SelectionAppearance>;
shellDisplayMode: AttributeMetadata<ShellDisplayMode>;
overlayPositioning: AttributeMetadata<OverlayPositioning>;
}

const logicalFlowPositionOptions: LogicalFlowPosition[] = ["inline-start", "inline-end", "block-start", "block-end"];
Expand Down Expand Up @@ -114,6 +116,7 @@ const textTypeOptions: TextType[] = [
];
const modeOptions: TimeZoneMode[] = ["offset", "name"];
const selectionAppearanceOptions: SelectionAppearance[] = ["icon", "border"];
const overlayPositioningOptions: OverlayPositioning[] = ["absolute", "fixed"];
const shellDisplayModeOptions: ShellDisplayMode[] = ["dock", "float", "overlay"];

export const ATTRIBUTES: CommonAttributes = {
Expand Down Expand Up @@ -213,6 +216,10 @@ export const ATTRIBUTES: CommonAttributes = {
values: modeOptions,
defaultValue: modeOptions[0],
},
overlayPositioning: {
values: overlayPositioningOptions,
defaultValue: overlayPositioningOptions[0],
},
selectionAppearance: {
values: selectionAppearanceOptions,
defaultValue: selectionAppearanceOptions[0],
Expand Down
2 changes: 1 addition & 1 deletion packages/calcite-components/src/assets/styles/global.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "~@esri/calcite-base/dist/_index";
@import "~@esri/calcite-base/dist/index";
@import "~@esri/calcite-design-tokens/dist/scss/index";
@import "~@esri/calcite-design-tokens/dist/scss/core";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import "~@esri/calcite-colors/dist/colors";
@import "~@esri/calcite-base/dist/_index";
@import "~@esri/calcite-base/dist/index";
@import "~@esri/calcite-design-tokens/dist/scss/index";
@import "~@esri/calcite-design-tokens/dist/scss/core";

Expand Down
210 changes: 210 additions & 0 deletions packages/calcite-components/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ import { ComboboxMessages } from "./components/combobox/assets/combobox/t9n";
import { DatePickerMessages } from "./components/date-picker/assets/date-picker/t9n";
import { DateLocaleData } from "./components/date-picker/utils";
import { HoverRange } from "./utils/date";
import { DialogMessages } from "./components/dialog/assets/dialog/t9n";
import { OverlayPositioning as OverlayPositioning1 } from "./components";
import { DialogPlacement } from "./components/dialog/interfaces";
import { RequestedItem as RequestedItem2 } from "./components/dropdown-group/interfaces";
import { ItemKeyboardEvent } from "./components/dropdown/interfaces";
import { FilterMessages } from "./components/filter/assets/filter/t9n";
Expand Down Expand Up @@ -130,6 +133,9 @@ export { ComboboxMessages } from "./components/combobox/assets/combobox/t9n";
export { DatePickerMessages } from "./components/date-picker/assets/date-picker/t9n";
export { DateLocaleData } from "./components/date-picker/utils";
export { HoverRange } from "./utils/date";
export { DialogMessages } from "./components/dialog/assets/dialog/t9n";
export { OverlayPositioning as OverlayPositioning1 } from "./components";
export { DialogPlacement } from "./components/dialog/interfaces";
export { RequestedItem as RequestedItem2 } from "./components/dropdown-group/interfaces";
export { ItemKeyboardEvent } from "./components/dropdown/interfaces";
export { FilterMessages } from "./components/filter/assets/filter/t9n";
Expand Down Expand Up @@ -1654,6 +1660,92 @@ export namespace Components {
*/
"selectedDate": Date;
}
interface CalciteDialog {
/**
* Passes a function to run before the component closes.
*/
"beforeClose": () => Promise<void>;
/**
* When `true`, disables the component's close button.
*/
"closeDisabled": boolean;
/**
* A description for the component.
*/
"description": string;
/**
* This internal property, managed by a containing calcite-shell, is used to inform the component if special configuration or styles are needed
*/
"embedded": boolean;
/**
* The component header text.
*/
"heading": string;
/**
* Specifies the heading level of the component's `heading` for proper document structure, without affecting visual styling.
*/
"headingLevel": HeadingLevel;
/**
* Specifies the kind of the component, which will style the top border.
*/
"kind": Extract<"brand" | "danger" | "info" | "success" | "warning", Kind>;
/**
* When `true`, a busy indicator is displayed.
*/
"loading": boolean;
/**
* When `true`, the action menu items in the `header-menu-actions` slot are open.
*/
"menuOpen": boolean;
/**
* Use this property to override individual strings used by the component.
*/
"messageOverrides": Partial<DialogMessages>;
/**
* Made into a prop for testing purposes only
*/
"messages": DialogMessages;
/**
* When `true`, displays a scrim blocking interaction underneath the component.
*/
"modal": boolean;
/**
* When `true`, displays and positions the component.
*/
"open": boolean;
/**
* Determines the type of positioning to use for the overlaid content. Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout. `"fixed"` should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
*/
"overlayPositioning": OverlayPositioning1;
/**
* Specifies the placement of the dialog.
*/
"placement": DialogPlacement;
/**
* Specifies the size of the component.
*/
"scale": Scale;
/**
* Scrolls the component's content to a specified set of coordinates.
* @example myCalciteFlowItem.scrollContentTo({ left: 0, // Specifies the number of pixels along the X axis to scroll the window or element. top: 0, // Specifies the number of pixels along the Y axis to scroll the window or element behavior: "auto" // Specifies whether the scrolling should animate smoothly (smooth), or happen instantly in a single jump (auto, the default value). });
* @param options - allows specific coordinates to be defined.
* @returns - promise that resolves once the content is scrolled to.
*/
"scrollContentTo": (options?: ScrollToOptions) => Promise<void>;
/**
* Sets focus on the component's "close" button (the first focusable item).
* @returns - A promise that is resolved when the operation has completed.
*/
"setFocus": () => Promise<void>;
/**
* Updates the element(s) that are used within the focus-trap of the component.
*/
"updateFocusTrapElements": () => Promise<void>;
/**
* Specifies the width of the component.
*/
"widthScale": Scale;
}
interface CalciteDropdown {
/**
* When `true`, the component will remain open after a selection is made. If the `selectionMode` of the selected `calcite-dropdown-item`'s containing `calcite-dropdown-group` is `"none"`, the component will always close.
Expand Down Expand Up @@ -5888,6 +5980,10 @@ export interface CalciteDatePickerMonthHeaderCustomEvent<T> extends CustomEvent<
detail: T;
target: HTMLCalciteDatePickerMonthHeaderElement;
}
export interface CalciteDialogCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLCalciteDialogElement;
}
export interface CalciteDropdownCustomEvent<T> extends CustomEvent<T> {
detail: T;
target: HTMLCalciteDropdownElement;
Expand Down Expand Up @@ -6570,6 +6666,27 @@ declare global {
prototype: HTMLCalciteDatePickerMonthHeaderElement;
new (): HTMLCalciteDatePickerMonthHeaderElement;
};
interface HTMLCalciteDialogElementEventMap {
"calciteDialogBeforeClose": void;
"calciteDialogClose": void;
"calciteDialogBeforeOpen": void;
"calciteDialogOpen": void;
"calciteDialogScroll": void;
}
interface HTMLCalciteDialogElement extends Components.CalciteDialog, HTMLStencilElement {
addEventListener<K extends keyof HTMLCalciteDialogElementEventMap>(type: K, listener: (this: HTMLCalciteDialogElement, ev: CalciteDialogCustomEvent<HTMLCalciteDialogElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof HTMLCalciteDialogElementEventMap>(type: K, listener: (this: HTMLCalciteDialogElement, ev: CalciteDialogCustomEvent<HTMLCalciteDialogElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
}
var HTMLCalciteDialogElement: {
prototype: HTMLCalciteDialogElement;
new (): HTMLCalciteDialogElement;
};
interface HTMLCalciteDropdownElementEventMap {
"calciteDropdownSelect": void;
"calciteDropdownBeforeClose": void;
Expand Down Expand Up @@ -7881,6 +7998,7 @@ declare global {
"calcite-date-picker-day": HTMLCalciteDatePickerDayElement;
"calcite-date-picker-month": HTMLCalciteDatePickerMonthElement;
"calcite-date-picker-month-header": HTMLCalciteDatePickerMonthHeaderElement;
"calcite-dialog": HTMLCalciteDialogElement;
"calcite-dropdown": HTMLCalciteDropdownElement;
"calcite-dropdown-group": HTMLCalciteDropdownGroupElement;
"calcite-dropdown-item": HTMLCalciteDropdownItemElement;
Expand Down Expand Up @@ -9518,6 +9636,96 @@ declare namespace LocalJSX {
*/
"selectedDate"?: Date;
}
interface CalciteDialog {
/**
* Passes a function to run before the component closes.
*/
"beforeClose"?: () => Promise<void>;
/**
* When `true`, disables the component's close button.
*/
"closeDisabled"?: boolean;
/**
* A description for the component.
*/
"description"?: string;
/**
* This internal property, managed by a containing calcite-shell, is used to inform the component if special configuration or styles are needed
*/
"embedded"?: boolean;
/**
* The component header text.
*/
"heading"?: string;
/**
* Specifies the heading level of the component's `heading` for proper document structure, without affecting visual styling.
*/
"headingLevel"?: HeadingLevel;
/**
* Specifies the kind of the component, which will style the top border.
*/
"kind"?: Extract<"brand" | "danger" | "info" | "success" | "warning", Kind>;
/**
* When `true`, a busy indicator is displayed.
*/
"loading"?: boolean;
/**
* When `true`, the action menu items in the `header-menu-actions` slot are open.
*/
"menuOpen"?: boolean;
/**
* Use this property to override individual strings used by the component.
*/
"messageOverrides"?: Partial<DialogMessages>;
/**
* Made into a prop for testing purposes only
*/
"messages"?: DialogMessages;
/**
* When `true`, displays a scrim blocking interaction underneath the component.
*/
"modal"?: boolean;
/**
* Fires when the component is requested to be closed and before the closing transition begins.
*/
"onCalciteDialogBeforeClose"?: (event: CalciteDialogCustomEvent<void>) => void;
/**
* Fires when the component is added to the DOM but not rendered, and before the opening transition begins.
*/
"onCalciteDialogBeforeOpen"?: (event: CalciteDialogCustomEvent<void>) => void;
/**
* Fires when the component is closed and animation is complete.
*/
"onCalciteDialogClose"?: (event: CalciteDialogCustomEvent<void>) => void;
/**
* Fires when the component is open and animation is complete.
*/
"onCalciteDialogOpen"?: (event: CalciteDialogCustomEvent<void>) => void;
/**
* Fires when the content is scrolled.
*/
"onCalciteDialogScroll"?: (event: CalciteDialogCustomEvent<void>) => void;
/**
* When `true`, displays and positions the component.
*/
"open"?: boolean;
/**
* Determines the type of positioning to use for the overlaid content. Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout. `"fixed"` should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
*/
"overlayPositioning"?: OverlayPositioning1;
/**
* Specifies the placement of the dialog.
*/
"placement"?: DialogPlacement;
/**
* Specifies the size of the component.
*/
"scale"?: Scale;
/**
* Specifies the width of the component.
*/
"widthScale"?: Scale;
}
interface CalciteDropdown {
/**
* When `true`, the component will remain open after a selection is made. If the `selectionMode` of the selected `calcite-dropdown-item`'s containing `calcite-dropdown-group` is `"none"`, the component will always close.
Expand Down Expand Up @@ -13881,6 +14089,7 @@ declare namespace LocalJSX {
"calcite-date-picker-day": CalciteDatePickerDay;
"calcite-date-picker-month": CalciteDatePickerMonth;
"calcite-date-picker-month-header": CalciteDatePickerMonthHeader;
"calcite-dialog": CalciteDialog;
"calcite-dropdown": CalciteDropdown;
"calcite-dropdown-group": CalciteDropdownGroup;
"calcite-dropdown-item": CalciteDropdownItem;
Expand Down Expand Up @@ -13997,6 +14206,7 @@ declare module "@stencil/core" {
"calcite-date-picker-day": LocalJSX.CalciteDatePickerDay & JSXBase.HTMLAttributes<HTMLCalciteDatePickerDayElement>;
"calcite-date-picker-month": LocalJSX.CalciteDatePickerMonth & JSXBase.HTMLAttributes<HTMLCalciteDatePickerMonthElement>;
"calcite-date-picker-month-header": LocalJSX.CalciteDatePickerMonthHeader & JSXBase.HTMLAttributes<HTMLCalciteDatePickerMonthHeaderElement>;
"calcite-dialog": LocalJSX.CalciteDialog & JSXBase.HTMLAttributes<HTMLCalciteDialogElement>;
"calcite-dropdown": LocalJSX.CalciteDropdown & JSXBase.HTMLAttributes<HTMLCalciteDropdownElement>;
"calcite-dropdown-group": LocalJSX.CalciteDropdownGroup & JSXBase.HTMLAttributes<HTMLCalciteDropdownGroupElement>;
"calcite-dropdown-item": LocalJSX.CalciteDropdownItem & JSXBase.HTMLAttributes<HTMLCalciteDropdownItemElement>;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"close": "Close"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"close": "إغلاق"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"close": "Затваряне"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"close": "Zatvori"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"close": "Tanca"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"close": "Zavřít"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"close": "Luk"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"close": "Schließen"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"close": "Κλείσιμο"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"close": "Close"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"close": "Cerrar"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"close": "Sule"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"close": "Sulje"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"close": "Fermer"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"close": "סגירה"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"close": "Zatvori"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"close": "Bezárás"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"close": "Tutup"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"close": "Chiudi"
}
Loading
Loading