@instructure/ui-options 11.6.0 → 11.6.1-snapshot-129

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 (149) hide show
  1. package/CHANGELOG.md +36 -294
  2. package/es/Options/{Item → v1/Item}/index.js +1 -1
  3. package/es/Options/{Separator → v1/Separator}/index.js +1 -1
  4. package/es/Options/{index.js → v1/index.js} +2 -2
  5. package/es/Options/v2/Item/index.js +127 -0
  6. package/es/Options/v2/Item/props.js +26 -0
  7. package/es/Options/v2/Item/styles.js +189 -0
  8. package/es/Options/v2/Item/theme.js +72 -0
  9. package/es/Options/v2/Separator/index.js +69 -0
  10. package/es/Options/v2/Separator/props.js +26 -0
  11. package/es/Options/v2/Separator/styles.js +46 -0
  12. package/es/Options/v2/Separator/theme.js +45 -0
  13. package/es/Options/v2/index.js +147 -0
  14. package/es/Options/v2/props.js +26 -0
  15. package/es/Options/v2/styles.js +57 -0
  16. package/es/Options/v2/theme.js +47 -0
  17. package/es/{index.js → exports/a.js} +6 -6
  18. package/es/exports/b.js +29 -0
  19. package/lib/Options/{Item → v1/Item}/index.js +1 -1
  20. package/lib/Options/{Separator → v1/Separator}/index.js +1 -1
  21. package/lib/Options/v1/index.js +153 -0
  22. package/lib/Options/v2/Item/index.js +132 -0
  23. package/lib/Options/v2/Item/props.js +31 -0
  24. package/lib/Options/v2/Item/styles.js +195 -0
  25. package/lib/Options/v2/Item/theme.js +78 -0
  26. package/lib/Options/v2/Separator/index.js +74 -0
  27. package/lib/Options/v2/Separator/props.js +31 -0
  28. package/lib/Options/v2/Separator/styles.js +52 -0
  29. package/lib/Options/v2/Separator/theme.js +51 -0
  30. package/lib/Options/{index.js → v2/index.js} +4 -5
  31. package/lib/Options/v2/props.js +31 -0
  32. package/lib/Options/v2/styles.js +63 -0
  33. package/lib/Options/v2/theme.js +53 -0
  34. package/lib/{index.js → exports/a.js} +7 -7
  35. package/lib/exports/b.js +47 -0
  36. package/package.json +40 -18
  37. package/src/Options/{Item → v1/Item}/index.tsx +1 -1
  38. package/src/Options/{Separator → v1/Separator}/index.tsx +1 -1
  39. package/src/Options/{index.tsx → v1/index.tsx} +2 -2
  40. package/src/Options/v2/Item/index.tsx +180 -0
  41. package/src/Options/v2/Item/props.ts +136 -0
  42. package/src/Options/v2/Item/styles.ts +205 -0
  43. package/src/Options/v2/Item/theme.ts +79 -0
  44. package/src/Options/v2/README.md +409 -0
  45. package/src/Options/v2/Separator/index.tsx +79 -0
  46. package/src/Options/v2/Separator/props.ts +52 -0
  47. package/src/Options/v2/Separator/styles.ts +52 -0
  48. package/src/Options/v2/Separator/theme.ts +48 -0
  49. package/src/Options/v2/index.tsx +188 -0
  50. package/src/Options/v2/props.ts +76 -0
  51. package/src/Options/v2/styles.ts +63 -0
  52. package/src/Options/v2/theme.ts +52 -0
  53. package/src/{index.ts → exports/a.ts} +9 -9
  54. package/src/exports/b.ts +38 -0
  55. package/tsconfig.build.tsbuildinfo +1 -1
  56. package/types/Options/v1/Item/index.d.ts.map +1 -0
  57. package/types/Options/v1/Item/props.d.ts.map +1 -0
  58. package/types/Options/v1/Item/styles.d.ts.map +1 -0
  59. package/types/Options/v1/Item/theme.d.ts.map +1 -0
  60. package/types/Options/v1/Separator/index.d.ts.map +1 -0
  61. package/types/Options/v1/Separator/props.d.ts.map +1 -0
  62. package/types/Options/v1/Separator/styles.d.ts.map +1 -0
  63. package/types/Options/v1/Separator/theme.d.ts.map +1 -0
  64. package/types/Options/v1/index.d.ts.map +1 -0
  65. package/types/Options/v1/props.d.ts.map +1 -0
  66. package/types/Options/v1/styles.d.ts.map +1 -0
  67. package/types/Options/v1/theme.d.ts.map +1 -0
  68. package/types/Options/v2/Item/index.d.ts +31 -0
  69. package/types/Options/v2/Item/index.d.ts.map +1 -0
  70. package/types/Options/v2/Item/props.d.ts +70 -0
  71. package/types/Options/v2/Item/props.d.ts.map +1 -0
  72. package/types/Options/v2/Item/styles.d.ts +15 -0
  73. package/types/Options/v2/Item/styles.d.ts.map +1 -0
  74. package/types/Options/v2/Item/theme.d.ts +11 -0
  75. package/types/Options/v2/Item/theme.d.ts.map +1 -0
  76. package/types/Options/v2/Separator/index.d.ts +22 -0
  77. package/types/Options/v2/Separator/index.d.ts.map +1 -0
  78. package/types/Options/v2/Separator/props.d.ts +17 -0
  79. package/types/Options/v2/Separator/props.d.ts.map +1 -0
  80. package/types/Options/v2/Separator/styles.d.ts +15 -0
  81. package/types/Options/v2/Separator/styles.d.ts.map +1 -0
  82. package/types/Options/v2/Separator/theme.d.ts +11 -0
  83. package/types/Options/v2/Separator/theme.d.ts.map +1 -0
  84. package/types/Options/v2/index.d.ts +43 -0
  85. package/types/Options/v2/index.d.ts.map +1 -0
  86. package/types/Options/v2/props.d.ts +32 -0
  87. package/types/Options/v2/props.d.ts.map +1 -0
  88. package/types/Options/v2/styles.d.ts +15 -0
  89. package/types/Options/v2/styles.d.ts.map +1 -0
  90. package/types/Options/v2/theme.d.ts +11 -0
  91. package/types/Options/v2/theme.d.ts.map +1 -0
  92. package/types/exports/a.d.ts +10 -0
  93. package/types/exports/a.d.ts.map +1 -0
  94. package/types/exports/b.d.ts +10 -0
  95. package/types/exports/b.d.ts.map +1 -0
  96. package/types/Options/Item/index.d.ts.map +0 -1
  97. package/types/Options/Item/props.d.ts.map +0 -1
  98. package/types/Options/Item/styles.d.ts.map +0 -1
  99. package/types/Options/Item/theme.d.ts.map +0 -1
  100. package/types/Options/Separator/index.d.ts.map +0 -1
  101. package/types/Options/Separator/props.d.ts.map +0 -1
  102. package/types/Options/Separator/styles.d.ts.map +0 -1
  103. package/types/Options/Separator/theme.d.ts.map +0 -1
  104. package/types/Options/index.d.ts.map +0 -1
  105. package/types/Options/props.d.ts.map +0 -1
  106. package/types/Options/styles.d.ts.map +0 -1
  107. package/types/Options/theme.d.ts.map +0 -1
  108. package/types/index.d.ts +0 -10
  109. package/types/index.d.ts.map +0 -1
  110. /package/es/Options/{Item → v1/Item}/props.js +0 -0
  111. /package/es/Options/{Item → v1/Item}/styles.js +0 -0
  112. /package/es/Options/{Item → v1/Item}/theme.js +0 -0
  113. /package/es/Options/{Separator → v1/Separator}/props.js +0 -0
  114. /package/es/Options/{Separator → v1/Separator}/styles.js +0 -0
  115. /package/es/Options/{Separator → v1/Separator}/theme.js +0 -0
  116. /package/es/Options/{props.js → v1/props.js} +0 -0
  117. /package/es/Options/{styles.js → v1/styles.js} +0 -0
  118. /package/es/Options/{theme.js → v1/theme.js} +0 -0
  119. /package/lib/Options/{Item → v1/Item}/props.js +0 -0
  120. /package/lib/Options/{Item → v1/Item}/styles.js +0 -0
  121. /package/lib/Options/{Item → v1/Item}/theme.js +0 -0
  122. /package/lib/Options/{Separator → v1/Separator}/props.js +0 -0
  123. /package/lib/Options/{Separator → v1/Separator}/styles.js +0 -0
  124. /package/lib/Options/{Separator → v1/Separator}/theme.js +0 -0
  125. /package/lib/Options/{props.js → v1/props.js} +0 -0
  126. /package/lib/Options/{styles.js → v1/styles.js} +0 -0
  127. /package/lib/Options/{theme.js → v1/theme.js} +0 -0
  128. /package/src/Options/{Item → v1/Item}/props.ts +0 -0
  129. /package/src/Options/{Item → v1/Item}/styles.ts +0 -0
  130. /package/src/Options/{Item → v1/Item}/theme.ts +0 -0
  131. /package/src/Options/{README.md → v1/README.md} +0 -0
  132. /package/src/Options/{Separator → v1/Separator}/props.ts +0 -0
  133. /package/src/Options/{Separator → v1/Separator}/styles.ts +0 -0
  134. /package/src/Options/{Separator → v1/Separator}/theme.ts +0 -0
  135. /package/src/Options/{props.ts → v1/props.ts} +0 -0
  136. /package/src/Options/{styles.ts → v1/styles.ts} +0 -0
  137. /package/src/Options/{theme.ts → v1/theme.ts} +0 -0
  138. /package/types/Options/{Item → v1/Item}/index.d.ts +0 -0
  139. /package/types/Options/{Item → v1/Item}/props.d.ts +0 -0
  140. /package/types/Options/{Item → v1/Item}/styles.d.ts +0 -0
  141. /package/types/Options/{Item → v1/Item}/theme.d.ts +0 -0
  142. /package/types/Options/{Separator → v1/Separator}/index.d.ts +0 -0
  143. /package/types/Options/{Separator → v1/Separator}/props.d.ts +0 -0
  144. /package/types/Options/{Separator → v1/Separator}/styles.d.ts +0 -0
  145. /package/types/Options/{Separator → v1/Separator}/theme.d.ts +0 -0
  146. /package/types/Options/{index.d.ts → v1/index.d.ts} +0 -0
  147. /package/types/Options/{props.d.ts → v1/props.d.ts} +0 -0
  148. /package/types/Options/{styles.d.ts → v1/styles.d.ts} +0 -0
  149. /package/types/Options/{theme.d.ts → v1/theme.d.ts} +0 -0
