@atlaskit/progress-indicator 9.0.5 → 9.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/codemods/{9.0.0-import-rename.ts → 9.0.0-import-rename.tsx} +0 -0
  3. package/codemods/__tests__/{9.0.0-import-rename.ts → 9.0.0-import-rename.tsx} +0 -0
  4. package/dist/cjs/components/appearances.js +54 -0
  5. package/dist/cjs/components/constants.js +22 -0
  6. package/dist/cjs/components/indicator.js +70 -0
  7. package/dist/cjs/components/progress-dots.js +164 -0
  8. package/dist/cjs/components/types.js +5 -0
  9. package/dist/cjs/index.js +2 -2
  10. package/dist/cjs/types.js +5 -0
  11. package/dist/cjs/version.json +1 -1
  12. package/dist/es2019/components/appearances.js +40 -0
  13. package/dist/es2019/components/constants.js +12 -0
  14. package/dist/es2019/components/indicator.js +51 -0
  15. package/dist/es2019/components/progress-dots.js +135 -0
  16. package/dist/es2019/components/types.js +1 -0
  17. package/dist/es2019/index.js +1 -1
  18. package/dist/es2019/types.js +1 -0
  19. package/dist/es2019/version.json +1 -1
  20. package/dist/esm/components/appearances.js +42 -0
  21. package/dist/esm/components/constants.js +12 -0
  22. package/dist/esm/components/indicator.js +53 -0
  23. package/dist/esm/components/progress-dots.js +140 -0
  24. package/dist/esm/components/types.js +1 -0
  25. package/dist/esm/index.js +1 -1
  26. package/dist/esm/types.js +1 -0
  27. package/dist/esm/version.json +1 -1
  28. package/dist/types/components/appearances.d.ts +2 -0
  29. package/dist/types/components/constants.d.ts +12 -0
  30. package/dist/types/components/indicator.d.ts +14 -0
  31. package/dist/types/components/progress-dots.d.ts +10 -0
  32. package/dist/types/components/types.d.ts +3 -0
  33. package/dist/types/index.d.ts +2 -1
  34. package/dist/types/types.d.ts +44 -0
  35. package/package.json +28 -10
  36. package/types/package.json +7 -0
  37. package/dist/cjs/components/Dots.js +0 -201
  38. package/dist/cjs/styled/Dots.js +0 -120
  39. package/dist/es2019/components/Dots.js +0 -145
  40. package/dist/es2019/styled/Dots.js +0 -122
  41. package/dist/esm/components/Dots.js +0 -178
  42. package/dist/esm/styled/Dots.js +0 -93
  43. package/dist/types/components/Dots.d.ts +0 -51
  44. package/dist/types/styled/Dots.d.ts +0 -12
