@instructure/ui-buttons 11.6.0 → 11.6.1-snapshot-129
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 +57 -323
- package/es/BaseButton/{index.js → v1/index.js} +2 -2
- package/es/BaseButton/v2/index.js +304 -0
- package/es/BaseButton/v2/props.js +26 -0
- package/es/BaseButton/v2/styles.js +578 -0
- package/es/Button/{index.js → v1/index.js} +2 -2
- package/es/{CondensedButton → Button/v1}/theme.js +1 -1
- package/es/Button/v2/index.js +121 -0
- package/es/Button/v2/props.js +26 -0
- package/es/CloseButton/{index.js → v1/index.js} +2 -2
- package/es/CloseButton/v2/index.js +130 -0
- package/es/CloseButton/v2/props.js +26 -0
- package/es/CloseButton/v2/styles.js +68 -0
- package/es/CondensedButton/{index.js → v1/index.js} +2 -2
- package/es/{Button → CondensedButton/v1}/theme.js +1 -1
- package/es/CondensedButton/v2/index.js +111 -0
- package/es/CondensedButton/v2/props.js +26 -0
- package/es/IconButton/{index.js → v1/index.js} +2 -2
- package/es/IconButton/{theme.js → v1/theme.js} +1 -1
- package/es/IconButton/v2/index.js +121 -0
- package/es/IconButton/v2/props.js +26 -0
- package/es/ToggleButton/{index.js → v1/index.js} +2 -2
- package/es/ToggleButton/v2/index.js +121 -0
- package/es/ToggleButton/v2/props.js +26 -0
- package/es/exports/a.js +29 -0
- package/es/exports/b.js +29 -0
- package/lib/BaseButton/{index.js → v1/index.js} +3 -3
- package/lib/BaseButton/v2/index.js +311 -0
- package/lib/BaseButton/v2/props.js +31 -0
- package/lib/BaseButton/v2/styles.js +584 -0
- package/lib/Button/v1/index.js +128 -0
- package/lib/Button/{theme.js → v1/theme.js} +1 -1
- package/lib/Button/{index.js → v2/index.js} +3 -4
- package/lib/Button/v2/props.js +31 -0
- package/lib/CloseButton/{index.js → v1/index.js} +4 -4
- package/lib/CloseButton/v2/index.js +136 -0
- package/lib/CloseButton/v2/props.js +31 -0
- package/lib/CloseButton/v2/styles.js +74 -0
- package/lib/CondensedButton/{index.js → v1/index.js} +3 -3
- package/lib/CondensedButton/{theme.js → v1/theme.js} +1 -1
- package/lib/CondensedButton/v2/index.js +116 -0
- package/lib/CondensedButton/v2/props.js +31 -0
- package/lib/IconButton/{index.js → v1/index.js} +3 -3
- package/lib/IconButton/{theme.js → v1/theme.js} +1 -1
- package/lib/IconButton/v2/index.js +126 -0
- package/lib/IconButton/v2/props.js +31 -0
- package/lib/ToggleButton/{index.js → v1/index.js} +4 -4
- package/lib/ToggleButton/v2/index.js +127 -0
- package/lib/ToggleButton/v2/props.js +31 -0
- package/lib/{index.js → exports/a.js} +12 -12
- package/lib/exports/b.js +47 -0
- package/package.json +46 -24
- package/src/BaseButton/{index.tsx → v1/index.tsx} +3 -3
- package/src/BaseButton/{props.ts → v1/props.ts} +1 -1
- package/src/BaseButton/v2/README.md +15 -0
- package/src/BaseButton/v2/index.tsx +343 -0
- package/src/BaseButton/v2/props.ts +226 -0
- package/src/BaseButton/v2/styles.ts +640 -0
- package/src/Button/{index.tsx → v1/index.tsx} +2 -2
- package/src/Button/{props.ts → v1/props.ts} +1 -1
- package/src/{CondensedButton → Button/v1}/theme.ts +1 -1
- package/src/Button/v2/README.md +338 -0
- package/src/Button/v2/index.tsx +137 -0
- package/src/Button/v2/props.ts +159 -0
- package/src/CloseButton/{index.tsx → v1/index.tsx} +2 -2
- package/src/CloseButton/{props.ts → v1/props.ts} +1 -1
- package/src/CloseButton/v2/README.md +70 -0
- package/src/CloseButton/v2/index.tsx +142 -0
- package/src/CloseButton/v2/props.ts +148 -0
- package/src/CloseButton/v2/styles.ts +81 -0
- package/src/CondensedButton/{index.tsx → v1/index.tsx} +2 -2
- package/src/CondensedButton/{props.ts → v1/props.ts} +1 -1
- package/src/{Button → CondensedButton/v1}/theme.ts +1 -1
- package/src/CondensedButton/v2/README.md +75 -0
- package/src/CondensedButton/v2/index.tsx +129 -0
- package/src/CondensedButton/v2/props.ts +134 -0
- package/src/IconButton/{index.tsx → v1/index.tsx} +2 -2
- package/src/IconButton/{props.ts → v1/props.ts} +1 -1
- package/src/IconButton/{theme.ts → v1/theme.ts} +1 -1
- package/src/IconButton/v2/README.md +86 -0
- package/src/IconButton/v2/index.tsx +138 -0
- package/src/IconButton/v2/props.ts +166 -0
- package/src/ToggleButton/{index.tsx → v1/index.tsx} +2 -2
- package/src/ToggleButton/{props.ts → v1/props.ts} +1 -1
- package/src/ToggleButton/v2/README.md +85 -0
- package/src/ToggleButton/v2/index.tsx +133 -0
- package/src/ToggleButton/v2/props.ts +143 -0
- package/src/exports/a.ts +40 -0
- package/src/exports/b.ts +40 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/BaseButton/{index.d.ts → v1/index.d.ts} +1 -1
- package/types/BaseButton/v1/index.d.ts.map +1 -0
- package/types/BaseButton/{props.d.ts → v1/props.d.ts} +1 -1
- package/types/BaseButton/v1/props.d.ts.map +1 -0
- package/types/BaseButton/v1/styles.d.ts.map +1 -0
- package/types/BaseButton/v1/theme.d.ts.map +1 -0
- package/types/BaseButton/v2/index.d.ts +48 -0
- package/types/BaseButton/v2/index.d.ts.map +1 -0
- package/types/BaseButton/v2/props.d.ts +118 -0
- package/types/BaseButton/v2/props.d.ts.map +1 -0
- package/types/BaseButton/v2/styles.d.ts +5 -0
- package/types/BaseButton/v2/styles.d.ts.map +1 -0
- package/types/Button/{index.d.ts → v1/index.d.ts} +2 -2
- package/types/Button/v1/index.d.ts.map +1 -0
- package/types/Button/{props.d.ts → v1/props.d.ts} +1 -1
- package/types/Button/v1/props.d.ts.map +1 -0
- package/types/Button/v1/theme.d.ts +2 -0
- package/types/Button/v1/theme.d.ts.map +1 -0
- package/types/Button/v2/index.d.ts +51 -0
- package/types/Button/v2/index.d.ts.map +1 -0
- package/types/Button/v2/props.d.ts +82 -0
- package/types/Button/v2/props.d.ts.map +1 -0
- package/types/CloseButton/{index.d.ts → v1/index.d.ts} +1 -1
- package/types/CloseButton/v1/index.d.ts.map +1 -0
- package/types/CloseButton/{props.d.ts → v1/props.d.ts} +1 -1
- package/types/CloseButton/v1/props.d.ts.map +1 -0
- package/types/CloseButton/v1/styles.d.ts.map +1 -0
- package/types/CloseButton/v1/theme.d.ts.map +1 -0
- package/types/CloseButton/v2/index.d.ts +46 -0
- package/types/CloseButton/v2/index.d.ts.map +1 -0
- package/types/CloseButton/v2/props.d.ts +77 -0
- package/types/CloseButton/v2/props.d.ts.map +1 -0
- package/types/CloseButton/v2/styles.d.ts +15 -0
- package/types/CloseButton/v2/styles.d.ts.map +1 -0
- package/types/CondensedButton/{index.d.ts → v1/index.d.ts} +2 -2
- package/types/CondensedButton/v1/index.d.ts.map +1 -0
- package/types/CondensedButton/{props.d.ts → v1/props.d.ts} +1 -1
- package/types/CondensedButton/v1/props.d.ts.map +1 -0
- package/types/CondensedButton/v1/theme.d.ts +2 -0
- package/types/CondensedButton/v1/theme.d.ts.map +1 -0
- package/types/CondensedButton/v2/index.d.ts +45 -0
- package/types/CondensedButton/v2/index.d.ts.map +1 -0
- package/types/CondensedButton/v2/props.d.ts +69 -0
- package/types/CondensedButton/v2/props.d.ts.map +1 -0
- package/types/IconButton/{index.d.ts → v1/index.d.ts} +2 -2
- package/types/IconButton/v1/index.d.ts.map +1 -0
- package/types/IconButton/{props.d.ts → v1/props.d.ts} +1 -1
- package/types/IconButton/v1/props.d.ts.map +1 -0
- package/types/IconButton/v1/theme.d.ts +2 -0
- package/types/IconButton/v1/theme.d.ts.map +1 -0
- package/types/IconButton/v2/index.d.ts +51 -0
- package/types/IconButton/v2/index.d.ts.map +1 -0
- package/types/IconButton/v2/props.d.ts +85 -0
- package/types/IconButton/v2/props.d.ts.map +1 -0
- package/types/ToggleButton/{index.d.ts → v1/index.d.ts} +1 -1
- package/types/ToggleButton/v1/index.d.ts.map +1 -0
- package/types/ToggleButton/{props.d.ts → v1/props.d.ts} +1 -1
- package/types/ToggleButton/v1/props.d.ts.map +1 -0
- package/types/ToggleButton/v2/index.d.ts +43 -0
- package/types/ToggleButton/v2/index.d.ts.map +1 -0
- package/types/ToggleButton/v2/props.d.ts +75 -0
- package/types/ToggleButton/v2/props.d.ts.map +1 -0
- package/types/exports/a.d.ts +13 -0
- package/types/exports/a.d.ts.map +1 -0
- package/types/exports/b.d.ts +13 -0
- package/types/exports/b.d.ts.map +1 -0
- package/es/index.js +0 -29
- package/src/index.ts +0 -37
- package/types/BaseButton/index.d.ts.map +0 -1
- package/types/BaseButton/props.d.ts.map +0 -1
- package/types/BaseButton/styles.d.ts.map +0 -1
- package/types/BaseButton/theme.d.ts.map +0 -1
- package/types/Button/index.d.ts.map +0 -1
- package/types/Button/props.d.ts.map +0 -1
- package/types/Button/theme.d.ts +0 -2
- package/types/Button/theme.d.ts.map +0 -1
- package/types/CloseButton/index.d.ts.map +0 -1
- package/types/CloseButton/props.d.ts.map +0 -1
- package/types/CloseButton/styles.d.ts.map +0 -1
- package/types/CloseButton/theme.d.ts.map +0 -1
- package/types/CondensedButton/index.d.ts.map +0 -1
- package/types/CondensedButton/props.d.ts.map +0 -1
- package/types/CondensedButton/theme.d.ts +0 -2
- package/types/CondensedButton/theme.d.ts.map +0 -1
- package/types/IconButton/index.d.ts.map +0 -1
- package/types/IconButton/props.d.ts.map +0 -1
- package/types/IconButton/theme.d.ts +0 -2
- package/types/IconButton/theme.d.ts.map +0 -1
- package/types/ToggleButton/index.d.ts.map +0 -1
- package/types/ToggleButton/props.d.ts.map +0 -1
- package/types/index.d.ts +0 -13
- package/types/index.d.ts.map +0 -1
- /package/es/BaseButton/{props.js → v1/props.js} +0 -0
- /package/es/BaseButton/{styles.js → v1/styles.js} +0 -0
- /package/es/BaseButton/{theme.js → v1/theme.js} +0 -0
- /package/es/Button/{props.js → v1/props.js} +0 -0
- /package/es/CloseButton/{props.js → v1/props.js} +0 -0
- /package/es/CloseButton/{styles.js → v1/styles.js} +0 -0
- /package/es/CloseButton/{theme.js → v1/theme.js} +0 -0
- /package/es/CondensedButton/{props.js → v1/props.js} +0 -0
- /package/es/IconButton/{props.js → v1/props.js} +0 -0
- /package/es/ToggleButton/{props.js → v1/props.js} +0 -0
- /package/lib/BaseButton/{props.js → v1/props.js} +0 -0
- /package/lib/BaseButton/{styles.js → v1/styles.js} +0 -0
- /package/lib/BaseButton/{theme.js → v1/theme.js} +0 -0
- /package/lib/Button/{props.js → v1/props.js} +0 -0
- /package/lib/CloseButton/{props.js → v1/props.js} +0 -0
- /package/lib/CloseButton/{styles.js → v1/styles.js} +0 -0
- /package/lib/CloseButton/{theme.js → v1/theme.js} +0 -0
- /package/lib/CondensedButton/{props.js → v1/props.js} +0 -0
- /package/lib/IconButton/{props.js → v1/props.js} +0 -0
- /package/lib/ToggleButton/{props.js → v1/props.js} +0 -0
- /package/src/BaseButton/{README.md → v1/README.md} +0 -0
- /package/src/BaseButton/{styles.ts → v1/styles.ts} +0 -0
- /package/src/BaseButton/{theme.ts → v1/theme.ts} +0 -0
- /package/src/Button/{README.md → v1/README.md} +0 -0
- /package/src/CloseButton/{README.md → v1/README.md} +0 -0
- /package/src/CloseButton/{styles.ts → v1/styles.ts} +0 -0
- /package/src/CloseButton/{theme.ts → v1/theme.ts} +0 -0
- /package/src/CondensedButton/{README.md → v1/README.md} +0 -0
- /package/src/IconButton/{README.md → v1/README.md} +0 -0
- /package/src/ToggleButton/{README.md → v1/README.md} +0 -0
- /package/types/BaseButton/{styles.d.ts → v1/styles.d.ts} +0 -0
- /package/types/BaseButton/{theme.d.ts → v1/theme.d.ts} +0 -0
- /package/types/CloseButton/{styles.d.ts → v1/styles.d.ts} +0 -0
- /package/types/CloseButton/{theme.d.ts → v1/theme.d.ts} +0 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = exports.Button = void 0;
|
|
8
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _getInteraction = require("@instructure/ui-react-utils/lib/getInteraction.js");
|
|
11
|
+
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
12
|
+
var _emotion = require("@instructure/emotion");
|
|
13
|
+
var _theme = _interopRequireDefault(require("./theme"));
|
|
14
|
+
var _v = require("../../BaseButton/v1");
|
|
15
|
+
var _props = require("./props");
|
|
16
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
17
|
+
const _excluded = ["children", "type", "size", "as", "color", "focusColor", "display", "textAlign", "withBackground", "margin", "cursor", "href", "renderIcon"];
|
|
18
|
+
var _dec, _class, _Button;
|
|
19
|
+
/*
|
|
20
|
+
* The MIT License (MIT)
|
|
21
|
+
*
|
|
22
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
23
|
+
*
|
|
24
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
25
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
26
|
+
* in the Software without restriction, including without limitation the rights
|
|
27
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
28
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
29
|
+
* furnished to do so, subject to the following conditions:
|
|
30
|
+
*
|
|
31
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
32
|
+
* copies or substantial portions of the Software.
|
|
33
|
+
*
|
|
34
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
35
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
36
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
37
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
38
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
39
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
40
|
+
* SOFTWARE.
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
---
|
|
44
|
+
category: components
|
|
45
|
+
---
|
|
46
|
+
**/
|
|
47
|
+
// needed for listing the available theme variables on docs page
|
|
48
|
+
let Button = exports.Button = (_dec = (0, _emotion.withStyleLegacy)(null, _theme.default), _dec(_class = (_Button = class Button extends _react.Component {
|
|
49
|
+
constructor(...args) {
|
|
50
|
+
super(...args);
|
|
51
|
+
this._buttonComponent = null;
|
|
52
|
+
this.ref = null;
|
|
53
|
+
this.handleElementRef = el => {
|
|
54
|
+
const elementRef = this.props.elementRef;
|
|
55
|
+
this.ref = el;
|
|
56
|
+
if (typeof elementRef === 'function') {
|
|
57
|
+
elementRef(el);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
this.handleButtonRef = component => {
|
|
61
|
+
this._buttonComponent = component;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
get focused() {
|
|
65
|
+
return this._buttonComponent && this._buttonComponent.focused;
|
|
66
|
+
}
|
|
67
|
+
focus() {
|
|
68
|
+
this._buttonComponent && this._buttonComponent.focus();
|
|
69
|
+
}
|
|
70
|
+
render() {
|
|
71
|
+
const _this$props = this.props,
|
|
72
|
+
children = _this$props.children,
|
|
73
|
+
type = _this$props.type,
|
|
74
|
+
size = _this$props.size,
|
|
75
|
+
as = _this$props.as,
|
|
76
|
+
color = _this$props.color,
|
|
77
|
+
focusColor = _this$props.focusColor,
|
|
78
|
+
display = _this$props.display,
|
|
79
|
+
textAlign = _this$props.textAlign,
|
|
80
|
+
withBackground = _this$props.withBackground,
|
|
81
|
+
margin = _this$props.margin,
|
|
82
|
+
cursor = _this$props.cursor,
|
|
83
|
+
href = _this$props.href,
|
|
84
|
+
renderIcon = _this$props.renderIcon,
|
|
85
|
+
props = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
|
|
86
|
+
const interaction = (0, _getInteraction.getInteraction)({
|
|
87
|
+
props
|
|
88
|
+
});
|
|
89
|
+
const themeOverride = this.props.themeOverride;
|
|
90
|
+
const buttonProps = {
|
|
91
|
+
...(0, _passthroughProps.passthroughProps)(props),
|
|
92
|
+
type,
|
|
93
|
+
size,
|
|
94
|
+
elementRef: this.handleElementRef,
|
|
95
|
+
ref: this.handleButtonRef,
|
|
96
|
+
as,
|
|
97
|
+
color,
|
|
98
|
+
interaction,
|
|
99
|
+
focusColor,
|
|
100
|
+
display,
|
|
101
|
+
textAlign,
|
|
102
|
+
withBackground,
|
|
103
|
+
margin,
|
|
104
|
+
cursor,
|
|
105
|
+
href,
|
|
106
|
+
renderIcon,
|
|
107
|
+
themeOverride
|
|
108
|
+
};
|
|
109
|
+
return (0, _jsxRuntime.jsx)(_v.BaseButton, {
|
|
110
|
+
...buttonProps,
|
|
111
|
+
"data-cid": "Button",
|
|
112
|
+
children: children
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}, _Button.displayName = "Button", _Button.componentId = 'Button', _Button.allowedProps = _props.allowedProps, _Button.defaultProps = {
|
|
116
|
+
type: 'button',
|
|
117
|
+
size: 'medium',
|
|
118
|
+
as: 'button',
|
|
119
|
+
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
120
|
+
interaction: void 0,
|
|
121
|
+
color: 'secondary',
|
|
122
|
+
display: 'inline-block',
|
|
123
|
+
textAlign: 'center',
|
|
124
|
+
withBackground: true,
|
|
125
|
+
margin: '0',
|
|
126
|
+
cursor: 'pointer'
|
|
127
|
+
}, _Button)) || _class);
|
|
128
|
+
var _default = exports.default = Button;
|
|
@@ -10,8 +10,7 @@ var _react = require("react");
|
|
|
10
10
|
var _getInteraction = require("@instructure/ui-react-utils/lib/getInteraction.js");
|
|
11
11
|
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
12
12
|
var _emotion = require("@instructure/emotion");
|
|
13
|
-
var
|
|
14
|
-
var _BaseButton = require("../BaseButton");
|
|
13
|
+
var _v = require("../../BaseButton/v2");
|
|
15
14
|
var _props = require("./props");
|
|
16
15
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
17
16
|
const _excluded = ["children", "type", "size", "as", "color", "focusColor", "display", "textAlign", "withBackground", "margin", "cursor", "href", "renderIcon"];
|
|
@@ -45,7 +44,7 @@ category: components
|
|
|
45
44
|
---
|
|
46
45
|
**/
|
|
47
46
|
// needed for listing the available theme variables on docs page
|
|
48
|
-
let Button = exports.Button = (_dec = (0, _emotion.withStyle)(null,
|
|
47
|
+
let Button = exports.Button = (_dec = (0, _emotion.withStyle)(null, 'BaseButton'), _dec(_class = (_Button = class Button extends _react.Component {
|
|
49
48
|
constructor(...args) {
|
|
50
49
|
super(...args);
|
|
51
50
|
this._buttonComponent = null;
|
|
@@ -106,7 +105,7 @@ let Button = exports.Button = (_dec = (0, _emotion.withStyle)(null, _theme.defau
|
|
|
106
105
|
renderIcon,
|
|
107
106
|
themeOverride
|
|
108
107
|
};
|
|
109
|
-
return (0, _jsxRuntime.jsx)(
|
|
108
|
+
return (0, _jsxRuntime.jsx)(_v.BaseButton, {
|
|
110
109
|
...buttonProps,
|
|
111
110
|
"data-cid": "Button",
|
|
112
111
|
children: children
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.allowedProps = void 0;
|
|
7
|
+
/*
|
|
8
|
+
* The MIT License (MIT)
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
const allowedProps = exports.allowedProps = ['as', 'children', 'color', 'cursor', 'display', 'elementRef', 'focusColor', 'href', 'interaction', 'margin', 'renderIcon', 'size', 'textAlign', 'type', 'withBackground', 'onClick'];
|
|
@@ -7,14 +7,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.CloseButton = void 0;
|
|
8
8
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
9
|
var _react = require("react");
|
|
10
|
-
var _IconXSolid = require("@instructure/ui-icons/lib/IconXSolid.js");
|
|
10
|
+
var _IconXSolid = require("@instructure/ui-icons/lib/generated/IconXSolid.js");
|
|
11
11
|
var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
|
|
12
12
|
var _getInteraction = require("@instructure/ui-react-utils/lib/getInteraction.js");
|
|
13
13
|
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
14
14
|
var _emotion = require("@instructure/emotion");
|
|
15
15
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
16
16
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
17
|
-
var
|
|
17
|
+
var _v = require("../../BaseButton/v1");
|
|
18
18
|
var _props = require("./props");
|
|
19
19
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
20
20
|
const _excluded = ["screenReaderLabel", "elementRef", "size", "onClick", "margin", "placement", "offset", "type", "as", "href", "cursor", "tabIndex", "styles"];
|
|
@@ -47,7 +47,7 @@ var _dec, _class, _CloseButton;
|
|
|
47
47
|
category: components
|
|
48
48
|
---
|
|
49
49
|
**/
|
|
50
|
-
let CloseButton = exports.CloseButton = (_dec = (0, _emotion.
|
|
50
|
+
let CloseButton = exports.CloseButton = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = (_CloseButton = class CloseButton extends _react.Component {
|
|
51
51
|
constructor(...args) {
|
|
52
52
|
super(...args);
|
|
53
53
|
this.ref = null;
|
|
@@ -97,7 +97,7 @@ let CloseButton = exports.CloseButton = (_dec = (0, _emotion.withStyle)(_styles.
|
|
|
97
97
|
ref: el => {
|
|
98
98
|
this.ref = el;
|
|
99
99
|
},
|
|
100
|
-
children: (0, _jsxRuntime.jsx)(
|
|
100
|
+
children: (0, _jsxRuntime.jsx)(_v.BaseButton, {
|
|
101
101
|
renderIcon: _IconXSolid.IconXSolid,
|
|
102
102
|
elementRef: this.handleRef,
|
|
103
103
|
interaction: this.interaction,
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = exports.CloseButton = void 0;
|
|
8
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _uiIcons = require("@instructure/ui-icons");
|
|
11
|
+
var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
|
|
12
|
+
var _getInteraction = require("@instructure/ui-react-utils/lib/getInteraction.js");
|
|
13
|
+
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
14
|
+
var _emotion = require("@instructure/emotion");
|
|
15
|
+
var _styles = _interopRequireDefault(require("./styles"));
|
|
16
|
+
var _v = require("../../BaseButton/v2");
|
|
17
|
+
var _props = require("./props");
|
|
18
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
19
|
+
const _excluded = ["screenReaderLabel", "elementRef", "size", "onClick", "margin", "placement", "offset", "type", "as", "href", "cursor", "tabIndex", "styles"];
|
|
20
|
+
var _dec, _class, _CloseButton;
|
|
21
|
+
/*
|
|
22
|
+
* The MIT License (MIT)
|
|
23
|
+
*
|
|
24
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
25
|
+
*
|
|
26
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
27
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
28
|
+
* in the Software without restriction, including without limitation the rights
|
|
29
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
30
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
31
|
+
* furnished to do so, subject to the following conditions:
|
|
32
|
+
*
|
|
33
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
34
|
+
* copies or substantial portions of the Software.
|
|
35
|
+
*
|
|
36
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
37
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
38
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
39
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
40
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
41
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
42
|
+
* SOFTWARE.
|
|
43
|
+
*/
|
|
44
|
+
/**
|
|
45
|
+
---
|
|
46
|
+
category: components
|
|
47
|
+
---
|
|
48
|
+
**/
|
|
49
|
+
let CloseButton = exports.CloseButton = (_dec = (0, _emotion.withStyle)(_styles.default, 'BaseButton'), _dec(_class = (_CloseButton = class CloseButton extends _react.Component {
|
|
50
|
+
constructor(...args) {
|
|
51
|
+
super(...args);
|
|
52
|
+
this.ref = null;
|
|
53
|
+
this.handleRef = el => {
|
|
54
|
+
const elementRef = this.props.elementRef;
|
|
55
|
+
if (typeof elementRef === 'function') {
|
|
56
|
+
elementRef(el);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
componentDidMount() {
|
|
61
|
+
var _this$props$makeStyle, _this$props;
|
|
62
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
63
|
+
}
|
|
64
|
+
componentDidUpdate() {
|
|
65
|
+
var _this$props$makeStyle2, _this$props2;
|
|
66
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
67
|
+
}
|
|
68
|
+
get interaction() {
|
|
69
|
+
return (0, _getInteraction.getInteraction)({
|
|
70
|
+
props: this.props
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
get color() {
|
|
74
|
+
const color = this.props.color;
|
|
75
|
+
return color === 'primary' ? 'secondary' : color;
|
|
76
|
+
}
|
|
77
|
+
render() {
|
|
78
|
+
const _this$props3 = this.props,
|
|
79
|
+
screenReaderLabel = _this$props3.screenReaderLabel,
|
|
80
|
+
elementRef = _this$props3.elementRef,
|
|
81
|
+
size = _this$props3.size,
|
|
82
|
+
onClick = _this$props3.onClick,
|
|
83
|
+
margin = _this$props3.margin,
|
|
84
|
+
placement = _this$props3.placement,
|
|
85
|
+
offset = _this$props3.offset,
|
|
86
|
+
type = _this$props3.type,
|
|
87
|
+
as = _this$props3.as,
|
|
88
|
+
href = _this$props3.href,
|
|
89
|
+
cursor = _this$props3.cursor,
|
|
90
|
+
tabIndex = _this$props3.tabIndex,
|
|
91
|
+
styles = _this$props3.styles,
|
|
92
|
+
props = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
|
|
93
|
+
const themeOverride = this.props.themeOverride;
|
|
94
|
+
return (0, _jsxRuntime.jsx)("span", {
|
|
95
|
+
...(0, _passthroughProps.passthroughProps)(props),
|
|
96
|
+
css: styles === null || styles === void 0 ? void 0 : styles.closeButton,
|
|
97
|
+
ref: el => {
|
|
98
|
+
this.ref = el;
|
|
99
|
+
},
|
|
100
|
+
children: (0, _jsxRuntime.jsx)(_v.BaseButton, {
|
|
101
|
+
renderIcon: _uiIcons.XInstUIIcon,
|
|
102
|
+
elementRef: this.handleRef,
|
|
103
|
+
interaction: this.interaction,
|
|
104
|
+
type: type,
|
|
105
|
+
...(this.color ? {
|
|
106
|
+
color: this.color
|
|
107
|
+
} : {}),
|
|
108
|
+
size: size,
|
|
109
|
+
onClick: onClick,
|
|
110
|
+
margin: margin,
|
|
111
|
+
withBorder: false,
|
|
112
|
+
withBackground: false,
|
|
113
|
+
as: as,
|
|
114
|
+
href: href,
|
|
115
|
+
cursor: cursor,
|
|
116
|
+
tabIndex: tabIndex,
|
|
117
|
+
themeOverride: themeOverride,
|
|
118
|
+
"data-cid": "CloseButton",
|
|
119
|
+
children: (0, _jsxRuntime.jsx)(_ScreenReaderContent.ScreenReaderContent, {
|
|
120
|
+
children: screenReaderLabel
|
|
121
|
+
})
|
|
122
|
+
})
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}, _CloseButton.displayName = "CloseButton", _CloseButton.componentId = 'CloseButton', _CloseButton.allowedProps = _props.allowedProps, _CloseButton.defaultProps = {
|
|
126
|
+
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
127
|
+
interaction: void 0,
|
|
128
|
+
type: 'button',
|
|
129
|
+
placement: 'static',
|
|
130
|
+
offset: 'x-small',
|
|
131
|
+
size: 'small',
|
|
132
|
+
margin: '0',
|
|
133
|
+
as: 'button',
|
|
134
|
+
cursor: 'pointer'
|
|
135
|
+
}, _CloseButton)) || _class);
|
|
136
|
+
var _default = exports.default = CloseButton;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.allowedProps = void 0;
|
|
7
|
+
/*
|
|
8
|
+
* The MIT License (MIT)
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
const allowedProps = exports.allowedProps = ['as', 'color', 'cursor', 'elementRef', 'href', 'interaction', 'margin', 'offset', 'onClick', 'placement', 'screenReaderLabel', 'size', 'tabIndex', 'type'];
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
/*
|
|
8
|
+
* The MIT License (MIT)
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* ---
|
|
33
|
+
* private: true
|
|
34
|
+
* ---
|
|
35
|
+
* Generates the style object from the theme and provided additional information
|
|
36
|
+
* @param {Object} _componentTheme The theme variable object.
|
|
37
|
+
* @param {Object} props the props of the component, the style is applied to
|
|
38
|
+
* @param {Object} sharedTokens the shared design tokens
|
|
39
|
+
* @return {Object} The final style object, which will be used in the component
|
|
40
|
+
*/
|
|
41
|
+
const generateStyle = (_componentTheme, props, sharedTokens) => {
|
|
42
|
+
const placement = props.placement,
|
|
43
|
+
offset = props.offset;
|
|
44
|
+
const offsetValueMap = {
|
|
45
|
+
none: 0,
|
|
46
|
+
'x-small': sharedTokens.spacing.general.spaceXs,
|
|
47
|
+
small: sharedTokens.spacing.general.spaceSm,
|
|
48
|
+
medium: sharedTokens.spacing.general.spaceMd
|
|
49
|
+
};
|
|
50
|
+
const getOffsetStyle = () => {
|
|
51
|
+
const offsetValue = offsetValueMap[offset];
|
|
52
|
+
return {
|
|
53
|
+
...(offsetValue !== 0 && {
|
|
54
|
+
top: offsetValue
|
|
55
|
+
}),
|
|
56
|
+
insetInlineStart: placement === 'start' ? offsetValue : 'auto',
|
|
57
|
+
insetInlineEnd: placement === 'end' ? offsetValue : 'auto'
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
return {
|
|
61
|
+
closeButton: {
|
|
62
|
+
label: 'closeButton',
|
|
63
|
+
zIndex: 1,
|
|
64
|
+
display: 'inline-block',
|
|
65
|
+
...(placement === 'static' ? {
|
|
66
|
+
position: 'static'
|
|
67
|
+
} : {
|
|
68
|
+
position: 'absolute',
|
|
69
|
+
...getOffsetStyle()
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
var _default = exports.default = generateStyle;
|
|
@@ -10,7 +10,7 @@ var _react = require("react");
|
|
|
10
10
|
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
11
11
|
var _emotion = require("@instructure/emotion");
|
|
12
12
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
13
|
-
var
|
|
13
|
+
var _v = require("../../BaseButton/v1");
|
|
14
14
|
var _props = require("./props");
|
|
15
15
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
16
16
|
const _excluded = ["children", "type", "size", "elementRef", "as", "interaction", "color", "margin", "cursor", "href", "renderIcon", "display"];
|
|
@@ -44,7 +44,7 @@ category: components
|
|
|
44
44
|
---
|
|
45
45
|
**/
|
|
46
46
|
// needed for listing the available theme variables on docs page
|
|
47
|
-
let CondensedButton = exports.CondensedButton = (_dec = (0, _emotion.
|
|
47
|
+
let CondensedButton = exports.CondensedButton = (_dec = (0, _emotion.withStyleLegacy)(null, _theme.default), _dec(_class = (_CondensedButton = class CondensedButton extends _react.Component {
|
|
48
48
|
constructor(...args) {
|
|
49
49
|
super(...args);
|
|
50
50
|
this._baseButton = null;
|
|
@@ -79,7 +79,7 @@ let CondensedButton = exports.CondensedButton = (_dec = (0, _emotion.withStyle)(
|
|
|
79
79
|
display = _this$props.display,
|
|
80
80
|
props = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
|
|
81
81
|
const themeOverride = this.props.themeOverride;
|
|
82
|
-
return (0, _jsxRuntime.jsx)(
|
|
82
|
+
return (0, _jsxRuntime.jsx)(_v.BaseButton, {
|
|
83
83
|
...(0, _passthroughProps.passthroughProps)(props),
|
|
84
84
|
isCondensed: true,
|
|
85
85
|
display: display,
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = exports.CondensedButton = void 0;
|
|
8
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
|
|
11
|
+
var _emotion = require("@instructure/emotion");
|
|
12
|
+
var _v = require("../../BaseButton/v2");
|
|
13
|
+
var _props = require("./props");
|
|
14
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
15
|
+
const _excluded = ["children", "type", "size", "elementRef", "as", "interaction", "color", "margin", "cursor", "href", "renderIcon", "display"];
|
|
16
|
+
var _dec, _class, _CondensedButton;
|
|
17
|
+
/*
|
|
18
|
+
* The MIT License (MIT)
|
|
19
|
+
*
|
|
20
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
21
|
+
*
|
|
22
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
23
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
24
|
+
* in the Software without restriction, including without limitation the rights
|
|
25
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
26
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
27
|
+
* furnished to do so, subject to the following conditions:
|
|
28
|
+
*
|
|
29
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
30
|
+
* copies or substantial portions of the Software.
|
|
31
|
+
*
|
|
32
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
33
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
34
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
35
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
36
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
37
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
38
|
+
* SOFTWARE.
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
---
|
|
42
|
+
category: components
|
|
43
|
+
---
|
|
44
|
+
**/
|
|
45
|
+
// needed for listing the available theme variables on docs page
|
|
46
|
+
let CondensedButton = exports.CondensedButton = (_dec = (0, _emotion.withStyle)(null, 'BaseButton'), _dec(_class = (_CondensedButton = class CondensedButton extends _react.Component {
|
|
47
|
+
constructor(...args) {
|
|
48
|
+
super(...args);
|
|
49
|
+
this._baseButton = null;
|
|
50
|
+
this.ref = null;
|
|
51
|
+
this.handleRef = el => {
|
|
52
|
+
const elementRef = this.props.elementRef;
|
|
53
|
+
this.ref = el;
|
|
54
|
+
if (typeof elementRef === 'function') {
|
|
55
|
+
elementRef(el);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
get focused() {
|
|
60
|
+
return this._baseButton && this._baseButton.focused;
|
|
61
|
+
}
|
|
62
|
+
focus() {
|
|
63
|
+
this._baseButton && this._baseButton.focus();
|
|
64
|
+
}
|
|
65
|
+
render() {
|
|
66
|
+
const _this$props = this.props,
|
|
67
|
+
children = _this$props.children,
|
|
68
|
+
type = _this$props.type,
|
|
69
|
+
size = _this$props.size,
|
|
70
|
+
elementRef = _this$props.elementRef,
|
|
71
|
+
as = _this$props.as,
|
|
72
|
+
interaction = _this$props.interaction,
|
|
73
|
+
color = _this$props.color,
|
|
74
|
+
margin = _this$props.margin,
|
|
75
|
+
cursor = _this$props.cursor,
|
|
76
|
+
href = _this$props.href,
|
|
77
|
+
renderIcon = _this$props.renderIcon,
|
|
78
|
+
display = _this$props.display,
|
|
79
|
+
props = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
|
|
80
|
+
const themeOverride = this.props.themeOverride;
|
|
81
|
+
return (0, _jsxRuntime.jsx)(_v.BaseButton, {
|
|
82
|
+
...(0, _passthroughProps.passthroughProps)(props),
|
|
83
|
+
isCondensed: true,
|
|
84
|
+
display: display,
|
|
85
|
+
withBackground: false,
|
|
86
|
+
withBorder: false,
|
|
87
|
+
type: type,
|
|
88
|
+
size: size,
|
|
89
|
+
elementRef: this.handleRef,
|
|
90
|
+
as: as,
|
|
91
|
+
interaction: interaction,
|
|
92
|
+
color: color,
|
|
93
|
+
margin: margin,
|
|
94
|
+
cursor: cursor,
|
|
95
|
+
href: href,
|
|
96
|
+
renderIcon: renderIcon,
|
|
97
|
+
themeOverride: themeOverride,
|
|
98
|
+
ref: component => {
|
|
99
|
+
this._baseButton = component;
|
|
100
|
+
},
|
|
101
|
+
"data-cid": "CondensedButton",
|
|
102
|
+
children: children
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}, _CondensedButton.displayName = "CondensedButton", _CondensedButton.componentId = 'CondensedButton', _CondensedButton.allowedProps = _props.allowedProps, _CondensedButton.defaultProps = {
|
|
106
|
+
type: 'button',
|
|
107
|
+
size: 'medium',
|
|
108
|
+
as: 'button',
|
|
109
|
+
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
110
|
+
interaction: void 0,
|
|
111
|
+
color: 'primary',
|
|
112
|
+
margin: '0',
|
|
113
|
+
cursor: 'pointer',
|
|
114
|
+
display: 'inline-block'
|
|
115
|
+
}, _CondensedButton)) || _class);
|
|
116
|
+
var _default = exports.default = CondensedButton;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.allowedProps = void 0;
|
|
7
|
+
/*
|
|
8
|
+
* The MIT License (MIT)
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
const allowedProps = exports.allowedProps = ['as', 'children', 'color', 'cursor', 'elementRef', 'href', 'interaction', 'margin', 'renderIcon', 'size', 'type', 'onClick', 'display'];
|