jbx 1.6.0 → 1.7.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.
package/.editorconfig ADDED
@@ -0,0 +1,12 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ indent_style = space
6
+ indent_size = 2
7
+ insert_final_newline = true
8
+ trim_trailing_whitespace = true
9
+
10
+ [*.md]
11
+ max_line_length = off
12
+ trim_trailing_whitespace = false
package/.prettierrc ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "singleQuote": true,
3
+ "printWidth": 100,
4
+ "editor.formatOnSave": true,
5
+ "proseWrap": "always",
6
+ "tabWidth": 2,
7
+ "requireConfig": false,
8
+ "useTabs": false,
9
+ "trailingComma": "none",
10
+ "bracketSpacing": true,
11
+ "jsxBracketSameLine": false,
12
+ "semi": true
13
+ }
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v1.7.0
2
+
3
+ - Add `touch-action: pan-y;`.
4
+
1
5
  # v1.6.0
2
6
 
3
7
  - `Button` now moves when clicked.
package/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import React, { Fragment } from "react";
1
+ import { createElement, Fragment } from 'react';
2
2
 
3
- import Styled from "styled-components";
4
- import capsize from "capsize";
3
+ import Styled from 'styled-components';
4
+ import capsize from 'capsize';
5
5
 
6
- import { createGlobalStyle } from "styled-components";
6
+ import { createGlobalStyle } from 'styled-components';
7
7
 
8
8
  const BASE_SIZE = 16;
9
9
  const SIZE = window.innerHeight > 640 ? 16 : 14;
@@ -15,7 +15,7 @@ const fontMetrics = {
15
15
  capHeight: 1364,
16
16
  ascent: 1950,
17
17
  descent: -494,
18
- unitsPerEm: 2048,
18
+ unitsPerEm: 2048
19
19
  };
20
20
 
21
21
  export const JBX = createGlobalStyle`
@@ -36,6 +36,7 @@ export const JBX = createGlobalStyle`
36
36
 
37
37
  body {
38
38
  touch-action: manipulation;
39
+ touch-action: pan-y;
39
40
  }
40
41
 
41
42
  body,
@@ -61,106 +62,102 @@ function textProps(capsizeConfig) {
61
62
  const capsizeComputed = {
62
63
  fontMetrics,
63
64
  lineGap: BASE_FONT_SIZE * 0.618,
64
- ...capsizeConfig,
65
+ ...capsizeConfig
65
66
  };
66
67
 
67
68
  return capsize(capsizeComputed);
68
69
  }
69
70
 
70
71
  export const Container = Styled.div({
71
- maxWidth: "1080px",
72
- margin: "0 auto",
73
- padding: `${SIZE * 2.5}px ${SIZE * 1.5}px ${SIZE * 4}px`,
72
+ maxWidth: '1080px',
73
+ margin: '0 auto',
74
+ padding: `${SIZE * 2.5}px ${SIZE * 1.5}px ${SIZE * 4}px`
74
75
  });
75
76
 
76
77
  export const Text = Styled(BaseText)({
77
78
  ...textProps({
78
- capHeight: BASE_FONT_SIZE,
79
- }),
79
+ capHeight: BASE_FONT_SIZE
80
+ })
80
81
  });
81
82
 
82
83
  export const SmallText = Styled(BaseText)({
83
84
  ...textProps({
84
85
  capHeight: BASE_FONT_SIZE * 0.8,
85
- lineGap: BASE_FONT_SIZE / 3,
86
- }),
86
+ lineGap: BASE_FONT_SIZE / 3
87
+ })
87
88
  });
88
89
 
