@workday/canvas-kit-labs-react 7.1.4 → 7.2.0-427-next.2
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/combobox/README.md +4 -4
- package/combobox/index.ts +0 -4
- package/combobox/lib/AutocompleteList.tsx +5 -8
- package/combobox/lib/Combobox.tsx +14 -20
- package/combobox/lib/Status.tsx +1 -3
- package/combobox/package.json +2 -1
- package/common/index.ts +0 -2
- package/common/lib/theming/index.ts +0 -1
- package/common/lib/theming/useThemeRTL.ts +14 -13
- package/common/package.json +2 -1
- package/dist/commonjs/combobox/index.d.ts +0 -3
- package/dist/commonjs/combobox/index.d.ts.map +1 -1
- package/dist/commonjs/combobox/index.js +0 -7
- package/dist/commonjs/combobox/lib/AutocompleteList.d.ts +4 -5
- package/dist/commonjs/combobox/lib/AutocompleteList.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/AutocompleteList.js +33 -53
- package/dist/commonjs/combobox/lib/Combobox.d.ts +4 -6
- package/dist/commonjs/combobox/lib/Combobox.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/Combobox.js +110 -142
- package/dist/commonjs/combobox/lib/Status.d.ts +1 -2
- package/dist/commonjs/combobox/lib/Status.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/Status.js +11 -11
- package/dist/commonjs/common/index.d.ts +0 -2
- package/dist/commonjs/common/index.d.ts.map +1 -1
- package/dist/commonjs/common/index.js +0 -5
- package/dist/commonjs/common/lib/theming/index.d.ts +0 -1
- package/dist/commonjs/common/lib/theming/index.d.ts.map +1 -1
- package/dist/commonjs/common/lib/theming/index.js +0 -1
- package/dist/commonjs/common/lib/theming/useThemeRTL.d.ts +3 -0
- package/dist/commonjs/common/lib/theming/useThemeRTL.d.ts.map +1 -1
- package/dist/commonjs/common/lib/theming/useThemeRTL.js +21 -46
- package/dist/commonjs/expandable/index.d.ts +3 -0
- package/dist/commonjs/expandable/index.d.ts.map +1 -0
- package/dist/commonjs/{drawer → expandable}/index.js +2 -10
- package/dist/commonjs/expandable/lib/Expandable.d.ts +108 -0
- package/dist/commonjs/expandable/lib/Expandable.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/Expandable.js +59 -0
- package/dist/commonjs/expandable/lib/ExpandableAvatar.d.ts +7 -0
- package/dist/commonjs/expandable/lib/ExpandableAvatar.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/ExpandableAvatar.js +23 -0
- package/dist/commonjs/expandable/lib/ExpandableContent.d.ts +21 -0
- package/dist/commonjs/expandable/lib/ExpandableContent.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/ExpandableContent.js +18 -0
- package/dist/commonjs/expandable/lib/ExpandableIcon.d.ts +29 -0
- package/dist/commonjs/expandable/lib/ExpandableIcon.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/ExpandableIcon.js +31 -0
- package/dist/commonjs/expandable/lib/ExpandableTarget.d.ts +33 -0
- package/dist/commonjs/expandable/lib/ExpandableTarget.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/ExpandableTarget.js +32 -0
- package/dist/commonjs/expandable/lib/ExpandableTitle.d.ts +11 -0
- package/dist/commonjs/expandable/lib/ExpandableTitle.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/ExpandableTitle.js +16 -0
- package/dist/commonjs/expandable/lib/hooks/index.d.ts +5 -0
- package/dist/commonjs/expandable/lib/hooks/index.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/hooks/index.js +16 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableContent.d.ts +18 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableContent.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableContent.js +11 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableIcon.d.ts +13 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableIcon.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableIcon.js +10 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableModel.d.ts +53 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableModel.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableModel.js +22 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableTarget.d.ts +15 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableTarget.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableTarget.js +19 -0
- package/dist/commonjs/index.d.ts +1 -2
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +1 -2
- package/dist/commonjs/search-form/lib/SearchForm.d.ts +7 -3
- package/dist/commonjs/search-form/lib/SearchForm.d.ts.map +1 -1
- package/dist/commonjs/search-form/lib/SearchForm.js +118 -145
- package/dist/commonjs/search-form/lib/themes.js +7 -8
- package/dist/es6/combobox/index.d.ts +0 -3
- package/dist/es6/combobox/index.d.ts.map +1 -1
- package/dist/es6/combobox/index.js +0 -3
- package/dist/es6/combobox/lib/AutocompleteList.d.ts +4 -5
- package/dist/es6/combobox/lib/AutocompleteList.d.ts.map +1 -1
- package/dist/es6/combobox/lib/AutocompleteList.js +26 -48
- package/dist/es6/combobox/lib/Combobox.d.ts +4 -6
- package/dist/es6/combobox/lib/Combobox.d.ts.map +1 -1
- package/dist/es6/combobox/lib/Combobox.js +98 -131
- package/dist/es6/combobox/lib/Status.d.ts +1 -2
- package/dist/es6/combobox/lib/Status.d.ts.map +1 -1
- package/dist/es6/combobox/lib/Status.js +6 -8
- package/dist/es6/common/index.d.ts +0 -2
- package/dist/es6/common/index.d.ts.map +1 -1
- package/dist/es6/common/index.js +0 -2
- package/dist/es6/common/lib/theming/index.d.ts +0 -1
- package/dist/es6/common/lib/theming/index.d.ts.map +1 -1
- package/dist/es6/common/lib/theming/index.js +0 -1
- package/dist/es6/common/lib/theming/useThemeRTL.d.ts +3 -0
- package/dist/es6/common/lib/theming/useThemeRTL.d.ts.map +1 -1
- package/dist/es6/common/lib/theming/useThemeRTL.js +19 -44
- package/dist/es6/expandable/index.d.ts +3 -0
- package/dist/es6/expandable/index.d.ts.map +1 -0
- package/dist/es6/expandable/index.js +2 -0
- package/dist/es6/expandable/lib/Expandable.d.ts +108 -0
- package/dist/es6/expandable/lib/Expandable.d.ts.map +1 -0
- package/dist/es6/expandable/lib/Expandable.js +53 -0
- package/dist/es6/expandable/lib/ExpandableAvatar.d.ts +7 -0
- package/dist/es6/expandable/lib/ExpandableAvatar.d.ts.map +1 -0
- package/dist/es6/expandable/lib/ExpandableAvatar.js +17 -0
- package/dist/es6/expandable/lib/ExpandableContent.d.ts +21 -0
- package/dist/es6/expandable/lib/ExpandableContent.d.ts.map +1 -0
- package/dist/es6/expandable/lib/ExpandableContent.js +12 -0
- package/dist/es6/expandable/lib/ExpandableIcon.d.ts +29 -0
- package/dist/es6/expandable/lib/ExpandableIcon.d.ts.map +1 -0
- package/dist/es6/expandable/lib/ExpandableIcon.js +25 -0
- package/dist/es6/expandable/lib/ExpandableTarget.d.ts +33 -0
- package/dist/es6/expandable/lib/ExpandableTarget.d.ts.map +1 -0
- package/dist/es6/expandable/lib/ExpandableTarget.js +26 -0
- package/dist/es6/expandable/lib/ExpandableTitle.d.ts +11 -0
- package/dist/es6/expandable/lib/ExpandableTitle.d.ts.map +1 -0
- package/dist/es6/expandable/lib/ExpandableTitle.js +10 -0
- package/dist/es6/expandable/lib/hooks/index.d.ts +5 -0
- package/dist/es6/expandable/lib/hooks/index.d.ts.map +1 -0
- package/dist/es6/expandable/lib/hooks/index.js +4 -0
- package/dist/es6/expandable/lib/hooks/useExpandableContent.d.ts +18 -0
- package/dist/es6/expandable/lib/hooks/useExpandableContent.d.ts.map +1 -0
- package/dist/es6/expandable/lib/hooks/useExpandableContent.js +8 -0
- package/dist/es6/expandable/lib/hooks/useExpandableIcon.d.ts +13 -0
- package/dist/es6/expandable/lib/hooks/useExpandableIcon.d.ts.map +1 -0
- package/dist/es6/expandable/lib/hooks/useExpandableIcon.js +7 -0
- package/dist/es6/expandable/lib/hooks/useExpandableModel.d.ts +53 -0
- package/dist/es6/expandable/lib/hooks/useExpandableModel.d.ts.map +1 -0
- package/dist/es6/expandable/lib/hooks/useExpandableModel.js +19 -0
- package/dist/es6/expandable/lib/hooks/useExpandableTarget.d.ts +15 -0
- package/dist/es6/expandable/lib/hooks/useExpandableTarget.d.ts.map +1 -0
- package/dist/es6/expandable/lib/hooks/useExpandableTarget.js +16 -0
- package/dist/es6/index.d.ts +1 -2
- package/dist/es6/index.d.ts.map +1 -1
- package/dist/es6/index.js +1 -2
- package/dist/es6/search-form/lib/SearchForm.d.ts +7 -3
- package/dist/es6/search-form/lib/SearchForm.d.ts.map +1 -1
- package/dist/es6/search-form/lib/SearchForm.js +108 -136
- package/dist/es6/search-form/lib/themes.js +5 -6
- package/{drawer → expandable}/LICENSE +2 -1
- package/expandable/README.md +11 -0
- package/expandable/index.ts +2 -0
- package/expandable/lib/Expandable.tsx +68 -0
- package/expandable/lib/ExpandableAvatar.tsx +26 -0
- package/expandable/lib/ExpandableContent.tsx +32 -0
- package/expandable/lib/ExpandableIcon.tsx +75 -0
- package/expandable/lib/ExpandableTarget.tsx +67 -0
- package/expandable/lib/ExpandableTitle.tsx +32 -0
- package/expandable/lib/hooks/index.ts +4 -0
- package/expandable/lib/hooks/useExpandableContent.ts +9 -0
- package/expandable/lib/hooks/useExpandableIcon.ts +8 -0
- package/expandable/lib/hooks/useExpandableModel.tsx +20 -0
- package/expandable/lib/hooks/useExpandableTarget.ts +16 -0
- package/expandable/package.json +6 -0
- package/index.ts +1 -2
- package/package.json +5 -5
- package/search-form/lib/SearchForm.tsx +13 -11
- package/search-form/package.json +2 -1
- package/common/lib/storybook-utils/ComponentStatesTable.tsx +0 -80
- package/common/lib/storybook-utils/permutateProps.ts +0 -47
- package/common/lib/storybook-utils/propTypes.ts +0 -15
- package/common/lib/theming/useThemedRing.ts +0 -82
- package/dist/commonjs/common/lib/storybook-utils/ComponentStatesTable.d.ts +0 -26
- package/dist/commonjs/common/lib/storybook-utils/ComponentStatesTable.d.ts.map +0 -1
- package/dist/commonjs/common/lib/storybook-utils/ComponentStatesTable.js +0 -48
- package/dist/commonjs/common/lib/storybook-utils/permutateProps.d.ts +0 -5
- package/dist/commonjs/common/lib/storybook-utils/permutateProps.d.ts.map +0 -1
- package/dist/commonjs/common/lib/storybook-utils/permutateProps.js +0 -47
- package/dist/commonjs/common/lib/storybook-utils/propTypes.d.ts +0 -15
- package/dist/commonjs/common/lib/storybook-utils/propTypes.d.ts.map +0 -1
- package/dist/commonjs/common/lib/storybook-utils/propTypes.js +0 -2
- package/dist/commonjs/common/lib/theming/useThemedRing.d.ts +0 -11
- package/dist/commonjs/common/lib/theming/useThemedRing.d.ts.map +0 -1
- package/dist/commonjs/common/lib/theming/useThemedRing.js +0 -67
- package/dist/commonjs/drawer/index.d.ts +0 -6
- package/dist/commonjs/drawer/index.d.ts.map +0 -1
- package/dist/commonjs/drawer/lib/Drawer.d.ts +0 -49
- package/dist/commonjs/drawer/lib/Drawer.d.ts.map +0 -1
- package/dist/commonjs/drawer/lib/Drawer.js +0 -124
- package/dist/commonjs/drawer/lib/DrawerHeader.d.ts +0 -38
- package/dist/commonjs/drawer/lib/DrawerHeader.d.ts.map +0 -1
- package/dist/commonjs/drawer/lib/DrawerHeader.js +0 -105
- package/dist/es6/common/lib/storybook-utils/ComponentStatesTable.d.ts +0 -26
- package/dist/es6/common/lib/storybook-utils/ComponentStatesTable.d.ts.map +0 -1
- package/dist/es6/common/lib/storybook-utils/ComponentStatesTable.js +0 -41
- package/dist/es6/common/lib/storybook-utils/permutateProps.d.ts +0 -5
- package/dist/es6/common/lib/storybook-utils/permutateProps.d.ts.map +0 -1
- package/dist/es6/common/lib/storybook-utils/permutateProps.js +0 -43
- package/dist/es6/common/lib/storybook-utils/propTypes.d.ts +0 -15
- package/dist/es6/common/lib/storybook-utils/propTypes.d.ts.map +0 -1
- package/dist/es6/common/lib/storybook-utils/propTypes.js +0 -1
- package/dist/es6/common/lib/theming/useThemedRing.d.ts +0 -11
- package/dist/es6/common/lib/theming/useThemedRing.d.ts.map +0 -1
- package/dist/es6/common/lib/theming/useThemedRing.js +0 -59
- package/dist/es6/drawer/index.d.ts +0 -6
- package/dist/es6/drawer/index.d.ts.map +0 -1
- package/dist/es6/drawer/index.js +0 -5
- package/dist/es6/drawer/lib/Drawer.d.ts +0 -49
- package/dist/es6/drawer/lib/Drawer.d.ts.map +0 -1
- package/dist/es6/drawer/lib/Drawer.js +0 -99
- package/dist/es6/drawer/lib/DrawerHeader.d.ts +0 -38
- package/dist/es6/drawer/lib/DrawerHeader.d.ts.map +0 -1
- package/dist/es6/drawer/lib/DrawerHeader.js +0 -81
- package/drawer/README.md +0 -35
- package/drawer/index.ts +0 -5
- package/drawer/lib/Drawer.tsx +0 -119
- package/drawer/lib/DrawerHeader.tsx +0 -105
- package/drawer/package.json +0 -5
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { Flex } from '@workday/canvas-kit-react/layout';
|
|
4
|
+
export interface ExpandableProps extends ExtractProps<typeof Flex, never> {
|
|
5
|
+
/**
|
|
6
|
+
* The children of the `Expandable` container. This should contain `Expandable.Target` and
|
|
7
|
+
* `Expandable.Container`
|
|
8
|
+
*/
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* `Expandable` wraps an `Expandable.Target` and an `Expandable.Content`. By default, it provides a
|
|
13
|
+
* `DisclosureModel` for its subcomponents. Alternatively, a model may be passed in using the
|
|
14
|
+
* hoisted model pattern.
|
|
15
|
+
*/
|
|
16
|
+
export declare const Expandable: import("@workday/canvas-kit-react/common").ElementComponentM<"div", ExpandableProps & Partial<{
|
|
17
|
+
id: string;
|
|
18
|
+
initialVisibility: import("@workday/canvas-kit-react/disclosure").Visibility;
|
|
19
|
+
}> & {
|
|
20
|
+
onShow?: ((data: Event | React.SyntheticEvent<Element, Event> | undefined, prevState: {
|
|
21
|
+
id: string;
|
|
22
|
+
visibility: "hidden" | "visible";
|
|
23
|
+
}) => void) | undefined;
|
|
24
|
+
onHide?: ((data: Event | React.SyntheticEvent<Element, Event> | undefined, prevState: {
|
|
25
|
+
id: string;
|
|
26
|
+
visibility: "hidden" | "visible";
|
|
27
|
+
}) => void) | undefined;
|
|
28
|
+
} & {
|
|
29
|
+
shouldShow?: ((data: Event | React.SyntheticEvent<Element, Event> | undefined, state: {
|
|
30
|
+
id: string;
|
|
31
|
+
visibility: "hidden" | "visible";
|
|
32
|
+
}) => boolean) | undefined;
|
|
33
|
+
shouldHide?: ((data: Event | React.SyntheticEvent<Element, Event> | undefined, state: {
|
|
34
|
+
id: string;
|
|
35
|
+
visibility: "hidden" | "visible";
|
|
36
|
+
}) => boolean) | undefined;
|
|
37
|
+
}, {
|
|
38
|
+
state: {
|
|
39
|
+
id: string;
|
|
40
|
+
visibility: "hidden" | "visible";
|
|
41
|
+
};
|
|
42
|
+
events: {
|
|
43
|
+
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
44
|
+
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
45
|
+
};
|
|
46
|
+
}> & {
|
|
47
|
+
/**
|
|
48
|
+
* `Expandable.Target` creates a heading and a button. The heading is a semantic heading to
|
|
49
|
+
* describe the associated content. The button provides users the ability to toggle the
|
|
50
|
+
* associated content.
|
|
51
|
+
*
|
|
52
|
+
* As according to the [W3 disclosure
|
|
53
|
+
* specification](https://www.w3.org/TR/wai-aria-practices-1.1/#disclosure), the button has
|
|
54
|
+
* `aria-expanded` and `aria-controls` attributes set by default
|
|
55
|
+
*
|
|
56
|
+
* This component should hold an `Expandable.Icon`, an optional `Expandable.Avatar`, and an
|
|
57
|
+
* `Expandable.Title`.
|
|
58
|
+
*/
|
|
59
|
+
Target: import("@workday/canvas-kit-react/common").ElementComponentM<"button", import("./ExpandableTarget").ExpandableTargetProps, {
|
|
60
|
+
state: {
|
|
61
|
+
id: string;
|
|
62
|
+
visibility: "hidden" | "visible";
|
|
63
|
+
};
|
|
64
|
+
events: {
|
|
65
|
+
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
66
|
+
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
67
|
+
};
|
|
68
|
+
}>;
|
|
69
|
+
/**
|
|
70
|
+
* `Expandable.Title` styles the target text that describes the content.
|
|
71
|
+
*/
|
|
72
|
+
Title: import("@workday/canvas-kit-react/common").ElementComponent<"div", import("./ExpandableTitle").ExpandableTitleProps>;
|
|
73
|
+
/**
|
|
74
|
+
* `Expandable.Icon` creates an icon to visually indicate the state of the content. It takes an
|
|
75
|
+
* `iconPosition` prop to determine which chevron icon to use.
|
|
76
|
+
*/
|
|
77
|
+
Icon: import("@workday/canvas-kit-react/common").ElementComponentM<"span", import("./ExpandableIcon").ExpandableIconProps, {
|
|
78
|
+
state: {
|
|
79
|
+
id: string;
|
|
80
|
+
visibility: "hidden" | "visible";
|
|
81
|
+
};
|
|
82
|
+
events: {
|
|
83
|
+
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
84
|
+
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
85
|
+
};
|
|
86
|
+
}>;
|
|
87
|
+
/**
|
|
88
|
+
* `Expandable.Avatar` is an optional component that creates an `Avatar` to display a decorative
|
|
89
|
+
* image.
|
|
90
|
+
*/
|
|
91
|
+
Avatar: import("@workday/canvas-kit-react/common").ElementComponent<"button", import("./ExpandableAvatar").ExpandableAvatarProps>;
|
|
92
|
+
/**
|
|
93
|
+
* `Expandable.Content` holds the content that will be conditionally expanded and collapsed. It
|
|
94
|
+
* has an `id` to ensure the `Expandable.Target` properly set it to the `aria-controls`
|
|
95
|
+
* attribute.
|
|
96
|
+
*/
|
|
97
|
+
Content: import("@workday/canvas-kit-react/common").ElementComponentM<"div", import("./ExpandableContent").ExpandableContentProps, {
|
|
98
|
+
state: {
|
|
99
|
+
id: string;
|
|
100
|
+
visibility: "hidden" | "visible";
|
|
101
|
+
};
|
|
102
|
+
events: {
|
|
103
|
+
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
104
|
+
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
105
|
+
};
|
|
106
|
+
}>;
|
|
107
|
+
};
|
|
108
|
+
//# sourceMappingURL=Expandable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Expandable.d.ts","sourceRoot":"","sources":["../../../../expandable/lib/Expandable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAkB,YAAY,EAAC,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAC,IAAI,EAAC,MAAM,kCAAkC,CAAC;AAStD,MAAM,WAAW,eAAgB,SAAQ,YAAY,CAAC,OAAO,IAAI,EAAE,KAAK,CAAC;IACvE;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAInB;;;;;;;;;;;OAWG;;;;;;;;;;;IAEH;;OAEG;;IAEH;;;OAGG;;;;;;;;;;;IAEH;;;OAGG;;IAEH;;;;OAIG;;;;;;;;;;;CAOL,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createContainer } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { Flex } from '@workday/canvas-kit-react/layout';
|
|
4
|
+
import { ExpandableContent } from './ExpandableContent';
|
|
5
|
+
import { ExpandableTarget } from './ExpandableTarget';
|
|
6
|
+
import { ExpandableIcon } from './ExpandableIcon';
|
|
7
|
+
import { ExpandableTitle } from './ExpandableTitle';
|
|
8
|
+
import { ExpandableAvatar } from './ExpandableAvatar';
|
|
9
|
+
import { useExpandableModel } from './hooks/useExpandableModel';
|
|
10
|
+
/**
|
|
11
|
+
* `Expandable` wraps an `Expandable.Target` and an `Expandable.Content`. By default, it provides a
|
|
12
|
+
* `DisclosureModel` for its subcomponents. Alternatively, a model may be passed in using the
|
|
13
|
+
* hoisted model pattern.
|
|
14
|
+
*/
|
|
15
|
+
export const Expandable = createContainer('div')({
|
|
16
|
+
displayName: 'Expandable',
|
|
17
|
+
modelHook: useExpandableModel,
|
|
18
|
+
subComponents: {
|
|
19
|
+
/**
|
|
20
|
+
* `Expandable.Target` creates a heading and a button. The heading is a semantic heading to
|
|
21
|
+
* describe the associated content. The button provides users the ability to toggle the
|
|
22
|
+
* associated content.
|
|
23
|
+
*
|
|
24
|
+
* As according to the [W3 disclosure
|
|
25
|
+
* specification](https://www.w3.org/TR/wai-aria-practices-1.1/#disclosure), the button has
|
|
26
|
+
* `aria-expanded` and `aria-controls` attributes set by default
|
|
27
|
+
*
|
|
28
|
+
* This component should hold an `Expandable.Icon`, an optional `Expandable.Avatar`, and an
|
|
29
|
+
* `Expandable.Title`.
|
|
30
|
+
*/
|
|
31
|
+
Target: ExpandableTarget,
|
|
32
|
+
/**
|
|
33
|
+
* `Expandable.Title` styles the target text that describes the content.
|
|
34
|
+
*/
|
|
35
|
+
Title: ExpandableTitle,
|
|
36
|
+
/**
|
|
37
|
+
* `Expandable.Icon` creates an icon to visually indicate the state of the content. It takes an
|
|
38
|
+
* `iconPosition` prop to determine which chevron icon to use.
|
|
39
|
+
*/
|
|
40
|
+
Icon: ExpandableIcon,
|
|
41
|
+
/**
|
|
42
|
+
* `Expandable.Avatar` is an optional component that creates an `Avatar` to display a decorative
|
|
43
|
+
* image.
|
|
44
|
+
*/
|
|
45
|
+
Avatar: ExpandableAvatar,
|
|
46
|
+
/**
|
|
47
|
+
* `Expandable.Content` holds the content that will be conditionally expanded and collapsed. It
|
|
48
|
+
* has an `id` to ensure the `Expandable.Target` properly set it to the `aria-controls`
|
|
49
|
+
* attribute.
|
|
50
|
+
*/
|
|
51
|
+
Content: ExpandableContent,
|
|
52
|
+
},
|
|
53
|
+
})(({ children, ...elementProps }, Element) => (React.createElement(Flex, Object.assign({ as: Element, flexDirection: 'column', padding: 'xxs' }, elementProps), children)));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { Avatar } from '@workday/canvas-kit-react/avatar';
|
|
4
|
+
export interface ExpandableAvatarProps extends Omit<ExtractProps<typeof Avatar, never>, keyof React.ButtonHTMLAttributes<HTMLButtonElement>> {
|
|
5
|
+
}
|
|
6
|
+
export declare const ExpandableAvatar: import("@workday/canvas-kit-react/common").ElementComponent<"button", ExpandableAvatarProps>;
|
|
7
|
+
//# sourceMappingURL=ExpandableAvatar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpandableAvatar.d.ts","sourceRoot":"","sources":["../../../../expandable/lib/ExpandableAvatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAkB,YAAY,EAAqB,MAAM,kCAAkC,CAAC;AACnG,OAAO,EAAC,MAAM,EAAC,MAAM,kCAAkC,CAAC;AAGxD,MAAM,WAAW,qBACf,SAAQ,IAAI,CACV,YAAY,CAAC,OAAO,MAAM,EAAE,KAAK,CAAC,EAClC,MAAM,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CACpD;CAAG;AAUN,eAAO,MAAM,gBAAgB,8FAK3B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createComponent, styled } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { Avatar } from '@workday/canvas-kit-react/avatar';
|
|
4
|
+
import { space } from '@workday/canvas-kit-react/tokens';
|
|
5
|
+
const StyledAvatar = styled(Avatar)({
|
|
6
|
+
marginRight: space.xxs,
|
|
7
|
+
flexShrink: 0,
|
|
8
|
+
});
|
|
9
|
+
// When the component is created, it needs to be a button element to match AvatarProps.
|
|
10
|
+
// Once Avatar becomes a `createComponent` we can default the element type to a `div`
|
|
11
|
+
// and the types should be properly extracted
|
|
12
|
+
export const ExpandableAvatar = createComponent('button')({
|
|
13
|
+
displayName: 'Expandable.Avatar',
|
|
14
|
+
Component: ({ altText, ...elemProps }, ref) => {
|
|
15
|
+
return React.createElement(StyledAvatar, Object.assign({ altText: undefined, as: "div", ref: ref, size: 32 }, elemProps));
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { Box } from '@workday/canvas-kit-react/layout';
|
|
4
|
+
export interface ExpandableContentProps extends ExtractProps<typeof Box, never> {
|
|
5
|
+
/**
|
|
6
|
+
* The children of the `Expandable.Content` whose visibility is controlled by the associated
|
|
7
|
+
* `Expandable.Target`
|
|
8
|
+
*/
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare const ExpandableContent: import("@workday/canvas-kit-react/common").ElementComponentM<"div", ExpandableContentProps, {
|
|
12
|
+
state: {
|
|
13
|
+
id: string;
|
|
14
|
+
visibility: "hidden" | "visible";
|
|
15
|
+
};
|
|
16
|
+
events: {
|
|
17
|
+
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
18
|
+
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
19
|
+
};
|
|
20
|
+
}>;
|
|
21
|
+
//# sourceMappingURL=ExpandableContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpandableContent.d.ts","sourceRoot":"","sources":["../../../../expandable/lib/ExpandableContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAqB,YAAY,EAAC,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAC,GAAG,EAAC,MAAM,kCAAkC,CAAC;AAKrD,MAAM,WAAW,sBAAuB,SAAQ,YAAY,CAAC,OAAO,GAAG,EAAE,KAAK,CAAC;IAC7E;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;EAc5B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { space } from '@workday/canvas-kit-react/tokens';
|
|
3
|
+
import { createSubcomponent } from '@workday/canvas-kit-react/common';
|
|
4
|
+
import { Box } from '@workday/canvas-kit-react/layout';
|
|
5
|
+
import { useExpandableContent } from './hooks/useExpandableContent';
|
|
6
|
+
import { useExpandableModel } from './hooks/useExpandableModel';
|
|
7
|
+
export const ExpandableContent = createSubcomponent('div')({
|
|
8
|
+
modelHook: useExpandableModel,
|
|
9
|
+
elemPropsHook: useExpandableContent,
|
|
10
|
+
})(({ children, ...elementProps }, Element) => {
|
|
11
|
+
return (React.createElement(Box, Object.assign({ as: Element, background: "none", padding: `${space.s} ${space.xxs} ${space.xxs}` }, elementProps), children));
|
|
12
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { CanvasSystemIcon } from '@workday/design-assets-types';
|
|
4
|
+
import { SystemIcon } from '@workday/canvas-kit-react/icon';
|
|
5
|
+
import { IconPositions } from '@workday/canvas-kit-react/button';
|
|
6
|
+
export interface ExpandableIconProps extends Omit<ExtractProps<typeof SystemIcon, never>, 'icon'> {
|
|
7
|
+
/**
|
|
8
|
+
* Icon to display from `@workday/canvas-accent-icons-web`
|
|
9
|
+
* @default chevronUpIcon
|
|
10
|
+
*/
|
|
11
|
+
icon?: CanvasSystemIcon;
|
|
12
|
+
/**
|
|
13
|
+
* Button icon positions can either be `start` or `end`.
|
|
14
|
+
* If no value is provided, it defaults to `start`.
|
|
15
|
+
* @default 'start'
|
|
16
|
+
*/
|
|
17
|
+
iconPosition?: IconPositions;
|
|
18
|
+
}
|
|
19
|
+
export declare const ExpandableIcon: import("@workday/canvas-kit-react/common").ElementComponentM<"span", ExpandableIconProps, {
|
|
20
|
+
state: {
|
|
21
|
+
id: string;
|
|
22
|
+
visibility: "hidden" | "visible";
|
|
23
|
+
};
|
|
24
|
+
events: {
|
|
25
|
+
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
26
|
+
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
27
|
+
};
|
|
28
|
+
}>;
|
|
29
|
+
//# sourceMappingURL=ExpandableIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpandableIcon.d.ts","sourceRoot":"","sources":["../../../../expandable/lib/ExpandableIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAEL,YAAY,EAGb,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAAC,UAAU,EAAC,MAAM,gCAAgC,CAAC;AAC1D,OAAO,EAAC,aAAa,EAAC,MAAM,kCAAkC,CAAC;AAK/D,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,YAAY,CAAC,OAAO,UAAU,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAC/F;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;;OAIG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC;CAC9B;AAwBD,eAAO,MAAM,cAAc;;;;;;;;;EAqB1B,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createSubcomponent, styled, } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { chevronUpIcon, chevronDownIcon } from '@workday/canvas-system-icons-web';
|
|
4
|
+
import { useExpandableIcon } from './hooks/useExpandableIcon';
|
|
5
|
+
import { SystemIcon } from '@workday/canvas-kit-react/icon';
|
|
6
|
+
import { colors, space } from '@workday/canvas-kit-react/tokens';
|
|
7
|
+
import { useExpandableModel } from './hooks/useExpandableModel';
|
|
8
|
+
const StyledEndIcon = styled(SystemIcon)({
|
|
9
|
+
marginLeft: 'auto',
|
|
10
|
+
}, ({ visible }) => ({
|
|
11
|
+
transform: !visible ? 'rotate(-180deg)' : undefined,
|
|
12
|
+
padding: !visible
|
|
13
|
+
? `${space.xxxs} ${space.xs} ${space.xxxs} ${space.xxxs}`
|
|
14
|
+
: `${space.xxxs} ${space.xxxs} ${space.xxxs} ${space.xs}`,
|
|
15
|
+
}));
|
|
16
|
+
const StyledStartIcon = styled(SystemIcon)({
|
|
17
|
+
margin: `0 ${space.xxs} 0 0`,
|
|
18
|
+
padding: space.xxxs,
|
|
19
|
+
}, ({ visible }) => ({
|
|
20
|
+
transform: !visible ? 'rotate(-90deg)' : undefined,
|
|
21
|
+
}));
|
|
22
|
+
export const ExpandableIcon = createSubcomponent('span')({
|
|
23
|
+
modelHook: useExpandableModel,
|
|
24
|
+
elemPropsHook: useExpandableIcon,
|
|
25
|
+
})(({ icon, visible, iconPosition = 'start', ...elementProps }, Element) => iconPosition === 'end' ? (React.createElement(StyledEndIcon, Object.assign({ as: Element, fill: colors.licorice200, icon: icon || chevronUpIcon, visible: visible }, elementProps))) : (React.createElement(StyledStartIcon, Object.assign({ as: Element, fill: colors.licorice200, icon: icon || chevronDownIcon, visible: visible }, elementProps))));
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { Flex } from '@workday/canvas-kit-react/layout';
|
|
4
|
+
export interface ExpandableTargetProps extends ExtractProps<typeof Flex, never> {
|
|
5
|
+
/**
|
|
6
|
+
* Children of the `Expandable.Target`. Should contain `Target.Title`, an optional `Target.Avatar`
|
|
7
|
+
* and `Target.Icon` with an `iconPosition` prop that takes a value of either `start` or `end`.
|
|
8
|
+
* `Target.Icon` with `start` is meant to be placed before the `Target.Title` and `Target.Icon`
|
|
9
|
+
* `end` should be placed after.
|
|
10
|
+
*/
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* This specifies the semantic heading level that will wrap the `Expandable.Target`'s button. If not
|
|
14
|
+
* defined, then nothing will wrap the button.
|
|
15
|
+
*/
|
|
16
|
+
headingLevel?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
17
|
+
}
|
|
18
|
+
export declare const ExpandableTarget: import("@workday/canvas-kit-react/common").ElementComponentM<"button", ExpandableTargetProps, {
|
|
19
|
+
state: {
|
|
20
|
+
id: string;
|
|
21
|
+
visibility: "hidden" | "visible";
|
|
22
|
+
}; /**
|
|
23
|
+
* Children of the `Expandable.Target`. Should contain `Target.Title`, an optional `Target.Avatar`
|
|
24
|
+
* and `Target.Icon` with an `iconPosition` prop that takes a value of either `start` or `end`.
|
|
25
|
+
* `Target.Icon` with `start` is meant to be placed before the `Target.Title` and `Target.Icon`
|
|
26
|
+
* `end` should be placed after.
|
|
27
|
+
*/
|
|
28
|
+
events: {
|
|
29
|
+
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
30
|
+
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
31
|
+
};
|
|
32
|
+
}>;
|
|
33
|
+
//# sourceMappingURL=ExpandableTarget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpandableTarget.d.ts","sourceRoot":"","sources":["../../../../expandable/lib/ExpandableTarget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAEL,YAAY,EAKb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,IAAI,EAAC,MAAM,kCAAkC,CAAC;AAMtD,MAAM,WAAW,qBAAsB,SAAQ,YAAY,CAAC,OAAO,IAAI,EAAE,KAAK,CAAC;IAC7E;;;;;OAKG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,YAAY,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CACxD;AAiBD,eAAO,MAAM,gBAAgB;;;;OA7B3B;;;;;OAKG;;;;;EA4CH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createSubcomponent, focusRing, hideMouseFocus, styled, } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { Flex } from '@workday/canvas-kit-react/layout';
|
|
4
|
+
import { colors } from '@workday/canvas-kit-react/tokens';
|
|
5
|
+
import { useExpandableTarget } from './hooks/useExpandableTarget';
|
|
6
|
+
import { useExpandableModel } from './hooks/useExpandableModel';
|
|
7
|
+
const StyledButton = styled(Flex.as('button'))({
|
|
8
|
+
cursor: 'pointer',
|
|
9
|
+
'&:focus': {
|
|
10
|
+
...focusRing(),
|
|
11
|
+
},
|
|
12
|
+
'&:hover': {
|
|
13
|
+
background: colors.soap300,
|
|
14
|
+
},
|
|
15
|
+
...hideMouseFocus,
|
|
16
|
+
});
|
|
17
|
+
const Heading = styled('h1')({
|
|
18
|
+
margin: 0,
|
|
19
|
+
});
|
|
20
|
+
export const ExpandableTarget = createSubcomponent('button')({
|
|
21
|
+
modelHook: useExpandableModel,
|
|
22
|
+
elemPropsHook: useExpandableTarget,
|
|
23
|
+
})(({ children, headingLevel, ...elementProps }, Element) => {
|
|
24
|
+
const button = (React.createElement(StyledButton, Object.assign({ as: Element, background: "none", border: "none", borderRadius: "m", flexDirection: "row", padding: "xxs", width: "100%" }, elementProps), children));
|
|
25
|
+
return !!headingLevel ? React.createElement(Heading, { as: headingLevel }, button) : button;
|
|
26
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { Box } from '@workday/canvas-kit-react/layout';
|
|
4
|
+
export interface ExpandableTitleProps extends ExtractProps<typeof Box, never> {
|
|
5
|
+
/**
|
|
6
|
+
* Children of the `Expandable.Title`. This should contain a string for the title
|
|
7
|
+
*/
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const ExpandableTitle: import("@workday/canvas-kit-react/common").ElementComponent<"div", ExpandableTitleProps>;
|
|
11
|
+
//# sourceMappingURL=ExpandableTitle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpandableTitle.d.ts","sourceRoot":"","sources":["../../../../expandable/lib/ExpandableTitle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAkB,YAAY,EAAC,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAC,GAAG,EAAC,MAAM,kCAAkC,CAAC;AAGrD,MAAM,WAAW,oBAAqB,SAAQ,YAAY,CAAC,OAAO,GAAG,EAAE,KAAK,CAAC;IAC3E;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,eAAe,0FAkB1B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createComponent } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { Box } from '@workday/canvas-kit-react/layout';
|
|
4
|
+
import { colors, space, type } from '@workday/canvas-kit-react/tokens';
|
|
5
|
+
export const ExpandableTitle = createComponent('div')({
|
|
6
|
+
displayName: 'Expandable.Title',
|
|
7
|
+
Component: ({ children, ...elemProps }, ref, Element) => {
|
|
8
|
+
return (React.createElement(Box, Object.assign({ as: Element, ref: ref }, type.levels.body.medium, { fontWeight: type.properties.fontWeights.bold, color: colors.blackPepper400, padding: `2px ${space.zero} 2px`, textAlign: "left" }, elemProps), children));
|
|
9
|
+
},
|
|
10
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../expandable/lib/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const useExpandableContent: import("@workday/canvas-kit-react/common").BehaviorHook<{
|
|
2
|
+
state: {
|
|
3
|
+
id: string;
|
|
4
|
+
visibility: "hidden" | "visible";
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
show(event?: Event | import("react").SyntheticEvent<Element, Event> | undefined): void;
|
|
8
|
+
hide(event?: Event | import("react").SyntheticEvent<Element, Event> | undefined): void;
|
|
9
|
+
};
|
|
10
|
+
}, {
|
|
11
|
+
style: {
|
|
12
|
+
display?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
display: string;
|
|
15
|
+
};
|
|
16
|
+
id: string;
|
|
17
|
+
}>;
|
|
18
|
+
//# sourceMappingURL=useExpandableContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useExpandableContent.d.ts","sourceRoot":"","sources":["../../../../../expandable/lib/hooks/useExpandableContent.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;EAK/B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createElemPropsHook } from '@workday/canvas-kit-react/common';
|
|
2
|
+
import { useExpandableModel } from './useExpandableModel';
|
|
3
|
+
export const useExpandableContent = createElemPropsHook(useExpandableModel)(({ state }) => {
|
|
4
|
+
return {
|
|
5
|
+
style: state.visibility !== 'hidden' ? {} : { display: 'none' },
|
|
6
|
+
id: state.id,
|
|
7
|
+
};
|
|
8
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const useExpandableIcon: import("@workday/canvas-kit-react/common").BehaviorHook<{
|
|
2
|
+
state: {
|
|
3
|
+
id: string;
|
|
4
|
+
visibility: "hidden" | "visible";
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
show(event?: Event | import("react").SyntheticEvent<Element, Event> | undefined): void;
|
|
8
|
+
hide(event?: Event | import("react").SyntheticEvent<Element, Event> | undefined): void;
|
|
9
|
+
};
|
|
10
|
+
}, {
|
|
11
|
+
visible: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
//# sourceMappingURL=useExpandableIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useExpandableIcon.d.ts","sourceRoot":"","sources":["../../../../../expandable/lib/hooks/useExpandableIcon.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB;;;;;;;;;;;EAI5B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createElemPropsHook } from '@workday/canvas-kit-react/common';
|
|
2
|
+
import { useExpandableModel } from './useExpandableModel';
|
|
3
|
+
export const useExpandableIcon = createElemPropsHook(useExpandableModel)(({ state }) => {
|
|
4
|
+
return {
|
|
5
|
+
visible: state.visibility !== 'hidden',
|
|
6
|
+
};
|
|
7
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `ExpandableModel` extends the `DisclosureModel`
|
|
3
|
+
*/
|
|
4
|
+
export declare const useExpandableModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
5
|
+
id: string;
|
|
6
|
+
initialVisibility: import("@workday/canvas-kit-react/disclosure").Visibility;
|
|
7
|
+
}> & {
|
|
8
|
+
onShow?: ((data: Event | import("react").SyntheticEvent<Element, Event> | undefined, prevState: {
|
|
9
|
+
id: string;
|
|
10
|
+
visibility: "hidden" | "visible";
|
|
11
|
+
}) => void) | undefined;
|
|
12
|
+
onHide?: ((data: Event | import("react").SyntheticEvent<Element, Event> | undefined, prevState: {
|
|
13
|
+
id: string;
|
|
14
|
+
visibility: "hidden" | "visible";
|
|
15
|
+
}) => void) | undefined;
|
|
16
|
+
} & {
|
|
17
|
+
shouldShow?: ((data: Event | import("react").SyntheticEvent<Element, Event> | undefined, state: {
|
|
18
|
+
id: string;
|
|
19
|
+
visibility: "hidden" | "visible";
|
|
20
|
+
}) => boolean) | undefined;
|
|
21
|
+
shouldHide?: ((data: Event | import("react").SyntheticEvent<Element, Event> | undefined, state: {
|
|
22
|
+
id: string;
|
|
23
|
+
visibility: "hidden" | "visible";
|
|
24
|
+
}) => boolean) | undefined;
|
|
25
|
+
}) | undefined) => {
|
|
26
|
+
state: {
|
|
27
|
+
id: string;
|
|
28
|
+
visibility: "hidden" | "visible";
|
|
29
|
+
};
|
|
30
|
+
events: {
|
|
31
|
+
show(event?: Event | import("react").SyntheticEvent<Element, Event> | undefined): void;
|
|
32
|
+
hide(event?: Event | import("react").SyntheticEvent<Element, Event> | undefined): void;
|
|
33
|
+
};
|
|
34
|
+
}) & import("@workday/canvas-kit-react/common").ModelExtras<{
|
|
35
|
+
id: string;
|
|
36
|
+
initialVisibility: import("@workday/canvas-kit-react/disclosure").Visibility;
|
|
37
|
+
}, {}, {
|
|
38
|
+
id: string;
|
|
39
|
+
visibility: "hidden" | "visible";
|
|
40
|
+
}, {
|
|
41
|
+
show(event?: Event | import("react").SyntheticEvent<Element, Event> | undefined): void;
|
|
42
|
+
hide(event?: Event | import("react").SyntheticEvent<Element, Event> | undefined): void;
|
|
43
|
+
}, {
|
|
44
|
+
state: {
|
|
45
|
+
id: string;
|
|
46
|
+
visibility: "hidden" | "visible";
|
|
47
|
+
};
|
|
48
|
+
events: {
|
|
49
|
+
show(event?: Event | import("react").SyntheticEvent<Element, Event> | undefined): void;
|
|
50
|
+
hide(event?: Event | import("react").SyntheticEvent<Element, Event> | undefined): void;
|
|
51
|
+
};
|
|
52
|
+
}>;
|
|
53
|
+
//# sourceMappingURL=useExpandableModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useExpandableModel.d.ts","sourceRoot":"","sources":["../../../../../expandable/lib/hooks/useExpandableModel.tsx"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa7B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createModelHook } from '@workday/canvas-kit-react/common';
|
|
2
|
+
import { useDisclosureModel } from '@workday/canvas-kit-react/disclosure';
|
|
3
|
+
/**
|
|
4
|
+
* The `ExpandableModel` extends the `DisclosureModel`
|
|
5
|
+
*/
|
|
6
|
+
export const useExpandableModel = createModelHook({
|
|
7
|
+
defaultConfig: {
|
|
8
|
+
...useDisclosureModel.defaultConfig,
|
|
9
|
+
},
|
|
10
|
+
})(config => {
|
|
11
|
+
const disclosure = useDisclosureModel(config);
|
|
12
|
+
const state = {
|
|
13
|
+
...disclosure.state,
|
|
14
|
+
};
|
|
15
|
+
const events = {
|
|
16
|
+
...disclosure.events,
|
|
17
|
+
};
|
|
18
|
+
return { state, events };
|
|
19
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const useExpandableTarget: import("@workday/canvas-kit-react/common").BehaviorHook<{
|
|
2
|
+
state: {
|
|
3
|
+
id: string;
|
|
4
|
+
visibility: "hidden" | "visible";
|
|
5
|
+
};
|
|
6
|
+
events: {
|
|
7
|
+
show(event?: Event | import("react").SyntheticEvent<Element, Event> | undefined): void;
|
|
8
|
+
hide(event?: Event | import("react").SyntheticEvent<Element, Event> | undefined): void;
|
|
9
|
+
};
|
|
10
|
+
}, {
|
|
11
|
+
'aria-controls': string;
|
|
12
|
+
'aria-expanded': boolean;
|
|
13
|
+
onClick: (event: React.MouseEvent) => void;
|
|
14
|
+
}>;
|
|
15
|
+
//# sourceMappingURL=useExpandableTarget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useExpandableTarget.d.ts","sourceRoot":"","sources":["../../../../../expandable/lib/hooks/useExpandableTarget.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;qBAIX,gBAAgB;EAQnC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createElemPropsHook } from '@workday/canvas-kit-react/common';
|
|
2
|
+
import { useExpandableModel } from './useExpandableModel';
|
|
3
|
+
export const useExpandableTarget = createElemPropsHook(useExpandableModel)(({ state, events }) => {
|
|
4
|
+
return {
|
|
5
|
+
'aria-controls': state.id,
|
|
6
|
+
'aria-expanded': state.visibility !== 'hidden',
|
|
7
|
+
onClick: (event) => {
|
|
8
|
+
if (state.visibility !== 'hidden') {
|
|
9
|
+
events.hide(event);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
events.show(event);
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
});
|
package/dist/es6/index.d.ts
CHANGED
package/dist/es6/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
package/dist/es6/index.js
CHANGED