@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.
- package/dist/rocket-ui-vue.cjs.js +1 -0
- package/dist/rocket-ui-vue.d.ts +1812 -0
- package/dist/rocket-ui-vue.es.js +9270 -0
- package/dist/rocket-ui-vue.umd.js +1 -0
- package/dist/style.css +2 -0
- package/package.json +7 -1
- package/.eslintrc.cjs +0 -79
- package/.gitattributes +0 -2
- package/.github/workflows/chromatic.yml +0 -28
- package/.github/workflows/publish-storybook.yml +0 -41
- package/.husky/pre-commit +0 -4
- package/.prettierrc.cjs +0 -10
- package/.storybook/Theme.js +0 -17
- package/.storybook/main.ts +0 -20
- package/.storybook/manager-head.html +0 -3
- package/.storybook/manager.js +0 -8
- package/.storybook/preview-head.html +0 -3
- package/.storybook/preview.ts +0 -36
- package/.storybook/source-panel/manager.js +0 -28
- package/.storybook/withSource.js +0 -91
- package/.vscode/extensions.json +0 -11
- package/.vscode/settings.json +0 -20
- package/index.html +0 -13
- package/lib/main.ts +0 -48
- package/postcss.config.cjs +0 -9
- package/resources/rocket-ui-logo-dark.svg +0 -27
- package/resources/rocket-ui-logo-light.svg +0 -27
- package/shims-rocketui.d.ts +0 -9
- package/src/App.vue +0 -15
- package/src/assets/blank-avatar.svg +0 -3
- package/src/assets/icons/mdi.js +0 -7302
- package/src/assets/logo.svg +0 -1
- package/src/components/Accordion/Accordion.mdx +0 -88
- package/src/components/Accordion/Accordion.stories.ts +0 -257
- package/src/components/Accordion/RAccordion.vue +0 -73
- package/src/components/Accordion/accordion.css +0 -75
- package/src/components/Accordion/accordion.spec.ts +0 -123
- package/src/components/Alert/Alert.mdx +0 -120
- package/src/components/Alert/Alert.stories.ts +0 -118
- package/src/components/Alert/RAlert.vue +0 -119
- package/src/components/Alert/alert.css +0 -136
- package/src/components/Alert/alert.spec.ts +0 -32
- package/src/components/Avatar/Avatar.mdx +0 -96
- package/src/components/Avatar/Avatar.stories.ts +0 -65
- package/src/components/Avatar/RAvatar.vue +0 -115
- package/src/components/Avatar/avatar.css +0 -82
- package/src/components/Avatar/avatar.spec.ts +0 -38
- package/src/components/Badge/Badge.mdx +0 -112
- package/src/components/Badge/Badge.stories.ts +0 -99
- package/src/components/Badge/RBadge.vue +0 -89
- package/src/components/Badge/badge.css +0 -63
- package/src/components/Badge/badge.spec.ts +0 -20
- package/src/components/Box/Box.mdx +0 -20
- package/src/components/Box/Box.stories.ts +0 -56
- package/src/components/Box/RBox.vue +0 -97
- package/src/components/Breadcrumb/Breadcrumb.stories.ts +0 -115
- package/src/components/Breadcrumb/RBreadcrumb.vue +0 -43
- package/src/components/Breadcrumb/breadcrumb.css +0 -29
- package/src/components/Button/Button.mdx +0 -148
- package/src/components/Button/Button.spec.ts +0 -29
- package/src/components/Button/Button.stories.ts +0 -118
- package/src/components/Button/RButton.vue +0 -179
- package/src/components/Button/button.css +0 -146
- package/src/components/Checkbox/Checkbox.mdx +0 -100
- package/src/components/Checkbox/Checkbox.stories.ts +0 -67
- package/src/components/Checkbox/RCheckbox.vue +0 -195
- package/src/components/Checkbox/checkbox.css +0 -67
- package/src/components/Checkbox/checkbox.spec.ts +0 -60
- package/src/components/Chips/Chip.mdx +0 -113
- package/src/components/Chips/Chip.stories.ts +0 -122
- package/src/components/Chips/RChip.vue +0 -125
- package/src/components/Chips/chip.css +0 -62
- package/src/components/Chips/chip.spec.ts +0 -40
- package/src/components/Dropdown/Dropdown.mdx +0 -135
- package/src/components/Dropdown/Dropdown.stories.ts +0 -84
- package/src/components/Dropdown/RDropdown.vue +0 -392
- package/src/components/Dropdown/dropdown.css +0 -113
- package/src/components/Dropdown/dropdown.spec.ts +0 -98
- package/src/components/Flex/Flex.mdx +0 -20
- package/src/components/Flex/Flex.stories.js +0 -127
- package/src/components/Flex/RFlex.vue +0 -91
- package/src/components/Grid/Grid.mdx +0 -20
- package/src/components/Grid/Grid.stories.js +0 -107
- package/src/components/Grid/RGrid.vue +0 -138
- package/src/components/Icon/Icon.mdx +0 -68
- package/src/components/Icon/Icon.stories.ts +0 -33
- package/src/components/Icon/RIcon.vue +0 -56
- package/src/components/Icon/icon.spec.ts +0 -25
- package/src/components/ItemGroup/ItemGroup.stories.ts +0 -91
- package/src/components/ItemGroup/RItem.vue +0 -74
- package/src/components/ItemGroup/RItemGroup.vue +0 -122
- package/src/components/ItemGroup/__snapshots__/itemgroup.spec.ts.snap +0 -13
- package/src/components/ItemGroup/itemgroup.spec.ts +0 -67
- package/src/components/Label/Label.mdx +0 -50
- package/src/components/Label/Label.stories.ts +0 -38
- package/src/components/Label/RLabel.vue +0 -42
- package/src/components/Label/label.css +0 -0
- package/src/components/Modal/Modal.mdx +0 -91
- package/src/components/Modal/Modal.stories.ts +0 -125
- package/src/components/Modal/RModal.vue +0 -130
- package/src/components/Modal/modal.css +0 -41
- package/src/components/Modal/modal.spec.ts +0 -25
- package/src/components/Pagination/Pagination.stories.ts +0 -24
- package/src/components/Pagination/RPagination.vue +0 -103
- package/src/components/Pagination/pagination.css +0 -47
- package/src/components/Pagination/pagination.spec.ts +0 -17
- package/src/components/ProgressBar/ProgressBar.stories.ts +0 -34
- package/src/components/ProgressBar/RProgressBar.vue +0 -21
- package/src/components/ProgressBar/progressbar.css +0 -24
- package/src/components/ProgressBar/progressbar.spec.ts +0 -17
- package/src/components/Shared/Enums.ts +0 -1
- package/src/components/Sidebar/RSidebar.vue +0 -27
- package/src/components/Sidebar/Sidebar.mdx +0 -31
- package/src/components/Sidebar/Sidebar.stories.ts +0 -34
- package/src/components/Sidebar/sidebar.css +0 -18
- package/src/components/Sidebar/sidebar.spec.ts +0 -33
- package/src/components/Snackbar/RSnackbar.vue +0 -136
- package/src/components/Snackbar/Snackbar.mdx +0 -126
- package/src/components/Snackbar/Snackbar.stories.ts +0 -93
- package/src/components/Snackbar/snackbar.css +0 -99
- package/src/components/Snackbar/snackbar.spec.ts +0 -56
- package/src/components/Switch/RSwitch.vue +0 -147
- package/src/components/Switch/Switch.mdx +0 -102
- package/src/components/Switch/Switch.stories.ts +0 -79
- package/src/components/Switch/switch.css +0 -102
- package/src/components/Switch/switch.spec.ts +0 -31
- package/src/components/TabItem/RTabItem.vue +0 -175
- package/src/components/TabItem/TabItem.mdx +0 -95
- package/src/components/TabItem/TabItem.spec.ts +0 -29
- package/src/components/TabItem/TabItem.stories.ts +0 -97
- package/src/components/TabItem/common.ts +0 -6
- package/src/components/TabItem/tab-item.css +0 -29
- package/src/components/Tabs/RTabs.vue +0 -94
- package/src/components/Tabs/Tabs.mdx +0 -78
- package/src/components/Tabs/Tabs.spec.ts +0 -28
- package/src/components/Tabs/Tabs.stories.ts +0 -191
- package/src/components/Tabs/tabs.css +0 -13
- package/src/components/Tabs/types.ts +0 -11
- package/src/components/TextArea/RTextArea.vue +0 -142
- package/src/components/TextArea/TextArea.mdx +0 -108
- package/src/components/TextArea/TextArea.stories.ts +0 -55
- package/src/components/TextArea/textarea.css +0 -51
- package/src/components/TextArea/textarea.spec.ts +0 -36
- package/src/components/Textfield/RTextfield.vue +0 -372
- package/src/components/Textfield/Textfield.mdx +0 -159
- package/src/components/Textfield/Textfield.stories.ts +0 -121
- package/src/components/Textfield/textfield.css +0 -81
- package/src/components/Textfield/textfield.spec.ts +0 -34
- package/src/components/Tooltip/RTooltip.vue +0 -325
- package/src/components/Tooltip/Tooltip.mdx +0 -111
- package/src/components/Tooltip/Tooltip.stories.ts +0 -203
- package/src/components/Tooltip/common.ts +0 -91
- package/src/components/Tooltip/tooltip.css +0 -34
- package/src/components/Tooltip/tooltip.spec.ts +0 -81
- package/src/components/Typography/Typography.mdx +0 -109
- package/src/components/Typography/typography.css +0 -128
- package/src/directives/index.ts +0 -19
- package/src/index.css +0 -241
- package/src/main.ts +0 -5
- package/src/scripts/buildIcons.js +0 -21
- package/src/stories/Colors.mdx +0 -355
- package/src/stories/GettingStarted.mdx +0 -121
- package/src/stories/Layout.mdx +0 -15
- package/tailwind.config.cjs +0 -16
- package/tsconfig.json +0 -24
- package/vite.config.ts +0 -39
- package/vitest.config.ts +0 -12
- /package/{public → dist}/design-tokens.source.json +0 -0
- /package/{public → dist}/favicon.ico +0 -0
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
2
|
-
import Tabs from './RTabs.vue';
|
|
3
|
-
|
|
4
|
-
const DefaultArgs = {
|
|
5
|
-
tabs: [
|
|
6
|
-
{ id: 0, label: 'Tab 1', prependIcon: 'mdiHome' },
|
|
7
|
-
{ id: 1, label: 'Tab 2', prependIcon: 'mdiPlusCircle', disabled: true },
|
|
8
|
-
{ id: 2, label: 'Tab 3', prependIcon: 'mdiHeart' },
|
|
9
|
-
{ id: 3, label: 'Tab 4', prependIcon: 'mdiFaceMan' },
|
|
10
|
-
{ id: 4, label: 'Tab 5', prependIcon: 'mdiCog', appendIcon: 'mdiClose' },
|
|
11
|
-
],
|
|
12
|
-
block: false,
|
|
13
|
-
activeTab: 0,
|
|
14
|
-
tile: false,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const TabsStory = {
|
|
18
|
-
title: 'Components/Tabs',
|
|
19
|
-
component: Tabs,
|
|
20
|
-
setup(args: typeof Tabs) {
|
|
21
|
-
return { args };
|
|
22
|
-
},
|
|
23
|
-
template: `
|
|
24
|
-
<Tabs v-bind="args" >
|
|
25
|
-
<template #tab={activeTab}>
|
|
26
|
-
<h1>Tab {{activeTab + 1}}</h1>
|
|
27
|
-
<p>Active tab {{activeTab}}</p>
|
|
28
|
-
</template>
|
|
29
|
-
</Tabs>
|
|
30
|
-
`,
|
|
31
|
-
args: { ...DefaultArgs },
|
|
32
|
-
argTypes: {
|
|
33
|
-
'onUpdate:modelValue': { action: 'onUpdate:modelValue' },
|
|
34
|
-
},
|
|
35
|
-
} as Meta<typeof Tabs>;
|
|
36
|
-
|
|
37
|
-
export default TabsStory;
|
|
38
|
-
|
|
39
|
-
type Story = StoryObj<typeof TabsStory>;
|
|
40
|
-
|
|
41
|
-
export const Overview: Story = {};
|
|
42
|
-
|
|
43
|
-
export const Default: Story = {};
|
|
44
|
-
|
|
45
|
-
export const Icon: Story = {
|
|
46
|
-
args: {
|
|
47
|
-
tabs: [
|
|
48
|
-
{
|
|
49
|
-
id: 0,
|
|
50
|
-
label: 'Tab 1',
|
|
51
|
-
prependIcon: 'mdiHome',
|
|
52
|
-
variant: 'icon',
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
id: 1,
|
|
56
|
-
label: 'Tab 2',
|
|
57
|
-
prependIcon: 'mdiPlusCircle',
|
|
58
|
-
disabled: true,
|
|
59
|
-
variant: 'icon',
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
id: 2,
|
|
63
|
-
label: 'Tab 3',
|
|
64
|
-
prependIcon: 'mdiHeart',
|
|
65
|
-
variant: 'icon',
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
id: 3,
|
|
69
|
-
label: 'Tab 4',
|
|
70
|
-
prependIcon: 'mdiFaceMan',
|
|
71
|
-
variant: 'icon',
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
id: 4,
|
|
75
|
-
label: 'Tab 5',
|
|
76
|
-
prependIcon: 'mdiCog',
|
|
77
|
-
variant: 'icon',
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
id: 5,
|
|
81
|
-
label: 'Tab 6',
|
|
82
|
-
prependIcon: 'mdiMagnify',
|
|
83
|
-
variant: 'icon',
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
id: 6,
|
|
87
|
-
label: 'Tab 7',
|
|
88
|
-
prependIcon: 'mdiAccount',
|
|
89
|
-
variant: 'icon',
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
id: 7,
|
|
93
|
-
label: 'Tab 8',
|
|
94
|
-
prependIcon: 'mdiAccountGroup',
|
|
95
|
-
variant: 'icon',
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
id: 8,
|
|
99
|
-
label: 'Tab 9',
|
|
100
|
-
prependIcon: 'mdiAccountMultiple',
|
|
101
|
-
variant: 'icon',
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
id: 9,
|
|
105
|
-
label: 'Tab 10',
|
|
106
|
-
prependIcon: 'mdiAccountMultiplePlus',
|
|
107
|
-
variant: 'icon',
|
|
108
|
-
},
|
|
109
|
-
],
|
|
110
|
-
},
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
export const Text: Story = {
|
|
114
|
-
args: {
|
|
115
|
-
tabs: [
|
|
116
|
-
{
|
|
117
|
-
id: 0,
|
|
118
|
-
label: 'Tab 1',
|
|
119
|
-
prependIcon: 'mdiHome',
|
|
120
|
-
variant: 'text',
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
id: 1,
|
|
124
|
-
label: 'Tab 2',
|
|
125
|
-
prependIcon: 'mdiPlusCircle',
|
|
126
|
-
disabled: true,
|
|
127
|
-
variant: 'text',
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
id: 2,
|
|
131
|
-
label: 'Tab 3',
|
|
132
|
-
prependIcon: 'mdiHeart',
|
|
133
|
-
variant: 'text',
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
id: 3,
|
|
137
|
-
label: 'Tab 4',
|
|
138
|
-
prependIcon: 'mdiFaceMan',
|
|
139
|
-
variant: 'text',
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
id: 4,
|
|
143
|
-
label: 'Tab 5',
|
|
144
|
-
prependIcon: 'mdiCog',
|
|
145
|
-
variant: 'text',
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
id: 5,
|
|
149
|
-
label: 'Tab 6',
|
|
150
|
-
prependIcon: 'mdiMagnify',
|
|
151
|
-
variant: 'text',
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
id: 6,
|
|
155
|
-
label: 'Tab 7',
|
|
156
|
-
prependIcon: 'mdiAccount',
|
|
157
|
-
variant: 'text',
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
id: 7,
|
|
161
|
-
label: 'Tab 8',
|
|
162
|
-
prependIcon: 'mdiAccountGroup',
|
|
163
|
-
variant: 'text',
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
id: 8,
|
|
167
|
-
label: 'Tab 9',
|
|
168
|
-
prependIcon: 'mdiAccountMultiple',
|
|
169
|
-
variant: 'text',
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
id: 9,
|
|
173
|
-
label: 'Tab 10',
|
|
174
|
-
prependIcon: 'mdiAccountMultiplePlus',
|
|
175
|
-
variant: 'text',
|
|
176
|
-
},
|
|
177
|
-
],
|
|
178
|
-
},
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
export const Tile: Story = {
|
|
182
|
-
args: {
|
|
183
|
-
tile: true,
|
|
184
|
-
tabs: [
|
|
185
|
-
{ id: 1, label: 'Section', prependIcon: 'mdiHeart' },
|
|
186
|
-
{ id: 2, label: 'Section', prependIcon: 'mdiFaceMan' },
|
|
187
|
-
{ id: 3, label: 'Section', prependIcon: 'mdiCog' },
|
|
188
|
-
],
|
|
189
|
-
modelValue: 2,
|
|
190
|
-
},
|
|
191
|
-
};
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import Label from '../Label/RLabel.vue';
|
|
3
|
-
import './textarea.css';
|
|
4
|
-
import {
|
|
5
|
-
defineProps,
|
|
6
|
-
defineEmits,
|
|
7
|
-
reactive,
|
|
8
|
-
watch,
|
|
9
|
-
type HTMLAttributes,
|
|
10
|
-
type InputHTMLAttributes,
|
|
11
|
-
type LabelHTMLAttributes,
|
|
12
|
-
} from 'vue';
|
|
13
|
-
export interface IProps {
|
|
14
|
-
/**
|
|
15
|
-
* id of the textarea
|
|
16
|
-
* @type HTMLAttributes['id']
|
|
17
|
-
* @default ''
|
|
18
|
-
* @example
|
|
19
|
-
* <TextArea id="textarea" />
|
|
20
|
-
* @link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
|
|
21
|
-
*/
|
|
22
|
-
id: HTMLAttributes['id'];
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Input value
|
|
26
|
-
* @type InputHTMLAttributes['value'];
|
|
27
|
-
* @default ''
|
|
28
|
-
* @example
|
|
29
|
-
* <TextArea modelValue="Hello" />
|
|
30
|
-
* @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#value
|
|
31
|
-
*/
|
|
32
|
-
modelValue?: InputHTMLAttributes['value'];
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* label of the textarea
|
|
36
|
-
* @type LabelHTMLAttributes['label']
|
|
37
|
-
* @default ''
|
|
38
|
-
* @example
|
|
39
|
-
* <TextArea label="TextArea" />
|
|
40
|
-
* @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label
|
|
41
|
-
*/
|
|
42
|
-
label?: LabelHTMLAttributes['for'];
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Placeholder text
|
|
46
|
-
* @type InputHTMLAttributes['placeholder'];
|
|
47
|
-
* @default ''
|
|
48
|
-
* @example
|
|
49
|
-
* <TextArea placeholder="Placeholder" />
|
|
50
|
-
* @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#placeholder
|
|
51
|
-
*/
|
|
52
|
-
placeholder?: InputHTMLAttributes['placeholder'];
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Disabled state
|
|
56
|
-
* @type InputHTMLAttributes['disabled'];
|
|
57
|
-
* @default false
|
|
58
|
-
* @example
|
|
59
|
-
* <TextArea disabled />
|
|
60
|
-
* @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#disabled
|
|
61
|
-
*/
|
|
62
|
-
disabled?: InputHTMLAttributes['disabled'];
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Hint text
|
|
66
|
-
* @type string
|
|
67
|
-
* @default 'This is a hint'
|
|
68
|
-
* @example
|
|
69
|
-
* <TextArea hint="This is a hint" />
|
|
70
|
-
*/
|
|
71
|
-
hint?: string;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Error message
|
|
75
|
-
* @type string
|
|
76
|
-
* @default ''
|
|
77
|
-
* @example
|
|
78
|
-
* <TextArea errorMsg="This is an error" />
|
|
79
|
-
*/
|
|
80
|
-
errorMsg?: string;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const props = withDefaults(defineProps<IProps>(), {
|
|
84
|
-
id: '',
|
|
85
|
-
errorMsg: '',
|
|
86
|
-
disabled: false,
|
|
87
|
-
placeholder: '',
|
|
88
|
-
modelValue: '',
|
|
89
|
-
label: '',
|
|
90
|
-
hint: 'This is a hint',
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
const state = reactive({
|
|
94
|
-
value: '',
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
const emit = defineEmits(['update:modelValue']);
|
|
98
|
-
|
|
99
|
-
function onInput(e: Event) {
|
|
100
|
-
emit('update:modelValue', (e.target as HTMLInputElement).value);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
watch(
|
|
104
|
-
() => props.modelValue,
|
|
105
|
-
(value) => {
|
|
106
|
-
state.value = value;
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
immediate: true,
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
</script>
|
|
113
|
-
|
|
114
|
-
<template>
|
|
115
|
-
<div class="container">
|
|
116
|
-
<Label
|
|
117
|
-
v-if="props.label"
|
|
118
|
-
id="textarea"
|
|
119
|
-
class="textarea__label"
|
|
120
|
-
for="textarea"
|
|
121
|
-
:text="props.label"
|
|
122
|
-
/>
|
|
123
|
-
<textarea
|
|
124
|
-
:id="props.id"
|
|
125
|
-
class="textarea"
|
|
126
|
-
:class="{
|
|
127
|
-
'textarea--error': props.errorMsg,
|
|
128
|
-
'textarea--disabled': props.disabled,
|
|
129
|
-
}"
|
|
130
|
-
:disabled="props.disabled"
|
|
131
|
-
:placeholder="props.placeholder"
|
|
132
|
-
:value="state.value"
|
|
133
|
-
@input="onInput"
|
|
134
|
-
/>
|
|
135
|
-
<p v-if="props.errorMsg" class="textarea__error">
|
|
136
|
-
{{ props.errorMsg }}
|
|
137
|
-
</p>
|
|
138
|
-
<p v-else class="textarea__hint">
|
|
139
|
-
{{ props.hint }}
|
|
140
|
-
</p>
|
|
141
|
-
</div>
|
|
142
|
-
</template>
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { Canvas, Meta, Story, Controls } from '@storybook/blocks';
|
|
2
|
-
import * as TextAreaStories from './TextArea.stories';
|
|
3
|
-
|
|
4
|
-
<Meta of={TextAreaStories} />
|
|
5
|
-
|
|
6
|
-
# TextArea
|
|
7
|
-
|
|
8
|
-
The TextArea component is a UI element that allows users to input and edit multiple lines of text.
|
|
9
|
-
|
|
10
|
-
- [Overview](#overview)
|
|
11
|
-
|
|
12
|
-
- [Playground](#playground)
|
|
13
|
-
|
|
14
|
-
- [Usage with props](#usage)
|
|
15
|
-
|
|
16
|
-
- [Stories](#stories)
|
|
17
|
-
|
|
18
|
-
- [Tips](#tips)
|
|
19
|
-
|
|
20
|
-
## Overview <a id="overview" />
|
|
21
|
-
|
|
22
|
-
This component provides a text area for user input and includes several optional props for customization such as error message, disabled state, placeholder text, default value, label, and hint.
|
|
23
|
-
|
|
24
|
-
<Canvas>
|
|
25
|
-
<Story of={TextAreaStories.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={TextAreaStories.Overview} exclude={/^(click|tab|on.*)/} />
|
|
33
|
-
|
|
34
|
-
## Usage <a id="usage" />
|
|
35
|
-
|
|
36
|
-
### id (required)
|
|
37
|
-
|
|
38
|
-
The **id** prop is a unique identifier for the TextArea component.
|
|
39
|
-
|
|
40
|
-
### errorMsg (optional)
|
|
41
|
-
|
|
42
|
-
The **errorMsg** prop is the error message to display when input is invalid.
|
|
43
|
-
|
|
44
|
-
### disabled (optional)
|
|
45
|
-
|
|
46
|
-
The **disabled** props is a boolean value that sets the component to a disabled state.
|
|
47
|
-
|
|
48
|
-
### placeholder (optional)
|
|
49
|
-
|
|
50
|
-
The **placeholder** prop is the placeholder text to display when the text area is empty.
|
|
51
|
-
|
|
52
|
-
### modelValue (optional)
|
|
53
|
-
|
|
54
|
-
The **modelValue** props is the default value for the text area.
|
|
55
|
-
|
|
56
|
-
### label (optional)
|
|
57
|
-
|
|
58
|
-
The **label** prop is the text to display as a label for the text area.
|
|
59
|
-
|
|
60
|
-
### hint (optional)
|
|
61
|
-
|
|
62
|
-
The **hint** prop is for additional information or context for the text area.
|
|
63
|
-
|
|
64
|
-
## Stories <a id="stories" />
|
|
65
|
-
|
|
66
|
-
### Default
|
|
67
|
-
|
|
68
|
-
<Canvas>
|
|
69
|
-
<Story of={TextAreaStories.Default} />
|
|
70
|
-
</Canvas>
|
|
71
|
-
|
|
72
|
-
### Disabled
|
|
73
|
-
|
|
74
|
-
<Canvas>
|
|
75
|
-
<Story of={TextAreaStories.Disabled} />
|
|
76
|
-
</Canvas>
|
|
77
|
-
|
|
78
|
-
### Hint
|
|
79
|
-
|
|
80
|
-
<Canvas>
|
|
81
|
-
<Story of={TextAreaStories.Hint} />
|
|
82
|
-
</Canvas>
|
|
83
|
-
|
|
84
|
-
### Error
|
|
85
|
-
|
|
86
|
-
<Canvas>
|
|
87
|
-
<Story of={TextAreaStories.Error} />
|
|
88
|
-
</Canvas>
|
|
89
|
-
|
|
90
|
-
### Tips <a id="tips" />
|
|
91
|
-
|
|
92
|
-
💡 Always include the 'id' prop: The 'id' prop is required for the TextArea component to function properly. Make sure to always include it and ensure that it is unique for each instance of the component.
|
|
93
|
-
|
|
94
|
-
💡 The 'label' prop is used to provide a text description of the TextArea component for accessibility purposes. This is especially important for users who rely on screen readers to navigate your application.
|
|
95
|
-
|
|
96
|
-
💡 The 'placeholder' prop allows you to provide users with an example or a hint of the kind of input you expect. This can be especially helpful for users who may not be sure what to type in the TextArea.
|
|
97
|
-
|
|
98
|
-
💡 The 'modelValue' prop allows you to set a default value for the TextArea component. This can be useful if you want to pre-populate the TextArea with a value or if you want to show the last input a user made.
|
|
99
|
-
|
|
100
|
-
💡 The 'errorMsg' prop allows you to display an error message when the input is invalid. This can be useful for providing feedback to the user when they make a mistake.
|
|
101
|
-
|
|
102
|
-
💡 The 'disabled' prop allows you to disable the textarea. This can be useful when you want to prevent users from making changes or inputting text.
|
|
103
|
-
|
|
104
|
-
💡 The 'hint' prop allows you to provide additional context or information about the TextArea component. This can be useful for providing more detailed instructions or information to the user.
|
|
105
|
-
|
|
106
|
-
💡 Limit the number of characters that can be entered, to avoid overflowing the layout or taking too much space in the database.
|
|
107
|
-
|
|
108
|
-
💡 Make sure the text area is adaptable to different screen sizes, to improve the user experience on different devices
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
2
|
-
import TextArea from './RTextArea.vue';
|
|
3
|
-
|
|
4
|
-
const DefaultArgs = {
|
|
5
|
-
errorMsg: '',
|
|
6
|
-
label: 'Text Area',
|
|
7
|
-
placeholder: 'RocketUI',
|
|
8
|
-
modelValue: '',
|
|
9
|
-
disabled: false,
|
|
10
|
-
hint: 'A form control for editing multi-line text.',
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const TextAreaStory = {
|
|
14
|
-
title: 'Form/TextArea',
|
|
15
|
-
component: TextArea,
|
|
16
|
-
setup(args: typeof TextArea) {
|
|
17
|
-
return { args };
|
|
18
|
-
},
|
|
19
|
-
template: `<TextArea v-bind="args"/>`,
|
|
20
|
-
args: DefaultArgs,
|
|
21
|
-
argTypes: {
|
|
22
|
-
onInput: { action: 'input' },
|
|
23
|
-
},
|
|
24
|
-
} as Meta<typeof TextArea>;
|
|
25
|
-
|
|
26
|
-
export default TextAreaStory;
|
|
27
|
-
|
|
28
|
-
type Story = StoryObj<typeof TextAreaStory>;
|
|
29
|
-
|
|
30
|
-
export const Overview: Story = {};
|
|
31
|
-
|
|
32
|
-
export const Default: Story = {
|
|
33
|
-
args: {
|
|
34
|
-
hint: '',
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const Disabled: Story = {
|
|
39
|
-
args: {
|
|
40
|
-
disabled: true,
|
|
41
|
-
hint: 'Cannot edit this field.',
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const Error: Story = {
|
|
46
|
-
args: {
|
|
47
|
-
errorMsg: 'This field is required.',
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const Hint: Story = {
|
|
52
|
-
args: {
|
|
53
|
-
hint: 'This is a hint.',
|
|
54
|
-
},
|
|
55
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
@import '../../index.css';
|
|
2
|
-
|
|
3
|
-
.container {
|
|
4
|
-
@apply flex flex-col items-start justify-center;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.textarea {
|
|
8
|
-
@apply outline-none px-3 py-2 rounded-lg border border-[var(--neutral-200)] text-[var(--neutral-900)] min-h-[80px] min-w-[320px];
|
|
9
|
-
|
|
10
|
-
&:hover {
|
|
11
|
-
@apply border-[var(--primary-500)];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
&:focus-visible {
|
|
15
|
-
@apply border-[var(--primary-500)] ring-[4px] ring-[var(--primary-100)];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
&::placeholder {
|
|
19
|
-
@apply text-[var(--neutral-500)];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&:disabled {
|
|
23
|
-
@apply bg-[var(--neutral-100)] cursor-not-allowed text-[var(--neutral-300)];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
&:disabled:hover {
|
|
27
|
-
@apply border-[var(--neutral-200)];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
&--error {
|
|
31
|
-
@apply border-[var(--error-500)] text-[var(--error-500)];
|
|
32
|
-
&:hover {
|
|
33
|
-
@apply border-[var(--error-500)];
|
|
34
|
-
}
|
|
35
|
-
&:focus-visible {
|
|
36
|
-
@apply text-[var(--neutral-900)] border-[var(--error-500)] ring-[4px] ring-[var(--error-100)];
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
&__label {
|
|
41
|
-
@apply text-[var(--neutral-900)] mb-2 text-sm;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
&__hint {
|
|
45
|
-
@apply text-[var(--neutral-500)] text-sm mt-2;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
&__error {
|
|
49
|
-
@apply text-[var(--error-500)] text-sm mt-2;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
|
|
3
|
-
import { mount } from '@vue/test-utils';
|
|
4
|
-
|
|
5
|
-
import TextArea from './RTextArea.vue';
|
|
6
|
-
|
|
7
|
-
describe('TextArea', () => {
|
|
8
|
-
it('renders properly', () => {
|
|
9
|
-
const wrapper = mount(TextArea, {
|
|
10
|
-
props: {
|
|
11
|
-
id: 'textarea-id',
|
|
12
|
-
placeholder: 'textarea placeholder',
|
|
13
|
-
modelValue: 'textarea value',
|
|
14
|
-
label: 'textarea label',
|
|
15
|
-
hint: 'textarea hint',
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
expect(wrapper.exists()).toBe(true);
|
|
19
|
-
expect(wrapper.find('textarea').attributes('id')).toBe('textarea-id');
|
|
20
|
-
expect(wrapper.find('textarea').attributes('placeholder')).toBe(
|
|
21
|
-
'textarea placeholder'
|
|
22
|
-
);
|
|
23
|
-
expect(wrapper.find('textarea').element.value).toBe('textarea value');
|
|
24
|
-
expect(wrapper.find('label').text()).toBe('textarea label');
|
|
25
|
-
expect(wrapper.find('.textarea__hint').text()).toBe('textarea hint');
|
|
26
|
-
});
|
|
27
|
-
it('error situation', () => {
|
|
28
|
-
const wrapper = mount(TextArea, {
|
|
29
|
-
props: {
|
|
30
|
-
id: 'textarea-id',
|
|
31
|
-
errorMsg: 'textarea error',
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
expect(wrapper.find('.textarea__error').text()).toBe('textarea error');
|
|
35
|
-
});
|
|
36
|
-
});
|