@ostack.tech/ui-kform 0.1.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/README.md +3 -0
- package/dist/ostack-ui-kform.cjs +7534 -0
- package/dist/ostack-ui-kform.cjs.map +1 -0
- package/dist/ostack-ui-kform.css +858 -0
- package/dist/ostack-ui-kform.css.map +1 -0
- package/dist/ostack-ui-kform.js +7518 -0
- package/dist/ostack-ui-kform.js.map +1 -0
- package/dist/types/components/Annexes/Annex.d.ts +46 -0
- package/dist/types/components/Annexes/AnnexTab.d.ts +5 -0
- package/dist/types/components/Annexes/Annexes.d.ts +95 -0
- package/dist/types/components/Annexes/AnnexesContext.d.ts +87 -0
- package/dist/types/components/Annexes/AnnexesManager.d.ts +47 -0
- package/dist/types/components/Annexes/AnnexesMenu.d.ts +10 -0
- package/dist/types/components/Annexes/AnnexesTabList.d.ts +8 -0
- package/dist/types/components/Annexes/index.d.ts +3 -0
- package/dist/types/components/CheckboxControl/CheckboxControl.d.ts +48 -0
- package/dist/types/components/CheckboxControl/index.d.ts +1 -0
- package/dist/types/components/CheckboxGroupControl/CheckboxGroupControl.d.ts +63 -0
- package/dist/types/components/CheckboxGroupControl/index.d.ts +1 -0
- package/dist/types/components/ControlField/ControlField.d.ts +50 -0
- package/dist/types/components/ControlField/ControlFieldContext.d.ts +33 -0
- package/dist/types/components/ControlField/index.d.ts +2 -0
- package/dist/types/components/DateControl/DateControl.d.ts +45 -0
- package/dist/types/components/DateControl/index.d.ts +1 -0
- package/dist/types/components/DateRangeControl/DateRangeControl.d.ts +79 -0
- package/dist/types/components/DateRangeControl/index.d.ts +1 -0
- package/dist/types/components/FileControl/FileControl.d.ts +68 -0
- package/dist/types/components/FileControl/index.d.ts +1 -0
- package/dist/types/components/FormApp/FormApp.d.ts +210 -0
- package/dist/types/components/FormApp/FormAppContext.d.ts +181 -0
- package/dist/types/components/FormApp/FormAppIssueMessages.d.ts +45 -0
- package/dist/types/components/FormApp/FormAppStatus.d.ts +23 -0
- package/dist/types/components/FormApp/index.d.ts +4 -0
- package/dist/types/components/FormPages/FormPage.d.ts +86 -0
- package/dist/types/components/FormPages/FormPageHeader.d.ts +7 -0
- package/dist/types/components/FormPages/FormPageSidebarItem.d.ts +6 -0
- package/dist/types/components/FormPages/FormPages.d.ts +40 -0
- package/dist/types/components/FormPages/FormPagesContext.d.ts +67 -0
- package/dist/types/components/FormPages/FormPagesNavigation.d.ts +12 -0
- package/dist/types/components/FormPages/FormPagesSelect.d.ts +7 -0
- package/dist/types/components/FormPages/FormPagesSelectOption.d.ts +6 -0
- package/dist/types/components/FormPages/FormPagesSidebar.d.ts +6 -0
- package/dist/types/components/FormPages/index.d.ts +3 -0
- package/dist/types/components/FormStepper/FormStep.d.ts +8 -0
- package/dist/types/components/FormStepper/FormStepContent.d.ts +20 -0
- package/dist/types/components/FormStepper/FormStepList.d.ts +7 -0
- package/dist/types/components/FormStepper/FormStepper.d.ts +71 -0
- package/dist/types/components/FormStepper/FormStepperContext.d.ts +65 -0
- package/dist/types/components/FormStepper/index.d.ts +3 -0
- package/dist/types/components/IssueAlert/IssueAlert.d.ts +13 -0
- package/dist/types/components/IssueAlert/index.d.ts +1 -0
- package/dist/types/components/IssueMessage/IssueMessage.d.ts +14 -0
- package/dist/types/components/IssueMessage/index.d.ts +1 -0
- package/dist/types/components/IssueMessages/IssueMessages.d.ts +70 -0
- package/dist/types/components/IssueMessages/index.d.ts +1 -0
- package/dist/types/components/IssuesPanel/IssuesPanel.d.ts +106 -0
- package/dist/types/components/IssuesPanel/IssuesPanelControls.d.ts +19 -0
- package/dist/types/components/IssuesPanel/IssuesPanelMessagesCard.d.ts +13 -0
- package/dist/types/components/IssuesPanel/IssuesPanelSummaryCard.d.ts +9 -0
- package/dist/types/components/IssuesPanel/index.d.ts +1 -0
- package/dist/types/components/IssuesPopover/IssuesPopover.d.ts +15 -0
- package/dist/types/components/IssuesPopover/index.d.ts +1 -0
- package/dist/types/components/LoadAction/LoadAction.d.ts +22 -0
- package/dist/types/components/LoadAction/index.d.ts +1 -0
- package/dist/types/components/NumericControl/NumericControl.d.ts +45 -0
- package/dist/types/components/NumericControl/index.d.ts +1 -0
- package/dist/types/components/PathLink/PathLink.d.ts +16 -0
- package/dist/types/components/PathLink/index.d.ts +1 -0
- package/dist/types/components/RadioGroupControl/RadioGroupControl.d.ts +56 -0
- package/dist/types/components/RadioGroupControl/index.d.ts +1 -0
- package/dist/types/components/SaveAction/SaveAction.d.ts +51 -0
- package/dist/types/components/SaveAction/index.d.ts +1 -0
- package/dist/types/components/SelectControl/SelectControl.d.ts +48 -0
- package/dist/types/components/SelectControl/index.d.ts +1 -0
- package/dist/types/components/SelectMultipleControl/SelectMultipleControl.d.ts +55 -0
- package/dist/types/components/SelectMultipleControl/index.d.ts +1 -0
- package/dist/types/components/SubmitAction/SubmitAction.d.ts +94 -0
- package/dist/types/components/SubmitAction/index.d.ts +1 -0
- package/dist/types/components/TableControl/TableControl.d.ts +64 -0
- package/dist/types/components/TableControl/TableControlAddRowTrigger.d.ts +25 -0
- package/dist/types/components/TableControl/TableControlApi.d.ts +25 -0
- package/dist/types/components/TableControl/TableControlCell.d.ts +7 -0
- package/dist/types/components/TableControl/TableControlColumn.d.ts +58 -0
- package/dist/types/components/TableControl/TableControlContent.d.ts +7 -0
- package/dist/types/components/TableControl/TableControlContext.d.ts +26 -0
- package/dist/types/components/TableControl/TableControlPagination.d.ts +2 -0
- package/dist/types/components/TableControl/TableControlRemoveRowTrigger.d.ts +61 -0
- package/dist/types/components/TableControl/TableControlRow.d.ts +7 -0
- package/dist/types/components/TableControl/TableControlRowsPerPage.d.ts +2 -0
- package/dist/types/components/TableControl/index.d.ts +8 -0
- package/dist/types/components/TextControl/TextControl.d.ts +66 -0
- package/dist/types/components/TextControl/index.d.ts +1 -0
- package/dist/types/components/TopBar/TopBar.d.ts +6 -0
- package/dist/types/components/TopBar/TopBarActions.d.ts +7 -0
- package/dist/types/components/TopBar/index.d.ts +2 -0
- package/dist/types/components/ValidateAction/ValidateAction.d.ts +21 -0
- package/dist/types/components/ValidateAction/index.d.ts +1 -0
- package/dist/types/index.d.ts +36 -0
- package/dist/types/locale/LocalizationObject.d.ts +34 -0
- package/dist/types/locale/defaultLocale.d.ts +3 -0
- package/dist/types/locale/en-GB.d.ts +3 -0
- package/dist/types/locale/en-US.d.ts +3 -0
- package/dist/types/locale/en.d.ts +3 -0
- package/dist/types/locale/fr-FR.d.ts +3 -0
- package/dist/types/locale/index.d.ts +6 -0
- package/dist/types/locale/pt-PT.d.ts +3 -0
- package/dist/types/providers/LocalizationProvider/LocalizationContext.d.ts +6 -0
- package/dist/types/providers/LocalizationProvider/LocalizationProvider.d.ts +10 -0
- package/dist/types/providers/LocalizationProvider/index.d.ts +3 -0
- package/dist/types/providers/LocalizationProvider/useLocale.d.ts +3 -0
- package/dist/types/providers/PrefixSuffixProvider/PrefixSuffixContext.d.ts +5 -0
- package/dist/types/providers/PrefixSuffixProvider/PrefixSuffixProvider.d.ts +9 -0
- package/dist/types/providers/PrefixSuffixProvider/index.d.ts +3 -0
- package/dist/types/providers/PrefixSuffixProvider/usePrefix.d.ts +6 -0
- package/dist/types/utils/dateRestrictions.d.ts +6 -0
- package/dist/types/utils/displayStatusConversions.d.ts +6 -0
- package/dist/types/utils/mostSpecificPath.d.ts +13 -0
- package/dist/types/utils/options.d.ts +18 -0
- package/dist/types/utils/pathSpecificity.d.ts +18 -0
- package/dist/types/utils/selectionTransformations.d.ts +32 -0
- package/dist/types/utils/useControlAutofocus.d.ts +32 -0
- package/dist/types/utils/useControlIssues.d.ts +27 -0
- package/dist/types/utils/useEqualityFn.d.ts +1 -0
- package/dist/types/utils/useFormLoader.d.ts +83 -0
- package/dist/types/utils/useFormSaver.d.ts +96 -0
- package/dist/types/utils/useFormValidator.d.ts +28 -0
- package/dist/types/utils/useRegisterControl.d.ts +24 -0
- package/dist/types/utils/useReportValidationFailures.d.ts +5 -0
- package/dist/types/utils/useTemporalStringTransformer.d.ts +21 -0
- package/package.json +70 -0
- package/scss/_utils.scss +6 -0
- package/scss/components/Annexes/_Annexes-variables.scss +17 -0
- package/scss/components/Annexes/_Annexes.scss +234 -0
- package/scss/components/FileControl/_FileControl.scss +52 -0
- package/scss/components/FormApp/_FormApp.scss +67 -0
- package/scss/components/FormPages/_FormPages-variables.scss +62 -0
- package/scss/components/FormPages/_FormPages.scss +288 -0
- package/scss/components/IssueMessages/_IssueMessages.scss +13 -0
- package/scss/components/IssuesPanel/_IssuesPanel-variables.scss +82 -0
- package/scss/components/IssuesPanel/_IssuesPanel.scss +196 -0
- package/scss/components/TableControl/_TableControl.scss +21 -0
- package/scss/components/TopBar/_TopBar.scss +52 -0
- package/scss/index.scss +11 -0
- package/scss/scss/_base-variables.scss +5 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { AbsolutePath } from "@ostack.tech/kform";
|
|
2
|
+
import { type FileSystemHandle, type WellKnownDirectory } from "browser-fs-access";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
/**
|
|
5
|
+
* Options that can be passed to the {@link useFormSaver} hook, or to its
|
|
6
|
+
* resulting `save`/`saveAs` functions.
|
|
7
|
+
*/
|
|
8
|
+
export interface FormSaverOptions<T = unknown> {
|
|
9
|
+
/**
|
|
10
|
+
* When set, if modern file system APIs are available and the form has been
|
|
11
|
+
* previously loaded or saved, then the file will be written over the
|
|
12
|
+
* previously saved/loaded file.
|
|
13
|
+
*
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
overwrite?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Function used to encode the form, given its value.
|
|
19
|
+
*
|
|
20
|
+
* Note that when returning a string, the string is converted into a `Blob`
|
|
21
|
+
* using the first provided mime type in `mimeTypes` as its type, _i.e._ it is
|
|
22
|
+
* converted as `new Blob([encodedValue], { type: mimeTypes?.[0] })`.
|
|
23
|
+
*
|
|
24
|
+
* @param formValue Value of the form.
|
|
25
|
+
* @returns Encoded form value as a string, blob, response, or a promise to
|
|
26
|
+
* either type.
|
|
27
|
+
*/
|
|
28
|
+
encode?: (formValue: T) => string | Blob | Response | PromiseLike<string | Blob | Response>;
|
|
29
|
+
/**
|
|
30
|
+
* Path of the value being saved.
|
|
31
|
+
*
|
|
32
|
+
* @default AbsolutePath.ROOT
|
|
33
|
+
*/
|
|
34
|
+
path?: string | AbsolutePath;
|
|
35
|
+
/**
|
|
36
|
+
* Suggested file name.
|
|
37
|
+
*
|
|
38
|
+
* A function may be provided which will be called with the form value right
|
|
39
|
+
* before invoking the save.
|
|
40
|
+
*/
|
|
41
|
+
fileName?: string | ((formValue: T) => string | PromiseLike<string>);
|
|
42
|
+
/** Acceptable file extensions. */
|
|
43
|
+
extensions?: string[];
|
|
44
|
+
/** Acceptable MIME types. */
|
|
45
|
+
mimeTypes?: string[];
|
|
46
|
+
/** Suggested file description. */
|
|
47
|
+
description?: string;
|
|
48
|
+
/** Directory to present when starting to save. */
|
|
49
|
+
startIn?: WellKnownDirectory | FileSystemHandle;
|
|
50
|
+
/** Excludes the "accept all" option. */
|
|
51
|
+
excludeAcceptAllOption?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* By specifying an ID, the user agent can remember different directories for
|
|
54
|
+
* different IDs.
|
|
55
|
+
*/
|
|
56
|
+
id?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Whether to set the form as pristine when saving.
|
|
59
|
+
*
|
|
60
|
+
* @default true
|
|
61
|
+
*/
|
|
62
|
+
setPristineOnSave?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Message to show in a toast when successfully saving the form to a file.
|
|
65
|
+
*
|
|
66
|
+
* @param fileHandle Handle to the saved file.
|
|
67
|
+
* @returns Message to show in a toast.
|
|
68
|
+
*/
|
|
69
|
+
successMessage?: (fileHandle: FileSystemFileHandle) => React.ReactNode;
|
|
70
|
+
/**
|
|
71
|
+
* Message to show in a toast when an error occurs while saving the form to a
|
|
72
|
+
* file.
|
|
73
|
+
*
|
|
74
|
+
* @param fileHandle Handle of the file over which the save was attempted, or
|
|
75
|
+
* `null` if no such file exists.
|
|
76
|
+
* @param error Error that occurred.
|
|
77
|
+
* @returns Message to show in a toast.
|
|
78
|
+
*/
|
|
79
|
+
errorMessage?: (fileHandle: FileSystemFileHandle | null, error: unknown) => React.ReactNode;
|
|
80
|
+
}
|
|
81
|
+
/** Result of the {@link useFormSaver} hook. */
|
|
82
|
+
export interface FormSaverResult<T> {
|
|
83
|
+
/**
|
|
84
|
+
* Function used to save the form.
|
|
85
|
+
*
|
|
86
|
+
* @param options Options used for saving the form.
|
|
87
|
+
* @returns Promise which resolves once the form has been saved.
|
|
88
|
+
*/
|
|
89
|
+
save: (options?: FormSaverOptions<T>) => Promise<void>;
|
|
90
|
+
/** Whether the browser supports modern file system APIs used for saving. */
|
|
91
|
+
supportsFileSystemAPIs: boolean;
|
|
92
|
+
}
|
|
93
|
+
/** Hook exposing functions used to save the form to a file. */
|
|
94
|
+
export declare function useFormSaver<T = unknown>({ overwrite, path, encode, fileName, extensions, description, mimeTypes, startIn, excludeAcceptAllOption, id, setPristineOnSave, successMessage, errorMessage, }?: FormSaverOptions<T>): FormSaverResult<T>;
|
|
95
|
+
/** Hook exposing whether the form is currently being saved. */
|
|
96
|
+
export declare function useFormIsSaving(): any;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Result of the {@link useFormValidator} hook. */
|
|
2
|
+
export interface FormValidatorResult {
|
|
3
|
+
/**
|
|
4
|
+
* Function used to validate the form.
|
|
5
|
+
*
|
|
6
|
+
* @returns Promise which resolves once the form has been validated.
|
|
7
|
+
*/
|
|
8
|
+
validate: () => Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
/** Hook exposing a function used to validate the form. */
|
|
11
|
+
export declare function useFormValidator(): FormValidatorResult;
|
|
12
|
+
/** Result of the {@link useFormIsValidating} hook. */
|
|
13
|
+
export interface FormIsValidatingResult {
|
|
14
|
+
/**
|
|
15
|
+
* Whether form is being validated automatically (due to validating mode being
|
|
16
|
+
* set to `"auto"`).
|
|
17
|
+
*/
|
|
18
|
+
validatingAutomatically: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Whether form is being validated manually (due to an explicit `validate`
|
|
21
|
+
* call).
|
|
22
|
+
*/
|
|
23
|
+
validatingManually: boolean;
|
|
24
|
+
/** Whether form is being validated (either automatically or manually). */
|
|
25
|
+
validating: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** Hook exposing whether the form is currently being validated. */
|
|
28
|
+
export declare function useFormIsValidating(): FormIsValidatingResult;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type DisplayStatus, type SealedValidationIssue } from "@ostack.tech/kform";
|
|
2
|
+
import { type Controller } from "@ostack.tech/kform-react";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
/** Options when registering the control. */
|
|
5
|
+
export interface UseRegisterControlOptions<T> {
|
|
6
|
+
controller: Controller<T>;
|
|
7
|
+
issuesPanelLabel?: React.ReactNode;
|
|
8
|
+
ariaLabel?: string;
|
|
9
|
+
issuesPanelLabelSuffix?: React.ReactNode;
|
|
10
|
+
preventAutoFocus?: boolean;
|
|
11
|
+
apiRef?: React.Ref<Controller<T> | undefined>;
|
|
12
|
+
}
|
|
13
|
+
/** Result of registering the control. */
|
|
14
|
+
export interface UseRegisterControlResult<TElem> {
|
|
15
|
+
displayLoading: boolean;
|
|
16
|
+
displayDisabled: boolean;
|
|
17
|
+
displayReadOnly: boolean;
|
|
18
|
+
displayStatusToDisplay: DisplayStatus | undefined;
|
|
19
|
+
issuesToDisplay: SealedValidationIssue[];
|
|
20
|
+
autofocusRef: React.MutableRefObject<TElem | null>;
|
|
21
|
+
handleFocus: (event: React.FocusEvent) => void;
|
|
22
|
+
}
|
|
23
|
+
/** Hook used to register a control within the form app. */
|
|
24
|
+
export declare function useRegisterControl<T, TElem extends HTMLElement = HTMLElement>({ controller, issuesPanelLabel, ariaLabel, issuesPanelLabelSuffix, preventAutoFocus, apiRef, }: UseRegisterControlOptions<T>): UseRegisterControlResult<TElem>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type LocatedValidationInfo } from "@ostack.tech/kform-react";
|
|
2
|
+
type ReportValidationFailuresInfo = Pick<LocatedValidationInfo, "path" | "issues">;
|
|
3
|
+
/** Hook used to report validation failures that occur. */
|
|
4
|
+
export declare function useReportValidationFailures(info?: ReportValidationFailuresInfo[]): void;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Schema } from "@ostack.tech/kform";
|
|
2
|
+
import { type Temporal } from "@ostack.tech/kform-react";
|
|
3
|
+
import { type DateFormatterOptions, type DateParserOptions, type DateTransformerOptions } from "@ostack.tech/ui";
|
|
4
|
+
/** Temporal string transformer. */
|
|
5
|
+
export interface TemporalStringTransformer {
|
|
6
|
+
/**
|
|
7
|
+
* Function used to parse a formatted date as exposed by a date input as a
|
|
8
|
+
* temporal string.
|
|
9
|
+
*/
|
|
10
|
+
parse: <T extends Temporal | null = Temporal | null>(formattedDate: string, schema: Schema<T>, options?: DateParserOptions) => string;
|
|
11
|
+
/**
|
|
12
|
+
* Function used to format a temporal string as a string accepted by a date
|
|
13
|
+
* input.
|
|
14
|
+
*/
|
|
15
|
+
format: <T extends Temporal | null = Temporal | null>(temporalString: string, schema: Schema<T>, options?: DateFormatterOptions) => string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Hook exposing functions to transform a temporal string value from/into a
|
|
19
|
+
* string representation of a date accepted by a date input.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useTemporalStringTransformer(dateTransformerOptions?: DateTransformerOptions): TemporalStringTransformer;
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ostack.tech/ui-kform",
|
|
3
|
+
"description": "Integration of ostack/UI with ostack/KForm.",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"homepage": "https://ui.ostack.tech/",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Opensoft",
|
|
8
|
+
"url": "https://opensoft.pt/en/"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://bitbucket.org/opensoftgitrepo/ostack-ui.git",
|
|
13
|
+
"directory": "packages/ui-kform/"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=10"
|
|
18
|
+
},
|
|
19
|
+
"main": "dist/ostack-ui-kform.cjs",
|
|
20
|
+
"types": "dist/types/index.d.ts",
|
|
21
|
+
"sass": "scss/index.scss",
|
|
22
|
+
"style": "dist/ostack-ui-kform.css",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./dist/types/index.d.ts",
|
|
26
|
+
"import": "./dist/ostack-ui-kform.js",
|
|
27
|
+
"require": "./dist/ostack-ui-kform.cjs"
|
|
28
|
+
},
|
|
29
|
+
"./css": "./dist/ostack-ui-kform.css",
|
|
30
|
+
"./scss": "./scss/index.scss",
|
|
31
|
+
"./scss/*": "./scss/*",
|
|
32
|
+
"./package.json": "./package.json"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist",
|
|
36
|
+
"scss"
|
|
37
|
+
],
|
|
38
|
+
"scripts": {
|
|
39
|
+
"clean": "rimraf dist scss",
|
|
40
|
+
"build": "npm run build:js && npm run build:css",
|
|
41
|
+
"build:js": "vite build && tsc -b tsconfig.build.json",
|
|
42
|
+
"build:css": "npm run copy-scss && sass -I ../../node_modules scss/index.scss dist/ostack-ui-kform.css",
|
|
43
|
+
"copy-scss": "cpy 'src/**/*.scss' '!src/**/*.stories.scss' scss"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"browser-fs-access": "^0.38.0"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"@fortawesome/fontawesome-svg-core": "^6.2.0 || ^7.0.0",
|
|
50
|
+
"@fortawesome/free-regular-svg-icons": "^6.2.0 || ^7.0.0",
|
|
51
|
+
"@fortawesome/free-solid-svg-icons": "^6.2.0 || ^7.0.0",
|
|
52
|
+
"@ostack.tech/kform": "~0.31.0",
|
|
53
|
+
"@ostack.tech/kform-react": "~0.31.0",
|
|
54
|
+
"@ostack.tech/ui": "~0.1.0",
|
|
55
|
+
"@types/react": "^18.0.0 || ^19.0.0",
|
|
56
|
+
"@types/react-dom": "^18.0.0 || ^19.0.0",
|
|
57
|
+
"date-fns": "^4.1.0",
|
|
58
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
59
|
+
"react-dom": "^18.0.0 || ^19.0.0",
|
|
60
|
+
"zustand": "^5.0.0"
|
|
61
|
+
},
|
|
62
|
+
"peerDependenciesMeta": {
|
|
63
|
+
"@types/react": {
|
|
64
|
+
"optional": true
|
|
65
|
+
},
|
|
66
|
+
"@types/react-dom": {
|
|
67
|
+
"optional": true
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
package/scss/_utils.scss
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@use "@ostack.tech/ui/scss/utils" as ostack-ui;
|
|
2
|
+
|
|
3
|
+
// Manager
|
|
4
|
+
$annexes-manager-min-width: 200px !default;
|
|
5
|
+
|
|
6
|
+
// Tab issues
|
|
7
|
+
$annexes-tab-issues-popover-button-icon-border-width: 1px !default;
|
|
8
|
+
$annexes-tab-issues-popover-button-padding: calc(
|
|
9
|
+
(
|
|
10
|
+
(
|
|
11
|
+
ostack-ui.$icon-button-md-min-size -
|
|
12
|
+
ostack-ui.$icon-button-md-font-size -
|
|
13
|
+
$annexes-tab-issues-popover-button-icon-border-width * 2
|
|
14
|
+
) /
|
|
15
|
+
2
|
|
16
|
+
)
|
|
17
|
+
);
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
@use "sass:color";
|
|
2
|
+
@use "@ostack.tech/ui/scss/utils" as ostack-ui;
|
|
3
|
+
@use "Annexes-variables" as *;
|
|
4
|
+
@use "../../scss/base-variables" as *;
|
|
5
|
+
|
|
6
|
+
.#{$prefix}annexes {
|
|
7
|
+
$tab-height: 44px;
|
|
8
|
+
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
|
|
12
|
+
&__manager {
|
|
13
|
+
min-width: $annexes-manager-min-width;
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: flex-end;
|
|
16
|
+
flex: 1 1 auto;
|
|
17
|
+
|
|
18
|
+
&:not(:last-child) {
|
|
19
|
+
margin-right: ostack-ui.spacing(2);
|
|
20
|
+
|
|
21
|
+
@include ostack-ui.media-breakpoint-up(sm) {
|
|
22
|
+
margin-right: ostack-ui.spacing(4);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&__menu-container {
|
|
28
|
+
margin-bottom: ostack-ui.$tabs-tab-list-annexes-margin-bottom;
|
|
29
|
+
padding-right: ostack-ui.spacing(2);
|
|
30
|
+
box-shadow: ostack-ui.$tabs-tab-list-annexes-box-shadow;
|
|
31
|
+
|
|
32
|
+
@include ostack-ui.media-breakpoint-up(sm) {
|
|
33
|
+
padding-right: ostack-ui.spacing(4);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&__issues-popover-container {
|
|
38
|
+
margin-left: ostack-ui.spacing(-4);
|
|
39
|
+
margin-right: ostack-ui.spacing(7);
|
|
40
|
+
padding-top: ostack-ui.spacing(0.5);
|
|
41
|
+
height: $tab-height;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&__tab-list-container {
|
|
45
|
+
flex: 1;
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&__menu-trigger {
|
|
50
|
+
height: $tab-height;
|
|
51
|
+
border-bottom-left-radius: 0;
|
|
52
|
+
border-bottom-right-radius: 0;
|
|
53
|
+
color: var(--#{ostack-ui.$prefix}primary-9) !important;
|
|
54
|
+
|
|
55
|
+
&[data-state="open"] {
|
|
56
|
+
border-color: ostack-ui.$neutral-7;
|
|
57
|
+
border-bottom-color: transparent;
|
|
58
|
+
background-color: var(--#{ostack-ui.$prefix}background-color) !important;
|
|
59
|
+
position: relative;
|
|
60
|
+
z-index: ostack-ui.$z-index-dropdown + 1;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&__menu {
|
|
65
|
+
width: 270px;
|
|
66
|
+
|
|
67
|
+
&[data-align="start"][data-side="bottom"] {
|
|
68
|
+
border-top-left-radius: 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&[data-align="start"][data-side="top"] {
|
|
72
|
+
border-bottom-left-radius: 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@include ostack-ui.media-breakpoint-down(sm) {
|
|
76
|
+
min-width: 100vw;
|
|
77
|
+
margin-left: -5px; // XXX: Override Radix's hard-coded collision margin
|
|
78
|
+
border-radius: 0;
|
|
79
|
+
border-right-width: 0;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&__menu-annex[data-status] {
|
|
84
|
+
position: relative;
|
|
85
|
+
|
|
86
|
+
&::after {
|
|
87
|
+
content: "";
|
|
88
|
+
position: absolute;
|
|
89
|
+
top: 0;
|
|
90
|
+
left: calc(
|
|
91
|
+
(ostack-ui.$menu-padding-x + ostack-ui.$menu-item-margin-x) * -1
|
|
92
|
+
);
|
|
93
|
+
height: 100%;
|
|
94
|
+
width: 3px;
|
|
95
|
+
border-radius: 0 var(--#{ostack-ui.$prefix}border-radius-sm)
|
|
96
|
+
var(--#{ostack-ui.$prefix}border-radius-sm) 0;
|
|
97
|
+
background-color: var(--#{ostack-ui.$prefix}accent-9);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&__menu-annex-action {
|
|
102
|
+
position: relative;
|
|
103
|
+
min-height: 40px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&__menu-annex-content {
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: space-between;
|
|
110
|
+
width: 100%;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&__menu-annex-content-container {
|
|
114
|
+
overflow: hidden;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&__menu-annex-title {
|
|
118
|
+
font-weight: ostack-ui.$font-weight-bold;
|
|
119
|
+
overflow: hidden;
|
|
120
|
+
text-overflow: ellipsis;
|
|
121
|
+
white-space: nowrap;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&__menu-annex-subtitle {
|
|
125
|
+
margin-left: ostack-ui.spacing(2);
|
|
126
|
+
font-weight: ostack-ui.$font-weight-normal;
|
|
127
|
+
font-size: ostack-ui.$font-size-xs;
|
|
128
|
+
line-height: ostack-ui.$font-size-xs;
|
|
129
|
+
text-transform: none;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
&__menu-annex-description {
|
|
133
|
+
font-weight: ostack-ui.$font-weight-normal;
|
|
134
|
+
text-transform: none;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&__menu-annex-remove {
|
|
138
|
+
margin-left: ostack-ui.spacing(2);
|
|
139
|
+
$min-size: 28px;
|
|
140
|
+
min-height: $min-size;
|
|
141
|
+
min-width: $min-size;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&__menu-new-annex-content {
|
|
145
|
+
display: flex;
|
|
146
|
+
width: 100%;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&__menu-new-annex-title {
|
|
150
|
+
flex: 1;
|
|
151
|
+
font-weight: ostack-ui.$font-weight-bold;
|
|
152
|
+
color: ostack-ui.$primary-9;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
&__menu-new-annex-description {
|
|
156
|
+
flex: 2;
|
|
157
|
+
margin-left: ostack-ui.spacing(2);
|
|
158
|
+
font-weight: ostack-ui.$font-weight-normal;
|
|
159
|
+
text-transform: none;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
&__tab-inner {
|
|
163
|
+
flex-direction: column;
|
|
164
|
+
height: 100%;
|
|
165
|
+
min-height: $tab-height;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
&__tab-title,
|
|
169
|
+
&__tab-subtitle {
|
|
170
|
+
display: block;
|
|
171
|
+
max-width: 100%;
|
|
172
|
+
overflow: hidden;
|
|
173
|
+
text-overflow: ellipsis;
|
|
174
|
+
white-space: nowrap;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
&__tab-subtitle {
|
|
178
|
+
font-weight: ostack-ui.$font-weight-normal;
|
|
179
|
+
font-size: ostack-ui.$font-size-xs;
|
|
180
|
+
line-height: ostack-ui.$line-height-xs;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Tab issues
|
|
184
|
+
&__tab[data-has-issues] &__tab-inner {
|
|
185
|
+
padding-right: calc(
|
|
186
|
+
ostack-ui.$tabs-tab-inner-annexes-padding-x * 2 +
|
|
187
|
+
ostack-ui.$icon-button-md-font-size +
|
|
188
|
+
$annexes-tab-issues-popover-button-padding
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
&__tab-issues-popover-button-container {
|
|
193
|
+
z-index: calc(ostack-ui.$tabs-tab-focus-z-index + 1);
|
|
194
|
+
margin-left: calc(
|
|
195
|
+
ostack-ui.$icon-button-md-min-size *
|
|
196
|
+
-1 - var(--#{ostack-ui.$prefix}tabs-tab-list-gap-x) -
|
|
197
|
+
$annexes-tab-issues-popover-button-padding / 2
|
|
198
|
+
);
|
|
199
|
+
padding-right: calc(
|
|
200
|
+
var(--#{ostack-ui.$prefix}tabs-tab-list-gap-x) +
|
|
201
|
+
$annexes-tab-issues-popover-button-padding / 2
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
&__tab-issues-popover-button .#{ostack-ui.$prefix}icon {
|
|
206
|
+
// Border around the icon
|
|
207
|
+
filter: drop-shadow(
|
|
208
|
+
/* Top */ 0
|
|
209
|
+
calc($annexes-tab-issues-popover-button-icon-border-width * -1) 0
|
|
210
|
+
var(--#{ostack-ui.$prefix}background-color)
|
|
211
|
+
)
|
|
212
|
+
drop-shadow(
|
|
213
|
+
/* Right */ $annexes-tab-issues-popover-button-icon-border-width 0 0
|
|
214
|
+
var(--#{ostack-ui.$prefix}background-color)
|
|
215
|
+
)
|
|
216
|
+
drop-shadow(
|
|
217
|
+
/* Bottom */ 0 $annexes-tab-issues-popover-button-icon-border-width 0
|
|
218
|
+
var(--#{ostack-ui.$prefix}background-color)
|
|
219
|
+
)
|
|
220
|
+
drop-shadow(
|
|
221
|
+
/* Left */
|
|
222
|
+
calc($annexes-tab-issues-popover-button-icon-border-width * -1) 0 0
|
|
223
|
+
var(--#{ostack-ui.$prefix}background-color)
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
&__annex {
|
|
228
|
+
min-height: calc(
|
|
229
|
+
var(--#{$prefix}form-app-min-height) - var(
|
|
230
|
+
--#{$prefix}top-bar-height
|
|
231
|
+
) - var(--#{$prefix}bottom-panel-height)
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
@use "sass:map";
|
|
2
|
+
@use "@ostack.tech/ui/scss/utils" as ostack-ui;
|
|
3
|
+
@use "../../scss/base-variables" as *;
|
|
4
|
+
|
|
5
|
+
.#{$prefix}file-control {
|
|
6
|
+
&__viewer-dialog {
|
|
7
|
+
width: fit-content;
|
|
8
|
+
min-width: 0;
|
|
9
|
+
max-width: min(
|
|
10
|
+
calc(100dvw - ostack-ui.spacing(14)),
|
|
11
|
+
ostack-ui.$dialog-xl-width
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&__viewer-download {
|
|
16
|
+
margin-left: ostack-ui.spacing(4);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&__viewer-dialog-title {
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
text-overflow: ellipsis;
|
|
22
|
+
white-space: nowrap;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&__viewer-dialog-body {
|
|
26
|
+
padding: 0 !important;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&__viewer-object {
|
|
30
|
+
$max-height: calc(100dvh - 50px - 64px);
|
|
31
|
+
|
|
32
|
+
display: flex;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
max-width: 100%;
|
|
35
|
+
width: auto;
|
|
36
|
+
max-height: $max-height;
|
|
37
|
+
margin: 0 auto;
|
|
38
|
+
|
|
39
|
+
border-bottom-left-radius: var(--#{ostack-ui.$prefix}border-radius-xs);
|
|
40
|
+
border-bottom-right-radius: var(--#{ostack-ui.$prefix}border-radius-xs);
|
|
41
|
+
background-color: var(--#{ostack-ui.$prefix}background-color);
|
|
42
|
+
|
|
43
|
+
&:not([type^="image/"]):not([type^="video/"]):not([type^="audio/"]) {
|
|
44
|
+
width: 100vw;
|
|
45
|
+
height: $max-height;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&__viewer-fallback {
|
|
50
|
+
margin: ostack-ui.spacing(3) ostack-ui.spacing(4);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
@use "@ostack.tech/ui/scss/utils" as ostack-ui;
|
|
2
|
+
@use "@ostack.tech/ui/scss/components/Spinner/Spinner";
|
|
3
|
+
@use "../../scss/base-variables" as *;
|
|
4
|
+
|
|
5
|
+
.#{$prefix}form-app {
|
|
6
|
+
$overlay: ".#{ostack-ui.$prefix}overlay";
|
|
7
|
+
|
|
8
|
+
$default-min-height: 100dvh;
|
|
9
|
+
|
|
10
|
+
position: relative;
|
|
11
|
+
min-height: var(--#{$prefix}form-app-min-height);
|
|
12
|
+
margin-bottom: 0; // Remove default `form` margin
|
|
13
|
+
background-color: var(--#{ostack-ui.$prefix}background-color);
|
|
14
|
+
|
|
15
|
+
@include ostack-ui.responsive-values(
|
|
16
|
+
--#{$prefix}form-app,
|
|
17
|
+
(
|
|
18
|
+
min-height: $default-min-height,
|
|
19
|
+
)
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
// Focus style around form
|
|
23
|
+
&:focus-visible {
|
|
24
|
+
outline: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&::after {
|
|
28
|
+
content: "";
|
|
29
|
+
position: absolute;
|
|
30
|
+
pointer-events: none;
|
|
31
|
+
z-index: ostack-ui.$z-index-overlay;
|
|
32
|
+
|
|
33
|
+
@include ostack-ui.accessible-transition(outline-color);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&:focus-visible::after {
|
|
37
|
+
top: 0;
|
|
38
|
+
left: 0;
|
|
39
|
+
width: 100%;
|
|
40
|
+
height: 100%;
|
|
41
|
+
outline: 2px solid ostack-ui.$primary-8;
|
|
42
|
+
outline-offset: -3px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// When the form app is within an overlay (e.g. being rendered as a dialog),
|
|
46
|
+
// we default the min-height to auto
|
|
47
|
+
#{$overlay} & {
|
|
48
|
+
@include ostack-ui.declare-var(--#{$prefix}form-app-min-height, auto);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Manually set this class on the form app's container to display a spinner
|
|
52
|
+
// while the app is loading
|
|
53
|
+
&__container:empty {
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
justify-content: center;
|
|
57
|
+
padding: ostack-ui.spacing(30) ostack-ui.spacing(10);
|
|
58
|
+
|
|
59
|
+
&::after {
|
|
60
|
+
content: "";
|
|
61
|
+
color: ostack-ui.$primary-9;
|
|
62
|
+
font-size: ostack-ui.$font-size-6xl;
|
|
63
|
+
|
|
64
|
+
@include ostack-ui.spinner;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
@use "@ostack.tech/ui/scss/utils" as ostack-ui;
|
|
2
|
+
|
|
3
|
+
// Sidebar
|
|
4
|
+
$form-pages-sidebar-width: 220px !default;
|
|
5
|
+
$form-pages-sidebar-width-xl: 300px !default;
|
|
6
|
+
$form-pages-sidebar-border-radius: null !default;
|
|
7
|
+
$form-pages-sidebar-background-color: var(
|
|
8
|
+
--#{ostack-ui.$prefix}primary-a3
|
|
9
|
+
) !default;
|
|
10
|
+
$form-pages-sidebar-border-width: 1px !default;
|
|
11
|
+
$form-pages-sidebar-border-color: var(--#{ostack-ui.$prefix}primary-4) !default;
|
|
12
|
+
$form-pages-sidebar-z-index: calc(
|
|
13
|
+
var(--#{ostack-ui.$prefix}z-index-sticky) + 1
|
|
14
|
+
) !default;
|
|
15
|
+
|
|
16
|
+
// Sidebar item code
|
|
17
|
+
$form-pages-sidebar-item-code-min-size: 20px;
|
|
18
|
+
$form-pages-sidebar-item-code-margin-x: ostack-ui.spacing(2) !default;
|
|
19
|
+
$form-pages-sidebar-item-code-padding: ostack-ui.spacing(0.5) !default;
|
|
20
|
+
$form-pages-sidebar-item-code-padding: ostack-ui.spacing(0.5) !default;
|
|
21
|
+
$form-pages-sidebar-item-code-border-radius: ostack-ui.$control-code-border-radius !default;
|
|
22
|
+
$form-pages-sidebar-item-code-font-size: var(
|
|
23
|
+
--#{ostack-ui.$prefix}font-size-xs
|
|
24
|
+
) !default;
|
|
25
|
+
$form-pages-sidebar-item-code-line-height: var(
|
|
26
|
+
--#{ostack-ui.$prefix}line-height-xs
|
|
27
|
+
) !default;
|
|
28
|
+
$form-pages-sidebar-item-code-font-weight: ostack-ui.$font-weight-bold !default;
|
|
29
|
+
$form-pages-sidebar-item-code-background-color: var(
|
|
30
|
+
--#{ostack-ui.$prefix}primary-2
|
|
31
|
+
) !default;
|
|
32
|
+
$form-pages-sidebar-item-code-color: var(
|
|
33
|
+
--#{ostack-ui.$prefix}primary-9
|
|
34
|
+
) !default;
|
|
35
|
+
|
|
36
|
+
// Sidebar item code - Selected
|
|
37
|
+
$form-pages-sidebar-item-code-selected-background-color: rgba(
|
|
38
|
+
255,
|
|
39
|
+
255,
|
|
40
|
+
255,
|
|
41
|
+
0.25
|
|
42
|
+
) !default;
|
|
43
|
+
$form-pages-sidebar-item-code-selected-color: var(
|
|
44
|
+
--#{ostack-ui.$prefix}primary-contrast
|
|
45
|
+
) !default;
|
|
46
|
+
|
|
47
|
+
// Sidebar item code - Status
|
|
48
|
+
$form-pages-sidebar-item-code-status-background-color: var(
|
|
49
|
+
--#{ostack-ui.$prefix}accent-9
|
|
50
|
+
) !default;
|
|
51
|
+
$form-pages-sidebar-item-code-status-color: var(
|
|
52
|
+
--#{ostack-ui.$prefix}accent-contrast
|
|
53
|
+
) !default;
|
|
54
|
+
|
|
55
|
+
// Select
|
|
56
|
+
$form-pages-select-z-index: calc(
|
|
57
|
+
var(--#{ostack-ui.$prefix}z-index-sticky) + 2
|
|
58
|
+
) !default;
|
|
59
|
+
$form-pages-select-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15) !default;
|
|
60
|
+
$form-pages-select-menu-background-color: var(
|
|
61
|
+
--#{ostack-ui.$prefix}primary-2
|
|
62
|
+
) !default;
|