@wordpress/components 30.9.0 → 31.0.1-next.6deb34194.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 +25 -4
- package/build/alignment-matrix-control/cell.js +131 -3
- package/build/alignment-matrix-control/cell.js.map +4 -4
- package/build/alignment-matrix-control/index.js +134 -6
- package/build/alignment-matrix-control/index.js.map +3 -3
- package/build/angle-picker-control/angle-circle.js +119 -15
- package/build/angle-picker-control/angle-circle.js.map +4 -4
- package/build/angle-picker-control/index.js +12 -7
- package/build/angle-picker-control/index.js.map +3 -3
- package/build/dropdown-menu/index.js +1 -1
- package/build/dropdown-menu/index.js.map +2 -2
- package/build/menu/styles.js +17 -17
- package/build/menu/styles.js.map +2 -2
- package/build/menu-item/index.js +1 -1
- package/build/menu-item/index.js.map +2 -2
- package/build/notice/index.js +1 -1
- package/build/notice/index.js.map +2 -2
- package/build/snackbar/index.js +1 -1
- package/build/snackbar/index.js.map +1 -1
- package/build/validated-form-controls/components/checkbox-control.js +0 -10
- package/build/validated-form-controls/components/checkbox-control.js.map +2 -2
- package/build/validated-form-controls/components/combobox-control.js +1 -11
- package/build/validated-form-controls/components/combobox-control.js.map +2 -2
- package/build/validated-form-controls/components/custom-select-control.js +0 -10
- package/build/validated-form-controls/components/custom-select-control.js.map +2 -2
- package/build/validated-form-controls/components/form-token-field.js +2 -12
- package/build/validated-form-controls/components/form-token-field.js.map +2 -2
- package/build/validated-form-controls/components/input-control.js +0 -10
- package/build/validated-form-controls/components/input-control.js.map +2 -2
- package/build/validated-form-controls/components/number-control.js +0 -10
- package/build/validated-form-controls/components/number-control.js.map +2 -2
- package/build/validated-form-controls/components/radio-control.js +0 -10
- package/build/validated-form-controls/components/radio-control.js.map +2 -2
- package/build/validated-form-controls/components/range-control.js +0 -10
- package/build/validated-form-controls/components/range-control.js.map +2 -2
- package/build/validated-form-controls/components/select-control.js +0 -10
- package/build/validated-form-controls/components/select-control.js.map +2 -2
- package/build/validated-form-controls/components/text-control.js +0 -10
- package/build/validated-form-controls/components/text-control.js.map +2 -2
- package/build/validated-form-controls/components/textarea-control.js +0 -10
- package/build/validated-form-controls/components/textarea-control.js.map +2 -2
- package/build/validated-form-controls/components/toggle-control.js +0 -10
- package/build/validated-form-controls/components/toggle-control.js.map +2 -2
- package/build/validated-form-controls/components/toggle-group-control.js +0 -10
- package/build/validated-form-controls/components/toggle-group-control.js.map +2 -2
- package/build/validated-form-controls/control-with-error.js +53 -58
- package/build/validated-form-controls/control-with-error.js.map +2 -2
- package/build-module/alignment-matrix-control/cell.js +131 -3
- package/build-module/alignment-matrix-control/cell.js.map +3 -3
- package/build-module/alignment-matrix-control/index.js +134 -6
- package/build-module/alignment-matrix-control/index.js.map +3 -3
- package/build-module/angle-picker-control/angle-circle.js +109 -15
- package/build-module/angle-picker-control/angle-circle.js.map +3 -3
- package/build-module/angle-picker-control/index.js +12 -7
- package/build-module/angle-picker-control/index.js.map +2 -2
- package/build-module/dropdown-menu/index.js +1 -1
- package/build-module/dropdown-menu/index.js.map +2 -2
- package/build-module/menu/styles.js +17 -17
- package/build-module/menu/styles.js.map +2 -2
- package/build-module/menu-item/index.js +1 -1
- package/build-module/menu-item/index.js.map +2 -2
- package/build-module/notice/index.js +1 -1
- package/build-module/notice/index.js.map +2 -2
- package/build-module/snackbar/index.js +1 -1
- package/build-module/snackbar/index.js.map +1 -1
- package/build-module/validated-form-controls/components/checkbox-control.js +0 -10
- package/build-module/validated-form-controls/components/checkbox-control.js.map +2 -2
- package/build-module/validated-form-controls/components/combobox-control.js +1 -11
- package/build-module/validated-form-controls/components/combobox-control.js.map +2 -2
- package/build-module/validated-form-controls/components/custom-select-control.js +0 -10
- package/build-module/validated-form-controls/components/custom-select-control.js.map +2 -2
- package/build-module/validated-form-controls/components/form-token-field.js +2 -12
- package/build-module/validated-form-controls/components/form-token-field.js.map +2 -2
- package/build-module/validated-form-controls/components/input-control.js +0 -10
- package/build-module/validated-form-controls/components/input-control.js.map +2 -2
- package/build-module/validated-form-controls/components/number-control.js +0 -10
- package/build-module/validated-form-controls/components/number-control.js.map +2 -2
- package/build-module/validated-form-controls/components/radio-control.js +0 -10
- package/build-module/validated-form-controls/components/radio-control.js.map +2 -2
- package/build-module/validated-form-controls/components/range-control.js +0 -10
- package/build-module/validated-form-controls/components/range-control.js.map +2 -2
- package/build-module/validated-form-controls/components/select-control.js +0 -10
- package/build-module/validated-form-controls/components/select-control.js.map +2 -2
- package/build-module/validated-form-controls/components/text-control.js +0 -10
- package/build-module/validated-form-controls/components/text-control.js.map +2 -2
- package/build-module/validated-form-controls/components/textarea-control.js +0 -10
- package/build-module/validated-form-controls/components/textarea-control.js.map +2 -2
- package/build-module/validated-form-controls/components/toggle-control.js +0 -10
- package/build-module/validated-form-controls/components/toggle-control.js.map +2 -2
- package/build-module/validated-form-controls/components/toggle-group-control.js +0 -10
- package/build-module/validated-form-controls/components/toggle-group-control.js.map +2 -2
- package/build-module/validated-form-controls/control-with-error.js +53 -58
- package/build-module/validated-form-controls/control-with-error.js.map +2 -2
- package/build-style/style-rtl.css +21 -33
- package/build-style/style.css +21 -33
- package/build-types/alignment-matrix-control/cell.d.ts.map +1 -1
- package/build-types/alignment-matrix-control/index.d.ts.map +1 -1
- package/build-types/angle-picker-control/angle-circle.d.ts +1 -1
- package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -1
- package/build-types/angle-picker-control/index.d.ts.map +1 -1
- package/build-types/notice/index.d.ts.map +1 -1
- package/build-types/notice/stories/index.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/checkbox-control.d.ts +1 -1
- package/build-types/validated-form-controls/components/checkbox-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/combobox-control.d.ts +2 -3
- package/build-types/validated-form-controls/components/combobox-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/custom-select-control.d.ts +1 -2
- package/build-types/validated-form-controls/components/custom-select-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/form-token-field.d.ts +1 -2
- package/build-types/validated-form-controls/components/form-token-field.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/input-control.d.ts +1 -2
- package/build-types/validated-form-controls/components/input-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/number-control.d.ts +1 -1
- package/build-types/validated-form-controls/components/number-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/radio-control.d.ts +1 -1
- package/build-types/validated-form-controls/components/radio-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/range-control.d.ts +1 -1
- package/build-types/validated-form-controls/components/range-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/select-control.d.ts +2 -3
- package/build-types/validated-form-controls/components/select-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/checkbox-control.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/combobox-control.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/custom-select-control.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/form-token-field.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/input-control.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/number-control.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/overview.story.d.ts +7 -0
- package/build-types/validated-form-controls/components/stories/overview.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/radio-control.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/range-control.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/select-control.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/text-control.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/textarea-control.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/toggle-control.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/toggle-group-control.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/text-control.d.ts +1 -1
- package/build-types/validated-form-controls/components/text-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/textarea-control.d.ts +1 -1
- package/build-types/validated-form-controls/components/textarea-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/toggle-control.d.ts +1 -1
- package/build-types/validated-form-controls/components/toggle-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/toggle-group-control.d.ts +1 -1
- package/build-types/validated-form-controls/components/toggle-group-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/types.d.ts +1 -9
- package/build-types/validated-form-controls/components/types.d.ts.map +1 -1
- package/build-types/validated-form-controls/control-with-error.d.ts +4 -5
- package/build-types/validated-form-controls/control-with-error.d.ts.map +1 -1
- package/package.json +20 -20
- package/src/alignment-matrix-control/cell.tsx +14 -3
- package/src/alignment-matrix-control/index.tsx +15 -6
- package/src/alignment-matrix-control/style.module.scss +84 -0
- package/src/angle-picker-control/angle-circle.tsx +27 -12
- package/src/angle-picker-control/index.tsx +8 -7
- package/src/angle-picker-control/style.module.scss +40 -0
- package/src/button/style.scss +1 -1
- package/src/dropdown-menu/index.tsx +1 -1
- package/src/dropdown-menu/style.scss +1 -1
- package/src/guide/style.scss +3 -3
- package/src/menu/styles.ts +2 -2
- package/src/menu-item/index.tsx +1 -1
- package/src/menu-item/test/__snapshots__/index.js.snap +4 -4
- package/src/modal/style.scss +5 -5
- package/src/notice/index.tsx +53 -46
- package/src/notice/stories/index.story.tsx +17 -1
- package/src/notice/style.scss +3 -20
- package/src/snackbar/index.tsx +1 -1
- package/src/validated-form-controls/components/checkbox-control.tsx +1 -14
- package/src/validated-form-controls/components/combobox-control.tsx +1 -14
- package/src/validated-form-controls/components/custom-select-control.tsx +1 -19
- package/src/validated-form-controls/components/form-token-field.tsx +2 -15
- package/src/validated-form-controls/components/input-control.tsx +1 -14
- package/src/validated-form-controls/components/number-control.tsx +1 -16
- package/src/validated-form-controls/components/radio-control.tsx +2 -18
- package/src/validated-form-controls/components/range-control.tsx +1 -14
- package/src/validated-form-controls/components/select-control.tsx +1 -23
- package/src/validated-form-controls/components/stories/checkbox-control.story.tsx +11 -20
- package/src/validated-form-controls/components/stories/combobox-control.story.tsx +8 -17
- package/src/validated-form-controls/components/stories/custom-select-control.story.tsx +8 -17
- package/src/validated-form-controls/components/stories/form-token-field.story.tsx +14 -26
- package/src/validated-form-controls/components/stories/input-control.story.tsx +25 -50
- package/src/validated-form-controls/components/stories/number-control.story.tsx +10 -19
- package/src/validated-form-controls/components/stories/overview.mdx +3 -3
- package/src/validated-form-controls/components/stories/overview.story.tsx +94 -79
- package/src/validated-form-controls/components/stories/radio-control.story.tsx +11 -20
- package/src/validated-form-controls/components/stories/range-control.story.tsx +8 -17
- package/src/validated-form-controls/components/stories/select-control.story.tsx +9 -18
- package/src/validated-form-controls/components/stories/text-control.story.tsx +11 -17
- package/src/validated-form-controls/components/stories/textarea-control.story.tsx +12 -16
- package/src/validated-form-controls/components/stories/toggle-control.story.tsx +11 -20
- package/src/validated-form-controls/components/stories/toggle-group-control.story.tsx +8 -17
- package/src/validated-form-controls/components/text-control.tsx +1 -14
- package/src/validated-form-controls/components/textarea-control.tsx +1 -14
- package/src/validated-form-controls/components/toggle-control.tsx +1 -14
- package/src/validated-form-controls/components/toggle-group-control.tsx +1 -14
- package/src/validated-form-controls/components/types.ts +1 -9
- package/src/validated-form-controls/control-with-error.tsx +57 -84
- package/src/validated-form-controls/style.scss +7 -7
- package/src/validated-form-controls/test/control-with-error.tsx +66 -5
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/alignment-matrix-control/styles.js +0 -105
- package/build/alignment-matrix-control/styles.js.map +0 -7
- package/build/angle-picker-control/styles/angle-picker-control-styles.js +0 -88
- package/build/angle-picker-control/styles/angle-picker-control-styles.js.map +0 -7
- package/build-module/alignment-matrix-control/styles.js +0 -67
- package/build-module/alignment-matrix-control/styles.js.map +0 -7
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +0 -50
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +0 -7
- package/build-types/alignment-matrix-control/styles.d.ts +0 -21
- package/build-types/alignment-matrix-control/styles.d.ts.map +0 -1
- package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts +0 -18
- package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +0 -1
- package/src/alignment-matrix-control/styles.ts +0 -113
- package/src/angle-picker-control/styles/angle-picker-control-styles.tsx +0 -58
|
@@ -5,9 +5,134 @@ import { useInstanceId } from "@wordpress/compose";
|
|
|
5
5
|
import { useCallback } from "@wordpress/element";
|
|
6
6
|
import Cell from "./cell";
|
|
7
7
|
import { Composite } from "../composite";
|
|
8
|
-
import { GridContainer, GridRow } from "./styles";
|
|
9
8
|
import AlignmentMatrixControlIcon from "./icon";
|
|
10
9
|
import { GRID, getItemId, getItemValue } from "./utils";
|
|
10
|
+
|
|
11
|
+
// packages/components/src/alignment-matrix-control/style.module.scss
|
|
12
|
+
var css = `/**
|
|
13
|
+
* SCSS Variables.
|
|
14
|
+
*
|
|
15
|
+
* Please use variables from this sheet to ensure consistency across the UI.
|
|
16
|
+
* Don't add to this sheet unless you're pretty sure the value will be reused in many places.
|
|
17
|
+
* For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Colors
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Fonts & basic variables.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Typography
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Grid System.
|
|
30
|
+
* https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* Radius scale.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* Elevation scale.
|
|
37
|
+
*/
|
|
38
|
+
/**
|
|
39
|
+
* Dimensions.
|
|
40
|
+
*/
|
|
41
|
+
/**
|
|
42
|
+
* Mobile specific styles
|
|
43
|
+
*/
|
|
44
|
+
/**
|
|
45
|
+
* Editor styles.
|
|
46
|
+
*/
|
|
47
|
+
/**
|
|
48
|
+
* Block & Editor UI.
|
|
49
|
+
*/
|
|
50
|
+
/**
|
|
51
|
+
* Block paddings.
|
|
52
|
+
*/
|
|
53
|
+
/**
|
|
54
|
+
* React Native specific.
|
|
55
|
+
* These variables do not appear to be used anywhere else.
|
|
56
|
+
*/
|
|
57
|
+
.style-module__grid-container__AuKvW {
|
|
58
|
+
direction: ltr;
|
|
59
|
+
display: grid;
|
|
60
|
+
grid-template-columns: repeat(3, 1fr);
|
|
61
|
+
grid-template-rows: repeat(3, 1fr);
|
|
62
|
+
box-sizing: border-box;
|
|
63
|
+
aspect-ratio: 1;
|
|
64
|
+
border: 1px solid transparent;
|
|
65
|
+
border-radius: 4px;
|
|
66
|
+
outline: none;
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.style-module__grid-row__xCH47 {
|
|
71
|
+
grid-column: 1/-1;
|
|
72
|
+
box-sizing: border-box;
|
|
73
|
+
display: grid;
|
|
74
|
+
grid-template-columns: repeat(3, 1fr);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.style-module__cell__Ovdp9 {
|
|
78
|
+
position: relative;
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
justify-content: center;
|
|
82
|
+
box-sizing: border-box;
|
|
83
|
+
margin: 0;
|
|
84
|
+
padding: 0;
|
|
85
|
+
appearance: none;
|
|
86
|
+
border: none;
|
|
87
|
+
outline: none;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.style-module__point__N-8S1 {
|
|
91
|
+
display: block;
|
|
92
|
+
contain: strict;
|
|
93
|
+
box-sizing: border-box;
|
|
94
|
+
width: 6px;
|
|
95
|
+
aspect-ratio: 1;
|
|
96
|
+
margin: auto;
|
|
97
|
+
color: var(--wp-components-color-gray-400, #ccc);
|
|
98
|
+
/* Use border instead of background color so that the point shows
|
|
99
|
+
in Windows High Contrast Mode */
|
|
100
|
+
border: 3px solid currentColor;
|
|
101
|
+
/* Highlight active item */
|
|
102
|
+
}
|
|
103
|
+
.style-module__cell__Ovdp9[data-active-item] .style-module__point__N-8S1 {
|
|
104
|
+
color: var(--wp-components-color-foreground, #1e1e1e);
|
|
105
|
+
transform: scale(1.6666666667);
|
|
106
|
+
}
|
|
107
|
+
.style-module__point__N-8S1 {
|
|
108
|
+
/* Hover styles for non-active items */
|
|
109
|
+
}
|
|
110
|
+
.style-module__cell__Ovdp9:not([data-active-item]):hover .style-module__point__N-8S1 {
|
|
111
|
+
color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
|
112
|
+
}
|
|
113
|
+
.style-module__point__N-8S1 {
|
|
114
|
+
/* Show an outline only when interacting with keyboard */
|
|
115
|
+
}
|
|
116
|
+
.style-module__cell__Ovdp9[data-focus-visible] .style-module__point__N-8S1 {
|
|
117
|
+
outline: 1px solid var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
|
118
|
+
outline-offset: 1px;
|
|
119
|
+
}
|
|
120
|
+
@media not (prefers-reduced-motion) {
|
|
121
|
+
.style-module__point__N-8S1 {
|
|
122
|
+
transition-property: color, transform;
|
|
123
|
+
transition-duration: 120ms;
|
|
124
|
+
transition-timing-function: linear;
|
|
125
|
+
}
|
|
126
|
+
}`;
|
|
127
|
+
document.head.appendChild(document.createElement("style")).appendChild(document.createTextNode(css));
|
|
128
|
+
var style_module_default = {
|
|
129
|
+
"grid-container": "style-module__grid-container__AuKvW",
|
|
130
|
+
"grid-row": "style-module__grid-row__xCH47",
|
|
131
|
+
"cell": "style-module__cell__Ovdp9",
|
|
132
|
+
"point": "style-module__point__N-8S1"
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
// packages/components/src/alignment-matrix-control/index.tsx
|
|
11
136
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
137
|
function UnforwardedAlignmentMatrixControl({
|
|
13
138
|
className,
|
|
@@ -26,22 +151,25 @@ function UnforwardedAlignmentMatrixControl({
|
|
|
26
151
|
onChange?.(nextValue);
|
|
27
152
|
}
|
|
28
153
|
}, [baseId, onChange]);
|
|
29
|
-
const classes = clsx("component-alignment-matrix-control", className);
|
|
154
|
+
const classes = clsx("component-alignment-matrix-control", style_module_default["grid-container"], className);
|
|
30
155
|
return /* @__PURE__ */ _jsx(Composite, {
|
|
31
156
|
defaultActiveId: getItemId(baseId, defaultValue),
|
|
32
157
|
activeId: getItemId(baseId, value),
|
|
33
158
|
setActiveId,
|
|
34
159
|
rtl: isRTL(),
|
|
35
|
-
render: /* @__PURE__ */ _jsx(
|
|
160
|
+
render: /* @__PURE__ */ _jsx("div", {
|
|
36
161
|
...props,
|
|
37
|
-
"aria-label": label,
|
|
38
162
|
className: classes,
|
|
163
|
+
"aria-label": label,
|
|
39
164
|
id: baseId,
|
|
40
165
|
role: "grid",
|
|
41
|
-
|
|
166
|
+
style: {
|
|
167
|
+
width: `${width}px`
|
|
168
|
+
}
|
|
42
169
|
}),
|
|
43
170
|
children: GRID.map((cells, index) => /* @__PURE__ */ _jsx(Composite.Row, {
|
|
44
|
-
render: /* @__PURE__ */ _jsx(
|
|
171
|
+
render: /* @__PURE__ */ _jsx("div", {
|
|
172
|
+
className: style_module_default["grid-row"],
|
|
45
173
|
role: "row"
|
|
46
174
|
}),
|
|
47
175
|
children: cells.map((cell) => /* @__PURE__ */ _jsx(Cell, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/alignment-matrix-control/index.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Cell from './cell';\nimport { Composite } from '../composite';\nimport
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,IAAI,aAAa;AAC1B,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAK5B,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAC1B,
|
|
3
|
+
"sources": ["../../src/alignment-matrix-control/index.tsx", "../../src/alignment-matrix-control/style.module.scss"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Cell from './cell';\nimport { Composite } from '../composite';\nimport AlignmentMatrixControlIcon from './icon';\nimport { GRID, getItemId, getItemValue } from './utils';\nimport styles from './style.module.scss';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nfunction UnforwardedAlignmentMatrixControl({\n className,\n id,\n label = __('Alignment Matrix Control'),\n defaultValue = 'center center',\n value,\n onChange,\n width = 92,\n ...props\n}) {\n const baseId = useInstanceId(UnforwardedAlignmentMatrixControl, 'alignment-matrix-control', id);\n const setActiveId = useCallback(nextActiveId => {\n const nextValue = getItemValue(baseId, nextActiveId);\n if (nextValue) {\n onChange?.(nextValue);\n }\n }, [baseId, onChange]);\n const classes = clsx('component-alignment-matrix-control', styles['grid-container'], className);\n return /*#__PURE__*/_jsx(Composite, {\n defaultActiveId: getItemId(baseId, defaultValue),\n activeId: getItemId(baseId, value),\n setActiveId: setActiveId,\n rtl: isRTL(),\n render: /*#__PURE__*/_jsx(\"div\", {\n ...props,\n className: classes,\n \"aria-label\": label,\n id: baseId,\n role: \"grid\",\n style: {\n width: `${width}px`\n }\n }),\n children: GRID.map((cells, index) => /*#__PURE__*/_jsx(Composite.Row, {\n render: /*#__PURE__*/_jsx(\"div\", {\n className: styles['grid-row'],\n role: \"row\"\n }),\n children: cells.map(cell => /*#__PURE__*/_jsx(Cell, {\n id: getItemId(baseId, cell),\n value: cell\n }, cell))\n }, index))\n });\n}\n\n/**\n * AlignmentMatrixControl components enable adjustments to horizontal and vertical alignments for UI.\n *\n * ```jsx\n * import { AlignmentMatrixControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * \tconst [ alignment, setAlignment ] = useState( 'center center' );\n *\n * \treturn (\n * \t\t<AlignmentMatrixControl\n * \t\t\tvalue={ alignment }\n * \t\t\tonChange={ setAlignment }\n * \t\t/>\n * \t);\n * };\n * ```\n */\nexport const AlignmentMatrixControl = Object.assign(UnforwardedAlignmentMatrixControl, {\n /**\n * Render an alignment matrix as an icon.\n *\n * ```jsx\n * import { AlignmentMatrixControl } from '@wordpress/components';\n *\n * <Icon icon={<AlignmentMatrixControl.Icon value=\"top left\" />} />\n * ```\n */\n Icon: Object.assign(AlignmentMatrixControlIcon, {\n displayName: 'AlignmentMatrixControl.Icon'\n })\n});\nexport default AlignmentMatrixControl;", "const css = `/**\n * SCSS Variables.\n *\n * Please use variables from this sheet to ensure consistency across the UI.\n * Don't add to this sheet unless you're pretty sure the value will be reused in many places.\n * For example, don't add rules to this sheet that affect block visuals. It's purely for UI.\n */\n/**\n * Colors\n */\n/**\n * Fonts & basic variables.\n */\n/**\n * Typography\n */\n/**\n * Grid System.\n * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/\n */\n/**\n * Radius scale.\n */\n/**\n * Elevation scale.\n */\n/**\n * Dimensions.\n */\n/**\n * Mobile specific styles\n */\n/**\n * Editor styles.\n */\n/**\n * Block & Editor UI.\n */\n/**\n * Block paddings.\n */\n/**\n * React Native specific.\n * These variables do not appear to be used anywhere else.\n */\n.style-module__grid-container__AuKvW {\n direction: ltr;\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n grid-template-rows: repeat(3, 1fr);\n box-sizing: border-box;\n aspect-ratio: 1;\n border: 1px solid transparent;\n border-radius: 4px;\n outline: none;\n cursor: pointer;\n}\n\n.style-module__grid-row__xCH47 {\n grid-column: 1/-1;\n box-sizing: border-box;\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n}\n\n.style-module__cell__Ovdp9 {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n appearance: none;\n border: none;\n outline: none;\n}\n\n.style-module__point__N-8S1 {\n display: block;\n contain: strict;\n box-sizing: border-box;\n width: 6px;\n aspect-ratio: 1;\n margin: auto;\n color: var(--wp-components-color-gray-400, #ccc);\n /* Use border instead of background color so that the point shows\n in Windows High Contrast Mode */\n border: 3px solid currentColor;\n /* Highlight active item */\n}\n.style-module__cell__Ovdp9[data-active-item] .style-module__point__N-8S1 {\n color: var(--wp-components-color-foreground, #1e1e1e);\n transform: scale(1.6666666667);\n}\n.style-module__point__N-8S1 {\n /* Hover styles for non-active items */\n}\n.style-module__cell__Ovdp9:not([data-active-item]):hover .style-module__point__N-8S1 {\n color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));\n}\n.style-module__point__N-8S1 {\n /* Show an outline only when interacting with keyboard */\n}\n.style-module__cell__Ovdp9[data-focus-visible] .style-module__point__N-8S1 {\n outline: 1px solid var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));\n outline-offset: 1px;\n}\n@media not (prefers-reduced-motion) {\n .style-module__point__N-8S1 {\n transition-property: color, transform;\n transition-duration: 120ms;\n transition-timing-function: linear;\n }\n}`;\ndocument.head\n .appendChild(document.createElement(\"style\"))\n .appendChild(document.createTextNode(css));\nexport {css};\nexport default {\n \"grid-container\": \"style-module__grid-container__AuKvW\",\n \"grid-row\": \"style-module__grid-row__xCH47\",\n \"cell\": \"style-module__cell__Ovdp9\",\n \"point\": \"style-module__point__N-8S1\"\n};"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,IAAI,aAAa;AAC1B,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAK5B,OAAO,UAAU;AACjB,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useRef } from "@wordpress/element";
|
|
3
4
|
import { __experimentalUseDragging as useDragging } from "@wordpress/compose";
|
|
4
|
-
|
|
5
|
+
|
|
6
|
+
// packages/components/src/angle-picker-control/style.module.scss
|
|
7
|
+
var css = `/**
|
|
8
|
+
* SCSS Variables.
|
|
9
|
+
*
|
|
10
|
+
* Please use variables from this sheet to ensure consistency across the UI.
|
|
11
|
+
* Don't add to this sheet unless you're pretty sure the value will be reused in many places.
|
|
12
|
+
* For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Colors
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Fonts & basic variables.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Typography
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Grid System.
|
|
25
|
+
* https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Radius scale.
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Elevation scale.
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Dimensions.
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* Mobile specific styles
|
|
38
|
+
*/
|
|
39
|
+
/**
|
|
40
|
+
* Editor styles.
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* Block & Editor UI.
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* Block paddings.
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* React Native specific.
|
|
50
|
+
* These variables do not appear to be used anywhere else.
|
|
51
|
+
*/
|
|
52
|
+
.style-module__circle-root__j1e41 {
|
|
53
|
+
border-radius: 50%;
|
|
54
|
+
border: 1px solid var(--wp-components-color-gray-600, #949494);
|
|
55
|
+
box-sizing: border-box;
|
|
56
|
+
cursor: grab;
|
|
57
|
+
height: 32px;
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
width: 32px;
|
|
60
|
+
}
|
|
61
|
+
.style-module__circle-root__j1e41:active {
|
|
62
|
+
cursor: grabbing;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.style-module__circle-indicator-wrapper__sbrph {
|
|
66
|
+
box-sizing: border-box;
|
|
67
|
+
position: relative;
|
|
68
|
+
width: 100%;
|
|
69
|
+
height: 100%;
|
|
70
|
+
}
|
|
71
|
+
.style-module__circle-indicator-wrapper__sbrph:focus-visible {
|
|
72
|
+
outline: none;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.style-module__circle-indicator__bS-go {
|
|
76
|
+
background: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
|
77
|
+
border-radius: 50%;
|
|
78
|
+
box-sizing: border-box;
|
|
79
|
+
display: block;
|
|
80
|
+
left: 50%;
|
|
81
|
+
top: 4px;
|
|
82
|
+
transform: translateX(-50%);
|
|
83
|
+
position: absolute;
|
|
84
|
+
width: 6px;
|
|
85
|
+
height: 6px;
|
|
86
|
+
}`;
|
|
87
|
+
document.head.appendChild(document.createElement("style")).appendChild(document.createTextNode(css));
|
|
88
|
+
var style_module_default = {
|
|
89
|
+
"circle-root": "style-module__circle-root__j1e41",
|
|
90
|
+
"circle-indicator-wrapper": "style-module__circle-indicator-wrapper__sbrph",
|
|
91
|
+
"circle-indicator": "style-module__circle-indicator__bS-go"
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// packages/components/src/angle-picker-control/angle-circle.tsx
|
|
5
95
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
96
|
function AngleCircle({
|
|
7
97
|
value,
|
|
8
98
|
onChange,
|
|
99
|
+
className,
|
|
9
100
|
...props
|
|
10
101
|
}) {
|
|
11
102
|
const angleCircleRef = useRef(null);
|
|
@@ -57,22 +148,25 @@ function AngleCircle({
|
|
|
57
148
|
previousCursorValueRef.current = void 0;
|
|
58
149
|
}
|
|
59
150
|
}, [isDragging]);
|
|
60
|
-
return
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
151
|
+
return (
|
|
152
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
153
|
+
/* @__PURE__ */ _jsx("div", {
|
|
154
|
+
ref: angleCircleRef,
|
|
155
|
+
onMouseDown: startDrag,
|
|
156
|
+
className: clsx("components-angle-picker-control__angle-circle", style_module_default["circle-root"], className),
|
|
157
|
+
...props,
|
|
158
|
+
children: /* @__PURE__ */ _jsx("div", {
|
|
159
|
+
style: value ? {
|
|
160
|
+
transform: `rotate(${value}deg)`
|
|
161
|
+
} : void 0,
|
|
162
|
+
className: clsx("components-angle-picker-control__angle-circle-indicator-wrapper", style_module_default["circle-indicator-wrapper"]),
|
|
163
|
+
tabIndex: -1,
|
|
164
|
+
children: /* @__PURE__ */ _jsx("div", {
|
|
165
|
+
className: clsx("components-angle-picker-control__angle-circle-indicator", style_module_default["circle-indicator"])
|
|
166
|
+
})
|
|
73
167
|
})
|
|
74
168
|
})
|
|
75
|
-
|
|
169
|
+
);
|
|
76
170
|
}
|
|
77
171
|
function getAngle(centerX, centerY, pointX, pointY) {
|
|
78
172
|
const y = pointY - centerY;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/angle-picker-control/angle-circle.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { __experimentalUseDragging as useDragging } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport
|
|
5
|
-
"mappings": ";AAGA,SAAS,WAAW,cAAc;AAClC,SAAS,6BAA6B,mBAAmB;
|
|
3
|
+
"sources": ["../../src/angle-picker-control/angle-circle.tsx", "../../src/angle-picker-control/style.module.scss"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { __experimentalUseDragging as useDragging } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.module.scss';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nfunction AngleCircle({\n value,\n onChange,\n className,\n ...props\n}) {\n const angleCircleRef = useRef(null);\n const angleCircleCenterRef = useRef();\n const previousCursorValueRef = useRef();\n const setAngleCircleCenter = () => {\n if (angleCircleRef.current === null) {\n return;\n }\n const rect = angleCircleRef.current.getBoundingClientRect();\n angleCircleCenterRef.current = {\n x: rect.x + rect.width / 2,\n y: rect.y + rect.height / 2\n };\n };\n const changeAngleToPosition = event => {\n if (event === undefined) {\n return;\n }\n\n // Prevent (drag) mouse events from selecting and accidentally\n // triggering actions from other elements.\n event.preventDefault();\n // Input control needs to lose focus and by preventDefault above, it doesn't.\n event.target?.focus();\n if (angleCircleCenterRef.current !== undefined && onChange !== undefined) {\n const {\n x: centerX,\n y: centerY\n } = angleCircleCenterRef.current;\n onChange(getAngle(centerX, centerY, event.clientX, event.clientY));\n }\n };\n const {\n startDrag,\n isDragging\n } = useDragging({\n onDragStart: event => {\n setAngleCircleCenter();\n changeAngleToPosition(event);\n },\n onDragMove: changeAngleToPosition,\n onDragEnd: changeAngleToPosition\n });\n useEffect(() => {\n if (isDragging) {\n if (previousCursorValueRef.current === undefined) {\n previousCursorValueRef.current = document.body.style.cursor;\n }\n document.body.style.cursor = 'grabbing';\n } else {\n document.body.style.cursor = previousCursorValueRef.current || '';\n previousCursorValueRef.current = undefined;\n }\n }, [isDragging]);\n return (\n /*#__PURE__*/\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n _jsx(\"div\", {\n ref: angleCircleRef,\n onMouseDown: startDrag,\n className: clsx('components-angle-picker-control__angle-circle', styles['circle-root'], className),\n ...props,\n children: /*#__PURE__*/_jsx(\"div\", {\n style: value ? {\n transform: `rotate(${value}deg)`\n } : undefined,\n className: clsx('components-angle-picker-control__angle-circle-indicator-wrapper', styles['circle-indicator-wrapper']),\n tabIndex: -1,\n children: /*#__PURE__*/_jsx(\"div\", {\n className: clsx('components-angle-picker-control__angle-circle-indicator', styles['circle-indicator'])\n })\n })\n })\n );\n}\nfunction getAngle(centerX, centerY, pointX, pointY) {\n const y = pointY - centerY;\n const x = pointX - centerX;\n const angleInRadians = Math.atan2(y, x);\n const angleInDeg = Math.round(angleInRadians * (180 / Math.PI)) + 90;\n if (angleInDeg < 0) {\n return 360 + angleInDeg;\n }\n return angleInDeg;\n}\nexport default AngleCircle;", "const css = `/**\n * SCSS Variables.\n *\n * Please use variables from this sheet to ensure consistency across the UI.\n * Don't add to this sheet unless you're pretty sure the value will be reused in many places.\n * For example, don't add rules to this sheet that affect block visuals. It's purely for UI.\n */\n/**\n * Colors\n */\n/**\n * Fonts & basic variables.\n */\n/**\n * Typography\n */\n/**\n * Grid System.\n * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/\n */\n/**\n * Radius scale.\n */\n/**\n * Elevation scale.\n */\n/**\n * Dimensions.\n */\n/**\n * Mobile specific styles\n */\n/**\n * Editor styles.\n */\n/**\n * Block & Editor UI.\n */\n/**\n * Block paddings.\n */\n/**\n * React Native specific.\n * These variables do not appear to be used anywhere else.\n */\n.style-module__circle-root__j1e41 {\n border-radius: 50%;\n border: 1px solid var(--wp-components-color-gray-600, #949494);\n box-sizing: border-box;\n cursor: grab;\n height: 32px;\n overflow: hidden;\n width: 32px;\n}\n.style-module__circle-root__j1e41:active {\n cursor: grabbing;\n}\n\n.style-module__circle-indicator-wrapper__sbrph {\n box-sizing: border-box;\n position: relative;\n width: 100%;\n height: 100%;\n}\n.style-module__circle-indicator-wrapper__sbrph:focus-visible {\n outline: none;\n}\n\n.style-module__circle-indicator__bS-go {\n background: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));\n border-radius: 50%;\n box-sizing: border-box;\n display: block;\n left: 50%;\n top: 4px;\n transform: translateX(-50%);\n position: absolute;\n width: 6px;\n height: 6px;\n}`;\ndocument.head\n .appendChild(document.createElement(\"style\"))\n .appendChild(document.createTextNode(css));\nexport {css};\nexport default {\n \"circle-root\": \"style-module__circle-root__j1e41\",\n \"circle-indicator-wrapper\": \"style-module__circle-indicator-wrapper__sbrph\",\n \"circle-indicator\": \"style-module__circle-indicator__bS-go\"\n};"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,WAAW,cAAc;AAClC,SAAS,6BAA6B,mBAAmB;;;ACTzD,IAAM,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgFZ,SAAS,KACJ,YAAY,SAAS,cAAc,OAAO,CAAC,EAC3C,YAAY,SAAS,eAAe,GAAG,CAAC;AAE7C,IAAO,uBAAQ;AAAA,EACb,eAAe;AAAA,EACf,4BAA4B;AAAA,EAC5B,oBAAoB;AACtB;;;ADzEA,SAAS,OAAO,YAAY;AAC5B,SAAS,YAAY;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG;AACD,QAAM,iBAAiB,OAAO,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AAK,OAAO;AAAA,QACjC,OAAO,QAAQ;AAAA,UACb,WAAW,UAAU,KAAK;AAAA,QAC5B,IAAI;AAAA,QACJ,WAAW,KAAK,mEAAmE,qBAAO,0BAA0B,CAAC;AAAA,QACrH,UAAU;AAAA,QACV,UAAuB,qBAAK,OAAO;AAAA,UACjC,WAAW,KAAK,2DAA2D,qBAAO,kBAAkB,CAAC;AAAA,QACvG,CAAC;AAAA,MACH,CAAC;AAAA,IACH,CAAC;AAAA;AAEL;AACA,SAAS,SAAS,SAAS,SAAS,QAAQ,QAAQ;AAClD,QAAM,IAAI,SAAS;AACnB,QAAM,IAAI,SAAS;AACnB,QAAM,iBAAiB,KAAK,MAAM,GAAG,CAAC;AACtC,QAAM,aAAa,KAAK,MAAM,kBAAkB,MAAM,KAAK,GAAG,IAAI;AAClE,MAAI,aAAa,GAAG;AAClB,WAAO,MAAM;AAAA,EACf;AACA,SAAO;AACT;AACA,IAAO,uBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,8 +5,9 @@ import { isRTL, __ } from "@wordpress/i18n";
|
|
|
5
5
|
import { Flex, FlexBlock } from "../flex";
|
|
6
6
|
import { Spacer } from "../spacer";
|
|
7
7
|
import NumberControl from "../number-control";
|
|
8
|
+
import InputControlPrefixWrapper from "../input-control/input-prefix-wrapper";
|
|
9
|
+
import InputControlSuffixWrapper from "../input-control/input-suffix-wrapper";
|
|
8
10
|
import AngleCircle from "./angle-circle";
|
|
9
|
-
import { UnitText } from "./styles/angle-picker-control-styles";
|
|
10
11
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
12
|
function UnforwardedAnglePickerControl(props, ref) {
|
|
12
13
|
const {
|
|
@@ -24,10 +25,15 @@ function UnforwardedAnglePickerControl(props, ref) {
|
|
|
24
25
|
onChange(inputValue);
|
|
25
26
|
};
|
|
26
27
|
const classes = clsx("components-angle-picker-control", className);
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
const prefixOrSuffixProp = isRTL() ? {
|
|
29
|
+
prefix: /* @__PURE__ */ _jsx(InputControlPrefixWrapper, {
|
|
30
|
+
children: "\xB0"
|
|
31
|
+
})
|
|
32
|
+
} : {
|
|
33
|
+
suffix: /* @__PURE__ */ _jsx(InputControlSuffixWrapper, {
|
|
34
|
+
children: "\xB0"
|
|
35
|
+
})
|
|
36
|
+
};
|
|
31
37
|
return /* @__PURE__ */ _jsxs(Flex, {
|
|
32
38
|
...restProps,
|
|
33
39
|
ref,
|
|
@@ -44,8 +50,7 @@ function UnforwardedAnglePickerControl(props, ref) {
|
|
|
44
50
|
step: "1",
|
|
45
51
|
value,
|
|
46
52
|
spinControls: "none",
|
|
47
|
-
|
|
48
|
-
suffix: suffixedUnitText
|
|
53
|
+
...prefixOrSuffixProp
|
|
49
54
|
})
|
|
50
55
|
}), /* @__PURE__ */ _jsx(Spacer, {
|
|
51
56
|
marginBottom: "1",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/angle-picker-control/index.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\n\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { Flex, FlexBlock } from '../flex';\nimport { Spacer } from '../spacer';\nimport NumberControl from '../number-control';\nimport
|
|
5
|
-
"mappings": ";AAIA,OAAO,UAAU;AAKjB,SAAS,kBAAkB;AAC3B,SAAS,OAAO,UAAU;AAK1B,SAAS,MAAM,iBAAiB;AAChC,SAAS,cAAc;AACvB,OAAO,mBAAmB;AAC1B,OAAO,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\n\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { Flex, FlexBlock } from '../flex';\nimport { Spacer } from '../spacer';\nimport NumberControl from '../number-control';\nimport InputControlPrefixWrapper from '../input-control/input-prefix-wrapper';\nimport InputControlSuffixWrapper from '../input-control/input-suffix-wrapper';\nimport AngleCircle from './angle-circle';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction UnforwardedAnglePickerControl(props, ref) {\n const {\n className,\n label = __('Angle'),\n onChange,\n value,\n ...restProps\n } = props;\n const handleOnNumberChange = unprocessedValue => {\n if (onChange === undefined) {\n return;\n }\n const inputValue = unprocessedValue !== undefined && unprocessedValue !== '' ? parseInt(unprocessedValue, 10) : 0;\n onChange(inputValue);\n };\n const classes = clsx('components-angle-picker-control', className);\n\n // Override the default behavior and position the degree symbol to the\n // right of the number, regardless of the language direction.\n const prefixOrSuffixProp = isRTL() ? {\n prefix: /*#__PURE__*/_jsx(InputControlPrefixWrapper, {\n children: \"\\xB0\"\n })\n } : {\n suffix: /*#__PURE__*/_jsx(InputControlSuffixWrapper, {\n children: \"\\xB0\"\n })\n };\n return /*#__PURE__*/_jsxs(Flex, {\n ...restProps,\n ref: ref,\n className: classes,\n gap: 2,\n children: [/*#__PURE__*/_jsx(FlexBlock, {\n children: /*#__PURE__*/_jsx(NumberControl, {\n __next40pxDefaultSize: true,\n label: label,\n className: \"components-angle-picker-control__input-field\",\n max: 360,\n min: 0,\n onChange: handleOnNumberChange,\n step: \"1\",\n value: value,\n spinControls: \"none\",\n ...prefixOrSuffixProp\n })\n }), /*#__PURE__*/_jsx(Spacer, {\n marginBottom: \"1\",\n marginTop: \"auto\",\n children: /*#__PURE__*/_jsx(AngleCircle, {\n \"aria-hidden\": \"true\",\n value: value,\n onChange: onChange\n })\n })]\n });\n}\n\n/**\n * `AnglePickerControl` is a React component to render a UI that allows users to\n * pick an angle. Users can choose an angle in a visual UI with the mouse by\n * dragging an angle indicator inside a circle or by directly inserting the\n * desired angle in a text field.\n *\n * ```jsx\n * import { useState } from '@wordpress/element';\n * import { AnglePickerControl } from '@wordpress/components';\n *\n * function Example() {\n * const [ angle, setAngle ] = useState( 0 );\n * return (\n * <AnglePickerControl\n * value={ angle }\n * onChange={ setAngle }\n * />\n * );\n * }\n * ```\n */\nexport const AnglePickerControl = forwardRef(UnforwardedAnglePickerControl);\nexport default AnglePickerControl;"],
|
|
5
|
+
"mappings": ";AAIA,OAAO,UAAU;AAKjB,SAAS,kBAAkB;AAC3B,SAAS,OAAO,UAAU;AAK1B,SAAS,MAAM,iBAAiB;AAChC,SAAS,cAAc;AACvB,OAAO,mBAAmB;AAC1B,OAAO,+BAA+B;AACtC,OAAO,+BAA+B;AACtC,OAAO,iBAAiB;AACxB,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,SAAS,8BAA8B,OAAO,KAAK;AACjD,QAAM;AAAA,IACJ;AAAA,IACA,QAAQ,GAAG,OAAO;AAAA,IAClB;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AACJ,QAAM,uBAAuB,sBAAoB;AAC/C,QAAI,aAAa,QAAW;AAC1B;AAAA,IACF;AACA,UAAM,aAAa,qBAAqB,UAAa,qBAAqB,KAAK,SAAS,kBAAkB,EAAE,IAAI;AAChH,aAAS,UAAU;AAAA,EACrB;AACA,QAAM,UAAU,KAAK,mCAAmC,SAAS;AAIjE,QAAM,qBAAqB,MAAM,IAAI;AAAA,IACnC,QAAqB,qBAAK,2BAA2B;AAAA,MACnD,UAAU;AAAA,IACZ,CAAC;AAAA,EACH,IAAI;AAAA,IACF,QAAqB,qBAAK,2BAA2B;AAAA,MACnD,UAAU;AAAA,IACZ,CAAC;AAAA,EACH;AACA,SAAoB,sBAAM,MAAM;AAAA,IAC9B,GAAG;AAAA,IACH;AAAA,IACA,WAAW;AAAA,IACX,KAAK;AAAA,IACL,UAAU,CAAc,qBAAK,WAAW;AAAA,MACtC,UAAuB,qBAAK,eAAe;AAAA,QACzC,uBAAuB;AAAA,QACvB;AAAA,QACA,WAAW;AAAA,QACX,KAAK;AAAA,QACL,KAAK;AAAA,QACL,UAAU;AAAA,QACV,MAAM;AAAA,QACN;AAAA,QACA,cAAc;AAAA,QACd,GAAG;AAAA,MACL,CAAC;AAAA,IACH,CAAC,GAAgB,qBAAK,QAAQ;AAAA,MAC5B,cAAc;AAAA,MACd,WAAW;AAAA,MACX,UAAuB,qBAAK,aAAa;AAAA,QACvC,eAAe;AAAA,QACf;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH,CAAC,CAAC;AAAA,EACJ,CAAC;AACH;AAuBO,IAAM,qBAAqB,WAAW,6BAA6B;AAC1E,IAAO,+BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -112,7 +112,7 @@ function UnconnectedDropdownMenu(dropdownMenuProps) {
|
|
|
112
112
|
...mergedMenuProps,
|
|
113
113
|
role: "menu",
|
|
114
114
|
children: [isFunction(children) ? children(props) : null, controlSets?.flatMap((controlSet, indexOfSet) => controlSet.map((control, indexOfControl) => /* @__PURE__ */ _jsx(Button, {
|
|
115
|
-
|
|
115
|
+
size: "compact",
|
|
116
116
|
onClick: (event) => {
|
|
117
117
|
event.stopPropagation();
|
|
118
118
|
props.onClose();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/dropdown-menu/index.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { menu } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { contextConnectWithoutRef, useContextSystem } from '../context';\nimport Button from '../button';\nimport Dropdown from '../dropdown';\nimport { NavigableMenu } from '../navigable-container';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction mergeProps(defaultProps = {}, props = {}) {\n const mergedProps = {\n ...defaultProps,\n ...props\n };\n if (props.className && defaultProps.className) {\n mergedProps.className = clsx(props.className, defaultProps.className);\n }\n return mergedProps;\n}\nfunction isFunction(maybeFunc) {\n return typeof maybeFunc === 'function';\n}\nfunction UnconnectedDropdownMenu(dropdownMenuProps) {\n const {\n children,\n className,\n controls,\n icon = menu,\n label,\n popoverProps,\n toggleProps,\n menuProps,\n disableOpenOnArrowDown = false,\n text,\n noIcons,\n open,\n defaultOpen,\n onToggle: onToggleProp,\n // Context\n variant\n } = useContextSystem(dropdownMenuProps, 'DropdownMenu');\n if (!controls?.length && !isFunction(children)) {\n return null;\n }\n\n // Normalize controls to nested array of objects (sets of controls)\n let controlSets;\n if (controls?.length) {\n // @ts-expect-error The check below is needed because `DropdownMenus`\n // rendered by `ToolBarGroup` receive controls as a nested array.\n controlSets = controls;\n if (!Array.isArray(controlSets[0])) {\n // This is not ideal, but at this point we know that `controls` is\n // not a nested array, even if TypeScript doesn't.\n controlSets = [controls];\n }\n }\n const mergedPopoverProps = mergeProps({\n className: 'components-dropdown-menu__popover',\n variant\n }, popoverProps);\n return /*#__PURE__*/_jsx(Dropdown, {\n className: className,\n popoverProps: mergedPopoverProps,\n renderToggle: ({\n isOpen,\n onToggle\n }) => {\n var _toggleProps$showTool;\n const openOnArrowDown = event => {\n if (disableOpenOnArrowDown) {\n return;\n }\n if (!isOpen && event.code === 'ArrowDown') {\n event.preventDefault();\n onToggle();\n }\n };\n const {\n as: Toggle = Button,\n ...restToggleProps\n } = toggleProps !== null && toggleProps !== void 0 ? toggleProps : {};\n const mergedToggleProps = mergeProps({\n className: clsx('components-dropdown-menu__toggle', {\n 'is-opened': isOpen\n })\n }, restToggleProps);\n return /*#__PURE__*/_jsx(Toggle, {\n ...mergedToggleProps,\n icon: icon,\n onClick: event => {\n onToggle();\n if (mergedToggleProps.onClick) {\n mergedToggleProps.onClick(event);\n }\n },\n onKeyDown: event => {\n openOnArrowDown(event);\n if (mergedToggleProps.onKeyDown) {\n mergedToggleProps.onKeyDown(event);\n }\n },\n \"aria-haspopup\": \"true\",\n \"aria-expanded\": isOpen,\n label: label,\n text: text,\n showTooltip: (_toggleProps$showTool = toggleProps?.showTooltip) !== null && _toggleProps$showTool !== void 0 ? _toggleProps$showTool : true,\n children: mergedToggleProps.children\n });\n },\n renderContent: props => {\n const mergedMenuProps = mergeProps({\n 'aria-label': label,\n className: clsx('components-dropdown-menu__menu', {\n 'no-icons': noIcons\n })\n }, menuProps);\n return /*#__PURE__*/_jsxs(NavigableMenu, {\n ...mergedMenuProps,\n role: \"menu\",\n children: [isFunction(children) ? children(props) : null, controlSets?.flatMap((controlSet, indexOfSet) => controlSet.map((control, indexOfControl) => /*#__PURE__*/_jsx(Button, {\n
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,YAAY;AAKrB,SAAS,0BAA0B,wBAAwB;AAC3D,OAAO,YAAY;AACnB,OAAO,cAAc;AACrB,SAAS,qBAAqB;AAC9B,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,SAAS,WAAW,eAAe,CAAC,GAAG,QAAQ,CAAC,GAAG;AACjD,QAAM,cAAc;AAAA,IAClB,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACA,MAAI,MAAM,aAAa,aAAa,WAAW;AAC7C,gBAAY,YAAY,KAAK,MAAM,WAAW,aAAa,SAAS;AAAA,EACtE;AACA,SAAO;AACT;AACA,SAAS,WAAW,WAAW;AAC7B,SAAO,OAAO,cAAc;AAC9B;AACA,SAAS,wBAAwB,mBAAmB;AAClD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,yBAAyB;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA;AAAA,IAEV;AAAA,EACF,IAAI,iBAAiB,mBAAmB,cAAc;AACtD,MAAI,CAAC,UAAU,UAAU,CAAC,WAAW,QAAQ,GAAG;AAC9C,WAAO;AAAA,EACT;A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A,IACA,eAAe,WAAS;AACtB,YAAM,kBAAkB,WAAW;AAAA,QACjC,cAAc;AAAA,QACd,WAAW,KAAK,kCAAkC;AAAA,UAChD,YAAY;AAAA,QACd,CAAC;AAAA,MACH,GAAG,SAAS;AACZ,aAAoB,sBAAM,eAAe;AAAA,QACvC,GAAG;AAAA,QACH,MAAM;AAAA,QACN,UAAU,CAAC,WAAW,QAAQ,IAAI,SAAS,KAAK,IAAI,MAAM,aAAa,QAAQ,CAAC,YAAY,eAAe,WAAW,IAAI,CAAC,SAAS,mBAAgC,qBAAK,QAAQ;AAAA,UAC/K,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { menu } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { contextConnectWithoutRef, useContextSystem } from '../context';\nimport Button from '../button';\nimport Dropdown from '../dropdown';\nimport { NavigableMenu } from '../navigable-container';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction mergeProps(defaultProps = {}, props = {}) {\n const mergedProps = {\n ...defaultProps,\n ...props\n };\n if (props.className && defaultProps.className) {\n mergedProps.className = clsx(props.className, defaultProps.className);\n }\n return mergedProps;\n}\nfunction isFunction(maybeFunc) {\n return typeof maybeFunc === 'function';\n}\nfunction UnconnectedDropdownMenu(dropdownMenuProps) {\n const {\n children,\n className,\n controls,\n icon = menu,\n label,\n popoverProps,\n toggleProps,\n menuProps,\n disableOpenOnArrowDown = false,\n text,\n noIcons,\n open,\n defaultOpen,\n onToggle: onToggleProp,\n // Context\n variant\n } = useContextSystem(dropdownMenuProps, 'DropdownMenu');\n if (!controls?.length && !isFunction(children)) {\n return null;\n }\n\n // Normalize controls to nested array of objects (sets of controls)\n let controlSets;\n if (controls?.length) {\n // @ts-expect-error The check below is needed because `DropdownMenus`\n // rendered by `ToolBarGroup` receive controls as a nested array.\n controlSets = controls;\n if (!Array.isArray(controlSets[0])) {\n // This is not ideal, but at this point we know that `controls` is\n // not a nested array, even if TypeScript doesn't.\n controlSets = [controls];\n }\n }\n const mergedPopoverProps = mergeProps({\n className: 'components-dropdown-menu__popover',\n variant\n }, popoverProps);\n return /*#__PURE__*/_jsx(Dropdown, {\n className: className,\n popoverProps: mergedPopoverProps,\n renderToggle: ({\n isOpen,\n onToggle\n }) => {\n var _toggleProps$showTool;\n const openOnArrowDown = event => {\n if (disableOpenOnArrowDown) {\n return;\n }\n if (!isOpen && event.code === 'ArrowDown') {\n event.preventDefault();\n onToggle();\n }\n };\n const {\n as: Toggle = Button,\n ...restToggleProps\n } = toggleProps !== null && toggleProps !== void 0 ? toggleProps : {};\n const mergedToggleProps = mergeProps({\n className: clsx('components-dropdown-menu__toggle', {\n 'is-opened': isOpen\n })\n }, restToggleProps);\n return /*#__PURE__*/_jsx(Toggle, {\n ...mergedToggleProps,\n icon: icon,\n onClick: event => {\n onToggle();\n if (mergedToggleProps.onClick) {\n mergedToggleProps.onClick(event);\n }\n },\n onKeyDown: event => {\n openOnArrowDown(event);\n if (mergedToggleProps.onKeyDown) {\n mergedToggleProps.onKeyDown(event);\n }\n },\n \"aria-haspopup\": \"true\",\n \"aria-expanded\": isOpen,\n label: label,\n text: text,\n showTooltip: (_toggleProps$showTool = toggleProps?.showTooltip) !== null && _toggleProps$showTool !== void 0 ? _toggleProps$showTool : true,\n children: mergedToggleProps.children\n });\n },\n renderContent: props => {\n const mergedMenuProps = mergeProps({\n 'aria-label': label,\n className: clsx('components-dropdown-menu__menu', {\n 'no-icons': noIcons\n })\n }, menuProps);\n return /*#__PURE__*/_jsxs(NavigableMenu, {\n ...mergedMenuProps,\n role: \"menu\",\n children: [isFunction(children) ? children(props) : null, controlSets?.flatMap((controlSet, indexOfSet) => controlSet.map((control, indexOfControl) => /*#__PURE__*/_jsx(Button, {\n size: \"compact\",\n onClick: event => {\n event.stopPropagation();\n props.onClose();\n if (control.onClick) {\n control.onClick();\n }\n },\n className: clsx('components-dropdown-menu__menu-item', {\n 'has-separator': indexOfSet > 0 && indexOfControl === 0,\n 'is-active': control.isActive,\n 'is-icon-only': !control.title\n }),\n icon: control.icon,\n label: control.label,\n \"aria-checked\": control.role === 'menuitemcheckbox' || control.role === 'menuitemradio' ? control.isActive : undefined,\n role: control.role === 'menuitemcheckbox' || control.role === 'menuitemradio' ? control.role : 'menuitem',\n accessibleWhenDisabled: true,\n disabled: control.isDisabled,\n children: control.title\n }, [indexOfSet, indexOfControl].join())))]\n });\n },\n open: open,\n defaultOpen: defaultOpen,\n onToggle: onToggleProp\n });\n}\n\n/**\n *\n * The DropdownMenu displays a list of actions (each contained in a MenuItem,\n * MenuItemsChoice, or MenuGroup) in a compact way. It appears in a Popover\n * after the user has interacted with an element (a button or icon) or when\n * they perform a specific action.\n *\n * Render a Dropdown Menu with a set of controls:\n *\n * ```jsx\n * import { DropdownMenu } from '@wordpress/components';\n * import {\n * \tmore,\n * \tarrowLeft,\n * \tarrowRight,\n * \tarrowUp,\n * \tarrowDown,\n * } from '@wordpress/icons';\n *\n * const MyDropdownMenu = () => (\n * \t<DropdownMenu\n * \t\ticon={ more }\n * \t\tlabel=\"Select a direction\"\n * \t\tcontrols={ [\n * \t\t\t{\n * \t\t\t\ttitle: 'Up',\n * \t\t\t\ticon: arrowUp,\n * \t\t\t\tonClick: () => console.log( 'up' ),\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\ttitle: 'Right',\n * \t\t\t\ticon: arrowRight,\n * \t\t\t\tonClick: () => console.log( 'right' ),\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\ttitle: 'Down',\n * \t\t\t\ticon: arrowDown,\n * \t\t\t\tonClick: () => console.log( 'down' ),\n * \t\t\t},\n * \t\t\t{\n * \t\t\t\ttitle: 'Left',\n * \t\t\t\ticon: arrowLeft,\n * \t\t\t\tonClick: () => console.log( 'left' ),\n * \t\t\t},\n * \t\t] }\n * \t/>\n * );\n * ```\n *\n * Alternatively, specify a `children` function which returns elements valid for\n * use in a DropdownMenu: `MenuItem`, `MenuItemsChoice`, or `MenuGroup`.\n *\n * ```jsx\n * import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\n * import { more, arrowUp, arrowDown, trash } from '@wordpress/icons';\n *\n * const MyDropdownMenu = () => (\n * \t<DropdownMenu icon={ more } label=\"Select a direction\">\n * \t\t{ ( { onClose } ) => (\n * \t\t\t<>\n * \t\t\t\t<MenuGroup>\n * \t\t\t\t\t<MenuItem icon={ arrowUp } onClick={ onClose }>\n * \t\t\t\t\t\tMove Up\n * \t\t\t\t\t</MenuItem>\n * \t\t\t\t\t<MenuItem icon={ arrowDown } onClick={ onClose }>\n * \t\t\t\t\t\tMove Down\n * \t\t\t\t\t</MenuItem>\n * \t\t\t\t</MenuGroup>\n * \t\t\t\t<MenuGroup>\n * \t\t\t\t\t<MenuItem icon={ trash } onClick={ onClose }>\n * \t\t\t\t\t\tRemove\n * \t\t\t\t\t</MenuItem>\n * \t\t\t\t</MenuGroup>\n * \t\t\t</>\n * \t\t) }\n * \t</DropdownMenu>\n * );\n * ```\n *\n */\nexport const DropdownMenu = contextConnectWithoutRef(UnconnectedDropdownMenu, 'DropdownMenu');\nexport default DropdownMenu;"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB,SAAS,YAAY;AAKrB,SAAS,0BAA0B,wBAAwB;AAC3D,OAAO,YAAY;AACnB,OAAO,cAAc;AACrB,SAAS,qBAAqB;AAC9B,SAAS,OAAO,MAAM,QAAQ,aAAa;AAC3C,SAAS,WAAW,eAAe,CAAC,GAAG,QAAQ,CAAC,GAAG;AACjD,QAAM,cAAc;AAAA,IAClB,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACA,MAAI,MAAM,aAAa,aAAa,WAAW;AAC7C,gBAAY,YAAY,KAAK,MAAM,WAAW,aAAa,SAAS;AAAA,EACtE;AACA,SAAO;AACT;AACA,SAAS,WAAW,WAAW;AAC7B,SAAO,OAAO,cAAc;AAC9B;AACA,SAAS,wBAAwB,mBAA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