@rocketui/vue 0.0.47 → 0.0.49

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 (169) hide show
  1. package/dist/rocket-ui-vue.cjs.js +1 -0
  2. package/dist/rocket-ui-vue.d.ts +1812 -0
  3. package/dist/rocket-ui-vue.es.js +9270 -0
  4. package/dist/rocket-ui-vue.umd.js +1 -0
  5. package/dist/style.css +2 -0
  6. package/package.json +7 -1
  7. package/.eslintrc.cjs +0 -79
  8. package/.gitattributes +0 -2
  9. package/.github/workflows/chromatic.yml +0 -28
  10. package/.github/workflows/publish-storybook.yml +0 -41
  11. package/.husky/pre-commit +0 -4
  12. package/.prettierrc.cjs +0 -10
  13. package/.storybook/Theme.js +0 -17
  14. package/.storybook/main.ts +0 -20
  15. package/.storybook/manager-head.html +0 -3
  16. package/.storybook/manager.js +0 -8
  17. package/.storybook/preview-head.html +0 -3
  18. package/.storybook/preview.ts +0 -36
  19. package/.storybook/source-panel/manager.js +0 -28
  20. package/.storybook/withSource.js +0 -91
  21. package/.vscode/extensions.json +0 -11
  22. package/.vscode/settings.json +0 -20
  23. package/index.html +0 -13
  24. package/lib/main.ts +0 -48
  25. package/postcss.config.cjs +0 -9
  26. package/resources/rocket-ui-logo-dark.svg +0 -27
  27. package/resources/rocket-ui-logo-light.svg +0 -27
  28. package/shims-rocketui.d.ts +0 -9
  29. package/src/App.vue +0 -15
  30. package/src/assets/blank-avatar.svg +0 -3
  31. package/src/assets/icons/mdi.js +0 -7302
  32. package/src/assets/logo.svg +0 -1
  33. package/src/components/Accordion/Accordion.mdx +0 -88
  34. package/src/components/Accordion/Accordion.stories.ts +0 -257
  35. package/src/components/Accordion/RAccordion.vue +0 -73
  36. package/src/components/Accordion/accordion.css +0 -75
  37. package/src/components/Accordion/accordion.spec.ts +0 -123
  38. package/src/components/Alert/Alert.mdx +0 -120
  39. package/src/components/Alert/Alert.stories.ts +0 -118
  40. package/src/components/Alert/RAlert.vue +0 -119
  41. package/src/components/Alert/alert.css +0 -136
  42. package/src/components/Alert/alert.spec.ts +0 -32
  43. package/src/components/Avatar/Avatar.mdx +0 -96
  44. package/src/components/Avatar/Avatar.stories.ts +0 -65
  45. package/src/components/Avatar/RAvatar.vue +0 -115
  46. package/src/components/Avatar/avatar.css +0 -82
  47. package/src/components/Avatar/avatar.spec.ts +0 -38
  48. package/src/components/Badge/Badge.mdx +0 -112
  49. package/src/components/Badge/Badge.stories.ts +0 -99
  50. package/src/components/Badge/RBadge.vue +0 -89
  51. package/src/components/Badge/badge.css +0 -63
  52. package/src/components/Badge/badge.spec.ts +0 -20
  53. package/src/components/Box/Box.mdx +0 -20
  54. package/src/components/Box/Box.stories.ts +0 -56
  55. package/src/components/Box/RBox.vue +0 -97
  56. package/src/components/Breadcrumb/Breadcrumb.stories.ts +0 -115
  57. package/src/components/Breadcrumb/RBreadcrumb.vue +0 -43
  58. package/src/components/Breadcrumb/breadcrumb.css +0 -29
  59. package/src/components/Button/Button.mdx +0 -148
  60. package/src/components/Button/Button.spec.ts +0 -29
  61. package/src/components/Button/Button.stories.ts +0 -118
  62. package/src/components/Button/RButton.vue +0 -179
  63. package/src/components/Button/button.css +0 -146
  64. package/src/components/Checkbox/Checkbox.mdx +0 -100
  65. package/src/components/Checkbox/Checkbox.stories.ts +0 -67
  66. package/src/components/Checkbox/RCheckbox.vue +0 -195
  67. package/src/components/Checkbox/checkbox.css +0 -67
  68. package/src/components/Checkbox/checkbox.spec.ts +0 -60
  69. package/src/components/Chips/Chip.mdx +0 -113
  70. package/src/components/Chips/Chip.stories.ts +0 -122
  71. package/src/components/Chips/RChip.vue +0 -125
  72. package/src/components/Chips/chip.css +0 -62
  73. package/src/components/Chips/chip.spec.ts +0 -40
  74. package/src/components/Dropdown/Dropdown.mdx +0 -135
  75. package/src/components/Dropdown/Dropdown.stories.ts +0 -84
  76. package/src/components/Dropdown/RDropdown.vue +0 -392
  77. package/src/components/Dropdown/dropdown.css +0 -113
  78. package/src/components/Dropdown/dropdown.spec.ts +0 -98
  79. package/src/components/Flex/Flex.mdx +0 -20
  80. package/src/components/Flex/Flex.stories.js +0 -127
  81. package/src/components/Flex/RFlex.vue +0 -91
  82. package/src/components/Grid/Grid.mdx +0 -20
  83. package/src/components/Grid/Grid.stories.js +0 -107
  84. package/src/components/Grid/RGrid.vue +0 -138
  85. package/src/components/Icon/Icon.mdx +0 -68
  86. package/src/components/Icon/Icon.stories.ts +0 -33
  87. package/src/components/Icon/RIcon.vue +0 -56
  88. package/src/components/Icon/icon.spec.ts +0 -25
  89. package/src/components/ItemGroup/ItemGroup.stories.ts +0 -91
  90. package/src/components/ItemGroup/RItem.vue +0 -74
  91. package/src/components/ItemGroup/RItemGroup.vue +0 -122
  92. package/src/components/ItemGroup/__snapshots__/itemgroup.spec.ts.snap +0 -13
  93. package/src/components/ItemGroup/itemgroup.spec.ts +0 -67
  94. package/src/components/Label/Label.mdx +0 -50
  95. package/src/components/Label/Label.stories.ts +0 -38
  96. package/src/components/Label/RLabel.vue +0 -42
  97. package/src/components/Label/label.css +0 -0
  98. package/src/components/Modal/Modal.mdx +0 -91
  99. package/src/components/Modal/Modal.stories.ts +0 -125
  100. package/src/components/Modal/RModal.vue +0 -130
  101. package/src/components/Modal/modal.css +0 -41
  102. package/src/components/Modal/modal.spec.ts +0 -25
  103. package/src/components/Pagination/Pagination.stories.ts +0 -24
  104. package/src/components/Pagination/RPagination.vue +0 -103
  105. package/src/components/Pagination/pagination.css +0 -47
  106. package/src/components/Pagination/pagination.spec.ts +0 -17
  107. package/src/components/ProgressBar/ProgressBar.stories.ts +0 -34
  108. package/src/components/ProgressBar/RProgressBar.vue +0 -21
  109. package/src/components/ProgressBar/progressbar.css +0 -24
  110. package/src/components/ProgressBar/progressbar.spec.ts +0 -17
  111. package/src/components/Shared/Enums.ts +0 -1
  112. package/src/components/Sidebar/RSidebar.vue +0 -27
  113. package/src/components/Sidebar/Sidebar.mdx +0 -31
  114. package/src/components/Sidebar/Sidebar.stories.ts +0 -34
  115. package/src/components/Sidebar/sidebar.css +0 -18
  116. package/src/components/Sidebar/sidebar.spec.ts +0 -33
  117. package/src/components/Snackbar/RSnackbar.vue +0 -136
  118. package/src/components/Snackbar/Snackbar.mdx +0 -126
  119. package/src/components/Snackbar/Snackbar.stories.ts +0 -93
  120. package/src/components/Snackbar/snackbar.css +0 -99
  121. package/src/components/Snackbar/snackbar.spec.ts +0 -56
  122. package/src/components/Switch/RSwitch.vue +0 -147
  123. package/src/components/Switch/Switch.mdx +0 -102
  124. package/src/components/Switch/Switch.stories.ts +0 -79
  125. package/src/components/Switch/switch.css +0 -102
  126. package/src/components/Switch/switch.spec.ts +0 -31
  127. package/src/components/TabItem/RTabItem.vue +0 -175
  128. package/src/components/TabItem/TabItem.mdx +0 -95
  129. package/src/components/TabItem/TabItem.spec.ts +0 -29
  130. package/src/components/TabItem/TabItem.stories.ts +0 -97
  131. package/src/components/TabItem/common.ts +0 -6
  132. package/src/components/TabItem/tab-item.css +0 -29
  133. package/src/components/Tabs/RTabs.vue +0 -94
  134. package/src/components/Tabs/Tabs.mdx +0 -78
  135. package/src/components/Tabs/Tabs.spec.ts +0 -28
  136. package/src/components/Tabs/Tabs.stories.ts +0 -191
  137. package/src/components/Tabs/tabs.css +0 -13
  138. package/src/components/Tabs/types.ts +0 -11
  139. package/src/components/TextArea/RTextArea.vue +0 -142
  140. package/src/components/TextArea/TextArea.mdx +0 -108
  141. package/src/components/TextArea/TextArea.stories.ts +0 -55
  142. package/src/components/TextArea/textarea.css +0 -51
  143. package/src/components/TextArea/textarea.spec.ts +0 -36
  144. package/src/components/Textfield/RTextfield.vue +0 -372
  145. package/src/components/Textfield/Textfield.mdx +0 -159
  146. package/src/components/Textfield/Textfield.stories.ts +0 -121
  147. package/src/components/Textfield/textfield.css +0 -81
  148. package/src/components/Textfield/textfield.spec.ts +0 -34
  149. package/src/components/Tooltip/RTooltip.vue +0 -325
  150. package/src/components/Tooltip/Tooltip.mdx +0 -111
  151. package/src/components/Tooltip/Tooltip.stories.ts +0 -203
  152. package/src/components/Tooltip/common.ts +0 -91
  153. package/src/components/Tooltip/tooltip.css +0 -34
  154. package/src/components/Tooltip/tooltip.spec.ts +0 -81
  155. package/src/components/Typography/Typography.mdx +0 -109
  156. package/src/components/Typography/typography.css +0 -128
  157. package/src/directives/index.ts +0 -19
  158. package/src/index.css +0 -241
  159. package/src/main.ts +0 -5
  160. package/src/scripts/buildIcons.js +0 -21
  161. package/src/stories/Colors.mdx +0 -355
  162. package/src/stories/GettingStarted.mdx +0 -121
  163. package/src/stories/Layout.mdx +0 -15
  164. package/tailwind.config.cjs +0 -16
  165. package/tsconfig.json +0 -24
  166. package/vite.config.ts +0 -39
  167. package/vitest.config.ts +0 -12
  168. /package/{public → dist}/design-tokens.source.json +0 -0
  169. /package/{public → dist}/favicon.ico +0 -0
