@wordpress/components 24.0.0 → 25.0.0

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 (166) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/CONTRIBUTING.md +10 -0
  3. package/build/color-picker/styles.js +8 -8
  4. package/build/color-picker/styles.js.map +1 -1
  5. package/build/date-time/date-time/index.js +3 -84
  6. package/build/date-time/date-time/index.js.map +1 -1
  7. package/build/date-time/date-time/styles.js +4 -19
  8. package/build/date-time/date-time/styles.js.map +1 -1
  9. package/build/dropdown-menu/index.js +87 -11
  10. package/build/dropdown-menu/index.js.map +1 -1
  11. package/build/dropdown-menu/types.js +6 -0
  12. package/build/dropdown-menu/types.js.map +1 -0
  13. package/build/dropdown-menu-v2/index.js +195 -0
  14. package/build/dropdown-menu-v2/index.js.map +1 -0
  15. package/build/dropdown-menu-v2/styles.js +176 -0
  16. package/build/dropdown-menu-v2/styles.js.map +1 -0
  17. package/build/dropdown-menu-v2/types.js +6 -0
  18. package/build/dropdown-menu-v2/types.js.map +1 -0
  19. package/build/index.native.js +0 -9
  20. package/build/index.native.js.map +1 -1
  21. package/build/input-control/styles/input-control-styles.js +30 -23
  22. package/build/input-control/styles/input-control-styles.js.map +1 -1
  23. package/build/mobile/bottom-sheet/cell.native.js +16 -8
  24. package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
  25. package/build/mobile/bottom-sheet/range-cell.native.js +3 -2
  26. package/build/mobile/bottom-sheet/range-cell.native.js.map +1 -1
  27. package/build/mobile/bottom-sheet/stepper-cell/index.native.js +4 -2
  28. package/build/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
  29. package/build/mobile/bottom-sheet/switch-cell.native.js +8 -2
  30. package/build/mobile/bottom-sheet/switch-cell.native.js.map +1 -1
  31. package/build/mobile/bottom-sheet-select-control/index.native.js +4 -2
  32. package/build/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  33. package/build/mobile/bottom-sheet-text-control/index.native.js +4 -2
  34. package/build/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
  35. package/build/modal/index.js +1 -2
  36. package/build/modal/index.js.map +1 -1
  37. package/build/private-apis.js +13 -1
  38. package/build/private-apis.js.map +1 -1
  39. package/build/range-control/index.native.js +5 -2
  40. package/build/range-control/index.native.js.map +1 -1
  41. package/build/snackbar/list.js +0 -2
  42. package/build/snackbar/list.js.map +1 -1
  43. package/build/toggle-group-control/toggle-group-control/styles.js +7 -7
  44. package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  45. package/build-module/color-picker/styles.js +8 -8
  46. package/build-module/color-picker/styles.js.map +1 -1
  47. package/build-module/date-time/date-time/index.js +6 -81
  48. package/build-module/date-time/date-time/index.js.map +1 -1
  49. package/build-module/date-time/date-time/styles.js +3 -17
  50. package/build-module/date-time/date-time/styles.js.map +1 -1
  51. package/build-module/dropdown-menu/index.js +87 -10
  52. package/build-module/dropdown-menu/index.js.map +1 -1
  53. package/build-module/dropdown-menu/types.js +2 -0
  54. package/build-module/dropdown-menu/types.js.map +1 -0
  55. package/build-module/dropdown-menu-v2/index.js +149 -0
  56. package/build-module/dropdown-menu-v2/index.js.map +1 -0
  57. package/build-module/dropdown-menu-v2/styles.js +153 -0
  58. package/build-module/dropdown-menu-v2/styles.js.map +1 -0
  59. package/build-module/dropdown-menu-v2/types.js +2 -0
  60. package/build-module/dropdown-menu-v2/types.js.map +1 -0
  61. package/build-module/index.native.js +0 -1
  62. package/build-module/index.native.js.map +1 -1
  63. package/build-module/input-control/styles/input-control-styles.js +30 -23
  64. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  65. package/build-module/mobile/bottom-sheet/cell.native.js +16 -8
  66. package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
  67. package/build-module/mobile/bottom-sheet/range-cell.native.js +3 -2
  68. package/build-module/mobile/bottom-sheet/range-cell.native.js.map +1 -1
  69. package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js +4 -2
  70. package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
  71. package/build-module/mobile/bottom-sheet/switch-cell.native.js +7 -2
  72. package/build-module/mobile/bottom-sheet/switch-cell.native.js.map +1 -1
  73. package/build-module/mobile/bottom-sheet-select-control/index.native.js +4 -2
  74. package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
  75. package/build-module/mobile/bottom-sheet-text-control/index.native.js +4 -2
  76. package/build-module/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
  77. package/build-module/modal/index.js +1 -2
  78. package/build-module/modal/index.js.map +1 -1
  79. package/build-module/private-apis.js +12 -1
  80. package/build-module/private-apis.js.map +1 -1
  81. package/build-module/range-control/index.native.js +5 -2
  82. package/build-module/range-control/index.native.js.map +1 -1
  83. package/build-module/snackbar/list.js +0 -2
  84. package/build-module/snackbar/list.js.map +1 -1
  85. package/build-module/toggle-group-control/toggle-group-control/styles.js +7 -7
  86. package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  87. package/build-style/style-rtl.css +11 -14
  88. package/build-style/style.css +11 -14
  89. package/build-types/color-picker/styles.d.ts.map +1 -1
  90. package/build-types/date-time/date-time/index.d.ts +3 -4
  91. package/build-types/date-time/date-time/index.d.ts.map +1 -1
  92. package/build-types/date-time/date-time/styles.d.ts +0 -4
  93. package/build-types/date-time/date-time/styles.d.ts.map +1 -1
  94. package/build-types/date-time/stories/date-time.d.ts.map +1 -1
  95. package/build-types/date-time/types.d.ts +0 -14
  96. package/build-types/date-time/types.d.ts.map +1 -1
  97. package/build-types/dropdown-menu/index.d.ts +83 -1
  98. package/build-types/dropdown-menu/index.d.ts.map +1 -1
  99. package/build-types/dropdown-menu/stories/index.d.ts +13 -0
  100. package/build-types/dropdown-menu/stories/index.d.ts.map +1 -0
  101. package/build-types/dropdown-menu/test/index.d.ts +2 -0
  102. package/build-types/dropdown-menu/test/index.d.ts.map +1 -0
  103. package/build-types/dropdown-menu/types.d.ts +134 -0
  104. package/build-types/dropdown-menu/types.d.ts.map +1 -0
  105. package/build-types/dropdown-menu-v2/index.d.ts +17 -0
  106. package/build-types/dropdown-menu-v2/index.d.ts.map +1 -0
  107. package/build-types/dropdown-menu-v2/stories/index.d.ts +13 -0
  108. package/build-types/dropdown-menu-v2/stories/index.d.ts.map +1 -0
  109. package/build-types/dropdown-menu-v2/styles.d.ts +41 -0
  110. package/build-types/dropdown-menu-v2/styles.d.ts.map +1 -0
  111. package/build-types/dropdown-menu-v2/test/index.d.ts +2 -0
  112. package/build-types/dropdown-menu-v2/test/index.d.ts.map +1 -0
  113. package/build-types/dropdown-menu-v2/types.d.ts +242 -0
  114. package/build-types/dropdown-menu-v2/types.d.ts.map +1 -0
  115. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  116. package/build-types/modal/index.d.ts.map +1 -1
  117. package/build-types/private-apis.d.ts.map +1 -1
  118. package/build-types/snackbar/list.d.ts.map +1 -1
  119. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts.map +1 -1
  120. package/build-types/toolbar/stories/index.d.ts.map +1 -1
  121. package/build-types/ui/context/get-styled-class-name-from-key.d.ts +1 -10
  122. package/build-types/ui/context/get-styled-class-name-from-key.d.ts.map +1 -1
  123. package/package.json +21 -20
  124. package/src/button/style.scss +5 -12
  125. package/src/color-picker/styles.ts +7 -2
  126. package/src/date-time/README.md +0 -16
  127. package/src/date-time/date-time/index.tsx +17 -155
  128. package/src/date-time/date-time/styles.ts +0 -4
  129. package/src/date-time/stories/date-time.tsx +0 -4
  130. package/src/date-time/types.ts +0 -16
  131. package/src/dropdown-menu/README.md +12 -22
  132. package/src/dropdown-menu/{index.js → index.tsx} +111 -25
  133. package/src/dropdown-menu/stories/{index.js → index.tsx} +14 -22
  134. package/src/dropdown-menu/test/{index.js → index.tsx} +6 -5
  135. package/src/dropdown-menu/types.ts +143 -0
  136. package/src/dropdown-menu-v2/README.md +392 -0
  137. package/src/dropdown-menu-v2/index.tsx +241 -0
  138. package/src/dropdown-menu-v2/stories/index.tsx +193 -0
  139. package/src/dropdown-menu-v2/styles.ts +263 -0
  140. package/src/dropdown-menu-v2/test/index.tsx +816 -0
  141. package/src/dropdown-menu-v2/types.ts +250 -0
  142. package/src/index.native.js +0 -1
  143. package/src/input-control/styles/input-control-styles.tsx +7 -0
  144. package/src/mobile/bottom-sheet/cell.native.js +26 -5
  145. package/src/mobile/bottom-sheet/range-cell.native.js +2 -1
  146. package/src/mobile/bottom-sheet/stepper-cell/index.native.js +2 -0
  147. package/src/mobile/bottom-sheet/styles.native.scss +13 -1
  148. package/src/mobile/bottom-sheet/switch-cell.native.js +10 -2
  149. package/src/mobile/bottom-sheet-select-control/index.native.js +2 -0
  150. package/src/mobile/bottom-sheet-text-control/index.native.js +2 -0
  151. package/src/modal/index.tsx +1 -6
  152. package/src/private-apis.ts +22 -0
  153. package/src/range-control/index.native.js +3 -0
  154. package/src/search-control/style.scss +2 -0
  155. package/src/snackbar/list.tsx +0 -1
  156. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +6 -2
  157. package/src/toggle-group-control/toggle-group-control/styles.ts +6 -1
  158. package/src/toolbar/stories/index.tsx +25 -28
  159. package/src/tooltip/style.scss +2 -2
  160. package/tsconfig.tsbuildinfo +1 -1
  161. package/build/mobile/readable-content-view/index.native.js +0 -97
  162. package/build/mobile/readable-content-view/index.native.js.map +0 -1
  163. package/build-module/mobile/readable-content-view/index.native.js +0 -81
  164. package/build-module/mobile/readable-content-view/index.native.js.map +0 -1
  165. package/src/mobile/readable-content-view/index.native.js +0 -85
  166. package/src/mobile/readable-content-view/style.native.scss +0 -30
