@cscfi/csc-ui 4.0.0-alpha.30 → 4.0.0-alpha.32
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/dist/csc-ui.js +20450 -18713
- package/dist/custom-elements.json +2141 -973
- package/dist/docs/c-color-picker/usage.md +160 -0
- package/dist/docs/c-file-upload/usage.md +189 -0
- package/dist/docs/c-modal/usage.md +1 -1
- package/dist/docs/c-progress-circle/usage.md +1 -1
- package/dist/docs/c-radio-group/usage.md +1 -1
- package/dist/styles/css/tokens.css +2 -1
- package/dist/vscode.css-custom-data.json +103 -5
- package/dist/vscode.html-custom-data.json +155 -1
- package/dist/web-types.json +570 -6
- package/dist-types/components/c-color-picker/CColorPicker.vue.d.ts +194 -0
- package/dist-types/components/c-color-picker/colors.d.ts +66 -0
- package/dist-types/components/c-date-picker/CDatePicker.vue.d.ts +1 -1
- package/dist-types/components/c-file-upload/CFileUpload.vue.d.ts +200 -0
- package/dist-types/components/c-file-upload/files.d.ts +99 -0
- package/dist-types/components/c-time-picker/times.d.ts +5 -5
- package/dist-types/index.d.ts +4 -2
- package/dist-types/shared/TypedField.vue.d.ts +1 -1
- package/dist-types/shared/emitModelValue.d.ts +12 -0
- package/dist-types/shared/selectAll.d.ts +1 -1
- package/dist-types/shared/useAnchoredPanel.d.ts +6 -1
- package/dist-types/shared/useKeyboardModality.d.ts +7 -0
- package/dist-types/shared/useTypedField.d.ts +21 -18
- package/dist-types/tag-name-map.d.ts +169 -1
- package/dist-types/theme/ramp.d.ts +12 -12
- package/dist-types/theme/themeMode.d.ts +24 -24
- package/package.json +3 -14
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import type { CFieldSize } from '../../types';
|
|
2
|
+
/** The notation a colour picker's value is written in (CONTEXT.md "Notation"). */
|
|
3
|
+
export type CColorPickerFormat = 'hex' | 'oklch' | 'rgb';
|
|
4
|
+
export interface CColorPickerProps {
|
|
5
|
+
/**
|
|
6
|
+
* Let the colour carry transparency: an alpha slider and an A channel join
|
|
7
|
+
* the panel. Without it typed alpha is dropped
|
|
8
|
+
*
|
|
9
|
+
* @defaultable false
|
|
10
|
+
*/
|
|
11
|
+
alpha?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Make the value clearable
|
|
14
|
+
*/
|
|
15
|
+
clearable?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Disable the field
|
|
18
|
+
*/
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Error message shown in place of the hint while the field is invalid
|
|
22
|
+
*
|
|
23
|
+
* @freeform
|
|
24
|
+
*/
|
|
25
|
+
errorMessage?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The notation the value is written in — and every emission with it:
|
|
28
|
+
* `#rrggbb`, `rgb(r g b)` or `oklch(l c h)`
|
|
29
|
+
*
|
|
30
|
+
* @defaultable 'hex'
|
|
31
|
+
*/
|
|
32
|
+
format?: CColorPickerFormat;
|
|
33
|
+
/**
|
|
34
|
+
* Hide the hint and error messages
|
|
35
|
+
*
|
|
36
|
+
* @defaultable false
|
|
37
|
+
*/
|
|
38
|
+
hideDetails?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Hint text for the field
|
|
41
|
+
*
|
|
42
|
+
* @freeform
|
|
43
|
+
*/
|
|
44
|
+
hint?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Id of the element
|
|
47
|
+
*
|
|
48
|
+
* @freeform
|
|
49
|
+
*/
|
|
50
|
+
hostId?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Element label
|
|
53
|
+
*
|
|
54
|
+
* @freeform
|
|
55
|
+
*/
|
|
56
|
+
label?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Label on top of the field
|
|
59
|
+
*
|
|
60
|
+
* @defaultable false
|
|
61
|
+
*/
|
|
62
|
+
labelOnTop?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Input field name
|
|
65
|
+
*
|
|
66
|
+
* @freeform
|
|
67
|
+
*/
|
|
68
|
+
name?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Placeholder of the input; an example of the notation when empty
|
|
71
|
+
*
|
|
72
|
+
* @freeform
|
|
73
|
+
*/
|
|
74
|
+
placeholder?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Set the field as required
|
|
77
|
+
*/
|
|
78
|
+
required?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Shadow variant
|
|
81
|
+
*
|
|
82
|
+
* @defaultable false
|
|
83
|
+
*/
|
|
84
|
+
shadow?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Field height: the 52px default (the shared control height) or the 36px `small` box
|
|
87
|
+
*
|
|
88
|
+
* @defaultable 'default'
|
|
89
|
+
*/
|
|
90
|
+
size?: CFieldSize;
|
|
91
|
+
/**
|
|
92
|
+
* Predefined colours offered under the picker — CSS colours, or
|
|
93
|
+
* `{ value, name }` objects whose name is read out and shown. Arrays have
|
|
94
|
+
* no attribute form — bind as a DOM property
|
|
95
|
+
*/
|
|
96
|
+
swatches?: CColorPickerSwatch[];
|
|
97
|
+
/**
|
|
98
|
+
* Limit the choice to the swatches: the field becomes readonly and opens
|
|
99
|
+
* a panel of the swatches alone
|
|
100
|
+
*/
|
|
101
|
+
swatchesOnly?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* UI text overrides (i18n), merged over the English defaults. Objects have
|
|
104
|
+
* no attribute form — bind as a DOM property
|
|
105
|
+
*
|
|
106
|
+
* @defaultable {}
|
|
107
|
+
*/
|
|
108
|
+
texts?: CColorPickerTexts;
|
|
109
|
+
/**
|
|
110
|
+
* Set the validity of the field
|
|
111
|
+
*/
|
|
112
|
+
valid?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* The colour in the `format` notation, or `null` when empty. Any CSS
|
|
115
|
+
* colour is accepted and shown in the notation
|
|
116
|
+
*/
|
|
117
|
+
value?: CColorPickerValue;
|
|
118
|
+
}
|
|
119
|
+
/** A predefined colour: a CSS colour, or one with a name for assistive technology and the swatch-only field. */
|
|
120
|
+
export type CColorPickerSwatch = {
|
|
121
|
+
name?: string;
|
|
122
|
+
value: string;
|
|
123
|
+
} | string;
|
|
124
|
+
/**
|
|
125
|
+
* UI texts of `c-color-picker`, merged key by key over the English defaults.
|
|
126
|
+
*/
|
|
127
|
+
export interface CColorPickerTexts {
|
|
128
|
+
/** Accessible name of the alpha slider and the A channel. */
|
|
129
|
+
alpha?: string;
|
|
130
|
+
/** Accessible name of the blue channel. */
|
|
131
|
+
blue?: string;
|
|
132
|
+
/** Accessible name of the colour area's vertical axis. */
|
|
133
|
+
brightness?: string;
|
|
134
|
+
/** Accessible name of the dialog when the field has no label. */
|
|
135
|
+
chooseColor?: string;
|
|
136
|
+
/** Accessible name of the chroma channel. */
|
|
137
|
+
chroma?: string;
|
|
138
|
+
/** Accessible label of the clear button. */
|
|
139
|
+
clearSelection?: string;
|
|
140
|
+
/** Accessible label of the close button in the fullscreen panel (narrow viewports). */
|
|
141
|
+
closePanel?: string;
|
|
142
|
+
/** Label of the Done button in the fullscreen panel (narrow viewports). */
|
|
143
|
+
done?: string;
|
|
144
|
+
/** Accessible name of the green channel. */
|
|
145
|
+
green?: string;
|
|
146
|
+
/** Accessible name of the hex channel. */
|
|
147
|
+
hex?: string;
|
|
148
|
+
/** Accessible name of the hue slider and the OKLCH hue channel. */
|
|
149
|
+
hue?: string;
|
|
150
|
+
/** Accessible name of the lightness channel. */
|
|
151
|
+
lightness?: string;
|
|
152
|
+
/** Accessible name of the notation switch. */
|
|
153
|
+
notation?: string;
|
|
154
|
+
/** Accessible label of the colour button. */
|
|
155
|
+
openPicker?: string;
|
|
156
|
+
/** Accessible name of the red channel. */
|
|
157
|
+
red?: string;
|
|
158
|
+
/** Accessible label of the original colour in the colour comparison: a click restores it. */
|
|
159
|
+
restoreOriginal?: string;
|
|
160
|
+
/** Accessible name of the colour area's horizontal axis. */
|
|
161
|
+
saturation?: string;
|
|
162
|
+
/** Accessible name of the swatch list. */
|
|
163
|
+
swatches?: string;
|
|
164
|
+
/** Accessible label of the swatch-only field's chevron button. */
|
|
165
|
+
toggleSwatches?: string;
|
|
166
|
+
}
|
|
167
|
+
/** Value of `c-color-picker`: a colour in its `format` notation, or `null` when empty. */
|
|
168
|
+
export type CColorPickerValue = null | string;
|
|
169
|
+
declare const _default: typeof __VLS_export;
|
|
170
|
+
export default _default;
|
|
171
|
+
declare const __VLS_export: import("vue").DefineComponent<CColorPickerProps, {
|
|
172
|
+
badInput: import("vue").ComputedRef<boolean>;
|
|
173
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CColorPickerProps> & Readonly<{}>, {
|
|
174
|
+
label: string;
|
|
175
|
+
value: CColorPickerValue;
|
|
176
|
+
name: string;
|
|
177
|
+
size: CFieldSize;
|
|
178
|
+
texts: CColorPickerTexts;
|
|
179
|
+
hideDetails: boolean;
|
|
180
|
+
labelOnTop: boolean;
|
|
181
|
+
shadow: boolean;
|
|
182
|
+
alpha: boolean;
|
|
183
|
+
format: CColorPickerFormat;
|
|
184
|
+
clearable: boolean;
|
|
185
|
+
disabled: boolean;
|
|
186
|
+
errorMessage: string;
|
|
187
|
+
hint: string;
|
|
188
|
+
hostId: string;
|
|
189
|
+
placeholder: string;
|
|
190
|
+
required: boolean;
|
|
191
|
+
valid: boolean;
|
|
192
|
+
swatches: CColorPickerSwatch[];
|
|
193
|
+
swatchesOnly: boolean;
|
|
194
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/** One editable channel of the **channel editor**. */
|
|
2
|
+
export type ColorChannel = 'a' | 'b' | 'c' | 'g' | 'h' | 'l' | 'r';
|
|
3
|
+
/** The CSS syntax a colour is spelled in (CONTEXT.md "Notation"). */
|
|
4
|
+
export type ColorNotation = 'hex' | 'oklch' | 'rgb';
|
|
5
|
+
/** The panel's position: hue 0–360, saturation and brightness 0–100, unrounded. */
|
|
6
|
+
export interface Hsv {
|
|
7
|
+
h: number;
|
|
8
|
+
s: number;
|
|
9
|
+
v: number;
|
|
10
|
+
}
|
|
11
|
+
/** A colour as the picker holds it: 8-bit sRGB channels and 8-bit alpha. */
|
|
12
|
+
export interface Rgba {
|
|
13
|
+
a: number;
|
|
14
|
+
b: number;
|
|
15
|
+
g: number;
|
|
16
|
+
r: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Text as a colour — any CSS colour culori parses, or a hex without its `#`
|
|
20
|
+
* — gamut-mapped into sRGB; `null` when it names none. Without `alpha` the
|
|
21
|
+
* colour comes back opaque.
|
|
22
|
+
*/
|
|
23
|
+
export declare const readColor: (text: string, alpha: boolean) => null | Rgba;
|
|
24
|
+
/** Whether a value is a string naming a colour. */
|
|
25
|
+
export declare const isColor: (value: unknown) => value is string;
|
|
26
|
+
export declare const sameColor: (a: null | Rgba, b: null | Rgba) => boolean;
|
|
27
|
+
/** The L, C and H texts of a colour's `oklch()` spelling. */
|
|
28
|
+
export interface OklchParts {
|
|
29
|
+
c: string;
|
|
30
|
+
h: string;
|
|
31
|
+
l: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The fewest decimals per channel — L and C up to four, H up to two — whose
|
|
35
|
+
* `oklch()` reads back to the same sRGB bytes (ADR-0069). A colour with no
|
|
36
|
+
* chroma spells its hue `0`.
|
|
37
|
+
*/
|
|
38
|
+
export declare const oklchParts: (c: Rgba) => OklchParts;
|
|
39
|
+
/** A colour in a notation: `#rrggbb[aa]`, `rgb(R G B[ / a])`, `oklch(L C H[ / a])`. */
|
|
40
|
+
export declare const spell: (c: Rgba, notation: ColorNotation) => string;
|
|
41
|
+
/** A CSS colour to paint with: the hex spelling, alpha included. */
|
|
42
|
+
export declare const toCss: (c: Rgba) => string;
|
|
43
|
+
/** A panel position as bytes, with the given alpha byte. */
|
|
44
|
+
export declare const fromHsv: (hsv: Hsv, a: number) => Rgba;
|
|
45
|
+
/**
|
|
46
|
+
* The panel position of a colour. A position that already lands on the same
|
|
47
|
+
* bytes is kept, so a step the bytes cannot show leaves the thumb where it
|
|
48
|
+
* went; a grey keeps the previous hue, black the previous saturation too.
|
|
49
|
+
*/
|
|
50
|
+
export declare const toHsv: (c: Rgba, prev?: Hsv | null) => Hsv;
|
|
51
|
+
/** Each channel's range and nudge step; Shift nudges ten steps. */
|
|
52
|
+
export declare const CHANNEL_RANGE: Record<ColorChannel, {
|
|
53
|
+
max: number;
|
|
54
|
+
min: number;
|
|
55
|
+
step: number;
|
|
56
|
+
}>;
|
|
57
|
+
/** The channels a notation's editor shows, alpha aside. */
|
|
58
|
+
export declare const NOTATION_CHANNELS: Record<Exclude<ColorNotation, 'hex'>, ColorChannel[]>;
|
|
59
|
+
/** A channel's text in the editor — what the value spells for it. */
|
|
60
|
+
export declare const channelText: (c: Rgba, key: ColorChannel) => string;
|
|
61
|
+
/** The colour with one channel set, clamped to its range (and mapped into sRGB). */
|
|
62
|
+
export declare const withChannel: (c: Rgba, key: ColorChannel, n: number) => Rgba;
|
|
63
|
+
/** A typed channel text read into the colour; `null` when it is no number. */
|
|
64
|
+
export declare const readChannel: (c: Rgba, key: ColorChannel, text: string) => null | Rgba;
|
|
65
|
+
/** The colour one nudge (or ten, `big`) away along a channel. */
|
|
66
|
+
export declare const nudgeChannel: (c: Rgba, key: ColorChannel, direction: -1 | 1, big?: boolean) => Rgba;
|
|
@@ -262,8 +262,8 @@ declare const __VLS_export: import("vue").DefineComponent<CDatePickerProps, {
|
|
|
262
262
|
hideDetails: boolean;
|
|
263
263
|
labelOnTop: boolean;
|
|
264
264
|
shadow: boolean;
|
|
265
|
-
firstDayOfWeek: CDatePickerWeekday;
|
|
266
265
|
format: string;
|
|
266
|
+
firstDayOfWeek: CDatePickerWeekday;
|
|
267
267
|
showToday: boolean;
|
|
268
268
|
showWeekNumbers: boolean;
|
|
269
269
|
clearable: boolean;
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import type { CFieldSize } from '../../types';
|
|
2
|
+
/** The second argument of an upload function. */
|
|
3
|
+
export interface CFileUploadContext {
|
|
4
|
+
/** The entry's id. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Report progress as a fraction from 0 to 1; the row stays indeterminate until the first call. */
|
|
7
|
+
onProgress: (fraction: number) => void;
|
|
8
|
+
/** Aborted when the user cancels, the entry is removed, or the field unmounts. */
|
|
9
|
+
signal: AbortSignal;
|
|
10
|
+
}
|
|
11
|
+
/** One file a `c-file-upload` holds (CONTEXT.md "File entry"). */
|
|
12
|
+
export interface CFileUploadEntry {
|
|
13
|
+
/** The rejection text shown for a failed upload. */
|
|
14
|
+
error?: string;
|
|
15
|
+
/** The browser file, for a file the user added. Absent on a server file. */
|
|
16
|
+
file?: File;
|
|
17
|
+
/** Stable identity: generated for an added file, the consumer's own for a server file. */
|
|
18
|
+
id: string;
|
|
19
|
+
/** The file name. */
|
|
20
|
+
name: string;
|
|
21
|
+
/** What the upload function resolved to. */
|
|
22
|
+
result?: unknown;
|
|
23
|
+
/** The size in bytes. */
|
|
24
|
+
size: number;
|
|
25
|
+
/** Where the entry stands. */
|
|
26
|
+
status: CFileUploadStatus;
|
|
27
|
+
/** The media type, as the browser reported it. */
|
|
28
|
+
type?: string;
|
|
29
|
+
}
|
|
30
|
+
/** Sends one file; resolves to the entry's `result` or rejects to mark it failed. */
|
|
31
|
+
export type CFileUploadFunction = (file: File, context: CFileUploadContext) => Promise<unknown>;
|
|
32
|
+
export interface CFileUploadProps {
|
|
33
|
+
/**
|
|
34
|
+
* The file types the field takes, in the native `accept` syntax: extensions (`.pdf`) and media types (`image/*`, `application/json`), comma separated. It filters the file dialog and is checked again on a drop
|
|
35
|
+
*
|
|
36
|
+
* @freeform
|
|
37
|
+
*/
|
|
38
|
+
accept?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Show the drop zone as a control-height row — a "Choose files" button and a drop prompt — that lines up with the fields beside it
|
|
41
|
+
*
|
|
42
|
+
* @defaultable false
|
|
43
|
+
*/
|
|
44
|
+
compact?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Disable the field. Uploads already running continue
|
|
47
|
+
*/
|
|
48
|
+
disabled?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Error message shown in place of the hint while the field is invalid
|
|
51
|
+
*
|
|
52
|
+
* @freeform
|
|
53
|
+
*/
|
|
54
|
+
errorMessage?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Hide the hint and error messages
|
|
57
|
+
*
|
|
58
|
+
* @defaultable false
|
|
59
|
+
*/
|
|
60
|
+
hideDetails?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Hint text under the drop zone — the place to name the accepted types and limits
|
|
63
|
+
*
|
|
64
|
+
* @freeform
|
|
65
|
+
*/
|
|
66
|
+
hint?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Label of the field
|
|
69
|
+
*
|
|
70
|
+
* @freeform
|
|
71
|
+
*/
|
|
72
|
+
label?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Hold added files as `local` even with an upload function, until `startUploads()` queues them — for a form that uploads on its own button. Files added after the call wait for the next one
|
|
75
|
+
*/
|
|
76
|
+
manual?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* The most file entries a `multiple` field holds; files beyond it are rejected
|
|
79
|
+
*/
|
|
80
|
+
maxFiles?: null | number;
|
|
81
|
+
/**
|
|
82
|
+
* The largest file in bytes; a larger one is rejected. Sizes are shown in decimal units, so write the limit in decimal bytes (`10000000` reads "10 MB")
|
|
83
|
+
*/
|
|
84
|
+
maxSize?: null | number;
|
|
85
|
+
/**
|
|
86
|
+
* Let a pick or a drop add several files. Without it the field holds one file and a new pick replaces it; the value is a list either way
|
|
87
|
+
*/
|
|
88
|
+
multiple?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Set the field as required
|
|
91
|
+
*/
|
|
92
|
+
required?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Height of the `compact` row: the 52px default (the shared control height) or the 36px `small` row. The large drop zone has one size
|
|
95
|
+
*
|
|
96
|
+
* @defaultable 'default'
|
|
97
|
+
*/
|
|
98
|
+
size?: CFieldSize;
|
|
99
|
+
/**
|
|
100
|
+
* UI text overrides (i18n), merged over the English defaults. Objects have no attribute form — bind as a DOM property
|
|
101
|
+
*
|
|
102
|
+
* @defaultable {}
|
|
103
|
+
*/
|
|
104
|
+
texts?: CFileUploadTexts;
|
|
105
|
+
/**
|
|
106
|
+
* The upload function: called once per added file with an abort signal and a progress callback taking a fraction from 0 to 1; what it resolves to becomes the entry's `result`, an `Error` it rejects with becomes the entry's `error` text. Without one the field only holds the files. A function — bind as a DOM property
|
|
107
|
+
*/
|
|
108
|
+
upload?: CFileUploadFunction;
|
|
109
|
+
/**
|
|
110
|
+
* Set the validity of the field
|
|
111
|
+
*/
|
|
112
|
+
valid?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* The file entries — always a list. A picked file's entry carries the browser `File`; a server file's entry is `{ id, name, size, status: 'done' }`. `''` reads as empty — what a plain `v-model` holding `null` writes. An array — bind as a DOM property
|
|
115
|
+
*/
|
|
116
|
+
value?: CFileUploadEntry[] | null | string;
|
|
117
|
+
}
|
|
118
|
+
/** One rejected file, as the `reject` event reports it. */
|
|
119
|
+
export interface CFileUploadRejection {
|
|
120
|
+
/** The refused file. */
|
|
121
|
+
file: File;
|
|
122
|
+
/** Why it was refused. */
|
|
123
|
+
reason: CFileUploadRejectReason;
|
|
124
|
+
}
|
|
125
|
+
/** Why a file was rejected. */
|
|
126
|
+
export type CFileUploadRejectReason = 'count' | 'duplicate' | 'folder' | 'size' | 'type';
|
|
127
|
+
/** Where a file entry stands (CONTEXT.md "Upload status"). */
|
|
128
|
+
export type CFileUploadStatus = 'done' | 'error' | 'local' | 'queued' | 'uploading';
|
|
129
|
+
/** UI texts of `c-file-upload`, merged key by key over the English defaults. */
|
|
130
|
+
export interface CFileUploadTexts {
|
|
131
|
+
/** Announced after an add, with the number of files added. */
|
|
132
|
+
announceAdded?: (count: number) => string;
|
|
133
|
+
/** Announced when an upload fails, with the file name and the row's error text. */
|
|
134
|
+
announceFailed?: (name: string, error: string) => string;
|
|
135
|
+
/** Announced for a rejected file, with its name and the reason text. */
|
|
136
|
+
announceRejected?: (name: string, reason: string) => string;
|
|
137
|
+
/** Announced when an upload is done, with the file name. */
|
|
138
|
+
announceUploaded?: (name: string) => string;
|
|
139
|
+
/** Accessible label of a queued or uploading row's cancel button. */
|
|
140
|
+
cancel?: (name: string) => string;
|
|
141
|
+
/** The link-styled end of the large drop zone's prompt. */
|
|
142
|
+
choose?: (multiple: boolean) => string;
|
|
143
|
+
/** The compact row's button, and the large drop zone's prompt on a touch screen. */
|
|
144
|
+
chooseButton?: (multiple: boolean) => string;
|
|
145
|
+
/** The compact row's prompt beside its button. */
|
|
146
|
+
compactPrompt?: (multiple: boolean) => string;
|
|
147
|
+
/** Accessible label of a rejected row's dismiss button. */
|
|
148
|
+
dismiss?: (name: string) => string;
|
|
149
|
+
/** The large drop zone's prompt before the choose link. */
|
|
150
|
+
dragPrompt?: (multiple: boolean) => string;
|
|
151
|
+
/** The drop zone's prompt while files are dragged over the field. */
|
|
152
|
+
dropActive?: (multiple: boolean) => string;
|
|
153
|
+
/** An uploading row's status: bytes sent, file size (both formatted) and the whole percentage. */
|
|
154
|
+
progress?: (loaded: string, total: string, percent: number) => string;
|
|
155
|
+
/** Rejection reason: a file beyond the count the field holds. */
|
|
156
|
+
rejectedCount?: (max: number) => string;
|
|
157
|
+
/** Rejection reason: a file the field already holds. */
|
|
158
|
+
rejectedDuplicate?: string;
|
|
159
|
+
/** Rejection reason: a dropped folder. */
|
|
160
|
+
rejectedFolder?: string;
|
|
161
|
+
/** Rejection reason: a file over `max-size`, with the formatted limit. */
|
|
162
|
+
rejectedSize?: (max: string) => string;
|
|
163
|
+
/** Rejection reason: a type outside `accept`. */
|
|
164
|
+
rejectedType?: string;
|
|
165
|
+
/** Accessible label of a row's remove button. */
|
|
166
|
+
remove?: (name: string) => string;
|
|
167
|
+
/** Accessible label of a failed row's retry button. */
|
|
168
|
+
retry?: (name: string) => string;
|
|
169
|
+
/** Accessible name of a done row's check mark. */
|
|
170
|
+
uploaded?: string;
|
|
171
|
+
/** A failed row's status when the upload function gave no message. */
|
|
172
|
+
uploadFailed?: string;
|
|
173
|
+
/** An uploading row's status before the first progress report. */
|
|
174
|
+
uploading?: string;
|
|
175
|
+
/** A queued row's status. */
|
|
176
|
+
waiting?: string;
|
|
177
|
+
}
|
|
178
|
+
declare const _default: typeof __VLS_export;
|
|
179
|
+
export default _default;
|
|
180
|
+
declare const __VLS_export: import("vue").DefineComponent<CFileUploadProps, {
|
|
181
|
+
startUploads: () => void;
|
|
182
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CFileUploadProps> & Readonly<{}>, {
|
|
183
|
+
label: string;
|
|
184
|
+
value: CFileUploadEntry[] | null | string;
|
|
185
|
+
multiple: boolean;
|
|
186
|
+
size: CFieldSize;
|
|
187
|
+
texts: CFileUploadTexts;
|
|
188
|
+
hideDetails: boolean;
|
|
189
|
+
compact: boolean;
|
|
190
|
+
disabled: boolean;
|
|
191
|
+
errorMessage: string;
|
|
192
|
+
hint: string;
|
|
193
|
+
required: boolean;
|
|
194
|
+
valid: boolean;
|
|
195
|
+
accept: string;
|
|
196
|
+
manual: boolean;
|
|
197
|
+
maxFiles: null | number;
|
|
198
|
+
maxSize: null | number;
|
|
199
|
+
upload: CFileUploadFunction;
|
|
200
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pure half of `c-file-upload` (ADR-0071): `accept` matching, the decimal
|
|
3
|
+
* byte formatter, the file-type icon category, the name split that keeps an
|
|
4
|
+
* extension visible, the upload-error wording rule and the screening of one
|
|
5
|
+
* add into accepted and rejected files. No DOM — `files.node.spec.ts`.
|
|
6
|
+
*/
|
|
7
|
+
/** The icon family a file belongs to (decision 19 of `_plan/c-file-upload.md`). */
|
|
8
|
+
export type FileCategory = 'archive' | 'audio' | 'code' | 'document' | 'generic' | 'image' | 'spreadsheet' | 'video';
|
|
9
|
+
/** The file facts these helpers read — a `File`, or a plain object in a node spec. */
|
|
10
|
+
export interface FileFacts {
|
|
11
|
+
/** Milliseconds since the epoch; a `File` always has it. */
|
|
12
|
+
lastModified?: number;
|
|
13
|
+
name: string;
|
|
14
|
+
size: number;
|
|
15
|
+
type: string;
|
|
16
|
+
}
|
|
17
|
+
/** Why a file was refused; mirrors the component's `CFileUploadRejectReason`. */
|
|
18
|
+
export type RejectReason = 'count' | 'duplicate' | 'folder' | 'size' | 'type';
|
|
19
|
+
/** The file's media type, else the one its extension suggests, else `''`; lowercase. */
|
|
20
|
+
export declare const mediaType: (file: Pick<FileFacts, "name" | "type">) => string;
|
|
21
|
+
/**
|
|
22
|
+
* Whether a file passes an `accept` list in the native syntax — `.pdf`,
|
|
23
|
+
* `image/*`, `application/json`, comma separated, case-insensitive. An empty
|
|
24
|
+
* list accepts everything. A drop bypasses the dialog's own filter, so every
|
|
25
|
+
* add is checked here.
|
|
26
|
+
*/
|
|
27
|
+
export declare const matchesAccept: (file: Pick<FileFacts, "name" | "type">, accept: string) => boolean;
|
|
28
|
+
/** The icon family of a file, by media type and then by extension. */
|
|
29
|
+
export declare const fileCategory: (file: Pick<FileFacts, "name" | "type">) => FileCategory;
|
|
30
|
+
/**
|
|
31
|
+
* A file name split into the stem that may truncate and the extension that
|
|
32
|
+
* stays visible: `['quarterly-report', '.pdf']`. A dotfile, a name without a
|
|
33
|
+
* dot, or a "extension" that is really a word (`notes.final draft`) keeps the
|
|
34
|
+
* whole name as the stem.
|
|
35
|
+
*/
|
|
36
|
+
export declare const splitName: (name: string) => [stem: string, extension: string];
|
|
37
|
+
/**
|
|
38
|
+
* A byte count in decimal SI units in the page's language: `482 kB`,
|
|
39
|
+
* `1.2 MB` (`fi`: `482 kt`, `1,2 Mt`). Kilobytes take no decimals, larger
|
|
40
|
+
* units one; a value that rounds to 1000 steps up a unit. Under a kilobyte
|
|
41
|
+
* the unit is spelled out (`512 bytes`, `512 tavua`) — ICU's short English
|
|
42
|
+
* byte is the odd `512 byte`.
|
|
43
|
+
*/
|
|
44
|
+
export declare const formatBytes: (bytes: number, lang: string) => string;
|
|
45
|
+
/**
|
|
46
|
+
* The text a failed row shows: the rejection's own message when it is an
|
|
47
|
+
* `Error` the consumer threw, else `fallback`. A `TypeError` (fetch's
|
|
48
|
+
* "Failed to fetch") and a `DOMException` (an abort, an XHR failure) carry
|
|
49
|
+
* browser wording, so they fall back too.
|
|
50
|
+
*/
|
|
51
|
+
export declare const uploadErrorText: (reason: unknown, fallback: string) => string;
|
|
52
|
+
/** One dropped or picked file, flagged when the drop says it is a folder. */
|
|
53
|
+
export interface Candidate<F extends FileFacts> {
|
|
54
|
+
file: F;
|
|
55
|
+
folder: boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A file the field already holds: an entry's browser `File`, or a server
|
|
59
|
+
* file's name and size (it has no `lastModified`).
|
|
60
|
+
*/
|
|
61
|
+
export interface HeldFile {
|
|
62
|
+
lastModified?: number;
|
|
63
|
+
name: string;
|
|
64
|
+
size: number;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Whether a new file is one the field already holds: the same name, size and
|
|
68
|
+
* last-modified time — a file picked again from the same folder. A server
|
|
69
|
+
* file, which has no last-modified time, matches on name and size.
|
|
70
|
+
*/
|
|
71
|
+
export declare const isSameFile: (file: Pick<FileFacts, "lastModified" | "name" | "size">, held: HeldFile) => boolean;
|
|
72
|
+
export interface ScreenOptions {
|
|
73
|
+
/** The `accept` list. */
|
|
74
|
+
accept: string;
|
|
75
|
+
/** What the field already holds — checked for duplicates, and counted against `maxFiles`. */
|
|
76
|
+
held: readonly HeldFile[];
|
|
77
|
+
/** The most entries a `multiple` field holds; `null` for no cap. */
|
|
78
|
+
maxFiles: null | number;
|
|
79
|
+
/** The largest file in bytes; `null` for no cap. */
|
|
80
|
+
maxSize: null | number;
|
|
81
|
+
/** Whether a pick adds files; without it, one file replaces the entry. */
|
|
82
|
+
multiple: boolean;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Sorts one add into the files to keep and the files to refuse, in drop
|
|
86
|
+
* order. A folder, a type outside `accept`, a file over `maxSize` and a file
|
|
87
|
+
* already held — or already kept from this add — are refused for that
|
|
88
|
+
* reason; of the rest, those beyond the room left — one without `multiple`,
|
|
89
|
+
* else `maxFiles` minus the entries held — are refused as `count`.
|
|
90
|
+
*/
|
|
91
|
+
export declare const screenFiles: <F extends FileFacts>(candidates: readonly Candidate<F>[], { accept, held, maxFiles, maxSize, multiple }: ScreenOptions) => {
|
|
92
|
+
accepted: F[];
|
|
93
|
+
rejected: {
|
|
94
|
+
file: F;
|
|
95
|
+
reason: RejectReason;
|
|
96
|
+
}[];
|
|
97
|
+
};
|
|
98
|
+
/** A page-unique id for a file entry the component creates. */
|
|
99
|
+
export declare const createEntryId: () => string;
|
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
* Arithmetic works in minutes since midnight.
|
|
5
5
|
*/
|
|
6
6
|
import type { MaskSlot } from '../../shared/inputMask';
|
|
7
|
-
/** The two period texts of a 12-hour format, as shown. */
|
|
8
|
-
export interface CTimePickerPeriods {
|
|
9
|
-
am: string;
|
|
10
|
-
pm: string;
|
|
11
|
-
}
|
|
12
7
|
/** `min` / `max` in minutes since midnight; `null` where unbounded. */
|
|
13
8
|
export interface CTimePickerBounds {
|
|
14
9
|
max: null | number;
|
|
15
10
|
min: null | number;
|
|
16
11
|
}
|
|
12
|
+
/** The two period texts of a 12-hour format, as shown. */
|
|
13
|
+
export interface CTimePickerPeriods {
|
|
14
|
+
am: string;
|
|
15
|
+
pm: string;
|
|
16
|
+
}
|
|
17
17
|
export declare const isTime: (value: unknown) => value is string;
|
|
18
18
|
export declare const toMinutes: (time: string) => number;
|
|
19
19
|
export declare const fromMinutes: (minutes: number) => string;
|
package/dist-types/index.d.ts
CHANGED
|
@@ -5,8 +5,10 @@ export type { CBreadcrumbProps, CBreadcrumbTexts, } from './components/c-breadcr
|
|
|
5
5
|
export type { CButtonGroupProps, CButtonGroupSize, CButtonGroupValue, } from './components/c-button-group/CButtonGroup.vue';
|
|
6
6
|
export type { CButtonProps, CButtonSize, CButtonType, } from './components/c-button/CButton.vue';
|
|
7
7
|
export type { CCardActionsAlign, CCardActionsJustify, CCardActionsProps, } from './components/c-card-actions/CCardActions.vue';
|
|
8
|
+
export type { CColorPickerFormat, CColorPickerProps, CColorPickerSwatch, CColorPickerTexts, CColorPickerValue, } from './components/c-color-picker/CColorPicker.vue';
|
|
8
9
|
export type { CDataTableAlign, CDataTableCellContent, CDataTableCellContext, CDataTableColumn, CDataTableColumnExpansion, CDataTableColumnPin, CDataTableExpandedContext, CDataTableFooterContext, CDataTableProps, CDataTableRow, CDataTableSelectionMode, CDataTableSort, CDataTableSortDirection, CDataTableTexts, } from './components/c-data-table/CDataTable.vue';
|
|
9
10
|
export type { CDatePickerDisabledDate, CDatePickerProps, CDatePickerRange, CDatePickerText, CDatePickerTexts, CDatePickerType, CDatePickerValue, CDatePickerWeekday, } from './components/c-date-picker/CDatePicker.vue';
|
|
11
|
+
export type { CFileUploadContext, CFileUploadEntry, CFileUploadFunction, CFileUploadProps, CFileUploadRejection, CFileUploadRejectReason, CFileUploadStatus, CFileUploadTexts, } from './components/c-file-upload/CFileUpload.vue';
|
|
10
12
|
export type { CIconButtonProps, CIconButtonSize, } from './components/c-icon-button/CIconButton.vue';
|
|
11
13
|
export type { CLoginCardActionsAlign, CLoginCardActionsJustify, CLoginCardActionsProps, } from './components/c-login-card-actions/CLoginCardActions.vue';
|
|
12
14
|
export type { CLoginCardBlendMode, CLoginCardProps, } from './components/c-login-card/CLoginCard.vue';
|
|
@@ -26,11 +28,11 @@ export type { CToastProps } from './components/c-toast/CToast.vue';
|
|
|
26
28
|
export type { CToastsHorizontal, CToastsProps, CToastsVertical, } from './components/c-toasts/CToasts.vue';
|
|
27
29
|
export type { CTooltipProps } from './components/c-tooltip/CTooltip.vue';
|
|
28
30
|
export type { CTreeSelectFilter, CTreeSelectItem, CTreeSelectProps, CTreeSelectSelection, CTreeSelectTexts, CTreeSelectValue, } from './components/c-tree-select/CTreeSelect.vue';
|
|
31
|
+
export { applyDefaults, DEFAULTABLE_PROPS, resetDefaults, } from './shared/appDefaults';
|
|
32
|
+
export type { AppDefaults, DefaultableTag } from './shared/appDefaults';
|
|
29
33
|
export type * from './tag-name-map';
|
|
30
34
|
export { applyTheme, resetTheme, themeToCss } from './theme/applyTheme';
|
|
31
35
|
export type { Family, ThemeSeeds } from './theme/applyTheme';
|
|
32
|
-
export { applyDefaults, DEFAULTABLE_PROPS, resetDefaults, } from './shared/appDefaults';
|
|
33
|
-
export type { AppDefaults, DefaultableTag } from './shared/appDefaults';
|
|
34
36
|
export { chartAnatomy, chartAnatomyHex, chartSlots, chartSlotsHex, } from './theme/chart-data';
|
|
35
37
|
export type { ChartAnatomy, ChartSlots } from './theme/chart-data';
|
|
36
38
|
export { DEFAULT_SEEDS, FAMILIES } from './theme/ramp.js';
|
|
@@ -3,9 +3,9 @@ import { type TypedField } from './useTypedField';
|
|
|
3
3
|
type __VLS_Props = {
|
|
4
4
|
/** The `anchor-name` style from `useAnchoredPanel`. */
|
|
5
5
|
anchorStyle: string;
|
|
6
|
+
clearable: boolean;
|
|
6
7
|
/** Accessible label of the clear button. */
|
|
7
8
|
clearLabel: string;
|
|
8
|
-
clearable: boolean;
|
|
9
9
|
disabled: boolean;
|
|
10
10
|
errorMessage: string;
|
|
11
11
|
/** The `useTypedField` state this field renders. */
|
|
@@ -35,3 +35,15 @@ export declare const emitModelValue: (host: HTMLElement | null, value: unknown)
|
|
|
35
35
|
* handlers, never from a `props.value` watcher.
|
|
36
36
|
*/
|
|
37
37
|
export declare const emitModelChange: (host: HTMLElement | null, value: unknown) => void;
|
|
38
|
+
/**
|
|
39
|
+
* The live half of a drag (ADR-0070): mirror the host `value`, then
|
|
40
|
+
* `update:value` + a native bubbling `input` — what `v-model` previews from —
|
|
41
|
+
* with no `change`. A drag ends with one `emitModelSettled`, as a native range
|
|
42
|
+
* input fires `input` per move and `change` on release.
|
|
43
|
+
*
|
|
44
|
+
* The same re-entrancy rule applies: call ONLY from user-interaction
|
|
45
|
+
* handlers, never from a `props.value` watcher.
|
|
46
|
+
*/
|
|
47
|
+
export declare const emitModelInput: (host: HTMLElement | null, value: unknown) => void;
|
|
48
|
+
/** The `change` that ends a drag the `emitModelInput` moves reported (ADR-0070). */
|
|
49
|
+
export declare const emitModelSettled: (host: HTMLElement | null, value: unknown) => void;
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
*/
|
|
10
10
|
/** `c-select` ↔ `c-dropdown` `index` contract: the select-all row is highlighted. */
|
|
11
11
|
export declare const SELECT_ALL_INDEX = -1;
|
|
12
|
-
export type SelectAllState = 'all' | 'none' | 'some';
|
|
13
12
|
export interface SelectAllListedOption {
|
|
14
13
|
label: string;
|
|
15
14
|
value: number | string;
|
|
16
15
|
}
|
|
16
|
+
export type SelectAllState = 'all' | 'none' | 'some';
|
|
17
17
|
/** What the row's indicator shows: none, some (indeterminate) or all listed selected. */
|
|
18
18
|
export declare const selectAllState: (listed: readonly (number | string)[], selected: ReadonlySet<number | string>) => SelectAllState;
|
|
19
19
|
/**
|