@fastkit/vui 0.6.37 → 0.6.41

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 (188) hide show
  1. package/dist/tool/index.js +3 -0
  2. package/dist/tool/vite-plugin.d.ts.map +1 -1
  3. package/dist/vui.cjs.js +181 -5
  4. package/dist/vui.cjs.prod.js +181 -5
  5. package/dist/vui.css +24 -14
  6. package/dist/vui.d.ts +3596 -16
  7. package/dist/vui.esm-bundler.js +181 -7
  8. package/dist/vui.min.css +1 -1
  9. package/dist/vui.min.css.map +1 -1
  10. package/package.json +8 -7
  11. package/src/.DS_Store +0 -0
  12. package/src/assets/.DS_Store +0 -0
  13. package/src/assets/builtins/color-scheme.ts +9 -0
  14. package/src/assets/builtins/media-match.ts +3 -0
  15. package/src/components/.DS_Store +0 -0
  16. package/src/components/VAccordion/VAccordion.scss +2 -0
  17. package/src/components/VAccordion/VAccordion.tsx +5 -0
  18. package/src/components/VAccordion/index.ts +1 -0
  19. package/src/components/VApp/VApp.tsx +17 -0
  20. package/src/components/VApp/index.ts +1 -0
  21. package/src/components/VBreadcrumbs/VBreadcrumbs.scss +61 -0
  22. package/src/components/VBreadcrumbs/VBreadcrumbs.tsx +137 -0
  23. package/src/components/VBreadcrumbs/index.ts +1 -0
  24. package/src/components/VButton/.DS_Store +0 -0
  25. package/src/components/VButton/VButton.scss +137 -0
  26. package/src/components/VButton/VButton.tsx +148 -0
  27. package/src/components/VButton/VButtonGroup.scss +23 -0
  28. package/src/components/VButton/VButtonGroup.tsx +81 -0
  29. package/src/components/VButton/index.ts +2 -0
  30. package/src/components/VCard/VCard.scss +3 -0
  31. package/src/components/VCard/VCard.tsx +20 -0
  32. package/src/components/VCard/VCardActions.scss +10 -0
  33. package/src/components/VCard/VCardActions.tsx +16 -0
  34. package/src/components/VCard/VCardContent.scss +3 -0
  35. package/src/components/VCard/VCardContent.tsx +16 -0
  36. package/src/components/VCard/index.ts +3 -0
  37. package/src/components/VCheckable/VCheckable.scss +103 -0
  38. package/src/components/VCheckable/VCheckable.tsx +60 -0
  39. package/src/components/VCheckable/index.ts +1 -0
  40. package/src/components/VCheckbox/VCheckbox.scss +56 -0
  41. package/src/components/VCheckbox/VCheckbox.tsx +63 -0
  42. package/src/components/VCheckbox/index.ts +1 -0
  43. package/src/components/VCheckboxGroup/.DS_Store +0 -0
  44. package/src/components/VCheckboxGroup/VCheckboxGroup.tsx +11 -0
  45. package/src/components/VCheckboxGroup/index.ts +1 -0
  46. package/src/components/VContentSwitcher/VContentSwitcher.scss +73 -0
  47. package/src/components/VContentSwitcher/VContentSwitcher.tsx +156 -0
  48. package/src/components/VContentSwitcher/index.ts +1 -0
  49. package/src/components/VControlField/VControlField.scss +183 -0
  50. package/src/components/VControlField/VControlField.tsx +152 -0
  51. package/src/components/VControlField/index.ts +1 -0
  52. package/src/components/VDataTable/VDataTable.scss +230 -0
  53. package/src/components/VDataTable/VDataTable.tsx +761 -0
  54. package/src/components/VDataTable/index.ts +1 -0
  55. package/src/components/VDrawerLayout/VDrawerLayout.scss +26 -0
  56. package/src/components/VDrawerLayout/VDrawerLayout.tsx +35 -0
  57. package/src/components/VDrawerLayout/index.ts +1 -0
  58. package/src/components/VForm/VForm.tsx +77 -0
  59. package/src/components/VForm/index.ts +1 -0
  60. package/src/components/VFormControl/VFormControl.scss +59 -0
  61. package/src/components/VFormControl/VFormControl.tsx +85 -0
  62. package/src/components/VFormControl/index.ts +1 -0
  63. package/src/components/VGrid/VGridContainer.scss +4 -0
  64. package/src/components/VGrid/VGridContainer.tsx +191 -0
  65. package/src/components/VGrid/VGridItem.scss +3 -0
  66. package/src/components/VGrid/VGridItem.tsx +114 -0
  67. package/src/components/VGrid/index.ts +2 -0
  68. package/src/components/VGrid/schemes.ts +28 -0
  69. package/src/components/VHero/.DS_Store +0 -0
  70. package/src/components/VHero/VHero.scss +26 -0
  71. package/src/components/VHero/VHero.tsx +52 -0
  72. package/src/components/VHero/index.ts +1 -0
  73. package/src/components/VIcon/VIcon.scss +22 -0
  74. package/src/components/VIcon/VIcon.tsx +110 -0
  75. package/src/components/VIcon/index.ts +1 -0
  76. package/src/components/VListTile/VListTile.scss +71 -0
  77. package/src/components/VListTile/VListTile.tsx +121 -0
  78. package/src/components/VListTile/index.ts +1 -0
  79. package/src/components/VNavigation/VNavigation.scss +12 -0
  80. package/src/components/VNavigation/VNavigation.tsx +79 -0
  81. package/src/components/VNavigation/VNavigationItem.scss +14 -0
  82. package/src/components/VNavigation/VNavigationItem.tsx +252 -0
  83. package/src/components/VNavigation/index.ts +2 -0
  84. package/src/components/VOption/VOption.scss +61 -0
  85. package/src/components/VOption/VOption.tsx +52 -0
  86. package/src/components/VOption/index.ts +1 -0
  87. package/src/components/VOptionGroup/VOptionGroup.scss +3 -0
  88. package/src/components/VOptionGroup/VOptionGroup.tsx +55 -0
  89. package/src/components/VOptionGroup/index.ts +1 -0
  90. package/src/components/VPagination/VPagination.scss +100 -0
  91. package/src/components/VPagination/VPagination.tsx +346 -0
  92. package/src/components/VPagination/index.ts +1 -0
  93. package/src/components/VPaper/VPaper.scss +37 -0
  94. package/src/components/VPaper/VPaper.tsx +78 -0
  95. package/src/components/VPaper/index.ts +1 -0
  96. package/src/components/VRadio/.DS_Store +0 -0
  97. package/src/components/VRadio/VRadio.scss +66 -0
  98. package/src/components/VRadio/VRadio.tsx +56 -0
  99. package/src/components/VRadio/index.ts +1 -0
  100. package/src/components/VRadioGroup/.DS_Store +0 -0
  101. package/src/components/VRadioGroup/VRadioGroup.tsx +10 -0
  102. package/src/components/VRadioGroup/index.ts +1 -0
  103. package/src/components/VSelect/VSelect.scss +78 -0
  104. package/src/components/VSelect/VSelect.tsx +204 -0
  105. package/src/components/VSelect/index.ts +1 -0
  106. package/src/components/VSwitch/VSwitch.scss +125 -0
  107. package/src/components/VSwitch/VSwitch.tsx +66 -0
  108. package/src/components/VSwitch/index.ts +1 -0
  109. package/src/components/VSwitchGroup/.DS_Store +0 -0
  110. package/src/components/VSwitchGroup/VSwitchGroup.tsx +11 -0
  111. package/src/components/VSwitchGroup/index.ts +1 -0
  112. package/src/components/VTabs/.DS_Store +0 -0
  113. package/src/components/VTabs/VTab.scss +73 -0
  114. package/src/components/VTabs/VTab.tsx +88 -0
  115. package/src/components/VTabs/VTabs.scss +49 -0
  116. package/src/components/VTabs/VTabs.tsx +315 -0
  117. package/src/components/VTabs/index.ts +1 -0
  118. package/src/components/VTextCounter/VTextCounter.scss +3 -0
  119. package/src/components/VTextCounter/VTextCounter.tsx +21 -0
  120. package/src/components/VTextCounter/index.ts +1 -0
  121. package/src/components/VTextField/VTextField.scss +45 -0
  122. package/src/components/VTextField/VTextField.tsx +96 -0
  123. package/src/components/VTextField/index.ts +1 -0
  124. package/src/components/VTextarea/VTextarea.scss +41 -0
  125. package/src/components/VTextarea/VTextarea.tsx +93 -0
  126. package/src/components/VTextarea/index.ts +1 -0
  127. package/src/components/VToolbar/.DS_Store +0 -0
  128. package/src/components/VToolbar/VToolbar.scss +26 -0
  129. package/src/components/VToolbar/VToolbar.tsx +44 -0
  130. package/src/components/VToolbar/VToolbarEdge.scss +27 -0
  131. package/src/components/VToolbar/VToolbarEdge.tsx +35 -0
  132. package/src/components/VToolbar/VToolbarMenu.scss +7 -0
  133. package/src/components/VToolbar/VToolbarMenu.tsx +26 -0
  134. package/src/components/VToolbar/VToolbarTitle.scss +22 -0
  135. package/src/components/VToolbar/VToolbarTitle.tsx +25 -0
  136. package/src/components/VToolbar/index.ts +4 -0
  137. package/src/components/VWysiwygEditor/.DS_Store +0 -0
  138. package/src/components/VWysiwygEditor/VWysiwygEditor.scss +60 -0
  139. package/src/components/VWysiwygEditor/VWysiwygEditor.tsx +293 -0
  140. package/src/components/VWysiwygEditor/index.ts +2 -0
  141. package/src/components/VWysiwygEditor/schemes.ts +65 -0
  142. package/src/components/VWysiwygEditor/tools/bullet-list.ts +18 -0
  143. package/src/components/VWysiwygEditor/tools/format-bold.ts +19 -0
  144. package/src/components/VWysiwygEditor/tools/format-italic.ts +18 -0
  145. package/src/components/VWysiwygEditor/tools/format-underline.ts +18 -0
  146. package/src/components/VWysiwygEditor/tools/history.ts +26 -0
  147. package/src/components/VWysiwygEditor/tools/index.ts +8 -0
  148. package/src/components/VWysiwygEditor/tools/link.ts +57 -0
  149. package/src/components/VWysiwygEditor/tools/ordered-list.ts +21 -0
  150. package/src/components/VWysiwygEditor/tools/text-color.ts +14 -0
  151. package/src/components/index.ts +32 -0
  152. package/src/components/kits.ts +1 -0
  153. package/src/components/loading.ts +1 -0
  154. package/src/composables/.DS_Store +0 -0
  155. package/src/composables/control.ts +118 -0
  156. package/src/composables/elevation.ts +34 -0
  157. package/src/composables/form-selector.scss +11 -0
  158. package/src/composables/form-selector.tsx +101 -0
  159. package/src/composables/index.ts +4 -0
  160. package/src/composables/vui.ts +9 -0
  161. package/src/index.ts +10 -0
  162. package/src/injections.ts +61 -0
  163. package/src/logger.ts +7 -0
  164. package/src/plugin.tsx +76 -0
  165. package/src/schemes/control.ts +7 -0
  166. package/src/schemes/elevation.ts +26 -0
  167. package/src/schemes/index.ts +2 -0
  168. package/src/service.tsx +242 -0
  169. package/src/styles/.DS_Store +0 -0
  170. package/src/styles/after-effects/display-flow.scss +346 -0
  171. package/src/styles/after-effects/spacing.scss +155 -0
  172. package/src/styles/after-effects/text.scss +90 -0
  173. package/src/styles/after-effects.scss +3 -0
  174. package/src/styles/base.scss +14 -0
  175. package/src/styles/control.scss +11 -0
  176. package/src/styles/core/functions.scss +62 -0
  177. package/src/styles/core/typo.scss +56 -0
  178. package/src/styles/core.scss +2 -0
  179. package/src/styles/elevation.scss +9 -0
  180. package/src/styles/group.scss +57 -0
  181. package/src/styles/index.scss +9 -0
  182. package/src/styles/transition.scss +11 -0
  183. package/src/styles/typo.scss +11 -0
  184. package/src/styles/variables.scss +320 -0
  185. package/src/styles/wysiwyg.scss +24 -0
  186. package/src/tool/.DS_Store +0 -0
  187. package/src/tool/index.ts +2 -0
  188. package/src/tool/vite-plugin.ts +281 -0
