@sproutsocial/racine 20.11.0 → 20.12.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.
@@ -5,6 +5,7 @@ interface TypeState {
5
5
  }
6
6
  declare class Input extends React.Component<TypeInputProps, TypeState> {
7
7
  constructor(props: TypeInputProps);
8
+ componentDidUpdate({ value: prevValue }: TypeInputProps): void;
8
9
  static defaultProps: {
9
10
  autoFocus: boolean;
10
11
  disabled: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/Input/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAEjD,UAAU,SAAS;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB;AA0ED,cAAM,KAAM,SAAQ,KAAK,CAAC,SAAS,CAAC,cAAc,EAAE,SAAS,CAAC;gBAChD,KAAK,EAAE,cAAc;IASjC,MAAM,CAAC,YAAY;;;;;;MAMjB;IAEF,MAAM,CAAC,WAAW;;;MAAe;IAGjC,QAAQ,oCAAuC;IAE/C,UAAU,MAAO,gBAAgB,CAAC,gBAAgB,CAAC,sBAC1B;IAEzB,WAAW,MAAO,MAAM,cAAc,CAAC,iBAAiB,CAAC,UAqBvD;IAEF,YAAY,MAAO,MAAM,cAAc,CAAC,gBAAgB,CAAC,UAGvD;IAEF,WAAW,MAAO,gBAAgB,CAAC,gBAAgB,CAAC,sBAC1B;IAE1B,aAAa,MAAO,mBAAmB,CAAC,gBAAgB,CAAC,sBACN;IAEnD,WAAW,MAAO,mBAAmB,CAAC,gBAAgB,CAAC,sBACN;IAEjD,WAAW,MAAO,MAAM,cAAc,CAAC,gBAAgB,CAAC,sBACP;IAEjD,WAAW,eAAgB,MAAM,UAU/B;IAEF,MAAM;CAoHP;AAED,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/Input/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAEjD,UAAU,SAAS;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB;AA0ED,cAAM,KAAM,SAAQ,KAAK,CAAC,SAAS,CAAC,cAAc,EAAE,SAAS,CAAC;gBAChD,KAAK,EAAE,cAAc;IASjC,kBAAkB,CAAC,EAAC,KAAK,EAAE,SAAS,EAAC,EAAE,cAAc;IAQrD,MAAM,CAAC,YAAY;;;;;;MAMjB;IAEF,MAAM,CAAC,WAAW;;;MAAe;IAGjC,QAAQ,oCAAuC;IAE/C,UAAU,MAAO,gBAAgB,CAAC,gBAAgB,CAAC,sBAC1B;IAEzB,WAAW,MAAO,MAAM,cAAc,CAAC,iBAAiB,CAAC,UAwBvD;IAEF,YAAY,MAAO,MAAM,cAAc,CAAC,gBAAgB,CAAC,UAIvD;IAEF,WAAW,MAAO,gBAAgB,CAAC,gBAAgB,CAAC,sBAC1B;IAE1B,aAAa,MAAO,mBAAmB,CAAC,gBAAgB,CAAC,sBACN;IAEnD,WAAW,MAAO,mBAAmB,CAAC,gBAAgB,CAAC,sBACN;IAEjD,WAAW,MAAO,MAAM,cAAc,CAAC,gBAAgB,CAAC,sBACP;IAEjD,WAAW,eAAgB,MAAM,UAU/B;IAEF,MAAM;CAoHP;AAED,eAAe,KAAK,CAAC"}
@@ -31,7 +31,7 @@ export declare const Listbox: {
31
31
  displayName: string;
32
32
  };
33
33
  FilterInput: {
34
- (props: import("..").TypeInputProps): JSX.Element;
34
+ ({ type, ...props }: import("..").TypeInputProps): JSX.Element;
35
35
  displayName: string;
36
36
  };
37
37
  };
@@ -54,7 +54,7 @@ export declare const Menu: {
54
54
  displayName: string;
55
55
  };
56
56
  FilterInput: {
57
- (props: TypeInputProps): JSX.Element;
57
+ ({ type, ...props }: TypeInputProps): JSX.Element;
58
58
  displayName: string;
59
59
  };
60
60
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../src/Menu/Menu.tsx"],"names":[],"mappings":";AAcA,OAAY,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AAI3C,OAAc,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAKjD,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EAEjB,aAAa,EAEb,mBAAmB,EACpB,MAAM,aAAa,CAAC;AA8CrB,eAAO,MAAM,QAAQ;kMAgBlB,iBAAiB;;CAuLnB,CAAC;AACF,eAAO,MAAM,YAAY;YAAW,iBAAiB;;CAEpD,CAAC;AACF,eAAO,MAAM,SAAS;YAAW,iBAAiB;;CAEjD,CAAC;AAEF,eAAO,MAAM,UAAU;YAAW,mBAAmB;;CA8CpD,CAAC;AAUF,eAAO,MAAM,SAAS;mEAMnB,kBAAkB;;CA2BpB,CAAC;AAEF,eAAO,MAAM,WAAW;YAAW,YAAY;;CAQ9C,CAAC;AA4FF,eAAO,MAAM,IAAI;0FASd,aAAa;;;uEA1Ib,kBAAkB;;;;sMA7PlB,iBAAiB;;;;gBAwLgB,iBAAiB;;;;gBAGpB,iBAAiB;;;;gBAIhB,mBAAmB;;;;gBA2FlB,YAAY;;;;gBAUf,cAAc;;;CAuJ7C,CAAC;AAuBF,eAAO,MAAM,UAAU,8GAWpB,mBAAmB,gBAwDrB,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../src/Menu/Menu.tsx"],"names":[],"mappings":";AAcA,OAAY,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AAI3C,OAAc,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAKjD,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EAEjB,aAAa,EAEb,mBAAmB,EACpB,MAAM,aAAa,CAAC;AA8CrB,eAAO,MAAM,QAAQ;kMAgBlB,iBAAiB;;CAuLnB,CAAC;AACF,eAAO,MAAM,YAAY;YAAW,iBAAiB;;CAEpD,CAAC;AACF,eAAO,MAAM,SAAS;YAAW,iBAAiB;;CAEjD,CAAC;AAEF,eAAO,MAAM,UAAU;YAAW,mBAAmB;;CA8CpD,CAAC;AAUF,eAAO,MAAM,SAAS;mEAMnB,kBAAkB;;CA2BpB,CAAC;AAEF,eAAO,MAAM,WAAW;YAAW,YAAY;;CAQ9C,CAAC;AA4FF,eAAO,MAAM,IAAI;0FASd,aAAa;;;uEA1Ib,kBAAkB;;;;sMA7PlB,iBAAiB;;;;gBAwLgB,iBAAiB;;;;gBAGpB,iBAAiB;;;;gBAIhB,mBAAmB;;;;gBA2FlB,YAAY;;;;6BAUO,cAAc;;;CAuJnE,CAAC;AAuBF,eAAO,MAAM,UAAU,8GAWpB,mBAAmB,gBAwDrB,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -106,15 +106,19 @@ var Input = /*#__PURE__*/function (_React$Component) {
106
106
  });
