@onereach/ui-components 21.3.1 → 21.3.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.
|
@@ -23,8 +23,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
23
23
|
root: import("vue").Ref<HTMLElement | undefined>;
|
|
24
24
|
rootStyles: import("vue").ComputedRef<string[]>;
|
|
25
25
|
starStyles: import("vue").ComputedRef<string[]>;
|
|
26
|
+
starSize: import("vue").ComputedRef<(index: number) => "inherit" | "xl" | "l">;
|
|
26
27
|
model: import("@onereach/ui-components-common/hooks").UseProxyModelValueReturn<number>;
|
|
27
28
|
draft: import("vue").Ref<number>;
|
|
29
|
+
isMobile: import("vue").ComputedRef<boolean>;
|
|
28
30
|
hoverIndex: boolean[];
|
|
29
31
|
onMouseEnter: (event: MouseEvent, index: number) => void;
|
|
30
32
|
onMouseMove: (event: MouseEvent, index: number) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, ref, computed, inject, toRef, watch, reactive, resolveComponent, openBlock, createElementBlock, normalizeClass, Fragment, renderList, createVNode } from 'vue';
|
|
2
|
-
import { r as re } from '../OrAutocompleteV3-961163d0.js';
|
|
2
|
+
import { n as ne, r as re } from '../OrAutocompleteV3-961163d0.js';
|
|
3
3
|
import { OrIconV3 as script$1 } from '../or-icon-v3/index.js';
|
|
4
4
|
import '@vueuse/core';
|
|
5
5
|
import '@onereach/styles/screens.json';
|
|
@@ -41,7 +41,7 @@ const RatingVariants = {
|
|
|
41
41
|
'layout-row'],
|
|
42
42
|
[RatingVariant.Fitted]: [
|
|
43
43
|
// Layout
|
|
44
|
-
'layout-row justify-between']
|
|
44
|
+
'layout-row md:justify-between']
|
|
45
45
|
};
|
|
46
46
|
const RatingStar = [
|
|
47
47
|
// Layout
|
|
@@ -49,11 +49,14 @@ const RatingStar = [
|
|
|
49
49
|
// Interactivity
|
|
50
50
|
'interactivity-click',
|
|
51
51
|
// Box
|
|
52
|
-
'w-[
|
|
52
|
+
'w-[32px] md:w-[24px]', 'h-[32px] md:h-[24px]',
|
|
53
53
|
// Theme (activated)
|
|
54
54
|
'activated:text-warning-hover', 'dark:activated:text-warning-hover-dark',
|
|
55
55
|
// Theme (disabled)
|
|
56
56
|
'disabled:text-disabled', 'dark:disabled:text-disabled-dark'];
|
|
57
|
+
const RatingStarMobile = [
|
|
58
|
+
// Typography;
|
|
59
|
+
'text-[32px]'];
|
|
57
60
|
|
|
58
61
|
const RATING_LENGTH = Symbol();
|
|
59
62
|
var script = defineComponent({
|
|
@@ -88,8 +91,11 @@ var script = defineComponent({
|
|
|
88
91
|
setup(props, context) {
|
|
89
92
|
// Refs & Styles
|
|
90
93
|
const root = ref();
|
|
94
|
+
const {
|
|
95
|
+
isMobile
|
|
96
|
+
} = ne();
|
|
91
97
|
const rootStyles = computed(() => ['or-rating-v3', ...Rating, ...RatingVariants[props.variant]]);
|
|
92
|
-
const starStyles = computed(() => [...RatingStar, ...(props.readonly ? ['interactivity-none'] : [])]);
|
|
98
|
+
const starStyles = computed(() => [...RatingStar, ...(props.readonly ? ['interactivity-none'] : []), ...(isMobile.value ? RatingStarMobile : [])]);
|
|
93
99
|
// Options
|
|
94
100
|
const length = inject(RATING_LENGTH, 5);
|
|
95
101
|
// State
|
|
@@ -103,6 +109,17 @@ var script = defineComponent({
|
|
|
103
109
|
immediate: true
|
|
104
110
|
});
|
|
105
111
|
const hoverIndex = reactive(Array(length).fill(false));
|
|
112
|
+
const starSize = computed(() => {
|
|
113
|
+
return index => {
|
|
114
|
+
if (props.variant === 'fitted' || isMobile.value) {
|
|
115
|
+
return 'inherit';
|
|
116
|
+
}
|
|
117
|
+
if (hoverIndex[index]) {
|
|
118
|
+
return 'xl';
|
|
119
|
+
}
|
|
120
|
+
return 'l';
|
|
121
|
+
};
|
|
122
|
+
});
|
|
106
123
|
// Handlers
|
|
107
124
|
function onMouseEnter(event, index) {
|
|
108
125
|
hoverIndex[index] = true;
|
|
@@ -122,8 +139,10 @@ var script = defineComponent({
|
|
|
122
139
|
root,
|
|
123
140
|
rootStyles,
|
|
124
141
|
starStyles,
|
|
142
|
+
starSize,
|
|
125
143
|
model,
|
|
126
144
|
draft,
|
|
145
|
+
isMobile,
|
|
127
146
|
hoverIndex,
|
|
128
147
|
onMouseEnter,
|
|
129
148
|
onMouseMove,
|
|
@@ -158,7 +177,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
158
177
|
}, [createVNode(_component_OrIcon, {
|
|
159
178
|
icon: _ctx.draft - value + 1 === 0.5 ? 'star_half' : 'star',
|
|
160
179
|
variant: value <= _ctx.draft ? 'filled' : 'outlined',
|
|
161
|
-
size: _ctx.
|
|
180
|
+
size: _ctx.starSize(value - 1)
|
|
162
181
|
}, null, 8 /* PROPS */, ["icon", "variant", "size"])], 42 /* CLASS, PROPS, NEED_HYDRATION */, _hoisted_2);
|
|
163
182
|
}), 128 /* KEYED_FRAGMENT */))], 10 /* CLASS, PROPS */, _hoisted_1);
|
|
164
183
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onereach/ui-components",
|
|
3
|
-
"version": "21.3.
|
|
3
|
+
"version": "21.3.2",
|
|
4
4
|
"description": "Vue components library for v3",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"@codemirror/view": "^6",
|
|
46
46
|
"@floating-ui/dom": "1.5.3",
|
|
47
47
|
"@lezer/highlight": "*",
|
|
48
|
-
"@onereach/styles": "^21.3.
|
|
49
|
-
"@onereach/ui-components-common": "^21.3.
|
|
48
|
+
"@onereach/styles": "^21.3.2",
|
|
49
|
+
"@onereach/ui-components-common": "^21.3.2",
|
|
50
50
|
"@splidejs/splide": "4.0.6",
|
|
51
51
|
"@tiptap/core": "2.0.3",
|
|
52
52
|
"@tiptap/extension-blockquote": "2.0.3",
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"access": "public"
|
|
104
104
|
},
|
|
105
105
|
"npmUnpacked": "4.15.2",
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "fa5876d40691fa509d8575963492da0c2cce65d0"
|
|
107
107
|
}
|