@workday/canvas-kit-react 9.0.0-alpha.412-next.14 → 9.0.0-alpha.413-next.15
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/dialog/lib/Dialog.tsx +66 -0
- package/dist/commonjs/dialog/lib/Dialog.d.ts +65 -0
- package/dist/commonjs/dialog/lib/Dialog.d.ts.map +1 -1
- package/dist/commonjs/dialog/lib/Dialog.js +65 -0
- package/dist/commonjs/popup/lib/Popup.d.ts +1 -81
- package/dist/commonjs/popup/lib/Popup.d.ts.map +1 -1
- package/dist/commonjs/popup/lib/Popup.js +1 -1
- package/dist/es6/dialog/lib/Dialog.d.ts +65 -0
- package/dist/es6/dialog/lib/Dialog.d.ts.map +1 -1
- package/dist/es6/dialog/lib/Dialog.js +65 -0
- package/dist/es6/popup/lib/Popup.d.ts +1 -81
- package/dist/es6/popup/lib/Popup.d.ts.map +1 -1
- package/dist/es6/popup/lib/Popup.js +1 -1
- package/package.json +3 -3
- package/popup/lib/Popup.tsx +1 -1
package/dialog/lib/Dialog.tsx
CHANGED
|
@@ -14,16 +14,82 @@ export interface DialogProps {
|
|
|
14
14
|
children: React.ReactNode;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* This component is the container component and does not render any semantic elements. It provides
|
|
19
|
+
* a React Context model for the `Dialog` subcomponents. If you manually pass a `model` to all
|
|
20
|
+
* subcomponents, this container component isn't needed. If you do not pass a `model`, the `Dialog`
|
|
21
|
+
* container component will build a default one using `useDialogModel`. `Dialog` is a composition of a
|
|
22
|
+
* {@link Popup} component and has a similar structure to `Popup`.
|
|
23
|
+
*/
|
|
17
24
|
export const Dialog = createContainer()({
|
|
18
25
|
displayName: 'Dialog',
|
|
19
26
|
modelHook: useDialogModel,
|
|
20
27
|
subComponents: {
|
|
28
|
+
/**
|
|
29
|
+
* A `Dialog.Body` is a thin wrapper around {@link CardBody Card.Body} and doesn't actually take
|
|
30
|
+
* a model. It adds `body` styling and nothing else.
|
|
31
|
+
*/
|
|
21
32
|
Body: Popup.Body,
|
|
33
|
+
/**
|
|
34
|
+
* A `Dialog.Card` is a wrapper around the {@link Card} component, but hooked up to a
|
|
35
|
+
* {@link DialogModel}. By default, this element has a `role=dialog`, `aria-labelledby` and an `id`.
|
|
36
|
+
* The behavior hook used is called {@link useDialogCard}.
|
|
37
|
+
*/
|
|
22
38
|
Card: DialogCard,
|
|
39
|
+
/**
|
|
40
|
+
* A `Dialog.CloseIcon` is an icon button that is the `X` at the top of a dialog. It will hide a
|
|
41
|
+
* dialog when clicked. The behavior hook used is called {@link usePopupCloseButton}.
|
|
42
|
+
*/
|
|
23
43
|
CloseIcon: Popup.CloseIcon,
|
|
44
|
+
/**
|
|
45
|
+
* A `Dialog.Target` is any element that is meant to show the Dialog. The default component
|
|
46
|
+
* rendered by this component is a {@link SecondaryButton} element. You can override this by
|
|
47
|
+
* passing the desired component via `as`. Many examples above use `as={DeleteButton}`. If you
|
|
48
|
+
* want to render a {@link TertiaryButton} instead, use `as={TertiaryButton}`. The behavior hook
|
|
49
|
+
* used is called {@link usePopupTarget}.
|
|
50
|
+
*
|
|
51
|
+
* ```tsx
|
|
52
|
+
* const model = useDialogModel();
|
|
53
|
+
*
|
|
54
|
+
* // using this component
|
|
55
|
+
* <Dialog.Target>Show Dialog</Dialog.Target>
|
|
56
|
+
*
|
|
57
|
+
* // using props instead
|
|
58
|
+
* const dialogTargetButtonProps = useDialogTarget(model);
|
|
59
|
+
* <SecondaryButton {...dialogTargetButtonProps}>Show Dialog</SecondaryButton>
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* `Dialog.Target` doesn't provide any styling by default. All styling comes from the default
|
|
63
|
+
* component used, which is {@link SecondaryButton}. If you don't want any styling, you can do
|
|
64
|
+
* the following:
|
|
65
|
+
*
|
|
66
|
+
* ```tsx
|
|
67
|
+
* <Dialog.Target as="button">Open</Dialog.Target>
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* To add your own styling, you could either add a `css` prop, or make a styled button and pass
|
|
71
|
+
* that styled component via the `as` prop.
|
|
72
|
+
*/
|
|
24
73
|
Target: Popup.Target,
|
|
74
|
+
/**
|
|
75
|
+
* A `Dialog.Heading` is a wrapper around {@link CardHeading Card.Heading} that connect the
|
|
76
|
+
* heading to a {@link DialogModel}. It will add an `id` to the element that match the
|
|
77
|
+
* `aria-labelledby` that is applied to the `Dialog.Card` element for accessibility. The behavior
|
|
78
|
+
* hook used is called {@link usePopupHeading}.
|
|
79
|
+
*/
|
|
25
80
|
Heading: Popup.Heading,
|
|
81
|
+
/**
|
|
82
|
+
* A `Dialog.Popper` is a wrapper around {@link PopupPopper Popup.Popper}. The behavior
|
|
83
|
+
* hook used is called {@link useDialogPopper}.
|
|
84
|
+
*/
|
|
85
|
+
|
|
26
86
|
Popper: DialogPopper,
|
|
87
|
+
/**
|
|
88
|
+
* A `Dialog.CloseButton` is a button that will hide a dialog. By default, this is a
|
|
89
|
+
* {@link SecondaryButton} component, but `as` can be used to render any button element (i.e
|
|
90
|
+
* {@link DeleteButton} or {@link PrimaryButton}). The behavior hook used is called
|
|
91
|
+
* {@link usePopupCloseButton}.
|
|
92
|
+
*/
|
|
27
93
|
CloseButton: Popup.CloseButton,
|
|
28
94
|
},
|
|
29
95
|
})(({children}: DialogProps) => {
|
|
@@ -5,6 +5,13 @@ export interface DialogProps {
|
|
|
5
5
|
*/
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* This component is the container component and does not render any semantic elements. It provides
|
|
10
|
+
* a React Context model for the `Dialog` subcomponents. If you manually pass a `model` to all
|
|
11
|
+
* subcomponents, this container component isn't needed. If you do not pass a `model`, the `Dialog`
|
|
12
|
+
* container component will build a default one using `useDialogModel`. `Dialog` is a composition of a
|
|
13
|
+
* {@link Popup} component and has a similar structure to `Popup`.
|
|
14
|
+
*/
|
|
8
15
|
export declare const Dialog: import("@workday/canvas-kit-react/common").ComponentM<DialogProps & Partial<{
|
|
9
16
|
returnFocusRef: React.RefObject<any> | undefined;
|
|
10
17
|
initialFocusRef: React.RefObject<any> | undefined;
|
|
@@ -88,6 +95,10 @@ export declare const Dialog: import("@workday/canvas-kit-react/common").Componen
|
|
|
88
95
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
89
96
|
};
|
|
90
97
|
}> & {
|
|
98
|
+
/**
|
|
99
|
+
* A `Dialog.Body` is a thin wrapper around {@link CardBody Card.Body} and doesn't actually take
|
|
100
|
+
* a model. It adds `body` styling and nothing else.
|
|
101
|
+
*/
|
|
91
102
|
Body: import("@workday/canvas-kit-react/common").ElementComponentM<"div", import("../..").BackgroundStyleProps & import("../../layout/lib/utils/border/color").BorderColorStyleProps & import("../../layout/lib/utils/border/lineStyle").BorderLineStyleProps & import("../../layout/lib/utils/border/radius").BorderRadiusStyleProps & import("../../layout/lib/utils/border/shorthand").BorderShorthandStyleProps & import("../../layout/lib/utils/border/width").BorderWidthStyleProps & import("../..").ColorStyleProps & import("../..").DepthStyleProps & import("../..").FlexItemStyleProps & import("../..").GridItemStyleProps & import("../..").LayoutStyleProps & import("../..").OtherStyleProps & import("../..").PositionStyleProps & import("../..").SpaceStyleProps & import("../..").TextStyleProps & React.HTMLAttributes<HTMLDivElement>, {
|
|
92
103
|
state: {
|
|
93
104
|
stackRef: React.RefObject<HTMLDivElement>;
|
|
@@ -106,6 +117,11 @@ export declare const Dialog: import("@workday/canvas-kit-react/common").Componen
|
|
|
106
117
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
107
118
|
};
|
|
108
119
|
}>;
|
|
120
|
+
/**
|
|
121
|
+
* A `Dialog.Card` is a wrapper around the {@link Card} component, but hooked up to a
|
|
122
|
+
* {@link DialogModel}. By default, this element has a `role=dialog`, `aria-labelledby` and an `id`.
|
|
123
|
+
* The behavior hook used is called {@link useDialogCard}.
|
|
124
|
+
*/
|
|
109
125
|
Card: import("@workday/canvas-kit-react/common").ElementComponentM<"div", import("../../popup/lib/PopupCard").PopupCardProps & import("@workday/canvas-kit-react/common").PropsWithModel<{
|
|
110
126
|
state: {
|
|
111
127
|
stackRef: React.RefObject<HTMLDivElement>;
|
|
@@ -141,6 +157,10 @@ export declare const Dialog: import("@workday/canvas-kit-react/common").Componen
|
|
|
141
157
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
142
158
|
};
|
|
143
159
|
}>;
|
|
160
|
+
/**
|
|
161
|
+
* A `Dialog.CloseIcon` is an icon button that is the `X` at the top of a dialog. It will hide a
|
|
162
|
+
* dialog when clicked. The behavior hook used is called {@link usePopupCloseButton}.
|
|
163
|
+
*/
|
|
144
164
|
CloseIcon: import("@workday/canvas-kit-react/common").ElementComponentM<"button", import("../../popup/lib/PopupCloseIcon").PopupCloseIconProps, {
|
|
145
165
|
state: {
|
|
146
166
|
stackRef: React.RefObject<HTMLDivElement>;
|
|
@@ -159,6 +179,35 @@ export declare const Dialog: import("@workday/canvas-kit-react/common").Componen
|
|
|
159
179
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
160
180
|
};
|
|
161
181
|
}>;
|
|
182
|
+
/**
|
|
183
|
+
* A `Dialog.Target` is any element that is meant to show the Dialog. The default component
|
|
184
|
+
* rendered by this component is a {@link SecondaryButton} element. You can override this by
|
|
185
|
+
* passing the desired component via `as`. Many examples above use `as={DeleteButton}`. If you
|
|
186
|
+
* want to render a {@link TertiaryButton} instead, use `as={TertiaryButton}`. The behavior hook
|
|
187
|
+
* used is called {@link usePopupTarget}.
|
|
188
|
+
*
|
|
189
|
+
* ```tsx
|
|
190
|
+
* const model = useDialogModel();
|
|
191
|
+
*
|
|
192
|
+
* // using this component
|
|
193
|
+
* <Dialog.Target>Show Dialog</Dialog.Target>
|
|
194
|
+
*
|
|
195
|
+
* // using props instead
|
|
196
|
+
* const dialogTargetButtonProps = useDialogTarget(model);
|
|
197
|
+
* <SecondaryButton {...dialogTargetButtonProps}>Show Dialog</SecondaryButton>
|
|
198
|
+
* ```
|
|
199
|
+
*
|
|
200
|
+
* `Dialog.Target` doesn't provide any styling by default. All styling comes from the default
|
|
201
|
+
* component used, which is {@link SecondaryButton}. If you don't want any styling, you can do
|
|
202
|
+
* the following:
|
|
203
|
+
*
|
|
204
|
+
* ```tsx
|
|
205
|
+
* <Dialog.Target as="button">Open</Dialog.Target>
|
|
206
|
+
* ```
|
|
207
|
+
*
|
|
208
|
+
* To add your own styling, you could either add a `css` prop, or make a styled button and pass
|
|
209
|
+
* that styled component via the `as` prop.
|
|
210
|
+
*/
|
|
162
211
|
Target: import("@workday/canvas-kit-react/common").ElementComponentM<import("@workday/canvas-kit-react/common").ElementComponent<"button", import("../..").SecondaryButtonProps>, {}, {
|
|
163
212
|
state: {
|
|
164
213
|
stackRef: React.RefObject<HTMLDivElement>;
|
|
@@ -177,6 +226,12 @@ export declare const Dialog: import("@workday/canvas-kit-react/common").Componen
|
|
|
177
226
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
178
227
|
};
|
|
179
228
|
}>;
|
|
229
|
+
/**
|
|
230
|
+
* A `Dialog.Heading` is a wrapper around {@link CardHeading Card.Heading} that connect the
|
|
231
|
+
* heading to a {@link DialogModel}. It will add an `id` to the element that match the
|
|
232
|
+
* `aria-labelledby` that is applied to the `Dialog.Card` element for accessibility. The behavior
|
|
233
|
+
* hook used is called {@link usePopupHeading}.
|
|
234
|
+
*/
|
|
180
235
|
Heading: import("@workday/canvas-kit-react/common").ElementComponentM<"h2", import("../../popup/lib/PopupHeading").PopupHeadingProps, {
|
|
181
236
|
state: {
|
|
182
237
|
stackRef: React.RefObject<HTMLDivElement>;
|
|
@@ -195,6 +250,10 @@ export declare const Dialog: import("@workday/canvas-kit-react/common").Componen
|
|
|
195
250
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
196
251
|
};
|
|
197
252
|
}>;
|
|
253
|
+
/**
|
|
254
|
+
* A `Dialog.Popper` is a wrapper around {@link PopupPopper Popup.Popper}. The behavior
|
|
255
|
+
* hook used is called {@link useDialogPopper}.
|
|
256
|
+
*/
|
|
198
257
|
Popper: import("@workday/canvas-kit-react/common").ElementComponentM<"div", import("../../popup/lib/PopupPopper").PopupPopperProps & import("@workday/canvas-kit-react/common").PropsWithModel<{
|
|
199
258
|
state: {
|
|
200
259
|
stackRef: React.RefObject<HTMLDivElement>;
|
|
@@ -230,6 +289,12 @@ export declare const Dialog: import("@workday/canvas-kit-react/common").Componen
|
|
|
230
289
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
231
290
|
};
|
|
232
291
|
}>;
|
|
292
|
+
/**
|
|
293
|
+
* A `Dialog.CloseButton` is a button that will hide a dialog. By default, this is a
|
|
294
|
+
* {@link SecondaryButton} component, but `as` can be used to render any button element (i.e
|
|
295
|
+
* {@link DeleteButton} or {@link PrimaryButton}). The behavior hook used is called
|
|
296
|
+
* {@link usePopupCloseButton}.
|
|
297
|
+
*/
|
|
233
298
|
CloseButton: import("@workday/canvas-kit-react/common").ElementComponentM<import("@workday/canvas-kit-react/common").ElementComponent<"button", import("../..").SecondaryButtonProps>, import("../../popup/lib/PopupCloseButton").PopupCloseButtonProps, {
|
|
234
299
|
state: {
|
|
235
300
|
stackRef: React.RefObject<HTMLDivElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../dialog/lib/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../dialog/lib/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIf;;;OAGG;;;;;;;;;;;;;;;;;;;IAEH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;;;IAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;;;;;;;;;;;;;;;;;;;IAEH;;;;;OAKG;;;;;;;;;;;;;;;;;;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGH;;;;;OAKG;;;;;;;;;;;;;;;;;;;CAKL,CAAC"}
|
|
@@ -10,16 +10,81 @@ const popup_1 = require("@workday/canvas-kit-react/popup");
|
|
|
10
10
|
const DialogPopper_1 = require("./DialogPopper");
|
|
11
11
|
const DialogCard_1 = require("./DialogCard");
|
|
12
12
|
const hooks_1 = require("./hooks");
|
|
13
|
+
/**
|
|
14
|
+
* This component is the container component and does not render any semantic elements. It provides
|
|
15
|
+
* a React Context model for the `Dialog` subcomponents. If you manually pass a `model` to all
|
|
16
|
+
* subcomponents, this container component isn't needed. If you do not pass a `model`, the `Dialog`
|
|
17
|
+
* container component will build a default one using `useDialogModel`. `Dialog` is a composition of a
|
|
18
|
+
* {@link Popup} component and has a similar structure to `Popup`.
|
|
19
|
+
*/
|
|
13
20
|
exports.Dialog = common_1.createContainer()({
|
|
14
21
|
displayName: 'Dialog',
|
|
15
22
|
modelHook: hooks_1.useDialogModel,
|
|
16
23
|
subComponents: {
|
|
24
|
+
/**
|
|
25
|
+
* A `Dialog.Body` is a thin wrapper around {@link CardBody Card.Body} and doesn't actually take
|
|
26
|
+
* a model. It adds `body` styling and nothing else.
|
|
27
|
+
*/
|
|
17
28
|
Body: popup_1.Popup.Body,
|
|
29
|
+
/**
|
|
30
|
+
* A `Dialog.Card` is a wrapper around the {@link Card} component, but hooked up to a
|
|
31
|
+
* {@link DialogModel}. By default, this element has a `role=dialog`, `aria-labelledby` and an `id`.
|
|
32
|
+
* The behavior hook used is called {@link useDialogCard}.
|
|
33
|
+
*/
|
|
18
34
|
Card: DialogCard_1.DialogCard,
|
|
35
|
+
/**
|
|
36
|
+
* A `Dialog.CloseIcon` is an icon button that is the `X` at the top of a dialog. It will hide a
|
|
37
|
+
* dialog when clicked. The behavior hook used is called {@link usePopupCloseButton}.
|
|
38
|
+
*/
|
|
19
39
|
CloseIcon: popup_1.Popup.CloseIcon,
|
|
40
|
+
/**
|
|
41
|
+
* A `Dialog.Target` is any element that is meant to show the Dialog. The default component
|
|
42
|
+
* rendered by this component is a {@link SecondaryButton} element. You can override this by
|
|
43
|
+
* passing the desired component via `as`. Many examples above use `as={DeleteButton}`. If you
|
|
44
|
+
* want to render a {@link TertiaryButton} instead, use `as={TertiaryButton}`. The behavior hook
|
|
45
|
+
* used is called {@link usePopupTarget}.
|
|
46
|
+
*
|
|
47
|
+
* ```tsx
|
|
48
|
+
* const model = useDialogModel();
|
|
49
|
+
*
|
|
50
|
+
* // using this component
|
|
51
|
+
* <Dialog.Target>Show Dialog</Dialog.Target>
|
|
52
|
+
*
|
|
53
|
+
* // using props instead
|
|
54
|
+
* const dialogTargetButtonProps = useDialogTarget(model);
|
|
55
|
+
* <SecondaryButton {...dialogTargetButtonProps}>Show Dialog</SecondaryButton>
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* `Dialog.Target` doesn't provide any styling by default. All styling comes from the default
|
|
59
|
+
* component used, which is {@link SecondaryButton}. If you don't want any styling, you can do
|
|
60
|
+
* the following:
|
|
61
|
+
*
|
|
62
|
+
* ```tsx
|
|
63
|
+
* <Dialog.Target as="button">Open</Dialog.Target>
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* To add your own styling, you could either add a `css` prop, or make a styled button and pass
|
|
67
|
+
* that styled component via the `as` prop.
|
|
68
|
+
*/
|
|
20
69
|
Target: popup_1.Popup.Target,
|
|
70
|
+
/**
|
|
71
|
+
* A `Dialog.Heading` is a wrapper around {@link CardHeading Card.Heading} that connect the
|
|
72
|
+
* heading to a {@link DialogModel}. It will add an `id` to the element that match the
|
|
73
|
+
* `aria-labelledby` that is applied to the `Dialog.Card` element for accessibility. The behavior
|
|
74
|
+
* hook used is called {@link usePopupHeading}.
|
|
75
|
+
*/
|
|
21
76
|
Heading: popup_1.Popup.Heading,
|
|
77
|
+
/**
|
|
78
|
+
* A `Dialog.Popper` is a wrapper around {@link PopupPopper Popup.Popper}. The behavior
|
|
79
|
+
* hook used is called {@link useDialogPopper}.
|
|
80
|
+
*/
|
|
22
81
|
Popper: DialogPopper_1.DialogPopper,
|
|
82
|
+
/**
|
|
83
|
+
* A `Dialog.CloseButton` is a button that will hide a dialog. By default, this is a
|
|
84
|
+
* {@link SecondaryButton} component, but `as` can be used to render any button element (i.e
|
|
85
|
+
* {@link DeleteButton} or {@link PrimaryButton}). The behavior hook used is called
|
|
86
|
+
* {@link usePopupCloseButton}.
|
|
87
|
+
*/
|
|
23
88
|
CloseButton: popup_1.Popup.CloseButton,
|
|
24
89
|
},
|
|
25
90
|
})(({ children }) => {
|
|
@@ -98,16 +98,6 @@ export declare const Popup: import("@workday/canvas-kit-react/common").Component
|
|
|
98
98
|
visibility: "hidden" | "visible";
|
|
99
99
|
};
|
|
100
100
|
events: {
|
|
101
|
-
/**
|
|
102
|
-
* A `Popup.Popper` is a {@link Popper} component that is hooked up to the {@link PopupModel}
|
|
103
|
-
* automatically. The behavior hook used is called {@link usePopupPopper}.
|
|
104
|
-
*
|
|
105
|
-
* > **Note:** `Popup.Popper` renders any children to a `div` element created by the
|
|
106
|
-
* > {@link PopupStack}. This element is not controlled by React, so any extra element props
|
|
107
|
-
* > will _not_ be forwarded. The `ref` will point to the `div` element created by the
|
|
108
|
-
* > `PopupStack`, however. If you wish to add extra props to an element, add them to the
|
|
109
|
-
* > {@link PopupCard Popup.Card} instead.
|
|
110
|
-
*/
|
|
111
101
|
updatePlacement(data: {
|
|
112
102
|
placement: import("@popperjs/core").Placement;
|
|
113
103
|
}): void;
|
|
@@ -126,7 +116,7 @@ export declare const Popup: import("@workday/canvas-kit-react/common").Component
|
|
|
126
116
|
* const model = usePopupModel();
|
|
127
117
|
*
|
|
128
118
|
* // using this component
|
|
129
|
-
* <Popup.Target>Show Popup</
|
|
119
|
+
* <Popup.Target>Show Popup</Popup.Target>
|
|
130
120
|
*
|
|
131
121
|
* // using props instead
|
|
132
122
|
* const popupTargetButtonProps = usePopupTarget(model);
|
|
@@ -155,16 +145,6 @@ export declare const Popup: import("@workday/canvas-kit-react/common").Component
|
|
|
155
145
|
visibility: "hidden" | "visible";
|
|
156
146
|
};
|
|
157
147
|
events: {
|
|
158
|
-
/**
|
|
159
|
-
* A `Popup.Popper` is a {@link Popper} component that is hooked up to the {@link PopupModel}
|
|
160
|
-
* automatically. The behavior hook used is called {@link usePopupPopper}.
|
|
161
|
-
*
|
|
162
|
-
* > **Note:** `Popup.Popper` renders any children to a `div` element created by the
|
|
163
|
-
* > {@link PopupStack}. This element is not controlled by React, so any extra element props
|
|
164
|
-
* > will _not_ be forwarded. The `ref` will point to the `div` element created by the
|
|
165
|
-
* > `PopupStack`, however. If you wish to add extra props to an element, add them to the
|
|
166
|
-
* > {@link PopupCard Popup.Card} instead.
|
|
167
|
-
*/
|
|
168
148
|
updatePlacement(data: {
|
|
169
149
|
placement: import("@popperjs/core").Placement;
|
|
170
150
|
}): void;
|
|
@@ -193,16 +173,6 @@ export declare const Popup: import("@workday/canvas-kit-react/common").Component
|
|
|
193
173
|
visibility: "hidden" | "visible";
|
|
194
174
|
};
|
|
195
175
|
events: {
|
|
196
|
-
/**
|
|
197
|
-
* A `Popup.Popper` is a {@link Popper} component that is hooked up to the {@link PopupModel}
|
|
198
|
-
* automatically. The behavior hook used is called {@link usePopupPopper}.
|
|
199
|
-
*
|
|
200
|
-
* > **Note:** `Popup.Popper` renders any children to a `div` element created by the
|
|
201
|
-
* > {@link PopupStack}. This element is not controlled by React, so any extra element props
|
|
202
|
-
* > will _not_ be forwarded. The `ref` will point to the `div` element created by the
|
|
203
|
-
* > `PopupStack`, however. If you wish to add extra props to an element, add them to the
|
|
204
|
-
* > {@link PopupCard Popup.Card} instead.
|
|
205
|
-
*/
|
|
206
176
|
updatePlacement(data: {
|
|
207
177
|
placement: import("@popperjs/core").Placement;
|
|
208
178
|
}): void;
|
|
@@ -226,16 +196,6 @@ export declare const Popup: import("@workday/canvas-kit-react/common").Component
|
|
|
226
196
|
visibility: "hidden" | "visible";
|
|
227
197
|
};
|
|
228
198
|
events: {
|
|
229
|
-
/**
|
|
230
|
-
* A `Popup.Popper` is a {@link Popper} component that is hooked up to the {@link PopupModel}
|
|
231
|
-
* automatically. The behavior hook used is called {@link usePopupPopper}.
|
|
232
|
-
*
|
|
233
|
-
* > **Note:** `Popup.Popper` renders any children to a `div` element created by the
|
|
234
|
-
* > {@link PopupStack}. This element is not controlled by React, so any extra element props
|
|
235
|
-
* > will _not_ be forwarded. The `ref` will point to the `div` element created by the
|
|
236
|
-
* > `PopupStack`, however. If you wish to add extra props to an element, add them to the
|
|
237
|
-
* > {@link PopupCard Popup.Card} instead.
|
|
238
|
-
*/
|
|
239
199
|
updatePlacement(data: {
|
|
240
200
|
placement: import("@popperjs/core").Placement;
|
|
241
201
|
}): void;
|
|
@@ -258,16 +218,6 @@ export declare const Popup: import("@workday/canvas-kit-react/common").Component
|
|
|
258
218
|
visibility: "hidden" | "visible";
|
|
259
219
|
};
|
|
260
220
|
events: {
|
|
261
|
-
/**
|
|
262
|
-
* A `Popup.Popper` is a {@link Popper} component that is hooked up to the {@link PopupModel}
|
|
263
|
-
* automatically. The behavior hook used is called {@link usePopupPopper}.
|
|
264
|
-
*
|
|
265
|
-
* > **Note:** `Popup.Popper` renders any children to a `div` element created by the
|
|
266
|
-
* > {@link PopupStack}. This element is not controlled by React, so any extra element props
|
|
267
|
-
* > will _not_ be forwarded. The `ref` will point to the `div` element created by the
|
|
268
|
-
* > `PopupStack`, however. If you wish to add extra props to an element, add them to the
|
|
269
|
-
* > {@link PopupCard Popup.Card} instead.
|
|
270
|
-
*/
|
|
271
221
|
updatePlacement(data: {
|
|
272
222
|
placement: import("@popperjs/core").Placement;
|
|
273
223
|
}): void;
|
|
@@ -292,16 +242,6 @@ export declare const Popup: import("@workday/canvas-kit-react/common").Component
|
|
|
292
242
|
visibility: "hidden" | "visible";
|
|
293
243
|
};
|
|
294
244
|
events: {
|
|
295
|
-
/**
|
|
296
|
-
* A `Popup.Popper` is a {@link Popper} component that is hooked up to the {@link PopupModel}
|
|
297
|
-
* automatically. The behavior hook used is called {@link usePopupPopper}.
|
|
298
|
-
*
|
|
299
|
-
* > **Note:** `Popup.Popper` renders any children to a `div` element created by the
|
|
300
|
-
* > {@link PopupStack}. This element is not controlled by React, so any extra element props
|
|
301
|
-
* > will _not_ be forwarded. The `ref` will point to the `div` element created by the
|
|
302
|
-
* > `PopupStack`, however. If you wish to add extra props to an element, add them to the
|
|
303
|
-
* > {@link PopupCard Popup.Card} instead.
|
|
304
|
-
*/
|
|
305
245
|
updatePlacement(data: {
|
|
306
246
|
placement: import("@popperjs/core").Placement;
|
|
307
247
|
}): void;
|
|
@@ -324,16 +264,6 @@ export declare const Popup: import("@workday/canvas-kit-react/common").Component
|
|
|
324
264
|
visibility: "hidden" | "visible";
|
|
325
265
|
};
|
|
326
266
|
events: {
|
|
327
|
-
/**
|
|
328
|
-
* A `Popup.Popper` is a {@link Popper} component that is hooked up to the {@link PopupModel}
|
|
329
|
-
* automatically. The behavior hook used is called {@link usePopupPopper}.
|
|
330
|
-
*
|
|
331
|
-
* > **Note:** `Popup.Popper` renders any children to a `div` element created by the
|
|
332
|
-
* > {@link PopupStack}. This element is not controlled by React, so any extra element props
|
|
333
|
-
* > will _not_ be forwarded. The `ref` will point to the `div` element created by the
|
|
334
|
-
* > `PopupStack`, however. If you wish to add extra props to an element, add them to the
|
|
335
|
-
* > {@link PopupCard Popup.Card} instead.
|
|
336
|
-
*/
|
|
337
267
|
updatePlacement(data: {
|
|
338
268
|
placement: import("@popperjs/core").Placement;
|
|
339
269
|
}): void;
|
|
@@ -358,16 +288,6 @@ export declare const Popup: import("@workday/canvas-kit-react/common").Component
|
|
|
358
288
|
visibility: "hidden" | "visible";
|
|
359
289
|
};
|
|
360
290
|
events: {
|
|
361
|
-
/**
|
|
362
|
-
* A `Popup.Popper` is a {@link Popper} component that is hooked up to the {@link PopupModel}
|
|
363
|
-
* automatically. The behavior hook used is called {@link usePopupPopper}.
|
|
364
|
-
*
|
|
365
|
-
* > **Note:** `Popup.Popper` renders any children to a `div` element created by the
|
|
366
|
-
* > {@link PopupStack}. This element is not controlled by React, so any extra element props
|
|
367
|
-
* > will _not_ be forwarded. The `ref` will point to the `div` element created by the
|
|
368
|
-
* > `PopupStack`, however. If you wish to add extra props to an element, add them to the
|
|
369
|
-
* > {@link PopupCard Popup.Card} instead.
|
|
370
|
-
*/
|
|
371
291
|
updatePlacement(data: {
|
|
372
292
|
placement: import("@popperjs/core").Placement;
|
|
373
293
|
}): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popup.d.ts","sourceRoot":"","sources":["../../../../popup/lib/Popup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,KAAK
|
|
1
|
+
{"version":3,"file":"Popup.d.ts","sourceRoot":"","sources":["../../../../popup/lib/Popup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAId;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;;;;;;;;;;;;;;;;;;;IAEH;;;;;;;;;OASG;;;;;;;;;;;;;;;;;;;IAEH;;;;OAIG;;;;;;;;;;;;;;;;;;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;;;IAEH;;;;;OAKG;;;;;;;;;;;;;;;;;;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;;;IAEH;;;;;OAKG;;;;;;;;;;;;;;;;;;;CAKL,CAAC"}
|
|
@@ -62,7 +62,7 @@ exports.Popup = common_1.createContainer()({
|
|
|
62
62
|
* const model = usePopupModel();
|
|
63
63
|
*
|
|
64
64
|
* // using this component
|
|
65
|
-
* <Popup.Target>Show Popup</
|
|
65
|
+
* <Popup.Target>Show Popup</Popup.Target>
|
|
66
66
|
*
|
|
67
67
|
* // using props instead
|
|
68
68
|
* const popupTargetButtonProps = usePopupTarget(model);
|
|
@@ -5,6 +5,13 @@ export interface DialogProps {
|
|
|
5
5
|
*/
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* This component is the container component and does not render any semantic elements. It provides
|
|
10
|
+
* a React Context model for the `Dialog` subcomponents. If you manually pass a `model` to all
|
|
11
|
+
* subcomponents, this container component isn't needed. If you do not pass a `model`, the `Dialog`
|
|
12
|
+
* container component will build a default one using `useDialogModel`. `Dialog` is a composition of a
|
|
13
|
+
* {@link Popup} component and has a similar structure to `Popup`.
|
|
14
|
+
*/
|
|
8
15
|
export declare const Dialog: import("@workday/canvas-kit-react/common").ComponentM<DialogProps & Partial<{
|
|
9
16
|
returnFocusRef: React.RefObject<any> | undefined;
|
|
10
17
|
initialFocusRef: React.RefObject<any> | undefined;
|
|
@@ -88,6 +95,10 @@ export declare const Dialog: import("@workday/canvas-kit-react/common").Componen
|
|
|
88
95
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
89
96
|
};
|
|
90
97
|
}> & {
|
|
98
|
+
/**
|
|
99
|
+
* A `Dialog.Body` is a thin wrapper around {@link CardBody Card.Body} and doesn't actually take
|
|
100
|
+
* a model. It adds `body` styling and nothing else.
|
|
101
|
+
*/
|
|
91
102
|
Body: import("@workday/canvas-kit-react/common").ElementComponentM<"div", import("../..").BackgroundStyleProps & import("../../layout/lib/utils/border/color").BorderColorStyleProps & import("../../layout/lib/utils/border/lineStyle").BorderLineStyleProps & import("../../layout/lib/utils/border/radius").BorderRadiusStyleProps & import("../../layout/lib/utils/border/shorthand").BorderShorthandStyleProps & import("../../layout/lib/utils/border/width").BorderWidthStyleProps & import("../..").ColorStyleProps & import("../..").DepthStyleProps & import("../..").FlexItemStyleProps & import("../..").GridItemStyleProps & import("../..").LayoutStyleProps & import("../..").OtherStyleProps & import("../..").PositionStyleProps & import("../..").SpaceStyleProps & import("../..").TextStyleProps & React.HTMLAttributes<HTMLDivElement>, {
|
|
92
103
|
state: {
|
|
93
104
|
stackRef: React.RefObject<HTMLDivElement>;
|
|
@@ -106,6 +117,11 @@ export declare const Dialog: import("@workday/canvas-kit-react/common").Componen
|
|
|
106
117
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
107
118
|
};
|
|
108
119
|
}>;
|
|
120
|
+
/**
|
|
121
|
+
* A `Dialog.Card` is a wrapper around the {@link Card} component, but hooked up to a
|
|
122
|
+
* {@link DialogModel}. By default, this element has a `role=dialog`, `aria-labelledby` and an `id`.
|
|
123
|
+
* The behavior hook used is called {@link useDialogCard}.
|
|
124
|
+
*/
|
|
109
125
|
Card: import("@workday/canvas-kit-react/common").ElementComponentM<"div", import("../../popup/lib/PopupCard").PopupCardProps & import("@workday/canvas-kit-react/common").PropsWithModel<{
|
|
110
126
|
state: {
|
|
111
127
|
stackRef: React.RefObject<HTMLDivElement>;
|
|
@@ -141,6 +157,10 @@ export declare const Dialog: import("@workday/canvas-kit-react/common").Componen
|
|
|
141
157
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
142
158
|
};
|
|
143
159
|
}>;
|
|
160
|
+
/**
|
|
161
|
+
* A `Dialog.CloseIcon` is an icon button that is the `X` at the top of a dialog. It will hide a
|
|
162
|
+
* dialog when clicked. The behavior hook used is called {@link usePopupCloseButton}.
|
|
163
|
+
*/
|
|
144
164
|
CloseIcon: import("@workday/canvas-kit-react/common").ElementComponentM<"button", import("../../popup/lib/PopupCloseIcon").PopupCloseIconProps, {
|
|
145
165
|
state: {
|
|
146
166
|
stackRef: React.RefObject<HTMLDivElement>;
|
|
@@ -159,6 +179,35 @@ export declare const Dialog: import("@workday/canvas-kit-react/common").Componen
|
|
|
159
179
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
160
180
|
};
|
|
161
181
|
}>;
|
|
182
|
+
/**
|
|
183
|
+
* A `Dialog.Target` is any element that is meant to show the Dialog. The default component
|
|
184
|
+
* rendered by this component is a {@link SecondaryButton} element. You can override this by
|
|
185
|
+
* passing the desired component via `as`. Many examples above use `as={DeleteButton}`. If you
|
|
186
|
+
* want to render a {@link TertiaryButton} instead, use `as={TertiaryButton}`. The behavior hook
|
|
187
|
+
* used is called {@link usePopupTarget}.
|
|
188
|
+
*
|
|
189
|
+
* ```tsx
|
|
190
|
+
* const model = useDialogModel();
|
|
191
|
+
*
|
|
192
|
+
* // using this component
|
|
193
|
+
* <Dialog.Target>Show Dialog</Dialog.Target>
|
|
194
|
+
*
|
|
195
|
+
* // using props instead
|
|
196
|
+
* const dialogTargetButtonProps = useDialogTarget(model);
|
|
197
|
+
* <SecondaryButton {...dialogTargetButtonProps}>Show Dialog</SecondaryButton>
|
|
198
|
+
* ```
|
|
199
|
+
*
|
|
200
|
+
* `Dialog.Target` doesn't provide any styling by default. All styling comes from the default
|
|
201
|
+
* component used, which is {@link SecondaryButton}. If you don't want any styling, you can do
|
|
202
|
+
* the following:
|
|
203
|
+
*
|
|
204
|
+
* ```tsx
|
|
205
|
+
* <Dialog.Target as="button">Open</Dialog.Target>
|
|
206
|
+
* ```
|
|
207
|
+
*
|
|
208
|
+
* To add your own styling, you could either add a `css` prop, or make a styled button and pass
|
|
209
|
+
* that styled component via the `as` prop.
|
|
210
|
+
*/
|
|
162
211
|
Target: import("@workday/canvas-kit-react/common").ElementComponentM<import("@workday/canvas-kit-react/common").ElementComponent<"button", import("../..").SecondaryButtonProps>, {}, {
|
|
163
212
|
state: {
|
|
164
213
|
stackRef: React.RefObject<HTMLDivElement>;
|
|
@@ -177,6 +226,12 @@ export declare const Dialog: import("@workday/canvas-kit-react/common").Componen
|
|
|
177
226
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
178
227
|
};
|
|
179
228
|
}>;
|
|
229
|
+
/**
|
|
230
|
+
* A `Dialog.Heading` is a wrapper around {@link CardHeading Card.Heading} that connect the
|
|
231
|
+
* heading to a {@link DialogModel}. It will add an `id` to the element that match the
|
|
232
|
+
* `aria-labelledby` that is applied to the `Dialog.Card` element for accessibility. The behavior
|
|
233
|
+
* hook used is called {@link usePopupHeading}.
|
|
234
|
+
*/
|
|
180
235
|
Heading: import("@workday/canvas-kit-react/common").ElementComponentM<"h2", import("../../popup/lib/PopupHeading").PopupHeadingProps, {
|
|
181
236
|
state: {
|
|
182
237
|
stackRef: React.RefObject<HTMLDivElement>;
|
|
@@ -195,6 +250,10 @@ export declare const Dialog: import("@workday/canvas-kit-react/common").Componen
|
|
|
195
250
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
196
251
|
};
|
|
197
252
|
}>;
|
|
253
|
+
/**
|
|
254
|
+
* A `Dialog.Popper` is a wrapper around {@link PopupPopper Popup.Popper}. The behavior
|
|
255
|
+
* hook used is called {@link useDialogPopper}.
|
|
256
|
+
*/
|
|
198
257
|
Popper: import("@workday/canvas-kit-react/common").ElementComponentM<"div", import("../../popup/lib/PopupPopper").PopupPopperProps & import("@workday/canvas-kit-react/common").PropsWithModel<{
|
|
199
258
|
state: {
|
|
200
259
|
stackRef: React.RefObject<HTMLDivElement>;
|
|
@@ -230,6 +289,12 @@ export declare const Dialog: import("@workday/canvas-kit-react/common").Componen
|
|
|
230
289
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
231
290
|
};
|
|
232
291
|
}>;
|
|
292
|
+
/**
|
|
293
|
+
* A `Dialog.CloseButton` is a button that will hide a dialog. By default, this is a
|
|
294
|
+
* {@link SecondaryButton} component, but `as` can be used to render any button element (i.e
|
|
295
|
+
* {@link DeleteButton} or {@link PrimaryButton}). The behavior hook used is called
|
|
296
|
+
* {@link usePopupCloseButton}.
|
|
297
|
+
*/
|
|
233
298
|
CloseButton: import("@workday/canvas-kit-react/common").ElementComponentM<import("@workday/canvas-kit-react/common").ElementComponent<"button", import("../..").SecondaryButtonProps>, import("../../popup/lib/PopupCloseButton").PopupCloseButtonProps, {
|
|
234
299
|
state: {
|
|
235
300
|
stackRef: React.RefObject<HTMLDivElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../dialog/lib/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../dialog/lib/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIf;;;OAGG;;;;;;;;;;;;;;;;;;;IAEH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;;;IAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;;;;;;;;;;;;;;;;;;;IAEH;;;;;OAKG;;;;;;;;;;;;;;;;;;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGH;;;;;OAKG;;;;;;;;;;;;;;;;;;;CAKL,CAAC"}
|
|
@@ -4,16 +4,81 @@ import { Popup } from '@workday/canvas-kit-react/popup';
|
|
|
4
4
|
import { DialogPopper } from './DialogPopper';
|
|
5
5
|
import { DialogCard } from './DialogCard';
|
|
6
6
|
import { useDialogModel } from './hooks';
|
|
7
|
+
/**
|
|
8
|
+
* This component is the container component and does not render any semantic elements. It provides
|
|
9
|
+
* a React Context model for the `Dialog` subcomponents. If you manually pass a `model` to all
|
|
10
|
+
* subcomponents, this container component isn't needed. If you do not pass a `model`, the `Dialog`
|
|
11
|
+
* container component will build a default one using `useDialogModel`. `Dialog` is a composition of a
|
|
12
|
+
* {@link Popup} component and has a similar structure to `Popup`.
|
|
13
|
+
*/
|
|
7
14
|
export const Dialog = createContainer()({
|
|
8
15
|
displayName: 'Dialog',
|
|
9
16
|
modelHook: useDialogModel,
|
|
10
17
|
subComponents: {
|
|
18
|
+
/**
|
|
19
|
+
* A `Dialog.Body` is a thin wrapper around {@link CardBody Card.Body} and doesn't actually take
|
|
20
|
+
* a model. It adds `body` styling and nothing else.
|
|
21
|
+
*/
|
|
11
22
|
Body: Popup.Body,
|
|
23
|
+
/**
|
|
24
|
+
* A `Dialog.Card` is a wrapper around the {@link Card} component, but hooked up to a
|
|
25
|
+
* {@link DialogModel}. By default, this element has a `role=dialog`, `aria-labelledby` and an `id`.
|
|
26
|
+
* The behavior hook used is called {@link useDialogCard}.
|
|
27
|
+
*/
|
|
12
28
|
Card: DialogCard,
|
|
29
|
+
/**
|
|
30
|
+
* A `Dialog.CloseIcon` is an icon button that is the `X` at the top of a dialog. It will hide a
|
|
31
|
+
* dialog when clicked. The behavior hook used is called {@link usePopupCloseButton}.
|
|
32
|
+
*/
|
|
13
33
|
CloseIcon: Popup.CloseIcon,
|
|
34
|
+
/**
|
|
35
|
+
* A `Dialog.Target` is any element that is meant to show the Dialog. The default component
|
|
36
|
+
* rendered by this component is a {@link SecondaryButton} element. You can override this by
|
|
37
|
+
* passing the desired component via `as`. Many examples above use `as={DeleteButton}`. If you
|
|
38
|
+
* want to render a {@link TertiaryButton} instead, use `as={TertiaryButton}`. The behavior hook
|
|
39
|
+
* used is called {@link usePopupTarget}.
|
|
40
|
+
*
|
|
41
|
+
* ```tsx
|
|
42
|
+
* const model = useDialogModel();
|
|
43
|
+
*
|
|
44
|
+
* // using this component
|
|
45
|
+
* <Dialog.Target>Show Dialog</Dialog.Target>
|
|
46
|
+
*
|
|
47
|
+
* // using props instead
|
|
48
|
+
* const dialogTargetButtonProps = useDialogTarget(model);
|
|
49
|
+
* <SecondaryButton {...dialogTargetButtonProps}>Show Dialog</SecondaryButton>
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* `Dialog.Target` doesn't provide any styling by default. All styling comes from the default
|
|
53
|
+
* component used, which is {@link SecondaryButton}. If you don't want any styling, you can do
|
|
54
|
+
* the following:
|
|
55
|
+
*
|
|
56
|
+
* ```tsx
|
|
57
|
+
* <Dialog.Target as="button">Open</Dialog.Target>
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* To add your own styling, you could either add a `css` prop, or make a styled button and pass
|
|
61
|
+
* that styled component via the `as` prop.
|
|
62
|
+
*/
|
|
14
63
|
Target: Popup.Target,
|
|
64
|
+
/**
|
|
65
|
+
* A `Dialog.Heading` is a wrapper around {@link CardHeading Card.Heading} that connect the
|
|
66
|
+
* heading to a {@link DialogModel}. It will add an `id` to the element that match the
|
|
67
|
+
* `aria-labelledby` that is applied to the `Dialog.Card` element for accessibility. The behavior
|
|
68
|
+
* hook used is called {@link usePopupHeading}.
|
|
69
|
+
*/
|
|
15
70
|
Heading: Popup.Heading,
|
|
71
|
+
/**
|
|
72
|
+
* A `Dialog.Popper` is a wrapper around {@link PopupPopper Popup.Popper}. The behavior
|
|
73
|
+
* hook used is called {@link useDialogPopper}.
|
|
74
|
+
*/
|
|
16
75
|
Popper: DialogPopper,
|
|
76
|
+
/**
|
|
77
|
+
* A `Dialog.CloseButton` is a button that will hide a dialog. By default, this is a
|
|
78
|
+
* {@link SecondaryButton} component, but `as` can be used to render any button element (i.e
|
|
79
|
+
* {@link DeleteButton} or {@link PrimaryButton}). The behavior hook used is called
|
|
80
|
+
* {@link usePopupCloseButton}.
|
|
81
|
+
*/
|
|
17
82
|
CloseButton: Popup.CloseButton,
|
|
18
83
|
},
|
|
19
84
|
})(({ children }) => {
|
|
@@ -98,16 +98,6 @@ export declare const Popup: import("@workday/canvas-kit-react/common").Component
|
|
|
98
98
|
visibility: "hidden" | "visible";
|
|
99
99
|
};
|
|
100
100
|
events: {
|
|
101
|
-
/**
|
|
102
|
-
* A `Popup.Popper` is a {@link Popper} component that is hooked up to the {@link PopupModel}
|
|
103
|
-
* automatically. The behavior hook used is called {@link usePopupPopper}.
|
|
104
|
-
*
|
|
105
|
-
* > **Note:** `Popup.Popper` renders any children to a `div` element created by the
|
|
106
|
-
* > {@link PopupStack}. This element is not controlled by React, so any extra element props
|
|
107
|
-
* > will _not_ be forwarded. The `ref` will point to the `div` element created by the
|
|
108
|
-
* > `PopupStack`, however. If you wish to add extra props to an element, add them to the
|
|
109
|
-
* > {@link PopupCard Popup.Card} instead.
|
|
110
|
-
*/
|
|
111
101
|
updatePlacement(data: {
|
|
112
102
|
placement: import("@popperjs/core").Placement;
|
|
113
103
|
}): void;
|
|
@@ -126,7 +116,7 @@ export declare const Popup: import("@workday/canvas-kit-react/common").Component
|
|
|
126
116
|
* const model = usePopupModel();
|
|
127
117
|
*
|
|
128
118
|
* // using this component
|
|
129
|
-
* <Popup.Target>Show Popup</
|
|
119
|
+
* <Popup.Target>Show Popup</Popup.Target>
|
|
130
120
|
*
|
|
131
121
|
* // using props instead
|
|
132
122
|
* const popupTargetButtonProps = usePopupTarget(model);
|
|
@@ -155,16 +145,6 @@ export declare const Popup: import("@workday/canvas-kit-react/common").Component
|
|
|
155
145
|
visibility: "hidden" | "visible";
|
|
156
146
|
};
|
|
157
147
|
events: {
|
|
158
|
-
/**
|
|
159
|
-
* A `Popup.Popper` is a {@link Popper} component that is hooked up to the {@link PopupModel}
|
|
160
|
-
* automatically. The behavior hook used is called {@link usePopupPopper}.
|
|
161
|
-
*
|
|
162
|
-
* > **Note:** `Popup.Popper` renders any children to a `div` element created by the
|
|
163
|
-
* > {@link PopupStack}. This element is not controlled by React, so any extra element props
|
|
164
|
-
* > will _not_ be forwarded. The `ref` will point to the `div` element created by the
|
|
165
|
-
* > `PopupStack`, however. If you wish to add extra props to an element, add them to the
|
|
166
|
-
* > {@link PopupCard Popup.Card} instead.
|
|
167
|
-
*/
|
|
168
148
|
updatePlacement(data: {
|
|
169
149
|
placement: import("@popperjs/core").Placement;
|
|
170
150
|
}): void;
|
|
@@ -193,16 +173,6 @@ export declare const Popup: import("@workday/canvas-kit-react/common").Component
|
|
|
193
173
|
visibility: "hidden" | "visible";
|
|
194
174
|
};
|
|
195
175
|
events: {
|
|
196
|
-
/**
|
|
197
|
-
* A `Popup.Popper` is a {@link Popper} component that is hooked up to the {@link PopupModel}
|
|
198
|
-
* automatically. The behavior hook used is called {@link usePopupPopper}.
|
|
199
|
-
*
|
|
200
|
-
* > **Note:** `Popup.Popper` renders any children to a `div` element created by the
|
|
201
|
-
* > {@link PopupStack}. This element is not controlled by React, so any extra element props
|
|
202
|
-
* > will _not_ be forwarded. The `ref` will point to the `div` element created by the
|
|
203
|
-
* > `PopupStack`, however. If you wish to add extra props to an element, add them to the
|
|
204
|
-
* > {@link PopupCard Popup.Card} instead.
|
|
205
|
-
*/
|
|
206
176
|
updatePlacement(data: {
|
|
207
177
|
placement: import("@popperjs/core").Placement;
|
|
208
178
|
}): void;
|
|
@@ -226,16 +196,6 @@ export declare const Popup: import("@workday/canvas-kit-react/common").Component
|
|
|
226
196
|
visibility: "hidden" | "visible";
|
|
227
197
|
};
|
|
228
198
|
events: {
|
|
229
|
-
/**
|
|
230
|
-
* A `Popup.Popper` is a {@link Popper} component that is hooked up to the {@link PopupModel}
|
|
231
|
-
* automatically. The behavior hook used is called {@link usePopupPopper}.
|
|
232
|
-
*
|
|
233
|
-
* > **Note:** `Popup.Popper` renders any children to a `div` element created by the
|
|
234
|
-
* > {@link PopupStack}. This element is not controlled by React, so any extra element props
|
|
235
|
-
* > will _not_ be forwarded. The `ref` will point to the `div` element created by the
|
|
236
|
-
* > `PopupStack`, however. If you wish to add extra props to an element, add them to the
|
|
237
|
-
* > {@link PopupCard Popup.Card} instead.
|
|
238
|
-
*/
|
|
239
199
|
updatePlacement(data: {
|
|
240
200
|
placement: import("@popperjs/core").Placement;
|
|
241
201
|
}): void;
|
|
@@ -258,16 +218,6 @@ export declare const Popup: import("@workday/canvas-kit-react/common").Component
|
|
|
258
218
|
visibility: "hidden" | "visible";
|
|
259
219
|
};
|
|
260
220
|
events: {
|
|
261
|
-
/**
|
|
262
|
-
* A `Popup.Popper` is a {@link Popper} component that is hooked up to the {@link PopupModel}
|
|
263
|
-
* automatically. The behavior hook used is called {@link usePopupPopper}.
|
|
264
|
-
*
|
|
265
|
-
* > **Note:** `Popup.Popper` renders any children to a `div` element created by the
|
|
266
|
-
* > {@link PopupStack}. This element is not controlled by React, so any extra element props
|
|
267
|
-
* > will _not_ be forwarded. The `ref` will point to the `div` element created by the
|
|
268
|
-
* > `PopupStack`, however. If you wish to add extra props to an element, add them to the
|
|
269
|
-
* > {@link PopupCard Popup.Card} instead.
|
|
270
|
-
*/
|
|
271
221
|
updatePlacement(data: {
|
|
272
222
|
placement: import("@popperjs/core").Placement;
|
|
273
223
|
}): void;
|
|
@@ -292,16 +242,6 @@ export declare const Popup: import("@workday/canvas-kit-react/common").Component
|
|
|
292
242
|
visibility: "hidden" | "visible";
|
|
293
243
|
};
|
|
294
244
|
events: {
|
|
295
|
-
/**
|
|
296
|
-
* A `Popup.Popper` is a {@link Popper} component that is hooked up to the {@link PopupModel}
|
|
297
|
-
* automatically. The behavior hook used is called {@link usePopupPopper}.
|
|
298
|
-
*
|
|
299
|
-
* > **Note:** `Popup.Popper` renders any children to a `div` element created by the
|
|
300
|
-
* > {@link PopupStack}. This element is not controlled by React, so any extra element props
|
|
301
|
-
* > will _not_ be forwarded. The `ref` will point to the `div` element created by the
|
|
302
|
-
* > `PopupStack`, however. If you wish to add extra props to an element, add them to the
|
|
303
|
-
* > {@link PopupCard Popup.Card} instead.
|
|
304
|
-
*/
|
|
305
245
|
updatePlacement(data: {
|
|
306
246
|
placement: import("@popperjs/core").Placement;
|
|
307
247
|
}): void;
|
|
@@ -324,16 +264,6 @@ export declare const Popup: import("@workday/canvas-kit-react/common").Component
|
|
|
324
264
|
visibility: "hidden" | "visible";
|
|
325
265
|
};
|
|
326
266
|
events: {
|
|
327
|
-
/**
|
|
328
|
-
* A `Popup.Popper` is a {@link Popper} component that is hooked up to the {@link PopupModel}
|
|
329
|
-
* automatically. The behavior hook used is called {@link usePopupPopper}.
|
|
330
|
-
*
|
|
331
|
-
* > **Note:** `Popup.Popper` renders any children to a `div` element created by the
|
|
332
|
-
* > {@link PopupStack}. This element is not controlled by React, so any extra element props
|
|
333
|
-
* > will _not_ be forwarded. The `ref` will point to the `div` element created by the
|
|
334
|
-
* > `PopupStack`, however. If you wish to add extra props to an element, add them to the
|
|
335
|
-
* > {@link PopupCard Popup.Card} instead.
|
|
336
|
-
*/
|
|
337
267
|
updatePlacement(data: {
|
|
338
268
|
placement: import("@popperjs/core").Placement;
|
|
339
269
|
}): void;
|
|
@@ -358,16 +288,6 @@ export declare const Popup: import("@workday/canvas-kit-react/common").Component
|
|
|
358
288
|
visibility: "hidden" | "visible";
|
|
359
289
|
};
|
|
360
290
|
events: {
|
|
361
|
-
/**
|
|
362
|
-
* A `Popup.Popper` is a {@link Popper} component that is hooked up to the {@link PopupModel}
|
|
363
|
-
* automatically. The behavior hook used is called {@link usePopupPopper}.
|
|
364
|
-
*
|
|
365
|
-
* > **Note:** `Popup.Popper` renders any children to a `div` element created by the
|
|
366
|
-
* > {@link PopupStack}. This element is not controlled by React, so any extra element props
|
|
367
|
-
* > will _not_ be forwarded. The `ref` will point to the `div` element created by the
|
|
368
|
-
* > `PopupStack`, however. If you wish to add extra props to an element, add them to the
|
|
369
|
-
* > {@link PopupCard Popup.Card} instead.
|
|
370
|
-
*/
|
|
371
291
|
updatePlacement(data: {
|
|
372
292
|
placement: import("@popperjs/core").Placement;
|
|
373
293
|
}): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popup.d.ts","sourceRoot":"","sources":["../../../../popup/lib/Popup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,KAAK
|
|
1
|
+
{"version":3,"file":"Popup.d.ts","sourceRoot":"","sources":["../../../../popup/lib/Popup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAId;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;;;;;;;;;;;;;;;;;;;IAEH;;;;;;;;;OASG;;;;;;;;;;;;;;;;;;;IAEH;;;;OAIG;;;;;;;;;;;;;;;;;;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;;;IAEH;;;;;OAKG;;;;;;;;;;;;;;;;;;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;;;IAEH;;;;;OAKG;;;;;;;;;;;;;;;;;;;CAKL,CAAC"}
|
|
@@ -40,7 +40,7 @@ export const Popup = createContainer()({
|
|
|
40
40
|
* const model = usePopupModel();
|
|
41
41
|
*
|
|
42
42
|
* // using this component
|
|
43
|
-
* <Popup.Target>Show Popup</
|
|
43
|
+
* <Popup.Target>Show Popup</Popup.Target>
|
|
44
44
|
*
|
|
45
45
|
* // using props instead
|
|
46
46
|
* const popupTargetButtonProps = usePopupTarget(model);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-react",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.413-next.15+76b571ed",
|
|
4
4
|
"description": "The parent module that contains all Workday Canvas Kit React components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@emotion/styled": "^11.6.0",
|
|
50
50
|
"@popperjs/core": "^2.5.4",
|
|
51
51
|
"@workday/canvas-colors-web": "^2.0.0",
|
|
52
|
-
"@workday/canvas-kit-popup-stack": "^9.0.0-alpha.
|
|
52
|
+
"@workday/canvas-kit-popup-stack": "^9.0.0-alpha.413-next.15+76b571ed",
|
|
53
53
|
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
54
54
|
"@workday/design-assets-types": "^0.2.8",
|
|
55
55
|
"chroma-js": "^2.1.0",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"@workday/canvas-accent-icons-web": "^3.0.0",
|
|
67
67
|
"@workday/canvas-applet-icons-web": "^2.0.0"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "76b571ed215127f6badf7a3834a761709aac303d"
|
|
70
70
|
}
|
package/popup/lib/Popup.tsx
CHANGED
|
@@ -50,7 +50,7 @@ export const Popup = createContainer()({
|
|
|
50
50
|
* const model = usePopupModel();
|
|
51
51
|
*
|
|
52
52
|
* // using this component
|
|
53
|
-
* <Popup.Target>Show Popup</
|
|
53
|
+
* <Popup.Target>Show Popup</Popup.Target>
|
|
54
54
|
*
|
|
55
55
|
* // using props instead
|
|
56
56
|
* const popupTargetButtonProps = usePopupTarget(model);
|