newspack-components 2.2.1 → 3.0.0-alpha.1

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.
Files changed (168) hide show
  1. package/dist/cjs/action-card/index.js +3 -4
  2. package/dist/cjs/autocomplete-tokenfield/index.js +52 -15
  3. package/dist/cjs/autocomplete-tokenfield/style.scss +11 -5
  4. package/dist/cjs/autocomplete-with-suggestions/index.js +45 -57
  5. package/dist/cjs/autocomplete-with-suggestions/style.scss +1 -9
  6. package/dist/cjs/button/index.js +8 -9
  7. package/dist/cjs/button-card/index.js +1 -2
  8. package/dist/cjs/card/index.js +1 -2
  9. package/dist/cjs/category-autocomplete/index.js +4 -8
  10. package/dist/cjs/color-picker/index.js +7 -9
  11. package/dist/cjs/consts.js +2 -7
  12. package/dist/cjs/custom-select-control/index.js +1 -2
  13. package/dist/cjs/footer/index.js +24 -29
  14. package/dist/cjs/form-token-field/index.js +1 -2
  15. package/dist/cjs/global-notices/index.js +1 -2
  16. package/dist/cjs/grid/index.js +14 -31
  17. package/dist/cjs/handoff/index.js +7 -8
  18. package/dist/cjs/hooks/index.js +2 -3
  19. package/dist/cjs/hooks/useObjectState.js +1 -2
  20. package/dist/cjs/hooks/useOnClickOutside.js +1 -2
  21. package/dist/cjs/hooks/usePrompt.js +1 -4
  22. package/dist/cjs/image-upload/index.js +5 -6
  23. package/dist/cjs/index.js +0 -14
  24. package/dist/cjs/info-button/index.js +1 -2
  25. package/dist/cjs/modal/index.js +1 -2
  26. package/dist/cjs/newspack-icon/index.js +1 -2
  27. package/dist/cjs/newspack-logo/index.js +1 -2
  28. package/dist/cjs/notice/index.js +2 -3
  29. package/dist/cjs/patrons-logo/index.js +4 -5
  30. package/dist/cjs/plugin-installer/index.js +9 -13
  31. package/dist/cjs/plugin-settings/SettingsSection.js +2 -4
  32. package/dist/cjs/plugin-settings/index.js +2 -3
  33. package/dist/cjs/plugin-toggle/index.js +16 -20
  34. package/dist/cjs/popover/index.js +1 -2
  35. package/dist/cjs/position-control/index.js +22 -23
  36. package/dist/cjs/progress-bar/index.js +1 -2
  37. package/dist/cjs/progress-bar/index.test.js +4 -5
  38. package/dist/cjs/proxied-imports/router.js +1 -2
  39. package/dist/cjs/radio-control/index.js +1 -2
  40. package/dist/cjs/section-header/index.js +13 -14
  41. package/dist/cjs/section-header/style.scss +4 -0
  42. package/dist/cjs/select-control/ButtonGroupControl.js +10 -12
  43. package/dist/cjs/select-control/GroupedSelectControl.js +21 -25
  44. package/dist/cjs/select-control/index.js +1 -2
  45. package/dist/cjs/settings/MinMaxSetting.js +17 -15
  46. package/dist/cjs/settings/SettingsCard.js +10 -12
  47. package/dist/cjs/settings/SettingsSection.js +20 -24
  48. package/dist/cjs/settings/index.js +2 -3
  49. package/dist/cjs/settings/style.scss +14 -1
  50. package/dist/cjs/sortable-newsletter-list-control/index.js +134 -0
  51. package/dist/cjs/sortable-newsletter-list-control/style.scss +45 -0
  52. package/dist/cjs/steps-list/index.js +1 -2
  53. package/dist/cjs/steps-list-item/index.js +1 -2
  54. package/dist/cjs/style-card/index.js +6 -7
  55. package/dist/cjs/style.scss +13 -1
  56. package/dist/cjs/tabbed-navigation/index.js +11 -14
  57. package/dist/cjs/text-control/index.js +32 -42
  58. package/dist/cjs/utils/index.js +15 -19
  59. package/dist/cjs/waiting/index.js +1 -2
  60. package/dist/cjs/web-preview/index.js +7 -8
  61. package/dist/cjs/with-wizard/index.js +6 -7
  62. package/dist/cjs/with-wizard-screen/index.js +20 -24
  63. package/dist/cjs/wizard/components/WizardError.js +7 -9
  64. package/dist/cjs/wizard/index.js +16 -21
  65. package/dist/cjs/wizard/store/index.js +36 -37
  66. package/dist/cjs/wizard/store/utils.js +1 -4
  67. package/dist/esm/action-card/index.js +3 -4
  68. package/dist/esm/autocomplete-tokenfield/index.js +52 -15
  69. package/dist/esm/autocomplete-tokenfield/style.scss +11 -5
  70. package/dist/esm/autocomplete-with-suggestions/index.js +46 -59
  71. package/dist/esm/autocomplete-with-suggestions/style.scss +1 -9
  72. package/dist/esm/button/index.js +7 -7
  73. package/dist/esm/button-card/index.js +1 -2
  74. package/dist/esm/category-autocomplete/index.js +4 -8
  75. package/dist/esm/color-picker/index.js +7 -9
  76. package/dist/esm/consts.js +0 -2
  77. package/dist/esm/footer/index.js +24 -29
  78. package/dist/esm/form-token-field/index.js +1 -2
  79. package/dist/esm/grid/index.js +13 -29
  80. package/dist/esm/handoff/index.js +7 -8
  81. package/dist/esm/hooks/useObjectState.js +1 -2
  82. package/dist/esm/hooks/useObjectState.test.js +1 -2
  83. package/dist/esm/hooks/usePrompt.js +1 -4
  84. package/dist/esm/image-upload/index.js +5 -7
  85. package/dist/esm/index.js +0 -2
  86. package/dist/esm/notice/index.js +2 -3
  87. package/dist/esm/patrons-logo/index.js +4 -5
  88. package/dist/esm/plugin-installer/index.js +9 -14
  89. package/dist/esm/plugin-settings/SettingsSection.js +2 -4
  90. package/dist/esm/plugin-settings/index.js +2 -3
  91. package/dist/esm/plugin-toggle/index.js +16 -20
  92. package/dist/esm/position-control/index.js +23 -25
  93. package/dist/esm/progress-bar/index.js +1 -2
  94. package/dist/esm/progress-bar/index.test.js +4 -5
  95. package/dist/esm/section-header/index.js +13 -14
  96. package/dist/esm/section-header/style.scss +4 -0
  97. package/dist/esm/select-control/ButtonGroupControl.js +9 -10
  98. package/dist/esm/select-control/GroupedSelectControl.js +22 -27
  99. package/dist/esm/settings/MinMaxSetting.js +17 -16
  100. package/dist/esm/settings/SettingsCard.js +9 -10
  101. package/dist/esm/settings/SettingsSection.js +20 -24
  102. package/dist/esm/settings/style.scss +14 -1
  103. package/dist/esm/sortable-newsletter-list-control/index.js +128 -0
  104. package/dist/esm/sortable-newsletter-list-control/style.scss +45 -0
  105. package/dist/esm/steps-list-item/index.js +1 -2
  106. package/dist/esm/style-card/index.js +6 -7
  107. package/dist/esm/style.scss +13 -1
  108. package/dist/esm/tabbed-navigation/index.js +11 -14
  109. package/dist/esm/text-control/index.js +32 -41
  110. package/dist/esm/utils/index.js +13 -16
  111. package/dist/esm/web-preview/index.js +7 -8
  112. package/dist/esm/with-wizard/index.js +7 -9
  113. package/dist/esm/with-wizard-screen/index.js +21 -27
  114. package/dist/esm/wizard/components/WizardError.js +7 -9
  115. package/dist/esm/wizard/index.js +16 -22
  116. package/dist/esm/wizard/store/index.js +35 -35
  117. package/dist/esm/wizard/store/utils.js +1 -4
  118. package/package.json +7 -8
  119. package/src/autocomplete-tokenfield/index.js +48 -15
  120. package/src/autocomplete-tokenfield/style.scss +11 -5
  121. package/src/autocomplete-with-suggestions/index.js +17 -22
  122. package/src/autocomplete-with-suggestions/style.scss +1 -9
  123. package/src/button/{index.js → index.tsx} +12 -5
  124. package/src/consts.js +0 -2
  125. package/src/footer/index.js +7 -7
  126. package/src/grid/index.tsx +34 -0
  127. package/src/handoff/index.js +7 -6
  128. package/src/hooks/{index.js → index.ts} +1 -1
  129. package/src/hooks/{usePrompt.js → usePrompt.ts} +4 -8
  130. package/src/image-upload/index.js +4 -4
  131. package/src/index.js +0 -2
  132. package/src/notice/index.js +1 -1
  133. package/src/patrons-logo/index.js +4 -1
  134. package/src/plugin-installer/index.js +7 -7
  135. package/src/plugin-settings/index.js +1 -1
  136. package/src/plugin-toggle/index.js +7 -5
  137. package/src/position-control/index.js +13 -13
  138. package/src/section-header/index.js +3 -3
  139. package/src/section-header/style.scss +4 -0
  140. package/src/select-control/GroupedSelectControl.js +1 -1
  141. package/src/settings/MinMaxSetting.js +8 -6
  142. package/src/settings/style.scss +14 -1
  143. package/src/sortable-newsletter-list-control/index.js +137 -0
  144. package/src/sortable-newsletter-list-control/style.scss +45 -0
  145. package/src/style-card/index.js +11 -5
  146. package/src/style.scss +13 -1
  147. package/src/tabbed-navigation/index.js +1 -1
  148. package/src/text-control/index.tsx +65 -0
  149. package/src/web-preview/index.js +6 -6
  150. package/src/with-wizard/index.js +4 -4
  151. package/src/with-wizard-screen/index.js +1 -1
  152. package/src/wizard/components/WizardError.js +1 -1
  153. package/src/wizard/index.js +3 -3
  154. package/src/wizard/store/index.js +9 -2
  155. package/dist/cjs/accordion/index.js +0 -46
  156. package/dist/cjs/accordion/style.scss +0 -27
  157. package/dist/cjs/date-range-picker/index.js +0 -41
  158. package/dist/cjs/date-range-picker/style.scss +0 -148
  159. package/dist/esm/accordion/index.js +0 -38
  160. package/dist/esm/accordion/style.scss +0 -27
  161. package/dist/esm/date-range-picker/index.js +0 -32
  162. package/dist/esm/date-range-picker/style.scss +0 -148
  163. package/src/accordion/index.js +0 -32
  164. package/src/accordion/style.scss +0 -27
  165. package/src/date-range-picker/index.js +0 -31
  166. package/src/date-range-picker/style.scss +0 -148
  167. package/src/grid/index.js +0 -44
  168. package/src/text-control/index.js +0 -56
