@wordpress/components 25.13.0 → 25.14.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 +38 -1
- package/build/border-control/border-control-dropdown/component.js +4 -2
- package/build/border-control/border-control-dropdown/component.js.map +1 -1
- package/build/border-control/border-control-dropdown/hook.js +3 -2
- package/build/border-control/border-control-dropdown/hook.js.map +1 -1
- package/build/border-control/styles.js +17 -17
- package/build/border-control/styles.js.map +1 -1
- package/build/checkbox-control/index.js +1 -1
- package/build/checkbox-control/index.js.map +1 -1
- package/build/checkbox-control/types.js.map +1 -1
- package/build/date-time/time/timezone.js +11 -2
- package/build/date-time/time/timezone.js.map +1 -1
- package/build/dimension-control/index.js +2 -0
- package/build/dimension-control/index.js.map +1 -1
- package/build/dimension-control/types.js.map +1 -1
- package/build/dropdown-menu-v2-ariakit/styles.js +14 -14
- package/build/dropdown-menu-v2-ariakit/styles.js.map +1 -1
- package/build/focal-point-picker/controls.js +5 -1
- package/build/focal-point-picker/controls.js.map +1 -1
- package/build/focal-point-picker/index.js +2 -0
- package/build/focal-point-picker/index.js.map +1 -1
- package/build/focal-point-picker/styles/focal-point-picker-style.js +15 -15
- package/build/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
- package/build/focal-point-picker/types.js.map +1 -1
- package/build/font-size-picker/font-size-picker-select.js +2 -0
- package/build/font-size-picker/font-size-picker-select.js.map +1 -1
- package/build/font-size-picker/font-size-picker-toggle-group.js +2 -0
- package/build/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
- package/build/font-size-picker/index.js +6 -1
- package/build/font-size-picker/index.js.map +1 -1
- package/build/font-size-picker/types.js.map +1 -1
- package/build/index.native.js +0 -16
- package/build/index.native.js.map +1 -1
- package/build/mobile/global-styles-context/utils.native.js +13 -0
- package/build/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build/palette-edit/index.js +21 -1
- package/build/palette-edit/index.js.map +1 -1
- package/build/query-controls/author-select.js +3 -1
- package/build/query-controls/author-select.js.map +1 -1
- package/build/query-controls/category-select.js +3 -1
- package/build/query-controls/category-select.js.map +1 -1
- package/build/query-controls/index.js +6 -1
- package/build/query-controls/index.js.map +1 -1
- package/build/query-controls/types.js.map +1 -1
- package/build/tabs/index.js +18 -1
- package/build/tabs/index.js.map +1 -1
- package/build/tabs/tab.js +2 -2
- package/build/tabs/tab.js.map +1 -1
- package/build/tabs/tabpanel.js +3 -2
- package/build/tabs/tabpanel.js.map +1 -1
- package/build/tabs/types.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/utils.js +17 -17
- package/build/toggle-group-control/toggle-group-control/utils.js.map +1 -1
- package/build/tools-panel/tools-panel-item/hook.js +11 -11
- package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/component.js +4 -2
- package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/hook.js +3 -2
- package/build-module/border-control/border-control-dropdown/hook.js.map +1 -1
- package/build-module/border-control/styles.js +17 -17
- package/build-module/border-control/styles.js.map +1 -1
- package/build-module/checkbox-control/index.js +1 -1
- package/build-module/checkbox-control/index.js.map +1 -1
- package/build-module/checkbox-control/types.js.map +1 -1
- package/build-module/date-time/time/timezone.js +11 -2
- package/build-module/date-time/time/timezone.js.map +1 -1
- package/build-module/dimension-control/index.js +2 -0
- package/build-module/dimension-control/index.js.map +1 -1
- package/build-module/dimension-control/types.js.map +1 -1
- package/build-module/dropdown-menu-v2-ariakit/styles.js +14 -14
- package/build-module/dropdown-menu-v2-ariakit/styles.js.map +1 -1
- package/build-module/focal-point-picker/controls.js +5 -1
- package/build-module/focal-point-picker/controls.js.map +1 -1
- package/build-module/focal-point-picker/index.js +2 -0
- package/build-module/focal-point-picker/index.js.map +1 -1
- package/build-module/focal-point-picker/styles/focal-point-picker-style.js +15 -15
- package/build-module/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
- package/build-module/focal-point-picker/types.js.map +1 -1
- package/build-module/font-size-picker/font-size-picker-select.js +2 -0
- package/build-module/font-size-picker/font-size-picker-select.js.map +1 -1
- package/build-module/font-size-picker/font-size-picker-toggle-group.js +2 -0
- package/build-module/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
- package/build-module/font-size-picker/index.js +6 -1
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/font-size-picker/types.js.map +1 -1
- package/build-module/index.native.js +0 -2
- package/build-module/index.native.js.map +1 -1
- package/build-module/mobile/global-styles-context/utils.native.js +13 -0
- package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build-module/palette-edit/index.js +20 -3
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/query-controls/author-select.js +3 -1
- package/build-module/query-controls/author-select.js.map +1 -1
- package/build-module/query-controls/category-select.js +3 -1
- package/build-module/query-controls/category-select.js.map +1 -1
- package/build-module/query-controls/index.js +6 -1
- package/build-module/query-controls/index.js.map +1 -1
- package/build-module/query-controls/types.js.map +1 -1
- package/build-module/tabs/index.js +18 -1
- package/build-module/tabs/index.js.map +1 -1
- package/build-module/tabs/tab.js +2 -2
- package/build-module/tabs/tab.js.map +1 -1
- package/build-module/tabs/tabpanel.js +3 -2
- package/build-module/tabs/tabpanel.js.map +1 -1
- package/build-module/tabs/types.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/utils.js +17 -17
- package/build-module/toggle-group-control/toggle-group-control/utils.js.map +1 -1
- package/build-module/tools-panel/tools-panel-item/hook.js +11 -11
- package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
- package/build-style/style-rtl.css +1 -1
- package/build-style/style.css +1 -1
- package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/hook.d.ts +1 -0
- package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
- package/build-types/border-control/styles.d.ts +1 -1
- package/build-types/border-control/styles.d.ts.map +1 -1
- package/build-types/checkbox-control/index.d.ts.map +1 -1
- package/build-types/checkbox-control/types.d.ts +3 -2
- package/build-types/checkbox-control/types.d.ts.map +1 -1
- package/build-types/date-time/time/timezone.d.ts.map +1 -1
- package/build-types/dimension-control/index.d.ts.map +1 -1
- package/build-types/dimension-control/types.d.ts +6 -0
- package/build-types/dimension-control/types.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2-ariakit/styles.d.ts.map +1 -1
- package/build-types/focal-point-picker/controls.d.ts +1 -1
- package/build-types/focal-point-picker/controls.d.ts.map +1 -1
- package/build-types/focal-point-picker/index.d.ts +1 -1
- package/build-types/focal-point-picker/index.d.ts.map +1 -1
- package/build-types/focal-point-picker/stories/index.story.d.ts +8 -4
- package/build-types/focal-point-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/focal-point-picker/types.d.ts +7 -0
- package/build-types/focal-point-picker/types.d.ts.map +1 -1
- package/build-types/font-size-picker/font-size-picker-select.d.ts.map +1 -1
- package/build-types/font-size-picker/font-size-picker-toggle-group.d.ts.map +1 -1
- package/build-types/font-size-picker/index.d.ts.map +1 -1
- package/build-types/font-size-picker/types.d.ts +8 -1
- package/build-types/font-size-picker/types.d.ts.map +1 -1
- package/build-types/palette-edit/index.d.ts +6 -1
- package/build-types/palette-edit/index.d.ts.map +1 -1
- package/build-types/query-controls/author-select.d.ts +1 -1
- package/build-types/query-controls/author-select.d.ts.map +1 -1
- package/build-types/query-controls/category-select.d.ts +1 -1
- package/build-types/query-controls/category-select.d.ts.map +1 -1
- package/build-types/query-controls/index.d.ts +1 -1
- package/build-types/query-controls/index.d.ts.map +1 -1
- package/build-types/query-controls/types.d.ts +9 -0
- package/build-types/query-controls/types.d.ts.map +1 -1
- package/build-types/tabs/index.d.ts +2 -2
- package/build-types/tabs/index.d.ts.map +1 -1
- package/build-types/tabs/tab.d.ts +2 -1
- package/build-types/tabs/tab.d.ts.map +1 -1
- package/build-types/tabs/tabpanel.d.ts +2 -1
- package/build-types/tabs/tabpanel.d.ts.map +1 -1
- package/build-types/tabs/types.d.ts +8 -3
- package/build-types/tabs/types.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/utils.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/border-control/border-control-dropdown/component.tsx +3 -1
- package/src/border-control/border-control-dropdown/hook.ts +3 -2
- package/src/border-control/styles.ts +2 -9
- package/src/checkbox-control/README.md +2 -1
- package/src/checkbox-control/index.tsx +8 -6
- package/src/checkbox-control/test/__snapshots__/index.tsx.snap +3 -8
- package/src/checkbox-control/test/index.tsx +7 -0
- package/src/checkbox-control/types.ts +3 -2
- package/src/custom-select-control/test/index.js +367 -35
- package/src/date-time/time/timezone.tsx +15 -3
- package/src/dimension-control/index.tsx +2 -0
- package/src/dimension-control/test/__snapshots__/index.test.js.snap +2 -2
- package/src/dimension-control/types.ts +6 -0
- package/src/dropdown-menu-v2-ariakit/styles.ts +12 -0
- package/src/focal-point-picker/controls.tsx +4 -0
- package/src/focal-point-picker/index.tsx +2 -0
- package/src/focal-point-picker/styles/focal-point-picker-style.ts +1 -1
- package/src/focal-point-picker/types.ts +7 -0
- package/src/font-size-picker/font-size-picker-select.tsx +2 -0
- package/src/font-size-picker/font-size-picker-toggle-group.tsx +9 -1
- package/src/font-size-picker/index.tsx +11 -3
- package/src/font-size-picker/types.ts +8 -1
- package/src/form-toggle/style.scss +4 -2
- package/src/index.native.js +0 -2
- package/src/mobile/global-styles-context/test/utils.native.js +22 -0
- package/src/mobile/global-styles-context/utils.native.js +14 -0
- package/src/mobile/link-settings/style.native.scss +0 -17
- package/src/palette-edit/index.tsx +22 -8
- package/src/palette-edit/style.scss +2 -2
- package/src/palette-edit/test/index.tsx +75 -1
- package/src/query-controls/author-select.tsx +2 -0
- package/src/query-controls/category-select.tsx +2 -0
- package/src/query-controls/index.tsx +6 -1
- package/src/query-controls/types.ts +9 -0
- package/src/search-control/README.md +2 -0
- package/src/spinner/README.md +2 -0
- package/src/tabs/README.md +4 -4
- package/src/tabs/index.tsx +22 -1
- package/src/tabs/stories/index.story.tsx +48 -48
- package/src/tabs/tab.tsx +3 -3
- package/src/tabs/tabpanel.tsx +7 -3
- package/src/tabs/test/index.tsx +180 -106
- package/src/tabs/types.ts +8 -3
- package/src/toggle-group-control/test/index.tsx +54 -1
- package/src/toggle-group-control/toggle-group-control/utils.ts +15 -20
- package/src/tools-panel/tools-panel-item/hook.ts +10 -21
- package/tsconfig.tsbuildinfo +1 -1
- package/build/mobile/inserter-button/index.native.js +0 -98
- package/build/mobile/inserter-button/index.native.js.map +0 -1
- package/build/mobile/inserter-button/sparkles.js +0 -23
- package/build/mobile/inserter-button/sparkles.js.map +0 -1
- package/build/mobile/link-settings/image-link-destinations-screen.native.js +0 -119
- package/build/mobile/link-settings/image-link-destinations-screen.native.js.map +0 -1
- package/build-module/mobile/inserter-button/index.native.js +0 -89
- package/build-module/mobile/inserter-button/index.native.js.map +0 -1
- package/build-module/mobile/inserter-button/sparkles.js +0 -15
- package/build-module/mobile/inserter-button/sparkles.js.map +0 -1
- package/build-module/mobile/link-settings/image-link-destinations-screen.native.js +0 -110
- package/build-module/mobile/link-settings/image-link-destinations-screen.native.js.map +0 -1
- package/build-types/mobile/inserter-button/sparkles.d.ts +0 -3
- package/build-types/mobile/inserter-button/sparkles.d.ts.map +0 -1
- package/src/mobile/inserter-button/README.md +0 -62
- package/src/mobile/inserter-button/index.native.js +0 -116
- package/src/mobile/inserter-button/sparkles.js +0 -15
- package/src/mobile/inserter-button/style.native.scss +0 -72
- package/src/mobile/link-settings/image-link-destinations-screen.native.js +0 -152
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { View, TouchableHighlight, Text } from 'react-native';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { Component } from '@wordpress/element';
|
|
10
|
-
import { Icon } from '@wordpress/components';
|
|
11
|
-
import { withPreferredColorScheme } from '@wordpress/compose';
|
|
12
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
13
|
-
import { BlockIcon } from '@wordpress/block-editor';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Internal dependencies
|
|
17
|
-
*/
|
|
18
|
-
import styles from './style.scss';
|
|
19
|
-
import sparkles from './sparkles';
|
|
20
|
-
class MenuItem extends Component {
|
|
21
|
-
constructor() {
|
|
22
|
-
super( ...arguments );
|
|
23
|
-
|
|
24
|
-
this.onPress = this.onPress.bind( this );
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
onPress() {
|
|
28
|
-
const { onSelect, item } = this.props;
|
|
29
|
-
onSelect( item );
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
render() {
|
|
33
|
-
const { getStylesFromColorScheme, item, itemWidth, maxWidth } =
|
|
34
|
-
this.props;
|
|
35
|
-
|
|
36
|
-
const modalIconWrapperStyle = getStylesFromColorScheme(
|
|
37
|
-
styles.modalIconWrapper,
|
|
38
|
-
styles.modalIconWrapperDark
|
|
39
|
-
);
|
|
40
|
-
const modalIconStyle = styles.modalIcon;
|
|
41
|
-
const modalItemLabelStyle = getStylesFromColorScheme(
|
|
42
|
-
styles.modalItemLabel,
|
|
43
|
-
styles.modalItemLabelDark
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
const clipboardBlockStyles = getStylesFromColorScheme(
|
|
47
|
-
styles.clipboardBlock,
|
|
48
|
-
styles.clipboardBlockDark
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
const isClipboardBlock = item.id === 'clipboard';
|
|
52
|
-
const blockTitle = isClipboardBlock ? __( 'Copied block' ) : item.title;
|
|
53
|
-
const blockIsNew = item.isNew === true;
|
|
54
|
-
const accessibilityLabelFormat = blockIsNew
|
|
55
|
-
? // translators: Newly available block name. %s: The localized block name
|
|
56
|
-
__( '%s block, newly available' )
|
|
57
|
-
: // translators: Block name. %s: The localized block name
|
|
58
|
-
__( '%s block' );
|
|
59
|
-
const accessibilityLabel = sprintf(
|
|
60
|
-
accessibilityLabelFormat,
|
|
61
|
-
item.title
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<TouchableHighlight
|
|
66
|
-
style={ [
|
|
67
|
-
styles.touchableArea,
|
|
68
|
-
item.isDisabled ? styles.disabled : null,
|
|
69
|
-
] }
|
|
70
|
-
underlayColor="transparent"
|
|
71
|
-
activeOpacity={ 0.5 }
|
|
72
|
-
accessibilityRole="button"
|
|
73
|
-
accessibilityLabel={ accessibilityLabel }
|
|
74
|
-
onPress={ this.onPress }
|
|
75
|
-
disabled={ item.isDisabled }
|
|
76
|
-
>
|
|
77
|
-
<View style={ [ styles.modalItem, { width: maxWidth } ] }>
|
|
78
|
-
<View
|
|
79
|
-
style={ [
|
|
80
|
-
modalIconWrapperStyle,
|
|
81
|
-
itemWidth && {
|
|
82
|
-
width: itemWidth,
|
|
83
|
-
},
|
|
84
|
-
isClipboardBlock && clipboardBlockStyles,
|
|
85
|
-
] }
|
|
86
|
-
>
|
|
87
|
-
{ blockIsNew && (
|
|
88
|
-
<Icon
|
|
89
|
-
icon={ sparkles }
|
|
90
|
-
style={ styles.newIndicator }
|
|
91
|
-
/>
|
|
92
|
-
) }
|
|
93
|
-
<View style={ modalIconStyle }>
|
|
94
|
-
<BlockIcon
|
|
95
|
-
icon={ item.icon }
|
|
96
|
-
size={ modalIconStyle.width }
|
|
97
|
-
/>
|
|
98
|
-
</View>
|
|
99
|
-
</View>
|
|
100
|
-
<Text numberOfLines={ 3 } style={ modalItemLabelStyle }>
|
|
101
|
-
{ blockTitle }
|
|
102
|
-
</Text>
|
|
103
|
-
</View>
|
|
104
|
-
</TouchableHighlight>
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const InserterButton = withPreferredColorScheme( MenuItem );
|
|
110
|
-
|
|
111
|
-
InserterButton.Styles = {
|
|
112
|
-
modalItem: styles.modalItem,
|
|
113
|
-
modalIconWrapper: styles.modalIconWrapper,
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
export default InserterButton;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { SVG, Path } from '@wordpress/primitives';
|
|
5
|
-
|
|
6
|
-
const sparkles = (
|
|
7
|
-
<SVG viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
8
|
-
<Path
|
|
9
|
-
d="M10 11c-1.588-.479-4-.91-4-.91s2-.241 4-.454c1.8-.191 3.365-.502 4-3.181C14.635 3.775 15 1 15 1s.365 2.775 1 5.455c.635 2.679 2 2.969 4 3.181 2 .213 4 .455 4 .455s-2.412.43-4 .909c-1.588.479-3 1-4 4.546-.746 2.643-.893 4.948-1 5.454-.107-.506-.167-2.5-1-5.454C13 12 11.588 11.479 10 11zM7.333 3.5C6.803 3.333 6 3.182 6 3.182s.667-.085 1.333-.16c.6-.066 1.122-.175 1.334-1.113C8.878.971 9 0 9 0s.122.971.333 1.91c.212.937.667 1.038 1.334 1.113.666.074 1.333.159 1.333.159s-.804.15-1.333.318c-.53.167-1 .35-1.334 1.59C9.085 6.017 9.036 6.824 9 7c-.036-.177-.056-.875-.333-1.91-.334-1.24-.804-1.423-1.334-1.59zM2.444 18C1.474 17.713 0 17.454 0 17.454s1.222-.145 2.444-.272c1.1-.115 2.057-.302 2.445-1.91C5.277 13.666 5.5 12 5.5 12s.223 1.665.611 3.273c.388 1.607 1.222 1.781 2.445 1.909 1.222.127 2.444.273 2.444.273s-1.474.258-2.444.545c-.971.287-1.834.6-2.445 2.727-.456 1.586-.546 2.97-.611 3.273-.065-.304-.102-1.5-.611-3.273C4.278 18.6 3.415 18.287 2.444 18z"
|
|
10
|
-
fill="#F0C930"
|
|
11
|
-
/>
|
|
12
|
-
</SVG>
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
export default sparkles;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/** @format */
|
|
2
|
-
.touchableArea {
|
|
3
|
-
border-radius: 8px 8px 8px 8px;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.disabled {
|
|
7
|
-
opacity: 0.3;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.modalIconWrapper {
|
|
11
|
-
width: 104px;
|
|
12
|
-
height: 64px;
|
|
13
|
-
background-color: $gray-light; //#f3f6f8
|
|
14
|
-
border-radius: 8px 8px 8px 8px;
|
|
15
|
-
justify-content: center;
|
|
16
|
-
align-items: center;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.modalIconWrapperDark {
|
|
20
|
-
background-color: rgba($white, 0.07);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.newIndicator {
|
|
24
|
-
height: 22;
|
|
25
|
-
left: 6;
|
|
26
|
-
position: absolute;
|
|
27
|
-
top: 6;
|
|
28
|
-
width: 22;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.modalIcon {
|
|
32
|
-
width: 32px;
|
|
33
|
-
height: 32px;
|
|
34
|
-
justify-content: center;
|
|
35
|
-
align-items: center;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.modalItemLabel {
|
|
39
|
-
background-color: transparent;
|
|
40
|
-
padding-left: 2;
|
|
41
|
-
padding-right: 2;
|
|
42
|
-
padding-top: 4;
|
|
43
|
-
padding-bottom: 0;
|
|
44
|
-
justify-content: center;
|
|
45
|
-
text-align: center;
|
|
46
|
-
font-size: 12;
|
|
47
|
-
color: $gray-dark;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.modalItemLabelDark {
|
|
51
|
-
color: $white;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.clipboardBlock {
|
|
55
|
-
background-color: transparent;
|
|
56
|
-
border-width: 1px;
|
|
57
|
-
border-color: $light-gray-400;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.clipboardBlockDark {
|
|
61
|
-
border-color: $gray-70;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.modalItem {
|
|
65
|
-
flex-direction: column;
|
|
66
|
-
justify-content: flex-start;
|
|
67
|
-
align-items: center;
|
|
68
|
-
padding-left: $grid-unit-20 * 0.5;
|
|
69
|
-
padding-right: $grid-unit-20 * 0.5;
|
|
70
|
-
padding-top: 0;
|
|
71
|
-
padding-bottom: 0;
|
|
72
|
-
}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
5
|
-
import { StyleSheet } from 'react-native';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* WordPress dependencies
|
|
9
|
-
*/
|
|
10
|
-
import { __ } from '@wordpress/i18n';
|
|
11
|
-
import { Icon, check, chevronRight } from '@wordpress/icons';
|
|
12
|
-
import { blockSettingsScreens } from '@wordpress/block-editor';
|
|
13
|
-
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Internal dependencies
|
|
17
|
-
*/
|
|
18
|
-
import styles from './style.scss';
|
|
19
|
-
import PanelBody from '../../panel/body';
|
|
20
|
-
import BottomSheet from '../bottom-sheet';
|
|
21
|
-
|
|
22
|
-
const LINK_DESTINATION_NONE = 'none';
|
|
23
|
-
const LINK_DESTINATION_MEDIA = 'media';
|
|
24
|
-
const LINK_DESTINATION_ATTACHMENT = 'attachment';
|
|
25
|
-
const LINK_DESTINATION_CUSTOM = 'custom';
|
|
26
|
-
|
|
27
|
-
function LinkDestination( {
|
|
28
|
-
children,
|
|
29
|
-
isSelected,
|
|
30
|
-
label,
|
|
31
|
-
onPress,
|
|
32
|
-
value,
|
|
33
|
-
valueStyle,
|
|
34
|
-
} ) {
|
|
35
|
-
const optionIcon = usePreferredColorSchemeStyle(
|
|
36
|
-
styles.optionIcon,
|
|
37
|
-
styles.optionIconDark
|
|
38
|
-
);
|
|
39
|
-
return (
|
|
40
|
-
<BottomSheet.Cell
|
|
41
|
-
icon={ check }
|
|
42
|
-
iconStyle={ StyleSheet.flatten( [
|
|
43
|
-
optionIcon,
|
|
44
|
-
! isSelected && styles.unselectedOptionIcon,
|
|
45
|
-
] ) }
|
|
46
|
-
label={ label }
|
|
47
|
-
leftAlign
|
|
48
|
-
onPress={ onPress }
|
|
49
|
-
value={ value }
|
|
50
|
-
valueStyle={ valueStyle }
|
|
51
|
-
separatorType="leftMargin"
|
|
52
|
-
>
|
|
53
|
-
{ children }
|
|
54
|
-
</BottomSheet.Cell>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function ImageLinkDestinationsScreen( props ) {
|
|
59
|
-
const navigation = useNavigation();
|
|
60
|
-
const route = useRoute();
|
|
61
|
-
const { url = '' } = props;
|
|
62
|
-
const {
|
|
63
|
-
inputValue = url,
|
|
64
|
-
imageUrl,
|
|
65
|
-
attachmentPageUrl,
|
|
66
|
-
linkDestination,
|
|
67
|
-
} = route.params || {};
|
|
68
|
-
|
|
69
|
-
function goToLinkPicker() {
|
|
70
|
-
navigation.navigate( blockSettingsScreens.linkPicker, {
|
|
71
|
-
inputValue:
|
|
72
|
-
linkDestination === LINK_DESTINATION_CUSTOM ? inputValue : '',
|
|
73
|
-
} );
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const setLinkDestination = ( newLinkDestination ) => () => {
|
|
77
|
-
let newUrl;
|
|
78
|
-
switch ( newLinkDestination ) {
|
|
79
|
-
case LINK_DESTINATION_MEDIA:
|
|
80
|
-
newUrl = imageUrl;
|
|
81
|
-
break;
|
|
82
|
-
case LINK_DESTINATION_ATTACHMENT:
|
|
83
|
-
newUrl = attachmentPageUrl;
|
|
84
|
-
break;
|
|
85
|
-
default:
|
|
86
|
-
newUrl = '';
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
navigation.navigate( blockSettingsScreens.settings, {
|
|
91
|
-
// The `inputValue` name is reused from LinkPicker, as it helps avoid
|
|
92
|
-
// bugs from stale values remaining in the React Navigation route
|
|
93
|
-
// parameters.
|
|
94
|
-
inputValue: newUrl,
|
|
95
|
-
// Clear link text value that may be set from LinkPicker.
|
|
96
|
-
text: '',
|
|
97
|
-
} );
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
return (
|
|
101
|
-
<>
|
|
102
|
-
<BottomSheet.NavBar>
|
|
103
|
-
<BottomSheet.NavBar.BackButton onPress={ navigation.goBack } />
|
|
104
|
-
<BottomSheet.NavBar.Heading>
|
|
105
|
-
{ __( 'Link To' ) }
|
|
106
|
-
</BottomSheet.NavBar.Heading>
|
|
107
|
-
</BottomSheet.NavBar>
|
|
108
|
-
<PanelBody>
|
|
109
|
-
<LinkDestination
|
|
110
|
-
isSelected={ linkDestination === LINK_DESTINATION_NONE }
|
|
111
|
-
label={ __( 'None' ) }
|
|
112
|
-
onPress={ setLinkDestination( LINK_DESTINATION_NONE ) }
|
|
113
|
-
/>
|
|
114
|
-
<LinkDestination
|
|
115
|
-
isSelected={ linkDestination === LINK_DESTINATION_MEDIA }
|
|
116
|
-
label={ __( 'Media File' ) }
|
|
117
|
-
onPress={ setLinkDestination( LINK_DESTINATION_MEDIA ) }
|
|
118
|
-
/>
|
|
119
|
-
{ !! attachmentPageUrl && (
|
|
120
|
-
<LinkDestination
|
|
121
|
-
isSelected={
|
|
122
|
-
linkDestination === LINK_DESTINATION_ATTACHMENT
|
|
123
|
-
}
|
|
124
|
-
label={ __( 'Attachment Page' ) }
|
|
125
|
-
onPress={ setLinkDestination(
|
|
126
|
-
LINK_DESTINATION_ATTACHMENT
|
|
127
|
-
) }
|
|
128
|
-
/>
|
|
129
|
-
) }
|
|
130
|
-
<LinkDestination
|
|
131
|
-
isSelected={ linkDestination === LINK_DESTINATION_CUSTOM }
|
|
132
|
-
label={ __( 'Custom URL' ) }
|
|
133
|
-
onPress={ goToLinkPicker }
|
|
134
|
-
value={
|
|
135
|
-
linkDestination === LINK_DESTINATION_CUSTOM
|
|
136
|
-
? inputValue
|
|
137
|
-
: ''
|
|
138
|
-
}
|
|
139
|
-
valueStyle={
|
|
140
|
-
linkDestination === LINK_DESTINATION_CUSTOM
|
|
141
|
-
? undefined
|
|
142
|
-
: styles.placeholderTextColor
|
|
143
|
-
}
|
|
144
|
-
>
|
|
145
|
-
<Icon icon={ chevronRight }></Icon>
|
|
146
|
-
</LinkDestination>
|
|
147
|
-
</PanelBody>
|
|
148
|
-
</>
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export default ImageLinkDestinationsScreen;
|