@instructure/ui-heading 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 (56) hide show
  1. package/CHANGELOG.md +42 -304
  2. package/es/Heading/{index.js → v1/index.js} +2 -2
  3. package/es/Heading/v2/index.js +266 -0
  4. package/es/Heading/v2/props.js +26 -0
  5. package/es/Heading/v2/styles.js +273 -0
  6. package/es/{index.js → exports/a.js} +1 -1
  7. package/{src/index.ts → es/exports/b.js} +1 -3
  8. package/lib/Heading/{index.js → v1/index.js} +4 -4
  9. package/lib/Heading/v2/index.js +271 -0
  10. package/lib/Heading/v2/props.js +31 -0
  11. package/lib/Heading/v2/styles.js +279 -0
  12. package/lib/{index.js → exports/a.js} +2 -2
  13. package/lib/exports/b.js +12 -0
  14. package/package.json +39 -17
  15. package/src/Heading/{index.tsx → v1/index.tsx} +2 -2
  16. package/src/Heading/v2/README.md +158 -0
  17. package/src/Heading/v2/index.tsx +291 -0
  18. package/src/Heading/v2/props.ts +133 -0
  19. package/src/Heading/v2/styles.ts +273 -0
  20. package/src/exports/a.ts +26 -0
  21. package/src/exports/b.ts +26 -0
  22. package/tsconfig.build.tsbuildinfo +1 -1
  23. package/types/Heading/v1/index.d.ts.map +1 -0
  24. package/types/Heading/v1/props.d.ts.map +1 -0
  25. package/types/Heading/v1/styles.d.ts.map +1 -0
  26. package/types/Heading/v1/theme.d.ts.map +1 -0
  27. package/types/Heading/v2/index.d.ts +40 -0
  28. package/types/Heading/v2/index.d.ts.map +1 -0
  29. package/types/Heading/v2/props.d.ts +62 -0
  30. package/types/Heading/v2/props.d.ts.map +1 -0
  31. package/types/Heading/v2/styles.d.ts +14 -0
  32. package/types/Heading/v2/styles.d.ts.map +1 -0
  33. package/types/exports/a.d.ts +3 -0
  34. package/types/exports/a.d.ts.map +1 -0
  35. package/types/exports/b.d.ts +3 -0
  36. package/types/exports/b.d.ts.map +1 -0
  37. package/types/Heading/index.d.ts.map +0 -1
  38. package/types/Heading/props.d.ts.map +0 -1
  39. package/types/Heading/styles.d.ts.map +0 -1
  40. package/types/Heading/theme.d.ts.map +0 -1
  41. package/types/index.d.ts +0 -3
  42. package/types/index.d.ts.map +0 -1
  43. /package/es/Heading/{props.js → v1/props.js} +0 -0
  44. /package/es/Heading/{styles.js → v1/styles.js} +0 -0
  45. /package/es/Heading/{theme.js → v1/theme.js} +0 -0
  46. /package/lib/Heading/{props.js → v1/props.js} +0 -0
  47. /package/lib/Heading/{styles.js → v1/styles.js} +0 -0
  48. /package/lib/Heading/{theme.js → v1/theme.js} +0 -0
  49. /package/src/Heading/{README.md → v1/README.md} +0 -0
  50. /package/src/Heading/{props.ts → v1/props.ts} +0 -0
  51. /package/src/Heading/{styles.ts → v1/styles.ts} +0 -0
  52. /package/src/Heading/{theme.ts → v1/theme.ts} +0 -0
  53. /package/types/Heading/{index.d.ts → v1/index.d.ts} +0 -0
  54. /package/types/Heading/{props.d.ts → v1/props.d.ts} +0 -0
  55. /package/types/Heading/{styles.d.ts → v1/styles.d.ts} +0 -0
  56. /package/types/Heading/{theme.d.ts → v1/theme.d.ts} +0 -0
