@webx-ui/core 0.0.2 → 0.2.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 (75) hide show
  1. package/dist/components/Card/Card.d.ts +3 -1
  2. package/dist/components/Card/types.d.ts +2 -2
  3. package/dist/components/Checkbox/Checkbox.d.ts +41 -0
  4. package/dist/components/Checkbox/index.d.ts +2 -0
  5. package/dist/components/Checkbox/types.d.ts +18 -0
  6. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +37 -0
  7. package/dist/components/CheckboxGroup/index.d.ts +2 -0
  8. package/dist/components/CheckboxGroup/types.d.ts +23 -0
  9. package/dist/components/ColorPicker/ColorPicker.d.ts +25 -0
  10. package/dist/components/ColorPicker/index.d.ts +2 -0
  11. package/dist/components/ColorPicker/types.d.ts +21 -0
  12. package/dist/components/DatePicker/DatePicker.d.ts +54 -0
  13. package/dist/components/DatePicker/index.d.ts +2 -0
  14. package/dist/components/DatePicker/types.d.ts +47 -0
  15. package/dist/components/DateRangePicker/DateRangePicker.d.ts +51 -0
  16. package/dist/components/DateRangePicker/index.d.ts +2 -0
  17. package/dist/components/DateRangePicker/types.d.ts +37 -0
  18. package/dist/components/DateTimePicker/DateTimePicker.d.ts +52 -0
  19. package/dist/components/DateTimePicker/index.d.ts +1 -0
  20. package/dist/components/Form/Form.d.ts +32 -0
  21. package/dist/components/Form/index.d.ts +2 -0
  22. package/dist/components/Form/types.d.ts +22 -0
  23. package/dist/components/FormItem/FormItem.d.ts +33 -0
  24. package/dist/components/FormItem/index.d.ts +2 -0
  25. package/dist/components/FormItem/types.d.ts +24 -0
  26. package/dist/components/Input/Input.d.ts +11 -10
  27. package/dist/components/Input/types.d.ts +2 -0
  28. package/dist/components/InputNumber/InputNumber.d.ts +41 -0
  29. package/dist/components/InputNumber/index.d.ts +2 -0
  30. package/dist/components/InputNumber/types.d.ts +34 -0
  31. package/dist/components/Pagination/Pagination.d.ts +45 -0
  32. package/dist/components/Pagination/index.d.ts +2 -0
  33. package/dist/components/Pagination/types.d.ts +29 -0
  34. package/dist/components/Radio/Radio.d.ts +36 -0
  35. package/dist/components/Radio/index.d.ts +2 -0
  36. package/dist/components/Radio/types.d.ts +16 -0
  37. package/dist/components/RadioGroup/RadioGroup.d.ts +35 -0
  38. package/dist/components/RadioGroup/index.d.ts +2 -0
  39. package/dist/components/RadioGroup/types.d.ts +19 -0
  40. package/dist/components/Rate/Rate.d.ts +24 -0
  41. package/dist/components/Rate/index.d.ts +2 -0
  42. package/dist/components/Rate/types.d.ts +22 -0
  43. package/dist/components/RichText/RichText.d.ts +38 -0
  44. package/dist/components/RichText/ToolbarButton.d.ts +20 -0
  45. package/dist/components/RichText/icons.d.ts +6 -0
  46. package/dist/components/RichText/index.d.ts +2 -0
  47. package/dist/components/RichText/tools.d.ts +48 -0
  48. package/dist/components/RichText/types.d.ts +42 -0
  49. package/dist/components/Select/Select.d.ts +50 -0
  50. package/dist/components/Select/index.d.ts +2 -0
  51. package/dist/components/Select/types.d.ts +41 -0
  52. package/dist/components/Slider/Slider.d.ts +26 -0
  53. package/dist/components/Slider/index.d.ts +2 -0
  54. package/dist/components/Slider/types.d.ts +24 -0
  55. package/dist/components/Switch/Switch.d.ts +38 -0
  56. package/dist/components/Switch/index.d.ts +2 -0
  57. package/dist/components/Switch/types.d.ts +18 -0
  58. package/dist/components/Table/Table.d.ts +34 -0
  59. package/dist/components/Table/index.d.ts +2 -0
  60. package/dist/components/Table/types.d.ts +142 -0
  61. package/dist/components/TagsInput/TagsInput.d.ts +32 -0
  62. package/dist/components/TagsInput/index.d.ts +2 -0
  63. package/dist/components/TagsInput/types.d.ts +26 -0
  64. package/dist/components/Textarea/Textarea.d.ts +39 -0
  65. package/dist/components/Textarea/index.d.ts +2 -0
  66. package/dist/components/Textarea/types.d.ts +31 -0
  67. package/dist/components/TimePicker/TimePicker.d.ts +52 -0
  68. package/dist/components/TimePicker/index.d.ts +1 -0
  69. package/dist/components/index.d.ts +22 -1
  70. package/dist/composables/useFormField.d.ts +64 -0
  71. package/dist/index.d.ts +1 -0
  72. package/dist/index.js +3061 -151
  73. package/dist/index.js.map +1 -1
  74. package/dist/style.css +1 -1
  75. package/package.json +12 -2
@@ -0,0 +1,38 @@
1
+ import { ChoiceValue } from '../../composables/useFormField';
2
+ import { SwitchProps } from './types';
3
+ type __VLS_Props = SwitchProps;
4
+ type __VLS_PublicProps = {
5
+ modelValue?: ChoiceValue;
6
+ } & __VLS_Props;
7
+ declare function __VLS_template(): {
8
+ attrs: Partial<{}>;
9
+ slots: {
10
+ default?(_: {}): any;
11
+ };
12
+ refs: {};
13
+ rootEl: any;
14
+ };
15
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
16
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
17
+ change: (value: ChoiceValue) => any;
18
+ "update:modelValue": (value: ChoiceValue) => any;
19
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
20
+ onChange?: ((value: ChoiceValue) => any) | undefined;
21
+ "onUpdate:modelValue"?: ((value: ChoiceValue) => any) | undefined;
22
+ }>, {
23
+ name: string;
24
+ size: import('../..').ControlSize;
25
+ disabled: boolean;
26
+ label: string;
27
+ id: string;
28
+ ariaLabel: string;
29
+ activeValue: ChoiceValue;
30
+ inactiveValue: ChoiceValue;
31
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
32
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
33
+ export default _default;
34
+ type __VLS_WithTemplateSlots<T, S> = T & {
35
+ new (): {
36
+ $slots: S;
37
+ };
38
+ };
@@ -0,0 +1,2 @@
1
+ export { default as WxSwitch } from './Switch';
2
+ export type * from './types';
@@ -0,0 +1,18 @@
1
+ import { ChoiceValue, ControlSize } from '../../composables/useFormField';
2
+ export interface SwitchProps {
3
+ /** Value written when the switch is on. */
4
+ activeValue?: ChoiceValue;
5
+ /** Value written when the switch is off. */
6
+ inactiveValue?: ChoiceValue;
7
+ /** Label text shown next to the track. */
8
+ label?: string;
9
+ disabled?: boolean;
10
+ size?: ControlSize;
11
+ id?: string;
12
+ name?: string;
13
+ /** Accessible label used when there is no visible one. */
14
+ ariaLabel?: string;
15
+ }
16
+ export interface SwitchEmits {
17
+ change: [value: ChoiceValue];
18
+ }
@@ -0,0 +1,34 @@
1
+ import { RowKey, TableProps, TableRow, TableSort, TableState } from './types';
2
+ declare const _default: <T extends TableRow = TableRow>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
4
+ readonly onSearch?: ((term: string) => any) | undefined;
5
+ readonly "onUpdate:page"?: ((value: number) => any) | undefined;
6
+ readonly "onUpdate:perPage"?: ((value: number) => any) | undefined;
7
+ readonly "onUpdate:selected"?: ((value: RowKey[]) => any) | undefined;
8
+ readonly "onUpdate:expanded"?: ((value: RowKey[]) => any) | undefined;
9
+ readonly "onUpdate:sort"?: ((value: TableSort | null) => any) | undefined;
10
+ readonly "onUpdate:search"?: ((value: string) => any) | undefined;
11
+ readonly "onRow-click"?: ((row: T, index: number, event: MouseEvent) => any) | undefined;
12
+ readonly "onSort-change"?: ((sort: TableSort | null) => any) | undefined;
13
+ readonly "onSelection-change"?: ((keys: RowKey[], rows: T[]) => any) | undefined;
14
+ readonly "onExpand-change"?: ((keys: RowKey[], rows: T[]) => any) | undefined;
15
+ readonly "onState-change"?: ((state: TableState) => any) | undefined;
16
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:page" | "onUpdate:perPage" | "onSearch" | "onUpdate:selected" | "onUpdate:expanded" | "onUpdate:sort" | "onUpdate:search" | "onRow-click" | "onSort-change" | "onSelection-change" | "onExpand-change" | "onState-change"> & ({
17
+ selected?: RowKey[];
18
+ expanded?: RowKey[];
19
+ sort?: TableSort | null;
20
+ search?: string;
21
+ page?: number;
22
+ perPage?: number;
23
+ } & TableProps<T>) & any> & import('vue').PublicProps;
24
+ expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
25
+ attrs: any;
26
+ slots: any;
27
+ emit: (((evt: "search", term: string) => void) & ((evt: "row-click", row: T, index: number, event: MouseEvent) => void) & ((evt: "sort-change", sort: TableSort | null) => void) & ((evt: "selection-change", keys: RowKey[], rows: T[]) => void) & ((evt: "expand-change", keys: RowKey[], rows: T[]) => void) & ((evt: "state-change", state: TableState) => void)) & (((evt: "update:page", value: number) => void) & ((evt: "update:perPage", value: number) => void) & ((evt: "update:selected", value: RowKey[]) => void) & ((evt: "update:expanded", value: RowKey[]) => void) & ((evt: "update:sort", value: TableSort | null) => void) & ((evt: "update:search", value: string) => void));
28
+ }>) => import('vue').VNode & {
29
+ __ctx?: Awaited<typeof __VLS_setup>;
30
+ };
31
+ export default _default;
32
+ type __VLS_PrettifyLocal<T> = {
33
+ [K in keyof T]: T[K];
34
+ } & {};
@@ -0,0 +1,2 @@
1
+ export { default as WxTable } from './Table';
2
+ export type * from './types';
@@ -0,0 +1,142 @@
1
+ import { ControlSize } from '../../composables/useFormField';
2
+ /**
3
+ * A page as Laravel's `->paginate()` serialises it. Taken as it arrives, with the
4
+ * snake_case keys intact — renaming them in every controller is work the table can
5
+ * spare the caller.
6
+ */
7
+ export interface Paginated<T = TableRow> {
8
+ data: T[];
9
+ current_page: number;
10
+ last_page: number;
11
+ per_page: number;
12
+ total: number;
13
+ from: number | null;
14
+ to: number | null;
15
+ }
16
+ export type TableRow = Record<string, unknown>;
17
+ export type SortOrder = 'asc' | 'desc';
18
+ export interface TableSort {
19
+ /** Column key. Sent to the backend as it is. */
20
+ key: string;
21
+ order: SortOrder;
22
+ }
23
+ export type RowKey = string | number;
24
+ export type TableAlign = 'left' | 'center' | 'right';
25
+ export interface TableColumn<T = TableRow> {
26
+ /**
27
+ * Identifies the column and reads the value out of the row. A dotted path walks
28
+ * into nested objects, so an eager-loaded relation works: `user.name`.
29
+ */
30
+ key: string;
31
+ /** Heading text. Use the `header-<key>` slot for anything richer. */
32
+ label?: string;
33
+ width?: string | number;
34
+ minWidth?: string | number;
35
+ align?: TableAlign;
36
+ /** Adds a sort control to the heading. The table reports, it does not reorder. */
37
+ sortable?: boolean;
38
+ /**
39
+ * Pins the column to an edge while the rest scrolls sideways. A pinned column needs
40
+ * a `width`: the offsets of the ones behind it are worked out from the declared
41
+ * widths, and a column of unknown width cannot say where the next one starts.
42
+ */
43
+ fixed?: 'left' | 'right';
44
+ /** Turns the raw value into the text of the cell. */
45
+ formatter?: (value: unknown, row: T, index: number) => string;
46
+ headerClass?: string;
47
+ cellClass?: string;
48
+ /** Leaves the column out without changing the array. */
49
+ hidden?: boolean;
50
+ }
51
+ /**
52
+ * One line of the summary under the table. `label` occupies every column ahead of the
53
+ * first one carrying a value, which is what a total wants: a caption on the left and a
54
+ * figure under its column.
55
+ */
56
+ export interface TableSummaryRow {
57
+ /** Caption on the left. */
58
+ label?: string;
59
+ /** Values by column key. */
60
+ cells?: Record<string, unknown>;
61
+ /** Draws the line as the one that matters — the total rather than its parts. */
62
+ strong?: boolean;
63
+ class?: string;
64
+ }
65
+ /** Everything the table asks the backend for, in one object. */
66
+ export interface TableState {
67
+ page: number;
68
+ perPage: number;
69
+ sort: TableSort | null;
70
+ search: string;
71
+ }
72
+ export interface TableProps<T = TableRow> {
73
+ /** Rows, or a whole paginator — the table reads `data` out of it. */
74
+ data?: T[] | Paginated<T> | null;
75
+ columns: TableColumn<T>[];
76
+ /**
77
+ * Where a stable row id comes from. A missing key falls back to the row's position,
78
+ * which is enough to render but too weak to survive a reorder — name one when rows
79
+ * can be selected or expanded.
80
+ */
81
+ rowKey?: string | ((row: T, index: number) => RowKey);
82
+ /** Heading above the table. */
83
+ title?: string;
84
+ /** Adds the search field to the header. */
85
+ searchable?: boolean;
86
+ searchPlaceholder?: string;
87
+ /** How long typing settles before `search` fires. Zero reports every keystroke. */
88
+ searchDebounce?: number;
89
+ loading?: boolean;
90
+ /** Shown in place of the rows when there are none. */
91
+ emptyText?: string;
92
+ stripe?: boolean;
93
+ bordered?: boolean;
94
+ /** Highlight the row under the pointer. */
95
+ hover?: boolean;
96
+ size?: ControlSize;
97
+ /** Adds the checkbox column. */
98
+ selectable?: boolean;
99
+ /** Rows this returns `false` for cannot be selected. */
100
+ selectableIf?: (row: T) => boolean;
101
+ /** Adds the disclosure column and renders the `expanded` slot underneath a row. */
102
+ expandable?: boolean;
103
+ /** Rows this returns `false` for have nothing to open. */
104
+ expandableIf?: (row: T) => boolean;
105
+ /** Lines under the table: totals, discounts, whatever the figures are. */
106
+ summary?: TableSummaryRow[];
107
+ /**
108
+ * Puts the pagination in the footer. On by default as soon as `data` is a paginator,
109
+ * since a paginated response is a promise that there are more pages to reach.
110
+ */
111
+ pagination?: boolean;
112
+ /** Page sizes offered by the built-in pagination. Empty leaves the control out. */
113
+ perPageOptions?: number[];
114
+ /**
115
+ * Remembers the page, the sort, the page size and the search term under this key, so
116
+ * a reload lands where the user left off. One key per table per application.
117
+ */
118
+ persist?: string;
119
+ /**
120
+ * Caps the height and scrolls the rows between a stuck header and a stuck footer.
121
+ * A number is pixels; a string is any CSS length, so `60vh` follows the window.
122
+ */
123
+ maxHeight?: string | number;
124
+ /** Extra class per row, for status colouring and the like. */
125
+ rowClass?: (row: T, index: number) => string | undefined;
126
+ /** Fixes the column widths instead of letting the content decide. */
127
+ layout?: 'auto' | 'fixed';
128
+ ariaLabel?: string;
129
+ }
130
+ export interface TableEmits<T = TableRow> {
131
+ 'row-click': [row: T, index: number, event: MouseEvent];
132
+ 'sort-change': [sort: TableSort | null];
133
+ 'selection-change': [keys: RowKey[], rows: T[]];
134
+ 'expand-change': [keys: RowKey[], rows: T[]];
135
+ search: [term: string];
136
+ /**
137
+ * Everything the backend needs, together. Fires once on mount — with whatever
138
+ * `persist` restored — and again whenever any part of it changes, which makes it the
139
+ * single place to hang the fetch on.
140
+ */
141
+ 'state-change': [state: TableState];
142
+ }
@@ -0,0 +1,32 @@
1
+ import { TagsInputProps } from './types';
2
+ type __VLS_Props = TagsInputProps;
3
+ type __VLS_PublicProps = {
4
+ modelValue?: string[];
5
+ } & __VLS_Props;
6
+ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
7
+ focus: () => void | undefined;
8
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
9
+ search: (term: string) => any;
10
+ change: (value: string[]) => any;
11
+ "update:modelValue": (value: string[]) => any;
12
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
13
+ onSearch?: ((term: string) => any) | undefined;
14
+ onChange?: ((value: string[]) => any) | undefined;
15
+ "onUpdate:modelValue"?: ((value: string[]) => any) | undefined;
16
+ }>, {
17
+ name: string;
18
+ size: import('../..').ControlSize;
19
+ disabled: boolean;
20
+ id: string;
21
+ ariaLabel: string;
22
+ max: number;
23
+ placeholder: string;
24
+ status: import('../..').ControlStatus;
25
+ emptyText: string;
26
+ suggestions: string[];
27
+ duplicates: boolean;
28
+ allowCreate: boolean;
29
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
30
+ inputRef: HTMLInputElement;
31
+ }, any>;
32
+ export default _default;
@@ -0,0 +1,2 @@
1
+ export { default as WxTagsInput } from './TagsInput';
2
+ export type * from './types';
@@ -0,0 +1,26 @@
1
+ import { ControlSize, ControlStatus } from '../../composables/useFormField';
2
+ export interface TagsInputProps {
3
+ /** Options offered while typing. Refresh them from the `search` event for a backend. */
4
+ suggestions?: string[];
5
+ placeholder?: string;
6
+ /** Shown when nothing matches and new tags are not allowed. */
7
+ emptyText?: string;
8
+ /** Largest number of tags the user may end up with. */
9
+ max?: number;
10
+ /** Allow the same tag twice. */
11
+ duplicates?: boolean;
12
+ /** Let Enter add a tag that is not in the suggestions. */
13
+ allowCreate?: boolean;
14
+ disabled?: boolean;
15
+ size?: ControlSize;
16
+ status?: ControlStatus;
17
+ id?: string;
18
+ name?: string;
19
+ /** Accessible label used when there is no visible `<label>`. */
20
+ ariaLabel?: string;
21
+ }
22
+ export interface TagsInputEmits {
23
+ change: [value: string[]];
24
+ /** What the user typed, on every keystroke — use it to fetch suggestions. */
25
+ search: [term: string];
26
+ }
@@ -0,0 +1,39 @@
1
+ import { TextareaModelValue, TextareaProps } from './types';
2
+ type __VLS_Props = TextareaProps;
3
+ type __VLS_PublicProps = {
4
+ modelValue?: TextareaModelValue;
5
+ } & __VLS_Props;
6
+ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
7
+ focus: () => void | undefined;
8
+ blur: () => void | undefined;
9
+ select: () => void | undefined;
10
+ textarea: import('vue').Ref<HTMLTextAreaElement | null, HTMLTextAreaElement | null>;
11
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
12
+ input: (value: string) => any;
13
+ change: (value: string) => any;
14
+ "update:modelValue": (value: TextareaModelValue) => any;
15
+ blur: (event: FocusEvent) => any;
16
+ focus: (event: FocusEvent) => any;
17
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
18
+ onInput?: ((value: string) => any) | undefined;
19
+ onChange?: ((value: string) => any) | undefined;
20
+ "onUpdate:modelValue"?: ((value: TextareaModelValue) => any) | undefined;
21
+ onBlur?: ((event: FocusEvent) => any) | undefined;
22
+ onFocus?: ((event: FocusEvent) => any) | undefined;
23
+ }>, {
24
+ size: import('../..').ControlSize;
25
+ disabled: boolean;
26
+ id: string;
27
+ ariaLabel: string;
28
+ placeholder: string;
29
+ readonly: boolean;
30
+ status: import('../..').ControlStatus;
31
+ maxlength: number;
32
+ showCount: boolean;
33
+ resize: "none" | "vertical" | "both";
34
+ rows: number;
35
+ autosize: boolean | import('./types').AutosizeOptions;
36
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
37
+ textareaRef: HTMLTextAreaElement;
38
+ }, any>;
39
+ export default _default;
@@ -0,0 +1,2 @@
1
+ export { default as WxTextarea } from './Textarea';
2
+ export type * from './types';
@@ -0,0 +1,31 @@
1
+ import { ControlSize, ControlStatus } from '../../composables/useFormField';
2
+ export interface AutosizeOptions {
3
+ minRows?: number;
4
+ maxRows?: number;
5
+ }
6
+ export interface TextareaProps {
7
+ size?: ControlSize;
8
+ status?: ControlStatus;
9
+ id?: string;
10
+ placeholder?: string;
11
+ disabled?: boolean;
12
+ readonly?: boolean;
13
+ /** Visible rows when autosize is off. */
14
+ rows?: number;
15
+ /** Grows with the content. Pass an object to bound the growth. */
16
+ autosize?: boolean | AutosizeOptions;
17
+ maxlength?: number;
18
+ /** Renders a `current / max` counter (requires `maxlength`). */
19
+ showCount?: boolean;
20
+ /** Which way the user may resize the field by hand. */
21
+ resize?: 'none' | 'vertical' | 'both';
22
+ /** Accessible label used when the field has no visible `<label>`. */
23
+ ariaLabel?: string;
24
+ }
25
+ export type TextareaModelValue = string | undefined;
26
+ export interface TextareaEmits {
27
+ input: [value: string];
28
+ change: [value: string];
29
+ focus: [event: FocusEvent];
30
+ blur: [event: FocusEvent];
31
+ }
@@ -0,0 +1,52 @@
1
+ import { DatePickerModelValue, DatePickerProps } from '../DatePicker/types';
2
+ /**
3
+ * Every prop defaults to `undefined` on purpose. Vue casts an absent boolean prop
4
+ * to `false`, and this preset forwards its whole prop object — without these the
5
+ * preset would hand `WxDatePicker` an explicit `false` for `is24`, `clearable`,
6
+ * `autoApply` and `teleport`, overriding that component's own defaults. Passing
7
+ * `undefined` lets each default apply as if the prop had never been written.
8
+ */
9
+ type __VLS_Props = Omit<DatePickerProps, 'type'>;
10
+ type __VLS_PublicProps = {
11
+ modelValue?: DatePickerModelValue;
12
+ } & __VLS_Props;
13
+ declare function __VLS_template(): {
14
+ attrs: Partial<{}>;
15
+ slots: any;
16
+ refs: {};
17
+ rootEl: any;
18
+ };
19
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
20
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
21
+ "update:modelValue": (value: DatePickerModelValue) => any;
22
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
23
+ "onUpdate:modelValue"?: ((value: DatePickerModelValue) => any) | undefined;
24
+ }>, {
25
+ name: string;
26
+ size: import('../..').ControlSize;
27
+ disabled: boolean;
28
+ id: string;
29
+ ariaLabel: string;
30
+ clearable: boolean;
31
+ placeholder: string;
32
+ teleport: boolean | string;
33
+ readonly: boolean;
34
+ status: import('../..').ControlStatus;
35
+ valueFormat: string;
36
+ format: string;
37
+ minDate: string | Date;
38
+ maxDate: string | Date;
39
+ seconds: boolean;
40
+ minutesIncrement: number;
41
+ is24: boolean;
42
+ weekStart: number;
43
+ autoApply: boolean;
44
+ textInput: boolean;
45
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
46
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
47
+ export default _default;
48
+ type __VLS_WithTemplateSlots<T, S> = T & {
49
+ new (): {
50
+ $slots: S;
51
+ };
52
+ };
@@ -0,0 +1 @@
1
+ export { default as WxTimePicker } from './TimePicker';
@@ -1,3 +1,24 @@
1
1
  export * from './Button';
2
- export * from './Input';
3
2
  export * from './Card';
3
+ export * from './Checkbox';
4
+ export * from './CheckboxGroup';
5
+ export * from './ColorPicker';
6
+ export * from './DatePicker';
7
+ export * from './DateRangePicker';
8
+ export * from './DateTimePicker';
9
+ export * from './Form';
10
+ export * from './FormItem';
11
+ export * from './Input';
12
+ export * from './InputNumber';
13
+ export * from './Pagination';
14
+ export * from './Radio';
15
+ export * from './RadioGroup';
16
+ export * from './Rate';
17
+ export * from './RichText';
18
+ export * from './Select';
19
+ export * from './Slider';
20
+ export * from './Switch';
21
+ export * from './Table';
22
+ export * from './TagsInput';
23
+ export * from './Textarea';
24
+ export * from './TimePicker';
@@ -0,0 +1,64 @@
1
+ import { ComputedRef, InjectionKey, Ref } from 'vue';
2
+ export type ControlSize = 'sm' | 'md' | 'lg';
3
+ export type ControlStatus = 'default' | 'success' | 'warning' | 'error';
4
+ /** Field name -> messages, the shape Laravel returns on a 422. */
5
+ export type ValidationErrors = Record<string, string[]>;
6
+ export interface FormContext {
7
+ /** Server-side errors, keyed by field name. */
8
+ errors: Ref<ValidationErrors>;
9
+ disabled: Ref<boolean>;
10
+ size: Ref<ControlSize>;
11
+ labelPosition: Ref<'top' | 'left'>;
12
+ labelWidth: Ref<string | undefined>;
13
+ }
14
+ export interface FormItemContext {
15
+ /** Id given to the control, so the label's `for` matches. */
16
+ id: ComputedRef<string>;
17
+ /** Ids of the help and error nodes, for `aria-describedby`. */
18
+ describedBy: ComputedRef<string | undefined>;
19
+ status: ComputedRef<ControlStatus>;
20
+ disabled: ComputedRef<boolean>;
21
+ size: ComputedRef<ControlSize | undefined>;
22
+ /** Set by grouped controls so the label points at the group, not one input. */
23
+ registerLabelTarget: (id: string | undefined) => void;
24
+ }
25
+ export declare const formContextKey: InjectionKey<FormContext>;
26
+ export declare const formItemContextKey: InjectionKey<FormItemContext>;
27
+ export declare function useId(prefix?: string): string;
28
+ export interface FormFieldProps {
29
+ disabled?: boolean;
30
+ size?: ControlSize;
31
+ status?: ControlStatus;
32
+ id?: string;
33
+ }
34
+ /**
35
+ * Resolves what a control should render as, given its own props, the enclosing
36
+ * `WxFormItem` and the enclosing `WxForm`. The control's own prop always wins;
37
+ * `WxFormItem` beats `WxForm`.
38
+ */
39
+ export declare function useFormField(props: FormFieldProps): {
40
+ id: ComputedRef<string>;
41
+ disabled: ComputedRef<boolean>;
42
+ size: ComputedRef<ControlSize>;
43
+ status: ComputedRef<ControlStatus>;
44
+ describedBy: ComputedRef<string | undefined>;
45
+ form: FormContext | null;
46
+ item: FormItemContext | null;
47
+ };
48
+ /**
49
+ * What a checkbox, radio or switch may carry. Deliberately narrower than `unknown`:
50
+ * a `v-model` that hands back `unknown` is useless to the caller, and object values
51
+ * would need identity comparison rather than `===`.
52
+ */
53
+ export type ChoiceValue = string | number | boolean | null;
54
+ /** Used by `WxCheckboxGroup` / `WxRadioGroup` to share state with their children. */
55
+ export interface ChoiceGroupContext<T> {
56
+ name: ComputedRef<string | undefined>;
57
+ modelValue: Ref<T>;
58
+ disabled: ComputedRef<boolean>;
59
+ size: ComputedRef<ControlSize>;
60
+ toggle: (value: ChoiceValue, checked: boolean) => void;
61
+ }
62
+ export declare const checkboxGroupKey: InjectionKey<ChoiceGroupContext<ChoiceValue[]>>;
63
+ export declare const radioGroupKey: InjectionKey<ChoiceGroupContext<ChoiceValue | undefined>>;
64
+ export declare function provideFormItem(context: FormItemContext): void;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './components';
2
2
  export { WebxUI, type WebxUiOptions } from './plugin';
3
+ export type { ControlSize, ControlStatus, ValidationErrors } from './composables/useFormField';