@instructure/ui-buttons 8.8.1-snapshot.7 → 8.9.1-snapshot.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/es/BaseButton/index.js +12 -133
- package/es/BaseButton/props.js +138 -0
- package/es/Button/index.js +4 -87
- package/es/Button/props.js +107 -0
- package/es/CloseButton/index.js +5 -93
- package/es/CloseButton/props.js +103 -0
- package/es/CondensedButton/index.js +4 -65
- package/es/CondensedButton/props.js +86 -0
- package/es/IconButton/index.js +4 -91
- package/es/IconButton/props.js +111 -0
- package/es/ToggleButton/index.js +2 -77
- package/es/ToggleButton/props.js +100 -0
- package/lib/BaseButton/index.js +12 -133
- package/lib/BaseButton/props.js +150 -0
- package/lib/Button/index.js +4 -87
- package/lib/Button/props.js +119 -0
- package/lib/CloseButton/index.js +5 -93
- package/lib/CloseButton/props.js +115 -0
- package/lib/CondensedButton/index.js +4 -65
- package/lib/CondensedButton/props.js +98 -0
- package/lib/IconButton/index.js +4 -91
- package/lib/IconButton/props.js +123 -0
- package/lib/ToggleButton/index.js +3 -79
- package/lib/ToggleButton/props.js +112 -0
- package/package.json +21 -21
- package/src/BaseButton/index.tsx +15 -120
- package/src/BaseButton/props.ts +192 -0
- package/src/BaseButton/styles.ts +1 -1
- package/src/Button/index.tsx +7 -81
- package/src/Button/props.ts +149 -0
- package/src/CloseButton/index.tsx +8 -82
- package/src/CloseButton/props.ts +137 -0
- package/src/CloseButton/styles.ts +1 -1
- package/src/CondensedButton/index.tsx +7 -57
- package/src/CondensedButton/props.ts +118 -0
- package/src/IconButton/index.tsx +7 -84
- package/src/IconButton/props.ts +154 -0
- package/src/ToggleButton/index.tsx +5 -68
- package/src/ToggleButton/props.ts +140 -0
- package/src/index.ts +6 -6
- package/types/BaseButton/index.d.ts +47 -101
- package/types/BaseButton/index.d.ts.map +1 -1
- package/types/BaseButton/{types.d.ts → props.d.ts} +15 -10
- package/types/BaseButton/props.d.ts.map +1 -0
- package/types/BaseButton/styles.d.ts +1 -1
- package/types/Button/index.d.ts +36 -73
- package/types/Button/index.d.ts.map +1 -1
- package/types/Button/{types.d.ts → props.d.ts} +12 -4
- package/types/Button/props.d.ts.map +1 -0
- package/types/CloseButton/index.d.ts +41 -75
- package/types/CloseButton/index.d.ts.map +1 -1
- package/types/CloseButton/props.d.ts +27 -0
- package/types/CloseButton/props.d.ts.map +1 -0
- package/types/CloseButton/styles.d.ts +1 -1
- package/types/CondensedButton/index.d.ts +28 -55
- package/types/CondensedButton/index.d.ts.map +1 -1
- package/types/CondensedButton/props.d.ts +24 -0
- package/types/CondensedButton/props.d.ts.map +1 -0
- package/types/IconButton/index.d.ts +38 -76
- package/types/IconButton/index.d.ts.map +1 -1
- package/types/IconButton/{types.d.ts → props.d.ts} +11 -3
- package/types/IconButton/props.d.ts.map +1 -0
- package/types/ToggleButton/index.d.ts +34 -65
- package/types/ToggleButton/index.d.ts.map +1 -1
- package/types/ToggleButton/{types.d.ts → props.d.ts} +10 -3
- package/types/ToggleButton/props.d.ts.map +1 -0
- package/types/index.d.ts +6 -6
- package/es/BaseButton/types.js +0 -1
- package/es/Button/types.js +0 -1
- package/es/CloseButton/types.js +0 -1
- package/es/CondensedButton/types.js +0 -1
- package/es/IconButton/types.js +0 -1
- package/es/ToggleButton/types.js +0 -1
- package/lib/BaseButton/types.js +0 -1
- package/lib/Button/types.js +0 -1
- package/lib/CloseButton/types.js +0 -1
- package/lib/CondensedButton/types.js +0 -1
- package/lib/IconButton/types.js +0 -1
- package/lib/ToggleButton/types.js +0 -1
- package/src/BaseButton/types.ts +0 -58
- package/src/Button/types.ts +0 -44
- package/src/CloseButton/types.ts +0 -45
- package/src/CondensedButton/types.ts +0 -40
- package/src/IconButton/types.ts +0 -45
- package/src/ToggleButton/types.ts +0 -48
- package/types/BaseButton/types.d.ts.map +0 -1
- package/types/Button/types.d.ts.map +0 -1
- package/types/CloseButton/types.d.ts +0 -22
- package/types/CloseButton/types.d.ts.map +0 -1
- package/types/CondensedButton/types.d.ts +0 -16
- package/types/CondensedButton/types.d.ts.map +0 -1
- package/types/IconButton/types.d.ts.map +0 -1
- package/types/ToggleButton/types.d.ts.map +0 -1
|
@@ -0,0 +1,107 @@
|
|
|
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
|
+
import { ThemeablePropTypes } from '@instructure/emotion';
|
|
26
|
+
const propTypes = {
|
|
27
|
+
/**
|
|
28
|
+
* Specifies the `Button` children.
|
|
29
|
+
*/
|
|
30
|
+
children: PropTypes.node,
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Specifies the type of the `Button`'s underlying html element.
|
|
34
|
+
*/
|
|
35
|
+
type: PropTypes.oneOf(['button', 'submit', 'reset']),
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The size of the `Button`
|
|
39
|
+
*/
|
|
40
|
+
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Provides a reference to the `Button`'s underlying html element.
|
|
44
|
+
*/
|
|
45
|
+
elementRef: PropTypes.func,
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The element to render as the component root, `Button` by default.
|
|
49
|
+
*/
|
|
50
|
+
as: PropTypes.elementType,
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Specifies if interaction with the `Button` is enabled, disabled, or readonly.
|
|
54
|
+
*/
|
|
55
|
+
interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Specifies the color for the `Button`.
|
|
59
|
+
*/
|
|
60
|
+
color: PropTypes.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger']),
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Override the `Button`'s default focus outline color.
|
|
64
|
+
*/
|
|
65
|
+
focusColor: PropTypes.oneOf(['info', 'inverse']),
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The `Button` display property. When set to `inline-block`, the `Button` displays inline with other elements.
|
|
69
|
+
* When set to block, the `Button` expands to fill the width of the container.
|
|
70
|
+
*/
|
|
71
|
+
display: PropTypes.oneOf(['inline-block', 'block']),
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Sets the alignment of the `Button` children and/or icon.
|
|
75
|
+
*/
|
|
76
|
+
textAlign: PropTypes.oneOf(['start', 'center']),
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Specifies if the `Button` should render with a solid background. When false, the background is transparent.
|
|
80
|
+
*/
|
|
81
|
+
withBackground: PropTypes.bool,
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
85
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
86
|
+
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
87
|
+
*/
|
|
88
|
+
margin: ThemeablePropTypes.spacing,
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Specify a mouse cursor to use when hovering over the button.
|
|
92
|
+
* The `pointer` cursor is used by default.
|
|
93
|
+
*/
|
|
94
|
+
cursor: PropTypes.string,
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Specifies an href attribute for the `Button`'s underlying html element.
|
|
98
|
+
*/
|
|
99
|
+
href: PropTypes.string,
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* An icon, or function that returns an icon.
|
|
103
|
+
*/
|
|
104
|
+
renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
|
|
105
|
+
};
|
|
106
|
+
const allowedProps = ['as', 'children', 'color', 'cursor', 'display', 'elementRef', 'focusColor', 'href', 'interaction', 'margin', 'renderIcon', 'size', 'textAlign', 'type', 'withBackground'];
|
|
107
|
+
export { propTypes, allowedProps };
|
package/es/CloseButton/index.js
CHANGED
|
@@ -29,15 +29,15 @@ var _dec, _dec2, _class, _class2, _temp;
|
|
|
29
29
|
|
|
30
30
|
/** @jsx jsx */
|
|
31
31
|
import { Component } from 'react';
|
|
32
|
-
import PropTypes from 'prop-types';
|
|
33
32
|
import { IconXSolid } from '@instructure/ui-icons';
|
|
34
33
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
35
34
|
import { testable } from '@instructure/ui-testable';
|
|
36
35
|
import { getInteraction, passthroughProps } from '@instructure/ui-react-utils';
|
|
37
|
-
import { withStyle, jsx
|
|
36
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
38
37
|
import generateStyle from './styles';
|
|
39
38
|
import generateComponentTheme from './theme';
|
|
40
39
|
import { BaseButton } from '../BaseButton';
|
|
40
|
+
import { propTypes, allowedProps } from './props';
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
---
|
|
@@ -82,7 +82,7 @@ let CloseButton = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
82
82
|
props = _objectWithoutProperties(_this$props, _excluded);
|
|
83
83
|
|
|
84
84
|
return jsx("span", Object.assign({}, passthroughProps(props), {
|
|
85
|
-
css: styles.closeButton
|
|
85
|
+
css: styles === null || styles === void 0 ? void 0 : styles.closeButton
|
|
86
86
|
}), jsx(BaseButton, {
|
|
87
87
|
renderIcon: IconXSolid,
|
|
88
88
|
elementRef: elementRef,
|
|
@@ -101,104 +101,16 @@ let CloseButton = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
101
101
|
}, jsx(ScreenReaderContent, null, screenReaderLabel)));
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
}, _class2.displayName = "CloseButton", _class2.componentId = 'CloseButton', _class2.propTypes = {
|
|
105
|
-
// eslint-disable-next-line react/require-default-props
|
|
106
|
-
makeStyles: PropTypes.func,
|
|
107
|
-
// eslint-disable-next-line react/require-default-props
|
|
108
|
-
styles: PropTypes.object,
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* An accessible label for the `CloseButton` (required)
|
|
112
|
-
*/
|
|
113
|
-
screenReaderLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Specifies the color for the `CloseButton`.
|
|
117
|
-
*/
|
|
118
|
-
color: PropTypes.oneOf(['primary', 'primary-inverse']),
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Specifies if interaction with the `CloseButton` is enabled, disabled, or readonly.
|
|
122
|
-
*/
|
|
123
|
-
interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Provides a reference to the `CloseButton`'s underlying html element.
|
|
127
|
-
*/
|
|
128
|
-
elementRef: PropTypes.func,
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* The size of the `CloseButton`
|
|
132
|
-
*/
|
|
133
|
-
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Callback fired when the `CloseButton` is clicked.
|
|
137
|
-
*/
|
|
138
|
-
onClick: PropTypes.func,
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
142
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
143
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
144
|
-
*/
|
|
145
|
-
margin: ThemeablePropTypes.spacing,
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Specifies the placement of the `CloseButton`
|
|
149
|
-
*/
|
|
150
|
-
placement: PropTypes.oneOf(['start', 'end', 'static']),
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Specifies the offset distance for the `CloseButton` with respect to both the top and start/end of the container.
|
|
154
|
-
* Note that for this property to have an effect, the `placement` prop must be set to either `start` or `end`. The
|
|
155
|
-
* offset will also be created with respect to a positioned parent. If it does not appear to be working, try setting
|
|
156
|
-
* the `position` of the parent container to `relative`.
|
|
157
|
-
*/
|
|
158
|
-
offset: PropTypes.oneOf(['none', 'x-small', 'small', 'medium']),
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Specifies the type of the `Button`'s underlying html element.
|
|
162
|
-
*/
|
|
163
|
-
type: PropTypes.oneOf(['button', 'submit', 'reset']),
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* The element to render as the component root, `CloseButton` by default.
|
|
167
|
-
*/
|
|
168
|
-
as: PropTypes.elementType,
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Specifies an href attribute for the `CloseButton`'s underlying html element.
|
|
172
|
-
*/
|
|
173
|
-
href: PropTypes.string,
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Specify a mouse cursor to use when hovering over the `CloseButton`.
|
|
177
|
-
*/
|
|
178
|
-
cursor: PropTypes.string,
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Specifies the tabindex of the `CloseButton`.
|
|
182
|
-
*/
|
|
183
|
-
tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
184
|
-
}, _class2.defaultProps = {
|
|
185
|
-
screenReaderLabel: void 0,
|
|
104
|
+
}, _class2.displayName = "CloseButton", _class2.componentId = 'CloseButton', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
186
105
|
onClick: event => {},
|
|
187
|
-
elementRef: void 0,
|
|
188
|
-
color: void 0,
|
|
189
106
|
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
190
|
-
interaction: void 0,
|
|
191
|
-
disabled: void 0,
|
|
192
|
-
readOnly: void 0,
|
|
193
107
|
type: 'button',
|
|
194
108
|
placement: 'static',
|
|
195
109
|
offset: 'x-small',
|
|
196
110
|
size: 'small',
|
|
197
111
|
margin: '0',
|
|
198
112
|
as: 'button',
|
|
199
|
-
|
|
200
|
-
cursor: 'pointer',
|
|
201
|
-
tabIndex: void 0
|
|
113
|
+
cursor: 'pointer'
|
|
202
114
|
}, _temp)) || _class) || _class);
|
|
203
115
|
export default CloseButton;
|
|
204
116
|
export { CloseButton };
|
|
@@ -0,0 +1,103 @@
|
|
|
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
|
+
import { ThemeablePropTypes } from '@instructure/emotion';
|
|
26
|
+
const propTypes = {
|
|
27
|
+
/**
|
|
28
|
+
* An accessible label for the `CloseButton` (required)
|
|
29
|
+
*/
|
|
30
|
+
screenReaderLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired,
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Specifies the color for the `CloseButton`.
|
|
34
|
+
*/
|
|
35
|
+
color: PropTypes.oneOf(['primary', 'primary-inverse']),
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Specifies if interaction with the `CloseButton` is enabled, disabled, or readonly.
|
|
39
|
+
*/
|
|
40
|
+
interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Provides a reference to the `CloseButton`'s underlying html element.
|
|
44
|
+
*/
|
|
45
|
+
elementRef: PropTypes.func,
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The size of the `CloseButton`
|
|
49
|
+
*/
|
|
50
|
+
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Callback fired when the `CloseButton` is clicked.
|
|
54
|
+
*/
|
|
55
|
+
onClick: PropTypes.func,
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
59
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
60
|
+
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
61
|
+
*/
|
|
62
|
+
margin: ThemeablePropTypes.spacing,
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Specifies the placement of the `CloseButton`
|
|
66
|
+
*/
|
|
67
|
+
placement: PropTypes.oneOf(['start', 'end', 'static']),
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Specifies the offset distance for the `CloseButton` with respect to both the top and start/end of the container.
|
|
71
|
+
* Note that for this property to have an effect, the `placement` prop must be set to either `start` or `end`. The
|
|
72
|
+
* offset will also be created with respect to a positioned parent. If it does not appear to be working, try setting
|
|
73
|
+
* the `position` of the parent container to `relative`.
|
|
74
|
+
*/
|
|
75
|
+
offset: PropTypes.oneOf(['none', 'x-small', 'small', 'medium']),
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Specifies the type of the `Button`'s underlying html element.
|
|
79
|
+
*/
|
|
80
|
+
type: PropTypes.oneOf(['button', 'submit', 'reset']),
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The element to render as the component root, `CloseButton` by default.
|
|
84
|
+
*/
|
|
85
|
+
as: PropTypes.elementType,
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Specifies an href attribute for the `CloseButton`'s underlying html element.
|
|
89
|
+
*/
|
|
90
|
+
href: PropTypes.string,
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Specify a mouse cursor to use when hovering over the `CloseButton`.
|
|
94
|
+
*/
|
|
95
|
+
cursor: PropTypes.string,
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Specifies the tabindex of the `CloseButton`.
|
|
99
|
+
*/
|
|
100
|
+
tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
101
|
+
};
|
|
102
|
+
const allowedProps = ['as', 'color', 'cursor', 'elementRef', 'href', 'interaction', 'margin', 'offset', 'onClick', 'placement', 'screenReaderLabel', 'size', 'tabIndex', 'type'];
|
|
103
|
+
export { propTypes, allowedProps };
|
|
@@ -27,12 +27,12 @@ var _dec, _dec2, _class, _class2, _temp;
|
|
|
27
27
|
* SOFTWARE.
|
|
28
28
|
*/
|
|
29
29
|
import React, { Component } from 'react';
|
|
30
|
-
import PropTypes from 'prop-types';
|
|
31
30
|
import { testable } from '@instructure/ui-testable';
|
|
32
31
|
import { passthroughProps } from '@instructure/ui-react-utils';
|
|
33
|
-
import { withStyle
|
|
32
|
+
import { withStyle } from '@instructure/emotion';
|
|
34
33
|
import generateComponentTheme from './theme';
|
|
35
34
|
import { BaseButton } from '../BaseButton';
|
|
35
|
+
import { propTypes, allowedProps } from './props';
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
---
|
|
@@ -92,77 +92,16 @@ let CondensedButton = (_dec = withStyle(null, generateComponentTheme), _dec2 = t
|
|
|
92
92
|
}), children);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
}, _class2.displayName = "CondensedButton", _class2.componentId = 'CondensedButton', _class2.propTypes = {
|
|
96
|
-
/**
|
|
97
|
-
* Specifies the `CondensedButton` children.
|
|
98
|
-
*/
|
|
99
|
-
children: PropTypes.node,
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Specifies the type of the `CondensedButton`'s underlying html element.
|
|
103
|
-
*/
|
|
104
|
-
type: PropTypes.oneOf(['button', 'submit', 'reset']),
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* The size of the `CondensedButton`
|
|
108
|
-
*/
|
|
109
|
-
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Provides a reference to the `CondensedButton`'s underlying html element.
|
|
113
|
-
*/
|
|
114
|
-
elementRef: PropTypes.func,
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* The element to render as the component root, `button` by default.
|
|
118
|
-
*/
|
|
119
|
-
as: PropTypes.elementType,
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Specifies if interaction with the `CondensedButton` is enabled, disabled, or readonly.
|
|
123
|
-
*/
|
|
124
|
-
interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Specifies the color for the `CondensedButton`.
|
|
128
|
-
*/
|
|
129
|
-
color: PropTypes.oneOf(['primary', 'primary-inverse']),
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
133
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
134
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
135
|
-
*/
|
|
136
|
-
margin: ThemeablePropTypes.spacing,
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Specify a mouse cursor to use when hovering over the button.
|
|
140
|
-
* The `pointer` cursor is used by default.
|
|
141
|
-
*/
|
|
142
|
-
cursor: PropTypes.string,
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Specifies an href attribute for the `CondensedButton`'s underlying html element.
|
|
146
|
-
*/
|
|
147
|
-
href: PropTypes.string,
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* An icon, or function that returns an icon.
|
|
151
|
-
*/
|
|
152
|
-
renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
|
|
153
|
-
}, _class2.defaultProps = {
|
|
95
|
+
}, _class2.displayName = "CondensedButton", _class2.componentId = 'CondensedButton', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
|
|
154
96
|
children: null,
|
|
155
97
|
type: 'button',
|
|
156
98
|
size: 'medium',
|
|
157
99
|
elementRef: el => {},
|
|
158
100
|
as: 'button',
|
|
159
101
|
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
160
|
-
interaction: void 0,
|
|
161
102
|
color: 'primary',
|
|
162
103
|
margin: '0',
|
|
163
|
-
cursor: 'pointer'
|
|
164
|
-
href: void 0,
|
|
165
|
-
renderIcon: void 0
|
|
104
|
+
cursor: 'pointer'
|
|
166
105
|
}, _temp)) || _class) || _class);
|
|
167
106
|
export default CondensedButton;
|
|
168
107
|
export { CondensedButton };
|
|
@@ -0,0 +1,86 @@
|
|
|
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
|
+
import { ThemeablePropTypes } from '@instructure/emotion';
|
|
26
|
+
const propTypes = {
|
|
27
|
+
/**
|
|
28
|
+
* Specifies the `CondensedButton` children.
|
|
29
|
+
*/
|
|
30
|
+
children: PropTypes.node,
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Specifies the type of the `CondensedButton`'s underlying html element.
|
|
34
|
+
*/
|
|
35
|
+
type: PropTypes.oneOf(['button', 'submit', 'reset']),
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The size of the `CondensedButton`
|
|
39
|
+
*/
|
|
40
|
+
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Provides a reference to the `CondensedButton`'s underlying html element.
|
|
44
|
+
*/
|
|
45
|
+
elementRef: PropTypes.func,
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The element to render as the component root, `button` by default.
|
|
49
|
+
*/
|
|
50
|
+
as: PropTypes.elementType,
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Specifies if interaction with the `CondensedButton` is enabled, disabled, or readonly.
|
|
54
|
+
*/
|
|
55
|
+
interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Specifies the color for the `CondensedButton`.
|
|
59
|
+
*/
|
|
60
|
+
color: PropTypes.oneOf(['primary', 'primary-inverse']),
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
64
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
65
|
+
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
66
|
+
*/
|
|
67
|
+
margin: ThemeablePropTypes.spacing,
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Specify a mouse cursor to use when hovering over the button.
|
|
71
|
+
* The `pointer` cursor is used by default.
|
|
72
|
+
*/
|
|
73
|
+
cursor: PropTypes.string,
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Specifies an href attribute for the `CondensedButton`'s underlying html element.
|
|
77
|
+
*/
|
|
78
|
+
href: PropTypes.string,
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* An icon, or function that returns an icon.
|
|
82
|
+
*/
|
|
83
|
+
renderIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
|
|
84
|
+
};
|
|
85
|
+
const allowedProps = ['as', 'children', 'color', 'cursor', 'elementRef', 'href', 'interaction', 'margin', 'renderIcon', 'size', 'type'];
|
|
86
|
+
export { propTypes, allowedProps };
|