@instructure/ui-list 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 (159) hide show
  1. package/CHANGELOG.md +38 -288
  2. package/es/InlineList/{InlineListItem → v1/InlineListItem}/index.js +2 -2
  3. package/es/InlineList/{index.js → v1/index.js} +1 -1
  4. package/es/InlineList/v2/InlineListItem/index.js +97 -0
  5. package/es/InlineList/v2/InlineListItem/styles.js +143 -0
  6. package/es/InlineList/v2/index.js +93 -0
  7. package/es/{index.js → InlineList/v2/props.js} +3 -3
  8. package/es/List/{ListItem → v1/ListItem}/index.js +2 -2
  9. package/es/List/v1/ListItem/props.js +28 -0
  10. package/es/List/{index.js → v1/index.js} +2 -2
  11. package/es/List/v2/ListItem/index.js +91 -0
  12. package/es/List/v2/ListItem/props.js +28 -0
  13. package/es/List/v2/ListItem/styles.js +131 -0
  14. package/es/List/v2/index.js +100 -0
  15. package/es/List/v2/props.js +26 -0
  16. package/es/List/v2/styles.js +66 -0
  17. package/es/exports/a.js +26 -0
  18. package/es/exports/b.js +26 -0
  19. package/lib/InlineList/{InlineListItem → v1/InlineListItem}/index.js +3 -3
  20. package/lib/InlineList/{index.js → v1/index.js} +2 -2
  21. package/lib/InlineList/v2/InlineListItem/index.js +102 -0
  22. package/lib/InlineList/v2/InlineListItem/styles.js +149 -0
  23. package/lib/InlineList/v2/index.js +101 -0
  24. package/lib/InlineList/v2/props.js +31 -0
  25. package/lib/List/{ListItem → v1/ListItem}/index.js +3 -3
  26. package/lib/List/v1/ListItem/props.js +33 -0
  27. package/lib/List/v1/index.js +114 -0
  28. package/lib/List/v2/ListItem/index.js +96 -0
  29. package/lib/List/v2/ListItem/props.js +33 -0
  30. package/lib/List/v2/ListItem/styles.js +137 -0
  31. package/lib/List/{index.js → v2/index.js} +4 -5
  32. package/lib/List/v2/props.js +31 -0
  33. package/lib/List/v2/styles.js +72 -0
  34. package/lib/{index.js → exports/a.js} +6 -6
  35. package/lib/exports/b.js +32 -0
  36. package/package.json +39 -17
  37. package/src/InlineList/{InlineListItem → v1/InlineListItem}/index.tsx +2 -2
  38. package/src/InlineList/{index.tsx → v1/index.tsx} +1 -1
  39. package/src/InlineList/v2/InlineListItem/index.tsx +110 -0
  40. package/src/InlineList/v2/InlineListItem/props.ts +99 -0
  41. package/src/InlineList/v2/InlineListItem/styles.ts +142 -0
  42. package/src/InlineList/v2/README.md +146 -0
  43. package/src/InlineList/v2/index.tsx +102 -0
  44. package/src/InlineList/v2/props.ts +80 -0
  45. package/src/List/{ListItem → v1/ListItem}/index.tsx +2 -2
  46. package/src/List/{index.tsx → v1/index.tsx} +2 -2
  47. package/src/List/v2/ListItem/index.tsx +104 -0
  48. package/src/List/v2/ListItem/props.ts +94 -0
  49. package/src/List/v2/ListItem/styles.ts +136 -0
  50. package/src/List/v2/README.md +142 -0
  51. package/src/List/v2/index.tsx +109 -0
  52. package/src/List/v2/props.ts +95 -0
  53. package/src/List/v2/styles.ts +77 -0
  54. package/src/exports/a.ts +32 -0
  55. package/src/exports/b.ts +32 -0
  56. package/tsconfig.build.tsbuildinfo +1 -1
  57. package/types/InlineList/v1/InlineListItem/index.d.ts.map +1 -0
  58. package/types/InlineList/v1/InlineListItem/props.d.ts.map +1 -0
  59. package/types/InlineList/v1/InlineListItem/styles.d.ts.map +1 -0
  60. package/types/InlineList/v1/InlineListItem/theme.d.ts.map +1 -0
  61. package/types/InlineList/v1/index.d.ts.map +1 -0
  62. package/types/InlineList/v1/props.d.ts.map +1 -0
  63. package/types/InlineList/v2/InlineListItem/index.d.ts +27 -0
  64. package/types/InlineList/v2/InlineListItem/index.d.ts.map +1 -0
  65. package/types/InlineList/v2/InlineListItem/props.d.ts +42 -0
  66. package/types/InlineList/v2/InlineListItem/props.d.ts.map +1 -0
  67. package/types/InlineList/v2/InlineListItem/styles.d.ts +14 -0
  68. package/types/InlineList/v2/InlineListItem/styles.d.ts.map +1 -0
  69. package/types/InlineList/v2/index.d.ts +35 -0
  70. package/types/InlineList/v2/index.d.ts.map +1 -0
  71. package/types/InlineList/v2/props.d.ts +33 -0
  72. package/types/InlineList/v2/props.d.ts.map +1 -0
  73. package/types/List/v1/ListItem/index.d.ts.map +1 -0
  74. package/types/List/v1/ListItem/props.d.ts.map +1 -0
  75. package/types/List/v1/ListItem/styles.d.ts.map +1 -0
  76. package/types/List/v1/ListItem/theme.d.ts.map +1 -0
  77. package/types/List/v1/index.d.ts.map +1 -0
  78. package/types/List/v1/props.d.ts.map +1 -0
  79. package/types/List/v1/styles.d.ts.map +1 -0
  80. package/types/List/v1/theme.d.ts.map +1 -0
  81. package/types/List/v2/ListItem/index.d.ts +26 -0
  82. package/types/List/v2/ListItem/index.d.ts.map +1 -0
  83. package/types/List/v2/ListItem/props.d.ts +38 -0
  84. package/types/List/v2/ListItem/props.d.ts.map +1 -0
  85. package/types/List/v2/ListItem/styles.d.ts +14 -0
  86. package/types/List/v2/ListItem/styles.d.ts.map +1 -0
  87. package/types/List/v2/index.d.ts +38 -0
  88. package/types/List/v2/index.d.ts.map +1 -0
  89. package/types/List/v2/props.d.ts +41 -0
  90. package/types/List/v2/props.d.ts.map +1 -0
  91. package/types/List/v2/styles.d.ts +15 -0
  92. package/types/List/v2/styles.d.ts.map +1 -0
  93. package/types/exports/a.d.ts +8 -0
  94. package/types/exports/a.d.ts.map +1 -0
  95. package/types/exports/b.d.ts +8 -0
  96. package/types/exports/b.d.ts.map +1 -0
  97. package/src/index.ts +0 -32
  98. package/types/InlineList/InlineListItem/index.d.ts.map +0 -1
  99. package/types/InlineList/InlineListItem/props.d.ts.map +0 -1
  100. package/types/InlineList/InlineListItem/styles.d.ts.map +0 -1
  101. package/types/InlineList/InlineListItem/theme.d.ts.map +0 -1
  102. package/types/InlineList/index.d.ts.map +0 -1
  103. package/types/InlineList/props.d.ts.map +0 -1
  104. package/types/List/ListItem/index.d.ts.map +0 -1
  105. package/types/List/ListItem/props.d.ts.map +0 -1
  106. package/types/List/ListItem/styles.d.ts.map +0 -1
  107. package/types/List/ListItem/theme.d.ts.map +0 -1
  108. package/types/List/index.d.ts.map +0 -1
  109. package/types/List/props.d.ts.map +0 -1
  110. package/types/List/styles.d.ts.map +0 -1
  111. package/types/List/theme.d.ts.map +0 -1
  112. package/types/index.d.ts +0 -8
  113. package/types/index.d.ts.map +0 -1
  114. /package/es/InlineList/{InlineListItem → v1/InlineListItem}/props.js +0 -0
  115. /package/es/InlineList/{InlineListItem → v1/InlineListItem}/styles.js +0 -0
  116. /package/es/InlineList/{InlineListItem → v1/InlineListItem}/theme.js +0 -0
  117. /package/es/InlineList/{props.js → v1/props.js} +0 -0
  118. /package/es/{List/ListItem → InlineList/v2/InlineListItem}/props.js +0 -0
  119. /package/es/List/{ListItem → v1/ListItem}/styles.js +0 -0
  120. /package/es/List/{ListItem → v1/ListItem}/theme.js +0 -0
  121. /package/es/List/{props.js → v1/props.js} +0 -0
  122. /package/es/List/{styles.js → v1/styles.js} +0 -0
  123. /package/es/List/{theme.js → v1/theme.js} +0 -0
  124. /package/lib/InlineList/{InlineListItem → v1/InlineListItem}/props.js +0 -0
  125. /package/lib/InlineList/{InlineListItem → v1/InlineListItem}/styles.js +0 -0
  126. /package/lib/InlineList/{InlineListItem → v1/InlineListItem}/theme.js +0 -0
  127. /package/lib/InlineList/{props.js → v1/props.js} +0 -0
  128. /package/lib/{List/ListItem → InlineList/v2/InlineListItem}/props.js +0 -0
  129. /package/lib/List/{ListItem → v1/ListItem}/styles.js +0 -0
  130. /package/lib/List/{ListItem → v1/ListItem}/theme.js +0 -0
  131. /package/lib/List/{props.js → v1/props.js} +0 -0
  132. /package/lib/List/{styles.js → v1/styles.js} +0 -0
  133. /package/lib/List/{theme.js → v1/theme.js} +0 -0
  134. /package/src/InlineList/{InlineListItem → v1/InlineListItem}/props.ts +0 -0
  135. /package/src/InlineList/{InlineListItem → v1/InlineListItem}/styles.ts +0 -0
  136. /package/src/InlineList/{InlineListItem → v1/InlineListItem}/theme.ts +0 -0
  137. /package/src/InlineList/{README.md → v1/README.md} +0 -0
  138. /package/src/InlineList/{props.ts → v1/props.ts} +0 -0
  139. /package/src/List/{ListItem → v1/ListItem}/props.ts +0 -0
  140. /package/src/List/{ListItem → v1/ListItem}/styles.ts +0 -0
  141. /package/src/List/{ListItem → v1/ListItem}/theme.ts +0 -0
  142. /package/src/List/{README.md → v1/README.md} +0 -0
  143. /package/src/List/{props.ts → v1/props.ts} +0 -0
  144. /package/src/List/{styles.ts → v1/styles.ts} +0 -0
  145. /package/src/List/{theme.ts → v1/theme.ts} +0 -0
  146. /package/types/InlineList/{InlineListItem → v1/InlineListItem}/index.d.ts +0 -0
  147. /package/types/InlineList/{InlineListItem → v1/InlineListItem}/props.d.ts +0 -0
  148. /package/types/InlineList/{InlineListItem → v1/InlineListItem}/styles.d.ts +0 -0
  149. /package/types/InlineList/{InlineListItem → v1/InlineListItem}/theme.d.ts +0 -0
  150. /package/types/InlineList/{index.d.ts → v1/index.d.ts} +0 -0
  151. /package/types/InlineList/{props.d.ts → v1/props.d.ts} +0 -0
  152. /package/types/List/{ListItem → v1/ListItem}/index.d.ts +0 -0
  153. /package/types/List/{ListItem → v1/ListItem}/props.d.ts +0 -0
  154. /package/types/List/{ListItem → v1/ListItem}/styles.d.ts +0 -0
  155. /package/types/List/{ListItem → v1/ListItem}/theme.d.ts +0 -0
  156. /package/types/List/{index.d.ts → v1/index.d.ts} +0 -0
  157. /package/types/List/{props.d.ts → v1/props.d.ts} +0 -0
  158. /package/types/List/{styles.d.ts → v1/styles.d.ts} +0 -0
  159. /package/types/List/{theme.d.ts → v1/theme.d.ts} +0 -0
