@atlaskit/range 5.0.11
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 +349 -0
- package/LICENSE +13 -0
- package/README.md +13 -0
- package/__perf__/default.tsx +7 -0
- package/__perf__/range.tsx +42 -0
- package/build/tsconfig.json +17 -0
- package/codemods/4.0.0-lite-mode.ts +92 -0
- package/codemods/__tests__/4.0.0-lite-mode.ts +109 -0
- package/constellation/index/examples.mdx +39 -0
- package/constellation/index/images/range-anatomy.png +0 -0
- package/constellation/index/props.mdx +5 -0
- package/constellation/index/usage.mdx +31 -0
- package/dist/cjs/index.js +15 -0
- package/dist/cjs/range.js +108 -0
- package/dist/cjs/styled.js +94 -0
- package/dist/cjs/theme.js +56 -0
- package/dist/cjs/version.json +5 -0
- package/dist/es2019/index.js +1 -0
- package/dist/es2019/range.js +67 -0
- package/dist/es2019/styled.js +255 -0
- package/dist/es2019/theme.js +36 -0
- package/dist/es2019/version.json +5 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/range.js +86 -0
- package/dist/esm/styled.js +79 -0
- package/dist/esm/theme.js +38 -0
- package/dist/esm/version.json +5 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/range.d.ts +28 -0
- package/dist/types/styled.d.ts +12 -0
- package/dist/types/theme.d.ts +60 -0
- package/docs/0-intro.tsx +13 -0
- package/extract-react-types/range-props.tsx +5 -0
- package/package.json +80 -0
- package/range/package.json +7 -0
- package/styled/package.json +7 -0
- package/theme/package.json +7 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
4
|
+
|
|
5
|
+
var _templateObject;
|
|
6
|
+
|
|
7
|
+
/** @jsx jsx */
|
|
8
|
+
|
|
9
|
+
/* eslint-disable no-mixed-operators */
|
|
10
|
+
import { forwardRef, useMemo } from 'react';
|
|
11
|
+
import { css, jsx } from '@emotion/core';
|
|
12
|
+
import { fontFamily } from '@atlaskit/theme/constants';
|
|
13
|
+
import { e200 } from '@atlaskit/theme/elevation';
|
|
14
|
+
var sliderThumbSize = 16;
|
|
15
|
+
var sliderThumbBorderThickness = 2;
|
|
16
|
+
var sliderLineThickness = 4;
|
|
17
|
+
var transitionDuration = '0.2s';
|
|
18
|
+
var sliderBorderRadius = sliderLineThickness / 2;
|
|
19
|
+
export var overallHeight = 40;
|
|
20
|
+
|
|
21
|
+
var getBackgroundGradient = function getBackgroundGradient(_ref) {
|
|
22
|
+
var lower = _ref.lower,
|
|
23
|
+
upper = _ref.upper;
|
|
24
|
+
return "\n background: linear-gradient(".concat(lower, ", ").concat(lower, ") 0 / var(--range-inline-width) 100%\n no-repeat ").concat(upper, ";\n [dir='rtl'] & {\n background-position: right;\n }\n ");
|
|
25
|
+
}; // Thumb style
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
var sliderThumbStyle = function sliderThumbStyle(_ref2) {
|
|
29
|
+
var thumb = _ref2.thumb;
|
|
30
|
+
return "\n background: ".concat(thumb.default.background, ";\n border: ").concat(sliderThumbBorderThickness, "px solid transparent;\n border-radius: 50%;\n height: ").concat(sliderThumbSize, "px;\n width: ").concat(sliderThumbSize, "px;\n box-sizing: border-box;\n transition: border-color ").concat(transitionDuration, " ease-in-out;\n ").concat(e200(), ";\n ");
|
|
31
|
+
}; // Track styles
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
var sliderTrackStyle = "\n border-radius: ".concat(sliderBorderRadius, "px;\n border: 0;\n cursor: pointer;\n height: ").concat(sliderLineThickness, "px;\n width: 100%;\n transition: background-color ").concat(transitionDuration, " ease-in-out;\n"); // Range input styles
|
|
35
|
+
|
|
36
|
+
var chromeRangeInputStyle = function chromeRangeInputStyle(tokens) {
|
|
37
|
+
return "\n &::-webkit-slider-thumb {\n -webkit-appearance: none;\n margin-top: -".concat((sliderThumbSize - sliderLineThickness) / 2, "px;\n ").concat(sliderThumbStyle(tokens), ";\n }\n\n &:focus::-webkit-slider-thumb {\n border-color: ").concat(tokens.thumb.focus.border, ";\n }\n\n &:disabled::-webkit-slider-thumb {\n cursor: not-allowed;\n box-shadow: 0 0 1px ").concat(tokens.thumb.disabled.boxShadow, ";\n }\n\n &::-webkit-slider-runnable-track {\n ").concat(sliderTrackStyle, ";\n ").concat(getBackgroundGradient(tokens.track.default), ";\n }\n\n &:focus::-webkit-slider-runnable-track {\n ").concat(getBackgroundGradient(tokens.track.default), ";\n }\n\n &:active::-webkit-slider-runnable-track,\n &:hover::-webkit-slider-runnable-track {\n ").concat(getBackgroundGradient(tokens.track.hover), ";\n }\n\n &:disabled::-webkit-slider-runnable-track {\n ").concat(getBackgroundGradient(tokens.track.disabled), "\n cursor: not-allowed;\n }\n ");
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
var firefoxRangeInputStyle = function firefoxRangeInputStyle(tokens) {
|
|
41
|
+
return "\n &::-moz-focus-outer {\n border: 0;\n }\n\n &::-moz-range-thumb {\n ".concat(sliderThumbStyle(tokens), ";\n }\n\n &:focus::-moz-range-thumb {\n border-color: ").concat(tokens.thumb.focus.border, ";\n }\n\n &:disabled::-moz-range-thumb {\n cursor: not-allowed;\n box-shadow: 0 0 1px ").concat(tokens.thumb.disabled.boxShadow, ";\n }\n\n &::-moz-range-progress {\n ").concat(sliderTrackStyle, ";\n background: ").concat(tokens.track.default.lower, ";\n }\n\n &::-moz-range-track {\n ").concat(sliderTrackStyle, ";\n background: ").concat(tokens.track.default.upper, ";\n }\n\n &:active::-moz-range-progress,\n &:hover::-moz-range-progress {\n background: ").concat(tokens.track.hover.lower, ";\n }\n\n &:active::-moz-range-track,\n &:hover::-moz-range-track {\n background: ").concat(tokens.track.hover.upper, ";\n }\n\n &:disabled::-moz-range-progress {\n background: ").concat(tokens.track.disabled.lower, ";\n cursor: not-allowed;\n }\n\n &:disabled::-moz-range-track {\n background: ").concat(tokens.track.disabled.upper, ";\n cursor: not-allowed;\n }\n");
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
var IERangeInputStyle = function IERangeInputStyle(tokens) {
|
|
45
|
+
return "\n &::-ms-thumb {\n margin-top: 0;\n ".concat(sliderThumbStyle(tokens), ";\n }\n\n &:focus::-ms-thumb {\n border-color: ").concat(tokens.thumb.focus.border, ";\n }\n\n &:disabled::-ms-thumb {\n cursor: not-allowed;\n box-shadow: 0 0 1px ").concat(tokens.thumb.disabled.boxShadow, ";\n }\n\n &::-ms-track {\n background: transparent;\n border-color: transparent;\n color: transparent;\n cursor: pointer;\n height: ").concat(sliderLineThickness, "px;\n transition: background-color ").concat(transitionDuration, " ease-in-out;\n width: 100%;\n }\n\n &::-ms-fill-lower {\n background: ").concat(tokens.track.default.lower, ";\n border-radius: ").concat(sliderBorderRadius, "px;\n border: 0;\n }\n\n &::-ms-fill-upper {\n background: ").concat(tokens.track.default.upper, ";\n border-radius: ").concat(sliderBorderRadius, "px;\n border: 0;\n }\n\n &:active::-ms-fill-lower,\n &:hover::-ms-fill-lower {\n background: ").concat(tokens.track.hover.lower, ";\n }\n\n &:active::-ms-fill-upper,\n &:hover::-ms-fill-upper {\n background: ").concat(tokens.track.hover.upper, ";\n }\n\n &:disabled::-ms-fill-lower {\n background: ").concat(tokens.track.disabled.lower, ";\n cursor: not-allowed;\n }\n\n &:disabled::-ms-fill-upper {\n background: ").concat(tokens.track.disabled.upper, ";\n cursor: not-allowed;\n }\n");
|
|
46
|
+
}; // Styles are split per browser as they are implemented differently
|
|
47
|
+
// Cannot consolidate as Chrome & Firefox don't recognise styles if they are grouped
|
|
48
|
+
// with CSS selectors they don't recognise, e.g. &::-ms-thumb
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
export var rangeInputStyle = function rangeInputStyle(tokens) {
|
|
52
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n -webkit-appearance: none; /* Hides the slider so that custom slider can be made */\n background: transparent; /* Otherwise white in Chrome */\n height: ", "px; /* Otherwise thumb will collide with previous box element */\n padding: 0; /* IE11 includes padding, this normalises it */\n width: 100%; /* Specific width is required for Firefox. */\n\n &:focus {\n outline: none;\n }\n\n &:disabled {\n cursor: not-allowed;\n }\n\n ", "\n ", "\n ", ";\n\n font-family: ", ";\n\n background-position: right;\n "])), overallHeight, chromeRangeInputStyle(tokens), firefoxRangeInputStyle(tokens), IERangeInputStyle(tokens), fontFamily());
|
|
53
|
+
};
|
|
54
|
+
export var Input = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
55
|
+
var valuePercent = props.valuePercent,
|
|
56
|
+
thumb = props.thumb,
|
|
57
|
+
track = props.track,
|
|
58
|
+
style = props.style,
|
|
59
|
+
strippedProps = _objectWithoutProperties(props, ["valuePercent", "thumb", "track", "style"]); // Note: emotion will cache unique outputs as their own this
|
|
60
|
+
// We are memoizing the creation of this string
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
var styles = useMemo(function () {
|
|
64
|
+
return rangeInputStyle({
|
|
65
|
+
track: track,
|
|
66
|
+
thumb: thumb
|
|
67
|
+
});
|
|
68
|
+
}, [thumb, track]); // We are creating a css variable to control the "progress" portion of the range input
|
|
69
|
+
// This avoids us needing to create a new css class for each new percentage value
|
|
70
|
+
|
|
71
|
+
return jsx("input", _extends({}, strippedProps, {
|
|
72
|
+
style: {
|
|
73
|
+
'--range-inline-width': "".concat(valuePercent, "%")
|
|
74
|
+
},
|
|
75
|
+
ref: ref,
|
|
76
|
+
css: styles
|
|
77
|
+
}));
|
|
78
|
+
});
|
|
79
|
+
Input.displayName = 'InputRange';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as colors from '@atlaskit/theme/colors';
|
|
2
|
+
import { createTheme } from '@atlaskit/theme/components';
|
|
3
|
+
export var thumb = {
|
|
4
|
+
default: {
|
|
5
|
+
background: colors.N0,
|
|
6
|
+
// This border color is not being used - awaiting focus state lift to props
|
|
7
|
+
border: colors.N800
|
|
8
|
+
},
|
|
9
|
+
disabled: {
|
|
10
|
+
boxShadow: colors.N60A
|
|
11
|
+
},
|
|
12
|
+
focus: {
|
|
13
|
+
// This border color is not being used - awaiting focus state lift to props
|
|
14
|
+
background: colors.N0,
|
|
15
|
+
border: colors.B200
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export var track = {
|
|
19
|
+
background: colors.N30A,
|
|
20
|
+
default: {
|
|
21
|
+
lower: colors.B400,
|
|
22
|
+
upper: colors.N30
|
|
23
|
+
},
|
|
24
|
+
disabled: {
|
|
25
|
+
lower: colors.N50,
|
|
26
|
+
upper: colors.N30
|
|
27
|
+
},
|
|
28
|
+
hover: {
|
|
29
|
+
lower: colors.B300,
|
|
30
|
+
upper: colors.N40
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export var Theme = createTheme(function () {
|
|
34
|
+
return {
|
|
35
|
+
thumb: thumb,
|
|
36
|
+
track: track
|
|
37
|
+
};
|
|
38
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ThemeProp } from '@atlaskit/theme/components';
|
|
3
|
+
export declare type OwnProps = {
|
|
4
|
+
/** Sets the default value if range is not set. */
|
|
5
|
+
defaultValue?: number;
|
|
6
|
+
/** Sets whether the field range is disabled. */
|
|
7
|
+
isDisabled?: boolean;
|
|
8
|
+
/** Sets the maximum value of the range. */
|
|
9
|
+
max?: number;
|
|
10
|
+
/** Sets the minimum value of the range.*/
|
|
11
|
+
min?: number;
|
|
12
|
+
/** Hook to be invoked on change of the range. */
|
|
13
|
+
onChange?: (value: number) => void;
|
|
14
|
+
/** Sets the step value for the range. */
|
|
15
|
+
step?: number;
|
|
16
|
+
/** A `testId` prop is provided for specific elements. This is a unique string that appears as a data attribute `data-testid` in the rendered code and serves as a hook for automated tests. */
|
|
17
|
+
testId?: string;
|
|
18
|
+
/** The theme object to be passed down. See
|
|
19
|
+
[@atlaskit/theme](https://atlaskit.atlassian.com/packages/design-system/theme) for more details on theming.
|
|
20
|
+
*/
|
|
21
|
+
theme?: ThemeProp<any, any>;
|
|
22
|
+
/** Sets the value of the range. */
|
|
23
|
+
value?: number;
|
|
24
|
+
};
|
|
25
|
+
declare type Combine<First, Second> = Omit<First, keyof Second> & Second;
|
|
26
|
+
export declare type RangeProps = Combine<Omit<React.InputHTMLAttributes<HTMLInputElement>, 'disabled' | 'required' | 'checked'>, OwnProps>;
|
|
27
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Pick<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" | "css">, "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "crossOrigin" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "maxLength" | "minLength" | "multiple" | "name" | "pattern" | "placeholder" | "readOnly" | "size" | "src" | "type" | "width" | "defaultChecked" | "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" | "css"> & OwnProps & React.RefAttributes<HTMLInputElement>>;
|
|
28
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
import { ThemeTokens } from './theme';
|
|
4
|
+
export declare const overallHeight = 40;
|
|
5
|
+
interface CustomInputProps extends ThemeTokens {
|
|
6
|
+
ref: React.Ref<HTMLInputElement>;
|
|
7
|
+
valuePercent: string;
|
|
8
|
+
}
|
|
9
|
+
declare type InputProps = React.InputHTMLAttributes<HTMLInputElement> & CustomInputProps;
|
|
10
|
+
export declare const rangeInputStyle: (tokens: ThemeTokens) => import("@emotion/core").SerializedStyles;
|
|
11
|
+
export declare const Input: import("react").ForwardRefExoticComponent<Pick<InputProps, "thumb" | "accept" | "alt" | "autoComplete" | "autoFocus" | "capture" | "checked" | "crossOrigin" | "disabled" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "pattern" | "placeholder" | "readOnly" | "required" | "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" | "css" | "valuePercent" | "track"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface ThemeTokensThumb {
|
|
3
|
+
background: string;
|
|
4
|
+
border: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ThemeTokensTrack {
|
|
7
|
+
lower: string;
|
|
8
|
+
upper: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ThemeTokens {
|
|
11
|
+
thumb: {
|
|
12
|
+
default: ThemeTokensThumb;
|
|
13
|
+
disabled: {
|
|
14
|
+
boxShadow: string;
|
|
15
|
+
};
|
|
16
|
+
focus: ThemeTokensThumb;
|
|
17
|
+
};
|
|
18
|
+
track: {
|
|
19
|
+
background: string;
|
|
20
|
+
default: ThemeTokensTrack;
|
|
21
|
+
disabled: ThemeTokensTrack;
|
|
22
|
+
hover: ThemeTokensTrack;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export declare const thumb: {
|
|
26
|
+
default: {
|
|
27
|
+
background: string;
|
|
28
|
+
border: string;
|
|
29
|
+
};
|
|
30
|
+
disabled: {
|
|
31
|
+
boxShadow: string;
|
|
32
|
+
};
|
|
33
|
+
focus: {
|
|
34
|
+
background: string;
|
|
35
|
+
border: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export declare const track: {
|
|
39
|
+
background: string;
|
|
40
|
+
default: {
|
|
41
|
+
lower: string;
|
|
42
|
+
upper: string;
|
|
43
|
+
};
|
|
44
|
+
disabled: {
|
|
45
|
+
lower: string;
|
|
46
|
+
upper: string;
|
|
47
|
+
};
|
|
48
|
+
hover: {
|
|
49
|
+
lower: string;
|
|
50
|
+
upper: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export declare const Theme: {
|
|
54
|
+
Consumer: import("react").ComponentType<any>;
|
|
55
|
+
Provider: import("react").ComponentType<{
|
|
56
|
+
children?: import("react").ReactNode;
|
|
57
|
+
value?: import("@atlaskit/theme/components").ThemeProp<ThemeTokens, any> | undefined;
|
|
58
|
+
}>;
|
|
59
|
+
useTheme: (props: any) => ThemeTokens;
|
|
60
|
+
};
|
package/docs/0-intro.tsx
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { md } from '@atlaskit/docs';
|
|
4
|
+
import SectionMessage from '@atlaskit/section-message';
|
|
5
|
+
|
|
6
|
+
export default md`
|
|
7
|
+
${(
|
|
8
|
+
<SectionMessage appearance="information">
|
|
9
|
+
This component is now documented on{' '}
|
|
10
|
+
<a href="https://atlassian.design/components">atlassian.design</a>
|
|
11
|
+
</SectionMessage>
|
|
12
|
+
)}
|
|
13
|
+
`;
|
package/package.json
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/range",
|
|
3
|
+
"version": "5.0.11",
|
|
4
|
+
"description": "A range lets users choose an approximate value on a slider.",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"registry": "https://registry.npmjs.org/"
|
|
7
|
+
},
|
|
8
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend",
|
|
9
|
+
"author": "Atlassian Pty Ltd",
|
|
10
|
+
"license": "Apache-2.0",
|
|
11
|
+
"main": "dist/cjs/index.js",
|
|
12
|
+
"module": "dist/esm/index.js",
|
|
13
|
+
"module:es2019": "dist/es2019/index.js",
|
|
14
|
+
"types": "dist/types/index.d.ts",
|
|
15
|
+
"sideEffects": false,
|
|
16
|
+
"atlaskit:src": "src/index.ts",
|
|
17
|
+
"homepage": "https://atlassian.design/components/range/",
|
|
18
|
+
"atlassian": {
|
|
19
|
+
"team": "Design System Team",
|
|
20
|
+
"deprecatedAutoEntryPoints": true,
|
|
21
|
+
"inPublicMirror": true,
|
|
22
|
+
"releaseModel": "scheduled",
|
|
23
|
+
"website": {
|
|
24
|
+
"name": "Range"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@atlaskit/theme": "^12.0.0",
|
|
29
|
+
"@babel/runtime": "^7.0.0",
|
|
30
|
+
"@emotion/core": "^10.0.9"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"react": "^16.8.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@atlaskit/build-utils": "*",
|
|
37
|
+
"@atlaskit/button": "^16.0.0",
|
|
38
|
+
"@atlaskit/checkbox": "^12.0.0",
|
|
39
|
+
"@atlaskit/docs": "*",
|
|
40
|
+
"@atlaskit/form": "^8.4.0",
|
|
41
|
+
"@atlaskit/section-message": "^6.0.0",
|
|
42
|
+
"@atlaskit/ssr": "*",
|
|
43
|
+
"@atlaskit/tooltip": "^17.5.0",
|
|
44
|
+
"@atlaskit/visual-regression": "*",
|
|
45
|
+
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
46
|
+
"@emotion/styled": "^10.0.7",
|
|
47
|
+
"@testing-library/react": "^8.0.1",
|
|
48
|
+
"@types/jscodeshift": "^0.11.0",
|
|
49
|
+
"jscodeshift": "^0.13.0",
|
|
50
|
+
"lodash": "^4.17.15",
|
|
51
|
+
"react-dom": "^16.8.0",
|
|
52
|
+
"storybook-addon-performance": "^0.16.0",
|
|
53
|
+
"typescript": "3.9.6"
|
|
54
|
+
},
|
|
55
|
+
"keywords": [
|
|
56
|
+
"atlaskit",
|
|
57
|
+
"react",
|
|
58
|
+
"ui"
|
|
59
|
+
],
|
|
60
|
+
"techstack": {
|
|
61
|
+
"@atlassian/frontend": {
|
|
62
|
+
"import-structure": "atlassian-conventions"
|
|
63
|
+
},
|
|
64
|
+
"@repo/internal": {
|
|
65
|
+
"ui-components": [
|
|
66
|
+
"lite-mode"
|
|
67
|
+
],
|
|
68
|
+
"analytics": [
|
|
69
|
+
"analytics-next"
|
|
70
|
+
],
|
|
71
|
+
"theming": [
|
|
72
|
+
"new-theming-api"
|
|
73
|
+
],
|
|
74
|
+
"deprecation": [
|
|
75
|
+
"no-deprecated-imports"
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
80
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../tsconfig.json",
|
|
3
|
+
"include": [
|
|
4
|
+
"__perf__",
|
|
5
|
+
"./src/**/*.ts",
|
|
6
|
+
"./src/**/*.tsx",
|
|
7
|
+
"./docs/**/*.ts",
|
|
8
|
+
"./docs/**/*.tsx",
|
|
9
|
+
"./codemods/**/*.ts",
|
|
10
|
+
"./codemods/**/*.tsx",
|
|
11
|
+
"./examples/**/*.ts",
|
|
12
|
+
"./examples/**/*.tsx",
|
|
13
|
+
"./example-helpers/**/*.ts",
|
|
14
|
+
"./example-helpers/**/*.tsx"
|
|
15
|
+
],
|
|
16
|
+
"compilerOptions": {
|
|
17
|
+
"baseUrl": "./"
|
|
18
|
+
}
|
|
19
|
+
}
|