itmar-block-packages 1.3.1 → 1.3.4

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/src/BlockPlace.js CHANGED
@@ -1,5 +1,5 @@
1
- import { __ } from '@wordpress/i18n';
2
- import { useState, useEffect } from '@wordpress/element';
1
+ import { __ } from "@wordpress/i18n";
2
+ import { useState, useEffect } from "@wordpress/element";
3
3
 
4
4
  import {
5
5
  Button,
@@ -12,56 +12,63 @@ import {
12
12
  ToolbarItem,
13
13
  RangeControl,
14
14
  RadioControl,
15
- Modal
16
- } from '@wordpress/components';
17
- import { group, stack, layout, justifyCenter, justifyLeft, justifyRight, justifySpaceBetween, justifyStretch, stretchWide, positionCenter } from '@wordpress/icons';
15
+ ToggleControl,
16
+ Modal,
17
+ } from "@wordpress/components";
18
+ import {
19
+ group,
20
+ stack,
21
+ layout,
22
+ justifyCenter,
23
+ justifyLeft,
24
+ justifyRight,
25
+ justifySpaceBetween,
26
+ justifyStretch,
27
+ stretchWide,
28
+ positionCenter,
29
+ } from "@wordpress/icons";
18
30
  import GridControls from "./GridControls";
19
31
 
20
-
21
32
  //横並びのアイコン
22
- const flex = <Icon icon={stack} className="rotate-icon" />
33
+ const flex = <Icon icon={stack} className="rotate-icon" />;
23
34
  //上よせアイコン
24
- const upper = <Icon icon={justifyLeft} className="rotate-icon" />
35
+ const upper = <Icon icon={justifyLeft} className="rotate-icon" />;
25
36
  //中央よせのアイコン
26
- const middle = <Icon icon={justifyCenter} className="rotate-icon" />
37
+ const middle = <Icon icon={justifyCenter} className="rotate-icon" />;
27
38
  //下よせのアイコン
28
- const lower = <Icon icon={justifyRight} className="rotate-icon" />
39
+ const lower = <Icon icon={justifyRight} className="rotate-icon" />;
29
40
  //上下一杯に伸ばすアイコン
30
- const vert_between = <Icon icon={justifyStretch} className="rotate-icon" />
41
+ const vert_between = <Icon icon={justifyStretch} className="rotate-icon" />;
31
42
  //上下均等に伸ばすアイコン
32
- const vert_around = <Icon icon={justifySpaceBetween} className="rotate-icon" />
43
+ const vert_around = <Icon icon={justifySpaceBetween} className="rotate-icon" />;
33
44
 