@@ -0,0 +1,97 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
+ const _excluded = ["delimiter", "size", "margin", "padding", "elementRef", "children", "spacing", "styles", "lastPlaceholder"];
3
+ var _dec, _class, _InlineListItem;
4
+ /*
5
+ * The MIT License (MIT)
6
+ *
7
+ * Copyright (c) 2015 - present Instructure, Inc.
8
+ *
9
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ * of this software and associated documentation files (the "Software"), to deal
11
+ * in the Software without restriction, including without limitation the rights
12
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ * copies of the Software, and to permit persons to whom the Software is
14
+ * furnished to do so, subject to the following conditions:
15
+ *
16
+ * The above copyright notice and this permission notice shall be included in all
17
+ * copies or substantial portions of the Software.
18
+ *
19
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ * SOFTWARE.
26
+ */
27
+
28
+ import { Component } from 'react';
29
+ import { View } from '@instructure/ui-view/latest';
30
+ import { passthroughProps } from '@instructure/ui-react-utils';
31
+ import { withStyle } from '@instructure/emotion';
32
+ import generateStyle from "./styles.js";
33
+ import { allowedProps } from "./props.js";
34
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
35
+ /**
36
+ ---
37
+ parent: InlineList
38
+ id: InlineList.Item
39
+ ---
40
+ **/
41
+ let InlineListItem = (_dec = withStyle(generateStyle), _dec(_class = (_InlineListItem = class InlineListItem extends Component {
42
+ constructor(...args) {
43
+ super(...args);
44
+ this.ref = null;
45
+ this.handleRef = el => {
46
+ const elementRef = this.props.elementRef;
47
+ this.ref = el;
48
+ if (typeof elementRef === 'function') {
49
+ elementRef(el);
50
+ }
51
+ };
52
+ }
53
+ componentDidMount() {
54
+ var _this$props$makeStyle, _this$props;
55
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
56
+ }
57
+ componentDidUpdate() {
58
+ var _this$props$makeStyle2, _this$props2;
59
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
60
+ }
61
+ render() {
62
+ const _this$props3 = this.props,
63
+ delimiter = _this$props3.delimiter,
64
+ size = _this$props3.size,
65
+ margin = _this$props3.margin,
66
+ padding = _this$props3.padding,
67
+ elementRef = _this$props3.elementRef,
68
+ children = _this$props3.children,
69
+ spacing = _this$props3.spacing,
70
+ styles = _this$props3.styles,
71
+ lastPlaceholder = _this$props3.lastPlaceholder,
72
+ rest = _objectWithoutProperties(_this$props3, _excluded);
73
+ return _jsxs(View, {
74
+ ...passthroughProps(rest),
75
+ css: styles === null || styles === void 0 ? void 0 : styles.inlineListItem,
76
+ as: "li",
77
+ margin: margin,
78
+ padding: padding,
79
+ display: "inline-block",
80
+ maxWidth: "100%",
81
+ elementRef: this.handleRef,
82
+ "data-cid": "InlineListItem",
83
+ children: [children, !lastPlaceholder && _jsx("span", {
84
+ css: styles === null || styles === void 0 ? void 0 : styles.delimiter,
85
+ "aria-hidden": "true"
86
+ })]
87
+ });
88
+ }
89
+ }, _InlineListItem.displayName = "InlineListItem", _InlineListItem.componentId = 'InlineList.Item', _InlineListItem.allowedProps = allowedProps, _InlineListItem.defaultProps = {
90
+ padding: 'none',
91
+ spacing: 'none',
92
+ delimiter: 'none',
93
+ size: 'medium',
94
+ lastPlaceholder: false
95
+ }, _InlineListItem)) || _class);
96
+ export default InlineListItem;
97
+ export { InlineListItem };
@@ -0,0 +1,143 @@
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 { logError as error } from '@instructure/console';
26
+ /**
27
+ * ---
28
+ * private: true
29
+ * ---
30
+ * Generates the style object from the theme and provided additional information
31
+ * @param {Object} componentTheme The theme variable object.
32
+ * @param {Object} props the props of the component, the style is applied to
33
+ * @return {Object} The final style object, which will be used in the component
34
+ */
35
+ const generateStyle = (componentTheme, props) => {
36
+ const size = props.size,
37
+ delimiter = props.delimiter,
38
+ spacing = props.spacing;
39
+ const withDelimiter = delimiter !== 'none';
40
+ const withSpacing = spacing !== 'none';
41
+ error(!(withDelimiter && withSpacing), `[InlineList] \`itemSpacing\` has no effect inside Lists with the \`delimiter\` prop set to anything other than \`none\`.`);
42
+ const sizeVariants = {
43
+ small: {
44
+ fontSize: componentTheme.fontSizeSmall
45
+ },
46
+ medium: {
47
+ fontSize: componentTheme.fontSizeMedium
48
+ },
49
+ large: {
50
+ fontSize: componentTheme.fontSizeLarge
51
+ }
52
+ };
53
+ const spacingVariants = {
54
+ 'xxx-small': {
55
+ marginInlineStart: componentTheme.spacingXXXSmall,
56
+ marginInlineEnd: componentTheme.spacingXXXSmall
57
+ },
58
+ 'xx-small': {
59
+ marginInlineStart: componentTheme.spacingXXSmall,
60
+ marginInlineEnd: componentTheme.spacingXXSmall
61
+ },
62
+ 'x-small': {
63
+ marginInlineStart: componentTheme.spacingXSmall,
64
+ marginInlineEnd: componentTheme.spacingXSmall
65
+ },
66
+ small: {
67
+ marginInlineStart: componentTheme.spacingSmall,
68
+ marginInlineEnd: componentTheme.spacingSmall
69
+ },
70
+ medium: {
71
+ marginInlineStart: componentTheme.spacingMedium,
72
+ marginInlineEnd: componentTheme.spacingMedium
73
+ },
74
+ large: {
75
+ marginInlineStart: componentTheme.spacingLarge,
76
+ marginInlineEnd: componentTheme.spacingLarge
77
+ },
78
+ 'x-large': {
79
+ marginInlineStart: componentTheme.spacingXLarge,
80
+ marginInlineEnd: componentTheme.spacingXLarge
81
+ },
82
+ 'xx-large': {
83
+ marginInlineStart: componentTheme.spacingXXLarge,
84
+ marginInlineEnd: componentTheme.spacingXXLarge
85
+ },
86
+ none: {}
87
+ };
88
+ const delimiterVariants = {
89
+ none: {
90
+ marginInlineStart: componentTheme.noneSpacing,
91
+ marginInlineEnd: componentTheme.noneSpacing
92
+ },
93
+ pipe: {
94
+ marginInlineStart: componentTheme.pipeSpacing,
95
+ marginInlineEnd: componentTheme.pipeSpacing,
96
+ '&::after': {
97
+ content: '"\\007C"'
98
+ }
99
+ },
100
+ slash: {
101
+ marginInlineStart: componentTheme.slashSpacing,
102
+ marginInlineEnd: componentTheme.slashSpacing,
103
+ '&::after': {
104
+ content: '"\\002F"'
105
+ }
106
+ },
107
+ arrow: {
108
+ marginInlineStart: componentTheme.arrowSpacing,
109
+ marginInlineEnd: componentTheme.arrowSpacing,
110
+ '&::after': {
111
+ content: '"\\003E"'
112
+ }
113
+ }
114
+ };
115
+ return {
116
+ inlineListItem: {
117
+ label: 'inlineListItem',
118
+ fontWeight: componentTheme.fontWeight,
119
+ fontFamily: componentTheme.fontFamily,
120
+ verticalAlign: 'middle',
121
+ boxSizing: 'border-box',
122
+ lineHeight: componentTheme.lineHeight,
123
+ color: componentTheme.color,
124
+ ...(withSpacing && !withDelimiter && spacingVariants[spacing]),
125
+ ...sizeVariants[size],
126
+ '&:first-of-type': {
127
+ marginInlineStart: 0
128
+ },
129
+ '&:last-of-type': {
130
+ marginInlineEnd: 0
131
+ }
132
+ },
133
+ delimiter: {
134
+ label: 'inlineListItem__delimiter',
135
+ ...delimiterVariants[delimiter],
136
+ '[class$=-inlineListItem]:last-of-type > &:last-child::after': {
137
+ content: 'none'
138
+ },
139
+ color: componentTheme.delimiterColor
140
+ }
141
+ };
142
+ };
143
+ export default generateStyle;
@@ -0,0 +1,93 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
+ const _excluded = ["as", "margin", "elementRef"];
3
+ /*
4
+ * The MIT License (MIT)
5
+ *
6
+ * Copyright (c) 2015 - present Instructure, Inc.
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ */
26
+ import { Children, Component } from 'react';
27
+ import { View } from '@instructure/ui-view/latest';
28
+ import { passthroughProps, safeCloneElement } from '@instructure/ui-react-utils';
29
+ import { InlineListItem } from "./InlineListItem/index.js";
30
+ import { allowedProps } from "./props.js";
31
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
32
+ /**
33
+ ---
34
+ category: components
35
+ ---
36
+
37
+ **/
38
+ class InlineList extends Component {
39
+ constructor(...args) {
40
+ super(...args);
41
+ this.ref = null;
42
+ this.handleRef = el => {
43
+ const elementRef = this.props.elementRef;
44
+ this.ref = el;
45
+ if (typeof elementRef === 'function') {
46
+ elementRef(el);
47
+ }
48
+ };
49
+ }
50
+ renderChildren() {
51
+ const childrenArray = Children.toArray(this.props.children);
52
+ const lastIndex = childrenArray.length - 1;
53
+ return childrenArray.map((child, index) => {
54
+ if (!child) return null;
55
+ const shouldRenderPlaceholder = index === lastIndex;
56
+ return safeCloneElement(child, {
57
+ delimiter: this.props.delimiter,
58
+ size: this.props.size,
59
+ spacing: this.props.itemSpacing,
60
+ lastPlaceholder: shouldRenderPlaceholder
61
+ });
62
+ });
63
+ }
64
+ render() {
65
+ const _this$props = this.props,
66
+ as = _this$props.as,
67
+ margin = _this$props.margin,
68
+ elementRef = _this$props.elementRef,
69
+ rest = _objectWithoutProperties(_this$props, _excluded);
70
+ return _jsx(View, {
71
+ ...passthroughProps(rest),
72
+ as: as,
73
+ margin: margin,
74
+ padding: "0",
75
+ elementRef: this.handleRef,
76
+ display: "block",
77
+ "data-cid": "InlineList",
78
+ children: this.renderChildren()
79
+ });
80
+ }
81
+ }
82
+ InlineList.displayName = "InlineList";
83
+ InlineList.allowedProps = allowedProps;
84
+ InlineList.defaultProps = {
85
+ itemSpacing: 'none',
86
+ as: 'ul',
87
+ margin: 'none',
88
+ delimiter: 'none',
89
+ size: 'medium'
90
+ };
91
+ InlineList.Item = InlineListItem;
92
+ export default InlineList;
93
+ export { InlineList };
@@ -21,6 +21,6 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
- export { InlineList } from "./InlineList/index.js";
25
- export { List, ListItem } from "./List/index.js";
26
- export { InlineListItem } from "./InlineList/InlineListItem/index.js";
24
+
25
+ const allowedProps = ['children', 'as', 'margin', 'size', 'delimiter', 'itemSpacing', 'elementRef'];
26
+ export { allowedProps };
@@ -26,9 +26,9 @@ var _dec, _class, _ListItem;
26
26
  */
