@zendeskgarden/react-dropdowns 9.0.0-next.2 → 9.0.0-next.21

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.
Files changed (157) hide show
  1. package/README.md +73 -69
  2. package/dist/esm/context/useComboboxContext.js +18 -0
  3. package/dist/esm/context/useFieldContext.js +18 -0
  4. package/dist/esm/context/useItemContext.js +18 -0
  5. package/dist/esm/context/useItemGroupContext.js +14 -0
  6. package/dist/esm/context/useMenuContext.js +18 -0
  7. package/dist/esm/context/useOptionContext.js +18 -0
  8. package/dist/esm/elements/combobox/Combobox.js +329 -0
  9. package/dist/esm/elements/combobox/Field.js +74 -0
  10. package/dist/esm/elements/combobox/Hint.js +56 -0
  11. package/dist/esm/elements/combobox/Label.js +67 -0
  12. package/dist/esm/elements/combobox/Listbox.js +154 -0
  13. package/dist/esm/elements/combobox/Message.js +62 -0
  14. package/dist/esm/elements/combobox/OptGroup.js +92 -0
  15. package/dist/esm/elements/combobox/Option.js +136 -0
  16. package/dist/esm/elements/combobox/OptionMeta.js +54 -0
  17. package/dist/esm/elements/combobox/Tag.js +97 -0
  18. package/dist/esm/elements/combobox/TagAvatar.js +13 -0
  19. package/dist/esm/elements/combobox/TagGroup.js +35 -0
  20. package/dist/esm/elements/combobox/utils.js +36 -0
  21. package/dist/esm/elements/menu/Item.js +141 -0
  22. package/dist/esm/elements/menu/ItemGroup.js +95 -0
  23. package/dist/esm/elements/menu/ItemMeta.js +54 -0
  24. package/dist/esm/elements/menu/Menu.js +126 -0
  25. package/dist/esm/elements/menu/MenuList.js +169 -0
  26. package/dist/esm/elements/menu/Separator.js +57 -0
  27. package/dist/esm/elements/menu/utils.js +55 -0
  28. package/dist/esm/index.js +19 -0
  29. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/check-lg-stroke.svg.js +28 -0
  30. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-down-stroke.svg.js +25 -0
  31. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-left-stroke.svg.js +25 -0
  32. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/chevron-right-stroke.svg.js +25 -0
  33. package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/plus-stroke.svg.js +26 -0
  34. package/dist/esm/types/index.js +12 -0
  35. package/dist/esm/views/combobox/StyledCombobox.js +30 -0
  36. package/dist/esm/views/combobox/StyledContainer.js +22 -0
  37. package/dist/esm/views/combobox/StyledField.js +22 -0
  38. package/dist/esm/views/combobox/StyledFloatingListbox.js +27 -0
  39. package/dist/esm/views/combobox/StyledHint.js +23 -0
  40. package/dist/esm/views/combobox/StyledInput.js +47 -0
  41. package/dist/esm/views/combobox/StyledInputGroup.js +26 -0
  42. package/dist/esm/views/combobox/StyledInputIcon.js +62 -0
  43. package/dist/esm/views/combobox/StyledLabel.js +23 -0
  44. package/dist/esm/views/combobox/StyledListbox.js +31 -0
  45. package/dist/esm/views/combobox/StyledListboxSeparator.js +37 -0
  46. package/dist/esm/views/combobox/StyledMessage.js +23 -0
  47. package/dist/esm/views/combobox/StyledOptGroup.js +22 -0
  48. package/dist/esm/views/combobox/StyledOption.js +69 -0
  49. package/dist/esm/views/combobox/StyledOptionContent.js +22 -0
  50. package/dist/esm/views/combobox/StyledOptionIcon.js +51 -0
  51. package/dist/esm/views/combobox/StyledOptionMeta.js +39 -0
  52. package/dist/esm/views/combobox/StyledOptionTypeIcon.js +58 -0
  53. package/dist/esm/views/combobox/StyledTag.js +27 -0
  54. package/dist/esm/views/combobox/StyledTagsButton.js +34 -0
  55. package/dist/esm/views/combobox/StyledTrigger.js +125 -0
  56. package/dist/esm/views/combobox/StyledValue.js +39 -0
  57. package/dist/esm/views/menu/StyledFloatingMenu.js +23 -0
  58. package/dist/esm/views/menu/StyledItem.js +23 -0
  59. package/dist/esm/views/menu/StyledItemContent.js +23 -0
  60. package/dist/esm/views/menu/StyledItemGroup.js +23 -0
  61. package/dist/esm/views/menu/StyledItemIcon.js +23 -0
  62. package/dist/esm/views/menu/StyledItemMeta.js +23 -0
  63. package/dist/esm/views/menu/StyledItemTypeIcon.js +24 -0
  64. package/dist/esm/views/menu/StyledMenu.js +27 -0
  65. package/dist/esm/views/menu/StyledSeparator.js +23 -0
  66. package/dist/index.cjs.js +1780 -1763
  67. package/dist/typings/context/useComboboxContext.d.ts +25 -0
  68. package/dist/typings/context/useFieldContext.d.ts +32 -0
  69. package/dist/typings/context/useItemContext.d.ts +14 -0
  70. package/dist/typings/context/useItemGroupContext.d.ts +15 -0
  71. package/dist/typings/context/useMenuContext.d.ts +23 -0
  72. package/dist/typings/context/useOptionContext.d.ts +14 -0
  73. package/dist/typings/elements/{Combobox → combobox}/Combobox.d.ts +0 -2
  74. package/dist/typings/elements/{Fields → combobox}/Field.d.ts +8 -1
  75. package/dist/typings/elements/{Fields → combobox}/Hint.d.ts +2 -0
  76. package/dist/typings/elements/{Fields → combobox}/Label.d.ts +3 -1
  77. package/dist/typings/elements/{Menu/Items/MediaBody.d.ts → combobox/Listbox.d.ts} +2 -4
  78. package/dist/typings/elements/{Fields → combobox}/Message.d.ts +3 -1
  79. package/dist/typings/elements/{Menu/Items/HeaderItem.d.ts → combobox/OptGroup.d.ts} +2 -2
  80. package/dist/typings/elements/{Menu/Items/MediaItem.d.ts → combobox/Option.d.ts} +5 -2
  81. package/dist/typings/elements/{Menu/Items/HeaderIcon.d.ts → combobox/OptionMeta.d.ts} +1 -1
  82. package/dist/typings/elements/combobox/Tag.d.ts +15 -0
  83. package/dist/typings/elements/combobox/TagAvatar.d.ts +14 -0
  84. package/dist/typings/elements/combobox/TagGroup.d.ts +12 -0
  85. package/dist/typings/elements/combobox/utils.d.ts +30 -0
  86. package/dist/typings/elements/{Menu/Items → menu}/Item.d.ts +5 -2
  87. package/dist/typings/elements/{Menu/Items/AddItem.d.ts → menu/ItemGroup.d.ts} +2 -2
  88. package/dist/typings/elements/{Menu/Items → menu}/ItemMeta.d.ts +2 -2
  89. package/dist/typings/elements/{Menu → menu}/Menu.d.ts +0 -2
  90. package/dist/typings/elements/menu/MenuList.d.ts +12 -0
  91. package/dist/typings/elements/{Menu → menu}/Separator.d.ts +1 -1
  92. package/dist/typings/elements/menu/utils.d.ts +29 -0
  93. package/dist/typings/index.d.ts +18 -25
  94. package/dist/typings/types/index.d.ts +242 -121
  95. package/dist/typings/{styled/items/StyledItemIcon.d.ts → views/combobox/StyledCombobox.d.ts} +4 -6
  96. package/dist/typings/{styled/multiselect/StyledMultiselectItemWrapper.d.ts → views/combobox/StyledContainer.d.ts} +1 -1
  97. package/dist/typings/{styled/select/StyledSelect.d.ts → views/combobox/StyledField.d.ts} +1 -1
  98. package/dist/typings/views/combobox/StyledFloatingListbox.d.ts +18 -0
  99. package/dist/typings/views/combobox/StyledHint.d.ts +11 -0
  100. package/dist/typings/views/combobox/StyledInput.d.ts +20 -0
  101. package/dist/typings/{styled/items/StyledAddItem.d.ts → views/combobox/StyledInputGroup.d.ts} +2 -4
  102. package/dist/typings/views/combobox/StyledInputIcon.d.ts +20 -0
  103. package/dist/typings/views/combobox/StyledLabel.d.ts +11 -0
  104. package/dist/typings/views/combobox/StyledListbox.d.ts +17 -0
  105. package/dist/typings/{styled/items/StyledNextItem.d.ts → views/combobox/StyledListboxSeparator.d.ts} +2 -4
  106. package/dist/typings/views/combobox/StyledMessage.d.ts +11 -0
  107. package/dist/typings/views/combobox/StyledOptGroup.d.ts +14 -0
  108. package/dist/typings/views/combobox/StyledOption.d.ts +18 -0
  109. package/dist/typings/views/combobox/StyledOptionContent.d.ts +10 -0
  110. package/dist/typings/views/combobox/StyledOptionIcon.d.ts +17 -0
  111. package/dist/typings/views/combobox/StyledOptionMeta.d.ts +14 -0
  112. package/dist/typings/views/combobox/StyledOptionTypeIcon.d.ts +17 -0
  113. package/dist/typings/views/combobox/StyledTag.d.ts +17 -0
  114. package/dist/typings/views/combobox/StyledTagsButton.d.ts +16 -0
  115. package/dist/typings/views/combobox/StyledTrigger.d.ts +24 -0
  116. package/dist/typings/views/combobox/StyledValue.d.ts +21 -0
  117. package/dist/typings/views/index.d.ts +37 -0
  118. package/dist/typings/views/menu/StyledFloatingMenu.d.ts +13 -0
  119. package/dist/typings/{styled/items/StyledPreviousItem.d.ts → views/menu/StyledItem.d.ts} +4 -4
  120. package/dist/typings/views/menu/StyledItemContent.d.ts +13 -0
  121. package/dist/typings/views/menu/StyledItemGroup.d.ts +13 -0
  122. package/dist/typings/views/menu/StyledItemIcon.d.ts +14 -0
  123. package/dist/typings/{styled/items → views/menu}/StyledItemMeta.d.ts +5 -10
  124. package/dist/typings/views/menu/StyledItemTypeIcon.d.ts +14 -0
  125. package/dist/typings/views/menu/StyledMenu.d.ts +19 -0
  126. package/dist/typings/{styled → views}/menu/StyledSeparator.d.ts +7 -4
  127. package/package.json +20 -18
  128. package/dist/index.esm.js +0 -2032
  129. package/dist/typings/elements/Autocomplete/Autocomplete.d.ts +0 -14
  130. package/dist/typings/elements/Dropdown/Dropdown.d.ts +0 -26
  131. package/dist/typings/elements/Menu/Items/MediaFigure.d.ts +0 -11
  132. package/dist/typings/elements/Menu/Items/NextItem.d.ts +0 -12
  133. package/dist/typings/elements/Menu/Items/PreviousItem.d.ts +0 -12
  134. package/dist/typings/elements/Multiselect/Multiselect.d.ts +0 -14
  135. package/dist/typings/elements/Select/Select.d.ts +0 -14
  136. package/dist/typings/elements/Trigger/Trigger.d.ts +0 -24
  137. package/dist/typings/styled/index.d.ts +0 -29
  138. package/dist/typings/styled/items/StyledItem.d.ts +0 -20
  139. package/dist/typings/styled/items/StyledNextIcon.d.ts +0 -12
  140. package/dist/typings/styled/items/StyledPreviousIcon.d.ts +0 -12
  141. package/dist/typings/styled/items/header/StyledHeaderIcon.d.ts +0 -14
  142. package/dist/typings/styled/items/header/StyledHeaderItem.d.ts +0 -16
  143. package/dist/typings/styled/items/media/StyledMediaBody.d.ts +0 -17
  144. package/dist/typings/styled/items/media/StyledMediaFigure.d.ts +0 -287
  145. package/dist/typings/styled/items/media/StyledMediaItem.d.ts +0 -13
  146. package/dist/typings/styled/menu/StyledMenu.d.ts +0 -20
  147. package/dist/typings/styled/menu/StyledMenuWrapper.d.ts +0 -16
  148. package/dist/typings/styled/multiselect/StyledMultiselectInput.d.ts +0 -22
  149. package/dist/typings/styled/multiselect/StyledMultiselectItemsContainer.d.ts +0 -16
  150. package/dist/typings/styled/multiselect/StyledMultiselectMoreAnchor.d.ts +0 -15
  151. package/dist/typings/styled/select/StyledFauxInput.d.ts +0 -22
  152. package/dist/typings/styled/select/StyledInput.d.ts +0 -15
  153. package/dist/typings/utils/garden-placements.d.ts +0 -26
  154. package/dist/typings/utils/useDropdownContext.d.ts +0 -28
  155. package/dist/typings/utils/useFieldContext.d.ts +0 -17
  156. package/dist/typings/utils/useItemContext.d.ts +0 -16
  157. package/dist/typings/utils/useMenuContext.d.ts +0 -17
