@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.
Files changed (216) hide show
  1. package/CHANGELOG.md +57 -323
  2. package/es/BaseButton/{index.js → v1/index.js} +2 -2
  3. package/es/BaseButton/v2/index.js +304 -0
  4. package/es/BaseButton/v2/props.js +26 -0
  5. package/es/BaseButton/v2/styles.js +578 -0
  6. package/es/Button/{index.js → v1/index.js} +2 -2
  7. package/es/{CondensedButton → Button/v1}/theme.js +1 -1
  8. package/es/Button/v2/index.js +121 -0
  9. package/es/Button/v2/props.js +26 -0
  10. package/es/CloseButton/{index.js → v1/index.js} +2 -2
  11. package/es/CloseButton/v2/index.js +130 -0
  12. package/es/CloseButton/v2/props.js +26 -0
  13. package/es/CloseButton/v2/styles.js +68 -0
  14. package/es/CondensedButton/{index.js → v1/index.js} +2 -2
  15. package/es/{Button → CondensedButton/v1}/theme.js +1 -1
  16. package/es/CondensedButton/v2/index.js +111 -0
  17. package/es/CondensedButton/v2/props.js +26 -0
  18. package/es/IconButton/{index.js → v1/index.js} +2 -2
  19. package/es/IconButton/{theme.js → v1/theme.js} +1 -1
  20. package/es/IconButton/v2/index.js +121 -0
  21. package/es/IconButton/v2/props.js +26 -0
  22. package/es/ToggleButton/{index.js → v1/index.js} +2 -2
  23. package/es/ToggleButton/v2/index.js +121 -0
  24. package/es/ToggleButton/v2/props.js +26 -0
  25. package/es/exports/a.js +29 -0
  26. package/es/exports/b.js +29 -0
  27. package/lib/BaseButton/{index.js → v1/index.js} +3 -3
  28. package/lib/BaseButton/v2/index.js +311 -0
  29. package/lib/BaseButton/v2/props.js +31 -0
  30. package/lib/BaseButton/v2/styles.js +584 -0
  31. package/lib/Button/v1/index.js +128 -0
  32. package/lib/Button/{theme.js → v1/theme.js} +1 -1
  33. package/lib/Button/{index.js → v2/index.js} +3 -4
  34. package/lib/Button/v2/props.js +31 -0
  35. package/lib/CloseButton/{index.js → v1/index.js} +4 -4
  36. package/lib/CloseButton/v2/index.js +136 -0
  37. package/lib/CloseButton/v2/props.js +31 -0
  38. package/lib/CloseButton/v2/styles.js +74 -0
  39. package/lib/CondensedButton/{index.js → v1/index.js} +3 -3
  40. package/lib/CondensedButton/{theme.js → v1/theme.js} +1 -1
  41. package/lib/CondensedButton/v2/index.js +116 -0
  42. package/lib/CondensedButton/v2/props.js +31 -0
  43. package/lib/IconButton/{index.js → v1/index.js} +3 -3
  44. package/lib/IconButton/{theme.js → v1/theme.js} +1 -1
  45. package/lib/IconButton/v2/index.js +126 -0
  46. package/lib/IconButton/v2/props.js +31 -0
  47. package/lib/ToggleButton/{index.js → v1/index.js} +4 -4
  48. package/lib/ToggleButton/v2/index.js +127 -0
  49. package/lib/ToggleButton/v2/props.js +31 -0
  50. package/lib/{index.js → exports/a.js} +12 -12
  51. package/lib/exports/b.js +47 -0
  52. package/package.json +46 -24
  53. package/src/BaseButton/{index.tsx → v1/index.tsx} +3 -3
  54. package/src/BaseButton/{props.ts → v1/props.ts} +1 -1
  55. package/src/BaseButton/v2/README.md +15 -0
  56. package/src/BaseButton/v2/index.tsx +343 -0
  57. package/src/BaseButton/v2/props.ts +226 -0
  58. package/src/BaseButton/v2/styles.ts +640 -0
  59. package/src/Button/{index.tsx → v1/index.tsx} +2 -2
  60. package/src/Button/{props.ts → v1/props.ts} +1 -1
  61. package/src/{CondensedButton → Button/v1}/theme.ts +1 -1
  62. package/src/Button/v2/README.md +338 -0
  63. package/src/Button/v2/index.tsx +137 -0
  64. package/src/Button/v2/props.ts +159 -0
  65. package/src/CloseButton/{index.tsx → v1/index.tsx} +2 -2
  66. package/src/CloseButton/{props.ts → v1/props.ts} +1 -1
  67. package/src/CloseButton/v2/README.md +70 -0
  68. package/src/CloseButton/v2/index.tsx +142 -0
  69. package/src/CloseButton/v2/props.ts +148 -0
  70. package/src/CloseButton/v2/styles.ts +81 -0
  71. package/src/CondensedButton/{index.tsx → v1/index.tsx} +2 -2
  72. package/src/CondensedButton/{props.ts → v1/props.ts} +1 -1
  73. package/src/{Button → CondensedButton/v1}/theme.ts +1 -1
  74. package/src/CondensedButton/v2/README.md +75 -0
  75. package/src/CondensedButton/v2/index.tsx +129 -0
  76. package/src/CondensedButton/v2/props.ts +134 -0
  77. package/src/IconButton/{index.tsx → v1/index.tsx} +2 -2
  78. package/src/IconButton/{props.ts → v1/props.ts} +1 -1
  79. package/src/IconButton/{theme.ts → v1/theme.ts} +1 -1
  80. package/src/IconButton/v2/README.md +86 -0
  81. package/src/IconButton/v2/index.tsx +138 -0
  82. package/src/IconButton/v2/props.ts +166 -0
  83. package/src/ToggleButton/{index.tsx → v1/index.tsx} +2 -2
  84. package/src/ToggleButton/{props.ts → v1/props.ts} +1 -1
  85. package/src/ToggleButton/v2/README.md +85 -0
  86. package/src/ToggleButton/v2/index.tsx +133 -0
  87. package/src/ToggleButton/v2/props.ts +143 -0
  88. package/src/exports/a.ts +40 -0
  89. package/src/exports/b.ts +40 -0
  90. package/tsconfig.build.tsbuildinfo +1 -1
  91. package/types/BaseButton/{index.d.ts → v1/index.d.ts} +1 -1
  92. package/types/BaseButton/v1/index.d.ts.map +1 -0
  93. package/types/BaseButton/{props.d.ts → v1/props.d.ts} +1 -1
  94. package/types/BaseButton/v1/props.d.ts.map +1 -0
  95. package/types/BaseButton/v1/styles.d.ts.map +1 -0
  96. package/types/BaseButton/v1/theme.d.ts.map +1 -0
  97. package/types/BaseButton/v2/index.d.ts +48 -0
  98. package/types/BaseButton/v2/index.d.ts.map +1 -0
  99. package/types/BaseButton/v2/props.d.ts +118 -0
  100. package/types/BaseButton/v2/props.d.ts.map +1 -0
  101. package/types/BaseButton/v2/styles.d.ts +5 -0
  102. package/types/BaseButton/v2/styles.d.ts.map +1 -0
  103. package/types/Button/{index.d.ts → v1/index.d.ts} +2 -2
  104. package/types/Button/v1/index.d.ts.map +1 -0
  105. package/types/Button/{props.d.ts → v1/props.d.ts} +1 -1
  106. package/types/Button/v1/props.d.ts.map +1 -0
  107. package/types/Button/v1/theme.d.ts +2 -0
  108. package/types/Button/v1/theme.d.ts.map +1 -0
  109. package/types/Button/v2/index.d.ts +51 -0
  110. package/types/Button/v2/index.d.ts.map +1 -0
  111. package/types/Button/v2/props.d.ts +82 -0
  112. package/types/Button/v2/props.d.ts.map +1 -0
  113. package/types/CloseButton/{index.d.ts → v1/index.d.ts} +1 -1
  114. package/types/CloseButton/v1/index.d.ts.map +1 -0
  115. package/types/CloseButton/{props.d.ts → v1/props.d.ts} +1 -1
  116. package/types/CloseButton/v1/props.d.ts.map +1 -0
  117. package/types/CloseButton/v1/styles.d.ts.map +1 -0
  118. package/types/CloseButton/v1/theme.d.ts.map +1 -0
  119. package/types/CloseButton/v2/index.d.ts +46 -0
  120. package/types/CloseButton/v2/index.d.ts.map +1 -0
  121. package/types/CloseButton/v2/props.d.ts +77 -0
  122. package/types/CloseButton/v2/props.d.ts.map +1 -0
  123. package/types/CloseButton/v2/styles.d.ts +15 -0
  124. package/types/CloseButton/v2/styles.d.ts.map +1 -0
  125. package/types/CondensedButton/{index.d.ts → v1/index.d.ts} +2 -2
  126. package/types/CondensedButton/v1/index.d.ts.map +1 -0
  127. package/types/CondensedButton/{props.d.ts → v1/props.d.ts} +1 -1
  128. package/types/CondensedButton/v1/props.d.ts.map +1 -0
  129. package/types/CondensedButton/v1/theme.d.ts +2 -0
  130. package/types/CondensedButton/v1/theme.d.ts.map +1 -0
  131. package/types/CondensedButton/v2/index.d.ts +45 -0
  132. package/types/CondensedButton/v2/index.d.ts.map +1 -0
  133. package/types/CondensedButton/v2/props.d.ts +69 -0
  134. package/types/CondensedButton/v2/props.d.ts.map +1 -0
  135. package/types/IconButton/{index.d.ts → v1/index.d.ts} +2 -2
  136. package/types/IconButton/v1/index.d.ts.map +1 -0
  137. package/types/IconButton/{props.d.ts → v1/props.d.ts} +1 -1
  138. package/types/IconButton/v1/props.d.ts.map +1 -0
  139. package/types/IconButton/v1/theme.d.ts +2 -0
  140. package/types/IconButton/v1/theme.d.ts.map +1 -0
  141. package/types/IconButton/v2/index.d.ts +51 -0
  142. package/types/IconButton/v2/index.d.ts.map +1 -0
  143. package/types/IconButton/v2/props.d.ts +85 -0
  144. package/types/IconButton/v2/props.d.ts.map +1 -0
  145. package/types/ToggleButton/{index.d.ts → v1/index.d.ts} +1 -1
  146. package/types/ToggleButton/v1/index.d.ts.map +1 -0
  147. package/types/ToggleButton/{props.d.ts → v1/props.d.ts} +1 -1
  148. package/types/ToggleButton/v1/props.d.ts.map +1 -0
  149. package/types/ToggleButton/v2/index.d.ts +43 -0
  150. package/types/ToggleButton/v2/index.d.ts.map +1 -0
  151. package/types/ToggleButton/v2/props.d.ts +75 -0
  152. package/types/ToggleButton/v2/props.d.ts.map +1 -0
  153. package/types/exports/a.d.ts +13 -0
  154. package/types/exports/a.d.ts.map +1 -0
  155. package/types/exports/b.d.ts +13 -0
  156. package/types/exports/b.d.ts.map +1 -0
  157. package/es/index.js +0 -29
  158. package/src/index.ts +0 -37
  159. package/types/BaseButton/index.d.ts.map +0 -1
  160. package/types/BaseButton/props.d.ts.map +0 -1
  161. package/types/BaseButton/styles.d.ts.map +0 -1
  162. package/types/BaseButton/theme.d.ts.map +0 -1
  163. package/types/Button/index.d.ts.map +0 -1
  164. package/types/Button/props.d.ts.map +0 -1
  165. package/types/Button/theme.d.ts +0 -2
  166. package/types/Button/theme.d.ts.map +0 -1
  167. package/types/CloseButton/index.d.ts.map +0 -1
  168. package/types/CloseButton/props.d.ts.map +0 -1
  169. package/types/CloseButton/styles.d.ts.map +0 -1
  170. package/types/CloseButton/theme.d.ts.map +0 -1
  171. package/types/CondensedButton/index.d.ts.map +0 -1
  172. package/types/CondensedButton/props.d.ts.map +0 -1
  173. package/types/CondensedButton/theme.d.ts +0 -2
  174. package/types/CondensedButton/theme.d.ts.map +0 -1
  175. package/types/IconButton/index.d.ts.map +0 -1
  176. package/types/IconButton/props.d.ts.map +0 -1
  177. package/types/IconButton/theme.d.ts +0 -2
  178. package/types/IconButton/theme.d.ts.map +0 -1
  179. package/types/ToggleButton/index.d.ts.map +0 -1
  180. package/types/ToggleButton/props.d.ts.map +0 -1
  181. package/types/index.d.ts +0 -13
  182. package/types/index.d.ts.map +0 -1
  183. /package/es/BaseButton/{props.js → v1/props.js} +0 -0
  184. /package/es/BaseButton/{styles.js → v1/styles.js} +0 -0
  185. /package/es/BaseButton/{theme.js → v1/theme.js} +0 -0
  186. /package/es/Button/{props.js → v1/props.js} +0 -0
  187. /package/es/CloseButton/{props.js → v1/props.js} +0 -0
  188. /package/es/CloseButton/{styles.js → v1/styles.js} +0 -0
  189. /package/es/CloseButton/{theme.js → v1/theme.js} +0 -0
  190. /package/es/CondensedButton/{props.js → v1/props.js} +0 -0
  191. /package/es/IconButton/{props.js → v1/props.js} +0 -0
  192. /package/es/ToggleButton/{props.js → v1/props.js} +0 -0
  193. /package/lib/BaseButton/{props.js → v1/props.js} +0 -0
  194. /package/lib/BaseButton/{styles.js → v1/styles.js} +0 -0
  195. /package/lib/BaseButton/{theme.js → v1/theme.js} +0 -0
  196. /package/lib/Button/{props.js → v1/props.js} +0 -0
  197. /package/lib/CloseButton/{props.js → v1/props.js} +0 -0
  198. /package/lib/CloseButton/{styles.js → v1/styles.js} +0 -0
  199. /package/lib/CloseButton/{theme.js → v1/theme.js} +0 -0
  200. /package/lib/CondensedButton/{props.js → v1/props.js} +0 -0
  201. /package/lib/IconButton/{props.js → v1/props.js} +0 -0
  202. /package/lib/ToggleButton/{props.js → v1/props.js} +0 -0
  203. /package/src/BaseButton/{README.md → v1/README.md} +0 -0
  204. /package/src/BaseButton/{styles.ts → v1/styles.ts} +0 -0
  205. /package/src/BaseButton/{theme.ts → v1/theme.ts} +0 -0
  206. /package/src/Button/{README.md → v1/README.md} +0 -0
  207. /package/src/CloseButton/{README.md → v1/README.md} +0 -0
  208. /package/src/CloseButton/{styles.ts → v1/styles.ts} +0 -0
  209. /package/src/CloseButton/{theme.ts → v1/theme.ts} +0 -0
  210. /package/src/CondensedButton/{README.md → v1/README.md} +0 -0
  211. /package/src/IconButton/{README.md → v1/README.md} +0 -0
  212. /package/src/ToggleButton/{README.md → v1/README.md} +0 -0
  213. /package/types/BaseButton/{styles.d.ts → v1/styles.d.ts} +0 -0
  214. /package/types/BaseButton/{theme.d.ts → v1/theme.d.ts} +0 -0
  215. /package/types/CloseButton/{styles.d.ts → v1/styles.d.ts} +0 -0
  216. /package/types/CloseButton/{theme.d.ts → v1/theme.d.ts} +0 -0
