@instructure/ui-pagination 8.13.1-snapshot.10 → 8.13.1-snapshot.22

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 (52) hide show
  1. package/es/Pagination/PaginationArrowButton/index.js +36 -4
  2. package/es/Pagination/PaginationArrowButton/props.js +1 -1
  3. package/es/Pagination/PaginationLocator.js +4 -0
  4. package/es/Pagination/PaginationPageInput/PaginationPageInputLocator.js +35 -0
  5. package/es/Pagination/PaginationPageInput/index.js +208 -0
  6. package/es/Pagination/PaginationPageInput/props.js +35 -0
  7. package/es/Pagination/PaginationPageInput/styles.js +55 -0
  8. package/es/Pagination/PaginationPageInput/theme.js +40 -0
  9. package/es/Pagination/index.js +178 -52
  10. package/es/Pagination/props.js +32 -2
  11. package/lib/Pagination/PaginationArrowButton/index.js +39 -3
  12. package/lib/Pagination/PaginationArrowButton/props.js +1 -1
  13. package/lib/Pagination/PaginationLocator.js +5 -0
  14. package/lib/Pagination/PaginationPageInput/PaginationPageInputLocator.js +46 -0
  15. package/lib/Pagination/PaginationPageInput/index.js +200 -0
  16. package/lib/Pagination/PaginationPageInput/props.js +46 -0
  17. package/lib/Pagination/PaginationPageInput/styles.js +63 -0
  18. package/lib/Pagination/PaginationPageInput/theme.js +48 -0
  19. package/lib/Pagination/index.js +179 -52
  20. package/lib/Pagination/props.js +32 -2
  21. package/package.json +23 -21
  22. package/src/Pagination/PaginationArrowButton/index.tsx +32 -4
  23. package/src/Pagination/PaginationArrowButton/props.ts +6 -4
  24. package/src/Pagination/PaginationLocator.ts +5 -1
  25. package/src/Pagination/PaginationPageInput/PaginationPageInputLocator.ts +42 -0
  26. package/src/Pagination/PaginationPageInput/index.tsx +224 -0
  27. package/src/Pagination/PaginationPageInput/props.ts +106 -0
  28. package/src/Pagination/PaginationPageInput/styles.ts +60 -0
  29. package/src/Pagination/PaginationPageInput/theme.ts +46 -0
  30. package/src/Pagination/README.md +116 -0
  31. package/src/Pagination/index.tsx +215 -79
  32. package/src/Pagination/props.ts +53 -4
  33. package/types/Pagination/PaginationArrowButton/index.d.ts +7 -4
  34. package/types/Pagination/PaginationArrowButton/index.d.ts.map +1 -1
  35. package/types/Pagination/PaginationArrowButton/props.d.ts +4 -3
  36. package/types/Pagination/PaginationArrowButton/props.d.ts.map +1 -1
  37. package/types/Pagination/PaginationLocator.d.ts +717 -7
  38. package/types/Pagination/PaginationLocator.d.ts.map +1 -1
  39. package/types/Pagination/PaginationPageInput/PaginationPageInputLocator.d.ts +581 -0
  40. package/types/Pagination/PaginationPageInput/PaginationPageInputLocator.d.ts.map +1 -0
  41. package/types/Pagination/PaginationPageInput/index.d.ts +63 -0
  42. package/types/Pagination/PaginationPageInput/index.d.ts.map +1 -0
  43. package/types/Pagination/PaginationPageInput/props.d.ts +46 -0
  44. package/types/Pagination/PaginationPageInput/props.d.ts.map +1 -0
  45. package/types/Pagination/PaginationPageInput/styles.d.ts +15 -0
  46. package/types/Pagination/PaginationPageInput/styles.d.ts.map +1 -0
  47. package/types/Pagination/PaginationPageInput/theme.d.ts +10 -0
  48. package/types/Pagination/PaginationPageInput/theme.d.ts.map +1 -0
  49. package/types/Pagination/index.d.ts +52 -14
  50. package/types/Pagination/index.d.ts.map +1 -1
  51. package/types/Pagination/props.d.ts +13 -3
  52. package/types/Pagination/props.d.ts.map +1 -1
@@ -30,7 +30,7 @@ import React, { Component } from 'react';
30
30
  import { IconButton } from '@instructure/ui-buttons';
31
31
  import { PresentationContent } from '@instructure/ui-a11y-content';
32
32
  import { Tooltip } from '@instructure/ui-tooltip';
