@planningcenter/tapestry-react 2.0.1-rc.0 → 2.1.1

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 +33 -38
  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 +33 -39
  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 +51 -8
  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 +24 -15
  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
@@ -2,6 +2,7 @@
2
2
  title: Highlight
3
3
  category: General
4
4
  propsSummary: Accepts [Text](/text) props.
5
+ themeKey: highlight
5
6
  ---
6
7
 
7
8
  ```jsx live
package/src/Icon/Icon.mdx CHANGED
@@ -4,13 +4,67 @@ category: Primitives
4
4
  summary: Icons are used to help visually communicate actions and information to the end user.
5
5
  propsSummary: Accepts [Box](/box) props.
6
6
  order: 3
7
+ isParent: true
7
8
  ---
8
9
 
9
- ## Single icon sets
10
+ ## Icon sets
10
11
 
11
- By default, components have access to the `general` icon set. Additional icon groups can be imported through your app's ThemeProvider.
12
+ An "icon set" groups product-specific icon paths together. By default, `tapestry-react` components have access to the `general` icon set, which contains icon paths that multiple products share.
12
13
 
13
- Example usage: `general.iconNameCamelCase`
14
+ ### Formatting
15
+
16
+ - Prefix the icon set's name
17
+ - Use dot notation to specify your icon
18
+ - Render the icon name in camelCase
19
+
20
+ ```jsx
21
+ // expects: iconSetName.iconName
22
+
23
+ <Icon name="general.outlinedInfoCircle" />
24
+ <Button icon={{ name: "general.outlinedInfoCircle"}} />
25
+ ```
26
+
27
+ ## Importing additional icon sets
28
+
29
+ Additional icon sets can be imported from [libraries like `@planningcenter/icons`](https://github.com/planningcenter/icons) and exported through your app's [ThemeProvider](/theming#themeprovider). (You can import all exports [by using an asterisk](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Import_an_entire_modules_contents).)
30
+
31
+ ```jsx
32
+ import * as calendar from '@planningcenter/icons/paths/calendar'
33
+ import * as giving from '@planningcenter/icons/paths/giving'
34
+ import * as people from '@planningcenter/icons/paths/people'
35
+
36
+ const theme = {
37
+ icons: {
38
+ calendar,
39
+ giving,
40
+ people
41
+ },
42
+ }
43
+
44
+ <ThemeProvider theme={theme}>
45
+ <Icon name="calendar.reservationBlock" />
46
+ <Icon name="giving.clockCircleO" />
47
+ <Icon name="people.photoOutline" />
48
+ </ThemeProvider>
49
+ ```
50
+
51
+ ```jsx live
52
+ render(() => {
53
+ return (
54
+ <ThemeProvider theme={{ icons }}>
55
+ <StackView axis="horizontal" spacing={2}>
56
+ <Icon name="calendar.reservationBlock" size="xl" />
57
+ <Icon name="giving.clockCircleO" size="xl" />
58
+ <Icon name="people.photoOutline" size="xl" />
59
+ </StackView>
60
+ </ThemeProvider>
61
+ )
62
+ })
63
+ ```
64
+
65
+ ## Preview icons
66
+
67
+ Preview all of the available icon sets and their icon's names from `@planningcenter/icons`.
14
68
 
15
69
  ```jsx live
