@onereach/ui-components 8.12.0 → 8.12.1-beta.3771.0
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/bundled/v2/components/OrRatingV3/OrRating.js +2 -0
- package/dist/bundled/v2/components/OrRatingV3/OrRating.vue.d.ts +56 -0
- package/dist/bundled/v2/components/OrRatingV3/index.d.ts +1 -0
- package/dist/bundled/v2/components/OrRatingV3/index.js +1 -0
- package/dist/bundled/v2/components/OrRatingV3/styles.d.ts +2 -0
- package/dist/bundled/v2/components/OrRatingV3/styles.js +1 -0
- package/dist/bundled/v2/components/OrRatingV3-0860f5b3.js +154 -0
- package/dist/bundled/v2/components/index.d.ts +1 -0
- package/dist/bundled/v2/components/index.js +1 -0
- package/dist/bundled/v2/index.js +2 -1
- package/dist/bundled/v3/components/OrRatingV3/OrRating.js +1 -0
- package/dist/bundled/v3/components/OrRatingV3/OrRating.vue.d.ts +37 -0
- package/dist/bundled/v3/components/OrRatingV3/index.d.ts +1 -0
- package/dist/bundled/v3/components/OrRatingV3/index.js +1 -0
- package/dist/bundled/v3/components/OrRatingV3/styles.d.ts +2 -0
- package/dist/bundled/v3/components/OrRatingV3/styles.js +1 -0
- package/dist/bundled/v3/components/OrRatingV3-d1230c2b.js +117 -0
- package/dist/bundled/v3/components/index.d.ts +1 -0
- package/dist/bundled/v3/components/index.js +1 -0
- package/dist/bundled/v3/index.js +2 -1
- package/dist/esm/v2/OrRating-1cda1619.js +158 -0
- package/dist/esm/v2/components/index.d.ts +1 -0
- package/dist/esm/v2/components/index.js +1 -0
- package/dist/esm/v2/components/or-rating-v3/OrRating.vue.d.ts +56 -0
- package/dist/esm/v2/components/or-rating-v3/index.d.ts +1 -0
- package/dist/esm/v2/components/or-rating-v3/index.js +11 -0
- package/dist/esm/v2/components/or-rating-v3/styles.d.ts +2 -0
- package/dist/esm/v2/index.js +1 -0
- package/dist/esm/v3/OrRating-51a033dc.js +121 -0
- package/dist/esm/v3/components/index.d.ts +1 -0
- package/dist/esm/v3/components/index.js +1 -0
- package/dist/esm/v3/components/or-rating-v3/OrRating.vue.d.ts +37 -0
- package/dist/esm/v3/components/or-rating-v3/index.d.ts +1 -0
- package/dist/esm/v3/components/or-rating-v3/index.js +11 -0
- package/dist/esm/v3/components/or-rating-v3/styles.d.ts +2 -0
- package/dist/esm/v3/index.js +1 -0
- package/package.json +3 -4
- package/src/components/index.ts +1 -0
- package/src/components/or-rating-v3/OrRating.vue +129 -0
- package/src/components/or-rating-v3/index.ts +1 -0
- package/src/components/or-rating-v3/styles.ts +24 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare const RATING_LENGTH: unique symbol;
|
|
2
|
+
declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
3
|
+
length: number;
|
|
4
|
+
root: import("@vue/composition-api").Ref<HTMLElement | undefined>;
|
|
5
|
+
rootStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
6
|
+
starStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
7
|
+
proxyModelValue: import("../../hooks").UseProxyModelValueReturn<number>;
|
|
8
|
+
draftModelValue: import("@vue/composition-api").Ref<number>;
|
|
9
|
+
hoverIndex: boolean[];
|
|
10
|
+
onMouseEnter: (event: MouseEvent, index: number) => void;
|
|
11
|
+
onMouseMove: (event: MouseEvent, index: number) => void;
|
|
12
|
+
onMouseLeave: (event: MouseEvent, index: number) => void;
|
|
13
|
+
}> & import("@vue/composition-api").Data, {}, {}, {
|
|
14
|
+
modelValue: {
|
|
15
|
+
type: NumberConstructor;
|
|
16
|
+
default: number;
|
|
17
|
+
};
|
|
18
|
+
disabled: {
|
|
19
|
+
type: BooleanConstructor;
|
|
20
|
+
default: boolean;
|
|
21
|
+
};
|
|
22
|
+
}, import("@vue/composition-api").ExtractPropTypes<{
|
|
23
|
+
modelValue: {
|
|
24
|
+
type: NumberConstructor;
|
|
25
|
+
default: number;
|
|
26
|
+
};
|
|
27
|
+
disabled: {
|
|
28
|
+
type: BooleanConstructor;
|
|
29
|
+
default: boolean;
|
|
30
|
+
};
|
|
31
|
+
}>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
|
|
32
|
+
modelValue: number;
|
|
33
|
+
disabled: boolean;
|
|
34
|
+
} & {} & {
|
|
35
|
+
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
36
|
+
}, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
37
|
+
length: number;
|
|
38
|
+
root: import("@vue/composition-api").Ref<HTMLElement | undefined>;
|
|
39
|
+
rootStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
40
|
+
starStyles: import("@vue/composition-api").ComputedRef<string[]>;
|
|
41
|
+
proxyModelValue: import("../../hooks").UseProxyModelValueReturn<number>;
|
|
42
|
+
draftModelValue: import("@vue/composition-api").Ref<number>;
|
|
43
|
+
hoverIndex: boolean[];
|
|
44
|
+
onMouseEnter: (event: MouseEvent, index: number) => void;
|
|
45
|
+
onMouseMove: (event: MouseEvent, index: number) => void;
|
|
46
|
+
onMouseLeave: (event: MouseEvent, index: number) => void;
|
|
47
|
+
}>, import("@vue/composition-api").Data, {}, {}, {}, {}, string[], {
|
|
48
|
+
modelValue: number;
|
|
49
|
+
disabled: boolean;
|
|
50
|
+
} & {} & {
|
|
51
|
+
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
52
|
+
}, {
|
|
53
|
+
modelValue: number;
|
|
54
|
+
disabled: boolean;
|
|
55
|
+
}, true>);
|
|
56
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as OrRatingV3 } from './OrRating.vue';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { _ as OrRatingV3 } from '../OrRatingV3-0860f5b3.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { R as Rating, a as RatingStar } from '../OrRatingV3-0860f5b3.js';
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { defineComponent, inject, ref, computed, toRef, watch, reactive } from 'vue-demi';
|
|
2
|
+
import { _ as __vue_component__$1 } from './OrIconV3-5d1d188a.js';
|
|
3
|
+
import { u as useProxyModelValue } from './OrBottomSheetV3-c8001cd5.js';
|
|
4
|
+
import { n as normalizeComponent } from './OrAvatar-f32ddb1f.js';
|
|
5
|
+
|
|
6
|
+
const Rating = [
|
|
7
|
+
// Layout
|
|
8
|
+
'layout-row',
|
|
9
|
+
// Theme
|
|
10
|
+
'theme-foreground-disabled', 'dark:theme-foreground-disabled-dark'];
|
|
11
|
+
const RatingStar = [
|
|
12
|
+
// Layout
|
|
13
|
+
'layout-row justify-center',
|
|
14
|
+
// Interactivity
|
|
15
|
+
'interactivity-click',
|
|
16
|
+
// Box
|
|
17
|
+
'w-[28px] md:w-[24px]', 'h-[28px] md:h-[24px]',
|
|
18
|
+
// Theme (activated)
|
|
19
|
+
'activated:theme-foreground-warning-hover', 'dark:activated:theme-foreground-warning-hover-dark'];
|
|
20
|
+
|
|
21
|
+
const RATING_LENGTH = Symbol();
|
|
22
|
+
var script = defineComponent({
|
|
23
|
+
components: {
|
|
24
|
+
OrIcon: __vue_component__$1
|
|
25
|
+
},
|
|
26
|
+
model: {
|
|
27
|
+
prop: 'modelValue',
|
|
28
|
+
event: 'update:modelValue'
|
|
29
|
+
},
|
|
30
|
+
props: {
|
|
31
|
+
modelValue: {
|
|
32
|
+
type: Number,
|
|
33
|
+
default: 0
|
|
34
|
+
},
|
|
35
|
+
disabled: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
emits: ['update:modelValue'],
|
|
41
|
+
expose: ['root'],
|
|
42
|
+
setup(props, context) {
|
|
43
|
+
// Options
|
|
44
|
+
const length = inject(RATING_LENGTH, 5);
|
|
45
|
+
// Refs
|
|
46
|
+
const root = ref();
|
|
47
|
+
// Styles
|
|
48
|
+
const rootStyles = computed(() => ['or-rating-v3', ...Rating]);
|
|
49
|
+
const starStyles = computed(() => [...RatingStar]);
|
|
50
|
+
// State
|
|
51
|
+
const proxyModelValue = useProxyModelValue(toRef(props, 'modelValue'), context.emit);
|
|
52
|
+
const draftModelValue = ref(proxyModelValue.value);
|
|
53
|
+
watch(proxyModelValue, value => {
|
|
54
|
+
draftModelValue.value = value;
|
|
55
|
+
});
|
|
56
|
+
const hoverIndex = reactive(Array(length).fill(false));
|
|
57
|
+
// Handlers
|
|
58
|
+
function onMouseEnter(event, index) {
|
|
59
|
+
hoverIndex[index] = true;
|
|
60
|
+
}
|
|
61
|
+
function onMouseMove(event, index) {
|
|
62
|
+
const {
|
|
63
|
+
width
|
|
64
|
+
} = event.currentTarget.getBoundingClientRect();
|
|
65
|
+
draftModelValue.value = Math.ceil((index - (width - event.offsetX) / width + 1) * 2) / 2;
|
|
66
|
+
}
|
|
67
|
+
function onMouseLeave(event, index) {
|
|
68
|
+
hoverIndex[index] = false;
|
|
69
|
+
draftModelValue.value = proxyModelValue.value;
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
length,
|
|
73
|
+
root,
|
|
74
|
+
rootStyles,
|
|
75
|
+
starStyles,
|
|
76
|
+
proxyModelValue,
|
|
77
|
+
draftModelValue,
|
|
78
|
+
hoverIndex,
|
|
79
|
+
onMouseEnter,
|
|
80
|
+
onMouseMove,
|
|
81
|
+
onMouseLeave
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
/* script */
|
|
87
|
+
const __vue_script__ = script;
|
|
88
|
+
|
|
89
|
+
/* template */
|
|
90
|
+
var __vue_render__ = function () {
|
|
91
|
+
var _vm = this;
|
|
92
|
+
var _h = _vm.$createElement;
|
|
93
|
+
var _c = _vm._self._c || _h;
|
|
94
|
+
return _c('div', {
|
|
95
|
+
ref: "root",
|
|
96
|
+
class: _vm.rootStyles,
|
|
97
|
+
attrs: {
|
|
98
|
+
"disabled": _vm.disabled
|
|
99
|
+
}
|
|
100
|
+
}, _vm._l(_vm.length, function (value) {
|
|
101
|
+
return _c('div', {
|
|
102
|
+
key: value,
|
|
103
|
+
ref: "stars",
|
|
104
|
+
refInFor: true,
|
|
105
|
+
class: _vm.starStyles,
|
|
106
|
+
attrs: {
|
|
107
|
+
"activated": value <= Math.ceil(_vm.proxyModelValue),
|
|
108
|
+
"disabled": _vm.disabled
|
|
109
|
+
},
|
|
110
|
+
on: {
|
|
111
|
+
"mouseenter": function ($event) {
|
|
112
|
+
return _vm.onMouseEnter($event, value - 1);
|
|
113
|
+
},
|
|
114
|
+
"mousemove": function ($event) {
|
|
115
|
+
return _vm.onMouseMove($event, value - 1);
|
|
116
|
+
},
|
|
117
|
+
"mouseleave": function ($event) {
|
|
118
|
+
return _vm.onMouseLeave($event, value - 1);
|
|
119
|
+
},
|
|
120
|
+
"click": function ($event) {
|
|
121
|
+
_vm.proxyModelValue = _vm.draftModelValue;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}, [_c('OrIcon', {
|
|
125
|
+
attrs: {
|
|
126
|
+
"icon": _vm.draftModelValue - value + 1 === 0.5 ? 'star_half' : 'star',
|
|
127
|
+
"variant": value <= _vm.draftModelValue ? 'filled' : 'outlined',
|
|
128
|
+
"size": _vm.hoverIndex[value - 1] ? 'xl' : 'l'
|
|
129
|
+
}
|
|
130
|
+
})], 1);
|
|
131
|
+
}), 0);
|
|
132
|
+
};
|
|
133
|
+
var __vue_staticRenderFns__ = [];
|
|
134
|
+
|
|
135
|
+
/* style */
|
|
136
|
+
const __vue_inject_styles__ = undefined;
|
|
137
|
+
/* scoped */
|
|
138
|
+
const __vue_scope_id__ = undefined;
|
|
139
|
+
/* module identifier */
|
|
140
|
+
const __vue_module_identifier__ = undefined;
|
|
141
|
+
/* functional template */
|
|
142
|
+
const __vue_is_functional_template__ = false;
|
|
143
|
+
/* style inject */
|
|
144
|
+
|
|
145
|
+
/* style inject SSR */
|
|
146
|
+
|
|
147
|
+
/* style inject shadow dom */
|
|
148
|
+
|
|
149
|
+
const __vue_component__ = /*#__PURE__*/normalizeComponent({
|
|
150
|
+
render: __vue_render__,
|
|
151
|
+
staticRenderFns: __vue_staticRenderFns__
|
|
152
|
+
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
|
|
153
|
+
|
|
154
|
+
export { Rating as R, __vue_component__ as _, RatingStar as a, RATING_LENGTH as b };
|
|
@@ -77,6 +77,7 @@ export * from './or-radio-group';
|
|
|
77
77
|
export * from './or-radio-group-v3';
|
|
78
78
|
export * from './or-radio-v3';
|
|
79
79
|
export * from './or-range-slider-v3';
|
|
80
|
+
export * from './or-rating-v3';
|
|
80
81
|
export * from './or-resizeable-panel-v3';
|
|
81
82
|
export * from './or-rich-text-editor-v3';
|
|
82
83
|
export * from './or-search';
|
|
@@ -78,6 +78,7 @@ export { default as OrRadioGroupV3 } from './OrRadioGroupV3/OrRadioGroup.js';
|
|
|
78
78
|
export { _ as OrRadioV3 } from './OrRadioV3-9e90e1b8.js';
|
|
79
79
|
export { _ as OrRangeSliderV3 } from './OrRangeSliderV3-280b8864.js';
|
|
80
80
|
export { _ as OrSliderV3, S as RangeSliderColor, a as RangeSliderOrientation, S as SliderColor, a as SliderOrientation } from './OrSliderV3-f3a65a56.js';
|
|
81
|
+
export { _ as OrRatingV3 } from './OrRatingV3-0860f5b3.js';
|
|
81
82
|
export { _ as OrResizeablePanelV3, R as ResizeablePanelPadding, a as ResizeablePanelPlacement, R as SidebarPadding } from './OrResizeablePanelV3-93accac1.js';
|
|
82
83
|
export { F as Formats, _ as OrRichTextEditorV3 } from './OrRichTextEditorV3-720917c5.js';
|
|
83
84
|
export { default as OrSearch } from './OrSearch/OrSearch.js';
|