@instructure/ui-view 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.
- package/CHANGELOG.md +42 -307
- package/es/ContextView/{index.js → v1/index.js} +2 -2
- package/es/ContextView/v2/index.js +125 -0
- package/es/ContextView/v2/props.js +26 -0
- package/es/ContextView/v2/styles.js +256 -0
- package/es/View/{index.js → v1/index.js} +1 -1
- package/es/View/v2/index.js +167 -0
- package/es/View/v2/props.js +29 -0
- package/es/View/v2/styles.js +420 -0
- package/es/{index.js → exports/a.js} +2 -2
- package/{src/index.ts → es/exports/b.js} +2 -6
- package/lib/ContextView/{index.js → v1/index.js} +4 -4
- package/lib/ContextView/v2/index.js +130 -0
- package/lib/ContextView/v2/props.js +31 -0
- package/lib/ContextView/v2/styles.js +262 -0
- package/lib/View/{index.js → v1/index.js} +1 -1
- package/lib/View/v2/index.js +175 -0
- package/lib/View/v2/props.js +34 -0
- package/lib/View/v2/styles.js +426 -0
- package/lib/{index.js → exports/a.js} +4 -4
- package/lib/exports/b.js +19 -0
- package/package.json +41 -19
- package/src/ContextView/{index.tsx → v1/index.tsx} +2 -2
- package/src/ContextView/v2/README.md +53 -0
- package/src/ContextView/v2/index.tsx +144 -0
- package/src/ContextView/v2/props.ts +98 -0
- package/src/ContextView/v2/styles.ts +332 -0
- package/src/View/{index.tsx → v1/index.tsx} +1 -1
- package/src/View/v2/README.md +803 -0
- package/src/View/v2/index.tsx +240 -0
- package/src/View/v2/props.ts +278 -0
- package/src/View/v2/styles.ts +503 -0
- package/src/exports/a.ts +29 -0
- package/src/exports/b.ts +29 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/ContextView/v1/index.d.ts.map +1 -0
- package/types/ContextView/v1/props.d.ts.map +1 -0
- package/types/ContextView/v1/styles.d.ts.map +1 -0
- package/types/ContextView/v1/theme.d.ts.map +1 -0
- package/types/ContextView/v2/index.d.ts +50 -0
- package/types/ContextView/v2/index.d.ts.map +1 -0
- package/types/ContextView/v2/props.d.ts +36 -0
- package/types/ContextView/v2/props.d.ts.map +1 -0
- package/types/ContextView/v2/styles.d.ts +14 -0
- package/types/ContextView/v2/styles.d.ts.map +1 -0
- package/types/View/v1/index.d.ts.map +1 -0
- package/types/View/v1/props.d.ts.map +1 -0
- package/types/View/v1/styles.d.ts.map +1 -0
- package/types/View/v1/theme.d.ts.map +1 -0
- package/types/View/v2/index.d.ts +36 -0
- package/types/View/v2/index.d.ts.map +1 -0
- package/types/View/v2/props.d.ts +157 -0
- package/types/View/v2/props.d.ts.map +1 -0
- package/types/View/v2/styles.d.ts +11 -0
- package/types/View/v2/styles.d.ts.map +1 -0
- package/types/exports/a.d.ts +5 -0
- package/types/exports/a.d.ts.map +1 -0
- package/types/exports/b.d.ts +5 -0
- package/types/exports/b.d.ts.map +1 -0
- package/types/ContextView/index.d.ts.map +0 -1
- package/types/ContextView/props.d.ts.map +0 -1
- package/types/ContextView/styles.d.ts.map +0 -1
- package/types/ContextView/theme.d.ts.map +0 -1
- package/types/View/index.d.ts.map +0 -1
- package/types/View/props.d.ts.map +0 -1
- package/types/View/styles.d.ts.map +0 -1
- package/types/View/theme.d.ts.map +0 -1
- package/types/index.d.ts +0 -5
- package/types/index.d.ts.map +0 -1
- /package/es/ContextView/{props.js → v1/props.js} +0 -0
- /package/es/ContextView/{styles.js → v1/styles.js} +0 -0
- /package/es/ContextView/{theme.js → v1/theme.js} +0 -0
- /package/es/View/{props.js → v1/props.js} +0 -0
- /package/es/View/{styles.js → v1/styles.js} +0 -0
- /package/es/View/{theme.js → v1/theme.js} +0 -0
- /package/lib/ContextView/{props.js → v1/props.js} +0 -0
- /package/lib/ContextView/{styles.js → v1/styles.js} +0 -0
- /package/lib/ContextView/{theme.js → v1/theme.js} +0 -0
- /package/lib/View/{props.js → v1/props.js} +0 -0
- /package/lib/View/{styles.js → v1/styles.js} +0 -0
- /package/lib/View/{theme.js → v1/theme.js} +0 -0
- /package/src/ContextView/{README.md → v1/README.md} +0 -0
- /package/src/ContextView/{props.ts → v1/props.ts} +0 -0
- /package/src/ContextView/{styles.ts → v1/styles.ts} +0 -0
- /package/src/ContextView/{theme.ts → v1/theme.ts} +0 -0
- /package/src/View/{README.md → v1/README.md} +0 -0
- /package/src/View/{props.ts → v1/props.ts} +0 -0
- /package/src/View/{styles.ts → v1/styles.ts} +0 -0
- /package/src/View/{theme.ts → v1/theme.ts} +0 -0
- /package/types/ContextView/{index.d.ts → v1/index.d.ts} +0 -0
- /package/types/ContextView/{props.d.ts → v1/props.d.ts} +0 -0
- /package/types/ContextView/{styles.d.ts → v1/styles.d.ts} +0 -0
- /package/types/ContextView/{theme.d.ts → v1/theme.d.ts} +0 -0
- /package/types/View/{index.d.ts → v1/index.d.ts} +0 -0
- /package/types/View/{props.d.ts → v1/props.d.ts} +0 -0
- /package/types/View/{styles.d.ts → v1/styles.d.ts} +0 -0
- /package/types/View/{theme.d.ts → v1/theme.d.ts} +0 -0
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _uiI18n = require("@instructure/ui-i18n");
|
|
8
|
+
var _emotion = require("@instructure/emotion");
|
|
9
|
+
var _pickProps = require("@instructure/ui-react-utils/lib/pickProps.js");
|
|
10
|
+
var _uiThemes = require("@instructure/ui-themes");
|
|
11
|
+
/*
|
|
12
|
+
* The MIT License (MIT)
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
15
|
+
*
|
|
16
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
17
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
18
|
+
* in the Software without restriction, including without limitation the rights
|
|
19
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
20
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
21
|
+
* furnished to do so, subject to the following conditions:
|
|
22
|
+
*
|
|
23
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
24
|
+
* copies or substantial portions of the Software.
|
|
25
|
+
*
|
|
26
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
27
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
28
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
29
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
30
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
31
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
32
|
+
* SOFTWARE.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
const processBorderRadiusValue = (value, sharedTokens) => {
|
|
36
|
+
if (!value) return '';
|
|
37
|
+
|
|
38
|
+
// Split by spaces to handle CSS shorthand (1-4 values)
|
|
39
|
+
const values = value.split(' ');
|
|
40
|
+
const processedValues = values.map(v => {
|
|
41
|
+
// Handle special cases
|
|
42
|
+
if (v === 'auto' || v === '0') return v;
|
|
43
|
+
if (v === 'none') return '0';
|
|
44
|
+
if (v === 'circle') return '100%';
|
|
45
|
+
if (v === 'pill') return '999em';
|
|
46
|
+
|
|
47
|
+
// Handle SharedTokens values
|
|
48
|
+
if (v === 'small') return sharedTokens.legacy.radiusSmall; // 2px in Canvas
|
|
49
|
+
if (v === 'medium') return sharedTokens.legacy.radiusMedium; // 4px in Canvas
|
|
50
|
+
if (v === 'large') return sharedTokens.legacy.radiusLarge; // 8px in Canvas
|
|
51
|
+
|
|
52
|
+
// Pass through CSS values (1rem, 12px, etc.)
|
|
53
|
+
return v;
|
|
54
|
+
});
|
|
55
|
+
return processedValues.join(' ');
|
|
56
|
+
};
|
|
57
|
+
const processBorderWidthValue = (value, sharedTokens) => {
|
|
58
|
+
if (!value) return '';
|
|
59
|
+
|
|
60
|
+
// Split by spaces to handle CSS shorthand (1-4 values)
|
|
61
|
+
const values = value.split(' ');
|
|
62
|
+
const processedValues = values.map(v => {
|
|
63
|
+
// Handle special cases
|
|
64
|
+
if (v === 'auto' || v === '0') return v;
|
|
65
|
+
if (v === 'none') return '0';
|
|
66
|
+
|
|
67
|
+
// Handle SharedTokens values
|
|
68
|
+
if (v === 'small') return sharedTokens.strokeWidth.sm;
|
|
69
|
+
if (v === 'medium') return sharedTokens.strokeWidth.md;
|
|
70
|
+
if (v === 'large') return sharedTokens.strokeWidth.lg;
|
|
71
|
+
|
|
72
|
+
// Pass through CSS values (1rem, 2px, etc.)
|
|
73
|
+
return v;
|
|
74
|
+
});
|
|
75
|
+
return processedValues.join(' ');
|
|
76
|
+
};
|
|
77
|
+
const getBorderStyle = ({
|
|
78
|
+
borderRadius,
|
|
79
|
+
borderWidth,
|
|
80
|
+
dir,
|
|
81
|
+
sharedTokens
|
|
82
|
+
}) => {
|
|
83
|
+
const isRtlDirection = dir === _uiI18n.DIRECTION.rtl;
|
|
84
|
+
return {
|
|
85
|
+
borderRadius: processBorderRadiusValue(isRtlDirection ? (0, _emotion.mirrorShorthandCorners)(borderRadius) : borderRadius, sharedTokens),
|
|
86
|
+
borderWidth: processBorderWidthValue(isRtlDirection ? (0, _emotion.mirrorShorthandEdges)(borderWidth) : borderWidth, sharedTokens)
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
const getSpacingStyle = ({
|
|
90
|
+
margin,
|
|
91
|
+
padding,
|
|
92
|
+
dir,
|
|
93
|
+
sharedTokens
|
|
94
|
+
}) => {
|
|
95
|
+
const isRtlDirection = dir === _uiI18n.DIRECTION.rtl;
|
|
96
|
+
return {
|
|
97
|
+
// TODO handle the merging on tokens inside the util
|
|
98
|
+
margin: (0, _emotion.calcSpacingFromShorthand)(isRtlDirection ? (0, _emotion.mirrorShorthandEdges)(margin) : margin, {
|
|
99
|
+
...sharedTokens.spacing,
|
|
100
|
+
...sharedTokens.legacy.spacing
|
|
101
|
+
}),
|
|
102
|
+
padding: (0, _emotion.calcSpacingFromShorthand)(isRtlDirection ? (0, _emotion.mirrorShorthandEdges)(padding) : padding, {
|
|
103
|
+
...sharedTokens.spacing,
|
|
104
|
+
...sharedTokens.legacy.spacing
|
|
105
|
+
})
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
const getOffsetStyle = ({
|
|
109
|
+
insetBlockStart,
|
|
110
|
+
insetBlockEnd,
|
|
111
|
+
insetInlineStart,
|
|
112
|
+
insetInlineEnd,
|
|
113
|
+
dir
|
|
114
|
+
}) => {
|
|
115
|
+
const isRtlDirection = dir === _uiI18n.DIRECTION.rtl;
|
|
116
|
+
const blockStart = {
|
|
117
|
+
top: insetBlockStart,
|
|
118
|
+
insetBlockStart
|
|
119
|
+
};
|
|
120
|
+
const blockEnd = {
|
|
121
|
+
bottom: insetBlockEnd,
|
|
122
|
+
insetBlockEnd
|
|
123
|
+
};
|
|
124
|
+
const horizontalOffsets = {
|
|
125
|
+
left: isRtlDirection ? insetInlineEnd : insetInlineStart,
|
|
126
|
+
right: isRtlDirection ? insetInlineStart : insetInlineEnd
|
|
127
|
+
};
|
|
128
|
+
return {
|
|
129
|
+
...blockStart,
|
|
130
|
+
...blockEnd,
|
|
131
|
+
...horizontalOffsets
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
const getStyleProps = ({
|
|
135
|
+
cursor,
|
|
136
|
+
style
|
|
137
|
+
}) => {
|
|
138
|
+
const whitelisted = (0, _pickProps.pickProps)(style || {}, {}, [
|
|
139
|
+
// Position/calculateElementPosition:
|
|
140
|
+
'top', 'left', 'position', 'display', 'transform', 'overflow', 'minWidth', 'minHeight',
|
|
141
|
+
// Img:
|
|
142
|
+
'filter',
|
|
143
|
+
// Flex.Item:
|
|
144
|
+
'flexBasis',
|
|
145
|
+
// Avatar:
|
|
146
|
+
'backgroundImage',
|
|
147
|
+
// Popover:
|
|
148
|
+
'pointerEvents']);
|
|
149
|
+
if (cursor) {
|
|
150
|
+
whitelisted.cursor = cursor;
|
|
151
|
+
}
|
|
152
|
+
return whitelisted;
|
|
153
|
+
};
|
|
154
|
+
const withBorder = props => {
|
|
155
|
+
const borderWidth = props.borderWidth;
|
|
156
|
+
return borderWidth && borderWidth !== '0' && borderWidth !== 'none';
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Generates the style object from the theme and provided additional information
|
|
161
|
+
* @param {Object} componentTheme The theme variable object.
|
|
162
|
+
* @param {Object} props the props of the component, the style is applied to
|
|
163
|
+
* @return {Object} The final style object, which will be used in the component
|
|
164
|
+
*/
|
|
165
|
+
const generateStyle = (componentTheme, props, sharedTokens) => {
|
|
166
|
+
const borderRadius = props.borderRadius,
|
|
167
|
+
borderWidth = props.borderWidth,
|
|
168
|
+
margin = props.margin,
|
|
169
|
+
padding = props.padding,
|
|
170
|
+
position = props.position,
|
|
171
|
+
display = props.display,
|
|
172
|
+
textAlign = props.textAlign,
|
|
173
|
+
borderColor = props.borderColor,
|
|
174
|
+
background = props.background,
|
|
175
|
+
stacking = props.stacking,
|
|
176
|
+
shadow = props.shadow,
|
|
177
|
+
overflowY = props.overflowY,
|
|
178
|
+
overflowX = props.overflowX,
|
|
179
|
+
overscrollBehavior = props.overscrollBehavior,
|
|
180
|
+
insetBlockEnd = props.insetBlockEnd,
|
|
181
|
+
insetBlockStart = props.insetBlockStart,
|
|
182
|
+
insetInlineEnd = props.insetInlineEnd,
|
|
183
|
+
insetInlineStart = props.insetInlineStart,
|
|
184
|
+
width = props.width,
|
|
185
|
+
height = props.height,
|
|
186
|
+
minWidth = props.minWidth,
|
|
187
|
+
minHeight = props.minHeight,
|
|
188
|
+
maxWidth = props.maxWidth,
|
|
189
|
+
maxHeight = props.maxHeight,
|
|
190
|
+
withVisualDebug = props.withVisualDebug,
|
|
191
|
+
dir = props.dir;
|
|
192
|
+
const borderStyle = getBorderStyle({
|
|
193
|
+
sharedTokens,
|
|
194
|
+
borderRadius,
|
|
195
|
+
borderWidth,
|
|
196
|
+
dir
|
|
197
|
+
});
|
|
198
|
+
const spacingStyle = getSpacingStyle({
|
|
199
|
+
margin,
|
|
200
|
+
padding,
|
|
201
|
+
sharedTokens,
|
|
202
|
+
dir
|
|
203
|
+
});
|
|
204
|
+
const offsetStyle = getOffsetStyle({
|
|
205
|
+
dir,
|
|
206
|
+
insetBlockEnd,
|
|
207
|
+
insetBlockStart,
|
|
208
|
+
insetInlineEnd,
|
|
209
|
+
insetInlineStart
|
|
210
|
+
});
|
|
211
|
+
const displayVariants = {
|
|
212
|
+
inline: {
|
|
213
|
+
label: 'view--inline',
|
|
214
|
+
display: 'inline'
|
|
215
|
+
},
|
|
216
|
+
block: {
|
|
217
|
+
label: 'view--block',
|
|
218
|
+
display: 'block'
|
|
219
|
+
},
|
|
220
|
+
'inline-block': {
|
|
221
|
+
label: 'view--inlineBlock',
|
|
222
|
+
display: 'inline-block',
|
|
223
|
+
verticalAlign: 'middle'
|
|
224
|
+
},
|
|
225
|
+
flex: {
|
|
226
|
+
label: 'view--flex',
|
|
227
|
+
display: 'flex'
|
|
228
|
+
},
|
|
229
|
+
'inline-flex': {
|
|
230
|
+
label: 'view--inlineFlex',
|
|
231
|
+
display: 'inline-flex',
|
|
232
|
+
verticalAlign: 'middle'
|
|
233
|
+
},
|
|
234
|
+
contents: {
|
|
235
|
+
label: 'view--contents',
|
|
236
|
+
display: 'contents'
|
|
237
|
+
},
|
|
238
|
+
inherit: {
|
|
239
|
+
label: 'view--inherit',
|
|
240
|
+
display: 'inherit'
|
|
241
|
+
},
|
|
242
|
+
initial: {
|
|
243
|
+
label: 'view--initial',
|
|
244
|
+
display: 'initial'
|
|
245
|
+
},
|
|
246
|
+
revert: {
|
|
247
|
+
label: 'view--revert',
|
|
248
|
+
display: 'revert'
|
|
249
|
+
},
|
|
250
|
+
'revert-layer': {
|
|
251
|
+
label: 'view--revertLayer',
|
|
252
|
+
display: 'revert-layer'
|
|
253
|
+
},
|
|
254
|
+
unset: {
|
|
255
|
+
label: 'view--unset',
|
|
256
|
+
display: 'unset'
|
|
257
|
+
},
|
|
258
|
+
auto: {}
|
|
259
|
+
};
|
|
260
|
+
const textAlignVariants = {
|
|
261
|
+
start: {
|
|
262
|
+
textAlign: 'start'
|
|
263
|
+
},
|
|
264
|
+
center: {
|
|
265
|
+
textAlign: 'center'
|
|
266
|
+
},
|
|
267
|
+
end: {
|
|
268
|
+
textAlign: 'end'
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
const borderColorVariants = {
|
|
272
|
+
transparent: {
|
|
273
|
+
borderColor: componentTheme.borderColorTransparent
|
|
274
|
+
},
|
|
275
|
+
primary: {
|
|
276
|
+
borderColor: componentTheme.borderColorPrimary
|
|
277
|
+
},
|
|
278
|
+
secondary: {
|
|
279
|
+
borderColor: componentTheme.borderColorSecondary
|
|
280
|
+
},
|
|
281
|
+
brand: {
|
|
282
|
+
borderColor: componentTheme.borderColorBrand
|
|
283
|
+
},
|
|
284
|
+
info: {
|
|
285
|
+
borderColor: componentTheme.borderColorInfo
|
|
286
|
+
},
|
|
287
|
+
success: {
|
|
288
|
+
borderColor: componentTheme.borderColorSuccess
|
|
289
|
+
},
|
|
290
|
+
warning: {
|
|
291
|
+
borderColor: componentTheme.borderColorWarning
|
|
292
|
+
},
|
|
293
|
+
alert: {
|
|
294
|
+
borderColor: componentTheme.borderColorAlert
|
|
295
|
+
},
|
|
296
|
+
danger: {
|
|
297
|
+
borderColor: componentTheme.borderColorDanger
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
const backgroundColorVariants = {
|
|
301
|
+
transparent: {
|
|
302
|
+
color: componentTheme.color,
|
|
303
|
+
background: 'none'
|
|
304
|
+
},
|
|
305
|
+
primary: {
|
|
306
|
+
color: componentTheme.color,
|
|
307
|
+
background: componentTheme.backgroundPrimary
|
|
308
|
+
},
|
|
309
|
+
secondary: {
|
|
310
|
+
color: componentTheme.color,
|
|
311
|
+
background: componentTheme.backgroundSecondary
|
|
312
|
+
},
|
|
313
|
+
['primary-inverse']: {
|
|
314
|
+
color: componentTheme.colorPrimaryInverse,
|
|
315
|
+
background: componentTheme.backgroundPrimaryInverse
|
|
316
|
+
},
|
|
317
|
+
brand: {
|
|
318
|
+
color: componentTheme.colorPrimaryInverse,
|
|
319
|
+
background: componentTheme.backgroundBrand
|
|
320
|
+
},
|
|
321
|
+
info: {
|
|
322
|
+
color: componentTheme.colorPrimaryInverse,
|
|
323
|
+
background: componentTheme.backgroundInfo
|
|
324
|
+
},
|
|
325
|
+
alert: {
|
|
326
|
+
color: componentTheme.colorPrimaryInverse,
|
|
327
|
+
background: componentTheme.backgroundAlert
|
|
328
|
+
},
|
|
329
|
+
success: {
|
|
330
|
+
color: componentTheme.colorPrimaryInverse,
|
|
331
|
+
background: componentTheme.backgroundSuccess
|
|
332
|
+
},
|
|
333
|
+
danger: {
|
|
334
|
+
color: componentTheme.colorPrimaryInverse,
|
|
335
|
+
background: componentTheme.backgroundDanger
|
|
336
|
+
},
|
|
337
|
+
warning: {
|
|
338
|
+
color: componentTheme.colorPrimaryInverse,
|
|
339
|
+
background: componentTheme.backgroundWarning
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
const stackingVariants = {
|
|
343
|
+
topmost: {
|
|
344
|
+
zIndex: componentTheme.stackingTopmost
|
|
345
|
+
},
|
|
346
|
+
above: {
|
|
347
|
+
zIndex: componentTheme.stackingAbove
|
|
348
|
+
},
|
|
349
|
+
resting: {},
|
|
350
|
+
below: {
|
|
351
|
+
zIndex: componentTheme.stackingBelow
|
|
352
|
+
},
|
|
353
|
+
deepest: {
|
|
354
|
+
zIndex: componentTheme.stackingDeepest
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
const shadowVariants = {
|
|
358
|
+
topmost: {
|
|
359
|
+
boxShadow: (0, _uiThemes.boxShadowObjectsToCSSString)(sharedTokens.boxShadow.elevation4)
|
|
360
|
+
},
|
|
361
|
+
resting: {
|
|
362
|
+
boxShadow: (0, _uiThemes.boxShadowObjectsToCSSString)(sharedTokens.boxShadow.elevation1)
|
|
363
|
+
},
|
|
364
|
+
above: {
|
|
365
|
+
boxShadow: (0, _uiThemes.boxShadowObjectsToCSSString)(sharedTokens.boxShadow.elevation2)
|
|
366
|
+
},
|
|
367
|
+
none: {}
|
|
368
|
+
};
|
|
369
|
+
const focusColor = props.focusColor,
|
|
370
|
+
focusPosition = props.focusPosition,
|
|
371
|
+
shouldAnimateFocus = props.shouldAnimateFocus,
|
|
372
|
+
withFocusOutline = props.withFocusOutline,
|
|
373
|
+
focusWithin = props.focusWithin;
|
|
374
|
+
const focusOutline = (0, _emotion.calcFocusOutlineStyles)(sharedTokens.focusOutline, {
|
|
375
|
+
focusColor,
|
|
376
|
+
focusPosition,
|
|
377
|
+
shouldAnimateFocus,
|
|
378
|
+
focusWithin,
|
|
379
|
+
withFocusOutline
|
|
380
|
+
});
|
|
381
|
+
return {
|
|
382
|
+
view: {
|
|
383
|
+
label: 'view',
|
|
384
|
+
boxSizing: 'border-box',
|
|
385
|
+
fontFamily: componentTheme.fontFamily,
|
|
386
|
+
maxWidth: '100%',
|
|
387
|
+
overflow: 'visible',
|
|
388
|
+
...displayVariants[display],
|
|
389
|
+
...(background && backgroundColorVariants[background]),
|
|
390
|
+
...(stacking && stackingVariants[stacking]),
|
|
391
|
+
...(shadow && shadowVariants[shadow]),
|
|
392
|
+
...(textAlign && textAlignVariants[textAlign]),
|
|
393
|
+
overflowX: overflowX && overflowX !== 'visible' ? overflowX : '',
|
|
394
|
+
overflowY: overflowY && overflowY !== 'visible' ? overflowY : '',
|
|
395
|
+
position: position !== 'static' ? position : '',
|
|
396
|
+
overscrollBehavior: overscrollBehavior ? overscrollBehavior : 'auto',
|
|
397
|
+
...(withVisualDebug ? {
|
|
398
|
+
boxShadow: `0 0 0 1px ${componentTheme.debugOutlineColor}`
|
|
399
|
+
} : {}),
|
|
400
|
+
...(withBorder(props) ? {
|
|
401
|
+
borderStyle: componentTheme.borderStyle,
|
|
402
|
+
...(borderColorVariants[borderColor] || {
|
|
403
|
+
borderColor: borderColor
|
|
404
|
+
})
|
|
405
|
+
} : {}),
|
|
406
|
+
...borderStyle
|
|
407
|
+
},
|
|
408
|
+
inlineStyles: {
|
|
409
|
+
//every '&' symbol will add another class to the rule, so it will be stronger
|
|
410
|
+
//making an accidental override less likely
|
|
411
|
+
'&&&&&&&&&&': {
|
|
412
|
+
...offsetStyle,
|
|
413
|
+
...focusOutline,
|
|
414
|
+
width,
|
|
415
|
+
height,
|
|
416
|
+
minWidth,
|
|
417
|
+
minHeight,
|
|
418
|
+
maxWidth,
|
|
419
|
+
maxHeight,
|
|
420
|
+
...getStyleProps(props),
|
|
421
|
+
...spacingStyle
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
};
|
|
426
|
+
var _default = exports.default = generateStyle;
|
|
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
Object.defineProperty(exports, "ContextView", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
|
-
return
|
|
9
|
+
return _v.ContextView;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "View", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function () {
|
|
15
|
-
return
|
|
15
|
+
return _v2.View;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
var
|
|
19
|
-
var
|
|
18
|
+
var _v = require("../ContextView/v1");
|
|
19
|
+
var _v2 = require("../View/v1");
|
package/lib/exports/b.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "ContextView", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _v.ContextView;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "View", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _v2.View;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _v = require("../ContextView/v2");
|
|
19
|
+
var _v2 = require("../View/v2");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-view",
|
|
3
|
-
"version": "11.6.
|
|
3
|
+
"version": "11.6.1-snapshot-129",
|
|
4
4
|
"description": "A component for basic styles including spacing, sizing, borders, display, positioning, and focus states.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -15,22 +15,22 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.27.6",
|
|
18
|
-
"@instructure/console": "11.6.
|
|
19
|
-
"@instructure/emotion": "11.6.
|
|
20
|
-
"@instructure/shared-types": "11.6.
|
|
21
|
-
"@instructure/ui-
|
|
22
|
-
"@instructure/ui-
|
|
23
|
-
"@instructure/ui-
|
|
24
|
-
"@instructure/ui-
|
|
25
|
-
"@instructure/ui-
|
|
18
|
+
"@instructure/console": "11.6.1-snapshot-129",
|
|
19
|
+
"@instructure/emotion": "11.6.1-snapshot-129",
|
|
20
|
+
"@instructure/shared-types": "11.6.1-snapshot-129",
|
|
21
|
+
"@instructure/ui-color-utils": "11.6.1-snapshot-129",
|
|
22
|
+
"@instructure/ui-dom-utils": "11.6.1-snapshot-129",
|
|
23
|
+
"@instructure/ui-i18n": "11.6.1-snapshot-129",
|
|
24
|
+
"@instructure/ui-react-utils": "11.6.1-snapshot-129",
|
|
25
|
+
"@instructure/ui-position": "11.6.1-snapshot-129"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@testing-library/jest-dom": "^6.6.3",
|
|
29
29
|
"@testing-library/react": "15.0.7",
|
|
30
30
|
"vitest": "^3.2.2",
|
|
31
|
-
"@instructure/ui-
|
|
32
|
-
"@instructure/ui-
|
|
33
|
-
"@instructure/ui-themes": "11.6.
|
|
31
|
+
"@instructure/ui-axe-check": "11.6.1-snapshot-129",
|
|
32
|
+
"@instructure/ui-babel-preset": "11.6.1-snapshot-129",
|
|
33
|
+
"@instructure/ui-themes": "11.6.1-snapshot-129"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"react": ">=18 <=19"
|
|
@@ -40,17 +40,39 @@
|
|
|
40
40
|
},
|
|
41
41
|
"sideEffects": false,
|
|
42
42
|
"exports": {
|
|
43
|
-
".": {
|
|
44
|
-
"types": "./types/index.d.ts",
|
|
45
|
-
"import": "./es/index.js",
|
|
46
|
-
"require": "./lib/index.js",
|
|
47
|
-
"default": "./es/index.js"
|
|
48
|
-
},
|
|
49
43
|
"./lib/*": "./lib/*",
|
|
50
44
|
"./es/*": "./es/*",
|
|
51
45
|
"./types/*": "./types/*",
|
|
52
46
|
"./package.json": "./package.json",
|
|
53
|
-
"./src/*": "./src/*"
|
|
47
|
+
"./src/*": "./src/*",
|
|
48
|
+
".": {
|
|
49
|
+
"src": "./src/exports/a.ts",
|
|
50
|
+
"types": "./types/exports/a.d.ts",
|
|
51
|
+
"import": "./es/exports/a.js",
|
|
52
|
+
"require": "./lib/exports/a.js",
|
|
53
|
+
"default": "./es/exports/a.js"
|
|
54
|
+
},
|
|
55
|
+
"./v11_6": {
|
|
56
|
+
"src": "./src/exports/a.ts",
|
|
57
|
+
"types": "./types/exports/a.d.ts",
|
|
58
|
+
"import": "./es/exports/a.js",
|
|
59
|
+
"require": "./lib/exports/a.js",
|
|
60
|
+
"default": "./es/exports/a.js"
|
|
61
|
+
},
|
|
62
|
+
"./v11_7": {
|
|
63
|
+
"src": "./src/exports/b.ts",
|
|
64
|
+
"types": "./types/exports/b.d.ts",
|
|
65
|
+
"import": "./es/exports/b.js",
|
|
66
|
+
"require": "./lib/exports/b.js",
|
|
67
|
+
"default": "./es/exports/b.js"
|
|
68
|
+
},
|
|
69
|
+
"./latest": {
|
|
70
|
+
"src": "./src/exports/b.ts",
|
|
71
|
+
"types": "./types/exports/b.d.ts",
|
|
72
|
+
"import": "./es/exports/b.js",
|
|
73
|
+
"require": "./lib/exports/b.js",
|
|
74
|
+
"default": "./es/exports/b.js"
|
|
75
|
+
}
|
|
54
76
|
},
|
|
55
77
|
"scripts": {
|
|
56
78
|
"lint": "ui-scripts lint",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
|
|
25
25
|
import { Component } from 'react'
|
|
26
26
|
|
|
27
|
-
import { withStyle } from '@instructure/emotion'
|
|
27
|
+
import { withStyleLegacy as withStyle } from '@instructure/emotion'
|
|
28
28
|
import { omitProps } from '@instructure/ui-react-utils'
|
|
29
29
|
|
|
30
|
-
import { View } from '
|
|
30
|
+
import { View } from '../../View/v1'
|
|
31
31
|
|
|
32
32
|
import generateStyle from './styles'
|
|
33
33
|
import generateComponentTheme from './theme'
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
describes: ContextView
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
`<ContextView/>` is a container that can be rendered inline in the document flow (vs as a [Popover](Popover)) but with an arrow pointing to something. See [RangeInput](RangeInput) for an example of how ContextView can be used to display contextual information in conjunction with another component. It is used internally in [Popover](Popover).
|
|
6
|
+
|
|
7
|
+
- Defaults to no padding around its content. To add padding, use the `padding` prop.
|
|
8
|
+
|
|
9
|
+
- Use the `textAlign` prop to change the alignment of the text inside `<ContextView />`.
|
|
10
|
+
|
|
11
|
+
- In use cases where `<ContextView/>` is not absolutely positioned, use the `margin` prop to set margin around the component.
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
---
|
|
15
|
+
type: example
|
|
16
|
+
---
|
|
17
|
+
<div>
|
|
18
|
+
<ContextView
|
|
19
|
+
padding="small"
|
|
20
|
+
margin="large"
|
|
21
|
+
placement="end top"
|
|
22
|
+
shadow="resting"
|
|
23
|
+
>
|
|
24
|
+
<Heading level="h3">Hello World</Heading>
|
|
25
|
+
</ContextView>
|
|
26
|
+
<ContextView
|
|
27
|
+
margin="0 large 0 0"
|
|
28
|
+
padding="small"
|
|
29
|
+
placement="top"
|
|
30
|
+
>
|
|
31
|
+
<Heading level="h3">Hello World</Heading>
|
|
32
|
+
<Text size="small">Some informational text that is helpful</Text>
|
|
33
|
+
</ContextView>
|
|
34
|
+
<ContextView
|
|
35
|
+
margin="0 large 0 0"
|
|
36
|
+
padding="small"
|
|
37
|
+
textAlign="end"
|
|
38
|
+
placement="start"
|
|
39
|
+
>
|
|
40
|
+
<Heading level="h3">Hello World</Heading>
|
|
41
|
+
<Text size="small">This ContextView is end-text-aligned</Text>
|
|
42
|
+
</ContextView>
|
|
43
|
+
<ContextView
|
|
44
|
+
placement="end bottom"
|
|
45
|
+
padding="medium"
|
|
46
|
+
background="inverse"
|
|
47
|
+
width="30rem"
|
|
48
|
+
margin="x-large 0 0"
|
|
49
|
+
>
|
|
50
|
+
This ContextView uses the inverse background and medium padding. Its width prop is set to `30rem`, which causes long strings like this to wrap. It also has top margin to separate it from the ContextViews above it.
|
|
51
|
+
</ContextView>
|
|
52
|
+
</div>
|
|
53
|
+
```
|