@onereach/ui-components 2.68.1 → 2.69.0-beta.2073.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 (37) hide show
  1. package/dist/bundled/v2/components/or-empty-state-v3/OrEmptyState.stories3.d.ts +24 -0
  2. package/dist/bundled/v2/components/or-empty-state-v3/OrEmptyState.vue.d.ts +101 -0
  3. package/dist/bundled/v2/components/or-empty-state-v3/index.d.ts +3 -0
  4. package/dist/bundled/v2/components/or-empty-state-v3/index.js +162 -0
  5. package/dist/bundled/v2/components/or-empty-state-v3/props.d.ts +4 -0
  6. package/dist/bundled/v2/components/or-empty-state-v3/styles.d.ts +10 -0
  7. package/dist/bundled/v2/components/or-empty-state-v3/types.d.ts +2 -0
  8. package/dist/bundled/v2/index.js +1 -1
  9. package/dist/bundled/v3/components/or-empty-state-v3/OrEmptyState.stories3.d.ts +24 -0
  10. package/dist/bundled/v3/components/or-empty-state-v3/OrEmptyState.vue.d.ts +101 -0
  11. package/dist/bundled/v3/components/or-empty-state-v3/index.d.ts +3 -0
  12. package/dist/bundled/v3/components/or-empty-state-v3/index.js +134 -0
  13. package/dist/bundled/v3/components/or-empty-state-v3/props.d.ts +4 -0
  14. package/dist/bundled/v3/components/or-empty-state-v3/styles.d.ts +10 -0
  15. package/dist/bundled/v3/components/or-empty-state-v3/types.d.ts +2 -0
  16. package/dist/bundled/v3/index.js +1 -1
  17. package/dist/esm/v2/components/or-empty-state-v3/OrEmptyState.stories3.d.ts +24 -0
  18. package/dist/esm/v2/components/or-empty-state-v3/OrEmptyState.vue.d.ts +101 -0
  19. package/dist/esm/v2/components/or-empty-state-v3/index.d.ts +3 -0
  20. package/dist/esm/v2/components/or-empty-state-v3/index.js +159 -0
  21. package/dist/esm/v2/components/or-empty-state-v3/props.d.ts +4 -0
  22. package/dist/esm/v2/components/or-empty-state-v3/styles.d.ts +10 -0
  23. package/dist/esm/v2/components/or-empty-state-v3/types.d.ts +2 -0
  24. package/dist/esm/v3/components/or-empty-state-v3/OrEmptyState.stories3.d.ts +24 -0
  25. package/dist/esm/v3/components/or-empty-state-v3/OrEmptyState.vue.d.ts +101 -0
  26. package/dist/esm/v3/components/or-empty-state-v3/index.d.ts +3 -0
  27. package/dist/esm/v3/components/or-empty-state-v3/index.js +135 -0
  28. package/dist/esm/v3/components/or-empty-state-v3/props.d.ts +4 -0
  29. package/dist/esm/v3/components/or-empty-state-v3/styles.d.ts +10 -0
  30. package/dist/esm/v3/components/or-empty-state-v3/types.d.ts +2 -0
  31. package/package.json +2 -3
  32. package/src/components/or-empty-state-v3/OrEmptyState.stories3.ts +87 -0
  33. package/src/components/or-empty-state-v3/OrEmptyState.vue +121 -0
  34. package/src/components/or-empty-state-v3/index.ts +3 -0
  35. package/src/components/or-empty-state-v3/props.ts +4 -0
  36. package/src/components/or-empty-state-v3/styles.ts +76 -0
  37. package/src/components/or-empty-state-v3/types.ts +3 -0
