@spaced-out/ui-design-system 0.1.8 → 0.1.10

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.
@@ -65,7 +65,7 @@ const Textarea_ = (props, ref) => {
65
65
  [_TextareaModule.default.small]: size === 'small',
66
66
  [_TextareaModule.default.locked]: locked
67
67
  })
68
- }, /*#__PURE__*/React.createElement("textarea", _extends({
68
+ }, /*#__PURE__*/React.createElement("textarea", _extends({}, textareaProps, {
69
69
  disabled: locked || disabled,
70
70
  name: name,
71
71
  ref: ref,
@@ -74,7 +74,7 @@ const Textarea_ = (props, ref) => {
74
74
  onChange: onChange,
75
75
  onFocus: onFocus,
76
76
  onBlur: onBlur
77
- }, textareaProps))), (Boolean(helperText) || error) && /*#__PURE__*/React.createElement("div", {
77
+ }))), (Boolean(helperText) || error) && /*#__PURE__*/React.createElement("div", {
78
78
  className: _TextareaModule.default.info
79
79
  }, /*#__PURE__*/React.createElement(_Text.BodySmall, {
80
80
  color: error && errorText ? 'danger' : disabled ? 'disabled' : 'secondary'
@@ -30,6 +30,7 @@ export type TextareaProps = {
30
30
  size?: 'medium' | 'small',
31
31
  required?: boolean,
32
32
  textCountLimit?: number,
33
+ ...
33
34
  };
34
35
 
35
36
  const Textarea_ = (props: TextareaProps, ref): React.Node => {
@@ -98,6 +99,7 @@ const Textarea_ = (props: TextareaProps, ref): React.Node => {
98
99
  })}
99
100
  >
100
101
  <textarea
102
+ {...textareaProps}
101
103
  disabled={locked || disabled}
102
104
  name={name}
103
105
  ref={ref}
@@ -106,7 +108,6 @@ const Textarea_ = (props: TextareaProps, ref): React.Node => {
106
108
  onChange={onChange}
107
109
  onFocus={onFocus}
108
110
  onBlur={onBlur}
109
- {...textareaProps}
110
111
  ></textarea>
111
112
  </div>
112
113
  {(Boolean(helperText) || error) && (
@@ -71,7 +71,7 @@ const ToastIcon = _ref => {
71
71
  });
72
72
  }
73
73
  };
74
- const ToastTitle = _ref2 => {
74
+ const ToastTitle = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
75
75
  let {
76
76
  children,
77
77
  semantic = '',
@@ -79,17 +79,21 @@ const ToastTitle = _ref2 => {
79
79
  } = _ref2;
80
80
  return /*#__PURE__*/React.createElement(_Text.SubTitleSmall, _extends({
81
81
  color: TOAST_TITLE_COLOR[semantic]
82
- }, props), children);
83
- };
82
+ }, props, {
83
+ ref: ref
84
+ }), children);
85
+ });
84
86
  exports.ToastTitle = ToastTitle;
85
87
  ToastTitle.displayName = 'ToastTitle';
86
- const ToastBody = _ref3 => {
88
+ const ToastBody = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
87
89
  let {
88
90
  children,
89
91
  ...props
90
92
  } = _ref3;
91
- return /*#__PURE__*/React.createElement(_Text.BodyMedium, props, children);
92
- };
93
+ return /*#__PURE__*/React.createElement(_Text.BodyMedium, _extends({}, props, {
94
+ ref: ref
95
+ }), children);
96
+ });
93
97
  exports.ToastBody = ToastBody;
94
98
  ToastBody.displayName = 'ToastBody';
