@fastkit/vui 0.6.36 → 0.6.40
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/tool/index.js +3 -0
- package/dist/tool/vite-plugin.d.ts.map +1 -1
- package/dist/vui.cjs.js +214 -19
- package/dist/vui.cjs.prod.js +214 -19
- package/dist/vui.css +69 -17
- package/dist/vui.d.ts +3609 -17
- package/dist/vui.esm-bundler.js +214 -21
- package/dist/vui.min.css +1 -1
- package/dist/vui.min.css.map +1 -1
- package/package.json +8 -7
- package/src/.DS_Store +0 -0
- package/src/assets/.DS_Store +0 -0
- package/src/assets/builtins/color-scheme.ts +9 -0
- package/src/assets/builtins/media-match.ts +3 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/VAccordion/VAccordion.scss +2 -0
- package/src/components/VAccordion/VAccordion.tsx +5 -0
- package/src/components/VAccordion/index.ts +1 -0
- package/src/components/VApp/VApp.tsx +17 -0
- package/src/components/VApp/index.ts +1 -0
- package/src/components/VBreadcrumbs/VBreadcrumbs.scss +61 -0
- package/src/components/VBreadcrumbs/VBreadcrumbs.tsx +137 -0
- package/src/components/VBreadcrumbs/index.ts +1 -0
- package/src/components/VButton/.DS_Store +0 -0
- package/src/components/VButton/VButton.scss +137 -0
- package/src/components/VButton/VButton.tsx +148 -0
- package/src/components/VButton/VButtonGroup.scss +23 -0
- package/src/components/VButton/VButtonGroup.tsx +81 -0
- package/src/components/VButton/index.ts +2 -0
- package/src/components/VCard/VCard.scss +3 -0
- package/src/components/VCard/VCard.tsx +20 -0
- package/src/components/VCard/VCardActions.scss +10 -0
- package/src/components/VCard/VCardActions.tsx +16 -0
- package/src/components/VCard/VCardContent.scss +3 -0
- package/src/components/VCard/VCardContent.tsx +16 -0
- package/src/components/VCard/index.ts +3 -0
- package/src/components/VCheckable/VCheckable.scss +103 -0
- package/src/components/VCheckable/VCheckable.tsx +60 -0
- package/src/components/VCheckable/index.ts +1 -0
- package/src/components/VCheckbox/VCheckbox.scss +56 -0
- package/src/components/VCheckbox/VCheckbox.tsx +63 -0
- package/src/components/VCheckbox/index.ts +1 -0
- package/src/components/VCheckboxGroup/.DS_Store +0 -0
- package/src/components/VCheckboxGroup/VCheckboxGroup.tsx +11 -0
- package/src/components/VCheckboxGroup/index.ts +1 -0
- package/src/components/VContentSwitcher/VContentSwitcher.scss +73 -0
- package/src/components/VContentSwitcher/VContentSwitcher.tsx +156 -0
- package/src/components/VContentSwitcher/index.ts +1 -0
- package/src/components/VControlField/VControlField.scss +183 -0
- package/src/components/VControlField/VControlField.tsx +152 -0
- package/src/components/VControlField/index.ts +1 -0
- package/src/components/VDataTable/VDataTable.scss +230 -0
- package/src/components/VDataTable/VDataTable.tsx +761 -0
- package/src/components/VDataTable/index.ts +1 -0
- package/src/components/VDrawerLayout/VDrawerLayout.scss +26 -0
- package/src/components/VDrawerLayout/VDrawerLayout.tsx +35 -0
- package/src/components/VDrawerLayout/index.ts +1 -0
- package/src/components/VForm/VForm.tsx +77 -0
- package/src/components/VForm/index.ts +1 -0
- package/src/components/VFormControl/VFormControl.scss +59 -0
- package/src/components/VFormControl/VFormControl.tsx +85 -0
- package/src/components/VFormControl/index.ts +1 -0
- package/src/components/VGrid/VGridContainer.scss +4 -0
- package/src/components/VGrid/VGridContainer.tsx +191 -0
- package/src/components/VGrid/VGridItem.scss +3 -0
- package/src/components/VGrid/VGridItem.tsx +110 -0
- package/src/components/VGrid/index.ts +2 -0
- package/src/components/VGrid/schemes.ts +28 -0
- package/src/components/VHero/.DS_Store +0 -0
- package/src/components/VHero/VHero.scss +26 -0
- package/src/components/VHero/VHero.tsx +52 -0
- package/src/components/VHero/index.ts +1 -0
- package/src/components/VIcon/VIcon.scss +22 -0
- package/src/components/VIcon/VIcon.tsx +110 -0
- package/src/components/VIcon/index.ts +1 -0
- package/src/components/VListTile/VListTile.scss +71 -0
- package/src/components/VListTile/VListTile.tsx +121 -0
- package/src/components/VListTile/index.ts +1 -0
- package/src/components/VNavigation/VNavigation.scss +12 -0
- package/src/components/VNavigation/VNavigation.tsx +79 -0
- package/src/components/VNavigation/VNavigationItem.scss +14 -0
- package/src/components/VNavigation/VNavigationItem.tsx +252 -0
- package/src/components/VNavigation/index.ts +2 -0
- package/src/components/VOption/VOption.scss +61 -0
- package/src/components/VOption/VOption.tsx +52 -0
- package/src/components/VOption/index.ts +1 -0
- package/src/components/VOptionGroup/VOptionGroup.scss +3 -0
- package/src/components/VOptionGroup/VOptionGroup.tsx +55 -0
- package/src/components/VOptionGroup/index.ts +1 -0
- package/src/components/VPagination/VPagination.scss +100 -0
- package/src/components/VPagination/VPagination.tsx +346 -0
- package/src/components/VPagination/index.ts +1 -0
- package/src/components/VPaper/VPaper.scss +37 -0
- package/src/components/VPaper/VPaper.tsx +78 -0
- package/src/components/VPaper/index.ts +1 -0
- package/src/components/VRadio/.DS_Store +0 -0
- package/src/components/VRadio/VRadio.scss +66 -0
- package/src/components/VRadio/VRadio.tsx +56 -0
- package/src/components/VRadio/index.ts +1 -0
- package/src/components/VRadioGroup/.DS_Store +0 -0
- package/src/components/VRadioGroup/VRadioGroup.tsx +10 -0
- package/src/components/VRadioGroup/index.ts +1 -0
- package/src/components/VSelect/VSelect.scss +78 -0
- package/src/components/VSelect/VSelect.tsx +204 -0
- package/src/components/VSelect/index.ts +1 -0
- package/src/components/VSwitch/VSwitch.scss +125 -0
- package/src/components/VSwitch/VSwitch.tsx +66 -0
- package/src/components/VSwitch/index.ts +1 -0
- package/src/components/VSwitchGroup/.DS_Store +0 -0
- package/src/components/VSwitchGroup/VSwitchGroup.tsx +11 -0
- package/src/components/VSwitchGroup/index.ts +1 -0
- package/src/components/VTabs/.DS_Store +0 -0
- package/src/components/VTabs/VTab.scss +73 -0
- package/src/components/VTabs/VTab.tsx +88 -0
- package/src/components/VTabs/VTabs.scss +49 -0
- package/src/components/VTabs/VTabs.tsx +315 -0
- package/src/components/VTabs/index.ts +1 -0
- package/src/components/VTextCounter/VTextCounter.scss +3 -0
- package/src/components/VTextCounter/VTextCounter.tsx +21 -0
- package/src/components/VTextCounter/index.ts +1 -0
- package/src/components/VTextField/VTextField.scss +45 -0
- package/src/components/VTextField/VTextField.tsx +96 -0
- package/src/components/VTextField/index.ts +1 -0
- package/src/components/VTextarea/VTextarea.scss +41 -0
- package/src/components/VTextarea/VTextarea.tsx +93 -0
- package/src/components/VTextarea/index.ts +1 -0
- package/src/components/VToolbar/.DS_Store +0 -0
- package/src/components/VToolbar/VToolbar.scss +26 -0
- package/src/components/VToolbar/VToolbar.tsx +44 -0
- package/src/components/VToolbar/VToolbarEdge.scss +27 -0
- package/src/components/VToolbar/VToolbarEdge.tsx +35 -0
- package/src/components/VToolbar/VToolbarMenu.scss +7 -0
- package/src/components/VToolbar/VToolbarMenu.tsx +26 -0
- package/src/components/VToolbar/VToolbarTitle.scss +22 -0
- package/src/components/VToolbar/VToolbarTitle.tsx +25 -0
- package/src/components/VToolbar/index.ts +4 -0
- package/src/components/VWysiwygEditor/.DS_Store +0 -0
- package/src/components/VWysiwygEditor/VWysiwygEditor.scss +60 -0
- package/src/components/VWysiwygEditor/VWysiwygEditor.tsx +293 -0
- package/src/components/VWysiwygEditor/index.ts +2 -0
- package/src/components/VWysiwygEditor/schemes.ts +65 -0
- package/src/components/VWysiwygEditor/tools/bullet-list.ts +18 -0
- package/src/components/VWysiwygEditor/tools/format-bold.ts +19 -0
- package/src/components/VWysiwygEditor/tools/format-italic.ts +18 -0
- package/src/components/VWysiwygEditor/tools/format-underline.ts +18 -0
- package/src/components/VWysiwygEditor/tools/history.ts +26 -0
- package/src/components/VWysiwygEditor/tools/index.ts +8 -0
- package/src/components/VWysiwygEditor/tools/link.ts +57 -0
- package/src/components/VWysiwygEditor/tools/ordered-list.ts +21 -0
- package/src/components/VWysiwygEditor/tools/text-color.ts +14 -0
- package/src/components/index.ts +32 -0
- package/src/components/kits.ts +1 -0
- package/src/components/loading.ts +1 -0
- package/src/composables/.DS_Store +0 -0
- package/src/composables/control.ts +118 -0
- package/src/composables/elevation.ts +34 -0
- package/src/composables/form-selector.scss +11 -0
- package/src/composables/form-selector.tsx +101 -0
- package/src/composables/index.ts +4 -0
- package/src/composables/vui.ts +9 -0
- package/src/index.ts +10 -0
- package/src/injections.ts +61 -0
- package/src/logger.ts +7 -0
- package/src/plugin.tsx +76 -0
- package/src/schemes/control.ts +7 -0
- package/src/schemes/elevation.ts +26 -0
- package/src/schemes/index.ts +2 -0
- package/src/service.tsx +242 -0
- package/src/styles/.DS_Store +0 -0
- package/src/styles/after-effects/display-flow.scss +346 -0
- package/src/styles/after-effects/spacing.scss +155 -0
- package/src/styles/after-effects/text.scss +90 -0
- package/src/styles/after-effects.scss +3 -0
- package/src/styles/base.scss +14 -0
- package/src/styles/control.scss +11 -0
- package/src/styles/core/functions.scss +62 -0
- package/src/styles/core/typo.scss +56 -0
- package/src/styles/core.scss +2 -0
- package/src/styles/elevation.scss +9 -0
- package/src/styles/group.scss +57 -0
- package/src/styles/index.scss +9 -0
- package/src/styles/transition.scss +11 -0
- package/src/styles/typo.scss +11 -0
- package/src/styles/variables.scss +320 -0
- package/src/styles/wysiwyg.scss +24 -0
- package/src/tool/.DS_Store +0 -0
- package/src/tool/index.ts +2 -0
- package/src/tool/vite-plugin.ts +281 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import './VBreadcrumbs.scss';
|
|
2
|
+
|
|
3
|
+
import { defineComponent, PropType, VNodeChild, computed } from 'vue';
|
|
4
|
+
import { VLink, NavigationableInheritProps } from '@fastkit/vue-utils';
|
|
5
|
+
import { useVui } from '../../injections';
|
|
6
|
+
import type { VuiService } from '../../service';
|
|
7
|
+
import { RawIconProp, resolveRawIconProp } from '../VIcon';
|
|
8
|
+
|
|
9
|
+
export interface BreadcrumbsItem
|
|
10
|
+
extends Pick<NavigationableInheritProps, 'to' | 'disabled'> {
|
|
11
|
+
/**
|
|
12
|
+
* "正確なマッチモード" を強制する場合true
|
|
13
|
+
*/
|
|
14
|
+
// exact?: boolean;
|
|
15
|
+
icon?: RawIconProp;
|
|
16
|
+
text: VNodeChild | ((vui: VuiService) => VNodeChild);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type RawBreadcrumbsItem = string | BreadcrumbsItem;
|
|
20
|
+
|
|
21
|
+
export const VBreadcrumbs = defineComponent({
|
|
22
|
+
name: 'VBreadcrumbs',
|
|
23
|
+
props: {
|
|
24
|
+
items: {
|
|
25
|
+
type: Array as PropType<BreadcrumbsItem[]>,
|
|
26
|
+
default: () => [],
|
|
27
|
+
},
|
|
28
|
+
divider: [String, Function] as PropType<
|
|
29
|
+
VNodeChild | ((vui: VuiService) => VNodeChild)
|
|
30
|
+
>,
|
|
31
|
+
// ...defineSlotsProps<{}>(),
|
|
32
|
+
},
|
|
33
|
+
setup(props, ctx) {
|
|
34
|
+
const vui = useVui();
|
|
35
|
+
|
|
36
|
+
const computedItemsRef = computed(() => {
|
|
37
|
+
const items: BreadcrumbsItem[] = props.items.map((rawItem) => {
|
|
38
|
+
return typeof rawItem === 'string'
|
|
39
|
+
? {
|
|
40
|
+
text: rawItem,
|
|
41
|
+
}
|
|
42
|
+
: rawItem;
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
return items.map((item) => {
|
|
46
|
+
const { to, text } = item;
|
|
47
|
+
const {
|
|
48
|
+
disabled = vui.location.match(to) || !vui.location.isAvairable(to),
|
|
49
|
+
} = item;
|
|
50
|
+
return {
|
|
51
|
+
...item,
|
|
52
|
+
disabled,
|
|
53
|
+
text: typeof text === 'function' ? text(vui) : text,
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const lengthRef = computed(() => computedItemsRef.value.length);
|
|
59
|
+
|
|
60
|
+
const defaultDividerSlot = () => {
|
|
61
|
+
return [<i class="v-breadcrumbs__divider__icon" />];
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return () => {
|
|
65
|
+
if (lengthRef.value < 1) return;
|
|
66
|
+
let dividerSlot: (vui: VuiService) => VNodeChild;
|
|
67
|
+
const propDivider = props.divider;
|
|
68
|
+
if (propDivider) {
|
|
69
|
+
dividerSlot =
|
|
70
|
+
typeof propDivider === 'function' ? propDivider : () => propDivider;
|
|
71
|
+
} else {
|
|
72
|
+
dividerSlot = defaultDividerSlot;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const children: VNodeChild[] = [];
|
|
76
|
+
|
|
77
|
+
computedItemsRef.value.forEach((item, index) => {
|
|
78
|
+
const { text, icon, disabled, to } = item;
|
|
79
|
+
|
|
80
|
+
if (index > 0) {
|
|
81
|
+
const divider = dividerSlot(vui);
|
|
82
|
+
if (divider) {
|
|
83
|
+
children.push(
|
|
84
|
+
<li class="v-breadcrumbs__divider" key={`divider-${index}`}>
|
|
85
|
+
{divider}
|
|
86
|
+
</li>,
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const myChildren: VNodeChild[] = [];
|
|
91
|
+
|
|
92
|
+
if (icon) {
|
|
93
|
+
const $icon = resolveRawIconProp(false, icon, {
|
|
94
|
+
class: 'v-breadcrumbs__icon',
|
|
95
|
+
});
|
|
96
|
+
if ($icon) {
|
|
97
|
+
myChildren.push($icon);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (text) myChildren.push(text);
|
|
102
|
+
|
|
103
|
+
const itemChild = to ? (
|
|
104
|
+
<VLink
|
|
105
|
+
class="v-breadcrumbs__link"
|
|
106
|
+
to={to}
|
|
107
|
+
exactActiveClass="v-breadcrumbs__link--active"
|
|
108
|
+
// exact={exact}
|
|
109
|
+
>
|
|
110
|
+
{myChildren}
|
|
111
|
+
</VLink>
|
|
112
|
+
) : (
|
|
113
|
+
myChildren
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
children.push(
|
|
117
|
+
<li
|
|
118
|
+
class={[
|
|
119
|
+
'v-breadcrumbs__item',
|
|
120
|
+
{
|
|
121
|
+
'v-breadcrumbs__item--disabled': disabled,
|
|
122
|
+
},
|
|
123
|
+
]}
|
|
124
|
+
key={`link-${index}`}>
|
|
125
|
+
{itemChild}
|
|
126
|
+
</li>,
|
|
127
|
+
);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<nav class="v-breadcrumbs">
|
|
132
|
+
<ul class="v-breadcrumbs__list">{children}</ul>
|
|
133
|
+
</nav>
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
},
|
|
137
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './VBreadcrumbs';
|
|
Binary file
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
|
|
3
|
+
.v-button {
|
|
4
|
+
// $base-height: 2.285714285714286em;
|
|
5
|
+
$base-height: 2.571428571428571em;
|
|
6
|
+
|
|
7
|
+
--padding: 1em;
|
|
8
|
+
--height: #{$base-height};
|
|
9
|
+
--icon-margin: 0.6em;
|
|
10
|
+
|
|
11
|
+
position: relative;
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
flex: 0 0 auto;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
min-width: calc(var(--root-em) * 4);
|
|
17
|
+
// height: calc(var(--root-em) * 2);
|
|
18
|
+
height: var(--height);
|
|
19
|
+
// padding: 0 var(--root-em);
|
|
20
|
+
padding: 0 var(--padding);
|
|
21
|
+
// margin: 0;
|
|
22
|
+
margin: calc(var(--root-em) * 0.375) calc(var(--root-em) * 0.5);
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
font: inherit;
|
|
25
|
+
// font-size: calc(var(--root-em) * 0.875);
|
|
26
|
+
font-weight: 500;
|
|
27
|
+
line-height: 1;
|
|
28
|
+
text-decoration: none;
|
|
29
|
+
text-transform: uppercase;
|
|
30
|
+
letter-spacing: math.div(1.25, 14) * 1em; //1.25px;
|
|
31
|
+
vertical-align: bottom;
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
user-select: none;
|
|
34
|
+
border-style: solid;
|
|
35
|
+
border-width: 1px;
|
|
36
|
+
border-radius: var(--control-field-radius);
|
|
37
|
+
outline: 0;
|
|
38
|
+
transition: 0.3s cubic-bezier(0.25, 0.8, 0.5, 1), color 1ms;
|
|
39
|
+
appearance: none;
|
|
40
|
+
|
|
41
|
+
&--plain {
|
|
42
|
+
color: inherit !important;
|
|
43
|
+
// color: inherit !important;
|
|
44
|
+
|
|
45
|
+
&[disabled] {
|
|
46
|
+
opacity: 0.5;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&--sm {
|
|
51
|
+
// height: 2em;
|
|
52
|
+
// height: calc(var(--root-em) * 1.5); // 24
|
|
53
|
+
font-size: calc(var(--root-em) * 0.75); // 12
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&--md {
|
|
57
|
+
// height: 2.285714285714286em;
|
|
58
|
+
// height: calc(var(--root-em) * 2); // 32
|
|
59
|
+
// font-size: calc(var(--root-em) * 0.875); // 14
|
|
60
|
+
font-size: calc(var(--root-em) * 0.875); // 14
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&--lg {
|
|
64
|
+
// height: calc(var(--root-em) * 2.875); // 46
|
|
65
|
+
font-size: calc(var(--root-em) * 1.375); // 20
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&--rounded {
|
|
69
|
+
--padding: 0;
|
|
70
|
+
|
|
71
|
+
min-width: 0;
|
|
72
|
+
aspect-ratio: 1 / 1;
|
|
73
|
+
margin: calc(var(--root-em) * 0.125) calc(var(--root-em) * 0.125);
|
|
74
|
+
border-radius: 50%;
|
|
75
|
+
|
|
76
|
+
--height: auto;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&--icon {
|
|
80
|
+
// aspect-ratio: 1 / 1;
|
|
81
|
+
min-width: #{$base-height * 0.75};
|
|
82
|
+
margin: calc(var(--root-em) * 0.125) calc(var(--root-em) * 0.125);
|
|
83
|
+
|
|
84
|
+
// --height: #{$base-height};
|
|
85
|
+
// --height: calc(var);
|
|
86
|
+
--height: #{$base-height * 0.75};
|
|
87
|
+
--padding: 0em;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
&::-moz-focus-inner {
|
|
91
|
+
border: 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&[disabled] {
|
|
95
|
+
cursor: default;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&--spacer {
|
|
99
|
+
&-left {
|
|
100
|
+
margin-left: auto;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&-right {
|
|
104
|
+
margin-right: auto;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&__content {
|
|
109
|
+
display: flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
justify-content: center;
|
|
112
|
+
justify-self: stretch;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&--loading &__content {
|
|
116
|
+
pointer-events: none;
|
|
117
|
+
opacity: 0;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&__icon {
|
|
121
|
+
&--start {
|
|
122
|
+
margin-right: var(--icon-margin);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&--end {
|
|
126
|
+
margin-left: var(--icon-margin);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
&__loading {
|
|
131
|
+
position: absolute;
|
|
132
|
+
top: 50%;
|
|
133
|
+
left: 50%;
|
|
134
|
+
z-index: 1;
|
|
135
|
+
transform: translate(-50%, -50%);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import './VButton.scss';
|
|
2
|
+
import {
|
|
3
|
+
defineComponent,
|
|
4
|
+
ExtractPropTypes,
|
|
5
|
+
computed,
|
|
6
|
+
PropType,
|
|
7
|
+
VNodeChild,
|
|
8
|
+
} from 'vue';
|
|
9
|
+
import { colorSchemeProps, useColorClasses } from '@fastkit/vue-color-scheme';
|
|
10
|
+
import {
|
|
11
|
+
navigationableInheritProps,
|
|
12
|
+
ExtractPropInput,
|
|
13
|
+
createPropsOptions,
|
|
14
|
+
renderSlotOrEmpty,
|
|
15
|
+
htmlAttributesPropOptions,
|
|
16
|
+
} from '@fastkit/vue-utils';
|
|
17
|
+
import { useVui } from '../../injections';
|
|
18
|
+
import { createControlProps, useControl } from '../../composables';
|
|
19
|
+
import { VProgressCircular } from '../loading';
|
|
20
|
+
import { ControlSize } from '../../schemes/control';
|
|
21
|
+
import { VIcon } from '../VIcon';
|
|
22
|
+
import type { IconName } from '../VIcon';
|
|
23
|
+
import { VLink } from '@fastkit/vue-utils';
|
|
24
|
+
|
|
25
|
+
export type VButtonSpacer = 'left' | 'right';
|
|
26
|
+
|
|
27
|
+
export type RawVButtonSpacer = boolean | VButtonSpacer;
|
|
28
|
+
|
|
29
|
+
export type VButtonIcon = () => VNodeChild;
|
|
30
|
+
|
|
31
|
+
export type RawVButtonIcon = IconName | VButtonIcon;
|
|
32
|
+
|
|
33
|
+
function resolveRawVButtonIcon(
|
|
34
|
+
raw?: RawVButtonIcon,
|
|
35
|
+
type: 'main' | 'start' | 'end' = 'main',
|
|
36
|
+
): VButtonIcon | undefined {
|
|
37
|
+
if (!raw) return;
|
|
38
|
+
return typeof raw === 'function'
|
|
39
|
+
? raw
|
|
40
|
+
: () => (
|
|
41
|
+
<VIcon
|
|
42
|
+
class={['v-button__icon', `v-button__icon--${type}`]}
|
|
43
|
+
name={raw}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const vueButtonProps = createPropsOptions({
|
|
49
|
+
...htmlAttributesPropOptions,
|
|
50
|
+
...colorSchemeProps(),
|
|
51
|
+
...navigationableInheritProps,
|
|
52
|
+
spacer: [Boolean, String] as PropType<RawVButtonSpacer>,
|
|
53
|
+
loading: Boolean,
|
|
54
|
+
rounded: Boolean,
|
|
55
|
+
icon: [String, Function] as PropType<RawVButtonIcon>,
|
|
56
|
+
startIcon: [String, Function] as PropType<RawVButtonIcon>,
|
|
57
|
+
endIcon: [String, Function] as PropType<RawVButtonIcon>,
|
|
58
|
+
...createControlProps(),
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export type VButtonProps = ExtractPropInput<typeof vueButtonProps>;
|
|
62
|
+
|
|
63
|
+
export type VButtonResolvedProps = ExtractPropTypes<typeof vueButtonProps>;
|
|
64
|
+
|
|
65
|
+
const LOADING_SIZE_MAP: Record<ControlSize, number> = {
|
|
66
|
+
sm: 14,
|
|
67
|
+
md: 20,
|
|
68
|
+
lg: 28,
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const VButton = defineComponent({
|
|
72
|
+
name: 'VButton',
|
|
73
|
+
inheritAttrs: false,
|
|
74
|
+
props: vueButtonProps,
|
|
75
|
+
setup(props, ctx) {
|
|
76
|
+
const vui = useVui();
|
|
77
|
+
const control = useControl(props);
|
|
78
|
+
const defaults = vui.setting('buttonDefault');
|
|
79
|
+
const icon = computed(() => {
|
|
80
|
+
const _icon = resolveRawVButtonIcon(props.icon);
|
|
81
|
+
return _icon && _icon();
|
|
82
|
+
});
|
|
83
|
+
const startIcon = computed(() => {
|
|
84
|
+
const _icon = resolveRawVButtonIcon(props.startIcon, 'start');
|
|
85
|
+
return _icon && _icon();
|
|
86
|
+
});
|
|
87
|
+
const endIcon = computed(() => {
|
|
88
|
+
const _icon = resolveRawVButtonIcon(props.endIcon, 'end');
|
|
89
|
+
return _icon && _icon();
|
|
90
|
+
});
|
|
91
|
+
const color = useColorClasses({
|
|
92
|
+
color: () => props.color || defaults.color,
|
|
93
|
+
variant: () =>
|
|
94
|
+
props.variant ||
|
|
95
|
+
(icon.value ? vui.setting('plainVariant') : defaults.variant),
|
|
96
|
+
});
|
|
97
|
+
const isPlain = computed(
|
|
98
|
+
() =>
|
|
99
|
+
color.variant.value.value === vui.setting('plainVariant') &&
|
|
100
|
+
color.color.value.value === defaults.color,
|
|
101
|
+
);
|
|
102
|
+
const isLoading = computed(() => props.loading);
|
|
103
|
+
// const isDisabled = computed(() => props.disabled);
|
|
104
|
+
// const isRounded = computed(() =>
|
|
105
|
+
// props.rounded != null ? props.rounded : !!icon.value,
|
|
106
|
+
// );
|
|
107
|
+
|
|
108
|
+
const spacer = computed<VButtonSpacer | undefined>(() => {
|
|
109
|
+
const _spacer = props.spacer;
|
|
110
|
+
if (!_spacer) return;
|
|
111
|
+
return _spacer === true ? 'left' : _spacer;
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const classes = computed(() => [
|
|
115
|
+
color.colorClasses.value,
|
|
116
|
+
// navigationable.value.classes,
|
|
117
|
+
spacer.value ? `v-button--spacer-${spacer.value}` : undefined,
|
|
118
|
+
`v-button--${control.size.value}`,
|
|
119
|
+
{
|
|
120
|
+
'v-button--loading': isLoading.value,
|
|
121
|
+
'v-button--icon': !!icon.value,
|
|
122
|
+
'v-button--rounded': props.rounded,
|
|
123
|
+
'v-button--plain': isPlain.value,
|
|
124
|
+
},
|
|
125
|
+
]);
|
|
126
|
+
|
|
127
|
+
return () => {
|
|
128
|
+
const children = renderSlotOrEmpty(ctx.slots);
|
|
129
|
+
return (
|
|
130
|
+
<VLink {...ctx.attrs} class={['v-button', classes.value]}>
|
|
131
|
+
<span class="v-button__content">
|
|
132
|
+
{startIcon.value}
|
|
133
|
+
{children}
|
|
134
|
+
{icon.value}
|
|
135
|
+
{endIcon.value}
|
|
136
|
+
</span>
|
|
137
|
+
{isLoading.value && (
|
|
138
|
+
<VProgressCircular
|
|
139
|
+
class="v-button__loading"
|
|
140
|
+
indeterminate
|
|
141
|
+
size={LOADING_SIZE_MAP[control.size.value]}
|
|
142
|
+
/>
|
|
143
|
+
)}
|
|
144
|
+
</VLink>
|
|
145
|
+
);
|
|
146
|
+
};
|
|
147
|
+
},
|
|
148
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.v-button-group {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: stretch;
|
|
4
|
+
|
|
5
|
+
&__item {
|
|
6
|
+
position: relative;
|
|
7
|
+
margin: 0;
|
|
8
|
+
|
|
9
|
+
&--has-left {
|
|
10
|
+
border-top-left-radius: 0;
|
|
11
|
+
border-bottom-left-radius: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&--has-right {
|
|
15
|
+
border-top-right-radius: 0;
|
|
16
|
+
border-bottom-right-radius: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&:focus {
|
|
20
|
+
z-index: 1;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import './VButtonGroup.scss';
|
|
2
|
+
|
|
3
|
+
import { defineComponent, isVNode, cloneVNode, VNodeChild, VNode } from 'vue';
|
|
4
|
+
import { colorSchemeProps } from '@fastkit/vue-color-scheme';
|
|
5
|
+
import { createControlProps } from '../../composables';
|
|
6
|
+
import { renderSlotOrEmpty, isFragment } from '@fastkit/vue-utils';
|
|
7
|
+
import { VButton } from './VButton';
|
|
8
|
+
|
|
9
|
+
type VButtonGroupChild =
|
|
10
|
+
| {
|
|
11
|
+
isButton: true;
|
|
12
|
+
node: VNode;
|
|
13
|
+
}
|
|
14
|
+
| {
|
|
15
|
+
isButton: false;
|
|
16
|
+
node: VNodeChild;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const VButtonGroup = defineComponent({
|
|
20
|
+
name: 'VButtonGroup',
|
|
21
|
+
props: {
|
|
22
|
+
...colorSchemeProps(),
|
|
23
|
+
...createControlProps(),
|
|
24
|
+
disabled: Boolean,
|
|
25
|
+
},
|
|
26
|
+
setup(props, ctx) {
|
|
27
|
+
return () => {
|
|
28
|
+
let buttonLength = 0;
|
|
29
|
+
|
|
30
|
+
let tmp = renderSlotOrEmpty(ctx.slots) || [];
|
|
31
|
+
|
|
32
|
+
if (tmp.length === 1 && isFragment(tmp[0])) {
|
|
33
|
+
tmp = tmp[0].children as any;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const children: VButtonGroupChild[] = tmp.map((node) => {
|
|
37
|
+
if (!isVNode(node) || node.type !== VButton) {
|
|
38
|
+
return {
|
|
39
|
+
isButton: false,
|
|
40
|
+
node,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
buttonLength++;
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
isButton: true,
|
|
48
|
+
node,
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
let buttonIndex = 0;
|
|
53
|
+
|
|
54
|
+
const $children = children.map((child) => {
|
|
55
|
+
if (child.isButton) {
|
|
56
|
+
buttonIndex++;
|
|
57
|
+
|
|
58
|
+
const hasLeft = buttonIndex > 1;
|
|
59
|
+
const hasRight = buttonIndex < buttonLength;
|
|
60
|
+
|
|
61
|
+
const childProps = child.node.props;
|
|
62
|
+
|
|
63
|
+
return cloneVNode(child.node, {
|
|
64
|
+
...props,
|
|
65
|
+
...childProps,
|
|
66
|
+
rouded: false,
|
|
67
|
+
class: [
|
|
68
|
+
'v-button-group__item',
|
|
69
|
+
{
|
|
70
|
+
'v-button-group__item--has-left': hasLeft,
|
|
71
|
+
'v-button-group__item--has-right': hasRight,
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return child.node;
|
|
77
|
+
});
|
|
78
|
+
return <div class="v-button-group">{$children}</div>;
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import './VCard.scss';
|
|
2
|
+
import { defineComponent, computed } from 'vue';
|
|
3
|
+
import { VPaper, createPaperProps } from '../VPaper';
|
|
4
|
+
|
|
5
|
+
export function createCardProps() {
|
|
6
|
+
return {
|
|
7
|
+
...createPaperProps(),
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const VCard = defineComponent({
|
|
12
|
+
name: 'VCard',
|
|
13
|
+
props: createCardProps(),
|
|
14
|
+
setup(props, ctx) {
|
|
15
|
+
const _props = computed(() => props);
|
|
16
|
+
return () => {
|
|
17
|
+
return <VPaper class="v-card" {..._props.value} v-slots={ctx.slots} />;
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import './VCardActions.scss';
|
|
2
|
+
import { defineComponent } from 'vue';
|
|
3
|
+
import { renderSlotOrEmpty } from '@fastkit/vue-utils';
|
|
4
|
+
|
|
5
|
+
export const VCardActions = defineComponent({
|
|
6
|
+
name: 'VCardActions',
|
|
7
|
+
setup(props, ctx) {
|
|
8
|
+
return () => {
|
|
9
|
+
return (
|
|
10
|
+
<div class="v-card-actions">
|
|
11
|
+
{renderSlotOrEmpty(ctx.slots, 'default')}
|
|
12
|
+
</div>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import './VCardContent.scss';
|
|
2
|
+
import { defineComponent } from 'vue';
|
|
3
|
+
import { renderSlotOrEmpty } from '@fastkit/vue-utils';
|
|
4
|
+
|
|
5
|
+
export const VCardContent = defineComponent({
|
|
6
|
+
name: 'VCardContent',
|
|
7
|
+
setup(props, ctx) {
|
|
8
|
+
return () => {
|
|
9
|
+
return (
|
|
10
|
+
<div class="v-card-content">
|
|
11
|
+
{renderSlotOrEmpty(ctx.slots, 'default')}
|
|
12
|
+
</div>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
});
|