@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,47 +0,0 @@
1
- @import '../../index.css';
2
-
3
- .r-pagination {
4
- @apply flex items-center justify-between;
5
-
6
- &__page-info {
7
- @apply flex items-center gap-2;
8
- }
9
-
10
- &__paginator {
11
- @apply flex items-center gap-2 whitespace-nowrap;
12
-
13
- &__prev,
14
- &__next {
15
- @apply flex items-center justify-center bg-[var(--pagination-bg-color)]
16
- cursor-pointer p-[var(--pagination-btn-padding)] rounded-[var(--pagination-border-radius)];
17
- border: var(--pagination-border-width) var(--pagination-border-style)
18
- var(--pagination-border-color);
19
-
20
- &:hover {
21
- @apply text-gray-300;
22
- }
23
-
24
- &:disabled {
25
- @apply cursor-not-allowed;
26
- }
27
- }
28
-
29
- &__input {
30
- @apply text-center rounded-[var(--pagination-border-radius)] p-[var(--pagination-input-padding)] bg-[var(--pagination-bg-color)];
31
- border: var(--pagination-border-width) var(--pagination-border-style)
32
- var(--pagination-border-color);
33
-
34
- &:focus {
35
- @apply outline-none ring-2 ring-[var(--primary-500)] ring-inset;
36
- }
37
-
38
- &::-webkit-inner-spin-button,
39
- &::-webkit-outer-spin-button {
40
- opacity: 0;
41
- pointer-events: none;
42
- background: transparent;
43
- display: none;
44
- }
45
- }
46
- }
47
- }
@@ -1,17 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
-
3
- import { mount } from '@vue/test-utils';
4
- import Pagination from './RPagination.vue';
5
-
6
- describe('Pagination', () => {
7
- it('should render correctly', () => {
8
- const wrapper = mount(Pagination, {
9
- props: {
10
- page: 1,
11
- totalPages: 10,
12
- },
13
- });
14
-
15
- expect(wrapper.find('.r-pagination').exists()).toBe(true);
16
- });
17
- });
@@ -1,34 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/vue3';
2
-
3
- // @ts-ignore
4
- import Progressbar from './RProgressbar.vue';
5
-
6
- const ProgressbarStory = {
7
- title: 'Components/Progressbar',
8
- component: Progressbar,
9
- setup: (args: typeof Progressbar) => ({
10
- args,
11
- }),
12
- template: `<Progressbar v-bind="args" />`,
13
- tags: ['autodocs'],
14
- args: {
15
- value: 50,
16
- height: 8,
17
- },
18
- argTypes: {
19
- value: {
20
- control: {
21
- type: 'range',
22
- min: 0,
23
- max: 100,
24
- step: 1,
25
- },
26
- },
27
- },
28
- } as Meta<typeof Progressbar>;
29
-
30
- export default ProgressbarStory;
31
-
32
- type Story = StoryObj<typeof ProgressbarStory>;
33
-
34
- export const Overview: Story = {};
@@ -1,21 +0,0 @@
1
- <script setup lang="ts">
2
- import './progressbar.css';
3
- export interface ProgressBarProps {
4
- value: number;
5
- height?: number;
6
- }
7
- const props = withDefaults(defineProps<ProgressBarProps>(), {
8
- value: 0,
9
- height: 8,
10
- });
11
- </script>
12
- <template>
13
- <progress
14
- class="r-progressbar"
15
- role="progressbar"
16
- :aria-valuemax="100"
17
- :max="100"
18
- :value="props.value"
19
- :style="{ height: props.height + 'px' }"
20
- />
21
- </template>
@@ -1,24 +0,0 @@
1
- @import '../../index.css';
2
-
3
- .r-progressbar {
4
- @apply appearance-none border-none rounded-full overflow-hidden w-full;
5
-
6
- &[value]::-webkit-progress-value {
7
- background-color: var(--primary-500);
8
- transition: inline-size 0.25s ease-out;
9
- }
10
-
11
- &[value]::-moz-progress-bar {
12
- background-color: var(--primary-500);
13
- transition: inline-size 0.25s ease-out;
14
- }
15
-
16
- &[value]::-ms-fill {
17
- background-color: var(--primary-500);
18
- transition: inline-size 0.25s ease-out;
19
- }
20
-
21
- &[value]::-webkit-progress-bar {
22
- background-color: var(--primary-200);
23
- }
24
- }
@@ -1,17 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
-
3
- import { mount } from '@vue/test-utils';
4
- import RProgressbar from './RProgressbar.vue';
5
-
6
- describe('progressbar', () => {
7
- it('should render correctly', () => {
8
- const wrapper = mount(RProgressbar, {
9
- props: {
10
- value: 50,
11
- },
12
- });
13
-
14
- expect(wrapper.find('.r-progressbar').exists()).toBe(true);
15
- expect(wrapper.attributes('value')).toBe('50');
16
- });
17
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,27 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed } from 'vue';
3
- import './sidebar.css';
4
-
5
- export interface RSidebarProps {
6
- modelValue: boolean;
7
- }
8
-
9
- const props = withDefaults(defineProps<RSidebarProps>(), {
10
- modelValue: false,
11
- });
12
-
13
- const classes = computed(() => ({
14
- sidebar: true,
15
- 'sidebar--open': props.modelValue,
16
- }));
17
- </script>
18
- <template>
19
- <aside :class="classes">
20
- <nav class="nav">
21
- <slot />
22
- </nav>
23
- <div class="actions">
24
- <slot name="actions" />
25
- </div>
26
- </aside>
27
- </template>
@@ -1,31 +0,0 @@
1
- import { Canvas, Meta, Story, Controls } from '@storybook/blocks';
2
-
3
- import * as SidebarStories from './Sidebar.stories';
4
-
5
- <Meta of={SidebarStories} />
6
-
7
- # Sidebar
8
-
9
- - [Overview](#overview)
10
-
11
- - [Playground](#playground)
12
-
13
- - [Usage with props](#usage)
14
-
15
- - [Slots](#slots)
16
-
17
- - [Stories](#stories)
18
-
19
- - [Tips](#tips)
20
-
21
- ## Overview <a id="overview" />
22
-
23
- <Canvas>
24
- <Story of={SidebarStories.Collapsed} />
25
- </Canvas>
26
-
27
- ## Playground <a id="playground" />
28
-
29
- > Changes you make in the controls will be reflected in the example above.
30
-
31
- <Controls of={SidebarStories.Collapsed} />
@@ -1,34 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/vue3';
2
- import { action } from '@storybook/addon-actions';
3
-
4
- import Sidebar from './RSidebar.vue';
5
-
6
- const SidebarStory = {
7
- title: 'Components/Sidebar',
8
- component: Sidebar,
9
- setup: (args: typeof Sidebar) => ({
10
- args,
11
- }),
12
- template: `
13
- <Sidebar v-bind="args">
14
- <template v-slot:default>
15
- test
16
- </template>
17
- <template v-slot:actions>
18
- test
19
- </template>
20
- </Sidebar>
21
- `,
22
- } as Meta<typeof Sidebar>;
23
-
24
- export default SidebarStory;
25
-
26
- type Story = StoryObj<typeof SidebarStory>;
27
-
28
- export const Collapsed: Story = {};
29
-
30
- export const Expanded: Story = {
31
- args: {
32
- modelValue: true,
33
- },
34
- };
@@ -1,18 +0,0 @@
1
- @import '../../index.css';
2
-
3
- .sidebar {
4
- @apply flex flex-col items-center w-[var(--sidebar-collapsed-width)] h-screen p-[var(--sidebar-padding)] overflow-y-auto bg-[var(--sidebar-background)] border-r
5
- transition-all ease-in duration-300;
6
-
7
- &--open {
8
- @apply w-[var(--sidebar-width)] items-start;
9
- }
10
-
11
- .nav {
12
- @apply flex flex-col flex-1 space-y-6 w-full;
13
- }
14
-
15
- .actions {
16
- @apply flex flex-col space-y-6 w-full;
17
- }
18
- }
@@ -1,33 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
-
3
- import { mount } from '@vue/test-utils';
4
-
5
- import Sidebar from './RSidebar.vue';
6
-
7
- describe('Sidebar', () => {
8
- it('renders correctly', () => {
9
- const wrapper = mount(Sidebar, {
10
- slots: {
11
- default: '<span class="default">test default</span>',
12
- actions: '<span class="actions">test actions</span>',
13
- },
14
- });
15
- expect(wrapper.find('.default').text()).toBe('test default');
16
- expect(wrapper.find('.actions').text()).toBe('test actions');
17
- });
18
-
19
- it('renders correctly when open', () => {
20
- const wrapper = mount(Sidebar, {
21
- props: {
22
- modelValue: true,
23
- },
24
- slots: {
25
- default: '<span class="default">test default</span>',
26
- actions: '<span class="actions">test actions</span>',
27
- },
28
- });
29
- expect(wrapper.find('.default').text()).toBe('test default');
30
- expect(wrapper.find('.actions').text()).toBe('test actions');
31
- expect(wrapper.find('.sidebar').classes()).toContain('sidebar--open');
32
- });
33
- });
@@ -1,136 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed, onMounted, onUnmounted, ref, watch, type Ref } from 'vue';
3
- import Button from '../Button/RButton.vue';
4
- import Icon from '../Icon/RIcon.vue';
5
- import './snackbar.css';
6
-
7
- export interface IProps {
8
- /**
9
- * Show of the snackbar
10
- * @type boolean
11
- * @default false
12
- * @example
13
- * <Snackbar show />
14
- */
15
- modelValue: boolean;
16
- /**
17
- * Text of the snackbar
18
- * @type string
19
- * @default ''
20
- * @example
21
- * <Snackbar text="Snackbar" />
22
- */
23
- text: string;
24
-
25
- /**
26
- * Show close of the snackbar
27
- * @type boolean
28
- * @default false
29
- * @example
30
- * <Snackbar closable />
31
- */
32
- closable?: boolean;
33
-
34
- /**
35
- * Set the snackbar slide from left otherwise slide from right
36
- * @type boolean
37
- * @default false
38
- * @example
39
- * <Snackbar left />
40
- */
41
- left?: boolean;
42
-
43
- /**
44
- * Timeout of the snackbar. <br />
45
- * If timeout is 0, the snackbar will not close automatically
46
- * @type number
47
- * @default 0
48
- * @example
49
- * <Snackbar timeout="1000" />
50
- */
51
- timeout?: number;
52
-
53
- /**
54
- * Variant of the snackbar
55
- * @type 'success' | 'error' | 'warning' | 'info'
56
- * @default 'info'
57
- * @example
58
- * <Snackbar variant="success" />
59
- */
60
- variant?: 'success' | 'error' | 'warning' | 'info';
61
-
62
- /**
63
- * Set the snackbar slide on top otherwise slide on bottom
64
- * @type boolean
65
- * @default false
66
- * @example
67
- * <Snackbar top />
68
- */
69
- top?: boolean;
70
- }
71
- const props = withDefaults(defineProps<IProps>(), {
72
- text: '',
73
- closable: false,
74
- left: false,
75
- modelValue: false,
76
- timeout: 0,
77
- });
78
-
79
- const emit = defineEmits(['action', 'update:modelValue']);
80
-
81
- watch(
82
- () => props.modelValue,
83
- () => {
84
- if (props.timeout > 0 && props.modelValue) {
85
- setTimeout(() => {
86
- emit('update:modelValue', false);
87
- }, props.timeout);
88
- }
89
- },
90
- {
91
- immediate: true,
92
- }
93
- );
94
-
95
- const classes = computed(() => {
96
- return {
97
- 'r-snackbar': true,
98
- [`r-snackbar--${props.variant}`]: true,
99
- [props.left ? 'r-snackbar__left' : 'r-snackbar__right']: true,
100
- [props.modelValue ? 'r-snackbar--shown' : 'r-snackbar--hidden']: true,
101
- [props.top ? 'r-snackbar__top' : 'r-snackbar__bottom']: true,
102
- };
103
- });
104
-
105
- const variantIcons = {
106
- success: 'mdiCheckCircle',
107
- error: 'mdiAlertCircle',
108
- warning: 'mdiAlert',
109
- info: 'mdiInformation',
110
- }[props.variant || 'info'];
111
- </script>
112
- <template>
113
- <div :class="classes">
114
- <slot>
115
- <Icon
116
- v-if="props.variant"
117
- :name="variantIcons"
118
- class="r-snackbar__icon"
119
- />
120
- </slot>
121
-
122
- <div class="r-snackbar__text">{{ props.text }}</div>
123
-
124
- <slot name="action"> </slot>
125
-
126
- <div v-if="props.closable" class="r-snackbar__close">
127
- <slot name="close">
128
- <Icon
129
- name="mdiClose"
130
- :size="16"
131
- @click.stop="$emit('update:modelValue', false)"
132
- />
133
- </slot>
134
- </div>
135
- </div>
136
- </template>
@@ -1,126 +0,0 @@
1
- import { Canvas, Meta, Story, Controls } from '@storybook/blocks';
2
-
3
- import * as SnackbarStories from './Snackbar.stories';
4
-
5
- <Meta of={SnackbarStories} />
6
-
7
- # Snackbar
8
-
9
- A Snackbar is a brief message that appears at the bottom of the screen to provide feedback to the user.
10
-
11
- - [Overview](#overview)
12
-
13
- - [Playground](#playground)
14
-
15
- - [Usage with props](#usage)
16
-
17
- - [Stories](#stories)
18
-
19
- - [Tips](#tips)
20
-
21
- # Overview <a id="overview" />
22
-
23
- The Snackbar component is a short, temporary notification that appears at the bottom of the screen. It is typically used to provide feedback to the user after an action has been performed, such as a successful submission of a form or completion of a task
24
-
25
- It is important to use the Snackbar component sparingly, as it can be disruptive if used excessively. It is generally recommended to use it only for important or time-sensitive notifications.
26
-
27
- <Canvas>
28
- <Story of={SnackbarStories.Overview} />
29
- </Canvas>
30
-
31
- ### Playground <a id="playground" />
32
-
33
- > Changes you make in the controls will be reflected in the example above.
34
-
35
- <Controls
36
- of={SnackbarStories.Overview}
37
- exclude={/^(click.*|action|content|close|on.*)$/}
38
- />
39
-
40
- ## Usage <a id="usage" />
41
-
42
- ### text (required)
43
-
44
- The text to be displayed in the Snackbar. This prop is required and should be a string.
45
-
46
- ### showAction (optional)
47
-
48
- Whether to display an action button in the Snackbar. If set to true, an action button will be displayed in the Snackbar. If set to false, the action button will not be displayed.
49
-
50
- ### showClose (optional)
51
-
52
- Whether to display a close button in the Snackbar. If set to true, a close button will be displayed in the Snackbar that allows the user to manually close it. If set to false, the close button will not be displayed.
53
-
54
- ### left (optional)
55
-
56
- Whether to align the Snackbar to the left or right side of the screen. If set to true, the Snackbar will be aligned to the left side of the screen. If set to false, the Snackbar will be aligned to the right side.
57
-
58
- ### show (optional)
59
-
60
- Whether to show or hide the Snackbar. If set to true, the Snackbar will be displayed. If set to false, the Snackbar will be hidden.
61
-
62
- ### timeout (optional)
63
-
64
- The amount of time in milliseconds that the Snackbar will be displayed before it is automatically hidden. This prop should be a number representing the number of milliseconds that the Snackbar will be displayed before it is automatically hidden.
65
-
66
- ## Stories <a id="stories" />
67
-
68
- ### OnlyText
69
-
70
- <Canvas>
71
- <Story of={SnackbarStories.OnlyText} />
72
- </Canvas>
73
-
74
- ### With Action
75
-
76
- <Canvas>
77
- <Story of={SnackbarStories.WithAction} />
78
- </Canvas>
79
-
80
- ### With Action and Close Button
81
-
82
- <Canvas>
83
- <Story of={SnackbarStories.WithActionAndCloseButton} />
84
- </Canvas>
85
-
86
- ### With Close Button
87
-
88
- <Canvas>
89
- <Story of={SnackbarStories.WithCloseButton} />
90
- </Canvas>
91
-
92
- ### Long Text
93
-
94
- <Canvas>
95
- <Story of={SnackbarStories.LongText} />
96
- </Canvas>
97
-
98
- ### Long Text with Action
99
-
100
- <Canvas>
101
- <Story of={SnackbarStories.LongTextWithAction} />
102
- </Canvas>
103
-
104
- ### Long Text with Action and Close Button
105
-
106
- <Canvas>
107
- <Story of={SnackbarStories.LongTextWithActionAndCloseButton} />
108
- </Canvas>
109
-
110
- ### With Timeout
111
-
112
- <Canvas>
113
- <Story of={SnackbarStories.WithTimeout} />
114
- </Canvas>
115
-
116
- ### Tips <a id="tips" />
117
-
118
- 💡 The Snackbar is a brief, temporary notification that should not be used excessively. Overusing the Snackbar can be disruptive and may cause users to ignore it.
119
-
120
- 💡 The Snackbar is best used for notifications that are important or time-sensitive. For example, if a form submission is successful or a task has been completed, the Snackbar can be used to provide feedback to the user.
121
-
122
- 💡 The Snackbar component has several props that can be used to customize its appearance and behavior. For example, you can use the left prop to align the Snackbar to the left or right side of the screen, and the timeout prop to control the amount of time it is displayed.
123
-
124
- 💡 The Snackbar should be tested on different screen sizes to ensure that it is displayed correctly and does not overlap with other content.
125
-
126
- 💡 The Snackbar is not the best choice for displaying critical errors or warnings. For these types of notifications, it is generally better to use a modal or an alert.
@@ -1,93 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/vue3';
2
- import Snackbar from './RSnackbar.vue';
3
-
4
- const DefaultArgs = {
5
- text: 'Single-line snackbar',
6
- actionText: '',
7
- showAction: false,
8
- showClose: false,
9
- left: false,
10
- show: true,
11
- timeout: 0,
12
- };
13
-
14
- const SnackbarStory = {
15
- component: Snackbar,
16
- setup: (args: typeof Snackbar) => ({
17
- args,
18
- }),
19
- template: `
20
- <div style="position:relative; min-height: 30vh; width: 100%;">
21
- <Snackbar
22
- v-bind="args"
23
- />
24
- </div>
25
- `,
26
- args: DefaultArgs,
27
- argTypes: {
28
- onAction: { action: 'action' },
29
- onClose: { action: 'close' },
30
- },
31
- } as Meta<typeof Snackbar>;
32
-
33
- export default SnackbarStory;
34
-
35
- type Story = StoryObj<typeof SnackbarStory>;
36
-
37
- export const Overview: Story = {};
38
-
39
- export const OnlyText: Story = {};
40
-
41
- export const WithAction: Story = {
42
- args: {
43
- actionText: 'Action',
44
- showAction: true,
45
- text: 'Single-line snackbar with action',
46
- },
47
- };
48
-
49
- export const WithActionAndCloseButton: Story = {
50
- args: {
51
- actionText: 'Action',
52
- showAction: true,
53
- showClose: true,
54
- text: 'Snackbar with action and close',
55
- },
56
- };
57
-
58
- export const WithCloseButton: Story = {
59
- args: {
60
- showClose: true,
61
- text: 'Single-line snackbar with close',
62
- },
63
- };
64
-
65
- export const LongText: Story = {
66
- args: {
67
- text: 'This is a very long snackbar message that will not fit on one line. It will wrap to multiple lines and the snackbar will grow in height.',
68
- },
69
- };
70
-
71
- export const LongTextWithAction: Story = {
72
- args: {
73
- actionText: 'Action',
74
- showAction: true,
75
- text: 'This is a very long snackbar message that will not fit on one line. It will wrap to multiple lines and the snackbar will grow in height.',
76
- },
77
- };
78
-
79
- export const LongTextWithActionAndCloseButton: Story = {
80
- args: {
81
- actionText: 'Action',
82
- showAction: true,
83
- showClose: true,
84
- text: 'This is a very long snackbar message that will not fit on one line. It will wrap to multiple lines and the snackbar will grow in height.',
85
- },
86
- };
87
-
88
- export const WithTimeout: Story = {
89
- args: {
90
- timeout: 5000,
91
- text: 'Snackbar with timeout',
92
- },
93
- };