@onereach/ui-components 2.68.1-beta.2071.0 → 2.68.2-beta.2074.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 (31) hide show
  1. package/dist/bundled/v2/{OrSelect-f37e751b.js → OrSelect-759b4410.js} +1 -1
  2. package/dist/bundled/v2/components/index.js +2 -2
  3. package/dist/bundled/v2/components/or-select-v3/index.js +2 -2
  4. package/dist/bundled/v2/components/or-tag-v3/OrTag.stories3.d.ts +5 -0
  5. package/dist/bundled/v2/hooks/index.js +1 -1
  6. package/dist/bundled/v2/index.js +3 -3
  7. package/dist/bundled/v2/{useOverflow-43299d81.js → useOverflow-dc93a300.js} +10 -6
  8. package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-c74a63e1.js → OrSelect.vue_vue_type_script_lang-dfadd12f.js} +1 -1
  9. package/dist/bundled/v3/components/index.js +2 -2
  10. package/dist/bundled/v3/components/or-select-v3/index.js +2 -2
  11. package/dist/bundled/v3/components/or-tag-v3/OrTag.stories3.d.ts +5 -0
  12. package/dist/bundled/v3/hooks/index.js +1 -1
  13. package/dist/bundled/v3/index.js +4 -4
  14. package/dist/bundled/v3/{useOverflow-2468b718.js → useOverflow-06bcc7d7.js} +10 -6
  15. package/dist/esm/v2/{OrSelect-528c7480.js → OrSelect-ac382aa6.js} +1 -1
  16. package/dist/esm/v2/components/index.js +2 -2
  17. package/dist/esm/v2/components/or-select-v3/index.js +2 -2
  18. package/dist/esm/v2/components/or-tag-v3/OrTag.stories3.d.ts +5 -0
  19. package/dist/esm/v2/hooks/index.js +1 -1
  20. package/dist/esm/v2/index.js +2 -2
  21. package/dist/esm/v2/{useOverflow-ac506c65.js → useOverflow-a3dc6212.js} +10 -6
  22. package/dist/esm/v3/{OrSelect-d9c76482.js → OrSelect-fee9c099.js} +1 -1
  23. package/dist/esm/v3/components/index.js +2 -2
  24. package/dist/esm/v3/components/or-select-v3/index.js +2 -2
  25. package/dist/esm/v3/components/or-tag-v3/OrTag.stories3.d.ts +5 -0
  26. package/dist/esm/v3/hooks/index.js +1 -1
  27. package/dist/esm/v3/index.js +2 -2
  28. package/dist/esm/v3/{useOverflow-ac506c65.js → useOverflow-a3dc6212.js} +10 -6
  29. package/package.json +1 -1
  30. package/src/components/or-tag-v3/OrTag.stories3.ts +112 -0
  31. package/src/hooks/useOverflow.ts +5 -2
