@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.
Files changed (155) hide show
  1. package/dist/cjs/Avatar/Avatar.js +3 -1
  2. package/dist/cjs/Box/Box.js +2 -2
  3. package/dist/cjs/Button/Button.js +2 -2
  4. package/dist/cjs/Calendar/Day.js +1 -0
  5. package/dist/cjs/Card/Card.js +14 -24
  6. package/dist/cjs/Card/Section.js +28 -0
  7. package/dist/cjs/Checkbox/Checkbox.js +1 -1
  8. package/dist/cjs/Collapse/Collapse.js +10 -9
  9. package/dist/cjs/Collapse/Collapse.test.js +56 -0
  10. package/dist/cjs/DataTable/components/Icon.js +4 -4
  11. package/dist/cjs/DragDrop/DragDrop.js +1 -1
  12. package/dist/cjs/GridView/GridView.js +2 -2
  13. package/dist/cjs/HelperDrawer/HelperDrawer.js +8 -8
  14. package/dist/cjs/Icon/Path.js +1 -0
  15. package/dist/cjs/Icon/Status.js +24 -17
  16. package/dist/cjs/Pagination/Pagination.js +99 -83
  17. package/dist/cjs/Select/Inline.js +1 -0
  18. package/dist/cjs/Select/Option.js +1 -1
  19. package/dist/cjs/Select/OptionGroup.js +1 -3
  20. package/dist/cjs/Select/Value.js +1 -0
  21. package/dist/cjs/Select/constants.js +2 -2
  22. package/dist/cjs/Sidebar/Sidebar.js +5 -5
  23. package/dist/cjs/Spinner/Spinner.js +3 -3
  24. package/dist/cjs/StackView/StackView.js +2 -2
  25. package/dist/cjs/Table/Table.js +2 -2
  26. package/dist/cjs/Text/Text.js +2 -2
  27. package/dist/cjs/ThemeProvider/ThemeProvider.js +4 -18
  28. package/dist/cjs/TileView/TileView.js +2 -2
  29. package/dist/cjs/system/box-sizes.js +6 -3
  30. package/dist/cjs/system/use-css.js +2 -2
  31. package/dist/cjs/system/utils.js +2 -2
  32. package/dist/esm/Avatar/Avatar.js +3 -3
  33. package/dist/esm/Box/Box.js +1 -1
  34. package/dist/esm/Button/Button.js +2 -2
  35. package/dist/esm/Calendar/Day.js +1 -0
  36. package/dist/esm/Card/Card.js +12 -22
  37. package/dist/esm/Card/Section.js +15 -0
  38. package/dist/esm/Checkbox/Checkbox.js +1 -1
  39. package/dist/esm/Collapse/Collapse.js +3 -2
  40. package/dist/esm/Collapse/Collapse.test.js +53 -0
  41. package/dist/esm/DataTable/components/Icon.js +1 -1
  42. package/dist/esm/DragDrop/DragDrop.js +1 -1
  43. package/dist/esm/GridView/GridView.js +1 -1
  44. package/dist/esm/HelperDrawer/HelperDrawer.js +1 -1
  45. package/dist/esm/Icon/Path.js +1 -0
  46. package/dist/esm/Icon/Status.js +24 -17
  47. package/dist/esm/Pagination/Pagination.js +96 -78
  48. package/dist/esm/Select/Inline.js +1 -0
  49. package/dist/esm/Select/Option.js +1 -1
  50. package/dist/esm/Select/OptionGroup.js +1 -2
  51. package/dist/esm/Select/Value.js +1 -0
  52. package/dist/esm/Select/constants.js +2 -2
  53. package/dist/esm/Sidebar/Sidebar.js +1 -1
  54. package/dist/esm/Spinner/Spinner.js +1 -1
  55. package/dist/esm/StackView/StackView.js +1 -1
  56. package/dist/esm/Table/Table.js +1 -1
  57. package/dist/esm/Text/Text.js +1 -1
  58. package/dist/esm/ThemeProvider/ThemeProvider.js +3 -15
  59. package/dist/esm/TileView/TileView.js +1 -1
  60. package/dist/esm/system/box-sizes.js +6 -3
  61. package/dist/esm/system/use-css.js +1 -1
  62. package/dist/esm/system/utils.js +1 -1
  63. package/dist/types/Avatar/Avatar.d.ts +19 -0
  64. package/dist/types/Box/Box.d.ts +5 -2
  65. package/dist/types/Button/Button.d.ts +22 -14
  66. package/dist/types/Button/Input.d.ts +1 -1
  67. package/dist/types/Card/Card.d.ts +2 -8
  68. package/dist/types/Card/Section.d.ts +11 -0
  69. package/dist/types/ChurchCenterStatus/ChurchCenterStatus.d.ts +0 -1
  70. package/dist/types/Collapse/Collapse.test.d.ts +1 -0
  71. package/dist/types/Divider/Divider.d.ts +0 -1
  72. package/dist/types/FilterLayout/FilterLayout.d.ts +0 -1
  73. package/dist/types/GridView/GridView.d.ts +4 -1
  74. package/dist/types/Pagination/Pagination.d.ts +23 -0
  75. package/dist/types/Popover/Popover.d.ts +3 -3
  76. package/dist/types/Portal/Portal.d.ts +4 -3
  77. package/dist/types/Spinner/Spinner.d.ts +0 -1
  78. package/dist/types/StackView/StackView.d.ts +4 -1
  79. package/dist/types/Tab/Tab.d.ts +0 -1
  80. package/dist/types/Text/Text.d.ts +4 -1
  81. package/dist/types/TileView/TileView.d.ts +4 -1
  82. package/package.json +12 -15
  83. package/src/Avatar/Avatar.mdx +2 -2
  84. package/src/Avatar/{Avatar.js → Avatar.tsx} +10 -5
  85. package/src/Badge/Badge.mdx +2 -0
  86. package/src/Badge/Status.mdx +1 -0
  87. package/src/Box/Box.tsx +2 -1
  88. package/src/Button/Button.mdx +1 -0
  89. package/src/Button/Button.tsx +13 -5
  90. package/src/Button/Input.mdx +1 -0
  91. package/src/Calendar/Calendar.mdx +1 -0
  92. package/src/Calendar/Day.js +42 -2
  93. package/src/Calendar/Day.mdx +6 -0
  94. package/src/Card/Card.mdx +1 -10
  95. package/src/Card/Card.tsx +8 -16
  96. package/src/Card/Section.mdx +19 -0
  97. package/src/Card/Section.tsx +25 -0
  98. package/src/Checkbox/Checkbox.js +1 -1
  99. package/src/Collapse/Collapse.js +5 -2
  100. package/src/Collapse/Collapse.test.tsx +42 -0
  101. package/src/Combobox/Combobox.mdx +1 -1
  102. package/src/DataTable/components/Icon.js +1 -1
  103. package/src/DragDrop/DragDrop.js +1 -1
  104. package/src/Drawer/Drawer.mdx +1 -0
  105. package/src/EditActions/EditActions.mdx +1 -0
  106. package/src/FieldSet/FieldSet.mdx +1 -0
  107. package/src/GridView/GridView.tsx +1 -1
  108. package/src/HeadingUppercase/HeadingUppercase.mdx +1 -0
  109. package/src/HelperDrawer/HelperDrawer.js +1 -1
  110. package/src/Highlight/Highlight.mdx +1 -0
  111. package/src/Icon/Icon.mdx +65 -35
  112. package/src/Icon/Path.js +2 -0
  113. package/src/Icon/Path.mdx +34 -0
  114. package/src/Icon/Status.js +23 -14
  115. package/src/Icon/Status.mdx +17 -0
  116. package/src/Input/Inline.mdx +1 -0
  117. package/src/Input/Input.mdx +1 -0
  118. package/src/Input/InputBox.mdx +1 -0
  119. package/src/Input/InputField.mdx +1 -0
  120. package/src/Input/InputLabel.mdx +1 -0
  121. package/src/PagerView/PagerView.mdx +1 -1
  122. package/src/Pagination/Pagination.mdx +0 -1
  123. package/src/Pagination/Pagination.tsx +163 -0
  124. package/src/Popover/Popover.tsx +1 -1
  125. package/src/Portal/Portal.tsx +2 -0
  126. package/src/Progress/Progress.mdx +1 -0
  127. package/src/RangeSlider/RangeSlider.mdx +1 -0
  128. package/src/Scrim/Scrim.tsx +2 -2
  129. package/src/Section/Section.mdx +1 -0
  130. package/src/Select/Inline.js +21 -1
  131. package/src/Select/Inline.mdx +27 -0
  132. package/src/Select/Option.js +1 -1
  133. package/src/Select/Option.mdx +30 -0
  134. package/src/Select/OptionGroup.js +9 -3
  135. package/src/Select/OptionGroup.mdx +25 -0
  136. package/src/Select/Select.mdx +2 -99
  137. package/src/Select/Value.js +2 -0
  138. package/src/Select/Value.mdx +67 -0
  139. package/src/Select/constants.js +2 -2
  140. package/src/Sidebar/Sidebar.js +1 -1
  141. package/src/Spinner/Spinner.mdx +1 -0
  142. package/src/Spinner/Spinner.tsx +1 -1
  143. package/src/StackView/StackView.tsx +1 -1
  144. package/src/StepperField/StepperField.mdx +1 -0
  145. package/src/StepperProgress/StepperProgress.mdx +1 -0
  146. package/src/Table/Table.js +1 -1
  147. package/src/Text/Text.mdx +1 -0
  148. package/src/Text/Text.tsx +1 -1
  149. package/src/ThemeProvider/ThemeProvider.tsx +2 -13
  150. package/src/TileView/TileView.tsx +1 -1
  151. package/src/system/README.md +1 -1
  152. package/src/system/box-sizes.js +6 -3
  153. package/src/system/use-css.js +1 -1
  154. package/src/system/utils.js +1 -1
  155. 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
