@celestia-island/hikari 0.4.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/README.md +54 -0
- package/package.json +63 -0
- package/src/DemoApp.vue +400 -0
- package/src/components/HkActionBar.tsx +15 -0
- package/src/components/HkAlert.scss +121 -0
- package/src/components/HkAlert.tsx +85 -0
- package/src/components/HkAvatar.tsx +29 -0
- package/src/components/HkBadge.scss +117 -0
- package/src/components/HkBadge.tsx +50 -0
- package/src/components/HkBreadcrumb.tsx +39 -0
- package/src/components/HkButton.scss +128 -0
- package/src/components/HkButton.tsx +74 -0
- package/src/components/HkCard.scss +49 -0
- package/src/components/HkCard.tsx +38 -0
- package/src/components/HkCheckbox.scss +102 -0
- package/src/components/HkCheckbox.tsx +85 -0
- package/src/components/HkCollapse.tsx +48 -0
- package/src/components/HkColorPicker.scss +148 -0
- package/src/components/HkColorPicker.tsx +204 -0
- package/src/components/HkConfirmDialog.scss +12 -0
- package/src/components/HkConfirmDialog.tsx +75 -0
- package/src/components/HkDateTimePicker.scss +361 -0
- package/src/components/HkDateTimePicker.tsx +424 -0
- package/src/components/HkDivider.scss +85 -0
- package/src/components/HkDivider.tsx +51 -0
- package/src/components/HkDraggableGrid.scss +132 -0
- package/src/components/HkDraggableGrid.tsx +291 -0
- package/src/components/HkDraggableList.scss +110 -0
- package/src/components/HkDraggableList.tsx +238 -0
- package/src/components/HkDrawer.scss +175 -0
- package/src/components/HkDrawer.tsx +171 -0
- package/src/components/HkEmptyState.scss +42 -0
- package/src/components/HkEmptyState.tsx +41 -0
- package/src/components/HkErrorBoundary.scss +64 -0
- package/src/components/HkErrorBoundary.tsx +82 -0
- package/src/components/HkGaugeRing.scss +4 -0
- package/src/components/HkGaugeRing.tsx +130 -0
- package/src/components/HkHoverRevealAction.scss +66 -0
- package/src/components/HkHoverRevealAction.tsx +77 -0
- package/src/components/HkIcon.tsx +43 -0
- package/src/components/HkIconButton.tsx +42 -0
- package/src/components/HkImageViewer.scss +33 -0
- package/src/components/HkImageViewer.tsx +250 -0
- package/src/components/HkInput.scss +172 -0
- package/src/components/HkInput.tsx +175 -0
- package/src/components/HkKbd.tsx +26 -0
- package/src/components/HkKeywordSearchModal.scss +148 -0
- package/src/components/HkKeywordSearchModal.tsx +308 -0
- package/src/components/HkListTransition.scss +131 -0
- package/src/components/HkListTransition.tsx +29 -0
- package/src/components/HkLocalePickerPopup.tsx +42 -0
- package/src/components/HkLogo.scss +36 -0
- package/src/components/HkLogo.tsx +93 -0
- package/src/components/HkMarkdownRenderer.scss +141 -0
- package/src/components/HkMarkdownRenderer.tsx +123 -0
- package/src/components/HkMediaControlBar.scss +65 -0
- package/src/components/HkMediaControlBar.tsx +115 -0
- package/src/components/HkMediaPlayer.scss +29 -0
- package/src/components/HkMediaPlayer.tsx +210 -0
- package/src/components/HkMediaSlider.scss +54 -0
- package/src/components/HkMediaSlider.tsx +81 -0
- package/src/components/HkMediaVisualizer.scss +7 -0
- package/src/components/HkMediaVisualizer.tsx +119 -0
- package/src/components/HkMinimap.scss +76 -0
- package/src/components/HkMinimap.tsx +255 -0
- package/src/components/HkModal.scss +318 -0
- package/src/components/HkModal.tsx +481 -0
- package/src/components/HkModalBreadcrumb.scss +55 -0
- package/src/components/HkModalBreadcrumb.tsx +113 -0
- package/src/components/HkMorphingTabs.scss +141 -0
- package/src/components/HkMorphingTabs.tsx +113 -0
- package/src/components/HkNavItem.scss +81 -0
- package/src/components/HkNavItem.tsx +157 -0
- package/src/components/HkNumberInput.scss +154 -0
- package/src/components/HkNumberInput.tsx +161 -0
- package/src/components/HkPasswordInput.scss +289 -0
- package/src/components/HkPasswordInput.tsx +533 -0
- package/src/components/HkPhaseTransition.scss +25 -0
- package/src/components/HkPhaseTransition.tsx +40 -0
- package/src/components/HkPopover.scss +82 -0
- package/src/components/HkPopover.tsx +410 -0
- package/src/components/HkPopupSelect.scss +136 -0
- package/src/components/HkPopupSelect.tsx +199 -0
- package/src/components/HkProgressBar.scss +106 -0
- package/src/components/HkProgressBar.tsx +61 -0
- package/src/components/HkProgressDialog.tsx +67 -0
- package/src/components/HkProgressRing.scss +56 -0
- package/src/components/HkProgressRing.tsx +82 -0
- package/src/components/HkRadio.scss +119 -0
- package/src/components/HkRadio.tsx +75 -0
- package/src/components/HkRollingNumber.scss +37 -0
- package/src/components/HkRollingNumber.tsx +97 -0
- package/src/components/HkScrollContainer.scss +101 -0
- package/src/components/HkScrollContainer.tsx +362 -0
- package/src/components/HkSearchInput.scss +132 -0
- package/src/components/HkSearchInput.tsx +117 -0
- package/src/components/HkSelect.scss +143 -0
- package/src/components/HkSelect.tsx +230 -0
- package/src/components/HkSelectionGrid.scss +177 -0
- package/src/components/HkSelectionGrid.tsx +99 -0
- package/src/components/HkSelectionWaterfall.scss +93 -0
- package/src/components/HkSelectionWaterfall.tsx +90 -0
- package/src/components/HkSidebar.scss +81 -0
- package/src/components/HkSidebar.tsx +45 -0
- package/src/components/HkSkeleton.scss +44 -0
- package/src/components/HkSkeleton.tsx +30 -0
- package/src/components/HkSkeletonList.tsx +35 -0
- package/src/components/HkSpinner.scss +67 -0
- package/src/components/HkSpinner.tsx +41 -0
- package/src/components/HkSplash.scss +60 -0
- package/src/components/HkSplash.tsx +40 -0
- package/src/components/HkSwitch.scss +157 -0
- package/src/components/HkSwitch.tsx +72 -0
- package/src/components/HkTable.scss +198 -0
- package/src/components/HkTable.tsx +246 -0
- package/src/components/HkTabs.scss +109 -0
- package/src/components/HkTabs.tsx +111 -0
- package/src/components/HkTag.scss +88 -0
- package/src/components/HkTag.tsx +44 -0
- package/src/components/HkTextarea.scss +72 -0
- package/src/components/HkTextarea.tsx +104 -0
- package/src/components/HkTimeline.scss +139 -0
- package/src/components/HkTimeline.tsx +95 -0
- package/src/components/HkToast.scss +168 -0
- package/src/components/HkToast.tsx +175 -0
- package/src/components/HkTooltip.scss +47 -0
- package/src/components/HkTooltip.tsx +108 -0
- package/src/components/HkTree.scss +188 -0
- package/src/components/HkTree.tsx +217 -0
- package/src/components/HkTrendChart.tsx +180 -0
- package/src/components/HkWindowedItem.scss +17 -0
- package/src/components/HkWindowedItem.tsx +107 -0
- package/src/components/HkZoomToolbar.scss +35 -0
- package/src/components/HkZoomToolbar.tsx +69 -0
- package/src/composables/useBreakpoint.ts +41 -0
- package/src/composables/useClipboard.ts +37 -0
- package/src/composables/useConfirm.ts +35 -0
- package/src/composables/useProgressDialog.ts +52 -0
- package/src/composables/useReportedTransition.ts +69 -0
- package/src/composables/useScrollWindow.ts +21 -0
- package/src/composables/useToast.ts +2 -0
- package/src/demo.scss +24 -0
- package/src/demo.ts +22 -0
- package/src/env.d.ts +6 -0
- package/src/i18n/context.ts +89 -0
- package/src/i18n/locales/ar/components.json +43 -0
- package/src/i18n/locales/ar/components.toml +40 -0
- package/src/i18n/locales/de/components.json +43 -0
- package/src/i18n/locales/de/components.toml +40 -0
- package/src/i18n/locales/en/components.json +43 -0
- package/src/i18n/locales/en/components.toml +40 -0
- package/src/i18n/locales/es/components.json +43 -0
- package/src/i18n/locales/es/components.toml +40 -0
- package/src/i18n/locales/fr/components.json +43 -0
- package/src/i18n/locales/fr/components.toml +40 -0
- package/src/i18n/locales/ja/components.json +43 -0
- package/src/i18n/locales/ja/components.toml +40 -0
- package/src/i18n/locales/ko/components.json +43 -0
- package/src/i18n/locales/ko/components.toml +40 -0
- package/src/i18n/locales/pt/components.json +43 -0
- package/src/i18n/locales/pt/components.toml +40 -0
- package/src/i18n/locales/ru/components.json +43 -0
- package/src/i18n/locales/ru/components.toml +40 -0
- package/src/i18n/locales/zh-Hans/components.json +43 -0
- package/src/i18n/locales/zh-Hans/components.toml +40 -0
- package/src/i18n/locales/zh-Hant/components.json +43 -0
- package/src/i18n/locales/zh-Hant/components.toml +40 -0
- package/src/index.ts +137 -0
- package/src/render.ts +18 -0
- package/src/runtime/animationBus.ts +278 -0
- package/src/runtime/cronBus.ts +25 -0
- package/src/runtime/index.ts +12 -0
- package/src/runtime/useAsyncData.ts +30 -0
- package/src/runtime/useBreakpoint.ts +62 -0
- package/src/runtime/useClipboard.ts +37 -0
- package/src/runtime/useConfirm.ts +35 -0
- package/src/runtime/useOverlay.ts +82 -0
- package/src/runtime/usePopupManager.ts +89 -0
- package/src/runtime/useToast.ts +140 -0
- package/src/styles/index.scss +10 -0
- package/src/theme/index.ts +5 -0
- package/src/theme/presets.ts +307 -0
- package/src/theme/theme.scss +17 -0
- package/src/theme/useBackgroundLuminance.ts +145 -0
- package/src/theme/useSolarTime.ts +101 -0
- package/src/theme/useTheme.ts +141 -0
- package/src/tokens.scss +26 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/* HkSpinner — pure-CSS infinite spinner. */
|
|
2
|
+
.hk-spinner-wrapper {
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: var(--space-8);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.hk-spinner-centered {
|
|
9
|
+
justify-content: center;
|
|
10
|
+
padding: var(--space-32) 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.hk-spinner {
|
|
14
|
+
border: 2px solid rgb(var(--color-border) / 20%);
|
|
15
|
+
border-top-color: rgb(var(--color-primary));
|
|
16
|
+
border-radius: 50%;
|
|
17
|
+
animation: hk-spinner-rotate 0.7s linear infinite;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* tone="current" — same shape/duration as the default, but colored with
|
|
21
|
+
currentcolor so the spinner matches surrounding text (e.g. inside a
|
|
22
|
+
colored HkButton). Track = faded currentcolor, arc = full currentcolor. */
|
|
23
|
+
.hk-spinner-current {
|
|
24
|
+
border-color: color-mix(in srgb, currentcolor 30%, transparent);
|
|
25
|
+
border-top-color: currentcolor;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.hk-spinner-xs {
|
|
29
|
+
width: 12px;
|
|
30
|
+
height: 12px;
|
|
31
|
+
border-width: 1.5px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.hk-spinner-sm {
|
|
35
|
+
width: 16px;
|
|
36
|
+
height: 16px;
|
|
37
|
+
border-width: 2px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.hk-spinner-md {
|
|
41
|
+
width: 24px;
|
|
42
|
+
height: 24px;
|
|
43
|
+
border-width: 3px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.hk-spinner-lg {
|
|
47
|
+
width: 36px;
|
|
48
|
+
height: 36px;
|
|
49
|
+
border-width: 3px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.hk-spinner-xl {
|
|
53
|
+
width: 48px;
|
|
54
|
+
height: 48px;
|
|
55
|
+
border-width: 4px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.hk-spinner-text {
|
|
59
|
+
font-size: var(--text-base);
|
|
60
|
+
color: color-mix(in srgb, rgb(var(--color-muted)) 70%, rgb(var(--color-background)));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@keyframes hk-spinner-rotate {
|
|
64
|
+
to {
|
|
65
|
+
transform: rotate(360deg);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { computed, defineComponent, type PropType } from "vue";
|
|
2
|
+
import "./HkSpinner.scss";
|
|
3
|
+
|
|
4
|
+
export type SpinnerSize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
5
|
+
|
|
6
|
+
export default defineComponent({
|
|
7
|
+
name: "HkSpinner",
|
|
8
|
+
props: {
|
|
9
|
+
size: {
|
|
10
|
+
type: [String, Number] as PropType<SpinnerSize | number>,
|
|
11
|
+
default: "md",
|
|
12
|
+
},
|
|
13
|
+
text: { type: String, default: undefined },
|
|
14
|
+
center: { type: Boolean, default: false },
|
|
15
|
+
tone: { type: String as PropType<"primary" | "current">, default: "primary" },
|
|
16
|
+
},
|
|
17
|
+
setup(props) {
|
|
18
|
+
const sizeClass = computed(() =>
|
|
19
|
+
typeof props.size === "string" ? `hk-spinner-${props.size}` : "",
|
|
20
|
+
);
|
|
21
|
+
const sizeStyle = computed(() =>
|
|
22
|
+
typeof props.size === "number"
|
|
23
|
+
? { width: `${props.size}px`, height: `${props.size}px` }
|
|
24
|
+
: null,
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
return () => (
|
|
28
|
+
<div class={["hk-spinner-wrapper", props.center && "hk-spinner-centered"]}>
|
|
29
|
+
<div
|
|
30
|
+
class={[
|
|
31
|
+
"hk-spinner",
|
|
32
|
+
sizeClass.value,
|
|
33
|
+
props.tone === "current" && "hk-spinner-current",
|
|
34
|
+
]}
|
|
35
|
+
style={sizeStyle.value ?? undefined}
|
|
36
|
+
/>
|
|
37
|
+
{props.text ? <span class="hk-spinner-text">{props.text}</span> : null}
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
},
|
|
41
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
.hk-splash {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
min-height: 100vh;
|
|
7
|
+
background: var(--hi-color-bg-canvas, #0d1117);
|
|
8
|
+
color: var(--hi-color-text-primary, #c9d1d9);
|
|
9
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.hk-splash-main {
|
|
13
|
+
text-align: center;
|
|
14
|
+
max-width: 480px;
|
|
15
|
+
padding: 2rem;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.hk-splash-logo {
|
|
19
|
+
width: 80px;
|
|
20
|
+
height: 80px;
|
|
21
|
+
margin-bottom: 1.5rem;
|
|
22
|
+
border-radius: 16px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.hk-splash-title {
|
|
26
|
+
font-size: 2rem;
|
|
27
|
+
font-weight: 700;
|
|
28
|
+
color: var(--hi-color-primary, #58a6ff);
|
|
29
|
+
margin: 0 0 0.5rem;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.hk-splash-subtitle {
|
|
33
|
+
font-size: 1.1rem;
|
|
34
|
+
color: var(--hi-color-text-secondary, #8b949e);
|
|
35
|
+
margin: 0 0 0.5rem;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.hk-splash-description {
|
|
39
|
+
font-size: 0.9rem;
|
|
40
|
+
color: var(--hi-color-text-tertiary, #6e7681);
|
|
41
|
+
margin-bottom: 1rem;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.hk-splash-status {
|
|
45
|
+
margin-bottom: 1.5rem;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.hk-splash-actions {
|
|
49
|
+
display: flex;
|
|
50
|
+
gap: 0.75rem;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
flex-wrap: wrap;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.hk-splash-footer {
|
|
56
|
+
margin-top: auto;
|
|
57
|
+
padding: 1rem;
|
|
58
|
+
font-size: 0.75rem;
|
|
59
|
+
color: var(--hi-color-text-tertiary, #484f58);
|
|
60
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { defineComponent, type PropType } from "vue";
|
|
2
|
+
import HBadge from "./HkBadge";
|
|
3
|
+
import "./HkSplash.scss";
|
|
4
|
+
|
|
5
|
+
export default defineComponent({
|
|
6
|
+
name: "HkSplash",
|
|
7
|
+
props: {
|
|
8
|
+
logo: { type: String, default: "" },
|
|
9
|
+
title: { type: String, default: "" },
|
|
10
|
+
subtitle: { type: String, default: "" },
|
|
11
|
+
status: { type: String as PropType<"online" | "offline" | "loading" | "coming-soon">, default: "coming-soon" },
|
|
12
|
+
statusLabel: { type: String, default: "" },
|
|
13
|
+
},
|
|
14
|
+
setup(props, { slots }) {
|
|
15
|
+
const statusVariant: Record<string, "success" | "error" | "warning" | "primary"> = {
|
|
16
|
+
online: "success",
|
|
17
|
+
offline: "error",
|
|
18
|
+
loading: "warning",
|
|
19
|
+
"coming-soon": "primary",
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return () => (
|
|
23
|
+
<div class="hk-splash">
|
|
24
|
+
<main class="hk-splash-main">
|
|
25
|
+
{props.logo ? <img class="hk-splash-logo" src={props.logo} alt={props.title || "logo"} /> : null}
|
|
26
|
+
<h1 class="hk-splash-title">{props.title || slots.title?.()}</h1>
|
|
27
|
+
{props.subtitle ? <p class="hk-splash-subtitle">{props.subtitle}</p> : null}
|
|
28
|
+
{slots.description ? <div class="hk-splash-description">{slots.description?.()}</div> : null}
|
|
29
|
+
<div class="hk-splash-status">
|
|
30
|
+
<HBadge variant={statusVariant[props.status] || "primary"} size="md">
|
|
31
|
+
{props.statusLabel || props.status}
|
|
32
|
+
</HBadge>
|
|
33
|
+
</div>
|
|
34
|
+
{slots.actions ? <div class="hk-splash-actions">{slots.actions?.()}</div> : null}
|
|
35
|
+
</main>
|
|
36
|
+
{slots.footer ? <footer class="hk-splash-footer">{slots.footer?.()}</footer> : null}
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
},
|
|
40
|
+
});
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
.hk-switch {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: 0.5rem;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
user-select: none;
|
|
7
|
+
|
|
8
|
+
&[data-disabled] {
|
|
9
|
+
opacity: 0.5;
|
|
10
|
+
cursor: not-allowed;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.hk-switch-input {
|
|
15
|
+
position: absolute;
|
|
16
|
+
width: 0;
|
|
17
|
+
height: 0;
|
|
18
|
+
opacity: 0;
|
|
19
|
+
pointer-events: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* --- Track --- */
|
|
23
|
+
|
|
24
|
+
.hk-switch-track {
|
|
25
|
+
position: relative;
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
border-radius: 9999px;
|
|
29
|
+
border: 1px solid var(--hi-color-border);
|
|
30
|
+
background: var(--hi-color-surface);
|
|
31
|
+
transition:
|
|
32
|
+
background-color 0.3s ease,
|
|
33
|
+
border-color 0.3s ease;
|
|
34
|
+
flex-shrink: 0;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
|
|
37
|
+
.hk-switch-sm & {
|
|
38
|
+
width: 2rem;
|
|
39
|
+
height: 1.125rem;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.hk-switch-md & {
|
|
43
|
+
width: 2.5rem;
|
|
44
|
+
height: 1.375rem;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.hk-switch-lg & {
|
|
48
|
+
width: 3rem;
|
|
49
|
+
height: 1.625rem;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.hk-switch-primary[data-checked] & {
|
|
53
|
+
background: var(--hi-color-primary);
|
|
54
|
+
border-color: var(--hi-color-primary);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.hk-switch-secondary[data-checked] & {
|
|
58
|
+
background: var(--hi-color-secondary);
|
|
59
|
+
border-color: var(--hi-color-secondary);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.hk-switch-danger[data-checked] & {
|
|
63
|
+
background: var(--hi-color-danger);
|
|
64
|
+
border-color: var(--hi-color-danger);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.hk-switch-warning[data-checked] & {
|
|
68
|
+
background: var(--hi-color-warning);
|
|
69
|
+
border-color: var(--hi-color-warning);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* --- Thumb --- */
|
|
74
|
+
|
|
75
|
+
.hk-switch-thumb {
|
|
76
|
+
position: absolute;
|
|
77
|
+
border-radius: 50%;
|
|
78
|
+
background: var(--hi-color-text-on-primary, #fff);
|
|
79
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
|
|
80
|
+
transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
|
81
|
+
z-index: 1;
|
|
82
|
+
|
|
83
|
+
.hk-switch-sm & {
|
|
84
|
+
width: 0.75rem;
|
|
85
|
+
height: 0.75rem;
|
|
86
|
+
left: 2px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.hk-switch-md & {
|
|
90
|
+
width: 0.9375rem;
|
|
91
|
+
height: 0.9375rem;
|
|
92
|
+
left: 2px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.hk-switch-lg & {
|
|
96
|
+
width: 1.125rem;
|
|
97
|
+
height: 1.125rem;
|
|
98
|
+
left: 2px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.hk-switch-sm[data-checked] & {
|
|
102
|
+
transform: translateX(0.813rem);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.hk-switch-md[data-checked] & {
|
|
106
|
+
transform: translateX(1.12rem);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.hk-switch-lg[data-checked] & {
|
|
110
|
+
transform: translateX(1.375rem);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* --- Content text inside track --- */
|
|
115
|
+
|
|
116
|
+
.hk-switch-content {
|
|
117
|
+
position: absolute;
|
|
118
|
+
font-size: 0.5625rem;
|
|
119
|
+
font-weight: 700;
|
|
120
|
+
line-height: 1;
|
|
121
|
+
white-space: nowrap;
|
|
122
|
+
z-index: 0;
|
|
123
|
+
transition: opacity 0.2s ease;
|
|
124
|
+
|
|
125
|
+
.hk-switch-sm & {
|
|
126
|
+
font-size: 0.4375rem;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.hk-switch-lg & {
|
|
130
|
+
font-size: 0.625rem;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&-off {
|
|
134
|
+
right: 4px;
|
|
135
|
+
color: var(--hi-color-text-secondary);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&-on {
|
|
139
|
+
left: 4px;
|
|
140
|
+
color: var(--hi-color-text-on-primary, #fff);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* --- Label --- */
|
|
145
|
+
|
|
146
|
+
.hk-switch-label-text {
|
|
147
|
+
font-size: 0.875rem;
|
|
148
|
+
color: var(--hi-color-text-primary);
|
|
149
|
+
|
|
150
|
+
.hk-switch-sm & {
|
|
151
|
+
font-size: 0.75rem;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.hk-switch-lg & {
|
|
155
|
+
font-size: 1rem;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { computed, defineComponent, type PropType } from "vue";
|
|
2
|
+
import "./HkSwitch.scss";
|
|
3
|
+
|
|
4
|
+
export default defineComponent({
|
|
5
|
+
name: "HkSwitch",
|
|
6
|
+
props: {
|
|
7
|
+
modelValue: { type: Boolean, default: false },
|
|
8
|
+
disabled: { type: Boolean, default: false },
|
|
9
|
+
size: {
|
|
10
|
+
type: String as PropType<"sm" | "md" | "lg">,
|
|
11
|
+
default: "md",
|
|
12
|
+
},
|
|
13
|
+
color: {
|
|
14
|
+
type: String as PropType<"primary" | "secondary" | "danger" | "warning">,
|
|
15
|
+
default: "primary",
|
|
16
|
+
},
|
|
17
|
+
label: { type: String, default: undefined },
|
|
18
|
+
checkedContent: { type: String, default: undefined },
|
|
19
|
+
uncheckedContent: { type: String, default: undefined },
|
|
20
|
+
},
|
|
21
|
+
emits: {
|
|
22
|
+
"update:modelValue": (_value: boolean) => true,
|
|
23
|
+
},
|
|
24
|
+
setup(props, { emit }) {
|
|
25
|
+
function toggle() {
|
|
26
|
+
if (props.disabled) return;
|
|
27
|
+
emit("update:modelValue", !props.modelValue);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return () => (
|
|
31
|
+
<label
|
|
32
|
+
class={[
|
|
33
|
+
"hk-switch",
|
|
34
|
+
`hk-switch-${props.size}`,
|
|
35
|
+
`hk-switch-${props.color}`,
|
|
36
|
+
]}
|
|
37
|
+
data-checked={props.modelValue ? "" : undefined}
|
|
38
|
+
data-disabled={props.disabled ? "" : undefined}
|
|
39
|
+
>
|
|
40
|
+
<input
|
|
41
|
+
class="hk-switch-input"
|
|
42
|
+
type="checkbox"
|
|
43
|
+
checked={props.modelValue}
|
|
44
|
+
disabled={props.disabled}
|
|
45
|
+
onChange={toggle}
|
|
46
|
+
/>
|
|
47
|
+
<span
|
|
48
|
+
class="hk-switch-track"
|
|
49
|
+
onClick={(e: MouseEvent) => {
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
toggle();
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
54
|
+
<span class="hk-switch-thumb" />
|
|
55
|
+
{props.uncheckedContent && !props.modelValue ? (
|
|
56
|
+
<span class="hk-switch-content hk-switch-content-off">
|
|
57
|
+
{props.uncheckedContent}
|
|
58
|
+
</span>
|
|
59
|
+
) : null}
|
|
60
|
+
{props.checkedContent && props.modelValue ? (
|
|
61
|
+
<span class="hk-switch-content hk-switch-content-on">
|
|
62
|
+
{props.checkedContent}
|
|
63
|
+
</span>
|
|
64
|
+
) : null}
|
|
65
|
+
</span>
|
|
66
|
+
{props.label ? (
|
|
67
|
+
<span class="hk-switch-label-text">{props.label}</span>
|
|
68
|
+
) : null}
|
|
69
|
+
</label>
|
|
70
|
+
);
|
|
71
|
+
},
|
|
72
|
+
});
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
.hk-table-wrapper {
|
|
2
|
+
width: 100%;
|
|
3
|
+
overflow-x: auto;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.hk-table {
|
|
7
|
+
width: 100%;
|
|
8
|
+
font-size: var(--hi-text-base, 1rem);
|
|
9
|
+
border-collapse: collapse;
|
|
10
|
+
color: var(--hi-color-text-primary, #c9d1d9);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.hk-table-header-row {
|
|
14
|
+
border-bottom: 1px solid var(--hi-color-border, rgba(255, 255, 255, 0.08));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.hk-table-header-cell {
|
|
18
|
+
padding: var(--hi-space-12, 12px) var(--hi-space-16, 16px);
|
|
19
|
+
text-align: left;
|
|
20
|
+
font-size: var(--hi-text-xs, 0.75rem);
|
|
21
|
+
font-weight: 600;
|
|
22
|
+
color: var(--hi-color-text-secondary, #8b949e);
|
|
23
|
+
text-transform: uppercase;
|
|
24
|
+
letter-spacing: 0.05em;
|
|
25
|
+
white-space: nowrap;
|
|
26
|
+
user-select: none;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.hk-table-header-sortable {
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
transition: color var(--hi-duration-short, 0.15s) var(--hi-ease-default, cubic-bezier(0.4, 0, 0.2, 1));
|
|
32
|
+
|
|
33
|
+
&:hover {
|
|
34
|
+
color: var(--hi-color-primary, #58a6ff);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.hk-table-header-sorted {
|
|
39
|
+
color: var(--hi-color-primary, #58a6ff);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.hk-table-header-label {
|
|
43
|
+
display: inline-flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
gap: 4px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.hk-table-sort-icon {
|
|
49
|
+
width: 14px;
|
|
50
|
+
height: 14px;
|
|
51
|
+
display: inline-block;
|
|
52
|
+
vertical-align: middle;
|
|
53
|
+
transition: transform var(--hi-duration-short, 0.15s) var(--hi-ease-default, cubic-bezier(0.4, 0, 0.2, 1));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.hk-table-sort-icon-desc {
|
|
57
|
+
transform: rotate(180deg);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.hk-table-body {
|
|
61
|
+
.hk-table-row {
|
|
62
|
+
border-bottom: 1px solid var(--hi-color-border, rgba(255, 255, 255, 0.05));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.hk-table-hover .hk-table-row:hover {
|
|
67
|
+
background: var(--hi-color-bg-subtle, rgba(255, 255, 255, 0.04));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.hk-table-striped .hk-table-row:nth-child(even) {
|
|
71
|
+
background: var(--hi-color-bg-subtle, rgba(255, 255, 255, 0.03));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.hk-table-bordered {
|
|
75
|
+
border: 1px solid var(--hi-color-border, rgba(255, 255, 255, 0.1));
|
|
76
|
+
border-radius: var(--hi-radius-md, 8px);
|
|
77
|
+
|
|
78
|
+
.hk-table-header-cell,
|
|
79
|
+
.hk-table-cell {
|
|
80
|
+
border: 1px solid var(--hi-color-border, rgba(255, 255, 255, 0.06));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.hk-table-header-cell {
|
|
84
|
+
border-bottom: 2px solid var(--hi-color-border, rgba(255, 255, 255, 0.1));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.hk-table-cell {
|
|
89
|
+
padding: var(--hi-space-12, 12px) var(--hi-space-16, 16px);
|
|
90
|
+
color: var(--hi-color-text-primary, #c9d1d9);
|
|
91
|
+
vertical-align: middle;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* Size variants */
|
|
95
|
+
.hk-table-sm {
|
|
96
|
+
.hk-table-header-cell,
|
|
97
|
+
.hk-table-cell {
|
|
98
|
+
padding: var(--hi-space-4, 4px) var(--hi-space-8, 8px);
|
|
99
|
+
font-size: var(--hi-text-xs, 0.75rem);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.hk-table-md {
|
|
104
|
+
.hk-table-header-cell,
|
|
105
|
+
.hk-table-cell {
|
|
106
|
+
padding: var(--hi-space-8, 8px) var(--hi-space-12, 12px);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.hk-table-lg {
|
|
111
|
+
.hk-table-header-cell,
|
|
112
|
+
.hk-table-cell {
|
|
113
|
+
padding: var(--hi-space-16, 16px) var(--hi-space-24, 24px);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.hk-table-empty {
|
|
118
|
+
padding: var(--hi-space-32, 32px) var(--hi-space-16, 16px);
|
|
119
|
+
text-align: center;
|
|
120
|
+
color: var(--hi-color-text-secondary, #8b949e);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* Alignment helpers */
|
|
124
|
+
.hk-text-left {
|
|
125
|
+
text-align: left;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.hk-text-center {
|
|
129
|
+
text-align: center;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.hk-text-right {
|
|
133
|
+
text-align: right;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* Checkbox styles inline */
|
|
137
|
+
.hk-table-checkbox-label {
|
|
138
|
+
display: inline-flex;
|
|
139
|
+
align-items: center;
|
|
140
|
+
cursor: pointer;
|
|
141
|
+
user-select: none;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.hk-table-checkbox-input {
|
|
145
|
+
position: absolute;
|
|
146
|
+
opacity: 0;
|
|
147
|
+
width: 0;
|
|
148
|
+
height: 0;
|
|
149
|
+
pointer-events: none;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.hk-table-checkbox {
|
|
153
|
+
display: inline-flex;
|
|
154
|
+
align-items: center;
|
|
155
|
+
justify-content: center;
|
|
156
|
+
flex-shrink: 0;
|
|
157
|
+
border: 2px solid var(--hi-color-border, rgba(255, 255, 255, 0.2));
|
|
158
|
+
border-radius: var(--hi-radius-sm, 4px);
|
|
159
|
+
background: transparent;
|
|
160
|
+
transition:
|
|
161
|
+
background-color var(--hi-duration-short, 0.15s) var(--hi-ease-default, cubic-bezier(0.4, 0, 0.2, 1)),
|
|
162
|
+
border-color var(--hi-duration-short, 0.15s) var(--hi-ease-default, cubic-bezier(0.4, 0, 0.2, 1));
|
|
163
|
+
|
|
164
|
+
&-md {
|
|
165
|
+
width: 16px;
|
|
166
|
+
height: 16px;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&-checked {
|
|
170
|
+
background: var(--hi-color-primary, #58a6ff);
|
|
171
|
+
border-color: var(--hi-color-primary, #58a6ff);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.hk-table-checkbox-input:focus-visible + & {
|
|
175
|
+
box-shadow:
|
|
176
|
+
0 0 0 2px var(--hi-color-bg-canvas, #0d1117),
|
|
177
|
+
0 0 0 4px var(--hi-color-primary, #58a6ff);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.hk-table-checkbox-icon {
|
|
182
|
+
width: 12px;
|
|
183
|
+
height: 12px;
|
|
184
|
+
color: var(--hi-color-text-on-primary, #ffffff);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/* SR-only utility */
|
|
188
|
+
.sr-only {
|
|
189
|
+
position: absolute;
|
|
190
|
+
width: 1px;
|
|
191
|
+
height: 1px;
|
|
192
|
+
padding: 0;
|
|
193
|
+
margin: -1px;
|
|
194
|
+
overflow: hidden;
|
|
195
|
+
clip: rect(0, 0, 0, 0);
|
|
196
|
+
white-space: nowrap;
|
|
197
|
+
border: 0;
|
|
198
|
+
}
|