@activecollab/components 2.0.541 → 2.0.543
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/cjs/components/BlockingProgress/BlockingProgress.js +61 -0
- package/dist/cjs/components/BlockingProgress/BlockingProgress.js.map +1 -0
- package/dist/cjs/components/BlockingProgress/Styles.js +34 -0
- package/dist/cjs/components/BlockingProgress/Styles.js.map +1 -0
- package/dist/cjs/components/BlockingProgress/index.js +17 -0
- package/dist/cjs/components/BlockingProgress/index.js.map +1 -0
- package/dist/cjs/components/CommandPalette/CommandPalette.js +3 -1
- package/dist/cjs/components/CommandPalette/CommandPalette.js.map +1 -1
- package/dist/cjs/components/ConfirmDialog/ConfirmDialog.js +4 -4
- package/dist/cjs/components/ConfirmDialog/ConfirmDialog.js.map +1 -1
- package/dist/cjs/components/Dialog/Dialog.js +3 -3
- package/dist/cjs/components/Dialog/Dialog.js.map +1 -1
- package/dist/cjs/components/Dialog/DialogContext.js.map +1 -1
- package/dist/cjs/components/Dialog/DialogFrame.js +21 -100
- package/dist/cjs/components/Dialog/DialogFrame.js.map +1 -1
- package/dist/cjs/components/Dialog/useRemovedPropWarning.js +22 -0
- package/dist/cjs/components/Dialog/useRemovedPropWarning.js.map +1 -0
- package/dist/cjs/components/ModalRoot/ModalRoot.js +32 -8
- package/dist/cjs/components/ModalRoot/ModalRoot.js.map +1 -1
- package/dist/cjs/components/ModalRoot/modalRootStack.js +18 -4
- package/dist/cjs/components/ModalRoot/modalRootStack.js.map +1 -1
- package/dist/cjs/components/ObjectFormModal/ObjectFormModal.js +5 -7
- package/dist/cjs/components/ObjectFormModal/ObjectFormModal.js.map +1 -1
- package/dist/cjs/components/Sheet/useHostAboveOpenModal.js +7 -0
- package/dist/cjs/components/Sheet/useHostAboveOpenModal.js.map +1 -1
- package/dist/cjs/components/Wizard/Wizard.js +1 -0
- package/dist/cjs/components/Wizard/Wizard.js.map +1 -1
- package/dist/cjs/components/index.js +12 -0
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/presentation/listView/columns.js +622 -184
- package/dist/cjs/presentation/listView/columns.js.map +1 -1
- package/dist/esm/components/BlockingProgress/BlockingProgress.d.ts +16 -0
- package/dist/esm/components/BlockingProgress/BlockingProgress.d.ts.map +1 -0
- package/dist/esm/components/BlockingProgress/BlockingProgress.js +52 -0
- package/dist/esm/components/BlockingProgress/BlockingProgress.js.map +1 -0
- package/dist/esm/components/BlockingProgress/Styles.d.ts +6 -0
- package/dist/esm/components/BlockingProgress/Styles.d.ts.map +1 -0
- package/dist/esm/components/BlockingProgress/Styles.js +27 -0
- package/dist/esm/components/BlockingProgress/Styles.js.map +1 -0
- package/dist/esm/components/BlockingProgress/index.d.ts +2 -0
- package/dist/esm/components/BlockingProgress/index.d.ts.map +1 -0
- package/dist/esm/components/BlockingProgress/index.js +2 -0
- package/dist/esm/components/BlockingProgress/index.js.map +1 -0
- package/dist/esm/components/CommandPalette/CommandPalette.d.ts +2 -2
- package/dist/esm/components/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/esm/components/CommandPalette/CommandPalette.js +3 -1
- package/dist/esm/components/CommandPalette/CommandPalette.js.map +1 -1
- package/dist/esm/components/ConfirmDialog/ConfirmDialog.d.ts +5 -2
- package/dist/esm/components/ConfirmDialog/ConfirmDialog.d.ts.map +1 -1
- package/dist/esm/components/ConfirmDialog/ConfirmDialog.js +4 -4
- package/dist/esm/components/ConfirmDialog/ConfirmDialog.js.map +1 -1
- package/dist/esm/components/DatePicker/Styles.d.ts +1 -1
- package/dist/esm/components/DatePicker/Styles.d.ts.map +1 -1
- package/dist/esm/components/Dialog/Dialog.d.ts +15 -3
- package/dist/esm/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/esm/components/Dialog/Dialog.js +3 -3
- package/dist/esm/components/Dialog/Dialog.js.map +1 -1
- package/dist/esm/components/Dialog/DialogContext.d.ts +2 -2
- package/dist/esm/components/Dialog/DialogContext.d.ts.map +1 -1
- package/dist/esm/components/Dialog/DialogContext.js.map +1 -1
- package/dist/esm/components/Dialog/DialogFrame.d.ts +5 -6
- package/dist/esm/components/Dialog/DialogFrame.d.ts.map +1 -1
- package/dist/esm/components/Dialog/DialogFrame.js +23 -100
- package/dist/esm/components/Dialog/DialogFrame.js.map +1 -1
- package/dist/esm/components/Dialog/useRemovedPropWarning.d.ts +3 -0
- package/dist/esm/components/Dialog/useRemovedPropWarning.d.ts.map +1 -0
- package/dist/esm/components/Dialog/useRemovedPropWarning.js +16 -0
- package/dist/esm/components/Dialog/useRemovedPropWarning.js.map +1 -0
- package/dist/esm/components/ModalRoot/ModalRoot.d.ts +10 -0
- package/dist/esm/components/ModalRoot/ModalRoot.d.ts.map +1 -1
- package/dist/esm/components/ModalRoot/ModalRoot.js +32 -8
- package/dist/esm/components/ModalRoot/ModalRoot.js.map +1 -1
- package/dist/esm/components/ModalRoot/modalRootStack.d.ts +8 -2
- package/dist/esm/components/ModalRoot/modalRootStack.d.ts.map +1 -1
- package/dist/esm/components/ModalRoot/modalRootStack.js +18 -4
- package/dist/esm/components/ModalRoot/modalRootStack.js.map +1 -1
- package/dist/esm/components/ObjectFormModal/ObjectFormModal.d.ts +4 -0
- package/dist/esm/components/ObjectFormModal/ObjectFormModal.d.ts.map +1 -1
- package/dist/esm/components/ObjectFormModal/ObjectFormModal.js +5 -7
- package/dist/esm/components/ObjectFormModal/ObjectFormModal.js.map +1 -1
- package/dist/esm/components/SelectDate/Styles.d.ts +1 -1
- package/dist/esm/components/SelectDate/Styles.d.ts.map +1 -1
- package/dist/esm/components/Sheet/useHostAboveOpenModal.d.ts.map +1 -1
- package/dist/esm/components/Sheet/useHostAboveOpenModal.js +9 -2
- package/dist/esm/components/Sheet/useHostAboveOpenModal.js.map +1 -1
- package/dist/esm/components/Wizard/Wizard.d.ts +1 -1
- package/dist/esm/components/Wizard/Wizard.d.ts.map +1 -1
- package/dist/esm/components/Wizard/Wizard.js +1 -0
- package/dist/esm/components/Wizard/Wizard.js.map +1 -1
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/presentation/listView/columns.d.ts +20 -7
- package/dist/esm/presentation/listView/columns.d.ts.map +1 -1
- package/dist/esm/presentation/listView/columns.js +538 -166
- package/dist/esm/presentation/listView/columns.js.map +1 -1
- package/dist/index.js +1039 -990
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/BlockingProgress/Styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,8BAA8B,oEAQ1C,CAAC;AAIF,eAAO,MAAM,0BAA0B,oEAUtC,CAAC;AAIF,eAAO,MAAM,kCAAkC,oEAM9C,CAAC;AAKF,eAAO,MAAM,2BAA2B,oEAQvC,CAAC;AAIF,eAAO,MAAM,4BAA4B,oEAExC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
export const StyledBlockingProgressViewport = styled.div.withConfig({
|
|
3
|
+
displayName: "Styles__StyledBlockingProgressViewport",
|
|
4
|
+
componentId: "sc-kvkoss-0"
|
|
5
|
+
})(["position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:16px;pointer-events:none;"]);
|
|
6
|
+
StyledBlockingProgressViewport.displayName = "StyledBlockingProgressViewport";
|
|
7
|
+
export const StyledBlockingProgressCard = styled.div.withConfig({
|
|
8
|
+
displayName: "Styles__StyledBlockingProgressCard",
|
|
9
|
+
componentId: "sc-kvkoss-1"
|
|
10
|
+
})(["display:flex;flex-direction:column;align-items:center;max-width:100%;padding:40px;background-color:var(--page-paper-main);box-shadow:var(--shadow-tertiary);border-radius:16px;pointer-events:auto;"]);
|
|
11
|
+
StyledBlockingProgressCard.displayName = "StyledBlockingProgressCard";
|
|
12
|
+
export const StyledBlockingProgressIllustration = styled.div.withConfig({
|
|
13
|
+
displayName: "Styles__StyledBlockingProgressIllustration",
|
|
14
|
+
componentId: "sc-kvkoss-2"
|
|
15
|
+
})(["display:flex;align-items:center;justify-content:center;height:144px;margin-bottom:16px;"]);
|
|
16
|
+
StyledBlockingProgressIllustration.displayName = "StyledBlockingProgressIllustration";
|
|
17
|
+
export const StyledBlockingProgressTitle = styled.div.withConfig({
|
|
18
|
+
displayName: "Styles__StyledBlockingProgressTitle",
|
|
19
|
+
componentId: "sc-kvkoss-3"
|
|
20
|
+
})(["width:340px;max-width:100%;margin-bottom:20px;h2{margin:0;}"]);
|
|
21
|
+
StyledBlockingProgressTitle.displayName = "StyledBlockingProgressTitle";
|
|
22
|
+
export const StyledBlockingProgressLoader = styled.div.withConfig({
|
|
23
|
+
displayName: "Styles__StyledBlockingProgressLoader",
|
|
24
|
+
componentId: "sc-kvkoss-4"
|
|
25
|
+
})(["width:144px;"]);
|
|
26
|
+
StyledBlockingProgressLoader.displayName = "StyledBlockingProgressLoader";
|
|
27
|
+
//# sourceMappingURL=Styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Styles.js","names":["styled","StyledBlockingProgressViewport","div","withConfig","displayName","componentId","StyledBlockingProgressCard","StyledBlockingProgressIllustration","StyledBlockingProgressTitle","StyledBlockingProgressLoader"],"sources":["../../../../src/components/BlockingProgress/Styles.ts"],"sourcesContent":["import styled from \"styled-components\";\n\nexport const StyledBlockingProgressViewport = styled.div`\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 16px;\n pointer-events: none;\n`;\n\nStyledBlockingProgressViewport.displayName = \"StyledBlockingProgressViewport\";\n\nexport const StyledBlockingProgressCard = styled.div`\n display: flex;\n flex-direction: column;\n align-items: center;\n max-width: 100%;\n padding: 40px;\n background-color: var(--page-paper-main);\n box-shadow: var(--shadow-tertiary);\n border-radius: 16px;\n pointer-events: auto;\n`;\n\nStyledBlockingProgressCard.displayName = \"StyledBlockingProgressCard\";\n\nexport const StyledBlockingProgressIllustration = styled.div`\n display: flex;\n align-items: center;\n justify-content: center;\n height: 144px;\n margin-bottom: 16px;\n`;\n\nStyledBlockingProgressIllustration.displayName =\n \"StyledBlockingProgressIllustration\";\n\nexport const StyledBlockingProgressTitle = styled.div`\n width: 340px;\n max-width: 100%;\n margin-bottom: 20px;\n\n h2 {\n margin: 0;\n }\n`;\n\nStyledBlockingProgressTitle.displayName = \"StyledBlockingProgressTitle\";\n\nexport const StyledBlockingProgressLoader = styled.div`\n width: 144px;\n`;\n\nStyledBlockingProgressLoader.displayName = \"StyledBlockingProgressLoader\";\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,mBAAmB;AAEtC,OAAO,MAAMC,8BAA8B,GAAGD,MAAM,CAACE,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,0HAQvD;AAEDJ,8BAA8B,CAACG,WAAW,GAAG,gCAAgC;AAE7E,OAAO,MAAME,0BAA0B,GAAGN,MAAM,CAACE,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,2MAUnD;AAEDC,0BAA0B,CAACF,WAAW,GAAG,4BAA4B;AAErE,OAAO,MAAMG,kCAAkC,GAAGP,MAAM,CAACE,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,+FAM3D;AAEDE,kCAAkC,CAACH,WAAW,GAC5C,oCAAoC;AAEtC,OAAO,MAAMI,2BAA2B,GAAGR,MAAM,CAACE,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,mEAQpD;AAEDG,2BAA2B,CAACJ,WAAW,GAAG,6BAA6B;AAEvE,OAAO,MAAMK,4BAA4B,GAAGT,MAAM,CAACE,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,oBAErD;AAEDI,4BAA4B,CAACL,WAAW,GAAG,8BAA8B","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/BlockingProgress/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/BlockingProgress/index.ts"],"sourcesContent":["export * from \"./BlockingProgress\";\n"],"mappings":"AAAA,cAAc,oBAAoB","ignoreList":[]}
|
|
@@ -14,10 +14,10 @@ export interface CommandPaletteProps extends DialogProps {
|
|
|
14
14
|
}
|
|
15
15
|
export declare const _CommandPalette: React.ForwardRefExoticComponent<CommandPaletteProps & {
|
|
16
16
|
children?: React.ReactNode | undefined;
|
|
17
|
-
} & React.RefAttributes<
|
|
17
|
+
} & React.RefAttributes<HTMLDialogElement>>;
|
|
18
18
|
export declare const CommandPalette: React.ForwardRefExoticComponent<CommandPaletteProps & {
|
|
19
19
|
children?: React.ReactNode | undefined;
|
|
20
|
-
} & React.RefAttributes<
|
|
20
|
+
} & React.RefAttributes<HTMLDialogElement>> & {
|
|
21
21
|
List: {
|
|
22
22
|
({ children, heading, visible, }: PropsWithChildren<import("./CommandPaletteList").CommandPaletteListProps>): React.JSX.Element | null;
|
|
23
23
|
displayName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandPalette.d.ts","sourceRoot":"","sources":["../../../../src/components/CommandPalette/CommandPalette.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAGZ,iBAAiB,EAKlB,MAAM,OAAO,CAAC;AAmBf,OAAO,EAAU,WAAW,EAAE,MAAM,WAAW,CAAC;AAEhD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC;IAC7B,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,eAAO,MAAM,eAAe;;
|
|
1
|
+
{"version":3,"file":"CommandPalette.d.ts","sourceRoot":"","sources":["../../../../src/components/CommandPalette/CommandPalette.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAGZ,iBAAiB,EAKlB,MAAM,OAAO,CAAC;AAmBf,OAAO,EAAU,WAAW,EAAE,MAAM,WAAW,CAAC;AAEhD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC;IAC7B,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,eAAO,MAAM,eAAe;;2CAqK3B,CAAC;AAKF,eAAO,MAAM,cAAc;;;;;;;;;;;;;CAIzB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["children", "onChangeSearch", "search", "mode", "setMode", "loading", "idModeEnabled"];
|
|
3
|
+
const _excluded = ["children", "onChangeSearch", "search", "mode", "setMode", "loading", "idModeEnabled", "aria-label"];
|
|
4
4
|
import React, { cloneElement, forwardRef, useMemo, useRef, useState } from "react";
|
|
5
5
|
import { StyledCommandPalette, StyledCommandPaletteWrapper } from "./CommandPalette.styles";
|
|
6
6
|
import { CommandPaletteCommandItem } from "./CommandPaletteCommandItem";
|
|
@@ -19,6 +19,7 @@ export const _CommandPalette = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
19
19
|
loading = _ref.loading,
|
|
20
20
|
_ref$idModeEnabled = _ref.idModeEnabled,
|
|
21
21
|
idModeEnabled = _ref$idModeEnabled === void 0 ? false : _ref$idModeEnabled,
|
|
22
|
+
ariaLabel = _ref["aria-label"],
|
|
22
23
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
23
24
|
const _useState = useState(0),
|
|
24
25
|
selected = _useState[0],
|
|
@@ -102,6 +103,7 @@ export const _CommandPalette = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
102
103
|
}
|
|
103
104
|
};
|
|
104
105
|
return /*#__PURE__*/React.createElement(Dialog, _extends({}, rest, {
|
|
106
|
+
"aria-label": ariaLabel != null ? ariaLabel : rest["aria-labelledby"] ? undefined : "Search",
|
|
105
107
|
ref: ref,
|
|
106
108
|
animate: "fade"
|
|
107
109
|
}), /*#__PURE__*/React.createElement(SearchContextProvider, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandPalette.js","names":["React","cloneElement","forwardRef","useMemo","useRef","useState","StyledCommandPalette","StyledCommandPaletteWrapper","CommandPaletteCommandItem","CommandPaletteHeader","CommandPaletteItem","CommandPaletteList","ModeContextProvider","SelectedContextProvider","SearchContextProvider","deepMap","Dialog","_CommandPalette","_ref","ref","children","onChangeSearch","search","mode","setMode","loading","_ref$idModeEnabled","idModeEnabled","rest","_objectWithoutPropertiesLoose","_excluded","_useState","selected","setSelected","listWrapperRef","scrollToTop","_listWrapperRef$curre","current","scrollTo","top","behavior","scrollToBottom","_listWrapperRef$curre2","scrollHeight","filterChildren","itemsLength","commandsLength","items","child","item","clonedElement","type","_extends","props","index","handleChangeSelected","direction","document","querySelectorAll","newIndex","newItem","forEach","_","i","length","scrollIntoView","block","createElement","animate","value","onKeyDown","e","key","preventDefault","displayName","CommandPalette","Object","assign","List","Item","CommandItem"],"sources":["../../../../src/components/CommandPalette/CommandPalette.tsx"],"sourcesContent":["import React, {\n cloneElement,\n forwardRef,\n PropsWithChildren,\n ReactElement,\n useMemo,\n useRef,\n useState,\n} from \"react\";\n\nimport {\n StyledCommandPalette,\n StyledCommandPaletteWrapper,\n} from \"./CommandPalette.styles\";\nimport { CommandPaletteCommandItem } from \"./CommandPaletteCommandItem\";\nimport { CommandPaletteHeader } from \"./CommandPaletteHeader\";\nimport {\n CommandPaletteItem,\n CommandPaletteItemProps,\n} from \"./CommandPaletteItem\";\nimport { CommandPaletteList } from \"./CommandPaletteList\";\nimport {\n ModeContextProvider,\n SelectedContextProvider,\n SearchContextProvider,\n} from \"./context\";\nimport { deepMap } from \"../../utils/deepChildrenMap\";\nimport { Dialog, DialogProps } from \"../Dialog\";\n\nexport interface SearchContext {\n name: string;\n class: string;\n}\n\nexport interface CommandPaletteProps extends DialogProps {\n onChangeSearch: (search: string) => void;\n search: string;\n mode: string | SearchContext;\n setMode: (value: string) => void;\n loading?: boolean;\n idModeEnabled?: boolean;\n}\n\nexport const _CommandPalette = forwardRef<\n HTMLDivElement,\n PropsWithChildren<CommandPaletteProps>\n>(\n (\n {\n children,\n onChangeSearch,\n search,\n mode,\n setMode,\n loading,\n idModeEnabled = false,\n ...rest\n },\n ref\n ) => {\n const [selected, setSelected] = useState<number>(0);\n const listWrapperRef = useRef<HTMLDivElement>(null);\n\n const scrollToTop = () => {\n listWrapperRef.current?.scrollTo({ top: 0, behavior: \"smooth\" });\n };\n\n const scrollToBottom = () => {\n listWrapperRef.current?.scrollTo({\n top: listWrapperRef.current.scrollHeight,\n behavior: \"smooth\",\n });\n };\n\n const filterChildren = useMemo(() => {\n let itemsLength = 0;\n let commandsLength = 0;\n\n const items = deepMap(children, (child) => {\n const item = child as ReactElement<CommandPaletteItemProps>;\n let clonedElement;\n\n if (item && item.type === CommandPaletteList) {\n clonedElement = cloneElement(item, {\n ...item.props,\n });\n }\n\n if (item && item.type === CommandPaletteCommandItem) {\n clonedElement = cloneElement(item, {\n ...item.props,\n index: itemsLength,\n selected,\n });\n\n itemsLength++;\n commandsLength++;\n }\n\n if (item && item.type === CommandPaletteItem) {\n clonedElement = cloneElement(item, {\n ...item.props,\n index: itemsLength,\n selected,\n });\n\n itemsLength++;\n }\n\n return clonedElement;\n });\n\n return { items, itemsLength, commandsLength };\n }, [children, selected]);\n\n const handleChangeSelected = (direction?: \"up\" | \"down\") => {\n const items = document.querySelectorAll(\".cp-item\");\n\n let index = 0;\n let newIndex = 0;\n let newItem: Element | null = null;\n\n if (direction === \"down\") {\n items.forEach((_, i) => {\n if (i === selected) {\n index = i;\n }\n });\n\n newIndex = index === items.length - 1 ? 0 : index + 1;\n } else if (direction === \"up\") {\n items.forEach((_, i) => {\n if (i === selected) {\n index = i;\n }\n });\n\n newIndex = !index ? items.length - 1 : index - 1;\n } else {\n setSelected(0);\n }\n\n newItem = items[newIndex];\n\n if (newItem && typeof newIndex === \"number\") {\n setSelected(newIndex);\n\n newItem.scrollIntoView({\n behavior: \"smooth\",\n block: newIndex ? \"center\" : \"end\",\n });\n }\n };\n\n return (\n <Dialog {...rest} ref={ref} animate=\"fade\">\n <SearchContextProvider value={{ search, onChangeSearch }}>\n <SelectedContextProvider value={{ selected: selected, setSelected }}>\n <StyledCommandPalette\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n handleChangeSelected(\"down\");\n }\n\n if (e.key === \"ArrowUp\") {\n e.preventDefault();\n handleChangeSelected(\"up\");\n }\n\n if (e.key === \"End\") {\n e.preventDefault();\n scrollToBottom();\n setSelected(filterChildren.itemsLength - 1);\n }\n\n if (e.key === \"Home\") {\n e.preventDefault();\n scrollToTop();\n setSelected(0);\n }\n }}\n >\n <ModeContextProvider value={{ mode, setMode, idModeEnabled }}>\n <CommandPaletteHeader\n commandsLength={filterChildren.commandsLength}\n itemsLength={filterChildren.itemsLength}\n loading={loading}\n />\n </ModeContextProvider>\n\n <StyledCommandPaletteWrapper ref={listWrapperRef}>\n {filterChildren.items}\n </StyledCommandPaletteWrapper>\n </StyledCommandPalette>\n </SelectedContextProvider>\n </SearchContextProvider>\n </Dialog>\n );\n }\n);\n\n_CommandPalette.displayName = \"CommandPalette\";\n\n// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/34757\nexport const CommandPalette = Object.assign({}, _CommandPalette, {\n List: CommandPaletteList,\n Item: CommandPaletteItem,\n CommandItem: CommandPaletteCommandItem,\n});\n"],"mappings":";;;AAAA,OAAOA,KAAK,IACVC,YAAY,EACZC,UAAU,EAGVC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AAEd,SACEC,oBAAoB,EACpBC,2BAA2B,QACtB,yBAAyB;AAChC,SAASC,yBAAyB,QAAQ,6BAA6B;AACvE,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SACEC,kBAAkB,QAEb,sBAAsB;AAC7B,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SACEC,mBAAmB,EACnBC,uBAAuB,EACvBC,qBAAqB,QAChB,WAAW;AAClB,SAASC,OAAO,QAAQ,6BAA6B;AACrD,SAASC,MAAM,QAAqB,WAAW;AAgB/C,OAAO,MAAMC,eAAe,gBAAGf,UAAU,CAIvC,CAAAgB,IAAA,EAWEC,GAAG,KACA;EAAA,IAVDC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,cAAc,GAAAH,IAAA,CAAdG,cAAc;IACdC,MAAM,GAAAJ,IAAA,CAANI,MAAM;IACNC,IAAI,GAAAL,IAAA,CAAJK,IAAI;IACJC,OAAO,GAAAN,IAAA,CAAPM,OAAO;IACPC,OAAO,GAAAP,IAAA,CAAPO,OAAO;IAAAC,kBAAA,GAAAR,I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ClBhC,cAAc,CAAC,CAAC;QAChBR,WAAW,CAACW,cAAc,CAACC,WAAW,GAAG,CAAC,CAAC;MAC7C;MAEA,IAAI0B,CAAC,CAACC,GAAG,KAAK,MAAM,EAAE;QACpBD,CAAC,CAACE,cAAc,CAAC,CAAC;QAClBtC,WAAW,CAAC,CAAC;QACbF,WAAW,CAAC,CAAC,CAAC;MAChB;IACF;EAAE,gBAEFjC,KAAA,CAAAmE,aAAA,CAACvD,mBAAmB;IAACyD,KAAK,EAAE;MAAE9C,IAAI;MAAEC,OAAO;MAAEG;IAAc;EAAE,gBAC3D3B,KAAA,CAAAmE,aAAA,CAAC1D,oBAAoB;IACnBqC,cAAc,EAAEF,cAAc,CAACE,cAAe;IAC9CD,WAAW,EAAED,cAAc,CAACC,WAAY;IACxCpB,OAAO,EAAEA;EAAQ,CAClB,CACkB,CAAC,eAEtBzB,KAAA,CAAAmE,aAAA,CAAC5D,2BAA2B;IAACY,GAAG,EAAEe;EAAe,GAC9CU,cAAc,CAACG,KACW,CACT,CACC,CACJ,CACjB,CAAC;AAEb,CACF,CAAC;AAED9B,eAAe,CAACyD,WAAW,GAAG,gBAAgB;;AAE9C;AACA,OAAO,MAAMC,cAAc,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,EAAE5D,eAAe,EAAE;EAC/D6D,IAAI,EAAEnE,kBAAkB;EACxBoE,IAAI,EAAErE,kBAAkB;EACxBsE,WAAW,EAAExE;AACf,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"CommandPalette.js","names":["React","cloneElement","forwardRef","useMemo","useRef","useState","StyledCommandPalette","StyledCommandPaletteWrapper","CommandPaletteCommandItem","CommandPaletteHeader","CommandPaletteItem","CommandPaletteList","ModeContextProvider","SelectedContextProvider","SearchContextProvider","deepMap","Dialog","_CommandPalette","_ref","ref","children","onChangeSearch","search","mode","setMode","loading","_ref$idModeEnabled","idModeEnabled","ariaLabel","rest","_objectWithoutPropertiesLoose","_excluded","_useState","selected","setSelected","listWrapperRef","scrollToTop","_listWrapperRef$curre","current","scrollTo","top","behavior","scrollToBottom","_listWrapperRef$curre2","scrollHeight","filterChildren","itemsLength","commandsLength","items","child","item","clonedElement","type","_extends","props","index","handleChangeSelected","direction","document","querySelectorAll","newIndex","newItem","forEach","_","i","length","scrollIntoView","block","createElement","undefined","animate","value","onKeyDown","e","key","preventDefault","displayName","CommandPalette","Object","assign","List","Item","CommandItem"],"sources":["../../../../src/components/CommandPalette/CommandPalette.tsx"],"sourcesContent":["import React, {\n cloneElement,\n forwardRef,\n PropsWithChildren,\n ReactElement,\n useMemo,\n useRef,\n useState,\n} from \"react\";\n\nimport {\n StyledCommandPalette,\n StyledCommandPaletteWrapper,\n} from \"./CommandPalette.styles\";\nimport { CommandPaletteCommandItem } from \"./CommandPaletteCommandItem\";\nimport { CommandPaletteHeader } from \"./CommandPaletteHeader\";\nimport {\n CommandPaletteItem,\n CommandPaletteItemProps,\n} from \"./CommandPaletteItem\";\nimport { CommandPaletteList } from \"./CommandPaletteList\";\nimport {\n ModeContextProvider,\n SelectedContextProvider,\n SearchContextProvider,\n} from \"./context\";\nimport { deepMap } from \"../../utils/deepChildrenMap\";\nimport { Dialog, DialogProps } from \"../Dialog\";\n\nexport interface SearchContext {\n name: string;\n class: string;\n}\n\nexport interface CommandPaletteProps extends DialogProps {\n onChangeSearch: (search: string) => void;\n search: string;\n mode: string | SearchContext;\n setMode: (value: string) => void;\n loading?: boolean;\n idModeEnabled?: boolean;\n}\n\nexport const _CommandPalette = forwardRef<\n HTMLDialogElement,\n PropsWithChildren<CommandPaletteProps>\n>(\n (\n {\n children,\n onChangeSearch,\n search,\n mode,\n setMode,\n loading,\n idModeEnabled = false,\n \"aria-label\": ariaLabel,\n ...rest\n },\n ref\n ) => {\n const [selected, setSelected] = useState<number>(0);\n const listWrapperRef = useRef<HTMLDivElement>(null);\n\n const scrollToTop = () => {\n listWrapperRef.current?.scrollTo({ top: 0, behavior: \"smooth\" });\n };\n\n const scrollToBottom = () => {\n listWrapperRef.current?.scrollTo({\n top: listWrapperRef.current.scrollHeight,\n behavior: \"smooth\",\n });\n };\n\n const filterChildren = useMemo(() => {\n let itemsLength = 0;\n let commandsLength = 0;\n\n const items = deepMap(children, (child) => {\n const item = child as ReactElement<CommandPaletteItemProps>;\n let clonedElement;\n\n if (item && item.type === CommandPaletteList) {\n clonedElement = cloneElement(item, {\n ...item.props,\n });\n }\n\n if (item && item.type === CommandPaletteCommandItem) {\n clonedElement = cloneElement(item, {\n ...item.props,\n index: itemsLength,\n selected,\n });\n\n itemsLength++;\n commandsLength++;\n }\n\n if (item && item.type === CommandPaletteItem) {\n clonedElement = cloneElement(item, {\n ...item.props,\n index: itemsLength,\n selected,\n });\n\n itemsLength++;\n }\n\n return clonedElement;\n });\n\n return { items, itemsLength, commandsLength };\n }, [children, selected]);\n\n const handleChangeSelected = (direction?: \"up\" | \"down\") => {\n const items = document.querySelectorAll(\".cp-item\");\n\n let index = 0;\n let newIndex = 0;\n let newItem: Element | null = null;\n\n if (direction === \"down\") {\n items.forEach((_, i) => {\n if (i === selected) {\n index = i;\n }\n });\n\n newIndex = index === items.length - 1 ? 0 : index + 1;\n } else if (direction === \"up\") {\n items.forEach((_, i) => {\n if (i === selected) {\n index = i;\n }\n });\n\n newIndex = !index ? items.length - 1 : index - 1;\n } else {\n setSelected(0);\n }\n\n newItem = items[newIndex];\n\n if (newItem && typeof newIndex === \"number\") {\n setSelected(newIndex);\n\n newItem.scrollIntoView({\n behavior: \"smooth\",\n block: newIndex ? \"center\" : \"end\",\n });\n }\n };\n\n return (\n <Dialog\n {...rest}\n aria-label={\n ariaLabel ?? (rest[\"aria-labelledby\"] ? undefined : \"Search\")\n }\n ref={ref}\n animate=\"fade\"\n >\n <SearchContextProvider value={{ search, onChangeSearch }}>\n <SelectedContextProvider value={{ selected: selected, setSelected }}>\n <StyledCommandPalette\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n handleChangeSelected(\"down\");\n }\n\n if (e.key === \"ArrowUp\") {\n e.preventDefault();\n handleChangeSelected(\"up\");\n }\n\n if (e.key === \"End\") {\n e.preventDefault();\n scrollToBottom();\n setSelected(filterChildren.itemsLength - 1);\n }\n\n if (e.key === \"Home\") {\n e.preventDefault();\n scrollToTop();\n setSelected(0);\n }\n }}\n >\n <ModeContextProvider value={{ mode, setMode, idModeEnabled }}>\n <CommandPaletteHeader\n commandsLength={filterChildren.commandsLength}\n itemsLength={filterChildren.itemsLength}\n loading={loading}\n />\n </ModeContextProvider>\n\n <StyledCommandPaletteWrapper ref={listWrapperRef}>\n {filterChildren.items}\n </StyledCommandPaletteWrapper>\n </StyledCommandPalette>\n </SelectedContextProvider>\n </SearchContextProvider>\n </Dialog>\n );\n }\n);\n\n_CommandPalette.displayName = \"CommandPalette\";\n\n// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/34757\nexport const CommandPalette = Object.assign({}, _CommandPalette, {\n List: CommandPaletteList,\n Item: CommandPaletteItem,\n CommandItem: CommandPaletteCommandItem,\n});\n"],"mappings":";;;AAAA,OAAOA,KAAK,IACVC,YAAY,EACZC,UAAU,EAGVC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AAEd,SACEC,oBAAoB,EACpBC,2BAA2B,QACtB,yBAAyB;AAChC,SAASC,yBAAyB,QAAQ,6BAA6B;AACvE,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SACEC,kBAAkB,QAEb,sBAAsB;AAC7B,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SACEC,mBAAmB,EACnBC,uBAAuB,EACvBC,qBAAqB,QAChB,WAAW;AAClB,SAASC,OAAO,QAAQ,6BAA6B;AACrD,SAASC,MAAM,QAAqB,WAAW;AAgB/C,OAAO,MAAMC,eAAe,gBAAGf,UAAU,CAIvC,CAAAgB,IAAA,EAYEC,GAAG,KACA;EAAA,IAXDC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,cAAc,GAAAH,IA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,CAAC","ignoreList":[]}
|
|
@@ -14,8 +14,11 @@ export interface ConfirmDialogProps {
|
|
|
14
14
|
confirmationLabel?: string;
|
|
15
15
|
size?: DialogSize;
|
|
16
16
|
height?: string;
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Every confirmation is a native modal alert dialog now. The prop is ignored, with a warning in
|
|
19
|
+
* development, and will be removed.
|
|
20
|
+
*/
|
|
18
21
|
native?: boolean;
|
|
19
22
|
}
|
|
20
|
-
export declare const ConfirmDialog: React.ForwardRefExoticComponent<ConfirmDialogProps & React.RefAttributes<
|
|
23
|
+
export declare const ConfirmDialog: React.ForwardRefExoticComponent<ConfirmDialogProps & React.RefAttributes<HTMLDialogElement>>;
|
|
21
24
|
//# sourceMappingURL=ConfirmDialog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/ConfirmDialog/ConfirmDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAQ5E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"ConfirmDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/ConfirmDialog/ConfirmDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAQ5E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAM9C,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,aAAa,8FAuHzB,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { Button } from "../Button/Button";
|
|
|
4
4
|
import { Checkbox } from "../Checkbox";
|
|
5
5
|
import { Dialog } from "../Dialog";
|
|
6
6
|
import { StyledConfirmation } from "./Styles";
|
|
7
|
+
import { useRemovedPropWarning } from "../Dialog/useRemovedPropWarning";
|
|
7
8
|
import { Body2 } from "../Typography/Variants/Body2";
|
|
8
9
|
const CONFIRMATION_CHECKBOX_ID = "confirm-dialog-confirmation";
|
|
9
10
|
export const ConfirmDialog = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
@@ -27,11 +28,11 @@ export const ConfirmDialog = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
27
28
|
confirmationLabel = _ref.confirmationLabel,
|
|
28
29
|
size = _ref.size,
|
|
29
30
|
height = _ref.height,
|
|
30
|
-
|
|
31
|
-
native = _ref$native === void 0 ? true : _ref$native;
|
|
31
|
+
native = _ref.native;
|
|
32
32
|
const _useState = useState(false),
|
|
33
33
|
confirmed = _useState[0],
|
|
34
34
|
setConfirmed = _useState[1];
|
|
35
|
+
useRemovedPropWarning("ConfirmDialog", "native", native, "Every confirmation is a native modal now, so remove it.");
|
|
35
36
|
const isConfirmBlocked = Boolean(confirmationLabel) && !confirmed;
|
|
36
37
|
const handleToggleConfirmed = useCallback(event => setConfirmed(event.target.checked), []);
|
|
37
38
|
useEffect(() => {
|
|
@@ -61,8 +62,7 @@ export const ConfirmDialog = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
61
62
|
disableCloseOnEsc: isLoading,
|
|
62
63
|
size: size,
|
|
63
64
|
height: height,
|
|
64
|
-
|
|
65
|
-
role: native ? "alertdialog" : undefined
|
|
65
|
+
role: "alertdialog"
|
|
66
66
|
}, /*#__PURE__*/React.createElement(Dialog.Title, null, dialogTitle), /*#__PURE__*/React.createElement(Dialog.ContentDivider, null), /*#__PURE__*/React.createElement(Dialog.Content, null, /*#__PURE__*/React.createElement(Body2, {
|
|
67
67
|
lineHeight: "loose",
|
|
68
68
|
color: "secondary",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmDialog.js","names":["React","forwardRef","useCallback","useEffect","useState","classnames","Button","Checkbox","Dialog","StyledConfirmation","Body2","CONFIRMATION_CHECKBOX_ID","ConfirmDialog","_ref","ref","_ref$open","open","onCancel","onConfirm","className","_ref$dialogTitle","dialogTitle","_ref$dialogContent","dialogContent","_ref$confirmBtnText","confirmBtnText","_ref$cancelBtnText","cancelBtnText","_ref$shouldShowCancel","shouldShowCancelButton","_ref$isLoading","isLoading","confirmationLabel","size","height","
|
|
1
|
+
{"version":3,"file":"ConfirmDialog.js","names":["React","forwardRef","useCallback","useEffect","useState","classnames","Button","Checkbox","Dialog","StyledConfirmation","useRemovedPropWarning","Body2","CONFIRMATION_CHECKBOX_ID","ConfirmDialog","_ref","ref","_ref$open","open","onCancel","onConfirm","className","_ref$dialogTitle","dialogTitle","_ref$dialogContent","dialogContent","_ref$confirmBtnText","confirmBtnText","_ref$cancelBtnText","cancelBtnText","_ref$shouldShowCancel","shouldShowCancelButton","_ref$isLoading","isLoading","confirmationLabel","size","height","native","_useState","confirmed","setConfirmed","isConfirmBlocked","Boolean","handleToggleConfirmed","event","target","checked","handleKeyDown","key","preventDefault","window","addEventListener","removeEventListener","createElement","onClose","disableCloseOnEsc","role","Title","ContentDivider","Content","lineHeight","color","whitespace","id","onChange","disabled","htmlFor","Actions","variant","onClick","type","displayName"],"sources":["../../../../src/components/ConfirmDialog/ConfirmDialog.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useEffect, useState } from \"react\";\n\nimport classnames from \"classnames\";\n\nimport { Button } from \"../Button/Button\";\nimport { Checkbox } from \"../Checkbox\";\nimport { Dialog } from \"../Dialog\";\nimport { StyledConfirmation } from \"./Styles\";\nimport { DialogSize } from \"../Dialog/Styles\";\nimport { useRemovedPropWarning } from \"../Dialog/useRemovedPropWarning\";\nimport { Body2 } from \"../Typography/Variants/Body2\";\n\nconst CONFIRMATION_CHECKBOX_ID = \"confirm-dialog-confirmation\";\n\nexport interface ConfirmDialogProps {\n open?: boolean;\n onCancel?: () => void;\n onConfirm?: () => void;\n className?: string;\n dialogTitle?: string;\n dialogContent?: React.ReactNode;\n confirmBtnText?: string;\n cancelBtnText?: string;\n shouldShowCancelButton?: boolean;\n isLoading?: boolean;\n confirmationLabel?: string;\n size?: DialogSize;\n height?: string;\n /**\n * @deprecated Every confirmation is a native modal alert dialog now. The prop is ignored, with a warning in\n * development, and will be removed.\n */\n native?: boolean;\n}\n\nexport const ConfirmDialog = forwardRef<HTMLDialogElement, ConfirmDialogProps>(\n (\n {\n open = false,\n onCancel,\n onConfirm,\n className,\n dialogTitle = \"Discard changes?\",\n dialogContent = \"All unsaved changes will be lost.\",\n confirmBtnText = \"OK\",\n cancelBtnText = \"Cancel\",\n shouldShowCancelButton = true,\n isLoading = false,\n confirmationLabel,\n size,\n height,\n native,\n },\n ref\n ) => {\n const [confirmed, setConfirmed] = useState(false);\n\n useRemovedPropWarning(\n \"ConfirmDialog\",\n \"native\",\n native,\n \"Every confirmation is a native modal now, so remove it.\"\n );\n const isConfirmBlocked = Boolean(confirmationLabel) && !confirmed;\n\n const handleToggleConfirmed = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) =>\n setConfirmed(event.target.checked),\n []\n );\n\n useEffect(() => {\n if (!open) {\n setConfirmed(false);\n }\n }, [open]);\n\n useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (\n event.key === \"Enter\" &&\n onConfirm &&\n !isConfirmBlocked &&\n !isLoading\n ) {\n event.preventDefault();\n onConfirm();\n }\n };\n\n if (open) {\n window.addEventListener(\"keydown\", handleKeyDown);\n }\n\n return () => {\n window.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, [open, onConfirm, isConfirmBlocked, isLoading]);\n\n return (\n <Dialog\n ref={ref}\n open={open}\n onClose={onCancel}\n className={classnames(\"c-confirm-dialog\", className)}\n disableCloseOnEsc={isLoading}\n size={size}\n height={height}\n role=\"alertdialog\"\n >\n <Dialog.Title>{dialogTitle}</Dialog.Title>\n <Dialog.ContentDivider />\n <Dialog.Content>\n <Body2 lineHeight=\"loose\" color=\"secondary\" whitespace=\"pre-line\">\n {dialogContent}\n </Body2>\n {confirmationLabel ? (\n <StyledConfirmation className=\"c-confirm-dialog--confirmation\">\n <Checkbox\n id={CONFIRMATION_CHECKBOX_ID}\n checked={confirmed}\n onChange={handleToggleConfirmed}\n disabled={isLoading}\n />\n <label htmlFor={CONFIRMATION_CHECKBOX_ID}>\n <Body2 color=\"secondary\">{confirmationLabel}</Body2>\n </label>\n </StyledConfirmation>\n ) : null}\n </Dialog.Content>\n <Dialog.ContentDivider />\n <Dialog.Actions>\n <Button\n variant=\"primary\"\n onClick={onConfirm}\n disabled={isLoading || isConfirmBlocked}\n >\n {confirmBtnText}\n </Button>\n {shouldShowCancelButton ? (\n <Button\n variant=\"secondary\"\n data-action=\"cancel\"\n onClick={onCancel}\n type=\"button\"\n disabled={isLoading}\n >\n {cancelBtnText}\n </Button>\n ) : null}\n </Dialog.Actions>\n </Dialog>\n );\n }\n);\n\nConfirmDialog.displayName = \"ConfirmDialog\";\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAE3E,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,QAAQ,QAAQ,aAAa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AAY,QAAQ;IACpBC,OAAO,EAAElD,QAAS;IAClBmD,IAAI,EAAC,QAAQ;IACbL,QAAQ,EAAEhC;EAAU,GAEnBJ,aACK,CAAC,GACP,IACU,CACV,CAAC;AAEb,CACF,CAAC;AAEDf,aAAa,CAACyD,WAAW,GAAG,eAAe","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const StyledConfirmDialog: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("..").ConfirmDialogProps & import("react").RefAttributes<
|
|
1
|
+
export declare const StyledConfirmDialog: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("..").ConfirmDialogProps & import("react").RefAttributes<HTMLDialogElement>>, any, {}, never>;
|
|
2
2
|
export declare const StyledDatePickerContainerInner: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
3
|
export declare const StyledDatePickerWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
4
|
export declare const StyledDaysOfWeek: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/DatePicker/Styles.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/DatePicker/Styles.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,mBAAmB,4LAkB/B,CAAC;AAIF,eAAO,MAAM,8BAA8B,oEAqO1C,CAAC;AAEF,eAAO,MAAM,uBAAuB,oEAInC,CAAC;AAIF,eAAO,MAAM,gBAAgB,oEAO5B,CAAC;AAIF,eAAO,MAAM,aAAa,oEAYzB,CAAC;AAIF,eAAO,MAAM,mBAAmB,oEAM/B,CAAC;AAIF,eAAO,MAAM,kBAAkB,oEAmB9B,CAAC;AAIF,eAAO,MAAM,aAAa,qEAkBzB,CAAC;AAIF,eAAO,MAAM,sBAAsB,oEAOlC,CAAC;AAIF,eAAO,MAAM,gBAAgB,oEAQ5B,CAAC;AAIF,eAAO,MAAM,gBAAgB,oEAsB5B,CAAC;AAIF,eAAO,MAAM,iBAAiB,oEAqB7B,CAAC;AAIF,eAAO,MAAM,iBAAiB,oEAO7B,CAAC;AAIF,eAAO,MAAM,mBAAmB,oEAG/B,CAAC;AAIF,eAAO,MAAM,cAAc,oEAM1B,CAAC;AAIF,eAAO,MAAM,kBAAkB,oEAG9B,CAAC;AAIF,eAAO,MAAM,wBAAwB;;sEAEpC,CAAC;AAIF,eAAO,MAAM,oBAAoB,oEAShC,CAAC"}
|
|
@@ -12,15 +12,27 @@ export interface DialogProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
12
12
|
size?: DialogSize;
|
|
13
13
|
/** "fluid" follows the content. A CSS length ("95%", "600px") pins the height instead. */
|
|
14
14
|
height?: string;
|
|
15
|
-
/**
|
|
15
|
+
/** Leaves the focus off the control that opened the dialog when it closes, so that control does not show focus. */
|
|
16
|
+
disableReturnFocus?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Counts as opened before the sheets that are open, so they stay above the dialog, also when it mounts after them
|
|
19
|
+
* on a reload. For a page dialog that opens a sheet over itself. A sheet that sits in the page when the dialog opens
|
|
20
|
+
* mounts its content again inside the dialog; a sheet that already sits in another dialog moves without remounting.
|
|
21
|
+
* Read when the dialog opens.
|
|
22
|
+
*/
|
|
23
|
+
belowOpenSheets?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated Every Dialog is a native modal <dialog> now: the page behind is inert and the dialog sits in the top
|
|
26
|
+
* layer. The prop is ignored, with a warning in development, and will be removed.
|
|
27
|
+
*/
|
|
16
28
|
native?: boolean;
|
|
17
29
|
}
|
|
18
30
|
export declare const _Dialog: React.ForwardRefExoticComponent<DialogProps & {
|
|
19
31
|
children?: React.ReactNode | undefined;
|
|
20
|
-
} & React.RefAttributes<
|
|
32
|
+
} & React.RefAttributes<HTMLDialogElement>>;
|
|
21
33
|
export declare const Dialog: React.ForwardRefExoticComponent<DialogProps & {
|
|
22
34
|
children?: React.ReactNode | undefined;
|
|
23
|
-
} & React.RefAttributes<
|
|
35
|
+
} & React.RefAttributes<HTMLDialogElement>> & {
|
|
24
36
|
Title: {
|
|
25
37
|
({ children, className, disableDefaultHeading, onClose, closeLabel, ...rest }: PropsWithChildren<import("./DialogTitle").DialogTitleProps>): React.JSX.Element;
|
|
26
38
|
displayName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAEZ,cAAc,EACd,iBAAiB,EAElB,MAAM,OAAO,CAAC;AASf,OAAO,EAAE,UAAU,EAA6B,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAEZ,cAAc,EACd,iBAAiB,EAElB,MAAM,OAAO,CAAC;AASf,OAAO,EAAE,UAAU,EAA6B,MAAM,UAAU,CAAC;AAIjE,MAAM,WAAW,WAAY,SAAQ,cAAc,CAAC,cAAc,CAAC;IACjE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,CAAC,KAAK,KAAA,KAAK,IAAI,CAAC;IACjC,4FAA4F;IAC5F,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,0FAA0F;IAC1F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mHAAmH;IACnH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,OAAO;;2CAyDnB,CAAC;AAKF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;CAKjB,CAAC"}
|
|
@@ -10,6 +10,7 @@ import { DialogFrame } from "./DialogFrame";
|
|
|
10
10
|
import { DialogTitle } from "./DialogTitle";
|
|
11
11
|
import { dialogSizes, StyledDialog } from "./Styles";
|
|
12
12
|
import { useFluidHeightAnimation } from "./useFluidHeightAnimation";
|
|
13
|
+
import { useRemovedPropWarning } from "./useRemovedPropWarning";
|
|
13
14
|
export const _Dialog = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
14
15
|
var _dialogSizes$size;
|
|
15
16
|
let children = _ref.children,
|
|
@@ -28,12 +29,12 @@ export const _Dialog = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
28
29
|
size = _ref$size === void 0 ? "m" : _ref$size,
|
|
29
30
|
_ref$height = _ref.height,
|
|
30
31
|
height = _ref$height === void 0 ? "fluid" : _ref$height,
|
|
31
|
-
|
|
32
|
-
native = _ref$native === void 0 ? false : _ref$native,
|
|
32
|
+
native = _ref.native,
|
|
33
33
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
34
34
|
const _useState = useState(null),
|
|
35
35
|
dialogNode = _useState[0],
|
|
36
36
|
setDialogNode = _useState[1];
|
|
37
|
+
useRemovedPropWarning("Dialog", "native", native, "Every Dialog is a native modal now, so remove it.");
|
|
37
38
|
useFluidHeightAnimation(dialogNode, height === "fluid");
|
|
38
39
|
const surface = /*#__PURE__*/React.createElement(StyledDialog, {
|
|
39
40
|
ref: setDialogNode,
|
|
@@ -43,7 +44,6 @@ export const _Dialog = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
43
44
|
}, children);
|
|
44
45
|
return /*#__PURE__*/React.createElement(DialogFrame, _extends({}, rest, {
|
|
45
46
|
forwardedRef: ref,
|
|
46
|
-
native: native,
|
|
47
47
|
open: open,
|
|
48
48
|
onClose: onClose,
|
|
49
49
|
enableBackgroundClick: enableBackgroundClick,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","names":["React","forwardRef","useState","classnames","DialogActions","DialogContent","DialogContentDivider","DialogFrame","DialogTitle","dialogSizes","StyledDialog","useFluidHeightAnimation","_Dialog","_ref","ref","_dialogSizes$size","children","_ref$open","open","onClose","className","_ref$enableBackground","enableBackgroundClick","_ref$disableCloseOnEs","disableCloseOnEsc","_ref$animate","animate","onClickOutside","_ref$size","size","_ref$height","height","
|
|
1
|
+
{"version":3,"file":"Dialog.js","names":["React","forwardRef","useState","classnames","DialogActions","DialogContent","DialogContentDivider","DialogFrame","DialogTitle","dialogSizes","StyledDialog","useFluidHeightAnimation","useRemovedPropWarning","_Dialog","_ref","ref","_dialogSizes$size","children","_ref$open","open","onClose","className","_ref$enableBackground","enableBackgroundClick","_ref$disableCloseOnEs","disableCloseOnEsc","_ref$animate","animate","onClickOutside","_ref$size","size","_ref$height","height","native","rest","_objectWithoutPropertiesLoose","_excluded","_useState","dialogNode","setDialogNode","surface","createElement","$maxWidth","m","$height","undefined","_extends","forwardedRef","displayName","Dialog","Object","assign","Title","Content","ContentDivider","Actions"],"sources":["../../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import React, {\n forwardRef,\n HTMLAttributes,\n PropsWithChildren,\n useState,\n} from \"react\";\n\nimport classnames from \"classnames\";\n\nimport { DialogActions } from \"./DialogActions\";\nimport { DialogContent } from \"./DialogContent\";\nimport { DialogContentDivider } from \"./DialogContentDivider\";\nimport { DialogFrame } from \"./DialogFrame\";\nimport { DialogTitle } from \"./DialogTitle\";\nimport { DialogSize, dialogSizes, StyledDialog } from \"./Styles\";\nimport { useFluidHeightAnimation } from \"./useFluidHeightAnimation\";\nimport { useRemovedPropWarning } from \"./useRemovedPropWarning\";\n\nexport interface DialogProps extends HTMLAttributes<HTMLDivElement> {\n open?: boolean;\n onClose?: () => void;\n className?: string;\n enableBackgroundClick?: boolean;\n disableCloseOnEsc?: boolean;\n animate?: \"fade\" | \"slide\";\n onClickOutside?: (event) => void;\n /** Width step. Every step is a max-width; the dialog always fills it when there is room. */\n size?: DialogSize;\n /** \"fluid\" follows the content. A CSS length (\"95%\", \"600px\") pins the height instead. */\n height?: string;\n /** Leaves the focus off the control that opened the dialog when it closes, so that control does not show focus. */\n disableReturnFocus?: boolean;\n /**\n * Counts as opened before the sheets that are open, so they stay above the dialog, also when it mounts after them\n * on a reload. For a page dialog that opens a sheet over itself. A sheet that sits in the page when the dialog opens\n * mounts its content again inside the dialog; a sheet that already sits in another dialog moves without remounting.\n * Read when the dialog opens.\n */\n belowOpenSheets?: boolean;\n /**\n * @deprecated Every Dialog is a native modal <dialog> now: the page behind is inert and the dialog sits in the top\n * layer. The prop is ignored, with a warning in development, and will be removed.\n */\n native?: boolean;\n}\n\nexport const _Dialog = forwardRef<\n HTMLDialogElement,\n PropsWithChildren<DialogProps>\n>(\n (\n {\n children,\n open = false,\n onClose,\n className,\n enableBackgroundClick = false,\n disableCloseOnEsc = false,\n animate = \"slide\",\n onClickOutside,\n size = \"m\",\n height = \"fluid\",\n native,\n ...rest\n },\n ref\n ) => {\n const [dialogNode, setDialogNode] = useState<HTMLDivElement | null>(null);\n\n useRemovedPropWarning(\n \"Dialog\",\n \"native\",\n native,\n \"Every Dialog is a native modal now, so remove it.\"\n );\n\n useFluidHeightAnimation(dialogNode, height === \"fluid\");\n\n const surface = (\n <StyledDialog\n ref={setDialogNode}\n $maxWidth={dialogSizes[size] ?? dialogSizes.m}\n $height={height === \"fluid\" ? undefined : height}\n className={classnames(\"c-dialog\", className)}\n >\n {children}\n </StyledDialog>\n );\n\n return (\n <DialogFrame\n {...rest}\n forwardedRef={ref}\n open={open}\n onClose={onClose}\n enableBackgroundClick={enableBackgroundClick}\n disableCloseOnEsc={disableCloseOnEsc}\n animate={animate}\n onClickOutside={onClickOutside}\n surface={surface}\n />\n );\n }\n);\n\n_Dialog.displayName = \"Dialog\";\n\n// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/34757\nexport const Dialog = Object.assign({}, _Dialog, {\n Title: DialogTitle,\n Content: DialogContent,\n ContentDivider: DialogContentDivider,\n Actions: DialogActions,\n});\n"],"mappings":";;;AAAA,OAAOA,KAAK,IACVC,UAAU,EAGVC,QAAQ,QACH,OAAO;AAEd,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAAqBC,WAAW,EAAEC,YAAY,QAAQ,UAAU;AAChE,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,qBAAqB,QAAQ,yBAAyB;AA8B/D,OAAO,MAAMC,OAAO,gBAAGZ,UAAU,CAI/B,CAAAa,IAAA,EAeEC,GAAG,KACA;EAAA,IAAAC,iBAAA;EAAA,IAdDC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IAAAC,SAAA,GAAAJ,IAAA,CACRK,IAAI;IAAJA,IAAI,GAAAD,SAAA,cAAG,KAAK,GAAAA,SAAA;IACZE,OAAO,GAAAN,IAAA,CAAPM,OAAO;IACPC,SAAS,GAAAP,IAAA,CAATO,SAAS;IAAAC,qBAAA,GAAAR,IAAA,CACTS,qBAAqB;IAArBA,qBAAqB,GAAAD,qBAAA,cAAG,KAAK,GAAAA,qBAAA;IAAAE,qBAAA,GAAAV,IAAA,CAC7BW,iBAAiB;IAAjBA,iBAAiB,GAAAD,qBAAA,cAAG,KAAK,GAAAA,qBAAA;IAAAE,YAAA,GAAAZ,IAAA,CACzBa,OAAO;IAAPA,OAAO,GAAAD,YAAA,cAAG,OAAO,GAAAA,YAA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AC;AAED3B,OAAO,CAACmC,WAAW,GAAG,QAAQ;;AAE9B;AACA,OAAO,MAAMC,MAAM,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,EAAEtC,OAAO,EAAE;EAC/CuC,KAAK,EAAE5C,WAAW;EAClB6C,OAAO,EAAEhD,aAAa;EACtBiD,cAAc,EAAEhD,oBAAoB;EACpCiD,OAAO,EAAEnD;AACX,CAAC,CAAC","ignoreList":[]}
|
|
@@ -3,9 +3,9 @@ export interface DialogContextProps {
|
|
|
3
3
|
requestClose?: () => void;
|
|
4
4
|
/** The handler the dialog was given, used to recognise a button that only closes. */
|
|
5
5
|
onClose?: () => void;
|
|
6
|
-
/**
|
|
6
|
+
/** The id of the dialog's title, which names the dialog. */
|
|
7
7
|
titleId?: string;
|
|
8
|
-
/**
|
|
8
|
+
/** The dialog's title reports that it is there. Returns the call that takes it back. */
|
|
9
9
|
registerTitle?: () => () => void;
|
|
10
10
|
}
|
|
11
11
|
export declare const DialogContext: import("react").Context<DialogContextProps | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogContext.d.ts","sourceRoot":"","sources":["../../../../src/components/Dialog/DialogContext.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IACjC,qFAAqF;IACrF,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,qFAAqF;IACrF,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,
|
|
1
|
+
{"version":3,"file":"DialogContext.d.ts","sourceRoot":"","sources":["../../../../src/components/Dialog/DialogContext.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IACjC,qFAAqF;IACrF,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,qFAAqF;IACrF,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wFAAwF;IACxF,aAAa,CAAC,EAAE,MAAM,MAAM,IAAI,CAAC;CAClC;AAED,eAAO,MAAM,aAAa,oDAAiD,CAAC;AAE5E,eAAO,MAAM,gBAAgB,iCAAkC,CAAC;AAEhE;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,WAAW,MAAM,IAAI,WAlB7B,IAsBtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogContext.js","names":["createContext","useContext","DialogContext","useDialogContext","useDialogClose","fallback","_ref","_context$requestClose","context","requestClose","undefined"],"sources":["../../../../src/components/Dialog/DialogContext.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\n\nexport interface DialogContextProps {\n /** Starts the closing transition. The dialog's own onClose runs once it finishes. */\n requestClose?: () => void;\n /** The handler the dialog was given, used to recognise a button that only closes. */\n onClose?: () => void;\n /**
|
|
1
|
+
{"version":3,"file":"DialogContext.js","names":["createContext","useContext","DialogContext","useDialogContext","useDialogClose","fallback","_ref","_context$requestClose","context","requestClose","undefined"],"sources":["../../../../src/components/Dialog/DialogContext.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\n\nexport interface DialogContextProps {\n /** Starts the closing transition. The dialog's own onClose runs once it finishes. */\n requestClose?: () => void;\n /** The handler the dialog was given, used to recognise a button that only closes. */\n onClose?: () => void;\n /** The id of the dialog's title, which names the dialog. */\n titleId?: string;\n /** The dialog's title reports that it is there. Returns the call that takes it back. */\n registerTitle?: () => () => void;\n}\n\nexport const DialogContext = createContext<DialogContextProps | null>(null);\n\nexport const useDialogContext = () => useContext(DialogContext);\n\n/**\n * Closes the dialog the way clicking the overlay does: the exit transition runs first, and the\n * dialog's own onClose fires once it finishes. Use it for a Cancel button instead of calling the\n * parent's close handler, which would unmount the dialog before it can animate out.\n */\nexport const useDialogClose = (fallback?: () => void) => {\n const context = useContext(DialogContext);\n\n return context?.requestClose ?? fallback ?? (() => undefined);\n};\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AAajD,OAAO,MAAMC,aAAa,gBAAGF,aAAa,CAA4B,IAAI,CAAC;AAE3E,OAAO,MAAMG,gBAAgB,GAAGA,CAAA,KAAMF,UAAU,CAACC,aAAa,CAAC;;AAE/D;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,cAAc,GAAIC,QAAqB,IAAK;EAAA,IAAAC,IAAA,EAAAC,qBAAA;EACvD,MAAMC,OAAO,GAAGP,UAAU,CAACC,aAAa,CAAC;EAEzC,QAAAI,IAAA,IAAAC,qBAAA,GAAOC,OAAO,oBAAPA,OAAO,CAAEC,YAAY,YAAAF,qBAAA,GAAIF,QAAQ,YAAAC,IAAA,GAAK,MAAMI,SAAS;AAC9D,CAAC","ignoreList":[]}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import React, { ReactElement, Ref } from "react";
|
|
1
|
+
import React, { ReactElement, ReactNode, Ref } from "react";
|
|
2
2
|
import type { DialogProps } from "./Dialog";
|
|
3
|
-
export interface DialogFrameProps extends Omit<DialogProps, "children" | "size" | "height"> {
|
|
4
|
-
forwardedRef?: Ref<
|
|
3
|
+
export interface DialogFrameProps extends Omit<DialogProps, "native" | "children" | "size" | "height"> {
|
|
4
|
+
forwardedRef?: Ref<HTMLDialogElement>;
|
|
5
5
|
/** The visible card. The frame places it in the viewport and runs its open and close animation. */
|
|
6
6
|
surface: ReactElement;
|
|
7
|
-
|
|
8
|
-
disableFocusLock?: boolean;
|
|
7
|
+
children?: ReactNode;
|
|
9
8
|
}
|
|
10
9
|
export declare const DialogFrame: {
|
|
11
|
-
({ forwardedRef, surface,
|
|
10
|
+
({ forwardedRef, surface, open, onClose, enableBackgroundClick, disableCloseOnEsc, animate, onClickOutside, disableReturnFocus, ...rest }: DialogFrameProps): React.JSX.Element;
|
|
12
11
|
displayName: string;
|
|
13
12
|
};
|
|
14
13
|
//# sourceMappingURL=DialogFrame.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogFrame.d.ts","sourceRoot":"","sources":["../../../../src/components/Dialog/DialogFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAGZ,YAAY,
|
|
1
|
+
{"version":3,"file":"DialogFrame.d.ts","sourceRoot":"","sources":["../../../../src/components/Dialog/DialogFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAGZ,YAAY,EACZ,SAAS,EACT,GAAG,EAMJ,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAQ5C,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,CAAC;IACpE,YAAY,CAAC,EAAE,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACtC,mGAAmG;IACnG,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAGD,eAAO,MAAM,WAAW;+IAWrB,gBAAgB;;CA6FlB,CAAC"}
|