asheeui 1.1.1 → 2.0.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/centered/Centered.d.ts +49 -0
- package/dist/components/centered/Centered.d.ts.map +1 -0
- package/dist/components/centered/Centered.js +32 -0
- package/dist/components/centered/centered-config.d.ts +63 -0
- package/dist/components/centered/centered-config.d.ts.map +1 -0
- package/dist/components/centered/centered-config.js +17 -0
- package/dist/components/centered/centered-styles.d.ts +11 -0
- package/dist/components/centered/centered-styles.d.ts.map +1 -0
- package/dist/components/centered/centered-styles.js +9 -0
- package/dist/components/centered/index.d.ts +3 -0
- package/dist/components/centered/index.d.ts.map +1 -0
- package/dist/components/centered/index.js +3 -0
- package/dist/components/chip/Chip.d.ts +8 -0
- package/dist/components/chip/Chip.d.ts.map +1 -1
- package/dist/components/chip/Chip.js +15 -15
- package/dist/components/data-table/DataTable.d.ts +137 -0
- package/dist/components/data-table/DataTable.d.ts.map +1 -0
- package/dist/components/data-table/DataTable.js +101 -0
- package/dist/components/data-table/data-table-config.d.ts +75 -0
- package/dist/components/data-table/data-table-config.d.ts.map +1 -0
- package/dist/components/data-table/data-table-config.js +24 -0
- package/dist/components/data-table/data-table-styles.d.ts +25 -0
- package/dist/components/data-table/data-table-styles.d.ts.map +1 -0
- package/dist/components/data-table/data-table-styles.js +5 -0
- package/dist/components/data-table/index.d.ts +3 -0
- package/dist/components/data-table/index.d.ts.map +1 -0
- package/dist/components/data-table/index.js +3 -0
- package/dist/components/docs-layout/DocsLayout.d.ts +94 -0
- package/dist/components/docs-layout/DocsLayout.d.ts.map +1 -0
- package/dist/components/docs-layout/DocsLayout.js +62 -0
- package/dist/components/docs-layout/docs-layout-config.d.ts +61 -0
- package/dist/components/docs-layout/docs-layout-config.d.ts.map +1 -0
- package/dist/components/docs-layout/docs-layout-config.js +22 -0
- package/dist/components/docs-layout/docs-layout-styles.d.ts +31 -0
- package/dist/components/docs-layout/docs-layout-styles.d.ts.map +1 -0
- package/dist/components/docs-layout/docs-layout-styles.js +5 -0
- package/dist/components/docs-layout/index.d.ts +3 -0
- package/dist/components/docs-layout/index.d.ts.map +1 -0
- package/dist/components/docs-layout/index.js +3 -0
- package/dist/components/empty-state/EmptyState.d.ts +19 -1
- package/dist/components/empty-state/EmptyState.d.ts.map +1 -1
- package/dist/components/empty-state/EmptyState.js +10 -9
- package/dist/components/error-state/ErrorState.d.ts +98 -0
- package/dist/components/error-state/ErrorState.d.ts.map +1 -0
- package/dist/components/error-state/ErrorState.js +57 -0
- package/dist/components/error-state/error-state-config.d.ts +66 -0
- package/dist/components/error-state/error-state-config.d.ts.map +1 -0
- package/dist/components/error-state/error-state-config.js +20 -0
- package/dist/components/error-state/error-state-styles.d.ts +17 -0
- package/dist/components/error-state/error-state-styles.d.ts.map +1 -0
- package/dist/components/error-state/error-state-styles.js +5 -0
- package/dist/components/error-state/index.d.ts +3 -0
- package/dist/components/error-state/index.d.ts.map +1 -0
- package/dist/components/error-state/index.js +3 -0
- package/dist/components/file-upload/FileUpload.d.ts +112 -0
- package/dist/components/file-upload/FileUpload.d.ts.map +1 -0
- package/dist/components/file-upload/FileUpload.js +83 -0
- package/dist/components/file-upload/file-upload-config.d.ts +41 -0
- package/dist/components/file-upload/file-upload-config.d.ts.map +1 -0
- package/dist/components/file-upload/file-upload-config.js +16 -0
- package/dist/components/file-upload/file-upload-styles.d.ts +22 -0
- package/dist/components/file-upload/file-upload-styles.d.ts.map +1 -0
- package/dist/components/file-upload/file-upload-styles.js +9 -0
- package/dist/components/file-upload/file-upload.helpers.d.ts +26 -0
- package/dist/components/file-upload/file-upload.helpers.d.ts.map +1 -0
- package/dist/components/file-upload/file-upload.helpers.js +17 -0
- package/dist/components/file-upload/index.d.ts +3 -0
- package/dist/components/file-upload/index.d.ts.map +1 -0
- package/dist/components/file-upload/index.js +4 -0
- package/dist/components/loading-state/LoadingState.d.ts +57 -0
- package/dist/components/loading-state/LoadingState.d.ts.map +1 -0
- package/dist/components/loading-state/LoadingState.js +44 -0
- package/dist/components/loading-state/index.d.ts +3 -0
- package/dist/components/loading-state/index.d.ts.map +1 -0
- package/dist/components/loading-state/index.js +3 -0
- package/dist/components/loading-state/loading-state-config.d.ts +49 -0
- package/dist/components/loading-state/loading-state-config.d.ts.map +1 -0
- package/dist/components/loading-state/loading-state-config.js +18 -0
- package/dist/components/loading-state/loading-state-styles.d.ts +12 -0
- package/dist/components/loading-state/loading-state-styles.d.ts.map +1 -0
- package/dist/components/loading-state/loading-state-styles.js +9 -0
- package/dist/components/marketing-layout/MarketingLayout.d.ts +83 -0
- package/dist/components/marketing-layout/MarketingLayout.d.ts.map +1 -0
- package/dist/components/marketing-layout/MarketingLayout.js +40 -0
- package/dist/components/marketing-layout/index.d.ts +3 -0
- package/dist/components/marketing-layout/index.d.ts.map +1 -0
- package/dist/components/marketing-layout/index.js +3 -0
- package/dist/components/marketing-layout/marketing-layout-config.d.ts +60 -0
- package/dist/components/marketing-layout/marketing-layout-config.d.ts.map +1 -0
- package/dist/components/marketing-layout/marketing-layout-config.js +16 -0
- package/dist/components/marketing-layout/marketing-layout-styles.d.ts +8 -0
- package/dist/components/marketing-layout/marketing-layout-styles.d.ts.map +1 -0
- package/dist/components/marketing-layout/marketing-layout-styles.js +8 -0
- package/dist/components/search-input/SearchInput.d.ts +111 -0
- package/dist/components/search-input/SearchInput.d.ts.map +1 -0
- package/dist/components/search-input/SearchInput.js +86 -0
- package/dist/components/search-input/index.d.ts +3 -0
- package/dist/components/search-input/index.d.ts.map +1 -0
- package/dist/components/search-input/index.js +3 -0
- package/dist/components/search-input/search-input-config.d.ts +55 -0
- package/dist/components/search-input/search-input-config.d.ts.map +1 -0
- package/dist/components/search-input/search-input-config.js +20 -0
- package/dist/components/search-input/search-input-styles.d.ts +16 -0
- package/dist/components/search-input/search-input-styles.d.ts.map +1 -0
- package/dist/components/search-input/search-input-styles.js +9 -0
- package/dist/components/section-kit/ActionGroup.d.ts +8 -1
- package/dist/components/section-kit/ActionGroup.d.ts.map +1 -1
- package/dist/components/section-kit/ActionGroup.js +13 -9
- package/dist/components/section-kit/SkipLink.d.ts +50 -0
- package/dist/components/section-kit/SkipLink.d.ts.map +1 -0
- package/dist/components/section-kit/SkipLink.js +14 -0
- package/dist/components/section-kit/index.d.ts +5 -4
- package/dist/components/section-kit/index.d.ts.map +1 -1
- package/dist/components/section-kit/index.js +1 -0
- package/dist/components/sidebar-layout/SidebarLayout.d.ts.map +1 -1
- package/dist/components/sidebar-layout/SidebarLayout.js +25 -25
- package/dist/components/sidebar-layout/sidebar-layout-styles.d.ts +10 -3
- package/dist/components/sidebar-layout/sidebar-layout-styles.d.ts.map +1 -1
- package/dist/components/sidebar-layout/sidebar-layout-styles.js +2 -2
- package/dist/components/split/Split.d.ts +68 -0
- package/dist/components/split/Split.d.ts.map +1 -0
- package/dist/components/split/Split.js +36 -0
- package/dist/components/split/index.d.ts +3 -0
- package/dist/components/split/index.d.ts.map +1 -0
- package/dist/components/split/index.js +3 -0
- package/dist/components/split/split-config.d.ts +83 -0
- package/dist/components/split/split-config.d.ts.map +1 -0
- package/dist/components/split/split-config.js +20 -0
- package/dist/components/split/split-styles.d.ts +36 -0
- package/dist/components/split/split-styles.d.ts.map +1 -0
- package/dist/components/split/split-styles.js +76 -0
- package/dist/components/stepper/Stepper.d.ts +94 -0
- package/dist/components/stepper/Stepper.d.ts.map +1 -0
- package/dist/components/stepper/Stepper.js +71 -0
- package/dist/components/stepper/index.d.ts +3 -0
- package/dist/components/stepper/index.d.ts.map +1 -0
- package/dist/components/stepper/index.js +3 -0
- package/dist/components/stepper/stepper-config.d.ts +51 -0
- package/dist/components/stepper/stepper-config.d.ts.map +1 -0
- package/dist/components/stepper/stepper-config.js +16 -0
- package/dist/components/stepper/stepper-styles.d.ts +30 -0
- package/dist/components/stepper/stepper-styles.d.ts.map +1 -0
- package/dist/components/stepper/stepper-styles.js +25 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +93 -73
- package/dist/shared/spacing.d.ts +8 -0
- package/dist/shared/spacing.d.ts.map +1 -1
- package/dist/shared/spacing.js +9 -1
- package/package.json +1 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Size } from '../../shared';
|
|
2
|
+
/**
|
|
3
|
+
* How the failed region announces itself.
|
|
4
|
+
*
|
|
5
|
+
* - `alert`: it is announced as soon as it appears, which is right when it
|
|
6
|
+
* replaces content after a request failed.
|
|
7
|
+
* - `status`: it is announced politely, which is right when the failure is not
|
|
8
|
+
* the result of the reader's last action.
|
|
9
|
+
* - `none`: it is not announced, which is right when it is part of the page's
|
|
10
|
+
* initial markup, such as a not-found page.
|
|
11
|
+
*/
|
|
12
|
+
export type ErrorStateRole = "alert" | "status" | "none";
|
|
13
|
+
/**
|
|
14
|
+
* Theme configuration options for the ErrorState component.
|
|
15
|
+
*
|
|
16
|
+
* Set under `components.errorstate` in the AsheeUI config. Values feed the
|
|
17
|
+
* component-level tier of the theme cascade.
|
|
18
|
+
*/
|
|
19
|
+
export interface ErrorStateConfig {
|
|
20
|
+
/**
|
|
21
|
+
* Density of the state.
|
|
22
|
+
*
|
|
23
|
+
* @default "md"
|
|
24
|
+
*/
|
|
25
|
+
size?: Size;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the state is drawn as a panel.
|
|
28
|
+
*
|
|
29
|
+
* @default true
|
|
30
|
+
*/
|
|
31
|
+
panel?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* How the state is announced.
|
|
34
|
+
*
|
|
35
|
+
* @default "alert"
|
|
36
|
+
*/
|
|
37
|
+
role?: ErrorStateRole;
|
|
38
|
+
/**
|
|
39
|
+
* Wording of the retry control.
|
|
40
|
+
*
|
|
41
|
+
* @default "Try again"
|
|
42
|
+
*/
|
|
43
|
+
retryLabel?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Wording of the disclosure that holds the technical detail.
|
|
46
|
+
*
|
|
47
|
+
* @default "Technical details"
|
|
48
|
+
*/
|
|
49
|
+
detailLabel?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Default config values registered for the ErrorState component.
|
|
53
|
+
* A panel and an announcement are the defaults because this state usually
|
|
54
|
+
* replaces a region after a request failed.
|
|
55
|
+
*/
|
|
56
|
+
export declare const defaultErrorStateConfig: ErrorStateConfig;
|
|
57
|
+
declare module "../../libs/registry" {
|
|
58
|
+
interface ComponentTypeConfigRegistry {
|
|
59
|
+
errorstate: ErrorStateConfig;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Hard fallback values used when no config tier provides a value.
|
|
64
|
+
*/
|
|
65
|
+
export declare const FALLBACK_ERROR_STATE_CONFIG: Required<ErrorStateConfig>;
|
|
66
|
+
//# sourceMappingURL=error-state-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-state-config.d.ts","sourceRoot":"","sources":["../../../src/components/error-state/error-state-config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC;;;;;;;;;GASG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;;OAIG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;IAEtB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBAMrC,CAAC;AAEF,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,2BAA2B;QACnC,UAAU,EAAE,gBAAgB,CAAC;KAC9B;CACF;AAID;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,gBAAgB,CAMlE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { registerComponentDefaults as e } from "../../libs/registry.js";
|
|
3
|
+
//#region src/components/error-state/error-state-config.ts
|
|
4
|
+
var t = {
|
|
5
|
+
size: "md",
|
|
6
|
+
panel: !0,
|
|
7
|
+
role: "alert",
|
|
8
|
+
retryLabel: "Try again",
|
|
9
|
+
detailLabel: "Technical details"
|
|
10
|
+
};
|
|
11
|
+
e("errorstate", t);
|
|
12
|
+
var n = {
|
|
13
|
+
size: "md",
|
|
14
|
+
panel: !0,
|
|
15
|
+
role: "alert",
|
|
16
|
+
retryLabel: "Try again",
|
|
17
|
+
detailLabel: "Technical details"
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { n as FALLBACK_ERROR_STATE_CONFIG, t as defaultErrorStateConfig };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ErrorState component styles for AsheeUI.
|
|
3
|
+
* This file provides the static class mappings for the failed-region
|
|
4
|
+
* presentation: the disclosure that holds the technical detail and its body.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* The disclosure.
|
|
8
|
+
* It is the platform's own `details` element rather than a framework component,
|
|
9
|
+
* because a detail a reader opens has to work when scripting is unavailable, and
|
|
10
|
+
* because it is not application state.
|
|
11
|
+
*/
|
|
12
|
+
export declare const ERROR_STATE_DETAIL_CLASS = "w-full max-w-2xl text-left text-sm text-foreground/70";
|
|
13
|
+
/** The summary a reader activates to open the detail. */
|
|
14
|
+
export declare const ERROR_STATE_DETAIL_SUMMARY_CLASS = "cursor-pointer font-medium text-foreground";
|
|
15
|
+
/** The detail body, which keeps the technical text as it was written. */
|
|
16
|
+
export declare const ERROR_STATE_DETAIL_BODY_CLASS = "mt-2 overflow-x-auto rounded-md border border-border bg-background p-3 font-mono text-xs";
|
|
17
|
+
//# sourceMappingURL=error-state-styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-state-styles.d.ts","sourceRoot":"","sources":["../../../src/components/error-state/error-state-styles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,0DACoB,CAAC;AAE1D,yDAAyD;AACzD,eAAO,MAAM,gCAAgC,+CACC,CAAC;AAE/C,yEAAyE;AACzE,eAAO,MAAM,6BAA6B,6FACkD,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/components/error-state/error-state-styles.ts
|
|
3
|
+
var e = "w-full max-w-2xl text-left text-sm text-foreground/70", t = "cursor-pointer font-medium text-foreground", n = "mt-2 overflow-x-auto rounded-md border border-border bg-background p-3 font-mono text-xs";
|
|
4
|
+
//#endregion
|
|
5
|
+
export { n as ERROR_STATE_DETAIL_BODY_CLASS, e as ERROR_STATE_DETAIL_CLASS, t as ERROR_STATE_DETAIL_SUMMARY_CLASS };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/error-state/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from 'react';
|
|
2
|
+
import { FieldStatus } from '../field/field-config';
|
|
3
|
+
import { FileUploadConfig } from './file-upload-config';
|
|
4
|
+
type BaseFileUploadProps = FileUploadConfig & Omit<InputHTMLAttributes<HTMLInputElement>, "children" | "className" | "onChange" | "size" | "type" | "value">;
|
|
5
|
+
/**
|
|
6
|
+
* Props for the FileUpload component.
|
|
7
|
+
*/
|
|
8
|
+
export interface FileUploadProps extends BaseFileUploadProps {
|
|
9
|
+
/**
|
|
10
|
+
* Called with the files the reader chose, once the ones over the size limit
|
|
11
|
+
* have been left out. The field owns nothing: the consumer keeps the list and
|
|
12
|
+
* passes it back through `files`.
|
|
13
|
+
*/
|
|
14
|
+
onFilesSelected: (files: File[]) => void;
|
|
15
|
+
/**
|
|
16
|
+
* The files that have been chosen, which the field lists and can remove.
|
|
17
|
+
*/
|
|
18
|
+
files?: File[];
|
|
19
|
+
/**
|
|
20
|
+
* Called with the file the reader removed.
|
|
21
|
+
* Its presence is what draws a remove control beside each file.
|
|
22
|
+
*/
|
|
23
|
+
onRemove?: (file: File) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Largest file the field accepts, in bytes.
|
|
26
|
+
* A larger file is left out and reported here rather than being passed on to
|
|
27
|
+
* be rejected later.
|
|
28
|
+
*/
|
|
29
|
+
maxSize?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Label of the field.
|
|
32
|
+
*/
|
|
33
|
+
label?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Description shown under the label.
|
|
36
|
+
*/
|
|
37
|
+
description?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Message shown under the field.
|
|
40
|
+
*/
|
|
41
|
+
message?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Validation status of the field.
|
|
44
|
+
*
|
|
45
|
+
* @default "default"
|
|
46
|
+
*/
|
|
47
|
+
status?: FieldStatus;
|
|
48
|
+
/**
|
|
49
|
+
* Whether the field is unavailable.
|
|
50
|
+
*
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
isDisabled?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Whether the field must be filled in before the form is submitted.
|
|
56
|
+
*
|
|
57
|
+
* @default false
|
|
58
|
+
*/
|
|
59
|
+
required?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Extra classes for the field wrapper.
|
|
62
|
+
*/
|
|
63
|
+
className?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* A field that accepts files.
|
|
67
|
+
*
|
|
68
|
+
* The zone is a label for the field, so a pointer opens the picker, a keyboard
|
|
69
|
+
* reaches the field, and a screen reader reads the zone as the field's name.
|
|
70
|
+
* Files dropped on the zone take the same path as files chosen from the picker,
|
|
71
|
+
* which is what keeps the size limit from being skipped.
|
|
72
|
+
*
|
|
73
|
+
* The field owns nothing: it reports what was chosen and lists what the consumer
|
|
74
|
+
* passes back, which is what lets one component serve a plain form and a form
|
|
75
|
+
* library that owns the files.
|
|
76
|
+
*
|
|
77
|
+
* @param props - FileUpload configuration options and field attributes.
|
|
78
|
+
* @param props.onFilesSelected - Called with the accepted files.
|
|
79
|
+
* @param props.files - The files that have been chosen.
|
|
80
|
+
* @param props.onRemove - Called with the file the reader removed.
|
|
81
|
+
* @param props.maxSize - Largest accepted file, in bytes.
|
|
82
|
+
* @param props.accept - The kinds of file the picker offers.
|
|
83
|
+
* @param props.multiple - Whether more than one file may be chosen.
|
|
84
|
+
* @param props.label - Label of the field.
|
|
85
|
+
* @param props.description - Description under the label.
|
|
86
|
+
* @param props.message - Message under the field.
|
|
87
|
+
* @param props.status - Validation status. Defaults to "default".
|
|
88
|
+
* @param props.isDisabled - Whether the field is unavailable. Defaults to false.
|
|
89
|
+
* @param props.size - Density of the zone. Defaults to "md".
|
|
90
|
+
* @param props.buttonLabel - Name of the control. Defaults to "Choose files".
|
|
91
|
+
* @param props.hint - Instruction in the zone. Defaults to "Drag files here".
|
|
92
|
+
* @returns The rendered field.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```tsx
|
|
96
|
+
* <FileUpload
|
|
97
|
+
* label="Attachments"
|
|
98
|
+
* accept="application/pdf"
|
|
99
|
+
* multiple
|
|
100
|
+
* maxSize={5 * 1024 * 1024}
|
|
101
|
+
* files={files}
|
|
102
|
+
* onFilesSelected={(chosen) => setFiles((current) => [...current, ...chosen])}
|
|
103
|
+
* onRemove={(file) => setFiles((current) => current.filter((f) => f !== file))}
|
|
104
|
+
* />
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* @see Input - The text field, which shares the field contract.
|
|
108
|
+
* @see Chip - The token the field uses for a chosen file.
|
|
109
|
+
*/
|
|
110
|
+
export declare const FileUpload: import('react').ForwardRefExoticComponent<FileUploadProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
111
|
+
export {};
|
|
112
|
+
//# sourceMappingURL=FileUpload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileUpload.d.ts","sourceRoot":"","sources":["../../../src/components/file-upload/FileUpload.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAGL,KAAK,mBAAmB,EAIzB,MAAM,OAAO,CAAC;AAMf,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAY9B,KAAK,mBAAmB,GAAG,gBAAgB,GACzC,IAAI,CACF,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,UAAU,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAClE,CAAC;AAEJ;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,mBAAmB;IAC1D;;;;OAIG;IACH,eAAe,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IAEzC;;OAEG;IACH,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IAEf;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAEhC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,eAAO,MAAM,UAAU,8GAkKtB,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn as e } from "../../utils/cn.js";
|
|
4
|
+
import { useAsheeConfig as t } from "../../libs/context.js";
|
|
5
|
+
import { resolveConfigCascade as n } from "../../utils/resolve-token.js";
|
|
6
|
+
import { FieldShell as r } from "../field/FieldShell.js";
|
|
7
|
+
import { Chip as i } from "../chip/Chip.js";
|
|
8
|
+
import { describeRejectedFiles as a } from "./file-upload.helpers.js";
|
|
9
|
+
import { FALLBACK_FILE_UPLOAD_CONFIG as o } from "./file-upload-config.js";
|
|
10
|
+
import { FILE_UPLOAD_BUTTON_CLASS as s, FILE_UPLOAD_HINT_CLASS as c, FILE_UPLOAD_INPUT_CLASS as l, FILE_UPLOAD_SIZE_CLASS as u, FILE_UPLOAD_ZONE_CLASS as d } from "./file-upload-styles.js";
|
|
11
|
+
import { forwardRef as f, useId as p, useRef as m, useState as h } from "react";
|
|
12
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
13
|
+
//#region src/components/file-upload/FileUpload.tsx
|
|
14
|
+
var v = f(({ onFilesSelected: f, files: v, onRemove: y, maxSize: b, label: x, description: S, message: C, status: w, isDisabled: T, required: E, buttonLabel: D, hint: O, size: k, className: A, id: j, ...M }, N) => {
|
|
15
|
+
let P = t(), F = p(), I = j ?? F, L = n({
|
|
16
|
+
buttonLabel: D,
|
|
17
|
+
hint: O,
|
|
18
|
+
size: k
|
|
19
|
+
}, P.components?.fileupload, o), [R, z] = h(!1), [B, V] = h(""), H = m(null), U = (e) => {
|
|
20
|
+
H.current = e, typeof N == "function" ? N(e) : N && (N.current = e);
|
|
21
|
+
}, W = (e) => {
|
|
22
|
+
let t = Array.from(e ?? []);
|
|
23
|
+
if (t.length === 0) return;
|
|
24
|
+
let n = b === void 0 ? t : t.filter((e) => e.size <= b), r = t.length - n.length;
|
|
25
|
+
V(r === 0 ? "" : a(r, b ?? 0)), n.length > 0 && f(n);
|
|
26
|
+
}, G = (e) => {
|
|
27
|
+
e.preventDefault(), z(!1), !T && W(e.dataTransfer?.files ?? null);
|
|
28
|
+
}, K = () => {
|
|
29
|
+
W(H.current?.files ?? null);
|
|
30
|
+
}, q = C ?? B, J = C ? w ?? "default" : B ? "error" : "default", Y = e(d, u[L.size], R && "border-primary bg-primary/10", T && "cursor-not-allowed opacity-60 hover:border-border");
|
|
31
|
+
return /* @__PURE__ */ g("div", {
|
|
32
|
+
className: e("flex w-full min-w-0 flex-col", A),
|
|
33
|
+
children: /* @__PURE__ */ _(r, {
|
|
34
|
+
id: I,
|
|
35
|
+
label: x,
|
|
36
|
+
description: S,
|
|
37
|
+
message: q,
|
|
38
|
+
status: J,
|
|
39
|
+
required: E,
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ g("input", {
|
|
42
|
+
...M,
|
|
43
|
+
ref: U,
|
|
44
|
+
id: I,
|
|
45
|
+
type: "file",
|
|
46
|
+
className: l,
|
|
47
|
+
disabled: T,
|
|
48
|
+
onChange: K
|
|
49
|
+
}),
|
|
50
|
+
/* @__PURE__ */ g("label", {
|
|
51
|
+
htmlFor: I,
|
|
52
|
+
className: Y,
|
|
53
|
+
onDragOver: (e) => {
|
|
54
|
+
e.preventDefault(), T || z(!0);
|
|
55
|
+
},
|
|
56
|
+
onDragLeave: () => z(!1),
|
|
57
|
+
onDrop: G,
|
|
58
|
+
children: /* @__PURE__ */ _("span", {
|
|
59
|
+
className: "flex flex-wrap items-baseline justify-center gap-1 text-sm",
|
|
60
|
+
children: [/* @__PURE__ */ g("span", {
|
|
61
|
+
className: s,
|
|
62
|
+
children: L.buttonLabel
|
|
63
|
+
}), /* @__PURE__ */ _("span", {
|
|
64
|
+
className: c,
|
|
65
|
+
children: ["or ", L.hint.toLowerCase()]
|
|
66
|
+
})]
|
|
67
|
+
})
|
|
68
|
+
}),
|
|
69
|
+
v && v.length > 0 && /* @__PURE__ */ g("ul", {
|
|
70
|
+
className: "flex flex-wrap gap-2 pt-1",
|
|
71
|
+
children: v.map((e) => /* @__PURE__ */ g("li", { children: /* @__PURE__ */ g(i, {
|
|
72
|
+
closeLabel: `Remove ${e.name}`,
|
|
73
|
+
onClose: y ? () => y(e) : void 0,
|
|
74
|
+
children: e.name
|
|
75
|
+
}) }, `${e.name}-${e.lastModified}`))
|
|
76
|
+
})
|
|
77
|
+
]
|
|
78
|
+
})
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
v.displayName = "FileUpload";
|
|
82
|
+
//#endregion
|
|
83
|
+
export { v as FileUpload };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Size } from '../../shared';
|
|
2
|
+
/**
|
|
3
|
+
* Theme configuration options for the FileUpload component.
|
|
4
|
+
*
|
|
5
|
+
* Set under `components.fileupload` in the AsheeUI config. Values feed the
|
|
6
|
+
* component-level tier of the theme cascade.
|
|
7
|
+
*/
|
|
8
|
+
export interface FileUploadConfig {
|
|
9
|
+
/**
|
|
10
|
+
* Name of the control inside the drop zone.
|
|
11
|
+
*
|
|
12
|
+
* @default "Choose files"
|
|
13
|
+
*/
|
|
14
|
+
buttonLabel?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Instruction shown in the zone when nothing is being dragged over it.
|
|
17
|
+
*
|
|
18
|
+
* @default "Drag files here"
|
|
19
|
+
*/
|
|
20
|
+
hint?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Density of the zone.
|
|
23
|
+
*
|
|
24
|
+
* @default "md"
|
|
25
|
+
*/
|
|
26
|
+
size?: Size;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Default config values registered for the FileUpload component.
|
|
30
|
+
*/
|
|
31
|
+
export declare const defaultFileUploadConfig: FileUploadConfig;
|
|
32
|
+
declare module "../../libs/registry" {
|
|
33
|
+
interface ComponentTypeConfigRegistry {
|
|
34
|
+
fileupload: FileUploadConfig;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Hard fallback values used when no config tier provides a value.
|
|
39
|
+
*/
|
|
40
|
+
export declare const FALLBACK_FILE_UPLOAD_CONFIG: Required<FileUploadConfig>;
|
|
41
|
+
//# sourceMappingURL=file-upload-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-upload-config.d.ts","sourceRoot":"","sources":["../../../src/components/file-upload/file-upload-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;CACb;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBAIrC,CAAC;AAEF,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,2BAA2B;QACnC,UAAU,EAAE,gBAAgB,CAAC;KAC9B;CACF;AAID;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,gBAAgB,CAIlE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { registerComponentDefaults as e } from "../../libs/registry.js";
|
|
3
|
+
//#region src/components/file-upload/file-upload-config.ts
|
|
4
|
+
var t = {
|
|
5
|
+
buttonLabel: "Choose files",
|
|
6
|
+
hint: "Drag files here",
|
|
7
|
+
size: "md"
|
|
8
|
+
};
|
|
9
|
+
e("fileupload", t);
|
|
10
|
+
var n = {
|
|
11
|
+
buttonLabel: "Choose files",
|
|
12
|
+
hint: "Drag files here",
|
|
13
|
+
size: "md"
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { n as FALLBACK_FILE_UPLOAD_CONFIG, t as defaultFileUploadConfig };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Size } from '../../shared';
|
|
2
|
+
/**
|
|
3
|
+
* The drop zone, which is a label for the field it hides.
|
|
4
|
+
* Its focus ring follows the field, so the zone shows where the keyboard is even
|
|
5
|
+
* though the field itself is visually hidden.
|
|
6
|
+
*/
|
|
7
|
+
export declare const FILE_UPLOAD_ZONE_CLASS = "flex w-full min-w-0 cursor-pointer flex-col items-center justify-center gap-2 rounded-md border-2 border-dashed border-border bg-background text-center transition-colors hover:border-primary focus-within:ring-2 focus-within:ring-primary focus-within:ring-offset-2";
|
|
8
|
+
/** The zone while a file is dragged over it. */
|
|
9
|
+
export declare const FILE_UPLOAD_ZONE_ACTIVE_CLASS = "border-primary bg-primary/10";
|
|
10
|
+
/** The zone when the field is unavailable. */
|
|
11
|
+
export declare const FILE_UPLOAD_ZONE_DISABLED_CLASS = "cursor-not-allowed opacity-60 hover:border-border";
|
|
12
|
+
/** Padding for each density. */
|
|
13
|
+
export declare const FILE_UPLOAD_SIZE_CLASS: Record<Size, string>;
|
|
14
|
+
/** The control's label, styled as an emphasised part of the zone. */
|
|
15
|
+
export declare const FILE_UPLOAD_BUTTON_CLASS = "font-medium text-primary underline";
|
|
16
|
+
/** The instruction beside it. */
|
|
17
|
+
export declare const FILE_UPLOAD_HINT_CLASS = "text-sm text-foreground/60";
|
|
18
|
+
/** The field itself, which is present for the keyboard and the picker only. */
|
|
19
|
+
export declare const FILE_UPLOAD_INPUT_CLASS = "sr-only";
|
|
20
|
+
/** The list of chosen files. */
|
|
21
|
+
export declare const FILE_UPLOAD_LIST_CLASS = "flex flex-wrap gap-2 pt-1";
|
|
22
|
+
//# sourceMappingURL=file-upload-styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-upload-styles.d.ts","sourceRoot":"","sources":["../../../src/components/file-upload/file-upload-styles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,4QACwO,CAAC;AAE5Q,gDAAgD;AAChD,eAAO,MAAM,6BAA6B,iCAAiC,CAAC;AAE5E,8CAA8C;AAC9C,eAAO,MAAM,+BAA+B,sDACS,CAAC;AAEtD,gCAAgC;AAChC,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAIvD,CAAC;AAEF,qEAAqE;AACrE,eAAO,MAAM,wBAAwB,uCAAuC,CAAC;AAE7E,iCAAiC;AACjC,eAAO,MAAM,sBAAsB,+BAA+B,CAAC;AAEnE,+EAA+E;AAC/E,eAAO,MAAM,uBAAuB,YAAY,CAAC;AAEjD,gCAAgC;AAChC,eAAO,MAAM,sBAAsB,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/components/file-upload/file-upload-styles.ts
|
|
3
|
+
var e = "flex w-full min-w-0 cursor-pointer flex-col items-center justify-center gap-2 rounded-md border-2 border-dashed border-border bg-background text-center transition-colors hover:border-primary focus-within:ring-2 focus-within:ring-primary focus-within:ring-offset-2", t = "border-primary bg-primary/10", n = "cursor-not-allowed opacity-60 hover:border-border", r = {
|
|
4
|
+
sm: "px-4 py-6",
|
|
5
|
+
md: "px-6 py-10",
|
|
6
|
+
lg: "px-8 py-14"
|
|
7
|
+
}, i = "font-medium text-primary underline", a = "text-sm text-foreground/60", o = "sr-only", s = "flex flex-wrap gap-2 pt-1";
|
|
8
|
+
//#endregion
|
|
9
|
+
export { i as FILE_UPLOAD_BUTTON_CLASS, a as FILE_UPLOAD_HINT_CLASS, o as FILE_UPLOAD_INPUT_CLASS, s as FILE_UPLOAD_LIST_CLASS, r as FILE_UPLOAD_SIZE_CLASS, t as FILE_UPLOAD_ZONE_ACTIVE_CLASS, e as FILE_UPLOAD_ZONE_CLASS, n as FILE_UPLOAD_ZONE_DISABLED_CLASS };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FileUpload component helpers for AsheeUI.
|
|
3
|
+
* This file provides the small pure functions the file field needs: reporting a
|
|
4
|
+
* file size in the reader's terms and describing what the field rejected.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Describe a file size in the reader's terms.
|
|
8
|
+
*
|
|
9
|
+
* @param bytes - The size in bytes.
|
|
10
|
+
* @returns A short description, such as `1.5 MB`.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* formatFileSize(1536); // "1.5 KB"
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function formatFileSize(bytes: number): string;
|
|
18
|
+
/**
|
|
19
|
+
* Describe the files a size limit left out.
|
|
20
|
+
*
|
|
21
|
+
* @param count - How many files were left out.
|
|
22
|
+
* @param maxSize - The limit, in bytes.
|
|
23
|
+
* @returns A sentence naming the count and the limit.
|
|
24
|
+
*/
|
|
25
|
+
export declare function describeRejectedFiles(count: number, maxSize: number): string;
|
|
26
|
+
//# sourceMappingURL=file-upload.helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-upload.helpers.d.ts","sourceRoot":"","sources":["../../../src/components/file-upload/file-upload.helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAepD;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAI5E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/components/file-upload/file-upload.helpers.ts
|
|
3
|
+
function e(e) {
|
|
4
|
+
if (e < 1024) return `${e} B`;
|
|
5
|
+
let t = [
|
|
6
|
+
"KB",
|
|
7
|
+
"MB",
|
|
8
|
+
"GB"
|
|
9
|
+
], n = e / 1024, r = 0;
|
|
10
|
+
for (; n >= 1024 && r < t.length - 1;) n /= 1024, r += 1;
|
|
11
|
+
return `${Number(n.toFixed(1))} ${t[r]}`;
|
|
12
|
+
}
|
|
13
|
+
function t(t, n) {
|
|
14
|
+
return `${t === 1 ? "One file was" : `${t} files were`} larger than ${e(n)} and was not added.`;
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { t as describeRejectedFiles, e as formatFileSize };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/file-upload/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ElementType, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { LoadingStateConfig } from './loading-state-config';
|
|
3
|
+
type BaseLoadingStateProps = LoadingStateConfig & Omit<HTMLAttributes<HTMLDivElement>, "color">;
|
|
4
|
+
/**
|
|
5
|
+
* Props for the LoadingState component.
|
|
6
|
+
*/
|
|
7
|
+
export interface LoadingStateProps extends BaseLoadingStateProps {
|
|
8
|
+
/**
|
|
9
|
+
* Supporting sentence under the label, for example what is being fetched.
|
|
10
|
+
*/
|
|
11
|
+
description?: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Element that replaces the framework's spinner, for a progress bar or a
|
|
14
|
+
* consumer's own indicator.
|
|
15
|
+
*/
|
|
16
|
+
indicator?: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Element to render.
|
|
19
|
+
* Defaults to a `div`.
|
|
20
|
+
*
|
|
21
|
+
* @default "div"
|
|
22
|
+
*/
|
|
23
|
+
as?: ElementType;
|
|
24
|
+
/**
|
|
25
|
+
* Content below the label, for example a cancel control.
|
|
26
|
+
*/
|
|
27
|
+
children?: ReactNode;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A region whose content has not arrived yet.
|
|
31
|
+
*
|
|
32
|
+
* The state is a `status` region, so assistive technology is told that something
|
|
33
|
+
* is in progress rather than being left with a silent gap. It claims room by
|
|
34
|
+
* default, so the page does not jump when the content arrives, and it says what
|
|
35
|
+
* is loading rather than only that something is.
|
|
36
|
+
*
|
|
37
|
+
* @param props - LoadingState configuration options and element attributes.
|
|
38
|
+
* @param props.label - Text shown and announced. Defaults to "Loading".
|
|
39
|
+
* @param props.description - Supporting sentence.
|
|
40
|
+
* @param props.indicator - Element that replaces the framework's spinner.
|
|
41
|
+
* @param props.size - Density of the indicator and the padding. Defaults to "md".
|
|
42
|
+
* @param props.panel - Draw the state as a panel. Defaults to false.
|
|
43
|
+
* @param props.minHeight - Room the state claims. Defaults to "sm".
|
|
44
|
+
* @param props.as - Element to render. Defaults to "div".
|
|
45
|
+
* @returns The rendered state.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```tsx
|
|
49
|
+
* <LoadingState label="Loading invoices" description="This usually takes a moment." />
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @see Skeleton - The placeholder form, for content whose shape is known.
|
|
53
|
+
* @see EmptyState - The presentation for a region that has nothing in it.
|
|
54
|
+
*/
|
|
55
|
+
export declare const LoadingState: import('react').ForwardRefExoticComponent<LoadingStateProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=LoadingState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingState.d.ts","sourceRoot":"","sources":["../../../src/components/loading-state/LoadingState.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAOf,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,wBAAwB,CAAC;AAOhC,KAAK,qBAAqB,GAAG,kBAAkB,GAC7C,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,qBAAqB;IAC9D;;OAEG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IAExB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;;;OAKG;IACH,EAAE,CAAC,EAAE,WAAW,CAAC;IAEjB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,YAAY,8GAsDxB,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn as e } from "../../utils/cn.js";
|
|
4
|
+
import { SPACE_MIN_HEIGHT_CLASS as t } from "../../shared/spacing.js";
|
|
5
|
+
import { useAsheeConfig as n } from "../../libs/context.js";
|
|
6
|
+
import { resolveConfigCascade as r } from "../../utils/resolve-token.js";
|
|
7
|
+
import { Typography as i } from "../typography/Typography.js";
|
|
8
|
+
import { Spinner as a } from "../spinner/spinner.js";
|
|
9
|
+
import { FALLBACK_LOADING_STATE_CONFIG as o } from "./loading-state-config.js";
|
|
10
|
+
import { LOADING_STATE_CLASS as s, LOADING_STATE_SIZE_CLASS as c } from "./loading-state-styles.js";
|
|
11
|
+
import { forwardRef as l } from "react";
|
|
12
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
13
|
+
//#region src/components/loading-state/LoadingState.tsx
|
|
14
|
+
var f = l(({ as: l, label: f, description: p, indicator: m, size: h, panel: g, minHeight: _, className: v, children: y, ...b }, x) => {
|
|
15
|
+
let S = n(), C = r({
|
|
16
|
+
label: f,
|
|
17
|
+
size: h,
|
|
18
|
+
panel: g,
|
|
19
|
+
minHeight: _
|
|
20
|
+
}, S.components?.loadingstate, o);
|
|
21
|
+
return /* @__PURE__ */ d(l ?? "div", {
|
|
22
|
+
ref: x,
|
|
23
|
+
role: "status",
|
|
24
|
+
className: e(s, c[C.size], t[C.minHeight], C.panel && "rounded-md border border-border bg-background", v),
|
|
25
|
+
...b,
|
|
26
|
+
children: [
|
|
27
|
+
m ?? /* @__PURE__ */ u(a, { size: C.size }),
|
|
28
|
+
/* @__PURE__ */ u(i, {
|
|
29
|
+
role: "body-sm",
|
|
30
|
+
tone: "muted",
|
|
31
|
+
children: C.label
|
|
32
|
+
}),
|
|
33
|
+
p && /* @__PURE__ */ u(i, {
|
|
34
|
+
role: "caption",
|
|
35
|
+
tone: "muted",
|
|
36
|
+
children: p
|
|
37
|
+
}),
|
|
38
|
+
y
|
|
39
|
+
]
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
f.displayName = "LoadingState";
|
|
43
|
+
//#endregion
|
|
44
|
+
export { f as LoadingState };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/loading-state/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC"}
|