33
- import { IconArrowOpenStartSolid, IconArrowOpenEndSolid } from '@instructure/ui-icons';
33
+ import { IconArrowOpenStartSolid, IconArrowOpenEndSolid, IconArrowDoubleStartSolid, IconArrowDoubleEndSolid } from '@instructure/ui-icons';
34
34
  import { testable } from '@instructure/ui-testable';
35
35
  import { allowedProps, propTypes } from './props';
36
36
  /**
@@ -50,6 +50,38 @@ let PaginationArrowButton = (_dec = testable(), _dec(_class = (_temp = _class2 =
50
50
  };
51
51
  }
52
52
 
53
+ get margin() {
54
+ switch (this.props.direction) {
55
+ case 'first':
56
+ return '0 xx-small 0 0';
57
+
58
+ case 'last':
59
+ return '0 0 0 xx-small';
60
+
61
+ default:
62
+ return void 0;
63
+ }
64
+ }
65
+
66
+ get Icon() {
67
+ switch (this.props.direction) {
68
+ case 'first':
69
+ return IconArrowDoubleStartSolid;
70
+
71
+ case 'prev':
72
+ return IconArrowOpenStartSolid;
73
+
74
+ case 'next':
75
+ return IconArrowOpenEndSolid;
76
+
77
+ case 'last':
78
+ return IconArrowDoubleEndSolid;
79
+
80
+ default:
81
+ return null;
82
+ }
83
+ }
84
+
53
85
  render() {
54
86
  const _this$props = this.props,
55
87
  label = _this$props.label,
@@ -57,7 +89,6 @@ let PaginationArrowButton = (_dec = testable(), _dec(_class = (_temp = _class2 =
57
89
  buttonRef = _this$props.buttonRef,
58
90
  props = _objectWithoutProperties(_this$props, _excluded);
59
91
 
60
- const Icon = direction === 'prev' ? IconArrowOpenStartSolid : IconArrowOpenEndSolid;
61
92
  return /*#__PURE__*/React.createElement(Tooltip, {
62
93
  on: ['hover', 'focus'],
63
94
  renderTip: /*#__PURE__*/React.createElement(PresentationContent, {
@@ -69,8 +100,9 @@ let PaginationArrowButton = (_dec = testable(), _dec(_class = (_temp = _class2 =
69
100
  withBorder: false,
70
101
  screenReaderLabel: label,
71
102
  rel: props.href || props.to ? direction : void 0,
72
- elementRef: buttonRef
73
- }), Icon));
103
+ elementRef: buttonRef,
104
+ margin: this.margin
105
+ }), this.Icon));
74
106
  }
75
107
 
76
108
  }, _class2.displayName = "PaginationArrowButton", _class2.componentId = 'Pagination.Navigation', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
@@ -23,7 +23,7 @@
23
23
  */
24
24
  import PropTypes from 'prop-types';
25
25
  const propTypes = {
26
- direction: PropTypes.oneOf(['next', 'prev']),
26
+ direction: PropTypes.oneOf(['first', 'prev', 'next', 'last']),
27
27
  label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
28
28
  buttonRef: PropTypes.func
29
29
  };
@@ -22,6 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
  import { locator } from '@instructure/ui-test-locator';
25
+ import { PaginationPageInputLocator } from './PaginationPageInput/PaginationPageInputLocator';
25
26
  import { PaginationArrowButtonLocator } from './PaginationArrowButton/PaginationArrowButtonLocator';
26
27
  import { Pagination } from './index';
27
28
  const PaginationButtonLocator = locator(Pagination.Page.selector);
@@ -34,5 +35,8 @@ export const PaginationLocator = locator(Pagination.selector, {
34
35
  },
35
36
  findArrowButton: async function () {
36
37
  return PaginationArrowButtonLocator.find(...arguments);
38
+ },
39
+ findPageInput: async function () {
40
+ return PaginationPageInputLocator.find(...arguments);
37
41
  }
38
42
  });