@@ -0,0 +1,271 @@
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.Heading = void 0;
8
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
+ var _react = require("react");
10
+ var _latest = require("@instructure/ui-view/latest");
11
+ var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
12
+ var _uiIcons = require("@instructure/ui-icons");
13
+ var _emotion = require("@instructure/emotion");
14
+ var _styles = _interopRequireDefault(require("./styles"));
15
+ var _props = require("./props");
16
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
+ const _excluded = ["border", "children", "color", "level", "margin", "elementRef", "makeStyles", "variant"];
18
+ var _dec, _class, _Heading, _StarsInstUIIcon;
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
+ const variantLevels = {
43
+ titlePageDesktop: 'h1',
44
+ titlePageMobile: 'h1',
45
+ titleSection: 'h2',
46
+ titleCardSection: 'h2',
47
+ titleModule: 'h3',
48
+ titleCardLarge: 'h4',
49
+ titleCardRegular: 'h4',
50
+ titleCardMini: 'h4',
51
+ label: 'h5',
52
+ labelInline: 'h5'
53
+ };
54
+ const variantToIconSize = {
55
+ titlePageDesktop: '2xl',
56
+ titlePageMobile: 'xl',
57
+ titleSection: 'xl',
58
+ titleCardSection: 'xl',
59
+ titleModule: 'xl',
60
+ titleCardLarge: 'xl',
61
+ titleCardRegular: 'lg',
62
+ titleCardMini: 'md',
63
+ label: 'md',
64
+ labelInline: 'md'
65
+ };
66
+ const levelToIconSize = {
67
+ h1: '2xl',
68
+ h2: 'xl',
69
+ h3: 'xl',
70
+ h4: 'lg',
71
+ h5: 'md',
72
+ h6: 'md'
73
+ };
74
+ const variantToAIHorizontalIconSize = {
75
+ titlePageDesktop: '2xl',
76
+ titlePageMobile: 'xl',
77
+ titleSection: 'xl',
78
+ titleCardSection: 'xl',
79
+ titleModule: 'md',
80
+ titleCardLarge: 'md',
81
+ titleCardRegular: 'md',
82
+ titleCardMini: 'xs',
83
+ label: 'xs',
84
+ labelInline: 'xs'
85
+ };
86
+ const levelToAIHorizontalIconSize = {
87
+ h1: '2xl',
88
+ h2: 'lg',
89
+ h3: 'md',
90
+ h4: 'sm',
91
+ h5: 'xs',
92
+ h6: 'xs'
93
+ };
94
+
95
+ /**
96
+ ---
97
+ category: components
98
+ ---
99
+ **/
100
+ let Heading = exports.Heading = (_dec = (0, _emotion.withStyle)(_styles.default), _dec(_class = (_Heading = class Heading extends _react.Component {
101
+ constructor(...args) {
102
+ super(...args);
103
+ this.ref = null;
104
+ this.handleRef = el => {
105
+ const elementRef = this.props.elementRef;
106
+ this.ref = el;
107
+ if (typeof elementRef === 'function') {
108
+ elementRef(el);
109
+ }
110
+ };
111
+ }
112
+ checkProps() {
113
+ const _this$props = this.props,
114
+ variant = _this$props.variant,
115
+ as = _this$props.as;
116
+ if (variant) {
117
+ if (as) {}
118
+ }
119
+ }
120
+ componentDidMount() {
121
+ var _this$props$makeStyle, _this$props2;
122
+ (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
123
+ this.checkProps();
124
+ }
125
+ componentDidUpdate() {
126
+ var _this$props$makeStyle2, _this$props3;
127
+ (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
128
+ this.checkProps();
129
+ }
130
+ getIconSize(forAIHorizontal = false) {
131
+ const _this$props4 = this.props,
132
+ variant = _this$props4.variant,
133
+ level = _this$props4.level,
134
+ as = _this$props4.as;
135
+ if (variant) {
136
+ return forAIHorizontal ? variantToAIHorizontalIconSize[variant] : variantToIconSize[variant];
137
+ }
138
+ if (level && level !== 'reset') {
139
+ return forAIHorizontal ? levelToAIHorizontalIconSize[level] : levelToIconSize[level];
140
+ }
141
+ if (as && typeof as === 'string' && ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(as)) {
142
+ const asLevel = as;
143
+ return forAIHorizontal ? levelToAIHorizontalIconSize[asLevel] : levelToIconSize[asLevel];
144
+ }
145
+ return 'md';
146
+ }
147
+ renderContent() {
148
+ const _this$props5 = this.props,
149
+ children = _this$props5.children,
150
+ renderIcon = _this$props5.renderIcon,
151
+ aiVariant = _this$props5.aiVariant;
152
+ if (renderIcon && !aiVariant) {
153
+ var _this$props$styles;
154
+ return (0, _jsxRuntime.jsxs)("span", {
155
+ css: [(_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.withIcon],
156
+ "aria-hidden": "true",
157
+ children: [(0, _uiIcons.renderIconWithProps)(renderIcon, this.getIconSize(), 'inherit'), children]
158
+ });
159
+ }
160
+ if (aiVariant === 'stacked') {
161
+ var _this$props$styles2, _this$props$styles3, _this$props$styles4;
162
+ return (0, _jsxRuntime.jsxs)("span", {
163
+ css: [(_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.withIcon],
164
+ "aria-hidden": "true",
165
+ children: [(0, _jsxRuntime.jsxs)("span", {
166
+ css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.igniteAIStacked,
167
+ children: [_StarsInstUIIcon || (_StarsInstUIIcon = (0, _jsxRuntime.jsx)(_uiIcons.StarsInstUIIcon, {
168
+ color: "ai",
169
+ size: "sm"
170
+ })), (0, _jsxRuntime.jsx)("span", {
171
+ css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.igniteAI,
172
+ children: "IgniteAI"
173
+ })]
174
+ }), children]
175
+ });
176
+ }
177
+ if (aiVariant === 'horizontal') {
178
+ var _this$props$styles5, _this$props$styles6, _this$props$styles7;
179
+ return (0, _jsxRuntime.jsxs)("span", {
180
+ css: (_this$props$styles5 = this.props.styles) === null || _this$props$styles5 === void 0 ? void 0 : _this$props$styles5.withIcon,
181
+ "aria-hidden": "true",
182
+ children: [(0, _jsxRuntime.jsxs)("span", {
183
+ css: (_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.igniteAIHorizontal,
184
+ children: [(0, _jsxRuntime.jsx)(_uiIcons.StarsInstUIIcon, {
185
+ color: "ai",
186
+ size: this.getIconSize(true)
187
+ }), (0, _jsxRuntime.jsx)("span", {
188
+ css: (_this$props$styles7 = this.props.styles) === null || _this$props$styles7 === void 0 ? void 0 : _this$props$styles7.igniteAI,
189
+ children: "IgniteAI"
190
+ })]
191
+ }), children]
192
+ });
193
+ }
194
+ if (aiVariant === 'iconOnly') {
195
+ var _this$props$styles8;
196
+ return (0, _jsxRuntime.jsxs)("span", {
197
+ css: (_this$props$styles8 = this.props.styles) === null || _this$props$styles8 === void 0 ? void 0 : _this$props$styles8.withIcon,
198
+ "aria-hidden": "true",
199
+ children: [(0, _jsxRuntime.jsx)(_uiIcons.StarsInstUIIcon, {
200
+ color: "ai",
201
+ size: this.getIconSize(true)
202
+ }), children]
203
+ });
204
+ }
205
+ return children;
206
+ }
207
+
208
+ //overriding default screen reader functionality is needed to read spans in h tags correctly
209
+ getAriaLabel() {
210
+ const _this$props6 = this.props,
211
+ aiVariant = _this$props6.aiVariant,
212
+ children = _this$props6.children,
213
+ renderIcon = _this$props6.renderIcon;
214
+ if (aiVariant === 'stacked' || aiVariant === 'horizontal') {
215
+ return `IgniteAI, ${children}`;
216
+ }
217
+ if (aiVariant === 'iconOnly' || renderIcon) {
218
+ return `${children}`;
219
+ }
220
+ return void 0;
221
+ }
222
+ render() {
223
+ var _this$props$styles9;
224
+ const _this$props7 = this.props,
225
+ border = _this$props7.border,
226
+ children = _this$props7.children,
227
+ color = _this$props7.color,
228
+ level = _this$props7.level,
229
+ margin = _this$props7.margin,
230
+ elementRef = _this$props7.elementRef,
231
+ makeStyles = _this$props7.makeStyles,
232
+ variant = _this$props7.variant,
233
+ props = (0, _objectWithoutProperties2.default)(_this$props7, _excluded);
234
+ let ElementType = 'h2';
235
+ if (variant) {
236
+ // TODO deprecated, remove. `variant` should not set DOM level
237
+ if (level) {
238
+ if (level === 'reset') {
239
+ ElementType = 'span';
240
+ } else {
241
+ ElementType = level;
242
+ }
243
+ } else {
244
+ ElementType = variantLevels[variant];
245
+ }
246
+ } else if (props.as) {
247
+ ElementType = props.as;
248
+ } else if (level) {
249
+ if (level === 'reset') {
250
+ ElementType = 'span';
251
+ } else {
252
+ ElementType = level;
253
+ }
254
+ }
255
+ return (0, _jsxRuntime.jsx)(_latest.View, {
256
+ "aria-label": this.getAriaLabel(),
257
+ ...(0, _passthroughProps.passthroughProps)(props),
258
+ css: (_this$props$styles9 = this.props.styles) === null || _this$props$styles9 === void 0 ? void 0 : _this$props$styles9.heading,
259
+ as: ElementType,
260
+ elementRef: this.handleRef,
261
+ margin: margin,
262
+ "data-cid": "Heading",
263
+ children: this.renderContent()
264
+ });
265
+ }
266
+ }, _Heading.displayName = "Heading", _Heading.componentId = 'Heading', _Heading.allowedProps = _props.allowedProps, _Heading.defaultProps = {
267
+ children: null,
268
+ border: 'none',
269
+ color: 'primary'
270
+ }, _Heading)) || _class);
271
+ var _default = exports.default = Heading;
@@ -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 = ['aiVariant', 'border', 'children', 'color', 'level', 'as', 'margin', 'elementRef', 'variant'];
@@ -0,0 +1,279 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ /*
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - present Instructure, Inc.
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ /**
32
+ * ---
33
+ * private: true
34
+ * ---
35
+ * Generates the style object from the theme and provided additional information
36
+ * @param {Object} componentTheme The theme variable object.
37
+ * @param {Object} props the props of the component, the style is applied to
38
+ * @return {Object} The final style object, which will be used in the component
39
+ */
40
+ const generateStyle = (componentTheme, props) => {
41
+ const level = props.level,
42
+ color = props.color,
43
+ border = props.border,
44
+ variant = props.variant,
45
+ aiVariant = props.aiVariant;
46
+ const variants = {
47
+ titlePageDesktop: {
48
+ fontStyle: 'normal',
49
+ ...componentTheme.titlePageDesktop
50
+ },
51
+ titlePageMobile: {
52
+ fontStyle: 'normal',
53
+ ...componentTheme.titlePageMobile
54
+ },
55
+ titleSection: {
56
+ fontStyle: 'normal',
57
+ ...componentTheme.titleSection
58
+ },
59
+ titleCardSection: {
60
+ fontStyle: 'normal',
61
+ ...componentTheme.titleCardSection
62
+ },
63
+ titleModule: {
64
+ fontStyle: 'normal',
65
+ ...componentTheme.titleModule
66
+ },
67
+ titleCardLarge: {
68
+ fontStyle: 'normal',
69
+ ...componentTheme.titleCardLarge
70
+ },
71
+ titleCardRegular: {
72
+ fontStyle: 'normal',
73
+ ...componentTheme.titleCardRegular
74
+ },
75
+ titleCardMini: {
76
+ fontStyle: 'normal',
77
+ ...componentTheme.titleCardMini
78
+ },
79
+ label: {
80
+ fontStyle: 'normal',
81
+ ...componentTheme.label
82
+ },
83
+ labelInline: {
84
+ fontStyle: 'normal',
85
+ ...componentTheme.labelInline
86
+ }
87
+ };
88
+ const levelStyles = {
89
+ h1: {
90
+ fontFamily: componentTheme.h1FontFamily,
91
+ fontSize: componentTheme.h1FontSize,
92
+ fontWeight: componentTheme.h1FontWeight
93
+ },
94
+ h2: {
95
+ fontFamily: componentTheme.h2FontFamily,
96
+ fontSize: componentTheme.h2FontSize,
97
+ fontWeight: componentTheme.h2FontWeight
98
+ },
99
+ h3: {
100
+ fontFamily: componentTheme.h3FontFamily,
101
+ fontSize: componentTheme.h3FontSize,
102
+ fontWeight: componentTheme.h3FontWeight
103
+ },
104
+ h4: {
105
+ fontFamily: componentTheme.h4FontFamily,
106
+ fontSize: componentTheme.h4FontSize,
107
+ fontWeight: componentTheme.h4FontWeight
108
+ },
109
+ h5: {
110
+ fontFamily: componentTheme.h5FontFamily,
111
+ fontSize: componentTheme.h5FontSize,
112
+ fontWeight: componentTheme.h5FontWeight
113
+ },
114
+ h6: {
115
+ fontFamily: componentTheme.h6FontFamily,
116
+ fontSize: componentTheme.h6FontSize,
117
+ fontWeight: componentTheme.h6FontWeight
118
+ },
119
+ reset: {
120
+ margin: 0,
121
+ fontSize: 'inherit',
122
+ fontWeight: 'inherit',
123
+ lineHeight: 'inherit'
124
+ }
125
+ };
126
+ const colorStyles = {
127
+ inherit: {
128
+ color: 'inherit'
129
+ },
130
+ primary: {
131
+ color: componentTheme.baseColor
132
+ },
133
+ secondary: {
134
+ color: componentTheme.mutedColor
135
+ },
136
+ 'primary-inverse': {
137
+ color: componentTheme.inverseColor
138
+ },
139
+ 'secondary-inverse': {
140
+ color: componentTheme.inverseColor
141
+ },
142
+ 'primary-on': {
143
+ color: componentTheme.baseOnColor
144
+ },
145
+ 'secondary-on': {
146
+ color: componentTheme.mutedOnColor
147
+ },
148
+ ai: {
149
+ background: `
150
+ linear-gradient(to bottom, ${componentTheme.aiTextTopGradientColor} 0%, ${componentTheme.aiTextBottomGradientColor} 100%) text`,
151
+ border: 'solid transparent',
152
+ WebkitTextFillColor: 'transparent',
153
+ '@media print': {
154
+ background: 'transparent',
155
+ WebkitTextFillColor: 'unset'
156
+ }
157
+ }
158
+ };
159
+ const borderStyles = {
160
+ top: {
161
+ paddingTop: componentTheme.borderPadding,
162
+ borderTop: `${componentTheme.borderWidth} ${componentTheme.borderStyle} ${componentTheme.borderColor}`
163
+ },
164
+ bottom: {
165
+ paddingBottom: componentTheme.borderPadding,
166
+ borderBottom: `${componentTheme.borderWidth} ${componentTheme.borderStyle} ${componentTheme.borderColor}`
167
+ },
168
+ none: {}
169
+ };
170
+ const inputStyles = {
171
+ outline: 0,
172
+ appearance: 'none',
173
+ boxSizing: 'border-box',
174
+ background: 'none',
175
+ border: 'none',
176
+ borderRadius: 0,
177
+ padding: 0,
178
+ margin: '-0.375rem 0 0 0',
179
+ color: 'inherit',
180
+ height: 'auto',
181
+ width: '100%',
182
+ lineHeight: 'inherit',
183
+ textAlign: 'start',
184
+ boxShadow: 'none',
185
+ display: 'block',
186
+ '&:focus': {
187
+ outline: 'none'
188
+ }
189
+ };
190
+ const iconGapVariants = {
191
+ titlePageDesktop: componentTheme.gapIconLg,
192
+ titlePageMobile: componentTheme.gapIconLg,
193
+ titleSection: componentTheme.gapIconLg,
194
+ titleCardSection: componentTheme.gapIconLg,
195
+ titleModule: componentTheme.gapIconMd,
196
+ titleCardLarge: componentTheme.gapIconMd,
197
+ titleCardRegular: componentTheme.gapIconMd,
198
+ titleCardMini: componentTheme.gapIconSm,
199
+ label: componentTheme.gapIconSm,
200
+ labelInline: componentTheme.gapIconSm
201
+ };
202
+ const iconGapLevels = {
203
+ h1: componentTheme.gapIconLg,
204
+ h2: componentTheme.gapIconLg,
205
+ h3: componentTheme.gapIconMd,
206
+ h4: componentTheme.gapIconMd,
207
+ h5: componentTheme.gapIconSm,
208
+ h6: componentTheme.gapIconSm
209
+ };
210
+ const getIconGap = () => {
211
+ if (variant) return {
212
+ gap: iconGapVariants[variant]
213
+ };
214
+ if (level && level !== 'reset') return {
215
+ gap: iconGapLevels[level]
216
+ };
217
+ if (props.as && typeof props.as === 'string' && ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(props.as)) {
218
+ return {
219
+ gap: iconGapLevels[props.as]
220
+ };
221
+ }
222
+ return {
223
+ gap: componentTheme.gapIconLg
224
+ };
225
+ };
226
+ return {
227
+ heading: {
228
+ label: 'heading',
229
+ lineHeight: componentTheme.lineHeight,
230
+ margin: 0,
231
+ // NOTE: the input styles exist to accommodate the InPlaceEdit component
232
+ // NOTE: needs separate groups for `:is()` and `:-webkit-any()` because of css selector group validation (see https://www.w3.org/TR/selectors-3/#grouping)
233
+ '&:is(input)[type]': inputStyles,
234
+ '&:-webkit-any(input)[type]': inputStyles,
235
+ ...(variant ? variants[variant] : levelStyles[level]),
236
+ ...colorStyles[color],
237
+ ...borderStyles[border]
238
+ },
239
+ igniteAI: {
240
+ label: 'heading__ignite-ai',
241
+ background: `
242
+ linear-gradient(to bottom, ${componentTheme.aiTextTopGradientColor} 0%, ${componentTheme.aiTextBottomGradientColor} 100%) text`,
243
+ border: 'solid transparent',
244
+ WebkitTextFillColor: 'transparent',
245
+ '@media print': {
246
+ background: 'transparent',
247
+ WebkitTextFillColor: 'unset'
248
+ },
249
+ ...(aiVariant !== 'stacked' && {
250
+ paddingRight: '.25rem'
251
+ })
252
+ },
253
+ igniteAIStacked: {
254
+ label: 'heading__ignite-ai-stacked',
255
+ fontSize: '1rem',
256
+ lineHeight: '1.25rem',
257
+ display: 'flex',
258
+ alignItems: 'center',
259
+ gap: componentTheme.gapIconSm
260
+ },
261
+ igniteAIHorizontal: {
262
+ label: 'heading__ignite-ai-horizontal',
263
+ display: 'flex',
264
+ alignItems: 'center',
265
+ ...getIconGap()
266
+ },
267
+ withIcon: {
268
+ label: 'heading__with-icon',
269
+ display: 'flex',
270
+ alignItems: 'center',
271
+ ...(aiVariant === 'stacked' && {
272
+ flexDirection: 'column',
273
+ alignItems: 'flex-start'
274
+ }),
275
+ ...getIconGap()
276
+ }
277
+ };
278
+ };
279
+ var _default = exports.default = generateStyle;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  Object.defineProperty(exports, "Heading", {
7
7
  enumerable: true,
8
8
  get: function () {
9
- return _Heading.Heading;
9
+ return _v.Heading;
10
10
  }
11
11
  });
12
- var _Heading = require("./Heading");
12
+ var _v = require("../Heading/v1");
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Heading", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _v.Heading;
10
+ }
11
+ });
12
+ var _v = require("../Heading/v2");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-heading",
3
- "version": "11.6.0",
3
+ "version": "11.6.1-snapshot-129",
4
4
  "description": "A component for creating typographic headings",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -15,20 +15,20 @@
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
17
  "@babel/runtime": "^7.27.6",
18
- "@instructure/console": "11.6.0",
19
- "@instructure/emotion": "11.6.0",
20
- "@instructure/shared-types": "11.6.0",
21
- "@instructure/ui-icons": "11.6.0",
22
- "@instructure/ui-react-utils": "11.6.0",
23
- "@instructure/ui-view": "11.6.0"
18
+ "@instructure/shared-types": "11.6.1-snapshot-129",
19
+ "@instructure/console": "11.6.1-snapshot-129",
20
+ "@instructure/ui-icons": "11.6.1-snapshot-129",
21
+ "@instructure/emotion": "11.6.1-snapshot-129",
22
+ "@instructure/ui-react-utils": "11.6.1-snapshot-129",
23
+ "@instructure/ui-view": "11.6.1-snapshot-129"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@testing-library/jest-dom": "^6.6.3",
27
27
  "@testing-library/react": "15.0.7",
28
28
  "vitest": "^3.2.2",
29
- "@instructure/ui-themes": "11.6.0",
30
- "@instructure/ui-babel-preset": "11.6.0",
31
- "@instructure/ui-axe-check": "11.6.0"
29
+ "@instructure/ui-axe-check": "11.6.1-snapshot-129",
30
+ "@instructure/ui-babel-preset": "11.6.1-snapshot-129",
31
+ "@instructure/ui-themes": "11.6.1-snapshot-129"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "react": ">=18 <=19"
@@ -38,17 +38,39 @@
38
38
  },
39
39
  "sideEffects": false,
40
40
  "exports": {
41
- ".": {
42
- "types": "./types/index.d.ts",
43
- "import": "./es/index.js",
44
- "require": "./lib/index.js",
45
- "default": "./es/index.js"
46
- },
47
41
  "./lib/*": "./lib/*",
48
42
  "./es/*": "./es/*",
49
43
  "./types/*": "./types/*",
50
44
  "./package.json": "./package.json",
51
- "./src/*": "./src/*"
45
+ "./src/*": "./src/*",
46
+ ".": {
47
+ "src": "./src/exports/a.ts",
48
+ "types": "./types/exports/a.d.ts",
49
+ "import": "./es/exports/a.js",
50
+ "require": "./lib/exports/a.js",
51
+ "default": "./es/exports/a.js"
52
+ },
53
+ "./v11_6": {
54
+ "src": "./src/exports/a.ts",
55
+ "types": "./types/exports/a.d.ts",
56
+ "import": "./es/exports/a.js",
57
+ "require": "./lib/exports/a.js",
58
+ "default": "./es/exports/a.js"
59
+ },
60
+ "./v11_7": {
61
+ "src": "./src/exports/b.ts",
62
+ "types": "./types/exports/b.d.ts",
63
+ "import": "./es/exports/b.js",
64
+ "require": "./lib/exports/b.js",
65
+ "default": "./es/exports/b.js"
66
+ },
67
+ "./latest": {
68
+ "src": "./src/exports/b.ts",
69
+ "types": "./types/exports/b.d.ts",
70
+ "import": "./es/exports/b.js",
71
+ "require": "./lib/exports/b.js",
72
+ "default": "./es/exports/b.js"
73
+ }
52
74
  },
53
75
  "scripts": {
54
76
  "lint": "ui-scripts lint",