@planningcenter/tapestry-react 1.2.0 → 2.0.0-rc.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/ActionsDropdown/ActionsDropdown.js +3 -3
- package/dist/cjs/Badge/Badge.js +41 -26
- package/dist/cjs/Badge/Status.js +2 -2
- package/dist/cjs/Button/Button.js +6 -1
- package/dist/cjs/Calendar/Calendar.js +5 -3
- package/dist/cjs/Card/Card.js +2 -0
- package/dist/cjs/Checkbox/Checkbox.js +3 -3
- package/dist/cjs/ChurchCenterStatus/ChurchCenterStatus.js +29 -16
- package/dist/cjs/ColumnView/ColumnView.js +5 -2
- package/dist/cjs/Combobox/ComboboxPopover.js +2 -2
- package/dist/cjs/DataTable/components/CheckboxCell.js +4 -4
- package/dist/cjs/DataTable/components/ColumnPicker.js +6 -5
- package/dist/cjs/DataTable/hooks/useColumnSort.js +1 -1
- package/dist/cjs/DataTable/utils/getParsedColumns.js +4 -4
- package/dist/cjs/DateField/DateField.js +1 -1
- package/dist/cjs/Drawer/Drawer.js +4 -1
- package/dist/cjs/Dropdown/Dropdown.js +1 -1
- package/dist/cjs/Dropdown/Link.js +3 -1
- package/dist/cjs/EditActions/EditActions.js +9 -3
- package/dist/cjs/Field/Field.js +1 -0
- package/dist/cjs/FieldSet/FieldSet.js +24 -10
- package/dist/cjs/FilterLayout/FilterLayout.js +2 -1
- package/dist/cjs/Form/Form.js +1 -1
- package/dist/cjs/GridView/GridView.js +6 -4
- package/dist/cjs/Group/Group.js +8 -3
- package/dist/cjs/HeadingUppercase/HeadingUppercase.js +2 -2
- package/dist/cjs/HelperDrawer/HelperDrawer.js +1 -1
- package/dist/cjs/Highlight/Highlight.js +11 -5
- package/dist/cjs/Icon/Status.js +4 -4
- package/dist/cjs/Input/InputBox.js +1 -1
- package/dist/cjs/List/ListItem.js +1 -1
- package/dist/cjs/Menu/Heading.js +4 -2
- package/dist/cjs/Menu/Item.js +5 -5
- package/dist/cjs/Pagination/Pagination.js +4 -2
- package/dist/cjs/Progress/Progress.js +12 -6
- package/dist/cjs/Radio/Radio.js +2 -2
- package/dist/cjs/RangeSlider/RangeSlider.js +10 -4
- package/dist/cjs/Scrim/Scrim.js +2 -2
- package/dist/cjs/Section/Section.js +14 -6
- package/dist/cjs/Select/Option.js +1 -1
- package/dist/cjs/Select/Select.js +1 -1
- package/dist/cjs/Sortable/SortableItem.js +1 -1
- package/dist/cjs/StackView/StackView.js +5 -5
- package/dist/cjs/StepperField/StepperField.js +9 -6
- package/dist/cjs/StepperProgress/StepperProgress.js +9 -5
- package/dist/cjs/Table/ColumnPicker.js +1 -1
- package/dist/cjs/Table/DragHandle.js +1 -1
- package/dist/cjs/Table/NavigationArrow.js +1 -1
- package/dist/cjs/Table/SubRowToggleCell.js +1 -1
- package/dist/cjs/Table/Table.js +1 -1
- package/dist/cjs/Tabs/Tab.js +1 -0
- package/dist/cjs/TileView/TileView.js +1 -1
- package/dist/cjs/TokenInput/DefaultToken.js +1 -1
- package/dist/cjs/Wizard/Wizard.js +2 -1
- package/dist/cjs/WrapView/WrapView.js +2 -27
- package/dist/cjs/hooks/use-accessibility-violation.js +1 -1
- package/dist/cjs/system/default-theme.js +8 -3
- package/dist/esm/ActionsDropdown/ActionsDropdown.js +3 -3
- package/dist/esm/Badge/Badge.js +42 -27
- package/dist/esm/Badge/Status.js +2 -2
- package/dist/esm/Button/Button.js +6 -1
- package/dist/esm/Calendar/Calendar.js +5 -3
- package/dist/esm/Card/Card.js +2 -3
- package/dist/esm/Checkbox/Checkbox.js +3 -3
- package/dist/esm/ChurchCenterStatus/ChurchCenterStatus.js +27 -15
- package/dist/esm/ColumnView/ColumnView.js +4 -2
- package/dist/esm/Combobox/ComboboxPopover.js +2 -2
- package/dist/esm/DataTable/components/CheckboxCell.js +4 -4
- package/dist/esm/DataTable/components/ColumnPicker.js +6 -5
- package/dist/esm/DataTable/hooks/useColumnSort.js +1 -1
- package/dist/esm/DataTable/utils/getParsedColumns.js +4 -4
- package/dist/esm/DateField/DateField.js +1 -1
- package/dist/esm/Drawer/Drawer.js +3 -1
- package/dist/esm/Dropdown/Dropdown.js +1 -1
- package/dist/esm/Dropdown/Link.js +3 -1
- package/dist/esm/EditActions/EditActions.js +8 -3
- package/dist/esm/Field/Field.js +1 -0
- package/dist/esm/FieldSet/FieldSet.js +22 -10
- package/dist/esm/FilterLayout/FilterLayout.js +2 -1
- package/dist/esm/Form/Form.js +1 -1
- package/dist/esm/GridView/GridView.js +5 -4
- package/dist/esm/Group/Group.js +8 -3
- package/dist/esm/HeadingUppercase/HeadingUppercase.js +3 -3
- package/dist/esm/HelperDrawer/HelperDrawer.js +1 -1
- package/dist/esm/Highlight/Highlight.js +9 -5
- package/dist/esm/Icon/Status.js +4 -4
- package/dist/esm/Input/InputBox.js +1 -1
- package/dist/esm/List/ListItem.js +1 -1
- package/dist/esm/Menu/Heading.js +4 -2
- package/dist/esm/Menu/Item.js +5 -5
- package/dist/esm/Pagination/Pagination.js +4 -2
- package/dist/esm/Progress/Progress.js +10 -6
- package/dist/esm/Radio/Radio.js +2 -2
- package/dist/esm/RangeSlider/RangeSlider.js +8 -4
- package/dist/esm/Scrim/Scrim.js +2 -2
- package/dist/esm/Section/Section.js +12 -6
- package/dist/esm/Select/Option.js +1 -1
- package/dist/esm/Select/Select.js +1 -1
- package/dist/esm/Sortable/SortableItem.js +1 -1
- package/dist/esm/StackView/StackView.js +4 -5
- package/dist/esm/StepperField/StepperField.js +10 -7
- package/dist/esm/StepperProgress/StepperProgress.js +8 -5
- package/dist/esm/Table/ColumnPicker.js +1 -1
- package/dist/esm/Table/DragHandle.js +1 -1
- package/dist/esm/Table/NavigationArrow.js +1 -1
- package/dist/esm/Table/SubRowToggleCell.js +1 -1
- package/dist/esm/Table/Table.js +1 -1
- package/dist/esm/Tabs/Tab.js +1 -0
- package/dist/esm/TileView/TileView.js +1 -1
- package/dist/esm/TokenInput/DefaultToken.js +1 -1
- package/dist/esm/Wizard/Wizard.js +2 -1
- package/dist/esm/WrapView/WrapView.js +2 -28
- package/dist/esm/hooks/use-accessibility-violation.js +1 -1
- package/dist/esm/system/default-theme.js +6 -2
- package/dist/types/Alert/Alert.d.ts +3 -0
- package/dist/types/Box/Box.d.ts +11 -2
- package/dist/types/Button/Button.d.ts +9 -1
- package/dist/types/Button/Input.d.ts +1 -1
- package/dist/types/Card/Card.d.ts +8 -1
- package/dist/types/ChurchCenterStatus/ChurchCenterStatus.d.ts +15 -1
- package/dist/types/GridView/GridView.d.ts +16 -4
- package/dist/types/Scrim/Scrim.d.ts +6 -1
- package/dist/types/StackView/StackView.d.ts +11 -0
- package/dist/types/Text/Text.d.ts +12 -0
- package/dist/types/TileView/TileView.d.ts +15 -7
- package/dist/types/WrapView/WrapView.d.ts +2 -1
- package/package.json +4 -3
- package/src/ActionsDropdown/ActionsDropdown.tsx +3 -3
- package/src/Alert/Alert.mdx +1 -0
- package/src/Alert/Alert.tsx +5 -0
- package/src/Avatar/Avatar.mdx +1 -0
- package/src/Badge/Badge.js +66 -25
- package/src/Badge/Badge.mdx +2 -1
- package/src/Badge/Status.js +2 -2
- package/src/Badge/Status.mdx +1 -0
- package/src/Box/Box.mdx +2 -1
- package/src/Box/Box.tsx +13 -2
- package/src/Button/Button.mdx +4 -3
- package/src/Button/Button.tsx +17 -1
- package/src/Button/Input.mdx +2 -2
- package/src/Calendar/Calendar.js +8 -3
- package/src/Calendar/Calendar.mdx +1 -0
- package/src/Card/Card.mdx +1 -0
- package/src/Card/Card.tsx +7 -1
- package/src/Checkbox/Checkbox.js +8 -3
- package/src/Checkbox/Checkbox.mdx +1 -0
- package/src/CheckboxCard/CheckboxCard.js +26 -1
- package/src/CheckboxCard/CheckboxCard.mdx +1 -0
- package/src/CheckboxGroup/CheckboxGroup.js +6 -0
- package/src/CheckboxGroup/CheckboxGroup.mdx +1 -0
- package/src/ChurchCenterStatus/ChurchCenterStatus.mdx +19 -0
- package/src/ChurchCenterStatus/ChurchCenterStatus.tsx +52 -20
- package/src/Collapse/Collapse.js +2 -0
- package/src/ColumnView/ColumnView.js +7 -3
- package/src/ColumnView/ColumnView.mdx +1 -0
- package/src/Combobox/Combobox.js +11 -1
- package/src/Combobox/Combobox.mdx +2 -1
- package/src/Combobox/ComboboxPopover.js +2 -2
- package/src/DataTable/DataTable.js +48 -0
- package/src/DataTable/DataTable.mdx +2 -2
- package/src/DataTable/components/CheckboxCell.js +5 -4
- package/src/DataTable/components/ColumnPicker.js +4 -4
- package/src/DataTable/hooks/useColumnSort.js +1 -1
- package/src/DataTable/utils/getParsedColumns.js +4 -4
- package/src/DateField/DateField.js +11 -1
- package/src/DateField/DateField.mdx +1 -0
- package/src/Divider/Divider.mdx +1 -0
- package/src/DragDrop/DragDrop.mdx +23 -9
- package/src/Drawer/Drawer.js +3 -0
- package/src/Drawer/Drawer.mdx +2 -1
- package/src/Dropdown/Dropdown.js +49 -3
- package/src/Dropdown/Dropdown.mdx +3 -2
- package/src/Dropdown/Link.js +3 -1
- package/src/EditActions/EditActions.js +18 -3
- package/src/EditActions/EditActions.mdx +1 -0
- package/src/Field/Field.js +16 -0
- package/src/Field/Field.mdx +1 -0
- package/src/FieldSet/FieldSet.js +35 -11
- package/src/FieldSet/FieldSet.mdx +1 -0
- package/src/FilterLayout/FilterLayout.mdx +1 -0
- package/src/FilterLayout/FilterLayout.tsx +4 -1
- package/src/Form/Form.js +1 -1
- package/src/Form/Form.mdx +26 -24
- package/src/GridView/GridView.mdx +2 -1
- package/src/GridView/GridView.tsx +27 -8
- package/src/Group/Group.mdx +8 -7
- package/src/Group/Group.tsx +6 -1
- package/src/Heading/Heading.js +6 -2
- package/src/Heading/Heading.mdx +1 -0
- package/src/HeadingUppercase/HeadingUppercase.js +9 -5
- package/src/HeadingUppercase/HeadingUppercase.mdx +1 -0
- package/src/HelperDrawer/HelperDrawer.js +10 -2
- package/src/HelperDrawer/HelperDrawer.mdx +1 -0
- package/src/Highlight/Highlight.js +6 -2
- package/src/Highlight/Highlight.mdx +1 -0
- package/src/Icon/Icon.js +6 -0
- package/src/Icon/Icon.mdx +42 -37
- package/src/Icon/Status.js +4 -4
- package/src/Input/Inline.js +11 -1
- package/src/Input/Inline.mdx +2 -1
- package/src/Input/Input.js +119 -1
- package/src/Input/Input.mdx +1 -6
- package/src/Input/InputBox.js +41 -1
- package/src/Input/InputBox.mdx +1 -0
- package/src/Input/InputField.js +32 -0
- package/src/Input/InputField.mdx +1 -0
- package/src/Input/InputLabel.mdx +1 -0
- package/src/Link/Link.js +10 -0
- package/src/Link/Link.mdx +2 -1
- package/src/LinkList/LinkList.js +7 -1
- package/src/LinkList/LinkList.mdx +1 -0
- package/src/List/List.js +25 -1
- package/src/List/List.mdx +1 -0
- package/src/List/ListItem.js +1 -1
- package/src/Logo/Logo.js +10 -1
- package/src/Logo/Logo.mdx +1 -0
- package/src/Menu/Heading.js +7 -1
- package/src/Menu/Item.js +5 -5
- package/src/Menu/Menu.js +7 -1
- package/src/Menu/Menu.mdx +2 -1
- package/src/Modal/Modal.js +1 -0
- package/src/Modal/Modal.mdx +1 -0
- package/src/NumberField/NumberField.js +19 -0
- package/src/Page/Page.mdx +1 -1
- package/src/PagerView/PagerView.js +1 -0
- package/src/PagerView/PagerView.mdx +9 -8
- package/src/Pagination/Pagination.js +2 -2
- package/src/Pagination/Pagination.mdx +1 -0
- package/src/Progress/Progress.js +8 -3
- package/src/Progress/Progress.mdx +1 -0
- package/src/Radio/Radio.js +4 -2
- package/src/Radio/Radio.mdx +1 -0
- package/src/RangeSlider/RangeSlider.js +11 -2
- package/src/RangeSlider/RangeSlider.mdx +13 -10
- package/src/ScreenReader/ScreenReader.js +6 -1
- package/src/ScreenReader/ScreenReader.mdx +1 -0
- package/src/Scrim/Scrim.mdx +1 -0
- package/src/Scrim/Scrim.tsx +8 -2
- package/src/Section/Section.js +15 -3
- package/src/Section/Section.mdx +1 -0
- package/src/SegmentedControl/SegmentedControl.mdx +3 -2
- package/src/SegmentedTabs/SegmentedTabs.js +2 -0
- package/src/SegmentedTabs/SegmentedTabs.mdx +1 -0
- package/src/Select/Option.js +1 -1
- package/src/Select/Select.js +63 -2
- package/src/Select/Select.mdx +1 -0
- package/src/Sidebar/Sidebar.js +7 -1
- package/src/Sidebar/Sidebar.mdx +1 -0
- package/src/Sortable/SortableItem.js +1 -1
- package/src/Spinner/Spinner.mdx +1 -0
- package/src/StackView/StackView.mdx +17 -1
- package/src/StackView/StackView.tsx +23 -8
- package/src/StepperField/StepperField.js +35 -6
- package/src/StepperField/StepperField.mdx +2 -2
- package/src/StepperProgress/StepperProgress.js +9 -10
- package/src/StepperProgress/StepperProgress.mdx +1 -0
- package/src/Summary/Summary.mdx +1 -0
- package/src/Tab/Tab.mdx +1 -0
- package/src/Table/ColumnPicker.js +1 -1
- package/src/Table/DragHandle.js +1 -1
- package/src/Table/NavigationArrow.js +1 -1
- package/src/Table/SubRowToggleCell.js +1 -1
- package/src/Table/Table.js +1 -1
- package/src/Table/Table.mdx +2 -2
- package/src/Tabs/Tab.js +1 -0
- package/src/Tabs/Tabs.js +5 -0
- package/src/Tabs/Tabs.mdx +1 -0
- package/src/Text/Text.mdx +1 -0
- package/src/Text/Text.tsx +12 -0
- package/src/TextArea/TextArea.js +7 -1
- package/src/TextArea/TextArea.mdx +1 -0
- package/src/TileView/TileView.mdx +1 -0
- package/src/TileView/TileView.tsx +17 -3
- package/src/TimeField/TimeField.mdx +1 -0
- package/src/TokenInput/DefaultToken.js +1 -1
- package/src/TokenInput/TokenInput.js +12 -6
- package/src/TokenInput/TokenInput.mdx +1 -0
- package/src/Toolbar/Toolbar.mdx +1 -0
- package/src/Tooltip/Tooltip.js +39 -0
- package/src/Tooltip/Tooltip.mdx +4 -3
- package/src/Wizard/Wizard.js +1 -1
- package/src/Wizard/Wizard.mdx +7 -2
- package/src/WrapView/WrapView.mdx +1 -0
- package/src/WrapView/WrapView.tsx +6 -28
- package/src/hooks/use-accessibility-violation.tsx +1 -1
- package/src/system/default-theme.ts +7 -2
- package/dist/cjs/icons.js +0 -126
- package/dist/esm/icons.js +0 -121
- package/src/icons.js +0 -121
package/src/Dropdown/Dropdown.js
CHANGED
|
@@ -12,21 +12,67 @@ import Item, { ITEM_DISPLAY_NAME } from './Item'
|
|
|
12
12
|
import Link, { LINK_DISPLAY_NAME, LINK_DATA } from './Link'
|
|
13
13
|
|
|
14
14
|
type Props = {
|
|
15
|
-
|
|
15
|
+
children?: React.ReactNode,
|
|
16
|
+
|
|
17
|
+
/** Allows specifying a type or custom element that will be cloned and provided `Dropdown` trigger props. (Defaults to a [Button](/button).) */
|
|
16
18
|
triggerElement?: React.ElementType | React.ReactNode,
|
|
19
|
+
|
|
20
|
+
/** Gain access to the internal ref. */
|
|
21
|
+
innerRef?: any,
|
|
22
|
+
|
|
17
23
|
/** Closes Popover upon selecting a `Dropdown.Item`. */
|
|
18
24
|
closeOnSelect?: boolean,
|
|
25
|
+
|
|
19
26
|
/** Forces Popover open for testing purposes. */
|
|
20
27
|
forceOpen?: boolean,
|
|
28
|
+
|
|
21
29
|
/** Externally control Popover open state on initial render. */
|
|
22
30
|
defaultOpen?: boolean,
|
|
31
|
+
|
|
23
32
|
/** Callback when Popover is opened. */
|
|
24
33
|
onOpen?: boolean,
|
|
34
|
+
|
|
25
35
|
/** Callback when Popover is closed. */
|
|
26
36
|
onClose?: boolean,
|
|
37
|
+
|
|
27
38
|
/** Overrides the default search function for selecting a dropdown item via keyboard. */
|
|
28
39
|
onSearch?: func,
|
|
29
|
-
|
|
40
|
+
|
|
41
|
+
/** Attempts to keep popover in view clipping edges if too large. */
|
|
42
|
+
keepInView?: boolean,
|
|
43
|
+
|
|
44
|
+
/** Locks external scrollbars when open. */
|
|
45
|
+
lockScrollWhileOpen?: boolean,
|
|
46
|
+
|
|
47
|
+
/** Matches anchor and popover widths. */
|
|
48
|
+
matchWidths?: boolean | 'minimum',
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* `'top-start'
|
|
52
|
+
| 'top'
|
|
53
|
+
| 'top-end'
|
|
54
|
+
| 'right-start'
|
|
55
|
+
| 'right'
|
|
56
|
+
| 'right-end'
|
|
57
|
+
| 'bottom-start'
|
|
58
|
+
| 'bottom'
|
|
59
|
+
| 'bottom-end'
|
|
60
|
+
| 'left-start'
|
|
61
|
+
| 'left'
|
|
62
|
+
| 'left-end'`
|
|
63
|
+
|
|
64
|
+
* Where to place the popover.
|
|
65
|
+
*/
|
|
66
|
+
placement?: string,
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Where to render the popover into. Accepts an HTML element or selector.
|
|
70
|
+
* Uses the closest fixed parent or `document.body` by default. This will only
|
|
71
|
+
* be computed once on initial render.
|
|
72
|
+
*/
|
|
73
|
+
renderTo?: HTMLElement | string,
|
|
74
|
+
|
|
75
|
+
/** Accepts any valid [Popover](/popover) props. */
|
|
30
76
|
popoverProps?: object,
|
|
31
77
|
}
|
|
32
78
|
|
|
@@ -169,7 +215,7 @@ class Dropdown extends Component<Props> {
|
|
|
169
215
|
'aria-haspopup': true,
|
|
170
216
|
'aria-expanded': isPopoverOpen,
|
|
171
217
|
[arrowIconOnly ? 'icon' : 'iconRight']: {
|
|
172
|
-
name: isPopoverOpen ? '
|
|
218
|
+
name: isPopoverOpen ? 'general.upCaret' : 'general.downCaret',
|
|
173
219
|
size: 'sm',
|
|
174
220
|
},
|
|
175
221
|
title: arrowIconOnly ? 'arrow down' : restProps.title,
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Dropdown
|
|
3
3
|
category: General
|
|
4
|
-
summary: A compact way of displaying content or actionable items in a popover. Use [Select](/select) for selectable options if needed.
|
|
4
|
+
summary: A compact way of displaying content or actionable items in a popover. Use [Select](/select) for selectable options if needed.
|
|
5
|
+
propsSummary: Accepts [Button](/button) and [Popover](/popover) props.
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
### Items
|
|
8
9
|
|
|
9
10
|
```jsx live
|
|
10
11
|
render(
|
|
11
|
-
<Dropdown icon={{ name: 'cog' }} title="Folder settings" variant="outline">
|
|
12
|
+
<Dropdown icon={{ name: 'general.cog' }} title="Folder settings" variant="outline">
|
|
12
13
|
<Dropdown.Item onSelect={() => console.log('edit folder')}>
|
|
13
14
|
Edit Folder
|
|
14
15
|
</Dropdown.Item>
|
package/src/Dropdown/Link.js
CHANGED
|
@@ -7,7 +7,9 @@ export const LINK_DISPLAY_NAME = 'Dropdown.Link'
|
|
|
7
7
|
export const LINK_DATA = 'link'
|
|
8
8
|
|
|
9
9
|
class Link extends Component {
|
|
10
|
-
|
|
10
|
+
// Graphql wasn't picking up the correct displayName when this was
|
|
11
|
+
// assigned to LINK_DISPLAY_NAME, but using a string works
|
|
12
|
+
static displayName = 'Dropdown.Link'
|
|
11
13
|
|
|
12
14
|
render() {
|
|
13
15
|
const { disabled, external, index, text, to, ...restProps } = this.props
|
|
@@ -1,15 +1,29 @@
|
|
|
1
|
+
// @flow
|
|
1
2
|
import React, { Children, useEffect, useState } from 'react'
|
|
2
3
|
|
|
3
4
|
import Button from '../Button'
|
|
4
5
|
import StackView from '../StackView'
|
|
5
6
|
import { useDocumentEvent, useFocus, useHover } from '../hooks'
|
|
7
|
+
import { useThemeProps } from '../system'
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
type Props = {
|
|
10
|
+
/** Renders any custom component or HTML element when not in the edit state. */
|
|
11
|
+
display?: React.ReactNode,
|
|
12
|
+
|
|
13
|
+
/** Renders any custom component or HTML element, usually form elments to capture user values. */
|
|
14
|
+
edit?: React.ReactNode,
|
|
15
|
+
|
|
16
|
+
/** Shows a spinner if true and then optimistically shows a checkmark when false again. */
|
|
17
|
+
loading?: boolean,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function EditActions({ display, edit, loading, ...restProps }: Props) {
|
|
8
21
|
const { focus, focusProps } = useFocus()
|
|
9
22
|
const { hover, hoverProps } = useHover()
|
|
10
23
|
const [on, setOn] = useState(false)
|
|
11
24
|
const [showCheck, setShowCheck] = useState(false)
|
|
12
25
|
const toggle = () => setOn((bool) => !bool)
|
|
26
|
+
const { buttonProps, ...themeProps } = useThemeProps('editActions', restProps)
|
|
13
27
|
|
|
14
28
|
useEffect(() => {
|
|
15
29
|
if (loading === false) {
|
|
@@ -35,14 +49,14 @@ function EditActions({ display, edit, loading, ...restProps }) {
|
|
|
35
49
|
onClick={on ? undefined : () => setOn(true)}
|
|
36
50
|
{...focusProps}
|
|
37
51
|
{...hoverProps}
|
|
38
|
-
{...
|
|
52
|
+
{...themeProps}
|
|
39
53
|
>
|
|
40
54
|
{Children.toArray(on ? edit : display)}
|
|
41
55
|
<Button
|
|
42
56
|
grow={0}
|
|
43
57
|
title={on ? 'Close' : 'Edit'}
|
|
44
58
|
icon={{
|
|
45
|
-
name: showCheck ? '
|
|
59
|
+
name: showCheck ? 'general.check' : on ? 'general.x' : 'general.pencil',
|
|
46
60
|
color: showCheck ? 'green' : undefined,
|
|
47
61
|
}}
|
|
48
62
|
tooltip={{
|
|
@@ -53,6 +67,7 @@ function EditActions({ display, edit, loading, ...restProps }) {
|
|
|
53
67
|
onClick={focus || on ? toggle : () => setOn(true)}
|
|
54
68
|
opacity={focus || hover || on ? 1 : 0}
|
|
55
69
|
spinner={on && loading ? { color: 'primary' } : undefined}
|
|
70
|
+
{...buttonProps}
|
|
56
71
|
/>
|
|
57
72
|
</StackView>
|
|
58
73
|
)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
title: EditActions
|
|
3
3
|
category: General
|
|
4
4
|
summary: Helper component that manages switching between initial and editing states of inline forms. It uses an optimisitic save that will render a checkmark after the loading prop has been set to `false`.
|
|
5
|
+
propsSummary: Accepts [StackView](/stackview) props.
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
```jsx live
|
package/src/Field/Field.js
CHANGED
|
@@ -9,6 +9,12 @@ import StackView from '../StackView'
|
|
|
9
9
|
import { cloneChildren, generateId } from '../utils'
|
|
10
10
|
|
|
11
11
|
type Props = {
|
|
12
|
+
/** Usually accepts form fields, such as `input` or `select`. */
|
|
13
|
+
children?: any,
|
|
14
|
+
|
|
15
|
+
/** Gain access to the internal ref. */
|
|
16
|
+
innerRef?: any,
|
|
17
|
+
|
|
12
18
|
/** Label that describes field[s]. */
|
|
13
19
|
label?: string | React.ReactNode,
|
|
14
20
|
|
|
@@ -24,6 +30,9 @@ type Props = {
|
|
|
24
30
|
/** Renders label and field[s] inline. */
|
|
25
31
|
inline?: boolean,
|
|
26
32
|
|
|
33
|
+
/** Renders label and field[s] smaller. */
|
|
34
|
+
compact?: boolean,
|
|
35
|
+
|
|
27
36
|
/** Renders content into a [HelperDrawer](/helperdrawer) next to label. */
|
|
28
37
|
helpContent?: string | React.ReactNode,
|
|
29
38
|
|
|
@@ -33,8 +42,14 @@ type Props = {
|
|
|
33
42
|
/** Controls spacing between fields. */
|
|
34
43
|
spacing?: number,
|
|
35
44
|
|
|
45
|
+
/** Controls distribution between fields, by [passing this prop to StackView](/stackview#distribution). (Defaults to "fill".) */
|
|
46
|
+
distribution?: number,
|
|
47
|
+
|
|
36
48
|
/** State of field[s]. */
|
|
37
49
|
state?: 'success' | 'error',
|
|
50
|
+
|
|
51
|
+
/** Places an icon to the left of the label. */
|
|
52
|
+
icon?: any,
|
|
38
53
|
}
|
|
39
54
|
|
|
40
55
|
class Field extends Component<Props> {
|
|
@@ -113,6 +128,7 @@ class Field extends Component<Props> {
|
|
|
113
128
|
order={inline ? 0 : 1}
|
|
114
129
|
grow={1}
|
|
115
130
|
marginTop={inline || !label ? undefined : 1}
|
|
131
|
+
maxWidth="100%"
|
|
116
132
|
spacing={spacing}
|
|
117
133
|
>
|
|
118
134
|
{cloneChildren(children, (child, { firstChild }) =>
|
package/src/Field/Field.mdx
CHANGED
package/src/FieldSet/FieldSet.js
CHANGED
|
@@ -5,8 +5,16 @@ import Heading from '../Heading'
|
|
|
5
5
|
import StackView from '../StackView'
|
|
6
6
|
import TileView from '../TileView'
|
|
7
7
|
import Toolbar from '../Toolbar'
|
|
8
|
+
import { useThemeProps } from '../system'
|
|
8
9
|
|
|
9
10
|
type Props = {
|
|
11
|
+
children?: any,
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Accepts any valid [Heading](/heading) props.
|
|
15
|
+
*/
|
|
16
|
+
headingProps?: object,
|
|
17
|
+
|
|
10
18
|
/**
|
|
11
19
|
* Maps to internal `Toolbar` prop.
|
|
12
20
|
*/
|
|
@@ -26,28 +34,44 @@ type Props = {
|
|
|
26
34
|
* Maps to internal `TileView` prop.
|
|
27
35
|
*/
|
|
28
36
|
spacing: number,
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Accepts any valid [TileView](/tileview) props.
|
|
40
|
+
*/
|
|
41
|
+
tileViewProps?: object,
|
|
29
42
|
}
|
|
30
43
|
|
|
31
|
-
function FieldSet({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
44
|
+
function FieldSet({ children, helpContent, legend, ...restProps }: Props) {
|
|
45
|
+
const {
|
|
46
|
+
headingProps,
|
|
47
|
+
tileViewProps,
|
|
48
|
+
spacing = 1,
|
|
49
|
+
minCellWidth = 16,
|
|
50
|
+
...themeProps
|
|
51
|
+
} = useThemeProps('fieldset', { ...restProps })
|
|
52
|
+
|
|
39
53
|
return (
|
|
40
|
-
<StackView
|
|
54
|
+
<StackView
|
|
55
|
+
as="fieldset"
|
|
56
|
+
padding={0}
|
|
57
|
+
margin={2}
|
|
58
|
+
{...themeProps}
|
|
59
|
+
{...restProps}
|
|
60
|
+
>
|
|
41
61
|
<Toolbar
|
|
42
62
|
title={
|
|
43
|
-
<Heading as="legend" level={4}>
|
|
63
|
+
<Heading as="legend" level={4} {...headingProps}>
|
|
44
64
|
{legend}
|
|
45
65
|
</Heading>
|
|
46
66
|
}
|
|
47
67
|
helpContent={helpContent}
|
|
48
68
|
marginBottom={1}
|
|
49
69
|
/>
|
|
50
|
-
<TileView
|
|
70
|
+
<TileView
|
|
71
|
+
minCellWidth={minCellWidth}
|
|
72
|
+
spacing={spacing}
|
|
73
|
+
{...tileViewProps}
|
|
74
|
+
>
|
|
51
75
|
{children}
|
|
52
76
|
</TileView>
|
|
53
77
|
</StackView>
|
|
@@ -59,7 +59,10 @@ export function FilterLayout(props: Props) {
|
|
|
59
59
|
radius={0}
|
|
60
60
|
title="Filter"
|
|
61
61
|
aria-label={sidebarOpen ? 'close filter' : 'open filter'}
|
|
62
|
-
iconRight={{
|
|
62
|
+
iconRight={{
|
|
63
|
+
name: sidebarOpen ? 'general.leftChevron' : 'general.threeReducingHorizontalBars',
|
|
64
|
+
size: sidebarOpen ? 'xs' : 'md'
|
|
65
|
+
}}
|
|
63
66
|
onClick={toggleSidebar}
|
|
64
67
|
/>
|
|
65
68
|
<Box visible={!(sidebarOpen && fill)} grow={1} shrink={1}>
|
package/src/Form/Form.js
CHANGED
|
@@ -130,7 +130,7 @@ class Form extends React.Component<Props> {
|
|
|
130
130
|
...this.state,
|
|
131
131
|
editButtonProps: {
|
|
132
132
|
disabled: isSubmitting,
|
|
133
|
-
icon: isEditing ? undefined : { name: 'pencil' },
|
|
133
|
+
icon: isEditing ? undefined : { name: 'general.pencil' },
|
|
134
134
|
onClick: () => {
|
|
135
135
|
// bail out if we've already triggered a submit in onBlur
|
|
136
136
|
if (this.submitTimeoutId === null) {
|
package/src/Form/Form.mdx
CHANGED
|
@@ -7,31 +7,33 @@ category: Forms
|
|
|
7
7
|
render(() => {
|
|
8
8
|
const [value, setValue] = React.useState({ name: "Dave's Band Tag Team" })
|
|
9
9
|
return (
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
10
|
+
<ThemeProvider theme={{ icons }}>
|
|
11
|
+
<Form
|
|
12
|
+
initialPayload={value}
|
|
13
|
+
onSubmit={(payload, complete) => {
|
|
14
|
+
setTimeout(() => {
|
|
15
|
+
setValue(payload)
|
|
16
|
+
complete()
|
|
17
|
+
}, 1600)
|
|
18
|
+
}}
|
|
19
|
+
>
|
|
20
|
+
{({ editButtonProps, getFieldProps }) => (
|
|
21
|
+
<StackView
|
|
22
|
+
minWidth={64}
|
|
23
|
+
padding={2}
|
|
24
|
+
spacing={1}
|
|
25
|
+
backgroundColor="primary-light"
|
|
26
|
+
>
|
|
27
|
+
<StackView axis="horizontal" alignment="center" spacing={1}>
|
|
28
|
+
<Input.Inline fontSize={0} light {...getFieldProps('name')} />
|
|
29
|
+
<Button size="xs" theme="light" {...editButtonProps} />
|
|
30
|
+
<Icon name="services.split" size="md" color="light-6" />
|
|
31
|
+
<Icon name="services.tag" size="md" color="light-6" />
|
|
32
|
+
</StackView>
|
|
31
33
|
</StackView>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
</
|
|
34
|
+
)}
|
|
35
|
+
</Form>
|
|
36
|
+
</ThemeProvider>
|
|
35
37
|
)
|
|
36
38
|
})
|
|
37
39
|
```
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: GridView
|
|
3
3
|
category: Layout
|
|
4
|
-
summary: Lay out children in columns and rows. Wraps CSS grid styles in a simple API.
|
|
4
|
+
summary: Lay out children in columns and rows. Wraps CSS grid styles in a simple API. To learn more about how you can use CSS grid visit [learncssgrid.com](https://learncssgrid.com/).
|
|
5
|
+
propsSummary: Accepts all valid HTML attributes.
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
```jsx live
|
|
@@ -5,6 +5,7 @@ import * as React from 'react'
|
|
|
5
5
|
|
|
6
6
|
import { BoxProps } from '../Box'
|
|
7
7
|
import splitStyles from '../system/split-styles'
|
|
8
|
+
import { spacingValue } from '../system'
|
|
8
9
|
import { MediaQueries, Variants } from '../index'
|
|
9
10
|
import { useVariant } from '../VariantProvider'
|
|
10
11
|
|
|
@@ -64,19 +65,25 @@ const gridViewPlugin = {
|
|
|
64
65
|
styles.justifyItems = distribution
|
|
65
66
|
}
|
|
66
67
|
if (columnSpacing !== undefined && styles.gridColumnGap === undefined) {
|
|
67
|
-
styles.gridColumnGap = columnSpacing
|
|
68
|
+
styles.gridColumnGap = spacingValue(columnSpacing)
|
|
68
69
|
}
|
|
69
70
|
if (rowSpacing !== undefined && styles.gridRowGap === undefined) {
|
|
70
|
-
styles.gridRowGap = rowSpacing
|
|
71
|
+
styles.gridRowGap = spacingValue(rowSpacing)
|
|
71
72
|
}
|
|
72
|
-
if (spacing !== undefined && styles.
|
|
73
|
-
styles.
|
|
73
|
+
if (spacing !== undefined && styles.gap === undefined) {
|
|
74
|
+
styles.gap = spacingValue(spacing)
|
|
74
75
|
}
|
|
75
76
|
return styles
|
|
76
77
|
},
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
export type GridViewProps = {
|
|
81
|
+
/** Any direct children can use the `column|Start|End` or `row|Start|End` [shorthand properties](/style-props#grid) to place themselves on the grid. */
|
|
82
|
+
children?: any
|
|
83
|
+
|
|
84
|
+
/** Render custom component or HTML element tag. (Defaults to a `<div>` element). */
|
|
85
|
+
as?: any
|
|
86
|
+
|
|
80
87
|
/** The algorithm used to implicitly place grid items. Maps to CSS [gridAutoFlow](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-flow) property. */
|
|
81
88
|
autoFlow?: 'column' | 'row' | 'dense'
|
|
82
89
|
|
|
@@ -89,20 +96,32 @@ export type GridViewProps = {
|
|
|
89
96
|
/** The columns of the grid. Maps to CSS [gridTemplateColumns](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns) property. */
|
|
90
97
|
columns?: Array<any> | string
|
|
91
98
|
|
|
99
|
+
/** If true, sets `display: inline-grid`, otherwise it defaults to `display: grid` */
|
|
100
|
+
inline?: boolean
|
|
101
|
+
|
|
102
|
+
/** Gain access to the internal ref */
|
|
103
|
+
innerRef?: any
|
|
104
|
+
|
|
92
105
|
/** The rows of the grid. Maps to CSS [gridTemplateRows](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-rows) property. */
|
|
93
106
|
rows?: Array<any> | string
|
|
94
107
|
|
|
95
108
|
/** Aligns content in a grid item along the column axis. Maps to CSS [alignItems](https://developer.mozilla.org/en-US/docs/Web/CSS/align-items) property. */
|
|
96
109
|
alignment?: 'start' | 'end' | 'center' | 'stretch'
|
|
97
110
|
|
|
98
|
-
/** The amount of space between children. Maps to CSS [
|
|
99
|
-
spacing?: number
|
|
111
|
+
/** The amount of space between children. Maps to CSS [gap](https://developer.mozilla.org/en-US/docs/Web/CSS/gap) property. */
|
|
112
|
+
spacing?: number | string
|
|
100
113
|
|
|
101
114
|
/** The amount of space between columns. Maps to CSS [gridColumnGap](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-column-gap) property. */
|
|
102
|
-
columnSpacing?: number
|
|
115
|
+
columnSpacing?: number | string
|
|
103
116
|
|
|
104
117
|
/** The amount of space between rows. Maps to CSS [gridRowGap](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-row-gap) property. */
|
|
105
|
-
rowSpacing?: number
|
|
118
|
+
rowSpacing?: number | string
|
|
119
|
+
|
|
120
|
+
/** Describes styles at various points in time. [Read about variants](/variants).*/
|
|
121
|
+
variants?: object
|
|
122
|
+
|
|
123
|
+
/** Describes props at different breakpoints. [Read about mediaQueries](/responsive). */
|
|
124
|
+
mediaQueries?: object
|
|
106
125
|
} & BoxProps
|
|
107
126
|
|
|
108
127
|
type Props = React.RefAttributes<any> &
|
package/src/Group/Group.mdx
CHANGED
|
@@ -2,24 +2,25 @@
|
|
|
2
2
|
title: Group
|
|
3
3
|
category: General
|
|
4
4
|
summary: Used to lay out groups of elements like cards, buttons, and/or inputs.
|
|
5
|
+
propsSummary: Accepts [StackView](/stackview) props.
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
```jsx live
|
|
8
9
|
render(
|
|
9
10
|
<Group>
|
|
10
11
|
<Button
|
|
11
|
-
icon={{ name: '
|
|
12
|
+
icon={{ name: 'general.envelope' }}
|
|
12
13
|
tooltip={{ title: 'Email' }}
|
|
13
14
|
variant="outline"
|
|
14
15
|
/>
|
|
15
16
|
<Button
|
|
16
|
-
icon={{ name: '
|
|
17
|
+
icon={{ name: 'general.printer' }}
|
|
17
18
|
tooltip={{ title: 'Print' }}
|
|
18
19
|
variant="outline"
|
|
19
20
|
/>
|
|
20
21
|
<Button
|
|
21
|
-
icon={{ name: '
|
|
22
|
-
tooltip={{ title: '
|
|
22
|
+
icon={{ name: 'general.thickToBottomArrow' }}
|
|
23
|
+
tooltip={{ title: 'Download' }}
|
|
23
24
|
variant="outline"
|
|
24
25
|
/>
|
|
25
26
|
</Group>
|
|
@@ -40,7 +41,7 @@ render(
|
|
|
40
41
|
color="grey-8"
|
|
41
42
|
subdued
|
|
42
43
|
>
|
|
43
|
-
<Icon name="
|
|
44
|
+
<Icon name="general.outlinedInfoCircle" size="sm" color="grey-6" marginRight={2} />
|
|
44
45
|
<Text>
|
|
45
46
|
David is an <Link to="#">Organization Administrator</Link> with full
|
|
46
47
|
Administrator permission everywhere.
|
|
@@ -60,7 +61,7 @@ render(
|
|
|
60
61
|
<Group size="md">
|
|
61
62
|
<Button title="Email" variant="outline" />
|
|
62
63
|
<Button
|
|
63
|
-
icon={{ name: '
|
|
64
|
+
icon={{ name: 'general.printer', color: 'foregroundSecondary' }}
|
|
64
65
|
tooltip={{ title: 'Print' }}
|
|
65
66
|
/>
|
|
66
67
|
</Group>
|
|
@@ -72,7 +73,7 @@ render(
|
|
|
72
73
|
render(
|
|
73
74
|
<Group radius={0} size="lg">
|
|
74
75
|
<Input placeholder="Search things..." />
|
|
75
|
-
<Button icon={{ name: 'search' }} tooltip={{ title: 'Search' }} />
|
|
76
|
+
<Button icon={{ name: 'general.search' }} tooltip={{ title: 'Search' }} />
|
|
76
77
|
</Group>
|
|
77
78
|
)
|
|
78
79
|
```
|
package/src/Group/Group.tsx
CHANGED
|
@@ -40,12 +40,17 @@ export function Group({
|
|
|
40
40
|
const startRadius = isHorizontalLayout ? 'radiusLeft' : 'radiusTop'
|
|
41
41
|
const endRadius = isHorizontalLayout ? 'radiusRight' : 'radiusBottom'
|
|
42
42
|
|
|
43
|
+
const marginBottom = isHorizontalLayout ? 0 : '-1px'
|
|
44
|
+
const marginRight = isHorizontalLayout ? '-1px' : 0
|
|
45
|
+
|
|
43
46
|
return (
|
|
44
|
-
<StackView axis={axis}
|
|
47
|
+
<StackView axis={axis} {...restProps}>
|
|
45
48
|
{cloneChildren(children, (child, { firstChild, lastChild }) => ({
|
|
46
49
|
...childProps,
|
|
47
50
|
[startRadius]: firstChild ? radiusValue : 0,
|
|
48
51
|
[endRadius]: lastChild ? radiusValue : 0,
|
|
52
|
+
...(!lastChild && { marginBottom }),
|
|
53
|
+
...(!lastChild && { marginRight }),
|
|
49
54
|
}))}
|
|
50
55
|
</StackView>
|
|
51
56
|
)
|
package/src/Heading/Heading.js
CHANGED
|
@@ -5,8 +5,12 @@ import Text from '../Text'
|
|
|
5
5
|
import { useThemeValue } from '../system'
|
|
6
6
|
|
|
7
7
|
type Props = {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
children?: any,
|
|
9
|
+
|
|
10
|
+
/** Sets the heading tag (1-6) and the respective font size corresponding to the index position (level - 1) in theme `fontSizes`
|
|
11
|
+
* `1 | 2 | 3 | 4 | 5 | 6`
|
|
12
|
+
*/
|
|
13
|
+
level?: number,
|
|
10
14
|
}
|
|
11
15
|
|
|
12
16
|
function Heading({ level = 1, ...restProps }: Props) {
|
package/src/Heading/Heading.mdx
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
// @flow
|
|
1
2
|
import React from 'react'
|
|
2
3
|
|
|
3
4
|
import Text from '../Text'
|
|
4
|
-
import {
|
|
5
|
+
import { useThemeProps } from '../system'
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
type Props = {
|
|
8
|
+
children?: any,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function HeadingUppercase({ children, ...restProps }: Props) {
|
|
12
|
+
const themeProps = useThemeProps('HeadingUppercase', restProps)
|
|
8
13
|
return (
|
|
9
14
|
<Text
|
|
10
15
|
as="span"
|
|
@@ -15,8 +20,7 @@ function HeadingUppercase({ children, ...restProps }) {
|
|
|
15
20
|
color="foregroundSecondary"
|
|
16
21
|
shrink={0}
|
|
17
22
|
margin={0}
|
|
18
|
-
{...
|
|
19
|
-
{...restProps}
|
|
23
|
+
{...themeProps}
|
|
20
24
|
>
|
|
21
25
|
{children}
|
|
22
26
|
</Text>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @flow
|
|
1
2
|
/** @jsxRuntime classic */
|
|
2
3
|
/** @jsx jsx */
|
|
3
4
|
import { jsx } from '@emotion/core'
|
|
@@ -22,7 +23,7 @@ function Toggle({ drawerId, ...restProps }) {
|
|
|
22
23
|
)
|
|
23
24
|
return (
|
|
24
25
|
<Button
|
|
25
|
-
icon={{ name: '
|
|
26
|
+
icon={{ name: 'general.outlinedInfoCircle' }}
|
|
26
27
|
tooltip={{ title: 'More info' }}
|
|
27
28
|
size="xs"
|
|
28
29
|
theme={false}
|
|
@@ -35,7 +36,14 @@ function Toggle({ drawerId, ...restProps }) {
|
|
|
35
36
|
)
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
type Props = {
|
|
40
|
+
children?: any,
|
|
41
|
+
|
|
42
|
+
/** Used by the `HelperDrawer.Toggle` to connect to. */
|
|
43
|
+
id?: string | number,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function HelperDrawer({ children, id, ...restProps }: Props) {
|
|
39
47
|
const [open, setOpen] = useState(false)
|
|
40
48
|
useEffect(() => {
|
|
41
49
|
drawerToggles[id] = () => setOpen((open) => !open)
|