34
45
  export default function BlockPlace(props) {
35
-
36
- const {
37
- attributes,
38
- clientId,
39
- blockRef,
40
- isMobile,
41
- isSubmenu
42
- } = props;
43
- const {
44
- positionType,
45
- heightValue,
46
- default_pos,
47
- mobile_pos
48
- } = attributes;
46
+ const { attributes, clientId, blockRef, isMobile, isSubmenu } = props;
47
+ const { positionType, default_pos, mobile_pos } = attributes;
49
48
 
50
49
  //モバイルかデスクトップか
51
- const sel_pos = isMobile ? mobile_pos : default_pos
50
+ const sel_pos = isMobile ? mobile_pos : default_pos;
52
51
 
53
52
  //配置アイコンの選択
54
- const start_icon = sel_pos.direction === 'vertical' ? upper : justifyLeft;
55
- const center_icon = sel_pos.direction === 'vertical' ? middle : justifyCenter;
56
- const end_icon = sel_pos.direction === 'vertical' ? lower : justifyRight;
57
- const between_icon = sel_pos.direction === 'vertical' ? vert_between : justifyStretch;
58
- const around_icon = sel_pos.direction === 'vertical' ? vert_around : justifySpaceBetween;
53
+ const start_icon = sel_pos.direction === "vertical" ? upper : justifyLeft;
54
+ const center_icon = sel_pos.direction === "vertical" ? middle : justifyCenter;
55
+ const end_icon = sel_pos.direction === "vertical" ? lower : justifyRight;
56
+ const between_icon =
57
+ sel_pos.direction === "vertical" ? vert_between : justifyStretch;
58
+ const around_icon =
59
+ sel_pos.direction === "vertical" ? vert_around : justifySpaceBetween;
59
60
  //ツールチップの選択
60
- const start_tip = sel_pos.direction === 'vertical' ? __('upper alignment', 'block-collections') : __('left alignment', 'block-collections');
61
- const end_tip = sel_pos.direction === 'vertical' ? __('lower alignment', 'block-collections') : __('right alignment', 'block-collections');
61
+ const start_tip =
62
+ sel_pos.direction === "vertical"
63
+ ? __("upper alignment", "block-collections")
64
+ : __("left alignment", "block-collections");
65
+ const end_tip =
66
+ sel_pos.direction === "vertical"
67
+ ? __("lower alignment", "block-collections")
68
+ : __("right alignment", "block-collections");
62
69
 
63
70
  const [isContainer, setIsContainer] = useState(false);
64
- const [direction, setDirection] = useState('row');
71
+ const [direction, setDirection] = useState("row");
65
72
  useEffect(() => {
66
73
  if (blockRef.current) {
67
74
  const element = blockRef.current;
@@ -69,130 +76,157 @@ export default function BlockPlace(props) {
69
76
  const grandparentElement = parentElement?.parentElement;
70
77
  const computedStyle = getComputedStyle(grandparentElement);
71
78
  //親要素がFlex又はGridコンテナか
72
- if (computedStyle.display === "flex" || computedStyle.display === "inline-flex" || computedStyle.display === "grid" || computedStyle.display === "inline-grid") {
73
- setIsContainer(true)
79
+ if (
80
+ computedStyle.display === "flex" ||
81
+ computedStyle.display === "inline-flex" ||
82
+ computedStyle.display === "grid" ||
83
+ computedStyle.display === "inline-grid"
84
+ ) {
85
+ setIsContainer(true);
74
86
  }
75
87
  //flexの時その方向
76
- if (computedStyle.display === "flex" || computedStyle.display === "inline-flex") {
88
+ if (
89
+ computedStyle.display === "flex" ||
90
+ computedStyle.display === "inline-flex"
91
+ ) {
77
92
  if (computedStyle.flexDirection === "row") {
78
- setDirection('row');
93
+ setDirection("row");
79
94
  } else {
80
- setDirection('column');
95
+ setDirection("column");
81
96
  }
82
-
83
97
  }
84
98
  }
85
99
  }, []);
86
100
 
87
-
88
-
89
101
  //GridModalを開く
90
102
  const [isGridModalOpen, setIsGridModalOpen] = useState(false);
91
103
  const openGridModal = () => setIsGridModalOpen(true);
92
104
  const closeGridModal = () => setIsGridModalOpen(false);
93
105
 
94
106
  // 翻訳が必要な文字列を直接指定
95
- const blockMaxWidthMobile = __('Block Max Width(Mobile)', 'block-collections');
96
- const blockWidthMobile = __('Block Width(Mobile)', 'block-collections');
97
- const blockMaxWidthDesktop = __('Block Max Width(DeskTop)', 'block-collections');
98
- const blockWidthDesktop = __('Block Width(DeskTop)', 'block-collections');
107
+ const blockMaxWidthMobile = __(
108
+ "Block Max Width(Mobile)",
109
+ "block-collections"
110
+ );
111
+ const blockWidthMobile = __("Block Width(Mobile)", "block-collections");
112
+ const blockMaxWidthDesktop = __(
113
+ "Block Max Width(DeskTop)",
114
+ "block-collections"
115
+ );
116
+ const blockWidthDesktop = __("Block Width(DeskTop)", "block-collections");
99
117
 
100
118
  // 条件に応じて選択
101
119
  const blockWidthLabel = isMobile
102
- ? (isSubmenu ? blockWidthMobile : blockMaxWidthMobile)
103
- : (isSubmenu ? blockWidthDesktop : blockMaxWidthDesktop);
104
-
120
+ ? isSubmenu
121
+ ? blockWidthMobile
122
+ : blockMaxWidthMobile
123
+ : isSubmenu
124
+ ? blockWidthDesktop
125
+ : blockMaxWidthDesktop;
105
126
 
106
127
  return (
107
128
  <>
108
129
  <PanelBody
109
- title={__("Block placement", 'block-collections')}
130
+ title={__("Block placement", "block-collections")}
110
131
  initialOpen={false}
111
- className='itmar_group_direction'
132
+ className="itmar_group_direction"
112
133
  >
113
- {isMobile ?
114
- <p>{__('InnerBlock direction(Mobile)', 'block-collections')}</p>
115
- :
116
- <p>{__('InnerBlock direction(DeskTop)', 'block-collections')}</p>
117
- }
134
+ {isMobile ? (
135
+ <p>{__("InnerBlock direction(Mobile)", "block-collections")}</p>
136
+ ) : (
137
+ <p>{__("InnerBlock direction(DeskTop)", "block-collections")}</p>
138
+ )}
118
139
 
119
140
  <ToolbarGroup>
120
141
  <ToolbarItem>
121
142
  {(itemProps) => (
122
- <Button {...itemProps}
123
- isPressed={sel_pos.direction === 'block'}
124
- onClick={() => props.onDirectionChange('block')}
143
+ <Button
144
+ {...itemProps}
145
+ isPressed={sel_pos.direction === "block"}
146
+ onClick={() => props.onDirectionChange("block")}
125
147
  icon={group}
126
- label={__('block', 'block-collections')}
148
+ label={__("block", "block-collections")}
127
149
  />
128
-
129
150
  )}
130
151
  </ToolbarItem>
131
152
  <ToolbarItem>
132
153
  {(itemProps) => (
133
- <Button {...itemProps}
134
- isPressed={sel_pos.direction === 'vertical'}
135
- onClick={() => props.onDirectionChange('vertical')}
154
+ <Button
155
+ {...itemProps}
156
+ isPressed={sel_pos.direction === "vertical"}
157
+ onClick={() => props.onDirectionChange("vertical")}
136
158
  icon={stack}
137
- label={__('virtical', 'block-collections')}
159
+ label={__("virtical", "block-collections")}
138
160
  />
139
161
  )}
140
162
  </ToolbarItem>
141
163
  <ToolbarItem>
142
164
  {(itemProps) => (
143
- <Button {...itemProps}
144
- isPressed={sel_pos.direction === 'horizen'}
145
- onClick={() => props.onDirectionChange('horizen')}
165
+ <Button
166
+ {...itemProps}
167
+ isPressed={sel_pos.direction === "horizen"}
168
+ onClick={() => props.onDirectionChange("horizen")}
146
169
  icon={flex}
147
- label={__('horizen', 'block-collections')}
170
+ label={__("horizen", "block-collections")}
148
171
  />
149
172
  )}
150
173
  </ToolbarItem>
151
174
  <ToolbarItem>
152
175
  {(itemProps) => (
153
- <Button {...itemProps}
154
- isPressed={sel_pos.direction === 'grid'}
155
- onClick={() => props.onDirectionChange('grid')}
176
+ <Button
177
+ {...itemProps}
178
+ isPressed={sel_pos.direction === "grid"}
179
+ onClick={() => props.onDirectionChange("grid")}
156
180
  icon={layout}
157
- label={__('grid', 'block-collections')}
181
+ label={__("grid", "block-collections")}
158
182
  />
159
183
  )}
160
184
  </ToolbarItem>
161
185
  </ToolbarGroup>
162
- {(sel_pos.direction !== 'block' && sel_pos.direction !== 'grid') &&
186
+ {(sel_pos.direction === "horizen" ||
187
+ sel_pos.direction === "vertical") && (
188
+ <ToggleControl
189
+ label={__("reverse", "block-collections")}
190
+ checked={sel_pos.reverse}
191
+ onChange={(checked) => props.onReverseChange(checked)}
192
+ />
193
+ )}
194
+ {sel_pos.direction !== "block" && sel_pos.direction !== "grid" && (
163
195
  <>
164
- {isMobile ?
165
- <p>{__('InnerBlock alignment(Mobile)', 'block-collections')}</p>
166
- :
167
- <p>{__('InnerBlock alignment(DeskTop)', 'block-collections')}</p>
168
- }
196
+ {isMobile ? (
197
+ <p>{__("InnerBlock alignment(Mobile)", "block-collections")}</p>
198
+ ) : (
199
+ <p>{__("InnerBlock alignment(DeskTop)", "block-collections")}</p>
200
+ )}
169
201
  <ToolbarGroup>
170
202
  <ToolbarItem>
171
203
  {(itemProps) => (
172
- <Button {...itemProps}
173
- isPressed={sel_pos.inner_align === 'flex-start'}
174
- onClick={() => props.onFlexChange('flex-start')}//親コンポーネントに通知
204
+ <Button
205
+ {...itemProps}
206
+ isPressed={sel_pos.inner_align === "flex-start"}
207
+ onClick={() => props.onFlexChange("flex-start")} //親コンポーネントに通知
175
208
  icon={start_icon}
176
209
  label={start_tip}
177
210
  />
178
-
179
211
  )}
180
212
  </ToolbarItem>
181
213
  <ToolbarItem>
182
214
  {(itemProps) => (
183
- <Button {...itemProps}
184
- isPressed={sel_pos.inner_align === 'center'}
185
- onClick={() => props.onFlexChange('center')}//親コンポーネントに通知
215
+ <Button
216
+ {...itemProps}
217
+ isPressed={sel_pos.inner_align === "center"}
218
+ onClick={() => props.onFlexChange("center")} //親コンポーネントに通知
186
219
  icon={center_icon}
187
- label={__('center alignment', 'block-collections')}
220
+ label={__("center alignment", "block-collections")}
188
221
  />
189
222
  )}
190
223
  </ToolbarItem>
191
224
  <ToolbarItem>
192
225
  {(itemProps) => (
193
- <Button {...itemProps}
194
- isPressed={sel_pos.inner_align === 'flex-end'}
195
- onClick={() => props.onFlexChange('flex-end')}//親コンポーネントに通知
226
+ <Button
227
+ {...itemProps}
228
+ isPressed={sel_pos.inner_align === "flex-end"}
229
+ onClick={() => props.onFlexChange("flex-end")} //親コンポーネントに通知
196
230
  icon={end_icon}
197
231
  label={end_tip}
198
232
  />
@@ -200,222 +234,252 @@ export default function BlockPlace(props) {
200
234
  </ToolbarItem>
201
235
  <ToolbarItem>
202
236
  {(itemProps) => (
203
- <Button {...itemProps}
204
- isPressed={sel_pos.inner_align === 'space-between'}
205
- onClick={() => props.onFlexChange('space-between')}//親コンポーネントに通知
237
+ <Button
238
+ {...itemProps}
239
+ isPressed={sel_pos.inner_align === "space-between"}
240
+ onClick={() => props.onFlexChange("space-between")} //親コンポーネントに通知
206
241
  icon={between_icon}
207
- label={__('beteen stretch', 'block-collections')}
242
+ label={__("beteen stretch", "block-collections")}
208
243
  />
209
-
210
244
  )}
211
245
  </ToolbarItem>
212
246
  <ToolbarItem>
213
247
  {(itemProps) => (
214
- <Button {...itemProps}
215
- isPressed={sel_pos.inner_align === 'space-around'}
216
- onClick={() => props.onFlexChange('space-around')}//親コンポーネントに通知
248
+ <Button
249
+ {...itemProps}
250
+ isPressed={sel_pos.inner_align === "space-around"}
251
+ onClick={() => props.onFlexChange("space-around")} //親コンポーネントに通知
217
252
  icon={around_icon}
218
- label={__('around stretch', 'block-collections')}
253
+ label={__("around stretch", "block-collections")}
219
254
  />
220
-
221
255
  )}
222
256
  </ToolbarItem>
223
257
  </ToolbarGroup>
224
258
  </>
225
- }
226
-
227
- {(!isContainer && !isSubmenu) && (
228
- isMobile ?
229
- <p>{__('Block alignment(Mobile)', 'block-collections')}</p>
230
- :
231
- <p>{__('Block alignment(DeskTop)', 'block-collections')}</p>
232
259
  )}
233
260
 
234
- {(!isContainer && !isSubmenu) &&
261
+ {!isContainer &&
262
+ !isSubmenu &&
263
+ (isMobile ? (
264
+ <p>{__("Block alignment(Mobile)", "block-collections")}</p>
265
+ ) : (
266
+ <p>{__("Block alignment(DeskTop)", "block-collections")}</p>
267
+ ))}
268
+
269
+ {!isContainer && !isSubmenu && (
235
270
  <ToolbarGroup>
236
271
  <ToolbarItem>
237
272
  {(itemProps) => (
238
- <Button {...itemProps}
239
- isPressed={sel_pos.outer_align === 'left'}
240
- onClick={() => props.onAlignChange('left')}
273
+ <Button
274
+ {...itemProps}
275
+ isPressed={sel_pos.outer_align === "left"}
276
+ onClick={() => props.onAlignChange("left")}
241
277
  icon={justifyLeft}
242
- label={__('left alignment', 'block-collections')}
278
+ label={__("left alignment", "block-collections")}
243
279
  />
244
-
245
280
  )}
246
281
  </ToolbarItem>
247
282
  <ToolbarItem>
248
283
  {(itemProps) => (
249
- <Button {...itemProps}
250
- isPressed={sel_pos.outer_align === 'center'}
251
- onClick={() => props.onAlignChange('center')}
284
+ <Button
285
+ {...itemProps}
286
+ isPressed={sel_pos.outer_align === "center"}
287
+ onClick={() => props.onAlignChange("center")}
252
288
  icon={justifyCenter}
253
- label={__('center alignment', 'block-collections')}
289
+ label={__("center alignment", "block-collections")}
254
290
  />
255
291
  )}
256
292
  </ToolbarItem>
257
293
  <ToolbarItem>
258
294
  {(itemProps) => (
259
- <Button {...itemProps}
260
- isPressed={sel_pos.outer_align === 'right'}
261
- onClick={() => props.onAlignChange('right')}
295
+ <Button
296
+ {...itemProps}
297
+ isPressed={sel_pos.outer_align === "right"}
298
+ onClick={() => props.onAlignChange("right")}
262
299
  icon={justifyRight}
263
- label={__('right alignment', 'block-collections')}
300
+ label={__("right alignment", "block-collections")}
264
301
  />
265
302
  )}
266
303
  </ToolbarItem>
267
-
268
304
  </ToolbarGroup>
269
- }
270
- {isContainer &&
305
+ )}
306
+ {isContainer && (
271
307
  <>
272
- {isMobile ?
273
- <p>{__('Block alignment(Mobile)', 'block-collections')}</p>
274
- :
275
- <p>{__('Block alignment(DeskTop)', 'block-collections')}</p>
276
- }
308
+ {isMobile ? (
309
+ <p>{__("Block alignment(Mobile)", "block-collections")}</p>
310
+ ) : (
311
+ <p>{__("Block alignment(DeskTop)", "block-collections")}</p>
312
+ )}
277
313
 
278
314
  <ToolbarGroup>
279
315
  <ToolbarItem>
280
316
  {(itemProps) => (
281
- <Button {...itemProps}
282
- isPressed={sel_pos.outer_vertical === 'self-start'}
283
- onClick={() => props.onVerticalChange('self-start')}
284
- icon={direction === 'row' ? upper : justifyLeft}
285
- label={__('upper alignment', 'block-collections')}
317
+ <Button
318
+ {...itemProps}
319
+ isPressed={sel_pos.outer_vertical === "self-start"}
320
+ onClick={() => props.onVerticalChange("self-start")}
321
+ icon={direction === "row" ? upper : justifyLeft}
322
+ label={__("upper alignment", "block-collections")}
286
323
  />
287
-
288
324
  )}
289
325
  </ToolbarItem>
290
326
  <ToolbarItem>
291
327
  {(itemProps) => (
292
- <Button {...itemProps}
293
- isPressed={sel_pos.outer_vertical === 'center'}
294
- onClick={() => props.onVerticalChange('center')}
295
- icon={direction === 'row' ? middle : justifyCenter}
296
- label={__('center alignment', 'block-collections')}
328
+ <Button
329
+ {...itemProps}
330
+ isPressed={sel_pos.outer_vertical === "center"}
331
+ onClick={() => props.onVerticalChange("center")}
332
+ icon={direction === "row" ? middle : justifyCenter}
333
+ label={__("center alignment", "block-collections")}
297
334
  />
298
335
  )}
299
336
  </ToolbarItem>
300
337
  <ToolbarItem>
301
338
  {(itemProps) => (
302
- <Button {...itemProps}
303
- isPressed={sel_pos.outer_vertical === 'self-end'}
304
- onClick={() => props.onVerticalChange('self-end')}
305
- icon={direction === 'row' ? lower : justifyRight}
306
- label={__('lower alignment', 'block-collections')}
339
+ <Button
340
+ {...itemProps}
341
+ isPressed={sel_pos.outer_vertical === "self-end"}
342
+ onClick={() => props.onVerticalChange("self-end")}
343
+ icon={direction === "row" ? lower : justifyRight}
344
+ label={__("lower alignment", "block-collections")}
307
345
  />
308
346
  )}
309
347
  </ToolbarItem>
310
-
311
348
  </ToolbarGroup>
312
349
  </>
313
- }
350
+ )}
314
351
 
315
352
  <p>{blockWidthLabel}</p>
316
353
  <ToolbarGroup>
317
354
  <ToolbarItem>
318
355
  {(itemProps) => (
319
- <Button {...itemProps}
320
- isPressed={sel_pos.width_val === 'full'}
321
- onClick={() => props.onWidthChange('full')}
322
- text='full'
356
+ <Button
357
+ {...itemProps}
358
+ isPressed={sel_pos.width_val === "full"}
359
+ onClick={() => props.onWidthChange("full")}
360
+ text="full"
323
361
  />
324
-
325
362
  )}
326
363
  </ToolbarItem>
327
364
  <ToolbarItem>
328
365
  {(itemProps) => (
329
- <Button {...itemProps}
330
- isPressed={sel_pos.width_val === 'fit'}
331
- onClick={() => props.onWidthChange('fit')}
332
- text='fit'
366
+ <Button
367
+ {...itemProps}
368
+ isPressed={sel_pos.width_val === "fit"}
369
+ onClick={() => props.onWidthChange("fit")}
370
+ text="fit"
333
371
  />
334
-
335
372
  )}
336
373
  </ToolbarItem>
337
374
  <ToolbarItem>
338
375
  {(itemProps) => (
339
- <Button {...itemProps}
340
- isPressed={sel_pos.width_val === 'wideSize'}
341
- onClick={() => props.onWidthChange('wideSize')}
376
+ <Button
377
+ {...itemProps}
378
+ isPressed={sel_pos.width_val === "wideSize"}
379
+ onClick={() => props.onWidthChange("wideSize")}
342
380
  icon={stretchWide}
343
- label={__('Wide Size', 'block-collections')}
381
+ label={__("Wide Size", "block-collections")}
344
382
  />
345
-
346
383
  )}
347
384
  </ToolbarItem>
348
385
  <ToolbarItem>
349
386
  {(itemProps) => (
350
- <Button {...itemProps}
351
- isPressed={sel_pos.width_val === 'contentSize'}
352
- onClick={() => props.onWidthChange('contentSize')}
387
+ <Button
388
+ {...itemProps}
389
+ isPressed={sel_pos.width_val === "contentSize"}
390
+ onClick={() => props.onWidthChange("contentSize")}
353
391
  icon={positionCenter}
354
- label={__('Content Size', 'block-collections')}
392
+ label={__("Content Size", "block-collections")}
355
393
  />
356
-
357
394
  )}
358
395
  </ToolbarItem>
359
396
  <ToolbarItem>
360
397
  {(itemProps) => (
361
- <Button {...itemProps}
362
- isPressed={sel_pos.width_val === 'free'}
363
- onClick={() => props.onWidthChange('free')}
364
- text='free'
398
+ <Button
399
+ {...itemProps}
400
+ isPressed={sel_pos.width_val === "free"}
401
+ onClick={() => props.onWidthChange("free")}
402
+ text="free"
365
403
  />
366
-
367
404
  )}
368
405
  </ToolbarItem>
369
-
370
406
  </ToolbarGroup>
371
407
 
372
- {sel_pos.width_val === 'free' &&
408
+ {sel_pos.width_val === "free" && (
373
409
  <RangeControl
374
- value={sel_pos.free_val}
375
- label={__("Max width", 'block-collections')}
410
+ value={sel_pos.free_width}
411
+ label={__("Max width", "block-collections")}
376
412
  max={1800}
377
413
  min={300}
378
414
  step={10}
379
415
  onChange={(newValue) => {
380
- props.onFreevalChange(newValue)
416
+ props.onFreeWidthChange(newValue);
381
417
  }}
382
418
  withInputField={true}
383
419
  />
384
- }
420
+ )}
385
421
 
386
- <p>{__('Block Height', 'block-collections')}</p>
422
+ {isMobile ? (
423
+ <p>{__("Block Height(Mobile)", "block-collections")}</p>
424
+ ) : (
425
+ <p>{__("Block Height(DeskTop)", "block-collections")}</p>
426
+ )}
387
427
  <ToolbarGroup>
388
428
  <ToolbarItem>
389
429
  {(itemProps) => (
390
- <Button {...itemProps}
391
- isPressed={heightValue === 'full'}
392
- onClick={() => props.onHeightChange('full')}
393
- text='full'
430
+ <Button
431
+ {...itemProps}
432
+ isPressed={sel_pos.height_val === "full"}
433
+ onClick={() => props.onHeightChange("full")}
434
+ text="full"
394
435
  />
395
-
396
436
  )}
397
437
  </ToolbarItem>
398
438
  <ToolbarItem>
399
439
  {(itemProps) => (
400
- <Button {...itemProps}
401
- isPressed={heightValue === 'fit'}
402
- onClick={() => props.onHeightChange('fit')}
403
- text='fit'
440
+ <Button
441
+ {...itemProps}
442
+ isPressed={sel_pos.height_val === "fit"}
443
+ onClick={() => props.onHeightChange("fit")}
444
+ text="fit"
404
445
  />
405
-
406
446
  )}
407
447
  </ToolbarItem>
448
+ <ToolbarItem>
449
+ {(itemProps) => (
450
+ <Button
451
+ {...itemProps}
452
+ isPressed={sel_pos.height_val === "free"}
453
+ onClick={() => props.onHeightChange("free")}
454
+ text="fit"
455
+ />
456
+ )}
457
+ </ToolbarItem>
458
+
459
+ {sel_pos.height_val === "free" && (
460
+ <RangeControl
461
+ value={sel_pos.free_height}
462
+ label={__("Height", "block-collections")}
463
+ max={1800}
464
+ min={300}
465
+ step={10}
466
+ onChange={(newValue) => {
467
+ props.onFreeHeightChange(newValue);
468
+ }}
469
+ withInputField={true}
470
+ />
471
+ )}
408
472
  </ToolbarGroup>
409
473
 
410
- {sel_pos.direction === 'grid' &&
474
+ {sel_pos.direction === "grid" && (
411
475
  <>
412
- {isMobile ?
413
- <p>{__('Grid Info settings(Mobile)', 'block-collections')}</p>
414
- :
415
- <p>{__('Grid Info settings(DeskTop)', 'block-collections')}</p>
416
- }
476
+ {isMobile ? (
477
+ <p>{__("Grid Info settings(Mobile)", "block-collections")}</p>
478
+ ) : (
479
+ <p>{__("Grid Info settings(DeskTop)", "block-collections")}</p>
480
+ )}
417
481
  <Button variant="primary" onClick={openGridModal}>
418
- {__("Open Setting Modal", 'block-collections')}
482
+ {__("Open Setting Modal", "block-collections")}
419
483
  </Button>
420
484
  {isGridModalOpen && (
421
485
  <Modal title="Grid Info settings" onRequestClose={closeGridModal}>
@@ -423,96 +487,97 @@ export default function BlockPlace(props) {
423
487
  attributes={sel_pos.grid_info}
424
488
  clientId={clientId}
425
489
  onChange={(newValue) => {
426
- props.onGridChange(newValue)
490
+ props.onGridChange(newValue);
427
491
  }}
428
492
  />
429
493
  </Modal>
430
494
  )}
431
495
  </>
432
- }
433
- <div className='itmar_title_type'>
496
+ )}
497
+ <div className="itmar_title_type">
434
498
  <RadioControl
435
- label={__("Position Type", 'block-collections')}
499
+ label={__("Position Type", "block-collections")}
436
500
  selected={positionType}
437
501
  options={[
438
- { label: __("Static", 'block-collections'), value: 'staic' },
439
- { label: __("Relative", 'block-collections'), value: 'relative' },
440
- { label: __("Absolute", 'block-collections'), value: 'absolute' },
441
- { label: __("Fix", 'block-collections'), value: 'fixed' },
442
- { label: __("Sticky", 'block-collections'), value: 'sticky' }
502
+ { label: __("Static", "block-collections"), value: "staic" },
503
+ { label: __("Relative", "block-collections"), value: "relative" },
504
+ { label: __("Absolute", "block-collections"), value: "absolute" },
505
+ { label: __("Fix", "block-collections"), value: "fixed" },
506
+ { label: __("Sticky", "block-collections"), value: "sticky" },
443
507
  ]}
444
508
  onChange={(newVal) => {
445
- props.onPositionChange(newVal)
509
+ props.onPositionChange(newVal);
446
510
  }}
447
511
  />
448
512
  </div>
449
- {(positionType === 'absolute' || positionType === 'fixed' || positionType === 'sticky') &&
513
+ {(positionType === "absolute" ||
514
+ positionType === "fixed" ||
515
+ positionType === "sticky") && (
450
516
  <>
451
- {isMobile ?
452
- <p>{__('Block Position(Mobile)', 'block-collections')}</p>
453
- :
454
- <p>{__('Block Position(DeskTop)', 'block-collections')}</p>
455
- }
456
- <PanelRow className='position_row'>
517
+ {isMobile ? (
518
+ <p>{__("Block Position(Mobile)", "block-collections")}</p>
519
+ ) : (
520
+ <p>{__("Block Position(DeskTop)", "block-collections")}</p>
521
+ )}
522
+ <PanelRow className="position_row">
457
523
  <ComboboxControl
458
- label={__("Vertical", 'block-collections')}
524
+ label={__("Vertical", "block-collections")}
459
525
  options={[
460
- { value: 'top', label: 'Top' },
461
- { value: 'bottom', label: 'Bottom' }
526
+ { value: "top", label: "Top" },
527
+ { value: "bottom", label: "Bottom" },
462
528
  ]}
463
- value={sel_pos.posValue?.vertBase || 'top'}
464
- onChange={
465
- (newValue) => {
466
- const newValObj = { ...(sel_pos.posValue || {}), vertBase: newValue }
467
- props.onPosValueChange(newValObj)
468
- }
469
- }
529
+ value={sel_pos.posValue?.vertBase || "top"}
530
+ onChange={(newValue) => {
531
+ const newValObj = {
532
+ ...(sel_pos.posValue || {}),
533
+ vertBase: newValue,
534
+ };
535
+ props.onPosValueChange(newValObj);
536
+ }}
470
537
  />
471
538
  <UnitControl
472
539
  dragDirection="e"
473
- onChange={
474
- (newValue) => {
475
- const newValObj = { ...(sel_pos.posValue || {}), vertValue: newValue }
476
- props.onPosValueChange(newValObj)
477
- }
478
- }
479
- value={sel_pos.posValue?.vertValue || '3em'}
540
+ onChange={(newValue) => {
541
+ const newValObj = {
542
+ ...(sel_pos.posValue || {}),
543
+ vertValue: newValue,
544
+ };
545
+ props.onPosValueChange(newValObj);
546
+ }}
547
+ value={sel_pos.posValue?.vertValue || "3em"}
480
548
  />
481
-
482
549
  </PanelRow>
483
- <PanelRow className='position_row'>
550
+ <PanelRow className="position_row">
484
551
  <ComboboxControl
485
- label={__("Horizon", 'block-collections')}
552
+ label={__("Horizon", "block-collections")}
486
553
  options={[
487
- { value: 'left', label: 'Left' },
488
- { value: 'right', label: 'Right' }
554
+ { value: "left", label: "Left" },
555
+ { value: "right", label: "Right" },
489
556
  ]}
490
- value={sel_pos.posValue?.horBase || 'left'}
491
- onChange={
492
- (newValue) => {
493
- const newValObj = { ...(sel_pos.posValue || {}), horBase: newValue }
494
- props.onPosValueChange(newValObj)
495
- }
496
- }
557
+ value={sel_pos.posValue?.horBase || "left"}
558
+ onChange={(newValue) => {
559
+ const newValObj = {
560
+ ...(sel_pos.posValue || {}),
561
+ horBase: newValue,
562
+ };
563
+ props.onPosValueChange(newValObj);
564
+ }}
497
565
  />
498
566
  <UnitControl
499
567
  dragDirection="e"
500
- onChange={
501
- (newValue) => {
502
- const newValObj = { ...(sel_pos.posValue || {}), horValue: newValue }
503
- props.onPosValueChange(newValObj)
504
- }
505
- }
506
- value={sel_pos.posValue?.horValue || '3em'}
568
+ onChange={(newValue) => {
569
+ const newValObj = {
570
+ ...(sel_pos.posValue || {}),
571
+ horValue: newValue,
572
+ };
573
+ props.onPosValueChange(newValObj);
574
+ }}
575
+ value={sel_pos.posValue?.horValue || "3em"}
507
576
  />
508
-
509
577
  </PanelRow>
510
-
511
578
  </>
512
-
513
- }
514
- </PanelBody >
515
-
579
+ )}
580
+ </PanelBody>
516
581
  </>
517
582
  );
518
- }
583
+ }