@instructure/ui-instructure 11.7.2-snapshot-9 → 11.7.2-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 +5 -2
- package/es/AiInformation/v2/index.js +2 -2
- package/es/DataPermissionLevels/v2/index.js +143 -0
- package/es/DataPermissionLevels/v2/props.js +26 -0
- package/es/DataPermissionLevels/v2/styles.js +99 -0
- package/es/NutritionFacts/v2/index.js +151 -0
- package/es/NutritionFacts/v2/props.js +26 -0
- package/es/NutritionFacts/v2/styles.js +73 -0
- package/es/exports/b.js +2 -2
- package/lib/AiInformation/v2/index.js +2 -2
- package/lib/DataPermissionLevels/v2/index.js +150 -0
- package/lib/DataPermissionLevels/v2/props.js +31 -0
- package/lib/DataPermissionLevels/v2/styles.js +105 -0
- package/lib/NutritionFacts/v2/index.js +158 -0
- package/lib/NutritionFacts/v2/props.js +31 -0
- package/lib/NutritionFacts/v2/styles.js +79 -0
- package/lib/exports/b.js +2 -2
- package/package.json +16 -16
- package/src/AiInformation/v2/index.tsx +2 -2
- package/src/AiInformation/v2/styles.ts +2 -2
- package/src/DataPermissionLevels/v2/README.md +47 -0
- package/src/DataPermissionLevels/v2/index.tsx +137 -0
- package/src/DataPermissionLevels/v2/props.ts +106 -0
- package/src/DataPermissionLevels/v2/styles.ts +110 -0
- package/src/NutritionFacts/v2/README.md +99 -0
- package/src/NutritionFacts/v2/index.tsx +147 -0
- package/src/NutritionFacts/v2/props.ts +103 -0
- package/src/NutritionFacts/v2/styles.ts +81 -0
- package/src/exports/b.ts +4 -4
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/AiInformation/v2/styles.d.ts +2 -2
- package/types/AiInformation/v2/styles.d.ts.map +1 -1
- package/types/DataPermissionLevels/v2/index.d.ts +10 -0
- package/types/DataPermissionLevels/v2/index.d.ts.map +1 -0
- package/types/DataPermissionLevels/v2/props.d.ts +57 -0
- package/types/DataPermissionLevels/v2/props.d.ts.map +1 -0
- package/types/DataPermissionLevels/v2/styles.d.ts +15 -0
- package/types/DataPermissionLevels/v2/styles.d.ts.map +1 -0
- package/types/NutritionFacts/v2/index.d.ts +10 -0
- package/types/NutritionFacts/v2/index.d.ts.map +1 -0
- package/types/NutritionFacts/v2/props.d.ts +57 -0
- package/types/NutritionFacts/v2/props.d.ts.map +1 -0
- package/types/NutritionFacts/v2/styles.d.ts +15 -0
- package/types/NutritionFacts/v2/styles.d.ts.map +1 -0
- package/types/exports/b.d.ts +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [11.7.2-snapshot-
|
|
6
|
+
## [11.7.2-snapshot-11](https://github.com/instructure/instructure-ui/compare/v11.7.1...v11.7.2-snapshot-11) (2026-03-31)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **ui-instructure:** rework DataPermissionLevels and NutritionFacts ([36c02c6](https://github.com/instructure/instructure-ui/commit/36c02c6b3e0badcf257a9697ea095ad07cd03d49))
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
|
|
@@ -31,8 +31,8 @@ import { Text } from '@instructure/ui-text/latest';
|
|
|
31
31
|
import { Link } from '@instructure/ui-link/latest';
|
|
32
32
|
import { ExternalLinkInstUIIcon } from '@instructure/ui-icons';
|
|
33
33
|
import { useStyle } from '@instructure/emotion';
|
|
34
|
-
import { NutritionFacts } from "../../NutritionFacts/
|
|
35
|
-
import { DataPermissionLevels } from "../../DataPermissionLevels/
|
|
34
|
+
import { NutritionFacts } from "../../NutritionFacts/v2/index.js";
|
|
35
|
+
import { DataPermissionLevels } from "../../DataPermissionLevels/v2/index.js";
|
|
36
36
|
import generateStyle from "./styles.js";
|
|
37
37
|
/**
|
|
38
38
|
---
|
|
@@ -0,0 +1,143 @@
|
|
|
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/latest';
|
|
27
|
+
import { Button, CloseButton } from '@instructure/ui-buttons/latest';
|
|
28
|
+
import { Heading } from '@instructure/ui-heading/latest';
|
|
29
|
+
import { Text } from '@instructure/ui-text/latest';
|
|
30
|
+
import { Link } from '@instructure/ui-link/latest';
|
|
31
|
+
import { useStyle } from '@instructure/emotion';
|
|
32
|
+
import generateStyle from "./styles.js";
|
|
33
|
+
/**
|
|
34
|
+
---
|
|
35
|
+
category: components/AI Components
|
|
36
|
+
---
|
|
37
|
+
**/
|
|
38
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
39
|
+
const DataPermissionLevels = ({
|
|
40
|
+
modalLabel,
|
|
41
|
+
title,
|
|
42
|
+
data,
|
|
43
|
+
closeButtonText,
|
|
44
|
+
closeIconButtonScreenReaderLabel,
|
|
45
|
+
currentFeature,
|
|
46
|
+
currentFeatureText,
|
|
47
|
+
triggerText,
|
|
48
|
+
fullscreen = false,
|
|
49
|
+
themeOverride
|
|
50
|
+
}) => {
|
|
51
|
+
var _Heading, _Text;
|
|
52
|
+
const _useState = useState(false),
|
|
53
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
54
|
+
open = _useState2[0],
|
|
55
|
+
setOpen = _useState2[1];
|
|
56
|
+
const styles = useStyle({
|
|
57
|
+
generateStyle,
|
|
58
|
+
themeOverride,
|
|
59
|
+
componentId: 'DataPermissionLevels',
|
|
60
|
+
displayName: 'DataPermissionLevels'
|
|
61
|
+
});
|
|
62
|
+
return _jsxs("div", {
|
|
63
|
+
children: [_jsx(Link, {
|
|
64
|
+
variant: "standalone",
|
|
65
|
+
onClick: e => {
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
setOpen(true);
|
|
68
|
+
},
|
|
69
|
+
forceButtonRole: false,
|
|
70
|
+
href: "#",
|
|
71
|
+
children: triggerText
|
|
72
|
+
}), _jsxs(Modal, {
|
|
73
|
+
size: fullscreen ? 'fullscreen' : 'medium',
|
|
74
|
+
open: open,
|
|
75
|
+
onDismiss: () => {
|
|
76
|
+
setOpen(false);
|
|
77
|
+
},
|
|
78
|
+
label: modalLabel,
|
|
79
|
+
shouldCloseOnDocumentClick: true,
|
|
80
|
+
children: [_jsxs(Modal.Header, {
|
|
81
|
+
spacing: "compact",
|
|
82
|
+
children: [_jsx(Heading, {
|
|
83
|
+
aiVariant: "stacked",
|
|
84
|
+
children: title
|
|
85
|
+
}), _jsx(CloseButton, {
|
|
86
|
+
size: "medium",
|
|
87
|
+
placement: "end",
|
|
88
|
+
offset: "small",
|
|
89
|
+
onClick: () => setOpen(false),
|
|
90
|
+
screenReaderLabel: closeIconButtonScreenReaderLabel
|
|
91
|
+
})]
|
|
92
|
+
}), _jsx(Modal.Body, {
|
|
93
|
+
children: _jsx("div", {
|
|
94
|
+
css: styles === null || styles === void 0 ? void 0 : styles.body,
|
|
95
|
+
children: data.map(({
|
|
96
|
+
level,
|
|
97
|
+
title,
|
|
98
|
+
description,
|
|
99
|
+
highlighted
|
|
100
|
+
}, index) => _jsxs("div", {
|
|
101
|
+
css: highlighted ? styles === null || styles === void 0 ? void 0 : styles.highlightedCard : styles === null || styles === void 0 ? void 0 : styles.card,
|
|
102
|
+
children: [highlighted ? _jsxs("div", {
|
|
103
|
+
css: styles === null || styles === void 0 ? void 0 : styles.currentFeature,
|
|
104
|
+
children: [_Heading || (_Heading = _jsxs(Heading, {
|
|
105
|
+
color: "primary-on",
|
|
106
|
+
level: "reset",
|
|
107
|
+
variant: "labelInline",
|
|
108
|
+
children: [currentFeatureText, ' ']
|
|
109
|
+
})), _Text || (_Text = _jsx(Text, {
|
|
110
|
+
color: "primary-on",
|
|
111
|
+
variant: "content",
|
|
112
|
+
children: currentFeature
|
|
113
|
+
}))]
|
|
114
|
+
}) : null, _jsxs("div", {
|
|
115
|
+
css: styles === null || styles === void 0 ? void 0 : styles.contentContainer,
|
|
116
|
+
children: [_jsx("div", {
|
|
117
|
+
css: styles === null || styles === void 0 ? void 0 : styles.level,
|
|
118
|
+
children: level
|
|
119
|
+
}), _jsx("div", {
|
|
120
|
+
css: styles === null || styles === void 0 ? void 0 : styles.permissionTitle,
|
|
121
|
+
children: _jsxs(Text, {
|
|
122
|
+
variant: "descriptionPage",
|
|
123
|
+
children: [title, " "]
|
|
124
|
+
})
|
|
125
|
+
}), _jsx(Text, {
|
|
126
|
+
variant: "content",
|
|
127
|
+
color: "secondary",
|
|
128
|
+
children: description
|
|
129
|
+
})]
|
|
130
|
+
})]
|
|
131
|
+
}, index))
|
|
132
|
+
})
|
|
133
|
+
}), _jsx(Modal.Footer, {
|
|
134
|
+
children: _jsx(Button, {
|
|
135
|
+
onClick: () => setOpen(false),
|
|
136
|
+
children: closeButtonText
|
|
137
|
+
})
|
|
138
|
+
})]
|
|
139
|
+
})]
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
export default DataPermissionLevels;
|
|
143
|
+
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,99 @@
|
|
|
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 componentTheme The theme variable object.
|
|
31
|
+
* @param params Additional parameters to customize the style.
|
|
32
|
+
* @param sharedTokens Shared token object that stores common values for the theme.
|
|
33
|
+
* @return The final style object, which will be used in the component
|
|
34
|
+
*/
|
|
35
|
+
const generateStyle = (componentTheme, _params, _sharedTokens) => {
|
|
36
|
+
return {
|
|
37
|
+
dataPermissionLevels: {
|
|
38
|
+
label: 'data-permission-levels'
|
|
39
|
+
},
|
|
40
|
+
body: {
|
|
41
|
+
label: 'data-permission-levels__body',
|
|
42
|
+
display: 'flex',
|
|
43
|
+
flexDirection: 'column',
|
|
44
|
+
padding: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.bodyPadding
|
|
45
|
+
},
|
|
46
|
+
card: {
|
|
47
|
+
label: 'data-permission-levels__card',
|
|
48
|
+
padding: '2px',
|
|
49
|
+
borderStyle: 'solid',
|
|
50
|
+
borderColor: 'transparent',
|
|
51
|
+
borderWidth: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardBorderWidth,
|
|
52
|
+
display: 'flex',
|
|
53
|
+
flexDirection: 'column'
|
|
54
|
+
},
|
|
55
|
+
highlightedCard: {
|
|
56
|
+
label: 'data-permission-levels__highlighted-card',
|
|
57
|
+
borderStyle: 'solid',
|
|
58
|
+
borderWidth: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardBorderWidth,
|
|
59
|
+
borderColor: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardBorderColor,
|
|
60
|
+
borderRadius: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardBorderRadius,
|
|
61
|
+
padding: '2px',
|
|
62
|
+
display: 'flex',
|
|
63
|
+
flexDirection: 'column',
|
|
64
|
+
background: `
|
|
65
|
+
linear-gradient(to right, ${componentTheme.aiTextLeftGradientColor} 0%, ${componentTheme.aiTextRightGradientColor} 100%) padding-box,
|
|
66
|
+
linear-gradient(to right, ${componentTheme.aiTextLeftGradientColor} 0%, ${componentTheme.aiTextRightGradientColor} 100%) border-box`,
|
|
67
|
+
border: 'solid transparent'
|
|
68
|
+
},
|
|
69
|
+
level: {
|
|
70
|
+
label: 'data-permission-levels__level',
|
|
71
|
+
color: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.levelColor
|
|
72
|
+
},
|
|
73
|
+
currentFeature: {
|
|
74
|
+
label: 'data-permission-levels__current-feature',
|
|
75
|
+
background: `
|
|
76
|
+
linear-gradient(to right, ${componentTheme.aiTextLeftGradientColor} 0%, ${componentTheme.aiTextRightGradientColor} 100%)`,
|
|
77
|
+
paddingLeft: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.currentFeaturePaddingSides,
|
|
78
|
+
paddingRight: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.currentFeaturePaddingSides,
|
|
79
|
+
paddingTop: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.currentFeaturePaddingTopBottom,
|
|
80
|
+
paddingBottom: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.currentFeaturePaddingTopBottom,
|
|
81
|
+
borderTopLeftRadius: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardBorderRadius,
|
|
82
|
+
borderTopRightRadius: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardBorderRadius
|
|
83
|
+
},
|
|
84
|
+
contentContainer: {
|
|
85
|
+
label: 'data-permission-levels__content-container',
|
|
86
|
+
background: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.contentContainerColor,
|
|
87
|
+
borderBottomLeftRadius: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.contentContainerBorderRadius,
|
|
88
|
+
borderBottomRightRadius: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.contentContainerBorderRadius,
|
|
89
|
+
padding: '10px',
|
|
90
|
+
display: 'flex',
|
|
91
|
+
flexDirection: 'column'
|
|
92
|
+
},
|
|
93
|
+
permissionTitle: {
|
|
94
|
+
label: 'data-permission-levels__permission-title',
|
|
95
|
+
marginBottom: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.permissionTitleBottomMargin
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
export default generateStyle;
|
|
@@ -0,0 +1,151 @@
|
|
|
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/latest';
|
|
27
|
+
import { Button, CloseButton } from '@instructure/ui-buttons/latest';
|
|
28
|
+
import { Heading } from '@instructure/ui-heading/latest';
|
|
29
|
+
import { Text } from '@instructure/ui-text/latest';
|
|
30
|
+
import { Link } from '@instructure/ui-link/latest';
|
|
31
|
+
import { useStyle } from '@instructure/emotion';
|
|
32
|
+
import generateStyle from "./styles.js";
|
|
33
|
+
/**
|
|
34
|
+
---
|
|
35
|
+
category: components/AI Components
|
|
36
|
+
---
|
|
37
|
+
**/
|
|
38
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
39
|
+
const NutritionFacts = ({
|
|
40
|
+
modalLabel,
|
|
41
|
+
title,
|
|
42
|
+
featureName,
|
|
43
|
+
data,
|
|
44
|
+
closeButtonText,
|
|
45
|
+
closeIconButtonScreenReaderLabel,
|
|
46
|
+
triggerText,
|
|
47
|
+
fullscreen = false,
|
|
48
|
+
themeOverride
|
|
49
|
+
}) => {
|
|
50
|
+
const _useState = useState(false),
|
|
51
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
52
|
+
open = _useState2[0],
|
|
53
|
+
setOpen = _useState2[1];
|
|
54
|
+
const styles = useStyle({
|
|
55
|
+
generateStyle,
|
|
56
|
+
themeOverride,
|
|
57
|
+
componentId: 'NutritionFacts',
|
|
58
|
+
displayName: 'NutritionFacts'
|
|
59
|
+
});
|
|
60
|
+
return _jsxs("div", {
|
|
61
|
+
children: [_jsx(Link, {
|
|
62
|
+
variant: "standalone",
|
|
63
|
+
onClick: e => {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
setOpen(true);
|
|
66
|
+
},
|
|
67
|
+
forceButtonRole: false,
|
|
68
|
+
href: "#",
|
|
69
|
+
children: triggerText
|
|
70
|
+
}), _jsxs(Modal, {
|
|
71
|
+
open: open,
|
|
72
|
+
onDismiss: () => {
|
|
73
|
+
setOpen(false);
|
|
74
|
+
},
|
|
75
|
+
label: modalLabel,
|
|
76
|
+
shouldCloseOnDocumentClick: true,
|
|
77
|
+
size: fullscreen ? 'fullscreen' : 'medium',
|
|
78
|
+
children: [_jsxs(Modal.Header, {
|
|
79
|
+
spacing: "compact",
|
|
80
|
+
children: [_jsx(Heading, {
|
|
81
|
+
aiVariant: "stacked",
|
|
82
|
+
children: title
|
|
83
|
+
}), _jsx(CloseButton, {
|
|
84
|
+
size: "medium",
|
|
85
|
+
placement: "end",
|
|
86
|
+
offset: "small",
|
|
87
|
+
onClick: () => setOpen(false),
|
|
88
|
+
screenReaderLabel: closeIconButtonScreenReaderLabel
|
|
89
|
+
})]
|
|
90
|
+
}), _jsx(Modal.Body, {
|
|
91
|
+
children: _jsxs("div", {
|
|
92
|
+
css: styles === null || styles === void 0 ? void 0 : styles.body,
|
|
93
|
+
children: [_jsxs(Heading, {
|
|
94
|
+
variant: "titleSection",
|
|
95
|
+
level: "h3",
|
|
96
|
+
children: [' ', featureName, ' ']
|
|
97
|
+
}), data.map(({
|
|
98
|
+
blockTitle,
|
|
99
|
+
segmentData
|
|
100
|
+
}, index) => {
|
|
101
|
+
return _jsxs("div", {
|
|
102
|
+
css: styles === null || styles === void 0 ? void 0 : styles.blockContainer,
|
|
103
|
+
children: [_jsxs(Heading, {
|
|
104
|
+
variant: "titleModule",
|
|
105
|
+
level: "h4",
|
|
106
|
+
children: [' ', blockTitle, ' ']
|
|
107
|
+
}), _jsx("div", {
|
|
108
|
+
css: styles === null || styles === void 0 ? void 0 : styles.segmentContainer,
|
|
109
|
+
children: segmentData.map(({
|
|
110
|
+
segmentTitle,
|
|
111
|
+
description,
|
|
112
|
+
value,
|
|
113
|
+
valueDescription
|
|
114
|
+
}, index) => {
|
|
115
|
+
return _jsxs("div", {
|
|
116
|
+
css: styles === null || styles === void 0 ? void 0 : styles.segmentCard,
|
|
117
|
+
children: [_jsxs("div", {
|
|
118
|
+
css: styles === null || styles === void 0 ? void 0 : styles.segmentCardExplainerContainer,
|
|
119
|
+
children: [_jsxs(Heading, {
|
|
120
|
+
variant: "label",
|
|
121
|
+
children: [' ', segmentTitle, ' ']
|
|
122
|
+
}), _jsxs(Text, {
|
|
123
|
+
variant: "contentSmall",
|
|
124
|
+
color: "secondary",
|
|
125
|
+
children: [' ', description, ' ']
|
|
126
|
+
})]
|
|
127
|
+
}), _jsxs(Text, {
|
|
128
|
+
variant: "content",
|
|
129
|
+
children: [" ", value, " "]
|
|
130
|
+
}), _jsxs(Text, {
|
|
131
|
+
variant: "contentSmall",
|
|
132
|
+
color: "secondary",
|
|
133
|
+
children: [' ', valueDescription, ' ']
|
|
134
|
+
})]
|
|
135
|
+
}, index);
|
|
136
|
+
})
|
|
137
|
+
})]
|
|
138
|
+
}, index);
|
|
139
|
+
})]
|
|
140
|
+
})
|
|
141
|
+
}), _jsx(Modal.Footer, {
|
|
142
|
+
children: _jsx(Button, {
|
|
143
|
+
onClick: () => setOpen(false),
|
|
144
|
+
children: closeButtonText
|
|
145
|
+
})
|
|
146
|
+
})]
|
|
147
|
+
})]
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
export default NutritionFacts;
|
|
151
|
+
export { NutritionFacts };
|
|
@@ -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', 'featureName', 'data', 'closeButtonText', 'closeIconButtonScreenReaderLabel', 'triggerText'];
|
|
26
|
+
export { allowedProps };
|
|
@@ -0,0 +1,73 @@
|
|
|
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 componentTheme The theme variable object.
|
|
31
|
+
* @param params Additional parameters to customize the style.
|
|
32
|
+
* @param sharedTokens Shared token object that stores common values for the theme.
|
|
33
|
+
* @return The final style object, which will be used in the component
|
|
34
|
+
*/
|
|
35
|
+
const generateStyle = (componentTheme, _params, _sharedTokens) => {
|
|
36
|
+
return {
|
|
37
|
+
segmentCard: {
|
|
38
|
+
label: 'nutrition-facts__segment-card',
|
|
39
|
+
borderStyle: 'solid',
|
|
40
|
+
borderWidth: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardBorderWidth,
|
|
41
|
+
borderColor: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardBorderColor,
|
|
42
|
+
borderRadius: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.borderRadius,
|
|
43
|
+
padding: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardPadding,
|
|
44
|
+
display: 'flex',
|
|
45
|
+
flexDirection: 'column'
|
|
46
|
+
},
|
|
47
|
+
segmentCardExplainerContainer: {
|
|
48
|
+
label: 'nutrition-facts__segment-card-explainer-container',
|
|
49
|
+
marginBottom: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardExplainerContainerBottomMargin
|
|
50
|
+
},
|
|
51
|
+
segmentContainer: {
|
|
52
|
+
label: 'nutrition-facts__segment-container',
|
|
53
|
+
display: 'flex',
|
|
54
|
+
flexDirection: 'column',
|
|
55
|
+
gap: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardGap
|
|
56
|
+
},
|
|
57
|
+
blockContainer: {
|
|
58
|
+
label: 'nutrition-facts__block-container',
|
|
59
|
+
display: 'flex',
|
|
60
|
+
flexDirection: 'column',
|
|
61
|
+
gap: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardGap
|
|
62
|
+
},
|
|
63
|
+
body: {
|
|
64
|
+
label: 'nutrition-facts__body',
|
|
65
|
+
display: 'flex',
|
|
66
|
+
flexDirection: 'column',
|
|
67
|
+
gap: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.blockGap,
|
|
68
|
+
padding: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.bodyPadding,
|
|
69
|
+
boxSizing: 'border-box'
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
export default generateStyle;
|
package/es/exports/b.js
CHANGED
|
@@ -21,6 +21,6 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
-
export { NutritionFacts } from "../NutritionFacts/
|
|
25
|
-
export { DataPermissionLevels } from "../DataPermissionLevels/
|
|
24
|
+
export { NutritionFacts } from "../NutritionFacts/v2/index.js";
|
|
25
|
+
export { DataPermissionLevels } from "../DataPermissionLevels/v2/index.js";
|
|
26
26
|
export { AiInformation } from "../AiInformation/v2/index.js";
|
|
@@ -14,8 +14,8 @@ var _latest4 = require("@instructure/ui-text/latest");
|
|
|
14
14
|
var _latest5 = require("@instructure/ui-link/latest");
|
|
15
15
|
var _uiIcons = require("@instructure/ui-icons");
|
|
16
16
|
var _emotion = require("@instructure/emotion");
|
|
17
|
-
var _v = require("../../NutritionFacts/
|
|
18
|
-
var _v2 = require("../../DataPermissionLevels/
|
|
17
|
+
var _v = require("../../NutritionFacts/v2");
|
|
18
|
+
var _v2 = require("../../DataPermissionLevels/v2");
|
|
19
19
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
20
20
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
21
21
|
var _ExternalLinkInstUIIc;
|