@@ -0,0 +1,195 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _uiReactUtils = require("@instructure/ui-react-utils");
8
+ /*
9
+ * The MIT License (MIT)
10
+ *
11
+ * Copyright (c) 2015 - present Instructure, Inc.
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ * of this software and associated documentation files (the "Software"), to deal
15
+ * in the Software without restriction, including without limitation the rights
16
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ * copies of the Software, and to permit persons to whom the Software is
18
+ * furnished to do so, subject to the following conditions:
19
+ *
20
+ * The above copyright notice and this permission notice shall be included in all
21
+ * copies or substantial portions of the Software.
22
+ *
23
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ * SOFTWARE.
30
+ */
31
+
32
+ /**
33
+ * ---
34
+ * private: true
35
+ * ---
36
+ * Generates the style object from the theme and provided additional information
37
+ * @param {Object} componentTheme The theme variable object.
38
+ * @param {Object} props the props of the component, the style is applied to
39
+ * @param {Object} state the state of the component, the style is applied to
40
+ * @return {Object} The final style object, which will be used in the component
41
+ */
42
+ const generateStyle = (componentTheme, props) => {
43
+ const variant = props.variant,
44
+ children = props.children,
45
+ hasContentBeforeLabel = props.renderBeforeLabel,
46
+ hasContentAfterLabel = props.renderAfterLabel,
47
+ beforeLabelContentVAlign = props.beforeLabelContentVAlign,
48
+ afterLabelContentVAlign = props.afterLabelContentVAlign;
49
+ // TODO if children are () => ReactNode this wont match anything
50
+ const containsList = (0, _uiReactUtils.matchComponentTypes)(children, ['Options']);
51
+
52
+ // used for label and description too
53
+ const variantVariants = {
54
+ highlighted: {
55
+ background: componentTheme.highlightedBackground,
56
+ color: componentTheme.highlightedLabelColor
57
+ },
58
+ selected: {
59
+ background: componentTheme.selectedBackground,
60
+ color: componentTheme.selectedLabelColor
61
+ },
62
+ disabled: {
63
+ cursor: 'not-allowed',
64
+ opacity: 0.68
65
+ },
66
+ 'highlighted-disabled': {
67
+ background: componentTheme.highlightedBackground,
68
+ color: componentTheme.highlightedLabelColor,
69
+ cursor: 'not-allowed'
70
+ },
71
+ 'selected-highlighted': {
72
+ background: componentTheme.selectedHighlightedBackground,
73
+ color: componentTheme.highlightedLabelColor
74
+ },
75
+ default: {
76
+ transition: 'background 200ms'
77
+ }
78
+ };
79
+ const getContentVAlign = type => {
80
+ const vAlign = type === 'before' ? beforeLabelContentVAlign : afterLabelContentVAlign;
81
+ const vOffset = type === 'before' ? componentTheme.beforeLabelContentVOffset : componentTheme.afterLabelContentVOffset;
82
+ return {
83
+ start: {
84
+ alignItems: 'flex-start',
85
+ paddingBlockStart: vOffset
86
+ },
87
+ center: {
88
+ alignItems: 'center',
89
+ paddingBlockStart: vOffset,
90
+ paddingBlockEnd: vOffset
91
+ },
92
+ end: {
93
+ alignItems: 'flex-end',
94
+ paddingBlockEnd: vOffset
95
+ }
96
+ }[vAlign];
97
+ };
98
+ const linkStyles = {
99
+ textDecoration: 'none',
100
+ color: 'currentColor'
101
+ };
102
+ return {
103
+ item: {
104
+ label: 'optionItem',
105
+ background: componentTheme.background,
106
+ color: componentTheme.color,
107
+ cursor: 'pointer',
108
+ display: 'block',
109
+ fontSize: componentTheme.fontSize,
110
+ fontFamily: componentTheme.fontFamily,
111
+ fontWeight: props.isSelected ? componentTheme.fontWeightSelected : componentTheme.fontWeight,
112
+ lineHeight: componentTheme.lineHeight,
113
+ outline: 'none',
114
+ position: 'relative',
115
+ userSelect: 'none',
116
+ ...variantVariants[variant],
117
+ ...(containsList && {
118
+ cursor: 'default'
119
+ }),
120
+ // for nested items
121
+ '[class*=-optionItem] &': {
122
+ // except if it has icon before
123
+ ...(!hasContentBeforeLabel && {
124
+ '[class$=-optionItem__container]': {
125
+ paddingInlineStart: componentTheme.nestedPadding
126
+ },
127
+ '[class$=-optionItem__content--before]': {
128
+ insetInlineStart: componentTheme.nestedPadding
129
+ }
130
+ })
131
+ }
132
+ },
133
+ container: {
134
+ label: 'optionItem__container',
135
+ display: 'block',
136
+ outline: 'none',
137
+ padding: `${componentTheme.paddingVertical} ${componentTheme.paddingHorizontal}`,
138
+ ...(containsList && {
139
+ padding: '0'
140
+ }),
141
+ ...(hasContentBeforeLabel && {
142
+ paddingInlineEnd: componentTheme.iconPadding,
143
+ paddingInlineStart: `calc(${componentTheme.iconPadding} * 2 + 1em)`
144
+ }),
145
+ ...(hasContentAfterLabel && {
146
+ paddingInlineEnd: `calc(${componentTheme.iconPadding} * 2 + 1em)`,
147
+ paddingInlineStart: componentTheme.iconPadding
148
+ }),
149
+ ...(hasContentBeforeLabel && hasContentAfterLabel && {
150
+ paddingInlineEnd: `calc(${componentTheme.iconPadding} * 2 + 1em)`,
151
+ paddingInlineStart: `calc(${componentTheme.iconPadding} * 2 + 1em)`
152
+ }),
153
+ // NOTE: needs separate groups for `:is()` and `:-webkit-any()` because of css selector group validation (see https://www.w3.org/TR/selectors-3/#grouping)
154
+ '&:is(a)': {
155
+ '&, &:link, &:visited, &:active, &:hover, &:focus': linkStyles
156
+ },
157
+ '&:-webkit-any(a)': {
158
+ '&, &:link, &:visited, &:active, &:hover, &:focus': linkStyles
159
+ }
160
+ },
161
+ content: {
162
+ label: 'optionItem__content',
163
+ display: 'flex',
164
+ height: '100%',
165
+ boxSizing: 'border-box',
166
+ pointerEvents: 'none',
167
+ position: 'absolute',
168
+ top: '0'
169
+ },
170
+ contentBefore: {
171
+ label: 'optionItem__content--before',
172
+ insetInlineEnd: 'auto',
173
+ insetInlineStart: componentTheme.iconPadding,
174
+ ...getContentVAlign('before')
175
+ },
176
+ contentAfter: {
177
+ label: 'optionItem__content--after',
178
+ insetInlineEnd: componentTheme.iconPadding,
179
+ insetInlineStart: 'auto',
180
+ ...getContentVAlign('after')
181
+ },
182
+ description: {
183
+ label: 'optionItem__description',
184
+ display: 'block',
185
+ paddingBlockStart: componentTheme.descriptionPaddingStart,
186
+ fontWeight: componentTheme.descriptionFontWeight,
187
+ fontSize: componentTheme.descriptionFontSize,
188
+ lineHeight: componentTheme.descriptionLineHeight,
189
+ color: componentTheme.descriptionColor,
190
+ ...variantVariants[variant],
191
+ background: 'none' // needed to clear variant background
192
+ }
193
+ };
194
+ };
195
+ var _default = exports.default = generateStyle;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.optionsItemThemeGenerator = 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$contrasts, _colors$contrasts2, _colors$contrasts3, _colors$contrasts4, _colors$contrasts5, _colors$contrasts6, _colors$contrasts7, _colors$contrasts8;
38
+ const colors = theme.colors,
39
+ typography = theme.typography,
40
+ spacing = theme.spacing,
41
+ themeName = theme.key;
42
+ const themeSpecificStyle = {
43
+ canvas: {
44
+ color: theme['ic-brand-font-color-dark'],
45
+ highlightedBackground: theme['ic-brand-primary']
46
+ }
47
+ };
48
+ const componentVariables = {
49
+ fontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
50
+ fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
51
+ fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightNormal,
52
+ lineHeight: typography === null || typography === void 0 ? void 0 : typography.lineHeightCondensed,
53
+ fontWeightSelected: typography === null || typography === void 0 ? void 0 : typography.fontWeightNormal,
54
+ color: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.grey125125,
55
+ background: colors === null || colors === void 0 ? void 0 : (_colors$contrasts2 = colors.contrasts) === null || _colors$contrasts2 === void 0 ? void 0 : _colors$contrasts2.white1010,
56
+ highlightedLabelColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts3 = colors.contrasts) === null || _colors$contrasts3 === void 0 ? void 0 : _colors$contrasts3.white1010,
57
+ highlightedBackground: colors === null || colors === void 0 ? void 0 : (_colors$contrasts4 = colors.contrasts) === null || _colors$contrasts4 === void 0 ? void 0 : _colors$contrasts4.blue4570,
58
+ selectedLabelColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts5 = colors.contrasts) === null || _colors$contrasts5 === void 0 ? void 0 : _colors$contrasts5.white1010,
59
+ selectedBackground: colors === null || colors === void 0 ? void 0 : (_colors$contrasts6 = colors.contrasts) === null || _colors$contrasts6 === void 0 ? void 0 : _colors$contrasts6.grey4570,
60
+ selectedHighlightedBackground: colors === null || colors === void 0 ? void 0 : (_colors$contrasts7 = colors.contrasts) === null || _colors$contrasts7 === void 0 ? void 0 : _colors$contrasts7.blue5782,
61
+ padding: `${spacing === null || spacing === void 0 ? void 0 : spacing.xSmall} ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`,
62
+ iconPadding: spacing === null || spacing === void 0 ? void 0 : spacing.small,
63
+ nestedPadding: spacing === null || spacing === void 0 ? void 0 : spacing.small,
64
+ beforeLabelContentVOffset: '0.625rem',
65
+ afterLabelContentVOffset: '0.625rem',
66
+ descriptionFontSize: typography.fontSizeSmall,
67
+ descriptionFontWeight: typography.fontWeightNormal,
68
+ descriptionLineHeight: typography.lineHeight,
69
+ descriptionPaddingStart: '0.25em',
70
+ descriptionColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts8 = colors.contrasts) === null || _colors$contrasts8 === void 0 ? void 0 : _colors$contrasts8.grey5782
71
+ };
72
+ return {
73
+ ...componentVariables,
74
+ ...themeSpecificStyle[themeName]
75
+ };
76
+ };
77
+ exports.optionsItemThemeGenerator = generateComponentTheme;
78
+ var _default = exports.default = generateComponentTheme;
@@ -0,0 +1,74 @@
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.Separator = void 0;
8
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
+ var _react = require("react");
10
+ var _uiReactUtils = require("@instructure/ui-react-utils");
11
+ var _emotion = require("@instructure/emotion");
12
+ var _styles = _interopRequireDefault(require("./styles"));
13
+ var _props = require("./props");
14
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
15
+ const _excluded = ["as", "styles"];
16
+ var _dec, _class, _Separator;
17
+ /*
18
+ * The MIT License (MIT)
19
+ *
20
+ * Copyright (c) 2015 - present Instructure, Inc.
21
+ *
22
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
23
+ * of this software and associated documentation files (the "Software"), to deal
24
+ * in the Software without restriction, including without limitation the rights
25
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
26
+ * copies of the Software, and to permit persons to whom the Software is
27
+ * furnished to do so, subject to the following conditions:
28
+ *
29
+ * The above copyright notice and this permission notice shall be included in all
30
+ * copies or substantial portions of the Software.
31
+ *
32
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
33
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
34
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
35
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
36
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
37
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
38
+ * SOFTWARE.
39
+ */
40
+ /**
41
+ ---
42
+ parent: Options
43
+ id: Options.Separator
44
+ ---
45
+ @module Separator
46
+ **/
47
+ let Separator = exports.Separator = (_dec = (0, _emotion.withStyle)(_styles.default), _dec(_class = (_Separator = class Separator extends _react.Component {
48
+ componentDidMount() {
49
+ var _this$props$makeStyle, _this$props;
50
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
51
+ }
52
+ componentDidUpdate() {
53
+ var _this$props$makeStyle2, _this$props2;
54
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
55
+ }
56
+ render() {
57
+ const _this$props3 = this.props,
58
+ as = _this$props3.as,
59
+ styles = _this$props3.styles,
60
+ rest = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
61
+ const ElementType = (0, _uiReactUtils.getElementType)(Separator, this.props, () => as);
62
+ return (0, _jsxRuntime.jsx)(ElementType, {
63
+ role: "none",
64
+ children: (0, _jsxRuntime.jsx)("div", {
65
+ ...(0, _uiReactUtils.omitProps)(rest, ['styles', 'makeStyles', 'themeOverride']),
66
+ css: styles === null || styles === void 0 ? void 0 : styles.separator,
67
+ role: "presentation"
68
+ })
69
+ });
70
+ }
71
+ }, _Separator.displayName = "Separator", _Separator.componentId = 'Options.Separator', _Separator.allowedProps = _props.allowedProps, _Separator.defaultProps = {
72
+ as: 'span'
73
+ }, _Separator)) || _class);
74
+ var _default = exports.default = Separator;
@@ -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 = ['as'];
@@ -0,0 +1,52 @@
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
+ * @param {Object} state the state of the component, the style is applied to
39
+ * @return {Object} The final style object, which will be used in the component
40
+ */
41
+ const generateStyle = componentTheme => {
42
+ return {
43
+ separator: {
44
+ label: 'separator',
45
+ height: componentTheme.height,
46
+ margin: `${componentTheme.marginVertical} ${componentTheme.marginHorizontal}`,
47
+ overflow: 'hidden',
48
+ background: componentTheme.background
49
+ }
50
+ };
51
+ };
52
+ var _default = exports.default = generateStyle;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.optionsSeparatorThemeGenerator = 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$contrasts;
38
+ const borders = theme.borders,
39
+ colors = theme.colors,
40
+ spacing = theme.spacing;
41
+ const componentVariables = {
42
+ background: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.grey3045,
43
+ height: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
44
+ margin: `0 ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`
45
+ };
46
+ return {
47
+ ...componentVariables
48
+ };
49
+ };
50
+ exports.optionsSeparatorThemeGenerator = generateComponentTheme;
51
+ var _default = exports.default = generateComponentTheme;
@@ -7,10 +7,9 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = exports.Options = void 0;
8
8
  var _react = require("react");