95
99
  const ToastFooter = _ref4 => {
@@ -112,14 +112,15 @@ export type ToastTitleProps = {
112
112
  color?: ColorTypes,
113
113
  };
114
114
 
115
- export const ToastTitle = ({
116
- children,
117
- semantic = '',
118
- ...props
119
- }: ToastTitleProps): React.Node => (
120
- <SubTitleSmall color={TOAST_TITLE_COLOR[semantic]} {...props}>
121
- {children}
122
- </SubTitleSmall>
115
+ export const ToastTitle: React$AbstractComponent<
116
+ ToastTitleProps,
117
+ HTMLHeadingElement,
118
+ > = React.forwardRef<ToastTitleProps, HTMLHeadingElement>(
119
+ ({children, semantic = '', ...props}: ToastTitleProps, ref): React.Node => (
120
+ <SubTitleSmall color={TOAST_TITLE_COLOR[semantic]} {...props} ref={ref}>
121
+ {children}
122
+ </SubTitleSmall>
123
+ ),
123
124
  );
124
125
 
125
126
  ToastTitle.displayName = 'ToastTitle';
@@ -130,8 +131,15 @@ export type ToastBodyProps = {
130
131
  color?: ColorTypes,
131
132
  };
132
133
 
133
- export const ToastBody = ({children, ...props}: ToastBodyProps): React.Node => (
134
- <BodyMedium {...props}>{children}</BodyMedium>
134
+ export const ToastBody: React$AbstractComponent<
135
+ ToastBodyProps,
136
+ HTMLParagraphElement,
137
+ > = React.forwardRef<ToastBodyProps, HTMLParagraphElement>(
138
+ ({children, ...props}: ToastBodyProps, ref): React.Node => (
139
+ <BodyMedium {...props} ref={ref}>
140
+ {children}
141
+ </BodyMedium>
142
+ ),
135
143
  );
136
144
 
137
145
  ToastBody.displayName = 'ToastBody';
@@ -12,7 +12,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
12
12
  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); }
13
13
  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; }
14
14
  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); }
