@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.
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 +214 -19
  4. package/dist/vui.cjs.prod.js +214 -19
  5. package/dist/vui.css +69 -17
  6. package/dist/vui.d.ts +3609 -17
  7. package/dist/vui.esm-bundler.js +214 -21
  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 +110 -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,315 @@
1
+ import './VTabs.scss';
2
+ import {
3
+ defineComponent,
4
+ VNodeChild,
5
+ ref,
6
+ PropType,
7
+ computed,
8
+ watch,
9
+ onBeforeUnmount,
10
+ onBeforeUpdate,
11
+ onMounted,
12
+ } from 'vue';
13
+ import { RawIconProp } from '../VIcon';
14
+ import { VuiService } from '../../service';
15
+ import { useVui } from '../../injections';
16
+ import { defineSlotsProps } from '@fastkit/vue-utils';
17
+ import { RouteLocationRaw, RouteLocation } from 'vue-router';
18
+ import { VTab, VTabRef } from './VTab';
19
+ import { VScroller, useVScrollerRef } from '@fastkit/vue-kit';
20
+ import { ScrollResult } from '@fastkit/scroller';
21
+ import { useScopeColorClass, ScopeName } from '@fastkit/vue-color-scheme';
22
+
23
+ export interface VTabsItemLabelSlotCtx {
24
+ value: string;
25
+ active: boolean;
26
+ vui: VuiService;
27
+ }
28
+
29
+ export type VTabsItemLabelSlot = (ctx: VTabsItemLabelSlotCtx) => VNodeChild;
30
+
31
+ export type VTabsRouterHandler = (value: string) => RouteLocationRaw;
32
+
33
+ export interface VTabsItem {
34
+ value: string;
35
+ icon?: RawIconProp;
36
+ label?: VNodeChild | VTabsItemLabelSlot;
37
+ }
38
+
39
+ export const VTabs = defineComponent({
40
+ name: 'VTabs',
41
+ props: {
42
+ modelValue: String,
43
+
44
+ items: {
45
+ type: Array as PropType<VTabsItem[]>,
46
+ required: true,
47
+ // validator: (value: VTabsItem[]) => {
48
+ // return Array.isArray(value) && value.length > 0;
49
+ // },
50
+ },
51
+
52
+ /**
53
+ * 自動スクロールする際の余剰オフセット幅(px)
54
+ */
55
+ autoScrollOffset: {
56
+ type: Number,
57
+ default: 20,
58
+ },
59
+
60
+ /**
61
+ * ルーター同期する場合設定する
62
+ */
63
+ router: Function as PropType<VTabsRouterHandler>,
64
+
65
+ /**
66
+ * ルーティング連携を行う際に、クエリベースのURLマッチングを行う
67
+ * タブのURLが /page1?tab=xxx のようになる時に設定する
68
+ */
69
+ withQuery: Boolean,
70
+ ...defineSlotsProps<{
71
+ item: VTabsItemLabelSlotCtx;
72
+ }>(),
73
+
74
+ color: String as PropType<ScopeName>,
75
+ },
76
+ emits: {
77
+ 'update:modelValue': (newValue: string) => true,
78
+ change: (newValue: string) => true,
79
+ },
80
+ setup(props, ctx) {
81
+ const vui = useVui();
82
+
83
+ const internalValueRef = ref<string>(null as any);
84
+ const scrollerRef = useVScrollerRef();
85
+ const elRef = ref<HTMLElement>(null as any);
86
+ let scrollResult: ScrollResult | undefined;
87
+ const tabRefs = ref<VTabRef[]>([]);
88
+
89
+ const currentRef = computed({
90
+ get: () => internalValueRef.value,
91
+ set: (value) => {
92
+ if (internalValueRef.value !== value) {
93
+ internalValueRef.value = value;
94
+ ctx.emit('update:modelValue', value);
95
+ ctx.emit('change', value);
96
+ }
97
+ },
98
+ });
99
+
100
+ const colorScope = useScopeColorClass({
101
+ color: () => props.color || vui.setting('tabDefault').color,
102
+ });
103
+
104
+ const classes = computed(() => [colorScope.value.className]);
105
+
106
+ const computedItemsRef = computed(() => {
107
+ const current = currentRef.value;
108
+ const { router } = props;
109
+ return props.items.map((item) => {
110
+ const { value } = item;
111
+ const active = current === value;
112
+ let location:
113
+ | {
114
+ to: RouteLocationRaw;
115
+ route: RouteLocation & {
116
+ href: string;
117
+ };
118
+ }
119
+ | undefined;
120
+
121
+ if (router) {
122
+ const to = router(value);
123
+ const route = vui.router.resolve(to);
124
+ location = { to, route };
125
+ }
126
+
127
+ return {
128
+ ...item,
129
+ active,
130
+ location,
131
+ };
132
+ });
133
+ });
134
+
135
+ const setTabRef = (ref: VTabRef) => {
136
+ tabRefs.value.push(ref);
137
+ };
138
+
139
+ // const isMountedRef = ref(false);
140
+
141
+ function setupInternalValue(routable?: boolean) {
142
+ let value = props.modelValue;
143
+ if (value == null || value === '') {
144
+ const firstItem = props.items[0];
145
+ if (!firstItem) return;
146
+ value = firstItem.value;
147
+ }
148
+ if (internalValueRef.value !== value) {
149
+ internalValueRef.value = value;
150
+
151
+ if (routable) {
152
+ const { router } = props;
153
+ if (!router) return;
154
+ const hit = computedItemsRef.value.find(
155
+ (item) => item.value === value,
156
+ );
157
+ if (!hit) return;
158
+ const { location } = hit;
159
+ if (!location) return;
160
+ const { to, route } = location;
161
+ if (route.fullPath === vui.location.currentRoute.fullPath) return;
162
+ vui.router[to.replace ? 'replace' : 'push'](to);
163
+ } else if (!props.router && props.modelValue !== value) {
164
+ ctx.emit('update:modelValue', value);
165
+ ctx.emit('change', value);
166
+ }
167
+ }
168
+ }
169
+
170
+ function to(value: string) {
171
+ currentRef.value = value;
172
+ }
173
+
174
+ function cancelScroll() {
175
+ if (scrollResult) {
176
+ scrollResult.cancel();
177
+ scrollResult = undefined;
178
+ }
179
+ }
180
+
181
+ const findTab = (tab: string) => {
182
+ return tabRefs.value.find((t) => t.value === tab);
183
+ };
184
+
185
+ function scrollToTab(tabValue: string) {
186
+ const tab = findTab(tabValue);
187
+ if (!tab) return;
188
+ const $tab = tab.$el as HTMLElement;
189
+ if (!$tab) return;
190
+
191
+ const scroller = scrollerRef.value;
192
+ if (!scroller) return;
193
+ const container = scroller.scroller.element();
194
+ if (!container) return;
195
+
196
+ const { autoScrollOffset } = props;
197
+ const tabLeft = $tab.offsetLeft;
198
+ const tabWidth = $tab.offsetWidth;
199
+ const tabRight = tabLeft + tabWidth;
200
+ let hiddenLeft = 0;
201
+ let hiddenRight = 0;
202
+
203
+ const { scrollLeft, offsetWidth: scrollerWidth } = container;
204
+ hiddenLeft = Math.max(scrollLeft - tabLeft, 0);
205
+ hiddenRight = Math.max(tabRight - scrollerWidth - scrollLeft, 0);
206
+
207
+ if (hiddenLeft > 0) hiddenLeft += autoScrollOffset;
208
+ if (hiddenRight > 0) hiddenRight += autoScrollOffset;
209
+
210
+ let scrollAmmount = 0;
211
+ if (hiddenRight > 0) {
212
+ scrollAmmount = hiddenRight;
213
+ }
214
+ if (hiddenLeft > 0) {
215
+ scrollAmmount = -hiddenLeft;
216
+ }
217
+
218
+ if (Math.abs(scrollAmmount) > 0) {
219
+ cancelScroll();
220
+ scrollResult = scroller.scroller.by(scrollAmmount, 0, {
221
+ duration: 150,
222
+ });
223
+ }
224
+ }
225
+
226
+ watch(
227
+ () => props.modelValue,
228
+ () => setupInternalValue(true),
229
+ );
230
+
231
+ watch(
232
+ () => props.items,
233
+ () => setupInternalValue(),
234
+ { deep: true },
235
+ );
236
+
237
+ watch(
238
+ () => internalValueRef.value,
239
+ (newValue) => {
240
+ scrollToTab(newValue);
241
+ },
242
+ );
243
+
244
+ vui.location.watchRoute(
245
+ (route) => {
246
+ if (!props.router) return;
247
+ const path = props.withQuery ? route.fullPath : route.path;
248
+ const hit = computedItemsRef.value.find(({ location }) => {
249
+ return location && location.route.fullPath === path;
250
+ });
251
+ if (hit) {
252
+ currentRef.value = hit.value;
253
+ }
254
+ },
255
+ { immediate: true },
256
+ );
257
+
258
+ onMounted(() => {
259
+ scrollToTab(currentRef.value);
260
+ });
261
+
262
+ onBeforeUnmount(() => {
263
+ cancelScroll();
264
+ });
265
+
266
+ onBeforeUpdate(() => {
267
+ tabRefs.value = [];
268
+ });
269
+
270
+ setupInternalValue();
271
+
272
+ return () => {
273
+ const items = computedItemsRef.value;
274
+ const itemSlot = ctx.slots.item as VTabsItemLabelSlot | undefined;
275
+ const children = items.map(({ value, active, label, icon, location }) => {
276
+ if (!label) {
277
+ label = itemSlot;
278
+ }
279
+
280
+ const children =
281
+ typeof label === 'function' ? label({ value, active, vui }) : label;
282
+
283
+ const _to = (location && location.to) || undefined;
284
+
285
+ return (
286
+ <VTab
287
+ value={value}
288
+ to={_to}
289
+ icon={icon}
290
+ active={active}
291
+ ref={setTabRef as any}
292
+ onClick={(e) => {
293
+ if (!e.defaultPrevented) {
294
+ to(value);
295
+ }
296
+ }}>
297
+ {children}
298
+ </VTab>
299
+ );
300
+ });
301
+
302
+ return (
303
+ <div class={['v-tabs', classes.value]} ref={elRef}>
304
+ <VScroller
305
+ class="v-tabs__scroller"
306
+ containerClass="v-tabs__scroller__container"
307
+ guide
308
+ ref={scrollerRef}>
309
+ <div class="v-tabs__content">{children}</div>
310
+ </VScroller>
311
+ </div>
312
+ );
313
+ };
314
+ },
315
+ });
@@ -0,0 +1 @@
1
+ export * from './VTabs';
@@ -0,0 +1,3 @@
1
+ .v-text-counter {
2
+ white-space: nowrap;
3
+ }
@@ -0,0 +1,21 @@
1
+ import './VTextCounter.scss';
2
+ import { defineComponent } from 'vue';
3
+
4
+ export const VTextCounter = defineComponent({
5
+ name: 'VTextCounter',
6
+ props: {
7
+ length: {
8
+ type: Number,
9
+ required: true,
10
+ },
11
+ maxlength: {
12
+ type: Number,
13
+ required: true,
14
+ },
15
+ },
16
+ render() {
17
+ return (
18
+ <span class="v-text-counter">{`${this.length} / ${this.maxlength}`}</span>
19
+ );
20
+ },
21
+ });
@@ -0,0 +1 @@
1
+ export * from './VTextCounter';
@@ -0,0 +1,45 @@
1
+ @use '../../styles/core.scss';
2
+
3
+ .v-text-field {
4
+ &__input {
5
+ cursor: text;
6
+
7
+ &__element {
8
+ width: 100%;
9
+ min-width: 0;
10
+ // width: calc(100% - 8px);
11
+ padding: 0;
12
+ margin: 0;
13
+ overflow: hidden;
14
+ // margin: 0 8px;
15
+ font-size: inherit;
16
+ line-height: inherit;
17
+ text-overflow: ellipsis;
18
+ letter-spacing: inherit;
19
+ white-space: nowrap;
20
+ background: transparent;
21
+ border: 0;
22
+ border-radius: 0;
23
+ outline: 0;
24
+
25
+ &:-webkit-autofill {
26
+ @include core.auto-fill-cancel;
27
+ // color: inherit !important;
28
+ // box-shadow: 0 0 0 1000px get-color(field) inset;
29
+ }
30
+
31
+ &::-ms-clear {
32
+ display: none;
33
+ }
34
+
35
+ &::placeholder {
36
+ font-style: italic;
37
+ color: var(--control-disabled-color);
38
+ }
39
+
40
+ // @include placeholder {
41
+ // color: get-color(text-muted);
42
+ // }
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,96 @@
1
+ import './VTextField.scss';
2
+ import { defineComponent } from 'vue';
3
+ import {
4
+ createTextInputSettings,
5
+ useTextInputControl,
6
+ createFormControlProps,
7
+ FormControlSlots,
8
+ defineSlotsProps,
9
+ } from '@fastkit/vue-kit';
10
+ import { VFormControl } from '../VFormControl';
11
+ import {
12
+ VControlField,
13
+ createControlFieldProps,
14
+ InputBoxSlots,
15
+ } from '../VControlField';
16
+ import {
17
+ createControlProps,
18
+ useControl,
19
+ createControlFieldProviderProps,
20
+ useControlField,
21
+ } from '../../composables';
22
+ import { VTextCounter } from '../VTextCounter';
23
+ import { VUI_TEXT_FIELD_SYMBOL } from '../../injections';
24
+ import { ExtractPropInput } from '@fastkit/vue-utils';
25
+
26
+ const { props, emits } = createTextInputSettings();
27
+
28
+ function createTextFieldProps() {
29
+ return {
30
+ ...props,
31
+ ...createFormControlProps(),
32
+ ...createControlFieldProps(),
33
+ ...createControlFieldProviderProps(),
34
+ ...createControlProps(),
35
+ ...defineSlotsProps<FormControlSlots & InputBoxSlots>(),
36
+ };
37
+ }
38
+
39
+ export type TextFieldInput = ExtractPropInput<
40
+ ReturnType<typeof createTextFieldProps>
41
+ >;
42
+
43
+ export const VTextField = defineComponent({
44
+ name: 'VTextField',
45
+ props: createTextFieldProps(),
46
+ emits,
47
+ setup(props, ctx) {
48
+ const inputControl = useTextInputControl(props, ctx, {
49
+ nodeType: VUI_TEXT_FIELD_SYMBOL,
50
+ });
51
+ const control = useControl(props);
52
+ useControlField(props);
53
+
54
+ return {
55
+ ...inputControl.expose(),
56
+ ...control,
57
+ };
58
+ },
59
+ render() {
60
+ return (
61
+ <VFormControl
62
+ nodeControl={this.nodeControl}
63
+ focused={this.nodeControl.focused}
64
+ hiddenInfo={this.hiddenInfo}
65
+ class={['v-text-field', this.classes]}
66
+ label={this.label}
67
+ hint={this.hint}
68
+ onClickLabel={(ev) => {
69
+ this.focus();
70
+ }}
71
+ v-slots={{
72
+ ...this.$slots,
73
+ default: () => (
74
+ <VControlField
75
+ class="v-text-field__input"
76
+ startAdornment={this.startAdornment}
77
+ endAdornment={this.endAdornment}
78
+ v-slots={{
79
+ ...this.$slots,
80
+ default: () =>
81
+ this.textInputControl.createInputElement({
82
+ class: 'v-text-field__input__element',
83
+ }),
84
+ }}
85
+ />
86
+ ),
87
+ infoAppends: () => {
88
+ const { counterResult } = this;
89
+ if (!counterResult) return;
90
+ return <VTextCounter {...counterResult} />;
91
+ },
92
+ }}
93
+ />
94
+ );
95
+ },
96
+ });
@@ -0,0 +1 @@
1
+ export * from './VTextField';
@@ -0,0 +1,41 @@
1
+ @use '../../styles/core.scss';
2
+
3
+ .v-textarea {
4
+ &__input {
5
+ cursor: text;
6
+
7
+ &__element {
8
+ width: 100%;
9
+ min-width: 0;
10
+ padding: 8px 0;
11
+ margin: 0;
12
+ font-size: inherit;
13
+ line-height: inherit;
14
+ letter-spacing: inherit;
15
+ resize: none;
16
+ background: transparent;
17
+ border: 0;
18
+ border-radius: 0;
19
+ outline: 0;
20
+
21
+ &:-webkit-autofill {
22
+ @include core.auto-fill-cancel;
23
+ // color: inherit !important;
24
+ // box-shadow: 0 0 0 1000px get-color(field) inset;
25
+ }
26
+
27
+ &::-ms-clear {
28
+ display: none;
29
+ }
30
+
31
+ &::placeholder {
32
+ font-style: italic;
33
+ color: var(--control-disabled-color);
34
+ }
35
+
36
+ // @include placeholder {
37
+ // color: get-color(text-muted);
38
+ // }
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,93 @@
1
+ import './VTextarea.scss';
2
+ import { defineComponent } from 'vue';
3
+ import {
4
+ createTextareaSettings,
5
+ useTextareaControl,
6
+ createFormControlProps,
7
+ FormControlSlots,
8
+ defineSlotsProps,
9
+ } from '@fastkit/vue-kit';
10
+ import { VFormControl } from '../VFormControl';
11
+ import {
12
+ VControlField,
13
+ createControlFieldProps,
14
+ InputBoxSlots,
15
+ } from '../VControlField';
16
+ import {
17
+ createControlProps,
18
+ useControl,
19
+ createControlFieldProviderProps,
20
+ useControlField,
21
+ } from '../../composables';
22
+ import { VTextCounter } from '../VTextCounter';
23
+ import { VUI_TEXTAREA_SYMBOL, useVui } from '../../injections';
24
+
25
+ const { props, emits } = createTextareaSettings();
26
+
27
+ export const VTextarea = defineComponent({
28
+ name: 'VTextarea',
29
+ props: {
30
+ ...props,
31
+ ...createFormControlProps(),
32
+ ...createControlFieldProps(),
33
+ ...createControlFieldProviderProps(),
34
+ ...createControlProps(),
35
+ ...defineSlotsProps<FormControlSlots & InputBoxSlots>(),
36
+ },
37
+ emits,
38
+ setup(props, ctx) {
39
+ const vui = useVui();
40
+ const inputControl = useTextareaControl(props, ctx, {
41
+ nodeType: VUI_TEXTAREA_SYMBOL,
42
+ defaultRows: vui.textareaRows,
43
+ });
44
+ const control = useControl(props);
45
+ useControlField(props);
46
+
47
+ return {
48
+ ...inputControl.expose(),
49
+ ...control,
50
+ };
51
+ },
52
+ render() {
53
+ return (
54
+ <VFormControl
55
+ nodeControl={this.nodeControl}
56
+ focused={this.nodeControl.focused}
57
+ class={['v-textarea', this.classes]}
58
+ label={this.label}
59
+ hint={this.hint}
60
+ hiddenInfo={this.hiddenInfo}
61
+ onClickLabel={(ev) => {
62
+ this.focus();
63
+ }}
64
+ v-slots={{
65
+ ...this.$slots,
66
+ default: () => (
67
+ <VControlField
68
+ class="v-textarea__input"
69
+ autoHeight
70
+ startAdornment={this.startAdornment}
71
+ endAdornment={this.endAdornment}
72
+ // onClickHost={(ev) => {
73
+ // this.focus();
74
+ // }}
75
+ v-slots={{
76
+ ...this.$slots,
77
+ default: () =>
78
+ this.textareaControl.createInputElement({
79
+ class: 'v-textarea__input__element',
80
+ }),
81
+ }}
82
+ />
83
+ ),
84
+ infoAppends: () => {
85
+ const { counterResult } = this;
86
+ if (!counterResult) return;
87
+ return <VTextCounter {...counterResult} />;
88
+ },
89
+ }}
90
+ />
91
+ );
92
+ },
93
+ });
@@ -0,0 +1 @@
1
+ export * from './VTextarea';
@@ -0,0 +1,26 @@
1
+ // @use './core.scss';
2
+ // @use '../../styles/core.scss';
3
+
4
+ .v-toolbar {
5
+ --height: var(--toolbar-height);
6
+
7
+ display: flex;
8
+ align-items: center;
9
+ width: 100%;
10
+ height: var(--height);
11
+ padding: 0 calc(var(--root-em) * 1.5); // 24
12
+ margin: 0;
13
+ border-radius: inherit;
14
+
15
+ &--plain {
16
+ --main-color: var(--palette-background);
17
+ }
18
+
19
+ .v-app-layout__header > & {
20
+ height: 100%;
21
+ }
22
+
23
+ &--dense {
24
+ --height: var(--toolbar-dense-height);
25
+ }
26
+ }
@@ -0,0 +1,44 @@
1
+ import './VToolbar.scss';
2
+ import { defineComponent, computed } from 'vue';
3
+ import { renderSlotOrEmpty } from '@fastkit/vue-utils';
4
+ import { colorSchemeProps, useColorClasses } from '@fastkit/vue-color-scheme';
5
+ import { createElevationProps, useElevation } from '../../composables';
6
+ import { useVui } from '../../injections';
7
+
8
+ export const VToolbar = defineComponent({
9
+ name: 'VToolbar',
10
+ props: {
11
+ ...createElevationProps(),
12
+ ...colorSchemeProps(),
13
+ dense: Boolean,
14
+ },
15
+ setup(props, ctx) {
16
+ const vui = useVui();
17
+
18
+ const elevation = useElevation(props, { defaultValue: 4 });
19
+ const dense = computed(() => props.dense);
20
+ const color = useColorClasses({
21
+ color: () => props.color,
22
+ variant: () => props.variant || vui.setting('containedVariant'),
23
+ });
24
+
25
+ const classes = computed(() => {
26
+ return [
27
+ elevation.elevationClassName.value,
28
+ color.colorClasses.value,
29
+ {
30
+ 'v-toolbar--plain': !color.color.value.value,
31
+ 'v-toolbar--dense': dense.value,
32
+ },
33
+ ];
34
+ });
35
+
36
+ return () => {
37
+ return (
38
+ <div class={['v-toolbar', classes.value]}>
39
+ {renderSlotOrEmpty(ctx.slots, 'default')}
40
+ </div>
41
+ );
42
+ };
43
+ },
44
+ });