@progress/kendo-vue-inputs 4.3.4-dev.202405030811 → 4.4.0-dev.202405091413

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.
Files changed (53) hide show
  1. package/dist/cdn/js/kendo-vue-inputs.js +1 -1
  2. package/dist/es/main.d.ts +1 -0
  3. package/dist/es/main.js +1 -0
  4. package/dist/es/package-metadata.js +1 -1
  5. package/dist/es/rating/Rating.d.ts +61 -0
  6. package/dist/es/rating/Rating.js +400 -0
  7. package/dist/es/rating/RatingItem.d.ts +46 -0
  8. package/dist/es/rating/RatingItem.js +272 -0
  9. package/dist/es/rating/interfaces/RatingEvents.d.ts +47 -0
  10. package/dist/es/rating/interfaces/RatingEvents.js +1 -0
  11. package/dist/es/rating/interfaces/RatingItemProps.d.ts +92 -0
  12. package/dist/es/rating/interfaces/RatingItemProps.js +1 -0
  13. package/dist/es/rating/interfaces/RatingProps.d.ts +116 -0
  14. package/dist/es/rating/interfaces/RatingProps.js +1 -0
  15. package/dist/es/rating/utils/index.d.ts +24 -0
  16. package/dist/es/rating/utils/index.js +60 -0
  17. package/dist/es/rating/utils/rating-reducer.d.ts +32 -0
  18. package/dist/es/rating/utils/rating-reducer.js +63 -0
  19. package/dist/esm/main.d.ts +1 -0
  20. package/dist/esm/main.js +1 -0
  21. package/dist/esm/package-metadata.js +1 -1
  22. package/dist/esm/rating/Rating.d.ts +61 -0
  23. package/dist/esm/rating/Rating.js +400 -0
  24. package/dist/esm/rating/RatingItem.d.ts +46 -0
  25. package/dist/esm/rating/RatingItem.js +272 -0
  26. package/dist/esm/rating/interfaces/RatingEvents.d.ts +47 -0
  27. package/dist/esm/rating/interfaces/RatingEvents.js +1 -0
  28. package/dist/esm/rating/interfaces/RatingItemProps.d.ts +92 -0
  29. package/dist/esm/rating/interfaces/RatingItemProps.js +1 -0
  30. package/dist/esm/rating/interfaces/RatingProps.d.ts +116 -0
  31. package/dist/esm/rating/interfaces/RatingProps.js +1 -0
  32. package/dist/esm/rating/utils/index.d.ts +24 -0
  33. package/dist/esm/rating/utils/index.js +60 -0
  34. package/dist/esm/rating/utils/rating-reducer.d.ts +32 -0
  35. package/dist/esm/rating/utils/rating-reducer.js +63 -0
  36. package/dist/npm/main.d.ts +1 -0
  37. package/dist/npm/main.js +1 -0
  38. package/dist/npm/package-metadata.js +1 -1
  39. package/dist/npm/rating/Rating.d.ts +61 -0
  40. package/dist/npm/rating/Rating.js +407 -0
  41. package/dist/npm/rating/RatingItem.d.ts +46 -0
  42. package/dist/npm/rating/RatingItem.js +279 -0
  43. package/dist/npm/rating/interfaces/RatingEvents.d.ts +47 -0
  44. package/dist/npm/rating/interfaces/RatingEvents.js +2 -0
  45. package/dist/npm/rating/interfaces/RatingItemProps.d.ts +92 -0
  46. package/dist/npm/rating/interfaces/RatingItemProps.js +2 -0
  47. package/dist/npm/rating/interfaces/RatingProps.d.ts +116 -0
  48. package/dist/npm/rating/interfaces/RatingProps.js +2 -0
  49. package/dist/npm/rating/utils/index.d.ts +24 -0
  50. package/dist/npm/rating/utils/index.js +72 -0
  51. package/dist/npm/rating/utils/rating-reducer.d.ts +32 -0
  52. package/dist/npm/rating/utils/rating-reducer.js +67 -0
  53. package/package.json +13 -13
