@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.
Files changed (59) hide show
  1. package/dist/bundled/v2/components/OrRatingV3/OrRating.js +2 -0
  2. package/dist/bundled/v2/components/OrRatingV3/OrRating.vue.d.ts +56 -0
  3. package/dist/bundled/v2/components/OrRatingV3/index.d.ts +1 -0
  4. package/dist/bundled/v2/components/OrRatingV3/index.js +1 -0
  5. package/dist/bundled/v2/components/OrRatingV3/styles.d.ts +2 -0
  6. package/dist/bundled/v2/components/OrRatingV3/styles.js +1 -0
  7. package/dist/bundled/v2/components/OrRatingV3-cdef097d.js +156 -0
  8. package/dist/bundled/v2/components/OrTagInputV3/OrTagInput.js +1 -1
  9. package/dist/bundled/v2/components/OrTagInputV3/OrTagInput.vue.d.ts +0 -11
  10. package/dist/bundled/v2/components/OrTagInputV3/index.js +1 -1
  11. package/dist/bundled/v2/components/OrTagInputV3/styles.js +1 -1
  12. package/dist/bundled/v2/components/{OrTagInputV3-697eb4bf.js → OrTagInputV3-69f191d0.js} +3 -9
  13. package/dist/bundled/v2/components/OrTextarea/OrTextarea.vue.d.ts +2 -2
  14. package/dist/bundled/v2/components/index.d.ts +1 -0
  15. package/dist/bundled/v2/components/index.js +2 -1
  16. package/dist/bundled/v2/index.js +3 -2
  17. package/dist/bundled/v3/components/OrRatingV3/OrRating.js +1 -0
  18. package/dist/bundled/v3/components/OrRatingV3/OrRating.vue.d.ts +37 -0
  19. package/dist/bundled/v3/components/OrRatingV3/index.d.ts +1 -0
  20. package/dist/bundled/v3/components/OrRatingV3/index.js +1 -0
  21. package/dist/bundled/v3/components/OrRatingV3/styles.d.ts +2 -0
  22. package/dist/bundled/v3/components/OrRatingV3/styles.js +1 -0
  23. package/dist/bundled/v3/components/OrRatingV3-a63edd01.js +119 -0
  24. package/dist/bundled/v3/components/OrTagInputV3/OrTagInput.js +1 -1
  25. package/dist/bundled/v3/components/OrTagInputV3/OrTagInput.vue.d.ts +0 -9
  26. package/dist/bundled/v3/components/OrTagInputV3/index.js +1 -1
  27. package/dist/bundled/v3/components/OrTagInputV3/styles.js +1 -1
  28. package/dist/bundled/v3/components/{OrTagInputV3-e511c0bf.js → OrTagInputV3-820b890f.js} +1 -7
  29. package/dist/bundled/v3/components/index.d.ts +1 -0
  30. package/dist/bundled/v3/components/index.js +2 -1
  31. package/dist/bundled/v3/index.js +3 -2
  32. package/dist/esm/v2/OrRating-2aaadb46.js +160 -0
  33. package/dist/esm/v2/{OrTagInput-e7b69c98.js → OrTagInput-a2905657.js} +3 -9
  34. package/dist/esm/v2/components/index.d.ts +1 -0
  35. package/dist/esm/v2/components/index.js +2 -1
  36. package/dist/esm/v2/components/or-rating-v3/OrRating.vue.d.ts +56 -0
  37. package/dist/esm/v2/components/or-rating-v3/index.d.ts +1 -0
  38. package/dist/esm/v2/components/or-rating-v3/index.js +11 -0
  39. package/dist/esm/v2/components/or-rating-v3/styles.d.ts +2 -0
  40. package/dist/esm/v2/components/or-tag-input-v3/OrTagInput.vue.d.ts +0 -11
  41. package/dist/esm/v2/components/or-tag-input-v3/index.js +1 -1
  42. package/dist/esm/v2/index.js +2 -1
  43. package/dist/esm/v3/OrRating-fdb024b7.js +123 -0
  44. package/dist/esm/v3/{OrTagInput-1290510b.js → OrTagInput-4a9158c9.js} +1 -7
  45. package/dist/esm/v3/components/index.d.ts +1 -0
  46. package/dist/esm/v3/components/index.js +2 -1
  47. package/dist/esm/v3/components/or-rating-v3/OrRating.vue.d.ts +37 -0
  48. package/dist/esm/v3/components/or-rating-v3/index.d.ts +1 -0
  49. package/dist/esm/v3/components/or-rating-v3/index.js +11 -0
  50. package/dist/esm/v3/components/or-rating-v3/styles.d.ts +2 -0
  51. package/dist/esm/v3/components/or-tag-input-v3/OrTagInput.vue.d.ts +0 -9
  52. package/dist/esm/v3/components/or-tag-input-v3/index.js +1 -1
  53. package/dist/esm/v3/index.js +2 -1
  54. package/package.json +4 -3
  55. package/src/components/index.ts +1 -0
  56. package/src/components/or-rating-v3/OrRating.vue +129 -0
  57. package/src/components/or-rating-v3/index.ts +1 -0
  58. package/src/components/or-rating-v3/styles.ts +28 -0
  59. package/src/components/or-tag-input-v3/OrTagInput.vue +1 -7
