@fastkit/vui 0.13.6 → 0.14.0

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 (40) hide show
  1. package/dist/vui.css +42 -13
  2. package/dist/vui.d.ts +1658 -4327
  3. package/dist/vui.mjs +117 -109
  4. package/dist/vui.mjs.map +1 -1
  5. package/package.json +22 -22
  6. package/src/components/VAvatar/VAvatar.tsx +1 -2
  7. package/src/components/VBreadcrumbs/VBreadcrumbs.tsx +0 -1
  8. package/src/components/VBusyImage/VBusyImage.tsx +8 -5
  9. package/src/components/VButton/VButton.tsx +2 -9
  10. package/src/components/VCard/VCardActions.tsx +2 -7
  11. package/src/components/VCard/VCardContent.tsx +2 -7
  12. package/src/components/VCheckable/VCheckable.tsx +14 -15
  13. package/src/components/VCheckbox/VCheckbox.tsx +1 -2
  14. package/src/components/VChip/VChip.tsx +1 -2
  15. package/src/components/VContentSwitcher/VContentSwitcher.tsx +1 -2
  16. package/src/components/VControlField/VControlField.tsx +13 -13
  17. package/src/components/VDrawerLayout/VDrawerLayout.tsx +2 -1
  18. package/src/components/VForm/VForm.tsx +9 -6
  19. package/src/components/VFormControl/VFormControl.tsx +10 -7
  20. package/src/components/VGrid/VGridContainer.tsx +0 -2
  21. package/src/components/VGrid/VGridItem.tsx +0 -3
  22. package/src/components/VHero/VHero.tsx +9 -15
  23. package/src/components/VListTile/VListTile.tsx +2 -4
  24. package/src/components/VNavigation/VNavigationItem.tsx +2 -2
  25. package/src/components/VOption/VOption.tsx +1 -4
  26. package/src/components/VOptionGroup/VOptionGroup.tsx +9 -6
  27. package/src/components/VPaper/VPaper.tsx +10 -12
  28. package/src/components/VRadio/VRadio.tsx +1 -2
  29. package/src/components/VSelect/VSelect.tsx +14 -8
  30. package/src/components/VSkeltonLoader/VSkeltonLoaderBone.tsx +1 -2
  31. package/src/components/VSwitch/VSwitch.tsx +1 -2
  32. package/src/components/VTabs/VTab.tsx +1 -2
  33. package/src/components/VTabs/VTabs.tsx +8 -6
  34. package/src/components/VTextField/VTextField.tsx +5 -3
  35. package/src/components/VTextarea/VTextarea.tsx +4 -2
  36. package/src/components/VToolbar/VToolbar.tsx +1 -4
  37. package/src/components/VToolbar/VToolbarMenu.tsx +1 -2
  38. package/src/components/VToolbar/VToolbarTitle.tsx +8 -6
  39. package/src/composables/form-selector.tsx +10 -4
  40. package/src/plugin.tsx +1 -1
@@ -6,23 +6,26 @@ import {
6
6
  FormSelectorItemGroupControl,
7
7
  } from '@fastkit/vue-form-control';
8
8
  import {
9
- defineSlotsProps,
9
+ defineSlots,
10
10
  VNodeChildOrSlot,
11
11
  resolveVNodeChildOrSlots,
12
- renderSlotOrEmpty,
13
12
  } from '@fastkit/vue-utils';
14
13
  import { VUI_SELECT_SYMBOL } from '../../injections';
15
14
 