@@ -0,0 +1,35 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ import { locator } from '@instructure/ui-test-locator';
25
+ import { NumberInputLocator } from '@instructure/ui-number-input/es/NumberInput/NumberInputLocator'; // eslint-disable-line no-restricted-imports
26
+
27
+ import { PaginationPageInput } from './index';
28
+ export const PaginationPageInputLocator = locator(PaginationPageInput.selector, {
29
+ findInput: function () {
30
+ return NumberInputLocator.findInput(...arguments);
31
+ },
32
+ findNumberInputArrows: function () {
33
+ return NumberInputLocator.findArrowButtons(...arguments);
34
+ }
35
+ });
@@ -0,0 +1,208 @@
1
+ var _dec, _dec2, _class, _class2, _temp;
2
+
3
+ /*
4
+ * The MIT License (MIT)
5
+ *
6
+ * Copyright (c) 2015 - present Instructure, Inc.
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ */
26
+
27
+ /** @jsx jsx */
28
+ import { Component } from 'react';
29
+ import { testable } from '@instructure/ui-testable';
30
+ import { withStyle, jsx } from '@instructure/emotion';
31
+ import { NumberInput } from '@instructure/ui-number-input';
32
+ import { ScreenReaderContent } from '@instructure/ui-a11y-content';
33
+ import generateStyle from './styles';
34
+ import generateComponentTheme from './theme';
35
+ import { propTypes, allowedProps } from './props';
36
+
37
+ /**
38
+ ---
39
+ parent: Pagination
40
+ id: Pagination.PageInput
41
+ ---
42
+ @tsProps
43
+ **/
44
+ let PaginationPageInput = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_temp = _class2 = class PaginationPageInput extends Component {
45
+ constructor(props) {
46
+ super(props);
47
+ this.ref = null;
48
+ this._inputRef = null;
49
+
50
+ this.handleRef = el => {
51
+ this.ref = el;
52
+ };
53
+
54
+ this.handleInputRef = el => {
55
+ this._inputRef = el;
56
+
57
+ if (typeof this.props.inputRef === 'function') {
58
+ this.props.inputRef(el);
59
+ }
60
+ };
61
+
62
+ this.handleChange = (_event, value) => {
63
+ let newValue = value; // if the last character was not a number, don't accept it
64
+
65
+ if (value.length > 0 && isNaN(value.slice(-1))) {
66
+ newValue = value.slice(0, -1);
67
+ }
68
+
69
+ this.setState({
70
+ number: newValue ? Number(newValue) : this.MIN,
71
+ value: newValue
72
+ });
73
+ };
74
+
75
+ this.handleDecrement = event => {
76
+ this.setNewPage(event, Math.floor(this.currentPage - 1));
77
+ };
78
+
79
+ this.handleIncrement = event => {
80
+ this.setNewPage(event, Math.floor(this.currentPage + 1));
81
+ };
82
+
83
+ this.handleBlur = event => {
84
+ this.setNewPage(event, Math.round(this.state.number));
85
+ };
86
+
87
+ this.state = this.initialState;
88
+ }
89
+
90
+ get currentPage() {
91
+ return this.props.currentPageIndex + 1;
92
+ }
93
+
94
+ get initialState() {
95
+ return {
96
+ number: this.currentPage,
97
+ value: `${this.currentPage}`
98
+ };
99
+ }
100
+
101
+ get MIN() {
102
+ return 1;
103
+ }
104
+
105
+ get MAX() {
106
+ return this.props.numberOfPages;
107
+ }
108
+
109
+ componentDidMount() {
110
+ var _this$props$makeStyle, _this$props;
111
+
112
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
113
+ }
114
+
115
+ componentDidUpdate(prevProps) {
116
+ var _this$props$makeStyle2, _this$props2;
117
+
118
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2); // when the current page changes from outside (e.g.: from arrow buttons),
119
+ // we update the initial state
120
+
121
+ if (this.props.currentPageIndex !== prevProps.currentPageIndex) {
122
+ this.resetInitialState();
123
+ }
124
+ }
125
+
126
+ resetInitialState() {
127
+ this.setState(this.initialState);
128
+ }
129
+
130
+ handleKeyDown(event) {
131
+ const key = event.key;
132
+
133
+ if (key.toLowerCase() === 'enter') {
134
+ const _this$state = this.state,
135
+ value = _this$state.value,
136
+ number = _this$state.number; // If it is invalid, we reset the input to the current page
137
+
138
+ if (value === '' || isNaN(value)) {
139
+ this.resetInitialState();
140
+ return;
141
+ }
142
+
143
+ this.setNewPage(event, number);
144
+ }
145
+ }
146
+
147
+ getNumberWithinRange(n) {
148
+ if (n < this.MIN) return this.MIN;
149
+ if (n > this.MAX) return this.MAX;
150
+ return n;
151
+ }
152
+
153
+ setNewPage(event, n) {
154
+ const number = this.getNumberWithinRange(n);
155
+ this.setState({
156
+ number,
157
+ value: `${number}`
158
+ });
159
+ this.props.onChange(event, number - 1);
160
+ }
161
+
162
+ renderLabel() {
163
+ const _this$props3 = this.props,
164
+ label = _this$props3.label,
165
+ numberOfPages = _this$props3.numberOfPages,
166
+ styles = _this$props3.styles;
167
+ return typeof label === 'function' && label(numberOfPages) ? jsx("span", {
168
+ css: styles === null || styles === void 0 ? void 0 : styles.inputLabel
169
+ }, label(numberOfPages)) : null;
170
+ }
171
+
172
+ renderScreenReaderLabel() {
173
+ const _this$props4 = this.props,
174
+ screenReaderLabel = _this$props4.screenReaderLabel,
175
+ numberOfPages = _this$props4.numberOfPages;
176
+ return jsx(ScreenReaderContent, null, screenReaderLabel(this.currentPage, numberOfPages));
177
+ }
178
+
179
+ render() {
180
+ const _this$props5 = this.props,
181
+ styles = _this$props5.styles,
182
+ disabled = _this$props5.disabled;
183
+ return jsx("span", {
184
+ css: styles === null || styles === void 0 ? void 0 : styles.paginationPageInput,
185
+ ref: this.handleRef
186
+ }, jsx("span", {
187
+ css: styles === null || styles === void 0 ? void 0 : styles.numberInput
188
+ }, jsx(NumberInput, {
189
+ renderLabel: this.renderScreenReaderLabel(),
190
+ onBlur: this.handleBlur,
191
+ onChange: this.handleChange,
192
+ onDecrement: this.handleDecrement,
193
+ onIncrement: this.handleIncrement,
194
+ onKeyDown: this.handleKeyDown.bind(this),
195
+ interaction: disabled ? 'disabled' : 'enabled',
196
+ showArrows: false,
197
+ value: this.state.value,
198
+ width: "100%",
199
+ textAlign: "center",
200
+ inputRef: this.handleInputRef
201
+ })), this.renderLabel());
202
+ }
203
+
204
+ }, _class2.displayName = "PaginationPageInput", _class2.componentId = 'Pagination.PageInput', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
205
+ disabled: false
206
+ }, _temp)) || _class) || _class);
207
+ export default PaginationPageInput;
208
+ export { PaginationPageInput };
@@ -0,0 +1,35 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ import PropTypes from 'prop-types';
25
+ const propTypes = {
26
+ numberOfPages: PropTypes.number.isRequired,
27
+ currentPageIndex: PropTypes.number.isRequired,
28
+ onChange: PropTypes.func.isRequired,
29
+ screenReaderLabel: PropTypes.func.isRequired,
30
+ label: PropTypes.func,
31
+ disabled: PropTypes.bool,
32
+ inputRef: PropTypes.func
33
+ };
34
+ const allowedProps = ['numberOfPages', 'currentPageIndex', 'onChange', 'screenReaderLabel', 'label', 'disabled', 'inputRef'];
35
+ export { propTypes, allowedProps };
@@ -0,0 +1,55 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ /**
26
+ * ---
27
+ * private: true
28
+ * ---
29
+ * Generates the style object from the theme and provided additional information
30
+ * @param {Object} componentTheme The theme variable object.
31
+ * @param {Object} props the props of the component, the style is applied to
32
+ * @param {Object} state the state of the component, the style is applied to
33
+ * @return {Object} The final style object, which will be used in the component
34
+ */
35
+ const generateStyle = componentTheme => {
36
+ return {
37
+ paginationPageInput: {
38
+ label: 'paginationPageInput',
39
+ display: 'inline-flex',
40
+ alignItems: 'center',
41
+ margin: `0 ${componentTheme.inputSpacing}`
42
+ },
43
+ numberInput: {
44
+ label: 'paginationPageInput__input',
45
+ width: componentTheme.inputWidth
46
+ },
47
+ inputLabel: {
48
+ label: 'paginationPageInput__inputLabel',
49
+ marginInlineStart: componentTheme.inputSpacing,
50
+ whiteSpace: 'nowrap'
51
+ }
52
+ };
53
+ };
54
+
55
+ export default generateStyle;
@@ -0,0 +1,40 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ /**
26
+ * Generates the theme object for the component from the theme and provided additional information
27
+ * @param {Object} theme The actual theme object.
28
+ * @return {Object} The final theme object with the overrides and component variables
29
+ */
30
+ const generateComponentTheme = theme => {
31
+ const spacing = theme.spacing;
32
+ const componentVariables = {
33
+ inputSpacing: spacing.xSmall,
34
+ inputWidth: '4.5rem'
35
+ };
36
+ return { ...componentVariables
37
+ };
38
+ };
39
+
40
+ export default generateComponentTheme;