@decisiv/ui-components 2.0.1-alpha.187 → 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/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/package.json +2 -2
|
@@ -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"}
|
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.188+da2dc11",
|
|
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": "da2dc11cc3917992124922b33ee4083e13a92e08"
|
|
75
75
|
}
|