15
+ const slots = defineSlots<{
16
+ label?: (control: FormSelectorItemGroupControl) => any;
17
+ default?: () => any;
18
+ }>();
19
+
16
20
  export const VOptionGroup = defineComponent({
17
21
  name: 'VOptionGroup',
18
22
  props: {
19
23
  ...createFormSelectorItemGroupProps(),
20
24
  // eslint-disable-next-line vue/require-prop-types
21
25
  label: {} as PropType<VNodeChildOrSlot<FormSelectorItemGroupControl>>,
22
- ...defineSlotsProps<{
23
- label: FormSelectorItemGroupControl;
24
- }>(),
26
+ ...slots(),
25
27
  },
28
+ slots,
26
29
  setup(props, ctx) {
27
30
  const groupControl = useFormSelectorItemGroupControl(props, ctx, {
28
31
  parentNodeType: VUI_SELECT_SYMBOL,
@@ -50,7 +53,7 @@ export const VOptionGroup = defineComponent({
50
53
  return (
51
54
  <div class={classes}>
52
55
  {!!label && <div class="v-option-group__label">{label}</div>}
53
- {renderSlotOrEmpty(this.$slots, 'default')}
56
+ {this.$slots.default?.()}
54
57
  </div>
55
58
  );
56
59
  },
@@ -1,26 +1,23 @@
1
1
  import './VPaper.scss';
2
2
  import { defineComponent, computed, PropType, VNodeProps } from 'vue';
3
3
  import { createElevationProps, useElevation } from '../../composables';
4
- import {
5
- renderSlotOrEmpty,
6
- defineSlotsProps,
7
- htmlAttributesPropOptions,
8
- } from '@fastkit/vue-utils';
4
+ import { renderSlotOrEmpty, defineSlots } from '@fastkit/vue-utils';
9
5
  import { useScopeColorClass, ScopeName } from '@fastkit/vue-color-scheme';
10
6
 
7
+ export const paperBaseSlots = defineSlots<{
8
+ header?: () => void;
9
+ default?: () => void;
10
+ footer?: () => void;
11
+ }>();
12
+
11
13
  export function createPaperBaseProps() {
12
14
  return {
13
- ...htmlAttributesPropOptions,
14
15
  color: String as PropType<ScopeName>,
15
16
  tag: {
16
17
  type: [String, Object] as PropType<any>,
17
18
  default: 'div',
18
19
  },
19
- ...defineSlotsProps<{
20
- header: void;
21
- default: void;
22
- footer: void;
23
- }>(),
20
+ ...paperBaseSlots(),
24
21
  };
25
22
  }
26
23
 
@@ -42,6 +39,7 @@ export const VPaper = defineComponent({
42
39
  name: 'VPaper',
43
40
  inheritAttrs: false,
44
41
  props: createPaperProps(),
42
+ slots: paperBaseSlots,
45
43
  setup(props, ctx) {
46
44
  const tag = computed(() => props.tag);
47
45
  const elevation = useElevation(props, { defaultValue: 1 });
@@ -72,7 +70,7 @@ export const VPaper = defineComponent({
72
70
  </div>
73
71
  )}
74
72
  <div class="v-paper__body" {...bodyProps.value}>
75
- {renderSlotOrEmpty(ctx.slots, 'default')}
73
+ {ctx.slots.default?.()}
76
74
  </div>
77
75
  {footer && (
78
76
  <div class="v-paper__footer" {...footerProps.value}>
@@ -4,7 +4,6 @@ import {
4
4
  createFormSelectorItemSettings,
5
5
  useFormSelectorItemControl,
6
6
  } from '@fastkit/vue-form-control';
7
- import { renderSlotOrEmpty } from '@fastkit/vue-utils';
8
7
  import { createControlProps, useControl } from '../../composables';
9
8
  import { VUI_RADIO_GROUP_SYMBOL, VUI_RADIO_SYMBOL } from '../../injections';
10
9
  import { VCheckable } from '../VCheckable';
@@ -48,7 +47,7 @@ export const VRadio = defineComponent({
48
47
  input: () =>
49
48
  selectorItemControl.createInputElement({ type: 'radio' }),
50
49
  faux: () => <span class="v-radio__faux"></span>,
51
- label: () => renderSlotOrEmpty(this.$slots, 'default'),
50
+ label: () => this.$slots.default?.(),
52
51
  }}
53
52
  />
54
53
  );
@@ -16,7 +16,7 @@ import {
16
16
  FormSelectorItemControl,
17
17
  } from '@fastkit/vue-form-control';
18
18
  import {
19
- defineSlotsProps,
19
+ defineSlots,
20
20
  createPropsOptions,
21
21
  VNodeChildOrSlot,
22
22
  resolveVNodeChildOrSlots,
@@ -53,6 +53,16 @@ export const KEYBORD_EVENT_TYPES = useKeyboard.Key([
53
53
 
54
54
  const { props, emits } = createFormSelectorSettings();
55
55
 
56
+ const slots = defineSlots<
57
+ FormControlSlots &
58
+ InputBoxSlots & {
59
+ selection?: (ctx: {
60
+ item: FormSelectorItemControl;
61
+ index: number;
62
+ }) => any;
63
+ }
64
+ >();
65
+
56
66
  export const VSelect = defineComponent({
57
67
  name: 'VSelect',
58
68
  props: {
@@ -61,12 +71,7 @@ export const VSelect = defineComponent({
61
71
  ...createControlFieldProps(),
62
72
  ...createControlFieldProviderProps(),
63
73
  ...createControlProps(),
64
- ...defineSlotsProps<
65
- FormControlSlots &
66
- InputBoxSlots & {
67
- selection: { item: FormSelectorItemControl; index: number };
68
- }
69
- >(),
74
+ ...slots(),
70
75
  ...createPropsOptions({
71
76
  placeholder: String,
72
77
  loadingMessage: {} as PropType<VNodeChildOrSlot>,
@@ -74,6 +79,7 @@ export const VSelect = defineComponent({
74
79
  }),
75
80
  closeOnNavigation: Boolean,
76
81
  },
82
+ slots,
77
83
  emits,
78
84
  setup(props, ctx) {
79
85
  const menuRef: Ref<{ stackMenuControl: VMenuControl } | null> = ref(null);
@@ -282,7 +288,7 @@ export const VSelect = defineComponent({
282
288
  },
283
289
  render() {
284
290
  const { nodeControl, selectorControl, selectorItems, selectedItems } = this;
285
- const children = (this.$slots.default && this.$slots.default()) || [];
291
+ const children = this.$slots.default?.() || [];
286
292
  const propGroups = this.propGroups.map((group) => {
287
293
  return (
288
294
  <VOptionGroup
@@ -1,7 +1,6 @@
1
1
  import './VSkeltonLoaderBone.scss';
2
2
 
3
3
  import { defineComponent } from 'vue';
4
- import { renderSlotOrEmpty } from '@fastkit/vue-utils';
5
4
 
6
5
  export const VSkeltonLoaderBone = defineComponent({
7
6
  name: 'VSkeltonLoaderBone',
@@ -17,7 +16,7 @@ export const VSkeltonLoaderBone = defineComponent({
17
16
  const TagName = props.tag as 'div';
18
17
  return (
19
18
  <TagName {...ctx.attrs} class="v-skelton-loader-bone">
20
- {renderSlotOrEmpty(ctx.slots)}
19
+ {ctx.slots.default?.()}
21
20
  </TagName>
22
21
  );
23
22
  };
@@ -4,7 +4,6 @@ import {
4
4
  createFormSelectorItemSettings,
5
5
  useFormSelectorItemControl,
6
6
  } from '@fastkit/vue-form-control';
7
- import { renderSlotOrEmpty } from '@fastkit/vue-utils';
8
7
  import { createControlProps, useControl } from '../../composables';
9
8
  import { VUI_SWITCH_GROUP_SYMBOL, VUI_SWITCH_SYMBOL } from '../../injections';
10
9
  import { VCheckable } from '../VCheckable';
@@ -58,7 +57,7 @@ export const VSwitch = defineComponent({
58
57
  <span class="v-switch__faux__pin"></span>
59
58
  </span>
60
59
  ),
61
- label: () => renderSlotOrEmpty(this.$slots, 'default'),
60
+ label: () => this.$slots.default?.(),
62
61
  }}
63
62
  />
64
63
  );
@@ -8,7 +8,6 @@ import {
8
8
  } from 'vue';
9
9
  import { RouteLocationRaw } from 'vue-router';
10
10
  import { RawIconProp, resolveRawIconProp } from '../VIcon';
11
- import { renderSlotOrEmpty } from '@fastkit/vue-utils';
12
11
  import { RouterLink } from 'vue-router';
13
12
 
14
13
  export interface VTabExpose {
@@ -54,7 +53,7 @@ export const VTab = defineComponent({
54
53
  resolveRawIconProp(active, icon, {
55
54
  class: 'v-tab__icon',
56
55
  })}
57
- {renderSlotOrEmpty(ctx.slots)}
56
+ {ctx.slots.default?.()}
58
57
  </span>
59
58
  );
60
59
 
@@ -13,7 +13,7 @@ import {
13
13
  import { RawIconProp } from '../VIcon';
14
14
  import { VuiService } from '../../service';
15
15
  import { useVui } from '../../injections';
16
- import { defineSlotsProps } from '@fastkit/vue-utils';
16
+ import { defineSlots } from '@fastkit/vue-utils';
17
17
  import { RouteLocationRaw, RouteLocation } from 'vue-router';
18
18
  import { VTab, VTabRef } from './VTab';
19
19
  import {
@@ -45,6 +45,10 @@ export interface VTabsItem {
45
45
  label?: VNodeChild | VTabsItemLabelSlot;
46
46
  }
47
47
 
48
+ const slots = defineSlots<{
49
+ item?: (ctx: VTabsItemLabelSlotCtx) => any;
50
+ }>();
51
+
48
52
  export const VTabs = defineComponent({
49
53
  name: 'VTabs',
50
54
  props: {
@@ -76,17 +80,15 @@ export const VTabs = defineComponent({
76
80
  * タブのURLが /page1?tab=xxx のようになる時に設定する
77
81
  */
78
82
  withQuery: Boolean,
79
- ...defineSlotsProps<{
80
- item: VTabsItemLabelSlotCtx;
81
- }>(),
82
-
83
83
  color: String as PropType<ScopeName>,
84
84
  onBeforeChange: Function as PropType<VTabsGuard>,
85
+ ...slots(),
85
86
  },
86
87
  emits: {
87
88
  'update:modelValue': (newValue: string) => true,
88
89
  change: (newValue: string) => true,
89
90
  },
91
+ slots,
90
92
  setup(props, ctx) {
91
93
  const vui = useVui();
92
94
 
@@ -296,7 +298,7 @@ export const VTabs = defineComponent({
296
298
 
297
299
  return () => {
298
300
  const items = computedItemsRef.value;
299
- const itemSlot = ctx.slots.item as VTabsItemLabelSlot | undefined;
301
+ const itemSlot = ctx.slots.item;
300
302
  const children = items.map(({ value, active, label, icon, location }) => {
301
303
  if (!label) {
302
304
  label = itemSlot;
@@ -7,7 +7,7 @@ import {
7
7
  FormControlSlots,
8
8
  TextInputEmits,
9
9
  } from '@fastkit/vue-form-control';
10
- import { defineSlotsProps } from '@fastkit/vue-utils';
10
+ import { defineSlots, ExtractPropInput } from '@fastkit/vue-utils';
11
11
  import { VFormControl } from '../VFormControl';
12
12
  import {
13
13
  VControlField,
@@ -22,10 +22,11 @@ import {
22
22
  } from '../../composables';
23
23
  import { VTextCounter } from '../VTextCounter';
24
24
  import { VUI_TEXT_FIELD_SYMBOL } from '../../injections';
25
- import { ExtractPropInput } from '@fastkit/vue-utils';
26
25
 
27
26
  const { props, emits } = createTextInputSettings();
28
27
 
28
+ const slots = defineSlots<FormControlSlots & InputBoxSlots>();
29
+
29
30
  function createTextFieldProps() {
30
31
  return {
31
32
  ...props,
@@ -33,7 +34,7 @@ function createTextFieldProps() {
33
34
  ...createControlFieldProps(),
34
35
  ...createControlFieldProviderProps(),
35
36
  ...createControlProps(),
36
- ...defineSlotsProps<FormControlSlots & InputBoxSlots>(),
37
+ ...slots(),
37
38
  };
38
39
  }
39
40
 
@@ -49,6 +50,7 @@ export const VTextField = defineComponent({
49
50
  name: 'VTextField',
50
51
  props: createTextFieldProps(),
51
52
  emits,
53
+ slots,
52
54
  setup(props, ctx) {
53
55
  const inputControl = useTextInputControl(props, ctx, {
54
56
  nodeType: VUI_TEXT_FIELD_SYMBOL,
@@ -6,7 +6,7 @@ import {
6
6
  createFormControlProps,
7
7
  FormControlSlots,
8
8
  } from '@fastkit/vue-form-control';
9
- import { defineSlotsProps } from '@fastkit/vue-utils';
9
+ import { defineSlots } from '@fastkit/vue-utils';
10
10
  import { VFormControl } from '../VFormControl';
11
11
  import {
12
12
  VControlField,
@@ -24,6 +24,8 @@ import { VUI_TEXTAREA_SYMBOL, useVui } from '../../injections';
24
24
 
25
25
  const { props, emits } = createTextareaSettings();
26
26
 
27
+ const slots = defineSlots<FormControlSlots & InputBoxSlots>();
28
+
27
29
  export const VTextarea = defineComponent({
28
30
  name: 'VTextarea',
29
31
  props: {
@@ -32,7 +34,7 @@ export const VTextarea = defineComponent({
32
34
  ...createControlFieldProps(),
33
35
  ...createControlFieldProviderProps(),
34
36
  ...createControlProps(),
35
- ...defineSlotsProps<FormControlSlots & InputBoxSlots>(),
37
+ ...slots(),
36
38
  },
37
39
  emits,
38
40
  setup(props, ctx) {
@@ -1,6 +1,5 @@
1
1
  import './VToolbar.scss';
2
2
  import { defineComponent, computed } from 'vue';
3
- import { renderSlotOrEmpty } from '@fastkit/vue-utils';
4
3
  import { colorSchemeProps, useColorClasses } from '@fastkit/vue-color-scheme';
5
4
  import { createElevationProps, useElevation } from '../../composables';
6
5
  import { useVui } from '../../injections';
@@ -35,9 +34,7 @@ export const VToolbar = defineComponent({
35
34
 
36
35
  return () => {
37
36
  return (
38
- <div class={['v-toolbar', classes.value]}>
39
- {renderSlotOrEmpty(ctx.slots, 'default')}
40
- </div>
37
+ <div class={['v-toolbar', classes.value]}>{ctx.slots.default?.()}</div>
41
38
  );
42
39
  };
43
40
  },
@@ -1,6 +1,5 @@
1
1
  import './VToolbarMenu.scss';
2
2
  import { defineComponent } from 'vue';
3
- import { renderSlotOrEmpty } from '@fastkit/vue-utils';
4
3
  import { VButton, vueButtonProps } from '../VButton';
5
4
  import { useVui } from '../../injections';
6
5
 
@@ -23,7 +22,7 @@ export const VToolbarMenu = defineComponent({
23
22
  const variant = props.variant || plain;
24
23
  return (
25
24
  <VButton {...ctx.attrs} variant={variant} class={['v-toolbar-menu']}>
26
- {renderSlotOrEmpty(ctx.slots)}
25
+ {ctx.slots.default?.()}
27
26
  </VButton>
28
27
  );
29
28
  };
@@ -1,6 +1,10 @@
1
1
  import './VToolbarTitle.scss';
2
2
  import { defineComponent, computed } from 'vue';
3
- import { renderSlotOrEmpty } from '@fastkit/vue-utils';
3
+ import { defineSlots } from '@fastkit/vue-utils';
4
+
5
+ const slots = defineSlots<{
6
+ default?: () => any;
7
+ }>();
4
8
 
5
9
  export const VToolbarTitle = defineComponent({
6
10
  name: 'VToolbarTitle',
@@ -9,17 +13,15 @@ export const VToolbarTitle = defineComponent({
9
13
  type: String,
10
14
  default: 'span',
11
15
  },
16
+ ...slots(),
12
17
  },
18
+ slots,
13
19
  setup(props, ctx) {
14
20
  const _TagName = computed(() => props.tag);
15
21
  return () => {
16
22
  const TagName = _TagName.value as 'span';
17
23
 
18
- return (
19
- <TagName class="v-toolbar-title">
20
- {renderSlotOrEmpty(ctx.slots, 'default')}
21
- </TagName>
22
- );
24
+ return <TagName class="v-toolbar-title">{ctx.slots.default?.()}</TagName>;
23
25
  };
24
26
  },
25
27
  });
@@ -10,9 +10,8 @@ import {
10
10
  FormNodeControl,
11
11
  } from '@fastkit/vue-form-control';
12
12
  import {
13
- defineSlotsProps,
13
+ defineSlots,
14
14
  TypedSlot,
15
- renderSlotOrEmpty,
16
15
  VNodeChildOrSlot,
17
16
  resolveVNodeChildOrSlots,
18
17
  } from '@fastkit/vue-utils';
@@ -40,6 +39,12 @@ export interface DefineFormSelectorComponentOptions {
40
39
  }) => VNodeChild;
41
40
  }
42
41
 
42
+ const slots = defineSlots<
43
+ FormControlSlots & {
44
+ default?: () => any;
45
+ }
46
+ >();
47
+
43
48
  export function defineFormSelectorComponent(
44
49
  opts: DefineFormSelectorComponentOptions,
45
50
  ) {
@@ -62,8 +67,9 @@ export function defineFormSelectorComponent(
62
67
  loadingMessage: {} as PropType<VNodeChildOrSlot>,
63
68
  // eslint-disable-next-line vue/require-prop-types
64
69
  failedToLoadItemsMessage: {} as PropType<VNodeChildOrSlot>,
65
- ...defineSlotsProps<FormControlSlots>(),
70
+ ...slots(),
66
71
  },
72
+ slots,
67
73
  emits,
68
74
  setup(props, ctx) {
69
75
  const selectorControl = useFormSelectorControl(props, ctx, {
@@ -161,7 +167,7 @@ export function defineFormSelectorComponent(
161
167
  </>
162
168
  );
163
169
  })}
164
- {renderSlotOrEmpty(this.$slots, 'default')}
170
+ {this.$slots.default?.()}
165
171
  </div>
166
172
  ),
167
173
  }}
package/src/plugin.tsx CHANGED
@@ -44,7 +44,7 @@ export function mergeVuiPluginOptions(
44
44
  return merged;
45
45
  }
46
46
 
47
- declare module '@vue/runtime-core' {
47
+ declare module 'vue' {
48
48
  export interface ComponentCustomProperties {
49
49
  $vui: VuiService;
50
50
  }