@fkui/vue 5.45.1 → 5.46.1

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.
@@ -5532,6 +5532,9 @@ const _sfc_main$12 = vue.defineComponent({
5532
5532
  };
5533
5533
  },
5534
5534
  computed: {
5535
+ ariaLabel() {
5536
+ return `${this.value.monthName} ${this.value.year}`;
5537
+ },
5535
5538
  totalCols() {
5536
5539
  return this.hideWeekNumbers ? 7 : 8;
5537
5540
  },
@@ -5573,50 +5576,43 @@ const _sfc_main$12 = vue.defineComponent({
5573
5576
  }
5574
5577
  }
5575
5578
  });
5576
- const _hoisted_1$O = {
5579
+ const _hoisted_1$O = ["aria-label"];
5580
+ const _hoisted_2$A = {
5577
5581
  key: 0,
5578
5582
  class: "calendar-month__col--week"
5579
5583
  };
5580
- const _hoisted_2$A = {
5581
- role: "presentation"
5582
- };
5583
5584
  const _hoisted_3$s = {
5584
- role: "presentation"
5585
- };
5586
- const _hoisted_4$n = {
5587
5585
  key: 0,
5588
5586
  scope: "col",
5589
5587
  "aria-hidden": "true",
5590
5588
  class: "calendar-month__header-cell"
5591
5589
  };
5592
- const _hoisted_5$i = ["title"];
5593
- const _hoisted_6$e = {
5594
- role: "presentation"
5595
- };
5596
- const _hoisted_7$d = {
5590
+ const _hoisted_4$n = ["title"];
5591
+ const _hoisted_5$i = {
5597
5592
  key: 0,
5598
5593
  class: "calendar-month__cell calendar-month__cell--week-number",
5599
5594
  "aria-hidden": "true"
5600
5595
  };
5601
- const _hoisted_8$8 = ["colspan"];
5602
- const _hoisted_9$5 = ["colspan"];
5603
- const _hoisted_10$3 = {
5596
+ const _hoisted_6$e = ["colspan"];
5597
+ const _hoisted_7$d = ["colspan"];
5598
+ const _hoisted_8$8 = {
5604
5599
  key: 0,
5605
5600
  "aria-hidden": "true"
5606
5601
  };
5607
- const _hoisted_11$2 = ["colspan"];
5608
- const _hoisted_12$2 = {
5602
+ const _hoisted_9$5 = ["colspan"];
5603
+ const _hoisted_10$3 = {
5609
5604
  key: 1,
5610
5605
  "aria-hidden": "true"
5611
5606
  };
5612
- const _hoisted_13$1 = ["colspan"];
5607
+ const _hoisted_11$2 = ["colspan"];
5613
5608
  function _sfc_render$Q(_ctx, _cache, $props, $setup, $data, $options) {
5614
5609
  return vue.openBlock(), vue.createElementBlock("table", {
5615
5610
  class: "calendar-month__table",
5616
- role: "application",
5611
+ role: "grid",
5612
+ "aria-label": _ctx.ariaLabel,
5617
5613
  onFocusin: _cache[0] || (_cache[0] = (...args) => _ctx.onFocusin && _ctx.onFocusin(...args)),
5618
5614
  onFocusout: _cache[1] || (_cache[1] = (...args) => _ctx.onFocusout && _ctx.onFocusout(...args))
5619
- }, [vue.createElementVNode("colgroup", null, [!_ctx.internalHideWeekNumbers ? (vue.openBlock(), vue.createElementBlock("col", _hoisted_1$O)) : vue.createCommentVNode("", true), _cache[2] || (_cache[2] = vue.createTextVNode()), _cache[3] || (_cache[3] = vue.createElementVNode("col", {
5615
+ }, [vue.createElementVNode("colgroup", null, [!_ctx.internalHideWeekNumbers ? (vue.openBlock(), vue.createElementBlock("col", _hoisted_2$A)) : vue.createCommentVNode("", true), _cache[2] || (_cache[2] = vue.createTextVNode()), _cache[3] || (_cache[3] = vue.createElementVNode("col", {
5620
5616
  class: "calendar-month__col--day"
5621
5617
  }, null, -1)), _cache[4] || (_cache[4] = vue.createTextVNode()), _cache[5] || (_cache[5] = vue.createElementVNode("col", {
5622
5618
  class: "calendar-month__col--day"
@@ -5630,26 +5626,23 @@ function _sfc_render$Q(_ctx, _cache, $props, $setup, $data, $options) {
5630
5626
  class: "calendar-month__col--day"
5631
5627
  }, null, -1)), _cache[14] || (_cache[14] = vue.createTextVNode()), _cache[15] || (_cache[15] = vue.createElementVNode("col", {
5632
5628
  class: "calendar-month__col--day"
5633
- }, null, -1))]), _cache[22] || (_cache[22] = vue.createTextVNode()), vue.createElementVNode("thead", _hoisted_2$A, [vue.createElementVNode("tr", _hoisted_3$s, [!_ctx.internalHideWeekNumbers ? (vue.openBlock(), vue.createElementBlock("th", _hoisted_4$n)) : vue.createCommentVNode("", true), _cache[16] || (_cache[16] = vue.createTextVNode()), (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.weekdays, (weekday) => {
5629
+ }, null, -1))]), _cache[22] || (_cache[22] = vue.createTextVNode()), vue.createElementVNode("thead", null, [vue.createElementVNode("tr", null, [!_ctx.internalHideWeekNumbers ? (vue.openBlock(), vue.createElementBlock("th", _hoisted_3$s)) : vue.createCommentVNode("", true), _cache[16] || (_cache[16] = vue.createTextVNode()), (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.weekdays, (weekday) => {
5634
5630
  return vue.openBlock(), vue.createElementBlock("th", {
5635
5631
  key: weekday.name,
5636
5632
  scope: "col",
5637
- role: "presentation",
5638
5633
  class: "calendar-month__header-cell"
5639
5634
  }, [vue.createElementVNode("abbr", {
5640
- "aria-hidden": "true",
5641
5635
  title: weekday.name
5642
- }, vue.toDisplayString(_ctx.showShortWeekdays ? weekday.shortName : weekday.name), 9, _hoisted_5$i)]);
5643
- }), 128))])]), _cache[23] || (_cache[23] = vue.createTextVNode()), vue.createElementVNode("tbody", _hoisted_6$e, [(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.weeks, (week) => {
5636
+ }, vue.toDisplayString(_ctx.showShortWeekdays ? weekday.shortName : weekday.name), 9, _hoisted_4$n)]);
5637
+ }), 128))])]), _cache[23] || (_cache[23] = vue.createTextVNode()), vue.createElementVNode("tbody", null, [(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.weeks, (week) => {
5644
5638
  return vue.openBlock(), vue.createElementBlock("tr", {
5645
- key: week.week,
5646
- role: "presentation"
5647
- }, [!_ctx.internalHideWeekNumbers ? (vue.openBlock(), vue.createElementBlock("td", _hoisted_7$d, vue.toDisplayString(week.week), 1)) : vue.createCommentVNode("", true), _cache[17] || (_cache[17] = vue.createTextVNode()), _ctx.getDayStartOffset(week.days) ? (vue.openBlock(), vue.createElementBlock("td", {
5639
+ key: week.week
5640
+ }, [!_ctx.internalHideWeekNumbers ? (vue.openBlock(), vue.createElementBlock("td", _hoisted_5$i, vue.toDisplayString(week.week), 1)) : vue.createCommentVNode("", true), _cache[17] || (_cache[17] = vue.createTextVNode()), _ctx.getDayStartOffset(week.days) ? (vue.openBlock(), vue.createElementBlock("td", {
5648
5641
  key: 1,
5649
5642
  class: "calendar-month__cell",
5650
5643
  colspan: _ctx.getDayStartOffset(week.days),
5651
5644
  "aria-hidden": "true"
5652
- }, null, 8, _hoisted_8$8)) : vue.createCommentVNode("", true), _cache[18] || (_cache[18] = vue.createTextVNode()), (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(week.days, (day) => {
5645
+ }, null, 8, _hoisted_6$e)) : vue.createCommentVNode("", true), _cache[18] || (_cache[18] = vue.createTextVNode()), (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(week.days, (day) => {
5653
5646
  return vue.openBlock(), vue.createElementBlock("td", {
5654
5647
  key: day.toString(),
5655
5648
  class: "calendar-month__cell",
@@ -5663,16 +5656,16 @@ function _sfc_render$Q(_ctx, _cache, $props, $setup, $data, $options) {
5663
5656
  class: "calendar-month__cell",
5664
5657
  colspan: _ctx.getDayEndOffset(week.days),
5665
5658
  "aria-hidden": "true"
5666
- }, null, 8, _hoisted_9$5)) : vue.createCommentVNode("", true)]);
5667
- }), 128)), _cache[20] || (_cache[20] = vue.createTextVNode()), _ctx.weeks.length < 5 ? (vue.openBlock(), vue.createElementBlock("tr", _hoisted_10$3, [vue.createElementVNode("td", {
5659
+ }, null, 8, _hoisted_7$d)) : vue.createCommentVNode("", true)]);
5660
+ }), 128)), _cache[20] || (_cache[20] = vue.createTextVNode()), _ctx.weeks.length < 5 ? (vue.openBlock(), vue.createElementBlock("tr", _hoisted_8$8, [vue.createElementVNode("td", {
5668
5661
  class: "calendar-month__cell",
5669
5662
  colspan: _ctx.totalCols,
5670
5663
  "aria-hidden": "true"
5671
- }, null, 8, _hoisted_11$2)])) : vue.createCommentVNode("", true), _cache[21] || (_cache[21] = vue.createTextVNode()), _ctx.weeks.length < 6 ? (vue.openBlock(), vue.createElementBlock("tr", _hoisted_12$2, [vue.createElementVNode("td", {
5664
+ }, null, 8, _hoisted_9$5)])) : vue.createCommentVNode("", true), _cache[21] || (_cache[21] = vue.createTextVNode()), _ctx.weeks.length < 6 ? (vue.openBlock(), vue.createElementBlock("tr", _hoisted_10$3, [vue.createElementVNode("td", {
5672
5665
  class: "calendar-month__cell",
5673
5666
  colspan: _ctx.totalCols,
5674
5667
  "aria-hidden": "true"
5675
- }, null, 8, _hoisted_13$1)])) : vue.createCommentVNode("", true)])], 32);
5668
+ }, null, 8, _hoisted_11$2)])) : vue.createCommentVNode("", true)])], 40, _hoisted_1$O);
5676
5669
  }
