@onereach/ui-components 8.13.0-beta.3770.0 → 8.13.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-cdef097d.js +156 -0
- package/dist/bundled/v2/components/OrTagInputV3/OrTagInput.js +1 -1
- package/dist/bundled/v2/components/OrTagInputV3/OrTagInput.vue.d.ts +0 -11
- package/dist/bundled/v2/components/OrTagInputV3/index.js +1 -1
- package/dist/bundled/v2/components/OrTagInputV3/styles.js +1 -1
- package/dist/bundled/v2/components/{OrTagInputV3-697eb4bf.js → OrTagInputV3-69f191d0.js} +3 -9
- package/dist/bundled/v2/components/OrTextarea/OrTextarea.vue.d.ts +2 -2
- package/dist/bundled/v2/components/index.d.ts +1 -0
- package/dist/bundled/v2/components/index.js +2 -1
- package/dist/bundled/v2/index.js +3 -2
- 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-a63edd01.js +119 -0
- package/dist/bundled/v3/components/OrTagInputV3/OrTagInput.js +1 -1
- package/dist/bundled/v3/components/OrTagInputV3/OrTagInput.vue.d.ts +0 -9
- package/dist/bundled/v3/components/OrTagInputV3/index.js +1 -1
- package/dist/bundled/v3/components/OrTagInputV3/styles.js +1 -1
- package/dist/bundled/v3/components/{OrTagInputV3-e511c0bf.js → OrTagInputV3-820b890f.js} +1 -7
- package/dist/bundled/v3/components/index.d.ts +1 -0
- package/dist/bundled/v3/components/index.js +2 -1
- package/dist/bundled/v3/index.js +3 -2
- package/dist/esm/v2/OrRating-2aaadb46.js +160 -0
- package/dist/esm/v2/{OrTagInput-e7b69c98.js → OrTagInput-a2905657.js} +3 -9
- package/dist/esm/v2/components/index.d.ts +1 -0
- package/dist/esm/v2/components/index.js +2 -1
- 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/components/or-tag-input-v3/OrTagInput.vue.d.ts +0 -11
- package/dist/esm/v2/components/or-tag-input-v3/index.js +1 -1
- package/dist/esm/v2/index.js +2 -1
- package/dist/esm/v3/OrRating-fdb024b7.js +123 -0
- package/dist/esm/v3/{OrTagInput-1290510b.js → OrTagInput-4a9158c9.js} +1 -7
- package/dist/esm/v3/components/index.d.ts +1 -0
- package/dist/esm/v3/components/index.js +2 -1
- 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/components/or-tag-input-v3/OrTagInput.vue.d.ts +0 -9
- package/dist/esm/v3/components/or-tag-input-v3/index.js +1 -1
- package/dist/esm/v3/index.js +2 -1
- package/package.json +4 -3
- 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 +28 -0
- package/src/components/or-tag-input-v3/OrTagInput.vue +1 -7
package/dist/esm/v3/index.js
CHANGED
|
@@ -91,6 +91,7 @@ export { s as OrRadioGroupV3 } from './OrRadioGroup-b4b6d364.js';
|
|
|
91
91
|
export { s as OrRadioV3 } from './OrRadio-50b0ead5.js';
|
|
92
92
|
export { s as OrRangeSliderV3 } from './OrRangeSlider-8edcdad1.js';
|
|
93
93
|
export { s as OrSliderV3, S as RangeSliderColor, a as RangeSliderOrientation, S as SliderColor, a as SliderOrientation } from './OrSlider-a0ec670e.js';
|
|
94
|
+
export { s as OrRatingV3 } from './OrRating-fdb024b7.js';
|
|
94
95
|
export { s as OrResizeablePanelV3, R as ResizeablePanelPadding, a as ResizeablePanelPlacement, R as SidebarPadding } from './OrResizeablePanel-60f83f9a.js';
|
|
95
96
|
export { F as Formats, s as OrRichTextEditorV3 } from './OrRichTextEditor-a1f04ce6.js';
|
|
96
97
|
export { s as OrSearch } from './OrSearch-2800e9bf.js';
|
|
@@ -119,7 +120,7 @@ export { s as OrTabV3 } from './OrTab-45853fd2.js';
|
|
|
119
120
|
export { s as OrTabs } from './OrTabs-3da3ea89.js';
|
|
120
121
|
export { s as OrTabsV3, T as TabsVariant } from './OrTabs-b076c7e7.js';
|
|
121
122
|
export { s as OrTag } from './OrTag-1b3b1296.js';
|
|
122
|
-
export { s as OrTagInputV3 } from './OrTagInput-
|
|
123
|
+
export { s as OrTagInputV3 } from './OrTagInput-4a9158c9.js';
|
|
123
124
|
export { s as OrTagV3, a as TagColor, T as TagVariant } from './OrTag-ff483e6b.js';
|
|
124
125
|
export { s as OrTagsV3, T as TagsOverflow } from './OrTags-942e528e.js';
|
|
125
126
|
export { s as OrTeleport } from './OrTeleport.vue3-9bce0c02.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onereach/ui-components",
|
|
3
|
-
"version": "8.13.0
|
|
3
|
+
"version": "8.13.0",
|
|
4
4
|
"npmUnpacked": "4.15.2",
|
|
5
5
|
"description": "Vue components library for v2/3",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@codemirror/lang-json": "6.0.1",
|
|
41
41
|
"@codemirror/lang-markdown": "6.1.1",
|
|
42
42
|
"@floating-ui/dom": "1.4.2",
|
|
43
|
-
"@onereach/styles": "^6.
|
|
43
|
+
"@onereach/styles": "^6.6.0",
|
|
44
44
|
"@splidejs/splide": "4.0.6",
|
|
45
45
|
"@tiptap/core": "2.0.3",
|
|
46
46
|
"@tiptap/extension-blockquote": "2.0.3",
|
|
@@ -176,5 +176,6 @@
|
|
|
176
176
|
"default": "./dist/bundled/v3/components/*/index.js"
|
|
177
177
|
},
|
|
178
178
|
"./package.json": "./package.json"
|
|
179
|
-
}
|
|
179
|
+
},
|
|
180
|
+
"gitHead": "3e1145e0603cef516dbe83442131c68cb121146a"
|
|
180
181
|
}
|
package/src/components/index.ts
CHANGED
|
@@ -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';
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="root"
|
|
4
|
+
:class="rootStyles"
|
|
5
|
+
:disabled="disabled"
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
v-for="value of length"
|
|
9
|
+
ref="stars"
|
|
10
|
+
:key="value"
|
|
11
|
+
:class="starStyles"
|
|
12
|
+
:activated="value <= Math.ceil(proxyModelValue)"
|
|
13
|
+
:disabled="disabled"
|
|
14
|
+
@mouseenter="onMouseEnter($event, value - 1)"
|
|
15
|
+
@mousemove="onMouseMove($event, value - 1)"
|
|
16
|
+
@mouseleave="onMouseLeave($event, value - 1)"
|
|
17
|
+
@click="proxyModelValue = draftModelValue"
|
|
18
|
+
>
|
|
19
|
+
<OrIcon
|
|
20
|
+
:icon="draftModelValue - value + 1 === 0.5 ? 'star_half' : 'star'"
|
|
21
|
+
:variant="value <= draftModelValue ? 'filled' : 'outlined'"
|
|
22
|
+
:size="hoverIndex[value - 1] ? 'xl' : 'l'"
|
|
23
|
+
/>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script lang="ts">
|
|
29
|
+
import { computed, defineComponent, inject, reactive, ref, toRef, watch } from 'vue-demi';
|
|
30
|
+
import { useProxyModelValue } from '../../hooks';
|
|
31
|
+
import { OrIconV3 as OrIcon } from '../or-icon-v3';
|
|
32
|
+
import { Rating, RatingStar } from './styles';
|
|
33
|
+
|
|
34
|
+
export const RATING_LENGTH = Symbol();
|
|
35
|
+
|
|
36
|
+
export default defineComponent({
|
|
37
|
+
components: {
|
|
38
|
+
OrIcon,
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
model: {
|
|
42
|
+
prop: 'modelValue',
|
|
43
|
+
event: 'update:modelValue',
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
props: {
|
|
47
|
+
modelValue: {
|
|
48
|
+
type: Number,
|
|
49
|
+
default: 0,
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
disabled: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
emits: [
|
|
59
|
+
'update:modelValue',
|
|
60
|
+
],
|
|
61
|
+
|
|
62
|
+
expose: [
|
|
63
|
+
'root',
|
|
64
|
+
],
|
|
65
|
+
|
|
66
|
+
setup(props, context) {
|
|
67
|
+
// Options
|
|
68
|
+
const length = inject(RATING_LENGTH, 5);
|
|
69
|
+
|
|
70
|
+
// Refs
|
|
71
|
+
const root = ref<HTMLElement>();
|
|
72
|
+
|
|
73
|
+
// Styles
|
|
74
|
+
const rootStyles = computed(() => [
|
|
75
|
+
'or-rating-v3',
|
|
76
|
+
...Rating,
|
|
77
|
+
]);
|
|
78
|
+
|
|
79
|
+
const starStyles = computed(() => [
|
|
80
|
+
...RatingStar,
|
|
81
|
+
]);
|
|
82
|
+
|
|
83
|
+
// State
|
|
84
|
+
const proxyModelValue = useProxyModelValue(toRef(props, 'modelValue'), context.emit);
|
|
85
|
+
const draftModelValue = ref(proxyModelValue.value);
|
|
86
|
+
|
|
87
|
+
watch(proxyModelValue, (value) => {
|
|
88
|
+
draftModelValue.value = value;
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const hoverIndex = reactive(Array<boolean>(length).fill(false));
|
|
92
|
+
|
|
93
|
+
// Handlers
|
|
94
|
+
function onMouseEnter(event: MouseEvent, index: number): void {
|
|
95
|
+
hoverIndex[index] = true;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function onMouseMove(event: MouseEvent, index: number): void {
|
|
99
|
+
const { width } = (event.currentTarget as Element).getBoundingClientRect();
|
|
100
|
+
|
|
101
|
+
draftModelValue.value = Math.ceil((index - (width - event.offsetX) / width + 1) * 2) / 2;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function onMouseLeave(event: MouseEvent, index: number): void {
|
|
105
|
+
hoverIndex[index] = false;
|
|
106
|
+
|
|
107
|
+
draftModelValue.value = proxyModelValue.value;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return {
|
|
111
|
+
length,
|
|
112
|
+
|
|
113
|
+
root,
|
|
114
|
+
|
|
115
|
+
rootStyles,
|
|
116
|
+
starStyles,
|
|
117
|
+
|
|
118
|
+
proxyModelValue,
|
|
119
|
+
draftModelValue,
|
|
120
|
+
|
|
121
|
+
hoverIndex,
|
|
122
|
+
|
|
123
|
+
onMouseEnter,
|
|
124
|
+
onMouseMove,
|
|
125
|
+
onMouseLeave,
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as OrRatingV3 } from './OrRating.vue';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export const Rating: string[] = [
|
|
2
|
+
// Layout
|
|
3
|
+
'layout-row',
|
|
4
|
+
|
|
5
|
+
// Theme
|
|
6
|
+
'theme-foreground-disabled',
|
|
7
|
+
'dark:theme-foreground-disabled-dark',
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
export const RatingStar: string[] = [
|
|
11
|
+
// Layout
|
|
12
|
+
'layout-row justify-center',
|
|
13
|
+
|
|
14
|
+
// Interactivity
|
|
15
|
+
'interactivity-click',
|
|
16
|
+
|
|
17
|
+
// Box
|
|
18
|
+
'w-[28px] md:w-[24px]',
|
|
19
|
+
'h-[28px] md:h-[24px]',
|
|
20
|
+
|
|
21
|
+
// Theme (activated)
|
|
22
|
+
'activated:text-warning-hover',
|
|
23
|
+
'dark:activated:text-warning-hover-dark',
|
|
24
|
+
|
|
25
|
+
// Theme (disabled)
|
|
26
|
+
'disabled:text-disabled',
|
|
27
|
+
'dark:disabled:text-disabled-dark',
|
|
28
|
+
];
|
|
@@ -202,11 +202,6 @@ export default defineComponent({
|
|
|
202
202
|
type: Boolean,
|
|
203
203
|
default: true,
|
|
204
204
|
},
|
|
205
|
-
|
|
206
|
-
saveDraftValueOnClickOutside: {
|
|
207
|
-
type: Boolean,
|
|
208
|
-
default: false,
|
|
209
|
-
},
|
|
210
205
|
},
|
|
211
206
|
|
|
212
207
|
emits: [
|
|
@@ -234,7 +229,7 @@ export default defineComponent({
|
|
|
234
229
|
const tags = ref<InstanceType<typeof OrTags>>();
|
|
235
230
|
|
|
236
231
|
// Props
|
|
237
|
-
const { modelValue, overflow, placeholder, disabled, readonly
|
|
232
|
+
const { modelValue, overflow, placeholder, disabled, readonly } = toRefs(props);
|
|
238
233
|
|
|
239
234
|
// Styles
|
|
240
235
|
const rootStyles = computed(() => [
|
|
@@ -327,7 +322,6 @@ export default defineComponent({
|
|
|
327
322
|
// Effects
|
|
328
323
|
onClickOutside((inputBox as MaybeElementRef), () => {
|
|
329
324
|
if (activated.value === false || (tags.value?.overflowPopover as any)?.state === 'open') return;
|
|
330
|
-
if (saveDraftValueOnClickOutside.value) add();
|
|
331
325
|
deactivate();
|
|
332
326
|
});
|
|
333
327
|
|