@fastkit/vui 0.6.38 → 0.6.42
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 +180 -5
- package/dist/vui.cjs.prod.js +180 -5
- package/dist/vui.css +24 -14
- package/dist/vui.d.ts +3294 -876
- package/dist/vui.esm-bundler.js +180 -7
- 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 +114 -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,103 @@
|
|
|
1
|
+
@use '../../styles/core.scss';
|
|
2
|
+
|
|
3
|
+
.v-checkable {
|
|
4
|
+
--outer-size: var(--control-checkable-outer-size);
|
|
5
|
+
--icon-size: var(--control-checkable-icon-size);
|
|
6
|
+
--color: var(--control-checkable-base-color);
|
|
7
|
+
|
|
8
|
+
&--checked {
|
|
9
|
+
--color: var(--main-color);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
padding-right: 1em;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
user-select: none;
|
|
17
|
+
|
|
18
|
+
&--invalid:not(#{&}--readonly) {
|
|
19
|
+
--color: var(--main-color);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&--disabled {
|
|
23
|
+
--color: var(--control-disabled-color);
|
|
24
|
+
// --color: var(--main-color);
|
|
25
|
+
|
|
26
|
+
pointer-events: none;
|
|
27
|
+
cursor: default;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&--readonly {
|
|
31
|
+
pointer-events: none;
|
|
32
|
+
cursor: default;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
input {
|
|
36
|
+
@include core.hidden-input-element;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&__faux {
|
|
40
|
+
position: relative;
|
|
41
|
+
display: inline-flex;
|
|
42
|
+
flex: 0 0 var(--outer-size);
|
|
43
|
+
align-items: center;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
width: var(--outer-size);
|
|
46
|
+
height: var(--outer-size);
|
|
47
|
+
margin: var(--control-checkable-faux-margin);
|
|
48
|
+
margin-left: 0;
|
|
49
|
+
color: var(--color);
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
|
|
52
|
+
&__icon {
|
|
53
|
+
position: relative;
|
|
54
|
+
display: block;
|
|
55
|
+
width: var(--icon-size);
|
|
56
|
+
height: var(--icon-size);
|
|
57
|
+
pointer-events: none;
|
|
58
|
+
transform: scale(var(--control-checkable-faux-scale));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&::before {
|
|
62
|
+
position: absolute;
|
|
63
|
+
top: 0;
|
|
64
|
+
right: 0;
|
|
65
|
+
bottom: 0;
|
|
66
|
+
left: 0;
|
|
67
|
+
display: block;
|
|
68
|
+
pointer-events: none;
|
|
69
|
+
content: '';
|
|
70
|
+
background: currentColor;
|
|
71
|
+
border-radius: 50%;
|
|
72
|
+
opacity: 0;
|
|
73
|
+
transition: opacity 0.2s;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&:hover::before {
|
|
77
|
+
opacity: 0.1;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&--custom-icon &__faux {
|
|
82
|
+
flex-basis: auto;
|
|
83
|
+
width: auto;
|
|
84
|
+
|
|
85
|
+
&::before {
|
|
86
|
+
content: none;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
&:focus-within &__faux {
|
|
91
|
+
&::before {
|
|
92
|
+
opacity: 0.2;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&__label {
|
|
97
|
+
line-height: 1.5;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&--disabled &__label {
|
|
101
|
+
color: var(--color);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import './VCheckable.scss';
|
|
2
|
+
import { computed, defineComponent } from 'vue';
|
|
3
|
+
import { defineSlotsProps, renderSlotOrEmpty } from '@fastkit/vue-kit';
|
|
4
|
+
import { useVuiColorProvider } from '../../injections';
|
|
5
|
+
|
|
6
|
+
export const VCheckable = defineComponent({
|
|
7
|
+
name: 'VCheckable',
|
|
8
|
+
props: {
|
|
9
|
+
invalid: Boolean,
|
|
10
|
+
disabled: Boolean,
|
|
11
|
+
readonly: Boolean,
|
|
12
|
+
checked: Boolean,
|
|
13
|
+
...defineSlotsProps<{
|
|
14
|
+
input: void;
|
|
15
|
+
faux: void;
|
|
16
|
+
icon: void;
|
|
17
|
+
label: void;
|
|
18
|
+
}>(),
|
|
19
|
+
// autoWidth: Boolean,
|
|
20
|
+
},
|
|
21
|
+
setup(props, ctx) {
|
|
22
|
+
const colorProvider = useVuiColorProvider();
|
|
23
|
+
const invalid = computed(() => props.invalid);
|
|
24
|
+
const disabled = computed(() => props.disabled);
|
|
25
|
+
const readonly = computed(() => props.readonly);
|
|
26
|
+
const checked = computed(() => props.checked);
|
|
27
|
+
// const autoWidth = computed(() => props.autoWidth);
|
|
28
|
+
const classes = computed(() => {
|
|
29
|
+
return [
|
|
30
|
+
{
|
|
31
|
+
'v-checkable--invalid': invalid.value,
|
|
32
|
+
'v-checkable--disabled': disabled.value,
|
|
33
|
+
'v-checkable--readonly': readonly.value,
|
|
34
|
+
'v-checkable--checked': checked.value,
|
|
35
|
+
'v-checkable--custom-icon': !!ctx.slots.icon,
|
|
36
|
+
disabled: disabled.value,
|
|
37
|
+
},
|
|
38
|
+
colorProvider.className(invalid.value ? 'error' : 'primary'),
|
|
39
|
+
];
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return () => (
|
|
43
|
+
<label class={['v-checkable', classes.value]}>
|
|
44
|
+
<span class="v-checkable__faux">
|
|
45
|
+
{renderSlotOrEmpty(ctx.slots, 'input')}
|
|
46
|
+
{ctx.slots.icon ? (
|
|
47
|
+
renderSlotOrEmpty(ctx.slots, 'icon')
|
|
48
|
+
) : (
|
|
49
|
+
<span class="v-checkable__faux__icon">
|
|
50
|
+
{renderSlotOrEmpty(ctx.slots, 'faux')}
|
|
51
|
+
</span>
|
|
52
|
+
)}
|
|
53
|
+
</span>
|
|
54
|
+
<span class="v-checkable__label">
|
|
55
|
+
{renderSlotOrEmpty(ctx.slots, 'label')}
|
|
56
|
+
</span>
|
|
57
|
+
</label>
|
|
58
|
+
);
|
|
59
|
+
},
|
|
60
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './VCheckable';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
|
|
3
|
+
.v-checkbox {
|
|
4
|
+
--my-border-color: var(--color);
|
|
5
|
+
--my-faux-bg-color: transparent;
|
|
6
|
+
|
|
7
|
+
&--selected,
|
|
8
|
+
&--indeterminate {
|
|
9
|
+
--my-border-color: transparent;
|
|
10
|
+
--my-faux-bg-color: var(--color);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&__faux {
|
|
14
|
+
display: block;
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 100%;
|
|
17
|
+
clip-path: polygon(
|
|
18
|
+
0 0,
|
|
19
|
+
0 100%,
|
|
20
|
+
100% 100%,
|
|
21
|
+
100% 0,
|
|
22
|
+
88.25% 28.25%,
|
|
23
|
+
38% 78.125%,
|
|
24
|
+
12% 50%,
|
|
25
|
+
20% 42.1875%,
|
|
26
|
+
38% 63%,
|
|
27
|
+
82% 20%,
|
|
28
|
+
88.25% 28.25%,
|
|
29
|
+
100% 0
|
|
30
|
+
);
|
|
31
|
+
background: var(--my-faux-bg-color);
|
|
32
|
+
border: solid 2px var(--my-border-color);
|
|
33
|
+
border-radius: var(--control-field-radius);
|
|
34
|
+
transition: border-color 0.2s, background-color 0.2s;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&--indeterminate &__faux {
|
|
38
|
+
$x1: math.div(12, 54) * 100%;
|
|
39
|
+
$x2: 100% - $x1;
|
|
40
|
+
$y1: math.div(24, 54) * 100%;
|
|
41
|
+
$y2: 100% - $y1;
|
|
42
|
+
|
|
43
|
+
clip-path: polygon(
|
|
44
|
+
0 0,
|
|
45
|
+
0 100%,
|
|
46
|
+
100% 100%,
|
|
47
|
+
100% 0,
|
|
48
|
+
#{$x2} #{$y1},
|
|
49
|
+
#{$x2} #{$y2},
|
|
50
|
+
#{$x1} #{$y2},
|
|
51
|
+
#{$x1} #{$y1},
|
|
52
|
+
#{$x2} #{$y1},
|
|
53
|
+
100% 0
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import './VCheckbox.scss';
|
|
2
|
+
import { defineComponent, computed } from 'vue';
|
|
3
|
+
import {
|
|
4
|
+
createFormSelectorItemSettings,
|
|
5
|
+
useFormSelectorItemControl,
|
|
6
|
+
renderSlotOrEmpty,
|
|
7
|
+
} from '@fastkit/vue-kit';
|
|
8
|
+
import { createControlProps, useControl } from '../../composables';
|
|
9
|
+
import {
|
|
10
|
+
VUI_CHECKBOX_GROUP_SYMBOL,
|
|
11
|
+
VUI_CHECKBOX_SYMBOL,
|
|
12
|
+
} from '../../injections';
|
|
13
|
+
import { VCheckable } from '../VCheckable';
|
|
14
|
+
|
|
15
|
+
const { props, emits } = createFormSelectorItemSettings();
|
|
16
|
+
|
|
17
|
+
export const VCheckbox = defineComponent({
|
|
18
|
+
name: 'VCheckbox',
|
|
19
|
+
props: {
|
|
20
|
+
...props,
|
|
21
|
+
...createControlProps(),
|
|
22
|
+
indeterminate: Boolean,
|
|
23
|
+
},
|
|
24
|
+
emits,
|
|
25
|
+
setup(props, ctx) {
|
|
26
|
+
const nodeControl = useFormSelectorItemControl(props, ctx, {
|
|
27
|
+
nodeType: VUI_CHECKBOX_SYMBOL,
|
|
28
|
+
parentNodeType: VUI_CHECKBOX_GROUP_SYMBOL,
|
|
29
|
+
});
|
|
30
|
+
const control = useControl(props);
|
|
31
|
+
const isIndeterminate = computed(() => props.indeterminate);
|
|
32
|
+
return {
|
|
33
|
+
...nodeControl.expose(),
|
|
34
|
+
...control,
|
|
35
|
+
isIndeterminate,
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
render() {
|
|
39
|
+
const { selectorItemControl, isIndeterminate } = this;
|
|
40
|
+
return (
|
|
41
|
+
<VCheckable
|
|
42
|
+
class={[
|
|
43
|
+
'v-checkbox',
|
|
44
|
+
{
|
|
45
|
+
'v-checkbox--selected': selectorItemControl.selected,
|
|
46
|
+
'v-checkbox--indeterminate': isIndeterminate,
|
|
47
|
+
},
|
|
48
|
+
this.classes,
|
|
49
|
+
]}
|
|
50
|
+
checked={this.selected || isIndeterminate}
|
|
51
|
+
invalid={this.invalid}
|
|
52
|
+
disabled={this.isDisabled}
|
|
53
|
+
readonly={this.isReadonly}
|
|
54
|
+
v-slots={{
|
|
55
|
+
input: () =>
|
|
56
|
+
selectorItemControl.createInputElement({ type: 'checkbox' }),
|
|
57
|
+
faux: () => <span class="v-checkbox__faux"></span>,
|
|
58
|
+
label: () => renderSlotOrEmpty(this.$slots, 'default'),
|
|
59
|
+
}}
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
62
|
+
},
|
|
63
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './VCheckbox';
|
|
Binary file
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { VUI_CHECKBOX_GROUP_SYMBOL } from '../../injections';
|
|
2
|
+
import { VCheckbox } from '../VCheckbox';
|
|
3
|
+
import { defineFormSelectorComponent } from '../../composables';
|
|
4
|
+
|
|
5
|
+
export const VCheckboxGroup = defineFormSelectorComponent({
|
|
6
|
+
name: 'VCheckboxGroup',
|
|
7
|
+
defaultMultiple: true,
|
|
8
|
+
nodeType: VUI_CHECKBOX_GROUP_SYMBOL,
|
|
9
|
+
className: 'v-checkbox-group',
|
|
10
|
+
itemRenderer: ({ attrs, slots }) => <VCheckbox {...attrs}>{slots}</VCheckbox>,
|
|
11
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './VCheckboxGroup';
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
.v-content-switcher {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: block;
|
|
4
|
+
width: 100%;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
transition: var(--transition-tab);
|
|
7
|
+
|
|
8
|
+
&__content {
|
|
9
|
+
width: 100%;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&-prev {
|
|
13
|
+
&-enter-active,
|
|
14
|
+
&-leave-active {
|
|
15
|
+
transition: var(--transition-tab);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&-enter {
|
|
19
|
+
&-from {
|
|
20
|
+
transform: translateX(-100%);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&-to {
|
|
24
|
+
transform: translateX(0%);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&-leave {
|
|
29
|
+
transform: translateX(0%);
|
|
30
|
+
|
|
31
|
+
&-active {
|
|
32
|
+
position: absolute;
|
|
33
|
+
top: 0;
|
|
34
|
+
left: 0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&-to {
|
|
38
|
+
transform: translateX(100%);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&-next {
|
|
44
|
+
&-enter-active,
|
|
45
|
+
&-leave-active {
|
|
46
|
+
transition: var(--transition-tab);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&-enter {
|
|
50
|
+
&-from {
|
|
51
|
+
transform: translateX(100%);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&-to {
|
|
55
|
+
transform: translateX(0%);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&-leave {
|
|
60
|
+
transform: translateX(0%);
|
|
61
|
+
|
|
62
|
+
&-active {
|
|
63
|
+
position: absolute;
|
|
64
|
+
top: 0;
|
|
65
|
+
left: 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&-to {
|
|
69
|
+
transform: translateX(-100%);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import './VContentSwitcher.scss';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
defineComponent,
|
|
5
|
+
PropType,
|
|
6
|
+
ref,
|
|
7
|
+
computed,
|
|
8
|
+
watch,
|
|
9
|
+
Transition,
|
|
10
|
+
} from 'vue';
|
|
11
|
+
import { getDocumentScroller } from '@fastkit/vue-scroller';
|
|
12
|
+
import { VTabsItem } from '../VTabs/VTabs';
|
|
13
|
+
import { renderSlotOrEmpty } from '@fastkit/vue-utils';
|
|
14
|
+
|
|
15
|
+
export interface ContentSwitcherSeeTopOptions {
|
|
16
|
+
/**
|
|
17
|
+
* スクロールする際のオフセット高px
|
|
18
|
+
*/
|
|
19
|
+
offset?: number;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* スクロール期間
|
|
23
|
+
*/
|
|
24
|
+
duration?: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const VContentSwitcher = defineComponent({
|
|
28
|
+
name: 'VContentSwitcher',
|
|
29
|
+
props: {
|
|
30
|
+
modelValue: String,
|
|
31
|
+
order: {
|
|
32
|
+
type: Array as PropType<(string | VTabsItem)[]>,
|
|
33
|
+
default: () => [],
|
|
34
|
+
},
|
|
35
|
+
autotop: [Boolean, Object] as PropType<
|
|
36
|
+
boolean | ContentSwitcherSeeTopOptions
|
|
37
|
+
>,
|
|
38
|
+
},
|
|
39
|
+
emits: {
|
|
40
|
+
'update:modelValue': (modelValue: string) => true,
|
|
41
|
+
},
|
|
42
|
+
setup(props, ctx) {
|
|
43
|
+
const internalValueRef = ref('');
|
|
44
|
+
const transitionRef = ref('');
|
|
45
|
+
const elRef = ref<HTMLElement | null>(null);
|
|
46
|
+
const anchorRef = ref<HTMLElement | null>(null);
|
|
47
|
+
const computedOrderRef = computed(() =>
|
|
48
|
+
props.order.map((row) => {
|
|
49
|
+
return typeof row === 'string' ? row : row.value;
|
|
50
|
+
}),
|
|
51
|
+
);
|
|
52
|
+
const currentRef = computed({
|
|
53
|
+
get: () => internalValueRef.value,
|
|
54
|
+
set: (current) => {
|
|
55
|
+
if (internalValueRef.value !== current) {
|
|
56
|
+
internalValueRef.value = current;
|
|
57
|
+
ctx.emit('update:modelValue', current);
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
const autotopSettingsRef = computed<
|
|
62
|
+
ContentSwitcherSeeTopOptions | undefined
|
|
63
|
+
>(() => {
|
|
64
|
+
let { autotop: settings } = props;
|
|
65
|
+
if (settings === true) settings = {};
|
|
66
|
+
if (!settings) return;
|
|
67
|
+
return {
|
|
68
|
+
...settings,
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
function seeTop(options?: ContentSwitcherSeeTopOptions) {
|
|
73
|
+
const scoller = getDocumentScroller();
|
|
74
|
+
const { value: anchor } = anchorRef;
|
|
75
|
+
if (anchor) {
|
|
76
|
+
scoller.toElement(anchor, options);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function getEl() {
|
|
81
|
+
const el = elRef.value;
|
|
82
|
+
if (!el) {
|
|
83
|
+
throw new Error('missing element');
|
|
84
|
+
}
|
|
85
|
+
return el;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
watch(
|
|
89
|
+
() => props.modelValue,
|
|
90
|
+
(value, beforeValue) => {
|
|
91
|
+
if (value == null) return;
|
|
92
|
+
internalValueRef.value = value;
|
|
93
|
+
|
|
94
|
+
if (beforeValue == null) return;
|
|
95
|
+
|
|
96
|
+
const order = computedOrderRef.value;
|
|
97
|
+
const index = order.indexOf(value);
|
|
98
|
+
const beforeIndex = order.indexOf(beforeValue);
|
|
99
|
+
|
|
100
|
+
let transition = 'fade';
|
|
101
|
+
if (index !== -1 && beforeIndex !== -1) {
|
|
102
|
+
if (index > beforeIndex) transition = 'v-content-switcher-next';
|
|
103
|
+
if (index < beforeIndex) transition = 'v-content-switcher-prev';
|
|
104
|
+
}
|
|
105
|
+
transitionRef.value = transition;
|
|
106
|
+
},
|
|
107
|
+
{ immediate: true },
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
watch(currentRef, () => {
|
|
111
|
+
const autotopSettings = autotopSettingsRef.value;
|
|
112
|
+
if (autotopSettings && props.modelValue != null) {
|
|
113
|
+
seeTop(autotopSettings);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
return () => {
|
|
118
|
+
const current = currentRef.value;
|
|
119
|
+
const children = renderSlotOrEmpty(ctx.slots) || [];
|
|
120
|
+
const currentSlot = ctx.slots[current];
|
|
121
|
+
|
|
122
|
+
if (currentSlot) {
|
|
123
|
+
children.push(
|
|
124
|
+
<div class="v-content-switcher__content" key={current}>
|
|
125
|
+
{currentSlot(this)}
|
|
126
|
+
</div>,
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<div class="v-content-switcher" ref={elRef}>
|
|
132
|
+
<div class="v-content-switcher__anchor" ref={anchorRef} />
|
|
133
|
+
<Transition
|
|
134
|
+
name={transitionRef.value}
|
|
135
|
+
onBeforeLeave={(el) => {
|
|
136
|
+
getEl().style.height = (el as HTMLElement).offsetHeight + 'px';
|
|
137
|
+
}}
|
|
138
|
+
onEnter={(el) => {
|
|
139
|
+
getEl().style.height = (el as HTMLElement).offsetHeight + 'px';
|
|
140
|
+
}}
|
|
141
|
+
onAfterEnter={() => {
|
|
142
|
+
getEl().style.height = '';
|
|
143
|
+
}}
|
|
144
|
+
onEnterCancelled={() => {
|
|
145
|
+
getEl().style.height = '';
|
|
146
|
+
}}
|
|
147
|
+
onLeaveCancelled={() => {
|
|
148
|
+
getEl().style.height = '';
|
|
149
|
+
}}>
|
|
150
|
+
{children}
|
|
151
|
+
</Transition>
|
|
152
|
+
</div>
|
|
153
|
+
);
|
|
154
|
+
};
|
|
155
|
+
},
|
|
156
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './VContentSwitcher';
|