@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,50 +0,0 @@
|
|
|
1
|
-
import { Canvas, Meta, Story, Controls } from '@storybook/blocks';
|
|
2
|
-
import * as LabelStories from './Label.stories';
|
|
3
|
-
|
|
4
|
-
<Meta of={LabelStories} />
|
|
5
|
-
|
|
6
|
-
# Label
|
|
7
|
-
|
|
8
|
-
- [Overview](#overview)
|
|
9
|
-
|
|
10
|
-
- [Playground](#playground)
|
|
11
|
-
|
|
12
|
-
- [Usage with props](#usage)
|
|
13
|
-
|
|
14
|
-
- [Tips](#tips)
|
|
15
|
-
|
|
16
|
-
### Overview <a id="overview" />
|
|
17
|
-
|
|
18
|
-
The Label component is a UI element that is used to display a label for a form element or other component. It is typically used in conjunction with form elements such as input fields, checkboxes, and radio buttons, as well as other components like sliders and switches. The Label component can be used to provide a clear and concise description of the associated form element or component, helping users understand its purpose and how to use it.
|
|
19
|
-
|
|
20
|
-
<Canvas>
|
|
21
|
-
<Story of={LabelStories.Overview} />
|
|
22
|
-
</Canvas>
|
|
23
|
-
|
|
24
|
-
### Playground <a id="playground" />
|
|
25
|
-
|
|
26
|
-
<Controls of={LabelStories.Overview} />
|
|
27
|
-
|
|
28
|
-
## Usage with props <a id="usage" />
|
|
29
|
-
|
|
30
|
-
### id (required)
|
|
31
|
-
|
|
32
|
-
The id prop is a unique identifier for the label element. It should be set to the same value as the id prop of the form element or component that the label is associated with.
|
|
33
|
-
|
|
34
|
-
### for (required)
|
|
35
|
-
|
|
36
|
-
The for prop is used to associate the label with a form element or component. It should be set to the same value as the id prop of the form element or component that the label is associated with.
|
|
37
|
-
|
|
38
|
-
### text (required)
|
|
39
|
-
|
|
40
|
-
The text prop is the text that will be displayed within the label element. It can be a string or a number.
|
|
41
|
-
|
|
42
|
-
### Tips <a id="tips" />
|
|
43
|
-
|
|
44
|
-
💡 Use clear and concise text for the text prop: Make sure that the text within the label accurately and clearly describes the associated form element or component. Avoid using jargon or technical terms that may be unfamiliar to some users.
|
|
45
|
-
|
|
46
|
-
💡 Use the for and id props correctly: The for prop should be set to the id of the form element or component that the label is associated with, and the id prop should be a unique identifier for the label element. This ensures that the label is properly associated with the correct form element or component, and helps screen readers and other assistive technologies correctly interpret the label.
|
|
47
|
-
|
|
48
|
-
💡 Consider using aria-label or aria-labelledby: If the label text is not visually displayed (e.g. because it is hidden using CSS), you may need to use the aria-label or aria-labelledby attributes to provide an accessible label for screen readers and other assistive technologies.
|
|
49
|
-
|
|
50
|
-
💡 Use label elements for all form elements: It is important to use label elements for all form elements, even if the form element is already described by surrounding text. This ensures that the form element is properly labeled and easier to use for all users, including those using assistive technologies.
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
2
|
-
|
|
3
|
-
import Label from './RLabel.vue';
|
|
4
|
-
|
|
5
|
-
const LabelStory = {
|
|
6
|
-
title: 'Form/Label',
|
|
7
|
-
render: (args: any) => ({
|
|
8
|
-
components: { Label },
|
|
9
|
-
setup() {
|
|
10
|
-
return {
|
|
11
|
-
args,
|
|
12
|
-
};
|
|
13
|
-
},
|
|
14
|
-
template: `
|
|
15
|
-
<div style="display: flex; flex-direction: column;">
|
|
16
|
-
<Label v-bind="args" />
|
|
17
|
-
<input id="name" placeholder="John Doe" style="border: gray 1px solid; padding: 4px" />
|
|
18
|
-
</div>
|
|
19
|
-
`,
|
|
20
|
-
}),
|
|
21
|
-
args: {
|
|
22
|
-
id: '',
|
|
23
|
-
for: '',
|
|
24
|
-
text: '',
|
|
25
|
-
},
|
|
26
|
-
} as Meta<typeof Label>;
|
|
27
|
-
|
|
28
|
-
export default LabelStory;
|
|
29
|
-
|
|
30
|
-
type Story = StoryObj<typeof LabelStory>;
|
|
31
|
-
|
|
32
|
-
export const Overview: Story = {
|
|
33
|
-
args: {
|
|
34
|
-
id: 'label',
|
|
35
|
-
for: 'name',
|
|
36
|
-
text: 'Name:',
|
|
37
|
-
},
|
|
38
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { HTMLAttributes, LabelHTMLAttributes } from 'vue';
|
|
3
|
-
import './label.css';
|
|
4
|
-
export interface LabelProps {
|
|
5
|
-
/**
|
|
6
|
-
* id of the label
|
|
7
|
-
* @type HTMLAttributes['id']
|
|
8
|
-
* @default ''
|
|
9
|
-
* @example
|
|
10
|
-
* <Label id="label" />
|
|
11
|
-
* @link https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
|
|
12
|
-
*/
|
|
13
|
-
id: HTMLAttributes['id'];
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* for of the label
|
|
17
|
-
* @type LabelHTMLAttributes['for']
|
|
18
|
-
* @default ''
|
|
19
|
-
* @example
|
|
20
|
-
* <Label for="label" />
|
|
21
|
-
* @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label
|
|
22
|
-
*/
|
|
23
|
-
for: LabelHTMLAttributes['for'];
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* text of the label
|
|
27
|
-
* @type string | number
|
|
28
|
-
* @default ''
|
|
29
|
-
* @example
|
|
30
|
-
* <Label text="Label" />
|
|
31
|
-
*/
|
|
32
|
-
text: string | number;
|
|
33
|
-
}
|
|
34
|
-
const props = withDefaults(defineProps<LabelProps>(), {
|
|
35
|
-
id: '',
|
|
36
|
-
for: '',
|
|
37
|
-
text: '',
|
|
38
|
-
});
|
|
39
|
-
</script>
|
|
40
|
-
<template>
|
|
41
|
-
<label :id="props.id" :for="props.for">{{ props.text }}</label>
|
|
42
|
-
</template>
|
|
File without changes
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { Canvas, Meta, Story, Controls } from '@storybook/blocks';
|
|
2
|
-
|
|
3
|
-
import * as ModalStories from './Modal.stories';
|
|
4
|
-
|
|
5
|
-
<Meta of={ModalStories} />
|
|
6
|
-
|
|
7
|
-
# Modal
|
|
8
|
-
|
|
9
|
-
Modal is a component that renders a modal dialog. It is used to display content in a layer above the app.
|
|
10
|
-
|
|
11
|
-
- [Overview](#overview)
|
|
12
|
-
|
|
13
|
-
- [Playground](#playground)
|
|
14
|
-
|
|
15
|
-
- [Usage with props](#usage)
|
|
16
|
-
|
|
17
|
-
- [Slots](#slots)
|
|
18
|
-
|
|
19
|
-
- [Stories](#stories)
|
|
20
|
-
|
|
21
|
-
- [Tips](#tips)
|
|
22
|
-
|
|
23
|
-
## Overview <a id="overview" />
|
|
24
|
-
|
|
25
|
-
<Canvas source="SourceProps['code']">
|
|
26
|
-
<Story of={ModalStories.Overview} />
|
|
27
|
-
</Canvas>
|
|
28
|
-
|
|
29
|
-
## Playground <a id="playground" />
|
|
30
|
-
|
|
31
|
-
> Changes you make in the controls will be reflected in the example above.
|
|
32
|
-
|
|
33
|
-
<Controls of={ModalStories.Overview} exclude={/^(on.*)$/} />
|
|
34
|
-
|
|
35
|
-
## Usage with props <a id="usage" />
|
|
36
|
-
|
|
37
|
-
### modelValue (required)
|
|
38
|
-
|
|
39
|
-
The `modelValue` prop is used to control the visibility of the modal. It is a boolean value that defaults to `false`.
|
|
40
|
-
|
|
41
|
-
### block (optional)
|
|
42
|
-
|
|
43
|
-
The `block` prop is used to control the block behavior of the modal. It is a boolean value that defaults to `true`.
|
|
44
|
-
|
|
45
|
-
### title (optional)
|
|
46
|
-
|
|
47
|
-
The `title` prop is used to set the title of the modal. It is a string value that defaults to `null`.
|
|
48
|
-
|
|
49
|
-
### description (optional)
|
|
50
|
-
|
|
51
|
-
The `description` prop is used to set the description of the modal. It is a string value that defaults to `null`.
|
|
52
|
-
|
|
53
|
-
### icon (optional)
|
|
54
|
-
|
|
55
|
-
The `icon` prop is used to set the icon of the modal. It is a string value that defaults to `null`.
|
|
56
|
-
|
|
57
|
-
## Slots <a id="slots" />
|
|
58
|
-
|
|
59
|
-
### header (optional)
|
|
60
|
-
|
|
61
|
-
The `header` slot is used to render the header of the modal.
|
|
62
|
-
|
|
63
|
-
### default (optional)
|
|
64
|
-
|
|
65
|
-
The `default` slot is used to render the body of the modal.
|
|
66
|
-
|
|
67
|
-
### actions (optional)
|
|
68
|
-
|
|
69
|
-
The `actions` slot is used to render the actions of the modal.
|
|
70
|
-
|
|
71
|
-
## Stories <a id="stories" />
|
|
72
|
-
|
|
73
|
-
<Canvas source="SourceProps['code']">
|
|
74
|
-
<Story of={ModalStories.WithActionsSlot} />
|
|
75
|
-
</Canvas>
|
|
76
|
-
|
|
77
|
-
<Canvas source="SourceProps['code']">
|
|
78
|
-
<Story of={ModalStories.WithForm} />
|
|
79
|
-
</Canvas>
|
|
80
|
-
|
|
81
|
-
## Tips <a id="tips" />
|
|
82
|
-
|
|
83
|
-
- Use the `modelValue` prop to control the visibility of the modal.
|
|
84
|
-
|
|
85
|
-
- Use the `block` prop to control the block behavior of the modal.
|
|
86
|
-
|
|
87
|
-
- Use the `title` prop to set the title of the modal.
|
|
88
|
-
|
|
89
|
-
- Use the `description` prop to set the description of the modal.
|
|
90
|
-
|
|
91
|
-
- Use the `icon` prop to set the icon of the modal.
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
2
|
-
|
|
3
|
-
import Modal from './RModal.vue';
|
|
4
|
-
import Button from '../Button/RButton.vue';
|
|
5
|
-
import Textfield from '../Textfield/RTextfield.vue';
|
|
6
|
-
import Dropdown from '../Dropdown/RDropdown.vue';
|
|
7
|
-
|
|
8
|
-
const ModalStory = {
|
|
9
|
-
title: 'Components/Modal',
|
|
10
|
-
component: Modal,
|
|
11
|
-
setup: (args: typeof Modal) => ({
|
|
12
|
-
args,
|
|
13
|
-
}),
|
|
14
|
-
template: `
|
|
15
|
-
<div>
|
|
16
|
-
<Modal v-bind="args" />
|
|
17
|
-
</div>
|
|
18
|
-
`,
|
|
19
|
-
args: {
|
|
20
|
-
title: 'Create Account',
|
|
21
|
-
description:
|
|
22
|
-
'On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment',
|
|
23
|
-
},
|
|
24
|
-
argTypes: {},
|
|
25
|
-
} as Meta<typeof Modal>;
|
|
26
|
-
|
|
27
|
-
export default ModalStory;
|
|
28
|
-
|
|
29
|
-
type Story = StoryObj<typeof ModalStory>;
|
|
30
|
-
|
|
31
|
-
export const Overview: Story = {};
|
|
32
|
-
|
|
33
|
-
export const WithActionsSlot: Story = {
|
|
34
|
-
render: (args) => ({
|
|
35
|
-
components: { Modal, Button },
|
|
36
|
-
setup: () => ({
|
|
37
|
-
args,
|
|
38
|
-
submit: () => {
|
|
39
|
-
alert('Submitted!');
|
|
40
|
-
},
|
|
41
|
-
}),
|
|
42
|
-
template: `
|
|
43
|
-
<div >
|
|
44
|
-
<Modal v-bind="args" >
|
|
45
|
-
<template v-slot:default>
|
|
46
|
-
<div>
|
|
47
|
-
<!-- type a text about pets -->
|
|
48
|
-
Pets are companion animals kept primarily for a person's company or entertainment rather than as a working animal, livestock, or a laboratory animal. Popular pets are often considered to have attractive appearances, intelligence and relatable personalities, but some pets may be taken in on an altruistic basis (such as a stray animal) and accepted by the owner regardless of these characteristics.
|
|
49
|
-
</div>
|
|
50
|
-
</template>
|
|
51
|
-
<template v-slot:actions>
|
|
52
|
-
<div class="flex gap-2">
|
|
53
|
-
<Button variant="secondary" @click="args.modelValue = false">
|
|
54
|
-
<template #custom-icon>
|
|
55
|
-
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-paw-off" width="24" height="24" viewBox="0 0 24 24" stroke-width="1.5" stroke="#000000" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
56
|
-
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
|
|
57
|
-
<path d="M11.168 11.154c-.71 .31 -1.184 1.107 -2 2.593c-.942 1.703 -2.846 1.845 -3.321 3.291c-.097 .265 -.145 .677 -.143 .962c0 1.176 .787 2 1.8 2c1.259 0 3 -1 4.5 -1s3.241 1 4.5 1c.927 0 1.664 -.689 1.783 -1.708" />
|
|
58
|
-
<path d="M20.188 8.082a1.039 1.039 0 0 0 -.406 -.082h-.015c-.735 .012 -1.56 .75 -1.993 1.866c-.519 1.335 -.28 2.7 .538 3.052c.129 .055 .267 .082 .406 .082c.739 0 1.575 -.742 2.011 -1.866c.516 -1.335 .273 -2.7 -.54 -3.052h0z" />
|
|
59
|
-
<path d="M11 6.992a3.608 3.608 0 0 0 -.04 -.725c-.203 -1.297 -1.047 -2.267 -1.932 -2.267a1.237 1.237 0 0 0 -.758 .265" />
|
|
60
|
-
<path d="M16.456 6.733c.214 -1.376 -.375 -2.594 -1.32 -2.722a1.164 1.164 0 0 0 -.162 -.011c-.885 0 -1.728 .97 -1.93 2.267c-.214 1.376 .375 2.594 1.32 2.722c.054 .007 .108 .011 .162 .011c.885 0 1.73 -.974 1.93 -2.267z" />
|
|
61
|
-
<path d="M5.69 12.918c.816 -.352 1.054 -1.719 .536 -3.052c-.436 -1.124 -1.271 -1.866 -2.009 -1.866c-.14 0 -.277 .027 -.407 .082c-.816 .352 -1.054 1.719 -.536 3.052c.436 1.124 1.271 1.866 2.009 1.866c.14 0 .277 -.027 .407 -.082z" />
|
|
62
|
-
<path d="M3 3l18 18" />
|
|
63
|
-
</svg>
|
|
64
|
-
</template>
|
|
65
|
-
</Button>
|
|
66
|
-
<Button @click="submit">
|
|
67
|
-
<template #custom-icon>
|
|
68
|
-
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-paw-filled" width="24" height="24" viewBox="0 0 24 24" stroke-width="1.5" stroke="#ffbf00" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
69
|
-
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
|
|
70
|
-
<path d="M12 10c-1.32 0 -1.983 .421 -2.931 1.924l-.244 .398l-.395 .688a50.89 50.89 0 0 0 -.141 .254c-.24 .434 -.571 .753 -1.139 1.142l-.55 .365c-.94 .627 -1.432 1.118 -1.707 1.955c-.124 .338 -.196 .853 -.193 1.28c0 1.687 1.198 2.994 2.8 2.994l.242 -.006c.119 -.006 .234 -.017 .354 -.034l.248 -.043l.132 -.028l.291 -.073l.162 -.045l.57 -.17l.763 -.243l.455 -.136c.53 -.15 .94 -.222 1.283 -.222c.344 0 .753 .073 1.283 .222l.455 .136l.764 .242l.569 .171l.312 .084c.097 .024 .187 .045 .273 .062l.248 .043c.12 .017 .235 .028 .354 .034l.242 .006c1.602 0 2.8 -1.307 2.8 -3c0 -.427 -.073 -.939 -.207 -1.306c-.236 -.724 -.677 -1.223 -1.48 -1.83l-.257 -.19l-.528 -.38c-.642 -.47 -1.003 -.826 -1.253 -1.278l-.27 -.485l-.252 -.432c-1.011 -1.696 -1.618 -2.099 -3.053 -2.099z" stroke-width="0" fill="currentColor" />
|
|
71
|
-
<path d="M19.78 7h-.03c-1.219 .02 -2.35 1.066 -2.908 2.504c-.69 1.775 -.348 3.72 1.075 4.333c.256 .109 .527 .163 .801 .163c1.231 0 2.38 -1.053 2.943 -2.504c.686 -1.774 .34 -3.72 -1.076 -4.332a2.05 2.05 0 0 0 -.804 -.164z" stroke-width="0" fill="currentColor" />
|
|
72
|
-
<path d="M9.025 3c-.112 0 -.185 .002 -.27 .015l-.093 .016c-1.532 .206 -2.397 1.989 -2.108 3.855c.272 1.725 1.462 3.114 2.92 3.114l.187 -.005a1.26 1.26 0 0 0 .084 -.01l.092 -.016c1.533 -.206 2.397 -1.989 2.108 -3.855c-.27 -1.727 -1.46 -3.114 -2.92 -3.114z" stroke-width="0" fill="currentColor" />
|
|
73
|
-
<path d="M14.972 3c-1.459 0 -2.647 1.388 -2.916 3.113c-.29 1.867 .574 3.65 2.174 3.867c.103 .013 .2 .02 .296 .02c1.39 0 2.543 -1.265 2.877 -2.883l.041 -.23c.29 -1.867 -.574 -3.65 -2.174 -3.867a2.154 2.154 0 0 0 -.298 -.02z" stroke-width="0" fill="currentColor" />
|
|
74
|
-
<path d="M4.217 7c-.274 0 -.544 .054 -.797 .161c-1.426 .615 -1.767 2.562 -1.078 4.335c.563 1.451 1.71 2.504 2.941 2.504c.274 0 .544 -.054 .797 -.161c1.426 -.615 1.767 -2.562 1.078 -4.335c-.563 -1.451 -1.71 -2.504 -2.941 -2.504z" stroke-width="0" fill="currentColor" />
|
|
75
|
-
</svg>
|
|
76
|
-
</template>
|
|
77
|
-
</Button>
|
|
78
|
-
</div>
|
|
79
|
-
</template>
|
|
80
|
-
</Modal>
|
|
81
|
-
</div>
|
|
82
|
-
`,
|
|
83
|
-
}),
|
|
84
|
-
args: {
|
|
85
|
-
modelValue: true,
|
|
86
|
-
icon: 'pets',
|
|
87
|
-
description: '',
|
|
88
|
-
title: 'Pets ',
|
|
89
|
-
},
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export const WithForm: Story = {
|
|
93
|
-
render: (args) => ({
|
|
94
|
-
components: { Modal, Textfield, Button, Dropdown },
|
|
95
|
-
setup: () => ({
|
|
96
|
-
args,
|
|
97
|
-
submit: () => {
|
|
98
|
-
alert(`Submitted!`);
|
|
99
|
-
},
|
|
100
|
-
}),
|
|
101
|
-
template: `
|
|
102
|
-
<div >
|
|
103
|
-
<Modal v-bind="args" >
|
|
104
|
-
<template v-slot:default>
|
|
105
|
-
<div>
|
|
106
|
-
<label class="block text-sm font-medium text-gray-700 mb-1">Account Type</label>
|
|
107
|
-
<Dropdown placeholder="Select a option" :options="[{label: 'Option 1', value:'Option 1'}, {label: 'Option 2', value: 'Option 2'}]" />
|
|
108
|
-
<Textfield label="Name" placeholder="type a name" />
|
|
109
|
-
<Textfield label="Email"placeholder="type a email" />
|
|
110
|
-
<Textfield label="Password" placeholder="type a password" />
|
|
111
|
-
</div>
|
|
112
|
-
</template>
|
|
113
|
-
<template v-slot:actions>
|
|
114
|
-
<Button variant="secondary" @click="args.modelValue = false" block>
|
|
115
|
-
Cancel
|
|
116
|
-
</Button>
|
|
117
|
-
<Button @click="submit" block>
|
|
118
|
-
Submit
|
|
119
|
-
</Button>
|
|
120
|
-
</template>
|
|
121
|
-
</Modal>
|
|
122
|
-
</div>
|
|
123
|
-
`,
|
|
124
|
-
}),
|
|
125
|
-
};
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed } from 'vue';
|
|
3
|
-
import './modal.css';
|
|
4
|
-
import Icon from '../Icon/RIcon.vue';
|
|
5
|
-
|
|
6
|
-
export interface ModalProps {
|
|
7
|
-
/**
|
|
8
|
-
* modelValue the modal
|
|
9
|
-
* @type boolean
|
|
10
|
-
* @default false
|
|
11
|
-
* @example
|
|
12
|
-
* <Modal :modelValue="true" />
|
|
13
|
-
*/
|
|
14
|
-
modelValue: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Modal width is 100%
|
|
17
|
-
* @type boolean
|
|
18
|
-
* @default false
|
|
19
|
-
* @example
|
|
20
|
-
* <Modal block />
|
|
21
|
-
*/
|
|
22
|
-
block?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Title of the Modal
|
|
25
|
-
* @type string
|
|
26
|
-
* @default ''
|
|
27
|
-
* @example
|
|
28
|
-
* <Modal title="Modal Title" />
|
|
29
|
-
*/
|
|
30
|
-
title?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Description of the Modal
|
|
33
|
-
* @type string
|
|
34
|
-
* @default ''
|
|
35
|
-
* @example
|
|
36
|
-
* <Modal description="Modal Description" />
|
|
37
|
-
*/
|
|
38
|
-
description?: string;
|
|
39
|
-
/**
|
|
40
|
-
* Icon of the Modal
|
|
41
|
-
* @type string
|
|
42
|
-
* @default ''
|
|
43
|
-
* @example
|
|
44
|
-
* <Modal icon="mdiMail" />
|
|
45
|
-
*/
|
|
46
|
-
icon?: string;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Width of the Modal
|
|
50
|
-
* @type string
|
|
51
|
-
* @default ''
|
|
52
|
-
* @example
|
|
53
|
-
* <Modal width="500px" />
|
|
54
|
-
*/
|
|
55
|
-
width?: string;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Height of the Modal
|
|
59
|
-
* @type string
|
|
60
|
-
* @default ''
|
|
61
|
-
* @example
|
|
62
|
-
* <Modal height="500px" />
|
|
63
|
-
*/
|
|
64
|
-
height?: string;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Close the modal when clicking outside
|
|
68
|
-
* @type boolean
|
|
69
|
-
* @default false
|
|
70
|
-
* @example
|
|
71
|
-
* <Modal :modelValue="true" :outsideClick="true" />
|
|
72
|
-
*/
|
|
73
|
-
outsideClick?: boolean;
|
|
74
|
-
}
|
|
75
|
-
const props = withDefaults(defineProps<ModalProps>(), {
|
|
76
|
-
modelValue: false,
|
|
77
|
-
block: false,
|
|
78
|
-
title: '',
|
|
79
|
-
description: '',
|
|
80
|
-
});
|
|
81
|
-
const emits = defineEmits(['update:modelValue']);
|
|
82
|
-
const classes = computed(() => {
|
|
83
|
-
return {
|
|
84
|
-
dialog: true,
|
|
85
|
-
'dialog--block': props.block,
|
|
86
|
-
};
|
|
87
|
-
});
|
|
88
|
-
const styles = computed(() => {
|
|
89
|
-
return {
|
|
90
|
-
width: props.width,
|
|
91
|
-
height: props.height,
|
|
92
|
-
};
|
|
93
|
-
});
|
|
94
|
-
const handleOutside = (event: Event) => {
|
|
95
|
-
if (!props.outsideClick) return;
|
|
96
|
-
if (event.target === event.currentTarget) {
|
|
97
|
-
emits('update:modelValue', false);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
</script>
|
|
101
|
-
<template>
|
|
102
|
-
<div class="modal" v-show="modelValue" @click.stop="handleOutside">
|
|
103
|
-
<div
|
|
104
|
-
:style="styles"
|
|
105
|
-
role="dialog"
|
|
106
|
-
aria-modal="true"
|
|
107
|
-
:class="classes"
|
|
108
|
-
:open="props.modelValue"
|
|
109
|
-
>
|
|
110
|
-
<div class="dialog__header">
|
|
111
|
-
<slot name="header" />
|
|
112
|
-
<div class="icon" v-if="props.icon">
|
|
113
|
-
<Icon :name="props.icon" />
|
|
114
|
-
</div>
|
|
115
|
-
<div class="title" v-if="props.title">
|
|
116
|
-
{{ props.title }}
|
|
117
|
-
</div>
|
|
118
|
-
<div class="description" v-if="props.description">
|
|
119
|
-
{{ props.description }}
|
|
120
|
-
</div>
|
|
121
|
-
</div>
|
|
122
|
-
<div class="dialog__body">
|
|
123
|
-
<slot />
|
|
124
|
-
</div>
|
|
125
|
-
<div class="dialog__actions">
|
|
126
|
-
<slot name="actions" />
|
|
127
|
-
</div>
|
|
128
|
-
</div>
|
|
129
|
-
</div>
|
|
130
|
-
</template>
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
@import '../../index.css';
|
|
2
|
-
|
|
3
|
-
.modal {
|
|
4
|
-
@apply fixed inset-0 z-50 flex items-center justify-center
|
|
5
|
-
bg-black bg-opacity-30 transition-opacity duration-300 ease-in-out;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.dialog {
|
|
9
|
-
@apply w-[var(--modal-width)] rounded-[var(--modal-border-radius)]
|
|
10
|
-
shadow-[var(--modal-shadow)] p-[var(--modal-padding)]
|
|
11
|
-
flex flex-col gap-6 bg-white animate-[var(--modal-animation)] transition-[width] duration-300 ease-in;
|
|
12
|
-
|
|
13
|
-
&__header {
|
|
14
|
-
@apply flex flex-col items-start justify-between gap-4;
|
|
15
|
-
|
|
16
|
-
.icon {
|
|
17
|
-
@apply max-h-[var(--modal-icon-size)] max-w-[var(--modal-icon-size)] p-[var(--modal-icon-padding)]
|
|
18
|
-
grid items-center bg-[var(--modal-icon-bg)] rounded-full text-[var(--modal-icon-color)];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.title {
|
|
22
|
-
@apply text-2xl font-semibold;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.description {
|
|
26
|
-
@apply text-sm text-[var(--neutral-500)] font-normal;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
&__body {
|
|
31
|
-
@apply flex-1 overflow-y-auto;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
&__actions {
|
|
35
|
-
@apply flex items-center justify-end gap-[var(--space-4)];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
&--block {
|
|
39
|
-
@apply w-full;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
|
|
3
|
-
import { mount } from '@vue/test-utils';
|
|
4
|
-
import Modal from './RModal.vue';
|
|
5
|
-
import exp from 'constants';
|
|
6
|
-
|
|
7
|
-
describe('Modal', () => {
|
|
8
|
-
it('should render correctly', () => {
|
|
9
|
-
const wrapper = mount(Modal, {
|
|
10
|
-
props: {
|
|
11
|
-
title: 'Test',
|
|
12
|
-
modelValue: true,
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
expect(wrapper.find('.modal').exists()).toBe(true);
|
|
16
|
-
expect(
|
|
17
|
-
wrapper.find('.modal').element.getElementsByClassName('title')[0]
|
|
18
|
-
.innerHTML
|
|
19
|
-
).toBe('Test');
|
|
20
|
-
expect(wrapper.find('.dialog').exists()).toBe(true);
|
|
21
|
-
expect(wrapper.find('.dialog').attributes('aria-modal')).toBe('true');
|
|
22
|
-
expect(wrapper.find('.dialog').attributes('role')).toBe('dialog');
|
|
23
|
-
expect(wrapper.find('.dialog').attributes('open')).toBe('true');
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
2
|
-
|
|
3
|
-
// @ts-ignore
|
|
4
|
-
import Pagination from './RPagination.vue';
|
|
5
|
-
|
|
6
|
-
const PaginationStory = {
|
|
7
|
-
title: 'Components/Pagination',
|
|
8
|
-
component: Pagination,
|
|
9
|
-
setup: (args: typeof Pagination) => ({
|
|
10
|
-
args,
|
|
11
|
-
}),
|
|
12
|
-
template: `<Pagination v-bind="args" />`,
|
|
13
|
-
args: {},
|
|
14
|
-
argTypes: {
|
|
15
|
-
'onUpdate:page': { action: 'update:page' },
|
|
16
|
-
},
|
|
17
|
-
tags: ['autodocs'],
|
|
18
|
-
} as Meta<typeof Pagination>;
|
|
19
|
-
|
|
20
|
-
export default PaginationStory;
|
|
21
|
-
|
|
22
|
-
type Story = StoryObj<typeof PaginationStory>;
|
|
23
|
-
|
|
24
|
-
export const Overview: Story = {};
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed } from 'vue';
|
|
3
|
-
import './pagination.css';
|
|
4
|
-
|
|
5
|
-
export interface PaginationProps {
|
|
6
|
-
page: number;
|
|
7
|
-
perPage: number;
|
|
8
|
-
totalItems: number;
|
|
9
|
-
pageText?: string;
|
|
10
|
-
ofText?: string;
|
|
11
|
-
slash?: boolean;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const props = withDefaults(defineProps<PaginationProps>(), {
|
|
15
|
-
page: 1,
|
|
16
|
-
perPage: 10,
|
|
17
|
-
totalItems: 100,
|
|
18
|
-
pageText: 'Page',
|
|
19
|
-
ofText: 'of',
|
|
20
|
-
slash: false,
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const emits = defineEmits(['update:page']);
|
|
24
|
-
|
|
25
|
-
const totalPages = computed(() => Math.ceil(props.totalItems / props.perPage));
|
|
26
|
-
|
|
27
|
-
const changePage = (page: number) => {
|
|
28
|
-
if (page < 1 || page > totalPages.value) return;
|
|
29
|
-
emits('update:page', page);
|
|
30
|
-
};
|
|
31
|
-
</script>
|
|
32
|
-
|
|
33
|
-
<template>
|
|
34
|
-
<div class="r-pagination">
|
|
35
|
-
<div class="r-pagination__page-info">
|
|
36
|
-
<span v-if="!slash">{{ props.pageText }}</span>
|
|
37
|
-
<span class="r-pagination__page-info__current-page">
|
|
38
|
-
{{ props.page }}
|
|
39
|
-
</span>
|
|
40
|
-
{{ slash ? '/' : props.ofText }}
|
|
41
|
-
<span class="r-pagination__page-info__total-pages">
|
|
42
|
-
{{ totalPages }}
|
|
43
|
-
</span>
|
|
44
|
-
</div>
|
|
45
|
-
<div class="r-pagination__paginator">
|
|
46
|
-
<button
|
|
47
|
-
class="r-pagination__paginator__prev"
|
|
48
|
-
:disabled="props.page === 1"
|
|
49
|
-
@click="changePage(+props.page - 1)"
|
|
50
|
-
>
|
|
51
|
-
<slot name="prev">
|
|
52
|
-
<svg
|
|
53
|
-
:class="{ 'stroke-gray-400': props.page === 1 }"
|
|
54
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
55
|
-
width="16"
|
|
56
|
-
height="16"
|
|
57
|
-
viewBox="0 0 24 24"
|
|
58
|
-
stroke-width="1.5"
|
|
59
|
-
stroke="#323232"
|
|
60
|
-
fill="none"
|
|
61
|
-
stroke-linecap="round"
|
|
62
|
-
stroke-linejoin="round"
|
|
63
|
-
>
|
|
64
|
-
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
|
65
|
-
<path d="M15 6l-6 6l6 6" />
|
|
66
|
-
</svg>
|
|
67
|
-
</slot>
|
|
68
|
-
</button>
|
|
69
|
-
<input
|
|
70
|
-
class="r-pagination__paginator__input"
|
|
71
|
-
type="number"
|
|
72
|
-
min="1"
|
|
73
|
-
:max="totalPages"
|
|
74
|
-
:value="props.page"
|
|
75
|
-
@blur="changePage(+$event?.target?.value)"
|
|
76
|
-
/>
|
|
77
|
-
<button
|
|
78
|
-
class="r-pagination__paginator__next"
|
|
79
|
-
:disabled="props.page === totalPages"
|
|
80
|
-
@click="changePage(+props.page + 1)"
|
|
81
|
-
>
|
|
82
|
-
<slot name="next">
|
|
83
|
-
<svg
|
|
84
|
-
:class="{ 'stroke-gray-400': props.page === totalPages }"
|
|
85
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
86
|
-
width="16"
|
|
87
|
-
height="16"
|
|
88
|
-
viewBox="0 0 24 24"
|
|
89
|
-
stroke-width="1.5"
|
|
90
|
-
stroke="#323232"
|
|
91
|
-
fill="none"
|
|
92
|
-
stroke-linecap="round"
|
|
93
|
-
stroke-linejoin="round"
|
|
94
|
-
>
|
|
95
|
-
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
|
96
|
-
<path d="M9 6l6 6l-6 6" />
|
|
97
|
-
</svg>
|
|
98
|
-
</slot>
|
|
99
|
-
</button>
|
|
100
|
-
<div class="r-pagination__paginator__total">/ {{ totalPages }}</div>
|
|
101
|
-
</div>
|
|
102
|
-
</div>
|
|
103
|
-
</template>
|