@planningcenter/tapestry-react 2.0.1-rc.0 → 2.1.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/dist/cjs/Avatar/Avatar.js +3 -1
- package/dist/cjs/Box/Box.js +2 -2
- package/dist/cjs/Button/Button.js +2 -2
- package/dist/cjs/Calendar/Day.js +1 -0
- package/dist/cjs/Card/Card.js +14 -24
- package/dist/cjs/Card/Section.js +28 -0
- package/dist/cjs/Checkbox/Checkbox.js +1 -1
- package/dist/cjs/Collapse/Collapse.js +10 -9
- package/dist/cjs/Collapse/Collapse.test.js +56 -0
- package/dist/cjs/DataTable/components/Icon.js +4 -4
- package/dist/cjs/DragDrop/DragDrop.js +1 -1
- package/dist/cjs/GridView/GridView.js +2 -2
- package/dist/cjs/HelperDrawer/HelperDrawer.js +8 -8
- package/dist/cjs/Icon/Path.js +1 -0
- package/dist/cjs/Icon/Status.js +24 -17
- package/dist/cjs/Pagination/Pagination.js +99 -83
- package/dist/cjs/Select/Inline.js +1 -0
- package/dist/cjs/Select/Option.js +1 -1
- package/dist/cjs/Select/OptionGroup.js +1 -3
- package/dist/cjs/Select/Value.js +1 -0
- package/dist/cjs/Select/constants.js +2 -2
- package/dist/cjs/Sidebar/Sidebar.js +5 -5
- package/dist/cjs/Spinner/Spinner.js +3 -3
- package/dist/cjs/StackView/StackView.js +2 -2
- package/dist/cjs/Table/Table.js +2 -2
- package/dist/cjs/Text/Text.js +2 -2
- package/dist/cjs/ThemeProvider/ThemeProvider.js +4 -18
- package/dist/cjs/TileView/TileView.js +2 -2
- package/dist/cjs/system/box-sizes.js +6 -3
- package/dist/cjs/system/use-css.js +2 -2
- package/dist/cjs/system/utils.js +2 -2
- package/dist/esm/Avatar/Avatar.js +3 -3
- package/dist/esm/Box/Box.js +1 -1
- package/dist/esm/Button/Button.js +2 -2
- package/dist/esm/Calendar/Day.js +1 -0
- package/dist/esm/Card/Card.js +12 -22
- package/dist/esm/Card/Section.js +15 -0
- package/dist/esm/Checkbox/Checkbox.js +1 -1
- package/dist/esm/Collapse/Collapse.js +3 -2
- package/dist/esm/Collapse/Collapse.test.js +53 -0
- package/dist/esm/DataTable/components/Icon.js +1 -1
- package/dist/esm/DragDrop/DragDrop.js +1 -1
- package/dist/esm/GridView/GridView.js +1 -1
- package/dist/esm/HelperDrawer/HelperDrawer.js +1 -1
- package/dist/esm/Icon/Path.js +1 -0
- package/dist/esm/Icon/Status.js +24 -17
- package/dist/esm/Pagination/Pagination.js +96 -78
- package/dist/esm/Select/Inline.js +1 -0
- package/dist/esm/Select/Option.js +1 -1
- package/dist/esm/Select/OptionGroup.js +1 -2
- package/dist/esm/Select/Value.js +1 -0
- package/dist/esm/Select/constants.js +2 -2
- package/dist/esm/Sidebar/Sidebar.js +1 -1
- package/dist/esm/Spinner/Spinner.js +1 -1
- package/dist/esm/StackView/StackView.js +1 -1
- package/dist/esm/Table/Table.js +1 -1
- package/dist/esm/Text/Text.js +1 -1
- package/dist/esm/ThemeProvider/ThemeProvider.js +3 -15
- package/dist/esm/TileView/TileView.js +1 -1
- package/dist/esm/system/box-sizes.js +6 -3
- package/dist/esm/system/use-css.js +1 -1
- package/dist/esm/system/utils.js +1 -1
- package/dist/types/Avatar/Avatar.d.ts +19 -0
- package/dist/types/Box/Box.d.ts +5 -2
- package/dist/types/Button/Button.d.ts +22 -14
- package/dist/types/Button/Input.d.ts +1 -1
- package/dist/types/Card/Card.d.ts +2 -8
- package/dist/types/Card/Section.d.ts +11 -0
- package/dist/types/ChurchCenterStatus/ChurchCenterStatus.d.ts +0 -1
- package/dist/types/Collapse/Collapse.test.d.ts +1 -0
- package/dist/types/Divider/Divider.d.ts +0 -1
- package/dist/types/FilterLayout/FilterLayout.d.ts +0 -1
- package/dist/types/GridView/GridView.d.ts +4 -1
- package/dist/types/Pagination/Pagination.d.ts +23 -0
- package/dist/types/Popover/Popover.d.ts +3 -3
- package/dist/types/Portal/Portal.d.ts +4 -3
- package/dist/types/Spinner/Spinner.d.ts +0 -1
- package/dist/types/StackView/StackView.d.ts +4 -1
- package/dist/types/Tab/Tab.d.ts +0 -1
- package/dist/types/Text/Text.d.ts +4 -1
- package/dist/types/TileView/TileView.d.ts +4 -1
- package/package.json +12 -15
- package/src/Avatar/Avatar.mdx +2 -2
- package/src/Avatar/{Avatar.js → Avatar.tsx} +10 -5
- package/src/Badge/Badge.mdx +2 -0
- package/src/Badge/Status.mdx +1 -0
- package/src/Box/Box.tsx +2 -1
- package/src/Button/Button.mdx +1 -0
- package/src/Button/Button.tsx +13 -5
- package/src/Button/Input.mdx +1 -0
- package/src/Calendar/Calendar.mdx +1 -0
- package/src/Calendar/Day.js +42 -2
- package/src/Calendar/Day.mdx +6 -0
- package/src/Card/Card.mdx +1 -10
- package/src/Card/Card.tsx +8 -16
- package/src/Card/Section.mdx +19 -0
- package/src/Card/Section.tsx +25 -0
- package/src/Checkbox/Checkbox.js +1 -1
- package/src/Collapse/Collapse.js +5 -2
- package/src/Collapse/Collapse.test.tsx +42 -0
- package/src/Combobox/Combobox.mdx +1 -1
- package/src/DataTable/components/Icon.js +1 -1
- package/src/DragDrop/DragDrop.js +1 -1
- package/src/Drawer/Drawer.mdx +1 -0
- package/src/EditActions/EditActions.mdx +1 -0
- package/src/FieldSet/FieldSet.mdx +1 -0
- package/src/GridView/GridView.tsx +1 -1
- package/src/HeadingUppercase/HeadingUppercase.mdx +1 -0
- package/src/HelperDrawer/HelperDrawer.js +1 -1
- package/src/Highlight/Highlight.mdx +1 -0
- package/src/Icon/Icon.mdx +65 -35
- package/src/Icon/Path.js +2 -0
- package/src/Icon/Path.mdx +34 -0
- package/src/Icon/Status.js +23 -14
- package/src/Icon/Status.mdx +17 -0
- package/src/Input/Inline.mdx +1 -0
- package/src/Input/Input.mdx +1 -0
- package/src/Input/InputBox.mdx +1 -0
- package/src/Input/InputField.mdx +1 -0
- package/src/Input/InputLabel.mdx +1 -0
- package/src/PagerView/PagerView.mdx +1 -1
- package/src/Pagination/Pagination.mdx +0 -1
- package/src/Pagination/Pagination.tsx +163 -0
- package/src/Popover/Popover.tsx +1 -1
- package/src/Portal/Portal.tsx +2 -0
- package/src/Progress/Progress.mdx +1 -0
- package/src/RangeSlider/RangeSlider.mdx +1 -0
- package/src/Scrim/Scrim.tsx +2 -2
- package/src/Section/Section.mdx +1 -0
- package/src/Select/Inline.js +21 -1
- package/src/Select/Inline.mdx +27 -0
- package/src/Select/Option.js +1 -1
- package/src/Select/Option.mdx +30 -0
- package/src/Select/OptionGroup.js +9 -3
- package/src/Select/OptionGroup.mdx +25 -0
- package/src/Select/Select.mdx +2 -99
- package/src/Select/Value.js +2 -0
- package/src/Select/Value.mdx +67 -0
- package/src/Select/constants.js +2 -2
- package/src/Sidebar/Sidebar.js +1 -1
- package/src/Spinner/Spinner.mdx +1 -0
- package/src/Spinner/Spinner.tsx +1 -1
- package/src/StackView/StackView.tsx +1 -1
- package/src/StepperField/StepperField.mdx +1 -0
- package/src/StepperProgress/StepperProgress.mdx +1 -0
- package/src/Table/Table.js +1 -1
- package/src/Text/Text.mdx +1 -0
- package/src/Text/Text.tsx +1 -1
- package/src/ThemeProvider/ThemeProvider.tsx +2 -13
- package/src/TileView/TileView.tsx +1 -1
- package/src/system/README.md +1 -1
- package/src/system/box-sizes.js +6 -3
- package/src/system/use-css.js +1 -1
- package/src/system/utils.js +1 -1
- package/src/Pagination/Pagination.js +0 -145
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Select.Value
|
|
3
|
+
category: Forms
|
|
4
|
+
summary: Composes [Text](/text) and allows for styling selected values within the [Select](/select). (Out-of-the-box it provides truncation.)
|
|
5
|
+
propsSummary: Accepts [Text](/text) props.
|
|
6
|
+
parent: Select
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
```jsx live
|
|
10
|
+
const options = [
|
|
11
|
+
{
|
|
12
|
+
title: 'Arrangement Files',
|
|
13
|
+
options: [
|
|
14
|
+
{
|
|
15
|
+
label: 'Chord Chart + → Lyrics & Chords',
|
|
16
|
+
type: 'TXT',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: 'Lead Sheet',
|
|
20
|
+
type: 'PDF',
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
title: 'E (Most Common)',
|
|
26
|
+
options: [
|
|
27
|
+
{
|
|
28
|
+
label: 'E Chord Chart +',
|
|
29
|
+
type: 'PDF',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
title: 'Ab',
|
|
35
|
+
options: [
|
|
36
|
+
{
|
|
37
|
+
label: 'Ab Chord Chart +',
|
|
38
|
+
type: 'PDF',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
]
|
|
43
|
+
render(
|
|
44
|
+
<Select
|
|
45
|
+
multiple
|
|
46
|
+
renderValue={(selectedOptions) => (
|
|
47
|
+
<Select.Value>
|
|
48
|
+
{selectedOptions.map((option) => option.value).join(', ')}
|
|
49
|
+
</Select.Value>
|
|
50
|
+
)}
|
|
51
|
+
style={{ maxWidth: 400 }}
|
|
52
|
+
>
|
|
53
|
+
{options.map((optgroup) => (
|
|
54
|
+
<Select.OptionGroup key={optgroup.title} title={optgroup.title}>
|
|
55
|
+
{optgroup.options.map((option) => (
|
|
56
|
+
<Select.Option key={option.label} value={option.label}>
|
|
57
|
+
<Text marginRight={2}>{option.label}</Text>
|
|
58
|
+
<Badge size="xs" marginLeft="auto">
|
|
59
|
+
{option.type}
|
|
60
|
+
</Badge>
|
|
61
|
+
</Select.Option>
|
|
62
|
+
))}
|
|
63
|
+
</Select.OptionGroup>
|
|
64
|
+
))}
|
|
65
|
+
</Select>
|
|
66
|
+
)
|
|
67
|
+
```
|
package/src/Select/constants.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export const SELECT_DISPLAY_NAME = 'Select'
|
|
2
|
-
export const OPTIONGROUP_DISPLAY_NAME = 'OptionGroup'
|
|
3
|
-
export const OPTION_DISPLAY_NAME = 'Option'
|
|
2
|
+
export const OPTIONGROUP_DISPLAY_NAME = 'Select.OptionGroup'
|
|
3
|
+
export const OPTION_DISPLAY_NAME = 'Select.Option'
|
package/src/Sidebar/Sidebar.js
CHANGED
package/src/Spinner/Spinner.mdx
CHANGED
package/src/Spinner/Spinner.tsx
CHANGED
package/src/Table/Table.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import React, { PureComponent, Children, Fragment } from 'react'
|
|
3
|
-
import { Global } from '@emotion/
|
|
3
|
+
import { Global } from '@emotion/react'
|
|
4
4
|
import { camelCase, snakeCase } from 'lodash'
|
|
5
5
|
|
|
6
6
|
import type { PaginationProps } from '../Pagination/Pagination'
|
package/src/Text/Text.mdx
CHANGED
package/src/Text/Text.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useLayoutEffect, useState } from 'react'
|
|
2
|
-
import { ThemeProvider as EmotionThemeProvider } from 'emotion
|
|
3
|
-
import { CacheProvider } from '@emotion/
|
|
2
|
+
import { ThemeProvider as EmotionThemeProvider } from '@emotion/react'
|
|
3
|
+
import { CacheProvider } from '@emotion/react'
|
|
4
4
|
import createCache from '@emotion/cache'
|
|
5
5
|
import { merge } from 'lodash'
|
|
6
6
|
|
|
@@ -14,17 +14,6 @@ const STORAGE_KEY = 'tapestry-react-theme'
|
|
|
14
14
|
|
|
15
15
|
export const cache = createCache({
|
|
16
16
|
key: 'tapestry-react',
|
|
17
|
-
prefix: (key) => {
|
|
18
|
-
switch (key) {
|
|
19
|
-
case 'appearance':
|
|
20
|
-
case 'user-select':
|
|
21
|
-
case 'position':
|
|
22
|
-
case ':placeholder':
|
|
23
|
-
return true
|
|
24
|
-
default:
|
|
25
|
-
return false
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
17
|
})
|
|
29
18
|
|
|
30
19
|
export const themeStorage = {
|
package/src/system/README.md
CHANGED
|
@@ -41,7 +41,7 @@ function Box(props) {
|
|
|
41
41
|
|
|
42
42
|
<small>See the [Box](../Box/Box.tsx) component for an actual implementation.</small>
|
|
43
43
|
|
|
44
|
-
The `splitStyles` function will also process any `mediaQueries` and `variants` props that are defined. See [Responsive](https://
|
|
44
|
+
The `splitStyles` function will also process any `mediaQueries` and `variants` props that are defined. See [Responsive](https://planningcenter.github.io/tapestry-react/responsive) and [Variants](https://planningcenter.github.io/tapestry-react/variants) for more information and examples.
|
|
45
45
|
|
|
46
46
|
### Plugins
|
|
47
47
|
|
package/src/system/box-sizes.js
CHANGED
|
@@ -18,7 +18,7 @@ export const boxSizes = {
|
|
|
18
18
|
radius: 3,
|
|
19
19
|
},
|
|
20
20
|
md: {
|
|
21
|
-
boxSize: 4,
|
|
21
|
+
boxSize: 4.5,
|
|
22
22
|
fontSize: 4,
|
|
23
23
|
lineHeight: 3,
|
|
24
24
|
paddingHorizontalDense: 1,
|
|
@@ -27,7 +27,7 @@ export const boxSizes = {
|
|
|
27
27
|
radius: 4,
|
|
28
28
|
},
|
|
29
29
|
lg: {
|
|
30
|
-
boxSize:
|
|
30
|
+
boxSize: 6,
|
|
31
31
|
fontSize: 3,
|
|
32
32
|
lineHeight: 4,
|
|
33
33
|
paddingHorizontalDense: 1,
|
|
@@ -36,7 +36,7 @@ export const boxSizes = {
|
|
|
36
36
|
radius: 5,
|
|
37
37
|
},
|
|
38
38
|
xl: {
|
|
39
|
-
boxSize:
|
|
39
|
+
boxSize: 9,
|
|
40
40
|
fontSize: 1,
|
|
41
41
|
lineHeight: 5,
|
|
42
42
|
paddingHorizontalDense: 2,
|
|
@@ -44,6 +44,9 @@ export const boxSizes = {
|
|
|
44
44
|
paddingVertical: 1.5,
|
|
45
45
|
radius: 6,
|
|
46
46
|
},
|
|
47
|
+
xxl: {
|
|
48
|
+
boxSize: 14,
|
|
49
|
+
},
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
export function getBoxSize(size = 'md') {
|
package/src/system/use-css.js
CHANGED
package/src/system/utils.js
CHANGED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
import React, { Component } from 'react'
|
|
3
|
-
|
|
4
|
-
import Box from '../Box'
|
|
5
|
-
import Button from '../Button'
|
|
6
|
-
import StackView from '../StackView'
|
|
7
|
-
import { range } from '../utils'
|
|
8
|
-
|
|
9
|
-
function getVisiblePages(currentPage, totalPages, visiblePages) {
|
|
10
|
-
const start = Math.max(
|
|
11
|
-
1,
|
|
12
|
-
Math.min(totalPages - visiblePages + 1, currentPage - visiblePages / 2 + 1)
|
|
13
|
-
)
|
|
14
|
-
const stop = Math.min(totalPages, start + visiblePages - 1)
|
|
15
|
-
const primaryWindow = range(start, stop + 1)
|
|
16
|
-
const showFirstPage = start > 1
|
|
17
|
-
const showLastPage = stop < totalPages
|
|
18
|
-
|
|
19
|
-
if (showFirstPage) {
|
|
20
|
-
primaryWindow.shift()
|
|
21
|
-
primaryWindow.shift()
|
|
22
|
-
}
|
|
23
|
-
if (showLastPage) {
|
|
24
|
-
primaryWindow.pop()
|
|
25
|
-
primaryWindow.pop()
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const first = showFirstPage ? [1, '...'] : []
|
|
29
|
-
const last = showLastPage ? ['...', totalPages] : []
|
|
30
|
-
return first.concat(primaryWindow).concat(last)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export type PaginationProps = {
|
|
34
|
-
/**
|
|
35
|
-
* Change the color of the active page
|
|
36
|
-
*/
|
|
37
|
-
activeColor: string,
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Current visible page number
|
|
41
|
-
*/
|
|
42
|
-
currentPage: number,
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Callback when new page is requested
|
|
46
|
-
*/
|
|
47
|
-
onPageChange: (nextPage: number) => undefined,
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Total available pages
|
|
51
|
-
*/
|
|
52
|
-
totalPages: number,
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Amount of visible pages
|
|
56
|
-
*/
|
|
57
|
-
visiblePages?: number,
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
class Pagination extends Component<PaginationProps> {
|
|
61
|
-
static defaultProps = {
|
|
62
|
-
activeColor: 'primary',
|
|
63
|
-
onPageChange: () => null,
|
|
64
|
-
visiblePages: 8,
|
|
65
|
-
totalPages: 0,
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
renderGap(key) {
|
|
69
|
-
return <Box key={key} userSelect="none" cursor="default" children="…" />
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
renderPageLink(number) {
|
|
73
|
-
const isActive = this.props.currentPage === number
|
|
74
|
-
return (
|
|
75
|
-
<Button
|
|
76
|
-
key={number}
|
|
77
|
-
onClick={this.props.onPageChange.bind(null, number)}
|
|
78
|
-
theme={isActive ? this.props.activeColor : undefined}
|
|
79
|
-
variant={isActive ? 'fill' : 'naked'}
|
|
80
|
-
title={number}
|
|
81
|
-
shrink={0}
|
|
82
|
-
square
|
|
83
|
-
/>
|
|
84
|
-
)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
renderPageLinks() {
|
|
88
|
-
const pages = getVisiblePages(
|
|
89
|
-
this.props.currentPage,
|
|
90
|
-
this.props.totalPages,
|
|
91
|
-
this.props.visiblePages
|
|
92
|
-
)
|
|
93
|
-
return pages.map((page, index) =>
|
|
94
|
-
page === '...' ? this.renderGap(page + index) : this.renderPageLink(page)
|
|
95
|
-
)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
render() {
|
|
99
|
-
const {
|
|
100
|
-
activeColor,
|
|
101
|
-
currentPage,
|
|
102
|
-
totalPages,
|
|
103
|
-
visiblePages,
|
|
104
|
-
onPageChange,
|
|
105
|
-
...restProps
|
|
106
|
-
} = this.props
|
|
107
|
-
|
|
108
|
-
if (totalPages <= 1) {
|
|
109
|
-
return null
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return (
|
|
113
|
-
<StackView
|
|
114
|
-
axis="horizontal"
|
|
115
|
-
alignment="center"
|
|
116
|
-
distribution="center"
|
|
117
|
-
width="100%"
|
|
118
|
-
paddingVertical={1}
|
|
119
|
-
shrink={0}
|
|
120
|
-
overflow="auto"
|
|
121
|
-
{...restProps}
|
|
122
|
-
>
|
|
123
|
-
<Button
|
|
124
|
-
onClick={onPageChange.bind(null, currentPage - 1)}
|
|
125
|
-
disabled={currentPage === 1}
|
|
126
|
-
icon={{ name: 'general.leftChevron', size: 'xs' }}
|
|
127
|
-
tooltip={{ title: 'Previous Page' }}
|
|
128
|
-
variant="naked"
|
|
129
|
-
shrink={0}
|
|
130
|
-
/>
|
|
131
|
-
{this.renderPageLinks()}
|
|
132
|
-
<Button
|
|
133
|
-
onClick={onPageChange.bind(null, currentPage + 1)}
|
|
134
|
-
disabled={currentPage === totalPages}
|
|
135
|
-
icon={{ name: 'general.rightChevron', size: 'xs' }}
|
|
136
|
-
tooltip={{ title: 'Next Page' }}
|
|
137
|
-
variant="naked"
|
|
138
|
-
shrink={0}
|
|
139
|
-
/>
|
|
140
|
-
</StackView>
|
|
141
|
-
)
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export default Pagination
|