yuyeon 0.1.0-rc.6 → 0.1.0-rc.7

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.
@@ -30,4 +30,5 @@ export * from "./divider/index.mjs";
30
30
  export * from "./date-picker/index.mjs";
31
31
  export * from "./icon/index.mjs";
32
32
  export * from "./badge/index.mjs";
33
+ export * from "./text-ellipsis/index.mjs";
33
34
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/components/index.ts"],"sourcesContent":["export * from './app';\nexport * from './button';\nexport * from './input';\nexport * from './field-input';\nexport * from './textarea';\nexport * from './form';\nexport * from './progress-bar';\nexport * from './card';\nexport * from './chip';\nexport * from './switch';\nexport * from './layer';\nexport * from './dialog';\nexport * from './snackbar';\nexport * from './tooltip';\nexport * from './transitions';\nexport * from './panel';\nexport * from './tree-view';\nexport * from './list';\nexport * from './icons';\nexport * from './table';\nexport * from './menu';\nexport * from './checkbox';\nexport * from './pagination';\nexport * from './loading';\nexport * from './dropdown';\nexport * from './select';\nexport * from './tab';\nexport * from './alert';\nexport * from './divider';\nexport * from './date-picker';\nexport * from './icon';\nexport * from './badge';\n"],"mappings":""}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/components/index.ts"],"sourcesContent":["export * from './app';\nexport * from './button';\nexport * from './input';\nexport * from './field-input';\nexport * from './textarea';\nexport * from './form';\nexport * from './progress-bar';\nexport * from './card';\nexport * from './chip';\nexport * from './switch';\nexport * from './layer';\nexport * from './dialog';\nexport * from './snackbar';\nexport * from './tooltip';\nexport * from './transitions';\nexport * from './panel';\nexport * from './tree-view';\nexport * from './list';\nexport * from './icons';\nexport * from './table';\nexport * from './menu';\nexport * from './checkbox';\nexport * from './pagination';\nexport * from './loading';\nexport * from './dropdown';\nexport * from './select';\nexport * from './tab';\nexport * from './alert';\nexport * from './divider';\nexport * from './date-picker';\nexport * from './icon';\nexport * from './badge';\nexport * from './text-ellipsis';\n"],"mappings":""}
@@ -0,0 +1,61 @@
1
+ import { createVNode as _createVNode } from "vue";
2
+ import { computed, defineComponent, ref, watch } from 'vue';
3
+ import { useRender, useResizeObserver } from "../../composables/index.mjs";
4
+ import "./YTextEllipsis.scss";
5
+ export const YTextEllipsis = defineComponent({
6
+ name: 'YTextEllipsis',
7
+ props: {
8
+ text: {
9
+ type: String,
10
+ default: ''
11
+ }
12
+ },
13
+ setup(props) {
14
+ const {
15
+ resizeObservedRef,
16
+ contentRect
17
+ } = useResizeObserver();
18
+ const isOverflow = ref(false);
19
+ const containerWidth = computed(() => {
20
+ return contentRect.value?.width;
21
+ });
22
+ const title = computed(() => {
23
+ return props.text;
24
+ });
25
+ const startText = computed(() => {
26
+ if (isOverflow.value) {
27
+ const length = Math.round(props.text.length * 0.5);
28
+ return props.text.substring(0, length);
29
+ }
30
+ return props.text;
31
+ });
32
+ const endText = computed(() => {
33
+ if (isOverflow.value) {
34
+ const length = Math.round(props.text.length * 0.5);
35
+ return props.text.substring(length, props.text.length);
36
+ }
37
+ return props.text;
38
+ });
39
+ watch(containerWidth, neo => {
40
+ if (resizeObservedRef.value && neo != null) {
41
+ isOverflow.value = resizeObservedRef.value.scrollWidth > resizeObservedRef.value.offsetWidth;
42
+ }
43
+ });
44
+ useRender(() => {
45
+ return _createVNode("span", {
46
+ "title": title.value,
47
+ "class": ['y-text-ellipsis', {
48
+ overflowed: isOverflow
49
+ }]
50
+ }, [_createVNode("span", {
51
+ "ref": resizeObservedRef,
52
+ "class": "y-text-ellipsis__origin"
53
+ }, [props.text]), isOverflow.value && _createVNode("span", {
54
+ "class": "y-text-ellipsis__start"
55
+ }, [startText.value]), isOverflow.value && _createVNode("span", {
56
+ "class": "y-text-ellipsis__end"
57
+ }, [endText.value])]);
58
+ });
59
+ }
60
+ });
61
+ //# sourceMappingURL=YTextEllipsis.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"YTextEllipsis.mjs","names":["computed","defineComponent","ref","watch","useRender","useResizeObserver","YTextEllipsis","name","props","text","type","String","default","setup","resizeObservedRef","contentRect","isOverflow","containerWidth","value","width","title","startText","length","Math","round","substring","endText","neo","scrollWidth","offsetWidth","_createVNode","overflowed"],"sources":["../../../src/components/text-ellipsis/YTextEllipsis.tsx"],"sourcesContent":["import { computed, defineComponent, ref, watch } from 'vue';\n\nimport { useRender, useResizeObserver } from '../../composables';\n\nimport './YTextEllipsis.scss';\n\nexport const YTextEllipsis = defineComponent({\n name: 'YTextEllipsis',\n props: {\n text: {\n type: String,\n default: '',\n },\n },\n setup(props) {\n const { resizeObservedRef, contentRect } = useResizeObserver();\n\n const isOverflow = ref(false);\n\n const containerWidth = computed(() => {\n return contentRect.value?.width;\n });\n\n const title = computed(() => {\n return props.text;\n });\n\n const startText = computed(() => {\n if (isOverflow.value) {\n const length = Math.round(props.text.length * 0.5);\n return props.text.substring(0, length);\n }\n return props.text;\n });\n\n const endText = computed(() => {\n if (isOverflow.value) {\n const length = Math.round(props.text.length * 0.5);\n return props.text.substring(length, props.text.length);\n }\n return props.text;\n });\n\n watch(containerWidth, (neo) => {\n if (resizeObservedRef.value && neo != null) {\n isOverflow.value =\n resizeObservedRef.value.scrollWidth >\n resizeObservedRef.value.offsetWidth;\n }\n });\n\n useRender(() => {\n return (\n <span\n title={title.value}\n class={['y-text-ellipsis', { overflowed: isOverflow }]}\n >\n <span ref={resizeObservedRef} class=\"y-text-ellipsis__origin\">\n {props.text}\n </span>\n {isOverflow.value && (\n <span class=\"y-text-ellipsis__start\">{startText.value}</span>\n )}\n\n {isOverflow.value && (\n <span class=\"y-text-ellipsis__end\">{endText.value}</span>\n )}\n </span>\n );\n });\n },\n});\n\nexport type YTextEllipsis = InstanceType<typeof YTextEllipsis>;\n"],"mappings":";AAAA,SAASA,QAAQ,EAAEC,eAAe,EAAEC,GAAG,EAAEC,KAAK,QAAQ,KAAK;AAAC,SAEnDC,SAAS,EAAEC,iBAAiB;AAErC;AAEA,OAAO,MAAMC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iBAAiB,CAACI,KAAK,IAAIS,GAAG,IAAI,IAAI,EAAE;QAC1CX,UAAU,CAACE,KAAK,GACdJ,iBAAiB,CAACI,KAAK,CAACU,WAAW,GACnCd,iBAAiB,CAACI,KAAK,CAACW,WAAW;MACvC;IACF,CAAC,CAAC;IAEFzB,SAAS,CAAC,MAAM;MACd,OAAA0B,YAAA;QAAA,SAEWV,KAAK,CAACF,KAAK;QAAA,SACX,CAAC,iBAAiB,EAAE;UAAEa,UAAU,EAAEf;QAAW,CAAC;MAAC,IAAAc,YAAA;QAAA,OAE3ChB,iBAAiB;QAAA;MAAA,IACzBN,KAAK,CAACC,IAAI,IAEZO,UAAU,CAACE,KAAK,IAAAY,YAAA;QAAA;MAAA,IACuBT,SAAS,CAACH,KAAK,EACtD,EAEAF,UAAU,CAACE,KAAK,IAAAY,YAAA;QAAA;MAAA,IACqBJ,OAAO,CAACR,KAAK,EAClD;IAGP,CAAC,CAAC;EACJ;AACF,CAAC,CAAC"}
@@ -0,0 +1,43 @@
1
+ .y-text-ellipsis {
2
+ display: inline-flex;
3
+ max-width: 100%;
4
+ position: relative;
5
+
6
+ &__origin {
7
+ white-space: nowrap;
8
+ overflow: hidden;
9
+ flex: 0 1 auto;
10
+ }
11
+
12
+ &__start {
13
+ position: absolute;
14
+ left: 0;
15
+ overflow: hidden;
16
+ width: calc(52%);
17
+ white-space: nowrap;
18
+ text-overflow: ellipsis;
19
+ }
20
+
21
+ &__end {
22
+ position: absolute;
23
+ right: 0;
24
+ overflow: hidden;
25
+ width: calc(45% + 1rem);
26
+ white-space: nowrap;
27
+ display: inline-flex;
28
+ justify-content: flex-end;
29
+ mask-image: linear-gradient(
30
+ to right,
31
+ transparent 0%,
32
+ rgb(0, 0, 0) 1rem,
33
+ rgb(0, 0, 0) 100%
34
+ );
35
+ }
36
+
37
+ &.overflowed & {
38
+ &__origin {
39
+ color: transparent;
40
+ user-select: none;
41
+ }
42
+ }
43
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./YTextEllipsis.mjs";
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/components/text-ellipsis/index.ts"],"sourcesContent":["export * from './YTextEllipsis';\r\n"],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuyeon",
3
- "version": "0.1.0-rc.6",
3
+ "version": "0.1.0-rc.7",
4
4
  "keywords": [
5
5
  "UI Library",
6
6
  "Vue"
@@ -30,3 +30,4 @@ export * from './divider';
30
30
  export * from './date-picker';
31
31
  export * from './icon';
32
32
  export * from './badge';
33
+ export * from './text-ellipsis';
@@ -0,0 +1,14 @@
1
+ export declare const YTextEllipsis: import("vue").DefineComponent<{
2
+ text: {
3
+ type: StringConstructor;
4
+ default: string;
5
+ };
6
+ }, void, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
7
+ text: {
8
+ type: StringConstructor;
9
+ default: string;
10
+ };
11
+ }>>, {
12
+ text: string;
13
+ }, {}>;
14
+ export type YTextEllipsis = InstanceType<typeof YTextEllipsis>;
@@ -0,0 +1 @@
1
+ export * from './YTextEllipsis';