@plexui/vue 0.14.0 → 0.15.0

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.
@@ -38,6 +38,11 @@ const AlertComponent = defineComponent({
38
38
  description: String,
39
39
  /** Places `actions` at the end or the bottom. Automatic from sizing when unset. */
40
40
  actionsPlacement: String,
41
+ /**
42
+ * How the actions show at 767px and below: 50px capsules side by side, as the buttons of an iOS tip (TipKit),
43
+ * or the buttons as given, at their own size, for an alert inside a block of buttons of its own. @default "capsules"
44
+ */
45
+ mobileActions: { type: String, default: "capsules" },
41
46
  /** `false` hides the indicator. Use the `indicator` slot to replace it. */
42
47
  indicator: { type: Boolean, default: undefined },
43
48
  /** Class applied to the actions container */
@@ -96,6 +101,7 @@ const AlertComponent = defineComponent({
96
101
  "role": color === "danger" ? "alert" : undefined,
97
102
  "data-actions-placement": props.actionsPlacement ?? actionsAutoPlacement.value,
98
103
  "data-banner": props.banner ? "" : undefined,
104
+ "data-mobile-actions": props.mobileActions === "own" ? "own" : undefined,
99
105
  }, [
100
106
  props.indicator === false
101
107
  ? null
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../../../src/components/Alert/Alert.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EACL,eAAe,EACf,CAAC,EACD,eAAe,EACf,SAAS,EACT,GAAG,EACH,KAAK,GAKN,MAAM,KAAK,CAAA;AAEZ,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,CAAC,MAAM,kDAAkD,CAAA;AAchE,+EAA+E;AAC/E,MAAM,SAAS,GAAG,CAAC,KAAiB,EAAE,EAAE;IACtC,QAAQ,KAAK,E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,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,aAAa,EAAE,EACxG,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,CAC7B;gCACH,CAAC,CAAC,IAAI;yBACT,CAAC;wBACJ,CAAC,CAAC,IAAI;iBACT,CAAC;gBACF,wFAAwF;gBACxF,KAAK,CAAC,SAAS;oBACb,CAAC,CAAC,CAAC,CACC,MAAM,EACN,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC,WAAW,EAAE,EACvL,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAC1B;oBACH,CAAC,CAAC,IAAI;aACT,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAOF,qFAAqF;AACrF,MAAM,CAAC,MAAM,KAAK,GAAG,cAA4E,CAAA","sourcesContent":["import clsx from \"clsx\"\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n ref,\n watch,\n type HTMLAttributes,\n type PropType,\n type VNodeArrayChildren,\n type VNodeChild,\n} from \"vue\"\nimport type { SemanticColors, Variants } from \"@plexui/styles/types\"\nimport { CheckCircle, Info, Warning, X } from \"../Icon/index.js\"\nimport { Button } from \"../Button/index.js\"\nimport { hasContent } from \"../../lib/slotContent.js\"\nimport s from \"@plexui/styles/components/Alert/Alert.module.css\"\n\n// Vue port of packages/ui/src/components/Alert/Alert.tsx. ReactNode props\n// are slots (`title`, `description`, `actions`, `indicator`), with string\n// props as fallback for `title` and `description`. `:indicator=\"false\"`\n// hides the indicator. `onDismiss` stays a function prop (`@dismiss` in\n// templates) because its presence adds the Dismiss button.\n// The actions auto placement mirrors usehooks-ts `useResizeObserver`: it\n// reacts to the container's content-box width only.\n\nexport type AlertColor = SemanticColors<\n \"primary\" | \"danger\" | \"success\" | \"info\" | \"discovery\" | \"caution\" | \"warning\"\n>\n\n/** Default indicator icon, chosen from the color (which signals intention). */\nconst Indicator = (color: AlertColor) => {\n switch (color) {\n case \"warning\":\n case \"caution\":\n case \"danger\":\n return h(Warning)\n case \"success\":\n return h(CheckCircle)\n default:\n return h(Info)\n }\n}\n\n// usehooks-ts `extractSize` for the content box\nconst contentBoxSize = (entry: ResizeObserverEntry, sizeType: \"inlineSize\" | \"blockSize\") => {\n const box = entry.contentBoxSize as ReadonlyArray<ResizeObserverSize> | ResizeObserverSize | undefined\n if (!box) return entry.contentRect[sizeType === \"inlineSize\" ? \"width\" : \"height\"]\n // Firefox once reported a single object instead of an array\n return Array.isArray(box) ? box[0]?.[sizeType] : (box as ResizeObserverSize)[sizeType]\n}\n\nconst AlertComponent = defineComponent({\n name: \"Alert\",\n props: {\n /** Color of the alert. @default \"primary\" */\n color: { type: String as PropType<AlertColor>, default: \"primary\" },\n /** Style variant. @default \"outline\" */\n variant: { type: String as PropType<Variants<\"solid\" | \"soft\" | \"outline\">>, default: \"outline\" },\n /** Title displayed in the alert (or the `title` slot). */\n title: String,\n /** Description text displayed in the alert (or the `description` slot). */\n description: String,\n /** Places `actions` at the end or the bottom. Automatic from sizing when unset. */\n actionsPlacement: String as PropType<\"end\" | \"bottom\">,\n /** `false` hides the indicator. Use the `indicator` slot to replace it. */\n indicator: { type: Boolean, default: undefined },\n /** Class applied to the actions container */\n actionsClassName: String,\n /** Shows the Dismiss button; called when it is clicked. */\n onDismiss: Function as PropType<(event: MouseEvent) => void>,\n /** A full-width strip across a page or panel: square corners, lines above and below only. @default false */\n banner: { type: Boolean, default: false },\n },\n setup(props, { slots }) {\n const containerRef = ref<HTMLDivElement | null>(null)\n const actionsRef = ref<HTMLDivElement | null>(null)\n const actionsAutoPlacement = ref<\"end\" | \"bottom\">(\"end\")\n const containerWidth = ref<number | undefined>(undefined)\n\n let observer: ResizeObserver | undefined\n onMounted(() => {\n const container = containerRef.value\n if (!container) return\n if (typeof window === \"undefined\" || !(\"ResizeObserver\" in window)) return\n let previousWidth: number | undefined\n let previousHeight: number | undefined\n observer = new ResizeObserver(([entry]) => {\n if (!entry) return\n const width = contentBoxSize(entry, \"inlineSize\")\n const height = contentBoxSize(entry, \"blockSize\")\n if (width !== previousWidth || height !== previousHeight) {\n previousWidth = width\n previousHeight = height\n containerWidth.value = width\n }\n })\n observer.observe(container, { box: \"content-box\" })\n })\n onBeforeUnmount(() => observer?.disconnect())\n\n watch(containerWidth, (width) => {\n const actionsWidth = actionsRef.value?.clientWidth ?? 0\n\n if (actionsWidth && width) {\n // If actions are larger than a third of the container width, wrap them.\n actionsAutoPlacement.value = actionsWidth > width / 3 ? \"bottom\" : \"end\"\n }\n })\n\n return () => {\n const { color } = props\n const title: VNodeChild = slots.title ? slots.title() : props.title\n const description: VNodeChild = slots.description ? slots.description() : props.description\n const actions = slots.actions?.()\n const showActions = hasContent(actions) || !!props.onDismiss\n\n return h(\n \"div\",\n {\n \"ref\": containerRef,\n \"class\": s.Alert,\n \"data-variant\": props.variant,\n \"data-color\": color,\n \"role\": color === \"danger\" ? \"alert\" : undefined,\n \"data-actions-placement\": props.actionsPlacement ?? actionsAutoPlacement.value,\n \"data-banner\": props.banner ? \"\" : undefined,\n },\n [\n props.indicator === false\n ? null\n : h(\"div\", { class: s.Indicator }, slots.indicator ? slots.indicator() : [Indicator(color)]),\n h(\"div\", { class: s.Content }, [\n h(\"div\", { class: s.Message }, [\n hasContent([title as VNodeArrayChildren]) ? h(\"div\", { class: s.Title }, [title]) : null,\n hasContent([description as VNodeArrayChildren])\n ? h(\"div\", { class: s.Description }, [description])\n : null,\n ]),\n showActions\n ? h(\"div\", { class: clsx(s.Actions, props.actionsClassName), ref: actionsRef }, [\n actions,\n props.onDismiss\n ? h(\n Button,\n { type: \"button\", onClick: props.onDismiss, color, variant: \"soft\", pill: true, class: s.DismissButton },\n { default: () => \"Dismiss\" },\n )\n : null,\n ])\n : null,\n ]),\n // On a phone the alert is dismissed with a close button in its corner, as an iOS tip is\n props.onDismiss\n ? h(\n Button,\n { \"type\": \"button\", \"onClick\": props.onDismiss, \"color\": \"secondary\", \"variant\": \"soft\", \"size\": \"sm\", \"uniform\": true, \"pill\": true, \"aria-label\": \"Dismiss\", \"class\": s.CloseButton },\n { default: () => [h(X)] },\n )\n : null,\n ],\n )\n }\n },\n})\n\ntype AlertOwnProps = InstanceType<typeof AlertComponent>[\"$props\"]\n\n/** Alert props plus the native <div> attributes that fall through to it, as in React. */\nexport type AlertProps = AlertOwnProps & Omit<HTMLAttributes, keyof AlertOwnProps>\n\n/** Inline message with a semantic color, optional title, description and actions. */\nexport const Alert = AlertComponent as typeof AlertComponent & { new (): { $props: AlertProps } }\n"]}
1
+ {"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../../../src/components/Alert/Alert.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EACL,eAAe,EACf,CAAC,EACD,eAAe,EACf,SAAS,EACT,GAAG,EACH,KAAK,GAKN,MAAM,KAAK,CAAA;AAEZ,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,CAAC,MAAM,kDAAkD,CAAA;AAgBhE,+EAA+E;AAC/E,MAAM,SAAS,GAAG,CAAC,KAAiB,EAAE,EAAE;IACtC,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,SAAS,CAAC;QACf,KAAK,SAAS,CAAC;QACf,KAAK,QAAQ;YACX,OAAO,CAAC,CAAC,O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AAM,EACN,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,aAAa,EAAE,EACxG,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,CAC7B;gCACH,CAAC,CAAC,IAAI;yBACT,CAAC;wBACJ,CAAC,CAAC,IAAI;iBACT,CAAC;gBACF,wFAAwF;gBACxF,KAAK,CAAC,SAAS;oBACb,CAAC,CAAC,CAAC,CACC,MAAM,EACN,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC,WAAW,EAAE,EACvL,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAC1B;oBACH,CAAC,CAAC,IAAI;aACT,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAOF,qFAAqF;AACrF,MAAM,CAAC,MAAM,KAAK,GAAG,cAA4E,CAAA","sourcesContent":["import clsx from \"clsx\"\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n ref,\n watch,\n type HTMLAttributes,\n type PropType,\n type VNodeArrayChildren,\n type VNodeChild,\n} from \"vue\"\nimport type { SemanticColors, Variants } from \"@plexui/styles/types\"\nimport { CheckCircle, Info, Warning, X } from \"../Icon/index.js\"\nimport { Button } from \"../Button/index.js\"\nimport { hasContent } from \"../../lib/slotContent.js\"\nimport s from \"@plexui/styles/components/Alert/Alert.module.css\"\n\n// Vue port of packages/ui/src/components/Alert/Alert.tsx. ReactNode props\n// are slots (`title`, `description`, `actions`, `indicator`), with string\n// props as fallback for `title` and `description`. `:indicator=\"false\"`\n// hides the indicator. `onDismiss` stays a function prop (`@dismiss` in\n// templates) because its presence adds the Dismiss button.\n// The actions auto placement mirrors usehooks-ts `useResizeObserver`: it\n// reacts to the container's content-box width only.\n\nexport type AlertMobileActions = \"capsules\" | \"own\"\n\nexport type AlertColor = SemanticColors<\n \"primary\" | \"danger\" | \"success\" | \"info\" | \"discovery\" | \"caution\" | \"warning\"\n>\n\n/** Default indicator icon, chosen from the color (which signals intention). */\nconst Indicator = (color: AlertColor) => {\n switch (color) {\n case \"warning\":\n case \"caution\":\n case \"danger\":\n return h(Warning)\n case \"success\":\n return h(CheckCircle)\n default:\n return h(Info)\n }\n}\n\n// usehooks-ts `extractSize` for the content box\nconst contentBoxSize = (entry: ResizeObserverEntry, sizeType: \"inlineSize\" | \"blockSize\") => {\n const box = entry.contentBoxSize as ReadonlyArray<ResizeObserverSize> | ResizeObserverSize | undefined\n if (!box) return entry.contentRect[sizeType === \"inlineSize\" ? \"width\" : \"height\"]\n // Firefox once reported a single object instead of an array\n return Array.isArray(box) ? box[0]?.[sizeType] : (box as ResizeObserverSize)[sizeType]\n}\n\nconst AlertComponent = defineComponent({\n name: \"Alert\",\n props: {\n /** Color of the alert. @default \"primary\" */\n color: { type: String as PropType<AlertColor>, default: \"primary\" },\n /** Style variant. @default \"outline\" */\n variant: { type: String as PropType<Variants<\"solid\" | \"soft\" | \"outline\">>, default: \"outline\" },\n /** Title displayed in the alert (or the `title` slot). */\n title: String,\n /** Description text displayed in the alert (or the `description` slot). */\n description: String,\n /** Places `actions` at the end or the bottom. Automatic from sizing when unset. */\n actionsPlacement: String as PropType<\"end\" | \"bottom\">,\n /**\n * How the actions show at 767px and below: 50px capsules side by side, as the buttons of an iOS tip (TipKit),\n * or the buttons as given, at their own size, for an alert inside a block of buttons of its own. @default \"capsules\"\n */\n mobileActions: { type: String as PropType<AlertMobileActions>, default: \"capsules\" },\n /** `false` hides the indicator. Use the `indicator` slot to replace it. */\n indicator: { type: Boolean, default: undefined },\n /** Class applied to the actions container */\n actionsClassName: String,\n /** Shows the Dismiss button; called when it is clicked. */\n onDismiss: Function as PropType<(event: MouseEvent) => void>,\n /** A full-width strip across a page or panel: square corners, lines above and below only. @default false */\n banner: { type: Boolean, default: false },\n },\n setup(props, { slots }) {\n const containerRef = ref<HTMLDivElement | null>(null)\n const actionsRef = ref<HTMLDivElement | null>(null)\n const actionsAutoPlacement = ref<\"end\" | \"bottom\">(\"end\")\n const containerWidth = ref<number | undefined>(undefined)\n\n let observer: ResizeObserver | undefined\n onMounted(() => {\n const container = containerRef.value\n if (!container) return\n if (typeof window === \"undefined\" || !(\"ResizeObserver\" in window)) return\n let previousWidth: number | undefined\n let previousHeight: number | undefined\n observer = new ResizeObserver(([entry]) => {\n if (!entry) return\n const width = contentBoxSize(entry, \"inlineSize\")\n const height = contentBoxSize(entry, \"blockSize\")\n if (width !== previousWidth || height !== previousHeight) {\n previousWidth = width\n previousHeight = height\n containerWidth.value = width\n }\n })\n observer.observe(container, { box: \"content-box\" })\n })\n onBeforeUnmount(() => observer?.disconnect())\n\n watch(containerWidth, (width) => {\n const actionsWidth = actionsRef.value?.clientWidth ?? 0\n\n if (actionsWidth && width) {\n // If actions are larger than a third of the container width, wrap them.\n actionsAutoPlacement.value = actionsWidth > width / 3 ? \"bottom\" : \"end\"\n }\n })\n\n return () => {\n const { color } = props\n const title: VNodeChild = slots.title ? slots.title() : props.title\n const description: VNodeChild = slots.description ? slots.description() : props.description\n const actions = slots.actions?.()\n const showActions = hasContent(actions) || !!props.onDismiss\n\n return h(\n \"div\",\n {\n \"ref\": containerRef,\n \"class\": s.Alert,\n \"data-variant\": props.variant,\n \"data-color\": color,\n \"role\": color === \"danger\" ? \"alert\" : undefined,\n \"data-actions-placement\": props.actionsPlacement ?? actionsAutoPlacement.value,\n \"data-banner\": props.banner ? \"\" : undefined,\n \"data-mobile-actions\": props.mobileActions === \"own\" ? \"own\" : undefined,\n },\n [\n props.indicator === false\n ? null\n : h(\"div\", { class: s.Indicator }, slots.indicator ? slots.indicator() : [Indicator(color)]),\n h(\"div\", { class: s.Content }, [\n h(\"div\", { class: s.Message }, [\n hasContent([title as VNodeArrayChildren]) ? h(\"div\", { class: s.Title }, [title]) : null,\n hasContent([description as VNodeArrayChildren])\n ? h(\"div\", { class: s.Description }, [description])\n : null,\n ]),\n showActions\n ? h(\"div\", { class: clsx(s.Actions, props.actionsClassName), ref: actionsRef }, [\n actions,\n props.onDismiss\n ? h(\n Button,\n { type: \"button\", onClick: props.onDismiss, color, variant: \"soft\", pill: true, class: s.DismissButton },\n { default: () => \"Dismiss\" },\n )\n : null,\n ])\n : null,\n ]),\n // On a phone the alert is dismissed with a close button in its corner, as an iOS tip is\n props.onDismiss\n ? h(\n Button,\n { \"type\": \"button\", \"onClick\": props.onDismiss, \"color\": \"secondary\", \"variant\": \"soft\", \"size\": \"sm\", \"uniform\": true, \"pill\": true, \"aria-label\": \"Dismiss\", \"class\": s.CloseButton },\n { default: () => [h(X)] },\n )\n : null,\n ],\n )\n }\n },\n})\n\ntype AlertOwnProps = InstanceType<typeof AlertComponent>[\"$props\"]\n\n/** Alert props plus the native <div> attributes that fall through to it, as in React. */\nexport type AlertProps = AlertOwnProps & Omit<HTMLAttributes, keyof AlertOwnProps>\n\n/** Inline message with a semantic color, optional title, description and actions. */\nexport const Alert = AlertComponent as typeof AlertComponent & { new (): { $props: AlertProps } }\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Alert/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAoC,MAAM,YAAY,CAAA","sourcesContent":["export { Alert, type AlertColor, type AlertProps } from \"./Alert.js\"\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Alert/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAA6D,MAAM,YAAY,CAAA","sourcesContent":["export { Alert, type AlertColor, type AlertMobileActions, type AlertProps } from \"./Alert.js\"\n"]}
@@ -1,5 +1,6 @@
1
1
  import { type HTMLAttributes, type PropType } from "vue";
2
2
  import type { SemanticColors, Variants } from "@plexui/styles/types";
3
+ export type AlertMobileActions = "capsules" | "own";
3
4
  export type AlertColor = SemanticColors<"primary" | "danger" | "success" | "info" | "discovery" | "caution" | "warning">;
4
5
  declare const AlertComponent: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
5
6
  /** Color of the alert. @default "primary" */
@@ -18,6 +19,14 @@ declare const AlertComponent: import("vue").DefineComponent<import("vue").Extrac
18
19
  description: StringConstructor;
19
20
  /** Places `actions` at the end or the bottom. Automatic from sizing when unset. */
20
21
  actionsPlacement: PropType<"end" | "bottom">;
22
+ /**
23
+ * How the actions show at 767px and below: 50px capsules side by side, as the buttons of an iOS tip (TipKit),
24
+ * or the buttons as given, at their own size, for an alert inside a block of buttons of its own. @default "capsules"
25
+ */
26
+ mobileActions: {
27
+ type: PropType<AlertMobileActions>;
28
+ default: string;
29
+ };
21
30
  /** `false` hides the indicator. Use the `indicator` slot to replace it. */
22
31
  indicator: {
23
32
  type: BooleanConstructor;
@@ -51,6 +60,14 @@ declare const AlertComponent: import("vue").DefineComponent<import("vue").Extrac
51
60
  description: StringConstructor;
52
61
  /** Places `actions` at the end or the bottom. Automatic from sizing when unset. */
53
62
  actionsPlacement: PropType<"end" | "bottom">;
63
+ /**
64
+ * How the actions show at 767px and below: 50px capsules side by side, as the buttons of an iOS tip (TipKit),
65
+ * or the buttons as given, at their own size, for an alert inside a block of buttons of its own. @default "capsules"
66
+ */
67
+ mobileActions: {
68
+ type: PropType<AlertMobileActions>;
69
+ default: string;
70
+ };
54
71
  /** `false` hides the indicator. Use the `indicator` slot to replace it. */
55
72
  indicator: {
56
73
  type: BooleanConstructor;
@@ -68,6 +85,7 @@ declare const AlertComponent: import("vue").DefineComponent<import("vue").Extrac
68
85
  }>> & Readonly<{}>, {
69
86
  color: "primary" | "danger" | "success" | "info" | "discovery" | "caution" | "warning";
70
87
  variant: "solid" | "soft" | "outline";
88
+ mobileActions: AlertMobileActions;
71
89
  indicator: boolean;
72
90
  banner: boolean;
73
91
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -1 +1 @@
1
- export { Alert, type AlertColor, type AlertProps } from "./Alert.js";
1
+ export { Alert, type AlertColor, type AlertMobileActions, type AlertProps } from "./Alert.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexui/vue",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "Plex UI components for Vue 3, built on Reka UI and the shared @plexui/styles CSS",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -77,7 +77,7 @@
77
77
  "@maskito/core": "5.2.2",
78
78
  "@maskito/kit": "5.2.2",
79
79
  "@maskito/vue": "5.2.2",
80
- "@plexui/styles": "^0.1.38",
80
+ "@plexui/styles": "^0.1.40",
81
81
  "@tanstack/table-core": "8.21.3",
82
82
  "@tanstack/vue-table": "8.21.3",
83
83
  "@tiptap/core": "3.21.0",