@skewedaspect/sleekspace-ui 0.3.0 → 0.4.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.
- package/dist/components/Alert/SkAlert.vue.d.ts +18 -8
- package/dist/components/Alert/types.d.ts +3 -2
- package/dist/sleekspace-ui.css +18 -18
- package/dist/sleekspace-ui.es.js +19 -5
- package/dist/sleekspace-ui.umd.js +19 -5
- package/package.json +2 -2
- package/src/components/Alert/SkAlert.vue +50 -17
- package/src/components/Alert/types.ts +7 -2
- package/src/styles/components/_alert.scss +5 -5
- package/web-types.json +14 -4
|
@@ -2,19 +2,28 @@ import { SkAlertKind } from './types';
|
|
|
2
2
|
import { ComponentCustomColors } from '../../types';
|
|
3
3
|
export interface SkAlertComponentProps extends ComponentCustomColors {
|
|
4
4
|
/**
|
|
5
|
-
* Semantic kind that determines the alert's color scheme and default icon.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Semantic kind that determines the alert's color scheme and default icon. Supports all
|
|
6
|
+
* semantic kinds (neutral, primary, accent, info, success, warning, danger) as well as
|
|
7
|
+
* direct color kinds (neon-blue, neon-purple, etc.). Default icons are provided for the
|
|
8
|
+
* four feedback kinds (info, success, warning, danger).
|
|
8
9
|
* @default 'info'
|
|
9
10
|
*/
|
|
10
11
|
kind?: SkAlertKind;
|
|
11
12
|
/**
|
|
12
|
-
* When true, applies
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* When true, applies subdued styling with a lighter, semi-transparent background.
|
|
14
|
+
* Use subtle alerts for less critical messages that shouldn't dominate the visual
|
|
15
|
+
* hierarchy, such as tips or supplementary information.
|
|
15
16
|
* @default false
|
|
16
17
|
*/
|
|
17
|
-
|
|
18
|
+
subtle?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Controls visibility of the icon container. When undefined (default), the icon is shown
|
|
21
|
+
* automatically if there's a default icon for the kind (info, success, warning, danger)
|
|
22
|
+
* or if custom content is provided via the icon slot. Set to false to force-hide the icon,
|
|
23
|
+
* or true to force-show the container even when empty.
|
|
24
|
+
* @default undefined
|
|
25
|
+
*/
|
|
26
|
+
showIcon?: boolean;
|
|
18
27
|
}
|
|
19
28
|
declare function __VLS_template(): {
|
|
20
29
|
attrs: Partial<{}>;
|
|
@@ -27,8 +36,9 @@ declare function __VLS_template(): {
|
|
|
27
36
|
};
|
|
28
37
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
29
38
|
declare const __VLS_component: import('vue').DefineComponent<SkAlertComponentProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<SkAlertComponentProps> & Readonly<{}>, {
|
|
39
|
+
subtle: boolean;
|
|
30
40
|
kind: SkAlertKind;
|
|
31
|
-
|
|
41
|
+
showIcon: boolean;
|
|
32
42
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
33
43
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
34
44
|
export default _default;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { ComponentKind } from '../../types';
|
|
1
2
|
/**
|
|
2
|
-
* Alert semantic
|
|
3
|
+
* Alert kind - supports all semantic and color kinds
|
|
3
4
|
*/
|
|
4
|
-
export type SkAlertKind =
|
|
5
|
+
export type SkAlertKind = ComponentKind;
|
package/dist/sleekspace-ui.css
CHANGED
|
@@ -1658,7 +1658,7 @@
|
|
|
1658
1658
|
.sk-alert .sk-alert-content > *:last-child {
|
|
1659
1659
|
margin-bottom: 0;
|
|
1660
1660
|
}
|
|
1661
|
-
.sk-alert.sk-
|
|
1661
|
+
.sk-alert:not(.sk-subtle) {
|
|
1662
1662
|
--sk-alert-padding: 1rem;
|
|
1663
1663
|
--sk-alert-icon-size: 1.5rem;
|
|
1664
1664
|
--sk-alert-cut-size: 1rem;
|
|
@@ -1675,7 +1675,7 @@
|
|
|
1675
1675
|
color: var(--sk-alert-fg);
|
|
1676
1676
|
border-color: var(--sk-alert-border-color);
|
|
1677
1677
|
}
|
|
1678
|
-
.sk-alert.sk-neutral.sk-
|
|
1678
|
+
.sk-alert.sk-neutral:not(.sk-subtle) {
|
|
1679
1679
|
--sk-alert-fg: var(--sk-neutral-text);
|
|
1680
1680
|
}
|
|
1681
1681
|
.sk-alert.sk-primary {
|
|
@@ -1686,7 +1686,7 @@
|
|
|
1686
1686
|
color: var(--sk-alert-fg);
|
|
1687
1687
|
border-color: var(--sk-alert-border-color);
|
|
1688
1688
|
}
|
|
1689
|
-
.sk-alert.sk-primary.sk-
|
|
1689
|
+
.sk-alert.sk-primary:not(.sk-subtle) {
|
|
1690
1690
|
--sk-alert-fg: var(--sk-primary-text);
|
|
1691
1691
|
}
|
|
1692
1692
|
.sk-alert.sk-accent {
|
|
@@ -1697,7 +1697,7 @@
|
|
|
1697
1697
|
color: var(--sk-alert-fg);
|
|
1698
1698
|
border-color: var(--sk-alert-border-color);
|
|
1699
1699
|
}
|
|
1700
|
-
.sk-alert.sk-accent.sk-
|
|
1700
|
+
.sk-alert.sk-accent:not(.sk-subtle) {
|
|
1701
1701
|
--sk-alert-fg: var(--sk-accent-text);
|
|
1702
1702
|
}
|
|
1703
1703
|
.sk-alert.sk-info {
|
|
@@ -1708,7 +1708,7 @@
|
|
|
1708
1708
|
color: var(--sk-alert-fg);
|
|
1709
1709
|
border-color: var(--sk-alert-border-color);
|
|
1710
1710
|
}
|
|
1711
|
-
.sk-alert.sk-info.sk-
|
|
1711
|
+
.sk-alert.sk-info:not(.sk-subtle) {
|
|
1712
1712
|
--sk-alert-fg: var(--sk-info-text);
|
|
1713
1713
|
}
|
|
1714
1714
|
.sk-alert.sk-success {
|
|
@@ -1719,7 +1719,7 @@
|
|
|
1719
1719
|
color: var(--sk-alert-fg);
|
|
1720
1720
|
border-color: var(--sk-alert-border-color);
|
|
1721
1721
|
}
|
|
1722
|
-
.sk-alert.sk-success.sk-
|
|
1722
|
+
.sk-alert.sk-success:not(.sk-subtle) {
|
|
1723
1723
|
--sk-alert-fg: var(--sk-success-text);
|
|
1724
1724
|
}
|
|
1725
1725
|
.sk-alert.sk-warning {
|
|
@@ -1730,7 +1730,7 @@
|
|
|
1730
1730
|
color: var(--sk-alert-fg);
|
|
1731
1731
|
border-color: var(--sk-alert-border-color);
|
|
1732
1732
|
}
|
|
1733
|
-
.sk-alert.sk-warning.sk-
|
|
1733
|
+
.sk-alert.sk-warning:not(.sk-subtle) {
|
|
1734
1734
|
--sk-alert-fg: var(--sk-warning-text);
|
|
1735
1735
|
}
|
|
1736
1736
|
.sk-alert.sk-danger {
|
|
@@ -1741,7 +1741,7 @@
|
|
|
1741
1741
|
color: var(--sk-alert-fg);
|
|
1742
1742
|
border-color: var(--sk-alert-border-color);
|
|
1743
1743
|
}
|
|
1744
|
-
.sk-alert.sk-danger.sk-
|
|
1744
|
+
.sk-alert.sk-danger:not(.sk-subtle) {
|
|
1745
1745
|
--sk-alert-fg: var(--sk-danger-text);
|
|
1746
1746
|
}
|
|
1747
1747
|
.sk-alert.sk-boulder {
|
|
@@ -1752,7 +1752,7 @@
|
|
|
1752
1752
|
color: var(--sk-alert-fg);
|
|
1753
1753
|
border-color: var(--sk-alert-border-color);
|
|
1754
1754
|
}
|
|
1755
|
-
.sk-alert.sk-boulder.sk-
|
|
1755
|
+
.sk-alert.sk-boulder:not(.sk-subtle) {
|
|
1756
1756
|
--sk-alert-fg: var(--sk-boulder-text);
|
|
1757
1757
|
}
|
|
1758
1758
|
.sk-alert.sk-neon-blue {
|
|
@@ -1763,7 +1763,7 @@
|
|
|
1763
1763
|
color: var(--sk-alert-fg);
|
|
1764
1764
|
border-color: var(--sk-alert-border-color);
|
|
1765
1765
|
}
|
|
1766
|
-
.sk-alert.sk-neon-blue.sk-
|
|
1766
|
+
.sk-alert.sk-neon-blue:not(.sk-subtle) {
|
|
1767
1767
|
--sk-alert-fg: var(--sk-neon-blue-text);
|
|
1768
1768
|
}
|
|
1769
1769
|
.sk-alert.sk-light-blue {
|
|
@@ -1774,7 +1774,7 @@
|
|
|
1774
1774
|
color: var(--sk-alert-fg);
|
|
1775
1775
|
border-color: var(--sk-alert-border-color);
|
|
1776
1776
|
}
|
|
1777
|
-
.sk-alert.sk-light-blue.sk-
|
|
1777
|
+
.sk-alert.sk-light-blue:not(.sk-subtle) {
|
|
1778
1778
|
--sk-alert-fg: var(--sk-light-blue-text);
|
|
1779
1779
|
}
|
|
1780
1780
|
.sk-alert.sk-neon-orange {
|
|
@@ -1785,7 +1785,7 @@
|
|
|
1785
1785
|
color: var(--sk-alert-fg);
|
|
1786
1786
|
border-color: var(--sk-alert-border-color);
|
|
1787
1787
|
}
|
|
1788
|
-
.sk-alert.sk-neon-orange.sk-
|
|
1788
|
+
.sk-alert.sk-neon-orange:not(.sk-subtle) {
|
|
1789
1789
|
--sk-alert-fg: var(--sk-neon-orange-text);
|
|
1790
1790
|
}
|
|
1791
1791
|
.sk-alert.sk-neon-purple {
|
|
@@ -1796,7 +1796,7 @@
|
|
|
1796
1796
|
color: var(--sk-alert-fg);
|
|
1797
1797
|
border-color: var(--sk-alert-border-color);
|
|
1798
1798
|
}
|
|
1799
|
-
.sk-alert.sk-neon-purple.sk-
|
|
1799
|
+
.sk-alert.sk-neon-purple:not(.sk-subtle) {
|
|
1800
1800
|
--sk-alert-fg: var(--sk-neon-purple-text);
|
|
1801
1801
|
}
|
|
1802
1802
|
.sk-alert.sk-neon-green {
|
|
@@ -1807,7 +1807,7 @@
|
|
|
1807
1807
|
color: var(--sk-alert-fg);
|
|
1808
1808
|
border-color: var(--sk-alert-border-color);
|
|
1809
1809
|
}
|
|
1810
|
-
.sk-alert.sk-neon-green.sk-
|
|
1810
|
+
.sk-alert.sk-neon-green:not(.sk-subtle) {
|
|
1811
1811
|
--sk-alert-fg: var(--sk-neon-green-text);
|
|
1812
1812
|
}
|
|
1813
1813
|
.sk-alert.sk-neon-mint {
|
|
@@ -1818,7 +1818,7 @@
|
|
|
1818
1818
|
color: var(--sk-alert-fg);
|
|
1819
1819
|
border-color: var(--sk-alert-border-color);
|
|
1820
1820
|
}
|
|
1821
|
-
.sk-alert.sk-neon-mint.sk-
|
|
1821
|
+
.sk-alert.sk-neon-mint:not(.sk-subtle) {
|
|
1822
1822
|
--sk-alert-fg: var(--sk-neon-mint-text);
|
|
1823
1823
|
}
|
|
1824
1824
|
.sk-alert.sk-neon-pink {
|
|
@@ -1829,7 +1829,7 @@
|
|
|
1829
1829
|
color: var(--sk-alert-fg);
|
|
1830
1830
|
border-color: var(--sk-alert-border-color);
|
|
1831
1831
|
}
|
|
1832
|
-
.sk-alert.sk-neon-pink.sk-
|
|
1832
|
+
.sk-alert.sk-neon-pink:not(.sk-subtle) {
|
|
1833
1833
|
--sk-alert-fg: var(--sk-neon-pink-text);
|
|
1834
1834
|
}
|
|
1835
1835
|
.sk-alert.sk-yellow {
|
|
@@ -1840,7 +1840,7 @@
|
|
|
1840
1840
|
color: var(--sk-alert-fg);
|
|
1841
1841
|
border-color: var(--sk-alert-border-color);
|
|
1842
1842
|
}
|
|
1843
|
-
.sk-alert.sk-yellow.sk-
|
|
1843
|
+
.sk-alert.sk-yellow:not(.sk-subtle) {
|
|
1844
1844
|
--sk-alert-fg: var(--sk-yellow-text);
|
|
1845
1845
|
}
|
|
1846
1846
|
.sk-alert.sk-red {
|
|
@@ -1851,7 +1851,7 @@
|
|
|
1851
1851
|
color: var(--sk-alert-fg);
|
|
1852
1852
|
border-color: var(--sk-alert-border-color);
|
|
1853
1853
|
}
|
|
1854
|
-
.sk-alert.sk-red.sk-
|
|
1854
|
+
.sk-alert.sk-red:not(.sk-subtle) {
|
|
1855
1855
|
--sk-alert-fg: var(--sk-red-text);
|
|
1856
1856
|
}
|
|
1857
1857
|
.sk-avatar {
|
package/dist/sleekspace-ui.es.js
CHANGED
|
@@ -15205,7 +15205,10 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
15205
15205
|
}
|
|
15206
15206
|
});
|
|
15207
15207
|
const SkAccordionItem = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__scopeId", "data-v-5e73d91f"]]);
|
|
15208
|
-
const _hoisted_1$w = {
|
|
15208
|
+
const _hoisted_1$w = {
|
|
15209
|
+
key: 0,
|
|
15210
|
+
class: "sk-alert-icon"
|
|
15211
|
+
};
|
|
15209
15212
|
const _hoisted_2$h = {
|
|
15210
15213
|
key: 0,
|
|
15211
15214
|
viewBox: "0 0 24 24",
|
|
@@ -15239,19 +15242,30 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
|
15239
15242
|
__name: "SkAlert",
|
|
15240
15243
|
props: {
|
|
15241
15244
|
kind: { default: "info" },
|
|
15242
|
-
|
|
15245
|
+
subtle: { type: Boolean, default: false },
|
|
15246
|
+
showIcon: { type: Boolean, default: void 0 },
|
|
15243
15247
|
baseColor: {},
|
|
15244
15248
|
textColor: {}
|
|
15245
15249
|
},
|
|
15246
15250
|
setup(__props) {
|
|
15251
|
+
const FEEDBACK_KINDS = ["info", "success", "warning", "danger"];
|
|
15247
15252
|
const props = __props;
|
|
15253
|
+
const slots = useSlots();
|
|
15248
15254
|
const classes = computed(() => {
|
|
15249
15255
|
return {
|
|
15250
15256
|
"sk-alert": true,
|
|
15251
15257
|
[`sk-${props.kind}`]: true,
|
|
15252
|
-
"sk-
|
|
15258
|
+
"sk-subtle": props.subtle
|
|
15253
15259
|
};
|
|
15254
15260
|
});
|
|
15261
|
+
const shouldShowIcon = computed(() => {
|
|
15262
|
+
if (props.showIcon !== void 0) {
|
|
15263
|
+
return props.showIcon;
|
|
15264
|
+
}
|
|
15265
|
+
const hasDefaultIcon = FEEDBACK_KINDS.includes(props.kind);
|
|
15266
|
+
const hasSlotContent = !!slots.icon;
|
|
15267
|
+
return hasDefaultIcon || hasSlotContent;
|
|
15268
|
+
});
|
|
15255
15269
|
const customColorStyles = useCustomColors(
|
|
15256
15270
|
"alert",
|
|
15257
15271
|
toRef(() => props.baseColor),
|
|
@@ -15263,7 +15277,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
|
15263
15277
|
style: normalizeStyle(unref(customColorStyles)),
|
|
15264
15278
|
role: "alert"
|
|
15265
15279
|
}, [
|
|
15266
|
-
|
|
15280
|
+
shouldShowIcon.value ? (openBlock(), createElementBlock("div", _hoisted_1$w, [
|
|
15267
15281
|
renderSlot(_ctx.$slots, "icon", {}, () => [
|
|
15268
15282
|
__props.kind === "info" ? (openBlock(), createElementBlock("svg", _hoisted_2$h, [..._cache[0] || (_cache[0] = [
|
|
15269
15283
|
createElementVNode("circle", {
|
|
@@ -15320,7 +15334,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
|
|
|
15320
15334
|
}, null, -1)
|
|
15321
15335
|
])])) : createCommentVNode("", true)
|
|
15322
15336
|
])
|
|
15323
|
-
]),
|
|
15337
|
+
])) : createCommentVNode("", true),
|
|
15324
15338
|
createElementVNode("div", _hoisted_6$3, [
|
|
15325
15339
|
renderSlot(_ctx.$slots, "default")
|
|
15326
15340
|
])
|
|
@@ -15224,7 +15224,10 @@ Defaulting to \`null\`.`);
|
|
|
15224
15224
|
}
|
|
15225
15225
|
});
|
|
15226
15226
|
const SkAccordionItem = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__scopeId", "data-v-5e73d91f"]]);
|
|
15227
|
-
const _hoisted_1$w = {
|
|
15227
|
+
const _hoisted_1$w = {
|
|
15228
|
+
key: 0,
|
|
15229
|
+
class: "sk-alert-icon"
|
|
15230
|
+
};
|
|
15228
15231
|
const _hoisted_2$h = {
|
|
15229
15232
|
key: 0,
|
|
15230
15233
|
viewBox: "0 0 24 24",
|
|
@@ -15258,19 +15261,30 @@ Defaulting to \`null\`.`);
|
|
|
15258
15261
|
__name: "SkAlert",
|
|
15259
15262
|
props: {
|
|
15260
15263
|
kind: { default: "info" },
|
|
15261
|
-
|
|
15264
|
+
subtle: { type: Boolean, default: false },
|
|
15265
|
+
showIcon: { type: Boolean, default: void 0 },
|
|
15262
15266
|
baseColor: {},
|
|
15263
15267
|
textColor: {}
|
|
15264
15268
|
},
|
|
15265
15269
|
setup(__props) {
|
|
15270
|
+
const FEEDBACK_KINDS = ["info", "success", "warning", "danger"];
|
|
15266
15271
|
const props = __props;
|
|
15272
|
+
const slots = vue.useSlots();
|
|
15267
15273
|
const classes = vue.computed(() => {
|
|
15268
15274
|
return {
|
|
15269
15275
|
"sk-alert": true,
|
|
15270
15276
|
[`sk-${props.kind}`]: true,
|
|
15271
|
-
"sk-
|
|
15277
|
+
"sk-subtle": props.subtle
|
|
15272
15278
|
};
|
|
15273
15279
|
});
|
|
15280
|
+
const shouldShowIcon = vue.computed(() => {
|
|
15281
|
+
if (props.showIcon !== void 0) {
|
|
15282
|
+
return props.showIcon;
|
|
15283
|
+
}
|
|
15284
|
+
const hasDefaultIcon = FEEDBACK_KINDS.includes(props.kind);
|
|
15285
|
+
const hasSlotContent = !!slots.icon;
|
|
15286
|
+
return hasDefaultIcon || hasSlotContent;
|
|
15287
|
+
});
|
|
15274
15288
|
const customColorStyles = useCustomColors(
|
|
15275
15289
|
"alert",
|
|
15276
15290
|
vue.toRef(() => props.baseColor),
|
|
@@ -15282,7 +15296,7 @@ Defaulting to \`null\`.`);
|
|
|
15282
15296
|
style: vue.normalizeStyle(vue.unref(customColorStyles)),
|
|
15283
15297
|
role: "alert"
|
|
15284
15298
|
}, [
|
|
15285
|
-
vue.
|
|
15299
|
+
shouldShowIcon.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$w, [
|
|
15286
15300
|
vue.renderSlot(_ctx.$slots, "icon", {}, () => [
|
|
15287
15301
|
__props.kind === "info" ? (vue.openBlock(), vue.createElementBlock("svg", _hoisted_2$h, [..._cache[0] || (_cache[0] = [
|
|
15288
15302
|
vue.createElementVNode("circle", {
|
|
@@ -15339,7 +15353,7 @@ Defaulting to \`null\`.`);
|
|
|
15339
15353
|
}, null, -1)
|
|
15340
15354
|
])])) : vue.createCommentVNode("", true)
|
|
15341
15355
|
])
|
|
15342
|
-
]),
|
|
15356
|
+
])) : vue.createCommentVNode("", true),
|
|
15343
15357
|
vue.createElementVNode("div", _hoisted_6$3, [
|
|
15344
15358
|
vue.renderSlot(_ctx.$slots, "default")
|
|
15345
15359
|
])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skewedaspect/sleekspace-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "A Vue 3 component library with a cyberpunk aesthetic, featuring OKLCH colors, beveled corners, and a powerful design token system",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/sleekspace-ui.umd.js",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"directory": "packages/sleekspace-ui"
|
|
54
54
|
},
|
|
55
55
|
"bugs": "https://gitlab.com/skewedaspect/sleekspace-ui/-/issues",
|
|
56
|
-
"homepage": "https://
|
|
56
|
+
"homepage": "https://sleekspace.skewedaspect.com",
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"vue": "^3.3.0"
|
|
59
59
|
},
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
<template>
|
|
6
6
|
<div :class="classes" :style="customColorStyles" role="alert">
|
|
7
|
-
<div class="sk-alert-icon">
|
|
7
|
+
<div v-if="shouldShowIcon" class="sk-alert-icon">
|
|
8
8
|
<slot name="icon">
|
|
9
|
-
<!-- Default icons for
|
|
9
|
+
<!-- Default icons for feedback kinds -->
|
|
10
10
|
<svg
|
|
11
11
|
v-if="kind === 'info'"
|
|
12
12
|
viewBox="0 0 24 24"
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
/**
|
|
67
67
|
* @component SkAlert
|
|
68
68
|
* @description A contextual feedback component for displaying informational, success, warning, or error messages.
|
|
69
|
-
* Features automatic icon selection based on alert kind and supports
|
|
69
|
+
* Features automatic icon selection based on alert kind and supports prominent (default) and subtle visual styles.
|
|
70
70
|
* Use alerts to communicate important status updates, validation results, or system messages to users.
|
|
71
71
|
*
|
|
72
72
|
* @example
|
|
@@ -74,11 +74,10 @@
|
|
|
74
74
|
* <SkAlert kind="success">Your changes have been saved!</SkAlert>
|
|
75
75
|
* ```
|
|
76
76
|
*
|
|
77
|
-
* @example
|
|
77
|
+
* @example Subtle info alert
|
|
78
78
|
* ```vue
|
|
79
|
-
* <SkAlert kind="
|
|
80
|
-
*
|
|
81
|
-
* This action cannot be undone.
|
|
79
|
+
* <SkAlert kind="info" subtle>
|
|
80
|
+
* A helpful tip for the user.
|
|
82
81
|
* </SkAlert>
|
|
83
82
|
* ```
|
|
84
83
|
*
|
|
@@ -86,7 +85,7 @@
|
|
|
86
85
|
* @slot icon - Custom icon to override the default kind-based icon. Receives no slot props.
|
|
87
86
|
*/
|
|
88
87
|
|
|
89
|
-
import { computed, toRef } from 'vue';
|
|
88
|
+
import { computed, toRef, useSlots } from 'vue';
|
|
90
89
|
|
|
91
90
|
// Types
|
|
92
91
|
import type { SkAlertKind } from './types';
|
|
@@ -97,32 +96,50 @@
|
|
|
97
96
|
|
|
98
97
|
//------------------------------------------------------------------------------------------------------------------
|
|
99
98
|
|
|
99
|
+
// Kinds that have default icons
|
|
100
|
+
const FEEDBACK_KINDS = [ 'info', 'success', 'warning', 'danger' ] as const;
|
|
101
|
+
|
|
102
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
103
|
+
|
|
100
104
|
export interface SkAlertComponentProps extends ComponentCustomColors
|
|
101
105
|
{
|
|
102
106
|
/**
|
|
103
|
-
* Semantic kind that determines the alert's color scheme and default icon.
|
|
104
|
-
*
|
|
105
|
-
*
|
|
107
|
+
* Semantic kind that determines the alert's color scheme and default icon. Supports all
|
|
108
|
+
* semantic kinds (neutral, primary, accent, info, success, warning, danger) as well as
|
|
109
|
+
* direct color kinds (neon-blue, neon-purple, etc.). Default icons are provided for the
|
|
110
|
+
* four feedback kinds (info, success, warning, danger).
|
|
106
111
|
* @default 'info'
|
|
107
112
|
*/
|
|
108
113
|
kind ?: SkAlertKind;
|
|
109
114
|
|
|
110
115
|
/**
|
|
111
|
-
* When true, applies
|
|
112
|
-
*
|
|
113
|
-
*
|
|
116
|
+
* When true, applies subdued styling with a lighter, semi-transparent background.
|
|
117
|
+
* Use subtle alerts for less critical messages that shouldn't dominate the visual
|
|
118
|
+
* hierarchy, such as tips or supplementary information.
|
|
114
119
|
* @default false
|
|
115
120
|
*/
|
|
116
|
-
|
|
121
|
+
subtle ?: boolean;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Controls visibility of the icon container. When undefined (default), the icon is shown
|
|
125
|
+
* automatically if there's a default icon for the kind (info, success, warning, danger)
|
|
126
|
+
* or if custom content is provided via the icon slot. Set to false to force-hide the icon,
|
|
127
|
+
* or true to force-show the container even when empty.
|
|
128
|
+
* @default undefined
|
|
129
|
+
*/
|
|
130
|
+
showIcon ?: boolean;
|
|
117
131
|
}
|
|
118
132
|
|
|
119
133
|
//------------------------------------------------------------------------------------------------------------------
|
|
120
134
|
|
|
121
135
|
const props = withDefaults(defineProps<SkAlertComponentProps>(), {
|
|
122
136
|
kind: 'info',
|
|
123
|
-
|
|
137
|
+
subtle: false,
|
|
138
|
+
showIcon: undefined,
|
|
124
139
|
});
|
|
125
140
|
|
|
141
|
+
const slots = useSlots();
|
|
142
|
+
|
|
126
143
|
//------------------------------------------------------------------------------------------------------------------
|
|
127
144
|
|
|
128
145
|
const classes = computed(() =>
|
|
@@ -130,10 +147,26 @@
|
|
|
130
147
|
return {
|
|
131
148
|
'sk-alert': true,
|
|
132
149
|
[`sk-${ props.kind }`]: true,
|
|
133
|
-
'sk-
|
|
150
|
+
'sk-subtle': props.subtle,
|
|
134
151
|
};
|
|
135
152
|
});
|
|
136
153
|
|
|
154
|
+
// Determine if we should show the icon container
|
|
155
|
+
const shouldShowIcon = computed(() =>
|
|
156
|
+
{
|
|
157
|
+
// Explicit override takes precedence
|
|
158
|
+
if(props.showIcon !== undefined)
|
|
159
|
+
{
|
|
160
|
+
return props.showIcon;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Auto-show if kind has a default icon or if slot content is provided
|
|
164
|
+
const hasDefaultIcon = FEEDBACK_KINDS.includes(props.kind as typeof FEEDBACK_KINDS[number]);
|
|
165
|
+
const hasSlotContent = !!slots.icon;
|
|
166
|
+
|
|
167
|
+
return hasDefaultIcon || hasSlotContent;
|
|
168
|
+
});
|
|
169
|
+
|
|
137
170
|
//------------------------------------------------------------------------------------------------------------------
|
|
138
171
|
|
|
139
172
|
// Custom color styles
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
// Alert Component Types
|
|
3
3
|
//----------------------------------------------------------------------------------------------------------------------
|
|
4
4
|
|
|
5
|
+
// Types
|
|
6
|
+
import type { ComponentKind } from '@/types';
|
|
7
|
+
|
|
8
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
9
|
+
|
|
5
10
|
/**
|
|
6
|
-
* Alert semantic
|
|
11
|
+
* Alert kind - supports all semantic and color kinds
|
|
7
12
|
*/
|
|
8
|
-
export type SkAlertKind =
|
|
13
|
+
export type SkAlertKind = ComponentKind;
|
|
9
14
|
|
|
10
15
|
//----------------------------------------------------------------------------------------------------------------------
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
/// Glow effect opacity
|
|
38
38
|
--sk-alert-glow-opacity: 0.3;
|
|
39
39
|
|
|
40
|
-
/// Subtle background opacity (for non-prominent alerts)
|
|
40
|
+
/// Subtle background opacity (for default non-prominent alerts)
|
|
41
41
|
--sk-alert-subtle-opacity: var(--sk-opacity-subtle);
|
|
42
42
|
|
|
43
43
|
//------------------------------------------------------------------------------------------------------------------
|
|
@@ -107,8 +107,8 @@
|
|
|
107
107
|
color: var(--sk-alert-fg);
|
|
108
108
|
border-color: var(--sk-alert-border-color);
|
|
109
109
|
|
|
110
|
-
//
|
|
111
|
-
|
|
110
|
+
// Non-subtle variants get the dark foreground color
|
|
111
|
+
&:not(.sk-subtle)
|
|
112
112
|
{
|
|
113
113
|
--sk-alert-fg: var(--sk-#{ $kind }-text);
|
|
114
114
|
}
|
|
@@ -185,10 +185,10 @@
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
//------------------------------------------------------------------------------------------------------------------
|
|
188
|
-
//
|
|
188
|
+
// Non-subtle (prominent) variant - applied when NOT subtle
|
|
189
189
|
//------------------------------------------------------------------------------------------------------------------
|
|
190
190
|
|
|
191
|
-
|
|
191
|
+
&:not(.sk-subtle)
|
|
192
192
|
{
|
|
193
193
|
--sk-alert-padding: 1rem;
|
|
194
194
|
--sk-alert-icon-size: 1.5rem;
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"framework": "vue",
|
|
3
3
|
"name": "@skewedaspect/sleekspace-ui",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"contributions": {
|
|
6
6
|
"html": {
|
|
7
7
|
"description-markup": "markdown",
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
{
|
|
142
142
|
"name": "kind",
|
|
143
143
|
"required": false,
|
|
144
|
-
"description": "Semantic kind that determines the alert's color scheme and default icon.
|
|
144
|
+
"description": "Semantic kind that determines the alert's color scheme and default icon. Supports all\nsemantic kinds (neutral, primary, accent, info, success, warning, danger) as well as\ndirect color kinds (neon-blue, neon-purple, etc.). Default icons are provided for the\nfour feedback kinds (info, success, warning, danger).",
|
|
145
145
|
"value": {
|
|
146
146
|
"kind": "expression",
|
|
147
147
|
"type": "SkAlertKind"
|
|
@@ -149,14 +149,24 @@
|
|
|
149
149
|
"default": "'info'"
|
|
150
150
|
},
|
|
151
151
|
{
|
|
152
|
-
"name": "
|
|
152
|
+
"name": "subtle",
|
|
153
153
|
"required": false,
|
|
154
|
-
"description": "When true, applies
|
|
154
|
+
"description": "When true, applies subdued styling with a lighter, semi-transparent background.\nUse subtle alerts for less critical messages that shouldn't dominate the visual\nhierarchy, such as tips or supplementary information.",
|
|
155
155
|
"value": {
|
|
156
156
|
"kind": "expression",
|
|
157
157
|
"type": "boolean"
|
|
158
158
|
},
|
|
159
159
|
"default": "false"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"name": "showIcon",
|
|
163
|
+
"required": false,
|
|
164
|
+
"description": "Controls visibility of the icon container. When undefined (default), the icon is shown\nautomatically if there's a default icon for the kind (info, success, warning, danger)\nor if custom content is provided via the icon slot. Set to false to force-hide the icon,\nor true to force-show the container even when empty.",
|
|
165
|
+
"value": {
|
|
166
|
+
"kind": "expression",
|
|
167
|
+
"type": "boolean"
|
|
168
|
+
},
|
|
169
|
+
"default": "undefined"
|
|
160
170
|
}
|
|
161
171
|
],
|
|
162
172
|
"slots": [
|