@instructure/ui-heading 10.21.0 → 10.21.1-snapshot-1

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.
@@ -42,6 +42,10 @@ import type {
42
42
  type HeadingLevel<U extends keyof JSX.IntrinsicElements> = U
43
43
 
44
44
  type HeadingOwnProps = {
45
+ /**
46
+ * transforms heading into an ai variant
47
+ */
48
+ aiVariant?: 'stacked' | 'horizontal' | 'iconOnly'
45
49
  /**
46
50
  * The text content of the Heading
47
51
  */
@@ -51,7 +55,7 @@ type HeadingOwnProps = {
51
55
  */
52
56
  border?: 'none' | 'top' | 'bottom'
53
57
  /**
54
- * The font color to render
58
+ * The font color to render, NOTE: `ai` color is deprecated. Use the `aiVariant` prop instead
55
59
  */
56
60
  color?:
57
61
  | 'primary'
@@ -63,7 +67,7 @@ type HeadingOwnProps = {
63
67
  /**
64
68
  * The *visual* appearance of the Heading: h1 is largest; h5 is smallest.
65
69
  */
66
- level?: HeadingLevel<'h1' | 'h2' | 'h3' | 'h4' | 'h5'> | 'reset'
70
+ level?: HeadingLevel<'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'> | 'reset'
67
71
  /**
68
72
  * Choose the element Heading should render as. Will default to the `level` prop
69
73
  * if not specified.
@@ -107,9 +111,12 @@ type HeadingProps = HeadingOwnProps &
107
111
  WithStyleProps<HeadingTheme, HeadingStyle> &
108
112
  OtherHTMLAttributes<HeadingOwnProps>
109
113
 
110
- type HeadingStyle = ComponentStyle<'heading'>
114
+ type HeadingStyle = ComponentStyle<
115
+ 'heading' | 'igniteAI' | 'igniteAIStacked' | 'withIcon'
116
+ >
111
117
 
112
118
  const propTypes: PropValidators<PropKeys> = {
119
+ aiVariant: PropTypes.oneOf(['stacked', 'horizontal', 'iconOnly']),
113
120
  border: PropTypes.oneOf(['none', 'top', 'bottom']),
114
121
  children: childrenOrValue,
115
122
  color: PropTypes.oneOf([
@@ -140,6 +147,7 @@ const propTypes: PropValidators<PropKeys> = {
140
147
  }
141
148
 
142
149
  const allowedProps: AllowedPropKeys = [
150
+ 'aiVariant',
143
151
  'border',
144
152
  'children',
145
153
  'color',
@@ -39,7 +39,7 @@ const generateStyle = (
39
39
  componentTheme: HeadingTheme,
40
40
  props: HeadingProps
41
41
  ): HeadingStyle => {
42
- const { level, color, border, variant, renderIcon } = props
42
+ const { level, color, border, variant, aiVariant } = props
43
43
 
44
44
  const variants: Record<NonNullable<HeadingProps['variant']>, object> = {
45
45
  titlePageDesktop: {
@@ -130,6 +130,11 @@ const generateStyle = (
130
130
  fontSize: componentTheme.h5FontSize,
131
131
  fontWeight: componentTheme.h5FontWeight
132
132
  },
133
+ h6: {
134
+ fontFamily: componentTheme.h6FontFamily,
135
+ fontSize: componentTheme.h6FontSize,
136
+ fontWeight: componentTheme.h6FontWeight
137
+ },
133
138
  reset: {
134
139
  margin: 0,
135
140
  fontSize: 'inherit',
@@ -188,13 +193,6 @@ const generateStyle = (
188
193
  label: 'heading',
189
194
  lineHeight: componentTheme.lineHeight,
190
195
  margin: 0,
191
- //need this for icons to render them vertically centered
192
- ...(renderIcon
193
- ? {
194
- display: 'flex',
195
- alignItems: 'center'
196
- }
197
- : {}),
198
196
  // NOTE: the input styles exist to accommodate the InPlaceEdit component
199
197
  // NOTE: needs separate groups for `:is()` and `:-webkit-any()` because of css selector group validation (see https://www.w3.org/TR/selectors-3/#grouping)
200
198
  '&:is(input)[type]': inputStyles,
@@ -203,6 +201,33 @@ const generateStyle = (
203
201
  ...(variant ? variants[variant] : levelStyles[level!]),
204
202
  ...colorStyles[color!],
205
203
  ...borderStyles[border!]
204
+ },
205
+ igniteAI: {
206
+ label: 'heading__ignite-ai',
207
+ background: `
208
+ linear-gradient(to bottom, ${componentTheme.aiTextTopGradientColor} 0%, ${componentTheme.aiTextBottomGradientColor} 100%) text`,
209
+ border: 'solid transparent',
210
+ WebkitTextFillColor: 'transparent',
211
+ paddingRight: '.25rem'
212
+ },
213
+ igniteAIStacked: {
214
+ label: 'heading__ignite-ai-stacked',
215
+ fontSize: '1rem',
216
+ lineHeight: '1.25rem',
217
+ display: 'flex',
218
+ alignItems: 'center'
219
+ },
220
+ withIcon: {
221
+ label: 'heading__with-icon',
222
+ display: 'flex',
223
+ alignItems: 'center',
224
+ ...(aiVariant === 'stacked'
225
+ ? {
226
+ display: 'flex',
227
+ flexDirection: 'column',
228
+ alignItems: 'flex-start'
229
+ }
230
+ : {})
206
231
  }
207
232
  }
208
233
  }
@@ -36,16 +36,6 @@ const generateComponentTheme = (theme: Theme): HeadingTheme => {
36
36
  const themeSpecificStyle: ThemeSpecificStyle<HeadingTheme> = {
37
37
  canvas: {
38
38
  primaryColor: theme['ic-brand-font-color-dark']
39
- },
40
- instructure: {
41
- h1FontFamily: typography?.fontFamilyHeading,
42
- h2FontFamily: typography?.fontFamilyHeading,
43
- h3FontWeight: typography?.fontWeightBold,
44
- h3FontSize: '2.125rem',
45
- h4FontWeight: typography?.fontWeightBold,
46
- h4FontSize: typography?.fontSizeLarge,
47
- h5FontWeight: typography?.fontWeightBold,
48
- h5FontSize: typography?.fontSizeMedium
49
39
  }
50
40
  }
51
41
 
@@ -74,6 +64,10 @@ const generateComponentTheme = (theme: Theme): HeadingTheme => {
74
64
  h5FontWeight: typography?.fontWeightNormal,
75
65
  h5FontFamily: typography?.fontFamily,
76
66
 
67
+ h6FontSize: typography?.fontSizeXSmall,
68
+ h6FontWeight: typography?.fontWeightNormal,
69
+ h6FontFamily: typography?.fontFamily,
70
+
77
71
  primaryInverseColor: colors?.contrasts?.white1010,
78
72
  primaryColor: colors?.contrasts?.grey125125,
79
73
 
@@ -7,15 +7,38 @@
7
7
  },
8
8
  "include": ["src"],
9
9
  "references": [
10
- { "path": "../console/tsconfig.build.json" },
11
- { "path": "../emotion/tsconfig.build.json" },
12
- { "path": "../shared-types/tsconfig.build.json" },
13
- { "path": "../ui-axe-check/tsconfig.build.json" },
14
- { "path": "../ui-prop-types/tsconfig.build.json" },
15
- { "path": "../ui-react-utils/tsconfig.build.json" },
16
- { "path": "../ui-testable/tsconfig.build.json" },
17
- { "path": "../ui-view/tsconfig.build.json" },
18
- { "path": "../ui-babel-preset/tsconfig.build.json" },
19
- { "path": "../ui-themes/tsconfig.build.json" }
10
+ {
11
+ "path": "../console/tsconfig.build.json"
12
+ },
13
+ {
14
+ "path": "../emotion/tsconfig.build.json"
15
+ },
16
+ {
17
+ "path": "../shared-types/tsconfig.build.json"
18
+ },
19
+ {
20
+ "path": "../ui-axe-check/tsconfig.build.json"
21
+ },
22
+ {
23
+ "path": "../ui-prop-types/tsconfig.build.json"
24
+ },
25
+ {
26
+ "path": "../ui-react-utils/tsconfig.build.json"
27
+ },
28
+ {
29
+ "path": "../ui-testable/tsconfig.build.json"
30
+ },
31
+ {
32
+ "path": "../ui-icons/tsconfig.build.json"
33
+ },
34
+ {
35
+ "path": "../ui-view/tsconfig.build.json"
36
+ },
37
+ {
38
+ "path": "../ui-babel-preset/tsconfig.build.json"
39
+ },
40
+ {
41
+ "path": "../ui-themes/tsconfig.build.json"
42
+ }
20
43
  ]
21
44
  }