@instructure/ui-pill 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 (56) hide show
  1. package/CHANGELOG.md +31 -282
  2. package/es/Pill/{index.js → v1/index.js} +3 -3
  3. package/es/Pill/v2/index.js +143 -0
  4. package/es/Pill/v2/props.js +26 -0
  5. package/es/Pill/v2/styles.js +101 -0
  6. package/es/{index.js → exports/a.js} +1 -1
  7. package/{src/index.ts → es/exports/b.js} +1 -3
  8. package/lib/Pill/v1/index.js +149 -0
  9. package/lib/Pill/{index.js → v2/index.js} +5 -6
  10. package/lib/Pill/v2/props.js +31 -0
  11. package/lib/Pill/v2/styles.js +107 -0
  12. package/lib/{index.js → exports/a.js} +2 -2
  13. package/lib/exports/b.js +12 -0
  14. package/package.json +47 -25
  15. package/src/Pill/{index.tsx → v1/index.tsx} +4 -4
  16. package/src/Pill/v2/README.md +80 -0
  17. package/src/Pill/v2/index.tsx +183 -0
  18. package/src/Pill/v2/props.ts +85 -0
  19. package/src/Pill/v2/styles.ts +110 -0
  20. package/src/exports/a.ts +26 -0
  21. package/src/exports/b.ts +26 -0
  22. package/tsconfig.build.tsbuildinfo +1 -1
  23. package/types/Pill/{index.d.ts → v1/index.d.ts} +1 -1
  24. package/types/Pill/v1/index.d.ts.map +1 -0
  25. package/types/Pill/v1/props.d.ts.map +1 -0
  26. package/types/Pill/v1/styles.d.ts.map +1 -0
  27. package/types/Pill/v1/theme.d.ts.map +1 -0
  28. package/types/Pill/v2/index.d.ts +36 -0
  29. package/types/Pill/v2/index.d.ts.map +1 -0
  30. package/types/Pill/v2/props.d.ts +37 -0
  31. package/types/Pill/v2/props.d.ts.map +1 -0
  32. package/types/Pill/v2/styles.d.ts +14 -0
  33. package/types/Pill/v2/styles.d.ts.map +1 -0
  34. package/types/exports/a.d.ts +3 -0
  35. package/types/exports/a.d.ts.map +1 -0
  36. package/types/exports/b.d.ts +3 -0
  37. package/types/exports/b.d.ts.map +1 -0
  38. package/types/Pill/index.d.ts.map +0 -1
  39. package/types/Pill/props.d.ts.map +0 -1
  40. package/types/Pill/styles.d.ts.map +0 -1
  41. package/types/Pill/theme.d.ts.map +0 -1
  42. package/types/index.d.ts +0 -3
  43. package/types/index.d.ts.map +0 -1
  44. /package/es/Pill/{props.js → v1/props.js} +0 -0
  45. /package/es/Pill/{styles.js → v1/styles.js} +0 -0
  46. /package/es/Pill/{theme.js → v1/theme.js} +0 -0
  47. /package/lib/Pill/{props.js → v1/props.js} +0 -0
  48. /package/lib/Pill/{styles.js → v1/styles.js} +0 -0
  49. /package/lib/Pill/{theme.js → v1/theme.js} +0 -0
  50. /package/src/Pill/{README.md → v1/README.md} +0 -0
  51. /package/src/Pill/{props.ts → v1/props.ts} +0 -0
  52. /package/src/Pill/{styles.ts → v1/styles.ts} +0 -0
  53. /package/src/Pill/{theme.ts → v1/theme.ts} +0 -0
  54. /package/types/Pill/{props.d.ts → v1/props.d.ts} +0 -0
  55. /package/types/Pill/{styles.d.ts → v1/styles.d.ts} +0 -0
  56. /package/types/Pill/{theme.d.ts → v1/theme.d.ts} +0 -0
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@instructure/ui-pill",
3
- "version": "11.6.0",
3
+ "version": "11.6.1-snapshot-129",
4
4
  "description": "A UI component to communicate concise status.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
- "module": "./es/index.js",
7
- "main": "./lib/index.js",
8
- "types": "./types/index.d.ts",
6
+ "module": "./es/Pill/11_5/index.js",
7
+ "main": "./lib/Pill/11_5/index.js",
8
+ "types": "./types/Pill/11_5/index.d.ts",
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "https://github.com/instructure/instructure-ui.git"
@@ -15,25 +15,25 @@
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
17
  "@babel/runtime": "^7.27.6",
