@mrshmllw/smores-react 2.15.1 → 2.17.0
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/dist/Accordion/Accordion.d.ts +1 -0
- package/dist/Accordion/Accordion.js +2 -2
- package/dist/Accordion/Accordion.js.map +1 -1
- package/dist/Tooltip/Tooltip.d.ts +22 -0
- package/dist/Tooltip/Tooltip.js +233 -0
- package/dist/Tooltip/Tooltip.js.map +1 -0
- package/dist/Tooltip/Tooltip.stories.d.ts +9 -0
- package/dist/Tooltip/Tooltip.stories.js +37 -0
- package/dist/Tooltip/Tooltip.stories.js.map +1 -0
- package/dist/Tooltip/index.d.ts +1 -0
- package/dist/Tooltip/index.js +2 -0
- package/dist/Tooltip/index.js.map +1 -0
- package/package.json +1 -1
- package/dist/Dropdown/__tests__/Dropdown.d.ts +0 -1
- package/dist/Dropdown/__tests__/Dropdown.js +0 -80
- package/dist/Dropdown/__tests__/Dropdown.js.map +0 -1
- package/dist/Field/Field.d.ts +0 -13
- package/dist/Field/Field.js +0 -72
- package/dist/Field/Field.js.map +0 -1
- package/dist/Field/index.d.ts +0 -3
- package/dist/Field/index.js +0 -2
- package/dist/Field/index.js.map +0 -1
- package/dist/Field/types/commonFieldTypes.d.ts +0 -12
- package/dist/Field/types/commonFieldTypes.js +0 -2
- package/dist/Field/types/commonFieldTypes.js.map +0 -1
- package/dist/Fieldset/Fieldset.d.ts +0 -9
- package/dist/Fieldset/Fieldset.js +0 -22
- package/dist/Fieldset/Fieldset.js.map +0 -1
- package/dist/Fieldset/index.d.ts +0 -1
- package/dist/Fieldset/index.js +0 -2
- package/dist/Fieldset/index.js.map +0 -1
- package/dist/SearchInput/__tests__/SearchInput.d.ts +0 -1
- package/dist/SearchInput/__tests__/SearchInput.js +0 -32
- package/dist/SearchInput/__tests__/SearchInput.js.map +0 -1
- package/dist/Textarea/__tests__/Textarea.d.ts +0 -1
- package/dist/Textarea/__tests__/Textarea.js +0 -17
- package/dist/Textarea/__tests__/Textarea.js.map +0 -1
@@ -16,8 +16,8 @@ import { Icon } from '../Icon';
|
|
16
16
|
import { theme } from '../theme';
|
17
17
|
import { Text } from '../Text';
|
18
18
|
export const Accordion = (_a) => {
|
19
|
-
var { title, children, onToggle, borderTop = false, subTitle, fullBorder = false } = _a, marginProps = __rest(_a, ["title", "children", "onToggle", "borderTop", "subTitle", "fullBorder"]);
|
20
|
-
const [isOpen, setIsOpen] = useState(
|
19
|
+
var { title, children, onToggle, defaultIsOpen = false, borderTop = false, subTitle, fullBorder = false } = _a, marginProps = __rest(_a, ["title", "children", "onToggle", "defaultIsOpen", "borderTop", "subTitle", "fullBorder"]);
|
20
|
+
const [isOpen, setIsOpen] = useState(defaultIsOpen);
|
21
21
|
const px = fullBorder ? '16px' : '0';
|
22
22
|
const handleToggle = () => {
|
23
23
|
const nextOpenState = !isOpen;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../../src/Accordion/Accordion.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAiB,QAAQ,EAAE,MAAM,OAAO,CAAA;AACtD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;
|
1
|
+
{"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../../src/Accordion/Accordion.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAiB,QAAQ,EAAE,MAAM,OAAO,CAAA;AACtD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,GAAG,EA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,EAAC,OAAO,EAAC,KAAK,EAAC,SAAS,EAAC,IAAI,EAAC,OAAO,IAC3C,QAAQ,CACJ,CACR,CACc;YAEjB,oBAAC,SAAS,IACR,MAAM,EAAC,OAAO,EACd,IAAI,EAAE,EAAE,EACR,KAAK,EAAC,WAAW,EACjB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,GACpB,CACW;QACd,MAAM,IAAI,CACT,oBAAC,GAAG,IAAC,EAAE,EAAC,MAAM,EAAC,EAAE,EAAC,MAAM,EAAC,EAAE,EAAE,EAAE,IAC5B,QAAQ,CACL,CACP,CACO,CACX,CAAA;AACH,CAAC,CAAA;AAQD,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CACzB,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;+BACL,KAAK,CAAC,MAAM,CAAC,OAAO;MAC7C,SAAS,IAAI,yBAAyB,KAAK,CAAC,MAAM,CAAC,OAAO,GAAG;;MAE7D,UAAU;IACZ,GAAG,CAAA;0BACmB,KAAK,CAAC,MAAM,CAAC,OAAO;;;KAGzC;GACF,CACF,CAAA;AAED,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA;;;CAGhC,CAAA;AACD,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;;CAE/B,CAAA;AAED,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,CAC5B,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;iBACJ,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,cAAc;;GAExD,CACF,CAAA"}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
2
|
+
type Position = 'top' | 'bottom' | 'left' | 'right';
|
3
|
+
type ArrowPosition = Position | 'center';
|
4
|
+
export interface TooltipProps {
|
5
|
+
children: ReactNode;
|
6
|
+
title?: string;
|
7
|
+
content: string | ReactNode;
|
8
|
+
position: Position;
|
9
|
+
underline?: boolean;
|
10
|
+
defaultArrowPosition?: ArrowPosition;
|
11
|
+
shadow?: boolean;
|
12
|
+
}
|
13
|
+
export declare const Tooltip: FC<TooltipProps>;
|
14
|
+
export declare const Container: import("styled-components").StyledComponent<"div", any, {
|
15
|
+
underline: boolean;
|
16
|
+
}, never>;
|
17
|
+
export declare const Tip: import("styled-components").StyledComponent<"div", any, {
|
18
|
+
position: Position;
|
19
|
+
arrowPosition: ArrowPosition;
|
20
|
+
shadow: boolean;
|
21
|
+
}, never>;
|
22
|
+
export {};
|
@@ -0,0 +1,233 @@
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState, } from 'react';
|
2
|
+
import styled, { css } from 'styled-components';
|
3
|
+
import { useEventListener } from '../hooks';
|
4
|
+
import { Text } from '../Text';
|
5
|
+
import { theme } from '../theme';
|
6
|
+
export const Tooltip = ({ children, title, content, underline = false, defaultArrowPosition = 'center', shadow = false, }) => {
|
7
|
+
const tipContainer = useRef(null);
|
8
|
+
const documentRef = useRef(document);
|
9
|
+
const [tooltipPosition, setTooltipPosition] = useState('top');
|
10
|
+
const [arrowPosition, setArrowPosition] = useState(defaultArrowPosition);
|
11
|
+
const checkInbounds = (element) => element.top >= 0 &&
|
12
|
+
element.left >= 0 &&
|
13
|
+
element.bottom <= window.innerHeight &&
|
14
|
+
element.right <= window.innerWidth;
|
15
|
+
const handleTipViewport = useCallback(() => {
|
16
|
+
var _a;
|
17
|
+
const shouldChangeXAxis = tooltipPosition === 'left' || tooltipPosition === 'right';
|
18
|
+
const shouldChangeYAxis = tooltipPosition === 'top' || tooltipPosition === 'bottom';
|
19
|
+
const handleArrowAxisChange = () => {
|
20
|
+
if (arrowPosition === 'left') {
|
21
|
+
setArrowPosition('top');
|
22
|
+
}
|
23
|
+
if (arrowPosition === 'right') {
|
24
|
+
setArrowPosition('bottom');
|
25
|
+
}
|
26
|
+
if (arrowPosition === 'top') {
|
27
|
+
setArrowPosition('left');
|
28
|
+
}
|
29
|
+
if (arrowPosition === 'bottom') {
|
30
|
+
setArrowPosition('right');
|
31
|
+
}
|
32
|
+
};
|
33
|
+
const dimensions = (_a = tipContainer.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
34
|
+
if (!dimensions)
|
35
|
+
return;
|
36
|
+
if (checkInbounds(dimensions))
|
37
|
+
return;
|
38
|
+
// If in bounds but not defaulted to top; default
|
39
|
+
if (dimensions.top >= 0 && tooltipPosition !== 'top') {
|
40
|
+
setArrowPosition(defaultArrowPosition);
|
41
|
+
setTooltipPosition('top');
|
42
|
+
return;
|
43
|
+
}
|
44
|
+
// if top out of bounds
|
45
|
+
if (dimensions.top < 0) {
|
46
|
+
shouldChangeXAxis && handleArrowAxisChange();
|
47
|
+
setTooltipPosition('bottom');
|
48
|
+
return;
|
49
|
+
}
|
50
|
+
// if right out of bounds
|
51
|
+
if (dimensions.right > window.innerWidth) {
|
52
|
+
shouldChangeYAxis && handleArrowAxisChange();
|
53
|
+
setTooltipPosition('left');
|
54
|
+
return;
|
55
|
+
}
|
56
|
+
// if left out of bounds
|
57
|
+
if (dimensions.left < 0) {
|
58
|
+
shouldChangeYAxis && handleArrowAxisChange();
|
59
|
+
setTooltipPosition('right');
|
60
|
+
return;
|
61
|
+
}
|
62
|
+
// If bottom out of bounds
|
63
|
+
if (dimensions.bottom > window.innerHeight) {
|
64
|
+
shouldChangeXAxis && handleArrowAxisChange();
|
65
|
+
setTooltipPosition('top');
|
66
|
+
return;
|
67
|
+
}
|
68
|
+
}, [tipContainer, tooltipPosition, arrowPosition]);
|
69
|
+
useEffect(() => {
|
70
|
+
handleTipViewport();
|
71
|
+
}, []);
|
72
|
+
useEventListener({
|
73
|
+
eventName: 'resize',
|
74
|
+
callback: handleTipViewport,
|
75
|
+
ref: documentRef,
|
76
|
+
});
|
77
|
+
useEventListener({
|
78
|
+
eventName: 'scroll',
|
79
|
+
callback: handleTipViewport,
|
80
|
+
ref: documentRef,
|
81
|
+
});
|
82
|
+
return (React.createElement(Container, { underline: underline },
|
83
|
+
React.createElement("span", null, children),
|
84
|
+
React.createElement(Tip, { className: "tooltip", position: tooltipPosition, arrowPosition: arrowPosition, shadow: shadow, ref: tipContainer },
|
85
|
+
title && (React.createElement(Text, { tag: "h5", typo: "desc-medium", color: "secondary" }, title)),
|
86
|
+
(typeof content === 'string' && (React.createElement(Text, { typo: "desc-light", color: "secondary" }, content))) ||
|
87
|
+
content)));
|
88
|
+
};
|
89
|
+
export const Container = styled.div `
|
90
|
+
position: relative;
|
91
|
+
display: flex;
|
92
|
+
align-items: center;
|
93
|
+
justify-content: center;
|
94
|
+
|
95
|
+
${({ underline }) => underline &&
|
96
|
+
css `
|
97
|
+
border-bottom: 1px dashed ${theme.colors.primary};
|
98
|
+
`}
|
99
|
+
|
100
|
+
> span:hover + .tooltip {
|
101
|
+
opacity: 1;
|
102
|
+
}
|
103
|
+
`;
|
104
|
+
const arrowPaddingSize = 18;
|
105
|
+
const arrowInset = 26;
|
106
|
+
const arrowCenterPosition = 'calc(50% - 12px)';
|
107
|
+
const arrowPadding = `calc(100% + ${arrowPaddingSize}px);`;
|
108
|
+
const calculateTipPosition = `calc(50% - ${arrowPaddingSize / 2 + arrowInset}px);`;
|
109
|
+
const handleTipPosition = (arrowPosition) => {
|
110
|
+
switch (arrowPosition) {
|
111
|
+
case 'left':
|
112
|
+
return css `
|
113
|
+
left: ${calculateTipPosition};
|
114
|
+
`;
|
115
|
+
case 'right':
|
116
|
+
return css `
|
117
|
+
right: ${calculateTipPosition};
|
118
|
+
`;
|
119
|
+
case 'top':
|
120
|
+
return css `
|
121
|
+
top: ${calculateTipPosition};
|
122
|
+
`;
|
123
|
+
case 'bottom':
|
124
|
+
return css `
|
125
|
+
bottom: ${calculateTipPosition};
|
126
|
+
`;
|
127
|
+
default:
|
128
|
+
return 'calc(100% + 18px)';
|
129
|
+
}
|
130
|
+
};
|
131
|
+
const handleHorizontalArrowPosition = (arrowPosition) => {
|
132
|
+
switch (arrowPosition) {
|
133
|
+
case 'left':
|
134
|
+
return css `
|
135
|
+
left: ${arrowInset}px;
|
136
|
+
`;
|
137
|
+
case 'right':
|
138
|
+
return css `
|
139
|
+
right: ${arrowInset}px;
|
140
|
+
`;
|
141
|
+
default:
|
142
|
+
return css `
|
143
|
+
left: ${arrowCenterPosition};
|
144
|
+
`;
|
145
|
+
}
|
146
|
+
};
|
147
|
+
const handleVerticalArrowPosition = (arrowPosition) => {
|
148
|
+
switch (arrowPosition) {
|
149
|
+
case 'top':
|
150
|
+
return css `
|
151
|
+
top: ${arrowInset}px;
|
152
|
+
`;
|
153
|
+
case 'bottom':
|
154
|
+
return css `
|
155
|
+
bottom: ${arrowInset}px;
|
156
|
+
`;
|
157
|
+
default:
|
158
|
+
return css `
|
159
|
+
top: ${arrowCenterPosition};
|
160
|
+
`;
|
161
|
+
}
|
162
|
+
};
|
163
|
+
const top = css `
|
164
|
+
bottom: ${arrowPadding};
|
165
|
+
${({ arrowPosition }) => handleTipPosition(arrowPosition)};
|
166
|
+
|
167
|
+
&:before {
|
168
|
+
bottom: -15px;
|
169
|
+
transform: rotate(-90deg);
|
170
|
+
${({ arrowPosition }) => handleHorizontalArrowPosition(arrowPosition)}
|
171
|
+
}
|
172
|
+
`;
|
173
|
+
const bottom = css `
|
174
|
+
top: ${arrowPadding};
|
175
|
+
${({ arrowPosition }) => handleTipPosition(arrowPosition)};
|
176
|
+
|
177
|
+
&:before {
|
178
|
+
top: -15px;
|
179
|
+
transform: rotate(90deg);
|
180
|
+
${({ arrowPosition }) => handleHorizontalArrowPosition(arrowPosition)}
|
181
|
+
}
|
182
|
+
`;
|
183
|
+
const left = css `
|
184
|
+
right: ${arrowPadding};
|
185
|
+
|
186
|
+
${({ arrowPosition }) => handleTipPosition(arrowPosition)};
|
187
|
+
&:before {
|
188
|
+
right: -11px;
|
189
|
+
transform: rotate(180deg);
|
190
|
+
${({ arrowPosition }) => handleVerticalArrowPosition(arrowPosition)}
|
191
|
+
}
|
192
|
+
`;
|
193
|
+
const right = css `
|
194
|
+
left: ${arrowPadding};
|
195
|
+
|
196
|
+
${({ arrowPosition }) => handleTipPosition(arrowPosition)};
|
197
|
+
&:before {
|
198
|
+
${({ arrowPosition }) => handleVerticalArrowPosition(arrowPosition)}
|
199
|
+
left: -11px;
|
200
|
+
}
|
201
|
+
`;
|
202
|
+
export const Tip = styled.div `
|
203
|
+
position: absolute;
|
204
|
+
margin: auto;
|
205
|
+
background: ${theme.colors.background};
|
206
|
+
white-space: nowrap;
|
207
|
+
padding: 16px 12px 20px;
|
208
|
+
border-radius: 8px;
|
209
|
+
opacity: 0;
|
210
|
+
transition: opacity 0.2s ease-in-out;
|
211
|
+
|
212
|
+
&:hover {
|
213
|
+
opacity: 1;
|
214
|
+
}
|
215
|
+
|
216
|
+
${({ position }) => position === 'top' && top}
|
217
|
+
${({ position }) => position === 'bottom' && bottom}
|
218
|
+
${({ position }) => position === 'left' && left}
|
219
|
+
${({ position }) => position === 'right' && right}
|
220
|
+
${({ shadow }) => shadow &&
|
221
|
+
css `
|
222
|
+
filter: drop-shadow(0px 4px 4px rgba(0, 0, 0, 0.25));
|
223
|
+
`}
|
224
|
+
|
225
|
+
&:before {
|
226
|
+
content: '';
|
227
|
+
border-style: solid;
|
228
|
+
border-width: 12px 12px 12px 0;
|
229
|
+
border-color: transparent ${theme.colors.background} transparent transparent;
|
230
|
+
position: absolute;
|
231
|
+
}
|
232
|
+
`;
|
233
|
+
//# sourceMappingURL=Tooltip.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../src/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAGZ,WAAW,EACX,SAAS,EACT,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAA;AACd,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,gBAAgB,EA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AAM,CAAC,UAAU;;;CAGtD,CAAA"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { TooltipProps } from './Tooltip';
|
3
|
+
declare const _default: {
|
4
|
+
title: string;
|
5
|
+
component: React.FC<TooltipProps>;
|
6
|
+
};
|
7
|
+
export default _default;
|
8
|
+
export declare const Default: any;
|
9
|
+
export declare const ReactNodeExample: any;
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { Box } from '../Box';
|
3
|
+
import { Text } from '../Text';
|
4
|
+
import { Tooltip } from './Tooltip';
|
5
|
+
export default {
|
6
|
+
title: 'Tooltip',
|
7
|
+
component: Tooltip,
|
8
|
+
};
|
9
|
+
const Template = (props) => (React.createElement(Box, { px: { custom: 250 }, py: { custom: 150 }, flex: true },
|
10
|
+
React.createElement(Tooltip, Object.assign({}, props),
|
11
|
+
React.createElement(Box, null, "Harry Hill"))));
|
12
|
+
export const Default = Template.bind({});
|
13
|
+
Default.args = {
|
14
|
+
title: 'Harry Hill',
|
15
|
+
content: 'Tooltip content, this is some text, maybe even more text if you feel like it.',
|
16
|
+
position: 'top',
|
17
|
+
size: 'small',
|
18
|
+
underline: true,
|
19
|
+
arrowPosition: 'left',
|
20
|
+
shadow: true,
|
21
|
+
};
|
22
|
+
export const ReactNodeExample = Template.bind({});
|
23
|
+
const tooltipContent = (React.createElement(React.Fragment, null,
|
24
|
+
React.createElement(Text, { typo: "desc-light", color: "secondary" }, "20 Cherry Blossom Lane,"),
|
25
|
+
React.createElement(Text, { typo: "desc-light", color: "secondary" }, "Aintree,"),
|
26
|
+
React.createElement(Text, { typo: "desc-light", color: "secondary" }, "Manchester,"),
|
27
|
+
React.createElement(Text, { typo: "desc-light", color: "secondary" }, "T: 07123456789")));
|
28
|
+
ReactNodeExample.args = {
|
29
|
+
title: 'React node example',
|
30
|
+
position: 'top',
|
31
|
+
content: tooltipContent,
|
32
|
+
size: 'large',
|
33
|
+
underline: true,
|
34
|
+
arrowPosition: 'left',
|
35
|
+
shadow: false,
|
36
|
+
};
|
37
|
+
//# sourceMappingURL=Tooltip.stories.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Tooltip.stories.js","sourceRoot":"","sources":["../../src/Tooltip/Tooltip.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,OAAO,EAAgB,MAAM,WAAW,CAAA;AAEjD,eAAe;IACb,KAAK,EAAE,SAAS;IAChB,SAAS,EAAE,OAAO;CACnB,CAAA;AAED,MAAM,QAAQ,GAAG,CAAC,KAAmB,EAAE,EAAE,CAAC,CACxC,oBAAC,GAAG,IAAC,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,IAAI;IACjD,oBAAC,OAAO,oBAAK,KAAK;QAChB,oBAAC,GAAG,qBAAiB,CACb,CACN,CACP,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAExC,OAAO,CAAC,IAAI,GAAG;IACb,KAAK,EAAE,YAAY;IACnB,OAAO,EACL,+EAA+E;IACjF,QAAQ,EAAE,KAAK;IACf,IAAI,EAAE,OAAO;IACb,SAAS,EAAE,IAAI;IACf,aAAa,EAAE,MAAM;IACrB,MAAM,EAAE,IAAI;CACb,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAEjD,MAAM,cAAc,GAAG,CACrB;IACE,oBAAC,IAAI,IAAC,IAAI,EAAC,YAAY,EAAC,KAAK,EAAC,WAAW,8BAElC;IACP,oBAAC,IAAI,IAAC,IAAI,EAAC,YAAY,EAAC,KAAK,EAAC,WAAW,eAElC;IACP,oBAAC,IAAI,IAAC,IAAI,EAAC,YAAY,EAAC,KAAK,EAAC,WAAW,kBAElC;IACP,oBAAC,IAAI,IAAC,IAAI,EAAC,YAAY,EAAC,KAAK,EAAC,WAAW,qBAElC,CACN,CACJ,CAAA;AAED,gBAAgB,CAAC,IAAI,GAAG;IACtB,KAAK,EAAE,oBAAoB;IAC3B,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,cAAc;IACvB,IAAI,EAAE,OAAO;IACb,SAAS,EAAE,IAAI;IACf,aAAa,EAAE,MAAM;IACrB,MAAM,EAAE,KAAK;CACd,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { Tooltip } from './Tooltip';
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Tooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA"}
|
package/package.json
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,80 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { render } from '@testing-library/react';
|
3
|
-
import 'jest-styled-components';
|
4
|
-
import { Dropdown } from '../Dropdown';
|
5
|
-
const days = [
|
6
|
-
{
|
7
|
-
label: 'Monday',
|
8
|
-
value: 'MONDAY',
|
9
|
-
},
|
10
|
-
{
|
11
|
-
label: 'Tuesday',
|
12
|
-
value: 'TUESDAY',
|
13
|
-
},
|
14
|
-
{
|
15
|
-
label: 'Wednesday',
|
16
|
-
value: 'WEDNESDAY',
|
17
|
-
},
|
18
|
-
{
|
19
|
-
label: 'Thursday',
|
20
|
-
value: 'THURSDAY',
|
21
|
-
},
|
22
|
-
{
|
23
|
-
label: 'Friday',
|
24
|
-
value: 'FRIDAY',
|
25
|
-
},
|
26
|
-
{
|
27
|
-
label: 'Saturday',
|
28
|
-
value: 'SATURDAY',
|
29
|
-
},
|
30
|
-
{
|
31
|
-
label: 'Sunday',
|
32
|
-
value: 'SUNDAY',
|
33
|
-
},
|
34
|
-
];
|
35
|
-
const daysWithGroups = [
|
36
|
-
{
|
37
|
-
label: 'Monday',
|
38
|
-
value: 'MONDAY',
|
39
|
-
optionGroupLabel: 'Weekday',
|
40
|
-
},
|
41
|
-
{
|
42
|
-
label: 'Tuesday',
|
43
|
-
value: 'TUESDAY',
|
44
|
-
optionGroupLabel: 'Weekday',
|
45
|
-
},
|
46
|
-
{
|
47
|
-
label: 'Wednesday',
|
48
|
-
value: 'WEDNESDAY',
|
49
|
-
optionGroupLabel: 'Weekday',
|
50
|
-
},
|
51
|
-
{
|
52
|
-
label: 'Thursday',
|
53
|
-
value: 'THURSDAY',
|
54
|
-
optionGroupLabel: 'Weekday',
|
55
|
-
},
|
56
|
-
{
|
57
|
-
label: 'Friday',
|
58
|
-
value: 'FRIDAY',
|
59
|
-
optionGroupLabel: 'Weekday',
|
60
|
-
},
|
61
|
-
{
|
62
|
-
label: 'Saturday',
|
63
|
-
value: 'SATURDAY',
|
64
|
-
optionGroupLabel: 'Weekend',
|
65
|
-
},
|
66
|
-
{
|
67
|
-
label: 'Sunday',
|
68
|
-
value: 'SUNDAY',
|
69
|
-
optionGroupLabel: 'Weekend',
|
70
|
-
},
|
71
|
-
];
|
72
|
-
test('rendersDropdown', () => {
|
73
|
-
const { container } = render(React.createElement(Dropdown, { list: days }));
|
74
|
-
expect(container.firstChild).toMatchSnapshot();
|
75
|
-
});
|
76
|
-
test('rendersDropdownWithGroups', () => {
|
77
|
-
const { container } = render(React.createElement(Dropdown, { list: daysWithGroups }));
|
78
|
-
expect(container.firstChild).toMatchSnapshot();
|
79
|
-
});
|
80
|
-
//# sourceMappingURL=Dropdown.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"Dropdown.js","sourceRoot":"","sources":["../../../src/Dropdown/__tests__/Dropdown.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;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AAE,GAAG,EAAE;IAC3B,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,oBAAC,QAAQ,IAAC,IAAI,EAAE,IAAI,GAAI,CAAC,CAAA;IAEtD,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,eAAe,EAAE,CAAA;AAChD,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACrC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,oBAAC,QAAQ,IAAC,IAAI,EAAE,cAAc,GAAI,CAAC,CAAA;IAEhE,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,eAAe,EAAE,CAAA;AAChD,CAAC,CAAC,CAAA"}
|
package/dist/Field/Field.d.ts
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { CommonFieldTypes } from './types/commonFieldTypes';
|
3
|
-
interface FieldProps extends CommonFieldTypes {
|
4
|
-
children: React.ReactElement;
|
5
|
-
showCaret?: boolean;
|
6
|
-
value: string;
|
7
|
-
trailingIcon?: string;
|
8
|
-
dropdownKey?: string;
|
9
|
-
fullHeight?: boolean;
|
10
|
-
assistiveText?: string;
|
11
|
-
}
|
12
|
-
export declare const Field: ({ children, renderAsTitle, className, error, id, label, outlined, value, trailingIcon, errorMsg, dropdownKey, required, showCaret, fullHeight, assistiveText, ...marginProps }: FieldProps) => JSX.Element;
|
13
|
-
export {};
|
package/dist/Field/Field.js
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
2
|
-
var t = {};
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
4
|
-
t[p] = s[p];
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
8
|
-
t[p[i]] = s[p[i]];
|
9
|
-
}
|
10
|
-
return t;
|
11
|
-
};
|
12
|
-
import React from 'react';
|
13
|
-
import styled from 'styled-components';
|
14
|
-
import { darken } from 'polished';
|
15
|
-
import { Icon } from '../Icon';
|
16
|
-
import { Text } from '../Text';
|
17
|
-
import { Box } from '../Box';
|
18
|
-
import { theme } from '../theme';
|
19
|
-
export const Field = (_a) => {
|
20
|
-
var { children, renderAsTitle, className = '', error, id, label, outlined = false, value, trailingIcon, errorMsg, dropdownKey, required, showCaret, fullHeight = false, assistiveText } = _a, marginProps = __rest(_a, ["children", "renderAsTitle", "className", "error", "id", "label", "outlined", "value", "trailingIcon", "errorMsg", "dropdownKey", "required", "showCaret", "fullHeight", "assistiveText"]);
|
21
|
-
return (React.createElement(Container, Object.assign({ className: className }, marginProps),
|
22
|
-
label && (React.createElement(React.Fragment, null, renderAsTitle ? (React.createElement(Box, { mb: "16px" },
|
23
|
-
React.createElement(Text, { tag: "label", typo: "heading-small", htmlFor: id, mb: assistiveText ? { custom: 4 } : undefined }, label),
|
24
|
-
assistiveText && (React.createElement(Text, { tag: "p", color: "subtext" }, assistiveText)))) : (React.createElement(Box, { mb: { custom: outlined ? 4 : 0 } },
|
25
|
-
React.createElement(Text, { tag: "label", typo: "label", color: "subtext", htmlFor: id },
|
26
|
-
label,
|
27
|
-
required && (React.createElement(Text, { tag: "span", typo: "body-small", color: "error" }, "*"))))))),
|
28
|
-
React.createElement(Content, { fullHeight: fullHeight, value: value, outlined: outlined, error: error, key: dropdownKey !== null && dropdownKey !== void 0 ? dropdownKey : null },
|
29
|
-
children,
|
30
|
-
showCaret && (React.createElement(Caret, { outlined: outlined },
|
31
|
-
React.createElement(Icon, { render: "caret", color: "subtext", size: 24 })))),
|
32
|
-
trailingIcon && React.createElement(Icon, { render: trailingIcon, color: "subtext" }),
|
33
|
-
error && (React.createElement(Text, { tag: "span", typo: "caption", color: "error", mt: "8px" }, errorMsg))));
|
34
|
-
};
|
35
|
-
const Container = styled(Box) `
|
36
|
-
display: flex;
|
37
|
-
flex-direction: column;
|
38
|
-
position: relative;
|
39
|
-
width: 100%;
|
40
|
-
`;
|
41
|
-
const Content = styled.div `
|
42
|
-
position: relative;
|
43
|
-
border-color: ${({ error }) => theme.colors[`${error ? 'error' : 'outline'}`]};
|
44
|
-
background-color: ${({ outlined }) => !outlined ? 'transparent' : theme.colors['white']};
|
45
|
-
height: ${({ fullHeight }) => (fullHeight ? `100%` : `32px`)};
|
46
|
-
|
47
|
-
&:hover,
|
48
|
-
&:focus-within {
|
49
|
-
border-color: ${({ error }) => error ? theme.colors.error : darken(0.1, theme.colors.outline)};
|
50
|
-
}
|
51
|
-
|
52
|
-
${({ outlined }) => outlined &&
|
53
|
-
`
|
54
|
-
border-radius: 8px;
|
55
|
-
height: auto;
|
56
|
-
`}
|
57
|
-
|
58
|
-
${({ value }) => value &&
|
59
|
-
value != '' &&
|
60
|
-
`
|
61
|
-
border-color: ${theme.colors.outline};
|
62
|
-
`}
|
63
|
-
`;
|
64
|
-
const Caret = styled.div `
|
65
|
-
position: absolute;
|
66
|
-
top: 50%;
|
67
|
-
z-index: 1;
|
68
|
-
right: ${({ outlined }) => (outlined ? '15px' : '0')};
|
69
|
-
pointer-events: none;
|
70
|
-
transform: translateY(-50%);
|
71
|
-
`;
|
72
|
-
//# sourceMappingURL=Field.js.map
|
package/dist/Field/Field.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"Field.js","sourceRoot":"","sources":["../../src/Field/Field.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B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,CAAC;;;;oBAI1C,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAC5B,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;;;IAGhE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CACjB,QAAQ;IACR;;;KAGC;;IAED,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CACd,KAAK;IACL,KAAK,IAAI,EAAE;IACX;oBACgB,KAAK,CAAC,MAAM,CAAC,OAAO;KACnC;CACJ,CAAA;AAED,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAuB;;;;WAIpC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;;;CAGrD,CAAA"}
|
package/dist/Field/index.d.ts
DELETED
package/dist/Field/index.js
DELETED
package/dist/Field/index.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Field/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA"}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import { MarginProps } from '../../utils/space';
|
2
|
-
export interface CommonFieldTypes extends MarginProps {
|
3
|
-
label?: string;
|
4
|
-
id?: string;
|
5
|
-
error?: boolean;
|
6
|
-
errorMsg?: string;
|
7
|
-
required?: boolean;
|
8
|
-
renderAsTitle?: boolean;
|
9
|
-
className?: string;
|
10
|
-
outlined?: boolean;
|
11
|
-
assistiveText?: string;
|
12
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"commonFieldTypes.js","sourceRoot":"","sources":["../../../src/Field/types/commonFieldTypes.ts"],"names":[],"mappings":""}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { MarginProps } from '../utils/space';
|
3
|
-
declare type FieldSetProps = {
|
4
|
-
children: React.ReactChild;
|
5
|
-
label: string;
|
6
|
-
outlined?: boolean;
|
7
|
-
} & MarginProps;
|
8
|
-
export declare const Fieldset: ({ children, label, outlined, ...marginProps }: FieldSetProps) => JSX.Element;
|
9
|
-
export {};
|
@@ -1,22 +0,0 @@
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
2
|
-
var t = {};
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
4
|
-
t[p] = s[p];
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
8
|
-
t[p[i]] = s[p[i]];
|
9
|
-
}
|
10
|
-
return t;
|
11
|
-
};
|
12
|
-
import React from 'react';
|
13
|
-
import { Box } from '../Box';
|
14
|
-
import { Text } from '../Text';
|
15
|
-
export const Fieldset = (_a) => {
|
16
|
-
var { children, label, outlined = false } = _a, marginProps = __rest(_a, ["children", "label", "outlined"]);
|
17
|
-
return (React.createElement(Box, Object.assign({ as: "fieldset" }, marginProps),
|
18
|
-
React.createElement(Box, { mb: { custom: outlined ? 4 : 0 } },
|
19
|
-
React.createElement(Text, { tag: "legend", typo: "heading-small", mb: "16px" }, label)),
|
20
|
-
children));
|
21
|
-
};
|
22
|
-
//# sourceMappingURL=Fieldset.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"Fieldset.js","sourceRoot":"","sources":["../../src/Fieldset/Fieldset.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAQ9B,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAKT,EAAE,EAAE;QALK,EACvB,QAAQ,EACR,KAAK,EACL,QAAQ,GAAG,KAAK,OAEF,EADX,WAAW,cAJS,iCAKxB,CADe;IAEd,OAAO,CACL,oBAAC,GAAG,kBAAC,EAAE,EAAC,UAAU,IAAK,WAAW;QAChC,oBAAC,GAAG,IAAC,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;YACnC,oBAAC,IAAI,IAAC,GAAG,EAAC,QAAQ,EAAC,IAAI,EAAC,eAAe,EAAC,EAAE,EAAC,MAAM,IAC9C,KAAK,CACD,CACH;QAEL,QAAQ,CACL,CACP,CAAA;AACH,CAAC,CAAA"}
|
package/dist/Fieldset/index.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export { Fieldset } from './Fieldset';
|
package/dist/Fieldset/index.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Fieldset/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA"}
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,32 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { render } from '@testing-library/react';
|
3
|
-
import 'jest-styled-components';
|
4
|
-
import { SearchInput } from '../SearchInput';
|
5
|
-
const list = [
|
6
|
-
{
|
7
|
-
label: 'Monday',
|
8
|
-
},
|
9
|
-
{
|
10
|
-
label: 'Tuesday',
|
11
|
-
},
|
12
|
-
{
|
13
|
-
label: 'Wednesday',
|
14
|
-
},
|
15
|
-
{
|
16
|
-
label: 'Thursday',
|
17
|
-
},
|
18
|
-
{
|
19
|
-
label: 'Friday',
|
20
|
-
},
|
21
|
-
{
|
22
|
-
label: 'Saturday',
|
23
|
-
},
|
24
|
-
{
|
25
|
-
label: 'Sunday',
|
26
|
-
},
|
27
|
-
];
|
28
|
-
test('renders', () => {
|
29
|
-
const { container } = render(React.createElement(SearchInput, { id: "days", label: "Days", searchList: list, onFound: () => { } }));
|
30
|
-
expect(container.firstChild).toMatchSnapshot();
|
31
|
-
});
|
32
|
-
//# sourceMappingURL=SearchInput.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"SearchInput.js","sourceRoot":"","sources":["../../../src/SearchInput/__tests__/SearchInput.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAC,MAAM,wBAAwB,CAAC;AAC9C,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE3C,MAAM,IAAI,GAAG;IACX;QACE,KAAK,EAAE,QAAQ;KAChB;IACD;QACE,KAAK,EAAE,SAAS;KACjB;IACD;QACE,KAAK,EAAE,WAAW;KACnB;IACD;QACE,KAAK,EAAE,UAAU;KAClB;IACD;QACE,KAAK,EAAE,QAAQ;KAChB;IACD;QACE,KAAK,EAAE,UAAU;KAClB;IACD;QACE,KAAK,EAAE,QAAQ;KAChB;CACF,CAAC;AAEF,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE;IACnB,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CACxB,oBAAC,WAAW,IAAC,EAAE,EAAC,MAAM,EAAC,KAAK,EAAC,MAAM,EAAC,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC,GAAI,CAC5E,CAAC;IACF,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,eAAe,EAAE,CAAC;AACjD,CAAC,CAAC,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { render } from '@testing-library/react';
|
3
|
-
import 'jest-styled-components';
|
4
|
-
import { Textarea } from '../Textarea';
|
5
|
-
test('renders', () => {
|
6
|
-
const { container } = render(React.createElement(Textarea, { id: "textarea_id", label: "Textarea label", value: "", onChange: str => { }, resize: "both", disabled: false, placeholder: "Placeholder text!", className: "Textarea" }));
|
7
|
-
expect(container.firstChild).toMatchSnapshot();
|
8
|
-
});
|
9
|
-
test('disabled', () => {
|
10
|
-
const { container } = render(React.createElement(Textarea, { id: "textarea_id", label: "Textarea label", value: "", onChange: str => { }, resize: "both", disabled: true, placeholder: "Placeholder text!" }));
|
11
|
-
expect(container.firstChild).toMatchSnapshot();
|
12
|
-
});
|
13
|
-
test('renders with error', () => {
|
14
|
-
const { container } = render(React.createElement(Textarea, { id: "textarea_id", label: "Textarea label", value: "", onChange: str => { }, resize: "both", disabled: false, error: true, errorMsg: "Something really quite terrible has gone wrong here!", placeholder: "Placeholder text!" }));
|
15
|
-
expect(container.firstChild).toMatchSnapshot();
|
16
|
-
});
|
17
|
-
//# sourceMappingURL=Textarea.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"Textarea.js","sourceRoot":"","sources":["../../../src/Textarea/__tests__/Textarea.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAC,MAAM,wBAAwB,CAAC;AAC9C,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AAErC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE;IACnB,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CACxB,oBAAC,QAAQ,IACP,EAAE,EAAC,aAAa,EAChB,KAAK,EAAC,gBAAgB,EACtB,KAAK,EAAC,EAAE,EACR,QAAQ,EAAE,GAAG,CAAC,EAAE,GAAE,CAAC,EACnB,MAAM,EAAC,MAAM,EACb,QAAQ,EAAE,KAAK,EACf,WAAW,EAAC,mBAAmB,EAC/B,SAAS,EAAC,UAAU,GACpB,C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