15
- const Toggle = _ref => {
15
+ const Toggle = /*#__PURE__*/React.forwardRef((_ref, ref) => {
16
16
  let {
17
17
  name = 'toggle',
18
18
  value = '',
@@ -41,7 +41,8 @@ const Toggle = _ref => {
41
41
  return /*#__PURE__*/React.createElement("label", {
42
42
  className: (0, _classify.default)(_ToggleModule.default.container, {
43
43
  [_ToggleModule.default.disabled]: disabled
44
- }, classNames?.wrapper)
44
+ }, classNames?.wrapper),
45
+ ref: ref
45
46
  }, /*#__PURE__*/React.createElement("span", {
46
47
  className: _ToggleModule.default.toggleWrap
47
48
  }, /*#__PURE__*/React.createElement("input", _extends({
@@ -60,5 +61,5 @@ const Toggle = _ref => {
60
61
  color: "secondary",
61
62
  className: (0, _classify.default)(_ToggleModule.default.toggleLabel, classNames?.label)
62
63
  }, children));
63
- };
64
+ });
64
65
  exports.Toggle = Toggle;
@@ -27,68 +27,75 @@ export type ToggleProps = {
27
27
  value?: string,
28
28
  };
29
29
 
30
- export const Toggle = ({
31
- name = 'toggle',
32
- value = '',
33
- classNames,
34
- children,
35
- disabled,
36
- checked,
37
- focused,
38
- onChange,
39
- ...props
40
- }: ToggleProps): React.Node => {
41
- const toggleInput = React.createRef<HTMLInputElement>();
42
- const handleOnChange = () => {
43
- if (!disabled) {
44
- onChange &&
45
- onChange({
46
- value,
47
- checked: !checked,
48
- });
49
- }
50
- };
30
+ export const Toggle: React$AbstractComponent<ToggleProps, HTMLLabelElement> =
31
+ React.forwardRef<ToggleProps, HTMLLabelElement>(
32
+ (
33
+ {
34
+ name = 'toggle',
35
+ value = '',
36
+ classNames,
37
+ children,
38
+ disabled,
39
+ checked,
40
+ focused,
41
+ onChange,
42
+ ...props
43
+ }: ToggleProps,
44
+ ref,
45
+ ): React.Node => {
46
+ const toggleInput = React.createRef<HTMLInputElement>();
47
+ const handleOnChange = () => {
48
+ if (!disabled) {
49
+ onChange &&
50
+ onChange({
51
+ value,
52
+ checked: !checked,
53
+ });
54
+ }
55
+ };
51
56
 
52
- React.useEffect(() => {
53
- if (toggleInput.current && focused) {
54
- toggleInput.current.focus();
55
- }
56
- }, [focused]);
57
- return (
58
- <label
59
- className={classify(
60
- css.container,
61
- {
62
- [css.disabled]: disabled,
63
- },
64
- classNames?.wrapper,
65
- )}
66
- >
67
- <span className={css.toggleWrap}>
68
- <input
69
- type="checkbox"
70
- name={name}
71
- value={value}
72
- checked={checked}
73
- onChange={handleOnChange}
74
- ref={toggleInput}
75
- disabled={disabled}
76
- {...props}
77
- />
78
- <span
79
- className={classify(css.toggle, {
80
- [css.disabledButton]: disabled,
81
- })}
82
- />
83
- </span>
84
- {React.Children.count(children) > 0 && (
85
- <FormLabelMedium
86
- color="secondary"
87
- className={classify(css.toggleLabel, classNames?.label)}
57
+ React.useEffect(() => {
58
+ if (toggleInput.current && focused) {
59
+ toggleInput.current.focus();
60
+ }
61
+ }, [focused]);
62
+ return (
63
+ <label
64
+ className={classify(
65
+ css.container,
66
+ {
67
+ [css.disabled]: disabled,
68
+ },
69
+ classNames?.wrapper,
70
+ )}
71
+ ref={ref}
88
72
  >
89
- {children}
90
- </FormLabelMedium>
91
- )}
92
- </label>
73
+ <span className={css.toggleWrap}>
74
+ <input
75
+ type="checkbox"
76
+ name={name}
77
+ value={value}
78
+ checked={checked}
79
+ onChange={handleOnChange}
80
+ ref={toggleInput}
81
+ disabled={disabled}
82
+ {...props}
83
+ />
84
+ <span
85
+ className={classify(css.toggle, {
86
+ [css.disabledButton]: disabled,
87
+ })}
88
+ />
89
+ </span>
90
+ {React.Children.count(children) > 0 && (
91
+ <FormLabelMedium
92
+ color="secondary"
93
+ className={classify(css.toggleLabel, classNames?.label)}
94
+ >
95
+ {children}
96
+ </FormLabelMedium>
97
+ )}
98
+ </label>
99
+ );
100
+ },
93
101
  );
94
- };
@@ -11,7 +11,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
11
11
  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); }
12
12
  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; }
13
13
 
14
- const BaseTruncate = _ref => {
14
+ const BaseTruncate = /*#__PURE__*/React.forwardRef((_ref, ref) => {
15
15
  let {
16
16
  children,
17
17
  line = 1,
@@ -22,11 +22,12 @@ const BaseTruncate = _ref => {
22
22
  style: {
23
23
  WebkitLineClamp: `${line}`
24
24
  },
25
- title: showFullTextOnHover ? children : ''
25
+ title: showFullTextOnHover ? children : '',
26
+ ref: ref
26
27
  }, children);
27
- };
28
+ });
28
29
  exports.BaseTruncate = BaseTruncate;
29
- const Truncate = _ref2 => {
30
+ const Truncate = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
30
31
  let {
31
32
  children,
32
33
  line = 1,
@@ -45,14 +46,16 @@ const Truncate = _ref2 => {
45
46
  style: {
46
47
  WebkitLineClamp: `${line}`
47
48
  },
48
- title: showFullTextOnHover ? children : ''
49
+ title: showFullTextOnHover ? children : '',
50
+ ref
49
51
  });
50
52
  }
51
53
  return /*#__PURE__*/React.createElement(BaseTruncate, {
52
54
  line: line,
53
- showFullTextOnHover: showFullTextOnHover
55
+ showFullTextOnHover: showFullTextOnHover,
56
+ ref: ref
54
57
  }, children);
55
58
  }
56
59
  return null;
57
- };
60
+ });
58
61
  exports.Truncate = Truncate;
@@ -13,42 +13,54 @@ export type TruncateProps = {
13
13
  showFullTextOnHover?: boolean,
14
14
  };
15
15
 
