loon-bulma-react 2023.0.16 → 2023.0.18
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/Calendar/DayContainer.d.ts +3 -1
- package/dist/forms/Numeric/MultiRangeInput.d.ts +3 -0
- package/dist/forms/Numeric/RangeInput.d.ts +3 -0
- package/dist/index.js +47 -32
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +47 -32
- package/dist/index.modern.js.map +1 -1
- package/package.json +7 -7
- package/styles/_all.scss +1 -0
- package/styles/bulma-color-helper-generator.scss +90 -0
- package/styles/colors.sass +38 -0
- package/styles/custom-bulma.scss +9 -1
- package/styles/range-sliders.scss +30 -73
|
@@ -12,11 +12,13 @@ declare type DayContainerProps<T extends BaseEventProps> = {
|
|
|
12
12
|
options?: CalendarOptions<T>;
|
|
13
13
|
/** De datum voor de container */
|
|
14
14
|
date: JSDateTime;
|
|
15
|
+
/** Behoort deze dag tot de huidige maand ? */
|
|
16
|
+
isCurrentMonth?: boolean;
|
|
15
17
|
};
|
|
16
18
|
/**
|
|
17
19
|
* Component voor de dag-container in de maand-view
|
|
18
20
|
* @param props
|
|
19
21
|
* @returns
|
|
20
22
|
*/
|
|
21
|
-
export declare function DayContainer<T extends BaseEventProps>({ options, date, onDayClick, onEventClick, events, }: DayContainerProps<T>): JSX.Element;
|
|
23
|
+
export declare function DayContainer<T extends BaseEventProps>({ options, date, onDayClick, onEventClick, events, isCurrentMonth, }: DayContainerProps<T>): JSX.Element;
|
|
22
24
|
export {};
|
|
@@ -5,6 +5,8 @@ declare type MultiRangeInputProps = Omit<BaseInputProps, 'icons'> & {
|
|
|
5
5
|
step?: number;
|
|
6
6
|
/** De start-waarde voor de input (optional) */
|
|
7
7
|
value?: [number, number];
|
|
8
|
+
/** een eenheid voor de waardes van de input (`%`, `kg/m3`, etc) */
|
|
9
|
+
unit?: string;
|
|
8
10
|
/**
|
|
9
11
|
* Wat te doen als de waarde is veranderd
|
|
10
12
|
* @param newVal: de nieuwe waarde
|
|
@@ -28,6 +30,7 @@ declare type MultiRangeInputProps = Omit<BaseInputProps, 'icons'> & {
|
|
|
28
30
|
* | step | `number ` | `1 ` | stapgrootte voor verschuiving |
|
|
29
31
|
* | labelHidden | `boolean` | `false` | de label is verborgen (screenreaders) |
|
|
30
32
|
* | disabled | `boolean` | `false` | de input is disabled |
|
|
33
|
+
* | unit | `string` | `''` | Een eenheid voor de waardes uit de range |
|
|
31
34
|
* | keyboardType | `search`, `text`, | `text ` | de type van de keyboard (touch-devices) |
|
|
32
35
|
* | | `email`,`tel`,`url` | | |
|
|
33
36
|
* | | `numeric`, `decimal` | | |
|
|
@@ -3,6 +3,8 @@ import { BaseInputProps } from '../shared';
|
|
|
3
3
|
declare type RangeInputProps = Omit<BaseInputProps, 'icons'> & {
|
|
4
4
|
/** Stap-grootte voor de input (optional, default = 1) */
|
|
5
5
|
step?: number;
|
|
6
|
+
/** een getals-unit (`%`, `kg/m3`, etc) om weer te geven op de range-input */
|
|
7
|
+
unit?: string;
|
|
6
8
|
/** De start-waarde voor de input (optional) */
|
|
7
9
|
value?: number;
|
|
8
10
|
/**
|
|
@@ -29,6 +31,7 @@ declare type RangeInputProps = Omit<BaseInputProps, 'icons'> & {
|
|
|
29
31
|
* | step | `number ` | `1 ` | stapgrootte voor verschuiving |
|
|
30
32
|
* | labelHidden | `boolean` | `false` | de label is verborgen (screenreaders) |
|
|
31
33
|
* | disabled | `boolean` | `false` | de input is disabled |
|
|
34
|
+
* | unit | `string ` | '' | een eenheid voor de input |
|
|
32
35
|
* | keyboardType | `search`, `text`, | `text ` | de type van de keyboard (touch-devices) |
|
|
33
36
|
* | | `email`,`tel`,`url` | | |
|
|
34
37
|
* | | `numeric`, `decimal` | | |
|
package/dist/index.js
CHANGED
|
@@ -3536,7 +3536,7 @@ function CalendarItem(_ref) {
|
|
|
3536
3536
|
setHovered = _React$useState[1];
|
|
3537
3537
|
var pickTextColor = React__default.useCallback(calculateTxtColor, []);
|
|
3538
3538
|
var eventStyle = React__default.useMemo(function () {
|
|
3539
|
-
var bgColor = isHovered ? '#f1f1f1' : '#
|
|
3539
|
+
var bgColor = isHovered ? '#f1f1f1' : '#ffffff00';
|
|
3540
3540
|
var txtColor = pickTextColor(bgColor);
|
|
3541
3541
|
return _extends({}, eventStylesBase, {
|
|
3542
3542
|
backgroundColor: bgColor,
|
|
@@ -3655,13 +3655,18 @@ function DayContainer(_ref) {
|
|
|
3655
3655
|
date = _ref.date,
|
|
3656
3656
|
onDayClick = _ref.onDayClick,
|
|
3657
3657
|
onEventClick = _ref.onEventClick,
|
|
3658
|
-
events = _ref.events
|
|
3658
|
+
events = _ref.events,
|
|
3659
|
+
_ref$isCurrentMonth = _ref.isCurrentMonth,
|
|
3660
|
+
isCurrentMonth = _ref$isCurrentMonth === void 0 ? true : _ref$isCurrentMonth;
|
|
3659
3661
|
var _React$useState = React__default.useState(false),
|
|
3660
3662
|
isHovered = _React$useState[0],
|
|
3661
3663
|
setHovered = _React$useState[1];
|
|
3662
3664
|
var pickTextColor = React__default.useCallback(calculateTxtColor, []);
|
|
3663
3665
|
var dayContainerStyle = React__default.useMemo(function () {
|
|
3664
|
-
return _extends({}, dayContainerStyleBase
|
|
3666
|
+
return _extends({}, dayContainerStyleBase, {
|
|
3667
|
+
backgroundColor: isCurrentMonth ? 'transparent' : '#f8f8f8',
|
|
3668
|
+
color: isCurrentMonth ? '#888888' : '#bbbbbb'
|
|
3669
|
+
});
|
|
3665
3670
|
}, [date, events]);
|
|
3666
3671
|
var todayHeaderStyle = React__default.useMemo(function () {
|
|
3667
3672
|
var _options$today, _options$today2;
|
|
@@ -3686,7 +3691,8 @@ function DayContainer(_ref) {
|
|
|
3686
3691
|
},
|
|
3687
3692
|
style: _extends({}, dayDateStyleBase, {
|
|
3688
3693
|
cursor: onDayClick ? 'pointer' : 'default',
|
|
3689
|
-
backgroundColor: isHovered ? '#f4f4f4' : 'transparent'
|
|
3694
|
+
backgroundColor: isHovered ? '#f4f4f4' : 'transparent',
|
|
3695
|
+
color: isCurrentMonth ? '#555555' : '#bbbbbb'
|
|
3690
3696
|
}),
|
|
3691
3697
|
onClick: function onClick(e) {
|
|
3692
3698
|
return onDayClick && onDayClick(date, e);
|
|
@@ -3695,7 +3701,7 @@ function DayContainer(_ref) {
|
|
|
3695
3701
|
style: date.isToday ? todayHeaderStyle : undefined
|
|
3696
3702
|
}, date.day), React__default.createElement("span", {
|
|
3697
3703
|
style: {
|
|
3698
|
-
color: '#
|
|
3704
|
+
color: isCurrentMonth ? '#777777' : '#bbbbbb',
|
|
3699
3705
|
fontSize: '0.66em'
|
|
3700
3706
|
}
|
|
3701
3707
|
}, " ", date.monthLong)), React__default.createElement("div", null, events.map(function (evt, index) {
|
|
@@ -4024,7 +4030,8 @@ function MonthViewDayBlocks(_ref4) {
|
|
|
4024
4030
|
onDayClick = _ref4.onDayClick,
|
|
4025
4031
|
onEventClick = _ref4.onEventClick,
|
|
4026
4032
|
options = _ref4.options,
|
|
4027
|
-
datesWithEvents = _ref4.datesWithEvents
|
|
4033
|
+
datesWithEvents = _ref4.datesWithEvents,
|
|
4034
|
+
viewDate = _ref4.viewDate;
|
|
4028
4035
|
var weekLength = visibleDays.size;
|
|
4029
4036
|
var counter = 0;
|
|
4030
4037
|
return React__default.createElement(React__default.Fragment, null, datesWithEvents.map(function (_ref5) {
|
|
@@ -4041,7 +4048,8 @@ function MonthViewDayBlocks(_ref4) {
|
|
|
4041
4048
|
events: events,
|
|
4042
4049
|
onEventClick: onEventClick,
|
|
4043
4050
|
onDayClick: onDayClick,
|
|
4044
|
-
options: options
|
|
4051
|
+
options: options,
|
|
4052
|
+
isCurrentMonth: date.hasSame(viewDate, 'month')
|
|
4045
4053
|
}));
|
|
4046
4054
|
}));
|
|
4047
4055
|
}
|
|
@@ -4912,11 +4920,14 @@ var reducer$4 = function reducer(state, action) {
|
|
|
4912
4920
|
}
|
|
4913
4921
|
};
|
|
4914
4922
|
function MultiRangeInput(props) {
|
|
4915
|
-
var _props$validation$min, _props$validation, _props$validation$max, _props$validation2, _state$
|
|
4923
|
+
var _props$validation$min, _props$validation, _props$validation$max, _props$validation2, _state$validation5, _state$validation6, _props$direction, _props$id, _state$validation$min3, _state$validation7, _state$validation$max3, _state$validation8, _state$validation9, _state$validation$min4, _state$validation10, _state$validation$max4, _state$validation11, _state$validation12;
|
|
4924
|
+
React__default.useEffect(function () {
|
|
4925
|
+
console.error('De <MultiRangeInput> werkt niet helemaal zoals het hoort. Gebruik hem voorlopig maar even niet');
|
|
4926
|
+
}, []);
|
|
4916
4927
|
var _React$useReducer = React__default.useReducer(reducer$4, {
|
|
4917
4928
|
description: props.label || props.name,
|
|
4918
|
-
valueA: props.value ? props.value[0] : +((_props$validation$min = (_props$validation = props.validation) === null || _props$validation === void 0 ? void 0 : _props$validation.min) != null ? _props$validation$min : 0),
|
|
4919
|
-
valueB: props.value ? props.value[1] : +((_props$validation$max = (_props$validation2 = props.validation) === null || _props$validation2 === void 0 ? void 0 : _props$validation2.max) != null ? _props$validation$max : 100),
|
|
4929
|
+
valueA: props.value ? props.value[0] : +((_props$validation$min = (_props$validation = props.validation) === null || _props$validation === void 0 ? void 0 : _props$validation.min) != null ? _props$validation$min : '0'),
|
|
4930
|
+
valueB: props.value ? props.value[1] : +((_props$validation$max = (_props$validation2 = props.validation) === null || _props$validation2 === void 0 ? void 0 : _props$validation2.max) != null ? _props$validation$max : '100'),
|
|
4920
4931
|
invalidMsg: '',
|
|
4921
4932
|
valid: false,
|
|
4922
4933
|
touched: false,
|
|
@@ -4925,18 +4936,20 @@ function MultiRangeInput(props) {
|
|
|
4925
4936
|
state = _React$useReducer[0],
|
|
4926
4937
|
dispatch = _React$useReducer[1];
|
|
4927
4938
|
var sliderStyle = React__default.useMemo(function () {
|
|
4928
|
-
var _state$validation$min, _state$validation, _state$validation$max, _state$
|
|
4939
|
+
var _state$validation$min, _state$validation, _state$validation$min2, _state$validation2, _state$validation$max, _state$validation3, _state$validation$max2, _state$validation4;
|
|
4929
4940
|
return {
|
|
4930
4941
|
width: '100%',
|
|
4931
4942
|
marginTop: '1em',
|
|
4932
4943
|
'--min': (_state$validation$min = (_state$validation = state.validation) === null || _state$validation === void 0 ? void 0 : _state$validation.min) != null ? _state$validation$min : 0,
|
|
4933
|
-
'--
|
|
4944
|
+
'--min-text': "\"" + ((_state$validation$min2 = (_state$validation2 = state.validation) === null || _state$validation2 === void 0 ? void 0 : _state$validation2.min) != null ? _state$validation$min2 : 0) + props.unit + "\"",
|
|
4945
|
+
'--max': (_state$validation$max = (_state$validation3 = state.validation) === null || _state$validation3 === void 0 ? void 0 : _state$validation3.max) != null ? _state$validation$max : 100,
|
|
4946
|
+
'--max-text': "\"" + ((_state$validation$max2 = (_state$validation4 = state.validation) === null || _state$validation4 === void 0 ? void 0 : _state$validation4.max) != null ? _state$validation$max2 : 100) + props.unit + "\"",
|
|
4934
4947
|
'--value-a': state.valueA,
|
|
4935
4948
|
'--value-b': state.valueB,
|
|
4936
|
-
'--text-value-a': "" + state.valueA,
|
|
4937
|
-
'--text-value-b': "" + state.valueB
|
|
4949
|
+
'--text-value-a': "" + state.valueA + props.unit,
|
|
4950
|
+
'--text-value-b': "" + state.valueB + props.unit
|
|
4938
4951
|
};
|
|
4939
|
-
}, [state.valueA, state.valueB, (_state$
|
|
4952
|
+
}, [state.valueA, state.valueB, (_state$validation5 = state.validation) === null || _state$validation5 === void 0 ? void 0 : _state$validation5.min, (_state$validation6 = state.validation) === null || _state$validation6 === void 0 ? void 0 : _state$validation6.max, props.value, props.unit]);
|
|
4940
4953
|
var onChangeValue = function onChangeValue(input, newVal) {
|
|
4941
4954
|
if (!props.disabled) {
|
|
4942
4955
|
var val = parseFloat(newVal);
|
|
@@ -4992,11 +5005,11 @@ function MultiRangeInput(props) {
|
|
|
4992
5005
|
type: "range",
|
|
4993
5006
|
name: props.name + '_A',
|
|
4994
5007
|
id: props.id + '_A',
|
|
4995
|
-
min: (_state$validation$
|
|
4996
|
-
max: (_state$validation$
|
|
5008
|
+
min: (_state$validation$min3 = (_state$validation7 = state.validation) === null || _state$validation7 === void 0 ? void 0 : _state$validation7.min) != null ? _state$validation$min3 : 0,
|
|
5009
|
+
max: (_state$validation$max3 = (_state$validation8 = state.validation) === null || _state$validation8 === void 0 ? void 0 : _state$validation8.max) != null ? _state$validation$max3 : 100,
|
|
4997
5010
|
value: state.valueA,
|
|
4998
5011
|
step: props.step,
|
|
4999
|
-
required: (_state$
|
|
5012
|
+
required: (_state$validation9 = state.validation) === null || _state$validation9 === void 0 ? void 0 : _state$validation9.required,
|
|
5000
5013
|
disabled: props.disabled,
|
|
5001
5014
|
onBlur: function onBlur() {
|
|
5002
5015
|
return !state.touched && dispatch({
|
|
@@ -5009,15 +5022,15 @@ function MultiRangeInput(props) {
|
|
|
5009
5022
|
}
|
|
5010
5023
|
}), React__default.createElement("output", {
|
|
5011
5024
|
id: props.id + '_out_A'
|
|
5012
|
-
}, state.valueA), React__default.createElement("input", {
|
|
5025
|
+
}, "" + state.valueA + props.unit), React__default.createElement("input", {
|
|
5013
5026
|
type: "range",
|
|
5014
5027
|
name: props.name + '_B',
|
|
5015
5028
|
id: props.id + '_B',
|
|
5016
|
-
min: (_state$validation$
|
|
5017
|
-
max: (_state$validation$
|
|
5029
|
+
min: (_state$validation$min4 = (_state$validation10 = state.validation) === null || _state$validation10 === void 0 ? void 0 : _state$validation10.min) != null ? _state$validation$min4 : 0,
|
|
5030
|
+
max: (_state$validation$max4 = (_state$validation11 = state.validation) === null || _state$validation11 === void 0 ? void 0 : _state$validation11.max) != null ? _state$validation$max4 : 100,
|
|
5018
5031
|
value: state.valueB,
|
|
5019
5032
|
step: props.step,
|
|
5020
|
-
required: (_state$
|
|
5033
|
+
required: (_state$validation12 = state.validation) === null || _state$validation12 === void 0 ? void 0 : _state$validation12.required,
|
|
5021
5034
|
disabled: props.disabled,
|
|
5022
5035
|
onBlur: function onBlur() {
|
|
5023
5036
|
return !state.touched && dispatch({
|
|
@@ -5030,7 +5043,7 @@ function MultiRangeInput(props) {
|
|
|
5030
5043
|
}
|
|
5031
5044
|
}), React__default.createElement("output", {
|
|
5032
5045
|
id: props.id + '_out_B'
|
|
5033
|
-
}, state.valueB), React__default.createElement("div", {
|
|
5046
|
+
}, "" + state.valueB + props.unit), React__default.createElement("div", {
|
|
5034
5047
|
className: "range-slider__progress"
|
|
5035
5048
|
})))));
|
|
5036
5049
|
}
|
|
@@ -5173,7 +5186,7 @@ function reducer$6(state, action) {
|
|
|
5173
5186
|
}
|
|
5174
5187
|
}
|
|
5175
5188
|
function RangeInput(props) {
|
|
5176
|
-
var _props$label, _props$value, _props$label2, _props$id, _props$direction, _props$id2, _state$validation$
|
|
5189
|
+
var _props$label, _props$value, _props$label2, _props$id, _props$direction, _props$id2, _state$validation$min3, _state$validation5, _state$validation$max3, _state$validation6, _state$validation7;
|
|
5177
5190
|
var _React$useReducer = React__default.useReducer(reducer$6, {
|
|
5178
5191
|
description: (_props$label = props.label) != null ? _props$label : props.name,
|
|
5179
5192
|
value: (_props$value = props.value) != null ? _props$value : 0,
|
|
@@ -5185,16 +5198,18 @@ function RangeInput(props) {
|
|
|
5185
5198
|
state = _React$useReducer[0],
|
|
5186
5199
|
dispatch = _React$useReducer[1];
|
|
5187
5200
|
var sliderStyle = React__default.useMemo(function () {
|
|
5188
|
-
var _state$validation$min, _state$validation, _state$validation$max, _state$
|
|
5201
|
+
var _state$validation$min, _state$validation, _state$validation$min2, _state$validation2, _state$validation$max, _state$validation3, _state$validation$max2, _state$validation4, _props$unit;
|
|
5189
5202
|
return {
|
|
5190
5203
|
width: '100%',
|
|
5191
5204
|
marginTop: '1em',
|
|
5192
5205
|
'--min': (_state$validation$min = (_state$validation = state.validation) === null || _state$validation === void 0 ? void 0 : _state$validation.min) != null ? _state$validation$min : 0,
|
|
5193
|
-
'--
|
|
5206
|
+
'--min-text': "\"" + ((_state$validation$min2 = (_state$validation2 = state.validation) === null || _state$validation2 === void 0 ? void 0 : _state$validation2.min) != null ? _state$validation$min2 : 0) + props.unit + "\"",
|
|
5207
|
+
'--max': (_state$validation$max = (_state$validation3 = state.validation) === null || _state$validation3 === void 0 ? void 0 : _state$validation3.max) != null ? _state$validation$max : 100,
|
|
5208
|
+
'--max-text': "\"" + ((_state$validation$max2 = (_state$validation4 = state.validation) === null || _state$validation4 === void 0 ? void 0 : _state$validation4.max) != null ? _state$validation$max2 : 100) + props.unit + "\"",
|
|
5194
5209
|
'--value': state.value || 0,
|
|
5195
|
-
'--text-value': "" + state.value
|
|
5210
|
+
'--text-value': "" + state.value + ((_props$unit = props.unit) != null ? _props$unit : '')
|
|
5196
5211
|
};
|
|
5197
|
-
}, [state.value, state.validation]);
|
|
5212
|
+
}, [state.value, state.validation, props.unit]);
|
|
5198
5213
|
var handleChange = function handleChange(val) {
|
|
5199
5214
|
if (!props.disabled) {
|
|
5200
5215
|
var v = parseFloat(val);
|
|
@@ -5243,12 +5258,12 @@ function RangeInput(props) {
|
|
|
5243
5258
|
type: "range",
|
|
5244
5259
|
name: props.name,
|
|
5245
5260
|
id: (_props$id2 = props.id) != null ? _props$id2 : props.name,
|
|
5246
|
-
min: (_state$validation$
|
|
5247
|
-
max: (_state$validation$
|
|
5261
|
+
min: (_state$validation$min3 = (_state$validation5 = state.validation) === null || _state$validation5 === void 0 ? void 0 : _state$validation5.min) != null ? _state$validation$min3 : 0,
|
|
5262
|
+
max: (_state$validation$max3 = (_state$validation6 = state.validation) === null || _state$validation6 === void 0 ? void 0 : _state$validation6.max) != null ? _state$validation$max3 : 100,
|
|
5248
5263
|
value: state.value,
|
|
5249
5264
|
step: props.step,
|
|
5250
5265
|
disabled: props.disabled,
|
|
5251
|
-
required: (_state$
|
|
5266
|
+
required: (_state$validation7 = state.validation) === null || _state$validation7 === void 0 ? void 0 : _state$validation7.required,
|
|
5252
5267
|
onBlur: function onBlur() {
|
|
5253
5268
|
return !state.touched && dispatch({
|
|
5254
5269
|
type: 'TOUCH',
|
|
@@ -5259,7 +5274,7 @@ function RangeInput(props) {
|
|
|
5259
5274
|
return handleChange(e.target.value);
|
|
5260
5275
|
},
|
|
5261
5276
|
onKeyDown: props.onKeyDown
|
|
5262
|
-
}), React__default.createElement("output", null, state.value), React__default.createElement("div", {
|
|
5277
|
+
}), React__default.createElement("output", null, state.value, props.unit), React__default.createElement("div", {
|
|
5263
5278
|
className: "range-slider__progress"
|
|
5264
5279
|
})))));
|
|
5265
5280
|
}
|