@onereach/ui-components 2.74.2 → 2.74.3-beta.2300.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 (28) hide show
  1. package/dist/bundled/v2/{OrText-a665b991.js → OrText-15bf85c4.js} +36 -3
  2. package/dist/bundled/v2/components/index.js +1 -1
  3. package/dist/bundled/v2/components/or-text-v3/OrText.stories3.d.ts +13 -1
  4. package/dist/bundled/v2/components/or-text-v3/OrText.vue.d.ts +27 -2
  5. package/dist/bundled/v2/components/or-text-v3/index.js +1 -1
  6. package/dist/bundled/v2/index.js +2 -2
  7. package/dist/bundled/v3/OrText.vue_vue_type_script_lang-e93438ea.js +93 -0
  8. package/dist/bundled/v3/components/index.js +1 -1
  9. package/dist/bundled/v3/components/or-text-v3/OrText.stories3.d.ts +13 -1
  10. package/dist/bundled/v3/components/or-text-v3/OrText.vue.d.ts +27 -2
  11. package/dist/bundled/v3/components/or-text-v3/index.js +1 -1
  12. package/dist/bundled/v3/index.js +3 -3
  13. package/dist/esm/v2/{OrText-b12d0682.js → OrText-91d662a0.js} +36 -3
  14. package/dist/esm/v2/components/index.js +1 -1
  15. package/dist/esm/v2/components/or-text-v3/OrText.stories3.d.ts +13 -1
  16. package/dist/esm/v2/components/or-text-v3/OrText.vue.d.ts +27 -2
  17. package/dist/esm/v2/components/or-text-v3/index.js +1 -1
  18. package/dist/esm/v2/index.js +1 -1
  19. package/dist/esm/v3/{OrText-6b4f7cd1.js → OrText-a3b00048.js} +36 -3
  20. package/dist/esm/v3/components/index.js +1 -1
  21. package/dist/esm/v3/components/or-text-v3/OrText.stories3.d.ts +13 -1
  22. package/dist/esm/v3/components/or-text-v3/OrText.vue.d.ts +27 -2
  23. package/dist/esm/v3/components/or-text-v3/index.js +1 -1
  24. package/dist/esm/v3/index.js +1 -1
  25. package/package.json +2 -3
  26. package/src/components/or-text-v3/OrText.stories3.ts +81 -5
  27. package/src/components/or-text-v3/OrText.vue +37 -3
  28. package/dist/bundled/v3/OrText.vue_vue_type_script_lang-271fb345.js +0 -60
@@ -18,16 +18,31 @@ const RestText = [
18
18
  // Layout
19
19
  'shrink'];
20
20
 
