newspack-components 2.2.0 → 2.2.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.
@@ -1,71 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _element = require("@wordpress/element");
11
-
12
- var _ = require("../");
13
-
14
- require("./style.scss");
15
-
16
- var _classnames = _interopRequireDefault(require("classnames"));
17
-
18
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
19
-
20
- /**
21
- * Toggle Group
22
- */
23
-
24
- /**
25
- * WordPress dependencies.
26
- */
27
-
28
- /**
29
- * Internal dependencies.
30
- */
31
-
32
- /**
33
- * External dependencies.
34
- */
35
- class ToggleGroup extends _element.Component {
36
- /**
37
- * Render.
38
- */
39
- render() {
40
- const {
41
- checked,
42
- children,
43
- description,
44
- onChange,
45
- title,
46
- className
47
- } = this.props;
48
- const classes = (0, _classnames.default)('newspack-toggle-group', className);
49
- return (0, _jsxRuntime.jsxs)("div", {
50
- className: classes,
51
- children: [(0, _jsxRuntime.jsx)(_.ToggleControl, {
52
- checked: checked || false,
53
- onChange: onChange
54
- }), (0, _jsxRuntime.jsxs)("div", {
55
- className: "newspack-toggle-group__description",
56
- children: [(0, _jsxRuntime.jsx)("p", {
57
- className: "is-dark",
58
- children: (0, _jsxRuntime.jsx)("strong", {
59
- children: title
60
- })
61
- }), (0, _jsxRuntime.jsx)("p", {
62
- children: description
63
- }), checked && children]
64
- })]
65
- });
66
- }
67
-
68
- }
69
-
70
- var _default = ToggleGroup;
71
- exports.default = _default;
@@ -1,28 +0,0 @@
1
- /**
2
- * Toggle Group
3
- */
4
-
5
- .newspack-toggle-group {
6
- display: flex;
7
- margin: 32px 0;
8
-
9
- & &__description p {
10
- margin-bottom: 0;
11
- margin-top: 0;
12
- }
13
-
14
- .newspack-toggle-control {
15
- margin: 0;
16
- }
17
-
18
- &__description {
19
- flex: 1;
20
- }
21
-
22
- // Multiple Toogle Groups
23
-
24
- & + & {
25
- margin-bottom: 32px;
26
- margin-top: -16px;
27
- }
28
- }
@@ -1,148 +0,0 @@
1
- @import '~@wordpress/base-styles/colors';
2
- @import '../../../shared/scss/colors';
3
-
4
- .newspack-wizard {
5
- &__title {
6
- align-items: center;
7
- border-bottom: 1px solid $gray-300;
8
- display: flex;
9
-
10
- h1 {
11
- color: $gray-900;
12
- font-size: 21px;
13
- line-height: 30px;
14
- margin: 0;
15
- padding: 0 24px;
16
- }
17
-
18
- svg {
19
- fill: white;
20
- margin: 0 !important;
21
-
22
- &.newspack-icon {
23
- flex: 0 0 36px;
24
- margin-bottom: -1px !important;
25
- }
26
-
27
- &:not( .newspack-icon ) {
28
- background: $primary-500;
29
- left: 50%;
30
- margin: -18px 0 0 -18px !important;
31
- opacity: 0;
32
- position: absolute;
33
- top: 50%;
34
- transition: opacity 125ms ease-in-out;
35
- }
36
- }
37
-
38
- a {
39
- position: relative;
40
-
41
- &:hover {
42
- svg {
43
- opacity: 1;
44
- }
45
- }
46
- }
47
-
48
- a:focus-visible {
49
- outline: none !important;
50
-
51
- &::before {
52
- border: 2px solid white;
53
- border-radius: 3px;
54
- bottom: 5px;
55
- content: '';
56
- display: block;
57
- left: 6px;
58
- position: absolute;
59
- right: 6px;
60
- top: 6px;
61
- }
62
- }
63
- }
64
-
65
- &__content {
66
- color: $gray-700;
67
- font-size: 14px;
68
- line-height: 24px;
69
- margin: 0 auto;
70
- max-width: 1208px;
71
- padding: 0 16px;
72
-
73
- @media screen and ( min-width: 744px ) {
74
- padding: 32px 84px;
75
- }
76
-
77
- // Typography
78
-
79
- h1,
80
- h2,
81
- h3,
82
- p {
83
- line-height: 24px;
84
- margin: 32px 0;
85
- padding: 0;
86
- }
87
-
88
- h1 {
89
- color: $gray-900;
90
- font-size: 21px;
91
- font-weight: bold;
92
- line-height: 32px;
93
- }
94
-
95
- h2 {
96
- color: $gray-900;
97
- font-size: 17px;
98
- font-weight: bold;
99
- }
100
-
101
- h3 {
102
- color: $gray-900;
103
- font-size: 14px;
104
- font-weight: bold;
105
- }
106
-
107
- p {
108
- font-size: 14px;
109
-
110
- &.is-dark {
111
- color: $gray-900;
112
- }
113
- }
114
-
115
- strong {
116
- font-weight: bold;
117
- }
118
-
119
- small {
120
- font-size: 12px;
121
- line-height: 16px;
122
- }
123
-
124
- // Links
125
-
126
- a {
127
- color: $primary-500;
128
-
129
- &:active,
130
- &:focus,
131
- &:hover {
132
- color: $primary-600;
133
- text-decoration: none;
134
- }
135
-
136
- &:focus {
137
- box-shadow: none;
138
- outline: 2px solid $primary-500;
139
- outline-offset: 2px;
140
- }
141
- }
142
- }
143
-
144
- &__above-header {
145
- border-radius: 0;
146
- margin: 0;
147
- }
148
- }
@@ -1,43 +0,0 @@
1
- /**
2
- * WordPress dependencies.
3
- */
4
- import { Component } from '@wordpress/element';
5
- import { ButtonGroup as BaseComponent } from '@wordpress/components';
6
- /**
7
- * Internal dependencies
8
- */
9
-
10
- import './style.scss';
11
- /**
12
- * External dependencies
13
- */
14
-
15
- import classnames from 'classnames';
16
- /**
17
- * Button Group.
18
- */
19
-
20
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
21
-
22
- class ButtonGroup extends Component {
23
- /**
24
- * Render.
25
- */
26
- render() {
27
- const {
28
- className,
29
- noMargin,
30
- ...otherProps
31
- } = this.props;
32
- const classes = classnames('newspack-button-group', {
33
- 'newspack-button-group--no-margin': noMargin
34
- }, className);
35
- return _jsx(BaseComponent, {
36
- className: classes,
37
- ...otherProps
38
- });
39
- }
40
-
41
- }
42
-
43
- export default ButtonGroup;
@@ -1,73 +0,0 @@
1
- /**
2
- * Button Group
3
- */
4
-
5
- @import '../../../shared/scss/colors';
6
- @import '~@wordpress/base-styles/colors';
7
-
8
- .newspack-button-group {
9
- display: block;
10
- &:not( .newspack-button-group--no-margin ) {
11
- margin: 32px 0;
12
- }
13
-
14
- .newspack-button {
15
- padding: 11px 17px !important;
16
- &:active,
17
- &:focus,
18
- &:hover,
19
- &.is-pressed {
20
- position: relative;
21
- }
22
-
23
- &.is-pressed {
24
- position: relative;
25
- z-index: 2;
26
- background-color: white !important;
27
- color: $gray-900 !important;
28
- border: none !important;
29
- &:focus {
30
- box-shadow: 0 0 0 1px white, 0 0 0 2px $primary-500 !important;
31
- }
32
- &:active,
33
- &:hover {
34
- background: $gray-100 !important;
35
- color: $primary-500 !important;
36
- }
37
- &::after {
38
- content: '';
39
- position: absolute;
40
- top: 0;
41
- left: 0;
42
- width: calc( 100% - 6px );
43
- height: calc( 100% - 6px );
44
- border: 3px solid $primary-500;
45
- }
46
- }
47
- }
48
- }
49
-
50
- body[class*='admin-color-'] {
51
- .newspack-button-group {
52
- .newspack-button {
53
- border-radius: 0;
54
- box-shadow: none;
55
-
56
- &:first-child {
57
- &,
58
- &::after {
59
- border-bottom-left-radius: 3px;
60
- border-top-left-radius: 3px;
61
- }
62
- }
63
-
64
- &:last-child {
65
- &,
66
- &::after {
67
- border-bottom-right-radius: 3px;
68
- border-top-right-radius: 3px;
69
- }
70
- }
71
- }
72
- }
73
- }
@@ -1,49 +0,0 @@
1
- /**
2
- * Checkbox Control
3
- */
4
-
5
- /**
6
- * WordPress dependencies
7
- */
8
- import { Component } from '@wordpress/element';
9
- import { CheckboxControl as BaseComponent } from '@wordpress/components';
10
- /**
11
- * Internal dependencies
12
- */
13
-
14
- import { InfoButton } from '../';
15
- import './style.scss';
16
- /**
17
- * External dependencies
18
- */
19
-
20
- import classnames from 'classnames';
21
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
22
- import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
23
-
24
- class CheckboxControl extends Component {
25
- /**
26
- * Render.
27
- */
28
- render() {
29
- const {
30
- className,
31
- checked,
32
- tooltip,
33
- ...otherProps
34
- } = this.props;
35
- const classes = classnames('newspack-checkbox-control', className);
36
- return _jsxs("div", {
37
- className: classes,
38
- children: [_jsx(BaseComponent, {
39
- checked: Boolean(checked),
40
- ...otherProps
41
- }), tooltip && _jsx(InfoButton, {
42
- text: tooltip
43
- })]
44
- });
45
- }
46
-
47
- }
48
-
49
- export default CheckboxControl;
@@ -1,78 +0,0 @@
1
- /**
2
- * Checkbox styles.
3
- */
4
-
5
- @import '../../../shared/scss/colors';
6
- @import '~@wordpress/base-styles/colors';
7
-
8
- .newspack-checkbox-control {
9
- color: $gray-700;
10
- display: flex;
11
- font-size: 14px;
12
- line-height: 24px;
13
- margin: 32px 0;
14
-
15
- label {
16
- color: inherit;
17
- font-size: inherit;
18
- line-height: inherit;
19
- margin: 0;
20
- }
21
-
22
- .components-checkbox-control__input-container {
23
- display: block;
24
- margin: 0;
25
- margin-right: 8px;
26
-
27
- @media screen and ( min-width: 600px ) {
28
- margin-bottom: 2px;
29
- margin-top: 2px;
30
- }
31
- }
32
-
33
- .components-checkbox-control__input[type='checkbox'] {
34
- margin: 0;
35
-
36
- &:checked {
37
- background-color: $primary-500;
38
- border-color: $primary-500;
39
- }
40
-
41
- &:focus {
42
- border-color: $primary-500;
43
- box-shadow: 0 0 0 2px white, 0 0 0 3.5px $primary-500;
44
- }
45
- }
46
-
47
- .components-base-control__help {
48
- color: inherit;
49
- font-size: inherit;
50
- font-style: italic;
51
- line-height: inherit;
52
- margin: 0;
53
- margin-left: 28px;
54
- }
55
-
56
- // Multiple Checkbox Controls
57
-
58
- & + & {
59
- margin-top: -16px;
60
- }
61
-
62
- // Reset
63
-
64
- .components-base-control {
65
- font-size: inherit;
66
- line-height: inherit;
67
- }
68
-
69
- .components-base-control__field {
70
- display: flex;
71
- margin: 0;
72
- }
73
-
74
- .components-base-control__label {
75
- display: block;
76
- margin: 0;
77
- }
78
- }
@@ -1,30 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { __ as alias__ } from '@wordpress/i18n';
5
- /**
6
- * Internal dependencies
7
- */
8
-
9
- const __ = alias__;
10
- import './style.scss';
11
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
- import { jsxs as _jsxs } from "@emotion/react/jsx-runtime";
13
-
14
- const PreviewBox = _ref => {
15
- let {
16
- children
17
- } = _ref;
18
- return _jsxs("div", {
19
- className: "newspack-preview-box",
20
- children: [_jsx("div", {
21
- className: "newspack-preview-box__label",
22
- children: __('Preview', 'newspack')
23
- }), _jsx("div", {
24
- className: "newspack-preview-box__content",
25
- children: children
26
- })]
27
- });
28
- };
29
-
30
- export default PreviewBox;
@@ -1,18 +0,0 @@
1
- @import '../../../shared/scss/colors';
2
- @import '~@wordpress/base-styles/colors';
3
-
4
- .newspack-preview-box {
5
- margin: 32px 0;
6
-
7
- &__label {
8
- color: $gray-900;
9
- font-weight: bold;
10
- }
11
-
12
- &__content {
13
- background: $gray-100;
14
- border: 1px solid $gray-300;
15
- border-radius: 3px;
16
- padding: 11px 8px;
17
- }
18
- }
@@ -1,40 +0,0 @@
1
- /**
2
- * Textarea Control
3
- */
4
-
5
- /**
6
- * WordPress dependencies
7
- */
8
- import { TextareaControl as BaseComponent } from '@wordpress/components';
9
- import { Component } from '@wordpress/element';
10
- /**
11
- * Internal dependencies
12
- */
13
-
14
- import './style.scss';
15
- /**
16
- * External dependencies
17
- */
18
-
19
- import classnames from 'classnames';
20
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
21
-
22
- class TextareaControl extends Component {
23
- /**
24
- * Render.
25
- */
26
- render() {
27
- const {
28
- className,
29
- ...otherProps
30
- } = this.props;
31
- const classes = classnames('newspack-textarea-control', className);
32
- return _jsx(BaseComponent, {
33
- className: classes,
34
- ...otherProps
35
- });
36
- }
37
-
38
- }
39
-
40
- export default TextareaControl;
@@ -1,76 +0,0 @@
1
- /**
2
- * Textarea Control
3
- */
4
-
5
- @import '../../../shared/scss/colors';
6
- @import '~@wordpress/base-styles/colors';
7
-
8
- .newspack-textarea-control {
9
- color: $gray-700;
10
- font-size: 14px;
11
- line-height: 24px;
12
- margin: 32px 0;
13
-
14
- label {
15
- color: $gray-900;
16
- font-size: 14px;
17
- font-weight: bold;
18
- line-height: 24px;
19
- margin: 0;
20
- }
21
-
22
- textarea {
23
- background: white;
24
- border: 1px solid $gray-300;
25
- border-radius: 3px;
26
- box-shadow: none;
27
- color: inherit;
28
- display: block;
29
- font-size: 16px;
30
- line-height: inherit;
31
- margin: 0;
32
- min-height: 48px;
33
- padding: 11px 8px;
34
- transition: border-color 125ms ease-in-out, box-shadow 125ms ease-in-out;
35
- width: 100%;
36
-
37
- @media screen and ( min-width: 768px ) {
38
- font-size: 14px;
39
- }
40
-
41
- &:focus {
42
- border-color: $primary-500;
43
- box-shadow: inset 0 0 0 2px $primary-500;
44
- }
45
-
46
- &:disabled,
47
- &.disabled {
48
- background: $gray-100;
49
- color: $gray-600;
50
- cursor: not-allowed;
51
- }
52
- }
53
-
54
- // Multiple Textarea Controls
55
-
56
- & + & {
57
- margin-bottom: 32px;
58
- margin-top: -24px;
59
- }
60
-
61
- // Multiple Controls
62
-
63
- + .newspack-select-control,
64
- + .newspack-text-control {
65
- margin-bottom: 32px;
66
- margin-top: -24px;
67
- }
68
-
69
- // Reset
70
-
71
- .components-base-control__field,
72
- .components-base-control__label {
73
- display: block;
74
- margin: 0;
75
- }
76
- }
@@ -1,44 +0,0 @@
1
- /**
2
- * Toggle Control
3
- */
4
-
5
- /**
6
- * WordPress dependencies
7
- */
8
- import { ToggleControl as BaseComponent } from '@wordpress/components';
9
- import { Component } from '@wordpress/element';
10
- /**
11
- * Internal dependencies
12
- */
13
-
14
- import './style.scss';
15
- /**
16
- * External dependencies
17
- */
18
-
19
- import classNames from 'classnames';
20
- import { jsx as _jsx } from "@emotion/react/jsx-runtime";
21
-
22
- class ToggleControl extends Component {
23
- /**
24
- * Render.
25
- */
26
- render() {
27
- const {
28
- className,
29
- isDark,
30
- checked,
31
- ...otherProps
32
- } = this.props;
33
- const classes = classNames('newspack-toggle-control', isDark && 'newspack-toggle-control--is-dark', // NOTE: disabled prop is handled in more recent Gutenberg versions. This special handling can be removed once that's in Core.
34
- otherProps.disabled && 'newspack-toggle-control--is-disabled', className);
35
- return _jsx(BaseComponent, {
36
- className: classes,
37
- checked: Boolean(checked),
38
- ...otherProps
39
- });
40
- }
41
-
42
- }
43
-
44
- export default ToggleControl;