@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,121 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
+
const _excluded = ["children", "renderIcon", "screenReaderLabel", "type", "size", "elementRef", "as", "interaction", "color", "focusColor", "shape", "withBackground", "withBorder", "margin", "cursor", "href"];
|
|
3
|
+
var _dec, _class, _IconButton;
|
|
4
|
+
/*
|
|
5
|
+
* The MIT License (MIT)
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
8
|
+
*
|
|
9
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
* in the Software without restriction, including without limitation the rights
|
|
12
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
* furnished to do so, subject to the following conditions:
|
|
15
|
+
*
|
|
16
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
* copies or substantial portions of the Software.
|
|
18
|
+
*
|
|
19
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
* SOFTWARE.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
import { Component } from 'react';
|
|
29
|
+
import { passthroughProps } from '@instructure/ui-react-utils';
|
|
30
|
+
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
31
|
+
import { combineDataCid } from '@instructure/ui-utils';
|
|
32
|
+
import { withStyle } from '@instructure/emotion';
|
|
33
|
+
import { BaseButton } from "../../BaseButton/v2/index.js";
|
|
34
|
+
import { allowedProps } from "./props.js";
|
|
35
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
36
|
+
/**
|
|
37
|
+
---
|
|
38
|
+
category: components
|
|
39
|
+
---
|
|
40
|
+
**/
|
|
41
|
+
// needed for listing the available theme variables on docs page
|
|
42
|
+
let IconButton = (_dec = withStyle(null, 'BaseButton'), _dec(_class = (_IconButton = class IconButton extends Component {
|
|
43
|
+
constructor(...args) {
|
|
44
|
+
super(...args);
|
|
45
|
+
this._baseButton = null;
|
|
46
|
+
this.ref = null;
|
|
47
|
+
this.handleRef = el => {
|
|
48
|
+
const elementRef = this.props.elementRef;
|
|
49
|
+
this.ref = el;
|
|
50
|
+
if (typeof elementRef === 'function') {
|
|
51
|
+
elementRef(el);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
get focused() {
|
|
56
|
+
return this._baseButton && this._baseButton.focused;
|
|
57
|
+
}
|
|
58
|
+
focus() {
|
|
59
|
+
this._baseButton && this._baseButton.focus();
|
|
60
|
+
}
|
|
61
|
+
render() {
|
|
62
|
+
const _this$props = this.props,
|
|
63
|
+
children = _this$props.children,
|
|
64
|
+
renderIcon = _this$props.renderIcon,
|
|
65
|
+
screenReaderLabel = _this$props.screenReaderLabel,
|
|
66
|
+
type = _this$props.type,
|
|
67
|
+
size = _this$props.size,
|
|
68
|
+
elementRef = _this$props.elementRef,
|
|
69
|
+
as = _this$props.as,
|
|
70
|
+
interaction = _this$props.interaction,
|
|
71
|
+
color = _this$props.color,
|
|
72
|
+
focusColor = _this$props.focusColor,
|
|
73
|
+
shape = _this$props.shape,
|
|
74
|
+
withBackground = _this$props.withBackground,
|
|
75
|
+
withBorder = _this$props.withBorder,
|
|
76
|
+
margin = _this$props.margin,
|
|
77
|
+
cursor = _this$props.cursor,
|
|
78
|
+
href = _this$props.href,
|
|
79
|
+
props = _objectWithoutProperties(_this$props, _excluded);
|
|
80
|
+
const themeOverride = this.props.themeOverride;
|
|
81
|
+
return _jsx(BaseButton, {
|
|
82
|
+
...passthroughProps(props),
|
|
83
|
+
type: type,
|
|
84
|
+
size: size,
|
|
85
|
+
elementRef: this.handleRef,
|
|
86
|
+
as: as,
|
|
87
|
+
interaction: interaction,
|
|
88
|
+
color: color,
|
|
89
|
+
focusColor: focusColor,
|
|
90
|
+
shape: shape,
|
|
91
|
+
withBackground: withBackground,
|
|
92
|
+
withBorder: withBorder,
|
|
93
|
+
margin: margin,
|
|
94
|
+
cursor: cursor,
|
|
95
|
+
href: href,
|
|
96
|
+
renderIcon: children || renderIcon,
|
|
97
|
+
themeOverride: themeOverride,
|
|
98
|
+
ref: component => {
|
|
99
|
+
this._baseButton = component;
|
|
100
|
+
},
|
|
101
|
+
"data-cid": combineDataCid('IconButton', this.props),
|
|
102
|
+
children: _jsx(ScreenReaderContent, {
|
|
103
|
+
children: screenReaderLabel
|
|
104
|
+
})
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}, _IconButton.displayName = "IconButton", _IconButton.componentId = 'IconButton', _IconButton.allowedProps = allowedProps, _IconButton.defaultProps = {
|
|
108
|
+
type: 'button',
|
|
109
|
+
size: 'medium',
|
|
110
|
+
as: 'button',
|
|
111
|
+
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
112
|
+
interaction: void 0,
|
|
113
|
+
color: 'secondary',
|
|
114
|
+
shape: 'rectangle',
|
|
115
|
+
withBackground: true,
|
|
116
|
+
withBorder: true,
|
|
117
|
+
margin: '0',
|
|
118
|
+
cursor: 'pointer'
|
|
119
|
+
}, _IconButton)) || _class);
|
|
120
|
+
export default IconButton;
|
|
121
|
+
export { IconButton };
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
const allowedProps = ['as', 'children', 'color', 'cursor', 'elementRef', 'focusColor', 'href', 'interaction', 'margin', 'renderIcon', 'screenReaderLabel', 'shape', 'size', 'type', 'withBackground', 'withBorder', 'onClick'];
|
|
26
|
+
export { allowedProps };
|
|
@@ -26,8 +26,8 @@ const _excluded = ["as", "color", "elementRef", "size", "interaction", "mountNod
|
|
|
26
26
|
|
|
27
27
|
import { Component } from 'react';
|
|
28
28
|
import { callRenderProp, passthroughProps } from '@instructure/ui-react-utils';
|
|
29
|
-
import { Tooltip } from '@instructure/ui-tooltip';
|
|
30
|
-
import { IconButton } from "
|
|
29
|
+
import { Tooltip } from '@instructure/ui-tooltip/v11_6';
|
|
30
|
+
import { IconButton } from "../../IconButton/v1/index.js";
|
|
31
31
|
import { allowedProps } from "./props.js";
|
|
32
32
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
33
33
|
/**
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
+
const _excluded = ["as", "color", "elementRef", "size", "interaction", "mountNode", "renderIcon", "renderTooltipContent", "screenReaderLabel", "status", "placement", "onClick"];
|
|
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
|
+
import { Component } from 'react';
|
|
28
|
+
import { passthroughProps } from '@instructure/ui-react-utils';
|
|
29
|
+
import { Tooltip } from '@instructure/ui-tooltip/latest';
|
|
30
|
+
import { IconButton } from "../../IconButton/v2/index.js";
|
|
31
|
+
import { allowedProps } from "./props.js";
|
|
32
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
33
|
+
/**
|
|
34
|
+
---
|
|
35
|
+
category: components
|
|
36
|
+
---
|
|
37
|
+
**/
|
|
38
|
+
|
|
39
|
+
class ToggleButton extends Component {
|
|
40
|
+
constructor(props) {
|
|
41
|
+
super(props);
|
|
42
|
+
this.ref = null;
|
|
43
|
+
this.handleRef = el => {
|
|
44
|
+
const elementRef = this.props.elementRef;
|
|
45
|
+
if (typeof elementRef === 'function') {
|
|
46
|
+
elementRef(el);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
this.state = {
|
|
50
|
+
isShowingTooltip: props.isShowingTooltip || false
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
get isShowingTooltip() {
|
|
54
|
+
return typeof this.props.isShowingTooltip === 'undefined' ? this.state.isShowingTooltip : this.props.isShowingTooltip;
|
|
55
|
+
}
|
|
56
|
+
render() {
|
|
57
|
+
const _this$props = this.props,
|
|
58
|
+
as = _this$props.as,
|
|
59
|
+
color = _this$props.color,
|
|
60
|
+
elementRef = _this$props.elementRef,
|
|
61
|
+
size = _this$props.size,
|
|
62
|
+
interaction = _this$props.interaction,
|
|
63
|
+
mountNode = _this$props.mountNode,
|
|
64
|
+
renderIcon = _this$props.renderIcon,
|
|
65
|
+
renderTooltipContent = _this$props.renderTooltipContent,
|
|
66
|
+
screenReaderLabel = _this$props.screenReaderLabel,
|
|
67
|
+
status = _this$props.status,
|
|
68
|
+
placement = _this$props.placement,
|
|
69
|
+
onClick = _this$props.onClick,
|
|
70
|
+
props = _objectWithoutProperties(_this$props, _excluded);
|
|
71
|
+
return _jsx(Tooltip, {
|
|
72
|
+
renderTip: renderTooltipContent,
|
|
73
|
+
on: ['hover', 'focus'],
|
|
74
|
+
placement: placement,
|
|
75
|
+
color: color === 'primary-inverse' ? 'primary-inverse' : 'primary',
|
|
76
|
+
isShowingContent: this.isShowingTooltip,
|
|
77
|
+
onShowContent: () => {
|
|
78
|
+
this.setState({
|
|
79
|
+
isShowingTooltip: true
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
onHideContent: () => {
|
|
83
|
+
this.setState({
|
|
84
|
+
isShowingTooltip: false
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
mountNode: mountNode,
|
|
88
|
+
elementRef: el => this.ref = el,
|
|
89
|
+
children: _jsx(IconButton, {
|
|
90
|
+
...passthroughProps(props),
|
|
91
|
+
screenReaderLabel: screenReaderLabel,
|
|
92
|
+
withBackground: false,
|
|
93
|
+
withBorder: false,
|
|
94
|
+
color: color,
|
|
95
|
+
size: size,
|
|
96
|
+
elementRef: this.handleRef,
|
|
97
|
+
as: as,
|
|
98
|
+
onClick: onClick,
|
|
99
|
+
interaction: interaction,
|
|
100
|
+
"aria-pressed": status === 'pressed',
|
|
101
|
+
"data-cid": "ToggleButton",
|
|
102
|
+
renderIcon: renderIcon
|
|
103
|
+
})
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
ToggleButton.displayName = "ToggleButton";
|
|
108
|
+
ToggleButton.componentId = 'ToggleButton';
|
|
109
|
+
ToggleButton.allowedProps = allowedProps;
|
|
110
|
+
ToggleButton.defaultProps = {
|
|
111
|
+
size: 'medium',
|
|
112
|
+
as: 'button',
|
|
113
|
+
// Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
|
|
114
|
+
interaction: void 0,
|
|
115
|
+
mountNode: null,
|
|
116
|
+
color: 'secondary',
|
|
117
|
+
placement: 'top center',
|
|
118
|
+
constrain: 'window'
|
|
119
|
+
};
|
|
120
|
+
export { ToggleButton };
|
|
121
|
+
export default ToggleButton;
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
const allowedProps = ['as', 'color', 'constrain', 'elementRef', 'interaction', 'isShowingTooltip', 'mountNode', 'onClick', 'placement', 'renderIcon', 'renderTooltipContent', 'screenReaderLabel', 'size', 'status'];
|
|
26
|
+
export { allowedProps };
|
package/es/exports/a.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
export { BaseButton } from "../BaseButton/v1/index.js";
|
|
25
|
+
export { Button } from "../Button/v1/index.js";
|
|
26
|
+
export { CloseButton } from "../CloseButton/v1/index.js";
|
|
27
|
+
export { CondensedButton } from "../CondensedButton/v1/index.js";
|
|
28
|
+
export { IconButton } from "../IconButton/v1/index.js";
|
|
29
|
+
export { ToggleButton } from "../ToggleButton/v1/index.js";
|
package/es/exports/b.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
export { BaseButton } from "../BaseButton/v2/index.js";
|
|
25
|
+
export { Button } from "../Button/v2/index.js";
|
|
26
|
+
export { CloseButton } from "../CloseButton/v2/index.js";
|
|
27
|
+
export { CondensedButton } from "../CondensedButton/v2/index.js";
|
|
28
|
+
export { IconButton } from "../IconButton/v2/index.js";
|
|
29
|
+
export { ToggleButton } from "../ToggleButton/v2/index.js";
|
|
@@ -14,7 +14,7 @@ var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProp
|
|
|
14
14
|
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
15
15
|
var _isActiveElement = require("@instructure/ui-dom-utils/lib/isActiveElement.js");
|
|
16
16
|
var _hasVisibleChildren = require("@instructure/ui-a11y-utils/lib/hasVisibleChildren.js");
|
|
17
|
-
var
|
|
17
|
+
var _v11_ = require("@instructure/ui-view/v11_6");
|
|
18
18
|
var _uiUtils = require("@instructure/ui-utils");
|
|
19
19
|
var _combineDataCid = require("@instructure/ui-utils/lib/combineDataCid.js");
|
|
20
20
|
var _emotion = require("@instructure/emotion");
|
|
@@ -54,7 +54,7 @@ var _dec, _class, _BaseButton;
|
|
|
54
54
|
category: components/utilities
|
|
55
55
|
---
|
|
56
56
|
**/
|
|
57
|
-
let BaseButton = exports.BaseButton = (_dec = (0, _emotion.
|
|
57
|
+
let BaseButton = exports.BaseButton = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = (_BaseButton = class BaseButton extends _react.Component {
|
|
58
58
|
constructor(...args) {
|
|
59
59
|
super(...args);
|
|
60
60
|
this.ref = null;
|
|
@@ -242,7 +242,7 @@ let BaseButton = exports.BaseButton = (_dec = (0, _emotion.withStyle)(_styles.de
|
|
|
242
242
|
if (onClick && as && needsZeroTabIndex || (0, _uiUtils.isSafari)() && as) {
|
|
243
243
|
tabIndexValue = tabIndex || 0;
|
|
244
244
|
}
|
|
245
|
-
return (0, _jsxRuntime.jsx)(
|
|
245
|
+
return (0, _jsxRuntime.jsx)(_v11_.View, {
|
|
246
246
|
...(0, _passthroughProps.passthroughProps)(props),
|
|
247
247
|
as: elementType,
|
|
248
248
|
focusColor: this.focusColor,
|