@speckle/ui-components 2.16.0 → 2.16.1-alpha10

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.
Files changed (35) hide show
  1. package/dist/AvatarEditor-594c4e0d.js +193 -0
  2. package/dist/AvatarEditor-594c4e0d.js.map +1 -0
  3. package/dist/AvatarEditor-92ea4e16.cjs +2 -0
  4. package/dist/AvatarEditor-92ea4e16.cjs.map +1 -0
  5. package/dist/components/common/loading/Icon.vue.d.ts +24 -0
  6. package/dist/components/form/Switch.vue.d.ts +6 -0
  7. package/dist/components/form/Tags.vue.d.ts +147 -0
  8. package/dist/components/form/TextArea.vue.d.ts +6 -0
  9. package/dist/components/form/TextInput.vue.d.ts +1 -1
  10. package/dist/components/form/file-upload/Zone.vue.d.ts +62 -0
  11. package/dist/components/form/select/Badges.vue.d.ts +64 -0
  12. package/dist/components/form/select/Base.vue.d.ts +375 -333
  13. package/dist/components/form/select/SourceApps.vue.d.ts +13 -0
  14. package/dist/components/form/tags/ContextManager.vue.d.ts +16 -0
  15. package/dist/components/layout/Table.vue.d.ts +68 -0
  16. package/dist/components/user/Avatar.vue.d.ts +59 -0
  17. package/dist/components/user/AvatarEditable.vue.d.ts +67 -0
  18. package/dist/components/user/AvatarEditor.vue.d.ts +26 -0
  19. package/dist/components/user/AvatarGroup.vue.d.ts +44 -0
  20. package/dist/composables/form/fileUpload.d.ts +63 -0
  21. package/dist/composables/form/textInput.d.ts +9 -5
  22. package/dist/composables/user/avatar.d.ts +19 -0
  23. package/dist/helpers/common/error.d.ts +28 -0
  24. package/dist/helpers/common/validation.d.ts +2 -0
  25. package/dist/helpers/form/file.d.ts +41 -0
  26. package/dist/lib.cjs +2 -1
  27. package/dist/lib.cjs.map +1 -0
  28. package/dist/lib.d.ts +14 -2
  29. package/dist/lib.js +2191 -1206
  30. package/dist/lib.js.map +1 -0
  31. package/dist/stories/helpers/avatar.d.ts +1 -0
  32. package/package.json +3 -2
  33. package/tailwind.config.cjs +11 -0
  34. package/tsconfig.json +1 -1
  35. package/vite.config.ts +6 -1
@@ -56,6 +56,12 @@ declare const _default: import("vue").DefineComponent<{
56
56
  type: PropType<Optional<SourceAppDefinition[]>>;
57
57
  default: undefined;
58
58
  };
59
+ clearable: {
60
+ type: BooleanConstructor;
61
+ };
62
+ help: {
63
+ type: StringConstructor;
64
+ };
59
65
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
60
66
  "update:modelValue": (v: ValueType) => void;
61
67
  }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
@@ -113,6 +119,12 @@ declare const _default: import("vue").DefineComponent<{
113
119
  type: PropType<Optional<SourceAppDefinition[]>>;
114
120
  default: undefined;
115
121
  };
