@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,91 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = 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
+ /**
32
+ * ---
33
+ * private: true
34
+ * ---
35
+ * Generates the style object from the theme and provided additional information
36
+ * @param {Object} componentTheme The theme variable object.
37
+ * @param {Object} props the props of the component, the style is applied to
38
+ * @return {Object} The final style object, which will be used in the component
39
+ */
40
+ const generateStyle = (componentTheme, _props) => {
41
+ return {
42
+ aiInformation: {
43
+ label: 'ai-information',
44
+ width: '18.5rem',
45
+ padding: componentTheme.bodyPadding,
46
+ boxSizing: 'border-box'
47
+ },
48
+ header: {
49
+ label: 'ai-information__header',
50
+ marginBottom: componentTheme.headingBottomMargin
51
+ },
52
+ featureName: {
53
+ label: 'ai-information__feature-name',
54
+ marginBottom: componentTheme.featureNameBottomMargin
55
+ },
56
+ permissionLevelText: {
57
+ label: 'ai-information__permission-level-text',
58
+ marginBottom: componentTheme.permissionLevelTextBottomMargin
59
+ },
60
+ permissionLevel: {
61
+ label: 'ai-information__permission-level',
62
+ marginBottom: componentTheme.permissionLevelBottomMargin,
63
+ color: componentTheme.levelColor
64
+ },
65
+ description: {
66
+ label: 'ai-information__description',
67
+ marginBottom: componentTheme.descriptionBottomMargin
68
+ },
69
+ permissionLevelsModalTriggerText: {
70
+ label: 'ai-information__permission-levels-modal-trigger-text',
71
+ marginBottom: componentTheme.permissionLevelsModalTriggerBottomMargin
72
+ },
73
+ modelNameText: {
74
+ label: 'ai-information__model-name-text',
75
+ marginBottom: componentTheme.modelNameTextBottomMargin
76
+ },
77
+ modelName: {
78
+ label: 'ai-information__model-name',
79
+ marginBottom: componentTheme.modelNameBottomMargin
80
+ },
81
+ divider: {
82
+ label: 'ai-information__divider',
83
+ marginBottom: componentTheme.dividerMargin,
84
+ marginTop: componentTheme.dividerMargin,
85
+ borderTop: 'solid 1px',
86
+ width: '100%',
87
+ borderColor: componentTheme.dividerColor
88
+ }
89
+ };
90
+ };
91
+ var _default = exports.default = generateStyle;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = 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
+ /**
32
+ * Generates the theme object for the component from the theme and provided additional information
33
+ * @param {Object} theme The actual theme object.
34
+ * @return {Object} The final theme object with the overrides and component variables
35
+ */
36
+ const generateComponentTheme = theme => {
37
+ var _colors$ui, _colors$contrasts;
38
+ const colors = theme.colors,
39
+ spacing = theme.spacing;
40
+ const componentVariables = {
41
+ bodyPadding: spacing === null || spacing === void 0 ? void 0 : spacing.paddingCardLarge,
42
+ headingBottomMargin: spacing === null || spacing === void 0 ? void 0 : spacing.sectionElements,
43
+ featureNameBottomMargin: spacing === null || spacing === void 0 ? void 0 : spacing.moduleElements,
44
+ permissionLevelTextBottomMargin: spacing === null || spacing === void 0 ? void 0 : spacing.space8,
45
+ permissionLevelBottomMargin: spacing === null || spacing === void 0 ? void 0 : spacing.space8,
46
+ descriptionBottomMargin: spacing === null || spacing === void 0 ? void 0 : spacing.space8,
47
+ permissionLevelsModalTriggerBottomMargin: spacing === null || spacing === void 0 ? void 0 : spacing.moduleElements,
48
+ modelNameTextBottomMargin: spacing === null || spacing === void 0 ? void 0 : spacing.space4,
49
+ modelNameBottomMargin: spacing === null || spacing === void 0 ? void 0 : spacing.space4,
50
+ dividerMargin: spacing === null || spacing === void 0 ? void 0 : spacing.moduleElements,
51
+ dividerColor: colors === null || colors === void 0 ? void 0 : (_colors$ui = colors.ui) === null || _colors$ui === void 0 ? void 0 : _colors$ui.surfaceDivider,
52
+ levelColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.violet5790
53
+ };
54
+ return {
55
+ ...componentVariables
56
+ };
57
+ };
58
+ var _default = exports.default = generateComponentTheme;
@@ -0,0 +1,151 @@
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.DataPermissionLevels = void 0;
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
+ var _react = require("react");
10
+ var _Modal = require("@instructure/ui-modal/lib/Modal");
11
+ var _Button = require("@instructure/ui-buttons/lib/Button");
12
+ var _CloseButton = require("@instructure/ui-buttons/lib/CloseButton");
13
+ var _Heading2 = require("@instructure/ui-heading/lib/Heading");
14
+ var _Text2 = require("@instructure/ui-text/lib/Text");
15
+ var _Link = require("@instructure/ui-link/lib/Link");
16
+ var _emotion = require("@instructure/emotion");
17
+ var _styles = _interopRequireDefault(require("./styles"));
18
+ var _theme = _interopRequireDefault(require("./theme"));
19
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
20
+ /*
21
+ * The MIT License (MIT)
22
+ *
23
+ * Copyright (c) 2015 - present Instructure, Inc.
24
+ *
25
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
26
+ * of this software and associated documentation files (the "Software"), to deal
27
+ * in the Software without restriction, including without limitation the rights
28
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
29
+ * copies of the Software, and to permit persons to whom the Software is
30
+ * furnished to do so, subject to the following conditions:
31
+ *
32
+ * The above copyright notice and this permission notice shall be included in all
33
+ * copies or substantial portions of the Software.
34
+ *
35
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
38
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
40
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
41
+ * SOFTWARE.
42
+ */
43
+
44
+ /**
45
+ ---
46
+ category: components/AI Components
47
+ ---
48
+ **/const DataPermissionLevels = ({
49
+ modalLabel,
50
+ title,
51
+ data,
52
+ closeButtonText,
53
+ closeIconButtonScreenReaderLabel,
54
+ currentFeature,
55
+ currentFeatureText,
56
+ triggerText,
57
+ fullscreen = false
58
+ }) => {
59
+ var _Heading, _Text;
60
+ const _useState = (0, _react.useState)(false),
61
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
62
+ open = _useState2[0],
63
+ setOpen = _useState2[1];
64
+ const styles = (0, _emotion.useStyle)({
65
+ generateStyle: _styles.default,
66
+ generateComponentTheme: _theme.default,
67
+ componentId: 'DataPermissionLevels',
68
+ displayName: 'DataPermissionLevels'
69
+ });
70
+ return (0, _jsxRuntime.jsxs)("div", {
71
+ children: [(0, _jsxRuntime.jsx)(_Link.Link, {
72
+ variant: "standalone",
73
+ onClick: e => {
74
+ e.preventDefault();
75
+ setOpen(true);
76
+ },
77
+ forceButtonRole: false,
78
+ href: "#",
79
+ children: triggerText
80
+ }), (0, _jsxRuntime.jsxs)(_Modal.Modal, {
81
+ size: fullscreen ? 'fullscreen' : 'medium',
82
+ open: open,
83
+ onDismiss: () => {
84
+ setOpen(false);
85
+ },
86
+ label: modalLabel,
87
+ shouldCloseOnDocumentClick: true,
88
+ children: [(0, _jsxRuntime.jsxs)(_Modal.Modal.Header, {
89
+ spacing: "compact",
90
+ children: [(0, _jsxRuntime.jsx)(_Heading2.Heading, {
91
+ aiVariant: "stacked",
92
+ children: title
93
+ }), (0, _jsxRuntime.jsx)(_CloseButton.CloseButton, {
94
+ size: "medium",
95
+ placement: "end",
96
+ offset: "small",
97
+ onClick: () => setOpen(false),
98
+ screenReaderLabel: closeIconButtonScreenReaderLabel
99
+ })]
100
+ }), (0, _jsxRuntime.jsx)(_Modal.Modal.Body, {
101
+ children: (0, _jsxRuntime.jsx)("div", {
102
+ css: styles === null || styles === void 0 ? void 0 : styles.body,
103
+ children: data.map(({
104
+ level,
105
+ title,
106
+ description,
107
+ highlighted
108
+ }, index) => (0, _jsxRuntime.jsxs)("div", {
109
+ css: highlighted ? styles === null || styles === void 0 ? void 0 : styles.highlightedCard : styles === null || styles === void 0 ? void 0 : styles.card,
110
+ children: [highlighted ? (0, _jsxRuntime.jsxs)("div", {
111
+ css: styles === null || styles === void 0 ? void 0 : styles.currentFeature,
112
+ children: [_Heading || (_Heading = (0, _jsxRuntime.jsxs)(_Heading2.Heading, {
113
+ color: "primary-inverse",
114
+ level: "reset",
115
+ variant: "labelInline",
116
+ children: [currentFeatureText, ' ']
117
+ })), _Text || (_Text = (0, _jsxRuntime.jsx)(_Text2.Text, {
118
+ color: "primary-inverse",
119
+ variant: "content",
120
+ children: currentFeature
121
+ }))]
122
+ }) : null, (0, _jsxRuntime.jsxs)("div", {
123
+ css: styles === null || styles === void 0 ? void 0 : styles.contentContainer,
124
+ children: [(0, _jsxRuntime.jsx)("div", {
125
+ css: styles === null || styles === void 0 ? void 0 : styles.level,
126
+ children: level
127
+ }), (0, _jsxRuntime.jsx)("div", {
128
+ css: styles === null || styles === void 0 ? void 0 : styles.permissionTitle,
129
+ children: (0, _jsxRuntime.jsxs)(_Text2.Text, {
130
+ variant: "descriptionPage",
131
+ children: [title, " "]
132
+ })
133
+ }), (0, _jsxRuntime.jsx)(_Text2.Text, {
134
+ variant: "content",
135
+ color: "secondary",
136
+ children: description
137
+ })]
138
+ })]
139
+ }, index))
140
+ })
141
+ }), (0, _jsxRuntime.jsx)(_Modal.Modal.Footer, {
142
+ children: (0, _jsxRuntime.jsx)(_Button.Button, {
143
+ onClick: () => setOpen(false),
144
+ children: closeButtonText
145
+ })
146
+ })]
147
+ })]
148
+ });
149
+ };
150
+ exports.DataPermissionLevels = DataPermissionLevels;
151
+ var _default = exports.default = DataPermissionLevels;
@@ -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 = ['fullscreen', 'modalLabel', 'title', 'data', 'closeButtonText', 'closeIconButtonScreenReaderLabel', 'currentFeatureText', 'currentFeature', 'triggerText'];
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = 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
+ /**
32
+ * ---
33
+ * private: true
34
+ * ---
35
+ * Generates the style object from the theme and provided additional information
36
+ * @param {Object} componentTheme The theme variable object.
37
+ * @param {Object} props the props of the component, the style is applied to
38
+ * @return {Object} The final style object, which will be used in the component
39
+ */
40
+ const generateStyle = (componentTheme, _props) => {
41
+ return {
42
+ dataPermissionLevels: {
43
+ label: 'data-permission-levels'
44
+ },
45
+ body: {
46
+ label: 'data-permission-levels__body',
47
+ display: 'flex',
48
+ flexDirection: 'column',
49
+ padding: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.bodyPadding
50
+ },
51
+ card: {
52
+ label: 'data-permission-levels__card',
53
+ padding: '2px',
54
+ borderStyle: 'solid',
55
+ borderColor: 'transparent',
56
+ borderWidth: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardBorderWidth,
57
+ display: 'flex',
58
+ flexDirection: 'column'
59
+ },
60
+ highlightedCard: {
61
+ label: 'data-permission-levels__highlighted-card',
62
+ borderStyle: 'solid',
63
+ borderWidth: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardBorderWidth,
64
+ borderColor: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardBorderColor,
65
+ borderRadius: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardBorderRadius,
66
+ padding: '2px',
67
+ display: 'flex',
68
+ flexDirection: 'column',
69
+ background: `
70
+ linear-gradient(to right, ${componentTheme.aiTextLeftGradientColor} 0%, ${componentTheme.aiTextRightGradientColor} 100%) padding-box,
71
+ linear-gradient(to right, ${componentTheme.aiTextLeftGradientColor} 0%, ${componentTheme.aiTextRightGradientColor} 100%) border-box`,
72
+ border: 'solid transparent'
73
+ },
74
+ level: {
75
+ label: 'data-permission-levels__level',
76
+ color: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.levelColor
77
+ },
78
+ currentFeature: {
79
+ label: 'data-permission-levels__current-feature',
80
+ background: `
81
+ linear-gradient(to right, ${componentTheme.aiTextLeftGradientColor} 0%, ${componentTheme.aiTextRightGradientColor} 100%)`,
82
+ paddingLeft: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.currentFeaturePaddingSides,
83
+ paddingRight: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.currentFeaturePaddingSides,
84
+ paddingTop: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.currentFeaturePaddingTopBottom,
85
+ paddingBottom: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.currentFeaturePaddingTopBottom,
86
+ borderTopLeftRadius: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardBorderRadius,
87
+ borderTopRightRadius: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.cardBorderRadius
88
+ },
89
+ contentContainer: {
90
+ label: 'data-permission-levels__content-container',
91
+ background: 'white',
92
+ padding: '10px',
93
+ display: 'flex',
94
+ flexDirection: 'column'
95
+ },
96
+ permissionTitle: {
97
+ label: 'data-permission-levels__permission-title',
98
+ marginBottom: componentTheme === null || componentTheme === void 0 ? void 0 : componentTheme.permissionTitleBottomMargin
99
+ }
100
+ };
101
+ };
102
+ var _default = exports.default = generateStyle;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = 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
+ /**
32
+ * Generates the theme object for the component from the theme and provided additional information
33
+ * @param {Object} theme The actual theme object.
34
+ * @return {Object} The final theme object with the overrides and component variables
35
+ */
36
+ const generateComponentTheme = theme => {
37
+ var _colors$ui, _colors$contrasts, _colors$contrasts2, _colors$contrasts3;
38
+ const colors = theme.colors,
39
+ spacing = theme.spacing,
40
+ borders = theme.borders;
41
+ const componentVariables = {
42
+ cardBorderRadius: borders === null || borders === void 0 ? void 0 : borders.radiusMedium,
43
+ cardBorderColor: colors === null || colors === void 0 ? void 0 : (_colors$ui = colors.ui) === null || _colors$ui === void 0 ? void 0 : _colors$ui.lineStroke,
44
+ cardBorderWidth: borders === null || borders === void 0 ? void 0 : borders.widthMedium,
45
+ cardPadding: spacing === null || spacing === void 0 ? void 0 : spacing.space12,
46
+ cardExplainerContainerBottomMargin: spacing === null || spacing === void 0 ? void 0 : spacing.space8,
47
+ cardGap: spacing === null || spacing === void 0 ? void 0 : spacing.modalElements,
48
+ currentFeaturePaddingSides: spacing === null || spacing === void 0 ? void 0 : spacing.space12,
49
+ currentFeaturePaddingTopBottom: spacing === null || spacing === void 0 ? void 0 : spacing.space8,
50
+ permissionTitleBottomMargin: spacing === null || spacing === void 0 ? void 0 : spacing.space8,
51
+ levelColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.violet5790,
52
+ bodyPadding: spacing === null || spacing === void 0 ? void 0 : spacing.paddingCardLarge,
53
+ aiTextLeftGradientColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts2 = colors.contrasts) === null || _colors$contrasts2 === void 0 ? void 0 : _colors$contrasts2.violet4570,
54
+ aiTextRightGradientColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts3 = colors.contrasts) === null || _colors$contrasts3 === void 0 ? void 0 : _colors$contrasts3.sea4570
55
+ };
56
+ return {
57
+ ...componentVariables
58
+ };
59
+ };
60
+ var _default = exports.default = generateComponentTheme;
@@ -0,0 +1,159 @@
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.NutritionFacts = void 0;
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
+ var _react = require("react");
10
+ var _Modal = require("@instructure/ui-modal/lib/Modal");
11
+ var _Button = require("@instructure/ui-buttons/lib/Button");
12
+ var _CloseButton = require("@instructure/ui-buttons/lib/CloseButton");
13
+ var _Heading = require("@instructure/ui-heading/lib/Heading");
14
+ var _Text = require("@instructure/ui-text/lib/Text");
15
+ var _Link = require("@instructure/ui-link/lib/Link");
16
+ var _emotion = require("@instructure/emotion");
17
+ var _styles = _interopRequireDefault(require("./styles"));
18
+ var _theme = _interopRequireDefault(require("./theme"));
19
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
20
+ /*
21
+ * The MIT License (MIT)
22
+ *
23
+ * Copyright (c) 2015 - present Instructure, Inc.
24
+ *
25
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
26
+ * of this software and associated documentation files (the "Software"), to deal
27
+ * in the Software without restriction, including without limitation the rights
28
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
29
+ * copies of the Software, and to permit persons to whom the Software is
30
+ * furnished to do so, subject to the following conditions:
31
+ *
32
+ * The above copyright notice and this permission notice shall be included in all
33
+ * copies or substantial portions of the Software.
34
+ *
35
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
38
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
40
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
41
+ * SOFTWARE.
42
+ */
43
+
44
+ /**
45
+ ---
46
+ category: components/AI Components
47
+ ---
48
+ **/const NutritionFacts = ({
49
+ modalLabel,
50
+ title,
51
+ featureName,
52
+ data,
53
+ closeButtonText,
54
+ closeIconButtonScreenReaderLabel,
55
+ triggerText,
56
+ fullscreen = false
57
+ }) => {
58
+ const _useState = (0, _react.useState)(false),
59
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
60
+ open = _useState2[0],
61
+ setOpen = _useState2[1];
62
+ const styles = (0, _emotion.useStyle)({
63
+ generateStyle: _styles.default,
64
+ generateComponentTheme: _theme.default,
65
+ componentId: 'NutritionFacts',
66
+ displayName: 'NutritionFacts'
67
+ });
68
+ return (0, _jsxRuntime.jsxs)("div", {
69
+ children: [(0, _jsxRuntime.jsx)(_Link.Link, {
70
+ variant: "standalone",
71
+ onClick: e => {
72
+ e.preventDefault();
73
+ setOpen(true);
74
+ },
75
+ forceButtonRole: false,
76
+ href: "#",
77
+ children: triggerText
78
+ }), (0, _jsxRuntime.jsxs)(_Modal.Modal, {
79
+ open: open,
80
+ onDismiss: () => {
81
+ setOpen(false);
82
+ },
83
+ label: modalLabel,
84
+ shouldCloseOnDocumentClick: true,
85
+ size: fullscreen ? 'fullscreen' : 'medium',
86
+ children: [(0, _jsxRuntime.jsxs)(_Modal.Modal.Header, {
87
+ spacing: "compact",
88
+ children: [(0, _jsxRuntime.jsx)(_Heading.Heading, {
89
+ aiVariant: "stacked",
90
+ children: title
91
+ }), (0, _jsxRuntime.jsx)(_CloseButton.CloseButton, {
92
+ size: "medium",
93
+ placement: "end",
94
+ offset: "small",
95
+ onClick: () => setOpen(false),
96
+ screenReaderLabel: closeIconButtonScreenReaderLabel
97
+ })]
98
+ }), (0, _jsxRuntime.jsx)(_Modal.Modal.Body, {
99
+ children: (0, _jsxRuntime.jsxs)("div", {
100
+ css: styles === null || styles === void 0 ? void 0 : styles.body,
101
+ children: [(0, _jsxRuntime.jsxs)(_Heading.Heading, {
102
+ variant: "titleSection",
103
+ level: "h3",
104
+ children: [' ', featureName, ' ']
105
+ }), data.map(({
106
+ blockTitle,
107
+ segmentData
108
+ }, index) => {
109
+ return (0, _jsxRuntime.jsxs)("div", {
110
+ css: styles === null || styles === void 0 ? void 0 : styles.blockContainer,
111
+ children: [(0, _jsxRuntime.jsxs)(_Heading.Heading, {
112
+ variant: "titleModule",
113
+ level: "h4",
114
+ children: [' ', blockTitle, ' ']
115
+ }), (0, _jsxRuntime.jsx)("div", {
116
+ css: styles === null || styles === void 0 ? void 0 : styles.segmentContainer,
117
+ children: segmentData.map(({
118
+ segmentTitle,
119
+ description,
120
+ value,
121
+ valueDescription
122
+ }, index) => {
123
+ return (0, _jsxRuntime.jsxs)("div", {
124
+ css: styles === null || styles === void 0 ? void 0 : styles.segmentCard,
125
+ children: [(0, _jsxRuntime.jsxs)("div", {
126
+ css: styles === null || styles === void 0 ? void 0 : styles.segmentCardExplainerContainer,
127
+ children: [(0, _jsxRuntime.jsxs)(_Heading.Heading, {
128
+ variant: "label",
129
+ children: [' ', segmentTitle, ' ']
130
+ }), (0, _jsxRuntime.jsxs)(_Text.Text, {
131
+ variant: "contentSmall",
132
+ color: "secondary",
133
+ children: [' ', description, ' ']
134
+ })]
135
+ }), (0, _jsxRuntime.jsxs)(_Text.Text, {
136
+ variant: "content",
137
+ children: [" ", value, " "]
138
+ }), (0, _jsxRuntime.jsxs)(_Text.Text, {
139
+ variant: "contentSmall",
140
+ color: "secondary",
141
+ children: [' ', valueDescription, ' ']
142
+ })]
143
+ }, index);
144
+ })
145
+ })]
146
+ }, index);
147
+ })]
148
+ })
149
+ }), (0, _jsxRuntime.jsx)(_Modal.Modal.Footer, {
150
+ children: (0, _jsxRuntime.jsx)(_Button.Button, {
151
+ onClick: () => setOpen(false),
152
+ children: closeButtonText
153
+ })
154
+ })]
155
+ })]
156
+ });
157
+ };
158
+ exports.NutritionFacts = NutritionFacts;
159
+ var _default = exports.default = NutritionFacts;