18
- "@instructure/console": "11.6.0",
19
- "@instructure/emotion": "11.6.0",
20
- "@instructure/ui-react-utils": "11.6.0",
21
- "@instructure/ui-tooltip": "11.6.0",
22
- "@instructure/shared-types": "11.6.0",
23
- "@instructure/ui-truncate-text": "11.6.0",
24
- "@instructure/ui-utils": "11.6.0",
25
- "@instructure/ui-view": "11.6.0"
18
+ "@instructure/console": "11.6.1-snapshot-129",
19
+ "@instructure/emotion": "11.6.1-snapshot-129",
20
+ "@instructure/ui-themes": "11.6.1-snapshot-129",
21
+ "@instructure/ui-react-utils": "11.6.1-snapshot-129",
22
+ "@instructure/shared-types": "11.6.1-snapshot-129",
23
+ "@instructure/ui-tooltip": "11.6.1-snapshot-129",
24
+ "@instructure/ui-utils": "11.6.1-snapshot-129",
25
+ "@instructure/ui-view": "11.6.1-snapshot-129",
26
+ "@instructure/ui-truncate-text": "11.6.1-snapshot-129"
26
27
  },
27
28
  "devDependencies": {
28
29
  "@testing-library/jest-dom": "^6.6.3",
29
30
  "@testing-library/react": "15.0.7",
30
31
  "vitest": "^3.2.2",
31
- "@instructure/ui-babel-preset": "11.6.0",
32
- "@instructure/ui-axe-check": "11.6.0",
33
- "@instructure/ui-color-utils": "11.6.0",
34
- "@instructure/ui-icons": "11.6.0",
35
- "@instructure/ui-scripts": "11.6.0",
36
- "@instructure/ui-themes": "11.6.0"
32
+ "@instructure/ui-axe-check": "11.6.1-snapshot-129",
33
+ "@instructure/ui-babel-preset": "11.6.1-snapshot-129",
34
+ "@instructure/ui-icons": "11.6.1-snapshot-129",
35
+ "@instructure/ui-color-utils": "11.6.1-snapshot-129",
36
+ "@instructure/ui-scripts": "11.6.1-snapshot-129"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "react": ">=18 <=19"
@@ -43,17 +43,39 @@
43
43
  },
44
44
  "sideEffects": false,
45
45
  "exports": {
46
- ".": {
47
- "types": "./types/index.d.ts",
48
- "import": "./es/index.js",
49
- "require": "./lib/index.js",
50
- "default": "./es/index.js"
51
- },
52
46
  "./lib/*": "./lib/*",
53
47
  "./es/*": "./es/*",
54
48
  "./types/*": "./types/*",
55
49
  "./package.json": "./package.json",
56
- "./src/*": "./src/*"
50
+ "./src/*": "./src/*",
51
+ ".": {
52
+ "src": "./src/exports/a.ts",
53
+ "types": "./types/exports/a.d.ts",
54
+ "import": "./es/exports/a.js",
55
+ "require": "./lib/exports/a.js",
56
+ "default": "./es/exports/a.js"
57
+ },
58
+ "./v11_6": {
59
+ "src": "./src/exports/a.ts",
60
+ "types": "./types/exports/a.d.ts",
61
+ "import": "./es/exports/a.js",
62
+ "require": "./lib/exports/a.js",
63
+ "default": "./es/exports/a.js"
64
+ },
65
+ "./v11_7": {
66
+ "src": "./src/exports/b.ts",
67
+ "types": "./types/exports/b.d.ts",
68
+ "import": "./es/exports/b.js",
69
+ "require": "./lib/exports/b.js",
70
+ "default": "./es/exports/b.js"
71
+ },
72
+ "./latest": {
73
+ "src": "./src/exports/b.ts",
74
+ "types": "./types/exports/b.d.ts",
75
+ "import": "./es/exports/b.js",
76
+ "require": "./lib/exports/b.js",
77
+ "default": "./es/exports/b.js"
78
+ }
57
79
  },