@@ -14,12 +14,16 @@ function useOverflow(container) {
14
14
  innerItems,
15
15
  outerItems
16
16
  }, child) => {
17
- const item = child,
18
- {
19
- x: offset,
20
- width
21
- } = child.getBoundingClientRect();
22
- if (offset + width >= container.clientWidth) {
17
+ const item = child;
18
+ const {
19
+ x: itemOffset,
20
+ width: itemWidth
21
+ } = item.getBoundingClientRect();
22
+ const {
23
+ x: containerOffset,
24
+ width: containerWidth
25
+ } = container.getBoundingClientRect();
26
+ if (itemOffset + itemWidth >= containerOffset + containerWidth) {
23
27
  item.style.setProperty('visibility', 'hidden');
24
28
  return {
25
29
  innerItems,
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, getCurrentInstance, ref, computed, onMounted, watch } from 'vue-demi';
2
2
  import { D as DropdownClose, a as DropdownOpen } from './dropdown-open-0d314aa4.js';
3
3
  import { u as useClassAttribute } from './useClassAttribute-47fdb016.js';
4
- import { u as useOverflow } from './useOverflow-ac506c65.js';
4
+ import { u as useOverflow } from './useOverflow-a3dc6212.js';
5
5
  import '@vueuse/core';
6
6
  import { _ as __vue_component__$1 } from './OrCheckbox-567e387c.js';
7
7
  import { _ as __vue_component__$2 } from './OrError-d267ee9a.js';
@@ -66,7 +66,7 @@ export { _ as OrRadioV3 } from '../OrRadio-848ce55d.js';
66
66
  export { _ as OrSearchV3 } from '../OrSearch-ddb7c1fe.js';
67
67
  export { _ as OrSegmentedControlV3, S as SegmentedControlSize } from '../OrSegmentedControl-e8dce8f9.js';
68
68
  export { _ as OrSelect } from '../OrSelect-dae2b069.js';
69
- export { _ as OrSelectV3 } from '../OrSelect-528c7480.js';
69
+ export { _ as OrSelectV3 } from '../OrSelect-ac382aa6.js';
70
70
  export { _ as OrSidebar, O as OrSidebarSide } from '../OrSidebar-7d6125bb.js';
71
71
  export { O as OrSidebarPlacement, _ as OrSidebarV3 } from '../OrSidebar-fabc7bc9.js';
72
72
  export { _ as OrSkeletonCircle, a as OrSkeletonRect, b as OrSkeletonText, O as OrSkeletonTextSizes } from '../OrSkeletonText-cc94bdc9.js';
@@ -121,6 +121,6 @@ import '../useElevation-31bfe1f6.js';
121
121
  import '../useResponsive-a02e95b7.js';
122
122
  import '@vueuse/integrations/useFocusTrap';
123
123
  import '../dropdown-open-0d314aa4.js';
124
- import '../useOverflow-ac506c65.js';
124
+ import '../useOverflow-a3dc6212.js';
125
125
  import 'portal-vue/dist/portal-vue.esm.js';
126
126
  import 'portal-vue';
@@ -1,9 +1,9 @@
1
- export { _ as OrSelectV3 } from '../../OrSelect-528c7480.js';
1
+ export { _ as OrSelectV3 } from '../../OrSelect-ac382aa6.js';
2
2
  export { a as SelectSize } from '../../OrInputBox-4d5a318d.js';
3
3
  import 'vue-demi';
4
4
  import '../../dropdown-open-0d314aa4.js';
5
5
  import '../../useClassAttribute-47fdb016.js';
6
- import '../../useOverflow-ac506c65.js';
6
+ import '../../useOverflow-a3dc6212.js';
7
7
  import '@vueuse/core';
8
8
  import '../../OrCheckbox-567e387c.js';
9
9
  import '../../OrLabel-2a9f1477.js';
@@ -15,3 +15,8 @@ export declare const WithCustomColor: StoryFn<import("vue").ComponentOptions<imp
15
15
  } | string[], {} & {}, {
16
16
  [x: number]: string;
17
17
  } | {}, true>)>;
18
+ export declare const InsideContainer: StoryFn<import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<unknown>, import("@vue/composition-api").MethodOptions, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").ComponentPropsOptions<import("@vue/composition-api").Data>, import("@vue/composition-api").ExtractPropTypes<import("@vue/composition-api").ComponentPropsOptions<import("@vue/composition-api").Data>>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{} & {}, import("@vue/composition-api").ShallowUnwrapRef<unknown>, unknown, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").MethodOptions, unknown, unknown, {
19
+ [x: string]: ((...args: any[]) => any) | null;
20
+ } | string[], {} & {}, {
21
+ [x: number]: string;
22
+ } | {}, true>)>;
@@ -1,6 +1,6 @@
1
1
  export { u as useClassAttribute } from '../useClassAttribute-47fdb016.js';
2
2
  export { u as useElevation } from '../useElevation-31bfe1f6.js';
