@decisiv/ui-components 2.0.1-alpha.210 → 2.0.1-alpha.212

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.
Files changed (33) hide show
  1. package/lib/atoms/OptionsList/Option/styles.d.ts +1 -1
  2. package/lib/components/Badge/types.d.ts +1 -1
  3. package/lib/components/CheckboxGroup/index.d.ts +1 -1
  4. package/lib/components/List/ContentContainer/index.d.ts +3 -1
  5. package/lib/components/List/ContentContainer/index.d.ts.map +1 -1
  6. package/lib/components/List/ContentContainer/index.js +12 -8
  7. package/lib/components/List/DefaultCell/index.d.ts +1 -2
  8. package/lib/components/List/DefaultCell/index.d.ts.map +1 -1
  9. package/lib/components/List/EditableCell/index.d.ts +13 -0
  10. package/lib/components/List/EditableCell/index.d.ts.map +1 -0
  11. package/lib/components/List/EditableCell/index.js +47 -0
  12. package/lib/components/List/EditableCell/styles.d.ts +204 -0
  13. package/lib/components/List/EditableCell/styles.d.ts.map +1 -0
  14. package/lib/components/List/EditableCell/styles.js +47 -0
  15. package/lib/components/List/ListItem/index.d.ts +1 -1
  16. package/lib/components/List/ListItem/index.d.ts.map +1 -1
  17. package/lib/components/List/ListItem/index.js +4 -2
  18. package/lib/components/List/constants.d.ts +5 -0
  19. package/lib/components/List/constants.d.ts.map +1 -1
  20. package/lib/components/List/constants.js +8 -2
  21. package/lib/components/List/index.d.ts +1 -0
  22. package/lib/components/List/index.d.ts.map +1 -1
  23. package/lib/components/List/index.js +3 -0
  24. package/lib/components/List/types.d.ts +2 -1
  25. package/lib/components/List/types.d.ts.map +1 -1
  26. package/lib/components/Popover/Arrow.d.ts +2 -2
  27. package/lib/components/Tag/propTypes.d.ts +1 -1
  28. package/lib/components/TagInput/index.d.ts +5 -1
  29. package/lib/components/TagInput/index.d.ts.map +1 -1
  30. package/lib/components/TagInput/index.js +125 -22
  31. package/lib/components/TagInput/index.test.js +110 -34
  32. package/lib/utils/commonUIColors.d.ts +2 -2
  33. package/package.json +2 -2
@@ -13,5 +13,5 @@ export declare const StyledLabel: import("styled-components").StyledComponent<"p
13
13
  export declare const StyledLabelDetails: import("styled-components").StyledComponent<"p", any, import("../../../components/Typography").PProps & {
14
14
  as: string;
15
15
  shade: number;
16
- }, "shade" | "as">;
16
+ }, "as" | "shade">;
17
17
  //# sourceMappingURL=styles.d.ts.map
@@ -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<"information" | "success" | "warning" | "danger" | "berryCrisp" | "koolaidCake" | "cookieMonster" | "cottonCandy" | "fizzyLime" | "mamboMango" | "carrotCake" | "roseGummy" | "licoriceMousse">;
17
+ color: PropTypes.Requireable<"danger" | "success" | "information" | "warning" | "berryCrisp" | "koolaidCake" | "cookieMonster" | "cottonCandy" | "fizzyLime" | "mamboMango" | "carrotCake" | "roseGummy" | "licoriceMousse">;
18
18
  icon: PropTypes.Validator<PropTypes.ReactComponentLike>;
19
19
  size: PropTypes.Requireable<string>;
20
20
  variant: typeof variantValidator;
@@ -4,7 +4,7 @@ import { Props as GroupProps, ItemProps as BaseItemProps } from '../../atoms/Boo
4
4
  export declare type Props = Omit<GroupProps, 'itemRenderer'>;
5
5
  export declare type ItemProps = BaseItemProps;
6
6
  declare const CheckboxGroup: {
7
- (props: Pick<GroupProps, "size" | "onChange" | "vertical" | "disabled" | "readOnly" | "status" | "items" | "warningMessage">): JSX.Element;
7
+ (props: Pick<GroupProps, "size" | "onChange" | "vertical" | "disabled" | "readOnly" | "status" | "warningMessage" | "items">): JSX.Element;
8
8
  propTypes: {
9
9
  disabled: PropTypes.Requireable<boolean>;
10
10
  items: PropTypes.Requireable<(PropTypes.InferProps<{}> | null | undefined)[]>;
@@ -8,11 +8,13 @@ export interface ContentContainerProps<T extends ValueType> {
8
8
  defaultViewState?: ListViewState;
9
9
  Component?: ComponentType<ExternalComponentProps<T>>;
10
10
  value?: T;
11
+ onSubmit?: (value?: T) => void;
11
12
  }
12
- export default function ContentContainer<T extends ValueType = string>({ defaultViewState, Component, value, }: ContentContainerProps<T>): JSX.Element;
13
+ export default function ContentContainer<T extends ValueType = string>({ defaultViewState, Component, value, onSubmit, }: ContentContainerProps<T>): JSX.Element;
13
14
  export declare function useListItemContent(): {
14
15
  viewState: "form" | "view";
15
16
  toggle: () => void;
17
+ onSubmit?: ((value?: string | number | boolean | Record<string, unknown> | undefined) => void) | undefined;
16
18
  size: "small" | "medium";
17
19
  };
18
20
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/List/ContentContainer/index.tsx"],"names":[],"mappings":"AAAA,OAAc,EAKZ,aAAa,EAEd,MAAM,OAAO,CAAC;AAOf,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAIzC,oBAAY,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5E,UAAU,sBAAsB,CAAC,CAAC,SAAS,SAAS,GAAG,MAAM,CAC3D,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC/B,KAAK,CAAC,EAAE,CAAC,CAAC;CACX;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC,SAAS,SAAS;IACxD,gBAAgB,CAAC,EAAE,aAAa,CAAC;IACjC,SAAS,CAAC,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;IACrD,KAAK,CAAC,EAAE,CAAC,CAAC;CACX;AAYD,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,CAAC,SAAS,SAAS,GAAG,MAAM,EAAE,EACrE,gBAAgB,EAChB,SAAmE,EACnE,KAAK,GACN,EAAE,qBAAqB,CAAC,CAAC,CAAC,eA4B1B;AAED,wBAAgB,kBAAkB;;;;EAKjC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/List/ContentContainer/index.tsx"],"names":[],"mappings":"AAAA,OAAc,EAKZ,aAAa,EAEd,MAAM,OAAO,CAAC;AAKf,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,oBAAY,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5E,UAAU,sBAAsB,CAAC,CAAC,SAAS,SAAS,GAAG,MAAM,CAC3D,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC/B,KAAK,CAAC,EAAE,CAAC,CAAC;CACX;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC,SAAS,SAAS;IACxD,gBAAgB,CAAC,EAAE,aAAa,CAAC;IACjC,SAAS,CAAC,EAAE,aAAa,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;IACrD,KAAK,CAAC,EAAE,CAAC,CAAC;IACV,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC;CAChC;AAaD,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,CAAC,SAAS,SAAS,GAAG,MAAM,EAAE,EACrE,gBAAgB,EAChB,SAAmE,EACnE,KAAK,EACL,QAAQ,GACT,EAAE,qBAAqB,CAAC,CAAC,CAAC,eA8B1B;AAED,wBAAgB,kBAAkB;;;;;EAKjC"}
@@ -45,7 +45,8 @@ function ContentContainer(_ref) {
45
45
  var defaultViewState = _ref.defaultViewState,
46
46
  _ref$Component = _ref.Component,
47
47
  Component = _ref$Component === void 0 ? _DefaultCell.default : _ref$Component,
48
- value = _ref.value;
48
+ value = _ref.value,
49
+ onSubmit = _ref.onSubmit;
49
50
 
50
51
  var _useState = (0, _react.useState)(defaultViewState || 'view'),
51
52
  _useState2 = _slicedToArray(_useState, 2),
@@ -58,14 +59,17 @@ function ContentContainer(_ref) {
58
59
  return _constants.VIEW_STATES.VIEW;
59
60
  });
60
61
  }, []);