21
+ /**
22
+ * Use `OrText` component to crop un-wrapped single-line text with ellipsis inside narrow containers.
23
+ * Ellipsis can be placed in the end or in the middle of the text. Convenient for displaying long labels,
24
+ * that have same beginning and differ in the ending part.
25
+ */
21
26
  var script = defineComponent({
22
27
  name: 'OrText',
23
28
  props: {
29
+ /**
30
+ * Text to crop.
31
+ */
24
32
  text: {
25
33
  type: String,
26
34
  required: true
27
35
  },
36
+ /**
37
+ * The index counted from the end of the string where ellipsis will be placed.
38
+ * Defines how many ending characters will remain visible.
39
+ * By default, ellipsis is placed in the end of the line.
40
+ *
41
+ * Note: Negative values behave same as corresponding positives still counting from the end of the line.
42
+ */
28
43
  sliceIndex: {
29
44
  type: Number,
30
- default: undefined
45
+ default: 0
31
46
  }
32
47
  },
33
48
  expose: ['root'],
@@ -38,15 +53,33 @@ var script = defineComponent({
38
53
  const rootStyles = computed(() => ['or-text', ...TextRoot]);
39
54
  const mainTextStyles = computed(() => [...MainText]);
40
55
  const restTextStyles = computed(() => [...RestText]);
56
+ /**
57
+ * Preserves whitespace at the last position as <code>&nbsp;</code>
58
+ * @param str A string to escape
59
+ */
60
+ const escapeLast = str => str && str.slice(0, -1) + '\xa0';
61
+ /**
62
+ * Preserves whitespace at the first position as <code>&nbsp;</code>
63
+ * @param str A string to escape
64
+ */
65
+ const escapeFirst = str => str && '\xa0' + str.slice(1);
41
66
  // State
42
67
  const mainText = computed(() => {
43
68
  if (props.sliceIndex) {
44
- return props.text.slice(0, Math.abs(props.sliceIndex) * -1);
69
+ let mainPart = props.text.slice(0, -Math.abs(props.sliceIndex));
70
+ if (mainPart[mainPart.length - 1] === ' ') {
71
+ mainPart = escapeLast(mainPart);
72
+ }
73
+ return mainPart;
45
74
  }
46
75
  return props.text;
47
76
  });
48
77
  const restText = computed(() => {
49
- return props.text.slice(mainText.value.length);
78
+ let restPart = props.text.slice(mainText.value.length);
79
+ if (restPart[0] === ' ') {
80
+ restPart = escapeFirst(restPart);
81
+ }
82
+ return restPart;
50
83
  });
51
84
  return {
52
85
  root,
@@ -89,7 +89,7 @@ export { _ as OrTag } from '../OrTag-79e48fec.js';
89
89
  export { O as OrTagV3, a as TagColor, T as TagVariant } from '../OrTag-3e442bf6.js';
90
90
  export { O as OrTeleport } from '../OrTeleportVue2-3544f185.js';
91
91
  export { O as OrTeleportV3 } from '../OrTeleport.vue2-e9ba3054.js';
92
- export { _ as OrTextV3 } from '../OrText-a665b991.js';
92
+ export { _ as OrTextV3 } from '../OrText-15bf85c4.js';
93
93
  export { _ as OrTextarea } from '../OrTextarea-71ff236d.js';
94
94
  export { _ as OrTextareaV3 } from '../OrTextarea-1201353b.js';
95
95
  export { _ as OrTextbox, T as TextboxTypes } from '../OrTextbox-eacd9b19.js';
@@ -1,12 +1,24 @@
1
1
  import { Meta, StoryFn } from '@storybook/vue3';
2
+ import OrText from './OrText.vue';
2
3
  declare const _default: Meta<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, {
3
4
  [x: string]: ((...args: any[]) => any) | null;
4
5
  } | string[], {} & {}, {
5
6
  [x: number]: string;
6
7
  } | {}, true>)>;
7
8
  export default _default;
8
- export declare const Text: 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, {
9
+ export declare const Default: 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, {
9
10
  [x: string]: ((...args: any[]) => any) | null;
10
11
  } | string[], {} & {}, {
11
12
  [x: number]: string;
12
13
  } | {}, true>)>;
14
+ export declare const MiddleCrop: 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, {
15
+ [x: string]: ((...args: any[]) => any) | null;
16
+ } | string[], {} & {}, {
17
+ [x: number]: string;
18
+ } | {}, true>)>;
19
+ export declare const TooFarLeft: 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, {
20
+ [x: string]: ((...args: any[]) => any) | null;
21
+ } | string[], {} & {}, {
22
+ [x: number]: string;
23
+ } | {}, true>)>;
24
+ export declare const ComplexContainer: StoryFn<typeof OrText>;
@@ -6,22 +6,42 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
6
6
  mainText: import("@vue/composition-api").ComputedRef<string>;
7
7
  restText: import("@vue/composition-api").ComputedRef<string>;
8
8
  }> & import("@vue/composition-api").Data, {}, {}, {
9
+ /**
10
+ * Text to crop.
11
+ */
9
12
  text: {
10
13
  type: StringConstructor;
11
14
  required: true;
12
15
  };
16
+ /**
17
+ * The index counted from the end of the string where ellipsis will be placed.
18
+ * Defines how many ending characters will remain visible.
19
+ * By default, ellipsis is placed in the end of the line.
20
+ *
21
+ * Note: Negative values behave same as corresponding positives still counting from the end of the line.
22
+ */
13
23
  sliceIndex: {
14
24
  type: NumberConstructor;
15
- default: undefined;
25
+ default: number;
16
26
  };
17
27
  }, import("@vue/composition-api").ExtractPropTypes<{
28
+ /**
29
+ * Text to crop.
30
+ */
18
31
  text: {
19
32
  type: StringConstructor;
20
33
  required: true;
21
34
  };
35
+ /**
36
+ * The index counted from the end of the string where ellipsis will be placed.
37
+ * Defines how many ending characters will remain visible.
38
+ * By default, ellipsis is placed in the end of the line.
39
+ *
40
+ * Note: Negative values behave same as corresponding positives still counting from the end of the line.
41
+ */
22
42
  sliceIndex: {
23
43
  type: NumberConstructor;
24
- default: undefined;
44
+ default: number;
25
45
  };
26
46
  }>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
27
47
  text: string;
@@ -39,4 +59,9 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
39
59
  } & {}, {
40
60
  sliceIndex: number;
41
61
  }, true>);
62
+ /**
63
+ * Use `OrText` component to crop un-wrapped single-line text with ellipsis inside narrow containers.
64
+ * Ellipsis can be placed in the end or in the middle of the text. Convenient for displaying long labels,
65
+ * that have same beginning and differ in the ending part.
66
+ */
42
67
  export default _default;
@@ -1,4 +1,4 @@
1
- export { _ as OrTextV3 } from '../../OrText-a665b991.js';
1
+ export { _ as OrTextV3 } from '../../OrText-15bf85c4.js';
2
2
  import '../../index-fa6eb4ca.js';
3
3
  import 'vue';
4
4
  import '@vue/composition-api/dist/vue-composition-api.mjs';