@box/blueprint-web 12.96.0 → 12.98.0
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/lib-esm/breadcrumb/breadcrumb.js +26 -6
- package/dist/lib-esm/index.css +579 -518
- package/dist/lib-esm/modal/constants.d.ts +1 -0
- package/dist/lib-esm/modal/constants.js +3 -0
- package/dist/lib-esm/modal/index.d.ts +1 -1
- package/dist/lib-esm/modal/modal-loading.d.ts +2 -0
- package/dist/lib-esm/modal/modal-loading.js +63 -0
- package/dist/lib-esm/modal/modal.d.ts +1 -0
- package/dist/lib-esm/modal/modal.js +2 -0
- package/dist/lib-esm/modal/modal.module.js +1 -1
- package/dist/lib-esm/modal/types.d.ts +8 -0
- package/dist/lib-esm/text/text.module.js +1 -1
- package/dist/lib-esm/text/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MODAL_LOADING_ANIMATION_DURATION = 200;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Modal } from './modal';
|
|
2
|
-
export {
|
|
2
|
+
export type { ModalCloseProps, ModalContentProps, ModalLoadingProps, ModalProps, ModalTriggerProps } from './types';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useState, useEffect } from 'react';
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
|
+
import { LoadingIndicator } from '../loading-indicator/loading-indicator.js';
|
|
5
|
+
import { MODAL_LOADING_ANIMATION_DURATION } from './constants.js';
|
|
6
|
+
import styles from './modal.module.js';
|
|
7
|
+
|
|
8
|
+
var LoadingState;
|
|
9
|
+
(function (LoadingState) {
|
|
10
|
+
LoadingState["Loading"] = "loading";
|
|
11
|
+
LoadingState["Animating"] = "animating";
|
|
12
|
+
LoadingState["ShowingContent"] = "showing_content";
|
|
13
|
+
})(LoadingState || (LoadingState = {}));
|
|
14
|
+
const ModalLoading = /*#__PURE__*/forwardRef(({
|
|
15
|
+
className,
|
|
16
|
+
loadingIndicatorAriaLabel,
|
|
17
|
+
isLoading,
|
|
18
|
+
children,
|
|
19
|
+
...rest
|
|
20
|
+
}, forwardedRef) => {
|
|
21
|
+
const [loadingState, setLoadingState] = useState(isLoading ? LoadingState.Loading : LoadingState.ShowingContent);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (isLoading) {
|
|
24
|
+
// Hide content when loading
|
|
25
|
+
setLoadingState(LoadingState.Loading);
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
// Start animating when loading completes
|
|
29
|
+
setLoadingState(LoadingState.Animating);
|
|
30
|
+
// Show content after modal resize completes
|
|
31
|
+
const showTimer = setTimeout(() => {
|
|
32
|
+
setLoadingState(LoadingState.ShowingContent);
|
|
33
|
+
}, MODAL_LOADING_ANIMATION_DURATION); // Duration of modal resize animation
|
|
34
|
+
return () => {
|
|
35
|
+
clearTimeout(showTimer);
|
|
36
|
+
};
|
|
37
|
+
}, [isLoading]);
|
|
38
|
+
const shouldShowLoading = loadingState === LoadingState.Loading;
|
|
39
|
+
const shouldShowContent = loadingState === LoadingState.ShowingContent;
|
|
40
|
+
return jsxs("div", {
|
|
41
|
+
className: clsx(styles.loadingContainer, {
|
|
42
|
+
[styles.loadingContainerActive]: shouldShowLoading
|
|
43
|
+
}),
|
|
44
|
+
children: [jsx("div", {
|
|
45
|
+
"aria-hidden": !shouldShowContent,
|
|
46
|
+
className: clsx(styles.loadingContent, {
|
|
47
|
+
[styles.loadingContentVisible]: shouldShowContent
|
|
48
|
+
}),
|
|
49
|
+
children: children
|
|
50
|
+
}), shouldShowLoading && jsx("div", {
|
|
51
|
+
...rest,
|
|
52
|
+
ref: forwardedRef,
|
|
53
|
+
className: clsx(className, styles.loading, styles.loadingOverlay),
|
|
54
|
+
children: jsx(LoadingIndicator, {
|
|
55
|
+
"aria-label": loadingIndicatorAriaLabel,
|
|
56
|
+
size: "large"
|
|
57
|
+
})
|
|
58
|
+
})]
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
ModalLoading.displayName = 'ModalLoading';
|
|
62
|
+
|
|
63
|
+
export { ModalLoading };
|
|
@@ -47,6 +47,7 @@ export declare const Modal: (({ children, modal, ...props }: ModalProps) => impo
|
|
|
47
47
|
}, "ref">) & import("react").RefAttributes<HTMLButtonElement>>;
|
|
48
48
|
};
|
|
49
49
|
Header: import("react").ForwardRefExoticComponent<import("./types").ModalHeaderProps & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
50
|
+
Loading: import("react").ForwardRefExoticComponent<import("./types").ModalLoadingProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
50
51
|
ScrollableContainer: import("react").ForwardRefExoticComponent<import("./types").ModalScrollableContainerProps & {
|
|
51
52
|
'data-testid'?: string;
|
|
52
53
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -6,6 +6,7 @@ import { ModalClose } from './modal-close.js';
|
|
|
6
6
|
import { ModalContent } from './modal-content.js';
|
|
7
7
|
import { ModalFooter } from './modal-footer.js';
|
|
8
8
|
import { ModalHeader } from './modal-header.js';
|
|
9
|
+
import { ModalLoading } from './modal-loading.js';
|
|
9
10
|
import { ModalScrollableContainer } from './modal-scrollable-container.js';
|
|
10
11
|
import { ModalTitle } from './modal-title.js';
|
|
11
12
|
import { ModalTrigger } from './modal-trigger.js';
|
|
@@ -50,6 +51,7 @@ const Modal = Object.assign(Root, {
|
|
|
50
51
|
Content: ModalContent,
|
|
51
52
|
Footer: ModalFooter,
|
|
52
53
|
Header: ModalHeader,
|
|
54
|
+
Loading: ModalLoading,
|
|
53
55
|
ScrollableContainer: ModalScrollableContainer,
|
|
54
56
|
Trigger: ModalTrigger,
|
|
55
57
|
Title: ModalTitle
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '../index.css';
|
|
2
|
-
var styles = {"overlay":"bp_modal_module_overlay--
|
|
2
|
+
var styles = {"overlay":"bp_modal_module_overlay--1e234","headerDividerLine":"bp_modal_module_headerDividerLine--1e234","footerDividerLine":"bp_modal_module_footerDividerLine--1e234","content":"bp_modal_module_content--1e234","popup_bounce_in":"bp_modal_module_popup_bounce_in--1e234","smallSizeModal":"bp_modal_module_smallSizeModal--1e234","mediumSizeModal":"bp_modal_module_mediumSizeModal--1e234","largeSizeModal":"bp_modal_module_largeSizeModal--1e234","xlargeSizeModal":"bp_modal_module_xlargeSizeModal--1e234","loadingContainerActive":"bp_modal_module_loadingContainerActive--1e234","scrollableContainer":"bp_modal_module_scrollableContainer--1e234","close":"bp_modal_module_close--1e234","onColor":"bp_modal_module_onColor--1e234","backButton":"bp_modal_module_backButton--1e234","modalHeader":"bp_modal_module_modalHeader--1e234","modalTitle":"bp_modal_module_modalTitle--1e234","body":"bp_modal_module_body--1e234","footer":"bp_modal_module_footer--1e234","footerButton":"bp_modal_module_footerButton--1e234","loadingContainer":"bp_modal_module_loadingContainer--1e234","loading":"bp_modal_module_loading--1e234","loadingOverlay":"bp_modal_module_loadingOverlay--1e234","loadingContent":"bp_modal_module_loadingContent--1e234","loadingContentVisible":"bp_modal_module_loadingContentVisible--1e234"};
|
|
3
3
|
|
|
4
4
|
export { styles as default };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type DialogContentProps, type DialogPortalProps, type DialogProps, type DialogTitleProps } from '@radix-ui/react-dialog';
|
|
2
2
|
import { type FunctionComponent, type HTMLAttributes, type PropsWithChildren, type ReactElement, type ReactNode, type SVGProps } from 'react';
|
|
3
|
+
import { type LoadingIndicatorProps } from '../loading-indicator/loading-indicator';
|
|
3
4
|
import { type IconButtonProps } from '../primitives/icon-button';
|
|
4
5
|
export type ModalProps = DialogProps;
|
|
5
6
|
/** The size of the modal content.
|
|
@@ -56,3 +57,10 @@ export interface ModalHeaderProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
|
56
57
|
/** Content of the Subttitle element */
|
|
57
58
|
subtitle?: ReactNode;
|
|
58
59
|
}
|
|
60
|
+
export interface ModalLoadingProps extends HTMLAttributes<HTMLDivElement> {
|
|
61
|
+
loadingIndicatorAriaLabel: LoadingIndicatorProps['aria-label'];
|
|
62
|
+
/** When false, fades out loading indicator and reveals children. Defaults to true. */
|
|
63
|
+
isLoading: boolean;
|
|
64
|
+
/** Content to render underneath the loading indicator. The modal will size to this content. */
|
|
65
|
+
children: ReactNode;
|
|
66
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '../index.css';
|
|
2
|
-
var styles = {"textReset":"bp_text_module_textReset--
|
|
2
|
+
var styles = {"textReset":"bp_text_module_textReset--d93f2","breakWord":"bp_text_module_breakWord--d93f2","textOnLightDefault":"bp_text_module_textOnLightDefault--d93f2","textOnLightSecondary":"bp_text_module_textOnLightSecondary--d93f2","textOnLightLink":"bp_text_module_textOnLightLink--d93f2","textOnLightError":"bp_text_module_textOnLightError--d93f2","textOnDarkDefault":"bp_text_module_textOnDarkDefault--d93f2","titleMondo":"bp_text_module_titleMondo--d93f2","titleXLarge":"bp_text_module_titleXLarge--d93f2","titleLarge":"bp_text_module_titleLarge--d93f2","titleMedium":"bp_text_module_titleMedium--d93f2","titleSmall":"bp_text_module_titleSmall--d93f2","subtitle":"bp_text_module_subtitle--d93f2","bodyLargeBold":"bp_text_module_bodyLargeBold--d93f2","bodyLarge":"bp_text_module_bodyLarge--d93f2","bodyDefaultBold":"bp_text_module_bodyDefaultBold--d93f2","bodyDefaultSemibold":"bp_text_module_bodyDefaultSemibold--d93f2","bodyDefault":"bp_text_module_bodyDefault--d93f2","caption":"bp_text_module_caption--d93f2","labelBold":"bp_text_module_labelBold--d93f2","label":"bp_text_module_label--d93f2","bodySmallSemibold":"bp_text_module_bodySmallSemibold--d93f2","bodySmall":"bp_text_module_bodySmall--d93f2","captionBold":"bp_text_module_captionBold--d93f2","link":"bp_text_module_link--d93f2","notification":"bp_text_module_notification--d93f2"};
|
|
3
3
|
|
|
4
4
|
export { styles as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type HTMLAttributes, type LabelHTMLAttributes } from 'react';
|
|
2
2
|
import { type StyledText } from '../utils/commonTypes';
|
|
3
3
|
type TypographyVariant = 'titleMondo' | 'titleXLarge' | 'titleLarge' | 'titleMedium' | 'titleSmall' | 'subtitle' | 'bodyLargeBold' | 'bodyLarge' | 'bodyDefaultBold' | 'bodyDefaultSemibold' | 'bodyDefault' | 'caption' | 'labelBold' | 'label';
|
|
4
|
-
type TypographyColors = 'textOnLightDefault' | 'textOnLightSecondary' | 'textOnLightLink' | 'textOnDarkDefault';
|
|
4
|
+
type TypographyColors = 'textOnLightDefault' | 'textOnLightSecondary' | 'textOnLightLink' | 'textOnLightError' | 'textOnDarkDefault';
|
|
5
5
|
type Element = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'legend' | 'label' | 'div';
|
|
6
6
|
interface HeadingProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
7
7
|
as: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|