@workday/canvas-kit-labs-react 7.1.5 → 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/common/index.ts +0 -2
- package/common/lib/theming/index.ts +0 -1
- package/common/lib/theming/useThemeRTL.ts +14 -13
- 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/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 -6
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
export var permutateProps = function (allProps, filter, remainingProps, values) {
|
|
13
|
-
if (remainingProps === void 0) { remainingProps = Object.keys(allProps); }
|
|
14
|
-
if (values === void 0) { values = {}; }
|
|
15
|
-
// When there are no more props to combine with, return result
|
|
16
|
-
var prop = remainingProps[0];
|
|
17
|
-
if (!prop) {
|
|
18
|
-
var props_1 = {};
|
|
19
|
-
Object.keys(values).forEach(function (prop) {
|
|
20
|
-
var _a;
|
|
21
|
-
props_1[prop] = (_a = values === null || values === void 0 ? void 0 : values[prop]) === null || _a === void 0 ? void 0 : _a.value;
|
|
22
|
-
});
|
|
23
|
-
if (filter && !filter(props_1)) {
|
|
24
|
-
return [];
|
|
25
|
-
}
|
|
26
|
-
var label = Object.keys(values)
|
|
27
|
-
.map(function (prop) { var _a; return (_a = values === null || values === void 0 ? void 0 : values[prop]) === null || _a === void 0 ? void 0 : _a.label; })
|
|
28
|
-
.join(' ');
|
|
29
|
-
return [
|
|
30
|
-
{
|
|
31
|
-
label: label,
|
|
32
|
-
props: props_1,
|
|
33
|
-
},
|
|
34
|
-
];
|
|
35
|
-
}
|
|
36
|
-
var possiblePropValues = allProps[prop];
|
|
37
|
-
var permutations = possiblePropValues === null || possiblePropValues === void 0 ? void 0 : possiblePropValues.map(function (value) {
|
|
38
|
-
var newValues = __assign({}, values); // Required so we don't overwrite previous references
|
|
39
|
-
newValues[prop] = value;
|
|
40
|
-
return permutateProps(allProps, filter, remainingProps.slice(1, remainingProps.length), newValues);
|
|
41
|
-
});
|
|
42
|
-
return permutations.flat();
|
|
43
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare type PropDeclaration = {
|
|
2
|
-
value: any;
|
|
3
|
-
label: string;
|
|
4
|
-
};
|
|
5
|
-
export declare type PropsDeclaration = {
|
|
6
|
-
[key: string]: PropDeclaration[];
|
|
7
|
-
};
|
|
8
|
-
export declare type Props = {
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
};
|
|
11
|
-
export declare type PropCombination = {
|
|
12
|
-
label: string;
|
|
13
|
-
props: Props;
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=propTypes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"propTypes.d.ts","sourceRoot":"","sources":["../../../../../common/lib/storybook-utils/propTypes.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe,GAAG;IAC5B,KAAK,EAAE,GAAG,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,oBAAY,gBAAgB,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,EAAE,CAAA;CAAC,CAAC;AAElE,oBAAY,KAAK,GAAG;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;AAEF,oBAAY,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;CACd,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { EmotionCanvasTheme } from '@workday/canvas-kit-react/common';
|
|
2
|
-
import { CSSProperties } from '@workday/canvas-kit-react/tokens';
|
|
3
|
-
declare type paletteSelection = Exclude<keyof EmotionCanvasTheme['canvas']['palette'], 'common'>;
|
|
4
|
-
interface ContrastColors {
|
|
5
|
-
outer?: string;
|
|
6
|
-
inner?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare function getPaletteColors(type: paletteSelection, theme: EmotionCanvasTheme): ContrastColors;
|
|
9
|
-
export declare const useThemedRing: (type: paletteSelection) => CSSProperties;
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=useThemedRing.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useThemedRing.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/useThemedRing.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,kBAAkB,EAAC,MAAM,kCAAkC,CAAC;AACxF,OAAO,EAAS,aAAa,EAA4B,MAAM,kCAAkC,CAAC;AAGlG,aAAK,gBAAgB,GAAG,OAAO,CAAC,MAAM,kBAAkB,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,CAAC;AACzF,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAoBD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,gBAAgB,EACtB,KAAK,EAAE,kBAAkB,GACxB,cAAc,CAsBhB;AAED,eAAO,MAAM,aAAa,SAAU,gBAAgB,KAAG,aAyBtD,CAAC"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { useThemeRTL } from './useThemeRTL';
|
|
2
|
-
import { colors, inputColors, statusColors } from '@workday/canvas-kit-react/tokens';
|
|
3
|
-
import chroma from 'chroma-js';
|
|
4
|
-
var isAccessible = function (foreground, background) {
|
|
5
|
-
if (background === void 0) { background = colors.frenchVanilla100; }
|
|
6
|
-
return chroma.contrast(foreground, background) >= 3;
|
|
7
|
-
};
|
|
8
|
-
var getPaletteColorsFromTheme = function (palette, fallbackColors) {
|
|
9
|
-
return {
|
|
10
|
-
outer: isAccessible(palette.main)
|
|
11
|
-
? palette.main
|
|
12
|
-
: isAccessible(palette.darkest)
|
|
13
|
-
? palette.darkest
|
|
14
|
-
: fallbackColors === null || fallbackColors === void 0 ? void 0 : fallbackColors.outer,
|
|
15
|
-
inner: (fallbackColors === null || fallbackColors === void 0 ? void 0 : fallbackColors.inner) ? fallbackColors.inner : palette.main,
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export function getPaletteColors(type, theme) {
|
|
19
|
-
var palette = theme.canvas.palette[type];
|
|
20
|
-
switch (type) {
|
|
21
|
-
case 'error': {
|
|
22
|
-
return getPaletteColorsFromTheme(palette, { outer: inputColors.error.border });
|
|
23
|
-
}
|
|
24
|
-
case 'alert': {
|
|
25
|
-
return getPaletteColorsFromTheme(palette, { outer: colors.cantaloupe600 });
|
|
26
|
-
}
|
|
27
|
-
case 'success': {
|
|
28
|
-
return getPaletteColorsFromTheme(palette, {
|
|
29
|
-
outer: colors.greenApple600,
|
|
30
|
-
// The theme default for success.main is set to the darkest GreenApple
|
|
31
|
-
// For our default ring, we need to override it so the inner ring is a bit lighter
|
|
32
|
-
inner: palette.main === colors.greenApple600 ? statusColors.success : palette.main,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
default: {
|
|
36
|
-
return getPaletteColorsFromTheme(palette);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
export var useThemedRing = function (type) {
|
|
41
|
-
var _a = useThemeRTL(), themeRTL = _a.themeRTL, theme = _a.theme;
|
|
42
|
-
var paletteColors = getPaletteColors(type, theme);
|
|
43
|
-
if (!((paletteColors === null || paletteColors === void 0 ? void 0 : paletteColors.outer) || (paletteColors === null || paletteColors === void 0 ? void 0 : paletteColors.inner))) {
|
|
44
|
-
return {};
|
|
45
|
-
}
|
|
46
|
-
var errorBoxShadow = "inset 0 0 0 " + (paletteColors.outer === paletteColors.inner ? 1 : 2) + "px " + paletteColors.inner;
|
|
47
|
-
return themeRTL({
|
|
48
|
-
borderColor: paletteColors.outer,
|
|
49
|
-
transition: '100ms box-shadow',
|
|
50
|
-
boxShadow: errorBoxShadow,
|
|
51
|
-
'&:hover, &:disabled': {
|
|
52
|
-
borderColor: paletteColors.outer,
|
|
53
|
-
},
|
|
54
|
-
'&:focus:not([disabled])': {
|
|
55
|
-
borderColor: paletteColors.outer,
|
|
56
|
-
boxShadow: errorBoxShadow + ",\n 0 0 0 2px " + colors.frenchVanilla100 + ",\n 0 0 0 4px " + (theme ? theme.canvas.palette.common.focusOutline : inputColors.focusBorder),
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../drawer/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAC,MAAM,EAAE,YAAY,EAAC,CAAC;AAC9B,eAAe,MAAM,CAAC;AACtB,cAAc,cAAc,CAAC"}
|
package/dist/es6/drawer/index.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { CanvasSpaceValues } from '@workday/canvas-kit-react/tokens';
|
|
3
|
-
export interface DrawerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
-
/**
|
|
5
|
-
* The padding of the Drawer contents.
|
|
6
|
-
* @default space.s
|
|
7
|
-
*/
|
|
8
|
-
padding?: CanvasSpaceValues;
|
|
9
|
-
/**
|
|
10
|
-
* The direction from which the Drawer opens. Accepts `Left` or `Right`.
|
|
11
|
-
* @default DrawerDirection.Right
|
|
12
|
-
*/
|
|
13
|
-
openDirection?: DrawerDirection;
|
|
14
|
-
/**
|
|
15
|
-
* The width of the Drawer in `px`.
|
|
16
|
-
* @default 360
|
|
17
|
-
*/
|
|
18
|
-
width?: number;
|
|
19
|
-
/**
|
|
20
|
-
* If true, render the Drawer with a drop shadow.
|
|
21
|
-
* @default false
|
|
22
|
-
*/
|
|
23
|
-
showDropShadow?: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* The optional DrawerHeader component of the Drawer. Shows an optional string and close button.
|
|
26
|
-
*/
|
|
27
|
-
header?: React.ReactElement;
|
|
28
|
-
/**
|
|
29
|
-
* The `aria-labelledby` of the Drawer. Set this when there is a `header` for accessibility. The `role` attribute should also be used when this attribute is present. This value should be the same as the `id` attribute of the `header` element.
|
|
30
|
-
*/
|
|
31
|
-
'aria-labelledby'?: string;
|
|
32
|
-
/**
|
|
33
|
-
* The `aria-label` for the Drawer. Set this when there is NO `header` for accessibility.
|
|
34
|
-
*/
|
|
35
|
-
'aria-label'?: string;
|
|
36
|
-
/**
|
|
37
|
-
* The role of the Drawer. If `role` is provided, you must also set `aria-labelledby` to link `header` to the `role`.
|
|
38
|
-
*/
|
|
39
|
-
role?: string;
|
|
40
|
-
}
|
|
41
|
-
export declare enum DrawerDirection {
|
|
42
|
-
Left = 0,
|
|
43
|
-
Right = 1
|
|
44
|
-
}
|
|
45
|
-
export default class Drawer extends React.Component<DrawerProps, {}> {
|
|
46
|
-
static OpenDirection: typeof DrawerDirection;
|
|
47
|
-
render(): JSX.Element;
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=Drawer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../../drawer/lib/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAgB,iBAAiB,EAAC,MAAM,kCAAkC,CAAC;AAElF,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IACvE;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B;;;OAGG;IACH,aAAa,CAAC,EAAE,eAAe,CAAC;IAChC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC5B;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,oBAAY,eAAe;IACzB,IAAI,IAAA;IACJ,KAAK,IAAA;CACN;AA4CD,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,KAAK,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE,CAAC;IAClE,MAAM,CAAC,aAAa,yBAAmB;IAEhC,MAAM;CAyBd"}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
extendStatics(d, b);
|
|
10
|
-
function __() { this.constructor = d; }
|
|
11
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
-
};
|
|
13
|
-
})();
|
|
14
|
-
var __assign = (this && this.__assign) || function () {
|
|
15
|
-
__assign = Object.assign || function(t) {
|
|
16
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
17
|
-
s = arguments[i];
|
|
18
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
19
|
-
t[p] = s[p];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
return __assign.apply(this, arguments);
|
|
24
|
-
};
|
|
25
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
-
var t = {};
|
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
-
t[p] = s[p];
|
|
29
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
-
t[p[i]] = s[p[i]];
|
|
33
|
-
}
|
|
34
|
-
return t;
|
|
35
|
-
};
|
|
36
|
-
import * as React from 'react';
|
|
37
|
-
import styled from '@emotion/styled';
|
|
38
|
-
import { colors, space } from '@workday/canvas-kit-react/tokens';
|
|
39
|
-
export var DrawerDirection;
|
|
40
|
-
(function (DrawerDirection) {
|
|
41
|
-
DrawerDirection[DrawerDirection["Left"] = 0] = "Left";
|
|
42
|
-
DrawerDirection[DrawerDirection["Right"] = 1] = "Right";
|
|
43
|
-
})(DrawerDirection || (DrawerDirection = {}));
|
|
44
|
-
var DrawerContainer = styled('div')({
|
|
45
|
-
height: '100%',
|
|
46
|
-
backgroundColor: 'white',
|
|
47
|
-
display: 'flex',
|
|
48
|
-
flexDirection: 'column',
|
|
49
|
-
position: 'absolute',
|
|
50
|
-
}, function (_a) {
|
|
51
|
-
var width = _a.width;
|
|
52
|
-
return ({
|
|
53
|
-
width: width,
|
|
54
|
-
});
|
|
55
|
-
}, function (_a) {
|
|
56
|
-
var showDropShadow = _a.showDropShadow, openDirection = _a.openDirection;
|
|
57
|
-
return ({
|
|
58
|
-
boxShadow: openDirection === DrawerDirection.Right && showDropShadow
|
|
59
|
-
? '-8px 0px 16px 0 rgba(0,0,0,0.12)'
|
|
60
|
-
: openDirection === DrawerDirection.Left && showDropShadow
|
|
61
|
-
? '8px 0px 16px 0 rgba(0,0,0,0.12)'
|
|
62
|
-
: undefined,
|
|
63
|
-
});
|
|
64
|
-
}, function (_a) {
|
|
65
|
-
var openDirection = _a.openDirection;
|
|
66
|
-
return ({
|
|
67
|
-
borderLeft: openDirection === DrawerDirection.Right ? "1px solid " + colors.soap400 : undefined,
|
|
68
|
-
borderRight: openDirection === DrawerDirection.Left ? "1px solid " + colors.soap400 : undefined,
|
|
69
|
-
right: openDirection === DrawerDirection.Right ? space.zero : undefined,
|
|
70
|
-
left: openDirection === DrawerDirection.Left ? space.zero : undefined,
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
var ChildrenContainer = styled('div')({
|
|
74
|
-
height: '100%',
|
|
75
|
-
overflowY: 'auto',
|
|
76
|
-
wordBreak: 'break-word',
|
|
77
|
-
wordWrap: 'break-word',
|
|
78
|
-
position: 'relative',
|
|
79
|
-
}, function (_a) {
|
|
80
|
-
var padding = _a.padding;
|
|
81
|
-
return ({
|
|
82
|
-
padding: padding,
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
var Drawer = /** @class */ (function (_super) {
|
|
86
|
-
__extends(Drawer, _super);
|
|
87
|
-
function Drawer() {
|
|
88
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
89
|
-
}
|
|
90
|
-
Drawer.prototype.render = function () {
|
|
91
|
-
var _a = this.props, _b = _a.padding, padding = _b === void 0 ? space.s : _b, _c = _a.width, width = _c === void 0 ? 360 : _c, _d = _a.openDirection, openDirection = _d === void 0 ? DrawerDirection.Right : _d, _e = _a.showDropShadow, showDropShadow = _e === void 0 ? false : _e, children = _a.children, header = _a.header, role = _a.role, elemProps = __rest(_a, ["padding", "width", "openDirection", "showDropShadow", "children", "header", "role"]);
|
|
92
|
-
return (React.createElement(DrawerContainer, __assign({ role: role }, elemProps, { showDropShadow: showDropShadow, width: width, openDirection: openDirection }),
|
|
93
|
-
header,
|
|
94
|
-
React.createElement(ChildrenContainer, { padding: padding }, children)));
|
|
95
|
-
};
|
|
96
|
-
Drawer.OpenDirection = DrawerDirection;
|
|
97
|
-
return Drawer;
|
|
98
|
-
}(React.Component));
|
|
99
|
-
export default Drawer;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { CanvasColor } from '@workday/canvas-kit-react/tokens';
|
|
3
|
-
export interface DrawerHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
-
/**
|
|
5
|
-
* The text of the DrawerHeader. This text will also be applied as the `title` attribute of the header element.
|
|
6
|
-
*/
|
|
7
|
-
title?: string;
|
|
8
|
-
/**
|
|
9
|
-
* The function called when the DrawerHeader close button is clicked.
|
|
10
|
-
*/
|
|
11
|
-
onClose?: React.MouseEventHandler<HTMLButtonElement>;
|
|
12
|
-
/**
|
|
13
|
-
* The `aria-label` for the DrawHeader close button. Useful for i18n.
|
|
14
|
-
* @default Close
|
|
15
|
-
*/
|
|
16
|
-
closeIconAriaLabel?: string;
|
|
17
|
-
/**
|
|
18
|
-
* The background color of the DrawerHeader.
|
|
19
|
-
*/
|
|
20
|
-
headerColor?: CanvasColor | string;
|
|
21
|
-
/**
|
|
22
|
-
* The border color of the DrawerHeader. This should match something close to `headerColor`.
|
|
23
|
-
*/
|
|
24
|
-
borderColor?: CanvasColor | string;
|
|
25
|
-
/**
|
|
26
|
-
* If true, render the icon and header in white. Useful for preserving contrast with a dark `headerColor`.
|
|
27
|
-
* @default false
|
|
28
|
-
*/
|
|
29
|
-
inverse?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* The unique id of the DrawerHeader for accessibility.
|
|
32
|
-
*/
|
|
33
|
-
id?: string;
|
|
34
|
-
}
|
|
35
|
-
export default class DrawerHeader extends React.Component<DrawerHeaderProps, {}> {
|
|
36
|
-
render(): JSX.Element;
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=DrawerHeader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DrawerHeader.d.ts","sourceRoot":"","sources":["../../../../drawer/lib/DrawerHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAsB,WAAW,EAAa,MAAM,kCAAkC,CAAC;AAI9F,MAAM,WAAW,iBAAkB,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC7E;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACrD;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IACnC;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IACnC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAsCD,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,KAAK,CAAC,SAAS,CAAC,iBAAiB,EAAE,EAAE,CAAC;IACvE,MAAM;CA4Bd"}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
extendStatics(d, b);
|
|
10
|
-
function __() { this.constructor = d; }
|
|
11
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
-
};
|
|
13
|
-
})();
|
|
14
|
-
var __assign = (this && this.__assign) || function () {
|
|
15
|
-
__assign = Object.assign || function(t) {
|
|
16
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
17
|
-
s = arguments[i];
|
|
18
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
19
|
-
t[p] = s[p];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
return __assign.apply(this, arguments);
|
|
24
|
-
};
|
|
25
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
-
var t = {};
|
|
27
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
-
t[p] = s[p];
|
|
29
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
-
t[p[i]] = s[p[i]];
|
|
33
|
-
}
|
|
34
|
-
return t;
|
|
35
|
-
};
|
|
36
|
-
import * as React from 'react';
|
|
37
|
-
import styled from '@emotion/styled';
|
|
38
|
-
import { colors, space, type, typeColors } from '@workday/canvas-kit-react/tokens';
|
|
39
|
-
import { TertiaryButton } from '@workday/canvas-kit-react/button';
|
|
40
|
-
import { xIcon } from '@workday/canvas-system-icons-web';
|
|
41
|
-
var headerHeight = 56;
|
|
42
|
-
var HeaderContainer = styled('div')({
|
|
43
|
-
height: headerHeight,
|
|
44
|
-
display: 'flex',
|
|
45
|
-
alignItems: 'center',
|
|
46
|
-
padding: "0 " + space.s,
|
|
47
|
-
justifyContent: 'space-between',
|
|
48
|
-
}, function (_a) {
|
|
49
|
-
var borderColor = _a.borderColor;
|
|
50
|
-
return ({
|
|
51
|
-
borderBottom: "1px solid " + borderColor,
|
|
52
|
-
});
|
|
53
|
-
}, function (_a) {
|
|
54
|
-
var headerColor = _a.headerColor;
|
|
55
|
-
return ({
|
|
56
|
-
backgroundColor: headerColor,
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
var HeaderTitle = styled('h4')(__assign(__assign({}, type.levels.body.small), { fontWeight: type.properties.fontWeights.bold, whiteSpace: 'nowrap', textOverflow: 'ellipsis', overflow: 'hidden', paddingRight: space.xxxs }), function (_a) {
|
|
60
|
-
var inverse = _a.inverse;
|
|
61
|
-
return ({
|
|
62
|
-
color: inverse ? colors.frenchVanilla100 : typeColors.heading,
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
var CloseButton = styled(TertiaryButton)({
|
|
66
|
-
margin: '-8px',
|
|
67
|
-
});
|
|
68
|
-
var DrawerHeader = /** @class */ (function (_super) {
|
|
69
|
-
__extends(DrawerHeader, _super);
|
|
70
|
-
function DrawerHeader() {
|
|
71
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
72
|
-
}
|
|
73
|
-
DrawerHeader.prototype.render = function () {
|
|
74
|
-
var _a = this.props, _b = _a.closeIconAriaLabel, closeIconAriaLabel = _b === void 0 ? 'Close' : _b, _c = _a.headerColor, headerColor = _c === void 0 ? colors.soap100 : _c, _d = _a.borderColor, borderColor = _d === void 0 ? colors.soap500 : _d, _e = _a.inverse, inverse = _e === void 0 ? false : _e, onClose = _a.onClose, title = _a.title, id = _a.id, elemProps = __rest(_a, ["closeIconAriaLabel", "headerColor", "borderColor", "inverse", "onClose", "title", "id"]);
|
|
75
|
-
return (React.createElement(HeaderContainer, __assign({ borderColor: borderColor }, elemProps, { headerColor: headerColor }),
|
|
76
|
-
React.createElement(HeaderTitle, { id: id, inverse: inverse, title: title }, title),
|
|
77
|
-
onClose && closeIconAriaLabel && (React.createElement(CloseButton, { variant: inverse ? 'inverse' : undefined, onClick: onClose, "aria-label": closeIconAriaLabel, icon: xIcon }))));
|
|
78
|
-
};
|
|
79
|
-
return DrawerHeader;
|
|
80
|
-
}(React.Component));
|
|
81
|
-
export default DrawerHeader;
|
package/drawer/README.md
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# Canvas Kit React Drawer
|
|
2
|
-
|
|
3
|
-
<a href="https://github.com/Workday/canvas-kit/tree/master/modules/labs-react/README.md">
|
|
4
|
-
<img src="https://img.shields.io/badge/LABS-alpha-orange" alt="LABS: Alpha" />
|
|
5
|
-
</a> This component is work in progress and currently in pre-release.
|
|
6
|
-
|
|
7
|
-
## Installation
|
|
8
|
-
|
|
9
|
-
```sh
|
|
10
|
-
yarn add @workday/canvas-kit-labs-react
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
```tsx
|
|
16
|
-
import * as React from 'react';
|
|
17
|
-
import {Drawer, DrawerDirection, DrawerHeader} from '@workday/canvas-kit-labs-react/drawer';
|
|
18
|
-
import {space} from '@workday/canvas-kit-react/tokens';
|
|
19
|
-
|
|
20
|
-
<div style={{height: '100vh', position: 'relative'}}>
|
|
21
|
-
<Drawer
|
|
22
|
-
header={
|
|
23
|
-
<DrawerHeader
|
|
24
|
-
onClose={() => {
|
|
25
|
-
window.alert('onClose Clicked');
|
|
26
|
-
}}
|
|
27
|
-
headerTitle={'Drawer Header'}
|
|
28
|
-
/>
|
|
29
|
-
}
|
|
30
|
-
openDirection={DrawerDirection.Left}
|
|
31
|
-
padding={space.l}
|
|
32
|
-
showDropShadow={true}
|
|
33
|
-
></Drawer>
|
|
34
|
-
</div>;
|
|
35
|
-
```
|
package/drawer/index.ts
DELETED
package/drawer/lib/Drawer.tsx
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import styled from '@emotion/styled';
|
|
3
|
-
import {colors, space, CanvasSpaceValues} from '@workday/canvas-kit-react/tokens';
|
|
4
|
-
|
|
5
|
-
export interface DrawerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
-
/**
|
|
7
|
-
* The padding of the Drawer contents.
|
|
8
|
-
* @default space.s
|
|
9
|
-
*/
|
|
10
|
-
padding?: CanvasSpaceValues;
|
|
11
|
-
/**
|
|
12
|
-
* The direction from which the Drawer opens. Accepts `Left` or `Right`.
|
|
13
|
-
* @default DrawerDirection.Right
|
|
14
|
-
*/
|
|
15
|
-
openDirection?: DrawerDirection;
|
|
16
|
-
/**
|
|
17
|
-
* The width of the Drawer in `px`.
|
|
18
|
-
* @default 360
|
|
19
|
-
*/
|
|
20
|
-
width?: number;
|
|
21
|
-
/**
|
|
22
|
-
* If true, render the Drawer with a drop shadow.
|
|
23
|
-
* @default false
|
|
24
|
-
*/
|
|
25
|
-
showDropShadow?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* The optional DrawerHeader component of the Drawer. Shows an optional string and close button.
|
|
28
|
-
*/
|
|
29
|
-
header?: React.ReactElement;
|
|
30
|
-
/**
|
|
31
|
-
* The `aria-labelledby` of the Drawer. Set this when there is a `header` for accessibility. The `role` attribute should also be used when this attribute is present. This value should be the same as the `id` attribute of the `header` element.
|
|
32
|
-
*/
|
|
33
|
-
'aria-labelledby'?: string;
|
|
34
|
-
/**
|
|
35
|
-
* The `aria-label` for the Drawer. Set this when there is NO `header` for accessibility.
|
|
36
|
-
*/
|
|
37
|
-
'aria-label'?: string;
|
|
38
|
-
/**
|
|
39
|
-
* The role of the Drawer. If `role` is provided, you must also set `aria-labelledby` to link `header` to the `role`.
|
|
40
|
-
*/
|
|
41
|
-
role?: string;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export enum DrawerDirection {
|
|
45
|
-
Left,
|
|
46
|
-
Right,
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const DrawerContainer = styled('div')<
|
|
50
|
-
Pick<DrawerProps, 'width' | 'showDropShadow' | 'openDirection'>
|
|
51
|
-
>(
|
|
52
|
-
{
|
|
53
|
-
height: '100%',
|
|
54
|
-
backgroundColor: 'white',
|
|
55
|
-
display: 'flex',
|
|
56
|
-
flexDirection: 'column',
|
|
57
|
-
position: 'absolute',
|
|
58
|
-
},
|
|
59
|
-
({width}) => ({
|
|
60
|
-
width: width,
|
|
61
|
-
}),
|
|
62
|
-
({showDropShadow, openDirection}) => ({
|
|
63
|
-
boxShadow:
|
|
64
|
-
openDirection === DrawerDirection.Right && showDropShadow
|
|
65
|
-
? '-8px 0px 16px 0 rgba(0,0,0,0.12)'
|
|
66
|
-
: openDirection === DrawerDirection.Left && showDropShadow
|
|
67
|
-
? '8px 0px 16px 0 rgba(0,0,0,0.12)'
|
|
68
|
-
: undefined,
|
|
69
|
-
}),
|
|
70
|
-
({openDirection}) => ({
|
|
71
|
-
borderLeft: openDirection === DrawerDirection.Right ? `1px solid ${colors.soap400}` : undefined,
|
|
72
|
-
borderRight: openDirection === DrawerDirection.Left ? `1px solid ${colors.soap400}` : undefined,
|
|
73
|
-
right: openDirection === DrawerDirection.Right ? space.zero : undefined,
|
|
74
|
-
left: openDirection === DrawerDirection.Left ? space.zero : undefined,
|
|
75
|
-
})
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
const ChildrenContainer = styled('div')<Pick<DrawerProps, 'padding'>>(
|
|
79
|
-
{
|
|
80
|
-
height: '100%',
|
|
81
|
-
overflowY: 'auto',
|
|
82
|
-
wordBreak: 'break-word',
|
|
83
|
-
wordWrap: 'break-word', // Needed for IE11
|
|
84
|
-
position: 'relative',
|
|
85
|
-
},
|
|
86
|
-
({padding}) => ({
|
|
87
|
-
padding: padding,
|
|
88
|
-
})
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
export default class Drawer extends React.Component<DrawerProps, {}> {
|
|
92
|
-
static OpenDirection = DrawerDirection;
|
|
93
|
-
|
|
94
|
-
public render() {
|
|
95
|
-
const {
|
|
96
|
-
padding = space.s,
|
|
97
|
-
width = 360,
|
|
98
|
-
openDirection = DrawerDirection.Right,
|
|
99
|
-
showDropShadow = false,
|
|
100
|
-
children,
|
|
101
|
-
header,
|
|
102
|
-
role,
|
|
103
|
-
...elemProps
|
|
104
|
-
} = this.props;
|
|
105
|
-
|
|
106
|
-
return (
|
|
107
|
-
<DrawerContainer
|
|
108
|
-
role={role}
|
|
109
|
-
{...elemProps}
|
|
110
|
-
showDropShadow={showDropShadow}
|
|
111
|
-
width={width}
|
|
112
|
-
openDirection={openDirection}
|
|
113
|
-
>
|
|
114
|
-
{header}
|
|
115
|
-
<ChildrenContainer padding={padding}>{children}</ChildrenContainer>
|
|
116
|
-
</DrawerContainer>
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
}
|