@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.
Files changed (75) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +30 -0
  3. package/es/AiInformation/index.js +179 -0
  4. package/es/AiInformation/props.js +26 -0
  5. package/es/AiInformation/styles.js +85 -0
  6. package/es/AiInformation/theme.js +52 -0
  7. package/es/DataPermissionLevels/index.js +144 -0
  8. package/es/DataPermissionLevels/props.js +26 -0
  9. package/es/DataPermissionLevels/styles.js +96 -0
  10. package/es/DataPermissionLevels/theme.js +54 -0
  11. package/es/NutritionFacts/index.js +152 -0
  12. package/es/NutritionFacts/props.js +26 -0
  13. package/es/NutritionFacts/styles.js +72 -0
  14. package/es/NutritionFacts/theme.js +49 -0
  15. package/es/index.js +26 -0
  16. package/lib/AiInformation/index.js +185 -0
  17. package/lib/AiInformation/props.js +31 -0
  18. package/lib/AiInformation/styles.js +91 -0
  19. package/lib/AiInformation/theme.js +58 -0
  20. package/lib/DataPermissionLevels/index.js +151 -0
  21. package/lib/DataPermissionLevels/props.js +31 -0
  22. package/lib/DataPermissionLevels/styles.js +102 -0
  23. package/lib/DataPermissionLevels/theme.js +60 -0
  24. package/lib/NutritionFacts/index.js +159 -0
  25. package/lib/NutritionFacts/props.js +31 -0
  26. package/lib/NutritionFacts/styles.js +78 -0
  27. package/lib/NutritionFacts/theme.js +55 -0
  28. package/lib/index.js +26 -0
  29. package/lib/package.json +1 -0
  30. package/package.json +54 -0
  31. package/src/AiInformation/README.md +298 -0
  32. package/src/AiInformation/index.tsx +182 -0
  33. package/src/AiInformation/props.ts +163 -0
  34. package/src/AiInformation/styles.ts +92 -0
  35. package/src/AiInformation/theme.ts +58 -0
  36. package/src/DataPermissionLevels/README.md +47 -0
  37. package/src/DataPermissionLevels/index.tsx +137 -0
  38. package/src/DataPermissionLevels/props.ts +109 -0
  39. package/src/DataPermissionLevels/styles.ts +106 -0
  40. package/src/DataPermissionLevels/theme.ts +59 -0
  41. package/src/NutritionFacts/README.md +99 -0
  42. package/src/NutritionFacts/index.tsx +147 -0
  43. package/src/NutritionFacts/props.ts +106 -0
  44. package/src/NutritionFacts/styles.ts +79 -0
  45. package/src/NutritionFacts/theme.ts +52 -0
  46. package/src/index.ts +29 -0
  47. package/tsconfig.build.json +50 -0
  48. package/tsconfig.build.tsbuildinfo +1 -0
  49. package/tsconfig.json +4 -0
  50. package/types/AiInformation/index.d.ts +10 -0
  51. package/types/AiInformation/index.d.ts.map +1 -0
  52. package/types/AiInformation/props.d.ts +92 -0
  53. package/types/AiInformation/props.d.ts.map +1 -0
  54. package/types/AiInformation/styles.d.ts +14 -0
  55. package/types/AiInformation/styles.d.ts.map +1 -0
  56. package/types/AiInformation/theme.d.ts +10 -0
  57. package/types/AiInformation/theme.d.ts.map +1 -0
  58. package/types/DataPermissionLevels/index.d.ts +10 -0
  59. package/types/DataPermissionLevels/index.d.ts.map +1 -0
  60. package/types/DataPermissionLevels/props.d.ts +55 -0
  61. package/types/DataPermissionLevels/props.d.ts.map +1 -0
  62. package/types/DataPermissionLevels/styles.d.ts +14 -0
  63. package/types/DataPermissionLevels/styles.d.ts.map +1 -0
  64. package/types/DataPermissionLevels/theme.d.ts +10 -0
  65. package/types/DataPermissionLevels/theme.d.ts.map +1 -0
  66. package/types/NutritionFacts/index.d.ts +10 -0
  67. package/types/NutritionFacts/index.d.ts.map +1 -0
  68. package/types/NutritionFacts/props.d.ts +55 -0
  69. package/types/NutritionFacts/props.d.ts.map +1 -0
  70. package/types/NutritionFacts/styles.d.ts +14 -0
  71. package/types/NutritionFacts/styles.d.ts.map +1 -0
  72. package/types/NutritionFacts/theme.d.ts +10 -0
  73. package/types/NutritionFacts/theme.d.ts.map +1 -0
  74. package/types/index.d.ts +7 -0
  75. package/types/index.d.ts.map +1 -0