9
9
  var _uiReactUtils = require("@instructure/ui-react-utils");
10
- var _uiView = require("@instructure/ui-view");
10
+ var _latest = require("@instructure/ui-view/latest");
11
11
  var _emotion = require("@instructure/emotion");
12
12
  var _styles = _interopRequireDefault(require("./styles"));
13
- var _theme = _interopRequireDefault(require("./theme"));
14
13
  var _Item = require("./Item");
15
14
  var _Separator = require("./Separator");
16
15
  var _props = require("./props");
@@ -45,7 +44,7 @@ var _dec, _dec2, _class, _Options;
45
44
  category: components/utilities
46
45
  ---
47
46
  **/
48
- let Options = exports.Options = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = _dec2(_class = (_Options = class Options extends _react.Component {
47
+ let Options = exports.Options = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default), _dec(_class = _dec2(_class = (_Options = class Options extends _react.Component {
49
48
  constructor(...args) {
50
49
  super(...args);
51
50
  this.ref = null;
@@ -116,7 +115,7 @@ let Options = exports.Options = (_dec = (0, _uiReactUtils.withDeterministicId)()
116
115
  return void 0;
117
116
  }
118
117
  render() {
119
- const passthroughProps = _uiView.View.omitViewProps((0, _uiReactUtils.omitProps)(this.props, Options.allowedProps), Options);
118
+ const passthroughProps = _latest.View.omitViewProps((0, _uiReactUtils.omitProps)(this.props, Options.allowedProps), Options);
120
119
  const _this$props4 = this.props,
121
120
  as = _this$props4.as,
122
121
  role = _this$props4.role,
@@ -128,7 +127,7 @@ let Options = exports.Options = (_dec = (0, _uiReactUtils.withDeterministicId)()
128
127
  role: "presentation",
129
128
  ref: this.handleRef,
130
129
  "data-cid": "Options",
131
- children: [renderLabel && this.renderLabel(), (0, _jsxRuntime.jsx)(_uiView.View, {
130
+ children: [renderLabel && this.renderLabel(), (0, _jsxRuntime.jsx)(_latest.View, {
132
131
  ...passthroughProps,
133
132
  elementRef: elementRef,
134
133
  css: styles === null || styles === void 0 ? void 0 : styles.list,
@@ -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 = ['as', 'role', 'elementRef', 'renderLabel', 'children'];
@@ -0,0 +1,63 @@
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
+ * @param {Object} state the state of the component, the style is applied to
39
+ * @return {Object} The final style object, which will be used in the component
40
+ */
41
+ const generateStyle = componentTheme => {
42
+ return {
43
+ options: {
44
+ label: 'options',
45
+ boxSizing: 'border-box',
46
+ wordWrap: 'break-word'
47
+ },
48
+ list: {
49
+ label: 'options__list',
50
+ listStyleType: 'none',
51
+ position: 'relative'
52
+ },
53
+ label: {
54
+ label: 'options__label',
55
+ color: componentTheme.labelColor,
56
+ cursor: 'default',
57
+ display: 'block',
58
+ fontWeight: componentTheme.labelFontWeight,
59
+ padding: `${componentTheme.nestedLabelPaddingVertical} ${componentTheme.nestedLabelPaddingHorizontal}`
60
+ }
61
+ };
62
+ };
63
+ var _default = exports.default = generateStyle;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.optionsThemeGenerator = 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$contrasts, _colors$contrasts2;
38
+ const colors = theme.colors,
39
+ typography = theme.typography,
40
+ spacing = theme.spacing;
41
+ const componentVariables = {
42
+ labelFontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightBold,
43
+ background: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.white1010,
44
+ labelColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts2 = colors.contrasts) === null || _colors$contrasts2 === void 0 ? void 0 : _colors$contrasts2.grey125125,
45
+ labelPadding: `${spacing === null || spacing === void 0 ? void 0 : spacing.xSmall} 0`,
46
+ nestedLabelPadding: `${spacing === null || spacing === void 0 ? void 0 : spacing.xSmall} ${spacing === null || spacing === void 0 ? void 0 : spacing.small}`
47
+ };
48
+ return {
49
+ ...componentVariables
50
+ };
51
+ };
52
+ exports.optionsThemeGenerator = generateComponentTheme;
53
+ var _default = exports.default = generateComponentTheme;