@rocketui/vue 0.0.46 → 0.0.47

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 (168) hide show
  1. package/.eslintrc.cjs +79 -0
  2. package/.gitattributes +2 -0
  3. package/.github/workflows/chromatic.yml +28 -0
  4. package/.github/workflows/publish-storybook.yml +41 -0
  5. package/.husky/pre-commit +4 -0
  6. package/.prettierrc.cjs +10 -0
  7. package/.storybook/Theme.js +17 -0
  8. package/.storybook/main.ts +20 -0
  9. package/.storybook/manager-head.html +3 -0
  10. package/.storybook/manager.js +8 -0
  11. package/.storybook/preview-head.html +3 -0
  12. package/.storybook/preview.ts +36 -0
  13. package/.storybook/source-panel/manager.js +28 -0
  14. package/.storybook/withSource.js +91 -0
  15. package/.vscode/extensions.json +11 -0
  16. package/.vscode/settings.json +20 -0
  17. package/index.html +13 -0
  18. package/lib/main.ts +48 -0
  19. package/package.json +2 -8
  20. package/postcss.config.cjs +9 -0
  21. package/resources/rocket-ui-logo-dark.svg +27 -0
  22. package/resources/rocket-ui-logo-light.svg +27 -0
  23. package/shims-rocketui.d.ts +9 -0
  24. package/src/App.vue +15 -0
  25. package/src/assets/blank-avatar.svg +3 -0
  26. package/src/assets/icons/mdi.js +7302 -0
  27. package/src/assets/logo.svg +1 -0
  28. package/src/components/Accordion/Accordion.mdx +88 -0
  29. package/src/components/Accordion/Accordion.stories.ts +257 -0
  30. package/src/components/Accordion/RAccordion.vue +73 -0
  31. package/src/components/Accordion/accordion.css +75 -0
  32. package/src/components/Accordion/accordion.spec.ts +123 -0
  33. package/src/components/Alert/Alert.mdx +120 -0
  34. package/src/components/Alert/Alert.stories.ts +118 -0
  35. package/src/components/Alert/RAlert.vue +119 -0
  36. package/src/components/Alert/alert.css +136 -0
  37. package/src/components/Alert/alert.spec.ts +32 -0
  38. package/src/components/Avatar/Avatar.mdx +96 -0
  39. package/src/components/Avatar/Avatar.stories.ts +65 -0
  40. package/src/components/Avatar/RAvatar.vue +115 -0
  41. package/src/components/Avatar/avatar.css +82 -0
  42. package/src/components/Avatar/avatar.spec.ts +38 -0
  43. package/src/components/Badge/Badge.mdx +112 -0
  44. package/src/components/Badge/Badge.stories.ts +99 -0
  45. package/src/components/Badge/RBadge.vue +89 -0
  46. package/src/components/Badge/badge.css +63 -0
  47. package/src/components/Badge/badge.spec.ts +20 -0
  48. package/src/components/Box/Box.mdx +20 -0
  49. package/src/components/Box/Box.stories.ts +56 -0
  50. package/src/components/Box/RBox.vue +97 -0
  51. package/src/components/Breadcrumb/Breadcrumb.stories.ts +115 -0
  52. package/src/components/Breadcrumb/RBreadcrumb.vue +43 -0
  53. package/src/components/Breadcrumb/breadcrumb.css +29 -0
  54. package/src/components/Button/Button.mdx +148 -0
  55. package/src/components/Button/Button.spec.ts +29 -0
  56. package/src/components/Button/Button.stories.ts +118 -0
  57. package/src/components/Button/RButton.vue +179 -0
  58. package/src/components/Button/button.css +146 -0
  59. package/src/components/Checkbox/Checkbox.mdx +100 -0
  60. package/src/components/Checkbox/Checkbox.stories.ts +67 -0
  61. package/src/components/Checkbox/RCheckbox.vue +195 -0
  62. package/src/components/Checkbox/checkbox.css +67 -0
  63. package/src/components/Checkbox/checkbox.spec.ts +60 -0
  64. package/src/components/Chips/Chip.mdx +113 -0
  65. package/src/components/Chips/Chip.stories.ts +122 -0
  66. package/src/components/Chips/RChip.vue +125 -0
  67. package/src/components/Chips/chip.css +62 -0
  68. package/src/components/Chips/chip.spec.ts +40 -0
  69. package/src/components/Dropdown/Dropdown.mdx +135 -0
  70. package/src/components/Dropdown/Dropdown.stories.ts +84 -0
  71. package/src/components/Dropdown/RDropdown.vue +392 -0
  72. package/src/components/Dropdown/dropdown.css +113 -0
  73. package/src/components/Dropdown/dropdown.spec.ts +98 -0
  74. package/src/components/Flex/Flex.mdx +20 -0
  75. package/src/components/Flex/Flex.stories.js +127 -0
  76. package/src/components/Flex/RFlex.vue +91 -0
  77. package/src/components/Grid/Grid.mdx +20 -0
  78. package/src/components/Grid/Grid.stories.js +107 -0
  79. package/src/components/Grid/RGrid.vue +138 -0
  80. package/src/components/Icon/Icon.mdx +68 -0
  81. package/src/components/Icon/Icon.stories.ts +33 -0
  82. package/src/components/Icon/RIcon.vue +56 -0
  83. package/src/components/Icon/icon.spec.ts +25 -0
  84. package/src/components/ItemGroup/ItemGroup.stories.ts +91 -0
  85. package/src/components/ItemGroup/RItem.vue +74 -0
  86. package/src/components/ItemGroup/RItemGroup.vue +122 -0
  87. package/src/components/ItemGroup/__snapshots__/itemgroup.spec.ts.snap +13 -0
  88. package/src/components/ItemGroup/itemgroup.spec.ts +67 -0
  89. package/src/components/Label/Label.mdx +50 -0
  90. package/src/components/Label/Label.stories.ts +38 -0
  91. package/src/components/Label/RLabel.vue +42 -0
  92. package/src/components/Label/label.css +0 -0
  93. package/src/components/Modal/Modal.mdx +91 -0
  94. package/src/components/Modal/Modal.stories.ts +125 -0
  95. package/src/components/Modal/RModal.vue +130 -0
  96. package/src/components/Modal/modal.css +41 -0
  97. package/src/components/Modal/modal.spec.ts +25 -0
  98. package/src/components/Pagination/Pagination.stories.ts +24 -0
  99. package/src/components/Pagination/RPagination.vue +103 -0
  100. package/src/components/Pagination/pagination.css +47 -0
  101. package/src/components/Pagination/pagination.spec.ts +17 -0
  102. package/src/components/ProgressBar/ProgressBar.stories.ts +34 -0
  103. package/src/components/ProgressBar/RProgressBar.vue +21 -0
  104. package/src/components/ProgressBar/progressbar.css +24 -0
  105. package/src/components/ProgressBar/progressbar.spec.ts +17 -0
  106. package/src/components/Shared/Enums.ts +1 -0
  107. package/src/components/Sidebar/RSidebar.vue +27 -0
  108. package/src/components/Sidebar/Sidebar.mdx +31 -0
  109. package/src/components/Sidebar/Sidebar.stories.ts +34 -0
  110. package/src/components/Sidebar/sidebar.css +18 -0
  111. package/src/components/Sidebar/sidebar.spec.ts +33 -0
  112. package/src/components/Snackbar/RSnackbar.vue +136 -0
  113. package/src/components/Snackbar/Snackbar.mdx +126 -0
  114. package/src/components/Snackbar/Snackbar.stories.ts +93 -0
  115. package/src/components/Snackbar/snackbar.css +99 -0
  116. package/src/components/Snackbar/snackbar.spec.ts +56 -0
  117. package/src/components/Switch/RSwitch.vue +147 -0
  118. package/src/components/Switch/Switch.mdx +102 -0
  119. package/src/components/Switch/Switch.stories.ts +79 -0
  120. package/src/components/Switch/switch.css +102 -0
  121. package/src/components/Switch/switch.spec.ts +31 -0
  122. package/src/components/TabItem/RTabItem.vue +175 -0
  123. package/src/components/TabItem/TabItem.mdx +95 -0
  124. package/src/components/TabItem/TabItem.spec.ts +29 -0
  125. package/src/components/TabItem/TabItem.stories.ts +97 -0
  126. package/src/components/TabItem/common.ts +6 -0
  127. package/src/components/TabItem/tab-item.css +29 -0
  128. package/src/components/Tabs/RTabs.vue +94 -0
  129. package/src/components/Tabs/Tabs.mdx +78 -0
  130. package/src/components/Tabs/Tabs.spec.ts +28 -0
  131. package/src/components/Tabs/Tabs.stories.ts +191 -0
  132. package/src/components/Tabs/tabs.css +13 -0
  133. package/src/components/Tabs/types.ts +11 -0
  134. package/src/components/TextArea/RTextArea.vue +142 -0
  135. package/src/components/TextArea/TextArea.mdx +108 -0
  136. package/src/components/TextArea/TextArea.stories.ts +55 -0
  137. package/src/components/TextArea/textarea.css +51 -0
  138. package/src/components/TextArea/textarea.spec.ts +36 -0
  139. package/src/components/Textfield/RTextfield.vue +372 -0
  140. package/src/components/Textfield/Textfield.mdx +159 -0
  141. package/src/components/Textfield/Textfield.stories.ts +121 -0
  142. package/src/components/Textfield/textfield.css +81 -0
  143. package/src/components/Textfield/textfield.spec.ts +34 -0
  144. package/src/components/Tooltip/RTooltip.vue +325 -0
  145. package/src/components/Tooltip/Tooltip.mdx +111 -0
  146. package/src/components/Tooltip/Tooltip.stories.ts +203 -0
  147. package/src/components/Tooltip/common.ts +91 -0
  148. package/src/components/Tooltip/tooltip.css +34 -0
  149. package/src/components/Tooltip/tooltip.spec.ts +81 -0
  150. package/src/components/Typography/Typography.mdx +109 -0
  151. package/src/components/Typography/typography.css +128 -0
  152. package/src/directives/index.ts +19 -0
  153. package/src/index.css +241 -0
  154. package/src/main.ts +5 -0
  155. package/src/scripts/buildIcons.js +21 -0
  156. package/src/stories/Colors.mdx +355 -0
  157. package/src/stories/GettingStarted.mdx +121 -0
  158. package/src/stories/Layout.mdx +15 -0
  159. package/tailwind.config.cjs +16 -0
  160. package/tsconfig.json +24 -0
  161. package/vite.config.ts +39 -0
  162. package/vitest.config.ts +12 -0
  163. package/dist/rocket-ui-vue.js +0 -9381
  164. package/dist/rocket-ui-vue.umd.cjs +0 -1
  165. package/dist/style.css +0 -2
  166. package/dist/types/main.d.ts +0 -25
  167. /package/{dist → public}/design-tokens.source.json +0 -0
  168. /package/{dist → public}/favicon.ico +0 -0