@@ -0,0 +1,54 @@
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, _colors$contrasts2, _colors$contrasts3;
32
+ const colors = theme.colors,
33
+ spacing = theme.spacing,
34
+ borders = theme.borders;
35
+ const componentVariables = {
36
+ cardBorderRadius: borders === null || borders === void 0 ? void 0 : borders.radiusMedium,
37
+ cardBorderColor: colors === null || colors === void 0 ? void 0 : (_colors$ui = colors.ui) === null || _colors$ui === void 0 ? void 0 : _colors$ui.lineStroke,
38
+ cardBorderWidth: borders === null || borders === void 0 ? void 0 : borders.widthMedium,
39
+ cardPadding: spacing === null || spacing === void 0 ? void 0 : spacing.space12,
40
+ cardExplainerContainerBottomMargin: spacing === null || spacing === void 0 ? void 0 : spacing.space8,
41
+ cardGap: spacing === null || spacing === void 0 ? void 0 : spacing.modalElements,
42
+ currentFeaturePaddingSides: spacing === null || spacing === void 0 ? void 0 : spacing.space12,
43
+ currentFeaturePaddingTopBottom: spacing === null || spacing === void 0 ? void 0 : spacing.space8,
44
+ permissionTitleBottomMargin: spacing === null || spacing === void 0 ? void 0 : spacing.space8,
45
+ levelColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.violet5790,
46
+ bodyPadding: spacing === null || spacing === void 0 ? void 0 : spacing.paddingCardLarge,
47
+ aiTextLeftGradientColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts2 = colors.contrasts) === null || _colors$contrasts2 === void 0 ? void 0 : _colors$contrasts2.violet4570,
48
+ aiTextRightGradientColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts3 = colors.contrasts) === null || _colors$contrasts3 === void 0 ? void 0 : _colors$contrasts3.sea4570
49
+ };
50
+ return {
51
+ ...componentVariables
52
+ };
53
+ };
54
+ export default generateComponentTheme;
@@ -0,0 +1,152 @@
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 NutritionFacts = ({
42
+ modalLabel,
43
+ title,
44
+ featureName,
45
+ data,
46
+ closeButtonText,
47
+ closeIconButtonScreenReaderLabel,
48
+ triggerText,
49
+ fullscreen = false
50
+ }) => {
51
+ const _useState = useState(false),
52
+ _useState2 = _slicedToArray(_useState, 2),
53
+ open = _useState2[0],
54
+ setOpen = _useState2[1];
55
+ const styles = useStyle({
56
+ generateStyle,
57
+ generateComponentTheme,
58
+ componentId: 'NutritionFacts',
59
+ displayName: 'NutritionFacts'
60
+ });
61
+ return _jsxs("div", {
62
+ children: [_jsx(Link, {
63
+ variant: "standalone",
64
+ onClick: e => {
65
+ e.preventDefault();
66
+ setOpen(true);
67
+ },
68
+ forceButtonRole: false,
69
+ href: "#",
70
+ children: triggerText
71
+ }), _jsxs(Modal, {
72
+ open: open,
73
+ onDismiss: () => {
74
+ setOpen(false);
75
+ },
76
+ label: modalLabel,
77
+ shouldCloseOnDocumentClick: true,
78
+ size: fullscreen ? 'fullscreen' : 'medium',
79
+ children: [_jsxs(Modal.Header, {
80
+ spacing: "compact",
81
+ children: [_jsx(Heading, {
82
+ aiVariant: "stacked",
83
+ children: title
84
+ }), _jsx(CloseButton, {
85
+ size: "medium",
86
+ placement: "end",
87
+ offset: "small",
88
+ onClick: () => setOpen(false),
89
+ screenReaderLabel: closeIconButtonScreenReaderLabel
90
+ })]
91
+ }), _jsx(Modal.Body, {
92
+ children: _jsxs("div", {
93
+ css: styles === null || styles === void 0 ? void 0 : styles.body,
94
+ children: [_jsxs(Heading, {
95
+ variant: "titleSection",
96
+ level: "h3",
97
+ children: [' ', featureName, ' ']
98
+ }), data.map(({
99
+ blockTitle,
100
+ segmentData
101
+ }, index) => {
102
+ return _jsxs("div", {
103
+ css: styles === null || styles === void 0 ? void 0 : styles.blockContainer,
104
+ children: [_jsxs(Heading, {
105
+ variant: "titleModule",
106
+ level: "h4",
107
+ children: [' ', blockTitle, ' ']
108
+ }), _jsx("div", {
109
+ css: styles === null || styles === void 0 ? void 0 : styles.segmentContainer,
110
+ children: segmentData.map(({
111
+ segmentTitle,
112
+ description,
113
+ value,
114
+ valueDescription
115
+ }, index) => {
116
+ return _jsxs("div", {
117
+ css: styles === null || styles === void 0 ? void 0 : styles.segmentCard,
118
+ children: [_jsxs("div", {
119
+ css: styles === null || styles === void 0 ? void 0 : styles.segmentCardExplainerContainer,
120
+ children: [_jsxs(Heading, {
121
+ variant: "label",
122
+ children: [' ', segmentTitle, ' ']
123
+ }), _jsxs(Text, {
124
+ variant: "contentSmall",
125
+ color: "secondary",
126
+ children: [' ', description, ' ']
127
+ })]
128
+ }), _jsxs(Text, {
129
+ variant: "content",
130
+ children: [" ", value, " "]
131
+ }), _jsxs(Text, {
132
+ variant: "contentSmall",
133
+ color: "secondary",
134
+ children: [' ', valueDescription, ' ']
135
+ })]
136
+ }, index);
137
+ })
138
+ })]
139
+ }, index);
140
+ })]
141
+ })
142
+ }), _jsx(Modal.Footer, {
143
+ children: _jsx(Button, {
144
+ onClick: () => setOpen(false),
145
+ children: closeButtonText
146
+ })
147
+ })]
148
+ })]
149
+ });
150
+ };
151
+ export default NutritionFacts;
152
+ 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,72 @@
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
+ segmentCard: {
37
+ label: 'nutrition-facts__segment-card',
38
+ borderStyle: 'solid',
39
+ borderWidth: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardBorderWidth,
40
+ borderColor: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardBorderColor,
41
+ borderRadius: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardBorderRadius,
42
+ padding: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardPadding,
43
+ display: 'flex',
44
+ flexDirection: 'column'
45
+ },
46
+ segmentCardExplainerContainer: {
47
+ label: 'nutrition-facts__segment-card-explainer-container',
48
+ marginBottom: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardExplainerContainerBottomMargin
49
+ },
50
+ segmentContainer: {
51
+ label: 'nutrition-facts__segment-container',
52
+ display: 'flex',
53
+ flexDirection: 'column',
54
+ gap: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardGap
55
+ },
56
+ blockContainer: {
57
+ label: 'nutrition-facts__block-container',
58
+ display: 'flex',
59
+ flexDirection: 'column',
60
+ gap: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardGap
61
+ },
62
+ body: {
63
+ label: 'nutrition-facts__body',
64
+ display: 'flex',
65
+ flexDirection: 'column',
66
+ gap: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.blockGap,
67
+ padding: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.bodyPadding,
68
+ boxSizing: 'border-box'
69
+ }
70
+ };
71
+ };
72
+ export default generateStyle;
@@ -0,0 +1,49 @@
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;
32
+ const colors = theme.colors,
33
+ spacing = theme.spacing,
34
+ borders = theme.borders;
35
+ const componentVariables = {
36
+ cardBorderRadius: borders === null || borders === void 0 ? void 0 : borders.radiusMedium,
37
+ cardBorderColor: colors === null || colors === void 0 ? void 0 : (_colors$ui = colors.ui) === null || _colors$ui === void 0 ? void 0 : _colors$ui.lineStroke,
38
+ cardBorderWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
39
+ cardPadding: spacing === null || spacing === void 0 ? void 0 : spacing.space12,
40
+ cardExplainerContainerBottomMargin: spacing === null || spacing === void 0 ? void 0 : spacing.space8,
41
+ cardGap: spacing === null || spacing === void 0 ? void 0 : spacing.modalElements,
42
+ bodyPadding: spacing === null || spacing === void 0 ? void 0 : spacing.paddingCardLarge,
43
+ blockGap: spacing === null || spacing === void 0 ? void 0 : spacing.sectionElements
44
+ };
45
+ return {
46
+ ...componentVariables
47
+ };
48
+ };
49
+ export default generateComponentTheme;
package/es/index.js ADDED
@@ -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
+ export { NutritionFacts } from './NutritionFacts';
25
+ export { DataPermissionLevels } from './DataPermissionLevels';
26
+ export { AiInformation } from './AiInformation';
@@ -0,0 +1,185 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = exports.AiInformation = void 0;
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
+ var _react = require("react");
10
+ var _Popover = require("@instructure/ui-popover/lib/Popover");
11
+ var _CloseButton = require("@instructure/ui-buttons/lib/CloseButton");
12
+ var _Heading = require("@instructure/ui-heading/lib/Heading");
13
+ var _Text = require("@instructure/ui-text/lib/Text");
14
+ var _emotion = require("@instructure/emotion");
15
+ var _ = require("../");
16
+ var _styles = _interopRequireDefault(require("./styles"));
17
+ var _theme = _interopRequireDefault(require("./theme"));
18
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
19
+ /*
20
+ * The MIT License (MIT)
21
+ *
22
+ * Copyright (c) 2015 - present Instructure, Inc.
23
+ *
24
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
25
+ * of this software and associated documentation files (the "Software"), to deal
26
+ * in the Software without restriction, including without limitation the rights
27
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
28
+ * copies of the Software, and to permit persons to whom the Software is
29
+ * furnished to do so, subject to the following conditions:
30
+ *
31
+ * The above copyright notice and this permission notice shall be included in all
32
+ * copies or substantial portions of the Software.
33
+ *
34
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
37
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
38
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
39
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
40
+ * SOFTWARE.
41
+ */
42
+
43
+ /**
44
+ ---
45
+ category: components/AI Components
46
+ ---
47
+ **/const AiInformation = ({
48
+ title,
49
+ data,
50
+ trigger,
51
+ fullscreenModals = false,
52
+ dataPermissionLevelsModalLabel,
53
+ dataPermissionLevelsTitle,
54
+ dataPermissionLevelsData,
55
+ dataPermissionLevelsCloseButtonText,
56
+ dataPermissionLevelsCloseIconButtonScreenReaderLabel,
57
+ dataPermissionLevelsCurrentFeature,
58
+ dataPermissionLevelsCurrentFeatureText,
59
+ nutritionFactsModalLabel,
60
+ nutritionFactsTitle,
61
+ nutritionFactsFeatureName,
62
+ nutritionFactsData,
63
+ nutritionFactsCloseButtonText,
64
+ nutritionFactsCloseIconButtonScreenReaderLabel
65
+ }) => {
66
+ const _useState = (0, _react.useState)(false),
67
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
68
+ open = _useState2[0],
69
+ setOpen = _useState2[1];
70
+ const styles = (0, _emotion.useStyle)({
71
+ generateStyle: _styles.default,
72
+ generateComponentTheme: _theme.default,
73
+ componentId: 'AiInformation',
74
+ displayName: 'AiInformation'
75
+ });
76
+ return (0, _jsxRuntime.jsx)("div", {
77
+ children: (0, _jsxRuntime.jsx)(_Popover.Popover, {
78
+ renderTrigger: trigger,
79
+ isShowingContent: open,
80
+ on: "click",
81
+ screenReaderLabel: "Popover Dialog Example",
82
+ shouldContainFocus: true,
83
+ shouldReturnFocus: true,
84
+ shouldCloseOnDocumentClick: true,
85
+ offsetY: "1rem",
86
+ onShowContent: () => setOpen(true),
87
+ onHideContent: () => setOpen(false),
88
+ children: (0, _jsxRuntime.jsxs)("div", {
89
+ css: styles === null || styles === void 0 ? void 0 : styles.aiInformation,
90
+ children: [(0, _jsxRuntime.jsxs)("div", {
91
+ css: styles === null || styles === void 0 ? void 0 : styles.header,
92
+ children: [(0, _jsxRuntime.jsx)(_Heading.Heading, {
93
+ level: "h2",
94
+ aiVariant: "stacked",
95
+ variant: "titleModule",
96
+ children: title
97
+ }), (0, _jsxRuntime.jsx)(_CloseButton.CloseButton, {
98
+ placement: "end",
99
+ offset: "small",
100
+ onClick: () => setOpen(false),
101
+ screenReaderLabel: "Close"
102
+ })]
103
+ }), (0, _jsxRuntime.jsx)("div", {
104
+ children: data.map(({
105
+ featureName,
106
+ permissionLevelText,
107
+ permissionLevel,
108
+ description,
109
+ permissionLevelsModalTriggerText,
110
+ modelNameText,
111
+ modelName,
112
+ nutritionFactsModalTriggerText
113
+ }, index) => (0, _jsxRuntime.jsxs)("div", {
114
+ children: [(0, _jsxRuntime.jsx)("div", {
115
+ css: styles === null || styles === void 0 ? void 0 : styles.featureName,
116
+ children: (0, _jsxRuntime.jsx)(_Heading.Heading, {
117
+ level: "h3",
118
+ variant: "titleCardRegular",
119
+ children: featureName
120
+ })
121
+ }), (0, _jsxRuntime.jsx)("div", {
122
+ css: styles === null || styles === void 0 ? void 0 : styles.permissionLevelText,
123
+ children: (0, _jsxRuntime.jsx)(_Heading.Heading, {
124
+ level: "h4",
125
+ variant: "label",
126
+ children: permissionLevelText
127
+ })
128
+ }), (0, _jsxRuntime.jsx)("div", {
129
+ css: styles === null || styles === void 0 ? void 0 : styles.permissionLevel,
130
+ children: (0, _jsxRuntime.jsxs)(_Text.Text, {
131
+ variant: "legend",
132
+ children: [" ", permissionLevel, " "]
133
+ })
134
+ }), (0, _jsxRuntime.jsx)("div", {
135
+ css: styles === null || styles === void 0 ? void 0 : styles.description,
136
+ children: (0, _jsxRuntime.jsxs)(_Text.Text, {
137
+ variant: "contentSmall",
138
+ children: [" ", description, " "]
139
+ })
140
+ }), (0, _jsxRuntime.jsx)("div", {
141
+ css: styles === null || styles === void 0 ? void 0 : styles.permissionLevelsModalTriggerText,
142
+ children: (0, _jsxRuntime.jsx)(_.DataPermissionLevels, {
143
+ fullscreen: fullscreenModals,
144
+ title: dataPermissionLevelsTitle,
145
+ currentFeatureText: dataPermissionLevelsCurrentFeatureText,
146
+ currentFeature: dataPermissionLevelsCurrentFeature,
147
+ closeIconButtonScreenReaderLabel: dataPermissionLevelsCloseIconButtonScreenReaderLabel,
148
+ closeButtonText: dataPermissionLevelsCloseButtonText,
149
+ modalLabel: dataPermissionLevelsModalLabel,
150
+ triggerText: permissionLevelsModalTriggerText,
151
+ data: dataPermissionLevelsData
152
+ })
153
+ }), (0, _jsxRuntime.jsx)("div", {
154
+ css: styles === null || styles === void 0 ? void 0 : styles.modelNameText,
155
+ children: (0, _jsxRuntime.jsxs)(_Heading.Heading, {
156
+ level: "h3",
157
+ variant: "label",
158
+ children: [' ', modelNameText, ' ']
159
+ })
160
+ }), (0, _jsxRuntime.jsx)("div", {
161
+ css: styles === null || styles === void 0 ? void 0 : styles.modelName,
162
+ children: (0, _jsxRuntime.jsxs)(_Text.Text, {
163
+ variant: "contentSmall",
164
+ children: [" ", modelName, " "]
165
+ })
166
+ }), (0, _jsxRuntime.jsx)(_.NutritionFacts, {
167
+ fullscreen: fullscreenModals,
168
+ modalLabel: nutritionFactsModalLabel,
169
+ title: nutritionFactsTitle,
170
+ featureName: nutritionFactsFeatureName,
171
+ closeButtonText: nutritionFactsCloseButtonText,
172
+ closeIconButtonScreenReaderLabel: nutritionFactsCloseIconButtonScreenReaderLabel,
173
+ triggerText: nutritionFactsModalTriggerText,
174
+ data: nutritionFactsData
175
+ }), data.length !== index + 1 ? (0, _jsxRuntime.jsx)("div", {
176
+ css: styles === null || styles === void 0 ? void 0 : styles.divider
177
+ }) : null]
178
+ }, index))
179
+ })]
180
+ })
181
+ })
182
+ });
183
+ };
184
+ exports.AiInformation = AiInformation;
185
+ var _default = exports.default = AiInformation;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.allowedProps = void 0;
7
+ /*
8
+ * The MIT License (MIT)
9
+ *
10
+ * Copyright (c) 2015 - present Instructure, Inc.
11
+ *
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ * of this software and associated documentation files (the "Software"), to deal
14
+ * in the Software without restriction, including without limitation the rights
15
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ * copies of the Software, and to permit persons to whom the Software is
17
+ * furnished to do so, subject to the following conditions:
18
+ *
19
+ * The above copyright notice and this permission notice shall be included in all
20
+ * copies or substantial portions of the Software.
21
+ *
22
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ * SOFTWARE.
29
+ */
30
+
31
+ const allowedProps = exports.allowedProps = ['fullscreenModals', 'title', 'data', 'trigger', 'dataPermissionLevelsModalLabel', 'dataPermissionLevelsTitle', 'dataPermissionLevelsData', 'dataPermissionLevelsCloseButtonText', 'dataPermissionLevelsCloseIconButtonScreenReaderLabel', 'dataPermissionLevelsCurrentFeatureText', 'dataPermissionLevelsCurrentFeature', 'nutritionFactsModalLabel', 'nutritionFactsTitle', 'nutritionFactsFeatureName', 'nutritionFactsData', 'nutritionFactsCloseButtonText', 'nutritionFactsCloseIconButtonScreenReaderLabel'];