@citizenplane/pimp 8.0.1 → 8.0.2

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/dist/pimp.es.js CHANGED
@@ -201,7 +201,7 @@ var v = function() {
201
201
  }(e2, n3 && n3.inputType || null));
202
202
  } }]) && t(r2.prototype, i2), n2;
203
203
  }();
204
- var d, h = (d = new WeakMap(), function(e2, t2) {
204
+ var d, h = (d = /* @__PURE__ */ new WeakMap(), function(e2, t2) {
205
205
  t2.value && (d.has(e2) && !function(e3) {
206
206
  return !(f(e3.value) && e3.value === e3.oldValue || Array.isArray(e3.value) && JSON.stringify(e3.value) === JSON.stringify(e3.oldValue) || e3.value && e3.value.mask && e3.oldValue && e3.oldValue.mask && e3.value.mask === e3.oldValue.mask);
207
207
  }(t2) || d.set(e2, new v(e2, function(e3) {
@@ -4043,13 +4043,13 @@ function friendlyDateTime(dateTimeish) {
4043
4043
  const randomString = () => {
4044
4044
  return `_${Math.random().toString(36).substr(2, 9)}`;
4045
4045
  };
4046
- const formatDates = function formatDates2(dateOne, dateTwo, format) {
4046
+ const formatDates = function formatDates2({ dateOne, dateTwo, format, locale }) {
4047
4047
  let formattedDates = "";
4048
4048
  if (dateOne) {
4049
- formattedDates = DateTime.fromISO(dateOne).toFormat(format);
4049
+ formattedDates = DateTime.fromISO(dateOne).toFormat(format, { locale });
4050
4050
  }
4051
4051
  if (dateTwo) {
4052
- formattedDates += " - " + DateTime.fromISO(dateTwo).toFormat(format);
4052
+ formattedDates += " - " + DateTime.fromISO(dateTwo).toFormat(format, { locale });
4053
4053
  }
4054
4054
  return formattedDates;
4055
4055
  };
@@ -4131,7 +4131,7 @@ function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
4131
4131
  ], 2);
4132
4132
  }
4133
4133
  var CpBadge = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$j]]);
4134
- var index_vue_vue_type_style_index_0_lang$7 = "";
4134
+ var index_vue_vue_type_style_index_0_lang$8 = "";
4135
4135
  const headingLevels = ["h1", "h2", "h3", "h4", "h5", "h6"];
4136
4136
  const sizes = [100, 200, 300, 400, 500, 600, 700, 800, 900];
4137
4137
  const _sfc_main$j = {
@@ -4202,7 +4202,7 @@ const _hoisted_1$f = {
4202
4202
  "xml:space": "preserve"
4203
4203
  };
4204
4204
  const _hoisted_2$e = ["fill"];
4205
- const _hoisted_3$b = ["fill"];
4205
+ const _hoisted_3$c = ["fill"];
4206
4206
  const _hoisted_4$b = /* @__PURE__ */ createElementVNode("animateTransform", {
4207
4207
  attributeType: "xml",
4208
4208
  attributeName: "transform",
@@ -4225,7 +4225,7 @@ function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
4225
4225
  createElementVNode("path", {
4226
4226
  fill: $props.color,
4227
4227
  d: "M26.013,10.047l1.654-2.866c-2.198-1.272-4.743-2.012-7.466-2.012h0v3.312h0 C22.32,8.481,24.301,9.057,26.013,10.047z"
4228
- }, _hoisted_5$9, 8, _hoisted_3$b)
4228
+ }, _hoisted_5$9, 8, _hoisted_3$c)
4229
4229
  ]);
4230
4230
  }
4231
4231
  var CpLoader = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$h]]);
@@ -4341,7 +4341,7 @@ const _hoisted_2$d = {
4341
4341
  key: 0,
4342
4342
  class: "cpButton__loader"
4343
4343
  };