@@ -1,148 +0,0 @@
1
- @use '../../../shared/scss/colors';
2
- @use '~@wordpress/base-styles/colors' as wp-colors;
3
-
4
- .DateRangePicker {
5
- margin: 32px 0;
6
- max-width: 296px;
7
- width: 100%;
8
-
9
- &__PaginationArrow {
10
- background: transparent 50% 50% no-repeat;
11
- background-size: 24px 24px;
12
- border-radius: 3px;
13
- height: 36px;
14
- transition: background-image 125ms ease-in-out;
15
- width: 36px;
16
-
17
- &--previous {
18
- background-image: url( 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" fill="%231e1e1e"/%3E%3C/svg%3E' );
19
- left: 0;
20
-
21
- &:hover {
22
- background-image: url( 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" fill="%2336f"/%3E%3C/svg%3E' );
23
- }
24
- }
25
-
26
- &--next {
27
- background-image: url( 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" fill="%231e1e1e"/%3E%3C/svg%3E' );
28
- right: 0;
29
-
30
- &:hover {
31
- background-image: url( 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" fill="%2336f"/%3E%3C/svg%3E' );
32
- }
33
- }
34
-
35
- &:hover {
36
- background-color: transparent;
37
- }
38
- }
39
-
40
- &__PaginationArrowIcon {
41
- display: none;
42
- }
43
-
44
- &__Month {
45
- margin: 0;
46
- width: inherit;
47
- }
48
-
49
- &__MonthHeader {
50
- color: wp-colors.$gray-900;
51
- font-size: 17px;
52
- height: auto;
53
- line-height: 24px;
54
- padding: 6px 44px;
55
- }
56
-
57
- &__WeekdayHeading,
58
- &__Date {
59
- font-size: 14px;
60
- line-height: 24px;
61
- padding: 6px 0;
62
- }
63
-
64
- &__WeekdayHeading {
65
- border-bottom-color: wp-colors.$gray-300;
66
- color: wp-colors.$gray-900;
67
-
68
- abbr[title] {
69
- color: inherit;
70
- }
71
- }
72
-
73
- &__MonthDates {
74
- border: 0;
75
- border-spacing: 0;
76
- }
77
-
78
- &__Date {
79
- border-color: wp-colors.$gray-300;
80
- border-bottom-width: 1px;
81
-
82
- &--weekend {
83
- background-color: wp-colors.$gray-100;
84
- }
85
-
86
- &--otherMonth {
87
- color: wp-colors.$gray-200;
88
- opacity: 1;
89
- }
90
-
91
- &--is-disabled {
92
- color: wp-colors.$gray-100;
93
- cursor: not-allowed;
94
- }
95
-
96
- &--is-highlighted {
97
- color: white;
98
- }
99
- }
100
-
101
- &__CalendarSelection,
102
- &__CalendarHighlight {
103
- border-color: colors.$primary-500;
104
- bottom: 4px;
105
- top: 4px;
106
-
107
- &--inOtherMonth {
108
- opacity: 1;
109
- }
110
-
111
- &--start {
112
- border-bottom-left-radius: 3px;
113
- border-top-left-radius: 3px;
114
- left: 4px;
115
- }
116
-
117
- &--end {
118
- border-bottom-right-radius: 3px;
119
- border-top-right-radius: 3px;
120
- right: 4px;
121
- }
122
-
123
- &--single {
124
- border: none;
125
- border-radius: 3px;
126
- left: 4px;
127
- right: 4px;
128
- }
129
- }
130
-
131
- &__CalendarSelection {
132
- background-color: colors.$primary-500;
133
- }
134
-
135
- &__CalendarHighlight {
136
- background: colors.$primary-500;
137
- border: none;
138
- bottom: 0;
139
- top: 0;
140
-
141
- &--single {
142
- border: none;
143
- border-radius: 0;
144
- left: 0;
145
- right: 0;
146
- }
147
- }
148
- }
@@ -1,32 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useState } from '@wordpress/element';
5
- import { Icon, chevronRight } from '@wordpress/icons';
6
-
7
- /**
8
- * External dependencies
9
- */
10
- import classNames from 'classnames';
11
-
12
- /**
13
- * Internal dependencies
14
- */
15
- import './style.scss';
16
-
17
- const Accordion = ( { children, title } ) => {
18
- const [ isOpen, setIsOpen ] = useState( false );
19
- return (
20
- <details
21
- className={ classNames( 'newspack-accordion', { 'newspack-accordion--is-open': isOpen } ) }
22
- >
23
- <summary onClick={ () => setIsOpen( ! isOpen ) }>
24
- { title }
25
- <Icon className="newspack-accordion__icon" icon={ chevronRight } size={ 24 } />
26
- </summary>
27
- { children }
28
- </details>
29
- );
30
- };
31
-
32
- export default Accordion;
@@ -1,27 +0,0 @@
1
- @use '~@wordpress/base-styles/colors' as wp-colors;
2
-
3
- .newspack-accordion {
4
- border: 1px solid wp-colors.$gray-300;
5
-
6
- &__icon {
7
- transition: transform 200ms ease-out;
8
- transform: rotate( 90deg );
9
- }
10
-
11
- &--is-open {
12
- .newspack-accordion {
13
- &__icon {
14
- transform: rotate( -90deg );
15
- }
16
- }
17
- }
18
- summary {
19
- padding: 16px 32px;
20
- display: flex;
21
- align-items: center;
22
- justify-content: space-between;
23
- cursor: pointer;
24
- font-size: 14px;
25
- font-weight: bold;
26
- }
27
- }
@@ -1,31 +0,0 @@
1
- /**
2
- * External dependencies.
3
- */
4
- import { default as ReactDateRangePicker } from 'react-daterange-picker';
5
- import origMoment from 'moment';
6
- import { extendMoment } from 'moment-range';
7
- import 'react-daterange-picker/dist/css/react-calendar.css';
8
-
9
- /**
10
- * Internal dependencies.
11
- */
12
- import './style.scss';
13
-
14
- const moment = extendMoment( origMoment );
15
-
16
- const DateRangePicker = ( { start, end, onChange } ) => {
17
- return (
18
- <ReactDateRangePicker
19
- value={ moment.range( moment( start ), moment( end ) ) }
20
- firstOfWeek={ 1 }
21
- onSelect={ range => {
22
- onChange( {
23
- start: range.start._d,
24
- end: range.end._d,
25
- } );
26
- } }
27
- />
28
- );
29
- };
30
-
31
- export default DateRangePicker;
@@ -1,148 +0,0 @@
1
- @use '../../../shared/scss/colors';
2
- @use '~@wordpress/base-styles/colors' as wp-colors;
3
-
4
- .DateRangePicker {
5
- margin: 32px 0;
6
- max-width: 296px;
7
- width: 100%;
8
-
9
- &__PaginationArrow {
10
- background: transparent 50% 50% no-repeat;
11
- background-size: 24px 24px;
12
- border-radius: 3px;
13
- height: 36px;
14
- transition: background-image 125ms ease-in-out;
15
- width: 36px;
16
-
17
- &--previous {
18
- background-image: url( 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" fill="%231e1e1e"/%3E%3C/svg%3E' );
19
- left: 0;
20
-
21
- &:hover {
22
- background-image: url( 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" fill="%2336f"/%3E%3C/svg%3E' );
23
- }
24
- }
25
-
26
- &--next {
27
- background-image: url( 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" fill="%231e1e1e"/%3E%3C/svg%3E' );
28
- right: 0;
29
-
30
- &:hover {
31
- background-image: url( 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath d="M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" fill="%2336f"/%3E%3C/svg%3E' );
32
- }
33
- }
34
-
35
- &:hover {
36
- background-color: transparent;
37
- }
38
- }
39
-
40
- &__PaginationArrowIcon {
41
- display: none;
42
- }
43
-
44
- &__Month {
45
- margin: 0;
46
- width: inherit;
47
- }
48
-
49
- &__MonthHeader {
50
- color: wp-colors.$gray-900;
51
- font-size: 17px;
52
- height: auto;
53
- line-height: 24px;
54
- padding: 6px 44px;
55
- }
56
-
57
- &__WeekdayHeading,
58
- &__Date {
59
- font-size: 14px;
60
- line-height: 24px;
61
- padding: 6px 0;
62
- }
63
-
64
- &__WeekdayHeading {
65
- border-bottom-color: wp-colors.$gray-300;
66
- color: wp-colors.$gray-900;
67
-
68
- abbr[title] {
69
- color: inherit;
70
- }
71
- }
72
-
73
- &__MonthDates {
74
- border: 0;
75
- border-spacing: 0;
76
- }
77
-
78
- &__Date {
79
- border-color: wp-colors.$gray-300;
80
- border-bottom-width: 1px;
81
-
82
- &--weekend {
83
- background-color: wp-colors.$gray-100;
84
- }
85
-
86
- &--otherMonth {
87
- color: wp-colors.$gray-200;
88
- opacity: 1;
89
- }
90
-
91
- &--is-disabled {
92
- color: wp-colors.$gray-100;
93
- cursor: not-allowed;
94
- }
95
-
96
- &--is-highlighted {
97
- color: white;
98
- }
99
- }
100
-
101
- &__CalendarSelection,
102
- &__CalendarHighlight {
103
- border-color: colors.$primary-500;
104
- bottom: 4px;
105
- top: 4px;
106
-
107
- &--inOtherMonth {
108
- opacity: 1;
109
- }
110
-
111
- &--start {
112
- border-bottom-left-radius: 3px;
113
- border-top-left-radius: 3px;
114
- left: 4px;
115
- }
116
-
117
- &--end {
118
- border-bottom-right-radius: 3px;
119
- border-top-right-radius: 3px;
120
- right: 4px;
121
- }
122
-
123
- &--single {
124
- border: none;
125
- border-radius: 3px;
126
- left: 4px;
127
- right: 4px;
128
- }
129
- }
130
-
131
- &__CalendarSelection {
132
- background-color: colors.$primary-500;
133
- }
134
-
135
- &__CalendarHighlight {
136
- background: colors.$primary-500;
137
- border: none;
138
- bottom: 0;
139
- top: 0;
140
-
141
- &--single {
142
- border: none;
143
- border-radius: 0;
144
- left: 0;
145
- right: 0;
146
- }
147
- }
148
- }
package/src/grid/index.js DELETED
@@ -1,44 +0,0 @@
1
- /**
2
- * Grid
3
- */
4
-
5
- /**
6
- * WordPress dependencies
7
- */
8
- import { Component } from '@wordpress/element';
9
-
10
- /**
11
- * Internal dependencies
12
- */
13
- import './style.scss';
14
-
15
- /**
16
- * External dependencies
17
- */
18
- import classnames from 'classnames';
19
-
20
- class Grid extends Component {
21
- /**
22
- * Render
23
- */
24
- render() {
25
- const { className, columns, gutter, noMargin, rowGap, ...otherProps } = this.props;
26
- const classes = classnames(
27
- 'newspack-grid',
28
- noMargin && 'newspack-grid--no-margin',
29
- columns && 'newspack-grid__columns-' + columns,
30
- gutter && 'newspack-grid__gutter-' + gutter,
31
- rowGap && 'newspack-grid__row-gap-' + rowGap,
32
- className
33
- );
34
- return <div className={ classes } { ...otherProps } />;
35
- }
36
- }
37
-
38
- Grid.defaultProps = {
39
- columns: 2,
40
- gutter: 32,
41
- rowGap: null,
42
- };
43
-
44
- export default Grid;
@@ -1,56 +0,0 @@
1
- /**
2
- * Text Control
3
- */
4
-
5
- /**
6
- * WordPress dependencies
7
- */
8
- import { TextControl as BaseComponent } from '@wordpress/components';
9
- import { Component, createRef } from '@wordpress/element';
10
- import { __ } from '@wordpress/i18n';
11
-
12
- /**
13
- * Internal dependencies
14
- */
15
- import './style.scss';
16
-
17
- /**
18
- * External dependencies
19
- */
20
- import classNames from 'classnames';
21
-
22
- class TextControl extends Component {
23
- constructor( props ) {
24
- super( props );
25
- this.wrapperRef = createRef();
26
- }
27
- componentDidMount() {
28
- if ( this.wrapperRef.current ) {
29
- const labelEl = this.wrapperRef.current.querySelector( 'label' );
30
- if ( labelEl ) {
31
- labelEl.setAttribute( 'data-required-text', __( '(required)', 'newspack' ) );
32
- }
33
- }
34
- }
35
- /**
36
- * Render.
37
- */
38
- render() {
39
- const { className, required, isWide, withMargin = true, ...otherProps } = this.props;
40
- const classes = classNames(
41
- 'newspack-text-control',
42
- { 'newspack-text-control--wide': isWide },
43
- { 'newspack-text-control--with-margin': withMargin },
44
- className
45
- );
46
- return required ? (
47
- <div ref={ this.wrapperRef } className="newspack-text-control--required">
48
- <BaseComponent className={ classes } required={ required } { ...otherProps } />
49
- </div>
50
- ) : (
51
- <BaseComponent className={ classes } { ...otherProps } />
52
- );
53
- }
54
- }
55
-
56
- export default TextControl;