@spaced-out/ui-design-system 0.0.1-alpha.0 → 0.0.1-alpha.1
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 +7 -0
- package/babel.config.js +1 -6
- package/lib/components/Button/Button.js +31 -40
- package/lib/components/ButtonDropdown/ButtonDropdown.js +39 -46
- package/lib/components/Checkbox/Checkbox.js +36 -41
- package/lib/components/Checkbox/CheckboxGroup.js +12 -16
- package/lib/components/CircularLoader/CircularLoader.js +16 -19
- package/lib/components/CodeBlock.js +4 -8
- package/lib/components/Dialog/Dialog.js +38 -51
- package/lib/components/Dropdown/Dropdown.js +46 -51
- package/lib/components/Grid/Grid.js +6 -9
- package/lib/components/Icon/ClickableIcon.js +6 -10
- package/lib/components/Icon/Icon.js +6 -10
- package/lib/components/InContextAlert/InContextAlert.js +29 -35
- package/lib/components/Input/Input.js +65 -78
- package/lib/components/LinearLoader/LinearLoader.js +8 -10
- package/lib/components/Menu/Menu.js +37 -40
- package/lib/components/Modal/Modal.js +18 -22
- package/lib/components/Notification/Notification.js +26 -32
- package/lib/components/Panel/Panel.js +23 -36
- package/lib/components/RadioButton/RadioButton.js +23 -27
- package/lib/components/RadioButton/RadioGroup.js +12 -16
- package/lib/components/SearchInput/SearchInput.js +3 -5
- package/lib/components/Text/Text.js +45 -61
- package/lib/components/Textarea/Textarea.js +34 -45
- package/lib/components/Toast/Toast.js +26 -38
- package/lib/components/Toast/ToastContainer.js +4 -5
- package/lib/components/Toggle/Toggle.js +21 -26
- package/lib/components/Tooltip/Tooltip.js +21 -30
- package/lib/components/Truncate/Truncate.js +3 -5
- package/lib/components/Typeahead/Typeahead.js +50 -55
- package/lib/utils/makeClassNameComponent.js +5 -8
- package/package.json +1 -1
|
@@ -14,11 +14,10 @@ var _clickAway = require("../../utils/click-away");
|
|
|
14
14
|
var _Menu = require("../Menu");
|
|
15
15
|
var _SearchInput = require("../SearchInput");
|
|
16
16
|
var _TypeaheadModule = _interopRequireDefault(require("./Typeahead.module.css"));
|
|
17
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
18
|
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); }
|
|
20
19
|
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; }
|
|
21
|
-
|
|
20
|
+
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); }
|
|
22
21
|
const Typeahead = _ref => {
|
|
23
22
|
let {
|
|
24
23
|
options,
|
|
@@ -66,59 +65,55 @@ const Typeahead = _ref => {
|
|
|
66
65
|
});
|
|
67
66
|
setFilteredOptions(optionsFiltered || []);
|
|
68
67
|
}, [inputValue]);
|
|
69
|
-
return /*#__PURE__*/
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
})
|
|
119
|
-
})]
|
|
120
|
-
});
|
|
121
|
-
}
|
|
68
|
+
return /*#__PURE__*/React.createElement(_clickAway.ClickAway, null, _ref2 => {
|
|
69
|
+
let {
|
|
70
|
+
isOpen,
|
|
71
|
+
onOpen,
|
|
72
|
+
cancelNext,
|
|
73
|
+
clickAway
|
|
74
|
+
} = _ref2;
|
|
75
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
"data-testid": "Typeahead",
|
|
77
|
+
className: (0, _classify.classify)(_TypeaheadModule.default.typeaheadContainer, classNames?.wrapper),
|
|
78
|
+
ref: typeaheadRef
|
|
79
|
+
}, /*#__PURE__*/React.createElement(_SearchInput.SearchInput, _extends({
|
|
80
|
+
boxRef: reference,
|
|
81
|
+
size: size,
|
|
82
|
+
placeholder: placeholder,
|
|
83
|
+
value: inputValue,
|
|
84
|
+
classNames: {
|
|
85
|
+
box: classNames?.box
|
|
86
|
+
}
|
|
87
|
+
}, inputProps, {
|
|
88
|
+
onChange: e => {
|
|
89
|
+
e.stopPropagation();
|
|
90
|
+
setInputValue(e.target.value);
|
|
91
|
+
onSearch && onSearch(e);
|
|
92
|
+
if (e.target.value.length > 0) {
|
|
93
|
+
onOpen();
|
|
94
|
+
} else {
|
|
95
|
+
clickAway();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
})), isOpen && filteredOptions && !!filteredOptions.length && /*#__PURE__*/React.createElement("div", {
|
|
99
|
+
onClickCapture: cancelNext,
|
|
100
|
+
ref: floating,
|
|
101
|
+
style: {
|
|
102
|
+
position: strategy,
|
|
103
|
+
top: y ?? _space.spaceNone,
|
|
104
|
+
left: x ?? _space.spaceNone,
|
|
105
|
+
width: _size.sizeFluid,
|
|
106
|
+
backgroundColor: _color.colorBackgroundTertiary
|
|
107
|
+
}
|
|
108
|
+
}, /*#__PURE__*/React.createElement(_Menu.Menu, {
|
|
109
|
+
isFluid: true,
|
|
110
|
+
options: filteredOptions,
|
|
111
|
+
onSelect: option => {
|
|
112
|
+
handleSelect(option);
|
|
113
|
+
clickAway();
|
|
114
|
+
},
|
|
115
|
+
size: size
|
|
116
|
+
})));
|
|
122
117
|
});
|
|
123
118
|
};
|
|
124
119
|
exports.Typeahead = Typeahead;
|
|
@@ -8,11 +8,10 @@ exports.makeClassNameComponentCustom = makeClassNameComponentCustom;
|
|
|
8
8
|
exports.nameHoc = nameHoc;
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _classify = _interopRequireDefault(require("./classify"));
|
|
11
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
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); }
|
|
14
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; }
|
|
15
|
-
|
|
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); }
|
|
16
15
|
function nameHoc(WrapperComponent, WrappedComponent, hocName) {
|
|
17
16
|
const wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
|
18
17
|
WrapperComponent.displayName = `${hocName}(${wrappedComponentName})`;
|
|
@@ -31,11 +30,10 @@ function makeClassNameComponent(baseClassName) {
|
|
|
31
30
|
return (
|
|
32
31
|
/*#__PURE__*/
|
|
33
32
|
// $FlowFixMe[escaped-generic]
|
|
34
|
-
(
|
|
35
|
-
...props,
|
|
33
|
+
React.createElement(ComponentType, _extends({}, props, {
|
|
36
34
|
ref: ref,
|
|
37
35
|
className: (0, _classify.default)(baseClassName, className)
|
|
38
|
-
})
|
|
36
|
+
}))
|
|
39
37
|
);
|
|
40
38
|
}, `CNC(${name || ComponentType})`));
|
|
41
39
|
}
|
|
@@ -45,11 +43,10 @@ function makeClassNameComponentCustom(baseClassName, ComponentType) {
|
|
|
45
43
|
className,
|
|
46
44
|
...props
|
|
47
45
|
} = _ref2;
|
|
48
|
-
return /*#__PURE__*/(
|
|
49
|
-
...props,
|
|
46
|
+
return /*#__PURE__*/React.createElement(ComponentType, _extends({}, props, {
|
|
50
47
|
ref: ref,
|
|
51
48
|
className: (0, _classify.default)(baseClassName, className)
|
|
52
|
-
});
|
|
49
|
+
}));
|
|
53
50
|
}, ComponentType, 'CNC'));
|
|
54
51
|
}
|
|
55
52
|
function nameComponent(component, name) {
|