@atlaskit/checkbox 12.3.7 → 12.3.10
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 +19 -0
- package/codemods/{12.0.0-lite-mode.ts → 12.0.0-lite-mode.tsx} +1 -1
- package/codemods/__tests__/{12.0.0-lite-mode.ts → 12.0.0-lite-mode.tsx} +0 -0
- package/codemods/migrations/{remove-imports.ts → remove-imports.tsx} +0 -0
- package/codemods/migrations/{remove-props.ts → remove-props.tsx} +0 -0
- package/codemods/migrations/{rename-import.ts → rename-import.tsx} +0 -0
- package/codemods/migrations/{rename-inputRef-to-ref.ts → rename-input-ref-to-ref.tsx} +0 -0
- package/codemods/{utils.ts → utils.tsx} +0 -0
- package/dist/cjs/checkbox.js +120 -73
- package/dist/cjs/index.js +3 -7
- package/dist/cjs/internal/checkbox-icon.js +73 -0
- package/dist/cjs/internal/constants.js +13 -0
- package/dist/cjs/internal/index.js +7 -7
- package/dist/cjs/internal/label-text.js +6 -9
- package/dist/cjs/internal/label.js +88 -24
- package/dist/cjs/internal/required-indicator.js +10 -13
- package/dist/cjs/internal/theme.js +65 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/checkbox.js +119 -66
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/internal/checkbox-icon.js +60 -0
- package/dist/es2019/internal/constants.js +3 -0
- package/dist/es2019/internal/index.js +1 -1
- package/dist/es2019/internal/label-text.js +7 -8
- package/dist/es2019/internal/label.js +81 -13
- package/dist/es2019/internal/required-indicator.js +11 -12
- package/dist/es2019/internal/theme.js +56 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/checkbox.js +120 -71
- package/dist/esm/index.js +1 -1
- package/dist/esm/internal/checkbox-icon.js +61 -0
- package/dist/esm/internal/constants.js +3 -0
- package/dist/esm/internal/index.js +1 -1
- package/dist/esm/internal/label-text.js +7 -8
- package/dist/esm/internal/label.js +85 -20
- package/dist/esm/internal/required-indicator.js +11 -12
- package/dist/esm/internal/theme.js +56 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/checkbox.d.ts +11 -19
- package/dist/types/index.d.ts +1 -1
- package/dist/types/internal/checkbox-icon.d.ts +16 -0
- package/dist/types/internal/constants.d.ts +2 -0
- package/dist/types/internal/index.d.ts +1 -1
- package/dist/types/internal/label-text.d.ts +0 -4
- package/dist/types/internal/label.d.ts +0 -2
- package/dist/types/internal/required-indicator.d.ts +1 -2
- package/dist/types/internal/theme.d.ts +55 -0
- package/dist/types/types.d.ts +51 -63
- package/extract-react-types/checkbox-props.tsx +2 -2
- package/package.json +10 -8
- package/dist/cjs/internal/styles.js +0 -83
- package/dist/es2019/internal/styles.js +0 -225
- package/dist/esm/internal/styles.js +0 -71
- package/dist/types/internal/styles.d.ts +0 -3
package/dist/types/checkbox.d.ts
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
label?: string | number | import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, string | any | (new (props: any) => import("react").Component<any, any, any>)> | null) | (new (props: any) => import("react").Component<any, any, any>)> | undefined;
|
|
13
|
-
onChange?: ((e: ChangeEvent<HTMLInputElement>, analyticsEvent: UIAnalyticsEvent) => void) | undefined;
|
|
14
|
-
value?: string | number | undefined;
|
|
15
|
-
size?: "small" | "medium" | "large" | "xlarge" | undefined;
|
|
16
|
-
testId?: string | undefined;
|
|
17
|
-
analyticsContext?: Record<string, any> | undefined;
|
|
18
|
-
css?: import("@emotion/core").InterpolationWithTheme<any>;
|
|
19
|
-
} & import("react").RefAttributes<HTMLInputElement>>>;
|
|
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<Pick<Pick<import("react").InputHTMLAttributes<HTMLInputElement>, "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "crossOrigin" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "pattern" | "placeholder" | "readOnly" | "size" | "src" | "step" | "type" | "value" | "width" | "onChange" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "inputMode" | "is" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture">, "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "crossOrigin" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "pattern" | "placeholder" | "readOnly" | "src" | "step" | "type" | "width" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "inputMode" | "is" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & import("./types").OwnProps & import("react").RefAttributes<HTMLInputElement>>>;
|
|
20
12
|
export default Checkbox;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default, Checkbox } from './checkbox';
|
|
1
|
+
export { default, default as Checkbox } from './checkbox';
|
|
2
2
|
export type { CheckboxProps } from './types';
|
|
@@ -0,0 +1,16 @@
|
|
|
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,4 +1,4 @@
|
|
|
1
|
-
export { default as
|
|
1
|
+
export { default as CheckboxIcon } from './checkbox-icon';
|
|
2
2
|
export { default as Label } from './label';
|
|
3
3
|
export { default as LabelText } from './label-text';
|
|
4
4
|
export { default as RequiredIndicator } from './required-indicator';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
declare const theme: {
|
|
2
|
+
light: {
|
|
3
|
+
borderColor: {
|
|
4
|
+
rest: "var(--ds-border)";
|
|
5
|
+
hovered: "var(--ds-border)";
|
|
6
|
+
disabled: "var(--ds-background-disabled)";
|
|
7
|
+
checked: "var(--ds-background-brand-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-brand-bold-hovered)";
|
|
13
|
+
};
|
|
14
|
+
boxColor: {
|
|
15
|
+
rest: "var(--ds-background-input)";
|
|
16
|
+
hovered: "var(--ds-surface)";
|
|
17
|
+
disabled: "var(--ds-background-disabled)";
|
|
18
|
+
active: "var(--ds-background-input-pressed)";
|
|
19
|
+
hoveredAndChecked: "var(--ds-background-brand-bold-hovered)";
|
|
20
|
+
checked: "var(--ds-background-brand-bold)";
|
|
21
|
+
};
|
|
22
|
+
tickColor: {
|
|
23
|
+
disabledAndChecked: "var(--ds-text-disabled)";
|
|
24
|
+
activeAndChecked: "var(--ds-text-inverse)";
|
|
25
|
+
checked: "var(--ds-text-inverse)";
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
dark: {
|
|
29
|
+
borderColor: {
|
|
30
|
+
rest: "var(--ds-border)";
|
|
31
|
+
hovered: "var(--ds-border)";
|
|
32
|
+
disabled: "var(--ds-background-disabled)";
|
|
33
|
+
checked: "var(--ds-background-brand-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-brand-bold-hovered)";
|
|
39
|
+
};
|
|
40
|
+
boxColor: {
|
|
41
|
+
rest: "var(--ds-background-input)";
|
|
42
|
+
hovered: "var(--ds-surface)";
|
|
43
|
+
disabled: "var(--ds-background-disabled)";
|
|
44
|
+
active: "var(--ds-background-input-pressed)";
|
|
45
|
+
hoveredAndChecked: "var(--ds-background-brand-bold-hovered)";
|
|
46
|
+
checked: "var(--ds-background-brand-bold)";
|
|
47
|
+
};
|
|
48
|
+
tickColor: {
|
|
49
|
+
disabledAndChecked: "var(--ds-text-disabled)";
|
|
50
|
+
activeAndChecked: "var(--ds-text-inverse)";
|
|
51
|
+
checked: "var(--ds-text-inverse)";
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export default theme;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import UIAnalyticsEvent from '@atlaskit/analytics-next/UIAnalyticsEvent';
|
|
2
|
+
import type UIAnalyticsEvent from '@atlaskit/analytics-next/UIAnalyticsEvent';
|
|
4
3
|
export declare type Size = 'small' | 'medium' | 'large' | 'xlarge';
|
|
5
4
|
/**
|
|
6
5
|
*
|
|
@@ -8,101 +7,92 @@ export declare type Size = 'small' | 'medium' | 'large' | 'xlarge';
|
|
|
8
7
|
* CHECKBOX PROPTYPES
|
|
9
8
|
*
|
|
10
9
|
*
|
|
11
|
-
|
|
12
|
-
declare type OwnProps = {
|
|
13
|
-
/** Sets whether the checkbox begins checked. */
|
|
14
|
-
defaultChecked?: boolean;
|
|
15
|
-
/** id assigned to input */
|
|
16
|
-
id?: string;
|
|
17
|
-
/** Sets whether the checkbox is checked or unchecked. */
|
|
18
|
-
isChecked?: boolean;
|
|
19
|
-
/** Sets whether the checkbox is disabled. */
|
|
20
|
-
isDisabled?: boolean;
|
|
10
|
+
*/
|
|
11
|
+
export declare type OwnProps = {
|
|
21
12
|
/**
|
|
22
|
-
* Sets whether the checkbox
|
|
23
|
-
* style and does not modify the isChecked property.
|
|
13
|
+
* Sets whether the checkbox begins checked.
|
|
24
14
|
*/
|
|
25
|
-
|
|
26
|
-
/** Marks the field as invalid. Changes style of unchecked component. */
|
|
27
|
-
isInvalid?: boolean;
|
|
28
|
-
/** Marks the field as required & changes the label style. */
|
|
29
|
-
isRequired?: boolean;
|
|
15
|
+
defaultChecked?: boolean;
|
|
30
16
|
/**
|
|
31
|
-
*
|
|
32
|
-
* of the clickable element to select the checkbox.
|
|
17
|
+
* id assigned to input
|
|
33
18
|
*/
|
|
34
|
-
|
|
19
|
+
id?: string;
|
|
35
20
|
/**
|
|
36
|
-
*
|
|
37
|
-
* be called with an object containing the react synthetic event. Use currentTarget to get value, name and checked
|
|
21
|
+
* Sets whether the checkbox is checked or unchecked.
|
|
38
22
|
*/
|
|
39
|
-
onChange?: (e: React.ChangeEvent<HTMLInputElement>, analyticsEvent: UIAnalyticsEvent) => void;
|
|
40
|
-
/** The value to be used in the checkbox input. This is the value that will be returned on form submission. */
|
|
41
|
-
value?: number | string;
|
|
42
|
-
/** The size of the Checkbox */
|
|
43
|
-
size?: Size;
|
|
44
|
-
/**
|
|
45
|
-
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
|
|
46
|
-
we have generated testid based on the one you pass to the Checkbox component:
|
|
47
|
-
- `{testId}--hidden-checkbox` to check if it got changed to checked/unchecked.
|
|
48
|
-
*/
|
|
49
|
-
testId?: string;
|
|
50
|
-
/** Additional information to be included in the `context` of analytics events that come from radio */
|
|
51
|
-
analyticsContext?: Record<string, any>;
|
|
52
|
-
/** Added to ensure that css is optional because of an emotion bug an emotion bug that makes css required */
|
|
53
|
-
css?: InterpolationWithTheme<any>;
|
|
54
|
-
};
|
|
55
|
-
declare type Combine<First, Second> = Omit<First, keyof Second> & Second;
|
|
56
|
-
export declare type CheckboxProps = Combine<Omit<React.InputHTMLAttributes<HTMLInputElement>, 'disabled' | 'required' | 'checked'>, OwnProps>;
|
|
57
|
-
export interface ExtractReactTypeProps {
|
|
58
|
-
/** Sets whether the checkbox begins checked. */
|
|
59
|
-
defaultChecked?: boolean;
|
|
60
|
-
/** id assigned to input */
|
|
61
|
-
id?: string;
|
|
62
|
-
/** Sets whether the checkbox is checked or unchecked. */
|
|
63
23
|
isChecked?: boolean;
|
|
64
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Sets whether the checkbox is disabled.
|
|
26
|
+
*/
|
|
65
27
|
isDisabled?: boolean;
|
|
66
28
|
/**
|
|
67
29
|
* Sets whether the checkbox is indeterminate. This only affects the
|
|
68
30
|
* style and does not modify the isChecked property.
|
|
69
31
|
*/
|
|
70
32
|
isIndeterminate?: boolean;
|
|
71
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Marks the field as invalid. Changes style of unchecked component.
|
|
35
|
+
*/
|
|
72
36
|
isInvalid?: boolean;
|
|
73
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* Marks the field as required & changes the label style.
|
|
39
|
+
*/
|
|
74
40
|
isRequired?: boolean;
|
|
75
41
|
/**
|
|
76
42
|
* The label to be displayed to the right of the checkbox. The label is part
|
|
77
43
|
* of the clickable element to select the checkbox.
|
|
78
44
|
*/
|
|
79
45
|
label?: React.ReactChild;
|
|
80
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* The name of the submitted field in a checkbox.
|
|
48
|
+
*/
|
|
81
49
|
name?: string;
|
|
82
50
|
/**
|
|
83
51
|
* Function that is called whenever the state of the checkbox changes. It will
|
|
84
52
|
* be called with an object containing the react synthetic event. Use currentTarget to get value, name and checked
|
|
85
53
|
*/
|
|
86
54
|
onChange?: (e: React.ChangeEvent<HTMLInputElement>, analyticsEvent: UIAnalyticsEvent) => void;
|
|
87
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* The value to be used in the checkbox input. This is the value that will be returned on form submission.
|
|
57
|
+
*/
|
|
88
58
|
value?: number | string;
|
|
89
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* The size of the Checkbox
|
|
61
|
+
*/
|
|
90
62
|
size?: Size;
|
|
91
63
|
/**
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
+
*/
|
|
96
68
|
testId?: string;
|
|
97
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* Additional information to be included in the `context` of analytics events that come from radio
|
|
71
|
+
*/
|
|
98
72
|
analyticsContext?: Record<string, any>;
|
|
99
|
-
}
|
|
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>;
|
|
100
88
|
export interface LabelTextProps extends React.HTMLProps<HTMLSpanElement> {
|
|
101
89
|
children: React.ReactNode;
|
|
102
90
|
}
|
|
103
91
|
export interface LabelProps extends React.HTMLProps<HTMLInputElement> {
|
|
104
92
|
isDisabled?: boolean;
|
|
105
|
-
/**
|
|
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
|
+
*/
|
|
106
96
|
testId?: string;
|
|
107
97
|
/**
|
|
108
98
|
* Click handler that is conditionally applied for Firefox
|
|
@@ -110,6 +100,4 @@ export interface LabelProps extends React.HTMLProps<HTMLInputElement> {
|
|
|
110
100
|
*/
|
|
111
101
|
onClick?: React.MouseEventHandler;
|
|
112
102
|
}
|
|
113
|
-
export interface RequiredIndicatorProps extends React.HTMLProps<HTMLSpanElement> {
|
|
114
|
-
}
|
|
115
103
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/checkbox",
|
|
3
|
-
"version": "12.3.
|
|
3
|
+
"version": "12.3.10",
|
|
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/"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"module:es2019": "dist/es2019/index.js",
|
|
14
14
|
"types": "dist/types/index.d.ts",
|
|
15
15
|
"sideEffects": false,
|
|
16
|
-
"atlaskit:src": "src/index.
|
|
16
|
+
"atlaskit:src": "src/index.tsx",
|
|
17
17
|
"atlassian": {
|
|
18
18
|
"team": "Design System Team",
|
|
19
19
|
"releaseModel": "scheduled",
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"af:exports": {
|
|
25
|
-
".": "./src/index.
|
|
25
|
+
".": "./src/index.tsx"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@atlaskit/analytics-next": "^8.2.0",
|
|
29
|
-
"@atlaskit/ds-lib": "^1.
|
|
29
|
+
"@atlaskit/ds-lib": "^1.4.0",
|
|
30
30
|
"@atlaskit/icon": "^21.10.0",
|
|
31
31
|
"@atlaskit/theme": "^12.1.0",
|
|
32
|
-
"@atlaskit/tokens": "^0.
|
|
32
|
+
"@atlaskit/tokens": "^0.8.0",
|
|
33
33
|
"@babel/runtime": "^7.0.0",
|
|
34
34
|
"@emotion/core": "^10.0.9"
|
|
35
35
|
},
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
"react": "^16.8.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@atlaskit/button": "^16.
|
|
40
|
+
"@atlaskit/button": "^16.2.0",
|
|
41
41
|
"@atlaskit/docs": "*",
|
|
42
|
-
"@atlaskit/form": "^8.
|
|
42
|
+
"@atlaskit/form": "^8.5.0",
|
|
43
43
|
"@atlaskit/section-message": "^6.1.0",
|
|
44
44
|
"@atlaskit/ssr": "*",
|
|
45
45
|
"@atlaskit/toggle": "^12.4.0",
|
|
@@ -63,12 +63,14 @@
|
|
|
63
63
|
"import-structure": "atlassian-conventions"
|
|
64
64
|
},
|
|
65
65
|
"@repo/internal": {
|
|
66
|
+
"design-system": "v1",
|
|
66
67
|
"ui-components": "lite-mode",
|
|
67
68
|
"analytics": "analytics-next",
|
|
68
69
|
"theming": "tokens",
|
|
69
70
|
"deprecation": "no-deprecated-imports",
|
|
70
71
|
"styling": [
|
|
71
|
-
"emotion"
|
|
72
|
+
"emotion",
|
|
73
|
+
"static"
|
|
72
74
|
]
|
|
73
75
|
}
|
|
74
76
|
},
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
|
-
|
|
12
|
-
var _core = require("@emotion/core");
|
|
13
|
-
|
|
14
|
-
var _colors = require("@atlaskit/theme/colors");
|
|
15
|
-
|
|
16
|
-
var _templateObject, _templateObject2;
|
|
17
|
-
|
|
18
|
-
var checkboxStyles = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n /* Make the input invisible */\n -webkit-appearance: none;\n -moz-appearance: none;\n margin: 0;\n /* Necessary to hide correctly on mobile Safari */\n border: none;\n width: 0px;\n height: 0px;\n /* Necessary to hide focus ring on Firefox */\n outline: none;\n\n /*\n Change the variables --checkbox-background-color, --checkbox-border-color\n and --checkbox-tick-color according to user interactions.\n All other variables are constant.\n All styles from the input target the sibling svg.\n */\n & + svg {\n --checkbox-background-color: var(--local-background);\n --checkbox-border-color: var(--local-border);\n --checkbox-tick-color: var(--local-tick-rest);\n /* Color changes the background color */\n color: var(--checkbox-background-color);\n /* Fill changes the tick color */\n fill: var(--checkbox-tick-color);\n transition: color 0.2s ease-in-out, fill 0.2s ease-in-out;\n flex-shrink: 0;\n /* If the label is multiple lines, don't center the checkbox */\n align-self: flex-start;\n }\n & + svg rect:first-of-type {\n /* Stroke changes the color of the border */\n stroke: var(--checkbox-border-color);\n stroke-width: 2px;\n transition: stroke 0.2s ease-in-out;\n }\n\n /* Styles are listed in order of increasing specificity */\n\n /*\n Compiled will order the pseudo classes by LVFHA\n As the background colour changes on hover, it is okay for the\n border focus colour to take precedence over hover.\n && is used to make the focus styles more specific than the hover\n styles\n */\n &&:focus + svg,\n &&:checked:focus + svg {\n --checkbox-border-color: var(--local-border-focus);\n }\n\n &:hover + svg {\n --checkbox-background-color: var(--local-background-hover);\n --checkbox-border-color: var(--local-border-hover);\n }\n &:checked:hover + svg {\n --checkbox-background-color: var(--local-background-checked-hover);\n --checkbox-border-color: var(--local-border-checked-hover);\n }\n\n &:checked + svg {\n --checkbox-background-color: var(--local-background-checked);\n --checkbox-border-color: var(--local-border-checked);\n --checkbox-tick-color: var(--local-tick-checked);\n }\n\n &[data-invalid] + svg {\n --checkbox-border-color: var(--local-border-invalid);\n }\n &:checked[data-invalid] + svg {\n --checkbox-border-color: var(--local-border-checked-invalid);\n }\n\n &:active + svg {\n --checkbox-background-color: var(--local-background-active);\n --checkbox-border-color: var(--local-border-active);\n }\n &:checked:active + svg {\n --checkbox-tick-color: var(--local-tick-active);\n --checkbox-background-color: var(--local-background-active);\n --checkbox-border-color: var(--local-border-active);\n }\n\n &:disabled + svg,\n &:disabled:hover + svg,\n &:disabled:focus + svg,\n &:disabled:active + svg,\n &:disabled[data-invalid] + svg {\n --checkbox-background-color: var(--local-background-disabled);\n --checkbox-border-color: var(--local-border-disabled);\n pointer-events: none;\n cursor: not-allowed;\n }\n\n &:disabled:checked + svg {\n --checkbox-tick-color: var(--local-tick-disabled);\n }\n\n @media screen and (forced-colors: active) {\n & + svg {\n --checkbox-background-color: Canvas;\n --checkbox-border-color: CanvasText;\n --checkbox-tick-color: CanvasText;\n }\n\n &:checked + svg,\n &:checked:hover + svg {\n --checkbox-background-color: Canvas;\n --checkbox-border-color: CanvasText;\n --checkbox-tick-color: CanvasText;\n }\n\n &:focus + svg rect:first-of-type {\n stroke: Highlight;\n }\n\n &[data-invalid] + svg {\n --checkbox-border-color: Highlight;\n }\n &:checked[data-invalid] + svg {\n --checkbox-border-color: Highlight;\n }\n\n &:disabled + svg,\n &:disabled:hover + svg,\n &:disabled:focus + svg,\n &:disabled:active + svg,\n &:disabled[data-invalid] + svg {\n --checkbox-background-color: Canvas;\n --checkbox-border-color: GrayText;\n --checkbox-tick-color: GrayText;\n }\n }\n"])));
|
|
19
|
-
var checkboxThemeColors = {
|
|
20
|
-
light: {
|
|
21
|
-
borderColor: {
|
|
22
|
-
rest: "var(--ds-border, ".concat(_colors.N40, ")"),
|
|
23
|
-
hovered: "var(--ds-border, ".concat(_colors.N40, ")"),
|
|
24
|
-
disabled: "var(--ds-background-disabled, ".concat(_colors.N20, ")"),
|
|
25
|
-
checked: "var(--ds-background-brand-bold, ".concat(_colors.B400, ")"),
|
|
26
|
-
active: "var(--ds-border, ".concat(_colors.B50, ")"),
|
|
27
|
-
invalid: "var(--ds-border-danger, ".concat(_colors.R300, ")"),
|
|
28
|
-
invalidAndChecked: "var(--ds-border-danger, ".concat(_colors.R300, ")"),
|
|
29
|
-
focused: "var(--ds-border-focused, ".concat(_colors.B100, ")"),
|
|
30
|
-
hoveredAndChecked: "var(--ds-background-brand-bold-hovered, ".concat(_colors.B300, ")")
|
|
31
|
-
},
|
|
32
|
-
boxColor: {
|
|
33
|
-
rest: "var(--ds-background-input, ".concat(_colors.N10, ")"),
|
|
34
|
-
hovered: "var(--ds-surface, ".concat(_colors.N30, ")"),
|
|
35
|
-
disabled: "var(--ds-background-disabled, ".concat(_colors.N20, ")"),
|
|
36
|
-
active: "var(--ds-background-input-pressed, ".concat(_colors.B50, ")"),
|
|
37
|
-
hoveredAndChecked: "var(--ds-background-brand-bold-hovered, ".concat(_colors.B300, ")"),
|
|
38
|
-
checked: "var(--ds-background-brand-bold, ".concat(_colors.B400, ")")
|
|
39
|
-
},
|
|
40
|
-
tickColor: {
|
|
41
|
-
disabledAndChecked: "var(--ds-text-disabled, ".concat(_colors.N70, ")"),
|
|
42
|
-
activeAndChecked: "var(--ds-text-inverse, ".concat(_colors.B400, ")"),
|
|
43
|
-
checked: "var(--ds-text-inverse, ".concat(_colors.N10, ")")
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
dark: {
|
|
47
|
-
borderColor: {
|
|
48
|
-
rest: "var(--ds-border, ".concat(_colors.DN80, ")"),
|
|
49
|
-
hovered: "var(--ds-border, ".concat(_colors.DN200, ")"),
|
|
50
|
-
disabled: "var(--ds-background-disabled, ".concat(_colors.DN10, ")"),
|
|
51
|
-
checked: "var(--ds-background-brand-bold, ".concat(_colors.B400, ")"),
|
|
52
|
-
active: "var(--ds-border, ".concat(_colors.B200, ")"),
|
|
53
|
-
invalid: "var(--ds-border-danger, ".concat(_colors.R300, ")"),
|
|
54
|
-
invalidAndChecked: "var(--ds-border-danger, ".concat(_colors.R300, ")"),
|
|
55
|
-
focused: "var(--ds-border-focused, ".concat(_colors.B75, ")"),
|
|
56
|
-
hoveredAndChecked: "var(--ds-background-brand-bold-hovered, ".concat(_colors.B75, ")")
|
|
57
|
-
},
|
|
58
|
-
boxColor: {
|
|
59
|
-
rest: "var(--ds-background-input, ".concat(_colors.DN10, ")"),
|
|
60
|
-
hovered: "var(--ds-surface, ".concat(_colors.DN30, ")"),
|
|
61
|
-
disabled: "var(--ds-background-disabled, ".concat(_colors.DN10, ")"),
|
|
62
|
-
active: "var(--ds-background-input-pressed, ".concat(_colors.B200, ")"),
|
|
63
|
-
hoveredAndChecked: "var(--ds-background-brand-bold-hovered, ".concat(_colors.B75, ")"),
|
|
64
|
-
checked: "var(--ds-background-brand-bold, ".concat(_colors.B400, ")")
|
|
65
|
-
},
|
|
66
|
-
tickColor: {
|
|
67
|
-
disabledAndChecked: "var(--ds-text-disabled, ".concat(_colors.DN90, ")"),
|
|
68
|
-
activeAndChecked: "var(--ds-text-inverse, ".concat(_colors.DN10, ")"),
|
|
69
|
-
checked: "var(--ds-text-inverse, ".concat(_colors.DN10, ")")
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
var getCheckboxStyles = function getCheckboxStyles(mode) {
|
|
75
|
-
var checkboxColors = checkboxThemeColors[mode];
|
|
76
|
-
var boxColor = checkboxColors.boxColor;
|
|
77
|
-
var tickColor = checkboxColors.tickColor;
|
|
78
|
-
var borderColor = checkboxColors.borderColor;
|
|
79
|
-
return [(0, _core.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n & + svg {\n --local-background: ", ";\n --local-background-hover: ", ";\n --local-background-active: ", ";\n --local-background-checked: ", ";\n --local-background-checked-hover: ", ";\n --local-background-disabled: ", ";\n\n --local-tick-rest: transparent;\n --local-tick-checked: ", ";\n --local-tick-disabled: ", ";\n --local-tick-active: ", ";\n\n --local-border: ", ";\n --local-border-disabled: ", ";\n --local-border-checked: ", ";\n --local-border-active: ", ";\n --local-border-invalid: ", ";\n --local-border-focus: ", ";\n --local-border-hover: ", ";\n --local-border-checked-hover: ", ";\n --local-border-checked-invalid: ", ";\n }\n "])), boxColor.rest, boxColor.hovered, boxColor.active, boxColor.checked, boxColor.hoveredAndChecked, boxColor.disabled, tickColor.checked, tickColor.disabledAndChecked, tickColor.activeAndChecked, borderColor.rest, borderColor.disabled, borderColor.checked, borderColor.active, borderColor.invalid, borderColor.focused, borderColor.hovered, borderColor.hoveredAndChecked, borderColor.invalidAndChecked), checkboxStyles];
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
var _default = getCheckboxStyles;
|
|
83
|
-
exports.default = _default;
|