3
- export { u as useOverflow } from '../useOverflow-ac506c65.js';
3
+ export { u as useOverflow } from '../useOverflow-a3dc6212.js';
4
4
  export { u as useResponsive } from '../useResponsive-a02e95b7.js';
5
5
  export { u as useToggle } from '../useToggle-29e4d7c7.js';
6
6
  import 'vue-demi';
@@ -66,7 +66,7 @@ export { _ as OrRadioV3 } from './OrRadio-848ce55d.js';
66
66
  export { _ as OrSearchV3 } from './OrSearch-ddb7c1fe.js';
67
67
  export { _ as OrSegmentedControlV3, S as SegmentedControlSize } from './OrSegmentedControl-e8dce8f9.js';
68
68
  export { _ as OrSelect } from './OrSelect-dae2b069.js';
69
- export { _ as OrSelectV3 } from './OrSelect-528c7480.js';
69
+ export { _ as OrSelectV3 } from './OrSelect-ac382aa6.js';
70
70
  export { _ as OrSidebar, O as OrSidebarSide } from './OrSidebar-7d6125bb.js';
71
71
  export { O as OrSidebarPlacement, _ as OrSidebarV3 } from './OrSidebar-fabc7bc9.js';
72
72
  export { _ as OrSkeletonCircle, a as OrSkeletonRect, b as OrSkeletonText, O as OrSkeletonTextSizes } from './OrSkeletonText-cc94bdc9.js';
@@ -98,7 +98,7 @@ export { _ as OrTooltipV3 } from './OrTooltip-513bee30.js';
98
98
  export { D as DropdownClose, a as DropdownOpen } from './dropdown-open-0d314aa4.js';
99
99
  export { u as useClassAttribute } from './useClassAttribute-47fdb016.js';
100
100
  export { u as useElevation } from './useElevation-31bfe1f6.js';
101
- export { u as useOverflow } from './useOverflow-ac506c65.js';
101
+ export { u as useOverflow } from './useOverflow-a3dc6212.js';
102
102
  export { u as useResponsive } from './useResponsive-a02e95b7.js';
103
103
  export { u as useToggle } from './useToggle-29e4d7c7.js';
104
104
  import { R as RX_ABBREVIATION_FROM_STRING } from './color-1f348774.js';
