newspack-components 3.0.0-alpha.1 → 3.0.0-alpha.2

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 (278) hide show
  1. package/babel.config.js +25 -0
  2. package/copy-styles.js +2 -10
  3. package/dist/accordion/index.js +50 -0
  4. package/dist/accordion/style.scss +31 -0
  5. package/dist/{cjs/action-card → action-card}/index.js +38 -41
  6. package/dist/{cjs/action-card → action-card}/style.scss +9 -9
  7. package/dist/{cjs/autocomplete-tokenfield → autocomplete-tokenfield}/index.js +19 -18
  8. package/dist/{esm/autocomplete-tokenfield → autocomplete-tokenfield}/style.scss +3 -3
  9. package/dist/{cjs/autocomplete-with-suggestions → autocomplete-with-suggestions}/index.js +29 -29
  10. package/dist/{cjs/autocomplete-with-suggestions → autocomplete-with-suggestions}/style.scss +8 -8
  11. package/dist/button/index.js +51 -0
  12. package/dist/button/index.tsx +48 -0
  13. package/dist/{cjs/button → button}/style.scss +1 -1
  14. package/dist/{cjs/button-card → button-card}/index.js +8 -8
  15. package/dist/{cjs/button-card → button-card}/style.scss +19 -13
  16. package/dist/{cjs/card → card}/index.js +3 -3
  17. package/dist/{esm/card → card}/style.scss +1 -1
  18. package/dist/{cjs/category-autocomplete → category-autocomplete}/index.js +50 -48
  19. package/dist/{cjs/category-autocomplete → category-autocomplete}/style.scss +2 -2
  20. package/dist/{cjs/color-picker → color-picker}/index.js +7 -7
  21. package/dist/{cjs/color-picker → color-picker}/style.scss +3 -3
  22. package/dist/{cjs/custom-select-control → custom-select-control}/index.js +3 -3
  23. package/dist/{esm/custom-select-control → custom-select-control}/style.scss +11 -10
  24. package/dist/date-range-picker/index.js +39 -0
  25. package/dist/date-range-picker/style.scss +148 -0
  26. package/dist/{cjs/footer → footer}/index.js +19 -17
  27. package/dist/{cjs/footer → footer}/style.scss +1 -1
  28. package/dist/{cjs/form-token-field → form-token-field}/index.js +5 -5
  29. package/dist/{esm/form-token-field → form-token-field}/style.scss +1 -1
  30. package/dist/{cjs/global-notices → global-notices}/index.js +3 -3
  31. package/dist/grid/index.js +44 -0
  32. package/dist/grid/index.tsx +34 -0
  33. package/dist/{esm/grid → grid}/style.scss +9 -9
  34. package/dist/{cjs/handoff → handoff}/index.js +72 -69
  35. package/dist/{cjs/handoff-message → handoff-message}/index.js +5 -3
  36. package/dist/hooks/index.js +29 -0
  37. package/dist/hooks/index.ts +15 -0
  38. package/dist/{cjs/hooks → hooks}/useObjectState.js +1 -1
  39. package/dist/{cjs/hooks → hooks}/useObjectState.test.js +9 -9
  40. package/dist/hooks/usePrompt.js +47 -0
  41. package/dist/hooks/usePrompt.ts +46 -0
  42. package/dist/image-upload/index.js +148 -0
  43. package/dist/{cjs/image-upload → image-upload}/index.test.js +13 -6
  44. package/dist/{cjs/image-upload → image-upload}/style.scss +5 -5
  45. package/dist/{cjs/index.js → index.js} +15 -1
  46. package/dist/{cjs/info-button → info-button}/index.js +5 -5
  47. package/dist/{cjs/modal → modal}/index.js +3 -3
  48. package/dist/{cjs/modal → modal}/style.scss +5 -5
  49. package/dist/{cjs/newspack-icon → newspack-icon}/index.js +4 -4
  50. package/dist/{cjs/newspack-icon → newspack-icon}/style.scss +1 -1
  51. package/dist/{cjs/newspack-logo → newspack-logo}/index.js +4 -4
  52. package/dist/{cjs/newspack-logo → newspack-logo}/style.scss +1 -1
  53. package/dist/{cjs/notice → notice}/index.js +11 -8
  54. package/dist/{cjs/notice → notice}/style.scss +11 -11
  55. package/dist/patrons-logo/index.js +77 -0
  56. package/dist/plugin-installer/index.js +297 -0
  57. package/dist/{esm/plugin-installer → plugin-installer}/style.scss +1 -1
  58. package/dist/{cjs/plugin-settings → plugin-settings}/SettingsSection.js +11 -9
  59. package/dist/plugin-settings/index.js +228 -0
  60. package/dist/{cjs/plugin-settings → plugin-settings}/style.scss +1 -1
  61. package/dist/plugin-toggle/README.md +53 -0
  62. package/dist/plugin-toggle/index.js +222 -0
  63. package/dist/{esm/plugin-toggle → plugin-toggle}/style.scss +1 -1
  64. package/dist/{cjs/popover → popover}/index.js +3 -3
  65. package/dist/{esm/popover → popover}/style.scss +7 -7
  66. package/dist/{cjs/position-control → position-control}/index.js +24 -22
  67. package/dist/{cjs/position-control → position-control}/style.scss +8 -8
  68. package/dist/{cjs/progress-bar → progress-bar}/index.js +8 -8
  69. package/dist/{cjs/progress-bar → progress-bar}/index.test.js +12 -11
  70. package/dist/{esm/progress-bar → progress-bar}/style.scss +2 -2
  71. package/dist/proxied-imports/router.js +15 -0
  72. package/dist/{cjs/radio-control → radio-control}/index.js +3 -3
  73. package/dist/{esm/radio-control → radio-control}/style.scss +3 -3
  74. package/dist/{cjs/section-header → section-header}/index.js +8 -8
  75. package/dist/{cjs/section-header → section-header}/style.scss +1 -1
  76. package/dist/{cjs/select-control → select-control}/ButtonGroupControl.js +7 -7
  77. package/dist/{cjs/select-control → select-control}/GroupedSelectControl.js +15 -14
  78. package/dist/{cjs/select-control → select-control}/index.js +6 -6
  79. package/dist/{esm/select-control → select-control}/style.scss +4 -4
  80. package/dist/{cjs/settings → settings}/MinMaxSetting.js +12 -11
  81. package/dist/{cjs/settings → settings}/SettingsCard.js +4 -4
  82. package/dist/{cjs/settings → settings}/SettingsSection.js +6 -6
  83. package/dist/{cjs/settings → settings}/index.js +1 -1
  84. package/dist/{cjs/settings → settings}/style.scss +1 -1
  85. package/dist/{cjs/sortable-newsletter-list-control → sortable-newsletter-list-control}/index.js +25 -24
  86. package/dist/{cjs/steps-list → steps-list}/index.js +4 -4
  87. package/dist/{esm/steps-list → steps-list}/style.scss +2 -2
  88. package/dist/{cjs/steps-list-item → steps-list-item}/index.js +5 -5
  89. package/dist/{cjs/steps-list-item → steps-list-item}/style.scss +5 -5
  90. package/dist/{cjs/style-card → style-card}/index.js +20 -17
  91. package/dist/{cjs/style-card → style-card}/style.scss +4 -4
  92. package/dist/{esm/style.scss → style.scss} +1 -1
  93. package/dist/{cjs/tabbed-navigation → tabbed-navigation}/index.js +7 -7
  94. package/dist/{cjs/tabbed-navigation → tabbed-navigation}/style.scss +4 -4
  95. package/dist/text-control/index.js +76 -0
  96. package/dist/text-control/index.tsx +71 -0
  97. package/dist/{cjs/utils → utils}/index.js +2 -2
  98. package/dist/{cjs/waiting → waiting}/index.js +3 -3
  99. package/dist/web-preview/index.js +191 -0
  100. package/dist/{esm/web-preview → web-preview}/style.scss +5 -5
  101. package/dist/with-wizard/index.js +328 -0
  102. package/dist/{cjs/with-wizard → with-wizard}/style.scss +44 -22
  103. package/dist/{cjs/with-wizard-screen → with-wizard-screen}/index.js +24 -23
  104. package/dist/{esm/with-wizard-screen → with-wizard-screen}/style.scss +7 -7
  105. package/dist/{cjs/wizard → wizard}/components/WizardError.js +10 -9
  106. package/dist/{cjs/wizard → wizard}/index.js +30 -27
  107. package/dist/{cjs/wizard → wizard}/store/index.js +1 -1
  108. package/package.json +18 -15
  109. package/shared/scss/_mixins.scss +2 -2
  110. package/src/accordion/index.js +35 -0
  111. package/src/accordion/style.scss +31 -0
  112. package/src/action-card/style.scss +9 -9
  113. package/src/autocomplete-tokenfield/style.scss +3 -3
  114. package/src/autocomplete-with-suggestions/index.js +46 -44
  115. package/src/autocomplete-with-suggestions/style.scss +8 -8
  116. package/src/button/style.scss +1 -1
  117. package/src/button-card/style.scss +19 -13
  118. package/src/card/style.scss +1 -1
  119. package/src/category-autocomplete/style.scss +2 -2
  120. package/src/color-picker/style.scss +3 -3
  121. package/src/custom-select-control/style.scss +11 -10
  122. package/src/date-range-picker/index.js +31 -0
  123. package/src/date-range-picker/style.scss +148 -0
  124. package/src/footer/style.scss +1 -1
  125. package/src/form-token-field/style.scss +1 -1
  126. package/src/grid/style.scss +9 -9
  127. package/src/handoff-message/index.js +3 -1
  128. package/src/image-upload/index.js +1 -1
  129. package/src/image-upload/index.test.js +6 -1
  130. package/src/image-upload/style.scss +5 -5
  131. package/src/index.js +2 -0
  132. package/src/modal/style.scss +5 -5
  133. package/src/newspack-icon/style.scss +1 -1
  134. package/src/newspack-logo/style.scss +1 -1
  135. package/src/notice/style.scss +11 -11
  136. package/src/plugin-installer/style.scss +1 -1
  137. package/src/plugin-settings/style.scss +1 -1
  138. package/src/plugin-toggle/index.js +6 -7
  139. package/src/plugin-toggle/style.scss +1 -1
  140. package/src/popover/style.scss +7 -7
  141. package/src/position-control/index.js +62 -63
  142. package/src/position-control/style.scss +8 -8
  143. package/src/progress-bar/style.scss +2 -2
  144. package/src/radio-control/style.scss +3 -3
  145. package/src/section-header/style.scss +1 -1
  146. package/src/select-control/style.scss +4 -4
  147. package/src/settings/style.scss +1 -1
  148. package/src/steps-list/style.scss +2 -2
  149. package/src/steps-list-item/style.scss +5 -5
  150. package/src/style-card/style.scss +4 -4
  151. package/src/style.scss +1 -1
  152. package/src/tabbed-navigation/index.js +1 -1
  153. package/src/tabbed-navigation/style.scss +4 -4
  154. package/src/web-preview/style.scss +5 -5
  155. package/src/with-wizard/style.scss +44 -22
  156. package/src/with-wizard-screen/style.scss +7 -7
  157. package/dist/cjs/autocomplete-tokenfield/style.scss +0 -49
  158. package/dist/cjs/button/index.js +0 -56
  159. package/dist/cjs/card/style.scss +0 -168
  160. package/dist/cjs/custom-select-control/style.scss +0 -92
  161. package/dist/cjs/form-token-field/style.scss +0 -37
  162. package/dist/cjs/grid/index.js +0 -37
  163. package/dist/cjs/grid/style.scss +0 -166
  164. package/dist/cjs/hooks/index.js +0 -25
  165. package/dist/cjs/hooks/usePrompt.js +0 -49
  166. package/dist/cjs/image-upload/index.js +0 -143
  167. package/dist/cjs/patrons-logo/index.js +0 -81
  168. package/dist/cjs/plugin-installer/index.js +0 -295
  169. package/dist/cjs/plugin-installer/style.scss +0 -72
  170. package/dist/cjs/plugin-settings/index.js +0 -221
  171. package/dist/cjs/plugin-toggle/index.js +0 -218
  172. package/dist/cjs/plugin-toggle/style.scss +0 -20
  173. package/dist/cjs/popover/style.scss +0 -161
  174. package/dist/cjs/progress-bar/style.scss +0 -42
  175. package/dist/cjs/proxied-imports/router.js +0 -14
  176. package/dist/cjs/radio-control/style.scss +0 -92
  177. package/dist/cjs/select-control/style.scss +0 -108
  178. package/dist/cjs/steps-list/style.scss +0 -11
  179. package/dist/cjs/style.scss +0 -55
  180. package/dist/cjs/text-control/index.js +0 -61
  181. package/dist/cjs/web-preview/index.js +0 -188
  182. package/dist/cjs/web-preview/style.scss +0 -155
  183. package/dist/cjs/with-wizard/index.js +0 -317
  184. package/dist/cjs/with-wizard-screen/style.scss +0 -160
  185. package/dist/esm/action-card/index.js +0 -221
  186. package/dist/esm/action-card/style.scss +0 -483
  187. package/dist/esm/autocomplete-tokenfield/index.js +0 -260
  188. package/dist/esm/autocomplete-with-suggestions/index.js +0 -276
  189. package/dist/esm/autocomplete-with-suggestions/style.scss +0 -163
  190. package/dist/esm/button/index.js +0 -48
  191. package/dist/esm/button/style.scss +0 -11
  192. package/dist/esm/button-card/index.js +0 -64
  193. package/dist/esm/button-card/style.scss +0 -174
  194. package/dist/esm/card/index.js +0 -43
  195. package/dist/esm/category-autocomplete/index.js +0 -181
  196. package/dist/esm/category-autocomplete/style.scss +0 -34
  197. package/dist/esm/color-picker/index.js +0 -59
  198. package/dist/esm/color-picker/style.scss +0 -37
  199. package/dist/esm/consts.js +0 -1
  200. package/dist/esm/custom-select-control/index.js +0 -37
  201. package/dist/esm/footer/index.js +0 -100
  202. package/dist/esm/footer/style.scss +0 -82
  203. package/dist/esm/form-token-field/index.js +0 -49
  204. package/dist/esm/global-notices/index.js +0 -30
  205. package/dist/esm/grid/index.js +0 -29
  206. package/dist/esm/handoff/index.js +0 -176
  207. package/dist/esm/handoff-message/index.js +0 -45
  208. package/dist/esm/hooks/index.js +0 -17
  209. package/dist/esm/hooks/useObjectState.js +0 -30
  210. package/dist/esm/hooks/useObjectState.test.js +0 -82
  211. package/dist/esm/hooks/useOnClickOutside.js +0 -31
  212. package/dist/esm/hooks/usePrompt.js +0 -40
  213. package/dist/esm/image-upload/index.js +0 -139
  214. package/dist/esm/image-upload/index.test.js +0 -28
  215. package/dist/esm/image-upload/style.scss +0 -103
  216. package/dist/esm/index.js +0 -45
  217. package/dist/esm/info-button/index.js +0 -42
  218. package/dist/esm/info-button/style.scss +0 -18
  219. package/dist/esm/modal/index.js +0 -39
  220. package/dist/esm/modal/style.scss +0 -56
  221. package/dist/esm/newspack-icon/index.js +0 -50
  222. package/dist/esm/newspack-icon/style.scss +0 -26
  223. package/dist/esm/newspack-logo/index.js +0 -46
  224. package/dist/esm/newspack-logo/style.scss +0 -30
  225. package/dist/esm/notice/index.js +0 -66
  226. package/dist/esm/notice/style.scss +0 -111
  227. package/dist/esm/patrons-logo/index.js +0 -75
  228. package/dist/esm/plugin-installer/index.js +0 -290
  229. package/dist/esm/plugin-settings/SettingsSection.js +0 -134
  230. package/dist/esm/plugin-settings/index.js +0 -216
  231. package/dist/esm/plugin-settings/style.scss +0 -7
  232. package/dist/esm/plugin-toggle/index.js +0 -213
  233. package/dist/esm/popover/index.js +0 -41
  234. package/dist/esm/position-control/index.js +0 -107
  235. package/dist/esm/position-control/style.scss +0 -66
  236. package/dist/esm/progress-bar/index.js +0 -68
  237. package/dist/esm/progress-bar/index.test.js +0 -109
  238. package/dist/esm/proxied-imports/router.js +0 -8
  239. package/dist/esm/radio-control/index.js +0 -37
  240. package/dist/esm/section-header/index.js +0 -67
  241. package/dist/esm/section-header/style.scss +0 -45
  242. package/dist/esm/select-control/ButtonGroupControl.js +0 -53
  243. package/dist/esm/select-control/GroupedSelectControl.js +0 -79
  244. package/dist/esm/select-control/index.js +0 -51
  245. package/dist/esm/settings/MinMaxSetting.js +0 -54
  246. package/dist/esm/settings/SettingsCard.js +0 -38
  247. package/dist/esm/settings/SettingsSection.js +0 -26
  248. package/dist/esm/settings/index.js +0 -9
  249. package/dist/esm/settings/style.scss +0 -119
  250. package/dist/esm/sortable-newsletter-list-control/index.js +0 -128
  251. package/dist/esm/sortable-newsletter-list-control/style.scss +0 -45
  252. package/dist/esm/steps-list/index.js +0 -43
  253. package/dist/esm/steps-list-item/index.js +0 -47
  254. package/dist/esm/steps-list-item/style.scss +0 -47
  255. package/dist/esm/style-card/index.js +0 -75
  256. package/dist/esm/style-card/style.scss +0 -94
  257. package/dist/esm/tabbed-navigation/index.js +0 -53
  258. package/dist/esm/tabbed-navigation/style.scss +0 -86
  259. package/dist/esm/text-control/index.js +0 -57
  260. package/dist/esm/text-control/style.scss +0 -32
  261. package/dist/esm/utils/index.js +0 -29
  262. package/dist/esm/waiting/index.js +0 -44
  263. package/dist/esm/waiting/style.scss +0 -27
  264. package/dist/esm/web-preview/index.js +0 -183
  265. package/dist/esm/with-wizard/index.js +0 -311
  266. package/dist/esm/with-wizard/style.scss +0 -260
  267. package/dist/esm/with-wizard-screen/index.js +0 -110
  268. package/dist/esm/wizard/components/WizardError.js +0 -67
  269. package/dist/esm/wizard/index.js +0 -120
  270. package/dist/esm/wizard/store/index.js +0 -155
  271. package/dist/esm/wizard/store/utils.js +0 -14
  272. /package/dist/{cjs/consts.js → consts.js} +0 -0
  273. /package/dist/{cjs/hooks → hooks}/useOnClickOutside.js +0 -0
  274. /package/dist/{cjs/info-button → info-button}/style.scss +0 -0
  275. /package/dist/{cjs/sortable-newsletter-list-control → sortable-newsletter-list-control}/style.scss +0 -0
  276. /package/dist/{cjs/text-control → text-control}/style.scss +0 -0
  277. /package/dist/{cjs/waiting → waiting}/style.scss +0 -0
  278. /package/dist/{cjs/wizard → wizard}/store/utils.js +0 -0