5677
5670
  const ICalendarMonthGrid = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["render", _sfc_render$Q]]);
5678
5671
  const DayStep = {
@@ -5745,6 +5738,11 @@ const _sfc_main$11 = vue.defineComponent({
5745
5738
  this.$emit("click", date2);
5746
5739
  },
5747
5740
  async onKeydownDay(date2, event) {
5741
+ if (event.code === "Enter" || event.code === "Space") {
5742
+ event.preventDefault();
5743
+ this.$emit("click", date2);
5744
+ return;
5745
+ }
5748
5746
  if (!isDayStepKey(event)) {
5749
5747
  return;
5750
5748
  }
@@ -5792,13 +5790,13 @@ function _sfc_render$P(_ctx, _cache, $props, $setup, $data, $options) {
5792
5790
  }, {
5793
5791
  default: vue.withCtx(({
5794
5792
  date: date2
5795
- }) => [vue.createElementVNode("button", {
5793
+ }) => [vue.createElementVNode("div", {
5796
5794
  ref: date2.toString(),
5795
+ role: "gridcell",
5797
5796
  class: "calendar-month__button",
5798
5797
  "data-test": "select-day-button",
5799
5798
  "data-date": date2.toString(),
5800
5799
  tabindex: _ctx.getTabindex(date2),
5801
- type: "button",
5802
5800
  onClick: vue.withModifiers(($event) => _ctx.onClickDay(date2), ["stop", "prevent"]),
5803
5801
  onKeydown: ($event) => _ctx.onKeydownDay(date2, $event)
5804
5802
  }, [vue.renderSlot(_ctx.$slots, "default", {
@@ -6006,9 +6004,7 @@ function useSlotUtils() {
6006
6004
  }
6007
6005
  };
6008
6006
  }
6009
- const _hoisted_1$K = {
6010
- class: "card card--default"
6011
- };
6007
+ const _hoisted_1$K = ["id"];
6012
6008
  const _hoisted_2$y = {
6013
6009
  key: 0,
6014
6010
  class: "card__header"
@@ -6022,16 +6018,91 @@ const _hoisted_4$m = {
6022
6018
  };
6023
6019
  const _sfc_main$_ = /* @__PURE__ */ vue.defineComponent({
6024
6020
  __name: "FCard",
6021
+ props: {
6022
+ /**
6023
+ * Element to focus on when card is invalid. Set when using validation.
6024
+ */
6025
+ focusRef: {
6026
+ type: Object,
6027
+ required: false,
6028
+ default: null
6029
+ },
6030
+ /**
6031
+ * Optional id (generated by default).
6032
+ */
6033
+ id: {
6034
+ type: String,
6035
+ required: false,
6036
+ default: () => logic.ElementIdService.generateElementId()
6037
+ }
6038
+ },
6025
6039
  setup(__props) {
6026
6040
  const {
6027
6041
  hasSlot: hasSlot2
6028
6042
  } = useSlotUtils();
6043
+ const validationMessage = vue.ref("");
6044
+ const hasError = vue.ref(false);
6045
+ const isMounted = vue.ref(false);
6029
6046
  const hasHeaderSlot = vue.computed(() => hasSlot2("header"));
6030
6047
  const hasFooterSlot = vue.computed(() => hasSlot2("footer"));
6048
+ const cardClass = vue.computed(() => `card card--${hasError.value ? "error" : "default"}`);
6049
+ const props = __props;
6050
+ vue.onMounted(() => isMounted.value = true);
6051
+ async function onValidity({
6052
+ detail
6053
+ }) {
6054
+ if (!isMounted.value) {
6055
+ return;
6056
+ }
6057
+ if (!props.focusRef) {
6058
+ throw new Error("Element to focus on when card is invalid (`focusRef`) is required when using card validation.");
6059
+ }
6060
+ const focusElementId = props.focusRef.id;
6061
+ if (!focusElementId) {
6062
+ throw new Error("An id must be set on the card's focus element.");
6063
+ }
6064
+ hasError.value = !detail.isValid;
6065
+ validationMessage.value = detail.validationMessage;
6066
+ dispatchComponentValidityEvent(props.focusRef, {
6067
+ ...detail,
6068
+ errorMessage: validationMessage.value,
6069
+ focusElementId
6070
+ });
6071
+ }
6031
6072
  return (_ctx, _cache) => {
6032
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$K, [hasHeaderSlot.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$y, [vue.renderSlot(_ctx.$slots, "header", vue.normalizeProps(vue.guardReactiveProps({
6073
+ return vue.openBlock(), vue.createElementBlock("div", {
6074
+ id: __props.id,
6075
+ class: vue.normalizeClass(cardClass.value),
6076
+ onValidity
6077
+ }, [hasHeaderSlot.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$y, [vue.renderSlot(_ctx.$slots, "header", vue.normalizeProps(vue.guardReactiveProps({
6033
6078
  headingSlotClass: "card__header-label"
6034
- })))])) : vue.createCommentVNode("", true), _cache[0] || (_cache[0] = vue.createTextVNode()), vue.createElementVNode("div", _hoisted_3$r, [vue.renderSlot(_ctx.$slots, "default")]), _cache[1] || (_cache[1] = vue.createTextVNode()), hasFooterSlot.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$m, [vue.renderSlot(_ctx.$slots, "footer")])) : vue.createCommentVNode("", true)]);
6079
+ })))])) : vue.createCommentVNode("", true), _cache[1] || (_cache[1] = vue.createTextVNode()), vue.renderSlot(_ctx.$slots, "error-message", vue.normalizeProps(vue.guardReactiveProps({
6080
+ hasError: hasError.value,
6081
+ validationMessage: validationMessage.value
6082
+ })), () => [hasError.value ? (vue.openBlock(), vue.createBlock(vue.unref(IFlex), {
6083
+ key: 0,
6084
+ gap: "1x",
6085
+ class: "card__error-message"
6086
+ }, {
6087
+ default: vue.withCtx(() => [vue.createVNode(vue.unref(IFlexItem), {
6088
+ shrink: "",
6089
+ align: "center"
6090
+ }, {
6091
+ default: vue.withCtx(() => [vue.createVNode(vue.unref(FIcon), {
6092
+ name: "error"
6093
+ })]),
6094
+ _: 1
6095
+ }), _cache[0] || (_cache[0] = vue.createTextVNode()), vue.createVNode(vue.unref(IFlexItem), {
6096
+ grow: ""
6097
+ }, {
6098
+ default: vue.withCtx(() => [vue.createTextVNode(vue.toDisplayString(validationMessage.value), 1)]),
6099
+ _: 1
6100
+ })]),
6101
+ _: 1
6102
+ })) : vue.createCommentVNode("", true)]), _cache[2] || (_cache[2] = vue.createTextVNode()), vue.createElementVNode("div", _hoisted_3$r, [vue.renderSlot(_ctx.$slots, "default")]), _cache[3] || (_cache[3] = vue.createTextVNode()), hasFooterSlot.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$m, [vue.renderSlot(_ctx.$slots, "footer", vue.normalizeProps(vue.guardReactiveProps({
6103
+ hasError: hasError.value,
6104
+ validationMessage: validationMessage.value
6105
+ })))])) : vue.createCommentVNode("", true)], 42, _hoisted_1$K);
6035
6106
  };
6036
6107
  }
6037
6108
  });
@@ -17054,6 +17125,20 @@ const _sfc_main = vue.defineComponent({
17054
17125
  });
17055
17126
  }
