@orianatech/pire 0.8.0 → 0.9.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.
- package/dist/components/forms/FileUpload.d.cts +57 -0
- package/dist/components/forms/FileUpload.d.ts +58 -0
- package/dist/components/forms/FileUpload.d.ts.map +1 -0
- package/dist/components/navigation/SideNav.d.cts +15 -9
- package/dist/components/navigation/SideNav.d.ts +15 -9
- package/dist/components/navigation/SideNav.d.ts.map +1 -1
- package/dist/components/patterns/FileDropZone.d.cts +16 -0
- package/dist/components/patterns/FileDropZone.d.ts +17 -0
- package/dist/components/patterns/FileDropZone.d.ts.map +1 -0
- package/dist/components.css +24 -0
- package/dist/i18n/messages.d.cts +8 -0
- package/dist/i18n/messages.d.ts +8 -0
- package/dist/i18n/messages.d.ts.map +1 -1
- package/dist/index.cjs +532 -270
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +526 -260
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface PireFile {
|
|
3
|
+
/** The browser's `File`. Pire uploads nothing — that is the app's job. */
|
|
4
|
+
file: File;
|
|
5
|
+
/** Object URL, only for images with `showPreview`. Revoked on unmount. */
|
|
6
|
+
previewUrl?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface FileRejection {
|
|
9
|
+
file: File;
|
|
10
|
+
reason: 'size' | 'type';
|
|
11
|
+
}
|
|
12
|
+
export interface FileUploadProps {
|
|
13
|
+
label?: React.ReactNode;
|
|
14
|
+
/** Controlled / uncontrolled, the same pair as `Tabs` and `MultiComboBox`. */
|
|
15
|
+
value?: PireFile[];
|
|
16
|
+
defaultValue?: PireFile[];
|
|
17
|
+
onChange?: (files: PireFile[]) => void;
|
|
18
|
+
/** Mime types or extensions, exactly as `FileTrigger.acceptedFileTypes` takes them. */
|
|
19
|
+
acceptedFileTypes?: readonly string[];
|
|
20
|
+
allowsMultiple?: boolean;
|
|
21
|
+
/** Ceiling in bytes. Oversized files are rejected and reported, never held. */
|
|
22
|
+
maxSize?: number;
|
|
23
|
+
/** Rejections, so the app can word its own message. */
|
|
24
|
+
onError?: (rejections: FileRejection[]) => void;
|
|
25
|
+
/** Thumbnail for images. Turn it off for CSVs, where a thumbnail says nothing. */
|
|
26
|
+
showPreview?: boolean;
|
|
27
|
+
/** Upload progress 0–100, while the app is doing the uploading. */
|
|
28
|
+
uploadProgress?: number;
|
|
29
|
+
/** Overrides the dictionary's `fileUploadChoose`. */
|
|
30
|
+
chooseLabel?: string;
|
|
31
|
+
description?: React.ReactNode;
|
|
32
|
+
errorMessage?: React.ReactNode;
|
|
33
|
+
isInvalid?: boolean;
|
|
34
|
+
isDisabled?: boolean;
|
|
35
|
+
isRequired?: boolean;
|
|
36
|
+
isReadOnly?: boolean;
|
|
37
|
+
fullWidth?: boolean;
|
|
38
|
+
name?: string;
|
|
39
|
+
className?: string;
|
|
40
|
+
style?: React.CSSProperties;
|
|
41
|
+
}
|
|
42
|
+
/** Human-readable size. Deliberately not localised digits: `toLocaleString` on the number only. */
|
|
43
|
+
export declare function formatFileSize(bytes: number): string;
|
|
44
|
+
/** Splits a picked list into keepers and rejections, without uploading or mutating anything. */
|
|
45
|
+
export declare function screenFiles(files: File[], { maxSize, acceptedFileTypes }: {
|
|
46
|
+
maxSize?: number;
|
|
47
|
+
acceptedFileTypes?: readonly string[];
|
|
48
|
+
}): {
|
|
49
|
+
accepted: File[];
|
|
50
|
+
rejected: FileRejection[];
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* File picker with a list of what was chosen. Pire hands back `File`s through `onChange` and
|
|
54
|
+
* uploads nothing: the app owns the `FormData`, the request and the progress it reports back
|
|
55
|
+
* through `uploadProgress`.
|
|
56
|
+
*/
|
|
57
|
+
export declare function FileUpload({ label, value, defaultValue, onChange, acceptedFileTypes, allowsMultiple, maxSize, onError, showPreview, uploadProgress, chooseLabel, description, errorMessage, isInvalid, isDisabled, isReadOnly, isRequired, fullWidth, className, style, }: FileUploadProps): React.JSX.Element;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface PireFile {
|
|
3
|
+
/** The browser's `File`. Pire uploads nothing — that is the app's job. */
|
|
4
|
+
file: File;
|
|
5
|
+
/** Object URL, only for images with `showPreview`. Revoked on unmount. */
|
|
6
|
+
previewUrl?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface FileRejection {
|
|
9
|
+
file: File;
|
|
10
|
+
reason: 'size' | 'type';
|
|
11
|
+
}
|
|
12
|
+
export interface FileUploadProps {
|
|
13
|
+
label?: React.ReactNode;
|
|
14
|
+
/** Controlled / uncontrolled, the same pair as `Tabs` and `MultiComboBox`. */
|
|
15
|
+
value?: PireFile[];
|
|
16
|
+
defaultValue?: PireFile[];
|
|
17
|
+
onChange?: (files: PireFile[]) => void;
|
|
18
|
+
/** Mime types or extensions, exactly as `FileTrigger.acceptedFileTypes` takes them. */
|
|
19
|
+
acceptedFileTypes?: readonly string[];
|
|
20
|
+
allowsMultiple?: boolean;
|
|
21
|
+
/** Ceiling in bytes. Oversized files are rejected and reported, never held. */
|
|
22
|
+
maxSize?: number;
|
|
23
|
+
/** Rejections, so the app can word its own message. */
|
|
24
|
+
onError?: (rejections: FileRejection[]) => void;
|
|
25
|
+
/** Thumbnail for images. Turn it off for CSVs, where a thumbnail says nothing. */
|
|
26
|
+
showPreview?: boolean;
|
|
27
|
+
/** Upload progress 0–100, while the app is doing the uploading. */
|
|
28
|
+
uploadProgress?: number;
|
|
29
|
+
/** Overrides the dictionary's `fileUploadChoose`. */
|
|
30
|
+
chooseLabel?: string;
|
|
31
|
+
description?: React.ReactNode;
|
|
32
|
+
errorMessage?: React.ReactNode;
|
|
33
|
+
isInvalid?: boolean;
|
|
34
|
+
isDisabled?: boolean;
|
|
35
|
+
isRequired?: boolean;
|
|
36
|
+
isReadOnly?: boolean;
|
|
37
|
+
fullWidth?: boolean;
|
|
38
|
+
name?: string;
|
|
39
|
+
className?: string;
|
|
40
|
+
style?: React.CSSProperties;
|
|
41
|
+
}
|
|
42
|
+
/** Human-readable size. Deliberately not localised digits: `toLocaleString` on the number only. */
|
|
43
|
+
export declare function formatFileSize(bytes: number): string;
|
|
44
|
+
/** Splits a picked list into keepers and rejections, without uploading or mutating anything. */
|
|
45
|
+
export declare function screenFiles(files: File[], { maxSize, acceptedFileTypes }: {
|
|
46
|
+
maxSize?: number;
|
|
47
|
+
acceptedFileTypes?: readonly string[];
|
|
48
|
+
}): {
|
|
49
|
+
accepted: File[];
|
|
50
|
+
rejected: FileRejection[];
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* File picker with a list of what was chosen. Pire hands back `File`s through `onChange` and
|
|
54
|
+
* uploads nothing: the app owns the `FormData`, the request and the progress it reports back
|
|
55
|
+
* through `uploadProgress`.
|
|
56
|
+
*/
|
|
57
|
+
export declare function FileUpload({ label, value, defaultValue, onChange, acceptedFileTypes, allowsMultiple, maxSize, onError, showPreview, uploadProgress, chooseLabel, description, errorMessage, isInvalid, isDisabled, isReadOnly, isRequired, fullWidth, className, style, }: FileUploadProps): React.JSX.Element;
|
|
58
|
+
//# sourceMappingURL=FileUpload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileUpload.d.ts","sourceRoot":"","sources":["../../../src/components/forms/FileUpload.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,MAAM,WAAW,QAAQ;IACvB,0EAA0E;IAC1E,IAAI,EAAE,IAAI,CAAC;IACX,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;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AAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAC1F;IAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAAC,QAAQ,EAAE,aAAa,EAAE,CAAA;CAAE,CAwBjD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,iBAAiB,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EACzF,WAAkB,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAC1E,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,SAAgB,EAAE,SAAS,EAAE,KAAK,GAClF,EAAE,eAAe,qBA2EjB"}
|
|
@@ -40,9 +40,16 @@ export interface SideNavProps extends Omit<React.HTMLAttributes<HTMLElement>, 'o
|
|
|
40
40
|
defaultExpandedIds?: string[];
|
|
41
41
|
/** Fires with every expanded id after a toggle, controlled or not. */
|
|
42
42
|
onExpandedChange?: (ids: string[]) => void;
|
|
43
|
-
/** 48px icon rail. Labels move into tooltips,
|
|
44
|
-
* see the note on {@link SideNav}. */
|
|
43
|
+
/** 48px icon rail. Labels move into tooltips or, for a group, into its flyout. */
|
|
45
44
|
collapsed?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* In the rail, a group opens its children in a flyout beside it. On by default: without it the
|
|
47
|
+
* rail records an expansion nothing can draw, leaving second-level destinations reachable only
|
|
48
|
+
* by expanding the nav again.
|
|
49
|
+
*
|
|
50
|
+
* Pass `false` for the previous behaviour, where a rail group toggles expansion invisibly.
|
|
51
|
+
*/
|
|
52
|
+
railFlyout?: boolean;
|
|
46
53
|
footer?: React.ReactNode;
|
|
47
54
|
}
|
|
48
55
|
/** Primary navigation. A first-level entry is either a destination (icon + label, selectable) or a
|
|
@@ -63,12 +70,11 @@ export interface SideNavProps extends Omit<React.HTMLAttributes<HTMLElement>, 'o
|
|
|
63
70
|
* UA's `[hidden] { display: none }`, leaving collapsed children focusable under
|
|
64
71
|
* `aria-hidden="true"`. `.pire-sidenav-subnav[hidden]` in `components.css` is that guard.
|
|
65
72
|
* - **`collapsed` and expansion are different axes, and the rail wins.** With `collapsed` set there
|
|
66
|
-
* are no labels, and a second level is nothing *but* labels
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* everyone, exactly as the labels already are.
|
|
73
|
+
* are no labels, and a second level is nothing *but* labels. A group therefore opens its children
|
|
74
|
+
* in a flyout beside the rail (`railFlyout`, on by default) rather than inline. With
|
|
75
|
+
* `railFlyout={false}` the row falls back to recording the expansion silently — which leaves
|
|
76
|
+
* second-level destinations reachable only by expanding the nav again, so it is off the
|
|
77
|
+
* accessible path and exists for compatibility.
|
|
72
78
|
* - **Several groups can be open at once**, and there is no accordion mode. Closing the group you
|
|
73
79
|
* are in to open another is the wrong trade in a nav whose whole job is showing where you are. */
|
|
74
|
-
export declare function SideNav({ groups, value, onChange, expandedIds, defaultExpandedIds, onExpandedChange, collapsed, footer, className, ...rest }: SideNavProps): React.JSX.Element;
|
|
80
|
+
export declare function SideNav({ groups, value, onChange, expandedIds, defaultExpandedIds, onExpandedChange, collapsed, railFlyout, footer, className, ...rest }: SideNavProps): React.JSX.Element;
|
|
@@ -40,9 +40,16 @@ export interface SideNavProps extends Omit<React.HTMLAttributes<HTMLElement>, 'o
|
|
|
40
40
|
defaultExpandedIds?: string[];
|
|
41
41
|
/** Fires with every expanded id after a toggle, controlled or not. */
|
|
42
42
|
onExpandedChange?: (ids: string[]) => void;
|
|
43
|
-
/** 48px icon rail. Labels move into tooltips,
|
|
44
|
-
* see the note on {@link SideNav}. */
|
|
43
|
+
/** 48px icon rail. Labels move into tooltips or, for a group, into its flyout. */
|
|
45
44
|
collapsed?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* In the rail, a group opens its children in a flyout beside it. On by default: without it the
|
|
47
|
+
* rail records an expansion nothing can draw, leaving second-level destinations reachable only
|
|
48
|
+
* by expanding the nav again.
|
|
49
|
+
*
|
|
50
|
+
* Pass `false` for the previous behaviour, where a rail group toggles expansion invisibly.
|
|
51
|
+
*/
|
|
52
|
+
railFlyout?: boolean;
|
|
46
53
|
footer?: React.ReactNode;
|
|
47
54
|
}
|
|
48
55
|
/** Primary navigation. A first-level entry is either a destination (icon + label, selectable) or a
|
|
@@ -63,13 +70,12 @@ export interface SideNavProps extends Omit<React.HTMLAttributes<HTMLElement>, 'o
|
|
|
63
70
|
* UA's `[hidden] { display: none }`, leaving collapsed children focusable under
|
|
64
71
|
* `aria-hidden="true"`. `.pire-sidenav-subnav[hidden]` in `components.css` is that guard.
|
|
65
72
|
* - **`collapsed` and expansion are different axes, and the rail wins.** With `collapsed` set there
|
|
66
|
-
* are no labels, and a second level is nothing *but* labels
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* everyone, exactly as the labels already are.
|
|
73
|
+
* are no labels, and a second level is nothing *but* labels. A group therefore opens its children
|
|
74
|
+
* in a flyout beside the rail (`railFlyout`, on by default) rather than inline. With
|
|
75
|
+
* `railFlyout={false}` the row falls back to recording the expansion silently — which leaves
|
|
76
|
+
* second-level destinations reachable only by expanding the nav again, so it is off the
|
|
77
|
+
* accessible path and exists for compatibility.
|
|
72
78
|
* - **Several groups can be open at once**, and there is no accordion mode. Closing the group you
|
|
73
79
|
* are in to open another is the wrong trade in a nav whose whole job is showing where you are. */
|
|
74
|
-
export declare function SideNav({ groups, value, onChange, expandedIds, defaultExpandedIds, onExpandedChange, collapsed, footer, className, ...rest }: SideNavProps): React.JSX.Element;
|
|
80
|
+
export declare function SideNav({ groups, value, onChange, expandedIds, defaultExpandedIds, onExpandedChange, collapsed, railFlyout, footer, className, ...rest }: SideNavProps): React.JSX.Element;
|
|
75
81
|
//# sourceMappingURL=SideNav.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideNav.d.ts","sourceRoot":"","sources":["../../../src/components/navigation/SideNav.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SideNav.d.ts","sourceRoot":"","sources":["../../../src/components/navigation/SideNav.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B;;;;8EAI8E;AAC9E,MAAM,WAAW,gBAAgB;IAAG,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE;AAE/E,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;wEAGoE;IACpE,KAAK,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,YAAY;IAAG,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,WAAW,EAAE,CAAA;CAAE;AAEtE,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC;IACvF,uDAAuD;IACvD,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;mGAC+F;IAC/F,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC;sEACkE;IAClE,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB;;mCAE+B;IAC/B,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,sEAAsE;IACtE,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC3C,kFAAkF;IAClF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B;AAaD;;;;;;;;;;;;;;;;;;;;;;;;qGAwBqG;AACrG,wBAAgB,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,kBAAkB,EAAE,gBAAgB,EAClG,SAAS,EAAE,UAAiB,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,YAAY,qBAwIzE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type FileUploadProps } from '../forms/FileUpload.cjs';
|
|
3
|
+
export interface FileDropZoneProps extends Omit<FileUploadProps, 'chooseLabel'> {
|
|
4
|
+
/** Instruction inside the zone. Overrides the dictionary's `fileDropZonePrompt`. */
|
|
5
|
+
promptLabel?: React.ReactNode;
|
|
6
|
+
/** `compact` for an import modal, where the zone competes with a table for height. */
|
|
7
|
+
height?: 'compact' | 'regular';
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The large drop surface, for import screens and anywhere a file is the point of the page.
|
|
11
|
+
*
|
|
12
|
+
* Built on React Aria's `DropZone`, so it is a real drop target for keyboard and assistive tech —
|
|
13
|
+
* not a div with `onDragOver`. It still contains a `FileTrigger`, because drag-and-drop alone is
|
|
14
|
+
* not an accessible way to supply a file.
|
|
15
|
+
*/
|
|
16
|
+
export declare function FileDropZone({ label, value, defaultValue, onChange, acceptedFileTypes, allowsMultiple, maxSize, onError, showPreview, uploadProgress, promptLabel, height, description, errorMessage, isInvalid, isDisabled, isReadOnly, isRequired, fullWidth, className, style, }: FileDropZoneProps): React.JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type FileUploadProps } from '../forms/FileUpload.js';
|
|
3
|
+
export interface FileDropZoneProps extends Omit<FileUploadProps, 'chooseLabel'> {
|
|
4
|
+
/** Instruction inside the zone. Overrides the dictionary's `fileDropZonePrompt`. */
|
|
5
|
+
promptLabel?: React.ReactNode;
|
|
6
|
+
/** `compact` for an import modal, where the zone competes with a table for height. */
|
|
7
|
+
height?: 'compact' | 'regular';
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The large drop surface, for import screens and anywhere a file is the point of the page.
|
|
11
|
+
*
|
|
12
|
+
* Built on React Aria's `DropZone`, so it is a real drop target for keyboard and assistive tech —
|
|
13
|
+
* not a div with `onDragOver`. It still contains a `FileTrigger`, because drag-and-drop alone is
|
|
14
|
+
* not an accessible way to supply a file.
|
|
15
|
+
*/
|
|
16
|
+
export declare function FileDropZone({ label, value, defaultValue, onChange, acceptedFileTypes, allowsMultiple, maxSize, onError, showPreview, uploadProgress, promptLabel, height, description, errorMessage, isInvalid, isDisabled, isReadOnly, isRequired, fullWidth, className, style, }: FileDropZoneProps): React.JSX.Element;
|
|
17
|
+
//# sourceMappingURL=FileDropZone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileDropZone.d.ts","sourceRoot":"","sources":["../../../src/components/patterns/FileDropZone.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EAA+B,KAAK,eAAe,EAAiB,MAAM,qBAAqB,CAAC;AAIvG,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC;IAC7E,oFAAoF;IACpF,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,sFAAsF;IACtF,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CAChC;AAID;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,iBAAiB,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,EACzF,WAAkB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAkB,EAAE,WAAW,EAAE,YAAY,EAC9F,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,SAAgB,EAAE,SAAS,EAAE,KAAK,GAClF,EAAE,iBAAiB,qBAyFnB"}
|
package/dist/components.css
CHANGED
|
@@ -481,6 +481,30 @@
|
|
|
481
481
|
.pire-menu-section-title{display:block;padding:var(--sp-1) var(--sp-3);font:var(--type-label);letter-spacing:var(--ls-caps);text-transform:uppercase;color:var(--text-secondary)}
|
|
482
482
|
.pire-menu-separator{border:0;border-top:var(--border-w-hairline) solid var(--border-subtle);margin:var(--sp-1) 0}
|
|
483
483
|
|
|
484
|
+
/* ---- FileUpload / FileDropZone ------------------------------------------- */
|
|
485
|
+
.pire-fileupload-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:var(--sp-1)}
|
|
486
|
+
.pire-fileupload-item{display:flex;align-items:center;gap:var(--sp-2);min-height:var(--row-h-condensed);padding:0 var(--sp-2);border:1px solid var(--border-subtle);border-radius:var(--radius-1);background:var(--surface-card)}
|
|
487
|
+
.pire-fileupload-icon{flex:0 0 auto;color:var(--text-secondary)}
|
|
488
|
+
.pire-fileupload-thumb{flex:0 0 auto;width:24px;height:24px;object-fit:cover;border-radius:var(--radius-1)}
|
|
489
|
+
.pire-fileupload-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:var(--type-body)}
|
|
490
|
+
.pire-fileupload-size{flex:0 0 auto;font:var(--type-caption);color:var(--text-secondary);font-variant-numeric:tabular-nums}
|
|
491
|
+
.pire-dropzone{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--sp-2);padding:var(--sp-6);border:1px dashed var(--border-default);border-radius:var(--radius-2);background:var(--surface-sunken);color:var(--text-secondary);text-align:center;transition:var(--transition-surface)}
|
|
492
|
+
.pire-dropzone[data-height="compact"]{padding:var(--sp-4)}
|
|
493
|
+
/* React Aria sets data-drop-target while a drag hovers, and data-focus-visible on keyboard
|
|
494
|
+
focus — the zone is a real drop target, so both states have to read as active. */
|
|
495
|
+
.pire-dropzone[data-drop-target]{border-color:var(--accent-bg);border-style:solid;background:var(--accent-subtle-bg)}
|
|
496
|
+
.pire-dropzone[data-focus-visible]{outline:var(--focus-w) solid var(--focus-color);outline-offset:var(--focus-offset)}
|
|
497
|
+
.pire-dropzone[data-disabled]{background:var(--surface-disabled);color:var(--text-disabled);border-color:var(--border-subtle)}
|
|
498
|
+
.pire-dropzone-icon{color:var(--text-tertiary)}
|
|
499
|
+
.pire-dropzone-prompt{font:var(--type-body)}
|
|
500
|
+
|
|
501
|
+
/* ---- SideNav rail flyout -------------------------------------------------- */
|
|
502
|
+
/* Matches the expanded nav's width so the flyout is not visibly narrower than the menu it
|
|
503
|
+
stands in for. The rows drop the second-level indent: there is no first level beside them
|
|
504
|
+
here, so the indent would be measuring against something that is not on screen. */
|
|
505
|
+
.pire-sidenav-flyout{min-width:var(--sidenav-w)}
|
|
506
|
+
.pire-sidenav-flyout .pire-menu-item{padding-left:var(--sp-4)}
|
|
507
|
+
|
|
484
508
|
/* ---- ComboBox async status ----------------------------------------------- */
|
|
485
509
|
/* Same height as an option row so the popover does not resize when results replace the
|
|
486
510
|
loading line — a popover that jumps has already moved the row under the pointer. */
|
package/dist/i18n/messages.d.cts
CHANGED
|
@@ -63,6 +63,14 @@ export interface PireMessages {
|
|
|
63
63
|
paginationRowsPerPage: string;
|
|
64
64
|
/** Landmark name of the main SideNav. Override it when a screen has more than one nav. */
|
|
65
65
|
sideNavLabel: string;
|
|
66
|
+
/** Button that opens the OS file picker. */
|
|
67
|
+
fileUploadChoose: string;
|
|
68
|
+
/** Removes one picked file. `{name}` is replaced with the file name. */
|
|
69
|
+
fileUploadRemoveNamed: string;
|
|
70
|
+
/** Label on the progress bar while the app uploads. */
|
|
71
|
+
fileUploadUploading: string;
|
|
72
|
+
/** Instruction inside the drop surface. */
|
|
73
|
+
fileDropZonePrompt: string;
|
|
66
74
|
}
|
|
67
75
|
export declare const enMessages: PireMessages;
|
|
68
76
|
export declare const esMessages: PireMessages;
|
package/dist/i18n/messages.d.ts
CHANGED
|
@@ -63,6 +63,14 @@ export interface PireMessages {
|
|
|
63
63
|
paginationRowsPerPage: string;
|
|
64
64
|
/** Landmark name of the main SideNav. Override it when a screen has more than one nav. */
|
|
65
65
|
sideNavLabel: string;
|
|
66
|
+
/** Button that opens the OS file picker. */
|
|
67
|
+
fileUploadChoose: string;
|
|
68
|
+
/** Removes one picked file. `{name}` is replaced with the file name. */
|
|
69
|
+
fileUploadRemoveNamed: string;
|
|
70
|
+
/** Label on the progress bar while the app uploads. */
|
|
71
|
+
fileUploadUploading: string;
|
|
72
|
+
/** Instruction inside the drop surface. */
|
|
73
|
+
fileDropZonePrompt: string;
|
|
66
74
|
}
|
|
67
75
|
export declare const enMessages: PireMessages;
|
|
68
76
|
export declare const esMessages: PireMessages;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/i18n/messages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,WAAW,YAAY;IAC3B,iCAAiC;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,8EAA8E;IAC9E,WAAW,EAAE,MAAM,CAAC;IACpB,mEAAmE;IACnE,iBAAiB,EAAE,MAAM,CAAC;IAE1B,qEAAqE;IACrE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,qDAAqD;IACrD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,oDAAoD;IACpD,gBAAgB,EAAE,MAAM,CAAC;IAEzB,wDAAwD;IACxD,WAAW,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,cAAc,EAAE,MAAM,CAAC;IAEvB,6DAA6D;IAC7D,oBAAoB,EAAE,MAAM,CAAC;IAC7B,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAC;IACrB,8CAA8C;I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