pebble-web 2.3.0 → 2.4.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": "pebble-web",
3
- "version": "2.3.0",
3
+ "version": "2.4.1",
4
4
  "author": "ritz078 <rkritesh078@gmail.com>",
5
5
  "license": "MIT",
6
6
  "main": "dist/pebble-web.js",
@@ -44,12 +44,12 @@
44
44
  "utility-types": "^3.10.0"
45
45
  },
46
46
  "devDependencies": {
47
- "pebble-shared": "^2.2.7"
47
+ "pebble-shared": "^2.3.1"
48
48
  },
49
49
  "greenkeeper": {
50
50
  "ignore": [
51
51
  "rheostat"
52
52
  ]
53
53
  },
54
- "gitHead": "6662ecf79cf28a6328c85295a5b234166dcbc9d3"
54
+ "gitHead": "2e6e566cf87edbb14bb945d9bb62f97cd5742d2e"
55
55
  }
@@ -12,15 +12,12 @@ import Ink from "react-ink";
12
12
  import { colors } from "pebble-shared";
13
13
 
14
14
  const defaultProps = {
15
- rightElement: ({
15
+ rightElement: <T extends unknown>({
16
16
  isSelected,
17
17
  multiSelect,
18
- indeterminate
19
- }: {
20
- isSelected: boolean;
21
- multiSelect: boolean;
22
- indeterminate?: boolean;
23
- }) => {
18
+ indeterminate,
19
+ iconClassName
20
+ }: OptionProps<T>) => {
24
21
  const iconClass = cx(
25
22
  "pi",
26
23
  {
@@ -35,7 +32,7 @@ const defaultProps = {
35
32
  fontSize: "20px"
36
33
  })
37
34
  );
38
- return multiSelect ? <i className={iconClass} /> : null;
35
+ return multiSelect ? <i className={cx(iconClass, iconClassName)} /> : null;
39
36
  }
40
37
  };
41
38
 
@@ -48,6 +45,7 @@ class Option<OptionType> extends React.Component<
48
45
  label,
49
46
  isActive,
50
47
  isSelected,
48
+ leftElement,
51
49
  rightElement,
52
50
  labelClassName,
53
51
  className
@@ -70,6 +68,7 @@ class Option<OptionType> extends React.Component<
70
68
  {() => {
71
69
  return (
72
70
  <>
71
+ {leftElement && leftElement(this.props)}
73
72
  <div className={cx(labelWrap, labelClassName)}>{label}</div>
74
73
  {rightElement(this.props)}
75
74
  <Ink />
@@ -1,3 +1,4 @@
1
+ import { cx } from "emotion";
1
2
  import * as React from "react";
2
3
  import { getSelectedCheckboxes } from "./utils/getSelectedCheckboxes";
3
4
  import Button from "./Button";
@@ -45,14 +46,21 @@ export default class OptionGroupCheckBox<
45
46
  if (onApply) onApply(selected || [], this.props);
46
47
  };
47
48
  render() {
48
- const { onApply, onClear, isSelected, onChange, ...rest } = this.props;
49
+ const {
50
+ wrapClassName,
51
+ onApply,
52
+ onClear,
53
+ isSelected,
54
+ onChange,
55
+ ...rest
56
+ } = this.props;
49
57
  const advancedOptionsProps = {
50
58
  selectVisible: this.selectVisible,
51
59
  clearVisible: this.clearVisible,
52
60
  ...this.props.advancedOptionsProps
53
61
  };
54
62
  return (
55
- <div className={styles.optionGroupCheckBoxWrap}>
63
+ <div className={cx(styles.optionGroupCheckBoxWrap, wrapClassName)}>
56
64
  <OptionGroup<OptionType>
57
65
  {...rest}
58
66
  advancedOptionsProps={advancedOptionsProps}
@@ -6,6 +6,10 @@ exports[`Option component snapshot for multi select 1`] = `
6
6
  -moz-user-select: none;
7
7
  -ms-user-select: none;
8
8
  user-select: none;
9
+ -webkit-box-flex: 1;
10
+ -webkit-flex-grow: 1;
11
+ -ms-flex-positive: 1;
12
+ flex-grow: 1;
9
13
  overflow: hidden;
10
14
  text-overflow: ellipsis;
11
15
  }
@@ -43,24 +47,14 @@ exports[`Option component snapshot for multi select 1`] = `
43
47
  overflow-x: hidden;
44
48
  text-overflow: ellipsis;
45
49
  white-space: nowrap;
46
- display: -webkit-box;
47
- display: -webkit-flex;
48
- display: -ms-flexbox;
49
- display: flex;
50
- -webkit-flex-direction: row;
51
- -ms-flex-direction: row;
52
- flex-direction: row;
53
- -webkit-box-pack: justify;
54
- -webkit-justify-content: space-between;
55
- -ms-flex-pack: justify;
56
- justify-content: space-between;
57
- -webkit-align-content: initial;
58
- -ms-flex-line-pack: initial;
59
- align-content: initial;
60
50
  -webkit-align-items: center;
61
51
  -webkit-box-align: center;
62
52
  -ms-flex-align: center;
63
53
  align-items: center;
54
+ display: -webkit-box;
55
+ display: -webkit-flex;
56
+ display: -ms-flexbox;
57
+ display: flex;
64
58
  }
65
59
 
66
60
  .emotion-2[data-disabled='true'] {
@@ -120,6 +114,10 @@ exports[`Option component snapshot in active state 1`] = `
120
114
  -moz-user-select: none;
121
115
  -ms-user-select: none;
122
116
  user-select: none;
117
+ -webkit-box-flex: 1;
118
+ -webkit-flex-grow: 1;
119
+ -ms-flex-positive: 1;
120
+ flex-grow: 1;
123
121
  overflow: hidden;
124
122
  text-overflow: ellipsis;
125
123
  }
@@ -151,24 +149,14 @@ exports[`Option component snapshot in active state 1`] = `
151
149
  overflow-x: hidden;
152
150
  text-overflow: ellipsis;
153
151
  white-space: nowrap;
154
- display: -webkit-box;
155
- display: -webkit-flex;
156
- display: -ms-flexbox;
157
- display: flex;
158
- -webkit-flex-direction: row;
159
- -ms-flex-direction: row;
160
- flex-direction: row;
161
- -webkit-box-pack: justify;
162
- -webkit-justify-content: space-between;
163
- -ms-flex-pack: justify;
164
- justify-content: space-between;
165
- -webkit-align-content: initial;
166
- -ms-flex-line-pack: initial;
167
- align-content: initial;
168
152
  -webkit-align-items: center;
169
153
  -webkit-box-align: center;
170
154
  -ms-flex-align: center;
171
155
  align-items: center;
156
+ display: -webkit-box;
157
+ display: -webkit-flex;
158
+ display: -ms-flexbox;
159
+ display: flex;
172
160
  background-color: #F7F7F9;
173
161
  }
174
162
 
@@ -226,6 +214,10 @@ exports[`Option component snapshot in selected state 1`] = `
226
214
  -moz-user-select: none;
227
215
  -ms-user-select: none;
228
216
  user-select: none;
217
+ -webkit-box-flex: 1;
218
+ -webkit-flex-grow: 1;
219
+ -ms-flex-positive: 1;
220
+ flex-grow: 1;
229
221
  overflow: hidden;
230
222
  text-overflow: ellipsis;
231
223
  }
@@ -257,24 +249,14 @@ exports[`Option component snapshot in selected state 1`] = `
257
249
  overflow-x: hidden;
258
250
  text-overflow: ellipsis;
259
251
  white-space: nowrap;
260
- display: -webkit-box;
261
- display: -webkit-flex;
262
- display: -ms-flexbox;
263
- display: flex;
264
- -webkit-flex-direction: row;
265
- -ms-flex-direction: row;
266
- flex-direction: row;
267
- -webkit-box-pack: justify;
268
- -webkit-justify-content: space-between;
269
- -ms-flex-pack: justify;
270
- justify-content: space-between;
271
- -webkit-align-content: initial;
272
- -ms-flex-line-pack: initial;
273
- align-content: initial;
274
252
  -webkit-align-items: center;
275
253
  -webkit-box-align: center;
276
254
  -ms-flex-align: center;
277
255
  align-items: center;
256
+ display: -webkit-box;
257
+ display: -webkit-flex;
258
+ display: -ms-flexbox;
259
+ display: flex;
278
260
  color: #101721;
279
261
  font-weight: 500;
280
262
  font-size: 14px;
@@ -6,6 +6,10 @@ exports[`Component: OptionGroup default snapshot 1`] = `
6
6
  -moz-user-select: none;
7
7
  -ms-user-select: none;
8
8
  user-select: none;
9
+ -webkit-box-flex: 1;
10
+ -webkit-flex-grow: 1;
11
+ -ms-flex-positive: 1;
12
+ flex-grow: 1;
9
13
  overflow: hidden;
10
14
  text-overflow: ellipsis;
11
15
  }
@@ -49,24 +53,14 @@ exports[`Component: OptionGroup default snapshot 1`] = `
49
53
  overflow-x: hidden;
50
54
  text-overflow: ellipsis;
51
55
  white-space: nowrap;
52
- display: -webkit-box;
53
- display: -webkit-flex;
54
- display: -ms-flexbox;
55
- display: flex;
56
- -webkit-flex-direction: row;
57
- -ms-flex-direction: row;
58
- flex-direction: row;
59
- -webkit-box-pack: justify;
60
- -webkit-justify-content: space-between;
61
- -ms-flex-pack: justify;
62
- justify-content: space-between;
63
- -webkit-align-content: initial;
64
- -ms-flex-line-pack: initial;
65
- align-content: initial;
66
56
  -webkit-align-items: center;
67
57
  -webkit-box-align: center;
68
58
  -ms-flex-align: center;
69
59
  align-items: center;
60
+ display: -webkit-box;
61
+ display: -webkit-flex;
62
+ display: -ms-flexbox;
63
+ display: flex;
70
64
  }
71
65
 
72
66
  .emotion-1[data-disabled='true'] {
@@ -639,6 +633,10 @@ Array [
639
633
  -moz-user-select: none;
640
634
  -ms-user-select: none;
641
635
  user-select: none;
636
+ -webkit-box-flex: 1;
637
+ -webkit-flex-grow: 1;
638
+ -ms-flex-positive: 1;
639
+ flex-grow: 1;
642
640
  overflow: hidden;
643
641
  text-overflow: ellipsis;
644
642
  }
@@ -682,24 +680,14 @@ Array [
682
680
  overflow-x: hidden;
683
681
  text-overflow: ellipsis;
684
682
  white-space: nowrap;
685
- display: -webkit-box;
686
- display: -webkit-flex;
687
- display: -ms-flexbox;
688
- display: flex;
689
- -webkit-flex-direction: row;
690
- -ms-flex-direction: row;
691
- flex-direction: row;
692
- -webkit-box-pack: justify;
693
- -webkit-justify-content: space-between;
694
- -ms-flex-pack: justify;
695
- justify-content: space-between;
696
- -webkit-align-content: initial;
697
- -ms-flex-line-pack: initial;
698
- align-content: initial;
699
683
  -webkit-align-items: center;
700
684
  -webkit-box-align: center;
701
685
  -ms-flex-align: center;
702
686
  align-items: center;
687
+ display: -webkit-box;
688
+ display: -webkit-flex;
689
+ display: -ms-flexbox;
690
+ display: flex;
703
691
  }
704
692
 
705
693
  .emotion-2[data-disabled='true'] {
@@ -1316,6 +1304,10 @@ Array [
1316
1304
  -moz-user-select: none;
1317
1305
  -ms-user-select: none;
1318
1306
  user-select: none;
1307
+ -webkit-box-flex: 1;
1308
+ -webkit-flex-grow: 1;
1309
+ -ms-flex-positive: 1;
1310
+ flex-grow: 1;
1319
1311
  overflow: hidden;
1320
1312
  text-overflow: ellipsis;
1321
1313
  }
@@ -1359,24 +1351,14 @@ Array [
1359
1351
  overflow-x: hidden;
1360
1352
  text-overflow: ellipsis;
1361
1353
  white-space: nowrap;
1362
- display: -webkit-box;
1363
- display: -webkit-flex;
1364
- display: -ms-flexbox;
1365
- display: flex;
1366
- -webkit-flex-direction: row;
1367
- -ms-flex-direction: row;
1368
- flex-direction: row;
1369
- -webkit-box-pack: justify;
1370
- -webkit-justify-content: space-between;
1371
- -ms-flex-pack: justify;
1372
- justify-content: space-between;
1373
- -webkit-align-content: initial;
1374
- -ms-flex-line-pack: initial;
1375
- align-content: initial;
1376
1354
  -webkit-align-items: center;
1377
1355
  -webkit-box-align: center;
1378
1356
  -ms-flex-align: center;
1379
1357
  align-items: center;
1358
+ display: -webkit-box;
1359
+ display: -webkit-flex;
1360
+ display: -ms-flexbox;
1361
+ display: flex;
1380
1362
  }
1381
1363
 
1382
1364
  .emotion-1[data-disabled='true'] {
@@ -10,7 +10,6 @@ export const rowWrapper = css({
10
10
  lineHeight: "28px",
11
11
  zIndex: 999,
12
12
  ...mixins.textEllipsis,
13
- ...mixins.flexSpaceBetween,
14
13
  alignItems: "center",
15
14
  display: "flex",
16
15
  "&:last-of-type": {
@@ -23,6 +22,7 @@ export const rowWrapper = css({
23
22
 
24
23
  export const labelWrap = css({
25
24
  userSelect: "none",
25
+ flexGrow: 1,
26
26
  overflow: "hidden",
27
27
  textOverflow: "ellipsis"
28
28
  });
@@ -8,5 +8,6 @@ export interface OptionProps<OptionType>
8
8
  isSelected?: boolean;
9
9
  multiSelect?: boolean;
10
10
  labelClassName?: string;
11
+ leftElement?: (props: OptionProps<OptionType>) => React.ReactNode;
11
12
  rightElement?: (props: OptionProps<OptionType>) => React.ReactNode;
12
13
  }
@@ -1,6 +1,7 @@
1
1
  import { CommonProps, Extras } from "./OptionGroup";
2
2
 
3
3
  export interface OptionGroupCheckBoxProps<OptionType> extends CommonProps {
4
+ wrapClassName?: string;
4
5
  onChange: (value: OptionType[], extras: Extras) => void;
5
6
  /**
6
7
  * @deprecated use isSelected