@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,203 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
2
|
-
import Tooltip from './RTooltip.vue';
|
|
3
|
-
import Button from '../Button/RButton.vue';
|
|
4
|
-
import Icon from '../Icon/RIcon.vue';
|
|
5
|
-
import { vTooltip } from '../../directives';
|
|
6
|
-
|
|
7
|
-
const DefaultArgTypes = {
|
|
8
|
-
placement: {
|
|
9
|
-
type: 'select',
|
|
10
|
-
options: [
|
|
11
|
-
'top',
|
|
12
|
-
'right',
|
|
13
|
-
'bottom',
|
|
14
|
-
'left',
|
|
15
|
-
'top-start',
|
|
16
|
-
'top-end',
|
|
17
|
-
'right-start',
|
|
18
|
-
'right-end',
|
|
19
|
-
'bottom-start',
|
|
20
|
-
'bottom-end',
|
|
21
|
-
'left-start',
|
|
22
|
-
'left-end',
|
|
23
|
-
],
|
|
24
|
-
},
|
|
25
|
-
triggers: {
|
|
26
|
-
type: 'select',
|
|
27
|
-
options: ['hover', 'click', 'manual'],
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
offset: {
|
|
31
|
-
control: {
|
|
32
|
-
type: 'range',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
padding: {
|
|
36
|
-
control: {
|
|
37
|
-
type: 'range',
|
|
38
|
-
},
|
|
39
|
-
defaultValue: 0,
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const DefaultArgs = {
|
|
44
|
-
placement: 'top',
|
|
45
|
-
text: 'Tooltips are used to describe or identify an element. In most scenarios, tooltips help the user understand the meaning, function or alt-text of an element.',
|
|
46
|
-
dark: true,
|
|
47
|
-
light: false,
|
|
48
|
-
triggers: 'hover',
|
|
49
|
-
autoHide: false,
|
|
50
|
-
hideDelay: 3000,
|
|
51
|
-
showDelay: 0,
|
|
52
|
-
shown: false,
|
|
53
|
-
disabled: false,
|
|
54
|
-
offset: 12,
|
|
55
|
-
padding: 0,
|
|
56
|
-
outsideClick: false,
|
|
57
|
-
resizable: false,
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const TooltipStory = {
|
|
61
|
-
title: 'Components/Tooltip',
|
|
62
|
-
render: (args: any) => ({
|
|
63
|
-
components: { Tooltip, Button },
|
|
64
|
-
setup: () => {
|
|
65
|
-
return {
|
|
66
|
-
args,
|
|
67
|
-
};
|
|
68
|
-
},
|
|
69
|
-
template: `
|
|
70
|
-
<Tooltip
|
|
71
|
-
v-bind="args"
|
|
72
|
-
@show="show"
|
|
73
|
-
@hide="hide"
|
|
74
|
-
>
|
|
75
|
-
<template #trigger>
|
|
76
|
-
<Button variant="primary">Tooltip</Button>
|
|
77
|
-
</template>
|
|
78
|
-
</Tooltip>
|
|
79
|
-
`,
|
|
80
|
-
}),
|
|
81
|
-
argTypes: DefaultArgTypes,
|
|
82
|
-
args: DefaultArgs,
|
|
83
|
-
} as Meta<typeof Tooltip>;
|
|
84
|
-
|
|
85
|
-
export default TooltipStory;
|
|
86
|
-
|
|
87
|
-
type Story = StoryObj<typeof TooltipStory>;
|
|
88
|
-
|
|
89
|
-
const WithContentSlotStory = {
|
|
90
|
-
render: (args: any) => ({
|
|
91
|
-
components: { Tooltip, Icon },
|
|
92
|
-
setup() {
|
|
93
|
-
return {
|
|
94
|
-
args,
|
|
95
|
-
};
|
|
96
|
-
},
|
|
97
|
-
template: `
|
|
98
|
-
<Tooltip
|
|
99
|
-
v-bind="args"
|
|
100
|
-
@show="show"
|
|
101
|
-
@hide="hide"
|
|
102
|
-
>
|
|
103
|
-
<template #trigger>
|
|
104
|
-
<Icon name="mdiInformation" />
|
|
105
|
-
</template>
|
|
106
|
-
<template #content>
|
|
107
|
-
<span style="background: red; color: #fff; padding: 8px;">This is a tooltip</span>
|
|
108
|
-
</template>
|
|
109
|
-
</Tooltip>
|
|
110
|
-
`,
|
|
111
|
-
}),
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const ToggleTemplate = {
|
|
115
|
-
render: (args: any) => ({
|
|
116
|
-
components: { Tooltip },
|
|
117
|
-
setup() {
|
|
118
|
-
return {
|
|
119
|
-
args,
|
|
120
|
-
};
|
|
121
|
-
},
|
|
122
|
-
template: `
|
|
123
|
-
<Tooltip
|
|
124
|
-
v-bind="args"
|
|
125
|
-
@show="show"
|
|
126
|
-
@hide="hide"
|
|
127
|
-
>
|
|
128
|
-
<template #trigger>
|
|
129
|
-
<span>Toggle tooltip</span>
|
|
130
|
-
</template>
|
|
131
|
-
</Tooltip>
|
|
132
|
-
`,
|
|
133
|
-
}),
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
const WithDirectivesStory = {
|
|
137
|
-
render: (args: any) => ({
|
|
138
|
-
components: { Button },
|
|
139
|
-
directives: { tooltip: vTooltip },
|
|
140
|
-
setup: () => ({
|
|
141
|
-
args,
|
|
142
|
-
}),
|
|
143
|
-
template: `
|
|
144
|
-
<div
|
|
145
|
-
v-tooltip="{
|
|
146
|
-
triggerContent: '<div>Hello World!</div>',
|
|
147
|
-
text: 'Directive tooltip',
|
|
148
|
-
autoHide: false,
|
|
149
|
-
placement: 'right',
|
|
150
|
-
offset: 30,
|
|
151
|
-
}"
|
|
152
|
-
|
|
153
|
-
/>
|
|
154
|
-
`,
|
|
155
|
-
}),
|
|
156
|
-
args: {},
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
export const Overview: Story = {
|
|
160
|
-
args: {},
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
export const Default: Story = {
|
|
164
|
-
args: {},
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
export const WithClickTrigger: Story = {
|
|
168
|
-
render: ToggleTemplate.render,
|
|
169
|
-
|
|
170
|
-
args: {
|
|
171
|
-
triggers: 'click',
|
|
172
|
-
text: 'Clicked!',
|
|
173
|
-
outsideClick: true,
|
|
174
|
-
},
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
export const WithManualTrigger: Story = {
|
|
178
|
-
args: {
|
|
179
|
-
triggers: 'manual',
|
|
180
|
-
dark: false,
|
|
181
|
-
light: true,
|
|
182
|
-
text: 'Manual!',
|
|
183
|
-
},
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
export const WithContentSlot: Story = {
|
|
187
|
-
render: WithContentSlotStory.render,
|
|
188
|
-
|
|
189
|
-
args: {
|
|
190
|
-
text: '',
|
|
191
|
-
triggers: 'hover',
|
|
192
|
-
},
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
export const WithDirectives: Story = {
|
|
196
|
-
render: WithDirectivesStory.render,
|
|
197
|
-
|
|
198
|
-
parameters: {
|
|
199
|
-
controls: {
|
|
200
|
-
disable: true,
|
|
201
|
-
},
|
|
202
|
-
},
|
|
203
|
-
};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
computePosition,
|
|
3
|
-
flip,
|
|
4
|
-
shift,
|
|
5
|
-
offset,
|
|
6
|
-
arrow,
|
|
7
|
-
hide,
|
|
8
|
-
} from '@floating-ui/dom';
|
|
9
|
-
import type { Ref } from 'vue';
|
|
10
|
-
|
|
11
|
-
export function update(
|
|
12
|
-
{ value: trigger }: Ref<HTMLDivElement>,
|
|
13
|
-
{ value: tooltip }: Ref<HTMLDivElement>,
|
|
14
|
-
{ value: arrowElement }: Ref<HTMLDivElement>,
|
|
15
|
-
placement: Placements,
|
|
16
|
-
offsetParam: number,
|
|
17
|
-
padding: number
|
|
18
|
-
) {
|
|
19
|
-
if (!trigger || !tooltip) return;
|
|
20
|
-
computePosition(trigger, tooltip, {
|
|
21
|
-
placement,
|
|
22
|
-
middleware: [
|
|
23
|
-
offset(offsetParam),
|
|
24
|
-
shift({ padding }),
|
|
25
|
-
arrow({ element: arrowElement }),
|
|
26
|
-
flip(),
|
|
27
|
-
hide(),
|
|
28
|
-
],
|
|
29
|
-
}).then(({ x, y, placement, middlewareData }) => {
|
|
30
|
-
Object.assign(tooltip.style, {
|
|
31
|
-
left: `${x}px`,
|
|
32
|
-
top: `${y}px`,
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
if (arrowElement && middlewareData.arrow) {
|
|
36
|
-
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
37
|
-
|
|
38
|
-
const staticSide = {
|
|
39
|
-
top: Placement.Bottom,
|
|
40
|
-
right: Placement.Left,
|
|
41
|
-
bottom: Placement.Top,
|
|
42
|
-
left: Placement.Right,
|
|
43
|
-
}[placement.split('-')[0]];
|
|
44
|
-
|
|
45
|
-
Object.assign(arrowElement.style, {
|
|
46
|
-
left: x != null ? `${arrowX}px` : '',
|
|
47
|
-
top: y != null ? `${arrowY}px` : '',
|
|
48
|
-
right: '',
|
|
49
|
-
bottom: '',
|
|
50
|
-
[`${staticSide}`]: '-4px',
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export type Placements =
|
|
57
|
-
| 'top'
|
|
58
|
-
| 'bottom'
|
|
59
|
-
| 'left'
|
|
60
|
-
| 'right'
|
|
61
|
-
| 'top-start'
|
|
62
|
-
| 'top-end'
|
|
63
|
-
| 'right-start'
|
|
64
|
-
| 'right-end'
|
|
65
|
-
| 'bottom-start'
|
|
66
|
-
| 'bottom-end'
|
|
67
|
-
| 'left-start'
|
|
68
|
-
| 'left-end';
|
|
69
|
-
|
|
70
|
-
export enum Placement {
|
|
71
|
-
Top = 'top',
|
|
72
|
-
Bottom = 'bottom',
|
|
73
|
-
Left = 'left',
|
|
74
|
-
Right = 'right',
|
|
75
|
-
TopStart = 'top-start',
|
|
76
|
-
TopEnd = 'top-end',
|
|
77
|
-
RightStart = 'right-start',
|
|
78
|
-
RightEnd = 'right-end',
|
|
79
|
-
BottomStart = 'bottom-start',
|
|
80
|
-
BottomEnd = 'bottom-end',
|
|
81
|
-
LeftStart = 'left-start',
|
|
82
|
-
LeftEnd = 'left-end',
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export type Triggers = 'click' | 'hover' | 'manual';
|
|
86
|
-
|
|
87
|
-
export enum Trigger {
|
|
88
|
-
Click = 'click',
|
|
89
|
-
Hover = 'hover',
|
|
90
|
-
Manual = 'manual',
|
|
91
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
@import '../../index.css';
|
|
2
|
-
|
|
3
|
-
.trigger {
|
|
4
|
-
@apply relative inline-block cursor-pointer bg-transparent rounded-full;
|
|
5
|
-
}
|
|
6
|
-
.tooltip {
|
|
7
|
-
@apply z-50 bg-transparent m-0 p-0 top-0 left-0 absolute w-max hidden;
|
|
8
|
-
|
|
9
|
-
&__content {
|
|
10
|
-
@apply font-normal p-4 rounded-lg text-xs max-w-xs;
|
|
11
|
-
|
|
12
|
-
&--dark {
|
|
13
|
-
@apply text-white bg-[var(--neutral-900)];
|
|
14
|
-
}
|
|
15
|
-
&--light {
|
|
16
|
-
@apply text-[var(--neutral-900)] bg-white;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
&__arrow {
|
|
21
|
-
@apply absolute w-4 h-4 rotate-45 -z-10;
|
|
22
|
-
|
|
23
|
-
&--dark {
|
|
24
|
-
@apply bg-[var(--neutral-900)];
|
|
25
|
-
}
|
|
26
|
-
&--light {
|
|
27
|
-
@apply bg-white;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
&--light {
|
|
32
|
-
@apply shadow-2xl rounded-lg;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
|
|
3
|
-
import { mount } from '@vue/test-utils';
|
|
4
|
-
|
|
5
|
-
import Tooltip from './RTooltip.vue';
|
|
6
|
-
import { Trigger } from './common';
|
|
7
|
-
|
|
8
|
-
describe('Tooltip', () => {
|
|
9
|
-
it('click trigger', () => {
|
|
10
|
-
const wrapper = mount(Tooltip, {
|
|
11
|
-
props: {
|
|
12
|
-
triggers: Trigger.Click,
|
|
13
|
-
outsideClick: true,
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
expect(wrapper.exists()).toBe(true);
|
|
17
|
-
expect(wrapper.find('.trigger').exists()).toBe(true);
|
|
18
|
-
expect(wrapper.find('.tooltip').exists()).toBe(true);
|
|
19
|
-
expect(
|
|
20
|
-
wrapper
|
|
21
|
-
.find('.trigger')
|
|
22
|
-
.trigger('click')
|
|
23
|
-
.then(() => {
|
|
24
|
-
expect(wrapper.find('.tooltip').attributes('style')).toBe(
|
|
25
|
-
'display: block;'
|
|
26
|
-
);
|
|
27
|
-
})
|
|
28
|
-
.then(() => {
|
|
29
|
-
wrapper.find('.trigger').trigger('click');
|
|
30
|
-
expect(wrapper.find('.tooltip').attributes('style')).toBe(
|
|
31
|
-
'display: "";'
|
|
32
|
-
);
|
|
33
|
-
})
|
|
34
|
-
);
|
|
35
|
-
});
|
|
36
|
-
it('hover trigger', () => {
|
|
37
|
-
const wrapper = mount(Tooltip, {
|
|
38
|
-
props: {
|
|
39
|
-
triggers: Trigger.Hover,
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
expect(wrapper.exists()).toBe(true);
|
|
43
|
-
expect(wrapper.find('.trigger').exists()).toBe(true);
|
|
44
|
-
expect(wrapper.find('.tooltip').exists()).toBe(true);
|
|
45
|
-
expect(
|
|
46
|
-
wrapper
|
|
47
|
-
.find('.trigger')
|
|
48
|
-
.trigger('mouseenter')
|
|
49
|
-
.then(() => {
|
|
50
|
-
expect(wrapper.find('.tooltip').attributes('style')).toBe(
|
|
51
|
-
'display: block;'
|
|
52
|
-
);
|
|
53
|
-
})
|
|
54
|
-
.then(() => {
|
|
55
|
-
wrapper.find('.trigger').trigger('mouseleave');
|
|
56
|
-
expect(wrapper.find('.tooltip').attributes('style')).toBe(
|
|
57
|
-
'display: "";'
|
|
58
|
-
);
|
|
59
|
-
})
|
|
60
|
-
);
|
|
61
|
-
});
|
|
62
|
-
it('manual trigger', () => {
|
|
63
|
-
const wrapper = mount(Tooltip, {
|
|
64
|
-
props: {
|
|
65
|
-
triggers: Trigger.Manual,
|
|
66
|
-
shown: true,
|
|
67
|
-
autoHide: true,
|
|
68
|
-
hideDelay: 1000,
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
expect(wrapper.exists()).toBe(true);
|
|
72
|
-
expect(wrapper.find('.trigger').exists()).toBe(true);
|
|
73
|
-
expect(wrapper.find('.tooltip').exists()).toBe(true);
|
|
74
|
-
expect(wrapper.find('.tooltip').attributes('style')).toBe(
|
|
75
|
-
'display: block;'
|
|
76
|
-
);
|
|
77
|
-
setTimeout(() => {
|
|
78
|
-
expect(wrapper.find('.tooltip').attributes('style')).toBe('""');
|
|
79
|
-
}, 1000);
|
|
80
|
-
});
|
|
81
|
-
});
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { Meta } from '@storybook/blocks';
|
|
2
|
-
import './typography.css';
|
|
3
|
-
|
|
4
|
-
<Meta
|
|
5
|
-
title="Design Tokens/Typography"
|
|
6
|
-
parameters={{
|
|
7
|
-
viewMode: 'docs',
|
|
8
|
-
previewTabs: {
|
|
9
|
-
canvas: { hidden: true },
|
|
10
|
-
},
|
|
11
|
-
}}
|
|
12
|
-
/>
|
|
13
|
-
|
|
14
|
-
export const Thing = ({
|
|
15
|
-
fontSize,
|
|
16
|
-
lineHeight,
|
|
17
|
-
fontWeight = '400',
|
|
18
|
-
as = 'p',
|
|
19
|
-
text,
|
|
20
|
-
}) => {
|
|
21
|
-
return (
|
|
22
|
-
<div>
|
|
23
|
-
<component is={as} style={{ fontSize, lineHeight, fontWeight }}>
|
|
24
|
-
{text}
|
|
25
|
-
</component>
|
|
26
|
-
<p
|
|
27
|
-
style={{ fontSize: '12px' }}
|
|
28
|
-
>{`Font size: ${fontSize} | Line height: ${lineHeight} | Font Weight: ${fontWeight}`}</p>
|
|
29
|
-
</div>
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
# Typography
|
|
34
|
-
|
|
35
|
-
## Heading
|
|
36
|
-
|
|
37
|
-
<Thing as={'h1'} text={'Heading 1'} fontSize={'72px'} lineHeight={'91.2px'} />
|
|
38
|
-
|
|
39
|
-
```html
|
|
40
|
-
.text-h1
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
<Thing as={'h2'} text={'Heading 2'} fontSize={'48px'} lineHeight={'60.8px'} />
|
|
44
|
-
|
|
45
|
-
```html
|
|
46
|
-
.text-h2;
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
<Thing as={'h3'} text={'Heading 3'} fontSize={'36px'} lineHeight={'45.6px'} />
|
|
50
|
-
|
|
51
|
-
```html
|
|
52
|
-
.text-h3
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
<Thing as={'h4'} text={'Heading 4'} fontSize={'24px'} lineHeight={'30.4px'} />
|
|
56
|
-
|
|
57
|
-
```html
|
|
58
|
-
.text-h4
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
<Thing as={'h5'} text={'Heading 5'} fontSize={'18px'} lineHeight={'22.4px'} />
|
|
62
|
-
|
|
63
|
-
```html
|
|
64
|
-
.text-h5
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
## Paragraph
|
|
68
|
-
|
|
69
|
-
<Thing text={'Title'} fontSize={'24px'} lineHeight={'32px'} />
|
|
70
|
-
|
|
71
|
-
```html
|
|
72
|
-
.text-title
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
<Thing text={'Subtitle Large'} fontSize={'20px'} lineHeight={'28px'} />
|
|
76
|
-
|
|
77
|
-
```html
|
|
78
|
-
.text-sub-title-1
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
<Thing text={'Subtitle Small'} fontSize={'18px'} lineHeight={'26px'} />
|
|
82
|
-
|
|
83
|
-
```html
|
|
84
|
-
.text-sub-title-2
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
<Thing text={'Body Large'} fontSize={'16px'} lineHeight={'24px'} />
|
|
88
|
-
|
|
89
|
-
```html
|
|
90
|
-
.text-body
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
<Thing text={'Body Medium'} fontSize={'14px'} lineHeight={'20px'} />
|
|
94
|
-
|
|
95
|
-
```html
|
|
96
|
-
.text-body-1
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
<Thing text={'Body Small'} fontSize={'12px'} lineHeight={'16px'} />
|
|
100
|
-
|
|
101
|
-
```html
|
|
102
|
-
.text-body-2
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
<Thing text={'Caption'} fontSize={'10px'} lineHeight={'14px'} />
|
|
106
|
-
|
|
107
|
-
```html
|
|
108
|
-
.text-caption
|
|
109
|
-
```
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
@import '../../index.css';
|
|
2
|
-
|
|
3
|
-
.text-h1 {
|
|
4
|
-
font-size: 4.5rem;
|
|
5
|
-
font-weight: 400;
|
|
6
|
-
line-height: 5.7rem;
|
|
7
|
-
|
|
8
|
-
@media (max-width: 767px) {
|
|
9
|
-
font-size: 3rem;
|
|
10
|
-
line-height: 3.5rem;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.text-h2 {
|
|
15
|
-
font-size: 3.75rem;
|
|
16
|
-
font-weight: 400;
|
|
17
|
-
line-height: 4.75rem;
|
|
18
|
-
|
|
19
|
-
@media (max-width: 767px) {
|
|
20
|
-
font-size: 2.5rem;
|
|
21
|
-
line-height: 3rem;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.text-h3 {
|
|
26
|
-
font-size: 3rem;
|
|
27
|
-
font-weight: 400;
|
|
28
|
-
line-height: 3.875rem;
|
|
29
|
-
|
|
30
|
-
@media (max-width: 767px) {
|
|
31
|
-
font-size: 2rem;
|
|
32
|
-
line-height: 2.5rem;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.text-h4 {
|
|
37
|
-
font-size: 2.5rem;
|
|
38
|
-
font-weight: 400;
|
|
39
|
-
line-height: 3.25rem;
|
|
40
|
-
|
|
41
|
-
@media (max-width: 767px) {
|
|
42
|
-
font-size: 1.5rem;
|
|
43
|
-
line-height: 2rem;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.text-h5 {
|
|
48
|
-
font-size: 2rem;
|
|
49
|
-
font-weight: 400;
|
|
50
|
-
line-height: 2.625rem;
|
|
51
|
-
|
|
52
|
-
@media (max-width: 767px) {
|
|
53
|
-
font-size: 1.25rem;
|
|
54
|
-
line-height: 1.75rem;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.text-title {
|
|
59
|
-
font-size: 1.5rem;
|
|
60
|
-
font-weight: 400;
|
|
61
|
-
line-height: 2rem;
|
|
62
|
-
|
|
63
|
-
@media (max-width: 767px) {
|
|
64
|
-
font-size: 1.125rem;
|
|
65
|
-
line-height: 1.5rem;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.text-sub-title-1 {
|
|
70
|
-
font-size: 1.25rem;
|
|
71
|
-
font-weight: 400;
|
|
72
|
-
line-height: 1.75rem;
|
|
73
|
-
|
|
74
|
-
@media (max-width: 767px) {
|
|
75
|
-
font-size: 1rem;
|
|
76
|
-
line-height: 1.5rem;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.text-sub-title-2 {
|
|
81
|
-
font-size: 1.125rem;
|
|
82
|
-
font-weight: 400;
|
|
83
|
-
line-height: 1.625rem;
|
|
84
|
-
|
|
85
|
-
@media (max-width: 767px) {
|
|
86
|
-
font-size: 0.875rem;
|
|
87
|
-
line-height: 1.25rem;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.text-body {
|
|
92
|
-
font-size: 1rem;
|
|
93
|
-
font-weight: 400;
|
|
94
|
-
line-height: 1.5rem;
|
|
95
|
-
|
|
96
|
-
@media (max-width: 767px) {
|
|
97
|
-
font-size: 0.875rem;
|
|
98
|
-
line-height: 1.25rem;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.text-body-1 {
|
|
103
|
-
font-size: 0.875rem;
|
|
104
|
-
font-weight: 400;
|
|
105
|
-
line-height: 1.25rem;
|
|
106
|
-
|
|
107
|
-
@media (max-width: 767px) {
|
|
108
|
-
font-size: 0.75rem;
|
|
109
|
-
line-height: 1rem;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.text-body-2 {
|
|
114
|
-
font-size: 0.75rem;
|
|
115
|
-
font-weight: 400;
|
|
116
|
-
line-height: 1rem;
|
|
117
|
-
|
|
118
|
-
@media (max-width: 767px) {
|
|
119
|
-
font-size: 0.625rem;
|
|
120
|
-
line-height: 0.875rem;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.text-caption {
|
|
125
|
-
font-size: 0.625rem;
|
|
126
|
-
font-weight: 400;
|
|
127
|
-
line-height: 0.875rem;
|
|
128
|
-
}
|
package/src/directives/index.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { type App, createApp, h, ref, type DirectiveBinding } from 'vue';
|
|
2
|
-
import Tooltip from '../components/Tooltip/RTooltip.vue';
|
|
3
|
-
|
|
4
|
-
export const vTooltip = {
|
|
5
|
-
mounted(el: HTMLElement, binding: DirectiveBinding) {
|
|
6
|
-
console.log('vTooltip');
|
|
7
|
-
const app: App = createApp({
|
|
8
|
-
setup() {
|
|
9
|
-
const props = ref(binding.value);
|
|
10
|
-
|
|
11
|
-
return () =>
|
|
12
|
-
h(Tooltip, {
|
|
13
|
-
...props.value,
|
|
14
|
-
});
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
app.mount(el);
|
|
18
|
-
},
|
|
19
|
-
};
|