@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,208 @@
|
|
|
1
|
+
import { createElement as _createElement } from "react";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Copyright 2023 Impulse Innovations Limited
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
import { useCombobox } from 'downshift';
|
|
20
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
21
|
+
import ReactDOM from 'react-dom';
|
|
22
|
+
import { usePopper } from 'react-popper';
|
|
23
|
+
import styled, { useTheme } from '@darajs/styled-components';
|
|
24
|
+
import Badge from '../badge/badge';
|
|
25
|
+
import { ChevronButton, Input, InputWrapper, NoItemsLabel, Wrapper } from '../combo-box/combo-box';
|
|
26
|
+
import { Chevron, List, ListItem, sameWidthModifier } from '../utils';
|
|
27
|
+
const { stateChangeTypes } = useCombobox;
|
|
28
|
+
const ListWrapper = styled(List) `
|
|
29
|
+
margin-left: -1px;
|
|
30
|
+
border-radius: 0px 0px 0.25rem 0.25rem;
|
|
31
|
+
box-shadow: ${(props) => props.theme.shadow.light};
|
|
32
|
+
`;
|
|
33
|
+
const getTextColor = (heading, selected, theme) => {
|
|
34
|
+
if (heading) {
|
|
35
|
+
return theme.colors.text;
|
|
36
|
+
}
|
|
37
|
+
if (selected) {
|
|
38
|
+
return theme.colors.primary;
|
|
39
|
+
}
|
|
40
|
+
return theme.colors.text;
|
|
41
|
+
};
|
|
42
|
+
const ListItemSpan = styled(ListItem) `
|
|
43
|
+
cursor: ${(props) => ((props === null || props === void 0 ? void 0 : props.heading) ? 'text' : 'pointer')};
|
|
44
|
+
user-select: ${(props) => ((props === null || props === void 0 ? void 0 : props.heading) ? 'text' : 'none')};
|
|
45
|
+
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
justify-content: space-between;
|
|
49
|
+
|
|
50
|
+
padding: ${(props) => ((props === null || props === void 0 ? void 0 : props.heading) || !props.section ? '0 0.7rem' : '0 1.5rem')};
|
|
51
|
+
padding-right: 0.7rem;
|
|
52
|
+
|
|
53
|
+
font-weight: ${(props) => ((props === null || props === void 0 ? void 0 : props.heading) ? 'bold' : 'normal')};
|
|
54
|
+
color: ${(props) => getTextColor(props === null || props === void 0 ? void 0 : props.heading, props.selected, props.theme)};
|
|
55
|
+
|
|
56
|
+
${(props) => {
|
|
57
|
+
if (props.heading) {
|
|
58
|
+
return `
|
|
59
|
+
:hover {
|
|
60
|
+
background-color: ${props.theme.colors.background};
|
|
61
|
+
color: ${props.theme.colors.text};
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
}
|
|
65
|
+
}}
|
|
66
|
+
`;
|
|
67
|
+
function instanceOfSectionItem(item) {
|
|
68
|
+
return 'items' in item;
|
|
69
|
+
}
|
|
70
|
+
function unpackSectionedList(listItems) {
|
|
71
|
+
return listItems.reduce((acc, item) => {
|
|
72
|
+
if (instanceOfSectionItem(item)) {
|
|
73
|
+
const sectionHeading = { heading: true, label: item.label, value: item.label };
|
|
74
|
+
const sectionItems = item.items.map((sectionItem) => (Object.assign(Object.assign({}, sectionItem), { section: item.label })));
|
|
75
|
+
return [...acc, sectionHeading, ...sectionItems];
|
|
76
|
+
}
|
|
77
|
+
return [...acc, item];
|
|
78
|
+
}, []);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* A component for rendering lists, sectioned and non-sectioned. Takes an array of unpacked ListItem objects and
|
|
82
|
+
* renders a searchable list.
|
|
83
|
+
*
|
|
84
|
+
* @param {SectionedListProps} props - the component props
|
|
85
|
+
*/
|
|
86
|
+
function SectionedList(props) {
|
|
87
|
+
var _a, _b, _c, _d;
|
|
88
|
+
const theme = useTheme();
|
|
89
|
+
const referenceElement = useRef(null);
|
|
90
|
+
const popperElement = useRef(null);
|
|
91
|
+
const { styles, attributes, update } = usePopper(referenceElement.current, popperElement.current, {
|
|
92
|
+
modifiers: [sameWidthModifier],
|
|
93
|
+
placement: 'bottom-start',
|
|
94
|
+
});
|
|
95
|
+
const unpackedItems = useMemo(() => unpackSectionedList(props.items), [props.items]);
|
|
96
|
+
const [pendingHighlight, setPendingHighlight] = useState(null);
|
|
97
|
+
const [items, setItems] = useState(unpackedItems);
|
|
98
|
+
const [inputValue, setInputValue] = useState((_b = (_a = props.selectedItem) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : '');
|
|
99
|
+
const { selectedItem, isOpen, getMenuProps, getInputProps, getToggleButtonProps, highlightedIndex, getItemProps, setHighlightedIndex, } = useCombobox(Object.assign({ initialIsOpen: false, initialSelectedItem: (_c = props.initialValue) !== null && _c !== void 0 ? _c : props.selectedItem, itemToString: (item) => (item ? item.label : ''), items, onInputValueChange: (change) => {
|
|
100
|
+
setInputValue(change.inputValue);
|
|
101
|
+
if (!change.inputValue) {
|
|
102
|
+
setItems(unpackedItems);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const counts = {};
|
|
106
|
+
const filteredItems = unpackedItems.filter((item) => {
|
|
107
|
+
const lowercaseInput = change.inputValue.toLowerCase();
|
|
108
|
+
const lowercaseLabel = item.label.toLowerCase();
|
|
109
|
+
// Check if search input matches section item
|
|
110
|
+
if (!item.heading && lowercaseLabel.includes(lowercaseInput)) {
|
|
111
|
+
counts[item.label] = counts[item.label] ? counts[item.label] + 1 : 1;
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
if (item.heading) {
|
|
115
|
+
// search for section headers that contain an item that matches the input
|
|
116
|
+
const listSections = props.items.filter((propItem) => propItem.items.find((subItem) => subItem.label.toLowerCase().includes(lowercaseInput)));
|
|
117
|
+
if (listSections.length) {
|
|
118
|
+
// display section headers that contain a matching item
|
|
119
|
+
listSections.forEach((section) => {
|
|
120
|
+
counts[section.label] = counts[section.label] ? counts[section.label] + 1 : 1;
|
|
121
|
+
});
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return false;
|
|
126
|
+
});
|
|
127
|
+
setItems(filteredItems.filter((item) => counts[item.label] > 0));
|
|
128
|
+
}, onSelectedItemChange: (changes) => {
|
|
129
|
+
var _a, _b;
|
|
130
|
+
if (props.onSelect) {
|
|
131
|
+
if ((props.selectedItem && ((_a = changes.selectedItem) === null || _a === void 0 ? void 0 : _a.value) !== ((_b = props.selectedItem) === null || _b === void 0 ? void 0 : _b.value)) ||
|
|
132
|
+
!props.selectedItem) {
|
|
133
|
+
props.onSelect(changes.selectedItem);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}, stateReducer: (state, { changes, type }) => {
|
|
137
|
+
var _a, _b, _c;
|
|
138
|
+
// When props is forcefully updated then clear the input as well
|
|
139
|
+
if (type === stateChangeTypes.ControlledPropUpdatedSelectedItem) {
|
|
140
|
+
return Object.assign(Object.assign({}, changes), { inputValue: '' });
|
|
141
|
+
}
|
|
142
|
+
// This resets the input when the dropdown is opened
|
|
143
|
+
if (type === stateChangeTypes.InputFocus ||
|
|
144
|
+
(type === stateChangeTypes.ToggleButtonClick && changes.isOpen)) {
|
|
145
|
+
// This is a hack to change the highlight in the next render cycle so filteredItems had time to update
|
|
146
|
+
setPendingHighlight(changes.selectedItem
|
|
147
|
+
? props.items.findIndex((i) => i.value === changes.selectedItem.value)
|
|
148
|
+
: 0);
|
|
149
|
+
return Object.assign(Object.assign({}, changes), { inputValue: '' });
|
|
150
|
+
}
|
|
151
|
+
// On item selection make sure the list doesn't filter down to just the selected item
|
|
152
|
+
if ([
|
|
153
|
+
stateChangeTypes.InputKeyDownEnter,
|
|
154
|
+
stateChangeTypes.ItemClick,
|
|
155
|
+
stateChangeTypes.InputBlur,
|
|
156
|
+
stateChangeTypes.InputKeyDownEscape,
|
|
157
|
+
stateChangeTypes.ToggleButtonClick,
|
|
158
|
+
].includes(type)) {
|
|
159
|
+
return Object.assign(Object.assign({}, changes), { inputValue: ((_a = changes.selectedItem) === null || _a === void 0 ? void 0 : _a.label) || '' });
|
|
160
|
+
}
|
|
161
|
+
// jump section headings when navigating with keys
|
|
162
|
+
if (type === stateChangeTypes.InputKeyDownArrowUp && ((_b = items[changes.highlightedIndex]) === null || _b === void 0 ? void 0 : _b.heading)) {
|
|
163
|
+
return Object.assign(Object.assign({}, changes), { highlightedIndex: changes.highlightedIndex - 1 < 0 ? items.length - 1 : changes.highlightedIndex - 1 });
|
|
164
|
+
}
|
|
165
|
+
if (type === stateChangeTypes.InputKeyDownArrowDown && ((_c = items[changes.highlightedIndex]) === null || _c === void 0 ? void 0 : _c.heading)) {
|
|
166
|
+
return Object.assign(Object.assign({}, changes), { highlightedIndex: changes.highlightedIndex + 1 === items.length ? 0 : changes.highlightedIndex + 1 });
|
|
167
|
+
}
|
|
168
|
+
return changes;
|
|
169
|
+
} }, ('selectedItem' in props && { selectedItem: props.selectedItem })));
|
|
170
|
+
useEffect(() => {
|
|
171
|
+
if (isOpen && pendingHighlight !== null) {
|
|
172
|
+
setHighlightedIndex(pendingHighlight);
|
|
173
|
+
setPendingHighlight(null);
|
|
174
|
+
}
|
|
175
|
+
}, [isOpen, pendingHighlight, setHighlightedIndex]);
|
|
176
|
+
useEffect(() => {
|
|
177
|
+
if (props.selectedItem === null) {
|
|
178
|
+
setInputValue('');
|
|
179
|
+
}
|
|
180
|
+
}, [props.selectedItem]);
|
|
181
|
+
// After the dropdown is opened, trigger an update of it's position, so it positions correctly.
|
|
182
|
+
useEffect(() => {
|
|
183
|
+
if (isOpen && update) {
|
|
184
|
+
update();
|
|
185
|
+
}
|
|
186
|
+
}, [isOpen, update]);
|
|
187
|
+
// Both downshift and popper want a ref to the reference element and popper element, the following blocks combine
|
|
188
|
+
// these refs into a single function that can be applied to the elements
|
|
189
|
+
const menuProps = getMenuProps();
|
|
190
|
+
const setMenuRef = menuProps.ref;
|
|
191
|
+
delete menuProps.ref;
|
|
192
|
+
const setMenuReference = (value) => {
|
|
193
|
+
setMenuRef(value);
|
|
194
|
+
popperElement.current = value;
|
|
195
|
+
};
|
|
196
|
+
return (_jsxs(Wrapper, { className: props.className, isDisabled: props.disabled, isErrored: false, isOpen: isOpen, style: props.style, children: [_jsxs(InputWrapper, { disabled: props.disabled, isOpen: isOpen, ref: referenceElement, children: [_jsx(Input, Object.assign({}, getInputProps({ value: inputValue }))), _jsx(ChevronButton, Object.assign({}, getToggleButtonProps(), { children: _jsx(Chevron, { disabled: props.disabled, isOpen: isOpen }) }))] }), ReactDOM.createPortal(_jsxs(ListWrapper, Object.assign({}, menuProps, attributes.popper, { isOpen: isOpen, ref: setMenuReference, style: Object.assign(Object.assign({}, styles.popper), { width: parseFloat((_d = styles.popper) === null || _d === void 0 ? void 0 : _d.width) + 2, zIndex: 9999 }), children: [items.length > 0 &&
|
|
197
|
+
items.map((item, index) => {
|
|
198
|
+
const itemProps = getItemProps({ index, item });
|
|
199
|
+
if (item.heading) {
|
|
200
|
+
delete itemProps.onClick;
|
|
201
|
+
}
|
|
202
|
+
return (_createElement(ListItemSpan, Object.assign({}, itemProps, { heading: item.heading, hovered: index === highlightedIndex, key: `item-${index}`, section: item.section, selected: item.value === (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.value), title: item.label }),
|
|
203
|
+
item.label || item.section,
|
|
204
|
+
item.badge && (_jsx(Badge, { color: item.badge.color || theme.colors.primary, children: item.badge.label }))));
|
|
205
|
+
}), items.length === 0 && _jsx(NoItemsLabel, { children: "No Items" })] })), document.body)] }));
|
|
206
|
+
}
|
|
207
|
+
export default SectionedList;
|
|
208
|
+
//# sourceMappingURL=sectioned-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sectioned-list.js","sourceRoot":"","sources":["../../src/sectioned-list/sectioned-list.tsx"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AC,KAAK,MAAK,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,KAAK,CAAA,EAC5C,KAAK,EAAE,IAAI,CAAC,KAAK;gCAEhB,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,OAAO;gCAC1B,IAAI,CAAC,KAAK,IAAI,CACX,KAAC,KAAK,IAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO,YACjD,IAAI,CAAC,KAAK,CAAC,KAAK,GACb,CACX,CACU,CAClB,CAAC;wBACN,CAAC,CAAC,EACL,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAC,YAAY,2BAAwB,KAClD,EACd,QAAQ,CAAC,IAAI,CAChB,IACK,CACb,CAAC;AACN,CAAC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -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
|
+
import { Placement } from '@popperjs/core';
|
|
18
|
+
import * as React from 'react';
|
|
19
|
+
import { InteractiveComponentProps, Item } from '../types';
|
|
20
|
+
export interface SelectProps extends InteractiveComponentProps<Item> {
|
|
21
|
+
/** Whether to force the list to the same width as the parent, defaults to true */
|
|
22
|
+
applySameWidthModifier?: boolean;
|
|
23
|
+
/** A function taking an element for the ref of the dropdown */
|
|
24
|
+
dropdownRef?: (element: any) => void;
|
|
25
|
+
/** Whether to open the select dropdown on load or not, defaults to false */
|
|
26
|
+
initialIsOpen?: boolean;
|
|
27
|
+
/** className property to put on the select's items and the item wrapper */
|
|
28
|
+
itemClass?: string;
|
|
29
|
+
/** The items to pick from the list. Each should have a label and a value */
|
|
30
|
+
items: Array<Item>;
|
|
31
|
+
/** The maximum number of items to display, defaults to 5 */
|
|
32
|
+
maxItems?: number;
|
|
33
|
+
/** onClick event. */
|
|
34
|
+
onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void | Promise<void>;
|
|
35
|
+
/** An optional onSelect handler for listening to changes in the selected item */
|
|
36
|
+
onSelect?: (item: Item) => void | Promise<void>;
|
|
37
|
+
/** An optional placeholder for the input field to display when nothing is selected, defaults to '' */
|
|
38
|
+
placeholder?: string;
|
|
39
|
+
/** Specify a specific placement for the list */
|
|
40
|
+
placement?: Placement;
|
|
41
|
+
/** Set the selected value to a specific value, will put the component in controlled mode. Set to `null` to reset the value */
|
|
42
|
+
selectedItem?: Item;
|
|
43
|
+
/** Font size in rem to show in the Select */
|
|
44
|
+
size?: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A single select dropdown component that has no search capability, accepts a list of items to select from and an
|
|
48
|
+
* onSelect handler to listen for changes in the selection
|
|
49
|
+
*
|
|
50
|
+
* @param {SelectProps} props - the props of the component
|
|
51
|
+
*/
|
|
52
|
+
declare function Select(props: SelectProps): JSX.Element;
|
|
53
|
+
export default Select;
|
|
54
|
+
//# sourceMappingURL=select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/select/select.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO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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 { createElement as _createElement } from "react";
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { useSelect } from 'downshift';
|
|
15
|
+
import { useEffect, useRef } from 'react';
|
|
16
|
+
import ReactDOM from 'react-dom';
|
|
17
|
+
import { usePopper } from 'react-popper';
|
|
18
|
+
import styled from '@darajs/styled-components';
|
|
19
|
+
import Tooltip from '../tooltip/tooltip';
|
|
20
|
+
import { Chevron, List, ListItem, sameWidthModifier } from '../utils';
|
|
21
|
+
const SelectedItem = styled.div `
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
|
|
24
|
+
/* The space available is that of the wrapper minus of the chevron */
|
|
25
|
+
width: calc(100% - 1rem);
|
|
26
|
+
margin-right: 0.5rem;
|
|
27
|
+
|
|
28
|
+
font-size: ${(props) => (props.size ? `${props.size}rem` : '1rem')};
|
|
29
|
+
font-weight: 300;
|
|
30
|
+
text-align: left;
|
|
31
|
+
text-overflow: ellipsis;
|
|
32
|
+
white-space: nowrap;
|
|
33
|
+
`;
|
|
34
|
+
const Wrapper = styled.div `
|
|
35
|
+
display: inline-flex;
|
|
36
|
+
|
|
37
|
+
width: 100%;
|
|
38
|
+
min-width: 4rem;
|
|
39
|
+
height: 2.5rem;
|
|
40
|
+
|
|
41
|
+
border-radius: ${(props) => (props.isOpen ? '0.25rem 0.25rem 0rem 0rem' : '0.25rem')};
|
|
42
|
+
|
|
43
|
+
${(props) => {
|
|
44
|
+
if (props.isDisabled) {
|
|
45
|
+
return `
|
|
46
|
+
border: 1px solid ${props.theme.colors.grey1};
|
|
47
|
+
cursor: not-allowed;
|
|
48
|
+
`;
|
|
49
|
+
}
|
|
50
|
+
if (props.isErrored) {
|
|
51
|
+
return `border: 1px solid ${props.theme.colors.error};`;
|
|
52
|
+
}
|
|
53
|
+
return `
|
|
54
|
+
border: 1px solid ${props.isOpen ? props.theme.colors.grey3 : props.theme.colors.grey1};
|
|
55
|
+
:hover {
|
|
56
|
+
border: 1px solid ${props.theme.colors.grey3};
|
|
57
|
+
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
60
|
+
}}
|
|
61
|
+
`;
|
|
62
|
+
const SelectButton = styled.button `
|
|
63
|
+
display: inline-flex;
|
|
64
|
+
flex: 1 1 auto;
|
|
65
|
+
align-items: center;
|
|
66
|
+
justify-content: space-between;
|
|
67
|
+
|
|
68
|
+
width: 100%;
|
|
69
|
+
height: 100%;
|
|
70
|
+
padding: 0 0.5rem 0rem 1rem;
|
|
71
|
+
|
|
72
|
+
font-size: 1rem;
|
|
73
|
+
color: ${(props) => props.theme.colors.text};
|
|
74
|
+
|
|
75
|
+
background-color: ${(props) => props.theme.colors.grey1};
|
|
76
|
+
border: none;
|
|
77
|
+
border-radius: ${(props) => (props.isOpen ? '0.25rem 0.25rem 0rem 0rem' : '0.25rem')};
|
|
78
|
+
outline: 0;
|
|
79
|
+
|
|
80
|
+
:not(:enabled) {
|
|
81
|
+
cursor: not-allowed;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
:disabled {
|
|
85
|
+
color: ${(props) => props.theme.colors.grey2};
|
|
86
|
+
background-color: ${(props) => props.theme.colors.grey1};
|
|
87
|
+
|
|
88
|
+
svg {
|
|
89
|
+
color: ${(props) => props.theme.colors.grey2};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
:hover:enabled {
|
|
94
|
+
background-color: ${(props) => props.theme.colors.grey2};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
svg {
|
|
98
|
+
width: 1rem !important;
|
|
99
|
+
height: 0.8rem;
|
|
100
|
+
}
|
|
101
|
+
`;
|
|
102
|
+
const DropdownList = styled(List) `
|
|
103
|
+
margin-left: -1px;
|
|
104
|
+
border-radius: 0px 0px 0.25rem 0.25rem;
|
|
105
|
+
outline: 0;
|
|
106
|
+
box-shadow: ${(props) => props.theme.shadow.light};
|
|
107
|
+
`;
|
|
108
|
+
/**
|
|
109
|
+
* A single select dropdown component that has no search capability, accepts a list of items to select from and an
|
|
110
|
+
* onSelect handler to listen for changes in the selection
|
|
111
|
+
*
|
|
112
|
+
* @param {SelectProps} props - the props of the component
|
|
113
|
+
*/
|
|
114
|
+
function Select(props) {
|
|
115
|
+
var _a, _b, _c, _d, _e, _f;
|
|
116
|
+
const referenceElement = useRef(null);
|
|
117
|
+
const popperElement = useRef(null);
|
|
118
|
+
const { styles, attributes, update } = usePopper(referenceElement.current, popperElement.current, {
|
|
119
|
+
modifiers: props.applySameWidthModifier === false ? [] : [sameWidthModifier],
|
|
120
|
+
placement: props.placement || 'bottom-start',
|
|
121
|
+
});
|
|
122
|
+
const { isOpen, selectedItem, getToggleButtonProps, getMenuProps, highlightedIndex, getItemProps } = useSelect(Object.assign({ initialIsOpen: props.initialIsOpen, initialSelectedItem: props.initialValue, itemToString: (item) => item.label, items: props.items, onSelectedItemChange: (changes) => {
|
|
123
|
+
var _a;
|
|
124
|
+
const selected = changes.selectedItem;
|
|
125
|
+
(_a = props.onSelect) === null || _a === void 0 ? void 0 : _a.call(props, selected);
|
|
126
|
+
} }, ('selectedItem' in props && { selectedItem: props.selectedItem })));
|
|
127
|
+
// After the dropdown is opened, trigger an update of it's position, so it positions correctly.
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
if (isOpen && update) {
|
|
130
|
+
update();
|
|
131
|
+
}
|
|
132
|
+
}, [isOpen, update]);
|
|
133
|
+
// Both downshift and popper want a ref to the reference element and popper element, the following blocks combine
|
|
134
|
+
// these refs into a single function that can be applied to the elements
|
|
135
|
+
const buttonProps = getToggleButtonProps({ disabled: props.disabled });
|
|
136
|
+
const setButtonRef = buttonProps.ref;
|
|
137
|
+
delete buttonProps.ref;
|
|
138
|
+
const setButtonReference = (value) => {
|
|
139
|
+
setButtonRef(value);
|
|
140
|
+
referenceElement.current = value;
|
|
141
|
+
};
|
|
142
|
+
const menuProps = getMenuProps();
|
|
143
|
+
const setMenuRef = menuProps.ref;
|
|
144
|
+
delete menuProps.ref;
|
|
145
|
+
const setMenuReference = (value) => {
|
|
146
|
+
var _a;
|
|
147
|
+
setMenuRef(value);
|
|
148
|
+
popperElement.current = value;
|
|
149
|
+
(_a = props.dropdownRef) === null || _a === void 0 ? void 0 : _a.call(props, value);
|
|
150
|
+
};
|
|
151
|
+
return (_jsx(Tooltip, { content: props.errorMsg, disabled: !props.errorMsg, styling: "error", children: _jsxs(Wrapper, { className: props.className, isDisabled: props.disabled, isErrored: !!props.errorMsg, isOpen: isOpen, onClick: props.onClick, style: props.style, children: [_jsxs(SelectButton, Object.assign({ disabled: props.disabled, isOpen: isOpen }, buttonProps, { ref: setButtonReference, type: "button", children: [_jsx(SelectedItem, { size: props.size, children: (_b = (_a = (selectedItem === null ? props.placeholder : selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.label)) !== null && _a !== void 0 ? _a : props.placeholder) !== null && _b !== void 0 ? _b : 'Select' }), _jsx(Chevron, { disabled: props.disabled, isOpen: isOpen })] })), ReactDOM.createPortal(_jsx(DropdownList, Object.assign({}, menuProps, attributes.popper, { className: `${(_c = menuProps === null || menuProps === void 0 ? void 0 : menuProps.className) !== null && _c !== void 0 ? _c : ''} ${(_e = (_d = attributes === null || attributes === void 0 ? void 0 : attributes.popper) === null || _d === void 0 ? void 0 : _d.className) !== null && _e !== void 0 ? _e : ''} ${props.itemClass}`, isOpen: isOpen, maxItems: props.maxItems, ref: setMenuReference, style: Object.assign(Object.assign({}, styles.popper), { width: props.applySameWidthModifier === false
|
|
152
|
+
? undefined
|
|
153
|
+
: parseFloat((_f = styles.popper) === null || _f === void 0 ? void 0 : _f.width) + 2, zIndex: 9999 }), children: props.items.map((item, index) => {
|
|
154
|
+
const _a = getItemProps({ index, item }), { itemClassName } = _a, itemProps = __rest(_a, ["itemClassName"]);
|
|
155
|
+
return (_createElement(ListItem, Object.assign({}, itemProps, { className: `${itemClassName} ${props.itemClass}`, hovered: index === highlightedIndex, key: `item-${index}`, size: props.size, title: item.label }), item.label));
|
|
156
|
+
}) })), document.body)] }) }));
|
|
157
|
+
}
|
|
158
|
+
export default Select;
|
|
159
|
+
//# sourceMappingURL=select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/select/select.tsx"],"names":[],"mappings":";;;;;;;;;;;;;AAiBA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAE/C,OAAO,OAAO,MAAM,oBAAoB,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAMtE,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAmB;;;;;;;iBAOjC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;;;;;CAKrE,CAAC;AAQF,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAc;;;;;;;qBAOnB,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,SAAS,CAAC;;MAElF,CAAC,KAAK,EA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,SAAS,EAAE,GAAG,aAAuB,IAAI,KAAK,CAAC,SAAS,EAAE,EAC1D,OAAO,EAAE,KAAK,KAAK,gBAAgB,EACnC,GAAG,EAAE,QAAQ,KAAK,EAAE,EACpB,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,KAAK,EAAE,IAAI,CAAC,KAAK,KAEhB,IAAI,CAAC,KAAK,CACJ,CACd,CAAC;oBACN,CAAC,CAAC,IACS,EACf,QAAQ,CAAC,IAAI,CAChB,IACK,GACJ,CACb,CAAC;AACN,CAAC;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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 { FunctionComponent } from 'react';
|
|
18
|
+
interface SliderInputsProps {
|
|
19
|
+
/** The domain defines the range of possible values that the slider can take */
|
|
20
|
+
domain: [number, number];
|
|
21
|
+
/** The error message callback for inputs when value is out of domain range */
|
|
22
|
+
getErrorMsg: (value: number, index: number) => string;
|
|
23
|
+
/** Slider Values state setter */
|
|
24
|
+
setSliderValues: React.Dispatch<React.SetStateAction<number[]>>;
|
|
25
|
+
/** Slider Values */
|
|
26
|
+
sliderValues: number[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The SliderInputs component displays the actual input values of the slider in a horizontal scrollable view
|
|
30
|
+
* that can be edited and have the changes reflected on the slider.
|
|
31
|
+
*
|
|
32
|
+
* @param {SliderInputsProps} props - the props for the component
|
|
33
|
+
*/
|
|
34
|
+
declare const SliderInputs: FunctionComponent<SliderInputsProps>;
|
|
35
|
+
export default SliderInputs;
|
|
36
|
+
//# sourceMappingURL=slider-inputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slider-inputs.d.ts","sourceRoot":"","sources":["../../src/slider/slider-inputs.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,iBAAiB,EAAuB,MAAM,OAAO,CAAC;AAgD/D,UAAU,iBAAiB;IACvB,+EAA+E;IAC/E,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,8EAA8E;IAC9E,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACtD,iCAAiC;IACjC,eAAe,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAChE,oBAAoB;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED;;;;;GAKG;AACH,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,CA0CtD,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
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 { useCallback, useRef } from 'react';
|
|
19
|
+
import styled from '@darajs/styled-components';
|
|
20
|
+
import { useIntersectionObserver } from '@darajs/ui-utils';
|
|
21
|
+
import NumericInput from '../numeric-input/numeric-input';
|
|
22
|
+
const InputWrapper = styled.div `
|
|
23
|
+
position: relative;
|
|
24
|
+
display: flex;
|
|
25
|
+
flex: 1 1 auto;
|
|
26
|
+
height: 3rem;
|
|
27
|
+
div {
|
|
28
|
+
flex: 1 1 auto;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
input {
|
|
32
|
+
height: 100%;
|
|
33
|
+
|
|
34
|
+
::before {
|
|
35
|
+
content: ' ';
|
|
36
|
+
|
|
37
|
+
position: sticky;
|
|
38
|
+
top: 0;
|
|
39
|
+
left: 0;
|
|
40
|
+
|
|
41
|
+
width: ${(props) => (!props.firstInputVisible ? '8px' : 0)};
|
|
42
|
+
height: 2.5rem;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
::after {
|
|
46
|
+
content: '';
|
|
47
|
+
|
|
48
|
+
position: sticky;
|
|
49
|
+
top: 0;
|
|
50
|
+
right: 0;
|
|
51
|
+
|
|
52
|
+
width: ${(props) => (!props.lastInputVisible ? '8px' : 0)};
|
|
53
|
+
height: 2.5rem;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
/**
|
|
58
|
+
* The SliderInputs component displays the actual input values of the slider in a horizontal scrollable view
|
|
59
|
+
* that can be edited and have the changes reflected on the slider.
|
|
60
|
+
*
|
|
61
|
+
* @param {SliderInputsProps} props - the props for the component
|
|
62
|
+
*/
|
|
63
|
+
const SliderInputs = ({ getErrorMsg, sliderValues, setSliderValues, domain, }) => {
|
|
64
|
+
const firstInputRef = useRef();
|
|
65
|
+
const lastInputRef = useRef();
|
|
66
|
+
const firstInputVisible = useIntersectionObserver(firstInputRef, '0px', 0.5);
|
|
67
|
+
const lastInputVisible = useIntersectionObserver(lastInputRef, '0px', 0.5);
|
|
68
|
+
const onInputChange = useCallback((value, index) => {
|
|
69
|
+
setSliderValues((currSliderValues) => {
|
|
70
|
+
const updatedValues = [...currSliderValues];
|
|
71
|
+
updatedValues[index] = Number.isNaN(value) ? domain[0] : value;
|
|
72
|
+
return updatedValues;
|
|
73
|
+
});
|
|
74
|
+
}, [domain, setSliderValues]);
|
|
75
|
+
return (_jsx(InputWrapper, { firstInputVisible: firstInputVisible, lastInputVisible: lastInputVisible, children: sliderValues.map((value, index) => {
|
|
76
|
+
let inputRef = null;
|
|
77
|
+
if (index === 0)
|
|
78
|
+
inputRef = firstInputRef;
|
|
79
|
+
if (index === sliderValues.length - 1)
|
|
80
|
+
inputRef = lastInputRef;
|
|
81
|
+
return (_jsx("div", { ref: inputRef, children: _jsx(NumericInput, { errorMsg: getErrorMsg(value, index), onChange: (val) => onInputChange(val, index), style: { height: '2rem', margin: '0.25rem 0.5rem' }, value: value }) }, index));
|
|
82
|
+
}) }));
|
|
83
|
+
};
|
|
84
|
+
export default SliderInputs;
|
|
85
|
+
//# sourceMappingURL=slider-inputs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slider-inputs.js","sourceRoot":"","sources":["../../src/slider/slider-inputs.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAqB,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/D,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,YAAY,MAAM,gCAAgC,CAAC;AAO1D,MAAM,YAAY,GAAG,MAAM,CAAC,GAA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,EAAE,KAAK,EAAE,EAAE;YAC/B,IAAI,QAAQ,GAAG,IAAI,CAAC;YACpB,IAAI,KAAK,KAAK,CAAC;gBAAE,QAAQ,GAAG,aAAa,CAAC;YAC1C,IAAI,KAAK,KAAK,YAAY,CAAC,MAAM,GAAG,CAAC;gBAAE,QAAQ,GAAG,YAAY,CAAC;YAC/D,OAAO,CACH,cAAiB,GAAG,EAAE,QAAQ,YAC1B,KAAC,YAAY,IACT,QAAQ,EAAE,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,EACnC,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC,EAC5C,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,EACnD,KAAK,EAAE,KAAK,GACd,IANI,KAAK,CAOT,CACT,CAAC;QACN,CAAC,CAAC,GACS,CAClB,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { InteractiveComponentProps } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Compute what step should be used for the given domain difference
|
|
4
|
+
*
|
|
5
|
+
* @param difference difference
|
|
6
|
+
*/
|
|
7
|
+
export declare function computeStep(difference: number): number;
|
|
8
|
+
export interface BaseSliderProps<T> extends InteractiveComponentProps<Array<number>> {
|
|
9
|
+
/** An optional flag to disable the input alternative switch render, its false by default */
|
|
10
|
+
disableInputAlternative?: boolean;
|
|
11
|
+
/** The domain defines the range of possible values that the slider can take */
|
|
12
|
+
domain: [number, number];
|
|
13
|
+
/** The getValueLabel can be used to map a numeric value to something else when displayed in the UI */
|
|
14
|
+
getValueLabel?: (value: number) => T;
|
|
15
|
+
/** An optional onChange handler that will be called when the current value of any handle changes */
|
|
16
|
+
onChange?: (values: Array<T>) => void | Promise<void>;
|
|
17
|
+
/** The step size for changes in the slider */
|
|
18
|
+
step?: number;
|
|
19
|
+
/**
|
|
20
|
+
* An optional parameter to control the number of ticks, alternatively an array can be passed to specify a specific
|
|
21
|
+
* set of ticks to display
|
|
22
|
+
*/
|
|
23
|
+
ticks?: Array<number> | number;
|
|
24
|
+
/** An array of track labels that will be shown above the tracks */
|
|
25
|
+
trackLabels?: Array<string>;
|
|
26
|
+
/** Whether a track should be drawn from the right most handle to the end of the rail */
|
|
27
|
+
trackToEnd?: boolean;
|
|
28
|
+
/** Whether a track should be drawn from the left most handle to the start of the rail */
|
|
29
|
+
trackToStart?: boolean;
|
|
30
|
+
/** The starting values for the handles, the number of values === the number of handles created */
|
|
31
|
+
values?: Array<number>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A simple numeric slider, essentially the same as BaseSlider
|
|
35
|
+
*
|
|
36
|
+
* @param props - the component props
|
|
37
|
+
*/
|
|
38
|
+
export declare function Slider(props: BaseSliderProps<number>): JSX.Element;
|
|
39
|
+
export interface CategoricalSliderProps extends Omit<BaseSliderProps<string>, 'domain' | 'initialValue' | 'disableInputAlternative'> {
|
|
40
|
+
/** The set of string values to have as options on the slider */
|
|
41
|
+
domain: Array<string>;
|
|
42
|
+
/** the initialValue of the slider */
|
|
43
|
+
initialValue?: Array<string>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The Categorical slider component accepts an array of string values to use on the slider, e.g.
|
|
47
|
+
*
|
|
48
|
+
* domain = ['low', 'med', 'high']
|
|
49
|
+
*
|
|
50
|
+
* @param {BaseSliderProps<string>} props - the component props
|
|
51
|
+
*/
|
|
52
|
+
export declare function CategoricalSlider(props: CategoricalSliderProps): JSX.Element;
|
|
53
|
+
//# sourceMappingURL=slider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slider.d.ts","sourceRoot":"","sources":["../../src/slider/slider.tsx"],"names":[],"mappings":"AA0BA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAGrD;;;;GAIG;AACH,wBAAg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