cynx-lib 1.3.75 → 1.3.77
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/package.json +1 -1
- package/ui/components/Divider.jsx +1 -1
- package/vue/components/Divider.vue +94 -0
- package/vue/index.d.ts +1 -0
- package/vue/index.js +3 -0
package/package.json
CHANGED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, useSlots } from "vue";
|
|
3
|
+
|
|
4
|
+
const SIZE_CONFIG: Record<string, any> = {
|
|
5
|
+
xs: { hMargin: "8px 0", vMargin: "0 4px", vHeight: "14px", fontSize: ".7rem", padding: "0 8px" },
|
|
6
|
+
sm: { hMargin: "12px 0", vMargin: "0 8px", vHeight: "18px", fontSize: ".75rem", padding: "0 10px" },
|
|
7
|
+
md: { hMargin: "16px 0", vMargin: "0 12px", vHeight: "24px", fontSize: ".82rem", padding: "0 12px" },
|
|
8
|
+
lg: { hMargin: "24px 0", vMargin: "0 16px", vHeight: "32px", fontSize: ".9rem", padding: "0 16px" },
|
|
9
|
+
xl: { hMargin: "32px 0", vMargin: "0 24px", vHeight: "48px", fontSize: "1rem", padding: "0 20px" },
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const props = withDefaults(
|
|
13
|
+
defineProps<{
|
|
14
|
+
label?: string;
|
|
15
|
+
orientation?: "horizontal" | "vertical";
|
|
16
|
+
align?: "left" | "center" | "right";
|
|
17
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
18
|
+
color?: string;
|
|
19
|
+
thickness?: number | string;
|
|
20
|
+
variant?: string;
|
|
21
|
+
}>(),
|
|
22
|
+
{
|
|
23
|
+
orientation: "horizontal",
|
|
24
|
+
align: "center",
|
|
25
|
+
size: "md",
|
|
26
|
+
color: "var(--border, #d7d8e0)",
|
|
27
|
+
thickness: 1,
|
|
28
|
+
variant: "solid",
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const slots = useSlots();
|
|
33
|
+
const hasContent = computed(() => Boolean(props.label || slots.default));
|
|
34
|
+
const cfg = computed(() => SIZE_CONFIG[props.size] || SIZE_CONFIG.md);
|
|
35
|
+
const thickStr = computed(() =>
|
|
36
|
+
typeof props.thickness === "number" ? `${props.thickness}px` : props.thickness
|
|
37
|
+
);
|
|
38
|
+
const lineStyle = computed(() => `${thickStr.value} ${props.variant} ${props.color}`);
|
|
39
|
+
const leftFlex = computed(() => (props.align === "left" ? "0 0 16px" : "1"));
|
|
40
|
+
const rightFlex = computed(() => (props.align === "right" ? "0 0 16px" : "1"));
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<template>
|
|
44
|
+
<div
|
|
45
|
+
v-if="orientation === 'vertical'"
|
|
46
|
+
class="cynx-divider cynx-divider-vertical"
|
|
47
|
+
:style="{
|
|
48
|
+
display: 'inline-block',
|
|
49
|
+
width: 0,
|
|
50
|
+
height: cfg.vHeight,
|
|
51
|
+
margin: cfg.vMargin,
|
|
52
|
+
borderLeft: lineStyle,
|
|
53
|
+
verticalAlign: 'middle',
|
|
54
|
+
alignSelf: 'center',
|
|
55
|
+
flexShrink: 0,
|
|
56
|
+
}"
|
|
57
|
+
/>
|
|
58
|
+
|
|
59
|
+
<div
|
|
60
|
+
v-else-if="hasContent"
|
|
61
|
+
class="cynx-divider cynx-divider-horizontal"
|
|
62
|
+
:style="{
|
|
63
|
+
display: 'flex',
|
|
64
|
+
alignItems: 'center',
|
|
65
|
+
width: '100%',
|
|
66
|
+
margin: cfg.hMargin,
|
|
67
|
+
}"
|
|
68
|
+
>
|
|
69
|
+
<div :style="{ flex: leftFlex, borderBottom: lineStyle }" />
|
|
70
|
+
<span
|
|
71
|
+
:style="{
|
|
72
|
+
padding: cfg.padding,
|
|
73
|
+
fontSize: cfg.fontSize,
|
|
74
|
+
color: 'var(--muted, #9b9daa)',
|
|
75
|
+
fontWeight: 500,
|
|
76
|
+
whiteSpace: 'nowrap',
|
|
77
|
+
lineHeight: 1,
|
|
78
|
+
}"
|
|
79
|
+
>
|
|
80
|
+
<slot>{{ label }}</slot>
|
|
81
|
+
</span>
|
|
82
|
+
<div :style="{ flex: rightFlex, borderBottom: lineStyle }" />
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<div
|
|
86
|
+
v-else
|
|
87
|
+
class="cynx-divider cynx-divider-horizontal"
|
|
88
|
+
:style="{
|
|
89
|
+
width: '100%',
|
|
90
|
+
margin: cfg.hMargin,
|
|
91
|
+
borderBottom: lineStyle,
|
|
92
|
+
}"
|
|
93
|
+
/>
|
|
94
|
+
</template>
|
package/vue/index.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ export declare const LinearProgress: DefineComponent<any, any, any>;
|
|
|
58
58
|
export declare const CircularProgress: DefineComponent<any, any, any>;
|
|
59
59
|
export declare const StatusTag: DefineComponent<any, any, any>;
|
|
60
60
|
export declare const InfoBadge: DefineComponent<any, any, any>;
|
|
61
|
+
export declare const Divider: DefineComponent<any, any, any>;
|
|
61
62
|
export declare const XTable: DefineComponent<any, any, any>;
|
|
62
63
|
export declare const XThead: DefineComponent<any, any, any>;
|
|
63
64
|
export declare const XTbody: DefineComponent<any, any, any>;
|
package/vue/index.js
CHANGED
|
@@ -19,6 +19,7 @@ import LinearProgress from "./components/LinearProgress.vue";
|
|
|
19
19
|
import CircularProgress from "./components/CircularProgress.vue";
|
|
20
20
|
import StatusTag from "./components/StatusTag.vue";
|
|
21
21
|
import InfoBadge from "./components/InfoBadge.vue";
|
|
22
|
+
import Divider from "./components/Divider.vue";
|
|
22
23
|
import { XTable, XThead, XTbody, XTr, XTh, XTd } from "./components/XTable.vue";
|
|
23
24
|
import { useAutoSkeletonRows } from "./composables/useAutoSkeletonRows";
|
|
24
25
|
|
|
@@ -43,6 +44,7 @@ export {
|
|
|
43
44
|
CircularProgress,
|
|
44
45
|
StatusTag,
|
|
45
46
|
InfoBadge,
|
|
47
|
+
Divider,
|
|
46
48
|
XTable,
|
|
47
49
|
XThead,
|
|
48
50
|
XTbody,
|
|
@@ -73,6 +75,7 @@ export default {
|
|
|
73
75
|
CircularProgress,
|
|
74
76
|
StatusTag,
|
|
75
77
|
InfoBadge,
|
|
78
|
+
Divider,
|
|
76
79
|
XTable,
|
|
77
80
|
XThead,
|
|
78
81
|
XTbody,
|