jbx 2.1.0 → 2.4.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/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # 2.4.0
2
+
3
+ - Respect `style` properties on `Box`.
4
+
5
+ # 2.3.0
6
+
7
+ - Add CodeTextarea.
8
+
9
+ # 2.2.0
10
+
11
+ - Restore `Dropzone`.
12
+
1
13
  # 2.1.0
2
14
 
3
15
  - Restore `input` and `range`.
package/index.js CHANGED
@@ -6,10 +6,10 @@ const SIZE = window.innerWidth > 1280 ? 16 : window.innerWidth > 640 ? 14 : 12;
6
6
  const BASE_RADIUS = SIZE / 2;
7
7
  const BASE_FONT_SIZE = SIZE;
8
8
 
9
- export function Component(className, styleSrc, config = {}) {
9
+ export function Component(className, styleSrc = {}, config = {}) {
10
10
  const { element = `div`, styleProps } = config;
11
11
 
12
- return function MakeComponent({ children, ...props }) {
12
+ return function MakeComponent({ children, style = {}, ...props }) {
13
13
  const passProps = styleProps
14
14
  ? Object.keys(props)
15
15
  .filter((e) => !styleProps.includes(e))
@@ -19,11 +19,13 @@ export function Component(className, styleSrc, config = {}) {
19
19
  }, {})
20
20
  : props;
21
21
 
22
+ const calculatedStyle = typeof styleSrc === 'function' ? styleSrc(props) : styleSrc;
23
+
22
24
  return React.createElement(
23
25
  element,
24
26
  {
25
27
  className,
26
- style: typeof styleSrc === 'function' ? styleSrc(props) : styleSrc,
28
+ style: { ...style, ...calculatedStyle },
27
29
  ...passProps
28
30
  },
29
31
  children
@@ -130,37 +132,7 @@ export const Stack = Component(`jbx-stack`, ({ v, h, gap }) => ({
130
132
  // }
131
133
  // });
132
134
 
133
- // export const Dropzone = Styled.div({
134
- // height: '120px',
135
- // flex: 1,
136
- // 'max-width': '320px',
137
- // display: 'flex',
138
- // 'text-align': 'center',
139
- // 'align-items': 'center',
140
- // 'align-content': 'center',
141
- // 'justify-content': 'center',
142
- // 'flex-direction': 'column',
143
- // border: '2px dashed #000',
144
- // color: '#000',
145
- // padding: '0',
146
- // cursor: 'pointer',
147
- // '& span': {
148
- // width: '100%',
149
- // cursor: 'pointer'
150
- // },
151
- // '&:hover': {
152
- // 'border-color': '#999'
153
- // },
154
- // '& input': {
155
- // position: 'absolute',
156
- // top: '0',
157
- // left: '0',
158
- // height: '100%',
159
- // width: '100%',
160
- // opacity: '0',
161
- // cursor: 'pointer'
162
- // }
163
- // });
135
+ export const Dropzone = Component(`jbx-dropzone`);
164
136
 
165
137
  export const Ul = Component(
166
138
  `jbx-ul`,
@@ -196,11 +168,12 @@ export const Tab = Component(
196
168
  );
197
169
 
198
170
  export const CodeSnippet = Component(`jbx-code-snippet`, null, { element: 'pre' });
171
+ export const CodeTextarea = Component(`jbx-code-area`, null, { element: 'textarea' });
199
172
 
200
173
  export const CheckboxHidden = Component(`jbx-checkbox-hidden`, ({ checked }) => {
201
174
  return {
202
- height: BASE_SIZE * 2 - 4,
203
- width: BASE_SIZE * 2 - 4,
175
+ height: SIZE * 2 - 4,
176
+ width: SIZE * 2 - 4,
204
177
  paddingTop: 2,
205
178
  paddingLeft: 2,
206
179
  backgroundColor: checked ? 'var(--accent-color)' : 'white',
@@ -237,8 +210,8 @@ export const Checkbox = function Checkbox({ label, checked, onChange }) {
237
210
  'svg',
238
211
  {
239
212
  xmlns: 'http://www.w3.org/2000/svg',
240
- width: BASE_SIZE * 2 - 8,
241
- height: BASE_SIZE * 2 - 8,
213
+ width: SIZE * 2 - 8,
214
+ height: SIZE * 2 - 8,
242
215
  fill: 'none',
243
216
  stroke: 'currentColor',
244
217
  strokeLinecap: 'round',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jbx",
3
- "version": "2.1.0",
3
+ "version": "2.4.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "hi@javier.xyz",
package/style.css CHANGED
@@ -60,16 +60,34 @@ body,
60
60
  font-family: monaco, monospace;
61
61
  border: none;
62
62
  width: 100%;
63
- font-size: calc(var(--size) - 2px);
64
- line-height: 1.5;
65
- padding: var(--size);
63
+ font-size: calc(var(--size) - 3px);
64
+ line-height: 1.33;
65
+ padding: var(--size) calc(var(--size) * 1.2);
66
66
  background: #ecf0f1;
67
67
  color: #34495e;
68
+ resize: none;
68
69
  }
69
70
  .jbx-code-snippet:focus {
70
71
  outline: none;
71
72
  }
72
73
 
74
+ .jbx-code-area {
75
+ border-radius: var(--size);
76
+ font-family: monaco, monospace;
77
+ border: none;
78
+ width: 100%;
79
+ font-size: calc(var(--size) - 3px);
80
+ line-height: 1.33;
81
+ padding: var(--size) calc(var(--size) * 1.2);
82
+ background: #ecf0f1;
83
+ color: #34495e;
84
+ resize: none;
85
+ min-height: 120px;
86
+ }
87
+ .jbx-code-area:focus {
88
+ outline: none;
89
+ }
90
+
73
91
  .jbx-button {
74
92
  appearance: none;
75
93
  user-select: none;
@@ -135,6 +153,10 @@ body,
135
153
  padding: calc(var(--size) * 2.5) calc(var(--size) * 1.5) calc(var(--size) * 4);
136
154
  }
137
155
 
156
+ .jbx-box {
157
+ flex: 1;
158
+ }
159
+
138
160
  .jbx-inline {
139
161
  flex: 1;
140
162
  display: flex;
@@ -164,6 +186,54 @@ body,
164
186
  box-shadow: inset rgba(0, 0, 0, 0.04) 3px 3px 0, inset rgba(0, 0, 0, 0.03) 0.5px 0.5px 0;
165
187
  }
166
188
 
189
+ .jbx-dropzone {
190
+ height: 120px;
191
+ flex: 1;
192
+ max-width: 320px;
193
+ display: flex;
194
+ text-align: center;
195
+ align-items: center;
196
+ align-content: center;
197
+ justify-content: center;
198
+ flex-direction: column;
199
+ border: 2px dashed #000;
200
+ color: #000;
201
+ padding: 0;
202
+ cursor: pointer;
203
+ }
204
+ .jbx-dropzone:hover {
205
+ border-color: #999;
206
+ }
207
+ .jbx-dropzone span {
208
+ width: 100%;
209
+ cursor: pointer;
210
+ }
211
+ .jbx-dropzone input {
212
+ position: absolute;
213
+ top: 0;
214
+ left: 0;
215
+ height: 100%;
216
+ width: 100%;
217
+ opacity: 0;
218
+ cursor: pointer;
219
+ }
220
+
221
+ /*export const Dropzone = Styled.div({
222
+
223
+
224
+
225
+ },
226
+ '& input': {
227
+ position: 'absolute',
228
+ top: '0',
229
+ left: '0',
230
+ height: '100%',
231
+ width: '100%',
232
+ opacity: '0',
233
+ cursor: 'pointer'
234
+ }
235
+ });*/
236
+
167
237
  .jbx-range {
168
238
  flex: 1;
169
239
  width: 100%;
@@ -174,6 +244,7 @@ body,
174
244
  }
175
245
 
176
246
  .jbx-range::-webkit-slider-thumb {
247
+ -webkit-appearance: none;
177
248
  appearance: none;
178
249
  box-shadow: none;
179
250
  border-radius: 0;