27
27
 
28
28
  import { Component } from 'react';
29
- import { View } from '@instructure/ui-view';
29
+ import { View } from '@instructure/ui-view/v11_6';
30
30
  import { passthroughProps } from '@instructure/ui-react-utils';
31
- import { withStyle } from '@instructure/emotion';
31
+ import { withStyleLegacy as withStyle } from '@instructure/emotion';
32
32
  import generateStyle from "./styles.js";
33
33
  import generateComponentTheme from "./theme.js";
34
34
  import { allowedProps } from "./props.js";
@@ -0,0 +1,28 @@
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
+ // <unknown> is needed for React 17 compatibility
26
+
27
+ const allowedProps = ['children', 'delimiter', 'size', 'margin', 'padding', 'spacing', 'elementRef'];
28
+ export { allowedProps };
@@ -26,10 +26,10 @@ var _dec, _class, _List;
26
26
  */
27
27
 
28
28
  import { Children, Component } from 'react';
29
- import { View } from '@instructure/ui-view';
29
+ import { View } from '@instructure/ui-view/v11_6';
30
30
  import { passthroughProps, safeCloneElement } from '@instructure/ui-react-utils';
31
31
  import { ListItem } from "./ListItem/index.js";
32
- import { withStyle } from '@instructure/emotion';
32
+ import { withStyleLegacy as withStyle } from '@instructure/emotion';
33
33
  import generateStyle from "./styles.js";