@@ -14,12 +14,16 @@ function useOverflow(container) {
14
14
  innerItems,
15
15
  outerItems
16
16
  }, child) => {
17
- const item = child,
18
- {
19
- x: offset,
20
- width
21
- } = child.getBoundingClientRect();
22
- if (offset + width >= container.clientWidth) {
17
+ const item = child;
18
+ const {
19
+ x: itemOffset,
20
+ width: itemWidth
21
+ } = item.getBoundingClientRect();
22
+ const {
23
+ x: containerOffset,
24
+ width: containerWidth
25
+ } = container.getBoundingClientRect();
26
+ if (itemOffset + itemWidth >= containerOffset + containerWidth) {
23
27
  item.style.setProperty('visibility', 'hidden');
24
28
  return {
25
29
  innerItems,
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, getCurrentInstance, ref, computed, onMounted, watch } from 'vue-demi';
2
2
  import { D as DropdownClose, a as DropdownOpen } from './dropdown-open-0d314aa4.js';
3
3
  import { u as useClassAttribute } from './useClassAttribute-47fdb016.js';
4
- import { u as useOverflow } from './useOverflow-ac506c65.js';
4
+ import { u as useOverflow } from './useOverflow-a3dc6212.js';
5
5
  import '@vueuse/core';
6
6
  import { s as script$1 } from './OrCheckbox-3e139eac.js';
7
7
  import { s as script$2 } from './OrError-ec8c709d.js';
@@ -61,7 +61,7 @@ export { s as OrRadioV3 } from '../OrRadio-54b6d0de.js';
61
61
  export { s as OrSearchV3 } from '../OrSearch-cdde55ce.js';
62
62
  export { s as OrSegmentedControlV3, S as SegmentedControlSize } from '../OrSegmentedControl-171cad78.js';
63
63
  export { s as OrSelect } from '../OrSelect-0821b907.js';
64
- export { s as OrSelectV3 } from '../OrSelect-d9c76482.js';
64
+ export { s as OrSelectV3 } from '../OrSelect-fee9c099.js';
65
65
  export { s as OrSidebar, O as OrSidebarSide } from '../OrSidebar-375c85a3.js';
66
66
  export { O as OrSidebarPlacement, s as OrSidebarV3 } from '../OrSidebar-a62972f5.js';
67
67
  export { s as OrSkeletonCircle, a as OrSkeletonRect, b as OrSkeletonText, O as OrSkeletonTextSizes } from '../OrSkeletonText-2b1610ce.js';
@@ -115,4 +115,4 @@ import '../useElevation-31bfe1f6.js';
115
115
  import '../useResponsive-a02e95b7.js';
116
116
  import '@vueuse/integrations/useFocusTrap';
117
117
  import '../dropdown-open-0d314aa4.js';
118
- import '../useOverflow-ac506c65.js';
118
+ import '../useOverflow-a3dc6212.js';
@@ -1,9 +1,9 @@
1
- export { s as OrSelectV3 } from '../../OrSelect-d9c76482.js';
1
+ export { s as OrSelectV3 } from '../../OrSelect-fee9c099.js';
2
2
  export { a as SelectSize } from '../../OrInputBox-5247ab25.js';
3
3
  import 'vue-demi';
4
4
  import '../../dropdown-open-0d314aa4.js';
5
5
  import '../../useClassAttribute-47fdb016.js';
6
- import '../../useOverflow-ac506c65.js';
6
+ import '../../useOverflow-a3dc6212.js';
7
7
  import '@vueuse/core';
8
8
  import '../../OrCheckbox-3e139eac.js';
9
9
  import '../../OrLabel-bdaec602.js';
@@ -15,3 +15,8 @@ export declare const WithCustomColor: StoryFn<import("vue").ComponentOptions<imp
15
15
  } | string[], {} & {}, {
16
16
  [x: number]: string;
17
17
  } | {}, true>)>;
18
+ export declare const InsideContainer: StoryFn<import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<unknown>, import("@vue/composition-api").MethodOptions, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").ComponentPropsOptions<import("@vue/composition-api").Data>, import("@vue/composition-api").ExtractPropTypes<import("@vue/composition-api").ComponentPropsOptions<import("@vue/composition-api").Data>>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{} & {}, import("@vue/composition-api").ShallowUnwrapRef<unknown>, unknown, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").MethodOptions, unknown, unknown, {
19
+ [x: string]: ((...args: any[]) => any) | null;
20
+ } | string[], {} & {}, {
21
+ [x: number]: string;
22
+ } | {}, true>)>;
@@ -1,6 +1,6 @@
1
1
  export { u as useClassAttribute } from '../useClassAttribute-47fdb016.js';
2
2
  export { u as useElevation } from '../useElevation-31bfe1f6.js';
3
- export { u as useOverflow } from '../useOverflow-ac506c65.js';
3
+ export { u as useOverflow } from '../useOverflow-a3dc6212.js';
4
4
  export { u as useResponsive } from '../useResponsive-a02e95b7.js';
5
5
  export { u as useToggle } from '../useToggle-29e4d7c7.js';
6
6
  import 'vue-demi';
@@ -61,7 +61,7 @@ export { s as OrRadioV3 } from './OrRadio-54b6d0de.js';
61
61
  export { s as OrSearchV3 } from './OrSearch-cdde55ce.js';
62
62
  export { s as OrSegmentedControlV3, S as SegmentedControlSize } from './OrSegmentedControl-171cad78.js';
