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