@darajs/ui-components 1.0.0-a.1
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/LICENSE +201 -0
- package/dist/accordion/accordion-item.d.ts +25 -0
- package/dist/accordion/accordion-item.d.ts.map +1 -0
- package/dist/accordion/accordion-item.js +90 -0
- package/dist/accordion/accordion-item.js.map +1 -0
- package/dist/accordion/accordion.d.ts +33 -0
- package/dist/accordion/accordion.d.ts.map +1 -0
- package/dist/accordion/accordion.js +86 -0
- package/dist/accordion/accordion.js.map +1 -0
- package/dist/badge/badge.d.ts +21 -0
- package/dist/badge/badge.d.ts.map +1 -0
- package/dist/badge/badge.js +42 -0
- package/dist/badge/badge.js.map +1 -0
- package/dist/button/button.d.ts +35 -0
- package/dist/button/button.d.ts.map +1 -0
- package/dist/button/button.js +169 -0
- package/dist/button/button.js.map +1 -0
- package/dist/button-bar/button-bar.d.ts +19 -0
- package/dist/button-bar/button-bar.d.ts.map +1 -0
- package/dist/button-bar/button-bar.js +123 -0
- package/dist/button-bar/button-bar.js.map +1 -0
- package/dist/carousel/carousel.d.ts +24 -0
- package/dist/carousel/carousel.d.ts.map +1 -0
- package/dist/carousel/carousel.js +175 -0
- package/dist/carousel/carousel.js.map +1 -0
- package/dist/checkbox/checkbox-group.d.ts +36 -0
- package/dist/checkbox/checkbox-group.d.ts.map +1 -0
- package/dist/checkbox/checkbox-group.js +116 -0
- package/dist/checkbox/checkbox-group.js.map +1 -0
- package/dist/checkbox/checkbox.d.ts +28 -0
- package/dist/checkbox/checkbox.d.ts.map +1 -0
- package/dist/checkbox/checkbox.js +162 -0
- package/dist/checkbox/checkbox.js.map +1 -0
- package/dist/checkbox/tri-state-checkbox.d.ts +23 -0
- package/dist/checkbox/tri-state-checkbox.d.ts.map +1 -0
- package/dist/checkbox/tri-state-checkbox.js +87 -0
- package/dist/checkbox/tri-state-checkbox.js.map +1 -0
- package/dist/combo-box/combo-box.d.ts +328 -0
- package/dist/combo-box/combo-box.d.ts.map +1 -0
- package/dist/combo-box/combo-box.js +213 -0
- package/dist/combo-box/combo-box.js.map +1 -0
- package/dist/component-select-list/component-select-list.d.ts +27 -0
- package/dist/component-select-list/component-select-list.d.ts.map +1 -0
- package/dist/component-select-list/component-select-list.js +129 -0
- package/dist/component-select-list/component-select-list.js.map +1 -0
- package/dist/constants.d.ts +33 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +47 -0
- package/dist/constants.js.map +1 -0
- package/dist/context-menu/context-menu.d.ts +24 -0
- package/dist/context-menu/context-menu.d.ts.map +1 -0
- package/dist/context-menu/context-menu.js +112 -0
- package/dist/context-menu/context-menu.js.map +1 -0
- package/dist/datepicker/datepicker-select.d.ts +50 -0
- package/dist/datepicker/datepicker-select.d.ts.map +1 -0
- package/dist/datepicker/datepicker-select.js +211 -0
- package/dist/datepicker/datepicker-select.js.map +1 -0
- package/dist/datepicker/datepicker.d.ts +57 -0
- package/dist/datepicker/datepicker.d.ts.map +1 -0
- package/dist/datepicker/datepicker.js +608 -0
- package/dist/datepicker/datepicker.js.map +1 -0
- package/dist/dropzone/dropzone.d.ts +20 -0
- package/dist/dropzone/dropzone.d.ts.map +1 -0
- package/dist/dropzone/dropzone.js +77 -0
- package/dist/dropzone/dropzone.js.map +1 -0
- package/dist/error-boundary/error-boundary.d.ts +33 -0
- package/dist/error-boundary/error-boundary.d.ts.map +1 -0
- package/dist/error-boundary/error-boundary.js +72 -0
- package/dist/error-boundary/error-boundary.js.map +1 -0
- package/dist/filter/categorical-filter.d.ts +27 -0
- package/dist/filter/categorical-filter.d.ts.map +1 -0
- package/dist/filter/categorical-filter.js +150 -0
- package/dist/filter/categorical-filter.js.map +1 -0
- package/dist/filter/datetime-filter.d.ts +29 -0
- package/dist/filter/datetime-filter.d.ts.map +1 -0
- package/dist/filter/datetime-filter.js +196 -0
- package/dist/filter/datetime-filter.js.map +1 -0
- package/dist/filter/numeric-filter.d.ts +25 -0
- package/dist/filter/numeric-filter.d.ts.map +1 -0
- package/dist/filter/numeric-filter.js +146 -0
- package/dist/filter/numeric-filter.js.map +1 -0
- package/dist/hierarchy-selector/hierarchy-selector.d.ts +31 -0
- package/dist/hierarchy-selector/hierarchy-selector.d.ts.map +1 -0
- package/dist/hierarchy-selector/hierarchy-selector.js +65 -0
- package/dist/hierarchy-selector/hierarchy-selector.js.map +1 -0
- package/dist/hierarchy-selector/node/branch.d.ts +47 -0
- package/dist/hierarchy-selector/node/branch.d.ts.map +1 -0
- package/dist/hierarchy-selector/node/branch.js +133 -0
- package/dist/hierarchy-selector/node/branch.js.map +1 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/dist/input/input.d.ts +58 -0
- package/dist/input/input.d.ts.map +1 -0
- package/dist/input/input.js +102 -0
- package/dist/input/input.js.map +1 -0
- package/dist/jest-setup.d.ts +18 -0
- package/dist/jest-setup.d.ts.map +1 -0
- package/dist/jest-setup.js +18 -0
- package/dist/jest-setup.js.map +1 -0
- package/dist/modal/modal.d.ts +37 -0
- package/dist/modal/modal.d.ts.map +1 -0
- package/dist/modal/modal.js +120 -0
- package/dist/modal/modal.js.map +1 -0
- package/dist/multiselect/multiselect.d.ts +31 -0
- package/dist/multiselect/multiselect.d.ts.map +1 -0
- package/dist/multiselect/multiselect.js +282 -0
- package/dist/multiselect/multiselect.js.map +1 -0
- package/dist/numeric-input/input-stepper.d.ts +33 -0
- package/dist/numeric-input/input-stepper.d.ts.map +1 -0
- package/dist/numeric-input/input-stepper.js +54 -0
- package/dist/numeric-input/input-stepper.js.map +1 -0
- package/dist/numeric-input/numeric-input.d.ts +48 -0
- package/dist/numeric-input/numeric-input.d.ts.map +1 -0
- package/dist/numeric-input/numeric-input.js +199 -0
- package/dist/numeric-input/numeric-input.js.map +1 -0
- package/dist/progress-bar/progress-bar.d.ts +23 -0
- package/dist/progress-bar/progress-bar.d.ts.map +1 -0
- package/dist/progress-bar/progress-bar.js +88 -0
- package/dist/progress-bar/progress-bar.js.map +1 -0
- package/dist/radio/radio-group.d.ts +20 -0
- package/dist/radio/radio-group.d.ts.map +1 -0
- package/dist/radio/radio-group.js +158 -0
- package/dist/radio/radio-group.js.map +1 -0
- package/dist/search-bar/search-bar.d.ts +34 -0
- package/dist/search-bar/search-bar.d.ts.map +1 -0
- package/dist/search-bar/search-bar.js +39 -0
- package/dist/search-bar/search-bar.js.map +1 -0
- package/dist/sectioned-list/sectioned-list.d.ts +29 -0
- package/dist/sectioned-list/sectioned-list.d.ts.map +1 -0
- package/dist/sectioned-list/sectioned-list.js +208 -0
- package/dist/sectioned-list/sectioned-list.js.map +1 -0
- package/dist/select/select.d.ts +54 -0
- package/dist/select/select.d.ts.map +1 -0
- package/dist/select/select.js +159 -0
- package/dist/select/select.js.map +1 -0
- package/dist/slider/slider-inputs.d.ts +36 -0
- package/dist/slider/slider-inputs.d.ts.map +1 -0
- package/dist/slider/slider-inputs.js +85 -0
- package/dist/slider/slider-inputs.js.map +1 -0
- package/dist/slider/slider.d.ts +53 -0
- package/dist/slider/slider.d.ts.map +1 -0
- package/dist/slider/slider.js +267 -0
- package/dist/slider/slider.js.map +1 -0
- package/dist/spinner/spinner.d.ts +20 -0
- package/dist/spinner/spinner.d.ts.map +1 -0
- package/dist/spinner/spinner.js +132 -0
- package/dist/spinner/spinner.js.map +1 -0
- package/dist/switch/sun-icon.d.ts +3 -0
- package/dist/switch/sun-icon.d.ts.map +1 -0
- package/dist/switch/sun-icon.js +24 -0
- package/dist/switch/sun-icon.js.map +1 -0
- package/dist/switch/switch.d.ts +17 -0
- package/dist/switch/switch.d.ts.map +1 -0
- package/dist/switch/switch.js +92 -0
- package/dist/switch/switch.js.map +1 -0
- package/dist/table/cells/action-cell.d.ts +34 -0
- package/dist/table/cells/action-cell.d.ts.map +1 -0
- package/dist/table/cells/action-cell.js +68 -0
- package/dist/table/cells/action-cell.js.map +1 -0
- package/dist/table/cells/datetime-cell.d.ts +12 -0
- package/dist/table/cells/datetime-cell.d.ts.map +1 -0
- package/dist/table/cells/datetime-cell.js +36 -0
- package/dist/table/cells/datetime-cell.js.map +1 -0
- package/dist/table/cells/edit-cell-utils.d.ts +32 -0
- package/dist/table/cells/edit-cell-utils.d.ts.map +1 -0
- package/dist/table/cells/edit-cell-utils.js +2 -0
- package/dist/table/cells/edit-cell-utils.js.map +1 -0
- package/dist/table/cells/edit-input-cell.d.ts +10 -0
- package/dist/table/cells/edit-input-cell.d.ts.map +1 -0
- package/dist/table/cells/edit-input-cell.js +61 -0
- package/dist/table/cells/edit-input-cell.js.map +1 -0
- package/dist/table/cells/edit-select-cell.d.ts +12 -0
- package/dist/table/cells/edit-select-cell.d.ts.map +1 -0
- package/dist/table/cells/edit-select-cell.js +55 -0
- package/dist/table/cells/edit-select-cell.js.map +1 -0
- package/dist/table/filters.d.ts +46 -0
- package/dist/table/filters.d.ts.map +1 -0
- package/dist/table/filters.js +223 -0
- package/dist/table/filters.js.map +1 -0
- package/dist/table/headers/select-header.d.ts +14 -0
- package/dist/table/headers/select-header.d.ts.map +1 -0
- package/dist/table/headers/select-header.js +41 -0
- package/dist/table/headers/select-header.js.map +1 -0
- package/dist/table/options-menu.d.ts +25 -0
- package/dist/table/options-menu.d.ts.map +1 -0
- package/dist/table/options-menu.js +120 -0
- package/dist/table/options-menu.js.map +1 -0
- package/dist/table/table.d.ts +95 -0
- package/dist/table/table.d.ts.map +1 -0
- package/dist/table/table.js +524 -0
- package/dist/table/table.js.map +1 -0
- package/dist/table/types.d.ts +30 -0
- package/dist/table/types.d.ts.map +1 -0
- package/dist/table/types.js +2 -0
- package/dist/table/types.js.map +1 -0
- package/dist/tabs/tabs.d.ts +22 -0
- package/dist/tabs/tabs.d.ts.map +1 -0
- package/dist/tabs/tabs.js +88 -0
- package/dist/tabs/tabs.js.map +1 -0
- package/dist/textarea/textarea.d.ts +45 -0
- package/dist/textarea/textarea.d.ts.map +1 -0
- package/dist/textarea/textarea.js +77 -0
- package/dist/textarea/textarea.js.map +1 -0
- package/dist/tooltip/tooltip.d.ts +46 -0
- package/dist/tooltip/tooltip.d.ts.map +1 -0
- package/dist/tooltip/tooltip.js +116 -0
- package/dist/tooltip/tooltip.js.map +1 -0
- package/dist/types.d.ts +66 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/chevron.d.ts +34 -0
- package/dist/utils/chevron.d.ts.map +1 -0
- package/dist/utils/chevron.js +40 -0
- package/dist/utils/chevron.js.map +1 -0
- package/dist/utils/index.d.ts +22 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +22 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/label.d.ts +3 -0
- package/dist/utils/label.d.ts.map +1 -0
- package/dist/utils/label.js +24 -0
- package/dist/utils/label.js.map +1 -0
- package/dist/utils/list-styles.d.ts +12 -0
- package/dist/utils/list-styles.d.ts.map +1 -0
- package/dist/utils/list-styles.js +58 -0
- package/dist/utils/list-styles.js.map +1 -0
- package/dist/utils/same-width-modifier.d.ts +23 -0
- package/dist/utils/same-width-modifier.d.ts.map +1 -0
- package/dist/utils/same-width-modifier.js +17 -0
- package/dist/utils/same-width-modifier.js.map +1 -0
- package/dist/utils/use-infinite-loader.d.ts +32 -0
- package/dist/utils/use-infinite-loader.d.ts.map +1 -0
- package/dist/utils/use-infinite-loader.js +114 -0
- package/dist/utils/use-infinite-loader.js.map +1 -0
- package/dist/utils/use-on-click-outside.d.ts +3 -0
- package/dist/utils/use-on-click-outside.d.ts.map +1 -0
- package/dist/utils/use-on-click-outside.js +36 -0
- package/dist/utils/use-on-click-outside.js.map +1 -0
- package/package.json +105 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2023 Impulse Innovations Limited
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { useState } from 'react';
|
|
19
|
+
import styled, { css, keyframes, useTheme } from '@darajs/styled-components';
|
|
20
|
+
import { Circle } from '@darajs/ui-icons';
|
|
21
|
+
import { Chevron } from '../../utils';
|
|
22
|
+
const NodeContent = styled.li `
|
|
23
|
+
margin-left: 0.35rem;
|
|
24
|
+
border-left: thin solid ${(props) => props.theme.colors.grey6};
|
|
25
|
+
&:last-child {
|
|
26
|
+
border-left: none;
|
|
27
|
+
&:before {
|
|
28
|
+
border-left: thin solid ${(props) => props.theme.colors.grey6};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
&:before {
|
|
32
|
+
content: '';
|
|
33
|
+
|
|
34
|
+
display: inline-block;
|
|
35
|
+
|
|
36
|
+
width: 0.9rem;
|
|
37
|
+
height: 0.8rem;
|
|
38
|
+
margin-right: 0.1rem;
|
|
39
|
+
|
|
40
|
+
vertical-align: top;
|
|
41
|
+
|
|
42
|
+
border-bottom: thin solid ${(props) => props.theme.colors.grey6};
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
export const Cell = styled.span `
|
|
46
|
+
cursor: ${(props) => (props.selectionAllowed ? 'pointer' : 'normal')};
|
|
47
|
+
font-weight: ${(props) => (props.isLeaf ? 300 : 400)};
|
|
48
|
+
color: ${(props) => {
|
|
49
|
+
if (props.selected) {
|
|
50
|
+
return props.theme.colors.primary;
|
|
51
|
+
}
|
|
52
|
+
return props.isLeaf ? props.theme.colors.grey6 : props.theme.colors.grey5;
|
|
53
|
+
}};
|
|
54
|
+
`;
|
|
55
|
+
export const CircleIcon = styled(Circle) `
|
|
56
|
+
width: 0.5rem;
|
|
57
|
+
height: 0.5rem;
|
|
58
|
+
margin-right: 0.4rem;
|
|
59
|
+
|
|
60
|
+
color: ${(props) => (props.selected ? props.theme.colors.primary : props.theme.colors.grey6)};
|
|
61
|
+
vertical-align: middle;
|
|
62
|
+
`;
|
|
63
|
+
const grow = keyframes `
|
|
64
|
+
0% {
|
|
65
|
+
transform: scaleY(0);
|
|
66
|
+
opacity: 0;
|
|
67
|
+
}
|
|
68
|
+
100% {
|
|
69
|
+
transform: scaleY(1);
|
|
70
|
+
opacity: 1;
|
|
71
|
+
}
|
|
72
|
+
`;
|
|
73
|
+
const contract = keyframes `
|
|
74
|
+
100% {
|
|
75
|
+
transform: scaleY(1);
|
|
76
|
+
opacity: 1;
|
|
77
|
+
}
|
|
78
|
+
0% {
|
|
79
|
+
transform: scaleY(0);
|
|
80
|
+
opacity: 0;
|
|
81
|
+
}
|
|
82
|
+
`;
|
|
83
|
+
export const NodeWrapper = styled.ul `
|
|
84
|
+
transform-origin: top center;
|
|
85
|
+
|
|
86
|
+
display: ${(props) => (props.open ? 'block' : 'none')};
|
|
87
|
+
|
|
88
|
+
margin: 0;
|
|
89
|
+
margin-left: 1rem;
|
|
90
|
+
padding: 0;
|
|
91
|
+
padding-bottom: 1rem;
|
|
92
|
+
|
|
93
|
+
list-style: none;
|
|
94
|
+
|
|
95
|
+
animation: ${(props) => props.open
|
|
96
|
+
? css `
|
|
97
|
+
${grow} 300ms ease-out forwards
|
|
98
|
+
`
|
|
99
|
+
: css `
|
|
100
|
+
${contract} 300ms ease-in forwards
|
|
101
|
+
`};
|
|
102
|
+
`;
|
|
103
|
+
/**
|
|
104
|
+
* The Branch Component renders each branch of the tree and then recursively renders all the child branches by calling
|
|
105
|
+
* itself again.
|
|
106
|
+
*
|
|
107
|
+
* @param {BranchProps} props - the component props
|
|
108
|
+
*/
|
|
109
|
+
function Branch(props) {
|
|
110
|
+
const theme = useTheme();
|
|
111
|
+
const [open, setOpen] = useState(props.open || false);
|
|
112
|
+
const toggle = () => {
|
|
113
|
+
if (props.content)
|
|
114
|
+
setOpen(!open);
|
|
115
|
+
};
|
|
116
|
+
const select = () => {
|
|
117
|
+
props.selectNode(props.content.id);
|
|
118
|
+
};
|
|
119
|
+
const selectionAllowed = (props.allowSelectCategory && props.content.children && props.content.children.length > 0) ||
|
|
120
|
+
(props.allowSelectLeaf && (!props.content.children || props.content.children.length === 0));
|
|
121
|
+
return (_jsxs(NodeContent, { className: props.className, style: props.style, children: [_jsx(CircleIcon, { selected: props.content.id === props.selectedNodeId }), _jsx(Cell, { isLeaf: !props.content.children || props.content.children.length === 0, onClick: selectionAllowed ? select : toggle, selected: props.content.id === props.selectedNodeId, selectionAllowed: selectionAllowed, children: props.content.label }), props.content.children && props.content.children.length > 0 && (_jsx(Chevron, { isOpen: open, onClick: toggle, style: {
|
|
122
|
+
color: theme.colors.grey5,
|
|
123
|
+
cursor: 'pointer',
|
|
124
|
+
height: '0.8rem',
|
|
125
|
+
marginLeft: '0.5rem',
|
|
126
|
+
verticalAlign: 'middle',
|
|
127
|
+
width: '0.8rem',
|
|
128
|
+
} })), _jsx(NodeWrapper, { open: open, children: props.content.children &&
|
|
129
|
+
props.content.children.length > 0 &&
|
|
130
|
+
props.content.children.map((nodeObj) => (_jsx(Branch, { allowSelectCategory: props.allowSelectCategory, allowSelectLeaf: props.allowSelectLeaf, content: nodeObj, selectCategory: props.selectCategory, selectNode: props.selectNode, selectedNodeId: props.selectedNodeId }, nodeObj.id))) })] }));
|
|
131
|
+
}
|
|
132
|
+
export default Branch;
|
|
133
|
+
//# sourceMappingURL=branch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branch.js","sourceRoot":"","sources":["../../../src/hierarchy-selector/node/branch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AE,IAAI,YAClB,KAAK,CAAC,OAAO,CAAC,QAAQ;oBACnB,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;oBACjC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CACpC,KAAC,MAAM,IACH,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,EAC9C,eAAe,EAAE,KAAK,CAAC,eAAe,EACtC,OAAO,EAAE,OAAO,EAEhB,cAAc,EAAE,KAAK,CAAC,cAAc,EACpC,UAAU,EAAE,KAAK,CAAC,UAAU,EAC5B,cAAc,EAAE,KAAK,CAAC,cAAc,IAH/B,OAAO,CAAC,EAAE,CAIjB,CACL,CAAC,GACI,IACJ,CACjB,CAAC;AACN,CAAC;AAED,eAAe,MAAM,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023 Impulse Innovations Limited
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export { Key, CONTROL_KEYS } from './constants';
|
|
18
|
+
export { AccordionItemType, JSONData, Item, ComponentSelectItem, InteractiveComponentProps, CarouselItem, } from './types';
|
|
19
|
+
export { default as Accordion } from './accordion/accordion';
|
|
20
|
+
export { default as Badge } from './badge/badge';
|
|
21
|
+
export { default as Button } from './button/button';
|
|
22
|
+
export { default as ButtonBar } from './button-bar/button-bar';
|
|
23
|
+
export { default as Carousel } from './carousel/carousel';
|
|
24
|
+
export { default as CategoricalFilter } from './filter/categorical-filter';
|
|
25
|
+
export { default as Checkbox } from './checkbox/checkbox';
|
|
26
|
+
export { default as CheckboxGroup } from './checkbox/checkbox-group';
|
|
27
|
+
export { default as ComboBox } from './combo-box/combo-box';
|
|
28
|
+
export { default as ContextMenu, MenuAction } from './context-menu/context-menu';
|
|
29
|
+
export { default as DatePicker } from './datepicker/datepicker';
|
|
30
|
+
export { default as UploadDropzone } from './dropzone/dropzone';
|
|
31
|
+
export { default as ErrorBoundary } from './error-boundary/error-boundary';
|
|
32
|
+
export { default as HierarchySelector, HierarchyNode } from './hierarchy-selector/hierarchy-selector';
|
|
33
|
+
export { default as Input } from './input/input';
|
|
34
|
+
export { InputProps } from './input/input';
|
|
35
|
+
export { default as Modal, ModalFooter, ModalHeader } from './modal/modal';
|
|
36
|
+
export { default as MultiSelect } from './multiselect/multiselect';
|
|
37
|
+
export { default as NumericFilter } from './filter/numeric-filter';
|
|
38
|
+
export { default as NumericInput } from './numeric-input/numeric-input';
|
|
39
|
+
export { default as ComponentSelectList } from './component-select-list/component-select-list';
|
|
40
|
+
export { default as ProgressBar } from './progress-bar/progress-bar';
|
|
41
|
+
export { default as RadioGroup } from './radio/radio-group';
|
|
42
|
+
export { default as SeachBar } from './search-bar/search-bar';
|
|
43
|
+
export { default as SectionedList, ListItem, ListSection } from './sectioned-list/sectioned-list';
|
|
44
|
+
export { default as Select } from './select/select';
|
|
45
|
+
export { CategoricalSlider, Slider } from './slider/slider';
|
|
46
|
+
export { default as Spinner } from './spinner/spinner';
|
|
47
|
+
export { default as Switch } from './switch/switch';
|
|
48
|
+
export { default as Table, TableAction } from './table/table';
|
|
49
|
+
export { default as Tabs } from './tabs/tabs';
|
|
50
|
+
export { default as Textarea } from './textarea/textarea';
|
|
51
|
+
export { default as Tooltip } from './tooltip/tooltip';
|
|
52
|
+
export { default as TriStateCheckbox } from './checkbox/tri-state-checkbox';
|
|
53
|
+
export { Chevron, SubtleLabel, useInfiniteLoader, InfiniteLoader } from './utils';
|
|
54
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EACH,iBAAiB,EACjB,QAAQ,EACR,IAAI,EACJ,mBAAmB,EACnB,yBAAyB,EACzB,YAAY,GACf,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACjF,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE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,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023 Impulse Innovations Limited
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export { Key, CONTROL_KEYS } from './constants';
|
|
18
|
+
export { default as Accordion } from './accordion/accordion';
|
|
19
|
+
export { default as Badge } from './badge/badge';
|
|
20
|
+
export { default as Button } from './button/button';
|
|
21
|
+
export { default as ButtonBar } from './button-bar/button-bar';
|
|
22
|
+
export { default as Carousel } from './carousel/carousel';
|
|
23
|
+
export { default as CategoricalFilter } from './filter/categorical-filter';
|
|
24
|
+
export { default as Checkbox } from './checkbox/checkbox';
|
|
25
|
+
export { default as CheckboxGroup } from './checkbox/checkbox-group';
|
|
26
|
+
export { default as ComboBox } from './combo-box/combo-box';
|
|
27
|
+
export { default as ContextMenu } from './context-menu/context-menu';
|
|
28
|
+
export { default as DatePicker } from './datepicker/datepicker';
|
|
29
|
+
export { default as UploadDropzone } from './dropzone/dropzone';
|
|
30
|
+
export { default as ErrorBoundary } from './error-boundary/error-boundary';
|
|
31
|
+
export { default as HierarchySelector } from './hierarchy-selector/hierarchy-selector';
|
|
32
|
+
export { default as Input } from './input/input';
|
|
33
|
+
export { default as Modal, ModalFooter, ModalHeader } from './modal/modal';
|
|
34
|
+
export { default as MultiSelect } from './multiselect/multiselect';
|
|
35
|
+
export { default as NumericFilter } from './filter/numeric-filter';
|
|
36
|
+
export { default as NumericInput } from './numeric-input/numeric-input';
|
|
37
|
+
export { default as ComponentSelectList } from './component-select-list/component-select-list';
|
|
38
|
+
export { default as ProgressBar } from './progress-bar/progress-bar';
|
|
39
|
+
export { default as RadioGroup } from './radio/radio-group';
|
|
40
|
+
export { default as SeachBar } from './search-bar/search-bar';
|
|
41
|
+
export { default as SectionedList } from './sectioned-list/sectioned-list';
|
|
42
|
+
export { default as Select } from './select/select';
|
|
43
|
+
export { CategoricalSlider, Slider } from './slider/slider';
|
|
44
|
+
export { default as Spinner } from './spinner/spinner';
|
|
45
|
+
export { default as Switch } from './switch/switch';
|
|
46
|
+
export { default as Table, TableAction } from './table/table';
|
|
47
|
+
export { default as Tabs } from './tabs/tabs';
|
|
48
|
+
export { default as Textarea } from './textarea/textarea';
|
|
49
|
+
export { default as Tooltip } from './tooltip/tooltip';
|
|
50
|
+
export { default as TriStateCheckbox } from './checkbox/tri-state-checkbox';
|
|
51
|
+
export { Chevron, SubtleLabel, useInfiniteLoader } from './utils';
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAUhD,OAAO,EAAE,OAAO,IAAI,SAAS,EA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MAAM,+CAA+C,CAAC;AAC/F,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAyB,MAAM,iCAAiC,CAAC;AAClG,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAkB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023 Impulse Innovations Limited
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import * as React from 'react';
|
|
18
|
+
import { InteractiveComponentProps } from '../types';
|
|
19
|
+
export declare const ErrorMessage: import("styled-components").StyledComponent<"span", import("@darajs/styled-components").DefaultTheme, {}, never>;
|
|
20
|
+
export interface InputProps extends InteractiveComponentProps<string> {
|
|
21
|
+
/** An optional prop to focus the input upon mounting it */
|
|
22
|
+
autoFocus?: boolean;
|
|
23
|
+
/** An optional keydown event filter, that can filter out invalid chars from an input. Should return true to let
|
|
24
|
+
* the char through */
|
|
25
|
+
keydownFilter?: (e: React.KeyboardEvent<HTMLInputElement>) => boolean;
|
|
26
|
+
/** An optional maximum length */
|
|
27
|
+
maxLength?: number;
|
|
28
|
+
/** An optional value to put in the input to check for maximum value */
|
|
29
|
+
maxValue?: any;
|
|
30
|
+
/** An optional value to put in the input to check for minimum value */
|
|
31
|
+
minValue?: any;
|
|
32
|
+
/** An optional onBlur handler for listening to input blur events */
|
|
33
|
+
onBlur?: (e: React.SyntheticEvent<HTMLInputElement>) => void | Promise<void>;
|
|
34
|
+
/** An optional onChange handler for listening to changes in the input */
|
|
35
|
+
onChange?: (value: string, e?: React.SyntheticEvent<HTMLInputElement>) => void | Promise<void>;
|
|
36
|
+
/** An optional onClick handler for listening to input click events */
|
|
37
|
+
onClick?: (e: React.SyntheticEvent<HTMLInputElement>) => void | Promise<void>;
|
|
38
|
+
/** An optional event listener for complete events (enter presses) */
|
|
39
|
+
onComplete?: () => void | Promise<void>;
|
|
40
|
+
/** An optional handler for listening to key down events */
|
|
41
|
+
onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void | Promise<void>;
|
|
42
|
+
/** An optional placeholder that will be used when the input is empty, defaults to '' */
|
|
43
|
+
placeholder?: string;
|
|
44
|
+
/** Input type attribute */
|
|
45
|
+
type?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A simple text input component, accepts an onChange handler to listen for changes.
|
|
49
|
+
*
|
|
50
|
+
* Note: this needs to be a const forwardRef rather than a separate function wrapped
|
|
51
|
+
* in a forwardRef in export statement as this does not work with Storybook
|
|
52
|
+
*
|
|
53
|
+
* @param props - the component props
|
|
54
|
+
* @param ref - forward ref that's attached to underlying input element
|
|
55
|
+
*/
|
|
56
|
+
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
57
|
+
export default Input;
|
|
58
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/input/input.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAiDrD,eAAO,MAAM,YAAY,kHAIxB,CAAC;AAEF,MAAM,WAAW,UAAW,SAAQ,yBAAyB,CAAC,MAAM,CAAC;IACjE,2DAA2D;IAC3D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;0BACsB;IACtB,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,KAAK,OAAO,CAAC;IACtE,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,uEAAuE;IACvE,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,oEAAoE;IACpE,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7E,yEAAyE;IACzE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/F,sEAAsE;IACtE,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9E,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,2DAA2D;IAC3D,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/E,wFAAwF;IACxF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2BAA2B;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,QAAA,MAAM,KAAK,qFAmDV,CAAC;AAGF,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
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 { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { forwardRef } from 'react';
|
|
14
|
+
import styled from '@darajs/styled-components';
|
|
15
|
+
import { Key } from '../constants';
|
|
16
|
+
const PrimaryInput = styled.input `
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
padding: 0 1rem;
|
|
23
|
+
|
|
24
|
+
font-size: 1rem;
|
|
25
|
+
color: ${(props) => (props.disabled ? props.theme.colors.grey2 : props.theme.colors.text)};
|
|
26
|
+
|
|
27
|
+
background-color: ${(props) => props.theme.colors.grey1};
|
|
28
|
+
border: 1px solid
|
|
29
|
+
${(props) => {
|
|
30
|
+
return props.isErrored ? props.theme.colors.error : props.theme.colors.grey1;
|
|
31
|
+
}};
|
|
32
|
+
border-radius: 0.25rem;
|
|
33
|
+
outline: 0;
|
|
34
|
+
|
|
35
|
+
:active:not(:disabled),
|
|
36
|
+
:focus:not(:disabled) {
|
|
37
|
+
border: 1px solid ${(props) => (props.isErrored ? props.theme.colors.error : props.theme.colors.grey3)};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
:hover:not(:disabled) {
|
|
41
|
+
background-color: ${(props) => props.theme.colors.grey2};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
:disabled {
|
|
45
|
+
cursor: not-allowed;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
::placeholder {
|
|
49
|
+
font-style: italic;
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
52
|
+
const InputWrapper = styled.div `
|
|
53
|
+
width: 22ch;
|
|
54
|
+
max-width: 100%;
|
|
55
|
+
height: 2.5rem;
|
|
56
|
+
`;
|
|
57
|
+
export const ErrorMessage = styled.span `
|
|
58
|
+
margin-left: 1rem;
|
|
59
|
+
font-size: 0.75rem;
|
|
60
|
+
color: ${(props) => props.theme.colors.error};
|
|
61
|
+
`;
|
|
62
|
+
/**
|
|
63
|
+
* A simple text input component, accepts an onChange handler to listen for changes.
|
|
64
|
+
*
|
|
65
|
+
* Note: this needs to be a const forwardRef rather than a separate function wrapped
|
|
66
|
+
* in a forwardRef in export statement as this does not work with Storybook
|
|
67
|
+
*
|
|
68
|
+
* @param props - the component props
|
|
69
|
+
* @param ref - forward ref that's attached to underlying input element
|
|
70
|
+
*/
|
|
71
|
+
const Input = forwardRef((_a, ref) => {
|
|
72
|
+
var { type = 'text' } = _a, props = __rest(_a, ["type"]);
|
|
73
|
+
const onChange = (e) => {
|
|
74
|
+
const target = e.target;
|
|
75
|
+
if (props.onChange) {
|
|
76
|
+
props.onChange(target.value, e);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const onKeyDown = (e) => {
|
|
80
|
+
if (props.onKeyDown)
|
|
81
|
+
props.onKeyDown(e);
|
|
82
|
+
if (props.keydownFilter && !props.keydownFilter(e)) {
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
}
|
|
85
|
+
if (e.key === Key.ENTER && props.onComplete) {
|
|
86
|
+
props.onComplete();
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
// Add all optional items here to be used by the primary input
|
|
90
|
+
const addOptionalItems = () => {
|
|
91
|
+
const result = {};
|
|
92
|
+
if (props.minValue)
|
|
93
|
+
result.minValue = props.minValue;
|
|
94
|
+
if (props.maxValue)
|
|
95
|
+
result.maxValue = props.minValue;
|
|
96
|
+
return result;
|
|
97
|
+
};
|
|
98
|
+
return (_jsxs(InputWrapper, { className: props.className, style: props.style, children: [_jsx(PrimaryInput, Object.assign({ autoFocus: props.autoFocus, defaultValue: props.initialValue, disabled: props.disabled, isErrored: !!props.errorMsg, maxLength: props.maxLength, onBlur: props.onBlur, onChange: onChange, onClick: props.onClick, onKeyDown: onKeyDown, placeholder: props.placeholder, ref: ref, type: type, value: props.value }, addOptionalItems())), props.errorMsg && _jsxs(ErrorMessage, { children: [props.errorMsg, " "] })] }));
|
|
99
|
+
});
|
|
100
|
+
Input.displayName = 'Input';
|
|
101
|
+
export default Input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,MAAC,YAAY,IAAC,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,aACxD,KAAC,YAAY,kBACT,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,EAC3B,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,CAAC,KAAK,IACd,gBAAgB,EAAE,EACxB,EACD,KAAK,CAAC,QAAQ,IAAI,MAAC,YAAY,eAAE,KAAK,CAAC,QAAQ,SAAiB,IACtD,CAClB,CAAC;AACN,CAAC,CACJ,CAAC;AACF,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC;AAE5B,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023 Impulse Innovations Limited
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import '@testing-library/jest-dom';
|
|
18
|
+
//# sourceMappingURL=jest-setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jest-setup.d.ts","sourceRoot":"","sources":["../src/jest-setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023 Impulse Innovations Limited
|
|
3
|
+
*
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import '@testing-library/jest-dom';
|
|
18
|
+
//# sourceMappingURL=jest-setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jest-setup.js","sourceRoot":"","sources":["../src/jest-setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/** Modal footer component, that arranges the buttons to each side and adds space around them */
|
|
3
|
+
declare const ModalFooter: import("styled-components").StyledComponent<"div", import("@darajs/styled-components").DefaultTheme, {}, never>;
|
|
4
|
+
interface ModalHeaderProps {
|
|
5
|
+
flexDirection?: string;
|
|
6
|
+
}
|
|
7
|
+
/** Arranges the modal header and adds some space below it */
|
|
8
|
+
declare const ModalHeader: import("styled-components").StyledComponent<"div", import("@darajs/styled-components").DefaultTheme, ModalHeaderProps, never>;
|
|
9
|
+
export interface ModalProps {
|
|
10
|
+
/** The content of the modal should be passed as children */
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
/** Standard react className property */
|
|
13
|
+
className?: string;
|
|
14
|
+
/** Component Id */
|
|
15
|
+
id?: string;
|
|
16
|
+
/**
|
|
17
|
+
* An optional event listener for if an external event (e.g. esc key) tries to close the modal, it's up to the
|
|
18
|
+
* parent component to decide whether to close the modal
|
|
19
|
+
*/
|
|
20
|
+
onAttemptClose?: () => void | Promise<void>;
|
|
21
|
+
/** Handler that's called when the modal has finished closing and has unmounted */
|
|
22
|
+
onClosed?: () => void | Promise<void>;
|
|
23
|
+
/** Whether to render the modal content or not */
|
|
24
|
+
render: boolean;
|
|
25
|
+
/** Native react style property */
|
|
26
|
+
style?: React.CSSProperties;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A simple modal component, accepts children and a render property. It handles attaching the modal to the body of the
|
|
30
|
+
* document and transitioning it in and out of view as required
|
|
31
|
+
*
|
|
32
|
+
* @param {ModalProps} props - the component props
|
|
33
|
+
*/
|
|
34
|
+
declare function Modal(props: ModalProps): JSX.Element;
|
|
35
|
+
export default Modal;
|
|
36
|
+
export { ModalFooter, ModalHeader };
|
|
37
|
+
//# sourceMappingURL=modal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../src/modal/modal.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAmD/B,gGAAgG;AAChG,QAAA,MAAM,WAAW,iHAKhB,CAAC;AAEF,UAAU,gBAAgB;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,6DAA6D;AAC7D,QAAA,MAAM,WAAW,+HAOhB,CAAC;AAEF,MAAM,WAAW,UAAU;IACvB,4DAA4D;IAC5D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,kFAAkF;IAClF,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,iDAAiD;IACjD,MAAM,EAAE,OAAO,CAAC;IAChB,kCAAkC;IAClC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC/B;AAED;;;;;GAKG;AACH,iBAAS,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,GAAG,CAAC,OAAO,CAoD7C;AAED,eAAe,KAAK,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright 2023 Impulse Innovations Limited
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { useEffect, useState } from 'react';
|
|
19
|
+
import ReactDOM from 'react-dom';
|
|
20
|
+
import styled from '@darajs/styled-components';
|
|
21
|
+
import { Key } from '../constants';
|
|
22
|
+
const Background = styled.div `
|
|
23
|
+
position: fixed;
|
|
24
|
+
z-index: 2000;
|
|
25
|
+
top: 0;
|
|
26
|
+
left: 0;
|
|
27
|
+
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
|
|
32
|
+
width: 100%;
|
|
33
|
+
height: 100%;
|
|
34
|
+
|
|
35
|
+
opacity: ${(props) => (props.render ? 1 : 0)};
|
|
36
|
+
background-color: ${(props) => props.theme.colors.modalBg};
|
|
37
|
+
|
|
38
|
+
transition: opacity ease-in 0.1s;
|
|
39
|
+
`;
|
|
40
|
+
const ModalWrapper = styled.div `
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
display: inline-flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
|
|
45
|
+
min-width: 20rem;
|
|
46
|
+
max-width: 80vw;
|
|
47
|
+
min-height: 10rem;
|
|
48
|
+
max-height: 80vh;
|
|
49
|
+
margin-top: ${(props) => (props.render ? 0 : '-50px')};
|
|
50
|
+
padding: 1.75rem;
|
|
51
|
+
|
|
52
|
+
font-size: ${(props) => props.theme.font.size};
|
|
53
|
+
|
|
54
|
+
background-color: ${(props) => props.theme.colors.grey1};
|
|
55
|
+
border-radius: 0.25rem;
|
|
56
|
+
box-shadow: ${(props) => props.theme.shadow.medium};
|
|
57
|
+
|
|
58
|
+
transition: margin-top ease-in 0.1s;
|
|
59
|
+
`;
|
|
60
|
+
/** Modal footer component, that arranges the buttons to each side and adds space around them */
|
|
61
|
+
const ModalFooter = styled.div `
|
|
62
|
+
display: flex;
|
|
63
|
+
flex: 0 0 auto;
|
|
64
|
+
justify-content: space-between;
|
|
65
|
+
margin-top: 1rem;
|
|
66
|
+
`;
|
|
67
|
+
/** Arranges the modal header and adds some space below it */
|
|
68
|
+
const ModalHeader = styled.div `
|
|
69
|
+
display: flex;
|
|
70
|
+
flex: 0 0 auto;
|
|
71
|
+
flex-direction: ${(props) => props.flexDirection || 'column'};
|
|
72
|
+
justify-content: space-between;
|
|
73
|
+
|
|
74
|
+
margin-bottom: 1rem;
|
|
75
|
+
`;
|
|
76
|
+
/**
|
|
77
|
+
* A simple modal component, accepts children and a render property. It handles attaching the modal to the body of the
|
|
78
|
+
* document and transitioning it in and out of view as required
|
|
79
|
+
*
|
|
80
|
+
* @param {ModalProps} props - the component props
|
|
81
|
+
*/
|
|
82
|
+
function Modal(props) {
|
|
83
|
+
var _a;
|
|
84
|
+
const [mounted, setMounted] = useState(false);
|
|
85
|
+
const [renderModal, setRenderModal] = useState(false);
|
|
86
|
+
// Internal state is updated using the useEffect to delay it to the next tick. This allows for the components css
|
|
87
|
+
// animations to work correctly
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
setRenderModal(props.render);
|
|
90
|
+
}, [props.render]);
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
if (renderModal) {
|
|
93
|
+
const keyHandler = (e) => {
|
|
94
|
+
if (e.key === Key.ESCAPE && props.onAttemptClose) {
|
|
95
|
+
props.onAttemptClose();
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
document.addEventListener('keydown', keyHandler);
|
|
99
|
+
return () => {
|
|
100
|
+
document.removeEventListener('keydown', keyHandler);
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}, [renderModal]);
|
|
104
|
+
if (!props.render && !mounted) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
const onTransitionEnd = () => {
|
|
108
|
+
setMounted(props.render);
|
|
109
|
+
if (!props.render && props.onClosed) {
|
|
110
|
+
props.onClosed();
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const stopPropagation = (e) => {
|
|
114
|
+
e.stopPropagation();
|
|
115
|
+
};
|
|
116
|
+
return ReactDOM.createPortal(_jsx(Background, { id: props.id, onClick: props.onAttemptClose, onTransitionEnd: onTransitionEnd, render: renderModal, children: _jsx(ModalWrapper, { className: `cl-modal-content ${(_a = props.className) !== null && _a !== void 0 ? _a : ''}`, onClick: stopPropagation, render: renderModal, style: props.style, children: props.children }) }), document.body);
|
|
117
|
+
}
|
|
118
|
+
export default Modal;
|
|
119
|
+
export { ModalFooter, ModalHeader };
|
|
120
|
+
//# sourceMappingURL=modal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modal.js","sourceRoot":"","sources":["../../src/modal/modal.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,QAAQ,MAAM,WAAW,CAAC;AAEjC,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAE/C,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAMnC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAY;;;;;;;;;;;;;eAa1B,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;wBACxB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO;;;CAG5D,CAAC;AAEF,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAY;;;;;;;;;kBASzB,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;;;iBAGxC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI;;wBAEzB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK;;kBAEzC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM;;;CAGrD,CAAC;AAEF,gGAAgG;AAChG,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