@instructure/ui-instructure 10.21.1-snapshot-11
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 +11 -0
- package/README.md +30 -0
- package/es/AiInformation/index.js +179 -0
- package/es/AiInformation/props.js +26 -0
- package/es/AiInformation/styles.js +85 -0
- package/es/AiInformation/theme.js +52 -0
- package/es/DataPermissionLevels/index.js +144 -0
- package/es/DataPermissionLevels/props.js +26 -0
- package/es/DataPermissionLevels/styles.js +96 -0
- package/es/DataPermissionLevels/theme.js +54 -0
- package/es/NutritionFacts/index.js +152 -0
- package/es/NutritionFacts/props.js +26 -0
- package/es/NutritionFacts/styles.js +72 -0
- package/es/NutritionFacts/theme.js +49 -0
- package/es/index.js +26 -0
- package/lib/AiInformation/index.js +185 -0
- package/lib/AiInformation/props.js +31 -0
- package/lib/AiInformation/styles.js +91 -0
- package/lib/AiInformation/theme.js +58 -0
- package/lib/DataPermissionLevels/index.js +151 -0
- package/lib/DataPermissionLevels/props.js +31 -0
- package/lib/DataPermissionLevels/styles.js +102 -0
- package/lib/DataPermissionLevels/theme.js +60 -0
- package/lib/NutritionFacts/index.js +159 -0
- package/lib/NutritionFacts/props.js +31 -0
- package/lib/NutritionFacts/styles.js +78 -0
- package/lib/NutritionFacts/theme.js +55 -0
- package/lib/index.js +26 -0
- package/lib/package.json +1 -0
- package/package.json +54 -0
- package/src/AiInformation/README.md +298 -0
- package/src/AiInformation/index.tsx +182 -0
- package/src/AiInformation/props.ts +163 -0
- package/src/AiInformation/styles.ts +92 -0
- package/src/AiInformation/theme.ts +58 -0
- package/src/DataPermissionLevels/README.md +47 -0
- package/src/DataPermissionLevels/index.tsx +137 -0
- package/src/DataPermissionLevels/props.ts +109 -0
- package/src/DataPermissionLevels/styles.ts +106 -0
- package/src/DataPermissionLevels/theme.ts +59 -0
- package/src/NutritionFacts/README.md +99 -0
- package/src/NutritionFacts/index.tsx +147 -0
- package/src/NutritionFacts/props.ts +106 -0
- package/src/NutritionFacts/styles.ts +79 -0
- package/src/NutritionFacts/theme.ts +52 -0
- package/src/index.ts +29 -0
- package/tsconfig.build.json +50 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +4 -0
- package/types/AiInformation/index.d.ts +10 -0
- package/types/AiInformation/index.d.ts.map +1 -0
- package/types/AiInformation/props.d.ts +92 -0
- package/types/AiInformation/props.d.ts.map +1 -0
- package/types/AiInformation/styles.d.ts +14 -0
- package/types/AiInformation/styles.d.ts.map +1 -0
- package/types/AiInformation/theme.d.ts +10 -0
- package/types/AiInformation/theme.d.ts.map +1 -0
- package/types/DataPermissionLevels/index.d.ts +10 -0
- package/types/DataPermissionLevels/index.d.ts.map +1 -0
- package/types/DataPermissionLevels/props.d.ts +55 -0
- package/types/DataPermissionLevels/props.d.ts.map +1 -0
- package/types/DataPermissionLevels/styles.d.ts +14 -0
- package/types/DataPermissionLevels/styles.d.ts.map +1 -0
- package/types/DataPermissionLevels/theme.d.ts +10 -0
- package/types/DataPermissionLevels/theme.d.ts.map +1 -0
- package/types/NutritionFacts/index.d.ts +10 -0
- package/types/NutritionFacts/index.d.ts.map +1 -0
- package/types/NutritionFacts/props.d.ts +55 -0
- package/types/NutritionFacts/props.d.ts.map +1 -0
- package/types/NutritionFacts/styles.d.ts +14 -0
- package/types/NutritionFacts/styles.d.ts.map +1 -0
- package/types/NutritionFacts/theme.d.ts +10 -0
- package/types/NutritionFacts/theme.d.ts.map +1 -0
- package/types/index.d.ts +7 -0
- package/types/index.d.ts.map +1 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## [10.21.1-snapshot-11](https://github.com/instructure/instructure-ui/compare/v10.21.0...v10.21.1-snapshot-11) (2025-07-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **many:** add new package (instructure) and three new components: AiInformation, NutritionFacts and DataPermissionLevels ([073be7b](https://github.com/instructure/instructure-ui/commit/073be7b50893e9ab77158ee8a83506eddfbd4113))
|
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
category: packages
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## ui-Instructure
|
|
6
|
+
|
|
7
|
+
[![npm][npm]][npm-url]
|
|
8
|
+
[![MIT License][license-badge]][license]
|
|
9
|
+
[![Code of Conduct][coc-badge]][coc]
|
|
10
|
+
|
|
11
|
+
### Components
|
|
12
|
+
|
|
13
|
+
The `ui-instructure` package contains the following:
|
|
14
|
+
|
|
15
|
+
- NutritionFacts
|
|
16
|
+
- DataPermissionLevels
|
|
17
|
+
- AiInformation
|
|
18
|
+
|
|
19
|
+
### Installation
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
npm install @instructure/ui-instructure
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
[npm]: https://img.shields.io/npm/v/@instructure/ui-instructure.svg
|
|
26
|
+
[npm-url]: https://npmjs.com/package/@instructure/ui-instructure
|
|
27
|
+
[license-badge]: https://img.shields.io/npm/l/instructure-ui.svg?style=flat-square
|
|
28
|
+
[license]: https://github.com/instructure/instructure-ui/blob/master/LICENSE.md
|
|
29
|
+
[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
|
|
30
|
+
[coc]: https://github.com/instructure/instructure-ui/blob/master/CODE_OF_CONDUCT.md
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
/*
|
|
3
|
+
* The MIT License (MIT)
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
* copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
* SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
import { useState } from 'react';
|
|
26
|
+
import { Popover } from '@instructure/ui-popover';
|
|
27
|
+
import { CloseButton } from '@instructure/ui-buttons';
|
|
28
|
+
import { Heading } from '@instructure/ui-heading';
|
|
29
|
+
import { Text } from '@instructure/ui-text';
|
|
30
|
+
import { useStyle } from '@instructure/emotion';
|
|
31
|
+
import { NutritionFacts, DataPermissionLevels } from '../';
|
|
32
|
+
import generateStyle from './styles';
|
|
33
|
+
import generateComponentTheme from './theme';
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
---
|
|
37
|
+
category: components/AI Components
|
|
38
|
+
---
|
|
39
|
+
**/
|
|
40
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
41
|
+
const AiInformation = ({
|
|
42
|
+
title,
|
|
43
|
+
data,
|
|
44
|
+
trigger,
|
|
45
|
+
fullscreenModals = false,
|
|
46
|
+
dataPermissionLevelsModalLabel,
|
|
47
|
+
dataPermissionLevelsTitle,
|
|
48
|
+
dataPermissionLevelsData,
|
|
49
|
+
dataPermissionLevelsCloseButtonText,
|
|
50
|
+
dataPermissionLevelsCloseIconButtonScreenReaderLabel,
|
|
51
|
+
dataPermissionLevelsCurrentFeature,
|
|
52
|
+
dataPermissionLevelsCurrentFeatureText,
|
|
53
|
+
nutritionFactsModalLabel,
|
|
54
|
+
nutritionFactsTitle,
|
|
55
|
+
nutritionFactsFeatureName,
|
|
56
|
+
nutritionFactsData,
|
|
57
|
+
nutritionFactsCloseButtonText,
|
|
58
|
+
nutritionFactsCloseIconButtonScreenReaderLabel
|
|
59
|
+
}) => {
|
|
60
|
+
const _useState = useState(false),
|
|
61
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
62
|
+
open = _useState2[0],
|
|
63
|
+
setOpen = _useState2[1];
|
|
64
|
+
const styles = useStyle({
|
|
65
|
+
generateStyle,
|
|
66
|
+
generateComponentTheme,
|
|
67
|
+
componentId: 'AiInformation',
|
|
68
|
+
displayName: 'AiInformation'
|
|
69
|
+
});
|
|
70
|
+
return _jsx("div", {
|
|
71
|
+
children: _jsx(Popover, {
|
|
72
|
+
renderTrigger: trigger,
|
|
73
|
+
isShowingContent: open,
|
|
74
|
+
on: "click",
|
|
75
|
+
screenReaderLabel: "Popover Dialog Example",
|
|
76
|
+
shouldContainFocus: true,
|
|
77
|
+
shouldReturnFocus: true,
|
|
78
|
+
shouldCloseOnDocumentClick: true,
|
|
79
|
+
offsetY: "1rem",
|
|
80
|
+
onShowContent: () => setOpen(true),
|
|
81
|
+
onHideContent: () => setOpen(false),
|
|
82
|
+
children: _jsxs("div", {
|
|
83
|
+
css: styles === null || styles === void 0 ? void 0 : styles.aiInformation,
|
|
84
|
+
children: [_jsxs("div", {
|
|
85
|
+
css: styles === null || styles === void 0 ? void 0 : styles.header,
|
|
86
|
+
children: [_jsx(Heading, {
|
|
87
|
+
level: "h2",
|
|
88
|
+
aiVariant: "stacked",
|
|
89
|
+
variant: "titleModule",
|
|
90
|
+
children: title
|
|
91
|
+
}), _jsx(CloseButton, {
|
|
92
|
+
placement: "end",
|
|
93
|
+
offset: "small",
|
|
94
|
+
onClick: () => setOpen(false),
|
|
95
|
+
screenReaderLabel: "Close"
|
|
96
|
+
})]
|
|
97
|
+
}), _jsx("div", {
|
|
98
|
+
children: data.map(({
|
|
99
|
+
featureName,
|
|
100
|
+
permissionLevelText,
|
|
101
|
+
permissionLevel,
|
|
102
|
+
description,
|
|
103
|
+
permissionLevelsModalTriggerText,
|
|
104
|
+
modelNameText,
|
|
105
|
+
modelName,
|
|
106
|
+
nutritionFactsModalTriggerText
|
|
107
|
+
}, index) => _jsxs("div", {
|
|
108
|
+
children: [_jsx("div", {
|
|
109
|
+
css: styles === null || styles === void 0 ? void 0 : styles.featureName,
|
|
110
|
+
children: _jsx(Heading, {
|
|
111
|
+
level: "h3",
|
|
112
|
+
variant: "titleCardRegular",
|
|
113
|
+
children: featureName
|
|
114
|
+
})
|
|
115
|
+
}), _jsx("div", {
|
|
116
|
+
css: styles === null || styles === void 0 ? void 0 : styles.permissionLevelText,
|
|
117
|
+
children: _jsx(Heading, {
|
|
118
|
+
level: "h4",
|
|
119
|
+
variant: "label",
|
|
120
|
+
children: permissionLevelText
|
|
121
|
+
})
|
|
122
|
+
}), _jsx("div", {
|
|
123
|
+
css: styles === null || styles === void 0 ? void 0 : styles.permissionLevel,
|
|
124
|
+
children: _jsxs(Text, {
|
|
125
|
+
variant: "legend",
|
|
126
|
+
children: [" ", permissionLevel, " "]
|
|
127
|
+
})
|
|
128
|
+
}), _jsx("div", {
|
|
129
|
+
css: styles === null || styles === void 0 ? void 0 : styles.description,
|
|
130
|
+
children: _jsxs(Text, {
|
|
131
|
+
variant: "contentSmall",
|
|
132
|
+
children: [" ", description, " "]
|
|
133
|
+
})
|
|
134
|
+
}), _jsx("div", {
|
|
135
|
+
css: styles === null || styles === void 0 ? void 0 : styles.permissionLevelsModalTriggerText,
|
|
136
|
+
children: _jsx(DataPermissionLevels, {
|
|
137
|
+
fullscreen: fullscreenModals,
|
|
138
|
+
title: dataPermissionLevelsTitle,
|
|
139
|
+
currentFeatureText: dataPermissionLevelsCurrentFeatureText,
|
|
140
|
+
currentFeature: dataPermissionLevelsCurrentFeature,
|
|
141
|
+
closeIconButtonScreenReaderLabel: dataPermissionLevelsCloseIconButtonScreenReaderLabel,
|
|
142
|
+
closeButtonText: dataPermissionLevelsCloseButtonText,
|
|
143
|
+
modalLabel: dataPermissionLevelsModalLabel,
|
|
144
|
+
triggerText: permissionLevelsModalTriggerText,
|
|
145
|
+
data: dataPermissionLevelsData
|
|
146
|
+
})
|
|
147
|
+
}), _jsx("div", {
|
|
148
|
+
css: styles === null || styles === void 0 ? void 0 : styles.modelNameText,
|
|
149
|
+
children: _jsxs(Heading, {
|
|
150
|
+
level: "h3",
|
|
151
|
+
variant: "label",
|
|
152
|
+
children: [' ', modelNameText, ' ']
|
|
153
|
+
})
|
|
154
|
+
}), _jsx("div", {
|
|
155
|
+
css: styles === null || styles === void 0 ? void 0 : styles.modelName,
|
|
156
|
+
children: _jsxs(Text, {
|
|
157
|
+
variant: "contentSmall",
|
|
158
|
+
children: [" ", modelName, " "]
|
|
159
|
+
})
|
|
160
|
+
}), _jsx(NutritionFacts, {
|
|
161
|
+
fullscreen: fullscreenModals,
|
|
162
|
+
modalLabel: nutritionFactsModalLabel,
|
|
163
|
+
title: nutritionFactsTitle,
|
|
164
|
+
featureName: nutritionFactsFeatureName,
|
|
165
|
+
closeButtonText: nutritionFactsCloseButtonText,
|
|
166
|
+
closeIconButtonScreenReaderLabel: nutritionFactsCloseIconButtonScreenReaderLabel,
|
|
167
|
+
triggerText: nutritionFactsModalTriggerText,
|
|
168
|
+
data: nutritionFactsData
|
|
169
|
+
}), data.length !== index + 1 ? _jsx("div", {
|
|
170
|
+
css: styles === null || styles === void 0 ? void 0 : styles.divider
|
|
171
|
+
}) : null]
|
|
172
|
+
}, index))
|
|
173
|
+
})]
|
|
174
|
+
})
|
|
175
|
+
})
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
export default AiInformation;
|
|
179
|
+
export { AiInformation };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const allowedProps = ['fullscreenModals', 'title', 'data', 'trigger', 'dataPermissionLevelsModalLabel', 'dataPermissionLevelsTitle', 'dataPermissionLevelsData', 'dataPermissionLevelsCloseButtonText', 'dataPermissionLevelsCloseIconButtonScreenReaderLabel', 'dataPermissionLevelsCurrentFeatureText', 'dataPermissionLevelsCurrentFeature', 'nutritionFactsModalLabel', 'nutritionFactsTitle', 'nutritionFactsFeatureName', 'nutritionFactsData', 'nutritionFactsCloseButtonText', 'nutritionFactsCloseIconButtonScreenReaderLabel'];
|
|
26
|
+
export { allowedProps };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* ---
|
|
27
|
+
* private: true
|
|
28
|
+
* ---
|
|
29
|
+
* Generates the style object from the theme and provided additional information
|
|
30
|
+
* @param {Object} componentTheme The theme variable object.
|
|
31
|
+
* @param {Object} props the props of the component, the style is applied to
|
|
32
|
+
* @return {Object} The final style object, which will be used in the component
|
|
33
|
+
*/
|
|
34
|
+
const generateStyle = (componentTheme, _props) => {
|
|
35
|
+
return {
|
|
36
|
+
aiInformation: {
|
|
37
|
+
label: 'ai-information',
|
|
38
|
+
width: '18.5rem',
|
|
39
|
+
padding: componentTheme.bodyPadding,
|
|
40
|
+
boxSizing: 'border-box'
|
|
41
|
+
},
|
|
42
|
+
header: {
|
|
43
|
+
label: 'ai-information__header',
|
|
44
|
+
marginBottom: componentTheme.headingBottomMargin
|
|
45
|
+
},
|
|
46
|
+
featureName: {
|
|
47
|
+
label: 'ai-information__feature-name',
|
|
48
|
+
marginBottom: componentTheme.featureNameBottomMargin
|
|
49
|
+
},
|
|
50
|
+
permissionLevelText: {
|
|
51
|
+
label: 'ai-information__permission-level-text',
|
|
52
|
+
marginBottom: componentTheme.permissionLevelTextBottomMargin
|
|
53
|
+
},
|
|
54
|
+
permissionLevel: {
|
|
55
|
+
label: 'ai-information__permission-level',
|
|
56
|
+
marginBottom: componentTheme.permissionLevelBottomMargin,
|
|
57
|
+
color: componentTheme.levelColor
|
|
58
|
+
},
|
|
59
|
+
description: {
|
|
60
|
+
label: 'ai-information__description',
|
|
61
|
+
marginBottom: componentTheme.descriptionBottomMargin
|
|
62
|
+
},
|
|
63
|
+
permissionLevelsModalTriggerText: {
|
|
64
|
+
label: 'ai-information__permission-levels-modal-trigger-text',
|
|
65
|
+
marginBottom: componentTheme.permissionLevelsModalTriggerBottomMargin
|
|
66
|
+
},
|
|
67
|
+
modelNameText: {
|
|
68
|
+
label: 'ai-information__model-name-text',
|
|
69
|
+
marginBottom: componentTheme.modelNameTextBottomMargin
|
|
70
|
+
},
|
|
71
|
+
modelName: {
|
|
72
|
+
label: 'ai-information__model-name',
|
|
73
|
+
marginBottom: componentTheme.modelNameBottomMargin
|
|
74
|
+
},
|
|
75
|
+
divider: {
|
|
76
|
+
label: 'ai-information__divider',
|
|
77
|
+
marginBottom: componentTheme.dividerMargin,
|
|
78
|
+
marginTop: componentTheme.dividerMargin,
|
|
79
|
+
borderTop: 'solid 1px',
|
|
80
|
+
width: '100%',
|
|
81
|
+
borderColor: componentTheme.dividerColor
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
export default generateStyle;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Generates the theme object for the component from the theme and provided additional information
|
|
27
|
+
* @param {Object} theme The actual theme object.
|
|
28
|
+
* @return {Object} The final theme object with the overrides and component variables
|
|
29
|
+
*/
|
|
30
|
+
const generateComponentTheme = theme => {
|
|
31
|
+
var _colors$ui, _colors$contrasts;
|
|
32
|
+
const colors = theme.colors,
|
|
33
|
+
spacing = theme.spacing;
|
|
34
|
+
const componentVariables = {
|
|
35
|
+
bodyPadding: spacing === null || spacing === void 0 ? void 0 : spacing.paddingCardLarge,
|
|
36
|
+
headingBottomMargin: spacing === null || spacing === void 0 ? void 0 : spacing.sectionElements,
|
|
37
|
+
featureNameBottomMargin: spacing === null || spacing === void 0 ? void 0 : spacing.moduleElements,
|
|
38
|
+
permissionLevelTextBottomMargin: spacing === null || spacing === void 0 ? void 0 : spacing.space8,
|
|
39
|
+
permissionLevelBottomMargin: spacing === null || spacing === void 0 ? void 0 : spacing.space8,
|
|
40
|
+
descriptionBottomMargin: spacing === null || spacing === void 0 ? void 0 : spacing.space8,
|
|
41
|
+
permissionLevelsModalTriggerBottomMargin: spacing === null || spacing === void 0 ? void 0 : spacing.moduleElements,
|
|
42
|
+
modelNameTextBottomMargin: spacing === null || spacing === void 0 ? void 0 : spacing.space4,
|
|
43
|
+
modelNameBottomMargin: spacing === null || spacing === void 0 ? void 0 : spacing.space4,
|
|
44
|
+
dividerMargin: spacing === null || spacing === void 0 ? void 0 : spacing.moduleElements,
|
|
45
|
+
dividerColor: colors === null || colors === void 0 ? void 0 : (_colors$ui = colors.ui) === null || _colors$ui === void 0 ? void 0 : _colors$ui.surfaceDivider,
|
|
46
|
+
levelColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.violet5790
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
...componentVariables
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export default generateComponentTheme;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
/*
|
|
3
|
+
* The MIT License (MIT)
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
* copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
* SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
import { useState } from 'react';
|
|
26
|
+
import { Modal } from '@instructure/ui-modal';
|
|
27
|
+
import { Button, CloseButton } from '@instructure/ui-buttons';
|
|
28
|
+
import { Heading } from '@instructure/ui-heading';
|
|
29
|
+
import { Text } from '@instructure/ui-text';
|
|
30
|
+
import { Link } from '@instructure/ui-link';
|
|
31
|
+
import { useStyle } from '@instructure/emotion';
|
|
32
|
+
import generateStyle from './styles';
|
|
33
|
+
import generateComponentTheme from './theme';
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
---
|
|
37
|
+
category: components/AI Components
|
|
38
|
+
---
|
|
39
|
+
**/
|
|
40
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
41
|
+
const DataPermissionLevels = ({
|
|
42
|
+
modalLabel,
|
|
43
|
+
title,
|
|
44
|
+
data,
|
|
45
|
+
closeButtonText,
|
|
46
|
+
closeIconButtonScreenReaderLabel,
|
|
47
|
+
currentFeature,
|
|
48
|
+
currentFeatureText,
|
|
49
|
+
triggerText,
|
|
50
|
+
fullscreen = false
|
|
51
|
+
}) => {
|
|
52
|
+
var _Heading, _Text;
|
|
53
|
+
const _useState = useState(false),
|
|
54
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
55
|
+
open = _useState2[0],
|
|
56
|
+
setOpen = _useState2[1];
|
|
57
|
+
const styles = useStyle({
|
|
58
|
+
generateStyle,
|
|
59
|
+
generateComponentTheme,
|
|
60
|
+
componentId: 'DataPermissionLevels',
|
|
61
|
+
displayName: 'DataPermissionLevels'
|
|
62
|
+
});
|
|
63
|
+
return _jsxs("div", {
|
|
64
|
+
children: [_jsx(Link, {
|
|
65
|
+
variant: "standalone",
|
|
66
|
+
onClick: e => {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
setOpen(true);
|
|
69
|
+
},
|
|
70
|
+
forceButtonRole: false,
|
|
71
|
+
href: "#",
|
|
72
|
+
children: triggerText
|
|
73
|
+
}), _jsxs(Modal, {
|
|
74
|
+
size: fullscreen ? 'fullscreen' : 'medium',
|
|
75
|
+
open: open,
|
|
76
|
+
onDismiss: () => {
|
|
77
|
+
setOpen(false);
|
|
78
|
+
},
|
|
79
|
+
label: modalLabel,
|
|
80
|
+
shouldCloseOnDocumentClick: true,
|
|
81
|
+
children: [_jsxs(Modal.Header, {
|
|
82
|
+
spacing: "compact",
|
|
83
|
+
children: [_jsx(Heading, {
|
|
84
|
+
aiVariant: "stacked",
|
|
85
|
+
children: title
|
|
86
|
+
}), _jsx(CloseButton, {
|
|
87
|
+
size: "medium",
|
|
88
|
+
placement: "end",
|
|
89
|
+
offset: "small",
|
|
90
|
+
onClick: () => setOpen(false),
|
|
91
|
+
screenReaderLabel: closeIconButtonScreenReaderLabel
|
|
92
|
+
})]
|
|
93
|
+
}), _jsx(Modal.Body, {
|
|
94
|
+
children: _jsx("div", {
|
|
95
|
+
css: styles === null || styles === void 0 ? void 0 : styles.body,
|
|
96
|
+
children: data.map(({
|
|
97
|
+
level,
|
|
98
|
+
title,
|
|
99
|
+
description,
|
|
100
|
+
highlighted
|
|
101
|
+
}, index) => _jsxs("div", {
|
|
102
|
+
css: highlighted ? styles === null || styles === void 0 ? void 0 : styles.highlightedCard : styles === null || styles === void 0 ? void 0 : styles.card,
|
|
103
|
+
children: [highlighted ? _jsxs("div", {
|
|
104
|
+
css: styles === null || styles === void 0 ? void 0 : styles.currentFeature,
|
|
105
|
+
children: [_Heading || (_Heading = _jsxs(Heading, {
|
|
106
|
+
color: "primary-inverse",
|
|
107
|
+
level: "reset",
|
|
108
|
+
variant: "labelInline",
|
|
109
|
+
children: [currentFeatureText, ' ']
|
|
110
|
+
})), _Text || (_Text = _jsx(Text, {
|
|
111
|
+
color: "primary-inverse",
|
|
112
|
+
variant: "content",
|
|
113
|
+
children: currentFeature
|
|
114
|
+
}))]
|
|
115
|
+
}) : null, _jsxs("div", {
|
|
116
|
+
css: styles === null || styles === void 0 ? void 0 : styles.contentContainer,
|
|
117
|
+
children: [_jsx("div", {
|
|
118
|
+
css: styles === null || styles === void 0 ? void 0 : styles.level,
|
|
119
|
+
children: level
|
|
120
|
+
}), _jsx("div", {
|
|
121
|
+
css: styles === null || styles === void 0 ? void 0 : styles.permissionTitle,
|
|
122
|
+
children: _jsxs(Text, {
|
|
123
|
+
variant: "descriptionPage",
|
|
124
|
+
children: [title, " "]
|
|
125
|
+
})
|
|
126
|
+
}), _jsx(Text, {
|
|
127
|
+
variant: "content",
|
|
128
|
+
color: "secondary",
|
|
129
|
+
children: description
|
|
130
|
+
})]
|
|
131
|
+
})]
|
|
132
|
+
}, index))
|
|
133
|
+
})
|
|
134
|
+
}), _jsx(Modal.Footer, {
|
|
135
|
+
children: _jsx(Button, {
|
|
136
|
+
onClick: () => setOpen(false),
|
|
137
|
+
children: closeButtonText
|
|
138
|
+
})
|
|
139
|
+
})]
|
|
140
|
+
})]
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
export default DataPermissionLevels;
|
|
144
|
+
export { DataPermissionLevels };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const allowedProps = ['fullscreen', 'modalLabel', 'title', 'data', 'closeButtonText', 'closeIconButtonScreenReaderLabel', 'currentFeatureText', 'currentFeature', 'triggerText'];
|
|
26
|
+
export { allowedProps };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* ---
|
|
27
|
+
* private: true
|
|
28
|
+
* ---
|
|
29
|
+
* Generates the style object from the theme and provided additional information
|
|
30
|
+
* @param {Object} componentTheme The theme variable object.
|
|
31
|
+
* @param {Object} props the props of the component, the style is applied to
|
|
32
|
+
* @return {Object} The final style object, which will be used in the component
|
|
33
|
+
*/
|
|
34
|
+
const generateStyle = (componentTheme, _props) => {
|
|
35
|
+
return {
|
|
36
|
+
dataPermissionLevels: {
|
|
37
|
+
label: 'data-permission-levels'
|
|
38
|
+
},
|
|
39
|
+
body: {
|
|
40
|
+
label: 'data-permission-levels__body',
|
|
41
|
+
display: 'flex',
|
|
42
|
+
flexDirection: 'column',
|
|
43
|
+
padding: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.bodyPadding
|
|
44
|
+
},
|
|
45
|
+
card: {
|
|
46
|
+
label: 'data-permission-levels__card',
|
|
47
|
+
padding: '2px',
|
|
48
|
+
borderStyle: 'solid',
|
|
49
|
+
borderColor: 'transparent',
|
|
50
|
+
borderWidth: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardBorderWidth,
|
|
51
|
+
display: 'flex',
|
|
52
|
+
flexDirection: 'column'
|
|
53
|
+
},
|
|
54
|
+
highlightedCard: {
|
|
55
|
+
label: 'data-permission-levels__highlighted-card',
|
|
56
|
+
borderStyle: 'solid',
|
|
57
|
+
borderWidth: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardBorderWidth,
|
|
58
|
+
borderColor: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardBorderColor,
|
|
59
|
+
borderRadius: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardBorderRadius,
|
|
60
|
+
padding: '2px',
|
|
61
|
+
display: 'flex',
|
|
62
|
+
flexDirection: 'column',
|
|
63
|
+
background: `
|
|
64
|
+
linear-gradient(to right, ${componentTheme.aiTextLeftGradientColor} 0%, ${componentTheme.aiTextRightGradientColor} 100%) padding-box,
|
|
65
|
+
linear-gradient(to right, ${componentTheme.aiTextLeftGradientColor} 0%, ${componentTheme.aiTextRightGradientColor} 100%) border-box`,
|
|
66
|
+
border: 'solid transparent'
|
|
67
|
+
},
|
|
68
|
+
level: {
|
|
69
|
+
label: 'data-permission-levels__level',
|
|
70
|
+
color: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.levelColor
|
|
71
|
+
},
|
|
72
|
+
currentFeature: {
|
|
73
|
+
label: 'data-permission-levels__current-feature',
|
|
74
|
+
background: `
|
|
75
|
+
linear-gradient(to right, ${componentTheme.aiTextLeftGradientColor} 0%, ${componentTheme.aiTextRightGradientColor} 100%)`,
|
|
76
|
+
paddingLeft: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.currentFeaturePaddingSides,
|
|
77
|
+
paddingRight: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.currentFeaturePaddingSides,
|
|
78
|
+
paddingTop: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.currentFeaturePaddingTopBottom,
|
|
79
|
+
paddingBottom: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.currentFeaturePaddingTopBottom,
|
|
80
|
+
borderTopLeftRadius: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardBorderRadius,
|
|
81
|
+
borderTopRightRadius: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardBorderRadius
|
|
82
|
+
},
|
|
83
|
+
contentContainer: {
|
|
84
|
+
label: 'data-permission-levels__content-container',
|
|
85
|
+
background: 'white',
|
|
86
|
+
padding: '10px',
|
|
87
|
+
display: 'flex',
|
|
88
|
+
flexDirection: 'column'
|
|
89
|
+
},
|
|
90
|
+
permissionTitle: {
|
|
91
|
+
label: 'data-permission-levels__permission-title',
|
|
92
|
+
marginBottom: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.permissionTitleBottomMargin
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
export default generateStyle;
|