@@ -0,0 +1,113 @@
1
+ @import '../../index.css';
2
+
3
+ .dropdown-wrapper {
4
+ @apply relative;
5
+ }
6
+
7
+ .dropdown {
8
+ @apply flex items-center bg-white border border-[var(--neutral-200)] rounded-md shadow-sm py-3 px-4 text-left cursor-pointer sm:text-sm;
9
+
10
+ &--active {
11
+ @apply border border-[var(--primary-500)] ring-inset ring-2;
12
+ }
13
+
14
+ &--disabled {
15
+ @apply bg-[var(--neutral-100)] text-[var(--neutral-300)] border-[var(--neutral-200)] cursor-not-allowed;
16
+ }
17
+
18
+ &--loading {
19
+ @apply bg-[var(--neutral-100)] text-[var(--neutral-300)] border-[var(--neutral-200)] cursor-not-allowed animate-pulse;
20
+ }
21
+
22
+ &__prepend-icon {
23
+ @apply inset-y-0 right-0 flex items-center pointer-events-none pr-2;
24
+
25
+ &--active {
26
+ /* @apply text-[var(--primary-500)]; */
27
+ }
28
+ }
29
+
30
+ &__tags {
31
+ @apply flex flex-wrap items-center gap-1;
32
+
33
+ &__chip {
34
+ @apply flex items-center gap-2 rounded-3xl text-xs text-[var(--neutral-900)] bg-[var(--neutral-100)];
35
+
36
+ & > .chip__text {
37
+ @apply whitespace-nowrap;
38
+ }
39
+ }
40
+ }
41
+
42
+ &__multiple {
43
+ @apply flex items-center gap-2;
44
+ & > * {
45
+ @apply flex-1 whitespace-nowrap;
46
+ }
47
+ }
48
+
49
+ &__input {
50
+ @apply text-[var(--neutral-900)] caret-[var(--primary-500)] block w-full placeholder-[var(--neutral-500)] focus:outline-none focus:ring-0 focus:border-transparent sm:text-sm disabled:bg-[var(--neutral-100)] disabled:text-[var(--neutral-300)] disabled:placeholder:text-[var(--neutral-300)];
51
+
52
+ &--loading {
53
+ @apply bg-[var(--neutral-100)] text-[var(--neutral-300)] border-[var(--neutral-200)] cursor-not-allowed animate-pulse;
54
+ }
55
+
56
+ &[readonly] {
57
+ @apply cursor-pointer;
58
+ }
59
+ }
60
+
61
+ &__append-icon {
62
+ @apply inset-y-0 right-0 flex items-center pointer-events-none;
63
+
64
+ &--active {
65
+ @apply transform rotate-180 transition-all duration-200 ease-in-out text-[var(--primary-500)];
66
+ }
67
+ }
68
+ }
69
+
70
+ .dropdown-options {
71
+ @apply hidden py-3 px-2 left-0 absolute z-10 w-full mt-1 bg-white border border-[var(--neutral-200)] rounded-md shadow-lg max-h-60 ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm;
72
+
73
+ &--active {
74
+ @apply block;
75
+ }
76
+
77
+ &__option {
78
+ @apply text-[var(--neutral-900)] transition-all duration-200 ease-in
79
+ flex justify-between items-center w-full border border-transparent
80
+ rounded-md py-3 px-4 text-left cursor-pointer sm:text-sm min-h-[50px];
81
+
82
+ &:hover {
83
+ @apply bg-[var(--neutral-100)];
84
+ }
85
+ &--active {
86
+ @apply bg-[var(--primary-100)] text-[var(--primary-500)];
87
+ }
88
+
89
+ &__label {
90
+ @apply ml-2;
91
+
92
+ &--active {
93
+ /* @apply text-[var(--primary-500)]; */
94
+ }
95
+ }
96
+
97
+ &__prepend-icon {
98
+ @apply text-[var(--neutral-900)] inset-y-0 right-0 flex items-center pointer-events-none;
99
+
100
+ &--active {
101
+ /* @apply text-[var(--primary-500)]; */
102
+ }
103
+ }
104
+
105
+ &__append-icon {
106
+ @apply transition-colors duration-100 ease-in-out;
107
+
108
+ &--active {
109
+ /* @apply text-[var(--primary-500)]; */
110
+ }
111
+ }
112
+ }
113
+ }
@@ -0,0 +1,98 @@
1
+ import { describe, it, expect } from 'vitest';
2
+
3
+ import { mount } from '@vue/test-utils';
4
+ import Dropdown from './RDropdown.vue';
5
+
6
+ describe('Dropdown', () => {
7
+ it('renders properly', () => {
8
+ const wrapper = mount(Dropdown, {
9
+ props: {
10
+ options: [{ value: 1, label: '1' }],
11
+ placeholder: 'Select...',
12
+ },
13
+ });
14
+
15
+ expect(wrapper.exists()).toBe(true);
16
+ expect(wrapper.find('input').exists()).toBe(true);
17
+ expect(wrapper.find('input').attributes('type')).toBe('text');
18
+ expect(wrapper.find('input').attributes('placeholder')).toBe('Select...');
19
+ expect(wrapper.classes()).toContain('dropdown');
20
+ expect(wrapper.find('ul').exists()).toBe(true);
21
+ expect(wrapper.find('.select').exists()).toBe(true);
22
+ expect(
23
+ wrapper
24
+ .find('.select')
25
+ .trigger('click')
26
+ .then(() => {
27
+ expect(wrapper.find('ul').classes()).toContain(
28
+ 'select-options--active'
29
+ );
30
+ })
31
+ );
32
+ });
33
+
34
+ it('multiple', () => {
35
+ const wrapper = mount(Dropdown, {
36
+ props: {
37
+ options: [
38
+ { value: 1, label: '1' },
39
+ { value: 2, label: '2' },
40
+ ],
41
+ multiple: true,
42
+ },
43
+ });
44
+ expect(
45
+ wrapper
46
+ .find('.select')
47
+ .trigger('click')
48
+ .then(() => {
49
+ expect(wrapper.find('ul').classes()).toContain(
50
+ 'select-options--active'
51
+ );
52
+ })
53
+ .then(() => {
54
+ document.addEventListener('click', () => {
55
+ expect(wrapper.find('ul').classes()).not.toContain(
56
+ 'select-options--active'
57
+ );
58
+ });
59
+ })
60
+ );
61
+
62
+ expect(wrapper.find('.select__multiple').exists()).toBe(true);
63
+ expect(wrapper.find('.select-options__option__label').text()).toBe('1');
64
+ expect(
65
+ wrapper
66
+ .find('.select-options__option')
67
+ .trigger('click')
68
+ .then(() => {
69
+ expect(wrapper.find('.select__multiple').text()).toBe('1,');
70
+ })
71
+ );
72
+ });
73
+ it('taggable', () => {
74
+ const wrapper = mount(Dropdown, {
75
+ props: {
76
+ options: [
77
+ { value: 1, label: '1' },
78
+ { value: 2, label: '2' },
79
+ ],
80
+ taggable: true,
81
+ },
82
+ });
83
+
84
+ expect(wrapper.find('.select__tags').exists()).toBe(true);
85
+ expect(wrapper.find('input').exists()).toBe(true);
86
+ expect(
87
+ wrapper
88
+ .find('.select-options__option')
89
+ .trigger('click')
90
+ .then(() => {
91
+ wrapper
92
+ .find('.select__tags')
93
+ .element.children[0].classList.contains('chip');
94
+ wrapper.find('.select__tags').element.children[0].textContent === '1';
95
+ })
96
+ );
97
+ });
98
+ });
@@ -0,0 +1,20 @@
1
+ import { Canvas, Meta, Story, Controls } from '@storybook/blocks';
2
+ import * as FlexStories from './Flex.stories';
3
+
4
+ <Meta of={FlexStories} />
5
+
6
+ # Flex
7
+
8
+ Flex is Box with display set to flex and comes with helpful style shorthand. It renders a `div` element.
9
+
10
+ ### Overview
11
+
12
+ <Canvas>
13
+ <Story of={FlexStories.Overview} />
14
+ </Canvas>
15
+
16
+ ### Playground
17
+
18
+ > Changes you make in the controls will be reflected in the example above.
19
+
20
+ <Controls of={FlexStories.Overview} exclude={/^(click|default|on.*)$/} />
@@ -0,0 +1,127 @@
1
+ import Flex from './RFlex.vue';
2
+ import Box from '../Box/RBox.vue';
3
+
4
+ const Default = (args) => ({
5
+ components: { Flex, Box },
6
+ setup() {
7
+ return { args };
8
+ },
9
+ template: `
10
+ <Flex v-bind="args">
11
+ <Box>Box 1</Box>
12
+ <Box>Box 2</Box>
13
+ </Flex>`,
14
+ });
15
+
16
+ const defaultArgs = {
17
+ align: {
18
+ control: {
19
+ type: 'select',
20
+ options: [
21
+ 'normal',
22
+ 'stretch',
23
+ 'center',
24
+ 'start',
25
+ 'end',
26
+ 'flex-start',
27
+ 'flex-end',
28
+ 'baseline',
29
+ 'first baseline',
30
+ 'last baseline',
31
+ 'safe center',
32
+ 'unsafe center',
33
+ ],
34
+ },
35
+ defaultValue: 'start',
36
+ },
37
+ justify: {
38
+ control: {
39
+ type: 'select',
40
+ options: [
41
+ 'start',
42
+ 'center',
43
+ 'end',
44
+ 'flex-start',
45
+ 'flex-end',
46
+ 'left',
47
+ 'right',
48
+ 'normal',
49
+ 'space-between',
50
+ 'space-around',
51
+ 'space-evenly',
52
+ 'stretch',
53
+ 'safe center',
54
+ 'unsafe center',
55
+ ],
56
+ },
57
+ defaultValue: 'start',
58
+ },
59
+ wrap: {
60
+ control: {
61
+ type: 'select',
62
+ options: ['nowrap', 'wrap', 'wrap-reverse'],
63
+ },
64
+ defaultValue: 'nowrap',
65
+ },
66
+ direction: {
67
+ control: {
68
+ type: 'select',
69
+ options: ['row', 'row-reverse', 'column', 'column-reverse'],
70
+ },
71
+ defaultValue: 'row',
72
+ },
73
+ basis: {
74
+ control: {
75
+ type: 'select',
76
+ options: [
77
+ 'auto',
78
+ 'max-content',
79
+ 'min-content',
80
+ 'fit-content',
81
+ 'content',
82
+ 'inherit',
83
+ 'initial',
84
+ 'unset',
85
+ ],
86
+ },
87
+ defaultValue: 'auto',
88
+ },
89
+ grow: {
90
+ control: {
91
+ type: 'select',
92
+ options: ['0', '1', '2', '3', '4', '5'],
93
+ },
94
+ defaultValue: '0',
95
+ },
96
+ shrink: {
97
+ control: {
98
+ type: 'select',
99
+ options: ['0', '1', '2', '3', '4', '5'],
100
+ },
101
+ defaultValue: '1',
102
+ },
103
+ };
104
+
105
+ export default {
106
+ title: 'Layout/Flex',
107
+ component: Flex,
108
+
109
+ argTypes: {
110
+ ...defaultArgs,
111
+ },
112
+
113
+ parameters: {
114
+ viewMode: 'docs',
115
+ },
116
+ };
117
+
118
+ export const Overview = {
119
+ render: Default.bind({}),
120
+ name: 'Overview',
121
+
122
+ argTypes: {
123
+ ...Default.argTypes,
124
+ },
125
+
126
+ args: {},
127
+ };
@@ -0,0 +1,91 @@
1
+ <script setup lang="ts">
2
+ import { computed, type CSSProperties } from 'vue';
3
+ import '../../index.css';
4
+
5
+ export interface IProps {
6
+ /**
7
+ * Shorthand for `alignItems` style prop
8
+ * @type CSSProperties["alignItems"]
9
+ * @example
10
+ * <Flex align="center" />
11
+ * @link https://developer.mozilla.org/en-US/docs/Web/CSS/align-items
12
+ */
13
+ align?: CSSProperties['alignItems'];
14
+
15
+ /**
16
+ * Shorthand for `justifyContent` style prop
17
+ * @type CSSProperties["justifyContent"]
18
+ * @example
19
+ * <Flex justify="center" />
20
+ * @link https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content
21
+ */
22
+ justify?: CSSProperties['justifyContent'];
23
+
24
+ /**
25
+ * Shorthand for `flexWrap` style prop
26
+ * @type CSSProperties["flexWrap"]
27
+ * @example
28
+ * <Flex wrap="wrap" />
29
+ * @link https://developer.mozilla.org/en-US/docs/Web/CSS/flex-wrap
30
+ */
31
+ wrap?: CSSProperties['flexWrap'];
32
+
33
+ /**
34
+ * Shorthand for `flexDirection` style prop
35
+ * @type CSSProperties["flexDirection"]
36
+ * @example
37
+ * <Flex direction="column" />
38
+ * @link https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction
39
+ */
40
+ direction?: CSSProperties['flexDirection'];
41
+
42
+ /**
43
+ * Shorthand for `flexBasis` style prop
44
+ * @type CSSProperties["flexBasis"]
45
+ * @example
46
+ * <Flex basis="50%" />
47
+ * @link https://developer.mozilla.org/en-US/docs/Web/CSS/flex-basis
48
+ */
49
+ basis?: CSSProperties['flexBasis'];
50
+
51
+ /**
52
+ * Shorthand for `flexGrow` style prop
53
+ * @type CSSProperties["flexGrow"]
54
+ * @example
55
+ * <Flex grow="1" />
56
+ * @link https://developer.mozilla.org/en-US/docs/Web/CSS/flex-grow
57
+ */
58
+ grow?: CSSProperties['flexGrow'];
59
+
60
+ /**
61
+ * Shorthand for `flexShrink` style prop
62
+ * @type CSSProperties["flexShrink"]
63
+ * @example
64
+ * <Flex shrink="1" />
65
+ * @link https://developer.mozilla.org/en-US/docs/Web/CSS/flex-shrink
66
+ */
67
+ shrink?: CSSProperties['flexShrink'];
68
+ }
69
+
70
+ const props = defineProps<IProps>();
71
+ const styles = computed(() => ({
72
+ alignItems: props.align,
73
+ justifyContent: props.justify,
74
+ flexWrap: props.wrap,
75
+ flexDirection: props.direction,
76
+ flexBasis: props.basis,
77
+ flexGrow: props.grow,
78
+ flexShrink: props.shrink,
79
+ }));
80
+ </script>
81
+
82
+ <template>
83
+ <div class="flex" :style="styles">
84
+ <slot />
85
+ </div>
86
+ </template>
87
+ <style scoped>
88
+ .flex {
89
+ display: flex;
90
+ }
91
+ </style>
@@ -0,0 +1,20 @@
1
+ import { Canvas, Meta, Story, Controls } from '@storybook/blocks';
2
+ import * as GridStories from './Grid.stories';
3
+
4
+ <Meta of={GridStories} />
5
+
6
+ # Grid
7
+
8
+ Grid is a simple box component that can be used to create layouts.
9
+
10
+ > A simple box Components
11
+
12
+ <Canvas>
13
+ <Story of={GridStories.Overview} />
14
+ </Canvas>
15
+
16
+ ### Playground <a id="playground" />
17
+
18
+ > Changes you make in the controls will be reflected in the example above.
19
+
20
+ <Controls of={GridStories.Overview} exclude={/^(click|default|on.*)$/} />
@@ -0,0 +1,107 @@
1
+ import Grid from './RGrid.vue';
2
+
3
+ const Default = (args) => ({
4
+ components: { Grid },
5
+ setup() {
6
+ return { args };
7
+ },
8
+ template: `<Grid v-bind="args">
9
+ hello world
10
+ </Grid>`,
11
+ });
12
+
13
+ const defaultArgs = {
14
+ templateColumns: {
15
+ control: {
16
+ type: 'text',
17
+ },
18
+ defaultValue: 'repeat(3, 1fr)',
19
+ },
20
+ gap: {
21
+ control: {
22
+ type: 'text',
23
+ },
24
+ defaultValue: '20px',
25
+ },
26
+ rowGap: {
27
+ control: {
28
+ type: 'text',
29
+ },
30
+ defaultValue: '20px',
31
+ },
32
+ columnGap: {
33
+ control: {
34
+ type: 'text',
35
+ },
36
+ defaultValue: '20px',
37
+ },
38
+ autoFlow: {
39
+ control: {
40
+ type: 'select',
41
+ options: ['row', 'column', 'dense', 'row dense', 'column dense'],
42
+ },
43
+ defaultValue: 'row',
44
+ },
45
+ autoRows: {
46
+ control: {
47
+ type: 'select',
48
+ options: ['auto', 'min-content', 'max-content', '1rem'],
49
+ },
50
+ defaultValue: 'auto',
51
+ },
52
+ autoColumns: {
53
+ control: {
54
+ type: 'select',
55
+ options: ['auto', 'min-content', 'max-content', '1rem'],
56
+ },
57
+ defaultValue: 'auto',
58
+ },
59
+ templateRows: {
60
+ control: {
61
+ type: 'text',
62
+ },
63
+ defaultValue: 'repeat(3, 1fr)',
64
+ },
65
+ templateAreas: {
66
+ control: {
67
+ type: 'text',
68
+ },
69
+ defaultValue: 'none',
70
+ },
71
+ column: {
72
+ control: {
73
+ type: 'text',
74
+ },
75
+ defaultValue: '1 / 2',
76
+ },
77
+ row: {
78
+ control: {
79
+ type: 'text',
80
+ },
81
+ defaultValue: '1 / 2',
82
+ },
83
+ };
84
+
85
+ export default {
86
+ title: 'Layout/Grid',
87
+ component: Grid,
88
+
89
+ argTypes: {
90
+ ...defaultArgs,
91
+ },
92
+
93
+ parameters: {
94
+ viewMode: 'docs',
95
+ },
96
+ };
97
+
98
+ export const Overview = {
99
+ render: Default.bind({}),
100
+ name: 'Overview',
101
+
102
+ argTypes: {
103
+ ...Default.argTypes,
104
+ },
105
+
106
+ args: {},
107
+ };