@instructure/ui-pill 8.8.1-snapshot.3 → 8.9.0
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 +6 -0
- package/es/Pill/index.js +23 -39
- package/{src/Pill/types.ts → es/Pill/props.js} +17 -11
- package/lib/Pill/index.js +22 -38
- package/lib/Pill/props.js +53 -0
- package/package.json +17 -18
- package/src/Pill/index.tsx +11 -39
- package/src/Pill/props.ts +74 -0
- package/src/Pill/styles.ts +1 -1
- package/src/index.ts +1 -1
- package/types/Pill/index.d.ts +16 -20
- package/types/Pill/index.d.ts.map +1 -1
- package/types/Pill/props.d.ts +18 -0
- package/types/Pill/props.d.ts.map +1 -0
- package/types/Pill/styles.d.ts +1 -1
- package/types/index.d.ts +1 -1
- package/LICENSE.md +0 -27
- package/es/Pill/types.js +0 -1
- package/lib/Pill/types.js +0 -1
- package/types/Pill/types.d.ts +0 -11
- package/types/Pill/types.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [8.9.0](https://github.com/instructure/instructure-ui/compare/v8.8.0...v8.9.0) (2021-09-15)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- fix shared-types TS errors ([7b83164](https://github.com/instructure/instructure-ui/commit/7b83164f4c5872f3a217e010563f59bf584ae4fc))
|
|
11
|
+
|
|
6
12
|
# [8.8.0](https://github.com/instructure/instructure-ui/compare/v8.7.0...v8.8.0) (2021-08-27)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @instructure/ui-pill
|
package/es/Pill/index.js
CHANGED
|
@@ -29,21 +29,21 @@ var _dec, _dec2, _class, _class2, _temp;
|
|
|
29
29
|
|
|
30
30
|
/** @jsx jsx */
|
|
31
31
|
import { Component } from 'react';
|
|
32
|
-
import PropTypes from 'prop-types';
|
|
33
32
|
import { View } from '@instructure/ui-view';
|
|
34
33
|
import { Tooltip } from '@instructure/ui-tooltip';
|
|
35
34
|
import { TruncateText } from '@instructure/ui-truncate-text';
|
|
36
35
|
import { passthroughProps } from '@instructure/ui-react-utils';
|
|
37
36
|
import { testable } from '@instructure/ui-testable';
|
|
38
|
-
import { withStyle, jsx
|
|
37
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
39
38
|
import generateStyle from './styles';
|
|
40
39
|
import generateComponentTheme from './theme';
|
|
41
|
-
|
|
40
|
+
import { allowedProps, propTypes } from './props';
|
|
42
41
|
/**
|
|
43
42
|
---
|
|
44
43
|
category: components
|
|
45
44
|
---
|
|
46
45
|
**/
|
|
46
|
+
|
|
47
47
|
let Pill = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_temp = _class2 = class Pill extends Component {
|
|
48
48
|
constructor(props) {
|
|
49
49
|
super(props);
|
|
@@ -53,11 +53,15 @@ let Pill = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
componentDidMount() {
|
|
56
|
-
|
|
56
|
+
var _this$props$makeStyle, _this$props;
|
|
57
|
+
|
|
58
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
57
59
|
}
|
|
58
60
|
|
|
59
|
-
componentDidUpdate(
|
|
60
|
-
|
|
61
|
+
componentDidUpdate() {
|
|
62
|
+
var _this$props$makeStyle2, _this$props2;
|
|
63
|
+
|
|
64
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
handleTruncation(truncated) {
|
|
@@ -69,15 +73,15 @@ let Pill = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
|
|
|
69
73
|
}
|
|
70
74
|
|
|
71
75
|
renderPill(focused, getTriggerProps) {
|
|
72
|
-
const _this$
|
|
73
|
-
margin = _this$
|
|
74
|
-
children = _this$
|
|
75
|
-
color = _this$
|
|
76
|
-
as = _this$
|
|
77
|
-
elementRef = _this$
|
|
78
|
-
styles = _this$
|
|
79
|
-
makeStyles = _this$
|
|
80
|
-
props = _objectWithoutProperties(_this$
|
|
76
|
+
const _this$props3 = this.props,
|
|
77
|
+
margin = _this$props3.margin,
|
|
78
|
+
children = _this$props3.children,
|
|
79
|
+
color = _this$props3.color,
|
|
80
|
+
as = _this$props3.as,
|
|
81
|
+
elementRef = _this$props3.elementRef,
|
|
82
|
+
styles = _this$props3.styles,
|
|
83
|
+
makeStyles = _this$props3.makeStyles,
|
|
84
|
+
props = _objectWithoutProperties(_this$props3, _excluded);
|
|
81
85
|
|
|
82
86
|
const filteredProps = passthroughProps(props);
|
|
83
87
|
const containerProps = typeof getTriggerProps === 'function' ? getTriggerProps(filteredProps) : filteredProps;
|
|
@@ -86,7 +90,7 @@ let Pill = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
|
|
|
86
90
|
elementRef: elementRef,
|
|
87
91
|
margin: margin,
|
|
88
92
|
padding: "0",
|
|
89
|
-
maxWidth: styles.maxWidth,
|
|
93
|
+
maxWidth: styles === null || styles === void 0 ? void 0 : styles.maxWidth,
|
|
90
94
|
background: "transparent",
|
|
91
95
|
borderRadius: "pill",
|
|
92
96
|
borderWidth: "0",
|
|
@@ -95,9 +99,9 @@ let Pill = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
|
|
|
95
99
|
withFocusOutline: focused,
|
|
96
100
|
focusColor: "info"
|
|
97
101
|
}), jsx("span", {
|
|
98
|
-
css: styles.pill
|
|
102
|
+
css: styles === null || styles === void 0 ? void 0 : styles.pill
|
|
99
103
|
}, jsx("span", {
|
|
100
|
-
css: styles.text
|
|
104
|
+
css: styles === null || styles === void 0 ? void 0 : styles.text
|
|
101
105
|
}, jsx(TruncateText, {
|
|
102
106
|
onUpdate: truncated => {
|
|
103
107
|
this.handleTruncation(truncated);
|
|
@@ -120,27 +124,7 @@ let Pill = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = tes
|
|
|
120
124
|
}
|
|
121
125
|
}
|
|
122
126
|
|
|
123
|
-
}, _class2.displayName = "Pill", _class2.componentId = 'Pill', _class2.propTypes = {
|
|
124
|
-
// eslint-disable-next-line react/require-default-props
|
|
125
|
-
makeStyles: PropTypes.func,
|
|
126
|
-
// eslint-disable-next-line react/require-default-props
|
|
127
|
-
styles: PropTypes.object,
|
|
128
|
-
as: PropTypes.elementType,
|
|
129
|
-
// eslint-disable-line react/require-default-props
|
|
130
|
-
children: PropTypes.node.isRequired,
|
|
131
|
-
color: PropTypes.oneOf(['primary', 'success', 'danger', 'info', 'warning', 'alert']),
|
|
132
|
-
elementRef: PropTypes.func,
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
136
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
137
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
138
|
-
*/
|
|
139
|
-
margin: ThemeablePropTypes.spacing
|
|
140
|
-
}, _class2.defaultProps = {
|
|
141
|
-
children: void 0,
|
|
142
|
-
margin: void 0,
|
|
143
|
-
elementRef: void 0,
|
|
127
|
+
}, _class2.displayName = "Pill", _class2.componentId = 'Pill', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
|
|
144
128
|
color: 'primary'
|
|
145
129
|
}, _temp)) || _class) || _class);
|
|
146
130
|
export default Pill;
|
|
@@ -21,15 +21,21 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
+
import PropTypes from 'prop-types';
|
|
25
|
+
import { ThemeablePropTypes } from '@instructure/emotion';
|
|
26
|
+
const propTypes = {
|
|
27
|
+
as: PropTypes.elementType,
|
|
28
|
+
// eslint-disable-line react/require-default-props
|
|
29
|
+
children: PropTypes.node.isRequired,
|
|
30
|
+
color: PropTypes.oneOf(['primary', 'success', 'danger', 'info', 'warning', 'alert']),
|
|
31
|
+
elementRef: PropTypes.func,
|
|
24
32
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
margin?: Spacing
|
|
35
|
-
}
|
|
33
|
+
/**
|
|
34
|
+
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
35
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
36
|
+
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
37
|
+
*/
|
|
38
|
+
margin: ThemeablePropTypes.spacing
|
|
39
|
+
};
|
|
40
|
+
const allowedProps = ['as', 'children', 'color', 'elementRef', 'margin'];
|
|
41
|
+
export { propTypes, allowedProps };
|
package/lib/Pill/index.js
CHANGED
|
@@ -11,8 +11,6 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
11
11
|
|
|
12
12
|
var _react = require("react");
|
|
13
13
|
|
|
14
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
|
|
16
14
|
var _View = require("@instructure/ui-view/lib/View");
|
|
17
15
|
|
|
18
16
|
var _Tooltip = require("@instructure/ui-tooltip/lib/Tooltip");
|
|
@@ -29,6 +27,8 @@ var _styles = _interopRequireDefault(require("./styles"));
|
|
|
29
27
|
|
|
30
28
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
31
29
|
|
|
30
|
+
var _props = require("./props");
|
|
31
|
+
|
|
32
32
|
const _excluded = ["margin", "children", "color", "as", "elementRef", "styles", "makeStyles"];
|
|
33
33
|
|
|
34
34
|
var _dec, _dec2, _class, _class2, _temp;
|
|
@@ -47,11 +47,15 @@ let Pill = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
componentDidMount() {
|
|
50
|
-
|
|
50
|
+
var _this$props$makeStyle, _this$props;
|
|
51
|
+
|
|
52
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
51
53
|
}
|
|
52
54
|
|
|
53
|
-
componentDidUpdate(
|
|
54
|
-
|
|
55
|
+
componentDidUpdate() {
|
|
56
|
+
var _this$props$makeStyle2, _this$props2;
|
|
57
|
+
|
|
58
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
handleTruncation(truncated) {
|
|
@@ -63,15 +67,15 @@ let Pill = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
renderPill(focused, getTriggerProps) {
|
|
66
|
-
const _this$
|
|
67
|
-
margin = _this$
|
|
68
|
-
children = _this$
|
|
69
|
-
color = _this$
|
|
70
|
-
as = _this$
|
|
71
|
-
elementRef = _this$
|
|
72
|
-
styles = _this$
|
|
73
|
-
makeStyles = _this$
|
|
74
|
-
props = (0, _objectWithoutProperties2.default)(_this$
|
|
70
|
+
const _this$props3 = this.props,
|
|
71
|
+
margin = _this$props3.margin,
|
|
72
|
+
children = _this$props3.children,
|
|
73
|
+
color = _this$props3.color,
|
|
74
|
+
as = _this$props3.as,
|
|
75
|
+
elementRef = _this$props3.elementRef,
|
|
76
|
+
styles = _this$props3.styles,
|
|
77
|
+
makeStyles = _this$props3.makeStyles,
|
|
78
|
+
props = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
|
|
75
79
|
const filteredProps = (0, _passthroughProps.passthroughProps)(props);
|
|
76
80
|
const containerProps = typeof getTriggerProps === 'function' ? getTriggerProps(filteredProps) : filteredProps;
|
|
77
81
|
return (0, _emotion.jsx)(_View.View, Object.assign({}, containerProps, {
|
|
@@ -79,7 +83,7 @@ let Pill = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
79
83
|
elementRef: elementRef,
|
|
80
84
|
margin: margin,
|
|
81
85
|
padding: "0",
|
|
82
|
-
maxWidth: styles.maxWidth,
|
|
86
|
+
maxWidth: styles === null || styles === void 0 ? void 0 : styles.maxWidth,
|
|
83
87
|
background: "transparent",
|
|
84
88
|
borderRadius: "pill",
|
|
85
89
|
borderWidth: "0",
|
|
@@ -88,9 +92,9 @@ let Pill = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
88
92
|
withFocusOutline: focused,
|
|
89
93
|
focusColor: "info"
|
|
90
94
|
}), (0, _emotion.jsx)("span", {
|
|
91
|
-
css: styles.pill
|
|
95
|
+
css: styles === null || styles === void 0 ? void 0 : styles.pill
|
|
92
96
|
}, (0, _emotion.jsx)("span", {
|
|
93
|
-
css: styles.text
|
|
97
|
+
css: styles === null || styles === void 0 ? void 0 : styles.text
|
|
94
98
|
}, (0, _emotion.jsx)(_TruncateText.TruncateText, {
|
|
95
99
|
onUpdate: truncated => {
|
|
96
100
|
this.handleTruncation(truncated);
|
|
@@ -113,27 +117,7 @@ let Pill = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _de
|
|
|
113
117
|
}
|
|
114
118
|
}
|
|
115
119
|
|
|
116
|
-
}, _class2.displayName = "Pill", _class2.componentId = 'Pill', _class2.propTypes = {
|
|
117
|
-
// eslint-disable-next-line react/require-default-props
|
|
118
|
-
makeStyles: _propTypes.default.func,
|
|
119
|
-
// eslint-disable-next-line react/require-default-props
|
|
120
|
-
styles: _propTypes.default.object,
|
|
121
|
-
as: _propTypes.default.elementType,
|
|
122
|
-
// eslint-disable-line react/require-default-props
|
|
123
|
-
children: _propTypes.default.node.isRequired,
|
|
124
|
-
color: _propTypes.default.oneOf(['primary', 'success', 'danger', 'info', 'warning', 'alert']),
|
|
125
|
-
elementRef: _propTypes.default.func,
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
129
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
130
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
131
|
-
*/
|
|
132
|
-
margin: _emotion.ThemeablePropTypes.spacing
|
|
133
|
-
}, _class2.defaultProps = {
|
|
134
|
-
children: void 0,
|
|
135
|
-
margin: void 0,
|
|
136
|
-
elementRef: void 0,
|
|
120
|
+
}, _class2.displayName = "Pill", _class2.componentId = 'Pill', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
|
137
121
|
color: 'primary'
|
|
138
122
|
}, _temp)) || _class) || _class);
|
|
139
123
|
exports.Pill = Pill;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.allowedProps = exports.propTypes = void 0;
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _emotion = require("@instructure/emotion");
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* The MIT License (MIT)
|
|
16
|
+
*
|
|
17
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
18
|
+
*
|
|
19
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
20
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
21
|
+
* in the Software without restriction, including without limitation the rights
|
|
22
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
23
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
24
|
+
* furnished to do so, subject to the following conditions:
|
|
25
|
+
*
|
|
26
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
27
|
+
* copies or substantial portions of the Software.
|
|
28
|
+
*
|
|
29
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
30
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
31
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
32
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
33
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
34
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
|
+
* SOFTWARE.
|
|
36
|
+
*/
|
|
37
|
+
const propTypes = {
|
|
38
|
+
as: _propTypes.default.elementType,
|
|
39
|
+
// eslint-disable-line react/require-default-props
|
|
40
|
+
children: _propTypes.default.node.isRequired,
|
|
41
|
+
color: _propTypes.default.oneOf(['primary', 'success', 'danger', 'info', 'warning', 'alert']),
|
|
42
|
+
elementRef: _propTypes.default.func,
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
46
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
47
|
+
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
48
|
+
*/
|
|
49
|
+
margin: _emotion.ThemeablePropTypes.spacing
|
|
50
|
+
};
|
|
51
|
+
exports.propTypes = propTypes;
|
|
52
|
+
const allowedProps = ['as', 'children', 'color', 'elementRef', 'margin'];
|
|
53
|
+
exports.allowedProps = allowedProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-pill",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.9.0",
|
|
4
4
|
"description": "A UI component to communicate concise status.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -25,24 +25,24 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@babel/runtime": "^7.13.10",
|
|
28
|
-
"@instructure/console": "8.
|
|
29
|
-
"@instructure/emotion": "8.
|
|
30
|
-
"@instructure/
|
|
31
|
-
"@instructure/ui-
|
|
32
|
-
"@instructure/ui-
|
|
33
|
-
"@instructure/ui-
|
|
34
|
-
"@instructure/ui-
|
|
35
|
-
"@instructure/ui-
|
|
28
|
+
"@instructure/console": "8.9.0",
|
|
29
|
+
"@instructure/emotion": "8.9.0",
|
|
30
|
+
"@instructure/shared-types": "8.9.0",
|
|
31
|
+
"@instructure/ui-react-utils": "8.9.0",
|
|
32
|
+
"@instructure/ui-testable": "8.9.0",
|
|
33
|
+
"@instructure/ui-tooltip": "8.9.0",
|
|
34
|
+
"@instructure/ui-truncate-text": "8.9.0",
|
|
35
|
+
"@instructure/ui-utils": "8.9.0",
|
|
36
|
+
"@instructure/ui-view": "8.9.0",
|
|
36
37
|
"prop-types": "^15"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
|
-
"@instructure/
|
|
40
|
-
"@instructure/ui-
|
|
41
|
-
"@instructure/ui-
|
|
42
|
-
"@instructure/ui-test-
|
|
43
|
-
"@instructure/ui-test-
|
|
44
|
-
"@instructure/ui-
|
|
45
|
-
"@instructure/ui-themes": "8.8.1-snapshot.3+d5d6d4cd8"
|
|
40
|
+
"@instructure/ui-babel-preset": "8.9.0",
|
|
41
|
+
"@instructure/ui-color-utils": "8.9.0",
|
|
42
|
+
"@instructure/ui-test-locator": "8.9.0",
|
|
43
|
+
"@instructure/ui-test-queries": "8.9.0",
|
|
44
|
+
"@instructure/ui-test-utils": "8.9.0",
|
|
45
|
+
"@instructure/ui-themes": "8.9.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"react": ">=16.8 <=17"
|
|
@@ -50,6 +50,5 @@
|
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
|
-
"sideEffects": false
|
|
54
|
-
"gitHead": "d5d6d4cd8f300e8635c69248f5d794c002269e08"
|
|
53
|
+
"sideEffects": false
|
|
55
54
|
}
|
package/src/Pill/index.tsx
CHANGED
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
|
|
25
25
|
/** @jsx jsx */
|
|
26
26
|
import { Component } from 'react'
|
|
27
|
-
import PropTypes from 'prop-types'
|
|
28
27
|
|
|
29
28
|
import { View } from '@instructure/ui-view'
|
|
30
29
|
import { Tooltip } from '@instructure/ui-tooltip'
|
|
@@ -32,11 +31,12 @@ import { TruncateText } from '@instructure/ui-truncate-text'
|
|
|
32
31
|
import { passthroughProps } from '@instructure/ui-react-utils'
|
|
33
32
|
import { testable } from '@instructure/ui-testable'
|
|
34
33
|
|
|
35
|
-
import { withStyle, jsx
|
|
34
|
+
import { withStyle, jsx } from '@instructure/emotion'
|
|
36
35
|
|
|
37
36
|
import generateStyle from './styles'
|
|
38
37
|
import generateComponentTheme from './theme'
|
|
39
|
-
import { PillProps } from './
|
|
38
|
+
import type { PillProps } from './props'
|
|
39
|
+
import { allowedProps, propTypes } from './props'
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
---
|
|
@@ -48,34 +48,10 @@ category: components
|
|
|
48
48
|
class Pill extends Component<PillProps> {
|
|
49
49
|
static readonly componentId = 'Pill'
|
|
50
50
|
|
|
51
|
-
static
|
|
52
|
-
|
|
53
|
-
makeStyles: PropTypes.func,
|
|
54
|
-
// eslint-disable-next-line react/require-default-props
|
|
55
|
-
styles: PropTypes.object,
|
|
56
|
-
as: PropTypes.elementType, // eslint-disable-line react/require-default-props
|
|
57
|
-
children: PropTypes.node.isRequired,
|
|
58
|
-
color: PropTypes.oneOf([
|
|
59
|
-
'primary',
|
|
60
|
-
'success',
|
|
61
|
-
'danger',
|
|
62
|
-
'info',
|
|
63
|
-
'warning',
|
|
64
|
-
'alert'
|
|
65
|
-
]),
|
|
66
|
-
elementRef: PropTypes.func,
|
|
67
|
-
/**
|
|
68
|
-
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
69
|
-
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
70
|
-
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
71
|
-
*/
|
|
72
|
-
margin: ThemeablePropTypes.spacing
|
|
73
|
-
}
|
|
51
|
+
static allowedProps = allowedProps
|
|
52
|
+
static propTypes = propTypes
|
|
74
53
|
|
|
75
54
|
static defaultProps = {
|
|
76
|
-
children: undefined,
|
|
77
|
-
margin: undefined,
|
|
78
|
-
elementRef: undefined,
|
|
79
55
|
color: 'primary'
|
|
80
56
|
}
|
|
81
57
|
|
|
@@ -89,14 +65,11 @@ class Pill extends Component<PillProps> {
|
|
|
89
65
|
}
|
|
90
66
|
|
|
91
67
|
componentDidMount() {
|
|
92
|
-
|
|
93
|
-
this.props.makeStyles()
|
|
68
|
+
this.props.makeStyles?.()
|
|
94
69
|
}
|
|
95
70
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
// @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
|
|
99
|
-
this.props.makeStyles()
|
|
71
|
+
componentDidUpdate() {
|
|
72
|
+
this.props.makeStyles?.()
|
|
100
73
|
}
|
|
101
74
|
|
|
102
75
|
// @ts-expect-error ts-migrate(7006) FIXME: Parameter 'truncated' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
@@ -136,7 +109,7 @@ class Pill extends Component<PillProps> {
|
|
|
136
109
|
elementRef={elementRef}
|
|
137
110
|
margin={margin}
|
|
138
111
|
padding="0"
|
|
139
|
-
maxWidth={styles
|
|
112
|
+
maxWidth={styles?.maxWidth}
|
|
140
113
|
background="transparent"
|
|
141
114
|
borderRadius="pill"
|
|
142
115
|
borderWidth="0"
|
|
@@ -145,8 +118,8 @@ class Pill extends Component<PillProps> {
|
|
|
145
118
|
withFocusOutline={focused}
|
|
146
119
|
focusColor="info"
|
|
147
120
|
>
|
|
148
|
-
<span css={styles
|
|
149
|
-
<span css={styles
|
|
121
|
+
<span css={styles?.pill}>
|
|
122
|
+
<span css={styles?.text}>
|
|
150
123
|
<TruncateText
|
|
151
124
|
onUpdate={(truncated) => {
|
|
152
125
|
this.handleTruncation(truncated)
|
|
@@ -165,7 +138,6 @@ class Pill extends Component<PillProps> {
|
|
|
165
138
|
if (this.state.truncated) {
|
|
166
139
|
return (
|
|
167
140
|
<Tooltip renderTip={this.props.children}>
|
|
168
|
-
{/* @ts-expect-error ts-migrate(7031) FIXME: Binding element 'focused' implicitly has an 'any' ... Remove this comment to see the full error message */}
|
|
169
141
|
{({ focused, getTriggerProps }) => {
|
|
170
142
|
return this.renderPill(focused, getTriggerProps)
|
|
171
143
|
}}
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
import React from 'react'
|
|
25
|
+
import PropTypes from 'prop-types'
|
|
26
|
+
|
|
27
|
+
import { ThemeablePropTypes } from '@instructure/emotion'
|
|
28
|
+
|
|
29
|
+
import type { Spacing, WithStyleProps } from '@instructure/emotion'
|
|
30
|
+
import type { PropValidators, AsElementType } from '@instructure/shared-types'
|
|
31
|
+
|
|
32
|
+
type PillOwnProps = {
|
|
33
|
+
as?: AsElementType
|
|
34
|
+
color?: 'primary' | 'success' | 'danger' | 'info' | 'warning' | 'alert'
|
|
35
|
+
elementRef?: (...args: any[]) => any
|
|
36
|
+
margin?: Spacing
|
|
37
|
+
children: React.ReactNode
|
|
38
|
+
}
|
|
39
|
+
type PropKeys = keyof PillOwnProps
|
|
40
|
+
|
|
41
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
42
|
+
|
|
43
|
+
type PillProps = PillOwnProps & WithStyleProps
|
|
44
|
+
|
|
45
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
46
|
+
as: PropTypes.elementType, // eslint-disable-line react/require-default-props
|
|
47
|
+
children: PropTypes.node.isRequired,
|
|
48
|
+
color: PropTypes.oneOf([
|
|
49
|
+
'primary',
|
|
50
|
+
'success',
|
|
51
|
+
'danger',
|
|
52
|
+
'info',
|
|
53
|
+
'warning',
|
|
54
|
+
'alert'
|
|
55
|
+
]),
|
|
56
|
+
elementRef: PropTypes.func,
|
|
57
|
+
/**
|
|
58
|
+
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
59
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
60
|
+
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
61
|
+
*/
|
|
62
|
+
margin: ThemeablePropTypes.spacing
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const allowedProps: AllowedPropKeys = [
|
|
66
|
+
'as',
|
|
67
|
+
'children',
|
|
68
|
+
'color',
|
|
69
|
+
'elementRef',
|
|
70
|
+
'margin'
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
export type { PillProps }
|
|
74
|
+
export { propTypes, allowedProps }
|
package/src/Pill/styles.ts
CHANGED
package/src/index.ts
CHANGED
package/types/Pill/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { Component } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import { jsx } from '@instructure/emotion';
|
|
5
|
-
import { PillProps } from './
|
|
4
|
+
import type { PillProps } from './props';
|
|
6
5
|
/**
|
|
7
6
|
---
|
|
8
7
|
category: components
|
|
@@ -10,29 +9,26 @@ category: components
|
|
|
10
9
|
**/
|
|
11
10
|
declare class Pill extends Component<PillProps> {
|
|
12
11
|
static readonly componentId = "Pill";
|
|
13
|
-
static
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
12
|
+
static allowedProps: readonly (keyof {
|
|
13
|
+
as?: import("@instructure/shared-types/types/CommonProps").AsElementType | undefined;
|
|
14
|
+
color?: "primary" | "success" | "danger" | "info" | "warning" | "alert" | undefined;
|
|
15
|
+
elementRef?: ((...args: any[]) => any) | undefined;
|
|
16
|
+
margin?: import("@instructure/emotion/types/styleUtils/ThemeablePropValues").Spacing | undefined;
|
|
17
|
+
children: import("react").ReactNode;
|
|
18
|
+
})[];
|
|
19
|
+
static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
|
|
20
|
+
as?: import("@instructure/shared-types/types/CommonProps").AsElementType | undefined;
|
|
21
|
+
color?: "primary" | "success" | "danger" | "info" | "warning" | "alert" | undefined;
|
|
22
|
+
elementRef?: ((...args: any[]) => any) | undefined;
|
|
23
|
+
margin?: import("@instructure/emotion/types/styleUtils/ThemeablePropValues").Spacing | undefined;
|
|
24
|
+
children: import("react").ReactNode;
|
|
25
|
+
}>;
|
|
27
26
|
static defaultProps: {
|
|
28
|
-
children: undefined;
|
|
29
|
-
margin: undefined;
|
|
30
|
-
elementRef: undefined;
|
|
31
27
|
color: string;
|
|
32
28
|
};
|
|
33
29
|
constructor(props: any);
|
|
34
30
|
componentDidMount(): void;
|
|
35
|
-
componentDidUpdate(
|
|
31
|
+
componentDidUpdate(): void;
|
|
36
32
|
handleTruncation(truncated: any): void;
|
|
37
33
|
renderPill(focused: any, getTriggerProps: any): jsx.JSX.Element;
|
|
38
34
|
render(): jsx.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Pill/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Pill/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAQjC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAIrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAGxC;;;;GAIG;AACH,cAEM,IAAK,SAAQ,SAAS,CAAC,SAAS,CAAC;IACrC,MAAM,CAAC,QAAQ,CAAC,WAAW,UAAS;IAEpC,MAAM,CAAC,YAAY;;;;;;SAAe;IAClC,MAAM,CAAC,SAAS;;;;;;OAAY;IAE5B,MAAM,CAAC,YAAY;;MAElB;gBAGW,KAAK,KAAA;IAQjB,iBAAiB;IAIjB,kBAAkB;IAKlB,gBAAgB,CAAC,SAAS,KAAA;IAU1B,UAAU,CAAC,OAAO,KAAA,EAAE,eAAe,KAAA;IAkDnC,MAAM;CAeP;AAED,eAAe,IAAI,CAAA;AACnB,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Spacing, WithStyleProps } from '@instructure/emotion';
|
|
3
|
+
import type { PropValidators, AsElementType } from '@instructure/shared-types';
|
|
4
|
+
declare type PillOwnProps = {
|
|
5
|
+
as?: AsElementType;
|
|
6
|
+
color?: 'primary' | 'success' | 'danger' | 'info' | 'warning' | 'alert';
|
|
7
|
+
elementRef?: (...args: any[]) => any;
|
|
8
|
+
margin?: Spacing;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
declare type PropKeys = keyof PillOwnProps;
|
|
12
|
+
declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
|
|
13
|
+
declare type PillProps = PillOwnProps & WithStyleProps;
|
|
14
|
+
declare const propTypes: PropValidators<PropKeys>;
|
|
15
|
+
declare const allowedProps: AllowedPropKeys;
|
|
16
|
+
export type { PillProps };
|
|
17
|
+
export { propTypes, allowedProps };
|
|
18
|
+
//# sourceMappingURL=props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/Pill/props.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAE9E,aAAK,YAAY,GAAG;IAClB,EAAE,CAAC,EAAE,aAAa,CAAA;IAClB,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAA;IACvE,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACpC,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAAA;AACD,aAAK,QAAQ,GAAG,MAAM,YAAY,CAAA;AAElC,aAAK,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEhD,aAAK,SAAS,GAAG,YAAY,GAAG,cAAc,CAAA;AAE9C,QAAA,MAAM,SAAS,EAAE,cAAc,CAAC,QAAQ,CAkBvC,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,eAMnB,CAAA;AAED,YAAY,EAAE,SAAS,EAAE,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
|
package/types/Pill/styles.d.ts
CHANGED
package/types/index.d.ts
CHANGED
package/LICENSE.md
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: The MIT License (MIT)
|
|
3
|
-
category: Getting Started
|
|
4
|
-
order: 9
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# The MIT License (MIT)
|
|
8
|
-
|
|
9
|
-
Copyright (c) 2015 Instructure, Inc.
|
|
10
|
-
|
|
11
|
-
**Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
-
in the Software without restriction, including without limitation the rights
|
|
14
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
-
furnished to do so, subject to the following conditions.**
|
|
17
|
-
|
|
18
|
-
The above copyright notice and this permission notice shall be included in all
|
|
19
|
-
copies or substantial portions of the Software.
|
|
20
|
-
|
|
21
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
-
SOFTWARE.
|
package/es/Pill/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/Pill/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/types/Pill/types.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AsElementType } from '@instructure/shared-types';
|
|
2
|
-
import type { Spacing } from '@instructure/emotion';
|
|
3
|
-
export declare type PillProps = {
|
|
4
|
-
makeStyles?: (...args: any[]) => any;
|
|
5
|
-
styles?: any;
|
|
6
|
-
as?: AsElementType;
|
|
7
|
-
color?: 'primary' | 'success' | 'danger' | 'info' | 'warning' | 'alert';
|
|
8
|
-
elementRef?: (...args: any[]) => any;
|
|
9
|
-
margin?: Spacing;
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/Pill/types.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAEnD,oBAAY,SAAS,GAAG;IACtB,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACpC,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,EAAE,CAAC,EAAE,aAAa,CAAA;IAClB,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAA;IACvE,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACpC,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA"}
|