63
63
  export { s as OrSelect } from './OrSelect-0821b907.js';
64
- export { s as OrSelectV3 } from './OrSelect-d9c76482.js';
64
+ export { s as OrSelectV3 } from './OrSelect-fee9c099.js';
65
65
  export { s as OrSidebar, O as OrSidebarSide } from './OrSidebar-375c85a3.js';
66
66
  export { O as OrSidebarPlacement, s as OrSidebarV3 } from './OrSidebar-a62972f5.js';
67
67
  export { s as OrSkeletonCircle, a as OrSkeletonRect, b as OrSkeletonText, O as OrSkeletonTextSizes } from './OrSkeletonText-2b1610ce.js';
@@ -92,7 +92,7 @@ export { s as OrTooltipV3 } from './OrTooltip-50d27b4f.js';
92
92
  export { D as DropdownClose, a as DropdownOpen } from './dropdown-open-0d314aa4.js';
93
93
  export { u as useClassAttribute } from './useClassAttribute-47fdb016.js';
94
94
  export { u as useElevation } from './useElevation-31bfe1f6.js';
95
- export { u as useOverflow } from './useOverflow-ac506c65.js';
95
+ export { u as useOverflow } from './useOverflow-a3dc6212.js';
96
96
  export { u as useResponsive } from './useResponsive-a02e95b7.js';
97
97
  export { u as useToggle } from './useToggle-29e4d7c7.js';
98
98
  import { R as RX_ABBREVIATION_FROM_STRING } from './color-1f348774.js';
