@fastkit/vui 0.6.30 → 0.6.31

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.
@@ -3,13 +3,13 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var vueKit = require('@fastkit/vue-kit');
6
+ var vueRouter = require('vue-router');
6
7
  var vueUtils = require('@fastkit/vue-utils');
7
8
  var vue = require('vue');
8
9
  var vueColorScheme = require('@fastkit/vue-color-scheme');
9
10
  var vueLoading = require('@fastkit/vue-loading');
10
11
  var iconFont = require('@fastkit/icon-font');
11
12
  var helpers = require('@fastkit/helpers');
12
- var vueRouter = require('vue-router');
13
13
  var vueAppLayout = require('@fastkit/vue-app-layout');
14
14
  var vueScroller = require('@fastkit/vue-scroller');
15
15
 
@@ -435,7 +435,7 @@ function resolveRawVButtonIcon(raw, type = 'main') {
435
435
  }
436
436
 
437
437
  const vueButtonProps = vueUtils.createPropsOptions({ ...vueColorScheme.colorSchemeProps(),
438
- ...vueUtils.navigationableProps,
438
+ ...vueUtils.navigationableInheritProps,
439
439
  spacer: [Boolean, String],
440
440
  loading: Boolean,
441
441
  rounded: Boolean,
@@ -451,9 +451,8 @@ const LOADING_SIZE_MAP = {
451
451
  };
452
452
  const VButton = vue.defineComponent({
453
453
  name: 'VButton',
454
+ inheritAttrs: false,
454
455
  props: vueButtonProps,
455
- emits: { ...vueUtils.navigationableEmits
456
- },
457
456
 
458
457
  setup(props, ctx) {
459
458
  const vui = useVui();
@@ -479,48 +478,25 @@ const VButton = vue.defineComponent({
479
478
  variant: () => props.variant || (icon.value ? vui.setting('plainVariant') : defaults.variant)
480
479
  });
481
480
  const isPlain = vue.computed(() => color.variant.value.value === vui.setting('plainVariant') && color.color.value.value === defaults.color);
482
- const navigationable = vueUtils.useNavigationable(props);
483
- const isLoading = vue.computed(() => props.loading);
484
- const isDisabled = vue.computed(() => props.disabled);
481
+ const isLoading = vue.computed(() => props.loading); // const isDisabled = computed(() => props.disabled);
482
+
485
483
  const isRounded = vue.computed(() => props.rounded || !!icon.value);
486
484
  const spacer = vue.computed(() => {
487
485
  const _spacer = props.spacer;
488
486
  if (!_spacer) return;
489
487
  return _spacer === true ? 'left' : _spacer;
490
488
  });
491
- const classes = vue.computed(() => [color.colorClasses.value, navigationable.value.classes, spacer.value ? `v-button--spacer-${spacer.value}` : undefined, `v-button--${control.size.value}`, {
489
+ const classes = vue.computed(() => [color.colorClasses.value, // navigationable.value.classes,
490
+ spacer.value ? `v-button--spacer-${spacer.value}` : undefined, `v-button--${control.size.value}`, {
492
491
  'v-button--loading': isLoading.value,
493
492
  'v-button--icon': !!icon.value,
494
493
  'v-button--rounded': isRounded.value,
495
494
  'v-button--plain': isPlain.value
496
495
  }]);
497
496
  return () => {
498
- const {
499
- Tag,
500
- attrs
501
- } = navigationable.value;
502
- const children = vueUtils.renderSlotOrEmpty(ctx.slots, 'default');
503
- const _attrs = { ...attrs
504
- };
505
-
506
- if (isDisabled.value) {
507
- _attrs.disabled = true;
508
- }
509
-
510
- return vue.createVNode(Tag, vue.mergeProps({
497
+ const children = vueUtils.renderSlotOrEmpty(ctx.slots);
498
+ return vue.createVNode(vueUtils.VLink, vue.mergeProps(ctx.attrs, {
511
499
  "class": ['v-button', classes.value]
512
- }, _attrs, {
513
- "onClick": ev => {
514
- if (isDisabled.value || isLoading.value) {
515
- ev.preventDefault();
516
-
517
- if (isDisabled.value) {
518
- return;
519
- }
520
- }
521
-
522
- ctx.emit('click', ev);
523
- }
524
500
  }), {
525
501
  default: () => [vue.createVNode("span", {
526
502
  "class": "v-button__content"
@@ -535,7 +511,7 @@ const VButton = vue.defineComponent({
535
511
 
536
512
  });
537
513
 
538
- function _isSlot$b(s) {
514
+ function _isSlot$c(s) {
539
515
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
540
516
  }
541
517
 
@@ -783,7 +759,7 @@ const VPagination = vue.defineComponent({
783
759
  "class": classes,
784
760
  "to": to,
785
761
  "key": key
786
- }, _isSlot$b(children) ? children : {
762
+ }, _isSlot$c(children) ? children : {
787
763
  default: () => [children]
788
764
  });
789
765
  } else {
@@ -830,11 +806,11 @@ const VPagination = vue.defineComponent({
830
806
 
831
807
  function createListTileProps() {
832
808
  const icon = rawIconProp();
833
- return { ...vueUtils.navigationableProps,
809
+ return { ...vueUtils.navigationableInheritProps,
834
810
  ...vueUtils.createPropsOptions({
835
811
  startIcon: icon,
836
812
  endIcon: icon,
837
- fallbackTag: {
813
+ linkFallbackTag: {
838
814
  type: String,
839
815
  default: 'div'
840
816
  },
@@ -844,11 +820,12 @@ function createListTileProps() {
844
820
  })
845
821
  };
846
822
  }
847
- const listTileEmits = { ...vueUtils.navigationableEmits,
823
+ const listTileEmits = {
848
824
  changeActive: isActive => true
849
825
  };
850
826
  const VListTile = vue.defineComponent({
851
827
  name: 'VListTile',
828
+ inheritAttrs: false,
852
829
  props: createListTileProps(),
853
830
  emits: { ...listTileEmits
854
831
  },
@@ -864,7 +841,6 @@ const VListTile = vue.defineComponent({
864
841
  return icon;
865
842
  });
866
843
  const endIcon = vue.computed(() => resolveRawIconProp(false, props.endIcon));
867
- const navigationable = vueUtils.useNavigationable(props, () => props.fallbackTag, ctx);
868
844
  const hasTo = vue.computed(() => !!props.to);
869
845
  const link = vueRouter.useLink({
870
846
  to: props.to || ''
@@ -877,10 +853,7 @@ const VListTile = vue.defineComponent({
877
853
  const classes = vue.computed(() => {
878
854
  const _color = color.value;
879
855
  const hasColor = !!_color.value;
880
- const _navigationable = navigationable.value;
881
- const clickable = _navigationable.clickable;
882
- return [color.value.className, _navigationable.classes, {
883
- 'v-list-tile--clickable': clickable,
856
+ return [color.value.className, {
884
857
  'v-list-tile--plain': !hasColor,
885
858
  'v-list-tile--has-color': hasColor,
886
859
  'v-list-tile--active': isActive.value
@@ -894,16 +867,9 @@ const VListTile = vue.defineComponent({
894
867
  return () => {
895
868
  const _startIcon = startIcon.value;
896
869
  const _endIcon = endIcon.value;
897
- const {
898
- Tag,
899
- attrs
900
- } = navigationable.value;
901
- return vue.createVNode(Tag, vue.mergeProps({
902
- "class": ['v-list-tile', classes.value]
903
- }, attrs, {
904
- "onClick": ev => {
905
- ctx.emit('click', ev);
906
- }
870
+ return vue.createVNode(vueUtils.VLink, vue.mergeProps(ctx.attrs, {
871
+ "class": ['v-list-tile', classes.value],
872
+ "clickableClassName": "v-list-tile--clickable"
907
873
  }), {
908
874
  default: () => [_startIcon && vue.createVNode("span", {
909
875
  "class": "v-list-tile__icon v-list-tile__icon--start"
@@ -948,7 +914,7 @@ const VDrawerLayout = vue.defineComponent({
948
914
 
949
915
  });
950
916
 
951
- function _isSlot$a(s) {
917
+ function _isSlot$b(s) {
952
918
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
953
919
  }
954
920
 
@@ -983,7 +949,7 @@ const VHero = vue.defineComponent({
983
949
  }, {
984
950
  default: () => [vue.createVNode(HTagName, {
985
951
  "class": "v-hero__title"
986
- }, _isSlot$a(_slot = vueUtils.renderSlotOrEmpty(ctx.slots, 'default')) ? _slot : {
952
+ }, _isSlot$b(_slot = vueUtils.renderSlotOrEmpty(ctx.slots, 'default')) ? _slot : {
987
953
  default: () => [_slot]
988
954
  })]
989
955
  })]
@@ -993,7 +959,7 @@ const VHero = vue.defineComponent({
993
959
 
994
960
  });
995
961
 
996
- function _isSlot$9(s) {
962
+ function _isSlot$a(s) {
997
963
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
998
964
  }
999
965
 
@@ -1024,7 +990,7 @@ function renderNavigationItemInput(input, extraProps) {
1024
990
  } = resolveNavigationItemInput(input);
1025
991
  return vue.createVNode(VNavigationItem, { ...props,
1026
992
  ...extraProps
1027
- }, _isSlot$9(label) ? label : {
993
+ }, _isSlot$a(label) ? label : {
1028
994
  default: () => [label]
1029
995
  });
1030
996
  }
@@ -1133,9 +1099,8 @@ const VNavigationItem = vue.defineComponent({
1133
1099
  const onClick = ev => {
1134
1100
  if (!to.value) {
1135
1101
  toggle();
1136
- }
1102
+ } // ctx.emit('click', ev);
1137
1103
 
1138
- ctx.emit('click', ev);
1139
1104
  };
1140
1105
 
1141
1106
  const onChangeActive = isActive => {
@@ -1162,13 +1127,13 @@ const VNavigationItem = vue.defineComponent({
1162
1127
 
1163
1128
  const _children = children.value;
1164
1129
  const fallbackTag = _children ? 'button' : undefined;
1165
- return vue.createVNode(vue.Fragment, null, [vue.createVNode(VListTile, vue.mergeProps(_props.value, {
1130
+ return vue.createVNode(vue.Fragment, null, [vue.createVNode(VListTile, vue.mergeProps(ctx.attrs, _props.value, {
1166
1131
  "fallbackTag": fallbackTag,
1167
1132
  "endIcon": _props.value.endIcon,
1168
1133
  "class": ['v-navigation-item', classes.value],
1169
1134
  "onClick": onClick,
1170
1135
  "onChangeActive": onChangeActive
1171
- }), _isSlot$9(_slot = vueUtils.renderSlotOrEmpty(ctx.slots, 'default')) ? _slot : {
1136
+ }), _isSlot$a(_slot = vueUtils.renderSlotOrEmpty(ctx.slots, 'default')) ? _slot : {
1172
1137
  default: () => [_slot]
1173
1138
  }), _children && vue.createVNode(vueUtils.VExpandTransition, null, {
1174
1139
  default: () => [vue.withDirectives(vue.createVNode("div", {
@@ -1316,7 +1281,7 @@ const VCheckbox = vue.defineComponent({
1316
1281
 
1317
1282
  });
1318
1283
 
1319
- function _isSlot$8(s) {
1284
+ function _isSlot$9(s) {
1320
1285
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
1321
1286
  }
1322
1287
 
@@ -1328,7 +1293,7 @@ const VCheckboxGroup = defineFormSelectorComponent({
1328
1293
  itemRenderer: ({
1329
1294
  attrs,
1330
1295
  slots
1331
- }) => vue.createVNode(VCheckbox, attrs, _isSlot$8(slots) ? slots : {
1296
+ }) => vue.createVNode(VCheckbox, attrs, _isSlot$9(slots) ? slots : {
1332
1297
  default: () => [slots]
1333
1298
  })
1334
1299
  });
@@ -1380,7 +1345,7 @@ const VRadio = vue.defineComponent({
1380
1345
 
1381
1346
  });
1382
1347
 
1383
- function _isSlot$7(s) {
1348
+ function _isSlot$8(s) {
1384
1349
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
1385
1350
  }
1386
1351
 
@@ -1391,7 +1356,7 @@ const VRadioGroup = defineFormSelectorComponent({
1391
1356
  itemRenderer: ({
1392
1357
  attrs,
1393
1358
  slots
1394
- }) => vue.createVNode(VRadio, attrs, _isSlot$7(slots) ? slots : {
1359
+ }) => vue.createVNode(VRadio, attrs, _isSlot$8(slots) ? slots : {
1395
1360
  default: () => [slots]
1396
1361
  })
1397
1362
  });
@@ -1453,7 +1418,7 @@ const VSwitch = vue.defineComponent({
1453
1418
 
1454
1419
  });
1455
1420
 
1456
- function _isSlot$6(s) {
1421
+ function _isSlot$7(s) {
1457
1422
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
1458
1423
  }
1459
1424
 
@@ -1465,7 +1430,7 @@ const VSwitchGroup = defineFormSelectorComponent({
1465
1430
  itemRenderer: ({
1466
1431
  attrs,
1467
1432
  slots
1468
- }) => vue.createVNode(VSwitch, attrs, _isSlot$6(slots) ? slots : {
1433
+ }) => vue.createVNode(VSwitch, attrs, _isSlot$7(slots) ? slots : {
1469
1434
  default: () => [slots]
1470
1435
  })
1471
1436
  });
@@ -2024,7 +1989,7 @@ const VForm = vue.defineComponent({
2024
1989
 
2025
1990
  });
2026
1991
 
2027
- function _isSlot$5(s) {
1992
+ function _isSlot$6(s) {
2028
1993
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
2029
1994
  }
2030
1995
 
@@ -2073,7 +2038,7 @@ const VTab = vue.defineComponent({
2073
2038
  "class": classes,
2074
2039
  "to": to,
2075
2040
  "replace": replace
2076
- }, _isSlot$5(children) ? children : {
2041
+ }, _isSlot$6(children) ? children : {
2077
2042
  default: () => [children]
2078
2043
  });
2079
2044
  } else {
@@ -2091,7 +2056,7 @@ const VTab = vue.defineComponent({
2091
2056
 
2092
2057
  });
2093
2058
 
2094
- function _isSlot$4(s) {
2059
+ function _isSlot$5(s) {
2095
2060
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
2096
2061
  }
2097
2062
 
@@ -2346,7 +2311,7 @@ const VTabs = vue.defineComponent({
2346
2311
  to(value);
2347
2312
  }
2348
2313
  }
2349
- }, _isSlot$4(children) ? children : {
2314
+ }, _isSlot$5(children) ? children : {
2350
2315
  default: () => [children]
2351
2316
  });
2352
2317
  });
@@ -2368,6 +2333,119 @@ const VTabs = vue.defineComponent({
2368
2333
 
2369
2334
  });
2370
2335
 
2336
+ function _isSlot$4(s) {
2337
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
2338
+ }
2339
+
2340
+ const VBreadcrumbs = vue.defineComponent({
2341
+ name: 'VBreadcrumbs',
2342
+ props: {
2343
+ items: {
2344
+ type: Array,
2345
+ default: () => []
2346
+ },
2347
+ divider: [String, Function] // ...defineSlotsProps<{}>(),
2348
+
2349
+ },
2350
+
2351
+ setup(props, ctx) {
2352
+ const vui = useVui();
2353
+ const computedItemsRef = vue.computed(() => {
2354
+ const items = props.items.map(rawItem => {
2355
+ return typeof rawItem === 'string' ? {
2356
+ text: rawItem
2357
+ } : rawItem;
2358
+ });
2359
+ return items.map(item => {
2360
+ const {
2361
+ to,
2362
+ text
2363
+ } = item;
2364
+ const {
2365
+ disabled = vui.location.match(to) || !vui.location.isAvairable(to)
2366
+ } = item;
2367
+ return { ...item,
2368
+ disabled,
2369
+ text: typeof text === 'function' ? text(vui) : text
2370
+ };
2371
+ });
2372
+ });
2373
+ const lengthRef = vue.computed(() => computedItemsRef.value.length);
2374
+
2375
+ const defaultDividerSlot = () => {
2376
+ return [vue.createVNode("i", {
2377
+ "class": "v-breadcrumbs__divider__icon"
2378
+ }, null)];
2379
+ };
2380
+
2381
+ return () => {
2382
+ if (lengthRef.value < 1) return;
2383
+ let dividerSlot;
2384
+ const propDivider = props.divider;
2385
+
2386
+ if (propDivider) {
2387
+ dividerSlot = typeof propDivider === 'function' ? propDivider : () => propDivider;
2388
+ } else {
2389
+ dividerSlot = defaultDividerSlot;
2390
+ }
2391
+
2392
+ const children = [];
2393
+ computedItemsRef.value.forEach((item, index) => {
2394
+ const {
2395
+ text,
2396
+ icon,
2397
+ disabled,
2398
+ to
2399
+ } = item;
2400
+
2401
+ if (index > 0) {
2402
+ const divider = dividerSlot(vui);
2403
+
2404
+ if (divider) {
2405
+ children.push(vue.createVNode("li", {
2406
+ "class": "v-breadcrumbs__divider",
2407
+ "key": `divider-${index}`
2408
+ }, [divider]));
2409
+ }
2410
+ }
2411
+
2412
+ const myChildren = [];
2413
+
2414
+ if (icon) {
2415
+ const $icon = resolveRawIconProp(false, icon, {
2416
+ class: 'v-breadcrumbs__icon'
2417
+ });
2418
+
2419
+ if ($icon) {
2420
+ myChildren.push($icon);
2421
+ }
2422
+ }
2423
+
2424
+ if (text) myChildren.push(text);
2425
+ const itemChild = to ? vue.createVNode(vueUtils.VLink, {
2426
+ "class": "v-breadcrumbs__link",
2427
+ "to": to,
2428
+ "exactActiveClass": "v-breadcrumbs__link--active"
2429
+ }, _isSlot$4(myChildren) ? myChildren : {
2430
+ default: () => [myChildren]
2431
+ }) : myChildren;
2432
+ children.push(vue.createVNode("li", {
2433
+ "class": ['v-breadcrumbs__item', {
2434
+ 'v-breadcrumbs__item--disabled': disabled
2435
+ }],
2436
+ "key": `link-${index}`
2437
+ }, [itemChild]));
2438
+ });
2439
+ return vue.createVNode("nav", {
2440
+ "class": "v-breadcrumbs"
2441
+ }, [vue.createVNode("ul", {
2442
+ "class": "v-breadcrumbs__list"
2443
+ }, [children])]);
2444
+ };
2445
+ }
2446
+
2447
+ });
2448
+
2371
2449
  function _isSlot$3(s) {
2372
2450
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
2373
2451
  }
@@ -3274,6 +3352,7 @@ class VuiService {
3274
3352
  location;
3275
3353
  constructor(options) {
3276
3354
  this.options = options;
3355
+ this.configure();
3277
3356
  const { selectionSeparator = () => ', ', autoScrollToElementOffsetTop = DEFAULT_AUTO_SCROLL_TO_ELEMENT_OFFSET_TOP, textareaRows = DEFAULT_TEXTAREA_ROWS, requiredChip = () => '*', } = options;
3278
3357
  this.selectionSeparator = selectionSeparator;
3279
3358
  this.autoScrollToElementOffsetTop = autoScrollToElementOffsetTop;
@@ -3284,6 +3363,13 @@ class VuiService {
3284
3363
  router: this.router,
3285
3364
  });
3286
3365
  }
3366
+ configure(options) {
3367
+ options && Object.assign(this.options, options);
3368
+ vueUtils.setDefaultRouterLink(this.getRouterLink());
3369
+ }
3370
+ getRouterLink() {
3371
+ return this.options.RouterLink || vueRouter.RouterLink;
3372
+ }
3287
3373
  setting(key) {
3288
3374
  return this.options.uiSettings[key];
3289
3375
  }
@@ -3368,6 +3454,7 @@ exports.CONTROL_FIELD_VARIANTS = CONTROL_FIELD_VARIANTS;
3368
3454
  exports.CONTROL_SIZES = CONTROL_SIZES;
3369
3455
  exports.PAGINATION_ALIGNS = PAGINATION_ALIGNS;
3370
3456
  exports.VApp = VApp;
3457
+ exports.VBreadcrumbs = VBreadcrumbs;
3371
3458
  exports.VButton = VButton;
3372
3459
  exports.VCard = VCard;
3373
3460
  exports.VCardActions = VCardActions;
package/dist/vui.css CHANGED
@@ -409,6 +409,7 @@ template {
409
409
  --typo-subtitle2-weight: 500;
410
410
  --typo-subtitle2-height: 1.57;
411
411
  --typo-subtitle2-spacing: 0.00714em;
412
+ --typo-sm-size: calc(var(--root-em) * 0.875);
412
413
  --control-field-rem-sm: 0.875rem;
413
414
  --control-field-rem-md: 1rem;
414
415
  --control-field-rem-lg: 1.125rem;
@@ -543,6 +544,7 @@ template {
543
544
  --tabs-height: calc(var(--root-em) * 3);
544
545
  --tabs-bar-height: calc(var(--root-em) * 0.375);
545
546
  --tabs-font-size: calc(var(--root-em) * 0.875);
547
+ --breadcrumbs-font-size: var(--typo-sm-size);
546
548
  }
547
549
 
548
550
  :root,
@@ -1809,6 +1811,57 @@ thead th {
1809
1811
  .v-tab--active::before {
1810
1812
  transform: scaleX(1);
1811
1813
  }
1814
+ .v-breadcrumbs {
1815
+ display: block;
1816
+ margin: 1.5em auto;
1817
+ font-size: var(--breadcrumbs-font-size);
1818
+ }
1819
+ .v-breadcrumbs__list {
1820
+ display: inline-flex;
1821
+ flex-wrap: wrap;
1822
+ align-items: center;
1823
+ padding: 0;
1824
+ margin: 0;
1825
+ vertical-align: bottom;
1826
+ list-style: none;
1827
+ }
1828
+ .v-breadcrumbs__item, .v-breadcrumbs__divider {
1829
+ padding: 0;
1830
+ margin: 0;
1831
+ list-style: none;
1832
+ }
1833
+ .v-breadcrumbs__link {
1834
+ display: inline-flex;
1835
+ align-items: center;
1836
+ text-decoration: none;
1837
+ white-space: nowrap;
1838
+ vertical-align: middle;
1839
+ }
1840
+ .v-breadcrumbs__item--disabled .v-breadcrumbs__link {
1841
+ color: inherit;
1842
+ pointer-events: none;
1843
+ }
1844
+ .v-breadcrumbs__icon {
1845
+ margin-right: 0.2em;
1846
+ font-size: 140%;
1847
+ }
1848
+ .v-breadcrumbs__divider {
1849
+ position: relative;
1850
+ top: 1px;
1851
+ display: flex;
1852
+ align-items: center;
1853
+ justify-content: center;
1854
+ margin: 0 1.25em;
1855
+ }
1856
+ .v-breadcrumbs__divider__icon {
1857
+ display: block;
1858
+ width: 0.5em;
1859
+ height: 0.5em;
1860
+ margin-left: -0.25em;
1861
+ border-top: solid 1px currentColor;
1862
+ border-right: solid 1px currentColor;
1863
+ transform: rotate(45deg);
1864
+ }
1812
1865
  .v-content-switcher {
1813
1866
  position: relative;
1814
1867
  display: block;