@fastkit/vui 0.6.39 → 0.6.43

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 (189) hide show
  1. package/dist/tool/index.js +3 -0
  2. package/dist/tool/vite-plugin.d.ts +2 -2
  3. package/dist/tool/vite-plugin.d.ts.map +1 -1
  4. package/dist/vui.cjs.js +180 -5
  5. package/dist/vui.cjs.prod.js +180 -5
  6. package/dist/vui.css +24 -14
  7. package/dist/vui.d.ts +2430 -12
  8. package/dist/vui.esm-bundler.js +180 -7
  9. package/dist/vui.min.css +1 -1
  10. package/dist/vui.min.css.map +1 -1
  11. package/package.json +8 -7
  12. package/src/.DS_Store +0 -0
  13. package/src/assets/.DS_Store +0 -0
  14. package/src/assets/builtins/color-scheme.ts +9 -0
  15. package/src/assets/builtins/media-match.ts +3 -0
  16. package/src/components/.DS_Store +0 -0
  17. package/src/components/VAccordion/VAccordion.scss +2 -0
  18. package/src/components/VAccordion/VAccordion.tsx +5 -0
  19. package/src/components/VAccordion/index.ts +1 -0
  20. package/src/components/VApp/VApp.tsx +17 -0
  21. package/src/components/VApp/index.ts +1 -0
  22. package/src/components/VBreadcrumbs/VBreadcrumbs.scss +61 -0
  23. package/src/components/VBreadcrumbs/VBreadcrumbs.tsx +137 -0
  24. package/src/components/VBreadcrumbs/index.ts +1 -0
  25. package/src/components/VButton/.DS_Store +0 -0
  26. package/src/components/VButton/VButton.scss +137 -0
  27. package/src/components/VButton/VButton.tsx +148 -0
  28. package/src/components/VButton/VButtonGroup.scss +23 -0
  29. package/src/components/VButton/VButtonGroup.tsx +81 -0
  30. package/src/components/VButton/index.ts +2 -0
  31. package/src/components/VCard/VCard.scss +3 -0
  32. package/src/components/VCard/VCard.tsx +20 -0
  33. package/src/components/VCard/VCardActions.scss +10 -0
  34. package/src/components/VCard/VCardActions.tsx +16 -0
  35. package/src/components/VCard/VCardContent.scss +3 -0
  36. package/src/components/VCard/VCardContent.tsx +16 -0
  37. package/src/components/VCard/index.ts +3 -0
  38. package/src/components/VCheckable/VCheckable.scss +103 -0
  39. package/src/components/VCheckable/VCheckable.tsx +60 -0
  40. package/src/components/VCheckable/index.ts +1 -0
  41. package/src/components/VCheckbox/VCheckbox.scss +56 -0
  42. package/src/components/VCheckbox/VCheckbox.tsx +63 -0
  43. package/src/components/VCheckbox/index.ts +1 -0
  44. package/src/components/VCheckboxGroup/.DS_Store +0 -0
  45. package/src/components/VCheckboxGroup/VCheckboxGroup.tsx +11 -0
  46. package/src/components/VCheckboxGroup/index.ts +1 -0
  47. package/src/components/VContentSwitcher/VContentSwitcher.scss +73 -0
  48. package/src/components/VContentSwitcher/VContentSwitcher.tsx +156 -0
  49. package/src/components/VContentSwitcher/index.ts +1 -0
  50. package/src/components/VControlField/VControlField.scss +183 -0
  51. package/src/components/VControlField/VControlField.tsx +152 -0
  52. package/src/components/VControlField/index.ts +1 -0
  53. package/src/components/VDataTable/VDataTable.scss +230 -0
  54. package/src/components/VDataTable/VDataTable.tsx +761 -0
  55. package/src/components/VDataTable/index.ts +1 -0
  56. package/src/components/VDrawerLayout/VDrawerLayout.scss +26 -0
  57. package/src/components/VDrawerLayout/VDrawerLayout.tsx +35 -0
  58. package/src/components/VDrawerLayout/index.ts +1 -0
  59. package/src/components/VForm/VForm.tsx +77 -0
  60. package/src/components/VForm/index.ts +1 -0
  61. package/src/components/VFormControl/VFormControl.scss +59 -0
  62. package/src/components/VFormControl/VFormControl.tsx +85 -0
  63. package/src/components/VFormControl/index.ts +1 -0
  64. package/src/components/VGrid/VGridContainer.scss +4 -0
  65. package/src/components/VGrid/VGridContainer.tsx +191 -0
  66. package/src/components/VGrid/VGridItem.scss +3 -0
  67. package/src/components/VGrid/VGridItem.tsx +114 -0
  68. package/src/components/VGrid/index.ts +2 -0
  69. package/src/components/VGrid/schemes.ts +28 -0
  70. package/src/components/VHero/.DS_Store +0 -0
  71. package/src/components/VHero/VHero.scss +26 -0
  72. package/src/components/VHero/VHero.tsx +52 -0
  73. package/src/components/VHero/index.ts +1 -0
  74. package/src/components/VIcon/VIcon.scss +22 -0
  75. package/src/components/VIcon/VIcon.tsx +110 -0
  76. package/src/components/VIcon/index.ts +1 -0
  77. package/src/components/VListTile/VListTile.scss +71 -0
  78. package/src/components/VListTile/VListTile.tsx +121 -0
  79. package/src/components/VListTile/index.ts +1 -0
  80. package/src/components/VNavigation/VNavigation.scss +12 -0
  81. package/src/components/VNavigation/VNavigation.tsx +79 -0
  82. package/src/components/VNavigation/VNavigationItem.scss +14 -0
  83. package/src/components/VNavigation/VNavigationItem.tsx +252 -0
  84. package/src/components/VNavigation/index.ts +2 -0
  85. package/src/components/VOption/VOption.scss +61 -0
  86. package/src/components/VOption/VOption.tsx +52 -0
  87. package/src/components/VOption/index.ts +1 -0
  88. package/src/components/VOptionGroup/VOptionGroup.scss +3 -0
  89. package/src/components/VOptionGroup/VOptionGroup.tsx +55 -0
  90. package/src/components/VOptionGroup/index.ts +1 -0
  91. package/src/components/VPagination/VPagination.scss +100 -0
  92. package/src/components/VPagination/VPagination.tsx +346 -0
  93. package/src/components/VPagination/index.ts +1 -0
  94. package/src/components/VPaper/VPaper.scss +37 -0
  95. package/src/components/VPaper/VPaper.tsx +78 -0
  96. package/src/components/VPaper/index.ts +1 -0
  97. package/src/components/VRadio/.DS_Store +0 -0
  98. package/src/components/VRadio/VRadio.scss +66 -0
  99. package/src/components/VRadio/VRadio.tsx +56 -0
  100. package/src/components/VRadio/index.ts +1 -0
  101. package/src/components/VRadioGroup/.DS_Store +0 -0
  102. package/src/components/VRadioGroup/VRadioGroup.tsx +10 -0
  103. package/src/components/VRadioGroup/index.ts +1 -0
  104. package/src/components/VSelect/VSelect.scss +78 -0
  105. package/src/components/VSelect/VSelect.tsx +204 -0
  106. package/src/components/VSelect/index.ts +1 -0
  107. package/src/components/VSwitch/VSwitch.scss +125 -0
  108. package/src/components/VSwitch/VSwitch.tsx +66 -0
  109. package/src/components/VSwitch/index.ts +1 -0
  110. package/src/components/VSwitchGroup/.DS_Store +0 -0
  111. package/src/components/VSwitchGroup/VSwitchGroup.tsx +11 -0
  112. package/src/components/VSwitchGroup/index.ts +1 -0
  113. package/src/components/VTabs/.DS_Store +0 -0
  114. package/src/components/VTabs/VTab.scss +73 -0
  115. package/src/components/VTabs/VTab.tsx +88 -0
  116. package/src/components/VTabs/VTabs.scss +49 -0
  117. package/src/components/VTabs/VTabs.tsx +315 -0
  118. package/src/components/VTabs/index.ts +1 -0
  119. package/src/components/VTextCounter/VTextCounter.scss +3 -0
  120. package/src/components/VTextCounter/VTextCounter.tsx +21 -0
  121. package/src/components/VTextCounter/index.ts +1 -0
  122. package/src/components/VTextField/VTextField.scss +45 -0
  123. package/src/components/VTextField/VTextField.tsx +96 -0
  124. package/src/components/VTextField/index.ts +1 -0
  125. package/src/components/VTextarea/VTextarea.scss +41 -0
  126. package/src/components/VTextarea/VTextarea.tsx +93 -0
  127. package/src/components/VTextarea/index.ts +1 -0
  128. package/src/components/VToolbar/.DS_Store +0 -0
  129. package/src/components/VToolbar/VToolbar.scss +26 -0
  130. package/src/components/VToolbar/VToolbar.tsx +44 -0
  131. package/src/components/VToolbar/VToolbarEdge.scss +27 -0
  132. package/src/components/VToolbar/VToolbarEdge.tsx +35 -0
  133. package/src/components/VToolbar/VToolbarMenu.scss +7 -0
  134. package/src/components/VToolbar/VToolbarMenu.tsx +26 -0
  135. package/src/components/VToolbar/VToolbarTitle.scss +22 -0
  136. package/src/components/VToolbar/VToolbarTitle.tsx +25 -0
  137. package/src/components/VToolbar/index.ts +4 -0
  138. package/src/components/VWysiwygEditor/.DS_Store +0 -0
  139. package/src/components/VWysiwygEditor/VWysiwygEditor.scss +60 -0
  140. package/src/components/VWysiwygEditor/VWysiwygEditor.tsx +293 -0
  141. package/src/components/VWysiwygEditor/index.ts +2 -0
  142. package/src/components/VWysiwygEditor/schemes.ts +65 -0
  143. package/src/components/VWysiwygEditor/tools/bullet-list.ts +18 -0
  144. package/src/components/VWysiwygEditor/tools/format-bold.ts +19 -0
  145. package/src/components/VWysiwygEditor/tools/format-italic.ts +18 -0
  146. package/src/components/VWysiwygEditor/tools/format-underline.ts +18 -0
  147. package/src/components/VWysiwygEditor/tools/history.ts +26 -0
  148. package/src/components/VWysiwygEditor/tools/index.ts +8 -0
  149. package/src/components/VWysiwygEditor/tools/link.ts +57 -0
  150. package/src/components/VWysiwygEditor/tools/ordered-list.ts +21 -0
  151. package/src/components/VWysiwygEditor/tools/text-color.ts +14 -0
  152. package/src/components/index.ts +32 -0
  153. package/src/components/kits.ts +1 -0
  154. package/src/components/loading.ts +1 -0
  155. package/src/composables/.DS_Store +0 -0
  156. package/src/composables/control.ts +118 -0
  157. package/src/composables/elevation.ts +34 -0
  158. package/src/composables/form-selector.scss +11 -0
  159. package/src/composables/form-selector.tsx +101 -0
  160. package/src/composables/index.ts +4 -0
  161. package/src/composables/vui.ts +9 -0
  162. package/src/index.ts +10 -0
  163. package/src/injections.ts +61 -0
  164. package/src/logger.ts +7 -0
  165. package/src/plugin.tsx +76 -0
  166. package/src/schemes/control.ts +7 -0
  167. package/src/schemes/elevation.ts +26 -0
  168. package/src/schemes/index.ts +2 -0
  169. package/src/service.tsx +242 -0
  170. package/src/styles/.DS_Store +0 -0
  171. package/src/styles/after-effects/display-flow.scss +346 -0
  172. package/src/styles/after-effects/spacing.scss +155 -0
  173. package/src/styles/after-effects/text.scss +90 -0
  174. package/src/styles/after-effects.scss +3 -0
  175. package/src/styles/base.scss +14 -0
  176. package/src/styles/control.scss +11 -0
  177. package/src/styles/core/functions.scss +62 -0
  178. package/src/styles/core/typo.scss +56 -0
  179. package/src/styles/core.scss +2 -0
  180. package/src/styles/elevation.scss +9 -0
  181. package/src/styles/group.scss +57 -0
  182. package/src/styles/index.scss +9 -0
  183. package/src/styles/transition.scss +11 -0
  184. package/src/styles/typo.scss +11 -0
  185. package/src/styles/variables.scss +320 -0
  186. package/src/styles/wysiwyg.scss +24 -0
  187. package/src/tool/.DS_Store +0 -0
  188. package/src/tool/index.ts +2 -0
  189. package/src/tool/vite-plugin.ts +281 -0
