no-frills-ui 0.0.14-alpha.0 → 0.0.14-alpha.2
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/README.md +63 -24
- package/dist/index.js +931 -2035
- package/dist/index.js.map +1 -1
- package/lib-esm/components/Accordion/Accordion.d.ts +2 -3
- package/lib-esm/components/Accordion/Accordion.js +6 -3
- package/lib-esm/components/Accordion/Accordion.js.map +1 -1
- package/lib-esm/components/Accordion/AccordionStep.d.ts +2 -2
- package/lib-esm/components/Accordion/AccordionStep.js +31 -22
- package/lib-esm/components/Accordion/AccordionStep.js.map +1 -1
- package/lib-esm/components/Accordion/index.js.map +1 -1
- package/lib-esm/components/Badge/Badge.js +5 -6
- package/lib-esm/components/Badge/Badge.js.map +1 -1
- package/lib-esm/components/Button/LinkButton.js +2 -1
- package/lib-esm/components/Button/LinkButton.js.map +1 -1
- package/lib-esm/components/Card/Card.js +1 -1
- package/lib-esm/components/Card/Card.js.map +1 -1
- package/lib-esm/components/Chip/Chip.d.ts +2 -0
- package/lib-esm/components/Chip/Chip.js +4 -3
- package/lib-esm/components/Chip/Chip.js.map +1 -1
- package/lib-esm/components/ChipInput/ChipInput.d.ts +33 -0
- package/lib-esm/components/ChipInput/ChipInput.js +225 -0
- package/lib-esm/components/ChipInput/ChipInput.js.map +1 -0
- package/lib-esm/components/ChipInput/index.d.ts +1 -0
- package/lib-esm/components/ChipInput/index.js +2 -0
- package/lib-esm/components/ChipInput/index.js.map +1 -0
- package/lib-esm/components/Dialog/AlertDialog.js +3 -3
- package/lib-esm/components/Dialog/AlertDialog.js.map +1 -1
- package/lib-esm/components/Dialog/ConfirmDialog.js +8 -3
- package/lib-esm/components/Dialog/ConfirmDialog.js.map +1 -1
- package/lib-esm/components/Dialog/Dialog.d.ts +2 -2
- package/lib-esm/components/Dialog/Dialog.js +6 -4
- package/lib-esm/components/Dialog/Dialog.js.map +1 -1
- package/lib-esm/components/Dialog/PromptDialog.js +2 -2
- package/lib-esm/components/Dialog/PromptDialog.js.map +1 -1
- package/lib-esm/components/DragAndDrop/DragAndDrop.d.ts +28 -1
- package/lib-esm/components/DragAndDrop/DragAndDrop.js +41 -3
- package/lib-esm/components/DragAndDrop/DragAndDrop.js.map +1 -1
- package/lib-esm/components/DragAndDrop/DragItem.d.ts +37 -0
- package/lib-esm/components/DragAndDrop/DragItem.js +160 -14
- package/lib-esm/components/DragAndDrop/DragItem.js.map +1 -1
- package/lib-esm/components/DragAndDrop/types.d.ts +3 -0
- package/lib-esm/components/DragAndDrop/types.js +1 -1
- package/lib-esm/components/DragAndDrop/types.js.map +1 -1
- package/lib-esm/components/Drawer/Drawer.js +10 -8
- package/lib-esm/components/Drawer/Drawer.js.map +1 -1
- package/lib-esm/components/Drawer/index.d.ts +1 -1
- package/lib-esm/components/Drawer/index.js +1 -1
- package/lib-esm/components/Drawer/index.js.map +1 -1
- package/lib-esm/components/Groups/Group.js +26 -14
- package/lib-esm/components/Groups/Group.js.map +1 -1
- package/lib-esm/components/Input/Checkbox.js +11 -8
- package/lib-esm/components/Input/Checkbox.js.map +1 -1
- package/lib-esm/components/Input/Dropdown.d.ts +2 -2
- package/lib-esm/components/Input/Dropdown.js +22 -22
- package/lib-esm/components/Input/Dropdown.js.map +1 -1
- package/lib-esm/components/Input/Input.js +20 -11
- package/lib-esm/components/Input/Input.js.map +1 -1
- package/lib-esm/components/Input/Radio.js +4 -3
- package/lib-esm/components/Input/Radio.js.map +1 -1
- package/lib-esm/components/Input/RadioButton.js +1 -1
- package/lib-esm/components/Input/RadioButton.js.map +1 -1
- package/lib-esm/components/Input/Select.js +17 -9
- package/lib-esm/components/Input/Select.js.map +1 -1
- package/lib-esm/components/Input/TextArea.js +17 -9
- package/lib-esm/components/Input/TextArea.js.map +1 -1
- package/lib-esm/components/Input/Toggle.js +5 -5
- package/lib-esm/components/Input/Toggle.js.map +1 -1
- package/lib-esm/components/Menu/Menu.d.ts +1 -1
- package/lib-esm/components/Menu/Menu.js +3 -2
- package/lib-esm/components/Menu/Menu.js.map +1 -1
- package/lib-esm/components/Menu/MenuContext.d.ts +11 -5
- package/lib-esm/components/Menu/MenuContext.js.map +1 -1
- package/lib-esm/components/Menu/MenuItem.d.ts +2 -2
- package/lib-esm/components/Menu/MenuItem.js +9 -5
- package/lib-esm/components/Menu/MenuItem.js.map +1 -1
- package/lib-esm/components/Modal/Modal.js +6 -4
- package/lib-esm/components/Modal/Modal.js.map +1 -1
- package/lib-esm/components/Notification/Notification.js +8 -4
- package/lib-esm/components/Notification/Notification.js.map +1 -1
- package/lib-esm/components/Notification/NotificationManager.js +11 -9
- package/lib-esm/components/Notification/NotificationManager.js.map +1 -1
- package/lib-esm/components/Notification/style.js +10 -8
- package/lib-esm/components/Notification/style.js.map +1 -1
- package/lib-esm/components/Notification/types.js +0 -1
- package/lib-esm/components/Notification/types.js.map +1 -1
- package/lib-esm/components/Popover/Popover.js +20 -17
- package/lib-esm/components/Popover/Popover.js.map +1 -1
- package/lib-esm/components/Popover/index.js.map +1 -1
- package/lib-esm/components/Spinner/Spinner.js +10 -6
- package/lib-esm/components/Spinner/Spinner.js.map +1 -1
- package/lib-esm/components/Stepper/Step.js +1 -0
- package/lib-esm/components/Stepper/Step.js.map +1 -1
- package/lib-esm/components/Stepper/Stepper.d.ts +3 -3
- package/lib-esm/components/Stepper/Stepper.js +17 -9
- package/lib-esm/components/Stepper/Stepper.js.map +1 -1
- package/lib-esm/components/Stepper/index.js.map +1 -1
- package/lib-esm/components/Tabs/Tab.js.map +1 -1
- package/lib-esm/components/Tabs/Tabs.d.ts +5 -5
- package/lib-esm/components/Tabs/Tabs.js +12 -9
- package/lib-esm/components/Tabs/Tabs.js.map +1 -1
- package/lib-esm/components/Toast/Toast.d.ts +1 -0
- package/lib-esm/components/Toast/Toast.js +9 -8
- package/lib-esm/components/Toast/Toast.js.map +1 -1
- package/lib-esm/components/Toast/ToastStory.js +1 -1
- package/lib-esm/components/Toast/ToastStory.js.map +1 -1
- package/lib-esm/components/Tooltip/Tooltip.js +5 -6
- package/lib-esm/components/Tooltip/Tooltip.js.map +1 -1
- package/lib-esm/components/index.d.ts +1 -0
- package/lib-esm/components/index.js +1 -0
- package/lib-esm/components/index.js.map +1 -1
- package/lib-esm/icons/CheckCircle.d.ts +1 -1
- package/lib-esm/icons/CheckCircle.js +1 -1
- package/lib-esm/icons/CheckCircle.js.map +1 -1
- package/lib-esm/icons/Close.d.ts +1 -1
- package/lib-esm/icons/Close.js +1 -1
- package/lib-esm/icons/Close.js.map +1 -1
- package/lib-esm/icons/DragIndicator.d.ts +1 -1
- package/lib-esm/icons/DragIndicator.js +1 -1
- package/lib-esm/icons/DragIndicator.js.map +1 -1
- package/lib-esm/icons/ErrorOutline.d.ts +1 -1
- package/lib-esm/icons/ErrorOutline.js +1 -1
- package/lib-esm/icons/ErrorOutline.js.map +1 -1
- package/lib-esm/icons/ExpandMore.d.ts +1 -1
- package/lib-esm/icons/ExpandMore.js +1 -1
- package/lib-esm/icons/ExpandMore.js.map +1 -1
- package/lib-esm/icons/FiberManualRecord.d.ts +1 -1
- package/lib-esm/icons/FiberManualRecord.js +1 -1
- package/lib-esm/icons/FiberManualRecord.js.map +1 -1
- package/lib-esm/icons/Info.d.ts +1 -1
- package/lib-esm/icons/Info.js +1 -1
- package/lib-esm/icons/Info.js.map +1 -1
- package/lib-esm/icons/ReportProblem.d.ts +1 -1
- package/lib-esm/icons/ReportProblem.js +1 -1
- package/lib-esm/icons/ReportProblem.js.map +1 -1
- package/lib-esm/shared/LayerManager.d.ts +2 -2
- package/lib-esm/shared/LayerManager.js +18 -14
- package/lib-esm/shared/LayerManager.js.map +1 -1
- package/lib-esm/shared/constants.js.map +1 -1
- package/package.json +93 -72
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
1
2
|
import PropTypes from 'prop-types';
|
|
2
|
-
declare function Accordion(props: AccordionProps
|
|
3
|
-
children: any;
|
|
4
|
-
}): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare function Accordion(props: PropsWithChildren<AccordionProps>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
5
4
|
declare namespace Accordion {
|
|
6
5
|
var propTypes: {
|
|
7
6
|
/** Currently opened step */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import { useState, Children, cloneElement } from 'react';
|
|
2
|
+
import { useState, Children, cloneElement, isValidElement } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
function Accordion(props) {
|
|
5
5
|
const [active, setActive] = useState(props.active);
|
|
@@ -16,9 +16,12 @@ function Accordion(props) {
|
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
return (_jsx(_Fragment, { children: Children.map(props.children, (child, index) => {
|
|
19
|
+
if (!isValidElement(child)) {
|
|
20
|
+
return child;
|
|
21
|
+
}
|
|
19
22
|
return cloneElement(child, {
|
|
20
23
|
open: active === index,
|
|
21
|
-
onStepClick: onStepClick(index, child.props.disabled)
|
|
24
|
+
onStepClick: onStepClick(index, child.props.disabled),
|
|
22
25
|
});
|
|
23
26
|
}) }));
|
|
24
27
|
}
|
|
@@ -26,7 +29,7 @@ Accordion.propTypes = {
|
|
|
26
29
|
/** Currently opened step */
|
|
27
30
|
active: PropTypes.number,
|
|
28
31
|
/** Handler for click event on a step */
|
|
29
|
-
onStepClick: PropTypes.func
|
|
32
|
+
onStepClick: PropTypes.func,
|
|
30
33
|
};
|
|
31
34
|
Accordion.defaultProps = {
|
|
32
35
|
active: -1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../../../src/components/Accordion/Accordion.tsx"],"names":[],"mappings":";AAAA,
|
|
1
|
+
{"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../../../src/components/Accordion/Accordion.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QA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Y,GAAG;IACrB,MAAM,EAAE,CAAC,CAAC;CACb,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -27,7 +27,7 @@ declare namespace AccordionStep {
|
|
|
27
27
|
}
|
|
28
28
|
export default AccordionStep;
|
|
29
29
|
type AccordionStepProps = PropTypes.InferProps<typeof AccordionStep.propTypes> & {
|
|
30
|
-
open
|
|
30
|
+
open?: boolean;
|
|
31
31
|
completed: boolean;
|
|
32
|
-
onStepClick
|
|
32
|
+
onStepClick?: () => void;
|
|
33
33
|
};
|
|
@@ -1,39 +1,44 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import styled from '@emotion/styled';
|
|
4
|
-
import { css } from '@emotion/react';
|
|
5
3
|
import PropTypes from 'prop-types';
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
4
|
+
import { css } from '@emotion/react';
|
|
5
|
+
import styled from '@emotion/styled';
|
|
8
6
|
import { FiberManualRecord, ExpandMore } from '../../icons';
|
|
9
7
|
import constants from '../../shared/constants';
|
|
8
|
+
import { Ellipsis } from '../../shared/styles';
|
|
10
9
|
import { Badge, BADGE_TYPE } from '../Badge';
|
|
10
|
+
import { Card } from '../Card';
|
|
11
11
|
const Step = styled(Card) `
|
|
12
|
-
transition: all .6s ease;
|
|
12
|
+
transition: all 0.6s ease;
|
|
13
13
|
|
|
14
|
-
${props => props.open &&
|
|
14
|
+
${(props) => props.open &&
|
|
15
|
+
`
|
|
15
16
|
margin: 20px 5px;
|
|
16
17
|
`}
|
|
17
18
|
|
|
18
|
-
${props => props.focused && `box-shadow: 0 0 0 4px var(--primary-light, ${constants.PRIMARY_LIGHT});`}
|
|
19
|
+
${(props) => props.focused && `box-shadow: 0 0 0 4px var(--primary-light, ${constants.PRIMARY_LIGHT});`}
|
|
19
20
|
`;
|
|
20
21
|
const StepHeader = styled.div `
|
|
21
22
|
padding: 20px 15px;
|
|
22
23
|
display: flex;
|
|
23
24
|
justify-content: space-between;
|
|
24
|
-
|
|
25
|
+
|
|
25
26
|
& input {
|
|
26
27
|
appearance: none;
|
|
27
28
|
margin: 0;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
${props => props.open
|
|
31
|
+
${(props) => props.open
|
|
32
|
+
? `
|
|
31
33
|
border-bottom: 1px solid var(--border-light-color, ${constants.BORDER_LIGHT_COLOR});
|
|
32
|
-
`
|
|
34
|
+
`
|
|
35
|
+
: ''}
|
|
33
36
|
|
|
34
|
-
${props => props.disabled
|
|
37
|
+
${(props) => props.disabled
|
|
38
|
+
? `
|
|
35
39
|
color: ${constants.LIGHT_GREY};
|
|
36
|
-
`
|
|
40
|
+
`
|
|
41
|
+
: `
|
|
37
42
|
cursor: pointer;
|
|
38
43
|
`}
|
|
39
44
|
`;
|
|
@@ -45,13 +50,13 @@ const HeaderContainer = styled.div `
|
|
|
45
50
|
& svg {
|
|
46
51
|
vertical-align: top;
|
|
47
52
|
margin-right: 10px;
|
|
48
|
-
fill: ${props => props.open
|
|
53
|
+
fill: ${(props) => props.open
|
|
49
54
|
? `var(--primary, ${constants.PRIMARY})`
|
|
50
55
|
: props.completed
|
|
51
56
|
? `var(--success, ${constants.SUCCESS})`
|
|
52
57
|
: constants.LIGHT_GREY};
|
|
53
|
-
transform: ${props => props.open ? 'scale(0.8)' : 'scale(0.6)'};
|
|
54
|
-
transition: all .3s ease;
|
|
58
|
+
transform: ${(props) => (props.open ? 'scale(0.8)' : 'scale(0.6)')};
|
|
59
|
+
transition: all 0.3s ease;
|
|
55
60
|
min-width: 24px;
|
|
56
61
|
}
|
|
57
62
|
`;
|
|
@@ -62,20 +67,22 @@ const ExpandContainer = styled.div `
|
|
|
62
67
|
& svg {
|
|
63
68
|
vertical-align: top;
|
|
64
69
|
margin-right: 10px;
|
|
65
|
-
transition: all .6s ease;
|
|
70
|
+
transition: all 0.6s ease;
|
|
66
71
|
fill: currentColor;
|
|
67
72
|
}
|
|
68
73
|
|
|
69
|
-
${props => props.open
|
|
74
|
+
${(props) => props.open
|
|
75
|
+
? `
|
|
70
76
|
& svg {
|
|
71
77
|
transform: rotate(180deg);
|
|
72
78
|
}
|
|
73
|
-
`
|
|
79
|
+
`
|
|
80
|
+
: ''}
|
|
74
81
|
`;
|
|
75
82
|
const StepBody = styled.div `
|
|
76
|
-
transition: all .6s ease;
|
|
83
|
+
transition: all 0.6s ease;
|
|
77
84
|
overflow: hidden;
|
|
78
|
-
height: ${props => props.height || 0}px;
|
|
85
|
+
height: ${(props) => props.height || 0}px;
|
|
79
86
|
`;
|
|
80
87
|
export const AccordionStepBody = styled.div `
|
|
81
88
|
padding: 20px 15px;
|
|
@@ -94,7 +101,9 @@ export default function AccordionStep(props) {
|
|
|
94
101
|
const toggleFocus = () => {
|
|
95
102
|
setFocused(!focused);
|
|
96
103
|
};
|
|
97
|
-
return (_jsxs(Step, Object.assign({}, props, { focused: focused, elevated: props.open, children: [_jsxs(StepHeader, { open: open, disabled: disabled, onClick: onStepClick, children: [_jsxs(HeaderContainer, { open: open, completed: completed, children: [_jsx("input", { type:
|
|
104
|
+
return (_jsxs(Step, Object.assign({}, props, { focused: focused, elevated: props.open, children: [_jsxs(StepHeader, { open: open, disabled: disabled, onClick: onStepClick, children: [_jsxs(HeaderContainer, { open: open, completed: completed, children: [_jsx("input", { type: "checkbox", checked: open, disabled: disabled, onFocus: toggleFocus, onBlur: toggleFocus }), _jsx(FiberManualRecord, {}), _jsx(Ellipsis, { children: header })] }), _jsxs(ExpandContainer, { open: open, children: [errorText && (_jsx(Badge, { css: css `
|
|
105
|
+
margin-right: 15px;
|
|
106
|
+
`, inline: true, type: BADGE_TYPE.DANGER, children: errorText })), _jsx(ExpandMore, {})] })] }), _jsx(StepBody, { ref: ref, height: open ? height : 0, children: open && props.children })] })));
|
|
98
107
|
}
|
|
99
108
|
AccordionStep.propTypes = {
|
|
100
109
|
/** Header text for the step */
|
|
@@ -108,6 +117,6 @@ AccordionStep.propTypes = {
|
|
|
108
117
|
};
|
|
109
118
|
AccordionStep.defaultProps = {
|
|
110
119
|
completed: false,
|
|
111
|
-
disabled: false
|
|
120
|
+
disabled: false,
|
|
112
121
|
};
|
|
113
122
|
//# sourceMappingURL=AccordionStep.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionStep.js","sourceRoot":"","sources":["../../../src/components/Accordion/AccordionStep.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,
|
|
1
|
+
{"version":3,"file":"AccordionStep.js","sourceRoot":"","sources":["../../../src/components/Accordion/AccordionStep.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAA2C;;;MAG9D,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,CAAC,IAAI;IACV;;KAEH;;MAEC,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,CAAC,OAAO,IAAI,8CAA8C,SAAS,CAAC,aAAa,IAAI;CACjG,CAAC;AAEF,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAsC;;;;;;;;;;MAU7D,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,CAAC,IAAI;IACN,CAAC,CA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IAAI,IAAI,KAAK,CAAC,QAAQ,GAChB,KACR,CACV,CAAC;AACN,CAAC;AAED,aAAa,CAAC,SAAS,GAAG;IACtB,+BAA+B;IAC/B,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACnC,8BAA8B;IAC9B,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,4CAA4C;IAC5C,SAAS,EAAE,SAAS,CAAC,IAAI;IACzB,8BAA8B;IAC9B,QAAQ,EAAE,SAAS,CAAC,IAAI;CAC3B,CAAC;AAEF,aAAa,CAAC,YAAY,GAAG;IACzB,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE,KAAK;CAClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Accordion/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,iBAAiB,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Accordion/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import styled from '@emotion/styled';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from '@emotion/styled';
|
|
4
4
|
import constants from '../../shared/constants';
|
|
5
5
|
export var BADGE_TYPE;
|
|
6
6
|
(function (BADGE_TYPE) {
|
|
@@ -11,7 +11,7 @@ export var BADGE_TYPE;
|
|
|
11
11
|
BADGE_TYPE["DISABLED"] = "disabled";
|
|
12
12
|
})(BADGE_TYPE || (BADGE_TYPE = {}));
|
|
13
13
|
const BadgeSpan = styled.span `
|
|
14
|
-
background-color: ${props => {
|
|
14
|
+
background-color: ${(props) => {
|
|
15
15
|
switch (props.type) {
|
|
16
16
|
case BADGE_TYPE.SUCCESS:
|
|
17
17
|
return `var(--success, ${constants.SUCCESS})`;
|
|
@@ -27,19 +27,18 @@ const BadgeSpan = styled.span `
|
|
|
27
27
|
}};
|
|
28
28
|
color: #fff;
|
|
29
29
|
border-radius: 10px;
|
|
30
|
-
padding: ${props => props.children ? '3px 10px' : '4px'};
|
|
30
|
+
padding: ${(props) => (props.children ? '3px 10px' : '4px')};
|
|
31
31
|
display: inline-block;
|
|
32
32
|
min-height: 4px;
|
|
33
33
|
min-width: 4px;
|
|
34
34
|
font-size: 12px;
|
|
35
|
-
margin: ${props => props.inline ? '0 5px' : '0'};
|
|
35
|
+
margin: ${(props) => (props.inline ? '0 5px' : '0')};
|
|
36
36
|
|
|
37
|
-
${props => !props.inline && 'position: absolute; top: 0; right: 0; transform: translate(50%, -50%);'};
|
|
37
|
+
${(props) => !props.inline && 'position: absolute; top: 0; right: 0; transform: translate(50%, -50%);'};
|
|
38
38
|
`;
|
|
39
39
|
export default function Badge(props) {
|
|
40
40
|
return _jsx(BadgeSpan, Object.assign({}, props));
|
|
41
41
|
}
|
|
42
|
-
;
|
|
43
42
|
Badge.propTypes = {
|
|
44
43
|
/** Display badge inline or overlay on parent component */
|
|
45
44
|
inline: PropTypes.bool,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../../src/components/Badge/Badge.tsx"],"names":[],"mappings":";AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../../src/components/Badge/Badge.tsx"],"names":[],"mappings":";AACA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,SAAS,MAAM,wBAAwB,CAAC;AA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I;IACtB,oBAAoB;IACpB,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC;QAClB,UAAU,CAAC,OAAO;QAClB,UAAU,CAAC,OAAO;QAClB,UAAU,CAAC,OAAO;QAClB,UAAU,CAAC,MAAM;QACjB,UAAU,CAAC,QAAQ;KACtB,CAAC;IACF,GAAG,EAAE,SAAS,CAAC,GAAG;CACrB,CAAC;AAEF,KAAK,CAAC,YAAY,GAAG;IACjB,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,UAAU,CAAC,OAAO;CAC3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkButton.js","sourceRoot":"","sources":["../../../src/components/Button/LinkButton.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAE/C,eAAe,MAAM,CAAC,MAAM,CAAA;;;;;;;;4BAQA,SAAS,CAAC,OAAO
|
|
1
|
+
{"version":3,"file":"LinkButton.js","sourceRoot":"","sources":["../../../src/components/Button/LinkButton.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAE/C,eAAe,MAAM,CAAC,MAAM,CAAA;;;;;;;;4BAQA,SAAS,CAAC,OAAO;;;;;;;;;;;;;;;;;;;;;wBAqBrB,SAAS,CAAC,YAAY;iBAC7B,SAAS,CAAC,eAAe;;CAEzC,CAAC"}
|
|
@@ -3,7 +3,7 @@ import constants from '../../shared/constants';
|
|
|
3
3
|
const Card = styled.div `
|
|
4
4
|
border-radius: 10px;
|
|
5
5
|
background-color: var(--background, ${constants.BACKGROUND});
|
|
6
|
-
${props => props.elevated
|
|
6
|
+
${(props) => props.elevated
|
|
7
7
|
? `box-shadow: var(--modal-shadow, ${constants.MODAL_SHADOW});`
|
|
8
8
|
: `box-shadow: var(--shadow, ${constants.SHADOW});`}
|
|
9
9
|
margin: 5px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","sourceRoot":"","sources":["../../../src/components/Card/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAM/C,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAgB;;0CAEG,SAAS,CAAC,UAAU;MACxD,KAAK,
|
|
1
|
+
{"version":3,"file":"Card.js","sourceRoot":"","sources":["../../../src/components/Card/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAM/C,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAgB;;0CAEG,SAAS,CAAC,UAAU;MACxD,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,CAAC,QAAQ;IACV,CAAC,CAAC,mCAAmC,SAAS,CAAC,YAAY,IAAI;IAC/D,CAAC,CAAC,6BAA6B,SAAS,CAAC,MAAM,IAAI;;;;CAI9D,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -11,10 +11,11 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
13
13
|
import styled from '@emotion/styled';
|
|
14
|
-
import constants from '../../shared/constants';
|
|
15
14
|
import { Close } from '../../icons';
|
|
15
|
+
import constants from '../../shared/constants';
|
|
16
16
|
const Container = styled.div `
|
|
17
17
|
padding: 5px;
|
|
18
|
+
padding-left: 15px;
|
|
18
19
|
border-radius: 16px;
|
|
19
20
|
background-color: var(--border-light-color, ${constants.BORDER_LIGHT_COLOR});
|
|
20
21
|
display: inline-flex;
|
|
@@ -23,7 +24,7 @@ const Container = styled.div `
|
|
|
23
24
|
align-items: center;
|
|
24
25
|
|
|
25
26
|
&:focus-within {
|
|
26
|
-
|
|
27
|
+
outline: 2px solid var(--primary-light, ${constants.PRIMARY_LIGHT});
|
|
27
28
|
}
|
|
28
29
|
`;
|
|
29
30
|
const Button = styled.button `
|
|
@@ -42,6 +43,6 @@ export default function Chip(props) {
|
|
|
42
43
|
onCloseClick === null || onCloseClick === void 0 ? void 0 : onCloseClick();
|
|
43
44
|
}
|
|
44
45
|
};
|
|
45
|
-
return (_jsxs(Container, Object.assign({}, rest, { onKeyUp: keyUpHandler, children: [label, _jsx(Button, { onClick: onCloseClick, children: _jsx(Close, { height: 20, width: 20 }) })] })));
|
|
46
|
+
return (_jsxs(Container, Object.assign({}, rest, { onKeyUp: keyUpHandler, children: [label, _jsx(Button, { onClick: onCloseClick, "aria-label": `Remove ${label}`, children: _jsx(Close, { height: 20, width: 20 }) })] })));
|
|
46
47
|
}
|
|
47
48
|
//# sourceMappingURL=Chip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chip.js","sourceRoot":"","sources":["../../../src/components/Chip/Chip.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,
|
|
1
|
+
{"version":3,"file":"Chip.js","sourceRoot":"","sources":["../../../src/components/Chip/Chip.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAS/C,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA;;;;kDAIsB,SAAS,CAAC,kBAAkB;;;;;;;kDAO5B,SAAS,CAAC,aAAa;;CAExE,CAAC;AAEF,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAA;;+CAEmB,SAAS,CAAC,eAAe;;;;;;CAMvE,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,KAAgB;IACzC,MAAM,EAAE,KAAK,EAAE,YAAY,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK,EAAxC,yBAAgC,CAAQ,CAAC;IAE/C,MAAM,YAAY,GAA+C,CAAC,CAAC,EAAE,EAAE;QACnE,IAAI,CAAC,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,KAAK,EAAE,EAAE,CAAC;YACtC,YAAY,aAAZ,YAAY,uBAAZ,YAAY,EAAI,CAAC;QACrB,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,CACH,MAAC,SAAS,oBAAK,IAAI,IAAE,OAAO,EAAE,YAAY,aACrC,KAAK,EACN,KAAC,MAAM,IAAC,OAAO,EAAE,YAAY,gBAAc,UAAU,KAAK,EAAE,YACxD,KAAC,KAAK,IAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,GAAI,GAC3B,KACD,CACf,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
type ChipInputProps = PropTypes.InferProps<typeof ChipInput.propTypes>;
|
|
4
|
+
/**
|
|
5
|
+
* A chip input component that allows users to add and remove chips (tags) by typing and pressing Enter.
|
|
6
|
+
* @component
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <ChipInput
|
|
10
|
+
* value={['tag1', 'tag2']}
|
|
11
|
+
* onChange={(newTags) => console.log(newTags)}
|
|
12
|
+
* label="Add tags"
|
|
13
|
+
* errorText="At least one tag is required"
|
|
14
|
+
* />
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
declare function ChipInput(props: ChipInputProps & React.AllHTMLAttributes<HTMLInputElement>): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
18
|
+
declare namespace ChipInput {
|
|
19
|
+
var propTypes: {
|
|
20
|
+
/** Label for the field */
|
|
21
|
+
label: PropTypes.Validator<string>;
|
|
22
|
+
/** Error message for the field */
|
|
23
|
+
errorText: PropTypes.Requireable<string>;
|
|
24
|
+
/** Values to display as chips */
|
|
25
|
+
value: PropTypes.Requireable<string[]>;
|
|
26
|
+
/** Callback when chips change */
|
|
27
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
28
|
+
};
|
|
29
|
+
var defaultProps: {
|
|
30
|
+
value: any[];
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export default ChipInput;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import styled from '@emotion/styled';
|
|
5
|
+
import constants from '../../shared/constants';
|
|
6
|
+
import Chip from '../Chip/Chip';
|
|
7
|
+
import { DragAndDrop, ORIENTATION } from '../DragAndDrop';
|
|
8
|
+
// Label component for the ChipInput
|
|
9
|
+
const Label = styled.label `
|
|
10
|
+
display: inline-flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
flex: 1;
|
|
13
|
+
position: relative;
|
|
14
|
+
margin: 10px 5px;
|
|
15
|
+
color: inherit;
|
|
16
|
+
padding: 0 8px;
|
|
17
|
+
width: 250px;
|
|
18
|
+
border-radius: 3px;
|
|
19
|
+
border: 1px solid var(--border-color, ${constants.BORDER_COLOR});
|
|
20
|
+
background-color: var(--background, ${constants.BACKGROUND});
|
|
21
|
+
|
|
22
|
+
/** Focused */
|
|
23
|
+
&:has(:focus),
|
|
24
|
+
&:has(:active) {
|
|
25
|
+
border-color: var(--primary, ${constants.PRIMARY});
|
|
26
|
+
box-shadow: 0 0 0 4px var(--primary-light, ${constants.PRIMARY_LIGHT});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&:has(:focus) > span,
|
|
30
|
+
&:has(:active) > span {
|
|
31
|
+
color: var(--primary, ${constants.PRIMARY});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Disabled */
|
|
35
|
+
&:has(:disabled) {
|
|
36
|
+
border-color: var(--disabled-border, ${constants.DISABLED_BORDER});
|
|
37
|
+
background-color: var(--disabled-background, ${constants.DISABLED_BACKGROUND});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&:has(:disabled) > span {
|
|
41
|
+
color: #777;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Invalid */
|
|
45
|
+
&:has(:focus:invalid) {
|
|
46
|
+
border-color: var(--error, ${constants.ERROR});
|
|
47
|
+
box-shadow: 0 0 0 4px var(--error-light, ${constants.ERROR_LIGHT});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
${(props) => props.touched
|
|
51
|
+
? `
|
|
52
|
+
&:has(:invalid) {
|
|
53
|
+
border-color: var(--error, ${constants.ERROR});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&:has(:invalid) > span {
|
|
57
|
+
color: var(--error, ${constants.ERROR});
|
|
58
|
+
}
|
|
59
|
+
`
|
|
60
|
+
: ''}
|
|
61
|
+
|
|
62
|
+
/** Error */
|
|
63
|
+
${(props) => props.errorText
|
|
64
|
+
? `
|
|
65
|
+
border-color: var(--error, ${constants.ERROR});
|
|
66
|
+
|
|
67
|
+
& > span {
|
|
68
|
+
color: var(--error, ${constants.ERROR});
|
|
69
|
+
}
|
|
70
|
+
`
|
|
71
|
+
: ''}
|
|
72
|
+
|
|
73
|
+
/** Required */
|
|
74
|
+
&:has(:required) > span:after {
|
|
75
|
+
content: '*';
|
|
76
|
+
margin-left: 2px;
|
|
77
|
+
color: var(--error, ${constants.ERROR});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
& > input {
|
|
81
|
+
border: none;
|
|
82
|
+
outline: none;
|
|
83
|
+
width: 100%;
|
|
84
|
+
line-height: 30px;
|
|
85
|
+
min-height: 30px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Label Animation */
|
|
89
|
+
& > span {
|
|
90
|
+
position: absolute;
|
|
91
|
+
padding: 0 5px;
|
|
92
|
+
top: 0px;
|
|
93
|
+
left: 4px;
|
|
94
|
+
font-size: 14px;
|
|
95
|
+
line-height: 32px;
|
|
96
|
+
transition: all 300ms ease;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&:has(:focus) > span,
|
|
100
|
+
&:has(:placeholder-shown) > span {
|
|
101
|
+
top: -8px;
|
|
102
|
+
background: var(--background, ${constants.BACKGROUND});
|
|
103
|
+
font-size: 12px;
|
|
104
|
+
line-height: 14px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
${(props) => props.text !== ''
|
|
108
|
+
? `
|
|
109
|
+
& > span {
|
|
110
|
+
top: -8px;
|
|
111
|
+
background: var(--background, ${constants.BACKGROUND});
|
|
112
|
+
font-size: 12px;
|
|
113
|
+
line-height: 14px;
|
|
114
|
+
}
|
|
115
|
+
`
|
|
116
|
+
: ''}
|
|
117
|
+
`;
|
|
118
|
+
// Error message container
|
|
119
|
+
const ErrorContainer = styled.div `
|
|
120
|
+
color: var(--error, ${constants.ERROR});
|
|
121
|
+
padding-top: 3px;
|
|
122
|
+
font-size: 12px;
|
|
123
|
+
line-height: 14px;
|
|
124
|
+
margin-left: 3px;
|
|
125
|
+
`;
|
|
126
|
+
/**
|
|
127
|
+
* A chip input component that allows users to add and remove chips (tags) by typing and pressing Enter.
|
|
128
|
+
* @component
|
|
129
|
+
* @example
|
|
130
|
+
* ```tsx
|
|
131
|
+
* <ChipInput
|
|
132
|
+
* value={['tag1', 'tag2']}
|
|
133
|
+
* onChange={(newTags) => console.log(newTags)}
|
|
134
|
+
* label="Add tags"
|
|
135
|
+
* errorText="At least one tag is required"
|
|
136
|
+
* />
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
export default function ChipInput(props) {
|
|
140
|
+
const [text, setText] = useState('');
|
|
141
|
+
const [touched, setTouched] = useState(false);
|
|
142
|
+
const [value, setValue] = useState(props.value);
|
|
143
|
+
const InputRef = React.useRef(null);
|
|
144
|
+
// Sync internal value with props.value
|
|
145
|
+
useEffect(() => {
|
|
146
|
+
setValue(props.value);
|
|
147
|
+
}, [props.value]);
|
|
148
|
+
/**
|
|
149
|
+
* Update the chip values and notify changes.
|
|
150
|
+
* @param newValue The new array of chip values
|
|
151
|
+
*/
|
|
152
|
+
const updateValue = (newValue) => {
|
|
153
|
+
var _a;
|
|
154
|
+
const deduped = Array.from(new Set(newValue));
|
|
155
|
+
setValue(deduped);
|
|
156
|
+
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, deduped);
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Marks the input as touched on focus.
|
|
160
|
+
* @param e React focus event
|
|
161
|
+
*/
|
|
162
|
+
const handleFocus = (e) => {
|
|
163
|
+
setTouched(true);
|
|
164
|
+
if (props.onFocus) {
|
|
165
|
+
props.onFocus(e);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Change handler for the input field.
|
|
170
|
+
* @param e React change event
|
|
171
|
+
*/
|
|
172
|
+
const handleChange = (e) => {
|
|
173
|
+
setText(e.target.value);
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* Adds a new chip on Enter key press.
|
|
177
|
+
* @param e React keyboard event
|
|
178
|
+
*/
|
|
179
|
+
const handleKeyUp = (e) => {
|
|
180
|
+
if (e.key === 'Enter' && text.trim() !== '') {
|
|
181
|
+
const newValue = [...value, text.trim()];
|
|
182
|
+
updateValue(newValue);
|
|
183
|
+
setText('');
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* Removes a chip from the list.
|
|
188
|
+
* @param chipToRemove The chip value to remove
|
|
189
|
+
*/
|
|
190
|
+
const removeChip = (chipToRemove) => {
|
|
191
|
+
const newValue = value.filter((chip) => chip !== chipToRemove);
|
|
192
|
+
updateValue(newValue);
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Moves a chip from one position to another.
|
|
196
|
+
* @param start The starting index of the item to move
|
|
197
|
+
* @param end The ending index where the item should be placed
|
|
198
|
+
*/
|
|
199
|
+
const onDrop = (start, end) => {
|
|
200
|
+
// Clone existing elements
|
|
201
|
+
const newItems = [...value];
|
|
202
|
+
// Remove the element to be moved
|
|
203
|
+
const item = newItems.splice(start, 1);
|
|
204
|
+
// Add it back at the required position
|
|
205
|
+
newItems.splice(end, 0, item[0]);
|
|
206
|
+
// Update
|
|
207
|
+
updateValue(newItems);
|
|
208
|
+
};
|
|
209
|
+
// Render the component
|
|
210
|
+
return (_jsxs(Label, { text: text, touched: touched, errorText: props.errorText, children: [_jsx("input", Object.assign({}, props, { ref: InputRef, type: "text", value: text, onChange: handleChange, onFocus: handleFocus, onKeyUp: handleKeyUp, required: props.required && value.length === 0 })), _jsx("div", { children: (value === null || value === void 0 ? void 0 : value.length) > 0 && (_jsx(DragAndDrop, { orientation: ORIENTATION.HORIZONTAL, onDrop: onDrop, children: value.map((chip) => (_jsx(Chip, { label: chip, onCloseClick: () => removeChip(chip) }, chip))) })) }), _jsx("span", { children: props.label }), props.errorText && _jsx(ErrorContainer, { children: props.errorText })] }));
|
|
211
|
+
}
|
|
212
|
+
ChipInput.propTypes = {
|
|
213
|
+
/** Label for the field */
|
|
214
|
+
label: PropTypes.string.isRequired,
|
|
215
|
+
/** Error message for the field */
|
|
216
|
+
errorText: PropTypes.string,
|
|
217
|
+
/** Values to display as chips */
|
|
218
|
+
value: PropTypes.arrayOf(PropTypes.string),
|
|
219
|
+
/** Callback when chips change */
|
|
220
|
+
onChange: PropTypes.func,
|
|
221
|
+
};
|
|
222
|
+
ChipInput.defaultProps = {
|
|
223
|
+
value: [],
|
|
224
|
+
};
|
|
225
|
+
//# sourceMappingURL=ChipInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChipInput.js","sourceRoot":"","sources":["../../../src/components/ChipInput/ChipInput.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAA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,EAAE,WAAW,EACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAChD,EACF,wBACK,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,IAAG,CAAC,IAAI,CAClB,KAAC,WAAW,IAAC,WAAW,EAAE,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,YAC3D,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACjB,KAAC,IAAI,IAAY,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAvD,IAAI,CAAuD,CACzE,CAAC,GACQ,CACjB,GACC,EACN,yBAAO,KAAK,CAAC,KAAK,GAAQ,EACzB,KAAK,CAAC,SAAS,IAAI,KAAC,cAAc,cAAE,KAAK,CAAC,SAAS,GAAkB,IAClE,CACX,CAAC;AACN,CAAC;AAED,SAAS,CAAC,SAAS,GAAG;IAClB,0BAA0B;IAC1B,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IAClC,kCAAkC;IAClC,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,iCAAiC;IACjC,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC;IAC1C,iCAAiC;IACjC,QAAQ,EAAE,SAAS,CAAC,IAAI;CAC3B,CAAC;AAEF,SAAS,CAAC,YAAY,GAAG;IACrB,KAAK,EAAE,EAAE;CACZ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ChipInput } from './ChipInput';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ChipInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import React, { createRef } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import Dialog, { DialogBody, DialogFooter, DialogHeader } from './Dialog';
|
|
5
4
|
import { Button } from '../Button';
|
|
5
|
+
import Dialog, { DialogBody, DialogFooter, DialogHeader } from './Dialog';
|
|
6
6
|
class AlertDialog extends React.Component {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments);
|
|
9
9
|
this.dialog = createRef();
|
|
10
10
|
this.show = () => {
|
|
11
|
-
return new Promise(resolve => {
|
|
11
|
+
return new Promise((resolve) => {
|
|
12
12
|
const onClose = () => resolve(null);
|
|
13
13
|
this.dialog.current.open(onClose);
|
|
14
14
|
});
|
|
@@ -30,7 +30,7 @@ AlertDialog.propTypes = {
|
|
|
30
30
|
dialogProps: PropTypes.object,
|
|
31
31
|
};
|
|
32
32
|
AlertDialog.defaultProps = {
|
|
33
|
-
buttonText: 'OK'
|
|
33
|
+
buttonText: 'OK',
|
|
34
34
|
};
|
|
35
35
|
export default AlertDialog;
|
|
36
36
|
//# sourceMappingURL=AlertDialog.js.map
|