@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,120 +0,0 @@
1
- import { Canvas, Meta, Story, Controls } from '@storybook/blocks';
2
-
3
- import * as AlertStories from './Alert.stories';
4
-
5
- <Meta of={AlertStories} />
6
-
7
- # Alert
8
-
9
- Alert is a component that displays a message to the user. It is often used to display information, warning, error, or success messages.
10
-
11
- - [Overview](#overview)
12
-
13
- - [Playground](#playground)
14
-
15
- - [Usage with props](#usage)
16
-
17
- - [Variants](#variants)
18
-
19
- - [Customizable Slots](#customizable-slots)
20
-
21
- - [Tips](#tips)
22
-
23
- ## Overview <a id="overview" />
24
-
25
- An Alert component is a user interface (UI) element that is used to display important information to the user. It can be used to provide feedback, success or error messages, or to simply draw the user's attention to something. Alert components are typically used in situations where the user needs to be notified of something immediately, or where the information being displayed is important and requires the user's attention.
26
-
27
- For example, an Alert component could be used to display a success message after the user has completed a form or submitted some data, to display an error message if there is a problem with the user's input, to display a warning if the user is about to perform an action that could have unintended consequences, or just to pass important information to the user.
28
-
29
- In general, Alert components should be used sparingly, as overusing them can make your UI cluttered and difficult to read. It's important to use Alert components only when necessary, and to provide clear and concise messages that help the user understand what is happening.
30
-
31
- <Canvas>
32
- <Story of={AlertStories.Overview} />
33
- </Canvas>
34
-
35
- ## Playground <a id="playground" />
36
-
37
- > Changes you make in the controls will be reflected in the example above. Try it yourself!
38
-
39
- <Controls of={AlertStories.Overview} exclude={/^(click|close|on.*)$/} />
40
-
41
- ## Usage with props <a id="usage" />
42
-
43
- ### type (required)
44
-
45
- The **type** prop determines the variant of the Alert component. The following values are accepted:
46
-
47
- - **success**: Indicates that a successful action has occurred.
48
- - **error**: Indicates that an error has occurred.
49
- - **warning**: Indicates that the user should be cautious about something.
50
- - **info**: Provides additional information to the user.
51
-
52
- ### title (optional)
53
-
54
- The **title** prop specifies the title of the Alert component. It should be short and concise, and should clearly convey the purpose of the Alert.
55
-
56
- ## description (optional)
57
-
58
- The **description** prop provides a longer description of the Alert component. It can be used to provide more detailed information or instructions to the user.
59
-
60
- ### size (optional)
61
-
62
- The **size** prop determines the size of the Alert component. The following values are accepted:
63
-
64
- - **small**: Renders a small Alert component.
65
- - **medium**: Renders a medium-sized Alert component.
66
- - **large**: Renders a large Alert component.
67
-
68
- ### closable (optional)
69
-
70
- If **closable** prop is set to true, the Alert component will include a close button that the user can use to dismiss the Alert.
71
-
72
- ## Variants <a id="variants" />
73
-
74
- > Our system has 4 Alert variants: **Success**, **Error**, **Information** and **Warning**.
75
-
76
- ### Success
77
-
78
- <Canvas>
79
- <Story of={AlertStories.Success} />
80
- </Canvas>
81
-
82
- ### Error
83
-
84
- <Canvas>
85
- <Story of={AlertStories.Error} />
86
- </Canvas>
87
-
88
- ### Information
89
-
90
- <Canvas>
91
- <Story of={AlertStories.Information} />
92
- </Canvas>
93
-
94
- ### Warning
95
-
96
- <Canvas>
97
- <Story of={AlertStories.Warning} />
98
- </Canvas>
99
-
100
- ## Customizable Slots <a id="customizable-slots" />
101
-
102
- ### `#close`
103
-
104
- > This `close` slot can be used for creating your own custom close buttons like this one example below 👇
105
-
106
- <Canvas>
107
- <Story of={AlertStories.CustomCloseButton} />
108
- </Canvas>
109
-
110
- ### Tips <a id="tips" />
111
-
112
- 💡 Use the title prop to provide a clear and concise message to the user.
113
-
114
- 💡 Use the description prop to provide more detailed information or instructions, if necessary.
115
-
116
- 💡 Choose the appropriate variant (success, error, warning, or info) for the Alert based on the content it is displaying.
117
-
118
- 💡 Keep the Alert small and concise. If you need to provide a lot of information, consider using a separate component or modal instead of trying to cram everything into the Alert.
119
-
120
- 💡 If the Alert is closable, make sure to provide clear instructions on how to dismiss it (e.g. "Click the 'X' to close this Alert").
@@ -1,118 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/vue3';
2
- import Alert from './RAlert.vue';
3
- import Icon from '../Icon/RIcon.vue';
4
-
5
- const DefaultArgs = {
6
- type: 'success',
7
- title: 'Alert Title',
8
- variant: 'ghost',
9
- description: '',
10
- closable: true,
11
- closeText: 'Close',
12
- block: false,
13
- };
14
-
15
- const DefaultArgTypes = {
16
- type: {
17
- type: 'select',
18
- options: ['success', 'info', 'warning', 'error'],
19
- },
20
- variant: {
21
- type: 'select',
22
- options: ['outline', 'solid', 'ghost'],
23
- },
24
- onClose: {
25
- action: 'close',
26
- },
27
- };
28
-
29
- const AlertStory = {
30
- component: Alert,
31
- setup: (args: typeof Alert) => {
32
- return { args };
33
- },
34
- template: `<Alert v-bind="args" @close="click"/>`,
35
- args: DefaultArgs,
36
- argTypes: DefaultArgTypes,
37
- } as Meta<typeof Alert>;
38
-
39
- export default AlertStory;
40
-
41
- type Story = StoryObj<typeof AlertStory>;
42
-
43
- export const Overview: Story = {
44
- args: {
45
- type: 'success',
46
- title: 'Alert Title',
47
- description:
48
- 'A type of alert which appears in a layer above other content, visually similar to a mobile or desktop push notification.',
49
- },
50
- };
51
-
52
- export const Success: Story = {
53
- args: {
54
- type: 'success',
55
- title: 'Success',
56
- description:
57
- 'Success Variant! This is a short but descriptive message that indicates a successful action.',
58
- },
59
- };
60
-
61
- export const Error: Story = {
62
- args: {
63
- type: 'error',
64
- title: 'Error',
65
- description:
66
- 'Error Variant! This is a short but descriptive message that indicates a negative action.',
67
- },
68
- };
69
-
70
- export const Information: Story = {
71
- args: {
72
- type: 'info',
73
- title: 'Info',
74
- description:
75
- 'Info Variant! This is a short but descriptive message that indicates a neutral informative action.',
76
- },
77
- };
78
-
79
- export const Warning: Story = {
80
- args: {
81
- type: 'warning',
82
- title: 'Warning',
83
- description:
84
- 'Warning Variant! This is a short but descriptive message that indicates a negative or dangerous action.',
85
- },
86
- };
87
-
88
- export const OnlyTitle: Story = {
89
- args: {
90
- type: 'success',
91
- title: 'Only Title',
92
- },
93
- };
94
-
95
- export const CustomCloseButton = {
96
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
97
- render: (args: any) => ({
98
- components: { Alert, Icon },
99
- setup: () => {
100
- return { args };
101
- },
102
- template: `
103
- <Alert
104
- v-bind="args"
105
- >
106
- <template #custom-close>
107
- <Icon name="mdiClose" />
108
- </template>
109
- </Alert>
110
- `,
111
- }),
112
- args: {
113
- type: 'info',
114
- title: 'With a custom button',
115
- description:
116
- 'This alert box looks very similar to our default examples but it contains a custom close button in it!',
117
- },
118
- };
@@ -1,119 +0,0 @@
1
- <script setup lang="ts">
2
- import './alert.css';
3
- import { computed } from 'vue';
4
- import Icon from '../Icon/RIcon.vue';
5
-
6
- export interface Props {
7
- /**
8
- * Type of the Alert
9
- * @type 'success' | 'error' | 'warning' | 'info'
10
- * @default 'info'
11
- * @example
12
- * <Alert type="success" />
13
- */
14
- type: 'success' | 'error' | 'warning' | 'info';
15
-
16
- /**
17
- * Title of the Alert
18
- * @type string
19
- * @default ''
20
- * @example
21
- * <Alert title="Title" />
22
- */
23
- title: string;
24
-
25
- /**
26
- * Variant of the Alert
27
- * @type 'solid' | 'outline' | 'ghost'
28
- * @default 'ghost'
29
- * @example
30
- * <Alert variant="ghost" />
31
- */
32
- variant?: 'solid' | 'outline' | 'ghost';
33
-
34
- /**
35
- * Description of the Alert
36
- * @type string
37
- * @default ''
38
- * @example
39
- * <Alert description="Description" />
40
- */
41
- description?: string;
42
-
43
- /**
44
- * Allow to close the Alert
45
- * @type boolean
46
- * @default true
47
- * @example
48
- * <Alert closable />
49
- */
50
- closable?: boolean;
51
-
52
- /**
53
- * Block appearance of the Alert
54
- * @type boolean
55
- * @default false
56
- * @example
57
- * <Alert block />
58
- */
59
- block?: boolean;
60
- }
61
-
62
- const emit = defineEmits(['close']);
63
- const props = withDefaults(defineProps<Props>(), {
64
- type: 'info',
65
- title: '',
66
- variant: 'ghost',
67
- description: '',
68
- closable: true,
69
- block: false,
70
- });
71
- const classes = computed(() => {
72
- return {
73
- ' r-alert': true,
74
- [`r-alert--${props.variant}`]: true,
75
- 'r-alert--block': props.block,
76
- [`r-alert--${props.variant}--${props.type}`]: true,
77
- };
78
- });
79
-
80
- const icon = computed(() => {
81
- return {
82
- success: 'mdiCheckCircle',
83
- error: 'mdiAlertCircle',
84
- warning: 'mdiAlert',
85
- info: 'mdiInformation',
86
- }[props.type];
87
- });
88
-
89
- const close = () => {
90
- emit('close');
91
- };
92
- </script>
93
- <template>
94
- <div :class="classes">
95
- <div class="r-alert__icon">
96
- <slot name="alert-icon">
97
- <Icon :name="icon" :size="24" />
98
- </slot>
99
- </div>
100
- <div class="r-alert__content">
101
- <slot name="content">
102
- <p class="r-alert__content__title">{{ props.title }}</p>
103
- <p v-if="props.description" class="r-alert__content__description">
104
- {{ props.description }}
105
- </p>
106
- </slot>
107
- </div>
108
- <div v-if="props.closable" class="r-alert__close">
109
- <slot name="custom-close">
110
- <Icon
111
- class="r-alert__close__button"
112
- name="mdiClose"
113
- :size="16"
114
- @click="close"
115
- />
116
- </slot>
117
- </div>
118
- </div>
119
- </template>
@@ -1,136 +0,0 @@
1
- @import '../../index.css';
2
-
3
- .r-alert {
4
- @apply inline-flex px-4 py-3 rounded-lg text-sm transition-transform duration-1000 box-border;
5
-
6
- &--block {
7
- @apply w-full;
8
-
9
- .r-alert__content {
10
- @apply max-w-full;
11
- }
12
- }
13
- &--solid {
14
- @apply text-[var(--white)];
15
-
16
- .r-alert__content {
17
- @apply text-[var(--white)];
18
-
19
- .r-alert__content__description {
20
- @apply text-[var(--white)];
21
- }
22
- }
23
-
24
- .r-alert__close {
25
- @apply text-[var(--white)];
26
- }
27
-
28
- &--success {
29
- @apply bg-[var(--success-500)];
30
- }
31
-
32
- &--error {
33
- @apply bg-[var(--error-500)];
34
- }
35
-
36
- &--warning {
37
- @apply bg-[var(--warning-500)];
38
- }
39
-
40
- &--info {
41
- @apply bg-[var(--info-500)];
42
- }
43
- }
44
-
45
- &--outline {
46
- @apply bg-transparent border border-solid;
47
-
48
- &--success {
49
- @apply border-[var(--success-500)] text-[var(--success-500)];
50
-
51
- .r-alert__content__description {
52
- @apply text-[var(--success-500)];
53
- }
54
- }
55
-
56
- &--error {
57
- @apply border-[var(--error-500)] text-[var(--error-500)];
58
-
59
- .r-alert__content__description {
60
- @apply text-[var(--error-500)];
61
- }
62
- }
63
-
64
- &--warning {
65
- @apply border-[var(--warning-500)] text-[var(--warning-500)];
66
-
67
- .r-alert__content__description {
68
- @apply text-[var(--warning-500)];
69
- }
70
- }
71
-
72
- &--info {
73
- @apply border-[var(--info-500)] text-[var(--info-500)];
74
-
75
- .r-alert__content__description {
76
- @apply text-[var(--info-500)];
77
- }
78
- }
79
- }
80
-
81
- &--ghost {
82
- @apply border-none text-[var(--neutral-900)];
83
-
84
- &--success {
85
- @apply bg-[var(--success-100)];
86
-
87
- .r-alert__icon {
88
- @apply text-[var(--success-500)];
89
- }
90
- }
91
-
92
- &--error {
93
- @apply bg-[var(--error-100)];
94
-
95
- .r-alert__icon {
96
- @apply text-[var(--error-500)];
97
- }
98
- }
99
-
100
- &--warning {
101
- @apply bg-[var(--warning-100)];
102
-
103
- .r-alert__icon {
104
- @apply text-[var(--warning-500)];
105
- }
106
- }
107
-
108
- &--info {
109
- @apply bg-[var(--info-100)];
110
-
111
- .r-alert__icon {
112
- @apply text-[var(--info-500)];
113
- }
114
- }
115
- }
116
-
117
- &__icon {
118
- @apply grid place-items-start;
119
- }
120
-
121
- &__content {
122
- @apply w-full grid place-items-start justify-items-start px-4 min-w-[21rem] max-w-sm;
123
-
124
- &__title {
125
- @apply font-medium;
126
- }
127
-
128
- &__description {
129
- @apply text-[var(--neutral-600)];
130
- }
131
- }
132
-
133
- &__close {
134
- @apply grid place-items-start cursor-pointer text-[var(--neutral-900)];
135
- }
136
- }
@@ -1,32 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { mount } from '@vue/test-utils';
3
- import Alert from './RAlert.vue';
4
-
5
- describe('Alert', () => {
6
- it('should render correctly', () => {
7
- const wrapper = mount(Alert, {
8
- props: {
9
- type: 'success',
10
- title: 'Alert Title',
11
- description: 'Alert Description',
12
- size: 'small',
13
- closable: true,
14
- },
15
- });
16
-
17
- expect(wrapper.classes()).toContain('alert');
18
- expect(wrapper.find('.texts__title').text()).toBe('Alert Title');
19
- expect(wrapper.find('.texts__description').text()).toBe(
20
- 'Alert Description'
21
- );
22
- expect(wrapper.find('.alert').classes()).toContain('alert--small');
23
- expect(
24
- wrapper
25
- .find('.alert')
26
- .trigger('click')
27
- .then(() => {
28
- expect(wrapper.emitted('close')).toBeTruthy();
29
- })
30
- );
31
- });
32
- });
@@ -1,96 +0,0 @@
1
- import { Canvas, Meta, Story, Controls } from '@storybook/blocks';
2
- import * as AvatarStories from './Avatar.stories';
3
-
4
- <Meta of={AvatarStories} />
5
-
6
- # Avatar
7
-
8
- Avatar component displays a visual representation of a user or an entity.
9
-
10
- - [Overview](#overview)
11
-
12
- - [Playground](#playground)
13
-
14
- - [Usage with props](#usage)
15
-
16
- - [Tips](#tips)
17
-
18
- ### Overview <a id="overview" />
19
-
20
- Avatar is typically used to identify a user or entity within a user interface, and can be displayed in various forms such as an image, text, or initials.
21
-
22
- To use an Avatar component, you can pass the necessary props to configure it to display the avatar in the desired way. For example, you can specify the type of avatar to display (e.g. image or text), the size of the avatar, and any additional props such as the source of the image or the text to display.
23
-
24
- <Canvas>
25
- <Story of={AvatarStories.Overview} />
26
- </Canvas>
27
-
28
- ### Playground <a id="playground" />
29
-
30
- > Changes you make in the controls will be reflected in the example above.
31
-
32
- <Controls of={AvatarStories.Overview} exclude={/^(click|close.*)$/} />
33
-
34
- ## Stories
35
-
36
- ### Image
37
-
38
- <Canvas>
39
- <Story of={AvatarStories.Image} />
40
- </Canvas>
41
-
42
- ### Text
43
-
44
- <Canvas>
45
- <Story of={AvatarStories.Text} />
46
- </Canvas>
47
-
48
- ### Anonymous
49
-
50
- <Canvas>
51
- <Story of={AvatarStories.Anonymous} />
52
- </Canvas>
53
-
54
- ### Online
55
-
56
- <Canvas>
57
- <Story of={AvatarStories.Online} />
58
- </Canvas>
59
-
60
- ## Usage with props <a id="usage" />
61
-
62
- ### type (optional)
63
-
64
- The **type** props is for the type of avatar to display. Can be either "image" or "text".
65
-
66
- ### src (optional)
67
-
68
- The **src** props is for the source of the image to display. This prop is only used when type is set to "image".
69
-
70
- ### alt (optional)
71
-
72
- The **alt** props is for the alt text for the image. This prop is only used when type is set to "image".
73
-
74
- ### size (optional)
75
-
76
- The **size** props is for the size of the avatar. Can be one of "xs", "sm", "md", "lg", "xl", or "2xl".
77
-
78
- ### online (optional)
79
-
80
- The **online** props is for whether to show a green circle indicator to signify that the user is online.
81
-
82
- ### text (optional)
83
-
84
- The **text** props is for the text to display when type is set to "text".
85
-
86
- ### Tips <a id="tips" />
87
-
88
- 💡 Use appropriate sizes for different contexts: The size of the avatar should be appropriate for the context in which it is being used. For example, a small avatar might be suitable for a list of users, while a larger avatar might be more suitable for a profile page.
89
-
90
- 💡 Use initials for text avatars: If you are using a text avatar, it is a good idea to use the user's initials rather than their full name. This can help to keep the avatar compact and easy to read.
91
-
92
- 💡 Use images sparingly: If you are using an image avatar, be mindful of the number of images you are loading on the page. If you are displaying a large number of avatars, it may be more efficient to use text avatars instead.
93
-
94
- 💡 Use alternative text for accessibility: When using an image avatar, make sure to include alt text to provide a textual representation of the image for screen readers and other assistive technologies.
95
-
96
- 💡 Consider the context of use: Think about the context in which the avatar will be used and design it accordingly. For example, if the avatar is being used in a chat application, you might want to include an online status indicator.
@@ -1,65 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/vue3';
2
- import Avatar from './RAvatar.vue';
3
-
4
- const DefaultArgs = {
5
- type: 'image',
6
- size: '2xl',
7
- src: 'https://avatars.githubusercontent.com/u/12534660?v=4',
8
- alt: 'Avatar',
9
- online: false,
10
- text: '',
11
- };
12
- const DefaultArgTypes = {
13
- type: {
14
- type: 'select',
15
- options: ['image', 'text'],
16
- },
17
- size: {
18
- type: 'select',
19
- options: ['xs', 'sm', 'md', 'lg', 'xl', '2xl'],
20
- },
21
- };
22
-
23
- const AvatarStory = {
24
- title: 'Components/Avatar',
25
- component: Avatar,
26
- setup: (args: typeof Avatar) => {
27
- return { args };
28
- },
29
- template: `<Avatar v-bind="args"/>`,
30
- args: DefaultArgs,
31
- argTypes: DefaultArgTypes,
32
- } as Meta<typeof Avatar>;
33
-
34
- export default AvatarStory;
35
-
36
- type Story = StoryObj<typeof AvatarStory>;
37
-
38
- export const Overview: Story = {
39
- args: {},
40
- };
41
-
42
- export const Image: Story = {
43
- args: {
44
- type: 'image',
45
- src: 'https://avatars.githubusercontent.com/u/12534660?v=4',
46
- },
47
- };
48
-
49
- export const Text: Story = {
50
- args: {
51
- type: 'text',
52
- text: 'Avatar Text',
53
- },
54
- };
55
-
56
- export const Anonymous: Story = {
57
- args: {},
58
- };
59
-
60
- export const Online: Story = {
61
- args: {
62
- online: true,
63
- src: 'https://avatars.githubusercontent.com/u/12534660?v=4',
64
- },
65
- };