89
90
  export const ButtonContainer = Styled.button({
90
- appearance: "none",
91
- userSelect: "none",
92
- cursor: "pointer",
93
- display: "inline-block",
94
- backgroundColor: "#eee",
95
- boxShadow: "3px 3px 0 #ccc",
91
+ appearance: 'none',
92
+ userSelect: 'none',
93
+ cursor: 'pointer',
94
+ display: 'inline-block',
95
+ backgroundColor: '#eee',
96
+ boxShadow: '3px 3px 0 #ccc',
96
97
  padding: `0 ${SPACE / 2}px`,
97
- border: "none",
98
+ border: 'none',
98
99
  height: SPACE * 2.5,
99
- "&:active": {
100
+ '&:active': {
100
101
  top: 1,
101
102
  left: 1,
102
- boxShadow: "2px 2px 0 #ccc",
103
- },
103
+ boxShadow: '2px 2px 0 #ccc'
104
+ }
104
105
  });
105
106
 
106
107
  export const Button = function Button(props) {
107
108
  const { children, ...other } = props;
108
- return React.createElement(
109
- ButtonContainer,
110
- other,
111
- React.createElement(Text, {}, children)
112
- );
109
+ return createElement(ButtonContainer, other, createElement(Text, {}, children));
113
110
  };
114
111
 
115
112
  export const Input = Styled.input({
116
- "-webkit-text-fill-color": "#777",
113
+ '-webkit-text-fill-color': '#777',
117
114
  opacity: 1,
118
115
  flex: 1,
119
- display: "block",
120
- appearance: "none",
121
- border: "none",
116
+ display: 'block',
117
+ appearance: 'none',
118
+ border: 'none',
122
119
  borderRadius: 0,
123
120
  height: SPACE * 2.5,
124
- backgroundColor: "#eee",
121
+ backgroundColor: '#eee',
125
122
  ...textProps({
126
- capHeight: (BASE_FONT_SIZE * 3) / 3,
123
+ capHeight: (BASE_FONT_SIZE * 3) / 3
127
124
  }),
128
125
  padding: `0 ${SPACE / 2}px`,
129
126
  boxShadow: `inset rgba(0, 0, 0, 0.04) 3px 3px 0, inset rgba(0, 0, 0, 0.03) 0.5px 0.5px 0`,
130
- color: "#777",
127
+ color: '#777'
131
128
  });
132
129
 
