@wordpress/components 25.12.0 → 25.13.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 (155) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/build/angle-picker-control/index.js +0 -1
  3. package/build/angle-picker-control/index.js.map +1 -1
  4. package/build/custom-select-control-v2/index.js +87 -0
  5. package/build/custom-select-control-v2/index.js.map +1 -0
  6. package/build/custom-select-control-v2/styles.js +85 -0
  7. package/build/custom-select-control-v2/styles.js.map +1 -0
  8. package/build/custom-select-control-v2/types.js +6 -0
  9. package/build/custom-select-control-v2/types.js.map +1 -0
  10. package/build/dropdown-menu-v2-ariakit/index.js +49 -20
  11. package/build/dropdown-menu-v2-ariakit/index.js.map +1 -1
  12. package/build/dropdown-menu-v2-ariakit/styles.js +82 -59
  13. package/build/dropdown-menu-v2-ariakit/styles.js.map +1 -1
  14. package/build/dropdown-menu-v2-ariakit/types.js.map +1 -1
  15. package/build/form-token-field/index.js +6 -2
  16. package/build/form-token-field/index.js.map +1 -1
  17. package/build/form-token-field/token-input.js.map +1 -1
  18. package/build/form-token-field/types.js.map +1 -1
  19. package/build/heading/hook.js +6 -3
  20. package/build/heading/hook.js.map +1 -1
  21. package/build/heading/types.js.map +1 -1
  22. package/build/mobile/utils/alignments.native.js +1 -1
  23. package/build/mobile/utils/alignments.native.js.map +1 -1
  24. package/build/private-apis.js +3 -2
  25. package/build/private-apis.js.map +1 -1
  26. package/build/slot-fill/types.js.map +1 -1
  27. package/build/tabs/index.js +6 -4
  28. package/build/tabs/index.js.map +1 -1
  29. package/build/tabs/tab.js +2 -2
  30. package/build/tabs/tab.js.map +1 -1
  31. package/build/tabs/tabpanel.js +1 -1
  32. package/build/tabs/tabpanel.js.map +1 -1
  33. package/build/text/types.js.map +1 -1
  34. package/build/tools-panel/tools-panel-item/hook.js +5 -1
  35. package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
  36. package/build-module/angle-picker-control/index.js +0 -1
  37. package/build-module/angle-picker-control/index.js.map +1 -1
  38. package/build-module/custom-select-control-v2/index.js +74 -0
  39. package/build-module/custom-select-control-v2/index.js.map +1 -0
  40. package/build-module/custom-select-control-v2/styles.js +71 -0
  41. package/build-module/custom-select-control-v2/styles.js.map +1 -0
  42. package/build-module/custom-select-control-v2/types.js +2 -0
  43. package/build-module/custom-select-control-v2/types.js.map +1 -0
  44. package/build-module/dropdown-menu-v2-ariakit/index.js +46 -18
  45. package/build-module/dropdown-menu-v2-ariakit/index.js.map +1 -1
  46. package/build-module/dropdown-menu-v2-ariakit/styles.js +69 -40
  47. package/build-module/dropdown-menu-v2-ariakit/styles.js.map +1 -1
  48. package/build-module/dropdown-menu-v2-ariakit/types.js.map +1 -1
  49. package/build-module/form-token-field/index.js +6 -2
  50. package/build-module/form-token-field/index.js.map +1 -1
  51. package/build-module/form-token-field/token-input.js.map +1 -1
  52. package/build-module/form-token-field/types.js.map +1 -1
  53. package/build-module/heading/hook.js +6 -3
  54. package/build-module/heading/hook.js.map +1 -1
  55. package/build-module/heading/types.js.map +1 -1
  56. package/build-module/mobile/utils/alignments.native.js +1 -1
  57. package/build-module/mobile/utils/alignments.native.js.map +1 -1
  58. package/build-module/private-apis.js +4 -3
  59. package/build-module/private-apis.js.map +1 -1
  60. package/build-module/slot-fill/types.js.map +1 -1
  61. package/build-module/tabs/index.js +7 -5
  62. package/build-module/tabs/index.js.map +1 -1
  63. package/build-module/tabs/tab.js +4 -4
  64. package/build-module/tabs/tab.js.map +1 -1
  65. package/build-module/tabs/tabpanel.js +3 -3
  66. package/build-module/tabs/tabpanel.js.map +1 -1
  67. package/build-module/text/types.js.map +1 -1
  68. package/build-module/tools-panel/tools-panel-item/hook.js +6 -2
  69. package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
  70. package/build-style/style-rtl.css +31 -5
  71. package/build-style/style.css +31 -5
  72. package/build-types/angle-picker-control/index.d.ts.map +1 -1
  73. package/build-types/box-control/stories/index.story.d.ts +1944 -0
  74. package/build-types/box-control/stories/index.story.d.ts.map +1 -0
  75. package/build-types/color-palette/styles.d.ts +4 -1
  76. package/build-types/color-palette/styles.d.ts.map +1 -1
  77. package/build-types/custom-select-control-v2/index.d.ts +6 -0
  78. package/build-types/custom-select-control-v2/index.d.ts.map +1 -0
  79. package/build-types/custom-select-control-v2/stories/index.story.d.ts +19 -0
  80. package/build-types/custom-select-control-v2/stories/index.story.d.ts.map +1 -0
  81. package/build-types/custom-select-control-v2/styles.d.ts +47 -0
  82. package/build-types/custom-select-control-v2/styles.d.ts.map +1 -0
  83. package/build-types/custom-select-control-v2/types.d.ts +57 -0
  84. package/build-types/custom-select-control-v2/types.d.ts.map +1 -0
  85. package/build-types/date-time/date/styles.d.ts +4 -1
  86. package/build-types/date-time/date/styles.d.ts.map +1 -1
  87. package/build-types/dropdown-menu-v2-ariakit/index.d.ts +11 -2
  88. package/build-types/dropdown-menu-v2-ariakit/index.d.ts.map +1 -1
  89. package/build-types/dropdown-menu-v2-ariakit/stories/index.story.d.ts.map +1 -1
  90. package/build-types/dropdown-menu-v2-ariakit/styles.d.ts +26 -18
  91. package/build-types/dropdown-menu-v2-ariakit/styles.d.ts.map +1 -1
  92. package/build-types/dropdown-menu-v2-ariakit/types.d.ts +0 -6
  93. package/build-types/dropdown-menu-v2-ariakit/types.d.ts.map +1 -1
  94. package/build-types/form-token-field/index.d.ts.map +1 -1
  95. package/build-types/form-token-field/token-input.d.ts.map +1 -1
  96. package/build-types/form-token-field/types.d.ts +1 -1
  97. package/build-types/form-token-field/types.d.ts.map +1 -1
  98. package/build-types/heading/component.d.ts +4 -1
  99. package/build-types/heading/component.d.ts.map +1 -1
  100. package/build-types/heading/hook.d.ts.map +1 -1
  101. package/build-types/heading/types.d.ts +20 -1
  102. package/build-types/heading/types.d.ts.map +1 -1
  103. package/build-types/navigation/styles/navigation-styles.d.ts +4 -1
  104. package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -1
  105. package/build-types/palette-edit/styles.d.ts +4 -1
  106. package/build-types/palette-edit/styles.d.ts.map +1 -1
  107. package/build-types/private-apis.d.ts.map +1 -1
  108. package/build-types/slot-fill/bubbles-virtually/slot.d.ts +1 -1
  109. package/build-types/slot-fill/types.d.ts +16 -6
  110. package/build-types/slot-fill/types.d.ts.map +1 -1
  111. package/build-types/tabs/index.d.ts +1 -0
  112. package/build-types/tabs/index.d.ts.map +1 -1
  113. package/build-types/tabs/stories/index.story.d.ts.map +1 -1
  114. package/build-types/text/types.d.ts +15 -2
  115. package/build-types/text/types.d.ts.map +1 -1
  116. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  117. package/package.json +19 -19
  118. package/src/angle-picker-control/index.tsx +0 -1
  119. package/src/box-control/stories/index.story.tsx +82 -0
  120. package/src/button/style.scss +10 -2
  121. package/src/combobox-control/README.md +1 -3
  122. package/src/custom-select-control-v2/README.md +73 -0
  123. package/src/custom-select-control-v2/index.tsx +99 -0
  124. package/src/custom-select-control-v2/stories/index.story.tsx +149 -0
  125. package/src/custom-select-control-v2/styles.ts +76 -0
  126. package/src/custom-select-control-v2/types.ts +63 -0
  127. package/src/dropdown-menu-v2-ariakit/README.md +19 -5
  128. package/src/dropdown-menu-v2-ariakit/index.tsx +85 -36
  129. package/src/dropdown-menu-v2-ariakit/stories/index.story.tsx +204 -90
  130. package/src/dropdown-menu-v2-ariakit/styles.ts +153 -117
  131. package/src/dropdown-menu-v2-ariakit/test/index.tsx +5 -10
  132. package/src/dropdown-menu-v2-ariakit/types.ts +0 -7
  133. package/src/form-toggle/style.scss +37 -7
  134. package/src/form-token-field/index.tsx +11 -3
  135. package/src/form-token-field/token-input.tsx +1 -3
  136. package/src/form-token-field/types.ts +1 -0
  137. package/src/heading/README.md +6 -1
  138. package/src/heading/hook.ts +6 -3
  139. package/src/heading/types.ts +23 -1
  140. package/src/mobile/utils/alignments.native.js +1 -0
  141. package/src/navigable-container/README.md +1 -1
  142. package/src/private-apis.ts +4 -2
  143. package/src/slot-fill/README.md +1 -1
  144. package/src/slot-fill/types.ts +18 -6
  145. package/src/tabs/index.tsx +12 -2
  146. package/src/tabs/stories/index.story.tsx +8 -0
  147. package/src/tabs/tab.tsx +4 -4
  148. package/src/tabs/tabpanel.tsx +3 -3
  149. package/src/tabs/test/index.tsx +19 -0
  150. package/src/text/README.md +5 -1
  151. package/src/text/types.ts +15 -2
  152. package/src/toggle-control/README.md +2 -2
  153. package/src/tools-panel/tools-panel-item/hook.ts +11 -2
  154. package/tsconfig.tsbuildinfo +1 -1
  155. package/src/box-control/stories/index.story.js +0 -75
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tabs/index.tsx"],"names":[],"mappings":";AAYA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAMzC,iBAAS,IAAI,CAAE,EACd,YAAmB,EACnB,YAAY,EACZ,WAA0B,EAC1B,QAAQ,EACR,QAAQ,EACR,aAAa,GACb,EAAE,SAAS,eAqIX;kBA5IQ,IAAI;;;;;AAiJb,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tabs/index.tsx"],"names":[],"mappings":";AAYA;;GAEG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAMzC,iBAAS,IAAI,CAAE,EACd,YAAmB,EACnB,YAAY,EACZ,WAA0B,EAC1B,QAAQ,EACR,QAAQ,EACR,aAAa,GACb,EAAE,SAAS,eA6IX;kBApJQ,IAAI;;;;;;AA2Jb,eAAe,IAAI,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/tabs/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,kBAAkB,CAAC;AAQtD;;GAEG;AACH,OAAO,IAAI,MAAM,IAAI,CAAC;AAKtB,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,IAAI,CAQ5B,CAAC;AACF,eAAe,IAAI,CAAC;AA+BpB,eAAO,MAAM,OAAO,6HAAsB,CAAC;AAwB3C,eAAO,MAAM,WAAW,6HAAiC,CAAC;AAqC1D,eAAO,MAAM,uBAAuB,6HAEnC,CAAC;AAEF,eAAO,MAAM,gBAAgB,6HAAsB,CAAC;AA0CpD,eAAO,MAAM,aAAa,6HAAmC,CAAC;AA6D9D,eAAO,MAAM,oBAAoB,6HAAiC,CAAC;AA+DnE,eAAO,MAAM,cAAc,6HAAoC,CAAC;AAqChE,eAAO,MAAM,kBAAkB,6HAAwC,CAAC;AAgCxE,eAAO,MAAM,cAAc,6HAAoC,CAAC"}
1
+ {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/tabs/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,kBAAkB,CAAC;AAQtD;;GAEG;AACH,OAAO,IAAI,MAAM,IAAI,CAAC;AAKtB,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,IAAI,CAgB5B,CAAC;AACF,eAAe,IAAI,CAAC;AA+BpB,eAAO,MAAM,OAAO,6HAAsB,CAAC;AAwB3C,eAAO,MAAM,WAAW,6HAAiC,CAAC;AAqC1D,eAAO,MAAM,uBAAuB,6HAEnC,CAAC;AAEF,eAAO,MAAM,gBAAgB,6HAAsB,CAAC;AA0CpD,eAAO,MAAM,aAAa,6HAAmC,CAAC;AA6D9D,eAAO,MAAM,oBAAoB,6HAAiC,CAAC;AA+DnE,eAAO,MAAM,cAAc,6HAAoC,CAAC;AAqChE,eAAO,MAAM,kBAAkB,6HAAwC,CAAC;AAgCxE,eAAO,MAAM,cAAc,6HAAoC,CAAC"}
@@ -35,10 +35,14 @@ export interface Props extends TruncateProps {
35
35
  isDestructive?: boolean;
36
36
  /**
37
37
  * Escape characters in `highlightWords` which are meaningful in regular expressions.
38
+ *
39
+ * @default false
38
40
  */
39
41
  highlightEscape?: boolean;
40
42
  /**
41
43
  * Determines if `highlightWords` should be case sensitive.
44
+ *
45
+ * @default false
42
46
  */
43
47
  highlightCaseSensitive?: boolean;
44
48
  /**
@@ -46,7 +50,10 @@ export interface Props extends TruncateProps {
46
50
  */
47
51
  highlightSanitize?: FindAllArgs['sanitize'];
48
52
  /**
49
- * Sets `Text` to have `display: block`.
53
+ * Sets `Text` to have `display: block`. Note: text truncation only works
54
+ * when `isBlock` is `false`.
55
+ *
56
+ * @default false
50
57
  */
51
58
  isBlock?: boolean;
52
59
  /**
@@ -62,11 +69,15 @@ export interface Props extends TruncateProps {
62
69
  */
63
70
  size?: CSSProperties['fontSize'] | TextSize;
64
71
  /**
65
- * Enables text truncation. When `truncate` is set,we are able to truncate the long text in a variety of ways.
72
+ * Enables text truncation. When `truncate` is set, we are able to truncate the long text in a variety of ways. Note: text truncation won't work if the `isBlock` property is set to `true`
73
+ *
74
+ * @default false
66
75
  */
67
76
  truncate?: boolean;
68
77
  /**
69
78
  * Uppercases the text content.
79
+ *
80
+ * @default false
70
81
  */
71
82
  upperCase?: boolean;
72
83
  /**
@@ -75,6 +86,8 @@ export interface Props extends TruncateProps {
75
86
  variant?: TextVariant;
76
87
  /**
77
88
  * Adjusts font-weight of the text.
89
+ *
90
+ * @default 'normal'
78
91
  */
79
92
  weight?: CSSProperties['fontWeight'] | TextWeight;
80
93
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/text/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,MAAM,QAAQ,GACjB,MAAM,GACN,SAAS,GACT,UAAU,GACV,YAAY,GACZ,a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{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../src/tools-panel/tools-panel-item/hook.ts"],"names":[],"mappings":";AAgBA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAG7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAIpD,wBAAgB,iBAAiB,CAChC,KAAK,EAAE,uBAAuB,CAAE,mBAAmB,EAAE,KAAK,CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkM5D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/components",
3
- "version": "25.12.0",
3
+ "version": "25.13.0",
4
4
  "description": "UI components for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -43,23 +43,23 @@
43
43
  "@types/gradient-parser": "0.1.3",
44
44
  "@types/highlight-words-core": "1.2.1",
45
45
  "@use-gesture/react": "^10.2.24",
46
- "@wordpress/a11y": "^3.46.0",
47
- "@wordpress/compose": "^6.23.0",
48
- "@wordpress/date": "^4.46.0",
49
- "@wordpress/deprecated": "^3.46.0",
50
- "@wordpress/dom": "^3.46.0",
51
- "@wordpress/element": "^5.23.0",
52
- "@wordpress/escape-html": "^2.46.0",
53
- "@wordpress/hooks": "^3.46.0",
54
- "@wordpress/html-entities": "^3.46.0",
55
- "@wordpress/i18n": "^4.46.0",
56
- "@wordpress/icons": "^9.37.0",
57
- "@wordpress/is-shallow-equal": "^4.46.0",
58
- "@wordpress/keycodes": "^3.46.0",
59
- "@wordpress/primitives": "^3.44.0",
60
- "@wordpress/private-apis": "^0.28.0",
61
- "@wordpress/rich-text": "^6.23.0",
62
- "@wordpress/warning": "^2.46.0",
46
+ "@wordpress/a11y": "^3.47.0",
47
+ "@wordpress/compose": "^6.24.0",
48
+ "@wordpress/date": "^4.47.0",
49
+ "@wordpress/deprecated": "^3.47.0",
50
+ "@wordpress/dom": "^3.47.0",
51
+ "@wordpress/element": "^5.24.0",
52
+ "@wordpress/escape-html": "^2.47.0",
53
+ "@wordpress/hooks": "^3.47.0",
54
+ "@wordpress/html-entities": "^3.47.0",
55
+ "@wordpress/i18n": "^4.47.0",
56
+ "@wordpress/icons": "^9.38.0",
57
+ "@wordpress/is-shallow-equal": "^4.47.0",
58
+ "@wordpress/keycodes": "^3.47.0",
59
+ "@wordpress/primitives": "^3.45.0",
60
+ "@wordpress/private-apis": "^0.29.0",
61
+ "@wordpress/rich-text": "^6.24.0",
62
+ "@wordpress/warning": "^2.47.0",
63
63
  "change-case": "^4.1.2",
64
64
  "classnames": "^2.3.1",
65
65
  "colord": "^2.7.0",
@@ -89,5 +89,5 @@
89
89
  "publishConfig": {
90
90
  "access": "public"
91
91
  },
92
- "gitHead": "839018ff6029ba749780e288e08ff9cd898e50e8"
92
+ "gitHead": "d98dff8ea96f29cfea045bf964269f46f040d539"
93
93
  }
@@ -41,7 +41,6 @@ function UnforwardedAnglePickerControl(
41
41
  'Bottom margin styles for wp.components.AnglePickerControl',
42
42
  {
43
43
  since: '6.1',
44
- version: '6.4',
45
44
  hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version.',
46
45
  }
47
46
  );
@@ -0,0 +1,82 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { Meta, StoryFn } from '@storybook/react';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { useState } from '@wordpress/element';
10
+
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+ import BoxControl from '../';
15
+
16
+ const meta: Meta< typeof BoxControl > = {
17
+ title: 'Components (Experimental)/BoxControl',
18
+ component: BoxControl,
19
+ argTypes: {
20
+ values: { control: { type: null } },
21
+ },
22
+ parameters: {
23
+ actions: { argTypesRegex: '^on.*' },
24
+ controls: { expanded: true },
25
+ docs: { canvas: { sourceState: 'shown' } },
26
+ },
27
+ };
28
+ export default meta;
29
+
30
+ const TemplateUncontrolled: StoryFn< typeof BoxControl > = ( props ) => {
31
+ return <BoxControl { ...props } />;
32
+ };
33
+
34
+ const TemplateControlled: StoryFn< typeof BoxControl > = ( props ) => {
35
+ const [ values, setValues ] = useState< ( typeof props )[ 'values' ] >();
36
+
37
+ return (
38
+ <BoxControl
39
+ values={ values }
40
+ { ...props }
41
+ onChange={ ( nextValue ) => {
42
+ setValues( nextValue );
43
+ props.onChange?.( nextValue );
44
+ } }
45
+ />
46
+ );
47
+ };
48
+
49
+ export const Default = TemplateUncontrolled.bind( {} );
50
+ Default.args = {
51
+ label: 'Label',
52
+ };
53
+
54
+ export const Controlled = TemplateControlled.bind( {} );
55
+ Controlled.args = {
56
+ ...Default.args,
57
+ };
58
+
59
+ export const ArbitrarySides = TemplateControlled.bind( {} );
60
+ ArbitrarySides.args = {
61
+ ...Default.args,
62
+ sides: [ 'top', 'bottom' ],
63
+ };
64
+
65
+ export const SingleSide = TemplateControlled.bind( {} );
66
+ SingleSide.args = {
67
+ ...Default.args,
68
+ sides: [ 'bottom' ],
69
+ };
70
+
71
+ export const AxialControls = TemplateControlled.bind( {} );
72
+ AxialControls.args = {
73
+ ...Default.args,
74
+ splitOnAxis: true,
75
+ };
76
+
77
+ export const AxialControlsWithSingleSide = TemplateControlled.bind( {} );
78
+ AxialControlsWithSingleSide.args = {
79
+ ...Default.args,
80
+ sides: [ 'horizontal' ],
81
+ splitOnAxis: true,
82
+ };
@@ -129,8 +129,11 @@
129
129
  background: transparent;
130
130
  transform: none;
131
131
  opacity: 1;
132
- box-shadow: none;
133
- outline: none;
132
+
133
+ &:not(:focus) {
134
+ box-shadow: none;
135
+ outline: none;
136
+ }
134
137
  }
135
138
  }
