@varlet/ui 2.13.0 → 2.13.1-alpha.1689619056304

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/lib/varlet.cjs.js CHANGED
@@ -12265,6 +12265,134 @@ const offset$1 = {
12265
12265
  requires: ["popperOffsets"],
12266
12266
  fn: offset
12267
12267
  };
12268
+ var unsetSides = {
12269
+ top: "auto",
12270
+ right: "auto",
12271
+ bottom: "auto",
12272
+ left: "auto"
12273
+ };
12274
+ function roundOffsetsByDPR(_ref) {
12275
+ var x = _ref.x, y = _ref.y;
12276
+ var win = window;
12277
+ var dpr = win.devicePixelRatio || 1;
12278
+ return {
12279
+ x: round(x * dpr) / dpr || 0,
12280
+ y: round(y * dpr) / dpr || 0
12281
+ };
12282
+ }
12283
+ function mapToStyles(_ref2) {
12284
+ var _Object$assign2;
12285
+ var popper2 = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, variation = _ref2.variation, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive, roundOffsets = _ref2.roundOffsets, isFixed = _ref2.isFixed;
12286
+ var _offsets$x = offsets.x, x = _offsets$x === void 0 ? 0 : _offsets$x, _offsets$y = offsets.y, y = _offsets$y === void 0 ? 0 : _offsets$y;
12287
+ var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
12288
+ x,
12289
+ y
12290
+ }) : {
12291
+ x,
12292
+ y
12293
+ };
12294
+ x = _ref3.x;
12295
+ y = _ref3.y;
12296
+ var hasX = offsets.hasOwnProperty("x");
12297
+ var hasY = offsets.hasOwnProperty("y");
12298
+ var sideX = left;
12299
+ var sideY = top;
12300
+ var win = window;
12301
+ if (adaptive) {
12302
+ var offsetParent = getOffsetParent(popper2);
12303
+ var heightProp = "clientHeight";
12304
+ var widthProp = "clientWidth";
12305
+ if (offsetParent === getWindow(popper2)) {
12306
+ offsetParent = getDocumentElement(popper2);
12307
+ if (getComputedStyle(offsetParent).position !== "static" && position === "absolute") {
12308
+ heightProp = "scrollHeight";
12309
+ widthProp = "scrollWidth";
12310
+ }
12311
+ }
12312
+ offsetParent = offsetParent;
12313
+ if (placement === top || (placement === left || placement === right) && variation === end) {
12314
+ sideY = bottom;
12315
+ var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : (
12316
+ // $FlowFixMe[prop-missing]
12317
+ offsetParent[heightProp]
12318
+ );
12319
+ y -= offsetY - popperRect.height;
12320
+ y *= gpuAcceleration ? 1 : -1;
12321
+ }
12322
+ if (placement === left || (placement === top || placement === bottom) && variation === end) {
12323
+ sideX = right;
12324
+ var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : (
12325
+ // $FlowFixMe[prop-missing]
12326
+ offsetParent[widthProp]
12327
+ );
12328
+ x -= offsetX - popperRect.width;
12329
+ x *= gpuAcceleration ? 1 : -1;
12330
+ }
12331
+ }
12332
+ var commonStyles = Object.assign({
12333
+ position
12334
+ }, adaptive && unsetSides);
12335
+ var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
12336
+ x,
12337
+ y
12338
+ }) : {
12339
+ x,
12340
+ y
12341
+ };
12342
+ x = _ref4.x;
12343
+ y = _ref4.y;
12344
+ if (gpuAcceleration) {
12345
+ var _Object$assign;
12346
+ return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? "0" : "", _Object$assign[sideX] = hasX ? "0" : "", _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
12347
+ }
12348
+ return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
12349
+ }
12350
+ function computeStyles(_ref5) {
12351
+ var state = _ref5.state, options = _ref5.options;
12352
+ var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
12353
+ if (process.env.NODE_ENV !== "production") {
12354
+ var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || "";
12355
+ if (adaptive && ["transform", "top", "right", "bottom", "left"].some(function(property) {
12356
+ return transitionProperty.indexOf(property) >= 0;
12357
+ })) {
12358
+ console.warn(["Popper: Detected CSS transitions on at least one of the following", 'CSS properties: "transform", "top", "right", "bottom", "left".', "\n\n", 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', "for smooth transitions, or remove these properties from the CSS", "transition declaration on the popper element if only transitioning", "opacity or background-color for example.", "\n\n", "We recommend using the popper element as a wrapper around an inner", "element that can have any CSS property transitioned for animations."].join(" "));
12359
+ }
12360
+ }
12361
+ var commonStyles = {
12362
+ placement: getBasePlacement(state.placement),
12363
+ variation: getVariation(state.placement),
12364
+ popper: state.elements.popper,
12365
+ popperRect: state.rects.popper,
12366
+ gpuAcceleration,
12367
+ isFixed: state.options.strategy === "fixed"
12368
+ };
12369
+ if (state.modifiersData.popperOffsets != null) {
12370
+ state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
12371
+ offsets: state.modifiersData.popperOffsets,
12372
+ position: state.options.strategy,
12373
+ adaptive,
12374
+ roundOffsets
12375
+ })));
12376
+ }
12377
+ if (state.modifiersData.arrow != null) {
12378
+ state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
12379
+ offsets: state.modifiersData.arrow,
12380
+ position: "absolute",
12381
+ adaptive: false,
12382
+ roundOffsets
12383
+ })));
12384
+ }
12385
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
12386
+ "data-popper-placement": state.placement
12387
+ });
12388
+ }
12389
+ const computeStyles$1 = {
12390
+ name: "computeStyles",
12391
+ enabled: true,
12392
+ phase: "beforeWrite",
12393
+ fn: computeStyles,
12394
+ data: {}
12395
+ };
12268
12396
  function getHTMLElementScroll(element) {
12269
12397
  return {
12270
12398
  scrollLeft: element.scrollLeft,
@@ -12707,134 +12835,6 @@ const popperOffsets$1 = {
12707
12835
  fn: popperOffsets,
12708
12836
  data: {}
12709
12837
  };
12710
- var unsetSides = {
12711
- top: "auto",
12712
- right: "auto",
12713
- bottom: "auto",
12714
- left: "auto"
12715
- };
12716
- function roundOffsetsByDPR(_ref) {
12717
- var x = _ref.x, y = _ref.y;
12718
- var win = window;
12719
- var dpr = win.devicePixelRatio || 1;
12720
- return {
12721
- x: round(x * dpr) / dpr || 0,
12722
- y: round(y * dpr) / dpr || 0
12723
- };
12724
- }
12725
- function mapToStyles(_ref2) {
12726
- var _Object$assign2;
12727
- var popper2 = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, variation = _ref2.variation, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive, roundOffsets = _ref2.roundOffsets, isFixed = _ref2.isFixed;
12728
- var _offsets$x = offsets.x, x = _offsets$x === void 0 ? 0 : _offsets$x, _offsets$y = offsets.y, y = _offsets$y === void 0 ? 0 : _offsets$y;
12729
- var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
12730
- x,
12731
- y
12732
- }) : {
12733
- x,
12734
- y
12735
- };
12736
- x = _ref3.x;
12737
- y = _ref3.y;
12738
- var hasX = offsets.hasOwnProperty("x");
12739
- var hasY = offsets.hasOwnProperty("y");
12740
- var sideX = left;
12741
- var sideY = top;
12742
- var win = window;
12743
- if (adaptive) {
12744
- var offsetParent = getOffsetParent(popper2);
12745
- var heightProp = "clientHeight";
12746
- var widthProp = "clientWidth";
12747
- if (offsetParent === getWindow(popper2)) {
12748
- offsetParent = getDocumentElement(popper2);
12749
- if (getComputedStyle(offsetParent).position !== "static" && position === "absolute") {
12750
- heightProp = "scrollHeight";
12751
- widthProp = "scrollWidth";
12752
- }
12753
- }
12754
- offsetParent = offsetParent;
12755
- if (placement === top || (placement === left || placement === right) && variation === end) {
12756
- sideY = bottom;
12757
- var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : (
12758
- // $FlowFixMe[prop-missing]
12759
- offsetParent[heightProp]
12760
- );
12761
- y -= offsetY - popperRect.height;
12762
- y *= gpuAcceleration ? 1 : -1;
12763
- }
12764
- if (placement === left || (placement === top || placement === bottom) && variation === end) {
12765
- sideX = right;
12766
- var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : (
12767
- // $FlowFixMe[prop-missing]
12768
- offsetParent[widthProp]
12769
- );
12770
- x -= offsetX - popperRect.width;
12771
- x *= gpuAcceleration ? 1 : -1;
12772
- }
12773
- }
12774
- var commonStyles = Object.assign({
12775
- position
12776
- }, adaptive && unsetSides);
12777
- var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
12778
- x,
12779
- y
12780
- }) : {
12781
- x,
12782
- y
12783
- };
12784
- x = _ref4.x;
12785
- y = _ref4.y;
12786
- if (gpuAcceleration) {
12787
- var _Object$assign;
12788
- return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? "0" : "", _Object$assign[sideX] = hasX ? "0" : "", _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
12789
- }
12790
- return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
12791
- }
12792
- function computeStyles(_ref5) {
12793
- var state = _ref5.state, options = _ref5.options;
12794
- var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
12795
- if (process.env.NODE_ENV !== "production") {
12796
- var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || "";
12797
- if (adaptive && ["transform", "top", "right", "bottom", "left"].some(function(property) {
12798
- return transitionProperty.indexOf(property) >= 0;
12799
- })) {
12800
- console.warn(["Popper: Detected CSS transitions on at least one of the following", 'CSS properties: "transform", "top", "right", "bottom", "left".', "\n\n", 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', "for smooth transitions, or remove these properties from the CSS", "transition declaration on the popper element if only transitioning", "opacity or background-color for example.", "\n\n", "We recommend using the popper element as a wrapper around an inner", "element that can have any CSS property transitioned for animations."].join(" "));
12801
- }
12802
- }
12803
- var commonStyles = {
12804
- placement: getBasePlacement(state.placement),
12805
- variation: getVariation(state.placement),
12806
- popper: state.elements.popper,
12807
- popperRect: state.rects.popper,
12808
- gpuAcceleration,
12809
- isFixed: state.options.strategy === "fixed"
12810
- };
12811
- if (state.modifiersData.popperOffsets != null) {
12812
- state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
12813
- offsets: state.modifiersData.popperOffsets,
12814
- position: state.options.strategy,
12815
- adaptive,
12816
- roundOffsets
12817
- })));
12818
- }
12819
- if (state.modifiersData.arrow != null) {
12820
- state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
12821
- offsets: state.modifiersData.arrow,
12822
- position: "absolute",
12823
- adaptive: false,
12824
- roundOffsets
12825
- })));
12826
- }
12827
- state.attributes.popper = Object.assign({}, state.attributes.popper, {
12828
- "data-popper-placement": state.placement
12829
- });
12830
- }
12831
- const computeStyles$1 = {
12832
- name: "computeStyles",
12833
- enabled: true,
12834
- phase: "beforeWrite",
12835
- fn: computeStyles,
12836
- data: {}
12837
- };
12838
12838
  function applyStyles(_ref) {
12839
12839
  var state = _ref.state;
12840
12840
  Object.keys(state.elements).forEach(function(name) {
@@ -13146,6 +13146,8 @@ function usePopover(options) {
13146
13146
  options: {
13147
13147
  offset: [skidding, distance]
13148
13148
  }
13149
+ }), _extends$9({}, computeStyles$1, {
13150
+ enabled: show.value
13149
13151
  })];
13150
13152
  return {
13151
13153
  placement,
@@ -17075,6 +17077,9 @@ var props$s = {
17075
17077
  type: Boolean,
17076
17078
  default: true
17077
17079
  },
17080
+ popoverClass: {
17081
+ type: String
17082
+ },
17078
17083
  closeOnClickReference: {
17079
17084
  type: Boolean,
17080
17085
  default: false
@@ -17122,7 +17127,7 @@ function __render__$x(_ctx, _cache) {
17122
17127
  zIndex: _ctx.zIndex,
17123
17128
  width: _ctx.sameWidth ? _ctx.toSizeUnit(Math.ceil(_ctx.hostSize.width)) : void 0
17124
17129
  }),
17125
- class: vue.normalizeClass(_ctx.classes(_ctx.n("menu"), _ctx.n("$--box"), [_ctx.defaultStyle, _ctx.n("--menu-background-color")], [_ctx.defaultStyle, _ctx.formatElevation(_ctx.elevation, 3)])),
17130
+ class: vue.normalizeClass(_ctx.classes(_ctx.n("menu"), _ctx.n("$--box"), _ctx.popoverClass, [_ctx.defaultStyle, _ctx.n("--menu-background-color")], [_ctx.defaultStyle, _ctx.formatElevation(_ctx.elevation, 3)])),
17126
17131
  onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
17127
17132
  }, ["stop"])),
