@decisiv/ui-components 2.0.1-alpha.186 → 2.0.1-alpha.188
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/lib/components/Badge/types.d.ts +1 -1
- package/lib/components/Button/StyledButton.d.ts +3 -8
- package/lib/components/Button/StyledButton.d.ts.map +1 -1
- package/lib/components/Button/StyledButton.js +2 -2
- package/lib/components/Button/index.js +1 -1
- package/lib/components/Filter/SimplePrimary/index.d.ts +1 -1
- package/lib/components/Filter/SimplePrimary/index.d.ts.map +1 -1
- package/lib/components/Filter/SimplePrimary/index.js +1 -2
- package/lib/components/Filter/StyledFilter.d.ts.map +1 -1
- package/lib/components/Filter/StyledFilter.js +21 -12
- package/lib/components/Filter/StyledLabel/index.js +1 -1
- package/lib/components/Filter/index.js +1 -1
- package/lib/components/Filter/index.test.js +14 -0
- package/lib/components/Filter/kind.d.ts.map +1 -1
- package/lib/components/Filter/kind.js +1 -1
- package/lib/components/Filter/schema.d.ts.map +1 -1
- package/lib/components/Filter/schema.js +1 -1
- package/lib/components/Filter/types.d.ts +1 -1
- package/lib/components/Filter/types.d.ts.map +1 -1
- package/lib/components/Link/styles.d.ts +1 -1
- package/lib/components/Modal/Manager.d.ts +6 -0
- package/lib/components/Modal/Manager.d.ts.map +1 -0
- package/lib/components/Modal/Manager.js +53 -0
- package/lib/components/Modal/ResponsiveModalWrapper.d.ts +12 -0
- package/lib/components/Modal/ResponsiveModalWrapper.d.ts.map +1 -0
- package/lib/components/Modal/ResponsiveModalWrapper.js +79 -0
- package/lib/components/Modal/components.d.ts +1 -0
- package/lib/components/Modal/components.d.ts.map +1 -1
- package/lib/components/Modal/components.js +2 -2
- package/lib/components/Modal/index.d.ts +8 -4
- package/lib/components/Modal/index.d.ts.map +1 -1
- package/lib/components/Modal/index.js +33 -81
- package/lib/components/Popover/Arrow.d.ts +2 -2
- package/lib/components/Tag/propTypes.d.ts +1 -1
- package/lib/components/Wizard/index.d.ts +24 -0
- package/lib/components/Wizard/index.d.ts.map +1 -0
- package/lib/components/Wizard/index.js +142 -0
- package/lib/components/Wizard/index.test.js +591 -0
- package/lib/components/Wizard/schema.d.ts +3 -0
- package/lib/components/Wizard/schema.d.ts.map +1 -0
- package/lib/components/Wizard/schema.js +37 -0
- package/lib/components/Wizard/styles.d.ts +989 -0
- package/lib/components/Wizard/styles.d.ts.map +1 -0
- package/lib/components/Wizard/styles.js +79 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +24 -1
- package/lib/providers/ConfigProvider/utils/translations.d.ts +8 -0
- package/lib/providers/ConfigProvider/utils/translations.d.ts.map +1 -1
- package/lib/providers/ConfigProvider/utils/translations.js +8 -0
- package/lib/utils/commonUIColors.d.ts +2 -2
- package/lib/utils/commonUIColors.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -14,7 +14,7 @@ export interface BadgeProps {
|
|
|
14
14
|
}
|
|
15
15
|
declare function variantValidator(props: BadgeProps, propName: 'variant', componentName: 'Badge'): Error | null;
|
|
16
16
|
export declare const propTypes: {
|
|
17
|
-
color: PropTypes.Requireable<
|
|
17
|
+
color: PropTypes.Requireable<CommonUIColorKeys>;
|
|
18
18
|
icon: PropTypes.Validator<PropTypes.ReactComponentLike>;
|
|
19
19
|
size: PropTypes.Requireable<string>;
|
|
20
20
|
variant: typeof variantValidator;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export interface StyledButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement
|
|
4
|
-
|
|
5
|
-
kind?: Kind;
|
|
6
|
-
minWidth?: string;
|
|
7
|
-
size: Size;
|
|
8
|
-
variant?: Variant;
|
|
9
|
-
loading?: boolean;
|
|
2
|
+
import { ButtonProps } from './types';
|
|
3
|
+
export interface StyledButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, ButtonProps {
|
|
4
|
+
$loading?: ButtonProps['loading'];
|
|
10
5
|
}
|
|
11
6
|
declare const StyledButton: import("styled-components").StyledComponent<"button", any, StyledButtonProps, never>;
|
|
12
7
|
export default StyledButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StyledButton.d.ts","sourceRoot":"","sources":["../../../src/components/Button/StyledButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAuB1B,OAAO,
|
|
1
|
+
{"version":3,"file":"StyledButton.d.ts","sourceRoot":"","sources":["../../../src/components/Button/StyledButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAuB1B,OAAO,EAAQ,WAAW,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,WAAW,iBACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,WAAW;IACb,QAAQ,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;CACnC;AA6LD,QAAA,MAAM,YAAY,sFAkBjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -85,9 +85,9 @@ var buttonSizeModifier = function buttonSizeModifier(_ref) {
|
|
|
85
85
|
|
|
86
86
|
var disabledStyles = function disabledStyles(_ref2) {
|
|
87
87
|
var variant = _ref2.variant,
|
|
88
|
-
loading = _ref2
|
|
88
|
+
$loading = _ref2.$loading;
|
|
89
89
|
|
|
90
|
-
if (loading) {
|
|
90
|
+
if ($loading) {
|
|
91
91
|
if (variant === 'ghost') {
|
|
92
92
|
return (0, _styledComponents.css)(["&:disabled:disabled{border-color:transparent;color:", ";cursor:not-allowed;}"], _colors.interactionSecondaryLight);
|
|
93
93
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SimpleFilterProps } from '../types';
|
|
3
|
-
declare const FilterSimplePrimary: ({ "aria-label": ariaLabel, active, disabled,
|
|
3
|
+
declare const FilterSimplePrimary: ({ "aria-label": ariaLabel, active, disabled, text, badgeIcon: Icon, badgeColor, count, }: SimpleFilterProps) => JSX.Element;
|
|
4
4
|
export default FilterSimplePrimary;
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Filter/SimplePrimary/index.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,QAAA,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Filter/SimplePrimary/index.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,QAAA,MAAM,mBAAmB,8HAgCxB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -21,7 +21,6 @@ var FilterSimplePrimary = function FilterSimplePrimary(_ref) {
|
|
|
21
21
|
active = _ref$active === void 0 ? false : _ref$active,
|
|
22
22
|
_ref$disabled = _ref.disabled,
|
|
23
23
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
24
|
-
kind = _ref.kind,
|
|
25
24
|
text = _ref.text,
|
|
26
25
|
Icon = _ref.badgeIcon,
|
|
27
26
|
_ref$badgeColor = _ref.badgeColor,
|
|
@@ -37,7 +36,7 @@ var FilterSimplePrimary = function FilterSimplePrimary(_ref) {
|
|
|
37
36
|
"aria-label": ariaLabel
|
|
38
37
|
})), _react.default.createElement(_StyledLabel.default, {
|
|
39
38
|
active: active,
|
|
40
|
-
kind:
|
|
39
|
+
kind: "primary",
|
|
41
40
|
hasBadge: !!Icon,
|
|
42
41
|
marginLeft: 1
|
|
43
42
|
}, buttonText));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StyledFilter.d.ts","sourceRoot":"","sources":["../../../src/components/Filter/StyledFilter.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"StyledFilter.d.ts","sourceRoot":"","sources":["../../../src/components/Filter/StyledFilter.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAoE1C,QAAA,MAAM,YAAY,oFAiDjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -35,18 +35,27 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
35
35
|
|
|
36
36
|
var activeStyles = (0, _styledComponents.css)(["color:", ";background-color:", ";border:", " solid ", ";svg{color:", ";}"], (0, _toColorString.default)(_color.default.base.snowWhite), (0, _toColorString.default)(_color.default.status.information.medium), (0, _rem.default)(1), (0, _toColorString.default)(_color.default.status.information.medium), (0, _toColorString.default)(_color.default.base.snowWhite));
|
|
37
37
|
var focusStyles = (0, _styledComponents.css)(["border:", " solid ", ";", ";"], (0, _rem.default)(1), (0, _toColorString.default)(_color.default.interaction.pacificOcean), (0, _focusRingWithColor.default)(_colors.focusRingColors.light.normal.secondary.shadow));
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
38
|
+
var altActionVariantStyles = (0, _styledComponents.css)(["border:", " solid transparent;background:transparent;svg{color:", ";}&:hover{border:", " solid transparent;color:", ";background:transparent;svg{color:inherit;}}&:disabled:disabled{border:none;background:transparent;}"], (0, _rem.default)(1), (0, _toColorString.default)(_color.default.interaction.pacificOcean), (0, _rem.default)(1), (0, _toColorString.default)(_color.default.interaction.indianOcean));
|
|
39
|
+
var variantKindMapper = {
|
|
40
|
+
primary: '',
|
|
41
|
+
primaryAlt: altActionVariantStyles,
|
|
42
|
+
secondary: altActionVariantStyles
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
var variant = function variant(_ref) {
|
|
46
|
+
var _ref$kind = _ref.kind,
|
|
47
|
+
kindProp = _ref$kind === void 0 ? 'primary' : _ref$kind;
|
|
48
|
+
return _styledTheming.default.variants(_ConfigProvider.themeKeys.mode, 'variant', {
|
|
49
|
+
simple: {
|
|
50
|
+
light: '',
|
|
51
|
+
dark: ''
|
|
52
|
+
},
|
|
53
|
+
action: {
|
|
54
|
+
light: variantKindMapper[kindProp],
|
|
55
|
+
dark: variantKindMapper[kindProp]
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
};
|
|
50
59
|
|
|
51
60
|
var StyledFilter = _styledComponents.default.button.withConfig({
|
|
52
61
|
displayName: "StyledFilter",
|
|
@@ -21,7 +21,7 @@ var StyledLabel = _styledComponents.default.span.withConfig({
|
|
|
21
21
|
})(["font-size:", ";margin-right:", ";margin-left:", ";"], function (_ref) {
|
|
22
22
|
var _ref$kind = _ref.kind,
|
|
23
23
|
kind = _ref$kind === void 0 ? 'primary' : _ref$kind;
|
|
24
|
-
return kind === '
|
|
24
|
+
return kind === 'secondary' ? (0, _rem.default)(_designTokens.typography.size.alias.paragraph2) : (0, _rem.default)(_designTokens.typography.size.alias.default);
|
|
25
25
|
}, function (_ref2) {
|
|
26
26
|
var _ref2$hasBadge = _ref2.hasBadge,
|
|
27
27
|
hasBadge = _ref2$hasBadge === void 0 ? false : _ref2$hasBadge,
|
|
@@ -72,7 +72,7 @@ var Filter = (0, _react.forwardRef)(function (props, ref) {
|
|
|
72
72
|
}, [onClick, toggleStatus]);
|
|
73
73
|
return _react.default.createElement(_StyledFilter.default, _extends({
|
|
74
74
|
ref: ref,
|
|
75
|
-
kind: kind,
|
|
75
|
+
kind: variant === 'simple' ? 'primary' : kind,
|
|
76
76
|
variant: variant,
|
|
77
77
|
tabIndex: 0,
|
|
78
78
|
active: filterActive || active,
|
|
@@ -53,4 +53,18 @@ describe('Filter', function () {
|
|
|
53
53
|
expect(onClick).not.toHaveBeenCalled();
|
|
54
54
|
});
|
|
55
55
|
});
|
|
56
|
+
describe('kind', function () {
|
|
57
|
+
['primary', 'primaryAlt', 'secondary'].forEach(function (kind) {
|
|
58
|
+
it("Renders ".concat(kind, " kind as expected"), function () {
|
|
59
|
+
var _render4 = (0, _react2.render)(_react.default.createElement(_.default, {
|
|
60
|
+
variant: "action",
|
|
61
|
+
text: "text sample",
|
|
62
|
+
kind: kind
|
|
63
|
+
})),
|
|
64
|
+
container = _render4.container;
|
|
65
|
+
|
|
66
|
+
expect(container).toMatchSnapshot();
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
});
|
|
56
70
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kind.d.ts","sourceRoot":"","sources":["../../../src/components/Filter/kind.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,gBAAgB,CAAC;AAInC,eAAO,MAAM,WAAW,wDAQvB,CAAC;AAEF,eAAO,MAAM,YAAY,wDAWxB,CAAC;AAEF,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"kind.d.ts","sourceRoot":"","sources":["../../../src/components/Filter/kind.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,gBAAgB,CAAC;AAInC,eAAO,MAAM,WAAW,wDAQvB,CAAC;AAEF,eAAO,MAAM,YAAY,wDAWxB,CAAC;AAEF,eAAO,MAAM,cAAc,wDAE1B,CAAC;AAEF,QAAA,MAAM,UAAU,kBAUd,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
|
@@ -25,7 +25,7 @@ var hoverStyles = (0, _styledComponents.css)(["color:", ";background-color:", ";
|
|
|
25
25
|
exports.hoverStyles = hoverStyles;
|
|
26
26
|
var primaryStyle = (0, _styledComponents.css)(["border:", " solid ", ";&:hover{", ";}&:disabled:disabled{background-color:transparent;color:", ";}"], (0, _rem.default)(1), (0, _toColorString.default)(_color.default.base.quarterMoon), hoverStyles, (0, _toColorString.default)(_color.default.opacity.charcoal40));
|
|
27
27
|
exports.primaryStyle = primaryStyle;
|
|
28
|
-
var secondaryStyle = (0, _styledComponents.css)(["height:", ";
|
|
28
|
+
var secondaryStyle = (0, _styledComponents.css)(["height:", ";"], (0, _rem.default)(_designTokens.spacing.base * 2.4));
|
|
29
29
|
exports.secondaryStyle = secondaryStyle;
|
|
30
30
|
|
|
31
31
|
var kindStyles = _styledTheming.default.variants(_ConfigProvider.themeKeys.mode, 'kind', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/components/Filter/schema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,eAAO,MAAM,yBAAyB;;;;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/components/Filter/schema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,eAAO,MAAM,yBAAyB;;;;CA4CpC,CAAC;AAEH,QAAA,MAAM,MAAM,KAAsC,CAAC;AAInD,eAAe,MAAM,CAAC"}
|
|
@@ -21,7 +21,7 @@ var makeFilterSchemaPropTypes = function makeFilterSchemaPropTypes(extensions) {
|
|
|
21
21
|
badgeColor: _reactDesc.PropTypes.string.description('Which color to use as background for the icon. It always displays when an icon is provided. Only usable with the "simple" variant').defaultValue('information'),
|
|
22
22
|
count: _reactDesc.PropTypes.number.description("The Filter's count, displayed to the left of the text. When not provided, no count is rendered."),
|
|
23
23
|
disabled: _reactDesc.PropTypes.bool.description("The Filter's displayed status of disabled or enabled.").defaultValue('false'),
|
|
24
|
-
kind: _reactDesc.PropTypes.oneOf(['primary', 'secondary']).defaultValue('primary'),
|
|
24
|
+
kind: _reactDesc.PropTypes.oneOf(['primary', 'primaryAlt', 'secondary']).defaultValue('primary'),
|
|
25
25
|
variant: _reactDesc.PropTypes.oneOf(['simple', 'action']).description('Use the variant to define the type of filter that you want to use').defaultValue('simple'),
|
|
26
26
|
startIcon: _reactDesc.PropTypes.element.description('Which `iconix` icon to render before the filter text, only usable with the "action" variant'),
|
|
27
27
|
endIcon: _reactDesc.PropTypes.element.description('Which `iconix` icon to render after the filter text, only usable with the "action" variant')
|
|
@@ -3,7 +3,7 @@ import { IconProps } from '@decisiv/iconix';
|
|
|
3
3
|
import { CommonUIColorKeys } from '../../utils/commonUIColors';
|
|
4
4
|
import { TranslatedText } from '../../utils/useTranslations';
|
|
5
5
|
export declare type Variant = 'simple' | 'action';
|
|
6
|
-
export declare type Kind = 'primary' | 'secondary';
|
|
6
|
+
export declare type Kind = 'primary' | 'primaryAlt' | 'secondary';
|
|
7
7
|
export declare type IconComponent = (props: IconProps) => JSX.Element;
|
|
8
8
|
export interface BaseFilterProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
9
9
|
kind?: Kind;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Filter/types.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,oBAAY,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAC1C,oBAAY,IAAI,GAAG,SAAS,GAAG,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Filter/types.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,oBAAY,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAC1C,oBAAY,IAAI,GAAG,SAAS,GAAG,YAAY,GAAG,WAAW,CAAC;AAC1D,oBAAY,aAAa,GAAG,CAAC,KAAK,EAAE,SAAS,KAAK,GAAG,CAAC,OAAO,CAAC;AAE9D,MAAM,WAAW,eACf,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IAC/C,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD,OAAO,EAAE,QAAQ,CAAC;IAClB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB;AAED,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD,OAAO,EAAE,QAAQ,CAAC;IAClB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB,UAAU,CAAC,EAAE,KAAK,CAAC;CACpB;AAED,oBAAY,WAAW,GAAG,iBAAiB,GAAG,iBAAiB,CAAC"}
|
|
@@ -8,7 +8,7 @@ export declare const fontSize: (p: {
|
|
|
8
8
|
size?: import("../../atoms/OptionsList/types").Size;
|
|
9
9
|
}) => SimpleInterpolation;
|
|
10
10
|
export declare const IconContainer: import("styled-components").StyledComponent<"span", any, {
|
|
11
|
-
position: "
|
|
11
|
+
position: import("../Button").IconPosition;
|
|
12
12
|
withText: boolean;
|
|
13
13
|
}, never>;
|
|
14
14
|
export declare const sharedLinkStyles: import("styled-components").FlattenInterpolation<import("styled-components").ThemedStyledProps<{
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import { ModalProps } from './types';
|
|
3
|
+
declare type ManagerProps = Pick<ModalProps, 'onClose' | 'visible'>;
|
|
4
|
+
declare function Manager({ onClose, visible, children, }: PropsWithChildren<ManagerProps>): React.ReactPortal | null;
|
|
5
|
+
export default Manager;
|
|
6
|
+
//# sourceMappingURL=Manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Manager.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Manager.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA0B,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAIzE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,aAAK,YAAY,GAAG,IAAI,CAAC,UAAU,EAAE,SAAS,GAAG,SAAS,CAAC,CAAC;AAE5D,iBAAS,OAAO,CAAC,EACf,OAAO,EACP,OAAO,EACP,QAAQ,GACT,EAAE,iBAAiB,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,WAAW,GAAG,IAAI,CA+B5D;AAED,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _ConfigProvider = require("../../providers/ConfigProvider");
|
|
11
|
+
|
|
12
|
+
var _canUseDOM = _interopRequireDefault(require("../../utils/canUseDOM"));
|
|
13
|
+
|
|
14
|
+
var _utils = require("./utils");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
function Manager(_ref) {
|
|
19
|
+
var onClose = _ref.onClose,
|
|
20
|
+
visible = _ref.visible,
|
|
21
|
+
children = _ref.children;
|
|
22
|
+
(0, _utils.useReturnFocus)(!visible);
|
|
23
|
+
|
|
24
|
+
var _useConfig = (0, _ConfigProvider.useConfig)(),
|
|
25
|
+
createPortal = _useConfig.createPortal;
|
|
26
|
+
|
|
27
|
+
var onKeyDown = (0, _react.useCallback)(function (event) {
|
|
28
|
+
if (event.key === 'Escape') {
|
|
29
|
+
onClose && onClose(event);
|
|
30
|
+
}
|
|
31
|
+
}, [onClose]); // Allow closing the modal by pressing the Escape key
|
|
32
|
+
|
|
33
|
+
(0, _react.useEffect)(function () {
|
|
34
|
+
if (visible && _canUseDOM.default) {
|
|
35
|
+
document.addEventListener('keydown', onKeyDown);
|
|
36
|
+
return function () {
|
|
37
|
+
document.removeEventListener('keydown', onKeyDown);
|
|
38
|
+
};
|
|
39
|
+
} // eslint has issues with no return statement here...
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
return undefined;
|
|
43
|
+
}, [visible, onKeyDown]);
|
|
44
|
+
|
|
45
|
+
if (visible) {
|
|
46
|
+
return createPortal(children);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
var _default = Manager;
|
|
53
|
+
exports.default = _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { RefObject } from 'react';
|
|
2
|
+
import { sizes } from '@decisiv/breakpoint-observer';
|
|
3
|
+
import { ModalProps } from './types';
|
|
4
|
+
import { WizardProps } from '../Wizard';
|
|
5
|
+
declare type Props = Pick<ModalProps, 'id' | 'onClose' | 'zIndex'> & {
|
|
6
|
+
size?: WizardProps['size'];
|
|
7
|
+
breakpoint: keyof typeof sizes | undefined;
|
|
8
|
+
observedElementRef: RefObject<HTMLDivElement>;
|
|
9
|
+
};
|
|
10
|
+
declare const ResponsiveModalWrapper: ({ children, breakpoint, id, size, onClose, zIndex, observedElementRef, }: React.PropsWithChildren<Props>) => JSX.Element;
|
|
11
|
+
export default ResponsiveModalWrapper;
|
|
12
|
+
//# sourceMappingURL=ResponsiveModalWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResponsiveModalWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/ResponsiveModalWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAkC,SAAS,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAGrD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,aAAK,KAAK,GAAG,IAAI,CAAC,UAAU,EAAE,IAAI,GAAG,SAAS,GAAG,QAAQ,CAAC,GAAG;IAC3D,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,UAAU,EAAE,MAAM,OAAO,KAAK,GAAG,SAAS,CAAC;IAC3C,kBAAkB,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;CAC/C,CAAC;AAEF,QAAA,MAAM,sBAAsB,2HA0D3B,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _components = require("./components");
|
|
11
|
+
|
|
12
|
+
var _useUniqueId = _interopRequireDefault(require("../../utils/useUniqueId"));
|
|
13
|
+
|
|
14
|
+
var _utils = require("./utils");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
|
19
|
+
|
|
20
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
|
21
|
+
|
|
22
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
|
23
|
+
|
|
24
|
+
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
25
|
+
|
|
26
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
27
|
+
|
|
28
|
+
var ResponsiveModalWrapper = function ResponsiveModalWrapper(_ref) {
|
|
29
|
+
var children = _ref.children,
|
|
30
|
+
breakpoint = _ref.breakpoint,
|
|
31
|
+
id = _ref.id,
|
|
32
|
+
_ref$size = _ref.size,
|
|
33
|
+
size = _ref$size === void 0 ? 'normal' : _ref$size,
|
|
34
|
+
onClose = _ref.onClose,
|
|
35
|
+
_ref$zIndex = _ref.zIndex,
|
|
36
|
+
zIndex = _ref$zIndex === void 0 ? 100 : _ref$zIndex,
|
|
37
|
+
observedElementRef = _ref.observedElementRef;
|
|
38
|
+
// Any click within the overlay should stay within the overlay. This click event should close
|
|
39
|
+
// the modal, but not bubble up to any parent elements.
|
|
40
|
+
var handleOverlayClick = (0, _react.useCallback)(function (event) {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
event.stopPropagation();
|
|
43
|
+
onClose && onClose(event);
|
|
44
|
+
}, [onClose]); // Any click within the body should stay within the body. This prevents the click event from
|
|
45
|
+
// bubbling up and firing the onClose handler via the Overlay's onClick.
|
|
46
|
+
|
|
47
|
+
var handleBodyClick = (0, _react.useCallback)(function (event) {
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
event.stopPropagation();
|
|
50
|
+
}, []);
|
|
51
|
+
|
|
52
|
+
var _useElement = (0, _utils.useElement)(),
|
|
53
|
+
_useElement2 = _slicedToArray(_useElement, 2),
|
|
54
|
+
container = _useElement2[0],
|
|
55
|
+
containerRef = _useElement2[1];
|
|
56
|
+
|
|
57
|
+
(0, _utils.useKeepFocusWithin)(container);
|
|
58
|
+
var uuid = (0, _useUniqueId.default)(id, 'modal-');
|
|
59
|
+
var modalHeaderId = "modal-header-".concat(uuid);
|
|
60
|
+
var modalContentId = "modal-content-".concat(uuid);
|
|
61
|
+
return _react.default.createElement(_components.Overlay, {
|
|
62
|
+
onClick: handleOverlayClick,
|
|
63
|
+
ref: observedElementRef,
|
|
64
|
+
zIndex: zIndex
|
|
65
|
+
}, _react.default.createElement(_components.Body, {
|
|
66
|
+
widthSize: size,
|
|
67
|
+
"aria-describedby": modalContentId,
|
|
68
|
+
"aria-labelledby": modalHeaderId,
|
|
69
|
+
"aria-modal": "true",
|
|
70
|
+
size: breakpoint,
|
|
71
|
+
id: uuid,
|
|
72
|
+
onClick: handleBodyClick,
|
|
73
|
+
ref: containerRef,
|
|
74
|
+
role: "dialog"
|
|
75
|
+
}, children));
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
var _default = ResponsiveModalWrapper;
|
|
79
|
+
exports.default = _default;
|
|
@@ -4,6 +4,7 @@ export declare const Overlay: import("styled-components").StyledComponent<"div",
|
|
|
4
4
|
}, never>;
|
|
5
5
|
export declare const Body: import("styled-components").StyledComponent<"div", any, {
|
|
6
6
|
size?: "XS" | "SM" | "MD" | "LG" | "XL" | undefined;
|
|
7
|
+
widthSize: "normal" | "extraLarge" | undefined;
|
|
7
8
|
}, never>;
|
|
8
9
|
export declare const ScrollYBox: import("styled-components").StyledComponent<"div", any, {
|
|
9
10
|
size?: "XS" | "SM" | "MD" | "LG" | "XL" | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/components.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/components.tsx"],"names":[],"mappings":";AAaA,eAAO,MAAM,OAAO;;SASnB,CAAC;AAEF,eAAO,MAAM,IAAI;;;SAuChB,CAAC;AAEF,eAAO,MAAM,UAAU;;SAgBtB,CAAC;AAEF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAoD,CAAC;AAExE,eAAO,MAAM,oBAAoB,oEAIhC,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAKnB,CAAC;AAEF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAoBlB,CAAC;AAEF,eAAO,MAAM,aAAa,sGAkBzB,CAAC"}
|
|
@@ -35,14 +35,14 @@ 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;padding-bottom:75px;position:relative;width:100%;", ";"], (0, _toColorString.default)(_designTokens.color.base.snowWhite), (0, _toColorString.default)(_designTokens.color.shadow.light.default), (0, _styleModifiers.when)('size', _breakpointObserver.sizes.XS, (0, _styledComponents.css)(["border-radius:0;bottom:0;left:0;margin:0;max-height:100%;overflow:hidden;position:fixed;right:0;top:0;"])));
|
|
38
|
+
})(["background:", ";border-radius:2px;box-shadow:0 1px 4px ", ";margin:40px auto;max-height:calc(100% - 80px);max-width:650px;overflow:hidden;padding-bottom:75px;position:relative;width:100%;", ";", ""], (0, _toColorString.default)(_designTokens.color.base.snowWhite), (0, _toColorString.default)(_designTokens.color.shadow.light.default), (0, _styleModifiers.when)('size', _breakpointObserver.sizes.XS, (0, _styledComponents.css)(["border-radius:0;bottom:0;left:0;margin:0;max-height:100%;overflow:hidden;position:fixed;right:0;top:0;padding-bottom:0;"])), (0, _styleModifiers.when)('widthSize', 'extraLarge', (0, _styledComponents.css)(["max-width:", ";"], (0, _rem.default)(_designTokens.spacing.base * 90))));
|
|
39
39
|
|
|
40
40
|
exports.Body = Body;
|
|
41
41
|
|
|
42
42
|
var ScrollYBox = _styledComponents.default.div.withConfig({
|
|
43
43
|
displayName: "components__ScrollYBox",
|
|
44
44
|
componentId: "zcog99-2"
|
|
45
|
-
})(["overflow-y:auto;position:relative;height:100%;max-height:calc(100vh - 150px);", ";"], (0, _styleModifiers.when)('size', _breakpointObserver.sizes.XS, (0, _styledComponents.css)(["max-height:calc(100vh - 70px);"])));
|
|
45
|
+
})(["width:100%;overflow-y:auto;position:relative;height:100%;max-height:calc(100vh - 150px);", ";"], (0, _styleModifiers.when)('size', _breakpointObserver.sizes.XS, (0, _styledComponents.css)(["max-height:calc(100vh - 70px);"])));
|
|
46
46
|
|
|
47
47
|
exports.ScrollYBox = ScrollYBox;
|
|
48
48
|
var Header = (0, _styledComponents.default)(_Flex.default).attrs({
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { ModalProps } from './types';
|
|
3
|
-
declare function
|
|
4
|
-
declare namespace
|
|
3
|
+
declare function ModalWrapper({ onClose, visible, children, ...rest }: ModalProps): JSX.Element;
|
|
4
|
+
declare namespace ModalWrapper {
|
|
5
5
|
var propTypes: any;
|
|
6
|
+
var defaultProps: {
|
|
7
|
+
actions: undefined;
|
|
8
|
+
icon: undefined;
|
|
9
|
+
};
|
|
6
10
|
var displayName: string;
|
|
7
11
|
}
|
|
8
|
-
export default
|
|
12
|
+
export default ModalWrapper;
|
|
9
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/index.tsx"],"names":[],"mappings":";AA+BA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AA2HrC,iBAAS,YAAY,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,UAAU,eAQxE;kBARQ,YAAY;;;;;;;;AAwBrB,eAAe,YAAY,CAAC"}
|