@workday/canvas-kit-react 7.1.0-next.0 → 7.2.0-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/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 +9 -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 +10 -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 +14 -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
|
@@ -79,55 +79,70 @@ var CheckboxRipple = common_1.styled('span')({
|
|
|
79
79
|
width: checkboxWidth,
|
|
80
80
|
position: 'absolute',
|
|
81
81
|
pointerEvents: 'none',
|
|
82
|
-
|
|
82
|
+
}, function (_a) {
|
|
83
|
+
var variant = _a.variant;
|
|
84
|
+
return ({
|
|
85
|
+
opacity: variant === 'inverse' ? '0.4' : '1',
|
|
86
|
+
});
|
|
83
87
|
});
|
|
84
88
|
/**
|
|
85
89
|
* Note: `~ div:first-of-type` refers to `CheckboxBackground`
|
|
86
90
|
* and was easier to use than a component selector in this case.
|
|
87
91
|
*/
|
|
88
92
|
var CheckboxInput = common_1.styled('input')(function (_a) {
|
|
89
|
-
var _b = _a.theme.canvas.palette, themePrimary = _b.primary, themeFocusOutline = _b.common.focusOutline;
|
|
93
|
+
var _b = _a.theme.canvas.palette, themePrimary = _b.primary, themeFocusOutline = _b.common.focusOutline, variant = _a.variant;
|
|
90
94
|
return (__assign({ borderRadius: tokens_1.borderRadius.s, width: checkboxTapArea, height: checkboxTapArea, margin: 0, marginTop: '-3px', marginLeft: '-3px', position: 'absolute', opacity: 0, '&:not(:disabled)': {
|
|
91
95
|
cursor: 'pointer',
|
|
92
96
|
},
|
|
93
97
|
// States
|
|
94
98
|
'&:not(:checked):not(:disabled):not(:focus):hover, &:not(:checked):not(:disabled):active': {
|
|
95
99
|
'~ div:first-of-type': {
|
|
96
|
-
borderColor: tokens_1.inputColors.hoverBorder,
|
|
100
|
+
borderColor: variant === 'inverse' ? tokens_1.colors.soap300 : tokens_1.inputColors.hoverBorder,
|
|
97
101
|
},
|
|
98
102
|
}, '&:checked ~ div:first-of-type': {
|
|
99
|
-
borderColor: themePrimary.main,
|
|
100
|
-
backgroundColor: themePrimary.main,
|
|
103
|
+
borderColor: variant === 'inverse' ? tokens_1.colors.soap300 : themePrimary.main,
|
|
104
|
+
backgroundColor: variant === 'inverse' ? tokens_1.colors.frenchVanilla100 : themePrimary.main,
|
|
101
105
|
}, '&:disabled ~ div:first-of-type': {
|
|
102
106
|
borderColor: tokens_1.inputColors.disabled.border,
|
|
103
|
-
backgroundColor: tokens_1.inputColors.disabled.background,
|
|
107
|
+
backgroundColor: variant === 'inverse' ? tokens_1.colors.soap300 : tokens_1.inputColors.disabled.background,
|
|
108
|
+
opacity: variant === 'inverse' ? '.4' : '1',
|
|
104
109
|
}, '&:disabled:checked ~ div:first-of-type': {
|
|
105
|
-
borderColor: themePrimary.light,
|
|
106
|
-
backgroundColor: themePrimary.light,
|
|
110
|
+
borderColor: variant === 'inverse' ? tokens_1.colors.soap300 : themePrimary.light,
|
|
111
|
+
backgroundColor: variant === 'inverse' ? tokens_1.colors.soap300 : themePrimary.light,
|
|
107
112
|
},
|
|
108
113
|
// Focus
|
|
109
114
|
'&:focus, &:active': {
|
|
110
115
|
outline: 'none',
|
|
111
|
-
}, '&:focus ~ div:first-of-type': {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
+
}, '&:focus ~ div:first-of-type': __assign({ borderColor: variant === 'inverse' ? tokens_1.colors.blackPepper400 : themePrimary.main, borderWidth: '2px', boxShadow: 'none' }, common_1.focusRing({
|
|
117
|
+
width: variant === 'inverse' ? 2 : 0,
|
|
118
|
+
separation: 0,
|
|
119
|
+
animate: false,
|
|
120
|
+
innerColor: variant === 'inverse' ? tokens_1.colors.blackPepper400 : undefined,
|
|
121
|
+
outerColor: variant === 'inverse' ? tokens_1.colors.frenchVanilla100 : undefined,
|
|
122
|
+
})), '&:checked:focus ~ div:first-of-type': __assign(__assign({}, common_1.focusRing({
|
|
123
|
+
width: 2,
|
|
124
|
+
separation: 2,
|
|
125
|
+
animate: false,
|
|
126
|
+
innerColor: variant === 'inverse' ? tokens_1.colors.blackPepper400 : undefined,
|
|
127
|
+
outerColor: variant === 'inverse' ? tokens_1.colors.frenchVanilla100 : themeFocusOutline,
|
|
128
|
+
})), { borderColor: variant === 'inverse' ? tokens_1.colors.frenchVanilla100 : themePrimary.main, borderWidth: '2px', '& span': {
|
|
116
129
|
marginLeft: '-7px',
|
|
117
130
|
} }) }, common_1.mouseFocusBehavior({
|
|
118
131
|
'&:focus ~ div:first-of-type': {
|
|
119
|
-
border:
|
|
132
|
+
border: variant === 'inverse'
|
|
133
|
+
? "1px solid " + tokens_1.colors.soap300
|
|
134
|
+
: "1px solid " + tokens_1.inputColors.hoverBorder,
|
|
120
135
|
boxShadow: 'none',
|
|
121
136
|
'& span': {
|
|
122
137
|
marginLeft: '-6px',
|
|
123
138
|
},
|
|
124
139
|
},
|
|
125
140
|
'&:checked ~ div:first-of-type': {
|
|
126
|
-
borderColor: themePrimary.main,
|
|
141
|
+
borderColor: variant === 'inverse' ? tokens_1.colors.soap300 : themePrimary.main,
|
|
127
142
|
},
|
|
128
143
|
'&:disabled:checked ~ div:first-of-type': {
|
|
129
144
|
borderColor: themePrimary.light,
|
|
130
|
-
backgroundColor: themePrimary.light,
|
|
145
|
+
backgroundColor: variant === 'inverse' ? tokens_1.colors.soap300 : themePrimary.light,
|
|
131
146
|
},
|
|
132
147
|
})));
|
|
133
148
|
}, function (_a) {
|
|
@@ -138,36 +153,35 @@ var CheckboxInput = common_1.styled('input')(function (_a) {
|
|
|
138
153
|
},
|
|
139
154
|
});
|
|
140
155
|
}, function (_a) {
|
|
141
|
-
var theme = _a.theme, error = _a.error;
|
|
156
|
+
var theme = _a.theme, error = _a.error, variant = _a.variant;
|
|
142
157
|
var errorColors = common_1.getErrorColors(error, theme);
|
|
143
158
|
if (errorColors.outer === errorColors.inner) {
|
|
144
159
|
errorColors.outer = 'transparent';
|
|
145
160
|
}
|
|
146
161
|
var errorStyles = {
|
|
147
162
|
'& ~ div:first-of-type': {
|
|
148
|
-
border: "1px solid " + errorColors.inner,
|
|
163
|
+
border: variant === 'inverse' ? "1px solid " + tokens_1.colors.soap300 : "1px solid " + errorColors.inner,
|
|
149
164
|
boxShadow: "0 0 0 1px " + errorColors.inner + ", 0 0 0 2px " + errorColors.outer,
|
|
150
165
|
},
|
|
151
166
|
'&:not(:checked):not(:disabled):not(:focus):hover, &:not(:checked):not(:disabled):active': {
|
|
152
167
|
'~ div:first-of-type': {
|
|
153
|
-
borderColor: errorColors.inner,
|
|
168
|
+
borderColor: variant === 'inverse' ? "1px solid " + tokens_1.colors.soap300 : errorColors.inner,
|
|
154
169
|
},
|
|
155
170
|
},
|
|
156
171
|
'&:checked ~ div:first-of-type': {
|
|
157
|
-
borderColor: theme.canvas.palette.primary.main,
|
|
158
|
-
boxShadow: "\n
|
|
172
|
+
borderColor: variant === 'inverse' ? tokens_1.colors.soap300 : theme.canvas.palette.primary.main,
|
|
173
|
+
boxShadow: "\n 0 0 0 2px " + tokens_1.colors.frenchVanilla100 + ",\n 0 0 0 4px " + errorColors.inner + ",\n 0 0 0 5px " + errorColors.outer,
|
|
159
174
|
},
|
|
160
175
|
};
|
|
161
|
-
return __assign(__assign({},
|
|
176
|
+
return __assign(__assign({}, common_1.mouseFocusBehavior(__assign(__assign({}, errorStyles), { '&:not(:checked):focus ~ div:first-of-type': {
|
|
162
177
|
border: "1px solid " + errorColors.inner,
|
|
163
178
|
boxShadow: "0 0 0 1px " + errorColors.inner + ", 0 0 0 2px " + errorColors.outer,
|
|
164
|
-
} })));
|
|
179
|
+
} }))), errorStyles);
|
|
165
180
|
});
|
|
166
181
|
var CheckboxBackground = common_1.styled('div')({
|
|
167
182
|
alignItems: 'center',
|
|
168
183
|
backgroundColor: tokens_1.colors.frenchVanilla100,
|
|
169
184
|
borderRadius: tokens_1.borderRadius.s,
|
|
170
|
-
border: '1px solid ' + tokens_1.inputColors.border,
|
|
171
185
|
boxSizing: 'border-box',
|
|
172
186
|
display: 'flex',
|
|
173
187
|
height: checkboxHeight,
|
|
@@ -177,6 +191,11 @@ var CheckboxBackground = common_1.styled('div')({
|
|
|
177
191
|
position: 'absolute',
|
|
178
192
|
transition: 'border 200ms ease, background 200ms',
|
|
179
193
|
width: checkboxWidth,
|
|
194
|
+
}, function (_a) {
|
|
195
|
+
var variant = _a.variant;
|
|
196
|
+
return ({
|
|
197
|
+
border: "1px solid " + (variant === 'inverse' ? tokens_1.colors.soap300 : tokens_1.inputColors.border),
|
|
198
|
+
});
|
|
180
199
|
});
|
|
181
200
|
var CheckboxCheck = common_1.styled('div')({
|
|
182
201
|
display: 'flex',
|
|
@@ -205,14 +224,24 @@ var IndeterminateBox = common_1.styled('div')({
|
|
|
205
224
|
width: '10px',
|
|
206
225
|
height: '2px',
|
|
207
226
|
}, function (_a) {
|
|
208
|
-
var theme = _a.theme;
|
|
227
|
+
var theme = _a.theme, variant = _a.variant;
|
|
209
228
|
return ({
|
|
210
|
-
backgroundColor:
|
|
229
|
+
backgroundColor: variant === 'inverse'
|
|
230
|
+
? theme.canvas.palette.primary.main
|
|
231
|
+
: theme.canvas.palette.primary.contrast,
|
|
211
232
|
});
|
|
212
233
|
});
|
|
213
234
|
var CheckboxLabel = common_1.styled('label')(__assign(__assign({}, tokens_1.default.type.levels.subtext.large), { paddingLeft: checkboxLabelDistance }), function (_a) {
|
|
214
|
-
var
|
|
215
|
-
return (
|
|
235
|
+
var variant = _a.variant;
|
|
236
|
+
return (variant === 'inverse' ? { color: tokens_1.colors.frenchVanilla100 } : undefined);
|
|
237
|
+
}, function (_a) {
|
|
238
|
+
var disabled = _a.disabled, variant = _a.variant;
|
|
239
|
+
return disabled
|
|
240
|
+
? {
|
|
241
|
+
color: variant === 'inverse' ? tokens_1.colors.frenchVanilla100 : tokens_1.inputColors.disabled.text,
|
|
242
|
+
opacity: variant === 'inverse' ? '.4' : '1',
|
|
243
|
+
}
|
|
244
|
+
: { cursor: 'pointer' };
|
|
216
245
|
});
|
|
217
246
|
exports.Checkbox = common_1.createComponent('input')({
|
|
218
247
|
displayName: 'Checkbox',
|
|
@@ -223,15 +252,17 @@ exports.Checkbox = common_1.createComponent('input')({
|
|
|
223
252
|
_d = _a.theme,
|
|
224
253
|
// TODO: Fix useTheme and make it a real hook
|
|
225
254
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
226
|
-
theme = _d === void 0 ? common_1.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"]);
|
|
255
|
+
theme = _d === void 0 ? common_1.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"]);
|
|
227
256
|
var inputId = common_1.useUniqueId(id);
|
|
228
257
|
return (React.createElement(CheckboxContainer, null,
|
|
229
258
|
React.createElement(CheckboxInputWrapper, { disabled: disabled },
|
|
230
|
-
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)),
|
|
231
|
-
React.createElement(CheckboxRipple,
|
|
232
|
-
React.createElement(CheckboxBackground, { checked: checked, disabled: disabled },
|
|
233
|
-
React.createElement(CheckboxCheck, { checked: checked }, indeterminate ? (React.createElement(IndeterminateBox,
|
|
234
|
-
|
|
259
|
+
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)),
|
|
260
|
+
React.createElement(CheckboxRipple, { variant: variant }),
|
|
261
|
+
React.createElement(CheckboxBackground, { variant: variant, checked: checked, disabled: disabled },
|
|
262
|
+
React.createElement(CheckboxCheck, { checked: checked }, indeterminate ? (React.createElement(IndeterminateBox, { variant: variant })) : (React.createElement(icon_1.SystemIcon, { icon: canvas_system_icons_web_1.checkSmallIcon, color: variant === 'inverse'
|
|
263
|
+
? theme.canvas.palette.primary.main
|
|
264
|
+
: theme.canvas.palette.primary.contrast }))))),
|
|
265
|
+
label && (React.createElement(CheckboxLabel, { variant: variant, htmlFor: inputId, disabled: disabled }, label))));
|
|
235
266
|
},
|
|
236
267
|
subComponents: {
|
|
237
268
|
ErrorType: common_1.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":"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"}
|
|
@@ -58,10 +58,16 @@ function getHiddenIds(containerWidth, overflowTargetWidth, itemWidthCache, selec
|
|
|
58
58
|
}
|
|
59
59
|
exports.getHiddenIds = getHiddenIds;
|
|
60
60
|
exports.useOverflowListModel = common_1.createModelHook({
|
|
61
|
-
defaultConfig: __assign(__assign({}, useSelectionListModel_1.useSelectionListModel.defaultConfig), { initialHiddenIds: [], containerWidth: 0
|
|
61
|
+
defaultConfig: __assign(__assign({}, useSelectionListModel_1.useSelectionListModel.defaultConfig), { initialHiddenIds: [], containerWidth: 0,
|
|
62
|
+
/**
|
|
63
|
+
* Determines if overflow should actually occur. For example, touch devices are better at
|
|
64
|
+
* side-scrolling than mouse devices. In these cases, it makes sense to disable overflowing.
|
|
65
|
+
* @default true
|
|
66
|
+
*/ shouldCalculateOverflow: true }),
|
|
62
67
|
requiredConfig: useSelectionListModel_1.useSelectionListModel.requiredConfig,
|
|
63
68
|
contextOverride: useSelectionListModel_1.useSelectionListModel.Context,
|
|
64
69
|
})(function (config) {
|
|
70
|
+
var shouldCalculateOverflow = config.shouldCalculateOverflow === undefined ? true : config.shouldCalculateOverflow;
|
|
65
71
|
var _a = react_1.default.useState(config.initialHiddenIds), hiddenIds = _a[0], setHiddenIds = _a[1];
|
|
66
72
|
var _b = react_1.default.useState({}), itemWidthCache = _b[0], setItemWidthCache = _b[1];
|
|
67
73
|
var _c = react_1.default.useState(0), containerWidth = _c[0], setContainerWidth = _c[1];
|
|
@@ -69,12 +75,12 @@ exports.useOverflowListModel = common_1.createModelHook({
|
|
|
69
75
|
var itemWidthCacheRef = react_1.default.useRef(itemWidthCache);
|
|
70
76
|
var _d = react_1.default.useState(0), overflowTargetWidth = _d[0], setOverflowTargetWidth = _d[1];
|
|
71
77
|
var overflowTargetWidthRef = react_1.default.useRef(0);
|
|
78
|
+
var internalHiddenIds = shouldCalculateOverflow ? hiddenIds : [];
|
|
72
79
|
// Cursors skip over disabled ids, but know nothing of hidden ids. We'll go ahead and disable
|
|
73
80
|
// hidden ids as well
|
|
74
|
-
var nonInteractiveIds = (config.nonInteractiveIds || []).concat(
|
|
81
|
+
var nonInteractiveIds = (config.nonInteractiveIds || []).concat(internalHiddenIds);
|
|
75
82
|
var model = useSelectionListModel_1.useSelectionListModel(__assign(__assign({}, config), { nonInteractiveIds: nonInteractiveIds }));
|
|
76
|
-
var state = __assign(__assign({}, model.state), { hiddenIds:
|
|
77
|
-
itemWidthCache: itemWidthCache,
|
|
83
|
+
var state = __assign(__assign({}, model.state), { hiddenIds: internalHiddenIds, itemWidthCache: itemWidthCache,
|
|
78
84
|
containerWidth: containerWidth,
|
|
79
85
|
overflowTargetWidth: overflowTargetWidth });
|
|
80
86
|
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"}
|
|
@@ -24,6 +24,7 @@ __exportStar(require("./models"), exports);
|
|
|
24
24
|
__exportStar(require("./elements"), exports);
|
|
25
25
|
__exportStar(require("./useConstant"), exports);
|
|
26
26
|
__exportStar(require("./useIsFullscreen"), exports);
|
|
27
|
+
__exportStar(require("./useModalityType"), exports);
|
|
27
28
|
__exportStar(require("./useWindowSize"), exports);
|
|
28
29
|
__exportStar(require("./useResizeObserver"), exports);
|
|
29
30
|
__exportStar(require("./StaticStates"), exports);
|
|
@@ -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,63 @@
|
|
|
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.useModalityType = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
// Use this shared global value to reduce calls to localStorage which is a synchronous API to a
|
|
9
|
+
// drive which could be slow (spinning disks could be hundreds of ms). We read only once this way.
|
|
10
|
+
// The following initialization is very difficult to test via automation. Don't mess with it unless
|
|
11
|
+
// you plan to manually test.
|
|
12
|
+
//
|
|
13
|
+
// 1. Initialize modality to localStorage
|
|
14
|
+
// a. if localStorage isn't primed, use clientWidth of the browsers
|
|
15
|
+
// b. if < 768, default to 'touch'
|
|
16
|
+
// c. else default to 'mouse'
|
|
17
|
+
var localStorageValue = 'mouse'; //((typeof localStorage !== 'undefined'
|
|
18
|
+
// ? localStorage.getItem('modality')
|
|
19
|
+
// : '') ||
|
|
20
|
+
// (typeof document !== 'undefined'
|
|
21
|
+
// ? document.documentElement.clientWidth < 768
|
|
22
|
+
// ? 'touch'
|
|
23
|
+
// : ''
|
|
24
|
+
// : '') ||
|
|
25
|
+
// 'mouse') as Modality;
|
|
26
|
+
// Update the `localStorageValue`, but conditionally update localStorage only if the value has
|
|
27
|
+
// changed. This prevents too many calls to `localStorage` which can be costly on spinning disk
|
|
28
|
+
// drives
|
|
29
|
+
var updateLocalStorage = function (value) {
|
|
30
|
+
// if (localStorageValue !== value) {
|
|
31
|
+
// localStorage.setItem('modality', value);
|
|
32
|
+
// }
|
|
33
|
+
// localStorageValue = value;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Uses heuristics to determine if the user is on a touch device, uses a pen, or a mouse. This hook
|
|
37
|
+
* is useful if you have styles or behaviors that depend on the user's interaction type. For
|
|
38
|
+
* example, touch users can scroll horizontally easier than mouse users, so horizontal overflow
|
|
39
|
+
* might be more desired than overflow menus on touch devices. For devices that support multiple
|
|
40
|
+
* input types, the last used input type is saved. For these devices, consider the possibility this
|
|
41
|
+
* value could change after your component is rendered, so make sure you component rerenders
|
|
42
|
+
* properly in this case.
|
|
43
|
+
*
|
|
44
|
+
* Uses `PointerEvent.pointerType` to determine last used input.
|
|
45
|
+
*
|
|
46
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType
|
|
47
|
+
*/
|
|
48
|
+
var useModalityType = function () {
|
|
49
|
+
var _a = react_1.default.useState(localStorageValue), modality = _a[0], setModality = _a[1];
|
|
50
|
+
react_1.default.useEffect(function () {
|
|
51
|
+
var handlePointerDown = function (event) {
|
|
52
|
+
var value = event.pointerType;
|
|
53
|
+
setModality(value);
|
|
54
|
+
updateLocalStorage(value);
|
|
55
|
+
};
|
|
56
|
+
document.addEventListener('pointerdown', handlePointerDown);
|
|
57
|
+
return function () {
|
|
58
|
+
document.removeEventListener('pointerdown', handlePointerDown);
|
|
59
|
+
};
|
|
60
|
+
}, []);
|
|
61
|
+
return modality;
|
|
62
|
+
};
|
|
63
|
+
exports.useModalityType = useModalityType;
|
|
@@ -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,gBAsBjB,CAAC"}
|
|
@@ -57,22 +57,23 @@ var StyledPageButton = common_1.styled(button_1.BaseButton)({
|
|
|
57
57
|
fontWeight: toggled ? 700 : 'normal',
|
|
58
58
|
};
|
|
59
59
|
});
|
|
60
|
-
var getPaginationButtonColors = function (toggled) {
|
|
60
|
+
var getPaginationButtonColors = function (toggled, theme) {
|
|
61
|
+
var themePrimary = theme.canvas.palette.primary;
|
|
61
62
|
return {
|
|
62
63
|
default: {
|
|
63
|
-
background: toggled ?
|
|
64
|
+
background: toggled ? themePrimary.main : 'transparent',
|
|
64
65
|
label: toggled ? tokens_1.colors.frenchVanilla100 : tokens_1.colors.blackPepper400,
|
|
65
66
|
},
|
|
66
67
|
hover: {
|
|
67
|
-
background: toggled ?
|
|
68
|
+
background: toggled ? themePrimary.main : tokens_1.colors.soap300,
|
|
68
69
|
label: toggled ? tokens_1.colors.frenchVanilla100 : tokens_1.colors.blackPepper400,
|
|
69
70
|
},
|
|
70
71
|
active: {
|
|
71
|
-
background: toggled ?
|
|
72
|
+
background: toggled ? themePrimary.main : 'transparent',
|
|
72
73
|
label: toggled ? tokens_1.colors.frenchVanilla100 : tokens_1.colors.blackPepper400,
|
|
73
74
|
},
|
|
74
75
|
focus: {
|
|
75
|
-
background: toggled ?
|
|
76
|
+
background: toggled ? themePrimary.main : 'transparent',
|
|
76
77
|
label: toggled ? tokens_1.colors.frenchVanilla100 : tokens_1.colors.blackPepper400,
|
|
77
78
|
},
|
|
78
79
|
disabled: {
|
|
@@ -83,10 +84,12 @@ var getPaginationButtonColors = function (toggled) {
|
|
|
83
84
|
var PageButton = function (_a) {
|
|
84
85
|
var model = _a.model, onClick = _a.onClick, pageNumber = _a.pageNumber, children = _a.children, elemProps = __rest(_a, ["model", "onClick", "pageNumber", "children"]);
|
|
85
86
|
var isCurrentPage = pageNumber === model.state.currentPage;
|
|
87
|
+
var theme = common_1.useTheme();
|
|
86
88
|
var handleClick = function (e) {
|
|
87
89
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
88
90
|
model.events.goTo(pageNumber);
|
|
89
91
|
};
|
|
90
|
-
|
|
92
|
+
console.warn(theme);
|
|
93
|
+
return (React.createElement(StyledPageButton, __assign({ "aria-current": isCurrentPage ? 'page' : undefined, colors: getPaginationButtonColors(isCurrentPage, theme), "aria-pressed": undefined, onClick: handleClick, toggled: isCurrentPage }, elemProps), children || pageNumber));
|
|
91
94
|
};
|
|
92
95
|
exports.PageButton = PageButton;
|
|
@@ -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,MAAM,OAAO,CAAC;AAC/B,OAAO,EAML,SAAS,EAEV,MAAM,kCAAkC,CAAC;AAQ1C,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC3C;;;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,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;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;
|
|
1
|
+
{"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../../../radio/lib/Radio.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAML,SAAS,EAEV,MAAM,kCAAkC,CAAC;AAQ1C,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC3C;;;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,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;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,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CACjC;AAkPD,eAAO,MAAM,KAAK,8DAgDhB,CAAC;AAEH,eAAe,KAAK,CAAC"}
|
|
@@ -77,7 +77,11 @@ var RadioRipple = common_1.styled('span')({
|
|
|
77
77
|
width: radioWidth,
|
|
78
78
|
position: 'absolute',
|
|
79
79
|
pointerEvents: 'none',
|
|
80
|
-
|
|
80
|
+
}, function (_a) {
|
|
81
|
+
var variant = _a.variant;
|
|
82
|
+
return ({
|
|
83
|
+
opacity: variant === 'inverse' ? '0.4' : '1',
|
|
84
|
+
});
|
|
81
85
|
});
|
|
82
86
|
var RadioInput = common_1.styled('input')({
|
|
83
87
|
borderRadius: radioBorderRadius,
|
|
@@ -92,7 +96,7 @@ var RadioInput = common_1.styled('input')({
|
|
|
92
96
|
outline: 'none',
|
|
93
97
|
},
|
|
94
98
|
}, function (_a) {
|
|
95
|
-
var checked = _a.checked, disabled = _a.disabled, _b = _a.theme.canvas.palette, themePrimary = _b.primary, themeFocusOutline = _b.common.focusOutline;
|
|
99
|
+
var checked = _a.checked, disabled = _a.disabled, variant = _a.variant, _b = _a.theme.canvas.palette, themePrimary = _b.primary, themeFocusOutline = _b.common.focusOutline;
|
|
96
100
|
return (__assign({ cursor: disabled ? undefined : 'pointer',
|
|
97
101
|
/**
|
|
98
102
|
* These selectors are targetting various sibling elements (~) here because
|
|
@@ -111,25 +115,52 @@ var RadioInput = common_1.styled('input')({
|
|
|
111
115
|
// input (which is visually hidden)
|
|
112
116
|
'&:hover ~ div:first-of-type': {
|
|
113
117
|
backgroundColor: checked
|
|
114
|
-
?
|
|
118
|
+
? variant === 'inverse'
|
|
119
|
+
? tokens_1.colors.frenchVanilla100
|
|
120
|
+
: themePrimary.main
|
|
115
121
|
: disabled
|
|
116
122
|
? tokens_1.inputColors.disabled.background
|
|
117
123
|
: 'white',
|
|
118
124
|
borderColor: checked
|
|
119
|
-
?
|
|
125
|
+
? variant === 'inverse'
|
|
126
|
+
? tokens_1.colors.soap300
|
|
127
|
+
: themePrimary.main
|
|
120
128
|
: disabled
|
|
121
129
|
? tokens_1.inputColors.disabled.border
|
|
122
|
-
:
|
|
130
|
+
: variant === 'inverse'
|
|
131
|
+
? tokens_1.colors.soap300
|
|
132
|
+
: tokens_1.inputColors.hoverBorder,
|
|
123
133
|
borderWidth: '1px',
|
|
124
134
|
}, '&:focus, &focus:hover': {
|
|
125
|
-
'& ~ div:first-of-type': {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
135
|
+
'& ~ div:first-of-type': __assign({ borderWidth: '2px', borderColor: variant === 'inverse' ? tokens_1.colors.blackPepper400 : themeFocusOutline, boxShadow: 'none' }, common_1.focusRing({
|
|
136
|
+
width: variant === 'inverse' ? 2 : 0,
|
|
137
|
+
separation: 0,
|
|
138
|
+
animate: false,
|
|
139
|
+
innerColor: variant === 'inverse' ? tokens_1.colors.blackPepper400 : undefined,
|
|
140
|
+
outerColor: variant === 'inverse' ? tokens_1.colors.frenchVanilla100 : undefined,
|
|
141
|
+
})),
|
|
142
|
+
}, '&:checked:focus ~ div:first-of-type': __assign(__assign({}, common_1.focusRing({
|
|
143
|
+
separation: 2,
|
|
144
|
+
width: 2,
|
|
145
|
+
innerColor: variant === 'inverse' ? tokens_1.colors.blackPepper400 : undefined,
|
|
146
|
+
outerColor: variant === 'inverse' ? tokens_1.colors.frenchVanilla100 : themeFocusOutline,
|
|
147
|
+
})), { borderColor: variant === 'inverse' ? tokens_1.colors.frenchVanilla100 : themePrimary.main, borderWidth: '2px' }) }, common_1.mouseFocusBehavior({
|
|
148
|
+
'&:focus ~ div:first-of-type': __assign(__assign({}, common_1.focusRing({
|
|
149
|
+
width: 0,
|
|
150
|
+
outerColor: variant === 'inverse' ? tokens_1.colors.frenchVanilla100 : themeFocusOutline,
|
|
151
|
+
})), { borderWidth: '1px', borderColor: checked
|
|
152
|
+
? variant === 'inverse'
|
|
153
|
+
? tokens_1.colors.soap300
|
|
154
|
+
: themePrimary.main
|
|
155
|
+
: tokens_1.inputColors.border }),
|
|
131
156
|
'&:focus:hover ~ div:first-of-type, &:focus:active ~ div:first-of-type': {
|
|
132
|
-
borderColor: checked
|
|
157
|
+
borderColor: checked
|
|
158
|
+
? variant === 'inverse'
|
|
159
|
+
? tokens_1.colors.soap300
|
|
160
|
+
: themePrimary.main
|
|
161
|
+
: variant === 'inverse'
|
|
162
|
+
? tokens_1.colors.soap300
|
|
163
|
+
: tokens_1.inputColors.hoverBorder,
|
|
133
164
|
},
|
|
134
165
|
})));
|
|
135
166
|
});
|
|
@@ -149,18 +180,25 @@ var RadioBackground = common_1.styled('div')({
|
|
|
149
180
|
transition: 'border 200ms ease, background 200ms',
|
|
150
181
|
width: radioWidth,
|
|
151
182
|
}, function (_a) {
|
|
152
|
-
var checked = _a.checked, disabled = _a.disabled, themePrimary = _a.theme.canvas.palette.primary;
|
|
183
|
+
var checked = _a.checked, disabled = _a.disabled, variant = _a.variant, themePrimary = _a.theme.canvas.palette.primary;
|
|
153
184
|
return ({
|
|
154
185
|
borderColor: checked
|
|
155
|
-
?
|
|
186
|
+
? variant === 'inverse'
|
|
187
|
+
? tokens_1.colors.soap300
|
|
188
|
+
: themePrimary.main
|
|
156
189
|
: disabled
|
|
157
190
|
? tokens_1.inputColors.disabled.border
|
|
158
|
-
:
|
|
191
|
+
: variant === 'inverse'
|
|
192
|
+
? tokens_1.colors.soap300
|
|
193
|
+
: tokens_1.inputColors.border,
|
|
159
194
|
backgroundColor: checked
|
|
160
|
-
?
|
|
195
|
+
? variant === 'inverse'
|
|
196
|
+
? tokens_1.colors.frenchVanilla100
|
|
197
|
+
: themePrimary.main
|
|
161
198
|
: disabled
|
|
162
199
|
? tokens_1.inputColors.disabled.background
|
|
163
200
|
: 'white',
|
|
201
|
+
opacity: disabled && variant === 'inverse' ? '.4' : '1',
|
|
164
202
|
});
|
|
165
203
|
});
|
|
166
204
|
var RadioCheck = common_1.styled('div')({
|
|
@@ -172,9 +210,11 @@ var RadioCheck = common_1.styled('div')({
|
|
|
172
210
|
transition: 'transform 200ms ease, opacity 200ms ease',
|
|
173
211
|
width: radioDot,
|
|
174
212
|
}, function (_a) {
|
|
175
|
-
var theme = _a.theme;
|
|
213
|
+
var theme = _a.theme, variant = _a.variant;
|
|
176
214
|
return ({
|
|
177
|
-
backgroundColor:
|
|
215
|
+
backgroundColor: variant === 'inverse'
|
|
216
|
+
? theme.canvas.palette.primary.main
|
|
217
|
+
: theme.canvas.palette.primary.contrast,
|
|
178
218
|
});
|
|
179
219
|
}, function (_a) {
|
|
180
220
|
var checked = _a.checked;
|
|
@@ -184,21 +224,29 @@ var RadioCheck = common_1.styled('div')({
|
|
|
184
224
|
});
|
|
185
225
|
});
|
|
186
226
|
var RadioLabel = common_1.styled('label')(__assign(__assign({}, tokens_1.default.type.levels.subtext.large), { paddingLeft: radioLabelDistance }), function (_a) {
|
|
187
|
-
var
|
|
188
|
-
return (
|
|
227
|
+
var variant = _a.variant;
|
|
228
|
+
return (variant === 'inverse' ? { color: tokens_1.colors.frenchVanilla100 } : undefined);
|
|
229
|
+
}, function (_a) {
|
|
230
|
+
var disabled = _a.disabled, variant = _a.variant;
|
|
231
|
+
return disabled
|
|
232
|
+
? {
|
|
233
|
+
color: variant === 'inverse' ? tokens_1.colors.frenchVanilla100 : tokens_1.inputColors.disabled.text,
|
|
234
|
+
opacity: variant === 'inverse' ? '.4' : '1',
|
|
235
|
+
}
|
|
236
|
+
: { cursor: 'pointer' };
|
|
189
237
|
});
|
|
190
238
|
exports.Radio = common_1.createComponent('input')({
|
|
191
239
|
displayName: 'Radio',
|
|
192
240
|
Component: function (_a, ref, Element) {
|
|
193
|
-
var _b = _a.checked, checked = _b === void 0 ? false : _b, id = _a.id, _c = _a.label, label = _c === void 0 ? '' : _c, disabled = _a.disabled, name = _a.name, onChange = _a.onChange, value = _a.value, elemProps = __rest(_a, ["checked", "id", "label", "disabled", "name", "onChange", "value"]);
|
|
241
|
+
var _b = _a.checked, checked = _b === void 0 ? false : _b, id = _a.id, _c = _a.label, label = _c === void 0 ? '' : _c, disabled = _a.disabled, name = _a.name, onChange = _a.onChange, value = _a.value, variant = _a.variant, elemProps = __rest(_a, ["checked", "id", "label", "disabled", "name", "onChange", "value", "variant"]);
|
|
194
242
|
var inputId = common_1.useUniqueId(id);
|
|
195
243
|
return (React.createElement(RadioContainer, null,
|
|
196
244
|
React.createElement(RadioInputWrapper, { disabled: disabled },
|
|
197
|
-
React.createElement(RadioInput, __assign({ as: Element, checked: checked, disabled: disabled, id: inputId, ref: ref, name: name, onChange: onChange, type: "radio", value: value, "aria-checked": checked }, elemProps)),
|
|
198
|
-
React.createElement(RadioRipple,
|
|
199
|
-
React.createElement(RadioBackground, { checked: checked, disabled: disabled },
|
|
200
|
-
React.createElement(RadioCheck, { checked: checked }))),
|
|
201
|
-
label && (React.createElement(RadioLabel, { htmlFor: inputId, disabled: disabled }, label))));
|
|
245
|
+
React.createElement(RadioInput, __assign({ as: Element, checked: checked, disabled: disabled, id: inputId, ref: ref, name: name, onChange: onChange, type: "radio", value: value, "aria-checked": checked, variant: variant }, elemProps)),
|
|
246
|
+
React.createElement(RadioRipple, { variant: variant }),
|
|
247
|
+
React.createElement(RadioBackground, { checked: checked, disabled: disabled, variant: variant },
|
|
248
|
+
React.createElement(RadioCheck, { checked: checked, variant: variant }))),
|
|
249
|
+
label && (React.createElement(RadioLabel, { htmlFor: inputId, disabled: disabled, variant: variant }, label))));
|
|
202
250
|
},
|
|
203
251
|
});
|
|
204
252
|
exports.default = exports.Radio;
|
|
@@ -31,6 +31,7 @@ export declare const Tabs: import("../../common").ComponentM<TabsProps & Partial
|
|
|
31
31
|
}>;
|
|
32
32
|
initialHiddenIds: string[];
|
|
33
33
|
containerWidth: number;
|
|
34
|
+
shouldCalculateOverflow: boolean;
|
|
34
35
|
initialSelectedIds: import("../../collection/lib/useSelectionListModel").SelectedIds;
|
|
35
36
|
initialUnselectedIds: string[];
|
|
36
37
|
selection: import("../../collection/lib/useSelectionListModel").SelectionManager;
|