133
130
  export const Range = Styled.input({
134
131
  flex: 1,
135
- width: "100%",
136
- appearance: "none",
137
- backgroundColor: "var(--accent-color)",
132
+ width: '100%',
133
+ appearance: 'none',
134
+ backgroundColor: 'var(--accent-color)',
138
135
  height: SPACE,
139
136
  borderRadius: 0,
140
- "&::-webkit-slider-thumb": {
141
- appearance: "none",
142
- boxShadow: "none",
137
+ '&::-webkit-slider-thumb': {
138
+ appearance: 'none',
139
+ boxShadow: 'none',
143
140
  borderRadius: 0,
144
141
  height: SPACE * 2,
145
142
  width: SPACE,
146
- backgroundColor: "#000",
147
- border: "none",
143
+ backgroundColor: '#000',
144
+ border: 'none'
148
145
  },
149
- "&::-moz-range-thumb": {
150
- appearance: "none",
151
- boxShadow: "none",
146
+ '&::-moz-range-thumb': {
147
+ appearance: 'none',
148
+ boxShadow: 'none',
152
149
  borderRadius: 0,
153
150
  height: SPACE * 2,
154
151
  width: SPACE,
155
- backgroundColor: "#000",
156
- border: "none",
157
- },
158
- "&::-webkit-slider-runnable-track": {
159
- appearance: "none",
152
+ backgroundColor: '#000',
153
+ border: 'none'
160
154
  },
161
- ":focus": {
162
- outline: "none",
155
+ '&::-webkit-slider-runnable-track': {
156
+ appearance: 'none'
163
157
  },
158
+ ':focus': {
159
+ outline: 'none'
160
+ }
164
161
  });
165
162
 
166
163
  export const HeaderH4 = Styled.h4({
@@ -170,8 +167,8 @@ export const HeaderH4 = Styled.h4({
170
167
  fontWeight: 700,
171
168
  ...textProps({
172
169
  capHeight: BASE_FONT_SIZE,
173
- lineGap: BASE_FONT_SIZE,
174
- }),
170
+ lineGap: BASE_FONT_SIZE
171
+ })
175
172
  });
176
173
  export const HeaderH3 = Styled.h3({
177
174
  margin: 0,
@@ -180,8 +177,8 @@ export const HeaderH3 = Styled.h3({
180
177
  fontWeight: 500,
181
178
  ...textProps({
182
179
  capHeight: BASE_FONT_SIZE * 1 * 1.25,
183
- lineGap: BASE_FONT_SIZE,
184
- }),
180
+ lineGap: BASE_FONT_SIZE
181
+ })
185
182
  });
186
183
  export const HeaderH2 = Styled.h2({
187
184
  margin: 0,
@@ -190,38 +187,38 @@ export const HeaderH2 = Styled.h2({
190
187
  fontWeight: 500,
191
188
  ...textProps({
192
189
  capHeight: BASE_FONT_SIZE * 1.5,
193
- lineGap: 12,
194
- }),
190
+ lineGap: 12
191
+ })
195
192
  });
196
193
  export const HeaderH1 = Styled.h1({
197
194
  letterSpacing: -1,
198
- margin: "2px 0",
195
+ margin: '2px 0',
199
196
  fontWeight: 700,
200
197
  ...textProps({
201
198
  capHeight: BASE_FONT_SIZE * 3 - 4,
202
- lineGap: BASE_FONT_SIZE,
203
- }),
199
+ lineGap: BASE_FONT_SIZE
200
+ })
204
201
  });
205
202
 
206
203
  export const MainHeader = function MainHeader({ children }) {
207
- const content = String(children).split(" ");
204
+ const content = String(children).split(' ');
208
205
 
209
- return React.createElement(
206
+ return createElement(
210
207
  Fragment,
211
208
  {},
212
209
  content.map((word) =>
213
- React.createElement(
210
+ createElement(
214
211
  HeaderH1,
215
212
  {
216
213
  key: word,
217
214
  style: {
218
215
  fontWeight: 900,
219
- display: "inline-block",
220
- width: "auto",
221
- padding: "6px",
216
+ display: 'inline-block',
217
+ width: 'auto',
218
+ padding: '6px',
222
219
  margin: 0,
223
- backgroundColor: "var(--accent-color)",
224
- },
220
+ backgroundColor: 'var(--accent-color)'
221
+ }
225
222
  },
226
223
  word
227
224
  )
@@ -230,19 +227,19 @@ export const MainHeader = function MainHeader({ children }) {
230
227
  };
231
228
 
232
229
  export const A = Styled.a({
233
- color: "#000",
234
- boxShadow: "var(--accent-color) 0 2px 0, inset var(--accent-color) 0 -2px 0",
230
+ color: '#000',
231
+ boxShadow: 'var(--accent-color) 0 2px 0, inset var(--accent-color) 0 -2px 0',
235
232
  fontWeight: 700,
236
- textDecoration: "none",
237
- "&:hover": {
238
- color: "#34495e",
239
- },
233
+ textDecoration: 'none',
234
+ '&:hover': {
235
+ color: '#34495e'
236
+ }
240
237
  });
241
238
 
242
239
  export const Space = Styled.div({
243
- display: (props) => (props.inline ? "inline-block" : "block"),
240
+ display: (props) => (props.inline ? 'inline-block' : 'block'),
244
241
  height: (props) => `${SPACE * props.h}px`,
245
- width: (props) => `${SPACE * props.w}px`,
242
+ width: (props) => `${SPACE * props.w}px`
246
243
  });
247
244
 
248
245
  export const Box = Styled.div({
@@ -253,115 +250,112 @@ export const Box = Styled.div({
253
250
 
254
251
  const paddingArr = [padding].flat();
255
252
 
256
- return paddingArr
257
- .map((paddingValue) => `${paddingValue * SPACE}px`)
258
- .join(` `);
253
+ return paddingArr.map((paddingValue) => `${paddingValue * SPACE}px`).join(` `);
259
254
  },
260
255
 
261
- "@media (max-width: 768px)": {
262
- display: ({ hideOnSmall }) => (hideOnSmall ? "none" : undefined),
256
+ '@media (max-width: 768px)': {
257
+ display: ({ hideOnSmall }) => (hideOnSmall ? 'none' : undefined)
263
258
  },
264
259
 
265
- "@media (max-width: 1080px)": {
266
- display: ({ hideOnMedium }) => (hideOnMedium ? "none" : undefined),
267
- },
260
+ '@media (max-width: 1080px)': {
261
+ display: ({ hideOnMedium }) => (hideOnMedium ? 'none' : undefined)
262
+ }
268
263
  });
269
264
 
270
265
  export const Inline = Styled.div({
271
- display: "flex",
272
- flexWrap: "wrap",
266
+ display: 'flex',
267
+ flexWrap: 'wrap',
273
268
  marginLeft: ({ h }) => `${h * SPACE}px`,
274
269
  marginRight: ({ h }) => `${h * SPACE}px`,
275
270
  marginTop: ({ v }) => `${v * SPACE}px`,
276
- marginBottom: ({ v }) => `${v * SPACE}px`,
271
+ marginBottom: ({ v }) => `${v * SPACE}px`
277
272
  });
278
273
 
279
274
  export const LinkButton = Styled.a({
280
275
  capHeight: BASE_FONT_SIZE,
281
- color: "#3498db",
282
- cursor: "pointer",
276
+ color: '#3498db',
277
+ cursor: 'pointer',
283
278
  borderRadius: 5,
284
- borderTop: "1px solid #3498db10",
285
- borderBottom: "1px solid #0000",
286
- backgroundColor: "#3498db20",
279
+ borderTop: '1px solid #3498db10',
280
+ borderBottom: '1px solid #0000',
281
+ backgroundColor: '#3498db20',
287
282
  height: BASE_FONT_SIZE * 2,
288
- display: "flex",
289
- alignItems: "center",
290
- alignContent: "center",
291
- justifyContent: "center",
283
+ display: 'flex',
284
+ alignItems: 'center',
285
+ alignContent: 'center',
286
+ justifyContent: 'center',
292
287
  padding: 0,
293
- "&:hover": {
294
- boxShadow: `rgba(0, 0, 0, 0.1) 0 1px 1px, rgba(0, 0, 0, 0.1) 0 3px 12px`,
295
- },
288
+ '&:hover': {
289
+ boxShadow: `rgba(0, 0, 0, 0.1) 0 1px 1px, rgba(0, 0, 0, 0.1) 0 3px 12px`
290
+ }
296
291
  });
297
292
 
298
293
  export const Dropzone = Styled.div({
299
- height: "120px",
294
+ height: '120px',
300
295
  flex: 1,
301
- "max-width": "320px",
302
- display: "flex",
303
- "text-align": "center",
304
- "align-items": "center",
305
- "align-content": "center",
306
- "justify-content": "center",
307
- "flex-direction": "column",
308
- border: "2px dashed #000",
309
- color: "#000",
310
- padding: "0",
311
- cursor: "pointer",
312
- "& span": {
313
- width: "100%",
314
- cursor: "pointer",
315
- },
316
- "&:hover": {
317
- "border-color": "#999",
296
+ 'max-width': '320px',
297
+ display: 'flex',
298
+ 'text-align': 'center',
299
+ 'align-items': 'center',
300
+ 'align-content': 'center',
301
+ 'justify-content': 'center',
302
+ 'flex-direction': 'column',
303
+ border: '2px dashed #000',
304
+ color: '#000',
305
+ padding: '0',
306
+ cursor: 'pointer',
307
+ '& span': {
308
+ width: '100%',
309
+ cursor: 'pointer'
318
310
  },
319
- "& input": {
320
- position: "absolute",
321
- top: "0",
322
- left: "0",
323
- height: "100%",
324
- width: "100%",
325
- opacity: "0",
326
- cursor: "pointer",
311
+ '&:hover': {
312
+ 'border-color': '#999'
327
313
  },
314
+ '& input': {
315
+ position: 'absolute',
316
+ top: '0',
317
+ left: '0',
318
+ height: '100%',
319
+ width: '100%',
320
+ opacity: '0',
321
+ cursor: 'pointer'
322
+ }
328
323
  });
329
324
 
330
325
  export const Ul = Styled.ul({
331
326
  margin: 0,
332
- padding: `0 0 0 ${BASE_FONT_SIZE / 4}px`,
327
+ padding: `0 0 0 ${BASE_FONT_SIZE / 4}px`
333
328
  });
334
329
 
335
330
  export const Li = Styled.li({
336
331
  margin: `0 0 0 ${SIZE}px`,
337
- padding: `${SIZE / 4}px 0`,
332
+ padding: `${SIZE / 4}px 0`
338
333
  });
339
334
 
340
335
  export const Tabs = Styled.div({});
341
336
 
342
337
  export const Tab = Styled.div({
343
- userSelect: "none",
338
+ userSelect: 'none',
344
339
  padding: SIZE / 2,
345
- cursor: "pointer",
346
- backgroundColor: (props) =>
347
- props.active ? "#000" : props.info ? "#fff" : "#ecf0f1",
348
- color: (props) => (props.active ? "#fff" : "#000"),
349
- paddingLeft: (props) => (props.info ? 0 : undefined),
340
+ cursor: 'pointer',
341
+ backgroundColor: (props) => (props.active ? '#000' : props.info ? '#fff' : '#ecf0f1'),
342
+ color: (props) => (props.active ? '#fff' : '#000'),
343
+ paddingLeft: (props) => (props.info ? 0 : undefined)
350
344
  });
351
345
 
352
346
  export const CodeSnippet = Styled.pre({
353
347
  borderRadius: BASE_RADIUS,
354
- "font-family": "monaco, monospace",
355
- border: "none",
356
- width: "100%",
357
- "font-size": SIZE - 2,
358
- "line-height": "1.5",
348
+ 'font-family': 'monaco, monospace',
349
+ border: 'none',
350
+ width: '100%',
351
+ 'font-size': SIZE - 2,
352
+ 'line-height': '1.5',
359
353
  padding: SIZE,
360
- background: "#ecf0f1",
361
- color: "#34495e",
362
- ":focus": {
363
- outline: "none",
364
- },
354
+ background: '#ecf0f1',
355
+ color: '#34495e',
356
+ ':focus': {
357
+ outline: 'none'
358
+ }
365
359
  });
366
360
 
367
361
  export const CheckboxHidden = Styled.div(({ checked }) => {
@@ -370,17 +364,17 @@ export const CheckboxHidden = Styled.div(({ checked }) => {
370
364
  width: BASE_SIZE * 2 - 4,
371
365
  paddingTop: 2,
372
366
  paddingLeft: 2,
373
- backgroundColor: checked ? "var(--accent-color)" : "white",
367
+ backgroundColor: checked ? 'var(--accent-color)' : 'white',
374
368
  borderRadius: BASE_RADIUS,
375
369
  boxShadow: checked
376
- ? "inset rgba(0, 0, 0, 0.07) 0 0 0 1px"
377
- : "inset rgba(0, 0, 0, 0.33) 0 0 0 1.5px",
378
- cursor: "pointer",
370
+ ? 'inset rgba(0, 0, 0, 0.07) 0 0 0 1px'
371
+ : 'inset rgba(0, 0, 0, 0.33) 0 0 0 1.5px',
372
+ cursor: 'pointer'
379
373
  };
380
374
  });
381
375
 
382
376
  export const Checkbox = function Checkbox({ label, checked, onChange }) {
383
- return React.createElement(
377
+ return createElement(
384
378
  Inline,
385
379
  {
386
380
  onClick: () => {
@@ -389,58 +383,54 @@ export const Checkbox = function Checkbox({ label, checked, onChange }) {
389
383
  }
390
384
  },
391
385
  style: {
392
- alignItems: "center",
393
- cursor: "pointer",
394
- },
386
+ alignItems: 'center',
387
+ cursor: 'pointer'
388
+ }
395
389
  },
396
390
  [
397
- React.createElement(
391
+ createElement(
398
392
  CheckboxHidden,
399
393
  {
400
394
  key: 0,
401
- checked,
395
+ checked
402
396
  },
403
- React.createElement(
404
- "svg",
397
+ createElement(
398
+ 'svg',
405
399
  {
406
- xmlns: "http://www.w3.org/2000/svg",
407
- width: "24",
408
- height: "24",
409
- fill: "none",
410
- stroke: "currentColor",
411
- strokeLinecap: "round",
412
- strokeLinejoin: "round",
413
- strokeWidth: "2",
414
- className: "feather feather-check",
415
- viewBox: "0 0 24 24",
416
- color: checked ? "white" : "#ddd",
400
+ xmlns: 'http://www.w3.org/2000/svg',
401
+ width: '24',
402
+ height: '24',
403
+ fill: 'none',
404
+ stroke: 'currentColor',
405
+ strokeLinecap: 'round',
406
+ strokeLinejoin: 'round',
407
+ strokeWidth: '2',
408
+ className: 'feather feather-check',
409
+ viewBox: '0 0 24 24',
410
+ color: checked ? 'white' : '#ddd'
417
411
  },
418
- React.createElement("path", {
419
- d: "M20 6L9 17 4 12",
412
+ createElement('path', {
413
+ d: 'M20 6L9 17 4 12'
420
414
  })
421
415
  )
422
416
  ),
423
- React.createElement(Space, { key: 1, w: 0.5 }),
424
- React.createElement(
425
- Text,
426
- { key: 2, style: { userSelect: "none" } },
427
- label
428
- ),
417
+ createElement(Space, { key: 1, w: 0.5 }),
418
+ createElement(Text, { key: 2, style: { userSelect: 'none' } }, label)
429
419
  ]
430
420
  );
431
421
  };
432
422
 
433
423
  export const Code = Styled.textarea({
434
- "font-family": "monaco, monospace",
435
- border: "none",
436
- width: "100%",
437
- height: "256px",
438
- "font-size": "12px",
439
- "line-height": "1.309",
440
- padding: "16px 18px",
441
- background: "#ecf0f1",
442
- color: "#34495e",
443
- ":focus": {
444
- outline: "none",
445
- },
424
+ 'font-family': 'monaco, monospace',
425
+ border: 'none',
426
+ width: '100%',
427
+ height: '256px',
428
+ 'font-size': '12px',
429
+ 'line-height': '1.309',
430
+ padding: '16px 18px',
431
+ background: '#ecf0f1',
432
+ color: '#34495e',
433
+ ':focus': {
434
+ outline: 'none'
435
+ }
446
436
  });
package/package.json CHANGED
@@ -1,17 +1,8 @@
1
1
  {
2
2
  "name": "jbx",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
- "peerDependencies": {
10
- "capsize": "^1.1.0",
11
- "react": "16.13.1",
12
- "react-dom": "16.13.1",
13
- "styled-components": "^5.2.0"
14
- },
15
- "author": "",
16
- "license": "ISC"
6
+ "author": "hi@javier.xyz",
7
+ "license": "Unlicensed"
17
8
  }