beem-component 2.1.2 → 2.1.4
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/BmSelector/BmSelector.js +15 -2
- package/dist/components/BmSelector/BmSelector.stories.js +14 -1
- package/dist/components/InfoPanel/InfoPanel.js +30 -14
- package/dist/components/InfoPanel/InfoPanel.stories.js +16 -2
- package/package.json +1 -1
- package/src/lib/components/BmSelector/BmSelector.js +14 -1
- package/src/lib/components/BmSelector/BmSelector.stories.jsx +10 -0
- package/src/lib/components/InfoPanel/InfoPanel.js +5 -6
- package/src/lib/components/InfoPanel/InfoPanel.stories.jsx +18 -2
|
@@ -89,10 +89,23 @@ const BmSelector = _ref8 => {
|
|
|
89
89
|
themeColor,
|
|
90
90
|
textColor,
|
|
91
91
|
fontWeight,
|
|
92
|
-
name = 'selection'
|
|
92
|
+
name = 'selection',
|
|
93
|
+
useFormik = false
|
|
93
94
|
} = _ref8;
|
|
94
95
|
return /*#__PURE__*/_react.default.createElement(RadioGroupWrapper, null, data.map(item => {
|
|
95
96
|
const isSelected = selectedDataId === item.id;
|
|
97
|
+
const handleChange = () => {
|
|
98
|
+
if (useFormik) {
|
|
99
|
+
onChange({
|
|
100
|
+
target: {
|
|
101
|
+
name,
|
|
102
|
+
value: item.id
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
} else {
|
|
106
|
+
onChange(item.id);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
96
109
|
return /*#__PURE__*/_react.default.createElement("label", {
|
|
97
110
|
key: item.id,
|
|
98
111
|
htmlFor: item.id
|
|
@@ -101,7 +114,7 @@ const BmSelector = _ref8 => {
|
|
|
101
114
|
name: name,
|
|
102
115
|
value: item.id,
|
|
103
116
|
checked: isSelected,
|
|
104
|
-
onChange:
|
|
117
|
+
onChange: handleChange
|
|
105
118
|
}), /*#__PURE__*/_react.default.createElement(TimeSlotCard, {
|
|
106
119
|
selected: isSelected,
|
|
107
120
|
themeColor: themeColor
|
|
@@ -56,6 +56,12 @@ var _default = exports.default = {
|
|
|
56
56
|
endDate: '09:30 AM'
|
|
57
57
|
}
|
|
58
58
|
}]
|
|
59
|
+
},
|
|
60
|
+
useFormik: {
|
|
61
|
+
control: {
|
|
62
|
+
type: 'boolean'
|
|
63
|
+
},
|
|
64
|
+
defaultValue: false
|
|
59
65
|
}
|
|
60
66
|
}
|
|
61
67
|
};
|
|
@@ -102,6 +108,7 @@ Default.args = {
|
|
|
102
108
|
endDate: '09:30 AM'
|
|
103
109
|
}
|
|
104
110
|
}],
|
|
111
|
+
useFormik: false,
|
|
105
112
|
themeColor: '#33B1BA',
|
|
106
113
|
textColor: '#33B1BA',
|
|
107
114
|
fontWeight: '',
|
|
@@ -124,15 +131,21 @@ const Example = () => {
|
|
|
124
131
|
endDate: '11:10 AM'
|
|
125
132
|
}
|
|
126
133
|
}];
|
|
134
|
+
|
|
135
|
+
// When you use useFormik as true then you need to pass handleChange func and the name [name="time"].
|
|
136
|
+
// so that is works accordingly
|
|
137
|
+
|
|
127
138
|
const [selectedDataId, setSelectedDataId] = (0, _react.useState)(null);
|
|
128
139
|
return /*#__PURE__*/_react.default.createElement(_BmSelector.default, {
|
|
140
|
+
name: "time",
|
|
129
141
|
data: slots,
|
|
130
142
|
selectedDataId: selectedDataId,
|
|
131
143
|
onChange: setSelectedDataId,
|
|
132
144
|
icon: _AccessTime.default,
|
|
133
145
|
themeColor: "#33B1BA",
|
|
134
146
|
textColor: "#33B1BA",
|
|
135
|
-
fontWeight: "600"
|
|
147
|
+
fontWeight: "600",
|
|
148
|
+
useFormik: "false"
|
|
136
149
|
});
|
|
137
150
|
};
|
|
138
151
|
exports.Example = Example;
|
|
@@ -80,25 +80,35 @@ const RowContainer = _styledComponents.default.div.withConfig({
|
|
|
80
80
|
})(["display:flex;justify-content:space-between;font-size:0.875rem;align-items:center;@media (max-width:42.8571rem){font-size:0.8rem;}"]);
|
|
81
81
|
const Label = _styledComponents.default.span.withConfig({
|
|
82
82
|
displayName: "InfoPanel__Label"
|
|
83
|
-
})(["color:
|
|
83
|
+
})(["color:", ";@media (max-width:42.8571rem){font-size:0.75rem;}"], _ref6 => {
|
|
84
|
+
let {
|
|
85
|
+
labelTextColor
|
|
86
|
+
} = _ref6;
|
|
87
|
+
return hexToRgba(labelTextColor || '#000000', 0.6);
|
|
88
|
+
});
|
|
84
89
|
const Value = _styledComponents.default.span.withConfig({
|
|
85
90
|
displayName: "InfoPanel__Value"
|
|
86
|
-
})(["font-weight:500;@media (max-width:42.8571rem){font-size:0.75rem;}"]
|
|
91
|
+
})(["font-weight:500;color:", ";@media (max-width:42.8571rem){font-size:0.75rem;}"], _ref7 => {
|
|
92
|
+
let {
|
|
93
|
+
valueTextColor
|
|
94
|
+
} = _ref7;
|
|
95
|
+
return hexToRgba(valueTextColor || '#000000', 1);
|
|
96
|
+
});
|
|
87
97
|
const Divider = _styledComponents.default.hr.withConfig({
|
|
88
98
|
displayName: "InfoPanel__Divider"
|
|
89
|
-
})(["border:none;border-top:", ";margin:1rem auto;max-width:97%;@media (max-width:42.8571rem){margin:0.75rem auto;max-width:97%;}"],
|
|
99
|
+
})(["border:none;border-top:", ";margin:1rem auto;max-width:97%;@media (max-width:42.8571rem){margin:0.75rem auto;max-width:97%;}"], _ref8 => {
|
|
90
100
|
let {
|
|
91
101
|
showDivider,
|
|
92
102
|
dividerColor = '#33b1ba',
|
|
93
103
|
dividerType = 'dashed',
|
|
94
104
|
dividerWitdh = '1px',
|
|
95
105
|
dividerOpacity = '0.2'
|
|
96
|
-
} =
|
|
106
|
+
} = _ref8;
|
|
97
107
|
if (showDivider) {
|
|
98
108
|
return "".concat(dividerWitdh, " ").concat(dividerType, " ").concat(hexToRgba(dividerColor, dividerOpacity));
|
|
99
109
|
}
|
|
100
110
|
});
|
|
101
|
-
const SectionSummary =
|
|
111
|
+
const SectionSummary = _ref9 => {
|
|
102
112
|
let {
|
|
103
113
|
icon: Icon,
|
|
104
114
|
title,
|
|
@@ -106,7 +116,7 @@ const SectionSummary = _ref7 => {
|
|
|
106
116
|
textColor,
|
|
107
117
|
subtitle,
|
|
108
118
|
iconBackgroundColor
|
|
109
|
-
} =
|
|
119
|
+
} = _ref9;
|
|
110
120
|
return /*#__PURE__*/_react.default.createElement(SectionSummaryContainer, null, Icon && /*#__PURE__*/_react.default.createElement(IconBox, {
|
|
111
121
|
iconColor: iconColor,
|
|
112
122
|
iconBackgroundColor: iconBackgroundColor
|
|
@@ -116,13 +126,13 @@ const SectionSummary = _ref7 => {
|
|
|
116
126
|
textColor: textColor
|
|
117
127
|
}, subtitle)));
|
|
118
128
|
};
|
|
119
|
-
const BmInfoPanel =
|
|
129
|
+
const BmInfoPanel = _ref0 => {
|
|
120
130
|
let {
|
|
121
131
|
children
|
|
122
|
-
} =
|
|
132
|
+
} = _ref0;
|
|
123
133
|
return /*#__PURE__*/_react.default.createElement(Panel, null, children);
|
|
124
134
|
};
|
|
125
|
-
const Section =
|
|
135
|
+
const Section = _ref1 => {
|
|
126
136
|
let {
|
|
127
137
|
title,
|
|
128
138
|
icon: Icon,
|
|
@@ -135,7 +145,7 @@ const Section = _ref9 => {
|
|
|
135
145
|
dividerWitdh,
|
|
136
146
|
dividerType,
|
|
137
147
|
dividerOpacity
|
|
138
|
-
} =
|
|
148
|
+
} = _ref1;
|
|
139
149
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, showDivider && /*#__PURE__*/_react.default.createElement(Divider, {
|
|
140
150
|
dividerColor: dividerColor,
|
|
141
151
|
showDivider: showDivider,
|
|
@@ -149,12 +159,18 @@ const Section = _ref9 => {
|
|
|
149
159
|
iconBackgroundColor: iconBackgroundColor
|
|
150
160
|
}, /*#__PURE__*/_react.default.createElement(Icon, null)), /*#__PURE__*/_react.default.createElement(SectionTitle, null, title)), /*#__PURE__*/_react.default.createElement(SectionBody, null, children));
|
|
151
161
|
};
|
|
152
|
-
const Row =
|
|
162
|
+
const Row = _ref10 => {
|
|
153
163
|
let {
|
|
154
164
|
label,
|
|
155
|
-
value
|
|
156
|
-
|
|
157
|
-
|
|
165
|
+
value,
|
|
166
|
+
labelTextColor,
|
|
167
|
+
valueTextColor
|
|
168
|
+
} = _ref10;
|
|
169
|
+
return /*#__PURE__*/_react.default.createElement(RowContainer, null, /*#__PURE__*/_react.default.createElement(Label, {
|
|
170
|
+
labelTextColor: labelTextColor
|
|
171
|
+
}, label, ":"), /*#__PURE__*/_react.default.createElement(Value, {
|
|
172
|
+
valueTextColor: valueTextColor
|
|
173
|
+
}, value));
|
|
158
174
|
};
|
|
159
175
|
BmInfoPanel.Section = Section;
|
|
160
176
|
BmInfoPanel.Row = Row;
|
|
@@ -70,6 +70,12 @@ var _default = exports.default = {
|
|
|
70
70
|
},
|
|
71
71
|
options: ['dashed', 'solid'],
|
|
72
72
|
defaultValue: 'dashed'
|
|
73
|
+
},
|
|
74
|
+
labelTextColor: {
|
|
75
|
+
control: 'color'
|
|
76
|
+
},
|
|
77
|
+
valueTextColor: {
|
|
78
|
+
control: 'color'
|
|
73
79
|
}
|
|
74
80
|
}
|
|
75
81
|
};
|
|
@@ -84,7 +90,9 @@ const Template = _ref => {
|
|
|
84
90
|
dividerColor,
|
|
85
91
|
dividerOpacity,
|
|
86
92
|
dividerType,
|
|
87
|
-
dividerWidth
|
|
93
|
+
dividerWidth,
|
|
94
|
+
labelTextColor,
|
|
95
|
+
valueTextColor
|
|
88
96
|
} = _ref;
|
|
89
97
|
if (variant === 'summary') {
|
|
90
98
|
return /*#__PURE__*/_react.default.createElement(_InfoPanel.default, {
|
|
@@ -126,6 +134,8 @@ const Template = _ref => {
|
|
|
126
134
|
label: "Date",
|
|
127
135
|
value: "Monday, June 24, 2025"
|
|
128
136
|
}), /*#__PURE__*/_react.default.createElement(_InfoPanel.default.Row, {
|
|
137
|
+
labelTextColor: labelTextColor,
|
|
138
|
+
valueTextColor: valueTextColor,
|
|
129
139
|
label: "Time",
|
|
130
140
|
value: "09:00 AM"
|
|
131
141
|
})), /*#__PURE__*/_react.default.createElement(_InfoPanel.default.Section, {
|
|
@@ -159,7 +169,9 @@ Default.args = {
|
|
|
159
169
|
dividerColor: '#33b1ba',
|
|
160
170
|
dividerType: 'dashed',
|
|
161
171
|
dividerWidth: '1px',
|
|
162
|
-
dividerOpacity: '0.2'
|
|
172
|
+
dividerOpacity: '0.2',
|
|
173
|
+
labelTextColor: '#e46a8e',
|
|
174
|
+
valueTextColor: '#235e92'
|
|
163
175
|
};
|
|
164
176
|
const ExampleSummary = () => {
|
|
165
177
|
return /*#__PURE__*/_react.default.createElement(_InfoPanel.default, null, /*#__PURE__*/_react.default.createElement(_InfoPanel.default.Section, {
|
|
@@ -196,6 +208,8 @@ const ExampleDetails = () => {
|
|
|
196
208
|
label: "Resource",
|
|
197
209
|
value: formData.resourceName
|
|
198
210
|
}), /*#__PURE__*/_react.default.createElement(_InfoPanel.default.Row, {
|
|
211
|
+
labelTextColor: "#e46a8e",
|
|
212
|
+
valueTextColor: "#235e92",
|
|
199
213
|
label: "Duration",
|
|
200
214
|
value: appointmentDetails.duration
|
|
201
215
|
}), /*#__PURE__*/_react.default.createElement(_InfoPanel.default.Row, {
|
package/package.json
CHANGED
|
@@ -120,11 +120,24 @@ const BmSelector = ({
|
|
|
120
120
|
textColor,
|
|
121
121
|
fontWeight,
|
|
122
122
|
name = 'selection',
|
|
123
|
+
useFormik = false,
|
|
123
124
|
}) => {
|
|
124
125
|
return (
|
|
125
126
|
<RadioGroupWrapper>
|
|
126
127
|
{data.map((item) => {
|
|
127
128
|
const isSelected = selectedDataId === item.id;
|
|
129
|
+
const handleChange = () => {
|
|
130
|
+
if (useFormik) {
|
|
131
|
+
onChange({
|
|
132
|
+
target: {
|
|
133
|
+
name,
|
|
134
|
+
value: item.id,
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
} else {
|
|
138
|
+
onChange(item.id);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
128
141
|
|
|
129
142
|
return (
|
|
130
143
|
<label key={item.id} htmlFor={item.id}>
|
|
@@ -133,7 +146,7 @@ const BmSelector = ({
|
|
|
133
146
|
name={name}
|
|
134
147
|
value={item.id}
|
|
135
148
|
checked={isSelected}
|
|
136
|
-
onChange={
|
|
149
|
+
onChange={handleChange}
|
|
137
150
|
/>
|
|
138
151
|
<TimeSlotCard selected={isSelected} themeColor={themeColor}>
|
|
139
152
|
<CustomRadio selected={isSelected} themeColor={themeColor} />
|
|
@@ -44,6 +44,10 @@ export default {
|
|
|
44
44
|
},
|
|
45
45
|
],
|
|
46
46
|
},
|
|
47
|
+
useFormik: {
|
|
48
|
+
control: { type: 'boolean' },
|
|
49
|
+
defaultValue: false,
|
|
50
|
+
},
|
|
47
51
|
},
|
|
48
52
|
};
|
|
49
53
|
|
|
@@ -89,6 +93,7 @@ Default.args = {
|
|
|
89
93
|
value: { startDate: '09:00 AM', endDate: '09:30 AM' },
|
|
90
94
|
},
|
|
91
95
|
],
|
|
96
|
+
useFormik: false,
|
|
92
97
|
|
|
93
98
|
themeColor: '#33B1BA',
|
|
94
99
|
textColor: '#33B1BA',
|
|
@@ -110,9 +115,13 @@ export const Example = () => {
|
|
|
110
115
|
},
|
|
111
116
|
];
|
|
112
117
|
|
|
118
|
+
// When you use useFormik as true then you need to pass handleChange func and the name [name="time"].
|
|
119
|
+
// so that is works accordingly
|
|
120
|
+
|
|
113
121
|
const [selectedDataId, setSelectedDataId] = useState(null);
|
|
114
122
|
return (
|
|
115
123
|
<BmSelector
|
|
124
|
+
name="time"
|
|
116
125
|
data={slots}
|
|
117
126
|
selectedDataId={selectedDataId}
|
|
118
127
|
onChange={setSelectedDataId}
|
|
@@ -120,6 +129,7 @@ export const Example = () => {
|
|
|
120
129
|
themeColor="#33B1BA"
|
|
121
130
|
textColor="#33B1BA"
|
|
122
131
|
fontWeight="600"
|
|
132
|
+
useFormik="false"
|
|
123
133
|
/>
|
|
124
134
|
);
|
|
125
135
|
};
|
|
@@ -134,8 +134,7 @@ const RowContainer = styled.div`
|
|
|
134
134
|
`;
|
|
135
135
|
|
|
136
136
|
const Label = styled.span`
|
|
137
|
-
color:
|
|
138
|
-
|
|
137
|
+
color: ${({ labelTextColor }) => hexToRgba(labelTextColor || '#000000', 0.6)};
|
|
139
138
|
@media (max-width: 42.8571rem) {
|
|
140
139
|
font-size: 0.75rem;
|
|
141
140
|
}
|
|
@@ -143,7 +142,7 @@ const Label = styled.span`
|
|
|
143
142
|
|
|
144
143
|
const Value = styled.span`
|
|
145
144
|
font-weight: 500;
|
|
146
|
-
|
|
145
|
+
color: ${({ valueTextColor }) => hexToRgba(valueTextColor || '#000000', 1)};
|
|
147
146
|
@media (max-width: 42.8571rem) {
|
|
148
147
|
font-size: 0.75rem;
|
|
149
148
|
}
|
|
@@ -232,10 +231,10 @@ const Section = ({
|
|
|
232
231
|
</>
|
|
233
232
|
);
|
|
234
233
|
|
|
235
|
-
const Row = ({ label, value }) => (
|
|
234
|
+
const Row = ({ label, value, labelTextColor, valueTextColor }) => (
|
|
236
235
|
<RowContainer>
|
|
237
|
-
<Label>{label}:</Label>
|
|
238
|
-
<Value>{value}</Value>
|
|
236
|
+
<Label labelTextColor={labelTextColor}>{label}:</Label>
|
|
237
|
+
<Value valueTextColor={valueTextColor}>{value}</Value>
|
|
239
238
|
</RowContainer>
|
|
240
239
|
);
|
|
241
240
|
|
|
@@ -39,6 +39,8 @@ export default {
|
|
|
39
39
|
options: ['dashed', 'solid'],
|
|
40
40
|
defaultValue: 'dashed',
|
|
41
41
|
},
|
|
42
|
+
labelTextColor: { control: 'color' },
|
|
43
|
+
valueTextColor: { control: 'color' },
|
|
42
44
|
},
|
|
43
45
|
};
|
|
44
46
|
|
|
@@ -53,6 +55,8 @@ const Template = ({
|
|
|
53
55
|
dividerOpacity,
|
|
54
56
|
dividerType,
|
|
55
57
|
dividerWidth,
|
|
58
|
+
labelTextColor,
|
|
59
|
+
valueTextColor,
|
|
56
60
|
}) => {
|
|
57
61
|
if (variant === 'summary') {
|
|
58
62
|
return (
|
|
@@ -90,7 +94,12 @@ const Template = ({
|
|
|
90
94
|
<BmInfoPanel.Row label="Resource" value="Dr. Smith" />
|
|
91
95
|
<BmInfoPanel.Row label="Duration" value="30 minutes" />
|
|
92
96
|
<BmInfoPanel.Row label="Date" value="Monday, June 24, 2025" />
|
|
93
|
-
<BmInfoPanel.Row
|
|
97
|
+
<BmInfoPanel.Row
|
|
98
|
+
labelTextColor={labelTextColor}
|
|
99
|
+
valueTextColor={valueTextColor}
|
|
100
|
+
label="Time"
|
|
101
|
+
value="09:00 AM"
|
|
102
|
+
/>
|
|
94
103
|
</BmInfoPanel.Section>
|
|
95
104
|
|
|
96
105
|
<BmInfoPanel.Section
|
|
@@ -123,6 +132,8 @@ Default.args = {
|
|
|
123
132
|
dividerType: 'dashed',
|
|
124
133
|
dividerWidth: '1px',
|
|
125
134
|
dividerOpacity: '0.2',
|
|
135
|
+
labelTextColor: '#e46a8e',
|
|
136
|
+
valueTextColor: '#235e92',
|
|
126
137
|
};
|
|
127
138
|
|
|
128
139
|
export const ExampleSummary = () => {
|
|
@@ -162,7 +173,12 @@ export const ExampleDetails = () => {
|
|
|
162
173
|
<BmInfoPanel.Row label="Type" value={appointmentDetails.title} />
|
|
163
174
|
<BmInfoPanel.Row label="Department" value={formData.departmentName} />
|
|
164
175
|
<BmInfoPanel.Row label="Resource" value={formData.resourceName} />
|
|
165
|
-
<BmInfoPanel.Row
|
|
176
|
+
<BmInfoPanel.Row
|
|
177
|
+
labelTextColor="#e46a8e"
|
|
178
|
+
valueTextColor="#235e92"
|
|
179
|
+
label="Duration"
|
|
180
|
+
value={appointmentDetails.duration}
|
|
181
|
+
/>
|
|
166
182
|
<BmInfoPanel.Row label="Date" value={formData.date.toDateString()} />
|
|
167
183
|
<BmInfoPanel.Row
|
|
168
184
|
label="Time"
|