@onereach/ui-components 2.58.1 → 2.59.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.
- package/dist/v2/OrSkeletonText-950be6a2.js +304 -0
- package/dist/v2/components/index.d.ts +1 -0
- package/dist/v2/components/or-skeleton-v3/OrSkeleton.stories3.d.ts +35 -0
- package/dist/v2/components/or-skeleton-v3/OrSkeletonCircle.stories3.d.ts +22 -0
- package/dist/v2/components/or-skeleton-v3/OrSkeletonCircle.vue.d.ts +51 -0
- package/dist/v2/components/or-skeleton-v3/OrSkeletonRect.stories3.d.ts +32 -0
- package/dist/v2/components/or-skeleton-v3/OrSkeletonRect.vue.d.ts +60 -0
- package/dist/v2/components/or-skeleton-v3/OrSkeletonText.stories3.d.ts +32 -0
- package/dist/v2/components/or-skeleton-v3/OrSkeletonText.vue.d.ts +96 -0
- package/dist/v2/components/or-skeleton-v3/index.d.ts +3 -0
- package/dist/v2/components/or-skeleton-v3/styles.d.ts +6 -0
- package/dist/v2/index.js +1 -0
- package/dist/v2/index2.js +1 -0
- package/dist/v2/index68.js +3 -10
- package/dist/v2/index69.js +3 -6
- package/dist/v2/index70.js +13 -2
- package/dist/v2/index71.js +4 -6
- package/dist/v2/index72.js +6 -4
- package/dist/v2/index73.js +2 -1
- package/dist/v2/index74.js +3 -3
- package/dist/v2/index75.js +3 -4
- package/dist/v2/index76.js +4 -15
- package/dist/v2/index77.js +14 -11
- package/dist/v2/index78.js +11 -13
- package/dist/v2/index79.js +14 -2
- package/dist/v2/index80.js +2 -2
- package/dist/v2/index81.js +2 -3
- package/dist/v2/index82.js +1 -6
- package/dist/v2/index83.js +7 -20
- package/dist/v2/index84.js +12 -9
- package/dist/v2/index85.js +18 -1
- package/dist/v2/index86.js +2 -18
- package/dist/v2/index87.js +18 -2
- package/dist/v2/index88.js +2 -10
- package/dist/v2/index89.js +9 -11
- package/dist/v2/index90.js +12 -6
- package/dist/v2/index91.js +5 -1
- package/dist/v2/index92.js +3 -0
- package/dist/v3/OrSkeletonText-3965ff71.js +235 -0
- package/dist/v3/components/index.d.ts +1 -0
- package/dist/v3/components/or-skeleton-v3/OrSkeleton.stories3.d.ts +35 -0
- package/dist/v3/components/or-skeleton-v3/OrSkeletonCircle.stories3.d.ts +22 -0
- package/dist/v3/components/or-skeleton-v3/OrSkeletonCircle.vue.d.ts +51 -0
- package/dist/v3/components/or-skeleton-v3/OrSkeletonRect.stories3.d.ts +32 -0
- package/dist/v3/components/or-skeleton-v3/OrSkeletonRect.vue.d.ts +60 -0
- package/dist/v3/components/or-skeleton-v3/OrSkeletonText.stories3.d.ts +32 -0
- package/dist/v3/components/or-skeleton-v3/OrSkeletonText.vue.d.ts +96 -0
- package/dist/v3/components/or-skeleton-v3/index.d.ts +3 -0
- package/dist/v3/components/or-skeleton-v3/styles.d.ts +6 -0
- package/dist/v3/index.js +1 -0
- package/dist/v3/index2.js +1 -0
- package/dist/v3/index68.js +3 -9
- package/dist/v3/index69.js +3 -4
- package/dist/v3/index70.js +10 -2
- package/dist/v3/index71.js +3 -5
- package/dist/v3/index72.js +5 -3
- package/dist/v3/index73.js +2 -1
- package/dist/v3/index74.js +3 -3
- package/dist/v3/index75.js +3 -4
- package/dist/v3/index76.js +4 -14
- package/dist/v3/index77.js +13 -10
- package/dist/v3/index78.js +10 -12
- package/dist/v3/index79.js +13 -1
- package/dist/v3/index80.js +1 -1
- package/dist/v3/index81.js +1 -3
- package/dist/v3/index82.js +1 -6
- package/dist/v3/index83.js +6 -16
- package/dist/v3/index84.js +12 -9
- package/dist/v3/index85.js +15 -1
- package/dist/v3/index86.js +2 -17
- package/dist/v3/index87.js +17 -2
- package/dist/v3/index88.js +2 -8
- package/dist/v3/index89.js +6 -9
- package/dist/v3/index90.js +11 -6
- package/dist/v3/index91.js +5 -1
- package/dist/v3/index92.js +3 -0
- package/package.json +3 -3
- package/src/components/index.ts +1 -0
- package/src/components/or-skeleton-v3/OrSkeleton.docs.mdx +6 -0
- package/src/components/or-skeleton-v3/OrSkeleton.stories3.ts +144 -0
- package/src/components/or-skeleton-v3/OrSkeletonCircle.docs.mdx +7 -0
- package/src/components/or-skeleton-v3/OrSkeletonCircle.stories3.ts +59 -0
- package/src/components/or-skeleton-v3/OrSkeletonCircle.vue +74 -0
- package/src/components/or-skeleton-v3/OrSkeletonRect.docs.mdx +6 -0
- package/src/components/or-skeleton-v3/OrSkeletonRect.stories3.ts +80 -0
- package/src/components/or-skeleton-v3/OrSkeletonRect.vue +77 -0
- package/src/components/or-skeleton-v3/OrSkeletonText.docs.mdx +7 -0
- package/src/components/or-skeleton-v3/OrSkeletonText.stories3.ts +88 -0
- package/src/components/or-skeleton-v3/OrSkeletonText.vue +114 -0
- package/src/components/or-skeleton-v3/index.ts +3 -0
- package/src/components/or-skeleton-v3/styles.ts +53 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/vue3';
|
|
2
|
+
import OrSkeletonCircleDocs from './OrSkeletonCircle.docs.mdx';
|
|
3
|
+
import OrSkeletonCircle from './OrSkeletonCircle.vue';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/Skeleton/Circle',
|
|
7
|
+
component: OrSkeletonCircle,
|
|
8
|
+
|
|
9
|
+
argTypes: {
|
|
10
|
+
// Props
|
|
11
|
+
animated: {
|
|
12
|
+
control: { type: 'boolean' },
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
size: {
|
|
16
|
+
control: { type: 'text' },
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
parameters: {
|
|
21
|
+
layout: 'centered',
|
|
22
|
+
|
|
23
|
+
docs: {
|
|
24
|
+
page: OrSkeletonCircleDocs,
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
design: {
|
|
28
|
+
type: 'figma',
|
|
29
|
+
url: 'https://www.figma.com/file/o7DdkaznUW2PtX4wiSuhhQ/Core?node-id=586%3A2974',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
} as Meta<typeof OrSkeletonCircle>;
|
|
33
|
+
|
|
34
|
+
const Template: StoryFn<typeof OrSkeletonCircle> = (args) => ({
|
|
35
|
+
components: {
|
|
36
|
+
OrSkeletonCircle,
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
setup() {
|
|
40
|
+
return { args };
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
template: '<OrSkeletonCircle v-bind="args" />',
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export const Default = Template.bind({});
|
|
47
|
+
Default.args = {};
|
|
48
|
+
|
|
49
|
+
export const NotAnimated = Template.bind({});
|
|
50
|
+
NotAnimated.args = {
|
|
51
|
+
...Default.args,
|
|
52
|
+
animated: false,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const WithSize = Template.bind({});
|
|
56
|
+
WithSize.args = {
|
|
57
|
+
...Default.args,
|
|
58
|
+
size: 64,
|
|
59
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="root"
|
|
4
|
+
v-bind="$attrs"
|
|
5
|
+
:class="rootStyles"
|
|
6
|
+
:style="rootStyle"
|
|
7
|
+
/>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { computed, defineComponent, ref } from 'vue-demi';
|
|
12
|
+
import _ from 'lodash';
|
|
13
|
+
import { pxToRem } from '../../utils/functions/px-to-rem';
|
|
14
|
+
import { useClassAttribute } from '../../hooks';
|
|
15
|
+
import { SkeletonAnimated, SkeletonCircle, SkeletonRoot } from './styles';
|
|
16
|
+
|
|
17
|
+
export default defineComponent({
|
|
18
|
+
name: 'OrSkeletonCircle',
|
|
19
|
+
|
|
20
|
+
inheritAttrs: false,
|
|
21
|
+
|
|
22
|
+
props: {
|
|
23
|
+
animated: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
required: false,
|
|
26
|
+
default: true,
|
|
27
|
+
},
|
|
28
|
+
size: {
|
|
29
|
+
type: [Number, String],
|
|
30
|
+
required: false,
|
|
31
|
+
default: 40,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
expose: [
|
|
36
|
+
'root',
|
|
37
|
+
],
|
|
38
|
+
|
|
39
|
+
setup(props) {
|
|
40
|
+
// Refs
|
|
41
|
+
const root = ref<HTMLElement>();
|
|
42
|
+
|
|
43
|
+
// Styles
|
|
44
|
+
const classAttribute = useClassAttribute();
|
|
45
|
+
|
|
46
|
+
const rootStyles = computed(() => [
|
|
47
|
+
'or-skeleton',
|
|
48
|
+
'or-skeleton-circle',
|
|
49
|
+
...SkeletonRoot,
|
|
50
|
+
...SkeletonCircle,
|
|
51
|
+
...(props.animated ? SkeletonAnimated : []),
|
|
52
|
+
classAttribute.value,
|
|
53
|
+
]);
|
|
54
|
+
|
|
55
|
+
const rootStyle = computed(() => {
|
|
56
|
+
const size = props.size ?? 40; // 40px - medium OrAvatar
|
|
57
|
+
const sizeStyle = _.isNumber(size) ? pxToRem(size) : size;
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
'width': sizeStyle,
|
|
61
|
+
'min-width': sizeStyle,
|
|
62
|
+
'height': sizeStyle,
|
|
63
|
+
'min-height': sizeStyle,
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
root,
|
|
69
|
+
rootStyles,
|
|
70
|
+
rootStyle,
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
</script>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/vue3';
|
|
2
|
+
import OrSkeletonRectDocs from './OrSkeletonRect.docs.mdx';
|
|
3
|
+
import OrSkeletonRect from './OrSkeletonRect.vue';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/Skeleton/Rect',
|
|
7
|
+
component: OrSkeletonRect,
|
|
8
|
+
|
|
9
|
+
argTypes: {
|
|
10
|
+
// Props
|
|
11
|
+
animated: {
|
|
12
|
+
control: { type: 'boolean' },
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
width: {
|
|
16
|
+
control: { type: 'text' },
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
height: {
|
|
20
|
+
control: { type: 'text' },
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
parameters: {
|
|
25
|
+
layout: 'centered',
|
|
26
|
+
|
|
27
|
+
docs: {
|
|
28
|
+
page: OrSkeletonRectDocs,
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
design: {
|
|
32
|
+
type: 'figma',
|
|
33
|
+
url: 'https://www.figma.com/file/o7DdkaznUW2PtX4wiSuhhQ/Core?node-id=586%3A2974',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
} as Meta<typeof OrSkeletonRect>;
|
|
37
|
+
|
|
38
|
+
const Template: StoryFn<typeof OrSkeletonRect> = (args) => ({
|
|
39
|
+
components: {
|
|
40
|
+
OrSkeletonRect,
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
setup() {
|
|
44
|
+
return { args };
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
template: `
|
|
48
|
+
<div style="min-width: 480px">
|
|
49
|
+
<OrSkeletonRect v-bind="args" />
|
|
50
|
+
</div>
|
|
51
|
+
`,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export const Default = Template.bind({});
|
|
55
|
+
Default.args = {};
|
|
56
|
+
|
|
57
|
+
export const NotAnimated = Template.bind({});
|
|
58
|
+
NotAnimated.args = {
|
|
59
|
+
...Default.args,
|
|
60
|
+
animated: false,
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const WithWidth = Template.bind({});
|
|
64
|
+
WithWidth.args = {
|
|
65
|
+
...Default.args,
|
|
66
|
+
width: 256,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const WithHeight = Template.bind({});
|
|
70
|
+
WithHeight.args = {
|
|
71
|
+
...Default.args,
|
|
72
|
+
height: 64,
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const WithWidthAndHeight = Template.bind({});
|
|
76
|
+
WithWidthAndHeight.args = {
|
|
77
|
+
...Default.args,
|
|
78
|
+
width: 128,
|
|
79
|
+
height: 32,
|
|
80
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="root"
|
|
4
|
+
v-bind="$attrs"
|
|
5
|
+
:class="rootStyles"
|
|
6
|
+
:style="rootStyle"
|
|
7
|
+
/>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { computed, defineComponent, ref } from 'vue-demi';
|
|
12
|
+
import _ from 'lodash';
|
|
13
|
+
import { pxToRem } from '../../utils/functions/px-to-rem';
|
|
14
|
+
import { useClassAttribute } from '../../hooks';
|
|
15
|
+
import { SkeletonAnimated, SkeletonRect, SkeletonRoot } from './styles';
|
|
16
|
+
|
|
17
|
+
export default defineComponent({
|
|
18
|
+
name: 'OrSkeletonRect',
|
|
19
|
+
|
|
20
|
+
inheritAttrs: false,
|
|
21
|
+
|
|
22
|
+
props: {
|
|
23
|
+
animated: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
required: false,
|
|
26
|
+
default: true,
|
|
27
|
+
},
|
|
28
|
+
width: {
|
|
29
|
+
type: [Number, String],
|
|
30
|
+
required: false,
|
|
31
|
+
default: '100%',
|
|
32
|
+
},
|
|
33
|
+
height: {
|
|
34
|
+
type: [Number, String],
|
|
35
|
+
required: false,
|
|
36
|
+
default: 36,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
expose: [
|
|
41
|
+
'root',
|
|
42
|
+
],
|
|
43
|
+
|
|
44
|
+
setup(props) {
|
|
45
|
+
// Refs
|
|
46
|
+
const root = ref<HTMLElement>();
|
|
47
|
+
|
|
48
|
+
// Styles
|
|
49
|
+
const classAttribute = useClassAttribute();
|
|
50
|
+
|
|
51
|
+
const rootStyles = computed(() => [
|
|
52
|
+
'or-skeleton',
|
|
53
|
+
'or-skeleton-rect',
|
|
54
|
+
...SkeletonRoot,
|
|
55
|
+
...SkeletonRect,
|
|
56
|
+
...(props.animated ? SkeletonAnimated : []),
|
|
57
|
+
classAttribute.value,
|
|
58
|
+
]);
|
|
59
|
+
|
|
60
|
+
const rootStyle = computed(() => {
|
|
61
|
+
const width = props.width ?? '100%';
|
|
62
|
+
const height = props.height ?? 36; // 36px - default OrInput height
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
'width': _.isNumber(width) ? pxToRem(width) : width,
|
|
66
|
+
'height': _.isNumber(height) ? pxToRem(height) : height,
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
root,
|
|
72
|
+
rootStyles,
|
|
73
|
+
rootStyle,
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
</script>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/vue3';
|
|
2
|
+
import OrSkeletonTextDocs from './OrSkeletonText.docs.mdx';
|
|
3
|
+
import OrSkeletonText from './OrSkeletonText.vue';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/Skeleton/Text',
|
|
7
|
+
component: OrSkeletonText,
|
|
8
|
+
|
|
9
|
+
argTypes: {
|
|
10
|
+
// Props
|
|
11
|
+
animated: {
|
|
12
|
+
control: { type: 'boolean' },
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
width: {
|
|
16
|
+
control: { type: 'text' },
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
linesCount: {
|
|
20
|
+
control: { type: 'number' },
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
fontSize: {
|
|
24
|
+
control: { type: 'number' },
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
lineHeight: {
|
|
28
|
+
control: { type: 'number' },
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
parameters: {
|
|
33
|
+
layout: 'centered',
|
|
34
|
+
|
|
35
|
+
docs: {
|
|
36
|
+
page: OrSkeletonTextDocs,
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
design: {
|
|
40
|
+
type: 'figma',
|
|
41
|
+
url: 'https://www.figma.com/file/o7DdkaznUW2PtX4wiSuhhQ/Core?node-id=586%3A2974',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
} as Meta<typeof OrSkeletonText>;
|
|
45
|
+
|
|
46
|
+
const Template: StoryFn<typeof OrSkeletonText> = (args) => ({
|
|
47
|
+
components: {
|
|
48
|
+
OrSkeletonText,
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
setup() {
|
|
52
|
+
return { args };
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
template: `
|
|
56
|
+
<div style="min-width: 480px">
|
|
57
|
+
<OrSkeletonText v-bind="args" />
|
|
58
|
+
</div>
|
|
59
|
+
`,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export const Default = Template.bind({});
|
|
63
|
+
Default.args = {};
|
|
64
|
+
|
|
65
|
+
export const NotAnimated = Template.bind({});
|
|
66
|
+
NotAnimated.args = {
|
|
67
|
+
...Default.args,
|
|
68
|
+
animated: false,
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const WithWidth = Template.bind({});
|
|
72
|
+
WithWidth.args = {
|
|
73
|
+
...Default.args,
|
|
74
|
+
width: 256,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const WithSize = Template.bind({});
|
|
78
|
+
WithSize.args = {
|
|
79
|
+
...Default.args,
|
|
80
|
+
fontSize: 24,
|
|
81
|
+
lineHeight: 28.64,
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export const WithLinesCount = Template.bind({});
|
|
85
|
+
WithLinesCount.args = {
|
|
86
|
+
...Default.args,
|
|
87
|
+
linesCount: 5,
|
|
88
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="root"
|
|
4
|
+
v-bind="$attrs"
|
|
5
|
+
:class="containerStyles"
|
|
6
|
+
:style="containerStyle"
|
|
7
|
+
>
|
|
8
|
+
<div
|
|
9
|
+
v-for="key in lineKeys"
|
|
10
|
+
:key="key"
|
|
11
|
+
:class="rowStyles"
|
|
12
|
+
:style="rowStyle"
|
|
13
|
+
/>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script lang="ts">
|
|
18
|
+
import { computed, defineComponent, ref } from 'vue-demi';
|
|
19
|
+
import _ from 'lodash';
|
|
20
|
+
import { pxToRem } from '../../utils/functions/px-to-rem';
|
|
21
|
+
import { useClassAttribute } from '../../hooks';
|
|
22
|
+
import { SkeletonAnimated, SkeletonRoot, SkeletonText, SkeletonTextContainerRoot } from './styles';
|
|
23
|
+
|
|
24
|
+
export default defineComponent({
|
|
25
|
+
name: 'OrSkeletonText',
|
|
26
|
+
|
|
27
|
+
inheritAttrs: false,
|
|
28
|
+
|
|
29
|
+
props: {
|
|
30
|
+
animated: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
required: false,
|
|
33
|
+
default: true,
|
|
34
|
+
},
|
|
35
|
+
linesCount: {
|
|
36
|
+
type: Number,
|
|
37
|
+
required: false,
|
|
38
|
+
default: 1,
|
|
39
|
+
},
|
|
40
|
+
width: {
|
|
41
|
+
type: [Number, String],
|
|
42
|
+
required: false,
|
|
43
|
+
default: '100%',
|
|
44
|
+
},
|
|
45
|
+
fontSize: {
|
|
46
|
+
type: Number,
|
|
47
|
+
required: false,
|
|
48
|
+
default: 16,
|
|
49
|
+
},
|
|
50
|
+
lineHeight: {
|
|
51
|
+
type: Number,
|
|
52
|
+
required: false,
|
|
53
|
+
default: 24,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
expose: [
|
|
58
|
+
'root',
|
|
59
|
+
],
|
|
60
|
+
|
|
61
|
+
setup(props) {
|
|
62
|
+
// Refs
|
|
63
|
+
const root = ref<HTMLElement>();
|
|
64
|
+
|
|
65
|
+
// Styles
|
|
66
|
+
const classAttribute = useClassAttribute();
|
|
67
|
+
|
|
68
|
+
const containerStyles = computed(() => [
|
|
69
|
+
'or-skeleton-text-root',
|
|
70
|
+
...SkeletonTextContainerRoot,
|
|
71
|
+
classAttribute.value,
|
|
72
|
+
]);
|
|
73
|
+
|
|
74
|
+
const containerStyle = computed(() => {
|
|
75
|
+
const width = props.width ?? '100%';
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
'width': _.isNumber(width) ? pxToRem(width) : width,
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const rowStyles = computed(() => [
|
|
83
|
+
'or-skeleton',
|
|
84
|
+
'or-skeleton-text',
|
|
85
|
+
...SkeletonRoot,
|
|
86
|
+
...SkeletonText,
|
|
87
|
+
...(props.animated ? SkeletonAnimated : []),
|
|
88
|
+
classAttribute.value,
|
|
89
|
+
]);
|
|
90
|
+
|
|
91
|
+
const rowStyle = computed(() => {
|
|
92
|
+
const height = props.fontSize ?? 16;
|
|
93
|
+
const margin = ((props.lineHeight ?? 24) - height) / 2;
|
|
94
|
+
|
|
95
|
+
return {
|
|
96
|
+
'height': _.isNumber(height) ? pxToRem(height) : height,
|
|
97
|
+
'margin': `${_.isNumber(margin) ? pxToRem(margin) : margin} 0`,
|
|
98
|
+
};
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// State
|
|
102
|
+
const lineKeys = computed(() => _.range(props.linesCount));
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
root,
|
|
106
|
+
containerStyles,
|
|
107
|
+
containerStyle,
|
|
108
|
+
rowStyles,
|
|
109
|
+
rowStyle,
|
|
110
|
+
lineKeys,
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
</script>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export const SkeletonRoot: string[] = [
|
|
2
|
+
// Position
|
|
3
|
+
'relative',
|
|
4
|
+
|
|
5
|
+
// Layout
|
|
6
|
+
'overflow-hidden',
|
|
7
|
+
|
|
8
|
+
// Box
|
|
9
|
+
'p-0',
|
|
10
|
+
|
|
11
|
+
// Borders
|
|
12
|
+
'border-0',
|
|
13
|
+
|
|
14
|
+
// Theme
|
|
15
|
+
'bg-skeletons-gradient',
|
|
16
|
+
'dark:bg-skeletons-gradient-dark',
|
|
17
|
+
|
|
18
|
+
// Background
|
|
19
|
+
'bg-repeat',
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
export const SkeletonTextContainerRoot: string[] = [
|
|
23
|
+
// Layout
|
|
24
|
+
'flex',
|
|
25
|
+
'flex-col',
|
|
26
|
+
|
|
27
|
+
// Box
|
|
28
|
+
'h-auto',
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
export const SkeletonCircle: string[] = [
|
|
32
|
+
// Box
|
|
33
|
+
'rounded-full',
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
export const SkeletonRect: string[] = [
|
|
37
|
+
// Box
|
|
38
|
+
'rounded-md',
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
export const SkeletonText: string[] = [
|
|
42
|
+
// Box
|
|
43
|
+
'w-full',
|
|
44
|
+
'rounded-md',
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
export const SkeletonAnimated: string[] = [
|
|
48
|
+
// Background
|
|
49
|
+
'bg-[length:200%]',
|
|
50
|
+
|
|
51
|
+
// Animation
|
|
52
|
+
'animate-skeleton-loader',
|
|
53
|
+
];
|