61
- var values = (0, _react.useMemo)(function () {
62
- return {
63
- viewState: viewState,
64
- toggle: toggle
65
- };
66
- }, [viewState, toggle]);
62
+ var contextValue = (0, _react.useMemo)(function () {
63
+ return (// eslint-disable-next-line @typescript-eslint/no-object-literal-type-assertion
64
+ {
65
+ viewState: viewState,
66
+ toggle: toggle,
67
+ onSubmit: onSubmit
68
+ }
69
+ );
70
+ }, [viewState, toggle, onSubmit]);
67
71
  return _react.default.createElement(ContentCellProvider.Provider, {
68
- value: values
72
+ value: contextValue
69
73
  }, _react.default.createElement(_BaseCell.default, null, _react.default.createElement(Component, {
70
74
  value: value
71
75
  })));
@@ -1,7 +1,6 @@
1
1
  /// <reference types="react" />
2
- interface DefaultCellProps {
2
+ export interface DefaultCellProps {
3
3
  value?: string;
4
4
  }
5
5
  export default function DefaultCell({ value }: DefaultCellProps): JSX.Element;
6
- export {};
7
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/List/DefaultCell/index.tsx"],"names":[],"mappings":";AAIA,UAAU,gBAAgB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,KAAK,EAAE,EAAE,gBAAgB,eAM9D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/List/DefaultCell/index.tsx"],"names":[],"mappings":";AAIA,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,KAAK,EAAE,EAAE,gBAAgB,eAM9D"}
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import { DefaultCellProps } from '../DefaultCell';
3
+ import { EditableCellAlignment, ListViewState } from '../types';
4
+ import { ButtonProps } from '../../Button';
5
+ interface EditableCellProps extends Partial<DefaultCellProps>, Pick<ButtonProps, 'icon' | 'text'> {
6
+ onClick?: (viewState: ListViewState) => void;
7
+ align?: EditableCellAlignment;
8
+ buttonIcon: ButtonProps['icon'];
9
+ buttonText: ButtonProps['text'];
10
+ }
11
+ export default function EditableCell({ align, value, onClick, buttonText, buttonIcon, }: EditableCellProps): JSX.Element;
12
+ export {};
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/List/EditableCell/index.tsx"],"names":[],"mappings":";AAEA,OAAoB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAG/D,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGhE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,UAAU,iBACR,SAAQ,OAAO,CAAC,gBAAgB,CAAC,EAC/B,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IACpC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,aAAa,KAAK,IAAI,CAAC;IAC7C,KAAK,CAAC,EAAE,qBAAqB,CAAC;IAC9B,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChC,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACjC;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,KAAgB,EAChB,KAAK,EACL,OAAO,EACP,UAAU,EACV,UAAU,GACX,EAAE,iBAAiB,eAoBnB"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = EditableCell;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _DefaultCell = _interopRequireDefault(require("../DefaultCell"));
11
+
12
+ var _ = require("../..");
13
+
14
+ var _styles = require("./styles");
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 EditableCell(_ref) {
21
+ var _ref$align = _ref.align,
22
+ align = _ref$align === void 0 ? 'inline' : _ref$align,
23
+ value = _ref.value,
24
+ onClick = _ref.onClick,
25
+ buttonText = _ref.buttonText,
26
+ buttonIcon = _ref.buttonIcon;
27
+
28
+ var _useListItemContent = (0, _.useListItemContent)(),
29
+ viewState = _useListItemContent.viewState,
30
+ size = _useListItemContent.size;
31
+
32
+ var handleOnClick = (0, _react.useCallback)(function () {
33
+ onClick && onClick(viewState);
34
+ }, [onClick, viewState]);
35
+ return _react.default.createElement(_styles.Container, {
36
+ align: align
37
+ }, value && _react.default.createElement(_DefaultCell.default, {
38
+ value: value
39
+ }), _react.default.createElement(_styles.Button, {
40
+ variant: "ghost",
41
+ onClick: handleOnClick,
42
+ size: size,
43
+ text: buttonText,
44
+ icon: buttonIcon,
45
+ align: align
46
+ }));
47
+ }
@@ -0,0 +1,204 @@
1
+ /// <reference types="react" />
2
+ import { EditableCellAlignment } from '../types';
3
+ import { ButtonProps } from '../../Button';
4
+ export declare const Container: import("styled-components").StyledComponent<"div", any, Partial<{
5
+ readonly alignContent?: string | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<string, {
6
+ readonly XS: "XS";
7
+ readonly SM: "SM";
8
+ readonly MD: "MD";
9
+ readonly LG: "LG";
10
+ readonly XL: "XL";
11
+ }> | undefined;
12
+ readonly alignItems?: string | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<string, {
13
+ readonly XS: "XS";
14
+ readonly SM: "SM";
15
+ readonly MD: "MD";
16
+ readonly LG: "LG";
17
+ readonly XL: "XL";
18
+ }> | undefined;
19
+ readonly alignSelf?: string | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<string, {
20
+ readonly XS: "XS";
21
+ readonly SM: "SM";
22
+ readonly MD: "MD";
23
+ readonly LG: "LG";
24
+ readonly XL: "XL";
25
+ }> | undefined;
26
+ readonly flex?: string | number | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<import("react").ReactText, {
27
+ readonly XS: "XS";
28
+ readonly SM: "SM";
29
+ readonly MD: "MD";
30
+ readonly LG: "LG";
31
+ readonly XL: "XL";
32
+ }> | undefined;
33
+ readonly flexBasis?: string | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<string, {
34
+ readonly XS: "XS";
35
+ readonly SM: "SM";
36
+ readonly MD: "MD";
37
+ readonly LG: "LG";
38
+ readonly XL: "XL";
39
+ }> | undefined;
40
+ readonly flexDirection?: "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | "row" | "column" | "column-reverse" | "row-reverse" | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<import("csstype").FlexDirectionProperty, {
41
+ readonly XS: "XS";
42
+ readonly SM: "SM";
43
+ readonly MD: "MD";
44
+ readonly LG: "LG";
45
+ readonly XL: "XL";
46
+ }> | undefined;
47
+ readonly flexGrow?: number | "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<import("csstype").GlobalsNumber, {
48
+ readonly XS: "XS";
49
+ readonly SM: "SM";
50
+ readonly MD: "MD";
51
+ readonly LG: "LG";
52
+ readonly XL: "XL";
53
+ }> | undefined;
54
+ readonly flexShrink?: number | "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<import("csstype").GlobalsNumber, {
55
+ readonly XS: "XS";
56
+ readonly SM: "SM";
57
+ readonly MD: "MD";
58
+ readonly LG: "LG";
59
+ readonly XL: "XL";
60
+ }> | undefined;
61
+ readonly flexWrap?: "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | "nowrap" | "wrap" | "wrap-reverse" | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<import("csstype").FlexWrapProperty, {
62
+ readonly XS: "XS";
63
+ readonly SM: "SM";
64
+ readonly MD: "MD";
65
+ readonly LG: "LG";
66
+ readonly XL: "XL";
67
+ }> | undefined;
68
+ readonly justifyContent?: string | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<string, {
69
+ readonly XS: "XS";
70
+ readonly SM: "SM";
71
+ readonly MD: "MD";
72
+ readonly LG: "LG";
73
+ readonly XL: "XL";
74
+ }> | undefined;
75
+ readonly justifyItems?: string | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<string, {
76
+ readonly XS: "XS";
77
+ readonly SM: "SM";
78
+ readonly MD: "MD";
79
+ readonly LG: "LG";
80
+ readonly XL: "XL";
81
+ }> | undefined;
82
+ readonly justifySelf?: string | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<string, {
83
+ readonly XS: "XS";
84
+ readonly SM: "SM";
85
+ readonly MD: "MD";
86
+ readonly LG: "LG";
87
+ readonly XL: "XL";
88
+ }> | undefined;
89
+ readonly order?: number | "-moz-initial" | "inherit" | "initial" | "revert" | "unset" | import("../../../utils/dynamicModifiers").DynamicResponsiveModifiersProp<import("csstype").GlobalsNumber, {
90
+ readonly XS: "XS";
91
+ readonly SM: "SM";
92
+ readonly MD: "MD";
93
+ readonly LG: "LG";
94
+ readonly XL: "XL";
95
+ }> | undefined;
96
+ readonly size?: "XS" | "SM" | "MD" | "LG" | "XL" | undefined;
97
+ }> & Partial<{
98
+ readonly margin: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
99
+ readonly XS: "XS";
100
+ readonly SM: "SM";
101
+ readonly MD: "MD";
102
+ readonly LG: "LG";
103
+ readonly XL: "XL";
104
+ }>;
105
+ readonly marginBottom: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
106
+ readonly XS: "XS";
107
+ readonly SM: "SM";
108
+ readonly MD: "MD";
109
+ readonly LG: "LG";
110
+ readonly XL: "XL";
111
+ }>;
112
+ readonly marginLeft: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
113
+ readonly XS: "XS";
114
+ readonly SM: "SM";
115
+ readonly MD: "MD";
116
+ readonly LG: "LG";
117
+ readonly XL: "XL";
118
+ }>;
119
+ readonly marginRight: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
120
+ readonly XS: "XS";
121
+ readonly SM: "SM";
122
+ readonly MD: "MD";
123
+ readonly LG: "LG";
124
+ readonly XL: "XL";
125
+ }>;
126
+ readonly marginTop: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
127
+ readonly XS: "XS";
128
+ readonly SM: "SM";
129
+ readonly MD: "MD";
130
+ readonly LG: "LG";
131
+ readonly XL: "XL";
132
+ }>;
133
+ readonly marginX: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
134
+ readonly XS: "XS";
135
+ readonly SM: "SM";
136
+ readonly MD: "MD";
137
+ readonly LG: "LG";
138
+ readonly XL: "XL";
139
+ }>;
140
+ readonly marginY: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
141
+ readonly XS: "XS";
142
+ readonly SM: "SM";
143
+ readonly MD: "MD";
144
+ readonly LG: "LG";
145
+ readonly XL: "XL";
146
+ }>;
147
+ readonly padding: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
148
+ readonly XS: "XS";
149
+ readonly SM: "SM";
150
+ readonly MD: "MD";
151
+ readonly LG: "LG";
152
+ readonly XL: "XL";
153
+ }>;
154
+ readonly paddingBottom: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
155
+ readonly XS: "XS";
156
+ readonly SM: "SM";
157
+ readonly MD: "MD";
158
+ readonly LG: "LG";
159
+ readonly XL: "XL";
160
+ }>;
161
+ readonly paddingLeft: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
162
+ readonly XS: "XS";
163
+ readonly SM: "SM";
164
+ readonly MD: "MD";
165
+ readonly LG: "LG";
166
+ readonly XL: "XL";
167
+ }>;
168
+ readonly paddingRight: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
169
+ readonly XS: "XS";
170
+ readonly SM: "SM";
171
+ readonly MD: "MD";
172
+ readonly LG: "LG";
173
+ readonly XL: "XL";
174
+ }>;
175
+ readonly paddingTop: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
176
+ readonly XS: "XS";
177
+ readonly SM: "SM";
178
+ readonly MD: "MD";
179
+ readonly LG: "LG";
180
+ readonly XL: "XL";
181
+ }>;
182
+ readonly paddingX: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
183
+ readonly XS: "XS";
184
+ readonly SM: "SM";
185
+ readonly MD: "MD";
186
+ readonly LG: "LG";
187
+ readonly XL: "XL";
188
+ }>;
189
+ readonly paddingY: import("../../../utils/dynamicModifiers").DynamicModifiersProp<number, {
190
+ readonly XS: "XS";
191
+ readonly SM: "SM";
192
+ readonly MD: "MD";
193
+ readonly LG: "LG";
194
+ readonly XL: "XL";
195
+ }>;
196
+ }> & {
197
+ align: "bottom" | "right" | "inline";
198
+ }, never>;
199
+ interface AlignableButton extends ButtonProps {
200
+ align: EditableCellAlignment;
201
+ }
202
+ export declare const Button: import("styled-components").StyledComponent<import("react").RefForwardingComponent<HTMLButtonElement, ButtonProps>, any, AlignableButton, never>;
203
+ export {};
204
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/List/EditableCell/styles.ts"],"names":[],"mappings":";AAMA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAuB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAc3D,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAKrB,CAAC;AAYF,UAAU,eAAgB,SAAQ,WAAW;IAC3C,KAAK,EAAE,qBAAqB,CAAC;CAC9B;AAED,eAAO,MAAM,MAAM,kJAElB,CAAC"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Button = exports.Container = void 0;
7
+
8
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
+
10
+ var _rem = _interopRequireDefault(require("polished/lib/helpers/rem"));
11
+
12
+ var _designTokens = require("@decisiv/design-tokens");
13
+
14
+ var _Flex = _interopRequireDefault(require("../../Flex"));
15
+
16
+ var _Button = _interopRequireDefault(require("../../Button"));
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ 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; } }
21
+
22
+ var containerAlignmentsStyles = {
23
+ inline: (0, _styledComponents.css)(["flex-direction:row;"]),
24
+ right: (0, _styledComponents.css)(["flex-direction:row;"]),
25
+ bottom: (0, _styledComponents.css)(["flex-direction:column;"])
26
+ };
27
+ var Container = (0, _styledComponents.default)(_Flex.default).withConfig({
28
+ displayName: "styles__Container",
29
+ componentId: "sc-1tnde8x-0"
30
+ })(["gap:", ";text-align:left;", ";"], (0, _rem.default)(_designTokens.spacing.base * 0.5), function (_ref) {
31
+ var align = _ref.align;
32
+ return containerAlignmentsStyles[align];
33
+ });
34
+ exports.Container = Container;
35
+ var buttonAlignmentsStyles = {
36
+ inline: (0, _styledComponents.css)(["height:auto;"]),
37
+ right: (0, _styledComponents.css)([""]),
38
+ bottom: (0, _styledComponents.css)(["align-self:flex-start;"])
39
+ };
40
+ var Button = (0, _styledComponents.default)(_Button.default).withConfig({
41
+ displayName: "styles__Button",
42
+ componentId: "sc-1tnde8x-1"
43
+ })(["", ""], function (_ref2) {
44
+ var align = _ref2.align;
45
+ return buttonAlignmentsStyles[align];
46
+ });
47
+ exports.Button = Button;
@@ -4,5 +4,5 @@ import { LabelContainerProps } from '../LabelContainer';
4
4
  export interface ListItemProps<T extends ValueType> extends Omit<LabelContainerProps, 'onHistoryClick'>, ContentContainerProps<T> {
5
5
  onHistoryClick?: (value?: T) => void;
6
6
  }
