@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,97 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed, type CSSProperties, type HTMLAttributes } from 'vue';
3
- import '../../index.css';
4
- export interface IProps extends HTMLAttributes {
5
- /**
6
- * The HTML tag to use for the root element.
7
- * @type HTMLAttributes['is']
8
- * @default 'div'
9
- * @example
10
- * <Box is="span" />
11
- * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/is
12
- */
13
- is: HTMLAttributes['is'];
14
-
15
- /**
16
- * Shorthand for `width` style prop
17
- * @type CSSProperties["width"]
18
- * @default 'auto'
19
- * @example
20
- * <Box width="100%" />
21
- * @link https://developer.mozilla.org/en-US/docs/Web/CSS/width
22
- */
23
- width?: CSSProperties['width'];
24
-
25
- /**
26
- * Shorthand for `height` style prop
27
- * @type CSSProperties["height"]
28
- * @default 'auto'
29
- * @example
30
- * <Box height="100%" />
31
- * @link https://developer.mozilla.org/en-US/docs/Web/CSS/height
32
- */
33
- height?: CSSProperties['height'];
34
-
35
- /**
36
- * Shorthand for `minWidth` style prop
37
- * @type CSSProperties["minWidth"]
38
- * @example
39
- * <Box minWidth="100%" />
40
- * @link https://developer.mozilla.org/en-US/docs/Web/CSS/min-width
41
- */
42
- minWidth?: CSSProperties['minWidth'];
43
-
44
- /**
45
- * Shorthand for `minHeight` style prop
46
- * @type CSSProperties["minHeight"]
47
- * @example
48
- * <Box minHeight="100%" />
49
- * @link https://developer.mozilla.org/en-US/docs/Web/CSS/min-height
50
- */
51
- minHeight?: CSSProperties['minHeight'];
52
-
53
- /**
54
- * Shorthand for `maxWidth` style prop
55
- * @type CSSProperties["maxWidth"]
56
- * @example
57
- * <Box maxWidth="100%" />
58
- * @link https://developer.mozilla.org/en-US/docs/Web/CSS/max-width
59
- */
60
- maxWidth?: CSSProperties['maxWidth'];
61
-
62
- /**
63
- * Shorthand for `maxHeight` style prop
64
- * @type CSSProperties["maxHeight"]
65
- * @example
66
- * <Box maxHeight="100%" />
67
- * @link https://developer.mozilla.org/en-US/docs/Web/CSS/max-height
68
- */
69
- maxHeight?: CSSProperties['maxHeight'];
70
-
71
- /**
72
- * Shorthand for `display` style prop
73
- * @type CSSProperties["display"]
74
- * @default 'block'
75
- * @example
76
- * <Box display="flex" />
77
- * @link https://developer.mozilla.org/en-US/docs/Web/CSS/display
78
- */
79
- display?: CSSProperties['display'];
80
- }
81
- const props = defineProps<IProps>();
82
- const styles = computed(() => ({
83
- display: props.display || 'block',
84
- width: props.width,
85
- height: props.height,
86
- minWidth: props.minWidth,
87
- minHeight: props.minHeight,
88
- maxWidth: props.maxWidth,
89
- }));
90
- const as = computed(() => props.is || 'div');
91
- </script>
92
-
93
- <template>
94
- <component :is="as" class="box" :style="styles">
95
- <slot />
96
- </component>
97
- </template>
@@ -1,115 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/vue3';
2
- import Breadcrumb from './RBreadcrumb.vue';
3
-
4
- const BreadcrumbStory = {
5
- title: 'Components/Breadcrumb',
6
- component: Breadcrumb,
7
- setup: (args: typeof Breadcrumb) => {
8
- return { args };
9
- },
10
- template: `<Breadcrumb v-bind="args" />`,
11
- args: {
12
- items: [
13
- {
14
- title: 'Ads Accounts',
15
- to: '/ads-accounts',
16
- },
17
- {
18
- title: 'Ad Account Detail',
19
- to: '/ads-accounts/123',
20
- },
21
- {
22
- title: 'Transaction History',
23
- to: '/ads-accounts/123/transaction-history',
24
- },
25
- ],
26
- seperator: 'mdiSlashForward',
27
- },
28
- tags: ['autodocs'],
29
- } as Meta<typeof Breadcrumb>;
30
-
31
- export default BreadcrumbStory;
32
-
33
- type Story = StoryObj<typeof BreadcrumbStory>;
34
-
35
- export const Overview: Story = {};
36
-
37
- export const WithSeperator: Story = {
38
- args: {
39
- seperator: 'mdiChevronRight',
40
- },
41
- };
42
-
43
- export const WithItemIcon: Story = {
44
- args: {
45
- items: [
46
- {
47
- title: 'Ads Accounts',
48
- to: '/ads-accounts',
49
- icon: 'mdiAdvertisements',
50
- },
51
- {
52
- title: 'Ad Account Detail',
53
- to: '/ads-accounts/123',
54
- icon: 'mdiAccount',
55
- },
56
- {
57
- title: 'Transaction History',
58
- to: '/ads-accounts/123/transaction-history',
59
- icon: 'mdiAccountFilter',
60
- },
61
- ],
62
- seperator: 'mdiSlashForward',
63
- },
64
- };
65
-
66
- export const WithItemOnlyIcon: Story = {
67
- args: {
68
- items: [
69
- {
70
- title: 'Ads Accounts',
71
- to: '/ads-accounts',
72
- icon: 'mdiAdvertisements',
73
- onlyIcon: true,
74
- },
75
- {
76
- title: 'Ad Account Detail',
77
- to: '/ads-accounts/123',
78
- icon: 'mdiAccount',
79
- onlyIcon: true,
80
- },
81
- {
82
- title: 'Transaction History',
83
- to: '/ads-accounts/123/transaction-history',
84
- icon: 'mdiAccountFilter',
85
- onlyIcon: true,
86
- },
87
- ],
88
- seperator: 'mdiChevronRight',
89
- },
90
- };
91
-
92
- export const LastItemWithIcon: Story = {
93
- args: {
94
- items: [
95
- {
96
- title: 'Ads Accounts',
97
- to: '/ads-accounts',
98
- icon: 'mdiAdvertisements',
99
- onlyIcon: true,
100
- },
101
- {
102
- title: 'Ad Account Detail',
103
- to: '/ads-accounts/123',
104
- icon: 'mdiAccount',
105
- onlyIcon: true,
106
- },
107
- {
108
- title: 'Transaction History',
109
- to: '/ads-accounts/123/transaction-history',
110
- icon: 'mdiAccountFilter',
111
- },
112
- ],
113
- seperator: 'mdiSlashForward',
114
- },
115
- };
@@ -1,43 +0,0 @@
1
- <script setup lang="ts">
2
- import './breadcrumb.css';
3
- import { defineProps, withDefaults } from 'vue';
4
- import RIcon from '../Icon/RIcon.vue';
5
- export interface BreadcrumbItem {
6
- title: string;
7
- to: string;
8
- icon?: string;
9
- onlyIcon?: boolean;
10
- }
11
-
12
- const props = withDefaults(
13
- defineProps<{
14
- items: BreadcrumbItem[];
15
- seperator?: string;
16
- }>(),
17
- {
18
- items: () => [] as BreadcrumbItem[],
19
- seperator: 'mdiChevronRight',
20
- }
21
- );
22
- </script>
23
- <template>
24
- <div class="r-breadcrumb">
25
- <div class="r-breadcrumb__item" v-for="(item, i) in props.items" :key="i">
26
- <router-link :to="item.to" class="r-breadcrumb__link">
27
- <slot name="item-icon">
28
- <RIcon v-if="item.icon" :name="item.icon" />
29
- </slot>
30
- <span v-if="!item.onlyIcon" class="r-breadcrumb__title">{{
31
- item.title
32
- }}</span>
33
- </router-link>
34
- <slot name="custom-seperator">
35
- <RIcon
36
- v-if="i !== items.length - 1 && props.seperator"
37
- :name="props.seperator"
38
- class="r-breadcrumb__separator"
39
- />
40
- </slot>
41
- </div>
42
- </div>
43
- </template>
@@ -1,29 +0,0 @@
1
- @import '../../index.css';
2
-
3
- .r-breadcrumb {
4
- @apply flex items-center;
5
-
6
- &__item {
7
- @apply flex items-center cursor-pointer;
8
-
9
- &:last-child {
10
- @apply pointer-events-none;
11
- }
12
- }
13
-
14
- &__link {
15
- @apply flex text-2xl text-[var(--breadcrumb-text-color)] hover:text-[var(--breadcrumb-text-color-hover)] gap-2 items-center;
16
-
17
- &:last-child {
18
- @apply font-bold !text-[var(--breadcrumb-text-color-active)];
19
- }
20
-
21
- &:not(:last-child) {
22
- @apply hover:underline font-medium;
23
- }
24
- }
25
-
26
- &__separator {
27
- @apply flex items-center mx-2 text-[var(--breadcrumb-text-color)];
28
- }
29
- }
@@ -1,148 +0,0 @@
1
- import { Canvas, Meta, Story, Controls } from '@storybook/blocks';
2
- import * as ButtonStories from './Button.stories';
3
-
4
- <Meta of={ButtonStories} />
5
-
6
- # Button
7
-
8
- Button is a clickable element that is used to trigger an action or event, such as submitting a form, opening a dialog, canceling an action, or performing a delete operation.
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 button component is a reusable piece of code that can be used in any part of a website or application. It is typically represented by a text or an icon that represents the action that will be performed when the user clicks on it.
23
-
24
- <Canvas>
25
- <Story of={ButtonStories.Overview} />
26
- </Canvas>
27
-
28
- ### Playground <a id="playground" />
29
-
30
- <Controls
31
- of={ButtonStories.Overview}
32
- exclude={/^(click|content|default|custom-icon|on.*)$/}
33
- />
34
-
35
- ## Usage with props <a id="usage" />
36
-
37
- ### variant (required)
38
-
39
- The **variant** prop allows you to specify the appearance of the button. The possible values for this prop are primary, secondary, text, and outline.
40
-
41
- ### loading (optional)
42
-
43
- The **loading** prop allows you to specify whether the button is in a loading state. When the button is in a loading state, it will display a loading indicator (e.g. a spinning spinner) instead of the button text.
44
- To set the button to a loading state, you can pass in the value true to the loading prop.
45
-
46
- ### disabled (optional)
47
-
48
- The **disabled** prop allows you to specify whether the button is disabled. A disabled button is not interactive and cannot be clicked on.
49
- To disable a button, you can pass in the value true to the disabled prop.
50
-
51
- ### prependIcon (optional)
52
-
53
- The **prependIcon** prop allows you to specify an icon that will be placed before the button text. This can be used to add visual context to the button.
54
- To add an icon to the button, you can pass in the name of the icon as a string to the prependIcon prop.
55
-
56
- ### appendIcon (optional)
57
-
58
- The **appendIcon** prop is similar to the prependIcon prop, but it allows you to specify an icon that will be placed after the button text.
59
- To add an icon to the button, you can pass in the name of the icon as a string to the appendIcon prop.
60
-
61
- ### size (optional)
62
-
63
- The **size** prop allows you to specify the size of the button. The possible values for this prop are: small, medium, and large.
64
-
65
- ### height (optional)
66
-
67
- The **height** prop allows you to specify the height of the button. This can be useful if you want to create buttons with different heights, or if you want to match the height of the button to the height of other elements on the page.
68
- To specify the height of the button, you can pass in a numeric value (in pixels) to the height prop.
69
-
70
- ### block (optional)
71
-
72
- The **block** prop allows you to specify whether the button should be displayed as a block element. When a button is a block element, it will take up the full width of its container.
73
- To make a button a block element, you can pass in the value true to the block prop.
74
-
75
- ### backgroundColor (optional)
76
-
77
- The **backgroundColor** prop allows you to specify the background color of the button. This can be useful if you want to create buttons with different background colors, or if you want to match the background color of the button to the color scheme of your website or application.
78
- To specify the background color of the button, you can pass in a valid CSS color value to the backgroundColor prop.
79
-
80
- ## Variants <a id="variants" />
81
-
82
- ### Primary
83
-
84
- <Canvas>
85
- <Story of={ButtonStories.Primary} />
86
- </Canvas>
87
-
88
- ### Secondary
89
-
90
- <Canvas>
91
- <Story of={ButtonStories.Secondary} />
92
- </Canvas>
93
-
94
- ### Outline
95
-
96
- <Canvas>
97
- <Story of={ButtonStories.Outline} />
98
- </Canvas>
99
-
100
- ### Text
101
-
102
- <Canvas>
103
- <Story of={ButtonStories.Text} />
104
- </Canvas>
105
-
106
- ### Danger
107
-
108
- <Canvas>
109
- <Story of={ButtonStories.Danger} />
110
- </Canvas>
111
-
112
- ### Link
113
-
114
- <Canvas>
115
- <Story of={ButtonStories.Link} />
116
- </Canvas>
117
-
118
- ### `#Custom Icon Slot`
119
-
120
- <Canvas>
121
- <Story of={ButtonStories.CustomIcon} />
122
- </Canvas>
123
-
124
- ### Unstyled
125
-
126
- #### \* Not yet implemented in the library
127
-
128
- <Canvas>
129
- <Story of={ButtonStories.Unstyled} />
130
- </Canvas>
131
-
132
- ### Tips <a id="tips" />
133
-
134
- 💡 Use the variant prop to create buttons with different appearances, such as primary, secondary, text, and outline.
135
-
136
- 💡 Use the loading prop to show a loading indicator on the button when it is performing an action.
137
-
138
- 💡 Use the disabled prop to make a button non-interactive when it is not needed.
139
-
140
- 💡 Use the prependIcon and appendIcon props to add visual context to the button.
141
-
142
- 💡 Use the size prop to create buttons with different sizes, such as small, medium, and large.
143
-
144
- 💡 Use the height prop to match the height of the button to the height of other elements on the page.
145
-
146
- 💡 Use the block prop to make the button take up the full width of its container.
147
-
148
- 💡 Use the backgroundColor prop to match the background color of the button to the color scheme of your website or application.
@@ -1,29 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
-
3
- import { mount } from '@vue/test-utils';
4
- import Button from './RButton.vue';
5
-
6
- describe('Button', () => {
7
- it('renders properly', () => {
8
- const wrapper = mount(Button, {
9
- props: {
10
- variant: 'primary',
11
- size: 'large',
12
- type: 'button',
13
- backgroundColor: '#fff',
14
- },
15
- });
16
- expect(wrapper.classes()).toContain('button');
17
- expect(wrapper.classes()).toContain('button--primary');
18
- expect(wrapper.attributes('type')).toBe('button');
19
- expect(wrapper.exists()).toBe(true);
20
- expect(wrapper.find('.button').attributes('type')).toBe('button');
21
- });
22
- });
23
- describe('when clicked', () => {
24
- it('emits an event', () => {
25
- const wrapper = mount(Button);
26
- wrapper.trigger('click');
27
- expect(wrapper.emitted().click).toBeTruthy();
28
- });
29
- });
@@ -1,118 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/vue3';
2
- import Button from './RButton.vue';
3
- import Icon from '../Icon/RIcon.vue';
4
-
5
- const DefaultArgTypes = {
6
- variant: {
7
- type: 'select',
8
- options: ['primary', 'secondary', 'text', 'outline'],
9
- },
10
- size: {
11
- type: 'select',
12
- options: ['small', 'medium', 'large'],
13
- },
14
- backgroundColor: {
15
- control: {
16
- type: 'color',
17
- },
18
- },
19
- onClick: {
20
- action: 'click',
21
- },
22
- };
23
-
24
- const WithCustomIconSlot = {
25
- render: (args: any) => ({
26
- components: { Button, Icon },
27
- setup: () => {
28
- return {
29
- args,
30
- };
31
- },
32
- template: `
33
- <Button v-bind="args">
34
- <template v-slot:custom-icon>
35
- <Icon name="mdiFingerprint"/>
36
- </template>
37
- </Button>`,
38
- }),
39
- argTypes: DefaultArgTypes,
40
- args: {},
41
- } as Meta<typeof Button>;
42
-
43
- const ButtonStory = {
44
- title: 'Form/Button',
45
- component: Button,
46
- setup(args: typeof Button) {
47
- return {
48
- args,
49
- };
50
- },
51
- template: `<Button v-bind="args"/>`,
52
- args: {
53
- variant: 'primary',
54
- default: 'Button',
55
- },
56
- argTypes: DefaultArgTypes,
57
- } as Meta<typeof Button>;
58
-
59
- export default ButtonStory;
60
-
61
- type Story = StoryObj<typeof ButtonStory>;
62
-
63
- export const Overview: Story = {
64
- args: {
65
- variant: 'primary',
66
- default: 'Button',
67
- },
68
- };
69
-
70
- export const Primary: Story = {
71
- args: {
72
- variant: 'primary',
73
- default: 'Primary',
74
- },
75
- };
76
-
77
- export const Secondary: Story = {
78
- args: {
79
- variant: 'secondary',
80
- default: 'Secondary',
81
- },
82
- };
83
-
84
- export const Outline: Story = {
85
- args: {
86
- variant: 'outline',
87
- default: 'Outline',
88
- },
89
- };
90
-
91
- export const Text: Story = {
92
- args: {
93
- variant: 'text',
94
- default: 'Text',
95
- },
96
- };
97
-
98
- export const Danger: Story = {
99
- args: {
100
- variant: 'danger',
101
- default: 'Danger',
102
- },
103
- };
104
-
105
- export const Link: Story = {
106
- args: {
107
- variant: 'link',
108
- default: 'Link',
109
- },
110
- };
111
-
112
- export const CustomIcon = {
113
- render: WithCustomIconSlot.render,
114
- };
115
-
116
- export const Unstyled = {
117
- render: WithCustomIconSlot.render,
118
- };