@@ -0,0 +1 @@
1
+ export * from './VDataTable';
@@ -0,0 +1,26 @@
1
+ .v-drawer-layout {
2
+ display: flex;
3
+ flex-direction: column;
4
+ align-items: stretch;
5
+ width: 100%;
6
+ height: 100%;
7
+
8
+ &__header {
9
+ display: flex;
10
+ flex: 0 0 var(--v-app-layout-vertial-fixed-height);
11
+ align-items: center;
12
+ justify-content: center;
13
+ height: var(--v-app-layout-vertial-fixed-height);
14
+ }
15
+
16
+ &__body {
17
+ flex: 1 1 100%;
18
+ overflow: auto;
19
+ -webkit-overflow-scrolling: touch;
20
+ }
21
+
22
+ &__footer {
23
+ flex: 0 0 auto;
24
+ margin-top: auto;
25
+ }
26
+ }
@@ -0,0 +1,35 @@
1
+ import './VDrawerLayout.scss';
2
+ import { defineComponent, computed } from 'vue';
3
+ import { createPaperBaseProps, VPaper } from '../VPaper';
4
+
5
+ export const VDrawerLayout = defineComponent({
6
+ name: 'VDrawerLayout',
7
+ props: {
8
+ ...createPaperBaseProps(),
9
+ },
10
+ setup(props, ctx) {
11
+ return () => {
12
+ const paperProps = computed(() => ({
13
+ color: props.color,
14
+ tag: props.tag,
15
+ }));
16
+
17
+ return (
18
+ <VPaper
19
+ class="v-drawer-layout"
20
+ {...paperProps.value}
21
+ square
22
+ headerProps={{
23
+ class: 'v-drawer-layout__header',
24
+ }}
25
+ bodyProps={{
26
+ class: 'v-drawer-layout__body',
27
+ }}
28
+ footerProps={{
29
+ class: 'v-drawer-layout__footer',
30
+ }}
31
+ v-slots={ctx.slots}></VPaper>
32
+ );
33
+ };
34
+ },
35
+ });
@@ -0,0 +1 @@
1
+ export * from './VDrawerLayout';
@@ -0,0 +1,77 @@
1
+ import { defineComponent, computed } from 'vue';
2
+ import {
3
+ VueForm,
4
+ createFormSettings,
5
+ useForm,
6
+ defineSlotsProps,
7
+ renderSlotOrEmpty,
8
+ getDocumentScroller,
9
+ } from '@fastkit/vue-kit';
10
+ import { createControlProps, useControl } from '../../composables';
11
+ import { VUI_FORM_SYMBOL, useVui } from '../../injections';
12
+
13
+ const { props, emits } = createFormSettings({
14
+ nodeType: VUI_FORM_SYMBOL,
15
+ });
16
+
17
+ export interface VFormSlots {
18
+ default: VueForm;
19
+ }
20
+
21
+ export const VForm = defineComponent({
22
+ name: 'VForm',
23
+ props: {
24
+ ...props,
25
+ ...createControlProps(),
26
+ ...defineSlotsProps<VFormSlots>(),
27
+ disableAutoScroll: Boolean,
28
+ },
29
+ emits,
30
+ setup(props, ctx) {
31
+ const vui = useVui();
32
+ const nodeControl = useForm(props, ctx as any, {
33
+ nodeType: VUI_FORM_SYMBOL,
34
+ onAutoValidateError: () => {
35
+ if (props.disableAutoScroll) return;
36
+ const scroller = getDocumentScroller();
37
+ const { firstInvalidEl } = nodeControl;
38
+ firstInvalidEl &&
39
+ scroller.toElement(firstInvalidEl, {
40
+ offset: vui.getAutoScrollToElementOffsetTop(),
41
+ });
42
+ },
43
+ });
44
+ const classes = computed(() => {
45
+ return [
46
+ 'v-form',
47
+ {
48
+ 'v-form--valid': nodeControl.valid,
49
+ 'v-form--invalid': nodeControl.invalid,
50
+ 'v-form--disabled': nodeControl.isDisabled,
51
+ 'v-form--validating': nodeControl.validating,
52
+ 'v-form--pending': nodeControl.pending,
53
+ 'v-form--submiting': nodeControl.submiting,
54
+ },
55
+ ];
56
+ });
57
+ useControl(props);
58
+
59
+ return {
60
+ ...nodeControl.expose(),
61
+ classes,
62
+ };
63
+ },
64
+ render() {
65
+ const { form } = this;
66
+ return (
67
+ <form
68
+ ref={this.formRef()}
69
+ class={this.classes}
70
+ action={this.nativeAction}
71
+ spellcheck={this.spellcheck}
72
+ onSubmit={form.handleSubmit}>
73
+ {renderSlotOrEmpty(this.$slots, 'default', form as any)}
74
+ </form>
75
+ );
76
+ },
77
+ });
@@ -0,0 +1 @@
1
+ export * from './VForm';
@@ -0,0 +1,59 @@
1
+ .v-form-control {
2
+ display: flex;
3
+ flex-direction: column;
4
+ max-width: 100%;
5
+ margin: var(--control-horizontal-margin) 0;
6
+
7
+ // --control-label-font-size: calc(var(--control-field-font-size) * 0.75); // 12
8
+ --my-label-color: var(--control-label-color);
9
+ --my-message-color: var(--control-message-color);
10
+
11
+ &--invalid:not(#{&}--readonly) {
12
+ --my-label-color: var(--main-color);
13
+ --my-message-color: var(--main-color);
14
+ }
15
+
16
+ &--disabled {
17
+ --my-label-color: var(--control-disabled-color);
18
+ --my-message-color: var(--control-disabled-color);
19
+ }
20
+
21
+ &__label {
22
+ align-self: flex-start;
23
+ font-size: var(--control-label-font-size);
24
+ font-weight: var(--control-label-font-weight);
25
+ line-height: var(--control-label-height);
26
+ color: var(--my-label-color);
27
+ letter-spacing: 0.00938em;
28
+ }
29
+
30
+ // &--disabled &__body {
31
+ // user-select: none;
32
+ // }
33
+
34
+ &__info {
35
+ display: flex;
36
+ padding-top: 3px;
37
+ }
38
+
39
+ &__message,
40
+ &__appends {
41
+ margin: 0 var(--control-message-horizontal-margin);
42
+ font-size: var(--control-message-font-size);
43
+ line-height: 1.66;
44
+ color: var(--my-message-color);
45
+ }
46
+
47
+ &__message {
48
+ flex: 1 0;
49
+ // margin: 0 var(--control-message-horizontal-margin);
50
+ // font-size: var(--control-message-font-size);
51
+ // line-height: 1.66;
52
+ // color: var(--my-message-color);
53
+ }
54
+
55
+ &__appends {
56
+ flex: 0 1;
57
+ margin-left: auto;
58
+ }
59
+ }
@@ -0,0 +1,85 @@
1
+ import './VFormControl.scss';
2
+ import { computed, defineComponent } from 'vue';
3
+ import {
4
+ createFormControlSettings,
5
+ useFormControl,
6
+ FormControlSlots,
7
+ defineSlotsProps,
8
+ FormControl,
9
+ renderSlotOrEmpty,
10
+ } from '@fastkit/vue-kit';
11
+ import { useVuiColorProvider, useVui } from '../../injections';
12
+
13
+ const { props, emits } = createFormControlSettings();
14
+
15
+ export const VFormControl = defineComponent({
16
+ name: 'VFormControl',
17
+ props: {
18
+ ...props,
19
+ ...defineSlotsProps<
20
+ FormControlSlots & {
21
+ default: FormControl;
22
+ }
23
+ >(),
24
+ },
25
+ emits,
26
+ setup(props, ctx) {
27
+ const control = useFormControl(props, ctx);
28
+ ctx.expose(control.expose());
29
+
30
+ const vui = useVui();
31
+ const colorProvider = useVuiColorProvider();
32
+
33
+ const classes = computed(() => [
34
+ {
35
+ 'v-form-control--validating': control.validating,
36
+ 'v-form-control--pending': control.pending,
37
+ 'v-form-control--focused': control.focused,
38
+ 'v-form-control--dirty': control.dirty,
39
+ 'v-form-control--pristine': control.pristine,
40
+ 'v-form-control--disabled': control.disabled,
41
+ 'v-form-control--readonly': control.readonly,
42
+ 'v-form-control--touched': control.touched,
43
+ 'v-form-control--untouched': control.untouched,
44
+ 'v-form-control--invalid': control.invalid,
45
+ 'v-form-control--valid': control.valid,
46
+ },
47
+ colorProvider.className(
48
+ control.invalid && !control.readonly ? 'error' : 'primary',
49
+ ),
50
+ ]);
51
+
52
+ return () => {
53
+ const label = control.renderLabel();
54
+ const message = control.renderMessage();
55
+ const appends = control.renderInfoAppends();
56
+ return (
57
+ <div class={['v-form-control', classes.value]}>
58
+ {label && (
59
+ <label
60
+ class="v-form-control__label"
61
+ onClick={(ev) => {
62
+ ctx.emit('clickLabel', ev, control);
63
+ }}>
64
+ {label}
65
+ {control.required && vui.getRequiredChip()}
66
+ </label>
67
+ )}
68
+ <div class="v-form-control__body">
69
+ {renderSlotOrEmpty(ctx.slots, 'default', control as any)}
70
+ {!props.hiddenInfo && (
71
+ <div class="v-form-control__info">
72
+ {!!message && (
73
+ <div class="v-form-control__message">{message}</div>
74
+ )}
75
+ {!!appends && (
76
+ <div class="v-form-control__appends">{appends}</div>
77
+ )}
78
+ </div>
79
+ )}
80
+ </div>
81
+ </div>
82
+ );
83
+ };
84
+ },
85
+ });
@@ -0,0 +1 @@
1
+ export * from './VFormControl';
@@ -0,0 +1,4 @@
1
+ .v-grid-container {
2
+ display: flex;
3
+ flex-wrap: wrap;
4
+ }
@@ -0,0 +1,191 @@
1
+ import './VGridContainer.scss';
2
+
3
+ import { defineComponent, computed } from 'vue';
4
+ import { htmlAttributesPropOptions } from '@fastkit/vue-utils';
5
+ import { RawGridValueProp, extractRawGridValueClasses } from './schemes';
6
+
7
+ export type GridContainerSpacingValue =
8
+ | 0
9
+ | 0.5
10
+ | 1
11
+ | 1.5
12
+ | 2
13
+ | 2.5
14
+ | 3
15
+ | 3.5
16
+ | 4
17
+ | 4.5
18
+ | 5
19
+ | 5.5
20
+ | 6
21
+ | 6.5
22
+ | 7
23
+ | 7.5
24
+ | 8
25
+ | 8.5
26
+ | 9
27
+ | 9.5
28
+ | 10;
29
+
30
+ function spacingValueToString(value: GridContainerSpacingValue): string {
31
+ return Number.isInteger(value) ? String(value) : `${value}h`;
32
+ }
33
+
34
+ export type GridContainerDirectionValue =
35
+ | 'row'
36
+ | 'row-reverse'
37
+ | 'column'
38
+ | 'column-reverse';
39
+
40
+ export type GridContainerWrapValue = 'wrap' | 'nowrap' | 'wrap-reverse';
41
+
42
+ export type GridContainerAlignContentValue =
43
+ | 'flex-start'
44
+ | 'flex-end'
45
+ | 'start'
46
+ | 'end'
47
+ | 'stretch'
48
+ | 'baseline'
49
+ | 'center'
50
+ | 'self-start'
51
+ | 'self-end';
52
+
53
+ export type GridContainerJustifyContentValue =
54
+ | 'start'
55
+ | 'end'
56
+ | 'flex-start'
57
+ | 'flex-end'
58
+ | 'center'
59
+ | 'baseline'
60
+ | 'space-between'
61
+ | 'space-around'
62
+ | 'space-evenly'
63
+ | 'stretch';
64
+
65
+ export const VGridContainer = defineComponent({
66
+ name: 'VGridContainer',
67
+ inheritAttrs: false,
68
+ props: {
69
+ ...htmlAttributesPropOptions,
70
+ wrapperTag: {
71
+ type: String,
72
+ default: 'div',
73
+ },
74
+ tag: {
75
+ type: String,
76
+ default: 'div',
77
+ },
78
+ spacing:
79
+ undefined as unknown as RawGridValueProp<GridContainerSpacingValue>,
80
+ spacingX:
81
+ undefined as unknown as RawGridValueProp<GridContainerSpacingValue>,
82
+ spacingY:
83
+ undefined as unknown as RawGridValueProp<GridContainerSpacingValue>,
84
+ direction:
85
+ undefined as unknown as RawGridValueProp<GridContainerDirectionValue>,
86
+ wrap: undefined as unknown as RawGridValueProp<GridContainerWrapValue>,
87
+ alignContent:
88
+ undefined as unknown as RawGridValueProp<GridContainerAlignContentValue>,
89
+ justifyContent:
90
+ undefined as unknown as RawGridValueProp<GridContainerJustifyContentValue>,
91
+ },
92
+ setup(props, ctx) {
93
+ const data = computed(() => {
94
+ const classes: any[] = [];
95
+
96
+ const attrs = {
97
+ ...ctx.attrs,
98
+ };
99
+
100
+ const {
101
+ spacing,
102
+ spacingX,
103
+ spacingY,
104
+ direction,
105
+ wrap,
106
+ alignContent,
107
+ justifyContent,
108
+ } = props;
109
+ const wrapperClass = attrs.class;
110
+ const wrapperStyle = attrs.style as any;
111
+
112
+ delete attrs.class;
113
+ delete attrs.style;
114
+ delete attrs.spacing;
115
+ delete attrs.spacingX;
116
+ delete attrs.spacingY;
117
+ delete attrs.direction;
118
+ delete attrs.wrap;
119
+ delete attrs.alignContent;
120
+ delete attrs.justifyContent;
121
+
122
+ // spacingX = mergeSpacing(spacing, spacingX);
123
+ // spacingY = mergeSpacing(spacing, spacingY);
124
+ // if (!spacingX) {
125
+ // spacingX = spacing;
126
+ // }
127
+
128
+ // align &&
129
+ // classes.push(extractRawGridItemValueClasses(align, 'self-align-'));
130
+ // justify &&
131
+ // classes.push(extractRawGridItemValueClasses(justify, 'self-justify-'));
132
+ spacing != null &&
133
+ classes.push(
134
+ extractRawGridValueClasses(
135
+ spacing,
136
+ 'grid-spacing-',
137
+ spacingValueToString,
138
+ ),
139
+ );
140
+ spacingX != null &&
141
+ classes.push(
142
+ extractRawGridValueClasses(
143
+ spacingX,
144
+ 'grid-spacing-x-',
145
+ spacingValueToString,
146
+ ),
147
+ );
148
+ spacingY != null &&
149
+ classes.push(
150
+ extractRawGridValueClasses(
151
+ spacingY,
152
+ 'grid-spacing-y-',
153
+ spacingValueToString,
154
+ ),
155
+ );
156
+
157
+ direction &&
158
+ classes.push(extractRawGridValueClasses(direction, 'direction-'));
159
+ wrap && classes.push(extractRawGridValueClasses(wrap, ''));
160
+ alignContent &&
161
+ classes.push(extractRawGridValueClasses(alignContent, 'align-'));
162
+ justifyContent &&
163
+ classes.push(extractRawGridValueClasses(justifyContent, 'justify-'));
164
+
165
+ return {
166
+ wrapperClass,
167
+ wrapperStyle,
168
+ classes,
169
+ attrs,
170
+ };
171
+ });
172
+
173
+ return () => {
174
+ const WrapperTag = props.wrapperTag as 'div';
175
+ const TagName = props.tag as 'div';
176
+ const { wrapperClass, wrapperStyle, classes, attrs } = data.value;
177
+
178
+ return (
179
+ <WrapperTag
180
+ class={['v-grid-container-wrapper', wrapperClass]}
181
+ style={wrapperStyle}>
182
+ <TagName
183
+ class={['v-grid-container grid-container', classes]}
184
+ {...attrs}
185
+ v-slots={ctx.slots}
186
+ />
187
+ </WrapperTag>
188
+ );
189
+ };
190
+ },
191
+ });
@@ -0,0 +1,3 @@
1
+ .v-grid-item {
2
+ display: block;
3
+ }
@@ -0,0 +1,114 @@
1
+ import './VGridItem.scss';
2
+
3
+ import { defineComponent, computed } from 'vue';
4
+ // import { MediaMatchKey, MEDIA_MATCH_CONDITIONS } from '@fastkit/media-match';
5
+ import { htmlAttributesPropOptions } from '@fastkit/vue-utils';
6
+ import { RawGridValueProp, extractRawGridValueClasses } from './schemes';
7
+
8
+ export type GridItemNumberSizeValue =
9
+ | 1
10
+ | 2
11
+ | 3
12
+ | 4
13
+ | 5
14
+ | 6
15
+ | 7
16
+ | 8
17
+ | 9
18
+ | 10
19
+ | 11
20
+ | 12;
21
+
22
+ export type GridItemSizeValue = GridItemNumberSizeValue | 'auto';
23
+
24
+ // type MQSizeProps = Record<
25
+ // MediaMatchKey,
26
+ // PropType<GridItemSizeValue | undefined>
27
+ // >;
28
+
29
+ export type GridItemAlignValue =
30
+ | 'flex-start'
31
+ | 'flex-end'
32
+ | 'start'
33
+ | 'end'
34
+ | 'stretch'
35
+ | 'baseline'
36
+ | 'center'
37
+ | 'self-start'
38
+ | 'self-end';
39
+
40
+ export type GridItemJustifyValue =
41
+ | 'start'
42
+ | 'end'
43
+ | 'flex-start'
44
+ | 'flex-end'
45
+ | 'center'
46
+ | 'baseline'
47
+ | 'stretch';
48
+
49
+ export const VGridItem = defineComponent({
50
+ name: 'VGridItem',
51
+ inheritAttrs: false,
52
+ props: {
53
+ ...htmlAttributesPropOptions,
54
+ tag: {
55
+ type: String,
56
+ default: 'div',
57
+ },
58
+ // ...(undefined as unknown as MQSizeProps),
59
+ size: undefined as unknown as RawGridValueProp<GridItemSizeValue>,
60
+ align: undefined as unknown as RawGridValueProp<GridItemAlignValue>,
61
+ justify: undefined as unknown as RawGridValueProp<GridItemJustifyValue>,
62
+ order: undefined as unknown as RawGridValueProp<number | string>,
63
+ },
64
+ setup(props, ctx) {
65
+ const data = computed(() => {
66
+ const classes: any[] = [];
67
+
68
+ const attrs = {
69
+ ...ctx.attrs,
70
+ };
71
+
72
+ const { size, align, justify, order } = props;
73
+
74
+ delete attrs.size;
75
+ delete attrs.align;
76
+ delete attrs.justify;
77
+ delete attrs.order;
78
+
79
+ size != null &&
80
+ classes.push(extractRawGridValueClasses(size, 'grid-size-'));
81
+ align && classes.push(extractRawGridValueClasses(align, 'self-align-'));
82
+ justify &&
83
+ classes.push(extractRawGridValueClasses(justify, 'self-justify-'));
84
+ order != null &&
85
+ classes.push(extractRawGridValueClasses(order, 'order-'));
86
+
87
+ // MEDIA_MATCH_CONDITIONS.forEach(({ key }) => {
88
+ // const v = attrs[key];
89
+ // delete attrs[key];
90
+ // if (v != null) {
91
+ // classes.push(`grid-size-${v}--${key}`);
92
+ // }
93
+ // });
94
+
95
+ return {
96
+ classes,
97
+ attrs,
98
+ };
99
+ });
100
+
101
+ return () => {
102
+ const TagName = props.tag as 'div';
103
+ const { classes, attrs } = data.value;
104
+
105
+ return (
106
+ <TagName
107
+ class={['v-grid-item grid-item', classes]}
108
+ {...attrs}
109
+ v-slots={ctx.slots}
110
+ />
111
+ );
112
+ };
113
+ },
114
+ });
@@ -0,0 +1,2 @@
1
+ export * from './VGridItem';
2
+ export * from './VGridContainer';
@@ -0,0 +1,28 @@
1
+ import { PropType } from 'vue';
2
+ import { MediaMatchKey } from '@fastkit/media-match';
3
+
4
+ export type RawGridValue<T extends number | string = number | string> =
5
+ | T
6
+ | Partial<Record<MediaMatchKey, T>>
7
+ | undefined;
8
+
9
+ export type RawGridValueProp<T extends number | string = number | string> =
10
+ PropType<RawGridValue<T>>;
11
+
12
+ export function extractRawGridValueClasses<
13
+ T extends number | string = number | string,
14
+ >(
15
+ value: NonNullable<RawGridValue<T>>,
16
+ prefix: string,
17
+ getter?: (value: T) => string,
18
+ ): string | string[] {
19
+ if (typeof value !== 'object')
20
+ return `${prefix}${getter ? getter(value) : value}`;
21
+ return Object.entries(value).map(([breakpoint, breakpointValue]) => {
22
+ return `${prefix}${
23
+ getter ? getter(breakpointValue) : breakpointValue
24
+ }--${breakpoint}`;
25
+ });
26
+ }
27
+
28
+ // export const DEFAULT_MEDIA_MATCH_KEY = MEDIA_MATCH_CONDITIONS[0].key;
Binary file
@@ -0,0 +1,26 @@
1
+ .v-hero {
2
+ --hero-background-color: var(--main-color);
3
+ --hero-text-color: var(--text-color);
4
+
5
+ display: flex;
6
+ align-items: center;
7
+ padding: 20px 30px;
8
+ margin: 0;
9
+ color: var(--hero-text-color);
10
+ background-color: var(--hero-background-color);
11
+
12
+ &__title {
13
+ flex: 1 1 100%;
14
+ margin: 0;
15
+ font-size: 1.75rem;
16
+ font-weight: 300;
17
+ line-height: 1;
18
+ color: inherit;
19
+ }
20
+
21
+ &__adornment {
22
+ flex: 0 0 auto;
23
+ padding-left: 10px;
24
+ margin-left: auto;
25
+ }
26
+ }