@planningcenter/tapestry-react 1.0.0 → 1.3.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 +9 -8
- package/dist/cjs/Button/Button.js +6 -1
- package/dist/cjs/ChurchCenterStatus/ChurchCenterStatus.js +25 -12
- package/dist/cjs/Menu/Heading.js +3 -2
- package/dist/cjs/Menu/Item.js +5 -5
- package/dist/cjs/NumberField/NumberField.js +19 -10
- package/dist/cjs/Page/PageActions.js +5 -0
- package/dist/cjs/Page/PageHeader.js +17 -21
- package/dist/cjs/Page/PageTab.js +11 -2
- package/dist/cjs/Page/PageTabList.js +5 -10
- package/dist/cjs/Page/PageTitle.js +3 -2
- package/dist/cjs/Page/PageToolbar.js +30 -6
- package/dist/esm/ActionsDropdown/ActionsDropdown.js +9 -8
- package/dist/esm/Button/Button.js +6 -1
- package/dist/esm/ChurchCenterStatus/ChurchCenterStatus.js +23 -11
- package/dist/esm/Menu/Heading.js +3 -2
- package/dist/esm/Menu/Item.js +5 -5
- package/dist/esm/NumberField/NumberField.js +19 -10
- package/dist/esm/Page/PageActions.js +5 -0
- package/dist/esm/Page/PageHeader.js +17 -18
- package/dist/esm/Page/PageTab.js +10 -2
- package/dist/esm/Page/PageTabList.js +5 -8
- package/dist/esm/Page/PageTitle.js +3 -2
- package/dist/esm/Page/PageToolbar.js +28 -6
- package/dist/types/ChurchCenterStatus/ChurchCenterStatus.d.ts +15 -1
- package/package.json +1 -1
- package/src/ActionsDropdown/ActionsDropdown.tsx +8 -7
- package/src/Button/Button.tsx +6 -1
- package/src/ChurchCenterStatus/ChurchCenterStatus.mdx +18 -0
- package/src/ChurchCenterStatus/ChurchCenterStatus.tsx +48 -16
- package/src/Menu/Heading.js +6 -1
- package/src/Menu/Item.js +5 -5
- package/src/NumberField/NumberField.js +19 -9
- package/src/Page/Page.mdx +56 -1
- package/src/Page/PageActions.js +12 -1
- package/src/Page/PageHeader.js +19 -25
- package/src/Page/PageTab.js +15 -1
- package/src/Page/PageTabList.js +10 -8
- package/src/Page/PageTitle.js +9 -1
- package/src/Page/PageToolbar.js +29 -6
|
@@ -134,12 +134,25 @@ var NumberField = /*#__PURE__*/function (_Component) {
|
|
|
134
134
|
maxValue = _this$getParsedValues5.maxValue;
|
|
135
135
|
|
|
136
136
|
if (_this.props.pad) {
|
|
137
|
-
var
|
|
137
|
+
var deleteKeyPressed = event.target.value === '';
|
|
138
|
+
var targetValue = deleteKeyPressed ? event.target.value : parseFloat(event.target.value);
|
|
138
139
|
|
|
139
|
-
if (
|
|
140
|
-
var nextValue = _this.
|
|
140
|
+
if (deleteKeyPressed) {
|
|
141
|
+
var nextValue = ("" + _this.props.value).slice(0, -1);
|
|
141
142
|
|
|
142
|
-
|
|
143
|
+
_this.props.onChange(padNumber(nextValue, _this.props.pad));
|
|
144
|
+
} else {
|
|
145
|
+
var _nextValue = _this.clampValue(targetValue);
|
|
146
|
+
|
|
147
|
+
var paddedValue = parseFloat("" + _this.props.value + targetValue);
|
|
148
|
+
|
|
149
|
+
if (!_this.firstTouch && !isNaN(targetValue) && _this.isValueValid(paddedValue)) {
|
|
150
|
+
_nextValue = paddedValue;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
_this.firstTouch = false;
|
|
154
|
+
|
|
155
|
+
if (_this.props.moveFocusOnMax && _nextValue / maxValue > 0.1) {
|
|
143
156
|
var _getTabbableSiblings = getTabbableSiblings(event.target),
|
|
144
157
|
next = _getTabbableSiblings.next;
|
|
145
158
|
|
|
@@ -150,11 +163,7 @@ var NumberField = /*#__PURE__*/function (_Component) {
|
|
|
150
163
|
}
|
|
151
164
|
}
|
|
152
165
|
|
|
153
|
-
_this.
|
|
154
|
-
|
|
155
|
-
_this.changeIfValid(nextValue);
|
|
156
|
-
} else {
|
|
157
|
-
_this.props.onChange('');
|
|
166
|
+
_this.changeIfValid(_nextValue);
|
|
158
167
|
}
|
|
159
168
|
} else {
|
|
160
169
|
_this.props.onChange(event.target.value);
|
|
@@ -219,7 +228,7 @@ var NumberField = /*#__PURE__*/function (_Component) {
|
|
|
219
228
|
textOverflow: undefined,
|
|
220
229
|
autoComplete: 'off',
|
|
221
230
|
value: numberValue,
|
|
222
|
-
highlightOnInteraction: highlightOnInteraction,
|
|
231
|
+
highlightOnInteraction: highlightOnInteraction || pad,
|
|
223
232
|
onBlur: this.handleBlur,
|
|
224
233
|
onInput: this.handleInput,
|
|
225
234
|
onKeyDown: this.handleKeyDown
|
|
@@ -4,7 +4,12 @@ import StackView from '../StackView';
|
|
|
4
4
|
|
|
5
5
|
function PageActions(props) {
|
|
6
6
|
return /*#__PURE__*/React.createElement(StackView, _extends({
|
|
7
|
+
alignment: "center",
|
|
8
|
+
alignSelf: "end",
|
|
7
9
|
axis: "horizontal",
|
|
10
|
+
distribution: "end",
|
|
11
|
+
flex: "1",
|
|
12
|
+
paddingBottom: 2,
|
|
8
13
|
spacing: 1
|
|
9
14
|
}, props));
|
|
10
15
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
import React
|
|
3
|
+
import React from 'react';
|
|
4
4
|
import { useThemeValue } from '../system';
|
|
5
5
|
import StackView from '../StackView';
|
|
6
|
-
import { PAGE_TABLIST_DISPLAY_NAME } from './PageTabList';
|
|
7
6
|
|
|
8
7
|
function PageHeader(_ref) {
|
|
9
8
|
var children = _ref.children,
|
|
@@ -11,24 +10,24 @@ function PageHeader(_ref) {
|
|
|
11
10
|
restProps = _objectWithoutPropertiesLoose(_ref, ["children", "toolbar"]);
|
|
12
11
|
|
|
13
12
|
var themeProps = useThemeValue('pageHeader');
|
|
14
|
-
var tabsPresent = toolbar ? Children.toArray(toolbar.props.children).some(function (child) {
|
|
15
|
-
return child && child.type.displayName === PAGE_TABLIST_DISPLAY_NAME;
|
|
16
|
-
}) : false;
|
|
17
|
-
var childrenToRender = toolbar ? children ? Children.toArray([/*#__PURE__*/React.createElement(StackView, {
|
|
18
|
-
axis: "horizontal",
|
|
19
|
-
alignment: "center",
|
|
20
|
-
width: "100%"
|
|
21
|
-
}, children), toolbar]) : toolbar : children;
|
|
22
13
|
return /*#__PURE__*/React.createElement(StackView, _extends({
|
|
23
14
|
as: "header",
|
|
24
|
-
axis:
|
|
25
|
-
|
|
26
|
-
paddingHorizontal:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
15
|
+
axis: "vertical",
|
|
16
|
+
backgroundColor: "primary-light",
|
|
17
|
+
paddingHorizontal: 2,
|
|
18
|
+
minHeight: 8,
|
|
19
|
+
mediaQueries: {
|
|
20
|
+
sm: {
|
|
21
|
+
paddingHorizontal: 3
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
spacing: 0
|
|
25
|
+
}, themeProps, restProps), children && /*#__PURE__*/React.createElement(StackView, {
|
|
26
|
+
alignment: "center",
|
|
27
|
+
axis: "horizontal",
|
|
28
|
+
paddingTop: 2,
|
|
29
|
+
width: "100%"
|
|
30
|
+
}, children), toolbar);
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
export default PageHeader;
|
package/dist/esm/Page/PageTab.js
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import Tab from '../Tab';
|
|
4
|
+
import { useThemeValue } from '../system';
|
|
4
5
|
|
|
5
6
|
function PageTab(props) {
|
|
6
|
-
|
|
7
|
+
var themeProps = useThemeValue('pageTab');
|
|
8
|
+
return /*#__PURE__*/React.createElement(Tab, _extends({
|
|
9
|
+
mediaQueries: {
|
|
10
|
+
sm: {
|
|
11
|
+
paddingHorizontal: 3
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
paddingHorizontal: 1.5,
|
|
7
15
|
size: "lg"
|
|
8
|
-
}));
|
|
16
|
+
}, themeProps, props));
|
|
9
17
|
}
|
|
10
18
|
|
|
11
19
|
export default PageTab;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import StackView from '../StackView';
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
function PageTabList(props) {
|
|
4
|
+
export default function PageTabList(props) {
|
|
7
5
|
return /*#__PURE__*/React.createElement(StackView, _extends({
|
|
8
6
|
axis: "horizontal",
|
|
9
|
-
|
|
7
|
+
paddingTop: 2,
|
|
8
|
+
spacing: 0.5,
|
|
9
|
+
alignSelf: "end"
|
|
10
10
|
}, props));
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
PageTabList.displayName = PAGE_TABLIST_DISPLAY_NAME;
|
|
14
|
-
export default PageTabList;
|
|
11
|
+
}
|
|
@@ -6,8 +6,9 @@ import Heading from '../Heading';
|
|
|
6
6
|
function PageTitle(props) {
|
|
7
7
|
var themeProps = useThemeValue('pageTitle');
|
|
8
8
|
return /*#__PURE__*/React.createElement(Heading, _extends({
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
color: "white",
|
|
10
|
+
fontSize: "25px",
|
|
11
|
+
level: 2
|
|
11
12
|
}, themeProps, props));
|
|
12
13
|
}
|
|
13
14
|
|
|
@@ -1,14 +1,36 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import StackView from '../StackView';
|
|
5
|
+
import { useThemeValue } from '../system';
|
|
3
6
|
|
|
4
7
|
function PageToolbar(_ref) {
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
var _mediaQueries;
|
|
9
|
+
|
|
10
|
+
var stackBelow = _ref.stackBelow,
|
|
11
|
+
restProps = _objectWithoutPropertiesLoose(_ref, ["stackBelow"]);
|
|
12
|
+
|
|
13
|
+
var themeBreakpoints = useThemeValue('breakpoints');
|
|
14
|
+
var breakpoint = Object.keys(themeBreakpoints).includes(stackBelow) ? stackBelow : 'sm';
|
|
15
|
+
var stackProps = stackBelow ? {
|
|
16
|
+
axis: 'vertical',
|
|
17
|
+
alignment: 'stretch',
|
|
18
|
+
spacing: 2,
|
|
19
|
+
mediaQueries: (_mediaQueries = {}, _mediaQueries[breakpoint] = {
|
|
20
|
+
axis: 'horizontal',
|
|
21
|
+
alignment: 'center',
|
|
22
|
+
paddingBottom: 0,
|
|
23
|
+
spacing: 0
|
|
24
|
+
}, _mediaQueries)
|
|
25
|
+
} : null;
|
|
26
|
+
return /*#__PURE__*/React.createElement(StackView, _extends({
|
|
27
|
+
alignment: "center",
|
|
8
28
|
axis: "horizontal",
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
29
|
+
distribution: "space-between",
|
|
30
|
+
flex: 1,
|
|
31
|
+
spacing: 2,
|
|
32
|
+
width: "100%"
|
|
33
|
+
}, stackProps, restProps));
|
|
12
34
|
}
|
|
13
35
|
|
|
14
36
|
export default PageToolbar;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
declare type ChurchCenterStatusProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Pass props to the Dropdown buttons.
|
|
5
|
+
*/
|
|
6
|
+
buttonProps?: object;
|
|
3
7
|
/**
|
|
4
8
|
* Determines status of Church Center App.
|
|
5
9
|
*/
|
|
@@ -36,10 +40,20 @@ declare type ChurchCenterStatusProps = {
|
|
|
36
40
|
* Where the browser should navigate when destination button is pressed.
|
|
37
41
|
*/
|
|
38
42
|
productUrl: string;
|
|
43
|
+
/**
|
|
44
|
+
* Render nodes at the end of the popover. `buttonProps` is passed as an argument
|
|
45
|
+
* and can be spread on any `<Button />` component to match the style of the other
|
|
46
|
+
* popover links.
|
|
47
|
+
*/
|
|
48
|
+
renderPopoverFooter: Function;
|
|
39
49
|
/**
|
|
40
50
|
* Where the browser should navigate when settings button is pressed.
|
|
41
51
|
*/
|
|
42
52
|
settingsUrl: string;
|
|
53
|
+
/**
|
|
54
|
+
* Toggle the settings link display.
|
|
55
|
+
*/
|
|
56
|
+
showSettingsLink?: boolean;
|
|
43
57
|
};
|
|
44
|
-
export declare function ChurchCenterStatus({ ccAppEnabled, ccPublishingEnabled, ccWebEnabled, description, destinationLabel, disabledDescription, dropdownProps, icons, productUrl, settingsUrl, ...props }: ChurchCenterStatusProps): JSX.Element;
|
|
58
|
+
export declare function ChurchCenterStatus({ buttonProps: passedButtonProps, ccAppEnabled, ccPublishingEnabled, ccWebEnabled, description, destinationLabel, disabledDescription, dropdownProps, icons, productUrl, renderPopoverFooter, settingsUrl, showSettingsLink, ...props }: ChurchCenterStatusProps): JSX.Element;
|
|
45
59
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/tapestry-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "A collection of flexible React components to help you build resilient, accessible user interfaces quickly and effectively.",
|
|
5
5
|
"author": "Front End Systems Engineering <frontend@pco.bz>",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -60,10 +60,10 @@ export function ActionsDropdown({
|
|
|
60
60
|
defaultButtonProps = defaultTheme.button.themes.primary.fill,
|
|
61
61
|
duplicates,
|
|
62
62
|
duplicatesButtonProps = {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
hover: { backgroundColor: 'hsl(
|
|
66
|
-
active: { backgroundColor: 'hsl(
|
|
63
|
+
backgroundColor: 'hsl(42deg 87% 94%)',
|
|
64
|
+
color: 'hsl(0deg 0% 24%)',
|
|
65
|
+
hover: { backgroundColor: 'hsl(42deg 87% 90%)' },
|
|
66
|
+
active: { backgroundColor: 'hsl(42deg 87% 87%)' },
|
|
67
67
|
},
|
|
68
68
|
inactive,
|
|
69
69
|
inactiveButtonProps = {
|
|
@@ -82,8 +82,9 @@ export function ActionsDropdown({
|
|
|
82
82
|
iconLeft={
|
|
83
83
|
hasDuplicates || hasInactiveDate
|
|
84
84
|
? {
|
|
85
|
+
color: hasDuplicates ? '#E6A714' : 'white',
|
|
85
86
|
name: hasDuplicates ? 'exclamation-triangle-filled' : 'inactive',
|
|
86
|
-
size: '
|
|
87
|
+
size: 'md',
|
|
87
88
|
}
|
|
88
89
|
: undefined
|
|
89
90
|
}
|
|
@@ -104,9 +105,9 @@ export function ActionsDropdown({
|
|
|
104
105
|
<>
|
|
105
106
|
<StackView axis="horizontal" padding={2} spacing={1}>
|
|
106
107
|
<Icon
|
|
107
|
-
|
|
108
|
-
color="#e8833a"
|
|
108
|
+
color="#E6A714"
|
|
109
109
|
marginTop="3px"
|
|
110
|
+
name="exclamation-triangle-filled"
|
|
110
111
|
/>
|
|
111
112
|
<Text size={4}>
|
|
112
113
|
There {duplicates.amount > 1 ? 'are' : 'is'} {duplicates.amount}{' '}
|
package/src/Button/Button.tsx
CHANGED
|
@@ -116,6 +116,7 @@ export function Button({
|
|
|
116
116
|
|
|
117
117
|
let buttonProps: any = {
|
|
118
118
|
alignment: 'center',
|
|
119
|
+
as: (restProps as any).href || to ? 'a' : 'div',
|
|
119
120
|
axis: 'horizontal',
|
|
120
121
|
distribution: 'center',
|
|
121
122
|
fontSize,
|
|
@@ -127,7 +128,6 @@ export function Button({
|
|
|
127
128
|
role: 'button',
|
|
128
129
|
strokeAlign: 'inside',
|
|
129
130
|
strokeWeight: 1,
|
|
130
|
-
as: (restProps as any).href || to ? 'a' : 'div',
|
|
131
131
|
userSelect: 'none',
|
|
132
132
|
zIndex: 1,
|
|
133
133
|
}
|
|
@@ -271,6 +271,11 @@ export function Button({
|
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
+
// pass to if as is defined
|
|
275
|
+
if ((restProps as any).as) {
|
|
276
|
+
buttonProps.to = to
|
|
277
|
+
}
|
|
278
|
+
|
|
274
279
|
if (process.env.NODE_ENV !== 'production') {
|
|
275
280
|
if (icon && !(title || (tooltip && (tooltip as any).title))) {
|
|
276
281
|
const { tooltipProps, wrapperProps } = useAccessibilityViolation(
|
|
@@ -59,6 +59,24 @@ render(
|
|
|
59
59
|
)
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
+
```jsx live
|
|
63
|
+
render(
|
|
64
|
+
<ChurchCenterStatus
|
|
65
|
+
ccAppEnabled
|
|
66
|
+
ccPublishingEnabled={false}
|
|
67
|
+
ccWebEnabled
|
|
68
|
+
description="On Church Center, people can browse and register for events."
|
|
69
|
+
destinationLabel="event list"
|
|
70
|
+
productUrl="#product"
|
|
71
|
+
renderPopoverFooter={(buttonProps) => (
|
|
72
|
+
<Button title="Another link!" {...buttonProps} />
|
|
73
|
+
)}
|
|
74
|
+
settingsUrl="#settings"
|
|
75
|
+
showSettingsLink={false}
|
|
76
|
+
/>
|
|
77
|
+
)
|
|
78
|
+
```
|
|
79
|
+
|
|
62
80
|
## Custom icons
|
|
63
81
|
|
|
64
82
|
To use the Planning Center General set of icons, import the general set to your theme and define the overrides with the `icons` prop.
|
|
@@ -8,6 +8,11 @@ import StackView from '../StackView'
|
|
|
8
8
|
import Text from '../Text'
|
|
9
9
|
|
|
10
10
|
type ChurchCenterStatusProps = {
|
|
11
|
+
/**
|
|
12
|
+
* Pass props to the Dropdown buttons.
|
|
13
|
+
*/
|
|
14
|
+
buttonProps?: object
|
|
15
|
+
|
|
11
16
|
/**
|
|
12
17
|
* Determines status of Church Center App.
|
|
13
18
|
*/
|
|
@@ -53,13 +58,26 @@ type ChurchCenterStatusProps = {
|
|
|
53
58
|
*/
|
|
54
59
|
productUrl: string
|
|
55
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Render nodes at the end of the popover. `buttonProps` is passed as an argument
|
|
63
|
+
* and can be spread on any `<Button />` component to match the style of the other
|
|
64
|
+
* popover links.
|
|
65
|
+
*/
|
|
66
|
+
renderPopoverFooter: Function
|
|
67
|
+
|
|
56
68
|
/**
|
|
57
69
|
* Where the browser should navigate when settings button is pressed.
|
|
58
70
|
*/
|
|
59
71
|
settingsUrl: string
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Toggle the settings link display.
|
|
75
|
+
*/
|
|
76
|
+
showSettingsLink?: boolean
|
|
60
77
|
}
|
|
61
78
|
|
|
62
79
|
export function ChurchCenterStatus({
|
|
80
|
+
buttonProps: passedButtonProps = {},
|
|
63
81
|
ccAppEnabled = false,
|
|
64
82
|
ccPublishingEnabled = false,
|
|
65
83
|
ccWebEnabled = false,
|
|
@@ -69,7 +87,9 @@ export function ChurchCenterStatus({
|
|
|
69
87
|
dropdownProps = {},
|
|
70
88
|
icons,
|
|
71
89
|
productUrl,
|
|
90
|
+
renderPopoverFooter = () => {},
|
|
72
91
|
settingsUrl,
|
|
92
|
+
showSettingsLink = true,
|
|
73
93
|
...props
|
|
74
94
|
}: ChurchCenterStatusProps) {
|
|
75
95
|
const buttonProps: any = {
|
|
@@ -78,9 +98,14 @@ export function ChurchCenterStatus({
|
|
|
78
98
|
paddingHorizontal: 2,
|
|
79
99
|
radius: 0,
|
|
80
100
|
variant: 'naked',
|
|
101
|
+
...passedButtonProps,
|
|
81
102
|
}
|
|
82
103
|
|
|
83
104
|
const ccEnabled = ccAppEnabled || ccWebEnabled
|
|
105
|
+
const hasLinks =
|
|
106
|
+
showSettingsLink ||
|
|
107
|
+
(ccEnabled && ccPublishingEnabled) ||
|
|
108
|
+
!!renderPopoverFooter()
|
|
84
109
|
|
|
85
110
|
const icon = {
|
|
86
111
|
check: 'checkmark',
|
|
@@ -142,25 +167,32 @@ export function ChurchCenterStatus({
|
|
|
142
167
|
</StackView>
|
|
143
168
|
)}
|
|
144
169
|
</StackView>
|
|
145
|
-
<Divider margin={0.5} />
|
|
170
|
+
{hasLinks && <Divider margin={0.5} />}
|
|
146
171
|
<StackView>
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
172
|
+
{showSettingsLink && (
|
|
173
|
+
<Button
|
|
174
|
+
external
|
|
175
|
+
title="Update settings"
|
|
176
|
+
to={settingsUrl}
|
|
177
|
+
{...buttonProps}
|
|
178
|
+
/>
|
|
179
|
+
)}
|
|
153
180
|
{ccEnabled && ccPublishingEnabled && (
|
|
154
|
-
<Button
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
color
|
|
158
|
-
name
|
|
159
|
-
marginLeft
|
|
160
|
-
size
|
|
161
|
-
|
|
162
|
-
|
|
181
|
+
<Button
|
|
182
|
+
external
|
|
183
|
+
iconRight={{
|
|
184
|
+
color: 'primary',
|
|
185
|
+
name: icon.external,
|
|
186
|
+
marginLeft: 1,
|
|
187
|
+
size: 'xs',
|
|
188
|
+
}}
|
|
189
|
+
title={`Visit ${destinationLabel}`}
|
|
190
|
+
to={productUrl}
|
|
191
|
+
{...buttonProps}
|
|
192
|
+
as="a"
|
|
193
|
+
/>
|
|
163
194
|
)}
|
|
195
|
+
{renderPopoverFooter(buttonProps)}
|
|
164
196
|
</StackView>
|
|
165
197
|
</Dropdown>
|
|
166
198
|
</StackView>
|
package/src/Menu/Heading.js
CHANGED
|
@@ -4,7 +4,12 @@ import HeadingUppercase from '../HeadingUppercase'
|
|
|
4
4
|
|
|
5
5
|
function Heading({ children, ...restProps }) {
|
|
6
6
|
return (
|
|
7
|
-
<HeadingUppercase
|
|
7
|
+
<HeadingUppercase
|
|
8
|
+
paddingBottom={0.5}
|
|
9
|
+
paddingHorizontal={2}
|
|
10
|
+
paddingTop={1}
|
|
11
|
+
{...restProps}
|
|
12
|
+
>
|
|
8
13
|
{children}
|
|
9
14
|
</HeadingUppercase>
|
|
10
15
|
)
|
package/src/Menu/Item.js
CHANGED
|
@@ -20,7 +20,7 @@ function Item({
|
|
|
20
20
|
minHeight: 4,
|
|
21
21
|
fontSize: '14px',
|
|
22
22
|
paddingVertical: 0.75,
|
|
23
|
-
paddingHorizontal:
|
|
23
|
+
paddingHorizontal: 2,
|
|
24
24
|
whiteSpace: 'nowrap',
|
|
25
25
|
position: 'relative',
|
|
26
26
|
userSelect: 'none',
|
|
@@ -28,11 +28,11 @@ function Item({
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
if (renderLeft) {
|
|
31
|
-
css.paddingLeft =
|
|
31
|
+
css.paddingLeft = 5
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
if (renderRight) {
|
|
35
|
-
css.paddingRight =
|
|
35
|
+
css.paddingRight = 5
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
if (isHighlighted) {
|
|
@@ -62,7 +62,7 @@ function Item({
|
|
|
62
62
|
height="100%"
|
|
63
63
|
position="absolute"
|
|
64
64
|
top={0}
|
|
65
|
-
left=
|
|
65
|
+
left={0.5}
|
|
66
66
|
>
|
|
67
67
|
{typeof renderLeft === 'function'
|
|
68
68
|
? renderRight()
|
|
@@ -83,7 +83,7 @@ function Item({
|
|
|
83
83
|
height="100%"
|
|
84
84
|
position="absolute"
|
|
85
85
|
top={0}
|
|
86
|
-
right=
|
|
86
|
+
right={0.5}
|
|
87
87
|
>
|
|
88
88
|
{typeof renderRight === 'function'
|
|
89
89
|
? renderRight()
|
|
@@ -168,13 +168,26 @@ class NumberField extends Component<Props> {
|
|
|
168
168
|
handleInput = (event) => {
|
|
169
169
|
const { maxValue } = this.getParsedValues(event.target.value)
|
|
170
170
|
if (this.props.pad) {
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
171
|
+
const deleteKeyPressed = event.target.value === ''
|
|
172
|
+
const targetValue = deleteKeyPressed
|
|
173
|
+
? event.target.value
|
|
174
|
+
: parseFloat(event.target.value)
|
|
175
175
|
|
|
176
|
-
if (
|
|
176
|
+
if (deleteKeyPressed) {
|
|
177
|
+
const nextValue = `${this.props.value}`.slice(0, -1)
|
|
178
|
+
this.props.onChange(padNumber(nextValue, this.props.pad))
|
|
179
|
+
} else {
|
|
177
180
|
let nextValue = this.clampValue(targetValue)
|
|
181
|
+
const paddedValue = parseFloat(`${this.props.value}${targetValue}`)
|
|
182
|
+
if (
|
|
183
|
+
!this.firstTouch &&
|
|
184
|
+
!isNaN(targetValue) &&
|
|
185
|
+
this.isValueValid(paddedValue)
|
|
186
|
+
) {
|
|
187
|
+
nextValue = paddedValue
|
|
188
|
+
}
|
|
189
|
+
this.firstTouch = false
|
|
190
|
+
|
|
178
191
|
if (this.props.moveFocusOnMax && nextValue / maxValue > 0.1) {
|
|
179
192
|
const { next } = getTabbableSiblings(event.target)
|
|
180
193
|
if (next) {
|
|
@@ -182,10 +195,7 @@ class NumberField extends Component<Props> {
|
|
|
182
195
|
}
|
|
183
196
|
}
|
|
184
197
|
|
|
185
|
-
this.firstTouch = false
|
|
186
198
|
this.changeIfValid(nextValue)
|
|
187
|
-
} else {
|
|
188
|
-
this.props.onChange('')
|
|
189
199
|
}
|
|
190
200
|
} else {
|
|
191
201
|
this.props.onChange(event.target.value)
|
|
@@ -244,7 +254,7 @@ class NumberField extends Component<Props> {
|
|
|
244
254
|
textOverflow: undefined,
|
|
245
255
|
autoComplete: 'off',
|
|
246
256
|
value: numberValue,
|
|
247
|
-
highlightOnInteraction: highlightOnInteraction,
|
|
257
|
+
highlightOnInteraction: highlightOnInteraction || pad,
|
|
248
258
|
onBlur: this.handleBlur,
|
|
249
259
|
onInput: this.handleInput,
|
|
250
260
|
onKeyDown: this.handleKeyDown,
|
package/src/Page/Page.mdx
CHANGED
|
@@ -4,6 +4,27 @@ category: General
|
|
|
4
4
|
summary: Page specific components.
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
```jsx live
|
|
8
|
+
render(
|
|
9
|
+
<Box width="100%">
|
|
10
|
+
<PageHeader>
|
|
11
|
+
<PageTitle>People</PageTitle>
|
|
12
|
+
</PageHeader>
|
|
13
|
+
<PageBody
|
|
14
|
+
sidebar={
|
|
15
|
+
<Sidebar grow={0}>
|
|
16
|
+
<Sidebar.Item active>Item 1</Sidebar.Item>
|
|
17
|
+
<Sidebar.Item>Item 2</Sidebar.Item>
|
|
18
|
+
<Sidebar.Item>Item 3</Sidebar.Item>
|
|
19
|
+
</Sidebar>
|
|
20
|
+
}
|
|
21
|
+
>
|
|
22
|
+
Regular body
|
|
23
|
+
</PageBody>
|
|
24
|
+
</Box>
|
|
25
|
+
)
|
|
26
|
+
```
|
|
27
|
+
|
|
7
28
|
```jsx live
|
|
8
29
|
render(
|
|
9
30
|
<Box width="100%">
|
|
@@ -33,6 +54,40 @@ render(
|
|
|
33
54
|
)
|
|
34
55
|
```
|
|
35
56
|
|
|
57
|
+
```jsx live
|
|
58
|
+
render(
|
|
59
|
+
<Box width="100%">
|
|
60
|
+
<PageHeader
|
|
61
|
+
toolbar={
|
|
62
|
+
<PageToolbar>
|
|
63
|
+
<PageTabList>
|
|
64
|
+
<PageTab active>My Schedule</PageTab>
|
|
65
|
+
<PageTab>All Plans</PageTab>
|
|
66
|
+
</PageTabList>
|
|
67
|
+
<PageActions>
|
|
68
|
+
<PageButton title="One" />
|
|
69
|
+
<PageButton title="Two" />
|
|
70
|
+
</PageActions>
|
|
71
|
+
</PageToolbar>
|
|
72
|
+
}
|
|
73
|
+
>
|
|
74
|
+
<PageTitle>People</PageTitle>
|
|
75
|
+
</PageHeader>
|
|
76
|
+
<PageBody
|
|
77
|
+
sidebar={
|
|
78
|
+
<Sidebar grow={0}>
|
|
79
|
+
<Sidebar.Item active>Item 1</Sidebar.Item>
|
|
80
|
+
<Sidebar.Item>Item 2</Sidebar.Item>
|
|
81
|
+
<Sidebar.Item>Item 3</Sidebar.Item>
|
|
82
|
+
</Sidebar>
|
|
83
|
+
}
|
|
84
|
+
>
|
|
85
|
+
Regular body
|
|
86
|
+
</PageBody>
|
|
87
|
+
</Box>
|
|
88
|
+
)
|
|
89
|
+
```
|
|
90
|
+
|
|
36
91
|
```jsx live
|
|
37
92
|
render(
|
|
38
93
|
<Box width="100%">
|
|
@@ -74,7 +129,7 @@ render(
|
|
|
74
129
|
|
|
75
130
|
## Theming
|
|
76
131
|
|
|
77
|
-
Use theme keys `pageBody`, `pageButton`, `pageDropdown`, and `pageTitle` to override `Page` component props.
|
|
132
|
+
Use theme keys `pageBody`, `pageButton`, `pageDropdown`, `pageHeader`, and `pageTitle` to override `Page` component props.
|
|
78
133
|
|
|
79
134
|
```jsx live
|
|
80
135
|
render(
|
package/src/Page/PageActions.js
CHANGED
|
@@ -3,7 +3,18 @@ import React from 'react'
|
|
|
3
3
|
import StackView from '../StackView'
|
|
4
4
|
|
|
5
5
|
function PageActions(props) {
|
|
6
|
-
return
|
|
6
|
+
return (
|
|
7
|
+
<StackView
|
|
8
|
+
alignment="center"
|
|
9
|
+
alignSelf="end"
|
|
10
|
+
axis="horizontal"
|
|
11
|
+
distribution="end"
|
|
12
|
+
flex="1"
|
|
13
|
+
paddingBottom={2}
|
|
14
|
+
spacing={1}
|
|
15
|
+
{...props}
|
|
16
|
+
/>
|
|
17
|
+
)
|
|
7
18
|
}
|
|
8
19
|
|
|
9
20
|
export default PageActions
|