@planningcenter/tapestry-react 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,13 +38,13 @@ function ActionsDropdown(_ref) {
38
38
  duplicates = _ref.duplicates,
39
39
  _ref$duplicatesButton = _ref.duplicatesButtonProps,
40
40
  duplicatesButtonProps = _ref$duplicatesButton === void 0 ? {
41
- color: 'white',
42
- backgroundColor: 'hsl(25deg 79% 57%)',
41
+ backgroundColor: 'hsl(42deg 87% 94%)',
42
+ color: 'hsl(0deg 0% 24%)',
43
43
  hover: {
44
- backgroundColor: 'hsl(25deg 80% 54%)'
44
+ backgroundColor: 'hsl(42deg 87% 90%)'
45
45
  },
46
46
  active: {
47
- backgroundColor: 'hsl(25deg 82% 51%)'
47
+ backgroundColor: 'hsl(42deg 87% 87%)'
48
48
  }
49
49
  } : _ref$duplicatesButton,
50
50
  inactive = _ref.inactive,
@@ -61,8 +61,9 @@ function ActionsDropdown(_ref) {
61
61
  return /*#__PURE__*/React.createElement(_Dropdown["default"], (0, _extends2["default"])({
62
62
  title: "Actions",
63
63
  iconLeft: hasDuplicates || hasInactiveDate ? {
64
+ color: hasDuplicates ? '#E6A714' : 'white',
64
65
  name: hasDuplicates ? 'exclamation-triangle-filled' : 'inactive',
65
- size: 'lg'
66
+ size: 'md'
66
67
  } : undefined,
67
68
  fontSize: "14px",
68
69
  fontWeight: 400,
@@ -78,9 +79,9 @@ function ActionsDropdown(_ref) {
78
79
  padding: 2,
79
80
  spacing: 1
80
81
  }, /*#__PURE__*/React.createElement(_Icon["default"], {
81
- name: "exclamation-triangle-filled",
82
- color: "#e8833a",
83
- marginTop: "3px"
82
+ color: "#E6A714",
83
+ marginTop: "3px",
84
+ name: "exclamation-triangle-filled"
84
85
  }), /*#__PURE__*/React.createElement(_Text["default"], {
85
86
  size: 4
86
87
  }, "There ", duplicates.amount > 1 ? 'are' : 'is', " ", duplicates.amount, ' ', "potential ", duplicates.amount > 1 ? 'duplicates' : 'duplicate', " for this profile.", ' ', isBelowManager ? "An administrator can resolve " + (duplicates.amount > 1 ? "them" : "it") + " in People." : /*#__PURE__*/React.createElement(_Link["default"], duplicates.linkProps, isPeopleProduct ? 'Review' : 'Review in People'))), /*#__PURE__*/React.createElement(_Divider["default"], null)) : null, hasInactiveDate ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_StackView["default"], {
@@ -139,12 +139,25 @@ var NumberField = /*#__PURE__*/function (_Component) {
139
139
  maxValue = _this$getParsedValues5.maxValue;
140
140
 
141
141
  if (_this.props.pad) {
142
- var targetValue = event.target.value === '' ? event.target.value : parseFloat(event.target.value);
142
+ var deleteKeyPressed = event.target.value === '';
143
+ var targetValue = deleteKeyPressed ? event.target.value : parseFloat(event.target.value);
143
144
 
144
- if (targetValue !== '') {
145
- var nextValue = _this.clampValue(targetValue);
145
+ if (deleteKeyPressed) {
146
+ var nextValue = ("" + _this.props.value).slice(0, -1);
146
147
 
147
- if (_this.props.moveFocusOnMax && nextValue / maxValue > 0.1) {
148
+ _this.props.onChange((0, _utils.padNumber)(nextValue, _this.props.pad));
149
+ } else {
150
+ var _nextValue = _this.clampValue(targetValue);
151
+
152
+ var paddedValue = parseFloat("" + _this.props.value + targetValue);
153
+
154
+ if (!_this.firstTouch && !isNaN(targetValue) && _this.isValueValid(paddedValue)) {
155
+ _nextValue = paddedValue;
156
+ }
157
+
158
+ _this.firstTouch = false;
159
+
160
+ if (_this.props.moveFocusOnMax && _nextValue / maxValue > 0.1) {
148
161
  var _getTabbableSiblings = (0, _utils.getTabbableSiblings)(event.target),
149
162
  next = _getTabbableSiblings.next;
150
163
 
@@ -155,11 +168,7 @@ var NumberField = /*#__PURE__*/function (_Component) {
155
168
  }
156
169
  }
157
170
 
158
- _this.firstTouch = false;
159
-
160
- _this.changeIfValid(nextValue);
161
- } else {
162
- _this.props.onChange('');
171
+ _this.changeIfValid(_nextValue);
163
172
  }
164
173
  } else {
165
174
  _this.props.onChange(event.target.value);
@@ -222,7 +231,7 @@ var NumberField = /*#__PURE__*/function (_Component) {
222
231
  textOverflow: undefined,
223
232
  autoComplete: 'off',
224
233
  value: numberValue,
225
- highlightOnInteraction: highlightOnInteraction,
234
+ highlightOnInteraction: highlightOnInteraction || pad,
226
235
  onBlur: this.handleBlur,
227
236
  onInput: this.handleInput,
228
237
  onKeyDown: this.handleKeyDown
@@ -12,9 +12,9 @@ import Text from '../Text';
12
12
  import { cloneChildren } from '../utils';
13
13
 
14
14
  var _ref2 = /*#__PURE__*/React.createElement(Icon, {
15
- name: "exclamation-triangle-filled",
16
- color: "#e8833a",
17
- marginTop: "3px"
15
+ color: "#E6A714",
16
+ marginTop: "3px",
17
+ name: "exclamation-triangle-filled"
18
18
  });
19
19
 
20
20
  var _ref3 = /*#__PURE__*/React.createElement(Divider, null);
@@ -52,13 +52,13 @@ export function ActionsDropdown(_ref) {
52
52
  duplicates = _ref.duplicates,
53
53
  _ref$duplicatesButton = _ref.duplicatesButtonProps,
54
54
  duplicatesButtonProps = _ref$duplicatesButton === void 0 ? {
55
- color: 'white',
56
- backgroundColor: 'hsl(25deg 79% 57%)',
55
+ backgroundColor: 'hsl(42deg 87% 94%)',
56
+ color: 'hsl(0deg 0% 24%)',
57
57
  hover: {
58
- backgroundColor: 'hsl(25deg 80% 54%)'
58
+ backgroundColor: 'hsl(42deg 87% 90%)'
59
59
  },
60
60
  active: {
61
- backgroundColor: 'hsl(25deg 82% 51%)'
61
+ backgroundColor: 'hsl(42deg 87% 87%)'
62
62
  }
63
63
  } : _ref$duplicatesButton,
64
64
  inactive = _ref.inactive,
@@ -75,8 +75,9 @@ export function ActionsDropdown(_ref) {
75
75
  return /*#__PURE__*/React.createElement(Dropdown, _extends({
76
76
  title: "Actions",
77
77
  iconLeft: hasDuplicates || hasInactiveDate ? {
78
+ color: hasDuplicates ? '#E6A714' : 'white',
78
79
  name: hasDuplicates ? 'exclamation-triangle-filled' : 'inactive',
79
- size: 'lg'
80
+ size: 'md'
80
81
  } : undefined,
81
82
  fontSize: "14px",
82
83
  fontWeight: 400,
@@ -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 targetValue = event.target.value === '' ? event.target.value : parseFloat(event.target.value);
137
+ var deleteKeyPressed = event.target.value === '';
138
+ var targetValue = deleteKeyPressed ? event.target.value : parseFloat(event.target.value);
138
139
 
139
- if (targetValue !== '') {
140
- var nextValue = _this.clampValue(targetValue);
140
+ if (deleteKeyPressed) {
141
+ var nextValue = ("" + _this.props.value).slice(0, -1);
141
142
 
142
- if (_this.props.moveFocusOnMax && nextValue / maxValue > 0.1) {
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.firstTouch = false;
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/tapestry-react",
3
- "version": "1.0.0",
3
+ "version": "1.1.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
- color: 'white',
64
- backgroundColor: 'hsl(25deg 79% 57%)',
65
- hover: { backgroundColor: 'hsl(25deg 80% 54%)' },
66
- active: { backgroundColor: 'hsl(25deg 82% 51%)' },
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: 'lg',
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
- name="exclamation-triangle-filled"
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}{' '}
@@ -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 targetValue =
172
- event.target.value === ''
173
- ? event.target.value
174
- : parseFloat(event.target.value)
171
+ const deleteKeyPressed = event.target.value === ''
172
+ const targetValue = deleteKeyPressed
173
+ ? event.target.value
174
+ : parseFloat(event.target.value)
175
175
 
176
- if (targetValue !== '') {
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,