@@ -0,0 +1,272 @@
1
+ // @ts-ignore
2
+ import * as Vue from 'vue';
3
+ var allVue = Vue;
4
+ var gh = allVue.h;
5
+ var isV3 = allVue.version && allVue.version[0] === '3';
6
+ var ref = allVue.ref;
7
+ import { Icon, classNames, getIconName, getTemplate } from '@progress/kendo-vue-common';
8
+ import { starIcon, starOutlineIcon } from '@progress/kendo-svg-icons';
9
+ /**
10
+ * @hidden
11
+ */
12
+ var RatingItemVue2 = {
13
+ name: 'KendoReactRatingItem',
14
+ // @ts-ignore
15
+ emits: {
16
+ 'click': null,
17
+ 'keydown': null,
18
+ 'focus': null,
19
+ 'blur': null,
20
+ 'mouseenter': null,
21
+ 'mouseleave': null,
22
+ 'mousemove': null
23
+ },
24
+ props: {
25
+ id: String,
26
+ tabIndex: Number,
27
+ half: Boolean,
28
+ title: String,
29
+ icon: Object,
30
+ selected: Boolean,
31
+ hovered: Boolean,
32
+ onClick: Function,
33
+ onKeyDown: Function,
34
+ onFocus: Function,
35
+ onBlur: Function,
36
+ onMouseEnter: Function,
37
+ svgIconOutline: Object,
38
+ svgIcon: Object,
39
+ haveSelectedValue: Boolean,
40
+ item: String,
41
+ itemTemplate: Object,
42
+ dir: {
43
+ type: String,
44
+ default: 'ltr',
45
+ validator: function validator(value) {
46
+ return [null, 'ltr', 'rtl'].includes(value);
47
+ }
48
+ },
49
+ value: {
50
+ type: Number,
51
+ required: true
52
+ }
53
+ },
54
+ // @ts-ignore
55
+ setup: !isV3 ? undefined : function () {
56
+ var v3 = !!isV3;
57
+ var inputRef = ref(null);
58
+ return {
59
+ v3: v3,
60
+ inputRef: inputRef
61
+ };
62
+ },
63
+ computed: {
64
+ wrapperClass: function wrapperClass() {
65
+ return classNames("k-rating-item".concat(this.$props.dir === 'rtl' ? ' k-rtl' : '').concat(this.$props.haveSelectedValue || this.$props.selected ? ' k-selected' : '').concat(this.$props.hovered ? ' k-hover' : ''));
66
+ }
67
+ },
68
+ // @ts-ignore
69
+ render: function render(createElement) {
70
+ var h = gh || createElement;
71
+ var _a = this.$props,
72
+ id = _a.id,
73
+ dir = _a.dir,
74
+ half = _a.half,
75
+ tabIndex = _a.tabIndex,
76
+ title = _a.title,
77
+ icon = _a.icon,
78
+ svgIcon = _a.svgIcon,
79
+ svgIconOutline = _a.svgIconOutline,
80
+ hovered = _a.hovered,
81
+ selected = _a.selected,
82
+ haveSelectedValue = _a.haveSelectedValue,
83
+ item = _a.item,
84
+ itemTemplate = _a.itemTemplate;
85
+ var itemRender = getTemplate.call(this, {
86
+ h: h,
87
+ template: itemTemplate,
88
+ additionalProps: {
89
+ dir: dir,
90
+ half: half,
91
+ title: title,
92
+ icon: icon,
93
+ svgIcon: svgIcon,
94
+ svgIconOutline: svgIconOutline,
95
+ hovered: hovered,
96
+ selected: selected,
97
+ haveSelectedValue: haveSelectedValue
98
+ },
99
+ additionalListeners: {
100
+ onclick: this.handleClick,
101
+ onkeydown: this.handleKeyDown,
102
+ onfocus: this.handleFocus,
103
+ onblur: this.handleBlur,
104
+ onmouseenter: this.handleMouseEnter,
105
+ onmouseleave: this.handleMouseLeave,
106
+ onmousemove: this.handleMouseMove
107
+ }
108
+ });
109
+ return h("span", {
110
+ id: id,
111
+ attrs: this.v3 ? undefined : {
112
+ id: id,
113
+ dir: dir,
114
+ "data-half": half,
115
+ tabIndex: tabIndex,
116
+ title: title
117
+ },
118
+ dir: dir,
119
+ "data-half": half,
120
+ tabIndex: tabIndex,
121
+ title: title,
122
+ "class": this.wrapperClass,
123
+ onClick: this.handleClick,
124
+ on: this.v3 ? undefined : {
125
+ "click": this.handleClick,
126
+ "keyDown": this.handleKeyDown,
127
+ "focus": this.handleFocus,
128
+ "blur": this.handleBlur,
129
+ "mouseenter": this.handleMouseEnter,
130
+ "mouseleave": this.handleMouseLeave,
131
+ "mousemove": this.handleMouseMove
132
+ },
133
+ onKeyDown: this.handleKeyDown,
134
+ onFocus: this.handleFocus,
135
+ onBlur: this.handleBlur,
136
+ onMouseenter: this.handleMouseEnter,
137
+ onMouseleave: this.handleMouseLeave,
138
+ onMousemove: this.handleMouseMove
139
+ }, [item ? itemRender : [half && h("span", {
140
+ "class": 'k-rating-precision-complement'
141
+ }, [!(icon || svgIconOutline) && h(Icon, {
142
+ name: "star-outline",
143
+ attrs: this.v3 ? undefined : {
144
+ name: "star-outline",
145
+ icon: starOutlineIcon,
146
+ size: 'xlarge'
147
+ },
148
+ icon: starOutlineIcon,
149
+ style: dir === 'rtl' ? {
150
+ clipPath: 'inset(0 50% 0 0)'
151
+ } : {
152
+ clipPath: 'inset(0 0 0 50%)'
153
+ },
154
+ size: 'xlarge'
155
+ }), (icon || svgIconOutline) && h(Icon, {
156
+ name: getIconName("".concat(icon, "-outline")),
157
+ attrs: this.v3 ? undefined : {
158
+ name: getIconName("".concat(icon, "-outline")),
159
+ icon: svgIconOutline,
160
+ size: 'xlarge'
161
+ },
162
+ icon: svgIconOutline,
163
+ size: 'xlarge'
164
+ })]), half && h("span", {
165
+ "class": 'k-rating-precision-part'
166
+ }, [!(icon || svgIcon) && h(Icon, {
167
+ name: "star",
168
+ attrs: this.v3 ? undefined : {
169
+ name: "star",
170
+ icon: starIcon,
171
+ size: 'xlarge'
172
+ },
173
+ icon: starIcon,
174
+ style: dir === 'rtl' ? {
175
+ clipPath: 'inset(0 0 0 50%)'
176
+ } : {
177
+ clipPath: 'inset(0 50% 0 0)'
178
+ },
179
+ size: 'xlarge'
180
+ }), (icon || svgIcon) && h(Icon, {
181
+ name: icon ? getIconName(icon) : undefined,
182
+ attrs: this.v3 ? undefined : {
183
+ name: icon ? getIconName(icon) : undefined,
184
+ icon: svgIcon,
185
+ size: 'xlarge'
186
+ },
187
+ icon: svgIcon,
188
+ size: 'xlarge'
189
+ })]), half && h("span", {
190
+ style: {
191
+ width: '24px',
192
+ height: '24px',
193
+ display: 'block'
194
+ }
195
+ }), !half && (!(icon || svgIcon) && (hovered || selected && !hovered) && h(Icon, {
196
+ name: "star",
197
+ attrs: this.v3 ? undefined : {
198
+ name: "star",
199
+ icon: starIcon,
200
+ size: 'xlarge'
201
+ },
202
+ icon: starIcon,
203
+ size: 'xlarge'
204
+ }) || !(icon || svgIcon) && !hovered && !selected && h(Icon, {
205
+ name: "star-outline",
206
+ attrs: this.v3 ? undefined : {
207
+ name: "star-outline",
208
+ icon: starOutlineIcon,
209
+ size: 'xlarge'
210
+ },
211
+ icon: starOutlineIcon,
212
+ size: 'xlarge'
213
+ }) || (icon || svgIcon) && (hovered || selected && !hovered) && h(Icon, {
214
+ name: icon,
215
+ attrs: this.v3 ? undefined : {
216
+ name: icon,
217
+ icon: svgIcon,
218
+ size: 'xlarge'
219
+ },
220
+ icon: svgIcon,
221
+ size: 'xlarge'
222
+ }) || (icon || svgIcon) && !hovered && h(Icon, {
223
+ name: getIconName("".concat(icon, "-outline")),
224
+ attrs: this.v3 ? undefined : {
225
+ name: getIconName("".concat(icon, "-outline")),
226
+ icon: svgIconOutline,
227
+ size: 'xlarge'
228
+ },
229
+ icon: svgIconOutline,
230
+ size: 'xlarge'
231
+ }))]]);
232
+ },
233
+ methods: {
234
+ handleClick: function handleClick(event) {
235
+ this.$emit('click', {
236
+ value: this.$props.value,
237
+ target: this.$el,
238
+ event: event
239
+ });
240
+ },
241
+ handleMouseLeave: function handleMouseLeave(event) {
242
+ this.$emit('mouseleave', {
243
+ target: this.$el,
244
+ event: event
245
+ });
246
+ },
247
+ handleMouseMove: function handleMouseMove(event) {
248
+ this.$emit('mousemove', {
249
+ value: this.$props.value,
250
+ target: this.$el,
251
+ event: event
252
+ });
253
+ },
254
+ handleMouseEnter: function handleMouseEnter(event) {
255
+ this.$emit('mouseenter', {
256
+ target: this.$el,
257
+ event: event
258
+ });
259
+ },
260
+ handleKeyDown: function handleKeyDown(event) {
261
+ this.$emit('keydown', event);
262
+ },
263
+ handleFocus: function handleFocus(event) {
264
+ this.$emit('focus', event);
265
+ },
266
+ handleBlur: function handleBlur(event) {
267
+ this.$emit('blur', event);
268
+ }
269
+ }
270
+ };
271
+ var RatingItem = RatingItemVue2;
272
+ export { RatingItem, RatingItemVue2 };
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Represents the return type of the RatingItemMouseEvent.
3
+ */
4
+ export interface RatingItemMouseEvent {
5
+ /**
6
+ * The event of the RatingItemMouseEvent.
7
+ */
8
+ event: MouseEvent;
9
+ /**
10
+ * The target of the RatingItemMouseEvent.
11
+ */
12
+ target: Element;
13
+ /**
14
+ * @hidden
15
+ */
16
+ value?: number | null;
17
+ }
18
+ /**
19
+ * Represents the return type of the RatingKeyboardEvent.
20
+ */
21
+ export interface RatingKeyboardEvent {
22
+ /**
23
+ * The current Rating value.
24
+ */
25
+ value: number;
26
+ /**
27
+ * The event of the RatingKeyboardEvent.
28
+ */
29
+ event: KeyboardEvent;
30
+ }
31
+ /**
32
+ * Represents the return type of RatingChangeEvent.
33
+ */
34
+ export interface RatingChangeEvent {
35
+ /**
36
+ * The event of the RatingChangeEvent.
37
+ */
38
+ event: PointerEvent;
39
+ /**
40
+ * The target of the RatingChangeEvent.
41
+ */
42
+ target: HTMLSpanElement;
43
+ /**
44
+ * The current Rating value.
45
+ */
46
+ value: number;
47
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,92 @@
1
+ import { SVGIcon } from '@progress/kendo-vue-common';
2
+ import { RatingItemMouseEvent } from './RatingEvents';
3
+ /**
4
+ * Represents the properties of [RatingItem](% slug api_inputs_ratingitem %) component.
5
+ */
6
+ export interface RatingItemProps {
7
+ /**
8
+ * Sets the `id` property of the top div element of the RatingItem.
9
+ */
10
+ id?: string;
11
+ /**
12
+ * Sets the `tabIndex` attribute.
13
+ */
14
+ tabIndex?: number;
15
+ /**
16
+ * Determines if icon is partly selected.
17
+ */
18
+ half?: boolean;
19
+ /**
20
+ * Determines the RatingItem direction `ltr` - by default, or `rtl`.
21
+ */
22
+ dir?: string;
23
+ /**
24
+ * Sets the current value of the RatingItem, used in controlled mode.
25
+ */
26
+ value: number;
27
+ /**
28
+ * Sets the title of current RatingItem component. [See example]({% slug controlled_rating %})
29
+ */
30
+ title?: string;
31
+ /**
32
+ * Sets the icon of current RatingItem component. [See example]({% slug label_rating %})
33
+ */
34
+ icon?: any;
35
+ /**
36
+ * Sets custom Rating SVG icon.
37
+ */
38
+ svgIcon?: SVGIcon;
39
+ /**
40
+ * Sets custom Rating SVG icon.
41
+ */
42
+ svgIconOutline?: SVGIcon;
43
+ /**
44
+ * Determines if current RatingItem is selected. [See example]({% slug item_customization_ratingitem %})
45
+ */
46
+ selected?: boolean;
47
+ /**
48
+ * Determines if some of the RatingItems are selected.
49
+ * [See example]({% slug item_customization_ratingitem %})
50
+ */
51
+ haveSelectedValue?: boolean;
52
+ /**
53
+ * Determines if current RatingItem is hovered.
54
+ */
55
+ hovered?: boolean;
56
+ /**
57
+ * @hidden
58
+ */
59
+ item?: any;
60
+ /**
61
+ * @hidden
62
+ */
63
+ itemTemplate?: any;
64
+ /**
65
+ * Triggered after `onClick` event. Gets outside access to the target element, the new value and the event type.
66
+ */
67
+ onClick?: (event: RatingItemMouseEvent) => void;
68
+ /**
69
+ * Triggered after `onKeyDown` event. Gets outside access to the target element, the new value and the event type.
70
+ */
71
+ onKeyDown?: (event: KeyboardEvent) => void;
72
+ /**
73
+ * Triggered after `onFocus` event. Gets outside access to the target element and the event type.
74
+ */
75
+ onFocus?: (event: FocusEvent) => void;
76
+ /**
77
+ * Triggered after `onBlur` event. Gets outside access to the target element and the event type.
78
+ */
79
+ onBlur?: (event: FocusEvent) => void;
80
+ /**
81
+ * Triggered after `onMouseEnter` event. Gets outside access to the target element and the event type.
82
+ */
83
+ onMouseEnter?: (event: RatingItemMouseEvent) => void;
84
+ /**
85
+ * Triggered after `onMouseLeave` event. Gets outside access to the target element and the event type.
86
+ */
87
+ onMouseLeave?: (event: RatingItemMouseEvent) => void;
88
+ /**
89
+ * Triggered after `onMouseMove` event. Gets outside access to the target element and the event type.
90
+ */
91
+ onMouseMove?: (event: RatingItemMouseEvent) => void;
92
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,116 @@
1
+ import { FormComponentProps, SVGIcon } from '@progress/kendo-vue-common';
2
+ import { RatingKeyboardEvent, RatingItemMouseEvent, RatingChangeEvent } from './RatingEvents';
3
+ /**
4
+ * Represents the properties of [Rating](% slug api_inputs_rating %) component.
5
+ */
6
+ export interface RatingProps extends FormComponentProps {
7
+ /**
8
+ * Sets the `id` property of the top div element of the Rating.
9
+ */
10
+ id?: string;
11
+ /**
12
+ * Sets additional classes to the Rating.
13
+ */
14
+ className?: string;
15
+ /**
16
+ * Sets the `tabIndex` attribute.
17
+ */
18
+ tabIndex?: number;
19
+ /**
20
+ * Sets additional CSS styles to the Rating.
21
+ */
22
+ style?: any;
23
+ /**
24
+ * Represents the rendered Rating item.
25
+ */
26
+ item?: any;
27
+ /**
28
+ * Sets the current value of the Rating, used in controlled mode. [See example]({% slug item_customization_ratingitem %})
29
+ */
30
+ value?: number;
31
+ /**
32
+ * Sets the default value of the Rating, used in uncontrolled mode. [See example]({% slug controlled_rating %})
33
+ */
34
+ defaultValue?: number;
35
+ /**
36
+ * Sets the min possible icon value or star value in the main use-case.
37
+ */
38
+ min?: number;
39
+ /**
40
+ * Sets the max possible icon value or star value in the main use-case.
41
+ */
42
+ max?: number;
43
+ /**
44
+ * Sets the step value between the min and max value.
45
+ */
46
+ step?: number;
47
+ /**
48
+ * Determines the Rating direction `ltr` - by default, or `rtl`.
49
+ */
50
+ dir?: string;
51
+ /**
52
+ * Determines if the Rating has a label and is it a custom one.
53
+ */
54
+ label?: string;
55
+ /**
56
+ * Sets the `readonly` mode of the Rating, if it is set to `true`. [See example]({% slug label_rating %})
57
+ */
58
+ readonly?: boolean;
59
+ /**
60
+ * Sets the `disabled` mode of the Rating, if it is set to `true`. [See example]({% slug readonly_rating %})
61
+ */
62
+ disabled?: boolean;
63
+ /**
64
+ * Sets custom Rating icon, by default - star. [See example]({% slug disabled_rating %})
65
+ */
66
+ icon?: string;
67
+ /**
68
+ * Sets custom Rating SVG icon.
69
+ */
70
+ svgIcon?: SVGIcon;
71
+ /**
72
+ * Sets custom Rating SVG icon.
73
+ */
74
+ svgIconOutline?: SVGIcon;
75
+ /**
76
+ * Determines the selection mode. By default set to `continues`. [See example]({% slug icon_rating %})
77
+ */
78
+ selection?: 'continues' | 'single';
79
+ /**
80
+ * Determines the precision of the Rating. By default set to `item`. [See example]({% slug selection_rating %})
81
+ */
82
+ precision?: 'half' | 'item';
83
+ /**
84
+ * Determines if value represents half icon -> true, or not -> false. [See example]({% slug precision_rating %})
85
+ */
86
+ half?: boolean;
87
+ /**
88
+ * Identifies the element(s) which will describe the component, similar to [HTML aria-describedby attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-describedby_attribute).
89
+ * For example these elements could contain error or hint message.
90
+ */
91
+ ariaDescribedBy?: string;
92
+ /**
93
+ * Identifies the element(s) which will label the component.
94
+ */
95
+ ariaLabelledBy?: string;
96
+ /**
97
+ * Triggered after value change. Gets outside access to the target element, the new value and the event type.
98
+ */
99
+ onChange?: (event: RatingChangeEvent) => void;
100
+ /**
101
+ * Triggered after `onClick` event. Gets outside access to the target element, the new value and the event type.
102
+ */
103
+ onClick?: (event: RatingItemMouseEvent) => void;
104
+ /**
105
+ * Triggered after `onKeyDown` event. Gets outside access to the target element, the new value and the event type.
106
+ */
107
+ onKeyDown?: (event: RatingKeyboardEvent) => void;
108
+ /**
109
+ * Triggered after `onFocus` event. Gets outside access to the target element and the event type.
110
+ */
111
+ onFocus?: (event: FocusEvent) => void;
112
+ /**
113
+ * Triggered after `onBlur` event. Gets outside access to the target element and the event type.
114
+ */
115
+ onBlur?: (event: FocusEvent) => void;
116
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @hidden
3
+ */
4
+ export declare const toRound: (num: number, base: number) => number;
5
+ /**
6
+ * @hidden
7
+ */
8
+ export declare const getRemainder: (x: number, y: number) => number;
9
+ /**
10
+ * @hidden
11
+ */
12
+ export declare const isHalf: (index: number, value: number, step: number) => boolean;
13
+ /**
14
+ * @hidden
15
+ */
16
+ export declare const isSelected: (index: number, value: number | null, step: number, selection: 'single' | 'continues') => boolean;
17
+ /**
18
+ * @hidden
19
+ */
20
+ export declare const calcIsFirstHalf: (dir: string, rect: any, clientX: number) => boolean;
21
+ /**
22
+ * @hidden
23
+ */
24
+ export declare const isCorrectValue: (min: number, max: number, step: number, value: number) => boolean;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @hidden
3
+ */
4
+ export var toRound = function toRound(num, base) {
5
+ if (num % 1) {
6
+ var percent = Math.pow(10, (base.toString().split('.')[1] || base.toString().split('.')[0]).length);
7
+ return Math.round(num * percent) / percent;
8
+ }
9
+ return num;
10
+ };
11
+ // Opting out of JS `modulo` calculation due to floating-point problems in JS
12
+ // We're looking for the reminder - R.
13
+ // x / y = a + R
14
+ // R = (x / y) - a | *y
15
+ // R = x - (y * a)
16
+ // : a = Math.floor(x /y );
17
+ /**
18
+ * @hidden
19
+ */
20
+ export var getRemainder = function getRemainder(x, y) {
21
+ return x - y * Math.floor(x / y);
22
+ };
23
+ /**
24
+ * @hidden
25
+ */
26
+ export var isHalf = function isHalf(index, value, step) {
27
+ return toRound(index - step, step) < value && value < index;
28
+ };
29
+ /**
30
+ * @hidden
31
+ */
32
+ export var isSelected = function isSelected(index, value, step, selection) {
33
+ if (value === null) {
34
+ return false;
35
+ }
36
+ if (selection === 'continues') {
37
+ return isHalf(index, value, step) ? toRound(index - step / 2, step / 2) <= value : index <= value;
38
+ }
39
+ if (selection === 'single') {
40
+ return isHalf(index, value, step) ? toRound(index - step / 2, step / 2) === value : index === value;
41
+ }
42
+ return false;
43
+ };
44
+ /**
45
+ * @hidden
46
+ */
47
+ export var calcIsFirstHalf = function calcIsFirstHalf(dir, rect, clientX) {
48
+ return dir === 'ltr' ? clientX < rect.x + rect.width / 2 : clientX > rect.x + rect.width / 2;
49
+ };
50
+ /**
51
+ * @hidden
52
+ */
53
+ export var isCorrectValue = function isCorrectValue(min, max, step, value) {
54
+ for (var i = min; i <= max; i += step) {
55
+ if (value === i) {
56
+ return true;
57
+ }
58
+ }
59
+ return false;
60
+ };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @hidden
3
+ */
4
+ export declare enum RATING_ACTION {
5
+ select = "select",
6
+ deselect = "deselect",
7
+ increase = "increase",
8
+ decrease = "decrease",
9
+ min = "min",
10
+ max = "max",
11
+ reset = "reset"
12
+ }
13
+ /**
14
+ * @hidden
15
+ */
16
+ export declare type RatingActionDispatch = {
17
+ type: RATING_ACTION;
18
+ payload?: number;
19
+ event?: any;
20
+ };
21
+ /**
22
+ * @hidden
23
+ */
24
+ export declare type RatingAction = {
25
+ min: number;
26
+ max: number;
27
+ step?: number;
28
+ };
29
+ /**
30
+ * @hidden
31
+ */
32
+ export declare const ratingReducer: (state: any, action: RatingAction & RatingActionDispatch) => any;