@workday/canvas-kit-react 7.1.0-next.0 → 7.1.1
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/action-bar/lib/ActionBarItem.tsx +1 -6
- package/checkbox/lib/Checkbox.tsx +106 -54
- package/collection/lib/useOverflowListModel.tsx +11 -2
- package/common/lib/utils/index.ts +1 -0
- package/common/lib/utils/useModalityType.ts +65 -0
- package/dist/commonjs/action-bar/lib/ActionBar.d.ts +2 -4
- package/dist/commonjs/action-bar/lib/ActionBar.d.ts.map +1 -1
- package/dist/commonjs/action-bar/lib/ActionBarItem.d.ts +1 -4
- package/dist/commonjs/action-bar/lib/ActionBarItem.d.ts.map +1 -1
- package/dist/commonjs/action-bar/lib/ActionBarItem.js +0 -5
- package/dist/commonjs/action-bar/lib/useActionBarModel.d.ts +2 -0
- package/dist/commonjs/action-bar/lib/useActionBarModel.d.ts.map +1 -1
- package/dist/commonjs/checkbox/lib/Checkbox.d.ts +4 -0
- package/dist/commonjs/checkbox/lib/Checkbox.d.ts.map +1 -1
- package/dist/commonjs/checkbox/lib/Checkbox.js +65 -34
- package/dist/commonjs/collection/lib/useOverflowListModel.d.ts +10 -0
- package/dist/commonjs/collection/lib/useOverflowListModel.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useOverflowListModel.js +10 -4
- package/dist/commonjs/common/lib/utils/index.d.ts +1 -0
- package/dist/commonjs/common/lib/utils/index.d.ts.map +1 -1
- package/dist/commonjs/common/lib/utils/index.js +1 -0
- package/dist/commonjs/common/lib/utils/useModalityType.d.ts +17 -0
- package/dist/commonjs/common/lib/utils/useModalityType.d.ts.map +1 -0
- package/dist/commonjs/common/lib/utils/useModalityType.js +63 -0
- package/dist/commonjs/pagination/lib/Pagination/PageButton.d.ts.map +1 -1
- package/dist/commonjs/pagination/lib/Pagination/PageButton.js +8 -6
- package/dist/commonjs/radio/lib/Radio.d.ts +1 -0
- package/dist/commonjs/radio/lib/Radio.d.ts.map +1 -1
- package/dist/commonjs/radio/lib/Radio.js +74 -26
- package/dist/commonjs/tabs/lib/Tabs.d.ts +1 -0
- package/dist/commonjs/tabs/lib/Tabs.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/TabsItem.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/TabsItem.js +4 -3
- package/dist/commonjs/tabs/lib/TabsList.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/TabsList.js +17 -2
- package/dist/commonjs/tabs/lib/useTabsModel.d.ts +55 -159
- package/dist/commonjs/tabs/lib/useTabsModel.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/useTabsModel.js +2 -0
- package/dist/es6/action-bar/lib/ActionBar.d.ts +2 -4
- package/dist/es6/action-bar/lib/ActionBar.d.ts.map +1 -1
- package/dist/es6/action-bar/lib/ActionBarItem.d.ts +1 -4
- package/dist/es6/action-bar/lib/ActionBarItem.d.ts.map +1 -1
- package/dist/es6/action-bar/lib/ActionBarItem.js +1 -6
- package/dist/es6/action-bar/lib/useActionBarModel.d.ts +2 -0
- package/dist/es6/action-bar/lib/useActionBarModel.d.ts.map +1 -1
- package/dist/es6/checkbox/lib/Checkbox.d.ts +4 -0
- package/dist/es6/checkbox/lib/Checkbox.d.ts.map +1 -1
- package/dist/es6/checkbox/lib/Checkbox.js +65 -34
- package/dist/es6/collection/lib/useOverflowListModel.d.ts +10 -0
- package/dist/es6/collection/lib/useOverflowListModel.d.ts.map +1 -1
- package/dist/es6/collection/lib/useOverflowListModel.js +10 -4
- package/dist/es6/common/lib/utils/index.d.ts +1 -0
- package/dist/es6/common/lib/utils/index.d.ts.map +1 -1
- package/dist/es6/common/lib/utils/index.js +1 -0
- package/dist/es6/common/lib/utils/useModalityType.d.ts +17 -0
- package/dist/es6/common/lib/utils/useModalityType.d.ts.map +1 -0
- package/dist/es6/common/lib/utils/useModalityType.js +56 -0
- package/dist/es6/pagination/lib/Pagination/PageButton.d.ts.map +1 -1
- package/dist/es6/pagination/lib/Pagination/PageButton.js +9 -7
- package/dist/es6/radio/lib/Radio.d.ts +1 -0
- package/dist/es6/radio/lib/Radio.d.ts.map +1 -1
- package/dist/es6/radio/lib/Radio.js +74 -26
- package/dist/es6/tabs/lib/Tabs.d.ts +1 -0
- package/dist/es6/tabs/lib/Tabs.d.ts.map +1 -1
- package/dist/es6/tabs/lib/TabsItem.d.ts.map +1 -1
- package/dist/es6/tabs/lib/TabsItem.js +5 -4
- package/dist/es6/tabs/lib/TabsList.d.ts.map +1 -1
- package/dist/es6/tabs/lib/TabsList.js +18 -3
- package/dist/es6/tabs/lib/useTabsModel.d.ts +55 -159
- package/dist/es6/tabs/lib/useTabsModel.d.ts.map +1 -1
- package/dist/es6/tabs/lib/useTabsModel.js +3 -1
- package/package.json +8 -7
- package/pagination/lib/Pagination/PageButton.tsx +13 -7
- package/radio/lib/Radio.tsx +98 -29
- package/tabs/lib/TabsItem.tsx +4 -3
- package/tabs/lib/TabsList.tsx +23 -4
- package/tabs/lib/useTabsModel.tsx +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBarItem.d.ts","sourceRoot":"","sources":["../../../../action-bar/lib/ActionBarItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ActionBarItem.d.ts","sourceRoot":"","sources":["../../../../action-bar/lib/ActionBarItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,MAAM,WAAW,kBAAkB;IACjC;;;;;;OAMG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAI5B,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMxB,CAAC"}
|
|
@@ -10,8 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import * as React from 'react';
|
|
13
|
-
import { composeHooks,
|
|
14
|
-
import { SystemIcon } from '@workday/canvas-kit-react/icon';
|
|
13
|
+
import { composeHooks, createSubcomponent } from '@workday/canvas-kit-react/common';
|
|
15
14
|
import { SecondaryButton } from '@workday/canvas-kit-react/button';
|
|
16
15
|
import { useListItemRegister, useListItemRovingFocus, useOverflowListItemMeasure, } from '@workday/canvas-kit-react/collection';
|
|
17
16
|
import { useActionBarModel } from './useActionBarModel';
|
|
@@ -20,10 +19,6 @@ export var ActionBarItem = createSubcomponent(SecondaryButton)({
|
|
|
20
19
|
displayName: 'ActionBar.Item',
|
|
21
20
|
modelHook: useActionBarModel,
|
|
22
21
|
elemPropsHook: useActionBarItem,
|
|
23
|
-
subComponents: {
|
|
24
|
-
Icon: SystemIcon,
|
|
25
|
-
Text: EllipsisText,
|
|
26
|
-
},
|
|
27
22
|
})(function (elemProps, Element) {
|
|
28
23
|
return React.createElement(Element, __assign({}, elemProps));
|
|
29
24
|
});
|
|
@@ -33,6 +33,7 @@ export declare const useActionBarModel: (<TT_Special_Generic>(config?: (Partial<
|
|
|
33
33
|
}>;
|
|
34
34
|
initialHiddenIds: string[];
|
|
35
35
|
containerWidth: number;
|
|
36
|
+
shouldCalculateOverflow: boolean;
|
|
36
37
|
initialSelectedIds: import("../../collection/lib/useSelectionListModel").SelectedIds;
|
|
37
38
|
initialUnselectedIds: string[];
|
|
38
39
|
selection: import("../../collection/lib/useSelectionListModel").SelectionManager;
|
|
@@ -1425,6 +1426,7 @@ export declare const useActionBarModel: (<TT_Special_Generic>(config?: (Partial<
|
|
|
1425
1426
|
}>;
|
|
1426
1427
|
initialHiddenIds: string[];
|
|
1427
1428
|
containerWidth: number;
|
|
1429
|
+
shouldCalculateOverflow: boolean;
|
|
1428
1430
|
initialSelectedIds: import("../../collection/lib/useSelectionListModel").SelectedIds;
|
|
1429
1431
|
initialUnselectedIds: string[];
|
|
1430
1432
|
selection: import("../../collection/lib/useSelectionListModel").SelectionManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActionBarModel.d.ts","sourceRoot":"","sources":["../../../../action-bar/lib/useActionBarModel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,eAAO,MAAM,iBAAiB;IAG1B;;;OAGG;;IAEH;;;;OAIG
|
|
1
|
+
{"version":3,"file":"useActionBarModel.d.ts","sourceRoot":"","sources":["../../../../action-bar/lib/useActionBarModel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,eAAO,MAAM,iBAAiB;IAG1B;;;OAGG;;IAEH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwEL,CAAC"}
|
|
@@ -38,6 +38,10 @@ export interface CheckboxProps extends Themeable {
|
|
|
38
38
|
* @default false
|
|
39
39
|
*/
|
|
40
40
|
indeterminate?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* The variant for the checkbox
|
|
43
|
+
*/
|
|
44
|
+
variant?: 'inverse' | undefined;
|
|
41
45
|
}
|
|
42
46
|
export declare const Checkbox: import("../../common").ElementComponent<"input", CheckboxProps> & {
|
|
43
47
|
ErrorType: typeof ErrorType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../checkbox/lib/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGL,SAAS,EAOT,SAAS,EACV,MAAM,kCAAkC,CAAC;AAU1C,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC9C;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC5D;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../checkbox/lib/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGL,SAAS,EAOT,SAAS,EACV,MAAM,kCAAkC,CAAC;AAU1C,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC9C;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC5D;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACjC;AAoQD,eAAO,MAAM,QAAQ;;CAoEnB,CAAC;AAEH,eAAe,QAAQ,CAAC"}
|
|
@@ -57,55 +57,70 @@ var CheckboxRipple = styled('span')({
|
|
|
57
57
|
width: checkboxWidth,
|
|
58
58
|
position: 'absolute',
|
|
59
59
|
pointerEvents: 'none',
|
|
60
|
-
|
|
60
|
+
}, function (_a) {
|
|
61
|
+
var variant = _a.variant;
|
|
62
|
+
return ({
|
|
63
|
+
opacity: variant === 'inverse' ? '0.4' : '1',
|
|
64
|
+
});
|
|
61
65
|
});
|
|
62
66
|
/**
|
|
63
67
|
* Note: `~ div:first-of-type` refers to `CheckboxBackground`
|
|
64
68
|
* and was easier to use than a component selector in this case.
|
|
65
69
|
*/
|
|
66
70
|
var CheckboxInput = styled('input')(function (_a) {
|
|
67
|
-
var _b = _a.theme.canvas.palette, themePrimary = _b.primary, themeFocusOutline = _b.common.focusOutline;
|
|
71
|
+
var _b = _a.theme.canvas.palette, themePrimary = _b.primary, themeFocusOutline = _b.common.focusOutline, variant = _a.variant;
|
|
68
72
|
return (__assign({ borderRadius: borderRadius.s, width: checkboxTapArea, height: checkboxTapArea, margin: 0, marginTop: '-3px', marginLeft: '-3px', position: 'absolute', opacity: 0, '&:not(:disabled)': {
|
|
69
73
|
cursor: 'pointer',
|
|
70
74
|
},
|
|
71
75
|
// States
|
|
72
76
|
'&:not(:checked):not(:disabled):not(:focus):hover, &:not(:checked):not(:disabled):active': {
|
|
73
77
|
'~ div:first-of-type': {
|
|
74
|
-
borderColor: inputColors.hoverBorder,
|
|
78
|
+
borderColor: variant === 'inverse' ? colors.soap300 : inputColors.hoverBorder,
|
|
75
79
|
},
|
|
76
80
|
}, '&:checked ~ div:first-of-type': {
|
|
77
|
-
borderColor: themePrimary.main,
|
|
78
|
-
backgroundColor: themePrimary.main,
|
|
81
|
+
borderColor: variant === 'inverse' ? colors.soap300 : themePrimary.main,
|
|
82
|
+
backgroundColor: variant === 'inverse' ? colors.frenchVanilla100 : themePrimary.main,
|
|
79
83
|
}, '&:disabled ~ div:first-of-type': {
|
|
80
84
|
borderColor: inputColors.disabled.border,
|
|
81
|
-
backgroundColor: inputColors.disabled.background,
|
|
85
|
+
backgroundColor: variant === 'inverse' ? colors.soap300 : inputColors.disabled.background,
|
|
86
|
+
opacity: variant === 'inverse' ? '.4' : '1',
|
|
82
87
|
}, '&:disabled:checked ~ div:first-of-type': {
|
|
83
|
-
borderColor: themePrimary.light,
|
|
84
|
-
backgroundColor: themePrimary.light,
|
|
88
|
+
borderColor: variant === 'inverse' ? colors.soap300 : themePrimary.light,
|
|
89
|
+
backgroundColor: variant === 'inverse' ? colors.soap300 : themePrimary.light,
|
|
85
90
|
},
|
|
86
91
|
// Focus
|
|
87
92
|
'&:focus, &:active': {
|
|
88
93
|
outline: 'none',
|
|
89
|
-
}, '&:focus ~ div:first-of-type': {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
}, '&:focus ~ div:first-of-type': __assign({ borderColor: variant === 'inverse' ? colors.blackPepper400 : themePrimary.main, borderWidth: '2px', boxShadow: 'none' }, focusRing({
|
|
95
|
+
width: variant === 'inverse' ? 2 : 0,
|
|
96
|
+
separation: 0,
|
|
97
|
+
animate: false,
|
|
98
|
+
innerColor: variant === 'inverse' ? colors.blackPepper400 : undefined,
|
|
99
|
+
outerColor: variant === 'inverse' ? colors.frenchVanilla100 : undefined,
|
|
100
|
+
})), '&:checked:focus ~ div:first-of-type': __assign(__assign({}, focusRing({
|
|
101
|
+
width: 2,
|
|
102
|
+
separation: 2,
|
|
103
|
+
animate: false,
|
|
104
|
+
innerColor: variant === 'inverse' ? colors.blackPepper400 : undefined,
|
|
105
|
+
outerColor: variant === 'inverse' ? colors.frenchVanilla100 : themeFocusOutline,
|
|
106
|
+
})), { borderColor: variant === 'inverse' ? colors.frenchVanilla100 : themePrimary.main, borderWidth: '2px', '& span': {
|
|
94
107
|
marginLeft: '-7px',
|
|
95
108
|
} }) }, mouseFocusBehavior({
|
|
96
109
|
'&:focus ~ div:first-of-type': {
|
|
97
|
-
border:
|
|
110
|
+
border: variant === 'inverse'
|
|
111
|
+
? "1px solid " + colors.soap300
|
|
112
|
+
: "1px solid " + inputColors.hoverBorder,
|
|
98
113
|
boxShadow: 'none',
|
|
99
114
|
'& span': {
|
|
100
115
|
marginLeft: '-6px',
|
|
101
116
|
},
|
|
102
117
|
},
|
|
103
118
|
'&:checked ~ div:first-of-type': {
|
|
104
|
-
borderColor: themePrimary.main,
|
|
119
|
+
borderColor: variant === 'inverse' ? colors.soap300 : themePrimary.main,
|
|
105
120
|
},
|
|
106
121
|
'&:disabled:checked ~ div:first-of-type': {
|
|
107
122
|
borderColor: themePrimary.light,
|
|
108
|
-
backgroundColor: themePrimary.light,
|
|
123
|
+
backgroundColor: variant === 'inverse' ? colors.soap300 : themePrimary.light,
|
|
109
124
|
},
|
|
110
125
|
})));
|
|
111
126
|
}, function (_a) {
|
|
@@ -116,36 +131,35 @@ var CheckboxInput = styled('input')(function (_a) {
|
|
|
116
131
|
},
|
|
117
132
|
});
|
|
118
133
|
}, function (_a) {
|
|
119
|
-
var theme = _a.theme, error = _a.error;
|
|
134
|
+
var theme = _a.theme, error = _a.error, variant = _a.variant;
|
|
120
135
|
var errorColors = getErrorColors(error, theme);
|
|
121
136
|
if (errorColors.outer === errorColors.inner) {
|
|
122
137
|
errorColors.outer = 'transparent';
|
|
123
138
|
}
|
|
124
139
|
var errorStyles = {
|
|
125
140
|
'& ~ div:first-of-type': {
|
|
126
|
-
border: "1px solid " + errorColors.inner,
|
|
141
|
+
border: variant === 'inverse' ? "1px solid " + colors.soap300 : "1px solid " + errorColors.inner,
|
|
127
142
|
boxShadow: "0 0 0 1px " + errorColors.inner + ", 0 0 0 2px " + errorColors.outer,
|
|
128
143
|
},
|
|
129
144
|
'&:not(:checked):not(:disabled):not(:focus):hover, &:not(:checked):not(:disabled):active': {
|
|
130
145
|
'~ div:first-of-type': {
|
|
131
|
-
borderColor: errorColors.inner,
|
|
146
|
+
borderColor: variant === 'inverse' ? "1px solid " + colors.soap300 : errorColors.inner,
|
|
132
147
|
},
|
|
133
148
|
},
|
|
134
149
|
'&:checked ~ div:first-of-type': {
|
|
135
|
-
borderColor: theme.canvas.palette.primary.main,
|
|
136
|
-
boxShadow: "\n
|
|
150
|
+
borderColor: variant === 'inverse' ? colors.soap300 : theme.canvas.palette.primary.main,
|
|
151
|
+
boxShadow: "\n 0 0 0 2px " + colors.frenchVanilla100 + ",\n 0 0 0 4px " + errorColors.inner + ",\n 0 0 0 5px " + errorColors.outer,
|
|
137
152
|
},
|
|
138
153
|
};
|
|
139
|
-
return __assign(__assign({},
|
|
154
|
+
return __assign(__assign({}, mouseFocusBehavior(__assign(__assign({}, errorStyles), { '&:not(:checked):focus ~ div:first-of-type': {
|
|
140
155
|
border: "1px solid " + errorColors.inner,
|
|
141
156
|
boxShadow: "0 0 0 1px " + errorColors.inner + ", 0 0 0 2px " + errorColors.outer,
|
|
142
|
-
} })));
|
|
157
|
+
} }))), errorStyles);
|
|
143
158
|
});
|
|
144
159
|
var CheckboxBackground = styled('div')({
|
|
145
160
|
alignItems: 'center',
|
|
146
161
|
backgroundColor: colors.frenchVanilla100,
|
|
147
162
|
borderRadius: borderRadius.s,
|
|
148
|
-
border: '1px solid ' + inputColors.border,
|
|
149
163
|
boxSizing: 'border-box',
|
|
150
164
|
display: 'flex',
|
|
151
165
|
height: checkboxHeight,
|
|
@@ -155,6 +169,11 @@ var CheckboxBackground = styled('div')({
|
|
|
155
169
|
position: 'absolute',
|
|
156
170
|
transition: 'border 200ms ease, background 200ms',
|
|
157
171
|
width: checkboxWidth,
|
|
172
|
+
}, function (_a) {
|
|
173
|
+
var variant = _a.variant;
|
|
174
|
+
return ({
|
|
175
|
+
border: "1px solid " + (variant === 'inverse' ? colors.soap300 : inputColors.border),
|
|
176
|
+
});
|
|
158
177
|
});
|
|
159
178
|
var CheckboxCheck = styled('div')({
|
|
160
179
|
display: 'flex',
|
|
@@ -183,14 +202,24 @@ var IndeterminateBox = styled('div')({
|
|
|
183
202
|
width: '10px',
|
|
184
203
|
height: '2px',
|
|
185
204
|
}, function (_a) {
|
|
186
|
-
var theme = _a.theme;
|
|
205
|
+
var theme = _a.theme, variant = _a.variant;
|
|
187
206
|
return ({
|
|
188
|
-
backgroundColor:
|
|
207
|
+
backgroundColor: variant === 'inverse'
|
|
208
|
+
? theme.canvas.palette.primary.main
|
|
209
|
+
: theme.canvas.palette.primary.contrast,
|
|
189
210
|
});
|
|
190
211
|
});
|
|
191
212
|
var CheckboxLabel = styled('label')(__assign(__assign({}, canvas.type.levels.subtext.large), { paddingLeft: checkboxLabelDistance }), function (_a) {
|
|
192
|
-
var
|
|
193
|
-
return (
|
|
213
|
+
var variant = _a.variant;
|
|
214
|
+
return (variant === 'inverse' ? { color: colors.frenchVanilla100 } : undefined);
|
|
215
|
+
}, function (_a) {
|
|
216
|
+
var disabled = _a.disabled, variant = _a.variant;
|
|
217
|
+
return disabled
|
|
218
|
+
? {
|
|
219
|
+
color: variant === 'inverse' ? colors.frenchVanilla100 : inputColors.disabled.text,
|
|
220
|
+
opacity: variant === 'inverse' ? '.4' : '1',
|
|
221
|
+
}
|
|
222
|
+
: { cursor: 'pointer' };
|
|
194
223
|
});
|
|
195
224
|
export var Checkbox = createComponent('input')({
|
|
196
225
|
displayName: 'Checkbox',
|
|
@@ -201,15 +230,17 @@ export var Checkbox = createComponent('input')({
|
|
|
201
230
|
_d = _a.theme,
|
|
202
231
|
// TODO: Fix useTheme and make it a real hook
|
|
203
232
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
204
|
-
theme = _d === void 0 ? useTheme() : _d, id = _a.id, disabled = _a.disabled, onChange = _a.onChange, value = _a.value, error = _a.error, indeterminate = _a.indeterminate, elemProps = __rest(_a, ["checked", "label", "theme", "id", "disabled", "onChange", "value", "error", "indeterminate"]);
|
|
233
|
+
theme = _d === void 0 ? useTheme() : _d, id = _a.id, disabled = _a.disabled, onChange = _a.onChange, value = _a.value, error = _a.error, indeterminate = _a.indeterminate, variant = _a.variant, elemProps = __rest(_a, ["checked", "label", "theme", "id", "disabled", "onChange", "value", "error", "indeterminate", "variant"]);
|
|
205
234
|
var inputId = useUniqueId(id);
|
|
206
235
|
return (React.createElement(CheckboxContainer, null,
|
|
207
236
|
React.createElement(CheckboxInputWrapper, { disabled: disabled },
|
|
208
|
-
React.createElement(CheckboxInput, __assign({ as: Element, checked: checked, disabled: disabled, id: inputId, ref: ref, onChange: onChange, type: "checkbox", value: value, error: error, "aria-checked": indeterminate ? 'mixed' : checked }, elemProps)),
|
|
209
|
-
React.createElement(CheckboxRipple,
|
|
210
|
-
React.createElement(CheckboxBackground, { checked: checked, disabled: disabled },
|
|
211
|
-
React.createElement(CheckboxCheck, { checked: checked }, indeterminate ? (React.createElement(IndeterminateBox,
|
|
212
|
-
|
|
237
|
+
React.createElement(CheckboxInput, __assign({ as: Element, checked: checked, disabled: disabled, id: inputId, ref: ref, onChange: onChange, type: "checkbox", value: value, error: error, variant: variant, "aria-checked": indeterminate ? 'mixed' : checked }, elemProps)),
|
|
238
|
+
React.createElement(CheckboxRipple, { variant: variant }),
|
|
239
|
+
React.createElement(CheckboxBackground, { variant: variant, checked: checked, disabled: disabled },
|
|
240
|
+
React.createElement(CheckboxCheck, { checked: checked }, indeterminate ? (React.createElement(IndeterminateBox, { variant: variant })) : (React.createElement(SystemIcon, { icon: checkSmallIcon, color: variant === 'inverse'
|
|
241
|
+
? theme.canvas.palette.primary.main
|
|
242
|
+
: theme.canvas.palette.primary.contrast }))))),
|
|
243
|
+
label && (React.createElement(CheckboxLabel, { variant: variant, htmlFor: inputId, disabled: disabled }, label))));
|
|
213
244
|
},
|
|
214
245
|
subComponents: {
|
|
215
246
|
ErrorType: ErrorType,
|
|
@@ -3,6 +3,11 @@ export declare function getHiddenIds(containerWidth: number, overflowTargetWidth
|
|
|
3
3
|
export declare const useOverflowListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
4
4
|
initialHiddenIds: string[];
|
|
5
5
|
containerWidth: number;
|
|
6
|
+
/**
|
|
7
|
+
* Determines if overflow should actually occur. For example, touch devices are better at
|
|
8
|
+
* side-scrolling than mouse devices. In these cases, it makes sense to disable overflowing.
|
|
9
|
+
* @default true
|
|
10
|
+
*/ shouldCalculateOverflow: boolean;
|
|
6
11
|
initialSelectedIds: import("./useSelectionListModel").SelectedIds;
|
|
7
12
|
initialUnselectedIds: string[];
|
|
8
13
|
selection: import("./useSelectionListModel").SelectionManager;
|
|
@@ -1298,6 +1303,11 @@ export declare const useOverflowListModel: (<TT_Special_Generic>(config?: (Parti
|
|
|
1298
1303
|
}) & import("../../common").ModelExtras<{
|
|
1299
1304
|
initialHiddenIds: string[];
|
|
1300
1305
|
containerWidth: number;
|
|
1306
|
+
/**
|
|
1307
|
+
* Determines if overflow should actually occur. For example, touch devices are better at
|
|
1308
|
+
* side-scrolling than mouse devices. In these cases, it makes sense to disable overflowing.
|
|
1309
|
+
* @default true
|
|
1310
|
+
*/ shouldCalculateOverflow: boolean;
|
|
1301
1311
|
initialSelectedIds: import("./useSelectionListModel").SelectedIds;
|
|
1302
1312
|
initialUnselectedIds: string[];
|
|
1303
1313
|
selection: import("./useSelectionListModel").SelectionManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOverflowListModel.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useOverflowListModel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,wBAAgB,YAAY,CAC1B,cAAc,EAAE,MAAM,EACtB,mBAAmB,EAAE,MAAM,EAC3B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACtC,WAAW,EAAE,MAAM,EAAE,GAAG,KAAK,GAC5B,MAAM,EAAE,CAwCV;AAED,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"useOverflowListModel.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useOverflowListModel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,wBAAgB,YAAY,CAC1B,cAAc,EAAE,MAAM,EACtB,mBAAmB,EAAE,MAAM,EAC3B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACtC,WAAW,EAAE,MAAM,EAAE,GAAG,KAAK,GAC5B,MAAM,EAAE,CAwCV;AAED,eAAO,MAAM,oBAAoB;;;IAK7B;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eA6DkC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;YAInB,MAAM;eAAS,MAAM;;;;;;;;;;;;;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AiBf;YAAC,EAAE,EAAE,MAAM,CAAA;SAAC;8BAGT;YAAC,EAAE,EAAE,MAAM,CAAA;SAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMpC,CAAC"}
|
|
@@ -51,10 +51,16 @@ export function getHiddenIds(containerWidth, overflowTargetWidth, itemWidthCache
|
|
|
51
51
|
return hiddenIds;
|
|
52
52
|
}
|
|
53
53
|
export var useOverflowListModel = createModelHook({
|
|
54
|
-
defaultConfig: __assign(__assign({}, useSelectionListModel.defaultConfig), { initialHiddenIds: [], containerWidth: 0
|
|
54
|
+
defaultConfig: __assign(__assign({}, useSelectionListModel.defaultConfig), { initialHiddenIds: [], containerWidth: 0,
|
|
55
|
+
/**
|
|
56
|
+
* Determines if overflow should actually occur. For example, touch devices are better at
|
|
57
|
+
* side-scrolling than mouse devices. In these cases, it makes sense to disable overflowing.
|
|
58
|
+
* @default true
|
|
59
|
+
*/ shouldCalculateOverflow: true }),
|
|
55
60
|
requiredConfig: useSelectionListModel.requiredConfig,
|
|
56
61
|
contextOverride: useSelectionListModel.Context,
|
|
57
62
|
})(function (config) {
|
|
63
|
+
var shouldCalculateOverflow = config.shouldCalculateOverflow === undefined ? true : config.shouldCalculateOverflow;
|
|
58
64
|
var _a = React.useState(config.initialHiddenIds), hiddenIds = _a[0], setHiddenIds = _a[1];
|
|
59
65
|
var _b = React.useState({}), itemWidthCache = _b[0], setItemWidthCache = _b[1];
|
|
60
66
|
var _c = React.useState(0), containerWidth = _c[0], setContainerWidth = _c[1];
|
|
@@ -62,12 +68,12 @@ export var useOverflowListModel = createModelHook({
|
|
|
62
68
|
var itemWidthCacheRef = React.useRef(itemWidthCache);
|
|
63
69
|
var _d = React.useState(0), overflowTargetWidth = _d[0], setOverflowTargetWidth = _d[1];
|
|
64
70
|
var overflowTargetWidthRef = React.useRef(0);
|
|
71
|
+
var internalHiddenIds = shouldCalculateOverflow ? hiddenIds : [];
|
|
65
72
|
// Cursors skip over disabled ids, but know nothing of hidden ids. We'll go ahead and disable
|
|
66
73
|
// hidden ids as well
|
|
67
|
-
var nonInteractiveIds = (config.nonInteractiveIds || []).concat(
|
|
74
|
+
var nonInteractiveIds = (config.nonInteractiveIds || []).concat(internalHiddenIds);
|
|
68
75
|
var model = useSelectionListModel(__assign(__assign({}, config), { nonInteractiveIds: nonInteractiveIds }));
|
|
69
|
-
var state = __assign(__assign({}, model.state), { hiddenIds:
|
|
70
|
-
itemWidthCache: itemWidthCache,
|
|
76
|
+
var state = __assign(__assign({}, model.state), { hiddenIds: internalHiddenIds, itemWidthCache: itemWidthCache,
|
|
71
77
|
containerWidth: containerWidth,
|
|
72
78
|
overflowTargetWidth: overflowTargetWidth });
|
|
73
79
|
var events = __assign(__assign({}, model.events), { select: function (data) {
|
|
@@ -12,6 +12,7 @@ export * from './models';
|
|
|
12
12
|
export * from './elements';
|
|
13
13
|
export * from './useConstant';
|
|
14
14
|
export * from './useIsFullscreen';
|
|
15
|
+
export * from './useModalityType';
|
|
15
16
|
export * from './useWindowSize';
|
|
16
17
|
export * from './useResizeObserver';
|
|
17
18
|
export * from './StaticStates';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../common/lib/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../common/lib/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC"}
|
|
@@ -12,6 +12,7 @@ export * from './models';
|
|
|
12
12
|
export * from './elements';
|
|
13
13
|
export * from './useConstant';
|
|
14
14
|
export * from './useIsFullscreen';
|
|
15
|
+
export * from './useModalityType';
|
|
15
16
|
export * from './useWindowSize';
|
|
16
17
|
export * from './useResizeObserver';
|
|
17
18
|
export * from './StaticStates';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare type Modality = 'mouse' | 'touch' | 'pen';
|
|
2
|
+
/**
|
|
3
|
+
* Uses heuristics to determine if the user is on a touch device, uses a pen, or a mouse. This hook
|
|
4
|
+
* is useful if you have styles or behaviors that depend on the user's interaction type. For
|
|
5
|
+
* example, touch users can scroll horizontally easier than mouse users, so horizontal overflow
|
|
6
|
+
* might be more desired than overflow menus on touch devices. For devices that support multiple
|
|
7
|
+
* input types, the last used input type is saved. For these devices, consider the possibility this
|
|
8
|
+
* value could change after your component is rendered, so make sure you component rerenders
|
|
9
|
+
* properly in this case.
|
|
10
|
+
*
|
|
11
|
+
* Uses `PointerEvent.pointerType` to determine last used input.
|
|
12
|
+
*
|
|
13
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType
|
|
14
|
+
*/
|
|
15
|
+
export declare const useModalityType: () => Modality;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=useModalityType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useModalityType.d.ts","sourceRoot":"","sources":["../../../../../common/lib/utils/useModalityType.ts"],"names":[],"mappings":"AAEA,aAAK,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC;AA+B1C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,QAAO,QAkBlC,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
// Use this shared global value to reduce calls to localStorage which is a synchronous API to a
|
|
3
|
+
// drive which could be slow (spinning disks could be hundreds of ms). We read only once this way.
|
|
4
|
+
// The following initialization is very difficult to test via automation. Don't mess with it unless
|
|
5
|
+
// you plan to manually test.
|
|
6
|
+
//
|
|
7
|
+
// 1. Initialize modality to localStorage
|
|
8
|
+
// a. if localStorage isn't primed, use clientWidth of the browsers
|
|
9
|
+
// b. if < 768, default to 'touch'
|
|
10
|
+
// c. else default to 'mouse'
|
|
11
|
+
var localStorageValue = 'mouse'; //((typeof localStorage !== 'undefined'
|
|
12
|
+
// ? localStorage.getItem('modality')
|
|
13
|
+
// : '') ||
|
|
14
|
+
// (typeof document !== 'undefined'
|
|
15
|
+
// ? document.documentElement.clientWidth < 768
|
|
16
|
+
// ? 'touch'
|
|
17
|
+
// : ''
|
|
18
|
+
// : '') ||
|
|
19
|
+
// 'mouse') as Modality;
|
|
20
|
+
// Update the `localStorageValue`, but conditionally update localStorage only if the value has
|
|
21
|
+
// changed. This prevents too many calls to `localStorage` which can be costly on spinning disk
|
|
22
|
+
// drives
|
|
23
|
+
var updateLocalStorage = function (value) {
|
|
24
|
+
// if (localStorageValue !== value) {
|
|
25
|
+
// localStorage.setItem('modality', value);
|
|
26
|
+
// }
|
|
27
|
+
// localStorageValue = value;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Uses heuristics to determine if the user is on a touch device, uses a pen, or a mouse. This hook
|
|
31
|
+
* is useful if you have styles or behaviors that depend on the user's interaction type. For
|
|
32
|
+
* example, touch users can scroll horizontally easier than mouse users, so horizontal overflow
|
|
33
|
+
* might be more desired than overflow menus on touch devices. For devices that support multiple
|
|
34
|
+
* input types, the last used input type is saved. For these devices, consider the possibility this
|
|
35
|
+
* value could change after your component is rendered, so make sure you component rerenders
|
|
36
|
+
* properly in this case.
|
|
37
|
+
*
|
|
38
|
+
* Uses `PointerEvent.pointerType` to determine last used input.
|
|
39
|
+
*
|
|
40
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType
|
|
41
|
+
*/
|
|
42
|
+
export var useModalityType = function () {
|
|
43
|
+
var _a = React.useState(localStorageValue), modality = _a[0], setModality = _a[1];
|
|
44
|
+
React.useEffect(function () {
|
|
45
|
+
var handlePointerDown = function (event) {
|
|
46
|
+
var value = event.pointerType;
|
|
47
|
+
setModality(value);
|
|
48
|
+
updateLocalStorage(value);
|
|
49
|
+
};
|
|
50
|
+
document.addEventListener('pointerdown', handlePointerDown);
|
|
51
|
+
return function () {
|
|
52
|
+
document.removeEventListener('pointerdown', handlePointerDown);
|
|
53
|
+
};
|
|
54
|
+
}, []);
|
|
55
|
+
return modality;
|
|
56
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageButton.d.ts","sourceRoot":"","sources":["../../../../../pagination/lib/Pagination/PageButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"PageButton.d.ts","sourceRoot":"","sources":["../../../../../pagination/lib/Pagination/PageButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;AA6CxC,oBAAY,eAAe,GAAG,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IAC5E,KAAK,EAAE,eAAe,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,UAAU,2DAMpB,eAAe,gBAqBjB,CAAC"}
|
|
@@ -21,7 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import * as React from 'react';
|
|
24
|
-
import { styled } from '@workday/canvas-kit-react/common';
|
|
24
|
+
import { styled, useTheme } from '@workday/canvas-kit-react/common';
|
|
25
25
|
import { borderRadius, colors, space } from '@workday/canvas-kit-react/tokens';
|
|
26
26
|
import { BaseButton } from '@workday/canvas-kit-react/button';
|
|
27
27
|
var StyledPageButton = styled(BaseButton)({
|
|
@@ -35,22 +35,23 @@ var StyledPageButton = styled(BaseButton)({
|
|
|
35
35
|
fontWeight: toggled ? 700 : 'normal',
|
|
36
36
|
};
|
|
37
37
|
});
|
|
38
|
-
var getPaginationButtonColors = function (toggled) {
|
|
38
|
+
var getPaginationButtonColors = function (toggled, theme) {
|
|
39
|
+
var themePrimary = theme.canvas.palette.primary;
|
|
39
40
|
return {
|
|
40
41
|
default: {
|
|
41
|
-
background: toggled ?
|
|
42
|
+
background: toggled ? themePrimary.main : 'transparent',
|
|
42
43
|
label: toggled ? colors.frenchVanilla100 : colors.blackPepper400,
|
|
43
44
|
},
|
|
44
45
|
hover: {
|
|
45
|
-
background: toggled ?
|
|
46
|
+
background: toggled ? themePrimary.main : colors.soap300,
|
|
46
47
|
label: toggled ? colors.frenchVanilla100 : colors.blackPepper400,
|
|
47
48
|
},
|
|
48
49
|
active: {
|
|
49
|
-
background: toggled ?
|
|
50
|
+
background: toggled ? themePrimary.main : 'transparent',
|
|
50
51
|
label: toggled ? colors.frenchVanilla100 : colors.blackPepper400,
|
|
51
52
|
},
|
|
52
53
|
focus: {
|
|
53
|
-
background: toggled ?
|
|
54
|
+
background: toggled ? themePrimary.main : 'transparent',
|
|
54
55
|
label: toggled ? colors.frenchVanilla100 : colors.blackPepper400,
|
|
55
56
|
},
|
|
56
57
|
disabled: {
|
|
@@ -61,9 +62,10 @@ var getPaginationButtonColors = function (toggled) {
|
|
|
61
62
|
export var PageButton = function (_a) {
|
|
62
63
|
var model = _a.model, onClick = _a.onClick, pageNumber = _a.pageNumber, children = _a.children, elemProps = __rest(_a, ["model", "onClick", "pageNumber", "children"]);
|
|
63
64
|
var isCurrentPage = pageNumber === model.state.currentPage;
|
|
65
|
+
var theme = useTheme();
|
|
64
66
|
var handleClick = function (e) {
|
|
65
67
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
66
68
|
model.events.goTo(pageNumber);
|
|
67
69
|
};
|
|
68
|
-
return (React.createElement(StyledPageButton, __assign({ "aria-current": isCurrentPage ? 'page' : undefined, colors: getPaginationButtonColors(isCurrentPage), "aria-pressed": undefined, onClick: handleClick, toggled: isCurrentPage }, elemProps), children || pageNumber));
|
|
70
|
+
return (React.createElement(StyledPageButton, __assign({ "aria-current": isCurrentPage ? 'page' : undefined, colors: getPaginationButtonColors(isCurrentPage, theme), "aria-pressed": undefined, onClick: handleClick, toggled: isCurrentPage }, elemProps), children || pageNumber));
|
|
69
71
|
};
|
|
@@ -33,6 +33,7 @@ export interface RadioProps extends Themeable {
|
|
|
33
33
|
* The value of the Radio button.
|
|
34
34
|
*/
|
|
35
35
|
value?: string;
|
|
36
|
+
variant?: 'inverse' | undefined;
|
|
36
37
|
}
|
|
37
38
|
export declare const Radio: import("../../common").ElementComponent<"input", RadioProps>;
|
|
38
39
|
export default Radio;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../../../radio/lib/Radio.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,M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