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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newspack-components",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "Newspack design system components",
5
5
  "author": "Automattic",
6
6
  "license": "GPL-2.0-or-later",
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import { isFunction, isString, isObject } from 'lodash';
4
+ import isFunction from 'lodash/isFunction';
5
+ import isObject from 'lodash/isObject';
6
+ import isString from 'lodash/isString';
5
7
 
6
8
  /**
7
9
  * Creates button props based on an action
@@ -1,3 +1,4 @@
1
+ // HEX
1
2
  $primary-000: #f5fdff;
2
3
  $primary-050: #d6f6ff;
3
4
  $primary-100: #b4e4ff;
@@ -10,3 +11,17 @@ $primary-700: #1522af;
10
11
  $primary-800: #0b0b8d;
11
12
  $primary-900: #0d046e;
12
13
  $primary-950: #0e0052;
14
+
15
+ // RGB
16
+ $primary-000--rgb: 245, 253, 255;
17
+ $primary-050--rgb: 214, 246, 255;
18
+ $primary-100--rgb: 180, 228, 255;
19
+ $primary-200--rgb: 147, 204, 253;
20
+ $primary-300--rgb: 114, 175, 251;
21
+ $primary-400--rgb: 82, 141, 252;
22
+ $primary-500--rgb: 51, 102, 255;
23
+ $primary-600--rgb: 34, 64, 213;
24
+ $primary-700--rgb: 21, 34, 175;
25
+ $primary-800--rgb: 11, 11, 141;
26
+ $primary-900--rgb: 13, 4, 110;
27
+ $primary-950--rgb: 14, 0, 82;
@@ -0,0 +1,12 @@
1
+ @mixin visuallyHidden {
2
+ border: 0;
3
+ clip: rect( 1px, 1px, 1px, 1px );
4
+ clip-path: inset( 50% );
5
+ width: 1px;
6
+ height: 1px;
7
+ margin: -1px;
8
+ overflow: hidden;
9
+ padding: 0;
10
+ position: absolute !important;
11
+ word-wrap: normal !important; /* Many screen reader and browser combinations announce broken words as they would appear visually. */
12
+ }
@@ -1,57 +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 _components = require("@wordpress/components");
13
-
14
- require("./style.scss");
15
-
16
- var _classnames = _interopRequireDefault(require("classnames"));
17
-
18
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
19
-
20
- /**
21
- * WordPress dependencies.
22
- */
23
-
24
- /**
25
- * Internal dependencies
26
- */
27
-
28
- /**
29
- * External dependencies
30
- */
31
-
32
- /**
33
- * Button Group.
34
- */
35
- class ButtonGroup extends _element.Component {
36
- /**
37
- * Render.
38
- */
39
- render() {
40
- const {
41
- className,
42
- noMargin,
43
- ...otherProps
44
- } = this.props;
45
- const classes = (0, _classnames.default)('newspack-button-group', {
46
- 'newspack-button-group--no-margin': noMargin
47
- }, className);
48
- return (0, _jsxRuntime.jsx)(_components.ButtonGroup, {
49
- className: classes,
50
- ...otherProps
51
- });
52
- }
53
-
54
- }
55
-
56
- var _default = ButtonGroup;
57
- exports.default = _default;
@@ -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,63 +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 _components = require("@wordpress/components");
13
-
14
- var _ = require("../");
15
-
16
- require("./style.scss");
17
-
18
- var _classnames = _interopRequireDefault(require("classnames"));
19
-
20
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
21
-
22
- /**
23
- * Checkbox Control
24
- */
25
-
26
- /**
27
- * WordPress dependencies
28
- */
29
-
30
- /**
31
- * Internal dependencies
32
- */
33
-
34
- /**
35
- * External dependencies
36
- */
37
- class CheckboxControl extends _element.Component {
38
- /**
39
- * Render.
40
- */
41
- render() {
42
- const {
43
- className,
44
- checked,
45
- tooltip,
46
- ...otherProps
47
- } = this.props;
48
- const classes = (0, _classnames.default)('newspack-checkbox-control', className);
49
- return (0, _jsxRuntime.jsxs)("div", {
50
- className: classes,
51
- children: [(0, _jsxRuntime.jsx)(_components.CheckboxControl, {
52
- checked: Boolean(checked),
53
- ...otherProps
54
- }), tooltip && (0, _jsxRuntime.jsx)(_.InfoButton, {
55
- text: tooltip
56
- })]
57
- });
58
- }
59
-
60
- }
61
-
62
- var _default = CheckboxControl;
63
- exports.default = _default;
@@ -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,36 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _i18n = require("@wordpress/i18n");
9
-
10
- require("./style.scss");
11
-
12
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
13
-
14
- /**
15
- * WordPress dependencies
16
- */
17
- const __ = _i18n.__;
18
-
19
- const PreviewBox = _ref => {
20
- let {
21
- children
22
- } = _ref;
23
- return (0, _jsxRuntime.jsxs)("div", {
24
- className: "newspack-preview-box",
25
- children: [(0, _jsxRuntime.jsx)("div", {
26
- className: "newspack-preview-box__label",
27
- children: __('Preview', 'newspack')
28
- }), (0, _jsxRuntime.jsx)("div", {
29
- className: "newspack-preview-box__content",
30
- children: children
31
- })]
32
- });
33
- };
34
-
35
- var _default = PreviewBox;
36
- exports.default = _default;
@@ -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,54 +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 _components = require("@wordpress/components");
11
-
12
- var _element = require("@wordpress/element");
13
-
14
- require("./style.scss");
15
-
16
- var _classnames = _interopRequireDefault(require("classnames"));
17
-
18
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
19
-
20
- /**
21
- * Textarea Control
22
- */
23
-
24
- /**
25
- * WordPress dependencies
26
- */
27
-
28
- /**
29
- * Internal dependencies
30
- */
31
-
32
- /**
33
- * External dependencies
34
- */
35
- class TextareaControl extends _element.Component {
36
- /**
37
- * Render.
38
- */
39
- render() {
40
- const {
41
- className,
42
- ...otherProps
43
- } = this.props;
44
- const classes = (0, _classnames.default)('newspack-textarea-control', className);
45
- return (0, _jsxRuntime.jsx)(_components.TextareaControl, {
46
- className: classes,
47
- ...otherProps
48
- });
49
- }
50
-
51
- }
52
-
53
- var _default = TextareaControl;
54
- exports.default = _default;
@@ -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,58 +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 _components = require("@wordpress/components");
11
-
12
- var _element = require("@wordpress/element");
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 Control
22
- */
23
-
24
- /**
25
- * WordPress dependencies
26
- */
27
-
28
- /**
29
- * Internal dependencies
30
- */
31
-
32
- /**
33
- * External dependencies
34
- */
35
- class ToggleControl extends _element.Component {
36
- /**
37
- * Render.
38
- */
39
- render() {
40
- const {
41
- className,
42
- isDark,
43
- checked,
44
- ...otherProps
45
- } = this.props;
46
- const classes = (0, _classnames.default)('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.
47
- otherProps.disabled && 'newspack-toggle-control--is-disabled', className);
48
- return (0, _jsxRuntime.jsx)(_components.ToggleControl, {
49
- className: classes,
50
- checked: Boolean(checked),
51
- ...otherProps
52
- });
53
- }
54
-
55
- }
56
-
57
- var _default = ToggleControl;
58
- exports.default = _default;
@@ -1,74 +0,0 @@
1
- /**
2
- * Toggle Control
3
- */
4
-
5
- @import '../../../shared/scss/colors';
6
- @import '~@wordpress/base-styles/colors';
7
-
8
- .newspack-toggle-control {
9
- margin: 32px 0;
10
-
11
- .components-base-control__field {
12
- align-items: flex-start;
13
- margin: 0;
14
-
15
- .components-toggle-control__label {
16
- color: $gray-700;
17
- font-size: 14px;
18
- line-height: 24px;
19
- margin: 0;
20
- }
21
-
22
- .components-form-toggle {
23
- margin: 3px 8px 3px 0;
24
-
25
- &.is-checked {
26
- .components-form-toggle__track {
27
- background: $primary-500;
28
- border-color: transparent;
29
- }
30
- }
31
- }
32
- }
33
-
34
- // Is Dark
35
-
36
- &.newspack-toggle-control--is-dark {
37
- .components-base-control__field label {
38
- color: $gray-900;
39
- font-weight: bold;
40
- }
41
-
42
- .components-base-control__help {
43
- font-style: normal;
44
- }
45
- }
46
-
47
- // Is disabled
48
-
49
- &.newspack-toggle-control--is-disabled {
50
- opacity: 0.5;
51
- pointer-events: none;
52
- }
53
-
54
- // Focus
55
-
56
- .components-form-toggle__input:focus {
57
- + .components-form-toggle__track {
58
- box-shadow: 0 0 0 2px white, 0 0 0 4px $primary-500;
59
- }
60
- }
61
-
62
- // Multiple Toggle Controls
63
-
64
- & + & {
65
- margin-bottom: 32px;
66
- margin-top: -24px;
67
- }
68
-
69
- // Reset
70
-
71
- .components-base-control__help {
72
- margin: 0 0 0 44px;
73
- }
74
- }