122
+ clearable: {
123
+ type: BooleanConstructor;
124
+ };
125
+ help: {
126
+ type: StringConstructor;
127
+ };
116
128
  }>> & {
117
129
  "onUpdate:modelValue"?: ((v: ValueType) => any) | undefined;
118
130
  }, {
@@ -121,6 +133,7 @@ declare const _default: import("vue").DefineComponent<{
121
133
  modelValue: ValueType;
122
134
  multiple: boolean;
123
135
  showLabel: boolean;
136
+ clearable: boolean;
124
137
  items: Optional<SourceAppDefinition[]>;
125
138
  searchPlaceholder: string;
126
139
  selectorPlaceholder: Optional<string>;
@@ -0,0 +1,16 @@
1
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {
2
+ goUp: () => void;
3
+ goDown: () => void;
4
+ open: () => void;
5
+ close: () => void;
6
+ selectActive: () => void;
7
+ isOpen: () => boolean;
8
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>, {
9
+ default?(_: {}): any;
10
+ }>;
11
+ export default _default;
12
+ type __VLS_WithTemplateSlots<T, S> = T & {
13
+ new (): {
14
+ $slots: S;
15
+ };
16
+ };
@@ -0,0 +1,68 @@
1
+ import { ConcreteComponent } from 'vue';
2
+ export type TableColumn<I> = {
3
+ id: I;
4
+ header: string;
5
+ classes: string;
6
+ };
7
+ export interface RowButton<T = unknown> {
8
+ icon: ConcreteComponent;
9
+ label: string;
10
+ action: (item: T) => void;
11
+ class: string;
12
+ }
13
+ declare const _default: <T extends {
14
+ id: string;
15
+ }, C extends string>(__VLS_props: {
16
+ items: T[];
17
+ buttons?: RowButton<T>[] | undefined;
18
+ columns: TableColumn<C>[];
19
+ overflowCells?: boolean | undefined;
20
+ onRowClick?: ((item: T) => void) | undefined;
21
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, __VLS_ctx?: Pick<{
22
+ props: {
23
+ items: T[];
24
+ buttons?: RowButton<T>[] | undefined;
25
+ columns: TableColumn<C>[];
26
+ overflowCells?: boolean | undefined;
27
+ onRowClick?: ((item: T) => void) | undefined;
28
+ };
29
+ expose(exposed: {}): void;
30
+ attrs: any;
31
+ slots: Partial<Record<NonNullable<C>, (_: {
32
+ item: T;
33
+ }) => any>>;
34
+ emit: any;
35
+ }, "attrs" | "slots" | "emit"> | undefined, __VLS_setup?: Promise<{
36
+ props: {
37
+ items: T[];
38
+ buttons?: RowButton<T>[] | undefined;
39
+ columns: TableColumn<C>[];
40
+ overflowCells?: boolean | undefined;
41
+ onRowClick?: ((item: T) => void) | undefined;
42
+ };
43
+ expose(exposed: {}): void;
44
+ attrs: any;
45
+ slots: Partial<Record<NonNullable<C>, (_: {
46
+ item: T;
47
+ }) => any>>;
48
+ emit: any;
49
+ }>) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
50
+ [key: string]: any;
51
+ }> & {
52
+ __ctx?: {
53
+ props: {
54
+ items: T[];
55
+ buttons?: RowButton<T>[] | undefined;
56
+ columns: TableColumn<C>[];
57
+ overflowCells?: boolean | undefined;
58
+ onRowClick?: ((item: T) => void) | undefined;
59
+ };
60
+ expose(exposed: {}): void;
61
+ attrs: any;
62
+ slots: Partial<Record<NonNullable<C>, (_: {
63
+ item: T;
64
+ }) => any>>;
65
+ emit: any;
66
+ } | undefined;
67
+ };
68
+ export default _default;
@@ -0,0 +1,59 @@
1
+ import { AvatarUser, UserAvatarSize } from '../../composables/user/avatar';
2
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
3
+ size: {
4
+ type: import("vue").PropType<UserAvatarSize>;
5
+ default: string;
6
+ };
7
+ active: {
8
+ type: import("vue").PropType<boolean>;
9
+ };
10
+ user: {
11
+ type: import("vue").PropType<AvatarUser | null>;
12
+ default: null;
13
+ };
14
+ hoverEffect: {
15
+ type: import("vue").PropType<boolean>;
16
+ default: boolean;
17
+ };
18
+ noBorder: {
19
+ type: import("vue").PropType<boolean>;
20
+ };
21
+ noBg: {
22
+ type: import("vue").PropType<boolean>;
23
+ };
24
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
25
+ size: {
26
+ type: import("vue").PropType<UserAvatarSize>;
27
+ default: string;
28
+ };
29
+ active: {
30
+ type: import("vue").PropType<boolean>;
31
+ };
32
+ user: {
33
+ type: import("vue").PropType<AvatarUser | null>;
34
+ default: null;
35
+ };
36
+ hoverEffect: {
37
+ type: import("vue").PropType<boolean>;
38
+ default: boolean;
39
+ };
40
+ noBorder: {
41
+ type: import("vue").PropType<boolean>;
42
+ };
43
+ noBg: {
44
+ type: import("vue").PropType<boolean>;
45
+ };
46
+ }>>, {
47
+ size: UserAvatarSize;
48
+ user: AvatarUser | null;
49
+ hoverEffect: boolean;
50
+ }, {}>, {
51
+ default?(_: {}): any;
52
+ "absolute-anchor"?(_: {}): any;
53
+ }>;
54
+ export default _default;
55
+ type __VLS_WithTemplateSlots<T, S> = T & {
56
+ new (): {
57
+ $slots: S;
58
+ };
59
+ };
@@ -0,0 +1,67 @@
1
+ import { MaybeNullOrUndefined } from '@speckle/shared';
2
+ type ModelType = MaybeNullOrUndefined<string>;
3
+ declare const _default: import("vue").DefineComponent<{
4
+ editMode: import("vue").PropType<boolean>;
5
+ modelValue: {
6
+ type: import("vue").PropType<string | null>;
7
+ };
8
+ placeholder: {
9
+ type: import("vue").PropType<string>;
10
+ required: true;
11
+ };
12
+ name: {
13
+ type: import("vue").PropType<string>;
14
+ required: true;
15
+ };
16
+ rules: {
17
+ type: import("vue").PropType<string | Record<string, unknown> | import("vee-validate").GenericValidateFunction<ModelType> | import("vee-validate").GenericValidateFunction<ModelType>[] | {
18
+ validate(value: ModelType, options: Record<string, any>): Promise<ModelType>;
19
+ }>;
20
+ };
21
+ validateOnMount: {
22
+ type: import("vue").PropType<boolean>;
23
+ };
24
+ validateOnValueUpdate: {
25
+ type: import("vue").PropType<boolean>;
26
+ };
27
+ disabled: {
28
+ type: import("vue").PropType<boolean>;
29
+ };
30
+ }, {
31
+ open: () => boolean;
32
+ close: () => boolean;
33
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
34
+ save: (newUrl: ModelType) => void;
35
+ "update:modelValue": (value: ModelType) => void;
36
+ }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
37
+ editMode: import("vue").PropType<boolean>;
38
+ modelValue: {
39
+ type: import("vue").PropType<string | null>;
40
+ };
41
+ placeholder: {
42
+ type: import("vue").PropType<string>;
43
+ required: true;
44
+ };
45
+ name: {
46
+ type: import("vue").PropType<string>;
47
+ required: true;
48
+ };
49
+ rules: {
50
+ type: import("vue").PropType<string | Record<string, unknown> | import("vee-validate").GenericValidateFunction<ModelType> | import("vee-validate").GenericValidateFunction<ModelType>[] | {
51
+ validate(value: ModelType, options: Record<string, any>): Promise<ModelType>;
52
+ }>;
53
+ };
54
+ validateOnMount: {
55
+ type: import("vue").PropType<boolean>;
56
+ };
57
+ validateOnValueUpdate: {
58
+ type: import("vue").PropType<boolean>;
59
+ };
60
+ disabled: {
61
+ type: import("vue").PropType<boolean>;
62
+ };
63
+ }>> & {
64
+ "onUpdate:modelValue"?: ((value: ModelType) => any) | undefined;
65
+ onSave?: ((newUrl: ModelType) => any) | undefined;
66
+ }, {}, {}>;
67
+ export default _default;
@@ -0,0 +1,26 @@
1
+ import { Nullable } from '@speckle/shared';
2
+ import { AvatarUser } from '../../composables/user/avatar';
3
+ declare const _default: import("vue").DefineComponent<{
4
+ user: {
5
+ type: import("vue").PropType<AvatarUser>;
6
+ required: true;
7
+ };
8
+ disabled: {
9
+ type: import("vue").PropType<boolean>;
10
+ };
11
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
+ cancel: () => void;
13
+ save: (val: Nullable<string>) => void;
14
+ }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
15
+ user: {
16
+ type: import("vue").PropType<AvatarUser>;
17
+ required: true;
18
+ };
19
+ disabled: {
20
+ type: import("vue").PropType<boolean>;
21
+ };
22
+ }>> & {
23
+ onCancel?: (() => any) | undefined;
24
+ onSave?: ((val: Nullable<string>) => any) | undefined;
25
+ }, {}, {}>;
26
+ export default _default;
@@ -0,0 +1,44 @@
1
+ import { UserAvatarSize, AvatarUserWithId } from '../../composables/user/avatar';
2
+ declare const _default: import("vue").DefineComponent<{
3
+ size: {
4
+ type: import("vue").PropType<UserAvatarSize>;
5
+ default: string;
6
+ };
7
+ users: {
8
+ type: import("vue").PropType<AvatarUserWithId[]>;
9
+ required: true;
10
+ default: () => never[];
11
+ };
12
+ overlap: {
13
+ type: import("vue").PropType<boolean>;
14
+ default: boolean;
15
+ };
16
+ maxCount: {
17
+ type: import("vue").PropType<number>;
18
+ default: undefined;
19
+ };
20
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
21
+ size: {
22
+ type: import("vue").PropType<UserAvatarSize>;
23
+ default: string;
24
+ };
25
+ users: {
26
+ type: import("vue").PropType<AvatarUserWithId[]>;
27
+ required: true;
28
+ default: () => never[];
29
+ };
30
+ overlap: {
31
+ type: import("vue").PropType<boolean>;
32
+ default: boolean;
33
+ };
34
+ maxCount: {
35
+ type: import("vue").PropType<number>;
36
+ default: undefined;
37
+ };
38
+ }>>, {
39
+ size: UserAvatarSize;
40
+ users: AvatarUserWithId[];
41
+ overlap: boolean;
42
+ maxCount: number;
43
+ }, {}>;
44
+ export default _default;
@@ -0,0 +1,63 @@
1
+ import { MaybeRef } from '@vueuse/core';
2
+ import { MaybeNullOrUndefined, Nullable, Optional } from '@speckle/shared';
3
+ import { CSSProperties } from 'vue';
4
+ /**
5
+ * A file, as emitted out from FileUploadZone
6
+ */
7
+ export interface UploadableFileItem {
8
+ file: File;
9
+ error: Nullable<Error>;
10
+ /**
11
+ * You can use this ID to check for File equality
12
+ */
13
+ id: string;
14
+ }
15
+ export declare enum BlobUploadStatus {
16
+ Success = 1,
17
+ Failure = 2
18
+ }
19
+ export type BlobPostResultItem = {
20
+ blobId?: string;
21
+ fileName?: string;
22
+ fileSize?: number;
23
+ formKey: string;
24
+ /**
25
+ * Success = 1, Failure = 2
26
+ */
27
+ uploadStatus: number;
28
+ uploadError: string;
29
+ };
30
+ export interface UploadFileItem extends UploadableFileItem {
31
+ /**
32
+ * Progress between 0 and 100
33
+ */
34
+ progress: number;
35
+ /**
36
+ * When upload has finished this contains a BlobPostResultItem
37
+ */
38
+ result: Optional<BlobPostResultItem>;
39
+ /**
40
+ * When a blob gets assigned to a resource, it should count as in use, and this will
41
+ * prevent it from being deleted as junk
42
+ */
43
+ inUse?: boolean;
44
+ }
45
+ export declare function usePrepareUploadableFiles(params: {
46
+ disabled?: MaybeRef<Optional<boolean>>;
47
+ accept?: MaybeRef<Optional<string>>;
48
+ multiple?: MaybeRef<Optional<boolean>>;
49
+ countLimit?: MaybeRef<Optional<number>>;
50
+ sizeLimit: MaybeRef<number>;
51
+ }): {
52
+ /**
53
+ * Validate incoming files and build UploadableFileItem structs out of them
54
+ */
55
+ buildUploadableFiles: (files: File[]) => UploadableFileItem[] | undefined;
56
+ };
57
+ export declare function useFileUploadProgressCore(params: {
58
+ item: MaybeRef<MaybeNullOrUndefined<UploadFileItem>>;
59
+ }): {
60
+ errorMessage: import("vue").ComputedRef<string | null>;
61
+ progressBarClasses: import("vue").ComputedRef<string>;
62
+ progressBarStyle: import("vue").ComputedRef<CSSProperties>;
63
+ };
@@ -5,16 +5,16 @@ export type InputColor = 'page' | 'foundation';
5
5
  /**
6
6
  * Common setup for text input & textarea fields
7
7
  */