@@ -1,92 +0,0 @@
1
- /**
2
- * Radio Control
3
- */
4
-
5
- @use '../../../shared/scss/colors';
6
- @use '~@wordpress/base-styles/colors' as wp-colors;
7
-
8
- .newspack-radio-control {
9
- color: wp-colors.$gray-700;
10
- font-size: 14px;
11
- line-height: 24px;
12
- margin: 32px 0;
13
-
14
- label {
15
- color: inherit;
16
- font-size: 14px;
17
- line-height: 24px;
18
- margin: 0;
19
- }
20
-
21
- .components-base-control__label {
22
- color: wp-colors.$gray-900;
23
- font-weight: bold;
24
- }
25
-
26
- // Options
27
-
28
- .components-radio-control__option {
29
- align-items: center;
30
- display: flex;
31
- margin: 0 0 8px;
32
-
33
- &:first-of-type {
34
- margin-top: 8px;
35
- }
36
-
37
- &:last-child {
38
- margin-bottom: 0;
39
- }
40
- }
41
-
42
- // Radio
43
-
44
- input[type='radio'] {
45
- height: 24px;
46
- margin-right: 8px;
47
- width: 24px;
48
-
49
- @media screen and ( min-width: 782px ) {
50
- height: 20px;
51
- width: 20px;
52
- }
53
-
54
- &:checked {
55
- background-color: colors.$primary-500;
56
- border-color: colors.$primary-500;
57
-
58
- &::before {
59
- border: none;
60
- }
61
- }
62
-
63
- &:focus {
64
- border-color: colors.$primary-500;
65
- box-shadow: 0 0 0 2px white, 0 0 0 3.5px colors.$primary-500;
66
- }
67
- }
68
-
69
- // Multiple Radio Controls
70
-
71
- & + & {
72
- margin-bottom: 32px;
73
- margin-top: -16px;
74
- }
75
-
76
- // Multiple Controls
77
-
78
- + .newspack-select-control,
79
- + .newspack-text-control {
80
- margin-bottom: 32px;
81
- margin-top: -16px;
82
- }
83
-
84
- // Reset
85
-
86
- .components-base-control__field,
87
- .components-base-control__label,
88
- .components-base-control__help {
89
- display: block;
90
- margin: 0;
91
- }
92
- }
@@ -1,108 +0,0 @@
1
- /**
2
- * Select Control
3
- */
4
-
5
- @use '~@wordpress/base-styles/colors' as wp-colors;
6
-
7
- .components-select-control {
8
- &__input {
9
- max-width: 100% !important;
10
-
11
- &[multiple] {
12
- height: auto !important;
13
- min-height: 70px !important;
14
- padding: 0 !important;
15
-
16
- + .components-input-control__suffix {
17
- display: none;
18
- }
19
-
20
- option {
21
- min-height: 1.4em;
22
- padding: 8px;
23
-
24
- &:checked {
25
- background: var( --wp-admin-theme-color );
26
- color: white;
27
- }
28
- }
29
- }
30
- }
31
-
32
- .components-base-control__field {
33
- width: 100%;
34
- }
35
-
36
- .components-input-control__label {
37
- line-height: inherit;
38
- }
39
- }
40
-
41
- // Grouped
42
-
43
- .newspack-grouped-select-control {
44
- position: relative;
45
-
46
- .components-select-control {
47
- &__input {
48
- appearance: none;
49
- background: transparent;
50
- border: 1px solid wp-colors.$gray-700;
51
- border-radius: 2px;
52
- box-shadow: none !important;
53
- box-sizing: border-box;
54
- display: block;
55
- font-size: inherit;
56
- margin: 0;
57
- max-width: 100%;
58
- outline: none;
59
- padding: 0 24px 0 7px;
60
- width: 100%;
61
-
62
- &:hover {
63
- color: inherit;
64
- }
65
-
66
- &:focus {
67
- border-color: var( --wp-admin-theme-color-darker-10 ) !important;
68
- box-shadow: inset 0 0 0 1px var( --wp-admin-theme-color-darker-10 ) !important;
69
- color: inherit;
70
- }
71
- }
72
-
73
- &__arrow-wrapper {
74
- align-items: center;
75
- display: flex;
76
- height: 24px;
77
- justify-content: center;
78
- margin-top: -12px;
79
- position: absolute;
80
- right: 1px;
81
- top: 50%;
82
- width: 24px;
83
- }
84
- }
85
- }
86
-
87
- // Buttons
88
-
89
- .newspack-buttons-select-control {
90
- .components-base-control__label {
91
- display: inline-flex;
92
- margin-bottom: 8px;
93
- }
94
-
95
- .components-button-group {
96
- display: flex;
97
- }
98
-
99
- &.icon-only {
100
- .components-button {
101
- align-items: center;
102
- height: 36px;
103
- justify-content: center;
104
- padding: 0 !important;
105
- width: 36px;
106
- }
107
- }
108
- }
@@ -1,11 +0,0 @@
1
- @use '../../../shared/scss/colors';
2
- @use '~@wordpress/base-styles/colors' as wp-colors;
3
-
4
- .steps-list {
5
- margin-left: auto;
6
- margin-right: auto;
7
-
8
- &__narrow-list {
9
- max-width: 416px;
10
- }
11
- }
@@ -1,55 +0,0 @@
1
- @use '~@wordpress/base-styles/colors' as wp-colors;
2
-
3
- // Buttons Card
4
-
5
- .newspack-buttons-card {
6
- display: flex;
7
- flex-direction: row-reverse;
8
- gap: 16px;
9
- justify-content: flex-start;
10
- align-items: center;
11
- margin: 64px 0 32px;
12
-
13
- &:empty {
14
- display: none;
15
- }
16
- }
17
-
18
- // Checkboxes
19
- .newspack-checkbox-control {
20
- margin-top: 0 !important;
21
- .components-checkbox-control__label {
22
- font-weight: 600;
23
- }
24
-
25
- .components-base-control__help {
26
- margin-left: 32px;
27
- margin-top: 0;
28
- }
29
- }
30
-
31
- // Checkbox Icon
32
- .newspack-checkbox-icon {
33
- background: white;
34
- border-radius: 50%;
35
- box-shadow: inset 0 0 0 1px wp-colors.$gray-300;
36
- display: block;
37
- height: 24px;
38
- width: 24px;
39
-
40
- svg {
41
- fill: wp-colors.$gray-700;
42
- }
43
-
44
- &--checked {
45
- background: wp-colors.$alert-green;
46
- box-shadow: none;
47
-
48
- svg {
49
- fill: white;
50
- }
51
- }
52
- &--pending {
53
- background: wp-colors.$alert-yellow;
54
- }
55
- }
@@ -1,61 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _components = require("@wordpress/components");
9
- var _element = require("@wordpress/element");
10
- var _i18n = require("@wordpress/i18n");
11
- require("./style.scss");
12
- var _classnames = _interopRequireDefault(require("classnames"));
13
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
14
- /**
15
- * Text Control
16
- */
17
- /**
18
- * WordPress dependencies
19
- */
20
- /**
21
- * Internal dependencies
22
- */
23
- const __ = _i18n.__;
24
- /**
25
- * External dependencies
26
- */
27
- const TextControl = ({
28
- className = '',
29
- required = false,
30
- isWide = false,
31
- withMargin = true,
32
- ...otherProps
33
- }) => {
34
- const wrapperRef = (0, _element.useRef)(null);
35
- (0, _element.useEffect)(() => {
36
- if (wrapperRef.current === null) {
37
- return;
38
- }
39
- const labelEl = wrapperRef.current.querySelector('label');
40
- if (labelEl) {
41
- labelEl.setAttribute('data-required-text', __('(required)', 'newspack-plugin'));
42
- }
43
- }, [wrapperRef.current]);
44
- const classes = (0, _classnames.default)('newspack-text-control', {
45
- 'newspack-text-control--wide': isWide,
46
- 'newspack-text-control--with-margin': withMargin
47
- }, className);
48
- return required ? (0, _jsxRuntime.jsx)("div", {
49
- ref: wrapperRef,
50
- className: "newspack-text-control--required",
51
- children: (0, _jsxRuntime.jsx)(_components.TextControl, {
52
- className: classes,
53
- required: required,
54
- ...otherProps
55
- })
56
- }) : (0, _jsxRuntime.jsx)(_components.TextControl, {
57
- className: classes,
58
- ...otherProps
59
- });
60
- };
61
- var _default = exports.default = TextControl;
@@ -1,188 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _element = require("@wordpress/element");
10
- var _i18n = require("@wordpress/i18n");
11
- var _icons = require("@wordpress/icons");
12
- var _components = require("@wordpress/components");
13
- var _ = require("../");
14
- require("./style.scss");
15
- var _classnames = _interopRequireDefault(require("classnames"));
16
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
- /**
18
- * WordPress dependencies.
19
- */
20
- const __ = _i18n.__;
21
- /**
22
- * Internal dependencies.
23
- */
24
- /**
25
- * External dependencies.
26
- */
27
- const PORTAL_PARENT_ID = 'newspack-components-web-preview-wrapper';
28
-
29
- /**
30
- * Web Preview. A component to preview a website in an iframe, with device sizing options.
31
- */
32
- class WebPreview extends _element.Component {
33
- constructor(props) {
34
- super(props);
35
- (0, _defineProperty2.default)(this, "state", {
36
- device: 'desktop',
37
- loaded: false,
38
- isPreviewVisible: false
39
- });
40
- /**
41
- * Create JSX for the modal
42
- */
43
- (0, _defineProperty2.default)(this, "getWebPreviewModal", () => {
44
- const {
45
- beforeLoad = () => {},
46
- onClose = () => {},
47
- url
48
- } = this.props;
49
- const {
50
- device,
51
- loaded,
52
- isPreviewVisible
53
- } = this.state;
54
- if (!this.modalDOMElement || !isPreviewVisible) {
55
- return null;
56
- }
57
- const classes = (0, _classnames.default)('newspack-web-preview', device, loaded && 'is-loaded');
58
- beforeLoad();
59
- return (0, _element.createPortal)((0, _jsxRuntime.jsx)("div", {
60
- className: classes,
61
- children: (0, _jsxRuntime.jsxs)("div", {
62
- className: "newspack-web-preview__interior",
63
- children: [(0, _jsxRuntime.jsxs)("div", {
64
- className: "newspack-web-preview__toolbar",
65
- children: [(0, _jsxRuntime.jsx)("div", {
66
- className: "newspack-web-preview__toolbar-left",
67
- children: (0, _jsxRuntime.jsxs)(_components.ButtonGroup, {
68
- children: [(0, _jsxRuntime.jsx)(_components.Button, {
69
- onClick: () => this.setState({
70
- device: 'desktop'
71
- }),
72
- variant: 'desktop' === device && 'primary',
73
- icon: _icons.desktop,
74
- label: __('Preview Desktop Size', 'newspack-plugin')
75
- }), (0, _jsxRuntime.jsx)(_components.Button, {
76
- onClick: () => this.setState({
77
- device: 'tablet'
78
- }),
79
- variant: 'tablet' === device && 'primary',
80
- icon: _icons.tablet,
81
- label: __('Preview Tablet Size', 'newspack-plugin')
82
- }), (0, _jsxRuntime.jsx)(_components.Button, {
83
- onClick: () => this.setState({
84
- device: 'phone'
85
- }),
86
- variant: 'phone' === device && 'primary',
87
- icon: _icons.mobile,
88
- label: __('Preview Phone Size', 'newspack-plugin')
89
- })]
90
- })
91
- }), (0, _jsxRuntime.jsx)("div", {
92
- className: "newspack-web-preview__toolbar-right",
93
- children: (0, _jsxRuntime.jsx)(_components.Button, {
94
- onClick: () => {
95
- onClose();
96
- this.setState({
97
- isPreviewVisible: false,
98
- loaded: false
99
- });
100
- },
101
- icon: _icons.closeSmall,
102
- label: __('Close Preview', 'newspack-plugin')
103
- })
104
- })]
105
- }), (0, _jsxRuntime.jsxs)("div", {
106
- className: "newspack-web-preview__content",
107
- children: [!loaded && (0, _jsxRuntime.jsxs)("div", {
108
- className: "newspack-web-preview__is-waiting",
109
- children: [(0, _jsxRuntime.jsx)(_.Waiting, {
110
- isLeft: true
111
- }), __('Loading…', 'newspack-plugin')]
112
- }), (0, _jsxRuntime.jsx)("iframe", {
113
- ref: this.iframeRef,
114
- title: "web-preview",
115
- src: url,
116
- onLoad: () => {
117
- this.setState({
118
- loaded: true
119
- });
120
- this.props.onLoad(this.iframeRef.current);
121
- }
122
- })]
123
- })]
124
- })
125
- }), this.modalDOMElement);
126
- });
127
- (0, _defineProperty2.default)(this, "showPreview", () => {
128
- this.setState({
129
- isPreviewVisible: true
130
- });
131
- });
132
- this.iframeRef = (0, _element.createRef)();
133
- }
134
-
135
- /**
136
- * If a div with id PORTAL_PARENT_ID exists, assign it to class field.
137
- * If not, create it and append to the body.
138
- */
139
- componentDidMount() {
140
- const existingDOMElement = document.getElementById(PORTAL_PARENT_ID);
141
- this.modalDOMElement = existingDOMElement || document.createElement('div');
142
- if (!existingDOMElement) {
143
- this.modalDOMElement.id = PORTAL_PARENT_ID;
144
- document.body.appendChild(this.modalDOMElement);
145
- }
146
- }
147
-
148
- /**
149
- * Add or remove applicable body classes
150
- */
151
- componentDidUpdate() {
152
- if (this.state.isPreviewVisible === true) {
153
- document.body.classList.add('newspack-web-preview--open');
154
- } else {
155
- document.body.classList.remove('newspack-web-preview--open');
156
- }
157
- }
158
- /**
159
- * Render.
160
- */
161
- render() {
162
- const {
163
- label,
164
- variant,
165
- /**
166
- * Inversion of control - let the caller render
167
- * the button that will trigger the modal
168
- */
169
- renderButton
170
- } = this.props;
171
- return (0, _jsxRuntime.jsxs)(_element.Fragment, {
172
- children: [renderButton ? renderButton({
173
- showPreview: this.showPreview
174
- }) : (0, _jsxRuntime.jsx)(_components.Button, {
175
- variant: variant,
176
- onClick: this.showPreview,
177
- tabIndex: "0",
178
- children: label
179
- }), this.getWebPreviewModal()]
180
- });
181
- }
182
- }
183
- WebPreview.defaultProps = {
184
- url: '//newspack.com',
185
- label: __('Preview', 'newspack-plugin'),
186
- onLoad: () => {}
187
- };
188
- var _default = exports.default = WebPreview;
@@ -1,155 +0,0 @@
1
- /**
2
- * Web Preview
3
- */
4
-
5
- @use '../../../shared/scss/colors';
6
- @use '~@wordpress/base-styles/colors' as wp-colors;
7
-
8
- .newspack-web-preview {
9
- // Color
10
- --wp-admin-theme-color: #{colors.$primary-500};
11
- --wp-admin-theme-color--rgb: #{colors.$primary-500--rgb};
12
- --wp-admin-theme-color-darker-10: #{colors.$primary-600};
13
- --wp-admin-theme-color-darker-10--rgb: #{colors.$primary-600--rgb};
14
- --wp-admin-theme-color-darker-20: #{colors.$primary-700};
15
- --wp-admin-theme-color-darker-20--rgb: #{colors.$primary-700--rgb};
16
-
17
- background: rgba( black, 0.7 );
18
- box-sizing: border-box;
19
- height: 100%;
20
- left: 0;
21
- margin: 0;
22
- max-width: 100%;
23
- padding: 32px;
24
- position: fixed;
25
- top: 0;
26
- width: 100%;
27
- z-index: 99999;
28
-
29
- &.phone iframe {
30
- max-width: 380px;
31
- }
32
-
33
- &.tablet iframe {
34
- max-width: 768px;
35
- }
36
-
37
- &.is-loaded iframe {
38
- opacity: 1;
39
- }
40
-
41
- &--open {
42
- overflow: hidden;
43
- }
44
-
45
- &__interior {
46
- animation: appear-animation 125ms ease-in-out;
47
- animation-fill-mode: forwards;
48
- background: white;
49
- border-radius: 2px;
50
- overflow: hidden;
51
- height: 100%;
52
- width: 100%;
53
- }
54
-
55
- &__content {
56
- background: wp-colors.$gray-100;
57
- height: calc( 100% - 49px );
58
- -webkit-overflow-scrolling: touch;
59
- overflow-x: hidden;
60
- width: 100%;
61
-
62
- iframe {
63
- background: #fff;
64
- display: block;
65
- height: 100%;
66
- margin: 0 auto;
67
- max-width: 100%;
68
- opacity: 0;
69
- outline: 1px solid wp-colors.$gray-300;
70
- padding: 0;
71
- pointer-events: all;
72
- transition: max-width 125ms ease-in-out, opacity 250ms ease-in-out;
73
- width: 100%;
74
- }
75
- }
76
-
77
- &__is-waiting {
78
- align-items: center;
79
- display: flex;
80
- left: 50%;
81
- margin: -12px 0 0;
82
- position: absolute;
83
- top: 50%;
84
- transform: translateX( -50% );
85
- }
86
-
87
- &__toolbar {
88
- border-bottom: 1px solid wp-colors.$gray-300;
89
- display: flex;
90
- padding: 6px;
91
-
92
- &-left {
93
- flex: 0 0 auto;
94
-
95
- .newspack-button-group {
96
- display: flex;
97
- margin: 0;
98
- }
99
-
100
- .newspack-button {
101
- display: none;
102
- padding: 0 !important;
103
-
104
- &.is-selected {
105
- background: colors.$primary-500;
106
- color: white;
107
-
108
- &:active,
109
- &:focus,
110
- &:hover {
111
- box-shadow: none !important;
112
- color: white;
113
- outline: none;
114
- }
115
-
116
- &:focus {
117
- box-shadow: inset 0 0 0 1px colors.$primary-500, inset 0 0 0 3px white !important;
118
- }
119
- }
120
-
121
- @media screen and ( min-width: 528px ) {
122
- &.is-phone,
123
- &.is-tablet {
124
- display: flex;
125
- }
126
- }
127
-
128
- @media screen and ( min-width: 816px ) {
129
- &.is-desktop {
130
- display: flex;
131
- }
132
- }
133
- }
134
- }
135
-
136
- &-right {
137
- display: flex;
138
- flex: 1;
139
- justify-content: flex-end;
140
- }
141
-
142
- .newspack-button {
143
- border-radius: 0 !important;
144
- }
145
- }
146
- }
147
-
148
- @keyframes appear-animation {
149
- from {
150
- margin-top: 32px;
151
- }
152
- to {
153
- margin-top: 0;
154
- }
155
- }