34
34
  import generateComponentTheme from "./theme.js";
35
35
  import { allowedProps } from "./props.js";
@@ -0,0 +1,91 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
+ const _excluded = ["delimiter", "spacing", "size", "margin", "padding", "elementRef", "children", "styles"];
3
+ var _dec, _class, _ListItem;
4
+ /*
5
+ * The MIT License (MIT)
6
+ *
7
+ * Copyright (c) 2015 - present Instructure, Inc.
8
+ *
9
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ * of this software and associated documentation files (the "Software"), to deal
11
+ * in the Software without restriction, including without limitation the rights
12
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ * copies of the Software, and to permit persons to whom the Software is
14
+ * furnished to do so, subject to the following conditions:
15
+ *
16
+ * The above copyright notice and this permission notice shall be included in all
17
+ * copies or substantial portions of the Software.
18
+ *
19
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ * SOFTWARE.
26
+ */
27
+
28
+ import { Component } from 'react';
29
+ import { View } from '@instructure/ui-view/latest';
30
+ import { passthroughProps } from '@instructure/ui-react-utils';
31
+ import { withStyle } from '@instructure/emotion';
32
+ import generateStyle from "./styles.js";
33
+ import { allowedProps } from "./props.js";
34
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
35
+ /**
36
+ ---
37
+ parent: List
38
+ id: List.Item
39
+ ---
40
+ **/
41
+ let ListItem = (_dec = withStyle(generateStyle), _dec(_class = (_ListItem = class ListItem extends Component {
42
+ constructor(...args) {
43
+ super(...args);
44
+ this.ref = null;
45
+ this.handleRef = el => {
46
+ const elementRef = this.props.elementRef;
47
+ this.ref = el;
48
+ if (typeof elementRef === 'function') {
49
+ elementRef(el);
50
+ }
51
+ };
52
+ }
53
+ componentDidMount() {
54
+ var _this$props$makeStyle, _this$props;
55
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
56
+ }
57
+ componentDidUpdate() {
58
+ var _this$props$makeStyle2, _this$props2;
59
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
60
+ }
61
+ render() {
62
+ const _this$props3 = this.props,
63
+ delimiter = _this$props3.delimiter,
64
+ spacing = _this$props3.spacing,
65
+ size = _this$props3.size,
66
+ margin = _this$props3.margin,
67
+ padding = _this$props3.padding,
68
+ elementRef = _this$props3.elementRef,
69
+ children = _this$props3.children,
70
+ styles = _this$props3.styles,
71
+ rest = _objectWithoutProperties(_this$props3, _excluded);
72
+ return _jsx(View, {
73
+ ...passthroughProps(rest),
74
+ css: styles === null || styles === void 0 ? void 0 : styles.listItem,
75
+ as: "li",
76
+ margin: margin,
77
+ padding: padding,
78
+ maxWidth: "100%",
79
+ elementRef: this.handleRef,
80
+ "data-cid": "ListItem",
81
+ children: children
82
+ });
83
+ }
84
+ }, _ListItem.displayName = "ListItem", _ListItem.componentId = 'List.Item', _ListItem.allowedProps = allowedProps, _ListItem.defaultProps = {
85
+ padding: 'none',
86
+ spacing: 'none',
87
+ delimiter: 'none',
88
+ size: 'medium'
89
+ }, _ListItem)) || _class);
90
+ export default ListItem;
91
+ export { ListItem };
@@ -0,0 +1,28 @@
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
+ // <unknown> is needed for React 17 compatibility
26
+
27
+ const allowedProps = ['children', 'delimiter', 'size', 'margin', 'padding', 'spacing', 'elementRef'];
28
+ export { allowedProps };
@@ -0,0 +1,131 @@
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 { logError as error } from '@instructure/console';
26
+ /**
27
+ * ---
28
+ * private: true
29
+ * ---
30
+ * Generates the style object from the theme and provided additional information
31
+ * @param {Object} componentTheme The theme variable object.
32
+ * @param {Object} props the props of the component, the style is applied to
33
+ * @return {Object} The final style object, which will be used in the component
34
+ */
35
+ const generateStyle = (componentTheme, props) => {
36
+ const size = props.size,
37
+ delimiter = props.delimiter,
38
+ spacing = props.spacing;
39
+ const withDelimiter = delimiter !== 'none';
40
+ const withSpacing = spacing !== 'none';
41
+ error(!(withDelimiter && withSpacing), `[List] \`itemSpacing\` has no effect inside Lists with the \`delimiter\` prop set to anything other than \`none\`.`);
42
+ const sizeVariants = {
43
+ small: {
44
+ fontSize: componentTheme.fontSizeSmall
45
+ },
46
+ medium: {
47
+ fontSize: componentTheme.fontSizeMedium
48
+ },
49
+ large: {
50
+ fontSize: componentTheme.fontSizeLarge
51
+ }
52
+ };
53
+ const spacingVariants = {
54
+ 'xxx-small': {
55
+ marginTop: componentTheme.spacingXXXSmall,
56
+ marginBottom: componentTheme.spacingXXXSmall
57
+ },
58
+ 'xx-small': {
59
+ marginTop: componentTheme.spacingXXSmall,
60
+ marginBottom: componentTheme.spacingXXSmall
61
+ },
62
+ 'x-small': {
63
+ marginTop: componentTheme.spacingXSmall,
64
+ marginBottom: componentTheme.spacingXSmall
65
+ },
66
+ small: {
67
+ marginTop: componentTheme.spacingSmall,
68
+ marginBottom: componentTheme.spacingSmall
69
+ },
70
+ medium: {
71
+ marginTop: componentTheme.spacingMedium,
72
+ marginBottom: componentTheme.spacingMedium
73
+ },
74
+ large: {
75
+ marginTop: componentTheme.spacingLarge,
76
+ marginBottom: componentTheme.spacingLarge
77
+ },
78
+ 'x-large': {
79
+ marginTop: componentTheme.spacingXLarge,
80
+ marginBottom: componentTheme.spacingXLarge
81
+ },
82
+ 'xx-large': {
83
+ marginTop: componentTheme.spacingXXLarge,
84
+ marginBottom: componentTheme.spacingXXLarge
85
+ },
86
+ none: {}
87
+ };
88
+ const delimiterVariants = {
89
+ dashed: {
90
+ listStylePosition: 'inside',
91
+ '&:not(:first-of-type)': {
92
+ borderTop: `
93
+ ${componentTheme.delimiterDashedBorder.width}
94
+ ${componentTheme.delimiterDashedBorder.style}
95
+ ${componentTheme.delimiterDashedBorder.color}
96
+ `
97
+ }
98
+ },
99
+ solid: {
100
+ listStylePosition: 'inside',
101
+ '&:not(:first-of-type)': {
102
+ borderTop: `
103
+ ${componentTheme.delimiterSolidBorder.width}
104
+ ${componentTheme.delimiterSolidBorder.style}
105
+ ${componentTheme.delimiterSolidBorder.color}
106
+ `
107
+ }
108
+ },
109
+ none: {}
110
+ };
111
+ return {
112
+ listItem: {
113
+ label: 'listItem',
114
+ fontWeight: componentTheme.fontWeight,
115
+ fontFamily: componentTheme.fontFamily,
116
+ lineHeight: componentTheme.lineHeight,
117
+ color: componentTheme.color,
118
+ padding: 0,
119
+ ...sizeVariants[size],
120
+ ...(withSpacing && !withDelimiter && spacingVariants[spacing]),
121
+ ...(withDelimiter && delimiterVariants[delimiter]),
122
+ '&:first-of-type': {
123
+ marginTop: '0'
124
+ },
125
+ '&:last-of-type': {
126
+ marginBottom: '0'
127
+ }
128
+ }
129
+ };
130
+ };
131
+ export default generateStyle;