@skewedaspect/sleekspace-ui 0.2.0-beta.1
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/LICENSE +21 -0
- package/README.md +111 -0
- package/dist/sleekspace-ui.css +12844 -0
- package/dist/sleekspace-ui.es.js +19021 -0
- package/dist/sleekspace-ui.umd.js +19040 -0
- package/docs/components/accordion.md +92 -0
- package/docs/components/alert.md +72 -0
- package/docs/components/avatar.md +69 -0
- package/docs/components/breadcrumbs.md +65 -0
- package/docs/components/button/_meta.yaml +12 -0
- package/docs/components/button/accessibility.md +16 -0
- package/docs/components/button/custom-colors.md +18 -0
- package/docs/components/button/icons.md +31 -0
- package/docs/components/button/intro.md +8 -0
- package/docs/components/button/kinds.md +25 -0
- package/docs/components/button/sizes.md +14 -0
- package/docs/components/button/states.md +12 -0
- package/docs/components/button/usage.md +23 -0
- package/docs/components/button/variants.md +14 -0
- package/docs/components/button.md +110 -0
- package/docs/components/card.md +87 -0
- package/docs/components/checkbox.md +77 -0
- package/docs/components/collapsible.md +71 -0
- package/docs/components/divider.md +62 -0
- package/docs/components/dropdown.md +88 -0
- package/docs/components/field.md +80 -0
- package/docs/components/group.md +41 -0
- package/docs/components/input.md +84 -0
- package/docs/components/listbox.md +82 -0
- package/docs/components/modal.md +101 -0
- package/docs/components/navbar.md +64 -0
- package/docs/components/number-input.md +78 -0
- package/docs/components/page.md +77 -0
- package/docs/components/pagination.md +88 -0
- package/docs/components/panel.md +74 -0
- package/docs/components/popover.md +93 -0
- package/docs/components/progress.md +76 -0
- package/docs/components/radio.md +86 -0
- package/docs/components/sidebar.md +74 -0
- package/docs/components/skeleton.md +76 -0
- package/docs/components/slider.md +94 -0
- package/docs/components/spinner.md +59 -0
- package/docs/components/switch.md +97 -0
- package/docs/components/table.md +91 -0
- package/docs/components/tabs.md +108 -0
- package/docs/components/tag.md +75 -0
- package/docs/components/tags-input.md +88 -0
- package/docs/components/textarea.md +80 -0
- package/docs/components/theme.md +65 -0
- package/docs/components/toast.md +95 -0
- package/docs/components/tooltip.md +90 -0
- package/docs/guides/custom-colors.md +84 -0
- package/docs/guides/design-tokens.md +105 -0
- package/docs/guides/getting-started.md +144 -0
- package/docs/guides/installation.md +62 -0
- package/docs/guides/theming.md +101 -0
- package/package.json +76 -0
- package/src/components/Accordion/SkAccordion.vue +133 -0
- package/src/components/Accordion/SkAccordionItem.vue +131 -0
- package/src/components/Accordion/index.ts +3 -0
- package/src/components/Accordion/types.ts +9 -0
- package/src/components/Alert/SkAlert.vue +137 -0
- package/src/components/Alert/types.ts +10 -0
- package/src/components/Avatar/SkAvatar.vue +141 -0
- package/src/components/Avatar/index.ts +8 -0
- package/src/components/Avatar/types.ts +31 -0
- package/src/components/Breadcrumbs/SkBreadcrumbItem.vue +76 -0
- package/src/components/Breadcrumbs/SkBreadcrumbSeparator.vue +38 -0
- package/src/components/Breadcrumbs/SkBreadcrumbs.vue +93 -0
- package/src/components/Breadcrumbs/index.ts +10 -0
- package/src/components/Breadcrumbs/types.ts +36 -0
- package/src/components/Button/SkButton.vue +148 -0
- package/src/components/Button/types.ts +21 -0
- package/src/components/Card/SkCard.vue +144 -0
- package/src/components/Card/types.ts +12 -0
- package/src/components/Checkbox/SkCheckbox.vue +136 -0
- package/src/components/Checkbox/index.ts +8 -0
- package/src/components/Checkbox/types.ts +10 -0
- package/src/components/Collapsible/SkCollapsible.vue +159 -0
- package/src/components/Collapsible/index.ts +2 -0
- package/src/components/Collapsible/types.ts +8 -0
- package/src/components/Divider/SkDivider.vue +63 -0
- package/src/components/Divider/types.ts +15 -0
- package/src/components/Dropdown/SkDropdown.vue +150 -0
- package/src/components/Dropdown/SkDropdownMenuItem.vue +58 -0
- package/src/components/Dropdown/SkDropdownMenuSeparator.vue +26 -0
- package/src/components/Dropdown/SkDropdownSubmenu.vue +107 -0
- package/src/components/Dropdown/index.ts +11 -0
- package/src/components/Dropdown/types.ts +11 -0
- package/src/components/Field/SkField.vue +152 -0
- package/src/components/Field/index.ts +8 -0
- package/src/components/Field/types.ts +7 -0
- package/src/components/Group/SkGroup.vue +52 -0
- package/src/components/Group/types.ts +10 -0
- package/src/components/Input/SkInput.vue +117 -0
- package/src/components/Input/index.ts +8 -0
- package/src/components/Input/types.ts +11 -0
- package/src/components/Listbox/SkListbox.vue +164 -0
- package/src/components/Listbox/SkListboxItem.vue +68 -0
- package/src/components/Listbox/SkListboxSeparator.vue +26 -0
- package/src/components/Listbox/index.ts +10 -0
- package/src/components/Listbox/types.ts +10 -0
- package/src/components/Modal/SkModal.vue +231 -0
- package/src/components/Modal/index.ts +8 -0
- package/src/components/Modal/types.ts +12 -0
- package/src/components/NavBar/SkNavBar.vue +83 -0
- package/src/components/NavBar/index.ts +8 -0
- package/src/components/NavBar/types.ts +15 -0
- package/src/components/NumberInput/SkNumberInput.vue +168 -0
- package/src/components/NumberInput/index.ts +8 -0
- package/src/components/NumberInput/types.ts +10 -0
- package/src/components/Page/SkPage.vue +94 -0
- package/src/components/Page/index.ts +8 -0
- package/src/components/Page/types.ts +21 -0
- package/src/components/Pagination/SkPagination.vue +185 -0
- package/src/components/Pagination/SkPaginationItem.vue +107 -0
- package/src/components/Pagination/index.ts +9 -0
- package/src/components/Pagination/types.ts +40 -0
- package/src/components/Panel/SkPanel.vue +96 -0
- package/src/components/Panel/types.ts +15 -0
- package/src/components/Popover/SkPopover.vue +185 -0
- package/src/components/Popover/index.ts +8 -0
- package/src/components/Popover/types.ts +11 -0
- package/src/components/Progress/SkProgress.vue +144 -0
- package/src/components/Progress/index.ts +8 -0
- package/src/components/Progress/types.ts +34 -0
- package/src/components/Radio/SkRadio.vue +110 -0
- package/src/components/Radio/SkRadioGroup.vue +92 -0
- package/src/components/Radio/index.ts +9 -0
- package/src/components/Radio/types.ts +11 -0
- package/src/components/Sidebar/README.md +405 -0
- package/src/components/Sidebar/SkSidebar.vue +88 -0
- package/src/components/Sidebar/SkSidebarItem.vue +58 -0
- package/src/components/Sidebar/SkSidebarSection.vue +40 -0
- package/src/components/Sidebar/types.ts +3 -0
- package/src/components/Skeleton/SkSkeleton.vue +171 -0
- package/src/components/Skeleton/index.ts +8 -0
- package/src/components/Skeleton/types.ts +31 -0
- package/src/components/Slider/SkSlider.vue +165 -0
- package/src/components/Slider/index.ts +8 -0
- package/src/components/Slider/types.ts +44 -0
- package/src/components/Spinner/SkSpinner.vue +105 -0
- package/src/components/Spinner/index.ts +8 -0
- package/src/components/Spinner/types.ts +28 -0
- package/src/components/Switch/SkSwitch.vue +215 -0
- package/src/components/Switch/index.ts +8 -0
- package/src/components/Switch/types.ts +12 -0
- package/src/components/Table/SkTable.vue +109 -0
- package/src/components/Table/index.ts +2 -0
- package/src/components/Table/types.ts +15 -0
- package/src/components/Tabs/README.md +331 -0
- package/src/components/Tabs/SkTab.vue +84 -0
- package/src/components/Tabs/SkTabList.vue +62 -0
- package/src/components/Tabs/SkTabPanel.vue +47 -0
- package/src/components/Tabs/SkTabPanels.vue +23 -0
- package/src/components/Tabs/SkTabs.vue +124 -0
- package/src/components/Tabs/types.ts +21 -0
- package/src/components/Tag/SkTag.vue +129 -0
- package/src/components/Tag/types.ts +15 -0
- package/src/components/TagsInput/SkTagsInput.vue +184 -0
- package/src/components/TagsInput/index.ts +8 -0
- package/src/components/TagsInput/types.ts +10 -0
- package/src/components/Textarea/SkTextarea.vue +117 -0
- package/src/components/Textarea/index.ts +8 -0
- package/src/components/Textarea/types.ts +10 -0
- package/src/components/Theme/SkTheme.vue +47 -0
- package/src/components/Theme/types.ts +17 -0
- package/src/components/Theme/useTheme.ts +131 -0
- package/src/components/Toast/SkToast.vue +156 -0
- package/src/components/Toast/SkToastProvider.vue +180 -0
- package/src/components/Toast/index.ts +15 -0
- package/src/components/Toast/types.ts +63 -0
- package/src/components/Toast/useToast.ts +78 -0
- package/src/components/Tooltip/SkTooltip.vue +162 -0
- package/src/components/Tooltip/SkTooltipProvider.vue +114 -0
- package/src/components/Tooltip/index.ts +9 -0
- package/src/components/Tooltip/types.ts +13 -0
- package/src/composables/useCustomColors.test.ts +505 -0
- package/src/composables/useCustomColors.ts +124 -0
- package/src/composables/usePortalContext.test.ts +402 -0
- package/src/composables/usePortalContext.ts +95 -0
- package/src/global.d.ts +76 -0
- package/src/index.ts +259 -0
- package/src/styles/_scrollbar.scss +100 -0
- package/src/styles/base/_fonts.scss +105 -0
- package/src/styles/base/_global.scss +47 -0
- package/src/styles/base/_index.scss +24 -0
- package/src/styles/base/_reset.scss +11 -0
- package/src/styles/base/_typography.scss +178 -0
- package/src/styles/components/_accordion.scss +250 -0
- package/src/styles/components/_alert.scss +239 -0
- package/src/styles/components/_avatar.scss +133 -0
- package/src/styles/components/_breadcrumbs.scss +137 -0
- package/src/styles/components/_button.scss +731 -0
- package/src/styles/components/_card.scss +141 -0
- package/src/styles/components/_checkbox.scss +232 -0
- package/src/styles/components/_collapsible.scss +158 -0
- package/src/styles/components/_divider.scss +121 -0
- package/src/styles/components/_field.scss +87 -0
- package/src/styles/components/_group.scss +138 -0
- package/src/styles/components/_index.scss +46 -0
- package/src/styles/components/_input.scss +205 -0
- package/src/styles/components/_listbox.scss +453 -0
- package/src/styles/components/_menu.scss +216 -0
- package/src/styles/components/_modal.scss +329 -0
- package/src/styles/components/_navbar.scss +258 -0
- package/src/styles/components/_number-input.scss +352 -0
- package/src/styles/components/_page.scss +98 -0
- package/src/styles/components/_pagination.scss +411 -0
- package/src/styles/components/_panel.scss +281 -0
- package/src/styles/components/_popover.scss +258 -0
- package/src/styles/components/_progress.scss +280 -0
- package/src/styles/components/_radio.scss +255 -0
- package/src/styles/components/_sidebar.scss +92 -0
- package/src/styles/components/_skeleton.scss +138 -0
- package/src/styles/components/_slider.scss +262 -0
- package/src/styles/components/_spinner.scss +331 -0
- package/src/styles/components/_switch.scss +370 -0
- package/src/styles/components/_table.scss +405 -0
- package/src/styles/components/_tabs.scss +486 -0
- package/src/styles/components/_tag.scss +425 -0
- package/src/styles/components/_tags-input.scss +279 -0
- package/src/styles/components/_textarea.scss +208 -0
- package/src/styles/components/_toast.scss +331 -0
- package/src/styles/components/_tooltip.scss +206 -0
- package/src/styles/fonts/Titillium_Web/OFL.txt +93 -0
- package/src/styles/fonts/Titillium_Web/TitilliumWeb-Black.ttf +0 -0
- package/src/styles/fonts/Titillium_Web/TitilliumWeb-Bold.ttf +0 -0
- package/src/styles/fonts/Titillium_Web/TitilliumWeb-BoldItalic.ttf +0 -0
- package/src/styles/fonts/Titillium_Web/TitilliumWeb-ExtraLight.ttf +0 -0
- package/src/styles/fonts/Titillium_Web/TitilliumWeb-ExtraLightItalic.ttf +0 -0
- package/src/styles/fonts/Titillium_Web/TitilliumWeb-Italic.ttf +0 -0
- package/src/styles/fonts/Titillium_Web/TitilliumWeb-Light.ttf +0 -0
- package/src/styles/fonts/Titillium_Web/TitilliumWeb-LightItalic.ttf +0 -0
- package/src/styles/fonts/Titillium_Web/TitilliumWeb-Regular.ttf +0 -0
- package/src/styles/fonts/Titillium_Web/TitilliumWeb-SemiBold.ttf +0 -0
- package/src/styles/fonts/Titillium_Web/TitilliumWeb-SemiBoldItalic.ttf +0 -0
- package/src/styles/index.scss +17 -0
- package/src/styles/mixins/_cut-border.scss +254 -0
- package/src/styles/mixins/_index.scss +7 -0
- package/src/styles/theme/_variables.scss +42 -0
- package/src/styles/themes/README.md +127 -0
- package/src/styles/themes/_colorful.scss +58 -0
- package/src/styles/themes/_greyscale.scss +58 -0
- package/src/styles/themes/index.scss +9 -0
- package/src/styles/tokens/README.md +268 -0
- package/src/styles/tokens/_foundation-borders.scss +26 -0
- package/src/styles/tokens/_foundation-colors.scss +169 -0
- package/src/styles/tokens/_foundation-glow.scss +36 -0
- package/src/styles/tokens/_foundation-radius.scss +53 -0
- package/src/styles/tokens/_foundation-scrollbar.scss +31 -0
- package/src/styles/tokens/_foundation-shadows.scss +37 -0
- package/src/styles/tokens/_foundation-space.scss +36 -0
- package/src/styles/tokens/_foundation-transitions.scss +37 -0
- package/src/styles/tokens/_foundation-typography.scss +58 -0
- package/src/styles/tokens/_semantic-color-kinds.scss +112 -0
- package/src/styles/tokens/_semantic-colors.scss +10 -0
- package/src/styles/tokens/_semantic-interactive.scss +29 -0
- package/src/styles/tokens/_semantic-scrollbar.scss +48 -0
- package/src/styles/tokens/_semantic-surfaces.scss +36 -0
- package/src/styles/tokens/index.scss +38 -0
- package/src/styles/tokens.scss +268 -0
- package/src/styles/utilities/_index.scss +9 -0
- package/src/styles/utilities/_typography.scss +121 -0
- package/src/types.ts +50 -0
- package/web-types.json +3524 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="classes"
|
|
4
|
+
:style="customStyles"
|
|
5
|
+
role="status"
|
|
6
|
+
aria-live="polite"
|
|
7
|
+
aria-label="Loading"
|
|
8
|
+
>
|
|
9
|
+
<!-- Circular variant -->
|
|
10
|
+
<div
|
|
11
|
+
v-if="variant === 'circular'"
|
|
12
|
+
class="sk-spinner-circular"
|
|
13
|
+
>
|
|
14
|
+
<div class="sk-arc sk-arc-large" />
|
|
15
|
+
<div class="sk-arc sk-arc-small" />
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<!-- Dots variant -->
|
|
19
|
+
<div
|
|
20
|
+
v-else-if="variant === 'dots'"
|
|
21
|
+
class="sk-spinner-dots"
|
|
22
|
+
>
|
|
23
|
+
<div class="sk-dot" />
|
|
24
|
+
<div class="sk-dot" />
|
|
25
|
+
<div class="sk-dot" />
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<!-- Crosshair variant -->
|
|
29
|
+
<div v-else-if="variant === 'crosshair'" class="sk-crosshair-loader" />
|
|
30
|
+
</div>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<!--------------------------------------------------------------------------------------------------------------------->
|
|
34
|
+
|
|
35
|
+
<style lang="scss" scoped>
|
|
36
|
+
// Component styles are implemented in /src/styles/components/_spinner.scss
|
|
37
|
+
</style>
|
|
38
|
+
|
|
39
|
+
<!--------------------------------------------------------------------------------------------------------------------->
|
|
40
|
+
|
|
41
|
+
<script setup lang="ts">
|
|
42
|
+
/**
|
|
43
|
+
* @component SkSpinner
|
|
44
|
+
* An animated loading spinner component with multiple variants.
|
|
45
|
+
* Supports all 7 semantic kinds and custom colors.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
import { computed } from 'vue';
|
|
49
|
+
|
|
50
|
+
// Types
|
|
51
|
+
import type { ComponentKind } from '@/types';
|
|
52
|
+
import type { SkSpinnerSize, SkSpinnerVariant } from './types';
|
|
53
|
+
|
|
54
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
55
|
+
|
|
56
|
+
export interface SkSpinnerComponentProps
|
|
57
|
+
{
|
|
58
|
+
/** Semantic color kind */
|
|
59
|
+
kind ?: ComponentKind;
|
|
60
|
+
/** Spinner size */
|
|
61
|
+
size ?: SkSpinnerSize;
|
|
62
|
+
/** Animation variant */
|
|
63
|
+
variant ?: SkSpinnerVariant;
|
|
64
|
+
/** Custom spinner color (overrides kind) */
|
|
65
|
+
color ?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
69
|
+
|
|
70
|
+
const props = withDefaults(defineProps<SkSpinnerComponentProps>(), {
|
|
71
|
+
kind: 'primary',
|
|
72
|
+
size: 'md',
|
|
73
|
+
variant: 'circular',
|
|
74
|
+
color: undefined,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
78
|
+
// Classes
|
|
79
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
80
|
+
|
|
81
|
+
const classes = computed(() => ({
|
|
82
|
+
'sk-spinner': true,
|
|
83
|
+
[`sk-${ props.kind }`]: true,
|
|
84
|
+
[`sk-${ props.size }`]: true,
|
|
85
|
+
[`sk-variant-${ props.variant }`]: true,
|
|
86
|
+
}));
|
|
87
|
+
|
|
88
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
89
|
+
// Custom Colors
|
|
90
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
91
|
+
|
|
92
|
+
const customStyles = computed(() =>
|
|
93
|
+
{
|
|
94
|
+
if(!props.color)
|
|
95
|
+
{
|
|
96
|
+
return {};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
'--sk-spinner-color': props.color,
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
</script>
|
|
104
|
+
|
|
105
|
+
<!--------------------------------------------------------------------------------------------------------------------->
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
2
|
+
// Spinner Component
|
|
3
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
4
|
+
|
|
5
|
+
export { default } from './SkSpinner.vue';
|
|
6
|
+
export * from './types';
|
|
7
|
+
|
|
8
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
2
|
+
// Spinner Types
|
|
3
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
4
|
+
|
|
5
|
+
import type { ComponentKind, ComponentSize } from '@/types';
|
|
6
|
+
|
|
7
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
/** Spinner animation variant */
|
|
10
|
+
export type SkSpinnerVariant = 'circular' | 'dots' | 'crosshair';
|
|
11
|
+
|
|
12
|
+
/** Spinner size */
|
|
13
|
+
export type SkSpinnerSize = ComponentSize;
|
|
14
|
+
|
|
15
|
+
/** Spinner props interface */
|
|
16
|
+
export interface SkSpinnerProps
|
|
17
|
+
{
|
|
18
|
+
/** Semantic color kind */
|
|
19
|
+
kind ?: ComponentKind;
|
|
20
|
+
/** Spinner size */
|
|
21
|
+
size ?: SkSpinnerSize;
|
|
22
|
+
/** Animation variant */
|
|
23
|
+
variant ?: SkSpinnerVariant;
|
|
24
|
+
/** Custom spinner color (overrides kind) */
|
|
25
|
+
color ?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
<!----------------------------------------------------------------------------------------------------------------------
|
|
2
|
+
- Switch Component (powered by RekaUI)
|
|
3
|
+
--------------------------------------------------------------------------------------------------------------------->
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<div class="sk-switch-wrapper">
|
|
7
|
+
<SwitchRoot
|
|
8
|
+
:model-value="modelValue"
|
|
9
|
+
:disabled="disabled"
|
|
10
|
+
:name="name"
|
|
11
|
+
:value="value"
|
|
12
|
+
:required="required"
|
|
13
|
+
:class="classes"
|
|
14
|
+
:style="customColorStyles"
|
|
15
|
+
@update:model-value="$emit('update:modelValue', $event)"
|
|
16
|
+
>
|
|
17
|
+
<SwitchThumb :class="thumbClasses" />
|
|
18
|
+
</SwitchRoot>
|
|
19
|
+
<label v-if="showLabel" class="sk-switch-label">
|
|
20
|
+
<!-- Default slot overrides everything -->
|
|
21
|
+
<slot v-if="slots.default" />
|
|
22
|
+
<!-- If using on/off labels with animation -->
|
|
23
|
+
<Transition v-else-if="useOnOffLabels && !disableLabelAnimation" name="sk-switch-label-fade" mode="out-in">
|
|
24
|
+
<span v-if="modelValue" :key="'on'">
|
|
25
|
+
<slot v-if="slots['label-on']" name="label-on" />
|
|
26
|
+
<template v-else>
|
|
27
|
+
{{ labelOn }}
|
|
28
|
+
</template>
|
|
29
|
+
</span>
|
|
30
|
+
<span v-else :key="'off'">
|
|
31
|
+
<slot v-if="slots['label-off']" name="label-off" />
|
|
32
|
+
<template v-else>
|
|
33
|
+
{{ labelOff }}
|
|
34
|
+
</template>
|
|
35
|
+
</span>
|
|
36
|
+
</Transition>
|
|
37
|
+
<!-- If using on/off labels without animation -->
|
|
38
|
+
<template v-else-if="useOnOffLabels && disableLabelAnimation">
|
|
39
|
+
<span v-if="modelValue">
|
|
40
|
+
<slot v-if="slots['label-on']" name="label-on" />
|
|
41
|
+
<template v-else>
|
|
42
|
+
{{ labelOn }}
|
|
43
|
+
</template>
|
|
44
|
+
</span>
|
|
45
|
+
<span v-else>
|
|
46
|
+
<slot v-if="slots['label-off']" name="label-off" />
|
|
47
|
+
<template v-else>
|
|
48
|
+
{{ labelOff }}
|
|
49
|
+
</template>
|
|
50
|
+
</span>
|
|
51
|
+
</template>
|
|
52
|
+
<!-- Otherwise just show static label -->
|
|
53
|
+
<template v-else>
|
|
54
|
+
{{ label }}
|
|
55
|
+
</template>
|
|
56
|
+
</label>
|
|
57
|
+
</div>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<!--------------------------------------------------------------------------------------------------------------------->
|
|
61
|
+
|
|
62
|
+
<script setup lang="ts">
|
|
63
|
+
/**
|
|
64
|
+
* @component
|
|
65
|
+
* A toggle switch component for binary choices powered by RekaUI.
|
|
66
|
+
* Supports dynamic labels that change based on state and flexible styling options.
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
import { computed, toRef, useSlots } from 'vue';
|
|
70
|
+
import { SwitchRoot, SwitchThumb } from 'reka-ui';
|
|
71
|
+
import type { SkSwitchKind, SkSwitchSize } from './types';
|
|
72
|
+
import type { ComponentCustomColors } from '@/types';
|
|
73
|
+
import { useCustomColors } from '@/composables/useCustomColors';
|
|
74
|
+
|
|
75
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* A toggle switch component for binary choices powered by RekaUI.
|
|
79
|
+
* Supports dynamic labels that change based on state and flexible styling options.
|
|
80
|
+
*
|
|
81
|
+
* @example Basic switch
|
|
82
|
+
* ```vue
|
|
83
|
+
* <SkSwitch v-model="enabled" label="Enable notifications" />
|
|
84
|
+
* ```
|
|
85
|
+
*
|
|
86
|
+
* @example Custom colors
|
|
87
|
+
* ```vue
|
|
88
|
+
* <SkSwitch
|
|
89
|
+
* v-model="premium"
|
|
90
|
+
* base-color="oklch(0.7 0.25 45)"
|
|
91
|
+
* text-color="white"
|
|
92
|
+
* label="Premium Features"
|
|
93
|
+
* />
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export interface SkSwitchComponentProps extends ComponentCustomColors
|
|
97
|
+
{
|
|
98
|
+
/** Current state of the switch (true for on, false for off) */
|
|
99
|
+
modelValue : boolean;
|
|
100
|
+
/** Static label text (used as fallback for labelOn/labelOff if not provided) */
|
|
101
|
+
label ?: string;
|
|
102
|
+
/** Label text displayed when switch is on (with animation if enabled) */
|
|
103
|
+
labelOn ?: string;
|
|
104
|
+
/** Label text displayed when switch is off (with animation if enabled) */
|
|
105
|
+
labelOff ?: string;
|
|
106
|
+
/** Semantic color kind for the switch background */
|
|
107
|
+
kind ?: SkSwitchKind;
|
|
108
|
+
/** Semantic color kind for the switch thumb (overrides main kind) */
|
|
109
|
+
thumbKind ?: SkSwitchKind;
|
|
110
|
+
/** Size of the switch control */
|
|
111
|
+
size ?: SkSwitchSize;
|
|
112
|
+
/** Whether the switch is disabled */
|
|
113
|
+
disabled ?: boolean;
|
|
114
|
+
/** Whether to disable the fade animation when labels change */
|
|
115
|
+
disableLabelAnimation ?: boolean;
|
|
116
|
+
/** Name attribute for form submission */
|
|
117
|
+
name ?: string;
|
|
118
|
+
/** Value attribute for form submission */
|
|
119
|
+
value ?: string;
|
|
120
|
+
/** Whether the switch is required in a form */
|
|
121
|
+
required ?: boolean;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
125
|
+
|
|
126
|
+
const props = withDefaults(defineProps<SkSwitchComponentProps>(), {
|
|
127
|
+
label: undefined,
|
|
128
|
+
labelOn: undefined,
|
|
129
|
+
labelOff: undefined,
|
|
130
|
+
kind: 'neutral',
|
|
131
|
+
thumbKind: undefined,
|
|
132
|
+
size: 'md',
|
|
133
|
+
disabled: false,
|
|
134
|
+
disableLabelAnimation: false,
|
|
135
|
+
name: undefined,
|
|
136
|
+
value: 'on',
|
|
137
|
+
required: false,
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
defineEmits<{
|
|
141
|
+
'update:modelValue' : [value : boolean];
|
|
142
|
+
}>();
|
|
143
|
+
|
|
144
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
145
|
+
|
|
146
|
+
const slots = useSlots();
|
|
147
|
+
|
|
148
|
+
const classes = computed(() =>
|
|
149
|
+
{
|
|
150
|
+
return {
|
|
151
|
+
'sk-switch': true,
|
|
152
|
+
[`sk-${ props.kind }`]: true,
|
|
153
|
+
[`sk-${ props.size }`]: true,
|
|
154
|
+
};
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
const thumbClasses = computed(() =>
|
|
158
|
+
{
|
|
159
|
+
return {
|
|
160
|
+
'sk-switch-thumb': true,
|
|
161
|
+
[`sk-thumb-${ props.thumbKind }`]: props.thumbKind !== undefined,
|
|
162
|
+
};
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
const showLabel = computed(() =>
|
|
166
|
+
{
|
|
167
|
+
// Show label if:
|
|
168
|
+
// - Default slot is provided, OR
|
|
169
|
+
// - labelOn/labelOff props are provided, OR
|
|
170
|
+
// - label-on/label-off slots are provided, OR
|
|
171
|
+
// - fallback label prop is provided
|
|
172
|
+
return Boolean(
|
|
173
|
+
slots.default
|
|
174
|
+
|| props.labelOn
|
|
175
|
+
|| props.labelOff
|
|
176
|
+
|| slots['label-on']
|
|
177
|
+
|| slots['label-off']
|
|
178
|
+
|| props.label
|
|
179
|
+
);
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
const useOnOffLabels = computed(() =>
|
|
183
|
+
{
|
|
184
|
+
// Use on/off label logic (with animation) only if:
|
|
185
|
+
// - labelOn or labelOff props are provided, OR
|
|
186
|
+
// - label-on or label-off slots are provided
|
|
187
|
+
return Boolean(
|
|
188
|
+
props.labelOn
|
|
189
|
+
|| props.labelOff
|
|
190
|
+
|| slots['label-on']
|
|
191
|
+
|| slots['label-off']
|
|
192
|
+
);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
const labelOn = computed(() =>
|
|
196
|
+
{
|
|
197
|
+
return props.labelOn ?? props.label;
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
const labelOff = computed(() =>
|
|
201
|
+
{
|
|
202
|
+
return props.labelOff ?? props.label;
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
206
|
+
|
|
207
|
+
// Custom color styles
|
|
208
|
+
const customColorStyles = useCustomColors(
|
|
209
|
+
'switch',
|
|
210
|
+
toRef(() => props.baseColor),
|
|
211
|
+
toRef(() => props.textColor)
|
|
212
|
+
);
|
|
213
|
+
</script>
|
|
214
|
+
|
|
215
|
+
<!--------------------------------------------------------------------------------------------------------------------->
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
2
|
+
// Switch Component Exports
|
|
3
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
4
|
+
|
|
5
|
+
export { default as SkSwitch } from './SkSwitch.vue';
|
|
6
|
+
export type { SkSwitchKind, SkSwitchSize } from './types.ts';
|
|
7
|
+
|
|
8
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
2
|
+
// Switch Types
|
|
3
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
4
|
+
|
|
5
|
+
import type { ComponentKind, ComponentSize } from '@/types';
|
|
6
|
+
|
|
7
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
export type SkSwitchKind = ComponentKind;
|
|
10
|
+
export type SkSwitchSize = ComponentSize;
|
|
11
|
+
|
|
12
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<!----------------------------------------------------------------------------------------------------------------------
|
|
2
|
+
- Table Component
|
|
3
|
+
- Style-only table component with clean, rounded styling
|
|
4
|
+
--------------------------------------------------------------------------------------------------------------------->
|
|
5
|
+
|
|
6
|
+
<template>
|
|
7
|
+
<div :class="wrapperClasses">
|
|
8
|
+
<table :class="tableClasses" :style="customColorStyles">
|
|
9
|
+
<slot />
|
|
10
|
+
</table>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<!--------------------------------------------------------------------------------------------------------------------->
|
|
15
|
+
|
|
16
|
+
<style lang="scss" scoped>
|
|
17
|
+
// Component styles are implemented in /src/styles/components/_table.scss
|
|
18
|
+
</style>
|
|
19
|
+
|
|
20
|
+
<!--------------------------------------------------------------------------------------------------------------------->
|
|
21
|
+
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
/**
|
|
24
|
+
* @component
|
|
25
|
+
* A flexible table component with clean, rounded styling.
|
|
26
|
+
* Supports various visual styles including striping, hover effects, and custom borders.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import { computed, toRef } from 'vue';
|
|
30
|
+
import type { SkTableKind, SkTableVariant } from './types';
|
|
31
|
+
import type { ComponentCustomColors } from '@/types';
|
|
32
|
+
import { useCustomColors } from '@/composables/useCustomColors';
|
|
33
|
+
|
|
34
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* A flexible table component with clean, rounded styling.
|
|
38
|
+
* Supports various visual styles including striping, hover effects, and custom borders.
|
|
39
|
+
*/
|
|
40
|
+
export interface SkTableComponentProps extends ComponentCustomColors
|
|
41
|
+
{
|
|
42
|
+
/** Semantic color kind for the table */
|
|
43
|
+
kind ?: SkTableKind;
|
|
44
|
+
/** Visual variant style (default or compact) */
|
|
45
|
+
variant ?: SkTableVariant;
|
|
46
|
+
/** Whether to alternate row background colors */
|
|
47
|
+
striped ?: boolean;
|
|
48
|
+
/** Whether rows highlight on hover */
|
|
49
|
+
hoverable ?: boolean;
|
|
50
|
+
/** Whether to show outer borders around the table */
|
|
51
|
+
bordered ?: boolean;
|
|
52
|
+
/** Whether to show borders between cells and rows */
|
|
53
|
+
innerBorders ?: boolean;
|
|
54
|
+
/** Whether the table has a dark background context */
|
|
55
|
+
darkBackground ?: boolean;
|
|
56
|
+
/** Whether to use subtle, lighter styling */
|
|
57
|
+
subtle ?: boolean;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
61
|
+
|
|
62
|
+
const props = withDefaults(defineProps<SkTableComponentProps>(), {
|
|
63
|
+
kind: 'neutral',
|
|
64
|
+
variant: 'default',
|
|
65
|
+
striped: false,
|
|
66
|
+
hoverable: true,
|
|
67
|
+
bordered: true,
|
|
68
|
+
innerBorders: false,
|
|
69
|
+
darkBackground: false,
|
|
70
|
+
subtle: false,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
74
|
+
|
|
75
|
+
const wrapperClasses = computed(() =>
|
|
76
|
+
{
|
|
77
|
+
return {
|
|
78
|
+
'sk-table-wrapper': true,
|
|
79
|
+
[`sk-table-wrapper-${ props.kind }`]: true,
|
|
80
|
+
'sk-dark-background': props.darkBackground,
|
|
81
|
+
'sk-subtle': props.subtle,
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const tableClasses = computed(() =>
|
|
86
|
+
{
|
|
87
|
+
return {
|
|
88
|
+
'sk-table': true,
|
|
89
|
+
[`sk-${ props.kind }`]: true,
|
|
90
|
+
[`sk-${ props.variant }`]: true,
|
|
91
|
+
'sk-striped': props.striped,
|
|
92
|
+
'sk-hoverable': props.hoverable,
|
|
93
|
+
'sk-bordered': props.bordered,
|
|
94
|
+
'sk-no-inner-borders': !props.innerBorders,
|
|
95
|
+
'sk-subtle': props.subtle,
|
|
96
|
+
};
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
100
|
+
|
|
101
|
+
// Custom color styles
|
|
102
|
+
const customColorStyles = useCustomColors(
|
|
103
|
+
'table',
|
|
104
|
+
toRef(() => props.baseColor),
|
|
105
|
+
toRef(() => props.textColor)
|
|
106
|
+
);
|
|
107
|
+
</script>
|
|
108
|
+
|
|
109
|
+
<!--------------------------------------------------------------------------------------------------------------------->
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
2
|
+
// Table Component Types
|
|
3
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
4
|
+
|
|
5
|
+
import type { ComponentKind } from '@/types';
|
|
6
|
+
|
|
7
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
// Table semantic kinds
|
|
10
|
+
export type SkTableKind = ComponentKind;
|
|
11
|
+
|
|
12
|
+
// Table visual variants
|
|
13
|
+
export type SkTableVariant = 'default' | 'compact' | 'comfortable';
|
|
14
|
+
|
|
15
|
+
//----------------------------------------------------------------------------------------------------------------------
|