@workday/canvas-kit-react 11.0.0-alpha.726-next.0 → 11.0.0-alpha.758-next.0
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/breadcrumbs/lib/BreadcrumbsItem.tsx +1 -1
- package/breadcrumbs/lib/BreadcrumbsOverflowButton.tsx +1 -1
- package/button/lib/BaseButton.tsx +16 -1
- package/button/lib/DeleteButton.tsx +12 -11
- package/button/lib/ExternalHyperlink.tsx +1 -1
- package/button/lib/PrimaryButton.tsx +52 -45
- package/button/lib/SecondaryButton.tsx +58 -75
- package/button/lib/TertiaryButton.tsx +63 -54
- package/collection/lib/ListBox.tsx +9 -3
- package/combobox/lib/ComboboxMenuList.tsx +3 -4
- package/dist/commonjs/badge/lib/CountBadge.js +6 -6
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsItem.js +1 -1
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsOverflowButton.js +1 -1
- package/dist/commonjs/button/lib/BaseButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/BaseButton.js +18 -17
- package/dist/commonjs/button/lib/DeleteButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/DeleteButton.js +2 -1
- package/dist/commonjs/button/lib/ExternalHyperlink.js +1 -1
- package/dist/commonjs/button/lib/PrimaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/PrimaryButton.js +3 -2
- package/dist/commonjs/button/lib/SecondaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/SecondaryButton.js +3 -2
- package/dist/commonjs/button/lib/TertiaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/TertiaryButton.js +16 -15
- package/dist/commonjs/card/lib/Card.js +1 -1
- package/dist/commonjs/card/lib/CardHeading.js +1 -1
- package/dist/commonjs/checkbox/lib/CheckBackground.js +5 -5
- package/dist/commonjs/checkbox/lib/CheckboxCheck.js +9 -9
- package/dist/commonjs/checkbox/lib/CheckboxContainer.js +1 -1
- package/dist/commonjs/checkbox/lib/CheckboxInput.js +11 -11
- package/dist/commonjs/checkbox/lib/CheckboxRipple.js +1 -1
- package/dist/commonjs/collection/lib/ListBox.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/ListBox.js +14 -8
- package/dist/commonjs/combobox/lib/ComboboxMenuItem.js +4 -4
- package/dist/commonjs/combobox/lib/ComboboxMenuList.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/ComboboxMenuList.js +4 -5
- package/dist/commonjs/common/lib/AccessibleHide.js +1 -1
- package/dist/commonjs/common/lib/CanvasProvider.js +1 -1
- package/dist/commonjs/icon/index.d.ts +1 -1
- package/dist/commonjs/icon/index.d.ts.map +1 -1
- package/dist/commonjs/icon/index.js +4 -1
- package/dist/commonjs/icon/lib/AccentIcon.d.ts +30 -4
- package/dist/commonjs/icon/lib/AccentIcon.d.ts.map +1 -1
- package/dist/commonjs/icon/lib/AccentIcon.js +28 -4
- package/dist/commonjs/icon/lib/AppletIcon.d.ts +31 -2
- package/dist/commonjs/icon/lib/AppletIcon.d.ts.map +1 -1
- package/dist/commonjs/icon/lib/AppletIcon.js +27 -4
- package/dist/commonjs/icon/lib/Graphic.d.ts +20 -1
- package/dist/commonjs/icon/lib/Graphic.d.ts.map +1 -1
- package/dist/commonjs/icon/lib/Graphic.js +25 -3
- package/dist/commonjs/icon/lib/Svg.d.ts +12 -2
- package/dist/commonjs/icon/lib/Svg.d.ts.map +1 -1
- package/dist/commonjs/icon/lib/Svg.js +25 -10
- package/dist/commonjs/icon/lib/SystemIcon.d.ts +79 -16
- package/dist/commonjs/icon/lib/SystemIcon.d.ts.map +1 -1
- package/dist/commonjs/icon/lib/SystemIcon.js +51 -14
- package/dist/commonjs/icon/lib/SystemIconCircle.d.ts +2 -3
- package/dist/commonjs/icon/lib/SystemIconCircle.d.ts.map +1 -1
- package/dist/commonjs/icon/lib/SystemIconCircle.js +20 -30
- package/dist/commonjs/loading-dots/lib/LoadingDots.js +3 -3
- package/dist/commonjs/menu/lib/MenuCard.js +2 -2
- package/dist/commonjs/menu/lib/MenuList.js +5 -5
- package/dist/commonjs/select/lib/Select.js +7 -7
- package/dist/commonjs/select/lib/hooks/useSelectInput.d.ts +4 -1
- package/dist/commonjs/select/lib/hooks/useSelectInput.d.ts.map +1 -1
- package/dist/commonjs/select/lib/hooks/useSelectInput.js +14 -5
- package/dist/commonjs/switch/lib/Switch.js +13 -13
- package/dist/commonjs/table/lib/Table.js +2 -2
- package/dist/commonjs/table/lib/TableBody.js +2 -2
- package/dist/commonjs/table/lib/TableCaption.js +2 -2
- package/dist/commonjs/table/lib/TableCell.js +2 -2
- package/dist/commonjs/table/lib/TableFooter.js +2 -2
- package/dist/commonjs/table/lib/TableHead.js +2 -2
- package/dist/commonjs/table/lib/TableHeader.js +2 -2
- package/dist/commonjs/table/lib/TableRow.js +2 -2
- package/dist/commonjs/tabs/lib/TabsItem.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/TabsItem.js +4 -12
- package/dist/commonjs/tabs/lib/useTabsModel.d.ts.map +1 -1
- package/dist/commonjs/text/lib/LabelText.d.ts.map +1 -1
- package/dist/commonjs/text/lib/LabelText.js +11 -27
- package/dist/commonjs/text/lib/Text.d.ts +103 -0
- package/dist/commonjs/text/lib/Text.d.ts.map +1 -1
- package/dist/commonjs/text/lib/Text.js +30 -27
- package/dist/commonjs/tooltip/lib/OverflowTooltip.d.ts.map +1 -1
- package/dist/commonjs/tooltip/lib/OverflowTooltip.js +2 -3
- package/dist/es6/badge/lib/CountBadge.js +6 -6
- package/dist/es6/breadcrumbs/lib/BreadcrumbsItem.js +1 -1
- package/dist/es6/breadcrumbs/lib/BreadcrumbsOverflowButton.js +1 -1
- package/dist/es6/button/lib/BaseButton.d.ts.map +1 -1
- package/dist/es6/button/lib/BaseButton.js +18 -17
- package/dist/es6/button/lib/DeleteButton.d.ts.map +1 -1
- package/dist/es6/button/lib/DeleteButton.js +2 -1
- package/dist/es6/button/lib/ExternalHyperlink.js +1 -1
- package/dist/es6/button/lib/PrimaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/PrimaryButton.js +3 -2
- package/dist/es6/button/lib/SecondaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/SecondaryButton.js +3 -2
- package/dist/es6/button/lib/TertiaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/TertiaryButton.js +16 -15
- package/dist/es6/card/lib/Card.js +1 -1
- package/dist/es6/card/lib/CardHeading.js +1 -1
- package/dist/es6/checkbox/lib/CheckBackground.js +5 -5
- package/dist/es6/checkbox/lib/CheckboxCheck.js +9 -9
- package/dist/es6/checkbox/lib/CheckboxContainer.js +1 -1
- package/dist/es6/checkbox/lib/CheckboxInput.js +11 -11
- package/dist/es6/checkbox/lib/CheckboxRipple.js +1 -1
- package/dist/es6/collection/lib/ListBox.d.ts.map +1 -1
- package/dist/es6/collection/lib/ListBox.js +15 -9
- package/dist/es6/combobox/lib/ComboboxMenuItem.js +4 -4
- package/dist/es6/combobox/lib/ComboboxMenuList.d.ts.map +1 -1
- package/dist/es6/combobox/lib/ComboboxMenuList.js +5 -6
- package/dist/es6/common/lib/AccessibleHide.js +1 -1
- package/dist/es6/common/lib/CanvasProvider.js +1 -1
- package/dist/es6/icon/index.d.ts +1 -1
- package/dist/es6/icon/index.d.ts.map +1 -1
- package/dist/es6/icon/index.js +1 -1
- package/dist/es6/icon/lib/AccentIcon.d.ts +30 -4
- package/dist/es6/icon/lib/AccentIcon.d.ts.map +1 -1
- package/dist/es6/icon/lib/AccentIcon.js +27 -3
- package/dist/es6/icon/lib/AppletIcon.d.ts +31 -2
- package/dist/es6/icon/lib/AppletIcon.d.ts.map +1 -1
- package/dist/es6/icon/lib/AppletIcon.js +26 -3
- package/dist/es6/icon/lib/Graphic.d.ts +20 -1
- package/dist/es6/icon/lib/Graphic.d.ts.map +1 -1
- package/dist/es6/icon/lib/Graphic.js +24 -2
- package/dist/es6/icon/lib/Svg.d.ts +12 -2
- package/dist/es6/icon/lib/Svg.d.ts.map +1 -1
- package/dist/es6/icon/lib/Svg.js +25 -11
- package/dist/es6/icon/lib/SystemIcon.d.ts +79 -16
- package/dist/es6/icon/lib/SystemIcon.d.ts.map +1 -1
- package/dist/es6/icon/lib/SystemIcon.js +50 -13
- package/dist/es6/icon/lib/SystemIconCircle.d.ts +2 -3
- package/dist/es6/icon/lib/SystemIconCircle.d.ts.map +1 -1
- package/dist/es6/icon/lib/SystemIconCircle.js +23 -30
- package/dist/es6/loading-dots/lib/LoadingDots.js +3 -3
- package/dist/es6/menu/lib/MenuCard.js +2 -2
- package/dist/es6/menu/lib/MenuList.js +5 -5
- package/dist/es6/select/lib/Select.js +7 -7
- package/dist/es6/select/lib/hooks/useSelectInput.d.ts +4 -1
- package/dist/es6/select/lib/hooks/useSelectInput.d.ts.map +1 -1
- package/dist/es6/select/lib/hooks/useSelectInput.js +14 -5
- package/dist/es6/switch/lib/Switch.js +13 -13
- package/dist/es6/table/lib/Table.js +2 -2
- package/dist/es6/table/lib/TableBody.js +2 -2
- package/dist/es6/table/lib/TableCaption.js +2 -2
- package/dist/es6/table/lib/TableCell.js +2 -2
- package/dist/es6/table/lib/TableFooter.js +2 -2
- package/dist/es6/table/lib/TableHead.js +2 -2
- package/dist/es6/table/lib/TableHeader.js +2 -2
- package/dist/es6/table/lib/TableRow.js +2 -2
- package/dist/es6/tabs/lib/TabsItem.d.ts.map +1 -1
- package/dist/es6/tabs/lib/TabsItem.js +5 -13
- package/dist/es6/tabs/lib/useTabsModel.d.ts.map +1 -1
- package/dist/es6/text/lib/LabelText.d.ts.map +1 -1
- package/dist/es6/text/lib/LabelText.js +12 -28
- package/dist/es6/text/lib/Text.d.ts +103 -0
- package/dist/es6/text/lib/Text.d.ts.map +1 -1
- package/dist/es6/text/lib/Text.js +31 -28
- package/dist/es6/tooltip/lib/OverflowTooltip.d.ts.map +1 -1
- package/dist/es6/tooltip/lib/OverflowTooltip.js +2 -3
- package/icon/index.ts +1 -1
- package/icon/lib/AccentIcon.tsx +48 -10
- package/icon/lib/AppletIcon.tsx +53 -12
- package/icon/lib/Graphic.tsx +43 -10
- package/icon/lib/Svg.tsx +36 -19
- package/icon/lib/SystemIcon.tsx +134 -39
- package/icon/lib/SystemIconCircle.tsx +42 -47
- package/package.json +5 -5
- package/select/lib/hooks/useSelectInput.ts +24 -8
- package/tabs/lib/TabsItem.tsx +6 -13
- package/tabs/lib/useTabsModel.tsx +0 -1
- package/text/lib/LabelText.tsx +11 -63
- package/text/lib/Text.tsx +65 -62
- package/tooltip/lib/OverflowTooltip.tsx +2 -3
- package/dist/commonjs/icon/lib/Icon.d.ts +0 -9
- package/dist/commonjs/icon/lib/Icon.d.ts.map +0 -1
- package/dist/commonjs/icon/lib/Icon.js +0 -40
- package/dist/es6/icon/lib/Icon.d.ts +0 -9
- package/dist/es6/icon/lib/Icon.d.ts.map +0 -1
- package/dist/es6/icon/lib/Icon.js +0 -18
- package/icon/lib/Icon.tsx +0 -38
|
@@ -1,46 +1,73 @@
|
|
|
1
1
|
import { CanvasSystemIcon } from '@workday/design-assets-types';
|
|
2
2
|
import { CSSObject } from '@emotion/styled';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { SvgProps } from './Svg';
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Interface `SystemIconStyles` will be removed in a future version. `accent`, `color`, background props will be moved inside `GraphicProps`.
|
|
6
|
+
*/
|
|
5
7
|
export interface SystemIconStyles {
|
|
6
8
|
/**
|
|
7
9
|
* The accent color of the SystemIcon. This overrides `color`.
|
|
8
10
|
*/
|
|
9
|
-
accent?:
|
|
11
|
+
accent?: string;
|
|
10
12
|
/**
|
|
11
13
|
* The accent color of the SystemIcon on hover. This overrides `colorHover`.
|
|
14
|
+
* @deprecated `accentHover` is deprecated and will be removed in a future version. Please use the following instead in your style overrides:
|
|
15
|
+
* ```tsx
|
|
16
|
+
* '&:hover': {
|
|
17
|
+
* [systemIconStencil.vars.accent]: desiredAccentHoverColor
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
12
20
|
*/
|
|
13
|
-
accentHover?:
|
|
21
|
+
accentHover?: string;
|
|
14
22
|
/**
|
|
15
23
|
* The background color of the SystemIcon.
|
|
16
24
|
* @default transparent
|
|
17
25
|
*/
|
|
18
|
-
background?:
|
|
26
|
+
background?: string;
|
|
19
27
|
/**
|
|
20
28
|
* The background color of the SystemIcon on hover.
|
|
21
29
|
* @default transparent
|
|
30
|
+
* @deprecated `backgroundHover` is deprecated and will be removed in a future version. Please use the following instead in your style overrides:
|
|
31
|
+
* ```tsx
|
|
32
|
+
* '&:hover': {
|
|
33
|
+
* [systemIconStencil.vars.background]: desiredBackgroundHoverColor
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
22
36
|
*/
|
|
23
|
-
backgroundHover?:
|
|
37
|
+
backgroundHover?: string;
|
|
24
38
|
/**
|
|
25
|
-
* The color of the SystemIcon. This defines `accent` and `fill`. `color` may be
|
|
26
|
-
* @default
|
|
39
|
+
* The color of the SystemIcon. This defines `accent` and `fill`. `color` may be overwritten by `accent` and `fill`.
|
|
40
|
+
* @default base.licorice200
|
|
27
41
|
*/
|
|
28
|
-
color?:
|
|
42
|
+
color?: string;
|
|
29
43
|
/**
|
|
30
|
-
* The hover color of the SystemIcon. This defines `accentHover` and `fillHover`. `colorHover` may be
|
|
31
|
-
* @default
|
|
44
|
+
* The hover color of the SystemIcon. This defines `accentHover` and `fillHover`. `colorHover` may be overwritten by `accentHover` and `fillHover`.
|
|
45
|
+
* @default base.licorice200
|
|
46
|
+
* @deprecated `colorHover` is deprecated and will be removed in a future version. Please use the following instead in your style overrides:
|
|
47
|
+
* ```tsx
|
|
48
|
+
* '&:hover': {
|
|
49
|
+
* [systemIconStencil.vars.color]: desiredColorHoverColor
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
32
52
|
*/
|
|
33
|
-
colorHover?:
|
|
53
|
+
colorHover?: string;
|
|
34
54
|
/**
|
|
35
55
|
* The fill color of the SystemIcon. This overrides `color`.
|
|
56
|
+
* @deprecated `fill` is deprecated and will be removed in a future version. Please use `color` and specify `accent` color if you want `accent` to be different from `color`.
|
|
36
57
|
*/
|
|
37
|
-
fill?:
|
|
58
|
+
fill?: string;
|
|
38
59
|
/**
|
|
39
60
|
* The fill color of the SystemIcon on hover. This overrides `colorHover`.
|
|
61
|
+
* @deprecated `fillHover` is deprecated and will be removed in a future version. Please use the following instead in your style overrides:
|
|
62
|
+
* ```tsx
|
|
63
|
+
* '&:hover': {
|
|
64
|
+
* [systemIconStencil.vars.fill]: desiredFillHoverColor
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
40
67
|
*/
|
|
41
|
-
fillHover?:
|
|
68
|
+
fillHover?: string;
|
|
42
69
|
}
|
|
43
|
-
export interface SystemIconProps extends SystemIconStyles, Omit<
|
|
70
|
+
export interface SystemIconProps extends SystemIconStyles, Omit<SvgProps, 'src' | 'type' | 'fill' | 'background' | 'color'> {
|
|
44
71
|
/**
|
|
45
72
|
* The icon to display from `@workday/canvas-system-icons-web`.
|
|
46
73
|
*/
|
|
@@ -48,8 +75,44 @@ export interface SystemIconProps extends SystemIconStyles, Omit<IconProps, 'src'
|
|
|
48
75
|
/**
|
|
49
76
|
* The size of the SystemIcon in `px`.
|
|
50
77
|
*/
|
|
51
|
-
size?: number | string
|
|
78
|
+
size?: number | string;
|
|
52
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* @deprecated This style utility function is deprecated and will be removed in a future version. We'll track usage over time to prevent unnecessary burden on upgrading. Most of the time, this function is used in conjunction with styling `SystemIcon`. There are a few ways to override the colors used in `SystemIcon`.
|
|
82
|
+
* - Pass props directly to the `SystemIcon` component: `<SystemIcon color={color} {...etc} />
|
|
83
|
+
* - Style overrides using the `systemIconStencil`:
|
|
84
|
+
* ```tsx
|
|
85
|
+
* // styling container
|
|
86
|
+
*
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
53
89
|
export declare const systemIconStyles: ({ accent, accentHover, background, backgroundHover, color, colorHover, fill, fillHover, }: SystemIconStyles) => CSSObject;
|
|
90
|
+
export declare const systemIconStencil: import("@workday/canvas-kit-styling").Stencil<import("@workday/canvas-kit-styling").StencilModifierConfig<{
|
|
91
|
+
/**
|
|
92
|
+
* This will set the icon's color (both `.wd-icon-fill` and `.wd-icon-accent` SVG layers). Most
|
|
93
|
+
* of the time, this is the only color you need to change. Icons also have an accent layer. If you
|
|
94
|
+
* wish to change the accent layer independently, also set the `accentColor` variable
|
|
95
|
+
*/
|
|
96
|
+
color: string;
|
|
97
|
+
accentColor: string;
|
|
98
|
+
backgroundColor: string;
|
|
99
|
+
}, never>, {
|
|
100
|
+
/**
|
|
101
|
+
* This will set the icon's color (both `.wd-icon-fill` and `.wd-icon-accent` SVG layers). Most
|
|
102
|
+
* of the time, this is the only color you need to change. Icons also have an accent layer. If you
|
|
103
|
+
* wish to change the accent layer independently, also set the `accentColor` variable
|
|
104
|
+
*/
|
|
105
|
+
color: string;
|
|
106
|
+
accentColor: string;
|
|
107
|
+
backgroundColor: string;
|
|
108
|
+
}, import("@workday/canvas-kit-styling").Stencil<{
|
|
109
|
+
shouldMirror: {
|
|
110
|
+
true: {
|
|
111
|
+
transform: "scaleX(-1)";
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
}, {
|
|
115
|
+
size: string;
|
|
116
|
+
}, never, never>, never>;
|
|
54
117
|
export declare const SystemIcon: import("@workday/canvas-kit-react/common").ElementComponent<"span", SystemIconProps>;
|
|
55
118
|
//# sourceMappingURL=SystemIcon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SystemIcon.d.ts","sourceRoot":"","sources":["../../../../icon/lib/SystemIcon.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,gBAAgB,EAAkB,MAAM,8BAA8B,CAAC;AAC/E,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"SystemIcon.d.ts","sourceRoot":"","sources":["../../../../icon/lib/SystemIcon.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,gBAAgB,EAAkB,MAAM,8BAA8B,CAAC;AAC/E,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAI1C,OAAO,EAAM,QAAQ,EAAwC,MAAM,OAAO,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;;;OASG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eACf,SAAQ,gBAAgB,EACtB,IAAI,CAAC,QAAQ,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,YAAY,GAAG,OAAO,CAAC;IAClE;;OAEG;IACH,IAAI,EAAE,gBAAgB,CAAC;IACvB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,8FAS1B,gBAAgB,KAAG,SAmBpB,CAAC;AAiBH,eAAO,MAAM,iBAAiB;IAG1B;;;;OAIG;;;;;IAJH;;;;OAIG;;;;;;;;;;;;wBAmCL,CAAC;AAEH,eAAO,MAAM,UAAU,sFA0CrB,CAAC"}
|
|
@@ -19,12 +19,23 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.SystemIcon = exports.systemIconStyles = void 0;
|
|
22
|
+
exports.SystemIcon = exports.systemIconStencil = exports.systemIconStyles = void 0;
|
|
23
23
|
const React = __importStar(require("react"));
|
|
24
24
|
const tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
25
25
|
const design_assets_types_1 = require("@workday/design-assets-types");
|
|
26
|
-
const Icon_1 = require("./Icon");
|
|
27
26
|
const common_1 = require("@workday/canvas-kit-react/common");
|
|
27
|
+
const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
|
|
28
|
+
const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
|
|
29
|
+
const Svg_1 = require("./Svg");
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated This style utility function is deprecated and will be removed in a future version. We'll track usage over time to prevent unnecessary burden on upgrading. Most of the time, this function is used in conjunction with styling `SystemIcon`. There are a few ways to override the colors used in `SystemIcon`.
|
|
32
|
+
* - Pass props directly to the `SystemIcon` component: `<SystemIcon color={color} {...etc} />
|
|
33
|
+
* - Style overrides using the `systemIconStencil`:
|
|
34
|
+
* ```tsx
|
|
35
|
+
* // styling container
|
|
36
|
+
*
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
28
39
|
const systemIconStyles = ({ accent, accentHover, background = 'transparent', backgroundHover = 'transparent', color = tokens_1.iconColors.standard, colorHover = tokens_1.iconColors.hover, fill, fillHover, }) => ({
|
|
29
40
|
'& .wd-icon-fill': {
|
|
30
41
|
fill: common_1.getColor(fill) || common_1.getColor(color),
|
|
@@ -46,19 +57,45 @@ const systemIconStyles = ({ accent, accentHover, background = 'transparent', bac
|
|
|
46
57
|
},
|
|
47
58
|
});
|
|
48
59
|
exports.systemIconStyles = systemIconStyles;
|
|
60
|
+
/**
|
|
61
|
+
* @deprecated These variables are being used for backward compatibility with existing hover props. Please use the following instead:
|
|
62
|
+
* ```tsx
|
|
63
|
+
* '&:hover': {
|
|
64
|
+
* [systemIconStencil.vars.color]: desiredHoverColor
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
const deprecatedSystemIconVars = canvas_kit_styling_1.createVars({ id: "cnvs-deprecated-system-icon", args: ["colorHover", "fillHover", "accentHover", "backgroundHover"] });
|
|
69
|
+
exports.systemIconStencil = canvas_kit_styling_1.createStencil({
|
|
70
|
+
extends: Svg_1.svgStencil,
|
|
71
|
+
vars: {
|
|
72
|
+
/**
|
|
73
|
+
* This will set the icon's color (both `.wd-icon-fill` and `.wd-icon-accent` SVG layers). Most
|
|
74
|
+
* of the time, this is the only color you need to change. Icons also have an accent layer. If you
|
|
75
|
+
* wish to change the accent layer independently, also set the `accentColor` variable
|
|
76
|
+
*/
|
|
77
|
+
color: '',
|
|
78
|
+
accentColor: '',
|
|
79
|
+
backgroundColor: 'transparent',
|
|
80
|
+
},
|
|
81
|
+
base: { name: "67a1c3", styles: "--cnvs-system-icon-backgroundColor:transparent;& .wd-icon-fill{fill:var(--cnvs-system-icon-color, var(--cnvs-base-palette-licorice-200));}& .wd-icon-accent, & .wd-icon-accent2{fill:var(--cnvs-system-icon-accentColor, var(--cnvs-system-icon-color, var(--cnvs-base-palette-licorice-200)));}& .wd-icon-background{fill:var(--cnvs-system-icon-backgroundColor);}&:where(:hover, .hover) .wd-icon-fill{fill:var(--cnvs-deprecated-system-icon-fillHover, var(--cnvs-deprecated-system-icon-colorHover, var(--cnvs-system-icon-color, var(--cnvs-base-palette-licorice-200))));}&:where(:hover, .hover) .wd-icon-accent, & .wd-icon-accent2{fill:var(--cnvs-deprecated-system-icon-accentHover, var(--cnvs-deprecated-system-icon-colorHover, var(--cnvs-system-icon-accentColor, var(--cnvs-system-icon-color, var(--cnvs-base-palette-licorice-200)))));}&:where(:hover, .hover) .wd-icon-background{fill:var(--cnvs-deprecated-system-icon-backgroundHover, var(--cnvs-system-icon-backgroundColor));}" }
|
|
82
|
+
}, "cnvs-system-icon");
|
|
49
83
|
exports.SystemIcon = common_1.createComponent('span')({
|
|
50
84
|
displayName: 'SystemIcon',
|
|
51
|
-
Component: ({ background
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
85
|
+
Component: ({ size, background, backgroundHover, color, colorHover, icon, accent, accentHover, fill, fillHover, ...elemProps }, ref, Element) => {
|
|
86
|
+
return (React.createElement(Svg_1.Svg, Object.assign({ as: Element, src: icon, type: design_assets_types_1.CanvasIconTypes.System, ref: ref }, canvas_kit_styling_1.handleCsProp(elemProps, [
|
|
87
|
+
exports.systemIconStencil({
|
|
88
|
+
size: typeof size === 'number' ? canvas_kit_styling_1.px2rem(size) : size,
|
|
89
|
+
color: Svg_1.transformColorNameToToken(fill || color),
|
|
90
|
+
accentColor: Svg_1.transformColorNameToToken(accent || color),
|
|
91
|
+
backgroundColor: Svg_1.transformColorNameToToken(background),
|
|
92
|
+
}),
|
|
93
|
+
{
|
|
94
|
+
[deprecatedSystemIconVars.colorHover]: colorHover && canvas_kit_styling_1.cssVar(colorHover),
|
|
95
|
+
[deprecatedSystemIconVars.fillHover]: fillHover && canvas_kit_styling_1.cssVar(fillHover),
|
|
96
|
+
[deprecatedSystemIconVars.accentHover]: accentHover && canvas_kit_styling_1.cssVar(accentHover),
|
|
97
|
+
[deprecatedSystemIconVars.backgroundHover]: backgroundHover && canvas_kit_styling_1.cssVar(backgroundHover),
|
|
98
|
+
},
|
|
99
|
+
]))));
|
|
63
100
|
},
|
|
64
101
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SystemIconProps } from './SystemIcon';
|
|
2
2
|
import { CanvasSystemIcon } from '@workday/design-assets-types';
|
|
3
|
-
import { SystemPropValues } from '@workday/canvas-kit-react/layout';
|
|
4
3
|
export declare enum SystemIconCircleSize {
|
|
5
4
|
xs = 16,
|
|
6
5
|
s = 24,
|
|
@@ -12,9 +11,9 @@ export declare enum SystemIconCircleSize {
|
|
|
12
11
|
export interface SystemIconCircleProps extends Pick<SystemIconProps, 'shouldMirror'> {
|
|
13
12
|
/**
|
|
14
13
|
* The background color of the SystemIconCircle from `@workday/canvas-colors-web`.
|
|
15
|
-
* @default
|
|
14
|
+
* @default base.soap300
|
|
16
15
|
*/
|
|
17
|
-
background?:
|
|
16
|
+
background?: string;
|
|
18
17
|
/**
|
|
19
18
|
* The icon to display from `@workday/canvas-accent-icons-web`.
|
|
20
19
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SystemIconCircle.d.ts","sourceRoot":"","sources":["../../../../icon/lib/SystemIconCircle.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SystemIconCircle.d.ts","sourceRoot":"","sources":["../../../../icon/lib/SystemIconCircle.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAa,eAAe,EAAoB,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAM9D,oBAAY,oBAAoB;IAC9B,EAAE,KAAK;IACP,CAAC,KAAK;IACN,CAAC,KAAK;IACN,CAAC,KAAK;IACN,EAAE,KAAK;IACP,GAAG,MAAM;CACV;AAED,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,eAAe,EAAE,cAAc,CAAC;IAClF;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,IAAI,EAAE,gBAAgB,CAAC;IACvB;;;OAGG;IACH,IAAI,CAAC,EAAE,oBAAoB,GAAG,MAAM,CAAC;CACtC;AA6BD,eAAO,MAAM,gBAAgB,4FAwB3B,CAAC"}
|
|
@@ -18,17 +18,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
22
|
exports.SystemIconCircle = exports.SystemIconCircleSize = void 0;
|
|
26
23
|
const React = __importStar(require("react"));
|
|
27
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
28
|
-
const is_prop_valid_1 = __importDefault(require("@emotion/is-prop-valid"));
|
|
29
24
|
const tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
30
25
|
const SystemIcon_1 = require("./SystemIcon");
|
|
31
26
|
const common_1 = require("@workday/canvas-kit-react/common");
|
|
27
|
+
const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
|
|
28
|
+
const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
|
|
29
|
+
const Svg_1 = require("./Svg");
|
|
32
30
|
var SystemIconCircleSize;
|
|
33
31
|
(function (SystemIconCircleSize) {
|
|
34
32
|
SystemIconCircleSize[SystemIconCircleSize["xs"] = 16] = "xs";
|
|
@@ -38,33 +36,25 @@ var SystemIconCircleSize;
|
|
|
38
36
|
SystemIconCircleSize[SystemIconCircleSize["xl"] = 64] = "xl";
|
|
39
37
|
SystemIconCircleSize[SystemIconCircleSize["xxl"] = 120] = "xxl";
|
|
40
38
|
})(SystemIconCircleSize = exports.SystemIconCircleSize || (exports.SystemIconCircleSize = {}));
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
justifyContent: 'center',
|
|
47
|
-
padding: 0,
|
|
48
|
-
border: 0,
|
|
49
|
-
borderRadius: tokens_1.borderRadius.circle,
|
|
50
|
-
boxSizing: 'border-box',
|
|
51
|
-
overflow: 'hidden',
|
|
52
|
-
'& img': {
|
|
53
|
-
width: '100%',
|
|
54
|
-
height: '100%',
|
|
39
|
+
const systemIconCircleStencil = canvas_kit_styling_1.createStencil({
|
|
40
|
+
vars: {
|
|
41
|
+
containerSize: '',
|
|
42
|
+
backgroundColor: '',
|
|
43
|
+
iconColor: '',
|
|
55
44
|
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}), ({ size }) => ({
|
|
59
|
-
width: size,
|
|
60
|
-
height: size,
|
|
61
|
-
}));
|
|
45
|
+
base: { name: "8a694b", styles: "background:var(--cnvs-system-icon-circle-backgroundColor, var(--cnvs-base-palette-soap-200));display:flex;align-items:center;justify-content:center;padding:var(--cnvs-sys-space-zero);border:none;border-radius:var(--cnvs-sys-shape-round);box-sizing:border-box;overflow:hidden;width:var(--cnvs-system-icon-circle-containerSize, var(--cnvs-sys-space-x10));height:var(--cnvs-system-icon-circle-containerSize, var(--cnvs-sys-space-x10));--cnvs-svg-size:calc(var(--cnvs-system-icon-circle-containerSize, var(--cnvs-sys-space-x10)) * 0.625);--cnvs-system-icon-color:var(--cnvs-system-icon-circle-iconColor);& img{width:100%;height:100%;}" }
|
|
46
|
+
}, "cnvs-system-icon-circle");
|
|
62
47
|
exports.SystemIconCircle = common_1.createComponent('span')({
|
|
63
48
|
displayName: 'SystemIconCircle',
|
|
64
|
-
Component: ({ background
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
49
|
+
Component: ({ background, size, icon, shouldMirror }, ref, Element) => {
|
|
50
|
+
// `pickForegroundColor` hasn't support to use css variables to generate foregroundColor
|
|
51
|
+
const backgroundFallback = background && !background.startsWith('--') ? background : tokens_1.colors.soap200;
|
|
52
|
+
const iconColor = common_1.pickForegroundColor(backgroundFallback, 'rgba(0,0,0,0.65)', tokens_1.colors.frenchVanilla100);
|
|
53
|
+
return (React.createElement("div", Object.assign({}, systemIconCircleStencil({
|
|
54
|
+
containerSize: typeof size === 'number' ? canvas_kit_styling_1.px2rem(size) : size,
|
|
55
|
+
backgroundColor: Svg_1.transformColorNameToToken(background),
|
|
56
|
+
iconColor,
|
|
57
|
+
})),
|
|
58
|
+
React.createElement(SystemIcon_1.SystemIcon, { as: Element, ref: ref, icon: icon, shouldMirror: shouldMirror })));
|
|
69
59
|
},
|
|
70
60
|
});
|
|
@@ -31,8 +31,8 @@ const ANIMATION_DURATION_MS = '1400';
|
|
|
31
31
|
/**
|
|
32
32
|
* Keyframe for the dots loading animation.
|
|
33
33
|
*/
|
|
34
|
-
const keyframesLoading = canvas_kit_styling_1.keyframes({ name: "
|
|
35
|
-
const loadingDotStyles = canvas_kit_styling_1.createStyles({ name: "
|
|
34
|
+
const keyframesLoading = canvas_kit_styling_1.keyframes({ name: "454a47", styles: "0%, 80%, 100%{transform:scale(0);}40%{transform:scale(1);}" });
|
|
35
|
+
const loadingDotStyles = canvas_kit_styling_1.createStyles({ name: "d1522e", styles: "background-color:var(--cnvs-base-palette-soap-400);width:var(--cnvs-sys-space-x4);height:var(--cnvs-sys-space-x4);font-size:var(--cnvs-sys-space-zero);border-radius:var(--cnvs-sys-shape-round);transform:scale(0);display:inline-block;animation-name:animation-454a47;animation-duration:1400ms;animation-iteration-count:infinite;animation-timing-function:ease-in-out;animation-fill-mode:both;&:nth-child(1){animation-delay:0ms;}&:nth-child(2){animation-delay:calc(1400ms * (4/35));}&:nth-child(3){animation-delay:calc(1400ms * (8/35));}" });
|
|
36
36
|
/**
|
|
37
37
|
* The actual loading dot div.
|
|
38
38
|
*/
|
|
@@ -40,7 +40,7 @@ const LoadingAnimationDot = () => React.createElement("div", { className: `${loa
|
|
|
40
40
|
/**
|
|
41
41
|
* A simple container for the loading dots.
|
|
42
42
|
*/
|
|
43
|
-
const containerStyles = canvas_kit_styling_1.createStyles({ name: "
|
|
43
|
+
const containerStyles = canvas_kit_styling_1.createStyles({ name: "0e8878", styles: "display:inline-flex;gap:var(--cnvs-sys-space-x2);" });
|
|
44
44
|
/**
|
|
45
45
|
* A simple component that displays three horizontal dots, to be used when some data is loading.
|
|
46
46
|
*/
|
|
@@ -34,8 +34,8 @@ exports.menuCardStencil = canvas_kit_styling_1.createStencil({
|
|
|
34
34
|
transformOriginVertical: 'top',
|
|
35
35
|
transformOriginHorizontal: 'left',
|
|
36
36
|
},
|
|
37
|
-
base: { name: "
|
|
38
|
-
}, "menu-card");
|
|
37
|
+
base: { name: "a0bf52", styles: "--cnvs-menu-card-minWidth:0.0625rem;--cnvs-menu-card-transformOriginVertical:top;--cnvs-menu-card-transformOriginHorizontal:left;font-family:var(--cnvs-base-font-family-50);font-weight:var(--cnvs-base-font-weight-400);line-height:var(--cnvs-base-line-height-100);font-size:var(--cnvs-base-font-size-75);letter-spacing:var(--cnvs-base-letter-spacing-150);color:var(--cnvs-base-palette-black-pepper-300);position:relative;display:flex;flex-direction:column;transition:transform ease-out 150ms;padding:var(--cnvs-sys-space-zero);max-width:calc(100vw - var(--cnvs-sys-space-x8));box-shadow:var(--cnvs-sys-depth-3);min-width:var(--cnvs-menu-card-minWidth);box-sizing:border-box;transform-origin:var(--cnvs-menu-card-transformOriginVertical) var(--cnvs-menu-card-transformOriginHorizontal);.wd-no-animation &{animation:none;}" }
|
|
38
|
+
}, "cnvs-menu-card");
|
|
39
39
|
exports.useMenuCard = common_1.createElemPropsHook(useMenuModel_1.useMenuModel)(() => {
|
|
40
40
|
return {};
|
|
41
41
|
});
|
|
@@ -35,14 +35,14 @@ exports.useMenuList = common_1.composeHooks(common_1.createElemPropsHook(useMenu
|
|
|
35
35
|
};
|
|
36
36
|
}), popup_1.useReturnFocus, popup_1.useFocusRedirect);
|
|
37
37
|
exports.menuListStencil = canvas_kit_styling_1.createStencil({
|
|
38
|
-
base: { name: "
|
|
38
|
+
base: { name: "4a3778", styles: "background:var(--cnvs-base-palette-french-vanilla-100);border-radius:var(--cnvs-sys-shape-zero);padding:var(--cnvs-sys-space-zero);gap:var(--cnvs-sys-space-zero);" },
|
|
39
39
|
modifiers: {
|
|
40
|
-
|
|
41
|
-
vertical: { name: "
|
|
42
|
-
horizontal: { name: "
|
|
40
|
+
orientation: {
|
|
41
|
+
vertical: { name: "db5d98", styles: "flex-direction:column;" },
|
|
42
|
+
horizontal: { name: "3f3c28", styles: "flex-direction:row;" }
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
}, "menu-list");
|
|
45
|
+
}, "cnvs-menu-list");
|
|
46
46
|
exports.MenuList = common_1.createSubcomponent('div')({
|
|
47
47
|
displayName: 'Menu.List',
|
|
48
48
|
modelHook: useMenuModel_1.useMenuModel,
|
|
@@ -17,14 +17,14 @@ const useSelectModel_1 = require("./hooks/useSelectModel");
|
|
|
17
17
|
const common_1 = require("@workday/canvas-kit-react/common");
|
|
18
18
|
const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
|
|
19
19
|
const selectInputStencil = canvas_kit_styling_1.createStencil({
|
|
20
|
-
base: { name: "
|
|
21
|
-
}, "select-input");
|
|
20
|
+
base: { name: "a28279", styles: "caret-color:transparent;cursor:default;&::selection{background-color:transparent;}" }
|
|
21
|
+
}, "cnvs-select-input");
|
|
22
22
|
const selectIconsStencil = canvas_kit_styling_1.createStencil({
|
|
23
|
-
base: { name: "
|
|
24
|
-
}, "select-icons");
|
|
23
|
+
base: { name: "482a82", styles: "position:absolute;pointer-events:none;" }
|
|
24
|
+
}, "cnvs-select-icons");
|
|
25
25
|
const hiddenSelectInputStencil = canvas_kit_styling_1.createStencil({
|
|
26
|
-
base: { name: "
|
|
27
|
-
}, "hidden-select-input");
|
|
26
|
+
base: { name: "926b2b", styles: "position:absolute;top:var(--cnvs-sys-space-zero);bottom:var(--cnvs-sys-space-zero);left:var(--cnvs-sys-space-zero);right:var(--cnvs-sys-space-zero);opacity:0;cursor:default;pointer-events:none;" }
|
|
27
|
+
}, "cnvs-hidden-select-input");
|
|
28
28
|
exports.SelectInput = common_1.createSubcomponent(text_input_1.TextInput)({
|
|
29
29
|
modelHook: useSelectModel_1.useSelectModel,
|
|
30
30
|
elemPropsHook: useSelectInput_1.useSelectInput,
|
|
@@ -45,7 +45,7 @@ exports.SelectItem = common_1.createSubcomponent('li')({
|
|
|
45
45
|
})(({ children, ...elemProps }, Element, _model) => {
|
|
46
46
|
return (react_1.default.createElement(combobox_1.Combobox.Menu.Item, Object.assign({ role: "option", as: Element }, elemProps), children));
|
|
47
47
|
});
|
|
48
|
-
const selectCardStyles = canvas_kit_styling_1.createStyles({ name: "
|
|
48
|
+
const selectCardStyles = canvas_kit_styling_1.createStyles({ name: "a8270c", styles: "max-height:18.75rem;" });
|
|
49
49
|
exports.SelectCard = common_1.createSubcomponent('div')({
|
|
50
50
|
modelHook: useSelectModel_1.useSelectModel,
|
|
51
51
|
elemPropsHook: useSelectCard_1.useSelectCard,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
declare function noop(): void;
|
|
2
3
|
/**
|
|
3
4
|
* `useSelectInput` extends {@link useComboboxInput useComboboxInput} and {@link useComboboxKeyboardTypeAhead useComboboxKeyboardTypeAhead} and adds type ahead functionality and Select-specific [keyboard support](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/).
|
|
4
5
|
*/
|
|
@@ -85,9 +86,10 @@ export declare const useSelectInput: import("@workday/canvas-kit-react/common").
|
|
|
85
86
|
readonly onFocus: () => void;
|
|
86
87
|
readonly textInputProps: {
|
|
87
88
|
readonly ref: React.RefObject<HTMLInputElement>;
|
|
89
|
+
readonly onChange: typeof noop;
|
|
90
|
+
readonly value: string;
|
|
88
91
|
};
|
|
89
92
|
readonly ref: (instance: HTMLInputElement | null) => void;
|
|
90
|
-
readonly defaultValue: string | undefined;
|
|
91
93
|
} & {
|
|
92
94
|
onKeyDown(event: React.KeyboardEvent<Element>): void;
|
|
93
95
|
keySofar: string;
|
|
@@ -115,4 +117,5 @@ export declare const useSelectInput: import("@workday/canvas-kit-react/common").
|
|
|
115
117
|
ref: (instance: unknown) => void;
|
|
116
118
|
onClick: (event: React.MouseEvent<Element, MouseEvent>) => void;
|
|
117
119
|
}>;
|
|
120
|
+
export {};
|
|
118
121
|
//# sourceMappingURL=useSelectInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSelectInput.d.ts","sourceRoot":"","sources":["../../../../../select/lib/hooks/useSelectInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAgB1B;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useSelectInput.d.ts","sourceRoot":"","sources":["../../../../../select/lib/hooks/useSelectInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAgB1B,iBAAS,IAAI,SAEZ;AAED;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCA4FF,mBAAmB;+BArFP,MAAM,WAAW,CAAC,gBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsIvE,CAAC"}
|
|
@@ -8,6 +8,9 @@ const react_1 = __importDefault(require("react"));
|
|
|
8
8
|
const common_1 = require("@workday/canvas-kit-react/common");
|
|
9
9
|
const combobox_1 = require("@workday/canvas-kit-react/combobox");
|
|
10
10
|
const useSelectModel_1 = require("./useSelectModel");
|
|
11
|
+
function noop() {
|
|
12
|
+
// Do nothing
|
|
13
|
+
}
|
|
11
14
|
/**
|
|
12
15
|
* `useSelectInput` extends {@link useComboboxInput useComboboxInput} and {@link useComboboxKeyboardTypeAhead useComboboxKeyboardTypeAhead} and adds type ahead functionality and Select-specific [keyboard support](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/).
|
|
13
16
|
*/
|
|
@@ -41,6 +44,13 @@ exports.useSelectInput = common_1.composeHooks(common_1.createElemPropsHook(useS
|
|
|
41
44
|
model.state.items.length > 0 &&
|
|
42
45
|
model.state.selectedIds[0]) {
|
|
43
46
|
const value = model.navigation.getItem(model.state.selectedIds[0], model).id;
|
|
47
|
+
// force the hidden input to have the correct value
|
|
48
|
+
if (model.state.inputRef.current.value !== value) {
|
|
49
|
+
const nativeInputValue = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(model.state.inputRef.current), 'value');
|
|
50
|
+
if (nativeInputValue && nativeInputValue.set) {
|
|
51
|
+
nativeInputValue.set.call(model.state.inputRef.current, value);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
44
54
|
if (model.state.selectedIds[0] !== value &&
|
|
45
55
|
model.state.inputRef.current.value !== value) {
|
|
46
56
|
// Programmatically dispatch an onChange once items are loaded. This account for when a consumer wants an initial selected item and they're loading them from a server.
|
|
@@ -108,12 +118,11 @@ exports.useSelectInput = common_1.composeHooks(common_1.createElemPropsHook(useS
|
|
|
108
118
|
},
|
|
109
119
|
textInputProps: {
|
|
110
120
|
ref: textInputRef,
|
|
121
|
+
onChange: noop,
|
|
122
|
+
value: model.state.selectedIds.length > 0 && model.state.items.length > 0
|
|
123
|
+
? model.navigation.getItem(model.state.selectedIds[0], model).textValue
|
|
124
|
+
: '',
|
|
111
125
|
},
|
|
112
126
|
ref: elementRef,
|
|
113
|
-
// Account for the case where an initial item is selected when the Select first renders
|
|
114
|
-
defaultValue: model.state.selectedIds.length > 0 && model.state.items.length > 0
|
|
115
|
-
? model.navigation.getItem(model.state.selectedIds[0], model).textValue ||
|
|
116
|
-
model.state.value
|
|
117
|
-
: undefined,
|
|
118
127
|
};
|
|
119
128
|
}), combobox_1.useComboboxKeyboardTypeAhead, combobox_1.useComboboxResetCursorToSelected, combobox_1.useComboboxMoveCursorToSelected, combobox_1.useComboboxInput);
|
|
@@ -26,8 +26,8 @@ const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
|
|
|
26
26
|
const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
|
|
27
27
|
const layout_1 = require("../../layout");
|
|
28
28
|
const switchContainerStencil = canvas_kit_styling_1.createStencil({
|
|
29
|
-
base: { name: "
|
|
30
|
-
}, "switch-container");
|
|
29
|
+
base: { name: "3c93da", styles: "position:relative;height:var(--cnvs-sys-space-x6);width:var(--cnvs-sys-space-x8);" }
|
|
30
|
+
}, "cnvs-switch-container");
|
|
31
31
|
const SwitchContainer = common_1.createComponent('div')({
|
|
32
32
|
displayName: 'SwitchContainer',
|
|
33
33
|
Component: ({ children, ...elemProps }, ref, Element) => {
|
|
@@ -35,14 +35,14 @@ const SwitchContainer = common_1.createComponent('div')({
|
|
|
35
35
|
},
|
|
36
36
|
});
|
|
37
37
|
const switchInputStencil = canvas_kit_styling_1.createStencil({
|
|
38
|
-
base: { name: "
|
|
38
|
+
base: { name: "509a50", styles: "display:flex;position:absolute;height:var(--cnvs-sys-space-x6);width:var(--cnvs-sys-space-x8);margin:var(--cnvs-sys-space-zero);margin-left:var(--cnvs-sys-space-x1);border-radius:var(--cnvs-sys-shape-round);opacity:0;cursor:pointer;&:checked, &.checked{& ~ div:first-of-type{background-color:var(--cnvs-brand-primary-base);}&:disabled, &.disabled{& ~ div:first-of-type{background-color:var(--cnvs-brand-primary-light);}}}&:disabled, &.disabled{cursor:not-allowed;& ~ div:first-of-type{background-color:var(--cnvs-base-palette-soap-400);}}&:focus-visible, &:focus, &.focus{outline:none;& ~ div:first-of-type{box-shadow:0 0 0 2px var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1)), 0 0 0 4px var(--cnvs-brand-common-focus-outline, rgba(8,117,225,1));}}" },
|
|
39
39
|
modifiers: {
|
|
40
|
-
|
|
41
|
-
error: { name: "
|
|
42
|
-
alert: { name: "
|
|
40
|
+
error: {
|
|
41
|
+
error: { name: "518003", styles: "& ~ div:first-of-type{box-shadow:\n 0 0 0 0.125rem var(--cnvs-base-palette-french-vanilla-100),\n 0 0 0 var(--cnvs-sys-space-x1) var(--cnvs-brand-error-base),\n 0 0 0 0.3125rem transparent;}" },
|
|
42
|
+
alert: { name: "6a2682", styles: "& ~ div:first-of-type{box-shadow:\n 0 0 0 0.125rem var(--cnvs-base-palette-french-vanilla-100),\n 0 0 0 var(--cnvs-sys-space-x1) var(--cnvs-brand-alert-base),\n 0 0 0 0.3125rem var(--cnvs-brand-alert-darkest);}" }
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
}, "switch-input");
|
|
45
|
+
}, "cnvs-switch-input");
|
|
46
46
|
const SwitchInput = common_1.createComponent('input')({
|
|
47
47
|
displayName: 'SwitchInput',
|
|
48
48
|
Component: ({ error, ...elemProps }, ref, Element) => {
|
|
@@ -50,8 +50,8 @@ const SwitchInput = common_1.createComponent('input')({
|
|
|
50
50
|
},
|
|
51
51
|
});
|
|
52
52
|
const switchBackgroundStencil = canvas_kit_styling_1.createStencil({
|
|
53
|
-
base: { name: "
|
|
54
|
-
}, "switch-background");
|
|
53
|
+
base: { name: "5d72ee", styles: "box-sizing:border-box;position:absolute;display:flex;align-items:center;pointer-events:none;margin-top:var(--cnvs-sys-space-x1);width:var(--cnvs-sys-space-x8);height:var(--cnvs-sys-space-x4);border-radius:var(--cnvs-sys-shape-round);padding:var(--cnvs-sys-space-zero) 0.125rem;transition:background-color 200ms ease;background-color:var(--cnvs-base-palette-licorice-200);" }
|
|
54
|
+
}, "cnvs-switch-background");
|
|
55
55
|
const SwitchBackground = common_1.createComponent('div')({
|
|
56
56
|
displayName: 'SwitchBackground',
|
|
57
57
|
Component: ({ children, ...elemProps }, ref, Element) => {
|
|
@@ -59,13 +59,13 @@ const SwitchBackground = common_1.createComponent('div')({
|
|
|
59
59
|
},
|
|
60
60
|
});
|
|
61
61
|
const switchCircleStencil = canvas_kit_styling_1.createStencil({
|
|
62
|
-
base: { name: "
|
|
62
|
+
base: { name: "09e7dc", styles: "width:var(--cnvs-sys-space-x3);height:var(--cnvs-sys-space-x3);border-radius:var(--cnvs-sys-shape-round);box-shadow:var(--cnvs-sys-depth-1);transition:transform 150ms ease;pointer-events:none;background-color:var(--cnvs-brand-primary-accent);transform:translateX(var(--cnvs-sys-space-zero));" },
|
|
63
63
|
modifiers: {
|
|
64
|
-
|
|
65
|
-
true: { name: "
|
|
64
|
+
checked: {
|
|
65
|
+
true: { name: "202c6e", styles: "transform:translateX(var(--cnvs-sys-space-x4));" }
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
}, "switch-circle");
|
|
68
|
+
}, "cnvs-switch-circle");
|
|
69
69
|
const SwitchCircle = common_1.createComponent('div')({
|
|
70
70
|
displayName: 'SwitchCircle',
|
|
71
71
|
Component: ({ checked, ...elemProps }, ref, Element) => {
|
|
@@ -17,8 +17,8 @@ const TableCaption_1 = require("./TableCaption");
|
|
|
17
17
|
const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
|
|
18
18
|
const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
|
|
19
19
|
const tableStencil = canvas_kit_styling_1.createStencil({
|
|
20
|
-
base: { name: "
|
|
21
|
-
}, "table");
|
|
20
|
+
base: { name: "c93ea3", styles: "font-family:var(--cnvs-base-font-family-50);font-weight:var(--cnvs-base-font-weight-400);line-height:var(--cnvs-base-line-height-100);font-size:var(--cnvs-base-font-size-75);letter-spacing:var(--cnvs-base-letter-spacing-150);display:grid;border:0.0625rem solid var(--cnvs-base-palette-soap-500);border-radius:var(--cnvs-sys-shape-x2);overflow:auto;color:var(--cnvs-base-palette-black-pepper-300);box-sizing:border-box;" }
|
|
21
|
+
}, "cnvs-table");
|
|
22
22
|
/**
|
|
23
23
|
* `Table` is a simple styled compound component that renders a [table](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table) element. It is used to present information in a two-dimensional table comprised of rows and columns of cells containing data.
|
|
24
24
|
*
|
|
@@ -9,8 +9,8 @@ const layout_1 = require("@workday/canvas-kit-react/layout");
|
|
|
9
9
|
const common_1 = require("@workday/canvas-kit-react/common");
|
|
10
10
|
const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
|
|
11
11
|
const tableBodyStencil = canvas_kit_styling_1.createStencil({
|
|
12
|
-
base: { name: "
|
|
13
|
-
}, "table-body");
|
|
12
|
+
base: { name: "afe05d", styles: "display:grid;box-sizing:border-box;tr {&:last-of-type{td, th{border-bottom:none;}}&:first-of-type{td, th{border-top:none;}}}td {&:last-of-type{border-inline-end:none;}&:first-of-type{border-inline-start:none;}}" }
|
|
13
|
+
}, "cnvs-table-body");
|
|
14
14
|
exports.TableBody = common_1.createComponent('tbody')({
|
|
15
15
|
displayName: 'Table.Body',
|
|
16
16
|
Component: ({ children, ...elemProps }, ref, Element) => {
|
|
@@ -10,8 +10,8 @@ const common_1 = require("@workday/canvas-kit-react/common");
|
|
|
10
10
|
const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
|
|
11
11
|
const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
|
|
12
12
|
const tableCaptionStencil = canvas_kit_styling_1.createStencil({
|
|
13
|
-
base: { name: "
|
|
14
|
-
}, "table-caption");
|
|
13
|
+
base: { name: "4d712b", styles: "display:flex;border-bottom:0.0625rem solid var(--cnvs-base-palette-soap-500);padding:var(--cnvs-sys-space-x2) var(--cnvs-sys-space-x4);box-sizing:border-box;" }
|
|
14
|
+
}, "cnvs-table-caption");
|
|
15
15
|
exports.TableCaption = common_1.createComponent('caption')({
|
|
16
16
|
displayName: 'Table.Caption',
|
|
17
17
|
Component: ({ children, ...elemProps }, ref, Element) => {
|
|
@@ -10,8 +10,8 @@ const common_1 = require("@workday/canvas-kit-react/common");
|
|
|
10
10
|
const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
|
|
11
11
|
const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
|
|
12
12
|
const tableCellStencil = canvas_kit_styling_1.createStencil({
|
|
13
|
-
base: { name: "
|
|
14
|
-
}, "table-cell");
|
|
13
|
+
base: { name: "ad28fe", styles: "display:grid;align-items:center;background-color:var(--cnvs-base-palette-french-vanilla-100);border-bottom:0.0625rem solid var(--cnvs-base-palette-soap-400);grid-template-columns:1fr;justify-content:start;min-height:3.5rem;padding:var(--cnvs-sys-space-x2) var(--cnvs-sys-space-x4);word-break:break-word;box-sizing:border-box;" }
|
|
14
|
+
}, "cnvs-table-cell");
|
|
15
15
|
exports.TableCell = common_1.createComponent('td')({
|
|
16
16
|
displayName: 'Table.Cell',
|
|
17
17
|
Component: ({ children, ...elemProps }, ref, Element) => {
|