itmar-block-packages 1.6.1 → 1.6.3

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.
@@ -4,33 +4,55 @@ import {
4
4
  RadioControl,
5
5
  ToggleControl,
6
6
  __experimentalUnitControl as UnitControl,
7
- } from '@wordpress/components';
7
+ } from "@wordpress/components";
8
8
 
9
- import Select from 'react-select';
10
- import { __ } from '@wordpress/i18n';
9
+ import Select from "react-select";
10
+ import { __ } from "@wordpress/i18n";
11
11
 
12
- const TypographyControls = ({ title, fontStyle, initialOpen, isMobile, onChange }) => {
12
+ const TypographyControls = ({
13
+ title,
14
+ fontStyle,
15
+ initialOpen,
16
+ isMobile,
17
+ onChange,
18
+ }) => {
13
19
  const {
14
20
  default_fontSize,
15
21
  mobile_fontSize,
16
22
  fontSize,
17
23
  fontFamily,
18
24
  fontWeight,
19
- isItalic
25
+ isItalic,
20
26
  } = fontStyle;
21
27
 
22
28
  const fontFamilyOptions = [
23
- { value: 'Arial, sans-serif', label: 'Arial', fontFamily: 'Arial, sans-serif' },
24
- { value: 'Courier New, monospace', label: 'Courier New', fontFamily: 'Courier New, monospace' },
25
- { value: 'Georgia, serif', label: 'Georgia', fontFamily: 'Georgia, serif' },
26
- { label: 'Noto Sans JP', value: 'Noto Sans JP, sans-serif', fontFamily: 'Noto Sans JP, sans-serif' },
27
- { label: 'Texturina', value: 'Texturina, serif', fontFamily: 'Texturina, serif' },
29
+ {
30
+ value: "Arial, sans-serif",
31
+ label: "Arial",
32
+ fontFamily: "Arial, sans-serif",
33
+ },
34
+ {
35
+ value: "Courier New, monospace",
36
+ label: "Courier New",
37
+ fontFamily: "Courier New, monospace",
38
+ },
39
+ { value: "Georgia, serif", label: "Georgia", fontFamily: "Georgia, serif" },
40
+ {
41
+ label: "Noto Sans JP",
42
+ value: "Noto Sans JP, sans-serif",
43
+ fontFamily: "Noto Sans JP, sans-serif",
44
+ },
45
+ {
46
+ label: "Texturina",
47
+ value: "Texturina, serif",
48
+ fontFamily: "Texturina, serif",
49
+ },
28
50
  ];
29
51
 
30
52
  const units = [
31
- { value: 'px', label: 'px' },
32
- { value: 'em', label: 'em' },
33
- { value: 'rem', label: 'rem' },
53
+ { value: "px", label: "px" },
54
+ { value: "em", label: "em" },
55
+ { value: "rem", label: "rem" },
34
56
  ];
35
57
 
36
58
  const customStyles = {
@@ -42,7 +64,9 @@ const TypographyControls = ({ title, fontStyle, initialOpen, isMobile, onChange
42
64
 
43
65
  const FontSelect = ({ label, value, onChange }) => (
44
66
  <>
45
- {label && <label className="components-base-control__label">{label}</label>}
67
+ {label && (
68
+ <label className="components-base-control__label">{label}</label>
69
+ )}
46
70
  <Select
47
71
  options={fontFamilyOptions}
48
72
  value={fontFamilyOptions.find((option) => option.value === value)}
@@ -55,24 +79,28 @@ const TypographyControls = ({ title, fontStyle, initialOpen, isMobile, onChange
55
79
  );
56
80
 
57
81
  return (
58
- <PanelBody title={title} initialOpen={initialOpen} >
82
+ <PanelBody title={title} initialOpen={initialOpen}>
59
83
  <UnitControl
60
84
  dragDirection="e"
61
85
  onChange={(newValue) => {
62
- newValue = newValue != '' ? newValue : '0px'
63
- const set_size = !isMobile ? { default_fontSize: newValue } : { mobile_fontSize: newValue };
86
+ newValue = newValue != "" ? newValue : "0px";
87
+ const set_size = !isMobile
88
+ ? { default_fontSize: newValue }
89
+ : { mobile_fontSize: newValue };
64
90
  const newStyle = { ...fontStyle, ...set_size };
65
91
  onChange(newStyle);
66
92
  }}
67
- label={!isMobile ?
68
- __("Size(desk top)", 'block-collections')
69
- : __("Size(mobile)", 'block-collections')}
93
+ label={
94
+ !isMobile
95
+ ? __("Size(desk top)", "block-collections")
96
+ : __("Size(mobile)", "block-collections")
97
+ }
70
98
  value={!isMobile ? default_fontSize : mobile_fontSize}
71
99
  units={units}
72
100
  />
73
101
 
74
102
  <FontSelect
75
- label={__("font family", 'block-collections')}
103
+ label={__("font family", "block-collections")}
76
104
  value={fontFamily}
77
105
  onChange={(newValue) => {
78
106
  const newStyle = { ...fontStyle, fontFamily: newValue };
@@ -80,17 +108,19 @@ const TypographyControls = ({ title, fontStyle, initialOpen, isMobile, onChange
80
108
  }}
81
109
  />
82
110
 
83
- <label className="components-base-control__label">{__('font weight', 'block-collections')}</label>
84
- <PanelRow className='itmar_weight_row'>
111
+ <label className="components-base-control__label">
112
+ {__("font weight", "block-collections")}
113
+ </label>
114
+ <PanelRow className="itmar_weight_row">
85
115
  <RadioControl
86
116
  selected={fontWeight}
87
117
  options={[
88
- { label: 'LIGHT', value: "300" },
89
- { label: 'REGULAR', value: "400" },
90
- { label: 'MEDIUM', value: "500" },
91
- { label: 'S-BOLD', value: "600" },
92
- { label: 'BOLD', value: "700" },
93
- { label: 'BLACK', value: "900" },
118
+ { label: "LIGHT", value: "300" },
119
+ { label: "REGULAR", value: "400" },
120
+ { label: "MEDIUM", value: "500" },
121
+ { label: "S-BOLD", value: "600" },
122
+ { label: "BOLD", value: "700" },
123
+ { label: "BLACK", value: "900" },
94
124
  ]}
95
125
  onChange={(newValue) => {
96
126
  const newStyle = { ...fontStyle, fontWeight: newValue };
@@ -99,7 +129,9 @@ const TypographyControls = ({ title, fontStyle, initialOpen, isMobile, onChange
99
129
  />
100
130
  </PanelRow>
101
131
 
102
- <label className="components-base-control__label">{__('Italic display', 'block-collections')}</label>
132
+ <label className="components-base-control__label">
133
+ {__("Italic display", "block-collections")}
134
+ </label>
103
135
  <ToggleControl
104
136
  checked={isItalic}
105
137
  onChange={(newValue) => {