@workday/canvas-kit-react 9.0.0-alpha.412-next.14 → 9.0.0-alpha.414-next.16
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/collection/lib/useCursorListModel.tsx +2 -2
- package/collection/lib/useListItemRegister.tsx +4 -2
- package/common/lib/utils/index.ts +1 -0
- package/common/lib/utils/slugify.ts +11 -0
- package/dialog/lib/Dialog.tsx +66 -0
- package/dist/commonjs/action-bar/lib/ActionBarItem.d.ts +1 -0
- package/dist/commonjs/action-bar/lib/ActionBarItem.d.ts.map +1 -1
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsCurrentItem.d.ts +1 -0
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsCurrentItem.d.ts.map +1 -1
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsItem.d.ts +1 -0
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsItem.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useCursorListModel.d.ts +34 -0
- package/dist/commonjs/collection/lib/useCursorListModel.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useCursorListModel.js +1 -1
- package/dist/commonjs/collection/lib/useListItemRegister.d.ts +1 -0
- package/dist/commonjs/collection/lib/useListItemRegister.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useListItemRegister.js +3 -2
- package/dist/commonjs/common/lib/utils/index.d.ts +1 -0
- package/dist/commonjs/common/lib/utils/index.d.ts.map +1 -1
- package/dist/commonjs/common/lib/utils/index.js +1 -0
- package/dist/commonjs/common/lib/utils/slugify.d.ts +5 -0
- package/dist/commonjs/common/lib/utils/slugify.d.ts.map +1 -0
- package/dist/commonjs/common/lib/utils/slugify.js +15 -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/menu/lib/MenuItem.d.ts +1 -0
- package/dist/commonjs/menu/lib/MenuItem.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/MenuItem.js +2 -2
- 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/commonjs/tabs/lib/TabsItem.d.ts +1 -0
- package/dist/commonjs/tabs/lib/TabsItem.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/TabsPanel.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/TabsPanel.js +2 -2
- package/dist/es6/action-bar/lib/ActionBarItem.d.ts +1 -0
- package/dist/es6/action-bar/lib/ActionBarItem.d.ts.map +1 -1
- package/dist/es6/breadcrumbs/lib/BreadcrumbsCurrentItem.d.ts +1 -0
- package/dist/es6/breadcrumbs/lib/BreadcrumbsCurrentItem.d.ts.map +1 -1
- package/dist/es6/breadcrumbs/lib/BreadcrumbsItem.d.ts +1 -0
- package/dist/es6/breadcrumbs/lib/BreadcrumbsItem.d.ts.map +1 -1
- package/dist/es6/collection/lib/useCursorListModel.d.ts +34 -0
- package/dist/es6/collection/lib/useCursorListModel.d.ts.map +1 -1
- package/dist/es6/collection/lib/useCursorListModel.js +2 -2
- package/dist/es6/collection/lib/useListItemRegister.d.ts +1 -0
- package/dist/es6/collection/lib/useListItemRegister.d.ts.map +1 -1
- package/dist/es6/collection/lib/useListItemRegister.js +4 -3
- package/dist/es6/common/lib/utils/index.d.ts +1 -0
- package/dist/es6/common/lib/utils/index.d.ts.map +1 -1
- package/dist/es6/common/lib/utils/index.js +1 -0
- package/dist/es6/common/lib/utils/slugify.d.ts +5 -0
- package/dist/es6/common/lib/utils/slugify.d.ts.map +1 -0
- package/dist/es6/common/lib/utils/slugify.js +11 -0
- 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/menu/lib/MenuItem.d.ts +1 -0
- package/dist/es6/menu/lib/MenuItem.d.ts.map +1 -1
- package/dist/es6/menu/lib/MenuItem.js +2 -2
- 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/dist/es6/tabs/lib/TabsItem.d.ts +1 -0
- package/dist/es6/tabs/lib/TabsItem.d.ts.map +1 -1
- package/dist/es6/tabs/lib/TabsPanel.d.ts.map +1 -1
- package/dist/es6/tabs/lib/TabsPanel.js +3 -3
- package/menu/lib/MenuItem.tsx +2 -2
- package/package.json +3 -3
- package/popup/lib/Popup.tsx +1 -1
- package/tabs/lib/TabsPanel.tsx +3 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {assert, createModelHook, Generic} from '@workday/canvas-kit-react/common';
|
|
3
3
|
|
|
4
|
-
import {useBaseListModel, Item
|
|
4
|
+
import {useBaseListModel, Item} from './useBaseListModel';
|
|
5
5
|
|
|
6
6
|
type NavigationInput = Pick<ReturnType<typeof useCursorListModel>, 'state'>;
|
|
7
7
|
|
|
@@ -365,7 +365,7 @@ export const useCursorListModel = createModelHook({
|
|
|
365
365
|
registerItem(data: Parameters<typeof list.events.registerItem>[0]) {
|
|
366
366
|
// point the cursor at the first item
|
|
367
367
|
if (!initialCurrentRef.current) {
|
|
368
|
-
initialCurrentRef.current = getId(data.item);
|
|
368
|
+
initialCurrentRef.current = list.getId(data.item);
|
|
369
369
|
setCursorId(initialCurrentRef.current);
|
|
370
370
|
}
|
|
371
371
|
list.events.registerItem(data);
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
createElemPropsHook,
|
|
6
6
|
useLocalRef,
|
|
7
7
|
useForkRef,
|
|
8
|
+
slugify,
|
|
8
9
|
} from '@workday/canvas-kit-react/common';
|
|
9
10
|
|
|
10
11
|
import {Item} from './useBaseListModel';
|
|
@@ -26,7 +27,7 @@ import {useListModel} from './useListModel';
|
|
|
26
27
|
*/
|
|
27
28
|
export const useListItemRegister = createElemPropsHook(useListModel)(
|
|
28
29
|
(
|
|
29
|
-
{state, events
|
|
30
|
+
{state, events},
|
|
30
31
|
ref?: React.Ref<HTMLElement>,
|
|
31
32
|
elemProps: {
|
|
32
33
|
'data-id'?: string;
|
|
@@ -64,7 +65,7 @@ export const useListItemRegister = createElemPropsHook(useListModel)(
|
|
|
64
65
|
|
|
65
66
|
// TODO: Better lookup that using `items.find`. We need a more generic collection to handle seeing if an item already exists
|
|
66
67
|
// bail early if item already exists. This happens if items were already provided.
|
|
67
|
-
if (state.items.find(item =>
|
|
68
|
+
if (state.items.find(item => item.id === itemId)) {
|
|
68
69
|
return;
|
|
69
70
|
}
|
|
70
71
|
events.registerItem({
|
|
@@ -89,6 +90,7 @@ export const useListItemRegister = createElemPropsHook(useListModel)(
|
|
|
89
90
|
'aria-setsize': elemProps.virtual?.size,
|
|
90
91
|
'aria-posinset': elemProps.virtual ? elemProps.item!.index + 1 : undefined,
|
|
91
92
|
style,
|
|
93
|
+
id: slugify(`${state.id}-${localId}`),
|
|
92
94
|
};
|
|
93
95
|
}
|
|
94
96
|
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function that takes a string and returns a "slug" which can be used in HTML
|
|
3
|
+
*/
|
|
4
|
+
export function slugify(input: string): string {
|
|
5
|
+
return input
|
|
6
|
+
.trim()
|
|
7
|
+
.replace(/[^\w\s-]/g, '')
|
|
8
|
+
.replace(/[\s_-]+/g, '-')
|
|
9
|
+
.replace(/^-+|-+$/g, '')
|
|
10
|
+
.toLowerCase();
|
|
11
|
+
}
|
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) => {
|
|
@@ -107,6 +107,7 @@ export declare const useActionBarItem: import("@workday/canvas-kit-react/common"
|
|
|
107
107
|
'aria-setsize': number | undefined;
|
|
108
108
|
'aria-posinset': number | undefined;
|
|
109
109
|
style: React.CSSProperties;
|
|
110
|
+
id: string;
|
|
110
111
|
}>;
|
|
111
112
|
export declare const ActionBarItem: import("@workday/canvas-kit-react/common").ElementComponentM<import("@workday/canvas-kit-react/common").ElementComponent<"button", import("@workday/canvas-kit-react/button").SecondaryButtonProps>, ActionBarItemProps, {
|
|
112
113
|
state: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBarItem.d.ts","sourceRoot":"","sources":["../../../../action-bar/lib/ActionBarItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,MAAM,WAAW,kBAAkB;IACjC;;;;;;OAMG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"ActionBarItem.d.ts","sourceRoot":"","sources":["../../../../action-bar/lib/ActionBarItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,MAAM,WAAW,kBAAkB;IACjC;;;;;;OAMG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAgE,CAAC;AAE9F,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMxB,CAAC"}
|
|
@@ -168,6 +168,7 @@ export declare const useBreadcrumbsItem: import("@workday/canvas-kit-react/commo
|
|
|
168
168
|
'aria-setsize': number | undefined;
|
|
169
169
|
'aria-posinset': number | undefined;
|
|
170
170
|
style: React.CSSProperties;
|
|
171
|
+
id: string;
|
|
171
172
|
}>;
|
|
172
173
|
export declare const BreadcrumbsCurrentItem: import("@workday/canvas-kit-react/common").ElementComponentM<"li", BreadcrumbsCurrentItemProps, {
|
|
173
174
|
state: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreadcrumbsCurrentItem.d.ts","sourceRoot":"","sources":["../../../../breadcrumbs/lib/BreadcrumbsCurrentItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAkB,oBAAoB,EAAC,MAAM,mCAAmC,CAAC;AAMxF,OAAO,EAAO,SAAS,EAAC,MAAM,gCAAgC,CAAC;AAE/D,MAAM,WAAW,2BAA4B,SAAQ,SAAS;IAC5D,YAAY,CAAC,EAAE,oBAAoB,CAAC;CACrC;AAED,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"BreadcrumbsCurrentItem.d.ts","sourceRoot":"","sources":["../../../../breadcrumbs/lib/BreadcrumbsCurrentItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAkB,oBAAoB,EAAC,MAAM,mCAAmC,CAAC;AAMxF,OAAO,EAAO,SAAS,EAAC,MAAM,gCAAgC,CAAC;AAE/D,MAAM,WAAW,2BAA4B,SAAQ,SAAS;IAC5D,YAAY,CAAC,EAAE,oBAAoB,CAAC;CACrC;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkB9B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBlC,CAAC"}
|
|
@@ -111,6 +111,7 @@ export declare const useBreadcrumbsItem: import("@workday/canvas-kit-react/commo
|
|
|
111
111
|
'aria-setsize': number | undefined;
|
|
112
112
|
'aria-posinset': number | undefined;
|
|
113
113
|
style: React.CSSProperties;
|
|
114
|
+
id: string;
|
|
114
115
|
}>;
|
|
115
116
|
export declare const BreadcrumbsItem: import("@workday/canvas-kit-react/common").ElementComponentM<"li", BreadcrumbsItemProps, {
|
|
116
117
|
state: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreadcrumbsItem.d.ts","sourceRoot":"","sources":["../../../../breadcrumbs/lib/BreadcrumbsItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,EAAO,SAAS,EAAC,MAAM,kCAAkC,CAAC;AAOjE,MAAM,WAAW,oBAAqB,SAAQ,SAAS;IACrD;;;;;;OAMG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"BreadcrumbsItem.d.ts","sourceRoot":"","sources":["../../../../breadcrumbs/lib/BreadcrumbsItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,EAAO,SAAS,EAAC,MAAM,kCAAkC,CAAC;AAOjE,MAAM,WAAW,oBAAqB,SAAQ,SAAS;IACrD;;;;;;OAMG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoB9B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwB1B,CAAC"}
|
|
@@ -139,6 +139,23 @@ export declare const useCursorListModel: (<TT_Special_Generic>(config?: (Partial
|
|
|
139
139
|
pageSize: number;
|
|
140
140
|
id: string;
|
|
141
141
|
getId: (item: any) => string;
|
|
142
|
+
/**
|
|
143
|
+
* Factory function that does type checking to create navigation managers. Navigation managers
|
|
144
|
+
* are expected to handle all methods of a grid. If your use-case isn't meant to handle a grid,
|
|
145
|
+
* pick one of the existing navigation managers and override the methods you wish to implement.
|
|
146
|
+
*
|
|
147
|
+
* For example,
|
|
148
|
+
* ```tsx
|
|
149
|
+
* import {createNavigationManager, wrappingNavigationManager} from '@workday/canvas-kit-react/collection'
|
|
150
|
+
*
|
|
151
|
+
* const navigationManager = createNavigationManager({
|
|
152
|
+
* ...wrappingNavigationManager,
|
|
153
|
+
* getNext(id, {state}) {
|
|
154
|
+
* //
|
|
155
|
+
* }
|
|
156
|
+
* })
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
142
159
|
getTextValue: (item: any) => string;
|
|
143
160
|
nonInteractiveIds: string[];
|
|
144
161
|
orientation: import("./useBaseListModel").Orientation;
|
|
@@ -1122,6 +1139,23 @@ export declare const useCursorListModel: (<TT_Special_Generic>(config?: (Partial
|
|
|
1122
1139
|
pageSize: number;
|
|
1123
1140
|
id: string;
|
|
1124
1141
|
getId: (item: any) => string;
|
|
1142
|
+
/**
|
|
1143
|
+
* Factory function that does type checking to create navigation managers. Navigation managers
|
|
1144
|
+
* are expected to handle all methods of a grid. If your use-case isn't meant to handle a grid,
|
|
1145
|
+
* pick one of the existing navigation managers and override the methods you wish to implement.
|
|
1146
|
+
*
|
|
1147
|
+
* For example,
|
|
1148
|
+
* ```tsx
|
|
1149
|
+
* import {createNavigationManager, wrappingNavigationManager} from '@workday/canvas-kit-react/collection'
|
|
1150
|
+
*
|
|
1151
|
+
* const navigationManager = createNavigationManager({
|
|
1152
|
+
* ...wrappingNavigationManager,
|
|
1153
|
+
* getNext(id, {state}) {
|
|
1154
|
+
* //
|
|
1155
|
+
* }
|
|
1156
|
+
* })
|
|
1157
|
+
* ```
|
|
1158
|
+
*/
|
|
1125
1159
|
getTextValue: (item: any) => string;
|
|
1126
1160
|
nonInteractiveIds: string[];
|
|
1127
1161
|
orientation: import("./useBaseListModel").Orientation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCursorListModel.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useCursorListModel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA0B,OAAO,EAAC,MAAM,kCAAkC,CAAC;AAElF,OAAO,EAAmB,IAAI,
|
|
1
|
+
{"version":3,"file":"useCursorListModel.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useCursorListModel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA0B,OAAO,EAAC,MAAM,kCAAkC,CAAC;AAElF,OAAO,EAAmB,IAAI,EAAC,MAAM,oBAAoB,CAAC;AAE1D,aAAK,eAAe,GAAG,IAAI,CAAC,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;;;;;;;;QAMH;;;WAGG;;;;;QASH,mEAAmE;mBACxD;YAAC,EAAE,EAAE,MAAM,CAAA;SAAC;QAIvB;;;;;WAKG;;QAKH;;;WAGG;;QAKH;;;;;WAKG;;QAOH;;;;;WAKG;;QAKH,mDAAmD;;QAKnD,kDAAkD;;;;;;;;;;;;;;;;IArIlD;;OAEG;;IAEH;;;OAGG;;IAEH;;;;;;;;;;;OAWG;;IAEH;;;OAGG;;;;IAzQP;;;;;;;;;;;;;;;;OAgBG;;;;;;;;IAsRC,wDAAwD;;IAExD;;;;OAIG;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;;IAMH;;;OAGG;;;;;IASH,mEAAmE;eACxD;QAAC,EAAE,EAAE,MAAM,CAAA;KAAC;IAIvB;;;;;OAKG;;IAKH;;;OAGG;;IAKH;;;;;OAKG;;IAOH;;;;;OAKG;;IAKH,mDAAmD;;IAKnD,kDAAkD;;;;;;;;;;;;;;QA/ElD,wDAAwD;;QAExD;;;;WAIG;;QAEH;;;WAGG;;;;;;;;;;;;;;;;;;;QAMH;;;WAGG;;;;;QASH,mEAAmE;mBACxD;YAAC,EAAE,EAAE,MAAM,CAAA;SAAC;QAIvB;;;;;WAKG;;QAKH;;;WAGG;;QAKH;;;;;WAKG;;QAOH;;;;;WAKG;;QAKH,mDAAmD;;QAKnD,kDAAkD;;;;;;;;;;;;;;;EA0BpD,CAAC"}
|
|
@@ -301,7 +301,7 @@ exports.useCursorListModel = common_1.createModelHook({
|
|
|
301
301
|
registerItem(data) {
|
|
302
302
|
// point the cursor at the first item
|
|
303
303
|
if (!initialCurrentRef.current) {
|
|
304
|
-
initialCurrentRef.current =
|
|
304
|
+
initialCurrentRef.current = list.getId(data.item);
|
|
305
305
|
setCursorId(initialCurrentRef.current);
|
|
306
306
|
}
|
|
307
307
|
list.events.registerItem(data);
|
|
@@ -79,5 +79,6 @@ export declare const useListItemRegister: import("@workday/canvas-kit-react/comm
|
|
|
79
79
|
'aria-setsize': number | undefined;
|
|
80
80
|
'aria-posinset': number | undefined;
|
|
81
81
|
style: React.CSSProperties;
|
|
82
|
+
id: string;
|
|
82
83
|
}>;
|
|
83
84
|
//# sourceMappingURL=useListItemRegister.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useListItemRegister.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useListItemRegister.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useListItemRegister.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useListItemRegister.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAU3C,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAG5C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoE/B,CAAC"}
|
|
@@ -20,7 +20,7 @@ const useListModel_1 = require("./useListModel");
|
|
|
20
20
|
* );
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
-
exports.useListItemRegister = common_1.createElemPropsHook(useListModel_1.useListModel)(({ state, events
|
|
23
|
+
exports.useListItemRegister = common_1.createElemPropsHook(useListModel_1.useListModel)(({ state, events }, ref, elemProps = {}) => {
|
|
24
24
|
var _a, _b, _c;
|
|
25
25
|
const [localId, setLocalId] = react_1.default.useState(elemProps['data-id'] || ((_a = elemProps.item) === null || _a === void 0 ? void 0 : _a.id) || '');
|
|
26
26
|
const { localRef, elementRef } = common_1.useLocalRef(common_1.useForkRef(ref, (_b = elemProps.virtual) === null || _b === void 0 ? void 0 : _b.measureRef));
|
|
@@ -47,7 +47,7 @@ exports.useListItemRegister = common_1.createElemPropsHook(useListModel_1.useLis
|
|
|
47
47
|
const itemId = localId || String(defaultId);
|
|
48
48
|
// TODO: Better lookup that using `items.find`. We need a more generic collection to handle seeing if an item already exists
|
|
49
49
|
// bail early if item already exists. This happens if items were already provided.
|
|
50
|
-
if (state.items.find(item =>
|
|
50
|
+
if (state.items.find(item => item.id === itemId)) {
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
53
|
events.registerItem({
|
|
@@ -70,5 +70,6 @@ exports.useListItemRegister = common_1.createElemPropsHook(useListModel_1.useLis
|
|
|
70
70
|
'aria-setsize': (_c = elemProps.virtual) === null || _c === void 0 ? void 0 : _c.size,
|
|
71
71
|
'aria-posinset': elemProps.virtual ? elemProps.item.index + 1 : undefined,
|
|
72
72
|
style,
|
|
73
|
+
id: common_1.slugify(`${state.id}-${localId}`),
|
|
73
74
|
};
|
|
74
75
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../common/lib/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../common/lib/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC"}
|
|
@@ -22,6 +22,7 @@ __exportStar(require("./assert"), exports);
|
|
|
22
22
|
__exportStar(require("./useMount"), exports);
|
|
23
23
|
__exportStar(require("./components"), exports);
|
|
24
24
|
__exportStar(require("./models"), exports);
|
|
25
|
+
__exportStar(require("./slugify"), exports);
|
|
25
26
|
__exportStar(require("./elements"), exports);
|
|
26
27
|
__exportStar(require("./useConstant"), exports);
|
|
27
28
|
__exportStar(require("./useIsFullscreen"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slugify.d.ts","sourceRoot":"","sources":["../../../../../common/lib/utils/slugify.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO7C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.slugify = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Function that takes a string and returns a "slug" which can be used in HTML
|
|
6
|
+
*/
|
|
7
|
+
function slugify(input) {
|
|
8
|
+
return input
|
|
9
|
+
.trim()
|
|
10
|
+
.replace(/[^\w\s-]/g, '')
|
|
11
|
+
.replace(/[\s_-]+/g, '-')
|
|
12
|
+
.replace(/^-+|-+$/g, '')
|
|
13
|
+
.toLowerCase();
|
|
14
|
+
}
|
|
15
|
+
exports.slugify = slugify;
|
|
@@ -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 }) => {
|
|
@@ -107,6 +107,7 @@ export declare const useMenuItem: import("@workday/canvas-kit-react/common").Beh
|
|
|
107
107
|
'aria-setsize': number | undefined;
|
|
108
108
|
'aria-posinset': number | undefined;
|
|
109
109
|
style: React.CSSProperties;
|
|
110
|
+
id: string;
|
|
110
111
|
}>;
|
|
111
112
|
export declare const MenuItem: import("@workday/canvas-kit-react/common").ElementComponentM<"button", MenuItemProps, {
|
|
112
113
|
state: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../../../../menu/lib/MenuItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAsB/B,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AA4FD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBA0BF,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../../../../menu/lib/MenuItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAsB/B,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AA4FD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBA0BF,MAAM,cAAc;;;;;;;;;;;;;;;;;;;EAazC,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBnB,CAAC"}
|
|
@@ -128,10 +128,10 @@ exports.useMenuItem = common_1.composeHooks(common_1.createElemPropsHook(useMenu
|
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
// We only need to run when the ID has changed. If the static API is used, the first time
|
|
131
|
+
// We only need to run when the ID or cursorId has changed. If the static API is used, the first time
|
|
132
132
|
// this is run, the id will be blank
|
|
133
133
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
134
|
-
}, [id]);
|
|
134
|
+
}, [id, model.state.cursorId]);
|
|
135
135
|
return {
|
|
136
136
|
ref: elementRef,
|
|
137
137
|
role: 'menuitem',
|