@khanacademy/wonder-blocks-toolbar 2.1.25

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Khan Academy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,99 @@
1
+ import { Component, createElement } from 'react';
2
+ import { StyleSheet } from 'aphrodite';
3
+ import Color from '@khanacademy/wonder-blocks-color';
4
+ import { View } from '@khanacademy/wonder-blocks-core';
5
+ import { LabelSmall, LabelLarge, HeadingSmall } from '@khanacademy/wonder-blocks-typography';
6
+
7
+ /*
8
+ * A toolbar component that often acts as a container header.
9
+ */
10
+ class Toolbar extends Component {
11
+ render() {
12
+ const {
13
+ color,
14
+ leftContent,
15
+ rightContent,
16
+ size,
17
+ subtitle,
18
+ title
19
+ } = this.props;
20
+ const TitleComponent = subtitle ? LabelLarge : HeadingSmall;
21
+ return /*#__PURE__*/createElement(View, {
22
+ style: [sharedStyles.container, color === "dark" && sharedStyles.dark, size === "small" && sharedStyles.small]
23
+ }, /*#__PURE__*/createElement(View, {
24
+ style: sharedStyles.column
25
+ }, /*#__PURE__*/createElement(View, {
26
+ style: sharedStyles.leftColumn
27
+ }, leftContent)), title && /*#__PURE__*/createElement(View, {
28
+ style: [sharedStyles.column, sharedStyles.wideColumn]
29
+ }, /*#__PURE__*/createElement(View, {
30
+ style: [sharedStyles.titles, sharedStyles.verticalAlign, sharedStyles.center]
31
+ }, /*#__PURE__*/createElement(TitleComponent, {
32
+ id: "wb-toolbar-title"
33
+ }, title), subtitle && /*#__PURE__*/createElement(LabelSmall, {
34
+ style: color === "light" && sharedStyles.subtitle
35
+ }, subtitle))), /*#__PURE__*/createElement(View, {
36
+ style: sharedStyles.column
37
+ }, /*#__PURE__*/createElement(View, {
38
+ style: sharedStyles.rightColumn
39
+ }, rightContent)));
40
+ }
41
+
42
+ }
43
+ Toolbar.defaultProps = {
44
+ color: "light",
45
+ leftContent: null,
46
+ rightContent: null,
47
+ size: "medium"
48
+ };
49
+ const sharedStyles = StyleSheet.create({
50
+ container: {
51
+ border: "1px solid rgba(33, 36, 44, 0.16)",
52
+ display: "flex",
53
+ flexDirection: "row",
54
+ minHeight: 66,
55
+ paddingLeft: 16,
56
+ paddingRight: 16,
57
+ position: "relative",
58
+ width: "100%"
59
+ },
60
+ small: {
61
+ minHeight: 50
62
+ },
63
+ dark: {
64
+ backgroundColor: Color.darkBlue,
65
+ boxShadow: "0 1px 0 0 rgba(255, 255, 255, 0.64)",
66
+ color: "white"
67
+ },
68
+ verticalAlign: {
69
+ justifyContent: "center"
70
+ },
71
+ column: {
72
+ flex: 1,
73
+ justifyContent: "center"
74
+ },
75
+ wideColumn: {
76
+ flexBasis: "50%"
77
+ },
78
+ leftColumn: {
79
+ alignItems: "center",
80
+ flexDirection: "row",
81
+ justifyContent: "flex-start"
82
+ },
83
+ rightColumn: {
84
+ alignItems: "center",
85
+ flexDirection: "row",
86
+ justifyContent: "flex-end"
87
+ },
88
+ center: {
89
+ textAlign: "center"
90
+ },
91
+ subtitle: {
92
+ color: "rgba(33, 36, 44, 0.64)"
93
+ },
94
+ titles: {
95
+ padding: 12
96
+ }
97
+ });
98
+
99
+ export default Toolbar;
package/dist/index.js ADDED
@@ -0,0 +1,247 @@
1
+ module.exports =
2
+ /******/ (function(modules) { // webpackBootstrap
3
+ /******/ // The module cache
4
+ /******/ var installedModules = {};
5
+ /******/
6
+ /******/ // The require function
7
+ /******/ function __webpack_require__(moduleId) {
8
+ /******/
9
+ /******/ // Check if module is in cache
10
+ /******/ if(installedModules[moduleId]) {
11
+ /******/ return installedModules[moduleId].exports;
12
+ /******/ }
13
+ /******/ // Create a new module (and put it into the cache)
14
+ /******/ var module = installedModules[moduleId] = {
15
+ /******/ i: moduleId,
16
+ /******/ l: false,
17
+ /******/ exports: {}
18
+ /******/ };
19
+ /******/
20
+ /******/ // Execute the module function
21
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22
+ /******/
23
+ /******/ // Flag the module as loaded
24
+ /******/ module.l = true;
25
+ /******/
26
+ /******/ // Return the exports of the module
27
+ /******/ return module.exports;
28
+ /******/ }
29
+ /******/
30
+ /******/
31
+ /******/ // expose the modules object (__webpack_modules__)
32
+ /******/ __webpack_require__.m = modules;
33
+ /******/
34
+ /******/ // expose the module cache
35
+ /******/ __webpack_require__.c = installedModules;
36
+ /******/
37
+ /******/ // define getter function for harmony exports
38
+ /******/ __webpack_require__.d = function(exports, name, getter) {
39
+ /******/ if(!__webpack_require__.o(exports, name)) {
40
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
41
+ /******/ }
42
+ /******/ };
43
+ /******/
44
+ /******/ // define __esModule on exports
45
+ /******/ __webpack_require__.r = function(exports) {
46
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48
+ /******/ }
49
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
50
+ /******/ };
51
+ /******/
52
+ /******/ // create a fake namespace object
53
+ /******/ // mode & 1: value is a module id, require it
54
+ /******/ // mode & 2: merge all properties of value into the ns
55
+ /******/ // mode & 4: return value when already ns object
56
+ /******/ // mode & 8|1: behave like require
57
+ /******/ __webpack_require__.t = function(value, mode) {
58
+ /******/ if(mode & 1) value = __webpack_require__(value);
59
+ /******/ if(mode & 8) return value;
60
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
61
+ /******/ var ns = Object.create(null);
62
+ /******/ __webpack_require__.r(ns);
63
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
64
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
65
+ /******/ return ns;
66
+ /******/ };
67
+ /******/
68
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
69
+ /******/ __webpack_require__.n = function(module) {
70
+ /******/ var getter = module && module.__esModule ?
71
+ /******/ function getDefault() { return module['default']; } :
72
+ /******/ function getModuleExports() { return module; };
73
+ /******/ __webpack_require__.d(getter, 'a', getter);
74
+ /******/ return getter;
75
+ /******/ };
76
+ /******/
77
+ /******/ // Object.prototype.hasOwnProperty.call
78
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
79
+ /******/
80
+ /******/ // __webpack_public_path__
81
+ /******/ __webpack_require__.p = "";
82
+ /******/
83
+ /******/
84
+ /******/ // Load entry module and return exports
85
+ /******/ return __webpack_require__(__webpack_require__.s = 5);
86
+ /******/ })
87
+ /************************************************************************/
88
+ /******/ ([
89
+ /* 0 */
90
+ /***/ (function(module, exports) {
91
+
92
+ module.exports = require("react");
93
+
94
+ /***/ }),
95
+ /* 1 */
96
+ /***/ (function(module, exports) {
97
+
98
+ module.exports = require("@khanacademy/wonder-blocks-core");
99
+
100
+ /***/ }),
101
+ /* 2 */
102
+ /***/ (function(module, exports) {
103
+
104
+ module.exports = require("@khanacademy/wonder-blocks-typography");
105
+
106
+ /***/ }),
107
+ /* 3 */
108
+ /***/ (function(module, exports) {
109
+
110
+ module.exports = require("aphrodite");
111
+
112
+ /***/ }),
113
+ /* 4 */
114
+ /***/ (function(module, exports) {
115
+
116
+ module.exports = require("@khanacademy/wonder-blocks-color");
117
+
118
+ /***/ }),
119
+ /* 5 */
120
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
121
+
122
+ "use strict";
123
+ // ESM COMPAT FLAG
124
+ __webpack_require__.r(__webpack_exports__);
125
+
126
+ // EXPORTS
127
+ __webpack_require__.d(__webpack_exports__, "default", function() { return /* reexport */ toolbar_Toolbar; });
128
+
129
+ // EXTERNAL MODULE: external "react"
130
+ var external_react_ = __webpack_require__(0);
131
+
132
+ // EXTERNAL MODULE: external "aphrodite"
133
+ var external_aphrodite_ = __webpack_require__(3);
134
+
135
+ // EXTERNAL MODULE: external "@khanacademy/wonder-blocks-color"
136
+ var wonder_blocks_color_ = __webpack_require__(4);
137
+ var wonder_blocks_color_default = /*#__PURE__*/__webpack_require__.n(wonder_blocks_color_);
138
+
139
+ // EXTERNAL MODULE: external "@khanacademy/wonder-blocks-core"
140
+ var wonder_blocks_core_ = __webpack_require__(1);
141
+
142
+ // EXTERNAL MODULE: external "@khanacademy/wonder-blocks-typography"
143
+ var wonder_blocks_typography_ = __webpack_require__(2);
144
+
145
+ // CONCATENATED MODULE: ./packages/wonder-blocks-toolbar/src/components/toolbar.js
146
+ /*
147
+ * A toolbar component that often acts as a container header.
148
+ */
149
+
150
+
151
+
152
+
153
+
154
+ class toolbar_Toolbar extends external_react_["Component"] {
155
+ render() {
156
+ const {
157
+ color,
158
+ leftContent,
159
+ rightContent,
160
+ size,
161
+ subtitle,
162
+ title
163
+ } = this.props;
164
+ const TitleComponent = subtitle ? wonder_blocks_typography_["LabelLarge"] : wonder_blocks_typography_["HeadingSmall"];
165
+ return /*#__PURE__*/external_react_["createElement"](wonder_blocks_core_["View"], {
166
+ style: [sharedStyles.container, color === "dark" && sharedStyles.dark, size === "small" && sharedStyles.small]
167
+ }, /*#__PURE__*/external_react_["createElement"](wonder_blocks_core_["View"], {
168
+ style: sharedStyles.column
169
+ }, /*#__PURE__*/external_react_["createElement"](wonder_blocks_core_["View"], {
170
+ style: sharedStyles.leftColumn
171
+ }, leftContent)), title && /*#__PURE__*/external_react_["createElement"](wonder_blocks_core_["View"], {
172
+ style: [sharedStyles.column, sharedStyles.wideColumn]
173
+ }, /*#__PURE__*/external_react_["createElement"](wonder_blocks_core_["View"], {
174
+ style: [sharedStyles.titles, sharedStyles.verticalAlign, sharedStyles.center]
175
+ }, /*#__PURE__*/external_react_["createElement"](TitleComponent, {
176
+ id: "wb-toolbar-title"
177
+ }, title), subtitle && /*#__PURE__*/external_react_["createElement"](wonder_blocks_typography_["LabelSmall"], {
178
+ style: color === "light" && sharedStyles.subtitle
179
+ }, subtitle))), /*#__PURE__*/external_react_["createElement"](wonder_blocks_core_["View"], {
180
+ style: sharedStyles.column
181
+ }, /*#__PURE__*/external_react_["createElement"](wonder_blocks_core_["View"], {
182
+ style: sharedStyles.rightColumn
183
+ }, rightContent)));
184
+ }
185
+
186
+ }
187
+ toolbar_Toolbar.defaultProps = {
188
+ color: "light",
189
+ leftContent: null,
190
+ rightContent: null,
191
+ size: "medium"
192
+ };
193
+ const sharedStyles = external_aphrodite_["StyleSheet"].create({
194
+ container: {
195
+ border: "1px solid rgba(33, 36, 44, 0.16)",
196
+ display: "flex",
197
+ flexDirection: "row",
198
+ minHeight: 66,
199
+ paddingLeft: 16,
200
+ paddingRight: 16,
201
+ position: "relative",
202
+ width: "100%"
203
+ },
204
+ small: {
205
+ minHeight: 50
206
+ },
207
+ dark: {
208
+ backgroundColor: wonder_blocks_color_default.a.darkBlue,
209
+ boxShadow: "0 1px 0 0 rgba(255, 255, 255, 0.64)",
210
+ color: "white"
211
+ },
212
+ verticalAlign: {
213
+ justifyContent: "center"
214
+ },
215
+ column: {
216
+ flex: 1,
217
+ justifyContent: "center"
218
+ },
219
+ wideColumn: {
220
+ flexBasis: "50%"
221
+ },
222
+ leftColumn: {
223
+ alignItems: "center",
224
+ flexDirection: "row",
225
+ justifyContent: "flex-start"
226
+ },
227
+ rightColumn: {
228
+ alignItems: "center",
229
+ flexDirection: "row",
230
+ justifyContent: "flex-end"
231
+ },
232
+ center: {
233
+ textAlign: "center"
234
+ },
235
+ subtitle: {
236
+ color: "rgba(33, 36, 44, 0.64)"
237
+ },
238
+ titles: {
239
+ padding: 12
240
+ }
241
+ });
242
+ // CONCATENATED MODULE: ./packages/wonder-blocks-toolbar/src/index.js
243
+
244
+
245
+
246
+ /***/ })
247
+ /******/ ]);
@@ -0,0 +1,2 @@
1
+ // @flow
2
+ export * from "../src/index.js";
package/docs.md ADDED
@@ -0,0 +1 @@
1
+ The Toolbar component is a generic toolbar wrapper that exposes customization options. An optional title and subtitle property can be used along with left and right content passed as props.
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@khanacademy/wonder-blocks-toolbar",
3
+ "version": "2.1.25",
4
+ "design": "v1",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "description": "",
9
+ "main": "dist/index.js",
10
+ "module": "dist/es/index.js",
11
+ "source": "src/index.js",
12
+ "scripts": {
13
+ "test": "echo \"Error: no test specified\" && exit 1"
14
+ },
15
+ "author": "",
16
+ "license": "MIT",
17
+ "dependencies": {
18
+ "@babel/runtime": "^7.13.10",
19
+ "@khanacademy/wonder-blocks-color": "^1.1.18",
20
+ "@khanacademy/wonder-blocks-core": "^3.1.4",
21
+ "@khanacademy/wonder-blocks-typography": "^1.1.25"
22
+ },
23
+ "peerDependencies": {
24
+ "aphrodite": "^1.2.5",
25
+ "react": "^16.4.1"
26
+ },
27
+ "devDependencies": {
28
+ "wb-dev-build-settings": "^0.1.0"
29
+ },
30
+ "gitHead": "8022bb419eed74be37f71f71c7621854794a731c"
31
+ }