@@ -1,120 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports.IndicatorDiv = exports.IndicatorButton = exports.Container = void 0;
11
-
12
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
-
14
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
15
-
16
- var colors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
17
-
18
- var _components = require("@atlaskit/theme/components");
19
-
20
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
21
-
22
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
-
24
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
-
26
- var colorMap = {
27
- default: (0, _components.themed)({
28
- light: colors.N50,
29
- dark: colors.DN70
30
- }),
31
- help: (0, _components.themed)({
32
- light: colors.P75,
33
- dark: colors.DN70
34
- }),
35
- inverted: (0, _components.themed)({
36
- light: 'rgba(255, 255, 255, 0.4)',
37
- dark: colors.DN300A
38
- }),
39
- primary: (0, _components.themed)({
40
- light: colors.B75,
41
- dark: colors.DN70
42
- })
43
- };
44
- var selectedColorMap = {
45
- default: (0, _components.themed)({
46
- light: colors.N900,
47
- dark: colors.DN600
48
- }),
49
- help: (0, _components.themed)({
50
- light: colors.P400,
51
- dark: colors.P300
52
- }),
53
- inverted: (0, _components.themed)({
54
- light: colors.N0,
55
- dark: colors.DN30
56
- }),
57
- primary: (0, _components.themed)({
58
- light: colors.B400,
59
- dark: colors.B100
60
- })
61
- };
62
- var outlineColorMap = {
63
- default: (0, _components.themed)({
64
- light: colors.B75,
65
- dark: colors.B200
66
- }),
67
- help: (0, _components.themed)({
68
- light: colors.P75,
69
- dark: colors.P75
70
- }),
71
- inverted: (0, _components.themed)({
72
- light: colors.B200,
73
- dark: colors.B75
74
- }),
75
- primary: (0, _components.themed)({
76
- light: colors.B75,
77
- dark: colors.B75
78
- })
79
- };
80
- var sizes = {
81
- small: 4,
82
- default: 8,
83
- large: 12
84
- };
85
- var spacingDivision = {
86
- comfortable: 2,
87
- cozy: 4,
88
- compact: 8
89
- };
90
-
91
- var getDimensions = function getDimensions(_ref) {
92
- var gutter = _ref.gutter,
93
- size = _ref.size;
94
- var val = sizes[size];
95
- var margin = val / spacingDivision[gutter];
96
- var hitslop = val + margin * 2;
97
- return (0, _styledComponents.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n height: ", "px;\n margin-left: ", "px;\n margin-right: ", "px;\n position: relative;\n width: ", "px;\n\n &::before {\n content: '';\n display: block;\n height: ", "px;\n left: -", "px;\n position: absolute;\n top: -", "px;\n width: ", "px;\n }\n "])), val, margin, margin, val, hitslop, margin, margin, hitslop);
98
- };
99
-
100
- var getColor = function getColor(_ref2) {
101
- var appearance = _ref2.appearance,
102
- selected = _ref2.selected;
103
- return selected ? selectedColorMap[appearance] : colorMap[appearance];
104
- };
105
-
106
- var commonRules = (0, _styledComponents.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ", " background-color: ", ";\n border-radius: 50%;\n"])), getDimensions, getColor);
107
-
108
- var Container = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n justify-content: center;\n"])));
109
-
110
- exports.Container = Container;
111
-
112
- var IndicatorButton = _styledComponents.default.button(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n ", " border: 0;\n cursor: pointer;\n outline: 0;\n padding: 0;\n\n ", ";\n"])), commonRules, function (p) {
113
- return p.selected ? (0, _styledComponents.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n &:focus {\n box-shadow: 0 0 0 2px ", ";\n }\n "])), outlineColorMap[p.appearance]) : null;
114
- });
115
-
116
- exports.IndicatorButton = IndicatorButton;
117
-
118
- var IndicatorDiv = _styledComponents.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n ", ";\n"])), commonRules);
119
-
120
- exports.IndicatorDiv = IndicatorDiv;
@@ -1,145 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- import React, { Component } from 'react';
4
- import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
5
- import { Container, IndicatorButton, IndicatorDiv } from '../styled/Dots';
6
- const packageName = "@atlaskit/progress-indicator";
7
- const packageVersion = "9.0.5";
8
-
9
- class ProgressDots extends Component {
10
- constructor(...args) {
11
- super(...args);
12
-
13
- _defineProperty(this, "tablist", {
14
- children: []
15
- });
16
-
17
- _defineProperty(this, "handleKeyDown", event => {
18
- const {
19
- onSelect,
20
- selectedIndex,
21
- values
22
- } = this.props;
23
- const indicators = Array.from(this.tablist.children); // bail if the target isn't an indicator
24
-
25
- if (!indicators.includes(event.target)) {
26
- return;
27
- } // bail if not valid arrow key
28
-
29
-
30
- const isLeft = event.key === 'ArrowLeft';
31
- const isRight = event.key === 'ArrowRight';
32
-
33
- if (!isLeft && !isRight) {
34
- return;
35
- } // bail if at either end of the values
36
-
37
-
38
- const isAlpha = isLeft && selectedIndex === 0;
39
- const isOmega = isRight && selectedIndex === values.length - 1;
40
-
41
- if (isAlpha || isOmega) {
42
- return;
43
- }
44
-
45
- const index = isLeft ? selectedIndex - 1 : selectedIndex + 1; // call the consumer's select method and focus the applicable indicator
46
-
47
- if (onSelect) {
48
- onSelect({
49
- event: event,
50
- index
51
- });
52
- }
53
-
54
- if (typeof indicators[index].focus === 'function') {
55
- indicators[index].focus();
56
- }
57
- });
58
- }
59
-
60
- componentDidMount() {
61
- if (this.props.onSelect) {
62
- document.addEventListener('keydown', this.handleKeyDown, false);
63
- }
64
- }
65
-
66
- componentWillUnmount() {
67
- if (this.props.onSelect) {
68
- document.removeEventListener('keydown', this.handleKeyDown);
69
- }
70
- }
71
-
72
- render() {
73
- // NOTE: `spacing` is a reserved HTML attribute and will be added to the
74
- // element, replaced with `gutter`.
75
- const {
76
- appearance,
77
- ariaControls,
78
- ariaLabel,
79
- onSelect,
80
- selectedIndex,
81
- size,
82
- spacing: gutter,
83
- values
84
- } = this.props;
85
- return /*#__PURE__*/React.createElement(Container, {
86
- innerRef: r => {
87
- this.tablist = r;
88
- },
89
- role: "tablist"
90
- }, values.map((val, index) => {
91
- const selected = selectedIndex === index;
92
- const common = {
93
- appearance: appearance,
94
- key: index,
95
- selected,
96
- size: size,
97
- gutter: gutter
98
- };
99
- const tabId = `${ariaLabel}${index}`;
100
- const panelId = `${ariaControls}${index}`;
101
- return onSelect ? /*#__PURE__*/React.createElement(IndicatorButton, _extends({}, common, {
102
- "aria-controls": panelId,
103
- "aria-label": tabId,
104
- "aria-selected": selected,
105
- id: tabId,
106
- onClick: event => onSelect({
107
- event,
108
- index
109
- }),
110
- role: "tab",
111
- tabIndex: selected ? 0 : -1,
112
- type: "button"
113
- })) : /*#__PURE__*/React.createElement(IndicatorDiv, _extends({}, common, {
114
- role: "presentation"
115
- }));
116
- }));
117
- }
118
-
119
- }
120
-
121
- _defineProperty(ProgressDots, "defaultProps", {
122
- appearance: 'default',
123
- ariaControls: 'panel',
124
- ariaLabel: 'tab',
125
- size: 'default',
126
- spacing: 'comfortable'
127
- });
128
-
129
- export { ProgressDots as ProgressDotsWithoutAnalytics };
130
- const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
131
- export default withAnalyticsContext({
132
- componentName: 'progressIndicator',
133
- packageName,
134
- packageVersion
135
- })(withAnalyticsEvents({
136
- onSelect: createAndFireEventOnAtlaskit({
137
- action: 'selected',
138
- actionSubject: 'progressIndicator',
139
- attributes: {
140
- componentName: 'progressIndicator',
141
- packageName,
142
- packageVersion
143
- }
144
- })
145
- })(ProgressDots));
@@ -1,122 +0,0 @@
1
- import styled, { css } from 'styled-components';
2
- import * as colors from '@atlaskit/theme/colors';
3
- import { themed } from '@atlaskit/theme/components';
4
- const colorMap = {
5
- default: themed({
6
- light: colors.N50,
7
- dark: colors.DN70
8
- }),
9
- help: themed({
10
- light: colors.P75,
11
- dark: colors.DN70
12
- }),
13
- inverted: themed({
14
- light: 'rgba(255, 255, 255, 0.4)',
15
- dark: colors.DN300A
16
- }),
17
- primary: themed({
18
- light: colors.B75,
19
- dark: colors.DN70
20
- })
21
- };
22
- const selectedColorMap = {
23
- default: themed({
24
- light: colors.N900,
25
- dark: colors.DN600
26
- }),
27
- help: themed({
28
- light: colors.P400,
29
- dark: colors.P300
30
- }),
31
- inverted: themed({
32
- light: colors.N0,
33
- dark: colors.DN30
34
- }),
35
- primary: themed({
36
- light: colors.B400,
37
- dark: colors.B100
38
- })
39
- };
40
- const outlineColorMap = {
41
- default: themed({
42
- light: colors.B75,
43
- dark: colors.B200
44
- }),
45
- help: themed({
46
- light: colors.P75,
47
- dark: colors.P75
48
- }),
49
- inverted: themed({
50
- light: colors.B200,
51
- dark: colors.B75
52
- }),
53
- primary: themed({
54
- light: colors.B75,
55
- dark: colors.B75
56
- })
57
- };
58
- const sizes = {
59
- small: 4,
60
- default: 8,
61
- large: 12
62
- };
63
- const spacingDivision = {
64
- comfortable: 2,
65
- cozy: 4,
66
- compact: 8
67
- };
68
-
69
- const getDimensions = ({
70
- gutter,
71
- size
72
- }) => {
73
- const val = sizes[size];
74
- const margin = val / spacingDivision[gutter];
75
- const hitslop = val + margin * 2;
76
- return css`
77
- height: ${val}px;
78
- margin-left: ${margin}px;
79
- margin-right: ${margin}px;
80
- position: relative;
81
- width: ${val}px;
82
-
83
- &::before {
84
- content: '';
85
- display: block;
86
- height: ${hitslop}px;
87
- left: -${margin}px;
88
- position: absolute;
89
- top: -${margin}px;
90
- width: ${hitslop}px;
91
- }
92
- `;
93
- };
94
-
95
- const getColor = ({
96
- appearance,
97
- selected
98
- }) => selected ? selectedColorMap[appearance] : colorMap[appearance];
99
-
100
- const commonRules = css`
101
- ${getDimensions} background-color: ${getColor};
102
- border-radius: 50%;
103
- `;
104
- export const Container = styled.div`
105
- display: flex;
106
- justify-content: center;
107
- `;
108
- export const IndicatorButton = styled.button`
109
- ${commonRules} border: 0;
110
- cursor: pointer;
111
- outline: 0;
112
- padding: 0;
113
-
114
- ${p => p.selected ? css`
115
- &:focus {
116
- box-shadow: 0 0 0 2px ${outlineColorMap[p.appearance]};
117
- }
118
- ` : null};
119
- `;
120
- export const IndicatorDiv = styled.div`
121
- ${commonRules};
122
- `;
@@ -1,178 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
- import _inherits from "@babel/runtime/helpers/inherits";
6
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
-
10
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
-
12
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
-
14
- import React, { Component } from 'react';
15
- import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
16
- import { Container, IndicatorButton, IndicatorDiv } from '../styled/Dots';
17
- var packageName = "@atlaskit/progress-indicator";
18
- var packageVersion = "9.0.5";
19
-
20
- var ProgressDots = /*#__PURE__*/function (_Component) {
21
- _inherits(ProgressDots, _Component);
22
-
23
- var _super = _createSuper(ProgressDots);
24
-
25
- function ProgressDots() {
26
- var _this;
27
-
28
- _classCallCheck(this, ProgressDots);
29
-
30
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
31
- args[_key] = arguments[_key];
32
- }
33
-
34
- _this = _super.call.apply(_super, [this].concat(args));
35
-
36
- _defineProperty(_assertThisInitialized(_this), "tablist", {
37
- children: []
38
- });
39
-
40
- _defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (event) {
41
- var _this$props = _this.props,
42
- onSelect = _this$props.onSelect,
43
- selectedIndex = _this$props.selectedIndex,
44
- values = _this$props.values;
45
- var indicators = Array.from(_this.tablist.children); // bail if the target isn't an indicator
46
-
47
- if (!indicators.includes(event.target)) {
48
- return;
49
- } // bail if not valid arrow key
50
-
51
-
52
- var isLeft = event.key === 'ArrowLeft';
53
- var isRight = event.key === 'ArrowRight';
54
-
55
- if (!isLeft && !isRight) {
56
- return;
57
- } // bail if at either end of the values
58
-
59
-
60
- var isAlpha = isLeft && selectedIndex === 0;
61
- var isOmega = isRight && selectedIndex === values.length - 1;
62
-
63
- if (isAlpha || isOmega) {
64
- return;
65
- }
66
-
67
- var index = isLeft ? selectedIndex - 1 : selectedIndex + 1; // call the consumer's select method and focus the applicable indicator
68
-
69
- if (onSelect) {
70
- onSelect({
71
- event: event,
72
- index: index
73
- });
74
- }
75
-
76
- if (typeof indicators[index].focus === 'function') {
77
- indicators[index].focus();
78
- }
79
- });
80
-
81
- return _this;
82
- }
83
-
84
- _createClass(ProgressDots, [{
85
- key: "componentDidMount",
86
- value: function componentDidMount() {
87
- if (this.props.onSelect) {
88
- document.addEventListener('keydown', this.handleKeyDown, false);
89
- }
90
- }
91
- }, {
92
- key: "componentWillUnmount",
93
- value: function componentWillUnmount() {
94
- if (this.props.onSelect) {
95
- document.removeEventListener('keydown', this.handleKeyDown);
96
- }
97
- }
98
- }, {
99
- key: "render",
100
- value: function render() {
101
- var _this2 = this;
102
-
103
- // NOTE: `spacing` is a reserved HTML attribute and will be added to the
104
- // element, replaced with `gutter`.
105
- var _this$props2 = this.props,
106
- appearance = _this$props2.appearance,
107
- ariaControls = _this$props2.ariaControls,
108
- ariaLabel = _this$props2.ariaLabel,
109
- onSelect = _this$props2.onSelect,
110
- selectedIndex = _this$props2.selectedIndex,
111
- size = _this$props2.size,
112
- gutter = _this$props2.spacing,
113
- values = _this$props2.values;
114
- return /*#__PURE__*/React.createElement(Container, {
115
- innerRef: function innerRef(r) {
116
- _this2.tablist = r;
117
- },
118
- role: "tablist"
119
- }, values.map(function (val, index) {
120
- var selected = selectedIndex === index;
121
- var common = {
122
- appearance: appearance,
123
- key: index,
124
- selected: selected,
125
- size: size,
126
- gutter: gutter
127
- };
128
- var tabId = "".concat(ariaLabel).concat(index);
129
- var panelId = "".concat(ariaControls).concat(index);
130
- return onSelect ? /*#__PURE__*/React.createElement(IndicatorButton, _extends({}, common, {
131
- "aria-controls": panelId,
132
- "aria-label": tabId,
133
- "aria-selected": selected,
134
- id: tabId,
135
- onClick: function onClick(event) {
136
- return onSelect({
137
- event: event,
138
- index: index
139
- });
140
- },
141
- role: "tab",
142
- tabIndex: selected ? 0 : -1,
143
- type: "button"
144
- })) : /*#__PURE__*/React.createElement(IndicatorDiv, _extends({}, common, {
145
- role: "presentation"
146
- }));
147
- }));
148
- }
149
- }]);
150
-
151
- return ProgressDots;
152
- }(Component);
153
-
154
- _defineProperty(ProgressDots, "defaultProps", {
155
- appearance: 'default',
156
- ariaControls: 'panel',
157
- ariaLabel: 'tab',
158
- size: 'default',
159
- spacing: 'comfortable'
160
- });
161
-
162
- export { ProgressDots as ProgressDotsWithoutAnalytics };
163
- var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
164
- export default withAnalyticsContext({
165
- componentName: 'progressIndicator',
166
- packageName: packageName,
167
- packageVersion: packageVersion
168
- })(withAnalyticsEvents({
169
- onSelect: createAndFireEventOnAtlaskit({
170
- action: 'selected',
171
- actionSubject: 'progressIndicator',
172
- attributes: {
173
- componentName: 'progressIndicator',
174
- packageName: packageName,
175
- packageVersion: packageVersion
176
- }
177
- })
178
- })(ProgressDots));
@@ -1,93 +0,0 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
-
3
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
4
-
5
- import styled, { css } from 'styled-components';
6
- import * as colors from '@atlaskit/theme/colors';
7
- import { themed } from '@atlaskit/theme/components';
8
- var colorMap = {
9
- default: themed({
10
- light: colors.N50,
11
- dark: colors.DN70
12
- }),
13
- help: themed({
14
- light: colors.P75,
15
- dark: colors.DN70
16
- }),
17
- inverted: themed({
18
- light: 'rgba(255, 255, 255, 0.4)',
19
- dark: colors.DN300A
20
- }),
21
- primary: themed({
22
- light: colors.B75,
23
- dark: colors.DN70
24
- })
25
- };
26
- var selectedColorMap = {
27
- default: themed({
28
- light: colors.N900,
29
- dark: colors.DN600
30
- }),
31
- help: themed({
32
- light: colors.P400,
33
- dark: colors.P300
34
- }),
35
- inverted: themed({
36
- light: colors.N0,
37
- dark: colors.DN30
38
- }),
39
- primary: themed({
40
- light: colors.B400,
41
- dark: colors.B100
42
- })
43
- };
44
- var outlineColorMap = {
45
- default: themed({
46
- light: colors.B75,
47
- dark: colors.B200
48
- }),
49
- help: themed({
50
- light: colors.P75,
51
- dark: colors.P75
52
- }),
53
- inverted: themed({
54
- light: colors.B200,
55
- dark: colors.B75
56
- }),
57
- primary: themed({
58
- light: colors.B75,
59
- dark: colors.B75
60
- })
61
- };
62
- var sizes = {
63
- small: 4,
64
- default: 8,
65
- large: 12
66
- };
67
- var spacingDivision = {
68
- comfortable: 2,
69
- cozy: 4,
70
- compact: 8
71
- };
72
-
73
- var getDimensions = function getDimensions(_ref) {
74
- var gutter = _ref.gutter,
75
- size = _ref.size;
76
- var val = sizes[size];
77
- var margin = val / spacingDivision[gutter];
78
- var hitslop = val + margin * 2;
79
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: ", "px;\n margin-left: ", "px;\n margin-right: ", "px;\n position: relative;\n width: ", "px;\n\n &::before {\n content: '';\n display: block;\n height: ", "px;\n left: -", "px;\n position: absolute;\n top: -", "px;\n width: ", "px;\n }\n "])), val, margin, margin, val, hitslop, margin, margin, hitslop);
80
- };
81
-
82
- var getColor = function getColor(_ref2) {
83
- var appearance = _ref2.appearance,
84
- selected = _ref2.selected;
85
- return selected ? selectedColorMap[appearance] : colorMap[appearance];
86
- };
87
-
88
- var commonRules = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", " background-color: ", ";\n border-radius: 50%;\n"])), getDimensions, getColor);
89
- export var Container = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: center;\n"])));
90
- export var IndicatorButton = styled.button(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", " border: 0;\n cursor: pointer;\n outline: 0;\n padding: 0;\n\n ", ";\n"])), commonRules, function (p) {
91
- return p.selected ? css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n &:focus {\n box-shadow: 0 0 0 2px ", ";\n }\n "])), outlineColorMap[p.appearance]) : null;
92
- });
93
- export var IndicatorDiv = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", ";\n"])), commonRules);