newspack-components 3.1.0 → 4.0.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.
Files changed (191) hide show
  1. package/colors/colors.module.scss +277 -0
  2. package/copy-styles.js +8 -1
  3. package/dist/cjs/action-card/action-card.d.js +5 -0
  4. package/dist/cjs/action-card/index.js +282 -187
  5. package/dist/cjs/action-card/style.scss +142 -44
  6. package/dist/cjs/autocomplete-tokenfield/index.js +6 -2
  7. package/dist/cjs/box-contrast/index.js +49 -0
  8. package/dist/cjs/button/index.js +1 -1
  9. package/dist/cjs/button-props/button-props.js +41 -0
  10. package/dist/cjs/button-props/index.js +13 -0
  11. package/dist/cjs/color-picker/index.js +11 -0
  12. package/dist/cjs/custom-select-control/style.scss +7 -12
  13. package/dist/cjs/footer/index.js +17 -24
  14. package/dist/cjs/footer/style.scss +0 -36
  15. package/dist/cjs/handoff-message/index.js +0 -3
  16. package/dist/cjs/hooks/useObjectState.js +9 -0
  17. package/dist/cjs/hooks/useObjectState.test.js +5 -5
  18. package/dist/cjs/index.js +7 -21
  19. package/dist/cjs/modal/index.js +4 -1
  20. package/dist/cjs/modal/style.scss +18 -7
  21. package/dist/cjs/newspack-icon/index.js +2 -2
  22. package/dist/cjs/newspack-icon/style.scss +3 -5
  23. package/dist/cjs/notice/index.js +1 -2
  24. package/dist/cjs/notice/style.scss +11 -9
  25. package/dist/cjs/plugin-installer/index.js +3 -3
  26. package/dist/cjs/plugin-settings/SettingsSection.js +2 -0
  27. package/dist/cjs/plugin-settings/index.js +4 -1
  28. package/dist/cjs/plugin-toggle/index.js +2 -0
  29. package/dist/cjs/popover/style.scss +5 -6
  30. package/dist/cjs/progress-bar/index.test.js +1 -2
  31. package/dist/cjs/progress-bar/style.scss +1 -2
  32. package/dist/cjs/proxied-imports/router.js +1 -2
  33. package/dist/cjs/radio-control/style.scss +4 -10
  34. package/dist/cjs/section-header/index.js +21 -1
  35. package/dist/cjs/select-control/ButtonGroupControl.js +2 -0
  36. package/dist/cjs/settings/SettingsCard.js +2 -6
  37. package/dist/cjs/sortable-newsletter-list-control/index.js +7 -5
  38. package/dist/cjs/sortable-newsletter-list-control/style.scss +11 -1
  39. package/dist/cjs/steps-list/style.scss +0 -3
  40. package/dist/cjs/steps-list-item/style.scss +1 -2
  41. package/dist/cjs/style-card/index.js +1 -0
  42. package/dist/cjs/style-card/style.scss +4 -5
  43. package/dist/cjs/style.scss +15 -0
  44. package/dist/cjs/tabbed-navigation/index.js +17 -7
  45. package/dist/cjs/tabbed-navigation/style.scss +2 -6
  46. package/dist/cjs/utils/color.js +35 -0
  47. package/dist/cjs/web-preview/style.scss +11 -11
  48. package/dist/cjs/with-wizard/index.js +80 -3
  49. package/dist/cjs/with-wizard/style.scss +34 -13
  50. package/dist/cjs/with-wizard-screen/index.js +3 -3
  51. package/dist/cjs/with-wizard-screen/style.scss +9 -9
  52. package/dist/cjs/wizard/index.js +38 -13
  53. package/dist/cjs/wizard/store/index.js +13 -5
  54. package/dist/cjs/wizard/store/utils.js +3 -1
  55. package/dist/esm/action-card/action-card.d.js +1 -0
  56. package/dist/esm/action-card/index.js +286 -189
  57. package/dist/esm/action-card/style.scss +142 -44
  58. package/dist/esm/autocomplete-tokenfield/index.js +6 -2
  59. package/dist/esm/box-contrast/index.js +44 -0
  60. package/dist/esm/button/index.js +1 -1
  61. package/dist/esm/button-props/button-props.js +34 -0
  62. package/dist/esm/button-props/index.js +1 -0
  63. package/dist/esm/color-picker/index.js +11 -0
  64. package/dist/esm/custom-select-control/style.scss +7 -12
  65. package/dist/esm/footer/index.js +18 -25
  66. package/dist/esm/footer/style.scss +0 -36
  67. package/dist/esm/handoff-message/index.js +0 -3
  68. package/dist/esm/hooks/useObjectState.js +10 -0
  69. package/dist/esm/hooks/useObjectState.test.js +6 -6
  70. package/dist/esm/index.js +1 -3
  71. package/dist/esm/modal/index.js +4 -1
  72. package/dist/esm/modal/style.scss +18 -7
  73. package/dist/esm/newspack-icon/index.js +2 -2
  74. package/dist/esm/newspack-icon/style.scss +3 -5
  75. package/dist/esm/notice/index.js +1 -2
  76. package/dist/esm/notice/style.scss +11 -9
  77. package/dist/esm/plugin-installer/index.js +3 -3
  78. package/dist/esm/plugin-settings/SettingsSection.js +2 -0
  79. package/dist/esm/plugin-settings/index.js +4 -1
  80. package/dist/esm/plugin-toggle/index.js +2 -0
  81. package/dist/esm/popover/style.scss +5 -6
  82. package/dist/esm/progress-bar/style.scss +1 -2
  83. package/dist/esm/radio-control/style.scss +4 -10
  84. package/dist/esm/section-header/index.js +22 -0
  85. package/dist/esm/select-control/ButtonGroupControl.js +2 -0
  86. package/dist/esm/settings/SettingsCard.js +2 -6
  87. package/dist/esm/sortable-newsletter-list-control/index.js +8 -6
  88. package/dist/esm/sortable-newsletter-list-control/style.scss +11 -1
  89. package/dist/esm/steps-list/style.scss +0 -3
  90. package/dist/esm/steps-list-item/style.scss +1 -2
  91. package/dist/esm/style-card/index.js +1 -0
  92. package/dist/esm/style-card/style.scss +4 -5
  93. package/dist/esm/style.scss +15 -0
  94. package/dist/esm/tabbed-navigation/index.js +17 -7
  95. package/dist/esm/tabbed-navigation/style.scss +2 -6
  96. package/dist/esm/utils/color.js +29 -0
  97. package/dist/esm/web-preview/style.scss +11 -11
  98. package/dist/esm/with-wizard/index.js +81 -4
  99. package/dist/esm/with-wizard/style.scss +34 -13
  100. package/dist/esm/with-wizard-screen/index.js +1 -1
  101. package/dist/esm/with-wizard-screen/style.scss +9 -9
  102. package/dist/esm/wizard/index.js +39 -13
  103. package/dist/esm/wizard/store/index.js +13 -5
  104. package/dist/esm/wizard/store/utils.js +3 -1
  105. package/package.json +1 -1
  106. package/src/accordion/index.js +1 -3
  107. package/src/action-card/action-card.d.ts +40 -0
  108. package/src/action-card/index.js +284 -202
  109. package/src/action-card/style.scss +142 -44
  110. package/src/autocomplete-tokenfield/index.js +3 -2
  111. package/src/autocomplete-with-suggestions/index.js +52 -63
  112. package/src/box-contrast/index.tsx +44 -0
  113. package/src/button/index.tsx +1 -1
  114. package/src/button-card/index.js +1 -12
  115. package/src/card/index.js +1 -11
  116. package/src/category-autocomplete/index.js +4 -19
  117. package/src/color-picker/index.js +11 -7
  118. package/src/custom-select-control/style.scss +7 -12
  119. package/src/footer/index.js +6 -18
  120. package/src/footer/style.scss +0 -36
  121. package/src/form-token-field/index.js +1 -2
  122. package/src/grid/index.tsx +1 -8
  123. package/src/handoff/index.js +4 -11
  124. package/src/handoff-message/index.js +0 -3
  125. package/src/hooks/useObjectState.js +10 -2
  126. package/src/hooks/useObjectState.test.js +14 -14
  127. package/src/image-upload/index.js +3 -23
  128. package/src/index.js +1 -3
  129. package/src/modal/index.js +2 -2
  130. package/src/modal/style.scss +18 -7
  131. package/src/newspack-icon/index.js +3 -14
  132. package/src/newspack-icon/style.scss +3 -5
  133. package/src/notice/index.js +0 -2
  134. package/src/notice/style.scss +11 -9
  135. package/src/plugin-installer/index.js +8 -17
  136. package/src/plugin-settings/SettingsSection.js +3 -7
  137. package/src/plugin-settings/index.js +7 -14
  138. package/src/plugin-toggle/README.md +3 -3
  139. package/src/plugin-toggle/index.js +10 -13
  140. package/src/popover/index.js +1 -5
  141. package/src/popover/style.scss +5 -6
  142. package/src/position-control/index.js +65 -75
  143. package/src/progress-bar/index.js +2 -9
  144. package/src/progress-bar/index.test.js +4 -13
  145. package/src/progress-bar/style.scss +1 -2
  146. package/src/radio-control/style.scss +4 -10
  147. package/src/section-header/index.js +20 -0
  148. package/src/select-control/ButtonGroupControl.js +2 -9
  149. package/src/select-control/GroupedSelectControl.js +1 -9
  150. package/src/select-control/index.js +1 -5
  151. package/src/settings/MinMaxSetting.js +2 -14
  152. package/src/settings/SettingsCard.js +2 -11
  153. package/src/sortable-newsletter-list-control/index.js +10 -26
  154. package/src/sortable-newsletter-list-control/style.scss +11 -1
  155. package/src/steps-list/style.scss +0 -3
  156. package/src/steps-list-item/index.js +1 -4
  157. package/src/steps-list-item/style.scss +1 -2
  158. package/src/style-card/index.js +6 -21
  159. package/src/style-card/style.scss +4 -5
  160. package/src/style.scss +15 -0
  161. package/src/tabbed-navigation/index.js +19 -7
  162. package/src/tabbed-navigation/style.scss +2 -6
  163. package/src/text-control/index.tsx +2 -12
  164. package/src/utils/color.ts +32 -0
  165. package/src/web-preview/style.scss +11 -11
  166. package/src/with-wizard/index.js +67 -16
  167. package/src/with-wizard/style.scss +34 -13
  168. package/src/with-wizard-screen/index.js +1 -1
  169. package/src/with-wizard-screen/style.scss +9 -9
  170. package/src/wizard/components/WizardError.js +2 -7
  171. package/src/wizard/index.js +64 -62
  172. package/src/wizard/store/index.js +8 -10
  173. package/src/wizard/store/utils.js +3 -4
  174. package/dist/cjs/date-range-picker/index.js +0 -39
  175. package/dist/cjs/date-range-picker/style.scss +0 -148
  176. package/dist/cjs/newspack-logo/index.js +0 -54
  177. package/dist/cjs/newspack-logo/style.scss +0 -30
  178. package/dist/cjs/patrons-logo/index.js +0 -77
  179. package/dist/esm/date-range-picker/index.js +0 -31
  180. package/dist/esm/date-range-picker/style.scss +0 -148
  181. package/dist/esm/newspack-logo/index.js +0 -46
  182. package/dist/esm/newspack-logo/style.scss +0 -30
  183. package/dist/esm/patrons-logo/index.js +0 -70
  184. package/shared/scss/_colors.scss +0 -27
  185. package/src/date-range-picker/index.js +0 -31
  186. package/src/date-range-picker/style.scss +0 -148
  187. package/src/newspack-logo/index.js +0 -45
  188. package/src/newspack-logo/style.scss +0 -30
  189. package/src/patrons-logo/index.js +0 -76
  190. /package/{shared/js → src/button-props}/button-props.js +0 -0
  191. /package/{shared/js → src/button-props}/index.js +0 -0
@@ -9,8 +9,7 @@
9
9
  padding: 0;
10
10
  border-color: wp-colors.$gray-300;
11
11
 
12
- // Clickable
13
-
12
+ /* Clickable */
14
13
  &.newspack-card--is-clickable {
15
14
  transition: box-shadow 125ms ease-in-out;
16
15
 
@@ -19,8 +18,7 @@
19
18
  }
20
19
  }
21
20
 
22
- // Status
23
-
21
+ /* Status */
24
22
  &.newspack-card__is-disabled,
25
23
  &.newspack-card__is-primary,
26
24
  &.newspack-card__is-secondary,
@@ -49,7 +47,7 @@
49
47
  box-shadow: inset 4px 0 0 wp-colors.$alert-red;
50
48
  }
51
49
 
52
- // Small
50
+ /* Small */
53
51
  &.is-small {
54
52
  .newspack-action-card__region-top {
55
53
  padding: 8px 16px;
@@ -116,8 +114,7 @@
116
114
  }
117
115
  }
118
116
 
119
- // Medium
120
-
117
+ /* Medium */
121
118
  &.is-medium {
122
119
  .newspack-action-card__region-top {
123
120
  padding: 16px;
@@ -146,8 +143,7 @@
146
143
  }
147
144
  }
148
145
 
149
- // Nested children
150
-
146
+ /* Nested children */
151
147
  &.newspack-card--has-children {
152
148
  .newspack-action-card {
153
149
  &:first-child {
@@ -164,8 +160,7 @@
164
160
  }
165
161
  }
166
162
 
167
- // Has grey header
168
-
163
+ /* Has grey header */
169
164
  &.newspack-card--has-grey-header {
170
165
  overflow: hidden;
171
166
 
@@ -198,8 +193,7 @@
198
193
  }
199
194
  }
200
195
 
201
- // Indent
202
-
196
+ /* Indent */
203
197
  &.newspack-card--indent {
204
198
  margin-left: 56px;
205
199
  position: relative;
@@ -216,8 +210,7 @@
216
210
  }
217
211
  }
218
212
 
219
- // Typography
220
-
213
+ /* Typography */
221
214
  h2,
222
215
  p:not([class*="components-base-control"]) {
223
216
  margin: 0;
@@ -247,8 +240,7 @@
247
240
  }
248
241
  }
249
242
 
250
- // Regions
251
-
243
+ /* Regions */
252
244
  .newspack-action-card__region {
253
245
  align-items: center;
254
246
  display: flex;
@@ -264,7 +256,7 @@
264
256
  display: flex;
265
257
  }
266
258
 
267
- // Toggle Control
259
+ /* Toggle Control */
268
260
  .components-toggle-control {
269
261
  margin-bottom: 24px;
270
262
  margin-top: 0;
@@ -359,14 +351,12 @@
359
351
  }
360
352
  }
361
353
 
362
- // Waiting
363
-
354
+ /* Waiting */
364
355
  .newspack-action-card__container {
365
356
  display: flex;
366
357
  }
367
358
 
368
- // Notifications
369
-
359
+ /* Notifications */
370
360
  .newspack-action-card__notification {
371
361
  .newspack-notice {
372
362
  margin: 0;
@@ -383,8 +373,7 @@
383
373
  }
384
374
  }
385
375
 
386
- // Image
387
-
376
+ /* Image */
388
377
  .newspack-action-card__image {
389
378
  background-position: center;
390
379
  background-repeat: no-repeat;
@@ -394,40 +383,52 @@
394
383
  width: 48px;
395
384
  }
396
385
 
397
- // Icon
398
-
386
+ /* Icon */
399
387
  .newspack_plugin-installer__icon {
400
388
  margin: 0;
401
389
  }
402
390
 
403
- // Badge
404
-
391
+ /* Badge */
405
392
  .newspack-action-card__badge {
406
393
  background: wp-colors.$gray-100;
407
394
  border-radius: 2px;
408
395
  color: wp-colors.$gray-900;
409
396
  display: block;
410
397
  flex: 0 0 auto;
411
- font-size: 10px;
412
- font-weight: bold;
413
- line-height: 1.4;
398
+ font-size: 12px;
399
+ font-weight: 400;
400
+ line-height: 1.333;
414
401
  margin: 0 8px 0 0;
415
- padding: 2px 8px;
416
- text-transform: uppercase;
402
+ padding: 2px 4px;
403
+
404
+ &.newspack-action-card__badge-level-warning {
405
+ background-color: color-mix(in srgb, #fff 90%, wp-colors.$alert-yellow);
406
+ color: color-mix(in srgb, #000 50%, wp-colors.$alert-yellow);
407
+ }
408
+ &.newspack-action-card__badge-level-error {
409
+ background-color: color-mix(in srgb, #fff 90%, wp-colors.$alert-red);
410
+ color: color-mix(in srgb, #000 50%, wp-colors.$alert-red);
411
+ }
412
+ &.newspack-action-card__badge-level-success {
413
+ background-color: color-mix(in srgb, #fff 90%, wp-colors.$alert-green);
414
+ color: color-mix(in srgb, #000 50%, wp-colors.$alert-green);
415
+ }
416
+ &.newspack-action-card__badge-level-brand {
417
+ background-color: color-mix(in srgb, #fff 90%, var(--wp-admin-theme-color));
418
+ color: color-mix(in srgb, #000 50%, var(--wp-admin-theme-color));
419
+ }
417
420
 
418
421
  + .newspack-action-card__badge {
419
422
  margin-left: -4px;
420
423
  }
421
424
  }
422
425
 
423
- // Description Card
424
-
426
+ /* Description Card */
425
427
  &.newspack-description-card {
426
428
  font-style: italic;
427
429
  }
428
430
 
429
- // Expandable card children
430
-
431
+ /* Expandable card children */
431
432
  &.is-expandable {
432
433
  .newspack-action-card__title .components-button.is-link {
433
434
  color: inherit;
@@ -439,6 +440,10 @@
439
440
  .newspack-action-card__region-children {
440
441
  border-top: 1px solid wp-colors.$gray-100;
441
442
  padding-top: 24px;
443
+
444
+ + .newspack-action-card__region-children {
445
+ border-top: none;
446
+ }
442
447
  }
443
448
 
444
449
  &.is-medium .newspack-action-card__region-children {
@@ -460,7 +465,7 @@
460
465
  }
461
466
  }
462
467
 
463
- // Action content with multiple buttons
468
+ /* Action content with multiple buttons */
464
469
  &.has-action-content .newspack-action-card__region-right {
465
470
  flex-direction: row;
466
471
 
@@ -468,16 +473,109 @@
468
473
  margin-left: 8px;
469
474
  }
470
475
  }
476
+ }
471
477
 
472
- // Multiple Cards
478
+ .newspack-card {
479
+ .newspack-card.newspack-action-card {
480
+ &:not(.newspack-card__no-border) {
481
+ border: 1px solid wp-colors.$gray-200;
482
+ }
483
+ &.newspack-card__no-border {
484
+ border: none;
485
+ .newspack-action-card__region-top,
486
+ .newspack-action-card__region-children {
487
+ padding: 0;
488
+ }
489
+ }
490
+ }
491
+ }
492
+
493
+ .newspack-action-card__draggable-wrapper {
494
+ margin: 16px 0;
473
495
 
474
- & + & {
475
- margin-top: -16px;
496
+ &.is-dragging {
497
+ opacity: 0.5;
498
+ }
499
+
500
+ .newspack-card {
501
+ margin: 0;
502
+ }
503
+
504
+ .newspack-action-card {
505
+ display: flex;
506
+ flex-direction: row;
507
+ flex-wrap: wrap;
508
+
509
+ .newspack-action-card__draggable-controls {
510
+ flex: 0 0 50px;
511
+ align-items: center;
512
+ display: flex;
513
+ height: 100%;
514
+ min-height: 100%;
515
+ width: fit-content;
516
+ justify-content: center;
517
+ margin-left: 8px;
518
+ margin-right: 8px;
519
+ padding: 8px 12px 8px 0;
520
+ border-right: 1px solid wp-colors.$gray-300;
521
+
522
+ .drag-handle {
523
+ align-items: center;
524
+ cursor: grab;
525
+ display: flex;
526
+ height: 100%;
527
+ justify-content: flex-end;
528
+ margin-left: -8px;
529
+ width: 32px;
530
+
531
+ .is-dragging & {
532
+ cursor: grabbing;
533
+ }
534
+
535
+ svg {
536
+ padding: 3px;
537
+ }
538
+ }
539
+
540
+ .movers {
541
+ display: flex;
542
+ flex-direction: column;
543
+
544
+ .components-button {
545
+ color: wp-colors.$gray-900;
546
+ display: block;
547
+ height: 24px;
548
+ line-height: 24px;
549
+ min-width: 24px;
550
+ padding: 0;
551
+ width: 24px;
552
+ + .components-button {
553
+ margin-top: -4px;
554
+ }
555
+ }
556
+ }
557
+ }
558
+
559
+ .newspack-action-card__region-top {
560
+ flex: 1 1 auto;
561
+ padding: 8px 16px 8px 0 !important;
562
+ flex: 1;
563
+ }
564
+
565
+ .newspack-action-card__region-children {
566
+ flex: 0 0 100%;
567
+ padding: 0 0 0 16px;
568
+ }
569
+
570
+ &.is-draggable {
571
+ display: flex;
572
+ align-items: center;
573
+ }
476
574
  }
477
575
  }
478
576
 
479
- .newspack-card {
480
- .newspack-card.newspack-action-card {
481
- border: 1px solid wp-colors.$gray-200;
577
+ .components-draggable__clone {
578
+ .newspack-card {
579
+ box-shadow: 0 0 8px 4px rgba(black, 0.08);
482
580
  }
483
581
  }
@@ -234,7 +234,9 @@ var _jsxRuntime = require("react/jsx-runtime");
234
234
  help,
235
235
  label = '',
236
236
  placeholder = '',
237
- maxLength
237
+ maxLength,
238
+ style,
239
+ __next40pxDefaultSize
238
240
  } = this.props;
239
241
  const {
240
242
  suggestions,
@@ -246,6 +248,7 @@ var _jsxRuntime = require("react/jsx-runtime");
246
248
  }
247
249
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
248
250
  className: "newspack-autocomplete-tokenfield",
251
+ style: style,
249
252
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
250
253
  className: classNames.join(' '),
251
254
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FormTokenField, {
@@ -255,7 +258,8 @@ var _jsxRuntime = require("react/jsx-runtime");
255
258
  onInputChange: input => this.debouncedUpdateSuggestions(input),
256
259
  label: label,
257
260
  maxLength: maxLength,
258
- placeholder: placeholder
261
+ placeholder: placeholder,
262
+ __next40pxDefaultSize: __next40pxDefaultSize
259
263
  }), loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {})]
260
264
  }), help && /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
261
265
  className: "newspack-autocomplete-tokenfield__help",
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _color = require("../utils/color");
8
+ var _jsxRuntime = require("react/jsx-runtime");
9
+ /**
10
+ * Box Contrast
11
+ *
12
+ * can be used to dynamically assign black or white color/background-color based on a hex color.
13
+ * Black/white can be assigned to either text or background-color.
14
+ */
15
+
16
+ /**
17
+ * Dependencies
18
+ */
19
+
20
+ /**
21
+ * Box Contrast component
22
+ *
23
+ * @return JSX.Element
24
+ */const BoxContrast = ({
25
+ hexColor,
26
+ isInverted = false,
27
+ children,
28
+ ...props
29
+ }) => {
30
+ let contrastColor;
31
+ if (hexColor === '#f0f0f0') {
32
+ contrastColor = '#1e1e1e';
33
+ } else {
34
+ contrastColor = (0, _color.getContrast)(hexColor);
35
+ }
36
+ const style = isInverted ? {
37
+ color: hexColor,
38
+ backgoundColor: contrastColor
39
+ } : {
40
+ backgroundColor: hexColor,
41
+ color: contrastColor
42
+ };
43
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
44
+ ...props,
45
+ style: style,
46
+ children: children
47
+ });
48
+ };
49
+ var _default = exports.default = BoxContrast;
@@ -48,7 +48,7 @@ const Button = ({
48
48
  if (isAwaitingOnClick) {
49
49
  otherProps.disabled = true;
50
50
  }
51
- // @ts-ignore - @wordpress/components' Button can only have either href or onClick, not both.
51
+ // @ts-expect-error - @wordpress/components' Button can only have either href or onClick, not both.
52
52
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
53
53
  ...otherProps
54
54
  });
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = buttonProps;
8
+ var _isFunction = _interopRequireDefault(require("lodash/isFunction"));
9
+ var _isObject = _interopRequireDefault(require("lodash/isObject"));
10
+ var _isString = _interopRequireDefault(require("lodash/isString"));
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+
15
+ /**
16
+ * Creates button props based on an action
17
+ */
18
+ function buttonProps(action) {
19
+ const props = {};
20
+ if ((0, _isFunction.default)(action)) {
21
+ props.onClick = action;
22
+ }
23
+ if ((0, _isString.default)(action)) {
24
+ props.href = action;
25
+ }
26
+ if ((0, _isObject.default)(action)) {
27
+ if (action.handoff) {
28
+ props.plugin = action.handoff;
29
+ if (action.editLink) {
30
+ props.editLink = action.editLink;
31
+ }
32
+ }
33
+ if (action.onClick) {
34
+ props.onClick = action.onClick;
35
+ }
36
+ if (action.href) {
37
+ props.href = action.href;
38
+ }
39
+ }
40
+ return props;
41
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ Object.defineProperty(exports, "buttonProps", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _buttonProps.default;
11
+ }
12
+ });
13
+ var _buttonProps = _interopRequireDefault(require("./button-props"));
@@ -30,6 +30,17 @@ var _jsxRuntime = require("react/jsx-runtime");
30
30
  const {
31
31
  InteractiveDiv
32
32
  } = _utils.default;
33
+
34
+ /**
35
+ * ColorPicker component.
36
+ *
37
+ * @param {Object} props - Component props.
38
+ * @param {JSX.Element|string} props.label - Label for the color picker.
39
+ * @param {string} [props.color] - Default color.
40
+ * @param {Function} props.onChange - Function to call when the color changes.
41
+ * @param {string} [props.className] - Additional class name.
42
+ * @return {JSX.Element} ColorPicker component.
43
+ */
33
44
  const ColorPicker = ({
34
45
  label,
35
46
  color = '#fff',
@@ -10,7 +10,7 @@
10
10
  margin-bottom: 8px;
11
11
  }
12
12
 
13
- .components-custom-select-control__button {
13
+ button {
14
14
  border-color: wp-colors.$gray-700;
15
15
  border-radius: 2px;
16
16
  color: wp-colors.$gray-900;
@@ -41,6 +41,10 @@
41
41
  }
42
42
  }
43
43
 
44
+ button + div {
45
+ min-width: 200px;
46
+ }
47
+
44
48
  .components-custom-select-control__menu {
45
49
  border-color: wp-colors.$gray-700;
46
50
  border-radius: 2px;
@@ -54,7 +58,6 @@
54
58
  cursor: pointer;
55
59
  display: flex;
56
60
  line-height: inherit;
57
- margin: 0 0 0 28px;
58
61
  padding: 6px 8px;
59
62
  transition: color 125ms ease-in-out;
60
63
 
@@ -77,16 +80,8 @@
77
80
 
78
81
  &.is-selected {
79
82
  margin-left: 0;
80
-
81
- &::before {
82
- background:
83
- url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ij48cGF0aCBkPSJNMTguMyA1LjZMOS45IDE2LjlsLTQuNi0zLjQtLjkgMS4yIDUuOCA0LjMgOS4zLTEyLjZ6IiBmaWxsPSIjMzM2NmZmIj48L3BhdGg+PC9zdmc+Cg==")
84
- 0 0 no-repeat;
85
- content: "";
86
- display: block;
87
- height: 24px;
88
- margin: 0 4px 0 0;
89
- width: 24px;
83
+ span svg {
84
+ fill: var(--wp-admin-theme-color);
90
85
  }
91
86
  }
92
87
  }
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _i18n = require("@wordpress/i18n");
8
8
  var _components = require("@wordpress/components");
9
- var _ = require("../");
10
9
  require("./style.scss");
11
10
  var _jsxRuntime = require("react/jsx-runtime");
12
11
  /**
@@ -22,7 +21,7 @@ var _jsxRuntime = require("react/jsx-runtime");
22
21
  */
23
22
 
24
23
  const Footer = ({
25
- simple
24
+ simple = undefined
26
25
  }) => {
27
26
  const {
28
27
  components_demo: componentsDemo = false,
@@ -78,29 +77,23 @@ const Footer = ({
78
77
  url: `mailto:${supportEmail}`
79
78
  });
80
79
  }
81
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
80
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
82
81
  className: "newspack-footer",
83
- children: [!simple && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
84
- className: "newspack-footer__inner",
85
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
86
- children: footerElements.map(({
87
- url,
88
- label,
89
- external
90
- }, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
91
- children: external ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ExternalLink, {
92
- href: url,
93
- children: label
94
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
95
- href: url,
96
- children: label
97
- })
98
- }, index))
99
- })
100
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
101
- className: "newspack-footer__logo",
102
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.PatronsLogo, {})
103
- })]
82
+ children: !simple && /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
83
+ children: footerElements.map(({
84
+ url,
85
+ label,
86
+ external
87
+ }, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
88
+ children: external ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ExternalLink, {
89
+ href: url,
90
+ children: label
91
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
92
+ href: url,
93
+ children: label
94
+ })
95
+ }, index))
96
+ })
104
97
  });
105
98
  };
106
99
  var _default = exports.default = Footer;
@@ -5,16 +5,13 @@
5
5
  @use "~@wordpress/base-styles/colors" as wp-colors;
6
6
 
7
7
  .newspack-footer {
8
- align-items: stretch;
9
8
  background: white;
10
9
  border: 0 solid wp-colors.$gray-300;
11
10
  border-width: 1px 0;
12
11
  bottom: 0;
13
12
  color: wp-colors.$gray-700;
14
13
  display: flex;
15
- flex-wrap: wrap;
16
14
  font-size: 12px;
17
- justify-content: space-between;
18
15
  left: 0;
19
16
  line-height: 16px;
20
17
  position: absolute;
@@ -22,17 +19,6 @@
22
19
 
23
20
  @media screen and ( min-width: 783px ) {
24
21
  bottom: 40px;
25
- flex-wrap: nowrap;
26
- }
27
-
28
- &__inner {
29
- align-items: center;
30
- display: flex;
31
- flex: 0 0 100%;
32
-
33
- @media screen and ( min-width: 783px ) {
34
- flex: 1 1 auto;
35
- }
36
22
  }
37
23
 
38
24
  ul {
@@ -57,26 +43,4 @@
57
43
  }
58
44
  }
59
45
  }
60
-
61
- &__logo {
62
- align-items: center;
63
- background: wp-colors.$gray-900;
64
- display: flex;
65
- margin: 0 0 -1px;
66
- padding: 16px;
67
- width: 100%;
68
-
69
- @media screen and ( min-width: 783px ) {
70
- margin: -1px 0 -1px 8px;
71
- max-width: 33.33%;
72
- width: auto;
73
- }
74
-
75
- .patrons-logo {
76
- display: block;
77
- fill: white;
78
- max-height: 16px;
79
- width: auto;
80
- }
81
- }
82
46
  }
@@ -36,9 +36,6 @@ var _jsxRuntime = require("react/jsx-runtime");
36
36
  setHandoffMessage(false);
37
37
  }
38
38
  }, 100);
39
-
40
- // Clean up the notification when unmounting.
41
- return () => window.localStorage.removeItem(_consts.HANDOFF_KEY);
42
39
  }, []);
43
40
  if (!handoffMessage) {
44
41
  return null;
@@ -12,6 +12,11 @@ var _mergeWith = _interopRequireDefault(require("lodash/mergeWith"));
12
12
  * WordPress dependencies
13
13
  */
14
14
 
15
+ /**
16
+ * @typedef {Object} StateObjectUpdate
17
+ * @property {Object.<string, any>} [update] The update object with key-value pairs to merge into the state.
18
+ */
19
+
15
20
  const mergeCustomizer = (objValue, srcValue) => {
16
21
  if ((0, _isArray.default)(objValue)) {
17
22
  // If it's an array, replace it (instead of concatenating).
@@ -22,6 +27,10 @@ const mergeCustomizer = (objValue, srcValue) => {
22
27
  /**
23
28
  * A useState for an object.
24
29
  * Nested objects will be nested, but arrays replaced.
30
+ *
31
+ * @template T
32
+ * @param {T} initial Initial state object.
33
+ * @return {[T, (keyOrUpdate: string | Partial<T>) => (value?: any) => void]} The state object and a function to update it.
25
34
  */
26
35
  var _default = (initial = {}) => {
27
36
  const [stateObject, setStateObject] = (0, _element.useState)(initial);