7
- export default function ListItem<T extends ValueType = string>({ label, onHistoryClick, historyLabel, tooltipText, Component, defaultViewState, value, }: ListItemProps<T>): JSX.Element;
7
+ export default function ListItem<T extends ValueType = string>({ label, onHistoryClick, historyLabel, tooltipText, Component, defaultViewState, value, onSubmit, }: ListItemProps<T>): JSX.Element;
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/List/ListItem/index.tsx"],"names":[],"mappings":";AAEA,OAAyB,EACvB,qBAAqB,EACrB,SAAS,EACV,MAAM,qBAAqB,CAAC;AAC7B,OAAuB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAIxE,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,SAAS,CAChD,SAAQ,IAAI,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,EACjD,qBAAqB,CAAC,CAAC,CAAC;IAC1B,cAAc,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC;CACtC;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,CAAC,SAAS,SAAS,GAAG,MAAM,EAAE,EAC7D,KAAK,EACL,cAAc,EACd,YAAY,EACZ,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,KAAK,GACN,EAAE,aAAa,CAAC,CAAC,CAAC,eAoBlB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/List/ListItem/index.tsx"],"names":[],"mappings":";AAEA,OAAyB,EACvB,qBAAqB,EACrB,SAAS,EACV,MAAM,qBAAqB,CAAC;AAC7B,OAAuB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAIxE,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,SAAS,CAChD,SAAQ,IAAI,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,EACjD,qBAAqB,CAAC,CAAC,CAAC;IAC1B,cAAc,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC;CACtC;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,CAAC,SAAS,SAAS,GAAG,MAAM,EAAE,EAC7D,KAAK,EACL,cAAc,EACd,YAAY,EACZ,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,KAAK,EACL,QAAQ,GACT,EAAE,aAAa,CAAC,CAAC,CAAC,eAqBlB"}
@@ -24,7 +24,8 @@ function ListItem(_ref) {
24
24
  tooltipText = _ref.tooltipText,
25
25
  Component = _ref.Component,
26
26
  defaultViewState = _ref.defaultViewState,
27
- value = _ref.value;
27
+ value = _ref.value,
28
+ onSubmit = _ref.onSubmit;
28
29
  var handleOnDotClick = (0, _react.useCallback)(function () {
29
30
  if (onHistoryClick) onHistoryClick(value);
30
31
  }, [onHistoryClick, value]);
@@ -36,6 +37,7 @@ function ListItem(_ref) {
36
37
  }), _react.default.createElement(_ContentContainer.default, {
37
38
  Component: Component,
38
39
  defaultViewState: defaultViewState,
39
- value: value
40
+ value: value,
41
+ onSubmit: onSubmit
40
42
  }));
