@datacrest/dcuikit 1.0.1 → 1.0.3

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 (28) hide show
  1. package/build/components/Atom/Input/Input.types.d.ts +1 -1
  2. package/build/components/Atom/TextArea/TextArea.d.ts +4 -0
  3. package/build/components/Atom/TextArea/TextArea.stories.d.ts +5 -0
  4. package/build/components/Atom/TextArea/TextArea.test.d.ts +1 -0
  5. package/build/components/Atom/TextArea/index.d.ts +3 -0
  6. package/build/components/Atom/TextArea/types.d.ts +25 -0
  7. package/build/components/Atom/TextArea/utils.d.ts +26 -0
  8. package/build/components/Molecule/AlertDialog/AlertDialog.d.ts +1 -1
  9. package/build/components/Molecule/AlertDialog/AlertDialog.stories.d.ts +1 -1
  10. package/build/components/Molecule/AlertDialog/index.d.ts +2 -0
  11. package/build/components/Molecule/AlertDialog/types.d.ts +5 -2
  12. package/build/components/Molecule/FileUploader/FileUploader.d.ts +4 -0
  13. package/build/components/Molecule/FileUploader/FileUploader.stories.d.ts +5 -0
  14. package/build/components/Molecule/FileUploader/FileUploader.test.d.ts +1 -0
  15. package/build/components/Molecule/FileUploader/const.d.ts +19 -0
  16. package/build/components/Molecule/FileUploader/index.d.ts +4 -0
  17. package/build/components/Molecule/FileUploader/types.d.ts +32 -0
  18. package/build/components/Molecule/FileUploader/utils.d.ts +4 -0
  19. package/build/index.css +1 -1
  20. package/build/index.d.ts +2 -0
  21. package/build/index.esm.css +1 -1
  22. package/build/index.esm.js +9 -9
  23. package/build/index.esm.js.map +1 -1
  24. package/build/index.js +7 -7
  25. package/build/index.js.map +1 -1
  26. package/build/tsconfig.prod.tsbuildinfo +1 -1
  27. package/build/tsconfig.tsbuildinfo +1 -1
  28. package/package.json +2 -1
@@ -6,7 +6,7 @@ export type HintStateKeys = ['color', 'borderColor', 'placeholderColor'];
6
6
  export type InputSizeKeys = ['fontSize', 'lineHeight', 'spacing'];
7
7
  export type InputStateKeys = ['color', 'borderColor'];
