@kuina-ui/vue 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +143 -143
- package/dist/elements/segmented-control/SegmentedControl.vue.d.ts +35 -0
- package/dist/elements/segmented-control/index.d.ts +2 -0
- package/dist/elements/segmented-control/segmented-control.theme.d.ts +62 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/nuxt.js +1 -1
- package/dist/shared/composables/useSlidingThumb.d.ts +12 -0
- package/dist/shared/utils/resolvePressScale.d.ts +2 -0
- package/dist/{src-ChY11Hfy.js → src-Bnn36nLV.js} +1046 -690
- package/package.json +75 -75
package/README.md
CHANGED
|
@@ -1,143 +1,143 @@
|
|
|
1
|
-
<picture>
|
|
2
|
-
<source media="(prefers-color-scheme: dark)" srcset=".github/assets/kuina-logo-dark.svg" />
|
|
3
|
-
<img src=".github/assets/kuina-logo-light.svg" alt="Kuina UI logo" height="64" />
|
|
4
|
-
</picture>
|
|
5
|
-
|
|
6
|
-
# Kuina UI — Vue
|
|
7
|
-
|
|
8
|
-
[![npm version][npm-version-src]][npm-version-href]
|
|
9
|
-
[![Vue][vue-src]][vue-href]
|
|
10
|
-
[![Nuxt][nuxt-src]][nuxt-href]
|
|
11
|
-
[![Tailwind CSS][tailwindcss-src]][tailwindcss-href]
|
|
12
|
-
|
|
13
|
-
Kuina UI is a library of accessible, typed [Vue](https://vuejs.org) components built from scratch with [Tailwind CSS v4](https://tailwindcss.com/), in light and dark themes. It works as a module in [Nuxt](https://nuxt.com) and with plain imports in any Vue app.
|
|
14
|
-
|
|
15
|
-
> [!NOTE]
|
|
16
|
-
> Kuina UI is in early development.
|
|
17
|
-
|
|
18
|
-
## Documentation
|
|
19
|
-
|
|
20
|
-
The documentation lives in its own repository: [Kuina-UI/docs](https://github.com/Kuina-UI/docs).
|
|
21
|
-
|
|
22
|
-
## Installation
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
npm install @kuina-ui/vue tailwindcss
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### Nuxt
|
|
29
|
-
|
|
30
|
-
1. Add the Kuina UI module in your `nuxt.config.ts`:
|
|
31
|
-
|
|
32
|
-
```ts
|
|
33
|
-
export default defineNuxtConfig({
|
|
34
|
-
modules: ['@kuina-ui/vue/nuxt'],
|
|
35
|
-
css: ['~/assets/css/main.css']
|
|
36
|
-
})
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
2. Import Tailwind CSS and Kuina UI in your `app/assets/css/main.css`:
|
|
40
|
-
|
|
41
|
-
```css
|
|
42
|
-
@import "tailwindcss";
|
|
43
|
-
@import "@kuina-ui/vue";
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
3. Set the theme on `<html>` in your `app.vue`:
|
|
47
|
-
|
|
48
|
-
```vue
|
|
49
|
-
<script setup lang="ts">
|
|
50
|
-
useHead({
|
|
51
|
-
htmlAttrs: { 'data-theme': 'light' }
|
|
52
|
-
})
|
|
53
|
-
</script>
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Components are registered for you: write `<KButton>` anywhere, no import needed.
|
|
57
|
-
|
|
58
|
-
### Vue
|
|
59
|
-
|
|
60
|
-
1. Install the Tailwind CSS Vite plugin and add it to your `vite.config.ts`:
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
npm install @tailwindcss/vite
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
```ts
|
|
67
|
-
import { defineConfig } from 'vite'
|
|
68
|
-
import vue from '@vitejs/plugin-vue'
|
|
69
|
-
import tailwindcss from '@tailwindcss/vite'
|
|
70
|
-
|
|
71
|
-
export default defineConfig({
|
|
72
|
-
plugins: [vue(), tailwindcss()]
|
|
73
|
-
})
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
2. Import Tailwind CSS and Kuina UI in your `src/assets/main.css`, then load it in `main.ts`:
|
|
77
|
-
|
|
78
|
-
```css
|
|
79
|
-
@import "tailwindcss";
|
|
80
|
-
@import "@kuina-ui/vue";
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
```ts
|
|
84
|
-
import './assets/main.css'
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
3. Set the theme on `<html>` in your `index.html`:
|
|
88
|
-
|
|
89
|
-
```html
|
|
90
|
-
<html lang="en" data-theme="light">
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
4. Import the components you use:
|
|
94
|
-
|
|
95
|
-
```vue
|
|
96
|
-
<script setup lang="ts">
|
|
97
|
-
import { KButton } from '@kuina-ui/vue'
|
|
98
|
-
</script>
|
|
99
|
-
|
|
100
|
-
<template>
|
|
101
|
-
<KButton>Save</KButton>
|
|
102
|
-
</template>
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
## Themes
|
|
106
|
-
|
|
107
|
-
Kuina UI comes in a light and a dark theme. `data-theme` on `<html>` picks it: set it to `light` or `dark`, and every component follows, along with the `light:` and `dark:` variants in your own classes.
|
|
108
|
-
|
|
109
|
-
## Contribution
|
|
110
|
-
|
|
111
|
-
Found a bug or have an idea? [Open an issue](https://github.com/Kuina-UI/vue/issues/new).
|
|
112
|
-
|
|
113
|
-
Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/) (`feat: …`, `fix: …`, `chore: …`), in English.
|
|
114
|
-
|
|
115
|
-
## Credits
|
|
116
|
-
|
|
117
|
-
- [vuejs/core](https://github.com/vuejs/core)
|
|
118
|
-
- [vitejs/vite](https://github.com/vitejs/vite)
|
|
119
|
-
- [nuxt/nuxt](https://github.com/nuxt/nuxt)
|
|
120
|
-
- [tailwindlabs/tailwindcss](https://github.com/tailwindlabs/tailwindcss)
|
|
121
|
-
- [lucide-icons/lucide](https://github.com/lucide-icons/lucide)
|
|
122
|
-
- [nuxt-content/docus](https://github.com/nuxt-content/docus)
|
|
123
|
-
|
|
124
|
-
## Support Kuina UI
|
|
125
|
-
|
|
126
|
-
Kuina UI is free and open source. If it saves you time, you can support its development:
|
|
127
|
-
|
|
128
|
-
- [GitHub Sponsors](https://github.com/sponsors/mgcodeur)
|
|
129
|
-
- [Open Collective](https://opencollective.com/mgcodeur)
|
|
130
|
-
- [Ko-fi](https://ko-fi.com/mgcodeur)
|
|
131
|
-
|
|
132
|
-
## License
|
|
133
|
-
|
|
134
|
-
[MIT](LICENSE): free to use, modify and redistribute, including for commercial projects.
|
|
135
|
-
|
|
136
|
-
[npm-version-src]: https://img.shields.io/npm/v/@kuina-ui/vue?color=18181B
|
|
137
|
-
[npm-version-href]: https://npmjs.com/package/@kuina-ui/vue
|
|
138
|
-
[vue-src]: https://img.shields.io/badge/Vue-18181B?logo=vuedotjs
|
|
139
|
-
[vue-href]: https://vuejs.org
|
|
140
|
-
[nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt
|
|
141
|
-
[nuxt-href]: https://nuxt.com
|
|
142
|
-
[tailwindcss-src]: https://img.shields.io/badge/Tailwind_CSS-18181B?logo=tailwindcss
|
|
143
|
-
[tailwindcss-href]: https://tailwindcss.com
|
|
1
|
+
<picture>
|
|
2
|
+
<source media="(prefers-color-scheme: dark)" srcset=".github/assets/kuina-logo-dark.svg" />
|
|
3
|
+
<img src=".github/assets/kuina-logo-light.svg" alt="Kuina UI logo" height="64" />
|
|
4
|
+
</picture>
|
|
5
|
+
|
|
6
|
+
# Kuina UI — Vue
|
|
7
|
+
|
|
8
|
+
[![npm version][npm-version-src]][npm-version-href]
|
|
9
|
+
[![Vue][vue-src]][vue-href]
|
|
10
|
+
[![Nuxt][nuxt-src]][nuxt-href]
|
|
11
|
+
[![Tailwind CSS][tailwindcss-src]][tailwindcss-href]
|
|
12
|
+
|
|
13
|
+
Kuina UI is a library of accessible, typed [Vue](https://vuejs.org) components built from scratch with [Tailwind CSS v4](https://tailwindcss.com/), in light and dark themes. It works as a module in [Nuxt](https://nuxt.com) and with plain imports in any Vue app.
|
|
14
|
+
|
|
15
|
+
> [!NOTE]
|
|
16
|
+
> Kuina UI is in early development.
|
|
17
|
+
|
|
18
|
+
## Documentation
|
|
19
|
+
|
|
20
|
+
The documentation lives in its own repository: [Kuina-UI/docs](https://github.com/Kuina-UI/docs).
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install @kuina-ui/vue tailwindcss
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Nuxt
|
|
29
|
+
|
|
30
|
+
1. Add the Kuina UI module in your `nuxt.config.ts`:
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
export default defineNuxtConfig({
|
|
34
|
+
modules: ['@kuina-ui/vue/nuxt'],
|
|
35
|
+
css: ['~/assets/css/main.css']
|
|
36
|
+
})
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
2. Import Tailwind CSS and Kuina UI in your `app/assets/css/main.css`:
|
|
40
|
+
|
|
41
|
+
```css
|
|
42
|
+
@import "tailwindcss";
|
|
43
|
+
@import "@kuina-ui/vue";
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
3. Set the theme on `<html>` in your `app.vue`:
|
|
47
|
+
|
|
48
|
+
```vue
|
|
49
|
+
<script setup lang="ts">
|
|
50
|
+
useHead({
|
|
51
|
+
htmlAttrs: { 'data-theme': 'light' }
|
|
52
|
+
})
|
|
53
|
+
</script>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Components are registered for you: write `<KButton>` anywhere, no import needed.
|
|
57
|
+
|
|
58
|
+
### Vue
|
|
59
|
+
|
|
60
|
+
1. Install the Tailwind CSS Vite plugin and add it to your `vite.config.ts`:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npm install @tailwindcss/vite
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import { defineConfig } from 'vite'
|
|
68
|
+
import vue from '@vitejs/plugin-vue'
|
|
69
|
+
import tailwindcss from '@tailwindcss/vite'
|
|
70
|
+
|
|
71
|
+
export default defineConfig({
|
|
72
|
+
plugins: [vue(), tailwindcss()]
|
|
73
|
+
})
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
2. Import Tailwind CSS and Kuina UI in your `src/assets/main.css`, then load it in `main.ts`:
|
|
77
|
+
|
|
78
|
+
```css
|
|
79
|
+
@import "tailwindcss";
|
|
80
|
+
@import "@kuina-ui/vue";
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
import './assets/main.css'
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
3. Set the theme on `<html>` in your `index.html`:
|
|
88
|
+
|
|
89
|
+
```html
|
|
90
|
+
<html lang="en" data-theme="light">
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
4. Import the components you use:
|
|
94
|
+
|
|
95
|
+
```vue
|
|
96
|
+
<script setup lang="ts">
|
|
97
|
+
import { KButton } from '@kuina-ui/vue'
|
|
98
|
+
</script>
|
|
99
|
+
|
|
100
|
+
<template>
|
|
101
|
+
<KButton>Save</KButton>
|
|
102
|
+
</template>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Themes
|
|
106
|
+
|
|
107
|
+
Kuina UI comes in a light and a dark theme. `data-theme` on `<html>` picks it: set it to `light` or `dark`, and every component follows, along with the `light:` and `dark:` variants in your own classes.
|
|
108
|
+
|
|
109
|
+
## Contribution
|
|
110
|
+
|
|
111
|
+
Found a bug or have an idea? [Open an issue](https://github.com/Kuina-UI/vue/issues/new).
|
|
112
|
+
|
|
113
|
+
Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/) (`feat: …`, `fix: …`, `chore: …`), in English.
|
|
114
|
+
|
|
115
|
+
## Credits
|
|
116
|
+
|
|
117
|
+
- [vuejs/core](https://github.com/vuejs/core)
|
|
118
|
+
- [vitejs/vite](https://github.com/vitejs/vite)
|
|
119
|
+
- [nuxt/nuxt](https://github.com/nuxt/nuxt)
|
|
120
|
+
- [tailwindlabs/tailwindcss](https://github.com/tailwindlabs/tailwindcss)
|
|
121
|
+
- [lucide-icons/lucide](https://github.com/lucide-icons/lucide)
|
|
122
|
+
- [nuxt-content/docus](https://github.com/nuxt-content/docus)
|
|
123
|
+
|
|
124
|
+
## Support Kuina UI
|
|
125
|
+
|
|
126
|
+
Kuina UI is free and open source. If it saves you time, you can support its development:
|
|
127
|
+
|
|
128
|
+
- [GitHub Sponsors](https://github.com/sponsors/mgcodeur)
|
|
129
|
+
- [Open Collective](https://opencollective.com/mgcodeur)
|
|
130
|
+
- [Ko-fi](https://ko-fi.com/mgcodeur)
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
|
|
134
|
+
[MIT](LICENSE): free to use, modify and redistribute, including for commercial projects.
|
|
135
|
+
|
|
136
|
+
[npm-version-src]: https://img.shields.io/npm/v/@kuina-ui/vue?color=18181B
|
|
137
|
+
[npm-version-href]: https://npmjs.com/package/@kuina-ui/vue
|
|
138
|
+
[vue-src]: https://img.shields.io/badge/Vue-18181B?logo=vuedotjs
|
|
139
|
+
[vue-href]: https://vuejs.org
|
|
140
|
+
[nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt
|
|
141
|
+
[nuxt-href]: https://nuxt.com
|
|
142
|
+
[tailwindcss-src]: https://img.shields.io/badge/Tailwind_CSS-18181B?logo=tailwindcss
|
|
143
|
+
[tailwindcss-href]: https://tailwindcss.com
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Component } from 'vue';
|
|
2
|
+
import type { ClassNameValue } from '../../shared/utils/tv';
|
|
3
|
+
import type { SegmentedControlSlotName, SegmentedControlThemeVariants } from './segmented-control.theme';
|
|
4
|
+
export interface SegmentedControlOption {
|
|
5
|
+
value: string;
|
|
6
|
+
label: string;
|
|
7
|
+
icon?: Component;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface SegmentedControlProps {
|
|
11
|
+
ariaLabel: string;
|
|
12
|
+
options: SegmentedControlOption[];
|
|
13
|
+
name?: string;
|
|
14
|
+
size?: SegmentedControlThemeVariants['size'];
|
|
15
|
+
pill?: boolean;
|
|
16
|
+
block?: boolean;
|
|
17
|
+
square?: boolean;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
ui?: Partial<Record<SegmentedControlSlotName, ClassNameValue>>;
|
|
20
|
+
class?: ClassNameValue;
|
|
21
|
+
}
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
24
|
+
declare const __VLS_export: import("vue").DefineComponent<SegmentedControlProps & {
|
|
25
|
+
modelValue?: string;
|
|
26
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
27
|
+
"update:modelValue": (value: string | undefined) => any;
|
|
28
|
+
}, string, import("vue").PublicProps, Readonly<SegmentedControlProps & {
|
|
29
|
+
modelValue?: string;
|
|
30
|
+
}> & Readonly<{
|
|
31
|
+
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
32
|
+
}>, {
|
|
33
|
+
pill: boolean;
|
|
34
|
+
size: "3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl";
|
|
35
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type VariantProps } from '../../shared/utils/tv';
|
|
2
|
+
export declare const segmentedControlTheme: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
size: Record<"3xs" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl", {
|
|
4
|
+
root: string[];
|
|
5
|
+
content: string;
|
|
6
|
+
icon: string;
|
|
7
|
+
}>;
|
|
8
|
+
pill: {
|
|
9
|
+
true: {
|
|
10
|
+
root: string;
|
|
11
|
+
thumb: string;
|
|
12
|
+
option: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
block: {
|
|
16
|
+
true: {
|
|
17
|
+
root: string;
|
|
18
|
+
option: string;
|
|
19
|
+
};
|
|
20
|
+
false: {
|
|
21
|
+
root: string;
|
|
22
|
+
option: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
square: {
|
|
26
|
+
true: string;
|
|
27
|
+
};
|
|
28
|
+
disabled: {
|
|
29
|
+
true: {
|
|
30
|
+
root: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
optionDisabled: {
|
|
34
|
+
true: {
|
|
35
|
+
option: string;
|
|
36
|
+
};
|
|
37
|
+
false: {
|
|
38
|
+
option: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
isThumbPlaced: {
|
|
42
|
+
true: string;
|
|
43
|
+
false: {
|
|
44
|
+
thumb: string;
|
|
45
|
+
option: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
animatesThumb: {
|
|
49
|
+
true: {
|
|
50
|
+
thumb: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
}, {
|
|
54
|
+
root: string;
|
|
55
|
+
thumb: string;
|
|
56
|
+
option: string;
|
|
57
|
+
input: string;
|
|
58
|
+
content: string;
|
|
59
|
+
icon: string;
|
|
60
|
+
}, undefined, undefined, undefined, undefined>;
|
|
61
|
+
export type SegmentedControlThemeVariants = VariantProps<typeof segmentedControlTheme>;
|
|
62
|
+
export type SegmentedControlSlotName = keyof ReturnType<typeof segmentedControlTheme>;
|
package/dist/index.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ export { KLoadingIndicator } from './elements/loading-indicator';
|
|
|
28
28
|
export type { LoadingIndicatorProps } from './elements/loading-indicator';
|
|
29
29
|
export { KRadioGroup } from './elements/radio-group';
|
|
30
30
|
export type { RadioGroupOption, RadioGroupProps } from './elements/radio-group';
|
|
31
|
+
export { KSegmentedControl } from './elements/segmented-control';
|
|
32
|
+
export type { SegmentedControlOption, SegmentedControlProps } from './elements/segmented-control';
|
|
31
33
|
export { KSwitch } from './elements/switch';
|
|
32
34
|
export type { SwitchProps } from './elements/switch';
|
|
33
35
|
export { KTextLink } from './elements/text-link';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { E as KAlert, T as KAvatar, w as KAvatarGroup, u as KBadge, D as KButton, l as KCheckbox, c as KCircularProgress, x as KDatePicker, b as KDatePickerField, y as KDateRangePicker, v as KDateRangePickerField, s as KLoadingDots, h as KLoadingIndicator, g as KMenu, o as KRadioGroup, a as KSegmentedControl, m as KSelect, p as KSelectField, i as KSwitch, f as KTextField, r as KTextLink, d as KTextarea, C as createMask, _ as extractMenuShortcuts, S as useMask, n as useShortcuts } from "./src-Bnn36nLV.js";
|
package/dist/nuxt.js
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type CSSProperties, type ShallowRef, type WatchSource } from 'vue';
|
|
2
|
+
export interface SlidingThumbOptions {
|
|
3
|
+
trackElement: Readonly<ShallowRef<HTMLElement | null>>;
|
|
4
|
+
findSelectedElement: () => HTMLElement | null | undefined;
|
|
5
|
+
placementSources: WatchSource[];
|
|
6
|
+
}
|
|
7
|
+
/** Slide a thumb under the selected element of a track, and jump without sliding when the track resizes. */
|
|
8
|
+
export declare function useSlidingThumb({ trackElement, findSelectedElement, placementSources }: SlidingThumbOptions): {
|
|
9
|
+
thumbStyle: import("vue").ComputedRef<CSSProperties | undefined>;
|
|
10
|
+
isThumbPlaced: import("vue").Ref<boolean, boolean>;
|
|
11
|
+
animatesThumb: import("vue").Ref<boolean, boolean>;
|
|
12
|
+
};
|