@digitalpromise/design 4.2.0 → 4.3.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.
@@ -1,4 +1,4 @@
1
- import { ButtonHTMLAttributes } from 'react';
1
+ import type { ButtonHTMLAttributes } from "react";
2
2
  declare const variants: readonly ["primary", "secondary", "tertiary"];
3
3
  declare const states: readonly ["default", "danger", "inverse", "decolor"];
4
4
  type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
@@ -1,4 +1,4 @@
1
- import { FormInputProps, InputPropsWithoutType } from './types';
1
+ import type { FormInputProps, InputPropsWithoutType } from "./types";
2
2
  type CheckboxProps = InputPropsWithoutType & FormInputProps & {
3
3
  label: string;
4
4
  };
@@ -1,5 +1,5 @@
1
- import { ReactElement, ComponentPropsWithRef } from 'react';
2
- import { FormInputProps } from './types';
1
+ import { ReactElement, type ComponentPropsWithRef } from "react";
2
+ import type { FormInputProps } from "./types";
3
3
  interface DropzoneProps extends Omit<ComponentPropsWithRef<"input">, "type">, FormInputProps {
4
4
  instructions?: string;
5
5
  remover?: ReactElement;
@@ -1,4 +1,4 @@
1
- import { FormInputProps } from './types';
1
+ import { FormInputProps } from "./types";
2
2
  interface FormFieldProps<C extends FormInputProps> {
3
3
  Input: React.ComponentType<C>;
4
4
  inputProps: C;
@@ -1,4 +1,4 @@
1
- import { ComponentPropsWithRef } from 'react';
1
+ import { ComponentPropsWithRef } from "react";
2
2
  type FormProps = ComponentPropsWithRef<"form">;
3
3
  export declare const Form: ({ noValidate, className, ...props }: FormProps) => import("react/jsx-runtime").JSX.Element;
4
4
  export {};
@@ -1,9 +1,9 @@
1
- import { Checkbox } from './checkbox';
2
- import { Dropzone, SingleImageDropzone } from './dropzone';
3
- import { Form } from './form';
4
- import { FormField } from './form-field';
5
- import { Select } from './select';
6
- import { TextInput } from './text-input';
7
- import { Textarea } from './textarea';
1
+ import { Checkbox } from "./checkbox";
2
+ import { Dropzone, SingleImageDropzone } from "./dropzone";
3
+ import { Form } from "./form";
4
+ import { FormField } from "./form-field";
5
+ import { Select } from "./select";
6
+ import { TextInput } from "./text-input";
7
+ import { Textarea } from "./textarea";
8
8
  export { Checkbox, Dropzone, SingleImageDropzone, Form, FormField, Select, Textarea, TextInput, };
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import { ComponentPropsWithRef } from 'react';
1
+ import { type ComponentPropsWithRef } from "react";
2
2
  export interface LabelProps extends ComponentPropsWithRef<"label"> {
3
3
  label: string;
4
4
  error?: boolean;
@@ -1,4 +1,4 @@
1
- import { FormInputProps } from './types';
1
+ import type { FormInputProps } from "./types";
2
2
  type ListInputProps = FormInputProps & {
3
3
  onChange?: (list: string[]) => void;
4
4
  defaultValue?: string[];
@@ -1,5 +1,5 @@
1
- import { ComponentPropsWithRef } from 'react';
2
- import { FormInputProps } from './types';
1
+ import { ComponentPropsWithRef } from "react";
2
+ import { FormInputProps } from "./types";
3
3
  export interface SelectProps extends ComponentPropsWithRef<"select">, FormInputProps {
4
4
  options: {
5
5
  value: string;
@@ -1,5 +1,5 @@
1
- import { ComponentPropsWithRef } from 'react';
2
- import { FormInputProps } from './types';
1
+ import type { ComponentPropsWithRef } from "react";
2
+ import type { FormInputProps } from "./types";
3
3
  interface TextInputProps extends ComponentPropsWithRef<"input">, FormInputProps {
4
4
  }
5
5
  export declare const TextInput: ({ error, className, ...props }: TextInputProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
- import { ComponentPropsWithRef } from 'react';
2
- import { FormInputProps } from './types';
1
+ import type { ComponentPropsWithRef } from "react";
2
+ import type { FormInputProps } from "./types";
3
3
  interface TextareaProps extends ComponentPropsWithRef<"textarea">, FormInputProps {
4
4
  }
5
5
  export declare const Textarea: ({ className, error, ...props }: TextareaProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { ComponentPropsWithRef } from 'react';
1
+ import type { ComponentPropsWithRef } from "react";
2
2
  export interface FormInputProps {
3
3
  id?: string;
4
4
  name?: string;
@@ -1,5 +1,5 @@
1
- import { DPGIconName } from '@digitalpromise/icons';
2
- import { ComponentPropsWithRef } from 'react';
1
+ import { type DPGIconName } from "@digitalpromise/icons";
2
+ import { type ComponentPropsWithRef } from "react";
3
3
  interface IconProps extends ComponentPropsWithRef<"svg"> {
4
4
  name: DPGIconName;
5
5
  }
@@ -1,8 +1,8 @@
1
- import { default as Button } from './button';
2
- import { default as Logo } from './logo';
3
- import { default as Pagination } from './pagination';
4
- import { default as Search } from './search';
5
- import { default as Table } from './table';
6
- export type { TableColumn } from './table';
1
+ import { default as Button } from "./button";
2
+ import { default as Logo } from "./logo";
3
+ import { default as Pagination } from "./pagination";
4
+ import { default as Search } from "./search";
5
+ import { default as Table } from "./table";
6
+ export type { TableColumn } from "./table";
7
7
  export { Button, Logo, Pagination, Search, Table };
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { type ReactNode } from "react";
2
2
  export interface TabProps {
3
3
  id: string;
4
4
  label: ReactNode;
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import type { ReactNode } from "react";
2
2
  export type TableColumn<TRow> = {
3
3
  key: string;
4
4
  header: string;
@@ -0,0 +1,64 @@
1
+ import { ComponentPropsWithRef } from 'react';
2
+ import { JSX } from 'react/jsx-runtime';
3
+ import { ReactElement } from 'react';
4
+
5
+ export declare const Checkbox: ({ error, className, label, ...props }: CheckboxProps) => JSX.Element;
6
+
7
+ declare type CheckboxProps = InputPropsWithoutType & FormInputProps & {
8
+ label: string;
9
+ };
10
+
11
+ export declare const Dropzone: ({ children, error, instructions, className, onChange: userOnChange, remover, ...props }: DropzoneProps) => JSX.Element;
12
+
13
+ declare interface DropzoneProps extends Omit<ComponentPropsWithRef<"input">, "type">, FormInputProps {
14
+ instructions?: string;
15
+ remover?: ReactElement;
16
+ }
17
+
18
+ export declare const Form: ({ noValidate, className, ...props }: FormProps) => JSX.Element;
19
+
20
+ export declare const FormField: <P extends FormInputProps>({ Input, inputProps, errorMessage, label, labelClassname, }: FormFieldProps<P>) => JSX.Element;
21
+
22
+ declare interface FormFieldProps<C extends FormInputProps> {
23
+ Input: React.ComponentType<C>;
24
+ inputProps: C;
25
+ errorMessage?: string;
26
+ label: string;
27
+ labelClassname?: string;
28
+ }
29
+
30
+ declare interface FormInputProps {
31
+ id?: string;
32
+ name?: string;
33
+ error?: boolean;
34
+ required?: boolean;
35
+ }
36
+
37
+ declare type FormProps = ComponentPropsWithRef<"form">;
38
+
39
+ declare type InputPropsWithoutType = Omit<ComponentPropsWithRef<"input">, "type">;
40
+
41
+ export declare const Select: ({ options, error, className, ...props }: SelectProps) => JSX.Element;
42
+
43
+ declare interface SelectProps extends ComponentPropsWithRef<"select">, FormInputProps {
44
+ options: {
45
+ value: string;
46
+ label: string;
47
+ }[];
48
+ }
49
+
50
+ export declare const SingleImageDropzone: (props: SingleImageDropzoneProps) => JSX.Element;
51
+
52
+ declare type SingleImageDropzoneProps = Omit<DropzoneProps, "multiple" | "accept" | "children">;
53
+
54
+ export declare const Textarea: ({ className, error, ...props }: TextareaProps) => JSX.Element;
55
+
56
+ declare interface TextareaProps extends ComponentPropsWithRef<"textarea">, FormInputProps {
57
+ }
58
+
59
+ export declare const TextInput: ({ error, className, ...props }: TextInputProps) => JSX.Element;
60
+
61
+ declare interface TextInputProps extends ComponentPropsWithRef<"input">, FormInputProps {
62
+ }
63
+
64
+ export { }
@@ -0,0 +1,60 @@
1
+ import { ButtonHTMLAttributes } from 'react';
2
+ import { JSX } from 'react/jsx-runtime';
3
+ import { ReactNode } from 'react';
4
+
5
+ export declare function Button({ className, variant, state, ...props }: ButtonProps): JSX.Element;
6
+
7
+ declare type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
8
+ variant?: (typeof variants)[number];
9
+ state?: (typeof states)[number];
10
+ };
11
+
12
+ export declare function Logo({ variant, className, }: {
13
+ variant?: LogoVariant;
14
+ className?: string;
15
+ }): JSX.Element | null;
16
+
17
+ declare type LogoVariant = "black" | "white" | "color";
18
+
19
+ export declare function Pagination({ count, limit, pageParamKey, }: PaginationProps): JSX.Element;
20
+
21
+ declare type PaginationProps = {
22
+ count: number;
23
+ limit: number;
24
+ pageParamKey?: string;
25
+ };
26
+
27
+ export declare function Search({ placeholder, className, inputWidth, value, onChange, syncToUrl, id, paramKey, }: SearchProps): JSX.Element;
28
+
29
+ declare type SearchProps = {
30
+ placeholder: string;
31
+ className?: string;
32
+ inputWidth?: number | string;
33
+ value?: string;
34
+ onChange?: (value: string) => void;
35
+ syncToUrl?: boolean;
36
+ id?: string;
37
+ paramKey?: string;
38
+ };
39
+
40
+ declare const states: readonly ["default", "danger", "inverse", "decolor"];
41
+
42
+ export declare function Table<TRow>({ columns, rows, rowKey }: TableProps<TRow>): JSX.Element;
43
+
44
+ export declare type TableColumn<TRow> = {
45
+ key: string;
46
+ header: string;
47
+ headerClassName?: string;
48
+ cellClassName?: string;
49
+ render: (row: TRow) => ReactNode;
50
+ };
51
+
52
+ declare type TableProps<TRow> = {
53
+ columns: TableColumn<TRow>[];
54
+ rows: TRow[];
55
+ rowKey: (row: TRow, index: number) => string;
56
+ };
57
+
58
+ declare const variants: readonly ["primary", "secondary", "tertiary"];
59
+
60
+ export { }
@@ -0,0 +1 @@
1
+ export { }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@digitalpromise/design",
3
3
  "private": false,
4
- "version": "4.2.0",
4
+ "version": "4.3.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "exports": {
@@ -9,7 +9,7 @@
9
9
  "./forms": "./dist/forms.js",
10
10
  "./theme": "./dist/theme.css"
11
11
  },
12
- "types": "./dist/components/index.d.ts",
12
+ "types": "./dist/index.d.ts",
13
13
  "files": [
14
14
  "dist"
15
15
  ],
@@ -17,6 +17,7 @@
17
17
  "@chromatic-com/storybook": "^5.0.1",
18
18
  "@digitalpromise/icons": "^2.6.1",
19
19
  "@eslint/js": "^10.0.1",
20
+ "@microsoft/api-extractor": "^7.57.6",
20
21
  "@storybook/addon-docs": "^10.2.13",
21
22
  "@storybook/addon-links": "^10.2.13",
22
23
  "@storybook/react-vite": "^10.2.13",
@@ -40,8 +41,8 @@
40
41
  "tailwindcss": "^4.2.1",
41
42
  "typescript": "^5.9.3",
42
43
  "typescript-eslint": "^8.56.1",
44
+ "unplugin-dts": "1.0.0-beta.6",
43
45
  "vite": "^7.3.1",
44
- "vite-plugin-dts": "^4.5.4",
45
46
  "vitest": "^4.0.18"
46
47
  },
47
48
  "peerDependencies": {
@@ -61,7 +62,7 @@
61
62
  "prestorybook": "style-dictionary build",
62
63
  "prebuild-storybook": "style-dictionary build",
63
64
  "prebuild": "style-dictionary build",
64
- "build": "tsc && vite build",
65
+ "build": "vite build && tsc",
65
66
  "lint": "eslint ./src --ext ts,tsx",
66
67
  "preview": "vite preview",
67
68
  "storybook": "storybook dev -p 6006",