@@ -0,0 +1,204 @@
1
+ import './VSelect.scss';
2
+ import { ref, VNodeChild, defineComponent } from 'vue';
3
+ import {
4
+ createFormSelectorSettings,
5
+ useFormSelectorControl,
6
+ createFormControlProps,
7
+ defineSlotsProps,
8
+ FormControlSlots,
9
+ FormSelectorItemControl,
10
+ createPropsOptions,
11
+ } from '@fastkit/vue-kit';
12
+ import { VFormControl } from '../VFormControl';
13
+ import {
14
+ VControlField,
15
+ createControlFieldProps,
16
+ InputBoxSlots,
17
+ } from '../VControlField';
18
+ import {
19
+ createControlProps,
20
+ useControl,
21
+ createControlFieldProviderProps,
22
+ useControlField,
23
+ } from '../../composables';
24
+ import { VUI_SELECT_SYMBOL, useVui } from '../../injections';
25
+ import { VIcon } from '../VIcon';
26
+ import { VMenu } from '../kits';
27
+ import { VOption } from '../VOption';
28
+
29
+ const { props, emits } = createFormSelectorSettings();
30
+
31
+ export const VSelect = defineComponent({
32
+ name: 'VSelect',
33
+ props: {
34
+ ...props,
35
+ ...createFormControlProps(),
36
+ ...createControlFieldProps(),
37
+ ...createControlFieldProviderProps(),
38
+ ...createControlProps(),
39
+ ...defineSlotsProps<FormControlSlots & InputBoxSlots>(),
40
+ ...createPropsOptions({
41
+ placeholder: String,
42
+ }),
43
+ },
44
+ emits,
45
+ setup(props, ctx) {
46
+ const menuOpened = ref(false);
47
+ const showMenu = () => {
48
+ menuOpened.value = true;
49
+ };
50
+ const closeMenu = () => {
51
+ menuOpened.value = false;
52
+ };
53
+ const inputControl = useFormSelectorControl(props, ctx, {
54
+ nodeType: VUI_SELECT_SYMBOL,
55
+ onSelectItem: (item) => {
56
+ closeMenu();
57
+ },
58
+ });
59
+ const control = useControl(props);
60
+ useControlField(props);
61
+ const vui = useVui();
62
+ const iconName = vui.icon('menuDown');
63
+ const fieldRef = ref<HTMLElement | null>(null);
64
+
65
+ const focus = (opts?: FocusOptions): void => {
66
+ fieldRef.value && fieldRef.value.focus(opts);
67
+ };
68
+
69
+ const renderSelections = (selectedItems: FormSelectorItemControl[]) => {
70
+ const children: VNodeChild[] = [];
71
+ if (selectedItems.length) {
72
+ selectedItems.forEach((item, index) => {
73
+ if (index > 0) {
74
+ children.push(vui.selectionSeparator());
75
+ }
76
+ children.push(item.renderDefaultSlot());
77
+ });
78
+ } else if (props.placeholder != null) {
79
+ children.push(
80
+ <span class="v-select__placeholder">{props.placeholder}</span>,
81
+ );
82
+ }
83
+ return children;
84
+ };
85
+
86
+ return {
87
+ ...inputControl.expose(),
88
+ ...control,
89
+ iconName,
90
+ menuOpened,
91
+ fieldRef: () => fieldRef,
92
+ focus,
93
+ showMenu,
94
+ closeMenu,
95
+ renderSelections,
96
+ };
97
+ },
98
+ render() {
99
+ const { nodeControl, selectorControl, selectorItems, selectedItems } = this;
100
+ const children = (this.$slots.default && this.$slots.default()) || [];
101
+ const propOptions = this.propItems.map((item) => {
102
+ return (
103
+ <VOption disabled={item.disabled} value={item.value} key={item.value}>
104
+ {{
105
+ default: () => item.label(selectorControl),
106
+ }}
107
+ </VOption>
108
+ );
109
+ });
110
+
111
+ return (
112
+ <VFormControl
113
+ nodeControl={nodeControl}
114
+ // focused={this.nodeControl.focused}
115
+ class={['v-select', this.classes]}
116
+ label={this.label}
117
+ hint={this.hint}
118
+ hiddenInfo={this.hiddenInfo}
119
+ onClickLabel={(ev) => {
120
+ this.focus();
121
+ }}
122
+ v-slots={{
123
+ ...this.$slots,
124
+ default: () => (
125
+ <VMenu
126
+ width="fit"
127
+ maxWidth="fit"
128
+ distance={0}
129
+ alwaysRender
130
+ v-model={this.menuOpened}
131
+ v-slots={{
132
+ activator: ({ attrs, control }) => [
133
+ <VControlField
134
+ class="v-select__input"
135
+ ref={this.fieldRef()}
136
+ startAdornment={this.startAdornment}
137
+ endAdornment={this.endAdornment}
138
+ // tabindex={this.computedTabindex}
139
+ focused={this.menuOpened}
140
+ onClick={(ev) => {
141
+ if (this.canOperation && !control.isActive) {
142
+ let t = ev.target as HTMLElement;
143
+ const count = 0;
144
+ let hit = false;
145
+ while (count < 5) {
146
+ if (t.classList.contains('v-select__input')) {
147
+ hit = true;
148
+ break;
149
+ }
150
+ t = t.parentElement as HTMLElement;
151
+ }
152
+ control.show(hit ? t : ev);
153
+ }
154
+ }}
155
+ v-slots={{
156
+ ...this.$slots,
157
+ default: () => [
158
+ <select
159
+ class="v-select__input__element"
160
+ name={this.name}
161
+ tabindex={this.computedTabindex}
162
+ disabled={this.isDisabled}
163
+ multiple={this.multiple}
164
+ onFocus={nodeControl.focusHandler}
165
+ onBlur={nodeControl.blurHandler}
166
+ v-model={this.currentValue}
167
+ // value={nodeControl.value}
168
+ >
169
+ {selectorItems.map((item) => {
170
+ return (
171
+ <option
172
+ value={item.propValue}
173
+ key={item.propValue}>
174
+ {item.renderDefaultSlot()}
175
+ </option>
176
+ );
177
+ })}
178
+ </select>,
179
+ <div class="v-select__selections">
180
+ <div class="v-select__selections__inner">
181
+ {this.renderSelections(selectedItems)}
182
+ </div>
183
+ </div>,
184
+ ],
185
+ endAdornment: () => (
186
+ <VIcon
187
+ name={this.iconName}
188
+ rotate={this.menuOpened ? 180 : 0}></VIcon>
189
+ ),
190
+ }}
191
+ />,
192
+ ],
193
+ }}>
194
+ <div class={['v-select__body', this.classes]}>
195
+ {children}
196
+ {propOptions}
197
+ </div>
198
+ </VMenu>
199
+ ),
200
+ }}
201
+ />
202
+ );
203
+ },
204
+ });
@@ -0,0 +1 @@
1
+ export * from './VSelect';
@@ -0,0 +1,125 @@
1
+ @use 'sass:math';
2
+
3
+ .v-switch {
4
+ --my-pin-color: var(--palette-background);
5
+ // --my-faux-bg-color: transparent;
6
+
7
+ &--selected {
8
+ --my-pin-color: var(--color);
9
+ }
10
+
11
+ &__faux {
12
+ position: relative;
13
+ display: flex;
14
+ align-items: center;
15
+ justify-content: center;
16
+ width: 100%;
17
+ width: var(--control-switch-width);
18
+ height: 100%;
19
+ cursor: pointer;
20
+
21
+ &::before {
22
+ display: block;
23
+ width: var(--control-switch-track-width);
24
+ height: var(--control-switch-track-height);
25
+ content: '';
26
+ background: var(--color);
27
+ border-radius: calc(var(--control-switch-track-height) / 2);
28
+ opacity: 0.5;
29
+ }
30
+
31
+ &__pin {
32
+ position: absolute;
33
+ top: 0;
34
+ bottom: 0;
35
+ left: 0;
36
+ display: flex;
37
+ align-items: center;
38
+ justify-content: center;
39
+ width: var(--outer-size);
40
+ height: var(--outer-size);
41
+ // background: #f00;
42
+ border-radius: 50%;
43
+ transition: left 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
44
+ transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
45
+
46
+ &::before,
47
+ &::after {
48
+ display: block;
49
+ content: '';
50
+ }
51
+
52
+ &::before {
53
+ position: absolute;
54
+ width: 100%;
55
+ height: 100%;
56
+ background: currentColor;
57
+ border-radius: 50%;
58
+ opacity: 0;
59
+ transition: opacity 0.2s;
60
+ }
61
+
62
+ &::after {
63
+ position: relative;
64
+ width: var(--icon-size);
65
+ height: var(--icon-size);
66
+ background: var(--my-pin-color);
67
+ border-radius: 50%;
68
+ box-shadow: rgb(0 0 0 / 0.2) 0 2px 1px -1px,
69
+ rgb(0 0 0 / 0.14) 0 1px 1px 0, rgb(0 0 0 / 0.12) 0 1px 3px 0;
70
+ transform: scale(var(--control-checkable-faux-scale));
71
+ }
72
+ }
73
+ }
74
+
75
+ &--selected &__faux {
76
+ &__pin {
77
+ left: calc(100% - var(--outer-size));
78
+ }
79
+ }
80
+
81
+ &--disabled &__faux {
82
+ &::before {
83
+ background-color: #000;
84
+ opacity: 0.12;
85
+ }
86
+
87
+ &__pin {
88
+ &::after {
89
+ background-color: rgba(245, 245, 245, 1);
90
+ }
91
+ }
92
+ }
93
+
94
+ &__faux:hover &__faux__pin::before {
95
+ opacity: 0.1;
96
+ }
97
+
98
+ &:focus-within &__faux {
99
+ &__pin {
100
+ &::before {
101
+ opacity: 0.1;
102
+ }
103
+ }
104
+ }
105
+
106
+ // &--indeterminate &__faux {
107
+ // $x1: math.div(12, 54) * 100%;
108
+ // $x2: 100% - $x1;
109
+ // $y1: math.div(24, 54) * 100%;
110
+ // $y2: 100% - $y1;
111
+
112
+ // clip-path: polygon(
113
+ // 0 0,
114
+ // 0 100%,
115
+ // 100% 100%,
116
+ // 100% 0,
117
+ // #{$x2} #{$y1},
118
+ // #{$x2} #{$y2},
119
+ // #{$x1} #{$y2},
120
+ // #{$x1} #{$y1},
121
+ // #{$x2} #{$y1},
122
+ // 100% 0
123
+ // );
124
+ // }
125
+ }
@@ -0,0 +1,66 @@
1
+ import './VSwitch.scss';
2
+ import { defineComponent } from 'vue';
3
+ import {
4
+ createFormSelectorItemSettings,
5
+ useFormSelectorItemControl,
6
+ renderSlotOrEmpty,
7
+ } from '@fastkit/vue-kit';
8
+ import { createControlProps, useControl } from '../../composables';
9
+ import { VUI_SWITCH_GROUP_SYMBOL, VUI_SWITCH_SYMBOL } from '../../injections';
10
+ import { VCheckable } from '../VCheckable';
11
+
12
+ const { props, emits } = createFormSelectorItemSettings();
13
+
14
+ export const VSwitch = defineComponent({
15
+ name: 'VSwitch',
16
+ props: {
17
+ ...props,
18
+ ...createControlProps(),
19
+ },
20
+ emits,
21
+ setup(props, ctx) {
22
+ const nodeControl = useFormSelectorItemControl(props, ctx, {
23
+ nodeType: VUI_SWITCH_SYMBOL,
24
+ parentNodeType: VUI_SWITCH_GROUP_SYMBOL,
25
+ });
26
+ const control = useControl(props);
27
+ if (typeof window !== 'undefined') {
28
+ (window as any).yy = {};
29
+ (window as any).yy[String(Date.now())] = nodeControl;
30
+ }
31
+ return {
32
+ ...nodeControl.expose(),
33
+ ...control,
34
+ };
35
+ },
36
+ render() {
37
+ const { selectorItemControl } = this;
38
+ return (
39
+ <VCheckable
40
+ class={[
41
+ 'v-switch',
42
+ {
43
+ 'v-switch--selected': selectorItemControl.selected,
44
+ 'v-switch--disabled': selectorItemControl.isDisabled,
45
+ xxxxx: selectorItemControl.booted,
46
+ },
47
+ this.classes,
48
+ ]}
49
+ checked={this.selected}
50
+ invalid={this.invalid}
51
+ disabled={this.isDisabled}
52
+ readonly={this.isReadonly}
53
+ v-slots={{
54
+ input: () =>
55
+ selectorItemControl.createInputElement({ type: 'checkbox' }),
56
+ icon: () => (
57
+ <span class="v-switch__faux">
58
+ <span class="v-switch__faux__pin"></span>
59
+ </span>
60
+ ),
61
+ label: () => renderSlotOrEmpty(this.$slots, 'default'),
62
+ }}
63
+ />
64
+ );
65
+ },
66
+ });
@@ -0,0 +1 @@
1
+ export * from './VSwitch';
@@ -0,0 +1,11 @@
1
+ import { VUI_SWITCH_GROUP_SYMBOL } from '../../injections';
2
+ import { VSwitch } from '../VSwitch';
3
+ import { defineFormSelectorComponent } from '../../composables';
4
+
5
+ export const VSwitchGroup = defineFormSelectorComponent({
6
+ name: 'VSwitchGroup',
7
+ defaultMultiple: true,
8
+ nodeType: VUI_SWITCH_GROUP_SYMBOL,
9
+ className: 'v-switch-group',
10
+ itemRenderer: ({ attrs, slots }) => <VSwitch {...attrs}>{slots}</VSwitch>,
11
+ });
@@ -0,0 +1 @@
1
+ export * from './VSwitchGroup';
Binary file
@@ -0,0 +1,73 @@
1
+ @use '../../styles/core.scss';
2
+
3
+ .v-tab {
4
+ @include core.button-reset;
5
+
6
+ --tab-content-color: var(--palette-caption);
7
+ --tab-content-focus-color: var(--main-color);
8
+ --tab-content-opacity: 0.7;
9
+
10
+ position: relative;
11
+ z-index: 3;
12
+ display: flex;
13
+ // flex: 1 1 auto;
14
+ align-items: center;
15
+ justify-content: center;
16
+ height: var(--tabs-height);
17
+ padding: 0 1.25em;
18
+ font: inherit;
19
+ font-size: var(--tabs-font-size);
20
+ // color: inherit;
21
+ white-space: nowrap;
22
+ user-select: none;
23
+ transition: color 0.6s;
24
+
25
+ &::before {
26
+ position: absolute;
27
+ right: 0;
28
+ bottom: 0;
29
+ // top: 0;
30
+ left: 0;
31
+ z-index: 1;
32
+ height: 2px;
33
+ content: '';
34
+ background-color: var(--tab-content-focus-color);
35
+ border-radius: inherit;
36
+ transition: all 0.25s;
37
+ transform: scaleX(0);
38
+ }
39
+
40
+ &__content {
41
+ position: relative;
42
+ z-index: 2;
43
+ display: flex;
44
+ align-items: center;
45
+ line-height: 1.2;
46
+ color: var(--tab-content-color);
47
+ text-align: center;
48
+ opacity: var(--tab-content-opacity);
49
+ transition: all 0.25s ease;
50
+ }
51
+
52
+ &__icon {
53
+ margin-right: 8px;
54
+ font-size: 120%;
55
+ }
56
+
57
+ &:hover {
58
+ --tab-content-color: var(--tab-content-focus-color);
59
+ }
60
+
61
+ &--active {
62
+ --tab-content-color: rgba(0, 0, 0, 0.87);
63
+
64
+ pointer-events: none;
65
+ background: var(--tabs-color);
66
+
67
+ --tab-content-opacity: 1;
68
+
69
+ &::before {
70
+ transform: scaleX(1);
71
+ }
72
+ }
73
+ }
@@ -0,0 +1,88 @@
1
+ import './VTab.scss';
2
+
3
+ import {
4
+ defineComponent,
5
+ PropType,
6
+ computed,
7
+ ComponentPublicInstance,
8
+ } from 'vue';
9
+ import { RouteLocationRaw } from 'vue-router';
10
+ import { RawIconProp, resolveRawIconProp } from '../VIcon';
11
+ import { renderSlotOrEmpty } from '@fastkit/vue-utils';
12
+ import { RouterLink } from 'vue-router';
13
+
14
+ export interface VTabExpose {
15
+ value: string;
16
+ active: boolean;
17
+ }
18
+
19
+ export interface VTabRef extends ComponentPublicInstance, VTabExpose {}
20
+
21
+ export const VTab = defineComponent({
22
+ name: 'VTab',
23
+ props: {
24
+ value: {
25
+ type: String,
26
+ required: true,
27
+ },
28
+ active: Boolean,
29
+ to: [String, Object] as PropType<RouteLocationRaw>,
30
+ icon: [String, Function] as PropType<RawIconProp>,
31
+ },
32
+ emits: {
33
+ click: (ev: MouseEvent) => true,
34
+ },
35
+ setup(props, ctx) {
36
+ const classesRef = computed(() => ({
37
+ 'v-tab--active': props.active,
38
+ }));
39
+
40
+ const exposeValues: VTabExpose = {
41
+ value: props.value,
42
+ active: props.active,
43
+ };
44
+
45
+ ctx.expose(exposeValues);
46
+
47
+ return () => {
48
+ const { to, value, icon, active } = props;
49
+ const classes = ['v-tab', classesRef.value];
50
+
51
+ const children = (
52
+ <span class="v-tab__content">
53
+ {icon &&
54
+ resolveRawIconProp(active, icon, {
55
+ class: 'v-tab__icon',
56
+ })}
57
+ {renderSlotOrEmpty(ctx.slots)}
58
+ </span>
59
+ );
60
+
61
+ if (to) {
62
+ const replace = typeof to === 'string' ? undefined : to.replace;
63
+ return (
64
+ <RouterLink
65
+ class={classes}
66
+ to={to}
67
+ replace={replace}
68
+ // disableScrollBehavior
69
+ >
70
+ {children}
71
+ </RouterLink>
72
+ );
73
+ } else {
74
+ return (
75
+ <button
76
+ class={classes}
77
+ type="button"
78
+ value={value}
79
+ onClick={(ev) => {
80
+ ctx.emit('click', ev);
81
+ }}>
82
+ {children}
83
+ </button>
84
+ );
85
+ }
86
+ };
87
+ },
88
+ });
@@ -0,0 +1,49 @@
1
+ $my-offset: 30px;
2
+
3
+ .v-tabs {
4
+ position: relative;
5
+ width: 100%;
6
+ height: var(--tabs-height);
7
+ overflow: hidden;
8
+
9
+ &::before {
10
+ position: absolute;
11
+ right: 0;
12
+ bottom: 0;
13
+ left: 0;
14
+ display: block;
15
+ height: 2px;
16
+ content: '';
17
+ background: currentColor;
18
+ opacity: 0.25;
19
+ }
20
+
21
+ &__scroller {
22
+ width: 100%;
23
+ height: calc(var(--tabs-height) + #{$my-offset});
24
+
25
+ &__container {
26
+ padding-bottom: $my-offset;
27
+ }
28
+ }
29
+
30
+ &__content {
31
+ position: relative;
32
+ display: inline-flex;
33
+ align-items: stretch;
34
+ min-width: 100%;
35
+ vertical-align: bottom;
36
+
37
+ // &::after {
38
+ // position: absolute;
39
+ // right: 0;
40
+ // bottom: 0;
41
+ // left: 0;
42
+ // z-index: 1;
43
+ // display: block;
44
+ // height: var(--tabs-bar-height);
45
+ // pointer-events: none;
46
+ // content: '';
47
+ // }
48
+ }
49
+ }