+ ```
@@ -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'
@@ -1,7 +1,7 @@
1
1
  // @flow
2
2
  /** @jsxRuntime classic */
3
3
  /** @jsx jsx */
4
- import { jsx } from '@emotion/core'
4
+ import { jsx } from '@emotion/react'
5
5
  import { Children } from 'react'
6
6
  import StickyBox from 'react-sticky-box'
7
7
 
@@ -2,6 +2,7 @@
2
2
  title: Spinner
3
3
  category: Indicators
4
4
  propsSummary: Accepts [Box](/box) props.
5
+ themeKey: spinner
5
6
  ---
6
7
 
7
8
  ```jsx live
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { keyframes } from '@emotion/core'
2
+ import { keyframes } from '@emotion/react'
3
3
 
4
4
  import { Box } from '../Box'
5
5
  import { useThemeProps } from '../system'
@@ -1,6 +1,6 @@
1
1
  /** @jsxRuntime classic */
2
2
  /** @jsx jsx */
3
- import { jsx } from '@emotion/core'
3
+ import { jsx } from '@emotion/react'
4
4
  import * as React from 'react'
5
5
 
6
6
  import { BoxProps } from '../Box'
@@ -3,6 +3,7 @@ title: StepperField
3
3
  category: Forms
4
4
  summary: Number input used to collect numeric information from users with increment/decrement buttons.