41
43
  }
@@ -11,4 +11,9 @@ export declare const VIEW_STATES: {
11
11
  readonly FORM: "form";
12
12
  readonly VIEW: "view";
13
13
  };
14
+ export declare const EDITABLE_CELL_ALIGNMENTS: {
15
+ readonly RIGHT: "right";
16
+ readonly BOTTOM: "bottom";
17
+ readonly INLINE: "inline";
18
+ };
14
19
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/components/List/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ;;;;CAIX,CAAC;AAEX,eAAO,MAAM,KAAK;;;CAGR,CAAC;AAEX,eAAO,MAAM,WAAW;;;CAGd,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/components/List/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ;;;;CAIX,CAAC;AAEX,eAAO,MAAM,KAAK;;;CAGR,CAAC;AAEX,eAAO,MAAM,WAAW;;;CAGd,CAAC;AAEX,eAAO,MAAM,wBAAwB;;;;CAI3B,CAAC"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.VIEW_STATES = exports.SIZES = exports.VARIANTS = void 0;
6
+ exports.EDITABLE_CELL_ALIGNMENTS = exports.VIEW_STATES = exports.SIZES = exports.VARIANTS = void 0;
7
7
  var VARIANTS = {
8
8
  ZEBRA: 'zebra',
9
9
  WHITE: 'white',
@@ -19,4 +19,10 @@ var VIEW_STATES = {
19
19
  FORM: 'form',
20
20
  VIEW: 'view'
21
21
  };
22
- exports.VIEW_STATES = VIEW_STATES;
22
+ exports.VIEW_STATES = VIEW_STATES;
23
+ var EDITABLE_CELL_ALIGNMENTS = {
24
+ RIGHT: 'right',
25
+ BOTTOM: 'bottom',
26
+ INLINE: 'inline'
27
+ };
28
+ exports.EDITABLE_CELL_ALIGNMENTS = EDITABLE_CELL_ALIGNMENTS;
@@ -7,6 +7,7 @@ declare function List({ variant, size, children, }: ListProps): JSX.Element;
7
7
  declare namespace List {
8
8
  var BaseCell: typeof import("./BaseCell").default;
9
9
  var DefaultCell: typeof import("./DefaultCell").default;
10
+ var EditableCell: typeof import("./EditableCell").default;
10
11
  var Item: typeof ListItem;
11
12
  }
12
13
  export default List;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/List/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAElE,OAAO,EAAE,SAAS,EAAoB,MAAM,SAAS,CAAC;AAKtD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAKlC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,eAAO,MAAM,WAAW,kDAEtB,CAAC;AAEH,iBAAwB,IAAI,CAAC,EAC3B,OAAwB,EACxB,IAAmB,EACnB,QAAQ,GACT,EAAE,SAAS,eAeX;kBAnBuB,IAAI;;;;;eAAJ,IAAI;AAqB5B,eAAO,MAAM,OAAO,yCAEnB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/List/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAElE,OAAO,EAAE,SAAS,EAAoB,MAAM,SAAS,CAAC;AAKtD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAMlC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,eAAO,MAAM,WAAW,kDAEtB,CAAC;AAEH,iBAAwB,IAAI,CAAC,EAC3B,OAAwB,EACxB,IAAmB,EACnB,QAAQ,GACT,EAAE,SAAS,eAeX;kBAnBuB,IAAI;;;;;;eAAJ,IAAI;AAqB5B,eAAO,MAAM,OAAO,yCAEnB,CAAC"}
@@ -24,6 +24,8 @@ var _styles = require("./styles");
24
24
 
25
25
  var _DefaultCell = _interopRequireDefault(require("./DefaultCell"));
26
26
 
27
+ var _EditableCell = _interopRequireDefault(require("./EditableCell"));
28
+
27
29
  var _ContentContainer = require("./ContentContainer");
28
30
 
29
31
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -61,4 +63,5 @@ var useList = function useList() {
61
63
  exports.useList = useList;
62
64
  List.BaseCell = _BaseCell.default;
63
65
  List.DefaultCell = _DefaultCell.default;
66
+ List.EditableCell = _EditableCell.default;
64
67
  List.Item = _ListItem.default;
@@ -1,10 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import { FlexProps } from '../../modifiers';
3
3
  import { ValueOf } from '../../types';
4
- import { VARIANTS, SIZES, VIEW_STATES } from './constants';
4
+ import { VARIANTS, SIZES, VIEW_STATES, EDITABLE_CELL_ALIGNMENTS } from './constants';
5
5
  export declare type ListVariant = ValueOf<typeof VARIANTS>;
6
6
  export declare type ListSize = ValueOf<typeof SIZES>;
7
7
  export declare type ListViewState = ValueOf<typeof VIEW_STATES>;
8
+ export declare type EditableCellAlignment = ValueOf<typeof EDITABLE_CELL_ALIGNMENTS>;
8
9
  export interface ListProps extends Omit<FlexProps, 'size'> {
9
10
  variant?: ListVariant;
10
11
  size?: ListSize;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/List/types.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE3D,oBAAY,WAAW,GAAG,OAAO,CAAC,OAAO,QAAQ,CAAC,CAAC;AACnD,oBAAY,QAAQ,GAAG,OAAO,CAAC,OAAO,KAAK,CAAC,CAAC;AAC7C,oBAAY,aAAa,GAAG,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC;AAExD,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC;IACxD,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,oBAAY,gBAAgB,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/List/types.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EACL,QAAQ,EACR,KAAK,EACL,WAAW,EACX,wBAAwB,EACzB,MAAM,aAAa,CAAC;AAErB,oBAAY,WAAW,GAAG,OAAO,CAAC,OAAO,QAAQ,CAAC,CAAC;AACnD,oBAAY,QAAQ,GAAG,OAAO,CAAC,OAAO,KAAK,CAAC,CAAC;AAC7C,oBAAY,aAAa,GAAG,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC;AACxD,oBAAY,qBAAqB,GAAG,OAAO,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE7E,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC;IACxD,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,oBAAY,gBAAgB,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import { ArrowProps } from './types';
2
2
  export declare const arrowColors: {
3
- information: import("@decisiv/design-tokens/lib/color").Color;
3
+ danger: import("@decisiv/design-tokens/lib/color").Color;
4
4
  success: import("@decisiv/design-tokens/lib/color").Color;
5
+ information: import("@decisiv/design-tokens/lib/color").Color;
5
6
  warning: import("@decisiv/design-tokens/lib/color").Color;
6
- danger: import("@decisiv/design-tokens/lib/color").Color;
7
7
  berryCrisp: import("@decisiv/design-tokens/lib/color").Color;
8
8
  koolaidCake: import("@decisiv/design-tokens/lib/color").Color;
9
9
  cookieMonster: import("@decisiv/design-tokens/lib/color").Color;
@@ -7,7 +7,7 @@ export declare const propTypes: {
7
7
  actionAttributes: any;
8
8
  actionIntent: PropTypes.Requireable<string>;
9
9
  actionRef: PropTypes.Requireable<any>;
10
- color: PropTypes.Requireable<"information" | "success" | "warning" | "danger" | "berryCrisp" | "koolaidCake" | "cookieMonster" | "cottonCandy" | "fizzyLime" | "mamboMango" | "carrotCake" | "roseGummy" | "licoriceMousse">;
10
+ color: PropTypes.Requireable<"danger" | "success" | "information" | "warning" | "berryCrisp" | "koolaidCake" | "cookieMonster" | "cottonCandy" | "fizzyLime" | "mamboMango" | "carrotCake" | "roseGummy" | "licoriceMousse">;
11
11
  variant: PropTypes.Requireable<string>;
12
12
  palette: PropTypes.Requireable<string>;
13
13
  size: PropTypes.Requireable<string>;
@@ -1,10 +1,14 @@
1
1
  /// <reference types="react" />
2
2
  import { BaseInputFieldProps } from '../../atoms/InputField';
3
+ import { DropdownListItem } from '../DropdownList/types';
3
4
  export interface TagInputProps extends Omit<BaseInputFieldProps, 'onChange' | 'children' | 'value' | 'hideLabel'> {
4
5
  hiddenLabel?: boolean;
5
6
  defaultTags?: string[];
6
7
  tags?: string[];
8
+ options: DropdownListItem[];
7
9
  onChange?: (value: string[]) => void;
10
+ onSelect?: (item: string[]) => void;
11
+ zIndex?: number;
8
12
  }
9
- export default function TagInput({ defaultTags, tags, onChange, disabled, readOnly, label, hiddenLabel, ...props }: TagInputProps): JSX.Element;
13
+ export default function TagInput({ defaultTags, tags, onChange, disabled, readOnly, label, hiddenLabel, options, onSelect, zIndex, ...props }: TagInputProps): JSX.Element;
10
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/TagInput/index.tsx"],"names":[],"mappings":";AAeA,OAAmB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAMzE,MAAM,WAAW,aACf,SAAQ,IAAI,CACV,mBAAmB,EACnB,UAAU,GAAG,UAAU,GAAG,OAAO,GAAG,WAAW,CAChD;IACD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CACtC;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,WAAgB,EAChB,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,WAAW,EACX,GAAG,KAAK,EACT,EAAE,aAAa,eAqMf"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/TagInput/index.tsx"],"names":[],"mappings":";AAoBA,OAAmB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAIzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAKzD,MAAM,WAAW,aACf,SAAQ,IAAI,CACV,mBAAmB,EACnB,UAAU,GAAG,UAAU,GAAG,OAAO,GAAG,WAAW,CAChD;IACD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,WAAgB,EAChB,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,WAAW,EACX,OAAO,EACP,QAAQ,EACR,MAAM,EACN,GAAG,KAAK,EACT,EAAE,aAAa,eA2Sf"}
@@ -9,18 +9,26 @@ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _rem = _interopRequireDefault(require("polished/lib/helpers/rem"));
11
11
 
12
+ var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
13
+
14
+ var _breakpointObserver = require("@decisiv/breakpoint-observer");
15
+
12
16
  var _spacing = _interopRequireDefault(require("@decisiv/design-tokens/lib/spacing"));
13
17
 
14
18
  var _Times = _interopRequireDefault(require("@decisiv/iconix/lib/components/Times"));
15
19
 
16
20
  var _useTranslations = _interopRequireDefault(require("../../utils/useTranslations"));
17
21
 
22
+ var _useClickOutside = _interopRequireDefault(require("../../utils/useClickOutside"));
23
+
18
24
  var _InputField = _interopRequireDefault(require("../../atoms/InputField"));
19
25
 
20
26
  var _Tag = _interopRequireDefault(require("../Tag"));
21
27
 
22
28
  var _Button = _interopRequireDefault(require("../Button"));
23
29
 
30
+ var _DropdownList = _interopRequireDefault(require("../DropdownList"));
31
+
24
32
  var _styles = require("./styles");
25
33
 
26
34
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -58,9 +66,13 @@ function TagInput(_ref) {
58
66
  readOnly = _ref.readOnly,
59
67
  label = _ref.label,
60
68
  hiddenLabel = _ref.hiddenLabel,
61
- props = _objectWithoutProperties(_ref, ["defaultTags", "tags", "onChange", "disabled", "readOnly", "label", "hiddenLabel"]);
69
+ options = _ref.options,
70
+ onSelect = _ref.onSelect,
71
+ zIndex = _ref.zIndex,
72
+ props = _objectWithoutProperties(_ref, ["defaultTags", "tags", "onChange", "disabled", "readOnly", "label", "hiddenLabel", "options", "onSelect", "zIndex"]);
62
73
 
63
74
  var clearButtonRef = (0, _react.useRef)(null);
75
+ var listRef = (0, _react.useRef)(null);
64
76
  var inputRef = (0, _react.useRef)(null);
65
77
 
66
78
  var _useState = (0, _react.useState)(false),
@@ -73,6 +85,16 @@ function TagInput(_ref) {
73
85
  innerTags = _useState4[0],
74
86
  setInnerTags = _useState4[1];
75
87
 
88
+ var _useBreakpointObserve = (0, _breakpointObserver.useBreakpointObserver)(),
89
+ _useBreakpointObserve2 = _slicedToArray(_useBreakpointObserve, 2),
90
+ inputContainerRef = _useBreakpointObserve2[0],
91
+ dimensions = _useBreakpointObserve2[1].dimensions;
92
+
93
+ var _useState5 = (0, _react.useState)(false),
94
+ _useState6 = _slicedToArray(_useState5, 2),
95
+ isPopoverVisible = _useState6[0],
96
+ setIsPopoverVisible = _useState6[1];
97
+
76
98
  var translate = (0, _useTranslations.default)();
77
99
  var isControlled = (0, _react.useMemo)(function () {
78
100
  return !!tags;
@@ -85,6 +107,9 @@ function TagInput(_ref) {
85
107
  if (!onChange) return;
86
108
  onChange(value);
87
109
  }, [onChange]);
110
+ var hasOptions = (0, _react.useMemo)(function () {
111
+ return !(0, _isEmpty.default)(options);
112
+ }, [options]);
88
113
  var handleAddTag = (0, _react.useCallback)(function (rawString) {
89
114
  var text = rawString.replace(/\s+/g, ' ').trim();
90
115
  if (!text || tagsToRender.includes(text)) return;
@@ -114,21 +139,26 @@ function TagInput(_ref) {
114
139
  });
115
140
  }, [isControlled, handleNotifyChange, tags]);
116
141
  var handleRemoveTag = (0, _react.useCallback)(function (text) {
117
- if (isControlled) {
118
- handleNotifyChange(tags.filter(function (tag) {
119
- return tag !== text;
120
- }));
121
- return;
122
- }
123
-
124
- setInnerTags(function (oldState) {
125
- var newState = oldState.filter(function (tag) {
126
- return tag !== text;
142
+ return function (e) {
143
+ if (hasOptions) e.stopPropagation();
144
+
145
+ if (isControlled) {
146
+ handleNotifyChange(_toConsumableArray(tags).filter(function (tag) {
147
+ return tag !== text;
148
+ }));
149
+ return;
150
+ }
151
+
152
+ setInnerTags(function (oldState) {
153
+ var newState = _toConsumableArray(oldState).filter(function (tag) {
154
+ return tag !== text;
155
+ });
156
+
157
+ handleNotifyChange(newState);
158
+ return newState;
127
159
  });
128
- handleNotifyChange(newState);
129
- return newState;
130
- });
131
- }, [isControlled, handleNotifyChange, tags]);
160
+ };
161
+ }, [isControlled, handleNotifyChange, tags, hasOptions]);
132
162
  var handleOnKeyUp = (0, _react.useCallback)(function (e) {
133
163
  e.stopPropagation();
134
164
  var text = e.target.value;
@@ -157,19 +187,94 @@ function TagInput(_ref) {
157
187
  e.target.value = '';
158
188
  setInputVisible(false);
159
189
  }, [handleAddTag]);
160
- var handleOnClearButtonClick = (0, _react.useCallback)(function () {
190
+ var handleOnClearButtonClick = (0, _react.useCallback)(function (e) {
191
+ if (hasOptions) e.stopPropagation();
192
+
161
193
  if (inputRef.current) {
162
194
  inputRef.current.value = '';
163
195
  }
164
- }, []);
165
- return _react.default.createElement(_styles.Wrapper, null, _react.default.createElement(_InputField.default, _extends({
196
+ }, [hasOptions]);
197
+ var handleOnSelect = (0, _react.useCallback)(function (selection) {
198
+ var allSelection = Array.isArray(selection) ? selection : [selection];
199
+
200
+ if (onSelect) {
201
+ onSelect(allSelection);
202
+ }
203
+
204
+ if (isControlled) {
205
+ handleNotifyChange([].concat(_toConsumableArray(tags), _toConsumableArray(allSelection)));
206
+ setIsPopoverVisible(false);
207
+ return;
208
+ }
209
+
210
+ setInnerTags(function (oldState) {
211
+ var newState = [].concat(_toConsumableArray(oldState), _toConsumableArray(allSelection));
212
+ handleNotifyChange(newState);
213
+ return newState;
214
+ });
215
+ setIsPopoverVisible(false);
216
+ }, [handleNotifyChange, tags, isControlled, options]);
217
+ /**
218
+ * Toggle the dropdown list.
219
+ */
220
+
221
+ var toggleIsPopoverVisible = (0, _react.useCallback)(function () {
222
+ setIsPopoverVisible(!isPopoverVisible);
223
+ }, [isPopoverVisible]);
224
+ /**
225
+ * Clicking anywhere within the InputField component (except the clear button) should toggle
226
+ * the dropdown list.
227
+ */
228
+
229
+ var handleContainerClick = (0, _react.useCallback)(function () {
230
+ toggleIsPopoverVisible();
231
+ }, [toggleIsPopoverVisible]); // When the dropdown is visible, clicking anywhere outside of the dropdown should close it.
232
+
233
+ var handleClickOutsideList = (0, _react.useCallback)(function () {
234
+ if (isPopoverVisible) {
235
+ setIsPopoverVisible(false);
236
+ }
237
+ }, [isPopoverVisible]);
238
+ (0, _react.useEffect)(function () {
239
+ if (isPopoverVisible) {
240
+ // Delay to ensure DOM updates are complete
241
+ var timer = setTimeout(function () {
242
+ if (inputRef.current) {
243
+ inputRef.current.focus();
244
+ }
245
+ }, 0);
246
+ return function () {
247
+ return clearTimeout(timer);
248
+ }; // Cleanup the timer on unmount or state change
249
+ }
250
+
251
+ return function () {};
252
+ }, [isPopoverVisible, inputRef]);
253
+ (0, _useClickOutside.default)([listRef], handleClickOutsideList, {
254
+ capture: true
255
+ });
256
+ return _react.default.createElement(_styles.Wrapper, null, hasOptions && _react.default.createElement(_DropdownList.default, {
257
+ name: "".concat(label, "-dropdown-list"),
258
+ items: options,
259
+ borderRadius: "0",
260
+ minWidth: "".concat((dimensions.width || 0) + 1, "px"),
261
+ maxWidth: "unset",
262
+ showArrow: false,
263
+ target: inputContainerRef,
264
+ onChange: handleOnSelect,
265
+ listRef: listRef,
266
+ visible: isPopoverVisible,
267
+ zIndex: zIndex
268
+ }), _react.default.createElement(_InputField.default, _extends({
166
269
  ref: inputRef,
167
270
  onFocus: handleFocus,
168
271
  onBlur: handleBlur,
169
272
  disabled: disabled,
170
273
  readOnly: readOnly,
171
274
  label: label,
172
- hideLabel: hiddenLabel
275
+ hideLabel: hiddenLabel,
276
+ inputContainerRef: inputContainerRef,
277
+ onClick: handleContainerClick
173
278
  }, props), function (innerProps) {
174
279
  return _react.default.createElement(_styles.Container, null, tagsToRender.map(function (tag) {
175
280
  return _react.default.createElement(_Tag.default, {
@@ -178,9 +283,7 @@ function TagInput(_ref) {
178
283
  text: tag,
179
284
  palette: "pastel",
180
285
  color: isDisabled ? 'licoriceMousse' : 'information',
181
- action: isDisabled ? undefined : function () {
182
- return handleRemoveTag(tag);
183
- },
286
+ action: isDisabled ? undefined : handleRemoveTag(tag),
184
287
  actionIntent: "danger",
185
288
  actionAttributes: {
186
289
  'aria-label': translate(undefined, 'tagInput.tagAriaLabel', {
@@ -4,15 +4,53 @@ var _react = _interopRequireDefault(require("react"));
4
4
 
5
5
  var _react2 = require("@testing-library/react");
6
6
 
7
+ var _ConfigProvider = require("../../providers/ConfigProvider");
8
+
7
9
  var _ = _interopRequireDefault(require("."));
8
10
 
9
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
12
 
13
+ function _extends() { _extends = Object.assign || 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); }
14
+
11
15
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
12
16
 
13
17
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
14
18
 
15
- var onChange = jest.fn();
19
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { keys.push.apply(keys, Object.getOwnPropertySymbols(object)); } if (enumerableOnly) keys = keys.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); return keys; }
20
+
21
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
22
+
23
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
24
+
25
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
26
+
27
+ var onChange = jest.fn(); // Prevent warnings about missing document methods (createRange, etc.)
28
+
29
+ jest.mock('popper.js', function () {
30
+ var _class, _temp;
31
+
32
+ var PopperJS = jest.requireActual('popper.js');
33
+ return _temp = _class = function _class() {
34
+ _classCallCheck(this, _class);
35
+
36
+ return {
37
+ destroy: function destroy() {},
38
+ scheduleUpdate: function scheduleUpdate() {}
39
+ };
40
+ }, _defineProperty(_class, "placements", PopperJS.placements), _temp;
41
+ });
42
+
43
+ var wrapper = function wrapper(_ref) {
44
+ var children = _ref.children;
45
+ return _react.default.createElement(_ConfigProvider.ConfigProvider, null, children);
46
+ };
47
+
48
+ var render = function render(ui, options) {
49
+ return (0, _react2.render)(ui, _objectSpread({}, options, {
50
+ wrapper: wrapper
51
+ }));
52
+ };
53
+
16
54
  afterEach(function () {
17
55
  onChange.mockClear();
18
56
  });
@@ -24,7 +62,7 @@ describe('TagInput', function () {
24
62
  while (1) {
25
63
  switch (_context.prev = _context.next) {
26
64
  case 0:
27
- _render = (0, _react2.render)(_react.default.createElement(_.default, {
65
+ _render = render(_react.default.createElement(_.default, {
28
66
  tags: [],
29
67
  hideLabel: false,
30
68
  label: "My Tag Input",
@@ -46,7 +84,7 @@ describe('TagInput', function () {
46
84
  while (1) {
47
85
  switch (_context2.prev = _context2.next) {
48
86
  case 0:
49
- _render2 = (0, _react2.render)(_react.default.createElement(_.default, {
87
+ _render2 = render(_react.default.createElement(_.default, {
50
88
  tags: [],
51
89
  hideLabel: false,
52
90
  label: "My Tag Input",
@@ -69,7 +107,7 @@ describe('TagInput', function () {
69
107
  while (1) {
70
108
  switch (_context3.prev = _context3.next) {
71
109
  case 0:
72
- _render3 = (0, _react2.render)(_react.default.createElement(_.default, {
110
+ _render3 = render(_react.default.createElement(_.default, {
73
111
  tags: [],
74
112
  hideLabel: false,
75
113
  label: "My Tag Input",
@@ -93,7 +131,7 @@ describe('TagInput', function () {
93
131
  while (1) {
94
132
  switch (_context4.prev = _context4.next) {
95
133
  case 0:
96
- _render4 = (0, _react2.render)(_react.default.createElement(_.default, {
134
+ _render4 = render(_react.default.createElement(_.default, {
97
135
  defaultTags: ['Foo tag'],
98
136
  label: "My Tag Input"
99
137
  })), getByText = _render4.getByText;
@@ -113,7 +151,7 @@ describe('TagInput', function () {
113
151
  while (1) {
114
152
  switch (_context5.prev = _context5.next) {
115
153
  case 0:
116
- _render5 = (0, _react2.render)(_react.default.createElement(_.default, {
154
+ _render5 = render(_react.default.createElement(_.default, {
117
155
  defaultTags: ['My tag'],
118
156
  label: "My Tag Input"
119
157
  })), getByLabelText = _render5.getByLabelText;
@@ -137,7 +175,7 @@ describe('TagInput', function () {
137
175
  while (1) {
138
176
  switch (_context6.prev = _context6.next) {
139
177
  case 0:
140
- _render6 = (0, _react2.render)(_react.default.createElement(_.default, {
178
+ _render6 = render(_react.default.createElement(_.default, {
141
179
  defaultTags: ['Foo tag'],
142
180
  label: "My Tag Input",
143
181
  "aria-label": "My Tag Input"
@@ -169,7 +207,7 @@ describe('TagInput', function () {
169
207
  while (1) {
170
208
  switch (_context7.prev = _context7.next) {
171
209
  case 0:
172
- _render7 = (0, _react2.render)(_react.default.createElement(_.default, {
210
+ _render7 = render(_react.default.createElement(_.default, {
173
211
  defaultTags: ['Foo tag'],
174
212
  label: "My Tag Input",
175
213
  "aria-label": "My Tag Input",
@@ -204,7 +242,7 @@ describe('TagInput', function () {
204
242
  while (1) {
205
243
  switch (_context8.prev = _context8.next) {
206
244
  case 0:
207
- _render8 = (0, _react2.render)(_react.default.createElement(_.default, {
245
+ _render8 = render(_react.default.createElement(_.default, {
208
246
  defaultTags: ['Foo tag'],
209
247
  label: "My Tag Input",
210
248
  "aria-label": "My Tag Input",
@@ -237,7 +275,7 @@ describe('TagInput', function () {
237
275
  while (1) {
238
276
  switch (_context9.prev = _context9.next) {
239
277
  case 0:
240
- _render9 = (0, _react2.render)(_react.default.createElement(_.default, {
278
+ _render9 = render(_react.default.createElement(_.default, {
241
279
  defaultTags: ['Foo tag'],
242
280
  label: "My Tag Input",
243
281
  "aria-label": "My Tag Input",
@@ -273,7 +311,7 @@ describe('TagInput', function () {
273
311
  while (1) {
274
312
  switch (_context10.prev = _context10.next) {
275
313
  case 0:
276
- _render10 = (0, _react2.render)(_react.default.createElement(_.default, {
314
+ _render10 = render(_react.default.createElement(_.default, {
277
315
  defaultTags: ['Foo tag'],
278
316
  label: "My Tag Input",
279
317
  "aria-label": "My Tag Input"
@@ -305,7 +343,7 @@ describe('TagInput', function () {
305
343
  while (1) {
306
344
  switch (_context11.prev = _context11.next) {
307
345
  case 0:
308
- _render11 = (0, _react2.render)(_react.default.createElement(_.default, {
346
+ _render11 = render(_react.default.createElement(_.default, {
309
347
  defaultTags: ['Foo tag'],
310
348
  label: "My Tag Input",
311
349
  "aria-label": "My Tag Input",
@@ -343,7 +381,7 @@ describe('TagInput', function () {
343
381
  while (1) {
344
382
  switch (_context12.prev = _context12.next) {
345
383
  case 0:
346
- _render12 = (0, _react2.render)(_react.default.createElement(_.default, {
384
+ _render12 = render(_react.default.createElement(_.default, {
347
385
  defaultTags: ['Foo tag'],
348
386
  label: "My Tag Input",
349
387
  "aria-label": "My Tag Input",
@@ -374,7 +412,7 @@ describe('TagInput', function () {
374
412
  while (1) {
375
413
  switch (_context13.prev = _context13.next) {
376
414
  case 0:
377
- _render13 = (0, _react2.render)(_react.default.createElement(_.default, {
415
+ _render13 = render(_react.default.createElement(_.default, {
378
416
  defaultTags: ['Foo tag'],
379
417
  label: "My Tag Input",
380
418
  "aria-label": "My Tag Input",
@@ -407,7 +445,7 @@ describe('TagInput', function () {
407
445
  while (1) {
408
446
  switch (_context14.prev = _context14.next) {
409
447
  case 0:
410
- _render14 = (0, _react2.render)(_react.default.createElement(_.default, {
448
+ _render14 = render(_react.default.createElement(_.default, {
411
449
  defaultTags: ['Foo tag'],
412
450
  label: "My Tag Input",
413
451
  "aria-label": "My Tag Input",
@@ -438,7 +476,7 @@ describe('TagInput', function () {
438
476
  while (1) {
439
477
  switch (_context15.prev = _context15.next) {
440
478
  case 0:
441
- _render15 = (0, _react2.render)(_react.default.createElement(_.default, {
479
+ _render15 = render(_react.default.createElement(_.default, {
442
480
  defaultTags: ['Foo tag'],
443
481
  label: "My Tag Input",
444
482
  "aria-label": "My Tag Input",
@@ -472,7 +510,7 @@ describe('TagInput', function () {
472
510
  while (1) {
473
511
  switch (_context16.prev = _context16.next) {
474
512
  case 0:
475
- _render16 = (0, _react2.render)(_react.default.createElement(_.default, {
513
+ _render16 = render(_react.default.createElement(_.default, {
476
514
  defaultTags: ['Foo tag'],
477
515
  label: "My Tag Input",
478
516
  "aria-label": "My Tag Input"
@@ -502,7 +540,7 @@ describe('TagInput', function () {
502
540
  while (1) {
503
541
  switch (_context17.prev = _context17.next) {
504
542
  case 0:
505
- _render17 = (0, _react2.render)(_react.default.createElement(_.default, {
543
+ _render17 = render(_react.default.createElement(_.default, {
506
544
  defaultTags: ['Foo tag'],
507
545
  label: "My Tag Input",
508
546
  "aria-label": "My Tag Input",
@@ -537,7 +575,7 @@ describe('TagInput', function () {
537
575
  while (1) {
538
576
  switch (_context18.prev = _context18.next) {
539
577
  case 0:
540
- _render18 = (0, _react2.render)(_react.default.createElement(_.default, {
578
+ _render18 = render(_react.default.createElement(_.default, {
541
579
  defaultTags: ['Foo tag'],
542
580
  label: "My Tag Input",
543
581
  "aria-label": "My Tag Input",
@@ -572,7 +610,7 @@ describe('TagInput', function () {
572
610
  while (1) {
573
611
  switch (_context19.prev = _context19.next) {
574
612
  case 0:
575
- _render19 = (0, _react2.render)(_react.default.createElement(_.default, {
613
+ _render19 = render(_react.default.createElement(_.default, {
576
614
  defaultTags: ['Foo tag'],
577
615
  label: "My Tag Input",
578
616
  "aria-label": "My Tag Input",
@@ -599,7 +637,7 @@ describe('TagInput', function () {
599
637
  while (1) {
600
638
  switch (_context20.prev = _context20.next) {
601
639
  case 0:
602
- _render20 = (0, _react2.render)(_react.default.createElement(_.default, {
640
+ _render20 = render(_react.default.createElement(_.default, {
603
641
  defaultTags: ['Foo tag'],
604
642
  label: "My Tag Input",
605
643
  "aria-label": "My Tag Input",
@@ -630,7 +668,7 @@ describe('TagInput', function () {
630
668
  while (1) {
631
669
  switch (_context21.prev = _context21.next) {
632
670
  case 0:
633
- _render21 = (0, _react2.render)(_react.default.createElement(_.default, {
671
+ _render21 = render(_react.default.createElement(_.default, {
634
672
  defaultTags: ['Foo tag'],
635
673
  label: "My Tag Input",
636
674
  "aria-label": "My Tag Input",
@@ -649,18 +687,18 @@ describe('TagInput', function () {
649
687
  }, _callee21);
650
688
  })));
651
689
  it('call onChange callback', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee22() {
652
- var _render22, getByLabelText, queryByLabelText;
690
+ var _render22, getByLabelText;
653
691
 
654
692
  return regeneratorRuntime.wrap(function _callee22$(_context22) {
655
693
  while (1) {
656
694
  switch (_context22.prev = _context22.next) {
657
695
  case 0:
658
- _render22 = (0, _react2.render)(_react.default.createElement(_.default, {
696
+ _render22 = render(_react.default.createElement(_.default, {
659
697
  defaultTags: ['Foo tag'],
660
698
  label: "My Tag Input",
661
699
  "aria-label": "My Tag Input",
662
700
  onChange: onChange
663
- })), getByLabelText = _render22.getByLabelText, queryByLabelText = _render22.queryByLabelText;
701
+ })), getByLabelText = _render22.getByLabelText;
664
702
 
665
703
  _react2.fireEvent.click(getByLabelText('Remove Foo tag'));
666
704
 
@@ -687,7 +725,7 @@ describe('TagInput', function () {
687
725
  while (1) {
688
726
  switch (_context23.prev = _context23.next) {
689
727
  case 0:
690
- _render23 = (0, _react2.render)(_react.default.createElement(_.default, {
728
+ _render23 = render(_react.default.createElement(_.default, {
691
729
  tags: ['Foo tag'],
692
730
  label: "My Tag Input",
693
731
  "aria-label": "My Tag Input",
@@ -722,7 +760,7 @@ describe('TagInput', function () {
722
760
  while (1) {
723
761
  switch (_context24.prev = _context24.next) {
724
762
  case 0:
725
- _render24 = (0, _react2.render)(_react.default.createElement(_.default, {
763
+ _render24 = render(_react.default.createElement(_.default, {
726
764
  tags: ['Foo tag'],
727
765
  label: "My Tag Input",
728
766
  "aria-label": "My Tag Input",
@@ -758,7 +796,7 @@ describe('TagInput', function () {
758
796
  while (1) {
759
797
  switch (_context25.prev = _context25.next) {
760
798
  case 0:
761
- _render25 = (0, _react2.render)(_react.default.createElement(_.default, {
799
+ _render25 = render(_react.default.createElement(_.default, {
762
800
  tags: ['Foo tag'],
763
801
  label: "My Tag Input",
764
802
  "aria-label": "My Tag Input",
@@ -796,7 +834,7 @@ describe('TagInput', function () {
796
834
  while (1) {
797
835
  switch (_context26.prev = _context26.next) {
798
836
  case 0:
799
- _render26 = (0, _react2.render)(_react.default.createElement(_.default, {
837
+ _render26 = render(_react.default.createElement(_.default, {
800
838
  tags: ['Foo tag'],
801
839
  label: "My Tag Input",
802
840
  "aria-label": "My Tag Input",
@@ -829,7 +867,7 @@ describe('TagInput', function () {
829
867
  while (1) {
830
868
  switch (_context27.prev = _context27.next) {
831
869
  case 0:
832
- _render27 = (0, _react2.render)(_react.default.createElement(_.default, {
870
+ _render27 = render(_react.default.createElement(_.default, {
833
871
  tags: ['Foo tag'],
834
872
  label: "My Tag Input",
835
873
  "aria-label": "My Tag Input",
@@ -863,7 +901,7 @@ describe('TagInput', function () {
863
901
  while (1) {
864
902
  switch (_context28.prev = _context28.next) {
865
903
  case 0:
866
- _render28 = (0, _react2.render)(_react.default.createElement(_.default, {
904
+ _render28 = render(_react.default.createElement(_.default, {
867
905
  tags: ['Foo tag'],
868
906
  label: "My Tag Input",
869
907
  "aria-label": "My Tag Input",
@@ -898,7 +936,7 @@ describe('TagInput', function () {
898
936
  while (1) {
899
937
  switch (_context29.prev = _context29.next) {
900
938
  case 0:
901
- _render29 = (0, _react2.render)(_react.default.createElement(_.default, {
939
+ _render29 = render(_react.default.createElement(_.default, {
902
940
  defaultTags: ['Foo tag'],
903
941
  label: "My Tag Input",
904
942
  "aria-label": "My Tag Input",
@@ -948,7 +986,7 @@ describe('TagInput', function () {
948
986
  while (1) {
949
987
  switch (_context31.prev = _context31.next) {
950
988
  case 0:
951
- _render30 = (0, _react2.render)(_react.default.createElement(_.default, {
989
+ _render30 = render(_react.default.createElement(_.default, {
952
990
  tags: ['Foo tag'],
953
991
  label: "My Tag Input",
954
992
  "aria-label": "My Tag Input",
@@ -978,7 +1016,7 @@ describe('TagInput', function () {
978
1016
  while (1) {
979
1017
  switch (_context32.prev = _context32.next) {
980
1018
  case 0:
981
- _render31 = (0, _react2.render)(_react.default.createElement(_.default, {
1019
+ _render31 = render(_react.default.createElement(_.default, {
982
1020
  tags: ['Foo tag'],
983
1021
  label: "My Tag Input",
984
1022
  "aria-label": "My Tag Input",
@@ -998,4 +1036,42 @@ describe('TagInput', function () {
998
1036
  }, _callee32);
999
1037
  })));
1000
1038
  });
1039
+ describe('dropdown', function () {
1040
+ var defaultProps = {
1041
+ label: 'My Tag Input',
1042
+ options: [{
1043
+ label: 'Option1',
1044
+ value: 'Option1',
1045
+ id: 'Option1'
1046
+ }],
1047
+ onChange: jest.fn(),
1048
+ onSelect: jest.fn()
1049
+ };
1050
+ it('toggles the dropdown visibility when the container is clicked', function () {
1051
+ var _render32 = render(_react.default.createElement(_.default, defaultProps)),
1052
+ getByLabelText = _render32.getByLabelText,
1053
+ getByText = _render32.getByText;
1054
+
1055
+ _react2.fireEvent.click(getByLabelText('My Tag Input'));
1056
+
1057
+ expect(getByText('Option1')).toBeInTheDocument();
1058
+ });
1059
+ it('calls onSelect when an option is selected from the dropdown', function () {
1060
+ var onSelectMock = jest.fn();
1061
+
1062
+ var _render33 = render(_react.default.createElement(_.default, _extends({}, defaultProps, {
1063
+ onSelect: onSelectMock
1064
+ }))),
1065
+ getByLabelText = _render33.getByLabelText,
1066
+ getByText = _render33.getByText;
1067
+
1068
+ _react2.fireEvent.click(getByLabelText('My Tag Input'));
1069
+
1070
+ expect(getByText('Option1')).toBeInTheDocument();
1071
+
1072
+ _react2.fireEvent.click(getByText('Option1'));
1073
+
1074
+ expect(onSelectMock).toHaveBeenCalledWith(['Option1']);
1075
+ });
1076
+ });
1001
1077
  });
@@ -12,10 +12,10 @@ export declare type CommonUIColors = {
12
12
  [K in CommonUIColorKeys]: Color;
13
13
  };
14
14
  export declare const viColorKeys: ("berryCrisp" | "koolaidCake" | "cookieMonster" | "cottonCandy" | "fizzyLime" | "mamboMango" | "carrotCake" | "roseGummy" | "licoriceMousse")[];
15
- export declare const statusColorKeys: ("information" | "success" | "warning" | "danger")[];
15
+ export declare const statusColorKeys: ("danger" | "success" | "information" | "warning")[];
16
16
  export declare const viColors: VIColors;
17
17
  export declare const statusColors: StatusColors;
18
- export declare const commonUIColorKeys: ("information" | "success" | "warning" | "danger" | "berryCrisp" | "koolaidCake" | "cookieMonster" | "cottonCandy" | "fizzyLime" | "mamboMango" | "carrotCake" | "roseGummy" | "licoriceMousse")[];
18
+ export declare const commonUIColorKeys: ("danger" | "success" | "information" | "warning" | "berryCrisp" | "koolaidCake" | "cookieMonster" | "cottonCandy" | "fizzyLime" | "mamboMango" | "carrotCake" | "roseGummy" | "licoriceMousse")[];
19
19
  export declare const commonUIColors: CommonUIColors;
20
20
  export declare const commonUIThreeShadeColors: {
21
21
  readonly berryCrisp: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decisiv/ui-components",
3
- "version": "2.0.1-alpha.210+e51d940",
3
+ "version": "2.0.1-alpha.212+3de0b1c",
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": "e51d9408aec827964739289ebf71550fdb3cb620"
74
+ "gitHead": "3de0b1cfa799be6189a6f62a26f850b74a60d051"
75
75
  }