@@ -0,0 +1,62 @@
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, getColor } from '@zendeskgarden/react-theming';
10
+ import { getHeight } from './StyledInput.js';
11
+ import { StyledTrigger } from './StyledTrigger.js';
12
+
13
+ const COMPONENT_ID = 'dropdowns.combobox.input_icon';
14
+ const colorStyles = _ref => {
15
+ let {
16
+ theme,
17
+ $isLabelHovered
18
+ } = _ref;
19
+ const options = {
20
+ theme,
21
+ variable: 'foreground.subtle'
22
+ };
23
+ const color = getColor(options);
24
+ const focusColor = getColor({
25
+ ...options,
26
+ dark: {
27
+ offset: -100
28
+ },
29
+ light: {
30
+ offset: 100
31
+ }
32
+ });
33
+ const disabledColor = getColor({
34
+ theme,
35
+ variable: 'foreground.disabled'
36
+ });
37
+ return css(["color:", ";", ":hover &&,", ":focus-within &&,", ":focus &&{color:", ";}", "[aria-disabled='true'] &&{color:", ";}"], $isLabelHovered ? focusColor : color, StyledTrigger, StyledTrigger, StyledTrigger, focusColor, StyledTrigger, disabledColor);
38
+ };
39
+ const sizeStyles = props => {
40
+ const size = props.theme.iconSizes.md;
41
+ const position = math(`(${getHeight(props)} - ${size}) / 2`);
42
+ const margin = `${props.theme.space.base * 2}px`;
43
+ let side;
44
+ if (props.$isEnd) {
45
+ side = props.theme.rtl ? 'right' : 'left';
46
+ } else {
47
+ side = props.theme.rtl ? 'left' : 'right';
48
+ }
49
+ return css(["top:", ";margin-", ":", ";width:", ";height:", ";"], position, side, margin, size, size);
50
+ };
51
+ const StyledInputIcon = styled(StyledBaseIcon).attrs({
52
+ 'data-garden-id': COMPONENT_ID,
53
+ 'data-garden-version': '9.0.0-next.21'
54
+ }).withConfig({
55
+ displayName: "StyledInputIcon",
56
+ componentId: "sc-gqbs1s-0"
57
+ })(["position:sticky;flex-shrink:0;transform:", ";transition:transform 0.25s ease-in-out,color 0.25s ease-in-out;", ";", ";", ";"], props => props.$isRotated && `rotate(${props.theme.rtl ? '-' : '+'}180deg)`, sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
58
+ StyledInputIcon.defaultProps = {
59
+ theme: DEFAULT_THEME
60
+ };
61
+
62
+ export { StyledInputIcon };
@@ -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 { Field } from '@zendeskgarden/react-forms';
10
+
11
+ const COMPONENT_ID = 'dropdowns.combobox.label';
12
+ const StyledLabel = styled(Field.Label).attrs({
13
+ 'data-garden-id': COMPONENT_ID,
14
+ 'data-garden-version': '9.0.0-next.21'
15
+ }).withConfig({
16
+ displayName: "StyledLabel",
17
+ componentId: "sc-az6now-0"
18
+ })(["vertical-align:revert;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
19
+ StyledLabel.defaultProps = {
20
+ theme: DEFAULT_THEME
21
+ };
22
+
23
+ export { StyledLabel };
@@ -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 { DEFAULT_THEME } from '@zendeskgarden/react-theming';
9
+ import { StyledOption, getMinHeight } from './StyledOption.js';
10
+ import { StyledOptionContent } from './StyledOptionContent.js';
11
+ import { StyledOptGroup } from './StyledOptGroup.js';
12
+ import { StyledListboxSeparator } from './StyledListboxSeparator.js';
13
+
14
+ const COMPONENT_ID = 'dropdowns.combobox.listbox';
15
+ const sizeStyles = props => {
16
+ const padding = props.theme.space.base;
17
+ const minHeight = props.minHeight === undefined ? `${getMinHeight(props) + padding * 2}px` : props.minHeight;
18
+ return css(["min-height:", ";max-height:", ";&&&{padding-top:", "px;padding-bottom:", "px;}"], minHeight, props.maxHeight, padding, padding);
19
+ };
20
+ const StyledListbox = styled.ul.attrs({
21
+ 'data-garden-id': COMPONENT_ID,
22
+ 'data-garden-version': '9.0.0-next.21'
23
+ }).withConfig({
24
+ displayName: "StyledListbox",
25
+ componentId: "sc-1k13ba7-0"
26
+ })(["overflow-y:auto;list-style-type:none;", ";&&&{display:block;}", ":first-child ", " ", ":first-child ", "[role='none']:first-child{display:none;}"], sizeStyles, StyledOption, StyledOptionContent, StyledOptGroup, StyledListboxSeparator);
27
+ StyledListbox.defaultProps = {
28
+ theme: DEFAULT_THEME
29
+ };
30
+
31
+ export { StyledListbox };
@@ -0,0 +1,37 @@
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, getColor } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'dropdowns.combobox.separator';
11
+ const colorStyles = _ref => {
12
+ let {
13
+ theme
14
+ } = _ref;
15
+ const backgroundColor = getColor({
16
+ theme,
17
+ variable: 'border.subtle'
18
+ });
19
+ return css(["background-color:", ";"], backgroundColor);
20
+ };
21
+ const sizeStyles = props => {
22
+ const margin = `${props.theme.space.base}px`;
23
+ const height = props.theme.borderWidths.sm;
24
+ return css(["margin:", " 0;height:", ";"], margin, height);
25
+ };
26
+ const StyledListboxSeparator = styled.li.attrs({
27
+ 'data-garden-id': COMPONENT_ID,
28
+ 'data-garden-version': '9.0.0-next.21'
29
+ }).withConfig({
30
+ displayName: "StyledListboxSeparator",
31
+ componentId: "sc-1p6toh2-0"
32
+ })(["cursor:default;", ";", ";", ";"], sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
33
+ StyledListboxSeparator.defaultProps = {
34
+ theme: DEFAULT_THEME
35
+ };
36
+
37
+ export { StyledListboxSeparator };
@@ -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 { Field } from '@zendeskgarden/react-forms';
10
+
11
+ const COMPONENT_ID = 'dropdowns.combobox.message';
12
+ const StyledMessage = styled(Field.Message).attrs({
13
+ 'data-garden-id': COMPONENT_ID,
14
+ 'data-garden-version': '9.0.0-next.21'
15
+ }).withConfig({
16
+ displayName: "StyledMessage",
17
+ componentId: "sc-jux8m5-0"
18
+ })(["", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
19
+ StyledMessage.defaultProps = {
20
+ theme: DEFAULT_THEME
21
+ };
22
+
23
+ export { StyledMessage };
@@ -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.21'
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,69 @@
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, getColor } from '@zendeskgarden/react-theming';
10
+
11
+ const COMPONENT_ID = 'dropdowns.combobox.option';
12
+ const colorStyles = _ref => {
13
+ let {
14
+ theme,
15
+ isActive,
16
+ $type
17
+ } = _ref;
18
+ let backgroundColor;
19
+ let boxShadow;
20
+ if (isActive && $type !== 'group' && $type !== 'header') {
21
+ const variable = 'background.primaryEmphasis';
22
+ backgroundColor = getColor({
23
+ theme,
24
+ variable,
25
+ transparency: theme.opacity[100]
26
+ });
27
+ boxShadow = `inset ${theme.rtl ? `-${theme.shadowWidths.md}` : theme.shadowWidths.md} 0 ${getColor({
28
+ theme,
29
+ variable
30
+ })}`;
31
+ }
32
+ let foregroundVariable;
33
+ if ($type === 'add') {
34
+ foregroundVariable = 'foreground.primary';
35
+ } else if ($type === 'danger') {
36
+ foregroundVariable = 'foreground.danger';
37
+ } else {
38
+ foregroundVariable = 'foreground.default';
39
+ }
40
+ const foregroundColor = getColor({
41
+ theme,
42
+ variable: foregroundVariable
43
+ });
44
+ const disabledForegroundColor = getColor({
45
+ theme,
46
+ variable: 'foreground.disabled'
47
+ });
48
+ return css(["box-shadow:", ";background-color:", ";color:", ";&[aria-disabled='true']{background-color:transparent;color:", ";}"], boxShadow, backgroundColor, foregroundColor, disabledForegroundColor);
49
+ };
50
+ const getMinHeight = props => props.theme.space.base * (props.isCompact ? 7 : 9);
51
+ const sizeStyles = props => {
52
+ const lineHeight = props.theme.lineHeights.md;
53
+ const minHeight = getMinHeight(props);
54
+ const paddingHorizontal = props.$type === 'group' ? 0 : `${props.theme.space.base * 9}px`;
55
+ const paddingVertical = props.$type === 'group' ? 0 : math(`(${minHeight} - ${lineHeight}) / 2`);
56
+ return css(["box-sizing:border-box;padding:", " ", ";min-height:", "px;line-height:", ";"], paddingVertical, paddingHorizontal, minHeight, lineHeight);
57
+ };
58
+ const StyledOption = styled.li.attrs({
59
+ 'data-garden-id': COMPONENT_ID,
60
+ 'data-garden-version': '9.0.0-next.21'
61
+ }).withConfig({
62
+ displayName: "StyledOption",
63
+ componentId: "sc-jl4wn6-0"
64
+ })(["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));
65
+ StyledOption.defaultProps = {
66
+ theme: DEFAULT_THEME
67
+ };
68
+
69
+ 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.21'
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,51 @@
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, getColor } from '@zendeskgarden/react-theming';
10
+
11
+ const COMPONENT_ID = 'dropdowns.combobox.option.icon';
12
+ const colorStyles = _ref => {
13
+ let {
14
+ theme,
15
+ $isDisabled,
16
+ $type
17
+ } = _ref;
18
+ let variable;
19
+ if ($isDisabled) {
20
+ variable = 'foreground.disabled';
21
+ } else if ($type === 'danger') {
22
+ variable = 'foreground.danger';
23
+ } else if ($type === 'add') {
24
+ variable = 'foreground.primary';
25
+ } else {
26
+ variable = 'foreground.subtle';
27
+ }
28
+ const color = getColor({
29
+ theme,
30
+ variable
31
+ });
32
+ return css(["color:", ";"], color);
33
+ };
34
+ const sizeStyles = props => {
35
+ const size = props.theme.iconSizes.md;
36
+ const marginTop = math(`(${props.theme.lineHeights.md} - ${size}) / 2`);
37
+ const marginHorizontal = `${props.theme.space.base * 2}px`;
38
+ return css(["margin-top:", ";margin-", ":", ";width:", ";height:", ";"], marginTop, props.theme.rtl ? 'left' : 'right', marginHorizontal, size, size);
39
+ };
40
+ const StyledOptionIcon = styled(StyledBaseIcon).attrs({
41
+ 'data-garden-id': COMPONENT_ID,
42
+ 'data-garden-version': '9.0.0-next.21'
43
+ }).withConfig({
44
+ displayName: "StyledOptionIcon",
45
+ componentId: "sc-qsab3y-0"
46
+ })(["flex-shrink:0;", ";", ";", ";"], sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
47
+ StyledOptionIcon.defaultProps = {
48
+ theme: DEFAULT_THEME
49
+ };
50
+
51
+ export { StyledOptionIcon };
@@ -0,0 +1,39 @@
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, getColor } from '@zendeskgarden/react-theming';
9
+
10
+ const COMPONENT_ID = 'dropdowns.combobox.option.meta';
11
+ const colorStyles = _ref => {
12
+ let {
13
+ theme,
14
+ isDisabled
15
+ } = _ref;
16
+ const variable = isDisabled ? 'foreground.disabled' : 'foreground.subtle';
17
+ const color = getColor({
18
+ theme,
19
+ variable
20
+ });
21
+ return css(["color:", ";"], color);
22
+ };
23
+ const sizeStyles = props => {
24
+ const lineHeight = props.theme.lineHeights.sm;
25
+ const fontSize = props.theme.fontSizes.sm;
26
+ return css(["line-height:", ";font-size:", ";"], lineHeight, fontSize);
27
+ };
28
+ const StyledOptionMeta = styled.div.attrs({
29
+ 'data-garden-id': COMPONENT_ID,
30
+ 'data-garden-version': '9.0.0-next.21'
31
+ }).withConfig({
32
+ displayName: "StyledOptionMeta",
33
+ componentId: "sc-j6pu10-0"
34
+ })(["transition:color 0.25s ease-in-out;font-weight:", ";", ";", ";", ";"], props => props.theme.fontWeights.regular, sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
35
+ StyledOptionMeta.defaultProps = {
36
+ theme: DEFAULT_THEME
37
+ };
38
+
39
+ export { StyledOptionMeta };
@@ -0,0 +1,58 @@
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, getColor } from '@zendeskgarden/react-theming';
10
+ import { StyledOption, getMinHeight } from './StyledOption.js';
11
+
12
+ const COMPONENT_ID = 'dropdowns.combobox.option.type_icon';
13
+ const colorStyles = _ref => {
14
+ let {
15
+ theme,
16
+ $type
17
+ } = _ref;
18
+ const opacity = $type && $type !== 'danger' ? 1 : 0;
19
+ let color;
20
+ if ($type === 'add') {
21
+ color = 'inherit';
22
+ } else if ($type === 'header' || $type === 'next' || $type === 'previous') {
23
+ color = getColor({
24
+ theme,
25
+ variable: 'foreground.subtle'
26
+ });
27
+ } else {
28
+ color = getColor({
29
+ theme,
30
+ variable: 'foreground.primary'
31
+ });
32
+ }
33
+ return css(["opacity:", ";color:", ";", "[aria-selected='true'] > &{opacity:1;}", "[aria-disabled='true'] > &{color:inherit;}"], opacity, color, StyledOption, StyledOption);
34
+ };
35
+ const sizeStyles = props => {
36
+ const size = props.theme.iconSizes.md;
37
+ const position = `${props.theme.space.base * 3}px`;
38
+ const top = math(`(${getMinHeight(props)} - ${size}) / 2`);
39
+ let side;
40
+ if (props.$type === 'next') {
41
+ side = props.theme.rtl ? 'left' : 'right';
42
+ } else {
43
+ side = props.theme.rtl ? 'right' : 'left';
44
+ }
45
+ return css(["top:", ";", ":", ";width:", ";height:", ";"], top, side, position, size, size);
46
+ };
47
+ const StyledOptionTypeIcon = styled(StyledBaseIcon).attrs({
48
+ 'data-garden-id': COMPONENT_ID,
49
+ 'data-garden-version': '9.0.0-next.21'
50
+ }).withConfig({
51
+ displayName: "StyledOptionTypeIcon",
52
+ componentId: "sc-xpink2-0"
53
+ })(["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));
54
+ StyledOptionTypeIcon.defaultProps = {
55
+ theme: DEFAULT_THEME
56
+ };
57
+
58
+ export { StyledOptionTypeIcon };
@@ -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 { hideVisually } from 'polished';
9
+ import { getColor, 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.21'
16
+ }).withConfig({
17
+ displayName: "StyledTag",
18
+ componentId: "sc-1alam0r-0"
19
+ })(["&[aria-disabled='true']{color:", ";}&[hidden]{display:revert;", "}", ";"], props => props.hue ? undefined : getColor({
20
+ theme: props.theme,
21
+ variable: 'foreground.disabled'
22
+ }), hideVisually(), props => retrieveComponentStyles(COMPONENT_ID, props));
23
+ StyledTag.defaultProps = {
24
+ theme: DEFAULT_THEME
25
+ };
26
+
27
+ export { StyledTag };
@@ -0,0 +1,34 @@
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, getColor } from '@zendeskgarden/react-theming';
9
+ import { StyledValue } from './StyledValue.js';
10
+
11
+ const COMPONENT_ID = 'dropdowns.combobox.tags_button';
12
+ const colorStyles = _ref => {
13
+ let {
14
+ theme
15
+ } = _ref;
16
+ const color = getColor({
17
+ theme,
18
+ variable: 'foreground.primary'
19
+ });
20
+ return css(["color:", ";&:disabled{color:inherit;}"], color);
21
+ };
22
+ const StyledTagsButton = styled(StyledValue).attrs({
23
+ as: 'button',
24
+ 'data-garden-id': COMPONENT_ID,
25
+ 'data-garden-version': '9.0.0-next.21'
26
+ }).withConfig({
27
+ displayName: "StyledTagsButton",
28
+ componentId: "sc-6q5w33-0"
29
+ })(["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));
30
+ StyledTagsButton.defaultProps = {
31
+ theme: DEFAULT_THEME
32
+ };
33
+
34
+ export { StyledTagsButton };
@@ -0,0 +1,125 @@
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, getColor, focusStyles } from '@zendeskgarden/react-theming';
10
+ import { getHeight } from './StyledInput.js';
11
+
12
+ const COMPONENT_ID = 'dropdowns.combobox.trigger';
13
+ const colorStyles = _ref => {
14
+ let {
15
+ theme,
16
+ validation,
17
+ isBare,
18
+ isLabelHovered,
19
+ focusInset
20
+ } = _ref;
21
+ const foregroundColor = getColor({
22
+ theme,
23
+ variable: 'foreground.default'
24
+ });
25
+ const backgroundColor = isBare ? 'transparent' : getColor({
26
+ theme,
27
+ variable: 'background.default'
28
+ });
29
+ let borderColor;
30
+ let borderVariable;
31
+ let hoverBorderColor;
32
+ let focusBorderColor;
33
+ if (validation) {
34
+ if (validation === 'success') {
35
+ borderVariable = 'border.successEmphasis';
36
+ } else if (validation === 'warning') {
37
+ borderVariable = 'border.warningEmphasis';
38
+ } else if (validation === 'error') {
39
+ borderVariable = 'border.dangerEmphasis';
40
+ }
41
+ borderColor = getColor({
42
+ theme,
43
+ variable: borderVariable
44
+ });
45
+ hoverBorderColor = borderColor;
46
+ focusBorderColor = borderColor;
47
+ } else {
48
+ borderColor = getColor({
49
+ theme,
50
+ variable: 'border.default',
51
+ dark: {
52
+ offset: -100
53
+ },
54
+ light: {
55
+ offset: 100
56
+ }
57
+ });
58
+ borderVariable = 'border.primaryEmphasis';
59
+ hoverBorderColor = getColor({
60
+ theme,
61
+ variable: borderVariable
62
+ });
63
+ focusBorderColor = hoverBorderColor;
64
+ }
65
+ const disabledBackgroundColor = isBare ? undefined : getColor({
66
+ theme,
67
+ variable: 'background.disabled'
68
+ });
69
+ const disabledBorderColor = getColor({
70
+ theme,
71
+ variable: 'border.disabled'
72
+ });
73
+ const disabledForegroundColor = getColor({
74
+ theme,
75
+ variable: 'foreground.disabled'
76
+ });
77
+ const focusSelector = `
78
+ &:focus-within:not([aria-disabled='true']),
79
+ &:focus-visible
80
+ `;
81
+ return css(["color-scheme:only ", ";border-color:", ";background-color:", ";color:", ";&:hover{border-color:", ";}", " &[aria-disabled='true']{border-color:", ";background-color:", ";color:", ";}"], theme.colors.base, isLabelHovered ? hoverBorderColor : borderColor, backgroundColor, foregroundColor, hoverBorderColor, focusStyles({
82
+ theme,
83
+ inset: focusInset,
84
+ color: {
85
+ variable: borderVariable
86
+ },
87
+ selector: focusSelector,
88
+ styles: {
89
+ borderColor: focusBorderColor
90
+ },
91
+ condition: !isBare
92
+ }), disabledBorderColor, disabledBackgroundColor, disabledForegroundColor);
93
+ };
94
+ const sizeStyles = props => {
95
+ const inputHeight = getHeight(props);
96
+ let minHeight;
97
+ let horizontalPadding;
98
+ if (props.isBare) {
99
+ if (props.isMultiselectable) {
100
+ minHeight = math(`${props.theme.shadowWidths.sm} * 2 + ${inputHeight}`);
101
+ horizontalPadding = props.theme.shadowWidths.sm;
102
+ } else {
103
+ minHeight = `${inputHeight}px`;
104
+ horizontalPadding = '0';
105
+ }
106
+ } else {
107
+ minHeight = `${props.theme.space.base * (props.isCompact ? 3 : 2) + inputHeight}px`;
108
+ horizontalPadding = `${props.theme.space.base * 3}px`;
109
+ }
110
+ const maxHeight = props.maxHeight || minHeight;
111
+ const verticalPadding = math(`(${minHeight} - ${inputHeight} - (${props.isBare ? 0 : props.theme.borderWidths.sm} * 2)) / 2`);
112
+ return css(["padding:", " ", ";min-height:", ";max-height:", ";font-size:", ";"], verticalPadding, horizontalPadding, minHeight, maxHeight, props.theme.fontSizes.md);
113
+ };
114
+ const StyledTrigger = styled.div.attrs({
115
+ 'data-garden-id': COMPONENT_ID,
116
+ 'data-garden-version': '9.0.0-next.21'
117
+ }).withConfig({
118
+ displayName: "StyledTrigger",
119
+ componentId: "sc-116nftk-0"
120
+ })(["overflow-y:", ";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 && !props.isMultiselectable ? 'visible' : 'auto', 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));
121
+ StyledTrigger.defaultProps = {
122
+ theme: DEFAULT_THEME
123
+ };
124
+
125
+ export { StyledTrigger };
@@ -0,0 +1,39 @@
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, getColor } from '@zendeskgarden/react-theming';
9
+ import { sizeStyles } from './StyledInput.js';
10
+
11
+ const COMPONENT_ID = 'dropdowns.combobox.value';
12
+ const colorStyles = _ref => {
13
+ let {
14
+ theme,
15
+ isPlaceholder
16
+ } = _ref;
17
+ const foregroundColor = isPlaceholder && getColor({
18
+ theme,
19
+ variable: 'foreground.disabled'
20
+ });
21
+ return css(["color:", ";"], foregroundColor);
22
+ };
23
+ const StyledValue = styled.div.attrs({
24
+ 'data-garden-id': COMPONENT_ID,
25
+ 'data-garden-version': '9.0.0-next.21'
26
+ }).withConfig({
27
+ displayName: "StyledValue",
28
+ componentId: "sc-t719sx-0"
29
+ })(["flex-basis:0;flex-grow:1;cursor:", ";overflow:hidden;text-overflow:ellipsis;white-space:pre;user-select:none;", ";", ";&[hidden]{display:none;}", ";"], props => {
30
+ if (props.isDisabled) {
31
+ return 'default';
32
+ }
33
+ return props.isEditable && !props.isAutocomplete ? 'text' : 'pointer';
34
+ }, sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
35
+ StyledValue.defaultProps = {
36
+ theme: DEFAULT_THEME
37
+ };
38
+
39
+ export { StyledValue };