@zendeskgarden/react-dropdowns 9.0.0-next.7 → 9.0.0-next.9
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/dist/esm/context/useComboboxContext.js +18 -0
- package/dist/esm/context/useFieldContext.js +18 -0
- package/dist/esm/context/useItemContext.js +18 -0
- package/dist/esm/context/useItemGroupContext.js +14 -0
- package/dist/esm/context/useMenuContext.js +18 -0
- package/dist/esm/context/useOptionContext.js +18 -0
- package/dist/esm/elements/combobox/Combobox.js +330 -0
- package/dist/esm/elements/combobox/Field.js +75 -0
- package/dist/esm/elements/combobox/Hint.js +57 -0
- package/dist/esm/elements/combobox/Label.js +68 -0
- package/dist/esm/elements/combobox/Listbox.js +155 -0
- package/dist/esm/elements/combobox/Message.js +63 -0
- package/dist/esm/elements/combobox/OptGroup.js +93 -0
- package/dist/esm/elements/combobox/Option.js +133 -0
- package/dist/esm/elements/combobox/OptionMeta.js +55 -0
- package/dist/esm/elements/combobox/Tag.js +98 -0
- package/dist/esm/elements/combobox/TagAvatar.js +13 -0
- package/dist/esm/elements/combobox/TagGroup.js +35 -0
- package/dist/esm/elements/combobox/utils.js +36 -0
- package/dist/esm/elements/menu/Item.js +140 -0
- package/dist/esm/elements/menu/ItemGroup.js +96 -0
- package/dist/esm/elements/menu/ItemMeta.js +55 -0
- package/dist/esm/elements/menu/Menu.js +157 -0
- package/dist/esm/elements/menu/MenuList.js +170 -0
- package/dist/esm/elements/menu/Separator.js +58 -0
- package/dist/esm/elements/menu/utils.js +55 -0
- package/dist/esm/index.js +19 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/check-lg-stroke.svg.js +28 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-down-stroke.svg.js +25 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-left-stroke.svg.js +25 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-right-stroke.svg.js +25 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/plus-stroke.svg.js +26 -0
- package/dist/esm/types/index.js +12 -0
- package/dist/esm/views/combobox/StyledCombobox.js +30 -0
- package/dist/esm/views/combobox/StyledContainer.js +22 -0
- package/dist/esm/views/combobox/StyledField.js +22 -0
- package/dist/esm/views/combobox/StyledFloatingListbox.js +27 -0
- package/dist/esm/views/combobox/StyledHint.js +23 -0
- package/dist/esm/views/combobox/StyledInput.js +41 -0
- package/dist/esm/views/combobox/StyledInputGroup.js +26 -0
- package/dist/esm/views/combobox/StyledInputIcon.js +43 -0
- package/dist/esm/views/combobox/StyledLabel.js +23 -0
- package/dist/esm/views/combobox/StyledListbox.js +31 -0
- package/dist/esm/views/combobox/StyledListboxSeparator.js +31 -0
- package/dist/esm/views/combobox/StyledMessage.js +23 -0
- package/dist/esm/views/combobox/StyledOptGroup.js +22 -0
- package/dist/esm/views/combobox/StyledOption.js +48 -0
- package/dist/esm/views/combobox/StyledOptionContent.js +22 -0
- package/dist/esm/views/combobox/StyledOptionIcon.js +29 -0
- package/dist/esm/views/combobox/StyledOptionMeta.js +31 -0
- package/dist/esm/views/combobox/StyledOptionTypeIcon.js +48 -0
- package/dist/esm/views/combobox/StyledTag.js +24 -0
- package/dist/esm/views/combobox/StyledTagsButton.js +28 -0
- package/dist/esm/views/combobox/StyledTrigger.js +94 -0
- package/dist/esm/views/combobox/StyledValue.js +32 -0
- package/dist/esm/views/menu/StyledButton.js +23 -0
- package/dist/esm/views/menu/StyledFloatingMenu.js +23 -0
- package/dist/esm/views/menu/StyledItem.js +23 -0
- package/dist/esm/views/menu/StyledItemContent.js +23 -0
- package/dist/esm/views/menu/StyledItemGroup.js +23 -0
- package/dist/esm/views/menu/StyledItemIcon.js +23 -0
- package/dist/esm/views/menu/StyledItemMeta.js +23 -0
- package/dist/esm/views/menu/StyledItemTypeIcon.js +24 -0
- package/dist/esm/views/menu/StyledMenu.js +27 -0
- package/dist/esm/views/menu/StyledSeparator.js +23 -0
- package/dist/index.cjs.js +86 -128
- package/dist/typings/views/combobox/StyledInputIcon.d.ts +6 -6
- package/dist/typings/views/combobox/StyledOptionIcon.d.ts +1 -1
- package/dist/typings/views/combobox/StyledOptionTypeIcon.d.ts +3 -3
- package/dist/typings/views/menu/StyledButton.d.ts +2 -2
- package/dist/typings/views/menu/StyledItemIcon.d.ts +1 -1
- package/dist/typings/views/menu/StyledItemTypeIcon.d.ts +1 -1
- package/package.json +9 -9
- package/dist/index.esm.js +0 -1969
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'dropdowns.combobox.optgroup';
|
|
11
|
+
const StyledOptGroup = styled.ul.attrs({
|
|
12
|
+
'data-garden-id': COMPONENT_ID,
|
|
13
|
+
'data-garden-version': '9.0.0-next.9'
|
|
14
|
+
}).withConfig({
|
|
15
|
+
displayName: "StyledOptGroup",
|
|
16
|
+
componentId: "sc-1kavqsx-0"
|
|
17
|
+
})(["margin:0;padding:0;list-style-type:none;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
|
+
StyledOptGroup.defaultProps = {
|
|
19
|
+
theme: DEFAULT_THEME
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { StyledOptGroup };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { hideVisually, math } from 'polished';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'dropdowns.combobox.option';
|
|
12
|
+
const colorStyles = props => {
|
|
13
|
+
let backgroundColor;
|
|
14
|
+
let boxShadow;
|
|
15
|
+
if (props.isActive && props.$type !== 'group' && props.$type !== 'header') {
|
|
16
|
+
const hue = props.$type === 'danger' ? 'dangerHue' : 'primaryHue';
|
|
17
|
+
backgroundColor = getColorV8(hue, 600, props.theme, 0.08);
|
|
18
|
+
boxShadow = `inset ${props.theme.rtl ? `-${props.theme.shadowWidths.md}` : props.theme.shadowWidths.md} 0 ${getColorV8(hue, 600, props.theme)}`;
|
|
19
|
+
}
|
|
20
|
+
const disabledForegroundColor = getColorV8('neutralHue', 400, props.theme);
|
|
21
|
+
let foregroundColor = getColorV8('foreground', 600 , props.theme);
|
|
22
|
+
if (props.$type === 'add') {
|
|
23
|
+
foregroundColor = getColorV8('primaryHue', 600, props.theme);
|
|
24
|
+
} else if (props.$type === 'danger') {
|
|
25
|
+
foregroundColor = getColorV8('dangerHue', 600, props.theme);
|
|
26
|
+
}
|
|
27
|
+
return css(["box-shadow:", ";background-color:", ";color:", ";&[aria-disabled='true']{background-color:transparent;color:", ";}"], boxShadow, backgroundColor, foregroundColor, disabledForegroundColor);
|
|
28
|
+
};
|
|
29
|
+
const getMinHeight = props => props.theme.space.base * (props.isCompact ? 7 : 9);
|
|
30
|
+
const sizeStyles = props => {
|
|
31
|
+
const lineHeight = props.theme.lineHeights.md;
|
|
32
|
+
const minHeight = getMinHeight(props);
|
|
33
|
+
const paddingHorizontal = props.$type === 'group' ? 0 : `${props.theme.space.base * 9}px`;
|
|
34
|
+
const paddingVertical = props.$type === 'group' ? 0 : math(`(${minHeight} - ${lineHeight}) / 2`);
|
|
35
|
+
return css(["box-sizing:border-box;padding:", " ", ";min-height:", "px;line-height:", ";"], paddingVertical, paddingHorizontal, minHeight, lineHeight);
|
|
36
|
+
};
|
|
37
|
+
const StyledOption = styled.li.attrs({
|
|
38
|
+
'data-garden-id': COMPONENT_ID,
|
|
39
|
+
'data-garden-version': '9.0.0-next.9'
|
|
40
|
+
}).withConfig({
|
|
41
|
+
displayName: "StyledOption",
|
|
42
|
+
componentId: "sc-jl4wn6-0"
|
|
43
|
+
})(["display:flex;position:relative;transition:color 0.25s ease-in-out;cursor:", ";overflow-wrap:anywhere;font-weight:", ";user-select:none;&:focus{outline:none;}", ";", ";&[aria-disabled='true']{cursor:default;}&[aria-hidden='true']{", ";}", ";"], props => props.$type === 'group' || props.$type === 'header' ? 'default' : 'pointer', props => props.$type === 'header' || props.$type === 'previous' ? props.theme.fontWeights.semibold : props.theme.fontWeights.regular, sizeStyles, colorStyles, hideVisually(), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
44
|
+
StyledOption.defaultProps = {
|
|
45
|
+
theme: DEFAULT_THEME
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export { StyledOption, getMinHeight };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'dropdowns.combobox.option.content';
|
|
11
|
+
const StyledOptionContent = styled.div.attrs({
|
|
12
|
+
'data-garden-id': COMPONENT_ID,
|
|
13
|
+
'data-garden-version': '9.0.0-next.9'
|
|
14
|
+
}).withConfig({
|
|
15
|
+
displayName: "StyledOptionContent",
|
|
16
|
+
componentId: "sc-121ujpu-0"
|
|
17
|
+
})(["display:flex;flex-direction:column;flex-grow:1;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
|
+
StyledOptionContent.defaultProps = {
|
|
19
|
+
theme: DEFAULT_THEME
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { StyledOptionContent };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { math } from 'polished';
|
|
9
|
+
import { StyledBaseIcon, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'dropdowns.combobox.option.icon';
|
|
12
|
+
const sizeStyles = props => {
|
|
13
|
+
const size = props.theme.iconSizes.md;
|
|
14
|
+
const marginTop = math(`(${props.theme.lineHeights.md} - ${size}) / 2`);
|
|
15
|
+
const marginHorizontal = `${props.theme.space.base * 2}px`;
|
|
16
|
+
return css(["margin-top:", ";margin-", ":", ";width:", ";height:", ";"], marginTop, props.theme.rtl ? 'left' : 'right', marginHorizontal, size, size);
|
|
17
|
+
};
|
|
18
|
+
const StyledOptionIcon = styled(StyledBaseIcon).attrs({
|
|
19
|
+
'data-garden-id': COMPONENT_ID,
|
|
20
|
+
'data-garden-version': '9.0.0-next.9'
|
|
21
|
+
}).withConfig({
|
|
22
|
+
displayName: "StyledOptionIcon",
|
|
23
|
+
componentId: "sc-qsab3y-0"
|
|
24
|
+
})(["flex-shrink:0;", ";", ";"], sizeStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
25
|
+
StyledOptionIcon.defaultProps = {
|
|
26
|
+
theme: DEFAULT_THEME
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export { StyledOptionIcon };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'dropdowns.combobox.option.meta';
|
|
11
|
+
const colorStyles = props => {
|
|
12
|
+
const color = getColorV8('neutralHue', props.isDisabled ? 400 : 600, props.theme);
|
|
13
|
+
return css(["color:", ";"], color);
|
|
14
|
+
};
|
|
15
|
+
const sizeStyles = props => {
|
|
16
|
+
const lineHeight = props.theme.lineHeights.sm;
|
|
17
|
+
const fontSize = props.theme.fontSizes.sm;
|
|
18
|
+
return css(["line-height:", ";font-size:", ";"], lineHeight, fontSize);
|
|
19
|
+
};
|
|
20
|
+
const StyledOptionMeta = styled.div.attrs({
|
|
21
|
+
'data-garden-id': COMPONENT_ID,
|
|
22
|
+
'data-garden-version': '9.0.0-next.9'
|
|
23
|
+
}).withConfig({
|
|
24
|
+
displayName: "StyledOptionMeta",
|
|
25
|
+
componentId: "sc-j6pu10-0"
|
|
26
|
+
})(["transition:color 0.25s ease-in-out;font-weight:", ";", ";", ";", ";"], props => props.theme.fontWeights.regular, sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
27
|
+
StyledOptionMeta.defaultProps = {
|
|
28
|
+
theme: DEFAULT_THEME
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { StyledOptionMeta };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { math } from 'polished';
|
|
9
|
+
import { StyledBaseIcon, retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { StyledOption, getMinHeight } from './StyledOption.js';
|
|
11
|
+
|
|
12
|
+
const COMPONENT_ID = 'dropdowns.combobox.option.type_icon';
|
|
13
|
+
const colorStyles = props => {
|
|
14
|
+
const opacity = props.$type && props.$type !== 'danger' ? 1 : 0;
|
|
15
|
+
let color;
|
|
16
|
+
if (props.$type === 'add' || props.$type === 'danger') {
|
|
17
|
+
color = 'inherit';
|
|
18
|
+
} else if (props.$type === 'header' || props.$type === 'next' || props.$type === 'previous') {
|
|
19
|
+
color = getColorV8('neutralHue', 600, props.theme);
|
|
20
|
+
} else {
|
|
21
|
+
color = getColorV8('primaryHue', 600, props.theme);
|
|
22
|
+
}
|
|
23
|
+
return css(["opacity:", ";color:", ";", "[aria-selected='true'] > &{opacity:1;}", "[aria-disabled='true'] > &{color:inherit;}"], opacity, color, StyledOption, StyledOption);
|
|
24
|
+
};
|
|
25
|
+
const sizeStyles = props => {
|
|
26
|
+
const size = props.theme.iconSizes.md;
|
|
27
|
+
const position = `${props.theme.space.base * 3}px`;
|
|
28
|
+
const top = math(`(${getMinHeight(props)} - ${size}) / 2`);
|
|
29
|
+
let side;
|
|
30
|
+
if (props.$type === 'next') {
|
|
31
|
+
side = props.theme.rtl ? 'left' : 'right';
|
|
32
|
+
} else {
|
|
33
|
+
side = props.theme.rtl ? 'right' : 'left';
|
|
34
|
+
}
|
|
35
|
+
return css(["top:", ";", ":", ";width:", ";height:", ";"], top, side, position, size, size);
|
|
36
|
+
};
|
|
37
|
+
const StyledOptionTypeIcon = styled(StyledBaseIcon).attrs({
|
|
38
|
+
'data-garden-id': COMPONENT_ID,
|
|
39
|
+
'data-garden-version': '9.0.0-next.9'
|
|
40
|
+
}).withConfig({
|
|
41
|
+
displayName: "StyledOptionTypeIcon",
|
|
42
|
+
componentId: "sc-xpink2-0"
|
|
43
|
+
})(["position:absolute;transform:", ";transition:opacity 0.1s ease-in-out;", ";", ";", ";"], props => props.theme.rtl && (props.$type === 'next' || props.$type === 'previous') && 'rotate(180deg)', sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
44
|
+
StyledOptionTypeIcon.defaultProps = {
|
|
45
|
+
theme: DEFAULT_THEME
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export { StyledOptionTypeIcon };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { hideVisually } from 'polished';
|
|
9
|
+
import { getColorV8, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { Tag } from '@zendeskgarden/react-tags';
|
|
11
|
+
|
|
12
|
+
const COMPONENT_ID = 'dropdowns.combobox.tag';
|
|
13
|
+
const StyledTag = styled(Tag).attrs({
|
|
14
|
+
'data-garden-id': COMPONENT_ID,
|
|
15
|
+
'data-garden-version': '9.0.0-next.9'
|
|
16
|
+
}).withConfig({
|
|
17
|
+
displayName: "StyledTag",
|
|
18
|
+
componentId: "sc-1alam0r-0"
|
|
19
|
+
})(["&[aria-disabled='true']{color:", ";}&[hidden]{display:revert;", "}", ";"], props => props.hue ? undefined : getColorV8('neutralHue', 400, props.theme), hideVisually(), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
20
|
+
StyledTag.defaultProps = {
|
|
21
|
+
theme: DEFAULT_THEME
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { StyledTag };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledValue } from './StyledValue.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'dropdowns.combobox.tags_button';
|
|
12
|
+
const colorStyles = props => {
|
|
13
|
+
const color = getColorV8('primaryHue', 600, props.theme);
|
|
14
|
+
return css(["color:", ";&:disabled{color:inherit;}"], color);
|
|
15
|
+
};
|
|
16
|
+
const StyledTagsButton = styled(StyledValue).attrs({
|
|
17
|
+
as: 'button',
|
|
18
|
+
'data-garden-id': COMPONENT_ID,
|
|
19
|
+
'data-garden-version': '9.0.0-next.9'
|
|
20
|
+
}).withConfig({
|
|
21
|
+
displayName: "StyledTagsButton",
|
|
22
|
+
componentId: "sc-6q5w33-0"
|
|
23
|
+
})(["display:inline-flex;flex:0 1 auto;align-items:center;border:none;background-color:transparent;cursor:pointer;min-width:auto;font-family:inherit;&:hover{text-decoration:underline;}", ";&:disabled{cursor:default;text-decoration:none;}", ";"], colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
24
|
+
StyledTagsButton.defaultProps = {
|
|
25
|
+
theme: DEFAULT_THEME
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { StyledTagsButton };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { math } from 'polished';
|
|
9
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColorV8, focusStyles } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { getHeight } from './StyledInput.js';
|
|
11
|
+
|
|
12
|
+
const COMPONENT_ID = 'dropdowns.combobox.trigger';
|
|
13
|
+
const colorStyles = props => {
|
|
14
|
+
const SHADE = 600;
|
|
15
|
+
let hue = 'neutralHue';
|
|
16
|
+
if (props.validation === 'success') {
|
|
17
|
+
hue = 'successHue';
|
|
18
|
+
} else if (props.validation === 'warning') {
|
|
19
|
+
hue = 'warningHue';
|
|
20
|
+
} else if (props.validation === 'error') {
|
|
21
|
+
hue = 'dangerHue';
|
|
22
|
+
}
|
|
23
|
+
const backgroundColor = props.isBare ? 'transparent' : getColorV8('background', 600 , props.theme);
|
|
24
|
+
let borderColor;
|
|
25
|
+
let hoverBorderColor;
|
|
26
|
+
let focusBorderColor;
|
|
27
|
+
let focusShade;
|
|
28
|
+
if (props.validation) {
|
|
29
|
+
borderColor = getColorV8(hue, SHADE, props.theme);
|
|
30
|
+
hoverBorderColor = borderColor;
|
|
31
|
+
if (props.validation === 'warning') {
|
|
32
|
+
focusBorderColor = getColorV8(hue, SHADE + 100, props.theme);
|
|
33
|
+
focusShade = SHADE + 100;
|
|
34
|
+
} else {
|
|
35
|
+
focusBorderColor = borderColor;
|
|
36
|
+
}
|
|
37
|
+
} else {
|
|
38
|
+
borderColor = getColorV8('neutralHue', SHADE - 300, props.theme);
|
|
39
|
+
hoverBorderColor = getColorV8('primaryHue', SHADE, props.theme);
|
|
40
|
+
focusBorderColor = hoverBorderColor;
|
|
41
|
+
}
|
|
42
|
+
const disabledBackgroundColor = props.isBare ? undefined : getColorV8('neutralHue', SHADE - 500, props.theme);
|
|
43
|
+
const disabledBorderColor = getColorV8('neutralHue', SHADE - 400, props.theme);
|
|
44
|
+
const disabledForegroundColor = getColorV8('neutralHue', SHADE - 200, props.theme);
|
|
45
|
+
const focusSelector = `
|
|
46
|
+
&:focus-within:not([aria-disabled='true']),
|
|
47
|
+
&:focus-visible
|
|
48
|
+
`;
|
|
49
|
+
return css(["border-color:", ";background-color:", ";color:", ";&:hover{border-color:", ";}", " &[aria-disabled='true']{border-color:", ";background-color:", ";color:", ";}"], props.isLabelHovered ? hoverBorderColor : borderColor, backgroundColor, getColorV8('foreground', 600 , props.theme), hoverBorderColor, focusStyles({
|
|
50
|
+
theme: props.theme,
|
|
51
|
+
inset: props.focusInset,
|
|
52
|
+
color: {
|
|
53
|
+
hue: focusBorderColor,
|
|
54
|
+
shade: focusShade
|
|
55
|
+
},
|
|
56
|
+
selector: focusSelector,
|
|
57
|
+
styles: {
|
|
58
|
+
borderColor: focusBorderColor
|
|
59
|
+
},
|
|
60
|
+
condition: !props.isBare
|
|
61
|
+
}), disabledBorderColor, disabledBackgroundColor, disabledForegroundColor);
|
|
62
|
+
};
|
|
63
|
+
const sizeStyles = props => {
|
|
64
|
+
const inputHeight = getHeight(props);
|
|
65
|
+
let minHeight;
|
|
66
|
+
let horizontalPadding;
|
|
67
|
+
if (props.isBare) {
|
|
68
|
+
if (props.isMultiselectable) {
|
|
69
|
+
minHeight = math(`${props.theme.shadowWidths.sm} * 2 + ${inputHeight}`);
|
|
70
|
+
horizontalPadding = props.theme.shadowWidths.sm;
|
|
71
|
+
} else {
|
|
72
|
+
minHeight = `${inputHeight}px`;
|
|
73
|
+
horizontalPadding = '0';
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
minHeight = `${props.theme.space.base * (props.isCompact ? 3 : 2) + inputHeight}px`;
|
|
77
|
+
horizontalPadding = `${props.theme.space.base * 3}px`;
|
|
78
|
+
}
|
|
79
|
+
const maxHeight = props.maxHeight || minHeight;
|
|
80
|
+
const verticalPadding = math(`(${minHeight} - ${inputHeight} - (${props.isBare ? 0 : props.theme.borderWidths.sm} * 2)) / 2`);
|
|
81
|
+
return css(["padding:", " ", ";min-height:", ";max-height:", ";font-size:", ";"], verticalPadding, horizontalPadding, minHeight, maxHeight, props.theme.fontSizes.md);
|
|
82
|
+
};
|
|
83
|
+
const StyledTrigger = styled.div.attrs({
|
|
84
|
+
'data-garden-id': COMPONENT_ID,
|
|
85
|
+
'data-garden-version': '9.0.0-next.9'
|
|
86
|
+
}).withConfig({
|
|
87
|
+
displayName: "StyledTrigger",
|
|
88
|
+
componentId: "sc-116nftk-0"
|
|
89
|
+
})(["overflow-y:auto;transition:border-color 0.25s ease-in-out,box-shadow 0.1s ease-in-out,background-color 0.25s ease-in-out,color 0.25s ease-in-out;border:", ";border-radius:", ";cursor:", ";box-sizing:border-box;", ";&:focus{outline:none;}", ";&[aria-disabled='true']{cursor:default;}", ";"], props => props.isBare ? 'none' : props.theme.borders.sm, props => props.isBare ? '0' : props.theme.borderRadii.md, props => !props.isAutocomplete && props.isEditable ? 'text' : 'pointer', sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
90
|
+
StyledTrigger.defaultProps = {
|
|
91
|
+
theme: DEFAULT_THEME
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export { StyledTrigger };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { sizeStyles } from './StyledInput.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'dropdowns.combobox.value';
|
|
12
|
+
const colorStyles = props => {
|
|
13
|
+
const foregroundColor = props.isPlaceholder && getColorV8('neutralHue', 400, props.theme);
|
|
14
|
+
return css(["color:", ";"], foregroundColor);
|
|
15
|
+
};
|
|
16
|
+
const StyledValue = styled.div.attrs({
|
|
17
|
+
'data-garden-id': COMPONENT_ID,
|
|
18
|
+
'data-garden-version': '9.0.0-next.9'
|
|
19
|
+
}).withConfig({
|
|
20
|
+
displayName: "StyledValue",
|
|
21
|
+
componentId: "sc-t719sx-0"
|
|
22
|
+
})(["flex-basis:0;flex-grow:1;cursor:", ";overflow:hidden;text-overflow:ellipsis;white-space:pre;user-select:none;", ";", ";&[hidden]{display:none;}", ";"], props => {
|
|
23
|
+
if (props.isDisabled) {
|
|
24
|
+
return 'default';
|
|
25
|
+
}
|
|
26
|
+
return props.isEditable && !props.isAutocomplete ? 'text' : 'pointer';
|
|
27
|
+
}, sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
28
|
+
StyledValue.defaultProps = {
|
|
29
|
+
theme: DEFAULT_THEME
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { StyledValue };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { Button } from '@zendeskgarden/react-buttons';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'dropdowns.menu.button';
|
|
12
|
+
const StyledButton = styled(Button).attrs({
|
|
13
|
+
'data-garden-id': COMPONENT_ID,
|
|
14
|
+
'data-garden-version': '9.0.0-next.9'
|
|
15
|
+
}).withConfig({
|
|
16
|
+
displayName: "StyledButton",
|
|
17
|
+
componentId: "sc-5hs2jg-0"
|
|
18
|
+
})(["", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
19
|
+
StyledButton.defaultProps = {
|
|
20
|
+
theme: DEFAULT_THEME
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { StyledButton };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledFloatingListbox } from '../combobox/StyledFloatingListbox.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'dropdowns.menu.floating';
|
|
12
|
+
const StyledFloatingMenu = styled(StyledFloatingListbox).attrs({
|
|
13
|
+
'data-garden-id': COMPONENT_ID,
|
|
14
|
+
'data-garden-version': '9.0.0-next.9'
|
|
15
|
+
}).withConfig({
|
|
16
|
+
displayName: "StyledFloatingMenu",
|
|
17
|
+
componentId: "sc-1rc7ahb-0"
|
|
18
|
+
})(["", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
19
|
+
StyledFloatingMenu.defaultProps = {
|
|
20
|
+
theme: DEFAULT_THEME
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { StyledFloatingMenu };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledOption } from '../combobox/StyledOption.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'dropdowns.menu.item';
|
|
12
|
+
const StyledItem = styled(StyledOption).attrs({
|
|
13
|
+
'data-garden-id': COMPONENT_ID,
|
|
14
|
+
'data-garden-version': '9.0.0-next.9'
|
|
15
|
+
}).withConfig({
|
|
16
|
+
displayName: "StyledItem",
|
|
17
|
+
componentId: "sc-1jp99dq-0"
|
|
18
|
+
})(["", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
19
|
+
StyledItem.defaultProps = {
|
|
20
|
+
theme: DEFAULT_THEME
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { StyledItem };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledOptionContent } from '../combobox/StyledOptionContent.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'dropdowns.menu.item.content';
|
|
12
|
+
const StyledItemContent = styled(StyledOptionContent).attrs({
|
|
13
|
+
'data-garden-id': COMPONENT_ID,
|
|
14
|
+
'data-garden-version': '9.0.0-next.9'
|
|
15
|
+
}).withConfig({
|
|
16
|
+
displayName: "StyledItemContent",
|
|
17
|
+
componentId: "sc-1opglsb-0"
|
|
18
|
+
})(["", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
19
|
+
StyledItemContent.defaultProps = {
|
|
20
|
+
theme: DEFAULT_THEME
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { StyledItemContent };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledOptGroup } from '../combobox/StyledOptGroup.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'dropdowns.menu.item_group';
|
|
12
|
+
const StyledItemGroup = styled(StyledOptGroup).attrs({
|
|
13
|
+
'data-garden-id': COMPONENT_ID,
|
|
14
|
+
'data-garden-version': '9.0.0-next.9'
|
|
15
|
+
}).withConfig({
|
|
16
|
+
displayName: "StyledItemGroup",
|
|
17
|
+
componentId: "sc-1umk3cg-0"
|
|
18
|
+
})(["", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
19
|
+
StyledItemGroup.defaultProps = {
|
|
20
|
+
theme: DEFAULT_THEME
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { StyledItemGroup };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledOptionIcon } from '../combobox/StyledOptionIcon.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'dropdowns.menu.item.icon';
|
|
12
|
+
const StyledItemIcon = styled(StyledOptionIcon).attrs({
|
|
13
|
+
'data-garden-id': COMPONENT_ID,
|
|
14
|
+
'data-garden-version': '9.0.0-next.9'
|
|
15
|
+
}).withConfig({
|
|
16
|
+
displayName: "StyledItemIcon",
|
|
17
|
+
componentId: "sc-w9orqb-0"
|
|
18
|
+
})(["", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
19
|
+
StyledItemIcon.defaultProps = {
|
|
20
|
+
theme: DEFAULT_THEME
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { StyledItemIcon };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledOptionMeta } from '../combobox/StyledOptionMeta.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'dropdowns.menu.item.meta';
|
|
12
|
+
const StyledItemMeta = styled(StyledOptionMeta).attrs({
|
|
13
|
+
'data-garden-id': COMPONENT_ID,
|
|
14
|
+
'data-garden-version': '9.0.0-next.9'
|
|
15
|
+
}).withConfig({
|
|
16
|
+
displayName: "StyledItemMeta",
|
|
17
|
+
componentId: "sc-1unw3x1-0"
|
|
18
|
+
})(["", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
19
|
+
StyledItemMeta.defaultProps = {
|
|
20
|
+
theme: DEFAULT_THEME
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { StyledItemMeta };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledOptionTypeIcon } from '../combobox/StyledOptionTypeIcon.js';
|
|
10
|
+
import { StyledItem } from './StyledItem.js';
|
|
11
|
+
|
|
12
|
+
const COMPONENT_ID = 'dropdowns.menu.item.type_icon';
|
|
13
|
+
const StyledItemTypeIcon = styled(StyledOptionTypeIcon).attrs({
|
|
14
|
+
'data-garden-id': COMPONENT_ID,
|
|
15
|
+
'data-garden-version': '9.0.0-next.9'
|
|
16
|
+
}).withConfig({
|
|
17
|
+
displayName: "StyledItemTypeIcon",
|
|
18
|
+
componentId: "sc-1pll3nu-0"
|
|
19
|
+
})(["", "[aria-checked='true'] > &{opacity:1;}", ";"], StyledItem, props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
20
|
+
StyledItemTypeIcon.defaultProps = {
|
|
21
|
+
theme: DEFAULT_THEME
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { StyledItemTypeIcon };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { arrowStyles, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledListbox } from '../combobox/StyledListbox.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'dropdowns.menu';
|
|
12
|
+
const StyledMenu = styled(StyledListbox).attrs({
|
|
13
|
+
'data-garden-id': COMPONENT_ID,
|
|
14
|
+
'data-garden-version': '9.0.0-next.9'
|
|
15
|
+
}).withConfig({
|
|
16
|
+
displayName: "StyledMenu",
|
|
17
|
+
componentId: "sc-f77ntu-0"
|
|
18
|
+
})(["position:static !important;", ";", ";"], props => props.arrowPosition && arrowStyles(props.arrowPosition, {
|
|
19
|
+
size: `${props.theme.space.base * 2}px`,
|
|
20
|
+
inset: '2px',
|
|
21
|
+
animationModifier: '[data-garden-animate-arrow="true"]'
|
|
22
|
+
}), props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
23
|
+
StyledMenu.defaultProps = {
|
|
24
|
+
theme: DEFAULT_THEME
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { StyledMenu };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
import { StyledListboxSeparator } from '../combobox/StyledListboxSeparator.js';
|
|
10
|
+
|
|
11
|
+
const COMPONENT_ID = 'dropdowns.menu.separator';
|
|
12
|
+
const StyledSeparator = styled(StyledListboxSeparator).attrs({
|
|
13
|
+
'data-garden-id': COMPONENT_ID,
|
|
14
|
+
'data-garden-version': '9.0.0-next.9'
|
|
15
|
+
}).withConfig({
|
|
16
|
+
displayName: "StyledSeparator",
|
|
17
|
+
componentId: "sc-8kqwen-0"
|
|
18
|
+
})(["", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
19
|
+
StyledSeparator.defaultProps = {
|
|
20
|
+
theme: DEFAULT_THEME
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { StyledSeparator };
|