@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 @@
|
|
|
1
|
+
export { b as RATING_LENGTH, s as default } from '../OrRatingV3-d1230c2b.js';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const RATING_LENGTH: unique symbol;
|
|
2
|
+
declare const _default: import("vue-demi").DefineComponent<{
|
|
3
|
+
modelValue: {
|
|
4
|
+
type: NumberConstructor;
|
|
5
|
+
default: number;
|
|
6
|
+
};
|
|
7
|
+
disabled: {
|
|
8
|
+
type: BooleanConstructor;
|
|
9
|
+
default: boolean;
|
|
10
|
+
};
|
|
11
|
+
}, {
|
|
12
|
+
length: number;
|
|
13
|
+
root: import("vue-demi").Ref<HTMLElement | undefined>;
|
|
14
|
+
rootStyles: import("vue-demi").ComputedRef<string[]>;
|
|
15
|
+
starStyles: import("vue-demi").ComputedRef<string[]>;
|
|
16
|
+
proxyModelValue: import("../../hooks").UseProxyModelValueReturn<number>;
|
|
17
|
+
draftModelValue: import("vue-demi").Ref<number>;
|
|
18
|
+
hoverIndex: boolean[];
|
|
19
|
+
onMouseEnter: (event: MouseEvent, index: number) => void;
|
|
20
|
+
onMouseMove: (event: MouseEvent, index: number) => void;
|
|
21
|
+
onMouseLeave: (event: MouseEvent, index: number) => void;
|
|
22
|
+
}, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
|
|
23
|
+
modelValue: {
|
|
24
|
+
type: NumberConstructor;
|
|
25
|
+
default: number;
|
|
26
|
+
};
|
|
27
|
+
disabled: {
|
|
28
|
+
type: BooleanConstructor;
|
|
29
|
+
default: boolean;
|
|
30
|
+
};
|
|
31
|
+
}>> & {
|
|
32
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
33
|
+
}, {
|
|
34
|
+
modelValue: number;
|
|
35
|
+
disabled: boolean;
|
|
36
|
+
}>;
|
|
37
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as OrRatingV3 } from './OrRating.vue';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { s as OrRatingV3 } from '../OrRatingV3-d1230c2b.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { R as Rating, a as RatingStar } from '../OrRatingV3-d1230c2b.js';
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { resolveComponent, openBlock, createElementBlock, normalizeClass, Fragment, renderList, createVNode } from 'vue';
|
|
2
|
+
import { defineComponent, inject, ref, computed, toRef, watch, reactive } from 'vue-demi';
|
|
3
|
+
import { s as script$1 } from './OrIconV3-85d7d26b.js';
|
|
4
|
+
import { u as useProxyModelValue } from './OrBottomSheetV3-74a98d9e.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: script$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
|
+
const _hoisted_1 = ["disabled"];
|
|
87
|
+
const _hoisted_2 = ["activated", "disabled", "onMouseenter", "onMousemove", "onMouseleave"];
|
|
88
|
+
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
89
|
+
const _component_OrIcon = resolveComponent("OrIcon");
|
|
90
|
+
return openBlock(), createElementBlock("div", {
|
|
91
|
+
ref: "root",
|
|
92
|
+
class: normalizeClass(_ctx.rootStyles),
|
|
93
|
+
disabled: _ctx.disabled
|
|
94
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.length, value => {
|
|
95
|
+
return openBlock(), createElementBlock("div", {
|
|
96
|
+
ref_for: true,
|
|
97
|
+
ref: "stars",
|
|
98
|
+
key: value,
|
|
99
|
+
class: normalizeClass(_ctx.starStyles),
|
|
100
|
+
activated: value <= Math.ceil(_ctx.proxyModelValue),
|
|
101
|
+
disabled: _ctx.disabled,
|
|
102
|
+
onMouseenter: $event => _ctx.onMouseEnter($event, value - 1),
|
|
103
|
+
onMousemove: $event => _ctx.onMouseMove($event, value - 1),
|
|
104
|
+
onMouseleave: $event => _ctx.onMouseLeave($event, value - 1),
|
|
105
|
+
onClick: _cache[0] || (_cache[0] = $event => _ctx.proxyModelValue = _ctx.draftModelValue)
|
|
106
|
+
}, [createVNode(_component_OrIcon, {
|
|
107
|
+
icon: _ctx.draftModelValue - value + 1 === 0.5 ? 'star_half' : 'star',
|
|
108
|
+
variant: value <= _ctx.draftModelValue ? 'filled' : 'outlined',
|
|
109
|
+
size: _ctx.hoverIndex[value - 1] ? 'xl' : 'l'
|
|
110
|
+
}, null, 8 /* PROPS */, ["icon", "variant", "size"])], 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_2);
|
|
111
|
+
}), 128 /* KEYED_FRAGMENT */))], 10 /* CLASS, PROPS */, _hoisted_1);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
script.render = render;
|
|
115
|
+
script.__file = "src/components/or-rating-v3/OrRating.vue";
|
|
116
|
+
|
|
117
|
+
export { Rating as R, RatingStar as a, RATING_LENGTH as b, script as s };
|
|
@@ -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 { s as OrRadioV3 } from './OrRadioV3-480629da.js';
|
|
79
79
|
export { s as OrRangeSliderV3 } from './OrRangeSliderV3-1383949e.js';
|
|
80
80
|
export { s as OrSliderV3, S as RangeSliderColor, a as RangeSliderOrientation, S as SliderColor, a as SliderOrientation } from './OrSliderV3-7d496e6b.js';
|
|
81
|
+
export { s as OrRatingV3 } from './OrRatingV3-d1230c2b.js';
|
|
81
82
|
export { s as OrResizeablePanelV3, R as ResizeablePanelPadding, a as ResizeablePanelPlacement, R as SidebarPadding } from './OrResizeablePanelV3-07812398.js';
|
|
82
83
|
export { F as Formats, s as OrRichTextEditorV3 } from './OrRichTextEditorV3-d6ea8050.js';
|
|
83
84
|
export { default as OrSearch } from './OrSearch/OrSearch.js';
|