@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,250 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
5
+
6
+ export type DropdownMenuProps = {
7
+ /**
8
+ * The open state of the dropdown menu when it is initially rendered. Use when
9
+ * you do not need to control its open state.
10
+ *
11
+ */
12
+ defaultOpen?: DropdownMenuPrimitive.DropdownMenuProps[ 'defaultOpen' ];
13
+ /**
14
+ * The controlled open state of the dropdown menu. Must be used in conjunction
15
+ * with `onOpenChange`.
16
+ */
17
+ open?: DropdownMenuPrimitive.DropdownMenuProps[ 'open' ];
18
+ /**
19
+ * Event handler called when the open state of the dropdown menu changes.
20
+ */
21
+ onOpenChange?: DropdownMenuPrimitive.DropdownMenuProps[ 'onOpenChange' ];
22
+ /**
23
+ * The modality of the dropdown menu. When set to true, interaction with
24
+ * outside elements will be disabled and only menu content will be visible to
25
+ * screen readers.
26
+ *
27
+ * @default true
28
+ */
29
+ modal?: DropdownMenuPrimitive.DropdownMenuProps[ 'modal' ];
30
+ /**
31
+ * The preferred side of the trigger to render against when open.
32
+ * Will be reversed when collisions occur and avoidCollisions is enabled.
33
+ *
34
+ * @default 'bottom'
35
+ */
36
+ side?: DropdownMenuPrimitive.DropdownMenuContentProps[ 'side' ];
37
+ /**
38
+ * The distance in pixels from the trigger.
39
+ *
40
+ * @default 0
41
+ */
42
+ sideOffset?: DropdownMenuPrimitive.DropdownMenuContentProps[ 'sideOffset' ];
43
+ /**
44
+ * The preferred alignment against the trigger.
45
+ * May change when collisions occur.
46
+ *
47
+ * @default 'center'
48
+ */
49
+ align?: DropdownMenuPrimitive.DropdownMenuContentProps[ 'align' ];
50
+ /**
51
+ * An offset in pixels from the "start" or "end" alignment options.
52
+ *
53
+ * @default 0
54
+ */
55
+ alignOffset?: DropdownMenuPrimitive.DropdownMenuContentProps[ 'alignOffset' ];
56
+ /**
57
+ * The trigger button.
58
+ */
59
+ trigger: React.ReactNode;
60
+ /**
61
+ * The contents of the dropdown
62
+ */
63
+ children: React.ReactNode;
64
+ };
65
+
66
+ export type DropdownSubMenuTriggerProps = {
67
+ /**
68
+ * The contents of the item.
69
+ */
70
+ children: React.ReactNode;
71
+ /**
72
+ * The contents of the item's prefix.
73
+ */
74
+ prefix?: React.ReactNode;
75
+ /**
76
+ * The contents of the item's suffix.
77
+ *
78
+ * @default The standard chevron icon for a submenu trigger.
79
+ */
80
+ suffix?: React.ReactNode;
81
+ };
82
+
83
+ export type DropdownSubMenuProps = {
84
+ /**
85
+ * The open state of the submenu when it is initially rendered. Use when you
86
+ * do not need to control its open state.
87
+ */
88
+ defaultOpen?: DropdownMenuPrimitive.DropdownMenuSubProps[ 'defaultOpen' ];
89
+ /**
90
+ * The controlled open state of the submenu. Must be used in conjunction with
91
+ * `onOpenChange`.
92
+ */
93
+ open?: DropdownMenuPrimitive.DropdownMenuSubProps[ 'open' ];
94
+ /**
95
+ * Event handler called when the open state of the submenu changes.
96
+ */
97
+ onOpenChange?: DropdownMenuPrimitive.DropdownMenuSubProps[ 'onOpenChange' ];
98
+ /**
99
+ * When `true`, prevents the user from interacting with the item.
100
+ */
101
+ disabled?: DropdownMenuPrimitive.DropdownMenuSubTriggerProps[ 'disabled' ];
102
+ /**
103
+ * Optional text used for typeahead purposes for the trigger. By default the typeahead
104
+ * behavior will use the `.textContent` of the trigger. Use this when the content
105
+ * is complex, or you have non-textual content inside.
106
+ */
107
+ textValue?: DropdownMenuPrimitive.DropdownMenuSubTriggerProps[ 'textValue' ];
108
+ /**
109
+ * The contents rendered inside the trigger. The trigger should be
110
+ * an instance of the `DropdownSubMenuTriggerProps` component.
111
+ */
112
+ trigger: React.ReactNode;
113
+ /**
114
+ * The contents of the dropdown sub menu
115
+ */
116
+ children: React.ReactNode;
117
+ };
118
+
119
+ export type DropdownMenuItemProps = {
120
+ /**
121
+ * When true, prevents the user from interacting with the item.
122
+ *
123
+ * @default false
124
+ */
125
+ disabled?: DropdownMenuPrimitive.DropdownMenuItemProps[ 'disabled' ];
126
+ /**
127
+ * Event handler called when the user selects an item (via mouse or keyboard).
128
+ * Calling `event.preventDefault` in this handler will prevent the dropdown
129
+ * menu from closing when selecting that item.
130
+ */
131
+ onSelect?: DropdownMenuPrimitive.DropdownMenuItemProps[ 'onSelect' ];
132
+ /**
133
+ * Optional text used for typeahead purposes. By default the typeahead
134
+ * behavior will use the `.textContent` of the item. Use this when the content
135
+ * is complex, or you have non-textual content inside.
136
+ */
137
+ textValue?: DropdownMenuPrimitive.DropdownMenuItemProps[ 'textValue' ];
138
+ /**
139
+ * The contents of the item
140
+ */
141
+ children: React.ReactNode;
142
+ /**
143
+ * The contents of the item's prefix
144
+ */
145
+ prefix?: React.ReactNode;
146
+ /**
147
+ * The contents of the item's suffix
148
+ */
149
+ suffix?: React.ReactNode;
150
+ };
151
+
152
+ export type DropdownMenuCheckboxItemProps = {
153
+ /**
154
+ * The controlled checked state of the item.
155
+ * Must be used in conjunction with `onCheckedChange`.
156
+ *
157
+ * @default false
158
+ */
159
+ checked?: DropdownMenuPrimitive.DropdownMenuCheckboxItemProps[ 'checked' ];
160
+ /**
161
+ * Event handler called when the checked state changes.
162
+ */
163
+ onCheckedChange?: DropdownMenuPrimitive.DropdownMenuCheckboxItemProps[ 'onCheckedChange' ];
164
+ /**
165
+ * When `true`, prevents the user from interacting with the item.
166
+ */
167
+ disabled?: DropdownMenuPrimitive.DropdownMenuCheckboxItemProps[ 'disabled' ];
168
+ /**
169
+ * Event handler called when the user selects an item (via mouse or keyboard).
170
+ * Calling `event.preventDefault` in this handler will prevent the dropdown
171
+ * menu from closing when selecting that item.
172
+ */
173
+ onSelect?: DropdownMenuPrimitive.DropdownMenuCheckboxItemProps[ 'onSelect' ];
174
+ /**
175
+ * Optional text used for typeahead purposes. By default the typeahead
176
+ * behavior will use the `.textContent` of the item. Use this when the content
177
+ * is complex, or you have non-textual content inside.
178
+ */
179
+ textValue?: DropdownMenuPrimitive.DropdownMenuCheckboxItemProps[ 'textValue' ];
180
+ /**
181
+ * The contents of the checkbox item
182
+ */
183
+ children: React.ReactNode;
184
+ /**
185
+ * The contents of the checkbox item's suffix
186
+ */
187
+ suffix?: React.ReactNode;
188
+ };
189
+
190
+ export type DropdownMenuRadioGroupProps = {
191
+ /**
192
+ * The value of the selected item in the group.
193
+ */
194
+ value?: DropdownMenuPrimitive.DropdownMenuRadioGroupProps[ 'value' ];
195
+ /**
196
+ * Event handler called when the value changes.
197
+ */
198
+ onValueChange?: DropdownMenuPrimitive.DropdownMenuRadioGroupProps[ 'onValueChange' ];
199
+ /**
200
+ * The contents of the radio group
201
+ */
202
+ children: React.ReactNode;
203
+ };
204
+
205
+ export type DropdownMenuRadioItemProps = {
206
+ /**
207
+ * The unique value of the item.
208
+ */
209
+ value: DropdownMenuPrimitive.DropdownMenuRadioItemProps[ 'value' ];
210
+ /**
211
+ * When `true`, prevents the user from interacting with the item.
212
+ */
213
+ disabled?: DropdownMenuPrimitive.DropdownMenuRadioItemProps[ 'disabled' ];
214
+ /**
215
+ * Event handler called when the user selects an item (via mouse or keyboard).
216
+ * Calling `event.preventDefault` in this handler will prevent the dropdown
217
+ * menu from closing when selecting that item.
218
+ */
219
+ onSelect?: DropdownMenuPrimitive.DropdownMenuRadioItemProps[ 'onSelect' ];
220
+ /**
221
+ * Optional text used for typeahead purposes. By default the typeahead
222
+ * behavior will use the `.textContent` of the item. Use this when the content
223
+ * is complex, or you have non-textual content inside.
224
+ */
225
+ textValue?: DropdownMenuPrimitive.DropdownMenuRadioItemProps[ 'textValue' ];
226
+ /**
227
+ * The contents of the radio item
228
+ */
229
+ children: React.ReactNode;
230
+ /**
231
+ * The contents of the radio item's suffix
232
+ */
233
+ suffix?: React.ReactNode;
234
+ };
235
+
236
+ export type DropdownMenuLabelProps = {
237
+ /**
238
+ * The contents of the label
239
+ */
240
+ children: React.ReactNode;
241
+ };
242
+
243
+ export type DropdownMenuGroupProps = {
244
+ /**
245
+ * The contents of the group
246
+ */
247
+ children: React.ReactNode;
248
+ };
249
+
250
+ export type DropdownMenuSeparatorProps = {};
@@ -94,7 +94,6 @@ export { default as HTMLTextInput } from './mobile/html-text-input';
94
94
  export { default as KeyboardAvoidingView } from './mobile/keyboard-avoiding-view';
