@decisiv/ui-components 2.0.1-alpha.213 → 2.0.1-alpha.215
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DropdownList/index.tsx"],"names":[],"mappings":";AAgBA,OAAO,EACL,QAAQ,IAAI,YAAY,EACxB,MAAM,IAAI,UAAU,EAErB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAIlD,OAAO,EACL,YAAY,IAAI,oBAAoB,EACpC,gBAAgB,EAChB,MAAM,IAAI,kBAAkB,EAC5B,KAAK,IAAI,iBAAiB,GAC3B,CAAC;AAEF,oBAAY,KAAK,GAAG,gBAAgB,EAAE,CAAC;AACvC,oBAAY,QAAQ,GAAG,YAAY,CAAC;AACpC,oBAAY,MAAM,GAAG,UAAU,CAAC;AAEhC,iBAAS,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DropdownList/index.tsx"],"names":[],"mappings":";AAgBA,OAAO,EACL,QAAQ,IAAI,YAAY,EACxB,MAAM,IAAI,UAAU,EAErB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAIlD,OAAO,EACL,YAAY,IAAI,oBAAoB,EACpC,gBAAgB,EAChB,MAAM,IAAI,kBAAkB,EAC5B,KAAK,IAAI,iBAAiB,GAC3B,CAAC;AAEF,oBAAY,KAAK,GAAG,gBAAgB,EAAE,CAAC;AACvC,oBAAY,QAAQ,GAAG,YAAY,CAAC;AACpC,oBAAY,MAAM,GAAG,UAAU,CAAC;AAEhC,iBAAS,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CA0M/C;kBA1MQ,YAAY;;;;;;;;AAkOrB,eAAe,YAAY,CAAC"}
|
|
@@ -95,7 +95,8 @@ function DropdownList(props) {
|
|
|
95
95
|
maxHeight = props.maxHeight,
|
|
96
96
|
maxWidth = props.maxWidth,
|
|
97
97
|
minWidth = props.minWidth,
|
|
98
|
-
|
|
98
|
+
multiple = props.multiple,
|
|
99
|
+
rest = _objectWithoutProperties(props, ["actions", "borderRadius", "containerSelector", "defaultSelectedIds", "defaultVisible", "defaultFooter", "focusOnShowing", "listRef", "onChange", "onHide", "onShow", "placement", "selectedIds", "showArrow", "target", "visible", "zIndex", "PanelComponent", "maxHeight", "maxWidth", "minWidth", "multiple"]); // Use a ref callback to get more control over re-rendering when a ref is stored.
|
|
99
100
|
// Specifically, the scroll to selected item on first render of dropdown requires this.
|
|
100
101
|
|
|
101
102
|
|
|
@@ -159,7 +160,12 @@ function DropdownList(props) {
|
|
|
159
160
|
var handleOnChange = (0, _react.useCallback)(function (selection) {
|
|
160
161
|
onChange && onChange(Array.isArray(selection) ? selection : [selection]);
|
|
161
162
|
defaultFooter && setSelected(selection) && setSaved(selection);
|
|
162
|
-
|
|
163
|
+
|
|
164
|
+
if (!multiple) {
|
|
165
|
+
setShowing(false);
|
|
166
|
+
popRef && popRef.current && popRef.current.hide() && popRef.current.targetNode && popRef.current.targetNode.focus();
|
|
167
|
+
}
|
|
168
|
+
}, [onChange, setSelected, setSaved, defaultFooter, setShowing]);
|
|
163
169
|
var handleOnApply = (0, _react.useCallback)(function () {
|
|
164
170
|
setSaved(selected);
|
|
165
171
|
popRef && popRef.current && popRef.current.hide();
|
|
@@ -227,7 +233,8 @@ function DropdownList(props) {
|
|
|
227
233
|
onKeyDown: onKeyDown,
|
|
228
234
|
maxHeight: maxHeight,
|
|
229
235
|
maxWidth: maxWidth,
|
|
230
|
-
minWidth: minWidth
|
|
236
|
+
minWidth: minWidth,
|
|
237
|
+
multiple: multiple
|
|
231
238
|
}, rest)))));
|
|
232
239
|
}
|
|
233
240
|
|
|
@@ -199,7 +199,7 @@ describe('DropdownList', function () {
|
|
|
199
199
|
expect(onChange).toHaveBeenCalledWith([item0Id]);
|
|
200
200
|
expect(baseElement).toMatchSnapshot();
|
|
201
201
|
});
|
|
202
|
-
it('
|
|
202
|
+
it('automatically hide the options', function () {
|
|
203
203
|
var _render7 = render(_react.default.createElement(_.default, defaultProps)),
|
|
204
204
|
baseElement = _render7.baseElement,
|
|
205
205
|
getByText = _render7.getByText;
|
|
@@ -208,38 +208,19 @@ describe('DropdownList', function () {
|
|
|
208
208
|
|
|
209
209
|
_react2.fireEvent.click((0, _react2.getByText)(baseElement, item0Label));
|
|
210
210
|
|
|
211
|
-
expect((0, _react2.queryByText)(baseElement, item0Label)).
|
|
212
|
-
});
|
|
213
|
-
it('does not allow multiple selections', function () {
|
|
214
|
-
var onChange = jest.fn();
|
|
215
|
-
|
|
216
|
-
var _render8 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
217
|
-
onChange: onChange
|
|
218
|
-
}))),
|
|
219
|
-
baseElement = _render8.baseElement,
|
|
220
|
-
getByText = _render8.getByText;
|
|
221
|
-
|
|
222
|
-
_react2.fireEvent.click(getByText(targetButtonText));
|
|
223
|
-
|
|
224
|
-
_react2.fireEvent.click((0, _react2.getByText)(baseElement, item0Label));
|
|
225
|
-
|
|
226
|
-
expect(onChange).toHaveBeenCalledWith([item0Id]);
|
|
227
|
-
|
|
228
|
-
_react2.fireEvent.click((0, _react2.getByText)(baseElement, item2Label));
|
|
229
|
-
|
|
230
|
-
expect(onChange).toHaveBeenCalledWith([item2Id]);
|
|
211
|
+
expect((0, _react2.queryByText)(baseElement, item0Label)).toBeFalsy();
|
|
231
212
|
});
|
|
232
213
|
});
|
|
233
214
|
describe('multiple options', function () {
|
|
234
215
|
it('calls the onChange prop with the selection ids', function () {
|
|
235
216
|
var onChange = jest.fn();
|
|
236
217
|
|
|
237
|
-
var
|
|
218
|
+
var _render8 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
238
219
|
onChange: onChange,
|
|
239
220
|
multiple: true
|
|
240
221
|
}))),
|
|
241
|
-
baseElement =
|
|
242
|
-
getByText =
|
|
222
|
+
baseElement = _render8.baseElement,
|
|
223
|
+
getByText = _render8.getByText;
|
|
243
224
|
|
|
244
225
|
_react2.fireEvent.click(getByText(targetButtonText));
|
|
245
226
|
|
|
@@ -251,11 +232,11 @@ describe('DropdownList', function () {
|
|
|
251
232
|
expect(baseElement).toMatchSnapshot();
|
|
252
233
|
});
|
|
253
234
|
it('does not automatically hide the options', function () {
|
|
254
|
-
var
|
|
235
|
+
var _render9 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
|
|
255
236
|
multiple: true
|
|
256
237
|
}))),
|
|
257
|
-
baseElement =
|
|
258
|
-
getByText =
|
|
238
|
+
baseElement = _render9.baseElement,
|
|
239
|
+
getByText = _render9.getByText;
|
|
259
240
|
|
|
260
241
|
_react2.fireEvent.click(getByText(targetButtonText));
|
|
261
242
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/components.tsx"],"names":[],"mappings":";AAcA,eAAO,MAAM,OAAO;;SASnB,CAAC;AAEF,eAAO,MAAM,IAAI;;;;
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/components.tsx"],"names":[],"mappings":";AAcA,eAAO,MAAM,OAAO;;SASnB,CAAC;AAEF,eAAO,MAAM,IAAI;;;;SAuBhB,CAAC;AAEF,eAAO,MAAM,UAAU;;;SA4BtB,CAAC;AAEF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAoD,CAAC;AAExE,eAAO,MAAM,oBAAoB,oEAIhC,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAKnB,CAAC;AAEF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAmBlB,CAAC;AAEF,eAAO,MAAM,aAAa,sGAkBzB,CAAC"}
|
|
@@ -35,7 +35,7 @@ exports.Overlay = Overlay;
|
|
|
35
35
|
var Body = _styledComponents.default.div.withConfig({
|
|
36
36
|
displayName: "components__Body",
|
|
37
37
|
componentId: "zcog99-1"
|
|
38
|
-
})(["background:", ";border-radius:2px;box-shadow:0 1px 4px ", ";margin:40px auto;max-height:calc(100% - 80px);max-width:650px;overflow:hidden;
|
|
38
|
+
})(["background:", ";border-radius:2px;box-shadow:0 1px 4px ", ";margin:40px auto;max-height:calc(100% - 80px);max-width:650px;overflow:hidden;display:flex;flex-direction:column;width:100%;", ""], (0, _toColorString.default)(_designTokens.color.base.snowWhite), (0, _toColorString.default)(_designTokens.color.shadow.light.default), (0, _styleModifiers.when)('widthSize', 'large', (0, _styledComponents.css)(["max-width:", ";"], (0, _rem.default)(_designTokens.spacing.base * 90))));
|
|
39
39
|
|
|
40
40
|
exports.Body = Body;
|
|
41
41
|
|
|
@@ -67,7 +67,7 @@ exports.Content = Content;
|
|
|
67
67
|
var Footer = (0, _styledComponents.default)(_Flex.default).withConfig({
|
|
68
68
|
displayName: "components__Footer",
|
|
69
69
|
componentId: "zcog99-6"
|
|
70
|
-
})(["background-color:", ";border-radius:0 0 2px 2px;border-top:1px solid ", ";
|
|
70
|
+
})(["background-color:", ";border-radius:0 0 2px 2px;border-top:1px solid ", ";display:flex;align-self:flex-end;width:100%;", ";"], (0, _toColorString.default)(_designTokens.color.base.fullMoon), (0, _toColorString.default)(_designTokens.color.opacity.charcoal15), (0, _styleModifiers.when)('size', _breakpointObserver.sizes.XS, (0, _styledComponents.css)(["border-radius:0;background-color:", ";flex-direction:column;"], (0, _toColorString.default)(_designTokens.color.base.fullMoon))));
|
|
71
71
|
exports.Footer = Footer;
|
|
72
72
|
var ActionWrapper = (0, _styledComponents.default)(_Flex.default).withConfig({
|
|
73
73
|
displayName: "components__ActionWrapper",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decisiv/ui-components",
|
|
3
|
-
"version": "2.0.1-alpha.
|
|
3
|
+
"version": "2.0.1-alpha.215+313fe27",
|
|
4
4
|
"description": "Decisiv's design system React components",
|
|
5
5
|
"author": "Decisiv UI Development Team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"access": "public"
|
|
72
72
|
},
|
|
73
73
|
"private": false,
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "313fe27fcdbeb91cfd4973c19a2b99e9a3cfbcfb"
|
|
75
75
|
}
|