16
70
  render(() => {
@@ -43,41 +97,17 @@ render(() => {
43
97
  />
44
98
  </StackView>
45
99
  <TileView minCellWidth={16} spacing={4} margin={4}>
46
- {matchSorter(Object.keys(icons[appName]), value).map((iconName) => (
47
- <StackView key={iconName} alignment="center" spacing={1}>
48
- <Icon key={iconName} name={`${appName}.${iconName}`} size="xl" />
49
- <Text fontSize={5} color="foregroundSecondary">
50
- {iconName}
51
- </Text>
52
- </StackView>
53
- ))}
100
+ {matchSorter(Object.keys(icons[appName]), value).map((iconName) => (
101
+ <StackView key={iconName} alignment="center" spacing={1}>
102
+ <Icon key={iconName} name={`${appName}.${iconName}`} size="xl" />
103
+ <Text fontSize={5} color="foregroundSecondary">
104
+ {iconName}
105
+ </Text>
106
+ </StackView>
107
+ ))}
54
108
  </TileView>
55
109
  </StackView>
56
110
  </ThemeProvider>
57
111
  )
58
112
  })
59
113
  ```
60
-
61
- ## Grouped icon sets
62
-
63
- When using grouped icon sets, you can access deeper path data using dot notation.
64
-
65
- To import multiple icons from a library like [@planningcenter/icons](https://github.com/planningcenter/icons) you can [import all exports by using an asterisk](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Import_an_entire_modules_contents):
66
-
67
- `import * as calendar from '@planningcenter/icons/paths/calendar'`
68
- `import * as general from '@planningcenter/icons/paths/general'`
69
-
70
- ```jsx live
71
- render(() => {
72
- return (
73
- <ThemeProvider theme={{ icons }}>
74
- <StackView axis="horizontal" spacing={2}>
75
- <Icon name="accounts.integrations" size="xl" />
76
- <Icon name="calendar.kiosk" size="xl" />
77
- <Icon name="general.heart" size="xl" />
78
- <Icon name="registrations.bell" size="xl" />
79
- </StackView>
80
- </ThemeProvider>
81
- )
82
- })
83
- ```
package/src/Icon/Path.js CHANGED
@@ -17,4 +17,6 @@ function Path({ name = '', color = 'currentColor', ...restProps }: Props) {
17
17
  return <Box as="path" d={pathData} fill={color} {...restProps} />
18
18
  }
19
19
 
20
+ Path.displayName = 'Icon.Path'
21
+
20
22
  export default Path
@@ -0,0 +1,34 @@
1
+ ---
2
+ title: Icon.Path
3
+ category: Primitives
4
+ summary: Path(s) are wrapped by an [Icon](/icon) component allowing for more customization.
5
+ propsSummary: Accepts [Box](/box) props.
6
+ parent: Icon
7
+ ---
8
+
9
+ ```jsx live
10
+ render(() => {
11
+ const [checked, setChecked] = React.useState(false)
12
+ return (
13
+ <StackView axis="horizontal" spacing={3}>
14
+ <Button
15
+ onClick={() => setChecked(!checked)}
16
+ title="Toggle path"
17
+ variant="outline"
18
+ />
19
+ <Icon size="xl">
20
+ <Icon.Path
21
+ name="general.checkCircle"
22
+ visible={checked}
23
+ color="success"
24
+ />
25
+ <Icon.Path
26
+ name="general.outlinedCircleCheck"
27
+ visible={!checked}
28
+ color="grey-5"
29
+ />
30
+ </Icon>
31
+ </StackView>
32
+ )
33
+ })
34
+ ```
@@ -5,14 +5,26 @@ import Icon from './Icon'
5
5
  import Path from './Path'
6
6
 
7
7
  const STATUS_VARIANTS = {
8
- confirmed: ['general.outlinedCircleCheck', 'success'],
9
- unconfirmed: ['general.outlinedQuestionCircle', 'warning'],
10
- declined: ['general.outlinedXCircle', 'error'],
8
+ confirmed: {
9
+ iconColor: 'success',
10
+ iconFilled: 'general.checkCircle',
11
+ iconOutlined: 'general.outlinedCircleCheck',
12
+ },
13
+ unconfirmed: {
14
+ iconColor: 'warning',
15
+ iconFilled: 'general.questionCircle',
16
+ iconOutlined: 'general.outlinedQuestionCircle',
17
+ },
18
+ declined: {
19
+ iconColor: 'error',
20
+ iconFilled: 'general.xCircle',
21
+ iconOutlined: 'general.outlinedXCircle',
22
+ },
11
23
  }
12
24
 
13
25
  export type Props = {
14
26
  /** The name of the status icon to render. */
15
- variant?: 'confirmed' | 'unconfirmed' | 'declined',
27
+ variant: 'confirmed' | 'unconfirmed' | 'declined',
16
28
  /** Uses the filled version of the icon. */
17
29
  variantFilled?: boolean,
18
30
  /** Pass any valid color from [colors](/colors). Defaults to variant color. */
@@ -21,21 +33,18 @@ export type Props = {
21
33
 
22
34
  function Status(props: Props) {
23
35
  const { color, variant, variantFilled, ...restProps } = props
24
- let variantName
25
- let variantColor
26
- Object.keys(STATUS_VARIANTS).some((key) => {
27
- return variant === key
28
- ? ([variantName, variantColor] = STATUS_VARIANTS[key])
29
- : false
30
- })
31
- if (variantName && variantFilled) {
32
- variantName += '-filled'
33
- }
36
+ const { iconOutlined, iconFilled, iconColor } = STATUS_VARIANTS[variant]
37
+
38
+ const variantColor = color || iconColor
39
+ const variantIcon = variantFilled ? iconFilled : iconOutlined
40
+
34
41
  return (
35
- <Icon name={variantName} color={color || variantColor} {...restProps}>
42
+ <Icon name={variantIcon} color={variantColor} {...restProps}>
36
43
  <Path name="tapestry.radio0" color={color} />
37
44
  </Icon>
38
45
  )
39
46
  }
40
47
 
48
+ Status.displayName = 'Icon.Status'
49
+
41
50
  export default Status
@@ -0,0 +1,17 @@
1
+ ---
2
+ title: Icon.Status
3
+ category: Primitives
4
+ summary: This wraps the [Icon](/icon) component and can render 3 different statuses.
5
+ propsSummary: Accepts [Icon](/icon) props.
6
+ parent: Icon
7
+ ---
8
+
9
+ ```jsx live
10
+ render(
11
+ <StackView axis="horizontal" spacing={3}>
12
+ <Icon.Status variant="confirmed" size="xl" />
13
+ <Icon.Status variant="unconfirmed" size="xl" />
14
+ <Icon.Status variant="declined" size="xl" />
15
+ </StackView>
16
+ )
17
+ ```
@@ -3,6 +3,7 @@ title: Input.Inline
3
3
  category: Forms
4
4
  summary: Composes [Input.InputField](/input.inputfield) with minimal styling.
5
5
  propsSummary: Accepts props for [Input.InputField](/input.inputfield).
6
+ parent: Input
6
7
  ---
7
8
 
8
9
  ```jsx live
@@ -3,6 +3,7 @@ title: Input
3
3
  category: Forms
4
4
  summary: Composes [Input.InputBox](/input.inputbox) and [Input.InputField](/input.inputfield).
5
5
  propsSummary: Accepts props for [Input.InputBox](/input.inputbox) _and_ [Input.InputField](/input.inputfield), remaining props are forwarded to `Input.InputBox`.
6
+ isParent: true
6
7
  ---
7
8
 
8
9
  ```jsx live
@@ -3,6 +3,7 @@ title: Input.InputBox
3
3
  category: Forms
4
4
  summary: A base component used in Input as well as [SegmentedControl](/segmentedcontrol), [Select](/select), and [TokenInput](/tokeninput).
5
5
  propsSummary: Accepts [StackView](/stackview) props.
6
+ parent: Input
6
7
  ---
7
8
 
8
9
  ```jsx live
@@ -3,6 +3,7 @@ title: Input.InputField
3
3
  category: Forms
4
4
  summary: The base component used in Input as well as Input.Inline and Combobox.Input. Provides a clean input base to build on top of.
5
5
  propsSummary: Accepts [Box](/box) props.
6
+ parent: Input
6
7
  ---
7
8
 
8
9
  ```jsx live
@@ -3,6 +3,7 @@ title: Input.InputLabel
3
3
  category: Forms
4
4
  summary: Provides accessibility as well as usability improvements for mouse users by allowing the user to click the <InputLabel/> component to focus the respective control. This mimics the browsers native label tag, but allows use with custom components like <Select/>.
5
5
  propsSummary: Accepts [Text](/text) props.
6
+ parent: Input
6
7
  ---
7
8
 
8
9
  ```jsx live
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: PagerView
3
3
  category: Layout
4
- summary: Allows paging between views. Use with the [useRovingIndex](https://github.com/ministrycentered/tapestry-react/blob/next/packages/tapestry-react/src/hooks/use-roving-index.js) hook to control the [activeViewIndex](#activeViewIndex).
4
+ summary: Allows paging between views. Use with the [useRovingIndex](https://github.com/planningcenter/tapestry-react/blob/next/packages/tapestry-react/src/hooks/use-roving-index.js) hook to control the [activeViewIndex](#activeViewIndex).
5
5
  propsSummary: Accepts [StackView](/stackview) props.
6
6
  ---
7
7
 
@@ -12,7 +12,6 @@ render(() => {
12
12
  currentPage={value}
13
13
  onPageChange={(value) => setValue(value)}
14
14
  totalPages={100}
15
- visiblePages={10}
16
15
  />
17
16
  )
18
17
  })
@@ -0,0 +1,163 @@
1
+ import React from 'react'
2
+
3
+ import Box from '../Box'
4
+ import Button from '../Button'
5
+ import Group from '../Group'
6
+ import StackView from '../StackView'
7
+ import { range } from '../utils'
8
+ import { useWindowWidth } from '@react-hook/window-size'
9
+ import { useThemeValue } from '../system'
10
+
11
+ function getVisiblePages(currentPage, totalPages, visiblePages) {
12
+ const start = Math.max(
13
+ 1,
14
+ Math.min(
15
+ totalPages - visiblePages + 1,
16
+ Math.floor(currentPage - visiblePages / 2 + 1)
17
+ )
18
+ )
19
+ const stop = Math.min(totalPages, start + visiblePages - 1)
20
+ const primaryWindow = range(start, stop + 1)
21
+ const showFirstPage = start > 1
22
+ const showLastPage = stop < totalPages
23
+
24
+ if (showFirstPage) {
25
+ primaryWindow.shift()
26
+ primaryWindow.shift()
27
+ }
28
+ if (showLastPage) {
29
+ primaryWindow.pop()
30
+ primaryWindow.pop()
31
+ }
32
+
33
+ const first = showFirstPage ? [1, '...'] : []
34
+ const last = showLastPage ? ['...', totalPages] : []
35
+ return first.concat(primaryWindow).concat(last)
36
+ }
37
+
38
+ export type PaginationProps = {
39
+ /**
40
+ * Change the color of the active page
41
+ */
42
+ activeColor: string,
43
+
44
+ /**
45
+ * Current visible page number
46
+ */
47
+ currentPage: number,
48
+
49
+ /**
50
+ * Callback when new page is requested
51
+ */
52
+ onPageChange: (nextPage: number) => undefined,
53
+
54
+ /**
55
+ * Total available pages
56
+ */
57
+ totalPages: number,
58
+
59
+ /**
60
+ * Amount of visible pages
61
+ */
62
+ visiblePages?: number,
63
+ }
64
+
65
+ const NavButton = ({ disabled, iconName, ...props }) => {
66
+ return (
67
+ <Button
68
+ backgroundColor={disabled ? '#f7f7f7' : '#f2f2f2'}
69
+ disabled={disabled}
70
+ icon={{
71
+ color: disabled ? '#cfcfcf' : undefined,
72
+ name: iconName,
73
+ size: 'xs',
74
+ }}
75
+ opacity={1}
76
+ shrink={0}
77
+ square
78
+ variant="fill"
79
+ {...props}
80
+ />
81
+ )
82
+ }
83
+
84
+ export default function Pagination({
85
+ activeColor = '#5b8bf7',
86
+ currentPage,
87
+ onPageChange = () => null,
88
+ visiblePages,
89
+ totalPages = 0,
90
+ ...restProps
91
+ }: PaginationProps) {
92
+ const { xs: xsBreakpoint } = useThemeValue('breakpoints')
93
+
94
+ const currentWidth = useWindowWidth()
95
+
96
+ function renderGap(key) {
97
+ return <Box key={key} userSelect="none" cursor="default" children="…" />
98
+ }
99
+
100
+ function renderPageLink(number) {
101
+ const isActive = currentPage === number
102
+
103
+ const outlineStyle = { border: '1px solid #5b8bf7', color: '#5b8bf7' }
104
+
105
+ return (
106
+ <Button
107
+ key={number}
108
+ focus={{ backgroundColor: '#f4f8fd', ...outlineStyle }}
109
+ fontWeight={500}
110
+ hover={{ backgroundColor: '#ffffff', ...outlineStyle }}
111
+ onClick={onPageChange.bind(null, number)}
112
+ shrink={0}
113
+ square
114
+ title={number}
115
+ variant={isActive ? 'fill' : 'naked'}
116
+ {...(isActive && { backgroundColor: '#5b8bf7', color: 'white' })}
117
+ />
118
+ )
119
+ }
120
+
121
+ function renderPageLinks() {
122
+ const visiblePagesToShow =
123
+ currentWidth <= xsBreakpoint ? visiblePages || 5 : visiblePages || 7
124
+ const pages = getVisiblePages(currentPage, totalPages, visiblePagesToShow)
125
+ return pages.map((page, index) =>
126
+ page === '...' ? renderGap(page + index) : renderPageLink(page)
127
+ )
128
+ }
129
+
130
+ if (totalPages <= 1) {
131
+ return null
132
+ } else {
133
+ return (
134
+ <StackView
135
+ alignment="center"
136
+ axis="horizontal"
137
+ distribution="center"
138
+ overflow="auto"
139
+ paddingVertical={1}
140
+ shrink={0}
141
+ spacing={0.5}
142
+ width="100%"
143
+ {...restProps}
144
+ >
145
+ <Group spacing={0.5}>
146
+ <NavButton
147
+ disabled={currentPage === 1}
148
+ iconName="general.leftChevron"
149
+ onClick={onPageChange.bind(null, currentPage - 1)}
150
+ tooltip={{ title: 'Previous Page' }}
151
+ />
152
+ <NavButton
153
+ disabled={currentPage === totalPages}
154
+ iconName="general.rightChevron"
155
+ onClick={onPageChange.bind(null, currentPage + 1)}
156
+ tooltip={{ title: 'Next Page' }}
157
+ />
158
+ </Group>
159
+ {renderPageLinks()}
160
+ </StackView>
161
+ )
162
+ }
163
+ }
@@ -17,7 +17,7 @@ export type PopoverProps = {
17
17
  /**
18
18
  * Controls the default component or tag being rendered.
19
19
  */
20
- as?: React.ReactNode
20
+ as?: any
21
21
 
22
22
  /**
23
23
  * The element to attach the popover to. Clones the element's ref to calculate
@@ -2,6 +2,8 @@ import * as React from 'react'
2
2
  import { createPortal } from 'react-dom'
3
3
 
4
4
  export type PortalProps = {
5
+ children: any
6
+
5
7
  /** Styles to apply to the portal root element. */
6
8
  style?: React.CSSProperties
7
9
 
@@ -3,6 +3,7 @@ title: Progress
3
3
  category: Indicators
4
4
  summary: Display progress towards the completion of a task. Composes [Box](/box).
5
5
  propsSummary: Accepts [Box](/box) props.
6
+ themeKey: progress
6
7
  ---
7
8
 
8
9
  ```jsx live
@@ -3,6 +3,7 @@ title: RangeSlider
3
3
  category: Forms
4
4
  summary: Allow the user to specify a numeric value which must be no less than a minimum value and no more than a maximum value. Composes [Box](/box).
5
5
  propsSummary: Accepts [Box](/box) props.
6
+ themeKey: rangeSlider
6
7
  ---
7
8
 
8
9
  ```jsx live
@@ -4,8 +4,8 @@ import StackView from '../StackView'
4
4
 
5
5
  type ScrimProps = {
6
6
  /** Gain access to the internal ref. */
7
- ref?: any
8
- children?: any
7
+ ref?: any,
8
+ children?: any,
9
9
  }
10
10
 
11
11
  const Scrim = React.forwardRef(function (props: ScrimProps, _ref: any) {
@@ -3,6 +3,7 @@ title: Section
3
3
  category: General
4
4
  summary: Sections are used within `Page` components to break up content into sections that always display a `Toolbar` at the top.
5
5
  propsSummary: Accepts [StackView](/stackview) props.
6
+ themeKey: section
6
7
  ---
7
8
 
8
9
  ```jsx live
@@ -1,8 +1,26 @@
1
+ // @flow
1
2
  import React from 'react'
2
3
 
3
4
  import Select from './Select'
4
5
 
5
- function Inline({ light, hover, focus, readOnly, ...restProps }) {
6
+ type Props = {
7
+ /**
8
+ * Changes the background and text color values
9
+ */
10
+ light?: boolean,
11
+ /**
12
+ * Accepts hover styles.
13
+ */
14
+ hover?: object,
15
+
16
+ /**
17
+ * Accepts focus styles.
18
+ */
19
+ focus?: object,
20
+ readOnly?: boolean,
21
+ }
22
+
23
+ function Inline({ light, hover, focus, readOnly, ...restProps }: Props) {
6
24
  const pseudoStyles = readOnly
7
25
  ? {}
8
26
  : { backgroundColor: light ? 'light-0' : 'highlight' }
@@ -29,4 +47,6 @@ function Inline({ light, hover, focus, readOnly, ...restProps }) {
29
47
  )
30
48
  }
31
49
 
50
+ Inline.displayName = 'Select.Inline'
51
+
32
52
  export default Inline
@@ -0,0 +1,27 @@
1
+ ---
2
+ title: Select.Inline
3
+ category: Forms
4
+ summary: A base component that composes [Select](/select) and provides transparent styles.
5
+ propsSummary: Accepts [Select](/select) props.
6
+ parent: Select
7
+ ---
8
+
9
+ ```jsx live
10
+ render(
11
+ <Box padding={2} backgroundColor="primary">
12
+ <Select.Inline light>
13
+ {generateRange(100).map((number) => (
14
+ <Select.Option key={number} value={number}>
15
+ {number}
16
+ </Select.Option>
17
+ ))}
18
+ </Select.Inline>
19
+ <Input.Inline
20
+ size="xl"
21
+ fontSize={0}
22
+ light
23
+ defaultValue="Editable Heading"
24
+ />
25
+ </Box>
26
+ )
27
+ ```
@@ -20,7 +20,7 @@ type Props = {
20
20
  }
21
21
 
22
22
  class Option extends Component<Props> {
23
- static displayName = OPTION_DISPLAY_NAME
23
+ static displayName = 'Select.Option'
24
24
 
25
25
  render() {
26
26
  const { children, disabled, index, text, value, ...restProps } = this.props
@@ -0,0 +1,30 @@
1
+ ---
2
+ title: Select.Option
3
+ category: Forms
4
+ summary: Holds values that will interact with [Select](/select) and can be wrapped by [Select.OptionGroup](/select.optiongroup)
5
+ parent: Select
6
+ ---
7
+
8
+ ```jsx live
9
+ render(
10
+ <Select
11
+ emptyValue="Select a fruit"
12
+ tooltip={{ title: 'Select a fruit' }}
13
+ onChange={(e) => console.log(e)}
14
+ >
15
+ <Select.Option value="apple">Apple</Select.Option>
16
+ <Select.Option value="orange">Orange</Select.Option>
17
+ <Select.Option value="banana">Banana</Select.Option>
18
+ <Select.Option value="mango">Mango</Select.Option>
19
+ <Select.Option value="kiwi" disabled>
20
+ Kiwi (Out of stock)
21
+ </Select.Option>
22
+ <Select.Option value="strawberry">Strawberry</Select.Option>
23
+ <Divider margin={0.5} />
24
+ <Menu.Item distribution="fill" spacing={1}>
25
+ <Button title="Action 1" size="sm" />
26
+ <Button title="Action 2" size="sm" />
27
+ </Menu.Item>
28
+ </Select>
29
+ )
30
+ ```
@@ -1,9 +1,15 @@
1
+ // @flow
1
2
  import { Component } from 'react'
2
3
 
3
- import { OPTIONGROUP_DISPLAY_NAME } from './constants'
4
+ type Props = {
5
+ /**
6
+ * Provide a title to a grouping of options.
7
+ */
8
+ title?: string,
9
+ }
4
10
 
5
- class OptionGroup extends Component {
6
- static displayName = OPTIONGROUP_DISPLAY_NAME
11
+ class OptionGroup extends Component<Props> {
12
+ static displayName = 'Select.OptionGroup'
7
13
 
8
14
  render() {
9
15
  return null