@wordpress/components 28.8.4 → 28.9.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.
- package/CHANGELOG.md +26 -3
- package/build/autocomplete/index.js +4 -1
- package/build/autocomplete/index.js.map +1 -1
- package/build/border-box-control/border-box-control/component.js +3 -14
- package/build/border-box-control/border-box-control/component.js.map +1 -1
- package/build/border-control/border-control/component.js +1 -2
- package/build/border-control/border-control/component.js.map +1 -1
- package/build/border-control/border-control-dropdown/component.js +2 -14
- package/build/border-control/border-control-dropdown/component.js.map +1 -1
- package/build/border-control/styles.js +13 -13
- package/build/border-control/styles.js.map +1 -1
- package/build/border-control/types.js.map +1 -1
- package/build/box-control/index.js +4 -4
- package/build/box-control/index.js.map +1 -1
- package/build/box-control/types.js.map +1 -1
- package/build/composite/group-label.js +7 -1
- package/build/composite/group-label.js.map +1 -1
- package/build/composite/group.js +7 -1
- package/build/composite/group.js.map +1 -1
- package/build/composite/hover.js +8 -2
- package/build/composite/hover.js.map +1 -1
- package/build/composite/index.js +5 -1
- package/build/composite/index.js.map +1 -1
- package/build/composite/item.js +16 -1
- package/build/composite/item.js.map +1 -1
- package/build/composite/row.js +7 -1
- package/build/composite/row.js.map +1 -1
- package/build/composite/typeahead.js +8 -2
- package/build/composite/typeahead.js.map +1 -1
- package/build/date-time/date/index.js +4 -2
- package/build/date-time/date/index.js.map +1 -1
- package/build/index.js +36 -5
- package/build/index.js.map +1 -1
- package/build/navigator/index.js +128 -32
- package/build/navigator/index.js.map +1 -1
- package/build/navigator/legacy.js +179 -0
- package/build/navigator/legacy.js.map +1 -0
- package/build/navigator/{navigator-provider → navigator}/component.js +5 -40
- package/build/navigator/navigator/component.js.map +1 -0
- package/build/navigator/navigator-back-button/component.js +2 -38
- package/build/navigator/navigator-back-button/component.js.map +1 -1
- package/build/navigator/navigator-back-button/hook.js +1 -1
- package/build/navigator/navigator-back-button/hook.js.map +1 -1
- package/build/navigator/navigator-button/component.js +2 -37
- package/build/navigator/navigator-button/component.js.map +1 -1
- package/build/navigator/navigator-button/hook.js +1 -1
- package/build/navigator/navigator-button/hook.js.map +1 -1
- package/build/navigator/navigator-screen/component.js +40 -62
- package/build/navigator/navigator-screen/component.js.map +1 -1
- package/build/navigator/navigator-screen/use-screen-animate-presence.js +114 -0
- package/build/navigator/navigator-screen/use-screen-animate-presence.js.map +1 -0
- package/build/navigator/navigator-to-parent-button/component.js +3 -7
- package/build/navigator/navigator-to-parent-button/component.js.map +1 -1
- package/build/navigator/styles.js +78 -35
- package/build/navigator/styles.js.map +1 -1
- package/build/navigator/types.js.map +1 -1
- package/build/navigator/use-navigator.js +4 -1
- package/build/navigator/use-navigator.js.map +1 -1
- package/build/search-control/index.js +5 -2
- package/build/search-control/index.js.map +1 -1
- package/build/tabs/styles.js +3 -3
- package/build/tabs/styles.js.map +1 -1
- package/build/tabs/tablist.js +61 -28
- package/build/tabs/tablist.js.map +1 -1
- package/build/tabs/use-track-overflow.js +73 -0
- package/build/tabs/use-track-overflow.js.map +1 -0
- package/build/toggle-group-control/toggle-group-control/as-button-group.js +4 -2
- package/build/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/as-radio-group.js +6 -2
- package/build/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/component.js +73 -8
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/styles.js +7 -7
- package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/component.js +10 -19
- package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js +8 -9
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build/toggle-group-control/types.js.map +1 -1
- package/build/utils/element-rect.js +22 -13
- package/build/utils/element-rect.js.map +1 -1
- package/build/utils/hooks/use-on-value-update.js +3 -7
- package/build/utils/hooks/use-on-value-update.js.map +1 -1
- package/build-module/autocomplete/index.js +4 -1
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/border-box-control/border-box-control/component.js +3 -14
- package/build-module/border-box-control/border-box-control/component.js.map +1 -1
- package/build-module/border-control/border-control/component.js +1 -2
- package/build-module/border-control/border-control/component.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/component.js +2 -14
- package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
- package/build-module/border-control/styles.js +13 -13
- package/build-module/border-control/styles.js.map +1 -1
- package/build-module/border-control/types.js.map +1 -1
- package/build-module/box-control/index.js +4 -4
- package/build-module/box-control/index.js.map +1 -1
- package/build-module/box-control/types.js.map +1 -1
- package/build-module/composite/group-label.js +7 -1
- package/build-module/composite/group-label.js.map +1 -1
- package/build-module/composite/group.js +7 -1
- package/build-module/composite/group.js.map +1 -1
- package/build-module/composite/hover.js +8 -2
- package/build-module/composite/hover.js.map +1 -1
- package/build-module/composite/index.js +5 -1
- package/build-module/composite/index.js.map +1 -1
- package/build-module/composite/item.js +16 -1
- package/build-module/composite/item.js.map +1 -1
- package/build-module/composite/row.js +7 -1
- package/build-module/composite/row.js.map +1 -1
- package/build-module/composite/typeahead.js +8 -2
- package/build-module/composite/typeahead.js.map +1 -1
- package/build-module/date-time/date/index.js +4 -2
- package/build-module/date-time/date/index.js.map +1 -1
- package/build-module/index.js +14 -4
- package/build-module/index.js.map +1 -1
- package/build-module/navigator/index.js +130 -5
- package/build-module/navigator/index.js.map +1 -1
- package/build-module/navigator/legacy.js +167 -0
- package/build-module/navigator/legacy.js.map +1 -0
- package/build-module/navigator/{navigator-provider → navigator}/component.js +4 -39
- package/build-module/navigator/navigator/component.js.map +1 -0
- package/build-module/navigator/navigator-back-button/component.js +1 -37
- package/build-module/navigator/navigator-back-button/component.js.map +1 -1
- package/build-module/navigator/navigator-back-button/hook.js +1 -1
- package/build-module/navigator/navigator-back-button/hook.js.map +1 -1
- package/build-module/navigator/navigator-button/component.js +1 -36
- package/build-module/navigator/navigator-button/component.js.map +1 -1
- package/build-module/navigator/navigator-button/hook.js +1 -1
- package/build-module/navigator/navigator-button/hook.js.map +1 -1
- package/build-module/navigator/navigator-screen/component.js +39 -61
- package/build-module/navigator/navigator-screen/component.js.map +1 -1
- package/build-module/navigator/navigator-screen/use-screen-animate-presence.js +106 -0
- package/build-module/navigator/navigator-screen/use-screen-animate-presence.js.map +1 -0
- package/build-module/navigator/navigator-to-parent-button/component.js +2 -6
- package/build-module/navigator/navigator-to-parent-button/component.js.map +1 -1
- package/build-module/navigator/styles.js +77 -33
- package/build-module/navigator/styles.js.map +1 -1
- package/build-module/navigator/types.js.map +1 -1
- package/build-module/navigator/use-navigator.js +4 -1
- package/build-module/navigator/use-navigator.js.map +1 -1
- package/build-module/search-control/index.js +5 -2
- package/build-module/search-control/index.js.map +1 -1
- package/build-module/tabs/styles.js +3 -3
- package/build-module/tabs/styles.js.map +1 -1
- package/build-module/tabs/tablist.js +62 -29
- package/build-module/tabs/tablist.js.map +1 -1
- package/build-module/tabs/use-track-overflow.js +67 -0
- package/build-module/tabs/use-track-overflow.js.map +1 -0
- package/build-module/toggle-group-control/toggle-group-control/as-button-group.js +4 -2
- package/build-module/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js +6 -2
- package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/component.js +76 -10
- package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/styles.js +7 -7
- package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/component.js +12 -22
- package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +7 -8
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build-module/toggle-group-control/types.js.map +1 -1
- package/build-module/utils/element-rect.js +22 -12
- package/build-module/utils/element-rect.js.map +1 -1
- package/build-module/utils/hooks/use-on-value-update.js +3 -6
- package/build-module/utils/hooks/use-on-value-update.js.map +1 -1
- package/build-style/style-rtl.css +26 -13
- package/build-style/style.css +26 -13
- package/build-types/autocomplete/index.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control/component.d.ts +5 -15
- package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/component.d.ts +2 -1
- package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
- package/build-types/border-box-control/stories/index.story.d.ts +3 -2
- package/build-types/border-box-control/stories/index.story.d.ts.map +1 -1
- package/build-types/border-control/border-control/component.d.ts +3 -2
- package/build-types/border-control/border-control/component.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/component.d.ts +2 -1
- package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
- package/build-types/border-control/border-control-style-picker/component.d.ts.map +1 -1
- package/build-types/border-control/stories/index.story.d.ts +15 -30
- package/build-types/border-control/stories/index.story.d.ts.map +1 -1
- package/build-types/border-control/styles.d.ts.map +1 -1
- package/build-types/border-control/types.d.ts +12 -7
- package/build-types/border-control/types.d.ts.map +1 -1
- package/build-types/box-control/index.d.ts +4 -4
- package/build-types/box-control/stories/index.story.d.ts.map +1 -1
- package/build-types/box-control/types.d.ts +3 -3
- package/build-types/composite/group-label.d.ts.map +1 -1
- package/build-types/composite/index.d.ts.map +1 -1
- package/build-types/composite/item.d.ts.map +1 -1
- package/build-types/composite/stories/index.story.d.ts +22 -0
- package/build-types/composite/stories/index.story.d.ts.map +1 -1
- package/build-types/composite/test/index.d.ts +2 -0
- package/build-types/composite/test/index.d.ts.map +1 -0
- package/build-types/date-time/date/index.d.ts.map +1 -1
- package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown-menu/stories/index.story.d.ts.map +1 -1
- package/build-types/index.d.ts +23 -4
- package/build-types/index.d.ts.map +1 -1
- package/build-types/navigator/index.d.ts +171 -5
- package/build-types/navigator/index.d.ts.map +1 -1
- package/build-types/navigator/legacy.d.ts +226 -0
- package/build-types/navigator/legacy.d.ts.map +1 -0
- package/build-types/navigator/navigator/component.d.ts +3 -0
- package/build-types/navigator/navigator/component.d.ts.map +1 -0
- package/build-types/navigator/navigator-back-button/component.d.ts +0 -35
- package/build-types/navigator/navigator-back-button/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-button/component.d.ts +0 -34
- package/build-types/navigator/navigator-button/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-screen/component.d.ts +0 -35
- package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-screen/use-screen-animate-presence.d.ts +16 -0
- package/build-types/navigator/navigator-screen/use-screen-animate-presence.d.ts.map +1 -0
- package/build-types/navigator/navigator-to-parent-button/component.d.ts +0 -4
- package/build-types/navigator/navigator-to-parent-button/component.d.ts.map +1 -1
- package/build-types/navigator/stories/index.story.d.ts +5 -5
- package/build-types/navigator/stories/index.story.d.ts.map +1 -1
- package/build-types/navigator/styles.d.ts +20 -7
- package/build-types/navigator/styles.d.ts.map +1 -1
- package/build-types/navigator/types.d.ts +19 -1
- package/build-types/navigator/types.d.ts.map +1 -1
- package/build-types/navigator/use-navigator.d.ts +4 -1
- package/build-types/navigator/use-navigator.d.ts.map +1 -1
- package/build-types/select-control/stories/index.story.d.ts +7 -0
- package/build-types/select-control/stories/index.story.d.ts.map +1 -1
- package/build-types/tabs/stories/index.story.d.ts +2 -1
- package/build-types/tabs/stories/index.story.d.ts.map +1 -1
- package/build-types/tabs/styles.d.ts.map +1 -1
- package/build-types/tabs/tablist.d.ts.map +1 -1
- package/build-types/tabs/use-track-overflow.d.ts +17 -0
- package/build-types/tabs/use-track-overflow.d.ts.map +1 -0
- package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts +2 -2
- package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts +2 -2
- package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/styles.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts +0 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
- package/build-types/toggle-group-control/types.d.ts +2 -1
- package/build-types/toggle-group-control/types.d.ts.map +1 -1
- package/build-types/utils/element-rect.d.ts +8 -0
- package/build-types/utils/element-rect.d.ts.map +1 -1
- package/build-types/utils/hooks/use-on-value-update.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/autocomplete/index.tsx +4 -1
- package/src/border-box-control/border-box-control/README.md +22 -26
- package/src/border-box-control/border-box-control/component.tsx +3 -14
- package/src/border-box-control/stories/index.story.tsx +2 -1
- package/src/border-control/border-control/README.md +26 -36
- package/src/border-control/border-control/component.tsx +1 -2
- package/src/border-control/border-control-dropdown/component.tsx +1 -15
- package/src/border-control/stories/index.story.tsx +4 -10
- package/src/border-control/styles.ts +0 -1
- package/src/border-control/test/index.js +2 -15
- package/src/border-control/types.ts +12 -7
- package/src/box-control/README.md +9 -12
- package/src/box-control/index.tsx +4 -4
- package/src/box-control/stories/index.story.tsx +1 -1
- package/src/box-control/types.ts +3 -3
- package/src/composite/group-label.tsx +7 -5
- package/src/composite/group.tsx +7 -7
- package/src/composite/hover.tsx +7 -7
- package/src/composite/index.tsx +6 -1
- package/src/composite/item.tsx +19 -1
- package/src/composite/legacy/test/index.tsx +22 -21
- package/src/composite/row.tsx +7 -7
- package/src/composite/stories/index.story.tsx +42 -0
- package/src/composite/test/index.tsx +123 -0
- package/src/composite/typeahead.tsx +7 -7
- package/src/date-time/date/index.tsx +2 -0
- package/src/dropdown/stories/index.story.tsx +1 -0
- package/src/dropdown/style.scss +10 -13
- package/src/dropdown-menu/stories/index.story.tsx +3 -0
- package/src/index.ts +19 -1
- package/src/menu-group/style.scss +4 -1
- package/src/menu-items-choice/style.scss +2 -0
- package/src/navigator/README.md +176 -0
- package/src/navigator/index.tsx +131 -0
- package/src/navigator/legacy.ts +169 -0
- package/src/navigator/{navigator-provider → navigator}/component.tsx +6 -44
- package/src/navigator/navigator-back-button/component.tsx +1 -37
- package/src/navigator/navigator-back-button/hook.ts +1 -1
- package/src/navigator/navigator-button/component.tsx +1 -36
- package/src/navigator/navigator-button/hook.ts +1 -1
- package/src/navigator/navigator-screen/component.tsx +48 -76
- package/src/navigator/navigator-screen/use-screen-animate-presence.ts +177 -0
- package/src/navigator/navigator-to-parent-button/component.tsx +2 -7
- package/src/navigator/stories/index.story.tsx +55 -54
- package/src/navigator/styles.ts +112 -41
- package/src/navigator/test/index.tsx +47 -47
- package/src/navigator/types.ts +19 -1
- package/src/navigator/use-navigator.ts +4 -1
- package/src/search-control/index.tsx +2 -2
- package/src/select-control/stories/index.story.tsx +14 -1
- package/src/tabs/stories/index.story.tsx +106 -0
- package/src/tabs/styles.ts +54 -20
- package/src/tabs/tablist.tsx +60 -26
- package/src/tabs/use-track-overflow.ts +76 -0
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +208 -44
- package/src/toggle-group-control/toggle-group-control/as-button-group.tsx +18 -10
- package/src/toggle-group-control/toggle-group-control/as-radio-group.tsx +19 -9
- package/src/toggle-group-control/toggle-group-control/component.tsx +114 -6
- package/src/toggle-group-control/toggle-group-control/styles.ts +41 -0
- package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +10 -27
- package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +0 -11
- package/src/toggle-group-control/types.ts +3 -1
- package/src/tools-panel/tools-panel/README.md +10 -10
- package/src/utils/element-rect.ts +32 -15
- package/src/utils/hooks/use-on-value-update.ts +3 -6
- package/tsconfig.tsbuildinfo +1 -1
- package/build/navigator/navigator-provider/component.js.map +0 -1
- package/build/utils/hooks/use-event.js +0 -41
- package/build/utils/hooks/use-event.js.map +0 -1
- package/build-module/navigator/navigator-provider/component.js.map +0 -1
- package/build-module/utils/hooks/use-event.js +0 -35
- package/build-module/utils/hooks/use-event.js.map +0 -1
- package/build-types/navigator/navigator-provider/component.d.ts +0 -37
- package/build-types/navigator/navigator-provider/component.d.ts.map +0 -1
- package/build-types/utils/hooks/use-event.d.ts +0 -20
- package/build-types/utils/hooks/use-event.d.ts.map +0 -1
- package/src/navigator/index.ts +0 -6
- package/src/navigator/navigator-back-button/README.md +0 -15
- package/src/navigator/navigator-button/README.md +0 -38
- package/src/navigator/navigator-provider/README.md +0 -94
- package/src/navigator/navigator-screen/README.md +0 -33
- package/src/navigator/navigator-to-parent-button/README.md +0 -17
- package/src/utils/hooks/use-event.ts +0 -38
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# BorderControl
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes.
|
|
5
|
-
</div>
|
|
6
|
-
<br />
|
|
7
|
-
This component provides control over a border's color, style, and width.
|
|
3
|
+
An input control for a border's color, style, and width.
|
|
8
4
|
|
|
9
5
|
## Development guidelines
|
|
10
6
|
|
|
@@ -21,7 +17,7 @@ a "shape" abstraction.
|
|
|
21
17
|
|
|
22
18
|
```jsx
|
|
23
19
|
import { useState } from 'react';
|
|
24
|
-
import {
|
|
20
|
+
import { BorderControl } from '@wordpress/components';
|
|
25
21
|
import { __ } from '@wordpress/i18n';
|
|
26
22
|
|
|
27
23
|
const colors = [
|
|
@@ -58,41 +54,41 @@ colors are organized by multiple origins.
|
|
|
58
54
|
|
|
59
55
|
Each color may be an object containing a `name` and `color` value.
|
|
60
56
|
|
|
61
|
-
-
|
|
62
|
-
-
|
|
57
|
+
- Required: No
|
|
58
|
+
- Default: `[]`
|
|
63
59
|
|
|
64
60
|
### `disableCustomColors`: `boolean`
|
|
65
61
|
|
|
66
62
|
This toggles the ability to choose custom colors.
|
|
67
63
|
|
|
68
|
-
-
|
|
64
|
+
- Required: No
|
|
69
65
|
|
|
70
66
|
### `disableUnits`: `boolean`
|
|
71
67
|
|
|
72
68
|
This controls whether unit selection should be disabled.
|
|
73
69
|
|
|
74
|
-
-
|
|
70
|
+
- Required: No
|
|
75
71
|
|
|
76
72
|
### `enableAlpha`: `boolean`
|
|
77
73
|
|
|
78
74
|
This controls whether the alpha channel will be offered when selecting
|
|
79
75
|
custom colors.
|
|
80
76
|
|
|
81
|
-
-
|
|
82
|
-
-
|
|
77
|
+
- Required: No
|
|
78
|
+
- Default: `true`
|
|
83
79
|
|
|
84
80
|
### `enableStyle`: `boolean`
|
|
85
81
|
|
|
86
82
|
This controls whether to support border style selection.
|
|
87
83
|
|
|
88
|
-
-
|
|
89
|
-
-
|
|
84
|
+
- Required: No
|
|
85
|
+
- Default: `true`
|
|
90
86
|
|
|
91
87
|
### `hideLabelFromVision`: `boolean`
|
|
92
88
|
|
|
93
89
|
Provides control over whether the label will only be visible to screen readers.
|
|
94
90
|
|
|
95
|
-
-
|
|
91
|
+
- Required: No
|
|
96
92
|
|
|
97
93
|
### `isCompact`: `boolean`
|
|
98
94
|
|
|
@@ -100,7 +96,7 @@ This flags the `BorderControl` to render with a more compact appearance. It
|
|
|
100
96
|
restricts the width of the control and prevents it from expanding to take up
|
|
101
97
|
additional space.
|
|
102
98
|
|
|
103
|
-
-
|
|
99
|
+
- Required: No
|
|
104
100
|
|
|
105
101
|
### `label`: `string`
|
|
106
102
|
|
|
@@ -109,7 +105,7 @@ If provided, a label will be generated using this as the content.
|
|
|
109
105
|
_Whether it is visible only to screen readers is controlled via
|
|
110
106
|
`hideLabelFromVision`._
|
|
111
107
|
|
|
112
|
-
-
|
|
108
|
+
- Required: No
|
|
113
109
|
|
|
114
110
|
### `onChange`: `( value?: Object ) => void`
|
|
115
111
|
|
|
@@ -118,7 +114,7 @@ that selects or clears, border color, style, or width.
|
|
|
118
114
|
|
|
119
115
|
_Note: the value may be `undefined` if a user clears all border properties._
|
|
120
116
|
|
|
121
|
-
-
|
|
117
|
+
- Required: Yes
|
|
122
118
|
|
|
123
119
|
### `shouldSanitizeBorder`: `boolean`
|
|
124
120
|
|
|
@@ -126,23 +122,16 @@ If opted into, sanitizing the border means that if no width or color have been
|
|
|
126
122
|
selected, the border style is also cleared and `undefined` is returned as the
|
|
127
123
|
new border value.
|
|
128
124
|
|
|
129
|
-
-
|
|
130
|
-
-
|
|
131
|
-
|
|
132
|
-
### `showDropdownHeader`: `boolean`
|
|
133
|
-
|
|
134
|
-
Whether or not to render a header for the border color and style picker
|
|
135
|
-
dropdown. The header includes a label for the color picker and a close button.
|
|
136
|
-
|
|
137
|
-
- Required: No
|
|
125
|
+
- Required: No
|
|
126
|
+
- Default: `true`
|
|
138
127
|
|
|
139
128
|
### `size`: `string`
|
|
140
129
|
|
|
141
130
|
Size of the control.
|
|
142
131
|
|
|
143
|
-
-
|
|
144
|
-
-
|
|
145
|
-
-
|
|
132
|
+
- Required: No
|
|
133
|
+
- Default: `default`
|
|
134
|
+
- Allowed values: `default`, `__unstable-large`
|
|
146
135
|
|
|
147
136
|
### `value`: `Object`
|
|
148
137
|
|
|
@@ -150,6 +139,7 @@ An object representing a border or `undefined`. Used to set the current border
|
|
|
150
139
|
configuration for this component.
|
|
151
140
|
|
|
152
141
|
Example:
|
|
142
|
+
|
|
153
143
|
```js
|
|
154
144
|
{
|
|
155
145
|
color: '#72aee6',
|
|
@@ -158,25 +148,25 @@ Example:
|
|
|
158
148
|
}
|
|
159
149
|
```
|
|
160
150
|
|
|
161
|
-
-
|
|
151
|
+
- Required: No
|
|
162
152
|
|
|
163
153
|
### `width`: `CSSProperties[ 'width' ]`
|
|
164
154
|
|
|
165
155
|
Controls the visual width of the `BorderControl`. It has no effect if the
|
|
166
156
|
`isCompact` prop is set to `true`.
|
|
167
157
|
|
|
168
|
-
-
|
|
158
|
+
- Required: No
|
|
169
159
|
|
|
170
160
|
### `withSlider`: `boolean`
|
|
171
161
|
|
|
172
162
|
Flags whether this `BorderControl` should also render a `RangeControl` for
|
|
173
163
|
additional control over a border's width.
|
|
174
164
|
|
|
175
|
-
-
|
|
165
|
+
- Required: No
|
|
176
166
|
|
|
177
167
|
### `__next40pxDefaultSize`: `boolean`
|
|
178
168
|
|
|
179
169
|
Start opting into the larger default height that will become the default size in a future version.
|
|
180
170
|
|
|
181
|
-
-
|
|
182
|
-
-
|
|
171
|
+
- Required: No
|
|
172
|
+
- Default: `false`
|
|
@@ -91,7 +91,6 @@ const UnconnectedBorderControl = (
|
|
|
91
91
|
previousStyleSelection={
|
|
92
92
|
previousStyleSelection
|
|
93
93
|
}
|
|
94
|
-
showDropdownHeader={ showDropdownHeader }
|
|
95
94
|
__experimentalIsRenderedInSidebar={
|
|
96
95
|
__experimentalIsRenderedInSidebar
|
|
97
96
|
}
|
|
@@ -141,7 +140,7 @@ const UnconnectedBorderControl = (
|
|
|
141
140
|
* a "shape" abstraction.
|
|
142
141
|
*
|
|
143
142
|
* ```jsx
|
|
144
|
-
* import {
|
|
143
|
+
* import { BorderControl } from '@wordpress/components';
|
|
145
144
|
* import { __ } from '@wordpress/i18n';
|
|
146
145
|
*
|
|
147
146
|
* const colors = [
|
|
@@ -7,7 +7,6 @@ import type { CSSProperties } from 'react';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { __, sprintf } from '@wordpress/i18n';
|
|
10
|
-
import { closeSmall } from '@wordpress/icons';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* Internal dependencies
|
|
@@ -17,12 +16,10 @@ import Button from '../../button';
|
|
|
17
16
|
import ColorIndicator from '../../color-indicator';
|
|
18
17
|
import ColorPalette from '../../color-palette';
|
|
19
18
|
import Dropdown from '../../dropdown';
|
|
20
|
-
import { HStack } from '../../h-stack';
|
|
21
19
|
import { VStack } from '../../v-stack';
|
|
22
20
|
import type { WordPressComponentProps } from '../../context';
|
|
23
21
|
import { contextConnect } from '../../context';
|
|
24
22
|
import { useBorderControlDropdown } from './hook';
|
|
25
|
-
import { StyledLabel } from '../../base-control/styles/base-control-styles';
|
|
26
23
|
import DropdownContentWrapper from '../../dropdown/dropdown-content-wrapper';
|
|
27
24
|
|
|
28
25
|
import type { ColorObject } from '../../color-palette/types';
|
|
@@ -149,7 +146,6 @@ const BorderControlDropdown = (
|
|
|
149
146
|
popoverContentClassName,
|
|
150
147
|
popoverControlsClassName,
|
|
151
148
|
resetButtonClassName,
|
|
152
|
-
showDropdownHeader,
|
|
153
149
|
size,
|
|
154
150
|
__unstablePopoverProps,
|
|
155
151
|
...otherProps
|
|
@@ -197,17 +193,6 @@ const BorderControlDropdown = (
|
|
|
197
193
|
<>
|
|
198
194
|
<DropdownContentWrapper paddingSize="medium">
|
|
199
195
|
<VStack className={ popoverControlsClassName } spacing={ 6 }>
|
|
200
|
-
{ showDropdownHeader ? (
|
|
201
|
-
<HStack>
|
|
202
|
-
<StyledLabel>{ __( 'Border color' ) }</StyledLabel>
|
|
203
|
-
<Button
|
|
204
|
-
size="small"
|
|
205
|
-
label={ __( 'Close border color' ) }
|
|
206
|
-
icon={ closeSmall }
|
|
207
|
-
onClick={ onClose }
|
|
208
|
-
/>
|
|
209
|
-
</HStack>
|
|
210
|
-
) : undefined }
|
|
211
196
|
<ColorPalette
|
|
212
197
|
className={ popoverContentClassName }
|
|
213
198
|
value={ color }
|
|
@@ -237,6 +222,7 @@ const BorderControlDropdown = (
|
|
|
237
222
|
onReset();
|
|
238
223
|
onClose();
|
|
239
224
|
} }
|
|
225
|
+
__next40pxDefaultSize
|
|
240
226
|
>
|
|
241
227
|
{ __( 'Reset' ) }
|
|
242
228
|
</Button>
|
|
@@ -16,7 +16,7 @@ import { BorderControl } from '..';
|
|
|
16
16
|
import type { Border } from '../types';
|
|
17
17
|
|
|
18
18
|
const meta: Meta< typeof BorderControl > = {
|
|
19
|
-
title: 'Components
|
|
19
|
+
title: 'Components/BorderControl',
|
|
20
20
|
component: BorderControl,
|
|
21
21
|
argTypes: {
|
|
22
22
|
onChange: {
|
|
@@ -93,6 +93,9 @@ export const Default = Template.bind( {} );
|
|
|
93
93
|
Default.args = {
|
|
94
94
|
colors,
|
|
95
95
|
label: 'Border',
|
|
96
|
+
enableAlpha: true,
|
|
97
|
+
enableStyle: true,
|
|
98
|
+
shouldSanitizeBorder: true,
|
|
96
99
|
};
|
|
97
100
|
|
|
98
101
|
/**
|
|
@@ -133,12 +136,3 @@ WithMultipleOrigins.args = {
|
|
|
133
136
|
...Default.args,
|
|
134
137
|
colors: multipleOriginColors,
|
|
135
138
|
};
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Allow the alpha channel to be edited on each color.
|
|
139
|
-
*/
|
|
140
|
-
export const WithAlphaEnabled = Template.bind( {} );
|
|
141
|
-
WithAlphaEnabled.args = {
|
|
142
|
-
...Default.args,
|
|
143
|
-
enableAlpha: true,
|
|
144
|
-
};
|
|
@@ -148,19 +148,6 @@ describe( 'BorderControl', () => {
|
|
|
148
148
|
expect( resetButton ).toBeInTheDocument();
|
|
149
149
|
} );
|
|
150
150
|
|
|
151
|
-
it( 'should render color and style popover header', async () => {
|
|
152
|
-
const user = userEvent.setup();
|
|
153
|
-
const props = createProps( { showDropdownHeader: true } );
|
|
154
|
-
render( <BorderControl { ...props } /> );
|
|
155
|
-
await openPopover( user );
|
|
156
|
-
|
|
157
|
-
const headerLabel = screen.getByText( 'Border color' );
|
|
158
|
-
const closeButton = getButton( 'Close border color' );
|
|
159
|
-
|
|
160
|
-
expect( headerLabel ).toBeInTheDocument();
|
|
161
|
-
expect( closeButton ).toBeInTheDocument();
|
|
162
|
-
} );
|
|
163
|
-
|
|
164
151
|
it( 'should not render style options when opted out of', async () => {
|
|
165
152
|
const user = userEvent.setup();
|
|
166
153
|
const props = createProps( { enableStyle: false } );
|
|
@@ -346,10 +333,10 @@ describe( 'BorderControl', () => {
|
|
|
346
333
|
|
|
347
334
|
it( 'should take no action when color and style popover is closed', async () => {
|
|
348
335
|
const user = userEvent.setup();
|
|
349
|
-
const props = createProps(
|
|
336
|
+
const props = createProps();
|
|
350
337
|
render( <BorderControl { ...props } /> );
|
|
351
338
|
await openPopover( user );
|
|
352
|
-
await user.
|
|
339
|
+
await user.keyboard( 'Escape' );
|
|
353
340
|
|
|
354
341
|
expect( props.onChange ).not.toHaveBeenCalled();
|
|
355
342
|
} );
|
|
@@ -18,12 +18,19 @@ export type Border = {
|
|
|
18
18
|
|
|
19
19
|
export type ColorProps = Pick<
|
|
20
20
|
ColorPaletteProps,
|
|
21
|
-
'colors' | '
|
|
21
|
+
'colors' | '__experimentalIsRenderedInSidebar'
|
|
22
22
|
> & {
|
|
23
23
|
/**
|
|
24
24
|
* This toggles the ability to choose custom colors.
|
|
25
25
|
*/
|
|
26
26
|
disableCustomColors?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* This controls whether the alpha channel will be offered when selecting
|
|
29
|
+
* custom colors.
|
|
30
|
+
*
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
33
|
+
enableAlpha?: boolean;
|
|
27
34
|
};
|
|
28
35
|
|
|
29
36
|
export type LabelProps = {
|
|
@@ -78,9 +85,8 @@ export type BorderControlProps = ColorProps &
|
|
|
78
85
|
*/
|
|
79
86
|
shouldSanitizeBorder?: boolean;
|
|
80
87
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* and a close button.
|
|
88
|
+
* @deprecated This prop no longer has any effect.
|
|
89
|
+
* @ignore
|
|
84
90
|
*/
|
|
85
91
|
showDropdownHeader?: boolean;
|
|
86
92
|
/**
|
|
@@ -139,9 +145,8 @@ export type DropdownProps = ColorProps &
|
|
|
139
145
|
*/
|
|
140
146
|
previousStyleSelection?: string;
|
|
141
147
|
/**
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* close button.
|
|
148
|
+
* @deprecated This prop no longer has any effect.
|
|
149
|
+
* @ignore
|
|
145
150
|
*/
|
|
146
151
|
showDropdownHeader?: boolean;
|
|
147
152
|
};
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
# BoxControl
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes.
|
|
5
|
-
</div>
|
|
6
|
-
|
|
7
|
-
BoxControl components let users set values for Top, Right, Bottom, and Left. This can be used as an input control for values like `padding` or `margin`.
|
|
3
|
+
A control that lets users set values for top, right, bottom, and left. Can be used as an input control for values like `padding` or `margin`.
|
|
8
4
|
|
|
9
5
|
## Usage
|
|
10
6
|
|
|
11
7
|
```jsx
|
|
12
8
|
import { useState } from 'react';
|
|
13
|
-
import {
|
|
9
|
+
import { BoxControl } from '@wordpress/components';
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
function Example() {
|
|
16
12
|
const [ values, setValues ] = useState( {
|
|
17
13
|
top: '50px',
|
|
18
14
|
left: '10%',
|
|
@@ -26,23 +22,24 @@ const Example = () => {
|
|
|
26
22
|
onChange={ ( nextValues ) => setValues( nextValues ) }
|
|
27
23
|
/>
|
|
28
24
|
);
|
|
29
|
-
}
|
|
25
|
+
}
|
|
30
26
|
```
|
|
31
27
|
|
|
32
28
|
## Props
|
|
29
|
+
|
|
33
30
|
### `allowReset`: `boolean`
|
|
34
31
|
|
|
35
32
|
If this property is true, a button to reset the box control is rendered.
|
|
36
33
|
|
|
37
|
-
-
|
|
38
|
-
-
|
|
34
|
+
- Required: No
|
|
35
|
+
- Default: `true`
|
|
39
36
|
|
|
40
37
|
### `splitOnAxis`: `boolean`
|
|
41
38
|
|
|
42
39
|
If this property is true, when the box control is unlinked, vertical and horizontal controls can be used instead of updating individual sides.
|
|
43
40
|
|
|
44
|
-
-
|
|
45
|
-
-
|
|
41
|
+
- Required: No
|
|
42
|
+
- Default: `false`
|
|
46
43
|
|
|
47
44
|
### `inputProps`: `object`
|
|
48
45
|
|
|
@@ -47,14 +47,14 @@ function useUniqueId( idProp?: string ) {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
50
|
+
* A control that lets users set values for top, right, bottom, and left. Can be
|
|
51
|
+
* used as an input control for values like `padding` or `margin`.
|
|
52
52
|
*
|
|
53
53
|
* ```jsx
|
|
54
|
-
* import {
|
|
54
|
+
* import { BoxControl } from '@wordpress/components';
|
|
55
55
|
* import { useState } from '@wordpress/element';
|
|
56
56
|
*
|
|
57
|
-
*
|
|
57
|
+
* function Example() {
|
|
58
58
|
* const [ values, setValues ] = useState( {
|
|
59
59
|
* top: '50px',
|
|
60
60
|
* left: '10%',
|
|
@@ -14,7 +14,7 @@ import { useState } from '@wordpress/element';
|
|
|
14
14
|
import BoxControl from '../';
|
|
15
15
|
|
|
16
16
|
const meta: Meta< typeof BoxControl > = {
|
|
17
|
-
title: 'Components
|
|
17
|
+
title: 'Components/BoxControl',
|
|
18
18
|
component: BoxControl,
|
|
19
19
|
argTypes: {
|
|
20
20
|
values: { control: { type: null } },
|
package/src/box-control/types.ts
CHANGED
|
@@ -37,13 +37,13 @@ export type BoxControlProps = Pick<
|
|
|
37
37
|
/**
|
|
38
38
|
* Props for the internal `UnitControl` components.
|
|
39
39
|
*
|
|
40
|
-
* @default
|
|
40
|
+
* @default { min: 0 }
|
|
41
41
|
*/
|
|
42
42
|
inputProps?: UnitControlPassthroughProps;
|
|
43
43
|
/**
|
|
44
44
|
* Heading label for the control.
|
|
45
45
|
*
|
|
46
|
-
* @default
|
|
46
|
+
* @default __( 'Box Control' )
|
|
47
47
|
*/
|
|
48
48
|
label?: string;
|
|
49
49
|
/**
|
|
@@ -53,7 +53,7 @@ export type BoxControlProps = Pick<
|
|
|
53
53
|
/**
|
|
54
54
|
* The `top`, `right`, `bottom`, and `left` box dimension values to use when the control is reset.
|
|
55
55
|
*
|
|
56
|
-
* @default
|
|
56
|
+
* @default { top: undefined, right: undefined, bottom: undefined, left: undefined }
|
|
57
57
|
*/
|
|
58
58
|
resetValues?: BoxControlValue;
|
|
59
59
|
/**
|
|
@@ -20,11 +20,13 @@ export const CompositeGroupLabel = forwardRef<
|
|
|
20
20
|
WordPressComponentProps< CompositeGroupLabelProps, 'div', false >
|
|
21
21
|
>( function CompositeGroupLabel( props, ref ) {
|
|
22
22
|
const context = useCompositeContext();
|
|
23
|
+
|
|
24
|
+
// @ts-expect-error The store prop is undocumented and only used by the
|
|
25
|
+
// legacy compat layer. The `store` prop is documented, but its type is
|
|
26
|
+
// obfuscated to discourage its use outside of the component's internals.
|
|
27
|
+
const store = ( props.store ?? context.store ) as Ariakit.CompositeStore;
|
|
28
|
+
|
|
23
29
|
return (
|
|
24
|
-
<Ariakit.CompositeGroupLabel
|
|
25
|
-
store={ context.store as Ariakit.CompositeStore }
|
|
26
|
-
{ ...props }
|
|
27
|
-
ref={ ref }
|
|
28
|
-
/>
|
|
30
|
+
<Ariakit.CompositeGroupLabel store={ store } { ...props } ref={ ref } />
|
|
29
31
|
);
|
|
30
32
|
} );
|
package/src/composite/group.tsx
CHANGED
|
@@ -20,11 +20,11 @@ export const CompositeGroup = forwardRef<
|
|
|
20
20
|
WordPressComponentProps< CompositeGroupProps, 'div', false >
|
|
21
21
|
>( function CompositeGroup( props, ref ) {
|
|
22
22
|
const context = useCompositeContext();
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
|
|
24
|
+
// @ts-expect-error The store prop is undocumented and only used by the
|
|
25
|
+
// legacy compat layer. The `store` prop is documented, but its type is
|
|
26
|
+
// obfuscated to discourage its use outside of the component's internals.
|
|
27
|
+
const store = ( props.store ?? context.store ) as Ariakit.CompositeStore;
|
|
28
|
+
|
|
29
|
+
return <Ariakit.CompositeGroup store={ store } { ...props } ref={ ref } />;
|
|
30
30
|
} );
|
package/src/composite/hover.tsx
CHANGED
|
@@ -20,11 +20,11 @@ export const CompositeHover = forwardRef<
|
|
|
20
20
|
WordPressComponentProps< CompositeHoverProps, 'div', false >
|
|
21
21
|
>( function CompositeHover( props, ref ) {
|
|
22
22
|
const context = useCompositeContext();
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
|
|
24
|
+
// @ts-expect-error The store prop is undocumented and only used by the
|
|
25
|
+
// legacy compat layer. The `store` prop is documented, but its type is
|
|
26
|
+
// obfuscated to discourage its use outside of the component's internals.
|
|
27
|
+
const store = ( props.store ?? context.store ) as Ariakit.CompositeStore;
|
|
28
|
+
|
|
29
|
+
return <Ariakit.CompositeGroup store={ store } { ...props } ref={ ref } />;
|
|
30
30
|
} );
|
package/src/composite/index.tsx
CHANGED
|
@@ -73,7 +73,10 @@ export const Composite = Object.assign(
|
|
|
73
73
|
},
|
|
74
74
|
ref
|
|
75
75
|
) {
|
|
76
|
-
|
|
76
|
+
// @ts-expect-error The store prop is undocumented and only used by the
|
|
77
|
+
// legacy compat layer.
|
|
78
|
+
const storeProp = props.store as Ariakit.CompositeStore;
|
|
79
|
+
const internalStore = Ariakit.useCompositeStore( {
|
|
77
80
|
activeId,
|
|
78
81
|
defaultActiveId,
|
|
79
82
|
setActiveId,
|
|
@@ -85,6 +88,8 @@ export const Composite = Object.assign(
|
|
|
85
88
|
rtl,
|
|
86
89
|
} );
|
|
87
90
|
|
|
91
|
+
const store = storeProp ?? internalStore;
|
|
92
|
+
|
|
88
93
|
const contextValue = useMemo(
|
|
89
94
|
() => ( {
|
|
90
95
|
store,
|
package/src/composite/item.tsx
CHANGED
|
@@ -20,9 +20,27 @@ export const CompositeItem = forwardRef<
|
|
|
20
20
|
WordPressComponentProps< CompositeItemProps, 'button', false >
|
|
21
21
|
>( function CompositeItem( props, ref ) {
|
|
22
22
|
const context = useCompositeContext();
|
|
23
|
+
|
|
24
|
+
// @ts-expect-error The store prop is undocumented and only used by the
|
|
25
|
+
// legacy compat layer. The `store` prop is documented, but its type is
|
|
26
|
+
// obfuscated to discourage its use outside of the component's internals.
|
|
27
|
+
const store = ( props.store ?? context.store ) as Ariakit.CompositeStore;
|
|
28
|
+
|
|
29
|
+
// If the active item is not connected, Composite may end up in a state
|
|
30
|
+
// where none of the items are tabbable. In this case, we force all items to
|
|
31
|
+
// be tabbable, so that as soon as an item received focus, it becomes active
|
|
32
|
+
// and Composite goes back to working as expected.
|
|
33
|
+
const tabbable = Ariakit.useStoreState( store, ( state ) => {
|
|
34
|
+
return (
|
|
35
|
+
state?.activeId !== null &&
|
|
36
|
+
! store?.item( state?.activeId )?.element?.isConnected
|
|
37
|
+
);
|
|
38
|
+
} );
|
|
39
|
+
|
|
23
40
|
return (
|
|
24
41
|
<Ariakit.CompositeItem
|
|
25
|
-
store={
|
|
42
|
+
store={ store }
|
|
43
|
+
tabbable={ tabbable }
|
|
26
44
|
{ ...props }
|
|
27
45
|
ref={ ref }
|
|
28
46
|
/>
|