@workday/canvas-kit-react 7.0.4 → 7.0.7

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.
@@ -77,7 +77,11 @@ var RadioRipple = common_1.styled('span')({
77
77
  width: radioWidth,
78
78
  position: 'absolute',
79
79
  pointerEvents: 'none',
80
- zIndex: -1,
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
- ? themePrimary.main
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
- ? themePrimary.main
125
+ ? variant === 'inverse'
126
+ ? tokens_1.colors.soap300
127
+ : themePrimary.main
120
128
  : disabled
121
129
  ? tokens_1.inputColors.disabled.border
122
- : tokens_1.inputColors.hoverBorder,
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
- borderColor: checked ? themePrimary.main : themeFocusOutline,
127
- borderWidth: '2px',
128
- },
129
- }, '&:checked:focus ~ div:first-of-type': __assign({}, common_1.focusRing({ separation: 2, outerColor: themeFocusOutline })) }, common_1.mouseFocusBehavior({
130
- '&:focus ~ div:first-of-type': __assign(__assign({}, common_1.focusRing({ width: 0, outerColor: themeFocusOutline })), { borderWidth: '1px', borderColor: checked ? themePrimary.main : tokens_1.inputColors.border }),
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 ? themePrimary.main : tokens_1.inputColors.hoverBorder,
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
- ? themePrimary.main
186
+ ? variant === 'inverse'
187
+ ? tokens_1.colors.soap300
188
+ : themePrimary.main
156
189
  : disabled
157
190
  ? tokens_1.inputColors.disabled.border
158
- : tokens_1.inputColors.border,
191
+ : variant === 'inverse'
192
+ ? tokens_1.colors.soap300
193
+ : tokens_1.inputColors.border,
159
194
  backgroundColor: checked
160
- ? themePrimary.main
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: theme.canvas.palette.primary.contrast,
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 disabled = _a.disabled;
188
- return (disabled ? { color: tokens_1.inputColors.disabled.text } : { cursor: 'pointer' });
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, null),
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;
@@ -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;CACzB;AA6ND,eAAO,MAAM,QAAQ;;CA2DnB,CAAC;AAEH,eAAe,QAAQ,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
- zIndex: -1,
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
- borderColor: themePrimary.main,
91
- borderWidth: '2px',
92
- boxShadow: 'none',
93
- }, '&:checked:focus ~ div:first-of-type': __assign(__assign({}, focusRing({ width: 2, separation: 2, animate: false, outerColor: themeFocusOutline })), { '& span': {
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: "1px solid " + inputColors.hoverBorder,
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 0 0 0 2px " + colors.frenchVanilla100 + ",\n 0 0 0 4px " + errorColors.inner + ",\n 0 0 0 5px " + errorColors.outer,
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({}, errorStyles), mouseFocusBehavior(__assign(__assign({}, errorStyles), { '&:not(:checked):focus ~ div:first-of-type': {
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: theme.canvas.palette.primary.contrast,
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 disabled = _a.disabled;
193
- return (disabled ? { color: inputColors.disabled.text } : { cursor: 'pointer' });
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, null),
210
- React.createElement(CheckboxBackground, { checked: checked, disabled: disabled },
211
- React.createElement(CheckboxCheck, { checked: checked }, indeterminate ? (React.createElement(IndeterminateBox, null)) : (React.createElement(SystemIcon, { icon: checkSmallIcon, color: theme.canvas.palette.primary.contrast }))))),
212
- label && (React.createElement(CheckboxLabel, { htmlFor: inputId, disabled: disabled }, label))));
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,
@@ -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;CAChB;AAyLD,eAAO,MAAM,KAAK,8DAqChB,CAAC;AAEH,eAAe,KAAK,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"}
@@ -55,7 +55,11 @@ var RadioRipple = styled('span')({
55
55
  width: radioWidth,
56
56
  position: 'absolute',
57
57
  pointerEvents: 'none',
58
- zIndex: -1,
58
+ }, function (_a) {
59
+ var variant = _a.variant;
60
+ return ({
61
+ opacity: variant === 'inverse' ? '0.4' : '1',
62
+ });
59
63
  });
60
64
  var RadioInput = styled('input')({
61
65
  borderRadius: radioBorderRadius,
@@ -70,7 +74,7 @@ var RadioInput = styled('input')({
70
74
  outline: 'none',
71
75
  },
72
76
  }, function (_a) {
73
- var checked = _a.checked, disabled = _a.disabled, _b = _a.theme.canvas.palette, themePrimary = _b.primary, themeFocusOutline = _b.common.focusOutline;
77
+ var checked = _a.checked, disabled = _a.disabled, variant = _a.variant, _b = _a.theme.canvas.palette, themePrimary = _b.primary, themeFocusOutline = _b.common.focusOutline;
74
78
  return (__assign({ cursor: disabled ? undefined : 'pointer',
75
79
  /**
76
80
  * These selectors are targetting various sibling elements (~) here because
@@ -89,25 +93,52 @@ var RadioInput = styled('input')({
89
93
  // input (which is visually hidden)
90
94
  '&:hover ~ div:first-of-type': {
91
95
  backgroundColor: checked
92
- ? themePrimary.main
96
+ ? variant === 'inverse'
97
+ ? colors.frenchVanilla100
98
+ : themePrimary.main
93
99
  : disabled
94
100
  ? inputColors.disabled.background
95
101
  : 'white',
96
102
  borderColor: checked
97
- ? themePrimary.main
103
+ ? variant === 'inverse'
104
+ ? colors.soap300
105
+ : themePrimary.main
98
106
  : disabled
99
107
  ? inputColors.disabled.border
100
- : inputColors.hoverBorder,
108
+ : variant === 'inverse'
109
+ ? colors.soap300
110
+ : inputColors.hoverBorder,
101
111
  borderWidth: '1px',
102
112
  }, '&:focus, &focus:hover': {
103
- '& ~ div:first-of-type': {
104
- borderColor: checked ? themePrimary.main : themeFocusOutline,
105
- borderWidth: '2px',
106
- },
107
- }, '&:checked:focus ~ div:first-of-type': __assign({}, focusRing({ separation: 2, outerColor: themeFocusOutline })) }, mouseFocusBehavior({
108
- '&:focus ~ div:first-of-type': __assign(__assign({}, focusRing({ width: 0, outerColor: themeFocusOutline })), { borderWidth: '1px', borderColor: checked ? themePrimary.main : inputColors.border }),
113
+ '& ~ div:first-of-type': __assign({ borderWidth: '2px', borderColor: variant === 'inverse' ? colors.blackPepper400 : themeFocusOutline, boxShadow: 'none' }, focusRing({
114
+ width: variant === 'inverse' ? 2 : 0,
115
+ separation: 0,
116
+ animate: false,
117
+ innerColor: variant === 'inverse' ? colors.blackPepper400 : undefined,
118
+ outerColor: variant === 'inverse' ? colors.frenchVanilla100 : undefined,
119
+ })),
120
+ }, '&:checked:focus ~ div:first-of-type': __assign(__assign({}, focusRing({
121
+ separation: 2,
122
+ width: 2,
123
+ innerColor: variant === 'inverse' ? colors.blackPepper400 : undefined,
124
+ outerColor: variant === 'inverse' ? colors.frenchVanilla100 : themeFocusOutline,
125
+ })), { borderColor: variant === 'inverse' ? colors.frenchVanilla100 : themePrimary.main, borderWidth: '2px' }) }, mouseFocusBehavior({
126
+ '&:focus ~ div:first-of-type': __assign(__assign({}, focusRing({
127
+ width: 0,
128
+ outerColor: variant === 'inverse' ? colors.frenchVanilla100 : themeFocusOutline,
129
+ })), { borderWidth: '1px', borderColor: checked
130
+ ? variant === 'inverse'
131
+ ? colors.soap300
132
+ : themePrimary.main
133
+ : inputColors.border }),
109
134
  '&:focus:hover ~ div:first-of-type, &:focus:active ~ div:first-of-type': {
110
- borderColor: checked ? themePrimary.main : inputColors.hoverBorder,
135
+ borderColor: checked
136
+ ? variant === 'inverse'
137
+ ? colors.soap300
138
+ : themePrimary.main
139
+ : variant === 'inverse'
140
+ ? colors.soap300
141
+ : inputColors.hoverBorder,
111
142
  },
112
143
  })));
113
144
  });
@@ -127,18 +158,25 @@ var RadioBackground = styled('div')({
127
158
  transition: 'border 200ms ease, background 200ms',
128
159
  width: radioWidth,
129
160
  }, function (_a) {
130
- var checked = _a.checked, disabled = _a.disabled, themePrimary = _a.theme.canvas.palette.primary;
161
+ var checked = _a.checked, disabled = _a.disabled, variant = _a.variant, themePrimary = _a.theme.canvas.palette.primary;
131
162
  return ({
132
163
  borderColor: checked
133
- ? themePrimary.main
164
+ ? variant === 'inverse'
165
+ ? colors.soap300
166
+ : themePrimary.main
134
167
  : disabled
135
168
  ? inputColors.disabled.border
136
- : inputColors.border,
169
+ : variant === 'inverse'
170
+ ? colors.soap300
171
+ : inputColors.border,
137
172
  backgroundColor: checked
138
- ? themePrimary.main
173
+ ? variant === 'inverse'
174
+ ? colors.frenchVanilla100
175
+ : themePrimary.main
139
176
  : disabled
140
177
  ? inputColors.disabled.background
141
178
  : 'white',
179
+ opacity: disabled && variant === 'inverse' ? '.4' : '1',
142
180
  });
143
181
  });
144
182
  var RadioCheck = styled('div')({
@@ -150,9 +188,11 @@ var RadioCheck = styled('div')({
150
188
  transition: 'transform 200ms ease, opacity 200ms ease',
151
189
  width: radioDot,
152
190
  }, function (_a) {
153
- var theme = _a.theme;
191
+ var theme = _a.theme, variant = _a.variant;
154
192
  return ({
155
- backgroundColor: theme.canvas.palette.primary.contrast,
193
+ backgroundColor: variant === 'inverse'
194
+ ? theme.canvas.palette.primary.main
195
+ : theme.canvas.palette.primary.contrast,
156
196
  });
157
197
  }, function (_a) {
158
198
  var checked = _a.checked;
@@ -162,21 +202,29 @@ var RadioCheck = styled('div')({
162
202
  });
163
203
  });
164
204
  var RadioLabel = styled('label')(__assign(__assign({}, canvas.type.levels.subtext.large), { paddingLeft: radioLabelDistance }), function (_a) {
165
- var disabled = _a.disabled;
166
- return (disabled ? { color: inputColors.disabled.text } : { cursor: 'pointer' });
205
+ var variant = _a.variant;
206
+ return (variant === 'inverse' ? { color: colors.frenchVanilla100 } : undefined);
207
+ }, function (_a) {
208
+ var disabled = _a.disabled, variant = _a.variant;
209
+ return disabled
210
+ ? {
211
+ color: variant === 'inverse' ? colors.frenchVanilla100 : inputColors.disabled.text,
212
+ opacity: variant === 'inverse' ? '.4' : '1',
213
+ }
214
+ : { cursor: 'pointer' };
167
215
  });
168
216
  export var Radio = createComponent('input')({
169
217
  displayName: 'Radio',
170
218
  Component: function (_a, ref, Element) {
171
- 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"]);
219
+ 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"]);
172
220
  var inputId = useUniqueId(id);
173
221
  return (React.createElement(RadioContainer, null,
174
222
  React.createElement(RadioInputWrapper, { disabled: disabled },
175
- 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)),
176
- React.createElement(RadioRipple, null),
177
- React.createElement(RadioBackground, { checked: checked, disabled: disabled },
178
- React.createElement(RadioCheck, { checked: checked }))),
179
- label && (React.createElement(RadioLabel, { htmlFor: inputId, disabled: disabled }, label))));
223
+ 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)),
224
+ React.createElement(RadioRipple, { variant: variant }),
225
+ React.createElement(RadioBackground, { checked: checked, disabled: disabled, variant: variant },
226
+ React.createElement(RadioCheck, { checked: checked, variant: variant }))),
227
+ label && (React.createElement(RadioLabel, { htmlFor: inputId, disabled: disabled, variant: variant }, label))));
180
228
  },
181
229
  });
182
230
  export default Radio;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-react",
3
- "version": "7.0.4",
3
+ "version": "7.0.7",
4
4
  "description": "The parent module that contains all Workday Canvas Kit React components",
5
5
  "author": "Workday, Inc. (https://www.workday.com)",
6
6
  "license": "Apache-2.0",
@@ -48,9 +48,9 @@
48
48
  "@emotion/styled": "^11.6.0",
49
49
  "@popperjs/core": "^2.5.4",
50
50
  "@workday/canvas-colors-web": "^2.0.0",
51
- "@workday/canvas-kit-labs-react": "^7.0.4",
52
- "@workday/canvas-kit-popup-stack": "^7.0.4",
53
- "@workday/canvas-kit-preview-react": "^7.0.4",
51
+ "@workday/canvas-kit-labs-react": "^7.0.7",
52
+ "@workday/canvas-kit-popup-stack": "^7.0.7",
53
+ "@workday/canvas-kit-preview-react": "^7.0.7",
54
54
  "@workday/canvas-system-icons-web": "^3.0.0",
55
55
  "@workday/design-assets-types": "^0.2.4",
56
56
  "chroma-js": "^2.1.0",
@@ -69,5 +69,5 @@
69
69
  "@workday/canvas-accent-icons-web": "^3.0.0",
70
70
  "@workday/canvas-applet-icons-web": "^2.0.0"
71
71
  },
72
- "gitHead": "27b39e0bc853b84f6d1abe7b1872cb4c4f816881"
72
+ "gitHead": "ea3eafb31497479dd35c38da2170cfab8ec7bcf9"
73
73
  }