17128
17133
  onMouseenter: _cache[1] || (_cache[1] = function() {
@@ -17306,7 +17311,9 @@ var __sfc__$x = vue.defineComponent({
17306
17311
  computeLabel
17307
17312
  } = select2;
17308
17313
  var handleClick = () => {
17309
- optionSelected.value = !optionSelected.value;
17314
+ if (multiple.value) {
17315
+ optionSelected.value = !optionSelected.value;
17316
+ }
17310
17317
  onSelect(optionProvider);
17311
17318
  };
17312
17319
  var handleSelect = () => onSelect(optionProvider);
@@ -20237,6 +20244,7 @@ function __render__$f(_ctx, _cache) {
20237
20244
  show: _ctx.showMenu,
20238
20245
  "onUpdate:show": _cache[1] || (_cache[1] = ($event) => _ctx.showMenu = $event),
20239
20246
  class: vue.normalizeClass(_ctx.n("menu")),
20247
+ "popover-class": _ctx.variant === "standard" && _ctx.hint ? _ctx.n("--standard-menu-margin") : void 0,
20240
20248
  "offset-y": _ctx.offsetY,
20241
20249
  disabled: _ctx.formReadonly || _ctx.readonly || _ctx.formDisabled || _ctx.disabled,
20242
20250
  placement: _ctx.placement,
@@ -20247,7 +20255,7 @@ function __render__$f(_ctx, _cache) {
20247
20255
  "div",
20248
20256
  {
20249
20257
  ref: "menuEl",
20250
- class: vue.normalizeClass(_ctx.classes(_ctx.n("scroller"), _ctx.n("--scroller-" + _ctx.variant), _ctx.n("$-elevation--3"), [!_ctx.hint, _ctx.n("--scroller-non-hint")]))
20258
+ class: vue.normalizeClass(_ctx.classes(_ctx.n("scroller"), _ctx.n("$-elevation--3")))
20251
20259
  },
20252
20260
  [vue.renderSlot(_ctx.$slots, "default")],
20253
20261
  2
@@ -20353,7 +20361,7 @@ function __render__$f(_ctx, _cache) {
20353
20361
  ))]) : vue.createCommentVNode("v-if", true)],
20354
20362
  2
20355
20363
  /* CLASS */
20356
- ), _ctx.useCustomPlaceholder ? (vue.openBlock(), vue.createElementBlock(
20364
+ ), _ctx.enableCustomPlaceholder ? (vue.openBlock(), vue.createElementBlock(
20357
20365
  "span",
20358
20366
  {
20359
20367
  key: 0,
@@ -20388,7 +20396,7 @@ function __render__$f(_ctx, _cache) {
20388
20396
  )]),
20389
20397
  _: 3
20390
20398
  /* FORWARDED */
20391
- }, 8, ["show", "class", "offset-y", "disabled", "placement", "onClickOutside"]), vue.createVNode(_component_var_form_details, {
20399
+ }, 8, ["show", "class", "popover-class", "offset-y", "disabled", "placement", "onClickOutside"]), vue.createVNode(_component_var_form_details, {
20392
20400
  "error-message": _ctx.errorMessage,
20393
20401
  onClick: _cache[2] || (_cache[2] = vue.withModifiers(() => {
20394
20402
  }, ["stop"]))
@@ -20452,7 +20460,7 @@ var __sfc__$g = vue.defineComponent({
20452
20460
  }
20453
20461
  return blurColor || "var(--field-decorator-blur-color)";
20454
20462
  });
20455
- var useCustomPlaceholder = vue.computed(() => !props2.hint && isEmpty(props2.modelValue) && !isFocus.value);
20463
+ var enableCustomPlaceholder = vue.computed(() => !props2.hint && isEmpty(props2.modelValue));
20456
20464
  var computeLabel = () => {
20457
20465
  var {
20458
20466
  multiple: multiple2,
@@ -20674,7 +20682,7 @@ var __sfc__$g = vue.defineComponent({
20674
20682
  placement,
20675
20683
  cursor,
20676
20684
  placeholderColor,
20677
- useCustomPlaceholder,
20685
+ enableCustomPlaceholder,
20678
20686
  n: n$h,
20679
20687
  classes: classes$d,
20680
20688
  handleFocus,
@@ -25201,7 +25209,7 @@ const TimePickerSfc = "";
25201
25209
  const TooltipSfc = "";
25202
25210
  const uploader = "";
25203
25211
  const UploaderSfc = "";
25204
- const version = "2.13.0";
25212
+ const version = "2.13.1-alpha.1689619056304";
25205
25213
  function install(app) {
25206
25214
  ActionSheet.install && app.use(ActionSheet);
25207
25215
  AppBar.install && app.use(AppBar);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/ui",
3
- "version": "2.13.0",
3
+ "version": "2.13.1-alpha.1689619056304",
4
4
  "description": "A material like components library",
5
5
  "main": "lib/varlet.cjs.js",
6
6
  "module": "es/index.mjs",
@@ -46,9 +46,9 @@
46
46
  "@popperjs/core": "^2.11.6",
47
47
  "dayjs": "^1.10.4",
48
48
  "decimal.js": "^10.2.1",
49
- "@varlet/icons": "2.13.0",
50
- "@varlet/shared": "2.13.0",
51
- "@varlet/use": "2.13.0"
49
+ "@varlet/icons": "2.13.1-alpha.1689619056304",
50
+ "@varlet/shared": "2.13.1-alpha.1689619056304",
51
+ "@varlet/use": "2.13.1-alpha.1689619056304"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@vue/runtime-core": "3.3.4",
@@ -63,8 +63,8 @@
63
63
  "typescript": "^5.1.5",
64
64
  "vue": "3.3.4",
65
65
  "vue-router": "4.2.0",
66
- "@varlet/cli": "2.13.0",
67
- "@varlet/touch-emulator": "2.13.0"
66
+ "@varlet/touch-emulator": "2.13.1-alpha.1689619056304",
67
+ "@varlet/cli": "2.13.1-alpha.1689619056304"
68
68
  },
69
69
  "browserslist": [
70
70
  "Chrome >= 54",
package/types/menu.d.ts CHANGED
@@ -31,6 +31,7 @@ export interface MenuProps extends BasicAttributes {
31
31
  sameWidth?: boolean
32
32
  elevation?: boolean | number | string
33
33
  defaultStyle?: boolean
34
+ popoverClass?: string
34
35
  closeOnClickReference?: boolean
35
36
  onOpen?: ListenerProp<() => void>
36
37
  onOpened?: ListenerProp<() => void>