@expcat/tigercat-vue 2.0.0-rc.2 → 2.0.4
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/{chunk-KE6RGD4Y.mjs → chunk-26OI3TEA.mjs} +25 -55
- package/dist/{chunk-H26JXVJX.mjs → chunk-2T2NEZRZ.mjs} +1 -1
- package/dist/chunk-4HUYX5WW.mjs +239 -0
- package/dist/{chunk-EGIQPUEL.mjs → chunk-5C32WCQY.mjs} +8 -6
- package/dist/{chunk-QFG452MD.mjs → chunk-5RXYJWNA.mjs} +53 -28
- package/dist/{chunk-IDUEWMWN.mjs → chunk-7KCOF5US.mjs} +61 -62
- package/dist/{chunk-RHV6DWY6.mjs → chunk-7VHXZX7Y.mjs} +20 -28
- package/dist/{chunk-36TZA5BH.mjs → chunk-A5QYJSHK.mjs} +0 -3
- package/dist/{chunk-IZRQ7LB3.mjs → chunk-AU6IC6K7.mjs} +1 -1
- package/dist/{chunk-O6BN5R6J.mjs → chunk-AUMTHL6N.mjs} +1 -1
- package/dist/{chunk-MNSVJBNH.mjs → chunk-B4MDHE3L.mjs} +18 -4
- package/dist/{chunk-7JT5ZIHC.mjs → chunk-BCU7GYF6.mjs} +16 -8
- package/dist/{chunk-7CPMXNLK.mjs → chunk-BNYA5IUB.mjs} +26 -2
- package/dist/{chunk-N7LWKAYS.mjs → chunk-BZ6MVFV7.mjs} +190 -174
- package/dist/{chunk-TK3QU367.mjs → chunk-DI6RRAGQ.mjs} +3 -3
- package/dist/{chunk-4ZZYQITT.mjs → chunk-FWO7RNGI.mjs} +249 -220
- package/dist/{chunk-SUORTZUY.mjs → chunk-GS4SV2HK.mjs} +48 -20
- package/dist/{chunk-EUSODI5E.mjs → chunk-HKYRRQS7.mjs} +11 -5
- package/dist/{chunk-D4APFWWS.mjs → chunk-IPGPLFUZ.mjs} +18 -4
- package/dist/{chunk-IMFHJEUX.mjs → chunk-JALHMWKW.mjs} +20 -7
- package/dist/{chunk-OHPXOLNB.mjs → chunk-K3WTQBE4.mjs} +40 -15
- package/dist/{chunk-VMYV5EWI.mjs → chunk-KICZSLOX.mjs} +9 -8
- package/dist/{chunk-BNNTDSLJ.mjs → chunk-KROVW4AW.mjs} +19 -60
- package/dist/{chunk-AQMPCLX7.mjs → chunk-NMAJD353.mjs} +248 -253
- package/dist/{chunk-4BO6JNA6.mjs → chunk-OAPIT53X.mjs} +4 -4
- package/dist/{chunk-SYRRMZT2.mjs → chunk-OQVGB7X6.mjs} +43 -29
- package/dist/{chunk-DWK5GUMB.mjs → chunk-OTGGPXDT.mjs} +26 -19
- package/dist/{chunk-5KPO3EDM.mjs → chunk-OTHJIFDV.mjs} +28 -15
- package/dist/{chunk-DWPZRG7A.mjs → chunk-PGF7HLLR.mjs} +43 -39
- package/dist/chunk-Q7Y22OFX.mjs +330 -0
- package/dist/{chunk-3NQUEQJT.mjs → chunk-RID7A5V7.mjs} +54 -38
- package/dist/{chunk-CFH5T3V2.mjs → chunk-S5RTMAQN.mjs} +2 -2
- package/dist/{chunk-SJ7W5I5H.mjs → chunk-TCV6YPH5.mjs} +1 -1
- package/dist/{chunk-LFENEILY.mjs → chunk-WC5MKASU.mjs} +110 -99
- package/dist/{chunk-JZCETBUV.mjs → chunk-WUQMFKQ6.mjs} +29 -16
- package/dist/{chunk-GWFVBG22.mjs → chunk-XGXZF27U.mjs} +28 -15
- package/dist/{chunk-JVQPU4M2.mjs → chunk-ZGA66PSG.mjs} +28 -15
- package/dist/components/ActivityFeed.d.mts +6 -6
- package/dist/components/ActivityFeed.mjs +3 -3
- package/dist/components/Alert.d.mts +3 -3
- package/dist/components/Anchor.d.mts +1 -1
- package/dist/components/AreaChart.d.mts +3 -3
- package/dist/components/AreaChart.mjs +1 -1
- package/dist/components/AutoComplete.d.mts +5 -5
- package/dist/components/AutoComplete.mjs +2 -1
- package/dist/components/Avatar.d.mts +1 -1
- package/dist/components/AvatarGroup.d.mts +2 -2
- package/dist/components/BackTop.d.mts +3 -3
- package/dist/components/Badge.d.mts +4 -4
- package/dist/components/BarChart.d.mts +2 -2
- package/dist/components/BarChart.mjs +1 -1
- package/dist/components/Breadcrumb.d.mts +3 -3
- package/dist/components/Button.d.mts +3 -3
- package/dist/components/ButtonGroup.d.mts +1 -1
- package/dist/components/Calendar.d.mts +2 -2
- package/dist/components/Card.d.mts +2 -2
- package/dist/components/Carousel.d.mts +2 -2
- package/dist/components/Cascader.d.mts +3 -3
- package/dist/components/Cascader.mjs +2 -1
- package/dist/components/ChartCanvas.d.mts +1 -1
- package/dist/components/ChartGrid.d.mts +1 -1
- package/dist/components/ChartLegend.d.mts +1 -1
- package/dist/components/ChatWindow.d.mts +4 -4
- package/dist/components/CodeEditor.d.mts +3 -3
- package/dist/components/Collapse.d.mts +1 -1
- package/dist/components/CollapsePanel.d.mts +1 -1
- package/dist/components/ColorPicker.mjs +2 -1
- package/dist/components/ColorSwatch.d.mts +2 -2
- package/dist/components/CommentThread.d.mts +2 -2
- package/dist/components/CommentThread.mjs +1 -1
- package/dist/components/ConfigProvider.d.mts +1 -1
- package/dist/components/Container.d.mts +1 -1
- package/dist/components/Countdown.d.mts +2 -2
- package/dist/components/CronEditor.d.mts +2 -2
- package/dist/components/CropUpload.d.mts +1 -1
- package/dist/components/CropUpload.mjs +4 -4
- package/dist/components/DataExport.d.mts +2 -2
- package/dist/components/DataExport.mjs +3 -3
- package/dist/components/DataTableWithToolbar.d.mts +11 -11
- package/dist/components/DataTableWithToolbar.mjs +6 -6
- package/dist/components/DatePicker.d.mts +3 -3
- package/dist/components/DatePicker.mjs +2 -1
- package/dist/components/Descriptions.d.mts +2 -2
- package/dist/components/DonutChart.d.mts +4 -4
- package/dist/components/Drawer.d.mts +6 -6
- package/dist/components/Drawer.mjs +2 -2
- package/dist/components/Dropdown.d.mts +2 -2
- package/dist/components/Dropdown.mjs +2 -2
- package/dist/components/Empty.d.mts +1 -1
- package/dist/components/FileManager.d.mts +2 -2
- package/dist/components/FloatButton.d.mts +5 -5
- package/dist/components/Form.d.mts +2 -2
- package/dist/components/FormItem.mjs +2 -1
- package/dist/components/FormWizard.d.mts +5 -5
- package/dist/components/FunnelChart.d.mts +3 -3
- package/dist/components/Gantt.d.mts +2 -2
- package/dist/components/GaugeChart.d.mts +2 -2
- package/dist/components/HeatmapChart.d.mts +3 -3
- package/dist/components/Icon.d.mts +2 -2
- package/dist/components/Image.d.mts +2 -2
- package/dist/components/Image.mjs +3 -3
- package/dist/components/ImageAnnotation.d.mts +5 -5
- package/dist/components/ImageCropper.d.mts +1 -1
- package/dist/components/ImageCropper.mjs +1 -1
- package/dist/components/ImageViewer.d.mts +1 -1
- package/dist/components/InfiniteScroll.d.mts +3 -3
- package/dist/components/InfiniteScroll.mjs +1 -1
- package/dist/components/Input.d.mts +4 -4
- package/dist/components/InputGroup.d.mts +1 -1
- package/dist/components/InputNumber.d.mts +1 -1
- package/dist/components/Kanban.d.mts +1 -1
- package/dist/components/LineChart.d.mts +2 -2
- package/dist/components/LineChart.mjs +1 -1
- package/dist/components/Link.d.mts +1 -1
- package/dist/components/List.d.mts +7 -7
- package/dist/components/Loading.d.mts +6 -6
- package/dist/components/Loading.mjs +2 -2
- package/dist/components/MarkdownEditor.d.mts +5 -5
- package/dist/components/Mentions.d.mts +3 -3
- package/dist/components/Mentions.mjs +2 -1
- package/dist/components/Menu.d.mts +4 -4
- package/dist/components/Menu.mjs +2 -2
- package/dist/components/Modal.d.mts +8 -8
- package/dist/components/Modal.mjs +2 -2
- package/dist/components/NotificationCenter.d.mts +5 -5
- package/dist/components/NotificationCenter.mjs +3 -3
- package/dist/components/NumberKeyboard.d.mts +5 -5
- package/dist/components/OrgChart.d.mts +3 -3
- package/dist/components/Pagination.d.mts +5 -5
- package/dist/components/PieChart.d.mts +4 -4
- package/dist/components/Popconfirm.d.mts +4 -4
- package/dist/components/Popconfirm.mjs +3 -3
- package/dist/components/Popover.d.mts +3 -3
- package/dist/components/Popover.mjs +3 -3
- package/dist/components/Progress.d.mts +3 -3
- package/dist/components/QRCode.d.mts +3 -3
- package/dist/components/RadarChart.d.mts +3 -3
- package/dist/components/Rate.d.mts +2 -2
- package/dist/components/Result.d.mts +1 -1
- package/dist/components/RichTextEditor.d.mts +4 -4
- package/dist/components/Row.d.mts +1 -1
- package/dist/components/ScatterChart.d.mts +2 -2
- package/dist/components/ScatterChart.mjs +1 -1
- package/dist/components/ScrollSpy.d.mts +3 -3
- package/dist/components/Select.d.mts +3 -3
- package/dist/components/Select.mjs +2 -1
- package/dist/components/Signature.d.mts +5 -5
- package/dist/components/Skeleton.d.mts +1 -1
- package/dist/components/Space.d.mts +2 -2
- package/dist/components/Splitter.d.mts +1 -1
- package/dist/components/Spotlight.d.mts +5 -5
- package/dist/components/Spotlight.mjs +2 -2
- package/dist/components/Steps.d.mts +3 -3
- package/dist/components/SunburstChart.d.mts +2 -2
- package/dist/components/Table.d.mts +5 -5
- package/dist/components/Table.mjs +3 -2
- package/dist/components/Tabs.d.mts +4 -4
- package/dist/components/Tag.d.mts +2 -2
- package/dist/components/TaskBoard.d.mts +2 -2
- package/dist/components/Text.d.mts +3 -3
- package/dist/components/Textarea.d.mts +3 -3
- package/dist/components/TimePicker.d.mts +4 -4
- package/dist/components/TimePicker.mjs +2 -1
- package/dist/components/Timeline.d.mts +4 -4
- package/dist/components/Tooltip.d.mts +3 -3
- package/dist/components/Tooltip.mjs +3 -3
- package/dist/components/Tour.d.mts +2 -2
- package/dist/components/Tour.mjs +2 -2
- package/dist/components/Transfer.d.mts +3 -3
- package/dist/components/Tree.d.mts +4 -4
- package/dist/components/TreeMapChart.d.mts +2 -2
- package/dist/components/TreeSelect.d.mts +3 -3
- package/dist/components/TreeSelect.mjs +2 -1
- package/dist/components/Upload.d.mts +4 -4
- package/dist/components/Upload.mjs +1 -1
- package/dist/components/VirtualTable.d.mts +3 -3
- package/dist/components/VirtualTable.mjs +1 -1
- package/dist/components/Watermark.d.mts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +4 -2
- package/package.json +2 -2
- package/dist/chunk-BDTPFPSB.mjs +0 -163
- package/dist/chunk-EWUHEW6W.mjs +0 -219
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
useVueFloating
|
|
5
|
-
} from "./chunk-BDTPFPSB.mjs";
|
|
2
|
+
useVueAnchoredOverlay
|
|
3
|
+
} from "./chunk-Q7Y22OFX.mjs";
|
|
6
4
|
|
|
7
5
|
// src/utils/use-floating-popup.ts
|
|
8
|
-
import { computed, ref, watch
|
|
6
|
+
import { computed, ref, watch } from "vue";
|
|
9
7
|
import {
|
|
10
|
-
getTransformOrigin,
|
|
11
|
-
FLOATING_OVERLAY_Z_INDEX,
|
|
12
8
|
buildTriggerHandlerMap,
|
|
13
9
|
restoreFocus
|
|
14
10
|
} from "@expcat/tigercat-core";
|
|
@@ -47,57 +43,28 @@ function useFloatingPopup(options) {
|
|
|
47
43
|
setVisible(false);
|
|
48
44
|
restoreTriggerFocus();
|
|
49
45
|
};
|
|
50
|
-
const {
|
|
51
|
-
x,
|
|
52
|
-
y,
|
|
53
|
-
placement: actualPlacement
|
|
54
|
-
} = useVueFloating({
|
|
55
|
-
referenceRef: triggerRef,
|
|
56
|
-
floatingRef,
|
|
57
|
-
enabled: currentVisible,
|
|
58
|
-
placement: props.placement ?? "top",
|
|
59
|
-
offset: props.offset ?? 8
|
|
60
|
-
});
|
|
61
|
-
let outsideClickCleanup;
|
|
62
|
-
let escapeKeyCleanup;
|
|
63
46
|
const effectiveTrigger = computed(
|
|
64
47
|
() => multiTrigger ? props.trigger ?? "click" : "click"
|
|
65
48
|
);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
if (visible && trigger !== "manual") {
|
|
82
|
-
escapeKeyCleanup = useVueEscapeKey({
|
|
83
|
-
enabled: currentVisible,
|
|
84
|
-
onEscape: closeAndRestoreFocus
|
|
85
|
-
});
|
|
49
|
+
const overlay = useVueAnchoredOverlay({
|
|
50
|
+
enabled: currentVisible,
|
|
51
|
+
referenceRef: triggerRef,
|
|
52
|
+
floatingRef,
|
|
53
|
+
containerRef,
|
|
54
|
+
placement: props.placement ?? "top",
|
|
55
|
+
offset: props.offset ?? 8,
|
|
56
|
+
dismissOnOutside: computed(() => effectiveTrigger.value === "click"),
|
|
57
|
+
dismissOnEscape: computed(() => effectiveTrigger.value !== "manual"),
|
|
58
|
+
onDismiss: (reason) => {
|
|
59
|
+
if (reason === "escape") {
|
|
60
|
+
closeAndRestoreFocus();
|
|
61
|
+
} else {
|
|
62
|
+
setVisible(false);
|
|
86
63
|
}
|
|
87
|
-
}
|
|
88
|
-
{ immediate: true }
|
|
89
|
-
);
|
|
90
|
-
onBeforeUnmount(() => {
|
|
91
|
-
outsideClickCleanup?.();
|
|
92
|
-
escapeKeyCleanup?.();
|
|
64
|
+
}
|
|
93
65
|
});
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
left: `${x.value}px`,
|
|
97
|
-
top: `${y.value}px`,
|
|
98
|
-
transformOrigin: getTransformOrigin(actualPlacement.value),
|
|
99
|
-
zIndex: FLOATING_OVERLAY_Z_INDEX
|
|
100
|
-
}));
|
|
66
|
+
const x = overlay.x;
|
|
67
|
+
const y = overlay.y;
|
|
101
68
|
const handleToggle = () => {
|
|
102
69
|
if (!props.disabled) setVisible(!currentVisible.value);
|
|
103
70
|
};
|
|
@@ -125,8 +92,11 @@ function useFloatingPopup(options) {
|
|
|
125
92
|
floatingRef,
|
|
126
93
|
x,
|
|
127
94
|
y,
|
|
128
|
-
actualPlacement,
|
|
129
|
-
floatingStyles,
|
|
95
|
+
actualPlacement: overlay.placement,
|
|
96
|
+
floatingStyles: overlay.floatingStyles,
|
|
97
|
+
floatingClasses: overlay.floatingClasses,
|
|
98
|
+
positioned: overlay.positioned,
|
|
99
|
+
overlayTarget: overlay.target,
|
|
130
100
|
triggerHandlers,
|
|
131
101
|
closeAndRestoreFocus
|
|
132
102
|
};
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import {
|
|
2
|
+
renderVueOverlayTeleport,
|
|
3
|
+
useVueAnchoredOverlay
|
|
4
|
+
} from "./chunk-Q7Y22OFX.mjs";
|
|
5
|
+
|
|
6
|
+
// src/components/ColorPicker.ts
|
|
7
|
+
import { defineComponent, h, ref, computed, watch } from "vue";
|
|
8
|
+
import {
|
|
9
|
+
colorPickerBaseClasses,
|
|
10
|
+
getColorPickerTriggerClasses,
|
|
11
|
+
colorPickerPanelClasses,
|
|
12
|
+
colorPickerInputClasses,
|
|
13
|
+
colorPickerPresetClasses,
|
|
14
|
+
hexToRgb,
|
|
15
|
+
rgbToHex,
|
|
16
|
+
rgbToHsv,
|
|
17
|
+
hsvToRgb,
|
|
18
|
+
formatColorString,
|
|
19
|
+
parseColorInput,
|
|
20
|
+
classNames,
|
|
21
|
+
coerceClassValue
|
|
22
|
+
} from "@expcat/tigercat-core";
|
|
23
|
+
var ColorPicker = defineComponent({
|
|
24
|
+
name: "TigerColorPicker",
|
|
25
|
+
props: {
|
|
26
|
+
modelValue: { type: String, default: "#2563eb" },
|
|
27
|
+
disabled: { type: Boolean, default: false },
|
|
28
|
+
size: { type: String, default: "md" },
|
|
29
|
+
showAlpha: { type: Boolean, default: false },
|
|
30
|
+
format: { type: String, default: "hex" },
|
|
31
|
+
presets: { type: Array, default: void 0 }
|
|
32
|
+
},
|
|
33
|
+
emits: ["update:modelValue", "change"],
|
|
34
|
+
setup(props, { emit, attrs }) {
|
|
35
|
+
const isOpen = ref(false);
|
|
36
|
+
const alpha = ref(1);
|
|
37
|
+
const containerRef = ref(null);
|
|
38
|
+
const triggerRef = ref(null);
|
|
39
|
+
const panelRef = ref(null);
|
|
40
|
+
const overlay = useVueAnchoredOverlay({
|
|
41
|
+
enabled: isOpen,
|
|
42
|
+
referenceRef: triggerRef,
|
|
43
|
+
floatingRef: panelRef,
|
|
44
|
+
containerRef,
|
|
45
|
+
placement: "bottom-start",
|
|
46
|
+
offset: 4,
|
|
47
|
+
dismissOnOutside: true,
|
|
48
|
+
dismissOnEscape: true,
|
|
49
|
+
restoreFocusOnDismiss: true,
|
|
50
|
+
onDismiss: closePanel
|
|
51
|
+
});
|
|
52
|
+
const rgb = computed(() => hexToRgb(props.modelValue));
|
|
53
|
+
const hsv = computed(() => rgbToHsv(rgb.value.r, rgb.value.g, rgb.value.b));
|
|
54
|
+
const displayValue = computed(
|
|
55
|
+
() => formatColorString(
|
|
56
|
+
rgb.value.r,
|
|
57
|
+
rgb.value.g,
|
|
58
|
+
rgb.value.b,
|
|
59
|
+
props.format,
|
|
60
|
+
props.showAlpha ? alpha.value : void 0
|
|
61
|
+
)
|
|
62
|
+
);
|
|
63
|
+
const swatchColor = computed(
|
|
64
|
+
() => props.showAlpha ? `rgba(${rgb.value.r}, ${rgb.value.g}, ${rgb.value.b}, ${alpha.value})` : props.modelValue
|
|
65
|
+
);
|
|
66
|
+
const inputValue = ref(displayValue.value);
|
|
67
|
+
watch(displayValue, (v) => {
|
|
68
|
+
inputValue.value = v;
|
|
69
|
+
});
|
|
70
|
+
function togglePanel() {
|
|
71
|
+
if (props.disabled) return;
|
|
72
|
+
isOpen.value = !isOpen.value;
|
|
73
|
+
}
|
|
74
|
+
function closePanel() {
|
|
75
|
+
isOpen.value = false;
|
|
76
|
+
}
|
|
77
|
+
function handleTriggerKeydown(e) {
|
|
78
|
+
if (props.disabled) return;
|
|
79
|
+
if (e.key === "Enter" || e.key === " " || e.key === "Spacebar") {
|
|
80
|
+
e.preventDefault();
|
|
81
|
+
isOpen.value = !isOpen.value;
|
|
82
|
+
} else if (e.key === "Escape" && isOpen.value) {
|
|
83
|
+
isOpen.value = false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function handleAlphaChange(e) {
|
|
87
|
+
alpha.value = Number(e.target.value) / 100;
|
|
88
|
+
}
|
|
89
|
+
function handleHueChange(e) {
|
|
90
|
+
const hue = Number(e.target.value);
|
|
91
|
+
const { r, g, b } = hsvToRgb(hue, hsv.value.s, hsv.value.v);
|
|
92
|
+
const hex = rgbToHex(r, g, b);
|
|
93
|
+
emit("update:modelValue", hex);
|
|
94
|
+
emit("change", hex);
|
|
95
|
+
}
|
|
96
|
+
function handleInputChange(e) {
|
|
97
|
+
const val = e.target.value;
|
|
98
|
+
inputValue.value = val;
|
|
99
|
+
const hex = parseColorInput(val);
|
|
100
|
+
if (hex) {
|
|
101
|
+
emit("update:modelValue", hex);
|
|
102
|
+
emit("change", hex);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function handlePresetClick(color) {
|
|
106
|
+
emit("update:modelValue", color);
|
|
107
|
+
emit("change", color);
|
|
108
|
+
}
|
|
109
|
+
function handlePresetKeydown(e, color) {
|
|
110
|
+
if (e.key === "Enter" || e.key === " " || e.key === "Spacebar") {
|
|
111
|
+
e.preventDefault();
|
|
112
|
+
handlePresetClick(color);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return () => h(
|
|
116
|
+
"div",
|
|
117
|
+
{
|
|
118
|
+
ref: containerRef,
|
|
119
|
+
class: classNames(colorPickerBaseClasses, coerceClassValue(attrs.class))
|
|
120
|
+
},
|
|
121
|
+
[
|
|
122
|
+
// Color trigger swatch
|
|
123
|
+
h("div", {
|
|
124
|
+
ref: triggerRef,
|
|
125
|
+
class: getColorPickerTriggerClasses(props.size, props.disabled),
|
|
126
|
+
style: { backgroundColor: swatchColor.value },
|
|
127
|
+
role: "button",
|
|
128
|
+
"aria-label": "Pick color",
|
|
129
|
+
"aria-haspopup": "dialog",
|
|
130
|
+
"aria-expanded": isOpen.value,
|
|
131
|
+
"aria-disabled": props.disabled || void 0,
|
|
132
|
+
tabindex: props.disabled ? -1 : 0,
|
|
133
|
+
onClick: togglePanel,
|
|
134
|
+
onKeydown: handleTriggerKeydown
|
|
135
|
+
}),
|
|
136
|
+
// Panel
|
|
137
|
+
isOpen.value ? renderVueOverlayTeleport(
|
|
138
|
+
h(
|
|
139
|
+
"div",
|
|
140
|
+
{
|
|
141
|
+
ref: panelRef,
|
|
142
|
+
class: classNames(colorPickerPanelClasses, overlay.floatingClasses.value),
|
|
143
|
+
style: overlay.floatingStyles.value,
|
|
144
|
+
"data-positioned": overlay.positioned.value
|
|
145
|
+
},
|
|
146
|
+
[
|
|
147
|
+
// Hue slider
|
|
148
|
+
h("div", { class: "mb-2" }, [
|
|
149
|
+
h(
|
|
150
|
+
"label",
|
|
151
|
+
{ class: "block text-xs text-[var(--tiger-text-muted,#6b7280)] mb-1" },
|
|
152
|
+
"Hue"
|
|
153
|
+
),
|
|
154
|
+
h("input", {
|
|
155
|
+
type: "range",
|
|
156
|
+
min: 0,
|
|
157
|
+
max: 360,
|
|
158
|
+
value: hsv.value.h,
|
|
159
|
+
class: "w-full h-2 rounded-full cursor-pointer accent-[var(--tiger-primary,#2563eb)]",
|
|
160
|
+
"aria-label": "Hue",
|
|
161
|
+
onInput: handleHueChange
|
|
162
|
+
})
|
|
163
|
+
]),
|
|
164
|
+
// Alpha slider
|
|
165
|
+
props.showAlpha ? h("div", { class: "mb-2" }, [
|
|
166
|
+
h(
|
|
167
|
+
"label",
|
|
168
|
+
{ class: "block text-xs text-[var(--tiger-text-muted,#6b7280)] mb-1" },
|
|
169
|
+
"Alpha"
|
|
170
|
+
),
|
|
171
|
+
h("input", {
|
|
172
|
+
type: "range",
|
|
173
|
+
min: 0,
|
|
174
|
+
max: 100,
|
|
175
|
+
value: Math.round(alpha.value * 100),
|
|
176
|
+
class: "w-full h-2 rounded-full cursor-pointer accent-[var(--tiger-primary,#2563eb)]",
|
|
177
|
+
"aria-label": "Alpha",
|
|
178
|
+
onInput: handleAlphaChange
|
|
179
|
+
})
|
|
180
|
+
]) : null,
|
|
181
|
+
// Color value input (rendered in the selected format)
|
|
182
|
+
h("div", { class: "mb-2" }, [
|
|
183
|
+
h(
|
|
184
|
+
"label",
|
|
185
|
+
{
|
|
186
|
+
class: "block text-xs text-[var(--tiger-text-muted,#6b7280)] mb-1 uppercase"
|
|
187
|
+
},
|
|
188
|
+
props.format
|
|
189
|
+
),
|
|
190
|
+
h("input", {
|
|
191
|
+
type: "text",
|
|
192
|
+
class: colorPickerInputClasses,
|
|
193
|
+
value: inputValue.value,
|
|
194
|
+
"aria-label": "Color value",
|
|
195
|
+
onInput: handleInputChange
|
|
196
|
+
})
|
|
197
|
+
]),
|
|
198
|
+
// Preview
|
|
199
|
+
h("div", { class: "flex items-center gap-2 mb-2" }, [
|
|
200
|
+
h("div", {
|
|
201
|
+
class: "w-8 h-8 rounded border border-[var(--tiger-border,#d1d5db)]",
|
|
202
|
+
style: { backgroundColor: swatchColor.value },
|
|
203
|
+
"aria-label": "Color preview"
|
|
204
|
+
}),
|
|
205
|
+
h(
|
|
206
|
+
"span",
|
|
207
|
+
{ class: "text-xs font-mono text-[var(--tiger-text,#111827)]" },
|
|
208
|
+
displayValue.value
|
|
209
|
+
)
|
|
210
|
+
]),
|
|
211
|
+
// Presets
|
|
212
|
+
props.presets && props.presets.length > 0 ? h("div", { class: "flex flex-wrap gap-1" }, [
|
|
213
|
+
...props.presets.map(
|
|
214
|
+
(color) => h("div", {
|
|
215
|
+
key: color,
|
|
216
|
+
class: colorPickerPresetClasses,
|
|
217
|
+
style: { backgroundColor: color },
|
|
218
|
+
role: "button",
|
|
219
|
+
tabindex: 0,
|
|
220
|
+
"aria-label": `Select ${color}`,
|
|
221
|
+
onClick: () => handlePresetClick(color),
|
|
222
|
+
onKeydown: (e) => handlePresetKeydown(e, color)
|
|
223
|
+
})
|
|
224
|
+
)
|
|
225
|
+
]) : null
|
|
226
|
+
]
|
|
227
|
+
),
|
|
228
|
+
overlay.target.value
|
|
229
|
+
) : null
|
|
230
|
+
]
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
var ColorPicker_default = ColorPicker;
|
|
235
|
+
|
|
236
|
+
export {
|
|
237
|
+
ColorPicker,
|
|
238
|
+
ColorPicker_default
|
|
239
|
+
};
|
|
@@ -160,7 +160,7 @@ var VirtualTable = defineComponent({
|
|
|
160
160
|
),
|
|
161
161
|
style: { ...widthStyle, ...stickyStyle }
|
|
162
162
|
},
|
|
163
|
-
col.title ?? ""
|
|
163
|
+
[col.renderHeader ? col.renderHeader() : col.title ?? ""]
|
|
164
164
|
);
|
|
165
165
|
});
|
|
166
166
|
const headerRowChildren = [
|
|
@@ -195,8 +195,10 @@ var VirtualTable = defineComponent({
|
|
|
195
195
|
emit("row-click", row, globalIdx);
|
|
196
196
|
if (hasSelection.value) toggleRowSelection(key, row);
|
|
197
197
|
};
|
|
198
|
-
const cells = visibleColumns.map(
|
|
199
|
-
|
|
198
|
+
const cells = visibleColumns.map((col, colIdx) => {
|
|
199
|
+
const dataKey = col.dataKey || col.key;
|
|
200
|
+
const value = row[dataKey];
|
|
201
|
+
return h(
|
|
200
202
|
"td",
|
|
201
203
|
{
|
|
202
204
|
key: col.key,
|
|
@@ -218,9 +220,9 @@ var VirtualTable = defineComponent({
|
|
|
218
220
|
),
|
|
219
221
|
style: getVirtualTableFixedCellStyle(col.key, fi)
|
|
220
222
|
},
|
|
221
|
-
|
|
222
|
-
)
|
|
223
|
-
);
|
|
223
|
+
[col.render ? col.render(row, globalIdx) : value]
|
|
224
|
+
);
|
|
225
|
+
});
|
|
224
226
|
const rowChildren = [
|
|
225
227
|
colRange && colRange.leftPad > 0 ? h("td", {
|
|
226
228
|
key: "__left-pad",
|
|
@@ -24,6 +24,31 @@ import {
|
|
|
24
24
|
clipCommentTreeDepth,
|
|
25
25
|
formatCommentTime
|
|
26
26
|
} from "@expcat/tigercat-core";
|
|
27
|
+
|
|
28
|
+
// ../core/src/internal/comment-thread-styles.ts
|
|
29
|
+
var buttonBaseClasses = "tiger-motion-aware px-2 py-0.5 h-auto min-h-0 text-xs rounded-[var(--tiger-radius-md,0.5rem)] [transition:var(--tiger-transition-base,all_200ms_cubic-bezier(0.4,0,0.2,1))]";
|
|
30
|
+
var commentThreadActionButtonClasses = `${buttonBaseClasses} text-[var(--tiger-text-muted,#6b7280)] font-medium flex items-center gap-1.5`;
|
|
31
|
+
var commentThreadPrimaryButtonClasses = `${buttonBaseClasses} text-[var(--tiger-primary,#2563eb)] hover:text-[var(--tiger-primary-hover,#1d4ed8)] font-semibold hover:bg-[var(--tiger-outline-bg-hover,#eff6ff)]`;
|
|
32
|
+
var commentThreadLikeButtonClasses = "hover:text-[var(--tiger-primary,#2563eb)] hover:bg-[var(--tiger-outline-bg-hover,#eff6ff)]";
|
|
33
|
+
var commentThreadLikedButtonClasses = "text-[var(--tiger-primary,#2563eb)] bg-[var(--tiger-outline-bg-hover,#eff6ff)] font-semibold border-[var(--tiger-primary,#2563eb)]/40";
|
|
34
|
+
var commentThreadReplyButtonClasses = "hover:text-[var(--tiger-success,#16a34a)] hover:bg-[var(--tiger-surface-muted,#f9fafb)]";
|
|
35
|
+
var commentThreadNeutralButtonClasses = "hover:text-[var(--tiger-text,#111827)] hover:bg-[var(--tiger-surface-muted,#f3f4f6)]";
|
|
36
|
+
var commentThreadLikeIconClasses = "tiger-motion-aware w-3.5 h-3.5 transition-transform active:scale-125";
|
|
37
|
+
var commentThreadDividerClasses = "border-b border-[var(--tiger-border,#e5e7eb)]";
|
|
38
|
+
var commentThreadAvatarClasses = "tiger-motion-aware shrink-0 mt-0.5 ring-1 ring-[var(--tiger-border,#e5e7eb)] shadow-sm [transition:var(--tiger-transition-base,all_200ms_cubic-bezier(0.4,0,0.2,1))] hover:scale-105";
|
|
39
|
+
var commentThreadAuthorClasses = "tiger-motion-aware text-[var(--tiger-text,#111827)] hover:text-[var(--tiger-primary,#2563eb)] transition-colors cursor-pointer";
|
|
40
|
+
var commentThreadUserTitleClasses = "bg-[var(--tiger-surface-muted,#f3f4f6)] px-1.5 py-0.5 rounded text-[var(--tiger-text-muted,#6b7280)] font-medium";
|
|
41
|
+
var commentThreadTimeClasses = "ml-auto text-[var(--tiger-text-muted,#6b7280)] font-normal";
|
|
42
|
+
var commentThreadContentClasses = "text-sm text-[var(--tiger-text-secondary,#4b5563)] leading-relaxed break-words mt-2 mb-3 pr-2";
|
|
43
|
+
var commentThreadReplyEditorClasses = "tiger-motion-aware mt-3 space-y-3 bg-[var(--tiger-surface-muted,#f9fafb)] border border-[var(--tiger-border,#e5e7eb)] p-4 rounded-[var(--tiger-radius-lg,0.75rem)] shadow-sm [transition:var(--tiger-transition-base,all_200ms_cubic-bezier(0.4,0,0.2,1))]";
|
|
44
|
+
var commentThreadReplyTextareaClasses = "tiger-motion-aware bg-[var(--tiger-surface,#ffffff)] border-[var(--tiger-border,#d1d5db)] focus:ring-2 focus:ring-[var(--tiger-primary,#2563eb)]/20 focus:border-[var(--tiger-primary,#2563eb)] rounded-[var(--tiger-radius-md,0.5rem)] shadow-inner [transition:var(--tiger-transition-base,all_200ms_cubic-bezier(0.4,0,0.2,1))]";
|
|
45
|
+
var commentThreadCancelButtonClasses = "tiger-motion-aware px-3 py-1.5 text-xs text-[var(--tiger-text-muted,#6b7280)] hover:text-[var(--tiger-text,#111827)] rounded-[var(--tiger-radius-md,0.5rem)] transition-colors";
|
|
46
|
+
var commentThreadSubmitButtonClasses = "tiger-motion-aware px-3 py-1.5 text-xs font-semibold shadow-sm hover:shadow rounded-[var(--tiger-radius-md,0.5rem)] [transition:var(--tiger-transition-base,all_200ms_cubic-bezier(0.4,0,0.2,1))]";
|
|
47
|
+
var commentThreadRepliesClasses = "tiger-motion-aware mt-4 ml-1 pl-4 border-l-2 border-[var(--tiger-border,#e5e7eb)] hover:border-[var(--tiger-primary,#2563eb)]/40 space-y-4 transition-colors";
|
|
48
|
+
var commentThreadEmptyClasses = "tiger-motion-aware flex flex-col items-center justify-center border border-dashed border-[var(--tiger-border,#d1d5db)] rounded-[var(--tiger-radius-lg,0.75rem)] py-12 px-4 bg-[var(--tiger-surface-muted,#f9fafb)] transition-colors";
|
|
49
|
+
var commentThreadEmptyIconClasses = "w-10 h-10 text-[var(--tiger-text-muted,#9ca3af)] mb-3";
|
|
50
|
+
|
|
51
|
+
// src/components/CommentThread.ts
|
|
27
52
|
var CommentThread = defineComponent({
|
|
28
53
|
name: "TigerCommentThread",
|
|
29
54
|
inheritAttrs: false,
|
|
@@ -163,9 +188,6 @@ var CommentThread = defineComponent({
|
|
|
163
188
|
updateExpandedKeys(next);
|
|
164
189
|
}
|
|
165
190
|
};
|
|
166
|
-
const BTN_BASE = "px-2 py-0.5 h-auto min-h-0 text-xs rounded-md transition-all duration-200 ease-out";
|
|
167
|
-
const ACTION_BTN = `${BTN_BASE} text-gray-500 dark:text-gray-400 font-medium flex items-center gap-1.5`;
|
|
168
|
-
const PRIMARY_BTN = `${BTN_BASE} text-[var(--tiger-primary,#2563eb)] hover:text-[var(--tiger-primary-hover,#1d4ed8)] dark:text-blue-400 dark:hover:text-blue-300 font-semibold hover:bg-[var(--tiger-primary,#2563eb)]/10 dark:hover:bg-blue-400/10`;
|
|
169
191
|
const renderNode = (node, depth, isLast) => {
|
|
170
192
|
const children = node.children ?? [];
|
|
171
193
|
const hasChildren = children.length > 0;
|
|
@@ -187,9 +209,9 @@ var CommentThread = defineComponent({
|
|
|
187
209
|
size: "sm",
|
|
188
210
|
variant: "ghost",
|
|
189
211
|
className: classNames(
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
node.liked &&
|
|
212
|
+
commentThreadActionButtonClasses,
|
|
213
|
+
commentThreadLikeButtonClasses,
|
|
214
|
+
node.liked && commentThreadLikedButtonClasses
|
|
193
215
|
),
|
|
194
216
|
onClick: () => emit("like", node, !node.liked)
|
|
195
217
|
},
|
|
@@ -199,7 +221,7 @@ var CommentThread = defineComponent({
|
|
|
199
221
|
"svg",
|
|
200
222
|
{
|
|
201
223
|
class: classNames(
|
|
202
|
-
|
|
224
|
+
commentThreadLikeIconClasses,
|
|
203
225
|
node.liked ? "fill-current" : "stroke-current fill-none"
|
|
204
226
|
),
|
|
205
227
|
viewBox: "0 0 24 24",
|
|
@@ -228,8 +250,8 @@ var CommentThread = defineComponent({
|
|
|
228
250
|
size: "sm",
|
|
229
251
|
variant: "ghost",
|
|
230
252
|
className: classNames(
|
|
231
|
-
|
|
232
|
-
|
|
253
|
+
commentThreadActionButtonClasses,
|
|
254
|
+
commentThreadReplyButtonClasses
|
|
233
255
|
),
|
|
234
256
|
onClick: () => {
|
|
235
257
|
replyingTo.value = replyingTo.value === node.id ? null : node.id;
|
|
@@ -270,8 +292,8 @@ var CommentThread = defineComponent({
|
|
|
270
292
|
size: "sm",
|
|
271
293
|
variant: "ghost",
|
|
272
294
|
className: classNames(
|
|
273
|
-
|
|
274
|
-
|
|
295
|
+
commentThreadActionButtonClasses,
|
|
296
|
+
commentThreadNeutralButtonClasses
|
|
275
297
|
),
|
|
276
298
|
onClick: () => emit("more", node)
|
|
277
299
|
},
|
|
@@ -310,7 +332,10 @@ var CommentThread = defineComponent({
|
|
|
310
332
|
key: actionKey,
|
|
311
333
|
size: "sm",
|
|
312
334
|
variant: action.variant ?? "ghost",
|
|
313
|
-
className: classNames(
|
|
335
|
+
className: classNames(
|
|
336
|
+
commentThreadActionButtonClasses,
|
|
337
|
+
commentThreadNeutralButtonClasses
|
|
338
|
+
),
|
|
314
339
|
disabled: action.disabled,
|
|
315
340
|
onClick: () => {
|
|
316
341
|
action.onClick?.(node, action);
|
|
@@ -328,7 +353,7 @@ var CommentThread = defineComponent({
|
|
|
328
353
|
class: classNames(
|
|
329
354
|
"tiger-comment-thread-item",
|
|
330
355
|
depth === 1 && "py-5",
|
|
331
|
-
depth === 1 && !isLast && props.showDivider &&
|
|
356
|
+
depth === 1 && !isLast && props.showDivider && commentThreadDividerClasses
|
|
332
357
|
),
|
|
333
358
|
key: node.id
|
|
334
359
|
},
|
|
@@ -338,7 +363,7 @@ var CommentThread = defineComponent({
|
|
|
338
363
|
size: depth === 1 ? "md" : "sm",
|
|
339
364
|
src: node.user.avatar,
|
|
340
365
|
text: node.user.name,
|
|
341
|
-
className:
|
|
366
|
+
className: commentThreadAvatarClasses
|
|
342
367
|
}) : null,
|
|
343
368
|
h("div", { class: "flex-1 min-w-0" }, [
|
|
344
369
|
h("div", { class: "flex items-center gap-2 flex-wrap" }, [
|
|
@@ -348,7 +373,7 @@ var CommentThread = defineComponent({
|
|
|
348
373
|
tag: "span",
|
|
349
374
|
size: "sm",
|
|
350
375
|
weight: "bold",
|
|
351
|
-
class:
|
|
376
|
+
class: commentThreadAuthorClasses
|
|
352
377
|
},
|
|
353
378
|
{ default: () => node.user?.name }
|
|
354
379
|
) : null,
|
|
@@ -358,7 +383,7 @@ var CommentThread = defineComponent({
|
|
|
358
383
|
tag: "span",
|
|
359
384
|
size: "xs",
|
|
360
385
|
color: "muted",
|
|
361
|
-
class:
|
|
386
|
+
class: commentThreadUserTitleClasses
|
|
362
387
|
},
|
|
363
388
|
{ default: () => node.user?.title }
|
|
364
389
|
) : null,
|
|
@@ -389,7 +414,7 @@ var CommentThread = defineComponent({
|
|
|
389
414
|
tag: "span",
|
|
390
415
|
size: "xs",
|
|
391
416
|
color: "muted",
|
|
392
|
-
class:
|
|
417
|
+
class: commentThreadTimeClasses
|
|
393
418
|
},
|
|
394
419
|
{ default: () => formatCommentTime(node.time) }
|
|
395
420
|
) : null
|
|
@@ -397,7 +422,7 @@ var CommentThread = defineComponent({
|
|
|
397
422
|
h(
|
|
398
423
|
"div",
|
|
399
424
|
{
|
|
400
|
-
class:
|
|
425
|
+
class: commentThreadContentClasses
|
|
401
426
|
},
|
|
402
427
|
String(node.content)
|
|
403
428
|
),
|
|
@@ -405,14 +430,14 @@ var CommentThread = defineComponent({
|
|
|
405
430
|
replyingTo.value === node.id ? h(
|
|
406
431
|
"div",
|
|
407
432
|
{
|
|
408
|
-
class:
|
|
433
|
+
class: commentThreadReplyEditorClasses
|
|
409
434
|
},
|
|
410
435
|
[
|
|
411
436
|
h(Textarea, {
|
|
412
437
|
rows: 3,
|
|
413
438
|
modelValue: replyValue.value,
|
|
414
439
|
placeholder: props.replyPlaceholder,
|
|
415
|
-
className:
|
|
440
|
+
className: commentThreadReplyTextareaClasses,
|
|
416
441
|
"onUpdate:modelValue": (value) => {
|
|
417
442
|
replyValue.value = value;
|
|
418
443
|
}
|
|
@@ -423,7 +448,7 @@ var CommentThread = defineComponent({
|
|
|
423
448
|
{
|
|
424
449
|
size: "sm",
|
|
425
450
|
variant: "ghost",
|
|
426
|
-
className:
|
|
451
|
+
className: commentThreadCancelButtonClasses,
|
|
427
452
|
onClick: () => {
|
|
428
453
|
replyingTo.value = null;
|
|
429
454
|
replyValue.value = "";
|
|
@@ -436,7 +461,7 @@ var CommentThread = defineComponent({
|
|
|
436
461
|
{
|
|
437
462
|
size: "sm",
|
|
438
463
|
variant: "primary",
|
|
439
|
-
className:
|
|
464
|
+
className: commentThreadSubmitButtonClasses,
|
|
440
465
|
onClick: () => handleReplySubmit(node)
|
|
441
466
|
},
|
|
442
467
|
{ default: () => props.replyButtonText }
|
|
@@ -450,8 +475,8 @@ var CommentThread = defineComponent({
|
|
|
450
475
|
size: "sm",
|
|
451
476
|
variant: "ghost",
|
|
452
477
|
className: classNames(
|
|
453
|
-
"mt-2 font-semibold
|
|
454
|
-
|
|
478
|
+
"mt-2 font-semibold",
|
|
479
|
+
commentThreadPrimaryButtonClasses
|
|
455
480
|
),
|
|
456
481
|
"aria-expanded": isExpanded,
|
|
457
482
|
"aria-controls": repliesId,
|
|
@@ -465,7 +490,7 @@ var CommentThread = defineComponent({
|
|
|
465
490
|
"div",
|
|
466
491
|
{
|
|
467
492
|
id: repliesId,
|
|
468
|
-
class:
|
|
493
|
+
class: commentThreadRepliesClasses
|
|
469
494
|
},
|
|
470
495
|
[
|
|
471
496
|
...visibleChildren.map(
|
|
@@ -476,7 +501,7 @@ var CommentThread = defineComponent({
|
|
|
476
501
|
{
|
|
477
502
|
size: "sm",
|
|
478
503
|
variant: "ghost",
|
|
479
|
-
className:
|
|
504
|
+
className: commentThreadPrimaryButtonClasses,
|
|
480
505
|
onClick: () => handleLoadMore(node)
|
|
481
506
|
},
|
|
482
507
|
{ default: () => props.loadMoreText }
|
|
@@ -494,13 +519,13 @@ var CommentThread = defineComponent({
|
|
|
494
519
|
h(
|
|
495
520
|
"div",
|
|
496
521
|
{
|
|
497
|
-
class:
|
|
522
|
+
class: commentThreadEmptyClasses
|
|
498
523
|
},
|
|
499
524
|
[
|
|
500
525
|
h(
|
|
501
526
|
"svg",
|
|
502
527
|
{
|
|
503
|
-
class:
|
|
528
|
+
class: commentThreadEmptyIconClasses,
|
|
504
529
|
fill: "none",
|
|
505
530
|
viewBox: "0 0 24 24",
|
|
506
531
|
stroke: "currentColor",
|