@nexdom/uimed-vue 2.0.0-beta.19 → 2.0.0-beta.20

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.
@@ -842,6 +842,7 @@ type __VLS_WithSlots$4<T, S> = T & {
842
842
  //#endregion
843
843
  //#region src/components/sections/section/types.d.ts
844
844
  type SectionVariant = "primary" | "secondary";
845
+ type SectionTextAlign = "start" | "center" | "end";
845
846
  /**
846
847
  * Props exposed by the {@link Section} component.
847
848
  */
@@ -860,6 +861,20 @@ type SectionProps = {
860
861
  * Subtitle displayed below the title.
861
862
  */
862
863
  subtitle?: string;
864
+ /**
865
+ * Horizontal alignment of the section's title, subtitle, content and actions.
866
+ * Available options are:
867
+ * - `"start"`: aligns the text to the start (left in left-to-right languages)
868
+ * and keeps the actions at the end;
869
+ * - `"center"`: centers the text and the actions;
870
+ * - `"end"`: aligns the text and the actions to the end.
871
+ *
872
+ * Uses `start`/`end` instead of `left`/`right`, so it follows the text
873
+ * direction in right-to-left languages. Nested components inherit the
874
+ * alignment, unless they define their own.
875
+ * @default "start"
876
+ */
877
+ textAlign?: SectionTextAlign;
863
878
  /**
864
879
  * List of actions displayed at the bottom of the section, inside
865
880
  * `v-card-actions`. When undefined or empty, no actions area is rendered.
@@ -1615,6 +1615,26 @@ function useSectionVariant(variant) {
1615
1615
  return variantValue ? sectionVariantToVuetifyVariant[variantValue] : sectionVariantToVuetifyVariant.primary;
1616
1616
  });
1617
1617
  }
1618
+ const sectionTextAlignToClasses = {
1619
+ start: {
1620
+ content: "text-start",
1621
+ actions: "justify-end"
1622
+ },
1623
+ center: {
1624
+ content: "text-center",
1625
+ actions: "justify-center"
1626
+ },
1627
+ end: {
1628
+ content: "text-end",
1629
+ actions: "justify-end"
1630
+ }
1631
+ };
1632
+ function useSectionTextAlign(textAlign) {
1633
+ return computed(() => {
1634
+ const textAlignValue = toValue(textAlign);
1635
+ return textAlignValue ? sectionTextAlignToClasses[textAlignValue] : sectionTextAlignToClasses.start;
1636
+ });
1637
+ }
1618
1638
  //#endregion
1619
1639
  //#region src/components/sections/section/section.vue
1620
1640
  var section_default = /* @__PURE__ */ defineComponent({
@@ -1633,6 +1653,10 @@ var section_default = /* @__PURE__ */ defineComponent({
1633
1653
  type: String,
1634
1654
  required: false
1635
1655
  },
1656
+ textAlign: {
1657
+ type: String,
1658
+ required: false
1659
+ },
1636
1660
  actions: {
1637
1661
  type: Array,
1638
1662
  required: false
@@ -1657,6 +1681,7 @@ var section_default = /* @__PURE__ */ defineComponent({
1657
1681
  setup(__props) {
1658
1682
  const props = __props;
1659
1683
  const variant = useSectionVariant(() => props.variant);
1684
+ const textAlignClasses = useSectionTextAlign(() => props.textAlign);
1660
1685
  const title = computed(() => props.title || void 0);
1661
1686
  const subtitle = computed(() => props.subtitle || void 0);
1662
1687
  const width = computed(() => props.fullWidth ? "100%" : void 0);
@@ -1670,18 +1695,18 @@ var section_default = /* @__PURE__ */ defineComponent({
1670
1695
  width: width.value,
1671
1696
  height: height.value
1672
1697
  }, {
1673
- default: withCtx(() => [createVNode(unref(VCard), {
1698
+ default: withCtx(() => [createCommentVNode(" The card and its actions have no alignment props, so `textAlign` uses utility classes "), createVNode(unref(VCard), {
1674
1699
  title: title.value,
1675
1700
  subtitle: subtitle.value,
1676
1701
  variant: unref(variant),
1677
1702
  width: width.value,
1678
1703
  height: height.value,
1679
1704
  "data-testid": props.dataTestid,
1680
- class: "d-flex flex-column"
1705
+ class: normalizeClass(["d-flex flex-column", unref(textAlignClasses).content])
1681
1706
  }, {
1682
1707
  default: withCtx(() => [renderSlot(_ctx.$slots, "default"), showActions.value ? (openBlock(), createBlock(unref(VCardActions), {
1683
1708
  key: 0,
1684
- class: "mt-auto justify-end"
1709
+ class: normalizeClass(["mt-auto", unref(textAlignClasses).actions])
1685
1710
  }, {
1686
1711
  default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(props.actions, ({ label, onClick, ...action }, index) => {
1687
1712
  return openBlock(), createBlock(button_default, mergeProps({ key: index }, { ref_for: true }, action, { onClick }), {
@@ -1690,7 +1715,7 @@ var section_default = /* @__PURE__ */ defineComponent({
1690
1715
  }, 1040, ["onClick"]);
1691
1716
  }), 128))]),
1692
1717
  _: 1
1693
- })) : createCommentVNode("v-if", true)]),
1718
+ }, 8, ["class"])) : createCommentVNode("v-if", true)]),
1694
1719
  _: 3
1695
1720
  }, 8, [
1696
1721
  "title",
@@ -1698,7 +1723,8 @@ var section_default = /* @__PURE__ */ defineComponent({
1698
1723
  "variant",
1699
1724
  "width",
1700
1725
  "height",
1701
- "data-testid"
1726
+ "data-testid",
1727
+ "class"
1702
1728
  ])]),
1703
1729
  _: 3
1704
1730
  }, 8, [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexdom/uimed-vue",
3
- "version": "2.0.0-beta.19",
3
+ "version": "2.0.0-beta.20",
4
4
  "description": "A ui framework for NEXDOM applications.",
5
5
  "keywords": [
6
6
  "lib",