8
- export declare function useTextInputCore(params: {
8
+ export declare function useTextInputCore<V extends string | string[] = string>(params: {
9
9
  props: ToRefs<{
10
10
  name: string;
11
11
  help?: string;
12
12
  label?: string;
13
13
  showLabel?: boolean;
14
- rules?: RuleExpression<string>;
14
+ rules?: RuleExpression<V>;
15
15
  validateOnMount?: boolean;
16
16
  validateOnValueUpdate?: boolean;
17
- modelValue?: string;
17
+ modelValue?: V;
18
18
  autoFocus?: boolean;
19
19
  showClear?: boolean;
20
20
  useLabelInErrors?: boolean;
@@ -24,15 +24,19 @@ export declare function useTextInputCore(params: {
24
24
  emit: {
25
25
  (e: 'change', val: {
26
26
  event?: Event;
27
- value: string;
27
+ value: V;
28
28
  }): void;
29
29
  (e: 'clear'): void;
30
30
  };
31
31
  inputEl: Ref<Nullable<HTMLInputElement | HTMLTextAreaElement>>;
32
+ options?: Partial<{
33
+ customClear: () => void;
34
+ }>;
32
35
  }): {
36
+ coreInputClasses: import("vue").ComputedRef<string>;
33
37
  coreClasses: import("vue").ComputedRef<string>;
34
38
  title: import("vue").ComputedRef<string>;
35
- value: Ref<string>;
39
+ value: Ref<V>;
36
40
  helpTipId: import("vue").ComputedRef<string | undefined>;
37
41
  helpTipClasses: import("vue").ComputedRef<string>;
38
42
  helpTip: import("vue").ComputedRef<string | undefined>;
@@ -0,0 +1,19 @@
1
+ import { ToRefs } from 'vue';
2
+ export type AvatarUser = {
3
+ name: string;
4
+ avatar?: string | null;
5
+ };
6
+ export type AvatarUserWithId = AvatarUser & {
7
+ id: string;
8
+ };
9
+ export type UserAvatarSize = 'xs' | 'sm' | 'base' | 'lg' | 'xl' | 'editable';
10
+ export declare function useAvatarSizeClasses(params: {
11
+ props: ToRefs<{
12
+ size?: UserAvatarSize;
13
+ }>;
14
+ }): {
15
+ heightClasses: import("vue").ComputedRef<"h-6" | "h-10" | "h-14" | "h-8" | "h-5" | "h-60">;
16
+ widthClasses: import("vue").ComputedRef<"w-5" | "w-6" | "w-10" | "w-14" | "w-60" | "w-8">;
17
+ sizeClasses: import("vue").ComputedRef<string>;
18
+ iconClasses: import("vue").ComputedRef<"w-5 h-5" | "w-3 h-3" | "w-8 h-8" | "w-20 h-20" | "w-4 h-4">;
19
+ };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Base ObjectLoader error
3
+ */
4
+ export declare abstract class BaseError extends Error {
5
+ /**
6
+ * Default message if none is passed
7
+ */
8
+ static defaultMessage: string;
9
+ constructor(message?: string, options?: ErrorOptions);
10
+ }
11
+ /**
12
+ * Throw these in execution branches that should never occur unless if there's a bug
13
+ */
14
+ export declare class LogicError extends BaseError {
15
+ static defaultMessage: string;
16
+ }
17
+ export declare class UninitializedResourceAccessError extends BaseError {
18
+ static defaultMessage: string;
19
+ }
20
+ export declare class ComposableInvokedOutOfScopeError extends BaseError {
21
+ static defaultMessage: string;
22
+ }
23
+ /**
24
+ * Throw this when something that's only supported during CSR is invoked during SSR or vice versa
25
+ */
26
+ export declare class UnsupportedEnvironmentError extends BaseError {
27
+ static defaultMessage: string;
28
+ }
@@ -21,3 +21,5 @@ export declare const stringContains: (params: {
21
21
  match: string | RegExp;
22
22
  message: string;
23
23
  }) => GenericValidateFunction<string>;
24
+ export declare const isUrl: GenericValidateFunction<string>;
25
+ export declare const isItemSelected: GenericValidateFunction<unknown[]>;
@@ -0,0 +1,41 @@
1
+ import { Nullable } from '@speckle/shared';
2
+ import { BaseError } from '../../helpers/common/error';
3
+ export type FileTypeSpecifier = UniqueFileTypeSpecifier | `.${string}`;
4
+ export declare enum UniqueFileTypeSpecifier {
5
+ AnyAudio = "audio/*",
6
+ AnyVideo = "video/*",
7
+ AnyImage = "image/*"
8
+ }
9
+ /**
10
+ * Validate if file has the allowed type. While we could also test for MIME types
11
+ * not in UniqueFileTypeSpecifier, this function is meant to be equivalent to the
12
+ * 'accept' attribute, which only allows for extensions or UniqueFileTypeSpecifier
13
+ * values.
14
+ * @param file
15
+ * @param allowedTypes The file must have one of these types
16
+ * @returns True if valid, Error object if not
17
+ */
18
+ export declare function validateFileType(file: File, allowedTypes: FileTypeSpecifier[]): true | Error;
19
+ /**
20
+ * Resolve file extension (with leading dot)
21
+ */
22
+ export declare function resolveFileExtension(fileName: string): Nullable<FileTypeSpecifier>;
23
+ /**
24
+ * Check if string is a FileTypeSpecifier
25
+ */
26
+ export declare function isFileTypeSpecifier(type: string): type is FileTypeSpecifier;
27
+ /**
28
+ * Create a human readable file size string from the numeric size in bytes
29
+ */
30
+ export declare function prettyFileSize(sizeInBytes: number): string;
31
+ /**
32
+ * Generate an ID that uniquely identifies a specific file. The same file
33
+ * will always have the same ID.
34
+ */
35
+ export declare function generateFileId(file: File): string;
36
+ export declare class MissingFileExtensionError extends BaseError {
37
+ static defaultMessage: string;
38
+ }
39
+ export declare class ForbiddenFileTypeError extends BaseError {
40
+ static defaultMessage: string;
41
+ }