@planningcenter/tapestry-react 1.4.0 → 2.0.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/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 +4 -4
- 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/useCollapsibleRows.js +1 -1
- 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/Dropdown.test.js +194 -19
- package/dist/cjs/Dropdown/Link.js +3 -1
- package/dist/cjs/EditActions/EditActions.js +9 -3
- 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 +10 -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 +1 -0
- package/dist/cjs/Modal/Modal.test.js +156 -0
- package/dist/cjs/Pagination/Pagination.js +4 -2
- package/dist/cjs/Popover/Popover.js +4 -0
- package/dist/cjs/Popover/Popover.test.js +65 -0
- package/dist/cjs/Popover/rewireTabOrder.js +13 -30
- 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 +10 -1
- package/dist/cjs/Sidebar/Sidebar.js +4 -3
- 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 +4 -6
- package/dist/cjs/Tabs/Tab.js +1 -0
- package/dist/cjs/ThemeProvider/ThemeProvider.js +5 -5
- 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/hooks/useConstant.js +23 -0
- package/dist/cjs/system/default-theme.js +8 -3
- package/dist/cjs/system/utils.js +2 -2
- package/dist/cjs/utils.js +3 -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/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 +4 -4
- 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/useCollapsibleRows.js +1 -1
- 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/Dropdown.test.js +158 -17
- package/dist/esm/Dropdown/Link.js +3 -1
- package/dist/esm/EditActions/EditActions.js +8 -3
- 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 +10 -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 +1 -0
- package/dist/esm/Modal/Modal.test.js +122 -0
- package/dist/esm/Pagination/Pagination.js +4 -2
- package/dist/esm/Popover/Popover.js +4 -0
- package/dist/esm/Popover/Popover.test.js +51 -0
- package/dist/esm/Popover/rewireTabOrder.js +13 -33
- 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 +10 -1
- package/dist/esm/Sidebar/Sidebar.js +4 -2
- 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 +2 -3
- package/dist/esm/Tabs/Tab.js +1 -0
- package/dist/esm/ThemeProvider/ThemeProvider.js +1 -1
- 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/hooks/useConstant.js +15 -0
- package/dist/esm/system/default-theme.js +6 -2
- package/dist/esm/system/utils.js +1 -1
- package/dist/esm/utils.js +3 -3
- 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/Dropdown/Dropdown.test.d.ts +1 -1
- package/dist/types/GridView/GridView.d.ts +16 -4
- package/dist/types/Group/Group.d.ts +5 -1
- package/dist/types/Modal/Modal.test.d.ts +1 -0
- package/dist/types/Popover/Popover.test.d.ts +1 -0
- 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/dist/types/hooks/useConstant.d.ts +1 -0
- package/package.json +16 -24
- 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 +11 -0
- 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 +1 -0
- package/src/ChurchCenterStatus/ChurchCenterStatus.tsx +4 -4
- 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/useCollapsibleRows.js +1 -1
- 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/Dropdown.test.tsx +128 -17
- 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 +15 -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 +12 -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 +1 -0
- 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/Modal/Modal.test.tsx +113 -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/Popover/Popover.test.tsx +62 -0
- package/src/Popover/Popover.tsx +3 -0
- package/src/Popover/rewireTabOrder.ts +24 -42
- 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 +69 -2
- package/src/Select/Select.mdx +1 -0
- package/src/Sidebar/Sidebar.js +14 -6
- 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 +2 -3
- 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/ThemeProvider/ThemeProvider.tsx +1 -1
- 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/hooks/useConstant.ts +17 -0
- package/src/system/default-theme.ts +7 -2
- package/src/system/utils.js +1 -1
- package/src/utils.js +3 -3
- package/src/utils.test.js +29 -0
- package/dist/cjs/icons.js +0 -126
- package/dist/esm/icons.js +0 -121
- package/src/icons.js +0 -121
|
@@ -4,6 +4,7 @@ import { clamp, snap } from '@popmotion/popcorn'
|
|
|
4
4
|
|
|
5
5
|
import Box from '../Box'
|
|
6
6
|
import { useMeasure } from '../hooks'
|
|
7
|
+
import { useThemeProps } from '../system'
|
|
7
8
|
|
|
8
9
|
export type Props = {
|
|
9
10
|
/**
|
|
@@ -34,6 +35,10 @@ export type Props = {
|
|
|
34
35
|
progress?: Object,
|
|
35
36
|
thumb?: Object,
|
|
36
37
|
},
|
|
38
|
+
/**
|
|
39
|
+
* Prevents the slider from being used and lowers its opacity.
|
|
40
|
+
*/
|
|
41
|
+
disabled?: boolean,
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
function RangeSlider(props: Props) {
|
|
@@ -44,10 +49,14 @@ function RangeSlider(props: Props) {
|
|
|
44
49
|
disabled,
|
|
45
50
|
value,
|
|
46
51
|
onChange,
|
|
47
|
-
variant = {},
|
|
48
52
|
...restProps
|
|
49
53
|
} = props
|
|
50
54
|
|
|
55
|
+
const { variant = {}, ...themeProps } = useThemeProps(
|
|
56
|
+
'rangeSlider',
|
|
57
|
+
restProps
|
|
58
|
+
)
|
|
59
|
+
|
|
51
60
|
const snapTo = snap(step)
|
|
52
61
|
const sliderRef = useRef()
|
|
53
62
|
const trackRef = useRef()
|
|
@@ -185,7 +194,7 @@ function RangeSlider(props: Props) {
|
|
|
185
194
|
opacity={disabled ? 0.65 : undefined}
|
|
186
195
|
onMouseDown={disabled ? undefined : handleTrackPointerDown}
|
|
187
196
|
onTouchStart={disabled ? undefined : handleTrackPointerDown}
|
|
188
|
-
{...
|
|
197
|
+
{...themeProps}
|
|
189
198
|
>
|
|
190
199
|
<Box
|
|
191
200
|
innerRef={trackRef}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
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
|
+
propsSummary: Accepts [Box](/box) props.
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
```jsx live
|
|
@@ -9,16 +10,18 @@ render(() => {
|
|
|
9
10
|
const [volume, setVolume] = React.useState(50)
|
|
10
11
|
const muted = volume === 0
|
|
11
12
|
return (
|
|
12
|
-
<
|
|
13
|
-
<
|
|
14
|
-
<Icon
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
<ThemeProvider theme={{ icons }}>
|
|
14
|
+
<StackView axis="horizontal" alignment="center" width="25%" spacing={1}>
|
|
15
|
+
<Icon>
|
|
16
|
+
<Icon.Path name="services.volume0" />
|
|
17
|
+
<Icon.Path name="services.volume1" visible={muted} />
|
|
18
|
+
<Icon.Path name="services.volume2" visible={!muted} />
|
|
19
|
+
<Icon.Path name="services.volume3" visible={!muted && volume > 50} />
|
|
20
|
+
</Icon>
|
|
21
|
+
<RangeSlider value={volume} onChange={setVolume} />
|
|
22
|
+
<Text>{volume}</Text>
|
|
23
|
+
</StackView>
|
|
24
|
+
</ThemeProvider>
|
|
22
25
|
)
|
|
23
26
|
})
|
|
24
27
|
```
|
package/src/Scrim/Scrim.mdx
CHANGED
package/src/Scrim/Scrim.tsx
CHANGED
|
@@ -2,7 +2,13 @@ import * as React from 'react'
|
|
|
2
2
|
|
|
3
3
|
import StackView from '../StackView'
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
type ScrimProps = {
|
|
6
|
+
/** Gain access to the internal ref. */
|
|
7
|
+
ref?: any,
|
|
8
|
+
children?: any,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const Scrim = React.forwardRef(function (props: ScrimProps,) {
|
|
6
12
|
React.useLayoutEffect(() => {
|
|
7
13
|
document.body.style.overflow = 'hidden'
|
|
8
14
|
return () => {
|
|
@@ -11,7 +17,7 @@ const Scrim = React.forwardRef(function (props, ref) {
|
|
|
11
17
|
}, [])
|
|
12
18
|
return (
|
|
13
19
|
<StackView
|
|
14
|
-
innerRef={ref}
|
|
20
|
+
innerRef={props.ref}
|
|
15
21
|
position="fixed"
|
|
16
22
|
top={0}
|
|
17
23
|
right={0}
|
package/src/Section/Section.js
CHANGED
|
@@ -5,6 +5,7 @@ import type { ChildrenArray } from 'react'
|
|
|
5
5
|
import Heading from '../Heading'
|
|
6
6
|
import Toolbar from '../Toolbar'
|
|
7
7
|
import StackView from '../StackView'
|
|
8
|
+
import { useThemeProps } from '../system'
|
|
8
9
|
|
|
9
10
|
import type { ToolbarProps } from '../Toolbar'
|
|
10
11
|
|
|
@@ -16,17 +17,27 @@ function Section({
|
|
|
16
17
|
actions = [],
|
|
17
18
|
children,
|
|
18
19
|
count,
|
|
19
|
-
countColor,
|
|
20
20
|
helpContent,
|
|
21
21
|
onStatusClearRequest,
|
|
22
22
|
status,
|
|
23
23
|
title,
|
|
24
24
|
...restProps
|
|
25
25
|
}: SectionProps) {
|
|
26
|
+
const {
|
|
27
|
+
countColor,
|
|
28
|
+
headingProps,
|
|
29
|
+
toolbarProps,
|
|
30
|
+
...themeProps
|
|
31
|
+
} = useThemeProps('section', restProps)
|
|
32
|
+
|
|
26
33
|
return (
|
|
27
|
-
<StackView as="section" {...
|
|
34
|
+
<StackView as="section" {...themeProps}>
|
|
28
35
|
<Toolbar
|
|
29
|
-
title={
|
|
36
|
+
title={
|
|
37
|
+
<Heading level={3} {...headingProps}>
|
|
38
|
+
{title}
|
|
39
|
+
</Heading>
|
|
40
|
+
}
|
|
30
41
|
helpContent={helpContent}
|
|
31
42
|
actions={actions}
|
|
32
43
|
count={count}
|
|
@@ -34,6 +45,7 @@ function Section({
|
|
|
34
45
|
status={status}
|
|
35
46
|
onStatusClearRequest={onStatusClearRequest}
|
|
36
47
|
marginBottom={2}
|
|
48
|
+
{...toolbarProps}
|
|
37
49
|
/>
|
|
38
50
|
{children}
|
|
39
51
|
</StackView>
|
package/src/Section/Section.mdx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: SegmentedControl
|
|
3
3
|
category: General
|
|
4
|
+
propsSummary: Accepts [Input.Inputbox](/input.inputbox) props.
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
```jsx live
|
|
@@ -61,8 +62,8 @@ render(
|
|
|
61
62
|
<SegmentedControl
|
|
62
63
|
color="default"
|
|
63
64
|
segments={[
|
|
64
|
-
{ title: 'Table', icon: { name: '
|
|
65
|
-
{ title: 'Grid', icon: { name: '
|
|
65
|
+
{ title: 'Table', icon: { name: 'general.showEye' }, tooltip: { title: 'Show' } },
|
|
66
|
+
{ title: 'Grid', icon: { name: 'general.hideEye' }, tooltip: { title: 'Hide' } },
|
|
66
67
|
]}
|
|
67
68
|
onChange={(selected) => console.log(selected)}
|
|
68
69
|
/>
|
package/src/Select/Option.js
CHANGED
package/src/Select/Select.js
CHANGED
|
@@ -27,6 +27,14 @@ type Props = {
|
|
|
27
27
|
* The value to show when nothing is selected
|
|
28
28
|
*/
|
|
29
29
|
emptyValue?: any,
|
|
30
|
+
/**
|
|
31
|
+
* Disables the select.
|
|
32
|
+
*/
|
|
33
|
+
disabled?: boolean,
|
|
34
|
+
/**
|
|
35
|
+
* Gain access to the internal ref
|
|
36
|
+
*/
|
|
37
|
+
innerRef?: any,
|
|
30
38
|
/**
|
|
31
39
|
* Controls the initial Popover state: open or closed (default).
|
|
32
40
|
*/
|
|
@@ -46,6 +54,24 @@ type Props = {
|
|
|
46
54
|
* returns { value, selectedValue }
|
|
47
55
|
*/
|
|
48
56
|
onChange?: Function,
|
|
57
|
+
/**
|
|
58
|
+
* Maps to the select's `onFocus` prop.
|
|
59
|
+
*/
|
|
60
|
+
onFocus?: () => null,
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Maps to the select's `onBlur` prop.
|
|
64
|
+
*/
|
|
65
|
+
onBlur?: () => null,
|
|
66
|
+
onClick?: Function,
|
|
67
|
+
onMouseUp?: Funtion,
|
|
68
|
+
onMouseDown?: Funtion,
|
|
69
|
+
onKeyUp?: Funtion,
|
|
70
|
+
onKeyDown?: Funtion,
|
|
71
|
+
/**
|
|
72
|
+
* Usually accepts `Select.OptionGroup` and `Select.Option`.
|
|
73
|
+
*/
|
|
74
|
+
children?: any,
|
|
49
75
|
/**
|
|
50
76
|
* Pass an object instead of `children` for use when rendering in a non React environment.
|
|
51
77
|
*/
|
|
@@ -74,6 +100,41 @@ type Props = {
|
|
|
74
100
|
* Initial `value` when component is uncontrolled.
|
|
75
101
|
*/
|
|
76
102
|
defaultValue?: boolean | string | number | Array<any> | Function,
|
|
103
|
+
/**
|
|
104
|
+
* Locks external scrollbars when open.
|
|
105
|
+
*/
|
|
106
|
+
lockScrollWhileOpen?: boolean,
|
|
107
|
+
/**
|
|
108
|
+
* Matches anchor and popover widths.
|
|
109
|
+
*/
|
|
110
|
+
matchWidths?: boolean | 'minimum',
|
|
111
|
+
/**
|
|
112
|
+
* Attempts to keep popover in view clipping edges if too large.
|
|
113
|
+
*/
|
|
114
|
+
keepInView?: boolean,
|
|
115
|
+
/**
|
|
116
|
+
* `'top-start'
|
|
117
|
+
| 'top'
|
|
118
|
+
| 'top-end'
|
|
119
|
+
| 'right-start'
|
|
120
|
+
| 'right'
|
|
121
|
+
| 'right-end'
|
|
122
|
+
| 'bottom-start'
|
|
123
|
+
| 'bottom'
|
|
124
|
+
| 'bottom-end'
|
|
125
|
+
| 'left-start'
|
|
126
|
+
| 'left'
|
|
127
|
+
| 'left-end'`
|
|
128
|
+
|
|
129
|
+
* Where to place the popover.
|
|
130
|
+
*/
|
|
131
|
+
placement?: string,
|
|
132
|
+
/**
|
|
133
|
+
* Where to render the popover into. Accepts an HTML element or selector.
|
|
134
|
+
* Uses the closest fixed parent or `document.body` by default. This will only
|
|
135
|
+
* be computed once on initial render.
|
|
136
|
+
*/
|
|
137
|
+
renderTo?: HTMLElement | string,
|
|
77
138
|
/**
|
|
78
139
|
* Accepts any valid [Popover](/popover) props.
|
|
79
140
|
*/
|
|
@@ -386,6 +447,12 @@ class Select extends Component<Props> {
|
|
|
386
447
|
selectHighlightedItem()
|
|
387
448
|
}
|
|
388
449
|
break
|
|
450
|
+
case 'Escape':
|
|
451
|
+
if (isPopoverOpen && !isPopoverVisible) {
|
|
452
|
+
event.preventDefault()
|
|
453
|
+
this.closePopover()
|
|
454
|
+
}
|
|
455
|
+
break
|
|
389
456
|
case ' ':
|
|
390
457
|
event.preventDefault()
|
|
391
458
|
if (getHighlightedIndex() === null) {
|
|
@@ -521,8 +588,8 @@ class Select extends Component<Props> {
|
|
|
521
588
|
<Icon
|
|
522
589
|
name={
|
|
523
590
|
isPopoverVisible
|
|
524
|
-
? '
|
|
525
|
-
: '
|
|
591
|
+
? 'general.upCaret'
|
|
592
|
+
: 'general.downCaret'
|
|
526
593
|
}
|
|
527
594
|
/>
|
|
528
595
|
}
|
package/src/Select/Select.mdx
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
title: Select
|
|
3
3
|
category: Forms
|
|
4
4
|
summary: Provide a list of options that can be selected. Replaces native select menus by using aria roles to enhance accessibility while allowing full customization of the options and what is used in the select popover. Composes [InputBox](/inputbox) and [Popover](/popover).
|
|
5
|
+
propsSummary: Accepts [InputBox](/input.inputbox) props.
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
```jsx live
|
package/src/Sidebar/Sidebar.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
// @flow
|
|
1
2
|
/** @jsxRuntime classic */
|
|
2
3
|
/** @jsx jsx */
|
|
3
4
|
import { jsx } from '@emotion/core'
|
|
4
5
|
import { Children } from 'react'
|
|
5
6
|
import StickyBox from 'react-sticky-box'
|
|
6
|
-
import warning from 'warning'
|
|
7
7
|
|
|
8
8
|
import { css } from '../system'
|
|
9
9
|
import StackView from '../StackView'
|
|
@@ -13,7 +13,12 @@ import SidebarItem from './SidebarItem'
|
|
|
13
13
|
|
|
14
14
|
const flexColumnCss = css({ display: 'flex', flexDirection: 'column' })
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
type Props = {
|
|
17
|
+
/** Only accepts `Sidebar.List` and `Sidebar.Item` components. */
|
|
18
|
+
children?: React.ReactNode,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function Sidebar({ children, ...restProps }: Props) {
|
|
17
22
|
return (
|
|
18
23
|
<StackView
|
|
19
24
|
grow={1}
|
|
@@ -24,11 +29,14 @@ function Sidebar({ children, ...restProps }) {
|
|
|
24
29
|
>
|
|
25
30
|
<StickyBox css={flexColumnCss}>
|
|
26
31
|
{Children.map(children, (child) => {
|
|
27
|
-
|
|
32
|
+
if (
|
|
28
33
|
(child && child.type !== Sidebar.List) ||
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
(child && child.type !== Sidebar.Item)
|
|
35
|
+
) {
|
|
36
|
+
console.warn(
|
|
37
|
+
`Invalid component nesting. ${child.type} cannot appear as a child of <Sidebar>. Only <Sidebar.List/> or <Sidebar.Item/> may be used.`
|
|
38
|
+
)
|
|
39
|
+
}
|
|
32
40
|
return child
|
|
33
41
|
})}
|
|
34
42
|
</StickyBox>
|
package/src/Sidebar/Sidebar.mdx
CHANGED
|
@@ -42,7 +42,7 @@ function SortableItem({
|
|
|
42
42
|
>
|
|
43
43
|
{!readOnly && (
|
|
44
44
|
<Box {...provided.dragHandleProps} marginRight={1}>
|
|
45
|
-
<Icon name="
|
|
45
|
+
<Icon name="general.dragHandle" size="sm" color="foregroundTertiary" />
|
|
46
46
|
</Box>
|
|
47
47
|
)}
|
|
48
48
|
{children}
|
package/src/Spinner/Spinner.mdx
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
title: StackView
|
|
3
3
|
category: Layout
|
|
4
4
|
summary: Lay out children in either a column or row. Wraps flexbox styles in a simple API inspired by Apple's UIStackView.
|
|
5
|
+
propsSummary: Accepts all valid HTML attributes.
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
```jsx live
|
|
@@ -65,7 +66,7 @@ render(() => {
|
|
|
65
66
|
<Button
|
|
66
67
|
size="xs"
|
|
67
68
|
title="Add item"
|
|
68
|
-
icon="
|
|
69
|
+
icon="general.plus"
|
|
69
70
|
onClick={() => setItems([...items, defaultItem])}
|
|
70
71
|
/>
|
|
71
72
|
</StackView>
|
|
@@ -137,3 +138,18 @@ render(
|
|
|
137
138
|
</StackView>
|
|
138
139
|
)
|
|
139
140
|
```
|
|
141
|
+
|
|
142
|
+
## Setting Axis, Alignment and Distribution
|
|
143
|
+
|
|
144
|
+
The standard way of defining these flex settings is via props, but they can appear as:
|
|
145
|
+
|
|
146
|
+
- `StackView.BASELINE`
|
|
147
|
+
- `StackView.CENTER`
|
|
148
|
+
- `StackView.END`
|
|
149
|
+
- `StackView.FILL`
|
|
150
|
+
- `StackView.HORIZONTAL`
|
|
151
|
+
- `StackView.SPACE_BETWEEN`
|
|
152
|
+
- `StackView.SPACE_EVENLY`
|
|
153
|
+
- `StackView.START`
|
|
154
|
+
- `StackView.STRETCH`
|
|
155
|
+
- `StackView.VERTICAL`
|
|
@@ -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 { joinChildren } from '../utils'
|
|
10
11
|
import { useVariant } from '../VariantProvider'
|
|
@@ -34,17 +35,19 @@ const stackViewPlugin = {
|
|
|
34
35
|
} else if (styles.justifyContent === undefined) {
|
|
35
36
|
styles.justifyContent = distribution
|
|
36
37
|
}
|
|
37
|
-
if (typeof spacing === 'number') {
|
|
38
|
-
styles
|
|
39
|
-
[`margin${axis === HORIZONTAL ? 'Right' : 'Bottom'}`]: spacing * 8,
|
|
40
|
-
[`margin${axis === HORIZONTAL ? 'Bottom' : 'Right'}`]: 0,
|
|
41
|
-
}
|
|
38
|
+
if (typeof spacing === 'number' || typeof spacing === 'string') {
|
|
39
|
+
styles.gap = spacingValue(spacing)
|
|
42
40
|
}
|
|
43
41
|
return styles
|
|
44
42
|
},
|
|
45
43
|
}
|
|
46
44
|
|
|
47
45
|
export type StackViewProps = {
|
|
46
|
+
children?: any
|
|
47
|
+
|
|
48
|
+
/** Render custom component or HTML element tag. (Defaults to a `<div>` element). */
|
|
49
|
+
as?: any
|
|
50
|
+
|
|
48
51
|
/** The axis along which children are laid out. */
|
|
49
52
|
axis?: 'horizontal' | 'vertical'
|
|
50
53
|
|
|
@@ -60,8 +63,20 @@ export type StackViewProps = {
|
|
|
60
63
|
| 'space-between'
|
|
61
64
|
| 'space-evenly'
|
|
62
65
|
|
|
66
|
+
/** If true, sets `display: inline-flex`, otherwise it defaults to `display: flex` */
|
|
67
|
+
inline?: boolean
|
|
68
|
+
|
|
69
|
+
/** Gain access to the internal ref */
|
|
70
|
+
innerRef?: any
|
|
71
|
+
|
|
63
72
|
/** The amount of space or element that is inserted between each child. */
|
|
64
73
|
spacing?: number | string | React.ReactNode
|
|
74
|
+
|
|
75
|
+
/** Describes styles at various points in time. [Read about variants](/variants). */
|
|
76
|
+
variants?: object
|
|
77
|
+
|
|
78
|
+
/** Describes props at different breakpoints. [Read about mediaQueries](/responsive). */
|
|
79
|
+
mediaQueries?: object
|
|
65
80
|
} & BoxProps
|
|
66
81
|
|
|
67
82
|
type Props = React.RefAttributes<any> &
|
|
@@ -78,9 +93,9 @@ export function StackView({ as, children, inline, innerRef, ...props }: Props) {
|
|
|
78
93
|
const childrenToRender =
|
|
79
94
|
Element === 'textarea'
|
|
80
95
|
? undefined
|
|
81
|
-
: typeof props.spacing === '
|
|
82
|
-
? children
|
|
83
|
-
:
|
|
96
|
+
: typeof props.spacing === 'object'
|
|
97
|
+
? joinChildren(children, props.spacing)
|
|
98
|
+
: children
|
|
84
99
|
return (
|
|
85
100
|
<Element
|
|
86
101
|
ref={innerRef}
|
|
@@ -1,26 +1,55 @@
|
|
|
1
|
+
// @flow
|
|
1
2
|
import React from 'react'
|
|
2
3
|
|
|
3
4
|
import Button from '../Button'
|
|
4
|
-
import { useBoxSize } from '../system'
|
|
5
|
+
import { useBoxSize, useThemeProps } from '../system'
|
|
5
6
|
import NumberField from '../NumberField'
|
|
6
7
|
import StackView from '../StackView'
|
|
7
8
|
|
|
9
|
+
type Props = {
|
|
10
|
+
/**
|
|
11
|
+
* The current value of the stepper.
|
|
12
|
+
*/
|
|
13
|
+
value?: number,
|
|
14
|
+
/**
|
|
15
|
+
* Minimum number that can be selected.
|
|
16
|
+
*/
|
|
17
|
+
min?: number,
|
|
18
|
+
/**
|
|
19
|
+
* Maximum number that can be selected.
|
|
20
|
+
*/
|
|
21
|
+
max?: number,
|
|
22
|
+
/**
|
|
23
|
+
* Specifies the size of each movement when incrementing/decrementing the value. Defaults to `1`.
|
|
24
|
+
*/
|
|
25
|
+
step?: number,
|
|
26
|
+
/**
|
|
27
|
+
* Called when incrementing/decrementing the value.
|
|
28
|
+
*/
|
|
29
|
+
onChange?: Function,
|
|
30
|
+
}
|
|
31
|
+
|
|
8
32
|
function StepperField({
|
|
9
33
|
min = -Infinity,
|
|
10
34
|
max = Infinity,
|
|
11
35
|
onChange,
|
|
12
|
-
size = 'md',
|
|
13
36
|
step = 1,
|
|
14
37
|
value,
|
|
15
38
|
...restProps
|
|
16
|
-
}) {
|
|
39
|
+
}: Props) {
|
|
40
|
+
const { size = 'md', ...themeProps } = useThemeProps(
|
|
41
|
+
'stepperField',
|
|
42
|
+
restProps
|
|
43
|
+
)
|
|
44
|
+
|
|
17
45
|
const { fontSize, paddingHorizontal, navigateSize } = useBoxSize(size)
|
|
46
|
+
|
|
18
47
|
return (
|
|
19
|
-
<StackView axis="horizontal" fontSize={fontSize} {...
|
|
48
|
+
<StackView axis="horizontal" fontSize={fontSize} {...themeProps}>
|
|
20
49
|
<Button
|
|
21
50
|
size={size}
|
|
22
51
|
title={`Decrement by ${step}`}
|
|
23
|
-
icon={{ name: '
|
|
52
|
+
icon={{ name: 'general.minus', size: navigateSize(size, -1) }}
|
|
24
53
|
disabled={value <= min}
|
|
25
54
|
onClick={() => onChange(Math.max(value - step, min))}
|
|
26
55
|
/>
|
|
@@ -37,7 +66,7 @@ function StepperField({
|
|
|
37
66
|
<Button
|
|
38
67
|
size={size}
|
|
39
68
|
title={`Increment by ${step}`}
|
|
40
|
-
icon={{ name: '
|
|
69
|
+
icon={{ name: 'general.plus', size: navigateSize(size, -1) }}
|
|
41
70
|
disabled={value >= max}
|
|
42
71
|
onClick={() => onChange(Math.min(value + step), max)}
|
|
43
72
|
/>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: StepperField
|
|
3
3
|
category: Forms
|
|
4
|
-
summary: Number input used to collect numeric information from users with
|
|
5
|
-
|
|
4
|
+
summary: Number input used to collect numeric information from users with increment/decrement buttons.
|
|
5
|
+
propsSummary: Accepts [StackView](/stackview) props.
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
```jsx live
|
|
@@ -2,30 +2,29 @@
|
|
|
2
2
|
import React, { Children } from 'react'
|
|
3
3
|
|
|
4
4
|
import GridView from '../GridView'
|
|
5
|
-
|
|
6
5
|
import StepperProgressContext from './Context'
|
|
7
|
-
|
|
8
|
-
const ACTIVE_COLOR = 'primary-light'
|
|
6
|
+
import { useThemeProps } from '../system'
|
|
9
7
|
|
|
10
8
|
export type Props = {
|
|
9
|
+
/** Often accepts `StepperProgress.Step` component. */
|
|
10
|
+
children?: React.ReactNode,
|
|
11
11
|
/** Highlighted steps from the first step to this step index. */
|
|
12
12
|
activeStepIndex?: number,
|
|
13
13
|
/** Active color for each step indicator and line. Defaults to `primary-light`. */
|
|
14
14
|
activeColor?: string,
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
function StepperProgress({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}: Props) {
|
|
17
|
+
function StepperProgress({ activeStepIndex, children, ...restProps }: Props) {
|
|
18
|
+
const { activeColor = 'primary-light', ...themeProps } = useThemeProps(
|
|
19
|
+
'stepperProgress',
|
|
20
|
+
restProps
|
|
21
|
+
)
|
|
23
22
|
return (
|
|
24
23
|
<GridView
|
|
25
24
|
autoFlow="column"
|
|
26
25
|
autoColumns="1fr"
|
|
27
26
|
alignment="center"
|
|
28
|
-
{...
|
|
27
|
+
{...themeProps}
|
|
29
28
|
>
|
|
30
29
|
{Children.map(children, (child, stepIndex) => (
|
|
31
30
|
<StepperProgressContext.Provider
|