5
5
  propsSummary: Accepts [StackView](/stackview) props.
6
+ themeKey: stepperField
6
7
  ---
7
8
 
8
9
  ```jsx live
@@ -3,6 +3,7 @@ title: StepperProgress
3
3
  category: Indicators
4
4
  summary: Use to convey progress through consecutive steps. Composes [GridView](/gridview).
5
5
  propsSummary: Accepts [GridView](/gridview) props.
6
+ themeKey: stepperProgress
6
7
  ---
7
8
 
8
9
  ```jsx live
@@ -1,6 +1,6 @@
1
1
  // @flow
2
2
  import React, { PureComponent, Children, Fragment } from 'react'
3
- import { Global } from '@emotion/core'
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
@@ -3,6 +3,7 @@ title: Text
3
3
  category: Primitives
4
4
  summary: Text is a primitive component that typography components build from.
5
5
  propsSummary: Accepts all [style props](/style-props) and valid HTML attributes.
6
+ themeKey: text
6
7
  order: 2
7
8
  ---
8
9
 
package/src/Text/Text.tsx CHANGED
@@ -1,6 +1,6 @@
1
1
  /** @jsxRuntime classic */
2
2
  /** @jsx jsx */
3
- import { jsx } from '@emotion/core'
3
+ import { jsx } from '@emotion/react'
4
4
  import * as React from 'react'
5
5
 
6
6
  import { BoxProps } from '../Box'
@@ -1,6 +1,6 @@
1
1
  import React, { useLayoutEffect, useState } from 'react'
2
- import { ThemeProvider as EmotionThemeProvider } from 'emotion-theming'
3
- import { CacheProvider } from '@emotion/core'
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 = {
@@ -1,6 +1,6 @@
1
1
  /** @jsxRuntime classic */
2
2
  /** @jsx jsx */
3
- import { jsx } from '@emotion/core'
3
+ import { jsx } from '@emotion/react'
4
4
  import * as React from 'react'
5
5
 
6
6
  import { BoxProps } from '../Box'
@@ -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://ministrycentered.github.io/tapestry-react/responsive) and [Variants](https://ministrycentered.github.io/tapestry-react/variants) for more information and examples.
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
 
@@ -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: 5,
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: 8,
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') {
@@ -1,5 +1,5 @@
1
1
  import { useCallback } from 'react'
2
- import { useTheme } from 'emotion-theming'
2
+ import { useTheme } from '@emotion/react'
3
3
 
4
4
  import css from './cxs'
5
5
  import { parseCssStyles } from './parse-styles'
@@ -1,5 +1,5 @@
1
1
  import { useContext, useCallback } from 'react'
2
- import { ThemeContext } from '@emotion/core'
2
+ import { ThemeContext } from '@emotion/react'
3
3
  import { darken, getLuminance, lighten, parseToRgb } from 'polished'
4
4
  import { get } from 'lodash'
5
5
 
@@ -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