@@ -14,12 +14,16 @@ function useOverflow(container) {
14
14
  innerItems,
15
15
  outerItems
16
16
  }, child) => {
17
- const item = child,
18
- {
19
- x: offset,
20
- width
21
- } = child.getBoundingClientRect();
22
- if (offset + width >= container.clientWidth) {
17
+ const item = child;
18
+ const {
19
+ x: itemOffset,
20
+ width: itemWidth
21
+ } = item.getBoundingClientRect();
22
+ const {
23
+ x: containerOffset,
24
+ width: containerWidth
25
+ } = container.getBoundingClientRect();
26
+ if (itemOffset + itemWidth >= containerOffset + containerWidth) {
23
27
  item.style.setProperty('visibility', 'hidden');
24
28
  return {
25
29
  innerItems,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/ui-components",
3
- "version": "2.68.1-beta.2071.0",
3
+ "version": "2.68.2-beta.2074.0",
4
4
  "description": "Vue components library for v2/3",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/auto/index.js",
@@ -1,8 +1,13 @@
1
1
  import { action } from '@storybook/addon-actions';
2
2
  import { Meta, StoryFn } from '@storybook/vue3';
3
+ import Faker from 'faker';
3
4
  import OrTagDocs from './OrTag.docs.mdx';
4
5
  import OrTag from './OrTag.vue';
5
6
  import { TagColor, TagVariant } from './props';
7
+ import { OrButtonV3 as OrButton } from '../or-button-v3';
8
+ import { OrPopoverV3 as OrPopover } from '../or-popover-v3';
9
+ import { useOverflow } from '../../hooks';
10
+ import { ref } from 'vue-demi';
6
11
 
7
12
  export default {
8
13
  title: 'Components/Tag',
@@ -77,6 +82,97 @@ const Template: StoryFn<typeof OrTag> = (args) => ({
77
82
  `,
78
83
  });
79
84
 
85
+ const ContainerTemplate: StoryFn<typeof OrTag> = (args) => ({
86
+ components: {
87
+ OrTag,
88
+ OrButton,
89
+ OrPopover,
90
+ },
91
+
92
+ setup() {
93
+ const container = ref<HTMLElement>();
94
+ const button = ref<InstanceType<typeof OrButton>>();
95
+ const popover = ref<InstanceType<typeof OrPopover>>();
96
+
97
+ const { innerItems, outerItems } = useOverflow(container);
98
+
99
+ return {
100
+ args,
101
+ container,
102
+ button,
103
+ popover,
104
+ innerItems,
105
+ outerItems,
106
+ handleClick: action('click'),
107
+ handleFocus: action('focus'),
108
+ handleBlur: action('blur'),
109
+ handleReset: action('reset'),
110
+ };
111
+ },
112
+
113
+ computed: {
114
+ tagsArr(): string[] {
115
+ return [
116
+ args.default,
117
+ ...(typeof args.tags === 'string' ? args.tags.split(' ') : []),
118
+ ];
119
+ },
120
+ hiddenTagsArr(): string[] {
121
+ return this.tagsArr.slice(this.innerItems?.length);
122
+ },
123
+ },
124
+
125
+ template: `
126
+ <div class="w-[512px] flex flex-row items-center overflow-hidden gap-xs">
127
+ <div
128
+ ref="container"
129
+ class="relative flex flex-row grow items-center overflow-hidden gap-xs"
130
+ >
131
+ <OrTag
132
+ v-for="tag in tagsArr"
133
+ v-bind="args"
134
+ @click="handleClick"
135
+ @focus="handleFocus"
136
+ @blur="handleBlur"
137
+ @reset="handleReset"
138
+ >
139
+ {{ tag }}
140
+ </OrTag>
141
+ </div>
142
+ <template v-if="outerItems?.length">
143
+ <OrButton
144
+ ref="button"
145
+ class="typography-caption-regular text-on-background dark:text-on-background-dark"
146
+ color="inherit"
147
+ variant="link"
148
+ @click="popover.open()"
149
+ >
150
+ +{{outerItems.length}}
151
+ </OrButton>
152
+ <OrPopover
153
+ ref="popover"
154
+ :trigger="button?.root"
155
+ >
156
+ <div
157
+ class="max-w-[192px] p-[16px] flex flex-row flex-wrap items-center overflow-hidden gap-xs"
158
+ >
159
+ <OrTag
160
+ v-for="tag in hiddenTagsArr"
161
+ v-bind="args"
162
+ @click="handleClick"
163
+ @focus="handleFocus"
164
+ @blur="handleBlur"
165
+ @reset="handleReset"
166
+ >
167
+ {{ tag }}
168
+ </OrTag>
169
+ </div>
170
+ </OrPopover>
171
+ </template>
172
+ </div>
173
+ `,
174
+ });
175
+
80
176
  export const Default = Template.bind({});
81
177
 
82
178
  Default.args = {
@@ -99,3 +195,19 @@ WithCustomColor.args = {
99
195
  // Props
100
196
  color: '#0000ff',
101
197
  };
198
+
199
+ export const InsideContainer = ContainerTemplate.bind({});
200
+
201
+ InsideContainer.argTypes = {
202
+ tags: {
203
+ control: { type: 'text' },
204
+ },
205
+ };
206
+
207
+ InsideContainer.args = {
208
+ // Slots
209
+ default: 'First tag',
210
+
211
+ // Args
212
+ tags: Faker.lorem.words(32),
213
+ };
@@ -21,9 +21,12 @@ export function useOverflow(
21
21
 
22
22
  if (container) {
23
23
  const update = [...container.children].reduce(({ innerItems, outerItems }, child) => {
24
- const item = child as HTMLElement, { x: offset, width } = child.getBoundingClientRect();
24
+ const item = child as HTMLElement;
25
25
 
26
- if (offset + width >= container.clientWidth) {
26
+ const { x: itemOffset, width: itemWidth } = item.getBoundingClientRect();
27
+ const { x: containerOffset, width: containerWidth } = container.getBoundingClientRect();
28
+
29
+ if (itemOffset + itemWidth >= containerOffset + containerWidth) {
27
30
  item.style.setProperty('visibility', 'hidden');
28
31
 
29
32
  return {