16
- export const BaseTruncate = ({
17
- children,
18
- line = 1,
19
- showFullTextOnHover = false,
20
- }: TruncateProps): React.Node => (
21
- <span
22
- className={classify(css.truncateLineClamp)}
23
- style={{WebkitLineClamp: `${line}`}}
24
- title={showFullTextOnHover ? children : ''}
25
- >
26
- {children}
27
- </span>
16
+ export const BaseTruncate: React$AbstractComponent<
17
+ TruncateProps,
18
+ HTMLSpanElement,
19
+ > = React.forwardRef<TruncateProps, HTMLSpanElement>(
20
+ (
21
+ {children, line = 1, showFullTextOnHover = false}: TruncateProps,
22
+ ref,
23
+ ): React.Node => (
24
+ <span
25
+ className={classify(css.truncateLineClamp)}
26
+ style={{WebkitLineClamp: `${line}`}}
27
+ title={showFullTextOnHover ? children : ''}
28
+ ref={ref}
29
+ >
30
+ {children}
31
+ </span>
32
+ ),
28
33
  );
29
34
 
30
- export const Truncate = ({
31
- children,
32
- line = 1,
33
- showFullTextOnHover = false,
34
- }: TruncateProps): React.Node => {
35
- const arrayChildren = React.Children.toArray(children);
36
- if (arrayChildren.length) {
37
- const child = arrayChildren[0];
38
- if (React.isValidElement(child)) {
39
- const {className, children} = child.props;
40
-
41
- return React.cloneElement(child, {
42
- className: classify(css.truncateLineClamp, className),
43
- style: {WebkitLineClamp: `${line}`},
44
- title: showFullTextOnHover ? children : '',
45
- });
46
- }
47
- return (
48
- <BaseTruncate line={line} showFullTextOnHover={showFullTextOnHover}>
49
- {children}
50
- </BaseTruncate>
51
- );
52
- }
53
- return null;
54
- };
35
+ export const Truncate: React$AbstractComponent<TruncateProps, HTMLSpanElement> =
36
+ React.forwardRef<TruncateProps, HTMLSpanElement>(
37
+ (
38
+ {children, line = 1, showFullTextOnHover = false}: TruncateProps,
39
+ ref,
40
+ ): React.Node => {
41
+ const arrayChildren = React.Children.toArray(children);
42
+ if (arrayChildren.length) {
43
+ const child = arrayChildren[0];
44
+ if (React.isValidElement(child)) {
45
+ const {className, children} = child.props;
46
+
47
+ return React.cloneElement(child, {
48
+ className: classify(css.truncateLineClamp, className),
49
+ style: {WebkitLineClamp: `${line}`},
50
+ title: showFullTextOnHover ? children : '',
51
+ ref,
52
+ });
53
+ }
54
+ return (
55
+ <BaseTruncate
56
+ line={line}
57
+ showFullTextOnHover={showFullTextOnHover}
58
+ ref={ref}
59
+ >
60
+ {children}
61
+ </BaseTruncate>
62
+ );
63
+ }
64
+ return null;
65
+ },
66
+ );
@@ -75,7 +75,7 @@ const Typeahead = _ref => {
75
75
  className: (0, _classify.classify)(_TypeaheadModule.default.typeaheadContainer, classNames?.wrapper),
76
76
  ref: typeaheadRef,
77
77
  onClickCapture: cancelNext
78
- }, /*#__PURE__*/React.createElement(_SearchInput.SearchInput, _extends({
78
+ }, /*#__PURE__*/React.createElement(_SearchInput.SearchInput, _extends({}, inputProps, {
79
79
  boxRef: reference,
80
80
  size: size,
81
81
  placeholder: placeholder,
@@ -83,8 +83,7 @@ const Typeahead = _ref => {
83
83
  classNames: {
84
84
  box: classNames?.box
85
85
  },
86
- isLoading: isLoading
87
- }, inputProps, {
86
+ isLoading: isLoading,
88
87
  onChange: e => {
89
88
  e.stopPropagation();
90
89
  onSearch && onSearch(e);
@@ -39,6 +39,7 @@ export type TypeaheadProps = {
39
39
  onClear?: () => void,
40
40
  isLoading?: boolean,
41
41
  menuOpenOffset?: number,
42
+ ...
42
43
  };
43
44
 
44
45
  export const Typeahead = ({
@@ -97,13 +98,13 @@ export const Typeahead = ({
97
98
  onClickCapture={cancelNext}
98
99
  >
99
100
  <SearchInput
101
+ {...inputProps}
100
102
  boxRef={reference}
101
103
  size={size}
102
104
  placeholder={placeholder}
103
105
  value={typeaheadInputText}
104
106
  classNames={{box: classNames?.box}}
105
107
  isLoading={isLoading}
106
- {...inputProps}
107
108
  onChange={(e) => {
108
109
  e.stopPropagation();
109
110
  onSearch && onSearch(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {