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
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Text Control
3
+ */
4
+
5
+ /**
6
+ * WordPress dependencies
7
+ */
8
+ import { TextControl as BaseComponent } from '@wordpress/components';
9
+ import { useEffect, useRef } 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
+ type BaseComponentProps = {
23
+ onChange: ( value: string ) => void;
24
+ value: string | number;
25
+ };
26
+
27
+ const TextControl = ( {
28
+ className = '',
29
+ required = false,
30
+ isWide = false,
31
+ withMargin = true,
32
+ ...otherProps
33
+ } ) => {
34
+ const wrapperRef = useRef< HTMLDivElement >( null );
35
+ 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 = classNames(
45
+ 'newspack-text-control',
46
+ {
47
+ 'newspack-text-control--wide': isWide,
48
+ 'newspack-text-control--with-margin': withMargin,
49
+ },
50
+ className
51
+ );
52
+ return required ? (
53
+ <div ref={ wrapperRef } className="newspack-text-control--required">
54
+ <BaseComponent
55
+ className={ classes }
56
+ required={ required }
57
+ { ...( otherProps as BaseComponentProps ) }
58
+ />
59
+ </div>
60
+ ) : (
61
+ <BaseComponent className={ classes } { ...( otherProps as BaseComponentProps ) } />
62
+ );
63
+ };
64
+
65
+ export default TextControl;
@@ -81,19 +81,19 @@ class WebPreview extends Component {
81
81
  onClick={ () => this.setState( { device: 'desktop' } ) }
82
82
  variant={ 'desktop' === device && 'primary' }
83
83
  icon={ desktop }
84
- label={ __( 'Preview Desktop Size', 'newspack' ) }
84
+ label={ __( 'Preview Desktop Size', 'newspack-plugin' ) }
85
85
  />
86
86
  <Button
87
87
  onClick={ () => this.setState( { device: 'tablet' } ) }
88
88
  variant={ 'tablet' === device && 'primary' }
89
89
  icon={ tablet }
90
- label={ __( 'Preview Tablet Size', 'newspack' ) }
90
+ label={ __( 'Preview Tablet Size', 'newspack-plugin' ) }
91
91
  />
92
92
  <Button
93
93
  onClick={ () => this.setState( { device: 'phone' } ) }
94
94
  variant={ 'phone' === device && 'primary' }
95
95
  icon={ mobile }
96
- label={ __( 'Preview Phone Size', 'newspack' ) }
96
+ label={ __( 'Preview Phone Size', 'newspack-plugin' ) }
97
97
  />
98
98
  </ButtonGroup>
99
99
  </div>
@@ -104,7 +104,7 @@ class WebPreview extends Component {
104
104
  this.setState( { isPreviewVisible: false, loaded: false } );
105
105
  } }
106
106
  icon={ closeSmall }
107
- label={ __( 'Close Preview', 'newspack' ) }
107
+ label={ __( 'Close Preview', 'newspack-plugin' ) }
108
108
  />
109
109
  </div>
110
110
  </div>
@@ -112,7 +112,7 @@ class WebPreview extends Component {
112
112
  { ! loaded && (
113
113
  <div className="newspack-web-preview__is-waiting">
114
114
  <Waiting isLeft />
115
- { __( 'Loading…', 'newspack' ) }
115
+ { __( 'Loading…', 'newspack-plugin' ) }
116
116
  </div>
117
117
  ) }
118
118
  <iframe
@@ -166,7 +166,7 @@ class WebPreview extends Component {
166
166
 
167
167
  WebPreview.defaultProps = {
168
168
  url: '//newspack.com',
169
- label: __( 'Preview', 'newspack' ),
169
+ label: __( 'Preview', 'newspack-plugin' ),
170
170
  onLoad: () => {},
171
171
  };
172
172
 
@@ -105,7 +105,7 @@ export default function withWizard( WrappedComponent, requiredPlugins ) {
105
105
  <Notice noticeText={ message } isError rawHTML />
106
106
  <Card buttonsCard noBorder className="justify-end">
107
107
  <Button isPrimary href={ fallbackURL }>
108
- { __( 'Return to Dashboard', 'newspack' ) }
108
+ { __( 'Return to Dashboard', 'newspack-plugin' ) }
109
109
  </Button>
110
110
  </Card>
111
111
  </Modal>
@@ -219,7 +219,7 @@ export default function withWizard( WrappedComponent, requiredPlugins ) {
219
219
  <Button
220
220
  isLink
221
221
  href={ newspack_urls.dashboard }
222
- label={ __( 'Return to Dashboard', 'newspack' ) }
222
+ label={ __( 'Return to Dashboard', 'newspack-plugin' ) }
223
223
  showTooltip={ true }
224
224
  icon={ home }
225
225
  iconSize={ 36 }
@@ -229,8 +229,8 @@ export default function withWizard( WrappedComponent, requiredPlugins ) {
229
229
  <div>
230
230
  <h2>
231
231
  { requiredPlugins.length > 1
232
- ? __( 'Required plugins', 'newspack' )
233
- : __( 'Required plugin', 'newspack' ) }
232
+ ? __( 'Required plugins', 'newspack-plugin' )
233
+ : __( 'Required plugin', 'newspack-plugin' ) }
234
234
  </h2>
235
235
  </div>
236
236
  </div>
@@ -66,7 +66,7 @@ export default function withWizardScreen( WrappedComponent, { hidePrimaryButton
66
66
  <Button
67
67
  isLink
68
68
  href={ newspack_urls.dashboard }
69
- label={ __( 'Return to Dashboard', 'newspack' ) }
69
+ label={ __( 'Return to Dashboard', 'newspack-plugin' ) }
70
70
  showTooltip={ true }
71
71
  icon={ category }
72
72
  iconSize={ 36 }
@@ -41,7 +41,7 @@ const WizardError = () => {
41
41
  { fallbackURL && (
42
42
  <Card buttonsCard noBorder className="justify-end">
43
43
  <Button isPrimary href={ fallbackURL }>
44
- { __( 'Return to Dashboard', 'newspack' ) }
44
+ { __( 'Return to Dashboard', 'newspack-plugin' ) }
45
45
  </Button>
46
46
  </Card>
47
47
  ) }
@@ -57,8 +57,8 @@ const Wizard = ( {
57
57
  if ( ! pluginRequirementsSatisfied ) {
58
58
  headerText =
59
59
  requiredPlugins.length > 1
60
- ? __( 'Required plugins', 'newspack' )
61
- : __( 'Required plugin', 'newspack' );
60
+ ? __( 'Required plugins', 'newspack-plugin' )
61
+ : __( 'Required plugin', 'newspack-plugin' );
62
62
  displayedSections = [
63
63
  {
64
64
  path: '/',
@@ -90,7 +90,7 @@ const Wizard = ( {
90
90
  <Button
91
91
  isLink
92
92
  href={ newspack_urls.dashboard }
93
- label={ __( 'Return to Dashboard', 'newspack' ) }
93
+ label={ __( 'Return to Dashboard', 'newspack-plugin' ) }
94
94
  showTooltip={ true }
95
95
  icon={ category }
96
96
  iconSize={ 36 }
@@ -59,17 +59,24 @@ const actions = {
59
59
  setError: createAction( 'SET_ERROR' ),
60
60
 
61
61
  // Async actions. These will not show up in Redux devtools.
62
- *saveWizardSettings( { slug, section = '', payloadPath = false, updatePayload = null } ) {
62
+ *saveWizardSettings( {
63
+ slug,
64
+ section = '',
65
+ payloadPath = false,
66
+ auxData = {},
67
+ updatePayload = null,
68
+ } ) {
63
69
  // Optionally data can be updated before saving - an immediate update case
64
70
  // (without an explicit "save" action).
65
71
  if ( updatePayload ) {
66
72
  yield actions.updateWizardSettings( { slug, ...updatePayload } );
67
73
  }
68
74
  const wizardState = select( WIZARD_STORE_NAMESPACE ).getWizardAPIData( slug );
75
+ const data = payloadPath ? get( wizardState, payloadPath ) : wizardState;
69
76
  const updatedData = yield actions.fetchFromAPI( {
70
77
  path: `/newspack/v1/wizard/${ slug }/${ section }`,
71
78
  method: 'POST',
72
- data: payloadPath ? get( wizardState, payloadPath ) : wizardState,
79
+ data: { ...data, ...auxData },
73
80
  isQuietFetch: true,
74
81
  } );
75
82
  if ( ! isEmpty( updatedData ) && ! updatedData.error ) {
@@ -1,46 +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 _element = require("@wordpress/element");
9
- var _icons = require("@wordpress/icons");
10
- var _classnames = _interopRequireDefault(require("classnames"));
11
- require("./style.scss");
12
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
13
- /**
14
- * WordPress dependencies
15
- */
16
-
17
- /**
18
- * External dependencies
19
- */
20
-
21
- /**
22
- * Internal dependencies
23
- */
24
-
25
- const Accordion = _ref => {
26
- let {
27
- children,
28
- title
29
- } = _ref;
30
- const [isOpen, setIsOpen] = (0, _element.useState)(false);
31
- return (0, _jsxRuntime.jsxs)("details", {
32
- className: (0, _classnames.default)('newspack-accordion', {
33
- 'newspack-accordion--is-open': isOpen
34
- }),
35
- children: [(0, _jsxRuntime.jsxs)("summary", {
36
- onClick: () => setIsOpen(!isOpen),
37
- children: [title, (0, _jsxRuntime.jsx)(_icons.Icon, {
38
- className: "newspack-accordion__icon",
39
- icon: _icons.chevronRight,
40
- size: 24
41
- })]
42
- }), children]
43
- });
44
- };
45
- var _default = Accordion;
46
- exports.default = _default;
@@ -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,41 +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 _reactDaterangePicker = _interopRequireDefault(require("react-daterange-picker"));
9
- var _moment = _interopRequireDefault(require("moment"));
10
- var _momentRange = require("moment-range");
11
- require("react-daterange-picker/dist/css/react-calendar.css");
12
- require("./style.scss");
13
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
14
- /**
15
- * External dependencies.
16
- */
17
-
18
- /**
19
- * Internal dependencies.
20
- */
21
-
22
- const moment = (0, _momentRange.extendMoment)(_moment.default);
23
- const DateRangePicker = _ref => {
24
- let {
25
- start,
26
- end,
27
- onChange
28
- } = _ref;
29
- return (0, _jsxRuntime.jsx)(_reactDaterangePicker.default, {
30
- value: moment.range(moment(start), moment(end)),
31
- firstOfWeek: 1,
32
- onSelect: range => {
33
- onChange({
34
- start: range.start._d,
35
- end: range.end._d
36
- });
37
- }
38
- });
39
- };
40
- var _default = DateRangePicker;
41
- exports.default = _default;
@@ -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,38 +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
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
17
- import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
18
- const Accordion = _ref => {
19
- let {
20
- children,
21
- title
22
- } = _ref;
23
- const [isOpen, setIsOpen] = useState(false);
24
- return _jsxs("details", {
25
- className: classNames('newspack-accordion', {
26
- 'newspack-accordion--is-open': isOpen
27
- }),
28
- children: [_jsxs("summary", {
29
- onClick: () => setIsOpen(!isOpen),
30
- children: [title, _jsx(Icon, {
31
- className: "newspack-accordion__icon",
32
- icon: chevronRight,
33
- size: 24
34
- })]
35
- }), children]
36
- });
37
- };
38
- 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,32 +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
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
14
- const moment = extendMoment(origMoment);
15
- const DateRangePicker = _ref => {
16
- let {
17
- start,
18
- end,
19
- onChange
20
- } = _ref;
21
- return _jsx(ReactDateRangePicker, {
22
- value: moment.range(moment(start), moment(end)),
23
- firstOfWeek: 1,
24
- onSelect: range => {
25
- onChange({
26
- start: range.start._d,
27
- end: range.end._d
28
- });
29
- }
30
- });
31
- };
32
- export default DateRangePicker;