glints-aries 4.0.215 → 4.0.216
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/es/@next/Combobox/Combobox.d.ts +17 -0
- package/es/@next/Combobox/Combobox.js +67 -0
- package/es/@next/Combobox/Combobox.stories.d.ts +4 -0
- package/es/@next/Combobox/comboboxStoryHelper/TagStyle.d.ts +2 -0
- package/es/@next/Combobox/comboboxStoryHelper/TagStyle.js +7 -0
- package/es/@next/Combobox/components/OptionList/Option.d.ts +13 -0
- package/es/@next/Combobox/components/OptionList/Option.js +39 -0
- package/es/@next/Combobox/components/OptionList/OptionList.d.ts +8 -0
- package/es/@next/Combobox/components/OptionList/OptionList.js +28 -0
- package/es/@next/Combobox/components/OptionList/OptionListContext.d.ts +15 -0
- package/es/@next/Combobox/components/OptionList/OptionListContext.js +17 -0
- package/es/@next/Combobox/components/OptionList/OptionListStyle.d.ts +7 -0
- package/es/@next/Combobox/components/OptionList/OptionListStyle.js +18 -0
- package/es/@next/Combobox/components/OptionList/index.d.ts +2 -0
- package/es/@next/Combobox/components/OptionList/index.js +2 -0
- package/es/@next/Combobox/components/TextInput/TextInput.d.ts +8 -0
- package/es/@next/Combobox/components/TextInput/TextInput.js +36 -0
- package/es/@next/Combobox/components/TextInput/TextInputContext.d.ts +4 -0
- package/es/@next/Combobox/components/TextInput/TextInputContext.js +9 -0
- package/es/@next/Combobox/components/TextInput/index.d.ts +1 -0
- package/es/@next/Combobox/components/TextInput/index.js +1 -0
- package/es/@next/Combobox/components/index.d.ts +2 -0
- package/es/@next/Combobox/components/index.js +2 -0
- package/es/@next/Combobox/index.d.ts +1 -0
- package/es/@next/Combobox/index.js +1 -0
- package/es/@next/index.d.ts +1 -0
- package/es/@next/index.js +1 -0
- package/lib/@next/Combobox/Combobox.d.ts +17 -0
- package/lib/@next/Combobox/Combobox.js +74 -0
- package/lib/@next/Combobox/Combobox.stories.d.ts +4 -0
- package/lib/@next/Combobox/comboboxStoryHelper/TagStyle.d.ts +2 -0
- package/lib/@next/Combobox/comboboxStoryHelper/TagStyle.js +13 -0
- package/lib/@next/Combobox/components/OptionList/Option.d.ts +13 -0
- package/lib/@next/Combobox/components/OptionList/Option.js +46 -0
- package/lib/@next/Combobox/components/OptionList/OptionList.d.ts +8 -0
- package/lib/@next/Combobox/components/OptionList/OptionList.js +34 -0
- package/lib/@next/Combobox/components/OptionList/OptionListContext.d.ts +15 -0
- package/lib/@next/Combobox/components/OptionList/OptionListContext.js +25 -0
- package/lib/@next/Combobox/components/OptionList/OptionListStyle.d.ts +7 -0
- package/lib/@next/Combobox/components/OptionList/OptionListStyle.js +26 -0
- package/lib/@next/Combobox/components/OptionList/index.d.ts +2 -0
- package/lib/@next/Combobox/components/OptionList/index.js +8 -0
- package/lib/@next/Combobox/components/TextInput/TextInput.d.ts +8 -0
- package/lib/@next/Combobox/components/TextInput/TextInput.js +44 -0
- package/lib/@next/Combobox/components/TextInput/TextInputContext.d.ts +4 -0
- package/lib/@next/Combobox/components/TextInput/TextInputContext.js +15 -0
- package/lib/@next/Combobox/components/TextInput/index.d.ts +1 -0
- package/lib/@next/Combobox/components/TextInput/index.js +6 -0
- package/lib/@next/Combobox/components/index.d.ts +2 -0
- package/lib/@next/Combobox/components/index.js +16 -0
- package/lib/@next/Combobox/index.d.ts +1 -0
- package/lib/@next/Combobox/index.js +9 -0
- package/lib/@next/index.d.ts +1 -0
- package/lib/@next/index.js +4 -1
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ComboboxProps {
|
|
3
|
+
activator: React.ReactElement;
|
|
4
|
+
allowMultiple?: boolean;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
label?: React.ReactNode;
|
|
7
|
+
onClose?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const Combobox: {
|
|
10
|
+
({ activator, allowMultiple, children, onClose, }: ComboboxProps): JSX.Element;
|
|
11
|
+
Label: ({ children }: {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}) => JSX.Element;
|
|
14
|
+
TextInput: ({ onChange, value, ...props }: import("./components/TextInput/TextInput").ComboboxTextInputProps) => JSX.Element;
|
|
15
|
+
OptionList: ({ children, isEmpty, noOptionsMessage, onSelect, }: import("./components/OptionList/OptionList").OptionListProps) => JSX.Element;
|
|
16
|
+
Option: ({ label, value, selected }: import("./components/OptionList/Option").OptionProps) => JSX.Element;
|
|
17
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React, { useCallback, useState } from 'react';
|
|
2
|
+
import { Popover } from '../Popover';
|
|
3
|
+
import { Typography } from '../Typography';
|
|
4
|
+
import { Neutral } from '../utilities/colors';
|
|
5
|
+
import { TextInput, OptionList, Option } from './components';
|
|
6
|
+
import { ComboboxOptionContext } from './components/OptionList/OptionListContext';
|
|
7
|
+
import { ComboboxTextInputContext } from './components/TextInput/TextInputContext';
|
|
8
|
+
export var Combobox = function Combobox(_ref) {
|
|
9
|
+
var activator = _ref.activator,
|
|
10
|
+
_ref$allowMultiple = _ref.allowMultiple,
|
|
11
|
+
allowMultiple = _ref$allowMultiple === void 0 ? false : _ref$allowMultiple,
|
|
12
|
+
children = _ref.children,
|
|
13
|
+
onClose = _ref.onClose;
|
|
14
|
+
var _useState = useState(false),
|
|
15
|
+
popoverActive = _useState[0],
|
|
16
|
+
setPopoverActive = _useState[1];
|
|
17
|
+
var _useState2 = useState(),
|
|
18
|
+
textInputWidth = _useState2[0],
|
|
19
|
+
setTextInputWidth = _useState2[1];
|
|
20
|
+
var handleClose = useCallback(function () {
|
|
21
|
+
setPopoverActive(false);
|
|
22
|
+
onClose == null ? void 0 : onClose();
|
|
23
|
+
}, [onClose]);
|
|
24
|
+
var handleFocus = function handleFocus() {
|
|
25
|
+
setPopoverActive(true);
|
|
26
|
+
};
|
|
27
|
+
var handleBlur = function handleBlur() {
|
|
28
|
+
if (popoverActive) {
|
|
29
|
+
handleClose();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var textInputContextValue = {
|
|
33
|
+
onFocus: handleFocus,
|
|
34
|
+
onBlur: handleBlur,
|
|
35
|
+
textInputWidth: textInputWidth,
|
|
36
|
+
setTextInputWidth: setTextInputWidth
|
|
37
|
+
};
|
|
38
|
+
var optionContextValue = {
|
|
39
|
+
allowMultiple: allowMultiple
|
|
40
|
+
};
|
|
41
|
+
return /*#__PURE__*/React.createElement(Popover, {
|
|
42
|
+
active: popoverActive,
|
|
43
|
+
activator: /*#__PURE__*/React.createElement(ComboboxTextInputContext.Provider, {
|
|
44
|
+
value: textInputContextValue
|
|
45
|
+
}, activator),
|
|
46
|
+
onClose: handleClose,
|
|
47
|
+
autofocusTarget: "none",
|
|
48
|
+
preventFocusOnClose: true,
|
|
49
|
+
fullWidth: true
|
|
50
|
+
}, /*#__PURE__*/React.createElement(Popover.Pane, null, /*#__PURE__*/React.createElement(ComboboxOptionContext.Provider, {
|
|
51
|
+
value: optionContextValue
|
|
52
|
+
}, /*#__PURE__*/React.createElement(ComboboxTextInputContext.Provider, {
|
|
53
|
+
value: textInputContextValue
|
|
54
|
+
}, children))));
|
|
55
|
+
};
|
|
56
|
+
var Label = function Label(_ref2) {
|
|
57
|
+
var children = _ref2.children;
|
|
58
|
+
return /*#__PURE__*/React.createElement(Typography, {
|
|
59
|
+
as: "span",
|
|
60
|
+
variant: "subtitle2",
|
|
61
|
+
color: Neutral.B18
|
|
62
|
+
}, children);
|
|
63
|
+
};
|
|
64
|
+
Combobox.Label = Label;
|
|
65
|
+
Combobox.TextInput = TextInput;
|
|
66
|
+
Combobox.OptionList = OptionList;
|
|
67
|
+
Combobox.Option = Option;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Tag } from '../../Tag';
|
|
3
|
+
import { space8 } from '../../utilities/spacing';
|
|
4
|
+
export var StyledTag = styled(Tag).withConfig({
|
|
5
|
+
displayName: "TagStyle__StyledTag",
|
|
6
|
+
componentId: "sc-1k5uydi-0"
|
|
7
|
+
})(["margin-right:", ";"], space8);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type OptionType = {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
};
|
|
6
|
+
export interface OptionProps extends OptionType {
|
|
7
|
+
selected?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface NoOptionListProps {
|
|
10
|
+
noOptionsMessage?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare const Option: ({ label, value, selected }: OptionProps) => JSX.Element;
|
|
13
|
+
export declare const NoOptionList: ({ noOptionsMessage, }: NoOptionListProps) => JSX.Element;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Checkbox } from '../../../Checkbox';
|
|
3
|
+
import { Typography } from '../../../Typography';
|
|
4
|
+
import { Neutral } from '../../../utilities/colors';
|
|
5
|
+
import { useOption, useOptionList } from './OptionListContext';
|
|
6
|
+
import { EmptyOptionContainer } from './OptionListStyle';
|
|
7
|
+
export var Option = function Option(_ref) {
|
|
8
|
+
var label = _ref.label,
|
|
9
|
+
value = _ref.value,
|
|
10
|
+
selected = _ref.selected;
|
|
11
|
+
var optionContext = useOption();
|
|
12
|
+
var allowMultiple = optionContext.allowMultiple;
|
|
13
|
+
var optionListContext = useOptionList();
|
|
14
|
+
var onOptionSelect = optionListContext.onOptionSelect;
|
|
15
|
+
var handleOptionSelect = function handleOptionSelect(event) {
|
|
16
|
+
event.preventDefault();
|
|
17
|
+
event.stopPropagation();
|
|
18
|
+
onOptionSelect({
|
|
19
|
+
value: value
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
23
|
+
value: value,
|
|
24
|
+
onClick: handleOptionSelect,
|
|
25
|
+
"data-active": selected
|
|
26
|
+
}, allowMultiple ? /*#__PURE__*/React.createElement(Checkbox, {
|
|
27
|
+
label: label,
|
|
28
|
+
checked: selected
|
|
29
|
+
}) : label);
|
|
30
|
+
};
|
|
31
|
+
export var NoOptionList = function NoOptionList(_ref2) {
|
|
32
|
+
var _ref2$noOptionsMessag = _ref2.noOptionsMessage,
|
|
33
|
+
noOptionsMessage = _ref2$noOptionsMessag === void 0 ? 'No matching results' : _ref2$noOptionsMessag;
|
|
34
|
+
return /*#__PURE__*/React.createElement(EmptyOptionContainer, null, /*#__PURE__*/React.createElement(Typography, {
|
|
35
|
+
as: "span",
|
|
36
|
+
variant: "body2",
|
|
37
|
+
color: Neutral.B40
|
|
38
|
+
}, noOptionsMessage));
|
|
39
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { NoOptionListProps } from './Option';
|
|
3
|
+
export interface OptionListProps extends NoOptionListProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
isEmpty?: boolean;
|
|
6
|
+
onSelect?(value: string): void;
|
|
7
|
+
}
|
|
8
|
+
export declare const OptionList: ({ children, isEmpty, noOptionsMessage, onSelect, }: OptionListProps) => JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useComboboxTextInput } from '../TextInput/TextInputContext';
|
|
3
|
+
import { NoOptionList } from './Option';
|
|
4
|
+
import { ComboboxOptionListContext } from './OptionListContext';
|
|
5
|
+
import { OptionListContainer, StyledOptionList } from './OptionListStyle';
|
|
6
|
+
export var OptionList = function OptionList(_ref) {
|
|
7
|
+
var children = _ref.children,
|
|
8
|
+
isEmpty = _ref.isEmpty,
|
|
9
|
+
noOptionsMessage = _ref.noOptionsMessage,
|
|
10
|
+
onSelect = _ref.onSelect;
|
|
11
|
+
var textInputContext = useComboboxTextInput();
|
|
12
|
+
var textInputWidth = textInputContext.textInputWidth;
|
|
13
|
+
var hasChildren = !isEmpty;
|
|
14
|
+
var onOptionSelect = function onOptionSelect(_ref2) {
|
|
15
|
+
var value = _ref2.value;
|
|
16
|
+
if (onSelect) onSelect(value);
|
|
17
|
+
};
|
|
18
|
+
var optionListContextValue = {
|
|
19
|
+
onOptionSelect: onOptionSelect
|
|
20
|
+
};
|
|
21
|
+
return /*#__PURE__*/React.createElement(OptionListContainer, {
|
|
22
|
+
textInputWidth: textInputWidth
|
|
23
|
+
}, /*#__PURE__*/React.createElement(StyledOptionList, null, /*#__PURE__*/React.createElement(ComboboxOptionListContext.Provider, {
|
|
24
|
+
value: optionListContextValue
|
|
25
|
+
}, hasChildren ? children : /*#__PURE__*/React.createElement(NoOptionList, {
|
|
26
|
+
noOptionsMessage: noOptionsMessage
|
|
27
|
+
}))));
|
|
28
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type ComboboxOptionType = {
|
|
3
|
+
allowMultiple?: boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare const ComboboxOptionContext: import("react").Context<ComboboxOptionType>;
|
|
6
|
+
export declare const useOption: () => ComboboxOptionType;
|
|
7
|
+
declare type ComboboxOptionListType = {
|
|
8
|
+
onOptionSelect({ value }: {
|
|
9
|
+
value: string;
|
|
10
|
+
}): void;
|
|
11
|
+
selectedOptions?: string[];
|
|
12
|
+
};
|
|
13
|
+
export declare const ComboboxOptionListContext: import("react").Context<ComboboxOptionListType>;
|
|
14
|
+
export declare const useOptionList: () => ComboboxOptionListType;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
export var ComboboxOptionContext = /*#__PURE__*/createContext(undefined);
|
|
3
|
+
export var useOption = function useOption() {
|
|
4
|
+
var context = useContext(ComboboxOptionContext);
|
|
5
|
+
if (!context) {
|
|
6
|
+
throw new Error('No ComboboxOptionContext was provided. Your component must be wrapped in a <ComboboxOptionContext.Provider>');
|
|
7
|
+
}
|
|
8
|
+
return context;
|
|
9
|
+
};
|
|
10
|
+
export var ComboboxOptionListContext = /*#__PURE__*/createContext(undefined);
|
|
11
|
+
export var useOptionList = function useOptionList() {
|
|
12
|
+
var context = useContext(ComboboxOptionListContext);
|
|
13
|
+
if (!context) {
|
|
14
|
+
throw new Error('No ComboboxOptionListContext was provided. Your component must be wrapped in a <ComboboxOptionListContext.Provider>');
|
|
15
|
+
}
|
|
16
|
+
return context;
|
|
17
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface OptionListContainerProps {
|
|
2
|
+
textInputWidth?: number;
|
|
3
|
+
}
|
|
4
|
+
export declare const OptionListContainer: import("styled-components").StyledComponent<"div", any, OptionListContainerProps, never>;
|
|
5
|
+
export declare const StyledOptionList: import("styled-components").StyledComponent<"ul", any, {}, never>;
|
|
6
|
+
export declare const EmptyOptionContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { borderRadius4 } from '../../../utilities/borderRadius';
|
|
3
|
+
import { Neutral } from '../../../utilities/colors';
|
|
4
|
+
import { space4, space8 } from '../../../utilities/spacing';
|
|
5
|
+
export var OptionListContainer = styled.div.withConfig({
|
|
6
|
+
displayName: "OptionListStyle__OptionListContainer",
|
|
7
|
+
componentId: "sc-19tus93-0"
|
|
8
|
+
})(["width:", "px;padding:", " 0;"], function (props) {
|
|
9
|
+
return props.textInputWidth;
|
|
10
|
+
}, space8);
|
|
11
|
+
export var StyledOptionList = styled.ul.withConfig({
|
|
12
|
+
displayName: "OptionListStyle__StyledOptionList",
|
|
13
|
+
componentId: "sc-19tus93-1"
|
|
14
|
+
})(["list-style:none;margin:0 ", ";padding:0;li{display:flex;height:44px;position:relative;align-items:center;padding:0 ", ";margin-bottom:", ";&:hover{background:", ";border-radius:", ";cursor:pointer;}&[data-active='true']{border-radius:", ";cursor:default;}svg{height:24px;width:24px;}}"], space8, space8, space4, Neutral.B99, borderRadius4, borderRadius4);
|
|
15
|
+
export var EmptyOptionContainer = styled.div.withConfig({
|
|
16
|
+
displayName: "OptionListStyle__EmptyOptionContainer",
|
|
17
|
+
componentId: "sc-19tus93-2"
|
|
18
|
+
})(["display:flex;align-items:center;justify-content:center;margin:10px 0;"]);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextInputProps } from '../../../TextInput';
|
|
3
|
+
export interface ComboboxTextInputProps extends Omit<TextInputProps, 'onChange'> {
|
|
4
|
+
onChange?(value: string): void;
|
|
5
|
+
textInputWidth?: number;
|
|
6
|
+
setTextInputWidth?: React.Dispatch<(prevState: undefined) => undefined>;
|
|
7
|
+
}
|
|
8
|
+
export declare const TextInput: ({ onChange, value, ...props }: ComboboxTextInputProps) => JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
+
var _excluded = ["onChange", "value"];
|
|
4
|
+
import React, { useEffect, useRef } from 'react';
|
|
5
|
+
import { Icon } from '../../../Icon';
|
|
6
|
+
import { TextInput as GlintsTextInput } from '../../../TextInput';
|
|
7
|
+
import { useComboboxTextInput } from './TextInputContext';
|
|
8
|
+
export var TextInput = function TextInput(_ref) {
|
|
9
|
+
var onChange = _ref.onChange,
|
|
10
|
+
value = _ref.value,
|
|
11
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
12
|
+
var inputRef = useRef(null);
|
|
13
|
+
var textInputContext = useComboboxTextInput();
|
|
14
|
+
var onFocus = textInputContext.onFocus,
|
|
15
|
+
setTextInputWidth = textInputContext.setTextInputWidth;
|
|
16
|
+
useEffect(function () {
|
|
17
|
+
setTextInputWidth(inputRef.current.getBoundingClientRect().width);
|
|
18
|
+
}, [inputRef, setTextInputWidth]);
|
|
19
|
+
var handleChange = function handleChange(_ref2) {
|
|
20
|
+
var value = _ref2.value;
|
|
21
|
+
if (onChange) onChange(value);
|
|
22
|
+
};
|
|
23
|
+
return /*#__PURE__*/React.createElement(GlintsTextInput, _extends({}, props, {
|
|
24
|
+
ref: inputRef,
|
|
25
|
+
prefix: /*#__PURE__*/React.createElement(Icon, {
|
|
26
|
+
name: "ri-search"
|
|
27
|
+
}),
|
|
28
|
+
value: value,
|
|
29
|
+
onChange: function onChange(value) {
|
|
30
|
+
return handleChange({
|
|
31
|
+
value: value
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
onFocus: onFocus
|
|
35
|
+
}));
|
|
36
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
export var ComboboxTextInputContext = /*#__PURE__*/createContext(undefined);
|
|
3
|
+
export var useComboboxTextInput = function useComboboxTextInput() {
|
|
4
|
+
var context = useContext(ComboboxTextInputContext);
|
|
5
|
+
if (!context) {
|
|
6
|
+
throw new Error('No TextInputContext was provided. Your component must be wrapped in a <TextInputContext.Provider>');
|
|
7
|
+
}
|
|
8
|
+
return context;
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TextInput } from './TextInput';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TextInput } from './TextInput';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Combobox';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Combobox';
|
package/es/@next/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export { Button, ButtonProps, DestructiveButton, OutlineButton, OutlineMonochrom
|
|
|
13
13
|
export { ButtonGroup, ButtonGroupProps } from './ButtonGroup';
|
|
14
14
|
export { Card, CardProps } from './Card';
|
|
15
15
|
export { Checkbox, CheckboxProps } from './Checkbox';
|
|
16
|
+
export { Combobox, ComboboxProps } from './Combobox';
|
|
16
17
|
export { CurrencyInput, CurrencyInputProps } from './CurrencyInput';
|
|
17
18
|
export { DataTable, DataTableProps, TableCellProps, TableHeaderProps, TableRowProps, } from './DataTable';
|
|
18
19
|
export { Divider } from './Divider';
|
package/es/@next/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export { Button, ButtonProps, DestructiveButton, OutlineButton, OutlineMonochrom
|
|
|
14
14
|
export { ButtonGroup, ButtonGroupProps } from './ButtonGroup';
|
|
15
15
|
export { Card, CardProps } from './Card';
|
|
16
16
|
export { Checkbox, CheckboxProps } from './Checkbox';
|
|
17
|
+
export { Combobox, ComboboxProps } from './Combobox';
|
|
17
18
|
export { CurrencyInput, CurrencyInputProps } from './CurrencyInput';
|
|
18
19
|
export { DataTable, DataTableProps, TableCellProps, TableHeaderProps, TableRowProps } from './DataTable';
|
|
19
20
|
export { Divider } from './Divider';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ComboboxProps {
|
|
3
|
+
activator: React.ReactElement;
|
|
4
|
+
allowMultiple?: boolean;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
label?: React.ReactNode;
|
|
7
|
+
onClose?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const Combobox: {
|
|
10
|
+
({ activator, allowMultiple, children, onClose, }: ComboboxProps): JSX.Element;
|
|
11
|
+
Label: ({ children }: {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}) => JSX.Element;
|
|
14
|
+
TextInput: ({ onChange, value, ...props }: import("./components/TextInput/TextInput").ComboboxTextInputProps) => JSX.Element;
|
|
15
|
+
OptionList: ({ children, isEmpty, noOptionsMessage, onSelect, }: import("./components/OptionList/OptionList").OptionListProps) => JSX.Element;
|
|
16
|
+
Option: ({ label, value, selected }: import("./components/OptionList/Option").OptionProps) => JSX.Element;
|
|
17
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.Combobox = void 0;
|
|
5
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
var _Popover = require("../Popover");
|
|
7
|
+
var _Typography = require("../Typography");
|
|
8
|
+
var _colors = require("../utilities/colors");
|
|
9
|
+
var _components = require("./components");
|
|
10
|
+
var _OptionListContext = require("./components/OptionList/OptionListContext");
|
|
11
|
+
var _TextInputContext = require("./components/TextInput/TextInputContext");
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
+
var Combobox = function Combobox(_ref) {
|
|
15
|
+
var activator = _ref.activator,
|
|
16
|
+
_ref$allowMultiple = _ref.allowMultiple,
|
|
17
|
+
allowMultiple = _ref$allowMultiple === void 0 ? false : _ref$allowMultiple,
|
|
18
|
+
children = _ref.children,
|
|
19
|
+
onClose = _ref.onClose;
|
|
20
|
+
var _useState = (0, _react.useState)(false),
|
|
21
|
+
popoverActive = _useState[0],
|
|
22
|
+
setPopoverActive = _useState[1];
|
|
23
|
+
var _useState2 = (0, _react.useState)(),
|
|
24
|
+
textInputWidth = _useState2[0],
|
|
25
|
+
setTextInputWidth = _useState2[1];
|
|
26
|
+
var handleClose = (0, _react.useCallback)(function () {
|
|
27
|
+
setPopoverActive(false);
|
|
28
|
+
onClose == null ? void 0 : onClose();
|
|
29
|
+
}, [onClose]);
|
|
30
|
+
var handleFocus = function handleFocus() {
|
|
31
|
+
setPopoverActive(true);
|
|
32
|
+
};
|
|
33
|
+
var handleBlur = function handleBlur() {
|
|
34
|
+
if (popoverActive) {
|
|
35
|
+
handleClose();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var textInputContextValue = {
|
|
39
|
+
onFocus: handleFocus,
|
|
40
|
+
onBlur: handleBlur,
|
|
41
|
+
textInputWidth: textInputWidth,
|
|
42
|
+
setTextInputWidth: setTextInputWidth
|
|
43
|
+
};
|
|
44
|
+
var optionContextValue = {
|
|
45
|
+
allowMultiple: allowMultiple
|
|
46
|
+
};
|
|
47
|
+
return /*#__PURE__*/_react["default"].createElement(_Popover.Popover, {
|
|
48
|
+
active: popoverActive,
|
|
49
|
+
activator: /*#__PURE__*/_react["default"].createElement(_TextInputContext.ComboboxTextInputContext.Provider, {
|
|
50
|
+
value: textInputContextValue
|
|
51
|
+
}, activator),
|
|
52
|
+
onClose: handleClose,
|
|
53
|
+
autofocusTarget: "none",
|
|
54
|
+
preventFocusOnClose: true,
|
|
55
|
+
fullWidth: true
|
|
56
|
+
}, /*#__PURE__*/_react["default"].createElement(_Popover.Popover.Pane, null, /*#__PURE__*/_react["default"].createElement(_OptionListContext.ComboboxOptionContext.Provider, {
|
|
57
|
+
value: optionContextValue
|
|
58
|
+
}, /*#__PURE__*/_react["default"].createElement(_TextInputContext.ComboboxTextInputContext.Provider, {
|
|
59
|
+
value: textInputContextValue
|
|
60
|
+
}, children))));
|
|
61
|
+
};
|
|
62
|
+
exports.Combobox = Combobox;
|
|
63
|
+
var Label = function Label(_ref2) {
|
|
64
|
+
var children = _ref2.children;
|
|
65
|
+
return /*#__PURE__*/_react["default"].createElement(_Typography.Typography, {
|
|
66
|
+
as: "span",
|
|
67
|
+
variant: "subtitle2",
|
|
68
|
+
color: _colors.Neutral.B18
|
|
69
|
+
}, children);
|
|
70
|
+
};
|
|
71
|
+
Combobox.Label = Label;
|
|
72
|
+
Combobox.TextInput = _components.TextInput;
|
|
73
|
+
Combobox.OptionList = _components.OptionList;
|
|
74
|
+
Combobox.Option = _components.Option;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.StyledTag = void 0;
|
|
6
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
7
|
+
var _Tag = require("../../Tag");
|
|
8
|
+
var _spacing = require("../../utilities/spacing");
|
|
9
|
+
var StyledTag = (0, _styledComponents["default"])(_Tag.Tag).withConfig({
|
|
10
|
+
displayName: "TagStyle__StyledTag",
|
|
11
|
+
componentId: "sc-1k5uydi-0"
|
|
12
|
+
})(["margin-right:", ";"], _spacing.space8);
|
|
13
|
+
exports.StyledTag = StyledTag;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type OptionType = {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
};
|
|
6
|
+
export interface OptionProps extends OptionType {
|
|
7
|
+
selected?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface NoOptionListProps {
|
|
10
|
+
noOptionsMessage?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare const Option: ({ label, value, selected }: OptionProps) => JSX.Element;
|
|
13
|
+
export declare const NoOptionList: ({ noOptionsMessage, }: NoOptionListProps) => JSX.Element;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.Option = exports.NoOptionList = void 0;
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
var _Checkbox = require("../../../Checkbox");
|
|
8
|
+
var _Typography = require("../../../Typography");
|
|
9
|
+
var _colors = require("../../../utilities/colors");
|
|
10
|
+
var _OptionListContext = require("./OptionListContext");
|
|
11
|
+
var _OptionListStyle = require("./OptionListStyle");
|
|
12
|
+
var Option = function Option(_ref) {
|
|
13
|
+
var label = _ref.label,
|
|
14
|
+
value = _ref.value,
|
|
15
|
+
selected = _ref.selected;
|
|
16
|
+
var optionContext = (0, _OptionListContext.useOption)();
|
|
17
|
+
var allowMultiple = optionContext.allowMultiple;
|
|
18
|
+
var optionListContext = (0, _OptionListContext.useOptionList)();
|
|
19
|
+
var onOptionSelect = optionListContext.onOptionSelect;
|
|
20
|
+
var handleOptionSelect = function handleOptionSelect(event) {
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
event.stopPropagation();
|
|
23
|
+
onOptionSelect({
|
|
24
|
+
value: value
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
28
|
+
value: value,
|
|
29
|
+
onClick: handleOptionSelect,
|
|
30
|
+
"data-active": selected
|
|
31
|
+
}, allowMultiple ? /*#__PURE__*/_react["default"].createElement(_Checkbox.Checkbox, {
|
|
32
|
+
label: label,
|
|
33
|
+
checked: selected
|
|
34
|
+
}) : label);
|
|
35
|
+
};
|
|
36
|
+
exports.Option = Option;
|
|
37
|
+
var NoOptionList = function NoOptionList(_ref2) {
|
|
38
|
+
var _ref2$noOptionsMessag = _ref2.noOptionsMessage,
|
|
39
|
+
noOptionsMessage = _ref2$noOptionsMessag === void 0 ? 'No matching results' : _ref2$noOptionsMessag;
|
|
40
|
+
return /*#__PURE__*/_react["default"].createElement(_OptionListStyle.EmptyOptionContainer, null, /*#__PURE__*/_react["default"].createElement(_Typography.Typography, {
|
|
41
|
+
as: "span",
|
|
42
|
+
variant: "body2",
|
|
43
|
+
color: _colors.Neutral.B40
|
|
44
|
+
}, noOptionsMessage));
|
|
45
|
+
};
|
|
46
|
+
exports.NoOptionList = NoOptionList;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { NoOptionListProps } from './Option';
|
|
3
|
+
export interface OptionListProps extends NoOptionListProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
isEmpty?: boolean;
|
|
6
|
+
onSelect?(value: string): void;
|
|
7
|
+
}
|
|
8
|
+
export declare const OptionList: ({ children, isEmpty, noOptionsMessage, onSelect, }: OptionListProps) => JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.OptionList = void 0;
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
var _TextInputContext = require("../TextInput/TextInputContext");
|
|
8
|
+
var _Option = require("./Option");
|
|
9
|
+
var _OptionListContext = require("./OptionListContext");
|
|
10
|
+
var _OptionListStyle = require("./OptionListStyle");
|
|
11
|
+
var OptionList = function OptionList(_ref) {
|
|
12
|
+
var children = _ref.children,
|
|
13
|
+
isEmpty = _ref.isEmpty,
|
|
14
|
+
noOptionsMessage = _ref.noOptionsMessage,
|
|
15
|
+
onSelect = _ref.onSelect;
|
|
16
|
+
var textInputContext = (0, _TextInputContext.useComboboxTextInput)();
|
|
17
|
+
var textInputWidth = textInputContext.textInputWidth;
|
|
18
|
+
var hasChildren = !isEmpty;
|
|
19
|
+
var onOptionSelect = function onOptionSelect(_ref2) {
|
|
20
|
+
var value = _ref2.value;
|
|
21
|
+
if (onSelect) onSelect(value);
|
|
22
|
+
};
|
|
23
|
+
var optionListContextValue = {
|
|
24
|
+
onOptionSelect: onOptionSelect
|
|
25
|
+
};
|
|
26
|
+
return /*#__PURE__*/_react["default"].createElement(_OptionListStyle.OptionListContainer, {
|
|
27
|
+
textInputWidth: textInputWidth
|
|
28
|
+
}, /*#__PURE__*/_react["default"].createElement(_OptionListStyle.StyledOptionList, null, /*#__PURE__*/_react["default"].createElement(_OptionListContext.ComboboxOptionListContext.Provider, {
|
|
29
|
+
value: optionListContextValue
|
|
30
|
+
}, hasChildren ? children : /*#__PURE__*/_react["default"].createElement(_Option.NoOptionList, {
|
|
31
|
+
noOptionsMessage: noOptionsMessage
|
|
32
|
+
}))));
|
|
33
|
+
};
|
|
34
|
+
exports.OptionList = OptionList;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type ComboboxOptionType = {
|
|
3
|
+
allowMultiple?: boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare const ComboboxOptionContext: import("react").Context<ComboboxOptionType>;
|
|
6
|
+
export declare const useOption: () => ComboboxOptionType;
|
|
7
|
+
declare type ComboboxOptionListType = {
|
|
8
|
+
onOptionSelect({ value }: {
|
|
9
|
+
value: string;
|
|
10
|
+
}): void;
|
|
11
|
+
selectedOptions?: string[];
|
|
12
|
+
};
|
|
13
|
+
export declare const ComboboxOptionListContext: import("react").Context<ComboboxOptionListType>;
|
|
14
|
+
export declare const useOptionList: () => ComboboxOptionListType;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.useOptionList = exports.useOption = exports.ComboboxOptionListContext = exports.ComboboxOptionContext = void 0;
|
|
5
|
+
var _react = require("react");
|
|
6
|
+
var ComboboxOptionContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
7
|
+
exports.ComboboxOptionContext = ComboboxOptionContext;
|
|
8
|
+
var useOption = function useOption() {
|
|
9
|
+
var context = (0, _react.useContext)(ComboboxOptionContext);
|
|
10
|
+
if (!context) {
|
|
11
|
+
throw new Error('No ComboboxOptionContext was provided. Your component must be wrapped in a <ComboboxOptionContext.Provider>');
|
|
12
|
+
}
|
|
13
|
+
return context;
|
|
14
|
+
};
|
|
15
|
+
exports.useOption = useOption;
|
|
16
|
+
var ComboboxOptionListContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
17
|
+
exports.ComboboxOptionListContext = ComboboxOptionListContext;
|
|
18
|
+
var useOptionList = function useOptionList() {
|
|
19
|
+
var context = (0, _react.useContext)(ComboboxOptionListContext);
|
|
20
|
+
if (!context) {
|
|
21
|
+
throw new Error('No ComboboxOptionListContext was provided. Your component must be wrapped in a <ComboboxOptionListContext.Provider>');
|
|
22
|
+
}
|
|
23
|
+
return context;
|
|
24
|
+
};
|
|
25
|
+
exports.useOptionList = useOptionList;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface OptionListContainerProps {
|
|
2
|
+
textInputWidth?: number;
|
|
3
|
+
}
|
|
4
|
+
export declare const OptionListContainer: import("styled-components").StyledComponent<"div", any, OptionListContainerProps, never>;
|
|
5
|
+
export declare const StyledOptionList: import("styled-components").StyledComponent<"ul", any, {}, never>;
|
|
6
|
+
export declare const EmptyOptionContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.StyledOptionList = exports.OptionListContainer = exports.EmptyOptionContainer = void 0;
|
|
6
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
7
|
+
var _borderRadius = require("../../../utilities/borderRadius");
|
|
8
|
+
var _colors = require("../../../utilities/colors");
|
|
9
|
+
var _spacing = require("../../../utilities/spacing");
|
|
10
|
+
var OptionListContainer = _styledComponents["default"].div.withConfig({
|
|
11
|
+
displayName: "OptionListStyle__OptionListContainer",
|
|
12
|
+
componentId: "sc-19tus93-0"
|
|
13
|
+
})(["width:", "px;padding:", " 0;"], function (props) {
|
|
14
|
+
return props.textInputWidth;
|
|
15
|
+
}, _spacing.space8);
|
|
16
|
+
exports.OptionListContainer = OptionListContainer;
|
|
17
|
+
var StyledOptionList = _styledComponents["default"].ul.withConfig({
|
|
18
|
+
displayName: "OptionListStyle__StyledOptionList",
|
|
19
|
+
componentId: "sc-19tus93-1"
|
|
20
|
+
})(["list-style:none;margin:0 ", ";padding:0;li{display:flex;height:44px;position:relative;align-items:center;padding:0 ", ";margin-bottom:", ";&:hover{background:", ";border-radius:", ";cursor:pointer;}&[data-active='true']{border-radius:", ";cursor:default;}svg{height:24px;width:24px;}}"], _spacing.space8, _spacing.space8, _spacing.space4, _colors.Neutral.B99, _borderRadius.borderRadius4, _borderRadius.borderRadius4);
|
|
21
|
+
exports.StyledOptionList = StyledOptionList;
|
|
22
|
+
var EmptyOptionContainer = _styledComponents["default"].div.withConfig({
|
|
23
|
+
displayName: "OptionListStyle__EmptyOptionContainer",
|
|
24
|
+
componentId: "sc-19tus93-2"
|
|
25
|
+
})(["display:flex;align-items:center;justify-content:center;margin:10px 0;"]);
|
|
26
|
+
exports.EmptyOptionContainer = EmptyOptionContainer;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextInputProps } from '../../../TextInput';
|
|
3
|
+
export interface ComboboxTextInputProps extends Omit<TextInputProps, 'onChange'> {
|
|
4
|
+
onChange?(value: string): void;
|
|
5
|
+
textInputWidth?: number;
|
|
6
|
+
setTextInputWidth?: React.Dispatch<(prevState: undefined) => undefined>;
|
|
7
|
+
}
|
|
8
|
+
export declare const TextInput: ({ onChange, value, ...props }: ComboboxTextInputProps) => JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.TextInput = void 0;
|
|
6
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
7
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _Icon = require("../../../Icon");
|
|
10
|
+
var _TextInput = require("../../../TextInput");
|
|
11
|
+
var _TextInputContext = require("./TextInputContext");
|
|
12
|
+
var _excluded = ["onChange", "value"];
|
|
13
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
+
var TextInput = function TextInput(_ref) {
|
|
16
|
+
var onChange = _ref.onChange,
|
|
17
|
+
value = _ref.value,
|
|
18
|
+
props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
|
|
19
|
+
var inputRef = (0, _react.useRef)(null);
|
|
20
|
+
var textInputContext = (0, _TextInputContext.useComboboxTextInput)();
|
|
21
|
+
var onFocus = textInputContext.onFocus,
|
|
22
|
+
setTextInputWidth = textInputContext.setTextInputWidth;
|
|
23
|
+
(0, _react.useEffect)(function () {
|
|
24
|
+
setTextInputWidth(inputRef.current.getBoundingClientRect().width);
|
|
25
|
+
}, [inputRef, setTextInputWidth]);
|
|
26
|
+
var handleChange = function handleChange(_ref2) {
|
|
27
|
+
var value = _ref2.value;
|
|
28
|
+
if (onChange) onChange(value);
|
|
29
|
+
};
|
|
30
|
+
return /*#__PURE__*/_react["default"].createElement(_TextInput.TextInput, (0, _extends2["default"])({}, props, {
|
|
31
|
+
ref: inputRef,
|
|
32
|
+
prefix: /*#__PURE__*/_react["default"].createElement(_Icon.Icon, {
|
|
33
|
+
name: "ri-search"
|
|
34
|
+
}),
|
|
35
|
+
value: value,
|
|
36
|
+
onChange: function onChange(value) {
|
|
37
|
+
return handleChange({
|
|
38
|
+
value: value
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
onFocus: onFocus
|
|
42
|
+
}));
|
|
43
|
+
};
|
|
44
|
+
exports.TextInput = TextInput;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.useComboboxTextInput = exports.ComboboxTextInputContext = void 0;
|
|
5
|
+
var _react = require("react");
|
|
6
|
+
var ComboboxTextInputContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
7
|
+
exports.ComboboxTextInputContext = ComboboxTextInputContext;
|
|
8
|
+
var useComboboxTextInput = function useComboboxTextInput() {
|
|
9
|
+
var context = (0, _react.useContext)(ComboboxTextInputContext);
|
|
10
|
+
if (!context) {
|
|
11
|
+
throw new Error('No TextInputContext was provided. Your component must be wrapped in a <TextInputContext.Provider>');
|
|
12
|
+
}
|
|
13
|
+
return context;
|
|
14
|
+
};
|
|
15
|
+
exports.useComboboxTextInput = useComboboxTextInput;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TextInput } from './TextInput';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
var _exportNames = {
|
|
5
|
+
TextInput: true
|
|
6
|
+
};
|
|
7
|
+
exports.TextInput = void 0;
|
|
8
|
+
var _TextInput = require("./TextInput");
|
|
9
|
+
exports.TextInput = _TextInput.TextInput;
|
|
10
|
+
var _OptionList = require("./OptionList");
|
|
11
|
+
Object.keys(_OptionList).forEach(function (key) {
|
|
12
|
+
if (key === "default" || key === "__esModule") return;
|
|
13
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
14
|
+
if (key in exports && exports[key] === _OptionList[key]) return;
|
|
15
|
+
exports[key] = _OptionList[key];
|
|
16
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Combobox';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
var _Combobox = require("./Combobox");
|
|
5
|
+
Object.keys(_Combobox).forEach(function (key) {
|
|
6
|
+
if (key === "default" || key === "__esModule") return;
|
|
7
|
+
if (key in exports && exports[key] === _Combobox[key]) return;
|
|
8
|
+
exports[key] = _Combobox[key];
|
|
9
|
+
});
|
package/lib/@next/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export { Button, ButtonProps, DestructiveButton, OutlineButton, OutlineMonochrom
|
|
|
13
13
|
export { ButtonGroup, ButtonGroupProps } from './ButtonGroup';
|
|
14
14
|
export { Card, CardProps } from './Card';
|
|
15
15
|
export { Checkbox, CheckboxProps } from './Checkbox';
|
|
16
|
+
export { Combobox, ComboboxProps } from './Combobox';
|
|
16
17
|
export { CurrencyInput, CurrencyInputProps } from './CurrencyInput';
|
|
17
18
|
export { DataTable, DataTableProps, TableCellProps, TableHeaderProps, TableRowProps, } from './DataTable';
|
|
18
19
|
export { Divider } from './Divider';
|
package/lib/@next/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.useModal = exports.useIndexResourceState = exports.useAlert = exports.TypographyProps = exports.Typography = exports.TooltipProps = exports.TooltipPosition = exports.Tooltip = exports.TextInputProps = exports.TextInput = exports.TagProps = exports.Tag = exports.TabsProps = exports.Tabs = exports.TableRowProps = exports.TableHeaderProps = exports.TableCellProps = exports.TabProps = exports.TabModel = exports.Tab = exports.Switch = exports.SpinnerProps = exports.Spinner = exports.Spacing = exports.SimplePagination = exports.RadioButtonProps = exports.RadioButton = exports.PrimaryButton = exports.PopoverProps = exports.Popover = exports.PaginationProps = exports.Pagination = exports.OutlineMonochromeButton = exports.OutlineButton = exports.NumberInputProps = exports.NumberInput = exports.ModalProvider = exports.ModalProps = exports.ModalContext = exports.Modal = exports.MenuProps = exports.Menu = exports.LinkProps = exports.Link = exports.InlineErrorProps = exports.InlineError = exports.IndexTableProps = exports.IndexTable = exports.IconProps = exports.Icon = exports.Fonts = exports.EmptyState = exports.DropShadow = exports.Divider = exports.DestructiveButton = exports.DataTableProps = exports.DataTable = exports.CurrencyInputProps = exports.CurrencyInput = exports.Colors = exports.CheckboxProps = exports.Checkbox = exports.CardProps = exports.Card = exports.ButtonProps = exports.ButtonGroupProps = exports.ButtonGroup = exports.Button = exports.Breakpoints = exports.BorderRadius = exports.BannerProps = exports.Banner = exports.BadgeProps = exports.Badge = exports.AvatarProps = exports.Avatar = exports.AlertWithProvider = exports.AlertProvider = exports.AlertProps = exports.AlertContextProps = exports.AlertContext = exports.Alert = exports.ActionListSection = exports.ActionListProps = exports.ActionListItem = exports.ActionList = void 0;
|
|
4
|
+
exports.useModal = exports.useIndexResourceState = exports.useAlert = exports.TypographyProps = exports.Typography = exports.TooltipProps = exports.TooltipPosition = exports.Tooltip = exports.TextInputProps = exports.TextInput = exports.TagProps = exports.Tag = exports.TabsProps = exports.Tabs = exports.TableRowProps = exports.TableHeaderProps = exports.TableCellProps = exports.TabProps = exports.TabModel = exports.Tab = exports.Switch = exports.SpinnerProps = exports.Spinner = exports.Spacing = exports.SimplePagination = exports.RadioButtonProps = exports.RadioButton = exports.PrimaryButton = exports.PopoverProps = exports.Popover = exports.PaginationProps = exports.Pagination = exports.OutlineMonochromeButton = exports.OutlineButton = exports.NumberInputProps = exports.NumberInput = exports.ModalProvider = exports.ModalProps = exports.ModalContext = exports.Modal = exports.MenuProps = exports.Menu = exports.LinkProps = exports.Link = exports.InlineErrorProps = exports.InlineError = exports.IndexTableProps = exports.IndexTable = exports.IconProps = exports.Icon = exports.Fonts = exports.EmptyState = exports.DropShadow = exports.Divider = exports.DestructiveButton = exports.DataTableProps = exports.DataTable = exports.CurrencyInputProps = exports.CurrencyInput = exports.ComboboxProps = exports.Combobox = exports.Colors = exports.CheckboxProps = exports.Checkbox = exports.CardProps = exports.Card = exports.ButtonProps = exports.ButtonGroupProps = exports.ButtonGroup = exports.Button = exports.Breakpoints = exports.BorderRadius = exports.BannerProps = exports.Banner = exports.BadgeProps = exports.Badge = exports.AvatarProps = exports.Avatar = exports.AlertWithProvider = exports.AlertProvider = exports.AlertProps = exports.AlertContextProps = exports.AlertContext = exports.Alert = exports.ActionListSection = exports.ActionListProps = exports.ActionListItem = exports.ActionList = void 0;
|
|
5
5
|
var BorderRadius = _interopRequireWildcard(require("./utilities/borderRadius"));
|
|
6
6
|
exports.BorderRadius = BorderRadius;
|
|
7
7
|
var Breakpoints = _interopRequireWildcard(require("./utilities/breakpoints"));
|
|
@@ -52,6 +52,9 @@ exports.CardProps = _Card.CardProps;
|
|
|
52
52
|
var _Checkbox = require("./Checkbox");
|
|
53
53
|
exports.Checkbox = _Checkbox.Checkbox;
|
|
54
54
|
exports.CheckboxProps = _Checkbox.CheckboxProps;
|
|
55
|
+
var _Combobox = require("./Combobox");
|
|
56
|
+
exports.Combobox = _Combobox.Combobox;
|
|
57
|
+
exports.ComboboxProps = _Combobox.ComboboxProps;
|
|
55
58
|
var _CurrencyInput = require("./CurrencyInput");
|
|
56
59
|
exports.CurrencyInput = _CurrencyInput.CurrencyInput;
|
|
57
60
|
exports.CurrencyInputProps = _CurrencyInput.CurrencyInputProps;
|