58
80
  "scripts": {
59
81
  "lint": "ui-scripts lint",
@@ -24,12 +24,12 @@
24
24
 
25
25
  import { Component } from 'react'
26
26
 
27
- import { View } from '@instructure/ui-view'
27
+ import { View } from '@instructure/ui-view/v11_6'
28
28
  import { passthroughProps } from '@instructure/ui-react-utils'
29
- import { Tooltip } from '@instructure/ui-tooltip'
30
- import type { TooltipRenderChildrenArgs } from '@instructure/ui-tooltip'
29
+ import { Tooltip } from '@instructure/ui-tooltip/v11_6'
30
+ import type { TooltipRenderChildrenArgs } from '@instructure/ui-tooltip/v11_6'
31
31
 
32
- import { withStyle } from '@instructure/emotion'
32
+ import { withStyleLegacy as withStyle } from '@instructure/emotion'
33
33
 
34
34
  import generateStyle from './styles'
35
35
  import generateComponentTheme from './theme'
@@ -0,0 +1,80 @@
1
+ ---
2
+ describes: Pill
3
+ ---
4
+
5
+ Displays short, contextual information about an item. Change the border
6
+ and text color via the `color` prop. Use the `margin` prop to add space around
7
+ the component. Use the `renderIcon` prop to add an icon to the left of the text. Additionally,
8
+ you can use the `statusLabel` prop to add a label to the left of the main text.
9
+
10
+ ```js
11
+ ---
12
+ type: example
13
+ ---
14
+ <div>
15
+ <Pill
16
+ margin="x-small"
17
+ >
18
+ Excused
19
+ </Pill>
20
+ <Pill
21
+ statusLabel="Status"
22
+ color="info"
23
+ margin="x-small"
24
+ >
25
+ Draft
26
+ </Pill>
27
+ <Pill
28
+ statusLabel="Status"
29
+ renderIcon={<CheckInstUIIcon size="sm" />}
30
+ color="success"
31
+ margin="x-small"
32
+ >
33
+ Checked In
34
+ </Pill>
35
+ <Pill
36
+ renderIcon={<Clock4InstUIIcon size="sm" />}
37
+ color="warning"
38
+ margin="x-small"
39
+ >
40
+ Late
41
+ </Pill>
42
+ <Pill
43
+ renderIcon={<MailInstUIIcon size="sm" />}
44
+ color="error"
45
+ margin="x-small"
46
+ >
47
+ Notification
48
+ </Pill>
49
+ </div>
50
+ ```
51
+
52
+ The component has a `max-width`, set by its theme. Any overflowing text will be handled via ellipses.
53
+
54
+ > **DEPRECATED** Please do not make Pills that have overflowing text, it's an a11y anti-pattern. The issue is if text overflows it cannot be read by keyboard-only users. We could make the Pill focusable, but that would be an anti-pattern too because only elements that are interactive should be focusable (and just displaying a tooltip is not a real interaction)
55
+
56
+ ```js
57
+ ---
58
+ type: example
59
+ ---
60
+ <Pill>
61
+ Supercalifragilisticexpialidocious bear
62
+ </Pill>
63
+ ```
64
+
65
+ ### Guidelines
66
+
67
+ ```js
68
+ ---
69
+ type: embed
70
+ ---
71
+ <Guidelines>
72
+ <Figure recommendation="no" title="Don't">
73
+ <Figure.Item>Use more than 2 words for the main text</Figure.Item>
74
+ <Figure.Item>Use more than 2 words for the statusLabel</Figure.Item>
75
+ <Figure.Item>Use for dismissible items (use a <Link href="/#Tag">Tag</Link> instead)</Figure.Item>
76
+ <Figure.Item>Use for counts (use a <Link href="/#Badge">Badge</Link> instead)</Figure.Item>
77
+ <Figure.Item>Put actions next to the text</Figure.Item>
78
+ </Figure>
79
+ </Guidelines>
80
+ ```
@@ -0,0 +1,183 @@
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 { Component } from 'react'
26
+
27
+ import { View } from '@instructure/ui-view/latest'
28
+ import { passthroughProps } from '@instructure/ui-react-utils'
29
+ import { Tooltip } from '@instructure/ui-tooltip/latest'
30
+ import type { TooltipRenderChildrenArgs } from '@instructure/ui-tooltip/latest'
31
+
32
+ import { withStyle } from '@instructure/emotion'
33
+
34
+ import generateStyle from './styles'
35
+
36
+ import type { PillProps, PillState } from './props'
37
+ import { allowedProps } from './props'
38
+
39
+ /**
40
+ ---
41
+ category: components
42
+ ---
43
+ **/
44
+
45
+ @withStyle(generateStyle)
46
+ class Pill extends Component<PillProps, PillState> {
47
+ static readonly componentId = 'Pill'
48
+
49
+ static allowedProps = allowedProps
50
+
51
+ static defaultProps = {
52
+ color: 'primary'
53
+ }
54
+
55
+ ref: Element | null = null
56
+
57
+ ellipsisRef: HTMLElement | null = null
58
+
59
+ constructor(props: PillProps) {
60
+ super(props)
61
+
62
+ this.state = {
63
+ truncated: false
64
+ }
65
+ }
66
+
67
+ componentDidMount() {
68
+ this.setTruncation()
69
+ this.props.makeStyles?.()
70
+ }
71
+
72
+ componentDidUpdate() {
73
+ this.props.makeStyles?.()
74
+ }
75
+
76
+ setTruncation() {
77
+ if (this.ellipsisRef) {
78
+ this.setState({
79
+ truncated: this.ellipsisRef.offsetWidth < this.ellipsisRef.scrollWidth
80
+ })
81
+ }
82
+ }
83
+
84
+ handleRef = (el: Element | null) => {
85
+ const { elementRef } = this.props
86
+
87
+ this.ref = el
88
+
89
+ if (typeof elementRef === 'function') {
90
+ elementRef(el)
91
+ }
92
+ }
93
+
94
+ renderPill(
95
+ focused?: TooltipRenderChildrenArgs['focused'],
96
+ getTriggerProps?: TooltipRenderChildrenArgs['getTriggerProps']
97
+ ) {
98
+ const {
99
+ margin,
100
+ children,
101
+ color,
102
+ as,
103
+ elementRef,
104
+ styles,
105
+ makeStyles,
106
+ statusLabel,
107
+ renderIcon,
108
+ ...props
109
+ } = this.props
110
+
111
+ const filteredProps = passthroughProps(props)
112
+
113
+ const containerProps =
114
+ typeof getTriggerProps === 'function'
115
+ ? getTriggerProps(filteredProps)
116
+ : filteredProps
117
+
118
+ const refProp = this.state.truncated ? {} : { elementRef: this.handleRef }
119
+ return (
120
+ <View
121
+ {...containerProps}
122
+ as={as}
123
+ {...refProp}
124
+ margin={margin}
125
+ padding="0"
126
+ maxWidth={styles?.maxWidth as string}
127
+ background="transparent"
128
+ borderRadius="pill"
129
+ borderWidth="0"
130
+ display="inline-block"
131
+ position="relative"
132
+ withFocusOutline={focused}
133
+ focusColor="info"
134
+ data-cid="Pill"
135
+ >
136
+ <div css={styles?.pill}>
137
+ {renderIcon && <div css={styles?.icon}>{renderIcon}</div>}
138
+ <div
139
+ css={styles?.text}
140
+ ref={(el) => {
141
+ this.ellipsisRef = el
142
+ }}
143
+ >
144
+ {statusLabel && (
145
+ <span css={styles?.status}>
146
+ {statusLabel && statusLabel.concat(':')}
147
+ </span>
148
+ )}
149
+ {children}
150
+ </div>
151
+ </div>
152
+ </View>
153
+ )
154
+ }
155
+
156
+ render() {
157
+ if (this.state.truncated) {
158
+ return (
159
+ <Tooltip
160
+ renderTip={
161
+ this.props.statusLabel
162
+ ? this.props.statusLabel.concat(
163
+ ': ',
164
+ this.props.children as string
165
+ )
166
+ : this.props.children
167
+ }
168
+ elementRef={this.handleRef}
169
+ >
170
+ {({ focused, getTriggerProps }) => {
171
+ return this.renderPill(focused, getTriggerProps)
172
+ }}
173
+ </Tooltip>
174
+ )
175
+ } else {
176
+ return this.renderPill()
177
+ }
178
+ }
179
+ }
180
+
181
+ export default Pill
182
+ export { Pill }
183
+ export type { PillProps }
@@ -0,0 +1,85 @@
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 type {
26
+ Spacing,
27
+ WithStyleProps,
28
+ ComponentStyle
29
+ } from '@instructure/emotion'
30
+ import type {
31
+ AsElementType,
32
+ PillTheme,
33
+ OtherHTMLAttributes
34
+ } from '@instructure/shared-types'
35
+
36
+ type PillOwnProps = {
37
+ as?: AsElementType
38
+ color?: 'primary' | 'success' | 'info' | 'warning' | 'error'
39
+ /**
40
+ * Provides a reference to the underlying HTML element
41
+ */
42
+ elementRef?: (element: Element | null) => void
43
+ /**
44
+ * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
45
+ * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
46
+ * familiar CSS-like shorthand. For example: `margin="small auto large"`.
47
+ */
48
+ margin?: Spacing
49
+ children: React.ReactNode
50
+
51
+ /**
52
+ * Adds a status label to the left of the main text.
53
+ */
54
+ statusLabel?: string
55
+
56
+ /**
57
+ * An icon displayed to the left of the text.
58
+ */
59
+ renderIcon?: React.ReactNode
60
+ }
61
+ type PropKeys = keyof PillOwnProps
62
+
63
+ type AllowedPropKeys = Readonly<Array<PropKeys>>
64
+
65
+ type PillProps = PillOwnProps &
66
+ WithStyleProps<PillTheme, PillStyle> &
67
+ OtherHTMLAttributes<PillOwnProps>
68
+
69
+ type PillStyle = ComponentStyle<
70
+ 'pill' | 'text' | 'maxWidth' | 'status' | 'icon'
71
+ >
72
+ const allowedProps: AllowedPropKeys = [
73
+ 'as',
74
+ 'children',
75
+ 'color',
76
+ 'elementRef',
77
+ 'margin'
78
+ ]
79
+
80
+ type PillState = {
81
+ truncated: boolean
82
+ }
83
+
84
+ export type { PillProps, PillStyle, PillState }
85
+ export { allowedProps }
@@ -0,0 +1,110 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import type { NewComponentTypes } from '@instructure/ui-themes'
26
+ import type { PillProps, PillStyle } from './props'
27
+
28
+ /**
29
+ * ---
30
+ * private: true
31
+ * ---
32
+ * Generates the style object from the theme and provided additional information
33
+ * @param {Object} componentTheme The theme variable object.
34
+ * @param {Object} props the props of the component, the style is applied to
35
+ * @return {Object} The final style object, which will be used in the component
36
+ */
37
+ const generateStyle = (
38
+ componentTheme: NewComponentTypes['Pill'],
39
+ props: PillProps
40
+ ): PillStyle => {
41
+ const { color } = props
42
+
43
+ const pillColorVariants = {
44
+ primary: {
45
+ color: componentTheme.baseTextColor,
46
+ borderColor: componentTheme.baseBorderColor
47
+ },
48
+ success: {
49
+ color: componentTheme.successTextColor,
50
+ borderColor: componentTheme.successBorderColor
51
+ },
52
+ info: {
53
+ color: componentTheme.infoTextColor,
54
+ borderColor: componentTheme.infoBorderColor
55
+ },
56
+ warning: {
57
+ color: componentTheme.warningTextColor,
58
+ borderColor: componentTheme.warningBorderColor
59
+ },
60
+ error: {
61
+ color: componentTheme.errorTextColor,
62
+ borderColor: componentTheme.errorBorderColor
63
+ }
64
+ }
65
+
66
+ return {
67
+ pill: {
68
+ label: 'pill',
69
+ display: 'flex',
70
+ alignItems: 'center',
71
+ boxSizing: 'border-box',
72
+ padding: `0 ${componentTheme.paddingHorizontal}`,
73
+ background: componentTheme.backgroundColor,
74
+ borderWidth: componentTheme.borderWidth,
75
+ borderStyle: componentTheme.borderStyle,
76
+ borderRadius: componentTheme.borderRadius,
77
+ fontFamily: componentTheme.fontFamily,
78
+ height: componentTheme.height,
79
+ lineHeight: componentTheme.lineHeight,
80
+ ...pillColorVariants[color!]
81
+ },
82
+ status: {
83
+ label: 'pill__status',
84
+ boxSizing: 'border-box',
85
+ fontSize: componentTheme.textFontSize,
86
+ fontWeight: componentTheme.statusLabelFontWeight,
87
+ marginRight: '0.125rem'
88
+ },
89
+ icon: {
90
+ label: 'pill__icon',
91
+ display: 'flex',
92
+ alignItems: 'center',
93
+ marginRight: '0.375rem',
94
+ fontSize: '0.75rem'
95
+ },
96
+ text: {
97
+ label: 'pill__text',
98
+ boxSizing: 'border-box',
99
+ maxWidth: componentTheme.maxWidth,
100
+ fontSize: componentTheme.textFontSize,
101
+ fontWeight: componentTheme.textFontWeight,
102
+ textOverflow: 'ellipsis',
103
+ whiteSpace: 'nowrap',
104
+ overflow: 'hidden'
105
+ },
106
+ maxWidth: componentTheme.maxWidth
107
+ }
108
+ }
109
+
110
+ export default generateStyle
@@ -0,0 +1,26 @@
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
+ export { Pill } from '../Pill/v1'
26
+ export type { PillProps } from '../Pill/v1/props'
@@ -0,0 +1,26 @@
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
+ export { Pill } from '../Pill/v2'
26
+ export type { PillProps } from '../Pill/v2/props'