loon-bulma-react 2022.2.1 → 2022.2.2

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/README.md CHANGED
@@ -467,7 +467,7 @@ De Calendar Component toont events in een grid-view. Er zijn 2 verschillende soo
467
467
  - Events met een start-tijd
468
468
  - Events zonder starttijd of met allday = true
469
469
 
470
- Events hebben het onderstaande type nodig. Daarvan zijn `id`, `title`, `startDateTime` de 3 verplichte properties, de rest is optioneel. De `evtColor` en de `txtColor` hebben de default waarden resp `#ee8000` en `#ffffff`. Voor deze waarden kunnen alleen hex-waarden worden gebruikt.
470
+ Events hebben het onderstaande type nodig. Daarvan zijn `id`, `title`, `startDateTime` de 3 verplichte properties, de rest is optioneel. De `evtColor` en de `txtColor` hebben de default waarden resp `#ee8000` en `#ffffff`. Voor deze waarden kunnen hex-waarden of de Bulma-kleuren 'p', 's', 'i', 'l', 'w', 'd' worden gebruikt.
471
471
 
472
472
  ```ts
473
473
  export type BaseEventProps = {
package/dist/index.js CHANGED
@@ -4132,9 +4132,45 @@ function AlldayEvent(props) {
4132
4132
  isHovered = _useState[0],
4133
4133
  setHovered = _useState[1];
4134
4134
 
4135
+ var evtColor = typeof event.evtColor == 'function' ? event.evtColor() : event.evtColor;
4136
+ var divClass = '';
4137
+
4138
+ switch (evtColor) {
4139
+ case 'p':
4140
+ divClass = isHovered ? 'has-background-primary-dark' : 'has-background-primary';
4141
+ break;
4142
+
4143
+ case 'i':
4144
+ divClass = isHovered ? 'has-background-info-dark' : 'has-background-info';
4145
+ break;
4146
+
4147
+ case 'l':
4148
+ divClass = isHovered ? 'has-background-link-dark' : 'has-background-link';
4149
+ break;
4150
+
4151
+ case 'd':
4152
+ divClass = isHovered ? 'has-background-danger-dark' : 'has-background-danger';
4153
+ break;
4154
+
4155
+ case 'w':
4156
+ divClass = isHovered ? 'has-background-warning-dark' : 'has-background-warning';
4157
+ break;
4158
+
4159
+ case 's':
4160
+ divClass = isHovered ? 'has-background-success-dark' : 'has-background-success';
4161
+ break;
4162
+
4163
+ default:
4164
+ divClass = '';
4165
+ break;
4166
+ }
4167
+
4135
4168
  var eventStyle = React__default.useMemo(function () {
4136
- var bgColor = (event.evtColor ? typeof event.evtColor == 'function' ? event.evtColor() : event.evtColor : typeof (options === null || options === void 0 ? void 0 : options.evtColor) == 'function' ? options.evtColor(event) : options === null || options === void 0 ? void 0 : options.evtColor) || ' #ee8000';
4137
- if (isHovered && options !== null && options !== void 0 && options.evtHoverColor) bgColor = typeof options.evtHoverColor == 'function' ? options.evtHoverColor(event) : options.evtHoverColor;else bgColor += isHovered ? 'ff' : 'dd';
4169
+ var bgColor = '';
4170
+ if (typeof event.evtColor == 'string' && ['p', 'l', 'i', 's', 'd', 'w'].includes(event.evtColor)) bgColor = 'transparent';else {
4171
+ bgColor = (event.evtColor ? typeof event.evtColor == 'function' ? event.evtColor() : event.evtColor : typeof (options === null || options === void 0 ? void 0 : options.evtColor) == 'function' ? options.evtColor(event) : options === null || options === void 0 ? void 0 : options.evtColor) || ' #ee8000';
4172
+ if (isHovered && options !== null && options !== void 0 && options.evtHoverColor) bgColor = typeof options.evtHoverColor == 'function' ? options.evtHoverColor(event) : options.evtHoverColor;else bgColor += isHovered ? 'ff' : 'dd';
4173
+ }
4138
4174
  var txtColor = (event.txtColor ? typeof event.txtColor == 'function' ? event.txtColor() : event.txtColor : typeof (options === null || options === void 0 ? void 0 : options.txtColor) == 'function' ? options.txtColor(event) : options === null || options === void 0 ? void 0 : options.txtColor) || '#ffffff';
4139
4175
  if (isHovered && options !== null && options !== void 0 && options.txtHoverColor) txtColor = typeof options.txtHoverColor == 'function' ? options.txtHoverColor(event) : options.txtHoverColor;
4140
4176
  return _extends({}, baseEventStyles, {
@@ -4146,6 +4182,7 @@ function AlldayEvent(props) {
4146
4182
  }, [props.event, isHovered]);
4147
4183
  var tooltip = createTooltip(event);
4148
4184
  return React__default.createElement("div", {
4185
+ className: divClass,
4149
4186
  title: tooltip,
4150
4187
  onClick: function onClick(e) {
4151
4188
  return _onClick && _onClick(event, e);
@@ -4180,8 +4217,11 @@ function TimedEvent(props) {
4180
4217
  });
4181
4218
  }, [isHovered]);
4182
4219
  var eventSpan = React__default.useMemo(function () {
4183
- var evtColor = event.evtColor ? typeof event.evtColor == 'function' ? event.evtColor() : event.evtColor : (typeof (options === null || options === void 0 ? void 0 : options.evtColor) == 'function' ? options.evtColor(event) : options === null || options === void 0 ? void 0 : options.evtColor) || ' #ee8000';
4184
- if (isHovered && options !== null && options !== void 0 && options.evtHoverColor) evtColor = typeof options.evtHoverColor == 'function' ? options.evtHoverColor(event) : options.evtHoverColor;else evtColor += isHovered ? 'ff' : 'dd';
4220
+ var evtColor = '';
4221
+ if (typeof event.evtColor == 'string' && ['p', 'l', 'i', 's', 'd', 'w'].includes(event.evtColor)) evtColor = 'transparent';else {
4222
+ evtColor = event.evtColor ? typeof event.evtColor == 'function' ? event.evtColor() : event.evtColor : (typeof (options === null || options === void 0 ? void 0 : options.evtColor) == 'function' ? options.evtColor(event) : options === null || options === void 0 ? void 0 : options.evtColor) || ' #ee8000';
4223
+ if (isHovered && options !== null && options !== void 0 && options.evtHoverColor) evtColor = typeof options.evtHoverColor == 'function' ? options.evtHoverColor(event) : options.evtHoverColor;else evtColor += isHovered ? 'ff' : 'dd';
4224
+ }
4185
4225
  return {
4186
4226
  width: '0.9em',
4187
4227
  height: '0.9em',
@@ -4192,6 +4232,39 @@ function TimedEvent(props) {
4192
4232
  transition: 'background-color .2s ease-in-out'
4193
4233
  };
4194
4234
  }, [props.event, isHovered]);
4235
+ var evtColor = typeof event.evtColor == 'function' ? event.evtColor() : event.evtColor;
4236
+ var divClass = '';
4237
+
4238
+ switch (evtColor) {
4239
+ case 'p':
4240
+ divClass = isHovered ? 'has-background-primary-dark' : 'has-background-primary';
4241
+ break;
4242
+
4243
+ case 'i':
4244
+ divClass = isHovered ? 'has-background-info-dark' : 'has-background-info';
4245
+ break;
4246
+
4247
+ case 'l':
4248
+ divClass = isHovered ? 'has-background-link-dark' : 'has-background-link';
4249
+ break;
4250
+
4251
+ case 'd':
4252
+ divClass = isHovered ? 'has-background-danger-dark' : 'has-background-danger';
4253
+ break;
4254
+
4255
+ case 'w':
4256
+ divClass = isHovered ? 'has-background-warning-dark' : 'has-background-warning';
4257
+ break;
4258
+
4259
+ case 's':
4260
+ divClass = isHovered ? 'has-background-success-dark' : 'has-background-success';
4261
+ break;
4262
+
4263
+ default:
4264
+ divClass = '';
4265
+ break;
4266
+ }
4267
+
4195
4268
  var timeStr = formatDate(event.startDateTime, 'HH:mm');
4196
4269
  var tooltip = createTooltip(event);
4197
4270
  return React__default.createElement("div", {
@@ -4207,6 +4280,7 @@ function TimedEvent(props) {
4207
4280
  return setHovered(false);
4208
4281
  }
4209
4282
  }, React__default.createElement("span", {
4283
+ className: divClass,
4210
4284
  style: eventSpan
4211
4285
  }), React__default.createElement("b", null, timeStr), React__default.createElement("span", null, " ", typeof event.title == 'string' ? event.title : event.title()));
4212
4286
  }