@@ -0,0 +1,160 @@
1
+ import { defineComponent, inject, ref, computed, toRef, watch, reactive } from 'vue-demi';
2
+ import '@vueuse/core';
3
+ import './dom-aecadd9a.js';
4
+ import { u as useProxyModelValue } from './useProxyModelValue-940010d2.js';
5
+ import '@onereach/styles/tailwind/plugins/core';
6
+ import '@onereach/styles/tailwind.config.json';
7
+ import { _ as __vue_component__$1 } from './OrIcon-0343b3d8.js';
8
+ import { n as normalizeComponent } from './normalize-component-6e8e3d80.js';
9
+
10
+ const Rating = [
11
+ // Layout
12
+ 'layout-row',
13
+ // Theme
14
+ 'theme-foreground-disabled', 'dark:theme-foreground-disabled-dark'];
15
+ const RatingStar = [
16
+ // Layout
17
+ 'layout-row justify-center',
18
+ // Interactivity
19
+ 'interactivity-click',
20
+ // Box
21
+ 'w-[28px] md:w-[24px]', 'h-[28px] md:h-[24px]',
22
+ // Theme (activated)
23
+ 'activated:text-warning-hover', 'dark:activated:text-warning-hover-dark',
24
+ // Theme (disabled)
25
+ 'disabled:text-disabled', 'dark:disabled:text-disabled-dark'];
26
+
27
+ const RATING_LENGTH = Symbol();
28
+ var script = defineComponent({
29
+ components: {
30
+ OrIcon: __vue_component__$1
31
+ },
32
+ model: {
33
+ prop: 'modelValue',
34
+ event: 'update:modelValue'
35
+ },
36
+ props: {
37
+ modelValue: {
38
+ type: Number,
39
+ default: 0
40
+ },
41
+ disabled: {
42
+ type: Boolean,
43
+ default: false
44
+ }
45
+ },
46
+ emits: ['update:modelValue'],
47
+ expose: ['root'],
48
+ setup(props, context) {
49
+ // Options
50
+ const length = inject(RATING_LENGTH, 5);
51
+ // Refs
52
+ const root = ref();
53
+ // Styles
54
+ const rootStyles = computed(() => ['or-rating-v3', ...Rating]);
55
+ const starStyles = computed(() => [...RatingStar]);
56
+ // State
57
+ const proxyModelValue = useProxyModelValue(toRef(props, 'modelValue'), context.emit);
58
+ const draftModelValue = ref(proxyModelValue.value);
59
+ watch(proxyModelValue, value => {
60
+ draftModelValue.value = value;
61
+ });
62
+ const hoverIndex = reactive(Array(length).fill(false));
63
+ // Handlers
64
+ function onMouseEnter(event, index) {
65
+ hoverIndex[index] = true;
66
+ }
67
+ function onMouseMove(event, index) {
68
+ const {
69
+ width
70
+ } = event.currentTarget.getBoundingClientRect();
71
+ draftModelValue.value = Math.ceil((index - (width - event.offsetX) / width + 1) * 2) / 2;
72
+ }
73
+ function onMouseLeave(event, index) {
74
+ hoverIndex[index] = false;
75
+ draftModelValue.value = proxyModelValue.value;
76
+ }
77
+ return {
78
+ length,
79
+ root,
80
+ rootStyles,
81
+ starStyles,
82
+ proxyModelValue,
83
+ draftModelValue,
84
+ hoverIndex,
85
+ onMouseEnter,
86
+ onMouseMove,
87
+ onMouseLeave
88
+ };
89
+ }
90
+ });
91
+
92
+ /* script */
93
+ const __vue_script__ = script;
94
+
95
+ /* template */
96
+ var __vue_render__ = function () {
97
+ var _vm = this;
98
+ var _h = _vm.$createElement;
99
+ var _c = _vm._self._c || _h;
100
+ return _c('div', {
101
+ ref: "root",
102
+ class: _vm.rootStyles,
103
+ attrs: {
104
+ "disabled": _vm.disabled
105
+ }
106
+ }, _vm._l(_vm.length, function (value) {
107
+ return _c('div', {
108
+ key: value,
109
+ ref: "stars",
110
+ refInFor: true,
111
+ class: _vm.starStyles,
112
+ attrs: {
113
+ "activated": value <= Math.ceil(_vm.proxyModelValue),
114
+ "disabled": _vm.disabled
115
+ },
116
+ on: {
117
+ "mouseenter": function ($event) {
118
+ return _vm.onMouseEnter($event, value - 1);
119
+ },
120
+ "mousemove": function ($event) {
121
+ return _vm.onMouseMove($event, value - 1);
122
+ },
123
+ "mouseleave": function ($event) {
124
+ return _vm.onMouseLeave($event, value - 1);
125
+ },
126
+ "click": function ($event) {
127
+ _vm.proxyModelValue = _vm.draftModelValue;
128
+ }
129
+ }
130
+ }, [_c('OrIcon', {
131
+ attrs: {
132
+ "icon": _vm.draftModelValue - value + 1 === 0.5 ? 'star_half' : 'star',
133
+ "variant": value <= _vm.draftModelValue ? 'filled' : 'outlined',
134
+ "size": _vm.hoverIndex[value - 1] ? 'xl' : 'l'
135
+ }
136
+ })], 1);
137
+ }), 0);
138
+ };
139
+ var __vue_staticRenderFns__ = [];
140
+
141
+ /* style */
142
+ const __vue_inject_styles__ = undefined;
143
+ /* scoped */
144
+ const __vue_scope_id__ = undefined;
145
+ /* module identifier */
146
+ const __vue_module_identifier__ = undefined;
147
+ /* functional template */
148
+ const __vue_is_functional_template__ = false;
149
+ /* style inject */
150
+
151
+ /* style inject SSR */
152
+
153
+ /* style inject shadow dom */
154
+
155
+ const __vue_component__ = /*#__PURE__*/normalizeComponent({
156
+ render: __vue_render__,
157
+ staticRenderFns: __vue_staticRenderFns__
158
+ }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
159
+
160
+ export { __vue_component__ as _ };
@@ -90,10 +90,6 @@ var script = defineComponent({
90
90
  enableClear: {
91
91
  type: Boolean,
92
92
  default: true
93
- },
94
- saveDraftValueOnClickOutside: {
95
- type: Boolean,
96
- default: false
97
93
  }
98
94
  },
99
95
  emits: ['update:modelValue', 'keydown', 'keyup', 'focus', 'blur', 'reset'],
@@ -110,8 +106,7 @@ var script = defineComponent({
110
106
  overflow,
111
107
  placeholder,
112
108
  disabled,
113
- readonly,
114
- saveDraftValueOnClickOutside
109
+ readonly
115
110
  } = toRefs(props);
116
111
  // Styles
117
112
  const rootStyles = computed(() => ['or-tag-input-v3', ...TagInput]);
@@ -182,7 +177,6 @@ var script = defineComponent({
182
177
  onClickOutside(inputBox, () => {
183
178
  var _a, _b;
184
179
  if (activated.value === false || ((_b = (_a = tags.value) === null || _a === void 0 ? void 0 : _a.overflowPopover) === null || _b === void 0 ? void 0 : _b.state) === 'open') return;
185
- if (saveDraftValueOnClickOutside.value) add();
186
180
  deactivate();
187
181
  });
188
182
  watch(proxyModelValue, (items, prevItems) => {
@@ -218,7 +212,7 @@ var script = defineComponent({
218
212
  }
219
213
  });
220
214
 
221
- var css_248z = "input[data-v-6e446c91]{min-width:0;background:0 0;outline:0}";
215
+ var css_248z = "input[data-v-5083e0d4]{min-width:0;background:0 0;outline:0}";
222
216
  styleInject(css_248z);
223
217
 
224
218
  /* script */
@@ -390,7 +384,7 @@ var __vue_staticRenderFns__ = [];
390
384
  /* style */
391
385
  const __vue_inject_styles__ = undefined;
392
386
  /* scoped */
393
- const __vue_scope_id__ = "data-v-6e446c91";
387
+ const __vue_scope_id__ = "data-v-5083e0d4";
394
388
  /* module identifier */
395
389
  const __vue_module_identifier__ = undefined;
396
390
  /* functional template */
@@ -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';
@@ -95,6 +95,7 @@ export { _ as OrRadioV3 } from '../OrRadio-81a1263e.js';
95
95
  export { _ as OrRangeSliderV3 } from '../OrRangeSlider-32622ccc.js';
96
96
  export { _ as OrSliderV3 } from '../OrSlider-4720f2e2.js';
97
97
  export { S as RangeSliderColor, a as RangeSliderOrientation, S as SliderColor, a as SliderOrientation } from '../OrSlider.vue_rollup-plugin-vue_script-071cae38.js';
98
+ export { _ as OrRatingV3 } from '../OrRating-2aaadb46.js';
98
99
  export { _ as OrResizeablePanelV3, R as ResizeablePanelPadding, a as ResizeablePanelPlacement, R as SidebarPadding } from '../OrResizeablePanel-51314593.js';
99
100
  export { F as Formats, _ as OrRichTextEditorV3 } from '../OrRichTextEditor-e92007c4.js';
100
101
  export { _ as OrSearch } from '../OrSearch-ac542dd6.js';
@@ -123,7 +124,7 @@ export { _ as OrTabV3 } from '../OrTab-c88df1ef.js';
123
124
  export { _ as OrTabs } from '../OrTabs-62e7e478.js';
124
125
  export { _ as OrTabsV3, T as TabsVariant } from '../OrTabs-6026881b.js';
125
126
  export { _ as OrTag } from '../OrTag-b5803a20.js';
126
- export { _ as OrTagInputV3 } from '../OrTagInput-e7b69c98.js';
127
+ export { _ as OrTagInputV3 } from '../OrTagInput-a2905657.js';
127
128
  export { _ as OrTagV3, a as TagColor, T as TagVariant } from '../OrTag-5429f2ff.js';
128
129
  export { _ as OrTagsV3, T as TagsOverflow } from '../OrTags-2d9187e5.js';
129
130
  export { _ as OrTeleport } from '../OrTeleport.vue2-f0c16c71.js';
@@ -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,11 @@
1
+ export { _ as OrRatingV3 } from '../../OrRating-2aaadb46.js';
2
+ import 'vue-demi';
3
+ import '@vueuse/core';
4
+ import '../../dom-aecadd9a.js';
5
+ import 'lodash/isElement';
6
+ import 'lodash/get';
7
+ import '../../useProxyModelValue-940010d2.js';
8
+ import '@onereach/styles/tailwind/plugins/core';
9
+ import '@onereach/styles/tailwind.config.json';
10
+ import '../../OrIcon-0343b3d8.js';
11
+ import '../../normalize-component-6e8e3d80.js';
@@ -0,0 +1,2 @@
1
+ export declare const Rating: string[];
2
+ export declare const RatingStar: string[];
@@ -90,10 +90,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
90
90
  type: BooleanConstructor;
91
91
  default: boolean;
92
92
  };
93
- saveDraftValueOnClickOutside: {
94
- type: BooleanConstructor;
95
- default: boolean;
96
- };
97
93
  }, import("@vue/composition-api").ExtractPropTypes<{
98
94
  modelValue: {
99
95
  type: PropType<string[]>;
@@ -139,10 +135,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
139
135
  type: BooleanConstructor;
140
136
  default: boolean;
141
137
  };
142
- saveDraftValueOnClickOutside: {
143
- type: BooleanConstructor;
144
- default: boolean;
145
- };
146
138
  }>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
147
139
  modelValue: string[];
148
140
  label: string;
@@ -155,7 +147,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
155
147
  disableDefaultStyles: boolean;
156
148
  overflow: "default" | "wrap" | "hidden" | "scroll";
157
149
  enableClear: boolean;
158
- saveDraftValueOnClickOutside: boolean;
159
150
  } & {} & {
160
151
  [x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
161
152
  }, import("@vue/composition-api").ShallowUnwrapRef<{
@@ -215,7 +206,6 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
215
206
  disableDefaultStyles: boolean;
216
207
  overflow: "default" | "wrap" | "hidden" | "scroll";
217
208
  enableClear: boolean;
218
- saveDraftValueOnClickOutside: boolean;
219
209
  } & {} & {
220
210
  [x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
221
211
  }, {
@@ -230,6 +220,5 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
230
220
  disableDefaultStyles: boolean;
231
221
  overflow: "default" | "wrap" | "hidden" | "scroll";
232
222
  enableClear: boolean;
233
- saveDraftValueOnClickOutside: boolean;
234
223
  }, true>);
235
224
  export default _default;
@@ -1,4 +1,4 @@
1
- export { _ as OrTagInputV3 } from '../../OrTagInput-e7b69c98.js';
1
+ export { _ as OrTagInputV3 } from '../../OrTagInput-a2905657.js';
2
2
  export { I as TagInputSize } from '../../OrInputBox.vue_rollup-plugin-vue_script-ba172f8b.js';
3
3
  import 'vue-demi';
4
4
  import '@vueuse/core';
@@ -95,6 +95,7 @@ export { _ as OrRadioV3 } from './OrRadio-81a1263e.js';
95
95
  export { _ as OrRangeSliderV3 } from './OrRangeSlider-32622ccc.js';
96
96
  export { _ as OrSliderV3 } from './OrSlider-4720f2e2.js';
97
97
  export { S as RangeSliderColor, a as RangeSliderOrientation, S as SliderColor, a as SliderOrientation } from './OrSlider.vue_rollup-plugin-vue_script-071cae38.js';
98
+ export { _ as OrRatingV3 } from './OrRating-2aaadb46.js';
98
99
  export { _ as OrResizeablePanelV3, R as ResizeablePanelPadding, a as ResizeablePanelPlacement, R as SidebarPadding } from './OrResizeablePanel-51314593.js';
99
100
  export { F as Formats, _ as OrRichTextEditorV3 } from './OrRichTextEditor-e92007c4.js';
100
101
  export { _ as OrSearch } from './OrSearch-ac542dd6.js';
@@ -123,7 +124,7 @@ export { _ as OrTabV3 } from './OrTab-c88df1ef.js';
123
124
  export { _ as OrTabs } from './OrTabs-62e7e478.js';
124
125
  export { _ as OrTabsV3, T as TabsVariant } from './OrTabs-6026881b.js';
125
126
  export { _ as OrTag } from './OrTag-b5803a20.js';
126
- export { _ as OrTagInputV3 } from './OrTagInput-e7b69c98.js';
127
+ export { _ as OrTagInputV3 } from './OrTagInput-a2905657.js';
127
128
  export { _ as OrTagV3, a as TagColor, T as TagVariant } from './OrTag-5429f2ff.js';
128
129
  export { _ as OrTagsV3, T as TagsOverflow } from './OrTags-2d9187e5.js';
129
130
  export { _ as OrTeleport } from './OrTeleport.vue2-f0c16c71.js';
@@ -0,0 +1,123 @@
1
+ import { defineComponent, inject, ref, computed, toRef, watch, reactive } from 'vue-demi';
2
+ import '@vueuse/core';
3
+ import './dom-aecadd9a.js';
4
+ import { u as useProxyModelValue } from './useProxyModelValue-940010d2.js';
5
+ import '@onereach/styles/tailwind/plugins/core';
6
+ import '@onereach/styles/tailwind.config.json';
7
+ import { s as script$1 } from './OrIcon-8f6c9c29.js';
8
+ import { resolveComponent, openBlock, createElementBlock, normalizeClass, Fragment, renderList, createVNode } from 'vue';
9
+
10
+ const Rating = [
11
+ // Layout
12
+ 'layout-row',
13
+ // Theme
14
+ 'theme-foreground-disabled', 'dark:theme-foreground-disabled-dark'];
15
+ const RatingStar = [
16
+ // Layout
17
+ 'layout-row justify-center',
18
+ // Interactivity
19
+ 'interactivity-click',
20
+ // Box
21
+ 'w-[28px] md:w-[24px]', 'h-[28px] md:h-[24px]',
22
+ // Theme (activated)
23
+ 'activated:text-warning-hover', 'dark:activated:text-warning-hover-dark',
24
+ // Theme (disabled)
25
+ 'disabled:text-disabled', 'dark:disabled:text-disabled-dark'];
26
+
27
+ const RATING_LENGTH = Symbol();
28
+ var script = defineComponent({
29
+ components: {
30
+ OrIcon: script$1
31
+ },
32
+ model: {
33
+ prop: 'modelValue',
34
+ event: 'update:modelValue'
35
+ },
36
+ props: {
37
+ modelValue: {
38
+ type: Number,
39
+ default: 0
40
+ },
41
+ disabled: {
42
+ type: Boolean,
43
+ default: false
44
+ }
45
+ },
46
+ emits: ['update:modelValue'],
47
+ expose: ['root'],
48
+ setup(props, context) {
49
+ // Options
50
+ const length = inject(RATING_LENGTH, 5);
51
+ // Refs
52
+ const root = ref();
53
+ // Styles
54
+ const rootStyles = computed(() => ['or-rating-v3', ...Rating]);
55
+ const starStyles = computed(() => [...RatingStar]);
56
+ // State
57
+ const proxyModelValue = useProxyModelValue(toRef(props, 'modelValue'), context.emit);
58
+ const draftModelValue = ref(proxyModelValue.value);
59
+ watch(proxyModelValue, value => {
60
+ draftModelValue.value = value;
61
+ });
62
+ const hoverIndex = reactive(Array(length).fill(false));
63
+ // Handlers
64
+ function onMouseEnter(event, index) {
65
+ hoverIndex[index] = true;
66
+ }
67
+ function onMouseMove(event, index) {
68
+ const {
69
+ width
70
+ } = event.currentTarget.getBoundingClientRect();
71
+ draftModelValue.value = Math.ceil((index - (width - event.offsetX) / width + 1) * 2) / 2;
72
+ }
73
+ function onMouseLeave(event, index) {
74
+ hoverIndex[index] = false;
75
+ draftModelValue.value = proxyModelValue.value;
76
+ }
77
+ return {
78
+ length,
79
+ root,
80
+ rootStyles,
81
+ starStyles,
82
+ proxyModelValue,
83
+ draftModelValue,
84
+ hoverIndex,
85
+ onMouseEnter,
86
+ onMouseMove,
87
+ onMouseLeave
88
+ };
89
+ }
90
+ });
91
+
92
+ const _hoisted_1 = ["disabled"];
93
+ const _hoisted_2 = ["activated", "disabled", "onMouseenter", "onMousemove", "onMouseleave"];
94
+ function render(_ctx, _cache, $props, $setup, $data, $options) {
95
+ const _component_OrIcon = resolveComponent("OrIcon");
96
+ return openBlock(), createElementBlock("div", {
97
+ ref: "root",
98
+ class: normalizeClass(_ctx.rootStyles),
99
+ disabled: _ctx.disabled
100
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.length, value => {
101
+ return openBlock(), createElementBlock("div", {
102
+ ref_for: true,
103
+ ref: "stars",
104
+ key: value,
105
+ class: normalizeClass(_ctx.starStyles),
106
+ activated: value <= Math.ceil(_ctx.proxyModelValue),
107
+ disabled: _ctx.disabled,
108
+ onMouseenter: $event => _ctx.onMouseEnter($event, value - 1),
109
+ onMousemove: $event => _ctx.onMouseMove($event, value - 1),
110
+ onMouseleave: $event => _ctx.onMouseLeave($event, value - 1),
111
+ onClick: _cache[0] || (_cache[0] = $event => _ctx.proxyModelValue = _ctx.draftModelValue)
112
+ }, [createVNode(_component_OrIcon, {
113
+ icon: _ctx.draftModelValue - value + 1 === 0.5 ? 'star_half' : 'star',
114
+ variant: value <= _ctx.draftModelValue ? 'filled' : 'outlined',
115
+ size: _ctx.hoverIndex[value - 1] ? 'xl' : 'l'
116
+ }, null, 8 /* PROPS */, ["icon", "variant", "size"])], 42 /* CLASS, PROPS, HYDRATE_EVENTS */, _hoisted_2);
117
+ }), 128 /* KEYED_FRAGMENT */))], 10 /* CLASS, PROPS */, _hoisted_1);
118
+ }
119
+
120
+ script.render = render;
121
+ script.__file = "src/components/or-rating-v3/OrRating.vue";
122
+
123
+ export { script as s };
@@ -89,10 +89,6 @@ var script = defineComponent({
89
89
  enableClear: {
90
90
  type: Boolean,
91
91
  default: true
92
- },
93
- saveDraftValueOnClickOutside: {
94
- type: Boolean,
95
- default: false
96
92
  }
97
93
  },
98
94
  emits: ['update:modelValue', 'keydown', 'keyup', 'focus', 'blur', 'reset'],
@@ -109,8 +105,7 @@ var script = defineComponent({
109
105
  overflow,
110
106
  placeholder,
111
107
  disabled,
112
- readonly,
113
- saveDraftValueOnClickOutside
108
+ readonly
114
109
  } = toRefs(props);
115
110
  // Styles
116
111
  const rootStyles = computed(() => ['or-tag-input-v3', ...TagInput]);
@@ -181,7 +176,6 @@ var script = defineComponent({
181
176
  onClickOutside(inputBox, () => {
182
177
  var _a, _b;
183
178
  if (activated.value === false || ((_b = (_a = tags.value) === null || _a === void 0 ? void 0 : _a.overflowPopover) === null || _b === void 0 ? void 0 : _b.state) === 'open') return;
184
- if (saveDraftValueOnClickOutside.value) add();
185
179
  deactivate();
186
180
  });
187
181
  watch(proxyModelValue, (items, prevItems) => {
@@ -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';
@@ -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-1290510b.js';
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';
@@ -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,11 @@
1
+ export { s as OrRatingV3 } from '../../OrRating-fdb024b7.js';
2
+ import 'vue-demi';
3
+ import '@vueuse/core';
4
+ import '../../dom-aecadd9a.js';
5
+ import 'lodash/isElement';
6
+ import 'lodash/get';
7
+ import '../../useProxyModelValue-940010d2.js';
8
+ import '@onereach/styles/tailwind/plugins/core';
9
+ import '@onereach/styles/tailwind.config.json';
10
+ import '../../OrIcon-8f6c9c29.js';
11
+ import 'vue';
@@ -0,0 +1,2 @@
1
+ export declare const Rating: string[];
2
+ export declare const RatingStar: string[];
@@ -45,10 +45,6 @@ declare const _default: import("vue-demi").DefineComponent<{
45
45
  type: BooleanConstructor;
46
46
  default: boolean;
47
47
  };
48
- saveDraftValueOnClickOutside: {
49
- type: BooleanConstructor;
50
- default: boolean;
51
- };
52
48
  }, {
53
49
  root: import("vue-demi").Ref<HTMLElement | undefined>;
54
50
  control: import("vue-demi").Ref<HTMLInputElement | undefined>;
@@ -131,10 +127,6 @@ declare const _default: import("vue-demi").DefineComponent<{
131
127
  type: BooleanConstructor;
132
128
  default: boolean;
133
129
  };
134
- saveDraftValueOnClickOutside: {
135
- type: BooleanConstructor;
136
- default: boolean;
137
- };
138
130
  }>> & {
139
131
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
140
132
  onKeydown?: ((...args: any[]) => any) | undefined;
@@ -154,6 +146,5 @@ declare const _default: import("vue-demi").DefineComponent<{
154
146
  disableDefaultStyles: boolean;
155
147
  overflow: "default" | "wrap" | "hidden" | "scroll";
156
148
  enableClear: boolean;
157
- saveDraftValueOnClickOutside: boolean;
158
149
  }>;
159
150
  export default _default;
@@ -1,4 +1,4 @@
1
- export { s as OrTagInputV3 } from '../../OrTagInput-1290510b.js';
1
+ export { s as OrTagInputV3 } from '../../OrTagInput-4a9158c9.js';
2
2
  export { I as TagInputSize } from '../../OrInputBox-ffea8c8e.js';
3
3
  import 'vue-demi';
4
4
  import '@vueuse/core';