@cloudwick/astral-ui 8.3.0 → 8.4.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/README.md +1 -1
- package/dist/components/button/button.d.ts +2 -0
- package/dist/components/modal/index.d.ts +1 -1
- package/dist/components/modal/modal.d.ts +29 -6
- package/dist/components/modal/modalContext.d.ts +22 -0
- package/dist/components/modal/modalTitle.d.ts +21 -0
- package/dist/components/modal/modalVariants.d.ts +18 -3
- package/dist/components/panel/panelContext.d.ts +7 -0
- package/dist/css/index.min.css +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/usePartRegistration.d.ts +10 -0
- package/dist/index.cjs.js +5 -5
- package/dist/index.esm.js +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,6 +58,8 @@ export interface IButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButton
|
|
|
58
58
|
* This prop accepts a ReactNode, if this is passed then the button will render
|
|
59
59
|
* tooltip on hover of the button.
|
|
60
60
|
* This tooltip is only on hover and not on click.
|
|
61
|
+
* A string tooltip on a button without text also becomes the button's `aria-label`, unless
|
|
62
|
+
* `aria-label` or `aria-labelledby` is passed.
|
|
61
63
|
*/
|
|
62
64
|
tooltip?: React.ReactNode;
|
|
63
65
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Modal, ModalHeader, ModalBody, type IModalProps, type IModalHeaderProps, type IModalBodyProps } from "./modal";
|
|
1
|
+
export { Modal, ModalHeader, ModalTitle, ModalBody, type IModalProps, type IModalHeaderProps, type IModalTitleProps, type IModalBodyProps } from "./modal";
|
|
2
2
|
export { modalVariants } from "./modalVariants";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { ModalTitle, type IModalTitleProps } from "./modalTitle";
|
|
2
3
|
export interface IModalProps {
|
|
3
4
|
/**
|
|
4
5
|
* Control modal's visibility
|
|
@@ -40,10 +41,24 @@ export interface IModalProps {
|
|
|
40
41
|
*/
|
|
41
42
|
onHide?: () => void;
|
|
42
43
|
/**
|
|
43
|
-
* Accessible name for the dialog. Takes precedence over the name derived from Modal.Header,
|
|
44
|
-
* when the header holds no title text (an icon, a search input) or when no header is rendered.
|
|
44
|
+
* Accessible name for the dialog. Takes precedence over the name derived from Modal.Title or Modal.Header,
|
|
45
|
+
* so use it when the header holds no title text (an icon, a search input) or when no header is rendered.
|
|
45
46
|
*/
|
|
46
47
|
"aria-label"?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Id of the element that names the dialog. Takes precedence over Modal.Title, Modal.Header and `aria-label`.
|
|
50
|
+
*/
|
|
51
|
+
"aria-labelledby"?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Id of the element that describes the dialog, or `false` for no description.
|
|
54
|
+
* @default the id of the rendered Modal.Body, unless it contains the Modal.Title
|
|
55
|
+
*/
|
|
56
|
+
"aria-describedby"?: string | false;
|
|
57
|
+
/**
|
|
58
|
+
* Accessible name of the built-in close button
|
|
59
|
+
* @default "Close"
|
|
60
|
+
*/
|
|
61
|
+
closeButtonLabel?: string;
|
|
47
62
|
}
|
|
48
63
|
export interface IModalHeaderProps {
|
|
49
64
|
/**
|
|
@@ -79,6 +94,7 @@ export interface IModalBodyProps {
|
|
|
79
94
|
}
|
|
80
95
|
type TModalCompoundComponent = React.ForwardRefExoticComponent<React.PropsWithoutRef<IModalProps> & React.RefAttributes<HTMLDivElement>> & {
|
|
81
96
|
Header: typeof ModalHeader;
|
|
97
|
+
Title: typeof ModalTitle;
|
|
82
98
|
Body: typeof ModalBody;
|
|
83
99
|
};
|
|
84
100
|
/**
|
|
@@ -87,18 +103,24 @@ type TModalCompoundComponent = React.ForwardRefExoticComponent<React.PropsWithou
|
|
|
87
103
|
* @example
|
|
88
104
|
* ```tsx
|
|
89
105
|
* <Modal showModal={modalVisible} onHide={() => setModalVisible(false)}>
|
|
90
|
-
* <Modal.Header>
|
|
106
|
+
* <Modal.Header>
|
|
107
|
+
* <Modal.Title>Modal Title</Modal.Title>
|
|
108
|
+
* </Modal.Header>
|
|
91
109
|
* <Modal.Body>Modal content goes here</Modal.Body>
|
|
92
110
|
* </Modal>
|
|
93
111
|
* ```
|
|
94
112
|
*/
|
|
95
113
|
export declare const Modal: TModalCompoundComponent;
|
|
96
114
|
/**
|
|
97
|
-
* Modal header component for
|
|
115
|
+
* Modal header component. With a Modal.Title inside, it is a layout row for the title and any actions;
|
|
116
|
+
* without one, the whole header is the dialog's heading and name.
|
|
98
117
|
*
|
|
99
118
|
* @example
|
|
100
119
|
* ```tsx
|
|
101
|
-
* <Modal.Header>
|
|
120
|
+
* <Modal.Header>
|
|
121
|
+
* <Modal.Title>Modal Title</Modal.Title>
|
|
122
|
+
* <Button aria-label="Download" prefixIcon="download" />
|
|
123
|
+
* </Modal.Header>
|
|
102
124
|
* ```
|
|
103
125
|
*/
|
|
104
126
|
declare const ModalHeader: React.ForwardRefExoticComponent<IModalHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -115,4 +137,5 @@ declare const ModalHeader: React.ForwardRefExoticComponent<IModalHeaderProps & R
|
|
|
115
137
|
* ```
|
|
116
138
|
*/
|
|
117
139
|
declare const ModalBody: React.ForwardRefExoticComponent<IModalBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
118
|
-
export { ModalHeader, ModalBody };
|
|
140
|
+
export { ModalHeader, ModalTitle, ModalBody };
|
|
141
|
+
export type { IModalTitleProps };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface IModalContext {
|
|
3
|
+
labelId: string;
|
|
4
|
+
descId: string;
|
|
5
|
+
closeButton: boolean;
|
|
6
|
+
titleRendered: boolean;
|
|
7
|
+
setHeaderMounted: (mounted: boolean) => void;
|
|
8
|
+
setTitleMounted: (mounted: boolean) => void;
|
|
9
|
+
setTitleInBodyMounted: (mounted: boolean) => void;
|
|
10
|
+
setBodyMounted: (mounted: boolean) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const ModalContext: React.Context<IModalContext | null>;
|
|
13
|
+
/**
|
|
14
|
+
* True inside Modal.Body. A Modal.Title there would otherwise be both the dialog's name and part of its
|
|
15
|
+
* description, which describes the dialog with the whole body.
|
|
16
|
+
*/
|
|
17
|
+
export declare const ModalBodyContext: React.Context<boolean>;
|
|
18
|
+
/**
|
|
19
|
+
* Development warnings for a dialog with no accessible name, and for a heading that contains controls,
|
|
20
|
+
* which then become part of the heading and of the dialog's name. Warns once per Modal instance.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useModalNameWarnings(dialog: HTMLElement | null, labelId: string, named: boolean, titleRendered: boolean): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface IModalTitleProps {
|
|
3
|
+
/**
|
|
4
|
+
* Title text of the Modal
|
|
5
|
+
*/
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Dynamically updates the classes applied to the component
|
|
9
|
+
*/
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Modal title component. It is the dialog's heading and names the dialog, so the header's actions stay
|
|
14
|
+
* out of the name. Place it inside Modal.Header, or in Modal.Body for dialogs that show the title there.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <Modal.Title>Modal Title</Modal.Title>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare const ModalTitle: React.ForwardRefExoticComponent<IModalTitleProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
@@ -1,28 +1,43 @@
|
|
|
1
1
|
export declare const modalVariants: import("tailwind-variants").TVReturnType<{
|
|
2
2
|
headerless: {
|
|
3
|
+
true: {};
|
|
4
|
+
};
|
|
5
|
+
closeButton: {
|
|
3
6
|
true: {
|
|
4
|
-
|
|
7
|
+
header: string;
|
|
5
8
|
};
|
|
6
9
|
};
|
|
7
10
|
}, {
|
|
8
11
|
container: string[];
|
|
9
12
|
modal: string[];
|
|
13
|
+
header: string;
|
|
14
|
+
title: string;
|
|
10
15
|
}, undefined, {
|
|
11
16
|
headerless: {
|
|
17
|
+
true: {};
|
|
18
|
+
};
|
|
19
|
+
closeButton: {
|
|
12
20
|
true: {
|
|
13
|
-
|
|
21
|
+
header: string;
|
|
14
22
|
};
|
|
15
23
|
};
|
|
16
24
|
}, {
|
|
17
25
|
container: string[];
|
|
18
26
|
modal: string[];
|
|
27
|
+
header: string;
|
|
28
|
+
title: string;
|
|
19
29
|
}, import("tailwind-variants").TVReturnType<{
|
|
20
30
|
headerless: {
|
|
31
|
+
true: {};
|
|
32
|
+
};
|
|
33
|
+
closeButton: {
|
|
21
34
|
true: {
|
|
22
|
-
|
|
35
|
+
header: string;
|
|
23
36
|
};
|
|
24
37
|
};
|
|
25
38
|
}, {
|
|
26
39
|
container: string[];
|
|
27
40
|
modal: string[];
|
|
41
|
+
header: string;
|
|
42
|
+
title: string;
|
|
28
43
|
}, undefined, unknown, unknown, undefined>>;
|