@atlaskit/checkbox 12.4.0 → 12.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/codemods/utils.tsx +187 -185
- package/dist/cjs/checkbox.js +3 -2
- package/dist/cjs/internal/label.js +7 -4
- package/dist/cjs/internal/required-indicator.js +1 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/checkbox.js +3 -2
- package/dist/es2019/internal/label.js +7 -4
- package/dist/es2019/internal/required-indicator.js +1 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/checkbox.js +3 -2
- package/dist/esm/internal/label.js +7 -4
- package/dist/esm/internal/required-indicator.js +1 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/internal/label.d.ts +1 -1
- package/package.json +6 -11
- package/report.api.md +28 -80
- package/dist/types-ts4.0/checkbox.d.ts +0 -12
- package/dist/types-ts4.0/index.d.ts +0 -2
- package/dist/types-ts4.0/internal/checkbox-icon.d.ts +0 -16
- package/dist/types-ts4.0/internal/constants.d.ts +0 -2
- package/dist/types-ts4.0/internal/index.d.ts +0 -4
- package/dist/types-ts4.0/internal/label-text.d.ts +0 -4
- package/dist/types-ts4.0/internal/label.d.ts +0 -4
- package/dist/types-ts4.0/internal/required-indicator.d.ts +0 -3
- package/dist/types-ts4.0/internal/theme.d.ts +0 -55
- package/dist/types-ts4.0/types.d.ts +0 -103
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/checkbox
|
|
2
2
|
|
|
3
|
+
## 12.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`ed1b0fd2c2d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ed1b0fd2c2d) - [ux] Removes redundant whitespace from checkbox when no visual label is applied - eg when an aria-label or id is used instead.
|
|
8
|
+
|
|
9
|
+
## 12.4.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 12.4.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/codemods/utils.tsx
CHANGED
|
@@ -222,94 +222,95 @@ export function addToImport({
|
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
export const createRenameFuncFor =
|
|
226
|
-
component: string,
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
to: string,
|
|
230
|
-
) => (j: core.JSCodeshift, source: Collection<Node>) => {
|
|
231
|
-
const specifier = getNamedSpecifier(j, source, component, importName);
|
|
225
|
+
export const createRenameFuncFor =
|
|
226
|
+
(component: string, importName: string, from: string, to: string) =>
|
|
227
|
+
(j: core.JSCodeshift, source: Collection<Node>) => {
|
|
228
|
+
const specifier = getNamedSpecifier(j, source, component, importName);
|
|
232
229
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
230
|
+
if (!specifier) {
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
236
233
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
234
|
+
source.findJSXElements(specifier).forEach((element) => {
|
|
235
|
+
getJSXAttributesByName(j, element, from).forEach((attribute) => {
|
|
236
|
+
j(attribute).replaceWith(
|
|
237
|
+
j.jsxAttribute(j.jsxIdentifier(to), attribute.node.value),
|
|
238
|
+
);
|
|
239
|
+
});
|
|
242
240
|
});
|
|
243
|
-
});
|
|
244
241
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
242
|
+
let variable = hasVariableAssignment(j, source, specifier);
|
|
243
|
+
if (variable) {
|
|
244
|
+
variable.find(j.VariableDeclarator).forEach((declarator) => {
|
|
245
|
+
j(declarator)
|
|
246
|
+
.find(j.Identifier)
|
|
247
|
+
.filter((identifier) => identifier.name === 'id')
|
|
248
|
+
.forEach((ids) => {
|
|
249
|
+
findIdentifierAndReplaceAttribute(
|
|
250
|
+
j,
|
|
251
|
+
source,
|
|
252
|
+
ids.node.name,
|
|
253
|
+
from,
|
|
254
|
+
to,
|
|
255
|
+
);
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
};
|
|
257
260
|
|
|
258
|
-
export const createRemoveFuncFor =
|
|
259
|
-
component: string,
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
comment?: string,
|
|
263
|
-
) => (j: core.JSCodeshift, source: Collection<Node>) => {
|
|
264
|
-
const specifier = getNamedSpecifier(j, source, component, importName);
|
|
261
|
+
export const createRemoveFuncFor =
|
|
262
|
+
(component: string, importName: string, prop: string, comment?: string) =>
|
|
263
|
+
(j: core.JSCodeshift, source: Collection<Node>) => {
|
|
264
|
+
const specifier = getNamedSpecifier(j, source, component, importName);
|
|
265
265
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
266
|
+
if (!specifier) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
269
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
270
|
+
source.findJSXElements(specifier).forEach((element) => {
|
|
271
|
+
getJSXAttributesByName(j, element, prop).forEach((attribute) => {
|
|
272
|
+
j(attribute).remove();
|
|
273
|
+
if (comment) {
|
|
274
|
+
addCommentToStartOfFile({ j, base: source, message: comment });
|
|
275
|
+
}
|
|
276
|
+
});
|
|
276
277
|
});
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
}: {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
}) =>
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
(
|
|
299
|
-
specifier
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
export const createRenameImportFor =
|
|
281
|
+
({
|
|
282
|
+
componentName,
|
|
283
|
+
newComponentName,
|
|
284
|
+
oldPackagePath,
|
|
285
|
+
newPackagePath,
|
|
286
|
+
}: {
|
|
287
|
+
componentName: string;
|
|
288
|
+
newComponentName?: string;
|
|
289
|
+
oldPackagePath: string;
|
|
290
|
+
newPackagePath: string;
|
|
291
|
+
}) =>
|
|
292
|
+
(j: core.JSCodeshift, source: Collection<Node>) => {
|
|
293
|
+
const isUsingName: boolean =
|
|
294
|
+
source
|
|
295
|
+
.find(j.ImportDeclaration)
|
|
296
|
+
.filter((path) => path.node.source.value === oldPackagePath)
|
|
297
|
+
.find(j.ImportSpecifier)
|
|
298
|
+
.nodes()
|
|
299
|
+
.filter(
|
|
300
|
+
(specifier) =>
|
|
301
|
+
specifier.imported && specifier.imported.name === componentName,
|
|
302
|
+
).length > 0;
|
|
303
|
+
if (!isUsingName) {
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
304
306
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
(specifier): Nullable<string> => {
|
|
307
|
+
const existingAlias: Nullable<string> =
|
|
308
|
+
source
|
|
309
|
+
.find(j.ImportDeclaration)
|
|
310
|
+
.filter((path) => path.node.source.value === oldPackagePath)
|
|
311
|
+
.find(j.ImportSpecifier)
|
|
312
|
+
.nodes()
|
|
313
|
+
.map((specifier): Nullable<string> => {
|
|
313
314
|
if (specifier.imported && specifier.imported.name !== componentName) {
|
|
314
315
|
return null;
|
|
315
316
|
}
|
|
@@ -319,81 +320,81 @@ export const createRenameImportFor = ({
|
|
|
319
320
|
}
|
|
320
321
|
|
|
321
322
|
return null;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
|
|
323
|
+
})
|
|
324
|
+
.filter(Boolean)[0] || null;
|
|
325
|
+
|
|
326
|
+
// Check to see if need to create new package path
|
|
327
|
+
// Try create an import declaration just before the old import
|
|
328
|
+
tryCreateImport({
|
|
329
|
+
j,
|
|
330
|
+
base: source,
|
|
331
|
+
relativeToPackage: oldPackagePath,
|
|
332
|
+
packageName: newPackagePath,
|
|
333
|
+
});
|
|
325
334
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
335
|
+
const newSpecifier: ImportSpecifier | ImportDefaultSpecifier = (() => {
|
|
336
|
+
// If there's a new name use that
|
|
337
|
+
if (newComponentName) {
|
|
338
|
+
return j.importSpecifier(
|
|
339
|
+
j.identifier(newComponentName),
|
|
340
|
+
j.identifier(newComponentName),
|
|
341
|
+
);
|
|
342
|
+
}
|
|
334
343
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
);
|
|
342
|
-
}
|
|
344
|
+
if (existingAlias) {
|
|
345
|
+
return j.importSpecifier(
|
|
346
|
+
j.identifier(componentName),
|
|
347
|
+
j.identifier(existingAlias),
|
|
348
|
+
);
|
|
349
|
+
}
|
|
343
350
|
|
|
344
|
-
|
|
351
|
+
// Add specifier
|
|
345
352
|
return j.importSpecifier(
|
|
346
353
|
j.identifier(componentName),
|
|
347
|
-
j.identifier(
|
|
354
|
+
j.identifier(componentName),
|
|
348
355
|
);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
// Add specifier
|
|
352
|
-
return j.importSpecifier(
|
|
353
|
-
j.identifier(componentName),
|
|
354
|
-
j.identifier(componentName),
|
|
355
|
-
);
|
|
356
|
-
})();
|
|
356
|
+
})();
|
|
357
357
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
358
|
+
addToImport({
|
|
359
|
+
j,
|
|
360
|
+
base: source,
|
|
361
|
+
importSpecifier: newSpecifier,
|
|
362
|
+
packageName: newPackagePath,
|
|
363
|
+
});
|
|
364
364
|
|
|
365
|
-
|
|
366
|
-
source
|
|
367
|
-
.find(j.ImportDeclaration)
|
|
368
|
-
.filter((path) => path.node.source.value === oldPackagePath)
|
|
369
|
-
.remove();
|
|
370
|
-
};
|
|
371
|
-
|
|
372
|
-
export const createRemoveImportsFor = ({
|
|
373
|
-
importsToRemove,
|
|
374
|
-
packagePath,
|
|
375
|
-
comment,
|
|
376
|
-
}: {
|
|
377
|
-
importsToRemove: string[];
|
|
378
|
-
packagePath: string;
|
|
379
|
-
comment: string;
|
|
380
|
-
}) => (j: core.JSCodeshift, source: Collection<Node>) => {
|
|
381
|
-
const isUsingName: boolean =
|
|
365
|
+
// Remove old path
|
|
382
366
|
source
|
|
383
367
|
.find(j.ImportDeclaration)
|
|
384
|
-
.filter((path) => path.node.source.value ===
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
368
|
+
.filter((path) => path.node.source.value === oldPackagePath)
|
|
369
|
+
.remove();
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
export const createRemoveImportsFor =
|
|
373
|
+
({
|
|
374
|
+
importsToRemove,
|
|
375
|
+
packagePath,
|
|
376
|
+
comment,
|
|
377
|
+
}: {
|
|
378
|
+
importsToRemove: string[];
|
|
379
|
+
packagePath: string;
|
|
380
|
+
comment: string;
|
|
381
|
+
}) =>
|
|
382
|
+
(j: core.JSCodeshift, source: Collection<Node>) => {
|
|
383
|
+
const isUsingName: boolean =
|
|
384
|
+
source
|
|
385
|
+
.find(j.ImportDeclaration)
|
|
386
|
+
.filter((path) => path.node.source.value === packagePath).length > 0;
|
|
387
|
+
if (!isUsingName) {
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
388
390
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
(specifier): Nullable<string> => {
|
|
391
|
+
const existingAlias: Nullable<string> =
|
|
392
|
+
source
|
|
393
|
+
.find(j.ImportDeclaration)
|
|
394
|
+
.filter((path) => path.node.source.value === packagePath)
|
|
395
|
+
.find(j.ImportSpecifier)
|
|
396
|
+
.nodes()
|
|
397
|
+
.map((specifier): Nullable<string> => {
|
|
397
398
|
if (!importsToRemove.includes(specifier.imported.name)) {
|
|
398
399
|
return null;
|
|
399
400
|
}
|
|
@@ -406,54 +407,55 @@ export const createRemoveImportsFor = ({
|
|
|
406
407
|
}
|
|
407
408
|
|
|
408
409
|
return null;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
.filter(Boolean)[0] || null;
|
|
412
|
-
|
|
413
|
-
// Remove imports
|
|
414
|
-
source
|
|
415
|
-
.find(j.ImportDeclaration)
|
|
416
|
-
.filter((path) => path.node.source.value === packagePath)
|
|
417
|
-
.find(j.ImportSpecifier)
|
|
418
|
-
.find(j.Identifier)
|
|
419
|
-
.filter((identifier) => {
|
|
420
|
-
if (
|
|
421
|
-
importsToRemove.includes(identifier.value.name) ||
|
|
422
|
-
identifier.value.name === existingAlias
|
|
423
|
-
) {
|
|
424
|
-
addCommentToStartOfFile({ j, base: source, message: comment });
|
|
425
|
-
return true;
|
|
426
|
-
}
|
|
427
|
-
return false;
|
|
428
|
-
})
|
|
429
|
-
.remove();
|
|
410
|
+
})
|
|
411
|
+
.filter(Boolean)[0] || null;
|
|
430
412
|
|
|
431
|
-
|
|
432
|
-
const isEmptyImport =
|
|
413
|
+
// Remove imports
|
|
433
414
|
source
|
|
434
415
|
.find(j.ImportDeclaration)
|
|
435
416
|
.filter((path) => path.node.source.value === packagePath)
|
|
436
417
|
.find(j.ImportSpecifier)
|
|
437
|
-
.find(j.Identifier)
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
418
|
+
.find(j.Identifier)
|
|
419
|
+
.filter((identifier) => {
|
|
420
|
+
if (
|
|
421
|
+
importsToRemove.includes(identifier.value.name) ||
|
|
422
|
+
identifier.value.name === existingAlias
|
|
423
|
+
) {
|
|
424
|
+
addCommentToStartOfFile({ j, base: source, message: comment });
|
|
425
|
+
return true;
|
|
426
|
+
}
|
|
427
|
+
return false;
|
|
428
|
+
})
|
|
442
429
|
.remove();
|
|
443
|
-
}
|
|
444
|
-
};
|
|
445
430
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
431
|
+
// Remove entire import if it is empty
|
|
432
|
+
const isEmptyImport =
|
|
433
|
+
source
|
|
434
|
+
.find(j.ImportDeclaration)
|
|
435
|
+
.filter((path) => path.node.source.value === packagePath)
|
|
436
|
+
.find(j.ImportSpecifier)
|
|
437
|
+
.find(j.Identifier).length === 0;
|
|
438
|
+
if (isEmptyImport) {
|
|
439
|
+
source
|
|
440
|
+
.find(j.ImportDeclaration)
|
|
441
|
+
.filter((path) => path.node.source.value === packagePath)
|
|
442
|
+
.remove();
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
export const createTransformer =
|
|
447
|
+
(
|
|
448
|
+
component: string,
|
|
449
|
+
migrates: { (j: core.JSCodeshift, source: Collection<Node>): void }[],
|
|
450
|
+
) =>
|
|
451
|
+
(fileInfo: FileInfo, { jscodeshift: j }: API, options: Options) => {
|
|
452
|
+
const source: Collection<Node> = j(fileInfo.source);
|
|
453
|
+
|
|
454
|
+
if (!hasImportDeclaration(j, source, component)) {
|
|
455
|
+
return fileInfo.source;
|
|
456
|
+
}
|
|
455
457
|
|
|
456
|
-
|
|
458
|
+
migrates.forEach((tf) => tf(j, source));
|
|
457
459
|
|
|
458
|
-
|
|
459
|
-
};
|
|
460
|
+
return source.toSource(options.printOptions || { quote: 'single' });
|
|
461
|
+
};
|
package/dist/cjs/checkbox.js
CHANGED
|
@@ -29,7 +29,7 @@ var _excluded = ["isChecked", "isDisabled", "isInvalid", "defaultChecked", "isIn
|
|
|
29
29
|
var checkboxStyles = (0, _react2.css)({
|
|
30
30
|
width: '100%',
|
|
31
31
|
height: '100%',
|
|
32
|
-
margin: 0,
|
|
32
|
+
margin: "var(--ds-space-0, 0px)",
|
|
33
33
|
appearance: 'none',
|
|
34
34
|
border: 'none',
|
|
35
35
|
gridArea: '1 / 1 / 2 / 2',
|
|
@@ -174,7 +174,7 @@ var Checkbox = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
174
174
|
analyticsData: analyticsContext,
|
|
175
175
|
componentName: 'checkbox',
|
|
176
176
|
packageName: "@atlaskit/checkbox",
|
|
177
|
-
packageVersion: "12.4.
|
|
177
|
+
packageVersion: "12.4.2"
|
|
178
178
|
});
|
|
179
179
|
var internalRef = (0, _react.useRef)(null);
|
|
180
180
|
var mergedRefs = (0, _mergeRefs.default)([internalRef, ref]); // Use isChecked from the state if it is controlled
|
|
@@ -182,6 +182,7 @@ var Checkbox = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef
|
|
|
182
182
|
var isChecked = isCheckedProp === undefined ? isCheckedState : isCheckedProp;
|
|
183
183
|
return (0, _react2.jsx)(_internal.Label, {
|
|
184
184
|
isDisabled: isDisabled,
|
|
185
|
+
label: label,
|
|
185
186
|
id: rest.id ? "".concat(rest.id, "-label") : undefined,
|
|
186
187
|
testId: testId && "".concat(testId, "--checkbox-label")
|
|
187
188
|
}, (0, _react2.jsx)("input", (0, _extends2.default)({}, rest, {
|
|
@@ -20,13 +20,15 @@ var _theme = _interopRequireDefault(require("./theme"));
|
|
|
20
20
|
/** @jsx jsx */
|
|
21
21
|
var labelStyles = (0, _react.css)({
|
|
22
22
|
display: 'grid',
|
|
23
|
-
gap: '0 4px',
|
|
24
23
|
gridAutoColumns: '1fr',
|
|
25
24
|
gridAutoRows: 'min-content',
|
|
26
|
-
gridTemplateColumns: 'min-content auto',
|
|
27
25
|
color: "var(--ds-text, ".concat(_colors.N900, ")"),
|
|
28
26
|
cursor: 'default',
|
|
29
|
-
fontFamily: _constants.fontFamily
|
|
27
|
+
fontFamily: "var(--ds-font-family-sans, ".concat(_constants.fontFamily, ")")
|
|
28
|
+
});
|
|
29
|
+
var textLabelLayoutStyles = (0, _react.css)({
|
|
30
|
+
gap: "var(--ds-space-0, 0px)".concat(" ", "var(--ds-space-050, 4px)"),
|
|
31
|
+
gridTemplateColumns: 'min-content auto'
|
|
30
32
|
});
|
|
31
33
|
var disabledStyles = (0, _react.css)({
|
|
32
34
|
color: "var(--ds-text-disabled, ".concat(_colors.N80, ")"),
|
|
@@ -104,6 +106,7 @@ function Label(_ref) {
|
|
|
104
106
|
isDisabled = _ref.isDisabled,
|
|
105
107
|
testId = _ref.testId,
|
|
106
108
|
onClick = _ref.onClick,
|
|
109
|
+
label = _ref.label,
|
|
107
110
|
id = _ref.id;
|
|
108
111
|
|
|
109
112
|
var _useGlobalTheme = (0, _components.useGlobalTheme)(),
|
|
@@ -111,7 +114,7 @@ function Label(_ref) {
|
|
|
111
114
|
|
|
112
115
|
return (// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
113
116
|
(0, _react.jsx)("label", {
|
|
114
|
-
css: [labelStyles, isDisabled && disabledStyles, mode === 'light' && themeStyles.light, mode === 'dark' && themeStyles.dark],
|
|
117
|
+
css: [labelStyles, label && textLabelLayoutStyles, isDisabled && disabledStyles, mode === 'light' && themeStyles.light, mode === 'dark' && themeStyles.dark],
|
|
115
118
|
"data-testid": testId,
|
|
116
119
|
"data-disabled": isDisabled || undefined,
|
|
117
120
|
onClick: onClick,
|
|
@@ -9,11 +9,9 @@ var _react = require("@emotion/react");
|
|
|
9
9
|
|
|
10
10
|
var _colors = require("@atlaskit/theme/colors");
|
|
11
11
|
|
|
12
|
-
var _constants = require("./constants");
|
|
13
|
-
|
|
14
12
|
/** @jsx jsx */
|
|
15
13
|
var requiredIndicatorStyles = (0, _react.css)({
|
|
16
|
-
paddingLeft:
|
|
14
|
+
paddingLeft: "var(--ds-space-025, 2px)",
|
|
17
15
|
color: "var(--ds-text-danger, ".concat(_colors.R500, ")")
|
|
18
16
|
});
|
|
19
17
|
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/checkbox.js
CHANGED
|
@@ -11,7 +11,7 @@ import { CheckboxIcon, Label, LabelText, RequiredIndicator } from './internal';
|
|
|
11
11
|
const checkboxStyles = css({
|
|
12
12
|
width: '100%',
|
|
13
13
|
height: '100%',
|
|
14
|
-
margin: 0,
|
|
14
|
+
margin: "var(--ds-space-0, 0px)",
|
|
15
15
|
appearance: 'none',
|
|
16
16
|
border: 'none',
|
|
17
17
|
gridArea: '1 / 1 / 2 / 2',
|
|
@@ -148,7 +148,7 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(pr
|
|
|
148
148
|
analyticsData: analyticsContext,
|
|
149
149
|
componentName: 'checkbox',
|
|
150
150
|
packageName: "@atlaskit/checkbox",
|
|
151
|
-
packageVersion: "12.4.
|
|
151
|
+
packageVersion: "12.4.2"
|
|
152
152
|
});
|
|
153
153
|
const internalRef = useRef(null);
|
|
154
154
|
const mergedRefs = mergeRefs([internalRef, ref]); // Use isChecked from the state if it is controlled
|
|
@@ -156,6 +156,7 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(pr
|
|
|
156
156
|
const isChecked = isCheckedProp === undefined ? isCheckedState : isCheckedProp;
|
|
157
157
|
return jsx(Label, {
|
|
158
158
|
isDisabled: isDisabled,
|
|
159
|
+
label: label,
|
|
159
160
|
id: rest.id ? `${rest.id}-label` : undefined,
|
|
160
161
|
testId: testId && `${testId}--checkbox-label`
|
|
161
162
|
}, jsx("input", _extends({}, rest, {
|
|
@@ -6,13 +6,15 @@ import { fontFamily } from './constants';
|
|
|
6
6
|
import theme from './theme';
|
|
7
7
|
const labelStyles = css({
|
|
8
8
|
display: 'grid',
|
|
9
|
-
gap: '0 4px',
|
|
10
9
|
gridAutoColumns: '1fr',
|
|
11
10
|
gridAutoRows: 'min-content',
|
|
12
|
-
gridTemplateColumns: 'min-content auto',
|
|
13
11
|
color: `var(--ds-text, ${N900})`,
|
|
14
12
|
cursor: 'default',
|
|
15
|
-
fontFamily: fontFamily
|
|
13
|
+
fontFamily: `var(--ds-font-family-sans, ${fontFamily})`
|
|
14
|
+
});
|
|
15
|
+
const textLabelLayoutStyles = css({
|
|
16
|
+
gap: `${"var(--ds-space-0, 0px)"} ${"var(--ds-space-050, 4px)"}`,
|
|
17
|
+
gridTemplateColumns: 'min-content auto'
|
|
16
18
|
});
|
|
17
19
|
const disabledStyles = css({
|
|
18
20
|
color: `var(--ds-text-disabled, ${N80})`,
|
|
@@ -89,6 +91,7 @@ export default function Label({
|
|
|
89
91
|
isDisabled,
|
|
90
92
|
testId,
|
|
91
93
|
onClick,
|
|
94
|
+
label,
|
|
92
95
|
id
|
|
93
96
|
}) {
|
|
94
97
|
const {
|
|
@@ -96,7 +99,7 @@ export default function Label({
|
|
|
96
99
|
} = useGlobalTheme();
|
|
97
100
|
return (// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
98
101
|
jsx("label", {
|
|
99
|
-
css: [labelStyles, isDisabled && disabledStyles, mode === 'light' && themeStyles.light, mode === 'dark' && themeStyles.dark],
|
|
102
|
+
css: [labelStyles, label && textLabelLayoutStyles, isDisabled && disabledStyles, mode === 'light' && themeStyles.light, mode === 'dark' && themeStyles.dark],
|
|
100
103
|
"data-testid": testId,
|
|
101
104
|
"data-disabled": isDisabled || undefined,
|
|
102
105
|
onClick: onClick,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { css, jsx } from '@emotion/react';
|
|
3
3
|
import { R500 } from '@atlaskit/theme/colors';
|
|
4
|
-
import { gridSize } from './constants';
|
|
5
4
|
const requiredIndicatorStyles = css({
|
|
6
|
-
paddingLeft:
|
|
5
|
+
paddingLeft: "var(--ds-space-025, 2px)",
|
|
7
6
|
color: `var(--ds-text-danger, ${R500})`
|
|
8
7
|
});
|
|
9
8
|
export default function RequiredIndicator() {
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/checkbox.js
CHANGED
|
@@ -14,7 +14,7 @@ import { CheckboxIcon, Label, LabelText, RequiredIndicator } from './internal';
|
|
|
14
14
|
var checkboxStyles = css({
|
|
15
15
|
width: '100%',
|
|
16
16
|
height: '100%',
|
|
17
|
-
margin: 0,
|
|
17
|
+
margin: "var(--ds-space-0, 0px)",
|
|
18
18
|
appearance: 'none',
|
|
19
19
|
border: 'none',
|
|
20
20
|
gridArea: '1 / 1 / 2 / 2',
|
|
@@ -159,7 +159,7 @@ var Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(prop
|
|
|
159
159
|
analyticsData: analyticsContext,
|
|
160
160
|
componentName: 'checkbox',
|
|
161
161
|
packageName: "@atlaskit/checkbox",
|
|
162
|
-
packageVersion: "12.4.
|
|
162
|
+
packageVersion: "12.4.2"
|
|
163
163
|
});
|
|
164
164
|
var internalRef = useRef(null);
|
|
165
165
|
var mergedRefs = mergeRefs([internalRef, ref]); // Use isChecked from the state if it is controlled
|
|
@@ -167,6 +167,7 @@ var Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Checkbox(prop
|
|
|
167
167
|
var isChecked = isCheckedProp === undefined ? isCheckedState : isCheckedProp;
|
|
168
168
|
return jsx(Label, {
|
|
169
169
|
isDisabled: isDisabled,
|
|
170
|
+
label: label,
|
|
170
171
|
id: rest.id ? "".concat(rest.id, "-label") : undefined,
|
|
171
172
|
testId: testId && "".concat(testId, "--checkbox-label")
|
|
172
173
|
}, jsx("input", _extends({}, rest, {
|
|
@@ -6,13 +6,15 @@ import { fontFamily } from './constants';
|
|
|
6
6
|
import theme from './theme';
|
|
7
7
|
var labelStyles = css({
|
|
8
8
|
display: 'grid',
|
|
9
|
-
gap: '0 4px',
|
|
10
9
|
gridAutoColumns: '1fr',
|
|
11
10
|
gridAutoRows: 'min-content',
|
|
12
|
-
gridTemplateColumns: 'min-content auto',
|
|
13
11
|
color: "var(--ds-text, ".concat(N900, ")"),
|
|
14
12
|
cursor: 'default',
|
|
15
|
-
fontFamily: fontFamily
|
|
13
|
+
fontFamily: "var(--ds-font-family-sans, ".concat(fontFamily, ")")
|
|
14
|
+
});
|
|
15
|
+
var textLabelLayoutStyles = css({
|
|
16
|
+
gap: "var(--ds-space-0, 0px)".concat(" ", "var(--ds-space-050, 4px)"),
|
|
17
|
+
gridTemplateColumns: 'min-content auto'
|
|
16
18
|
});
|
|
17
19
|
var disabledStyles = css({
|
|
18
20
|
color: "var(--ds-text-disabled, ".concat(N80, ")"),
|
|
@@ -89,6 +91,7 @@ export default function Label(_ref) {
|
|
|
89
91
|
isDisabled = _ref.isDisabled,
|
|
90
92
|
testId = _ref.testId,
|
|
91
93
|
onClick = _ref.onClick,
|
|
94
|
+
label = _ref.label,
|
|
92
95
|
id = _ref.id;
|
|
93
96
|
|
|
94
97
|
var _useGlobalTheme = useGlobalTheme(),
|
|
@@ -96,7 +99,7 @@ export default function Label(_ref) {
|
|
|
96
99
|
|
|
97
100
|
return (// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
98
101
|
jsx("label", {
|
|
99
|
-
css: [labelStyles, isDisabled && disabledStyles, mode === 'light' && themeStyles.light, mode === 'dark' && themeStyles.dark],
|
|
102
|
+
css: [labelStyles, label && textLabelLayoutStyles, isDisabled && disabledStyles, mode === 'light' && themeStyles.light, mode === 'dark' && themeStyles.dark],
|
|
100
103
|
"data-testid": testId,
|
|
101
104
|
"data-disabled": isDisabled || undefined,
|
|
102
105
|
onClick: onClick,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { css, jsx } from '@emotion/react';
|
|
3
3
|
import { R500 } from '@atlaskit/theme/colors';
|
|
4
|
-
import { gridSize } from './constants';
|
|
5
4
|
var requiredIndicatorStyles = css({
|
|
6
|
-
paddingLeft:
|
|
5
|
+
paddingLeft: "var(--ds-space-025, 2px)",
|
|
7
6
|
color: "var(--ds-text-danger, ".concat(R500, ")")
|
|
8
7
|
});
|
|
9
8
|
export default function RequiredIndicator() {
|
package/dist/esm/version.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
3
|
import { LabelProps } from '../types';
|
|
4
|
-
export default function Label({ children, isDisabled, testId, onClick, id, }: LabelProps): jsx.JSX.Element;
|
|
4
|
+
export default function Label({ children, isDisabled, testId, onClick, label, id, }: LabelProps): jsx.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/checkbox",
|
|
3
|
-
"version": "12.4.
|
|
3
|
+
"version": "12.4.2",
|
|
4
4
|
"description": "A checkbox is an input control that allows a user to select one or more options from a number of choices.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -12,16 +12,10 @@
|
|
|
12
12
|
"module": "dist/esm/index.js",
|
|
13
13
|
"module:es2019": "dist/es2019/index.js",
|
|
14
14
|
"types": "dist/types/index.d.ts",
|
|
15
|
-
"typesVersions": {
|
|
16
|
-
">=4.0 <4.5": {
|
|
17
|
-
"*": [
|
|
18
|
-
"dist/types-ts4.0/*"
|
|
19
|
-
]
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
15
|
"sideEffects": false,
|
|
23
16
|
"atlaskit:src": "src/index.tsx",
|
|
24
17
|
"atlassian": {
|
|
18
|
+
"disableProductCI": true,
|
|
25
19
|
"team": "Design System Team",
|
|
26
20
|
"releaseModel": "scheduled",
|
|
27
21
|
"website": {
|
|
@@ -37,7 +31,7 @@
|
|
|
37
31
|
"@atlaskit/ds-lib": "^2.1.0",
|
|
38
32
|
"@atlaskit/icon": "^21.11.0",
|
|
39
33
|
"@atlaskit/theme": "^12.2.0",
|
|
40
|
-
"@atlaskit/tokens": "^0.
|
|
34
|
+
"@atlaskit/tokens": "^0.11.0",
|
|
41
35
|
"@babel/runtime": "^7.0.0",
|
|
42
36
|
"@emotion/react": "^11.7.1"
|
|
43
37
|
},
|
|
@@ -45,9 +39,9 @@
|
|
|
45
39
|
"react": "^16.8.0"
|
|
46
40
|
},
|
|
47
41
|
"devDependencies": {
|
|
48
|
-
"@atlaskit/button": "^16.
|
|
42
|
+
"@atlaskit/button": "^16.4.0",
|
|
49
43
|
"@atlaskit/docs": "*",
|
|
50
|
-
"@atlaskit/form": "^8.
|
|
44
|
+
"@atlaskit/form": "^8.7.0",
|
|
51
45
|
"@atlaskit/section-message": "^6.3.0",
|
|
52
46
|
"@atlaskit/ssr": "*",
|
|
53
47
|
"@atlaskit/toggle": "^12.5.0",
|
|
@@ -76,6 +70,7 @@
|
|
|
76
70
|
"ui-components": "lite-mode",
|
|
77
71
|
"analytics": "analytics-next",
|
|
78
72
|
"theming": "tokens",
|
|
73
|
+
"design-tokens": "spacing",
|
|
79
74
|
"deprecation": "no-deprecated-imports",
|
|
80
75
|
"styling": [
|
|
81
76
|
"emotion",
|
package/report.api.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
## API Report File for "@atlaskit/checkbox"
|
|
1
|
+
## API Report File for "@atlaskit/checkbox"
|
|
2
2
|
|
|
3
|
-
> Do not edit this file.
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
<!--
|
|
6
|
+
Generated API Report version: 2.0
|
|
7
|
+
-->
|
|
4
8
|
|
|
5
9
|
[Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
6
10
|
|
|
@@ -14,30 +18,25 @@ import { default as React_2 } from 'react';
|
|
|
14
18
|
import { RefAttributes } from 'react';
|
|
15
19
|
import type UIAnalyticsEvent from '@atlaskit/analytics-next/UIAnalyticsEvent';
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
* A checkbox an input control that allows a user to select one or more options from a number of choices.
|
|
21
|
-
*
|
|
22
|
-
* - [Examples](https://atlassian.design/components/checkbox/examples)
|
|
23
|
-
* - [Code](https://atlassian.design/components/checkbox/code)
|
|
24
|
-
* - [Usage](https://atlassian.design/components/checkbox/usage)
|
|
25
|
-
*/
|
|
26
|
-
declare const Checkbox: MemoExoticComponent<ForwardRefExoticComponent<
|
|
27
|
-
Omit<
|
|
21
|
+
// @public
|
|
22
|
+
const Checkbox: MemoExoticComponent<
|
|
23
|
+
ForwardRefExoticComponent<
|
|
28
24
|
Omit<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
Omit<
|
|
26
|
+
InputHTMLAttributes<HTMLInputElement>,
|
|
27
|
+
'disabled' | 'required' | 'checked' | 'css'
|
|
28
|
+
>,
|
|
29
|
+
keyof OwnProps
|
|
30
|
+
> &
|
|
31
|
+
OwnProps &
|
|
32
|
+
RefAttributes<HTMLInputElement>
|
|
33
|
+
>
|
|
34
|
+
>;
|
|
37
35
|
export { Checkbox };
|
|
38
36
|
export default Checkbox;
|
|
39
37
|
|
|
40
|
-
|
|
38
|
+
// @public (undocumented)
|
|
39
|
+
export type CheckboxProps = Combine<
|
|
41
40
|
Omit<
|
|
42
41
|
React_2.InputHTMLAttributes<HTMLInputElement>,
|
|
43
42
|
/**
|
|
@@ -56,83 +55,32 @@ export declare type CheckboxProps = Combine<
|
|
|
56
55
|
OwnProps
|
|
57
56
|
>;
|
|
58
57
|
|
|
59
|
-
|
|
58
|
+
// @public (undocumented)
|
|
59
|
+
type Combine<First, Second> = Omit<First, keyof Second> & Second;
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
*
|
|
64
|
-
* CHECKBOX PROPTYPES
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*/
|
|
68
|
-
declare type OwnProps = {
|
|
69
|
-
/**
|
|
70
|
-
* Sets whether the checkbox begins checked.
|
|
71
|
-
*/
|
|
61
|
+
// @public
|
|
62
|
+
type OwnProps = {
|
|
72
63
|
defaultChecked?: boolean;
|
|
73
|
-
/**
|
|
74
|
-
* id assigned to input
|
|
75
|
-
*/
|
|
76
64
|
id?: string;
|
|
77
|
-
/**
|
|
78
|
-
* Sets whether the checkbox is checked or unchecked.
|
|
79
|
-
*/
|
|
80
65
|
isChecked?: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Sets whether the checkbox is disabled.
|
|
83
|
-
*/
|
|
84
66
|
isDisabled?: boolean;
|
|
85
|
-
/**
|
|
86
|
-
* Sets whether the checkbox is indeterminate. This only affects the
|
|
87
|
-
* style and does not modify the isChecked property.
|
|
88
|
-
*/
|
|
89
67
|
isIndeterminate?: boolean;
|
|
90
|
-
/**
|
|
91
|
-
* Marks the field as invalid. Changes style of unchecked component.
|
|
92
|
-
*/
|
|
93
68
|
isInvalid?: boolean;
|
|
94
|
-
/**
|
|
95
|
-
* Marks the field as required & changes the label style.
|
|
96
|
-
*/
|
|
97
69
|
isRequired?: boolean;
|
|
98
|
-
/**
|
|
99
|
-
* The label to be displayed to the right of the checkbox. The label is part
|
|
100
|
-
* of the clickable element to select the checkbox.
|
|
101
|
-
*/
|
|
102
70
|
label?: React_2.ReactChild;
|
|
103
|
-
/**
|
|
104
|
-
* The name of the submitted field in a checkbox.
|
|
105
|
-
*/
|
|
106
71
|
name?: string;
|
|
107
|
-
/**
|
|
108
|
-
* Function that is called whenever the state of the checkbox changes. It will
|
|
109
|
-
* be called with an object containing the react synthetic event. Use currentTarget to get value, name and checked
|
|
110
|
-
*/
|
|
111
72
|
onChange?: (
|
|
112
73
|
e: React_2.ChangeEvent<HTMLInputElement>,
|
|
113
74
|
analyticsEvent: UIAnalyticsEvent,
|
|
114
75
|
) => void;
|
|
115
|
-
/**
|
|
116
|
-
* The value to be used in the checkbox input. This is the value that will be returned on form submission.
|
|
117
|
-
*/
|
|
118
76
|
value?: number | string;
|
|
119
|
-
/**
|
|
120
|
-
* The size of the Checkbox
|
|
121
|
-
*/
|
|
122
77
|
size?: Size;
|
|
123
|
-
/**
|
|
124
|
-
* A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
|
|
125
|
-
* we have generated testid based on the one you pass to the Checkbox component:
|
|
126
|
-
* - `{testId}--hidden-checkbox` to check if it got changed to checked/unchecked.
|
|
127
|
-
*/
|
|
128
78
|
testId?: string;
|
|
129
|
-
/**
|
|
130
|
-
* Additional information to be included in the `context` of analytics events that come from radio
|
|
131
|
-
*/
|
|
132
79
|
analyticsContext?: Record<string, any>;
|
|
133
80
|
};
|
|
134
81
|
|
|
135
|
-
|
|
82
|
+
// @public (undocumented)
|
|
83
|
+
type Size = 'small' | 'medium' | 'large' | 'xlarge';
|
|
136
84
|
|
|
137
|
-
|
|
85
|
+
// (No @packageDocumentation comment for this package)
|
|
138
86
|
```
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
/**
|
|
3
|
-
* __Checkbox__
|
|
4
|
-
*
|
|
5
|
-
* A checkbox an input control that allows a user to select one or more options from a number of choices.
|
|
6
|
-
*
|
|
7
|
-
* - [Examples](https://atlassian.design/components/checkbox/examples)
|
|
8
|
-
* - [Code](https://atlassian.design/components/checkbox/code)
|
|
9
|
-
* - [Usage](https://atlassian.design/components/checkbox/usage)
|
|
10
|
-
*/
|
|
11
|
-
declare const Checkbox: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "disabled" | "required" | "checked" | "css">, keyof import("./types").OwnProps> & import("./types").OwnProps & import("react").RefAttributes<HTMLInputElement>>>;
|
|
12
|
-
export default Checkbox;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import type { Size } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* __Checkbox icon__
|
|
5
|
-
*
|
|
6
|
-
* A checkbox icon is the visual representation of checkbox state,
|
|
7
|
-
* which is shown instead of the native input.
|
|
8
|
-
*
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
declare const CheckboxIcon: import("react").NamedExoticComponent<{
|
|
12
|
-
size: Size;
|
|
13
|
-
isIndeterminate: boolean;
|
|
14
|
-
isChecked: boolean;
|
|
15
|
-
}>;
|
|
16
|
-
export default CheckboxIcon;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
declare const theme: {
|
|
2
|
-
light: {
|
|
3
|
-
borderColor: {
|
|
4
|
-
rest: "var(--ds-border-input)";
|
|
5
|
-
hovered: "var(--ds-border-input)";
|
|
6
|
-
disabled: "var(--ds-background-disabled)";
|
|
7
|
-
checked: "var(--ds-background-selected-bold)";
|
|
8
|
-
active: "var(--ds-border)";
|
|
9
|
-
invalid: "var(--ds-border-danger)";
|
|
10
|
-
invalidAndChecked: "var(--ds-border-danger)";
|
|
11
|
-
focused: "var(--ds-border-focused)";
|
|
12
|
-
hoveredAndChecked: "var(--ds-background-selected-bold-hovered)";
|
|
13
|
-
};
|
|
14
|
-
boxColor: {
|
|
15
|
-
rest: "var(--ds-background-input)";
|
|
16
|
-
hovered: "var(--ds-background-input-hovered)";
|
|
17
|
-
disabled: "var(--ds-background-disabled)";
|
|
18
|
-
active: "var(--ds-background-input-pressed)";
|
|
19
|
-
hoveredAndChecked: "var(--ds-background-selected-bold-hovered)";
|
|
20
|
-
checked: "var(--ds-background-selected-bold)";
|
|
21
|
-
};
|
|
22
|
-
tickColor: {
|
|
23
|
-
disabledAndChecked: "var(--ds-icon-disabled)";
|
|
24
|
-
activeAndChecked: "var(--ds-icon-inverse)";
|
|
25
|
-
checked: "var(--ds-icon-inverse)";
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
dark: {
|
|
29
|
-
borderColor: {
|
|
30
|
-
rest: "var(--ds-border-input)";
|
|
31
|
-
hovered: "var(--ds-border-input)";
|
|
32
|
-
disabled: "var(--ds-background-disabled)";
|
|
33
|
-
checked: "var(--ds-background-selected-bold)";
|
|
34
|
-
active: "var(--ds-border)";
|
|
35
|
-
invalid: "var(--ds-border-danger)";
|
|
36
|
-
invalidAndChecked: "var(--ds-border-danger)";
|
|
37
|
-
focused: "var(--ds-border-focused)";
|
|
38
|
-
hoveredAndChecked: "var(--ds-background-selected-bold-hovered)";
|
|
39
|
-
};
|
|
40
|
-
boxColor: {
|
|
41
|
-
rest: "var(--ds-background-input)";
|
|
42
|
-
hovered: "var(--ds-background-input-hovered)";
|
|
43
|
-
disabled: "var(--ds-background-disabled)";
|
|
44
|
-
active: "var(--ds-background-input-pressed)";
|
|
45
|
-
hoveredAndChecked: "var(--ds-background-selected-bold-hovered)";
|
|
46
|
-
checked: "var(--ds-background-selected-bold)";
|
|
47
|
-
};
|
|
48
|
-
tickColor: {
|
|
49
|
-
disabledAndChecked: "var(--ds-icon-disabled)";
|
|
50
|
-
activeAndChecked: "var(--ds-icon-inverse)";
|
|
51
|
-
checked: "var(--ds-icon-inverse)";
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
export default theme;
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type UIAnalyticsEvent from '@atlaskit/analytics-next/UIAnalyticsEvent';
|
|
3
|
-
export declare type Size = 'small' | 'medium' | 'large' | 'xlarge';
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* CHECKBOX PROPTYPES
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*/
|
|
11
|
-
export declare type OwnProps = {
|
|
12
|
-
/**
|
|
13
|
-
* Sets whether the checkbox begins checked.
|
|
14
|
-
*/
|
|
15
|
-
defaultChecked?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* id assigned to input
|
|
18
|
-
*/
|
|
19
|
-
id?: string;
|
|
20
|
-
/**
|
|
21
|
-
* Sets whether the checkbox is checked or unchecked.
|
|
22
|
-
*/
|
|
23
|
-
isChecked?: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Sets whether the checkbox is disabled.
|
|
26
|
-
*/
|
|
27
|
-
isDisabled?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Sets whether the checkbox is indeterminate. This only affects the
|
|
30
|
-
* style and does not modify the isChecked property.
|
|
31
|
-
*/
|
|
32
|
-
isIndeterminate?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Marks the field as invalid. Changes style of unchecked component.
|
|
35
|
-
*/
|
|
36
|
-
isInvalid?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Marks the field as required & changes the label style.
|
|
39
|
-
*/
|
|
40
|
-
isRequired?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* The label to be displayed to the right of the checkbox. The label is part
|
|
43
|
-
* of the clickable element to select the checkbox.
|
|
44
|
-
*/
|
|
45
|
-
label?: React.ReactChild;
|
|
46
|
-
/**
|
|
47
|
-
* The name of the submitted field in a checkbox.
|
|
48
|
-
*/
|
|
49
|
-
name?: string;
|
|
50
|
-
/**
|
|
51
|
-
* Function that is called whenever the state of the checkbox changes. It will
|
|
52
|
-
* be called with an object containing the react synthetic event. Use currentTarget to get value, name and checked
|
|
53
|
-
*/
|
|
54
|
-
onChange?: (e: React.ChangeEvent<HTMLInputElement>, analyticsEvent: UIAnalyticsEvent) => void;
|
|
55
|
-
/**
|
|
56
|
-
* The value to be used in the checkbox input. This is the value that will be returned on form submission.
|
|
57
|
-
*/
|
|
58
|
-
value?: number | string;
|
|
59
|
-
/**
|
|
60
|
-
* The size of the Checkbox
|
|
61
|
-
*/
|
|
62
|
-
size?: Size;
|
|
63
|
-
/**
|
|
64
|
-
* A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
|
|
65
|
-
* we have generated testid based on the one you pass to the Checkbox component:
|
|
66
|
-
* - `{testId}--hidden-checkbox` to check if it got changed to checked/unchecked.
|
|
67
|
-
*/
|
|
68
|
-
testId?: string;
|
|
69
|
-
/**
|
|
70
|
-
* Additional information to be included in the `context` of analytics events that come from radio
|
|
71
|
-
*/
|
|
72
|
-
analyticsContext?: Record<string, any>;
|
|
73
|
-
};
|
|
74
|
-
declare type Combine<First, Second> = Omit<First, keyof Second> & Second;
|
|
75
|
-
export declare type CheckboxProps = Combine<Omit<React.InputHTMLAttributes<HTMLInputElement>,
|
|
76
|
-
/**
|
|
77
|
-
* 'disabled', 'required', and 'checked' are omitted so that
|
|
78
|
-
* consumers must handle state using our props.
|
|
79
|
-
*
|
|
80
|
-
* 'css' is added globally to element attributes by emotion.
|
|
81
|
-
* This was causing a bug, making the css prop required in
|
|
82
|
-
* some cases. We explicitly omit it to avoid that.
|
|
83
|
-
*
|
|
84
|
-
* Because 'className' (which the css prop uses internally)
|
|
85
|
-
* is still available, this should not break existing usage.
|
|
86
|
-
*/
|
|
87
|
-
'disabled' | 'required' | 'checked' | 'css'>, OwnProps>;
|
|
88
|
-
export interface LabelTextProps extends React.HTMLProps<HTMLSpanElement> {
|
|
89
|
-
children: React.ReactNode;
|
|
90
|
-
}
|
|
91
|
-
export interface LabelProps extends React.HTMLProps<HTMLInputElement> {
|
|
92
|
-
isDisabled?: boolean;
|
|
93
|
-
/**
|
|
94
|
-
* A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
|
|
95
|
-
*/
|
|
96
|
-
testId?: string;
|
|
97
|
-
/**
|
|
98
|
-
* Click handler that is conditionally applied for Firefox
|
|
99
|
-
* as Firefox does not dispatch modified click events (e.g. Ctrl+Click) down to the underlying input element
|
|
100
|
-
*/
|
|
101
|
-
onClick?: React.MouseEventHandler;
|
|
102
|
-
}
|
|
103
|
-
export {};
|