beem-component 1.7.5 → 1.7.6
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/dist/components/Checkbox/checkboxToggler.js +3 -2
- package/dist/components/Checkbox/checkboxToggler.stories.js +23 -2
- package/package.json +1 -1
- package/src/App.js +23 -1
- package/src/lib/components/Checkbox/checkboxToggler.js +13 -4
- package/src/lib/components/Checkbox/checkboxToggler.stories.js +16 -0
|
@@ -37,8 +37,9 @@ var BmCheckboxToggle = function BmCheckboxToggle(_ref2) {
|
|
|
37
37
|
var checked = _ref2.checked,
|
|
38
38
|
_onChange = _ref2.onChange,
|
|
39
39
|
disabled = _ref2.disabled,
|
|
40
|
-
label = _ref2.label
|
|
41
|
-
|
|
40
|
+
label = _ref2.label,
|
|
41
|
+
hidden = _ref2.hidden;
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement(CheckBoxWrapper, null, hidden ? null : /*#__PURE__*/_react.default.createElement(Label, {
|
|
42
43
|
htmlFor: label,
|
|
43
44
|
disabled: disabled
|
|
44
45
|
}, label), /*#__PURE__*/_react.default.createElement(CheckBox, {
|
|
@@ -5,7 +5,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = exports.Sample = exports.DisabledToggler = void 0;
|
|
8
|
+
exports.hiddenToggleLabel = exports.default = exports.Sample = exports.DisabledToggler = void 0;
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
@@ -51,6 +51,9 @@ var _default = {
|
|
|
51
51
|
},
|
|
52
52
|
disabled: {
|
|
53
53
|
description: 'for disabling the checkbox toggler'
|
|
54
|
+
},
|
|
55
|
+
hidden: {
|
|
56
|
+
description: 'for hiding the label'
|
|
54
57
|
}
|
|
55
58
|
}
|
|
56
59
|
};
|
|
@@ -89,4 +92,22 @@ var DisabledToggler = function DisabledToggler() {
|
|
|
89
92
|
});
|
|
90
93
|
};
|
|
91
94
|
|
|
92
|
-
exports.DisabledToggler = DisabledToggler;
|
|
95
|
+
exports.DisabledToggler = DisabledToggler;
|
|
96
|
+
|
|
97
|
+
var hiddenToggleLabel = function hiddenToggleLabel() {
|
|
98
|
+
var _useState5 = (0, _react.useState)(false),
|
|
99
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
100
|
+
checked = _useState6[0],
|
|
101
|
+
setChecked = _useState6[1];
|
|
102
|
+
|
|
103
|
+
return /*#__PURE__*/_react.default.createElement(_checkboxToggler.BmCheckboxToggle, {
|
|
104
|
+
hidden: true,
|
|
105
|
+
checked: checked,
|
|
106
|
+
onChange: function onChange() {
|
|
107
|
+
return setChecked(!checked);
|
|
108
|
+
},
|
|
109
|
+
label: /*#__PURE__*/_react.default.createElement("h4", null, "Field Label")
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
exports.hiddenToggleLabel = hiddenToggleLabel;
|
package/package.json
CHANGED
package/src/App.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import AttachFileIcon from '@mui/icons-material/AttachFile';
|
|
4
4
|
import EmojiEmotionsIcon from '@mui/icons-material/EmojiEmotions';
|
|
5
5
|
import SendIcon from '@mui/icons-material/Send';
|
|
6
6
|
import QuickreplyIcon from '@mui/icons-material/Quickreply';
|
|
7
|
+
import { BmCheckboxToggle } from './lib/components';
|
|
7
8
|
import {
|
|
8
9
|
BmChat,
|
|
9
10
|
BmInput,
|
|
@@ -13,6 +14,9 @@ import {
|
|
|
13
14
|
} from './lib/components';
|
|
14
15
|
|
|
15
16
|
const Chat = () => {
|
|
17
|
+
const [test, setTest] = useState(false);
|
|
18
|
+
const [test1, setTest1] = useState(false);
|
|
19
|
+
|
|
16
20
|
const image =
|
|
17
21
|
'https://scontent.fnbo1-1.fna.fbcdn.net/v/t39.30808-6/298879098_10161724947807542_5252175668064009159_n.jpg?stp=dst-jpg_p720x720&_nc_cat=100&ccb=1-7&_nc_sid=9e2e56&_nc_ohc=9uDHII_ETpUAX_KNS3Y&_nc_ht=scontent.fnbo1-1.fna&edm=APCh5TUEAAAA&oh=00_AT8sOJmRGYwgXF48_GPOCWx1soil0yK8V3AiEPkce9WJIw&oe=6304120B';
|
|
18
22
|
return (
|
|
@@ -160,6 +164,24 @@ const Chat = () => {
|
|
|
160
164
|
</div>
|
|
161
165
|
</BmChat.Footer>
|
|
162
166
|
</BmChat>
|
|
167
|
+
|
|
168
|
+
<BmCheckboxToggle
|
|
169
|
+
key="test"
|
|
170
|
+
checked={test}
|
|
171
|
+
onChange={(check) => {
|
|
172
|
+
console.log(check);
|
|
173
|
+
setTest(check)
|
|
174
|
+
}}
|
|
175
|
+
/>
|
|
176
|
+
|
|
177
|
+
<BmCheckboxToggle
|
|
178
|
+
key="test1"
|
|
179
|
+
checked={test1}
|
|
180
|
+
onChange={(check) => {
|
|
181
|
+
console.log(check);
|
|
182
|
+
setTest(check)
|
|
183
|
+
}}
|
|
184
|
+
/>
|
|
163
185
|
</>
|
|
164
186
|
);
|
|
165
187
|
};
|
|
@@ -63,12 +63,21 @@ const CheckBox = styled.input`
|
|
|
63
63
|
}
|
|
64
64
|
`;
|
|
65
65
|
|
|
66
|
-
export const BmCheckboxToggle = ({
|
|
66
|
+
export const BmCheckboxToggle = ({
|
|
67
|
+
checked,
|
|
68
|
+
onChange,
|
|
69
|
+
disabled,
|
|
70
|
+
label,
|
|
71
|
+
hidden,
|
|
72
|
+
}) => {
|
|
67
73
|
return (
|
|
68
74
|
<CheckBoxWrapper>
|
|
69
|
-
|
|
70
|
-
{label}
|
|
71
|
-
|
|
75
|
+
{hidden ? null : (
|
|
76
|
+
<Label htmlFor={label} disabled={disabled}>
|
|
77
|
+
{label}
|
|
78
|
+
</Label>
|
|
79
|
+
)}
|
|
80
|
+
|
|
72
81
|
<CheckBox
|
|
73
82
|
id={label || 'checkbox'}
|
|
74
83
|
type="checkbox"
|
|
@@ -22,6 +22,9 @@ export default {
|
|
|
22
22
|
disabled: {
|
|
23
23
|
description: 'for disabling the checkbox toggler',
|
|
24
24
|
},
|
|
25
|
+
hidden: {
|
|
26
|
+
description: 'for hiding the label',
|
|
27
|
+
},
|
|
25
28
|
},
|
|
26
29
|
};
|
|
27
30
|
export const Sample = () => {
|
|
@@ -46,3 +49,16 @@ export const DisabledToggler = () => {
|
|
|
46
49
|
/>
|
|
47
50
|
);
|
|
48
51
|
};
|
|
52
|
+
|
|
53
|
+
export const hiddenToggleLabel = () => {
|
|
54
|
+
const [checked, setChecked] = useState(false);
|
|
55
|
+
return (
|
|
56
|
+
<BmCheckboxToggle
|
|
57
|
+
hidden
|
|
58
|
+
checked={checked}
|
|
59
|
+
onChange={() => setChecked(!checked)}
|
|
60
|
+
label={<h4>Field Label</h4>}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|