@onereach/ui-components 2.68.1-beta.2071.0 → 2.68.1
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/{OrCardCollection-a9a779ea.js → OrCardCollection-dac9fd1e.js} +1 -1
- package/dist/bundled/v2/{OrConfirm-18c534df.js → OrConfirm-ff57274f.js} +1 -1
- package/dist/bundled/v2/{OrInput-8b90e08f.js → OrInput-4b82eb59.js} +4 -4
- package/dist/bundled/v2/{OrSearch-9d402f56.js → OrSearch-e34afaee.js} +1 -1
- package/dist/bundled/v2/{OrSelect-f37e751b.js → OrSelect-a2dbc872.js} +3 -3
- package/dist/bundled/v2/components/index.js +6 -6
- package/dist/bundled/v2/components/or-card-collection-v3/index.js +2 -2
- package/dist/bundled/v2/components/or-confirm-v3/index.js +2 -2
- package/dist/bundled/v2/components/or-input-v3/index.js +1 -1
- package/dist/bundled/v2/components/or-search-v3/index.js +2 -2
- package/dist/bundled/v2/components/or-select-v3/index.js +3 -3
- package/dist/bundled/v2/components/or-tag-v3/OrTag.stories3.d.ts +5 -0
- package/dist/bundled/v2/hooks/index.js +1 -1
- package/dist/bundled/v2/index.js +7 -7
- package/dist/bundled/v2/{useOverflow-43299d81.js → useOverflow-dc93a300.js} +10 -6
- package/dist/bundled/v3/{OrCardCollection.vue_vue_type_script_lang-3993a015.js → OrCardCollection.vue_vue_type_script_lang-7a07be47.js} +1 -1
- package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-289b5600.js → OrConfirm.vue_vue_type_script_lang-2e7fa659.js} +1 -1
- package/dist/bundled/v3/{OrInput-fa782fc1.js → OrInput-e97211bb.js} +1 -1
- package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-ed78b21f.js → OrSearch.vue_vue_type_script_lang-1d2a20e0.js} +1 -1
- package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-c74a63e1.js → OrSelect.vue_vue_type_script_lang-619d6eb7.js} +2 -2
- package/dist/bundled/v3/components/index.js +6 -6
- package/dist/bundled/v3/components/or-card-collection-v3/index.js +2 -2
- package/dist/bundled/v3/components/or-confirm-v3/index.js +2 -2
- package/dist/bundled/v3/components/or-search-v3/index.js +2 -2
- package/dist/bundled/v3/components/or-select-v3/index.js +3 -3
- package/dist/bundled/v3/components/or-tag-v3/OrTag.stories3.d.ts +5 -0
- package/dist/bundled/v3/hooks/index.js +1 -1
- package/dist/bundled/v3/index.js +12 -12
- package/dist/bundled/v3/{useOverflow-2468b718.js → useOverflow-06bcc7d7.js} +10 -6
- package/dist/esm/v2/{OrCardCollection-4f001551.js → OrCardCollection-e46b220e.js} +1 -1
- package/dist/esm/v2/{OrConfirm-b0b2e43c.js → OrConfirm-74e21c56.js} +1 -1
- package/dist/esm/v2/{OrInput-2f16a7ac.js → OrInput-b8a1627f.js} +4 -4
- package/dist/esm/v2/{OrSearch-ddb7c1fe.js → OrSearch-0c0d1773.js} +1 -1
- package/dist/esm/v2/{OrSelect-528c7480.js → OrSelect-acc13b49.js} +3 -3
- package/dist/esm/v2/components/index.js +6 -6
- package/dist/esm/v2/components/or-card-collection-v3/index.js +2 -2
- package/dist/esm/v2/components/or-confirm-v3/index.js +2 -2
- package/dist/esm/v2/components/or-input-v3/index.js +1 -1
- package/dist/esm/v2/components/or-search-v3/index.js +2 -2
- package/dist/esm/v2/components/or-select-v3/index.js +3 -3
- package/dist/esm/v2/components/or-tag-v3/OrTag.stories3.d.ts +5 -0
- package/dist/esm/v2/hooks/index.js +1 -1
- package/dist/esm/v2/index.js +6 -6
- package/dist/esm/{v3/useOverflow-ac506c65.js → v2/useOverflow-a3dc6212.js} +10 -6
- package/dist/esm/v3/{OrCardCollection-5a0febaf.js → OrCardCollection-5924d035.js} +1 -1
- package/dist/esm/v3/{OrConfirm-906427ef.js → OrConfirm-a3f312a6.js} +1 -1
- package/dist/esm/v3/{OrInput-41691fb3.js → OrInput-e2ac1182.js} +1 -1
- package/dist/esm/v3/{OrSearch-cdde55ce.js → OrSearch-01225d82.js} +1 -1
- package/dist/esm/v3/{OrSelect-d9c76482.js → OrSelect-fbf4a140.js} +3 -3
- package/dist/esm/v3/components/index.js +6 -6
- package/dist/esm/v3/components/or-card-collection-v3/index.js +2 -2
- package/dist/esm/v3/components/or-confirm-v3/index.js +2 -2
- package/dist/esm/v3/components/or-input-v3/index.js +1 -1
- package/dist/esm/v3/components/or-search-v3/index.js +2 -2
- package/dist/esm/v3/components/or-select-v3/index.js +3 -3
- package/dist/esm/v3/components/or-tag-v3/OrTag.stories3.d.ts +5 -0
- package/dist/esm/v3/hooks/index.js +1 -1
- package/dist/esm/v3/index.js +6 -6
- package/dist/esm/{v2/useOverflow-ac506c65.js → v3/useOverflow-a3dc6212.js} +10 -6
- package/package.json +3 -2
- package/src/components/or-input-v3/OrInput.vue +1 -1
- package/src/components/or-select-v3/OrSelect.vue +1 -1
- package/src/components/or-tag-v3/OrTag.stories3.ts +112 -0
- package/src/hooks/useOverflow.ts +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onereach/ui-components",
|
|
3
|
-
"version": "2.68.1
|
|
3
|
+
"version": "2.68.1",
|
|
4
4
|
"description": "Vue components library for v2/3",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/auto/index.js",
|
|
@@ -123,5 +123,6 @@
|
|
|
123
123
|
"default": "./dist/bundled/v3/components/*/index.js"
|
|
124
124
|
},
|
|
125
125
|
"./package.json": "./package.json"
|
|
126
|
-
}
|
|
126
|
+
},
|
|
127
|
+
"gitHead": "55398360b64c548aaca507b97933932bff0475da"
|
|
127
128
|
}
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
@blur="$emit('blur', $event)"
|
|
42
42
|
>
|
|
43
43
|
|
|
44
|
-
<div :class="['layout-row']">
|
|
44
|
+
<div :class="['layout-row', 'm-[-4px] md:m-[-2px]']">
|
|
45
45
|
<template v-if="type === 'password'">
|
|
46
46
|
<OrIconButton
|
|
47
47
|
:icon="{ icon: disclosed ? 'visibility_off' : 'visibility', variant: 'filled' }"
|
|
@@ -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
|
+
};
|
package/src/hooks/useOverflow.ts
CHANGED
|
@@ -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
|
|
24
|
+
const item = child as HTMLElement;
|
|
25
25
|
|
|
26
|
-
|
|
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 {
|