@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
|
@@ -0,0 +1,103 @@
|
|
|
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
|
+
import type { ComponentStyle, ThemeOverrideValue } from '@instructure/emotion'
|
|
26
|
+
import type { OtherHTMLAttributes } from '@instructure/shared-types'
|
|
27
|
+
|
|
28
|
+
type BlockType = {
|
|
29
|
+
blockTitle: string
|
|
30
|
+
segmentData: {
|
|
31
|
+
segmentTitle: string
|
|
32
|
+
description: string
|
|
33
|
+
value: string
|
|
34
|
+
valueDescription?: string
|
|
35
|
+
}[]
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
type NutritionFactsOwnProps = {
|
|
39
|
+
/**
|
|
40
|
+
* i18n text for the label of the modal
|
|
41
|
+
*/
|
|
42
|
+
modalLabel: string
|
|
43
|
+
/**
|
|
44
|
+
* i18n text for the Nutrition Facts title
|
|
45
|
+
*/
|
|
46
|
+
title: string
|
|
47
|
+
/**
|
|
48
|
+
* i18n text for the feature name that the Nutrition Facts describes
|
|
49
|
+
*/
|
|
50
|
+
featureName: string
|
|
51
|
+
/**
|
|
52
|
+
* i18n text for the "model and data" heading of the Nutrition Facts
|
|
53
|
+
*/
|
|
54
|
+
data: BlockType[]
|
|
55
|
+
/**
|
|
56
|
+
* i18n text for the close button
|
|
57
|
+
*/
|
|
58
|
+
closeButtonText: string
|
|
59
|
+
/**
|
|
60
|
+
* i18n text for the close iconButton
|
|
61
|
+
*/
|
|
62
|
+
closeIconButtonScreenReaderLabel: string
|
|
63
|
+
/**
|
|
64
|
+
* i18n text for the trigger
|
|
65
|
+
*/
|
|
66
|
+
triggerText: string
|
|
67
|
+
/**
|
|
68
|
+
* sets the modal size to 'fullscreen'. Used for small viewports
|
|
69
|
+
*/
|
|
70
|
+
fullscreen?: boolean
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
type PropKeys = keyof NutritionFactsOwnProps
|
|
74
|
+
|
|
75
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
76
|
+
|
|
77
|
+
type NutritionFactsProps = NutritionFactsOwnProps & {
|
|
78
|
+
themeOverride?: ThemeOverrideValue
|
|
79
|
+
} & OtherHTMLAttributes<NutritionFactsOwnProps>
|
|
80
|
+
|
|
81
|
+
type NutritionFactsStyle = ComponentStyle<
|
|
82
|
+
| 'segmentCard'
|
|
83
|
+
| 'segmentCardExplainerContainer'
|
|
84
|
+
| 'segmentContainer'
|
|
85
|
+
| 'blockContainer'
|
|
86
|
+
| 'body'
|
|
87
|
+
> & {
|
|
88
|
+
maxWidth?: string
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const allowedProps: AllowedPropKeys = [
|
|
92
|
+
'fullscreen',
|
|
93
|
+
'modalLabel',
|
|
94
|
+
'title',
|
|
95
|
+
'featureName',
|
|
96
|
+
'data',
|
|
97
|
+
'closeButtonText',
|
|
98
|
+
'closeIconButtonScreenReaderLabel',
|
|
99
|
+
'triggerText'
|
|
100
|
+
]
|
|
101
|
+
|
|
102
|
+
export type { NutritionFactsProps, NutritionFactsStyle }
|
|
103
|
+
export { allowedProps }
|
|
@@ -0,0 +1,81 @@
|
|
|
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
|
+
import type { NewComponentTypes, SharedTokens } from '@instructure/ui-themes'
|
|
26
|
+
import type { NutritionFactsProps, NutritionFactsStyle } from './props'
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* ---
|
|
30
|
+
* private: true
|
|
31
|
+
* ---
|
|
32
|
+
* Generates the style object from the theme and provided additional information
|
|
33
|
+
* @param componentTheme The theme variable object.
|
|
34
|
+
* @param params Additional parameters to customize the style.
|
|
35
|
+
* @param sharedTokens Shared token object that stores common values for the theme.
|
|
36
|
+
* @return The final style object, which will be used in the component
|
|
37
|
+
*/
|
|
38
|
+
const generateStyle = (
|
|
39
|
+
componentTheme: NewComponentTypes['NutritionFacts'],
|
|
40
|
+
_params: NutritionFactsProps,
|
|
41
|
+
_sharedTokens: SharedTokens
|
|
42
|
+
): NutritionFactsStyle => {
|
|
43
|
+
return {
|
|
44
|
+
segmentCard: {
|
|
45
|
+
label: 'nutrition-facts__segment-card',
|
|
46
|
+
borderStyle: 'solid',
|
|
47
|
+
borderWidth: componentTheme?.cardBorderWidth,
|
|
48
|
+
borderColor: componentTheme?.cardBorderColor,
|
|
49
|
+
borderRadius: componentTheme?.borderRadius,
|
|
50
|
+
padding: componentTheme?.cardPadding,
|
|
51
|
+
display: 'flex',
|
|
52
|
+
flexDirection: 'column'
|
|
53
|
+
},
|
|
54
|
+
segmentCardExplainerContainer: {
|
|
55
|
+
label: 'nutrition-facts__segment-card-explainer-container',
|
|
56
|
+
marginBottom: componentTheme?.cardExplainerContainerBottomMargin
|
|
57
|
+
},
|
|
58
|
+
segmentContainer: {
|
|
59
|
+
label: 'nutrition-facts__segment-container',
|
|
60
|
+
display: 'flex',
|
|
61
|
+
flexDirection: 'column',
|
|
62
|
+
gap: componentTheme?.cardGap
|
|
63
|
+
},
|
|
64
|
+
blockContainer: {
|
|
65
|
+
label: 'nutrition-facts__block-container',
|
|
66
|
+
display: 'flex',
|
|
67
|
+
flexDirection: 'column',
|
|
68
|
+
gap: componentTheme?.cardGap
|
|
69
|
+
},
|
|
70
|
+
body: {
|
|
71
|
+
label: 'nutrition-facts__body',
|
|
72
|
+
display: 'flex',
|
|
73
|
+
flexDirection: 'column',
|
|
74
|
+
gap: componentTheme?.blockGap,
|
|
75
|
+
padding: componentTheme?.bodyPadding,
|
|
76
|
+
boxSizing: 'border-box'
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export default generateStyle
|
package/src/exports/b.ts
CHANGED
|
@@ -21,9 +21,9 @@
|
|
|
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'
|
|
25
|
+
export { DataPermissionLevels } from '../DataPermissionLevels/v2'
|
|
26
26
|
export { AiInformation } from '../AiInformation/v2'
|
|
27
|
-
export type { NutritionFactsProps } from '../NutritionFacts/
|
|
28
|
-
export type { DataPermissionLevelsProps } from '../DataPermissionLevels/
|
|
27
|
+
export type { NutritionFactsProps } from '../NutritionFacts/v2/props'
|
|
28
|
+
export type { DataPermissionLevelsProps } from '../DataPermissionLevels/v2/props'
|
|
29
29
|
export type { AiInformationProps } from '../AiInformation/v2/props'
|