136
139
 
@@ -242,6 +245,11 @@
242
245
  &.is-secondary.is-busy:disabled,
243
246
  &.is-secondary.is-busy[aria-disabled="true"] {
244
247
  animation: components-button__busy-animation 2500ms infinite linear;
248
+ // This should be refactored to use the reduce-motion("animation") mixin
249
+ // as soon as https://github.com/WordPress/gutenberg/issues/55566 is closed.
250
+ @media (prefers-reduced-motion: reduce) {
251
+ animation-duration: 0s;
252
+ }
245
253
  opacity: 1;
246
254
  background-size: 100px 100%;
247
255
  // Disable reason: This function call looks nicer when each argument is on its own line.
@@ -47,9 +47,7 @@ function MyComboboxControl() {
47
47
  onFilterValueChange={ ( inputValue ) =>
48
48
  setFilteredOptions(
49
49
  options.filter( ( option ) =>
50
- option.label
51
- .toLowerCase()
52
- .startsWith( inputValue.toLowerCase() )
50
+ option.value === inputValue
53
51
  )
54
52
  )
55
53
  }
@@ -0,0 +1,73 @@
1
+ <div class="callout callout-alert">
2
+ This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes.
3
+ </div>
4
+
5
+ ### `CustomSelect`
6
+
7
+ Used to render a customizable select control component.
8
+
9
+ #### Props
10
+
11
+ The component accepts the following props:
12
+
13
+ ##### `children`: `React.ReactNode`
14
+
15
+ The child elements. This should be composed of CustomSelect.Item components.
16
+
17
+ - Required: yes
18
+
19
+ ##### `defaultValue`: `string`
20
+
21
+ An optional default value for the control. If left `undefined`, the first non-disabled item will be used.
22
+
23
+ - Required: no
24
+
25
+ ##### `label`: `string`
26
+
27
+ Label for the control.
28
+
29
+ - Required: yes
30
+
31
+ ##### `onChange`: `( newValue: string ) => void`
32
+
33
+ A function that receives the new value of the input.
34
+
35
+ - Required: no
36
+
37
+ ##### `renderSelectedValue`: `( selectValue: string ) => React.ReactNode`
38
+
39
+ Can be used to render select UI with custom styled values.
40
+
41
+ - Required: no
42
+
43
+ ##### `size`: `'default' | 'large'`
44
+
45
+ The size of the control.
46
+
47
+ - Required: no
48
+
49
+ ##### `value`: `string`
50
+
51
+ Can be used to externally control the value of the control.
52
+
53
+ - Required: no
54
+
55
+ ### `CustomSelectItem`
56
+
57
+ Used to render a select item.
58
+
59
+ #### Props
60
+
61
+ The component accepts the following props:
62
+
63
+ ##### `value`: `string`
64
+
65
+ The value of the select item. This will be used as the children if children are left `undefined`.
66
+
67
+ - Required: yes
68
+
69
+ ##### `children`: `React.ReactNode`
70
+
71
+ The children to display for each select item. The `value` will be used if left `undefined`.
72
+
73
+ - Required: no
@@ -0,0 +1,99 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ // eslint-disable-next-line no-restricted-imports
5
+ import * as Ariakit from '@ariakit/react';
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { createContext, useContext } from '@wordpress/element';
10
+ import { __, sprintf } from '@wordpress/i18n';
11
+
12
+ /**
13
+ * Internal dependencies
14
+ */
15
+ import * as Styled from './styles';
16
+ import type {
17
+ CustomSelectProps,
18
+ CustomSelectItemProps,
19
+ CustomSelectContext as CustomSelectContextType,
20
+ } from './types';
21
+
22
+ export const CustomSelectContext =
23
+ createContext< CustomSelectContextType >( undefined );
24
+
25
+ function defaultRenderSelectedValue( value: CustomSelectProps[ 'value' ] ) {
26
+ const isValueEmpty = Array.isArray( value )
27
+ ? value.length === 0
28
+ : value === undefined || value === null;
29
+
30
+ if ( isValueEmpty ) {
31
+ return __( 'Select an item' );
32
+ }
33
+
34
+ if ( Array.isArray( value ) ) {
35
+ return value.length === 1
36
+ ? value[ 0 ]
37
+ : // translators: %s: number of items selected (it will always be 2 or more items)
38
+ sprintf( __( '%s items selected' ), value.length );
39
+ }
40
+
41
+ return value;
42
+ }
43
+
44
+ export function CustomSelect( props: CustomSelectProps ) {
45
+ const {
46
+ children,
47
+ defaultValue,
48
+ label,
49
+ onChange,
50
+ size = 'default',
51
+ value,
52
+ renderSelectedValue = defaultRenderSelectedValue,
53
+ } = props;
54
+
55
+ const store = Ariakit.useSelectStore( {
56
+ setValue: ( nextValue ) => onChange?.( nextValue ),
57
+ defaultValue,
58
+ value,
59
+ } );
60
+
61
+ const { value: currentValue } = store.useState();
62
+
63
+ return (
64
+ <>
65
+ <Styled.CustomSelectLabel store={ store }>
66
+ { label }
67
+ </Styled.CustomSelectLabel>
68
+ <Styled.CustomSelectButton
69
+ size={ size }
70
+ hasCustomRenderProp={ !! renderSelectedValue }
71
+ store={ store }
72
+ >
73
+ { renderSelectedValue( currentValue ) }
74
+ <Ariakit.SelectArrow />
75
+ </Styled.CustomSelectButton>
76
+ <Styled.CustomSelectPopover gutter={ 12 } store={ store } sameWidth>
77
+ <CustomSelectContext.Provider value={ { store } }>
78
+ { children }
79
+ </CustomSelectContext.Provider>
80
+ </Styled.CustomSelectPopover>
81
+ </>
82
+ );
83
+ }
84
+
85
+ export function CustomSelectItem( {
86
+ children,
87
+ ...props
88
+ }: CustomSelectItemProps ) {
89
+ const customSelectContext = useContext( CustomSelectContext );
90
+ return (
91
+ <Styled.CustomSelectItem
92
+ store={ customSelectContext?.store }
93
+ { ...props }
94
+ >
95
+ { children ?? props.value }
96
+ <Ariakit.SelectItemCheck />
97
+ </Styled.CustomSelectItem>
98
+ );
99
+ }
@@ -0,0 +1,149 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { Meta, StoryFn } from '@storybook/react';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { useState } from '@wordpress/element';
10
+
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+ import { CustomSelect, CustomSelectItem } from '..';
15
+
16
+ const meta: Meta< typeof CustomSelect > = {
17
+ title: 'Components (Experimental)/CustomSelectControl v2',
18
+ component: CustomSelect,
19
+ subcomponents: {
20
+ // @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
21
+ CustomSelectItem,
22
+ },
23
+ argTypes: {
24
+ children: { control: { type: null } },
25
+ renderSelectedValue: { control: { type: null } },
26
+ value: { control: { type: null } },
27
+ },
28
+ parameters: {
29
+ actions: { argTypesRegex: '^on.*' },
30
+ controls: { expanded: true },
31
+ docs: {
32
+ canvas: { sourceState: 'shown' },
33
+ source: { excludeDecorators: true },
34
+ },
35
+ },
36
+ decorators: [
37
+ ( Story ) => (
38
+ <div
39
+ style={ {
40
+ minHeight: '150px',
41
+ } }
42
+ >
43
+ <Story />
44
+ </div>
45
+ ),
46
+ ],
47
+ };
48
+ export default meta;
49
+
50
+ const Template: StoryFn< typeof CustomSelect > = ( props ) => {
51
+ return <CustomSelect { ...props } />;
52
+ };
53
+
54
+ const ControlledTemplate: StoryFn< typeof CustomSelect > = ( props ) => {
55
+ const [ value, setValue ] = useState< string | string[] >();
56
+ return (
57
+ <CustomSelect
58
+ { ...props }
59
+ onChange={ ( nextValue ) => {
60
+ setValue( nextValue );
61
+ props.onChange?.( nextValue );
62
+ } }
63
+ value={ value }
64
+ />
65
+ );
66
+ };
67
+
68
+ export const Default = Template.bind( {} );
69
+ Default.args = {
70
+ label: 'Label',
71
+ children: (
72
+ <>
73
+ <CustomSelectItem value="Small">
74
+ <span style={ { fontSize: '75%' } }>Small</span>
75
+ </CustomSelectItem>
76
+ <CustomSelectItem value="Something bigger">
77
+ <span style={ { fontSize: '200%' } }>Something bigger</span>
78
+ </CustomSelectItem>
79
+ </>
80
+ ),
81
+ };
82
+
83
+ /**
84
+ * Multiple selection can be enabled by using an array for the `value` and
85
+ * `defaultValue` props. The argument of the `onChange` function will also
86
+ * change accordingly.
87
+ */
88
+ export const MultiSelect = Template.bind( {} );
89
+ MultiSelect.args = {
90
+ defaultValue: [ 'lavender', 'tangerine' ],
91
+ label: 'Select Colors',
92
+ renderSelectedValue: ( currentValue: string | string[] ) => {
93
+ if ( ! Array.isArray( currentValue ) ) {
94
+ return currentValue;
95
+ }
96
+ if ( currentValue.length === 0 ) return 'No colors selected';
97
+ if ( currentValue.length === 1 ) return currentValue[ 0 ];
98
+ return `${ currentValue.length } colors selected`;
99
+ },
100
+ children: (
101
+ <>
102
+ { [
103
+ 'amber',
104
+ 'aquamarine',
105
+ 'flamingo pink',
106
+ 'lavender',
107
+ 'maroon',
108
+ 'tangerine',
109
+ ].map( ( item ) => (
110
+ <CustomSelectItem key={ item } value={ item }>
111
+ { item }
112
+ </CustomSelectItem>
113
+ ) ) }
114
+ </>
115
+ ),
116
+ };
117
+
118
+ const renderControlledValue = ( gravatar: string | string[] ) => {
119
+ const avatar = `https://gravatar.com/avatar?d=${ gravatar }`;
120
+ return (
121
+ <div style={ { display: 'flex', alignItems: 'center' } }>
122
+ <img
123
+ style={ { maxHeight: '75px', marginRight: '10px' } }
124
+ key={ avatar }
125
+ src={ avatar }
126
+ alt=""
127
+ aria-hidden="true"
128
+ />
129
+ <span>{ gravatar }</span>
130
+ </div>
131
+ );
132
+ };
133
+
134
+ export const Controlled = ControlledTemplate.bind( {} );
135
+ Controlled.args = {
136
+ label: 'Default Gravatars',
137
+ renderSelectedValue: renderControlledValue,
138
+ children: (
139
+ <>
140
+ { [ 'mystery-person', 'identicon', 'wavatar', 'retro' ].map(
141
+ ( option ) => (
142
+ <CustomSelectItem key={ option } value={ option }>
143
+ { renderControlledValue( option ) }
144
+ </CustomSelectItem>
145
+ )
146
+ ) }
147
+ </>
148
+ ),
149
+ };
@@ -0,0 +1,76 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import styled from '@emotion/styled';
5
+ // eslint-disable-next-line no-restricted-imports
6
+ import * as Ariakit from '@ariakit/react';
7
+
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ import { COLORS } from '../utils';
12
+ import { space } from '../utils/space';
13
+ import type { CustomSelectProps } from './types';
14
+
15
+ export const CustomSelectLabel = styled( Ariakit.SelectLabel )`
16
+ font-size: 11px;
17
+ font-weight: 500;
18
+ line-height: 1.4;
19
+ text-transform: uppercase;
20
+ margin-bottom: ${ space( 2 ) };
21
+ `;
22
+
23
+ const inputHeights = {
24
+ default: 40,
25
+ small: 24,
26
+ };
27
+
28
+ export const CustomSelectButton = styled( Ariakit.Select, {
29
+ // Do not forward `hasCustomRenderProp` to the underlying Ariakit.Select component
30
+ shouldForwardProp: ( prop ) => prop !== 'hasCustomRenderProp',
31
+ } )( ( {
32
+ size,
33
+ hasCustomRenderProp,
34
+ }: {
35
+ size: NonNullable< CustomSelectProps[ 'size' ] >;
36
+ hasCustomRenderProp: boolean;
37
+ } ) => {
38
+ const isSmallSize = size === 'small' && ! hasCustomRenderProp;
39
+ const heightProperty = hasCustomRenderProp ? 'minHeight' : 'height';
40
+
41
+ return {
42
+ display: 'flex',
43
+ justifyContent: 'space-between',
44
+ alignItems: 'center',
45
+ backgroundColor: COLORS.white,
46
+ border: `1px solid ${ COLORS.gray[ 600 ] }`,
47
+ borderRadius: space( 0.5 ),
48
+ cursor: 'pointer',
49
+ width: '100%',
50
+ [ heightProperty ]: `${ inputHeights[ size ] }px`,
51
+ padding: isSmallSize ? space( 2 ) : space( 4 ),
52
+ fontSize: isSmallSize ? '11px' : '13px',
53
+ '&[data-focus-visible]': {
54
+ outlineStyle: 'solid',
55
+ },
56
+ '&[aria-expanded="true"]': {
57
+ outlineStyle: `1.5px solid ${ COLORS.theme.accent }`,
58
+ },
59
+ };
60
+ } );
61
+
62
+ export const CustomSelectPopover = styled( Ariakit.SelectPopover )`
63
+ border-radius: ${ space( 0.5 ) };
64
+ background: ${ COLORS.white };
65
+ border: 1px solid ${ COLORS.gray[ 900 ] };
66
+ `;
67
+
68
+ export const CustomSelectItem = styled( Ariakit.SelectItem )`
69
+ display: flex;
70
+ align-items: center;
71
+ justify-content: space-between;
72
+ padding: ${ space( 2 ) };
73
+ &[data-active-item] {
74
+ background-color: ${ COLORS.gray[ 300 ] };
75
+ }
76
+ `;