@kuina-ui/vue 0.3.0 → 0.4.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.
Files changed (33) hide show
  1. package/dist/components/date-picker/DateCalendar.vue.d.ts +2 -3
  2. package/dist/components/date-picker/DateCalendarPopover.vue.d.ts +61 -0
  3. package/dist/components/date-picker/DatePicker.vue.d.ts +3 -9
  4. package/dist/components/date-picker/DatePickerField.vue.d.ts +38 -0
  5. package/dist/components/date-picker/DateRangePicker.vue.d.ts +4 -18
  6. package/dist/components/date-picker/DateRangePickerField.vue.d.ts +40 -0
  7. package/dist/components/date-picker/datePickerProps.d.ts +42 -6
  8. package/dist/components/date-picker/index.d.ts +8 -2
  9. package/dist/components/date-picker/useDatePickerControl.d.ts +63 -0
  10. package/dist/components/date-picker/useDatePickerPopover.d.ts +2 -2
  11. package/dist/components/date-picker/useDateRangeSelection.d.ts +30 -0
  12. package/dist/components/date-picker/useDateRangeTyping.d.ts +45 -0
  13. package/dist/components/date-picker/useDateTypingFocus.d.ts +28 -0
  14. package/dist/components/date-picker/useSingleDateSelection.d.ts +15 -0
  15. package/dist/components/date-picker/useSingleDateTyping.d.ts +43 -0
  16. package/dist/components/date-picker/useTypedDateInput.d.ts +32 -0
  17. package/dist/components/select/SelectField.vue.d.ts +5 -5
  18. package/dist/components/text-field/TextField.vue.d.ts +7 -1
  19. package/dist/elements/select-field-control/SelectFieldControl.vue.d.ts +61 -0
  20. package/dist/elements/select-field-control/index.d.ts +3 -0
  21. package/dist/elements/select-field-control/select-field-control.theme.d.ts +101 -0
  22. package/dist/elements/text-link/TextLink.vue.d.ts +1 -1
  23. package/dist/index.d.ts +5 -2
  24. package/dist/index.js +1 -1
  25. package/dist/nuxt.js +1 -1
  26. package/dist/shared/composables/useMask.d.ts +10 -0
  27. package/dist/shared/types/mask.d.ts +17 -0
  28. package/dist/shared/utils/createDateInputMask.d.ts +19 -0
  29. package/dist/shared/utils/createMask.d.ts +10 -0
  30. package/dist/shared/utils/isoDate.d.ts +8 -0
  31. package/dist/{src-Cl5gtlze.js → src-ChY11Hfy.js} +3482 -2351
  32. package/package.json +1 -1
  33. package/dist/components/select/select-field.theme.d.ts +0 -250
@@ -0,0 +1,61 @@
1
+ import type { Component } from 'vue';
2
+ import type { ClassNameValue } from '../../shared/utils/tv';
3
+ import type { SelectFieldControlSlotName, SelectFieldControlThemeVariants } from './select-field-control.theme';
4
+ export interface SelectFieldControlProps {
5
+ label: string;
6
+ labelId: string;
7
+ valueId?: string;
8
+ hintId: string;
9
+ errorMessageId: string;
10
+ placeholder?: string;
11
+ hint?: string;
12
+ errorMessage?: string;
13
+ size?: SelectFieldControlThemeVariants['size'];
14
+ variant?: SelectFieldControlThemeVariants['variant'];
15
+ pill?: boolean;
16
+ floatLabel?: SelectFieldControlThemeVariants['floatLabel'];
17
+ open?: boolean;
18
+ invalid?: boolean;
19
+ disabled?: boolean;
20
+ hasValue?: boolean;
21
+ leadingIcon?: Component | null;
22
+ trailingIcon?: Component | null;
23
+ showsClearButton?: boolean;
24
+ clearLabel?: string;
25
+ spokenValue?: string;
26
+ triggerAttributes?: Record<string, unknown>;
27
+ ui?: Partial<Record<SelectFieldControlSlotName, ClassNameValue>>;
28
+ class?: ClassNameValue;
29
+ }
30
+ export interface SelectFieldControlSlots {
31
+ default?: () => unknown;
32
+ leading?: () => unknown;
33
+ input?: (inputSlotProps: {
34
+ inputClass: string;
35
+ }) => unknown;
36
+ status?: (statusSlotProps: {
37
+ statusClass: string;
38
+ }) => unknown;
39
+ popup?: () => unknown;
40
+ }
41
+ declare const _default: typeof __VLS_export;
42
+ export default _default;
43
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<SelectFieldControlProps, {
44
+ containerElement: Readonly<import("vue").ShallowRef<HTMLElement | null>>;
45
+ triggerElement: Readonly<import("vue").ShallowRef<HTMLElement | null>>;
46
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
47
+ clear: () => any;
48
+ }, string, import("vue").PublicProps, Readonly<SelectFieldControlProps> & Readonly<{
49
+ onClear?: (() => any) | undefined;
50
+ }>, {
51
+ pill: boolean;
52
+ size: "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl";
53
+ variant: "soft" | "outline";
54
+ clearLabel: string;
55
+ floatLabel: "auto" | "always";
56
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, SelectFieldControlSlots>;
57
+ type __VLS_WithSlots<T, S> = T & {
58
+ new (): {
59
+ $slots: S;
60
+ };
61
+ };
@@ -0,0 +1,3 @@
1
+ export { default as KSelectFieldControl } from './SelectFieldControl.vue';
2
+ export type { SelectFieldControlProps, SelectFieldControlSlots } from './SelectFieldControl.vue';
3
+ export type { SelectFieldControlSlotName, SelectFieldControlThemeVariants } from './select-field-control.theme';
@@ -0,0 +1,101 @@
1
+ import { type VariantProps } from '../../shared/utils/tv';
2
+ export declare const selectFieldControlTheme: import("tailwind-variants").TVReturnType<{
3
+ size: Record<"md" | "lg" | "xl" | "2xl" | "3xl" | "4xl", {
4
+ base: string[];
5
+ leadingIcon: string;
6
+ trailingIcon: string;
7
+ loadingIndicator: string;
8
+ clearButton: string;
9
+ clearIcon: string;
10
+ }>;
11
+ variant: {
12
+ outline: string;
13
+ soft: string;
14
+ };
15
+ pill: {
16
+ true: string;
17
+ false: string;
18
+ };
19
+ fieldState: {
20
+ invalid: {
21
+ base: string;
22
+ label: string;
23
+ };
24
+ disabled: {
25
+ label: string;
26
+ };
27
+ open: {
28
+ base: string;
29
+ label: string;
30
+ };
31
+ idle: {
32
+ label: string;
33
+ };
34
+ };
35
+ floatLabel: {
36
+ auto: string;
37
+ always: {
38
+ placeholder: string;
39
+ input: string;
40
+ };
41
+ };
42
+ labelFloating: {
43
+ true: {
44
+ label: string;
45
+ };
46
+ false: {
47
+ label: string;
48
+ };
49
+ };
50
+ hasLeadingIcon: {
51
+ true: string;
52
+ false: string;
53
+ };
54
+ disabled: {
55
+ true: {
56
+ container: string;
57
+ base: string;
58
+ };
59
+ false: {
60
+ base: string;
61
+ };
62
+ };
63
+ open: {
64
+ true: {
65
+ trailingIcon: string;
66
+ placeholder: string;
67
+ };
68
+ false: {
69
+ trailingIcon: string;
70
+ };
71
+ };
72
+ hasTrailingIcon: {
73
+ true: {
74
+ clearButton: string;
75
+ };
76
+ false: {
77
+ clearButton: string;
78
+ };
79
+ };
80
+ }, {
81
+ root: string;
82
+ container: string;
83
+ base: string;
84
+ leadingIcon: string;
85
+ leadingAvatar: string;
86
+ value: string;
87
+ input: string;
88
+ placeholder: string;
89
+ selectionForScreenReaders: string;
90
+ trailing: string;
91
+ clearButton: string;
92
+ clearIcon: string;
93
+ loadingIndicator: string;
94
+ trailingIcon: string;
95
+ label: string;
96
+ hint: string;
97
+ errorMessage: string;
98
+ errorIcon: string;
99
+ }, undefined, undefined, undefined, undefined>;
100
+ export type SelectFieldControlThemeVariants = VariantProps<typeof selectFieldControlTheme>;
101
+ export type SelectFieldControlSlotName = keyof ReturnType<typeof selectFieldControlTheme>;
@@ -18,7 +18,7 @@ export default _default;
18
18
  declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<TextLinkProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TextLinkProps> & Readonly<{}>, {
19
19
  color: "primary" | "inherit" | "muted";
20
20
  href: string;
21
- weight: "medium" | "inherit" | "semibold";
21
+ weight: "inherit" | "medium" | "semibold";
22
22
  underline: boolean;
23
23
  external: boolean;
24
24
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ export { KAlert } from './components/alert';
2
2
  export type { AlertProps } from './components/alert';
3
3
  export { KAvatarGroup } from './components/avatar-group';
4
4
  export type { AvatarGroupMember, AvatarGroupProps } from './components/avatar-group';
5
- export { KDatePicker, KDateRangePicker } from './components/date-picker';
6
- export type { DatePickerProps, DatePickerSlots, DateRange, DateRangePickerProps, DateRangePickerSlots, DateRangeShortcut, } from './components/date-picker';
5
+ export { KDatePicker, KDatePickerField, KDateRangePicker, KDateRangePickerField } from './components/date-picker';
6
+ export type { DatePickerFieldProps, DatePickerProps, DatePickerSlots, DateRange, DateRangePickerFieldProps, DateRangePickerProps, DateRangePickerSlots, DateRangeShortcut, } from './components/date-picker';
7
7
  export { extractMenuShortcuts, KMenu } from './components/menu';
8
8
  export type { MenuEntry, MenuGroup, MenuHeader, MenuItem, MenuItemAction, MenuProps, MenuSeparator, MenuTriggerProps, } from './components/menu';
9
9
  export { KSelect, KSelectField } from './components/select';
@@ -32,7 +32,10 @@ export { KSwitch } from './elements/switch';
32
32
  export type { SwitchProps } from './elements/switch';
33
33
  export { KTextLink } from './elements/text-link';
34
34
  export type { TextLinkProps } from './elements/text-link';
35
+ export { useMask } from './shared/composables/useMask';
35
36
  export { useShortcuts } from './shared/composables/useShortcuts';
36
37
  export type { ShortcutListenerOptions } from './shared/composables/useShortcuts';
37
38
  export type { KeyCombination, ShortcutBinding, ShortcutContext, ShortcutDefinition, ShortcutDefinitions, ShortcutGuard, ShortcutHandler, ShortcutModifierName, ShortcutOptions, } from './shared/types/shortcut';
38
39
  export type { DateOrDateRange, Weekday } from './shared/types/calendar';
40
+ export type { MaskOptions, MaskResult, MaskSettings, MaskToken, MaskTokens } from './shared/types/mask';
41
+ export { createMask } from './shared/utils/createMask';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export { x as KAlert, b as KAvatar, y as KAvatarGroup, l as KBadge, S as KButton, c as KCheckbox, s as KCircularProgress, v as KDatePicker, _ as KDateRangePicker, o as KLoadingDots, m as KLoadingIndicator, h as KMenu, a as KRadioGroup, p as KSelect, f as KSelectField, i as KSwitch, d as KTextField, r as KTextLink, u as KTextarea, g as extractMenuShortcuts, n as useShortcuts } from "./src-Cl5gtlze.js";
1
+ export { T as KAlert, w as KAvatar, C as KAvatarGroup, l as KBadge, E as KButton, c as KCheckbox, s as KCircularProgress, b as KDatePicker, y as KDatePickerField, v as KDateRangePicker, _ as KDateRangePickerField, o as KLoadingDots, m as KLoadingIndicator, h as KMenu, a as KRadioGroup, p as KSelect, f as KSelectField, i as KSwitch, d as KTextField, r as KTextLink, u as KTextarea, S as createMask, g as extractMenuShortcuts, x as useMask, n as useShortcuts } from "./src-ChY11Hfy.js";
package/dist/nuxt.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as e } from "./src-Cl5gtlze.js";
1
+ import { t as e } from "./src-ChY11Hfy.js";
2
2
  import { addComponent as t, addImports as n, addVitePlugin as r, defineNuxtModule as i } from "@nuxt/kit";
3
3
  import a from "@tailwindcss/vite";
4
4
  // src/nuxt.ts
@@ -0,0 +1,10 @@
1
+ import { type MaybeRefOrGetter } from 'vue';
2
+ import type { MaskOptions } from '../types/mask';
3
+ /** Mask what is typed in an input: bind `maskedValue` as its value and `applyMaskOnInput` on its input event. */
4
+ export declare function useMask(maskOptions: MaybeRefOrGetter<MaskOptions>, initialText?: string): {
5
+ maskedValue: Readonly<import("vue").Ref<string, string>>;
6
+ unmaskedValue: import("vue").ComputedRef<string>;
7
+ isComplete: import("vue").ComputedRef<boolean>;
8
+ setMaskedValue: (text: string) => void;
9
+ applyMaskOnInput: (inputEvent: Event) => void;
10
+ };
@@ -0,0 +1,17 @@
1
+ export interface MaskToken {
2
+ pattern: RegExp;
3
+ transform?: (character: string) => string;
4
+ }
5
+ export type MaskTokens = Record<string, MaskToken>;
6
+ export interface MaskSettings {
7
+ pattern: string | string[];
8
+ tokens?: MaskTokens;
9
+ eager?: boolean;
10
+ preprocess?: (text: string) => string;
11
+ }
12
+ export type MaskOptions = string | string[] | MaskSettings;
13
+ export interface MaskResult {
14
+ masked: string;
15
+ unmasked: string;
16
+ completed: boolean;
17
+ }
@@ -0,0 +1,19 @@
1
+ /** Describe how dates are typed in a language: the mask pattern, the format hint, and how typed text becomes a date. */
2
+ export declare function createDateInputMask(locale: string): {
3
+ pattern: string;
4
+ formatHint: string;
5
+ formatIsoDate: (isoDate: string) => string;
6
+ parseTypedDate: (typedText: string) => string | undefined;
7
+ normalizeTypedDate: (typedText: string) => string;
8
+ rangePattern: string;
9
+ rangeFormatHint: string;
10
+ formatIsoRange: ([rangeStart, rangeEnd]: [string, string]) => string;
11
+ parseTypedRange: (typedText: string) => {
12
+ hasCompleteStart: boolean;
13
+ hasCompleteEnd: boolean;
14
+ rangeStart: string | undefined;
15
+ rangeEnd: string | undefined;
16
+ };
17
+ normalizeTypedRange: (typedText: string) => string;
18
+ };
19
+ export type DateInputMask = ReturnType<typeof createDateInputMask>;
@@ -0,0 +1,10 @@
1
+ import type { MaskOptions, MaskResult, MaskTokens } from '../types/mask';
2
+ export declare const defaultMaskTokens: MaskTokens;
3
+ /** Build a mask from a pattern like `##/##/####`, where tokens accept characters and anything else is written as is. */
4
+ export declare function createMask(maskOptions: MaskOptions): {
5
+ apply: (text: string, applyOptions?: {
6
+ eager?: boolean;
7
+ }) => MaskResult;
8
+ findCaretPosition: (maskedText: string, acceptedCharacterCount: number) => number;
9
+ };
10
+ export type Mask = ReturnType<typeof createMask>;
@@ -13,6 +13,14 @@ export declare function countMonthsBetweenIsoMonths(fromIsoMonth: string, toIsoM
13
13
  export declare function countDaysBetweenIsoDates(fromIsoDate: string, toIsoDate: string): number;
14
14
  /** Tell whether a date is one of the listed dates, or falls inside one of the listed ranges, both ends included. */
15
15
  export declare function isIsoDateInDateList(isoDate: string, dateList: DateOrDateRange[]): boolean;
16
+ export interface IsoDateLimits {
17
+ min?: string;
18
+ max?: string;
19
+ disabledDates?: DateOrDateRange[];
20
+ isDateDisabled?: (isoDate: string) => boolean;
21
+ }
22
+ /** Tell whether a date falls outside min and max, or is disabled by the list or the function. */
23
+ export declare function isIsoDateUnavailable(isoDate: string, dateLimits: IsoDateLimits): boolean;
16
24
  export declare function clampIsoDate(isoDate: string, minIsoDate?: string, maxIsoDate?: string): string;
17
25
  /** Read today's date in the time zone of the device, which is the day its user sees on the calendar. */
18
26
  export declare function findLocalTodayIsoDate(): string;