@salt-ds/lab 1.0.0-alpha.34 → 1.0.0-alpha.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/css/salt-lab.css +253 -192
- package/dist-cjs/combo-box-next/ComboBoxNext.css.js +6 -0
- package/dist-cjs/combo-box-next/ComboBoxNext.css.js.map +1 -0
- package/dist-cjs/combo-box-next/ComboBoxNext.js +31 -3
- package/dist-cjs/combo-box-next/ComboBoxNext.js.map +1 -1
- package/dist-cjs/dropdown-next/DropdownNext.js +1 -1
- package/dist-cjs/dropdown-next/DropdownNext.js.map +1 -1
- package/dist-cjs/index.js +0 -14
- package/dist-cjs/index.js.map +1 -1
- package/dist-cjs/option/Option.css.js +1 -1
- package/dist-cjs/option/OptionList.css.js +1 -1
- package/dist-cjs/overlay/Overlay.css.js +1 -1
- package/dist-cjs/overlay/Overlay.js +1 -7
- package/dist-cjs/overlay/Overlay.js.map +1 -1
- package/dist-cjs/overlay/OverlayPanel.js +18 -24
- package/dist-cjs/overlay/OverlayPanel.js.map +1 -1
- package/dist-cjs/overlay/OverlayPanelBase.js +2 -4
- package/dist-cjs/overlay/OverlayPanelBase.js.map +1 -1
- package/dist-cjs/pill-input/PillInput.css.js +6 -0
- package/dist-cjs/pill-input/PillInput.css.js.map +1 -0
- package/dist-cjs/pill-input/PillInput.js +256 -0
- package/dist-cjs/pill-input/PillInput.js.map +1 -0
- package/dist-cjs/pill-input/useTruncatePills.js +85 -0
- package/dist-cjs/pill-input/useTruncatePills.js.map +1 -0
- package/dist-cjs/tabs/Tab.js +1 -1
- package/dist-cjs/tabs/Tab.js.map +1 -1
- package/dist-cjs/tabs-next/TabNextContext.js.map +1 -1
- package/dist-cjs/tabs-next/TabstripNext.css.js +1 -1
- package/dist-cjs/tabs-next/TabstripNext.js +23 -21
- package/dist-cjs/tabs-next/TabstripNext.js.map +1 -1
- package/dist-cjs/utils/useValueEffect.js +40 -0
- package/dist-cjs/utils/useValueEffect.js.map +1 -0
- package/dist-es/combo-box-next/ComboBoxNext.css.js +4 -0
- package/dist-es/combo-box-next/ComboBoxNext.css.js.map +1 -0
- package/dist-es/combo-box-next/ComboBoxNext.js +32 -4
- package/dist-es/combo-box-next/ComboBoxNext.js.map +1 -1
- package/dist-es/dropdown-next/DropdownNext.js +1 -1
- package/dist-es/dropdown-next/DropdownNext.js.map +1 -1
- package/dist-es/index.js +0 -6
- package/dist-es/index.js.map +1 -1
- package/dist-es/option/Option.css.js +1 -1
- package/dist-es/option/OptionList.css.js +1 -1
- package/dist-es/overlay/Overlay.css.js +1 -1
- package/dist-es/overlay/Overlay.js +1 -7
- package/dist-es/overlay/Overlay.js.map +1 -1
- package/dist-es/overlay/OverlayPanel.js +19 -25
- package/dist-es/overlay/OverlayPanel.js.map +1 -1
- package/dist-es/overlay/OverlayPanelBase.js +2 -4
- package/dist-es/overlay/OverlayPanelBase.js.map +1 -1
- package/dist-es/pill-input/PillInput.css.js +4 -0
- package/dist-es/pill-input/PillInput.css.js.map +1 -0
- package/dist-es/pill-input/PillInput.js +252 -0
- package/dist-es/pill-input/PillInput.js.map +1 -0
- package/dist-es/pill-input/useTruncatePills.js +81 -0
- package/dist-es/pill-input/useTruncatePills.js.map +1 -0
- package/dist-es/tabs/Tab.js +1 -1
- package/dist-es/tabs/Tab.js.map +1 -1
- package/dist-es/tabs-next/TabNextContext.js.map +1 -1
- package/dist-es/tabs-next/TabstripNext.css.js +1 -1
- package/dist-es/tabs-next/TabstripNext.js +23 -21
- package/dist-es/tabs-next/TabstripNext.js.map +1 -1
- package/dist-es/utils/useValueEffect.js +36 -0
- package/dist-es/utils/useValueEffect.js.map +1 -0
- package/dist-types/combo-box-next/ComboBoxNext.d.ts +3 -3
- package/dist-types/index.d.ts +0 -1
- package/dist-types/pill-input/PillInput.d.ts +48 -0
- package/dist-types/pill-input/index.d.ts +1 -0
- package/dist-types/pill-input/useTruncatePills.d.ts +8 -0
- package/dist-types/tabs/drag-drop/drag-utils.d.ts +6 -6
- package/dist-types/tabs-next/TabNextContext.d.ts +2 -2
- package/dist-types/utils/useValueEffect.d.ts +4 -0
- package/package.json +2 -2
- package/dist-cjs/dialog/Dialog.css.js +0 -6
- package/dist-cjs/dialog/Dialog.css.js.map +0 -1
- package/dist-cjs/dialog/Dialog.js +0 -115
- package/dist-cjs/dialog/Dialog.js.map +0 -1
- package/dist-cjs/dialog/DialogActions.css.js +0 -6
- package/dist-cjs/dialog/DialogActions.css.js.map +0 -1
- package/dist-cjs/dialog/DialogActions.js +0 -33
- package/dist-cjs/dialog/DialogActions.js.map +0 -1
- package/dist-cjs/dialog/DialogCloseButton.css.js +0 -6
- package/dist-cjs/dialog/DialogCloseButton.css.js.map +0 -1
- package/dist-cjs/dialog/DialogCloseButton.js +0 -39
- package/dist-cjs/dialog/DialogCloseButton.js.map +0 -1
- package/dist-cjs/dialog/DialogContent.css.js +0 -6
- package/dist-cjs/dialog/DialogContent.css.js.map +0 -1
- package/dist-cjs/dialog/DialogContent.js +0 -45
- package/dist-cjs/dialog/DialogContent.js.map +0 -1
- package/dist-cjs/dialog/DialogContext.js +0 -17
- package/dist-cjs/dialog/DialogContext.js.map +0 -1
- package/dist-cjs/dialog/DialogHeader.css.js +0 -6
- package/dist-cjs/dialog/DialogHeader.css.js.map +0 -1
- package/dist-cjs/dialog/DialogHeader.js +0 -67
- package/dist-cjs/dialog/DialogHeader.js.map +0 -1
- package/dist-es/dialog/Dialog.css.js +0 -4
- package/dist-es/dialog/Dialog.css.js.map +0 -1
- package/dist-es/dialog/Dialog.js +0 -110
- package/dist-es/dialog/Dialog.js.map +0 -1
- package/dist-es/dialog/DialogActions.css.js +0 -4
- package/dist-es/dialog/DialogActions.css.js.map +0 -1
- package/dist-es/dialog/DialogActions.js +0 -29
- package/dist-es/dialog/DialogActions.js.map +0 -1
- package/dist-es/dialog/DialogCloseButton.css.js +0 -4
- package/dist-es/dialog/DialogCloseButton.css.js.map +0 -1
- package/dist-es/dialog/DialogCloseButton.js +0 -31
- package/dist-es/dialog/DialogCloseButton.js.map +0 -1
- package/dist-es/dialog/DialogContent.css.js +0 -4
- package/dist-es/dialog/DialogContent.css.js.map +0 -1
- package/dist-es/dialog/DialogContent.js +0 -41
- package/dist-es/dialog/DialogContent.js.map +0 -1
- package/dist-es/dialog/DialogContext.js +0 -12
- package/dist-es/dialog/DialogContext.js.map +0 -1
- package/dist-es/dialog/DialogHeader.css.js +0 -4
- package/dist-es/dialog/DialogHeader.css.js.map +0 -1
- package/dist-es/dialog/DialogHeader.js +0 -59
- package/dist-es/dialog/DialogHeader.js.map +0 -1
- package/dist-types/dialog/Dialog.d.ts +0 -46
- package/dist-types/dialog/DialogActions.d.ts +0 -8
- package/dist-types/dialog/DialogCloseButton.d.ts +0 -2
- package/dist-types/dialog/DialogContent.d.ts +0 -8
- package/dist-types/dialog/DialogContext.d.ts +0 -8
- package/dist-types/dialog/DialogHeader.d.ts +0 -22
- package/dist-types/dialog/index.d.ts +0 -6
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useState, useRef } from 'react';
|
|
2
|
+
import { useIsomorphicLayoutEffect } from '@salt-ds/core';
|
|
3
|
+
import { useEventCallback } from './useEventCallback.js';
|
|
4
|
+
|
|
5
|
+
function useValueEffect(defaultValue) {
|
|
6
|
+
let [value, setValue] = useState(defaultValue);
|
|
7
|
+
let effect = useRef(null);
|
|
8
|
+
let nextRef = useEventCallback(() => {
|
|
9
|
+
if (!effect.current) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
let newValue = effect.current.next();
|
|
13
|
+
if (newValue.done) {
|
|
14
|
+
effect.current = null;
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (value === newValue.value) {
|
|
18
|
+
nextRef();
|
|
19
|
+
} else {
|
|
20
|
+
setValue(newValue.value);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
useIsomorphicLayoutEffect(() => {
|
|
24
|
+
if (effect.current) {
|
|
25
|
+
nextRef();
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
let queue = useEventCallback((fn) => {
|
|
29
|
+
effect.current = fn(value);
|
|
30
|
+
nextRef();
|
|
31
|
+
});
|
|
32
|
+
return [value, queue];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { useValueEffect };
|
|
36
|
+
//# sourceMappingURL=useValueEffect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useValueEffect.js","sources":["../src/utils/useValueEffect.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { Dispatch, MutableRefObject, useRef, useState } from \"react\";\nimport { useIsomorphicLayoutEffect } from \"@salt-ds/core\";\nimport { useEventCallback } from \"./useEventCallback\";\n\ntype SetValueAction<S> = (prev: S) => Generator<any, void, unknown>;\n\n// This hook works like `useState`, but when setting the value, you pass a generator function\n// that can yield multiple values. Each yielded value updates the state and waits for the next\n// layout effect, then continues the generator. This allows sequential updates to state to be\n// written linearly.\nexport function useValueEffect<S>(\n defaultValue: S | (() => S)\n): [S, Dispatch<SetValueAction<S>>] {\n let [value, setValue] = useState(defaultValue);\n let effect: MutableRefObject<Generator<S> | null> =\n useRef<Generator<S> | null>(null);\n\n // Store the function in a ref so we can always access the current version\n // which has the proper `value` in scope.\n let nextRef = useEventCallback(() => {\n if (!effect.current) {\n return;\n }\n // Run the generator to the next yield.\n let newValue = effect.current.next();\n\n // If the generator is done, reset the effect.\n if (newValue.done) {\n effect.current = null;\n return;\n }\n\n // If the value is the same as the current value,\n // then continue to the next yield. Otherwise,\n // set the value in state and wait for the next layout effect.\n if (value === newValue.value) {\n nextRef();\n } else {\n setValue(newValue.value);\n }\n });\n\n useIsomorphicLayoutEffect(() => {\n // If there is an effect currently running, continue to the next yield.\n if (effect.current) {\n nextRef();\n }\n });\n\n let queue: Dispatch<SetValueAction<S>> = useEventCallback((fn) => {\n effect.current = fn(value);\n nextRef();\n });\n\n return [value, queue];\n}\n"],"names":[],"mappings":";;;;AAsBO,SAAS,eACd,YACkC,EAAA;AAClC,EAAA,IAAI,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAS,YAAY,CAAA,CAAA;AAC7C,EAAI,IAAA,MAAA,GACF,OAA4B,IAAI,CAAA,CAAA;AAIlC,EAAI,IAAA,OAAA,GAAU,iBAAiB,MAAM;AACnC,IAAI,IAAA,CAAC,OAAO,OAAS,EAAA;AACnB,MAAA,OAAA;AAAA,KACF;AAEA,IAAI,IAAA,QAAA,GAAW,MAAO,CAAA,OAAA,CAAQ,IAAK,EAAA,CAAA;AAGnC,IAAA,IAAI,SAAS,IAAM,EAAA;AACjB,MAAA,MAAA,CAAO,OAAU,GAAA,IAAA,CAAA;AACjB,MAAA,OAAA;AAAA,KACF;AAKA,IAAI,IAAA,KAAA,KAAU,SAAS,KAAO,EAAA;AAC5B,MAAQ,OAAA,EAAA,CAAA;AAAA,KACH,MAAA;AACL,MAAA,QAAA,CAAS,SAAS,KAAK,CAAA,CAAA;AAAA,KACzB;AAAA,GACD,CAAA,CAAA;AAED,EAAA,yBAAA,CAA0B,MAAM;AAE9B,IAAA,IAAI,OAAO,OAAS,EAAA;AAClB,MAAQ,OAAA,EAAA,CAAA;AAAA,KACV;AAAA,GACD,CAAA,CAAA;AAED,EAAI,IAAA,KAAA,GAAqC,gBAAiB,CAAA,CAAC,EAAO,KAAA;AAChE,IAAO,MAAA,CAAA,OAAA,GAAU,GAAG,KAAK,CAAA,CAAA;AACzB,IAAQ,OAAA,EAAA,CAAA;AAAA,GACT,CAAA,CAAA;AAED,EAAO,OAAA,CAAC,OAAO,KAAK,CAAA,CAAA;AACtB;;;;"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { ReactNode, Ref } from "react";
|
|
2
|
-
import { InputProps } from "@salt-ds/core";
|
|
3
2
|
import { UseComboBoxNextProps } from "./useComboBoxNext";
|
|
3
|
+
import { PillInputProps } from "../pill-input";
|
|
4
4
|
export declare type ComboBoxNextProps<Item = string> = {
|
|
5
5
|
/**
|
|
6
6
|
* The options to display in the combo box.
|
|
7
7
|
*/
|
|
8
8
|
children?: ReactNode;
|
|
9
|
-
} & UseComboBoxNextProps<Item> &
|
|
9
|
+
} & UseComboBoxNextProps<Item> & PillInputProps;
|
|
10
10
|
export declare const ComboBoxNext: <Item = string>(props: {
|
|
11
11
|
/**
|
|
12
12
|
* The options to display in the combo box.
|
|
13
13
|
*/
|
|
14
14
|
children?: ReactNode;
|
|
15
|
-
} & import("../list-control/ListControlState").ListControlProps<Item> & Pick<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "defaultValue" | "value"> &
|
|
15
|
+
} & import("../list-control/ListControlState").ListControlProps<Item> & Pick<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "defaultValue" | "value"> & PillInputProps & {
|
|
16
16
|
ref?: Ref<HTMLDivElement> | undefined;
|
|
17
17
|
}) => JSX.Element;
|
package/dist-types/index.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export * from "./contact-details";
|
|
|
15
15
|
export * from "./content-status";
|
|
16
16
|
export * from "./deck-item";
|
|
17
17
|
export * from "./deck-layout";
|
|
18
|
-
export * from "./dialog";
|
|
19
18
|
export * from "./dropdown";
|
|
20
19
|
export * from "./dropdown-next";
|
|
21
20
|
export * from "./editable-label";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { SyntheticEvent, ComponentPropsWithoutRef, InputHTMLAttributes, ReactNode, Ref } from "react";
|
|
2
|
+
export interface PillInputProps extends Omit<ComponentPropsWithoutRef<"div">, "defaultValue">, Pick<ComponentPropsWithoutRef<"input">, "disabled" | "value" | "defaultValue" | "placeholder"> {
|
|
3
|
+
/**
|
|
4
|
+
* The marker to use in an empty read only Input.
|
|
5
|
+
* Use `''` to disable this feature. Defaults to '—'.
|
|
6
|
+
*/
|
|
7
|
+
emptyReadOnlyMarker?: string;
|
|
8
|
+
/**
|
|
9
|
+
* End adornment component
|
|
10
|
+
*/
|
|
11
|
+
endAdornment?: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
|
14
|
+
*/
|
|
15
|
+
inputProps?: InputHTMLAttributes<HTMLInputElement>;
|
|
16
|
+
/**
|
|
17
|
+
* Optional ref for the input component
|
|
18
|
+
*/
|
|
19
|
+
inputRef?: Ref<HTMLInputElement>;
|
|
20
|
+
/**
|
|
21
|
+
* If `true`, the component is read only.
|
|
22
|
+
*/
|
|
23
|
+
readOnly?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The tokens to display in the input.
|
|
26
|
+
*/
|
|
27
|
+
pills?: any[];
|
|
28
|
+
onPillRemove?: (event: SyntheticEvent, index: number) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Start adornment component
|
|
31
|
+
*/
|
|
32
|
+
startAdornment?: ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* Alignment of text within container. Defaults to "left"
|
|
35
|
+
*/
|
|
36
|
+
textAlign?: "left" | "center" | "right";
|
|
37
|
+
/**
|
|
38
|
+
* Validation status.
|
|
39
|
+
*/
|
|
40
|
+
validationStatus?: "error" | "warning" | "success";
|
|
41
|
+
/**
|
|
42
|
+
* Styling variant. Defaults to "primary".
|
|
43
|
+
*/
|
|
44
|
+
variant?: "primary" | "secondary";
|
|
45
|
+
hidePillClose?: boolean;
|
|
46
|
+
truncate?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export declare const PillInput: import("react").ForwardRefExoticComponent<PillInputProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./PillInput";
|
|
@@ -20,24 +20,24 @@ export declare type targetType = {
|
|
|
20
20
|
declare type Dimension = keyof Pick<DOMRect, "width" | "height">;
|
|
21
21
|
export declare const measureElementSizeAndPosition: (element: HTMLElement, dimension?: Dimension, includeAutoMargin?: boolean) => number[];
|
|
22
22
|
export declare const dimensions: (orientation: orientationType) => {
|
|
23
|
-
CLIENT_SIZE: "
|
|
23
|
+
CLIENT_SIZE: "scrollTop" | "scrollWidth" | "scrollHeight" | "clientHeight" | "clientWidth" | "scrollLeft";
|
|
24
24
|
CONTRA: "x" | "y" | "height" | "width" | "left" | "right" | "top" | "bottom";
|
|
25
25
|
CONTRA_POS: "clientX" | "clientY";
|
|
26
26
|
DIMENSION: "height" | "width";
|
|
27
27
|
END: "x" | "y" | "height" | "width" | "left" | "right" | "top" | "bottom";
|
|
28
28
|
POS: "clientX" | "clientY";
|
|
29
|
-
SCROLL_POS: "
|
|
30
|
-
SCROLL_SIZE: "
|
|
29
|
+
SCROLL_POS: "scrollTop" | "scrollWidth" | "scrollHeight" | "clientHeight" | "clientWidth" | "scrollLeft";
|
|
30
|
+
SCROLL_SIZE: "scrollTop" | "scrollWidth" | "scrollHeight" | "clientHeight" | "clientWidth" | "scrollLeft";
|
|
31
31
|
START: "x" | "y" | "height" | "width" | "left" | "right" | "top" | "bottom";
|
|
32
32
|
} | {
|
|
33
|
-
CLIENT_SIZE: "
|
|
33
|
+
CLIENT_SIZE: "scrollTop" | "scrollWidth" | "scrollHeight" | "clientHeight" | "clientWidth" | "scrollLeft";
|
|
34
34
|
CONTRA: "x" | "y" | "height" | "width" | "left" | "right" | "top" | "bottom";
|
|
35
35
|
CONTRA_POS: "clientX" | "clientY";
|
|
36
36
|
DIMENSION: "height" | "width";
|
|
37
37
|
END: "x" | "y" | "height" | "width" | "left" | "right" | "top" | "bottom";
|
|
38
38
|
POS: "clientX" | "clientY";
|
|
39
|
-
SCROLL_POS: "
|
|
40
|
-
SCROLL_SIZE: "
|
|
39
|
+
SCROLL_POS: "scrollTop" | "scrollWidth" | "scrollHeight" | "clientHeight" | "clientWidth" | "scrollLeft";
|
|
40
|
+
SCROLL_SIZE: "scrollTop" | "scrollWidth" | "scrollHeight" | "clientHeight" | "clientWidth" | "scrollLeft";
|
|
41
41
|
START: "x" | "y" | "height" | "width" | "left" | "right" | "top" | "bottom";
|
|
42
42
|
};
|
|
43
43
|
export declare const getDraggedItem: (measuredItems: MeasuredDropTarget[]) => MeasuredDropTarget;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salt-ds/lab",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.36",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"react-window": "^1.8.6",
|
|
27
27
|
"rifm": "^0.12.0",
|
|
28
28
|
"tinycolor2": "^1.4.2",
|
|
29
|
-
"@salt-ds/core": "^1.
|
|
29
|
+
"@salt-ds/core": "^1.20.0",
|
|
30
30
|
"@salt-ds/window": "^0.1.1",
|
|
31
31
|
"@salt-ds/styles": "^0.2.1",
|
|
32
32
|
"@salt-ds/icons": "^1.9.1"
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var css_248z = "/* Styles applied to Dialog component */\n.saltDialog {\n position: fixed;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n margin: auto;\n display: flex;\n flex-direction: column;\n padding-top: var(--salt-spacing-300);\n padding-bottom: var(--salt-spacing-300);\n background: var(--salt-container-primary-background);\n box-shadow: var(--salt-overlayable-shadow-modal);\n overflow-y: auto;\n z-index: var(--salt-zIndex-drawer);\n height: min-content;\n border: var(--salt-container-borderStyle) var(--salt-separable-tertiary-borderColor) var(--salt-size-border);\n box-sizing: border-box;\n border-radius: var(--salt-palette-corner, 0);\n}\n\n/* Styles applied to Dialog when a status=\"info\" */\n.saltDialog-info {\n border-color: var(--salt-status-info-borderColor);\n}\n\n/* Styles applied to Dialog when a status=\"error\" */\n.saltDialog-error {\n border-color: var(--salt-status-error-borderColor);\n}\n\n/* Styles applied to Dialog when a status=\"warning\" */\n.saltDialog-warning {\n border-color: var(--salt-status-warning-borderColor);\n}\n\n/* Styles applied to Dialog when a status=\"success\" */\n.saltDialog-success {\n border-color: var(--salt-status-success-borderColor);\n}\n\n/* Styles applied when the component mounts */\n.saltDialog.saltDialog-enterAnimation {\n animation: var(--salt-animation-fade-in-center);\n}\n\n/* Styles applied when the component unmounts */\n.saltDialog.saltDialog-exitAnimation {\n animation: var(--salt-animation-fade-out-back);\n}\n\n/* Pending design decision on heights and widths */\n.saltDialog-small-xs {\n width: 100%;\n max-height: 48%;\n}\n\n.saltDialog-small-sm {\n width: 56%;\n max-height: 48%;\n}\n\n.saltDialog-small-md {\n width: 36%;\n max-height: 48%;\n}\n\n.saltDialog-small-lg {\n width: 24%;\n max-height: 48%;\n}\n\n.saltDialog-small-xl {\n width: 24%;\n max-height: 48%;\n}\n\n.saltDialog-medium-xs {\n width: 100%;\n max-height: 72%;\n}\n\n.saltDialog-medium-sm {\n width: 84%;\n max-height: 72%;\n}\n\n.saltDialog-medium-md {\n width: 68%;\n max-height: 72%;\n}\n\n.saltDialog-medium-lg {\n width: 48%;\n max-height: 72%;\n}\n\n.saltDialog-medium-xl {\n width: 48%;\n max-height: 72%;\n}\n\n.saltDialog-large-xs {\n width: 100%;\n max-height: 84%;\n}\n\n.saltDialog-large-sm {\n width: 96%;\n max-height: 84%;\n}\n\n.saltDialog-large-md {\n width: 84%;\n max-height: 84%;\n}\n\n.saltDialog-large-lg {\n width: 72%;\n max-height: 84%;\n}\n\n.saltDialog-large-xl {\n width: 72%;\n max-height: 84%;\n}\n";
|
|
4
|
-
|
|
5
|
-
module.exports = css_248z;
|
|
6
|
-
//# sourceMappingURL=Dialog.css.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var React = require('react');
|
|
7
|
-
var clsx = require('clsx');
|
|
8
|
-
var react = require('@floating-ui/react');
|
|
9
|
-
var core = require('@salt-ds/core');
|
|
10
|
-
var window = require('@salt-ds/window');
|
|
11
|
-
var styles = require('@salt-ds/styles');
|
|
12
|
-
var Dialog$1 = require('./Dialog.css.js');
|
|
13
|
-
var DialogContext = require('./DialogContext.js');
|
|
14
|
-
|
|
15
|
-
const ConditionalScrimWrapper = ({
|
|
16
|
-
condition,
|
|
17
|
-
children
|
|
18
|
-
}) => {
|
|
19
|
-
return condition ? /* @__PURE__ */ jsxRuntime.jsx(core.Scrim, {
|
|
20
|
-
fixed: true,
|
|
21
|
-
children
|
|
22
|
-
}) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
23
|
-
children: [
|
|
24
|
-
children,
|
|
25
|
-
" "
|
|
26
|
-
]
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
const withBaseName = core.makePrefixer("saltDialog");
|
|
30
|
-
const Dialog = React.forwardRef(function Dialog2(props, ref) {
|
|
31
|
-
var _a, _b;
|
|
32
|
-
const {
|
|
33
|
-
children,
|
|
34
|
-
className,
|
|
35
|
-
open = false,
|
|
36
|
-
onOpenChange,
|
|
37
|
-
status,
|
|
38
|
-
disableDismiss,
|
|
39
|
-
size = "medium",
|
|
40
|
-
disableScrim,
|
|
41
|
-
idProp,
|
|
42
|
-
...rest
|
|
43
|
-
} = props;
|
|
44
|
-
const targetWindow = window.useWindow();
|
|
45
|
-
styles.useComponentCssInjection({
|
|
46
|
-
testId: "salt-dialog",
|
|
47
|
-
css: Dialog$1,
|
|
48
|
-
window: targetWindow
|
|
49
|
-
});
|
|
50
|
-
const id = core.useId(idProp);
|
|
51
|
-
const currentbreakpoint = core.useCurrentBreakpoint();
|
|
52
|
-
const [showComponent, setShowComponent] = React.useState(false);
|
|
53
|
-
const { context, floating, elements } = core.useFloatingUI({
|
|
54
|
-
open,
|
|
55
|
-
onOpenChange
|
|
56
|
-
});
|
|
57
|
-
const { getFloatingProps } = react.useInteractions([
|
|
58
|
-
react.useClick(context),
|
|
59
|
-
react.useDismiss(context, { enabled: !disableDismiss })
|
|
60
|
-
]);
|
|
61
|
-
const { Component: FloatingComponent } = core.useFloatingComponent();
|
|
62
|
-
const floatingRef = core.useForkRef(floating, ref);
|
|
63
|
-
React.useEffect(() => {
|
|
64
|
-
if (open && !showComponent) {
|
|
65
|
-
setShowComponent(true);
|
|
66
|
-
}
|
|
67
|
-
if (!open && showComponent) {
|
|
68
|
-
const animate = setTimeout(() => {
|
|
69
|
-
setShowComponent(false);
|
|
70
|
-
}, 300);
|
|
71
|
-
return () => clearTimeout(animate);
|
|
72
|
-
}
|
|
73
|
-
}, [open, showComponent, setShowComponent]);
|
|
74
|
-
const contextValue = React.useMemo(() => ({ status, id }), [status, id]);
|
|
75
|
-
return /* @__PURE__ */ jsxRuntime.jsx(DialogContext.DialogContext.Provider, {
|
|
76
|
-
value: contextValue,
|
|
77
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ConditionalScrimWrapper, {
|
|
78
|
-
condition: open && !disableScrim,
|
|
79
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(FloatingComponent, {
|
|
80
|
-
open: showComponent,
|
|
81
|
-
role: "dialog",
|
|
82
|
-
"aria-modal": "true",
|
|
83
|
-
"aria-labelledby": id,
|
|
84
|
-
ref: floatingRef,
|
|
85
|
-
width: (_a = elements.floating) == null ? void 0 : _a.offsetWidth,
|
|
86
|
-
height: (_b = elements.floating) == null ? void 0 : _b.offsetHeight,
|
|
87
|
-
focusManagerProps: {
|
|
88
|
-
context
|
|
89
|
-
},
|
|
90
|
-
className: clsx.clsx(
|
|
91
|
-
withBaseName(),
|
|
92
|
-
withBaseName(size, currentbreakpoint),
|
|
93
|
-
{
|
|
94
|
-
[withBaseName("enterAnimation")]: open,
|
|
95
|
-
[withBaseName("exitAnimation")]: !open,
|
|
96
|
-
[withBaseName(status)]: status
|
|
97
|
-
},
|
|
98
|
-
className
|
|
99
|
-
),
|
|
100
|
-
onAnimationEnd: () => {
|
|
101
|
-
if (!open && showComponent) {
|
|
102
|
-
setShowComponent(false);
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
...getFloatingProps(),
|
|
106
|
-
...rest,
|
|
107
|
-
children
|
|
108
|
-
})
|
|
109
|
-
})
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
exports.ConditionalScrimWrapper = ConditionalScrimWrapper;
|
|
114
|
-
exports.Dialog = Dialog;
|
|
115
|
-
//# sourceMappingURL=Dialog.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","sources":["../src/dialog/Dialog.tsx"],"sourcesContent":["import {\n forwardRef,\n HTMLAttributes,\n useEffect,\n useMemo,\n useState,\n ComponentProps,\n ReactNode,\n} from \"react\";\nimport { clsx } from \"clsx\";\nimport {\n FloatingFocusManager,\n useClick,\n useDismiss,\n useInteractions,\n} from \"@floating-ui/react\";\nimport {\n makePrefixer,\n useFloatingComponent,\n useFloatingUI,\n useCurrentBreakpoint,\n useForkRef,\n ValidationStatus,\n Scrim,\n useId,\n} from \"@salt-ds/core\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport dialogCss from \"./Dialog.css\";\nimport { DialogContext } from \"./DialogContext\";\n\ninterface ConditionalScrimWrapperProps {\n children?: ReactNode;\n condition: boolean;\n}\n\nexport const ConditionalScrimWrapper = ({\n condition,\n children,\n}: ConditionalScrimWrapperProps) => {\n return condition ? <Scrim fixed>{children}</Scrim> : <>{children} </>;\n};\n\nexport interface DialogProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Display or hide the component.\n */\n open?: boolean;\n /**\n * Callback function triggered when open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * The status of the Dialog\n * */\n status?: ValidationStatus;\n /**\n * Which element to initially focus. Can be either a number (tabbable index as specified by the order) or a ref.\n * Default value is 0 (first tabbable element).\n * */\n initialFocus?: ComponentProps<typeof FloatingFocusManager>[\"initialFocus\"];\n /**\n * Size of the Dialog\n * */\n size?: \"small\" | \"medium\" | \"large\";\n /**\n * Prevent the dialog closing on click away\n * */\n disableDismiss?: boolean;\n /**\n * Prevent Scrim from rendering\n * */\n disableScrim?: boolean;\n /**\n * Optional id prop\n * Used for accessibility purposes to announce the title and subtitle when using a screen reader\n * */\n idProp?: string;\n}\n\nconst withBaseName = makePrefixer(\"saltDialog\");\n\nexport const Dialog = forwardRef<HTMLDivElement, DialogProps>(function Dialog(\n props,\n ref\n) {\n const {\n children,\n className,\n open = false,\n onOpenChange,\n status,\n disableDismiss,\n size = \"medium\",\n disableScrim,\n idProp,\n ...rest\n } = props;\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-dialog\",\n css: dialogCss,\n window: targetWindow,\n });\n\n const id = useId(idProp);\n\n const currentbreakpoint = useCurrentBreakpoint();\n\n const [showComponent, setShowComponent] = useState(false);\n\n const { context, floating, elements } = useFloatingUI({\n open,\n onOpenChange,\n });\n\n const { getFloatingProps } = useInteractions([\n useClick(context),\n useDismiss(context, { enabled: !disableDismiss }),\n ]);\n\n const { Component: FloatingComponent } = useFloatingComponent();\n\n const floatingRef = useForkRef<HTMLDivElement>(floating, ref);\n\n useEffect(() => {\n if (open && !showComponent) {\n setShowComponent(true);\n }\n\n if (!open && showComponent) {\n const animate = setTimeout(() => {\n setShowComponent(false);\n }, 300); // var(--salt-duration-perceptible)\n return () => clearTimeout(animate);\n }\n }, [open, showComponent, setShowComponent]);\n\n const contextValue = useMemo(() => ({ status, id }), [status, id]);\n\n return (\n <DialogContext.Provider value={contextValue}>\n <ConditionalScrimWrapper condition={open && !disableScrim}>\n <FloatingComponent\n open={showComponent}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={id}\n ref={floatingRef}\n width={elements.floating?.offsetWidth}\n height={elements.floating?.offsetHeight}\n focusManagerProps={{\n context: context,\n }}\n className={clsx(\n withBaseName(),\n withBaseName(size, currentbreakpoint),\n {\n [withBaseName(\"enterAnimation\")]: open,\n [withBaseName(\"exitAnimation\")]: !open,\n [withBaseName(status as string)]: status,\n },\n className\n )}\n onAnimationEnd={() => {\n if (!open && showComponent) {\n setShowComponent(false);\n }\n }}\n {...getFloatingProps()}\n {...rest}\n >\n {children}\n </FloatingComponent>\n </ConditionalScrimWrapper>\n </DialogContext.Provider>\n );\n});\n"],"names":["jsx","Scrim","jsxs","Fragment","makePrefixer","forwardRef","Dialog","useWindow","useComponentCssInjection","dialogCss","useId","useCurrentBreakpoint","useState","useFloatingUI","useInteractions","useClick","useDismiss","useFloatingComponent","useForkRef","useEffect","useMemo","DialogContext","clsx"],"mappings":";;;;;;;;;;;;;;AAoCO,MAAM,0BAA0B,CAAC;AAAA,EACtC,SAAA;AAAA,EACA,QAAA;AACF,CAAoC,KAAA;AAClC,EAAA,OAAO,4BAAaA,cAAA,CAAAC,UAAA,EAAA;AAAA,IAAM,KAAK,EAAA,IAAA;AAAA,IAAE,QAAA;AAAA,GAAS,CAAW,mBAAAC,eAAA,CAAAC,mBAAA,EAAA;AAAA,IAAG,QAAA,EAAA;AAAA,MAAA,QAAA;AAAA,MAAS,GAAA;AAAA,KAAA;AAAA,GAAC,CAAA,CAAA;AACpE,EAAA;AAuCA,MAAM,YAAA,GAAeC,kBAAa,YAAY,CAAA,CAAA;AAEvC,M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,SAAA;AAAA,UACT,YAAa,EAAA;AAAA,UACb,YAAA,CAAa,MAAM,iBAAiB,CAAA;AAAA,UACpC;AAAA,YACE,CAAC,YAAa,CAAA,gBAAgB,CAAI,GAAA,IAAA;AAAA,YAClC,CAAC,YAAA,CAAa,eAAe,CAAA,GAAI,CAAC,IAAA;AAAA,YAClC,CAAC,YAAa,CAAA,MAAgB,CAAI,GAAA,MAAA;AAAA,WACpC;AAAA,UACA,SAAA;AAAA,SACF;AAAA,QACA,gBAAgB,MAAM;AACpB,UAAI,IAAA,CAAC,QAAQ,aAAe,EAAA;AAC1B,YAAA,gBAAA,CAAiB,KAAK,CAAA,CAAA;AAAA,WACxB;AAAA,SACF;AAAA,QACC,GAAG,gBAAiB,EAAA;AAAA,QACpB,GAAG,IAAA;AAAA,QAEH,QAAA;AAAA,OACH,CAAA;AAAA,KACF,CAAA;AAAA,GACF,CAAA,CAAA;AAEJ,CAAC;;;;;"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var css_248z = ".saltDialogActions {\n padding: var(--salt-spacing-300);\n padding-bottom: 0;\n display: flex;\n justify-content: flex-end;\n gap: var(--salt-spacing-100);\n}\n";
|
|
4
|
-
|
|
5
|
-
module.exports = css_248z;
|
|
6
|
-
//# sourceMappingURL=DialogActions.css.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DialogActions.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var React = require('react');
|
|
7
|
-
var clsx = require('clsx');
|
|
8
|
-
var core = require('@salt-ds/core');
|
|
9
|
-
var window = require('@salt-ds/window');
|
|
10
|
-
var styles = require('@salt-ds/styles');
|
|
11
|
-
var DialogActions$1 = require('./DialogActions.css.js');
|
|
12
|
-
|
|
13
|
-
const withBaseName = core.makePrefixer("saltDialogActions");
|
|
14
|
-
const DialogActions = React.forwardRef(
|
|
15
|
-
function DialogActions2(props, ref) {
|
|
16
|
-
const { children, className, ...rest } = props;
|
|
17
|
-
const targetWindow = window.useWindow();
|
|
18
|
-
styles.useComponentCssInjection({
|
|
19
|
-
testId: "salt-dialog-actions",
|
|
20
|
-
css: DialogActions$1,
|
|
21
|
-
window: targetWindow
|
|
22
|
-
});
|
|
23
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
24
|
-
className: clsx.clsx(withBaseName(), className),
|
|
25
|
-
...rest,
|
|
26
|
-
ref,
|
|
27
|
-
children
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
exports.DialogActions = DialogActions;
|
|
33
|
-
//# sourceMappingURL=DialogActions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DialogActions.js","sources":["../src/dialog/DialogActions.tsx"],"sourcesContent":["import { forwardRef, HTMLAttributes, ReactNode } from \"react\";\nimport { clsx } from \"clsx\";\nimport { makePrefixer } from \"@salt-ds/core\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nimport dialogActionsCss from \"./DialogActions.css\";\n\nconst withBaseName = makePrefixer(\"saltDialogActions\");\n\nexport interface DialogActionsProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * The content of Dialog Actions\n */\n children?: ReactNode;\n}\n\nexport const DialogActions = forwardRef<HTMLDivElement, DialogActionsProps>(\n function DialogActions(props, ref) {\n const { children, className, ...rest } = props;\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-dialog-actions\",\n css: dialogActionsCss,\n window: targetWindow,\n });\n\n return (\n <div className={clsx(withBaseName(), className)} {...rest} ref={ref}>\n {children}\n </div>\n );\n }\n);\n"],"names":["makePrefixer","forwardRef","DialogActions","useWindow","useComponentCssInjection","dialogActionsCss","jsx","clsx"],"mappings":";;;;;;;;;;;;AAQA,MAAM,YAAA,GAAeA,kBAAa,mBAAmB,CAAA,CAAA;AAS9C,MAAM,aAAgB,GAAAC,gBAAA;AAAA,EAC3B,SAASC,cAAc,CAAA,KAAA,EAAO,GAAK,EAAA;AACjC,IAAA,MAAM,EAAE,QAAA,EAAU,SAAc,EAAA,GAAA,IAAA,EAAS,GAAA,KAAA,CAAA;AACzC,IAAA,MAAM,eAAeC,gBAAU,EAAA,CAAA;AAC/B,IAAyBC,+BAAA,CAAA;AAAA,MACvB,MAAQ,EAAA,qBAAA;AAAA,MACR,GAAK,EAAAC,eAAA;AAAA,MACL,MAAQ,EAAA,YAAA;AAAA,KACT,CAAA,CAAA;AAED,IAAA,uBACGC,cAAA,CAAA,KAAA,EAAA;AAAA,MAAI,SAAW,EAAAC,SAAA,CAAK,YAAa,EAAA,EAAG,SAAS,CAAA;AAAA,MAAI,GAAG,IAAA;AAAA,MAAM,GAAA;AAAA,MACxD,QAAA;AAAA,KACH,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DialogCloseButton.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var React = require('react');
|
|
7
|
-
var clsx = require('clsx');
|
|
8
|
-
var core = require('@salt-ds/core');
|
|
9
|
-
var window = require('@salt-ds/window');
|
|
10
|
-
var styles = require('@salt-ds/styles');
|
|
11
|
-
var icons = require('@salt-ds/icons');
|
|
12
|
-
var DialogCloseButton$1 = require('./DialogCloseButton.css.js');
|
|
13
|
-
|
|
14
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
|
-
|
|
16
|
-
var clsx__default = /*#__PURE__*/_interopDefaultLegacy(clsx);
|
|
17
|
-
|
|
18
|
-
const withBaseName = core.makePrefixer("saltDialogCloseButton");
|
|
19
|
-
const DialogCloseButton = React.forwardRef(
|
|
20
|
-
function DialogCloseButton2({ className, ...rest }, ref) {
|
|
21
|
-
const targetWindow = window.useWindow();
|
|
22
|
-
styles.useComponentCssInjection({
|
|
23
|
-
testId: "salt-dialog-close-button",
|
|
24
|
-
css: DialogCloseButton$1,
|
|
25
|
-
window: targetWindow
|
|
26
|
-
});
|
|
27
|
-
return /* @__PURE__ */ jsxRuntime.jsx(core.Button, {
|
|
28
|
-
ref,
|
|
29
|
-
"aria-label": "Close dialog",
|
|
30
|
-
variant: "secondary",
|
|
31
|
-
className: clsx__default["default"](withBaseName(), className),
|
|
32
|
-
...rest,
|
|
33
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseIcon, {})
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
exports.DialogCloseButton = DialogCloseButton;
|
|
39
|
-
//# sourceMappingURL=DialogCloseButton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DialogCloseButton.js","sources":["../src/dialog/DialogCloseButton.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport clsx from \"clsx\";\nimport { Button, ButtonProps, makePrefixer } from \"@salt-ds/core\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { CloseIcon } from \"@salt-ds/icons\";\n\nimport dialogCloseButtonCss from \"./DialogCloseButton.css\";\n\nconst withBaseName = makePrefixer(\"saltDialogCloseButton\");\n\nexport const DialogCloseButton = forwardRef<HTMLButtonElement, ButtonProps>(\n function DialogCloseButton({ className, ...rest }, ref) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-dialog-close-button\",\n css: dialogCloseButtonCss,\n window: targetWindow,\n });\n\n return (\n <Button\n ref={ref}\n aria-label=\"Close dialog\"\n variant=\"secondary\"\n className={clsx(withBaseName(), className)}\n {...rest}\n >\n <CloseIcon />\n </Button>\n );\n }\n);\n"],"names":["makePrefixer","forwardRef","DialogCloseButton","useWindow","useComponentCssInjection","dialogCloseButtonCss","jsx","Button","clsx","CloseIcon"],"mappings":";;;;;;;;;;;;;;;;;AASA,MAAM,YAAA,GAAeA,kBAAa,uBAAuB,CAAA,CAAA;AAElD,MAAM,iBAAoB,GAAAC,gBAAA;AAAA,EAC/B,SAASC,kBAAkB,CAAA,EAAE,SAAc,EAAA,GAAA,IAAA,IAAQ,GAAK,EAAA;AACtD,IAAA,MAAM,eAAeC,gBAAU,EAAA,CAAA;AAC/B,IAAyBC,+BAAA,CAAA;AAAA,MACvB,MAAQ,EAAA,0BAAA;AAAA,MACR,GAAK,EAAAC,mBAAA;AAAA,MACL,MAAQ,EAAA,YAAA;AAAA,KACT,CAAA,CAAA;AAED,IAAA,uBACGC,cAAA,CAAAC,WAAA,EAAA;AAAA,MACC,GAAA;AAAA,MACA,YAAW,EAAA,cAAA;AAAA,MACX,OAAQ,EAAA,WAAA;AAAA,MACR,SAAW,EAAAC,wBAAA,CAAK,YAAa,EAAA,EAAG,SAAS,CAAA;AAAA,MACxC,GAAG,IAAA;AAAA,MAEJ,yCAACC,eAAU,EAAA,EAAA,CAAA;AAAA,KACb,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var css_248z = ".saltDialogContent {\n color: var(--salt-content-primary-foreground);\n min-height: var(--salt-text-lineHeight);\n overflow-y: auto;\n background: var(--salt-container-primary-background);\n padding-bottom: var(--salt-spacing-50);\n\n margin-left: var(--salt-spacing-200);\n margin-right: var(--salt-spacing-300);\n padding-right: var(--salt-spacing-300);\n padding-left: var(--salt-spacing-100);\n border-bottom: var(--salt-size-border) var(--salt-separable-borderStyle) transparent;\n box-shadow: none;\n}\n\n.saltDialogContent-scroll {\n border-bottom: var(--salt-size-border) var(--salt-separable-borderStyle) var(--salt-separable-tertiary-borderColor);\n box-shadow: var(--salt-overlayable-shadow-scroll);\n}\n";
|
|
4
|
-
|
|
5
|
-
module.exports = css_248z;
|
|
6
|
-
//# sourceMappingURL=DialogContent.css.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DialogContent.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var React = require('react');
|
|
7
|
-
var clsx = require('clsx');
|
|
8
|
-
var core = require('@salt-ds/core');
|
|
9
|
-
var window = require('@salt-ds/window');
|
|
10
|
-
var styles = require('@salt-ds/styles');
|
|
11
|
-
var DialogContent$1 = require('./DialogContent.css.js');
|
|
12
|
-
|
|
13
|
-
const withBaseName = core.makePrefixer("saltDialogContent");
|
|
14
|
-
const DialogContent = React.forwardRef(
|
|
15
|
-
function DialogContent2(props, ref) {
|
|
16
|
-
const { children, className, ...rest } = props;
|
|
17
|
-
const [scrollTop, setScrollTop] = React.useState(0);
|
|
18
|
-
const handleScroll = (event) => {
|
|
19
|
-
setScrollTop(event.currentTarget.scrollTop);
|
|
20
|
-
};
|
|
21
|
-
const targetWindow = window.useWindow();
|
|
22
|
-
styles.useComponentCssInjection({
|
|
23
|
-
testId: "salt-dialog-content",
|
|
24
|
-
css: DialogContent$1,
|
|
25
|
-
window: targetWindow
|
|
26
|
-
});
|
|
27
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
28
|
-
children: [
|
|
29
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
30
|
-
className: clsx.clsx({ [withBaseName("scroll")]: scrollTop > 0 })
|
|
31
|
-
}),
|
|
32
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
33
|
-
className: clsx.clsx(withBaseName(), className),
|
|
34
|
-
onScroll: handleScroll,
|
|
35
|
-
...rest,
|
|
36
|
-
ref,
|
|
37
|
-
children
|
|
38
|
-
})
|
|
39
|
-
]
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
exports.DialogContent = DialogContent;
|
|
45
|
-
//# sourceMappingURL=DialogContent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DialogContent.js","sources":["../src/dialog/DialogContent.tsx"],"sourcesContent":["import { forwardRef, HTMLAttributes, ReactNode, useState } from \"react\";\nimport { clsx } from \"clsx\";\nimport { makePrefixer } from \"@salt-ds/core\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nimport dialogContentCss from \"./DialogContent.css\";\n\nconst withBaseName = makePrefixer(\"saltDialogContent\");\n\nexport interface DialogContentProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * The content of Dialog Content\n */\n children?: ReactNode;\n}\n\nexport const DialogContent = forwardRef<HTMLDivElement, DialogContentProps>(\n function DialogContent(props, ref) {\n const { children, className, ...rest } = props;\n const [scrollTop, setScrollTop] = useState(0);\n\n const handleScroll = (event: React.UIEvent<HTMLElement>) => {\n setScrollTop(event.currentTarget.scrollTop);\n };\n\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-dialog-content\",\n css: dialogContentCss,\n window: targetWindow,\n });\n\n return (\n <>\n <div className={clsx({ [withBaseName(\"scroll\")]: scrollTop > 0 })} />\n <div\n className={clsx(withBaseName(), className)}\n onScroll={handleScroll}\n {...rest}\n ref={ref}\n >\n {children}\n </div>\n </>\n );\n }\n);\n"],"names":["makePrefixer","forwardRef","DialogContent","useState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ict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var React = require('react');
|
|
6
|
-
|
|
7
|
-
const DialogContext = React.createContext({
|
|
8
|
-
status: void 0,
|
|
9
|
-
id: ""
|
|
10
|
-
});
|
|
11
|
-
const useDialogContext = () => {
|
|
12
|
-
return React.useContext(DialogContext);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
exports.DialogContext = DialogContext;
|
|
16
|
-
exports.useDialogContext = useDialogContext;
|
|
17
|
-
//# sourceMappingURL=DialogContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DialogContext.js","sources":["../src/dialog/DialogContext.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport { ValidationStatus } from \"@salt-ds/core\";\n\nexport const DialogContext = createContext<{\n status?: ValidationStatus;\n id: string | undefined;\n}>({\n status: undefined,\n id: \"\",\n});\n\nexport const useDialogContext = () => {\n return useContext(DialogContext);\n};\n"],"names":["createContext","useContext"],"mappings":";;;;;;AAGO,MAAM,gBAAgBA,mBAG1B,CAAA;AAAA,EACD,MAAQ,EAAA,KAAA,CAAA;AAAA,EACR,EAAI,EAAA,EAAA;AACN,CAAC,EAAA;AAEM,MAAM,mBAAmB,MAAM;AACpC,EAAA,OAAOC,iBAAW,aAAa,CAAA,CAAA;AACjC;;;;;"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var css_248z = "/* Styles applied to the root element */\n.saltDialogHeader {\n padding-bottom: var(--salt-spacing-100);\n padding-left: var(--salt-spacing-300);\n padding-right: var(--salt-spacing-300);\n align-items: center;\n display: flex;\n flex-direction: row;\n gap: var(--salt-spacing-100);\n box-sizing: border-box;\n}\n\n.saltDialogHeader-header {\n margin: 0;\n}\n\n/* Styles applied to the status indicator icon overriding its default size */\n.saltDialogHeader .saltStatusIndicator.saltIcon {\n --icon-size: var(--salt-text-h2-lineHeight);\n}\n\n/* Styles applied to DialogTitle when accent={true} */\n.saltDialogHeader-withAccent {\n position: relative;\n}\n\n.saltDialogHeader-withAccent::before {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n bottom: var(--salt-spacing-100);\n width: var(--salt-size-accent);\n background: var(--salt-accent-background);\n}\n\n.saltDialogHeader-error::before {\n background: var(--salt-status-error-borderColor);\n}\n\n.saltDialogHeader-info::before {\n background: var(--salt-status-info-borderColor);\n}\n\n.saltDialogHeader-success::before {\n background: var(--salt-status-success-borderColor);\n}\n\n.saltDialogHeader-warning::before {\n background: var(--salt-status-warning-borderColor);\n}\n";
|
|
4
|
-
|
|
5
|
-
module.exports = css_248z;
|
|
6
|
-
//# sourceMappingURL=DialogHeader.css.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DialogHeader.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|