@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,640 @@
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
+ import type { NewComponentTypes, SharedTokens } from '@instructure/ui-themes'
26
+ import type {
27
+ BaseButtonProps,
28
+ BaseButtonStyleProps,
29
+ BaseButtonStyle
30
+ } from './props'
31
+
32
+ const generateStyle = (
33
+ componentTheme: NewComponentTypes['BaseButton'],
34
+ params: BaseButtonProps,
35
+ _sharedTokens: SharedTokens,
36
+ extraArgs: BaseButtonStyleProps
37
+ ): BaseButtonStyle => {
38
+ const {
39
+ size,
40
+ color,
41
+ textAlign,
42
+ shape,
43
+ withBackground,
44
+ withBorder,
45
+ isCondensed
46
+ } = params
47
+
48
+ const { isDisabled, hasOnlyIconVisible, isEnabled } = extraArgs
49
+
50
+ const gapForSize = {
51
+ small: componentTheme.gapButtonContentSm,
52
+ medium: componentTheme.gapButtonContentMd,
53
+ large: componentTheme.gapButtonContentLg,
54
+ condensedSmall: componentTheme.gapButtonContentSm,
55
+ condensedMedium: componentTheme.gapButtonContentSm
56
+ }
57
+
58
+ const shapeVariants = {
59
+ circle: { borderRadius: componentTheme.borderRadiusFull },
60
+ rectangle: {}
61
+ }
62
+
63
+ const sizeVariants = {
64
+ small: {
65
+ content: {
66
+ fontSize: componentTheme.smallFontSize,
67
+ paddingLeft: componentTheme.smallPaddingHorizontal,
68
+ paddingRight: componentTheme.smallPaddingHorizontal,
69
+ minHeight: componentTheme.smallHeight,
70
+ ...(hasOnlyIconVisible && {
71
+ paddingLeft: 0,
72
+ paddingRight: 0,
73
+ width: componentTheme.smallHeight
74
+ })
75
+ }
76
+ },
77
+ medium: {
78
+ content: {
79
+ fontSize: componentTheme.mediumFontSize,
80
+ paddingLeft: componentTheme.mediumPaddingHorizontal,
81
+ paddingRight: componentTheme.mediumPaddingHorizontal,
82
+ minHeight: componentTheme.mediumHeight,
83
+ ...(hasOnlyIconVisible && {
84
+ paddingLeft: 0,
85
+ paddingRight: 0,
86
+ width: componentTheme.mediumHeight
87
+ })
88
+ }
89
+ },
90
+ large: {
91
+ content: {
92
+ fontSize: componentTheme.largeFontSize,
93
+ paddingLeft: componentTheme.largePaddingHorizontal,
94
+ paddingRight: componentTheme.largePaddingHorizontal,
95
+ minHeight: componentTheme.largeHeight,
96
+ ...(hasOnlyIconVisible && {
97
+ paddingLeft: 0,
98
+ paddingRight: 0,
99
+ width: componentTheme.largeHeight
100
+ })
101
+ }
102
+ },
103
+ condensedSmall: {
104
+ content: {
105
+ fontSize: componentTheme.smallFontSize,
106
+ paddingLeft: componentTheme.smallPaddingHorizontal,
107
+ paddingRight: componentTheme.smallPaddingHorizontal,
108
+ height: componentTheme.heightXxs,
109
+ ...(hasOnlyIconVisible && {
110
+ paddingLeft: 0,
111
+ paddingRight: 0,
112
+ width: componentTheme.heightXxs
113
+ })
114
+ }
115
+ },
116
+ condensedMedium: {
117
+ content: {
118
+ fontSize: componentTheme.smallFontSize,
119
+ paddingLeft: componentTheme.smallPaddingHorizontal,
120
+ paddingRight: componentTheme.smallPaddingHorizontal,
121
+ height: componentTheme.heightXs,
122
+ ...(hasOnlyIconVisible && {
123
+ paddingLeft: 0,
124
+ paddingRight: 0,
125
+ width: componentTheme.heightXs
126
+ })
127
+ }
128
+ }
129
+ }
130
+
131
+ const colorVariants = {
132
+ 'ai-primary': {
133
+ default: {
134
+ color: componentTheme.aiBaseTextColor,
135
+ background: `
136
+ linear-gradient(to bottom, ${componentTheme.aiBackgroundTopGradientColor} 0%, ${componentTheme.aiBackgroundBottomGradientColor} 100%) padding-box,
137
+ linear-gradient(to bottom, ${componentTheme.aiBorderTopGradientColor} 0%, ${componentTheme.aiBorderBottomGradientColor} 100%) border-box`,
138
+ borderStyle: 'solid',
139
+ borderColor: 'transparent',
140
+ boxShadow: componentTheme.primaryBoxShadow
141
+ },
142
+ active: {
143
+ background: `
144
+ linear-gradient(to bottom, ${componentTheme.aiActiveBackgroundTopGradientColor} 0%, ${componentTheme.aiActiveBackgroundBottomGradientColor} 100%) padding-box,
145
+ linear-gradient(to bottom, ${componentTheme.aiActiveBorderTopGradientColor} 0%, ${componentTheme.aiActiveBorderBottomGradientColor} 100%) border-box`,
146
+ borderStyle: 'solid',
147
+ borderColor: 'transparent',
148
+ color: componentTheme.aiActiveTextColor
149
+ },
150
+ hover: {
151
+ background: `
152
+ linear-gradient(to bottom, ${componentTheme.aiHoverBackgroundTopGradientColor} 0%, ${componentTheme.aiHoverBackgroundBottomGradientColor} 100%) padding-box,
153
+ linear-gradient(to bottom, ${componentTheme.aiHoverBorderTopGradientColor} 0%, ${componentTheme.aiHoverBorderBottomGradientColor} 100%) border-box`,
154
+ borderStyle: 'solid',
155
+ borderColor: 'transparent',
156
+ color: componentTheme.aiHoverTextColor,
157
+ boxShadow: componentTheme.primaryHoverBoxShadow
158
+ },
159
+ disabled: {
160
+ background: componentTheme.aiDisabledBackgroundColor,
161
+ borderColor: componentTheme.aiDisabledBorderColor,
162
+ color: componentTheme.aiDisabledTextColor
163
+ }
164
+ },
165
+ 'ai-secondary': {
166
+ default: {
167
+ boxShadow: componentTheme.primaryBoxShadow
168
+ },
169
+ active: {
170
+ background: `
171
+ linear-gradient(to bottom, ${componentTheme.aiSecondaryActiveBackgroundTopGradientColor} 0%, ${componentTheme.aiSecondaryActiveBackgroundBottomGradientColor} 100%)`
172
+ },
173
+ hover: {
174
+ background: `
175
+ linear-gradient(to bottom, ${componentTheme.aiSecondaryHoverBackgroundTopGradientColor} 0%, ${componentTheme.aiSecondaryHoverBackgroundBottomGradientColor} 100%)`
176
+ },
177
+ disabled: {
178
+ borderColor: componentTheme.aiSecondaryDisabledBorderColor,
179
+ color: componentTheme.aiSecondaryDisabledTextColor
180
+ }
181
+ },
182
+ primary: withBackground
183
+ ? {
184
+ default: {
185
+ color: componentTheme.primaryColor,
186
+ background: componentTheme.primaryBackground,
187
+ borderColor: componentTheme.primaryBorderColor,
188
+ boxShadow: componentTheme.primaryBoxShadow
189
+ },
190
+ active: {
191
+ background: componentTheme.primaryActiveBackground,
192
+ color: componentTheme.primaryActiveTextColor,
193
+ borderColor: componentTheme.primaryActiveBorderColor
194
+ },
195
+ hover: {
196
+ background: componentTheme.primaryHoverBackground,
197
+ boxShadow: componentTheme.primaryHoverBoxShadow,
198
+ color: componentTheme.primaryHoverTextColor,
199
+ borderColor: componentTheme.primaryHoverBorderColor
200
+ },
201
+ disabled: {
202
+ background: componentTheme.primaryDisabledBackgroundColor,
203
+ borderColor: componentTheme.primaryDisabledBorderColor,
204
+ color: componentTheme.primaryDisabledTextColor
205
+ }
206
+ }
207
+ : {
208
+ default: {
209
+ color: componentTheme.primaryGhostColor,
210
+ borderColor: componentTheme.primaryGhostBorderColor,
211
+ background: componentTheme.primaryGhostBackground,
212
+ boxShadow: componentTheme.primaryBoxShadow
213
+ },
214
+ active: {
215
+ background: componentTheme.primaryGhostActiveBackground,
216
+ color: componentTheme.tertiaryActiveTextColor,
217
+ borderColor: componentTheme.tertiaryActiveBorderColor
218
+ },
219
+ hover: {
220
+ background: componentTheme.primaryGhostHoverBackground,
221
+ boxShadow: componentTheme.primaryHoverBoxShadow,
222
+ color: componentTheme.tertiaryHoverTextColor,
223
+ borderColor: componentTheme.tertiaryHoverBorderColor
224
+ },
225
+ disabled: {
226
+ background: 'transparent',
227
+ borderColor: componentTheme.tertiaryDisabledBorderColor,
228
+ color: componentTheme.tertiaryDisabledTextColor
229
+ }
230
+ },
231
+
232
+ secondary: withBackground
233
+ ? {
234
+ default: {
235
+ color: componentTheme.secondaryColor,
236
+ background: componentTheme.secondaryBackground,
237
+ borderColor: componentTheme.secondaryBorderColor,
238
+ boxShadow: componentTheme.secondaryBoxShadow
239
+ },
240
+ active: {
241
+ background: componentTheme.secondaryActiveBackground,
242
+ color: componentTheme.secondaryActiveTextColor,
243
+ borderColor: componentTheme.secondaryActiveBorderColor
244
+ },
245
+ hover: {
246
+ background: componentTheme.secondaryHoverBackground,
247
+ boxShadow: componentTheme.secondaryHoverBoxShadow,
248
+ color: componentTheme.secondaryHoverTextColor,
249
+ borderColor: componentTheme.secondaryHoverBorderColor
250
+ },
251
+ disabled: {
252
+ background: componentTheme.secondaryDisabledBackgroundColor,
253
+ borderColor: componentTheme.secondaryDisabledBorderColor,
254
+ color: componentTheme.secondaryDisabledTextColor
255
+ }
256
+ }
257
+ : {
258
+ default: {
259
+ color: componentTheme.secondaryGhostColor,
260
+ borderColor: componentTheme.secondaryGhostBorderColor,
261
+ background: componentTheme.secondaryGhostBackground,
262
+ boxShadow: componentTheme.secondaryGhostBoxShadow
263
+ },
264
+ active: {
265
+ background: componentTheme.secondaryGhostActiveBackground,
266
+ },
267
+ hover: {
268
+ background: componentTheme.secondaryGhostHoverBackground,
269
+ boxShadow: componentTheme.secondaryGhostHoverBoxShadow
270
+ },
271
+ disabled: {
272
+ background: 'transparent'
273
+ }
274
+ },
275
+
276
+ 'primary-inverse': withBackground
277
+ ? {
278
+ default: {
279
+ color: componentTheme.primaryInverseColor,
280
+ background: componentTheme.primaryInverseBackground,
281
+ borderColor: componentTheme.primaryInverseBorderColor,
282
+ boxShadow: componentTheme.primaryInverseBoxShadow
283
+ },
284
+ active: {
285
+ background: componentTheme.primaryInverseActiveBackground,
286
+ color: componentTheme.primaryOnColorActiveTextColor,
287
+ borderColor: componentTheme.primaryOnColorActiveBorderColor
288
+ },
289
+ hover: {
290
+ background: componentTheme.primaryInverseHoverBackground,
291
+ boxShadow: componentTheme.primaryInverseHoverBoxShadow,
292
+ color: componentTheme.primaryOnColorHoverTextColor,
293
+ borderColor: componentTheme.primaryOnColorHoverBorderColor
294
+ },
295
+ disabled: {
296
+ background: componentTheme.primaryOnColorDisabledBackgroundColor,
297
+ borderColor: componentTheme.primaryOnColorDisabledBorderColor,
298
+ color: componentTheme.primaryOnColorDisabledTextColor
299
+ }
300
+ }
301
+ : {
302
+ default: {
303
+ color: componentTheme.primaryInverseGhostColor,
304
+ borderColor: componentTheme.primaryInverseGhostBorderColor,
305
+ background: componentTheme.primaryInverseGhostBackground,
306
+ boxShadow: componentTheme.primaryInverseGhostBoxShadow
307
+ },
308
+ active: {
309
+ background: componentTheme.primaryInverseGhostActiveBackground,
310
+ color: componentTheme.secondaryOnColorActiveTextColor,
311
+ borderColor: componentTheme.secondaryOnColorActiveBorderColor
312
+ },
313
+ hover: {
314
+ background: componentTheme.primaryInverseGhostHoverBackground,
315
+ boxShadow: componentTheme.primaryInverseGhostHoverBoxShadow,
316
+ color: componentTheme.secondaryOnColorHoverTextColor,
317
+ borderColor: componentTheme.secondaryOnColorHoverBorderColor
318
+ },
319
+ disabled: {
320
+ background: 'transparent',
321
+ borderColor: componentTheme.secondaryOnColorDisabledBorderColor,
322
+ color: componentTheme.secondaryOnColorDisabledTextColor
323
+ }
324
+ },
325
+
326
+ success: withBackground
327
+ ? {
328
+ default: {
329
+ color: componentTheme.successColor,
330
+ background: componentTheme.successBackground,
331
+ borderColor: componentTheme.successBorderColor,
332
+ boxShadow: componentTheme.successBoxShadow
333
+ },
334
+ active: {
335
+ background: componentTheme.successActiveBackground,
336
+ color: componentTheme.successActiveTextColor,
337
+ borderColor: componentTheme.successActiveBorderColor
338
+ },
339
+ hover: {
340
+ background: componentTheme.successHoverBackground,
341
+ boxShadow: componentTheme.successHoverBoxShadow,
342
+ color: componentTheme.successHoverTextColor,
343
+ borderColor: componentTheme.successHoverBorderColor
344
+ },
345
+ disabled: {
346
+ background: componentTheme.successDisabledBackgroundColor,
347
+ borderColor: componentTheme.successDisabledBorderColor,
348
+ color: componentTheme.successDisabledTextColor
349
+ }
350
+ }
351
+ : {
352
+ default: {
353
+ color: componentTheme.successGhostColor,
354
+ borderColor: componentTheme.successGhostBorderColor,
355
+ background: componentTheme.successGhostBackground,
356
+ boxShadow: componentTheme.successGhostBoxShadow
357
+ },
358
+ active: {
359
+ background: componentTheme.successGhostActiveBackground,
360
+ color: componentTheme.successSecondaryActiveTextColor,
361
+ borderColor: componentTheme.successSecondaryActiveBorderColor
362
+ },
363
+ hover: {
364
+ background: componentTheme.successGhostHoverBackground,
365
+ boxShadow: componentTheme.successGhostHoverBoxShadow,
366
+ color: componentTheme.successSecondaryHoverTextColor,
367
+ borderColor: componentTheme.successSecondaryHoverBorderColor
368
+ },
369
+ disabled: {
370
+ background: 'transparent',
371
+ borderColor: componentTheme.successSecondaryDisabledBorderColor,
372
+ color: componentTheme.successSecondaryDisabledTextColor
373
+ }
374
+ },
375
+
376
+ danger: withBackground
377
+ ? {
378
+ default: {
379
+ color: componentTheme.dangerColor,
380
+ background: componentTheme.dangerBackground,
381
+ borderColor: componentTheme.dangerBorderColor,
382
+ boxShadow: componentTheme.dangerBoxShadow
383
+ },
384
+ active: {
385
+ background: componentTheme.dangerActiveBackground,
386
+ color: componentTheme.destructiveActiveTextColor,
387
+ borderColor: componentTheme.destructiveActiveBorderColor
388
+ },
389
+ hover: {
390
+ background: componentTheme.dangerHoverBackground,
391
+ boxShadow: componentTheme.dangerHoverBoxShadow,
392
+ color: componentTheme.destructiveHoverTextColor,
393
+ borderColor: componentTheme.destructiveHoverBorderColor
394
+ },
395
+ disabled: {
396
+ background: componentTheme.destructiveDisabledBackgroundColor,
397
+ borderColor: componentTheme.destructiveDisabledBorderColor,
398
+ color: componentTheme.destructiveDisabledTextColor
399
+ }
400
+ }
401
+ : {
402
+ default: {
403
+ color: componentTheme.dangerGhostColor,
404
+ borderColor: componentTheme.dangerGhostBorderColor,
405
+ background: componentTheme.dangerGhostBackground,
406
+ boxShadow: componentTheme.dangerGhostBoxShadow
407
+ },
408
+ active: {
409
+ background: componentTheme.dangerGhostActiveBackground,
410
+ color: componentTheme.destructiveSecondaryActiveTextColor,
411
+ borderColor: componentTheme.destructiveSecondaryActiveBorderColor
412
+ },
413
+ hover: {
414
+ background: componentTheme.dangerGhostHoverBackground,
415
+ boxShadow: componentTheme.dangerGhostHoverBoxShadow,
416
+ color: componentTheme.destructiveSecondaryHoverTextColor,
417
+ borderColor: componentTheme.destructiveSecondaryHoverBorderColor
418
+ },
419
+ disabled: {
420
+ background: 'transparent',
421
+ borderColor: componentTheme.destructiveSecondaryDisabledBorderColor,
422
+ color: componentTheme.destructiveSecondaryDisabledTextColor
423
+ }
424
+ }
425
+ }
426
+
427
+ return {
428
+ baseButton: isEnabled
429
+ ? {
430
+ label: 'baseButton',
431
+ appearance: 'none',
432
+ textDecoration: 'none' /* for links styled as buttons */,
433
+ touchAction: 'manipulation',
434
+ // This sets the focus ring's border radius displayed by the `View`
435
+ borderRadius:
436
+ size === 'condensedSmall' || size === 'condensedMedium'
437
+ ? componentTheme.borderRadiusSm
438
+ : componentTheme.borderRadius,
439
+ ...shapeVariants[shape!],
440
+ // Prevents vertical stretching in flex parents with fixed height
441
+ // Avoids background/focus ring distortion
442
+ height: 'fit-content',
443
+
444
+ '&::-moz-focus-inner': {
445
+ border: '0' /* removes default dotted focus outline in Firefox */
446
+ },
447
+ '*': {
448
+ pointerEvents:
449
+ 'none' /* Ensures that button or link is always the event target */
450
+ },
451
+ '&:focus': {
452
+ textDecoration: 'none'
453
+ },
454
+ '&:hover > [class$=-baseButton__content]':
455
+ colorVariants[color!].hover,
456
+ '&:active > [class$=-baseButton__content]':
457
+ colorVariants[color!].active,
458
+
459
+ //TODO not the greatest solution. Must be stronger than the same &&& enforcement of <View>
460
+ ...(color === 'ai-secondary'
461
+ ? {
462
+ '&&&&&&&&&&': {
463
+ padding: componentTheme.borderWidth,
464
+ ...(shape !== 'circle'
465
+ ? {
466
+ borderRadius: `calc(${componentTheme.borderRadius} + ${componentTheme.borderWidth})`
467
+ }
468
+ : { borderRadius: componentTheme.borderRadiusFull }),
469
+ '&::before': {
470
+ content: '""',
471
+ position: 'absolute',
472
+ inset: '0',
473
+ borderRadius: 'inherit',
474
+ padding: componentTheme.borderWidth,
475
+ background: `linear-gradient(to bottom, ${componentTheme.aiBorderTopGradientColor} 0%, ${componentTheme.aiBorderBottomGradientColor} 100%)`,
476
+ WebkitMask:
477
+ 'linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)',
478
+ WebkitMaskComposite: 'xor',
479
+ mask: 'linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)',
480
+ maskComposite: 'exclude',
481
+ pointerEvents: 'none'
482
+ }
483
+ }
484
+ }
485
+ : {})
486
+ }
487
+ : {
488
+ textDecoration: 'none',
489
+ label: 'baseButton',
490
+ appearance: 'none'
491
+ },
492
+ content: {
493
+ label: 'baseButton__content',
494
+ opacity: componentTheme.opacityBase,
495
+ boxSizing: 'border-box',
496
+ width: '100%',
497
+ display: 'flex',
498
+ alignItems: 'center',
499
+ direction: 'inherit',
500
+ userSelect: 'none',
501
+ transition: 'background 0.2s, transform 0.2s',
502
+ transform: componentTheme.transform,
503
+ fontFamily: componentTheme.fontFamily,
504
+ fontWeight: componentTheme.fontWeight,
505
+ textTransform: componentTheme.textTransform,
506
+ letterSpacing: componentTheme.letterSpacing,
507
+ borderStyle: componentTheme.borderStyle,
508
+ borderWidth: componentTheme.borderWidth,
509
+ borderRadius: componentTheme.borderRadius,
510
+ lineHeight: componentTheme.lineHeight,
511
+
512
+ textAlign,
513
+
514
+ '&:hover': { transform: componentTheme.hoverTransform },
515
+
516
+ ...(color === 'ai-secondary'
517
+ ? {
518
+ border: 'none',
519
+ background: 'transparent',
520
+ transition: 'none'
521
+ }
522
+ : {}),
523
+
524
+ paddingTop: componentTheme.paddingVertical,
525
+ paddingBottom: componentTheme.paddingVertical,
526
+
527
+ ...sizeVariants[size!].content,
528
+ ...colorVariants[color!].default,
529
+ ...shapeVariants[shape!],
530
+
531
+ ...(isCondensed && {
532
+ paddingLeft: 0,
533
+ paddingRight: 0,
534
+ paddingTop: 0,
535
+ paddingBottom: 0,
536
+ minHeight: 'fit-content'
537
+ }),
538
+ ...((size === 'condensedSmall' || size === 'condensedMedium') && {
539
+ background: 'transparent',
540
+ borderStyle: 'none',
541
+ borderRadius: componentTheme.borderRadiusSm,
542
+ paddingTop: 0,
543
+ paddingBottom: 0
544
+ }),
545
+ ...(isDisabled && {
546
+ ...colorVariants[color!].disabled,
547
+ opacity: componentTheme.opacityDisabled
548
+ }),
549
+ ...(hasOnlyIconVisible && {
550
+ lineHeight: 1
551
+ }),
552
+ ...(!withBorder && {
553
+ borderStyle: 'none'
554
+ })
555
+ },
556
+
557
+ children: {
558
+ label: 'baseButton__children',
559
+ display: 'block',
560
+ minWidth: 0,
561
+
562
+ ...(isCondensed && {
563
+ paddingTop: 0,
564
+ paddingBottom: 0
565
+ }),
566
+ ...(color === 'ai-secondary'
567
+ ? {
568
+ ...(isDisabled
569
+ ? {
570
+ color: componentTheme.aiSecondaryDisabledTextColor
571
+ }
572
+ : {
573
+ background: `
574
+ linear-gradient(to bottom, ${componentTheme.aiSecondaryTextTopGradientColor} 0%, ${componentTheme.aiSecondaryTextBottomGradientColor} 100%)`,
575
+ backgroundClip: 'text',
576
+ color: 'transparent'
577
+ })
578
+ }
579
+ : {})
580
+ },
581
+
582
+ iconSVG: {
583
+ label: 'baseButton__iconSVG',
584
+ display: 'flex',
585
+ alignItems: 'center'
586
+ },
587
+
588
+ childrenLayout: {
589
+ label: 'baseButton__childrenLayout',
590
+ display: 'flex',
591
+ height: '100%',
592
+ width: '100%',
593
+ justifyContent:
594
+ hasOnlyIconVisible || textAlign === 'center' ? 'center' : 'flex-start',
595
+ boxSizing: 'border-box',
596
+ alignItems: 'center',
597
+ flexDirection: 'row',
598
+ maxWidth: '100%',
599
+ overflowX: 'visible',
600
+ overflowY: 'visible',
601
+ unicodeBidi: 'isolate'
602
+ },
603
+
604
+ iconOnly: {
605
+ label: 'baseButton__iconOnly',
606
+ boxSizing: 'border-box',
607
+ minWidth: '0.0625rem',
608
+ flexShrink: 0,
609
+ maxWidth: '100%',
610
+ overflowX: 'visible',
611
+ overflowY: 'visible',
612
+ unicodeBidi: 'isolate'
613
+ },
614
+
615
+ iconWrapper: {
616
+ label: 'baseButton__iconWrapper',
617
+ boxSizing: 'border-box',
618
+ minWidth: '0.0625rem',
619
+ paddingInlineEnd: gapForSize[size!],
620
+ flexShrink: 0,
621
+ maxWidth: '100%',
622
+ overflowX: 'visible',
623
+ overflowY: 'visible',
624
+ unicodeBidi: 'isolate'
625
+ },
626
+
627
+ childrenWrapper: {
628
+ label: 'baseButton__childrenWrapper',
629
+ boxSizing: 'border-box',
630
+ minWidth: '0.0625rem',
631
+ flexShrink: 1,
632
+ maxWidth: '100%',
633
+ overflowX: 'visible',
634
+ overflowY: 'visible',
635
+ unicodeBidi: 'isolate'
636
+ }
637
+ }
638
+ }
639
+
640
+ export default generateStyle
@@ -26,10 +26,10 @@ import { Component } from 'react'
26
26
 
27
27
  import { getInteraction, passthroughProps } from '@instructure/ui-react-utils'
28
28
 
29
- import { withStyle } from '@instructure/emotion'
29
+ import { withStyleLegacy as withStyle } from '@instructure/emotion'
30
30
 
31
31
  import generateComponentTheme from './theme'
32
- import { BaseButton } from '../BaseButton'
32
+ import { BaseButton } from '../../BaseButton/v1'
33
33
 
34
34
  import { allowedProps } from './props'
35
35
  import type { ButtonProps } from './props'
@@ -31,7 +31,7 @@ import type {
31
31
  OtherHTMLAttributes
32
32
  } from '@instructure/shared-types'
33
33
  import type { Cursor } from '@instructure/shared-types'
34
- import type { ViewProps } from '@instructure/ui-view'
34
+ import type { ViewProps } from '@instructure/ui-view/v11_6'
35
35
 
36
36
  type ButtonOwnProps = {
37
37
  /**
@@ -22,4 +22,4 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- export { default } from '../BaseButton/theme'
25
+ export { default } from '../../BaseButton/v1/theme'