@@ -0,0 +1,193 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ComponentMeta, ComponentStory } from '@storybook/react';
5
+ import styled from '@emotion/styled';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import {
11
+ DropdownMenu,
12
+ DropdownMenuItem,
13
+ DropdownSubMenu,
14
+ DropdownMenuSeparator,
15
+ DropdownMenuCheckboxItem,
16
+ DropdownMenuGroup,
17
+ DropdownMenuLabel,
18
+ DropdownMenuRadioGroup,
19
+ DropdownMenuRadioItem,
20
+ DropdownSubMenuTrigger,
21
+ } from '..';
22
+ import Button from '../../button';
23
+
24
+ /**
25
+ * WordPress dependencies
26
+ */
27
+ import { useState } from '@wordpress/element';
28
+ import { menu, wordpress } from '@wordpress/icons';
29
+
30
+ /**
31
+ * Internal dependencies
32
+ */
33
+ import Icon from '../../icon';
34
+
35
+ const meta: ComponentMeta< typeof DropdownMenu > = {
36
+ title: 'Components (Experimental)/DropdownMenu v2',
37
+ component: DropdownMenu,
38
+ subcomponents: {
39
+ DropdownMenuItem,
40
+ DropdownSubMenu,
41
+ DropdownSubMenuTrigger,
42
+ DropdownMenuSeparator,
43
+ DropdownMenuCheckboxItem,
44
+ DropdownMenuGroup,
45
+ DropdownMenuLabel,
46
+ DropdownMenuRadioGroup,
47
+ DropdownMenuRadioItem,
48
+ },
49
+ argTypes: {
50
+ children: { control: { type: null } },
51
+ trigger: { control: { type: null } },
52
+ },
53
+ parameters: {
54
+ actions: { argTypesRegex: '^on.*' },
55
+ controls: { expanded: true },
56
+ docs: { source: { state: 'open', excludeDecorators: true } },
57
+ },
58
+ decorators: [
59
+ // Layout wrapper
60
+ ( Story ) => (
61
+ <div
62
+ style={ {
63
+ minHeight: '300px',
64
+ } }
65
+ >
66
+ <Story />
67
+ </div>
68
+ ),
69
+ ],
70
+ };
71
+ export default meta;
72
+
73
+ const ItemHelpText = styled.span`
74
+ font-size: 10px;
75
+ color: #777;
76
+
77
+ /* "> * > &" syntax is to target only immediate parent menu item */
78
+ [data-highlighted] > * > &,
79
+ [data-state='open'] > * > &,
80
+ [data-disabled] > * & {
81
+ color: inherit;
82
+ }
83
+ `;
84
+
85
+ const CheckboxItemsGroup = () => {
86
+ const [ itemOneChecked, setItemOneChecked ] = useState( true );
87
+ const [ itemTwoChecked, setItemTwoChecked ] = useState( false );
88
+
89
+ return (
90
+ <DropdownMenuGroup>
91
+ <DropdownMenuLabel>Checkbox group label</DropdownMenuLabel>
92
+ <DropdownMenuCheckboxItem
93
+ checked={ itemOneChecked }
94
+ onCheckedChange={ setItemOneChecked }
95
+ suffix={ <span>⌘+B</span> }
96
+ >
97
+ Checkbox item one
98
+ </DropdownMenuCheckboxItem>
99
+
100
+ <DropdownMenuCheckboxItem
101
+ checked={ itemTwoChecked }
102
+ onCheckedChange={ setItemTwoChecked }
103
+ >
104
+ Checkbox item two
105
+ </DropdownMenuCheckboxItem>
106
+ </DropdownMenuGroup>
107
+ );
108
+ };
109
+
110
+ const RadioItemsGroup = () => {
111
+ const [ radioValue, setRadioValue ] = useState( 'radio-one' );
112
+
113
+ return (
114
+ <DropdownMenuRadioGroup
115
+ value={ radioValue }
116
+ onValueChange={ setRadioValue }
117
+ >
118
+ <DropdownMenuLabel>Radio group label</DropdownMenuLabel>
119
+ <DropdownMenuRadioItem value="radio-one">
120
+ Radio item one
121
+ </DropdownMenuRadioItem>
122
+ <DropdownMenuRadioItem value="radio-two">
123
+ Radio item two
124
+ </DropdownMenuRadioItem>
125
+ </DropdownMenuRadioGroup>
126
+ );
127
+ };
128
+
129
+ const Template: ComponentStory< typeof DropdownMenu > = ( props ) => (
130
+ <DropdownMenu { ...props } />
131
+ );
132
+ export const Default = Template.bind( {} );
133
+ Default.args = {
134
+ trigger: <Button __next40pxDefaultSize label="Open menu" icon={ menu } />,
135
+ sideOffset: 12,
136
+ children: (
137
+ <>
138
+ <DropdownMenuGroup>
139
+ <DropdownMenuItem>Menu item</DropdownMenuItem>
140
+ <DropdownMenuItem
141
+ prefix={ <Icon icon={ wordpress } size={ 18 } /> }
142
+ >
143
+ Menu item with prefix
144
+ </DropdownMenuItem>
145
+ <DropdownMenuItem suffix={ <span>⌥⌘T</span> }>
146
+ Menu item with suffix
147
+ </DropdownMenuItem>
148
+ <DropdownMenuItem disabled>Disabled menu item</DropdownMenuItem>
149
+ <DropdownSubMenu
150
+ trigger={
151
+ <DropdownSubMenuTrigger>Submenu</DropdownSubMenuTrigger>
152
+ }
153
+ >
154
+ <DropdownMenuItem suffix={ <span>⌘+S</span> }>
155
+ Submenu item with suffix
156
+ </DropdownMenuItem>
157
+ <DropdownMenuItem>
158
+ <div
159
+ style={ {
160
+ display: 'inline-flex',
161
+ flexDirection: 'column',
162
+ } }
163
+ >
164
+ Submenu item
165
+ <ItemHelpText>
166
+ With additional custom text
167
+ </ItemHelpText>
168
+ </div>
169
+ </DropdownMenuItem>
170
+ <DropdownMenuSeparator />
171
+ <DropdownSubMenu
172
+ trigger={
173
+ <DropdownSubMenuTrigger>
174
+ Second level submenu
175
+ </DropdownSubMenuTrigger>
176
+ }
177
+ >
178
+ <DropdownMenuItem>Submenu item</DropdownMenuItem>
179
+ <DropdownMenuItem>Submenu item</DropdownMenuItem>
180
+ </DropdownSubMenu>
181
+ </DropdownSubMenu>
182
+ </DropdownMenuGroup>
183
+
184
+ <DropdownMenuSeparator />
185
+
186
+ <CheckboxItemsGroup />
187
+
188
+ <DropdownMenuSeparator />
189
+
190
+ <RadioItemsGroup />
191
+ </>
192
+ ),
193
+ };
@@ -0,0 +1,263 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import styled from '@emotion/styled';
5
+ import { css, keyframes } from '@emotion/react';
6
+ import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
7
+
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ import { COLORS, font, rtl } from '../utils';
12
+ import { space } from '../ui/utils/space';
13
+ import Icon from '../icon';
14
+
15
+ const ANIMATION_PARAMS = {
16
+ SLIDE_AMOUNT: '2px',
17
+ DURATION: '400ms',
18
+ EASING: 'cubic-bezier( 0.16, 1, 0.3, 1 )',
19
+ };
20
+
21
+ const ITEM_PREFIX_WIDTH = space( 7 );
22
+ const ITEM_PADDING_INLINE_START = space( 2 );
23
+ const ITEM_PADDING_INLINE_END = space( 2.5 );
24
+
25
+ const slideUpAndFade = keyframes( {
26
+ '0%': {
27
+ opacity: 0,
28
+ transform: `translateY(${ ANIMATION_PARAMS.SLIDE_AMOUNT })`,
29
+ },
30
+ '100%': { opacity: 1, transform: 'translateY(0)' },
31
+ } );
32
+
33
+ const slideRightAndFade = keyframes( {
34
+ '0%': {
35
+ opacity: 0,
36
+ transform: `translateX(-${ ANIMATION_PARAMS.SLIDE_AMOUNT })`,
37
+ },
38
+ '100%': { opacity: 1, transform: 'translateX(0)' },
39
+ } );
40
+
41
+ const slideDownAndFade = keyframes( {
42
+ '0%': {
43
+ opacity: 0,
44
+ transform: `translateY(-${ ANIMATION_PARAMS.SLIDE_AMOUNT })`,
45
+ },
46
+ '100%': { opacity: 1, transform: 'translateY(0)' },
47
+ } );
48
+
49
+ const slideLeftAndFade = keyframes( {
50
+ '0%': {
51
+ opacity: 0,
52
+ transform: `translateX(${ ANIMATION_PARAMS.SLIDE_AMOUNT })`,
53
+ },
54
+ '100%': { opacity: 1, transform: 'translateX(0)' },
55
+ } );
56
+
57
+ const baseContent = css`
58
+ min-width: 220px;
59
+ background-color: ${ COLORS.ui.background };
60
+ border-radius: 6px;
61
+ padding: ${ space( 2 ) };
62
+ box-shadow: 0.1px 4px 16.4px -0.5px rgba( 0, 0, 0, 0.1 ),
63
+ 0px 5.5px 7.8px -0.3px rgba( 0, 0, 0, 0.1 ),
64
+ 0px 2.7px 3.8px -0.2px rgba( 0, 0, 0, 0.1 ),
65
+ 0px 0.7px 1px rgba( 0, 0, 0, 0.1 );
66
+ animation-duration: ${ ANIMATION_PARAMS.DURATION };
67
+ animation-timing-function: ${ ANIMATION_PARAMS.EASING };
68
+ will-change: transform, opacity;
69
+
70
+ &[data-side='top'] {
71
+ animation-name: ${ slideDownAndFade };
72
+ }
73
+
74
+ &[data-side='right'] {
75
+ animation-name: ${ slideLeftAndFade };
76
+ }
77
+
78
+ &[data-side='bottom'] {
79
+ animation-name: ${ slideUpAndFade };
80
+ }
81
+
82
+ &[data-side='left'] {
83
+ animation-name: ${ slideRightAndFade };
84
+ }
85
+
86
+ @media ( prefers-reduced-motion ) {
87
+ animation-duration: 0s;
88
+ }
89
+ `;
90
+
91
+ const itemPrefix = css`
92
+ width: ${ ITEM_PREFIX_WIDTH };
93
+ display: inline-flex;
94
+ align-items: center;
95
+ justify-content: center;
96
+ /* Prefixes don't get affected by the item's inline start padding */
97
+ margin-inline-start: calc( -1 * ${ ITEM_PADDING_INLINE_START } );
98
+ /*
99
+ Negative margin allows the suffix to be as tall as the whole item
100
+ (incl. padding) before increasing the items' height. This can be useful,
101
+ e.g., when using icons that are bigger than 20x20 px
102
+ */
103
+ margin-top: ${ space( -2 ) };
104
+ margin-bottom: ${ space( -2 ) };
105
+ `;
106
+
107
+ const itemSuffix = css`
108
+ width: max-content;
109
+ display: inline-flex;
110
+ align-items: center;
111
+ justify-content: center;
112
+ /* Push prefix to the inline-end of the item */
113
+ margin-inline-start: auto;
114
+ /* Minimum space between the item's content and suffix */
115
+ padding-inline-start: ${ space( 6 ) };
116
+ /*
117
+ Negative margin allows the suffix to be as tall as the whole item
118
+ (incl. padding) before increasing the items' height. This can be useful,
119
+ e.g., when using icons that are bigger than 20x20 px
120
+ */
121
+ margin-top: ${ space( -2 ) };
122
+ margin-bottom: ${ space( -2 ) };
123
+
124
+ /*
125
+ Override color in normal conditions, but inherit the item's color
126
+ for altered conditions.
127
+
128
+ TODO:
129
+ - For now, used opacity like for disabled item, which makes it work
130
+ regardless of the theme
131
+ - how do we translate this for themes? Should we have a new variable
132
+ for "secondary" text?
133
+ */
134
+ opacity: 0.6;
135
+
136
+ [data-highlighted] > &,
137
+ [data-state='open'] > &,
138
+ [data-disabled] > & {
139
+ opacity: 1;
140
+ }
141
+ `;
142
+
143
+ export const ItemPrefixWrapper = styled.span`
144
+ ${ itemPrefix }
145
+ `;
146
+
147
+ export const ItemSuffixWrapper = styled.span`
148
+ ${ itemSuffix }
149
+ `;
150
+
151
+ const baseItem = css`
152
+ all: unset;
153
+ font-size: ${ font( 'default.fontSize' ) };
154
+ font-family: inherit;
155
+ font-weight: normal;
156
+ line-height: 20px;
157
+ color: ${ COLORS.gray[ 900 ] };
158
+ border-radius: 3px;
159
+ display: flex;
160
+ align-items: center;
161
+ padding: ${ space( 2 ) } ${ ITEM_PADDING_INLINE_END } ${ space( 2 ) }
162
+ ${ ITEM_PADDING_INLINE_START };
163
+ position: relative;
164
+ user-select: none;
165
+ outline: none;
166
+
167
+ &[data-disabled] {
168
+ /*
169
+ TODO:
170
+ - we need a disabled color in the Theme variables
171
+ - design specs use opacity instead of setting a new text color
172
+ */
173
+ opacity: 0.5;
174
+ pointer-events: none;
175
+ }
176
+
177
+ &[data-highlighted] {
178
+ /*
179
+ TODO: reconcile with global focus styles
180
+ (incl high contrast mode fallbacks)
181
+ */
182
+
183
+ background-color: ${ COLORS.ui.theme };
184
+ color: white;
185
+ }
186
+
187
+ svg {
188
+ fill: currentColor;
189
+ }
190
+
191
+ &:not( :has( ${ ItemPrefixWrapper } ) ) {
192
+ padding-inline-start: ${ ITEM_PREFIX_WIDTH };
193
+ }
194
+ `;
195
+
196
+ export const Content = styled( DropdownMenu.Content )`
197
+ ${ baseContent }
198
+ `;
199
+ export const SubContent = styled( DropdownMenu.SubContent )`
200
+ ${ baseContent }
201
+ `;
202
+
203
+ export const Item = styled( DropdownMenu.Item )`
204
+ ${ baseItem }
205
+ `;
206
+ export const CheckboxItem = styled( DropdownMenu.CheckboxItem )`
207
+ ${ baseItem }
208
+ `;
209
+ export const RadioItem = styled( DropdownMenu.RadioItem )`
210
+ ${ baseItem }
211
+ `;
212
+ export const SubTrigger = styled( DropdownMenu.SubTrigger )`
213
+ &[data-state='open']:not( [data-highlighted] ) {
214
+ /* TODO: use variable */
215
+ background-color: rgba( 56, 88, 233, 0.04 );
216
+ color: ${ COLORS.ui.theme };
217
+ }
218
+
219
+ ${ baseItem }
220
+ `;
221
+
222
+ export const Label = styled( DropdownMenu.Label )`
223
+ box-sizing: border-box;
224
+ display: flex;
225
+ align-items: center;
226
+ min-height: ${ space( 8 ) };
227
+
228
+ padding: ${ space( 2 ) } ${ ITEM_PADDING_INLINE_END } ${ space( 2 ) }
229
+ ${ ITEM_PREFIX_WIDTH };
230
+ /* TODO: color doesn't match available UI variables */
231
+ color: ${ COLORS.gray[ 700 ] };
232
+
233
+ /* TODO: font size doesn't match available ones via "font" utils */
234
+ font-size: 11px;
235
+ line-height: 1.4;
236
+ font-weight: 500;
237
+ text-transform: uppercase;
238
+ `;
239
+
240
+ export const Separator = styled( DropdownMenu.Separator )`
241
+ height: 1px;
242
+ /* TODO: doesn't match border color from variables */
243
+ background-color: ${ COLORS.ui.borderDisabled };
244
+ /* Negative horizontal margin to make separator go from side to side */
245
+ margin: ${ space( 2 ) } 0;
246
+ `;
247
+
248
+ export const ItemIndicator = styled( DropdownMenu.ItemIndicator )`
249
+ display: inline-flex;
250
+ align-items: center;
251
+ justify-content: center;
252
+ `;
253
+
254
+ export const SubmenuRtlChevronIcon = styled( Icon )`
255
+ ${ rtl(
256
+ {
257
+ transform: `scaleX(1) translateX(${ space( 2 ) })`,
258
+ },
259
+ {
260
+ transform: `scaleX(-1) translateX(${ space( 2 ) })`,
261
+ }
262
+ )() }
263
+ `;