4344
- const _hoisted_3$a = {
4344
+ const _hoisted_3$b = {
4345
4345
  key: 1,
4346
4346
  class: "cpButton__icon cpButton__icon--isBefore"
4347
4347
  };
@@ -4366,7 +4366,7 @@ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
4366
4366
  $props.isLoading ? (openBlock(), createElementBlock("span", _hoisted_2$d, [
4367
4367
  createVNode(_component_cp_loader, { color: "#B2B2BD" })
4368
4368
  ])) : createCommentVNode("", true),
4369
- $options.hasIconBefore ? (openBlock(), createElementBlock("span", _hoisted_3$a, [
4369
+ $options.hasIconBefore ? (openBlock(), createElementBlock("span", _hoisted_3$b, [
4370
4370
  renderSlot(_ctx.$slots, "icon-before")
4371
4371
  ])) : createCommentVNode("", true),
4372
4372
  $options.hasLabel ? (openBlock(), createElementBlock("span", _hoisted_4$a, [
@@ -4381,7 +4381,7 @@ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
4381
4381
  }, 8, ["type", "aria-disabled", "disabled", "class", "onClick"]);
4382
4382
  }
4383
4383
  var CpButton = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$g]]);
4384
- var CpDate_vue_vue_type_style_index_0_lang = "";
4384
+ var index_vue_vue_type_style_index_0_lang$7 = "";
4385
4385
  const HUMAN_MAX_AGE = 120;
4386
4386
  const _sfc_main$g = {
4387
4387
  props: {
@@ -4420,6 +4420,17 @@ const _sfc_main$g = {
4420
4420
  autocompleteBirthday: {
4421
4421
  type: Boolean,
4422
4422
  default: false
4423
+ },
4424
+ locale: {
4425
+ type: String,
4426
+ default: () => {
4427
+ return navigator.language;
4428
+ }
4429
+ },
4430
+ inputsOptions: {
4431
+ type: Object,
4432
+ default: () => {
4433
+ }
4423
4434
  }
4424
4435
  },
4425
4436
  emits: ["update:modelValue", "on-validation"],
@@ -4433,7 +4444,7 @@ const _sfc_main$g = {
4433
4444
  computed: {
4434
4445
  formattedLabel() {
4435
4446
  const requiredLabel = this.required && this.label ? "*" : "";
4436
- return `${this.label} ${requiredLabel}`;
4447
+ return `${capitalizeFirstLetter(this.label)} ${requiredLabel}`;
4437
4448
  },
4438
4449
  cpDateId() {
4439
4450
  return randomString();
@@ -4453,9 +4464,10 @@ const _sfc_main$g = {
4453
4464
  return date.daysInMonth;
4454
4465
  },
4455
4466
  months() {
4456
- return Info.months().map((month, index) => {
4467
+ const rawLocalizedMonths = Info.months("long", { locale: this.locale });
4468
+ return rawLocalizedMonths.map((month, index) => {
4457
4469
  return {
4458
- label: month,
4470
+ label: capitalizeFirstLetter(month),
4459
4471
  value: index + 1
4460
4472
  };
4461
4473
  });
@@ -4542,6 +4554,18 @@ const _sfc_main$g = {
4542
4554
  month: "bday-month",
4543
4555
  year: "bday-year"
4544
4556
  };
4557
+ },
4558
+ dayInputPlaceholder() {
4559
+ var _a;
4560
+ return ((_a = this.inputsOptions) == null ? void 0 : _a.dayInputPlaceholder) || "DD";
4561
+ },
4562
+ monthInputPlaceholder() {
4563
+ var _a;
4564
+ return ((_a = this.inputsOptions) == null ? void 0 : _a.monthInputPlaceholder) || "Months";
4565
+ },
4566
+ yearInputPlaceholder() {
4567
+ var _a;
4568
+ return ((_a = this.inputsOptions) == null ? void 0 : _a.yearInputPlaceholder) || "YYYY";
4545
4569
  }
4546
4570
  },
4547
4571
  watch: {
@@ -4569,13 +4593,13 @@ const _sfc_main$g = {
4569
4593
  };
4570
4594
  const _hoisted_1$d = ["for"];
4571
4595
  const _hoisted_2$c = { class: "cpDate__inputs" };
4572
- const _hoisted_3$9 = ["required", "disabled", "autocomplete"];
4596
+ const _hoisted_3$a = ["placeholder", "required", "disabled", "autocomplete"];
4573
4597
  const _hoisted_4$9 = /* @__PURE__ */ createElementVNode("div", { class: "cpDate__divider" }, null, -1);
4574
4598
  const _hoisted_5$7 = ["id", "required", "disabled", "autocomplete"];
4575
- const _hoisted_6$6 = /* @__PURE__ */ createElementVNode("option", { value: "" }, "Month", -1);
4599
+ const _hoisted_6$6 = { value: "" };
4576
4600
  const _hoisted_7$5 = ["value"];
4577
4601
  const _hoisted_8$4 = /* @__PURE__ */ createElementVNode("div", { class: "cpDate__divider" }, null, -1);
4578
- const _hoisted_9$4 = ["disabled", "required", "autocomplete"];
4602
+ const _hoisted_9$4 = ["placeholder", "disabled", "required", "autocomplete"];
4579
4603
  const _hoisted_10$4 = {
4580
4604
  key: 0,
4581
4605
  class: "cpDate__errorMessage"
@@ -4601,14 +4625,14 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
4601
4625
  createElementVNode("div", _hoisted_2$c, [
4602
4626
  withDirectives(createElementVNode("input", {
4603
4627
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.day = $event),
4604
- placeholder: "DD",
4628
+ placeholder: $options.dayInputPlaceholder,
4605
4629
  class: "cpDate__day",
4606
4630
  inputmode: "numeric",
4607
4631
  maxlength: "2",
4608
4632
  required: $props.required,
4609
4633
  disabled: $props.disabled,
4610
4634
  autocomplete: $options.autocompleteFields.day
4611
- }, null, 8, _hoisted_3$9), [
4635
+ }, null, 8, _hoisted_3$a), [
4612
4636
  [vModelText, $data.day],
4613
4637
  [_directive_maska, "##"]
4614
4638
  ]),
@@ -4623,7 +4647,7 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
4623
4647
  disabled: $props.disabled,
4624
4648
  autocomplete: $options.autocompleteFields.month
4625
4649
  }, [
4626
- _hoisted_6$6,
4650
+ createElementVNode("option", _hoisted_6$6, toDisplayString($options.monthInputPlaceholder), 1),
4627
4651
  (openBlock(true), createElementBlock(Fragment, null, renderList($options.months, (monthItem, index) => {
4628
4652
  return openBlock(), createElementBlock("option", {
4629
4653
  key: index,
@@ -4637,7 +4661,7 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
4637
4661
  _hoisted_8$4,
4638
4662
  withDirectives(createElementVNode("input", {
4639
4663
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => $data.year = $event),
4640
- placeholder: "YYYY",
4664
+ placeholder: $options.yearInputPlaceholder,
4641
4665
  class: "cpDate__year",
4642
4666
  inputmode: "numeric",
4643
4667
  maxlength: "4",
@@ -4739,7 +4763,7 @@ var feather$2 = { exports: {} };
4739
4763
  var classNames = function() {
4740
4764
  function StorageObject() {
4741
4765
  }
4742
- StorageObject.prototype = Object.create(null);
4766
+ StorageObject.prototype = /* @__PURE__ */ Object.create(null);
4743
4767
  function _parseArray(resultSet, array) {
4744
4768
  var length = array.length;
4745
4769
  for (var i2 = 0; i2 < length; ++i2) {
@@ -6274,6 +6298,12 @@ const _sfc_main$e = {
6274
6298
  type: Boolean,
6275
6299
  default: false
6276
6300
  },
6301
+ locale: {
6302
+ type: String,
6303
+ default: () => {
6304
+ return navigator.language;
6305
+ }
6306
+ },
6277
6307
  isTest: {
6278
6308
  type: Boolean,
6279
6309
  default: () => false
@@ -6307,9 +6337,9 @@ const _sfc_main$e = {
6307
6337
  hoveredInRange: "#67f6ee"
6308
6338
  },
6309
6339
  sundayFirst: false,
6310
- monthNames: Info.months("long", { locale: "eng" }),
6311
- days: Info.weekdaysFormat("long", { locale: "eng" }),
6312
- daysShort: Info.weekdaysFormat("short", { locale: "eng" }),
6340
+ monthNames: Info.months("long", { locale: this.locale }),
6341
+ days: Info.weekdaysFormat("long", { locale: this.locale }),
6342
+ daysShort: Info.weekdaysFormat("short", { locale: this.locale }),
6313
6343
  texts: {
6314
6344
  apply: "Apply",
6315
6345
  cancel: "Cancel",
@@ -6959,7 +6989,7 @@ const _hoisted_2$b = {
6959
6989
  key: 0,
6960
6990
  class: "asd__mobile-header asd__mobile-only"
6961
6991
  };
6962
- const _hoisted_3$8 = {
6992
+ const _hoisted_3$9 = {
6963
6993
  key: 1,
6964
6994
  class: "asd__mobile-close-icon"
6965
6995
  };
@@ -6997,7 +7027,7 @@ function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
6997
7027
  type: "button",
6998
7028
  onClick: _cache[0] || (_cache[0] = (...args) => $options.closeDatepicker && $options.closeDatepicker(...args))
6999
7029
  }, [
7000
- _ctx.$slots["close-icon"] ? renderSlot(_ctx.$slots, "close-icon", { key: 0 }) : (openBlock(), createElementBlock("div", _hoisted_3$8, "X"))
7030
+ _ctx.$slots["close-icon"] ? renderSlot(_ctx.$slots, "close-icon", { key: 0 }) : (openBlock(), createElementBlock("div", _hoisted_3$9, "X"))
7001
7031
  ]),
7002
7032
  createElementVNode("h3", null, toDisplayString($props.mobileHeader || $options.mobileHeaderFallback), 1)
7003
7033
  ])) : createCommentVNode("", true),
@@ -7341,7 +7371,7 @@ const _hoisted_2$a = {
7341
7371
  key: 0,
7342
7372
  class: "cpInput__icon cpInput__icon--isBefore"
7343
7373
  };
7344
- const _hoisted_3$7 = {
7374
+ const _hoisted_3$8 = {
7345
7375
  key: 2,
7346
7376
  class: "cpInput__icon cpInput__icon--isAfter"
7347
7377
  };
@@ -7390,7 +7420,7 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
7390
7420
  _: 1
7391
7421
  })
7392
7422
  ], 2)) : createCommentVNode("", true),
7393
- $options.hasAfterIcon ? (openBlock(), createElementBlock("div", _hoisted_3$7, [
7423
+ $options.hasAfterIcon ? (openBlock(), createElementBlock("div", _hoisted_3$8, [
7394
7424
  renderSlot(_ctx.$slots, "input-icon-after")
7395
7425
  ])) : createCommentVNode("", true),
7396
7426
  withDirectives(createElementVNode("input", mergeProps({
@@ -7498,6 +7528,12 @@ const _sfc_main$a = {
7498
7528
  singleMonth: {
7499
7529
  type: Boolean,
7500
7530
  default: false
7531
+ },
7532
+ locale: {
7533
+ type: String,
7534
+ default: () => {
7535
+ return navigator.language;
7536
+ }
7501
7537
  }
7502
7538
  },
7503
7539
  emits: ["dates"],
@@ -7513,7 +7549,14 @@ const _sfc_main$a = {
7513
7549
  },
7514
7550
  computed: {
7515
7551
  inputComputedValue() {
7516
- return this.inputValue || formatDates(this.dateOne, this.dateTwo, this.humanFormat);
7552
+ if (this.inputValue)
7553
+ return this.inputValue;
7554
+ return formatDates({
7555
+ dateOne: this.dateOne,
7556
+ dateTwo: this.dateTwo,
7557
+ format: this.humanFormat,
7558
+ locale: this.locale
7559
+ });
7517
7560
  },
7518
7561
  numberOfMonths() {
7519
7562
  return this.singleMonth ? 1 : 2;
@@ -7573,12 +7616,13 @@ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
7573
7616
  "months-to-show": $options.numberOfMonths,
7574
7617
  "min-date": $options.computedMinDate,
7575
7618
  "max-date": $props.maxDate,
7619
+ locale: $props.locale,
7576
7620
  class: normalizeClass(["cpDatepicker__datepicker", { "cpDatepicker__datepicker--isInline": $props.isInline }]),
7577
7621
  onDateOneSelected: _cache[0] || (_cache[0] = (date) => $options.selectDate("dateOne", date)),
7578
7622
  onDateTwoSelected: _cache[1] || (_cache[1] = (date) => $options.selectDate("dateTwo", date)),
7579
7623
  onOpened: _cache[2] || (_cache[2] = () => $data.isDisabled = true),
7580
7624
  onClosed: _cache[3] || (_cache[3] = () => $data.isDisabled = null)
7581
- }, null, 8, ["date-one", "date-two", "trigger-element-id", "close-after-select", "mode", "inline", "months-to-show", "min-date", "max-date", "class"])
7625
+ }, null, 8, ["date-one", "date-two", "trigger-element-id", "close-after-select", "mode", "inline", "months-to-show", "min-date", "max-date", "locale", "class"])
7582
7626
  ]);
7583
7627
  }
7584
7628
  var CpDatepicker = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$a]]);
@@ -7618,6 +7662,12 @@ const _sfc_main$9 = {
7618
7662
  validator: (value) => {
7619
7663
  return value === "" || value.length === 10;
7620
7664
  }
7665
+ },
7666
+ locale: {
7667
+ type: String,
7668
+ default: () => {
7669
+ return navigator.language;
7670
+ }
7621
7671
  }
7622
7672
  },
7623
7673
  emits: ["dates"],
@@ -7670,7 +7720,7 @@ const _sfc_main$9 = {
7670
7720
  this.triggerCalendar = !this.triggerCalendar;
7671
7721
  },
7672
7722
  humanDateFormat(dateOne, dateTwo) {
7673
- return formatDates(dateOne, dateTwo, this.humanFormat);
7723
+ return formatDates({ dateOne, dateTwo, format: this.humanFormat, locale: this.locale });
7674
7724
  },
7675
7725
  toggleDay(index) {
7676
7726
  this.days[index].selected = !this.days[index].selected;
@@ -7730,7 +7780,7 @@ const _hoisted_2$9 = {
7730
7780
  key: 0,
7731
7781
  class: "footer-container"
7732
7782
  };
7733
- const _hoisted_3$6 = {
7783
+ const _hoisted_3$7 = {
7734
7784
  key: "days",
7735
7785
  class: "asd__recurency--container"
7736
7786
  };
@@ -7779,6 +7829,7 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
7779
7829
  "close-after-select": $props.closeAfterSelect,
7780
7830
  "close-calendar": $data.triggerCalendar,
7781
7831
  inline: $data.isInline,
7832
+ locale: $props.locale,
7782
7833
  class: normalizeClass(["cpCalendar__datepicker", $options.dynamicClasses]),
7783
7834
  onDateOneSelected: _cache[1] || (_cache[1] = (date) => $options.selectDate("dateOne", date)),
7784
7835
  onDateTwoSelected: _cache[2] || (_cache[2] = (date) => $options.selectDate("dateTwo", date)),
@@ -7793,7 +7844,7 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
7793
7844
  mode: "out-in"
7794
7845
  }, {
7795
7846
  default: withCtx(() => [
7796
- $options.isDaysDisplayed ? (openBlock(), createElementBlock("div", _hoisted_3$6, [
7847
+ $options.isDaysDisplayed ? (openBlock(), createElementBlock("div", _hoisted_3$7, [
7797
7848
  createElementVNode("div", _hoisted_4$6, [
7798
7849
  createElementVNode("ul", _hoisted_5$5, [
7799
7850
  (openBlock(true), createElementBlock(Fragment, null, renderList($data.days, ({ day, selected, value }, index) => {
@@ -7865,7 +7916,7 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
7865
7916
  ])) : createCommentVNode("", true)
7866
7917
  ]),
7867
7918
  _: 1
7868
- }, 8, ["date-one", "date-two", "customized-dates", "trigger-element-id", "mode", "close-after-select", "close-calendar", "inline", "class"])
7919
+ }, 8, ["date-one", "date-two", "customized-dates", "trigger-element-id", "mode", "close-after-select", "close-calendar", "inline", "locale", "class"])
7869
7920
  ]);
7870
7921
  }
7871
7922
  var CpCalendar = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$9]]);
@@ -7930,8 +7981,9 @@ const _sfc_main$8 = {
7930
7981
  }
7931
7982
  }
7932
7983
  };
7933
- const _hoisted_1$8 = { class: "cpAlert__body" };
7934
- const _hoisted_2$8 = {
7984
+ const _hoisted_1$8 = { class: "cpAlert__icon" };
7985
+ const _hoisted_2$8 = { class: "cpAlert__body" };
7986
+ const _hoisted_3$6 = {
7935
7987
  key: 1,
7936
7988
  class: "cpAlert__content"
7937
7989
  };
@@ -7942,11 +7994,10 @@ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
7942
7994
  key: 0,
7943
7995
  class: normalizeClass(["cpAlert", `cpAlert--${$props.intent}`])
7944
7996
  }, [
7945
- createVNode(_component_cp_icon, {
7946
- type: $options.alertIcon,
7947
- class: "cpAlert__icon"
7948
- }, null, 8, ["type"]),
7949
7997
  createElementVNode("div", _hoisted_1$8, [
7998
+ createVNode(_component_cp_icon, { type: $options.alertIcon }, null, 8, ["type"])
7999
+ ]),
8000
+ createElementVNode("div", _hoisted_2$8, [
7950
8001
  $props.title ? (openBlock(), createBlock(_component_cp_heading, {
7951
8002
  key: 0,
7952
8003
  "heading-level": "h4",
@@ -7958,7 +8009,7 @@ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
7958
8009
  ]),
7959
8010
  _: 1
7960
8011
  })) : createCommentVNode("", true),
7961
- $options.hasContent ? (openBlock(), createElementBlock("div", _hoisted_2$8, [
8012
+ $options.hasContent ? (openBlock(), createElementBlock("div", _hoisted_3$6, [
7962
8013
  renderSlot(_ctx.$slots, "default")
7963
8014
  ])) : createCommentVNode("", true)
7964
8015
  ]),
@@ -8746,7 +8797,7 @@ function getElementTransforms(el) {
8746
8797
  }
8747
8798
  var str = el.style.transform || "";
8748
8799
  var reg = /(\w+)\(([^)]*)\)/g;
8749
- var transforms = new Map();
8800
+ var transforms = /* @__PURE__ */ new Map();
8750
8801
  var m;
8751
8802
  while (m = reg.exec(str)) {
8752
8803
  transforms.set(m[1], m[2]);