17056
17127
  logic.DomUtils.focus(headerElement);
17128
+ },
17129
+ beforeNextWrapper() {
17130
+ return this.beforeNext({
17131
+ key: this.step.key,
17132
+ stepNumber: this.stepNumber,
17133
+ totalSteps: this.totalSteps
17134
+ });
17135
+ },
17136
+ beforeValidationWrapper() {
17137
+ return this.beforeValidation({
17138
+ key: this.step.key,
17139
+ stepNumber: this.stepNumber,
17140
+ totalSteps: this.totalSteps
17141
+ });
17057
17142
  }
17058
17143
  }
17059
17144
  });
@@ -17169,8 +17254,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
17169
17254
  }, {
17170
17255
  default: vue.withCtx(() => [vue.createVNode(_component_f_validation_form, {
17171
17256
  id: _ctx.formId,
17172
- "before-submit": _ctx.beforeNext,
17173
- "before-validation": _ctx.beforeValidation,
17257
+ "before-submit": _ctx.beforeNextWrapper,
17258
+ "before-validation": _ctx.beforeValidationWrapper,
17174
17259
  "use-error-list": _ctx.useErrorList,
17175
17260
  class: "wizard-step-body",
17176
17261
  onSubmit: _ctx.onSubmit
@@ -17181,7 +17266,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
17181
17266
  "data-disabled": _ctx.ignoreClick ? "true" : "false",
17182
17267
  type: "submit",
17183
17268
  class: "button button--primary button-group__item button--large"
17184
- }, [vue.renderSlot(_ctx.$slots, "next-button-text", {}, () => [_ctx.isFinalStep ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
17269
+ }, [vue.renderSlot(_ctx.$slots, "next-button-text", vue.normalizeProps(vue.guardReactiveProps({
17270
+ stepNumber: _ctx.stepNumber,
17271
+ totalSteps: _ctx.totalSteps
17272
+ })), () => [_ctx.isFinalStep ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
17185
17273
  key: 0
17186
17274
  }, [vue.createTextVNode(vue.toDisplayString(_ctx.$t("fkui.wizard-step.button.next.text-final", "Gå vidare och granska")), 1)], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
17187
17275
  key: 1
@@ -17190,7 +17278,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
17190
17278
  type: "button",
17191
17279
  class: "button button--secondary button-group__item button--large",
17192
17280
  onClick: _cache[2] || (_cache[2] = (...args) => _ctx.onCancel && _ctx.onCancel(...args))
17193
- }, [vue.renderSlot(_ctx.$slots, "cancel-button-text", {}, () => [vue.createTextVNode(vue.toDisplayString(_ctx.$t("fkui.wizard-step.button.cancel.text", "Avbryt")), 1)])])])]),
17281
+ }, [vue.renderSlot(_ctx.$slots, "cancel-button-text", vue.normalizeProps(vue.guardReactiveProps({
17282
+ stepNumber: _ctx.stepNumber,
17283
+ totalSteps: _ctx.totalSteps
17284
+ })), () => [vue.createTextVNode(vue.toDisplayString(_ctx.$t("fkui.wizard-step.button.cancel.text", "Avbryt")), 1)])])])]),
17194
17285
  _: 3
17195
17286
  }, 8, ["id", "before-submit", "before-validation", "use-error-list", "onSubmit"])]),
17196
17287
  _: 3