@workday/canvas-kit-labs-react 8.0.0-alpha.253-next.22 → 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,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import {createComponent} from '@workday/canvas-kit-react/common';
|
|
3
|
+
import {createComponent, ExtractProps} from '@workday/canvas-kit-react/common';
|
|
4
4
|
import {Box} from '@workday/canvas-kit-react/layout';
|
|
5
5
|
import {colors, space, type} from '@workday/canvas-kit-react/tokens';
|
|
6
6
|
|
|
7
|
-
export interface ExpandableTitleProps {
|
|
7
|
+
export interface ExpandableTitleProps extends ExtractProps<typeof Box, never> {
|
|
8
8
|
/**
|
|
9
9
|
* Children of the `Expandable.Title`. This should contain a string for the title
|
|
10
10
|
*/
|
|
@@ -18,13 +18,11 @@ export const ExpandableTitle = createComponent('div')({
|
|
|
18
18
|
<Box
|
|
19
19
|
as={Element}
|
|
20
20
|
ref={ref}
|
|
21
|
-
|
|
21
|
+
{...type.levels.body.medium}
|
|
22
|
+
fontWeight={type.properties.fontWeights.bold}
|
|
22
23
|
color={colors.blackPepper400}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
fontWeight: type.properties.fontWeights.bold,
|
|
26
|
-
textAlign: 'left',
|
|
27
|
-
}}
|
|
24
|
+
padding={`2px ${space.zero} 2px`}
|
|
25
|
+
textAlign="left"
|
|
28
26
|
{...elemProps}
|
|
29
27
|
>
|
|
30
28
|
{children}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {createElemPropsHook} from '@workday/canvas-kit-react/common';
|
|
2
|
-
import {useExpandableModel} from '
|
|
2
|
+
import {useExpandableModel} from './useExpandableModel';
|
|
3
3
|
|
|
4
4
|
export const useExpandableContent = createElemPropsHook(useExpandableModel)(({state}) => {
|
|
5
5
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {createElemPropsHook} from '@workday/canvas-kit-react/common';
|
|
2
|
-
import {useExpandableModel} from '
|
|
2
|
+
import {useExpandableModel} from './useExpandableModel';
|
|
3
3
|
|
|
4
4
|
export const useExpandableIcon = createElemPropsHook(useExpandableModel)(({state}) => {
|
|
5
5
|
return {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {createModelHook} from '@workday/canvas-kit-react/common';
|
|
2
2
|
import {useDisclosureModel} from '@workday/canvas-kit-react/disclosure';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* The `ExpandableModel` extends the `DisclosureModel`
|
|
6
|
+
*/
|
|
4
7
|
export const useExpandableModel = createModelHook({
|
|
5
8
|
defaultConfig: {
|
|
6
9
|
...useDisclosureModel.defaultConfig,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {createElemPropsHook} from '@workday/canvas-kit-react/common';
|
|
2
|
-
import {useExpandableModel} from '
|
|
2
|
+
import {useExpandableModel} from './useExpandableModel';
|
|
3
3
|
|
|
4
4
|
export const useExpandableTarget = createElemPropsHook(useExpandableModel)(({state, events}) => {
|
|
5
5
|
return {
|
package/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-labs-react",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.428-next.2+2c79134a",
|
|
4
4
|
"description": "Canvas Kit Labs is an incubator for new and experimental components. Since we have a rather rigorous process for getting components in at a production level, it can be valuable to make them available earlier while we continuously iterate on the API/functionality. The Labs modules allow us to do that as needed.",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"workday"
|
|
42
42
|
],
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"react": "
|
|
44
|
+
"react": ">=16.14"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@emotion/react": "^11.7.1",
|
|
48
48
|
"@emotion/styled": "^11.6.0",
|
|
49
|
-
"@workday/canvas-kit-react": "^8.0.0-alpha.
|
|
49
|
+
"@workday/canvas-kit-react": "^8.0.0-alpha.428-next.2+2c79134a",
|
|
50
50
|
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
51
51
|
"@workday/design-assets-types": "^0.2.8",
|
|
52
52
|
"chroma-js": "^2.1.0",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/lodash.flatten": "^4.4.6"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "2c79134aa48ef0efde9cdf883b529b8157337a28"
|
|
60
60
|
}
|
|
@@ -86,6 +86,11 @@ export interface SearchFormProps extends GrowthBehavior, React.FormHTMLAttribute
|
|
|
86
86
|
* @default false
|
|
87
87
|
*/
|
|
88
88
|
allowEmptyStringSearch?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Sets the `id` for the label
|
|
91
|
+
* @default unique identifier
|
|
92
|
+
*/
|
|
93
|
+
labelId?: string;
|
|
89
94
|
}
|
|
90
95
|
|
|
91
96
|
export interface SearchFormState {
|
|
@@ -276,7 +281,7 @@ export class SearchForm extends React.Component<SearchFormProps, SearchFormState
|
|
|
276
281
|
|
|
277
282
|
private inputRef = React.createRef<HTMLInputElement>();
|
|
278
283
|
private openRef = React.createRef<HTMLButtonElement>();
|
|
279
|
-
private
|
|
284
|
+
private defaultLabelId = generateUniqueId();
|
|
280
285
|
|
|
281
286
|
state: Readonly<SearchFormState> = {
|
|
282
287
|
showForm: false,
|
|
@@ -381,6 +386,7 @@ export class SearchForm extends React.Component<SearchFormProps, SearchFormState
|
|
|
381
386
|
submitAriaLabel = 'Search',
|
|
382
387
|
openButtonAriaLabel = 'Open Search',
|
|
383
388
|
closeButtonAriaLabel = 'Cancel',
|
|
389
|
+
labelId = this.defaultLabelId,
|
|
384
390
|
showClearButton = true,
|
|
385
391
|
height = 40,
|
|
386
392
|
grow,
|
|
@@ -401,7 +407,7 @@ export class SearchForm extends React.Component<SearchFormProps, SearchFormState
|
|
|
401
407
|
action="."
|
|
402
408
|
rightAlign={rightAlign}
|
|
403
409
|
grow={grow}
|
|
404
|
-
aria-labelledby={
|
|
410
|
+
aria-labelledby={labelId}
|
|
405
411
|
isCollapsed={isCollapsed}
|
|
406
412
|
onSubmit={this.handleSubmit}
|
|
407
413
|
showForm={this.state.showForm}
|
|
@@ -428,8 +434,8 @@ export class SearchForm extends React.Component<SearchFormProps, SearchFormState
|
|
|
428
434
|
/>
|
|
429
435
|
<SearchField
|
|
430
436
|
grow={grow}
|
|
431
|
-
id={
|
|
432
|
-
inputId={`input-${
|
|
437
|
+
id={labelId}
|
|
438
|
+
inputId={`input-${labelId}`}
|
|
433
439
|
label={inputLabel}
|
|
434
440
|
labelPosition={FormFieldLabelPosition.Hidden}
|
|
435
441
|
useFieldset={false}
|
|
@@ -446,7 +452,7 @@ export class SearchForm extends React.Component<SearchFormProps, SearchFormState
|
|
|
446
452
|
onBlur={this.handleBlur}
|
|
447
453
|
showClearButton={!isCollapsed && showClearButton}
|
|
448
454
|
clearButtonAriaLabel={clearButtonAriaLabel}
|
|
449
|
-
labelId={
|
|
455
|
+
labelId={labelId}
|
|
450
456
|
>
|
|
451
457
|
<SearchInput
|
|
452
458
|
ref={this.inputRef}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import {useThemeRTL} from './useThemeRTL';
|
|
2
|
-
import {CanvasThemePalette, EmotionCanvasTheme} from '@workday/canvas-kit-react/common';
|
|
3
|
-
import {colors, CSSProperties, inputColors, statusColors} from '@workday/canvas-kit-react/tokens';
|
|
4
|
-
import chroma from 'chroma-js';
|
|
5
|
-
|
|
6
|
-
type paletteSelection = Exclude<keyof EmotionCanvasTheme['canvas']['palette'], 'common'>;
|
|
7
|
-
interface ContrastColors {
|
|
8
|
-
outer?: string;
|
|
9
|
-
inner?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const isAccessible = (foreground: string, background: string = colors.frenchVanilla100) => {
|
|
13
|
-
return chroma.contrast(foreground, background) >= 3;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const getPaletteColorsFromTheme = (
|
|
17
|
-
palette: CanvasThemePalette,
|
|
18
|
-
fallbackColors?: ContrastColors
|
|
19
|
-
): ContrastColors => {
|
|
20
|
-
return {
|
|
21
|
-
outer: isAccessible(palette.main)
|
|
22
|
-
? palette.main
|
|
23
|
-
: isAccessible(palette.darkest)
|
|
24
|
-
? palette.darkest
|
|
25
|
-
: fallbackColors?.outer,
|
|
26
|
-
inner: fallbackColors?.inner ? fallbackColors.inner : palette.main,
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export function getPaletteColors(
|
|
31
|
-
type: paletteSelection,
|
|
32
|
-
theme: EmotionCanvasTheme
|
|
33
|
-
): ContrastColors {
|
|
34
|
-
const palette = theme.canvas.palette[type];
|
|
35
|
-
|
|
36
|
-
switch (type) {
|
|
37
|
-
case 'error': {
|
|
38
|
-
return getPaletteColorsFromTheme(palette, {outer: inputColors.error.border});
|
|
39
|
-
}
|
|
40
|
-
case 'alert': {
|
|
41
|
-
return getPaletteColorsFromTheme(palette, {outer: colors.cantaloupe600});
|
|
42
|
-
}
|
|
43
|
-
case 'success': {
|
|
44
|
-
return getPaletteColorsFromTheme(palette, {
|
|
45
|
-
outer: colors.greenApple600,
|
|
46
|
-
// The theme default for success.main is set to the darkest GreenApple
|
|
47
|
-
// For our default ring, we need to override it so the inner ring is a bit lighter
|
|
48
|
-
inner: palette.main === colors.greenApple600 ? statusColors.success : palette.main,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
default: {
|
|
52
|
-
return getPaletteColorsFromTheme(palette);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export const useThemedRing = (type: paletteSelection): CSSProperties => {
|
|
58
|
-
const {themeRTL, theme} = useThemeRTL();
|
|
59
|
-
|
|
60
|
-
const paletteColors = getPaletteColors(type, theme);
|
|
61
|
-
if (!(paletteColors?.outer || paletteColors?.inner)) {
|
|
62
|
-
return {};
|
|
63
|
-
}
|
|
64
|
-
const errorBoxShadow = `inset 0 0 0 ${paletteColors.outer === paletteColors.inner ? 1 : 2}px ${
|
|
65
|
-
paletteColors.inner
|
|
66
|
-
}`;
|
|
67
|
-
|
|
68
|
-
return themeRTL({
|
|
69
|
-
borderColor: paletteColors.outer,
|
|
70
|
-
transition: '100ms box-shadow',
|
|
71
|
-
boxShadow: errorBoxShadow,
|
|
72
|
-
'&:hover, &:disabled': {
|
|
73
|
-
borderColor: paletteColors.outer,
|
|
74
|
-
},
|
|
75
|
-
'&:focus:not([disabled])': {
|
|
76
|
-
borderColor: paletteColors.outer,
|
|
77
|
-
boxShadow: `${errorBoxShadow},
|
|
78
|
-
0 0 0 2px ${colors.frenchVanilla100},
|
|
79
|
-
0 0 0 4px ${theme ? theme.canvas.palette.common.focusOutline : inputColors.focusBorder}`,
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
};
|
|
@@ -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,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.useThemedRing = exports.getPaletteColors = void 0;
|
|
7
|
-
var useThemeRTL_1 = require("./useThemeRTL");
|
|
8
|
-
var tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
9
|
-
var chroma_js_1 = __importDefault(require("chroma-js"));
|
|
10
|
-
var isAccessible = function (foreground, background) {
|
|
11
|
-
if (background === void 0) { background = tokens_1.colors.frenchVanilla100; }
|
|
12
|
-
return chroma_js_1.default.contrast(foreground, background) >= 3;
|
|
13
|
-
};
|
|
14
|
-
var getPaletteColorsFromTheme = function (palette, fallbackColors) {
|
|
15
|
-
return {
|
|
16
|
-
outer: isAccessible(palette.main)
|
|
17
|
-
? palette.main
|
|
18
|
-
: isAccessible(palette.darkest)
|
|
19
|
-
? palette.darkest
|
|
20
|
-
: fallbackColors === null || fallbackColors === void 0 ? void 0 : fallbackColors.outer,
|
|
21
|
-
inner: (fallbackColors === null || fallbackColors === void 0 ? void 0 : fallbackColors.inner) ? fallbackColors.inner : palette.main,
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
function getPaletteColors(type, theme) {
|
|
25
|
-
var palette = theme.canvas.palette[type];
|
|
26
|
-
switch (type) {
|
|
27
|
-
case 'error': {
|
|
28
|
-
return getPaletteColorsFromTheme(palette, { outer: tokens_1.inputColors.error.border });
|
|
29
|
-
}
|
|
30
|
-
case 'alert': {
|
|
31
|
-
return getPaletteColorsFromTheme(palette, { outer: tokens_1.colors.cantaloupe600 });
|
|
32
|
-
}
|
|
33
|
-
case 'success': {
|
|
34
|
-
return getPaletteColorsFromTheme(palette, {
|
|
35
|
-
outer: tokens_1.colors.greenApple600,
|
|
36
|
-
// The theme default for success.main is set to the darkest GreenApple
|
|
37
|
-
// For our default ring, we need to override it so the inner ring is a bit lighter
|
|
38
|
-
inner: palette.main === tokens_1.colors.greenApple600 ? tokens_1.statusColors.success : palette.main,
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
default: {
|
|
42
|
-
return getPaletteColorsFromTheme(palette);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
exports.getPaletteColors = getPaletteColors;
|
|
47
|
-
var useThemedRing = function (type) {
|
|
48
|
-
var _a = useThemeRTL_1.useThemeRTL(), themeRTL = _a.themeRTL, theme = _a.theme;
|
|
49
|
-
var paletteColors = getPaletteColors(type, theme);
|
|
50
|
-
if (!((paletteColors === null || paletteColors === void 0 ? void 0 : paletteColors.outer) || (paletteColors === null || paletteColors === void 0 ? void 0 : paletteColors.inner))) {
|
|
51
|
-
return {};
|
|
52
|
-
}
|
|
53
|
-
var errorBoxShadow = "inset 0 0 0 " + (paletteColors.outer === paletteColors.inner ? 1 : 2) + "px " + paletteColors.inner;
|
|
54
|
-
return themeRTL({
|
|
55
|
-
borderColor: paletteColors.outer,
|
|
56
|
-
transition: '100ms box-shadow',
|
|
57
|
-
boxShadow: errorBoxShadow,
|
|
58
|
-
'&:hover, &:disabled': {
|
|
59
|
-
borderColor: paletteColors.outer,
|
|
60
|
-
},
|
|
61
|
-
'&:focus:not([disabled])': {
|
|
62
|
-
borderColor: paletteColors.outer,
|
|
63
|
-
boxShadow: errorBoxShadow + ",\n 0 0 0 2px " + tokens_1.colors.frenchVanilla100 + ",\n 0 0 0 4px " + (theme ? theme.canvas.palette.common.focusOutline : tokens_1.inputColors.focusBorder),
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
exports.useThemedRing = useThemedRing;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../drawer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,sBAAsB,EAAC,MAAM,oBAAoB,CAAC;AAC1D,cAAc,cAAc,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.DeprecatedDrawerHeader = void 0;
|
|
14
|
-
var DrawerHeader_1 = require("./lib/DrawerHeader");
|
|
15
|
-
Object.defineProperty(exports, "DeprecatedDrawerHeader", { enumerable: true, get: function () { return DrawerHeader_1.DeprecatedDrawerHeader; } });
|
|
16
|
-
__exportStar(require("./lib/Drawer"), exports);
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { CanvasSpaceValues } from '@workday/canvas-kit-react/tokens';
|
|
3
|
-
/**
|
|
4
|
-
* ### Deprecated Drawer Props
|
|
5
|
-
*
|
|
6
|
-
* As of Canvas Kit v8, Drawer is being soft-deprecated.
|
|
7
|
-
* It will be hard-deprecated (completely removed) in v9. Please see the
|
|
8
|
-
* [upgrade guide](https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page)
|
|
9
|
-
* for more information.
|
|
10
|
-
*/
|
|
11
|
-
export interface DeprecatedDrawerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
12
|
-
/**
|
|
13
|
-
* The padding of the DeprecatedDrawer contents.
|
|
14
|
-
* @default space.s
|
|
15
|
-
*/
|
|
16
|
-
padding?: CanvasSpaceValues;
|
|
17
|
-
/**
|
|
18
|
-
* The direction from which the DeprecatedDrawer opens. Accepts `Left` or `Right`.
|
|
19
|
-
* @default DeprecatedDrawerDirection.Right
|
|
20
|
-
*/
|
|
21
|
-
openDirection?: DeprecatedDrawerDirection;
|
|
22
|
-
/**
|
|
23
|
-
* The width of the DeprecatedDrawer in `px`.
|
|
24
|
-
* @default 360
|
|
25
|
-
*/
|
|
26
|
-
width?: number;
|
|
27
|
-
/**
|
|
28
|
-
* If true, render the DeprecatedDrawer with a drop shadow.
|
|
29
|
-
* @default false
|
|
30
|
-
*/
|
|
31
|
-
showDropShadow?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* The optional DeprecatedDrawerHeader component of the DeprecatedDrawer. Shows an optional string and close button.
|
|
34
|
-
*/
|
|
35
|
-
header?: React.ReactElement;
|
|
36
|
-
/**
|
|
37
|
-
* The `aria-labelledby` of the DeprecatedDrawer. 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.
|
|
38
|
-
*/
|
|
39
|
-
'aria-labelledby'?: string;
|
|
40
|
-
/**
|
|
41
|
-
* The `aria-label` for the DeprecatedDrawer. Set this when there is NO `header` for accessibility.
|
|
42
|
-
*/
|
|
43
|
-
'aria-label'?: string;
|
|
44
|
-
/**
|
|
45
|
-
* The role of the DeprecatedDrawer. If `role` is provided, you must also set `aria-labelledby` to link `header` to the `role`.
|
|
46
|
-
*/
|
|
47
|
-
role?: string;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* ### Deprecated Drawer Direction
|
|
51
|
-
*
|
|
52
|
-
* As of Canvas Kit v8, Drawer is being soft-deprecated.
|
|
53
|
-
* It will be hard-deprecated (completely removed) in v9. Please see the
|
|
54
|
-
* [upgrade guide](https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page)
|
|
55
|
-
* for more information.
|
|
56
|
-
*/
|
|
57
|
-
export declare enum DeprecatedDrawerDirection {
|
|
58
|
-
Left = 0,
|
|
59
|
-
Right = 1
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* ### Deprecated Drawer
|
|
63
|
-
*
|
|
64
|
-
* As of Canvas Kit v8, this component is being soft-deprecated.
|
|
65
|
-
* It will be hard-deprecated (completely removed) in v9. Please see the
|
|
66
|
-
* [upgrade guide](https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page)
|
|
67
|
-
* for more information.
|
|
68
|
-
*/
|
|
69
|
-
export declare class DeprecatedDrawer extends React.Component<DeprecatedDrawerProps, {}> {
|
|
70
|
-
static OpenDirection: typeof DeprecatedDrawerDirection;
|
|
71
|
-
componentDidMount(): void;
|
|
72
|
-
render(): JSX.Element;
|
|
73
|
-
}
|
|
74
|
-
//# 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;;;;;;;GAOG;AAEH,MAAM,WAAW,qBAAsB,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IACjF;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B;;;OAGG;IACH,aAAa,CAAC,EAAE,yBAAyB,CAAC;IAC1C;;;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;;;;;;;GAOG;AAEH,oBAAY,yBAAyB;IACnC,IAAI,IAAA;IACJ,KAAK,IAAA;CACN;AA6CD;;;;;;;GAOG;AAEH,qBAAa,gBAAiB,SAAQ,KAAK,CAAC,SAAS,CAAC,qBAAqB,EAAE,EAAE,CAAC;IAC9E,MAAM,CAAC,aAAa,mCAA6B;IAEjD,iBAAiB;IASV,MAAM;CAyBd"}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
var __assign = (this && this.__assign) || function () {
|
|
16
|
-
__assign = Object.assign || function(t) {
|
|
17
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
18
|
-
s = arguments[i];
|
|
19
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
20
|
-
t[p] = s[p];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
return __assign.apply(this, arguments);
|
|
25
|
-
};
|
|
26
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
27
|
-
if (k2 === undefined) k2 = k;
|
|
28
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
29
|
-
}) : (function(o, m, k, k2) {
|
|
30
|
-
if (k2 === undefined) k2 = k;
|
|
31
|
-
o[k2] = m[k];
|
|
32
|
-
}));
|
|
33
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
34
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
35
|
-
}) : function(o, v) {
|
|
36
|
-
o["default"] = v;
|
|
37
|
-
});
|
|
38
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
39
|
-
if (mod && mod.__esModule) return mod;
|
|
40
|
-
var result = {};
|
|
41
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
42
|
-
__setModuleDefault(result, mod);
|
|
43
|
-
return result;
|
|
44
|
-
};
|
|
45
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
46
|
-
var t = {};
|
|
47
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
48
|
-
t[p] = s[p];
|
|
49
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
50
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
51
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
52
|
-
t[p[i]] = s[p[i]];
|
|
53
|
-
}
|
|
54
|
-
return t;
|
|
55
|
-
};
|
|
56
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
57
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
58
|
-
};
|
|
59
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
|
-
exports.DeprecatedDrawer = exports.DeprecatedDrawerDirection = void 0;
|
|
61
|
-
var React = __importStar(require("react"));
|
|
62
|
-
var styled_1 = __importDefault(require("@emotion/styled"));
|
|
63
|
-
var tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
64
|
-
/**
|
|
65
|
-
* ### Deprecated Drawer Direction
|
|
66
|
-
*
|
|
67
|
-
* As of Canvas Kit v8, Drawer is being soft-deprecated.
|
|
68
|
-
* It will be hard-deprecated (completely removed) in v9. Please see the
|
|
69
|
-
* [upgrade guide](https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page)
|
|
70
|
-
* for more information.
|
|
71
|
-
*/
|
|
72
|
-
var DeprecatedDrawerDirection;
|
|
73
|
-
(function (DeprecatedDrawerDirection) {
|
|
74
|
-
DeprecatedDrawerDirection[DeprecatedDrawerDirection["Left"] = 0] = "Left";
|
|
75
|
-
DeprecatedDrawerDirection[DeprecatedDrawerDirection["Right"] = 1] = "Right";
|
|
76
|
-
})(DeprecatedDrawerDirection = exports.DeprecatedDrawerDirection || (exports.DeprecatedDrawerDirection = {}));
|
|
77
|
-
var DrawerContainer = styled_1.default('div')({
|
|
78
|
-
height: '100%',
|
|
79
|
-
backgroundColor: 'white',
|
|
80
|
-
display: 'flex',
|
|
81
|
-
flexDirection: 'column',
|
|
82
|
-
position: 'absolute',
|
|
83
|
-
}, function (_a) {
|
|
84
|
-
var width = _a.width;
|
|
85
|
-
return ({
|
|
86
|
-
width: width,
|
|
87
|
-
});
|
|
88
|
-
}, function (_a) {
|
|
89
|
-
var showDropShadow = _a.showDropShadow, openDirection = _a.openDirection;
|
|
90
|
-
return ({
|
|
91
|
-
boxShadow: openDirection === DeprecatedDrawerDirection.Right && showDropShadow
|
|
92
|
-
? '-8px 0px 16px 0 rgba(0,0,0,0.12)'
|
|
93
|
-
: openDirection === DeprecatedDrawerDirection.Left && showDropShadow
|
|
94
|
-
? '8px 0px 16px 0 rgba(0,0,0,0.12)'
|
|
95
|
-
: undefined,
|
|
96
|
-
});
|
|
97
|
-
}, function (_a) {
|
|
98
|
-
var openDirection = _a.openDirection;
|
|
99
|
-
return ({
|
|
100
|
-
borderLeft: openDirection === DeprecatedDrawerDirection.Right ? "1px solid " + tokens_1.colors.soap400 : undefined,
|
|
101
|
-
borderRight: openDirection === DeprecatedDrawerDirection.Left ? "1px solid " + tokens_1.colors.soap400 : undefined,
|
|
102
|
-
right: openDirection === DeprecatedDrawerDirection.Right ? tokens_1.space.zero : undefined,
|
|
103
|
-
left: openDirection === DeprecatedDrawerDirection.Left ? tokens_1.space.zero : undefined,
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
var ChildrenContainer = styled_1.default('div')({
|
|
107
|
-
height: '100%',
|
|
108
|
-
overflowY: 'auto',
|
|
109
|
-
wordBreak: 'break-word',
|
|
110
|
-
position: 'relative',
|
|
111
|
-
}, function (_a) {
|
|
112
|
-
var padding = _a.padding;
|
|
113
|
-
return ({
|
|
114
|
-
padding: padding,
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
/**
|
|
118
|
-
* ### Deprecated Drawer
|
|
119
|
-
*
|
|
120
|
-
* As of Canvas Kit v8, this component is being soft-deprecated.
|
|
121
|
-
* It will be hard-deprecated (completely removed) in v9. Please see the
|
|
122
|
-
* [upgrade guide](https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page)
|
|
123
|
-
* for more information.
|
|
124
|
-
*/
|
|
125
|
-
var DeprecatedDrawer = /** @class */ (function (_super) {
|
|
126
|
-
__extends(DeprecatedDrawer, _super);
|
|
127
|
-
function DeprecatedDrawer() {
|
|
128
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
129
|
-
}
|
|
130
|
-
DeprecatedDrawer.prototype.componentDidMount = function () {
|
|
131
|
-
console.warn("This component is being deprecated and will be removed in Canvas Kit V9.\n\n For more information, please see the V8 upgrade guide:\n\n https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page\n ");
|
|
132
|
-
};
|
|
133
|
-
DeprecatedDrawer.prototype.render = function () {
|
|
134
|
-
var _a = this.props, _b = _a.padding, padding = _b === void 0 ? tokens_1.space.s : _b, _c = _a.width, width = _c === void 0 ? 360 : _c, _d = _a.openDirection, openDirection = _d === void 0 ? DeprecatedDrawerDirection.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"]);
|
|
135
|
-
return (React.createElement(DrawerContainer, __assign({ role: role }, elemProps, { showDropShadow: showDropShadow, width: width, openDirection: openDirection }),
|
|
136
|
-
header,
|
|
137
|
-
React.createElement(ChildrenContainer, { padding: padding }, children)));
|
|
138
|
-
};
|
|
139
|
-
DeprecatedDrawer.OpenDirection = DeprecatedDrawerDirection;
|
|
140
|
-
return DeprecatedDrawer;
|
|
141
|
-
}(React.Component));
|
|
142
|
-
exports.DeprecatedDrawer = DeprecatedDrawer;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { CanvasColor } from '@workday/canvas-kit-react/tokens';
|
|
3
|
-
/**
|
|
4
|
-
* ### Deprecated Drawer Header Props
|
|
5
|
-
*
|
|
6
|
-
* As of Canvas Kit v8, this component is being soft-deprecated.
|
|
7
|
-
* It will be hard-deprecated (completely removed) in v9. Please see the
|
|
8
|
-
* [upgrade guide](https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page)
|
|
9
|
-
* for more information.
|
|
10
|
-
*/
|
|
11
|
-
export interface DeprecatedDrawerHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
12
|
-
/**
|
|
13
|
-
* The text of the DeprecatedDrawerHeader. This text will also be applied as the `title` attribute of the header element.
|
|
14
|
-
*/
|
|
15
|
-
title?: string;
|
|
16
|
-
/**
|
|
17
|
-
* The function called when the DeprecatedDrawerHeader close button is clicked.
|
|
18
|
-
*/
|
|
19
|
-
onClose?: React.MouseEventHandler<HTMLButtonElement>;
|
|
20
|
-
/**
|
|
21
|
-
* The `aria-label` for the DrawHeader close button. Useful for i18n.
|
|
22
|
-
* @default Close
|
|
23
|
-
*/
|
|
24
|
-
closeIconAriaLabel?: string;
|
|
25
|
-
/**
|
|
26
|
-
* The background color of the DeprecatedDrawerHeader.
|
|
27
|
-
*/
|
|
28
|
-
headerColor?: CanvasColor | string;
|
|
29
|
-
/**
|
|
30
|
-
* The border color of the DeprecatedDrawerHeader. This should match something close to `headerColor`.
|
|
31
|
-
*/
|
|
32
|
-
borderColor?: CanvasColor | string;
|
|
33
|
-
/**
|
|
34
|
-
* If true, render the icon and header in white. Useful for preserving contrast with a dark `headerColor`.
|
|
35
|
-
* @default false
|
|
36
|
-
*/
|
|
37
|
-
inverse?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* The unique id of the DeprecatedDrawerHeader for accessibility.
|
|
40
|
-
*/
|
|
41
|
-
id?: string;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* ### Deprecated Drawer Header
|
|
45
|
-
*
|
|
46
|
-
* As of Canvas Kit v8, this component is being soft-deprecated.
|
|
47
|
-
* It will be hard-deprecated (completely removed) in v9. Please see the
|
|
48
|
-
* [upgrade guide](https://workday.github.io/canvas-kit/?path=/story/welcome-upgrade-guides-v8-0--page)
|
|
49
|
-
* for more information.
|
|
50
|
-
*/
|
|
51
|
-
export declare class DeprecatedDrawerHeader extends React.Component<DeprecatedDrawerHeaderProps, {}> {
|
|
52
|
-
componentDidMount(): void;
|
|
53
|
-
render(): JSX.Element;
|
|
54
|
-
}
|
|
55
|
-
//# 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,EAAgB,WAAW,EAAa,MAAM,kCAAkC,CAAC;AAKxF;;;;;;;GAOG;AAEH,MAAM,WAAW,2BAA4B,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IACvF;;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;AA0BD;;;;;;;GAOG;AAEH,qBAAa,sBAAuB,SAAQ,KAAK,CAAC,SAAS,CAAC,2BAA2B,EAAE,EAAE,CAAC;IAC1F,iBAAiB;IASV,MAAM;CAwCd"}
|