@@ -12,7 +12,7 @@ var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReade
12
12
  var _combineDataCid = require("@instructure/ui-utils/lib/combineDataCid.js");
13
13
  var _emotion = require("@instructure/emotion");
14
14
  var _theme = _interopRequireDefault(require("./theme"));
15
- var _BaseButton = require("../BaseButton");
15
+ var _v = require("../../BaseButton/v1");
16
16
  var _props = require("./props");
17
17
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
18
18
  const _excluded = ["children", "renderIcon", "screenReaderLabel", "type", "size", "elementRef", "as", "interaction", "color", "focusColor", "shape", "withBackground", "withBorder", "margin", "cursor", "href"];
@@ -46,7 +46,7 @@ category: components
46
46
  ---
47
47
  **/
48
48
  // needed for listing the available theme variables on docs page
49
- let IconButton = exports.IconButton = (_dec = (0, _emotion.withStyle)(null, _theme.default), _dec(_class = (_IconButton = class IconButton extends _react.Component {
49
+ let IconButton = exports.IconButton = (_dec = (0, _emotion.withStyleLegacy)(null, _theme.default), _dec(_class = (_IconButton = class IconButton extends _react.Component {
50
50
  constructor(...args) {
51
51
  super(...args);
52
52
  this._baseButton = null;
@@ -85,7 +85,7 @@ let IconButton = exports.IconButton = (_dec = (0, _emotion.withStyle)(null, _the
85
85
  href = _this$props.href,
86
86
  props = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
87
87
  const themeOverride = this.props.themeOverride;
88
- return (0, _jsxRuntime.jsx)(_BaseButton.BaseButton, {
88
+ return (0, _jsxRuntime.jsx)(_v.BaseButton, {
89
89
  ...(0, _passthroughProps.passthroughProps)(props),
90
90
  type: type,
91
91
  size: size,
@@ -10,4 +10,4 @@ Object.defineProperty(exports, "default", {
10
10
  return _theme.default;
11
11
  }
12
12
  });
13
- var _theme = _interopRequireDefault(require("../BaseButton/theme"));
13
+ var _theme = _interopRequireDefault(require("../../BaseButton/v1/theme"));
@@ -0,0 +1,126 @@
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.IconButton = 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 _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
12
+ var _combineDataCid = require("@instructure/ui-utils/lib/combineDataCid.js");
13
+ var _emotion = require("@instructure/emotion");
14
+ var _v = require("../../BaseButton/v2");
15
+ var _props = require("./props");
16
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
+ const _excluded = ["children", "renderIcon", "screenReaderLabel", "type", "size", "elementRef", "as", "interaction", "color", "focusColor", "shape", "withBackground", "withBorder", "margin", "cursor", "href"];
18
+ var _dec, _class, _IconButton;
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 IconButton = exports.IconButton = (_dec = (0, _emotion.withStyle)(null, 'BaseButton'), _dec(_class = (_IconButton = class IconButton extends _react.Component {
49
+ constructor(...args) {
50
+ super(...args);
51
+ this._baseButton = null;
52
+ this.ref = null;
53
+ this.handleRef = el => {
54
+ const elementRef = this.props.elementRef;
55
+ this.ref = el;
56
+ if (typeof elementRef === 'function') {
57
+ elementRef(el);
58
+ }
59
+ };
60
+ }
61
+ get focused() {
62
+ return this._baseButton && this._baseButton.focused;
63
+ }
64
+ focus() {
65
+ this._baseButton && this._baseButton.focus();
66
+ }
67
+ render() {
68
+ const _this$props = this.props,
69
+ children = _this$props.children,
70
+ renderIcon = _this$props.renderIcon,
71
+ screenReaderLabel = _this$props.screenReaderLabel,
72
+ type = _this$props.type,
73
+ size = _this$props.size,
74
+ elementRef = _this$props.elementRef,
75
+ as = _this$props.as,
76
+ interaction = _this$props.interaction,
77
+ color = _this$props.color,
78
+ focusColor = _this$props.focusColor,
79
+ shape = _this$props.shape,
80
+ withBackground = _this$props.withBackground,
81
+ withBorder = _this$props.withBorder,
82
+ margin = _this$props.margin,
83
+ cursor = _this$props.cursor,
84
+ href = _this$props.href,
85
+ props = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
86
+ const themeOverride = this.props.themeOverride;
87
+ return (0, _jsxRuntime.jsx)(_v.BaseButton, {
88
+ ...(0, _passthroughProps.passthroughProps)(props),
89
+ type: type,
90
+ size: size,
91
+ elementRef: this.handleRef,
92
+ as: as,
93
+ interaction: interaction,
94
+ color: color,
95
+ focusColor: focusColor,
96
+ shape: shape,
97
+ withBackground: withBackground,
98
+ withBorder: withBorder,
99
+ margin: margin,
100
+ cursor: cursor,
101
+ href: href,
102
+ renderIcon: children || renderIcon,
103
+ themeOverride: themeOverride,
104
+ ref: component => {
105
+ this._baseButton = component;
106
+ },
107
+ "data-cid": (0, _combineDataCid.combineDataCid)('IconButton', this.props),
108
+ children: (0, _jsxRuntime.jsx)(_ScreenReaderContent.ScreenReaderContent, {
109
+ children: screenReaderLabel
110
+ })
111
+ });
112
+ }
113
+ }, _IconButton.displayName = "IconButton", _IconButton.componentId = 'IconButton', _IconButton.allowedProps = _props.allowedProps, _IconButton.defaultProps = {
114
+ type: 'button',
115
+ size: 'medium',
116
+ as: 'button',
117
+ // Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
118
+ interaction: void 0,
119
+ color: 'secondary',
120
+ shape: 'rectangle',
121
+ withBackground: true,
122
+ withBorder: true,
123
+ margin: '0',
124
+ cursor: 'pointer'
125
+ }, _IconButton)) || _class);
126
+ var _default = exports.default = IconButton;
@@ -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', 'focusColor', 'href', 'interaction', 'margin', 'renderIcon', 'screenReaderLabel', 'shape', 'size', 'type', 'withBackground', 'withBorder', 'onClick'];
@@ -9,8 +9,8 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
9
9
  var _react = require("react");
10
10
  var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
11
11
  var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
12
- var _Tooltip = require("@instructure/ui-tooltip/lib/Tooltip");
13
- var _IconButton = require("../IconButton");
12
+ var _v11_ = require("@instructure/ui-tooltip/v11_6");
13
+ var _v = require("../../IconButton/v1");
14
14
  var _props = require("./props");
15
15
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
16
16
  const _excluded = ["as", "color", "elementRef", "size", "interaction", "mountNode", "renderIcon", "renderTooltipContent", "screenReaderLabel", "status", "placement", "onClick"];
@@ -75,7 +75,7 @@ class ToggleButton extends _react.Component {
75
75
  placement = _this$props.placement,
76
76
  onClick = _this$props.onClick,
77
77
  props = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
78
- return (0, _jsxRuntime.jsx)(_Tooltip.Tooltip, {
78
+ return (0, _jsxRuntime.jsx)(_v11_.Tooltip, {
79
79
  renderTip: renderTooltipContent,
80
80
  on: ['hover', 'focus'],
81
81
  placement: placement,
@@ -93,7 +93,7 @@ class ToggleButton extends _react.Component {
93
93
  },
94
94
  mountNode: mountNode,
95
95
  elementRef: el => this.ref = el,
96
- children: (0, _jsxRuntime.jsx)(_IconButton.IconButton, {
96
+ children: (0, _jsxRuntime.jsx)(_v.IconButton, {
97
97
  ...(0, _passthroughProps.passthroughProps)(props),
98
98
  screenReaderLabel: screenReaderLabel,
99
99
  withBackground: false,
@@ -0,0 +1,127 @@
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.ToggleButton = 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 _latest = require("@instructure/ui-tooltip/latest");
12
+ var _v = require("../../IconButton/v2");
13
+ var _props = require("./props");
14
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
15
+ const _excluded = ["as", "color", "elementRef", "size", "interaction", "mountNode", "renderIcon", "renderTooltipContent", "screenReaderLabel", "status", "placement", "onClick"];
16
+ /*
17
+ * The MIT License (MIT)
18
+ *
19
+ * Copyright (c) 2015 - present Instructure, Inc.
20
+ *
21
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
22
+ * of this software and associated documentation files (the "Software"), to deal
23
+ * in the Software without restriction, including without limitation the rights
24
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25
+ * copies of the Software, and to permit persons to whom the Software is
26
+ * furnished to do so, subject to the following conditions:
27
+ *
28
+ * The above copyright notice and this permission notice shall be included in all
29
+ * copies or substantial portions of the Software.
30
+ *
31
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
+ * SOFTWARE.
38
+ */
39
+ /**
40
+ ---
41
+ category: components
42
+ ---
43
+ **/
44
+
45
+ class ToggleButton extends _react.Component {
46
+ constructor(props) {
47
+ super(props);
48
+ this.ref = null;
49
+ this.handleRef = el => {
50
+ const elementRef = this.props.elementRef;
51
+ if (typeof elementRef === 'function') {
52
+ elementRef(el);
53
+ }
54
+ };
55
+ this.state = {
56
+ isShowingTooltip: props.isShowingTooltip || false
57
+ };
58
+ }
59
+ get isShowingTooltip() {
60
+ return typeof this.props.isShowingTooltip === 'undefined' ? this.state.isShowingTooltip : this.props.isShowingTooltip;
61
+ }
62
+ render() {
63
+ const _this$props = this.props,
64
+ as = _this$props.as,
65
+ color = _this$props.color,
66
+ elementRef = _this$props.elementRef,
67
+ size = _this$props.size,
68
+ interaction = _this$props.interaction,
69
+ mountNode = _this$props.mountNode,
70
+ renderIcon = _this$props.renderIcon,
71
+ renderTooltipContent = _this$props.renderTooltipContent,
72
+ screenReaderLabel = _this$props.screenReaderLabel,
73
+ status = _this$props.status,
74
+ placement = _this$props.placement,
75
+ onClick = _this$props.onClick,
76
+ props = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
77
+ return (0, _jsxRuntime.jsx)(_latest.Tooltip, {
78
+ renderTip: renderTooltipContent,
79
+ on: ['hover', 'focus'],
80
+ placement: placement,
81
+ color: color === 'primary-inverse' ? 'primary-inverse' : 'primary',
82
+ isShowingContent: this.isShowingTooltip,
83
+ onShowContent: () => {
84
+ this.setState({
85
+ isShowingTooltip: true
86
+ });
87
+ },
88
+ onHideContent: () => {
89
+ this.setState({
90
+ isShowingTooltip: false
91
+ });
92
+ },
93
+ mountNode: mountNode,
94
+ elementRef: el => this.ref = el,
95
+ children: (0, _jsxRuntime.jsx)(_v.IconButton, {
96
+ ...(0, _passthroughProps.passthroughProps)(props),
97
+ screenReaderLabel: screenReaderLabel,
98
+ withBackground: false,
99
+ withBorder: false,
100
+ color: color,
101
+ size: size,
102
+ elementRef: this.handleRef,
103
+ as: as,
104
+ onClick: onClick,
105
+ interaction: interaction,
106
+ "aria-pressed": status === 'pressed',
107
+ "data-cid": "ToggleButton",
108
+ renderIcon: renderIcon
109
+ })
110
+ });
111
+ }
112
+ }
113
+ exports.ToggleButton = ToggleButton;
114
+ ToggleButton.displayName = "ToggleButton";
115
+ ToggleButton.componentId = 'ToggleButton';
116
+ ToggleButton.allowedProps = _props.allowedProps;
117
+ ToggleButton.defaultProps = {
118
+ size: 'medium',
119
+ as: 'button',
120
+ // Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied
121
+ interaction: void 0,
122
+ mountNode: null,
123
+ color: 'secondary',
124
+ placement: 'top center',
125
+ constrain: 'window'
126
+ };
127
+ var _default = exports.default = ToggleButton;
@@ -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', 'constrain', 'elementRef', 'interaction', 'isShowingTooltip', 'mountNode', 'onClick', 'placement', 'renderIcon', 'renderTooltipContent', 'screenReaderLabel', 'size', 'status'];
@@ -6,42 +6,42 @@ Object.defineProperty(exports, "__esModule", {
6
6
  Object.defineProperty(exports, "BaseButton", {
7
7
  enumerable: true,
8
8
  get: function () {
9
- return _BaseButton.BaseButton;
9
+ return _v.BaseButton;
10
10
  }
11
11
  });
12
12
  Object.defineProperty(exports, "Button", {
13
13
  enumerable: true,
14
14
  get: function () {
15
- return _Button.Button;
15
+ return _v2.Button;
16
16
  }
17
17
  });
18
18
  Object.defineProperty(exports, "CloseButton", {
19
19
  enumerable: true,
20
20
  get: function () {
21
- return _CloseButton.CloseButton;
21
+ return _v3.CloseButton;
22
22
  }
23
23
  });
24
24
  Object.defineProperty(exports, "CondensedButton", {
25
25
  enumerable: true,
26
26
  get: function () {
27
- return _CondensedButton.CondensedButton;
27
+ return _v4.CondensedButton;
28
28
  }
29
29
  });
30
30
  Object.defineProperty(exports, "IconButton", {
31
31
  enumerable: true,
32
32
  get: function () {
33
- return _IconButton.IconButton;
33
+ return _v5.IconButton;
34
34
  }
35
35
  });
36
36
  Object.defineProperty(exports, "ToggleButton", {
37
37
  enumerable: true,
38
38
  get: function () {
39
- return _ToggleButton.ToggleButton;
39
+ return _v6.ToggleButton;
40
40
  }
41
41
  });
42
- var _BaseButton = require("./BaseButton");
43
- var _Button = require("./Button");
44
- var _CloseButton = require("./CloseButton");
45
- var _CondensedButton = require("./CondensedButton");
46
- var _IconButton = require("./IconButton");
47
- var _ToggleButton = require("./ToggleButton");
42
+ var _v = require("../BaseButton/v1");
43
+ var _v2 = require("../Button/v1");
44
+ var _v3 = require("../CloseButton/v1");
45
+ var _v4 = require("../CondensedButton/v1");
46
+ var _v5 = require("../IconButton/v1");
47
+ var _v6 = require("../ToggleButton/v1");
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "BaseButton", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _v.BaseButton;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "Button", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _v2.Button;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "CloseButton", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _v3.CloseButton;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "CondensedButton", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _v4.CondensedButton;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "IconButton", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _v5.IconButton;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "ToggleButton", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _v6.ToggleButton;
40
+ }
41
+ });
42
+ var _v = require("../BaseButton/v2");
43
+ var _v2 = require("../Button/v2");
44
+ var _v3 = require("../CloseButton/v2");
45
+ var _v4 = require("../CondensedButton/v2");
46
+ var _v5 = require("../IconButton/v2");
47
+ var _v6 = require("../ToggleButton/v2");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-buttons",
3
- "version": "11.6.0",
3
+ "version": "11.6.1-snapshot-129",
4
4
  "description": "Accessible button components",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -16,28 +16,28 @@
16
16
  "dependencies": {
17
17
  "@babel/runtime": "^7.27.6",
18
18
  "keycode": "^2",
19
- "@instructure/console": "11.6.0",
20
- "@instructure/shared-types": "11.6.0",
21
- "@instructure/ui-a11y-content": "11.6.0",
22
- "@instructure/ui-a11y-utils": "11.6.0",
23
- "@instructure/emotion": "11.6.0",
24
- "@instructure/ui-color-utils": "11.6.0",
25
- "@instructure/ui-icons": "11.6.0",
26
- "@instructure/ui-dom-utils": "11.6.0",
27
- "@instructure/ui-react-utils": "11.6.0",
28
- "@instructure/ui-tooltip": "11.6.0",
29
- "@instructure/ui-position": "11.6.0",
30
- "@instructure/ui-utils": "11.6.0",
31
- "@instructure/ui-view": "11.6.0"
19
+ "@instructure/console": "11.6.1-snapshot-129",
20
+ "@instructure/emotion": "11.6.1-snapshot-129",
21
+ "@instructure/shared-types": "11.6.1-snapshot-129",
22
+ "@instructure/ui-a11y-content": "11.6.1-snapshot-129",
23
+ "@instructure/ui-a11y-utils": "11.6.1-snapshot-129",
24
+ "@instructure/ui-color-utils": "11.6.1-snapshot-129",
25
+ "@instructure/ui-icons": "11.6.1-snapshot-129",
26
+ "@instructure/ui-dom-utils": "11.6.1-snapshot-129",
27
+ "@instructure/ui-position": "11.6.1-snapshot-129",
28
+ "@instructure/ui-tooltip": "11.6.1-snapshot-129",
29
+ "@instructure/ui-react-utils": "11.6.1-snapshot-129",
30
+ "@instructure/ui-utils": "11.6.1-snapshot-129",
31
+ "@instructure/ui-view": "11.6.1-snapshot-129"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@testing-library/jest-dom": "^6.6.3",
35
35
  "@testing-library/react": "15.0.7",
36
36
  "@testing-library/user-event": "^14.6.1",
37
37
  "vitest": "^3.2.2",
38
- "@instructure/ui-babel-preset": "11.6.0",
39
- "@instructure/ui-axe-check": "11.6.0",
40
- "@instructure/ui-themes": "11.6.0"
38
+ "@instructure/ui-axe-check": "11.6.1-snapshot-129",
39
+ "@instructure/ui-babel-preset": "11.6.1-snapshot-129",
40
+ "@instructure/ui-themes": "11.6.1-snapshot-129"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "react": ">=18 <=19"
@@ -47,17 +47,39 @@
47
47
  },
48
48
  "sideEffects": false,
49
49
  "exports": {
50
- ".": {
51
- "types": "./types/index.d.ts",
52
- "import": "./es/index.js",
53
- "require": "./lib/index.js",
54
- "default": "./es/index.js"
55
- },
56
50
  "./lib/*": "./lib/*",
57
51
  "./es/*": "./es/*",
58
52
  "./types/*": "./types/*",
59
53
  "./package.json": "./package.json",
60
- "./src/*": "./src/*"
54
+ "./src/*": "./src/*",
55
+ ".": {
56
+ "src": "./src/exports/a.ts",
57
+ "types": "./types/exports/a.d.ts",
58
+ "import": "./es/exports/a.js",
59
+ "require": "./lib/exports/a.js",
60
+ "default": "./es/exports/a.js"
61
+ },
62
+ "./v11_6": {
63
+ "src": "./src/exports/a.ts",
64
+ "types": "./types/exports/a.d.ts",
65
+ "import": "./es/exports/a.js",
66
+ "require": "./lib/exports/a.js",
67
+ "default": "./es/exports/a.js"
68
+ },
69
+ "./v11_7": {
70
+ "src": "./src/exports/b.ts",
71
+ "types": "./types/exports/b.d.ts",
72
+ "import": "./es/exports/b.js",
73
+ "require": "./lib/exports/b.js",
74
+ "default": "./es/exports/b.js"
75
+ },
76
+ "./latest": {
77
+ "src": "./src/exports/b.ts",
78
+ "types": "./types/exports/b.d.ts",
79
+ "import": "./es/exports/b.js",
80
+ "require": "./lib/exports/b.js",
81
+ "default": "./es/exports/b.js"
82
+ }
61
83
  },
62
84
  "scripts": {
63
85
  "lint": "ui-scripts lint",
@@ -33,15 +33,15 @@ import {
33
33
  } from '@instructure/ui-react-utils'
34
34
  import { isActiveElement } from '@instructure/ui-dom-utils'
35
35
  import { hasVisibleChildren } from '@instructure/ui-a11y-utils'
36
- import { View } from '@instructure/ui-view'
37
- import type { ViewProps } from '@instructure/ui-view'
36
+ import { View } from '@instructure/ui-view/v11_6'
37
+ import type { ViewProps } from '@instructure/ui-view/v11_6'
38
38
 
39
39
  // TODO these have to be imported in separate lines because otherwise `isSafari` will be missing from the babel build
40
40
  // this bug is very likely caused by `babel-plugin-transform-imports` and can be reverted once it is removed from the codebase
41
41
  import { isSafari } from '@instructure/ui-utils'
42
42
  import { combineDataCid } from '@instructure/ui-utils'
43
43
 
44
- import { withStyle } from '@instructure/emotion'
44
+ import { withStyleLegacy as withStyle } from '@instructure/emotion'
45
45
 
46
46
  import generateStyles from './styles'
47
47
  import generateComponentTheme from './theme'
@@ -36,7 +36,7 @@ import type {
36
36
  OtherHTMLAttributes
37
37
  } from '@instructure/shared-types'
38
38
  import type { Cursor } from '@instructure/shared-types'
39
- import type { ViewProps } from '@instructure/ui-view'
39
+ import type { ViewProps } from '@instructure/ui-view/v11_6'
40
40
  import { Renderable } from '@instructure/shared-types'
41
41
 
42
42
  type BaseButtonOwnProps = {
@@ -0,0 +1,15 @@
1
+ ---
2
+ describes: BaseButton
3
+ ---
4
+
5
+ `BaseButton` is a low level utility component used to compose Instructure UI buttons. In most cases, it should not be used directly.
6
+ Use [Button](Button), [CloseButton](CloseButton), [IconButton](IconButton), or [CondensedButton](CondensedButton) instead.
7
+
8
+ ```js
9
+ ---
10
+ type: example
11
+ ---
12
+ <View display="block" margin="medium">
13
+ <BaseButton>Click me</BaseButton>
14
+ </View>
15
+ ```