@webx-ui/core 0.24.0 → 0.26.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.
@@ -20,6 +20,7 @@ declare const __VLS_component: import('vue').DefineComponent<ButtonProps, {}, {}
20
20
  type: import('./types').ButtonType;
21
21
  target: string;
22
22
  round: boolean;
23
+ icon: import('..').IconName;
23
24
  href: string;
24
25
  loading: boolean;
25
26
  block: boolean;
@@ -1,3 +1,4 @@
1
+ import { IconName } from '../Icon/types';
1
2
  export type ButtonType = 'default' | 'primary' | 'success' | 'warning' | 'danger';
2
3
  export type ButtonVariant = 'solid' | 'outline' | 'text';
3
4
  export type ButtonSize = 'sm' | 'md' | 'lg';
@@ -5,6 +6,8 @@ export type ButtonNativeType = 'button' | 'submit' | 'reset';
5
6
  export interface ButtonProps {
6
7
  /** Semantic colour of the button. Defaults to `default`, or to the group's. */
7
8
  type?: ButtonType;
9
+ /** Icon before the label. The `icon` slot wins when both are given. */
10
+ icon?: IconName;
8
11
  /** Visual weight: filled, bordered or borderless. Defaults to `solid`, or to the group's. */
9
12
  variant?: ButtonVariant;
10
13
  /** Defaults to `md`, or to the enclosing `WxButtonGroup`. */
@@ -35,6 +35,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
35
35
  id: string;
36
36
  readonly: boolean;
37
37
  format: string;
38
+ locale: string | import('../..').DateFnsLocale;
38
39
  valueFormat: string;
39
40
  minDate: string | Date;
40
41
  maxDate: string | Date;
@@ -1,4 +1,5 @@
1
1
  import { ControlSize, ControlStatus } from '../../composables/useFormField';
2
+ import { DateFnsLocale } from '../../internal/dateLocale';
2
3
  export type DatePickerType = 'date' | 'datetime' | 'time';
3
4
  export type DatePickerModelValue = string | Date | null;
4
5
  export interface DatePickerProps {
@@ -22,6 +23,13 @@ export interface DatePickerProps {
22
23
  minutesIncrement?: number;
23
24
  /** 24-hour clock. Off means AM/PM. */
24
25
  is24?: boolean;
26
+ /**
27
+ * Language the calendar is drawn in: a BCP-47 tag such as `'ru'` or `'pt-BR'`, whose
28
+ * month and weekday names come from the browser, or a date-fns locale object for a
29
+ * language the browser does not carry. Defaults to what the application provided with
30
+ * `provideDateLocale`, then to the browser's own language.
31
+ */
32
+ locale?: string | DateFnsLocale;
25
33
  /** First day of the week: 0 is Sunday, 1 is Monday. */
26
34
  weekStart?: number;
27
35
  /** Apply the value as soon as it is picked, with no confirm button. */
@@ -34,6 +34,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
34
34
  id: string;
35
35
  readonly: boolean;
36
36
  format: string;
37
+ locale: string | import('../..').DateFnsLocale;
37
38
  valueFormat: string;
38
39
  minDate: string | Date;
39
40
  maxDate: string | Date;
@@ -1,4 +1,5 @@
1
1
  import { ControlSize, ControlStatus } from '../../composables/useFormField';
2
+ import { DateFnsLocale } from '../../internal/dateLocale';
2
3
  /** `[start, end]`, or `null` while nothing is picked. */
3
4
  export type DateRangePickerModelValue = string[] | Date[] | null;
4
5
  export interface DateRangePickerProps {
@@ -12,6 +13,13 @@ export interface DateRangePickerProps {
12
13
  maxDate?: string | Date;
13
14
  /** How many months to show side by side. Two makes picking across a boundary easy. */
14
15
  months?: number;
16
+ /**
17
+ * Language the calendar is drawn in: a BCP-47 tag such as `'ru'` or `'pt-BR'`, whose
18
+ * month and weekday names come from the browser, or a date-fns locale object for a
19
+ * language the browser does not carry. Defaults to what the application provided with
20
+ * `provideDateLocale`, then to the browser's own language.
21
+ */
22
+ locale?: string | DateFnsLocale;
15
23
  /** First day of the week: 0 is Sunday, 1 is Monday. */
16
24
  weekStart?: number;
17
25
  /** Apply as soon as the second date is picked, with no confirm button. */
@@ -33,6 +33,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
33
33
  id: string;
34
34
  readonly: boolean;
35
35
  format: string;
36
+ locale: string | import('../..').DateFnsLocale;
36
37
  valueFormat: string;
37
38
  minDate: string | Date;
38
39
  maxDate: string | Date;
@@ -29,6 +29,7 @@ declare const __VLS_component: import('vue').DefineComponent<EntityCardProps, {}
29
29
  shape: import('./types').EntityCardShape;
30
30
  imageAlt: string;
31
31
  imageSize: number | string;
32
+ titleLines: number;
32
33
  selected: boolean;
33
34
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
34
35
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
@@ -24,6 +24,14 @@ export interface EntityCardProps {
24
24
  imageSize?: number | string;
25
25
  /** Facts under the title. Use the `meta` slot when a fact needs markup. */
26
26
  meta?: EntityCardMeta[];
27
+ /**
28
+ * How many lines the name may take before it is cut.
29
+ *
30
+ * One by default, because a row of entities reads as a row only while every one of them is
31
+ * the same height. Two is for a list where the name is a sentence rather than a label — an
32
+ * article headline cut to one line on a phone is half a thought.
33
+ */
34
+ titleLines?: number;
27
35
  size?: EntityCardSize;
28
36
  /** `card` sits on its own surface; `plain` drops the background for use inside one. */
29
37
  variant?: EntityCardVariant;
@@ -20,10 +20,10 @@ declare const __VLS_component: import('vue').DefineComponent<FormItemProps, {
20
20
  required: boolean;
21
21
  label: string;
22
22
  error: string | string[];
23
+ wide: boolean;
23
24
  labelWidth: string;
24
25
  help: string;
25
26
  reserveErrorSpace: boolean;
26
- wide: boolean;
27
27
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
28
28
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
29
29
  export default _default;
@@ -47,6 +47,8 @@ export declare const builtinIcons: {
47
47
  readonly sliders: "<path d=\"M4 7h9M17 7h3M4 17h3M11 17h9\"/><circle cx=\"15\" cy=\"7\" r=\"2\"/><circle cx=\"9\" cy=\"17\" r=\"2\"/>";
48
48
  readonly home: "<path d=\"M4 10.5 12 4l8 6.5V19a1.5 1.5 0 0 1-1.5 1.5H15V14H9v6.5H5.5A1.5 1.5 0 0 1 4 19Z\"/>";
49
49
  readonly file: "<path d=\"M13.5 3.5H7a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V9zm0 0V9H19\"/>";
50
+ readonly 'file-text': string;
51
+ readonly newspaper: "<path d=\"M5 20.5h13.5a2 2 0 0 0 2-2v-13a2 2 0 0 0-2-2H9a2 2 0 0 0-2 2v13a2 2 0 0 1-2 2Z\"/><path d=\"M5 20.5a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2\"/><path d=\"M9.8 6.8h8.2v3.6h-8.2z\"/><path d=\"M9.8 13.6h8.2M9.8 16.6h5.2\"/>";
50
52
  readonly folder: "<path d=\"M3.5 7a2 2 0 0 1 2-2h3.2a2 2 0 0 1 1.5.7l1.3 1.5h7a2 2 0 0 1 2 2v8.3a2 2 0 0 1-2 2h-13a2 2 0 0 1-2-2z\"/>";
51
53
  readonly 'folder-move': string;
52
54
  readonly image: "<rect x=\"3.5\" y=\"4.5\" width=\"17\" height=\"15\" rx=\"2.5\"/><circle cx=\"8.75\" cy=\"9.75\" r=\"1.75\"/><path d=\"m4 17 4.5-4.2a2 2 0 0 1 2.7 0l3 2.8 1.6-1.5a2 2 0 0 1 2.7 0L20 16\"/>";
@@ -40,6 +40,23 @@ declare const _default: <T extends TableRow = TableRow>(__VLS_props: NonNullable
40
40
  }) => unknown) | undefined;
41
41
  title?: () => unknown;
42
42
  actions?: () => unknown;
43
+ /**
44
+ * The fields of the filter, inside the panel a funnel in the header opens.
45
+ *
46
+ * Three dropdowns standing open in the header is three controls of chrome above the first
47
+ * row, and on a phone that is half the screen before any data. Behind the funnel they cost
48
+ * one button, and what they are set to is said by `applied` instead.
49
+ */
50
+ filters?: () => unknown;
51
+ /**
52
+ * What the filters are set to, as chips the reader can take off — the strip between the
53
+ * header and the rows.
54
+ *
55
+ * The table gives the place and the spacing; the chips are the caller's, because only the
56
+ * caller knows what "rubric: News" is called and what taking it off means. Nothing is drawn
57
+ * while the strip holds no elements.
58
+ */
59
+ applied?: () => unknown;
43
60
  empty?: () => unknown;
44
61
  footer?: () => unknown;
45
62
  loading?: () => unknown;
@@ -68,6 +85,23 @@ declare const _default: <T extends TableRow = TableRow>(__VLS_props: NonNullable
68
85
  }) => unknown) | undefined;
69
86
  title?: () => unknown;
70
87
  actions?: () => unknown;
88
+ /**
89
+ * The fields of the filter, inside the panel a funnel in the header opens.
90
+ *
91
+ * Three dropdowns standing open in the header is three controls of chrome above the first
92
+ * row, and on a phone that is half the screen before any data. Behind the funnel they cost
93
+ * one button, and what they are set to is said by `applied` instead.
94
+ */
95
+ filters?: () => unknown;
96
+ /**
97
+ * What the filters are set to, as chips the reader can take off — the strip between the
98
+ * header and the rows.
99
+ *
100
+ * The table gives the place and the spacing; the chips are the caller's, because only the
101
+ * caller knows what "rubric: News" is called and what taking it off means. Nothing is drawn
102
+ * while the strip holds no elements.
103
+ */
104
+ applied?: () => unknown;
71
105
  empty?: () => unknown;
72
106
  footer?: () => unknown;
73
107
  loading?: () => unknown;
@@ -33,6 +33,13 @@ export interface TableColumn<T = TableRow> {
33
33
  /** Heading text. Use the `header-<key>` slot for anything richer. */
34
34
  label?: string;
35
35
  width?: string | number;
36
+ /**
37
+ * A floor for the column — and only with `layout="auto"`.
38
+ *
39
+ * The fixed algorithm reads `width` and nothing else, and the widths ride on a `<col>`, where
40
+ * `min-width` is not one of the four properties that apply: declared there it computes, shows
41
+ * in devtools and does nothing. A fixed table sizes its columns by `width`.
42
+ */
36
43
  minWidth?: string | number;
37
44
  align?: TableAlign;
38
45
  /** Adds a sort control to the heading. The table reports, it does not reorder. */
@@ -153,6 +160,18 @@ export interface TableProps<T = TableRow> {
153
160
  /** Adds the search field to the header. */
154
161
  searchable?: boolean;
155
162
  searchPlaceholder?: string;
163
+ /**
164
+ * How many filters are on.
165
+ *
166
+ * A panel of filters says nothing about itself once it is shut, and a list narrowed by
167
+ * something the reader cannot see is a list that looks wrong. The number rides on the funnel,
168
+ * and `0` leaves it bare. What the filters actually are is said by the `applied` slot.
169
+ */
170
+ filtersCount?: number;
171
+ /** Name of the funnel — its tooltip, its accessible name and the heading of the panel. */
172
+ filtersLabel?: string;
173
+ /** Width of that panel: a number in pixels, or any CSS length. */
174
+ filtersWidth?: number | string;
156
175
  /** How long typing settles before `search` fires. Zero reports every keystroke. */
157
176
  searchDebounce?: number;
158
177
  loading?: boolean;
@@ -33,6 +33,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps,
33
33
  id: string;
34
34
  readonly: boolean;
35
35
  format: string;
36
+ locale: string | import('../..').DateFnsLocale;
36
37
  valueFormat: string;
37
38
  minDate: string | Date;
38
39
  maxDate: string | Date;
@@ -0,0 +1,23 @@
1
+ import { ComputedRef, InjectionKey, Ref } from 'vue';
2
+ import { DateFnsLocale } from '../internal/dateLocale';
3
+ /** A BCP-47 tag, or something that reads one — the application's own language. */
4
+ export type DateLocaleSource = string | Ref<string> | ComputedRef<string>;
5
+ /**
6
+ * The language every date picker below draws its calendar in.
7
+ *
8
+ * This is the language of the *interface*, not of the content: an administrator who
9
+ * switched the panel to Russian on a machine set to English expects the month header to
10
+ * follow the switch, and neither the browser nor the site's content languages know about
11
+ * it. A `locale` prop on the picker still wins over what is provided here.
12
+ */
13
+ export declare const dateLocaleKey: InjectionKey<DateLocaleSource>;
14
+ /**
15
+ * Tells every date picker below which language to draw its calendar in.
16
+ *
17
+ * ```ts
18
+ * app.provide(dateLocaleKey, computed(() => admin.i18n.state.locale))
19
+ * ```
20
+ */
21
+ export declare function provideDateLocale(locale: DateLocaleSource): void;
22
+ /** The calendar's language: the `locale` prop, then the application's, then the browser's. */
23
+ export declare function useDateLocale(locale: () => string | DateFnsLocale | undefined): ComputedRef<DateFnsLocale>;
package/dist/index.d.ts CHANGED
@@ -3,6 +3,8 @@ export { WebxUI, type WebxUiOptions } from './plugin';
3
3
  export type { ControlSize, ControlStatus, ValidationErrors } from './composables/useFormField';
4
4
  export { useControlAttrs, type ControlAttrs } from './composables/useControlAttrs';
5
5
  export { provideLocales, useLocales, useLocalized, localeLabel, localizedValue, localesKey, type LocaleOption, type LocalesContext, type LocalizedValue, type LocalizedFieldProps, } from './composables/useLocalized';
6
+ export { provideDateLocale, useDateLocale, dateLocaleKey, type DateLocaleSource, } from './composables/useDateLocale';
7
+ export type { DateFnsLocale } from './internal/dateLocale';
6
8
  export { useElementWidth } from './composables/useElementWidth';
7
9
  export { useHoverPointer } from './composables/useHoverPointer';
8
10
  export { useToast, toast, toastQueue, dismissToast, removeToast, clearToasts, type ToastApi, type ToastHandle, type ToastOptions, type ToastRecord, type ToastType, type ToastAction, } from './composables/useToast';