95
95
  export { default as KeyboardAwareFlatList } from './mobile/keyboard-aware-flat-list';
96
96
  export { default as Picker } from './mobile/picker';
97
- export { default as ReadableContentView } from './mobile/readable-content-view';
98
97
  export { default as CycleSelectControl } from './mobile/cycle-select-control';
99
98
  export { default as Gradient } from './mobile/gradient';
100
99
  export { default as ColorSettings } from './mobile/color-settings';
@@ -270,9 +270,14 @@ const backdropFocusedStyles = ( {
270
270
  let borderColor = isFocused ? COLORS.ui.borderFocus : COLORS.ui.border;
271
271
 
272
272
  let boxShadow;
273
+ let outline;
274
+ let outlineOffset;
273
275
 
274
276
  if ( isFocused ) {
275
277
  boxShadow = `0 0 0 1px ${ COLORS.ui.borderFocus } inset`;
278
+ // Windows High Contrast mode will show this outline, but not the box-shadow.
279
+ outline = `2px solid transparent`;
280
+ outlineOffset = `-2px`;
276
281
  }
277
282
 
278
283
  if ( disabled ) {
@@ -284,6 +289,8 @@ const backdropFocusedStyles = ( {
284
289
  borderColor,
285
290
  borderStyle: 'solid',
286
291
  borderWidth: 1,
292
+ outline,
293
+ outlineOffset,
287
294
  } );
288
295
  };
289
296
 
@@ -92,6 +92,7 @@ class BottomSheetCell extends Component {
92
92
  accessibilityHint,
93
93
  accessibilityRole,
94
94
  disabled = false,
95
+ disabledStyle = styles.cellDisabled,
95
96
  activeOpacity,
96
97
  onPress,
97
98
  onLongPress,
@@ -223,11 +224,22 @@ class BottomSheetCell extends Component {
223
224
  styles.cellValue,
224
225
  styles.cellTextDark
225
226
  );
226
- const finalStyle = {
227
+ const textInputStyle = {
227
228
  ...cellValueStyle,
228
229
  ...valueStyle,
229
230
  ...styleRTL,
230
231
  };
232
+ const placeholderTextColor = disabled
233
+ ? this.props.getStylesFromColorScheme(
234
+ styles.placeholderColorDisabled,
235
+ styles.placeholderColorDisabledDark
236
+ ).color
237
+ : styles.placeholderColor.color;
238
+ const textStyle = {
239
+ ...( disabled && styles.cellDisabled ),
240
+ ...cellValueStyle,
241
+ ...valueStyle,
242
+ };
231
243
 
232
244
  // To be able to show the `middle` ellipsizeMode on editable cells
233
245
  // we show the TextInput just when the user wants to edit the value,
@@ -238,10 +250,10 @@ class BottomSheetCell extends Component {
238
250
  <TextInput
239
251
  ref={ ( c ) => ( this._valueTextInput = c ) }
240
252
  numberOfLines={ 1 }
241
- style={ finalStyle }
253
+ style={ textInputStyle }
242
254
  value={ value }
243
255
  placeholder={ valuePlaceholder }
244
- placeholderTextColor={ '#87a6bc' }
256
+ placeholderTextColor={ placeholderTextColor }
245
257
  onChangeText={ onChangeValue }
246
258
  editable={ isValueEditable }
247
259
  pointerEvents={
@@ -251,11 +263,12 @@ class BottomSheetCell extends Component {
251
263
  onBlur={ finishEditing }
252
264
  onSubmitEditing={ onSubmit }
253
265
  keyboardType={ this.typeToKeyboardType( type, step ) }
266
+ disabled={ disabled }
254
267
  { ...valueProps }
255
268
  />
256
269
  ) : (
257
270
  <Text
258
- style={ { ...cellValueStyle, ...valueStyle } }
271
+ style={ textStyle }
259
272
  numberOfLines={ 1 }
260
273
  ellipsizeMode={ 'middle' }
261
274
  >
@@ -418,7 +431,15 @@ class BottomSheetCell extends Component {
418
431
  />
419
432
  ) }
420
433
  { showValue && getValueComponent() }
421
- { children }
434
+ <View
435
+ style={ [
436
+ disabled && disabledStyle,
437
+ styles.cellRowContainer,
438
+ ] }
439
+ pointerEvents={ disabled ? 'none' : 'auto' }
440
+ >
441
+ { children }
442
+ </View>
422
443
  </View>
423
444
  { help && (
424
445
  <Text style={ [ cellHelpStyle, styles.placeholderColor ] }>
@@ -218,6 +218,7 @@ class BottomSheetRangeCell extends Component {
218
218
  activeOpacity={ 1 }
219
219
  accessible={ false }
220
220
  valueStyle={ styles.valueStyle }
221
+ disabled={ disabled }
221
222
  >
222
223
  <View style={ containerStyle }>
223
224
  { preview }
@@ -225,7 +226,7 @@ class BottomSheetRangeCell extends Component {
225
226
  testID={ `Slider ${ cellProps.label }` }
226
227
  value={ sliderValue }
227
228
  defaultValue={ defaultValue }
228
- disabled={ disabled }
229
+ disabled={ disabled && ! isIOS }
229
230
  step={ step }
230
231
  minimumValue={ minimumValue }
231
232
  maximumValue={ maximumValue }
@@ -144,6 +144,7 @@ class BottomSheetStepperCell extends Component {
144
144
  openUnitPicker,
145
145
  decimalNum,
146
146
  cellContainerStyle,
147
+ disabled,
147
148
  } = this.props;
148
149
  const { inputValue } = this.state;
149
150
  const isMinValue = value === min;
@@ -215,6 +216,7 @@ class BottomSheetStepperCell extends Component {
215
216
  labelStyle={ labelStyle }
216
217
  leftAlign={ true }
217
218
  separatorType={ separatorType }
219
+ disabled={ disabled }
218
220
  >
219
221
  <View style={ preview && containerStyle }>
220
222
  { preview }
@@ -284,7 +284,15 @@
284
284
 
285
285
  // used in both light and dark modes
286
286
  .placeholderColor {
287
- color: #87a6bc;
287
+ color: $gray;
288
+ }
289
+
290
+ .placeholderColorDisabled {
291
+ color: lighten($gray, 20%);
292
+ }
293
+
294
+ .placeholderColorDisabledDark {
295
+ color: lighten($gray-dark, 10%);
288
296
  }
289
297
 
290
298
  .applyButton {
@@ -317,3 +325,7 @@
317
325
  .cellSubLabelTextDark {
318
326
  color: $sub-heading-dark;
319
327
  }
328
+
329
+ .cellDisabled {
330
+ opacity: 0.3;
331
+ }
@@ -12,8 +12,10 @@ import { __, _x, sprintf } from '@wordpress/i18n';
12
12
  */
13
13
  import Cell from './cell';
14
14
 
15
+ const EMPTY_STYLE = {};
16
+
15
17
  export default function BottomSheetSwitchCell( props ) {
16
- const { value, onValueChange, ...cellProps } = props;
18
+ const { value, onValueChange, disabled, ...cellProps } = props;
17
19
 
18
20
  const onPress = () => {
19
21
  onValueChange( ! value );
@@ -60,8 +62,14 @@ export default function BottomSheetSwitchCell( props ) {
60
62
  onPress={ onPress }
61
63
  editable={ false }
62
64
  value={ '' }
65
+ disabled={ disabled }
66
+ disabledStyle={ EMPTY_STYLE }
63
67
  >
64
- <Switch value={ value } onValueChange={ onValueChange } />
68
+ <Switch
69
+ value={ value }
70
+ onValueChange={ onValueChange }
71
+ disabled={ disabled }
72
+ />
65
73
  </Cell>
66
74
  );
67
75
  }
@@ -22,6 +22,7 @@ const BottomSheetSelectControl = ( {
22
22
  options: items,
23
23
  onChange,
24
24
  value: selectedValue,
25
+ disabled,
25
26
  } ) => {
26
27
  const [ showSubSheet, setShowSubSheet ] = useState( false );
27
28
  const navigation = useNavigation();
@@ -68,6 +69,7 @@ const BottomSheetSelectControl = ( {
68
69
  __( 'Navigates to select %s' ),
69
70
  label
70
71
  ) }
72
+ disabled={ disabled }
71
73
  >
72
74
  <Icon icon={ chevronRight }></Icon>
73
75
  </BottomSheet.Cell>
@@ -29,6 +29,7 @@ const BottomSheetTextControl = ( {
29
29
  icon,
30
30
  footerNote,
31
31
  cellPlaceholder,
32
+ disabled,
32
33
  } ) => {
33
34
  const [ showSubSheet, setShowSubSheet ] = useState( false );
34
35
  const navigation = useNavigation();
@@ -62,6 +63,7 @@ const BottomSheetTextControl = ( {
62
63
  onPress={ openSubSheet }
63
64
  value={ initialValue || '' }
64
65
  placeholder={ cellPlaceholder || placeholder || '' }
66
+ disabled={ disabled }
65
67
  >
66
68
  <Icon icon={ chevronRight }></Icon>
67
69
  </BottomSheet.Cell>
@@ -252,12 +252,7 @@ function UnforwardedModal(
252
252
  ) }
253
253
  </div>
254
254
  ) }
255
- <div
256
- ref={ childrenContainerRef }
257
- className="components-modal__children-container"
258
- >
259
- { children }
260
- </div>
255
+ <div ref={ childrenContainerRef }>{ children }</div>
261
256
  </div>
262
257
  </div>
263
258
  </StyleProvider>
@@ -9,6 +9,18 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri
9
9
  import { default as CustomSelectControl } from './custom-select-control';
10
10
  import { positionToPlacement as __experimentalPopoverLegacyPositionToPlacement } from './popover/utils';
11
11
  import { createPrivateSlotFill } from './slot-fill';
12
+ import {
13
+ DropdownMenu as DropdownMenuV2,
14
+ DropdownMenuCheckboxItem as DropdownMenuCheckboxItemV2,
15
+ DropdownMenuGroup as DropdownMenuGroupV2,
16
+ DropdownMenuItem as DropdownMenuItemV2,
17
+ DropdownMenuLabel as DropdownMenuLabelV2,
18
+ DropdownMenuRadioGroup as DropdownMenuRadioGroupV2,
19
+ DropdownMenuRadioItem as DropdownMenuRadioItemV2,
20
+ DropdownMenuSeparator as DropdownMenuSeparatorV2,
21
+ DropdownSubMenu as DropdownSubMenuV2,
22
+ DropdownSubMenuTrigger as DropdownSubMenuTriggerV2,
23
+ } from './dropdown-menu-v2';
12
24
 
13
25
  export const { lock, unlock } =
14
26
  __dangerousOptInToUnstableAPIsOnlyForCoreModules(
@@ -21,4 +33,14 @@ lock( privateApis, {
21
33
  CustomSelectControl,
22
34
  __experimentalPopoverLegacyPositionToPlacement,
23
35
  createPrivateSlotFill,
36
+ DropdownMenuV2,
37
+ DropdownMenuCheckboxItemV2,
38
+ DropdownMenuGroupV2,
39
+ DropdownMenuItemV2,
40
+ DropdownMenuLabelV2,
41
+ DropdownMenuRadioGroupV2,
42
+ DropdownMenuRadioItemV2,
43
+ DropdownMenuSeparatorV2,
44
+ DropdownSubMenuV2,
45
+ DropdownSubMenuTriggerV2,
24
46
  } );
@@ -25,6 +25,7 @@ const RangeControl = memo(
25
25
  max,
26
26
  type,
27
27
  separatorType,
28
+ disabled,
28
29
  ...props
29
30
  } ) => {
30
31
  if ( type === 'stepper' ) {
@@ -36,6 +37,7 @@ const RangeControl = memo(
36
37
  onChange={ onChange }
37
38
  separatorType={ separatorType }
38
39
  value={ value }
40
+ disabled={ disabled }
39
41
  />
40
42
  );
41
43
  }
@@ -61,6 +63,7 @@ const RangeControl = memo(
61
63
  allowReset={ allowReset }
62
64
  defaultValue={ initialSliderValue }
63
65
  separatorType={ separatorType }
66
+ disabled={ disabled }
64
67
  { ...props }
65
68
  />
66
69
  );
@@ -41,10 +41,12 @@
41
41
  .components-search-control__icon {
42
42
  position: absolute;
43
43
  top: 0;
44
+ width: $icon-size;
44
45
  right: ( $grid-unit-60 - $icon-size ) * 0.5;
45
46
  bottom: 0;
46
47
  display: flex;
47
48
  align-items: center;
49
+ justify-content: center;
48
50
 
49
51
  > svg {
50
52
  margin: $grid-unit-10 0;
@@ -73,7 +73,6 @@ export function SnackbarList( {
73
73
 
74
74
  return (
75
75
  <motion.div
76
- layout={ ! isReducedMotion } // See https://www.framer.com/docs/animation/#layout-animations
77
76
  initial={ 'init' }
78
77
  animate={ 'open' }
79
78
  exit={ 'exit' }
@@ -67,8 +67,9 @@ exports[`ToggleGroupControl should render correctly with icons 1`] = `
67
67
  .emotion-8:focus-within {
68
68
  border-color: var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #2145e6));
69
69
  box-shadow: 0 0 0 0.5px var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
70
- outline: none;
71
70
  z-index: 1;
71
+ outline: 2px solid transparent;
72
+ outline-offset: -2px;
72
73
  }
73
74
 
74
75
  .emotion-10 {
@@ -81,6 +82,8 @@ exports[`ToggleGroupControl should render correctly with icons 1`] = `
81
82
  -webkit-transition: -webkit-transform 160ms ease;
82
83
  transition: transform 160ms ease;
83
84
  z-index: 1;
85
+ outline: 2px solid transparent;
86
+ outline-offset: -3px;
84
87
  }
85
88
 
86
89
  @media ( prefers-reduced-motion: reduce ) {
@@ -402,8 +405,9 @@ exports[`ToggleGroupControl should render correctly with text options 1`] = `
402
405
  .emotion-8:focus-within {
403
406
  border-color: var(--wp-components-color-accent-darker-10, var(--wp-admin-theme-color-darker-10, #2145e6));
404
407
  box-shadow: 0 0 0 0.5px var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
405
- outline: none;
406
408
  z-index: 1;
409
+ outline: 2px solid transparent;
410
+ outline-offset: -2px;
407
411
  }
408
412
 
409
413
  .emotion-10 {
@@ -46,8 +46,10 @@ const enclosingBorders = ( isBlock: ToggleGroupControlProps[ 'isBlock' ] ) => {
46
46
  &:focus-within {
47
47
  border-color: ${ COLORS.ui.borderFocus };
48
48
  box-shadow: ${ CONFIG.controlBoxShadowFocus };
49
- outline: none;
50
49
  z-index: 1;
50
+ // Windows High Contrast mode will show this outline, but not the box-shadow.
51
+ outline: 2px solid transparent;
52
+ outline-offset: -2px;
51
53
  }
52
54
  `;
53
55
  };
@@ -80,6 +82,9 @@ export const BackdropView = styled.div`
80
82
  transition: transform ${ CONFIG.transitionDurationFast } ease;
81
83
  ${ reduceMotion( 'transition' ) }
82
84
  z-index: 1;
85
+ // Windows High Contrast mode will show this outline, but not the box-shadow.
86
+ outline: 2px solid transparent;
87
+ outline-offset: -3px;
83
88
  `;
84
89
 
85
90
  export const VisualLabelWrapper = styled.div`
@@ -82,34 +82,31 @@ Default.args = {
82
82
  </ToolbarGroup>
83
83
  <ToolbarGroup>
84
84
  <ToolbarItem>
85
- {
86
- // @ts-expect-error TODO: Remove when DropdownMenu is typed
87
- ( toggleProps ) => {
88
- return (
89
- <DropdownMenu
90
- hasArrowIndicator
91
- icon={ alignLeft }
92
- label="Align"
93
- controls={ [
94
- {
95
- icon: alignLeft,
96
- title: 'Align left',
97
- isActive: true,
98
- },
99
- {
100
- icon: alignCenter,
101
- title: 'Align center',
102
- },
103
- {
104
- icon: alignRight,
105
- title: 'Align right',
106
- },
107
- ] }
108
- toggleProps={ toggleProps }
109
- />
110
- );
111
- }
112
- }
85
+ { /* There is an issue here with TS not recognizing the
86
+ * `RenderProp` being passed.
87
+ * @ts-expect-error */ }
88
+ { ( toggleProps ) => (
89
+ <DropdownMenu
90
+ icon={ alignLeft }
91
+ label="Align"
92
+ controls={ [
93
+ {
94
+ icon: alignLeft,
95
+ title: 'Align left',
96
+ isActive: true,
97
+ },
98
+ {
99
+ icon: alignCenter,
100
+ title: 'Align center',
101
+ },
102
+ {
103
+ icon: alignRight,
104
+ title: 'Align right',
105
+ },
106
+ ] }
107
+ toggleProps={ toggleProps }
108
+ />
109
+ ) }
113
110
  </ToolbarItem>
114
111
  </ToolbarGroup>
115
112
  <ToolbarGroup>