@@ -0,0 +1,87 @@
1
+ import { Meta, StoryFn } from '@storybook/vue3';
2
+ import OrEmptyState from './OrEmptyState.vue';
3
+ import successPng from '../../assets/success.png';
4
+ import { EmptyStateSize } from './props';
5
+
6
+ export default {
7
+ title: 'Components/Empty State',
8
+ component: OrEmptyState,
9
+ argTypes: {
10
+ size: {
11
+ control: {
12
+ type: 'inline-radio',
13
+ labels: {
14
+ [EmptyStateSize.M]: 'Medium',
15
+ [EmptyStateSize.L]: 'Large',
16
+ },
17
+ },
18
+ options: Object.values(EmptyStateSize),
19
+ },
20
+ },
21
+ parameters: {
22
+ layout: 'centered',
23
+ },
24
+ } as Meta<typeof OrEmptyState>
25
+
26
+ const Template: StoryFn<typeof OrEmptyState> = (args) => ({
27
+ components: { OrEmptyState },
28
+ setup() {
29
+ return { args };
30
+ },
31
+ template: `
32
+ <OrEmptyState v-bind="args"/>
33
+ `,
34
+ });
35
+
36
+ export const Default = Template.bind({});
37
+ Default.args = {
38
+ heading: 'No aliens detected',
39
+ text: 'Invite some aliens to your planet.'
40
+ };
41
+ Default.parameters = {
42
+ layout: 'fullscreen',
43
+ };
44
+ Default.decorators = [
45
+ () => ({
46
+ template: `
47
+ <div class="
48
+ demo-wrapper w-full min-h-[200px] h-screen box-border relative
49
+ gap-sm p-md bg-surface-variant
50
+ flex flex-col
51
+ text-body-2-regular">
52
+ <div>
53
+ Note: This frame is added for demo purpose.<br>
54
+ The OrEmptyState component is transparent and has <code>width:100%</code> and <code>flex-grow:1</code> attributes.<br>
55
+ It is recommended to put it inside a column flex container or a row flex container that wraps.
56
+ </div>
57
+ <div class="demo-container grow bg-background dark:bg-background-dark flex flex-col"><story /></div>
58
+ </div>
59
+ `
60
+ })
61
+ ];
62
+
63
+ export const ImageIcon = Template.bind({});
64
+ ImageIcon.args = {
65
+ heading: 'Planet populated',
66
+ text: 'So many aliens on this planet!',
67
+ imageSrc: successPng,
68
+ };
69
+
70
+ export const LargeSize = Template.bind({});
71
+ LargeSize.args = {
72
+ ...ImageIcon.args,
73
+ size: EmptyStateSize.L,
74
+ };
75
+
76
+ export const ExtraContentInSlot: StoryFn<typeof OrEmptyState> = (args) => ({
77
+ components: { OrEmptyState },
78
+ setup() {
79
+ return { args };
80
+ },
81
+ template: `
82
+ <OrEmptyState v-bind="args" heading="Alien not found" text="Pass formatted content via a default slot.">
83
+ Alien named <b>Garry</b> not found.<br>
84
+ The text in the slot is by default formatted as a component's text prop.
85
+ </OrEmptyState>
86
+ `,
87
+ });
@@ -0,0 +1,121 @@
1
+ <template>
2
+ <div
3
+ class="static"
4
+ :class="rootClasses">
5
+ <img v-if="imageSrc"
6
+ :src="imageSrc"
7
+ :class="imageClasses"
8
+ alt="">
9
+ <div :class="headingClasses">
10
+ {{ heading }}
11
+ </div>
12
+ <div v-if="$slots.default" :class="slotClasses">
13
+ <!-- @slot Additional content can be inserted via default slot. The slot uses the same font as a `text` prop. -->
14
+ <slot/>
15
+ </div>
16
+ <div :class="textClasses">
17
+ {{ text }}
18
+ </div>
19
+ </div>
20
+ </template>
21
+
22
+ <script lang="ts">
23
+ import { defineComponent, PropType } from 'vue-demi';
24
+ import { EmptyStateSize } from '.';
25
+ import {
26
+ EmptyStateContent,
27
+ EmptyStateContentSizes,
28
+ EmptyStateHeading,
29
+ EmptyStateHeadingSizes,
30
+ EmptyStateImage,
31
+ EmptyStateImageSizes,
32
+ EmptyStateRoot,
33
+ EmptyStateText,
34
+ EmptyStateTextSizes
35
+ } from './styles';
36
+
37
+ /**
38
+ * The component to display when there is no content on a page,
39
+ * no records found or selected, or while the data is being loaded.
40
+ * Provides a hint to the user on what to do.
41
+ * Consists of text message, optional icon and optional loader.
42
+ */
43
+ export default defineComponent({
44
+ name: 'OrEmptyState',
45
+ props: {
46
+ /**
47
+ * Size of the component, affects font and icon size.
48
+ * Use Large if the component takes all screen space,
49
+ * and Medium if it is a part of the complex layout.
50
+ */
51
+ size: {
52
+ type: String as PropType<EmptyStateSize>,
53
+ default: EmptyStateSize.M,
54
+ },
55
+ /**
56
+ * The heading of the empty state block.
57
+ */
58
+ heading: {
59
+ type: String,
60
+ default: '',
61
+ },
62
+ /**
63
+ * Additional text such as a hint for a user with proposed next steps.
64
+ */
65
+ text: {
66
+ type: String,
67
+ default: '',
68
+ },
69
+ /**
70
+ * Path to the image to display above the heading.
71
+ * Image height is fixed depending on `size` prop, width is undefined to preserve aspect ratio.
72
+ */
73
+ imageSrc: {
74
+ type: String,
75
+ default: undefined,
76
+ },
77
+ },
78
+ computed: {
79
+ rootClasses(): string[] {
80
+ return [
81
+ 'or-empty-state',
82
+ ...EmptyStateRoot,
83
+ ];
84
+ },
85
+ imageClasses(): string[] {
86
+ return [
87
+ 'or-empty-state_image',
88
+ ...EmptyStateImage,
89
+ ...EmptyStateImageSizes[this.size],
90
+
91
+ ];
92
+ },
93
+ headingClasses(): string[] {
94
+ return [
95
+ 'or-empty-state_heading',
96
+ ...EmptyStateHeading,
97
+ ...EmptyStateHeadingSizes[this.size],
98
+
99
+ ];
100
+ },
101
+ textClasses(): string[] {
102
+ return [
103
+ 'or-empty-state_text',
104
+ ...EmptyStateText,
105
+ ...EmptyStateTextSizes[this.size],
106
+
107
+ ];
108
+ },
109
+ slotClasses(): string[] {
110
+ return [
111
+ 'or-empty-state_content',
112
+ ...EmptyStateContent,
113
+ ...EmptyStateContentSizes[this.size],
114
+ ];
115
+ },
116
+ },
117
+ });
118
+ </script>
119
+
120
+ <style scoped>
121
+ </style>
@@ -0,0 +1,3 @@
1
+ export { default as OrEmptyStateV3 } from './OrEmptyState.vue';
2
+ export * from './types';
3
+ export * from './props';
@@ -0,0 +1,4 @@
1
+ export enum EmptyStateSize {
2
+ L = 'l',
3
+ M = 'm',
4
+ }
@@ -0,0 +1,76 @@
1
+ import { EmptyStateSize } from './props';
2
+
3
+ export const EmptyStateRoot: string[] = [
4
+ // Layout
5
+ 'grow',
6
+ 'flex',
7
+ 'flex-col',
8
+ 'justify-center',
9
+ 'items-center',
10
+
11
+ // Box
12
+ 'w-full',
13
+
14
+ // Sizing
15
+ 'gap-sm',
16
+ ];
17
+
18
+ export const EmptyStateImage = [
19
+ // Sizing
20
+ 'mb-sm',
21
+ ];
22
+
23
+ export const EmptyStateImageSizes: Record<EmptyStateSize, string[]> = {
24
+ [EmptyStateSize.L]: [
25
+ // Box
26
+ 'h-3xl',
27
+ ],
28
+ [EmptyStateSize.M]: [
29
+ // Box
30
+ 'h-2xl',
31
+ ],
32
+ }
33
+
34
+ export const EmptyStateHeading: string[] = [
35
+ // Theme
36
+ 'text-on-background',
37
+ 'dark:text-on-background-dark'
38
+ ];
39
+
40
+ export const EmptyStateHeadingSizes: Record<EmptyStateSize, string[]> = {
41
+ [EmptyStateSize.L]: [
42
+ // Typography
43
+ 'text-headline-2',
44
+ 'font-headline-2',
45
+ ],
46
+ [EmptyStateSize.M]: [
47
+ // Typography
48
+ 'text-headline-4',
49
+ 'font-headline-4',
50
+ ],
51
+ }
52
+
53
+ export const EmptyStateText: string[] = [
54
+ 'text-center',
55
+
56
+ // Theme
57
+ 'text-outline',
58
+ 'dark:text-outline-dark',
59
+ ];
60
+
61
+ export const EmptyStateContent = EmptyStateText;
62
+
63
+ export const EmptyStateTextSizes: Record<EmptyStateSize, string[]> = {
64
+ [EmptyStateSize.L]: [
65
+ // Typography
66
+ 'text-body-2-regular',
67
+ 'font-body-2-regular',
68
+ ],
69
+ [EmptyStateSize.M]: [
70
+ // Typography
71
+ 'text-caption-regular',
72
+ 'font-caption-regular',
73
+ ],
74
+ };
75
+
76
+ export const EmptyStateContentSizes = EmptyStateTextSizes;
@@ -0,0 +1,3 @@
1
+ import { LoaderVariant } from '../or-loader-v3';
2
+
3
+ export type EmptyStateLoader = boolean | LoaderVariant | undefined;