@spaced-out/ui-design-system 0.0.52 → 0.0.54

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/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.0.54](https://github.com/spaced-out/ui-design-system/compare/v0.0.53...v0.0.54) (2023-03-21)
6
+
7
+
8
+ ### Features
9
+
10
+ * added support for hover events in a chip ([242d98d](https://github.com/spaced-out/ui-design-system/commit/242d98ddb62d02b6b8fd9e9a470d9fe1957d7bfc))
11
+
12
+ ### [0.0.53](https://github.com/spaced-out/ui-design-system/compare/v0.0.52...v0.0.53) (2023-03-21)
13
+
14
+
15
+ ### Features
16
+
17
+ * typeahead on clear support ([6348d18](https://github.com/spaced-out/ui-design-system/commit/6348d187f6b75c1ce16e38b47d0106c4200a6867))
18
+
5
19
  ### [0.0.52](https://github.com/spaced-out/ui-design-system/compare/v0.0.51...v0.0.52) (2023-03-20)
6
20
 
7
21
 
@@ -12,7 +12,7 @@ var _ChipModule = _interopRequireDefault(require("./Chip.module.css"));
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
14
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
-
15
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
16
16
  const CHIP_SEMANTIC = Object.freeze({
17
17
  primary: 'primary',
18
18
  information: 'information',
@@ -33,10 +33,12 @@ const Chip = _ref => {
33
33
  dismissable = false,
34
34
  onDismiss = () => null,
35
35
  onClick,
36
- disabled
36
+ disabled,
37
+ ...rest
37
38
  } = _ref;
38
- return /*#__PURE__*/React.createElement("div", {
39
- "data-testid": "Chip",
39
+ return /*#__PURE__*/React.createElement("div", _extends({
40
+ "data-testid": "Chip"
41
+ }, rest, {
40
42
  className: (0, _classify.classify)(_ChipModule.default.chipWrapper, {
41
43
  [_ChipModule.default.primary]: semantic === CHIP_SEMANTIC.primary,
42
44
  [_ChipModule.default.information]: semantic === CHIP_SEMANTIC.information,
@@ -51,7 +53,7 @@ const Chip = _ref => {
51
53
  [_ChipModule.default.disabled]: disabled
52
54
  }, classNames?.wrapper),
53
55
  onClick: onClick
54
- }, iconName && size !== 'small' && /*#__PURE__*/React.createElement(_Icon.Icon, {
56
+ }), iconName && size !== 'small' && /*#__PURE__*/React.createElement(_Icon.Icon, {
55
57
  className: _ChipModule.default.chipIcon,
56
58
  name: iconName,
57
59
  type: iconType,
@@ -29,6 +29,8 @@ export type BaseChipProps = {
29
29
  children: React.Node,
30
30
  disabled?: boolean,
31
31
  onClick?: ?(SyntheticEvent<HTMLElement>) => mixed,
32
+ onMouseEnter?: ?(SyntheticEvent<HTMLElement>) => mixed,
33
+ onMouseLeave?: ?(SyntheticEvent<HTMLElement>) => mixed,
32
34
  };
33
35
 
34
36
  export type MediumChipProps = {
@@ -57,9 +59,11 @@ export const Chip = ({
57
59
  onDismiss = () => null,
58
60
  onClick,
59
61
  disabled,
62
+ ...rest
60
63
  }: ChipProps): React.Node => (
61
64
  <div
62
65
  data-testid="Chip"
66
+ {...rest}
63
67
  className={classify(
64
68
  css.chipWrapper,
65
69
  {
@@ -28,6 +28,7 @@ const Typeahead = _ref => {
28
28
  onSearch,
29
29
  selectedOption,
30
30
  menuSize,
31
+ onClear,
31
32
  ...inputProps
32
33
  } = _ref;
33
34
  const typeaheadRef = React.useRef();
@@ -95,6 +96,10 @@ const Typeahead = _ref => {
95
96
  } else {
96
97
  clickAway();
97
98
  }
99
+ },
100
+ onClear: _e => {
101
+ setInputValue('');
102
+ onClear?.();
98
103
  }
99
104
  })), isOpen && filteredOptions && !!filteredOptions.length && /*#__PURE__*/React.createElement("div", {
100
105
  onClickCapture: cancelNext,
@@ -45,6 +45,7 @@ export type TypeaheadProps = {
45
45
  options?: Array<MenuOption>,
46
46
  selectedOption?: MenuOption,
47
47
  menuSize?: 'medium' | 'small',
48
+ onClear?: () => void,
48
49
  };
49
50
 
50
51
  export const Typeahead = ({
@@ -56,6 +57,7 @@ export const Typeahead = ({
56
57
  onSearch,
57
58
  selectedOption,
58
59
  menuSize,
60
+ onClear,
59
61
  ...inputProps
60
62
  }: TypeaheadProps): React.Node => {
61
63
  const typeaheadRef = React.useRef();
@@ -123,6 +125,10 @@ export const Typeahead = ({
123
125
  clickAway();
124
126
  }
125
127
  }}
128
+ onClear={(_e) => {
129
+ setInputValue('');
130
+ onClear?.();
131
+ }}
126
132
  />
127
133
 
128
134
  {isOpen && filteredOptions && !!filteredOptions.length && (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.0.52",
3
+ "version": "0.0.54",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {