@webx-ui/core 0.1.0 → 0.3.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 (94) hide show
  1. package/dist/components/Action/Action.d.ts +35 -0
  2. package/dist/components/Action/index.d.ts +2 -0
  3. package/dist/components/Action/types.d.ts +37 -0
  4. package/dist/components/Actions/Actions.d.ts +45 -0
  5. package/dist/components/Actions/index.d.ts +2 -0
  6. package/dist/components/Actions/types.d.ts +20 -0
  7. package/dist/components/Autocomplete/Autocomplete.d.ts +60 -0
  8. package/dist/components/Autocomplete/index.d.ts +2 -0
  9. package/dist/components/Autocomplete/types.d.ts +58 -0
  10. package/dist/components/Badge/Badge.d.ts +31 -0
  11. package/dist/components/Badge/index.d.ts +2 -0
  12. package/dist/components/Badge/types.d.ts +21 -0
  13. package/dist/components/Button/Button.d.ts +5 -5
  14. package/dist/components/Button/types.d.ts +3 -2
  15. package/dist/components/ButtonGroup/ButtonGroup.d.ts +26 -0
  16. package/dist/components/ButtonGroup/index.d.ts +2 -0
  17. package/dist/components/ButtonGroup/types.d.ts +20 -0
  18. package/dist/components/Cascader/Cascader.d.ts +62 -0
  19. package/dist/components/Cascader/index.d.ts +2 -0
  20. package/dist/components/Cascader/types.d.ts +55 -0
  21. package/dist/components/Checkbox/Checkbox.d.ts +3 -3
  22. package/dist/components/ColorPicker/ColorPicker.d.ts +5 -5
  23. package/dist/components/Countdown/Countdown.d.ts +42 -0
  24. package/dist/components/Countdown/format.d.ts +12 -0
  25. package/dist/components/Countdown/index.d.ts +3 -0
  26. package/dist/components/Countdown/types.d.ts +27 -0
  27. package/dist/components/DatePicker/DatePicker.d.ts +12 -12
  28. package/dist/components/DateRangePicker/DateRangePicker.d.ts +11 -11
  29. package/dist/components/DateTimePicker/DateTimePicker.d.ts +5 -5
  30. package/dist/components/Dropdown/Dropdown.d.ts +46 -0
  31. package/dist/components/Dropdown/index.d.ts +2 -0
  32. package/dist/components/Dropdown/types.d.ts +28 -0
  33. package/dist/components/DropdownItem/DropdownItem.d.ts +32 -0
  34. package/dist/components/DropdownItem/index.d.ts +2 -0
  35. package/dist/components/DropdownItem/types.d.ts +20 -0
  36. package/dist/components/EntityCard/EntityCard.d.ts +40 -0
  37. package/dist/components/EntityCard/index.d.ts +2 -0
  38. package/dist/components/EntityCard/types.d.ts +37 -0
  39. package/dist/components/FormItem/FormItem.d.ts +2 -2
  40. package/dist/components/Heading/Heading.d.ts +24 -0
  41. package/dist/components/Heading/index.d.ts +2 -0
  42. package/dist/components/Heading/types.d.ts +16 -0
  43. package/dist/components/Icon/Icon.d.ts +8 -0
  44. package/dist/components/Icon/icons.d.ts +85 -0
  45. package/dist/components/Icon/index.d.ts +4 -0
  46. package/dist/components/Icon/types.d.ts +25 -0
  47. package/dist/components/Indicator/Indicator.d.ts +29 -0
  48. package/dist/components/Indicator/index.d.ts +2 -0
  49. package/dist/components/Indicator/types.d.ts +21 -0
  50. package/dist/components/Input/Input.d.ts +6 -6
  51. package/dist/components/InputNumber/InputNumber.d.ts +3 -3
  52. package/dist/components/Link/Link.d.ts +34 -0
  53. package/dist/components/Link/index.d.ts +2 -0
  54. package/dist/components/Link/types.d.ts +26 -0
  55. package/dist/components/Pagination/Pagination.d.ts +45 -0
  56. package/dist/components/Pagination/index.d.ts +2 -0
  57. package/dist/components/Pagination/types.d.ts +29 -0
  58. package/dist/components/Prose/Prose.d.ts +22 -0
  59. package/dist/components/Prose/index.d.ts +2 -0
  60. package/dist/components/Prose/types.d.ts +13 -0
  61. package/dist/components/Radio/Radio.d.ts +2 -2
  62. package/dist/components/Rate/Rate.d.ts +2 -2
  63. package/dist/components/RichText/RichText.d.ts +4 -4
  64. package/dist/components/RichText/ToolbarButton.d.ts +1 -1
  65. package/dist/components/Select/Select.d.ts +10 -10
  66. package/dist/components/Slider/Slider.d.ts +1 -1
  67. package/dist/components/Statistic/Statistic.d.ts +34 -0
  68. package/dist/components/Statistic/index.d.ts +2 -0
  69. package/dist/components/Statistic/types.d.ts +24 -0
  70. package/dist/components/Switch/Switch.d.ts +2 -2
  71. package/dist/components/Table/Table.d.ts +34 -0
  72. package/dist/components/Table/index.d.ts +2 -0
  73. package/dist/components/Table/types.d.ts +142 -0
  74. package/dist/components/TagsInput/TagsInput.d.ts +4 -4
  75. package/dist/components/Text/Text.d.ts +27 -0
  76. package/dist/components/Text/index.d.ts +2 -0
  77. package/dist/components/Text/types.d.ts +21 -0
  78. package/dist/components/Textarea/Textarea.d.ts +3 -3
  79. package/dist/components/TimePicker/TimePicker.d.ts +5 -5
  80. package/dist/components/Timeline/Timeline.d.ts +20 -0
  81. package/dist/components/Timeline/index.d.ts +2 -0
  82. package/dist/components/Timeline/types.d.ts +6 -0
  83. package/dist/components/TimelineItem/TimelineItem.d.ts +29 -0
  84. package/dist/components/TimelineItem/index.d.ts +2 -0
  85. package/dist/components/TimelineItem/types.d.ts +21 -0
  86. package/dist/components/index.d.ts +21 -0
  87. package/dist/composables/useActions.d.ts +8 -0
  88. package/dist/composables/useButtonGroup.d.ts +15 -0
  89. package/dist/composables/useDropdown.d.ts +9 -0
  90. package/dist/composables/useTimeline.d.ts +8 -0
  91. package/dist/index.js +3459 -1179
  92. package/dist/index.js.map +1 -1
  93. package/dist/style.css +1 -1
  94. package/package.json +1 -1
@@ -22,28 +22,28 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
22
22
  input: import('vue').Ref<HTMLInputElement | null, HTMLInputElement | null>;
23
23
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
24
24
  input: (value: string) => any;
25
+ clear: () => any;
25
26
  change: (value: string) => any;
26
27
  "update:modelValue": (value: InputModelValue) => any;
27
- clear: () => any;
28
28
  blur: (event: FocusEvent) => any;
29
29
  focus: (event: FocusEvent) => any;
30
30
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
31
31
  onInput?: ((value: string) => any) | undefined;
32
+ onClear?: (() => any) | undefined;
32
33
  onChange?: ((value: string) => any) | undefined;
33
34
  "onUpdate:modelValue"?: ((value: InputModelValue) => any) | undefined;
34
- onClear?: (() => any) | undefined;
35
35
  onBlur?: ((event: FocusEvent) => any) | undefined;
36
36
  onFocus?: ((event: FocusEvent) => any) | undefined;
37
37
  }>, {
38
- type: import('./types').InputNativeType;
39
38
  size: import('./types').InputSize;
39
+ type: import('./types').InputNativeType;
40
40
  disabled: boolean;
41
- id: string;
41
+ placeholder: string;
42
42
  ariaLabel: string;
43
43
  clearable: boolean;
44
- placeholder: string;
45
- readonly: boolean;
46
44
  status: import('./types').InputStatus;
45
+ id: string;
46
+ readonly: boolean;
47
47
  autocomplete: string;
48
48
  maxlength: number;
49
49
  showCount: boolean;
@@ -23,13 +23,13 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
23
23
  name: string;
24
24
  size: import('../..').ControlSize;
25
25
  disabled: boolean;
26
- id: string;
26
+ placeholder: string;
27
27
  ariaLabel: string;
28
+ status: import('../..').ControlStatus;
29
+ id: string;
28
30
  min: number;
29
31
  max: number;
30
- placeholder: string;
31
32
  readonly: boolean;
32
- status: import('../..').ControlStatus;
33
33
  step: number;
34
34
  precision: number;
35
35
  controls: boolean;
@@ -0,0 +1,34 @@
1
+ import { LinkProps } from './types';
2
+ declare function __VLS_template(): {
3
+ attrs: Partial<{}>;
4
+ slots: {
5
+ icon?(_: {}): any;
6
+ default?(_: {}): any;
7
+ };
8
+ refs: {};
9
+ rootEl: any;
10
+ };
11
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
12
+ declare const __VLS_component: import('vue').DefineComponent<LinkProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
13
+ click: (event: MouseEvent) => any;
14
+ }, string, import('vue').PublicProps, Readonly<LinkProps> & Readonly<{
15
+ onClick?: ((event: MouseEvent) => any) | undefined;
16
+ }>, {
17
+ size: import('..').TextSize;
18
+ type: import('./types').LinkType;
19
+ href: string;
20
+ target: string;
21
+ as: string | import('vue').Component;
22
+ disabled: boolean;
23
+ rel: string;
24
+ underline: import('./types').LinkUnderline;
25
+ weight: import('..').TextWeight;
26
+ external: boolean;
27
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
28
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
29
+ export default _default;
30
+ type __VLS_WithTemplateSlots<T, S> = T & {
31
+ new (): {
32
+ $slots: S;
33
+ };
34
+ };
@@ -0,0 +1,2 @@
1
+ export { default as WxLink } from './Link';
2
+ export type * from './types';
@@ -0,0 +1,26 @@
1
+ import { Component } from 'vue';
2
+ import { TextSize, TextWeight } from '../Text/types';
3
+ export type LinkType = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'muted';
4
+ export type LinkUnderline = 'hover' | 'always' | 'never';
5
+ export interface LinkProps {
6
+ href?: string;
7
+ target?: string;
8
+ rel?: string;
9
+ /** Colour role. `default` is the link colour from the tokens. */
10
+ type?: LinkType;
11
+ /** When the underline shows. */
12
+ underline?: LinkUnderline;
13
+ size?: TextSize;
14
+ weight?: TextWeight;
15
+ disabled?: boolean;
16
+ /**
17
+ * Marks the link as leaving the app: opens in a new tab with a safe `rel`, and
18
+ * appends a small arrow icon.
19
+ */
20
+ external?: boolean;
21
+ /** Renders through another component — `RouterLink`, say, with `to` in the attrs. */
22
+ as?: string | Component;
23
+ }
24
+ export interface LinkEmits {
25
+ click: [event: MouseEvent];
26
+ }
@@ -0,0 +1,45 @@
1
+ import { PaginationProps } from './types';
2
+ type __VLS_Props = PaginationProps;
3
+ type __VLS_PublicProps = {
4
+ 'page'?: number | undefined;
5
+ 'perPage'?: number | undefined;
6
+ } & __VLS_Props;
7
+ declare function __VLS_template(): {
8
+ attrs: Partial<{}>;
9
+ slots: {
10
+ total?(_: {
11
+ from: number | null;
12
+ to: number | null;
13
+ total: number;
14
+ }): any;
15
+ };
16
+ refs: {};
17
+ rootEl: HTMLElement;
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
+ change: (value: import('./types').PaginationChange) => any;
22
+ "update:page": (value: number | undefined) => any;
23
+ "update:perPage": (value: number | undefined) => any;
24
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
25
+ onChange?: ((value: import('./types').PaginationChange) => any) | undefined;
26
+ "onUpdate:page"?: ((value: number | undefined) => any) | undefined;
27
+ "onUpdate:perPage"?: ((value: number | undefined) => any) | undefined;
28
+ }>, {
29
+ size: import('../..').ControlSize;
30
+ disabled: boolean;
31
+ ariaLabel: string;
32
+ paginator: import('..').Paginated<unknown> | null;
33
+ total: number;
34
+ lastPage: number;
35
+ siblings: number;
36
+ perPageOptions: number[];
37
+ showTotal: boolean;
38
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLElement>;
39
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
40
+ export default _default;
41
+ type __VLS_WithTemplateSlots<T, S> = T & {
42
+ new (): {
43
+ $slots: S;
44
+ };
45
+ };
@@ -0,0 +1,2 @@
1
+ export { default as WxPagination } from './Pagination';
2
+ export type * from './types';
@@ -0,0 +1,29 @@
1
+ import { ControlSize } from '../../composables/useFormField';
2
+ import { Paginated } from '../Table/types';
3
+ export interface PaginationProps {
4
+ /**
5
+ * A page as `->paginate()` serialises it. The current page, the page size and the
6
+ * totals are all read from it, so the usual case needs no other prop.
7
+ */
8
+ paginator?: Paginated<unknown> | null;
9
+ /** Rows in total. Only needed without a paginator. */
10
+ total?: number;
11
+ /** Last page number. Worked out from `total` and the page size when missing. */
12
+ lastPage?: number;
13
+ /** Page buttons kept either side of the current one. */
14
+ siblings?: number;
15
+ /** Offers a page-size control. Empty leaves it out. */
16
+ perPageOptions?: number[];
17
+ /** Shows the "1–15 of 128" line. */
18
+ showTotal?: boolean;
19
+ disabled?: boolean;
20
+ size?: ControlSize;
21
+ ariaLabel?: string;
22
+ }
23
+ export interface PaginationChange {
24
+ page: number;
25
+ perPage: number;
26
+ }
27
+ export interface PaginationEmits {
28
+ change: [value: PaginationChange];
29
+ }
@@ -0,0 +1,22 @@
1
+ import { ProseProps } from './types';
2
+ declare function __VLS_template(): {
3
+ attrs: Partial<{}>;
4
+ slots: {
5
+ default?(_: {}): any;
6
+ };
7
+ refs: {};
8
+ rootEl: any;
9
+ };
10
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
11
+ declare const __VLS_component: import('vue').DefineComponent<ProseProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ProseProps> & Readonly<{}>, {
12
+ size: import('./types').ProseSize;
13
+ html: string;
14
+ as: string;
15
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
16
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
17
+ export default _default;
18
+ type __VLS_WithTemplateSlots<T, S> = T & {
19
+ new (): {
20
+ $slots: S;
21
+ };
22
+ };
@@ -0,0 +1,2 @@
1
+ export { default as WxProse } from './Prose';
2
+ export type * from './types';
@@ -0,0 +1,13 @@
1
+ export type ProseSize = 'sm' | 'md' | 'lg';
2
+ export interface ProseProps {
3
+ /**
4
+ * HTML to render — the output of the rich-text editor, a CMS field, a Markdown
5
+ * renderer. It is injected as-is, so pass only markup you have sanitised on the
6
+ * server; use the default slot for anything you assemble in the template.
7
+ */
8
+ html?: string;
9
+ /** Text scale of the whole block. */
10
+ size?: ProseSize;
11
+ /** Element to render. */
12
+ as?: string;
13
+ }
@@ -22,10 +22,10 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
22
22
  }>, {
23
23
  name: string;
24
24
  size: import('../..').ControlSize;
25
- disabled: boolean;
26
25
  label: string;
27
- id: string;
26
+ disabled: boolean;
28
27
  ariaLabel: string;
28
+ id: string;
29
29
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
30
30
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
31
31
  export default _default;
@@ -13,10 +13,10 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {},
13
13
  name: string;
14
14
  size: import('../..').ControlSize;
15
15
  disabled: boolean;
16
- id: string;
17
16
  ariaLabel: string;
18
- max: number;
19
17
  clearable: boolean;
18
+ id: string;
19
+ max: number;
20
20
  readonly: boolean;
21
21
  allowHalf: boolean;
22
22
  showValue: boolean;
@@ -20,16 +20,16 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
20
20
  onFocus?: (() => any) | undefined;
21
21
  onUploadError?: ((error: unknown, file: File) => any) | undefined;
22
22
  }>, {
23
+ upload: import('./types').RichTextUpload;
23
24
  size: import('../..').ControlSize;
24
25
  disabled: boolean;
25
- id: string;
26
- ariaLabel: string;
27
26
  placeholder: string;
28
- readonly: boolean;
27
+ ariaLabel: string;
29
28
  status: import('../..').ControlStatus;
29
+ id: string;
30
+ readonly: boolean;
30
31
  minHeight: string;
31
32
  tools: RichTextTool[];
32
- upload: import('./types').RichTextUpload;
33
33
  pickImage: import('./types').RichTextImagePicker;
34
34
  accept: string[];
35
35
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
@@ -13,8 +13,8 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
13
13
  onClick?: (() => any) | undefined;
14
14
  }>, {
15
15
  text: string;
16
- disabled: boolean;
17
16
  icon: string;
17
+ disabled: boolean;
18
18
  active: boolean;
19
19
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLButtonElement>;
20
20
  export default _default;
@@ -13,33 +13,33 @@ declare function __VLS_template(): {
13
13
  };
14
14
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
15
15
  declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
16
+ close: () => any;
16
17
  search: (term: string) => any;
18
+ clear: () => any;
19
+ open: () => any;
17
20
  change: (value: SelectModelValue) => any;
18
21
  "update:modelValue": (value: SelectModelValue) => any;
19
- open: () => any;
20
- clear: () => any;
21
- close: () => any;
22
22
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
23
+ onClose?: (() => any) | undefined;
23
24
  onSearch?: ((term: string) => any) | undefined;
25
+ onClear?: (() => any) | undefined;
26
+ onOpen?: (() => any) | undefined;
24
27
  onChange?: ((value: SelectModelValue) => any) | undefined;
25
28
  "onUpdate:modelValue"?: ((value: SelectModelValue) => any) | undefined;
26
- onOpen?: (() => any) | undefined;
27
- onClear?: (() => any) | undefined;
28
- onClose?: (() => any) | undefined;
29
29
  }>, {
30
30
  name: string;
31
31
  size: import('../..').ControlSize;
32
32
  disabled: boolean;
33
- id: string;
33
+ teleport: boolean;
34
+ placeholder: string;
34
35
  ariaLabel: string;
35
36
  options: import('./types').SelectOption[];
37
+ emptyText: string;
36
38
  clearable: boolean;
37
- placeholder: string;
38
- teleport: boolean;
39
39
  status: import('../..').ControlStatus;
40
+ id: string;
40
41
  multiple: boolean;
41
42
  filterable: boolean;
42
- emptyText: string;
43
43
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
44
44
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
45
45
  export default _default;
@@ -13,8 +13,8 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {},
13
13
  name: string;
14
14
  size: import('../..').ControlSize;
15
15
  disabled: boolean;
16
- id: string;
17
16
  ariaLabel: string;
17
+ id: string;
18
18
  range: boolean;
19
19
  min: number;
20
20
  max: number;
@@ -0,0 +1,34 @@
1
+ import { StatisticProps } from './types';
2
+ declare function __VLS_template(): {
3
+ attrs: Partial<{}>;
4
+ slots: {
5
+ title?(_: {}): any;
6
+ prefix?(_: {}): any;
7
+ value?(_: {}): any;
8
+ suffix?(_: {}): any;
9
+ default?(_: {}): any;
10
+ };
11
+ refs: {};
12
+ rootEl: HTMLDivElement;
13
+ };
14
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
15
+ declare const __VLS_component: import('vue').DefineComponent<StatisticProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<StatisticProps> & Readonly<{}>, {
16
+ size: import('./types').StatisticSize;
17
+ title: string;
18
+ tone: import('..').TextTone;
19
+ align: import('..').TextAlign;
20
+ value: number | string;
21
+ precision: number;
22
+ locale: string;
23
+ grouping: boolean;
24
+ prefix: string;
25
+ suffix: string;
26
+ formatter: (value: number | string | undefined) => string;
27
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
28
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
29
+ export default _default;
30
+ type __VLS_WithTemplateSlots<T, S> = T & {
31
+ new (): {
32
+ $slots: S;
33
+ };
34
+ };
@@ -0,0 +1,2 @@
1
+ export { default as WxStatistic } from './Statistic';
2
+ export type * from './types';
@@ -0,0 +1,24 @@
1
+ import { TextAlign, TextTone } from '../Text/types';
2
+ export type StatisticSize = 'sm' | 'md' | 'lg';
3
+ export interface StatisticProps {
4
+ /** The number itself. A string is printed as-is — already formatted upstream. */
5
+ value?: number | string;
6
+ /** Caption above the number. */
7
+ title?: string;
8
+ /** Digits after the decimal point. Left alone, the number keeps its own. */
9
+ precision?: number;
10
+ /** Locale for grouping and the decimal mark. Defaults to the browser's. */
11
+ locale?: string;
12
+ /** Thousands grouping. */
13
+ grouping?: boolean;
14
+ /** Short text before the number — a currency sign, an arrow. */
15
+ prefix?: string;
16
+ /** Short text after the number — a unit, a percent sign. */
17
+ suffix?: string;
18
+ /** Full control over the printed value; wins over `precision` and `grouping`. */
19
+ formatter?: (value: number | string | undefined) => string;
20
+ size?: StatisticSize;
21
+ /** Colour of the number — `success` for growth, `danger` for a drop. */
22
+ tone?: TextTone;
23
+ align?: TextAlign;
24
+ }
@@ -22,10 +22,10 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
22
22
  }>, {
23
23
  name: string;
24
24
  size: import('../..').ControlSize;
25
- disabled: boolean;
26
25
  label: string;
27
- id: string;
26
+ disabled: boolean;
28
27
  ariaLabel: string;
28
+ id: string;
29
29
  activeValue: ChoiceValue;
30
30
  inactiveValue: ChoiceValue;
31
31
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
@@ -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>, "onSearch" | "onUpdate:page" | "onUpdate:perPage" | "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
+ }
@@ -17,12 +17,12 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
17
17
  name: string;
18
18
  size: import('../..').ControlSize;
19
19
  disabled: boolean;
20
- id: string;
21
- ariaLabel: string;
22
- max: number;
23
20
  placeholder: string;
24
- status: import('../..').ControlStatus;
21
+ ariaLabel: string;
25
22
  emptyText: string;
23
+ status: import('../..').ControlStatus;
24
+ id: string;
25
+ max: number;
26
26
  suggestions: string[];
27
27
  duplicates: boolean;
28
28
  allowCreate: boolean;