glints-aries 4.0.215 → 4.0.217
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/Bar/Bar.d.ts +11 -0
- package/es/@next/Bar/Bar.js +50 -0
- package/es/@next/Bar/Bar.stories.d.ts +6 -0
- package/es/@next/Bar/BarStyle.d.ts +5 -0
- package/es/@next/Bar/BarStyle.js +24 -0
- package/es/@next/Bar/index.d.ts +1 -0
- package/es/@next/Bar/index.js +1 -0
- package/es/@next/Bar/useWindowSize.d.ts +4 -0
- package/es/@next/Bar/useWindowSize.js +38 -0
- 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/DataTable/DataTable.js +1 -3
- package/es/@next/DataTable/DataTableStyle.js +6 -5
- package/es/@next/DataTable/TableHeader.js +3 -1
- package/es/@next/Menu/Menu.js +1 -1
- package/es/@next/index.d.ts +2 -0
- package/es/@next/index.js +2 -0
- package/es/@next/utilities/dropShadow/DropShadow.d.ts +1 -1
- package/es/@next/utilities/dropShadow/DropShadow.js +1 -1
- package/lib/@next/Bar/Bar.d.ts +11 -0
- package/lib/@next/Bar/Bar.js +56 -0
- package/lib/@next/Bar/Bar.stories.d.ts +6 -0
- package/lib/@next/Bar/BarStyle.d.ts +5 -0
- package/lib/@next/Bar/BarStyle.js +36 -0
- package/lib/@next/Bar/index.d.ts +1 -0
- package/lib/@next/Bar/index.js +9 -0
- package/lib/@next/Bar/useWindowSize.d.ts +4 -0
- package/lib/@next/Bar/useWindowSize.js +42 -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/DataTable/DataTable.js +1 -3
- package/lib/@next/DataTable/DataTableStyle.js +8 -5
- package/lib/@next/DataTable/TableHeader.js +3 -1
- package/lib/@next/Menu/Menu.js +1 -1
- package/lib/@next/index.d.ts +2 -0
- package/lib/@next/index.js +7 -1
- package/lib/@next/utilities/dropShadow/DropShadow.d.ts +1 -1
- package/lib/@next/utilities/dropShadow/DropShadow.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentAction } from '../../types/componentAction';
|
|
3
|
+
export declare type BarProps = {
|
|
4
|
+
heading: React.ReactNode;
|
|
5
|
+
subheading?: React.ReactNode;
|
|
6
|
+
primaryAction: ComponentAction;
|
|
7
|
+
secondaryAction?: ComponentAction;
|
|
8
|
+
tertiaryAction?: ComponentAction;
|
|
9
|
+
position?: 'top' | 'bottom';
|
|
10
|
+
};
|
|
11
|
+
export declare const Bar: React.ForwardRefExoticComponent<BarProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Breakpoints, Colors } from '..';
|
|
3
|
+
import { Button, PrimaryButton } from '../Button';
|
|
4
|
+
import { ButtonGroup } from '../ButtonGroup';
|
|
5
|
+
import { Typography } from '../Typography';
|
|
6
|
+
import { StyledBarActionWrapper, StyledBar, StyledBarHeaderWrapper, StyledBarContainer } from './BarStyle';
|
|
7
|
+
import { useWindowSize } from './useWindowSize';
|
|
8
|
+
export var Bar = /*#__PURE__*/React.forwardRef(function Bar(_ref, ref) {
|
|
9
|
+
var heading = _ref.heading,
|
|
10
|
+
subheading = _ref.subheading,
|
|
11
|
+
primaryAction = _ref.primaryAction,
|
|
12
|
+
secondaryAction = _ref.secondaryAction,
|
|
13
|
+
tertiaryAction = _ref.tertiaryAction,
|
|
14
|
+
position = _ref.position;
|
|
15
|
+
var headerMarkup = function headerMarkup() {
|
|
16
|
+
if (subheading) {
|
|
17
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
|
|
18
|
+
as: "div",
|
|
19
|
+
variant: "body2",
|
|
20
|
+
color: Colors.Neutral.B18
|
|
21
|
+
}, heading), /*#__PURE__*/React.createElement(Typography, {
|
|
22
|
+
as: "div",
|
|
23
|
+
variant: "subtitle2",
|
|
24
|
+
color: Colors.Neutral.B40
|
|
25
|
+
}, subheading));
|
|
26
|
+
}
|
|
27
|
+
return /*#__PURE__*/React.createElement(Typography, {
|
|
28
|
+
as: "div",
|
|
29
|
+
variant: "headline6",
|
|
30
|
+
color: Colors.Neutral.B18
|
|
31
|
+
}, heading);
|
|
32
|
+
};
|
|
33
|
+
var _useWindowSize = useWindowSize(),
|
|
34
|
+
width = _useWindowSize.width;
|
|
35
|
+
var breakpointWidth = parseInt(Breakpoints.large.slice(0, -2));
|
|
36
|
+
var buttonSize = width <= breakpointWidth ? 'default' : 'large';
|
|
37
|
+
return /*#__PURE__*/React.createElement(StyledBar, {
|
|
38
|
+
"data-align": position,
|
|
39
|
+
ref: ref
|
|
40
|
+
}, /*#__PURE__*/React.createElement(StyledBarContainer, null, /*#__PURE__*/React.createElement(StyledBarHeaderWrapper, null, headerMarkup(), " "), /*#__PURE__*/React.createElement(StyledBarActionWrapper, null, /*#__PURE__*/React.createElement(ButtonGroup, null, tertiaryAction && /*#__PURE__*/React.createElement(Button, {
|
|
41
|
+
onClick: tertiaryAction.action,
|
|
42
|
+
size: buttonSize
|
|
43
|
+
}, tertiaryAction.label), secondaryAction && /*#__PURE__*/React.createElement(Button, {
|
|
44
|
+
onClick: secondaryAction.action,
|
|
45
|
+
size: buttonSize
|
|
46
|
+
}, secondaryAction.label), /*#__PURE__*/React.createElement(PrimaryButton, {
|
|
47
|
+
onClick: primaryAction.action,
|
|
48
|
+
size: buttonSize
|
|
49
|
+
}, primaryAction.label)))));
|
|
50
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const StyledBar: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export declare const StyledBarHeaderWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
+
export declare const StyledBarActionWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
+
export declare const StyledBarContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
|
+
export declare const StyledCustomHeadingWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import * as Breakpoints from '../utilities/breakpoints';
|
|
3
|
+
import { Neutral } from '../utilities/colors';
|
|
4
|
+
import { space8 } from '../utilities/spacing';
|
|
5
|
+
export var StyledBar = styled.div.withConfig({
|
|
6
|
+
displayName: "BarStyle__StyledBar",
|
|
7
|
+
componentId: "sc-1m51mld-0"
|
|
8
|
+
})(["display:flex;flex-direction:row;padding:20px 0;width:100%;position:absolute;height:90px;@media (max-width:", "){height:70px;}&[data-align='bottom']{bottom:0;}&[data-align='top']{top:0;}box-shadow:0px 0px 0px 1px rgba(63,63,68,0.05),0px 1px 3px rgba(63,63,68,0.15);background:", ";"], Breakpoints.large, Neutral.B100);
|
|
9
|
+
export var StyledBarHeaderWrapper = styled.div.withConfig({
|
|
10
|
+
displayName: "BarStyle__StyledBarHeaderWrapper",
|
|
11
|
+
componentId: "sc-1m51mld-1"
|
|
12
|
+
})(["display:flex;flex-grow:1;flex-direction:column;"]);
|
|
13
|
+
export var StyledBarActionWrapper = styled.div.withConfig({
|
|
14
|
+
displayName: "BarStyle__StyledBarActionWrapper",
|
|
15
|
+
componentId: "sc-1m51mld-2"
|
|
16
|
+
})(["display:flex;flex-direction:column-reverse;align-items:flex-end;"]);
|
|
17
|
+
export var StyledBarContainer = styled.div.withConfig({
|
|
18
|
+
displayName: "BarStyle__StyledBarContainer",
|
|
19
|
+
componentId: "sc-1m51mld-3"
|
|
20
|
+
})(["position:relative;margin:0 auto;padding:0 50px;width:100%;*,*:before,*:after{box-sizing:border-box;}justify-content:space-between;align-items:center;flex-direction:row;display:flex;@media (max-width:", "){gap:16px;padding:0 24px;}"], Breakpoints.large);
|
|
21
|
+
export var StyledCustomHeadingWrapper = styled.div.withConfig({
|
|
22
|
+
displayName: "BarStyle__StyledCustomHeadingWrapper",
|
|
23
|
+
componentId: "sc-1m51mld-4"
|
|
24
|
+
})(["display:flex;flex-direction:row;gap:", ";"], space8);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Bar';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Bar';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
// Hook
|
|
4
|
+
export var useWindowSize = function useWindowSize() {
|
|
5
|
+
// Initialize state with undefined width/height so server and client renders match
|
|
6
|
+
// Learn more here: https://joshwcomeau.com/react/the-perils-of-rehydration/
|
|
7
|
+
var _useState = useState({
|
|
8
|
+
width: undefined,
|
|
9
|
+
height: undefined
|
|
10
|
+
}),
|
|
11
|
+
windowSize = _useState[0],
|
|
12
|
+
setWindowSize = _useState[1];
|
|
13
|
+
useEffect(function () {
|
|
14
|
+
// Handler to call on window resize
|
|
15
|
+
function handleResize() {
|
|
16
|
+
// Set window width/height to state
|
|
17
|
+
setWindowSize({
|
|
18
|
+
width: window.innerWidth,
|
|
19
|
+
height: window.innerHeight
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Add event listener
|
|
24
|
+
window.addEventListener('resize', handleResize);
|
|
25
|
+
|
|
26
|
+
// Call handler right away so state gets updated with initial window size
|
|
27
|
+
handleResize();
|
|
28
|
+
|
|
29
|
+
// Remove event listener on cleanup
|
|
30
|
+
return function () {
|
|
31
|
+
return window.removeEventListener('resize', handleResize);
|
|
32
|
+
};
|
|
33
|
+
}, []); // Empty array ensures that effect is only run on mount
|
|
34
|
+
|
|
35
|
+
return windowSize;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// Taken from https://usehooks.com/useWindowSize/
|
|
@@ -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';
|
|
@@ -84,9 +84,7 @@ var DataTableComponent = /*#__PURE__*/React.forwardRef(function DataTable(_ref,
|
|
|
84
84
|
ref: ref,
|
|
85
85
|
"data-loading": loading,
|
|
86
86
|
"data-has-footer": showFooter
|
|
87
|
-
}, props), /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement(StyledTableRow, null, rowHeaderMarkup)), /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement(LoadingRow, null), totalsRowMarkup && hasRows && /*#__PURE__*/React.createElement(StyledTableRow, {
|
|
88
|
-
"data-total": "true"
|
|
89
|
-
}, totalsRowMarkup), rowsMarkup), showFooter && /*#__PURE__*/React.createElement("tfoot", null, /*#__PURE__*/React.createElement(StyledTableFooterRow, null, /*#__PURE__*/React.createElement(StyledTableCell, {
|
|
87
|
+
}, props), /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement(StyledTableRow, null, rowHeaderMarkup)), /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement(LoadingRow, null), totalsRowMarkup && hasRows && /*#__PURE__*/React.createElement(StyledTableRow, null, totalsRowMarkup), rowsMarkup), showFooter && /*#__PURE__*/React.createElement("tfoot", null, /*#__PURE__*/React.createElement(StyledTableFooterRow, null, /*#__PURE__*/React.createElement(StyledTableCell, {
|
|
90
88
|
colSpan: headings.length
|
|
91
89
|
}, footer)))));
|
|
92
90
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
|
+
import * as DropShadow from '../utilities/dropShadow';
|
|
2
3
|
import { borderRadius8 } from '../utilities/borderRadius';
|
|
3
4
|
import { Blue, Neutral } from '../utilities/colors';
|
|
4
5
|
import { space16 } from '../utilities/spacing';
|
|
@@ -6,15 +7,15 @@ var alignmentStyle = "\n&[data-text-align='right'] {\n > div {\n display: fl
|
|
|
6
7
|
export var StyledTable = styled.table.withConfig({
|
|
7
8
|
displayName: "DataTableStyle__StyledTable",
|
|
8
9
|
componentId: "sc-18v2ula-0"
|
|
9
|
-
})(["width:100%;height:100%;border:1px solid ", ";border-spacing:0;color:", ";max-width:100vw;border-bottom:0
|
|
10
|
+
})(["width:100%;height:100%;border:1px solid ", ";border-spacing:0;color:", ";max-width:100vw;border-bottom:0;thead tr{background:", ";}&[data-has-footer='true']{border-bottom:1px solid ", ";}&[data-loading='true']{tbody{position:relative;}.loader-container{display:block;z-index:1;}}"], Neutral.B85, Neutral.B18, Neutral.B99, Neutral.B85);
|
|
10
11
|
export var StyledTableRow = styled.tr.withConfig({
|
|
11
12
|
displayName: "DataTableStyle__StyledTableRow",
|
|
12
13
|
componentId: "sc-18v2ula-1"
|
|
13
|
-
})(["background:", ";box-shadow:inset 0px -1px 0px ", ";&:hover{background:", ";}
|
|
14
|
+
})(["background:", ";box-shadow:inset 0px -1px 0px ", ";&:hover{background:", ";}"], Neutral.B100, Neutral.B85, Neutral.B99);
|
|
14
15
|
export var StyledTabledHeader = styled.th.withConfig({
|
|
15
16
|
displayName: "DataTableStyle__StyledTabledHeader",
|
|
16
17
|
componentId: "sc-18v2ula-2"
|
|
17
|
-
})(["padding:", ";text-align:left;", " button{padding:0;margin:0;height:auto;border:none;box-shadow:none;}button:hover{background:transparent;}button:active{border:none;box-shadow:none;background:transparent;}button:focus{border:none;}button svg{width:24px;height:24px;fill:", ";}"], space16, alignmentStyle, Neutral.B40);
|
|
18
|
+
})(["padding:", ";text-align:left;", " button{padding:0;margin:0;height:auto;border:none;box-shadow:none;background:", ";}button:hover{background:transparent;}button:active{border:none;box-shadow:none;background:transparent;}button:focus{border:none;}button svg{width:24px;height:24px;fill:", ";}"], space16, alignmentStyle, Neutral.B99, Neutral.B40);
|
|
18
19
|
export var StyledTableCell = styled.td.withConfig({
|
|
19
20
|
displayName: "DataTableStyle__StyledTableCell",
|
|
20
21
|
componentId: "sc-18v2ula-3"
|
|
@@ -22,7 +23,7 @@ export var StyledTableCell = styled.td.withConfig({
|
|
|
22
23
|
export var StyledTableFooterRow = styled.tr.withConfig({
|
|
23
24
|
displayName: "DataTableStyle__StyledTableFooterRow",
|
|
24
25
|
componentId: "sc-18v2ula-4"
|
|
25
|
-
})(["background:", ";border-top:0;border-radius:0px 0px ", " ", ";td{padding:", ";}"], Neutral.
|
|
26
|
+
})(["background:", ";border-top:0;border-radius:0px 0px ", " ", ";td{padding:", ";}"], Neutral.B100, borderRadius8, borderRadius8, space16);
|
|
26
27
|
export var StyledTableLoadingRow = styled(StyledTableRow).withConfig({
|
|
27
28
|
displayName: "DataTableStyle__StyledTableLoadingRow",
|
|
28
29
|
componentId: "sc-18v2ula-5"
|
|
@@ -38,4 +39,4 @@ export var StyledSpinnerContainer = styled.div.withConfig({
|
|
|
38
39
|
export var StyledDataTableContainer = styled.div.withConfig({
|
|
39
40
|
displayName: "DataTableStyle__StyledDataTableContainer",
|
|
40
41
|
componentId: "sc-18v2ula-8"
|
|
41
|
-
})(["overflow-x:auto;scroll-behavior:smooth;"]);
|
|
42
|
+
})(["overflow-x:auto;scroll-behavior:smooth;box-shadow:", ";"], DropShadow.card);
|
|
@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react';
|
|
|
2
2
|
import { Button } from '../Button';
|
|
3
3
|
import { Icon } from '../Icon';
|
|
4
4
|
import { Typography } from '../Typography';
|
|
5
|
+
import { Neutral } from '../utilities/colors';
|
|
5
6
|
import { StyledTabledHeader } from './DataTableStyle';
|
|
6
7
|
export var TableHeader = function TableHeader(_ref) {
|
|
7
8
|
var sortDirectionProp = _ref.sortDirection,
|
|
@@ -21,7 +22,8 @@ export var TableHeader = function TableHeader(_ref) {
|
|
|
21
22
|
}) : null;
|
|
22
23
|
var titleMarkup = /*#__PURE__*/React.createElement(Typography, {
|
|
23
24
|
as: "span",
|
|
24
|
-
variant: "
|
|
25
|
+
variant: "body2",
|
|
26
|
+
color: Neutral.B18,
|
|
25
27
|
style: {
|
|
26
28
|
whiteSpace: 'nowrap'
|
|
27
29
|
}
|
package/es/@next/Menu/Menu.js
CHANGED
|
@@ -16,7 +16,7 @@ export var Menu = function Menu(_ref) {
|
|
|
16
16
|
};
|
|
17
17
|
return /*#__PURE__*/React.createElement(StyledMenu, {
|
|
18
18
|
id: menuId
|
|
19
|
-
}, /*#__PURE__*/React.createElement(TitleContainer, null, /*#__PURE__*/React.createElement(Typography, {
|
|
19
|
+
}, title && /*#__PURE__*/React.createElement(TitleContainer, null, /*#__PURE__*/React.createElement(Typography, {
|
|
20
20
|
variant: "subtitle2",
|
|
21
21
|
as: "span",
|
|
22
22
|
color: Neutral.B40
|
package/es/@next/index.d.ts
CHANGED
|
@@ -9,10 +9,12 @@ export { Alert, AlertContext, AlertContextProps, AlertProps, AlertProvider, Aler
|
|
|
9
9
|
export { Avatar, AvatarProps } from './Avatar';
|
|
10
10
|
export { Badge, BadgeProps } from './Badge';
|
|
11
11
|
export { Banner, BannerProps } from './Banner';
|
|
12
|
+
export { Bar, BarProps } from './Bar';
|
|
12
13
|
export { Button, ButtonProps, DestructiveButton, OutlineButton, OutlineMonochromeButton, PrimaryButton, } from './Button';
|
|
13
14
|
export { ButtonGroup, ButtonGroupProps } from './ButtonGroup';
|
|
14
15
|
export { Card, CardProps } from './Card';
|
|
15
16
|
export { Checkbox, CheckboxProps } from './Checkbox';
|
|
17
|
+
export { Combobox, ComboboxProps } from './Combobox';
|
|
16
18
|
export { CurrencyInput, CurrencyInputProps } from './CurrencyInput';
|
|
17
19
|
export { DataTable, DataTableProps, TableCellProps, TableHeaderProps, TableRowProps, } from './DataTable';
|
|
18
20
|
export { Divider } from './Divider';
|
package/es/@next/index.js
CHANGED
|
@@ -10,10 +10,12 @@ export { Alert, AlertContext, AlertContextProps, AlertProps, AlertProvider, Aler
|
|
|
10
10
|
export { Avatar, AvatarProps } from './Avatar';
|
|
11
11
|
export { Badge, BadgeProps } from './Badge';
|
|
12
12
|
export { Banner, BannerProps } from './Banner';
|
|
13
|
+
export { Bar, BarProps } from './Bar';
|
|
13
14
|
export { Button, ButtonProps, DestructiveButton, OutlineButton, OutlineMonochromeButton, PrimaryButton } from './Button';
|
|
14
15
|
export { ButtonGroup, ButtonGroupProps } from './ButtonGroup';
|
|
15
16
|
export { Card, CardProps } from './Card';
|
|
16
17
|
export { Checkbox, CheckboxProps } from './Checkbox';
|
|
18
|
+
export { Combobox, ComboboxProps } from './Combobox';
|
|
17
19
|
export { CurrencyInput, CurrencyInputProps } from './CurrencyInput';
|
|
18
20
|
export { DataTable, DataTableProps, TableCellProps, TableHeaderProps, TableRowProps } from './DataTable';
|
|
19
21
|
export { Divider } from './Divider';
|