@kuina-ui/vue 0.3.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/components/date-picker/DateCalendar.vue.d.ts +2 -3
- package/dist/components/date-picker/DateCalendarPopover.vue.d.ts +61 -0
- package/dist/components/date-picker/DatePicker.vue.d.ts +3 -9
- package/dist/components/date-picker/DatePickerField.vue.d.ts +38 -0
- package/dist/components/date-picker/DateRangePicker.vue.d.ts +4 -18
- package/dist/components/date-picker/DateRangePickerField.vue.d.ts +40 -0
- package/dist/components/date-picker/datePickerProps.d.ts +42 -6
- package/dist/components/date-picker/index.d.ts +8 -2
- package/dist/components/date-picker/useDatePickerControl.d.ts +63 -0
- package/dist/components/date-picker/useDatePickerPopover.d.ts +2 -2
- package/dist/components/date-picker/useDateRangeSelection.d.ts +30 -0
- package/dist/components/date-picker/useDateRangeTyping.d.ts +45 -0
- package/dist/components/date-picker/useDateTypingFocus.d.ts +28 -0
- package/dist/components/date-picker/useSingleDateSelection.d.ts +15 -0
- package/dist/components/date-picker/useSingleDateTyping.d.ts +43 -0
- package/dist/components/date-picker/useTypedDateInput.d.ts +32 -0
- package/dist/components/select/SelectField.vue.d.ts +5 -5
- package/dist/components/text-field/TextField.vue.d.ts +7 -1
- 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/elements/select-field-control/SelectFieldControl.vue.d.ts +61 -0
- package/dist/elements/select-field-control/index.d.ts +3 -0
- package/dist/elements/select-field-control/select-field-control.theme.d.ts +101 -0
- package/dist/elements/text-link/TextLink.vue.d.ts +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.js +1 -1
- package/dist/nuxt.js +1 -1
- package/dist/shared/composables/useMask.d.ts +10 -0
- package/dist/shared/composables/useSlidingThumb.d.ts +12 -0
- package/dist/shared/types/mask.d.ts +17 -0
- package/dist/shared/utils/createDateInputMask.d.ts +19 -0
- package/dist/shared/utils/createMask.d.ts +10 -0
- package/dist/shared/utils/isoDate.d.ts +8 -0
- package/dist/shared/utils/resolvePressScale.d.ts +2 -0
- package/dist/{src-Cl5gtlze.js → src-Bnn36nLV.js} +3952 -2465
- package/package.json +75 -75
- package/dist/components/select/select-field.theme.d.ts +0 -250
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
|
|
@@ -19,12 +19,11 @@ type __VLS_Props = {
|
|
|
19
19
|
nextMonthLabel: string;
|
|
20
20
|
ui?: Partial<Record<DateCalendarSlotName, ClassNameValue>>;
|
|
21
21
|
};
|
|
22
|
-
/** Bring a date into view: slide one month when it is next to the visible ones, else jump to it without sliding. */
|
|
23
|
-
declare function revealDate(isoDate: string): void;
|
|
24
22
|
declare function focusTabbableDay(): void;
|
|
23
|
+
declare function showDate(isoDate: string): void;
|
|
25
24
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
26
25
|
focusTabbableDay: typeof focusTabbableDay;
|
|
27
|
-
|
|
26
|
+
showDate: typeof showDate;
|
|
28
27
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
29
28
|
selectDate: (isoDate: string) => any;
|
|
30
29
|
hoverDate: (isoDate: string) => any;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { DateOrDateRange, Weekday } from '../../shared/types/calendar';
|
|
2
|
+
import type { FloatingAlign, FloatingSide, FloatingStrategy } from '../../shared/types/floating-position';
|
|
3
|
+
import type { ClassNameValue } from '../../shared/utils/tv';
|
|
4
|
+
import type { DateCalendarSlotName } from './date-calendar.theme';
|
|
5
|
+
import { type DatePickerSlotName } from './date-picker.theme';
|
|
6
|
+
import type { DateRangeShortcut } from './datePickerProps';
|
|
7
|
+
type __VLS_Props = {
|
|
8
|
+
open: boolean;
|
|
9
|
+
dialogId: string;
|
|
10
|
+
label: string;
|
|
11
|
+
anchorElement: HTMLElement | null | undefined;
|
|
12
|
+
side: FloatingSide;
|
|
13
|
+
align: FloatingAlign;
|
|
14
|
+
flip: boolean;
|
|
15
|
+
strategy: FloatingStrategy;
|
|
16
|
+
initialFocusedDate: string;
|
|
17
|
+
monthCount?: number;
|
|
18
|
+
selectedStart?: string;
|
|
19
|
+
selectedEnd?: string;
|
|
20
|
+
min?: string;
|
|
21
|
+
max?: string;
|
|
22
|
+
disabledDates?: DateOrDateRange[];
|
|
23
|
+
isDateDisabled?: (isoDate: string) => boolean;
|
|
24
|
+
weekStartsOn: Weekday;
|
|
25
|
+
weekdayLabel: (weekday: Weekday) => string;
|
|
26
|
+
monthLabel: (isoMonth: string) => string;
|
|
27
|
+
dayLabel: (isoDate: string) => string;
|
|
28
|
+
previousMonthLabel: string;
|
|
29
|
+
nextMonthLabel: string;
|
|
30
|
+
shortcuts?: DateRangeShortcut[];
|
|
31
|
+
activeShortcut?: DateRangeShortcut;
|
|
32
|
+
focusesCalendarOnOpen?: boolean;
|
|
33
|
+
ui?: Partial<Record<DatePickerSlotName | DateCalendarSlotName, ClassNameValue>>;
|
|
34
|
+
};
|
|
35
|
+
declare function showDate(isoDate: string): void;
|
|
36
|
+
declare function focusCalendar(): void;
|
|
37
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
38
|
+
panelElement: import("vue").ComputedRef<HTMLElement | null>;
|
|
39
|
+
showDate: typeof showDate;
|
|
40
|
+
focusCalendar: typeof focusCalendar;
|
|
41
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
42
|
+
selectDate: (isoDate: string) => any;
|
|
43
|
+
hoverDate: (isoDate: string) => any;
|
|
44
|
+
leaveDates: () => any;
|
|
45
|
+
selectShortcut: (shortcut: DateRangeShortcut) => any;
|
|
46
|
+
panelKeydown: (keyboardEvent: KeyboardEvent) => any;
|
|
47
|
+
panelFocusout: (focusEvent: FocusEvent) => any;
|
|
48
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
49
|
+
onSelectDate?: ((isoDate: string) => any) | undefined;
|
|
50
|
+
onHoverDate?: ((isoDate: string) => any) | undefined;
|
|
51
|
+
onLeaveDates?: (() => any) | undefined;
|
|
52
|
+
onSelectShortcut?: ((shortcut: DateRangeShortcut) => any) | undefined;
|
|
53
|
+
onPanelKeydown?: ((keyboardEvent: KeyboardEvent) => any) | undefined;
|
|
54
|
+
onPanelFocusout?: ((focusEvent: FocusEvent) => any) | undefined;
|
|
55
|
+
}>, {
|
|
56
|
+
monthCount: number;
|
|
57
|
+
shortcuts: DateRangeShortcut[];
|
|
58
|
+
focusesCalendarOnOpen: boolean;
|
|
59
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
60
|
+
declare const _default: typeof __VLS_export;
|
|
61
|
+
export default _default;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
export interface DatePickerSlots {
|
|
6
|
-
selection?: (selectionSlotProps: {
|
|
7
|
-
selectedDate: string;
|
|
8
|
-
}) => unknown;
|
|
1
|
+
import type { DatePickerSlots } from './datePickerProps';
|
|
2
|
+
import type { DatePickerBaseProps, SingleDateProps } from './datePickerProps';
|
|
3
|
+
export interface DatePickerProps extends DatePickerBaseProps, SingleDateProps {
|
|
9
4
|
}
|
|
10
5
|
declare const _default: typeof __VLS_export;
|
|
11
6
|
export default _default;
|
|
@@ -27,7 +22,6 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<DatePi
|
|
|
27
22
|
variant: "soft" | "outline" | "ghost";
|
|
28
23
|
block: boolean;
|
|
29
24
|
clearLabel: string;
|
|
30
|
-
placeholder: string;
|
|
31
25
|
side: import("../../shared/types/floating-position.ts").FloatingSide;
|
|
32
26
|
align: import("../../shared/types/floating-position.ts").FloatingAlign;
|
|
33
27
|
weekStartsOn: import("../../index.ts").Weekday;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { DatePickerSlots } from './datePickerProps';
|
|
2
|
+
import type { DatePickerFieldBaseProps, SingleDateProps } from './datePickerProps';
|
|
3
|
+
export interface DatePickerFieldProps extends DatePickerFieldBaseProps, SingleDateProps {
|
|
4
|
+
}
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
7
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<DatePickerFieldProps & {
|
|
8
|
+
modelValue?: string;
|
|
9
|
+
open?: boolean;
|
|
10
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
"update:open": (value: boolean) => any;
|
|
12
|
+
"update:modelValue": (value: string | undefined) => any;
|
|
13
|
+
}, string, import("vue").PublicProps, Readonly<DatePickerFieldProps & {
|
|
14
|
+
modelValue?: string;
|
|
15
|
+
open?: boolean;
|
|
16
|
+
}> & Readonly<{
|
|
17
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
18
|
+
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
19
|
+
}>, {
|
|
20
|
+
pill: boolean;
|
|
21
|
+
size: "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl";
|
|
22
|
+
variant: "soft" | "outline";
|
|
23
|
+
clearLabel: string;
|
|
24
|
+
side: import("../../shared/types/floating-position.ts").FloatingSide;
|
|
25
|
+
align: import("../../shared/types/floating-position.ts").FloatingAlign;
|
|
26
|
+
weekStartsOn: import("../../index.ts").Weekday;
|
|
27
|
+
previousMonthLabel: string;
|
|
28
|
+
nextMonthLabel: string;
|
|
29
|
+
flip: boolean;
|
|
30
|
+
strategy: import("../../shared/types/floating-position.ts").FloatingStrategy;
|
|
31
|
+
floatLabel: "auto" | "always";
|
|
32
|
+
locale: string;
|
|
33
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, DatePickerSlots>;
|
|
34
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
35
|
+
new (): {
|
|
36
|
+
$slots: S;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
@@ -1,20 +1,7 @@
|
|
|
1
1
|
import type { DateRange } from '../../shared/types/calendar';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
export interface
|
|
5
|
-
label: string;
|
|
6
|
-
value: DateRange;
|
|
7
|
-
}
|
|
8
|
-
export interface DateRangePickerProps extends DatePickerBaseProps {
|
|
9
|
-
shortcuts?: DateRangeShortcut[];
|
|
10
|
-
maxRangeDays?: number;
|
|
11
|
-
selectionLabel?: (selectedRange: DateRange, activeShortcut?: DateRangeShortcut) => string;
|
|
12
|
-
}
|
|
13
|
-
export interface DateRangePickerSlots {
|
|
14
|
-
selection?: (selectionSlotProps: {
|
|
15
|
-
selectedRange: DateRange;
|
|
16
|
-
activeShortcut?: DateRangeShortcut;
|
|
17
|
-
}) => unknown;
|
|
2
|
+
import type { DateRangePickerSlots } from './datePickerProps';
|
|
3
|
+
import type { DatePickerBaseProps, DateRangeProps } from './datePickerProps';
|
|
4
|
+
export interface DateRangePickerProps extends DatePickerBaseProps, DateRangeProps {
|
|
18
5
|
}
|
|
19
6
|
declare const _default: typeof __VLS_export;
|
|
20
7
|
export default _default;
|
|
@@ -36,13 +23,12 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<DateRa
|
|
|
36
23
|
variant: "soft" | "outline" | "ghost";
|
|
37
24
|
block: boolean;
|
|
38
25
|
clearLabel: string;
|
|
39
|
-
placeholder: string;
|
|
40
26
|
side: import("../../shared/types/floating-position.ts").FloatingSide;
|
|
41
27
|
align: import("../../shared/types/floating-position.ts").FloatingAlign;
|
|
42
28
|
weekStartsOn: import("../../index.ts").Weekday;
|
|
43
29
|
previousMonthLabel: string;
|
|
44
30
|
nextMonthLabel: string;
|
|
45
|
-
shortcuts: DateRangeShortcut[];
|
|
31
|
+
shortcuts: import("./datePickerProps").DateRangeShortcut[];
|
|
46
32
|
flip: boolean;
|
|
47
33
|
strategy: import("../../shared/types/floating-position.ts").FloatingStrategy;
|
|
48
34
|
locale: string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { DateRange } from '../../shared/types/calendar';
|
|
2
|
+
import type { DateRangePickerSlots } from './datePickerProps';
|
|
3
|
+
import type { DatePickerFieldBaseProps, DateRangeProps } from './datePickerProps';
|
|
4
|
+
export interface DateRangePickerFieldProps extends DatePickerFieldBaseProps, DateRangeProps {
|
|
5
|
+
}
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
8
|
+
declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<DateRangePickerFieldProps & {
|
|
9
|
+
modelValue?: DateRange;
|
|
10
|
+
open?: boolean;
|
|
11
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
"update:open": (value: boolean) => any;
|
|
13
|
+
"update:modelValue": (value: DateRange | undefined) => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<DateRangePickerFieldProps & {
|
|
15
|
+
modelValue?: DateRange;
|
|
16
|
+
open?: boolean;
|
|
17
|
+
}> & Readonly<{
|
|
18
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
19
|
+
"onUpdate:modelValue"?: ((value: DateRange | undefined) => any) | undefined;
|
|
20
|
+
}>, {
|
|
21
|
+
pill: boolean;
|
|
22
|
+
size: "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl";
|
|
23
|
+
variant: "soft" | "outline";
|
|
24
|
+
clearLabel: string;
|
|
25
|
+
side: import("../../shared/types/floating-position.ts").FloatingSide;
|
|
26
|
+
align: import("../../shared/types/floating-position.ts").FloatingAlign;
|
|
27
|
+
weekStartsOn: import("../../index.ts").Weekday;
|
|
28
|
+
previousMonthLabel: string;
|
|
29
|
+
nextMonthLabel: string;
|
|
30
|
+
shortcuts: import("./datePickerProps").DateRangeShortcut[];
|
|
31
|
+
flip: boolean;
|
|
32
|
+
strategy: import("../../shared/types/floating-position.ts").FloatingStrategy;
|
|
33
|
+
floatLabel: "auto" | "always";
|
|
34
|
+
locale: string;
|
|
35
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, DateRangePickerSlots>;
|
|
36
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
37
|
+
new (): {
|
|
38
|
+
$slots: S;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import type { Component } from 'vue';
|
|
2
2
|
import type { SelectControlSlotName, SelectControlThemeVariants } from '../../elements/select-control';
|
|
3
|
-
import type {
|
|
3
|
+
import type { SelectFieldControlSlotName, SelectFieldControlThemeVariants } from '../../elements/select-field-control';
|
|
4
|
+
import type { DateOrDateRange, DateRange, Weekday } from '../../shared/types/calendar';
|
|
4
5
|
import type { FloatingAlign, FloatingSide, FloatingStrategy } from '../../shared/types/floating-position';
|
|
5
6
|
import type { ClassNameValue } from '../../shared/utils/tv';
|
|
6
7
|
import type { DateCalendarSlotName } from './date-calendar.theme';
|
|
7
8
|
import type { DatePickerSlotName } from './date-picker.theme';
|
|
8
|
-
export interface
|
|
9
|
+
export interface DateRangeShortcut {
|
|
9
10
|
label: string;
|
|
11
|
+
value: DateRange;
|
|
12
|
+
}
|
|
13
|
+
export interface DatePickerSharedProps {
|
|
14
|
+
label: string;
|
|
15
|
+
editable?: boolean;
|
|
10
16
|
min?: string;
|
|
11
17
|
max?: string;
|
|
12
18
|
disabledDates?: DateOrDateRange[];
|
|
@@ -24,16 +30,46 @@ export interface DatePickerBaseProps {
|
|
|
24
30
|
name?: string;
|
|
25
31
|
disabled?: boolean;
|
|
26
32
|
invalid?: boolean;
|
|
27
|
-
size?: SelectControlThemeVariants['size'];
|
|
28
|
-
variant?: SelectControlThemeVariants['variant'];
|
|
29
33
|
pill?: boolean;
|
|
30
|
-
block?: boolean;
|
|
31
34
|
leadingIcon?: Component | null;
|
|
32
35
|
trailingIcon?: Component | null;
|
|
33
36
|
side?: FloatingSide;
|
|
34
37
|
align?: FloatingAlign;
|
|
35
38
|
flip?: boolean;
|
|
36
39
|
strategy?: FloatingStrategy;
|
|
37
|
-
ui?: Partial<Record<SelectControlSlotName | DatePickerSlotName | DateCalendarSlotName, ClassNameValue>>;
|
|
38
40
|
class?: ClassNameValue;
|
|
39
41
|
}
|
|
42
|
+
export interface DatePickerBaseProps extends DatePickerSharedProps {
|
|
43
|
+
size?: SelectControlThemeVariants['size'];
|
|
44
|
+
variant?: SelectControlThemeVariants['variant'];
|
|
45
|
+
block?: boolean;
|
|
46
|
+
ui?: Partial<Record<SelectControlSlotName | DatePickerSlotName | DateCalendarSlotName, ClassNameValue>>;
|
|
47
|
+
}
|
|
48
|
+
export interface DatePickerFieldBaseProps extends DatePickerSharedProps {
|
|
49
|
+
id?: string;
|
|
50
|
+
hint?: string;
|
|
51
|
+
errorMessage?: string;
|
|
52
|
+
floatLabel?: SelectFieldControlThemeVariants['floatLabel'];
|
|
53
|
+
size?: SelectFieldControlThemeVariants['size'];
|
|
54
|
+
variant?: SelectFieldControlThemeVariants['variant'];
|
|
55
|
+
ui?: Partial<Record<SelectFieldControlSlotName | DatePickerSlotName | DateCalendarSlotName, ClassNameValue>>;
|
|
56
|
+
}
|
|
57
|
+
export interface SingleDateProps {
|
|
58
|
+
selectionLabel?: (selectedDate: string) => string;
|
|
59
|
+
}
|
|
60
|
+
export interface DateRangeProps {
|
|
61
|
+
shortcuts?: DateRangeShortcut[];
|
|
62
|
+
maxRangeDays?: number;
|
|
63
|
+
selectionLabel?: (selectedRange: DateRange, activeShortcut?: DateRangeShortcut) => string;
|
|
64
|
+
}
|
|
65
|
+
export interface DatePickerSlots {
|
|
66
|
+
selection?: (selectionSlotProps: {
|
|
67
|
+
selectedDate: string;
|
|
68
|
+
}) => unknown;
|
|
69
|
+
}
|
|
70
|
+
export interface DateRangePickerSlots {
|
|
71
|
+
selection?: (selectionSlotProps: {
|
|
72
|
+
selectedRange: DateRange;
|
|
73
|
+
activeShortcut?: DateRangeShortcut;
|
|
74
|
+
}) => unknown;
|
|
75
|
+
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
export { default as KDatePicker } from './DatePicker.vue';
|
|
2
|
+
export { default as KDatePickerField } from './DatePickerField.vue';
|
|
2
3
|
export { default as KDateRangePicker } from './DateRangePicker.vue';
|
|
3
|
-
export
|
|
4
|
-
export type {
|
|
4
|
+
export { default as KDateRangePickerField } from './DateRangePickerField.vue';
|
|
5
|
+
export type { DatePickerProps } from './DatePicker.vue';
|
|
6
|
+
export type { DatePickerFieldProps } from './DatePickerField.vue';
|
|
7
|
+
export type { DateRangePickerProps } from './DateRangePicker.vue';
|
|
8
|
+
export type { DateRangePickerFieldProps } from './DateRangePickerField.vue';
|
|
9
|
+
export type { DatePickerSlots, DateRangePickerSlots, DateRangeShortcut } from './datePickerProps';
|
|
10
|
+
export type { DateRange } from '../../shared/types/calendar';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type Component, type Ref } from 'vue';
|
|
2
|
+
import { type CalendarLabelOptions } from '../../shared/composables/useCalendarLabels';
|
|
3
|
+
interface DatePickerControlProps extends CalendarLabelOptions {
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
leadingIcon?: Component | null;
|
|
6
|
+
trailingIcon?: Component | null;
|
|
7
|
+
}
|
|
8
|
+
interface DatePickerControlOptions {
|
|
9
|
+
isOpen: Ref<boolean>;
|
|
10
|
+
isInvalid: () => boolean;
|
|
11
|
+
rootElement: Readonly<Ref<HTMLElement | null>>;
|
|
12
|
+
triggerElement: Readonly<Ref<HTMLElement | null>>;
|
|
13
|
+
panelElement: Readonly<Ref<HTMLElement | null>>;
|
|
14
|
+
onClose?: () => void;
|
|
15
|
+
}
|
|
16
|
+
/** Share between the date pickers how their calendar opens, what their trigger says to assistive technology, and their texts and icons. */
|
|
17
|
+
export declare function useDatePickerControl(controlProps: DatePickerControlProps, controlOptions: DatePickerControlOptions): {
|
|
18
|
+
dialogTriggerAttributes: import("vue").ComputedRef<{
|
|
19
|
+
role: string;
|
|
20
|
+
tabindex: number;
|
|
21
|
+
'aria-haspopup': "dialog";
|
|
22
|
+
'aria-expanded': boolean;
|
|
23
|
+
'aria-controls': string | undefined;
|
|
24
|
+
'aria-disabled': true | undefined;
|
|
25
|
+
'aria-invalid': true | undefined;
|
|
26
|
+
onClick: () => void;
|
|
27
|
+
onKeydown: (keydownEvent: Event) => void;
|
|
28
|
+
}>;
|
|
29
|
+
typedInputAttributes: import("vue").ComputedRef<{
|
|
30
|
+
type: string;
|
|
31
|
+
inputmode: "numeric";
|
|
32
|
+
autocomplete: string;
|
|
33
|
+
spellcheck: boolean;
|
|
34
|
+
role: string;
|
|
35
|
+
'aria-haspopup': "dialog";
|
|
36
|
+
'aria-expanded': boolean;
|
|
37
|
+
'aria-controls': string | undefined;
|
|
38
|
+
'aria-invalid': true | undefined;
|
|
39
|
+
disabled: boolean | undefined;
|
|
40
|
+
}>;
|
|
41
|
+
resolvedLeadingIcon: import("vue").ComputedRef<Component | import("vue").FunctionalComponent<import("lucide-vue-next").LucideProps, {}, any, {}> | null>;
|
|
42
|
+
resolvedTrailingIcon: import("vue").ComputedRef<Component | import("vue").FunctionalComponent<import("lucide-vue-next").LucideProps, {}, any, {}> | null>;
|
|
43
|
+
openCalendar: () => void;
|
|
44
|
+
closeCalendar: ({ restoreFocus }: {
|
|
45
|
+
restoreFocus: boolean;
|
|
46
|
+
}) => void;
|
|
47
|
+
toggleCalendar: () => void;
|
|
48
|
+
openCalendarFromTriggerKeys: (keydownEvent: Event) => void;
|
|
49
|
+
closeCalendarOnEscape: (keydownEvent: Event) => void;
|
|
50
|
+
closeCalendarWhenFocusLeaves: (focusEvent: FocusEvent) => void;
|
|
51
|
+
dateFormatters: import("vue").ComputedRef<{
|
|
52
|
+
formatShortDate: (isoDate: string) => string;
|
|
53
|
+
formatFullDate: (isoDate: string) => string;
|
|
54
|
+
formatMonth: (isoMonth: string) => string;
|
|
55
|
+
formatWeekday: (weekday: import("../..").Weekday) => string;
|
|
56
|
+
}>;
|
|
57
|
+
resolvedWeekdayLabel: import("vue").ComputedRef<(weekday: import("../..").Weekday) => string>;
|
|
58
|
+
resolvedMonthLabel: import("vue").ComputedRef<(isoMonth: string) => string>;
|
|
59
|
+
resolvedDayLabel: import("vue").ComputedRef<(isoDate: string) => string>;
|
|
60
|
+
calendarDialogId: string;
|
|
61
|
+
isOpenable: import("vue").ComputedRef<boolean>;
|
|
62
|
+
};
|
|
63
|
+
export {};
|