@@ -1,115 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed, defineProps } from 'vue';
3
- import './avatar.css';
4
- // @ts-ignore
5
- import blank from '../../assets/blank-avatar.svg';
6
-
7
- export interface IProps {
8
- /**
9
- * Type of the Avatar
10
- * @type 'image' | 'text'
11
- * @default 'image'
12
- * @example
13
- * <Avatar type="text" />
14
- */
15
- type?: 'image' | 'text';
16
-
17
- /**
18
- * Source of the Avatar
19
- * @type string
20
- * @default ''
21
- * @example
22
- * <Avatar src="https://source.unsplash.com/random" />
23
- */
24
- src?: string;
25
-
26
- /**
27
- * Alt of the Avatar
28
- * @type string
29
- * @default 'Avatar'
30
- * @example
31
- * <Avatar alt="Avatar" />
32
- */
33
- alt?: string;
34
-
35
- /**
36
- * Size of the Avatar
37
- * @type 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'
38
- * @default '2xl'
39
- * @example
40
- * <Avatar size="xs" />
41
- */
42
- size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
43
-
44
- /**
45
- * Show online status
46
- * @type boolean
47
- * @default false
48
- * @example
49
- * <Avatar online />
50
- */
51
- online?: boolean;
52
-
53
- /**
54
- * Text to show when type is text
55
- * @type string
56
- * @default ''
57
- * @example
58
- * <Avatar type="text" text="John Doe" />
59
- */
60
- text?: string;
61
- }
62
- const props = withDefaults(defineProps<IProps>(), {
63
- type: 'image',
64
- size: '2xl',
65
- src: blank,
66
- alt: 'Avatar',
67
- online: false,
68
- text: '',
69
- });
70
-
71
- const classes = computed(() => ({
72
- avatar: true,
73
- [`avatar--${props.size}`]: true,
74
- }));
75
- const isAnon = computed(() => props.type === 'image' && !props.src);
76
- const imgSrc = computed(() => {
77
- if (!isAnon.value) {
78
- return props.src;
79
- }
80
- return blank;
81
- });
82
- const shortTextWithFirstCharacters = (text: string) => {
83
- const words = text.split(' ');
84
- if (words.length === 1) {
85
- return words[0].substring(0, 2);
86
- }
87
- return `${words[0].charAt(0)}${words[1].charAt(0)}`;
88
- };
89
- </script>
90
- <template>
91
- <div class="avatar__wrapper">
92
- <div :class="classes">
93
- <p
94
- v-if="props.type === 'text'"
95
- :class="{ avatar__text: true, [`avatar__text--${props.size}`]: true }"
96
- >
97
- {{ shortTextWithFirstCharacters(props.text) }}
98
- </p>
99
- <img
100
- v-else
101
- :alt="props.alt"
102
- :class="{
103
- avatar__image: true,
104
- [`avatar__image--${props.size}`]: true,
105
- 'avatar__image--anonymous': isAnon,
106
- }"
107
- :src="imgSrc"
108
- />
109
- </div>
110
- <span
111
- v-if="props.online"
112
- :class="{ avatar__online: true, [`avatar__online--${props.size}`]: true }"
113
- />
114
- </div>
115
- </template>
@@ -1,82 +0,0 @@
1
- @import '../../index.css';
2
-
3
- .avatar {
4
- @apply relative grid place-items-center rounded-full overflow-hidden bg-[var(--primary-100)];
5
-
6
- &__wrapper {
7
- @apply relative max-w-min;
8
- }
9
-
10
- &--xs {
11
- @apply w-6 h-6;
12
- }
13
- &--sm {
14
- @apply w-8 h-8;
15
- }
16
- &--md {
17
- @apply w-10 h-10;
18
- }
19
- &--lg {
20
- @apply w-12 h-12;
21
- }
22
- &--xl {
23
- @apply w-14 h-14;
24
- }
25
- &--2xl {
26
- @apply w-16 h-16;
27
- }
28
-
29
- &__text {
30
- @apply text-[var(--primary-500)] font-semibold;
31
-
32
- &--xs {
33
- @apply text-xs;
34
- }
35
- &--sm {
36
- @apply text-sm;
37
- }
38
- &--md {
39
- @apply text-base;
40
- }
41
- &--lg {
42
- @apply text-xl;
43
- }
44
- &--xl {
45
- @apply text-2xl;
46
- }
47
- &--2xl {
48
- @apply text-2xl;
49
- }
50
- }
51
-
52
- &__image {
53
- @apply inset-0 object-cover;
54
-
55
- &--anonymous {
56
- @apply w-[40%] h-[40%];
57
- }
58
- }
59
-
60
- &__online {
61
- @apply absolute rounded-full bg-green-500 border-white;
62
-
63
- &--xs {
64
- @apply w-1.5 h-1.5 right-[1px] bottom-[1px] border;
65
- }
66
- &--sm {
67
- @apply w-2 h-2 right-[1px] bottom-[1px] border;
68
- }
69
- &--md {
70
- @apply w-2 h-2 right-0.5 bottom-0.5 border-[1.25px];
71
- }
72
- &--lg {
73
- @apply w-3 h-3 right-[1.5px] bottom-[1.5px] border-[1.5px];
74
- }
75
- &--xl {
76
- @apply w-3.5 h-3.5 right-0.5 bottom-0.5 border-2;
77
- }
78
- &--2xl {
79
- @apply w-4 h-4 right-0.5 bottom-0.5 border-2;
80
- }
81
- }
82
- }
@@ -1,38 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { mount } from '@vue/test-utils';
3
- import Avatar from './RAvatar.vue';
4
-
5
- describe('Avatar', () => {
6
- it('should render correctly for image version', () => {
7
- const wrapper = mount(Avatar, {
8
- props: {
9
- type: 'image',
10
- size: 'sm',
11
- src: 'https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50',
12
- alt: 'avatar',
13
- online: true,
14
- },
15
- });
16
-
17
- expect(wrapper.exists()).toBe(true);
18
- expect(wrapper.find('.avatar').classes()).toContain('avatar--sm');
19
- expect(wrapper.find('img').attributes('src')).toBe(
20
- 'https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50'
21
- );
22
- expect(wrapper.find('img').attributes('alt')).toBe('avatar');
23
- expect(wrapper.find('.avatar__online').exists()).toBe(true);
24
- });
25
-
26
- it('should render correctly for image version', () => {
27
- const wrapper = mount(Avatar, {
28
- props: {
29
- type: 'text',
30
- text: 'Hello World',
31
- size: 'sm',
32
- },
33
- });
34
- expect(wrapper.exists()).toBe(true);
35
- expect(wrapper.find('.avatar').classes()).toContain('avatar--sm');
36
- expect(wrapper.find('.avatar__text').text()).toBe('HW');
37
- });
38
- });
@@ -1,112 +0,0 @@
1
- import { Canvas, Meta, Story, Controls } from '@storybook/blocks';
2
- import * as BadgeStories from './Badge.stories';
3
-
4
- <Meta of={BadgeStories} />
5
-
6
- # Badge
7
-
8
- A badge is a small, customizable component that is often used to display a notification, count, or status.
9
-
10
- - [Overview](#overview)
11
-
12
- - [Playground](#playground)
13
-
14
- - [Usage with props](#usage)
15
-
16
- - [Variants](#variants)
17
-
18
- - [Tips](#tips)
19
-
20
- ### Overview <a id="overview" />
21
-
22
- A badge is a small visual element that is used to communicate a value or a status. It is typically used to show the number of items in a list, the status of a process, or a notification. Badges are often used in conjunction with buttons, icons, or other elements to provide additional information to the user.
23
-
24
- Badges should be used when it is important to quickly and clearly communicate a value or a status to the user. They are often used to show the number of unread items in a list, the status of a process, or to indicate that an element has been updated.
25
-
26
- Badges can be used in a variety of different contexts, but they are most commonly used in web and mobile applications. Some examples of where badges might be used include:
27
-
28
- - In a messaging app to indicate the number of unread messages
29
- - In a social media app to show the number of likes or comments on a post
30
- - In a task management app to indicate the number of tasks that are overdue or incomplete
31
-
32
- Our badge component has a `default` slot that can be used to display any content.
33
-
34
- <Canvas>
35
- <Story of={BadgeStories.Overview} />
36
- </Canvas>
37
-
38
- ### Playground <a id="playground" />
39
-
40
- > Changes you make in the controls will be reflected in the example above.
41
-
42
- <Controls of={BadgeStories.Overview} exclude={/^(click|default|on.*)$/} />
43
-
44
- ## Usage with props <a id="usage" />
45
-
46
- ### placement (optional)
47
-
48
- The **placement** prop is used to specify the position of the badge relative to its parent element. It can be set to _right_, _bottom_ or _left_.
49
-
50
- ### variant (optional)
51
-
52
- The **variant** prop is used to specify the color and styling of the badge. In the example above, it is set to primary, which will apply the default primary color and style to the badge. It can be set to _primary_, _success_, _error_, _warning_, or _neutral_.
53
-
54
- ### overlap (optional)
55
-
56
- The **overlap** prop is used to specify the overlapping status of the badge. In the example above, it is set to _false_, which will apply the default position of the badge.
57
-
58
- ### hover (optional)
59
-
60
- The **hover** prop is a boolean value that specifies whether the badge should be visible only on hover. If it is set to true, the badge will only be visible when the user hovers over its parent element.
61
-
62
- ### content (optional)
63
-
64
- The **content** prop is used to specify the text or number that should be displayed inside the badge. In this example, it is set to 3.
65
-
66
- ### outside (optional)
67
-
68
- Finally, the **outside** prop is a boolean value that specifies whether the badge should be displayed outside of its parent element, rather than inside it. In this example, it is set to false, so the badge will be displayed inside its parent element.
69
-
70
- ## Variants <a id="variants" />
71
-
72
- ### Right
73
-
74
- <Canvas>
75
- <Story of={BadgeStories.Right} />
76
- </Canvas>
77
-
78
- ### With Content
79
-
80
- <Canvas>
81
- <Story of={BadgeStories.WithContent} />
82
- </Canvas>
83
-
84
- ### Hover
85
-
86
- <Canvas>
87
- <Story of={BadgeStories.Hover} />
88
- </Canvas>
89
-
90
- ### Bottom
91
-
92
- <Canvas>
93
- <Story of={BadgeStories.Bottom} />
94
- </Canvas>
95
-
96
- ### Left
97
-
98
- <Canvas>
99
- <Story of={BadgeStories.Left} />
100
- </Canvas>
101
-
102
- ## Tips
103
-
104
- 💡 Keep the badge small and simple. The badge should be small enough to not distract from the rest of the interface, but large enough to be easily readable.
105
-
106
- 💡 Use a clear and concise label. The label on the badge should be short and to the point, and should accurately convey the information that it is intended to communicate.
107
-
108
- 💡 Use color to convey meaning. Different colors can be used to indicate different types of information, such as red for error messages and green for success messages.
109
-
110
- 💡 Position the badge carefully. The badge should be positioned in a way that is easily visible and does not obstruct other elements in the interface.
111
-
112
- 💡 Use badges sparingly. Overuse of badges can make the interface cluttered and difficult to read, so use them only when necessary to communicate important information to the user.
@@ -1,99 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/vue3';
2
- import Badge from './RBadge.vue';
3
- import Icon from '../Icon/RIcon.vue';
4
- import Button from '../Button/RButton.vue';
5
-
6
- const DefaultArgs = {
7
- variant: 'primary',
8
- placement: 'right',
9
- overlap: false,
10
- hover: false,
11
- content: '',
12
- outside: false,
13
- };
14
- const DefaultArgTypes = {
15
- variant: {
16
- type: 'select',
17
- options: ['primary', 'success', 'error', 'warning', 'neutral'],
18
- },
19
- placement: {
20
- type: 'select',
21
- options: ['right', 'bottom', 'left'],
22
- },
23
- onClick: {
24
- action: 'click',
25
- },
26
- };
27
-
28
- const BadgeStory = {
29
- title: 'Components/Badge',
30
- render: (args: any) => ({
31
- components: { Badge, Icon },
32
- setup: () => {
33
- return { args };
34
- },
35
- template: `
36
- <Badge v-bind="args" >
37
- <template v-slot:default>
38
- <Icon name="mdiEmail" size="24" />
39
- </template>
40
- </Badge>
41
- `,
42
- args: DefaultArgs,
43
- argTypes: DefaultArgTypes,
44
- }),
45
- } as Meta<any>;
46
-
47
- export default BadgeStory;
48
-
49
- type Story = StoryObj<typeof BadgeStory>;
50
-
51
- export const Overview: Story = {
52
- args: {
53
- placement: 'right',
54
- },
55
- };
56
-
57
- export const Right: Story = {
58
- args: {
59
- placement: 'right',
60
- },
61
- };
62
-
63
- export const WithContent = {
64
- render: (args: any) => ({
65
- components: { Badge, Button },
66
- setup() {
67
- return { args };
68
- },
69
- template: `
70
- <Badge v-bind="args">
71
- <template v-slot:default>
72
- <Button icon="add" variant="primary">Hello World</Button>
73
- </template>
74
- </Badge>
75
- `,
76
- }),
77
- args: {
78
- ...DefaultArgs,
79
- content: '32',
80
- },
81
- };
82
-
83
- export const Hover: Story = {
84
- args: {
85
- hover: true,
86
- },
87
- };
88
-
89
- export const Bottom: Story = {
90
- args: {
91
- placement: 'bottom',
92
- },
93
- };
94
-
95
- export const Left: Story = {
96
- args: {
97
- placement: 'left',
98
- },
99
- };
@@ -1,89 +0,0 @@
1
- <script setup lang="ts">
2
- import './badge.css';
3
- import { computed } from 'vue';
4
-
5
- export interface BadgeProps {
6
- /**
7
- * Variant of the Badge
8
- * @type 'primary' | 'success' | 'warning' | 'error' | 'neutral'
9
- * @default 'primary'
10
- * @example
11
- * <Badge variant="primary" />
12
- */
13
- variant?: 'primary' | 'success' | 'warning' | 'error' | 'neutral';
14
-
15
- /**
16
- * Placement of the Badge
17
- * @type 'right' | 'bottom' | 'left'
18
- * @default 'right'
19
- * @example
20
- * <Badge placement="right" />
21
- */
22
- placement?: 'right' | 'bottom' | 'left';
23
-
24
- /**
25
- * Overlap the Badge
26
- * @type boolean
27
- * @default false
28
- * @example
29
- * <Badge overlap />
30
- */
31
- overlap?: boolean;
32
-
33
- /**
34
- * Show the Badge on hover
35
- * @type boolean
36
- * @default false
37
- * @example
38
- * <Badge hover />
39
- */
40
- hover?: boolean;
41
-
42
- /**
43
- * Content of the Badge
44
- * @type string | number
45
- * @default ''
46
- * @example
47
- * <Badge content="1" />
48
- */
49
- content?: string | number;
50
-
51
- /**
52
- * Show the Badge outside
53
- * @type boolean
54
- * @default false
55
- * @example
56
- * <Badge outside />
57
- */
58
- outside?: boolean;
59
- }
60
- const props = withDefaults(defineProps<BadgeProps>(), {
61
- variant: 'primary',
62
- placement: 'right',
63
- overlap: false,
64
- hover: false,
65
- content: '',
66
- outside: false,
67
- });
68
- defineEmits(['click']);
69
- const classes = computed(() => {
70
- return {
71
- badge: true,
72
- badge__content: props.content,
73
- [`badge--overlap-${props.placement}`]: props.overlap,
74
- [`badge--${props.placement}`]: props.placement,
75
- [`badge--outside-${props.placement}`]: props.outside,
76
- 'badge--hover': props.hover,
77
- 'badge--no-content': !props.content,
78
- [`badge--${props.variant}`]: props.variant,
79
- };
80
- });
81
- </script>
82
- <template>
83
- <div class="badge-wrapper group">
84
- <span :class="classes" @click="$emit('click')">
85
- {{ props.content }}
86
- </span>
87
- <slot />
88
- </div>
89
- </template>
@@ -1,63 +0,0 @@
1
- @import '../../index.css';
2
-
3
- .badge-wrapper {
4
- @apply relative flex items-center justify-center max-w-max p-2;
5
- }
6
-
7
- .badge {
8
- @apply absolute z-50 rounded-full py-0 px-1 bg-[var(--primary-500)];
9
-
10
- &--right {
11
- @apply -top-1 -right-1;
12
- }
13
- &--left {
14
- @apply -top-1 -left-1;
15
- }
16
- &--bottom {
17
- @apply -right-1 -bottom-1;
18
- }
19
- &--hover {
20
- @apply opacity-0 group-hover:opacity-100 transition-all duration-500 ease-in-out;
21
- }
22
- &--outside-right {
23
- @apply -top-2 -right-2;
24
- }
25
- &--outside-left {
26
- @apply -top-2 -left-2;
27
- }
28
- &--outside-bottom {
29
- @apply -right-2 -bottom-2;
30
- }
31
- &--overlap-right {
32
- @apply top-0 right-0;
33
- }
34
- &--overlap-left {
35
- @apply top-0 left-0;
36
- }
37
- &--overlap-bottom {
38
- @apply right-0 bottom-0;
39
- }
40
- &--no-content {
41
- @apply w-2 h-2 py-1;
42
- }
43
-
44
- &--primary {
45
- @apply bg-[var(--primary-500)];
46
- }
47
- &--success {
48
- @apply bg-[var(--success-500)];
49
- }
50
- &--warning {
51
- @apply bg-[var(--warning-500)];
52
- }
53
- &--error {
54
- @apply bg-[var(--error-500)];
55
- }
56
- &--neutral {
57
- @apply bg-[var(--neutral-500)];
58
- }
59
-
60
- &__content {
61
- @apply grid place-items-center leading-[14px] text-[10px] text-white font-bold;
62
- }
63
- }
@@ -1,20 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
-
3
- import { mount } from '@vue/test-utils';
4
- import Badge from './RBadge.vue';
5
-
6
- describe('Badge', () => {
7
- it('renders properly', () => {
8
- const wrapper = mount(Badge, {
9
- props: {
10
- placement: 'right',
11
- size: 'small',
12
- content: '1',
13
- },
14
- });
15
- expect(wrapper.element.classList.contains('badge'));
16
- expect(wrapper.element.classList.contains('badge--right'));
17
- expect(wrapper.element.classList.contains('badge--small'));
18
- expect(wrapper.element.innerHTML.includes('1'));
19
- });
20
- });
@@ -1,20 +0,0 @@
1
- import { Canvas, Meta, Story, Controls } from '@storybook/blocks';
2
- import * as BoxStories from './Box.stories';
3
-
4
- <Meta of={BoxStories} />
5
-
6
- # Box
7
-
8
- Box is the most abstract component on top of which all other Rocket UI components are built. By default, it renders a `div` element
9
-
10
- > A simple box Components
11
-
12
- <Canvas>
13
- <Story of={BoxStories.Overview} />
14
- </Canvas>
15
-
16
- ### Playground <a id="playground" />
17
-
18
- > Changes you make in the controls will be reflected in the example above.
19
-
20
- <Controls of={BoxStories.Overview} exclude={/^(click|default|on.*)$/} />
@@ -1,56 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/vue3';
2
- import Box from './RBox.vue';
3
-
4
- const DefaultArgTypes = {
5
- is: {
6
- type: 'select',
7
- options: ['div', 'span', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
8
- },
9
- display: {
10
- type: 'select',
11
- options: [
12
- 'block',
13
- 'inline-block',
14
- 'inline',
15
- 'flex',
16
- 'inline-flex',
17
- 'grid',
18
- 'inline-grid',
19
- 'table',
20
- 'inline-table',
21
- 'contents',
22
- 'list-item',
23
- 'none',
24
- ],
25
- },
26
- };
27
- const DefaultArgs = {
28
- is: 'div',
29
- display: 'block',
30
- width: 'auto',
31
- height: 'auto',
32
- minWidth: 'auto',
33
- minHeight: 'auto',
34
- maxWidth: 'auto',
35
- maxHeight: 'auto',
36
- };
37
- const BoxStory = {
38
- title: 'Layout/Box',
39
- component: Box,
40
- setup(args: any) {
41
- return { args };
42
- },
43
- template: `<Box v-bind="args" />`,
44
- args: DefaultArgs,
45
- argTypes: DefaultArgTypes,
46
- } as Meta<typeof Box>;
47
-
48
- export default BoxStory;
49
-
50
- type Story = StoryObj<typeof BoxStory>;
51
-
52
- export const Overview: Story = {
53
- args: {
54
- default: 'Hello World',
55
- },
56
- };