107
107
  input.dispatchEvent(inputEvent);
108
108
 
109
- // Focus the input, update hasValue, and call any onClear callback
110
- input.focus();
111
- _this.updateState('');
109
+ // call any onClear callback
112
110
  (_this$props$onClear = (_this$props2 = _this.props).onClear) === null || _this$props$onClear === void 0 || _this$props$onClear.call(_this$props2, e);
111
+
112
+ // wait for next cycle to update focus
113
+ setTimeout(function () {
114
+ input.focus();
115
+ }, 0);
113
116
  }
114
117
  });
115
118
  _defineProperty(_assertThisInitialized(_this), "handleChange", function (e) {
116
119
  var _this$props$onChange, _this$props3;
117
120
  (_this$props$onChange = (_this$props3 = _this.props).onChange) === null || _this$props$onChange === void 0 || _this$props$onChange.call(_this$props3, e, e.currentTarget.value);
121
+ // needed for uncontrolled inputs
118
122
  _this.updateState(e.currentTarget.value);
119
123
  });
120
124
  _defineProperty(_assertThisInitialized(_this), "handleFocus", function (e) {
@@ -152,6 +156,16 @@ var Input = /*#__PURE__*/function (_React$Component) {
152
156
  return _this;
153
157
  }
154
158
  _createClass(Input, [{
159
+ key: "componentDidUpdate",
160
+ value: function componentDidUpdate(_ref) {
161
+ var prevValue = _ref.value;
162
+ // Update hasValue state whenever props value changes
163
+ var value = this.props.value;
164
+ if (value !== prevValue) {
165
+ this.updateState(value || '');
166
+ }
167
+ }
168
+ }, {
155
169
  key: "render",
156
170
  value: function render() {
157
171
  var _this$props8 = this.props,
@@ -83,8 +83,8 @@ module.exports = {
83
83
  "tableau-lockup-dark": "0 0 291 56",
84
84
  "tableau-lockup": "0 0 291 56",
85
85
  "tableau": "0 0 18 18",
86
- "threads-dark": "0 0 24 24",
87
- "threads": "0 0 24 24",
86
+ "threads-dark": "0 0 18 18",
87
+ "threads": "0 0 18 18",
88
88
  "tiktok-dark": "0 0 140 159",
89
89
  "tiktok": "0 0 140 159",
90
90
  "tripadvisor-dark": "0 0 140 140",
package/lib/Menu/Menu.js CHANGED
@@ -3,9 +3,10 @@ import _styled from "styled-components";
3
3
  var _excluded = ["id", "index", "as", "children", "role", "elemBefore", "elemAfter", "value", "onKeyPress", "onClick", "selected", "disabled", "indeterminate", "label"],
4
4
  _excluded2 = ["placement", "labelProps", "switchProps", "children", "id", "label"],
5
5
  _excluded3 = ["children", "title", "titleAs", "disabled"],
6
- _excluded4 = ["children", "role", "multiselect", "innerRef"],
7
- _excluded5 = ["role", "children", "onChange", "value", "multiselect", "innerRef", "footerContent"],
8
- _excluded6 = ["content", "popoutProps", "children", "onClick", "closeOnItemClick", "id", "placement", "isOpen", "setIsOpen"];
6
+ _excluded4 = ["type"],
7
+ _excluded5 = ["children", "role", "multiselect", "innerRef"],
8
+ _excluded6 = ["role", "children", "onChange", "value", "multiselect", "innerRef", "footerContent"],
9
+ _excluded7 = ["content", "popoutProps", "children", "onClick", "closeOnItemClick", "id", "placement", "isOpen", "setIsOpen"];
9
10
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
10
11
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11
12
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -338,8 +339,10 @@ export var MenuDivider = function MenuDivider(props) {
338
339
  borderColor: "container.border.base"
339
340
  }, props));
340
341
  };
341
- var MenuFilterInput = function MenuFilterInput(props) {
342
- // @ts-note should probably user input types when Input is converted
342
+ var MenuFilterInput = function MenuFilterInput(_ref7) {
343
+ var _ref7$type = _ref7.type,
344
+ type = _ref7$type === void 0 ? 'search' : _ref7$type,
345
+ props = _objectWithoutProperties(_ref7, _excluded4);
343
346
  var onChange = props.onChange,
344
347
  onFocus = props.onFocus,
345
348
  onBlur = props.onBlur;
@@ -365,18 +368,19 @@ var MenuFilterInput = function MenuFilterInput(props) {
365
368
  });
366
369
  }, [setState, onBlur]);
367
370
  return /*#__PURE__*/React.createElement(Input, _extends({}, props, {
371
+ type: type,
368
372
  value: state.filterQuery,
369
373
  onChange: handleOnChange,
370
374
  onFocus: handleOnFocus,
371
375
  onBlur: handleOnBlur
372
376
  }));
373
377
  };
374
- var MenuItems = function MenuItems(_ref7) {
375
- var children = _ref7.children,
376
- role = _ref7.role,
377
- multiselect = _ref7.multiselect,
378
- innerRef = _ref7.innerRef,
379
- props = _objectWithoutProperties(_ref7, _excluded4);
378
+ var MenuItems = function MenuItems(_ref8) {
379
+ var children = _ref8.children,
380
+ role = _ref8.role,
381
+ multiselect = _ref8.multiselect,
382
+ innerRef = _ref8.innerRef,
383
+ props = _objectWithoutProperties(_ref8, _excluded5);
380
384
  var _useMenuKeyDown = useMenuKeyDown(),
381
385
  handleKeyDown = _useMenuKeyDown.handleKeyDown,
382
386
  activeDescendent = _useMenuKeyDown.activeDescendent;
@@ -396,8 +400,8 @@ var MenuItems = function MenuItems(_ref7) {
396
400
  overflow: "hidden"
397
401
  }), children);
398
402
  };
399
- var MenuFooter = function MenuFooter(_ref8) {
400
- var children = _ref8.children;
403
+ var MenuFooter = function MenuFooter(_ref9) {
404
+ var children = _ref9.children;
401
405
  var _useContext5 = useContext(MenuContext),
402
406
  setState = _useContext5.setState;
403
407
  var handleOnBlur = useCallback(function () {
@@ -415,16 +419,16 @@ var MenuFooter = function MenuFooter(_ref8) {
415
419
  onFocus: handleOnFocus
416
420
  }, children);
417
421
  };
418
- export var Menu = function Menu(_ref9) {
419
- var _ref9$role = _ref9.role,
420
- role = _ref9$role === void 0 ? MENU_ROLES.MENU : _ref9$role,
421
- children = _ref9.children,
422
- onChange = _ref9.onChange,
423
- value = _ref9.value,
424
- multiselect = _ref9.multiselect,
425
- innerRef = _ref9.innerRef,
426
- footerContent = _ref9.footerContent,
427
- props = _objectWithoutProperties(_ref9, _excluded5);
422
+ export var Menu = function Menu(_ref10) {
423
+ var _ref10$role = _ref10.role,
424
+ role = _ref10$role === void 0 ? MENU_ROLES.MENU : _ref10$role,
425
+ children = _ref10.children,
426
+ onChange = _ref10.onChange,
427
+ value = _ref10.value,
428
+ multiselect = _ref10.multiselect,
429
+ innerRef = _ref10.innerRef,
430
+ footerContent = _ref10.footerContent,
431
+ props = _objectWithoutProperties(_ref10, _excluded6);
428
432
  var _useDescendants = useDescendants(),
429
433
  _useDescendants2 = _slicedToArray(_useDescendants, 2),
430
434
  descendants = _useDescendants2[0],
@@ -486,20 +490,20 @@ var CustomPopoutContent = styled(Popout.Content).withConfig({
486
490
  displayName: "Menu__CustomPopoutContent",
487
491
  componentId: "sc-1jmjosz-2"
488
492
  })(["padding:0;margin-left:0;margin-right:0;"]);
489
- export var MenuButton = function MenuButton(_ref10) {
490
- var content = _ref10.content,
491
- popoutProps = _ref10.popoutProps,
492
- children = _ref10.children,
493
- _onClick = _ref10.onClick,
494
- _ref10$closeOnItemCli = _ref10.closeOnItemClick,
495
- closeOnItemClick = _ref10$closeOnItemCli === void 0 ? true : _ref10$closeOnItemCli,
496
- _ref10$id = _ref10.id,
497
- id = _ref10$id === void 0 ? uniqueId('MenuButton-') : _ref10$id,
498
- _ref10$placement = _ref10.placement,
499
- placement = _ref10$placement === void 0 ? 'bottom' : _ref10$placement,
500
- isOpen = _ref10.isOpen,
501
- setIsOpen = _ref10.setIsOpen,
502
- props = _objectWithoutProperties(_ref10, _excluded6);
493
+ export var MenuButton = function MenuButton(_ref11) {
494
+ var content = _ref11.content,
495
+ popoutProps = _ref11.popoutProps,
496
+ children = _ref11.children,
497
+ _onClick = _ref11.onClick,
498
+ _ref11$closeOnItemCli = _ref11.closeOnItemClick,
499
+ closeOnItemClick = _ref11$closeOnItemCli === void 0 ? true : _ref11$closeOnItemCli,
500
+ _ref11$id = _ref11.id,
501
+ id = _ref11$id === void 0 ? uniqueId('MenuButton-') : _ref11$id,
502
+ _ref11$placement = _ref11.placement,
503
+ placement = _ref11$placement === void 0 ? 'bottom' : _ref11$placement,
504
+ isOpen = _ref11.isOpen,
505
+ setIsOpen = _ref11.setIsOpen,
506
+ props = _objectWithoutProperties(_ref11, _excluded7);
503
507
  var _useState5 = useState(false),
504
508
  _useState6 = _slicedToArray(_useState5, 2),
505
509
  isInternalShown = _useState6[0],
@@ -43,7 +43,7 @@ export var Container = styled(ReactModalAdapter).withConfig({
43
43
  }, zIndex, function (props) {
44
44
  return props.theme.colors.container.background.base;
45
45
  }, function (props) {
46
- return props.theme.radii[500];
46
+ return props.theme.radii[600];
47
47
  }, function (props) {
48
48
  return props.theme.shadows.medium;
49
49
  }, function (props) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sproutsocial/racine",
3
- "version": "20.11.0",
3
+ "version": "20.12.0",
4
4
  "license": "MIT",
5
5
  "engines": {
6
6
  "node": ">=18"
@@ -24,7 +24,6 @@
24
24
  "scripts": {
25
25
  "install-deps": "yarn install",
26
26
  "prepublishOnly": "yarn run build",
27
- "precommit": "lint-staged",
28
27
  "change": "yarn changeset add",
29
28
  "clean": "rimraf ./__flow__ ./commonjs ./dist ./lib ./es tsconfig.tsbuildinfo",
30
29
  "build-package": "node ./bin/buildPackage.js",
@@ -55,7 +54,8 @@
55
54
  "storybook": "rm -rf node_modules/.cache/storybook && storybook dev -c .storybook -p 9999",
56
55
  "build-storybook": "storybook build --quiet -c .storybook -o .storybook-dist",
57
56
  "build-chromatic": "yarn build-svgs && storybook build --quiet -c .storybook -o .storybook-dist",
58
- "ts-to-flow": "flowgen $FILE -o $OUTPUT --add-flow-header --no-module-exports"
57
+ "ts-to-flow": "flowgen $FILE -o $OUTPUT --add-flow-header --no-module-exports",
58
+ "prepare": "husky install"
59
59
  },
60
60
  "lint-staged": {
61
61
  "**/*": [
@@ -160,7 +160,7 @@
160
160
  "flow-bin": "0.131.0",
161
161
  "flowgen": "^1.21.0",
162
162
  "glob": "^7.1.6",
163
- "husky": "^0.14.3",
163
+ "husky": "^8.0.3",
164
164
  "identity-obj-proxy": "^3.0.0",
165
165
  "inquirer": "^6.4.1",
166
166
  "is-glob": "^4.0.1",
@@ -170,7 +170,7 @@
170
170
  "jscodeshift": "^0.13.0",
171
171
  "jsdom": "^22.1.0",
172
172
  "json-to-scss": "^1.6.2",
173
- "lint-staged": "^13.0.3",
173
+ "lint-staged": "^15.2.0",
174
174
  "moment": "^2.29.4",
175
175
  "npm-run-all": "^4.1.2",
176
176
  "outdent": "^0.7.0",