8
8
  export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement>, Record<string, any> {
9
- label: string;
9
+ label?: string;
10
10
  fluid?: boolean;
11
11
  inputSize?: InputSizes[number];
12
12
  success?: StateProps;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { TextAreaProps } from './types';
3
+ declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
4
+ export default TextArea;
@@ -0,0 +1,5 @@
1
+ import { Meta } from '@storybook/react';
2
+ import { TextAreaProps } from './types';
3
+ declare const _default: Meta;
4
+ export default _default;
5
+ export declare const TextArea: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, TextAreaProps>;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,3 @@
1
+ import TextArea from './TextArea';
2
+ export { TextArea };
3
+ export * from './types';
@@ -0,0 +1,25 @@
1
+ import { TextareaHTMLAttributes, ChangeEvent, FocusEvent } from 'react';
2
+ export type TextAreaResize = boolean;
3
+ export interface TextAreaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'size' | 'onChange' | 'onFocus' | 'onBlur'> {
4
+ error?: boolean;
5
+ resize?: TextAreaResize;
6
+ placeholder?: string;
7
+ value?: string;
8
+ defaultValue?: string;
9
+ label?: string;
10
+ helperText?: string;
11
+ showCharCount?: boolean;
12
+ floatingLabel?: boolean;
13
+ onChange?: (event: ChangeEvent<HTMLTextAreaElement>) => void;
14
+ onFocus?: (event: FocusEvent<HTMLTextAreaElement>) => void;
15
+ onBlur?: (event: FocusEvent<HTMLTextAreaElement>) => void;
16
+ rows?: number;
17
+ maxLength?: number;
18
+ required?: boolean;
19
+ readOnly?: boolean;
20
+ disabled?: boolean;
21
+ autoFocus?: boolean;
22
+ fluid?: boolean;
23
+ width?: string;
24
+ className?: string;
25
+ }
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ export interface Prop {
3
+ resize: boolean;
4
+ disabled: boolean;
5
+ floatingLabel: boolean;
6
+ isLabelFloated: boolean;
7
+ focused: boolean;
8
+ error: boolean;
9
+ fluid: boolean;
10
+ width?: string;
11
+ className?: string;
12
+ value?: string;
13
+ currentValue: string;
14
+ }
15
+ export declare const generateBaseClasses: (resize: boolean) => string;
16
+ export declare const generateContainerClasses: ({ disabled, floatingLabel, isLabelFloated, focused, error, }: Pick<Prop, "disabled" | "floatingLabel" | "isLabelFloated" | "focused" | "error">) => string;
17
+ export declare const generateWrapperClasses: ({ fluid, width, className, }: Pick<Prop, "fluid" | "width" | "className">) => string;
18
+ export declare const generateWrapperStyle: (width?: string) => React.CSSProperties;
19
+ export declare const getCurrentLength: (value?: string, currentValue?: string) => number;
20
+ export declare const generateFloatingLabelClasses: ({ isLabelFloated, focused, error, }: {
21
+ isLabelFloated: boolean;
22
+ focused: boolean;
23
+ error: boolean;
24
+ }) => string;
25
+ export declare const generateBorderClasses: (focused: boolean, error: boolean) => string;
26
+ export declare const generateNotchWidth: (label?: string, required?: boolean) => number;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import type { AlertDialogProps } from './types';
3
- declare const AlertDialogComponent: ({ title, description, trigger, action, cancel, onAction, onCancel, variant, disabled, }: AlertDialogProps) => React.JSX.Element;
3
+ declare const AlertDialogComponent: ({ title, description, trigger, action, cancel, onAction, onCancel, variant, disabled, open, onOpenChange, }: AlertDialogProps) => React.JSX.Element;
4
4
  export default AlertDialogComponent;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import type { AlertDialogProps } from './types';
3
3
  declare const _default: {
4
4
  title: string;
5
- component: ({ title, description, trigger, action, cancel, onAction, onCancel, variant, disabled, }: AlertDialogProps) => React.JSX.Element;
5
+ component: ({ title, description, trigger, action, cancel, onAction, onCancel, variant, disabled, open, onOpenChange, }: AlertDialogProps) => React.JSX.Element;
6
6
  argTypes: {
7
7
  title: {
8
8
  control: "text";
@@ -1,2 +1,4 @@
1
1
  import AlertDialogComponent from './AlertDialog';
2
2
  export { AlertDialogComponent };
3
+ export * from './const';
4
+ export * from './types';
@@ -1,11 +1,14 @@
1
+ import { ReactNode } from 'react';
1
2
  export interface AlertDialogProps {
2
3
  title: string;
3
4
  description: string;
4
- trigger: string;
5
- action: string;
5
+ trigger: string | ReactNode;
6
+ action: string | ReactNode;
6
7
  cancel?: string;
7
8
  onAction?: () => void;
8
9
  onCancel?: () => void;
9
10
  variant?: 'default' | 'destructive';
10
11
  disabled?: boolean;
12
+ open?: boolean;
13
+ onOpenChange?: (open: boolean) => void;
11
14
  }
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import { FileUploaderProps } from './types';
3
+ declare const FileUploader: FC<FileUploaderProps>;
4
+ export default FileUploader;
@@ -0,0 +1,5 @@
1
+ import { Meta } from '@storybook/react';
2
+ import type { FileUploaderProps } from './types';
3
+ declare const _default: Meta<FileUploaderProps>;
4
+ export default _default;
5
+ export declare const FileUploader: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, FileUploaderProps>;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,19 @@
1
+ export declare const DEFAULT_MAX_SIZE: number;
2
+ export declare const DEFAULT_MAX_FILES = 5;
3
+ export declare const ACCEPTED_FILE_TYPES: {
4
+ IMAGE: string;
5
+ PDF: string;
6
+ DOCUMENT: string;
7
+ ALL: string;
8
+ };
9
+ export declare const FILE_UPLOAD_ERRORS: {
10
+ FILE_TOO_LARGE: string;
11
+ TOO_MANY_FILES: string;
12
+ INVALID_FILE_TYPE: string;
13
+ UPLOAD_FAILED: string;
14
+ };
15
+ export declare const UPLOAD_STATUS: {
16
+ readonly UPLOADING: "uploading";
17
+ readonly SUCCESS: "success";
18
+ readonly ERROR: "error";
19
+ };
@@ -0,0 +1,4 @@
1
+ import FileUploader from './FileUploader';
2
+ export { FileUploader };
3
+ export * from './const';
4
+ export * from './types';
@@ -0,0 +1,32 @@
1
+ export interface FileAction {
2
+ label: string;
3
+ onClick: (file: UploadedFile) => void;
4
+ variant?: 'primary' | 'secondary' | 'tertiary' | 'danger' | 'warning' | 'harford' | 'link';
5
+ icon?: React.ReactNode;
6
+ }
7
+ export interface FileUploaderProps {
8
+ onFilesChange: (files: File[]) => void;
9
+ accept: string;
10
+ multiple?: boolean;
11
+ maxSize?: number;
12
+ maxFiles?: number;
13
+ disabled?: boolean;
14
+ className?: string;
15
+ width?: string;
16
+ children?: React.ReactNode;
17
+ fileActions?: FileAction[];
18
+ showRemoveButton?: boolean;
19
+ }
20
+ export interface FileWithPreview extends File {
21
+ preview?: string;
22
+ }
23
+ export interface UploadedFile {
24
+ id: string;
25
+ file: File;
26
+ name: string;
27
+ size: number;
28
+ type: string;
29
+ preview?: string;
30
+ status: 'uploading' | 'success' | 'error';
31
+ progress?: number;
32
+ }
@@ -0,0 +1,4 @@
1
+ export declare const formatFileSize: (bytes: number) => string;
2
+ export declare const parseAccept: (acceptProp: string) => {
3
+ [x: string]: never[];
4
+ } | undefined;