@workday/canvas-kit-labs-react 8.0.0-alpha.254-next.23 → 8.0.0-alpha.428-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/common/lib/theming/index.ts +0 -1
- package/common/lib/theming/useThemeRTL.ts +3 -0
- package/dist/commonjs/combobox/lib/AutocompleteList.js +31 -52
- package/dist/commonjs/combobox/lib/Combobox.js +105 -133
- package/dist/commonjs/combobox/lib/Status.js +9 -10
- 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 +19 -42
- package/dist/commonjs/expandable/lib/Expandable.d.ts +45 -12
- package/dist/commonjs/expandable/lib/Expandable.d.ts.map +1 -1
- package/dist/commonjs/expandable/lib/Expandable.js +46 -37
- package/dist/commonjs/expandable/lib/ExpandableAvatar.js +7 -30
- package/dist/commonjs/expandable/lib/ExpandableContent.d.ts +4 -2
- package/dist/commonjs/expandable/lib/ExpandableContent.d.ts.map +1 -1
- package/dist/commonjs/expandable/lib/ExpandableContent.js +8 -31
- package/dist/commonjs/expandable/lib/ExpandableIcon.d.ts +1 -1
- package/dist/commonjs/expandable/lib/ExpandableIcon.d.ts.map +1 -1
- package/dist/commonjs/expandable/lib/ExpandableIcon.js +20 -51
- package/dist/commonjs/expandable/lib/ExpandableTarget.d.ts +7 -2
- package/dist/commonjs/expandable/lib/ExpandableTarget.d.ts.map +1 -1
- package/dist/commonjs/expandable/lib/ExpandableTarget.js +18 -34
- package/dist/commonjs/expandable/lib/ExpandableTitle.d.ts +3 -1
- package/dist/commonjs/expandable/lib/ExpandableTitle.d.ts.map +1 -1
- package/dist/commonjs/expandable/lib/ExpandableTitle.js +6 -29
- package/dist/commonjs/expandable/lib/hooks/index.d.ts +1 -0
- package/dist/commonjs/expandable/lib/hooks/index.d.ts.map +1 -1
- package/dist/commonjs/expandable/lib/hooks/index.js +1 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableContent.d.ts +4 -6
- package/dist/commonjs/expandable/lib/hooks/useExpandableContent.d.ts.map +1 -1
- package/dist/commonjs/expandable/lib/hooks/useExpandableContent.js +3 -4
- package/dist/commonjs/expandable/lib/hooks/useExpandableIcon.d.ts +4 -6
- package/dist/commonjs/expandable/lib/hooks/useExpandableIcon.d.ts.map +1 -1
- package/dist/commonjs/expandable/lib/hooks/useExpandableIcon.js +3 -4
- package/dist/{es6/expandable/lib → commonjs/expandable/lib/hooks}/useExpandableModel.d.ts +10 -7
- 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 +4 -6
- package/dist/commonjs/expandable/lib/hooks/useExpandableTarget.d.ts.map +1 -1
- package/dist/commonjs/expandable/lib/hooks/useExpandableTarget.js +4 -5
- package/dist/commonjs/index.d.ts +0 -3
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +0 -3
- package/dist/commonjs/search-form/lib/SearchForm.d.ts +6 -1
- package/dist/commonjs/search-form/lib/SearchForm.d.ts.map +1 -1
- package/dist/commonjs/search-form/lib/SearchForm.js +117 -142
- package/dist/commonjs/search-form/lib/themes.js +7 -8
- package/dist/es6/combobox/lib/AutocompleteList.js +26 -47
- package/dist/es6/combobox/lib/Combobox.js +95 -123
- package/dist/es6/combobox/lib/Status.js +6 -7
- 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 +16 -39
- package/dist/es6/expandable/lib/Expandable.d.ts +45 -12
- package/dist/es6/expandable/lib/Expandable.d.ts.map +1 -1
- package/dist/es6/expandable/lib/Expandable.js +40 -31
- package/dist/es6/expandable/lib/ExpandableAvatar.js +4 -27
- package/dist/es6/expandable/lib/ExpandableContent.d.ts +4 -2
- package/dist/es6/expandable/lib/ExpandableContent.d.ts.map +1 -1
- package/dist/es6/expandable/lib/ExpandableContent.js +5 -28
- package/dist/es6/expandable/lib/ExpandableIcon.d.ts +1 -1
- package/dist/es6/expandable/lib/ExpandableIcon.d.ts.map +1 -1
- package/dist/es6/expandable/lib/ExpandableIcon.js +15 -46
- package/dist/es6/expandable/lib/ExpandableTarget.d.ts +7 -2
- package/dist/es6/expandable/lib/ExpandableTarget.d.ts.map +1 -1
- package/dist/es6/expandable/lib/ExpandableTarget.js +15 -31
- package/dist/es6/expandable/lib/ExpandableTitle.d.ts +3 -1
- package/dist/es6/expandable/lib/ExpandableTitle.d.ts.map +1 -1
- package/dist/es6/expandable/lib/ExpandableTitle.js +3 -26
- package/dist/es6/expandable/lib/hooks/index.d.ts +1 -0
- package/dist/es6/expandable/lib/hooks/index.d.ts.map +1 -1
- package/dist/es6/expandable/lib/hooks/index.js +1 -0
- package/dist/es6/expandable/lib/hooks/useExpandableContent.d.ts +4 -6
- package/dist/es6/expandable/lib/hooks/useExpandableContent.d.ts.map +1 -1
- package/dist/es6/expandable/lib/hooks/useExpandableContent.js +2 -3
- package/dist/es6/expandable/lib/hooks/useExpandableIcon.d.ts +4 -6
- package/dist/es6/expandable/lib/hooks/useExpandableIcon.d.ts.map +1 -1
- package/dist/es6/expandable/lib/hooks/useExpandableIcon.js +2 -3
- package/dist/{commonjs/expandable/lib → es6/expandable/lib/hooks}/useExpandableModel.d.ts +10 -7
- 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 +4 -6
- package/dist/es6/expandable/lib/hooks/useExpandableTarget.d.ts.map +1 -1
- package/dist/es6/expandable/lib/hooks/useExpandableTarget.js +3 -4
- package/dist/es6/index.d.ts +0 -3
- package/dist/es6/index.d.ts.map +1 -1
- package/dist/es6/index.js +0 -3
- package/dist/es6/search-form/lib/SearchForm.d.ts +6 -1
- package/dist/es6/search-form/lib/SearchForm.d.ts.map +1 -1
- package/dist/es6/search-form/lib/SearchForm.js +107 -133
- package/dist/es6/search-form/lib/themes.js +5 -6
- package/expandable/lib/Expandable.tsx +38 -4
- package/expandable/lib/ExpandableContent.tsx +4 -4
- package/expandable/lib/ExpandableIcon.tsx +2 -1
- package/expandable/lib/ExpandableTarget.tsx +3 -3
- package/expandable/lib/ExpandableTitle.tsx +6 -8
- package/expandable/lib/hooks/index.ts +1 -0
- package/expandable/lib/hooks/useExpandableContent.ts +1 -1
- package/expandable/lib/hooks/useExpandableIcon.ts +1 -1
- package/expandable/lib/{useExpandableModel.tsx → hooks/useExpandableModel.tsx} +3 -0
- package/expandable/lib/hooks/useExpandableTarget.ts +1 -1
- package/index.ts +0 -3
- package/package.json +4 -4
- package/search-form/lib/SearchForm.tsx +11 -5
- package/common/lib/theming/useThemedRing.ts +0 -82
- 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 -3
- package/dist/commonjs/drawer/index.d.ts.map +0 -1
- package/dist/commonjs/drawer/index.js +0 -16
- package/dist/commonjs/drawer/lib/Drawer.d.ts +0 -74
- package/dist/commonjs/drawer/lib/Drawer.d.ts.map +0 -1
- package/dist/commonjs/drawer/lib/Drawer.js +0 -142
- package/dist/commonjs/drawer/lib/DrawerHeader.d.ts +0 -55
- package/dist/commonjs/drawer/lib/DrawerHeader.d.ts.map +0 -1
- package/dist/commonjs/drawer/lib/DrawerHeader.js +0 -113
- package/dist/commonjs/expandable/lib/useExpandableModel.d.ts.map +0 -1
- package/dist/commonjs/expandable/lib/useExpandableModel.js +0 -24
- package/dist/commonjs/toast/index.d.ts +0 -3
- package/dist/commonjs/toast/index.d.ts.map +0 -1
- package/dist/commonjs/toast/index.js +0 -14
- package/dist/commonjs/toast/lib/Toast.d.ts +0 -27
- package/dist/commonjs/toast/lib/Toast.d.ts.map +0 -1
- package/dist/commonjs/toast/lib/Toast.js +0 -78
- package/dist/commonjs/toast/lib/ToastBody.d.ts +0 -6
- package/dist/commonjs/toast/lib/ToastBody.d.ts.map +0 -1
- package/dist/commonjs/toast/lib/ToastBody.js +0 -40
- package/dist/commonjs/toast/lib/ToastCloseIcon.d.ts +0 -6
- package/dist/commonjs/toast/lib/ToastCloseIcon.d.ts.map +0 -1
- package/dist/commonjs/toast/lib/ToastCloseIcon.js +0 -43
- package/dist/commonjs/toast/lib/ToastIcon.d.ts +0 -5
- package/dist/commonjs/toast/lib/ToastIcon.d.ts.map +0 -1
- package/dist/commonjs/toast/lib/ToastIcon.js +0 -26
- package/dist/commonjs/toast/lib/ToastLink.d.ts +0 -9
- package/dist/commonjs/toast/lib/ToastLink.d.ts.map +0 -1
- package/dist/commonjs/toast/lib/ToastLink.js +0 -42
- package/dist/commonjs/toast/lib/ToastMessage.d.ts +0 -11
- package/dist/commonjs/toast/lib/ToastMessage.d.ts.map +0 -1
- package/dist/commonjs/toast/lib/ToastMessage.js +0 -41
- package/dist/commonjs/toast/lib/hooks/useToastModel.d.ts +0 -65
- package/dist/commonjs/toast/lib/hooks/useToastModel.d.ts.map +0 -1
- package/dist/commonjs/toast/lib/hooks/useToastModel.js +0 -35
- 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 -3
- package/dist/es6/drawer/index.d.ts.map +0 -1
- package/dist/es6/drawer/index.js +0 -2
- package/dist/es6/drawer/lib/Drawer.d.ts +0 -74
- package/dist/es6/drawer/lib/Drawer.d.ts.map +0 -1
- package/dist/es6/drawer/lib/Drawer.js +0 -117
- package/dist/es6/drawer/lib/DrawerHeader.d.ts +0 -55
- package/dist/es6/drawer/lib/DrawerHeader.d.ts.map +0 -1
- package/dist/es6/drawer/lib/DrawerHeader.js +0 -88
- package/dist/es6/expandable/lib/useExpandableModel.d.ts.map +0 -1
- package/dist/es6/expandable/lib/useExpandableModel.js +0 -21
- package/dist/es6/toast/index.d.ts +0 -3
- package/dist/es6/toast/index.d.ts.map +0 -1
- package/dist/es6/toast/index.js +0 -2
- package/dist/es6/toast/lib/Toast.d.ts +0 -27
- package/dist/es6/toast/lib/Toast.d.ts.map +0 -1
- package/dist/es6/toast/lib/Toast.js +0 -72
- package/dist/es6/toast/lib/ToastBody.d.ts +0 -6
- package/dist/es6/toast/lib/ToastBody.d.ts.map +0 -1
- package/dist/es6/toast/lib/ToastBody.js +0 -34
- package/dist/es6/toast/lib/ToastCloseIcon.d.ts +0 -6
- package/dist/es6/toast/lib/ToastCloseIcon.d.ts.map +0 -1
- package/dist/es6/toast/lib/ToastCloseIcon.js +0 -37
- package/dist/es6/toast/lib/ToastIcon.d.ts +0 -5
- package/dist/es6/toast/lib/ToastIcon.d.ts.map +0 -1
- package/dist/es6/toast/lib/ToastIcon.js +0 -20
- package/dist/es6/toast/lib/ToastLink.d.ts +0 -9
- package/dist/es6/toast/lib/ToastLink.d.ts.map +0 -1
- package/dist/es6/toast/lib/ToastLink.js +0 -36
- package/dist/es6/toast/lib/ToastMessage.d.ts +0 -11
- package/dist/es6/toast/lib/ToastMessage.d.ts.map +0 -1
- package/dist/es6/toast/lib/ToastMessage.js +0 -35
- package/dist/es6/toast/lib/hooks/useToastModel.d.ts +0 -65
- package/dist/es6/toast/lib/hooks/useToastModel.d.ts.map +0 -1
- package/dist/es6/toast/lib/hooks/useToastModel.js +0 -32
- package/drawer/LICENSE +0 -51
- package/drawer/README.md +0 -35
- package/drawer/index.ts +0 -2
- package/drawer/lib/Drawer.tsx +0 -156
- package/drawer/lib/DrawerHeader.tsx +0 -133
- package/drawer/package.json +0 -6
- package/toast/LICENSE +0 -52
- package/toast/README.md +0 -5
- package/toast/index.ts +0 -2
- package/toast/lib/Toast.tsx +0 -63
- package/toast/lib/ToastBody.tsx +0 -34
- package/toast/lib/ToastCloseIcon.tsx +0 -18
- package/toast/lib/ToastIcon.tsx +0 -24
- package/toast/lib/ToastLink.tsx +0 -27
- package/toast/lib/ToastMessage.tsx +0 -21
- package/toast/lib/hooks/useToastModel.tsx +0 -27
- package/toast/package.json +0 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useThemeRTL.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/useThemeRTL.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,kCAAkC,CAAC;AAI/D,oBAAY,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAc5D
|
|
1
|
+
{"version":3,"file":"useThemeRTL.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/useThemeRTL.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,kCAAkC,CAAC;AAI/D,oBAAY,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAc5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,WAAW;6BAMD,aAAa,EAAE;;EAYxC"}
|
|
@@ -1,41 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
14
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
15
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
16
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
17
|
-
r[k] = a[j];
|
|
18
|
-
return r;
|
|
19
|
-
};
|
|
20
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
4
|
};
|
|
23
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
6
|
exports.useThemeRTL = void 0;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var styles = [];
|
|
30
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
31
|
-
styles[_i - 1] = arguments[_i];
|
|
32
|
-
}
|
|
7
|
+
const common_1 = require("@workday/canvas-kit-react/common");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const rtl_css_js_1 = __importDefault(require("rtl-css-js"));
|
|
10
|
+
const getDirectionalStyles = (isRTL, ...styles) => {
|
|
33
11
|
return isRTL ? rtl_css_js_1.default(styles) : styles;
|
|
34
12
|
};
|
|
35
|
-
|
|
13
|
+
const getConvertedStyles = (styles, convertFunc) => {
|
|
36
14
|
return convertFunc ? convertFunc(styles) : styles;
|
|
37
15
|
};
|
|
38
16
|
/**
|
|
17
|
+
* @deprecated Now that IE11 is no longer supported, we encourage consumers to use [CSS logical properties](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties)
|
|
18
|
+
*
|
|
19
|
+
*
|
|
39
20
|
* A helpful hook for supporting bidirectional styles.
|
|
40
21
|
* * Read below for more detail or [view the docs](https://github.com/Workday/canvas-kit/blob/master/modules/labs-react/common/README.md#useThemeRTL).
|
|
41
22
|
*
|
|
@@ -65,23 +46,19 @@ var getConvertedStyles = function (styles, convertFunc) {
|
|
|
65
46
|
* }
|
|
66
47
|
*/
|
|
67
48
|
function useThemeRTL() {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return styles.reduce(function (first, second) {
|
|
79
|
-
var convertedFirst = getConvertedStyles(first, convertFunc);
|
|
80
|
-
var convertedSecond = getConvertedStyles(second, convertFunc);
|
|
81
|
-
return __assign(__assign({}, convertedFirst), convertedSecond);
|
|
49
|
+
const theme = common_1.useTheme();
|
|
50
|
+
const direction = common_1.useIsRTL(theme);
|
|
51
|
+
const convertFunc = theme.canvas._styleRewriteFn;
|
|
52
|
+
const themeRTL = react_1.useMemo(() => {
|
|
53
|
+
return (...cssObject) => {
|
|
54
|
+
const styles = getDirectionalStyles(direction, ...cssObject);
|
|
55
|
+
return styles.reduce((first, second) => {
|
|
56
|
+
const convertedFirst = getConvertedStyles(first, convertFunc);
|
|
57
|
+
const convertedSecond = getConvertedStyles(second, convertFunc);
|
|
58
|
+
return { ...convertedFirst, ...convertedSecond };
|
|
82
59
|
}, {});
|
|
83
60
|
};
|
|
84
61
|
}, [direction, convertFunc]);
|
|
85
|
-
return { themeRTL
|
|
62
|
+
return { themeRTL, theme };
|
|
86
63
|
}
|
|
87
64
|
exports.useThemeRTL = useThemeRTL;
|
|
@@ -8,68 +8,101 @@ export interface ExpandableProps extends ExtractProps<typeof Flex, never> {
|
|
|
8
8
|
*/
|
|
9
9
|
children?: React.ReactNode;
|
|
10
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
|
+
*/
|
|
11
16
|
export declare const Expandable: import("@workday/canvas-kit-react/common").ElementComponentM<"div", ExpandableProps & Partial<{
|
|
12
17
|
id: string;
|
|
13
18
|
initialVisibility: import("@workday/canvas-kit-react/disclosure").Visibility;
|
|
14
19
|
}> & {
|
|
15
20
|
onShow?: ((data: Event | React.SyntheticEvent<Element, Event> | undefined, prevState: {
|
|
16
21
|
id: string;
|
|
17
|
-
visibility:
|
|
22
|
+
visibility: "hidden" | "visible";
|
|
18
23
|
}) => void) | undefined;
|
|
19
24
|
onHide?: ((data: Event | React.SyntheticEvent<Element, Event> | undefined, prevState: {
|
|
20
25
|
id: string;
|
|
21
|
-
visibility:
|
|
26
|
+
visibility: "hidden" | "visible";
|
|
22
27
|
}) => void) | undefined;
|
|
23
28
|
} & {
|
|
24
29
|
shouldShow?: ((data: Event | React.SyntheticEvent<Element, Event> | undefined, state: {
|
|
25
30
|
id: string;
|
|
26
|
-
visibility:
|
|
31
|
+
visibility: "hidden" | "visible";
|
|
27
32
|
}) => boolean) | undefined;
|
|
28
33
|
shouldHide?: ((data: Event | React.SyntheticEvent<Element, Event> | undefined, state: {
|
|
29
34
|
id: string;
|
|
30
|
-
visibility:
|
|
35
|
+
visibility: "hidden" | "visible";
|
|
31
36
|
}) => boolean) | undefined;
|
|
32
37
|
}, {
|
|
33
38
|
state: {
|
|
34
39
|
id: string;
|
|
35
|
-
visibility:
|
|
40
|
+
visibility: "hidden" | "visible";
|
|
36
41
|
};
|
|
37
42
|
events: {
|
|
38
43
|
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
39
44
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
40
45
|
};
|
|
41
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
|
+
*/
|
|
42
59
|
Target: import("@workday/canvas-kit-react/common").ElementComponentM<"button", import("./ExpandableTarget").ExpandableTargetProps, {
|
|
43
60
|
state: {
|
|
44
61
|
id: string;
|
|
45
|
-
visibility:
|
|
62
|
+
visibility: "hidden" | "visible";
|
|
46
63
|
};
|
|
47
64
|
events: {
|
|
48
65
|
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
49
66
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
50
67
|
};
|
|
51
68
|
}>;
|
|
52
|
-
|
|
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, {
|
|
53
78
|
state: {
|
|
54
79
|
id: string;
|
|
55
|
-
visibility:
|
|
80
|
+
visibility: "hidden" | "visible";
|
|
56
81
|
};
|
|
57
82
|
events: {
|
|
58
83
|
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
59
84
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
60
85
|
};
|
|
61
86
|
}>;
|
|
62
|
-
|
|
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, {
|
|
63
98
|
state: {
|
|
64
99
|
id: string;
|
|
65
|
-
visibility:
|
|
100
|
+
visibility: "hidden" | "visible";
|
|
66
101
|
};
|
|
67
102
|
events: {
|
|
68
103
|
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
69
104
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
70
105
|
};
|
|
71
106
|
}>;
|
|
72
|
-
Avatar: import("@workday/canvas-kit-react/common").ElementComponent<"button", import("./ExpandableAvatar").ExpandableAvatarProps>;
|
|
73
|
-
Title: import("@workday/canvas-kit-react/common").ElementComponent<"div", import("./ExpandableTitle").ExpandableTitleProps>;
|
|
74
107
|
};
|
|
75
108
|
//# sourceMappingURL=Expandable.d.ts.map
|
|
@@ -1 +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;
|
|
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"}
|
|
@@ -1,50 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
4
|
};
|
|
27
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
6
|
exports.Expandable = void 0;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const common_1 = require("@workday/canvas-kit-react/common");
|
|
9
|
+
const layout_1 = require("@workday/canvas-kit-react/layout");
|
|
10
|
+
const ExpandableContent_1 = require("./ExpandableContent");
|
|
11
|
+
const ExpandableTarget_1 = require("./ExpandableTarget");
|
|
12
|
+
const ExpandableIcon_1 = require("./ExpandableIcon");
|
|
13
|
+
const ExpandableTitle_1 = require("./ExpandableTitle");
|
|
14
|
+
const ExpandableAvatar_1 = require("./ExpandableAvatar");
|
|
15
|
+
const useExpandableModel_1 = require("./hooks/useExpandableModel");
|
|
16
|
+
/**
|
|
17
|
+
* `Expandable` wraps an `Expandable.Target` and an `Expandable.Content`. By default, it provides a
|
|
18
|
+
* `DisclosureModel` for its subcomponents. Alternatively, a model may be passed in using the
|
|
19
|
+
* hoisted model pattern.
|
|
20
|
+
*/
|
|
38
21
|
exports.Expandable = common_1.createContainer('div')({
|
|
22
|
+
displayName: 'Expandable',
|
|
39
23
|
modelHook: useExpandableModel_1.useExpandableModel,
|
|
40
24
|
subComponents: {
|
|
25
|
+
/**
|
|
26
|
+
* `Expandable.Target` creates a heading and a button. The heading is a semantic heading to
|
|
27
|
+
* describe the associated content. The button provides users the ability to toggle the
|
|
28
|
+
* associated content.
|
|
29
|
+
*
|
|
30
|
+
* As according to the [W3 disclosure
|
|
31
|
+
* specification](https://www.w3.org/TR/wai-aria-practices-1.1/#disclosure), the button has
|
|
32
|
+
* `aria-expanded` and `aria-controls` attributes set by default
|
|
33
|
+
*
|
|
34
|
+
* This component should hold an `Expandable.Icon`, an optional `Expandable.Avatar`, and an
|
|
35
|
+
* `Expandable.Title`.
|
|
36
|
+
*/
|
|
41
37
|
Target: ExpandableTarget_1.ExpandableTarget,
|
|
42
|
-
|
|
38
|
+
/**
|
|
39
|
+
* `Expandable.Title` styles the target text that describes the content.
|
|
40
|
+
*/
|
|
41
|
+
Title: ExpandableTitle_1.ExpandableTitle,
|
|
42
|
+
/**
|
|
43
|
+
* `Expandable.Icon` creates an icon to visually indicate the state of the content. It takes an
|
|
44
|
+
* `iconPosition` prop to determine which chevron icon to use.
|
|
45
|
+
*/
|
|
43
46
|
Icon: ExpandableIcon_1.ExpandableIcon,
|
|
47
|
+
/**
|
|
48
|
+
* `Expandable.Avatar` is an optional component that creates an `Avatar` to display a decorative
|
|
49
|
+
* image.
|
|
50
|
+
*/
|
|
44
51
|
Avatar: ExpandableAvatar_1.ExpandableAvatar,
|
|
45
|
-
|
|
52
|
+
/**
|
|
53
|
+
* `Expandable.Content` holds the content that will be conditionally expanded and collapsed. It
|
|
54
|
+
* has an `id` to ensure the `Expandable.Target` properly set it to the `aria-controls`
|
|
55
|
+
* attribute.
|
|
56
|
+
*/
|
|
57
|
+
Content: ExpandableContent_1.ExpandableContent,
|
|
46
58
|
},
|
|
47
|
-
})(
|
|
48
|
-
var children = _a.children, elementProps = __rest(_a, ["children"]);
|
|
49
|
-
return (react_1.default.createElement(layout_1.Flex, __assign({ as: Element, flexDirection: 'column', padding: 'xxs' }, elementProps), children));
|
|
50
|
-
});
|
|
59
|
+
})(({ children, ...elementProps }, Element) => (react_1.default.createElement(layout_1.Flex, Object.assign({ as: Element, flexDirection: 'column', padding: 'xxs' }, elementProps), children)));
|
|
@@ -1,36 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
4
|
};
|
|
27
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
6
|
exports.ExpandableAvatar = void 0;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const common_1 = require("@workday/canvas-kit-react/common");
|
|
9
|
+
const avatar_1 = require("@workday/canvas-kit-react/avatar");
|
|
10
|
+
const tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
11
|
+
const StyledAvatar = common_1.styled(avatar_1.Avatar)({
|
|
34
12
|
marginRight: tokens_1.space.xxs,
|
|
35
13
|
flexShrink: 0,
|
|
36
14
|
});
|
|
@@ -39,8 +17,7 @@ var StyledAvatar = common_1.styled(avatar_1.Avatar)({
|
|
|
39
17
|
// and the types should be properly extracted
|
|
40
18
|
exports.ExpandableAvatar = common_1.createComponent('button')({
|
|
41
19
|
displayName: 'Expandable.Avatar',
|
|
42
|
-
Component:
|
|
43
|
-
|
|
44
|
-
return react_1.default.createElement(StyledAvatar, __assign({ altText: undefined, as: "div", ref: ref, size: 32 }, elemProps));
|
|
20
|
+
Component: ({ altText, ...elemProps }, ref) => {
|
|
21
|
+
return react_1.default.createElement(StyledAvatar, Object.assign({ altText: undefined, as: "div", ref: ref, size: 32 }, elemProps));
|
|
45
22
|
},
|
|
46
23
|
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
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> {
|
|
3
5
|
/**
|
|
4
6
|
* The children of the `Expandable.Content` whose visibility is controlled by the associated
|
|
5
7
|
* `Expandable.Target`
|
|
@@ -9,7 +11,7 @@ export interface ExpandableContentProps {
|
|
|
9
11
|
export declare const ExpandableContent: import("@workday/canvas-kit-react/common").ElementComponentM<"div", ExpandableContentProps, {
|
|
10
12
|
state: {
|
|
11
13
|
id: string;
|
|
12
|
-
visibility:
|
|
14
|
+
visibility: "hidden" | "visible";
|
|
13
15
|
};
|
|
14
16
|
events: {
|
|
15
17
|
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpandableContent.d.ts","sourceRoot":"","sources":["../../../../expandable/lib/ExpandableContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
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"}
|
|
@@ -1,41 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
4
|
};
|
|
27
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
6
|
exports.ExpandableContent = void 0;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
9
|
+
const common_1 = require("@workday/canvas-kit-react/common");
|
|
10
|
+
const layout_1 = require("@workday/canvas-kit-react/layout");
|
|
11
|
+
const useExpandableContent_1 = require("./hooks/useExpandableContent");
|
|
12
|
+
const useExpandableModel_1 = require("./hooks/useExpandableModel");
|
|
35
13
|
exports.ExpandableContent = common_1.createSubcomponent('div')({
|
|
36
14
|
modelHook: useExpandableModel_1.useExpandableModel,
|
|
37
15
|
elemPropsHook: useExpandableContent_1.useExpandableContent,
|
|
38
|
-
})(
|
|
39
|
-
|
|
40
|
-
return (react_1.default.createElement(layout_1.Box, __assign({ as: Element, background: "none", padding: tokens_1.space.s + " " + tokens_1.space.xxs + " " + tokens_1.space.xxs }, elementProps), children));
|
|
16
|
+
})(({ children, ...elementProps }, Element) => {
|
|
17
|
+
return (react_1.default.createElement(layout_1.Box, Object.assign({ as: Element, background: "none", padding: `${tokens_1.space.s} ${tokens_1.space.xxs} ${tokens_1.space.xxs}` }, elementProps), children));
|
|
41
18
|
});
|
|
@@ -19,7 +19,7 @@ export interface ExpandableIconProps extends Omit<ExtractProps<typeof SystemIcon
|
|
|
19
19
|
export declare const ExpandableIcon: import("@workday/canvas-kit-react/common").ElementComponentM<"span", ExpandableIconProps, {
|
|
20
20
|
state: {
|
|
21
21
|
id: string;
|
|
22
|
-
visibility:
|
|
22
|
+
visibility: "hidden" | "visible";
|
|
23
23
|
};
|
|
24
24
|
events: {
|
|
25
25
|
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
@@ -1 +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;
|
|
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"}
|
|
@@ -1,62 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
4
|
};
|
|
27
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
6
|
exports.ExpandableIcon = void 0;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const common_1 = require("@workday/canvas-kit-react/common");
|
|
9
|
+
const canvas_system_icons_web_1 = require("@workday/canvas-system-icons-web");
|
|
10
|
+
const useExpandableIcon_1 = require("./hooks/useExpandableIcon");
|
|
11
|
+
const icon_1 = require("@workday/canvas-kit-react/icon");
|
|
12
|
+
const tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
13
|
+
const useExpandableModel_1 = require("./hooks/useExpandableModel");
|
|
14
|
+
const StyledEndIcon = common_1.styled(icon_1.SystemIcon)({
|
|
37
15
|
marginLeft: 'auto',
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
var StyledStartIcon = common_1.styled(icon_1.SystemIcon)({
|
|
48
|
-
margin: "0 " + tokens_1.space.xxs + " 0 0",
|
|
16
|
+
}, ({ visible }) => ({
|
|
17
|
+
transform: !visible ? 'rotate(-180deg)' : undefined,
|
|
18
|
+
padding: !visible
|
|
19
|
+
? `${tokens_1.space.xxxs} ${tokens_1.space.xs} ${tokens_1.space.xxxs} ${tokens_1.space.xxxs}`
|
|
20
|
+
: `${tokens_1.space.xxxs} ${tokens_1.space.xxxs} ${tokens_1.space.xxxs} ${tokens_1.space.xs}`,
|
|
21
|
+
}));
|
|
22
|
+
const StyledStartIcon = common_1.styled(icon_1.SystemIcon)({
|
|
23
|
+
margin: `0 ${tokens_1.space.xxs} 0 0`,
|
|
49
24
|
padding: tokens_1.space.xxxs,
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
transform: !visible ? 'rotate(-90deg)' : undefined,
|
|
54
|
-
});
|
|
55
|
-
});
|
|
25
|
+
}, ({ visible }) => ({
|
|
26
|
+
transform: !visible ? 'rotate(-90deg)' : undefined,
|
|
27
|
+
}));
|
|
56
28
|
exports.ExpandableIcon = common_1.createSubcomponent('span')({
|
|
57
29
|
modelHook: useExpandableModel_1.useExpandableModel,
|
|
58
30
|
elemPropsHook: useExpandableIcon_1.useExpandableIcon,
|
|
59
|
-
})(
|
|
60
|
-
var icon = _a.icon, visible = _a.visible, _b = _a.iconPosition, iconPosition = _b === void 0 ? 'start' : _b, elementProps = __rest(_a, ["icon", "visible", "iconPosition"]);
|
|
61
|
-
return iconPosition === 'end' ? (react_1.default.createElement(StyledEndIcon, __assign({ as: Element, fill: tokens_1.colors.licorice200, icon: icon || canvas_system_icons_web_1.chevronUpIcon, visible: visible }, elementProps))) : (react_1.default.createElement(StyledStartIcon, __assign({ as: Element, fill: tokens_1.colors.licorice200, icon: icon || canvas_system_icons_web_1.chevronDownIcon, visible: visible }, elementProps)));
|
|
62
|
-
});
|
|
31
|
+
})(({ icon, visible, iconPosition = 'start', ...elementProps }, Element) => iconPosition === 'end' ? (react_1.default.createElement(StyledEndIcon, Object.assign({ as: Element, fill: tokens_1.colors.licorice200, icon: icon || canvas_system_icons_web_1.chevronUpIcon, visible: visible }, elementProps))) : (react_1.default.createElement(StyledStartIcon, Object.assign({ as: Element, fill: tokens_1.colors.licorice200, icon: icon || canvas_system_icons_web_1.chevronDownIcon, visible: visible }, elementProps))));
|
|
@@ -18,8 +18,13 @@ export interface ExpandableTargetProps extends ExtractProps<typeof Flex, never>
|
|
|
18
18
|
export declare const ExpandableTarget: import("@workday/canvas-kit-react/common").ElementComponentM<"button", ExpandableTargetProps, {
|
|
19
19
|
state: {
|
|
20
20
|
id: string;
|
|
21
|
-
visibility:
|
|
22
|
-
};
|
|
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
|
+
*/
|
|
23
28
|
events: {
|
|
24
29
|
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
25
30
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
@@ -1 +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;
|
|
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"}
|
|
@@ -1,48 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
4
|
};
|
|
27
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
6
|
exports.ExpandableTarget = void 0;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const common_1 = require("@workday/canvas-kit-react/common");
|
|
9
|
+
const layout_1 = require("@workday/canvas-kit-react/layout");
|
|
10
|
+
const tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
11
|
+
const useExpandableTarget_1 = require("./hooks/useExpandableTarget");
|
|
12
|
+
const useExpandableModel_1 = require("./hooks/useExpandableModel");
|
|
13
|
+
const StyledButton = common_1.styled(layout_1.Flex.as('button'))({
|
|
14
|
+
cursor: 'pointer',
|
|
15
|
+
'&:focus': {
|
|
16
|
+
...common_1.focusRing(),
|
|
17
|
+
},
|
|
18
|
+
'&:hover': {
|
|
36
19
|
background: tokens_1.colors.soap300,
|
|
37
|
-
}
|
|
38
|
-
|
|
20
|
+
},
|
|
21
|
+
...common_1.hideMouseFocus,
|
|
22
|
+
});
|
|
23
|
+
const Heading = common_1.styled('h1')({
|
|
39
24
|
margin: 0,
|
|
40
25
|
});
|
|
41
26
|
exports.ExpandableTarget = common_1.createSubcomponent('button')({
|
|
42
27
|
modelHook: useExpandableModel_1.useExpandableModel,
|
|
43
28
|
elemPropsHook: useExpandableTarget_1.useExpandableTarget,
|
|
44
|
-
})(
|
|
45
|
-
|
|
46
|
-
var button = (react_1.default.createElement(StyledButton, __assign({ as: Element, background: "none", border: "none", borderRadius: "m", flexDirection: "row", padding: "xxs", width: "100%" }, elementProps), children));
|
|
29
|
+
})(({ children, headingLevel, ...elementProps }, Element) => {
|
|
30
|
+
const button = (react_1.default.createElement(StyledButton, Object.assign({ as: Element, background: "none", border: "none", borderRadius: "m", flexDirection: "row", padding: "xxs", width: "100%" }, elementProps), children));
|
|
47
31
|
return !!headingLevel ? react_1.default.createElement(Heading, { as: headingLevel }, button) : button;
|
|
48
32
|
});
|